Image decompression method and device
By acquiring quantized data from the compressed image data of the image block and converting it into original pixel data, the problem of high complexity of decompression calculation in the prior art is solved, and an image decompression effect with lower complexity and power consumption is achieved.
Patent Information
- Application Number
- CN202210994705.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-18
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-08-18
Smart Images

Figure CN115361554B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of computer technology, chip design, and graphic image display, and in particular to a method and device for image decompression. Background Art
[0002] With the popularization of Internet applications, more and more applications involve image processing, image transmission and other services, which usually require image compression to save network resources and computing resources.
[0003] Existing image decompression methods usually target larger pixel blocks (e.g., 16x16, 8x8, etc.) generated by compression methods such as JPEG. The large pixel block size and low compression rate result in high decompression computational complexity, which increases the requirements for computing resources of image processing devices and makes it difficult to apply to low-complexity, low-power hardware devices. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a method and device for image decompression, which can obtain quantized data from compressed image data of an image block; determine a quantized coding method corresponding to the quantized type according to the header coding of the quantized data; based on the quantized coding method, convert the quantized data into original pixel data; and generate a decompressed image of the compressed image based on the original pixel data of each of the image blocks; the embodiment of the present invention reduces the computational complexity of the decompressed image, thereby reducing the difficulty of hardware design and power consumption requirements.
[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a method for image decompression is provided, characterized in that it includes: determining compressed image data of one or more image blocks of a set size contained in a compressed image; the compressed image data includes quantization data of the image block; wherein the quantization data includes first quantization data of each of three pixel channels; for each pixel channel contained in the image block, executing: determining a quantization encoding method for the first quantization data according to a header code contained in the first quantization data; based on the quantization encoding method, converting the first quantization data into original pixel data of the pixel channel; and generating a decompressed image of the compressed image in combination with the original pixel data corresponding to each pixel channel contained in each of the image blocks.
[0006] Optionally, the quantization encoding method indicates a calculation relationship between a reference pixel and one or more other pixels corresponding to the reference pixel;
[0007] Based on the quantization encoding method, the first quantization data is converted into the original pixel data of the pixel channel, including: obtaining a target reference pixel of the first quantization data, and determining one or more other pixels corresponding to the target reference pixel using the calculation relationship indicated by the quantization encoding method; determining the key pixel data according to the target reference pixel and each of the other pixels included in the first quantization data; and generating the original pixel data of the pixel channel based on the key pixel data.
[0008] Optionally, the compressed image data further includes: a feature identifier; wherein the feature identifier indicates a feature type for determining the compressed image data;
[0009] Determining the key pixel data further includes: acquiring the feature identifier from the compressed image data; and determining the key pixel data corresponding to the feature type according to the feature identifier.
[0010] Optionally, the compressed image data also includes a feature code of the image block corresponding to the feature identifier; a plurality of preset decompression strategies are set for generating raw pixel data from the key pixel data; the feature code and the preset decompression strategy have a decompression correspondence relationship; and the generating of the raw pixel data of the pixel channel based on the key pixel data comprises: based on the decompression correspondence relationship, determining a target decompression strategy matching the feature code from a plurality of preset decompression strategies, and using the target decompression strategy, executing the step of generating the raw pixel data of the pixel channel based on the key pixel data.
[0011] Optionally, the image decompression method further includes: when the image block contains multiple sub-image blocks, the compressed image data includes feature codes of each of the sub-image blocks; for each sub-image block, based on the key pixel data of each pixel channel of the sub-image block, generating original pixel data of the sub-image block; and generating original pixel data of the image block according to the original pixel data of each sub-image block.
[0012] Optionally, determining the compressed image data of one or more image blocks of a set size contained in the compressed image includes:
[0013] receiving a data stream of any image block of a set size, and extracting compressed image data of the image block of the set size from the data stream;
[0014] Alternatively, the compressed image is divided into a plurality of image blocks of a set size, and the compressed image data is extracted from the image blocks.
[0015] Optionally, the image decompression method further comprises:
[0016] The step of generating a decompressed image of the compressed image based on the original pixel data of each of the image blocks comprises:
[0017] Directly generate a decompressed image of the compressed image using the processed multiple original pixel data corresponding to the compressed image; or, send the original pixel data to other processing modules so that the other processing modules generate a decompressed image of the compressed image using the received multiple original pixel data corresponding to the compressed image.
[0018] Optionally, the compressed image data is of a first set length;
[0019] The quantized data of each pixel channel included in the image compression data is of a second set length; wherein the first quantized data corresponding to each pixel channel is composed of a combination of a header code and second quantized data.
[0020] To achieve the above object, according to a second aspect of an embodiment of the present invention, there is provided an image decompression device, characterized in that it comprises: a data processing module and an image decompression module; wherein:
[0021] The data processing module is used to determine compressed image data of one or more image blocks of a set size contained in the compressed image; the compressed image data includes quantized data of the image blocks; wherein the quantized data includes first quantized data of each of three pixel channels;
[0022] The image decompression module is used to perform the following operations for each pixel channel included in the image block: determining a quantization encoding method for the first quantization data according to a header code included in the first quantization data; converting the first quantization data into original pixel data of the pixel channel based on the quantization encoding method; and generating a decompressed image of the compressed image by combining the original pixel data corresponding to each pixel channel included in each of the image blocks.
[0023] Optionally, the image decompression device includes the quantization encoding method indicating a reference pixel, and a calculation relationship between one or more other pixels corresponding to the reference pixel; based on the quantization encoding method, the first quantization data is converted into original pixel data of the pixel channel, including: obtaining a target reference pixel of the first quantization data, and determining one or more other pixels corresponding to the target reference pixel using the calculation relationship indicated by the quantization encoding method; determining the key pixel data based on the target reference pixel and each of the other pixels contained in the first quantization data; and generating the original pixel data of the pixel channel based on the key pixel data.
[0024] Optionally, the image decompression device includes the compressed image data further comprising: a feature identifier; wherein the feature identifier indicates a feature type of the compressed image data; determining the key pixel data further comprises: obtaining the feature identifier from the compressed image data; and determining the key pixel data corresponding to the feature type based on the feature identifier.
[0025] Optionally, the image decompression device includes compressed image data that also includes a feature code of the image block corresponding to the feature identifier; multiple preset decompression strategies are set for generating original pixel data from the key pixel data; the feature code and the preset decompression strategy have a decompression correspondence relationship; and the generating of the original pixel data of the pixel channel based on the key pixel data includes: based on the decompression correspondence, determining a target decompression strategy that matches the feature code from multiple preset decompression strategies, and using the target decompression strategy, executing the step of generating the original pixel data of the pixel channel based on the key pixel data.
[0026] Optionally, the image decompression device is further used for, when the image block contains multiple sub-image blocks, the compressed image data includes feature codes of each of the sub-image blocks; for each sub-image block, based on key pixel data of each pixel channel of the sub-image block, generating original pixel data of the sub-image block; and generating original pixel data of the image block based on the original pixel data of each sub-image block.
[0027] Optionally, the image decompression device is used to determine the compressed image data of one or more image blocks of a set size contained in the compressed image, including: receiving a data stream of any image block of the set size, and extracting the compressed image data of the image block of the set size from the data stream; or, dividing the compressed image into multiple image blocks of the set size, and extracting the compressed image data from the image blocks.
[0028] Optionally, the image decompression device is further used to generate a decompressed image of the compressed image based on the original pixel data of each of the image blocks, including: directly generating a decompressed image of the compressed image using the processed multiple original pixel data corresponding to the compressed image; or, sending the original pixel data to other processing modules so that the other processing modules generate a decompressed image of the compressed image using the received multiple original pixel data corresponding to the compressed image.
[0029] Optionally, the compressed image data included in the image decompression device is of a first set length; the quantization data of each pixel channel contained in the image compression data is of a second set length; wherein the first quantization data corresponding to each pixel channel is composed of a combination of a header code and a second quantization data.
[0030] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for image decompression, characterized in that it comprises: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above-mentioned image decompression methods.
[0031] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any method as described in the above-mentioned image decompression method is implemented.
[0032] An embodiment of the above invention has the following advantages or beneficial effects: it is capable of obtaining quantized data of an image block of a compressed set size, and for each pixel channel contained in the image block, executing: determining a quantized coding method for the first quantized data according to a header code contained in the first quantized data; based on the quantized coding method, converting the first quantized data into original pixel data of the pixel channel; combining the original pixel data corresponding to each pixel channel contained in each of the image blocks, generating a decompressed image of the compressed image; an embodiment of the present invention, through a quantized coding method corresponding to the quantized data, decompresses the quantized data into original pixel data; improves the effect of decompressing the image, reduces the computational complexity of the compressed image, and thus reduces the difficulty of hardware design and power consumption requirements.
[0033] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0035] Figure 1 is a flowchart of an image decompression method provided by an embodiment of the present invention;
[0036] Figure 2 is a flowchart of a decompression method for multiple image blocks provided by an embodiment of the present invention;
[0037] Figure 3 is a schematic diagram of the structure of image block compression data provided by an embodiment of the present invention;
[0038] Figure 4 It is a structural schematic diagram of an image decompression device provided by an embodiment of the present invention;
[0039] Figure 5A A schematic diagram of the structure of a chip providing image decompression according to an embodiment of the present invention;
[0040] Figure 5B A schematic structural diagram of a chip for image decompression provided by another embodiment of the present invention;
[0041] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0042] Figure 7 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0043] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0044] like Figure 1 As shown, an embodiment of the present invention provides a method for image decompression, which may include the following steps:
[0045] Step S101: Determine compressed image data of one or more image blocks of a set size contained in a compressed image; the compressed image data includes quantized data of the image blocks; wherein the quantized data includes first quantized data of each of three pixel channels.
[0046] Specifically, in response to a trigger condition for decompressing an image; wherein the trigger condition may be generated in application scenarios such as receiving an image receiving request, a page browsing request, and an image browsing request. wherein the compressed image after compression is composed of one or more image blocks of a set size, so preferably, when performing a decompression operation on the compressed image, the compressed image data of one or more image blocks may be processed. wherein the set size is, for example, 2×4; that is, the image block of the set size includes a 2×4 pixel area; it can be understood that the set size is associated with the size of the image blocks divided when compressing the original image, and the present invention does not limit the specific set size.
[0047] Furthermore, there are two methods for obtaining compressed image data:
[0048] The first method is: receiving a data stream of an image block of any set size, and extracting the compressed image data of the image block of the set size from the data stream. Specifically, in this method, the process of receiving the data stream, extracting the compressed image data, and performing decompression processing can only be for the received data stream, and the processing result is output after processing; similarly, the next data stream is received for processing; it can be understood that this method only processes the data stream of one image block, reduces the memory occupancy rate, reduces the computational complexity of the compressed image, and thus improves the efficiency of decompressing the image; it is particularly suitable for devices with limited computing resources and memory (such as chips, etc.).
[0049] The second method is to divide the compressed image into a plurality of image blocks of a set size, and extract the compressed image data from the image blocks. Specifically, by dividing the compressed image into a plurality of image blocks of a set size (e.g., 2×4, etc.), and extracting the compressed image data from the image blocks for decompression processing, the problem of high computational complexity caused by large-size image blocks in the prior art and difficulty in applying to low-complexity, low-power hardware devices is overcome.
[0050] That is, determining the compressed image data of one or more image blocks of a set size contained in the compressed image includes: receiving a data stream of any image block of a set size, and extracting the compressed image data of the image block of the set size from the data stream; or, dividing the compressed image into a plurality of image blocks of a set size, and extracting the compressed image data from the image blocks.
[0051] Furthermore, the compressed image data includes quantized data of the image block; wherein the quantized data includes first quantized data of each of the three pixel channels. The three pixel channel information may be RGB three pixel channel information, representing red (R), green (G), and blue (B) three pixel channels respectively. That is, each pixel channel has first quantized data.
[0052] In one embodiment of the present invention, the compression rate of the compressed image relative to the original image is 1 / 3. For example, the data of an original image block in the original image includes 2x4 pixels, each pixel includes three pixel channel information of RGB, each pixel channel information is 8 bits, and the total data volume of the original image block is 192 bits, where 192=3x 8x8; 3 represents 3 pixel channels, 8 represents 2x4, and 8 represents that each pixel channel information is 8 bits; for the original image block, if the data volume of the compressed image data after image compression processing is 64 bits, then the compression rate of the compressed image relative to the original image is 1 / 3; illustratively, the structure of the compressed image data of an image block is as follows Figure 3The schematic diagram is shown as follows:
[0053] like Figure 3 As shown, the data volume of the compressed image data is 64 bits (i.e., the first set length); wherein, the data volume of the first quantized data (i.e., compressed data, composed of Header and Quantitative data) of the three pixel channel (R, G, B) information is 15 bits (i.e., the second set length); Type represents a feature identifier (indicating that the feature type is a shape feature or a range feature, etc.), and the data volume of the feature identifier is 1 bit; F1 represents a feature code of a sub-image block contained in the image block; F2 represents a feature code of another sub-image block contained in the image block, composed of Figure 3 It can be seen from the schematic diagram of compressed image data that the data volume of the feature code of each sub-image is 9 bits, which is a component of the compressed image data. That is, the compressed image data is of a first set length; the quantized data of each pixel channel contained in the image compression data is of a second set length; wherein the quantized data of each pixel channel is composed of header data and pixel channel quantized data. For example: for the R pixel channel, R Header (representing the header code) and R Quantitative data (representing the second quantized data of the R pixel channel) are composed, wherein the size of the header code and the pixel channel quantized data is variable length, and the size of the combined header code and pixel channel quantized data is a set length (i.e., the second set length).
[0054] Step S102: for each pixel channel included in the image block, executing: determining a quantization encoding method for the first quantization data according to a header encoding included in the first quantization data; and converting the first quantization data into original pixel data of the pixel channel based on the quantization encoding method.
[0055] Specifically, it can be understood that when processing compressed image data, three pixel channels (RGB) are processed separately, and the processing flow and method are consistent. Therefore, in the embodiment of the present invention, the G pixel channel is taken as an example for explanation.
[0056] Further, according to the header code included in the first quantized data, a quantization coding method of the first quantized data is determined, taking the G pixel channel as an example: Table 1 shows the correspondence between the header code included in the first quantized data and the quantization coding method:
[0057] Table 1
[0058] Header encoding Quantization Coding Method 0 G1(H7)g0(2)g2(2)g3(3) 10 G1(H6)g0(2)g2(2)g3(3) 110 G0(H3)G1(H3)G2(H3)G3(H3) 1110 G1(H5)g0(2)g2(2)g3(2) 11110 G1(H4)g0(2)g2(2)g3(2) 111110 G(H8)0
[0059] Among them, the header code (Header) contained in the first quantized data adopts Huffman coding, which is a binary unique identifier of the quantized coding method. The corresponding data in the corresponding quantized coding method means: uppercase letters correspond to the high bits of the data; lowercase letters correspond to the difference of the high bits of the data; for example: through analysis, the header code contained in the first quantized data of the G pixel channel obtained is "10", then it can be seen from Table 1 that its corresponding quantized coding method is G1(H6)g0(2)g2(2)g3(3). That is, according to the header code contained in the first quantized data, the quantized coding method of the first quantized data is determined.
[0060] Further, the quantization encoding method indicates a calculation relationship between a reference pixel and one or more other pixels corresponding to the reference pixel; based on the quantization encoding method, converting the first quantization data into original pixel data of the pixel channel includes:
[0061] Obtain a target reference pixel of the first quantized data, and determine one or more other pixels corresponding to the target reference pixel using the calculation relationship indicated by the quantization encoding method; determine the key pixel data according to the target reference pixel and each of the other pixels included in the first quantized data; and generate original pixel data of the pixel channel based on the key pixel data.
[0062] The following is still explained with the example of Table 1. For example, the quantization coding method determined according to the header code is G1(H6)g0(2)g2(2)g3(3), where: G1 is the target reference pixel of the first quantization data, and G1(H6) is the high 6 bits of the G1 channel data; further, since g0(2), g2(2), and g3(3) are all complement data, the other pixels corresponding to the target reference pixel are calculated as G0, G2, and G3; where the method for calculating G0 is G0(H6)=G1(H6)+g0(2 ); similarly, calculate G2(H6)=G1(H6)+g2(2), G3(H6)=G2(H6)+g3(3); wherein, the calculation method of obtaining G0, G2, and G3 based on G1 is the calculation relationship between the reference pixel indicated by the quantization coding method and one or more other pixels corresponding to the reference pixel; and, determine the key pixel data according to the target reference pixel and each of the other pixels contained in the first quantization data, and G0, G1, G2, and G3 are the key pixel data.
[0063] Furthermore, if Figure 3 As shown, the compressed image data further includes: a feature identifier; wherein the feature identifier indicates a feature type for determining the compressed image data; for example Figure 3The Type shown is a feature identifier, and the feature type indicates the type to which the pixel of the compressed image data belongs, for example: shape feature or range feature (such as brightness feature), etc.; further, the key pixel feature is determined according to the feature type, that is, the feature identifier is obtained from the compressed image data; and the key pixel data corresponding to the feature type is determined according to the feature identifier.
[0064] Furthermore, the compressed image data also includes a feature code of the image block corresponding to the feature identifier; for example Figure 3 As shown, F1 or F2 is the feature code of the image block corresponding to the feature identifier; wherein F1 and F2 are feature codes of two sub-pixel blocks. In one embodiment of the present invention, when the image block contains multiple sub-image blocks, the compressed image data includes the feature codes of each of the sub-image blocks; for each sub-image block, based on the key pixel data of each pixel channel of the sub-image block, the original pixel data of the sub-image block is generated; and according to the original pixel data of each sub-image block, the original pixel data of the image block is generated.
[0065] Furthermore, the compressed image data also includes a feature code of the image block corresponding to the feature identifier; a plurality of preset decompression strategies are set for generating original pixel data from the key pixel data; the feature code and the preset decompression strategy have a decompression correspondence relationship; and the generating of the original pixel data of the pixel channel based on the key pixel data includes: based on the decompression correspondence relationship, determining a target decompression strategy matching the feature code from a plurality of preset decompression strategies, and using the target decompression strategy, executing the step of generating the original pixel data of the pixel channel based on the key pixel data.
[0066] Specifically, the following describes the cases where the feature type is a shape feature and a range feature respectively:
[0067] 1) For shape features: when it is determined that the feature type indicated by the feature identifier is a shape feature, key pixel data corresponding to the shape feature is determined, and the key pixel data associated with the shape feature is obtained to generate raw pixel data and set multiple preset decompression strategies. For shape features, the feature code and the preset decompression strategy have a decompression correspondence relationship as shown in Table 2.
[0068] For example: the feature code of sub-image block 1 contained in the image block is F1, and its data volume is 9 bits; it contains feature codes of three pixel channels (RGB) respectively; specifically, the schematic data in Table 2 takes a 2×2 sub-image block as an example, and parses out two types of shape key pixels contained therein according to the compressed image data, shape key pixel A and shape key pixel B; it can be understood that for a 2×4 image block, the shape key pixels of the two sub-image blocks contained therein are A1, B1, A2, and B2.
[0069] Table 2
[0070]
[0071] Exemplarily, when the first feature obtained is 001 (corresponding to 1 in decimal), the matching target decompression strategy is obtained. The feature code corresponds to the shape key pixel A and the shape key pixel B to indicate a variety of basic shapes, such as horizontal lines, vertical lines, oblique lines, and fold lines at various corners.
[0072] Further, for example, based on G0, G1, G2, G3, the shape key pixels of the two sub-image blocks are determined to be A1, B1, A2, B2. For the G pixel channel of a sub-image block, take Table 2 as an example: for example, the decimal of the first feature code parsed is 3, then it can be determined that "A=a; b=B; c=B; d=B" is a target decompression strategy that matches the feature code 3 from a plurality of preset decompression strategies; and the step of generating the original pixel data of the pixel channel based on the key pixel data is performed according to the target decompression strategy. That is, according to the parsed key pixel data A, B; the corresponding original pixel data a, b, c, d are generated; similarly, similar steps are performed for other pixel channels R, B to generate the corresponding original pixel data a, b, c, d. Further, after decompression is performed on the sub-image blocks respectively, the original pixel data of the image block is generated.
[0073] 2) For range features: when it is determined that the feature type indicated by the feature identifier is a range feature, key pixel data corresponding to the range feature is obtained, and the key pixel data associated with the range feature is obtained to generate raw pixel data and set multiple preset decompression strategies. For range features, the feature code and the preset decompression strategy have a decompression correspondence relationship.
[0074] Specifically, obtain the key pixel data corresponding to the range feature, for example: according to the three pixel channels RGB, determine the range key pixel corresponding to the range feature as R max , R min , G max , G min , B max , B min Among them, taking the R channel as an example, Rmax represents the maximum brightness corresponding to the range feature, R min Represents the minimum brightness value corresponding to the range feature.
[0075] The key pixel data associated with the range feature is obtained to generate raw pixel data and set multiple preset decompression strategies, wherein the multiple preset decompression strategies associated with the range feature are related to the brightness range to which the brightness belongs; for example, when the brightness is divided into 4 gears, examples of the multiple preset decompression strategies are shown in Table 3;
[0076] Taking the G pixel channel as an example, if the acquired feature code associated with the range feature is 1, then according to the various preset decompression strategies shown in Table 3, the target decompression strategy matching the feature code 1 is (Y max -Y min ) / 3+Y min ; Further, according to the obtained G max , G min Key pixel data, G max As Y max , G min As Y min The formula is input to generate the original pixel data of the pixel channel; that is, the target decompression strategy is used to perform the step of generating the original pixel data of the pixel channel based on the key pixel data.
[0077] Further, similar steps are performed for other pixel channels R and B to generate corresponding original pixel data. After decompression is performed on the sub-image blocks respectively, original pixel data of the image block is generated.
[0078] Table 3
[0079] Signature Code Default decompression strategy 0 <![CDATA[Y min ]]> 1 <![CDATA[(Y max -AND min ) / 3+Y min ]]> 2 <![CDATA[2(Y max -AND min ) / 3+Y min ]]> 3 <![CDATA[Y max ]]>
[0080] Step S103: combining the original pixel data corresponding to each pixel channel included in each of the image blocks to generate a decompressed image of the compressed image.
[0081] Specifically, for each pixel channel corresponding to RGB, the corresponding original pixel data is generated, and further, the decompressed image is obtained using the original pixel data.
[0082] Furthermore, there are two methods for generating a decompressed image of the compressed image based on the original pixel data of each of the image blocks:
[0083] The first method is to directly generate a decompressed image of the compressed image using the processed original pixel data corresponding to the compressed image. Specifically, the decompressed image of the compressed image is generated based on the original pixel data of each sub-image block or the original pixel data of an image block of a set size.
[0084] The second method: sending the original pixel data to other processing modules, so that the other processing modules generate a decompressed image of the compressed image using the received multiple original pixel data corresponding to the compressed image. In one embodiment of the present invention, when applied to a chip, the other processing modules may belong to the same chip as the module for decompressing the image, or may belong to different chips. For example, when receiving compressed image data of an image block of any set size, decompression processing is performed according to the compressed image data of the data stream, and the result of the decompression processing is sent to other processing modules, wherein the other processing modules are processing modules including storage and computing capabilities, and may perform operations such as splicing and integration on the received original pixel data of each image block to generate a decompressed image.
[0085] like Figure 2 As shown, an embodiment of the present invention provides a method for decompressing a compressed image, and the method may include the following steps:
[0086] Step S201: obtaining compressed image data of a plurality of image blocks of set sizes contained in a compressed image; the compressed image data comprises quantized data of the image blocks; wherein the quantized data comprises first quantized data of each of three pixel channels.
[0087] Step S202: Acquire a feature code corresponding to the feature identifier from the compressed image data.
[0088] Step S203: determining a target decompression strategy that matches the feature code from a plurality of preset decompression strategies, and executing a step of generating original pixel data of the pixel channel based on the key pixel data using the target decompression strategy.
[0089] Step S204: determine whether the first quantized data of each pixel channel is decompressed, if yes, execute step S205; otherwise, execute step S202.
[0090] Step S205: Determine whether the compressed image data of each image block has been processed, if so, execute step S206; otherwise, execute step S201.
[0091] Step S206: combining the original pixel data corresponding to each pixel channel included in each of the image blocks to generate a decompressed image of the compressed image.
[0092] Specifically, step S201-step S206 includes a process of looping each pixel channel and looping each image block. That is, for each pixel channel contained in the image block, perform: determine the quantization encoding method of the first quantization data according to the header code contained in the first quantization data; based on the quantization encoding method, convert the first quantization data into the original pixel data of the pixel channel; combine the original pixel data corresponding to each pixel channel contained in each of the image blocks to generate the decompressed image of the compressed image. The specific description of the first quantization data, feature code, and key pixel data is consistent with the description of step S101-step S102, and will not be repeated here.
[0093] like Figure 4 As shown, the embodiment of the present invention provides an image decompression device 400, comprising: a data processing module 401 and an image decompression module 402; wherein,
[0094] The data processing module 401 is used to determine compressed image data of one or more image blocks of a set size contained in the compressed image; the compressed image data includes quantized data of the image blocks; wherein the quantized data includes first quantized data of each of the three pixel channels;
[0095] The image decompression module 402 is used to perform the following operations for each pixel channel included in the image block: determining a quantization coding method for the first quantization data based on a header code included in the first quantization data; converting the first quantization data into original pixel data of the pixel channel based on the quantization coding method; and generating a decompressed image of the compressed image by combining the original pixel data corresponding to each pixel channel included in each of the image blocks.
[0096] In one embodiment of the present invention, the image decompression method is applied to a chip. The other processing modules and the module for processing image decompression may belong to the same chip (e.g. Figure 5A ), or belong to different chips (such as Figure 5B shown).
[0097] Figure 5AThe structure diagram of a chip 500A for providing an image decompression method according to an embodiment of the present invention is shown; the chip 500A comprises: an image decompression device 501A (e.g., a module for processing image decompression) and other processing modules 502A; the image decompression device 501A and the other processing modules 502A belong to the same chip; the image decompression device 501A receives a compressed image to be processed (e.g., an image block data stream, or compressed image data of a compressed image), performs the image decompression step, and sends the generated raw pixel data to other processing modules 502A in the chip; the other processing modules 502A can generate a decompressed image of the compressed image based on a plurality of raw pixel data; or send the decompressed image to a storage module, etc.
[0098] Figure 5B The structure diagram of a chip 501B for providing an image decompression method according to an embodiment of the present invention is shown; it includes: an image decompression device 501B; and other processing modules 502B belonging to other chips; wherein the image decompression device 501B receives a compressed image to be processed (such as an image block data stream, or compressed image data of a compressed image), performs the image decompression step, and sends the generated original pixel data to other processing modules 502B outside the chip; the other processing modules 502B can generate a decompressed image of the compressed image based on a plurality of the original pixel data; or send it to a storage module, etc.
[0099] In one embodiment of the present invention, the method for image decompression is applied to a chip, which reduces the computational complexity of decompressing the image, thereby reducing the difficulty of chip hardware design and the power consumption requirement for the chip.
[0100] An embodiment of the present invention also provides an electronic device for image decompression, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0101] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the image decompression method provided by any of the above embodiments is implemented.
[0102] Figure 6 An exemplary system architecture 600 is shown to which the method or apparatus for image decompression according to the embodiment of the present invention may be applied.
[0103] like Figure 6As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0104] Users can use terminal devices 601, 602, 603 to interact with server 605 through network 604 to receive or send messages, etc. Terminal devices 601, 602, 603 can be installed with various client applications, such as e-commerce client applications, web browser applications, instant messaging tools, and email clients.
[0105] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0106] The server 605 may be a server providing various services, such as a background management server providing support for client applications used by users using the terminal devices 601, 602, and 603. The background management server may process the received request for decompressing the image and feed back the decompressed image to the terminal device.
[0107] It should be noted that the image decompression method provided in the embodiment of the present invention is generally executed by the terminal device 601, 602, 603 or the server 605. Accordingly, the image decompression device can be set in the terminal device 601, 602, 603 or in the server 605.
[0108] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0109] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0110] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0111] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a display device such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A driver 710 is also connected to the I / O interface 705 as needed. The removable medium 711, such as a disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that the computer program read therefrom can be installed into the storage part 708 as needed. In an embodiment of the present invention, the original image data of the image block is collected by the camera module 712, and the image is encoded and compressed by the central processing unit (CPU) 701 or the dedicated integrated circuit module, and then the compressed data is stored in the memory. When the image is decompressed, the image compression data can be obtained from the memory, and the decompression processing described in the embodiment of the present invention is performed by the central processing unit (CPU) 701 or the dedicated integrated circuit module, and the processed decompressed image is displayed by the display module 713 via the I / O interface 705.
[0112] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.
[0113] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0114] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0115] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware. The modules and / or units described may also be set in a processor, for example, they may be described as: a processor includes a data processing module and an image decompression module; wherein the names of these modules do not constitute a limitation on the modules themselves in certain circumstances, for example, the data processing module may also be described as "determining compressed image data of one or more image blocks of a set size contained in a compressed image".
[0116] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes: determining compressed image data of one or more image blocks of set sizes contained in the compressed image; the compressed image data includes quantization data of the image block; wherein the quantization data includes first quantization data of each pixel channel in three pixel channels; for each pixel channel contained in the image block, executing: determining a quantization coding method of the first quantization data according to the header code contained in the first quantization data; based on the quantization coding method, converting the first quantization data into the original pixel data of the pixel channel; combining the original pixel data corresponding to each pixel channel contained in each of the image blocks, generating a decompressed image of the compressed image.
[0117] The embodiments of the present invention can obtain quantized data from compressed image data of a compressed image; determine a quantized coding method corresponding to the quantized type according to the header coding of the quantized data; convert the quantized data into original pixel data based on the quantized coding method; and generate a decompressed image of the compressed image based on the original pixel data of each of the image blocks; the embodiments of the present invention reduce the computational complexity of the decompressed image, thereby reducing the difficulty of hardware design and power consumption requirements.
[0118] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for image decompression, characterized in that: include: Determining compressed image data of one or more image blocks of a set size contained in the compressed image; The compressed image data includes quantized data of the image block; wherein the quantized data includes first quantized data of each of three pixel channels; The first quantized data corresponding to each pixel channel is composed of a header code and a second quantized data; wherein the size of the header code and the second quantized data of the pixel channel is a variable length; and the size of the first quantized data is a set length; For each pixel channel included in the image block, executing: determining a quantization encoding method of the first quantization data according to a header code included in the first quantization data; and converting the first quantization data into original pixel data of the pixel channel based on the quantization encoding method; The original pixel data corresponding to each pixel channel included in each of the image blocks is combined to generate a decompressed image of the compressed image.
2. The method according to claim 1, characterized in that: The quantization encoding method indicates a calculation relationship between a reference pixel and one or more other pixels corresponding to the reference pixel; Based on the quantization encoding method, converting the first quantized data into original pixel data of the pixel channel includes: Acquire a target reference pixel of the first quantized data, and determine one or more other pixels corresponding to the target reference pixel by using the calculation relationship indicated by the quantization encoding method; Key pixel data is determined according to the target reference pixel and each of the other pixels included in the first quantized data; and original pixel data of the pixel channel is generated based on the key pixel data.
3. The method according to claim 2, characterized in that The compressed image data further includes: a feature identifier; wherein the feature identifier indicates a feature type for determining the compressed image data; Determining the key pixel data further includes: Acquire the feature identifier from the compressed image data; The key pixel data corresponding to the feature type is determined according to the feature identifier.
4. The method according to claim 3, characterized in that The compressed image data also includes a feature code of the image block corresponding to the feature identifier; a plurality of preset decompression strategies are set for generating raw pixel data from the key pixel data; The feature code and the preset decompression strategy have a decompression corresponding relationship; The generating the original pixel data of the pixel channel based on the key pixel data comprises: Based on the decompression correspondence, a target decompression strategy matching the feature code is determined from a plurality of preset decompression strategies, and the target decompression strategy is used to execute the step of generating original pixel data of the pixel channel based on the key pixel data.
5. The method according to claim 4, characterized in that Further including: In the case where the image block contains multiple sub-image blocks, the compressed image data includes a feature code of each of the sub-image blocks; For each sub-image block, generating original pixel data of the sub-image block based on key pixel data of each pixel channel of the sub-image block; The original pixel data of the image block is generated according to the original pixel data of each sub-image block.
6. The method according to claim 1, characterized in that The step of determining compressed image data of one or more image blocks of a set size contained in the compressed image comprises: receiving a data stream of any image block of a set size, and extracting compressed image data of the image block of the set size from the data stream; or, The compressed image is divided into a plurality of image blocks of a set size, and compressed image data is extracted from the image blocks.
7. The method according to claim 1, characterized in that The combining the original pixel data corresponding to each pixel channel included in each of the image blocks to generate a decompressed image of the compressed image includes: Directly generate a decompressed image of the compressed image by using the processed plurality of original pixel data corresponding to the compressed image; or, The original pixel data is sent to other processing modules, so that the other processing modules generate a decompressed image of the compressed image by using the received multiple original pixel data corresponding to the compressed image.
8. The method according to claim 1, characterized in that: The compressed image data has a first set length; The quantized data of each pixel channel included in the compressed image data has a second set length.
9. An image decompression device, characterized in that: include: Data processing module and image decompression module; wherein, The data processing module is used to determine compressed image data of one or more image blocks of a set size contained in the compressed image; the compressed image data includes quantized data of the image blocks; wherein the quantized data includes first quantized data of each pixel channel in three pixel channels; the first quantized data corresponding to each pixel channel is composed of a header code and second quantized data; wherein the size of the header code and the second quantized data of the pixel channel is a variable length; and the size of the first quantized data is a set length; The image decompression module is used to perform the following operations for each pixel channel included in the image block: determining a quantization encoding method for the first quantization data according to a header code included in the first quantization data; converting the first quantization data into original pixel data of the pixel channel based on the quantization encoding method; and generating a decompressed image of the compressed image by combining the original pixel data corresponding to each pixel channel included in each of the image blocks.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Image compression method and device
CN110072108A
Video encoding method / apparatus, and video decoding method / apparatus
CN110234010A