WO2020025006A1 - 数据压缩、解压方法及相关装置、电子设备、系统 - Google Patents

数据压缩、解压方法及相关装置、电子设备、系统 Download PDF

Info

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
Application number
PCT/CN2019/098758
Other languages
English (en)
French (fr)
Inventor
陆超
刘保庆
何雷骏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201980051013.2A priority Critical patent/CN112514264B/zh
Priority to EP19844866.4A priority patent/EP3820048B1/en
Publication of WO2020025006A1 publication Critical patent/WO2020025006A1/zh
Priority to US17/162,153 priority patent/US11463102B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

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

本申请实施例公开了一种数据压缩、解压方法及相关装置、电子设备、系统,该数据压缩方法基于压缩算法对原始数据中的原始数据块进行处理以得到与原始数据块对应的长度为L2的规范压缩数据块,进而将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,解压装置包括多个解压引擎,每个解压引擎在一个处理周期内能够对一个规范压缩数据块进行解压。通过执行本发明实施例的数据压缩方法可以压缩成长度为固定值的规范压缩数据块,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,提高数据的解压效率。

Description

数据压缩、解压方法及相关装置、电子设备、系统
本申请要求于2018年07月31日提交中国国家知识产权局、申请号为201810859928.3、申请名称为“数据压缩、解压方法及相关装置、电子设备、系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及数据压缩技术领域,尤其涉及一种数据压缩、解压方法及相关装置、电子设备、系统。
背景技术
对于数据量较大的运算,例如,视频、图像处理或者机器学习等运算通常使用硬件芯片进行加速。在硬件芯片进行数据处理的过程中往往需要从外部存储器实时导入大量的数据。例如,机器学习的硬件加速是一种通过硬件芯片来执行机器学习算法而实现计算加速的技术。在运行机器学习算法时,往往需要大量参数。这些参数无法完全保存在硬件芯片内部,因此在机器学习算法运行时,需要从外部实时导入大量参数。由于实时导入大量参数占用芯片的输入/输出(Input/Output,I/O)带宽,当I/O带宽不足时,导致硬件芯片的计算能力空置,降低机器学习算法的运行速度。
通过对外部参数的离线压缩来减小外部参数的体积,并在硬件芯片内通过解压引擎进行实时在线解压还原出外部参数,可以实现在相同的I/O带宽下传输更多的外部参数。然而,解压引擎所能到达的解压速率有限,同样限制了机器学习算法的运行速度。
目前,提高硬件芯片解压速率的常用方法为多引擎并行解压。如图1所示的现有技术中多解压引擎解压的原理示意图。在电子设备对一个待压缩文件进行压缩时,将待压缩文件拆分为等长的多个原始数据块,对该多个原始数据块分别进行压缩生成与各个原始数据块一一对应的压缩数据块;在解压时,首先获取多个压缩数据块,将该多个压缩数据块分配到多个解压引擎中,多个解压引擎还原出多个原始数据块,再将多个原始数据块拼接成原始文件(即待压缩文件)。
可见,现有技术中由于各个原始数据块的压缩率不同,得到的各个压缩数据块的长度不同,使得各个解压引擎分别对各个压缩数据块进行解压所需要的时间不同,解压装置在最后一个压缩数据块完成解压时,才能将各个解压引擎还原出的原始数据块拼接出需要的数据,解压效率低。
发明内容
本发明实施例所要解决的技术问题在于,提供一种数据压缩方法、数据解压方法及相关装置、电子设备、系统,通过规范原始数据的压缩过程,生成的规范压缩数据块,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,提高数据的解压效率。
第一方面,本发明实施例提供了一种数据压缩方法,可以应用于包第一电子设备或压 缩装置,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,解压装置包括多个解压引擎,每个解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,该方法包括:执行一次或者多次原始数据块压缩,其中,原始数据块压缩包括:基于压缩算法对原始数据块进行处理以得到与原始数据块对应的规范压缩数据块,其中,原始数据块为所述原始数据中包括的数据。
通过执行本发明实施例的数据压缩方法可以压缩成长度为固定值的规范压缩数据块,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,提高数据的解压效率。
在本申请实施例的一种实现中,第一电子设备或压缩装置基于压缩算法对原始数据块进行处理以得到与原始数据块对应的规范压缩数据块的一种实现可以包括:解压装置对原始数据块通过压缩算法进行独立压缩,得到与原始数据块对应的压缩数据块,该压缩数据块的长度d不大于所述L2;进而,在该压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为L2的规范压缩数据块,d为大于0的整数。
在本申请实施例的另一种实现中,压缩装置或第一电子设备的处理器将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到该S个原始数据块一一对应的S个压缩数据块,该S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,该S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数;进而,在该S个压缩数据块中的每一个压缩数据块之后添加长度为L2-d的附加数据,生成S个长度为L2的规范压缩数据块,其中,该长度为L2的规范数据块为解压装置中的单个解压引擎能够在一个处理周期内处理完的数据块,L1以及L2为大于1的整数,d为大于0的整数,L1大于所述L2。可以理解,该数据压缩方法的执行主体可以是第一电子设备或压缩装置,下面以执行主体压缩装置为例来说明。
通过执行上述方法,在对原始数据进行压缩时,生成的S个规范压缩数据块长度为固定值L2,且生成该规范压缩数据块的原始数据块的长度不大于L1,规范了原始数据压缩生成的压缩数据块的长度,并且,各个规范压缩数据块为独立压缩的,进而可独立解压,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,都可以在一个处理周期内完成对特定长度数据的处理,不需要等待解压最慢的一个解压引擎的输出,从而解决了木桶原理(Cannikin Law)中的“短板”的问题,提高数据的解压效率。而且,相对于压缩成变长的压缩数据块,本申请设置成固定长度L2的规范压缩数据块,压缩端不需要记录各个压缩数据块的长度,解压端也不需要记录获取到的数据长度,使得解压端的设计更加简单。
进一步地,现有技术中,原始数据划分的原始数据块的个数等于解压引擎的个数,即解压引擎的个数限制了原始数据可划分的粒度,使得原始数据所压缩形成的多个压缩数据块的长度较大。当对随机地址的数据进行访问时,需要将该随机地址的数据所在的压缩数据块进行解压。在解压的过程中,由于压缩数据块中数据的关联性,该压缩数据块只能在一个解压引擎进行解压,无法实现压缩数据的倍速解压。执行上述方法所述的技术方案,原始数据可划分的粒度与解压引擎的个数无关,原始数据可以被压缩为大量较小的规范压缩数据块,各个规范压缩数据块之间不存在关联性,当对随机地址的数据进行访问时,将该随机地址的数据所在的多个连续的规范压缩数据块输入到多个解压引擎中进行解压,可 实现对随机地址的压缩数据的倍速解压。
在一种可能的实现方式中,第一原始数据块为所述S个原始数据块中的任意一个原始数据块,其中,在第一原始数据块的长度等于L1时,该第一原始数据块压缩得到的规范数据块中的附加数据为合法码字或该附加数据包括无效标志和无效数据。在第一原始数据块的长度小于L1时,该附加数据包括无效标志和无效数据。其中,无效标志用于指示该无效标志所在的附加数据需要弃掉;无效数据在该无效标志后面,可以包括大于等于0位数据。通过上述各种方式设置无效数据或者无效标志,可以让解压引擎停止解压,从而在得到正确的数据的同时,还能够减少解压操作,从而降低解压功耗。
可选地,当一个处理周期包括多个时钟周期的情况下,上述该第一原始数据块压缩得到的规范压缩数据块中的附加数据包括无效标志和无效数据。其中,无效标志用于指示该无效标志所在的附加数据需要弃掉;无效数据在该无效标志后面,可以包括大于等于0位数据。
在又一种可能的实现方式中,压缩装置对原始数据块通过压缩算法进行独立压缩,得到与原始数据块对应的压缩数据块的一种实现方式可以包括如下步骤:S1、从原始数据中获取一个待压缩的数据组,数据组包括一个或多个比特的数据;S2、判断是否需要对该待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;S3、压缩该待压缩的数据块组,压缩完成后执行所述S1;S4、将当前已经压缩得到的数据作为压缩数据块;其中,判断是否需要对该待压缩的数据组进行压缩的一种实现方式可以包括:若已被压缩的一个或多个数据组的总长度x与该待压缩的数据组的长度Δx之和不大于L1且在该待压缩的数据组被压缩后生成的压缩数据块长度不大于L2,则确定需要进行压缩;若x与Δx之和不大于L1且在该待压缩的数据组被压缩后生成的压缩数据块长度大于L2,则确定不需要进行压缩;若x与Δx之和大于L1,则确定不需要进行压缩。
通过上述方法,可以实现对数据块的压缩,具有实现简单,效率高的优点。
在又一种可能的实现方式中,压缩装置对原始数据块通过压缩算法进行独立压缩,得到与原始数据块对应的压缩数据块的另一实现方式可以是:压缩装置将原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;在该临时压缩数据块的长度大于L2时,将该长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为原始数据块,并将原始数据块压缩得到的数据作为压缩数据块,其中,所述压缩数据块的长度不大于所述L2,i为正整数,且i<L1;在该临时压缩数据块的长度不大于L2时,将该长度为L1的数据块即为原始数据块,该临时压缩数据块即为压缩数据块。上述方法给出了另一种具体的实现方式,同时具有实现简单,压缩效率高的优点。
可选地,i为使得压缩数据块不大于所述L2的最小正整数。i越小,表明压缩的数据更多,从而可以增加压缩效率。
在又一种可能的实现方式中,L1为单个解压引擎的出口位宽;L2为单个解压引擎的入口位宽。这样,可以尽可能地利用现有的硬件资源来提升每次压缩的数据量,从而增加压缩效率。
第二方面,本申请实施例还提供了一种压缩装置,包括:用于将原始数据压缩成供解 压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,包括:处理模块,用于基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,所述原始数据块为所述原始数据中包括的数据。
在一种可能的实现中,所述处理模块包括:
压缩单元,用于对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;
规范单元,用于在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
可选地,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,L1为所述解压引擎的出口位宽。
在一种可能的实现中,所述处理模块可以包括:
压缩单元,用于将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数;
规范单元,用于在所述S个压缩数据块中的每一个压缩数据块之后添加长度为L2-d的附加数据,生成S个长度为L2的规范压缩数据块,其中,所述长度为L2的规范数据块为解压装置中的单个解压引擎能够在一个处理周期内解压完成的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于所述L2。
在一种可能的实现方式中,在原始数据块的长度等于L1时,该原始数据块压缩得到的规范数据块中的附加数据为合法码字;或该附加数据包括无效标志以及无效数据,其中,无效标志用于指示所述附加数据需要弃掉;或,
在原始数据块的长度小于L1时,该附加数据包括无效标志以及无效数据,其中,无效标志用于指示所述附加数据需要弃掉。
在又一种可能的实现方式中,所述压缩单元具体包括用于执行如下步骤:
S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;
S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
S3、压缩所述待压缩的数据块组,压缩完成后执行所述S1;
S4、将当前已经压缩得到的数据作为所述压缩数据块;
其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于 L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
在又一种可能的实现方式中,所述压缩单元具体包括用于执行如下步骤:
将原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
在所述临时压缩数据块的长度大于L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,i为正整数,且i<L1;
在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
可选地,所述i为使得所述压缩数据块不大于所述L2的最小正整数。
在又一种可能的实现方式中,所述L1为单个解压引擎的出口位宽;和/或所述L2为单个解压引擎的入口位宽。
第三方面,本申请实施例还提供了一种压缩装置,包括:处理器和存储器,其中,所述存储器用于存储数据和程序指令,当所述处理器调用所述存储器存储数据和程序指令,使得压缩装置实现如第一方面所述的任意一种数据压缩方法。
第四方面,本申请实施例还提供了一种具有压缩功能的电子设备,具体为本申请实施例中第一电子设备,该电子设备包括压缩装置和处理装置,该压缩装置可以是如第二方面或第三方面所述的任意一种压缩装置;所述处理装置用于向所述压缩装置发送前文所述的原始数据。
第五方面,本申请实施例还提供了一种计算机存储介质,所述计算机存储介质用于存储计算机软件指令,所述计算机软件指令当被计算机执行时使所述计算机实现如第一方面所述的任意一种数据压缩方法。
第六方面,本申请实施例还提供了一种计算机程序,所述计算机程序包括计算机软件指令,所述计算机软件指令当被计算机执行时使所述计算机实现如第一方面所述的任意一种数据压缩方法。
第七方面,本申请实施例还提供了一种解压装置,包括:第一存储器、M个解压引擎和第二存储器,其中,所述第一存储器用于存储多个规范压缩数据块(例如N个规范压缩数据块),其中,一个所述规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个所述规范压缩数据块能够被单个所述解压引擎在一个处理周期内解压完成,M为大于1的整数,M、N为正整数,M≥N;所述M个解压引擎用于对所述第一存储器存储的规范压缩数据块进行并行解压,一个所述解压引擎用于解压一个所述规范压缩数据块,例如,M个解压引擎中包括N个解压引擎,N个解压引擎中的每一个解压引擎用于获取所述N个规范压缩数据块中的一个规范压缩数据块,并对获取到的规范压缩数据块 进行解压,得到与所述N个规范压缩数据块一一对应的N个原始数据块
所述第二存储器用于存储所述规范压缩数据块被解压得到的原始数据块,例如N个原始数据块,所述规范压缩数据块与所述原始数据块一一对应。
可选地,所述原始数据块的长度不大于L1,所述解压引擎的出口位宽为所述L1。
上述实施例提供的解压装置,多个规范压缩数据块分别通过多个解压引擎进行并行解压,使得各个解压引擎在解压该多个规范压缩数据块时可以并行解压,提高数据的解压效率。而且,相对于压缩成变长的压缩数据块,本申请设置成固定长度L2的规范压缩数据块,压缩端不需要记录各个压缩数据块的长度,解压端也不需要记录获取到的数据长度,使得解压端的设计更加简单。
进一步地,现有技术中,原始数据划分的原始数据块的个数等于解压引擎的个数,即解压引擎的个数限制了原始数据可划分的粒度,使得原始数据所压缩形成的多个压缩数据块的长度较大。当对随机地址的数据进行访问时,需要将该随机地址的数据所在的压缩数据块进行解压。在解压的过程中,由于压缩数据块中数据的关联性,该压缩数据块只能在一个解压引擎进行解压,无法实现压缩数据的倍速解压。通过上述解压装置,原始数据可划分的粒度与解压引擎的个数无关,原始数据可以被压缩为大量较小规范压缩数据块,当对随机地址的数据进行访问时,将该随机地址的数据所在的多个连续的规范压缩数据块输入到多个解压引擎中进行解压,可实现对随机地址的压缩数据的倍速解压。
在一种可能的实现方式中,所述解压装置还包括拼接电路,所述拼接电路用于将第二储存器中存储的原始数据块进行拼接,得到原始数据。这样,可以完成对原始数据的解压,并给后续的处理电路进行处理,保证了数据的不丢失。
在一个实施例中,解压装置还可以包括长度计数器,用于对解压出来的数据的长度进行记录,这样,拼接电路就可以根据长度计数器中的数值来获取特定长度的数据进行拼接。
在又一种可能的实现方式中,所述M个解压引擎中的每一个解压引擎还用于:在解压得到的原始数据块的长度等于所述L1时或在识别到无效标志时,停止解压操作。通过识别无效标志来停止解压,在保证得到正确的数据的前提下,可以节省解压操作,减少功耗。
在又一种可能的实现方式中,所述解压装置还包括控制电路,用于:在第一解压引擎解压得到的原始数据块的长度等于所述L1的情况下,停止所述第一解压引擎的解压操作,所述第一解压引擎为所述M个解压引擎中的任意一个解压引擎。通过判断得到了需要长度的数据(L1)后停止解压,在保证得到正确的数据的前提下,可以节省解压操作,减少功耗。
在又一种可能的实现方式中,所述第二存储器包括分别与所述M个解压引擎一一对应的M个存储子单元,所述第一存储子单元用于存储所述第一存储子单元对应的解压引擎所解压得到的原始数据块,第一存储子单元为所述M个存储子单元中的任意一个存储子单元。
其中,解压引擎、各个电路(如控制电路、拼接电路)可以基于硬件电路(如FPGA、ASIC)实现的,这样,可以增加处理速率,从而提升解压速度。
第八方面,本申请实施例还提供了一种集成电路,包括:如第七方面所述的任意一种解压装置。
可选地,该集成电路还可以包括耦合于所述解压装置的运算装置,所述运算装置用于根据所述解压装置解压得到的原始数据进行数据处理。
第九方面,本申请实施例还提供了一种数据解压方法,应用于解压装置,所述解压装置包括M个解压引擎,M为正整数,该方法包括:解压装置获取N个规范压缩数据块,其中,所述N个规范压缩数据块中任意一个规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,该长度为L2规范压缩数据块为单个解压引擎能够在一个处理周期内解压完成的数据块,N为正整数,M≥N;通过N个解压引擎分别对所述N个规范压缩数据块进行解压,得到与所述N个规范压缩数据块一一对应N个原始数据块;将所述N个原始数据块进行拼接,得到原始数据,其中,所述L1以及所述L2为大于1的整数,所述L1大于所述L2。
通过执行上述方法,N个长度为L2的规范压缩数据块分别通过N个解压引擎进行同步解压,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,提高数据的解压效率。
而且,相对于压缩成变长的压缩数据块,本申请设置成固定长度L2的规范压缩数据块,压缩端不需要记录各个压缩数据块的长度,解压端也不需要记录获取到的数据长度,使得解压端的设计更加简单。
进一步地,现有技术中,原始数据划分的原始数据块的个数等于解压引擎的个数,即解压引擎的个数限制了原始数据可划分的粒度,使得原始数据所压缩形成的多个压缩数据块的长度较大。当对随机地址的数据进行访问时,需要将该随机地址的数据所在的压缩数据块进行解压。在解压的过程中,由于压缩数据块中数据的关联性,该压缩数据块只能在一个解压引擎进行解压,无法实现压缩数据的倍速解压。执行上述方法所述的技术方案,原始数据可划分的粒度与解压引擎的个数无关,原始数据可以被压缩为大量较小规范压缩数据块,当对随机地址的数据进行访问时,将该随机地址的数据所在的多个连续的规范压缩数据块输入到多个解压引擎中进行解压,可实现对随机地址的压缩数据的倍速解压。
在一种可能的实现方式中,所述N个解压引擎包括所述解压引擎k,所述N个压缩数据块包括压缩数据块k,所述N个原始数据块包括所述压缩数据块k解压得到的原始数据块k,k为正整数,k不大于N;所述通过N个解压引擎分别对所述N个规范压缩数据块进行解压,得到所述N个压缩数据块一一对应N个原始数据块,具体包括:
通过所述解压引擎k对于所述压缩数据块k进行解压;
在所述解压引擎k解压得到的原始数据块k的长度等于所述L1时,停止所述解压引擎k对所述压缩数据块k的解压操作,输出所述原始数据块k;或,在所述解压引擎k识别到无效标志时,停止所述解压引擎k对所述压缩数据块k的解压操作,输出解压得到的所述原始数据块k。
第十方面,本申请实施例还提供了一种具有解压功能的电子设备,具体可以是本申请实施例中第二电子设备,可以包括处理器、耦合该处理器的存储器和解压装置,其中该解压装置为如第七方面所述的任意一种解压装置,处理器用于调用所述存储器存储的数据和 指令实现所述第二电子设备的功能。
第十一方面,本申请实施例还提供了一种压缩解压系统,该系统包括压缩装置为第二方面或第三方面所述的任意一种压缩装置,所述解压装置为如第七方面所述的任意一种解压装置。
第十二方面,本申请实施例还提供了一种压缩解压系统,包括第一电子设备和第二电子设备,所述第一电子设备为如第四方面所述的具有压缩功能的电子设备,所述第二电子设备为如第十方面所述的具有解压功能的电子设备。
第十三方面,本申请实施例还提供了一种数据压缩方法,包括:
将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于L2;
记录所述S个压缩数据块中每一个压缩数据块的长度。
上述数据压缩方法可以应用于压缩装置或具有压缩功能的第三电子设备,此处以压缩装置为例来说明。
与第一方面所述的数据压缩方法不同的是,第一方面所述数据压缩方法最终得到规范压缩数据块,其长度固定为L2,通过在压缩原始数据块得到的压缩数据块之后增加附加数据来实现。上述实施例中,压缩原始数据块得到的压缩数据块即为最终得到的压缩的数据块,其长度可变,压缩设备需要记录该各个压缩数据块的长度,以使解压设备可以对不同长度的压缩数据块进行区分。
同第一方面,通过执行上述方法,在对原始数据进行压缩时,生成的S个压缩数据块长度小于L2,使得各个解压引擎在分别解压第一压缩数据块都可以在一个处理周期内完成,进而实现各个解压引擎的同步解压,提高数据的解压效率。
进一步地,现有技术中,原始数据划分的原始数据块的个数等于解压引擎的个数,即解压引擎的个数限制了原始数据可划分的粒度,使得原始数据所压缩形成的多个压缩数据块的长度较大。当对随机地址的数据进行访问时,需要将该随机地址的数据所在的压缩数据块进行解压。在解压的过程中,由于压缩数据块中数据的关联性,该压缩数据块只能在一个解压引擎进行解压,无法实现压缩数据的倍速解压。执行上述方法所述的技术方案,原始数据可划分的粒度与解压引擎的个数无关,原始数据可以被压缩为大量较小压缩数据块,当对随机地址的数据进行访问时,将该随机地址的数据所在的多个连续的规范压缩数据块输入到多个解压引擎中进行解压,可实现对随机地址的压缩数据的倍速解压。
在一种可能的实现方式中,第一原始数据块为所述S个原始数据块中的任意一个原始数据块,第一压缩数据块为与所述S个压缩数据块中与所述第一原始数据块对应的压缩数 据块,压缩装置将第一原始数据块通过压缩算法进行独立压缩,得到第一压缩数据块的一种实现方式可以包括:
S1、获取一个待压缩的数据组;
S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
S3、压缩所述待压缩的数据块组,压缩完成后执行所述S1;
S4、将当前已经压缩得到的数据作为作为所述第一压缩数据块;
其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
在又一种可能的实现方式中,第一原始数据块为所述S个原始数据块中的任意一个原始数据块,第一压缩数据块为与所述S个压缩数据块中与所述第一原始数据块对应的压缩数据块,压缩装置将原始数据中第一原始数据块通过压缩算法进行独立压缩,得到第一压缩数据块的另一实现方式可以是:
压缩装置将原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述第一原始数据块,并将所述第一原始数据块压缩得到的数据作为所述第一压缩数据块,其中,所述第一压缩数据块的长度不大于所述L2,i为正整数,且i<L1;
在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述第一原始数据块,将所述临时压缩数据块作为所述第一压缩数据块。
可选地,所述i为使得所述第一压缩数据块不大于所述L2的最小正整数。
在一种可能的实现方式中,第三电子设备或压缩装置记录第一压缩数据块的长度的一种实施方式可以是:
压缩装置将第一压缩数据块的长度d记录在第一压缩数据块的起始字段内,该起始字段为从第一压缩数据块起始位开始且长度为第三长度阈值的字段内;或者,
将第一压缩数据块的长度d写入第一文件;该第一文件包括第二压缩设备依次压缩原始数据得到的S个压缩数据块分别对应的长度。
第十四方面,本申请实施例还提供了一种压缩装置,包括:
压缩单元,用于将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正 整数,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于L2;
记录单元,用于记录所述S个压缩数据块中每一个压缩数据块的长度。
在一种可能的实现方式中,第一原始数据块为所述S个原始数据块中的任意一个原始数据块,第一压缩数据块为与所述S个压缩数据块中与所述第一原始数据块对应的压缩数据块,所述压缩单元包括用于执行:
S1、获取一个待压缩的数据组;
S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
S3、压缩所述待压缩的数据块组,压缩完成后执行所述S1;
S4、将当前已经压缩得到的数据作为作为所述第一压缩数据块;
其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
在又一种可能的实现方式中,第一原始数据块为所述S个原始数据块中的任意一个原始数据块,第一压缩数据块为与所述S个压缩数据块中与所述第一原始数据块对应的压缩数据块,所述压缩单元包括具体用于:
将原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述第一原始数据块,并将所述第一原始数据块压缩得到的数据作为所述第一压缩数据块,其中,所述第一压缩数据块的长度不大于所述L2,i为正整数,且i<L1;
在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述第一原始数据块,将所述临时压缩数据块作为所述第一压缩数据块。
可选地,所述i为使得所述第一压缩数据块不大于所述L2的最小正整数。
在一种可能的实现方式中,记录单元具体用于:
将第一压缩数据块的长度d记录在第一压缩数据块的起始字段内,该起始字段为从第一压缩数据块起始位开始且长度为长度第三长度阈值的字段内;或者,
记录将第一压缩数据块的长度d写入第一文件;该第一文件包括第二压缩设备依次压缩原始数据得到的多个第一压缩数据块分别对应的长度。
第十五方面,本申请实施例还提供了一种压缩装置,包括:处理器和存储器,其中,所述存储器用于存储数据和程序指令,所述处理器调用所述存储器存储数据和程序指令,执行如第十三方面所述的数据压缩方法。
第十六方面,本申请实施例还提供了一种具有压缩功能的电子设备,具体可以是本申请实施例中的第三电子设备,包括:如第十四方面或第十五方面所述的任意一种压缩装置。
第十七方面,本申请实施例还提供了一种计算机存储介质,所述计算机存储介质用于存储计算机软件指令,所述计算机软件指令当被计算机执行时使所述计算机实现如第十三方面所述的任意一种数据压缩方法。
第十八方面,本申请实施例还提供了一种计算机程序,所述计算机程序包括计算机软件指令,所述计算机软件指令当被计算机执行时使所述计算机实现如第十三方面所述的任意一种数据压缩方法。
第十九方面,本申请实施例还提供了一种数据解压方法,应用于解压装置,该解压装置包括M个解压引擎,该方法包括:
获取压缩数据,所述压缩数据包括N个压缩数据块以及所述N个压缩数据块中每一个压缩数据块的长度,N为正整数;其中,所述N个压缩数据块中任意一个压缩数据块为独立压缩的长度为不大于L2的数据块,N为正整数,M≥N;
根据所述N个压缩数据块中每一个压缩数据块的长度,将所述压缩数据拆分出N个压缩数据块;
通过N个解压引擎分别对所述N个规范压缩数据块进行解压,得到与所述N个压缩数据块一一对应N个原始数据块;
将所述N个原始数据块进行拼接,得到原始数据。
第二十方面,本申请实施例还提供了一种解压装置,包括控制器和M个解压引擎,所述控制器包括获取单元,拆分单元、数据分发单元以及拼接单元,其中:
所述获取单元用于:获取压缩数据,所述压缩数据包括N个压缩数据块以及所述N个压缩数据块中每一个压缩数据块的长度,N为正整数;其中,所述N个压缩数据块中任意一个压缩数据块为独立压缩的长度为不大于L2的数据块,N为正整数,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块;
所述拆分单元用于:根据所述N个压缩数据块中每一个压缩数据块的长度,将所述压缩数据拆分出N个压缩数据块,
所述数据分发单元用于:将所述N个压缩数据块分发给所述M个解压引擎中N个解压引擎,以使所述N个解压引擎分别对所述N个压缩数据块进行解压,得到与N个压缩数据块一一对应N个原始数据块,其中,所述N个原始数据块中任意一个原始数据块的长度不大于L1,所述L1以及所述L2为大于1的整数,所述L1大于L2;
所述拼接单元用于:将所述N个原始数据块进行拼接,得到原始数据。
第二十一方面,本申请实施例还提供了一种解压装置,该解压装置包括:控制器、第一存储器、M个解压引擎和第二存储器,其中:
所述控制器用于获取压缩数据,所述压缩数据包括N个压缩数据块以及所述N个压缩数据块中每一个第一压缩数据块的长度,以及根据所述N个压缩数据块中每一个压缩数据块的长度,将所述压缩数据拆分出N个压缩数据块;
所述第一存储器用于存储N个压缩数据块,其中,所述N个压缩数据块中任意一个压缩数据块为独立压缩的长度为不大于L2的数据块,N为正整数,M≥N,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块;
N个解压引擎中每一个解压引擎用于获取所述N个压缩数据块中的一个压缩数据块,并分别对所述获取到的压缩数据块进行解压,得到所述N个压缩数据块一一对应N个原始数据块,其中,所述N个原始数据块中任意一个原始数据块的长度不大于L1,所述L1以及所述L2为大于1的整数,所述L1大于L2;
所述第二存储器用于存储所述N个压缩数据块。
在一种可能的实现方式中,该解压装置还包括:拼接电路,
所述拼接电路用于将所述N个原始数据块进行拼接,得到原始数据。
第二十二方面,本申请实施例还提供了一种集成电路,包括:如第二十一方面所述的任意一种解压装置。可选地,该集成电路还可以包括耦合于所述解压装置的运算装置,所述运算装置用于根据所述解压装置解压得到的原始数据进行数据处理。
第二十三方面,本申请实施例还提供了一种具有解压功能的电子设备,具体可以是本申请实施例中第四电子设备,包括:如第一二十方面或第二十一方面所述的任意一种解压装置、耦合于所述解压装置的处理器以及耦合于所述处理器的存储器。
第二十四方面,本申请实施例还提供了一种计算机存储介质,所述计算机存储介质用于存储计算机软件指令,所述计算机软件指令当被计算机执行时使所述计算机实现如第十九方面所述的任意一种数据解压方法。
第二十五方面,本申请实施例还提供了一种计算机程序,所述计算机程序包括计算机软件指令,所述计算机软件指令当被计算机执行时使所述计算机执行如第十九方面所述的任意一种数据解压方法。
附图说明
为了更清楚地说明本发明实施例或背景技术中的技术方案,下面将对本发明实施例或背景技术中所需要使用的附图进行说明。
图1是现有技术中多解压引擎解压的原理示意图;
图2是本发明实施例提供的一种电子设备的架构示意图;
图3是本发明实施例提供的一种解压装置的结构示意图;
图4是本发明实施例提供的一种数据压缩方法的流程示意图;
图5是本发明实施例提供的一种数据压缩方法的示意性说明图;
图6A是本发明实施例提供的原始数据与压缩数据的示意性说明图;
图6B是本发明实施例提供的规范压缩数据块的结构示意图
图7是本发明实施例提供的一种步骤S41的实现方法的流程示意图;
图8是本发明实施例提供的另一种步骤S41的实现方法的流程示意图;
图9是本发明实施例提供的一种压缩装置的结构示意图;
图10是本发明实施例提供的另一种压缩装置的结构示意图;
图11是本发明实施例提供的一种数据解压方法的流程示意图;
图12是本发明实施例提供的另一种解压装置的结构示意图;
图13是本发明实施例提供的一种第二电子设备的结构示意图
图14是本发明实施例提供的另一种数据压缩方法的流程示意图;
图15是本发明实施例提供的又一种压缩装置的结构示意图;
图16是本发明实施例提供的又一种压缩装置的结构示意图;
图17是本发明实施例提供的又一种解压装置的结构示意图;
图18是本发明实施例提供的另一种数据解压方法的流程示意图;
图19是本发明实施例提供的又一种解压装置的结构示意图;
图20是本发明实施例提供的一种第四电子设备的结构示意图。
具体实施方式
下面对本发明各个实施例涉及的相关概念进行简要介绍:
(1)系统级芯片(System on Chip,SoC),SoC称为系统级芯片,也有称片上系统,意指它是一个产品,是一个有专用目标的集成电路,其中包含完整系统并有嵌入软件的全部内容。所谓完整的系统一般包括中央处理器(Central Processing Unit,CPU)、存储器、以及外围电路等。同时它又是一种技术,用以实现从确定系统功能开始,到软/硬件划分,并完成设计的整个过程。本申请实施例中,解压装置还可以集成在SOC上。
(2)随机存取存储器(Random Access Memory,RAM),又称作“随机存储器”,是与CPU直接交换数据的内部存储器,也叫主存(内存)。它可以随时读写,而且速度很快,通常作为操作系统或其他正在运行中的程序的临时数据存储媒介。
(3)双倍速率同步动态随机存储器(Double Data Rate Synchronous Dynamic Random Access Memory,DDR SDRAM),简称DDR,是一系列存储器接口协议及采用这种接口协议的存储器的统称,包括DDR1、DDR2、DDR3、DDR4等。DDR内存可以在一个时钟周期内传输两次数据,即在时钟的上升期和下降期各传输一次数据,因而,DDR内存可以在与SDRAM相同的总线频率下达到更高的数据传输率。
(4)AXI(Advanced eXtensible Interface)是一种总线协议,该协议是AMBA(Advanced Microcontroller Bus Architecture)3.0协议中最重要的部分,是一种面向高性能、高带宽、低延迟的片内总线。AXI总线将地址、读数据、写数据、握手信号在不同的通道中发送,不同的访问之间顺序可以打乱,用BUSID来表示各个访问的归属。主设备在没有得到返回数据的情况下可发出多个读写操作。读回的数据顺序可以被打乱,同时还支持非对齐数据访问。
(5)压缩算法,指数据压缩的算法,在电子与通信领域也常被称为信号编码,包括压缩和还原(或编码和解码)两个步骤。本申请中所涉及压缩算法的特点在于电子设备需要顺序扫描待压缩字符并顺序编码,从而使得电子设备可以一边压缩一边监视压缩后数据的长度。
可选地,该压缩算法可以是熵编码(entropy encoding)、游程编码(Run Length Coding,RLC)、字典编码等通用的压缩算法以及它们的组合方法或变种等,本申请实施例不作限定。其中,熵编码可以包括但不限于哈夫曼编码(Huffman Coding)、算术编码(arithmetic coding)等;字典编码包括但不限于LZ(Lempel-Ziv)编码系列,LZ编码系列包括deflate、LZ77、LZ78、LZW、LZO等编码,本申请实施例不作限定。
(6)哈夫曼编码(Huffman Coding),又称霍夫曼编码,是一种编码方式,哈夫曼编码是可变字长编码(VLC)的一种。哈夫曼编码依据字符出现概率来构造异字头的平均长度最短的码字。通过哈夫曼编码的码字(即各符号的代码)是异前置码字,即任一码字不会是另一码字的前面部分,这使各码字可以连在一起传送,中间不需另加隔离符号,只要传送时不出错,接收端仍可分离各个码字,不致混淆。
(7)游程编码(Run Length Coding,RLC),又称“运行长度编码”或“行程编码”,是一种统计编码,该编码属于无损压缩编码,是栅格数据压缩的重要编码方法。其基本原理是:用一个符号值或串长代替具有相同值的连续符号(连续符号构成了一段连续的“行程”),使符号长度少于原始数据的长度。只在各行或者各列数据的代码发生变化时,一次记录该代码及相同代码重复的个数,从而实现数据的压缩。
(8)数据组,压缩算法在对字符串进行压缩时,以数据组为单位进行。通常数据组为一个字符或多个连续字符,与原始数据的编码格式有关。本申请中字符为原始数据的编码格式里有意义的最小单位,例如英文格式的文本为1字节(8bit),INT32格式的整数是4个字节。数据组的长度(即压缩的步长)与被压缩的数据内容、压缩算法等有关。本申请中一次压缩是指对一个数据组进行压缩。
例如,对于哈夫曼编码来说,在对字符串进行压缩时,若是以单个字符为单位进行压缩,则一个数据组为一个字符。
又例如,对于游程编码来说,假设待压缩数据为“AAAABBB”,在第一次压缩时,数据组为“AAAA”,第一次压缩对应的数据组的长度为4个字符的长度;在第二次压缩时,数据组为“BBB”,第二次压缩对应的数据组的长度为3个字符的长度。
(9)解压引擎,实现数据解压的硬件,比如集成电路或者现场可编程门阵列(Field Programmable Gate Array,FPGA)等。解压引擎与压缩算法相对应,只能解压通过特定压缩算法的压缩的数据。
(10)规范压缩数据块,具有固定的长度,即L2,为解压设备中的单个解压引擎能够在一个处理周期内处理完(解压完)的数据块,且其解压后得到的原始数据块的大小不大于L1。其中,L1以及L2为大于1的整数,L1大于L2。
(11)处理周期,可以是一个时钟周期或者多个时钟周期。单个解压引擎能够在一个处理周期内完成对最大长度为L2的压缩数据块的处理。
(12)独立压缩,S个原始数据块分别独立压缩,得到的与S个原始数据块一一对应 的S个压缩数据块。该S个压缩数据块之间不存在相关性(即压缩某一个原始数据块的时候,不需要基于其他的原始数据块来压缩),分别可以独立解压缩(即解压的时候,不需要基于其他的压缩数据块来解压)。
例如,原始数据由原始数据块A和原始数据块B组成,则对该原始数据的压缩时,通过压缩算法对原始数据块A进行压缩时,从原始数据块A的第一个数据组开始进行压缩,在原始数据块A进行压缩完成后,得到一个压缩数据块A′;在压缩原始数据块B时,从原始数据块B的第一个数据组开始重新进行压缩,在原始数据块B进行压缩完成后,得到一个压缩数据块B′。在对压缩数据块A′和压缩数据块B′进行解压时,可以分别对压缩数据块A′和压缩数据块B′进行解压,可以以任意顺序对压缩数据块A′和压缩数据块B′进行解压,也可以同时对压缩数据块A′和压缩数据块B′进行解压。
请参阅图2,图2是本发明实施例提供的一种电子设备的架构示意图,该电子设备可以包括:处理器21、存储器22以及解压装置23。处理器21可以通过总线24连接到存储器22和解压装置23。
存储器22可以是只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)或其他存储器。本申请实施例中,存储器22用于存储原始数据以及各种软件程序,例如本申请中数据压缩程序等。在本申请一实施例中,存储器22可以是DDR,以提高存储器与处理器之间或存储器与解压装置之间的数据传输率。
处理器21是计算机设备的控制中心,本申请中,处理器是指具有处理能力的一个电路或者多个电路的集合。例如,可以是中央处理器(Central Processing Unit,CPU)等基于指令集的处理器(也称“软件处理器”),或者还可以是基于专用集成电路(ASIC)或者现场可编程门阵列(Field Programmable Gate Array,FPGA)等硬件实现的处理电路(也称“硬件处理器”)。对于基于指令集的处理器,处理器21可以通过运行或执行存储在计算机设备中的存储器内的软件程序,以及调用存储在存储器内的数据,执行电子设备的各种功能。对于基于FPGA的处理器,可以通过读取配置文件以对FPGA电路进行配置,来完成相应的功能。对于基于ASIC实现的电路,可以在设计时让ASIC具有相应的电路功能,以在上电后执行这些功能。本申请中,处理器21可以单独或者和其他电路一起封装成一个芯片,或者也可将处理器封装成几个芯片(如针对不同的功能电路各自封装成多个芯片),本申请并不限定。
本申请实施例中,处理器21可以调用存储器22内存储的原始数据,以及数据压缩程序以实现本申请实施例所述的数据压缩方法。
总线24可以是AXI总线、外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。所述总线可以分为地址总线、数据总线、控制总线等。
请参阅图3所示的解压装置的结构示意图,解压装置23可以包括第一存储器231、M个解压引擎232、第二存储器233、拼接电路234等。处理器21还可以通过总线24控制解压装置24的启动。解压装置23可以通过总线24从存储器22中获取压缩数据块,通过解压引擎将压缩数据块实时解压。为了让解压速度更快,解压装置具体可以基于ASIC或者FPGA等硬件处理器来完成,当然,本申请也不限定基于CPU等软件处理器来完成解压。
第一存储器231为解压装置的入口存储,用于存储接收到的压缩数据块。可选地,第一存储器231可以包括与M个解压引擎一一对应的M个存储子单元,一个存储子单元可以存储一个压缩数据块,比如规范压缩数据块,在本申请一实施例中,该压缩数据块也可以是长度不大于L1的原始数据块压缩得到的压缩数据块。也就是说,可以确定L2为第一存储器中任意一个存储子单元可存储数据长度。
M个解压引擎用于对第一存储器存储的规范压缩数据块进行并行解压,一个解压引擎用于解压一个规范压缩数据块。
在本申请实施例的一种具体实现中,M个解压引擎包括N个解压引擎,可以通过N个解压引擎分别对N个规范压缩数据块进行并行解压,得到N个原始数据块。N个解压引擎中每一个解压引擎232用于获取N个规范压缩数据块中一个规范压缩数据块,并对获取到的规范压缩数据块进行解压,得到该N个规范压缩数据块一一对应N个原始数据块。其中,所述N个原始数据块中任意一个原始数据块的长度可以不大于L1。
所述第二存储器为解压装置的出口存储,用于存储N个原始数据块。可选地,第二存储器包括分别与M个解压引擎一一对应的M个存储子单元,存储子单元用于存储存储子单元对应的解压引擎所解压得到的原始数据块,也就是说,可以确定L1为第二存储器中任意一个存储子单元可存储数据长度。
可以理解,解压装置的入口存储大小为解压装置包括的M个解压引擎的入口存储大小之和。解压装置的出口存储大小为解压装置包括的M个解压引擎的出口存储大小之和。
拼接电路用于将第二储存器中存储的原始数据块(例如,N个原始数据块)进行拼接,得到原始数据。其中,拼接电路不是解压装置的必须组成部分,解压装置可以不包括拼接电路,通过软件方式实现数据的拼接,本申请实施例不作限定。
本申请一实施例中,N个解压引擎包括解压引擎i,N个压缩数据块包括压缩数据块i,N个原始数据块包括压缩数据块i解压得到的原始数据块i,i为正整数,i不大于N;解压引擎i具体用于:通过解压引擎i对于压缩数据块i进行解压。进而,在解压引擎i解压得到的原始数据块i的长度等于L1时,停止对压缩数据块i的解压操作,输出原始数据块i;或,在解压引擎i识别到无效标志时,停止对压缩数据块i的解压操作,输出解压得到的原始数据块i。
也可以说,第一解压引擎为N个解压引擎中任意一个解压引擎,第一规范压缩数据块为N个规范压缩数据块中的任意一个规范压缩数据块;以第一解压引擎对第一规范压缩数据块为例来说明,任意一个解压引擎的解压过程,具体地:解压装置可以通过第一解压引擎对第一规范压缩数据块进行解压;在第一解压引擎解压得到的原始数据块的长度等于L1时,停止第一解压引擎对第一规范压缩数据块的解压操作,输出原始数据块;或,在第一解压引擎识别到无效标志时,停止第一解压引擎对第一规范压缩数据块的解压操作,输出当前解压得到的原始数据块。
本申请一实施例中,解压装置还包括控制电路,用于:在N个解压引擎中的第一解压引擎解压得到的原始数据块的长度等于L1时,停止第一解压引擎对获取到的压缩数据块的解压操作。
可选地,解压装置还可以包括数据分发电路,该数据分发电路用于将第一存储器存储 的N个压缩数据块依次分发到N个解压引擎中。
需要说明的是,第一存储器中一个存储子单元和/或第二存储器中一个存储子单元可以设置于对应的解压引擎内,本申请实施例不作限定。
可选地,该电子设备还可以包括运算装置,该运算装置与解压装置、处理器耦合,用于根据解压装置解压得到的原始数据进行数据处理。
在具体实现中,运算装置可以是特定的集成电路,例如运行机器学习算法的硬件,运行视频或图像处理算法的硬件等。处理器还可以通过总线控制解压装置、运算装置的启动;解压装置可以通过总线从存储器中获取压缩数据块,通过多个解压引擎分别将多个压缩数据块实时解压得到该多个压缩数据块对应的原始数据,将原始数据输入到运算装置;运算装置利用该原始数据完成计算,例如运算装置将原始数据进行机器学习模型的训练或推理。
该运算装置可以是一个或多个微处理器,还可以是一个或多个现场可编程门阵列(Field Programmable Gate Array,FPGA)等,用于实现计算模块的特定的计算功能。
本发明一实施例中,运算装置和解压装置可以组成集成电路,该集成电路可以与处理器、存储器等集成在同一芯片上,该集成电路也可以作为独立的芯片,应用到电子设备中以实现通过硬件进行计算的加速。
虽然,图2中电子设备可以同时运行本申请中数据压缩方法和该数据压缩方法对应的数据解压方法。然而,在本申请一实施例中,执行数据压缩方法的电子设备(本申请中也称第一电子设备)也可以不包括运算装置和解压装置。同理,执行数据解压方法的电子设备(如第二电子设备)中处理器也可以不运行数据压缩方法。
需要说明的是,电子设备、第一电子设备实现数据压缩功能的具体实现可以参照下述数据压缩方法的实施例中相关描述;第二电子设备实现的数据解压功能的具体实现可以参照下述数据解压方法的实施例中相关描述,本申请实施例不再赘述。
下面详细描述本发明实施例中数据压缩方法,如图4所示的数据压缩方法的流程示意图,请一并参阅图5所示的数据压缩方法的示意性说明图,该数据压缩方法通过第一电子设备或压缩装置执行,该第一电子设备可以是如图2所示的电子设备也可以本申请实施例所述的其他第一电子设备,以下以压缩装置为例进行描述,该数据压缩方法用于将元数据局压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,解压装置包括多个解压引擎,每个解压引擎在一个处理周期内能够完成对一个规范压缩数据块进行解压,L2为大于1的整数,在对原始数据进行压缩的过程中,压缩装置可以执行一次或者多次原始数据块压缩,该原始数据块压缩可以包括:压缩装置基于压缩算法对原始数据块进行处理以得到与原始数据块对应的规范压缩数据块,其中,原始数据块为原始数据中包括的数据。
本申请实施例以一个原始数据块的压缩过程为例来说明,该压缩具体实现可以是:对原始数据块通过压缩算法进行独立压缩,得到与始数据块对应的压缩数据块,该压缩数据块的长度d不大于L2;进一步地,在压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为L2的规范压缩数据块,d为大于0的整数。应理解,d仅仅为符合指代压缩数据块的长度,针对不同的压缩数据块,该d的实际值可以不同。
在本申请实施例的另一种实现中,对原始数据的压缩的方法可以包括以下全部或部分步骤。
步骤S41:将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到该S个个压缩数据块,原始数据块与压缩数据块一一对应。其中,该S个原始数据块中每一个原始数据块为原始数据中连续的多个数据,该连续的多个数据的长度不大于L1,该S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数。
原始数据,可以是以文件形式存在的数据,也可以是以非文件形式的数据(例如,存储在内存中的一些数据)。原始数据包括多个原始数据块,该多个原始数据块依次连接组成原始数据,其中,“数据块”是指多个数据的集合,在计算机应用领域,可用一个或多个比特来表示一个数据,也即数据块可以包括多个比特。该多个原始数据块中每个原始数据块的长度都不大于L1。各个原始数据块对应的压缩数据块的长度都不大于L2。应理解,在不同的原始数据块中,原始数据块的长度可以不同。请一并参阅图6A所示的原始数据与压缩数据的示意性说明图。
可选地,步骤S41之前,该方法还可以包括:
步骤S40:确定L1为单个解压引擎出口位宽以及所述L2为单个解压引擎的入口位宽。
本步骤中的“确定”可以是通过事先配置L1、L2的方式进行确定(例如,在程序代码或者电路实现中配置好这个L1、L2的具体值),或者也可以通过在程序或者硬件电路运行时读取相关的配置值来确定(例如,通过读取保存在本地或者远端的记载有L1、L2值的配置文件来确定L1、L2的值)。
可以理解,本申请中,L1以及L2的值可以根据压缩系统的硬件对压缩的支持情况来确定,也即这些阈值的确定需要能够有硬件支持,并且最好能够最大化地利用硬件资源。例如,对于L1,由于涉及到原始数据块,那么就要保证最后并行解压的时候解压引擎的出口存储(即用于存储解压后数据的存储器)的大小能够容纳解压出的数据,即不小于解压引擎的出口带宽(也即在一个处理周期内对规范压缩数据块解压后能存储的最大数据位数),因此,需要让L1小于等于单个解压引擎的出口位宽,为了让利用率最大,可以让L1等于单个解压引擎的出口位宽。同理,要保证单个解压引擎的入口存储可以容纳压缩后的数据,即不小于解压引擎的入口带宽(也即在一个处理周期内一个解压引擎能读取的数据的宽度,例如,每次读8字节,就是64位位宽)因此,从利用率最大化考虑,可以设置L2等于单个解压引擎的入口位宽。
应理解,单个解压引擎的入口位宽可以是第一存储器可分配给单个解压引擎的存储大小或者第一存储器中与单个解压引擎分别对应的存储子单元的大小。
其中,出口位宽、L1、入口位宽和L2可以以bit为单位。
本领域技术人员可以理解,出口位宽、入口位宽可以由压缩解压系统要满足的性能指标来结合具体的软硬件来确定,例如,可以根据解压引擎所采用的压缩算法、解压引擎的电路设计、每个时钟周期可输入到解压装置的数据长度以及解压装置中解压引擎的个数、面积、功耗等中的一个或多个因素确定。例如,硬件的主频为f,解压装置的入口分配的带宽为b,则每一个时钟周期进入压缩装置的数据为b/f,若已知单个解压引擎的解压能力为 c字节/时钟周期(byte/cycle),则至少需要b/(f*c)个解压引擎。同理,若已知单个解压引擎的解压能力为c字节/时钟周期,解压装置包括M个解压引擎,则每一个时钟周期进入压缩装置的数据为c*M个字节,因此,解压装置中第一存储器的存储大小必须能够存储每一个时钟周期进入压缩装置的数据,单个解压引擎的入口存储须能够存储每一个时钟周期进入压缩引擎的数据量,即c个字节。
举例来说,硬件的主频为1GHz,解压装置的入口分配的带宽为32GBps,则每一个时钟周期进入压缩装置的数据为32字节,若已知单个解压引擎的解压能力为8字节/时钟周期(byte/cycle),解压装置至少需要4个解压引擎,单个解压引擎分别对应的存储资源大小不小于8字节。
单个解压引擎的出口位宽大于单个引擎的入口位宽。单个引擎的出口位宽可以等于解压装置中第二存储器分配给单个解压引擎的存储大小,或等于第二存储单元中与单个解压引擎分别对应的存储子单元的大小。
可选地,单个解压引擎的入口位宽可以被设置为一个时钟周期单个解压引擎可解压的压缩数据块的最大长度;同理,单个解压引擎的出口位宽可以被设置为一个时钟周期单个解压引擎可解压出的原始数据的最大长度。
可选地,压缩装置可以获取到解压装置的规格参数,该规格参数包括出口位宽、入口位宽、解压引擎的个数等。进而确定L1为小于或等于单个解压引擎的出口位宽,L2小于或等于单个解压引擎的入口位宽。
需要说明的是,L1也可以小于单个解压引擎的出口位宽,L2也可以小于单个解压引擎的入口位宽。
步骤S42:在该S个压缩数据块中的每一个压缩数据块之后添加长度为L2-d的附加数据,生成S个长度为L2的规范压缩数据块。其中,一个长度为L2的规范数据块能够被解压装置中的单个解压引擎能在一个处理周期内解压完成,L1以及L2为大于1的整数,d为大于0的整数,L1大于L2。
其中,第一原始数据块为S个原始数据块中的任意一个原始数据块,第一压缩数据块为S个压缩数据块中第一原始数据块压缩得到的数据,当第一压缩数据块的长度等于L2时,d为L2,也即压缩装置不需要在第一压缩数据块之后添加附加数据,第一压缩数据块即为需要的长度为L2的规范压缩数据块。
可以理解,不同原始数据块压缩得到的规范压缩数据块中的附加数据长度可能不同。
附加数据的添加方式可以包括以下三种情况:
第一种情况:第一原始数据块的长度y等于L1,第一原始数据块压缩得到的规范压缩数据块中的附加数据可以是任意填充的,解压端在解压时,解压端只保留前面的长度为L1的数据,后面数据都可以舍弃,例如附加数据(1)合法码字或(2)包括无效标志以及无效数据,其中,无效标志用于指示该附加数据需要弃掉,无效数据位于无效标志之后。无效标志后面的无线数据的位数可以是0或者不小于1,无效数据的位数由第一原始数据块压缩得到的数据的长度而定,其与无效数据的位数、无效标志的位数的和为L2,以保证可以得到长度为L2的规范压缩数据块。请参阅图6B所示的规范压缩数据块的结构示意图,其中,合法码字为解压引擎可以识别并解压的码字,当附加数据为第(1)种合法码字的情 况时,虽然解压引擎可以识别并解压附加数据,但由于第一原始数据块长度是L1,因此,解压引擎可以最多只取L1长度的数据,附加部分解压出来的数据都可以丢弃掉。对于第(2)种情况,无效标志可以由多位的比特组成,具体的位数视解压算法而定,针对不同的解压算法,无效标志的比特位数可以不同,不管哪种算法,只需要保证能够让解压引擎识别到无效标志后知道从这个无效标志开始的都是无效数据,弃掉即可。由于解压引擎不对无效标志后面的数据进行解压,因此,无效标志后面填充的无效数据的数值并不限定,可填任意数据。
第二种情况:第一原始数据块的长度y小于L1,附加数据为第一种情况中所说的包括“无效标志”以及“无效数据”。在这种情况下,由于y小于L1,因此,如果采用填充合法码字的方式,会使得解压端无法输出解压结果(因为不像第一种情况可以统一取L1的数据,在本种情况下,解压出的有效数据多长并不知道),因此,需要采用“无效标志+无效数据”的方式来停止解压,此时,无效标志之前的解压出来的数据即是原始的数据块。需要说明的是,在另一实施例中,如果能通过某种方式知道原始数据块的长度,则也可以通过添加合法码字来实现。可以理解,通过添加无效标志的方法,第二种情况可以跟第一种情况共同一套软件代码,处理起来更方便,减少设计成本。
上述两种情况适用于处理周期为一个或多个时钟周期的情况。
第三种情况:对于处理周期为多个时钟周期的情况,第一原始数据块压缩得到的规范数据块中的附加数据还可以是(3)包括无效标志以及无效数据,其中,无效标志用于指示该附加数据需要弃掉,无效数据位于无效标志之后,无效标志后面的无线数据的位数可以是0或者不小于1。
上述两种情况中提到的合法码字可以参见下表,例如,压缩算法采用哈夫曼编码,一个编码的中的合法的码字如下表1所示:
码长(bit) 编码(二进制)
2 00
3 001
3 011
3 100
3 101
3 110
5 11100
5 11101
5 11110
6 111110
6 111111
表1
压缩装置可以根据L2-d的值确定合法码字为表1中L2-d的码长对应的编码或者确定合法码字为表1中总长度为L2-d的多个编码的组合。
需要说明的是,上述表1仅仅用于说明选定合法码字的原理,本申请实施例根据具体的压缩算法可以采用其他合法编码或合法编码的组合。
上述实施例中,在对原始数据进行压缩时,生成的多个规范压缩数据块长度为固定值L2,且生成该规范压缩数据块的原始数据块的长度不大于L1,规范了原始数据压缩生成的压缩数据块的长度,并且,各个规范压缩数据块为独立压缩的,进而可独立解压,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,提高数据的解压效率。
而且,相对于压缩成变长的压缩数据块,本申请设置成固定长度L2的规范压缩数据块,压缩端不需要记录各个压缩数据块的长度,解压端也不需要记录获取到的数据长度,使得解压端的设计更加简单。
进一步地,现有技术中,原始数据划分的原始数据块的个数等于解压引擎的个数,即解压引擎的个数限制了原始数据可划分的粒度,使得原始数据所压缩形成的多个压缩数据块的长度较大。当对随机地址的数据进行访问时,需要将该随机地址的数据所在的压缩数据块进行解压。在解压的过程中,由于压缩数据块中数据的关联性,该压缩数据块只能在一个解压引擎进行解压,无法实现压缩数据的倍速解压。本申请实施例中,原始数据可划分的粒度与解压引擎的个数无关,原始数据可以被压缩为大量较小规范压缩数据块,当对随机地址的数据进行访问时,将该随机地址的数据所在的多个连续的规范压缩数据块输入到多个解压引擎中进行解压,可实现对随机地址的压缩数据的倍速解压。
下面以压缩装置将第一原始数据块通过压缩算法进行独立压缩,得到第一压缩数据块为例来介绍步骤S41中的实现方式,第一原始数据块为原始数据中的一个原始数据块,可以理解步骤S41还可以包括其他实现方式,本申请实施例不作限定。
第一种实现方式:
通常,数据压缩是以数据组为步长进行,数据组为可进行压缩的一个数据或多个连续数据,为该压缩算法下的可压缩单元,数据组的长度由所述压缩算法以及数据组的数据内容决定,其小于或等于L1;而且,单个数据组被压缩生成的数据块的长度小于或者等于L2,其具体实现为现有技术,本申请并不赘述。
步骤S41的第一种实现方法包括如下流程:
S1:压缩装置从原始数据中获取一个待压缩的数据组。
其中,该待压缩的数据组可以是第一原始数据块中的第一个数据组或者在对第一原始数据块中的数据组完成了一次或多次压缩后的下一个待压缩的数据组。该数据组包括一个或多个比特的数据。
S2:判断是否需要对该待压缩的数据组进行压缩,如果需要进行压缩则执行步骤S3,否则执行S4。
其中,判断是否需要对该待压缩的数据组进行压缩包括:判断已被压缩的一个或多个数据组的总长度x与该待压缩的数据组的长度Δx之和是否不大于所述L1,以及判断该待压缩的数据组被压缩后生成的压缩数据块长度y是否不大于L2。本领域技术人员可以理解,数据组被压缩后生成的压缩数据块的长度是指在原来压缩数据块的长度的基础上再增加本次压缩后所增加的长度,也即压缩数据块的长度在对每个数据组进行压缩后都会被更新。
1)若x+Δx≤L1且y≤L2,判断需要进行压缩。
若已被压缩的一个或多个数据组的总长度x与待压缩的数据组的长度Δx之和不大于L1且在该待压缩的数据组被压缩后生成的压缩数据块长度不大于L2,说明再经过一次压缩后得到的压缩数据块仍然满足长度不大于L2的条件,即可对待压缩的数据组进行压缩,判断为需要进行压缩。
2)若x+Δx≤L1且y>L2,判断不需要进行压缩。
若已被压缩的一个或多个数据组的总长度x与待压缩的数据组的长度Δx之和不大于L1且该待压缩的数据组被压缩后生成的压缩数据块长度大于L2,说明再经过一次压缩后虽然长度仍然满足小于L1的条件,但被压缩后得到的压缩数据块长度不满足不大于L2的条件,因此,判断为不需要进行压缩,此时要停止对待压缩的数据组的压缩,执行步骤S4。
3)若x+Δx>L1,判断不需要进行压缩。
若已被压缩的一个或多个数据组的总长度x与待压缩的数据组的长度Δx之和大于L1,说明如果再经过一次压缩后,长度会超过L1,因此,判断为不需要进行压缩,此时要停止对待压缩的数据组的压缩,执行步骤S5。
S3、压缩该待压缩的数据组,压缩完成后执行S1。
S4、将当前已经压缩得到的数据作为第一压缩数据块。此时,当前被压缩的数据组即为第一原始数据组。
需要说明的是,当该待压缩的数据组不需要进行压缩时,需要将待压缩的数据组放回到原始数据中,以作为对下一个原始数据块进行压缩的第一一个数据组。
应理解,本申请将原始数据压缩成S个规范压缩数据块,本申请中数据组为第一个数据组是指第一原始数据块中第一个数据组。
应理解,压缩装置可以优先判断x+Δx与L1的大小,再判断y与L2的大小。
例如,参阅图7所示的将第一原始数据块通过压缩算法进行独立压缩,得到第一压缩数据块的一种实现方法的流程示意图。该方法包括如下流程:
S411:压缩装置获取第一个数据组,并对该第一个数据组进行压缩。
由于,数据组的长度Δx不大于L1,且单个数据组被压缩后形成的数据块不大于L2,因此,压缩装置在获取到第一个数据组时,可以默认进行压缩。压缩装置也可以在获取到第一个数据组时,判断是否需要对其进行压缩,此时第一个数据组必定满足能够进行压缩的条件。进一步地,令k=2执行步骤S412,k为正整数,k≤M。
S412:压缩装置获取第k个数据组,该第k个数据组的长度为Δx k。
可选地,压缩装置可以优先判断已被压缩的一个或多个数的长度x与第k个数据组的长度Δx k之和是否不大于L1。
S413:压缩装置判断已被压缩的一个或多个数据组的总长度x与第k个数据组的长度Δx k之和是否大于L1。可以理解,一个或多个数据组的总长度x是指对一个或多个数据组中的每个数据组的长度进行累加后得到长度。
其中,已被压缩的一个或多个数据组为第1至k-1个数据组。
当x+Δx k>L1时,说明如果对第k个数据组进行压缩后,第1至k个数据组的长度会超过L1,此时,不需要对第k个数据组进行压缩,要停止对第K个数据组的压缩,执行步 骤S414;当x+Δx k≤L1时,说明如果对第k个数据组进行压缩后,第1至k个数据组的长度小于等于L1,执行步骤S415。
S414:将该已被压缩的一个或多个数据组(即第1至k-1个数据组)被压缩得到的压缩数据块作为第一压缩数据块。此时,已被压缩的一个或多个数据组(即第1至k-1个数据组)即为步骤S41中的第一原始数据块。
S415:判断压缩第k个数据组后生成的压缩数据块的长度y是否大于L2。
当y>L2时,说明压缩第k个数据组后生成的压缩数据块的长度y大于L2的条件,此时,判断为第k数据组不需要进行压缩,可执行S414。当y≤L2时,说明压缩第k个数据组后生成的压缩数据块的长度y不大于L2,需要对第k个数据组进行压缩,此时,令k=k+1,重复执行步骤S412。
需要说明的是,针对第一个或多个待压缩的数据组,如果事先能够约定相应的参数满足一定的条件来保证肯定能够满足能够进行一次或多次压缩的条件(例如,L1远大于数据组长度,L2也比较大,即使经过一次或多次压缩后,被压缩的数据不会超过L1,压缩后的数据块长度不会超过L2),此时,也可以不执行判断,而直接对第一个或多个数据进行相应地一次或多次压缩。
第二种实现方式:
请一并参阅图8所示的本发明实施例提供的又一种将第一原始数据通过压缩算法进行独立压缩,得到第一压缩数据块的流程示意图。其中,该实现方式可以包括以下步骤:
步骤S416:将原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块。
步骤S417:判断临时压缩数据块的长度y'是否大于L2。
当y'>L2时,说明长度为L1的数据块压缩得到的临时压缩数据块的长度大于L2,即大于规范压缩数据块的长度,此时,执行步骤S418;否则,当y'≤L2时,执行步骤S419。
步骤S418:将该长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为第一原始数据块,并将该第一原始数据块压缩得到数据作为第一压缩数据块。其中,第一压缩数据块的长度不大于所述L2。
可选地,i可以是使得第一压缩数据块的长度不大于的最小正整数。其中,确定i的方法可以是:压缩装置从长度为L1的数据块的尾部逐个去除数据组,直至长度为L1的数据块在去除第i个数据组后得到的数据块压缩得到的压缩数据块的长度不大于L2。
需要说明的是,被去除的i个数据组需要放回原始数据中,以作为对下一个原始数据块进行压缩的第一一个数据组。
步骤S419:将该长度为L1的数据块作为第一原始数据块,将临时压缩数据块作为第一压缩数据块。压缩装置可以执行步骤S42。
在图8所示实施例中,压缩装置将待压缩数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;比较临时压缩数据块的长度y'与L2的大小,根据比较结果确定第一原始数据块和该第一原始数据块被压缩生成的第一压缩数据块,进而得到符合要求的第一压缩数据块,以进一步得到的固定长度L2的规范压缩数据块。
请参阅图9,图9是本发明实施例提供的一种压缩装置的结构示意图,该压缩装置90包括:压缩装置90用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,解压装置包括多个解压引擎,每个解压引擎在一个处理周期内能够对一个规范压缩数据块进行解压,L2为大于1的整数,压缩装置90包括:
处理模块,用于基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,原始数据块为原始数据中包括的数据。
在本申请实施例的一种实现中,该处理模块可以包括:
压缩单元91,用于对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;
规范单元92,用于在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
换句话来说,压缩单元91,用于将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数;
规范单元92,在所述S个压缩数据块中的每一个压缩数据块之后添加长度为L2-d的附加数据,生成S个长度为L2的规范压缩数据块,其中,所述长度为L2的规范数据块为解压装置中的单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于所述L2。
压缩装置90包括的各个功能单元的具体实现可参考上述数据压缩方法中相关描述,这里不再赘述。该压缩装置90中的各个单元可以基于硬件或软件实现上述数据压缩方法,例如,基于硬件时,可以基于FPGA、ASIC等电路来完成各个单元,或者基于软件实现时,可以通过让CPU读取存储器中保存的能够实现上述单元功能的代码来执行相应的功能。
请参阅图10,图10是本发明实施例提供的另一种压缩装置的结构示意图,该压缩装置100可以实现上述数据压缩方法,该压缩装置100包括:处理器101和存储器102,处理器101通过总线103连接到存储器102,其中,
存储器102可以是只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)或其他存储器。本申请实施例中,存储器102用于存储原始数据等数据以及各种软件程序,例如本申请中数据压缩程序等。可选的,存储器102可以是DDR,以提高存储器与处理器之间或存储器与解压装置之间的数据传输率。
处理器101是第一计算机设备的控制中心,可以是一个处理器,也可以是多个处理元件的统称。在具体的实现中,作为一种可选的实施例,处理器101可以包括一个或多个CPU。处理器101还可以包括特定的集成电路,例如实施本发明实施例中数据压缩方法的一个或多个微处理器、一个或多个现场可编程门阵列(Field Programmable Gate Array,FPGA)等。
可选地,该压缩装置还包括通信接口104,通信接口104用于实现与其他设备,如解 压装置的数据交换。
所述处理器101用于调用存储器102内存储的原始数据等数据和程序代码执行:一次或者多次原始数据块压缩,所述原始数据块压缩包括:
基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,所述原始数据块为所述原始数据中包括的数据。
在本申请实施例的一种实现中,以对一个原始数据块进行压缩为例,处理器101可以执行:对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
换句话来说,处理器101可以执行:将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2;在所述S个压缩数据块中的每一个压缩数据块之后添加长度为L2-d的附加数据,生成S个长度为L2的规范压缩数据块,其中,所述长度为L2的规范数据块为解压装置中的单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于所述L2。
可选地,所述原始数据块可以包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
在本申请实施例的一种实现中,第一原始数据块为所述S个原始数据块中的任意一个原始数据块,其中:
在第一原始数据块的长度等于L1时,该第一原始数据块压缩得到的规范数据块中的第一附加数据为合法码字或第一附加数据包括用于指示解压引擎该第一附加数据需要弃掉的无效标志以及在该无效标志后面的大于等于0个的无效数据。
在第一原始数据块的长度小于L1时,该第一附加数据包括用于指示解压引擎该第一原始数据块压缩得到的规范数据块中的第一附加数据需要弃掉的无效标志以及在该无效标志后面的大于等于0个的无效数据。
在本申请的一种实现中,所述处理器101执行所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,具体包括执行如下部分或全部流程:
S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;
S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
S3、压缩所述待压缩的数据块组,压缩完成后执行所述S1;
S4、将当前已经压缩得到的数据作为所述压缩数据块;
其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压 缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
在本申请的另一种实现中,所述处理器101执行所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,具体包括执行如下部分或全部流程:
将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,i可以为使得所述压缩数据块不大于所述L2的最小正整数;
在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
在本申请的一种实现中,L1为单个解压引擎的出口位宽;和/或,L2为单个解压引擎的入口位宽。
应理解,本申请实施例中压缩装置中各个器件的功能实现可以参照上述数据压缩方法的实施例中相关描述,本申请实施例不再赘述。
本申请还提供了一种包括数据压缩功能的第一电子设备,该第一电子设备可以包括上述如图9或图10中所描述的任意一种压缩装置。
下面结合图2所示的电子设备的架构、图3所示的解压装置以及图11所示的数据解压方法的流程示意图详细描述本发明实施例中数据解压方法。
该数据解压方法由具有数据解压功能的第二电子设备执行或由上述图3所示的解压装置执行。其中,第二电子设备可以是图2所示的电子设备或其他包括解压装置的电子设备,解压装置也可以是如图3所示解压装置,也可以是其他解压装置,本申请实施例不作限定。本申请实施例以第二电子设备为图2所示的电子设备,解压装置为图3所示的解压装置为例说明数据解压方法。
解压装置所在的电子设备中存储器可以存储第一数据和该第一数据压缩后的压缩数据块。运算装置可以通过总线向电子设备请求获取起始地址为随机地址add1长度为Q的第二数据,其中,第一数据包括第二数据;电子设备可以根据该请求地址确定包括第二数据的P个压缩数据块,进而将P个压缩数据块发送给解压装置;解压装置将P个压缩数据块在被解压和拼接后得到的原始数据输入到运算装置,其中,原始数据包括第二数据;运算装置可以基于请求地址从原始数据中获取到第二数据。
需要说明的是,电子设备也可以根据其需要的第二数据的地址确定包括第二数据的P个压缩数据块,进而通过总线读取存储器内存储的P个压缩数据块到解压装置,对此,本申请实施例不作限定。
本申请实施例设定解压装置包括M个解压引擎,M个解压引擎中每个解压引擎是与上述数据解压方法实施例中压缩算法相对应的解压引擎,用于解压该压缩算法生成的压缩数据。单个解压引擎在一个时钟周期可以解压一个规范压缩数据块。即解压装置在一个时钟周期最大解压M个规范压缩数据块。
本申请实施例假定P=N,N≤M,即运算装置需要的第二数据可以在一个时钟周期解压出。可以理解,P也可以大于M,此时,需要通过多个时钟周期解压出第二数据。具体的解压方法与解压N个压缩数据块类似,本申请实施例不再赘述。
请参阅图11所示的数据解压方法的流程示意图,数据解压方法由第二电子设备或解压装置执行,本申请实施例以解压装置为例来描述,该方法包括以下全部或部分步骤。
步骤S111:解压装置获取N个规范压缩数据块,其中,所述N个规范压缩数据块中任意一个规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个规范压缩数据块能够被单个解压引擎在一个处理周期内解压完成,N为正整数,M≥N。
解压装置通过总线获取N个规范压缩数据块,其解压后的原始数据块的长度可以均不大于L1。关于规范压缩数据块的压缩过程可以参阅上述图4、图7和图8所述的数据压缩方法中相关描述,本申请实施例不再赘述。其中,L1以及L2为大于1的整数,L1大于L2。
可选地,解压装置可以包括分发电路,用于将N个规范压缩数据块分发到N个解压引擎中。
此时,步骤S111的具体实现方式可以是:解压装置接收处理器通过总线发送的N个规范压缩数据块;通过分发电路将所述N个规范压缩数据块依次分发给N个解压引擎。
步骤S112:通过N个解压引擎分别对N个规范压缩数据块进行解压,得到N个原始数据块,规范压缩数据块与原始数据块一一对应,其中,N个原始数据块中任意一个原始数据块的长度可以不大于L1。
在本申请实施例的一种实现中,第一解压引擎为N个解压引擎中任意一个,第一规范压缩数据块为N个规范压缩数据块中的任意一个规范压缩数据块。以第一解压引擎对第一规范压缩数据块为例来说明,任意一个解压引擎的解压过程,具体地:解压装置可以通过第一解压引擎对第一规范压缩数据块进行解压;在第一解压引擎解压得到的原始数据块的长度等于L1时,停止第一解压引擎对第一压缩数据块的解压操作,输出原始数据块;或,在第一解压引擎识别到无效标志时,停止第一解压引擎对第一压缩数据块的解压操作,输出当前解压得到的原始数据块。
在本申请实施例的一种实现中,N个解压引擎包括解压引擎i,N个规范压缩数据块包括规范压缩数据块i,N个原始数据块包括规范压缩数据块i解压得到的原始数据块i,i为正整数,i不大于N,第一解压引擎用于对接收到的规范压缩数据块i进行解压,得到并输出原始数据块i。
解压引擎i进行解压的一种实现方式可以是:
解压引擎i对于规范压缩数据块i进行解压;
解压引擎i可以包括一计数器,记录解压引擎i解压得到的原始数据块i的长度并通过一比较器比较原始数据块i的长度与L1的大小,在第一解压引擎解压得到的原始数据块i的长度等于L1的情况下,第一解压引擎停止对规范压缩数据块i的解压操作,输出原始数 据块i。
在第一解压引擎识别到无效标志的情况下,第一解压引擎停止对规范压缩数据块i的解压操作,输出解压得到的原始数据块i。
解压引擎i进行解压的另一种实现方式可以是:
解压引擎i对于规范压缩数据块i进行全部解压,得到原始数据块,在该原始数据块长度大于L1时,舍去该原始数据块中长度为L1的数据之后的数据,得到长度等于L1的原始数据块i。
在解压引擎i识别到无效标志的情况下,解压引擎i停止对所述规范压缩数据块i的解压操作,输出解压得到的原始数据块i。
可选地,解压装置可以包括控制电路,在解压引擎i对规范压缩数据块i进行解压得到的原始数据块i的长度等于所述L1的情况下,解压装置可以通过控制电路停止解压引擎i对规范压缩数据块i的解压操作。
步骤S113:将所述N个原始数据块进行拼接,得到原始数据。
在N个解压引擎解压得到的N个原始数据块后,解压装置可以将N个原始数据块进行拼接得到原始数据。
可选地,解压装置也可以通过内设的拼接电路实现N个原始数据块拼接成原始数据。
步骤S113之后,解压装置可以将原始数据输入运算装置。
在图11所示的实施例中,解压装置获取N个规范压缩数据块,通过N个解压引擎分别对所述N个规范压缩数据块进行解压,得到所述N个规范压缩数据块一一对应N个原始数据块,将得到的N个原始数据块进行拼接,得到原始数据。其中,所述N个规范压缩数据块中任意一个规范压缩数据块为对原始数据块进行独立压缩后生成的的长度为L2的数据块,使得各个解压引擎在解压该多个规范压缩数据块时可以同步解压,提高数据的解压效率。
进一步地,原始数据可划分的粒度与解压引擎的个数无关,原始数据可以被压缩为大量较小规范压缩数据块,当对随机地址的数据进行访问时,将该随机地址的数据所在的多个连续的规范压缩数据块输入到多个解压引擎中进行解压,可实现对随机地址的压缩数据的倍速解压。
请参阅图12,图12是本发明实施例提供的一种解压装置的结构示意图,该解压装置12包括控制器120和M个解压引擎121,其中,控制器包括获取单元1201、数据分发单元1202以及拼接单元1203,其中:
获取单元1201,用于获取N个规范压缩数据块,其中,所述N个规范压缩数据块中任意一个规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个所述规范压缩数据块能够被单个所述解压引擎在一个处理周期内解压完成,N为正整数,M≥N;
数据分发单元1202,通过N个解压引擎分别对所述N个规范压缩数据块进行并行解压,得到N个原始数据块,所述规范压缩数据块与所述原始数据块一一对应;
拼接单元1203,用于将所述N个原始数据块进行拼接,得到原始数据。
在本申请实施例的一种实现中,数据分发单元1202具体可以用于将N个规范压缩数据块分发给M个解压引擎中的N个解压引擎,以通过N个解压引擎分别对所述N个规范压缩数据块进行解压,得到所述N个规范压缩数据块一一对应N个原始数据块,其中,所述N个原始数据块中任意一个原始数据块的长度不大于L1。需要说明的是,本申请实施例中解压装置12中各个单元的具体实现可以参照上述图11所示的数据解压方法中相关描述,本申请实施例不再赘述。
该控制器120中的各个单元可以基于硬件或软件实现上述数据压缩方法,例如,基于硬件时,可以基于FPGA、ASIC等电路来完成各个单元,或者基于软件实现时,可以通过让CPU读取存储器中保存的能够实现上述单元功能的代码来执行相应的功能。为了实现更快的解压速度,本申请中使用硬件来实现相关的单元的功能。
请参阅图13,图13是本发明实施例提供的一种具有数据解压功能的第二电子设备的结构示意图,该第二电子设备13包括:处理器131、存储器132以及解压装置133,其中,处理器131通过总线134连接到存储器132和解压装置133。
其中,处理器131为解压装置的控制中心,用于可以是一个或多个CPU、一个或多个微处理器,或者一个或多个FPGA等,本发明实施例不做限定。
存储器132用于存储数据和指令,可以是只读存储器、随机存取存储器或其他存储器等,处理器131用于调用存储器132的指令实现该第二电子设备的功能。
解压装置133用于对接收到的规范压缩数据块进行解压,以还原出原始数据块,该解压装置可以是如图3或图9所示的解压装置。需要说明的是,图13所示的解压装置中各个功能的具体实现可以参照图11所示的方法实施例中相关描述,本申请实施例不再赘述。
本申请实施例提供了一种压缩解压系统,该压缩解压系统可以包括压缩装置和解压装置,该压缩装置可以是如图9或图10所示的任意一种压缩装置,解压装置可以是图3或图12所示的任意一种解压装置。可以理解,该压缩解压系统可以设置于同一电子设备中,如图2所示的电子设备,也可以分布在不同的电子设备中。
本申请实施例还提供了一种压缩解压系统,该压缩解压系统可以包括第一电子设备和第二电子设备,具体可参见上述各实施例中第一电子设备和第二电子设备的相关描述,此处,不再赘述。
应理解,本申请中电子设备、第一电子设备、第二电子设备可以是个人计算机(personal computer,PC)、手机、笔记本电脑、平板电脑、服务器、网关、路由器等设备。其中,第一电子设备和第二电子设备可以设置于同一电子设备中,如图2所示的电子设备;也可以是不同设备,本申请实施例不作限定。
下面介绍本申请实施例提供的另一种数据压缩方法,该数据压缩方法应用于压缩设备或可实现数据压缩的第三电子设备,以下以压缩装置为例进行描述。
压缩装置将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,并记录该S个压缩数据块中每一个压缩数据块的长度。其中,该S个原始数据块中每一个原始数据块为原 始数据中连续的多个数据,该连续的多个数据的长度不大于L1,该S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块,通过限制压缩得到的压缩数据块可以在一个处理周期内处理完,使得解压装置在解压时各个解压引擎可以同步解压。
如图14所示的本申请实施例提供的一种数据压缩方法的流程示意图,该数据压缩方法可以包括如下步骤:
S141:压缩装置将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块。
其中,该S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,该S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数,长度为L2的压缩数据块为解压装置中单个解压引擎能够在一个处理周期内处理完的数据块,L1以及L2为大于1的整数,所述d为大于0的整数,L1大于L2。
S142:压缩装置记录S个压缩数据块中每一个压缩数据块的长度。
其中,关于“原始数据”、“数据块”、“原始数据块”、“压缩数据块”、“处理周期”等的描述可以参见上述图5所述的数据压缩方法或其他实施例中相关描述,本申请实施例不再赘述。
与上述图5所示的数据压缩方法不同的是,图5所示的数据压缩方法最终得到规范压缩数据块,其长度固定为L2,通过在压缩数据块增加附加数据来实现。本申请实施例中,压缩数据块即为最终得到的压缩数据块,其长度不固定,压缩装置需要记录该各个压缩数据块的长度,以使解压装置可以对得到的压缩数据中不同长度的压缩数据块进行区分。
其中,步骤S141的一种实现方式可以参见上述S41的两种实现方式,本申请实施例不再赘述。通过S41的两种实现方式,使得压缩数据块的长度尽量接近L2,以使得第四电子设备或解压装置中各个解压引擎在对第一压缩数据块进行解压时,最大程度地利用解压引擎,提高解压效率。
其中,第一原始数据块为S个原始数据块中的任意一个原始数据块,第一压缩数据块为S个压缩数据块中与第一原始数据块对应的压缩数据块,下面以第一压缩数据块为例来描述压缩装置记录压缩数据块长度的实现方式,可以理解,压缩装置记录第一压缩数据块长度可以包括但不限于以下两种实现方式:
第一种实现方式:
压缩装置将第一压缩数据块的长度d记录在第一压缩数据块的起始字段内,该起始字段为从第一压缩数据块起始位开始且长度为第三长度阈值的字段。其中,第三长度阈值可以是4比特或8比特,与L2的大小有关。例如,L2为8个字节,即第一压缩数据块的最大长度为64个比特,则记录的长度值不超过64,第三长度阈值可以是8比特。
解压装置在接收到压缩数据后,通过读取起始字段内存储的长度,进而获取到第一压缩数据块。依次类推,获取下一个第一压缩数据块,进而得到全部的第一压缩数据块。进一步地,解压装置或设备将多个第一压缩数据块依次输入到解压引擎中进行解压。
第二种实现方式:
压缩装置将第一压缩数据块的长度d写入第一文件,该第一文件包括压缩装置依次压缩得到的S个压缩数据块的长度。
压缩装置将S个压缩数据块的长度按照数据的压缩次序依次记录在第一文件中。在压缩装置向第四电子设备或解压装置传输压缩数据时,同时将第一文件发送至第四电子设备或解压装置。解压装置或设备根据第一文件包含的多个长度,对接收到的压缩数据进行划分,得到S个压缩数据块。进一步地,解压装置或设备将S个压缩数据块依次输入到解压引擎中进行解压。
下面介绍本申请实施例提供的一种压缩装置,如图15所示,该压缩装置150包括:压缩单元1501和记录单元1502,其中:
压缩单元1501,用于将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于L2;
记录单元1502,用于记录所述S个压缩数据块中每一个压缩数据块的长度。
压缩装置150包括的各个功能单元的具体实现可参考上述图13所述的数据压缩方法中相关描述,这里不再赘述。该压缩装置150中的各个单元可以基于硬件或软件实现上述数据压缩方法,例如,基于硬件时,可以基于FPGA、ASIC等电路来完成各个单元,或者基于软件实现时,可以通过让CPU读取存储器中保存的能够实现上述单元功能的代码来执行相应的功能。
下面介绍本申请实施例提供的又一种压缩装置,如图16所示,该压缩装置160包括:处理器1601、存储器1602,处理器1601通过总线1603连接到存储器1602,其中,所述存储器1602用于存储数据和程序指令,
存储器1602可以是只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)或其他存储器。本申请实施例中,存储器1602用于存储原始数据等数据以及各种软件程序,例如本申请中实现图14所述的数据压缩方法的程序等。可选的,存储器1602可以是DDR,以提高存储器1602与处理器1601之间或存储器1601与解压装置之间的数据传输率。
处理器1601是第一计算机设备的控制中心,可以是一个处理器,也可以是多个处理元件的统称。在具体的实现中,作为一种可选的实施例,处理器1601可以包括一个或多个CPU。处理器1601还可以包括特定的集成电路,例如实施本发明实施例中数据压缩方法的一个或多个微处理器、一个或多个现场可编程门阵列(Field Programmable Gate Array,FPGA)等。
可选地,该压缩装置还包括通信接口1604,通信接口1604用于实现与其他设备,如第二解压设备的数据交换。
所述处理器1601调用所述存储器1602存储的数据和程序指令,执行下述方法:
将原始数据中连续的S个原始数据块中的每一个原始数据块分别通过压缩算法进行独立压缩,得到所述S个原始数据块一一对应的S个压缩数据块,所述S个原始数据块中每一个原始数据块为所述原始数据中连续的多个数据,所述连续的多个数据的长度不大于L1,所述S个压缩数据块中的每一个压缩数据块的长度d不大于L2,S为正整数,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述d为大于0的整数,所述L1大于L2;
记录所述S个压缩数据块中每一个压缩数据块的长度。
可选地,该压缩装置还可以包括通信接口1604,以实现与通信对端如解压装置的数据传输。
压缩装置160执行步骤时的具体实现可参考图上述图13所述的数据压缩方法中相关描述,这里不再赘述。
下面介绍本申请实施例涉及的另一种解压装置,如图17,该解压装置170可以包括控制器1700、第一存储器1701、M个解压引擎1702和第二存储器1703,其中:
所述控制器1700用于获取压缩数据,所述压缩数据包括N个压缩数据块以及所述N个压缩数据块中每一个压缩数据块的长度,以及根据所述N个压缩数据块中每一个压缩数据块的长度,将所述压缩数据拆分出N个压缩数据块;
所述第一存储器1701用于存储N个压缩数据块,其中,所述N个压缩数据块中任意一个压缩数据块为独立压缩的长度为不大于L2的数据块,N为正整数,M≥N,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块,所述L1以及所述L2为大于1的整数,所述L1大于L2;
N个解压引擎中每一个解压引擎用于获取所述N个压缩数据块中的一个压缩数据块,并分别对所述获取到的压缩数据块进行解压,得到所述N个压缩数据块一一对应的N个原始数据块,其中,所述N个原始数据块中任意一个原始数据块的长度不大于L1,所述M个解压引擎包括所述N个解压引擎;
所述第二存储器1703用于存储所述N个原始数据块。
在一种可能的实现方式中,该解压装置170还包括:拼接电路1704,所述拼接电路1704用于将所述N个原始数据块进行拼接,得到原始数据。
可选地,第一存储器1701可以包括与M个解压引擎一一对应的M个存储子单元,一个存储子单元可以存储一个压缩数据块。同理,第二存储器1703可以包括与M个解压引擎一一对应的M个存储子单元,一个存储子单元可以存储一个原始数据块。
需要说明的是,第一存储器中一个存储子单元和/或第二存储器中一个存储子单元可以设置于对应的解压引擎内,本申请实施例不作限定。
需要说明的是,控制器1700,不是解压装置170必须的器件,解压装置170可以不包括控制器1700,而将控制器1700设于包括该解压装置170的第四电子设备中。控制器1700中的各个流程可以基于硬件或软件实现上述数据压缩方法,例如,基于硬件时,可以基于FPGA、ASIC等电路来完成各个单元,或者基于软件实现时,可以通过让CPU读取存储器 中保存的能够实现上述流程的代码来执行相应的功能。
本申请实施例还提供了一种可实现数据解压功能的第四电子设备,该第四电子设备可以包括如图17所示任意一种解压装置。
下面介绍本申请提供的针对图14所示的数据压缩方法的一种数据解压方法。该方法应用于第四电子设备或解压装置。第四电子设备可以是如图2所示电子设备而或其他包括解压装置的电子设备,解压装置可以是如图17所示的解压装置,也可以是其他解压装置。
如图18所示一种解压方法的流程示意图,该方法包括但不限于以下步骤:
S181:获取压缩数据,所述压缩数据包括N个压缩数据块以及所述N个压缩数据块中每一个压缩数据块的长度,N为正整数;其中,所述N个压缩数据块中任意一个压缩数据块为独立压缩的长度为不大于L2的数据块,N为正整数,M≥N,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块。
S182:根据所述N个压缩数据块中每一个压缩数据块的长度,将所述压缩数据拆分出N个压缩数据块。
S183:通过N个解压引擎分别对N个压缩数据块进行解压,得到与N个压缩数据块一一对应N个原始数据块,其中,所述N个原始数据块中任意一个原始数据块的长度不大于L1,L1以及L2为大于1的整数,L1大于L2。
S184:将所述N个原始数据块进行拼接,得到原始数据。
其中,压缩数据块为通过上述图14所述的数据压缩方法得到的压缩数据块。具体可参见图14所示的数据压缩方法中相关描述,本申请实施例不再赘述。
本申请一实施例中,解压装置在接收到压缩数据后,通过读取起始字段内存储的长度,进而获取到压缩数据块。依次类推,获取下一个压缩数据块,进而得到N个压缩数据块。进一步地,解压装置将N个压缩数据块依次输入到解压引擎中进行解压。
本申请一实施例中,压缩装置可以将各个压缩数据块的长度按照数据的压缩次序依次记录在第一文件中。在压缩装置向解压装置传输包括N个压缩数据块和第一文件的压缩数据后,解压装置可以根据第一文件包含的多个长度,对接收到的压缩数据进行划分,得到N个压缩数据块。进一步地,解压装置将N个压缩数据块依次输入到N个解压引擎中进行解压。
请参阅图19,图19是本发明实施例提供的又一种解压装置的结构示意图,该解压装置190可以包括控制器1900以及M个解压引擎1901,其中,控制器1900包括以下单元:
获取单元1902,用于获取压缩数据,所述压缩数据包括N个压缩数据块以及所述N个压缩数据块中每一个压缩数据块的长度,N为正整数;其中,所述N个压缩数据块中任意一个压缩数据块为独立压缩的长度为不大于L2的数据块,N为正整数,M≥N,长度为L2的压缩数据块为单个解压引擎能够在一个处理周期内处理完的数据块;
拆分单元1903,用于根据所述N个压缩数据块中每一个压缩数据块的长度,将所述压缩数据拆分出N个压缩数据块;
数据分发单元1904,用于将N个压缩数据块分发给N个解压引擎,以使所述N个解 压引擎分别对所述N个压缩数据块进行解压,得到与N个压缩数据块一一对应N个原始数据块,N个原始数据块中每一个原始数据块的长度不大于L1,L1以及L2为大于1的整数,L1大于L2;
拼接单元1905,用于将所述N个原始数据块进行拼接,得到原始数据。
解压装置190包括的各个功能单元的具体实现可参考上述图18所述的数据解压方法中相关描述,这里不再赘述。该控制器1900中的各个单元可以基于硬件或软件实现上述数据压缩方法,例如,基于硬件时,可以基于FPGA、ASIC等电路来完成各个单元,或者基于软件实现时,可以通过让CPU读取存储器中保存的能够实现上述单元功能的代码来执行相应的功能。为了实现更快的解压速度,本申请中使用硬件来实现相关的单元的功能。
本申请实施例还提供了一种可实现数据解压功能的第四电子设备,该第四电子设备可以包括如图17或图19所示任意一种解压装置。例如,该第四电子设备200包括:处理器2001、存储器2002以及解压装置2003,其中,处理器2001通过总线2004连接到存储器2002和解压装置2003。
其中,处理器2001为解压装置的控制中心,可以是一个或多个CPU、一个或多个微处理器,或者一个或多个FPGA等,本发明实施例不做限定。
存储器2002用于存储数据和指令,可以是只读存储器、随机存取存储器或其他存储器等,处理器2001用于调用存储器2002的指令实现该第二电子设备的功能。
解压装置2003用于对接收到的压缩数据块进行解压,以还原出原始数据块,该解压装置可以是如图17或图19所示的解压装置。需要说明的是,图20所示的解压装置中各个功能的具体实现可以参照图18所示的方法实施例中相关描述,本申请实施例不再赘述。
可选地,该第四电子设备还可以包括运算装置,该运算装置与解压装置、处理器耦合,用于根据解压装置解压得到的原始数据进行数据处理。具体可参见上述图2描述的电子设备中计算装置的相关描述,此处不再赘述。
本申请实施例还提供了一种压缩解压系统,该压缩解压系统可以包括压缩装置和解压装置,该压缩装置可以是如图15或图16所示的任意一种压缩装置,解压装置可以是图17或图19所示的任意一种解压装置。可以理解,该压缩解压系统可以设置于同一电子设备中,也可以分布在不同的电子设备中。
本申请实施例还提供了一种压缩解压系统,该压缩解压系统可以包括第三电子设备和第四电子设备,具体可参见上述各实施例中第三电子设备和第四电子设备的相关描述,此处,不再赘述。
应理解,本申请中第三电子设备、第四电子设备可以是个人计算机(personal computer,PC)、手机、笔记本电脑、平板电脑、服务器、网关、路由器等设备。其中,第三电子设备和第四电子设备可以设置于同一电子设备中;也可以是不同设备,本申请实施例不作限定。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。

Claims (36)

  1. 一种数据压缩方法,其特征在于,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,所述方法包括:
    执行一次或者多次原始数据块压缩,所述原始数据块压缩包括:
    基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,所述原始数据块为所述原始数据中包括的数据。
  2. 如权利要求1所述的方法,其特征在于,所述基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块包括:
    对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;
    在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
  3. 如权利要求2所述的方法,其特征在于,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
  4. 如权利要求3所述的方法,其特征在于,
    在所述原始数据块的长度等于所述L1时,与所述原始数据块对应的所述规范压缩数据块中的附加数据为合法码字;或所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉;或,
    在所述原始数据块的长度小于所述L1时,所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉。
  5. 如权利要求3或4所述的方法,其特征在于,所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块包括:
    S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;
    S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
    S3、压缩所述待压缩的数据组,压缩完成后执行所述S1;
    S4、将当前已经压缩得到的数据作为所述压缩数据块;
    其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述 x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
  6. 如权利要求3或4所述的方法,其特征在于,所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块包括:
    将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
    在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,所述i为使得所述压缩数据块不大于所述L2的最小正整数;
    在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
  7. 如权利要求1-6任一所述的方法,其特征在于,所述L2为单个所述解压引擎的入口位宽。
  8. 一种压缩装置,其特征在于,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,包括:
    处理模块,用于基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,其中,所述原始数据块为所述原始数据中包括的数据。
  9. 如权利要求8所述的压缩装置,其特征在于,所述处理模块包括:
    压缩单元,用于对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;
    规范单元,用于在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
  10. 如权利要求9所述的压缩装置,其特征在于,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
  11. 如权利要求10所述的压缩装置,其特征在于,
    在所述原始数据块的长度等于所述L1时,与所述原始数据块对应的所述规范压缩数据块中的附加数据为合法码字;或所述附加数据包括无效标志以及无效数据,其中,所述无 效标志用于指示所述附加数据需要弃掉;或,
    在所述原始数据块的长度小于所述L1时,所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉。
  12. 如权利要求10或11所述的压缩装置,其特征在于,所述压缩单元具体用于执行如下步骤:
    S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
    S3、压缩所述待压缩的数据组,压缩完成后执行所述S1;
    S4、将当前已经压缩得到的数据作为所述压缩数据块;
    其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
  13. 如权利要求10或11所述的压缩装置,其特征在于,所述压缩单元具体用于:
    将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
    在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,所述i为使得所述压缩数据块不大于所述L2的最小正整数;
    在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
  14. 如权利要求8-13任一所述的压缩装置,其特征在于,所述L2为单个所述解压引擎的入口位宽。
  15. 一种压缩装置,其特征在于,用于将原始数据压缩成供解压装置并行解压的一个或多个长度为L2的规范压缩数据块,其中,所述解压装置包括多个解压引擎,每个所述解压引擎在一个处理周期内能够对一个所述规范压缩数据块进行解压,所述L2为大于1的整数,所述压缩装置包括:处理器和存储器,其中,所述存储器用于存储数据和程序指令,所述处理器调用所述存储器存储的数据和程序指令,执行:一次或者多次原始数据块压缩,所述原始数据块压缩包括:
    基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数 据块,其中,所述原始数据块为所述原始数据中包括的数据。
  16. 如权利要求15所述的压缩装置,其特征在于,所述处理器执行所述基于压缩算法对原始数据块进行处理以得到与所述原始数据块对应的所述规范压缩数据块,具体包括执行:
    对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,所述压缩数据块的长度d不大于所述L2;
    在所述压缩数据块之后添加长度为L2-d的附加数据,从而生成长度为所述L2的所述规范压缩数据块,所述d为大于0的整数。
  17. 如权利要求16所述的压缩装置,其特征在于,所述原始数据块包括所述原始数据中连续的多个数据,所述原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
  18. 如权利要求17所述的压缩装置,其特征在于,
    在所述原始数据块的长度等于所述L1时,与所述原始数据块对应的所述规范压缩数据块中的附加数据为合法码字;或所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉;或,
    在所述原始数据块的长度小于所述L1时,所述附加数据包括无效标志以及无效数据,其中,所述无效标志用于指示所述附加数据需要弃掉。
  19. 如权利要求17或18所述的压缩装置,其特征在于,所述处理器执行所述对所述原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,具体包括执行如下步骤:
    S1、从所述原始数据中获取一个待压缩的数据组,所述数据组包括一个或多个比特的数据;
    S2、判断是否需要对所述待压缩的数据组进行压缩,如果需要进行压缩,则执行S3,否则执行S4;
    S3、压缩所述待压缩的数据组,压缩完成后执行所述S1;
    S4、将当前已经压缩得到的数据作为所述压缩数据块;
    其中,所述判断是否需要对所述待压缩的数据组进行压缩包括:若已被压缩的一个或多个数据组的总长度x与所述待压缩的数据组的长度Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度不大于所述L2,则确定需要进行压缩;若所述x与所述Δx之和不大于所述L1且在所述待压缩的数据组被压缩后生成的压缩数据块长度大于所述L2,则确定不需要进行压缩;若所述x与所述Δx之和大于所述L1,则确定不需要进行压缩。
  20. 如权利要求17或18所述的压缩装置,其特征在于,所述处理器执行所述对所述 原始数据块通过压缩算法进行独立压缩,得到与所述原始数据块对应的压缩数据块,具体包括执行:
    将所述原始数据中长度为L1的数据块以数据组为步长进行压缩,得到临时压缩数据块;
    在所述临时压缩数据块的长度大于所述L2时,将所述长度为L1的数据块在去除尾部的i个数据组后得到的数据块作为所述原始数据块,并将所述原始数据块压缩得到的数据作为所述压缩数据块,其中,所述压缩数据块的长度不大于所述L2,所述i为使得所述压缩数据块不大于所述L2的最小正整数;
    在所述临时压缩数据块的长度不大于所述L2时,将所述长度为L1的数据块作为所述原始数据块,将所述临时压缩数据块作为所述压缩数据块。
  21. 如权利要求15-20任一所述的压缩装置,其特征在于,所述L2为单个所述解压引擎的入口位宽。
  22. 一种具有压缩功能的电子设备,所述电子设备包括压缩装置和处理装置,所述压缩装置为如权利要求8-14任意一项权利要求所述的压缩装置或如权利要求15-21任意一项权利要求所述的压缩装置;所述处理装置用于向所述压缩装置发送所述原始数据。
  23. 一种解压装置,其特征在于,包括:第一存储器、M个解压引擎和第二存储器,其中,
    所述第一存储器用于存储多个规范压缩数据块,其中,一个所述规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个所述规范压缩数据块能够被单个所述解压引擎在一个处理周期内解压完成,M为大于1的整数;
    所述M个解压引擎用于对所述第一存储器存储的规范压缩数据块进行并行解压,一个所述解压引擎用于解压一个所述规范压缩数据块;
    所述第二存储器用于存储所述规范压缩数据块被解压得到的原始数据块,所述规范压缩数据块与所述原始数据块一一对应。
  24. 如权利要求23所述的解压装置,其特征在于,所述解压装置还包括拼接电路,
    所述拼接电路用于将所述第二储存器中存储的原始数据块进行拼接,得到原始数据。
  25. 如权利要求23或24所述的解压装置,其特征在于,所述M个解压引擎中的每一个解压引擎还用于:
    在解压得到的原始数据块的长度等于L1时或在识别到所述规范压缩数据块中的无效标志时,停止解压操作。
  26. 如权利要求23或24所述的解压装置,其特征在于,所述解压装置还包括控制电路,用于:
    在第一解压引擎解压得到的原始数据块的长度等于所述L1的情况下,停止所述第一解压引擎的解压操作,所述第一解压引擎为所述N个解压引擎中的任意一个解压引擎。
  27. 如权利要求25或26所述的解压装置,其特征在于,所述解压引擎的出口位宽为所述L1,所述原始数据块的长度不大于所述L1。
  28. 如权利要求23-27任意一项权利要求所述的解压装置,其特征在于,所述第二存储器包括分别与所述M个解压引擎一一对应的M个存储子单元,所述第一存储子单元用于存储所述第一存储子单元对应的解压引擎所解压得到的原始数据块,第一存储子单元为所述M个存储子单元中的任意一个存储子单元。
  29. 一种集成电路,其特征在于,所述集成电路包括如权利要求23-28任意一项权利要求所述的解压装置。
  30. 一种数据解压方法,其特征在于,应用于解压装置,所述解压装置包括M个解压引擎,M为大于1的整数,所述方法包括:
    获取N个规范压缩数据块,其中,所述N个规范压缩数据块中任意一个规范压缩数据块为对原始数据块进行独立压缩后生成的长度为L2的数据块,一个所述规范压缩数据块能够被单个所述解压引擎在一个处理周期内解压完成,N为正整数,M≥N;
    通过N个解压引擎分别对所述N个规范压缩数据块进行并行解压,得到N个原始数据块,所述规范压缩数据块与所述原始数据块一一对应;
    将所述N个原始数据块进行拼接,得到原始数据。
  31. 如权利要求30所述的数据解压方法,其特征在于,所述N个原始数据块中任意一个原始数据块的长度不大于L1,所述L1为所述解压引擎的出口位宽。
  32. 如权利要求30或31所述的数据解压方法,其特征在于,第一解压引擎为所述N个解压引擎中的任意一个所述解压引擎,第一规范压缩数据块为所述N个规范压缩数据块中的任意一个规范压缩数据块;所述通过N个解压引擎分别对所述N个规范压缩数据块进行并行解压,得到N个原始数据块,具体包括:
    通过所述第一解压引擎对所述第一规范压缩数据块进行解压;
    在所述第一解压引擎解压得到的原始数据块的长度等于所述L1时,停止所述第一解压引擎对所述第一规范压缩数据块的解压操作,输出所述原始数据块;或,在所述第一解压引擎识别到无效标志时,停止所述第一解压引擎对所述第一规范压缩数据块的解压操作,输出当前解压得到的原始数据块。
  33. 一种具有解压功能的电子设备,其特征在于,包括处理器、存储器以及解压装置,所述处理器耦合所述存储器和所述解压装置,其中,所述解压装置为如权利要求23-28任 意一项权利要求所述的解压装置。
  34. 一种具有解压功能的电子设备,其特征在于,包括处理器、存储器以及M个解压引擎,所述处理器耦合所述存储器和所述M个解压引擎,所述存储器用于存储数据和程序指令,所述处理器调用所述存储器存储的数据和程序指令,实现如权利要求30-32任一项所述的数据解压方法。
  35. 一种压缩解压系统,其特征在于,包括压缩装置和解压装置,所述压缩装置为如权利要求8-21任意一项权利要求所述的压缩装置,所述解压装置为如权利要求23-28任意一项权利要求所述的解压装置。
  36. 一种压缩解压系统,其特征在于,包括第一电子设备和第二电子设备,所述第一电子设备为如权利要求22所述的具有压缩功能的电子设备,所述第二电子设备为如权利要求33或34所述的具有解压功能的电子设备。
PCT/CN2019/098758 2018-07-31 2019-07-31 数据压缩、解压方法及相关装置、电子设备、系统 Ceased WO2020025006A1 (zh)

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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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格式的多线程压缩与解压方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
Title
See also references of EP3820048A4

Cited By (2)

* Cited by examiner, † Cited by third party
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