Picture compression method and device, computer device and storage medium

By performing lossless image compression in an embedded system and generating an index table through modulo operations and buffer transformations, the problems of large storage space and data loss are solved, achieving lossless compression and cost savings.

CN116309889BActive Publication Date: 2026-04-07SHENZHEN JIER TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-20
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

Existing image compression algorithms consume a lot of storage space in embedded systems and may cause data loss, especially when displaying images on a screen with insufficient RAM.

Method used

The original data is obtained through modulo operation, transformed and stored in different buffers, non-repeating data statistics are counted, the target buffer is determined, a color data table and an index table are generated, and the index table is compressed to form a compressed index table.

Benefits of technology

It achieves lossless compression, reduces storage space requirements, saves costs, avoids data loss, and is suitable for embedded systems with limited RAM.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116309889B_ABST
    Figure CN116309889B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a picture compression method, device, computer equipment and storage medium. The method comprises: performing a modulo operation on a picture to be compressed to obtain original data; transforming the original data and storing the transformed data in different buffer areas, and counting non-repeated data statistics in each buffer area; determining the buffer area with the minimum non-repeated data statistics as a target buffer area, generating a color data table according to the non-repeated data in the target buffer area; generating an index table according to the target buffer area and the color data table; and compressing the index table to obtain a compressed index table. Through the method of the embodiments of the present application, the picture can be losslessly compressed while occupying a small space during compression.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a picture lossless compression method and device, computer equipment and a storage medium. BACKGROUND

[0002] With the development of economy and technology, many embedded systems have display screens, and a large amount of picture information needs to be displayed every day. These pictures often need to be stored in storage chips, and are usually stored in the original (uncompressed) manner, which occupies a large amount of storage chip space, and even requires the use of additional storage chips, increasing the volume and cost of the system. Therefore, the picture is stored by using a compression decoding algorithm to reduce the occupied storage chip space. However, when the existing algorithm is used for decoding, a large amount of RAM is consumed. If the RAM of a small embedded system is not enough to support the decoding consumption of the algorithm, data loss may occur, and there will be certain defects when displaying on the display screen, or the compressed data has a certain loss. SUMMARY

[0003] The embodiment of the present application provides a picture compression method, device, computer equipment and storage medium, and aims to solve the problems of occupying a large amount of storage space when the picture is not compressed, and the inconvenience of compression or data loss when compressed.

[0004] In a first aspect, the embodiment of the present application provides a picture lossless compression method, which comprises: performing a modulo operation on a picture to be compressed to obtain original data; transforming the original data and storing the transformed data in different buffer areas, and counting the number of non-repeated data in each buffer area; determining the buffer area with the minimum number of non-repeated data as a target buffer area, and generating a color data table according to the non-repeated data in the target buffer area; generating an index table according to the target buffer area and the color data table; and compressing the index table to obtain a compressed index table.

[0005] In a second aspect, the embodiment of the present application further provides a picture lossless compression device, which comprises: a modulo unit configured to perform a modulo operation on a picture to be compressed to obtain original data; a transformation unit configured to transform the original data and store the transformed data in different buffer areas, and count the number of non-repeated data in each buffer area; a first generation unit configured to determine the buffer area with the minimum number of non-repeated data as a target buffer area, and generate a color data table according to the non-repeated data in the target buffer area; a second generation unit configured to generate an index table according to the target buffer area and the color data table; and a compression unit configured to compress the index table to obtain a compressed index table.

[0006] Thirdly, embodiments of the present invention also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.

[0007] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, can implement the above-described method.

[0008] This invention provides a lossless image compression method, apparatus, computer device, and storage medium. The method includes: performing a modulo operation on the image to be compressed to obtain original data; transforming the original data and storing the transformed data in different buffers, and counting the unique data values ​​in each buffer; determining the buffer with the smallest unique data value as the target buffer, and generating a color data table based on the unique data in the target buffer; generating an index table based on the target buffer and the color data table; and compressing the index table to obtain a compressed index table. This invention, by obtaining original data from the image, transforming the original data by byte size, and changing the index to obtain compressed data stored in the index table, achieves lossless image compression by reducing compression costs, shrinking compression space, and saving storage space without data loss. Attached Figure Description

[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 A schematic flowchart of the image compression method provided in an embodiment of the present invention;

[0011] Figure 2 A schematic diagram of a sub-process of the image compression method provided in an embodiment of the present invention;

[0012] Figure 3 A schematic diagram of a sub-process of the image compression method provided in an embodiment of the present invention;

[0013] Figure 4 A schematic diagram of a sub-process of the image compression method provided in an embodiment of the present invention;

[0014] Figure 5 A schematic diagram of a sub-process of the image compression method provided in an embodiment of the present invention;

[0015] Figure 6 A schematic block diagram of an image compression device provided in an embodiment of the present invention;

[0016] Figure 7 A schematic block diagram of specific units of the image compression apparatus provided in the embodiments of the present invention; and

[0017] Figure 8 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation

[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0019] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0020] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0021] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0022] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating the image compression method provided in this embodiment of the invention. The image compression method in this embodiment can be applied to an aerosol device equipped with a display screen, which needs to display various images. However, the RAM in the aerosol device may be insufficient to support the large amount of RAM consumed during decoding by existing algorithms; if data loss occurs, there will be certain defects when displaying it on the screen. Therefore, the image compression method of this invention can reduce the cost of the device, eliminate the need for external storage chips, reduce the device space, save storage space on the main control chip, and facilitate program expansion.

[0023] Figure 1 This is a schematic flowchart of the image compression method provided in an embodiment of the present invention. As shown in the figure, the method includes the following steps S110-S150.

[0024] S110. Perform modulo operation on the image to be compressed to obtain the original data;

[0025] In this embodiment, the image to be compressed is the image to be displayed in the aerosol device. Image storage typically involves converting the image into machine-readable data using image encoding software. Common image encoding software includes Image2lcd, ACDSee, and OLED, all of which can perform image encoding operations to convert the image into target data according to rules. Since TFT color screens generally use RGB565 or RGB888 for color code conversion, with RGB565 being a more popular method, subsequent applications of this image compression method will primarily focus on RGB565. The RGB565 format target data is the original data. Obtaining the RGB565 format original data through image encoding operations reduces costs and the amount of data transmitted by the microcontroller, meeting the needs of general usage scenarios.

[0026] S120. Transform the original data and store the transformed data in different buffers, and count the non-repeating data values ​​in each buffer.

[0027] In this embodiment, the non-repeating data statistics value is the number of non-repeating data in the buffer. The original data can be transformed according to the byte size, specifically according to single byte, double byte, and four byte. For example, the data rgb(105,105,105) is transformed into 01101001 according to the double byte size. By compressing the data according to the byte size, the original data can be transformed into data that is easy to count and compare, reducing the content that needs to be processed during compression. The non-repeating data statistics value in each buffer is counted, which makes it easier to accurately understand the repetition of the transformed data.

[0028] In one embodiment, such as Figure 2 As shown, step S120 may include steps S121-S122.

[0029] S121. Store the original data in the first buffer according to the size of the first byte, and obtain the first statistical value of the number of non-repeating data based on the number of non-repeating data in the first buffer.

[0030] S122. Store the original data in the second buffer according to the size of the second byte, and obtain the second statistical value of the number of non-repeating data based on the number of non-repeating data in the second buffer.

[0031] In this embodiment, the first byte size is two bytes, and the first buffer is a buffer for storing data transformed according to the two-byte size. The second byte size is four bytes, and the second buffer is a buffer for storing data transformed according to the two-byte size. When transforming the original data according to the byte size, the order of the original data should not be disrupted, and the data in the buffer should be consistent with the order of the original data. By compressing the original data according to the byte size and counting the number of non-repeating values ​​in sequence, the data can be effectively compressed without disrupting the original data order, thus avoiding problems such as image quality degradation during the decoding process.

[0032] S130. Determine the buffer with the smallest non-repeating data statistical value as the target buffer, and generate a color data table based on the non-repeating data in the target buffer;

[0033] In this embodiment, the buffer containing the data to be processed in the subsequent process is the target buffer. The buffer with the smallest non-repeating data statistical value has more repetitive data than the buffer with the highest non-repeating data statistical value. By selecting the buffer with more repetitive data as the target buffer, the generated color data table occupies less space, and the more repetitive data is easier to process uniformly during the image compression process, reducing the number of operation steps in the image compression process.

[0034] In one embodiment, such as Figure 3 As shown, step S130 may include steps S131-S133.

[0035] S131. Compare the first statistical value with the second statistical value to obtain a comparison result;

[0036] S132. The buffer corresponding to the smaller of the comparison results is selected as the target buffer;

[0037] S133. Extract the non-repeating data from the target buffer and store it in the color data table.

[0038] In this embodiment, the first statistical value is compared with the second statistical value, and the buffer corresponding to the smaller statistical value is selected as the target buffer. The size of the target buffer in bytes is used as the storage bytes required in the subsequent compression process. By selecting the buffer corresponding to the smaller statistical value as the target buffer, the generated color data table occupies less space, and a large amount of duplicate data is easily processed uniformly during image compression, reducing the number of operation steps in the image compression process. In one embodiment, such as... Figure 3 As shown, step S130 further includes step S134.

[0039] S134. If the comparison result is that the first statistical value and the second statistical value are equal, the first buffer is used as the target buffer, wherein the first byte is smaller than the second byte.

[0040] In this embodiment, when comparing the first statistical value and the second statistical value, if the comparison results are equal, the buffer containing the first byte should be selected as the target buffer. This is because the first byte is defined as a two-byte buffer and the second byte is defined as a four-byte buffer. When storing data in two-byte buffers, each data occupies 16 bits, while when storing data in four-byte buffers, each data occupies 32 bits. To save equipment costs, reduce storage space usage, and facilitate compression processing, the buffer containing data in two-byte buffers is selected as the target buffer when the comparison results are the same.

[0041] S140. Generate an index table based on the target buffer and the color data table;

[0042] In this embodiment, the index bit width is determined by the size of the target buffer and its statistical value. Specifically, assuming the index bit width is 6, when the stored bytes are double bytes, the data in the index table is represented bit by bit (i.e., binary representation), where $ represents an unused bit and the letter represents a used bit, not a specific numerical value: $$$$$$$$$AAAAAA. After storing the data in the target buffer into the index table according to the calculated index bit width, the data in the index table is compared with the data in the color data table. Since the data in the color data table is extracted from the target buffer, and the data in the index table is from the target buffer, there will definitely be identical data in the two tables. The index of the identical data in the color data table is replaced in the index table. By replacing the index of the identical data, the indexes of duplicate data in the index table are uniformly processed, achieving the effect of small space occupation, saving equipment costs, and reducing the time consumption in subsequent compression and decoding processes.

[0043] In one embodiment, such as Figure 4 As shown, step S140 may include steps S141-S142.

[0044] S141. Compare the data in the target cache with the data in the color data table;

[0045] S142. Replace the data in the target cache that is equal to the data in the color data table with the index of the corresponding data in the color data table.

[0046] In this embodiment, the data in the color data table also exists in the target buffer. By comparing the data of both, the identical data in the target buffer is replaced with the index of the data in the color data table. For example, the data in the color data table (letters represent data, and numbers represent indexes; for the sake of illustration, letters and numbers do not represent specific values) are A, B, C, and the data indexes are 1, 2, 3. The data in the target buffer is A, B, C, C, and the data in the target buffer after replacement is 1, 2, 3, 3. Therefore, the data in the index table is 1, 2, 3, 3. By replacing the data after comparison, the data in the index table is unified, reducing non-repeating data, facilitating compression, reducing the time in the subsequent compression and decoding process, and saving equipment costs.

[0047] In one embodiment, such as Figure 4 As shown, step S140 may include steps S143-S144.

[0048] S143. Using the size of the target buffer as the base and the statistical value of the number of non-repeating data in the target buffer as the result of the exponentiation operation, determine the exponent of the exponentiation operation.

[0049] S144. Determine the index as the index bit width of the index.

[0050] In this embodiment, the index width is calculated by exponentiation of the byte corresponding to the target buffer and the statistical value of the number of unique data points corresponding to the target buffer. The resulting exponent is the minimum value of the result of raising the index width of the byte to the power of 2, where the result is greater than or equal to the statistical value of the number of unique data points corresponding to the target buffer. The minimum value satisfying this condition is used as the index width. Specifically, the operation is as follows: Assuming that the data in the selected target buffer is stored in double-byte form, the base of the operation is 2. Assuming that the statistical value of the number of unique data points corresponding to the target buffer is 64, and assuming that the index width is represented by N, then the mathematical expression for N is 2. N ≥64, so N equals 6. Therefore, the index width of the index table is 6 bits. Assuming the statistical value of the number of unique data points corresponding to the target buffer is 253, then the mathematical expression for N is 2. N If ≥253, then N equals 8, and the index width of the index table is 8. The index width obtained by the above method is the most suitable index width for the current index table. By storing data with the obtained index width, the storage space occupied in data compression is reduced, and the data compression effect in the index table can be optimized.

[0051] S150. Compress the index table to obtain a compressed index table.

[0052] In this embodiment, the compressed index table is the table containing the data that will ultimately be stored. The index table contains unused bits. For example, if the data in the target buffer is stored in double-byte format, the index width is calculated to be 6 bits. The data in the table is represented bit by bit (i.e., binary representation), where $ represents an unused bit and the letter represents a used bit (not a specific numerical value). Therefore, the data in the table would be $$$$$$$$$AAAAAA. As can be seen, there are still unused bits. Therefore, the data is compressed and combined into new data based on the original data order in the compressed table, generating the final index table. By compressing and storing the data, the space occupied by the data is minimized, allowing direct use of the chip's internal Flash memory without the need for an external Flash chip. This reduces operation time and saves labor costs.

[0053] In one embodiment, such as Figure 5 As shown, step S150 may include steps S151-S152.

[0054] S151. Extract adjacent data from the index table to obtain used byte data, wherein the data in the index table includes used byte data and unused byte data;

[0055] S152. Recombine the data of the used bytes according to the index bit width to obtain compressed data and generate a compressed index table.

[0056] In this embodiment, adjacent data in the index table are extracted and combined into new data through operations such as shifting. For example, if the target buffer has a storage size of two bytes, the obtained index bit width is 6, and the data in the table is represented bit by bit (i.e., binary representation), where $ represents an unused bit and the letters A to Z represent used bits (not specific numerical values), then the original index table can be represented as follows: $$$$$$$$$AAA AAA, $$$$$$$$$BBBBBB, $$$$$$$$$$CCCCCC, $$$$$$$$$$$DDDDDD,

[0057] $$$$$$$$$EEEEEE、$$$$$$$$$FFFFFF......, After processing, the data is: AAAAAABBBBBBCCCC、CCDDDDDDEEEEEEFF、FFFFGGGGGGHHHHHH........ As can be seen from the above, in the compressed index table, except for the last data which may have unused bits, the bits of the other data are fully utilized. In order to improve the efficiency of restoring the data in the index table to the original data, when compressing the index table, it can be processed according to a multiple of twice the number of bytes stored in the target buffer. For example, let N represent the index bit width, and the size of the target buffer is two bytes. It is processed according to a multiple of 2, that is, a multiple of 4. When N∈(1,4], N takes the value 4, wasting 4 minus N bits; when N∈(5,8], N takes the value 8, wasting 8 minus N bits; when N∈(9 ... When N is 12, 12 minus N bits are wasted, etc. Assuming the index width is 6, taking the value 8, then each data wastes 2 bits. Therefore, the result of compressing the data in the index table: $$$$$$$$$AAAAAA, $$$$$$$$$$BBBBBB, $$$$$$$$$$CCCCCC, $$$$$$$$$$DDDDDD, $$$$$$$$$$$EEEEEE, $$$$$$$$$$FFFFFF...... is: $$AAAAAA$$BBBBBB, $$CCCCCC$$DDDDDD, $$EEEEEE$$FFFFFF....... In summary, by determining the index width and performing combination compression such as shifting according to the index width, the bits in the data storage can be fully utilized, reducing storage space. During decoding, the data in the compressed index table can also be quickly restored to the original data.

[0058] Figure 6 This is a schematic block diagram of an image compression device 200 provided in an embodiment of the present invention. Figure 6 As shown, corresponding to the above image compression method, the present invention also provides an image compression apparatus 200. This image compression apparatus 200 includes a unit for performing the above image compression method, and the apparatus can be configured in an aerosol device. Specifically, please refer to... Figure 5 The image compression device 200 includes a model taking unit 210, a transformation unit 220, a first generation unit 230, a second generation unit 240, and a compression unit 250.

[0059] Modulus unit 210 is used to perform modulus operation on the image to be compressed to obtain the original data;

[0060] The transformation unit 220 is used to transform the original data and store the transformed data in different buffers, and to count the non-repeating data in each buffer.

[0061] In one embodiment, such as Figure 7 As shown, the transformation unit 220 includes a first storage unit and a second storage unit.

[0062] The first storage unit is used to store the original data in a first buffer according to the size of the first byte, and to obtain a first statistical value of the number of non-repeating data based on the number of non-repeating data in the first buffer; the second storage unit is used to store the original data in a second buffer according to the size of the second byte, and to obtain a second statistical value of the number of non-repeating data based on the number of non-repeating data in the second buffer.

[0063] The first generation unit 230 is used to determine the buffer with the smallest non-repeating data statistical value as the target buffer, and generate a color data table based on the non-repeating data in the target buffer.

[0064] In one embodiment, such as Figure 7 As shown, the first generation unit 230 includes a first comparison unit, a target unit, and a data storage unit.

[0065] The system includes a first comparison unit for comparing the first statistical value with the second statistical value to obtain a comparison result; a target unit for using the buffer corresponding to the smaller of the comparison results as the target buffer; and a data storage unit for extracting non-repeating data from the target buffer and storing it in a color data table.

[0066] In one embodiment, such as Figure 7 As shown, the first generation unit 230 further includes a second comparison unit.

[0067] The second comparison unit is used to select the first buffer as the target buffer if the comparison result is that the first statistical value and the second statistical value are equal, wherein the first byte is smaller than the second byte.

[0068] The second generation unit 240 is used to generate an index table based on the target buffer and the color data table;

[0069] In one embodiment, such as Figure 7 As shown, the second generation unit 240 includes a comparison unit and a replacement unit.

[0070] The comparison unit is used to compare the data in the target cache with the data in the color data table; the replacement unit is used to replace the index corresponding to the data in the target cache that is equal to the data in the color data table with the index of the data in the color data table.

[0071] In one embodiment, such as Figure 7 As shown, the second generation unit 240 includes a calculation unit and a determination unit.

[0072] The arithmetic unit is used to determine the exponent of the exponentiation operation by taking the byte corresponding to the target buffer as the base and the statistical value of the number of non-repeating data corresponding to the target buffer as the result of the exponentiation operation; the determining unit is used to determine the exponent as the index bit width of the index.

[0073] Compression unit 250 is used to compress the index table to obtain a compressed index table.

[0074] In one embodiment, such as Figure 7 As shown, the compression unit 250 includes an extraction unit and a first compression unit.

[0075] The extraction unit is used to extract adjacent data from the index table to obtain used byte data, wherein the data in the index table includes used byte data and unused byte data; the first compression unit is used to recombine the used byte data according to the index bit width to obtain compressed data and generate a compressed index table.

[0076] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned image compression device 200 and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.

[0077] The aforementioned image compression device can be implemented as a computer program, which can, for example... Figure 8 It runs on the computer device shown.

[0078] Please see Figure 8 , Figure 8 This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 may be an aerosol device.

[0079] See Figure 8 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.

[0080] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform an image compression method.

[0081] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.

[0082] The internal memory 504 provides an environment for the execution of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute an image compression method.

[0083] This network interface 505 is used for network communication with other devices. Those skilled in the art will understand that... Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0084] The processor 502 is used to run a computer program 5032 stored in a memory to implement the steps of the above method.

[0085] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.

[0086] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.

[0087] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When executed by a processor, the program instructions cause the processor to perform the steps of the method described above.

[0088] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.

[0089] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0090] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.

[0091] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0092] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, 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, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.

[0093] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. An image compression method, characterized in that, include: Perform a modulo operation on the image to be compressed to obtain the original data; The original data is transformed and the transformed data is stored in different buffers. A statistical value of non-repeating data is calculated in each buffer. This includes: storing the original data in a first buffer with a first byte size, and calculating a first statistical value of the number of non-repeating data based on the number of non-repeating data in the first buffer; storing the original data in a second buffer with a second byte size, and calculating a second statistical value of the number of non-repeating data based on the number of non-repeating data in the second buffer. The buffer with the smallest non-repeating data statistical value is determined as the target buffer, and a color data table is generated based on the non-repeating data in the target buffer. Generate an index table based on the target buffer and the color data table; The index table is compressed to obtain a compressed index table.

2. The image compression method according to claim 1, characterized in that, The step of determining the buffer with the smallest non-repeating data statistical value as the target buffer, and generating a color data table based on the non-repeating data in the target buffer, includes: The comparison results are obtained by comparing the first statistical value with the second statistical value; The buffer corresponding to the smaller of the comparison results shall be selected as the target buffer; Extract the non-repeating data from the target buffer and store it in the color data table.

3. The image compression method according to claim 2, characterized in that, The step of selecting the buffer corresponding to the smaller of the comparison results as the target buffer includes: If the comparison result is that the first statistical value and the second statistical value are equal, the first buffer is used as the target buffer, wherein the first byte is smaller than the second byte.

4. The image compression method according to claim 1, characterized in that, The step of generating an index table based on the target buffer and the color data table includes: Compare the data in the target cache with the data in the color data table; Replace the data in the target cache that is equal to the data in the color data table with the index of the corresponding data in the color data table.

5. The image compression method according to claim 4, characterized in that, The step of generating an index table based on the target buffer and the color data table includes: The exponent of the exponentiation operation is determined by using the bytes corresponding to the target buffer as the base and the statistical value of the number of non-repeating data corresponding to the target buffer as the result of the exponentiation operation. The index is determined as the index bit width of the index.

6. The image compression method according to claim 1, characterized in that, The step of compressing the index table to obtain a compressed index table includes: The adjacent data in the index table are extracted to obtain the used byte data, wherein the data in the index table includes used byte data and unused byte data; Based on the index bit width, the data of the used bytes are recombined to obtain compressed data and generate a compressed index table.

7. An image compression device, characterized in that, include: The modulus extraction unit is used to perform modulus extraction on the image to be compressed to obtain the original data. A transformation unit is used to transform the original data and store the transformed data in different buffers, and to count the number of unique data in each buffer. This includes: storing the original data in a first buffer of size one byte, and obtaining a first statistical value for the number of unique data based on the number of unique data in the first buffer; storing the original data in a second buffer of size two bytes, and obtaining a second statistical value for the number of unique data based on the number of unique data in the second buffer. The first generation unit is used to determine the buffer with the smallest non-repeating data statistical value as the target buffer, and generate a color data table based on the non-repeating data in the target buffer. The second generation unit is used to generate an index table based on the target buffer and the color data table; A compression unit is used to compress the index table to obtain a compressed index table.

8. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-6.

9. A storage medium, characterized in that, The storage medium stores a computer program, which includes program instructions that, when executed by a processor, can implement the method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method and equipment for compressing and decompressing image

    CN101616320A

  • Picture compression method and device based on serial port screen, storage medium and computer equipment

    CN114418833A