Image compression and image decompression method, device, equipment and storage medium

By transforming the image to the frequency domain and setting the quantization step size according to the frequency level, the problem of inflexible quantization step size in the existing technology is solved, achieving a balance between image compression rate and fidelity, and adapting to the image compression needs of different scenarios.

CN118741121BActive Publication Date: 2025-12-30MOORE THREADS TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202410881380.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2025-12-30
Estimated Expiration
2044-07-02

AI Technical Summary

Technical Problem

In existing technologies, the quantization step size setting for pixels during image compression is not flexible enough, resulting in poor image compression performance and difficulty in balancing compression ratio and fidelity.

Method used

By transforming the image from the spatial domain to the frequency domain, determining the target quantization step size based on the pixel frequency level, compressing the transformation coefficients, and designing different quantization step sizes to adapt to pixels of different frequency levels, a flexible compression method is achieved.

Benefits of technology

It improves the flexibility of the image compression process, taking into account both the compression rate and fidelity of the image, and adapts to the image needs of different scene types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118741121B_ABST
    Figure CN118741121B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose an image compression and image decompression method, device, equipment and storage medium, wherein the image compression method comprises: obtaining a first image; transforming the first image from a spatial domain to a frequency domain to obtain first transform coefficients corresponding to each pixel in the first image; and performing compression processing on the corresponding first transform coefficients by using a target quantization step corresponding to each pixel to obtain first image compression data; the target quantization step corresponding to each pixel is determined according to a frequency level corresponding to the pixel. According to the embodiments of the present disclosure, different quantization steps can be designed according to the frequency level corresponding to each pixel to perform compression processing on the corresponding first transform coefficients, so that the flexibility in the image compression process can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to, but is not limited to, the field of image processing, and particularly to an image compression and decompression method, apparatus, device, and storage medium. Background Technology

[0002] In the field of image processing, lossy compression schemes that achieve subjective visual losslessness can be used to reduce image bandwidth and memory usage. Subjective visual losslessness means that, through lossy compression techniques, the human eye cannot distinguish the difference between the compressed and decompressed images. However, in related technologies, the quantization step size settings for each pixel during image compression are not flexible enough. Summary of the Invention

[0003] In view of this, the present disclosure provides at least one method, apparatus, device, and storage medium for image compression and decompression.

[0004] The technical solution of this disclosure embodiment is implemented as follows:

[0005] This disclosure provides an image compression method, the method comprising:

[0006] Get the first image;

[0007] The first image is transformed from the spatial domain to the frequency domain to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0008] The first transform coefficients are compressed using the target quantization step size corresponding to each pixel to obtain the first image compressed data; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel.

[0009] This disclosure provides an image decompression method, the method comprising:

[0010] Obtain first image compressed data; the first image compressed data includes the compressed value corresponding to each pixel in the first restored image to be restored;

[0011] Using the target quantization step size corresponding to each pixel, the corresponding compressed value is decompressed to obtain the second transform coefficient corresponding to each pixel; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel;

[0012] The second transformation coefficients corresponding to each pixel are transformed from the frequency domain to the spatial domain to obtain the first restored image.

[0013] This disclosure provides an image compression apparatus, the apparatus comprising:

[0014] The first acquisition module is used to acquire the first image;

[0015] The first transformation module is used to transform the first image from the spatial domain to the frequency domain to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0016] The compression module is used to compress the corresponding first transform coefficients using the target quantization step size corresponding to each pixel to obtain first image compressed data; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel.

[0017] This disclosure provides an image decompression apparatus, the apparatus comprising:

[0018] The second acquisition module is used to acquire first image compressed data; the first image compressed data includes the compressed value corresponding to each pixel in the first restored image to be restored.

[0019] The decompression module is used to decompress the corresponding compressed value using the target quantization step size corresponding to each pixel to obtain the second transform coefficient corresponding to each pixel; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel;

[0020] The second transformation module is used to transform the second transformation coefficients corresponding to each pixel from the frequency domain to the spatial domain to obtain the first restored image.

[0021] This disclosure provides a computer device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.

[0022] This disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements some or all of the steps in the above-described method.

[0023] This disclosure provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement some or all of the steps in the above-described method.

[0024] In this embodiment, a first image is acquired and transformed from the spatial domain to the frequency domain to obtain first transformation coefficients corresponding to each pixel in the first image. The first transformation coefficients are then compressed using the target quantization step size corresponding to each pixel to obtain compressed first image data. The target quantization step size for each pixel is determined based on the frequency level corresponding to that pixel. This allows for the design of different quantization step sizes to compress the corresponding first transformation coefficients based on the frequency level of each pixel, thereby improving the flexibility in the image compression process. Furthermore, the overall compression rate and fidelity requirements of the image can be balanced through a flexibly set quantization step size.

[0025] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this disclosure. Attached Figure Description

[0026] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the specification, serve to illustrate the technical solutions of this disclosure.

[0027] Figure 1 A schematic diagram of the implementation process of an image compression method provided in this disclosure embodiment. Figure 1 ;

[0028] Figure 2 A schematic diagram of the implementation process of an image compression method provided in this disclosure embodiment. Figure 2 ;

[0029] Figure 3 A schematic diagram of the implementation process of an image decompression method provided in this embodiment of the present disclosure. Figure 1 ;

[0030] Figure 4 A schematic diagram of a compression method combining a frequency domain segmented quantization-based subjective lossless image compression method and a dithering compression coding method provided in this embodiment of the present disclosure;

[0031] Figure 5 A schematic diagram illustrating the transformation of an image from the spatial domain to the frequency domain along the horizontal direction, as provided in an embodiment of this disclosure;

[0032] Figure 6 This is a schematic diagram illustrating an embodiment of the present disclosure of transforming an image along a vertical direction;

[0033] Figure 7 This is a schematic diagram illustrating the correspondence between quantization step size and image block position, provided in an embodiment of the present disclosure.

[0034] Figure 8A schematic diagram of the implementation process of an image decompression method provided in this embodiment of the present disclosure. Figure 2 ;

[0035] Figure 9A This is a schematic diagram of the composition structure of an image compression device provided in an embodiment of the present disclosure;

[0036] Figure 9B This is a schematic diagram of the composition structure of an image decompression apparatus provided in an embodiment of the present disclosure;

[0037] Figure 10 This is a schematic diagram of the hardware entity of a computer device provided in an embodiment of this disclosure. Detailed Implementation

[0038] To make the objectives, technical solutions, and advantages of this disclosure clearer, the technical solutions of this disclosure are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this disclosure. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0039] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0040] The terms “first / second / third” are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that “first / second / third” may be interchanged in a specific order or sequence where permitted, so that the embodiments of this disclosure described herein can be implemented in an order other than that illustrated or described herein.

[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains. The terminology used herein is for descriptive purposes only and is not intended to limit the scope of this disclosure.

[0042] In view of this, embodiments of the present disclosure provide an image compression method. Figure 1 A schematic diagram of the implementation process of an image compression method provided in this disclosure embodiment. Figure 1 ,like Figure 1 As shown, the method includes the following steps S101 to S103:

[0043] Step S101: Obtain the first image;

[0044] Here, the first image can be any suitable image to be compressed, and this disclosure does not limit this.

[0045] In some implementations, the first image is the original image to be compressed.

[0046] In some implementations, the first image is one of a plurality of image blocks divided from the original image. For example, the original image can be divided into a plurality of 4x4 image blocks, and the first image is a 4x4 image block; or the original image can be divided into a plurality of 8x8 image blocks, and the first image is an 8x8 image block.

[0047] Step S102: Transform the first image from the spatial domain to the frequency domain to obtain the first transformation coefficients corresponding to each pixel in the first image;

[0048] Here, the first image is transformed from the spatial domain to the frequency domain to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0049] In some implementations, the first image can be transformed from the spatial domain to the frequency domain using the Haar algorithm. Transforming the first image from the spatial domain to the frequency domain includes performing frequency separation processing on the first image along the horizontal and / or vertical directions. For example, the first image can be frequency separated along the horizontal direction, and then further frequency separation processing can be performed along the vertical direction to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0050] In some implementations, the first image can be transformed from the spatial domain to the frequency domain using Discrete Cosine Transform (DCT) and / or Discrete Wavelet Transform (DWT).

[0051] Step S103: Using the target quantization step size corresponding to each pixel, the corresponding first transform coefficient is compressed to obtain the first image compressed data; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel.

[0052] In some implementations, the target quantization step size for each pixel is determined based on the target compression ratio and the frequency level corresponding to each pixel.

[0053] In some implementations, the quantization step size can be adaptively adjusted based on the local or global characteristics of the image to ultimately determine the target quantization step size for each pixel.

[0054] In some implementations, the target quantization step size corresponding to each pixel can be preset by those skilled in the art according to actual needs.

[0055] In some implementations, for pixels in the first image, the higher the frequency level of the pixel, the smaller the target quantization step size. For example, a smaller target quantization step size is used for pixels with higher frequency levels, and a larger target quantization step size is used for pixels with lower frequency levels.

[0056] In some implementations, the higher the frequency level of a pixel in the first image, the smaller the target quantization step size of the pixel. This can effectively protect the high-frequency components in the image from being over-compressed, reduce compression loss, and improve image fidelity, while also increasing the compression rate of the low-frequency components in the image, thus balancing the overall compression rate requirements and fidelity requirements of the image.

[0057] In some embodiments, for a pixel in the first image, the target quantization step size can be determined based on the frequency level corresponding to the pixel and the scene type of the first image. The scene type of the first image represents the scene corresponding to the content contained in the first image. For example, the scene type may include at least one of text type, natural texture type, etc.

[0058] In some embodiments, a target quantization step size corresponding to the scene type can be set for pixels at each frequency level according to the scene type of the first image. For example, for a text-type first image, since the human eye is usually more sensitive to high-frequency information in this type of image, that is, pixels corresponding to higher frequency levels in a text-type first image are more easily perceived by the human eye, in a text-type first image, for pixels whose corresponding frequency level is higher than the first target level, the target quantization step size corresponding to that pixel is less than the first step size threshold. In this way, for pixels corresponding to higher frequency levels in a text-type first image, by setting a smaller target quantization step size, the compression loss of that pixel can be reduced, and the subjective visual effect of the compressed and decompressed image can be improved. For example, in the case of natural texture scenes, since the human eye is not very sensitive to high-frequency information in this type of image, that is, the pixels corresponding to higher frequency levels in the first image of natural texture are less likely to be perceived, in the first image of natural texture, for pixels whose corresponding frequency level is higher than the first target level, the target quantization step size corresponding to the pixel is greater than the first step size threshold. In this way, by setting a larger target quantization step size for pixels corresponding to higher frequency levels in the first image of natural texture, the compression rate of the image can be improved, thereby improving the image transmission speed and reducing the image transmission bandwidth.

[0059] In some embodiments, when the scene type of the first image is text, the target quantization step size of the pixel corresponding to the first frequency level is larger than the target quantization step size of the pixel corresponding to the second frequency level; when the scene type of the first image is natural texture, the target quantization step size of the pixel corresponding to the first frequency level is smaller than the target quantization step size of the pixel corresponding to the second frequency level; wherein, the second frequency level is higher than the first frequency level. Thus, by designing different target quantization step sizes for different frequency levels according to the scene type of the first image, more suitable target quantization step sizes are designed for each pixel in the first image of different scene types, resulting in better compression performance of the first image.

[0060] In some implementations, compressing each first transform coefficient includes quantizing each first transform coefficient to obtain a first quantized value corresponding to each first transform coefficient, and encoding the first quantized value corresponding to each first transform coefficient to obtain first image compressed data.

[0061] In this embodiment, a first image is acquired and transformed from the spatial domain to the frequency domain to obtain first transformation coefficients corresponding to each pixel in the first image. The first transformation coefficients are then compressed using the target quantization step size corresponding to each pixel to obtain compressed first image data. The target quantization step size for each pixel is determined based on the frequency level corresponding to that pixel. This allows for the design of different quantization step sizes to compress the corresponding first transformation coefficients based on the frequency level of each pixel, thereby improving the flexibility in the image compression process. Furthermore, by flexibly setting different target quantization step sizes for each pixel based on its different frequency levels, different quantization step sizes can balance the overall image compression ratio requirements with fidelity requirements.

[0062] In some embodiments, step S102 may include the following step S111:

[0063] Step S111: Perform frequency separation processing on the first image along the horizontal and / or vertical directions to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0064] In some implementations, the first image is subjected to frequency separation processing along the horizontal direction to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0065] In some implementations, the first image is subjected to frequency separation processing along the vertical direction to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0066] In some implementations, the first image is subjected to frequency separation processing along the horizontal direction. Based on this, the image after frequency separation processing along the horizontal direction is subjected to frequency separation processing along the vertical direction to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0067] In some implementations, the first image is subjected to frequency separation processing along the vertical direction. Based on this, the image after frequency separation processing along the vertical direction is subjected to frequency separation processing along the horizontal direction to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0068] In this embodiment, the first image is subjected to frequency separation processing along the horizontal and / or vertical directions to obtain the first transform coefficients corresponding to each pixel in the first image. This allows for better separation of the first transform coefficients corresponding to different frequency levels in the frequency domain.

[0069] In some embodiments, step S111 may include the following steps S121 and S122:

[0070] Step S121: Perform frequency separation processing on the first image along the horizontal direction to obtain the first transformed image;

[0071] In some embodiments, the first image and the first transformed image have the same size, and both the first image and the first transformed image have N columns, where N is greater than 3.

[0072] The pixel value of the first column of pixels in the first transformed image is equal to the pixel value of the first column of pixels in the first image. The pixel value of the (N-1)th column of pixels in the first transformed image is determined based on the pixel value of the (N-1)th column of pixels in the first image and the pixel value of the first column of pixels in the first image. The pixel value of the Nth column of pixels in the first transformed image is determined based on the pixel value of the Nth column of pixels in the first image and the pixel value of the (N-1)th column of pixels in the first image. The pixel value of the i-th column of pixels in the first transformed image is determined based on the pixel value of the i-th column of pixels in the first image and the pixel values ​​of at least two reference pixel columns in the first image corresponding to the i-th column of pixels. i is greater than 1 and less than N-1.

[0073] In some embodiments, the frequency level corresponding to the i-th column pixel is not lower than the frequency level corresponding to the 1-th column pixel; the frequency level corresponding to the (N-1)-th column pixel is higher than the frequency level corresponding to the i-th column pixel, and the frequency level corresponding to the N-th column pixel is higher than the frequency level corresponding to the i-th column pixel.

[0074] In some embodiments, the frequency level corresponding to the Nth column pixel in the first transformed image is higher than the frequency level corresponding to the (N-1)th column pixel; in some embodiments, the frequency level corresponding to the Nth column pixel in the first transformed image is the same as the frequency level corresponding to the (N-1)th column pixel.

[0075] For example, assuming that both the first image and the first transformed image are 4*4 image blocks, the first pixel of each row in the first image is taken as the base pixel and is not processed, that is, the first pixel of each row in the first transformed image is equal to the first pixel of each row in the first image; the difference between the third pixel of each row in the first image and the first pixel of each row in the first image is taken as the third pixel of each row in the first transformed image; the difference between the fourth pixel of each row in the first image and the third pixel of each row in the first image is taken as the fourth pixel of each row in the first transformed image; and the difference between the average of the first and third pixels of each row in the first image and the second pixel of each row in the first image is taken as the second pixel of each row in the first transformed image.

[0076] In some implementations, in the first transformed image, the frequency level of the second column of pixels is not lower than the frequency level of the first column of pixels; the frequency level of the third column of pixels is higher than the frequency level of the second column of pixels; and the frequency level of the fourth column of pixels is higher than the frequency level of the second column of pixels.

[0077] Step S122: Perform frequency separation processing on the first transformed image along the vertical direction to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0078] In some embodiments, the first image and the first transformed image have the same size, and both the first image and the first transformed image have M rows, where M is greater than 3.

[0079] The first transformation coefficient corresponding to the first row of pixels in the first image is equal to the pixel value of the first row of pixels in the first transformed image. The first transformation coefficient corresponding to the (M-1)th row of pixels in the first image is determined based on the pixel value of the (M-1)th row of pixels in the first transformed image and the pixel value of the first row of pixels in the first transformed image. The first transformation coefficient corresponding to the Mth row of pixels in the first image is determined based on the pixel value of the Mth row of pixels in the first transformed image and the pixel value of the (M-1)th row of pixels in the first transformed image. The first transformation coefficient corresponding to the jth row of pixels in the first image is determined based on the pixel value of the jth row of pixels in the first transformed image and the pixel values ​​of at least two reference pixel rows corresponding to the jth row of pixels in the first transformed image, where j is greater than 1 and less than M-1.

[0080] In some embodiments, the frequency level corresponding to the j-th row of pixels is not lower than the frequency level corresponding to the 1-th row of pixels, the frequency level corresponding to the (M-1)-th row of pixels is higher than the frequency level corresponding to the j-th row of pixels, and the frequency level corresponding to the M-th row of pixels is higher than the frequency level corresponding to the j-th row of pixels.

[0081] In some implementations, the frequency level corresponding to the pixels in the Mth row is higher than the frequency level corresponding to the pixels in the (M-1)th row; in some implementations, the frequency level corresponding to the pixels in the Mth row is the same as the frequency level corresponding to the pixels in the (M-1)th row.

[0082] For example, assuming that both the first image and the first transformed image are 4*4 image blocks, the first pixel of each column in the first transformed image is taken as the base pixel and is not processed. That is, the first transformation coefficient corresponding to the first pixel of each column in the first image is equal to the first pixel of each column in the first transformed image. The difference between the third pixel of each column in the first transformed image and the first pixel of each column in the first transformed image is taken as the first transformation coefficient corresponding to the third pixel of each column in the first image. The difference between the fourth pixel of each column in the first transformed image and the third pixel of each column in the first transformed image is taken as the first transformation coefficient corresponding to the fourth pixel of each column in the first image. The difference between the average of the first and third pixels of each column in the first transformed image and the second pixel of each column in the first transformed image is taken as the first transformation coefficient corresponding to the second pixel of each column in the first image.

[0083] In some implementations, in the first image, the frequency level corresponding to the pixels in the second row is not lower than the frequency level corresponding to the pixels in the first row; the frequency level corresponding to the pixels in the third row is higher than the frequency level corresponding to the pixels in the second row; and the frequency level corresponding to the pixels in the fourth row is higher than the frequency level corresponding to the pixels in the second row.

[0084] In this embodiment, the first image is subjected to frequency separation processing along the horizontal direction to obtain a first transformed image; the first transformed image is then subjected to frequency separation processing along the vertical direction to obtain the first transformation coefficients corresponding to each pixel in the first image. Thus, performing frequency separation processing from both the horizontal and vertical directions makes the frequency levels corresponding to the pixels obtained after frequency separation clearer and more accurate.

[0085] In some implementations, after performing frequency separation processing on the first image along the horizontal and / or vertical directions, the distribution of frequency levels corresponding to each pixel can be as follows: Figure 7 As shown, the frequency levels corresponding to parts b, c, and d are higher than the frequency levels corresponding to part a; the frequency levels corresponding to parts e, f, and g are higher than the frequency levels corresponding to parts b, c, and d.

[0086] In some embodiments, step S103 may include the following steps S131 and S132:

[0087] Step S131: Based on the target quantization step size corresponding to each pixel, quantize the corresponding first transformation coefficient to obtain the first quantization value corresponding to each first transformation coefficient.

[0088] Here, the target quantization step size is the quantization step size corresponding to each pixel in the target quantization step size group, and this correspondence is determined by the frequency level corresponding to each pixel.

[0089] Here, the first quantization value is the result of dividing each first transformation coefficient by the corresponding target quantization step size and rounding it to the nearest integer.

[0090] Step S132: Encode each of the first quantization values ​​to obtain the first image compressed data.

[0091] In some implementations, each first quantization value can be encoded using the exponential Golomb coding method to obtain the first image compressed data.

[0092] In some implementations, each first quantization value can be encoded using Huffman coding to obtain the first image compressed data.

[0093] In this embodiment, based on the target quantization step size corresponding to each pixel, the corresponding first transform coefficients are quantized to obtain first quantized values ​​corresponding to each first transform coefficient; each first quantized value is then encoded to obtain first image compressed data. This allows for flexible selection of the corresponding target quantization step size for each pixel, resulting in quantization results that meet actual requirements.

[0094] In some embodiments, the above method may further include the following steps S141 and S142:

[0095] Step S141: Based on the target compression ratio, select a target quantization step size group from the quantization step size group sequence; the quantization step size group sequence includes at least two quantization step size groups;

[0096] Here, the target compression ratio can be preset.

[0097] In some implementations, the later the quantization step group is in the quantization step group sequence, the greater the compression ratio corresponding to the quantization step group. Therefore, when traversing the quantization step group sequence, if there is a first quantization step group in the quantization step group sequence whose first compression ratio is greater than or equal to the target compression ratio, the traversal is stopped, and the first quantization step group is determined as the target quantization step group. In this way, the compression ratio requirement can be met without over-compression, thus ensuring image quality.

[0098] Each quantization step group in the quantization step group sequence can be pre-defined based on actual conditions. For example, the quantization step group sequence can be obtained through experimentation and calculation, or it can be analyzed and determined using mathematical or statistical models.

[0099] Understandably, the process involves iterating through the quantization step size groups in the sequence, quantizing each first transform coefficient using each quantization step size group, and encoding based on the quantized results. This yields the compression ratio corresponding to each quantization step size group. If the compression ratio of a quantization step size group is greater than or equal to the target compression ratio, that quantization step size group is designated as the target quantization step size group.

[0100] Step S142: Based on the frequency level corresponding to each pixel, determine the target quantization step size corresponding to each pixel from the target quantization step size group.

[0101] In some implementations, the target quantization step size group may include at least one target quantization step size corresponding to each frequency level, so that for each pixel, the target quantization step size corresponding to the frequency level in the target quantization step size group can be determined as the target quantization step size corresponding to the pixel according to the frequency level corresponding to the pixel.

[0102] In some implementations, the higher the frequency level of a pixel, the smaller the target quantization step size of the pixel.

[0103] In some implementations, to ensure the effectiveness of compression processing of the first image, the target quantization step size corresponding to the pixel can be adjusted according to the actual scene.

[0104] In this embodiment of the disclosure, a target quantization step size group is selected from the quantization step size group sequence based on the target compression ratio; and the target quantization step size corresponding to each pixel is determined from the target quantization step size group based on the frequency level corresponding to each pixel. Thus, by selecting the target quantization step size group from the quantization step size group sequence according to the set target compression ratio, and compressing the corresponding first transform coefficients according to the target quantization step size group, the result can meet the compression ratio requirement.

[0105] In some embodiments, step S141 may include the following steps S151 and S152:

[0106] Step S151: Determine the first compression ratio corresponding to the first quantization step group in the quantization step group sequence;

[0107] Here, the first compression rate is the compression rate corresponding to the compression processing of the corresponding first transform coefficient using the first quantization step size group; each quantization step size group corresponds to a first compression rate.

[0108] Step S152: If the first compression ratio is greater than or equal to the target compression ratio, the first quantization step size group is determined as the target quantization step size group.

[0109] In some implementations, the sequence of quantization step groups is traversed, and if there is a first quantization step group whose first compression ratio is greater than or equal to the target compression ratio, the first quantization step group is determined as the target quantization step group.

[0110] In this embodiment of the disclosure, a first compression ratio is determined corresponding to the first quantization step group in the quantization step group sequence; if the first compression ratio is less than the target compression ratio, the first quantization step group is determined as the target quantization step group. This ensures that the compression ratio after compression processing using the target quantization step group meets the set target compression ratio requirement.

[0111] This disclosure provides an image compression method. Figure 2 A schematic diagram of the implementation process of an image compression method provided in this disclosure embodiment. Figure 2 ,like Figure 2 As shown, the method may include the following steps S201 to S206:

[0112] Step S201: Obtain the first image;

[0113] Step S202: Transform the first image from the spatial domain to the frequency domain to obtain the first transformation coefficients corresponding to each pixel in the first image;

[0114] Step S203: Based on the target compression ratio, select a target quantization step size group from the quantization step size group sequence; the quantization step size group sequence includes at least two quantization step size groups;

[0115] Step S204: Based on the frequency level corresponding to each pixel, determine the target quantization step size corresponding to each pixel from the target quantization step size group;

[0116] Step S205: Using the target quantization step size corresponding to each pixel, the corresponding first transform coefficient is compressed to obtain the first image compressed data; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel;

[0117] Step S206: If there is no target quantization step group in the quantization step group sequence, dithering compression encoding is performed on the pixel values ​​of each pixel in the first image to obtain the second image compressed data.

[0118] In some implementations, dithering compression coding is used when the compression ratios corresponding to all quantization step groups in the quantization step group sequence do not meet the target compression ratio requirement.

[0119] Step S206 above may include steps S241 to S244:

[0120] Step S241: Shift the pixel value of the pixel in the first image to the right by a first number of bits to obtain the first compression value corresponding to the pixel; the first number of bits is determined based on the target compression ratio;

[0121] Here, the first bit count is the number of bits required to shift the pixels in the first image to the right to meet the set target compression ratio requirement.

[0122] Step S242: Based on the first number of bits and the first compression value corresponding to the pixel, determine the first reference pixel value and the second reference pixel value corresponding to the pixel;

[0123] In some embodiments, the first reference pixel value is obtained by left-shifting the first compressed value corresponding to the pixel by the first number of bits, the second reference pixel value is obtained by left-shifting the second compressed value corresponding to the pixel by the first number of bits, and the second compressed value corresponding to the pixel is obtained by adding one to the first compressed value corresponding to the pixel.

[0124] In some implementations, the first reference pixel value is the lower boundary value after the first image is restored, and the second reference pixel value is the upper boundary value after the first image is restored.

[0125] Step S243: Based on the pixel value of the pixel and the first reference pixel value and the second reference pixel value corresponding to the pixel, determine the target compression value corresponding to the pixel, wherein the target compression value is the first compression value or the second compression value corresponding to the pixel;

[0126] Here, the target compression value is the final result after compressing the first image.

[0127] In some implementations, the jitter value corresponding to a pixel is found from a jitter code table using the pixel's coordinates in the first image; the difference between the first reference pixel value and the second reference pixel value corresponding to the pixel is used as the jitter error coefficient, and the jitter median is calculated based on the jitter value and the jitter error coefficient; the target compression value is determined by comparing the difference between the pixel value of the pixel and the first reference pixel value corresponding to the pixel with the jitter median.

[0128] Here, the dithering median is used to determine whether the pixel value of each pixel in the first image is closer to the upper boundary value or the lower boundary value. If the difference between the pixel value and the lower boundary value is greater than the dithering median, it means that the pixel value is closer to the upper boundary value. If the difference between the pixel value and the lower boundary value is not greater than the dithering median, it means that the pixel value is closer to the lower boundary value.

[0129] In some implementations, if the difference between the pixel value of a pixel and the first reference pixel value corresponding to the pixel is greater than the jitter median, the second reference pixel value corresponding to the pixel is determined as the target compression value corresponding to the pixel; if the difference between the pixel value of a pixel and the first reference pixel value corresponding to the pixel is not greater than the jitter median, the first reference pixel value corresponding to the pixel is determined as the target compression value corresponding to the pixel.

[0130] Step S244: Determine the compressed data of the second image based on the target compression value corresponding to each pixel in the first image.

[0131] In this embodiment, when the target quantization step size table is not present in the quantization step size group sequence, the compression method corresponding to the second compression identifier is used for compression processing. Thus, when the first image is not suitable for compression processing using the compression method corresponding to the first compression identifier, the compression method corresponding to the second compression identifier is used, combining the advantages of both compression methods.

[0132] In some embodiments, step S243 may include the following steps S211 to S213:

[0133] Step S211: Determine the target reference value corresponding to the pixel based on the first difference between the first reference pixel value and the second reference pixel value corresponding to the pixel;

[0134] Here, the first difference is the jitter error coefficient, which represents the range between the upper and lower boundary values; the target reference value is the jitter median, which serves as the criterion for selecting the target compression value.

[0135] Step S212: If the second difference corresponding to the pixel is greater than the target reference value corresponding to the pixel, the second compression value corresponding to the pixel is determined as the target compression value corresponding to the pixel, and the second difference corresponding to the pixel is the difference between the pixel value of the pixel and the first reference pixel value corresponding to the pixel;

[0136] In some implementations, if the second difference corresponding to a pixel is greater than the target reference value corresponding to the pixel, it indicates that the pixel is closer to the upper boundary value, so the target compression value corresponding to the pixel is selected as the second compression value.

[0137] Step S213: If the second difference corresponding to the pixel is not greater than the target reference value corresponding to the pixel, the first compression value corresponding to the pixel is determined as the target compression value corresponding to the pixel.

[0138] In some implementations, if the second difference corresponding to a pixel is not greater than the target reference value corresponding to the pixel, it indicates that the pixel is closer to the lower boundary value, and therefore the target compression value corresponding to the pixel is selected as the first compression value.

[0139] In some embodiments, step S211 may include the following steps S221 and S222:

[0140] Step S221: Determine the jitter value corresponding to the pixel in the first image;

[0141] In some implementations, when the first image is an image to be compressed, the jitter value corresponding to the pixel in the jitter code table is determined based on the pixel's coordinates in the first image; in other implementations, when the first image is one of multiple image blocks into which the image to be compressed is divided, the jitter value corresponding to the pixel in the jitter code table is determined based on the pixel's coordinates in the first image and the coordinates of the first image in the image to be compressed.

[0142] Step S222: Determine the target reference value corresponding to the pixel based on the jitter value corresponding to the pixel and the first difference.

[0143] In some implementations, to maintain accuracy, the jitter value corresponding to the pixel is shifted left by 1 bit, and the rightmost bit is not 0 by ORing with 1; the result of shifting the jitter value corresponding to the pixel left by 1 bit and ORing with 1 is multiplied by the first difference (i.e., the jitter error coefficient), and the result of the multiplication is shifted right by 5 bits to obtain the jitter median.

[0144] In some implementations, the dithering median is used to compare the difference between the pixel value of a pixel and the first reference pixel value corresponding to the pixel to determine the target compression value.

[0145] In some embodiments, the above method may further include the following steps S231 and S232:

[0146] Step S231: If a target quantization step size group exists in the quantization step size group sequence, write a first compression identifier, the first image compression data, and a group identifier corresponding to the target quantization step size group into the transmission data stream.

[0147] Here, the group identifier corresponding to the target quantization step size group represents the index of the target quantization step size group in the quantization step size group sequence.

[0148] In some implementations, when a target quantization step size group exists in the quantization step size group sequence, exponential Golomb coding is used; the first compression identifier indicates that exponential Golomb coding is used; the first image compressed data is image data after quantization using the target quantization step size group and exponential Golomb coding of the quantized data.

[0149] In some implementations, when a target quantization step size group exists in the quantization step size group sequence, Huffman coding is used; the first compression identifier indicates that Huffman coding is used; the first image compressed data is image data after quantization using the target quantization step size group and Huffman coding of the quantized data.

[0150] In some implementations, a first compression identifier, first image compression data, and a group identifier corresponding to the target quantization step size group are written into a transmission data stream, and the data is transmitted to the device that needs to be decompressed via the transmission data stream.

[0151] In some implementations, the first compression identifier, the first image compression data, and the group identifier corresponding to the target quantization step size group can be packaged into a data packet and sent to the device that needs to be decompressed.

[0152] Step S232: If there is no target quantization step group in the quantization step group sequence, write the second compression identifier, the second image compression data, and the first number of bits into the transmission data stream.

[0153] In some implementations, dithering compression coding is used when the target quantization step group is not present in the quantization step group sequence; the second compression identifier indicates the use of dithering compression coding; the second image compressed data indicates the image data compressed using dithering compression coding; and the first bit count is the number of bits required to shift the pixels of the first image to the right to meet the set compression ratio.

[0154] In some implementations, a second compression identifier, second image compression data, and a first number of bits are written into a transmission data stream, and the data is transmitted to a device that needs to be decompressed via the transmission data stream.

[0155] In some implementations, the second compression identifier, the second image compression data, and the first number of bits can be packaged into a data packet and sent to the device that needs to be decompressed.

[0156] This disclosure provides an image decompression method. Figure 3 A schematic diagram of the implementation process of an image decompression method provided in this embodiment of the present disclosure. Figure 1 ,like Figure 3 As shown, the method may include the following steps S301 to S303:

[0157] Step S301: Obtain first image compression data; the first image compression data includes the compression value corresponding to each pixel in the first restored image to be restored;

[0158] In some implementations, if a first compression identifier is read from the transmission data stream, first image compression data is obtained from the transmission data stream.

[0159] In some implementations, if a first compression identifier is read from the data packet, first image compression data is obtained from the data packet.

[0160] Step S302: Using the target quantization step size corresponding to each pixel, the corresponding compressed value is decompressed to obtain the second transform coefficient corresponding to each pixel; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel;

[0161] Here, the target quantization step size corresponding to each pixel is the target quantization step size when the first image is compressed;

[0162] In some implementations, decompressing each compressed value includes decoding each compressed value to obtain a second quantized value corresponding to each compressed value, and dequantizing each second quantized value to obtain a second transform coefficient.

[0163] Step S303: Transform the second transformation coefficients corresponding to each pixel from the frequency domain to the spatial domain to obtain the first restored image.

[0164] In some implementations, the second transformation coefficients corresponding to each compressed value in the first image compressed data are transformed from the frequency domain to the spatial domain to obtain the restored first image.

[0165] In some implementations, transforming the second transform coefficients corresponding to each compressed value in the first image compressed data from the frequency domain to the spatial domain includes an inverse transform along the horizontal and / or vertical directions. First, the second transform coefficients corresponding to each compressed value in the first image compressed data are inversely transformed along the vertical direction to obtain a second transformed image; then, each pixel in the second transformed image is inversely transformed along the horizontal direction to obtain the restored first restored image.

[0166] In this embodiment, first image compressed data is acquired; the corresponding compressed values ​​are decompressed using the target quantization step size corresponding to each pixel in the first image compressed data to obtain the second transform coefficients corresponding to each pixel in the first image compressed data; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel; the second transform coefficients corresponding to each pixel are transformed from the frequency domain to the spatial domain to obtain the first restored image. In this way, on the one hand, different quantization step sizes can be determined for decompression processing according to the frequency level corresponding to each pixel, thereby improving the flexibility in the image decompression process; on the other hand, since the frequency levels corresponding to each pixel are different, the target quantization step sizes corresponding to each pixel are also different. This reduces the loss of high-frequency components during decompression, improving image fidelity, and also increases the compression rate of low-frequency components in the image, thus balancing the overall compression rate and fidelity requirements of the image.

[0167] In some embodiments, step S302 may include the following steps S311 and S312:

[0168] Step S311: Decode the first image compressed data to obtain the second quantization value corresponding to each pixel;

[0169] In some implementations, the first image compressed data can be parsed according to the exponential Columbus to obtain the second quantization value corresponding to each pixel.

[0170] In some implementations, the first image compressed data can be parsed according to Huffman coding to obtain the second quantization value corresponding to each pixel.

[0171] Step S312: Based on the target quantization step size corresponding to each pixel, the corresponding second quantization value is dequantized to obtain the second transformation coefficient corresponding to each pixel.

[0172] In some embodiments, the above method may further include the following steps S321 to S323:

[0173] Step S321: Obtain the group identifier;

[0174] Here, the group identifier is the index of the target quantization step size group in the quantization step size group sequence.

[0175] In some implementations, the group identifier is obtained from the transmitted data stream.

[0176] Step S322: Based on the group identifier, determine the target quantization step size group from the quantization step size group sequence;

[0177] In some implementations, the index of the target quantization step size group in the quantization step size group sequence is determined based on the group identifier, and the corresponding target quantization step size group is found from the quantization step size group sequence based on the index.

[0178] Step S323: Based on the frequency level corresponding to each pixel, determine the target quantization step size corresponding to each pixel from the target quantization step size group.

[0179] In some implementations, the first restored image has M rows, where M is greater than 3;

[0180] In the first restored image, the frequency level corresponding to the pixel in the j-th row is not lower than the frequency level corresponding to the pixel in the 1-th row, the frequency level corresponding to the pixel in the (M-1)-th row is higher than the frequency level corresponding to the pixel in the j-th row, and the frequency level corresponding to the pixel in the M-th row is higher than the frequency level corresponding to the pixel in the j-th row.

[0181] In some implementations, the first restored image has N columns, where N is greater than 3;

[0182] In the first restored image, the frequency level of the pixel in the i-th column is not lower than the frequency level of the pixel in the 1-th column; the frequency level of the pixel in the (N-1)-th column is higher than the frequency level of the pixel in the i-th column, and the frequency level of the pixel in the N-th column is higher than the frequency level of the pixel in the i-th column.

[0183] In some embodiments, step S303 may include the following step S331:

[0184] Step S331: Perform inverse transformation on the second transformation coefficients corresponding to each pixel along the horizontal and / or vertical directions to obtain the first restored image.

[0185] In some implementations, the second transformation coefficients corresponding to each pixel are inversely transformed along the vertical direction to obtain a second transformed image; the second transformed image is inversely transformed along the horizontal direction to obtain a first restored image.

[0186] In some implementations, the second transformation coefficients corresponding to each pixel and the second transformed image have the same size, and both the first restored image and the second transformed image have M rows, where M is greater than 3;

[0187] The pixel value of the first row of pixels in the second transformed image is equal to the second transformation coefficient of the first row corresponding to the first row of pixels. The pixel value of the (M-1)th row of pixels in the second transformed image is determined based on the second transformation coefficient of the (M-1)th row corresponding to the first row of pixels and the second transformation coefficient of the first row corresponding to the first row of pixels. The pixel value of the Mth row of pixels in the second transformed image is determined based on the second transformation coefficient of the Mth row corresponding to the Mth row of pixels and the second transformation coefficient of the (M-1)th row corresponding to the Mth row of pixels. The pixel value of the jth row of pixels in the second transformed image is determined based on the second transformation coefficient of the jth row corresponding to the jth row of pixels and at least two reference transformation coefficient rows corresponding to the second transformation coefficient of the jth row corresponding to the jth row of pixels, where j is greater than 1 and less than M-1.

[0188] In some implementations, the first restored image and the second transformed image are the same size, and both the first restored image and the second transformed image have N columns, where N is greater than 3;

[0189] The pixel value of the first column of pixels in the first restored image is equal to the pixel value of the first column of pixels in the second transformed image; the pixel value of the (N-1)th column of pixels in the first restored image is determined based on the pixel value of the (N-1)th column of pixels in the second transformed image and the pixel value of the first column of pixels in the second transformed image; the pixel value of the Nth column of pixels in the first restored image is determined based on the pixel value of the Nth column of pixels in the second transformed image and the pixel value of the (N-1)th column of pixels in the second transformed image; the pixel value of the i-th column of pixels in the first restored image is determined based on the pixel value of the i-th column of pixels in the second transformed image and the pixel values ​​of at least two reference pixel columns corresponding to the i-th column of pixels in the second transformed image, where i is greater than 1 and less than N-1.

[0190] In some embodiments, step S301 may include the following step S341:

[0191] Step S341: If the first compression identifier is read from the transmission data stream, read the first image compression data from the transmission data stream.

[0192] In some implementations, the device that needs to decompress receives the transmitted data stream and reads the compression identifier from the transmitted data stream; if the compression identifier is a first compression identifier, the device obtains the first image compressed data from the transmitted data stream.

[0193] In some implementations, the device that needs to decompress receives a data packet and reads a compression identifier from the data packet; if the compression identifier is a first compression identifier, the first image compression data is obtained from the data packet.

[0194] In some implementations, the first compression identifier indicates that the first image compression data is image data obtained through exponential Golomb coding.

[0195] In some implementations, the first compression identifier indicates that the first image compression data is image data obtained through Huffman coding.

[0196] In some embodiments, the above method may further include the following steps S351 and S352:

[0197] Step S351: If the second compression identifier is read from the transmitted data stream, the second image compression data and the first number of bits are obtained;

[0198] In some implementations, the second compression identifier indicates that the second image compression data is image data obtained using dithering compression encoding; the first bit count is the number of bits required to shift the pixels in the first image to the right in the encoded bitstream to meet the set compression ratio during image compression.

[0199] In some implementations, when reading the second compression identifier from the data packet, the second image compression data and the first number of bits are obtained from the data packet.

[0200] Step S352: Shift each compressed value in the second image compressed data to the left by the first number of bits to obtain the second restored image.

[0201] The following describes the application of the image compression and decompression methods provided in this disclosure in real-world scenarios, taking an image compression method combining a frequency domain segmented quantization-based subjective lossless compression method and a dithering compression coding-based compression method as an example.

[0202] Image bandwidth compression technology has always been a relatively effective solution for reducing the communication bandwidth between different IPs of a hardware image processor. Image bandwidth compression can compress redundant information in the spatial domain of two-dimensional or multi-dimensional images, reducing the amount of image data during transmission and lowering the bandwidth of hardware devices. While image bandwidth compression can solve the bandwidth problem, it cannot reduce image bandwidth in all scenarios, and hardware design requires allocating maximum space for data storage. Therefore, lossless bandwidth compression technology cannot reduce the memory cost of the device.

[0203] In the field of image processing, lossy compression schemes that achieve subjective visual losslessness can be used to address the issues of maximum bandwidth and memory compression. Subjective visual losslessness refers to the ability of the human eye to distinguish the difference between the compressed and decompressed images using lossy compression techniques. This technology is commonly used in device display links.

[0204] Commonly used subjective visual lossless techniques include lossy compression with controllable line-level bitrate and lossy compression techniques with intra-block prediction residual quantization.

[0205] Line-level rate-controlled lossy compression works by subtracting the predicted value of the current pixel from the combination of the pixels to its left and top, quantizing and entropy-coding the residual (such as Huffman coding or arithmetic coding), and obtaining the encoded bits for the current pixel. Each line has a fixed number of pixels as a coding unit, and one quantization parameter is used within each coding unit. The rate control part compares the difference between the bits used in the encoded block and the pre-allocated bits, allocating the excess bits to the pre-allocated bits of subsequent coding units, thus reducing the quantization parameters of subsequent coding units. The quantization parameters are refreshed to a set value at the beginning of each line, ensuring a fixed compression rate for each line. This compression method has two drawbacks: 1) it requires buffering the data of one row of pixels for one frame of image; 2) the smallest unit of rate control is the line, making it only effective for raster scan output.

[0206] The intra-block prediction residual quantization method is similar to the intra-frame prediction module in H.264 / H.265. It predicts a reference value for each pixel in the current image block by calculating the encoded pixels in the row above and column to the left of the current image block. The interpolation between the reference value and the current pixel is calculated, a DCT transform is performed on the interpolation, and quantization is performed using a quantization coefficient. This quantization coefficient controls the compression ratio of the coded block. This compression method has the following drawbacks: it requires buffering the image data from the previous row; it uses a single quantization coefficient per image block; and it quantizes high-frequency signals corresponding to detailed textures and low-frequency signals corresponding to flat areas at the same scale, failing to simultaneously consider both high and low frequency signals. Quantization may severely damage high-frequency components, leading to problems in reconstructing image details and textures, and potentially resulting in low compression ratios.

[0207] Therefore, this disclosure provides a subjective lossless image compression method based on frequency domain segmented quantization. The method splits image blocks into high-frequency and low-frequency components and designs a quantization step size table sequence corresponding to the high and low-frequency components. The low-frequency components are assigned a larger quantization step size, while the high-frequency components are assigned a smaller quantization step size. A quantization step size table that meets the set compression ratio requirement is selected from the quantization step size table sequence, and each image block is compressed to obtain compressed image data.

[0208] Figure 4 A schematic diagram of a compression method combining a frequency-domain segmented quantization-based subjective lossless image compression method and a dithering-based compression coding method is shown, as follows: Figure 4 As shown, the specific steps may include steps S401 to S411:

[0209] Step S401: Transform the image patch from the spatial domain to the frequency domain;

[0210] Transforming an image patch from the spatial domain to the frequency domain includes both horizontal and vertical transformations.

[0211] First, perform a horizontal frequency domain transformation on the 4x4 image block. Figure 5 The example illustrates a horizontal frequency domain transformation of a 4x4 image patch, such as... Figure 5 As shown, the index of each column starts from 0. The first pixel of each row of the image block is taken as the base pixel and is not processed. That is, after horizontal transformation, the first pixel of each row is equal to the first pixel of each row of the image block. The difference between the third pixel of each row of the image block and the first pixel of each row of the image block is taken as the third pixel of each row after horizontal transformation. The difference between the fourth pixel of each row of the image block and the third pixel of each row of the image block is taken as the fourth pixel of each row after horizontal transformation. The difference between the second pixel of each row of the image block and the average value (i.e., pre) of the first and third pixels of each row of the image block is taken as the second pixel of each row after horizontal transformation.

[0212] The data after horizontal transformation is transformed vertically to separate the high and low frequency components of the image patch. Figure 6 This illustrates the vertical frequency domain transformation of pixels after horizontal transformation, such as... Figure 6 As shown, the index of each row starts from 0. The first pixel of each column after horizontal transformation is taken as the base pixel and is not processed. That is, the first transformation coefficient of each column after vertical transformation is equal to the first pixel of each column after horizontal transformation. The difference between the third pixel of each column after horizontal transformation and the first pixel of each column after horizontal transformation is taken as the third transformation coefficient of each column after vertical transformation. The difference between the fourth pixel of each column after horizontal transformation and the third pixel of each column after horizontal transformation is taken as the fourth transformation coefficient of each column after vertical transformation. The difference between the second pixel of each column after horizontal transformation and the average value (i.e., pre) of the first and third pixels of each column after horizontal transformation is taken as the second transformation coefficient of each column after vertical transformation.

[0213] Step S402: Select a set of quantization step size tables from the quantization step size table sequence to quantize the image patch;

[0214] The quantization step size table sequence was obtained through experiments and calculations: QpList[8][7]={{0,0,0,0,0,0,0}{1,0,0,1,0,0,1}{2,1,0,2,1,1,2}{3,0,2,2,0,1,0}{4,2,3,1,1,2,1}{5,4,5,4,2,4,2}{6,5,6,5,4,4,5}{7,6,6,6,7,7,7}}.

[0215] In a set of quantization step size tables, the image block position corresponding to each quantization step size is as follows: Figure 7As shown, the frequency levels corresponding to parts b, c, and d are higher than those corresponding to part a, and the quantization step size selected for parts b, c, and d is smaller than that selected for part a; similarly, the frequency levels corresponding to parts e, f, and g are higher than those corresponding to parts b, c, and d, and the quantization step size selected for parts e, f, and g is smaller than that selected for parts b, c, and d. In actual image compression, the corresponding quantization step size is adjusted according to the image type. For example, when the image is of text type, the frequency levels corresponding to parts e, f, and g are higher than those corresponding to parts b, c, and d; when the image is of natural texture type, the frequency levels corresponding to parts b, c, and d are higher than those corresponding to parts e, f, and g.

[0216] Quantization is performed based on the quantization step size corresponding to each pixel in the image block determined by the above process.

[0217] Step S403: Perform exponential Golomb encoding on the quantized value;

[0218] Step S404: Is the encoded bitstream less than the encoded bitstream required for the set compression ratio? If the encoded bitstream is less than the encoded bitstream required for the set compression ratio, proceed to step S406; otherwise, proceed to step S405.

[0219] Quantization is performed using a set of quantization step size tables from the quantization step size table sequence, and the quantized values ​​are then subjected to exponential Golomb coding. The encoded bitstream corresponding to this set of quantization step size tables is calculated. If the encoded bitstream is less than the encoded bitstream required for the set compression ratio, proceed to step S406; otherwise, proceed to step S405.

[0220] Step S405: Has the quantization step size table sequence been traversed completely? If the quantization step size table sequence has been traversed completely, proceed to step S409; otherwise, proceed to step S402.

[0221] Step S406: Write 1 bit 0 into the bit stream as a compression flag, indicating that quantization table compression mode is used;

[0222] Step S407: Write the index of the selected quantization step size table into the bit stream;

[0223] Write the index corresponding to the quantization step size table in the quantization step size table sequence into the bit stream.

[0224] Step S408: Write the encoded result of the quantized exponential Columbus into the bitstream;

[0225] Quantization is performed using this set of quantization step size tables, and exponential Columbus coding is performed based on the quantized image data; the encoded result is then written into the bitstream.

[0226] Step S409: Write 1 bit 1 into the bitstream as a compression flag, indicating that jitter compression mode is used;

[0227] Step S410: Jitter compression encoding;

[0228] The steps of performing dithering compression encoding on image blocks may include steps S451 to S455:

[0229] Step S451: Design the jitter code table and determine the jitter value corresponding to each pixel in the image block in the jitter code table;

[0230] Based on extensive experiments and calculations, a 4x4 dithering code table was designed: {{10, 2, 8, 0}, {6, 14, 4, 12}, {9, 1, 11, 3}, {5, 13, 7, 15}}. The coordinates (posx, posy) of the current image patch in the image are calculated, and the coordinates (x, y) of the current pixel in the image patch are calculated. The dithering coefficient corresponding to the current pixel is the dither value (dither_val) at the position ((posx+x)%4, (posy+y)%4) in the dithering code table.

[0231] Step S452: Calculate the number of bits n that each original pixel needs to be shifted to the right to achieve the required compression ratio, and shift the image block to the right by the number of bits n to obtain the compressed image block (low_prec);

[0232] Step S453: Shift low_prec left by n bits to obtain the lower boundary value (mapped_back) of the restored image block, shift low_prec+1 left by n bits to obtain the upper boundary value (higher_bound) of the restored image block, and calculate the jitter error coefficient: range = higher_bound - mapped_back;

[0233] Step S454: Calculate the median of the jitter (mid_dither_val) based on the jitter value of each pixel in the image block and the jitter error coefficient, referring to formula (1);

[0234] mid_dither_val=(((dither_val<<1)|1)*range)>>5 (1);

[0235] In formula (1), in order to maintain accuracy, the dither value corresponding to the pixel is shifted to the left by 1 bit, and the rightmost bit is not 0 by ORing 1.

[0236] Step S455: Calculate whether the difference between the current pixel and mapped_back is greater than the jitter median. If the difference between the current pixel and mapped_back is greater than the jitter median, select low_prec+1 for the compressed value of the current pixel; otherwise, select low_prec for the compressed value of the current pixel.

[0237] Step S411: Write the compressed pixels into the bitstream output one pixel at a time.

[0238] The process of decompressing the above compressed result is shown below.

[0239] Figure 8 The diagram illustrates the process of decompressing compressed data, such as... Figure 8 As shown, the specific steps may include steps S801 to S807:

[0240] Step S801: Read the 1-bit compression flag;

[0241] Read the 1 bit representing the compression flag from the bitstream.

[0242] Step S802: Is the compression flag 1?

[0243] Determine whether the read compression flag is 1. If the compression flag is 1, it indicates that the dithering compression encoding method is used, and proceed to step S807 for decompression; if the compression flag is 0, it indicates that the quantization table compression mode is used, and proceed to step S803 for decompression.

[0244] Step S803: Determine the target quantization step size table from the quantization step size table sequence;

[0245] Read the sequence number corresponding to the quantization step size table from the bit stream, and find the corresponding target quantization step size table in the quantization step size table sequence.

[0246] Step S804: Analyze all bitstreams of the current image block according to the Exponential Columbus method;

[0247] Step S805: Shift the result after the exponential Columbus parsing to the left by the corresponding number of bits according to the target quantization step size table to obtain the transform block data;

[0248] Step S806: Perform high-low frequency inverse transform on the transform block data to obtain the output image data;

[0249] Step S807: Decompression corresponding to the jitter compression encoding method.

[0250] Read the compressed image data from the bitstream and calculate the number of bits *n* that each image pixel needs to be shifted to the right to meet the set compression ratio. Shift the compressed image data to the left by the number of bits *n* to obtain the decompressed image data.

[0251] In this embodiment, the image block is split into high-frequency and low-frequency components. A larger quantization step size is used for the low-frequency components, while a smaller quantization step size is used for the high-frequency components. Under the premise of meeting the set compression ratio, a target quantization step size table is selected from the quantization step size table sequence, and the image block is compressed according to the target quantization step size table. This effectively protects the high-frequency components from over-compression while ensuring the compression ratio of the low-frequency components. In this embodiment, when the target quantization step size table is not present in the quantization step size table sequence, dithering compression coding is used. This allows dithering compression coding to be used even when the quantization table compression mode is not applicable to the image block, thus combining the advantages of both quantization table compression and dithering compression coding.

[0252] Based on the foregoing embodiments, this disclosure provides an image compression and image compression apparatus. The apparatus includes various units and modules included in each unit, which can be implemented by a processor in a computer device; of course, it can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor unit (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0253] Figure 9A This is a schematic diagram of the composition structure of an image compression device provided in an embodiment of the present disclosure, as shown below. Figure 9A As shown, the image compression device 900 includes: a first acquisition module 901, a first transformation module 902, and a compression module 903, wherein:

[0254] The first acquisition module 901 is used to acquire the first image;

[0255] The first transformation module 902 is used to transform the first image from the spatial domain to the frequency domain to obtain the first transformation coefficients corresponding to each pixel in the first image.

[0256] The compression module 903 is used to compress the corresponding first transform coefficients using the target quantization step size corresponding to each pixel to obtain first image compressed data; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel.

[0257] In some embodiments, the first transformation module includes a frequency separation unit, configured to perform frequency separation processing on the first image along the horizontal and / or vertical directions to obtain first transformation coefficients corresponding to each pixel in the first image.

[0258] In some embodiments, the frequency separation unit includes: a first frequency separation subunit, configured to perform frequency separation processing on the first image along the horizontal direction to obtain a first transformed image; and a second frequency separation subunit, configured to perform frequency separation processing on the first transformed image along the vertical direction to obtain first transformation coefficients corresponding to each pixel in the first image.

[0259] In some embodiments, the compression module includes: a quantization unit, configured to quantize the corresponding first transform coefficients based on the target quantization step size corresponding to each pixel, to obtain a first quantization value corresponding to each first transform coefficient; and an encoding unit, configured to encode each first quantization value to obtain first image compressed data.

[0260] In some embodiments, the apparatus further includes: a selection module, configured to select a target quantization step size group from a quantization step size group sequence based on a target compression ratio; the quantization step size group sequence includes at least two quantization step size groups; and a first determination module, configured to determine a target quantization step size corresponding to each pixel from the target quantization step size group based on the frequency level corresponding to each pixel.

[0261] In some embodiments, the selection module includes: a first determining unit, configured to determine a first compression ratio corresponding to a first quantization step group in the quantization step group sequence; the first compression ratio is the compression ratio after compressing each of the first transform coefficients using the first quantization step group; and a second determining unit, configured to determine the first quantization step group as a target quantization step group if the first compression ratio is greater than or equal to the target compression ratio.

[0262] In some embodiments, the apparatus further includes an encoding module, configured to perform dithering compression encoding on the pixel values ​​of each pixel in the first image to obtain second image compressed data when the target quantization step group is not present in the quantization step group sequence.

[0263] In some embodiments, the encoding module includes: a right-shift unit, configured to, when there is no target quantization step group in the quantization step group sequence, right-shift the pixel value of a pixel in the first image by a first bit number to obtain a first compressed value corresponding to the pixel; the first bit number is determined based on the target encoded bitstream; a third determining unit, configured to, based on the first bit number and the first compressed value corresponding to the pixel, determine a first reference pixel value and a second reference pixel value corresponding to the pixel; the first reference pixel value is obtained by left-shifting the first compressed value corresponding to the pixel by the first bit number, the second reference pixel value is obtained by left-shifting the second compressed value corresponding to the pixel by the first bit number, and the second compressed value corresponding to the pixel is obtained by adding one to the first compressed value corresponding to the pixel; a fourth determining unit, configured to, based on the pixel value of the pixel and the first and second reference pixel values ​​corresponding to the pixel, determine a target compressed value corresponding to the pixel, the target compressed value being either the first compressed value or the second compressed value corresponding to the pixel; and a fifth determining unit, configured to, based on the target compressed values ​​corresponding to each pixel in the first image, determine second image compressed data.

[0264] In some embodiments, the fifth determining unit includes: a first determining subunit, configured to determine a target reference value corresponding to the pixel based on a first difference between a first reference pixel value and a second reference pixel value corresponding to the pixel; a second determining subunit, configured to determine a second compressed value corresponding to the pixel as the target compressed value corresponding to the pixel when the second difference corresponding to the pixel is greater than the target reference value corresponding to the pixel, wherein the second difference corresponding to the pixel is the difference between the pixel value of the pixel and the first reference pixel value corresponding to the pixel; and a third determining subunit, configured to determine the first compressed value corresponding to the pixel as the target compressed value corresponding to the pixel when the second difference corresponding to the pixel is not greater than the target reference value corresponding to the pixel.

[0265] In some embodiments, the first determining subunit is configured to: determine the jitter value corresponding to a pixel in the first image; and determine a target reference value corresponding to the pixel based on the jitter value corresponding to the pixel and the first difference.

[0266] In some embodiments, the encoding module further includes: a first writing unit, configured to write a first compression identifier, the first image compression data, and a group identifier corresponding to the target quantization step group into the transmission data stream when a target quantization step group exists in the quantization step group sequence; and a second writing unit, configured to write a second compression identifier, the second image compression data, and the first number of bits into the transmission data stream when a target quantization step group does not exist in the quantization step group sequence.

[0267] Figure 9B This is a schematic diagram of the composition structure of an image decompression apparatus provided in an embodiment of the present disclosure, as shown below. Figure 9B As shown, the image decompression device 910 includes: a second acquisition module 911, a decompression module 912, and a second transformation module 913, wherein:

[0268] The second acquisition module 911 is used to acquire first image compressed data; the first image compressed data includes the compressed value corresponding to each pixel in the first restored image to be restored.

[0269] The decompression module 912 is used to decompress the corresponding compressed value using the target quantization step size corresponding to each pixel to obtain the second transform coefficient corresponding to each pixel; the target quantization step size corresponding to each pixel is determined according to the frequency level corresponding to the pixel;

[0270] The second transformation module 913 is used to transform the second transformation coefficients corresponding to each pixel from the frequency domain to the spatial domain to obtain the first restored image.

[0271] In some embodiments, the decompression module includes: a decoding unit, configured to decode the first image compressed data to obtain a second quantization value corresponding to each pixel; and an inverse quantization unit, configured to inverse quantize the corresponding second quantization value based on a target quantization step size corresponding to each pixel to obtain a second transform coefficient corresponding to each pixel.

[0272] In some embodiments, the apparatus further includes: a third acquisition module for acquiring a group identifier; a fifth determination module for determining a target quantization step size group from the quantization step size group sequence based on the group identifier; and a sixth determination module for determining a target quantization step size corresponding to each pixel from the target quantization step size group based on the frequency level corresponding to each pixel.

[0273] In some embodiments, the second transformation module includes an inverse transformation unit, configured to inversely transform the second transformation coefficients corresponding to each pixel along the horizontal and / or vertical directions to obtain a first restored image.

[0274] In some embodiments, the second acquisition module includes a reading unit, configured to read the first image compressed data from the transmission data stream if a first compression identifier is read from the transmission data stream.

[0275] In some embodiments, the second acquisition module further includes: an acquisition unit, configured to acquire second image compressed data and a first number of bits when a second compression identifier is read from the transmission data stream; and a left shift unit, configured to shift each compression value in the second image compressed data to the left by a first number of bits to obtain a second restored image.

[0276] The descriptions of the apparatus embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. In some embodiments, the functions or modules included in the apparatus provided in this disclosure can be used to perform the methods described in the method embodiments above. For technical details not disclosed in the apparatus embodiments of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.

[0277] It should be noted that, in the embodiments of this disclosure, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this disclosure, or the parts that contribute to related technologies, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this disclosure are not limited to any specific hardware, software, or firmware, or any combination of hardware, software, and firmware.

[0278] This disclosure provides a computer device including a memory and a processor. The memory stores a computer program that can run on the processor. When the processor executes the program, it implements some or all of the steps in the above-described method.

[0279] This disclosure provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements some or all of the steps in the above-described method. The computer-readable storage medium may be transient or non-transient.

[0280] This disclosure provides a computer program including computer-readable code, wherein when the computer-readable code is executed in a computer device, a processor in the computer device performs some or all of the steps in the above-described method.

[0281] This disclosure provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program. When the computer program is read and executed by a computer, it implements some or all of the steps in the above-described method. This computer program product can be implemented specifically through hardware, software, or a combination thereof. In some embodiments, the computer program product is specifically embodied as a computer storage medium; in other embodiments, the computer program product is specifically embodied as a software product, such as a software development kit (SDK), etc.

[0282] It should be noted that the descriptions of the various embodiments above tend to emphasize the differences between them, while their similarities or commonalities can be referenced interchangeably. The descriptions of the above embodiments of the device, storage medium, computer program, and computer program product are similar to the descriptions of the above method embodiments and have similar beneficial effects. For technical details not disclosed in the embodiments of the device, storage medium, computer program, and computer program product of this disclosure, please refer to the descriptions of the method embodiments of this disclosure for understanding.

[0283] It should be noted that, Figure 10 This is a schematic diagram of a hardware entity of a computer device in an embodiment of this disclosure, such as... Figure 10 As shown, the hardware entity of the computer device 1000 includes: a processor 1001, a communication interface 1002, and a memory 1003, wherein:

[0284] Processor 1001 typically controls the overall operation of computer device 1000.

[0285] The communication interface 1002 enables computer devices to communicate with other terminals or servers via a network.

[0286] The memory 1003 is configured to store instructions and applications executable by the processor 1001, and can also cache data to be processed or already processed (e.g., image data, audio data, voice communication data, and video communication data) in the processor 1001 and various modules in the computer device 1000. It can be implemented using flash memory or random access memory (RAM). Data transfer between the processor 1001, the communication interface 1002, and the memory 1003 can be performed via bus 1004.

[0287] It should be understood that the phrase "an embodiment" or "one embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this disclosure. Therefore, "in one embodiment" or "one embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this disclosure, the sequence numbers of the above steps / processes do not imply a sequential order of execution; the execution order of each step / process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure. The sequence numbers of the above embodiments of this disclosure are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0288] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0289] In the several embodiments provided in this disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components may be combined, or integrated into another system, or some features may be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0290] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; they may be located in one place or distributed across multiple network units; some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs. Furthermore, the functional units in the embodiments of this disclosure may all be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in hardware or in a combination of hardware and software functional units.

[0291] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0292] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, or the part that contributes to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROM, magnetic disks, or optical disks.

[0293] The above description is merely an embodiment of this disclosure, but the scope of protection of this disclosure is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this disclosure should be included within the scope of protection of this disclosure.

Claims

1. An image compression method characterized by, The method comprises: acquiring a first image; transforming the first image from a spatial domain to a frequency domain to obtain first transform coefficients corresponding to respective pixels in the first image; performing compression processing on the first transform coefficients corresponding to the respective pixels using target quantization steps corresponding to the respective pixels to obtain first image compression data; the target quantization step corresponding to each pixel being determined from a target quantization step group according to a frequency level corresponding to the pixel; in the case where the target quantization step group is not present in a quantization step group sequence, performing dithering compression encoding on pixel values of the respective pixels in the first image to obtain second image compression data; the target quantization step group being selected from the quantization step group sequence based on a target compression rate; the second image compression data being determined based on target compression values corresponding to the respective pixels in the first image.

2. The method of claim 1, wherein, The transformation of the first image from the spatial domain to the frequency domain to obtain the first transform coefficients corresponding to the respective pixels in the first image comprises: performing frequency separation processing on the first image along a horizontal direction and / or a vertical direction to obtain the first transform coefficients corresponding to the respective pixels in the first image.

3. The method of claim 2, wherein, The transformation of the first image from the spatial domain to the frequency domain to obtain the first transform coefficients corresponding to the respective pixels in the first image comprises: performing frequency separation processing on the first image along a horizontal direction to obtain a first transform image; performing frequency separation processing on the first transform image along a vertical direction to obtain the first transform coefficients corresponding to the respective pixels in the first image.

4. The method of claim 3, wherein, The first image and the first transform image have the same size, and both the first image and the first transform image have N columns, N being greater than 3; a pixel value of a first column of pixels in the first transform image is equal to a pixel value of a first column of pixels in the first image, a pixel value of an N-1th column of pixels in the first transform image is determined based on a pixel value of an N-1th column of pixels in the first image and the pixel value of the first column of pixels in the first image, a pixel value of an Nth column of pixels in the first transform image is determined based on a pixel value of an Nth column of pixels in the first image and the pixel value of the N-1th column of pixels in the first image, and a pixel value of an ith column of pixels in the first transform image is determined based on a pixel value of an ith column of pixels in the first image and pixel values of at least two reference pixel columns corresponding to the ith column of pixels in the first image, i being greater than 1 and less than N-1.

5. The method of claim 4, wherein, a frequency level corresponding to the ith column of pixels is not lower than a frequency level corresponding to the first column of pixels; a frequency level corresponding to the N-1th column of pixels is higher than a frequency level corresponding to the ith column of pixels, and a frequency level corresponding to the Nth column of pixels is higher than a frequency level corresponding to the ith column of pixels.

6. The method of claim 3, wherein, The first image and the first transform image have the same size, and both the first image and the first transform image have M rows, M being greater than 3; The first row of first transform coefficients corresponding to the first row of pixels in the first image is equal to the pixel values of the first row of pixels in the first transform image, the M-1th row of first transform coefficients corresponding to the M-1th row of pixels in the first image is determined based on the pixel values of the M-1th row of pixels in the first transform image and the pixel values of the first row of pixels in the first transform image, the Mth row of first transform coefficients corresponding to the Mth row of pixels in the first image is determined based on the pixel values of the Mth row of pixels in the first transform image and the pixel values of the M-1th row of pixels in the first transform image, and the jth row of first transform coefficients corresponding to the jth row of pixels in the first image is determined based on the pixel values of the jth row of pixels in the first transform image and the pixel values of at least two reference pixel rows corresponding to the jth row of pixels in the first transform image, where j is greater than 1 and less than M-1.

7. The method of claim 6, wherein, The frequency level corresponding to the jth row of pixels is not lower than the frequency level corresponding to the first row of pixels, the frequency level corresponding to the M-1th row of pixels is higher than the frequency level corresponding to the jth row of pixels, and the frequency level corresponding to the Mth row of pixels is higher than the frequency level corresponding to the jth row of pixels.

8. The method of claim 1, wherein, The first image compression data is obtained by compressing the first transform coefficients corresponding to the pixels respectively using the target quantization step length corresponding to each of the pixels. The first image compression data is obtained by compressing the first transform coefficients corresponding to the pixels respectively using the target quantization step length corresponding to each of the pixels. The first image compression data is obtained by compressing the first transform coefficients corresponding to the pixels respectively using the target quantization step length corresponding to each of the pixels.

9. The method according to any one of claims 1 to 8, characterized in that, The method further comprises: selecting a target quantization step length group from a sequence of quantization step length groups based on a target compression rate, wherein the sequence of quantization step length groups comprises at least two quantization step length groups; determining the target quantization step length corresponding to each of the pixels from the target quantization step length group based on the frequency level corresponding to each of the pixels.

10. The method of claim 9, wherein, The method further comprises: determining a first compression rate corresponding to a first quantization step length group in the sequence of quantization step length groups, wherein the first compression rate is a compression rate after the first quantization step length group is used to compress the first transform coefficients; in a case where the first compression rate is greater than or equal to the target compression rate, determining the first quantization step length group as the target quantization step length group.

11. The method as claimed in claim 1, wherein, The second image compression data is obtained by dithering and compressing and encoding the pixel values of the pixels in the first image, comprising: right shifting the pixel value of the pixel in the first image by a first number of bits to obtain a first compression value corresponding to the pixel, wherein the first number of bits is determined based on the target compression rate; determining a first reference pixel value and a second reference pixel value corresponding to the pixel based on the first number of bits and the first compression value corresponding to the pixel; determining a target compression value corresponding to the pixel based on the pixel value of the pixel and the first reference pixel value and the second reference pixel value corresponding to the pixel, wherein the target compression value is the first compression value or a second compression value corresponding to the pixel. Determine second image compression data based on target compression values corresponding to pixels in the first image.

12. The method of claim 11, wherein, The first reference pixel value is obtained by left shifting the first compression value corresponding to the pixel by the first number of bits, and the second reference pixel value is obtained by left shifting the second compression value corresponding to the pixel by the first number of bits, and the second compression value corresponding to the pixel is obtained by adding one to the first compression value corresponding to the pixel.

13. The method of claim 11, wherein, The method further comprises: Determine a target reference value corresponding to the pixel based on a first difference between the first reference pixel value and the second reference pixel value corresponding to the pixel; In a case where the second difference corresponding to the pixel is greater than the target reference value corresponding to the pixel, determine the second compression value corresponding to the pixel as the target compression value corresponding to the pixel, the second difference corresponding to the pixel being a difference between the pixel value of the pixel and the first reference pixel value corresponding to the pixel; In a case where the second difference corresponding to the pixel is not greater than the target reference value corresponding to the pixel, determine the first compression value corresponding to the pixel as the target compression value corresponding to the pixel.

14. The method of claim 13, wherein, The method further comprises: Determine a target reference value corresponding to the pixel based on a first difference between the first reference pixel value and the second reference pixel value corresponding to the pixel; Determine a dithering value corresponding to the pixel in the first image; 15. The method of claim 11, wherein, Determine the target reference value corresponding to the pixel based on the dithering value corresponding to the pixel and the first difference. The method further comprises: In a case where a target quantization step group exists in the sequence of quantization step groups, write a first compression identifier, the first image compression data, and a group identifier corresponding to the target quantization step group in a transmission data stream; 16. An image decompression method characterized by, In a case where a target quantization step group does not exist in the sequence of quantization step groups, write a second compression identifier, the second image compression data, and the first number of bits in the transmission data stream. The method comprises: Obtain first image compression data; the first image compression data comprising compression values corresponding to pixels in a first restored image to be restored; Decompress the compression values corresponding to the pixels using target quantization steps corresponding to the pixels to obtain second transform coefficients corresponding to the pixels; the target quantization step corresponding to each pixel being determined from a target quantization step group according to a frequency level corresponding to the pixel; the target quantization step group being selected from a sequence of quantization step groups based on a target compression rate; Transform the second transform coefficients corresponding to the pixels from a frequency domain to a spatial domain to obtain the first restored image; Obtain second image compression data; the second image compression data being obtained by dithering compression encoding pixel values of pixels in a second restored image to be restored in a case where the target quantization step group does not exist in the sequence of quantization step groups; the second image compression data comprising target compression values corresponding to the pixels in the second restored image; Decompressing target compressed values corresponding to each pixel in the second image compressed data to obtain the second recovered image.

17. The method of claim 16, wherein, The decompressing the compressed values corresponding to each pixel by using the target quantization step corresponding to the pixel to obtain the second transform coefficient corresponding to each pixel comprises: Decoding the first image compressed data to obtain second quantization values corresponding to each pixel; Dequantizing the second quantization values corresponding to each pixel based on the target quantization step corresponding to the pixel to obtain the second transform coefficient corresponding to each pixel.

18. The method of claim 16, wherein, The method further comprises: obtaining a group identifier; determining a target quantization step group from a quantization step group sequence based on the group identifier; determining the target quantization step corresponding to each pixel from the target quantization step group based on the frequency level corresponding to the pixel.

19. The method of claim 16, wherein, The transforming the second transform coefficient corresponding to each pixel from the frequency domain to the spatial domain to obtain the first recovered image comprises: inverse transforming the second transform coefficient corresponding to each pixel along a horizontal direction and / or a vertical direction to obtain the first recovered image.

20. The method of claim 16, wherein, The obtaining the first image compressed data comprises: in a case where a first compression identifier is read from a transmission data stream, reading the first image compressed data from the transmission data stream.

21. The method of claim 20, wherein, The method further comprises: in a case where a second compression identifier is read from the transmission data stream, obtaining second image compressed data and a first bit number; left shifting each compressed value in the second image compressed data by the first bit number to obtain a second recovered image.

22. An image compression apparatus characterized by comprising: comprise: a first obtaining module configured to obtain a first image; a first transforming module configured to transform the first image from a spatial domain to a frequency domain to obtain first transform coefficients corresponding to each pixel in the first image respectively; a compressing module configured to compress the first transform coefficients corresponding to each pixel by using a target quantization step corresponding to the pixel to obtain first image compressed data; the target quantization step corresponding to each pixel is determined from a target quantization step group according to a frequency level corresponding to the pixel; in a case where the target quantization step group does not exist in a quantization step group sequence, the compressing module is further configured to perform dithering compression encoding on pixel values of each pixel in the first image to obtain second image compressed data; the target quantization step group is selected from the quantization step group sequence based on a target compression rate; and the second image compressed data is determined based on target compressed values corresponding to each pixel in the first image.

23. An image decompression apparatus characterized by comprising: comprise: a second obtaining module configured to obtain first image compressed data; the first image compressed data comprises compressed values corresponding to each pixel in a first recovered image to be recovered; a decompressing module configured to decompress the compressed values corresponding to each pixel by using a target quantization step corresponding to the pixel to obtain second transform coefficients corresponding to each pixel; the target quantization step corresponding to each pixel is determined from a target quantization step group according to a frequency level corresponding to the pixel; and the target quantization step group is selected from a quantization step group sequence based on a target compression rate. A second conversion module is configured to convert the second conversion coefficients corresponding to the pixels from the frequency domain to the spatial domain to obtain the first restored image The decompression module is further configured to acquire second image compression data, the second image compression data being obtained by dithering compression encoding of pixel values of pixels in a second restored image to be restored in a case where the target quantization step group does not exist in the quantization step group sequence, and the second image compression data including target compression values corresponding to the pixels in the second restored image. The target compression values corresponding to the pixels in the second image compression data are decompressed to obtain the second restored image. 24.A computer device, comprising a memory and a processor, wherein the memory stores a computer program capable of running on the processor, and the computer device is characterized in that, The processor implements the steps in the method of any one of claims 1 to 21 when executing the program.

25. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps in the method of any one of claims 1 to 21.

26. A computer program product comprising computer programs or instructions, characterized in that, The computer program or instructions are executed by the processor to implement the steps in the method of any one of claims 1 to 21.

Citation Information

Patent Citations

  • Method for compression quantization and anti-quantization of video-frequency data

    CN1816145A

  • Device and method for image processing

    JP2001145105A

  • Image processing apparatus, image processing method, and recording medium recorded with image processing method

    JP2004112712A