WO2020025006A1 - 数据压缩、解压方法及相关装置、电子设备、系统 - Google Patents
数据压缩、解压方法及相关装置、电子设备、系统 Download PDFInfo
- Publication number
- WO2020025006A1 WO2020025006A1 PCT/CN2019/098758 CN2019098758W WO2020025006A1 WO 2020025006 A1 WO2020025006 A1 WO 2020025006A1 CN 2019098758 W CN2019098758 W CN 2019098758W WO 2020025006 A1 WO2020025006 A1 WO 2020025006A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data block
- compressed
- data
- decompression
- compression
- 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.)
- Ceased
Links
Images
Classifications
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/3059—Digital compression and data reduction techniques where the original information is represented by a subset or similar information, e.g. lossy compression
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/40—Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/55—Compression Theory, e.g. compression of random number, repeated compression
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/60—General implementation details not specific to a particular type of compression
- H03M7/6005—Decoder aspects
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/60—General implementation details not specific to a particular type of compression
- H03M7/6011—Encoder aspects
-
- H—ELECTRICITY
- H03—ELECTRONIC CIRCUITRY
- H03M—CODING; DECODING; CODE CONVERSION IN GENERAL
- H03M7/00—Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
- H03M7/30—Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
- H03M7/60—General implementation details not specific to a particular type of compression
- H03M7/6017—Methods or arrangements to increase the throughput
- H03M7/6023—Parallelization
Definitions
- the present invention relates to the technical field of data compression, and in particular, to a data compression and decompression method and related devices, electronic equipment, and systems.
- FIG. 1 A schematic diagram of the decompression principle of the multi-decompression engine in the prior art shown in FIG. 1.
- the file to be compressed is divided into a plurality of original data blocks of equal length, and the plurality of original data blocks are separately compressed to generate compressed data corresponding to each original data block.
- the technical problem to be solved by the embodiments of the present invention is to provide a data compression method, a data decompression method, and related devices, electronic equipment, and systems.
- a standardized compressed data block is generated so that each decompression engine can When decompressing the multiple compressed data blocks, the data can be decompressed simultaneously to improve the decompression efficiency of the data.
- an embodiment of the present invention provides a data compression method that can be applied to a first electronic device or a compression device, and is used to compress raw data into one or more specifications of length L2 for a decompression device to decompress in parallel.
- the compressed data block wherein the decompression device includes multiple decompression engines, and each decompression engine is capable of decompressing one of the specification compressed data blocks within one processing cycle, and the L2 is an integer greater than 1, and the method includes: executing once Or multiple times of original data block compression, where the original data block compression includes processing the original data block based on a compression algorithm to obtain a canonical compressed data block corresponding to the original data block, where the original data block includes the original data and includes The data.
- the data compression method according to the embodiment of the present invention can be compressed into a canonical compression data block having a fixed value, so that each decompression engine can simultaneously decompress when decompressing the plurality of canonical compression data blocks, thereby improving the decompression efficiency of the data.
- an implementation in which the first electronic device or the compression device processes the original data block based on a compression algorithm to obtain a canonical compressed data block corresponding to the original data block may include: the decompression device performs the original data block operation.
- the data block is independently compressed by a compression algorithm to obtain a compressed data block corresponding to the original data block, and the length d of the compressed data block is not greater than the L2; further, additional data of length L2-d is added after the compressed data block
- a canonical compressed data block of length L2 is generated, and d is an integer greater than 0.
- the compression device or the processor of the first electronic device independently compresses each of the S original data blocks in the original data by a compression algorithm to obtain the
- the S original data blocks correspond to one S compressed data blocks, each of the S original data blocks is a plurality of consecutive data in the original data, and the length of the plurality of consecutive data is not greater than L1, the length d of each compressed data block in the S compressed data blocks is not greater than L2, and S is a positive integer; further, after each compressed data block in the S compressed data blocks, a length of L2-d is added Additional data to generate S canonical compressed data blocks of length L2, where the canonical data block of length L2 is a data block that can be processed by a single decompression engine in a decompression device, and L1 and L2 are An integer greater than 1, d is an integer greater than 0, and L1 is greater than the L2.
- the execution body of the data compression method may be a first electronic device or a compression device. The following describes
- the length of the S standardized compressed data blocks generated is a fixed value L2
- the length of the original data block that generates the standardized compressed data block is not greater than L1, which regulates the generation of raw data compression
- the length of the compressed data block, and each canonical compression data block is independently compressed, and can be independently decompressed, so that each decompression engine can decompress simultaneously when decompressing the multiple canonical compression data blocks, which can be completed in one processing cycle.
- there is no need to wait for the output of the decompression engine that is the slowest to decompress thereby solving the "short board" problem in Cannkin Law and improving the decompression efficiency of the data.
- the present application is set to a standard compressed data block of fixed length L2.
- the compression end does not need to record the length of each compressed data block, and the decompression end does not need to record the acquired data length. Makes the design of the decompression side simpler.
- the number of original data blocks divided by the original data is equal to the number of decompression engines, that is, the number of decompression engines limits the granularity that the original data can divide, so that multiple compressions formed by the original data compression
- the length of the data block is large.
- the compressed data block where the data at the random address is located needs to be decompressed.
- the compressed data block can only be decompressed by a decompression engine, and the double-speed decompression of the compressed data cannot be achieved.
- the granularity of the original data can be divided regardless of the number of decompression engines.
- the original data can be compressed into a large number of smaller canonical compressed data blocks, and there is no correlation between the canonical compressed data blocks.
- multiple consecutive canonical compressed data blocks where the random address data is located are input into multiple decompression engines for decompression, which can achieve double-speed decompression of compressed data at random addresses.
- the first original data block is any one of the S original data blocks, and when the length of the first original data block is equal to L1, the first original data block is The additional data in the compressed standardized data block is a legal codeword or the additional data includes an invalid flag and invalid data.
- the additional data includes an invalid flag and invalid data.
- the invalid flag is used to indicate that the additional data where the invalid flag is located needs to be discarded; the invalid data may include data of 0 bits or more after the invalid flag.
- the additional data in the canonical compressed data block obtained by compressing the first original data block includes an invalid flag and invalid data.
- the invalid flag is used to indicate that the additional data where the invalid flag is located needs to be discarded; the invalid data may include data of 0 bits or more after the invalid flag.
- the compression device independently compresses the original data block by using a compression algorithm to obtain a compressed data block corresponding to the original data block.
- An implementation manner may include the following steps: S1, obtaining from the original data A data group to be compressed, the data group includes one or more bits of data; S2, determine whether the data group to be compressed needs to be compressed, if compression is required, execute S3, otherwise execute S4; S3, compress the The group of data blocks to be compressed is executed after the compression is completed; S4.
- the compression device independently compresses the original data block by using a compression algorithm to obtain a compressed data block corresponding to the original data block.
- Another implementation manner may be: the compression device converts the length of the original data to L1 The data block is compressed with the data group as the step size to obtain a temporary compressed data block; when the length of the temporary compressed data block is greater than L2, the data obtained by removing the i data group at the tail from the data block of length L1 The block is used as the original data block, and the data obtained by compressing the original data block is used as the compressed data block, wherein the length of the compressed data block is not greater than the L2, i is a positive integer, and i ⁇ L1; When the length of the block is not greater than L2, the data block of length L1 is the original data block, and the temporary compressed data block is the compressed data block.
- the above method gives another specific implementation, and has the advantages of simple implementation and high compression efficiency.
- i is the smallest positive integer such that the compressed data block is not larger than the L2.
- a smaller i indicates more compressed data, which can increase compression efficiency.
- L1 is the exit bit width of a single decompression engine
- L2 is the entry bit width of a single decompression engine.
- an embodiment of the present application further provides a compression device, including: compressing the original data into one or more canonical compressed data blocks of length L2 for the decompression device to decompress in parallel, wherein the decompression device Including multiple decompression engines, each of which can decompress one of the canonical compression data blocks within a processing cycle, the L2 is an integer greater than 1, including: a processing module, which is used to The data block is processed to obtain the canonical compressed data block corresponding to the original data block, wherein the original data block is data included in the original data.
- the processing module includes:
- a compression unit configured to independently compress the original data block by using a compression algorithm to obtain a compressed data block corresponding to the original data block, and the length d of the compressed data block is not greater than the L2;
- a specification unit is configured to add additional data having a length of L2-d after the compressed data block, thereby generating the normalized compressed data block having a length of L2, where d is an integer greater than 0.
- the original data block includes a plurality of consecutive data in the original data, and a length of the original data block is not greater than L1, where L1 is an exit bit width of the decompression engine.
- the processing module may include:
- the compression unit is configured to independently compress each of the S original data blocks in the original data through a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks one by one.
- Each of the S original data blocks is a continuous multiple data in the original data, and the length of the continuous multiple data is not greater than L1, and each of the S compressed data blocks is compressed data.
- the length d of the block is not greater than L2, and S is a positive integer;
- a specification unit configured to add additional data of length L2-d after each of the S compressed data blocks to generate S standardized compressed data blocks of length L2, where the length is L2
- the canonical data block is a data block that can be decompressed by a single decompression engine in a decompression device.
- the L1 and L2 are integers greater than 1, the d is an integer greater than 0, and the L1 is greater than The L2.
- the additional data in the canonical data block obtained by compressing the original data block is a legal codeword; or the additional data includes an invalid flag and invalid data, where , An invalid flag is used to indicate that the additional data needs to be discarded; or,
- the additional data includes an invalid flag and invalid data, where the invalid flag is used to indicate that the additional data needs to be discarded.
- the compression unit specifically includes the following steps:
- determining whether the data group to be compressed needs to be compressed includes: if the sum of the total length x of one or more data groups that have been compressed and the length ⁇ x of the data group to be compressed is not greater than If L1 is described and the length of the compressed data block generated after the data group to be compressed is not greater than L2, it is determined that compression is required; if the sum of x and ⁇ x is not greater than L1 and After the compressed data group is compressed and the length of the compressed data block is greater than L2, it is determined that no compression is needed; if the sum of the x and the ⁇ x is greater than the L1, it is determined that no compression is needed.
- the compression unit specifically includes the following steps:
- a data block obtained by removing the i data groups at the tail of the data block of length L1 is used as the original data block, and the original data block is compressed
- the obtained data is used as the compressed data block, wherein the length of the compressed data block is not greater than the L2, i is a positive integer, and i ⁇ L1;
- the data block of length L1 is used as the original data block, and the temporary compressed data block is used as the compressed data block.
- i is the smallest positive integer such that the compressed data block is not larger than the L2.
- the L1 is an exit bit width of a single decompression engine; and / or the L2 is an entry bit width of a single decompression engine.
- an embodiment of the present application further provides a compression apparatus including a processor and a memory, where the memory is used to store data and program instructions, and when the processor calls the memory to store data and program instructions , So that the compression device implements any one of the data compression methods described in the first aspect.
- an embodiment of the present application further provides an electronic device having a compression function, which is specifically the first electronic device in the embodiment of the present application.
- the electronic device includes a compression device and a processing device. Aspect or the third aspect of the compression device; the processing device is configured to send the original data described above to the compression device.
- an embodiment of the present application further provides a computer storage medium, where the computer storage medium is used to store computer software instructions, and when the computer software instructions are executed by a computer, the computer is implemented as described in the first aspect Any of the data compression methods.
- an embodiment of the present application further provides a computer program, where the computer program includes computer software instructions, and when the computer software instructions are executed by a computer, the computer implements any one of the first aspect Data compression method.
- an embodiment of the present application further provides a decompression device, including: a first memory, M decompression engines, and a second memory, where the first memory is configured to store a plurality of standardized compressed data blocks (for example, N Canonical compressed data blocks), where one canonical compressed data block is a data block of length L2 generated after independent compression of the original data block, and one canonical compressed data block can be
- N standardized compressed data blocks
- M is an integer greater than 1
- M and N are positive integers
- M ⁇ N the M decompression engines are used to decompress the canonical compressed data blocks stored in the first memory in parallel
- the decompression engine is used to decompress one of the canonical compression data blocks.
- the M decompression engines include N decompression engines, and each of the N decompression engines is used to obtain the N canonical compression data blocks.
- the second memory is configured to store original data blocks, such as N original data blocks, obtained by decompressing the standardized compressed data blocks, and the standardized compressed data blocks correspond to the original data blocks in a one-to-one manner.
- the length of the original data block is not greater than L1
- the exit bit width of the decompression engine is the L1.
- multiple standardized compressed data blocks are decompressed in parallel by multiple decompression engines, so that each decompression engine can decompress in parallel when decompressing the multiple standardized compressed data blocks, thereby improving data decompression efficiency.
- the present application is set to a standard compressed data block of fixed length L2. The compression end does not need to record the length of each compressed data block, and the decompression end does not need to record the acquired data length. Makes the design of the decompression side simpler.
- the number of original data blocks divided by the original data is equal to the number of decompression engines, that is, the number of decompression engines limits the granularity that the original data can divide, so that multiple compressions formed by the original data compression
- the length of the data block is large.
- the compressed data block where the data at the random address is located needs to be decompressed.
- the compressed data block can only be decompressed by a decompression engine, and the double-speed decompression of the compressed data cannot be achieved.
- the granularity of the original data can be divided regardless of the number of decompression engines.
- the original data can be compressed into a large number of smaller standardized compressed data blocks.
- the data of a random address is accessed, the data of the random address is located
- Multiple consecutive standardized compressed data blocks are input into multiple decompression engines for decompression, which can achieve double-speed decompression of compressed data with random addresses.
- the decompression device further includes a splicing circuit, and the splicing circuit is configured to splice the original data blocks stored in the second storage to obtain the original data.
- the original data can be decompressed and processed to subsequent processing circuits to ensure that the data is not lost.
- the decompression device may further include a length counter for recording the length of the decompressed data.
- the splicing circuit may obtain data of a specific length for splicing according to the value in the length counter.
- each of the M decompression engines is further configured to: when the length of the decompressed original data block is equal to the L1 or when an invalid flag is identified, decompression is stopped. operating. Stop the decompression by identifying the invalid flag. Under the premise of ensuring that the correct data is obtained, the decompression operation can be saved and the power consumption can be reduced.
- the decompression device further includes a control circuit, configured to stop the first decompression engine when the length of the original data block decompressed by the first decompression engine is equal to the L1.
- the first decompression engine is any one of the M decompression engines. After determining that the required length of data (L1) is obtained, decompression is stopped. Under the premise of ensuring that the correct data is obtained, the decompression operation can be saved and the power consumption can be reduced.
- the second memory includes M storage subunits corresponding to the M decompression engines one-to-one respectively, and the first storage subunit is configured to store the first storage subunit.
- the original data block decompressed by the decompression engine corresponding to the unit, and the first storage subunit is any one of the M storage subunits.
- the decompression engine and each circuit can be implemented based on a hardware circuit (such as an FPGA or an ASIC). In this way, the processing rate can be increased, thereby increasing the decompression speed.
- an embodiment of the present application further provides an integrated circuit, including: any one of the decompression devices described in the seventh aspect.
- the integrated circuit may further include a computing device coupled to the decompression device, and the computing device is configured to perform data processing according to the original data obtained by decompression of the decompression device.
- an embodiment of the present application further provides a data decompression method, which is applied to a decompression device.
- the decompression device includes M decompression engines, and M is a positive integer.
- the method includes: the decompression device obtains N standardized compressed data blocks. Wherein, any one of the N canonical compression data blocks is a data block of length L2 generated after independent compression of the original data block, and the length is L2 canonical compression data block.
- the decompressed data blocks in one processing cycle N is a positive integer, and M ⁇ N; the N canonical compression data blocks are decompressed by N decompression engines to obtain a one-to-one correspondence with the N canonical compression data blocks.
- N original data blocks; the N original data blocks are spliced to obtain original data, wherein the L1 and the L2 are integers greater than 1, and the L1 is greater than the L2.
- N standardized compressed data blocks of length L2 are decompressed synchronously by N decompression engines respectively, so that each decompression engine can decompress simultaneously when decompressing the plurality of standardized compressed data blocks, thereby improving data decompression efficiency.
- the present application is set to a standard compressed data block of fixed length L2.
- the compression end does not need to record the length of each compressed data block, and the decompression end does not need to record the acquired data length. Makes the design of the decompression side simpler.
- the number of original data blocks divided by the original data is equal to the number of decompression engines, that is, the number of decompression engines limits the granularity that the original data can divide, so that multiple compressions formed by the original data compression
- the length of the data block is large.
- the compressed data block where the data at the random address is located needs to be decompressed.
- the compressed data block can only be decompressed by a decompression engine, and the double-speed decompression of the compressed data cannot be achieved.
- the granularity of the original data can be divided regardless of the number of decompression engines.
- the original data can be compressed into a large number of smaller standardized compressed data blocks.
- the random data Multiple consecutive standardized compressed data blocks where the data of the address resides are input into multiple decompression engines for decompression, which can achieve double-speed decompression of the compressed data of the random address.
- the N decompression engines include the decompression engine k, the N compressed data blocks include a compressed data block k, and the N original data blocks include the compressed data block k for decompression.
- the obtained original data block k where k is a positive integer, and k is not greater than N;
- the N decompression engines respectively decompress the N standardized compressed data blocks to obtain the N compressed data blocks one to one corresponding to N Raw data blocks, including:
- an embodiment of the present application further provides an electronic device with a decompression function, which may specifically be a second electronic device in the embodiment of the present application, which may include a processor, a memory coupled to the processor, and a decompression device.
- the decompression device is any one of the decompression devices according to the seventh aspect, and the processor is configured to call data and instructions stored in the memory to implement the function of the second electronic device.
- an embodiment of the present application further provides a compression and decompression system.
- the system includes a compression device as any one of the compression devices described in the second aspect or the third aspect, and the decompression device is as described in the seventh aspect. Any of the decompression devices described above.
- an embodiment of the present application further provides a compression and decompression system, including a first electronic device and a second electronic device.
- the first electronic device is an electronic device with a compression function according to the fourth aspect
- the second electronic device is an electronic device with a decompression function according to the tenth aspect.
- an embodiment of the present application further provides a data compression method, including:
- Each original data block of consecutive S original data blocks in the original data is independently compressed by a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks one to one, and the S original data blocks
- Each original data block in the block is continuous multiple data in the original data, the length of the continuous multiple data is not greater than L1, and the length d of each compressed data block in the S compressed data blocks is not Greater than L2, S is a positive integer, and the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle.
- the L1 and L2 are integers greater than 1, and the d is greater than 0.
- the above data compression method can be applied to a compression device or a third electronic device with a compression function.
- the compression device is taken as an example for illustration.
- the data compression method described in the first aspect finally obtains a standardized compressed data block with a fixed length of L2.
- the compressed data block obtained by compressing the original data block is the final compressed data block.
- the length of the compressed data block is variable. The compression device needs to record the length of each compressed data block, so that the decompression device can Differentiate compressed data blocks.
- the length of the generated S compressed data blocks is less than L2, so that each decompression engine can complete the decompression of the first compressed data block in one processing cycle. Furthermore, the synchronous decompression of each decompression engine is realized, and the decompression efficiency of the data is improved.
- the number of original data blocks divided by the original data is equal to the number of decompression engines, that is, the number of decompression engines limits the granularity that the original data can divide, so that multiple compressions formed by the original data compression
- the length of the data block is large.
- the compressed data block where the data at the random address is located needs to be decompressed.
- the compressed data block can only be decompressed by a decompression engine, and the double-speed decompression of the compressed data cannot be achieved.
- the granularity of the original data can be divided regardless of the number of decompression engines.
- the original data can be compressed into a large number of smaller compressed data blocks.
- the random address is accessed.
- Multiple consecutive standardized compressed data blocks where the data is located are input into multiple decompression engines for decompression, which can achieve double-speed decompression of compressed data with random addresses.
- the first original data block is any one of the S original data blocks
- the first compressed data block is the same as the first compressed data block and the first compressed data block.
- the compression device independently compresses the first original data block through a compression algorithm, and an implementation manner of obtaining the first compressed data block may include:
- determining whether the data group to be compressed needs to be compressed includes: if the sum of the total length x of one or more data groups that have been compressed and the length ⁇ x of the data group to be compressed is not greater than If L1 is described and the compressed data block length generated after the data group to be compressed is not greater than L2, it is determined that compression is needed; if the sum of x and ⁇ x is not greater than L1 and The compressed data block length generated after the data group to be compressed is greater than the L2, it is determined that no compression is needed; if the sum of the x and ⁇ x is greater than the L1, it is determined that no compression is needed.
- the first original data block is any one of the S original data blocks
- the first compressed data block is the same as the first compressed data block and the first compressed data block.
- the compression device independently compresses the first original data block in the original data through a compression algorithm.
- Another implementation manner to obtain the first compressed data block may be:
- the compression device compresses a data block of length L1 in the original data with a data group as a step size to obtain a temporary compressed data block;
- the data block obtained by removing the i data groups at the tail of the data block of length L1 is used as the first original data block, and the The data obtained by compressing the first original data block is used as the first compressed data block, wherein the length of the first compressed data block is not greater than the L2, i is a positive integer, and i ⁇ L1;
- the data block of length L1 is used as the first original data block, and the temporary compressed data block is used as the first compressed data block.
- i is the smallest positive integer such that the first compressed data block is not larger than the L2.
- an implementation manner in which the third electronic device or the compression device records the length of the first compressed data block may be:
- the compression device records the length d of the first compressed data block in a start field of the first compressed data block, where the start field is a field starting from the start bit of the first compressed data block and having a length of a third length threshold; or,
- the length d of the first compressed data block is written into the first file; the first file includes the respective lengths of the S compressed data blocks obtained by the second compression device sequentially compressing the original data.
- an embodiment of the present application further provides a compression device, including:
- the compression unit is configured to independently compress each of the S original data blocks in the original data through a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks one by one.
- Each of the S original data blocks is a continuous multiple data in the original data, and the length of the continuous multiple data is not greater than L1, and each of the S compressed data blocks is compressed data.
- the length d of the block is not greater than L2, S is a positive integer, and the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle.
- the L1 and the L2 are integers greater than 1, so D is an integer greater than 0, and L1 is greater than L2;
- the recording unit is configured to record a length of each compressed data block in the S compressed data blocks.
- the first original data block is any one of the S original data blocks
- the first compressed data block is the same as the first compressed data block and the first compressed data block.
- a compressed data block corresponding to the original data block, the compression unit includes:
- determining whether the data group to be compressed needs to be compressed includes: if the sum of the total length x of one or more data groups that have been compressed and the length ⁇ x of the data group to be compressed is not greater than If L1 is described and the compressed data block length generated after the data group to be compressed is not greater than L2, it is determined that compression is needed; if the sum of x and ⁇ x is not greater than L1 and The compressed data block length generated after the data group to be compressed is greater than the L2, it is determined that no compression is needed; if the sum of the x and ⁇ x is greater than the L1, it is determined that no compression is needed.
- the first original data block is any one of the S original data blocks
- the first compressed data block is the same as the first compressed data block and the first compressed data block.
- a compressed data block corresponding to an original data block, the compression unit includes:
- the data block obtained by removing the i data groups at the tail of the data block of length L1 is used as the first original data block, and the The data obtained by compressing the first original data block is used as the first compressed data block, wherein the length of the first compressed data block is not greater than the L2, i is a positive integer, and i ⁇ L1;
- the data block of length L1 is used as the first original data block, and the temporary compressed data block is used as the first compressed data block.
- i is the smallest positive integer such that the first compressed data block is not larger than the L2.
- the recording unit is specifically configured to:
- the record writes the length d of the first compressed data block into a first file; the first file includes the lengths corresponding to the first compressed data blocks obtained by the second compression device sequentially compressing the original data, respectively.
- an embodiment of the present application further provides a compression apparatus, including: a processor and a memory, where the memory is used to store data and program instructions, and the processor calls the memory to store data and program instructions , Perform the data compression method as described in the thirteenth aspect.
- an embodiment of the present application further provides an electronic device having a compression function, which may specifically be a third electronic device in the embodiment of the present application, including: as described in the fourteenth aspect or the fifteenth aspect. Any compression device.
- an embodiment of the present application further provides a computer storage medium, where the computer storage medium is used to store computer software instructions, and when the computer software instructions are executed by a computer, the computer is implemented as in the thirteenth aspect Any of the data compression methods described.
- an embodiment of the present application further provides a computer program, where the computer program includes computer software instructions, and the computer software instructions, when executed by a computer, cause the computer to implement any of the aspects described in the thirteenth aspect.
- a method of data compression is provided.
- an embodiment of the present application further provides a data decompression method, which is applied to a decompression device.
- the decompression device includes M decompression engines.
- the method includes:
- the compressed data includes N compressed data blocks and the length of each compressed data block in the N compressed data blocks, where N is a positive integer; wherein any of the N compressed data blocks is compressed data
- the blocks are independently compressed data blocks of length no greater than L2, N is a positive integer, and M ⁇ N;
- the N original data blocks are spliced to obtain original data.
- an embodiment of the present application further provides a decompression device, including a controller and M decompression engines.
- the controller includes an obtaining unit, a splitting unit, a data distribution unit, and a splicing unit, where:
- the obtaining unit is configured to obtain compressed data, where the compressed data includes N compressed data blocks and a length of each compressed data block of the N compressed data blocks, where N is a positive integer; wherein the N compressed data Any compressed data block in the data block is an independent compressed data block with a length not greater than L2, N is a positive integer, and a compressed data block with a length of L2 is a data block that can be processed by a single decompression engine in one processing cycle;
- the splitting unit is configured to split the compressed data into N compressed data blocks according to the length of each of the N compressed data blocks,
- the data distribution unit is configured to distribute the N compressed data blocks to N decompression engines of the M decompression engines, so that the N decompression engines decompress the N compressed data blocks, respectively, N original data blocks corresponding to N compressed data blocks are obtained, wherein the length of any one of the N original data blocks is not greater than L1, and L1 and L2 are integers greater than 1, The L1 is greater than the L2;
- the splicing unit is configured to splice the N original data blocks to obtain original data.
- an embodiment of the present application further provides a decompression device.
- the decompression device includes a controller, a first memory, M decompression engines, and a second memory, where:
- the controller is configured to obtain compressed data, where the compressed data includes N compressed data blocks and a length of each first compressed data block of the N compressed data blocks, and according to each of the N compressed data blocks Compressing the length of the data block, and splitting the compressed data into N compressed data blocks;
- the first memory is configured to store N compressed data blocks, wherein any one of the N compressed data blocks is an independently compressed data block having a length not greater than L2, N is a positive integer, and M ⁇ N ,
- the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle;
- Each of the N decompression engines is configured to obtain a compressed data block among the N compressed data blocks, and decompress the obtained compressed data blocks respectively to obtain the N compressed data blocks one by one.
- N original data blocks wherein the length of any one of the N original data blocks is not greater than L1, the L1 and L2 are integers greater than 1, and the L1 is greater than L2;
- the second memory is configured to store the N compressed data blocks.
- the decompression device further includes: a splicing circuit,
- the splicing circuit is configured to splice the N original data blocks to obtain original data.
- an embodiment of the present application further provides an integrated circuit, including: any one of the decompression devices described in the twenty-first aspect.
- the integrated circuit may further include a computing device coupled to the decompression device, and the computing device is configured to perform data processing according to the original data obtained by decompression of the decompression device.
- the embodiment of the present application further provides an electronic device with a decompression function, which may specifically be the fourth electronic device in the embodiment of the present application, including: as described in the twenty-first aspect or the twenty-first aspect. Any one of the decompression devices described above, a processor coupled to the decompression device, and a memory coupled to the processor.
- an embodiment of the present application further provides a computer storage medium, where the computer storage medium is used to store computer software instructions, and when the computer software instructions are executed by a computer, the computer is implemented as the nineteenth Any one of the data decompression methods described in the aspect.
- an embodiment of the present application further provides a computer program, where the computer program includes computer software instructions that, when executed by a computer, cause the computer to execute the computer program according to the nineteenth aspect. Any data decompression method.
- FIG. 1 is a schematic diagram of decompression of a multi-decompression engine in the prior art
- FIG. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
- FIG. 3 is a schematic structural diagram of a decompression device according to an embodiment of the present invention.
- FIG. 4 is a schematic flowchart of a data compression method according to an embodiment of the present invention.
- FIG. 5 is a schematic explanatory diagram of a data compression method according to an embodiment of the present invention.
- 6A is a schematic explanatory diagram of raw data and compressed data provided by an embodiment of the present invention.
- 6B is a schematic structural diagram of a canonical compressed data block provided by an embodiment of the present invention.
- step S41 is a schematic flowchart of a method for implementing step S41 according to an embodiment of the present invention.
- step S41 is a schematic flowchart of another method for implementing step S41 according to an embodiment of the present invention.
- FIG. 9 is a schematic structural diagram of a compression device according to an embodiment of the present invention.
- FIG. 10 is a schematic structural diagram of another compression device according to an embodiment of the present invention.
- FIG. 11 is a schematic flowchart of a data decompression method according to an embodiment of the present invention.
- FIG. 12 is a schematic structural diagram of another decompression device according to an embodiment of the present invention.
- FIG. 13 is a schematic structural diagram of a second electronic device according to an embodiment of the present invention.
- FIG. 15 is a schematic structural diagram of still another compression device according to an embodiment of the present invention.
- FIG. 16 is a schematic structural diagram of still another compression device according to an embodiment of the present invention.
- FIG. 17 is a schematic structural diagram of still another decompression device according to an embodiment of the present invention.
- FIG. 19 is a schematic structural diagram of still another decompression device according to an embodiment of the present invention.
- FIG. 20 is a schematic structural diagram of a fourth electronic device according to an embodiment of the present invention.
- SoC System-on-chip
- SoC is called system-on-chip, and it is also called system-on-chip. It means that it is a product, an integrated circuit with special purpose, which contains a complete system and embedded software. The entire content.
- the so-called complete system generally includes a central processing unit (CPU), memory, and peripheral circuits. At the same time, it is a technology that is used to implement the entire process from determining the function of the system to dividing the software / hardware and completing the design.
- the decompression device may also be integrated on the SOC.
- Random Access Memory also known as "random memory”
- main memory main memory
- Double Rate Synchronous Dynamic Random Access Memory (DDR, Synchronous, Random, Access, Memory, DDR, SDRAM), referred to as DDR, is a series of memory interface protocols and a collective term for memories using this interface protocol, including DDR1, DDR2, DDR3 , DDR4, etc.
- DDR memory can transmit data twice in one clock cycle, that is, data is transmitted once during the rising period and falling period of the clock. Therefore, DDR memory can achieve a higher data transmission rate at the same bus frequency as SDRAM.
- AXI Advanced eXtensible Interface
- AMBA Advanced Microcontroller Bus Architecture 3.0 protocol. It is a high-performance, high-bandwidth, low-latency on-chip bus.
- the AXI bus sends addresses, read data, write data, and handshake signals in different channels. The order between different accesses can be disrupted.
- the BUSID is used to indicate the ownership of each access. The master can issue multiple read and write operations without getting the returned data. The order of the read data can be shuffled, and non-aligned data access is also supported.
- Compression algorithm refers to the algorithm of data compression. It is also often called signal coding in the field of electronics and communication. It includes two steps of compression and reduction (or encoding and decoding).
- the compression algorithm involved in this application is characterized in that the electronic device needs to sequentially scan the characters to be compressed and sequentially encode, so that the electronic device can monitor the length of the compressed data while compressing.
- the compression algorithm may be general compression algorithms such as entropy encoding, run length coding (RLC), dictionary encoding, and their combination methods or variants, which are not limited in the embodiments of the present application.
- entropy coding may include, but is not limited to, Huffman coding, arithmetic coding, etc .
- dictionary coding includes but is not limited to LZ (Lempel-Ziv) coding series, and LZ coding series includes deflate, LZ77, LZ78 , LZW, LZO, etc. are not limited in the embodiment of the present application.
- Huffman coding also known as Huffman coding
- Huffman coding is a coding method.
- Huffman coding is a type of variable word length coding (VLC).
- Huffman coding constructs the codewords with the shortest average length of heterograph heads according to the probability of character appearance.
- Huffman-encoded codewords that is, the codes of each symbol
- hetero-preamble codewords that is, any codeword will not be the front part of another codeword, which allows the codewords to be transmitted together. No additional isolation symbol is required, as long as no error occurs during transmission, the receiving end can still separate each codeword without confusion.
- Run Length Coding also known as “run length coding” or “run length coding”
- This coding belongs to lossless compression coding and is an important coding method for raster data compression.
- the basic principle is: use a symbol value or string length to replace consecutive symbols with the same value (consecutive symbols constitute a continuous "run"), so that the symbol length is less than the length of the original data. Only when the code of each row or column of data changes, the code and the number of duplicates of the same code are recorded at one time to achieve data compression.
- the data group is usually one character or multiple consecutive characters, which is related to the encoding format of the original data.
- characters are the smallest meaningful unit in the encoding format of the original data.
- the text in English format is 1 byte (8 bits)
- the integer in INT32 format is 4 bytes.
- the length of the data group (that is, the compression step size) is related to the compressed data content, compression algorithm, and so on.
- a compression refers to compressing a data group.
- a data group is a character.
- the data to be compressed is "AAAABBB”, and the data group is "AAAA” in the first compression, and the length of the corresponding data group in the first compression is 4 characters in length;
- the data group is "BBB”, and the length of the data group corresponding to the second compression is 3 characters.
- Decompression engine hardware for decompressing data, such as integrated circuits or Field Programmable Gate Array (FPGA).
- the decompression engine corresponds to the compression algorithm, and can only decompress the data compressed by a specific compression algorithm.
- the standard compressed data block has a fixed length, that is, L2. It is a data block that can be processed (decompressed) by a single decompression engine in a decompression device, and the original data block obtained after decompression is The size is not larger than L1. Among them, L1 and L2 are integers greater than 1, and L1 is greater than L2.
- the processing cycle may be one clock cycle or multiple clock cycles.
- a single decompression engine can process compressed data blocks with a maximum length of L2 in one processing cycle.
- S original data blocks are compressed independently, and S compressed data blocks corresponding to the S original data blocks are obtained. There is no correlation between the S compressed data blocks (that is, when compressing one original data block, there is no need to compress based on other original data blocks), and they can be decompressed independently (that is, when decompressing, there is no need to Compressed data blocks to decompress).
- the original data is composed of original data block A and original data block B.
- the original data block A is compressed by using a compression algorithm, starting from the first data group of the original data block A. Compression, after the original data block A is compressed, a compressed data block A ′ is obtained.
- the compression is restarted from the first data group of the original data block B, and the original data block B is compressed. After the compression is completed, a compressed data block B ′ is obtained.
- the compressed data block A ′ and the compressed data block B ′ may be decompressed respectively, and the compressed data block A ′ and the compressed data block B ′ may be decompressed in any order.
- the compressed data block A ′ and the compressed data block B ′ may be decompressed at the same time.
- FIG. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
- the electronic device may include a processor 21, a memory 22, and a decompression device 23.
- the processor 21 may be connected to the memory 22 and the decompression device 23 through a bus 24.
- the memory 22 may be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), or other memories.
- the memory 22 is configured to store original data and various software programs, such as a data compression program in the present application.
- the memory 22 may be DDR to improve a data transmission rate between the memory and the processor or between the memory and the decompression device.
- the processor 21 is a control center of a computer device.
- a processor refers to a circuit or a collection of multiple circuits with processing capabilities.
- it can be an instruction set-based processor (also called a "software processor") such as a central processing unit (CPU), or it can be based on an application-specific integrated circuit (ASIC) or a field programmable gate array (Field).
- ASIC application-specific integrated circuit
- FPGA Programmable Gate Array
- the processor 21 may perform various functions of the electronic device by running or executing a software program stored in a memory of a computer device, and calling data stored in the memory.
- the processor 21 may be packaged into one chip alone or with other circuits, or the processor may be packaged into several chips (for example, each function circuit is packaged into multiple chips), which is not limited in this application. .
- the processor 21 may call the original data stored in the memory 22 and a data compression program to implement the data compression method described in the embodiment of the present application.
- the bus 24 may be an AXI bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, or the like.
- the bus can be divided into an address bus, a data bus, a control bus, and the like.
- the decompression device 23 may include a first memory 231, M decompression engines 232, a second memory 233, a splicing circuit 234, and the like.
- the processor 21 may also control the activation of the decompression device 24 through the bus 24.
- the decompression device 23 may obtain the compressed data block from the memory 22 through the bus 24, and decompress the compressed data block in real time through the decompression engine.
- the decompression device may specifically be completed based on a hardware processor such as an ASIC or an FPGA. Of course, this application is not limited to complete the decompression based on a software processor such as a CPU.
- the first memory 231 is an entry storage of the decompression device, and is configured to store the received compressed data block.
- the first memory 231 may include M storage subunits corresponding to the M decompression engines one by one, and one storage subunit may store a compressed data block, such as a standard compressed data block.
- the compressed data block may also be a compressed data block obtained by compressing an original data block whose length is not greater than L1. That is, it can be determined that L2 is a storable data length of any storage sub-unit in the first memory.
- M decompression engines are used to decompress the canonical compressed data block stored in the first memory in parallel, and one decompression engine is used to decompress a canonical compressed data block.
- the M decompression engines include N decompression engines, and the N canonical compression blocks can be decompressed in parallel by the N decompression engines to obtain N original data blocks.
- Each of the N decompression engines 232 is used to obtain a canonical compression data block among the N canonical compression data blocks, and decompress the obtained canonical compression data block to obtain the N canonical compression data blocks one-to-one corresponding to N Blocks of raw data.
- the length of any one of the N original data blocks may not be greater than L1.
- the second memory is an outlet storage of the decompression device, and is configured to store N original data blocks.
- the second memory includes M storage subunits corresponding to the M decompression engines one-to-one respectively, and the storage subunits are used to store the original data blocks decompressed by the decompression engine corresponding to the storage subunits. That is, It is determined that L1 is a storable data length of any storage sub-unit in the second memory.
- the storage size of the inlet of the decompression device is the sum of the storage sizes of the M decompression engines included in the decompression device.
- the outlet storage size of the decompression device is the sum of the outlet storage sizes of the M decompression engines included in the decompression device.
- the stitching circuit is configured to stitch the original data blocks (for example, N original data blocks) stored in the second storage to obtain the original data.
- the splicing circuit is not a necessary component of the decompression device.
- the decompression device may not include a splicing circuit, and the data splicing is implemented by software, which is not limited in the embodiment of the present application.
- the N decompression engines include a decompression engine i
- the N compressed data blocks include a compressed data block i
- the N original data blocks include a raw data block i obtained by decompressing the compressed data block i, where i is a positive integer, i is not greater than N; the decompression engine i is specifically used to decompress the compressed data block i by the decompression engine i.
- the decompression engine i when the length of the original data block i obtained by the decompression engine i is equal to L1, stop the decompression operation on the compressed data block i and output the original data block i; or, when the decompression engine i recognizes an invalid flag, stop the compression The decompressing operation of the data block i outputs the original data block i obtained by the decompression.
- the first decompression engine is any one of the N decompression engines
- the first canonical compression data block is any one of the N canonical compression data blocks.
- the compressed data block is taken as an example to illustrate the decompression process of any decompression engine.
- the decompression device can decompress the first specification compressed data block through the first decompression engine; the length of the original data block decompressed by the first decompression engine. When equal to L1, stop the decompression operation of the first canonical compression data block by the first decompression engine and output the original data block; or, when the first decompression engine recognizes the invalid flag, stop the first decompression engine from compressing the first canonical compression data block. Decompression operation to output the original data block obtained by the current decompression.
- the decompression device further includes a control circuit, configured to stop the first decompression engine from compressing the obtained compression when the length of the original data block decompressed by the first decompression engine among the N decompression engines is equal to L1. Decompress operation of data block.
- the decompression device may further include a data distribution circuit, which is configured to sequentially distribute the N compressed data blocks stored in the first memory to the N decompression engines.
- one storage subunit in the first storage and / or one storage subunit in the second storage may be set in the corresponding decompression engine, which is not limited in the embodiment of the present application.
- the electronic device may further include a computing device, which is coupled to the decompression device and the processor, and is configured to perform data processing according to the original data obtained by the decompression device.
- a computing device which is coupled to the decompression device and the processor, and is configured to perform data processing according to the original data obtained by the decompression device.
- the computing device may be a specific integrated circuit, such as hardware running a machine learning algorithm, hardware running a video or image processing algorithm, and the like.
- the processor can also control the activation of the decompression device and the computing device through the bus; the decompression device can obtain the compressed data blocks from the memory through the bus, and decompress the multiple compressed data blocks in real time through multiple decompression engines to obtain the corresponding compressed data blocks.
- the raw data is input to a computing device; the computing device uses the raw data to perform calculations, for example, the computing device uses the raw data for training or inference of a machine learning model.
- the computing device may be one or more microprocessors, and may also be one or more Field Programmable Gate Array (FPGA), etc., and is used for implementing specific computing functions of the computing module.
- FPGA Field Programmable Gate Array
- the computing device and the decompression device may form an integrated circuit.
- the integrated circuit may be integrated on the same chip as a processor, a memory, or the like.
- the integrated circuit may also be used as an independent chip and applied to an electronic device to implement Acceleration of calculations by hardware.
- the electronic device in FIG. 2 can simultaneously run the data compression method and the data decompression method corresponding to the data compression method in this application.
- the electronic device also referred to as the first electronic device in the present application
- the electronic device that executes the data compression method may not include a computing device and a decompression device.
- the processor in the electronic device such as the second electronic device
- the data decompression method may not run the data compression method.
- the data compression method passes the first An electronic device or a compression device is executed.
- the first electronic device may be the electronic device shown in FIG. 2 or another first electronic device described in the embodiment of the present application.
- the data compression method It is used to compress the metadata bureau into one or more canonical compressed data blocks of length L2 for the decompression device to decompress in parallel, wherein the decompression device includes multiple decompression engines, and each decompression engine can complete one to one within a processing cycle. Decompress compressed data blocks.
- L2 is an integer greater than 1.
- the compression device can perform one or more original data block compressions.
- the original data block compression may include: the compression device is based on a compression algorithm. Processing the original data block to obtain a canonical compressed data block corresponding to the original data block, where Original data block included in the original data Data.
- the embodiment of the present application uses a compression process of an original data block as an example.
- the specific implementation of the compression may be: independent compression of the original data block through a compression algorithm to obtain a compressed data block corresponding to the original data block.
- the compressed data block The length d is not greater than L2; further, additional data of length L2-d is added after the compressed data block, thereby generating a canonical compressed data block of length L2, where d is an integer greater than 0. It should be understood that d is only consistent with the length of the reference compressed data block. For different compressed data blocks, the actual value of d may be different.
- a method for compressing original data may include all or part of the following steps.
- Step S41 Each of the consecutive S original data blocks in the original data is independently compressed by a compression algorithm to obtain the S compressed data blocks, and the original data blocks correspond to the compressed data blocks one by one.
- each of the S original data blocks is continuous multiple data in the original data, and the length of the continuous multiple data is not greater than L1, and each of the S compressed data blocks is compressed.
- the length d is not greater than L2, and S is a positive integer.
- Raw data can be data in the form of files or non-file data (for example, some data stored in memory).
- the original data includes multiple original data blocks, which are connected in sequence to form the original data.
- data block refers to a collection of multiple data.
- one or more bits can be used to represent a data That is, the data block may include multiple bits.
- the length of each of the plurality of original data blocks is not greater than L1.
- the length of the compressed data block corresponding to each original data block is not greater than L2. It should be understood that the length of the original data block may be different in different original data blocks. Please refer to the schematic explanatory diagram of the original data and the compressed data shown in FIG. 6A together.
- the method may further include:
- Step S40 Determine that L1 is the exit bit width of a single decompression engine and that L2 is the entry bit width of a single decompression engine.
- the "determination" in this step can be determined by configuring L1 and L2 in advance (for example, the specific values of L1 and L2 are configured in the program code or circuit implementation), or it can also be run by a program or hardware circuit. Read the relevant configuration values at any time to determine (for example, determine the values of L1 and L2 by reading the configuration file that stores the values of L1 and L2 stored locally or remotely).
- the values of L1 and L2 can be determined according to the compression support hardware of the compression system, that is, the determination of these thresholds needs to be capable of supporting hardware, and it is best to maximize the use of hardware resources.
- L1 because the original data block is involved, it is necessary to ensure that the size of the exit storage of the decompression engine (that is, the memory used to store the decompressed data) can accommodate the decompressed data, that is, not less than the decompressed size.
- the exit bandwidth of the engine that is, the maximum number of data bits that can be stored after decompressing the standard compressed data block in a processing cycle). Therefore, L1 must be less than or equal to the exit bit width of a single decompression engine.
- L1 the exit width of a single decompression engine.
- L2 the entry bit width of a single decompression engine.
- the entry bit width of a single decompression engine may be a storage size that the first memory can allocate to the single decompression engine or a size of a storage subunit corresponding to the single decompression engine in the first memory.
- the exit bit width, L1, entry bit width, and L2 can be in units of bits.
- the exit bit width and entry bit width can be determined by the performance indicators to be satisfied by the compression and decompression system in combination with specific software and hardware.
- the compression algorithm and circuit design of the decompression engine can be used.
- the length of data that can be input to the decompression device and the number, area, and power consumption of the decompression engines in the decompression device are determined by each clock cycle. For example, the main frequency of the hardware is f, and the bandwidth allocated to the entry of the decompression device is b, then the data entering the compression device per clock cycle is b / f.
- the decompression capability of a single decompression engine is c bytes / clock cycle (byte / cycle)
- at least b / (f * c) decompression engines are required.
- the decompression capability of a single decompression engine is c bytes / clock cycle
- the decompression device includes M decompression engines
- the data entering the compression device per clock cycle is c * M bytes. Therefore, the decompression device
- the storage size of the first memory must be able to store the data entering the compression device every clock cycle, and the entry storage of a single decompression engine must be able to store the amount of data entering the compression engine per clock cycle, that is, c bytes.
- the main frequency of the hardware is 1GHz
- the bandwidth allocated to the entry of the decompression device is 32GBps.
- the data that enters the compression device per clock cycle is 32 bytes. Clock cycle (byte / cycle).
- the decompression device needs at least 4 decompression engines.
- the size of the storage resource corresponding to a single decompression engine is not less than 8 bytes.
- the exit bit width of a single decompression engine is greater than the entry bit width of a single engine.
- the exit bit width of a single engine may be equal to the storage size allocated to the single decompression engine by the second memory in the decompression device, or equal to the size of the storage subunit corresponding to the single decompression engine in the second storage unit.
- the entry bit width of a single decompression engine can be set to the maximum length of a compressed data block that can be decompressed by a single decompression engine; similarly, the exit bit width of a single decompression engine can be set to a single decompression of one clock cycle The maximum length of raw data that the engine can extract.
- the compression device can obtain the specifications of the decompression device, and the specifications include the exit bit width, the entry bit width, the number of decompression engines, and the like. It is further determined that L1 is less than or equal to the exit bit width of a single decompression engine, and L2 is less than or equal to the entry bit width of a single decompression engine.
- L1 may also be smaller than the exit bit width of a single decompression engine, and L2 may also be smaller than the entry bit width of a single decompression engine.
- Step S42 Add additional data of length L2-d after each of the S compressed data blocks to generate S standardized compressed data blocks of length L2.
- a canonical data block of length L2 can be decompressed by a single decompression engine in a decompression device, L1 and L2 are integers greater than 1, d is an integer greater than 0, and L1 is greater than L2.
- the first original data block is any one of the S original data blocks
- the first compressed data block is data obtained by compressing the first original data block in the S compressed data blocks.
- the length is equal to L2
- d is L2, that is, the compression device does not need to add additional data after the first compressed data block
- the first compressed data block is a required standard compressed data block of length L2.
- the length of the additional data in the canonical compressed data block obtained by compressing different original data blocks may be different.
- additional data (1) legal codeword or (2) includes invalid flag and invalid data.
- the invalid flag is used to indicate that the additional data needs to be discarded, and the invalid data is located in invalid. After the sign.
- the number of bits of wireless data after the invalid flag can be 0 or not less than 1.
- the number of bits of invalid data is determined by the length of the data compressed by the first original data block.
- the legal codeword is a codeword that can be identified and decompressed by the decompression engine.
- the additional data is the type (1) legal codeword, although the decompression engine The additional data can be identified and decompressed, but since the length of the first raw data block is L1, the decompression engine can only take data up to L1 length, and the data decompressed by the additional part can be discarded.
- the invalid flag can consist of multiple bits. The specific number of bits depends on the decompression algorithm. For different decompression algorithms, the number of bits of the invalid flag can be different.
- the decompression engine recognizes the invalid flag and knows that all data starting from this invalid flag is invalid data, and it can be discarded. Since the decompression engine does not decompress the data after the invalidation flag, the value of the invalid data filled after the invalidation flag is not limited, and arbitrary data can be filled.
- the second case the length y of the first original data block is less than L1, and the additional data includes the "invalid flag” and "invalid data" as mentioned in the first case.
- y is less than L1
- the decompression end cannot output the decompression result (because unlike the first case, the data of L1 can be taken uniformly.
- the length of the valid data that is decompressed is unknown), so the method of "invalid flag + invalid data" needs to be used to stop decompression. At this time, the decompressed data before the invalid flag is the original data block.
- the length of the original data block can be known in some way, it can also be implemented by adding a legal codeword. It can be understood that by adding an invalid flag method, the second case can be shared with the first case with a set of software code, which is more convenient to handle and reduces the design cost.
- the additional data in the canonical data block obtained by compressing the first original data block may also be (3) including an invalid flag and invalid data, where the invalid flag is used for Indicates that the additional data needs to be discarded, invalid data is located after the invalid flag, and the number of bits of wireless data behind the invalid flag may be 0 or not less than 1.
- the compression device may determine that the legal codeword is a code corresponding to the code length of L2-d in Table 1 according to the value of L2-d, or determine that the legal codeword is a combination of multiple codes whose total length is L2-d in Table 1.
- the length of the multiple standardized compressed data blocks generated is a fixed value L2
- the length of the original data block that generates the standardized compressed data block is not greater than L1, which regulates the original data compression generation
- the length of the compressed data block, and each canonical compression data block is independently compressed, and can be independently decompressed, so that each decompression engine can decompress simultaneously when decompressing the multiple canonical compression data blocks, and improve the decompression efficiency of the data.
- the present application is set to a standard compressed data block of fixed length L2.
- the compression end does not need to record the length of each compressed data block, and the decompression end does not need to record the acquired data length. Makes the design of the decompression side simpler.
- the number of original data blocks divided by the original data is equal to the number of decompression engines, that is, the number of decompression engines limits the granularity that the original data can divide, so that multiple compressions formed by the original data compression
- the length of the data block is large.
- the compressed data block where the data at the random address is located needs to be decompressed.
- the compressed data block can only be decompressed by a decompression engine, and the double-speed decompression of the compressed data cannot be achieved.
- the granularity of the original data can be divided regardless of the number of decompression engines.
- the original data can be compressed into a large number of smaller standardized compressed data blocks.
- the data of a random address is accessed, the data of the random address is accessed.
- Multiple consecutive canonical compressed data blocks are input into multiple decompression engines for decompression, which can achieve double-speed decompression of compressed data with random addresses.
- step S41 uses the compression device to independently compress the first original data block by using a compression algorithm to obtain the first compressed data block as an example to introduce the implementation method in step S41.
- the first original data block is an original data block in the original data. It is understood that step S41 may also include other implementation manners, which are not limited in the embodiment of the present application.
- data compression is performed with a data group as a step size, and the data group is one or more continuous data that can be compressed. It is a compressible unit under the compression algorithm.
- the length of the data group is determined by the compression algorithm and the data group.
- the content of the data is determined to be less than or equal to L1; moreover, the length of the data block generated by the compression of a single data group is less than or equal to L2, and its specific implementation is the prior art, which is not described in this application.
- the first implementation method of step S41 includes the following process:
- the compression device obtains a data group to be compressed from the original data.
- the data group to be compressed may be the first data group in the first original data block or the next data group to be compressed after the data group in the first original data block is compressed one or more times.
- the data group includes one or more bits of data.
- step S2 Determine whether it is necessary to compress the data group to be compressed. If compression is required, perform step S3; otherwise, perform step S4.
- determining whether the data group to be compressed needs to be compressed includes: determining whether the sum of the total length x of the one or more data groups that have been compressed and the length ⁇ x of the data group to be compressed is not greater than the L1, And it is determined whether the compressed data block length y generated after the data group to be compressed is compressed is not greater than L2.
- the length of the compressed data block generated after the data group is compressed means that the length of the compressed data block is increased based on the length of the original compressed data block, that is, the length of the compressed data block is Each data set is updated after compression.
- the sum of the total length x of the compressed data group or data groups and the length ⁇ x of the data group to be compressed is not greater than L1 and the length of the compressed data block generated after the data group to be compressed is not greater than L2, It indicates that the compressed data block obtained after compression again still meets the condition that the length is not greater than L2, and the data group to be compressed can be compressed, and it is determined that compression is needed.
- step S5 If the sum of the total length x of the compressed data group or data groups and the length ⁇ x of the data group to be compressed is greater than L1, it means that the length will exceed L1 after another compression, so it is judged that no compression is needed. At this time, the compression of the data group to be compressed is stopped, and step S5 is performed.
- the data group to be compressed does not need to be compressed, the data group to be compressed needs to be returned to the original data as the first data group to compress the next original data block.
- the present application compresses the original data into S canonical compressed data blocks.
- the first data group in the data group refers to the first data group in the first original data block.
- the compression device may determine the sizes of x + ⁇ x and L1 first, and then determine the sizes of y and L2.
- FIG. 7 is a schematic flowchart of an implementation method of independently compressing a first original data block by using a compression algorithm to obtain a first compressed data block.
- the method includes the following processes:
- the compression device obtains a first data group and compresses the first data group.
- the compression device may perform compression by default when it obtains the first data group.
- the compression device obtains the k-th data group, and the length of the k-th data group is ⁇ x k .
- the compression device may preferentially determine whether the sum of the length x of the compressed one or more numbers and the length ⁇ x k of the k-th data group is not greater than L1.
- the compression device determines whether the sum of the total length x of the compressed one or more data groups and the length ⁇ x k of the k-th data group is greater than L1. It can be understood that the total length x of one or more data groups refers to the length obtained by accumulating the lengths of each data group in the one or more data groups.
- one or more data groups that have been compressed are the first to k-1 data groups.
- step S414 When x + ⁇ x k > L1, it means that if the kth data group is compressed, the length of the 1st to kth data groups will exceed L1. At this time, there is no need to compress the kth data group, and to stop For the compression of the Kth data group, perform step S414; when x + ⁇ x k ⁇ L1, it means that if the length of the 1st to kth data groups is less than or equal to L1 after the kth data group is compressed, perform step S415 .
- the compressed data block obtained by compressing the compressed one or more data groups (that is, the first to k-1 data groups) is used as the first compressed data block.
- the compressed one or more data groups ie, the first to k-1 data groups
- the first original data block in step S41 is the first original data block in step S41.
- S415 Determine whether the length y of the compressed data block generated after the k-th data group is compressed is greater than L2.
- the condition that the length y of the compressed data block generated after the k-th data group is compressed is greater than L2 is determined. At this time, it is determined that the k-th data group does not need to be compressed, and S414 may be performed.
- the first or more data groups to be compressed, if the corresponding parameters can be agreed in advance to meet certain conditions to ensure that they can definitely meet the conditions that can be compressed once or multiple times (for example, L1 is much larger than the data
- the group length, L2 is also relatively large. Even after one or more compressions, the compressed data will not exceed L1, and the compressed data block length will not exceed L2). At this time, you can directly judge without performing judgment.
- the first or more data is compressed one or more times accordingly.
- FIG. 8 Please refer to FIG. 8 together for another schematic flowchart of obtaining the first compressed data block by independently compressing the first original data through a compression algorithm.
- the implementation may include the following steps:
- Step S416 Compress the data block of length L1 in the original data with the data group as the step size to obtain a temporary compressed data block.
- Step S417 Determine whether the length y 'of the temporarily compressed data block is greater than L2.
- step S418 is performed; otherwise, when y' ⁇ L2 Go to step S419.
- Step S418 The data block obtained by removing the i data groups at the tail of the data block of length L1 is used as the first original data block, and the data obtained by compressing the first original data block is used as the first compressed data block.
- the length of the first compressed data block is not greater than the L2.
- i may be the smallest positive integer such that the length of the first compressed data block is not greater than.
- the method for determining i may be: the compression device removes the data group one by one from the tail of the data block of length L1, until the data block of length L1 is obtained by compressing the compressed data block obtained by compressing the data block obtained after removing the i-th data group. The length is not greater than L2.
- Step S419 Use the data block of length L1 as the first original data block and the temporary compressed data block as the first compressed data block.
- the compression device may perform step S42.
- the compression device compresses a data block of length L1 in the data to be compressed with a data group as a step size to obtain a temporary compressed data block; compares the length y ′ of the temporarily compressed data block with the size of L2 , Determine the first original data block and the first compressed data block generated by compressing the first original data block according to the comparison result, and then obtain the first compressed data block that meets the requirements, and further obtain the standardized compressed data block of fixed length L2 .
- FIG. 9 is a schematic structural diagram of a compression device according to an embodiment of the present invention.
- the compression device 90 includes: The compression device 90 is configured to compress the original data into one or more lengths for the decompression device to decompress in parallel.
- L2 is an integer greater than 1
- the compression device 90 includes:
- a processing module is configured to process an original data block based on a compression algorithm to obtain the canonical compressed data block corresponding to the original data block, where the original data block is data included in the original data.
- the processing module may include:
- a compression unit 91 is configured to independently compress the original data block by using a compression algorithm to obtain a compressed data block corresponding to the original data block, and a length d of the compressed data block is not greater than the L2;
- a specification unit 92 is configured to add additional data having a length of L2-d after the compressed data block, so as to generate the normalized compressed data block having a length of L2, where d is an integer greater than 0.
- the compression unit 91 is configured to independently compress each original data block of consecutive S original data blocks in the original data through a compression algorithm to obtain a one-to-one correspondence between the S original data blocks.
- S compressed data blocks each of the S original data blocks is a continuous multiple data in the original data, the length of the continuous multiple data is not greater than L1, and the S compressed data The length d of each compressed data block in the block is not greater than L2, and S is a positive integer;
- the specification unit 92 adds additional data of length L2-d after each of the S compressed data blocks to generate S standardized compressed data blocks of length L2, where the length is L2
- the specification data block is a data block that can be processed by a single decompression engine in a decompression device.
- the L1 and L2 are integers greater than 1, the d is an integer greater than 0, and the L1 is greater than all ⁇ L2 ⁇ Said L2.
- each unit in the compression device 90 can implement the above-mentioned data compression method based on hardware or software. For example, when based on hardware, each unit can be completed based on circuits such as FPGA and ASIC, or when implemented based on software, the CPU can read the memory. The code saved in the can implement the above unit functions to perform the corresponding functions.
- FIG. 10 is a schematic structural diagram of another compression apparatus according to an embodiment of the present invention.
- the compression apparatus 100 can implement the foregoing data compression method.
- the compression apparatus 100 includes: a processor 101 and a memory 102.
- the processor 101 Connected to the memory 102 via a bus 103, where:
- the memory 102 may be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), or other memories.
- the memory 102 is configured to store data such as original data and various software programs, such as a data compression program in the present application.
- the memory 102 may be DDR to improve a data transmission rate between the memory and the processor or between the memory and the decompression device.
- the processor 101 is a control center of the first computer device, and may be a processor or a collective name of a plurality of processing elements.
- the processor 101 may include one or more CPUs.
- the processor 101 may further include a specific integrated circuit, for example, one or more microprocessors, one or more Field Programmable Gate Arrays (FPGAs), etc. that implement the data compression method in the embodiment of the present invention.
- FPGAs Field Programmable Gate Arrays
- the compression device further includes a communication interface 104, and the communication interface 104 is configured to implement data exchange with other devices, such as a decompression device.
- the processor 101 is configured to call data such as raw data stored in the memory 102 and program code to execute: one or more times of raw data block compression, where the raw data block compression includes:
- the original data block is processed based on a compression algorithm to obtain the canonical compressed data block corresponding to the original data block, wherein the original data block is data included in the original data.
- the processor 101 may execute: independently compressing the original data block by using a compression algorithm to obtain an original data block corresponding to the original data block.
- a compressed data block, the length d of the compressed data block is not greater than the L2; adding additional data of length L2-d after the compressed data block, thereby generating the canonical compressed data block of length L2,
- the d is an integer greater than 0.
- each original data block of consecutive S original data blocks in the original data is independently compressed by a compression algorithm to obtain a one-to-one correspondence of the S original data blocks.
- S compressed data blocks each of the S original data blocks is a continuous multiple data in the original data, the length of the continuous multiple data is not greater than L1, and the S compressed data
- the length d of each compressed data block in the block is not greater than L2; after each compressed data block in the S compressed data blocks, additional data of length L2-d is added to generate S standardized compressions of length L2 A data block, wherein the length of the canonical data block L2 is a data block that can be processed by a single decompression engine in a decompression device, the L1 and the L2 are integers greater than 1, and the d Is an integer greater than 0, the L1 is greater than the L2.
- the original data block may include a plurality of consecutive data in the original data, and the length of the original data block is not greater than L1, where L1 is an exit bit width of the decompression engine.
- the first original data block is any one of the S original data blocks, where:
- the first additional data in the canonical data block obtained by compressing the first original data block is a legal codeword or the first additional data includes the first additional data for instructing the decompression engine.
- the first additional data includes an invalid flag for indicating that the first additional data in the canonical data block obtained by compressing the first original data block by the decompression engine needs to be discarded, and Zero or more invalid data following the invalidation flag.
- the processor 101 executes the independent compression of the original data block by using a compression algorithm to obtain a compressed data block corresponding to the original data block, which specifically includes executing part or all of the following Process:
- determining whether the data group to be compressed needs to be compressed includes: if the sum of the total length x of one or more data groups that have been compressed and the length ⁇ x of the data group to be compressed is not greater than If L1 is described and the compressed data block length generated after the data group to be compressed is not greater than L2, it is determined that compression is needed; if the sum of x and ⁇ x is not greater than L1 and The compressed data block length generated after the data group to be compressed is greater than the L2, it is determined that no compression is needed; if the sum of the x and ⁇ x is greater than the L1, it is determined that no compression is needed.
- the processor 101 executes the independent compression of the original data block by using a compression algorithm to obtain a compressed data block corresponding to the original data block, which specifically includes executing the following part or All processes:
- the length of the temporary compressed data block is greater than the L2
- the data obtained by block compression is used as the compressed data block, wherein the length of the compressed data block is not greater than the L2, and i may be the smallest positive integer such that the compressed data block is not greater than the L2;
- the data block of length L1 is used as the original data block, and the temporary compressed data block is used as the compressed data block.
- L1 is an exit bit width of a single decompression engine; and / or, L2 is an entry bit width of a single decompression engine.
- the present application further provides a first electronic device including a data compression function.
- the first electronic device may include any one of the compression devices described in FIG. 9 or FIG. 10.
- the data decompression method is executed by a second electronic device having a data decompression function or by the decompression device shown in FIG. 3 described above.
- the second electronic device may be the electronic device shown in FIG. 2 or another electronic device including a decompression device.
- the decompression device may also be a decompression device as shown in FIG. 3 or other decompression devices, which are not limited in the embodiment of the present application. .
- the data decompression method is described by taking the second electronic device as the electronic device shown in FIG. 2 and the decompression device as the decompression device shown in FIG. 3 as an example.
- the memory in the electronic device where the decompression device is located may store the first data and the compressed data block compressed by the first data.
- the computing device may request the electronic device through the bus to obtain second data whose start address is a random address add1 and whose length is Q, wherein the first data includes the second data; the electronic device may determine P including the second data according to the request address. Compress the data blocks, and then send P compressed data blocks to the decompression device; the decompression device inputs the original data obtained after decompressing and splicing the P compressed data blocks to the computing device, where the original data includes the second data; the computing device The second data may be obtained from the original data based on the request address.
- the electronic device may also determine the P compressed data blocks including the second data according to the address of the required second data, and then read the P compressed data blocks stored in the memory to the decompression device through the bus.
- the embodiments of the present application are not limited.
- the decompression device includes M decompression engines, and each of the M decompression engines is a decompression engine corresponding to the compression algorithm in the foregoing data decompression method embodiment, and is used to decompress the compressed data generated by the compression algorithm.
- a single decompression engine can decompress a canonical compressed data block in one clock cycle. That is, the decompression device decompresses a maximum of M standardized compressed data blocks in one clock cycle.
- a specific decompression method is similar to decompressing N compressed data blocks, which is not described in the embodiment of the present application.
- the data decompression method is executed by a second electronic device or decompression device.
- the embodiment of the present application is described using the decompression device as an example.
- the method includes all or part of the following steps.
- Step S111 The decompression device obtains N canonical compressed data blocks, where any one of the N canonical compressed data blocks is a data block of length L2 generated after independent compression of the original data block, one canonical
- the compressed data block can be decompressed by a single decompression engine in one processing cycle, where N is a positive integer and M ⁇ N.
- the decompression device obtains N standardized compressed data blocks through the bus, and the length of the original data blocks after decompression may not be greater than L1.
- L1 and L2 are integers greater than 1, and L1 is greater than L2.
- the decompression device may include a distribution circuit for distributing N standardized compressed data blocks to N decompression engines.
- step S111 may be: the decompression device receives the N specification compressed data blocks sent by the processor through the bus; and the N specification compressed data blocks are sequentially distributed to the N decompression engines through a distribution circuit.
- Step S112 Decompress N standardized compressed data blocks through N decompression engines to obtain N original data blocks, and the standardized compressed data blocks correspond to the original data blocks one by one. Among them, any one of the N original data blocks has original data.
- the length of the block may not be greater than L1.
- the first decompression engine is any one of the N decompression engines
- the first canonical compression data block is any one of the N canonical compression data blocks.
- the decompression device can decompress the first specification compressed data block through the first decompression engine; When the length of the original data block obtained by the engine decompression is equal to L1, stop the first decompression engine from decompressing the first compressed data block and output the original data block; or, when the first decompression engine recognizes the invalid flag, stop the first decompression The engine decompresses the first compressed data block and outputs the original data block obtained by the current decompression.
- the N decompression engines include a decompression engine i
- the N standardized compressed data blocks include a standardized compressed data block i
- the N original data blocks include the original compressed data blocks obtained by decompressing the standardized compressed data block i.
- i, i are positive integers, i is not greater than N
- the first decompression engine is used to decompress the received canonical compressed data block i to obtain and output the original data block i.
- An implementation manner of the decompression engine i for decompression may be:
- the decompression engine i decompresses the standard compressed data block i;
- the decompression engine i may include a counter that records the length of the original data block i decompressed by the decompression engine i and compares the length of the original data block i with the size of L1 through a comparator.
- the original data block i decompressed by the first decompression engine In the case where the length is equal to L1, the first decompression engine stops the decompression operation on the standard compressed data block i, and outputs the original data block i.
- the first decompression engine When the first decompression engine recognizes the invalid flag, the first decompression engine stops the decompression operation on the standard compressed data block i, and outputs the decompressed original data block i.
- Another implementation manner of the decompression engine i for decompression may be:
- the decompression engine i decompresses all the compressed data blocks i to obtain the original data block.
- the length of the original data block is greater than L1
- the data after the data of the length L1 in the original data block is discarded to obtain the original data with the length equal to L1 Data block i.
- the decompression engine i When the decompression engine i recognizes an invalid flag, the decompression engine i stops the decompression operation on the standard compressed data block i, and outputs the decompressed original data block i.
- the decompression device may include a control circuit, and when the length of the original data block i obtained by decompressing the canonical compression data block i by the decompression engine i is equal to the L1, the decompression device may stop the decompression engine i through the control circuit. Decompress the compressed data block i.
- Step S113 splicing the N original data blocks to obtain original data.
- the decompression device may stitch the N original data blocks to obtain the original data.
- the decompression device may also realize the splicing of the N original data blocks into the original data through a built-in splicing circuit.
- the decompression device can input the raw data into the computing device.
- the decompression device obtains N canonical compression data blocks, and decompresses the N canonical compression data blocks through N decompression engines to obtain one-to-one correspondence of the N canonical compression data blocks.
- N original data blocks the obtained N original data blocks are spliced to obtain original data.
- any one of the N canonical compressed data blocks is a data block of length L2 generated after independent compression of the original data block, so that each decompression engine can decompress the multiple canonical compressed data blocks. Decompression can be synchronized to improve the efficiency of data decompression.
- the granularity of the original data can be divided regardless of the number of decompression engines.
- the original data can be compressed into a large number of smaller canonical compression data blocks.
- the continuous canonical compressed data blocks are input into multiple decompression engines for decompression, which can achieve double-speed decompression of compressed data with random addresses.
- FIG. 12 is a schematic structural diagram of a decompression device according to an embodiment of the present invention.
- the decompression device 12 includes a controller 120 and M decompression engines 121.
- the controller includes an obtaining unit 1201 and a data distribution unit 1202. And a splicing unit 1203, where:
- An obtaining unit 1201 is configured to obtain N canonical compressed data blocks, where any one of the canonical compressed data blocks is a data block of length L2 generated after independent compression of the original data block, one The canonical compression data block can be decompressed by a single decompression engine in one processing cycle, where N is a positive integer and M ⁇ N;
- the data distribution unit 1202 decompresses the N canonical compressed data blocks in parallel through N decompression engines to obtain N original data blocks, and the canonical compressed data blocks correspond to the original data blocks one to one;
- a splicing unit 1203 is configured to splice the N original data blocks to obtain original data.
- the data distribution unit 1202 may be specifically configured to distribute N standardized compressed data blocks to N decompression engines of the M decompression engines, so that the N The canonical compressed data blocks are decompressed to obtain the N canonical compressed data blocks one-to-one corresponding to the N original data blocks, wherein the length of any one of the N original data blocks is not greater than L1. It should be noted that, for specific implementation of each unit in the decompression device 12 in the embodiment of the present application, reference may be made to the related description in the data decompression method shown in FIG. 11 above, which is not repeated in the embodiment of the present application.
- Each unit in the controller 120 can implement the above-mentioned data compression method based on hardware or software. For example, when based on hardware, each unit can be completed based on circuits such as FPGA, ASIC, or when implemented based on software, the CPU can read the memory. The code saved in the can implement the above unit functions to perform the corresponding functions. In order to achieve a faster decompression speed, hardware is used in this application to implement the functions of the relevant units.
- FIG. 13 is a schematic structural diagram of a second electronic device with a data decompression function according to an embodiment of the present invention.
- the second electronic device 13 includes a processor 131, a memory 132, and a decompression device 133.
- the processor 131 is connected to the memory 132 and the decompression device 133 through a bus 134.
- the processor 131 is a control center of the decompression device, and may be one or more CPUs, one or more microprocessors, or one or more FPGAs, which are not limited in the embodiment of the present invention.
- the memory 132 is configured to store data and instructions, and may be a read-only memory, a random access memory, or other memories.
- the processor 131 is configured to call the instructions of the memory 132 to implement the functions of the second electronic device.
- the decompression device 133 is configured to decompress the received standard compressed data block to restore the original data block.
- the decompression device may be a decompression device as shown in FIG. 3 or FIG. 9. It should be noted that, for specific implementation of each function in the decompression device shown in FIG. 13, reference may be made to related descriptions in the method embodiment shown in FIG. 11, which is not repeatedly described in the embodiment of the present application.
- the compression and decompression system may include a compression device and a decompression device.
- the compression device may be any one of the compression devices as shown in FIG. 9 or FIG. 10, and the decompression device may be as shown in FIG. Or any one of the decompression devices shown in FIG. 12. It can be understood that the compression and decompression system can be set in the same electronic device, such as the electronic device shown in FIG. 2, or can be distributed in different electronic devices.
- An embodiment of the present application further provides a compression and decompression system.
- the compression and decompression system may include a first electronic device and a second electronic device.
- the first electronic device and the second electronic device may include a first electronic device and a second electronic device.
- the electronic device, the first electronic device, and the second electronic device in this application may be devices such as a personal computer (PC), a mobile phone, a notebook computer, a tablet computer, a server, a gateway, and a router.
- the first electronic device and the second electronic device may be disposed in the same electronic device, such as the electronic device shown in FIG. 2, or may be different devices, which are not limited in the embodiment of the present application.
- the following describes another data compression method provided by the embodiment of the present application.
- the data compression method is applied to a compression device or a third electronic device that can implement data compression.
- the following uses a compression device as an example for description.
- the compression device independently compresses each of the consecutive S original data blocks in the original data through a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks in a one-to-one correspondence, and records the S The length of each compressed data block in the compressed data blocks.
- each of the S original data blocks is continuous multiple data in the original data, and the length of the continuous multiple data is not greater than L1, and each of the S compressed data blocks is compressed.
- the length d is not greater than L2
- S is a positive integer
- the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle.
- the compressed data block obtained by limiting compression can be processed in one processing cycle.
- the data compression method may include the following steps:
- the compression device independently compresses each of the consecutive S original data blocks in the original data through a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks one-to-one.
- each of the S original data blocks is continuous multiple data in the original data, and the length of the continuous multiple data is not greater than L1, and each of the S compressed data blocks is compressed.
- the length d of the data block is not greater than L2, S is a positive integer, and the compressed data block of length L2 is a data block that can be processed by a single decompression engine in a decompression device.
- L1 and L2 are integers greater than 1, so Let d be an integer greater than 0, and L1 be greater than L2.
- S142 The compression device records the length of each compressed data block in the S compressed data blocks.
- the data compression method shown in FIG. 5 finally obtains a standardized compressed data block whose length is fixed at L2 and is implemented by adding additional data to the compressed data block.
- the compressed data block is the finally obtained compressed data block, and its length is not fixed.
- the compression device needs to record the length of each compressed data block, so that the decompression device can compress different lengths of the obtained compressed data. Data blocks are distinguished.
- step S141 For an implementation manner of step S141, reference may be made to the two implementation manners of S41 described above, which are not repeatedly described in the embodiment of the present application.
- the length of the compressed data block is made as close as possible to L2, so that each decompression engine in the fourth electronic device or decompression device uses the decompression engine to the greatest extent when decompressing the first compressed data block, improving Decompression efficiency.
- the first original data block is any one of the S original data blocks
- the first compressed data block is a compressed data block corresponding to the first original data block among the S compressed data blocks.
- the data block is taken as an example to describe the implementation manner of the compression device recording the length of the compressed data block. It can be understood that the compression device records the length of the first compressed data block and may include, but is not limited to, the following two implementations:
- the compression device records the length d of the first compressed data block in a start field of the first compressed data block, where the start field is a field starting from the start bit of the first compressed data block and having a length of a third length threshold.
- the third length threshold may be 4 bits or 8 bits, which is related to the size of L2. For example, if L2 is 8 bytes, that is, the maximum length of the first compressed data block is 64 bits, then the length value of the record does not exceed 64, and the third length threshold may be 8 bits.
- the decompression device After receiving the compressed data, the decompression device obtains the first compressed data block by reading the length stored in the start field. By analogy, the next first compressed data block is obtained, and then all the first compressed data blocks are obtained. Further, the decompression device or device sequentially inputs the plurality of first compressed data blocks into the decompression engine for decompression.
- the compression device writes the length d of the first compressed data block into a first file, and the first file includes the lengths of the S compressed data blocks obtained by the compression device in order.
- the compression device sequentially records the lengths of the S compressed data blocks in the first file according to the compression order of the data.
- the compression device transmits the compressed data to the fourth electronic device or the decompression device
- the first file is simultaneously sent to the fourth electronic device or the decompression device.
- the decompression device or device divides the received compressed data according to multiple lengths contained in the first file to obtain S compressed data blocks. Further, the decompression device or device sequentially inputs the S compressed data blocks into the decompression engine for decompression.
- the compression device 150 includes a compression unit 1501 and a recording unit 1502, where:
- a compression unit 1501 is configured to independently compress each original data block of consecutive S original data blocks in the original data through a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks in a one-to-one correspondence,
- Each of the S original data blocks is a continuous multiple data in the original data, and the length of the continuous multiple data is not greater than L1, and each of the S compressed data blocks is compressed.
- the length d of the data block is not greater than L2, S is a positive integer, and the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle.
- the L1 and the L2 are integers greater than 1.
- D is an integer greater than 0, and L1 is greater than L2;
- the recording unit 1502 is configured to record a length of each compressed data block in the S compressed data blocks.
- each functional unit included in the compression device 150 can implement the above-mentioned data compression method based on hardware or software. For example, when based on hardware, each unit can be completed based on circuits such as FPGA, ASIC, or when implemented by software, the CPU can read the memory The code saved in the can implement the above unit functions to perform the corresponding functions.
- the compression device 160 includes: a processor 1601, a memory 1602, and the processor 1601 is connected to the memory 1602 through a bus 1603.
- the processor 1601 is connected to the memory 1602 through a bus 1603.
- the memory 1602 may be a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), or other memories.
- the memory 1602 is used to store data such as original data and various software programs, for example, a program that implements the data compression method described in FIG. 14 in the present application.
- the memory 1602 may be DDR, so as to improve a data transmission rate between the memory 1602 and the processor 1601 or between the memory 1601 and the decompression device.
- the processor 1601 is a control center of the first computer device, and may be a processor or a collective name of multiple processing elements. In a specific implementation, as an optional embodiment, the processor 1601 may include one or more CPUs. The processor 1601 may further include a specific integrated circuit, such as one or more microprocessors, one or more Field Programmable Gate Arrays (FPGAs), and the like that implement the data compression method in the embodiment of the present invention.
- FPGAs Field Programmable Gate Arrays
- the compression apparatus further includes a communication interface 1604, and the communication interface 1604 is configured to implement data exchange with other devices, such as a second decompression device.
- the processor 1601 calls data and program instructions stored in the memory 1602, and executes the following methods:
- Each original data block of consecutive S original data blocks in the original data is independently compressed by a compression algorithm to obtain S compressed data blocks corresponding to the S original data blocks one to one, and the S original data blocks
- Each original data block in the block is continuous multiple data in the original data, the length of the continuous multiple data is not greater than L1, and the length d of each compressed data block in the S compressed data blocks is not Greater than L2, S is a positive integer, and the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle.
- the L1 and L2 are integers greater than 1, and the d is greater than 0.
- the compression device may further include a communication interface 1604 to implement data transmission with a communication peer such as a decompression device.
- a communication peer such as a decompression device.
- the decompression device 170 may include a controller 1700, a first memory 1701, M decompression engines 1702, and a second memory 1703, where:
- the controller 1700 is configured to obtain compressed data, where the compressed data includes N compressed data blocks and a length of each of the N compressed data blocks, and according to each of the N compressed data blocks Compressing the length of the data block, and splitting the compressed data into N compressed data blocks;
- the first memory 1701 is configured to store N compressed data blocks, wherein any one of the N compressed data blocks is an independently compressed data block with a length of no more than L2, N is a positive integer, and M ⁇ N, the compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle, the L1 and the L2 are integers greater than 1, and the L1 is greater than L2;
- Each of the N decompression engines is configured to obtain a compressed data block among the N compressed data blocks, and decompress the obtained compressed data blocks respectively to obtain the N compressed data blocks one by one.
- the second memory 1703 is configured to store the N original data blocks.
- the decompression device 170 further includes: a splicing circuit 1704, which is used to splice the N original data blocks to obtain original data.
- the first memory 1701 may include M storage subunits corresponding to the M decompression engines one by one, and one storage subunit may store one compressed data block.
- the second memory 1703 may include M storage subunits corresponding to the M decompression engines one by one, and one storage subunit may store one original data block.
- one storage subunit in the first storage and / or one storage subunit in the second storage may be set in the corresponding decompression engine, which is not limited in the embodiment of the present application.
- controller 1700 is not a necessary component of the decompression device 170.
- the decompression device 170 may not include the controller 1700, and the controller 1700 is provided in a fourth electronic device including the decompression device 170.
- the various processes in the controller 1700 can implement the above-mentioned data compression method based on hardware or software. For example, when based on hardware, each unit can be completed based on FPGA, ASIC and other circuits, or when implemented based on software, the CPU can read the memory The saved code that can implement the above process performs the corresponding function.
- An embodiment of the present application further provides a fourth electronic device that can implement a data decompression function.
- the fourth electronic device may include any one of the decompression devices shown in FIG. 17.
- a data decompression method for the data compression method shown in FIG. 14 provided by the present application is described below. This method is applied to a fourth electronic device or a decompression device.
- the fourth electronic device may be an electronic device as shown in FIG. 2 or other electronic devices including a decompression device, and the decompression device may be a decompression device as shown in FIG. 17 or other decompression devices.
- a flowchart of a decompression method includes, but is not limited to, the following steps:
- S181 Obtain compressed data, where the compressed data includes N compressed data blocks and a length of each compressed data block in the N compressed data blocks, where N is a positive integer; wherein any one of the N compressed data blocks Compressed data blocks are independently compressed data blocks of length no greater than L2, N is a positive integer, M ⁇ N, and a compressed data block of length L2 is a data block that can be processed by a single decompression engine in one processing cycle.
- S182 Split the compressed data into N compressed data blocks according to the length of each of the N compressed data blocks.
- S183 Decompress the N compressed data blocks by N decompression engines respectively to obtain N original data blocks that correspond to the N compressed data blocks one by one, where the length of any one of the N original data blocks is the length of any one of the original data blocks.
- No more than L1, L1 and L2 are integers greater than 1, and L1 is greater than L2.
- the compressed data block is a compressed data block obtained by using the data compression method described in FIG. 14.
- the compressed data block obtained by using the data compression method described in FIG. 14.
- the decompression device after receiving the compressed data, obtains the compressed data block by reading the length stored in the start field. By analogy, the next compressed data block is obtained, and then N compressed data blocks are obtained. Further, the decompression device sequentially inputs N compressed data blocks into a decompression engine for decompression.
- the compression device may sequentially record the length of each compressed data block in the first file according to the compression order of the data. After the compression device transmits the compressed data including the N compressed data blocks and the first file to the decompression device, the decompression device may divide the received compressed data according to the multiple lengths contained in the first file to obtain N compressed data blocks. . Further, the decompression device sequentially inputs N compressed data blocks into N decompression engines for decompression.
- FIG. 19 is a schematic structural diagram of another decompression device according to an embodiment of the present invention.
- the decompression device 190 may include a controller 1900 and M decompression engines 1901.
- the controller 1900 includes the following units:
- An obtaining unit 1902 is configured to obtain compressed data, where the compressed data includes N compressed data blocks and a length of each compressed data block in the N compressed data blocks, where N is a positive integer, where the N compressed data Any compressed data block in the block is an independent compressed data block with a length no greater than L2, N is a positive integer, M ⁇ N, and a compressed data block with a length of L2 is data that a single decompression engine can process in one processing cycle. Piece;
- a splitting unit 1903 configured to split the compressed data into N compressed data blocks according to the length of each of the N compressed data blocks
- a data distribution unit 1904 is configured to distribute N compressed data blocks to N decompression engines, so that the N decompression engines decompress the N compressed data blocks respectively to obtain a one-to-one correspondence with the N compressed data blocks.
- N original data blocks, the length of each original data block in the N original data blocks is not greater than L1, L1 and L2 are integers greater than 1, and L1 is greater than L2;
- a splicing unit 1905 is configured to splice the N original data blocks to obtain original data.
- each functional unit included in the decompression device 190 can implement the above-mentioned data compression method based on hardware or software. For example, when based on hardware, each unit can be completed based on circuits such as FPGA, ASIC, or when implemented based on software, the CPU can read the memory. The code saved in the can implement the above unit functions to perform the corresponding functions. In order to achieve a faster decompression speed, hardware is used in this application to implement the functions of the relevant units.
- An embodiment of the present application further provides a fourth electronic device that can implement a data decompression function.
- the fourth electronic device may include any one of the decompression devices shown in FIG. 17 or FIG. 19.
- the fourth electronic device 200 includes a processor 2001, a memory 2002, and a decompression device 2003.
- the processor 2001 is connected to the memory 2002 and the decompression device 2003 through a bus 2004.
- the processor 2001 is a control center of the decompression device, and may be one or more CPUs, one or more microprocessors, or one or more FPGAs, which are not limited in the embodiment of the present invention.
- the memory 2002 is used to store data and instructions, and may be a read-only memory, a random access memory, or other memories.
- the processor 2001 is configured to call the instructions of the memory 2002 to implement the functions of the second electronic device.
- the decompression device 2003 is configured to decompress the received compressed data block to restore the original data block.
- the decompression device may be a decompression device as shown in FIG. 17 or 19. It should be noted that, for specific implementation of each function in the decompression device shown in FIG. 20, reference may be made to related descriptions in the method embodiment shown in FIG. 18, which is not repeatedly described in this embodiment of the present application.
- the fourth electronic device may further include a computing device, which is coupled to the decompression device and the processor, and is configured to perform data processing according to the original data obtained by the decompression device.
- a computing device which is coupled to the decompression device and the processor, and is configured to perform data processing according to the original data obtained by the decompression device.
- An embodiment of the present application further provides a compression and decompression system.
- the compression and decompression system may include a compression device and a decompression device.
- the compression device may be any one of the compression devices shown in FIG. 15 or FIG. 17 or any one of the decompression devices shown in FIG. 19. It can be understood that the compression and decompression system can be set in the same electronic device, or can be distributed in different electronic devices.
- An embodiment of the present application further provides a compression and decompression system.
- the compression and decompression system may include a third electronic device and a fourth electronic device.
- the third electronic device and the fourth electronic device may include a third electronic device and a fourth electronic device.
- the third electronic device and the fourth electronic device in this application may be devices such as a personal computer (PC), a mobile phone, a notebook computer, a tablet computer, a server, a gateway, and a router.
- the third electronic device and the fourth electronic device may be disposed in the same electronic device; or may be different devices, which are not limited in the embodiment of the present application.
- the processes may be completed by a computer program instructing related hardware.
- the program may be stored in a computer-readable storage medium.
- When the program is executed, Can include the processes of the method embodiments described above.
- the foregoing storage media include: ROM or random storage memory RAM, magnetic disks, or optical discs, which can store various program code media.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
Description
| 码长(bit) | 编码(二进制) |
| 2 | 00 |
| 3 | 001 |
| 3 | 011 |
| 3 | 100 |
| 3 | 101 |
| 3 | 110 |
| 5 | 11100 |
| 5 | 11101 |
| 5 | 11110 |
| 6 | 111110 |
| 6 | 111111 |
Claims (36)
- 一种数据压缩方法,其特征在于,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,所述方法包括:执行一次或者多次原始数据块压缩,所述原始数据块压缩包括:基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,所述原始数据块为所述原始数据中包括的数据。
- 如权利要求1所述的方法,其特征在于,所述基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块包括:对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
- 如权利要求2所述的方法,其特征在于,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
- 如权利要求3所述的方法,其特征在于,在所述原始数据块的长度等于所述L1时,与所述原始数据块对应的所述规范压缩数据块中的附加数据为合法码字;或所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉;或,在所述原始数据块的长度小于所述L1时,所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉。
- 如权利要求3或4所述的方法,其特征在于,所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块包括:S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;S3、压缩所述待压缩的数据组,压缩完成后执行所述S1;S4、将当前已经压缩得到的数据作为所述压缩数据块;其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述 x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
- 如权利要求3或4所述的方法,其特征在于,所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块包括:将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,所述i为使得所述压缩数据块不大于所述L2的最小正整数;在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
- 如权利要求1-6任一所述的方法,其特征在于,所述L2为单个所述解压引擎的入口位宽。
- 一种压缩装置,其特征在于,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,包括:处理模块,用于基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,所述原始数据块为所述原始数据中包括的数据。
- 如权利要求8所述的压缩装置,其特征在于,所述处理模块包括:压缩单元,用于对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;规范单元,用于在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
- 如权利要求9所述的压缩装置,其特征在于,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
- 如权利要求10所述的压缩装置,其特征在于,在所述原始数据块的长度等于所述L1时,与所述原始数据块对应的所述规范压缩数据块中的附加数据为合法码字;或所述附加数据包括无效标志以及无效数据,其中,所述无 效标志用于指示所述附加数据需要弃掉;或,在所述原始数据块的长度小于所述L1时,所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉。
- 如权利要求10或11所述的压缩装置,其特征在于,所述压缩单元具体用于执行如下步骤:S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;S3、压缩所述待压缩的数据组,压缩完成后执行所述S1;S4、将当前已经压缩得到的数据作为所述压缩数据块;其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
- 如权利要求10或11所述的压缩装置,其特征在于,所述压缩单元具体用于:将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,所述i为使得所述压缩数据块不大于所述L2的最小正整数;在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
- 如权利要求8-13任一所述的压缩装置,其特征在于,所述L2为单个所述解压引擎的入口位宽。
- 一种压缩装置,其特征在于,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,所述压缩装置包括:处理器和存储器,其中,所述存储器用于存储数据和程序指令,所述处理器调用所述存储器存储的数据和程序指令,执行:一次或者多次原始数据块压缩,所述原始数据块压缩包括:基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数 据块,其中,所述原始数据块为所述原始数据中包括的数据。
- 如权利要求15所述的压缩装置,其特征在于,所述处理器执行所述基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,具体包括执行:对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
- 如权利要求16所述的压缩装置,其特征在于,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
- 如权利要求17所述的压缩装置,其特征在于,在所述原始数据块的长度等于所述L1时,与所述原始数据块对应的所述规范压缩数据块中的附加数据为合法码字;或所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉;或,在所述原始数据块的长度小于所述L1时,所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉。
- 如权利要求17或18所述的压缩装置,其特征在于,所述处理器执行所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,具体包括执行如下步骤:S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;S3、压缩所述待压缩的数据组,压缩完成后执行所述S1;S4、将当前已经压缩得到的数据作为所述压缩数据块;其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
- 如权利要求17或18所述的压缩装置,其特征在于,所述处理器执行所述对所述 原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,具体包括执行:将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,所述i为使得所述压缩数据块不大于所述L2的最小正整数;在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
- 如权利要求15-20任一所述的压缩装置,其特征在于,所述L2为单个所述解压引擎的入口位宽。
- 一种具有压缩功能的电子设备,所述电子设备包括压缩装置和处理装置,所述压缩装置为如权利要求8-14任意一项权利要求所述的压缩装置或如权利要求15-21任意一项权利要求所述的压缩装置;所述处理装置用于向所述压缩装置发送所述原始数据。
- 一种解压装置,其特征在于,包括:第一存储器、M个解压引擎和第二存储器,其中,所述第一存储器用于存储多个规范压缩数据块,其中,一个所述规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个所述规范压缩数据块能够被单个所述解压引擎在一个处理周期内解压完成,M为大于1的整数;所述M个解压引擎用于对所述第一存储器存储的规范压缩数据块进行并行解压,一个所述解压引擎用于解压一个所述规范压缩数据块;所述第二存储器用于存储所述规范压缩数据块被解压得到的原始数据块,所述规范压缩数据块与所述原始数据块一一对应。
- 如权利要求23所述的解压装置,其特征在于,所述解压装置还包括拼接电路,所述拼接电路用于将所述第二储存器中存储的原始数据块进行拼接,得到原始数据。
- 如权利要求23或24所述的解压装置,其特征在于,所述M个解压引擎中的每一个解压引擎还用于:在解压得到的原始数据块的长度等于L1时或在识别到所述规范压缩数据块中的无效标志时,停止解压操作。
- 如权利要求23或24所述的解压装置,其特征在于,所述解压装置还包括控制电路,用于:在第一解压引擎解压得到的原始数据块的长度等于所述L1的情况下,停止所述第一解压引擎的解压操作,所述第一解压引擎为所述N个解压引擎中的任意一个解压引擎。
- 如权利要求25或26所述的解压装置,其特征在于,所述解压引擎的出口位宽为所述L1,所述原始数据块的长度不大于所述L1。
- 如权利要求23-27任意一项权利要求所述的解压装置,其特征在于,所述第二存储器包括分别与所述M个解压引擎一一对应的M个存储子单元,所述第一存储子单元用于存储所述第一存储子单元对应的解压引擎所解压得到的原始数据块,第一存储子单元为所述M个存储子单元中的任意一个存储子单元。
- 一种集成电路,其特征在于,所述集成电路包括如权利要求23-28任意一项权利要求所述的解压装置。
- 一种数据解压方法,其特征在于,应用于解压装置,所述解压装置包括M个解压引擎,M为大于1的整数,所述方法包括:获取N个规范压缩数据块,其中,所述N个规范压缩数据块中任意一个规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个所述规范压缩数据块能够被单个所述解压引擎在一个处理周期内解压完成,N为正整数,M≥N;通过N个解压引擎分别对所述N个规范压缩数据块进行并行解压,得到N个原始数据块,所述规范压缩数据块与所述原始数据块一一对应;将所述N个原始数据块进行拼接,得到原始数据。
- 如权利要求30所述的数据解压方法,其特征在于,所述N个原始数据块中任意一个原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
- 如权利要求30或31所述的数据解压方法,其特征在于,第一解压引擎为所述N个解压引擎中的任意一个所述解压引擎,第一规范压缩数据块为所述N个规范压缩数据块中的任意一个规范压缩数据块;所述通过N个解压引擎分别对所述N个规范压缩数据块进行并行解压,得到N个原始数据块,具体包括:通过所述第一解压引擎对所述第一规范压缩数据块进行解压;在所述第一解压引擎解压得到的原始数据块的长度等于所述L1时,停止所述第一解压引擎对所述第一规范压缩数据块的解压操作,输出所述原始数据块;或,在所述第一解压引擎识别到无效标志时,停止所述第一解压引擎对所述第一规范压缩数据块的解压操作,输出当前解压得到的原始数据块。
- 一种具有解压功能的电子设备,其特征在于,包括处理器、存储器以及解压装置,所述处理器耦合所述存储器和所述解压装置,其中,所述解压装置为如权利要求23-28任 意一项权利要求所述的解压装置。
- 一种具有解压功能的电子设备,其特征在于,包括处理器、存储器以及M个解压引擎,所述处理器耦合所述存储器和所述M个解压引擎,所述存储器用于存储数据和程序指令,所述处理器调用所述存储器存储的数据和程序指令,实现如权利要求30-32任一项所述的数据解压方法。
- 一种压缩解压系统,其特征在于,包括压缩装置和解压装置,所述压缩装置为如权利要求8-21任意一项权利要求所述的压缩装置,所述解压装置为如权利要求23-28任意一项权利要求所述的解压装置。
- 一种压缩解压系统,其特征在于,包括第一电子设备和第二电子设备,所述第一电子设备为如权利要求22所述的具有压缩功能的电子设备,所述第二电子设备为如权利要求33或34所述的具有解压功能的电子设备。
Priority Applications (3)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201980051013.2A CN112514264B (zh) | 2018-07-31 | 2019-07-31 | 数据压缩、解压方法及相关装置、电子设备、系统 |
| EP19844866.4A EP3820048B1 (en) | 2018-07-31 | 2019-07-31 | Data compression and decompression method and related apparatus, electronic device, and system |
| US17/162,153 US11463102B2 (en) | 2018-07-31 | 2021-01-29 | Data compression method, data decompression method, and related apparatus, electronic device, and system |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201810859928.3A CN110784225A (zh) | 2018-07-31 | 2018-07-31 | 数据压缩、解压方法及相关装置、电子设备、系统 |
| CN201810859928.3 | 2018-07-31 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US17/162,153 Continuation US11463102B2 (en) | 2018-07-31 | 2021-01-29 | Data compression method, data decompression method, and related apparatus, electronic device, and system |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2020025006A1 true WO2020025006A1 (zh) | 2020-02-06 |
Family
ID=69232373
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2019/098758 Ceased WO2020025006A1 (zh) | 2018-07-31 | 2019-07-31 | 数据压缩、解压方法及相关装置、电子设备、系统 |
Country Status (4)
| Country | Link |
|---|---|
| US (1) | US11463102B2 (zh) |
| EP (1) | EP3820048B1 (zh) |
| CN (2) | CN110784225A (zh) |
| WO (1) | WO2020025006A1 (zh) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111884658A (zh) * | 2020-07-09 | 2020-11-03 | 上海兆芯集成电路有限公司 | 数据解压缩方法、数据压缩方法及卷积运算装置 |
| EP4290775A4 (en) * | 2021-03-30 | 2024-07-17 | Huawei Technologies Co., Ltd. | Data compression method and apparatus |
Families Citing this family (16)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US11144207B2 (en) * | 2019-11-07 | 2021-10-12 | International Business Machines Corporation | Accelerating memory compression of a physically scattered buffer |
| CN113497627B (zh) * | 2020-03-20 | 2025-05-16 | 华为技术有限公司 | 一种数据压缩和解压缩方法、装置及系统 |
| CN112104658B (zh) * | 2020-09-17 | 2022-08-12 | 山东方寸微电子科技有限公司 | 一种报文压缩方法及系统 |
| CN113326001B (zh) * | 2021-05-20 | 2023-08-01 | 锐掣(杭州)科技有限公司 | 数据处理方法、装置、设备、系统、介质及程序 |
| CN113641643A (zh) * | 2021-07-02 | 2021-11-12 | 阿里巴巴新加坡控股有限公司 | 文件写入方法及装置 |
| CN113726341B (zh) * | 2021-08-25 | 2023-09-01 | 杭州海康威视数字技术股份有限公司 | 一种数据处理方法、装置、电子设备及存储介质 |
| CN113590051B (zh) * | 2021-09-29 | 2022-03-18 | 阿里云计算有限公司 | 数据存储和读取方法、装置、电子设备及介质 |
| CN114640354B (zh) * | 2022-03-24 | 2025-11-04 | 苏州登临科技有限公司 | 数据压缩方法、装置、电子设备及计算机可读存储介质 |
| CN117335810A (zh) * | 2022-06-23 | 2024-01-02 | 加特兰微电子科技(上海)有限公司 | 数据压缩、解压缩方法及装置 |
| CN116634029B (zh) * | 2023-07-21 | 2023-09-29 | 众科云(北京)科技有限公司 | 基于区块链的用工平台数据快速传输方法 |
| CN116634167B (zh) * | 2023-07-24 | 2023-11-07 | 中国科学院空天信息创新研究院 | 卫星成像数据存储及提取方法 |
| CN117097346B (zh) * | 2023-10-19 | 2024-03-19 | 深圳大普微电子股份有限公司 | 一种解压器及数据解压方法、系统、设备、计算机介质 |
| CN120567194A (zh) * | 2024-02-27 | 2025-08-29 | 深圳市真迈生物科技有限公司 | 数据解压方法、装置、电子设备、存储介质以及测序仪 |
| US20250293708A1 (en) * | 2024-03-18 | 2025-09-18 | WaveXR, Inc. | Method for Compressing and Serializing Complex Time Series Data |
| US12639071B2 (en) * | 2024-03-26 | 2026-05-26 | Xilinx, Inc. | Data packing for power and area-efficient memory structures and performance-efficient decoding of encoded data |
| CN121597610A (zh) * | 2024-08-14 | 2026-03-03 | 阿里巴巴达摩院(杭州)科技有限公司 | 总线控制单元、处理装置、片上系统、总线控制方法、以及计算机存储介质 |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1247669A (zh) * | 1996-12-18 | 2000-03-15 | 汤姆森消费电子有限公司 | 有效的固定长度块压缩和解压 |
| US20110043387A1 (en) * | 2009-08-20 | 2011-02-24 | International Business Machines Corporation | Data compression using a nested hierachy of fixed phrase length static and dynamic dictionaries |
| CN103384884A (zh) * | 2012-12-11 | 2013-11-06 | 华为技术有限公司 | 一种文件压缩方法、文件解压缩方法、装置及服务器 |
Family Cites Families (21)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US5572209A (en) * | 1994-08-16 | 1996-11-05 | International Business Machines Corporation | Method and apparatus for compressing and decompressing data |
| US5654703A (en) * | 1996-06-17 | 1997-08-05 | Hewlett-Packard Company | Parallel data compression and decompression |
| US6668015B1 (en) * | 1996-12-18 | 2003-12-23 | Thomson Licensing S.A. | Efficient fixed-length block compression and decompression |
| US6819271B2 (en) * | 1999-01-29 | 2004-11-16 | Quickshift, Inc. | Parallel compression and decompression system and method having multiple parallel compression and decompression engines |
| US7095343B2 (en) * | 2001-10-09 | 2006-08-22 | Trustees Of Princeton University | code compression algorithms and architectures for embedded systems |
| US6577254B2 (en) * | 2001-11-14 | 2003-06-10 | Hewlett-Packard Development Company, L.P. | Data compression/decompression system |
| US7800519B2 (en) * | 2008-09-30 | 2010-09-21 | Apple Inc. | Method and apparatus for compressing and decompressing data |
| US9940230B2 (en) * | 2010-10-22 | 2018-04-10 | Cnex Labs, Inc. | Compression and decompression of data at high speed in solid state storage |
| JP2013085071A (ja) * | 2011-10-07 | 2013-05-09 | Fujitsu Ltd | データ圧縮装置、及び方法 |
| US8497788B1 (en) * | 2012-04-25 | 2013-07-30 | Pure Storage Inc. | Efficient techniques for aligned fixed-length compression |
| CN103458460B (zh) * | 2012-05-31 | 2017-04-12 | 国际商业机器公司 | 对信号数据进行压缩和解压缩的方法和装置 |
| US8847798B2 (en) * | 2012-12-17 | 2014-09-30 | Maxeler Technologies, Ltd. | Systems and methods for data compression and parallel, pipelined decompression |
| US10019457B1 (en) * | 2013-01-22 | 2018-07-10 | Amazon Technologies, Inc. | Multi-level compression for storing data in a data store |
| US9510008B2 (en) * | 2013-11-25 | 2016-11-29 | Entropic Communications, Llc | Video decoder memory bandwidth compression |
| US20150227540A1 (en) * | 2014-02-12 | 2015-08-13 | Hitachi, Ltd. | System and method for content-aware data compression |
| US9413386B1 (en) * | 2015-02-19 | 2016-08-09 | Qualcomm Incorporated | System, apparatus, and method for decompressing data |
| CN104753540B (zh) * | 2015-03-05 | 2019-02-26 | 华为技术有限公司 | 数据压缩方法、数据解压方法和装置 |
| US10277248B2 (en) * | 2015-07-07 | 2019-04-30 | Tidal Systems, Inc. | Compression engine with consistent throughput |
| CN106503165A (zh) * | 2016-10-31 | 2017-03-15 | 杭州华为数字技术有限公司 | 压缩、解压方法、装置以及设备 |
| CN106849956B (zh) * | 2016-12-30 | 2020-07-07 | 华为机器有限公司 | 压缩方法、解压缩方法、装置和数据处理系统 |
| CN108134609A (zh) * | 2017-12-21 | 2018-06-08 | 深圳大学 | 一种通用数据gz格式的多线程压缩与解压方法及装置 |
-
2018
- 2018-07-31 CN CN201810859928.3A patent/CN110784225A/zh active Pending
-
2019
- 2019-07-31 EP EP19844866.4A patent/EP3820048B1/en active Active
- 2019-07-31 WO PCT/CN2019/098758 patent/WO2020025006A1/zh not_active Ceased
- 2019-07-31 CN CN201980051013.2A patent/CN112514264B/zh active Active
-
2021
- 2021-01-29 US US17/162,153 patent/US11463102B2/en active Active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1247669A (zh) * | 1996-12-18 | 2000-03-15 | 汤姆森消费电子有限公司 | 有效的固定长度块压缩和解压 |
| US20110043387A1 (en) * | 2009-08-20 | 2011-02-24 | International Business Machines Corporation | Data compression using a nested hierachy of fixed phrase length static and dynamic dictionaries |
| CN103384884A (zh) * | 2012-12-11 | 2013-11-06 | 华为技术有限公司 | 一种文件压缩方法、文件解压缩方法、装置及服务器 |
Non-Patent Citations (1)
| Title |
|---|
| See also references of EP3820048A4 |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111884658A (zh) * | 2020-07-09 | 2020-11-03 | 上海兆芯集成电路有限公司 | 数据解压缩方法、数据压缩方法及卷积运算装置 |
| EP4290775A4 (en) * | 2021-03-30 | 2024-07-17 | Huawei Technologies Co., Ltd. | Data compression method and apparatus |
Also Published As
| Publication number | Publication date |
|---|---|
| EP3820048A1 (en) | 2021-05-12 |
| EP3820048A4 (en) | 2021-09-01 |
| CN112514264A (zh) | 2021-03-16 |
| CN110784225A (zh) | 2020-02-11 |
| EP3820048B1 (en) | 2025-07-30 |
| US11463102B2 (en) | 2022-10-04 |
| US20210152183A1 (en) | 2021-05-20 |
| CN112514264B (zh) | 2025-01-10 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN112514264B (zh) | 数据压缩、解压方法及相关装置、电子设备、系统 | |
| US11775320B2 (en) | Overflow detection and correction in state machine engines | |
| CN107565971B (zh) | 一种数据压缩方法及装置 | |
| US7924183B2 (en) | Method and system for reducing required storage during decompression of a compressed file | |
| US9836248B2 (en) | In-memory data compression complementary to host data compression | |
| US11955995B2 (en) | Apparatus and method for two-stage lossless data compression, and two-stage lossless data decompression | |
| US9973210B1 (en) | Reduction of execution stalls of LZ4 decompression via parallelization | |
| CN107888197A (zh) | 一种数据压缩方法和装置 | |
| CN104487956A (zh) | 用于使用状态机引擎中的状态向量数据的方法及系统 | |
| CN113300715A (zh) | 一种数据处理方法、装置、硬件压缩设备以及介质 | |
| US9864536B2 (en) | System and method for conserving power consumption in a memory system | |
| CN108932315A (zh) | 一种数据解压的方法以及相关装置 | |
| CN113497627B (zh) | 一种数据压缩和解压缩方法、装置及系统 | |
| Zhao et al. | Implementation of the LZMA compression algorithm on FPGA | |
| WO2023231571A1 (zh) | 数据压缩方法及装置 | |
| CN114070327B (zh) | 一种fpga码流数据的压缩及解压缩方法 | |
| WO2024066753A1 (zh) | 压缩数据的方法和相关装置 | |
| US12405893B2 (en) | Technology for early abort of compression acceleration | |
| CN111382856A (zh) | 数据处理装置、方法、芯片及电子设备 | |
| CN111382852B (zh) | 数据处理装置、方法、芯片及电子设备 | |
| US20260099249A1 (en) | Self-managed dram modules with built-in adaptive data compression | |
| US20180041612A1 (en) | System and method for out-of-stream order compression of multi-media tiles in a system on a chip | |
| CN111382853A (zh) | 数据处理装置、方法、芯片及电子设备 | |
| US10411731B1 (en) | Device and method of compressing data using tiered data compression | |
| TW202606227A (zh) | 用於隨機張量存取之基於區塊之編碼及解碼 |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19844866 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| ENP | Entry into the national phase |
Ref document number: 2019844866 Country of ref document: EP Effective date: 20210203 |
|
| WWG | Wipo information: grant in national office |
Ref document number: 201980051013.2 Country of ref document: CN |
|
| WWG | Wipo information: grant in national office |
Ref document number: 2019844866 Country of ref document: EP |