Image compression device and method, equipment and storage medium
By dividing the image into multiple pixel units and processing it using multiple compression modes, the problem that the prior art is difficult to meet the high-magnification compression requirements is solved, and higher image compression accuracy and compression magnification are achieved.
Patent Information
- Application Number
- CN202510387774.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-06-27
AI Technical Summary
The existing overdrive compression technology is difficult to meet the compression needs of high magnifications, and it is complex and has a large hardware occupancy, resulting in an increase in hardware costs.
By dividing the image to be compressed into multiple image blocks and dividing each image block into multiple pixel units, each pixel unit is compressed using quantization parameters and multiple compression modes, the target compression mode is determined to improve image compression accuracy.
A smaller image compression granularity is achieved, the image compression accuracy of each pixel unit is improved, the dependence on storage hardware is reduced, and the compression magnification is improved.
Smart Images

Figure CN120219518A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technologies, and in particular, to an image compression device, method, equipment, and storage medium. Background Art
[0002] With the development of display technologies, liquid crystal displays (LCDs) have been widely used in the screen displays of various electronic products. Due to the slow response speed of liquid crystals, contour blurring or ghosting phenomena may occur when displaying dynamic images. The above problems existing in LCDs can be solved by using over drive (OD) technology. In order to reduce the data volume and transmission bandwidth generated during the over drive process, the over drive compression (ODC) technology can be used to compress each frame of the dynamic image, but the compression ratio and compression accuracy will affect the over drive performance.
[0003] In the process of implementing the present disclosure, it is found that the existing ODC technologies are difficult to meet the high magnification compression requirements, and some of the existing technologies have high complexity and large hardware area occupation, which leads to an increase in hardware costs. Summary of the Invention
[0004] In view of the above problems, the present disclosure provides an image compression device, method, equipment, and storage medium.
[0005] According to the first aspect of the present disclosure, there is provided an image compression device, including: a partitioning module for partitioning a to-be-compressed image to obtain a plurality of image blocks, and partitioning each image block into a plurality of pixel units, each pixel unit including at least one pixel; an image reconstruction module for determining compression results of the pixel unit in a plurality of compression modes and a plurality of reconstruction results corresponding to the plurality of compression results respectively according to quantization parameters and each pixel unit; a mode determination module for determining a target compression mode for the pixel unit from the plurality of compression modes according to a processing error between the plurality of reconstruction results and the to-be-compressed image; and an image compression module for performing compression processing on each pixel unit of the to-be-compressed image according to the target compression mode corresponding to the pixel unit.
[0006] The second aspect of the present disclosure provides a display chip including the above image compression device.
[0007] A third aspect of the present disclosure provides an image compression method, including: dividing a to-be-compressed image to obtain a plurality of image blocks, dividing each image block into a plurality of pixel units, and each pixel unit includes at least one pixel; determining compression results of the pixel unit in a plurality of compression modes and a plurality of reconstruction results respectively corresponding to the plurality of compression results according to a quantization parameter and each pixel unit; determining a target compression mode for the pixel unit from the plurality of compression modes according to a processing error between the plurality of reconstruction results and the to-be-compressed image; and performing compression processing on each pixel unit of the to-be-compressed image according to the target compression mode corresponding to the pixel unit.
[0008] A fourth aspect of the present disclosure provides an electronic device, including: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0009] A fifth aspect of the present disclosure further provides a computer-readable storage medium, on which a computer program or instruction is stored, and when the computer program or instruction is executed by a processor, the steps of the above method are implemented.
[0010] A sixth aspect of the present disclosure further provides a computer program product, including a computer program or instruction, and when the computer program or instruction is executed by a processor, the steps of the above method are implemented.
[0011] According to an embodiment of the present disclosure, the image blocks in the to-be-compressed image are divided into a plurality of pixel units, and each pixel unit is processed separately. This can make the granularity of image compression smaller and improve the image compression accuracy of each pixel unit. In a plurality of compression modes, a quantization parameter is respectively used to compress a plurality of pixels in the pixel unit, and then the compression result is reconstructed. The processing error between the reconstructed result after reconstruction and the pixel unit before compression is determined, so as to determine the target compression mode applicable to the pixel unit based on the reconstructed result with the smallest processing error, and the image compression code for the to-be-compressed image is determined by using the target compression mode of each pixel unit respectively. It can be ensured that each pixel unit in the to-be-compressed image uses its target compression mode for subsequent processing, so that the cumulative value of the processing errors of the plurality of pixel units is the smallest, and the image compression accuracy is improved. By controlling the quantization parameter and the parameters used in each compression mode, the code length of the image compression code after compression can be flexibly adjusted according to the usage requirements, thereby improving the compression ratio of image compression and reducing the dependence on storage hardware. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, the above content and other objects, features and advantages of the present disclosure will become clearer. In the drawings:
[0013] Figure 1 Schematically shows a structural block diagram of an image compression device according to an embodiment of the present disclosure;
[0014] Figure 2 Schematically shows a partitioning result diagram of a pixel unit according to an embodiment of the present disclosure;
[0015] Figure 3 Schematically shows a flowchart for compressing and restoring a pixel unit according to an embodiment of the present disclosure;
[0016] Figure 4 Schematically shows a process of determining a target compression mode from multiple compression modes according to an embodiment of the present disclosure;
[0017] Figure 5 Schematically shows a partitioning schematic diagram of a pixel block by multiple alternative residual thresholds according to an embodiment of the present disclosure;
[0018] Figure 6 Schematically shows a flowchart of an image compression method according to an embodiment of the present disclosure; and
[0019] Figure 7 Schematically shows a block diagram of an electronic device suitable for implementing an image compression method according to an embodiment of the present disclosure. Detailed implementation manners
[0020] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are merely exemplary and are not intended to limit the scope of the present disclosure. In the following detailed description, for the sake of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, obviously, one or more embodiments can also be implemented without these specific details. In addition, in the following description, descriptions of well-known structures and technologies are omitted to avoid unnecessarily confusing the concepts of the present disclosure.
[0021] The terms used herein are merely for describing specific embodiments and are not intended to limit the present disclosure. The terms "including", "comprising", etc. used herein indicate the presence of the described features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0022] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0023] In the case of using expressions such as "at least one of A, B, and C", generally, it should be interpreted according to the meaning that those skilled in the art usually understand this expression (for example, "a system having at least one of A, B, and C" should include, but not be limited to, a system having only A, only B, only C, having A and B, having A and C, having B and C, and / or having A, B, and C, etc.).
[0024] In the technical solutions of the present disclosure, the involved user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) are all information and data authorized by the user or fully authorized by all parties. Moreover, the processing of the relevant data, such as collection, storage, use, processing, transmission, provision, disclosure, and application, all comply with relevant laws, regulations, and standards, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for the user to choose to authorize or refuse.
[0025] An embodiment of the present disclosure provides an image compression device, including: a partitioning module for partitioning a to-be-compressed image to obtain a plurality of image blocks, and partitioning each image block into a plurality of pixel units, each pixel unit including at least one pixel; an image reconstruction module for determining the compression results of the pixel units in a plurality of compression modes and a plurality of reconstruction results respectively corresponding to the plurality of compression results according to the quantization parameter and the pixel values of at least one pixel included in each pixel unit; a mode determination module for determining a target compression mode for the pixel unit from the plurality of compression modes according to the processing errors between the plurality of reconstruction results and the to-be-compressed image respectively; and an image compression module for performing compression processing on each pixel unit of the to-be-compressed image according to the target compression mode corresponding to the pixel unit.
[0026] Figure 1 A structural block diagram of an image compression device according to an embodiment of the present disclosure is schematically shown.
[0027] As Figure 1 shown, the image compression device 100 of this embodiment includes a partitioning module 110, an image reconstruction module 120, a mode determination module 130, and an image compression module 140.
[0028] In an embodiment of the present disclosure, the partitioning module 110 partitions the to-be-compressed image to obtain a plurality of image blocks, and partitions each image block into a plurality of pixel units, each pixel unit including at least one pixel.
[0029] For example, according to a preset size, the image to be compressed is divided into multiple image blocks, and each image block is divided into one or more pixel units, where the pixel unit is the smallest unit for subsequent image reconstruction and image compression.
[0030] By dividing the image to be compressed into multiple image blocks, even if each image block division results in only one pixel unit, the number of pixel units included in the image to be compressed is the same as the number of image blocks, thus avoiding the problem that the number of pixel units obtained by dividing the image to be compressed is too small and affecting the image compression accuracy. Therefore, the preset size of the image block can be determined according to the number of pixels in the image to be compressed and the expected minimum number of pixel units.
[0031] When dividing multiple pixels in an image block, several adjacent pixels with unchanged pixel values and the same change trend can be divided into the same pixel unit. In the case where the pixel values of two adjacent pixels change abruptly or the change trend changes, the above two adjacent pixels can be divided into different pixel units.
[0032] In the embodiment of the present disclosure, the image reconstruction module 120 determines the compression results of the pixel unit in multiple compression modes and multiple reconstruction results corresponding to the multiple compression results respectively according to the quantization parameter and each pixel unit.
[0033] Since a pixel unit will include a large number of pixels, the calculation load in the image compression process can be reduced by calculating the average value, calculating the difference after calculating the endpoint values, filling with default values, etc. instead of calculating each pixel separately. The multiple compression modes include compressing according to the average pixel value of multiple pixels in the pixel unit, compressing according to the endpoint pixel values in the pixel unit, and filling and compressing the pixel unit according to the default value, etc.
[0034] In different compression modes, the quantization parameter can be used to process the average pixel value, endpoint pixel value, etc. used in this compression mode, and then the compression result is reconstructed to obtain the reconstruction result. The reconstruction result can be the result obtained by decompressing the compressed pixel unit correspondingly after processing the pixel unit according to this compression mode.
[0035] In the embodiment of the present disclosure, the mode determination module 130 determines the target compression mode for the pixel unit from multiple compression modes according to the processing error between the multiple reconstruction results and the image to be compressed.
[0036] The processing error can be used to characterize the loss that occurs during the compression process of the pixel unit according to the compression mode. Therefore, the smaller the processing error of the compression mode, the better the compression effect of using this compression mode for the pixel unit. The compression mode corresponding to the smallest processing error can be determined as the target compression mode of the pixel unit.
[0037] For each pixel unit in each image block of the image to be compressed, the above operations are performed, and the target compression mode of each pixel unit can be determined. By processing the pixel units respectively using the target compression mode of each pixel unit, it can ensure that the accuracy of the result obtained after compressing the image to be compressed is the highest.
[0038] In the embodiment of the present disclosure, the image compression module 140 compresses each pixel unit of the image to be compressed according to the target compression mode corresponding to the pixel unit.
[0039] Each pixel unit is processed using the target compression mode for this pixel unit to determine the compression result of each pixel unit. Then, according to the compression results of the multiple pixel units in the image to be compressed, the image compression code of the image to be compressed can be determined.
[0040] According to the embodiment of the present disclosure, the image blocks in the image to be compressed are divided into multiple pixel units, and each pixel unit is processed separately. This can make the granularity of image compression smaller and improve the image compression accuracy of each pixel unit. Under multiple compression modes, multiple pixels in the pixel unit are compressed respectively using quantization parameters, and then the compression result is reconstructed. The processing error between the reconstructed result after reconstruction and the pixel unit before compression is determined, so as to determine the target compression mode applicable to the pixel unit based on the reconstructed result with the smallest processing error, and respectively use the target compression mode of each pixel unit to determine the image compression code for the image to be compressed. It can ensure that each pixel unit in the image to be compressed is processed using its target compression mode in subsequent processing, making the cumulative value of the processing errors of the multiple pixel units the smallest and improving the accuracy of image compression. By controlling the quantization parameters and the parameters used in each compression mode, the code length of the image compression code after compression can be flexibly adjusted according to the usage requirements, thereby improving the compression ratio of image compression and reducing the dependence on storage hardware.
[0041] Figure 2 Schematically shows the division result diagram of the pixel unit according to the embodiment of the present disclosure.
[0042] As Figure 2 shown, taking P0 - P8 as an example, this image block includes 9 pixels. When the image to be compressed to which this image block belongs is a grayscale image, the pixel differences between multiple pixels in this image block and their adjacent pixels can be determined. Since there is only one channel in the grayscale image, the pixel residuals can be directly determined according to the pixel differences, and the pixel residual sequence P diff_0 -P diff_7 is obtained, where P diff_x represents P x and P x+1The pixel difference between them. For the image to be compressed, the above processing can be performed separately for each image block.
[0043] After determining the pixel residuals, based on the pixel differences, the pixel value residuals and the gradient direction values of the pixel differences between two adjacent pixels can be determined in sequence to obtain a gradient direction value sequence D diff_0 -D diff_7 , where D diff_x represents the gradient direction value between P x and P x+1 . Among them, the gradient direction value D diff_x is used to represent the magnitude relationship between the pixel difference and a preset value. In this example, it can be determined according to the magnitude relationship between the pixel residual P diff_x and the preset value. Preferably, the preset value can be taken as 0, as shown in formula (1):
[0044] (1)
[0045] In another example, when the image to be compressed to which the image block belongs includes three channels of R, G, and B, the pixel differences between each pixel and its adjacent pixel on each channel can be determined separately, and the pixel residual P between the pixel and its adjacent pixel can be determined according to the pixel differences on each channel using formula (2) diff_x :
[0046] (2)
[0047] where W r , W g , W b are the preset weights on the three channels of R, G, and B respectively, and R y , G y , B y are the pixel values of the y-th pixel on the three channels of R, G, and B respectively.
[0048] Since the image to be compressed includes three channels, it is necessary to determine the respective gradient direction values on the three channels, as shown in formulas (3) to (5):
[0049] (3)
[0050] (4)
[0051] (5)
[0052] where D diff_x [0], D diff_x [1], D diff_x [2] respectively represent from P x to Px+1 Gradient direction values on the R, G, and B channels.
[0053] After determining the pixel residual sequence and the gradient direction value sequence, multiple pixel units can be divided from the image block according to multiple pixel value residuals, corresponding multiple gradient direction values, and a residual threshold.
[0054] In the unit division module, the residual threshold T can be compared with multiple pixel value residuals respectively to obtain multiple first comparison results corresponding to the multiple pixel value residuals. Then, according to the multiple gradient direction values and the multiple first comparison results determined by the threshold comparison unit, the division results of two adjacent neighboring pixels are determined. The division results can be used to indicate whether two adjacent pixels are divided into the same pixel unit.
[0055] For an image block with I pixels, since the pixel residual sequence and the gradient direction value sequence are determined based on pixel interpolation between two adjacent pixels, the number of pixel residuals in the pixel residual sequence and the number of gradient direction values in the gradient direction value sequence are I - 1. In this example, I = 9, the pixel residual sequence includes 8 pixel residuals, and the gradient direction value sequence includes 8 gradient direction values.
[0056] The i-th gradient direction value in the gradient direction value sequence can be compared with the (i - 1)-th gradient direction value in the multiple gradient direction values in turn according to the positional relationship of multiple pixels in the image block to obtain a second comparison result, where i is a positive integer, i = 2,..., I - 1.
[0057] In Figure 2 , the first comparison result can indicate that P diff_0 -P diff_2 , P diff_4 -P diff_7 are all less than T. The second comparison result can indicate that D diff_0 -D diff_2 are all the same. In the case where the image to be compressed is a grayscale image, D diff_0 -D diff_2 are equal. In the case where the image to be compressed is a color image, D diff_0 -D diff_2 have the same values on the three channels respectively. D diff_4 -D diff_7 has a relationship similar to that of D diff_0 -D diff_2 .
[0058] After determining the first comparison result and the second comparison result, when the second comparison result indicates that the i-th gradient direction value is inconsistent with the (i - 1)-th gradient direction value, or the first comparison result indicates that the residual between the i-th pixel and the (i + 1)-th pixel is greater than the residual threshold, the partitioning result is used to indicate that the i-th pixel and the (i + 1)-th pixel belong to different pixel units.
[0059] When the second comparison result indicates that the i-th gradient direction value is consistent with the (i - 1)-th gradient direction value, and the first comparison result indicates that the residual between the i-th pixel and the (i + 1)-th pixel is less than or equal to the residual threshold, the partitioning result is used to indicate that the i-th pixel and the (i + 1)-th pixel belong to the same pixel unit.
[0060] Therefore, according to Figure 2 the determined first comparison result and the second comparison result, it can be determined that P0 - P3 are pairwise partitioned into the same pixel unit, and P4 - P8 are pairwise partitioned into the same pixel unit.
[0061] For P3 and P4, there is P diff_3 greater than or equal to T or D diff_3 different from D diff_2 Therefore, it can be determined that there is a pixel value mutation between P3 - P4 or the change trend of P3 - P4 is different from the change trend of P2 - P3. Therefore, for P3 and P4, the partitioning result indicates that P3 and P4 are partitioned into different pixel units.
[0062] After determining the partitioning results between multiple pixels pairwise, multiple pixel units in the image block can be determined according to the multiple partitioning results. Since P0 - P3 are pairwise partitioned into the same pixel unit, P3 and P4 are partitioned into different pixel units, and P4 - P8 are pairwise partitioned into the same pixel unit, it can be determined that the image block includes two pixel units, where the first pixel unit includes P0 - P3 and the second pixel unit includes P4 - P8.
[0063] According to the embodiments of the present disclosure, by further partitioning the pixel block to obtain multiple pixel units, the minimum unit of image compression can be reduced, making the processing granularity smaller and improving the processing accuracy. By partitioning several consecutive pixels with pixel residuals less than the residual threshold and consistent gradient direction values into the same pixel unit, it can be ensured that there are no mutations and the change trend is gentle between adjacent pixels in the same pixel unit, improving the integrity of the pixel unit for compression processing of the pixel unit.
[0064] Figure 3 Schematically shows a flowchart for compressing and restoring pixel units according to an embodiment of the present disclosure.
[0065] As Figure 3As shown, taking the compression and subsequent restoration of the second pixel unit as an example. It includes five pixels P4 - P8.
[0066] Before performing the compression process, first determine the parameters to be processed for each of the multiple compression modes. Among them, the parameters to be processed for the compression mode may include at least one of the average pixel value of the pixel unit, the pixel values of the first pixel and the last pixel in the pixel unit, etc. In the image reconstruction module, for each compression mode, based on the pixel values of the multiple pixels included in the pixel unit, determine the parameters to be processed for the compression mode.
[0067] Figure 3 Take the case where the parameter to be processed is the average pixel value of the pixel unit. Take the average of the pixel values of P4 - P8 to obtain the parameter to be processed. In the case where the parameter to be processed is at least one of the pixel values of the first pixel and the last pixel in the pixel unit, the value of P4 and / or P8 can be taken as the parameter to be processed.
[0068] After determining the parameter to be processed, based on the parameter to be processed and the quantization parameter, determine the compression result obtained by compressing the pixel unit using the compression mode, where the quantization parameter is used to represent the number of bits retained for the binary data. The parameter to be processed can be processed using the quantization parameter to obtain the compression result. Figure 3 In this case, the quantization parameter is 5, that is, five - bit binary numbers are retained. And the pixel value range of the pixel is [0, 255], which is eight - bit binary numbers after conversion. To retain the high - order five - bit binary numbers, the parameter to be processed needs to be shifted right by 3 bits. That is, the compression result of 10110101 is 10110.
[0069] After completing the compression of the parameter to be processed, the parameter to be processed needs to be decompressed, and the error between the decompressed result and the parameter to be processed before compression is determined, so as to determine the errors of different compression modes.
[0070] The compression result can be reconstructed to obtain the reconstruction result. Among them, based on the number of bits of the parameter to be processed, the compression result can be restored to obtain the restored result, so that the restored result is consistent with the number of bits of the parameter to be processed. Since the parameter to be processed is 8 - bit, the restored result only needs to be restored to eight - bit binary numbers. Since the compression result is five - bit binary numbers, only shift the compression result left by (8 - 5 =) 3 bits and fill 0 in the low - order bits to obtain the restored result.
[0071] Since different processing parameters to be processed are selected for different compression modes, the meanings of the restoration results determined based on the processing parameters to be processed are different. When the processing parameters corresponding to the compression mode include the average pixel value of the pixel unit, the restoration result includes the features of all pixels within the pixel unit. Therefore, the reconstruction result of the pixel unit can be determined based on the restoration result. When the processing parameters corresponding to the compression mode include at least one of the pixel values of the first pixel and the last pixel in the pixel unit, the restoration result only includes the features of at least one of the first pixel and the last pixel in the pixel unit. Therefore, it is necessary to estimate all the pixels in the pixel unit based on the restoration result, and the reconstruction result of the pixel unit can be determined by using the method of linear interpolation according to the restoration result and the number of pixels in the pixel unit.
[0072] According to an embodiment of the present disclosure, the compression mode further includes reconstructing the pixel unit based on the pixel values of multiple pixels located in the row above the pixel unit in the image to be compressed; the image compression device further includes a pixel reconstruction module, configured to reconstruct a target pixel by using the pixel values of the reconstructed pixels in the row above each target pixel located in the pixel unit, so as to obtain the reconstruction result of the pixel unit.
[0073] When the multiple pixels included in the pixel unit are not the first-row pixels in the image to be compressed, for each target pixel in the pixel unit, the pixel located in the row above the target pixel in the image to be compressed can be determined as the reconstructed pixel, and the target pixel can be reconstructed according to the pixel value of the reconstructed pixel. Thus, by directly performing reconstruction using known pixels, the computational load is reduced. At the same time, since the reconstructed pixel and the target pixel are in the same column and adjacent in the image to be compressed, reconstructing the target pixel by using the reconstructed pixel can ensure that the error is within a controllable range, and the amount of calculation can be reduced on the premise of ensuring the reconstruction accuracy.
[0074] According to an embodiment of the present disclosure, multiple compression modes are provided. By compressing and reconstructing the pixel unit using different compression modes and determining the respective reconstruction results of each pixel unit under multiple compression modes, the loss caused by compression to the image quality can be determined based on the reconstruction results. Compared with processing all pixel units in the image to be compressed using a single compression mode, cross-using multiple compression modes can minimize the loss of each pixel unit, thereby improving the accuracy of image compression and the image quality.
[0075] For each compression mode, its reconstruction result is determined separately. Taking three compression modes as an example, the parameter to be processed in the first compression mode is the average pixel value of the pixel unit, the parameter to be processed in the second compression mode is at least one of the pixel values of the first pixel and the last pixel in the pixel unit, and the third compression mode reconstructs the target pixel by using the reconstructed pixel in the same column and the upper row of the target pixel in the pixel unit of the image to be compressed. After determining the reconstruction result, the error that appears after compressing the pixel unit for each compression mode can be determined separately, and the target compression mode with the smallest error can be selected from multiple compression modes, and the target compression mode is used to process the pixel unit in actual use.
[0076] According to an embodiment of the present disclosure, the mode determination module is further configured to: for each reconstruction result, determine the processing loss of each pixel in the reconstruction result; based on the processing losses of multiple reconstruction results, select a target reconstruction result and a target compression mode corresponding to the target reconstruction result from multiple reconstruction results.
[0077] Figure 4 Schematically shows the process of determining a target compression mode from multiple compression modes according to an embodiment of the present disclosure.
[0078] As Figure 4 shown, the reconstruction results of three compression modes are determined in sequence, and for each reconstruction result, based on the reconstruction result of each pixel in the pixel unit and the pixel value of each pixel in the pixel unit in the image to be compressed, the processing loss of each pixel is determined, where the processing loss of each pixel can be determined according to the pixel value of the pixel in the reconstruction result and the pixel value of the pixel in the image to be compressed. For example, the pixel value in the reconstruction result can be subtracted from the pixel value in the image to be compressed, and the absolute value is taken as the processing loss of the pixel.
[0079] According to the processing losses of multiple pixels, the maximum value is determined as the maximum processing loss, the average value is determined as the average processing loss, and the processing error of the reconstruction result is determined according to the maximum processing loss and the average processing loss, where the processing error can be obtained by weighted summation of the maximum processing loss and the average processing loss, and the weights of the maximum processing loss and the average processing loss can be preset in advance. Based on the processing errors of multiple reconstruction results, the compression mode corresponding to the reconstruction result with the smallest processing error can be determined as the target compression mode, ensuring that after each pixel unit in the image to be compressed is processed using its target compression mode, the total loss of the image to be compressed is the smallest.
[0080] According to an embodiment of the present disclosure, the image compression module is further configured to: for each pixel unit, determine a compression code for the pixel unit based on a target compression mode, the number of pixels included in the pixel unit, and a quantization parameter, to obtain a plurality of compression codes; and determine an image compression code according to the compression codes and the positions of the plurality of pixel units in the image to be compressed.
[0081] Encode multiple compression modes into a binary format. For example, in the case of including three compression modes, the encodings of different compression modes can be 00, 01, and 10 respectively. Similarly, convert the number of pixels and the quantization parameter in the pixel unit into binary formats respectively. In one example, when the image to be compressed is a grayscale image, concatenate the encoding of the target compression mode, the encoding of the number of pixels, and the encoding of the quantization parameter to obtain a compression code. In another example, when the image to be compressed is a color image, the processing order of the R, G, and B channels during compression of the image to be compressed can be encoded, and the encoding of the number of pixels, the encoding of the quantization parameter, and the processing order encoding are concatenated to obtain a compression code.
[0082] In the image compression module, a plurality of compression codes can be arranged according to the positions of the pixel units corresponding to each compression code in the image to be compressed, and concatenated to obtain an image compression code.
[0083] According to an embodiment of the present disclosure, the image compression code includes the target compression mode, the number of pixels, and the quantization parameter used in the image compression mode of each pixel unit respectively. Therefore, in the subsequent decompression process, each pixel unit can be accurately divided and processed based on the image compression code, so as to determine the overdrive value of the image to be compressed, and the accuracy of image compression can be ensured. In addition, by encoding the above parameters such as the number of pixels, the code length of the image compression code can be significantly reduced, the compression ratio can be increased without reducing the compression accuracy, the compression effect can be improved, and the storage and communication loads can be reduced.
[0084] According to an embodiment of the present disclosure, the image compression device further includes: a sending module, configured to send the image compression code to a display module, so that the display module determines the difference between the image to be compressed and the previous image based on the image compression code, and determines a plurality of pixel values of the image to be compressed according to the pixel values of the previous image and the difference, so as to display the image to be compressed according to the plurality of pixel values.
[0085] After sending the image compression code to the display module, the display module determines the target compression mode, the number of pixels, and the quantization parameter of each pixel unit based on the image compression code, and divides the previous image of the image to be compressed according to the number of pixels of each pixel unit to obtain a plurality of previous pixel units. The display module parses the overdrive value of each pixel unit based on the target compression mode and the quantization parameter, and determines the difference between each pixel unit and its corresponding online pixel unit according to the overdrive value of each pixel unit.
[0086] According to the multiple differences and the multiple previous pixel units, determine the multiple pixel values of each pixel unit in the image to be compressed, so as to determine the multiple pixel values in the image to be compressed, so that the display module can display the image to be compressed according to the multiple pixel values.
[0087] Figure 5 Schematically shows a schematic diagram of the division of a pixel block by multiple alternative residual thresholds according to an embodiment of the present disclosure.
[0088] Such as Figure 5 shown, the image block includes P0-P I-1 There are a total of I pixels. In order to determine a compression method that satisfies both the compression ratio and the accuracy of the image block, a residual threshold sequence can be set, where the multiple alternative residual thresholds in the residual threshold sequence increase in sequence.
[0089] Taking P7-P8 as an example, P diff_7 is greater than the first alternative residual threshold. At this time, it is determined that the first comparison result indicates that P7 and P8 are divided into different pixel units, and P diff_7 is less than the second alternative residual threshold. At this time, it is determined that the first comparison result indicates that P7 and P8 are divided into the same pixel unit.
[0090] Since the pixel value residuals less than the next alternative residual threshold in the residual threshold sequence must also be less than the previous alternative residual threshold in the residual threshold sequence, and the gradient direction values between multiple pixels in the image block do not change, the factors affecting the division results of different alternative residual thresholds include the first comparison results of different alternative residual thresholds.
[0091] Among the multiple first comparison results determined according to the larger alternative residual thresholds in the residual threshold sequence, the number of first comparison results indicating that adjacent pixels are divided into different pixel units is less than that in the first comparison results determined according to the smaller alternative residual thresholds, where the first comparison results indicate that adjacent pixels are divided into different pixel units. Therefore, when dividing an image block using a larger alternative residual threshold, the number of pixel units obtained must be less than or equal to the number of pixel units obtained by dividing the image block using a smaller alternative residual threshold. Thus, it can be ensured that when dividing an image block using multiple alternative residual thresholds in the residual threshold sequence, the corresponding accuracies of the multiple division methods obtained decrease in sequence, and the compression ratios increase in sequence.
[0092] For multiple alternative residual thresholds in the residual threshold sequence, multiple image blocks of the image to be compressed can be divided respectively, and the alternative image compression codes corresponding to the multiple alternative residual thresholds can be determined respectively using the above method.
[0093] Since the encoding lengths are the same after each image block is encoded according to the above encoding method, the code length of the compression code of the image to be compressed is only related to the number of pixel units in the image to be compressed, that is, from the first alternative residual threshold to the m-th alternative residual threshold, the corresponding number of pixel units decreases in sequence, and the code length of the compression code also decreases in sequence. Therefore, according to the order of the multiple alternative residual thresholds in the residual threshold sequence, the code lengths of the alternative image compression codes corresponding to the multiple alternative residual thresholds can be compared with the code length threshold respectively, and the alternative residual threshold corresponding to the alternative image compression code that is first less than the code length threshold can be determined as the residual threshold.
[0094] The code length threshold can also be set as a quantity range, and the residual threshold whose code length is within the above quantity range can be selected from the multiple alternative image compression codes, so that the image compression code obtained after subsequent image compression meets the requirements of the compression ratio, and at the same time, the compression accuracy can be ensured as much as possible.
[0095] According to an embodiment of the present disclosure, using the code length threshold, a code length that meets the requirements is determined from the alternative image compression codes determined using multiple alternative residual thresholds, and the alternative residual threshold corresponding to the alternative image compression code with this code length is determined as the residual threshold. Different residual thresholds can be selected according to actual needs to control the code length of the image compression code obtained after compression, so as to meet the requirements of different compression ratios and accuracies in different usage scenarios.
[0096] Based on the above image compression device, the present disclosure also provides a display chip, including the above image compression device.
[0097] Based on the above image compression device, the present disclosure also provides an image compression method. The following will be combined with Figure 6 This method will be described in detail.
[0098] Figure 6 A flowchart schematically showing an image compression method according to an embodiment of the present disclosure is shown.
[0099] As Figure 6 shown, the image compression method of this embodiment includes operations S610 to S640.
[0100] In operation S610, the image to be compressed is divided to obtain a plurality of image blocks, and each image block is divided into a plurality of pixel units, and each pixel unit includes at least one pixel.
[0101] In operation S620, according to the quantization parameter and each pixel unit, the compression results of the pixel unit in a plurality of compression modes and a plurality of reconstruction results respectively corresponding to the plurality of compression results are determined.
[0102] In operation S630, according to the processing error between the plurality of reconstruction results and the image to be compressed, a target compression mode for the pixel unit is determined from the plurality of compression modes.
[0103] In operation S640, for each pixel unit of the image to be compressed, the pixel unit is compressed according to the target compression mode corresponding to the pixel unit.
[0104] According to an embodiment of the present disclosure, for each image block of the image to be compressed, each image block is divided into a plurality of pixel units, and each pixel unit includes at least one pixel, including: for each image block, determining the pixel difference between each pixel in each image block and its adjacent pixels; according to the pixel difference, sequentially determining the pixel value residual and the gradient direction value of the pixel difference between two adjacent pixels, obtaining a pixel residual sequence including a plurality of pixel value residuals and a gradient direction value sequence including corresponding plurality of gradient direction values, wherein the gradient direction value is used to represent the magnitude relationship between the pixel difference and a preset value; according to the plurality of pixel value residuals, the corresponding plurality of gradient direction values, and a residual threshold, dividing the image block into a plurality of pixel units.
[0105] According to an embodiment of the present disclosure, dividing the image block into a plurality of pixel units according to the plurality of pixel value residuals, the corresponding plurality of gradient direction values, and a residual threshold includes: comparing the residual threshold with the plurality of pixel value residuals respectively to obtain a plurality of first comparison results respectively corresponding to the plurality of pixel value residuals; determining the division result for two adjacent pixels according to the plurality of gradient direction values and the plurality of first comparison results; and determining a plurality of pixel units in the image block according to the plurality of division results.
[0106] According to an embodiment of the present disclosure, determining a partitioning result for two adjacent pixels based on a plurality of gradient direction values and a plurality of first comparison results includes: comparing the i-th gradient direction value in the gradient direction value sequence with the (i - 1)-th gradient direction value in the plurality of gradient direction values in sequence according to the positional relationship of the plurality of pixels in the image block, to obtain a second comparison result, where i is a positive integer, i = 2,......, I - 1, and I is the number of pixels in the image block; in the case where the second comparison result indicates that the i-th gradient direction value is inconsistent with the (i - 1)-th gradient direction value, or the first comparison result indicates that the residual between the i-th pixel and the (i + 1)-th pixel is greater than a residual threshold, the partitioning result is used to indicate that the i-th pixel and the (i + 1)-th pixel belong to different pixel units.
[0107] According to an embodiment of the present disclosure, determining a compression result of a pixel unit in a plurality of compression modes and a plurality of reconstruction results respectively corresponding to the plurality of compression results based on a quantization parameter and pixel values of at least one pixel included in each pixel unit includes: for each compression mode, determining a parameter to be processed for the compression mode based on the pixel values of the plurality of pixels included in the pixel unit, where the parameter to be processed includes at least one of the average pixel value of the pixel unit, the pixel values of the first pixel and the last pixel in the pixel unit; determining a compression result obtained by compressing the pixel unit using the compression mode based on the parameter to be processed and the quantization parameter; and reconstructing the compression result to obtain a reconstruction result.
[0108] According to an embodiment of the present disclosure, determining a compression result obtained by compressing a pixel unit using a compression mode based on a parameter to be processed and a quantization parameter includes: processing the parameter to be processed using the quantization parameter to obtain a compression result, where the quantization parameter is used to represent the number of bits to be retained for binary data.
[0109] According to an embodiment of the present disclosure, reconstructing a compression result to obtain a reconstruction result includes: restoring the compression result based on the number of bits of the parameter to be processed to obtain a restored result; in the case where the parameter to be processed corresponding to the compression mode includes the average pixel value of the pixel unit, determining the reconstruction result of the pixel unit based on the restored result; and in the case where the parameter to be processed corresponding to the compression mode includes at least one of the pixel values of the first pixel and the last pixel in the pixel unit, determining the reconstruction result of the pixel unit using a linear interpolation method based on the restored result and the number of pixels in the pixel unit.
[0110] According to an embodiment of the present disclosure, the image compression method further includes: reconstructing a target pixel using the pixel value of the reconstructed pixel in the previous row of each target pixel located in the pixel unit to obtain the reconstruction result of the pixel unit.
[0111] According to an embodiment of the present disclosure, determining a target compression mode for a pixel unit from a plurality of compression modes according to the processing errors between each of the plurality of reconstruction results and the image to be compressed includes: for each reconstruction result, determining the respective processing losses of each pixel based on the reconstruction result of each pixel in the pixel unit and the pixel value of each pixel in the image to be compressed in the pixel unit; determining the processing error of the reconstruction result according to the maximum processing loss and the average processing loss; and based on the processing errors of each of the plurality of reconstruction results, determining the compression mode corresponding to the reconstruction result with the minimum processing error as the target compression mode.
[0112] According to an embodiment of the present disclosure, determining an image compression code for the image to be compressed according to the target compression mode for each pixel unit includes: for each pixel unit, determining a compression code for the pixel unit based on the target compression mode, the number of pixels included in the pixel unit, and the quantization parameter, to obtain a plurality of compression codes; and determining the image compression code according to the compression codes and the positions of the plurality of pixel units in the image to be compressed.
[0113] According to an embodiment of the present disclosure, the image compression method further includes: sending the image compression code to a display module, so that the display module determines the difference between the image to be compressed and the previous image based on the image compression code, and determines the pixel values of the image to be compressed according to the pixel values of the previous image and the difference, so as to display the image to be compressed according to the plurality of pixel values.
[0114] According to an embodiment of the present disclosure, the image compression method further includes: determining a plurality of alternative image compression codes for a plurality of alternative residual thresholds in a residual threshold sequence, where the plurality of alternative residual thresholds in the residual threshold sequence are arranged in ascending order; comparing the alternative image compression codes corresponding to the plurality of alternative residual thresholds with a code length threshold in the order of the plurality of alternative residual thresholds in the residual threshold sequence, and determining the alternative residual threshold corresponding to the alternative image compression code that is first less than the code length threshold as the residual threshold.
[0115] Figure 7 A block diagram of an electronic device suitable for implementing the image compression method according to an embodiment of the present disclosure is schematically shown.
[0116] As Figure 7As shown, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage section 708 into a random access memory (RAM) 703. The processor 701 can include, for example, a general microprocessor (e.g., CPU), an instruction set processor, and / or a related chipset, and / or a dedicated microprocessor (e.g., an application specific integrated circuit (ASIC)), etc. The processor 701 can also include on-board memory for caching purposes. The processor 701 can include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0117] In the RAM 703, various programs and data required for the operation of the electronic device 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. The processor 701 performs various operations of the method flow according to an embodiment of the present disclosure by executing the program in the ROM 702 and / or the RAM 703. It should be noted that the program can also be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 can also perform various operations of the method flow according to an embodiment of the present disclosure by executing the program stored in the one or more memories.
[0118] According to an embodiment of the present disclosure, the electronic device 700 can further include an input / output (I / O) interface 705, and the input / output (I / O) interface 705 is also connected to the bus 704. The electronic device 700 can further include one or more of the following components connected to the input / output (I / O) interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the input / output (I / O) interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed so that a computer program read from it can be installed into the storage section 708 as needed.
[0119] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist separately without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the one or more programs are executed, the methods according to the embodiments of the present disclosure are implemented.
[0120] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, and for example, may include but is not limited to: portable computer disks, hard disks, random access memories (RAMs), read-only memories (ROMs), erasable programmable read-only memories (EPROMs or flash memories), portable compact disk read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the above. In the present disclosure, the computer-readable storage medium may be any tangible medium that contains or stores a program, and the program may be used by or in combination with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the above-described ROM 702 and / or RAM 703 and / or one or more memories other than ROM 702 and RAM 703.
[0121] An embodiment of the present disclosure further includes a computer program product, which includes a computer program, and the computer program includes program codes for executing the method shown in the flowchart. When the computer program product runs in a computer system, the program codes are used to enable the computer system to implement the method provided by the embodiments of the present disclosure.
[0122] When the computer program is executed by the processor 701, the above functions defined in the system / apparatus of the embodiments of the present disclosure are executed. According to an embodiment of the present disclosure, the above-described systems, apparatuses, modules, units, etc. may be implemented by computer program modules.
[0123] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices and magnetic storage devices. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and is downloaded and installed through the communication part 709, and / or installed from the removable medium 711. The program codes included in the computer program may be transmitted by any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0124] In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the processor 701, the above-described functions defined in the system of the embodiments of the present disclosure are performed. According to the embodiments of the present disclosure, the above-described systems, devices, apparatuses, modules, units, etc. can be implemented by computer program modules.
[0125] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level procedures and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, such as Java, C++, Python, the "C" language, or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., by connecting through the Internet using an Internet service provider).
[0126] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, and the above-mentioned module, program segment, or part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram or flowchart, and the combination of blocks in the block diagram or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0127] Those skilled in the art can understand that the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways, even if such combinations or combinations are not explicitly described in the present disclosure. In particular, without departing from the spirit and teachings of the present disclosure, the features described in the various embodiments of the present disclosure can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of the present disclosure.
[0128] The embodiments of the present disclosure have been described above. However, these embodiments are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments have been described separately above, this does not mean that the measures in each embodiment cannot be used advantageously in combination. Without departing from the scope of the present disclosure, those skilled in the art can make various substitutions and modifications, and all such substitutions and modifications should fall within the scope of the present disclosure.
Claims
1. An image compression device, comprising: A division module, used for dividing the image to be compressed to obtain a plurality of image blocks, and dividing each of the image blocks into a plurality of pixel units, each of the pixel units including at least one pixel; An image reconstruction module, used for determining, according to the quantization parameter and each of the pixel units, a compression result of the pixel unit under a plurality of compression modes and a plurality of reconstruction results respectively corresponding to the plurality of compression results; a mode determination module, configured to determine a target compression mode for the pixel unit from the plurality of compression modes according to processing errors between the plurality of reconstruction results and the image to be compressed; as well as The image compression module is used to compress each pixel unit of the image to be compressed according to the target compression mode corresponding to the pixel unit.
2. The device according to claim 1, characterized in that The partitioning module is also used for: For each of the image blocks, determining a pixel difference between each of a plurality of pixels in each of the image blocks and an adjacent pixel; According to the pixel difference, a pixel value residual between two adjacent pixels and a gradient direction value of the pixel difference are determined in sequence to obtain a pixel residual sequence including a plurality of pixel value residuals and a gradient direction value sequence including a plurality of corresponding gradient direction values, wherein the gradient direction value is used to indicate a magnitude relationship between the pixel difference and a preset value; The image block is divided into a plurality of pixel units according to the plurality of pixel value residuals, the corresponding plurality of gradient direction values, and a residual threshold.
3. The device according to claim 2, characterized in that The partitioning module is also used for: Compare the residual threshold with the plurality of pixel value residuals respectively to obtain a plurality of first comparison results respectively corresponding to the plurality of pixel value residuals; Determining a division result for the two adjacent pixels according to the multiple gradient direction values and the multiple first comparison results; as well as A plurality of pixel units in the image block are determined according to the plurality of division results.
4. The device according to claim 3, characterized in that The number of the multiple gradient direction values is I-1; The partitioning module is also used for: According to the position relationship of multiple pixels in the image block, sequentially compare the i-th gradient direction value in the gradient direction value sequence with the i-1-th gradient direction value to obtain a second comparison result, wherein i is a positive integer, i=2, ..., I-1, and I is the number of pixels in the image block; When the second comparison result indicates that the i-th gradient direction value is inconsistent with the i-1-th gradient direction value, or the first comparison result indicates that the residual between the i-th pixel and the i+1-th pixel is greater than the residual threshold, the division result is used to indicate that the i-th pixel and the i+1-th pixel belong to different pixel units; When the second comparison result represents that the i-th gradient direction finger is consistent with the i-1-th gradient direction value, and the first comparison result represents that the residual between the i-th pixel and the i+1-th pixel is less than or equal to the residual threshold, the division result is used to represent that the i-th pixel and the i+1-th pixel belong to the same pixel unit.
5. The device according to claim 1, characterized in that The image reconstruction module is also used for: For each of the compression modes, based on the pixel values of the plurality of pixels included in the pixel unit, determine a parameter to be processed of the compression mode, wherein the parameter to be processed includes at least one of an average pixel value of the pixel unit and a pixel value of a first pixel and a last pixel in the pixel unit; Determining, based on the parameter to be processed and the quantization parameter, a compression result obtained by compressing the pixel unit using the compression mode; and The compression result is reconstructed to obtain the reconstructed result.
6. The device according to claim 5, characterized in that The image reconstruction module is also used for: Restoring the compression result based on the number of bits of the parameter to be processed to obtain a restoration result; In a case where the parameters to be processed corresponding to the compression mode include the average pixel value of the pixel unit, the reconstruction result of the pixel unit is determined based on the restoration result; and in a case where the parameters to be processed corresponding to the compression mode include at least one of the pixel values of the first pixel and the last pixel in the pixel unit, the reconstruction result of the pixel unit is determined based on the restoration result and the number of pixels in the pixel unit using a linear interpolation method.
7. The device according to claim 5, characterized in that The compression mode further includes reconstructing the pixel unit based on the pixel values of a plurality of pixels in the image to be compressed that are located in a row above the pixel unit; The device also includes: The pixel reconstruction module is used to reconstruct the target pixels by using the pixel values of the reconstructed pixels in a row above each target pixel in the pixel unit to obtain a reconstruction result of the pixel unit.
8. The device according to claim 1, characterized in that The mode determination module is also used for: For each of the reconstruction results, determining a processing loss of each of the pixels in the reconstruction result; A target reconstruction result and the target compression mode corresponding to the target reconstruction result are selected from the multiple reconstruction results based on the processing losses of the multiple reconstruction results.
9. The device according to claim 1, characterized in that The image compression module is also used for: For each of the pixel units, based on the target compression mode, the number of pixels included in the pixel unit and the quantization parameter, determine a compression code for the pixel unit to obtain multiple compression codes; as well as An image compression code of the image to be compressed is determined according to the compression code and positions of the plurality of pixel units in the image to be compressed.
10. The device according to any one of claims 1 to 9, characterized in that: The device also includes: A compression code calculation module, used for determining a plurality of candidate image compression codes for a plurality of candidate residual thresholds in a residual threshold sequence, wherein the plurality of candidate residual thresholds in the residual threshold sequence are arranged in ascending order; A threshold determination module is used to compare the alternative image compression codes corresponding to the multiple alternative residual thresholds with the code length threshold respectively according to the order of the multiple alternative residual thresholds in the residual threshold sequence, and determine the alternative residual threshold corresponding to the first alternative image compression code smaller than the code length threshold as the residual threshold.
11. A display chip, comprising: An image compression device according to any one of claims 1 to 10.
12. An image compression method, comprising: Dividing the image to be compressed to obtain a plurality of image blocks, dividing each of the image blocks into a plurality of pixel units, each of the pixel units including at least one pixel; Determine, according to the quantization parameter and each of the pixel units, compression results of the pixel unit under multiple compression modes and multiple reconstruction results respectively corresponding to the multiple compression results; determining a target compression mode for the pixel unit from the plurality of compression modes according to processing errors between the plurality of reconstruction results and the image to be compressed; as well as For each pixel unit of the image to be compressed, compression processing is performed on the pixel unit according to the target compression mode corresponding to the pixel unit.
13. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the image compression method according to claim 12.
14. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the image compression method according to claim 12.