WO2023231710A1 - Picture processing method and related device - Google Patents

Picture processing method and related device Download PDF

Info

Publication number
WO2023231710A1
WO2023231710A1 PCT/CN2023/092770 CN2023092770W WO2023231710A1 WO 2023231710 A1 WO2023231710 A1 WO 2023231710A1 CN 2023092770 W CN2023092770 W CN 2023092770W WO 2023231710 A1 WO2023231710 A1 WO 2023231710A1
Authority
WO
WIPO (PCT)
Prior art keywords
coefficient
picture file
format
file
decoding
Prior art date
Application number
PCT/CN2023/092770
Other languages
French (fr)
Chinese (zh)
Inventor
赖昌材
郭小东
张海波
钱璟
裘杰
周彦均
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023231710A1 publication Critical patent/WO2023231710A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/18Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a set of transform coefficients
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/20Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding
    • H04N19/21Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using video object coding with binary alpha-plane coding for video objects, e.g. context-based arithmetic encoding [CAE]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/91Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/90Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
    • H04N19/94Vector quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/80Camera processing pipelines; Components thereof
    • H04N23/84Camera processing pipelines; Components thereof for processing colour signals
    • H04N23/85Camera processing pipelines; Components thereof for processing colour signals for matrixing

Definitions

  • the present application relates to the field of computers, and in particular, to an image processing method and related equipment.
  • JPEG joint photographic experts group
  • picture standard picture standard
  • JPEG Joint photographic experts group
  • decoders that implement various technologies from JPEG decoding to display.
  • image files in JPEG format can be encoded into image files that require smaller storage space to achieve a lower space occupancy rate.
  • embodiments of the present application provide a picture processing method and computer equipment, which simplify the process of encoding or decoding picture files in the prior art, thereby making the picture file processing process more flexible and reducing the system cost. Complexity and resource overhead.
  • embodiments of the present application first provide an image processing method (decoding process) for decoding an encoded image file into an RBG format image file for display. It can be applied to the client side to process pictures, and can also be used to the cloud side to process pictures.
  • the method includes: obtaining a first picture file; performing arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain the first The DC coefficient and the first AC coefficient; perform inverse quantization and inverse discrete cosine transformation on the first DC coefficient and the first AC coefficient to obtain a picture file in YUV format; convert the picture file in YUV format into an RGB format Image files.
  • the above picture processing method simplifies the process of secondary decoding (i.e., simplifies the process of decoding the first picture file into a picture file in a format such as JPEG), and simplifies the process of primary decoding (i.e., simplifies the process of decoding the first picture file into a picture file in a format such as JPEG).
  • format image files into RGB format image files That is to say, in the process of decoding the first picture file to obtain the picture file in RGB format, the step of generating picture files in JPEG and other formats is skipped, thereby avoiding unnecessary Huffman encoding operations and decoding operations.
  • the first picture file is obtained by encoding a second picture file
  • the format of the first picture file is different from the format of the second picture file
  • the second picture file The image format of the file is any one of JPEG format, PNG format or GIF format.
  • the first picture file is stored in the memory.
  • the The first picture file can be stored in the local storage, or in the cloud or the storage of other electronic devices.
  • obtaining the first picture file specifically includes receiving the first picture file from the cloud or other electronic devices.
  • the image file in RGB format is used for display. It should be understood that the above method can also be applied in other scenarios other than display that require the use of image files in RGB format.
  • a complete second decoding process can be used to decode the first image file into a JPEG format image file.
  • using different decoding methods can reduce system complexity, improve system performance, and reduce resource utilization efficiency while ensuring function realization.
  • the process of performing inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient to obtain the image file in YUV format does not include: Perform Huffman encoding on the DC coefficient and the first AC coefficient to obtain a picture file in JPEG format; perform Huffman decoding on the picture file in JPEG format to obtain the second DC coefficient and the second AC coefficient; The two DC coefficients and the second AC coefficient are subjected to inverse quantization and inverse discrete cosine transformation to obtain a picture file in YUV format.
  • embodiments of the present application provide an image processing method (encoding process) for encoding an RGB format image file into an image format that requires less storage space and using it for storage. It can be applied to end-side devices or cloud-side devices.
  • the method includes: obtaining an image file in RGB format; converting the image file in RGB format into an image file in YUV format; discretizing the image file in YUV format. Cosine transformation and quantization to obtain a third DC coefficient and a third AC coefficient; performing arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file, the third picture Files are used for storage in memory.
  • the above image processing method simplifies the primary encoding process (i.e., simplifies the process of encoding RGB format image files into JPEG and other format image files), and simplifies the secondary encoding process (i.e., simplifies the process of encoding JPEG format image files)
  • the process of encoding image files in other formats into image files that require less storage space That is to say, in the process of encoding image files in RGB format to obtain image files that require smaller storage space, the step of generating image files in JPEG and other formats is skipped, thereby avoiding unnecessary Huffman encoding operations and decoding operation.
  • the method further includes: performing arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient;
  • the AC coefficients are inversely quantized and inversely discrete cosine transformed to obtain image files in YUV format; the image files in YUV format are converted into image files in RGB format. This step can be used in subsequent scenarios where the third image file needs to be decoded to obtain an RGB format image file, for example, in display scenarios.
  • the method further includes: performing arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient;
  • the coefficients or third AC coefficients are Huffman encoded to obtain image files in JPEG format. This step can be used in subsequent scenarios where the third picture file needs to be decoded to obtain a picture file in a format such as JPEG, for example, in editing, sending, etc. scenarios.
  • using different decoding methods for image files can reduce system complexity, improve system performance, and reduce resource utilization efficiency while ensuring function realization.
  • the third picture file can be stored in the memory.
  • the third picture file may be stored in a local storage, or may be stored in a cloud or the storage of other electronic devices.
  • the method also includes: Send the third picture file to the cloud or other electronic device for storage.
  • arithmetic coding or asymmetric coding is performed on the third DC coefficient and the third AC coefficient to obtain a third picture file, excluding: the third DC coefficient and the third AC coefficient.
  • Huffman encoding is performed on the third AC coefficient to obtain a picture file in JPEG format;
  • Huffman decoding is performed on the picture file in JPEG format to obtain a fourth DC coefficient and a fourth AC coefficient; the fourth DC coefficient and the The fourth AC coefficient is subjected to arithmetic coding or asymmetric coding to obtain the third picture file.
  • the third aspect of the embodiments of the present application provides a computer device, which has a method for implementing the first aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect.
  • Function can be implemented by hardware, or it can be implemented by hardware executing corresponding software.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the fourth aspect of the embodiment of the present application provides a computer device, which may include a memory, a processor, and a bus system.
  • the memory is used to store programs, and the processor is used to call the program stored in the memory to execute the first aspect of the embodiment of the present application. Or any possible implementation method of the first aspect.
  • the fourth aspect of the embodiments of the present application provides a computer-readable storage medium.
  • the computer-readable storage medium stores instructions. When run on a computer, the computer can execute the above-mentioned first aspect, second aspect, and first aspect. any possible implementation of the second aspect, or any possible implementation of the second aspect.
  • the fifth aspect of the embodiment of the present application provides a computer program that, when run on a computer, causes the computer to execute the first aspect, the second aspect, any of the possible implementation methods of the first aspect, or any of the second aspects. possible implementation methods.
  • the sixth aspect of the embodiment of the present application provides a chip.
  • the chip (such as a CPU) includes at least one processor and at least one interface circuit.
  • the interface circuit is coupled to the processor.
  • the at least one interface circuit is used to perform a transceiver function. and sends the instructions to at least one processor.
  • the at least one processor is used to run a computer program or instructions, which has the ability to implement the above-mentioned first aspect, the second aspect, any one of the possible implementation methods of the first aspect, or any one of the second aspect.
  • This function can be implemented by hardware, software, or a combination of hardware and software.
  • the hardware or software includes one or more modules corresponding to the above functions.
  • the interface circuit is used to communicate with other modules outside the chip. For example, the interface circuit can send the dummy file and the second picture file obtained by the processor on the chip to the device on the other side for storage.
  • Figure 1 is a storage system architecture diagram provided by an embodiment of the present application.
  • Figure 2 is a schematic flow chart of the image processing method provided by the embodiment of the present application.
  • FIG. 3 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • FIG. 4 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • Figure 5 is another schematic flow chart of the image processing method provided by the embodiment of the present application.
  • FIG. 6 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • FIG. 7 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • FIG. 8 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • FIG. 9 is another schematic flowchart of the image processing method provided by the embodiment of the present application.
  • Figure 10 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • Figure 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the corresponding device may include one or more units, such as functional units, to perform the one or more described method steps (e.g., one unit performs one or more steps , or a plurality of units, each of which performs one or more of a plurality of steps), even if such unit or units are not explicitly depicted or illustrated in the drawings.
  • units such as functional units
  • the corresponding method may include a step to perform the functionality of the one or more units (e.g., a step to perform the functionality of the one or more units) functionality, or a plurality of steps, each of which performs the functionality of one or more of a plurality of units), even if such one or more steps are not explicitly depicted or illustrated in the drawings.
  • a step to perform the functionality of the one or more units e.g., a step to perform the functionality of the one or more units
  • a plurality of steps each of which performs the functionality of one or more of a plurality of units
  • “at least one” refers to one or more, and “multiple” refers to two or more.
  • “And/or” describes the association of associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A, B can be singular or plural.
  • the character “/” generally indicates that the related objects are in an "or” relationship.
  • “At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items).
  • At least one of a, b, or c can mean: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple .
  • the image processing method provided by the embodiment of the present application can be executed on the terminal side.
  • the end-side device can obtain the first picture file from its own memory or the cloud, and the end-side processor decodes and performs other processing operations on the first picture file, and finally obtains an RGB format picture file for display.
  • the image processing method provided by the embodiment of the present application can be executed on the cloud side.
  • the cloud side device can obtain the first picture file from its own memory, and the cloud side processor decodes the first picture file and performs other processing operations to finally obtain the RGB format picture file, and then converts the RGB format image file into the RGB format picture file.
  • the image processing method provided by the embodiment of the present application can be executed collaboratively through the device and cloud.
  • the cloud-side device can obtain the first image file from its own memory, perform certain processing, and then send the result of an intermediate process to the end-side device, which then performs subsequent processing and finally generates Picture files in RGB format are used for display.
  • the image processing method provided by the embodiment of the present application can be applied to a home storage scenario.
  • the home storage can correspond to the above-mentioned cloud storage. The method is similar and will not be described again.
  • Figure 1 is a storage system architecture diagram provided by the embodiment of the present invention.
  • the storage system includes computing nodes 11, storage nodes 12 and storage media 13.
  • the computing node 11 and the storage node 12 may be physical servers, or may also be virtual machines, Containers and other virtual entities based on general hardware resource abstraction.
  • the storage medium 13 is, for example, a storage medium such as a solid state disk (SSD), a hard disk drive (HDD), a storage class memory (SCM), etc., and the storage medium 13 may be a storage medium.
  • the storage medium local to the node may also be a distributed storage medium connected to the storage node.
  • the computing node 11 can perform data access to the storage node 12, such as writing data, reading data, etc. Specifically, the computing node 11 may send a write request to the storage node 12 to write data.
  • the data to be written in the write request may be, for example, various types of data such as pictures, databases, and texts.
  • the storage node 12 may process the file involved in the write request through the encoding module 121, the decoding module 121, the processing module 123, etc.
  • the encoding module 121, the pseudo file generation module 123, and the decoding module 122 may be in the form of software, hardware, or firmware.
  • One-time encoding in the embodiment of this application refers to the process of encoding an RGB format image file into an image file in a format such as JPEG format, PNG (Portable Network Graphics, PNG) format, or GIF (Graphics Interchange Format, GIF) format.
  • the process can also be called primary compression. This process mainly includes processes such as YUV coding, Discrete Cosine Transform (DCT), quantization, and Huffman coding (Huffman). Each transformation process will be described in detail below. introduction.
  • the embodiments of the present application do not limit the format of the picture file into which the RGB format picture file is encoded.
  • the encoding of the RGB format picture file into the JPEG format picture file is taken as an example to illustrate the one-time encoding process. .
  • One-time encoding in the embodiment of this application refers to the process of encoding image files in JPEG format, PNG format, or GIF format into image files in a format that requires smaller storage space.
  • the embodiment of the present application does not limit the format of the twice-encoded image file.
  • the image format may be the same as or different from the format of the once-encoded image file, but the storage space required is smaller than that of the once-encoded image file.
  • secondary encoding of a picture file in JPEG format is taken as an example to explain the process of secondary encoding.
  • RGB color mode is a color standard in the industry. It is obtained by changing the three color channels of red (R, Red), green (G, Green), and blue (B, Blue) and the superposition of them. Of all kinds of colors, RGB represents the colors of the three channels of red, green, and blue. This standard includes almost all colors that human vision can perceive, and is one of the most widely used color systems. Picture files used for display in display scenarios are usually RGB format picture files.
  • YUV is a color encoding method. Often used in various video processing components. YUV takes into account human perception when encoding photos or videos, allowing for reduced chroma bandwidth. YUV is a type of compiled true-color color space (color space). Y'UV, YUV, YCbCr, YPbPr and other proper nouns can all be called YUV, and they overlap with each other. "Y” represents brightness (Luminance or Luma), which is the grayscale value. "U” and “V” represent chrominance (Chrominance or Chroma), which are used to describe the color and saturation of the image and are used to specify pixels. s color. YUV decoding is the reverse process corresponding to YUV encoding.
  • JPEG Since JPEG only supports the data structure of the YUV color mode and does not support the RGB image data structure, YUV encoding (data conversion of the color mode) is required before subsequent encoding of the RGB format image file.
  • DCT transformation is a process that transforms image signals in the frequency domain and separates high-frequency and low-frequency information. Then the high-frequency part of the image (ie, image details) is compressed to achieve the purpose of compressing the image data. First divide the image into multiple 8*8 matrices. Then perform DCT transformation on each matrix, and obtain a frequency coefficient matrix after transformation. The frequency coefficients in the frequency coefficient matrix are all floating point numbers. Inverse DCT is the inverse process corresponding to the DCT transform.
  • Huffman coding is a type of variable word length coding. This method is completely based on the probability of character occurrence to construct the codeword with the shortest average length of different prefixes. It is also called the best coding or Huffman coding. Huffman decoding is the inverse process corresponding to Huffman coding.
  • Arithmetic coding is a lossless data compression method and an entropy coding method.
  • the difference from other entropy coding methods is that other entropy coding methods usually divide the input message into symbols and then encode each symbol, while arithmetic coding directly encodes the entire input message into a number, which satisfies (0.0 ⁇ n ⁇ 1.0) decimal n.
  • Arithmetic coding can give near-optimal coding results given a set of symbols and symbol probabilities. Compression algorithms that use arithmetic coding usually estimate the probabilities of input symbols before encoding. The more accurate this estimate is, the closer the encoding result is to the optimal result.
  • Arithmetic decoding is the reverse process corresponding to arithmetic encoding.
  • ANS coding is a lossless compression algorithm that has both the compression rate of the AC algorithm and the compression speed of the Huffman algorithm.
  • JPEG joint photographic experts group
  • the system storage space is saved mainly by encoding image files in JPEG format into image files that require smaller storage space.
  • JPEG high-density polyethylene
  • decoders that implement various technologies from JPEG decoding to display.
  • the image files obtained after further encoding the JPEG format image files are usually decoded into JPEG format first. After decoding the image file, use an existing standard decoder to decode the image file in JPEG format and use it in scenes such as display.
  • the whole process is relatively rigid and cumbersome, with high system complexity and high resource overhead.
  • Figure 2 is a schematic flow chart of processing image files in the prior art.
  • the original RGB format image file is obtained through camera shooting or social software reception, and then the RGB format image file is converted into YUV through YUV encoding.
  • format image files then perform DCT transformation and quantization on the YUV format image files, convert the YUV format image files into DC coefficients and AC coefficients, and finally, convert the DC coefficients and AC coefficients into JPEG format images through Huffman coding document.
  • the above process is a one-time encoding process for converting RGB image files into JPEG format image files (here it can be called a complete one-time encoding process).
  • the image file in JPEG format is re-encoded to obtain a re-encoded image file (the figure shows an image file in X format, where X format represents any possible image format).
  • Huffman decoding is first performed on the image file in JPEG format to obtain the tributary coefficients and AC coefficients, and then the DC coefficients and AC coefficients are encoded to obtain the image file after secondary encoding.
  • the above process can be called a complete secondary encoding process.
  • the storage space will store the image files after secondary encoding, instead of storing the original RGB format image files and the once-encoded JPEG format image files. Therefore, the efficiency of storage space usage is greatly improved. .
  • the picture file When the picture file needs to be used for display, it needs to be restored to an RGB format picture file through the process shown by the arrow on the right in Figure 2. Specifically, it is necessary to first decode the image file obtained after secondary encoding to obtain a JPEG format image file, and then decode the JPEG format image file to obtain an RGB format image file.
  • the image file obtained after secondary encoding is decoded to obtain the DC coefficient and the AC coefficient, and then, the DC coefficient and the AC coefficient are obtained.
  • the above process can be called a complete secondary decoding process.
  • Huffman decoding is performed on the JPEG format image file to obtain DC coefficients and AC coefficients, and then, the DC coefficients and AC coefficients are inversely quantized and decoded.
  • DCT transform to obtain an image file in YUV format.
  • Picture files in RGB format can be used for display.
  • Figure 3 is a schematic flow chart of a simplified image processing process.
  • YUV encoding is performed on the RGB format image files to obtain YUV format image files, and then, the YUV format image files are subjected to DCT transformation and Quantize to obtain DC coefficients and AC coefficients. Finally, directly decode the DC coefficients and AC coefficients to obtain X format image files.
  • the system can store image files in X format to improve storage space utilization efficiency.
  • the X format picture file is decoded to obtain the DC coefficients and AC coefficients, and then, the DC coefficients and AC coefficients are inverse quantized and inverse DCT transformed to obtain Obtain the picture file in YUV format. Finally, perform YUV decoding on the picture file in YUV format to obtain the picture file in RGB format.
  • the picture file in RGB format can be used for display.
  • the picture processing flow shown in Figure 3 deletes the redundant Huffman encoding and Huffman decoding processes in the existing technology, and simplifies the primary encoding process, secondary encoding process, primary decoding process and secondary decoding process. By simplifying the decoding and encoding process, redundant operations can be avoided, resource overhead is reduced to a certain extent, and system complexity is reduced.
  • the image processing method corresponds to the steps on the right side of Figure 3, that is, decoding the file obtained by secondary encoding to The process of obtaining image files in RGB format for display.
  • This image processing method can be used in various application scenarios mentioned above. Here, only the terminal side is used as the execution subject to describe the solution in detail. It should be understood that it can also be used in other application scenarios, and the method is basically the same. Please refer to Figure 4 for details.
  • Figure 4 is a schematic flowchart of the image processing method provided by the embodiment of the present application. Specifically, it may include the following steps:
  • the first picture file here corresponds to the X-format picture file in FIG. 3 , that is, the stored picture file, and the first picture file may be stored in the memory.
  • the embodiment of the present application does not limit the format of the first picture file, which may be a private format or a standard format.
  • the first picture file can be obtained through a variety of possible implementation methods.
  • the first picture file can be stored in a local storage.
  • the first picture file can be obtained from the local storage.
  • the first picture file can be stored in a cloud storage, and at this time, the first picture file can be received from the cloud.
  • the first picture file can be stored in other electronic devices (for example, independent memory or other terminal devices). At this time, the first picture file can be received from other electronic devices.
  • the first image file may come from multiple sources.
  • the first picture file can be obtained through the process shown by the arrow on the left in Figure 2, that is, the first picture file is obtained by performing a complete one-time encoding of the picture file in RGB format. It is obtained by obtaining image files in JPEG and other formats, and then performing complete secondary encoding on the image files in JPEG and other formats.
  • the first picture file can be obtained through the process shown by the arrow on the left side of Figure 3, that is, the first picture file is a simplified one-time encoding of the RGB format picture file. It is obtained by obtaining image files in JPEG and other formats, and then performing simplified secondary encoding on the image files in JPEG and other formats.
  • the first picture file can be obtained by encoding a picture file in a format such as JPEG.
  • the embodiment of the present application does not limit the acquisition method of the picture file in a format such as JPEG.
  • the picture files in JPEG and other formats can be obtained through social software, etc., or obtained from the cloud.
  • JPEG and other formats are not limited to JPEG format, and may also be common picture formats such as PNG format or GIF format that can be re-encoded.
  • the embodiment of the present application only takes an image file in JPEG format as an example to describe the image processing method in detail.
  • step 403 the first DC coefficient and the first AC coefficient obtained in step 402 are directly inverse quantized and inverse discrete cosine transformed to obtain a picture file in YUV format.
  • Step 403 is different from the solution in the prior art. It skips the Huffman encoding and Huffman decoding steps and directly performs inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient obtained in step 402 to obtain a picture in YUV format.
  • Step 404 can be implemented through the YUV decoding process, and the resulting image file in RGB format can be used for display or for users to browse.
  • the above image processing method simplifies the redundant steps in the decoding process, makes the decoding process more flexible, reduces system complexity and resource overhead, and also improves the efficiency of image file decoding to a certain extent.
  • Figure 5 takes the first image file as a starting point.
  • the user may wish to convert the A picture file is used for display and other scenes, and the first picture file needs to be converted into an RGB format picture file.
  • the image processing method shown in Figure 4 can be used to convert the first image file into an RGB format image file through a simplified secondary decoding process and a simplified primary decoding process.
  • the user may want to edit the first picture file, or send the first picture file through social applications such as WeChat and Weibo.
  • the first picture file needs to be converted into a picture in a format such as JPEG. document.
  • a complete secondary decoding process can be used to convert the first picture file into a picture file in a format such as JPEG.
  • Adopting different processing methods for image files according to different uses can make the system's management of image files more flexible, further improve system efficiency, reduce system complexity, and improve resource utilization while ensuring the realization of functions.
  • FIG. 6 is a schematic flowchart of an image processing method provided by an embodiment of the present application. Specifically, it may include the following steps:
  • image files in RGB format can be obtained through collection methods such as taking photos, or image files in RGB format can be received from the cloud or other electronic devices.
  • Step 602 may be implemented through a YUV encoding process.
  • the third picture file is used for storage and memory.
  • the third picture file can be stored.
  • the third picture file can be stored in a local memory.
  • the third picture file can be sent to the storage in the cloud for storage.
  • the third picture file can be sent to other electronic devices for storage.
  • step 604 arithmetic coding or asymmetric digital system coding is directly performed on the third DC coefficient and the third AC coefficient obtained in step 603 to obtain the third picture file.
  • Step 604 it is necessary to perform Huffman encoding on the third DC coefficient and the third AC coefficient obtained in step 603 to obtain a picture file in JPEG format, and then perform Huffman decoding on the picture file in JPEG format to obtain the fourth DC coefficient. coefficient and the fourth AC coefficient, and then perform arithmetic coding or asymmetric digital system coding on the fourth DC coefficient and the fourth AC coefficient to obtain the third picture file.
  • Step 604 is different from the solution in the prior art. It skips the Huffman encoding and Huffman decoding steps and directly performs arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient obtained in step 603 to obtain the third picture file. .
  • the above image processing method when the third image needs to be converted into an image file in a format such as RGB, the above image processing method also includes the following steps:
  • Steps 605-607 are optional.
  • the specific implementation methods of steps 605-607 are basically the same as the implementation methods of steps 402-403. To avoid duplication, they will not be described again here.
  • the scenarios in which the third image file needs to be converted into an image file in an RGB or other format include display, etc.
  • Other scenarios that require the use of an image file in an RGB or other format are also possible.
  • the above picture processing method when the third picture needs to be converted into a picture file in a format such as JPEG, the above picture processing method also includes the following steps:
  • Steps 608 and 609 are optional.
  • the specific implementation method of step 608 is basically the same as the implementation method of step 402.
  • Step 609 can be implemented by solutions in the prior art. To avoid repetition, no details will be described here.
  • the scenarios in which the third picture file needs to be converted into a picture file in a format such as JPEG include editing, sending through social applications such as WeChat and Weibo, etc.
  • Other scenarios in which picture files in a format such as JPEG are also possible. .
  • the above image processing method simplifies the redundant steps in the encoding process, makes the encoding process more flexible, reduces system complexity and resource overhead, and also improves the efficiency of image file encoding to a certain extent.
  • image files can be processed in different ways to maximize system processing efficiency.
  • Figure 9 uses an image file in RGB format as a starting point.
  • the user may want to store the image file.
  • the RGB format image file needs to be encoded into an X format image file that requires smaller storage space.
  • the image processing method shown in Figure 6 can be used to convert the RGB format image file into an X format image file through a simplified primary encoding process and a simplified secondary encoding process.
  • the user may want to edit the image file in RGB format, or send the image file through social applications such as WeChat and Weibo.
  • the image file in RGB format needs to be converted into JPEG. Picture files in other formats. At this point, a complete one-pass encoding process can be used.
  • Adopting different processing methods for image files according to different uses can make the system's management of image files more flexible, further improve system efficiency, reduce system complexity, and improve resource utilization while ensuring the realization of functions.
  • the computer device may include handheld terminal devices, such as mobile phones, computers, iPads, etc., and may also include smart wearable devices, such as smart bracelets, smart watches, smart heart rate meters, etc.; it may also include wheeled mobile devices, such as, Vehicles (such as self-driving vehicles), aircraft, robots (such as sweeping robots), etc.
  • vehicles such as self-driving vehicles
  • robots such as sweeping robots
  • this application does not limit the product form of computer equipment, as long as it can be used to implement the image processing method described in this application. All equipment can be called computer equipment.
  • Figure 10 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the computer device 1000 includes: an acquisition module 1003, a decoding module 1002 and a processing module 1002.
  • the acquisition module 1001 is used to acquire the third A picture file;
  • the decoding module 1002 is used to perform arithmetic decoding or ANS decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient;
  • the processing module 1003 is used to perform the first DC coefficient and the first AC coefficient
  • the first AC coefficient is inversely quantized and inversely discrete cosine transformed to obtain an image file in YUV format;
  • the processing module is also used to convert the image file in YUV format into an image file in RGB format.
  • the first picture file is obtained by encoding the second picture file.
  • the format of the first picture file is different from the format of the second picture file.
  • the format of the second picture file is as follows Either:
  • JPEG format JPEG format, PNG format or GIF format.
  • the first picture file is stored in the memory.
  • the image file in RGB format is used for display
  • the acquisition module 1001 is specifically configured to receive the first picture file from the cloud or other electronic devices.
  • the processing module is not used to: perform Huffman coding on the first DC coefficient and the first AC coefficient to obtain a picture file in JPEG format; perform Huffman coding on the picture file in JPEG format. Mann decoding is performed to obtain the second DC coefficient and the second AC coefficient; the second DC coefficient and the second AC coefficient are inversely quantized and inversely discrete cosine transformed to obtain a picture file in YUV format.
  • Figure 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the computer device 1100 includes: an acquisition module 1101, an encoding/decoding module 1102, and a processing module 1103.
  • the acquisition module 1101 is used to Obtain a picture file in RGB format;
  • the processing module 1103 is used to convert the picture file in RGB format into a picture file in YUV format;
  • the processing module 1103 is also used to perform discrete cosine transformation and quantization on the picture file in YUV format to Obtain the third DC coefficient and the third AC coefficient;
  • the encoding/decoding module 1102 is used to perform arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file.
  • Three picture files are used for storage in memory.
  • the encoding/decoding module 1102 is also used to perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient; the processing module 1103 is also used to Perform inverse quantization and inverse discrete cosine transform on the third DC coefficient or the third AC coefficient to obtain the image file in YUV format; the processing module 1103 is also used to convert the image file in YUV format into an image file in RGB format.
  • the encoding/decoding module 1102 is also used to perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient; the encoding/decoding module 1102, It is also used to perform Huffman encoding on the third DC coefficient or the third AC coefficient to obtain a picture file in JPEG format.
  • the computer device 1100 also includes a sending module 1104 for sending the picture file to the cloud or other electronic devices for storage.
  • the encoding/decoding module 1102 is not used to perform Huffman encoding on the third DC coefficient and the third AC coefficient to obtain the image file in JPEG format; it performs Huffman encoding on the image file in JPEG format.
  • Furman decoding is performed to obtain a fourth DC coefficient and a fourth AC coefficient; arithmetic coding or asymmetric coding is performed on the fourth DC coefficient and the fourth AC coefficient to obtain a third picture file.
  • the embodiment of the present application also provides a computer device. Please refer to Figure 12.
  • Figure 12 is a schematic structural diagram of the computer device provided by the embodiment of the present application. For convenience of explanation, only the parts related to the embodiment of the present application are shown. If the specific technical details are not disclosed, please refer to the method section of the embodiments of this application.
  • the computer device 1200 may be deployed with a pair of FIGS. 10 and 11
  • the modules described in the embodiments are used to implement the functions of the computer device 1000 in the embodiment corresponding to FIG. 10 and the functions of the computer device 1100 in the embodiment corresponding to FIG. 11 .
  • the computer device 1200 is implemented by one or more servers.
  • the computer device 1200 may vary greatly due to different configurations or performance, and may include one or more central processing units (CPU) 1222 and memory 1232 , one or more storage media 1230 (eg, one or more mass storage devices) that store applications 1242 or data 1244.
  • the memory 1232 and the storage medium 1230 may be short-term storage or persistent storage.
  • the program stored in the storage medium 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the computer device 1200 .
  • the central processor 1222 may be configured to communicate with the storage medium 1230 and execute a series of instruction operations in the storage medium 1230 on the computer device 1200 .
  • Computer device 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258, and/or, one or more operating systems 1241, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and more.
  • one or more power supplies 1226 such as, Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and more.
  • the central processor 1222 is used to execute the image processing method in the corresponding embodiments of FIG. 4 and FIG. 6 .
  • the central processor 1222 may be used to: obtain a first picture file; perform arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient;
  • the coefficients and the first AC coefficient are inverse quantized and inverse discrete cosine transformed to obtain a YUV format image file; the YUV format image file is converted into an RGB format image file.
  • the central processor 1222 can also be used to: obtain an image file in RGB format; convert the image file in RGB format into an image file in YUV format; perform discrete cosine transformation and quantization on the image file in YUV format to obtain The third DC coefficient and the third AC coefficient; perform arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file, and the third picture file is used for storage in the memory .
  • central processing unit 1222 can also be used to execute any step in the method embodiment corresponding to Figure 4 and Figure 6 in this application.
  • any step in the method embodiment corresponding to Figure 4 and Figure 6 in this application please refer to the description in the method embodiment shown above in this application. No further details will be given here.
  • the image processing device may be a chip.
  • the chip includes: a processing unit and a communication unit.
  • the processing unit may be, for example, a processor.
  • the communication unit may be, for example, an input/output interface, a pin, or a circuit.
  • the processing unit can execute computer execution instructions stored in the storage unit, so that the chip executes the method described in the embodiments shown in FIG. 4 and FIG. 6 .
  • the storage unit is a storage unit within the chip, such as a register, cache, etc.
  • the storage unit may also be a storage unit located outside the chip in the wireless access device, such as Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
  • ROM Read-only memory
  • RAM random access memory
  • the embodiments of the present application also provide a computer-readable storage medium, which stores a program for signal processing. When it is run on a computer, it causes the computer to execute the steps described in the foregoing embodiments. The steps performed by computer equipment.
  • the device embodiments described above are only illustrative.
  • the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separate.
  • the physical unit can be located in one place, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • the connection relationship between modules indicates that there are communication connections between them, which can be specifically implemented as one or more communication buses or signal lines.
  • the present application can be implemented by software plus necessary general hardware.
  • it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, Special memory, special components, etc. can be implemented.
  • all functions performed by computer programs can be easily implemented with corresponding hardware.
  • the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special-purpose circuits. circuit etc.
  • software program implementation is a better implementation in most cases.
  • the computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., including several instructions to make a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in various embodiments of this application.
  • the computer program product includes one or more computer instructions.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transferred from a website, computer, training device, or data
  • the center transmits to another website site, computer, training equipment or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a training device or a data center integrated with one or more available media.
  • the usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, high-density digital video discs (DVD)), or semiconductor media (eg, solid state disks). ,SSD)), etc.

Abstract

Embodiments of the present application disclose a picture processing method and a computer device, which can be used in the field of computer file management, and specifically in a decoding scenario and an encoding scenario of picture files. The method comprises: obtaining a first picture file; performing arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain a first direct current coefficient and a first alternating current coefficient; performing inverse quantization and inverse discrete cosine transform on the first direct current coefficient and the first alternating current coefficient to obtain a picture file in a YUV format; and converting the picture file in the YUV format into a picture file in an RGB format. According to the method, the decoding process of the picture file is simplified, so that the processing procedure of the picture file is more flexible, and the system complexity and resource overhead are reduced.

Description

一种图片的处理方法及相关设备Image processing method and related equipment 技术领域Technical field
本申请涉及计算机领域,尤其涉及一种图片的处理方法及相关设备。The present application relates to the field of computers, and in particular, to an image processing method and related equipment.
背景技术Background technique
随着智能手机为代表的终端的流行,现有智能手机和云存储中媒体类文件(特别是图片)的占比普遍较高,且随着相机像素不断增加,图片分辨率越来越高,每张照片占用的存储空间也越来越大。目前,存储空间不足已成为用户更换手机的主要因素之一,降低图片所需的存储空间,提升存储空间使用效率能够极大提升用户体验及黏性。With the popularity of terminals represented by smartphones, the proportion of media files (especially pictures) in existing smartphones and cloud storage is generally high, and as camera pixels continue to increase, the resolution of pictures is getting higher and higher. Each photo also takes up more and more storage space. At present, insufficient storage space has become one of the main factors for users to change mobile phones. Reducing the storage space required for pictures and improving storage space usage efficiency can greatly improve user experience and stickiness.
JPEG(joint photographic experts group,JPEG)是当前使用最广泛的图片标准(图片格式),针对现有的标准JPEG,已经有标准的解码器实现从JPEG的解码到显示的各种技术。随着技术的发展,为了提升存储空间的利用效率,可将JPEG格式的图片文件编码为所需存储空间更小的图片文件,以实现更低的空间占用率。JPEG (joint photographic experts group, JPEG) is currently the most widely used picture standard (picture format). For the existing standard JPEG, there are already standard decoders that implement various technologies from JPEG decoding to display. With the development of technology, in order to improve the efficiency of storage space utilization, image files in JPEG format can be encoded into image files that require smaller storage space to achieve a lower space occupancy rate.
然而现有技术中,将对JPEG格式的图片文件进行编码后的得到的图片文件进行解码并用于显示等场景中的过程较为死板和繁琐,系统复杂度较高,资源开销较大。However, in the existing technology, the process of decoding the image files obtained after encoding the JPEG format image files and using them for display and other scenarios is relatively rigid and cumbersome, resulting in high system complexity and large resource overhead.
发明内容Contents of the invention
针对上述技术问题,本申请实施例提供了一种图片的处理方法及计算机设备,对现有技术中对图片文件进行编码或者解码的过程进行简化,从而使得图片文件的处理过程更加灵活,降低系统复杂度和资源开销。In view of the above technical problems, embodiments of the present application provide a picture processing method and computer equipment, which simplify the process of encoding or decoding picture files in the prior art, thereby making the picture file processing process more flexible and reducing the system cost. Complexity and resource overhead.
基于此,本申请实施例提供以下技术方案:Based on this, the embodiments of this application provide the following technical solutions:
第一方面,本申请实施例首先提供一种图片处理方法(解码过程),用于将编码后的图片文件解码为RBG格式的图片文件,并用于显示。可应用于端侧对图片进行处理,也可应用于云侧对图片进行处理,该方法包括:获取第一图片文件;对该第一图片文件进行算术解码或非对称数字系统解码以得到第一直流系数和第一交流系数;对该第一直流系数和该第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件;将该YUV格式的图片文件转化为RGB格式的图片文件。In the first aspect, embodiments of the present application first provide an image processing method (decoding process) for decoding an encoded image file into an RBG format image file for display. It can be applied to the client side to process pictures, and can also be used to the cloud side to process pictures. The method includes: obtaining a first picture file; performing arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain the first The DC coefficient and the first AC coefficient; perform inverse quantization and inverse discrete cosine transformation on the first DC coefficient and the first AC coefficient to obtain a picture file in YUV format; convert the picture file in YUV format into an RGB format Image files.
上述图片的处理方法,简化了二次解码的过程(即,简化了将第一图片文件解码为JPEG等格式的图片文件的过程),并简化了一次解码的过程(即,简化了将JPEG等格式的图片文件解码为RGB格式的图片文件的过程)。也就是说,在从第一图片文件解码得到RGB格式的图片文件的过程中,跳过了生成JPEG等格式的图片文件的步骤,从而避免了进行不必要的Huffman编码操作和解码操作。通过简化从第一图片文件到RGB格式的图片文件的解码过程,使得对图片文件的处理过程更加灵活,降低系统复杂度和资源开销。The above picture processing method simplifies the process of secondary decoding (i.e., simplifies the process of decoding the first picture file into a picture file in a format such as JPEG), and simplifies the process of primary decoding (i.e., simplifies the process of decoding the first picture file into a picture file in a format such as JPEG). format image files into RGB format image files). That is to say, in the process of decoding the first picture file to obtain the picture file in RGB format, the step of generating picture files in JPEG and other formats is skipped, thereby avoiding unnecessary Huffman encoding operations and decoding operations. By simplifying the decoding process from the first image file to the RGB format image file, the image file processing process is made more flexible and system complexity and resource overhead are reduced.
在第一方面的一种可能的实现方式中,该第一图片文件是对第二图片文件进行编码得到的,该第一图片文件的格式与该第二图片文件的格式不同,该第二图片文件的图片格式为JPEG格式,PNG格式或者GIF格式中的任意一种。In a possible implementation of the first aspect, the first picture file is obtained by encoding a second picture file, the format of the first picture file is different from the format of the second picture file, and the second picture file The image format of the file is any one of JPEG format, PNG format or GIF format.
在第一方面的一种可能的实现方式中,该第一图片文件存储于存储器中。示例性的,该 第一图片文件可以存储于本地的存储器中,也可以存储于云端或者其他电子设备的存储器中。In a possible implementation of the first aspect, the first picture file is stored in the memory. By way of example, the The first picture file can be stored in the local storage, or in the cloud or the storage of other electronic devices.
在第一方面的一种可能的实现方式中,获取第一图片文件具体为,从云端或者其他电子设备接收该第一图片文件。In a possible implementation of the first aspect, obtaining the first picture file specifically includes receiving the first picture file from the cloud or other electronic devices.
在第一方面的一种可能的实现方式中,该RGB格式的图片文件用于进行显示。应当理解,除显示以外的其他需要用到RGB格式的图片文件的场景中也可以应用上述方法。而对于编辑、发送等其他需要用到JPEG格式的图片文件的场景中,可采用完整的第二解码过程将第一图片文件解码为JPEG格式的图片文件。In a possible implementation of the first aspect, the image file in RGB format is used for display. It should be understood that the above method can also be applied in other scenarios other than display that require the use of image files in RGB format. For editing, sending and other scenarios that require the use of JPEG format image files, a complete second decoding process can be used to decode the first image file into a JPEG format image file.
针对不同的应用场景,采用不同的解码方法,能够在保证功能实现的基础上降低系统复杂度,提升系统性能,降低资源利用效率。For different application scenarios, using different decoding methods can reduce system complexity, improve system performance, and reduce resource utilization efficiency while ensuring function realization.
在第一方面的一种可能的实现方式中,对该第一直流系数和该第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件的过程,不包括:对该第一直流系数和该第一交流系数进行哈夫曼编码以得到JPEG格式的图片文件;对该JPEG格式的图片文件进行哈夫曼解码以得到第二直流系数和第二交流系数;对该第二直流系数和该第二交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。In a possible implementation of the first aspect, the process of performing inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient to obtain the image file in YUV format does not include: Perform Huffman encoding on the DC coefficient and the first AC coefficient to obtain a picture file in JPEG format; perform Huffman decoding on the picture file in JPEG format to obtain the second DC coefficient and the second AC coefficient; The two DC coefficients and the second AC coefficient are subjected to inverse quantization and inverse discrete cosine transformation to obtain a picture file in YUV format.
第二方面,本申请实施例提供一种图片处理方法(编码过程),用于将RGB格式的图片文件编码为所需存储空间更小的图片格式,并用于存储。可应用于端侧设备,也可应用于云侧设备,该方法包括:获取RGB格式的图片文件;将该RGB格式的图片文件转化为YUV格式的图片文件;对该YUV格式的图片文件进行离散余弦变换和量化,以得到第三直流系数和第三交流系数;对该第三直流系数和该第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件,该第三图片文件用于存储于存储器中。In the second aspect, embodiments of the present application provide an image processing method (encoding process) for encoding an RGB format image file into an image format that requires less storage space and using it for storage. It can be applied to end-side devices or cloud-side devices. The method includes: obtaining an image file in RGB format; converting the image file in RGB format into an image file in YUV format; discretizing the image file in YUV format. Cosine transformation and quantization to obtain a third DC coefficient and a third AC coefficient; performing arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file, the third picture Files are used for storage in memory.
上述图片的处理方法,简化了一次编码的过程(即,简化了将RGB格式的图片文件编码为JPEG等格式的图片文件的过程),并简化了二次编码的过程(即,简化了将JPEG等格式的图片文件编码为所需存储空间更小的图片文件的过程)。也就是说,在从RGB格式的图片文件编码得到所需存储空间更小的图片文件的过程中,跳过了生成JPEG等格式的图片文件的步骤,从而避免了进行不必要的Huffman编码操作和解码操作。通过简化从RGB格式的图片文件到所需存储空间更小的图片文件的解码过程,使得对图片文件的处理过程更加灵活,降低系统复杂度和资源开销。The above image processing method simplifies the primary encoding process (i.e., simplifies the process of encoding RGB format image files into JPEG and other format image files), and simplifies the secondary encoding process (i.e., simplifies the process of encoding JPEG format image files) The process of encoding image files in other formats into image files that require less storage space). That is to say, in the process of encoding image files in RGB format to obtain image files that require smaller storage space, the step of generating image files in JPEG and other formats is skipped, thereby avoiding unnecessary Huffman encoding operations and decoding operation. By simplifying the decoding process from RGB format image files to image files requiring smaller storage space, the processing of image files is made more flexible and system complexity and resource overhead are reduced.
在第二方面的一种可能的实现方式中,该方法还包括:对第三图片文件进行算术解码或者非对称解码以得到第三直流系数或第三交流系数;对第三直流系数或第三交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件;将YUV格式的图片文件转化为RGB格式的图片文件。该步骤可用于后续需要将第三图片文件解码得到RGB格式的图片文件的场景中,例如,显示等场景。In a possible implementation of the second aspect, the method further includes: performing arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient; The AC coefficients are inversely quantized and inversely discrete cosine transformed to obtain image files in YUV format; the image files in YUV format are converted into image files in RGB format. This step can be used in subsequent scenarios where the third image file needs to be decoded to obtain an RGB format image file, for example, in display scenarios.
在第二方面的一种可能的实现方式中,该方法还包括:对该第三图片文件进行算术解码或者非对称解码以得到该第三直流系数或该第三交流系数;对该第三直流系数或第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件。该步骤可用于后续需要将第三图片文件解码得到JPEG等格式的图片文件的场景中,例如,编辑、发送等场景。In a possible implementation of the second aspect, the method further includes: performing arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient; The coefficients or third AC coefficients are Huffman encoded to obtain image files in JPEG format. This step can be used in subsequent scenarios where the third picture file needs to be decoded to obtain a picture file in a format such as JPEG, for example, in editing, sending, etc. scenarios.
针对不同应用场景的需求,对图片文件采用不同的解码方法,能够在保证功能实现的基础上降低系统复杂度,提升系统性能,降低资源利用效率。According to the needs of different application scenarios, using different decoding methods for image files can reduce system complexity, improve system performance, and reduce resource utilization efficiency while ensuring function realization.
在第二方面的一种可能的实现方式中,该第三图片文件可用于存储于存储器中。示例性的,可该第三图片文件存储于本地的存储器中,也可以存储于云端或者其他电子设备的存储器中。在将第三图片文件存储于云端或者其他电子设备的存储器的场景中,该方法还包括: 将该第三图片文件发送至云端或者其他电子设备进行存储。In a possible implementation of the second aspect, the third picture file can be stored in the memory. For example, the third picture file may be stored in a local storage, or may be stored in a cloud or the storage of other electronic devices. In the scenario of storing the third picture file in the cloud or the memory of other electronic devices, the method also includes: Send the third picture file to the cloud or other electronic device for storage.
在第二方面的一种可能的实现方式中,对该第三直流系数和该第三交流系数进行算术编码或者非对称编码,以得到第三图片文件,不包括:对该第三直流系数和该第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件;对该JPEG格式的图片文件进行哈夫曼解码以得到第四直流系数和第四交流系数;对该第四直流系数和该第四交流系数进行算术编码或非对称编码以得到第三图片文件。In a possible implementation of the second aspect, arithmetic coding or asymmetric coding is performed on the third DC coefficient and the third AC coefficient to obtain a third picture file, excluding: the third DC coefficient and the third AC coefficient. Huffman encoding is performed on the third AC coefficient to obtain a picture file in JPEG format; Huffman decoding is performed on the picture file in JPEG format to obtain a fourth DC coefficient and a fourth AC coefficient; the fourth DC coefficient and the The fourth AC coefficient is subjected to arithmetic coding or asymmetric coding to obtain the third picture file.
本申请实施例第三方面提供一种计算机设备,该计算机设备具有实现上述第一方面、第二方面、第一方面任意一种可能实现方式、或第二方面任意一种可能实现方式的方法的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块。The third aspect of the embodiments of the present application provides a computer device, which has a method for implementing the first aspect, the second aspect, any possible implementation manner of the first aspect, or any possible implementation manner of the second aspect. Function. This function can be implemented by hardware, or it can be implemented by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
本申请实施例第四方面提供一种计算机设备,可以包括存储器、处理器以及总线系统,其中,存储器用于存储程序,处理器用于调用该存储器中存储的程序以执行本申请实施例第一方面或第一方面任意一种可能实现方式的方法。The fourth aspect of the embodiment of the present application provides a computer device, which may include a memory, a processor, and a bus system. The memory is used to store programs, and the processor is used to call the program stored in the memory to execute the first aspect of the embodiment of the present application. Or any possible implementation method of the first aspect.
本申请实施例第四方面提供一种计算机可读存储介质,该计算机可读存储介质中存储有指令,当其在计算机上运行时,使得计算机可以执行上述第一方面、第二方面、第一方面任意一种可能实现方式、或第二方面任意一种可能实现方式的方法。The fourth aspect of the embodiments of the present application provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When run on a computer, the computer can execute the above-mentioned first aspect, second aspect, and first aspect. any possible implementation of the second aspect, or any possible implementation of the second aspect.
本申请实施例第五方面提供了一种计算机程序,当其在计算机上运行时,使得计算机执行上述第一方面、第二方面、第一方面任意一种可能实现方式、或第二方面任意一种可能实现方式的方法。The fifth aspect of the embodiment of the present application provides a computer program that, when run on a computer, causes the computer to execute the first aspect, the second aspect, any of the possible implementation methods of the first aspect, or any of the second aspects. possible implementation methods.
本申请实施例第六方面提供了一种芯片,该芯片(如,CPU)包括至少一个处理器和至少一个接口电路,该接口电路和该处理器耦合,至少一个接口电路用于执行收发功能,并将指令发送给至少一个处理器,至少一个处理器用于运行计算机程序或指令,其具有实现如上述第一方面、第二方面、第一方面任意一种可能实现方式、或第二方面任意一种可能实现方式的方法的功能,该功能可以通过硬件实现,也可以通过软件实现,还可以通过硬件和软件组合实现,该硬件或软件包括一个或多个与上述功能相对应的模块。此外,该接口电路用于与该芯片之外的其它模块进行通信,例如,该接口电路可将芯片上处理器得到的伪文件和第二图片文件发送给另一侧设备进行保存。The sixth aspect of the embodiment of the present application provides a chip. The chip (such as a CPU) includes at least one processor and at least one interface circuit. The interface circuit is coupled to the processor. The at least one interface circuit is used to perform a transceiver function. and sends the instructions to at least one processor. The at least one processor is used to run a computer program or instructions, which has the ability to implement the above-mentioned first aspect, the second aspect, any one of the possible implementation methods of the first aspect, or any one of the second aspect. This function can be implemented by hardware, software, or a combination of hardware and software. The hardware or software includes one or more modules corresponding to the above functions. In addition, the interface circuit is used to communicate with other modules outside the chip. For example, the interface circuit can send the dummy file and the second picture file obtained by the processor on the chip to the device on the other side for storage.
本申请实施例第二到第六方面能够实现如第一方面所述的有益效果,为避免重复,此处不再进行赘述。The second to sixth aspects of the embodiments of the present application can achieve the beneficial effects described in the first aspect. To avoid repetition, they will not be described again here.
附图说明Description of the drawings
图1为本申请实施例提供的一个存储系统架构图;Figure 1 is a storage system architecture diagram provided by an embodiment of the present application;
图2为本申请实施例提供的图片处理方法的一个流程示意图;Figure 2 is a schematic flow chart of the image processing method provided by the embodiment of the present application;
图3为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 3 is another schematic flowchart of the image processing method provided by the embodiment of the present application;
图4为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 4 is another schematic flowchart of the image processing method provided by the embodiment of the present application;
图5为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 5 is another schematic flow chart of the image processing method provided by the embodiment of the present application;
图6为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 6 is another schematic flowchart of the image processing method provided by the embodiment of the present application;
图7为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 7 is another schematic flowchart of the image processing method provided by the embodiment of the present application;
图8为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 8 is another schematic flowchart of the image processing method provided by the embodiment of the present application;
图9为本申请实施例提供的图片处理方法的另一个流程示意图;Figure 9 is another schematic flowchart of the image processing method provided by the embodiment of the present application;
图10为本申请实施例提供的计算机设备的一种结构示意图; Figure 10 is a schematic structural diagram of a computer device provided by an embodiment of the present application;
图11是本申请实施例提供的计算机设备的一种结构示意图;Figure 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application;
图12是本申请实施例提供的计算机设备的一种结构示意图。Figure 12 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
具体实施方式Detailed ways
下面结合本发明实施例中的附图对本发明实施例进行描述。以下描述中,示出本发明实施例的具体方面或可使用本发明实施例的具体方面的附图。应理解,本发明实施例可在其它方面中使用,并可包括附图中未描绘的结构或逻辑变化。因此,以下详细描述不应以限制性的意义来理解,且本发明的范围由所附权利要求书界定。例如,应理解,结合所描述方法的揭示内容可以同样适用于用于执行所述方法的对应设备或系统,且反之亦然。例如,如果描述一个或多个具体方法步骤,则对应的设备可以包含如功能单元等一个或多个单元,来执行所描述的一个或多个方法步骤(例如,一个单元执行一个或多个步骤,或多个单元,其中每个都执行多个步骤中的一个或多个),即使附图中未明确描述或说明这种一个或多个单元。另一方面,例如,如果基于如功能单元等一个或多个单元描述具体装置,则对应的方法可以包含一个步骤来执行一个或多个单元的功能性(例如,一个步骤执行一个或多个单元的功能性,或多个步骤,其中每个执行多个单元中一个或多个单元的功能性),即使附图中未明确描述或说明这种一个或多个步骤。进一步,应理解的是,除非另外明确提出,本文中所描述的各示例性实施例和/或方面的特征可以相互组合。The embodiments of the present invention will be described below with reference to the drawings in the embodiments of the present invention. In the following description, specific aspects of embodiments of the invention are shown or may be used in the accompanying drawings. It is to be understood that embodiments of the invention may be utilized in other aspects and may involve structural or logical changes not depicted in the drawings. Accordingly, the following detailed description is not to be taken in a limiting sense, and the scope of the invention is defined by the appended claims. For example, it should be understood that disclosure in connection with the described methods may equally apply to corresponding devices or systems for performing the methods, and vice versa. For example, if one or more specific method steps are described, the corresponding device may include one or more units, such as functional units, to perform the one or more described method steps (e.g., one unit performs one or more steps , or a plurality of units, each of which performs one or more of a plurality of steps), even if such unit or units are not explicitly depicted or illustrated in the drawings. On the other hand, for example, if a specific apparatus is described based on one or more units such as functional units, the corresponding method may include a step to perform the functionality of the one or more units (e.g., a step to perform the functionality of the one or more units) functionality, or a plurality of steps, each of which performs the functionality of one or more of a plurality of units), even if such one or more steps are not explicitly depicted or illustrated in the drawings. Further, it should be understood that features of various exemplary embodiments and/or aspects described herein may be combined with each other unless expressly stated otherwise.
本发明实施例中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B的情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),可以表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c可以是单个,也可以是多个。In the embodiment of the present invention, "at least one" refers to one or more, and "multiple" refers to two or more. "And/or" describes the association of associated objects, indicating that there can be three relationships, for example, A and/or B, which can mean: A exists alone, A and B exist simultaneously, and B exists alone, where A, B can be singular or plural. The character "/" generally indicates that the related objects are in an "or" relationship. "At least one of the following" or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items). For example, at least one of a, b, or c can mean: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c can be single or multiple .
本发明的实施方式部分使用的术语仅用于对本发明的具体实施例进行解释,而非旨在限定本发明。The terms used in the embodiments of the present invention are only used to explain specific embodiments of the present invention and are not intended to limit the present invention.
首先对本申请实施例提供的图片处理方法所涉及的应用场景进行介绍。在一种可能的实现方式中,本申请实施例提供的图片处理方法可在端侧执行。示例性的,端侧设备可以从自身的存储器或者云端获取第一图片文件,由端侧的处理器对第一图片文件进行解码及其他处理操作,最终得到RGB格式的图片文件用于显示。在一种可能的实现方式中,本申请实施例提供的图片处理方法可在云侧执行。示例性的,云侧设备可以从自身的存储器中获取第一图片文件,由云侧的处理器对第一图片文件进行解码及其他处理操作,最终得到RGB格式的图片文件,再将RGB格式的图片发送给端侧用于显示。在一种可能的实现方式中,本申请实施例提供的图片处理方法可通过端云协同执行。示例性的,云侧设备可以从自身的存储器中获取第一图片文件,并进行一定的处理,再将某个中间过程的结果发送给端侧设备,由端侧设备进行后续处理,并最终生成RGB格式的图片文件用于显示。在一种可能的实现方式中,本申请实施例提供的图片处理方法可应用于家庭存储的场景中,此时,家庭存储可对应于上述云侧存储,其方法类似,不再进行赘述。First, the application scenarios involved in the image processing method provided by the embodiments of this application are introduced. In a possible implementation, the image processing method provided by the embodiment of the present application can be executed on the terminal side. For example, the end-side device can obtain the first picture file from its own memory or the cloud, and the end-side processor decodes and performs other processing operations on the first picture file, and finally obtains an RGB format picture file for display. In a possible implementation, the image processing method provided by the embodiment of the present application can be executed on the cloud side. For example, the cloud side device can obtain the first picture file from its own memory, and the cloud side processor decodes the first picture file and performs other processing operations to finally obtain the RGB format picture file, and then converts the RGB format image file into the RGB format picture file. The picture is sent to the client for display. In a possible implementation manner, the image processing method provided by the embodiment of the present application can be executed collaboratively through the device and cloud. For example, the cloud-side device can obtain the first image file from its own memory, perform certain processing, and then send the result of an intermediate process to the end-side device, which then performs subsequent processing and finally generates Picture files in RGB format are used for display. In a possible implementation, the image processing method provided by the embodiment of the present application can be applied to a home storage scenario. In this case, the home storage can correspond to the above-mentioned cloud storage. The method is similar and will not be described again.
其次,对本申请实施例提供的系统架构进行介绍,具体请参阅图1,图1为本发明实施例提供的存储系统架构图。如图1所示,存储系统中包括计算节点11、存储节点12和存储介质13。其中,所述计算节点11和存储节点12可以为物理服务器,或者也可以为虚拟机、 容器等基于通用硬件资源抽象的虚拟实体。所述存储介质13例如为固态硬盘(Solid State Disk,SSD)、硬盘(hard disk drive,HDD)、存储级内存(Storage class memory,SCM)等存储介质,并且,所述存储介质13可以为存储节点本地的存储介质,也可以为与存储节点连接的分布式的存储介质。Secondly, the system architecture provided by the embodiment of the present application is introduced. For details, please refer to Figure 1. Figure 1 is a storage system architecture diagram provided by the embodiment of the present invention. As shown in Figure 1, the storage system includes computing nodes 11, storage nodes 12 and storage media 13. Wherein, the computing node 11 and the storage node 12 may be physical servers, or may also be virtual machines, Containers and other virtual entities based on general hardware resource abstraction. The storage medium 13 is, for example, a storage medium such as a solid state disk (SSD), a hard disk drive (HDD), a storage class memory (SCM), etc., and the storage medium 13 may be a storage medium. The storage medium local to the node may also be a distributed storage medium connected to the storage node.
计算节点11可对存储节点12进行数据访问,例如写数据、读数据等。具体是,计算节点11可向存储节点12发送写请求以写入数据,该写请求的待写数据例如可以为图片、数据库、文本等各种类型的数据。存储节点12在接收到写请求之后,可通过编码模块121、解码模块121、处理模块123等对写请求所涉及的文件进行处理。编码模块121、伪文件生成模块123、解码模块122可以为软件、硬件或者固件的形式。The computing node 11 can perform data access to the storage node 12, such as writing data, reading data, etc. Specifically, the computing node 11 may send a write request to the storage node 12 to write data. The data to be written in the write request may be, for example, various types of data such as pictures, databases, and texts. After receiving the write request, the storage node 12 may process the file involved in the write request through the encoding module 121, the decoding module 121, the processing module 123, etc. The encoding module 121, the pseudo file generation module 123, and the decoding module 122 may be in the form of software, hardware, or firmware.
为了方便理解,对本申请实施例所涉及的术语进行简单的介绍,由于下列编码过程均为业内通用的编码过程,对其具体的实现方式本申请实施例不再进行赘述。In order to facilitate understanding, the terms involved in the embodiments of the present application are briefly introduced. Since the following encoding processes are all common encoding processes in the industry, the specific implementation methods will not be described again in the embodiments of the present application.
1.一次编码1. Encode once
本申请实施例中的一次编码是指将RGB格式的图片文件编码为JPEG格式、PNG(Portable Network Graphics,PNG)格式或者GIF(Graphics Interchange Format,GIF)格式等格式的图片文件的过程,一次编码的过程也可称为一次压缩,该过程中主要包括YUV编码、离散余弦变换(Discrete Cosine Transform,DCT)、量化、和哈夫曼编码(Huffman)等过程,下面将对每一个变换过程进行详细的介绍。本申请实施例中不限定将RGB格式的图片文件编码为何种格式的图片文件,本申请实施例中以将RGB格式的图片文件编码为JPEG格式的图片文件为例,对一次编码的过程进行说明。One-time encoding in the embodiment of this application refers to the process of encoding an RGB format image file into an image file in a format such as JPEG format, PNG (Portable Network Graphics, PNG) format, or GIF (Graphics Interchange Format, GIF) format. One-time encoding The process can also be called primary compression. This process mainly includes processes such as YUV coding, Discrete Cosine Transform (DCT), quantization, and Huffman coding (Huffman). Each transformation process will be described in detail below. introduction. The embodiments of the present application do not limit the format of the picture file into which the RGB format picture file is encoded. In the embodiment of the present application, the encoding of the RGB format picture file into the JPEG format picture file is taken as an example to illustrate the one-time encoding process. .
2.二次编码2. Secondary encoding
本申请实施例中的一次编码是指将JPEG格式、PNG格式或者GIF格式等格式的图片文件编码为所需存储空间更小的格式的图片文件的过程。本申请实施例不限定二次编码后的图片文件的格式,该图片格式可以与一次编码后的图片文件的格式相同,也可以不同,但其所需的存储空间小于一次编码后的图片文件。本申请实施例中以对JPEG格式的图片文件进行二次编码为例,对二次编码的过程进行说明。One-time encoding in the embodiment of this application refers to the process of encoding image files in JPEG format, PNG format, or GIF format into image files in a format that requires smaller storage space. The embodiment of the present application does not limit the format of the twice-encoded image file. The image format may be the same as or different from the format of the once-encoded image file, but the storage space required is smaller than that of the once-encoded image file. In the embodiment of this application, secondary encoding of a picture file in JPEG format is taken as an example to explain the process of secondary encoding.
3.RGB3.RGB
RGB色彩模式是工业界的一种颜色标准,是通过对红(R,Red)、绿(G,Green)、蓝(B,Blue)三个颜色通道的变化以及它们相互之间的叠加来得到各式各样的颜色的,RGB即是代表红、绿、蓝三个通道的颜色,这个标准几乎包括了人类视力所能感知的所有颜色,是运用最广的颜色系统之一。在显示场景中用于显示的图片文件通常为RGB格式的图片文件。RGB color mode is a color standard in the industry. It is obtained by changing the three color channels of red (R, Red), green (G, Green), and blue (B, Blue) and the superposition of them. Of all kinds of colors, RGB represents the colors of the three channels of red, green, and blue. This standard includes almost all colors that human vision can perceive, and is one of the most widely used color systems. Picture files used for display in display scenarios are usually RGB format picture files.
4.YUV4.YUV
YUV,是一种颜色编码方法。常使用在各个视频处理组件中。YUV在对照片或视频编码时,考虑到人类的感知能力,允许降低色度的带宽。YUV是编译true-color颜色空间(color space)的种类,Y'UV、YUV、YCbCr、YPbPr等专有名词都可以称为YUV,彼此有重叠。“Y”表示明亮度(Luminance或Luma),也就是灰阶值,“U”和“V”表示的则是色度(Chrominance或Chroma),作用是描述影像色彩及饱和度,用于指定像素的颜色。YUV解码是与YUV编码相对应的逆过程。YUV is a color encoding method. Often used in various video processing components. YUV takes into account human perception when encoding photos or videos, allowing for reduced chroma bandwidth. YUV is a type of compiled true-color color space (color space). Y'UV, YUV, YCbCr, YPbPr and other proper nouns can all be called YUV, and they overlap with each other. "Y" represents brightness (Luminance or Luma), which is the grayscale value. "U" and "V" represent chrominance (Chrominance or Chroma), which are used to describe the color and saturation of the image and are used to specify pixels. s color. YUV decoding is the reverse process corresponding to YUV encoding.
由于JPEG只支持YUV颜色模式的数据结构,而不支持RGB图像数据结构,所以在将RGB格式的图片文件进行后续编码之前,需要进行YUV编码(对颜色模式进行数据转换)。Since JPEG only supports the data structure of the YUV color mode and does not support the RGB image data structure, YUV encoding (data conversion of the color mode) is required before subsequent encoding of the RGB format image file.
5.DCT 5.DCT
DCT变换是将图像信号在频率域上进行变换,分离出高频和低频信息的处理过程。然后再对图像的高频部分(即图像细节)进行压缩,以达到压缩图像数据的目的。首先将图像划分为多个8*8的矩阵。然后对每一个矩阵作DCT变换,变换后得到一个频率系数矩阵,频率系数矩阵中的频率系数都是浮点数。反DCT是与DCT变换相对应的逆过程。DCT transformation is a process that transforms image signals in the frequency domain and separates high-frequency and low-frequency information. Then the high-frequency part of the image (ie, image details) is compressed to achieve the purpose of compressing the image data. First divide the image into multiple 8*8 matrices. Then perform DCT transformation on each matrix, and obtain a frequency coefficient matrix after transformation. The frequency coefficients in the frequency coefficient matrix are all floating point numbers. Inverse DCT is the inverse process corresponding to the DCT transform.
6.量化6.Quantification
量化由于在后续编码过程中使用的码本都是整数,因此需要对变换后的频率系数进行量化,将之转换为整数。反量化是与量化相对应的逆过程。Quantization Since the codebooks used in the subsequent encoding process are all integers, it is necessary to quantize the transformed frequency coefficients and convert them into integers. Inverse quantization is the reverse process corresponding to quantization.
7.哈夫曼(Huffman)编码7. Huffman coding
哈夫曼编码是可变字长编码的一种,该方法完全依据字符出现概率来构造异字头的平均长度最短的码字,也称之为最佳编码或者霍夫曼编码。哈夫曼解码是与哈夫曼编码相对应的逆过程。Huffman coding is a type of variable word length coding. This method is completely based on the probability of character occurrence to construct the codeword with the shortest average length of different prefixes. It is also called the best coding or Huffman coding. Huffman decoding is the inverse process corresponding to Huffman coding.
8.算术编码8. Arithmetic coding
算术编码是一种无损数据压缩方法,也是一种熵编码的方法。和其它熵编码方法不同的地方在于,其他的熵编码方法通常是把输入的消息分割为符号,然后对每个符号进行编码,而算术编码是直接把整个输入的消息编码为一个数,一个满足(0.0≤n<1.0)的小数n。在给定符号集和符号概率的情况下,算术编码可以给出接近最优的编码结果。使用算术编码的压缩算法通常先要对输入符号的概率进行估计,然后再编码。这个估计越准,编码结果就越接近最优的结果。算术解码是与算术编码相对应的逆过程。Arithmetic coding is a lossless data compression method and an entropy coding method. The difference from other entropy coding methods is that other entropy coding methods usually divide the input message into symbols and then encode each symbol, while arithmetic coding directly encodes the entire input message into a number, which satisfies (0.0≤n<1.0) decimal n. Arithmetic coding can give near-optimal coding results given a set of symbols and symbol probabilities. Compression algorithms that use arithmetic coding usually estimate the probabilities of input symbols before encoding. The more accurate this estimate is, the closer the encoding result is to the optimal result. Arithmetic decoding is the reverse process corresponding to arithmetic encoding.
9.非对称数字系统(Asymmetric Numeral Systems,ANS)编码9. Asymmetric Numeral Systems (ANS) encoding
ANS编码是一个既有AC算法的压缩率又有Huffman算法的压缩速度的无损压缩算法。ANS coding is a lossless compression algorithm that has both the compression rate of the AC algorithm and the compression speed of the Huffman algorithm.
随着智能手机为代表的终端的流行,现有智能手机和云存储中媒体类文件(特别是图片)的占比普遍较高,且随着相机像素不断增加,图片分辨率越来越高,每张照片占用的存储空间也越来越大。目前,存储空间不足已成为用户更换手机的主要因素之一,降低图片所需的存储空间,提升存储空间使用效率能够极大提升用户体验及黏性。JPEG(joint photographic experts group,JPEG)是当前使用最广泛的图片标准(图片格式),然而,JPEG格式的图片文件所需的存储空间较大,存储大量的JPEG格式图片容易导致终端或者云端的存储空间不足的问题。With the popularity of terminals represented by smartphones, the proportion of media files (especially pictures) in existing smartphones and cloud storage is generally high, and as camera pixels continue to increase, the resolution of pictures is getting higher and higher. Each photo also takes up more and more storage space. At present, insufficient storage space has become one of the main factors for users to change mobile phones. Reducing the storage space required for pictures and improving storage space usage efficiency can greatly improve user experience and stickiness. JPEG (joint photographic experts group, JPEG) is currently the most widely used picture standard (picture format). However, JPEG format picture files require a large storage space, and storing a large number of JPEG format pictures can easily lead to terminal or cloud storage Insufficient space problem.
目前比较流行的现有技术中,主要通过将JPEG格式的图片文件编码为所需存储空间更小的图片文件以起到节约系统存储空间的效果。针对现有的标准JPEG,已经有标准的解码器实现从JPEG的解码到显示的各种技术,而针对JPEG格式的图片文件进行进一步编码后得到的图片文件,通常先将其解码为JPEG格式的图片文件后,再用已有的标准的解码器对JPEG格式的图片文件进行解码,并用于显示等场景中。整个过程较为死板和繁琐,系统复杂度较高,资源开销较大。Among the currently popular technologies, the system storage space is saved mainly by encoding image files in JPEG format into image files that require smaller storage space. For the existing standard JPEG, there are already standard decoders that implement various technologies from JPEG decoding to display. The image files obtained after further encoding the JPEG format image files are usually decoded into JPEG format first. After decoding the image file, use an existing standard decoder to decode the image file in JPEG format and use it in scenes such as display. The whole process is relatively rigid and cumbersome, with high system complexity and high resource overhead.
具体的,请参阅图2,图2为现有技术中对图片文件进行处理的一个流程示意图。现有技术中,如图2中左侧箭头所示,首先,通过相机拍摄或者社交软件接收等方式获取到原始RGB格式的图片文件后,然后,通过YUV编码将RGB格式的图片文件转换为YUV格式的图片文件,接着对YUV格式的图片文件进行DCT变换和量化,将YUV格式的图片文件转换为直流系数和交流系数,最后,再通过Huffman编码将直流系数和交流系数转换为JPEG格式的图片文件。上述过程为将RGB图片文件转化为JPEG格式的图片文件的一次编码的过程(这里可称为完整的一次编码过程)。 Specifically, please refer to Figure 2, which is a schematic flow chart of processing image files in the prior art. In the existing technology, as shown by the arrow on the left in Figure 2, first, the original RGB format image file is obtained through camera shooting or social software reception, and then the RGB format image file is converted into YUV through YUV encoding. format image files, then perform DCT transformation and quantization on the YUV format image files, convert the YUV format image files into DC coefficients and AC coefficients, and finally, convert the DC coefficients and AC coefficients into JPEG format images through Huffman coding document. The above process is a one-time encoding process for converting RGB image files into JPEG format image files (here it can be called a complete one-time encoding process).
随后,为了节约存储空间,对JPEG格式的图片文件进行二次编码以得到二次编码后的图片文件(图中为X格式的图片文件,X格式代表任意可能的图片格式)。具体的,首先对JPEG格式的图片文件进行Huffman解码以得到支流系数和交流系数,然后,对直流系数和交流系数进行编码以得到二次编码之后的图片文件。可称上述过程为完整的二次编码过程。最终,存储空间中会存储经过二次编码之后的图片文件,而不会存储原始的RGB格式的图片文件和一次编码后的JPEG格式的图片文件,因此,极大的提升了存储空间的使用效率。Subsequently, in order to save storage space, the image file in JPEG format is re-encoded to obtain a re-encoded image file (the figure shows an image file in X format, where X format represents any possible image format). Specifically, Huffman decoding is first performed on the image file in JPEG format to obtain the tributary coefficients and AC coefficients, and then the DC coefficients and AC coefficients are encoded to obtain the image file after secondary encoding. The above process can be called a complete secondary encoding process. Finally, the storage space will store the image files after secondary encoding, instead of storing the original RGB format image files and the once-encoded JPEG format image files. Therefore, the efficiency of storage space usage is greatly improved. .
当需要将图片文件用于显示时,需要通过图2中右侧箭头所示的过程将其恢复到RGB格式的图片文件。具体的,需要首先将二次编码后得到的图片文件解码得到JPEG格式的图片文件,然后在将JPEG格式的图片文件解码得到RGB格式的图片文件。When the picture file needs to be used for display, it needs to be restored to an RGB format picture file through the process shown by the arrow on the right in Figure 2. Specifically, it is necessary to first decode the image file obtained after secondary encoding to obtain a JPEG format image file, and then decode the JPEG format image file to obtain an RGB format image file.
具体的,在将二次编码后得到的图片文件解码得到JPEG格式的图片文件的过程中,首先,对二次编码得到的图片文件解码得到直流系数和交流系数,然后,对直流系数和交流系数进行Huffman编码得到JPEG格式的图片文件。可称上述过程为完整的二次解码过程。在将JPEG格式的图片文件解码得到RGB格式的图片文件的过程中,首先,对JPEG格式的图片文件进行Huffman解码以得到直流系数和交流系数,然后,对直流系数和交流系数进行反量化和反DCT变换以得到YUV格式的图片文件,最后,对YUV格式的图片文件进行YUV解码以得到RGB格式的图片文件。可称上述过程为完整的一次解码过程。RGB格式的图片文件可用于进行显示。Specifically, in the process of decoding the image file obtained after secondary encoding to obtain the image file in JPEG format, first, the image file obtained after secondary encoding is decoded to obtain the DC coefficient and the AC coefficient, and then, the DC coefficient and the AC coefficient are obtained. Perform Huffman encoding to obtain image files in JPEG format. The above process can be called a complete secondary decoding process. In the process of decoding a JPEG format image file to obtain an RGB format image file, first, Huffman decoding is performed on the JPEG format image file to obtain DC coefficients and AC coefficients, and then, the DC coefficients and AC coefficients are inversely quantized and decoded. DCT transform to obtain an image file in YUV format. Finally, YUV decode the image file in YUV format to obtain an image file in RGB format. The above process can be called a complete decoding process. Picture files in RGB format can be used for display.
现有技术中,在对RGB图片进行编码以得到二次编码后的图片文件的过程中,为了得到JPEG格式的图片文件,对直流系数和交流系数进行了一次Huffman编码,为了得到直流系数和交流系数,又进行了一次Huffman解码以得到直流系数和交流系数。实际上,在不需要JPEG格式的图片文件作为中间输出的场景中,可跳过生成JPEG格式的图片文件的步骤,直接由RGB格式的图片文件编码得到X格式的图片文件。In the prior art, in the process of encoding an RGB image to obtain a twice-encoded image file, in order to obtain a JPEG format image file, a Huffman encoding is performed on the DC coefficients and AC coefficients. In order to obtain the DC coefficients and AC coefficients Coefficients, another Huffman decoding is performed to obtain the DC coefficients and AC coefficients. In fact, in scenarios where JPEG format image files are not required as intermediate output, the step of generating JPEG format image files can be skipped and X format image files can be obtained directly from RGB format image files by encoding.
具体的,请参阅图3,图3为简化后的图片处理过程的流程示意图。如图3所示,在对RGB格式的图片文件进行编码的过程中,首先,对RGB格式的图片文件进行YUV编码以得到YUV格式的图片文件,然后,对YUV格式的图片文件进行DCT变换和量化以得到直流系数和交流系数,最后,直接对直流系数和交流系数进行解码以得到X格式的图片文件。系统可存储X格式的图片文件以提高存储空间的利用效率。对应的,在对X格式的图片文件进行解码的过程中,首先,对X格式的图片文件进行解码以得到直流系数和交流系数,然后,对直流系数和交流系数进行反量化和反DCT变换以得到YUV格式的图片文件,最后,对YUV格式的图片文件进行YUV解码以得到RGB格式的图片文件,RGB格式的图片文件可用于显示。Specifically, please refer to Figure 3, which is a schematic flow chart of a simplified image processing process. As shown in Figure 3, in the process of encoding RGB format image files, first, YUV encoding is performed on the RGB format image files to obtain YUV format image files, and then, the YUV format image files are subjected to DCT transformation and Quantize to obtain DC coefficients and AC coefficients. Finally, directly decode the DC coefficients and AC coefficients to obtain X format image files. The system can store image files in X format to improve storage space utilization efficiency. Correspondingly, in the process of decoding the X format picture file, first, the X format picture file is decoded to obtain the DC coefficients and AC coefficients, and then, the DC coefficients and AC coefficients are inverse quantized and inverse DCT transformed to obtain Obtain the picture file in YUV format. Finally, perform YUV decoding on the picture file in YUV format to obtain the picture file in RGB format. The picture file in RGB format can be used for display.
如图3所示的图片处理流程,删除了现有技术中冗余的Huffman编码和Huffman解码的过程,简化了一次编码过程、二次编码过程、一次解码过程和二次解码过程。通过简化解码和编码过程,能够避免冗余操作,在一定程度上降低资源开销,降低系统复杂度。The picture processing flow shown in Figure 3 deletes the redundant Huffman encoding and Huffman decoding processes in the existing technology, and simplifies the primary encoding process, secondary encoding process, primary decoding process and secondary decoding process. By simplifying the decoding and encoding process, redundant operations can be avoided, resource overhead is reduced to a certain extent, and system complexity is reduced.
基于上述所述背景和发明构思,接下来对本申请实施例提供的图片处理方法进行详细介绍,该图片处理方法对应于图3中右侧的步骤,即,将二次编码得到的文件进行解码以得到RGB格式的图片文件用于显示的过程。该图片处理方法可用于上述的各种应用场景中,这里仅以端侧作为执行主体对方案进行详细的描述,应该理解,其他应用场景中也可以使用,且方法基本相同。具体请参阅图4,图4为本申请实施例提供的图片处理方法的一个流程示意图,具体可以包括如下步骤:Based on the above background and inventive concept, the image processing method provided by the embodiment of the present application is introduced in detail. The image processing method corresponds to the steps on the right side of Figure 3, that is, decoding the file obtained by secondary encoding to The process of obtaining image files in RGB format for display. This image processing method can be used in various application scenarios mentioned above. Here, only the terminal side is used as the execution subject to describe the solution in detail. It should be understood that it can also be used in other application scenarios, and the method is basically the same. Please refer to Figure 4 for details. Figure 4 is a schematic flowchart of the image processing method provided by the embodiment of the present application. Specifically, it may include the following steps:
401、获取第一图片文件。 401. Obtain the first image file.
这里的第一图片文件对应于图3中的X格式的图片文件,即,存储的图片文件,第一图片文件可存储于存储器中。本申请实施例不限制第一图片文件的格式,其可以是私有格式,也可以是标准格式。The first picture file here corresponds to the X-format picture file in FIG. 3 , that is, the stored picture file, and the first picture file may be stored in the memory. The embodiment of the present application does not limit the format of the first picture file, which may be a private format or a standard format.
步骤401中可通过多种可能的实现方式获取该第一图片文件。在一种可能的实现方式中,该第一图片文件可以存储于本地的存储器中,此时,可从本地存储器中获取该第一图片文件。在另一种可能的实现方式中,该第一图片文件可以存储于云端的存储器中,此时,可从云端接收该第一图片文件。在另一种可能的实现方式中,该第一图片文件可以存储于其他电子设备中(例如,独立的存储器或者其他终端设备),此时,可从其他电子设备接收该第一图片文件。In step 401, the first picture file can be obtained through a variety of possible implementation methods. In a possible implementation, the first picture file can be stored in a local storage. In this case, the first picture file can be obtained from the local storage. In another possible implementation, the first picture file can be stored in a cloud storage, and at this time, the first picture file can be received from the cloud. In another possible implementation, the first picture file can be stored in other electronic devices (for example, independent memory or other terminal devices). At this time, the first picture file can be received from other electronic devices.
该第一图片文件可能有多种来源。在一种可能的实现方式中,该第一图片文件可通过如图2中左侧箭头所示的过程处理得到,即,该第一图片文件是通过对RGB格式的图片文件进行完整的一次编码得到JPEG等格式的图片文件,再对JPEG等格式的图片文件进行完整的二次编码得到的。在另一种可能的实现方式中,该第一图片文件可通过如图3左侧箭头所示的过程处理得到,即,该第一图片文件是通过对RGB格式的图片文件进行简化的一次编码得到JPEG等格式的图片文件,再对JPEG等格式的图片文件进行简化的二次编码得到的。在另一种可能的实现方式中,该第一图片文件可通过对JPEG等格式的图片文件进行编码得到,本申请实施例对JPEG等格式的图片文件的获取方式不进行限定,示例性的,该JPEG等格式的图片文件可以是通过社交软件等方式获取的,或者是从云端获取的。The first image file may come from multiple sources. In a possible implementation, the first picture file can be obtained through the process shown by the arrow on the left in Figure 2, that is, the first picture file is obtained by performing a complete one-time encoding of the picture file in RGB format. It is obtained by obtaining image files in JPEG and other formats, and then performing complete secondary encoding on the image files in JPEG and other formats. In another possible implementation, the first picture file can be obtained through the process shown by the arrow on the left side of Figure 3, that is, the first picture file is a simplified one-time encoding of the RGB format picture file. It is obtained by obtaining image files in JPEG and other formats, and then performing simplified secondary encoding on the image files in JPEG and other formats. In another possible implementation, the first picture file can be obtained by encoding a picture file in a format such as JPEG. The embodiment of the present application does not limit the acquisition method of the picture file in a format such as JPEG. For example, The picture files in JPEG and other formats can be obtained through social software, etc., or obtained from the cloud.
应当理解,上述JPEG等格式的图片文件并不限定于JPEG格式,其还可以是PNG格式或者GIF格式等可以进行二次编码的常见的图片格式。本申请实施例仅以JPEG格式的图片文件为例对图片处理方法进行详细说明。It should be understood that the above-mentioned picture files in JPEG and other formats are not limited to JPEG format, and may also be common picture formats such as PNG format or GIF format that can be re-encoded. The embodiment of the present application only takes an image file in JPEG format as an example to describe the image processing method in detail.
402、对该第一图片文件进行算术解码或非对称数字系统(ANS)解码以得到第一直流系数和第一交流系数。402. Perform arithmetic decoding or asymmetric number system (ANS) decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient.
403、对该第一直流系数和该第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。403. Perform inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient to obtain a picture file in YUV format.
需要注意的是,步骤403中直接对步骤402得到的第一直流系数和第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。具体的,现有技术中需要对步骤402得到的第一直流系数和第一交流系数进行Huffman编码以得到JPEG格式的图片文件,然后,再对JPEG格式的图片文件进行Huffman解码以得到第二直流系数和第二交流系数,然后,再对第二直流系数和第二交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。步骤403不同于现有技术中的方案,跳过Huffman编码和Huffman解码步骤,直接对步骤402得到的第一直流系数和第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。It should be noted that in step 403, the first DC coefficient and the first AC coefficient obtained in step 402 are directly inverse quantized and inverse discrete cosine transformed to obtain a picture file in YUV format. Specifically, in the prior art, it is necessary to perform Huffman encoding on the first DC coefficient and the first AC coefficient obtained in step 402 to obtain a picture file in JPEG format, and then perform Huffman decoding on the picture file in JPEG format to obtain the second DC coefficient and second AC coefficient, and then perform inverse quantization and inverse discrete cosine transform on the second DC coefficient and second AC coefficient to obtain a picture file in YUV format. Step 403 is different from the solution in the prior art. It skips the Huffman encoding and Huffman decoding steps and directly performs inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient obtained in step 402 to obtain a picture in YUV format. document.
404、将该YUV格式的图片文件转化为RGB格式的图片文件。404. Convert the YUV format image file into an RGB format image file.
步骤404可通过YUV解码过程实现,所得的RGB格式的图片文件可用于进行显示或者供用户进行浏览。Step 404 can be implemented through the YUV decoding process, and the resulting image file in RGB format can be used for display or for users to browse.
上述图片处理方法简化了解码过程中的冗余步骤,使得解码的过程更加灵活,降低了系统复杂度和资源开销,也在一定程度上提升了图片文件解码的效率。The above image processing method simplifies the redundant steps in the decoding process, makes the decoding process more flexible, reduces system complexity and resource overhead, and also improves the efficiency of image file decoding to a certain extent.
随着终端功能的多样化发展,用户对图片文件存在多种可能的使用方式,因此,针对不同的使用方式,可以采用不同的方式对图片文件进行处理,以最大程度的提升系统处理效率。请参阅图5,图5以第一图片文件作为起点。在一种可能的实现方式中,用户可能希望将第 一图片文件用于显示等场景,需要将第一图片文件转化为RGB格式的图片文件。此时,可采用如图4所示的图片处理方法,通过简化的二次解码过程和简化的一次解码过程将第一图片文件转化为RGB格式的图片文件。在另一种可能的实现方式中,用户可能希望对第一图片文件进行编辑,或者通过微信、微博等社交应用发送该第一图片文件,需要将第一图片文件转化为JPEG等格式的图片文件。此时,可采用完整的二次解码过程,将第一图片文件转化为JPEG等格式的图片文件。With the diversified development of terminal functions, users have many possible ways to use image files. Therefore, according to different usage methods, image files can be processed in different ways to maximize system processing efficiency. Please refer to Figure 5, which takes the first image file as a starting point. In one possible implementation, the user may wish to convert the A picture file is used for display and other scenes, and the first picture file needs to be converted into an RGB format picture file. At this time, the image processing method shown in Figure 4 can be used to convert the first image file into an RGB format image file through a simplified secondary decoding process and a simplified primary decoding process. In another possible implementation, the user may want to edit the first picture file, or send the first picture file through social applications such as WeChat and Weibo. The first picture file needs to be converted into a picture in a format such as JPEG. document. At this time, a complete secondary decoding process can be used to convert the first picture file into a picture file in a format such as JPEG.
应当理解,上述应用场景仅仅是示例性的,其他应用场景也是可能的。对于需要JPEG等格式的图片文件的应用场景,可采用完整的二次解码过程对第一图片文件进行处理,对于需要RGB格式的图片文件的因公场景,可采用简化的二次解码和简化的一次解码过程对第一图片文件进行处理。It should be understood that the above application scenarios are only exemplary, and other application scenarios are also possible. For application scenarios that require image files in JPEG and other formats, a complete secondary decoding process can be used to process the first image file. For business-related scenarios that require image files in RGB format, simplified secondary decoding and simplified The first picture file is processed in one decoding process.
根据不同的用途对图片文件采取不同的处理方式,能够使得系统对图片文件的管理更加灵活,在保证功能实现的前提下,进一步提升系统效率,降低系统复杂度,提升资源的利用率。Adopting different processing methods for image files according to different uses can make the system's management of image files more flexible, further improve system efficiency, reduce system complexity, and improve resource utilization while ensuring the realization of functions.
基于上述所述背景和发明构思,接下来对本申请实施例提供的另一种图片处理方法进行详细介绍,该图片处理方法对应于图3中左侧的步骤,即,将RGB格式的图片文件进行编码以得到二次编码得到的文件用于存储的过程。该图片处理方法可用于上述的各种应用场景中,这里仅以端侧作为执行主体对方案进行详细的描述,应该理解,其他应用场景中也可以使用,且方法基本相同。具体请参阅图6,图6为本申请实施例提供的图片处理方法的一个流程示意图,具体可以包括如下步骤:Based on the above background and inventive concept, another image processing method provided by the embodiment of the present application will be introduced in detail. This image processing method corresponds to the steps on the left side in Figure 3, that is, processing the image file in RGB format. The process of encoding to obtain a secondary encoded file for storage. This image processing method can be used in various application scenarios mentioned above. Here, only the terminal side is used as the execution subject to describe the solution in detail. It should be understood that it can also be used in other application scenarios, and the method is basically the same. Please refer to Figure 6 for details. Figure 6 is a schematic flowchart of an image processing method provided by an embodiment of the present application. Specifically, it may include the following steps:
601、获取RGB格式的图片文件。601. Obtain image files in RGB format.
本申请实施例对获取RGB格式的图片文件的方式不进行限定,示例性的,可通过拍照等采集方式获取RGB格式的图片文件,也可以从云端或者其他电子设备接收RGB格式的图片文件。The embodiments of this application do not limit the method of obtaining image files in RGB format. For example, image files in RGB format can be obtained through collection methods such as taking photos, or image files in RGB format can be received from the cloud or other electronic devices.
602、将该RGB格式的图片文件转化为YUV格式的图片文件。602. Convert the image file in RGB format into an image file in YUV format.
步骤602可通过YUV编码过程实现。Step 602 may be implemented through a YUV encoding process.
603、对该YUV格式的图片文件进行离散余弦变换和量化,以得到第三直流系数和第三交流系数。603. Perform discrete cosine transformation and quantization on the YUV format image file to obtain the third DC coefficient and the third AC coefficient.
604、对该第三支流系数和该第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件,所述第三图片文件用于存储与存储器中。604. Perform arithmetic coding or asymmetric digital system coding on the third tributary coefficient and the third AC coefficient to obtain a third picture file. The third picture file is used for storage and memory.
在获取到第三图片文件之后,可以将第三图片文件进行存储,在一种可能的实现方式中,可将第三图片文件存储于本地的存储器中,在另一种可能的实现方式中,可将第三图片文件发送到云端的存储器进行存储,在另一种可能的实现方式中,可将第三图片文件发送到其他电子设备内中进行存储。After obtaining the third picture file, the third picture file can be stored. In one possible implementation, the third picture file can be stored in a local memory. In another possible implementation, The third picture file can be sent to the storage in the cloud for storage. In another possible implementation, the third picture file can be sent to other electronic devices for storage.
需要注意的是,步骤604中直接对步骤603得到的第三直流系数和第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件。具体的,现有技术中需要对步骤603得到的第三直流系数和第三交流系数进行Huffman编码以得到JPEG格式的图片文件,然后,再对JPEG格式的图片文件进行Huffman解码以得到第四直流系数和第四交流系数,然后,再对第四直流系数和第四交流系数进行算术编码或者非对称数字系统编码以得到第三图片文件。步骤604不同于现有技术中的方案,跳过Huffman编码和Huffman解码步骤,直接对步骤603得到的第三直流系数和第三交流系数进行算术编码或者非对称数字系统编码以得到第三图片文件。 It should be noted that in step 604, arithmetic coding or asymmetric digital system coding is directly performed on the third DC coefficient and the third AC coefficient obtained in step 603 to obtain the third picture file. Specifically, in the prior art, it is necessary to perform Huffman encoding on the third DC coefficient and the third AC coefficient obtained in step 603 to obtain a picture file in JPEG format, and then perform Huffman decoding on the picture file in JPEG format to obtain the fourth DC coefficient. coefficient and the fourth AC coefficient, and then perform arithmetic coding or asymmetric digital system coding on the fourth DC coefficient and the fourth AC coefficient to obtain the third picture file. Step 604 is different from the solution in the prior art. It skips the Huffman encoding and Huffman decoding steps and directly performs arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient obtained in step 603 to obtain the third picture file. .
请参阅图7,在一种可能的实现方式中,当第三图片需要被转化为RGB等格式的图片文件时,上述图片处理方法还包括以下步骤:Please refer to Figure 7. In a possible implementation, when the third image needs to be converted into an image file in a format such as RGB, the above image processing method also includes the following steps:
605、对该第三图片文件进行算术解码或非对称数字系统解码以得到第三直流系数和第三交流系数。605. Perform arithmetic decoding or asymmetric digital system decoding on the third picture file to obtain the third DC coefficient and the third AC coefficient.
606、对该第三直流系数和该第三交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。606. Perform inverse quantization and inverse discrete cosine transform on the third DC coefficient and the third AC coefficient to obtain a picture file in YUV format.
607、将该YUV格式的图片文件转化为RGB格式的图片文件。607. Convert the YUV format image file into an RGB format image file.
步骤605-607是可选的,步骤605-607的具体实现方式与步骤402-403的实现方式基本相同,为避免重复,此处不再进行赘述。Steps 605-607 are optional. The specific implementation methods of steps 605-607 are basically the same as the implementation methods of steps 402-403. To avoid duplication, they will not be described again here.
示例性的,该第三图片文件需要被转化为RGB等格式的图片文件的场景包括显示等,其他需要使用RGB等格式的图片文件的场景也是可能的。For example, the scenarios in which the third image file needs to be converted into an image file in an RGB or other format include display, etc. Other scenarios that require the use of an image file in an RGB or other format are also possible.
请参阅图8,在一种可能的实现方式中,当第三图片需要被转化为JPEG等格式的图片文件时,上述图片处理方法还包括以下步骤:Please refer to Figure 8. In a possible implementation, when the third picture needs to be converted into a picture file in a format such as JPEG, the above picture processing method also includes the following steps:
608、对该第三图片文件进行算术解码或非对称数字系统解码以得到第三直流系数和第三交流系数。608. Perform arithmetic decoding or asymmetric digital system decoding on the third picture file to obtain the third DC coefficient and the third AC coefficient.
609、对该第三直流系数和该第三交流系数进行Huffman编码以得到JPEG格式的图片文件。609. Perform Huffman encoding on the third DC coefficient and the third AC coefficient to obtain a picture file in JPEG format.
步骤608和步骤609是可选的。步骤608的具体实现方式与步骤402的实现方式基本相同,步骤609可通过现有技术中的方案实现,为避免重复,此处不再进行赘述。Steps 608 and 609 are optional. The specific implementation method of step 608 is basically the same as the implementation method of step 402. Step 609 can be implemented by solutions in the prior art. To avoid repetition, no details will be described here.
示例性的,该第三图片文件需要被转化为JPEG等格式的图片文件的场景包括编辑、通过微信、微博等社交应用进行发送等,其他需要使用JPEG等格式的图片文件的场景也是可能的。For example, the scenarios in which the third picture file needs to be converted into a picture file in a format such as JPEG include editing, sending through social applications such as WeChat and Weibo, etc. Other scenarios in which picture files in a format such as JPEG are also possible. .
上述图片处理方法简化了编码过程中的冗余步骤,使得编码的过程更加灵活,降低了系统复杂度和资源开销,也在一定程度上提升了图片文件编码的效率。The above image processing method simplifies the redundant steps in the encoding process, makes the encoding process more flexible, reduces system complexity and resource overhead, and also improves the efficiency of image file encoding to a certain extent.
随着终端功能的多样化发展,用户对图片文件存在多种可能的使用方式,因此,针对不同的使用方式,可以采用不同的方式对图片文件进行处理,以最大程度的提升系统处理效率。请参阅图9,图9以RGB格式的图片文件作为起点。在一种可能的实现方式中,用户可能希望该图片文件进行存储,此时,为了节约存储空间,需要将RGB格式的图片文件编码为所需存储空间更小的X格式的图片文件。此时,可采用如图6所示的图片处理方法,通过简化的一次编码过程和简化的二次编码过程将RGB格式的图片文件转化为X格式的图片文件。在另一种可能的实现方式中,用户可能希望对RGB格式的图片文件进行编辑,或者通过微信、微博等社交应用发送该图片文件,此时,需要将该RGB格式的图片文件转化为JPEG等格式的图片文件。此时,可采用完整的一次编码过程。With the diversified development of terminal functions, users have many possible ways to use image files. Therefore, according to different usage methods, image files can be processed in different ways to maximize system processing efficiency. Please refer to Figure 9, which uses an image file in RGB format as a starting point. In a possible implementation, the user may want to store the image file. At this time, in order to save storage space, the RGB format image file needs to be encoded into an X format image file that requires smaller storage space. At this time, the image processing method shown in Figure 6 can be used to convert the RGB format image file into an X format image file through a simplified primary encoding process and a simplified secondary encoding process. In another possible implementation, the user may want to edit the image file in RGB format, or send the image file through social applications such as WeChat and Weibo. In this case, the image file in RGB format needs to be converted into JPEG. Picture files in other formats. At this point, a complete one-pass encoding process can be used.
根据不同的用途对图片文件采取不同的处理方式,能够使得系统对图片文件的管理更加灵活,在保证功能实现的前提下,进一步提升系统效率,降低系统复杂度,提升资源的利用率。Adopting different processing methods for image files according to different uses can make the system's management of image files more flexible, further improve system efficiency, reduce system complexity, and improve resource utilization while ensuring the realization of functions.
在上述对应实施例的基础上,为了更好的实施本申请实施例的上述方案,下面还提供用于实施上述方案的计算机设备。该计算机设备可以包括手持终端设备,如,手机、电脑、iPad等,也可以包括智能可穿戴设备,如,智能手环、智能手表、智能心率计等;还可以包括轮式移动设备,如,车辆(如自动驾驶车辆)、飞行器、机器人(如扫地机器人)等,具体本申请对计算机设备的产品形态不做限定,只要能用于实现本申请所述的图片处理方法的电子设 备,都可以称为计算机设备。On the basis of the above corresponding embodiments, in order to better implement the above solutions of the embodiments of the present application, computer equipment for implementing the above solutions is also provided below. The computer device may include handheld terminal devices, such as mobile phones, computers, iPads, etc., and may also include smart wearable devices, such as smart bracelets, smart watches, smart heart rate meters, etc.; it may also include wheeled mobile devices, such as, Vehicles (such as self-driving vehicles), aircraft, robots (such as sweeping robots), etc. Specifically, this application does not limit the product form of computer equipment, as long as it can be used to implement the image processing method described in this application. All equipment can be called computer equipment.
请参阅图10,图10为本申请实施例提供的计算机设备的一种结构示意图,该计算机设备1000包括:获取模块1003、解码模块1002和处理模块1002,其中,获取模块1001,用于获取第一图片文件;解码模块1002,用于对该第一图片文件进行算术解码或ANS解码以得到第一直流系数和第一交流系数;处理模块1003,用于对该第一直流系数和该第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件;处理模块还用于将该YUV格式的图片文件转化为RGB格式的图片文件。Please refer to Figure 10. Figure 10 is a schematic structural diagram of a computer device provided by an embodiment of the present application. The computer device 1000 includes: an acquisition module 1003, a decoding module 1002 and a processing module 1002. The acquisition module 1001 is used to acquire the third A picture file; the decoding module 1002 is used to perform arithmetic decoding or ANS decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient; the processing module 1003 is used to perform the first DC coefficient and the first AC coefficient The first AC coefficient is inversely quantized and inversely discrete cosine transformed to obtain an image file in YUV format; the processing module is also used to convert the image file in YUV format into an image file in RGB format.
在一种可能的设计中,该第一图片文件是对第二图片文件进行编码得到的,该第一图片文件的格式与该第二图片文件的格式不同,该第二图片文件的格式为以下任意一种:In a possible design, the first picture file is obtained by encoding the second picture file. The format of the first picture file is different from the format of the second picture file. The format of the second picture file is as follows Either:
JPEG格式,PNG格式或者GIF格式。JPEG format, PNG format or GIF format.
在一种可能的设计中,该第一图片文件存储与存储器中。In a possible design, the first picture file is stored in the memory.
在一种可能的设计中,该RGB格式的图片文件用于进行显示In a possible design, the image file in RGB format is used for display
在一种可能的设计中,该获取模块1001,具体用于从云端或者其他电子设备接收该第一图片文件。In one possible design, the acquisition module 1001 is specifically configured to receive the first picture file from the cloud or other electronic devices.
在一种可能的设计中,该处理模块不用于:对该第一直流系数和该第一交流系数进行哈夫曼编码以得到JPEG格式的图片文件;对该JPEG格式的图片文件进行哈夫曼解码以得到第二直流系数和第二交流系数;对该第二直流系数和该第二交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。In a possible design, the processing module is not used to: perform Huffman coding on the first DC coefficient and the first AC coefficient to obtain a picture file in JPEG format; perform Huffman coding on the picture file in JPEG format. Mann decoding is performed to obtain the second DC coefficient and the second AC coefficient; the second DC coefficient and the second AC coefficient are inversely quantized and inversely discrete cosine transformed to obtain a picture file in YUV format.
请参阅图11,图11为本申请实施例提供的计算机设备的一种结构示意图,该计算机设备1100包括:获取模块1101、编码/解码模块1102和处理模块1103,其中,获取模块1101,用于获取RGB格式的图片文件;处理模块1103,用于将该RGB格式的图片文件转化为YUV格式的图片文件;处理模块1103,还用于对该YUV格式的图片文件进行离散余弦变换和量化,以得到第三直流系数和第三交流系数;编码/解码模块1102,用于对该第三直流系数和该第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件,该第三图片文件用于存储于存储器中。Please refer to Figure 11. Figure 11 is a schematic structural diagram of a computer device provided by an embodiment of the present application. The computer device 1100 includes: an acquisition module 1101, an encoding/decoding module 1102, and a processing module 1103. The acquisition module 1101 is used to Obtain a picture file in RGB format; the processing module 1103 is used to convert the picture file in RGB format into a picture file in YUV format; the processing module 1103 is also used to perform discrete cosine transformation and quantization on the picture file in YUV format to Obtain the third DC coefficient and the third AC coefficient; the encoding/decoding module 1102 is used to perform arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file. Three picture files are used for storage in memory.
在一种可能的设计中,编码/解码模块1102,还用于该第三图片文件进行算术解码或者非对称解码以得到该第三直流系数或该第三交流系数;处理模块1103,还用于对该第三直流系数或第三交流系数进行反量化和反离散余弦变换以得到该YUV格式的图片文件;处理模块1103,还用于将该YUV格式的图片文件转化为RGB格式的图片文件。In a possible design, the encoding/decoding module 1102 is also used to perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient; the processing module 1103 is also used to Perform inverse quantization and inverse discrete cosine transform on the third DC coefficient or the third AC coefficient to obtain the image file in YUV format; the processing module 1103 is also used to convert the image file in YUV format into an image file in RGB format.
在一种可能的设计中,编码/解码模块1102,还用于对该第三图片文件进行算术解码或者非对称解码以得到该第三直流系数或该第三交流系数;编码/解码模块1102,还用于对该第三直流系数或该第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件。In a possible design, the encoding/decoding module 1102 is also used to perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient; the encoding/decoding module 1102, It is also used to perform Huffman encoding on the third DC coefficient or the third AC coefficient to obtain a picture file in JPEG format.
在一种可能的设计中,该计算机设备1100还包括发送模块1104,用于将该图片文件发送至云端或者其他电子设备进行存储。In a possible design, the computer device 1100 also includes a sending module 1104 for sending the picture file to the cloud or other electronic devices for storage.
在一种可能的设计中,编码/解码模块1102,不用于对该第三直流系数和该第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件;对该JPEG格式的图片文件进行哈夫曼解码以得到第四直流系数和第四交流系数;对该第四直流系数和该第四交流系数进行算术编码或非对称编码以得到第三图片文件。In one possible design, the encoding/decoding module 1102 is not used to perform Huffman encoding on the third DC coefficient and the third AC coefficient to obtain the image file in JPEG format; it performs Huffman encoding on the image file in JPEG format. Furman decoding is performed to obtain a fourth DC coefficient and a fourth AC coefficient; arithmetic coding or asymmetric coding is performed on the fourth DC coefficient and the fourth AC coefficient to obtain a third picture file.
本申请实施例还提供了一种计算机设备,请参阅图12,图12是本申请实施例提供的计算机设备一种结构示意图,为便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该计算机设备1200上可以部署有图10和图11对 应实施例中所描述的模块,用于实现图10对应实施例中计算机设备1000的功能和图11对应实施例中计算机设备1100的功能。具体的,计算机设备1200由一个或多个服务器实现,计算机设备1200可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上中央处理器(central processing units,CPU)1222和存储器1232,一个或一个以上存储应用程序1242或数据1244的存储介质1230(例如一个或一个以上海量存储设备)。其中,存储器1232和存储介质1230可以是短暂存储或持久存储。存储在存储介质1230的程序可以包括一个或一个以上模块(图示没标出),每个模块可以包括对计算机设备1200中的一系列指令操作。更进一步地,中央处理器1222可以设置为与存储介质1230通信,在计算机设备1200上执行存储介质1230中的一系列指令操作。The embodiment of the present application also provides a computer device. Please refer to Figure 12. Figure 12 is a schematic structural diagram of the computer device provided by the embodiment of the present application. For convenience of explanation, only the parts related to the embodiment of the present application are shown. If the specific technical details are not disclosed, please refer to the method section of the embodiments of this application. The computer device 1200 may be deployed with a pair of FIGS. 10 and 11 The modules described in the embodiments are used to implement the functions of the computer device 1000 in the embodiment corresponding to FIG. 10 and the functions of the computer device 1100 in the embodiment corresponding to FIG. 11 . Specifically, the computer device 1200 is implemented by one or more servers. The computer device 1200 may vary greatly due to different configurations or performance, and may include one or more central processing units (CPU) 1222 and memory 1232 , one or more storage media 1230 (eg, one or more mass storage devices) that store applications 1242 or data 1244. Among them, the memory 1232 and the storage medium 1230 may be short-term storage or persistent storage. The program stored in the storage medium 1230 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the computer device 1200 . Furthermore, the central processor 1222 may be configured to communicate with the storage medium 1230 and execute a series of instruction operations in the storage medium 1230 on the computer device 1200 .
计算机设备1200还可以包括一个或一个以上电源1226,一个或一个以上有线或无线网络接口1250,一个或一个以上输入输出接口1258,和/或,一个或一个以上操作系统1241,例如Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTM等等。Computer device 1200 may also include one or more power supplies 1226, one or more wired or wireless network interfaces 1250, one or more input and output interfaces 1258, and/or, one or more operating systems 1241, such as Windows Server™, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM and more.
本申请实施例中,中央处理器1222,用于执行图4和图6对应实施例中的图片的处理方法。例如,中央处理器1222可以用于:获取第一图片文件;对该第一图片文件进行算术解码或非对称数字系统解码以得到第一直流系数和第一交流系数;对该第一直流系数和该第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件;将该YUV格式的图片文件转化为RGB格式的图片文件。再如,中央处理器1222还可以用于:获取RGB格式的图片文件;将该RGB格式的图片文件转化为YUV格式的图片文件;对该YUV格式的图片文件进行离散余弦变换和量化,以得到第三直流系数和第三交流系数;对该第三直流系数和该第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件,该第三图片文件用于存储于存储器中。In this embodiment of the present application, the central processor 1222 is used to execute the image processing method in the corresponding embodiments of FIG. 4 and FIG. 6 . For example, the central processor 1222 may be used to: obtain a first picture file; perform arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient; The coefficients and the first AC coefficient are inverse quantized and inverse discrete cosine transformed to obtain a YUV format image file; the YUV format image file is converted into an RGB format image file. For another example, the central processor 1222 can also be used to: obtain an image file in RGB format; convert the image file in RGB format into an image file in YUV format; perform discrete cosine transformation and quantization on the image file in YUV format to obtain The third DC coefficient and the third AC coefficient; perform arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file, and the third picture file is used for storage in the memory .
需要说明的是,中央处理器1222还可以用于执行与本申请中图4和图6对应的方法实施例中任意一个步骤,具体内容可参见本申请前述所示的方法实施例中的叙述,此处不再赘述。It should be noted that the central processing unit 1222 can also be used to execute any step in the method embodiment corresponding to Figure 4 and Figure 6 in this application. For specific content, please refer to the description in the method embodiment shown above in this application. No further details will be given here.
本申请实施例提供的图片处理装置可以为芯片,芯片包括:处理单元和通信单元,所述处理单元例如可以是处理器,所述通信单元例如可以是输入/输出接口、管脚或电路等。该处理单元可执行存储单元存储的计算机执行指令,以使芯片执行上述图4、图6所示实施例描述的方法。可选地,所述存储单元为所述芯片内的存储单元,如寄存器、缓存等,所述存储单元还可以是所述无线接入设备端内的位于所述芯片外部的存储单元,如只读存储器(read-only memory,ROM)或可存储静态信息和指令的其他类型的静态存储设备,随机存取存储器(random access memory,RAM)等。The image processing device provided by the embodiment of the present application may be a chip. The chip includes: a processing unit and a communication unit. The processing unit may be, for example, a processor. The communication unit may be, for example, an input/output interface, a pin, or a circuit. The processing unit can execute computer execution instructions stored in the storage unit, so that the chip executes the method described in the embodiments shown in FIG. 4 and FIG. 6 . Optionally, the storage unit is a storage unit within the chip, such as a register, cache, etc. The storage unit may also be a storage unit located outside the chip in the wireless access device, such as Read-only memory (ROM) or other types of static storage devices that can store static information and instructions, random access memory (random access memory, RAM), etc.
本申请实施例中还提供一种计算机可读存储介质,该计算机可读存储介质中存储有用于进行信号处理的程序,当其在计算机上运行时,使得计算机执行如前述所示实施例描述中计算机设备所执行的步骤。The embodiments of the present application also provide a computer-readable storage medium, which stores a program for signal processing. When it is run on a computer, it causes the computer to execute the steps described in the foregoing embodiments. The steps performed by computer equipment.
另外需说明的是,以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。另外,本申请提供的装置实施例附图中,模块之间的连接关系表示它们之间具有通信连接,具体可以实现为一条或多条通信总线或信号线。In addition, it should be noted that the device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physically separate. The physical unit can be located in one place, or it can be distributed across multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. In addition, in the drawings of the device embodiments provided in this application, the connection relationship between modules indicates that there are communication connections between them, which can be specifically implemented as one or more communication buses or signal lines.
通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件的方式来实现,当然也可以通过专用硬件包括专用集成电路、专用CPU、 专用存储器、专用元器件等来实现。一般情况下,凡由计算机程序完成的功能都可以很容易地用相应的硬件来实现,而且,用来实现同一功能的具体硬件结构也可以是多种多样的,例如模拟电路、数字电路或专用电路等。但是,对本申请而言更多情况下软件程序实现是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘、U盘、移动硬盘、只读存储器(read only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,训练设备,或者网络设备等)执行本申请各个实施例所述的方法。Through the above description of the embodiments, those skilled in the art can clearly understand that the present application can be implemented by software plus necessary general hardware. Of course, it can also be implemented by dedicated hardware including dedicated integrated circuits, dedicated CPUs, Special memory, special components, etc. can be implemented. In general, all functions performed by computer programs can be easily implemented with corresponding hardware. Moreover, the specific hardware structures used to implement the same function can also be diverse, such as analog circuits, digital circuits or special-purpose circuits. circuit etc. However, for this application, software program implementation is a better implementation in most cases. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or that contributes to the existing technology. The computer software product is stored in a readable storage medium, such as a computer floppy disk. , U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc., including several instructions to make a computer device (which can be a personal computer, training equipment, or network equipment, etc.) to execute the methods described in various embodiments of this application.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product.
所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、训练设备或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、训练设备或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存储的任何可用介质或者是包含一个或多个可用介质集成的训练设备、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(digital video disc,DVD))、或者半导体介质(例如,固态硬盘(solid state disk,SSD))等。 The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another, for example, the computer instructions may be transferred from a website, computer, training device, or data The center transmits to another website site, computer, training equipment or data center through wired (such as coaxial cable, optical fiber, digital subscriber line) or wireless (such as infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store, or a data storage device such as a training device or a data center integrated with one or more available media. The usable media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, high-density digital video discs (DVD)), or semiconductor media (eg, solid state disks). ,SSD)), etc.

Claims (23)

  1. 一种图片处理方法,其特征在于,包括:An image processing method, characterized by including:
    获取第一图片文件;Get the first image file;
    对所述第一图片文件进行算术解码或非对称数字系统解码以得到第一直流系数和第一交流系数;Perform arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient;
    对所述第一直流系数和所述第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件;Perform inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient to obtain a picture file in YUV format;
    将所述YUV格式的图片文件转化为RGB格式的图片文件。Convert the image file in YUV format into an image file in RGB format.
  2. 根据权利要求1所述的方法,其特征在于,所述第一图片文件是对第二图片文件进行编码得到的,所述第一图片文件的格式与所述第二图片文件的格式不同,所述第二图片文件的图片格式为以下任意一种:The method of claim 1, wherein the first picture file is obtained by encoding a second picture file, and the format of the first picture file is different from the format of the second picture file, so The image format of the second image file is any of the following:
    JPEG格式,PNG格式或者GIF格式。JPEG format, PNG format or GIF format.
  3. 根据权利要求1或2所述的方法,其特征在于,所述第一图片文件存储于存储器中。The method according to claim 1 or 2, characterized in that the first picture file is stored in a memory.
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述RGB格式的图片文件用于进行显示。The method according to any one of claims 1 to 3, characterized in that the picture file in RGB format is used for display.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述获取第一图片文件,包括:The method according to any one of claims 1-4, characterized in that said obtaining the first picture file includes:
    从云端或者其他电子设备接收所述第一图片文件。Receive the first picture file from the cloud or other electronic device.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述对所述第一直流系数和所述第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件,不包括:The method according to any one of claims 1 to 5, characterized in that: performing inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient to obtain a picture file in YUV format , excluding:
    对所述第一直流系数和所述第一交流系数进行哈夫曼编码以得到JPEG格式的图片文件;Perform Huffman coding on the first DC coefficient and the first AC coefficient to obtain a picture file in JPEG format;
    对所述JPEG格式的图片文件进行哈夫曼解码以得到第二直流系数和第二交流系数;Perform Huffman decoding on the picture file in JPEG format to obtain the second DC coefficient and the second AC coefficient;
    对所述第二直流系数和所述第二交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件。Perform inverse quantization and inverse discrete cosine transform on the second DC coefficient and the second AC coefficient to obtain a picture file in YUV format.
  7. 一种图片处理方法,其特征在于,包括:An image processing method, characterized by including:
    获取RGB格式的图片文件;Get image files in RGB format;
    将所述RGB格式的图片文件转化为YUV格式的图片文件;Convert the image file in RGB format into an image file in YUV format;
    对所述YUV格式的图片文件进行离散余弦变换和量化,以得到第三直流系数和第三交流系数;Perform discrete cosine transformation and quantization on the picture file in YUV format to obtain the third DC coefficient and the third AC coefficient;
    对所述第三直流系数和所述第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件,所述第三图片文件用于存储于存储器中。Arithmetic coding or asymmetric digital system coding is performed on the third DC coefficient and the third AC coefficient to obtain a third picture file, and the third picture file is used for storage in a memory.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7, further comprising:
    对所述第三图片文件进行算术解码或者非对称解码以得到所述第三直流系数或所述第三交流系数;Perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient;
    对所述第三直流系数或第三交流系数进行反量化和反离散余弦变换以得到所述YUV格 式的图片文件;Perform inverse quantization and inverse discrete cosine transform on the third DC coefficient or the third AC coefficient to obtain the YUV grid image file;
    将所述YUV格式的图片文件转化为RGB格式的图片文件。Convert the image file in YUV format into an image file in RGB format.
  9. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method of claim 7, further comprising:
    对所述第三图片文件进行算术解码或者非对称解码以得到所述第三直流系数或所述第三交流系数;Perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient;
    对所述第三直流系数或第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件。Huffman encoding is performed on the third DC coefficient or the third AC coefficient to obtain a picture file in JPEG format.
  10. 根据权利要求7-9任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 7-9, characterized in that the method further includes:
    将所述第三图片文件发送至云端或者其他电子设备进行存储。Send the third picture file to the cloud or other electronic device for storage.
  11. 根据权利要求7-10任一项所述的方法,其特征在于,所述对所述第三直流系数和所述第三交流系数进行算术编码或者非对称编码,以得到第三图片文件,不包括:The method according to any one of claims 7-10, characterized in that the third DC coefficient and the third AC coefficient are subjected to arithmetic coding or asymmetric coding to obtain a third picture file. include:
    对所述第三直流系数和所述第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件;Perform Huffman coding on the third DC coefficient and the third AC coefficient to obtain a picture file in JPEG format;
    对所述JPEG格式的图片文件进行哈夫曼解码以得到第四直流系数和第四交流系数;Perform Huffman decoding on the picture file in JPEG format to obtain the fourth DC coefficient and the fourth AC coefficient;
    对所述第四直流系数和所述第四交流系数进行算术编码或非对称编码以得到第三图片文件。Arithmetic coding or asymmetric coding is performed on the fourth DC coefficient and the fourth AC coefficient to obtain a third picture file.
  12. 一种计算机设备,其特征在于,包括:A computer device, characterized in that it includes:
    获取模块,用于获取第一图片文件;Acquisition module, used to obtain the first image file;
    解码模块,用于对所述第一图片文件进行算术解码或非对称数字系统解码以得到第一直流系数和第一交流系数;A decoding module configured to perform arithmetic decoding or asymmetric digital system decoding on the first picture file to obtain the first DC coefficient and the first AC coefficient;
    处理模块,用于对所述第一直流系数和所述第一交流系数进行反量化和反离散余弦变换以得到YUV格式的图片文件;A processing module configured to perform inverse quantization and inverse discrete cosine transform on the first DC coefficient and the first AC coefficient to obtain a picture file in YUV format;
    所述处理模块,还用于将所述YUV格式的图片文件转化为RGB格式的图片文件。The processing module is also used to convert the picture file in YUV format into a picture file in RGB format.
  13. 根据权利要求12所述的设备,其特征在于,所述第一图片文件是对第二图片文件进行编码得到的,所述第一图片文件的格式与所述第二图片文件的格式不同,所述第二图片文件的格式为以下任意一种:The device according to claim 12, wherein the first picture file is obtained by encoding a second picture file, and the format of the first picture file is different from the format of the second picture file, so The format of the second picture file is any of the following:
    JPEG格式,PNG格式或者GIF格式。JPEG format, PNG format or GIF format.
  14. 根据权利要求12或13所述的设备,其特征在于,所述第一图片文件存储于存储器中。The device according to claim 12 or 13, characterized in that the first picture file is stored in a memory.
  15. 根据权利要求12-13中任一项所述的设备,其特征在于:所述RGB格式的图片文件用于进行显示。The device according to any one of claims 12-13, characterized in that: the picture file in RGB format is used for display.
  16. 根据权利要求12-15中任一项所述的设备,其特征在于,所述处理模块不用于:The device according to any one of claims 12-15, characterized in that the processing module is not used for:
    对所述第一直流系数和所述第一交流系数进行哈夫曼编码以得到JPEG格式的图片文件;Perform Huffman coding on the first DC coefficient and the first AC coefficient to obtain a picture file in JPEG format;
    对所述JPEG格式的图片文件进行哈夫曼解码以得到第二直流系数和第二交流系数;Perform Huffman decoding on the picture file in JPEG format to obtain the second DC coefficient and the second AC coefficient;
    对所述第二直流系数和所述第二交流系数进行反量化和反离散余弦变换以得到YUV格 式的图片文件。Perform inverse quantization and inverse discrete cosine transform on the second DC coefficient and the second AC coefficient to obtain the YUV grid image file.
  17. 一种计算机设备,其特征在于,包括:A computer device, characterized in that it includes:
    获取模块,用于获取RGB格式的图片文件;Acquisition module, used to obtain image files in RGB format;
    处理模块,用于将所述RGB格式的图片文件转化为YUV格式的图片文件;A processing module, used to convert the image files in RGB format into image files in YUV format;
    所述处理模块,还用于对所述YUV格式的图片文件进行离散余弦变换和量化,以得到第三直流系数和第三交流系数;The processing module is also used to perform discrete cosine transform and quantization on the picture file in YUV format to obtain the third DC coefficient and the third AC coefficient;
    编码模块,用于对所述第三直流系数和所述第三交流系数进行算术编码或者非对称数字系统编码,以得到第三图片文件,所述第三图片文件用于存储于存储器中。A coding module, configured to perform arithmetic coding or asymmetric digital system coding on the third DC coefficient and the third AC coefficient to obtain a third picture file, where the third picture file is used for storage in a memory.
  18. 根据权利要求17所述的设备,其特征在于,所述计算设备还包括:The device of claim 17, wherein the computing device further includes:
    解码模块,用于对所述第三图片文件进行算术解码或者非对称解码以得到所述第三直流系数或所述第三交流系数;A decoding module configured to perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient;
    所述处理模块,还用于对所述第三直流系数或第三交流系数进行反量化和反离散余弦变换以得到所述YUV格式的图片文件;The processing module is also configured to perform inverse quantization and inverse discrete cosine transform on the third DC coefficient or the third AC coefficient to obtain the picture file in the YUV format;
    所述处理模块,还用于将所述YUV格式的图片文件转化为RGB格式的图片文件。The processing module is also used to convert the picture file in YUV format into a picture file in RGB format.
  19. 根据权利要求17所述的设备,其特征在于,所述计算设备还包括:The device of claim 17, wherein the computing device further includes:
    解码模块,用于对所述第三图片文件进行算术解码或者非对称解码以得到所述第三直流系数或所述第三交流系数;A decoding module configured to perform arithmetic decoding or asymmetric decoding on the third picture file to obtain the third DC coefficient or the third AC coefficient;
    所述编码模块,还用于对所述第三直流系数或所述第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件。The encoding module is also configured to perform Huffman encoding on the third DC coefficient or the third AC coefficient to obtain a picture file in JPEG format.
  20. 根据权利要求17-19中任一项所述的设备,其特征在于,所述编码模块不用于:The device according to any one of claims 17-19, characterized in that the encoding module is not used for:
    对所述第三直流系数和所述第三交流系数进行哈夫曼编码以得到JPEG格式的图片文件;Perform Huffman coding on the third DC coefficient and the third AC coefficient to obtain a picture file in JPEG format;
    对所述JPEG格式的图片文件进行哈夫曼解码以得到第四直流系数和第四交流系数;Perform Huffman decoding on the picture file in JPEG format to obtain the fourth DC coefficient and the fourth AC coefficient;
    对所述第四直流系数和所述第四交流系数进行算术编码或非对称编码以得到第三图片文件。Arithmetic coding or asymmetric coding is performed on the fourth DC coefficient and the fourth AC coefficient to obtain a third picture file.
  21. 一种计算机设备,包括处理器和存储器,所述处理器与所述存储器耦合,其特征在于,A computer device including a processor and a memory, the processor being coupled to the memory, characterized in that:
    所述存储器,用于存储程序;The memory is used to store programs;
    所述处理器,用于执行所述存储器中的程序,使得所述计算机设备执行如权利要求1-6或7-11中任一项所述的方法。The processor is configured to execute the program in the memory, so that the computer device executes the method according to any one of claims 1-6 or 7-11.
  22. 一种计算机可读存储介质,包括程序,当其在计算机上运行时,使得计算机执行如权利要求1-6或7-11中任一项所述的方法。A computer-readable storage medium includes a program that, when run on a computer, causes the computer to perform the method according to any one of claims 1-6 or 7-11.
  23. 一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行如权利要求1-6或7-11中任一项所述的方法。 A computer program product containing instructions that, when run on a computer, cause the computer to perform the method according to any one of claims 1-6 or 7-11.
PCT/CN2023/092770 2022-05-30 2023-05-08 Picture processing method and related device WO2023231710A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210596528.4 2022-05-30
CN202210596528.4A CN117221740A (en) 2022-05-30 2022-05-30 Picture processing method and related equipment

Publications (1)

Publication Number Publication Date
WO2023231710A1 true WO2023231710A1 (en) 2023-12-07

Family

ID=89026895

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/092770 WO2023231710A1 (en) 2022-05-30 2023-05-08 Picture processing method and related device

Country Status (2)

Country Link
CN (1) CN117221740A (en)
WO (1) WO2023231710A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1988596A (en) * 2005-12-22 2007-06-27 海信集团有限公司 MPEG format picture display method for set-top box
KR20110038467A (en) * 2009-10-08 2011-04-14 엘지전자 주식회사 Method and apparatus for generating a compressed file, and terminal having the apparatus
CN108111858A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of picture compression method and device
CN113079379A (en) * 2021-03-26 2021-07-06 山东英信计算机技术有限公司 Video compression method, device, equipment and computer readable storage medium
CN113365016A (en) * 2020-03-05 2021-09-07 阿里巴巴集团控股有限公司 Real-time map image data acquisition system and method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1988596A (en) * 2005-12-22 2007-06-27 海信集团有限公司 MPEG format picture display method for set-top box
KR20110038467A (en) * 2009-10-08 2011-04-14 엘지전자 주식회사 Method and apparatus for generating a compressed file, and terminal having the apparatus
CN108111858A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of picture compression method and device
CN113365016A (en) * 2020-03-05 2021-09-07 阿里巴巴集团控股有限公司 Real-time map image data acquisition system and method
CN113079379A (en) * 2021-03-26 2021-07-06 山东英信计算机技术有限公司 Video compression method, device, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN117221740A (en) 2023-12-12

Similar Documents

Publication Publication Date Title
JP6703032B2 (en) Backward compatibility extended image format
US7899260B2 (en) Method and apparatus for generating thumbnail of digital image
US8254700B1 (en) Optimized method and system for entropy coding
US20060147122A1 (en) Method and apparatus for processing a compressed image in an order other than the order in which it was compressed
US8682091B2 (en) Real-time image compression
WO2021031877A1 (en) Methods and apparatus for image coding and decoding, and chip
US9819957B2 (en) Method and apparatus for decoding a progressive JPEG image
CA2774940C (en) Joint scalar embedded graphics coding for color images
JP2004032698A (en) Differential image compressing method and apparatus
WO2023231710A1 (en) Picture processing method and related device
JP2023062136A (en) Block-based picture fusion for contextual segmentation and processing
KR20160082521A (en) Chroma down-conversion and up-conversion processing
US20200322621A1 (en) Video decoder and manufacturing method therefor, and data processing circuit, system and method
US10856011B2 (en) Method and apparatus for color difference transform
US10609411B1 (en) Cross color prediction for image/video compression
JP4241517B2 (en) Image encoding apparatus and image decoding apparatus
CN114375577A (en) Joint component quadratic transform
CN111953972A (en) Hash table construction method, device and equipment in IBC mode
WO2023174040A1 (en) Picture processing method and related device
KR20200107745A (en) Sub-block based entropy coding for embedded image codec
TW200421203A (en) Run length encoded digital image
US9154800B2 (en) Method and apparatus for a memory efficient approach for decoding progressive joint photographic experts group (JPEG) images
WO2023185806A1 (en) Image coding method and apparatus, image decoding method and apparatus, and electronic device and storage medium
WO2015192340A1 (en) Palette-based image coding method, device and image processing device
CN115529465A (en) Image transmission method, system and device and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23814896

Country of ref document: EP

Kind code of ref document: A1