Data compression method based on huffman encoding

By converting the raw data into binary numbers of a preset bit width and arranging them in a specific order, the problem of Huffman coding not being able to be parallelized is solved, resulting in faster encoding and decoding speeds and improved hardware utilization.

CN115865098BActive Publication Date: 2026-07-21NANJING UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NANJING UNIV
Filing Date
2021-09-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

The code length uncertainty of Huffman coding makes parallel coding impossible, and the starting position of the next symbol cannot be determined during the decoding process, making parallel decoding difficult.

Method used

The original data is converted into a binary number with a preset target bit width, and arranged in the same or opposite bit expansion order to obtain binary data blocks. Huffman encoding is then performed on the data of the same bit position, either separately or simultaneously.

Benefits of technology

It improves the parallelism of Huffman coding, speeds up encoding and decoding, avoids the problem of waiting for the end of low-order data after decoding high-order data, and improves the utilization of hardware decoders.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115865098B_ABST
    Figure CN115865098B_ABST
Patent Text Reader

Abstract

The application provides a Huffman coding-based data compression method, for a plurality of original data to be compressed, each original data is converted into a binary number with a preset target bit width, then all binary numbers are arranged in the same bit expansion order to obtain a binary data block, and finally, Huffman coding is performed on data in the same bit in all binary numbers, since the binary numbers contained in the binary data block and the data length are explicit, Huffman coding can be performed in parallel on data in different bits at the same time, thereby improving the parallel degree of Huffman coding, and accelerating the coding speed and decoding speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data compression technology, and in particular to a data compression method based on Huffman coding. Background Technology

[0002] Currently, the most common encoding method for data compression is Huffman coding. Huffman coding is a variable-length encoding method that constructs the shortest codeword with the lowest average length based entirely on the probability of character occurrence.

[0003] Because the code length of Huffman coding is uncertain, it cannot be encoded in parallel. Moreover, in the decoded bitstream, since the length to be decoded cannot be determined, the starting position of the next symbol cannot be determined before the current character is decoded. Therefore, Huffman coding is also difficult to decode in parallel. Summary of the Invention

[0004] To address the technical problem that Huffman coding is difficult to parallelize because its code length is uncertain and the starting position of the next symbol cannot be determined before the current character is decoded, this application discloses a data compression method based on Huffman coding through the following embodiments.

[0005] The first aspect of this application discloses a data compression method based on Huffman coding, including:

[0006] Obtain multiple raw data sets to be compressed;

[0007] Each of the original data is converted into a binary number with a preset target bit width;

[0008] Obtain a binary data block, which includes binary numbers corresponding to all original data, and all binary numbers are arranged in the same bit expansion order, which is from high bit to low bit or from low bit to high bit.

[0009] Based on the binary data block, Huffman encoding is performed on the data at the same bit position in all binary numbers.

[0010] Optionally, obtaining the binary data block includes:

[0011] Arrange the binary numbers corresponding to each original data in columns to obtain the binary data block. Each column of the binary data block corresponds to a binary number, and the binary numbers in all columns are arranged in the same bit expansion order. The number of rows in the binary data block is the target bit width.

[0012] Optionally, based on the binary data block, Huffman encoding is performed on the data at the same bit position in all binary numbers, including:

[0013] Huffman encoding is performed simultaneously on each line of data in the binary data block.

[0014] Optionally, obtaining the binary data block includes:

[0015] Arrange the binary numbers corresponding to each original data in rows to obtain the binary data block. Each row of the binary data block corresponds to a binary number, and the binary numbers in all rows are arranged in the same bit expansion order. The number of columns in the binary data block is the target bit width.

[0016] Optionally, based on the binary data block, Huffman encoding is performed on the data at the same bit position in all binary numbers, including:

[0017] Huffman encoding is performed simultaneously on each column of data in the binary data block.

[0018] The second aspect of this application discloses a data compression method based on Huffman coding, comprising:

[0019] Obtain multiple raw data sets to be compressed;

[0020] Each of the original data is converted into a binary number with a preset target bit width;

[0021] Multiple binary data blocks are acquired. Each binary data block includes binary numbers corresponding to the target number of original data. The binary numbers in the same binary data block are arranged in the same bit expansion order. The binary data in any two adjacent binary data blocks are arranged in the opposite bit expansion order. The bit expansion order is from high bit to low bit or from low bit to high bit.

[0022] Huffman encoding is performed on all the binary data blocks simultaneously.

[0023] Optionally, acquiring multiple binary data blocks includes:

[0024] Arrange the binary numbers corresponding to each original data point column by column to obtain a binary dataset. Each column of the binary dataset corresponds to a binary number, and the number of rows in the binary dataset is the target bit width.

[0025] The binary dataset is horizontally divided according to the target quantity to obtain multiple data blocks to be rearranged. Each data block to be rearranged includes the target quantity of binary numbers. Each column of each data block to be rearranged corresponds to a binary number. The number of rows in each data block to be rearranged is the target bit width.

[0026] Adjust the bit expansion order of each column of binary numbers in the plurality of data blocks to be rearranged to obtain a plurality of binary data blocks, wherein the binary numbers in each column of the same binary data block are arranged in the same bit expansion order, and the binary data in any two adjacent binary data blocks are arranged in opposite bit expansion orders.

[0027] Optionally, performing Huffman encoding on all the binary data blocks simultaneously includes:

[0028] Arrange all the binary data blocks horizontally in sequence to obtain a binary array;

[0029] Huffman coding is performed simultaneously on each row of data in the binary array.

[0030] Optionally, acquiring multiple binary data blocks includes:

[0031] Arrange the binary numbers corresponding to each original data in rows to obtain a binary dataset, where each row of the binary dataset corresponds to a binary number, and the number of columns in the binary dataset is the target bit width;

[0032] The binary dataset is vertically divided according to the target quantity to obtain multiple data blocks to be rearranged. Each data block to be rearranged includes the target quantity of binary numbers. Each row of each data block to be rearranged corresponds to a binary number. The number of columns in each data block to be rearranged is the target bit width.

[0033] Adjust the bit expansion order of each row of binary numbers in the plurality of data blocks to be rearranged to obtain a plurality of binary data blocks, wherein the binary numbers in each row of the same binary data block are arranged in the same bit expansion order, and the binary data in any two adjacent binary data blocks are arranged in opposite bit expansion orders.

[0034] Optionally, performing Huffman encoding on all the binary data blocks simultaneously includes:

[0035] Arrange all the binary data blocks vertically in sequence to obtain a binary array;

[0036] Huffman coding is performed simultaneously on each column of data in the binary array.

[0037] A third aspect of this application discloses a computer device, comprising:

[0038] Memory is used to store computer programs.

[0039] A processor is configured to implement the steps of the Huffman coding-based data compression method as described in the first aspect of this application when executing the computer program.

[0040] The fourth aspect of this application discloses a computer-readable storage medium storing a computer program that, when processed and executed, implements the steps of the Huffman coding-based data compression method described in the first aspect of this application.

[0041] The fifth aspect of this application discloses a computer device, comprising:

[0042] Memory is used to store computer programs.

[0043] A processor is configured to implement the steps of the Huffman-based data compression method as described in the second aspect of this application when executing the computer program.

[0044] The sixth aspect of this application discloses a computer-readable storage medium storing a computer program that, when processed and executed, implements the steps of the Huffman coding-based data compression method as described in the second aspect of this application.

[0045] The data compression method based on Huffman coding provided in this application involves converting each piece of raw data to a binary number with a preset target bit width. Then, by arranging all binary numbers in the same bit expansion order, binary data blocks are obtained. Finally, Huffman coding is performed on the data at the same bit position in all binary numbers. Since the binary numbers and data length contained in the binary data block are known, Huffman coding can be performed simultaneously on data at different bit positions, thereby improving the parallelism of Huffman coding and accelerating the encoding and decoding speeds. Attached Figure Description

[0046] Figure 1This is a schematic diagram illustrating the workflow of a data compression method based on Huffman coding disclosed in an embodiment of this application;

[0047] Figure 2 This is a schematic diagram of binary data blocks obtained by arranging them in columns in a data compression method based on Huffman coding disclosed in an embodiment of this application.

[0048] Figure 3 This is a schematic diagram of the same bit data in a binary data block arranged in columns, in a data compression method based on Huffman coding disclosed in an embodiment of this application.

[0049] Figure 4 This is a schematic diagram of binary data blocks obtained by arranging them row by row in a data compression method based on Huffman coding disclosed in an embodiment of this application;

[0050] Figure 5 This is a schematic diagram of the same bit data in a binary data block arranged in rows, in a data compression method based on Huffman coding disclosed in an embodiment of this application.

[0051] Figure 6 This is a schematic diagram illustrating the workflow of another data compression method based on Huffman coding disclosed in an embodiment of this application;

[0052] Figure 7 This is a schematic diagram of multiple binary data blocks obtained by arranging them in columns in another data compression method based on Huffman coding disclosed in an embodiment of this application;

[0053] Figure 8 This is a schematic diagram of a binary array composed of multiple binary data blocks arranged horizontally in another data compression method based on Huffman coding disclosed in an embodiment of this application;

[0054] Figure 9 This is a schematic diagram of multiple binary data blocks obtained by arranging them in rows in another data compression method based on Huffman coding disclosed in an embodiment of this application.

[0055] Figure 10 This is a schematic diagram of a binary array composed of multiple binary data blocks arranged vertically in another data compression method based on Huffman coding disclosed in an embodiment of this application. Detailed Implementation

[0056] To address the technical problem that Huffman coding is difficult to parallelize because its code length is uncertain and the starting position of the next symbol cannot be determined before the current character is decoded, this application discloses a data compression method based on Huffman coding through the following embodiments.

[0057] The first embodiment of this application provides a data compression method based on Huffman coding. See [link to relevant documentation]. Figure 1 The method includes:

[0058] Step 101: Obtain multiple sets of raw data to be compressed. Typically, the raw data are decimal numbers, and there is no limit to the number of sets of raw data to be compressed. For example, the obtained sets of raw data to be compressed are: 40, 2, 0, 0, 30, -30, -38, 0, 11.

[0059] Step 102: Convert each of the original data into a binary number with a preset target bit width.

[0060] This embodiment does not limit the value of the target bit width. Technicians can set the target bit width to any bit size according to actual needs, such as 8 bits, 16 bits, 32 bits or 64 bits.

[0061] As an example, the target bit width is set to 8 bits. For multiple raw data to be compressed: 40, 2, 0, 0, 30, -30, -38, 0, 11, they are converted into binary numbers of length 8 bits each. Specifically, the 8-bit binary number corresponding to 40 is "00101000", 2 is "00000010", 0 is "00000000", 30 is "00011110", -30 is "11100010", -38 is "11011010", and 11 is "00001011".

[0062] Step 103: Obtain a binary data block, which includes binary numbers corresponding to all original data, and all binary numbers are arranged in the same bit expansion order, which is from high bit to low bit or from low bit to high bit.

[0063] Step 104: Based on the binary data block, perform Huffman encoding on the data at the same bit position in all binary numbers.

[0064] The binary numbers and data length contained in a binary data block are well-defined. During Huffman coding, data at different bit positions can be encoded in parallel simultaneously, thereby improving the parallelism of Huffman coding and accelerating encoding and decoding speeds. For example, in the binary data block described above, each original data point is expanded into an 8-bit binary number, arranged in the same bit expansion order. During encoding, data at the same bit position can be extracted and encoded as a single Huffman channel. Therefore, for this binary data block, eight channels of data can be extracted and encoded in parallel simultaneously, significantly improving the parallelism of the encoding and accelerating both encoding and decoding speeds.

[0065] The data compression method based on Huffman coding provided in the above embodiments converts each original data into a binary number with a preset target bit width for multiple original data to be compressed. Then, by arranging all binary numbers in the same bit expansion order, binary data blocks are obtained. Finally, Huffman coding is performed on the data in the same bit position of all binary numbers. Since the binary numbers contained in the binary data block and the data length are known, Huffman coding can be performed simultaneously on data in different bit positions, thereby improving the parallelism of Huffman coding and speeding up the encoding and decoding speeds.

[0066] In one implementation, obtaining the binary data block includes:

[0067] Arrange the binary numbers corresponding to each original data in columns to obtain the binary data block. Each column of the binary data block corresponds to a binary number, and the binary numbers in all columns are arranged in the same bit expansion order. The number of rows in the binary data block is the target bit width.

[0068] Based on the above example, if the original data includes: 40, 2, 0, 0, 30, -30, -38, 0, 11, and the target bit width is 8 bits, then the resulting binary data block is shown below. Figure 2 As shown, the binary numbers corresponding to each original data point are arranged sequentially in columns. The binary number corresponding to 40 is in the first column, 2 in the second column, and so on, with 11 in the last column. Furthermore, from... Figure 2 As can be seen, each binary number is arranged from top to bottom in the order of bit expansion from the most significant bit to the least significant bit. In practice, it can also be arranged in the order of bit expansion from the least significant bit to the most significant bit. The number of columns in the binary data block is the number of original data to be compressed, and the number of rows is the target bit width.

[0069] In this implementation, Huffman encoding is performed on the data at the same bit position in all binary numbers according to the binary data block, including: performing Huffman encoding on each row of data in the binary data block simultaneously.

[0070] Combination Figure 2 and Figure 3 In a binary data block, the data in the same row is the data at the same bit position in all binary data. By performing Huffman coding on each row of data simultaneously, parallel encoding of 8 data channels can be achieved, which can effectively improve the encoding speed and subsequent decoding speed.

[0071] In another implementation, obtaining the binary data block includes:

[0072] Arrange the binary numbers corresponding to each original data in rows to obtain the binary data block. Each row of the binary data block corresponds to a binary number, and the binary numbers in all rows are arranged in the same bit expansion order. The number of columns in the binary data block is the target bit width.

[0073] Based on the above example, if the original data includes: 40, 2, 0, 0, 30, -30, -38, 0, 11, and the target bit width is 8 bits, then the resulting binary data block is shown below. Figure 4 As shown, the binary numbers corresponding to each original data point are arranged sequentially in rows. The binary number corresponding to 40 is in the first row, the binary number corresponding to 2 is in the second row, and so on, with the binary number corresponding to 11 in the last row. And from... Figure 4 As can be seen, each binary number is arranged from left to right in the order of bit expansion from the most significant bit to the least significant bit. In practice, they can also be arranged in the order of bit expansion from the least significant bit to the most significant bit. The number of rows in the binary data block is the number of original data to be compressed, and the number of columns is the target bit width.

[0074] In this implementation, Huffman encoding is performed on the data at the same bit position in all binary numbers according to the binary data block, including: performing Huffman encoding on each column of data in the binary data block simultaneously.

[0075] Combination Figure 4 and Figure 5 In a binary data block, the data in the same column is the data at the same bit position in all binary data. By performing Huffman coding on each column of data simultaneously, parallel encoding of 8 channels of data can be achieved, which can effectively improve the encoding speed and subsequent decoding speed.

[0076] In practical applications, for certain types of data, such as the weights in most convolutional neural networks, most weights have relatively small values. Therefore, from a binary perspective, the information entropy of new data composed of higher-order bits is low, while the information entropy of new data composed of lower-order bits is high. This leads to the problem that decoding higher-order data is fast, while decoding lower-order data is slow. During the decoding process, the decoding of higher-order bits may finish first, requiring a period of idle time to wait for the decoding of lower-order bits to finish. Therefore, the utilization rate of the hardware decoder is not high.

[0077] To improve decoding speed and hardware decoder utilization, the second embodiment of this application provides a data compression method based on Huffman coding, see [link to relevant documentation]. Figure 6 The method includes:

[0078] Step 601: Obtain multiple raw data sets to be compressed. Typically, the raw data are decimal numbers, and there is no limit to the number of raw data sets to be compressed. For example, the obtained raw data sets are: 40, 2, 0, 0, 30, -30, -38, 0, 11.

[0079] Step 602: Convert each of the original data into a binary number with a preset target bit width.

[0080] This embodiment does not limit the value of the target bit width. Technicians can set the target bit width to any bit size according to actual needs, such as 8 bits, 16 bits, 32 bits or 64 bits.

[0081] As an example, the target bit width is set to 8 bits. For multiple original data to be compressed: 40, 2, 0, 0, 30, -30, -38, 0, 11, they are converted into binary numbers of length 8 bits each. For the specific conversion results, please refer to the content disclosed in the first embodiment, which will not be repeated here.

[0082] Step 603: Obtain multiple binary data blocks. Each binary data block includes the binary number corresponding to the target number of original data. The binary numbers in the same binary data block are arranged in the same bit expansion order. The binary data in any two adjacent binary data blocks are arranged in the opposite bit expansion order. The bit expansion order is from high bit to low bit or from low bit to high bit.

[0083] This embodiment does not limit the value of the target quantity; technicians can set the target quantity to any value according to actual needs. As an example, this embodiment sets the target quantity to 5, so each binary data block includes 5 binary numbers. It should be noted that for the last binary data block, if it contains fewer binary numbers than the target quantity, it is padded with zeros. Combining the above example, the binary numbers corresponding to 40, 2, 0, 0, and 30 are used as the first binary data block, and the binary numbers corresponding to -30, -38, 0, 11, and 0 are used as the second binary data block. The last zero in the second binary data block is obtained by padding with zeros.

[0084] Within the same binary data block, all binary numbers are arranged in the same bit expansion order. The binary numbers in any two adjacent binary data blocks are arranged in opposite bit expansion orders. If the binary numbers in the first binary data block are arranged in bit expansion order from most significant bit to least significant bit, then the binary numbers in the second binary data block are arranged in bit expansion order from least significant bit to most significant bit, the binary numbers in the third binary data block are arranged in bit expansion order from most significant bit to least significant bit, and so on.

[0085] Step 604: Perform Huffman encoding on all the binary data blocks simultaneously.

[0086] When performing Huffman coding on a single binary data block, the binary numbers and data length within the block are well-defined. Data at different bit positions can be encoded in parallel simultaneously, thus improving the parallelism of Huffman coding and accelerating both encoding and decoding speeds. For example, in the above scenario, each original data point in the resulting single binary data block is expanded into an 8-bit binary number, arranged in the same bit expansion order. During encoding, data at the same bit position can be extracted and encoded as a single Huffman path. Therefore, for this binary data block, eight paths of data can be extracted and encoded in parallel simultaneously, significantly improving the parallelism of the encoding and accelerating both encoding and decoding speeds.

[0087] When performing Huffman encoding on different binary data blocks, since the binary data in two adjacent binary data blocks are arranged in reverse bit expansion order, the high-order and low-order data can be mixed and encoded during the Huffman encoding process. This eliminates the need to encode the high-order and low-order data separately, avoiding the problem of the high-order decoding finishing first and requiring a period of idle time to wait for the low-order decoding to finish, thus improving the utilization of the hardware decoder.

[0088] In one implementation, acquiring multiple binary data blocks includes:

[0089] Arrange the binary numbers corresponding to each original data point column by column to obtain a binary dataset. Each column of the binary dataset corresponds to a binary number, and the number of rows in the binary dataset is the target bit width.

[0090] The binary dataset is horizontally divided according to the target quantity to obtain multiple data blocks to be rearranged. Each data block to be rearranged includes the target quantity of binary numbers. Each column of each data block to be rearranged corresponds to a binary number. The number of rows in each data block to be rearranged is the target bit width.

[0091] Adjust the bit expansion order of each column of binary numbers in the plurality of data blocks to be rearranged to obtain a plurality of binary data blocks, wherein the binary numbers in each column of the same binary data block are arranged in the same bit expansion order, and the binary data in any two adjacent binary data blocks are arranged in opposite bit expansion orders.

[0092] Based on the above example, if the original data includes: 40, 2, 0, 0, 30, -30, -38, 0, 11, the target bit width is 8 bits, and the target quantity is 5, then the binary number corresponding to the original data can be horizontally divided into two binary data blocks, see [reference]. Figure 7 As shown, the binary numbers corresponding to each original data are arranged column by column. Since the second binary data block contains fewer than 5 bytes, zero-padding is performed. Specifically, all binary numbers in the first binary data block are arranged from the most significant bit to the least significant bit, and all binary numbers in the second binary data block are arranged from the least significant bit to the most significant bit. In practical applications, it's possible to arrange all binary numbers in the first binary data block from the least significant bit to the most significant bit, and vice versa. From... Figure 7 As can be seen, the number of rows in each binary data block is the target bit width, and the number of columns is the target quantity.

[0093] In this implementation, performing Huffman encoding on all the binary data blocks simultaneously includes:

[0094] All the binary data blocks are arranged horizontally in sequence to obtain a binary array. Huffman coding is then performed on each row of data in the binary array.

[0095] Combining the above example, the first and second binary data blocks are horizontally concatenated to obtain a binary array, see [link to example]. Figure 8 As shown, each row of data in this binary array includes both high-order and low-order data of the binary number. The information entropy of each row of data is balanced as much as possible. Therefore, when Huffman encoding is performed on all rows of data at the same time, it can effectively avoid the problem that the high-order decoding ends first during the subsequent decoding process, and a period of idle time is needed to wait for the low-order decoding to finish, thus improving the utilization of the hardware decoder.

[0096] In another implementation, acquiring multiple binary data blocks includes:

[0097] Arrange the binary numbers corresponding to each original data in rows to obtain a binary dataset. Each row of the binary dataset corresponds to a binary number, and the number of columns in the binary dataset is the target bit width.

[0098] The binary dataset is vertically divided according to the target quantity to obtain multiple data blocks to be rearranged. Each data block to be rearranged includes the target quantity of binary numbers. Each row of each data block to be rearranged corresponds to a binary number. The number of columns in each data block to be rearranged is the target bit width.

[0099] Adjust the bit expansion order of each row of binary numbers in the plurality of data blocks to be rearranged to obtain a plurality of binary data blocks, wherein the binary numbers in each row of the same binary data block are arranged in the same bit expansion order, and the binary data in any two adjacent binary data blocks are arranged in opposite bit expansion orders.

[0100] Based on the above example, if the original data includes: 40, 2, 0, 0, 30, -30, -38, 0, 11, the target bit width is 8 bits, and the target quantity is 5, then the binary number corresponding to the original data can be vertically divided into two binary data blocks, see [reference]. Figure 9 As shown, the binary numbers corresponding to each original data are arranged sequentially in rows. Since the second binary data block contains fewer than 5 characters, it is padded with zeros. Specifically, all binary numbers in the first binary data block are arranged from left to right in bit order from the most significant bit to the least significant bit, and all binary numbers in the second binary data block are arranged from left to right in bit order from the least significant bit to the most significant bit. In practical applications, it is possible to arrange all binary numbers in the first binary data block from left to right in bit order from the least significant bit to the most significant bit, and all binary numbers in the second binary data block from left to right in bit order from the most significant bit to the least significant bit. From... Figure 9As can be seen, the number of rows in each binary data block is the target quantity, and the number of columns is the target bit width.

[0101] In this implementation, performing Huffman encoding on all the binary data blocks simultaneously includes:

[0102] All the binary data blocks are arranged vertically in sequence to obtain a binary array. Huffman coding is then performed on each column of data in the binary array.

[0103] Combining the above example, the first and second binary data blocks are concatenated vertically to obtain a binary array, see [link to example]. Figure 10 As shown, each column of data in this binary array includes both high-order and low-order data of the binary number. The information entropy of each column of data is balanced as much as possible. Therefore, when Huffman encoding is performed on all columns of data at the same time, it can effectively avoid the problem that the high-order decoding ends first during the subsequent decoding process, and a period of idle time is needed to wait for the low-order decoding to finish, thus improving the utilization rate of the hardware decoder.

[0104] The third embodiment of this application discloses a computer device, including:

[0105] Memory is used to store computer programs.

[0106] A processor is configured to execute the computer program to implement the steps of the data compression method based on Huffman coding as described in the first embodiment of this application.

[0107] The fourth embodiment of this application discloses a computer-readable storage medium storing a computer program, which, when processed and executed, implements the steps of the data compression method based on Huffman coding as described in the first embodiment of this application.

[0108] The fifth embodiment of this application discloses a computer device, including:

[0109] Memory is used to store computer programs.

[0110] A processor is configured to execute the computer program to implement the steps of the data compression method based on Huffman coding as described in the second embodiment of this application.

[0111] The sixth embodiment of this application discloses a computer-readable storage medium storing a computer program, which, when processed and executed, implements the steps of the data compression method based on Huffman coding as described in the second embodiment of this application.

Claims

1. A data compression method based on Huffman coding, characterized in that, include: Obtain multiple raw data sets to be compressed; Each of the original data is converted into a binary number with a preset target bit width; Obtain a binary data block, which includes binary numbers corresponding to all original data, and all binary numbers are arranged in the same bit expansion order, which is from high bit to low bit or from low bit to high bit. Based on the binary data block, Huffman encoding is performed on the data at the same bit position in all binary numbers; The acquisition of binary data blocks includes: Arrange the binary numbers corresponding to each original data in columns to obtain the binary data block. Each column of the binary data block corresponds to a binary number, and all columns of binary numbers are arranged in the same bit expansion order. The number of rows of the binary data block is the target bit width. The acquisition of binary data blocks includes: Arrange the binary numbers corresponding to each original data in rows to obtain the binary data block. Each row of the binary data block corresponds to a binary number, and the binary numbers in all rows are arranged in the same bit expansion order. The number of columns in the binary data block is the target bit width.

2. The data compression method based on Huffman coding according to claim 1, characterized in that, Based on the binary data block, Huffman encoding is performed on the data at the same bit position in all binary numbers, including: Huffman encoding is performed simultaneously on each line of data in the binary data block.

3. The data compression method based on Huffman coding according to claim 1, characterized in that, Based on the binary data block, Huffman encoding is performed on the data at the same bit position in all binary numbers, including: Huffman encoding is performed simultaneously on each column of data in the binary data block.

4. A data compression method based on Huffman coding, characterized in that, include: Obtain multiple raw data sets to be compressed; Each of the original data is converted into a binary number with a preset target bit width; Multiple binary data blocks are acquired. Each binary data block includes binary numbers corresponding to the target number of original data. The binary numbers in the same binary data block are arranged in the same bit expansion order. The binary data in any two adjacent binary data blocks are arranged in the opposite bit expansion order. The bit expansion order is from high bit to low bit or from low bit to high bit. Huffman encoding is performed on all the binary data blocks simultaneously. The acquisition of multiple binary data blocks includes: Arrange the binary numbers corresponding to each original data point column by column to obtain a binary dataset. Each column of the binary dataset corresponds to a binary number, and the number of rows in the binary dataset is the target bit width. The binary dataset is horizontally divided according to the target quantity to obtain multiple data blocks to be rearranged. Each data block to be rearranged includes the target quantity of binary numbers. Each column of each data block to be rearranged corresponds to a binary number. The number of rows in each data block to be rearranged is the target bit width. Adjust the bit expansion order of each column of binary numbers in the plurality of data blocks to be rearranged to obtain a plurality of binary data blocks, wherein the binary numbers in each column of the same binary data block are arranged in the same bit expansion order, and the binary data in any two adjacent binary data blocks are arranged in the opposite bit expansion order. The acquisition of multiple binary data blocks includes: Arrange the binary numbers corresponding to each original data in rows to obtain a binary dataset, where each row of the binary dataset corresponds to a binary number, and the number of columns in the binary dataset is the target bit width; The binary dataset is vertically divided according to the target quantity to obtain multiple data blocks to be rearranged. Each data block to be rearranged includes the target quantity of binary numbers. Each row of each data block to be rearranged corresponds to a binary number. The number of columns in each data block to be rearranged is the target bit width. Adjust the bit expansion order of each row of binary numbers in the plurality of data blocks to be rearranged to obtain a plurality of binary data blocks, wherein the binary numbers in each row of the same binary data block are arranged in the same bit expansion order, and the binary data in any two adjacent binary data blocks are arranged in opposite bit expansion orders.

5. The data compression method based on Huffman coding according to claim 4, characterized in that, The step of simultaneously performing Huffman encoding on all the binary data blocks includes: Arrange all the binary data blocks horizontally in sequence to obtain a binary array; Huffman coding is performed simultaneously on each row of data in the binary array.

6. The data compression method based on Huffman coding according to claim 4, characterized in that, The step of simultaneously performing Huffman encoding on all the binary data blocks includes: Arrange all the binary data blocks vertically in sequence to obtain a binary array; Huffman coding is performed simultaneously on each column of data in the binary array.