[go: up one dir, main page]

CN116309889A - Picture compression method, device, computer equipment and storage medium - Google Patents

Picture compression method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116309889A
CN116309889A CN202211643643.9A CN202211643643A CN116309889A CN 116309889 A CN116309889 A CN 116309889A CN 202211643643 A CN202211643643 A CN 202211643643A CN 116309889 A CN116309889 A CN 116309889A
Authority
CN
China
Prior art keywords
data
target buffer
index
index table
buffer area
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211643643.9A
Other languages
Chinese (zh)
Inventor
田亚雷
龚文博
周勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Woody Vapes Technology Co Ltd
Original Assignee
Shenzhen Woody Vapes Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Woody Vapes Technology Co Ltd filed Critical Shenzhen Woody Vapes Technology Co Ltd
Priority to CN202211643643.9A priority Critical patent/CN116309889A/en
Publication of CN116309889A publication Critical patent/CN116309889A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The embodiment of the invention discloses a method and a device for compressing pictures, computer equipment and a storage medium. The method comprises the following steps: performing modular operation on the picture to be compressed to obtain original data; transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area; determining the buffer zone with the minimum non-repeated data statistic value as a target buffer zone, and generating a color data table according to the non-repeated data in the target buffer zone; 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. By implementing the method provided by the embodiment of the invention, the effect of lossless compression of the picture while occupying small space during compression can be realized.

Description

Picture compression method, device, computer equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a lossless compression method and apparatus for a picture, a computer device, and a storage medium.
Background
With the development of economy and technology, many embedded systems are provided with display screens, and a large amount of picture information needs to be displayed every day. These pictures often need to be stored in a memory chip, which is usually stored in an original (uncompressed) manner, and occupies a large amount of memory chip space of the chip, and even requires the use of an additional memory chip, which increases the volume and cost of the system. Therefore, the pictures are stored by using the compression decoding algorithm to reduce the occupied memory chip space. However, the existing algorithm needs to consume a large amount of RAM when decoding, if the RAM of the tiny embedded system is insufficient to support the decoding consumption of the algorithm, there may be a loss of data, a certain defect may exist when the data is displayed on the display screen, or a certain loss of compressed data exists.
Disclosure of Invention
The embodiment of the invention provides a picture compression method, a device, computer equipment and a storage medium, which aim to solve the problems that pictures occupy a large amount of storage space without compression, are inconvenient to compress and even have data loss during compression.
In a first aspect, an embodiment of the present invention provides a lossless compression method for a picture, including: performing modular operation on the picture to be compressed to obtain original data; transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area; determining the buffer zone with the minimum non-repeated data statistic value as a target buffer zone, and generating a color data table according to the non-repeated data in the target buffer zone; 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.
In a second aspect, an embodiment of the present invention further provides a lossless compression apparatus for a picture, including: the module taking unit is used for carrying out module taking operation on the picture to be compressed to obtain original data; the transformation unit is used for transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area; the first generation unit is used for determining the buffer zone with the smallest non-repeated data statistic value as a target buffer zone and generating a color data table according to the non-repeated data in the target buffer zone; a second generating unit, configured to generate an index table according to the target buffer area and the color data table; and the compression unit is used for compressing the index table to obtain a compressed index table.
In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the method when executing the computer program.
In a fourth aspect, embodiments of the present invention also provide a computer readable storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the above-described method.
The embodiment of the invention provides a lossless compression method and device for pictures, computer equipment and a storage medium. Wherein the method comprises the following steps: performing modular operation on the picture to be compressed to obtain original data; transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area; determining the buffer zone with the minimum non-repeated data statistic value as a target buffer zone, and generating a color data table according to the non-repeated data in the target buffer zone; 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. According to the embodiment of the invention, as the original data is obtained according to the picture, the original data is converted according to the byte size and the index is changed to be compressed data which is stored in the index table, the compression cost can be reduced, the compression space can be reduced, the storage space can be saved, and meanwhile, the data loss can not be caused, so that the lossless compression effect of the picture can be achieved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a picture compression method according to an embodiment of the present invention;
fig. 2 is a schematic sub-flowchart of a picture compression method according to an embodiment of the present invention;
fig. 3 is a schematic sub-flowchart of a picture compression method according to an embodiment of the present invention;
fig. 4 is a schematic sub-flowchart of a picture compression method according to an embodiment of the present invention;
fig. 5 is a schematic sub-flowchart of a picture compression method according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of a picture compression apparatus according to an embodiment of the present invention;
fig. 7 is a schematic block diagram of specific units of a picture compression apparatus according to an embodiment of the present invention; and
fig. 8 is a schematic block diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of 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 as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1, fig. 1 is a schematic flowchart of a picture compression method according to an embodiment of the present invention. The image compression method in the embodiment can be applied to an aerosol device, and the aerosol device is provided with a display screen, so that various images need to be displayed on the display screen. However, the RAM in an aerosol device may not be sufficient to support the large amount of RAM expended in decoding existing algorithms; if there is a loss of data, there will be some defect when displayed on the display screen. Therefore, the picture compression method can reduce the cost of equipment without using an external memory chip; the space of the equipment is reduced, the storage space of the main control chip is saved, and the expansion of the program is facilitated.
Fig. 1 is a flow chart of a picture compression method according to an embodiment of the present invention. As shown, the method includes the following steps S110-S150.
S110, performing modular operation on a picture to be compressed to obtain original data;
in this embodiment, the picture to be compressed is a picture to be displayed in the aerosol device, the picture is generally stored by converting the picture into machine-recognizable data through modulo software, and the commonly used modulo software includes Image2lcd, ACDSee, OLED and the like, and can perform modulo operation to convert the picture into target data according to rules. The RGB565 format original data is obtained through the modulo arithmetic, so that the cost is reduced, the data quantity transmitted by the singlechip is reduced, and the common use scene is satisfied.
S120, transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area;
in this embodiment, the non-duplication data statistics value is a value of the number of non-duplication data in the buffer, where the original data may be transformed according to a byte size, specifically, may be transformed according to a single byte, a double byte, and four bytes, for example, the data rgb (105,105,105) is transformed into 01101001 according to a double byte size, and the original data may be transformed into data that is convenient for statistics and comparison by compressing the data according to a byte size, so that the content that needs to be processed during compression is reduced, and the non-duplication data statistics value in each buffer is counted, so that the duplication condition of the transformed data is convenient to be accurately known.
In one embodiment, as shown in FIG. 2, the step S120 may include steps S121-S122.
S121, storing original data in a first buffer area according to a first byte size, and counting according to the number of unrepeated data in the first buffer area to obtain a first statistic value of the number of unrepeated data;
s122, storing the original data in a second buffer area according to the second byte size, and counting according to the number of the non-repeated data in the second buffer area to obtain a second statistical value of the number of the non-repeated data.
In this embodiment, the first byte size is a double-byte size, the first buffer is a buffer for storing data transformed according to the double-byte size, the second byte size is a four-byte size, the second buffer is a buffer for storing data transformed according to the double-byte size, the order of the original data cannot be disturbed in transforming the original data according to the byte size, the order of the data in the buffer should be consistent with the order of the original data, and after the original data is compressed according to the byte size according to the order and the number of unrepeated values is counted, the data can be effectively compressed while the order of the original data is not disturbed, so as to avoid the problems of picture quality damage and the like in the decoding process.
S130, determining the buffer area with the smallest non-repeated data statistic value as a target buffer area, and generating a color data table according to non-repeated data in the target buffer area;
in this embodiment, the buffer area where the data to be processed in the subsequent process is located is the target buffer area, and the buffer area with the smallest non-repeated data statistics value has more repeated data than the buffer area with the high non-repeated data statistics value.
In one embodiment, as shown in FIG. 3, the step S130 may include steps S131-S133.
S131, comparing the first statistical value with the second statistical value to obtain a comparison result;
s132, taking the smaller buffer area in the buffer area corresponding to the smaller comparison result as a target buffer area;
s133, extracting non-repeated data in the target buffer area and storing the non-repeated data in a color data table.
In this embodiment, comparing the first statistic value with the second statistic value, selecting a buffer area corresponding to a smaller statistic value as the target buffer area, and taking the size of a storage byte of the target buffer area as a storage byte required in a subsequent compression process, by selecting a buffer area corresponding to a smaller statistic value as the target buffer area, the generated color data table occupies less space, and more repeated data is convenient for unified processing in a picture compression process, so as to reduce operation steps of the picture compression process, and in one embodiment, as shown in fig. 3, the step S130 further includes a step S134.
And S134, if the comparison result is that the first statistical value is equal to the second statistical value, the first buffer area is used as a target buffer area, wherein the first byte is smaller than the second byte.
In this embodiment, when comparing the first statistic value with the second statistic value, if the comparison result is equal, the buffer area where the first byte is located should be selected as the target buffer area, because the first byte is specified as double bytes, the second byte is specified as four bytes, each data occupies 16 bits when the double bytes are stored, each data occupies 32 bits when the four bytes are stored, in order to save equipment cost, reduce occupied storage space, and facilitate compression processing, so that the buffer area where the data is stored in double bytes is used as the target buffer area when the comparison result is the same.
S140, generating an index table according to the target buffer area and the color data table;
in this embodiment, the index bit width is determined by the size of the stored bytes in the target buffer and the statistic value of the target buffer, specifically, assuming that the index bit width is obtained as 6, when the stored bytes are selected to be double bytes, the data in the index table is represented by bits (bit) (i.e., binary representation), $represents unused bits, and letters represent used bits, which do not represent specific numerical values: after the data in the target buffer area is stored in the index table according to the obtained index bit width, the data in the index table is compared with the data in the color data table, and the data in the color data table is extracted from the target buffer area, so that the data in the index table are the data in the target buffer area, the same data are always present in the two tables, the indexes of the same data in the color data table are replaced in the index table, and the indexes of the same data are uniformly processed by replacing the indexes of the repeated data in the index table, so that the effect of small occupied space is achieved, the cost of equipment is saved, and the time consumption in the subsequent compression and decoding processes is shorter.
In one embodiment, as shown in FIG. 4, the step S140 may include steps S141-S142.
S141, comparing the data in the target cache area with the data in the color data table;
s142, replacing the data which are equal to the data in the color data table in the target cache area with the index of the corresponding data in the color data table.
In this embodiment, the data in the color data table is also present in the target buffer, by comparing the data of both sides, the same 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 (letter represents data, number represents index, and thus letters and numbers do not represent specific values because of the main example analysis) is A, B, C, the indexes of the data are 1, 2, and 3, the data in the target buffer is A, B, C, C, the data in the replaced target buffer is 1, 2, 3, and 3, so the data in the index table is 1, 2, 3, and by replacing the data after comparison, the data in the index table is unified, so that non-repeated data is reduced, compression is facilitated, time in the subsequent compression and decoding processes is reduced, and the cost of equipment is saved.
In one embodiment, as shown in FIG. 4, the step S140 may include steps S143-S144.
S143, taking the byte size corresponding to the target buffer as a base number, taking the statistical value of the number of non-repeated data corresponding to the target buffer as a result of power operation, and determining an exponent of the power operation;
s144, determining the index as the index bit width of the index.
In this embodiment, exponentiation is performed according to the statistics of the bytes corresponding to the target buffer and the numbers of non-repeated data corresponding to the target buffer, where the obtained exponent is an index bit width, the exponent is a minimum value of the statistics of the numbers of non-repeated data corresponding to the target buffer, where the result of satisfying the index bit width power of the bytes is greater than and equal to the minimum value of the statistics of the numbers of non-repeated data corresponding to the target buffer, and by obtaining the minimum value satisfying the condition as the index bit width, the specific operation may be as follows: assuming that the data in the selected target buffer is stored according to the size of double bytes, the base number is 2 during that operation, the statistical value of the number of non-repeated data corresponding to the target buffer is 64, and the calculated index bit width is represented by N, then the mathematical expression of N is 2 N More than or equal to 64, obtaining N equal to 6, wherein the index bit width of the index table is 6, and assuming that the target buffer zone corresponds toThe statistical value of the number of unrepeated data is 253, then the mathematical expression of N is 2 N And (3) not less than 253, wherein N is equal to 8, the index bit width of the index table is 8, the index bit width obtained by the method is the index bit width most suitable for the current index table, and the data compression effect in the index table can be optimized by storing the data through the obtained index bit width and reducing the occupied storage space in the compressed data.
S150, compressing the index table to obtain a compressed index table.
In this embodiment, the compressed index table is a table where data to be stored is located, where there are unused bits in the index table, for example, the data in the target buffer is stored according to a double-byte size, the index bit width is obtained to be 6, the data in the table is represented by bits (i.e., binary representation), the unused bits are represented by letters, the used bits are not represented by specific values, the data in the table is $ $ $ $ $ $ $ $ AAAAAA, and as known from the above, there are still unused bits, so the data is compressed and combined into new data according to the original data sequence in the compressed table, and the new data is generated. By compressing and storing the data, the space occupied by the data can be reduced to the minimum, flash inside the chip can be directly used, an additional plug-in Flash chip is not needed, the operation time is shorter, and the labor cost is saved.
In one embodiment, as shown in FIG. 5, the step S150 may include steps S151-S152.
S151, extracting adjacent data in the index table to obtain used byte bit data, wherein the data in the index table comprises the used byte bit data and unused byte bit data;
s152, recombining the used data of the byte bits according to the index bit width to obtain compressed data to generate a compressed index table.
In this embodiment, adjacent data in the index table is extracted and combined into new data through operations such as shifting, for example, the storage byte size of the target buffer is double bytes, the obtained index bit width is 6, the data in the table is represented in bits (bit) (i.e. binary representation), the $ indicates unused bits, the letters a-Z indicate used bits, do not represent specific values, the original index table may be such that it represents the AAA, BBBBBBBBBB, CCCCC, DDDDDD, BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBtape, BBBBand BBand BBBBBBand BBthat it is a kind of material, and the CCCCC, the DDDD, the BBBBBBBB material and the material
The data after processing are: AAAAAA BBBBBBCCCC, CCDDDDDDEEEEEEFF, ffffgghhhh are considered to be fully utilized in the compressed index table except for the last data which may have unused bits, and when the index table is compressed, the data can be processed according to a multiple of the two-time storage bytes of the target buffer data, for example, the storage bytes of the target buffer are two-byte size, the data can be compressed according to a multiple of 2, namely, the data can be processed according to a multiple of 4, when the N e (1, 4) is used, the N is used as a value of 8, when the N e (5, 8) is used, the N is used as a value of 12, and so on, and when the N e (9, 12) is used, the index is used as a value of 6, for example, the data can be compressed according to a multiple of 2, the data can be stored in the index table, and the data can be fully decoded according to a multiple of 4, and when the data can be compressed according to a single-time, the data can be stored in the data, and the data can be fully decoded according to a single-time, the data can be stored in the data, and the data can be stored in the data can be fully decoded according to a data buffer, and the data can be stored in the data buffer, and the data can be reduced according to the data.
Fig. 6 is a schematic block diagram of a picture compression apparatus 200 according to an embodiment of the present invention. As shown in fig. 6, the present invention further provides a picture compression apparatus 200 corresponding to the above picture compression method. The picture compression apparatus 200 includes means for performing the picture compression method described above, which may be configured in an aerosol apparatus. Specifically, referring to fig. 5, the picture compression apparatus 200 includes a modulus unit 210, a transformation unit 220, a first generation unit 230, a second generation unit 240, and a compression unit 250.
The modulus taking unit 210 is configured to perform modulus taking operation on the picture to be compressed to obtain original data;
a transforming unit 220, configured to transform the original data and store the transformed data in different buffers, and count non-duplicate data statistics values in each buffer;
in one embodiment, as shown in fig. 7, the conversion unit 220 includes a first storage unit and a second storage unit.
The first storage unit is used for storing the original data in a first buffer area according to the first byte size, and counting according to the number of the unrepeated data in the first buffer area to obtain a first statistic value of the number of the unrepeated data; and the second storage unit is used for storing the original data in a second buffer area according to the second byte size, and counting according to the number of the non-repeated data in the second buffer area to obtain a second statistical value of the number of the non-repeated data.
A first generating unit 230, configured to determine the buffer with the smallest non-repeated data statistics value as a target buffer, and generate a color data table according to non-repeated data in the target buffer;
in one embodiment, as shown in fig. 7, the first generating unit 230 includes a first comparing unit, a target unit, and a data storing unit.
The first comparison unit is used for comparing the first statistical value with the second statistical value to obtain a comparison result; the target unit is used for taking the buffer area corresponding to the smaller one of the comparison results as a target buffer area; and the data storage unit is used for extracting the non-repeated data in the target buffer area and storing the non-repeated data in the color data table.
In an embodiment, as shown in fig. 7, the first generating unit 230 further includes a second comparing unit.
And the second comparing unit is used for taking the first buffer area as a target buffer area if the comparison result is that the first statistical value is equal to the second statistical value, wherein the first byte is smaller than the second byte.
A second generating unit 240 for generating an index table according to the target buffer and the color data table;
in one embodiment, as shown in fig. 7, the second generating unit 240 includes a comparing unit and a replacing unit.
The comparison unit is used for comparing the data in the target cache area with the data in the color data table; and the replacing unit is used for replacing the index corresponding to the data which is equal to the data in the color data table in the target cache area with the index of the data in the color data table.
In an embodiment, as shown in fig. 7, the second generating unit 240 includes an operation unit and a determining unit.
The operation unit is used for determining an exponent of the power operation by taking bytes corresponding to the target buffer as a base number and taking a statistical value of a non-repeated data number corresponding to the target buffer as a result of the power operation; and the determining unit is used for determining the index as the index bit width of the index.
And a compression unit 250, configured to compress the index table to obtain a compressed index table.
In one embodiment, as shown in fig. 7, the compression unit 250 includes an extraction unit and a first compression unit.
The extraction unit is used for extracting adjacent data in the index table to obtain used byte bit data, wherein the data in the index table comprises the used byte bit data and unused byte bit data; and the first compression unit is used for recombining the used data of the byte bits according to the index bit width to obtain compressed data so as to generate a compressed index table.
It should be noted that, as a person skilled in the art can clearly understand, the specific implementation process of the above-mentioned picture compression apparatus 200 and each unit may refer to the corresponding description in the foregoing method embodiment, and for convenience and brevity of description, the description is omitted here.
The picture compression apparatus described above may be implemented in the form of a computer program which is executable on a computer device as shown in fig. 8.
Referring to fig. 8, fig. 8 is a schematic block diagram of a computer device according to an embodiment of the present application. The computer device 500 may be an aerosol apparatus.
With reference to FIG. 8, the computer device 500 includes a processor 502, memory, and a network interface 505 connected by a system bus 501, where the memory may include a non-volatile storage medium 503 and an internal memory 504.
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 a picture compression method.
The processor 502 is used to provide computing and control capabilities to support the operation of the overall computer device 500.
The internal memory 504 provides an environment for the execution of a computer program 5032 in the non-volatile storage medium 503, which computer program 5032, when executed by the processor 502, causes the processor 502 to perform a picture compression method.
The network interface 505 is used for network communication with other devices. Those skilled in the art will appreciate that the architecture shown in fig. 8 is merely a block diagram of a portion of the architecture in connection with the present application and is not intended to limit the computer device 500 to which the present application is applied, and that a particular computer device 500 may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
Wherein the processor 502 is adapted to run a computer program 5032 stored in a memory for implementing the steps of the above method.
It should be appreciated that in embodiments of the present application, the processor 502 may be a Central processing unit (Central ProcessingUnit, CPU), and the processor 502 may also be other general purpose processors, digital signal processors (DigitalSignalProcessor, DSP), application specific integrated circuits (ApplicationSpecificIntegrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-ProgrammableGateArray, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Those skilled in the art will appreciate that all or part of the flow in a method embodying the above described embodiments may be accomplished by computer programs instructing the relevant hardware. The computer program comprises program instructions, and the computer program 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 flow steps of the embodiments of the method described above.
Accordingly, the present invention also provides a storage medium. The storage medium may be a computer readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. The program instructions, when executed by a processor, cause the processor to perform the steps of the method as described above.
The storage medium may be a U-disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk, or other various computer-readable storage media that may store program codes.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only one logic function division, and there may be another division manner in actual implementation. For example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed.
The steps in the method of the embodiment of the invention can be sequentially adjusted, combined and deleted according to actual needs. The units in the device of the embodiment of the invention can be combined, divided and deleted according to actual needs. In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The integrated unit may be stored in a storage medium if implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present invention is essentially or a part contributing to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a terminal, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (10)

1. A picture compression method, comprising:
performing modular operation on the picture to be compressed to obtain original data;
transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area;
determining the buffer zone with the minimum non-repeated data statistic value as a target buffer zone, and generating a color data table according to the non-repeated data in the target buffer zone;
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.
2. The picture compression method according to claim 1, wherein the steps of transforming the original data and storing the transformed data in different buffers, and counting non-duplicate data statistics in each of the buffers, include:
storing original data in a first buffer area according to a first byte size, and counting according to the number of unrepeated data in the first buffer area to obtain a first statistic value of the number of unrepeated data;
and storing the original data in a second buffer area according to the second byte size, and counting according to the number of the non-repeated data in the second buffer area to obtain a second statistical value of the number of the non-repeated data.
3. The picture compression method according to claim 2, wherein the step of determining the buffer with the smallest non-repeated data statistic as a target buffer and generating a color data table according to non-repeated data in the target buffer comprises:
comparing the first statistical value with the second statistical value to obtain a comparison result;
taking the smaller buffer zone in the buffer zone corresponding to the comparison result as a target buffer zone;
and extracting non-repeated data in the target buffer area and storing the non-repeated data in a color data table.
4. A picture compression method according to claim 3, wherein the step of using the smaller one of the comparison results as the target buffer in the buffer corresponding to the smaller one of the comparison results comprises:
and if the comparison result is that the first statistic value is equal to the second statistic value, the first buffer area is used as a target buffer area, wherein the first byte is smaller than the second byte.
5. The picture compression method according to claim 1, wherein the step of generating an index table from the target buffer and the color data table comprises:
comparing the data in the target cache region with the data in the color data table;
and replacing the data in the target cache region, which are equal to the data in the color data table, with the index of the corresponding data in the color data table.
6. The picture compression method according to claim 5, wherein the step of generating an index table from the target buffer and the color data table comprises:
taking bytes corresponding to the target buffer as a base number, taking a statistical value of a number of non-repeated data corresponding to the target buffer as a result of power operation, and determining an exponent of the power operation;
and determining the index as the index bit width of the index.
7. The picture compression method according to claim 1, wherein the step of compressing the index table to obtain a compressed index table comprises:
extracting adjacent data in the index table to obtain used byte bit data, wherein the data in the index table comprises the used byte bit data and unused byte bit data;
and recombining the used data of the byte bits according to the index bit width to obtain compressed data to generate a compressed index table.
8. A picture compression apparatus, comprising:
the module taking unit is used for carrying out module taking operation on the picture to be compressed to obtain original data;
the transformation unit is used for transforming the original data, storing the transformed data in different buffer areas, and counting the non-repeated data statistic value in each buffer area;
the first generation unit is used for determining the buffer zone with the smallest non-repeated data statistic value as a target buffer zone and generating a color data table according to the non-repeated data in the target buffer zone;
a second generating unit, configured to generate an index table according to the target buffer area and the color data table;
and the compression unit is used for compressing the index table to obtain a compressed index table.
9. A computer device, characterized in that it comprises a memory on which a computer program is stored and a processor which, when executing the computer program, implements the method according to any of claims 1-7.
10. A storage medium storing a computer program comprising program instructions which, when executed by a processor, implement the method of any one of claims 1-7.
CN202211643643.9A 2022-12-20 2022-12-20 Picture compression method, device, computer equipment and storage medium Pending CN116309889A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211643643.9A CN116309889A (en) 2022-12-20 2022-12-20 Picture compression method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211643643.9A CN116309889A (en) 2022-12-20 2022-12-20 Picture compression method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116309889A true CN116309889A (en) 2023-06-23

Family

ID=86822854

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211643643.9A Pending CN116309889A (en) 2022-12-20 2022-12-20 Picture compression method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116309889A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4506896A1 (en) * 2023-08-08 2025-02-12 Shenzhen Woody Vapes Technology Co., Ltd. Multi-level compression method for picture data, computer device, and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4506896A1 (en) * 2023-08-08 2025-02-12 Shenzhen Woody Vapes Technology Co., Ltd. Multi-level compression method for picture data, computer device, and storage medium

Similar Documents

Publication Publication Date Title
US6587057B2 (en) High performance memory efficient variable-length coding decoder
US11817885B2 (en) Guaranteed data compression
US8090027B2 (en) Data compression using an arbitrary-sized dictionary
US6931159B2 (en) Size reduction method and device for compressed images
CN109075798B (en) Variable size symbol entropy-based data compression
TW200822579A (en) Data-modifying run length encoder to avoid data expansion
US7554464B1 (en) Method and system for processing data having a pattern of repeating bits
TWI244052B (en) Window idle frame memory compression
JP2002261623A (en) Decoding device, decoding method, storage medium, and program software
US8682091B2 (en) Real-time image compression
EP3295568B1 (en) Improved compressed caching in a virtual memory system
US6094151A (en) Apparatus and method for finite state machine coding of information selecting most probable state subintervals
KR20180060990A (en) Method and apparatus for vertex attribute compression and decompression in hardware
CN116309889A (en) Picture compression method, device, computer equipment and storage medium
JP4189443B2 (en) Graphics image compression and decompression method
CN108122189A (en) Vertex attribute compression and decompression in hardware
JP2006093958A (en) Progressive JPEG decoding system
US6737993B2 (en) Method and apparatus for run-length encoding data values
CN112449191B (en) Method for compressing multiple images, method and device for decompressing images
US8817875B2 (en) Methods and systems to encode and decode sequences of images
US7733249B2 (en) Method and system of compressing and decompressing data
JPH10341166A (en) Data compression method adaptive to data quantity
US7609895B2 (en) Methods and apparatus for performing MQ-decoding operations
CN114928747B (en) Context probability processing circuit and method based on AV1 entropy coding and related device
US6608940B1 (en) Lossless image compression

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination