Data compression device, decompression device, data processing method and related equipment
By using the target base determination module and the data compression module in the data compression device, the target base is determined based on the alignment sequence of candidate bases and the data block position marking is solved, and the problem of redundant data in the prior art cannot be effectively compressed is improved. Data compression success rate and computing performance.
Patent Information
- Application Number
- CN202411134780.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2025-01-03
AI Technical Summary
When existing data compression algorithms face redundant and duplicate data generated during large model training and inference, they cannot effectively compress, resulting in insufficient memory access bandwidth and affecting computing performance.
By introducing a target base determination module and a data compression module in the data compression device, the target base is determined by using the alignment sequence of the candidate base, and compressing the compressed data according to the target base, and generating compressed data, including the target alignment sequence, Target-based and non-target-based data blocks ensure the accuracy and compression rate of data block position information.
It improves the success rate of data compression, avoids the inability to compress data with large differences between non-sparse matrices or data blocks, realizes lossless data compression, and improves memory access bandwidth and computing performance.
Smart Images

Figure CN119254235A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of semiconductor technology, and in particular, to a data compression device, a decompression device, a data processing method, and related equipment. Background Art
[0002] As the computing power of chips increases, increasing memory access bandwidth has become one of the main issues that need to be addressed when chips perform data operations. Among them, data compression methods are one of the effective means to increase memory access bandwidth. Data compression methods can compress data to optimize data structure and storage format.
[0003] However, the data compression method has usage limitations, which affects the success rate of data compression. In this context, how to provide a technical solution to improve the success rate of data compression has become a technical problem that those skilled in the art need to solve urgently. Summary of the invention
[0004] In view of this, embodiments of the present application provide a data compression device, a decompression device, a data processing method and related equipment to improve the success rate of data compression.
[0005] To achieve the above objectives, the embodiments of the present application provide the following technical solutions.
[0006] In a first aspect, an embodiment of the present application provides a data compression device, comprising:
[0007] A target base determination module is used to obtain each candidate base of the data to be compressed and a comparison sequence of each candidate base, and determine a target base from each candidate base based on the comparison sequence of each candidate base; the comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed;
[0008] A data compression module, used for compressing the data to be compressed according to the target base to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence;
[0009] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0010] In a second aspect, an embodiment of the present application provides a data decompression device, comprising:
[0011] A compressed data acquisition module, used to acquire compressed data, wherein the compressed data at least includes a target comparison sequence corresponding to a target base, a target base, and a non-target base data block arranged in sequence, wherein the value of the non-target base data block is different from the value of the target base; the compressed data is obtained by compressing the data to be compressed based on the data compression device according to the first aspect;
[0012] A data decompression and restoration module, used to decompress and restore the compressed data based on the target base, the target comparison sequence and the non-target base data block to obtain decompressed data;
[0013] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0014] In a third aspect, an embodiment of the present application provides a data processing system, including:
[0015] The data compression device according to the first aspect is used to compress the data to be compressed to obtain compressed data; the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence;
[0016] The data decompression device as described in the second aspect is used to receive compressed data and decompress the compressed data to obtain decompressed data;
[0017] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0018] In a fourth aspect, an embodiment of the present application provides a data processing method, which is applied to the data compression device described in the first aspect, comprising:
[0019] Acquire each candidate base of the data to be compressed and a comparison sequence of each candidate base, and determine a target base from each candidate base based on the comparison sequence of each candidate base; the comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed;
[0020] Compressing the data to be compressed according to the target base to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block having a value different from that of the target base, which are arranged in sequence;
[0021] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0022] In a fifth aspect, an embodiment of the present application provides a data processing method, which is applied to the data decompression device described in the second aspect, including:
[0023] Obtaining compressed data, wherein the compressed data at least includes a target comparison sequence corresponding to a target base, a target base, and a non-target base data block arranged in sequence, wherein a value of the non-target base data block is different from a value of the target base; the compressed data is obtained by compressing the data to be compressed based on the data compression method according to the fourth aspect;
[0024] Based on the target base, the target comparison sequence and the non-target base data block, the compressed data is decompressed and restored to obtain decompressed data;
[0025] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0026] The data compression device provided by the embodiment of the present application includes: a target base determination module, which is used to obtain each candidate base of the data to be compressed and the comparison sequence of each candidate base, and determine the target base among each candidate base based on the comparison sequence of each candidate base; the comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed; a data compression module, which is used to compress the data to be compressed according to the target base to obtain compressed data, and the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence; wherein the target comparison sequence is used to indicate the position of the data block with the same value as the target base in the data to be compressed, and the position of the non-target base data block in the data to be compressed.
[0027] It can be seen that the technical solution provided by the embodiment of the present application, by using the target base determination module, first determines the target base that can be used for data compression, and then compresses the data to be compressed by using the target base through the data compression module to obtain the compressed data; because the compressed data includes the target comparison sequence, target base and non-target base data blocks of the target base arranged in sequence; and the target base is determined based on the comparison sequence of the candidate base, and the comparison sequence of the candidate base is the comparison result of the candidate base and each data block of the data to be compressed. Therefore, the target base determined based on the candidate base, its corresponding target comparison sequence is also the comparison result obtained after the comparison of the target base and each data block of the data to be compressed. At the same time, the target comparison sequence can indicate the position of the data block with the same value as the target base in the data to be compressed, and the position of the non-target base data block in the data to be compressed, that is to say, the comparison result corresponding to the target comparison sequence can reflect the position of the data block with the same value as the target base, and the position of the data block with different value from the target base. Therefore, on the one hand, the technical solution provided by the present application can be based on the target comparison sequence when decompressing the compressed data, directly according to the position of the data block with the same value as the target base indicated by the target comparison sequence in the data to be compressed, and the position of the non-target base data block in the data block to be compressed, combined with the target base and the non-target base data block, to quickly and conveniently restore the compressed data. On the other hand, since the compressed data includes data blocks with different values from the target base (i.e., non-target base data blocks), the data compression device provided by the embodiment of the present application, in the process of using the determined target base for data compression, can also retain the data blocks in the data to be compressed that are inconsistent with the target base value, so as to achieve compression of the data to be compressed; thereby, it can avoid the situation where data compression cannot be performed when facing a non-sparse matrix or data to be compressed with large differences between data blocks; therefore, it can improve the success rate of data compression on the basis of quickly achieving lossless data compression. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0029] Figure 1 It is a structural schematic diagram of a data compression device provided in an embodiment of the present application.
[0030] Figure 2 It is a schematic diagram of an implementation process of a basis-based data compression method.
[0031] Figure 3 This is another schematic diagram of the implementation process of the basis-based data compression method.
[0032] Figure 4 It is a schematic diagram of different compression rates corresponding to the compressed data provided in an embodiment of the present application.
[0033] Figure 5 It is another structural schematic diagram of the data compression device provided in an embodiment of the present application.
[0034] Figure 6 It is another structural schematic diagram of the data compression device provided in an embodiment of the present application.
[0035] Figure 7 It is a data structure diagram of compressed data obtained by using the data compression device provided in the embodiment of the present application.
[0036] Figure 8 It is a structural schematic diagram of the data to be compressed provided in an embodiment of the present application.
[0037] Fig. 9 is based on Figure 8 A schematic structural diagram of compressed data obtained by compressing the data to be compressed is shown.
[0038] Fig.10 It is another structural schematic diagram of the data to be compressed provided in an embodiment of the present application.
[0039] Fig.11 is based on Fig.10 A schematic structural diagram of compressed data obtained by compressing the data to be compressed is shown.
[0040] Fig.12 It is another structural schematic diagram of the data compression device provided in an embodiment of the present application.
[0041] Fig.13 It is a structural schematic diagram of a data decompression device provided in an embodiment of the present application.
[0042] Fig.14 It is another structural schematic diagram of the data decompression device provided in an embodiment of the present application.
[0043] Fig.15 It is a structural diagram of a data processing system provided in an embodiment of the present application.
[0044] Fig.16 It is a flow chart of a data processing method provided in an embodiment of the present application.
[0045] Fig.17 It is another flowchart of the data processing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0047] With the rapid development of artificial intelligence (AI), deep learning and large models have given rise to the demand for high-performance computing resources. For example, general-purpose computing on graphics processing units (GPGPU) has become an ideal choice for AI computing due to its powerful parallel processing capabilities and efficient floating-point computing capabilities.
[0048] In order to further improve the computing power of a single chip, more and more computing units are integrated on GPGPU. However, when the computing power increases faster than the memory access bandwidth (i.e., the total amount of data transferred between the computing unit and the memory per unit time), the memory access bandwidth becomes the bottleneck of GPGPU computing power. Each iteration, forward propagation, and backward propagation of a neural network requires a large amount of data to be read from the memory. If the memory access bandwidth is insufficient, valuable computing resources will be wasted, and the advantages of parallel computing will be difficult to play. Therefore, how to improve the memory access bandwidth has become an urgent problem that high-performance computing chips (such as GPGPU) need to solve.
[0049] An effective way to increase memory bandwidth is to optimize data structure and storage format by compressing data. Since a large amount of redundant and duplicate data is generated during large model training and inference, data compression can often achieve higher memory bandwidth benefits at a lower hardware cost. However, software-level compression is usually complex and relatively slow, so it is more beneficial to implant efficient data compression devices and corresponding data decompression devices in hardware.
[0050] However, when faced with redundant and repeated data generated during large model training and inference, commonly used data compression algorithms cannot effectively compress the data due to the characteristics of this type of data (such as diversity, high latitude, nonlinearity, sparsity, etc.).
[0051] Based on this, an embodiment of the present application provides a data compression device for improving the success rate of data compression.
[0052] Please refer to Figure 1 , Figure 1It is a structural schematic diagram of a data compression device provided in an embodiment of the present application.
[0053] like Figure 1 As shown, the data compression device 1 comprises:
[0054] The target base determination module 11 is used to obtain each candidate base of the data to be compressed and the comparison sequence of each candidate base, and determine the target base from each candidate base based on the comparison sequence of each candidate base; the comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed;
[0055] A data compression module 12 is used to compress the data to be compressed according to the target base to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence;
[0056] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0057] The candidate base may be selected from each data block of the data to be compressed. Therefore, the candidate base is also a data block containing multiple bit values.
[0058] In order to achieve a better success rate in data compression, multiple data blocks can be selected as candidate bases at one time in each data block of the data to be compressed; thus, the selected multiple candidate bases can be used to perform one-to-one comparisons with the data blocks to obtain a comparison sequence for each candidate base.
[0059] For example, if the data to be compressed is divided into 32 data blocks, and two data blocks are selected as candidate bases, the first candidate base can be used to compare with the 32 data blocks one by one, and 32 comparison results of the first candidate base are obtained, and the 32 comparison results constitute the comparison sequence of the first candidate base; at the same time, the second candidate base is used to compare with the 32 data blocks one by one, and 32 comparison results of the second candidate base are obtained, and the same 32 comparison results constitute the comparison sequence of the second candidate base. It can be seen that the number of bits of the comparison sequence of the candidate base (for example, 32 comparison results is 32 bits) is equal to the number of data blocks of the data to be compressed.
[0060] After obtaining the alignment sequence of the candidate base, the alignment result indicated by the alignment sequence of the candidate base can be used to select a target base that can be used for compression.
[0061] The compressed data includes the target base alignment sequence, the target base, and the non-target base data blocks arranged in sequence. Since the target base alignment sequence (bitmask) indicates the position of the data blocks that are the same as the target base and the positions of the data blocks that are different from the target base (non-target base data blocks), the target base and non-target base data blocks can be directly decompressed and restored to the data to be compressed based on the positions indicated by the target alignment sequence, so as to accurately compress and decompress the data and achieve lossless data compression.
[0062] To facilitate understanding that the data compression device provided in the embodiment of the present application can produce a better success rate, a comparison is made here using the usual method of using a basis for data compression.
[0063] Please refer to Figure 2 and Figure 3 , Figure 2 This is a schematic diagram of the implementation process of the basis-based data compression method. Figure 3 This is another schematic diagram of the implementation process of the basis-based data compression method.
[0064] Figure 2 The base-based data compression method shown in the figure takes the BDI compression (Base-Delta-Immediate Compression) algorithm commonly used in hardware as an example. The core idea is to select one or more bases. If the value of a data block in the data blocks divided by the data to be compressed is very close to the value of the selected base, then this data block can be represented in the form of "base + delta".
[0065] For example, Figure 2 Shown is a schematic diagram of the success of the BDI compression algorithm. Figure 2 Assuming that the first step length of 4-byte data 0x00000000 is the only basis, 0x0000000B = 0x00000000 + 0x0B. In other words, the original data with a length of 4 bytes can be represented by only a 1-byte data 0x0B after being compressed by the BDI compression algorithm.
[0066] Assuming that each 4-Byte original data can be represented in the form of "base + increment", the data length of the compressed data is 4+1*8=12Byte, which saves a total of 20Bytes compared to the original 4*8=32Byte data.
[0067] However, in the BDI compression algorithm, if the value of a data block differs greatly from the base value, compression will fail even if there are many similar data. Figure 3As shown in the figure, assuming that the last data is 0x12345678, the entire compression will fail because the difference between the value of this data block and the base cannot be represented by a 1-byte data. At the same time, in actual data transmission, how to choose a suitable base is also a challenge. Always choosing the first data block of the original data (data to be compressed) as the base may not achieve the expected compression effect, resulting in compression failure.
[0068] The data compression device provided by the embodiment of the present application, when selecting a base (the target base described in the present application) and performing data compression, is different from the method of using a base for data compression in general. The technical solution provided by the present application is based on the comparison sequence of the candidate base, and at least one is selected as the target base in the candidate base, and the comparison sequence of the candidate base is formed by the comparison result of the candidate base and each data block. Therefore, there is no situation where the compression process cannot be performed due to the large difference between the value of the data block and the value of the base. At the same time, the compressed data of the present application includes the target base and the non-target base data block, so the data to be compressed can be directly decompressed and restored according to the target comparison sequence, according to the position indicated in the target comparison sequence that is the same as the value of the target base, and the position that is different from the value of the target base. Instead of using the "base + increment" method for compression and subsequent restoration; Therefore, the correctness of the decompression and restoration of the compressed data can be guaranteed while improving the compression success rate.
[0069] It can be seen that the technical solution provided by the embodiment of the present application, by using the target base determination module, first determines the target base that can be used for data compression, and then compresses the data to be compressed by using the target base through the data compression module to obtain the compressed data; because the compressed data includes the target comparison sequence, target base and non-target base data blocks of the target base arranged in sequence; and the target base is determined based on the comparison sequence of the candidate base, and the comparison sequence of the candidate base is the comparison result of the candidate base and each data block of the data to be compressed. Therefore, the target base determined based on the candidate base, its corresponding target comparison sequence is also the comparison result obtained after the comparison of the target base and each data block of the data to be compressed. At the same time, the target comparison sequence can indicate the position of the data block with the same value as the target base in the data to be compressed, and the position of the non-target base data block in the data to be compressed, that is to say, the comparison result corresponding to the target comparison sequence can reflect the position of the data block with the same value as the target base, and the position of the data block with different value from the target base. Therefore, on the one hand, the technical solution provided by the present application can be based on the target comparison sequence when decompressing the compressed data, directly according to the position of the data block with the same value as the target base indicated by the target comparison sequence in the data to be compressed, and the position of the non-target base data block in the data block to be compressed, combined with the target base and the non-target base data block, to quickly and conveniently restore the compressed data. On the other hand, since the compressed data includes data blocks with different values from the target base (i.e., non-target base data blocks), the data compression device provided by the embodiment of the present application, in the process of using the determined target base for data compression, can also retain the data blocks in the data to be compressed that are inconsistent with the target base value, so as to achieve compression of the data to be compressed; thereby, it can avoid the situation where data compression cannot be performed when facing a non-sparse matrix or data to be compressed with large differences between data blocks; therefore, it can improve the success rate of data compression on the basis of quickly achieving lossless data compression.
[0070] In order to reliably compress data, in one implementation, the data to be compressed may also be preprocessed.
[0071] Please continue to refer to Figure 1 ,like Figure 1 The data compression device 1 may further include:
[0072] A data acquisition module 13, used to acquire data to be compressed;
[0073] The candidate basis matrix forming module 14 is used to compare each candidate basis of the data to be compressed with each data block of the data to be compressed in turn using the candidate basis to obtain a comparison sequence of the candidate basis; based on the comparison sequence of each candidate basis, a candidate basis matrix is formed to provide each candidate basis and the comparison sequence of the candidate basis to the target basis determination module;
[0074] The compression control module 15 is used to determine the data length of the compressed data according to the target base and the target comparison sequence, and determine the compression rate of the compressed data according to the compressible data length range corresponding to the data length of the compressed data. The compression rate is used to indicate whether the data to be compressed can be compressed successfully. When the data length of the compressed data is within the compressible data length range, it indicates that the data to be compressed can be compressed successfully; when the data length of the compressed data is outside the compressible data length range, it indicates that the data to be compressed cannot be compressed successfully.
[0075] For ease of understanding, an example is given in which there are 4 candidate bases of data to be compressed: con-base0, con-base1, con-base2, and con-base3, and there are 8 data blocks of data to be compressed.
[0076] For the candidate base con-base0: the candidate base matrix forming module 14 uses con-base0 to compare with each data block to be compressed in turn, that is, con-base0 is compared with data block d0 to obtain the corresponding comparison result cm00, con-base0 is compared with data block d1 to obtain the corresponding comparison result cm01, ..., con-base0 is compared with data block d7 to obtain the corresponding comparison result cm07, so that the comparison sequence bitmask0 (cm00, cm01, cm02, cm03, cm04, cm05, cm06, cm07) of con-base0 can be obtained.
[0077] For con-base01: the candidate basis matrix forming module 14 uses con-base1 to compare with each data block to be compressed in turn, that is, con-base1 is compared with data block d0 to obtain the corresponding comparison result cm10, con-base1 is compared with data block d1 to obtain the corresponding comparison result cm11, ..., con-base1 is compared with data block d7 to obtain the corresponding comparison result cm17, so that the comparison sequence bitmask1 (cm10, cm11, cm12, cm13, cm14, cm15, cm16, cm17) of con-base1 can be obtained.
[0078] By analogy, the candidate basis matrix forming module 14 can combine the comparison sequences obtained from each candidate basis to form a matrix, namely, the candidate basis matrix S:
[0079]
[0080] After obtaining the candidate base sequence matrix S formed by the comparison sequence of the candidate bases, the candidate base matrix forming module 14 can send the candidate base matrix S and each corresponding candidate base to the target base determination module 11, so that the target base determination module 11 can determine the target base that can be used for compression based on the comparison sequence of the candidate bases and the corresponding candidate bases in the candidate base matrix S.
[0081] The compression control module 15 can calculate the compression ratio of the compressed data and control the stable and reliable data compression. In one embodiment, when calculating the compression ratio, the compression control module 15 can calculate the data length of the compressed data according to the target base and the target comparison sequence of the target base, and then calculate the ratio of the data length of the compressed data to the data length of the data to be compressed to obtain the compression ratio.
[0082] Since the compressed data includes other data in addition to the target base, the target comparison sequence and the non-target base data block, and the other data is the data with fixed bits added in the embodiment of the present application for the convenience of subsequent decompression, for example, the compressed data may also include the compression rate of the compressed data. Therefore, after the target base determination module 11 determines the target base, the compression control module 15 can directly determine the compression rate according to the target base, the target comparison sequence and other data with fixed bits when calculating the compression rate.
[0083] The compressible data length range is used to limit the numerical range of the length of the compressed data that can be compressed successfully. The numerical range can be determined based on the expected data length of the compressed data and the data length of the data to be compressed. For example, the expected data length of the compressed data can be 32B, 64B, or 96B.
[0084] In order to further improve the success rate of data compression, the compressible data length range that can be formed based on the above-mentioned expected data length of the compressed data can be limited by the maximum expected data length of the compressed data and the data length of the data to be compressed. For example, the data length of the data to be compressed is 128B, and the maximum expected data length of the compressed data is 96B, then the compressible data length range can be expressed as (0, 96]. If the compressed data actually obtained is within the range of (0, 96], it means that the data to be compressed can be compressed successfully, so that the compressed data obtained by the data compression module 12 can be output, otherwise the original data, i.e., the data to be compressed, is directly output to ensure the stability of the data compression process.
[0085] In order to fully ensure the realization of data compression, in an embodiment of the present application, the length range of compressible data can be divided into levels, so that compressed data with different compression rates can be smoothly compressed and output.
[0086] For example, based on the above embodiment in which the data length of the data to be compressed is 128B and the expected data length of the compressed data is 32B, 64B, and 96B, the compressible data length range (0, 96] can be divided into a first level (0, 32], whose corresponding compression rate is 1 / 4 (32 / 128), a second level (32, 64], whose corresponding compression rate is 2 / 4 (64 / 128), and a third level (64, 96], whose corresponding compression rate is 3 / 4 (96 / 128), thereby satisfying data compression at different compression levels.
[0087] That is to say, the compressed data obtained in the embodiment of the present application may have different compression rates. Figure 4 , Figure 4 It is a schematic diagram of different compression rates corresponding to the compressed data provided in an embodiment of the present application.
[0088] Under different compression rates, all possible formats of the output data (compressed data) of the data compression device 1 are as follows: Figure 4 As shown, when the data length of the compressed data is less than or equal to 32, the compression ratio is 1 / 4; when the data length of the compressed data is greater than 32B and less than or equal to 64B, the compression ratio is 2 / 4; when the data length of the compressed data is greater than 64B and less than or equal to 96B, the compression ratio is 3 / 4; when the data length of the compressed data is greater than 96B, the compression is considered to have failed.
[0089] It should be noted that Figure 4 The data length of the compressed data shown = the data length of the compressed data (compressed data) + the data length of other data (referred to as metadata meta in the embodiment of the present application), and the bits of metadata are fixed. The addition of metadata can facilitate the subsequent decompression and restoration of the compressed data. For example, the metadata can include bits indicating the compression rate.
[0090] To facilitate subsequent decompression and restoration, the number of bits added in the low-order bits of the compressed data can be determined according to the compression rate to store values representing different compression rates. For example, when the compression rate corresponds to the four aforementioned compressible data length ranges, two bits can be added accordingly, and the compression rates of different compressed data can be represented according to the values in the two bits. The compression rate of the compressed data can be part of the aforementioned metadata.
[0091] For example, "00" can be used to indicate a compression rate of 1 / 4, and the lower two bits of the compressed data output at this time are written as "00"; "01" can be used to indicate a compression rate of 2 / 4, and the lower two bits of the compressed data output at this time are written as "01"; "10" can be used to indicate a compression rate of 3 / 4, and the lower two bits of the compressed data output at this time are written as "10". Of course, if the compression rate exceeds 3 / 4, "11" can be used to indicate it accordingly.
[0092] In other implementations, if the compression ratio can have more situations, the number of bits can be added according to the number of specific compression ratios.
[0093] During decompression, the bit width of the input data corresponds to the width of the transmission channel, that is, it is not the data length of the compressed data; therefore, when the compressed data is subsequently decompressed and restored, the compressed data can be determined in the input data based on the values written in the lower two bits. For example, if the value corresponding to the compression rate is "00", it means that the data length of the compressed data is between (0, 32B], then according to the compression rate and the data length of the input data (equal to the data length of the data to be compressed during the compression process), it can be ensured that the selected data contains the data to be decompressed (compressed data), so as to accurately decompress and restore the compressed data during the decompression process.
[0094] In order to accurately select a target basis that can be used for compression, in one embodiment, the candidate basis matrix forming module 14 may include:
[0095] A candidate base determination module is used to divide the data to be compressed based on a compression step size of a preset number of bits to obtain divided data blocks; and to determine at least one data block from each data block as a candidate base;
[0096] A comparison module is used to compare, for each candidate base, the values corresponding to each bit in the candidate base with the values corresponding to each bit in each data block in turn, to obtain the comparison results corresponding to each data block;
[0097] A comparison sequence forming module is used to set a first value at a bit position corresponding to a data block when it is determined that the comparison results corresponding to the data blocks are the same for each candidate base; set a second value at a bit position corresponding to the data block when it is determined that the comparison results corresponding to the data blocks are different; and obtain a comparison sequence of the candidate base based on the first value and the second value set in sequence.
[0098] The compression step length of the preset bit number can be selected according to actual needs, for example, the compression step length can be set to 4B. The compression step length can be a part of the metadata meta mentioned above.
[0099] When the data length of the data to be compressed is 128B, the candidate base determination module can divide the 128B data to be compressed into 32 (128B / 4B) data blocks according to the compression step size 4B, and the data length of each data block is 4B.
[0100] Then, the candidate base determination module may select at least one data block from the 32 data blocks as a candidate base, for example, select the first 4 data blocks from the 32 data blocks as the candidate base.
[0101] Of course, in other implementations, 8 or 10 can also be selected as candidate bases. An appropriate number of candidate bases can be selected according to hardware design and usage requirements to meet the determination of the target base. Here, 4 data blocks are selected as candidate bases for example.
[0102] It should be noted that when selecting candidate bases, in order to ensure that the final target base can have sufficient positive returns, the first M data blocks can be selected as candidate bases in the divided data blocks, and N target bases can be selected from the M candidate bases. Among them, M is greater than N, and M is less than the number of divided data blocks.
[0103] The comparison module can compare each selected candidate base with each data block respectively. During the comparison, the value on each bit in the candidate base can be compared one by one with the value on each bit in the data block; if the values on each bit are the same, it means that the value of the data block is the same as the value of the candidate base, otherwise the value of the data block is different from the value of the candidate base.
[0104] For example, take the aforementioned four candidate bases con-base0, con-base1, con-base2, and con-base3 as an example.
[0105] For the candidate base con-base0, the comparison result between it and each data block di (i=0, 1, 2, . . . , 31) can be expressed as cm0i.
[0106] Correspondingly, for the candidate base con-base1, the comparison result between it and each data block di (i=0, 1, 2, ..., 31) can be expressed as cm1i; for the candidate base con-base2, the comparison result between it and each data block di (i=0, 1, 2, ..., 31) can be expressed as cm2i; for the candidate base con-base3, the comparison result between it and each data block di (i=0, 1, 2, ..., 31) can be expressed as cm3i.
[0107] The comparison sequence forming module may set a value at a position corresponding to each data block in turn according to the comparison result obtained by the comparison module, wherein the first value may be "1" and the second value may be "0".
[0108] For example, the compression step size is 4B, the data to be compressed is 128B, M=4, N=2 (the first 4 data blocks are selected as candidate bases, and 2 target bases are selected from the 4 candidate bases) as an example for explanation.
[0109] Among them, the four candidate bases can be represented as in the above-mentioned embodiment: con-base0, con-base1, con-base2, con-base3.
[0110] For the candidate base con-base0, if the comparison result between the candidate base con-base0 and the first data block d0 is the same, 1 can be set at the bit corresponding to the data block d0 (i.e. cm00=1); if the comparison result between the candidate base con-base0 and the first data block d0 is different, 0 can be set at the bit corresponding to the data block d0 (i.e. cm00=0); thus, the comparison sequence bitmask0=(cm00=1, cm01=0, cm02=0, ..., cm031=1) of the candidate base can be obtained according to the comparison result between the candidate base and each data block.
[0111] Correspondingly, for the candidate base con-base1, if the comparison result of the candidate base con-base1 and the first data block d0 is the same, then 1 can be set at the bit corresponding to the data block d0 (that is, cm10=1); if the comparison result of the candidate base con-base1 and the first data block d0 is different, then 0 can be set at the bit corresponding to the data block d0 (that is, cm10=0); thereby, the comparison sequence s1=(cm10=1, cm11=1, cm12=0, ..., cm131=0) of the candidate base can be obtained according to the comparison result of the candidate base and each data block.
[0112] By analogy, we can get the comparison sequence bitmaskj (j=0, 1, 2, 3) of each candidate base, and we can see that the comparison sequence of the candidate base is 32 bits. That is to say, after the data length and compression step of the data to be compressed are determined, the number of bits of the comparison sequence bitmask of the candidate base is also determined.
[0113] The candidate basis matrix forming module transmits the candidate basis and the candidate basis matrix to the target basis determining module 11 after forming the candidate basis matrix.
[0114] In order to select a target base that can generate positive returns, in one embodiment, the target base determination module 11 may include:
[0115] A statistical module, for counting the number of first values in the alignment sequence of each candidate base to obtain a statistical value;
[0116] A statistical value selection module is used to sort the statistical values of each candidate base in positive order and select the top two statistical values;
[0117] The statistical value comparison module is used to compare the two selected statistical values with the profit threshold to determine the statistical value greater than the profit threshold, so as to determine the candidate basis corresponding to the statistical value greater than the profit threshold as the target basis.
[0118] At this time, the statistical module in the target base determination module 11 counts the number of first values in the comparison sequence of each candidate base, because the first value is set when the comparison results are the same. Therefore, the statistics of the number of first values can clearly determine the number of data blocks in the data block that have the same value as the target base.
[0119] For example, for the alignment sequence bitmask0 of the candidate base con-base0, the statistical value obtained is sum0; for the alignment sequence bitmask1 of the candidate base con-base1, the statistical value obtained is sum1; for the alignment sequence bitmask2 of the candidate base con-base2, the statistical value obtained is sum2; for the alignment sequence bitmask3 of the candidate base con-base3, the statistical value obtained is sum3.
[0120] Based on the above content, it can be known that the compressed data must include the target comparison sequence of the target base, and the target comparison sequence is a data sequence with a certain data length. When data compression is performed, the compression effect of the data is mainly reflected in the saving of the data length of the data block with the same value as the target base. If the number of data blocks with the same value as the target base is large, then the data length of the saved data block can be greater than the data length of the added bitmask, and data compression can achieve positive benefits; conversely, if the number of data blocks with the same value as the target base is small, then the saved data length is less than the data length of the added bitmask, and data compression produces negative benefits. Therefore, in order to ensure that the selected target base produces positive benefits, the benefit threshold can be calculated in advance when selecting the target base. Among them, the benefit threshold represents the number of data blocks with the same value as the target base in the comparison sequence of the target base, so that after the selected target base is compressed, it can ensure that the data length of the saved data block is greater than the data length of the target comparison sequence that must be added to the compressed data, thereby generating positive benefits.
[0121] When calculating the income threshold C, the following formula can be used:
[0122] C=W / (L 2 );
[0123] Wherein, W represents the data length of the data to be compressed, and L represents the data length corresponding to the compression step.
[0124] It should be noted that when calculating the revenue threshold C, the units of the data lengths of W and L are the same.
[0125] For example, the unit of the data length corresponding to W and L is bit.
[0126] When the data length of the data to be compressed is W = 2048 bits, and the data length corresponding to the compression step is L = 16 bits, it can be seen that the data lengths of both are bits; when calculating the benefit C, according to the above formula W / (L 2 ), we can calculate C = 2048 / (16 2 )=8.
[0127] In the above formula W / (L 2) = (W / L) / L, where the unit of the calculated value of W / L is bit. This is because the meaning of W / L is that when the compression step length L is 16 bit and the data length W of the data to be compressed is 2048 bit, the number of divided data blocks that can be obtained is 128. Based on the content of the foregoing embodiments, it can be known that the data length of the target comparison sequence is equal to the number of divided data blocks, and in the process of obtaining the target comparison sequence, both the first value and the second value are set at the bit positions corresponding to the data blocks. Therefore, the unit of the data length of the target comparison sequence is bit, that is, the data length of the target comparison sequence is equal to the number of bits of the number of divided data blocks.
[0128] Since the foregoing embodiments are described by taking selecting no more than two candidate bases from 4 candidate bases as the target bases as an example. Therefore, after the statistical module completes the statistics of the number of data blocks (sum0, sum1, sum2, sum3) in the comparison sequences of each candidate base that are the same as the value of the candidate base, in order to have a greater positive benefit, the statistical value selection module selects the two candidate bases with the largest statistical values for the next determination of the target bases.
[0129] The statistical value selection module selects the top two statistical values: Sum1 and Sum2 from the sum0, sum1, sum2, sum3 sorted in ascending order.
[0130] Then, the statistical value comparison module can compare Sum1 and Sum2 based on the foregoing calculated benefit threshold C:
[0131] When Sum1 > C and Sum2 > C, the candidate bases corresponding to Sum1 and Sum2 can be determined as 2 target bases;
[0132] When Sum1 > C and Sum2 < C, the candidate base corresponding to Sum1 can be determined as 1 target base;
[0133] When Sum1 < C and Sum2 > C, the candidate base corresponding to Sum2 can be determined as 1 target base;
[0134] When Sum1 < C and Sum2 < C, it means that the compression fails.
[0135] Based on the above operations, the target bases that can be used for compression can be determined.
[0136] It should be noted that after the above target base selection is completed, it does not necessarily mean that the compression will succeed. The target base only indicates that a positive benefit can be generated. Subsequently, further consideration can be given to the compression ratio obtained by the overall compressed data after compression processing based on the selected target base (for example Figure 4As shown), if the data length of the compressed data is within the compressible data length range, the compression ratio at this time indicates that the compressed data can be compressed successfully.
[0137] That is to say, the compression control module may be further used to determine whether compression is successful.
[0138] Please continue to refer to Figure 1 The compression control module 15 can also be used to generate a compression indication signal according to the determined compression ratio, and the compression indication signal is used to control whether to output the compression result of the data compression module 12. When it is determined that the compression ratio indicates that the data to be compressed can be compressed successfully, the compression result of the data compression module 12 is controlled to be output; when it is determined that the compression ratio indicates that the data to be compressed cannot be compressed successfully, the compression result of the data compression module 12 is controlled not to be output;
[0139] The device also includes:
[0140] The first selection output module 16 is used to output the corresponding first output result according to the compression indication signal, wherein when the compression indication signal controls not to output the compression result of the data compression module 12, the first output result is the data to be compressed; when the compression indication signal controls to output the compression result of the data compression module 12, the first output result is the compressed data.
[0141] The compression control module 15 further generates a compression indication signal according to the calculated compression ratio to determine whether the final output is compressed data or data to be compressed.
[0142] The first selection output module 16 can receive a compression indication signal. When the compression ratio indicates that the data to be compressed can be compressed successfully, the first selection output module 16 selects to output the compressed data according to the control of the compression indication signal. When the compression ratio indicates that the data to be compressed fails to be compressed (for example, the compression ratio is greater than 3 / 4, and the compression fails), the first selection output module 16 selects to output the data to be compressed according to the control of the compression indication signal. This facilitates the complete implementation of the data compression process and improves the overall stability of the data compression device 1.
[0143] That is to say, regardless of whether the compression ratio indicates that the data to be compressed can be compressed successfully, the compression process of the data compression module 12 must be executed, and the output result is selected and output by the first selection output module 16 according to the compression indication signal output by the compression control module 15.
[0144] Since there are situations where data compression is not required, in order to fully utilize different usage environments to accurately output the final data, in one implementation, a hardware structure for outputting the final data may also be included.
[0145] Please continue to refer to Figure 1 ,like Figure 1 As shown, the data compression device 1 may further include:
[0146] An information receiving module 17, used for receiving a compression signal and data to be compressed, wherein the compression signal is used for indicating whether to compress the data to be compressed;
[0147] The second selection output module 18 is used to output a corresponding second output result according to the compression signal; wherein, when it is determined that the compression signal indicates that the data to be compressed is not to be compressed, the second output result is the data to be compressed; when it is determined that the compression signal indicates that the data to be compressed is to be compressed, the second output result is the first output result of the first selection output module.
[0148] The information receiving module 17 receives the compression signal (cmp_en) and the data to be compressed (data). Since there may be situations where compression is not required in the data compression process, the second selection output module 18 can first determine whether the data to be compressed is the data to be compressed based on the compression signal. If so, the various modules provided in the aforementioned embodiments are used to compress the data to be compressed and output the compressed data; if not, the data to be compressed is directly output, thereby facilitating the control and execution of the data compression process.
[0149] If, when it is determined that the compression signal indicates that the data to be compressed is to be compressed, there is a compression failure in the data compression process, for example, the target base determination module 11 does not select a target base that can be used for compression, that is, the statistical value obtained in the comparison sequence of the candidate base is less than the benefit threshold; at this time, the data compression fails, then the second selection output module 18 still outputs the data to be compressed itself.
[0150] Alternatively, when the compression rate determined by the compression control module 15 indicates that the data to be compressed cannot be compressed successfully, the first selection output module 16 selects to output the data to be compressed itself according to the control of the compression indication signal.
[0151] To facilitate understanding of the implementation of the data compression device provided in the embodiment of the present application, an example in which the data compression device uses a single compression step is used for explanation.
[0152] Please refer to Figure 5 , Figure 5 It is another structural schematic diagram of the data compression device provided in an embodiment of the present application.
[0153] Figure 5 As shown, taking the data length of the data to be compressed as 128B and the compression step size as 4B as an example, the target basis determined by the target basis determination module 11 (4B) is determined from the candidate basis obtained after the data to be compressed is divided by the candidate basis matrix formation module 14 according to the compression step size of 4B.
[0154] The compression control module 15 calculates the compression ratio according to the target base and the target comparison sequence determined by the target base determination module 11 (4B), and outputs a compression indication signal.
[0155] The data compression module 12 (4B) compresses the data to be compressed.
[0156] The first selection and output module 16 selects and outputs the compression result of the data compression module 12 according to the compression instruction signal output by the compression control module 15 , that is, outputs the first output result.
[0157] The second selection module 18 selects to output the data to be compressed or the first output result according to the compression signal (cmp_en).
[0158] In order to improve the compression effect of data compression, that is, to make the compressed data have a better compression rate, in one embodiment, the compressed data may also include a compression step, the number of the target base determination modules 11 may be at least 2, and the compression step corresponding to the target base obtained by each target base determination module 11 is different; the number of the data compression modules 12 is at least 2; so as to synchronously use multiple target base determination modules 11 to determine target bases with different compression steps to perform data compression, so as to select the target base with the highest compression rate from the compression rates calculated corresponding to the target bases of multiple compression steps, and then output the compressed data compressed by the target base.
[0159] Please refer to Figure 6 , Figure 6 It is another structural schematic diagram of the data compression device provided in an embodiment of the present application.
[0160] like Figure 6 As shown, the compression control module 15 is also used to receive the target bases determined by each of the target base determination modules 11 and the target comparison sequences corresponding to each of the target bases; and to compare the compression rates determined by each of the target base determination modules 11 to obtain a compression rate comparison result; and to generate a target base selection signal according to the compression rate comparison result; the target base selection signal is used to select and output the compressed data corresponding to the target base with a smaller compression rate.
[0161] Figure 6 In each target basis determination module 11, the compression step length of the determined target basis is different, that is, there are multiple compression step lengths of the preset bit number used when dividing the data to be compressed.
[0162] The compression control module 15 can determine the compression rate corresponding to each target base determination module 11 based on the target base and target comparison sequence determined by each target base determination module 11, and select the target base with the optimal compression rate (the smallest compression rate) to output the compressed data corresponding to the target base.
[0163] The compression control module 15 generates a target base selection signal so that the first selection output module 16 selects and outputs the compressed data of the corresponding target base according to the target base selection signal.
[0164] The target base selection signal can be sent to the first selection output module 16. At this time, the first selection output module 16 can receive the compressed data output by each data compression module 12, and then output the corresponding compressed data using the target base selected by the target base selection signal.
[0165] If the target base selected by the target base selection signal has a compression ratio corresponding to it (the selected compression ratio is the smallest among the multiple compression ratios) indicating that the data to be compressed can be compressed successfully, for example, the compression ratio of the selected target base is any one of the aforementioned 1 / 4, 2 / 4, and 3 / 4, then the first selection output module 16 can output the compressed data obtained based on the selected target base. Otherwise, the first selection output module 16 outputs the data to be compressed.
[0166] By selecting a target basis with an optimal compression rate from target bases obtained from multiple compression steps, the data to be compressed is compressed, so that the compressed data can have a better compression rate and the compression effect of the data compression can be improved.
[0167] In the case of having multiple target basis determination modules 11, the candidate basis matrix formation module 14 can be set to one (eg Figure 6 As shown), multiple target basis determination modules 11 use the output result of the same candidate basis matrix forming module 14, and the compression step of the preset bit number used by the candidate basis matrix forming module 14 is the smallest compression step among the compression step sizes used by the multiple target basis determination modules 11, for example, the smallest compression step size is 1B, so that compression step sizes with other different bit numbers can reuse the candidate basis matrix obtained by the candidate basis matrix forming module 14, thereby reducing the setting of hardware modules and simplifying the structural design of the data compression device.
[0168] To facilitate understanding of the data compression device provided in the embodiment of the present application and the data structure of the compressed data obtained, please refer to Figure 7 , Figure 7 It is a data structure diagram of compressed data obtained by using the data compression device provided in the embodiment of the present application.
[0169] like Figure 7 As shown, the compressed data includes:
[0170] The bits [1023:8] for storing the compressed data compress data (including the target comparison sequence, target base, and non-target base data blocks arranged in sequence); the bits [7:2] for storing the compression step compress mode; and the bits [1:0] for storing the compression ratio length of the compressed data. It can be seen that the bits of the compression step and the compression ratio included in the compressed data are fixed, which is 8 bits. Therefore, after the target base determination module 11 determines the target base and the corresponding target comparison sequence, the compression control module 15 can calculate the compression ratio and determine whether the data to be compressed is compressible (generate a compression indication signal) so as to control whether the first selection output module 16 outputs the compression result of the data compression module 12. Among them, the compression ratio and compression step of the compressed data constitute the aforementioned metadata.
[0171] When the compressed data is subsequently decompressed and restored, the data segment containing the compressed data can be determined based on the compression ratio of the compressed data, and the restoration step used during decompression can be determined based on the compression step, so that the compressed data can be restored losslessly.
[0172] Based on the above embodiments, it can be known that when determining the target base from the candidate base, the number of the target bases can be 1, 2, or 0. To understand the compressed data obtained with different numbers of target bases, please refer to Figure 8-Figure 11 , Figure 8 is a schematic diagram of a structure of data to be compressed provided by an embodiment of the present application, Fig. 9 is based on Figure 8 A schematic diagram of the structure of compressed data obtained by compressing the data to be compressed is shown, Fig.10 is another structural diagram of data to be compressed provided by an embodiment of the present application, Fig.11 is based on Fig.10 A schematic structural diagram of compressed data obtained by compressing the data to be compressed is shown.
[0173] Figure 8-Figure 11 In the figure, the data length of the data to be compressed is 128B and the compression step is 4B.
[0174] Figure 8 The figure shows a schematic diagram of a structure in which two target bases (d0 and d1) are determined in data blocks (32) divided into data to be compressed (raw).
[0175] Since the compression step is 4B and the data to be compressed is 128B, the target comparison sequence bitmask0 obtained for the target base d0 is 32 bits, and the target comparison sequence bitmask1 obtained for the target base d1 is also 32 bits.
[0176] like Figure 8 As shown in the figure, the same filling format of the data blocks indicates that the values of the two data blocks are the same. Figure 8 Among the data blocks to be compressed shown, the data blocks with the same value as d0 are: d2, d5, ..., d31, that is, d0=d2=d5=…=d31; the data blocks with the same value as d1 are: d3, ..., d29, that is, d1=d3=…=d29, and the two target comparison sequences obtained are: bitmask0=101001…001 and bitmask1=010100…100.
[0177] Based on Figure 8 As shown, it can be obtained Fig. 9 The compressed data shown ( Fig. 9 The compression step size of the lower eight bits and the compression ratio of the compressed data are not shown).
[0178] like Fig. 9 As shown, the compressed data includes: compressed data; the compressed data is, from high to low, the target comparison sequences bitmask0 and bitmask1 of the two target bases, the first target base d0, the second target base d1, and each non-target base data block (d4, ..., d30) having a value different from the target base.
[0179] Fig.10 The figure shows a schematic diagram of a structure in which one target basis (d0 and d1) is determined in the data blocks (32) into which the data to be compressed is divided.
[0180] Since the compression step is 4B and the data to be compressed is 128B, the target comparison sequence bitmask0 obtained for the target base d0 has 32 bits.
[0181] like Fig.10 As shown, the same filling format of the data blocks indicates that the values of the two data blocks are the same. Fig.10 Among the data blocks of the data to be compressed shown, the data blocks with the same value as d0 are: d2, d3, d5, ..., d31, that is, d0=d2=d3=d5=...=d31, and the obtained target comparison sequence bitmask0=101101...001.
[0182] Based on Fig.10 As shown, it can be obtained Fig.11The compressed data shown ( Fig.11 The compression step size of the lower eight bits and the compression ratio of the compressed data are not shown).
[0183] like Fig.11 As shown, the compressed data includes: compressed data, which is from high to low: the target comparison sequence bitmask0 of the target base, the target base d0, and each non-target base data block (d1, d4, ..., d29, d30) with a value different from the target base.
[0184] To understand the structural design of data compression devices under different compression step sizes, you can refer to Fig.12 , Fig.12 It is another structural schematic diagram of the data compression device provided in an embodiment of the present application. Fig.12 In the structure shown, multiple target basis determination modules 11 use a candidate basis matrix formation module 14.
[0185] like Fig.12 As shown, the data compression device 1 may include:
[0186] The information receiving module 17 receives the compression signal cmp_en and the data to be compressed data to control whether to compress the data to be compressed received by the data obtaining module; for example, when cmp_en=0, the data to be compressed is not compressed and is directly output; when cmp_en=1, the data to be compressed is compressed.
[0187] A data acquisition module 13 (d_in), receiving data to be compressed;
[0188] Candidate basis matrix forming module (compare matrix) 14;
[0189] 5 target base determination modules 11 with different compression step sizes: a target base determination module with a compression step size of 1B (target base determination module 11(1B): base choose 1B), a target base determination module with a compression step size of 2B (target base determination module 11(2B): base choose 2B), a target base determination module with a compression step size of 4B (target base determination module 11(4B): base choose 4B), a target base determination module with a compression step size of 8B (target base determination module 11(8B): basechoose 8B), and a target base determination module with a compression step size of 16B (target base determination module 11(16B): base choose16B);
[0190] Target alignment sequence selection module (bitmask mini search) (compression control module 15);
[0191] The data compression modules (inv_butterfly) 12 are connected to the corresponding five compression control modules 15: data compression module 12 (1B), data compression module 12 (2B), data compression module 12 (4B), data compression module 12 (8B), and data compression module 12 (16B).
[0192] The first selection output module (mux0) 16 is used to receive the target base selection signal output by the compression control module 15 and the compressed data output by each data compression module 12, so as to output the corresponding compressed data according to the target base selection signal.
[0193] The second selection output module (mux1) 18 receives the compression signal, the data to be compressed and the first output result output by the first selection output module 16. When the compression signal does not compress the data to be compressed, the second selection output module 18 outputs the data to be compressed. When the compression signal compresses the data to be compressed, the second selection output module 18 outputs the first output result output by the first selection output module 16.
[0194] Among them, the first data result output by the first selection output module 16 includes: the compression indication signal output by the compression control module 15 is: when the compression rate indicates that the data to be compressed can be compressed, combined with the target base selection signal of the compression control module 15, the corresponding selected compressed data is output; when the compression indication signal output by the compression control module 15 is: when the compression rate indicates that the data to be compressed cannot be compressed, the data to be compressed is directly output.
[0195] The embodiment of the present application also provides a data decompression device for decompressing and restoring the compressed data obtained by the data compression device provided in the above embodiment.
[0196] Please refer to Fig.13 , Fig.13 It is a structural schematic diagram of a data decompression device provided in an embodiment of the present application.
[0197] like Fig.13 As shown, the data decompression device 2 includes:
[0198] A compressed data acquisition module 21 is used to acquire compressed data, wherein the compressed data at least includes a target comparison sequence corresponding to a target base, a target base, and a non-target base data block arranged in sequence, wherein the value of the non-target base data block is different from the value of the target base; the compressed data is obtained by compressing the data to be compressed based on the data compression device 1 described in the above embodiment;
[0199] A data decompression and restoration module 22 is used to decompress and restore the compressed data based on the target base, the target comparison sequence and the non-target base data block to obtain decompressed data;
[0200] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0201] The data decompression and restoration module 22 fills the target base at the position of the data block indicated by it that is the same as the target base, and fills the non-target base data block at the position of the non-target base data block indicated by it according to the target comparison sequence, so that the data to be compressed itself can be losslessly restored, thereby achieving fast and accurate data decompression.
[0202] It can be seen that the technical solution provided by the embodiment of the present application, since the compressed data includes the target comparison sequence of the target base, the target base and the non-target base data blocks arranged in sequence; and when the data compression device performs compression, the target base used is determined based on the comparison sequence of the candidate base, and the comparison sequence of the candidate base is the comparison result of the candidate base and each data block of the data to be compressed. Therefore, the target base determined based on the candidate base, and its corresponding target comparison sequence is also the comparison result obtained after the comparison of the target base and each data block of the data to be compressed. At the same time, the target comparison sequence can indicate the position of the data block with the same value as the target base in the data to be compressed, and the position of the non-target base data block in the data to be compressed, that is to say, the comparison result corresponding to the target comparison sequence can reflect the position of the data block with the same value as the target base, and the position of the data block with different value from the target base. Therefore, on the one hand, the technical solution provided by the present application can be based on the target comparison sequence when decompressing the compressed data, directly according to the position of the data block with the same value as the target base indicated by the target comparison sequence in the data to be compressed, and the position of the non-target base data block in the data block to be compressed, combined with the target base and the non-target base data block, to quickly and conveniently restore the compressed data. On the other hand, since the compressed data includes data blocks with different values from the target base (i.e., non-target base data blocks), the data compression device provided by the embodiment of the present application, in the process of using the determined target base for data compression, can also retain the data blocks in the data to be compressed that are inconsistent with the target base value, so as to achieve compression of the data to be compressed; thereby, it can avoid the situation where data compression cannot be performed when facing a non-sparse matrix or data to be compressed with large differences between data blocks; therefore, it can improve the success rate of data compression on the basis of quickly achieving lossless data compression.
[0203] In order to accurately restore the data to be compressed, the compressed data may also include the data length and compression step of the compressed data. Fig.13 , the data decompression device 2 may further include:
[0204] The data acquisition module 20 is used to receive the data to be decompressed, wherein the data to be decompressed includes compressed data;
[0205] A comparison sequence determination module 23, used to determine a target comparison sequence according to the compression step size and the data length of the data to be decompressed;
[0206] The valid data determination module 24 is used to determine valid data of corresponding data length in the data to be decompressed according to the data length of the compressed data, so as to provide the valid data to the compressed data acquisition module 21 as compressed data.
[0207] During data transmission, the data length of the data to be decompressed corresponds to the width of the transmission channel. That is to say, even if the data compression device 1 compresses successfully, the data length of the compressed data is reduced. When the data compression device 1 transmits the compressed data to the data decompression device 2, it is also necessary to fill the compressed data with invalid data so that the data length of the filled data (data to be decompressed) meets the width of the transmission channel.
[0208] The data to be decompressed received by the data acquisition module 20 is the padded data, which includes the compressed data and the padded invalid data.
[0209] The compression step length of the compressed data can be used to determine the target comparison sequence in the data to be decompressed. Since the data length of the data to be decompressed is the same as the data length of the data to be compressed, the data length of the data to be decompressed is known. For example, the data length of the data to be decompressed can be 128B. Therefore, according to the compression step length (for example, 4B), the data length of the target comparison sequence is determined to be 128 / 4=32bit, and the data length of the target comparison sequence can be calculated; thereby, based on the data length of the valid data and the target comparison sequence, the target comparison sequence is determined in the valid data.
[0210] In order to accurately decompress and restore the data, on the one hand, the comparison sequence determination module 23 is used to determine the target comparison sequence in the data to be decompressed, and on the other hand, the valid data determination module 24 is used to determine the valid data so that the determined valid data can be used as the compressed data, thereby combining the valid data and the target comparison sequence to restore the compressed data.
[0211] In one implementation, the data decompression and restoration module 22 may include:
[0212] A target base restoration module, used to restore the target base in the valid data to the bit position set to the first value in the target comparison sequence, to obtain first restored data;
[0213] A non-target base data block restoration module, used to restore the non-target base data block in the valid data to the bit position set to the second value in the target comparison sequence, to obtain second restored data;
[0214] The data combining module is used to combine the first restored data and the second restored data to obtain decompressed data.
[0215] The comparison sequence determination module 23 obtains the target comparison sequence, which can be input into the target base restoration module. At the same time, the valid data determination module can synchronously transmit the determined valid data to the target base restoration module and the non-target base data block restoration module; thereby, the target base restoration module restores the target base to the bit position indicated by the target comparison sequence, which is the same as the target base, that is, the bit position of the first value (1), based on the target base and the target comparison sequence in the valid data; the non-target base data block restoration module restores the non-target base data block to the bit position corresponding to the non-target base data block indicated by the target comparison sequence, that is, the bit position of the second value (0), based on the non-target base data block in the valid data.
[0216] Based on the execution process of the aforementioned data compression device 1 , it can be known that the target comparison sequence is a string of data consisting of 0s and 1s.
[0217] Therefore, in the target base restoration module, after the target base is restored based on the target comparison sequence, the format of the first restored data is: the position of 1 in the target comparison sequence is the target base, and the position of 0 is all 0; the format of the second restored data is: the position of 0 in the target comparison sequence is the non-target base, and the position of 1 is all 0.
[0218] After obtaining the first restored data and the second restored data, the data combination module can be used to combine the first restored data and the second restored data, and the position of "0" in the first restored data is filled with the non-target base data block at the corresponding position in the second restored data, and the position of "0" in the second restored data is filled with the target base at the corresponding position in the first restored data; finally, the decompressed data is obtained.
[0219] Please continue to refer to Fig.13 In order to accurately control the decompression execution of the data decompression device, in one embodiment, the data decompression device 2 may further include:
[0220] A decompression information receiving module 25, used for receiving a decompression signal and data to be decompressed, wherein the decompression signal is used for controlling the decompression of the data to be decompressed;
[0221] The third selection output module 26 is used to output a third output result according to the decompression signal; wherein, when it is determined that the decompression signal indicates that the data to be decompressed is to be decompressed, the third output result is the decompressed data; when it is determined that the decompression signal indicates that the data to be decompressed is not to be decompressed, the third output result is the data to be decompressed.
[0222] The decompression signal received by the decompression information receiving module 25 can be used to enable the data decompression device 2 to determine whether to decompress the received data to be decompressed. If the decompression signal indicates that the data to be decompressed is not to be decompressed, the data to be decompressed can be directly output; if the decompression signal indicates that the data to be decompressed is to be decompressed, the data decompression device 2 is used to decompress the data to be decompressed to output the decompressed data.
[0223] The third selection output module 26 can be connected to the decompression information receiving module 25 and the data decompression and restoration module 22, so as to output the decompressed data output by the data decompression and restoration module 22 when it is determined that the decompression signal indicates that the data to be decompressed should be decompressed.
[0224] For example, the structural design of the data decompression device 2 can refer to Fig.14 , Fig.14 It is another structural schematic diagram of the data decompression device provided in an embodiment of the present application.
[0225] like Fig.14 As shown, the structure may include:
[0226] The decompression information receiving module 25 is used to receive the decompression signal cmp_en' and the data to be decompressed data' to determine whether to decompress the data to be decompressed;
[0227] The data acquisition module (d_in) 20 receives the to-be-decompressed data data' from the decompression information receiving module 25, wherein the data length of the to-be-decompressed data is equal to the width of the transmission channel and the data length of the to-be-compressed data;
[0228] A comparison sequence determination module (bitmask generation) 23, used to determine a target comparison sequence based on the data to be decompressed and the compression step size;
[0229] The valid data determination module (data choose) 24 is used to determine valid data of corresponding data length in the data to be decompressed according to the data length of the compressed data stored in the lowest two bits, as the compressed data.
[0230] The data decompression and restoration module 22 includes: a butterfly data splicing module (butterfly_1B), a target base restoration module (base restore) and a data combination module (Combination);
[0231] Among them, the butterfly data splicing module (butterfly_1B) can be used as a hardware implementation structure of the non-target base data block restoration module, which is used to receive the target comparison sequence output by the comparison sequence determination module (bitmask generation) 23, and receive the valid data output by the valid data determination module (data choose) 24, so as to restore the non-target base data block in the valid data to the bit position with a value of 0 in the target comparison sequence.
[0232] The target base restoration module (base restore) can receive valid data, determine the target base in the valid data, and restore the target base to the position of the target alignment sequence with a value of 1. For example, the target base can be determined in the valid data according to the percentage of the target alignment sequence and the compression step size in the received valid data;
[0233] The data combination module can perform a logical OR operation based on the output of the butterfly data splicing module (butterfly_1B) and the output of the target base restoration module (base restore), thereby obtaining the decompressed data.
[0234] The third selection output module 26 is used to receive the decompression signal, the data to be decompressed and the output result of the data combination module. When the decompression signal indicates that the data to be decompressed is to be decompressed, the output result of the data combination module (i.e., the decompressed data) is output; when the decompression signal indicates that the data to be decompressed is not to be decompressed (by pass), the data to be decompressed is directly output.
[0235] The embodiment of the present application also provides a data processing system for completing the data compression process of the data compression device 1 and the data decompression process of the data decompression device.
[0236] Please refer to Fig.15 , Fig.15 It is a structural diagram of a data processing system provided in an embodiment of the present application.
[0237] like Fig.15 As shown, the data processing system may include:
[0238] The data compression device as described in any of the above embodiments is used to compress the data to be compressed to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence;
[0239] The data decompression device as described in any of the above embodiments is used to receive compressed data and decompress the compressed data to obtain decompressed data;
[0240] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0241] It can be seen that the data processing system provided by the embodiment of the present application, by using the target comparison sequence, can, on the one hand, directly restore the compressed data according to the position of the data block with the same value as the target base indicated by the target comparison sequence in the data to be compressed, and the position of the non-target base data block in the data block to be compressed, combined with the target base and the non-target base data block, quickly and conveniently restore the compressed data. On the other hand, since the compressed data includes data blocks (i.e., non-target base data blocks) with different values from the target base, the data processing method provided by the embodiment of the present application, in the process of data compression using the determined target base, can also retain the data blocks in the data to be compressed that are inconsistent with the target base value, so as to achieve compression of the data to be compressed; thereby, it can be avoided that the data compression cannot be performed when facing non-sparse matrices or data blocks with large differences between them; therefore, it can improve the success rate of data compression on the basis of quickly achieving lossless data compression.
[0242] An embodiment of the present invention further provides a data processing method, which is applied to the data compression device described in the above embodiment.
[0243] Please refer to Fig.16 , Fig.16 It is a flow chart of a data processing method provided in an embodiment of the present application.
[0244] like Fig.16 As shown, the method may include the following steps:
[0245] Step S100, obtaining each candidate base of the data to be compressed and the comparison sequence of each candidate base, and determining the target base from each candidate base based on the comparison sequence of each candidate base.
[0246] The comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed.
[0247] Step S101, compressing the data to be compressed according to the target base to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block having a value different from the target base arranged in sequence.
[0248] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0249] It can be seen that the technical solution provided by the embodiment of the present application includes the target comparison sequence of the target base, the target base and the non-target base data blocks arranged in sequence in the compressed data; and the target base is determined based on the comparison sequence of the candidate base, and the comparison sequence of the candidate base is the comparison result of the candidate base and each data block of the data to be compressed. Therefore, the target base determined based on the candidate base, and its corresponding target comparison sequence is also the comparison result obtained after the comparison of the target base and each data block of the data to be compressed. At the same time, the target comparison sequence can indicate the position of the data block with the same value as the target base in the data to be compressed, and the position of the non-target base data block in the data to be compressed, that is to say, the comparison result corresponding to the target comparison sequence can reflect the position of the data block with the same value as the target base, and the position of the data block with a different value from the target base. Therefore, on the one hand, the technical solution provided by the present application can be based on the target comparison sequence when decompressing the compressed data, directly according to the position of the data block with the same value as the target base indicated by the target comparison sequence in the data to be compressed, and the position of the non-target base data block in the data block to be compressed, combined with the target base and the non-target base data block, to quickly and conveniently restore the compressed data. On the other hand, since the compressed data includes data blocks with different values from the target base (i.e., non-target base data blocks), the data compression device provided by the embodiment of the present application, in the process of using the determined target base for data compression, can also retain the data blocks in the data to be compressed that are inconsistent with the target base value, so as to achieve compression of the data to be compressed; thereby, it can avoid the situation where data compression cannot be performed when facing a non-sparse matrix or data to be compressed with large differences between data blocks; therefore, it can improve the success rate of data compression on the basis of quickly achieving lossless data compression.
[0250] An embodiment of the present invention further provides a data processing method, which is applied to the data decompression device described in the above embodiment.
[0251] Please refer to Fig.17 , Fig.17 It is another flowchart of the data processing method provided in an embodiment of the present application.
[0252] like Fig.17 As shown, the method may include the following steps:
[0253] Step S200, obtaining compressed data, wherein the compressed data at least includes a target comparison sequence corresponding to a target base, a target base, and a non-target base data block arranged in sequence, wherein a value of the non-target base data block is different from a value of the target base.
[0254] The compressed data is obtained by compressing the data to be compressed based on the data compression method described in the above embodiment;
[0255] Step S201, based on the target base, the target comparison sequence and the non-target base data block, the compressed data is decompressed to obtain decompressed data.
[0256] The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
[0257] It can be seen that the technical solution provided by the embodiment of the present application includes the target comparison sequence of the target base, the target base and the non-target base data blocks arranged in sequence in the compressed data; and the target base is determined based on the comparison sequence of the candidate base, and the comparison sequence of the candidate base is the comparison result of the candidate base and each data block of the data to be compressed. Therefore, the target base determined based on the candidate base, and its corresponding target comparison sequence is also the comparison result obtained after the comparison of the target base and each data block of the data to be compressed. At the same time, the target comparison sequence can indicate the position of the data block with the same value as the target base in the data to be compressed, and the position of the non-target base data block in the data to be compressed, that is to say, the comparison result corresponding to the target comparison sequence can reflect the position of the data block with the same value as the target base, and the position of the data block with a different value from the target base. Therefore, on the one hand, the technical solution provided by the present application can be based on the target comparison sequence when decompressing the compressed data, directly according to the position of the data block with the same value as the target base indicated by the target comparison sequence in the data to be compressed, and the position of the non-target base data block in the data block to be compressed, combined with the target base and the non-target base data block, to quickly and conveniently restore the compressed data. On the other hand, since the compressed data includes data blocks with different values from the target base (i.e., non-target base data blocks), the data compression device provided by the embodiment of the present application, in the process of using the determined target base for data compression, can also retain the data blocks in the data to be compressed that are inconsistent with the target base value, so as to achieve compression of the data to be compressed; thereby, it can avoid the situation where data compression cannot be performed when facing a non-sparse matrix or data to be compressed with large differences between data blocks; therefore, it can improve the success rate of data compression on the basis of quickly achieving lossless data compression.
[0258] It should be noted that the above-mentioned terminal device may also include other devices (not shown) that may not be necessary for understanding the contents disclosed in the embodiments of the present application; given that these other devices may not be necessary for understanding the contents disclosed in the embodiments of the present application, the embodiments of the present application will not introduce them one by one.
[0259] Although the embodiments of the present application are disclosed above, the present application is not limited thereto. Any person skilled in the art may make various changes and modifications without departing from the spirit and scope of the present application. Therefore, the scope of protection of the present application shall be subject to the scope defined by the claims.
Claims
1. A data compression device, wherein: include: A target base determination module is used to obtain each candidate base of the data to be compressed and a comparison sequence of each candidate base, and determine a target base from each candidate base based on the comparison sequence of each candidate base; the comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed; A data compression module, used for compressing the data to be compressed according to the target base to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence; The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
2. The data compression device according to claim 1, wherein: The compressed data also includes a compression ratio of the compressed data, and the device also includes: A data acquisition module, used for acquiring data to be compressed; A candidate basis matrix forming module is used to compare each candidate basis of the data to be compressed with each data block of the data to be compressed in turn using the candidate basis to obtain a comparison sequence of the candidate basis; based on the comparison sequence of each candidate basis, a candidate basis matrix is formed to provide each candidate basis and the comparison sequence of the candidate basis to the target basis determination module; A compression control module is used to determine the data length of the compressed data according to the target base and the target comparison sequence, and determine the compression rate of the compressed data according to the compressible data length range corresponding to the data length of the compressed data. The compression rate is used to indicate whether the data to be compressed can be compressed successfully. When the data length of the compressed data is within the compressible data length range, it indicates that the data to be compressed can be compressed successfully; when the data length of the compressed data is outside the compressible data length range, it indicates that the data to be compressed cannot be compressed successfully.
3. The data compression device according to claim 2, wherein: The candidate basis matrix forming module comprises: A candidate base determination module is used to divide the data to be compressed based on a compression step size of a preset number of bits to obtain divided data blocks; and to determine at least one data block from each data block as a candidate base; A comparison module is used to compare, for each candidate base, the values corresponding to each bit in the candidate base with the values corresponding to each bit in each data block in turn, to obtain the comparison results corresponding to each data block; A comparison sequence forming module is used to set a first value at a bit position corresponding to a data block when it is determined that the comparison results corresponding to the data blocks are the same for each candidate base; set a second value at a bit position corresponding to the data block when it is determined that the comparison results corresponding to the data blocks are different; and obtain a comparison sequence of the candidate base based on the first value and the second value set in sequence.
4. The data compression device according to claim 3, wherein: The target base determination module comprises: A statistical module, for counting the number of first values in the alignment sequence of each candidate base, to obtain a statistical value; A statistical value selection module is used to sort the statistical values of each candidate base in positive order and select the top two statistical values; The statistical value comparison module is used to compare the two selected statistical values with the profit threshold to determine the statistical value greater than the profit threshold, so as to determine the candidate basis corresponding to the statistical value greater than the profit threshold as the target basis.
5. The data compression device according to claim 4, wherein: The compression control module is further used to generate a compression indication signal according to the determined compression ratio, and the compression indication signal is used to control whether to output the compression result of the data compression module, and when it is determined that the compression ratio indicates that the data to be compressed can be compressed successfully, control the output of the compression result of the data compression module; When it is determined that the compression ratio indicates that the data to be compressed cannot be compressed successfully, controlling not to output the compression result of the data compression module; A first selection output module is used to output a corresponding first output result according to the compression indication signal, wherein when the compression indication signal controls not to output the compression result of the data compression module, the first output result is the data to be compressed; when the compression indication signal controls to output the compression result of the data compression module, the first output result is the compressed data.
6. The data compression device according to claim 5, wherein: Also includes: An information receiving module, used for receiving a compression signal and data to be compressed, wherein the compression signal is used for indicating whether to compress the data to be compressed; A second selection output module is used to output a corresponding second output result according to the compression signal; wherein, when it is determined that the compression signal indicates that the data to be compressed is not compressed, the second output result is the data to be compressed; when it is determined that the compression signal indicates that the data to be compressed is compressed, the second output result is the first output result of the first selection output module.
7. The data compression device according to any one of claims 1 to 6, wherein: The compressed data also includes a compression step length, the number of the target basis determination modules is at least 2, and the compression step lengths corresponding to the target basis obtained by each target basis determination module are different; the number of the data compression modules is at least 2; The compression control module is also used to receive the target bases determined by each of the target base determination modules and the target comparison sequences corresponding to each of the target bases; and compare the compression rates determined by each of the target base determination modules to obtain a compression rate comparison result; and generate a target base selection signal based on the compression rate comparison result; the target base selection signal is used to select and output the compressed data corresponding to the target base with a smaller compression rate.
8. A data decompression device, wherein: include: A compressed data acquisition module, used to acquire compressed data, wherein the compressed data at least includes a target comparison sequence corresponding to a target base, a target base, and a non-target base data block arranged in sequence, wherein the value of the non-target base data block is different from the value of the target base; the compressed data is obtained by compressing the data to be compressed by the data compression device according to any one of claims 1 to 7; A data decompression and restoration module, used to decompress and restore the compressed data based on the target base, the target comparison sequence and the non-target base data block to obtain decompressed data; The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
9. The data decompression device according to claim 8, wherein: The compressed data also includes a compression step and a data length of the compressed data; the device also includes: A data acquisition module, used for acquiring data to be decompressed, wherein the data to be decompressed includes compressed data; A comparison sequence determination module, used to determine a target comparison sequence according to the compression step size and the data length of the data to be decompressed; The valid data determination module is used to determine valid data of corresponding data length in the data to be decompressed according to the data length of the compressed data, so as to provide the valid data to the compressed data acquisition module as compressed data.
10. The data decompression device according to claim 9, wherein: The data decompression and restoration module includes: A target base restoration module, used to restore the target base in the valid data to the bit position set to the first value in the target comparison sequence, to obtain first restored data; A non-target base data block restoration module, used to restore the non-target base data block in the valid data to the bit position set to the second value in the target comparison sequence, to obtain second restored data; The data combining module is used to combine the first restored data and the second restored data to obtain decompressed data.
11. The data decompression device according to claim 10, wherein: Also includes: A decompression information receiving module, used for receiving a decompression signal and data to be decompressed, wherein the decompression signal is used for controlling the decompression of the data to be decompressed; A third selection output module is used to output a third output result according to the decompression signal; wherein, when it is determined that the decompression signal indicates that the data to be decompressed is to be decompressed, the third output result is the decompressed data; when it is determined that the decompression signal indicates that the data to be decompressed is not to be decompressed, the third output result is the data to be decompressed.
12. A data processing system, wherein: include: The data compression device according to any one of claims 1 to 7, used to compress the data to be compressed to obtain compressed data; the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block with a value different from the target base arranged in sequence; The data decompression device according to any one of claims 8 to 11, used for receiving compressed data and decompressing the compressed data to obtain decompressed data; The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
13. A data processing method, applied to the data compression device according to any one of claims 1 to 7, comprising: Acquire each candidate base of the data to be compressed and a comparison sequence of each candidate base, and determine a target base from each candidate base based on the comparison sequence of each candidate base; the comparison sequence is formed based on the comparison of the candidate base and each data block of the data to be compressed; Compressing the data to be compressed according to the target base to obtain compressed data, wherein the compressed data at least includes a target comparison sequence of the target base, the target base, and a non-target base data block having a value different from that of the target base, which are arranged in sequence; The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
14. A data processing method, applied to the data decompression device according to any one of claims 8 to 11, comprising: Obtaining compressed data, wherein the compressed data at least includes a target comparison sequence corresponding to a target base, a target base, and a non-target base data block arranged in sequence, wherein a value of the non-target base data block is different from a value of the target base; the compressed data is obtained by compressing the data to be compressed based on the data compression method according to claim 13; Based on the target base, the target comparison sequence and the non-target base data block, the compressed data is decompressed and restored to obtain decompressed data; The target comparison sequence is used to indicate the position of the data blocks having the same value as the target base in the data to be compressed, and the position of the non-target base data blocks in the data to be compressed.
