A decompression method, device and readable storage medium

CN114416350BActive Publication Date: 2026-09-11SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111629773.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2026-09-11
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

[0005]本申请的目的是提供一种解压方法,以便于解决现有的解压方法导致CPU负载过高的问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114416350B_ABST
    Figure CN114416350B_ABST
Patent Text Reader

Abstract

The application discloses a decompression method and device, and a readable storage medium, and relates to the electronic information field. The decompression method provided by the application determines whether first data block control information needs to be acquired after a compression task flow is received, determines whether the control information and undecoded data information of the current data block need to be sent to a host end after the compression task flow is completed, and generates an interruption to the host end CPU when detecting that the current data block is an incomplete data block in a traditional way. After the CPU detects the interruption information, the information of a Huffman tree of the corresponding data block and undecompressed information are saved. In the method, the CPU only needs to transmit data to a decompression device, and the control software of the CPU does not need to identify and save the control information in the corresponding data block, so that the load of the CPU is reduced. Furthermore, the decompression is performed by the hardware throughout the whole process, and the control software of the CPU does not need to participate, so that the load of the CPU is further reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electronic information, and in particular to a decompression method, apparatus, and readable storage medium. Background Technology

[0002] In recent years, with the rapid development of technologies such as 5G, IoT, cloud computing, big data, and artificial intelligence, high-speed and secure data storage services are facing new challenges. As massive amounts of data grow exponentially, they place unprecedented pressure on existing storage devices. Compression and decompression have become the main technical means to solve storage problems. In existing actual compression stream processing, there are two scenarios: Stateless decompression task streams, which may contain several tasks to be decompressed, but the host ensures the integrity of each data block during the distribution process; and Stateful decompression task streams, where the host can arbitrarily split the data stream according to its actual needs. For example, for a data block containing three blocks to be decompressed, the first two blocks are complete, and the decoding engine can complete the decoding process normally. The last block is randomly cut by the software and does not complete the decompression process. For the host, this task stream distribution method is more in line with actual application needs.

[0003] In traditional implementations, the hardware only needs to generate an interrupt to the host CPU when it detects that the current data block is incomplete. After detecting the interrupt, the CPU saves the Huffman tree information of the corresponding data block and stores the undecoded compressed stream in the data buffer. Because compression and segmentation are performed in software, the currently saved Huffman tree information and the stream to be decoded are not sent to the decoding engine until the next task is assigned. Since the data stream is divided into numerous tasks during the encoding and decoding of large datasets, this results in the CPU constantly intervening in the decompression process, significantly increasing the CPU load.

[0004] Given the above-mentioned technologies, finding a decompression method that can reduce CPU load is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a decompression method to solve the problem of excessive CPU load caused by existing decompression methods.

[0006] To solve the above-mentioned technical problems, this application provides a decompression method, applied to a decompression device connected to a host, including:

[0007] Receive the compressed task stream sent by the host;

[0008] Determine whether the compressed task flow is a State less task flow or a State full task flow;

[0009] If it is a state full task flow, the control information of the first data block is obtained from the host, and the first data block is decompressed. The control information includes the Huffman code table of the first data block and the data information that could not be decoded during the last decoding.

[0010] If it is a stateless task flow, then directly decompress the first data block;

[0011] When the end marker of the first data block is obtained, the next data block is decompressed, and this step is repeated until the compression task flow ends.

[0012] When the compression task flow ends, determine whether the end-of-line character of the current data block has been obtained;

[0013] If the end-of-line character of the current data block is not obtained, the control information of the current data block is sent to the host so that the control information of the current data block can be obtained from the host in the next task.

[0014] Preferably, the decompressed data block includes:

[0015] Decode the CCL information to obtain the SQ code table;

[0016] Run-length encoding is obtained by decoding the SQ bitstream information;

[0017] Based on the numbers of CL1 and CL2, the lit length code sequence and the distance code sequence are obtained through decoding. These two sets of code length sequences can be used to generate the LIT code table and the DIST code table.

[0018] Complete the decoding of the LIT or DIST stream to obtain the LZ77 encoded data;

[0019] Based on the already decoded original text in the sliding window, complete the decoding of LZ77.

[0020] Preferably, the method further includes: when decoding CCL information, saving the decoded CCL information and calculating the number of valid bits.

[0021] Preferably, the method further includes:

[0022] When decoding SQ, the progress of SQ decoding can be determined by the number of CL1 and CL2 output by the SQ decoding engine. After SQ decoding is completed, all valid SQ bits are stored in the storage medium according to the offset value output by the engine, and the total number of SQ bits is calculated.

[0023] Preferably, the method further includes: caching the undecoded bitstream.

[0024] Preferably, the method further includes storing 32KB of decoded data of the current data block to facilitate LZ77 decoding.

[0025] Preferably, the decompression device further includes a DMA and a data buffer pool, wherein the compression task stream is received from the host;

[0026] The host-side configuration DMA sends the compression task stream and control information of the first data block to the data buffer pool via the PCIE protocol;

[0027] Obtain the compression task stream from the data cache pool;

[0028] The control information for obtaining the first data block includes:

[0029] Retrieve the control information of the first data block from the data cache pool.

[0030] To address the aforementioned problems, this application also provides a decompression device, which includes:

[0031] The receiving module is used to receive the compressed task stream sent by the host;

[0032] The first judgment module is used to determine whether the compression task flow is a state less task flow or a state full task flow. If it is a state full task flow, the acquisition module is activated; if it is a state less task flow, the first decompression module is activated.

[0033] The acquisition module is used to acquire control information of the first data block from the host and decompress the first data block. The control information includes the Huffman code table of the first data block and data information that could not be decoded during the last decoding.

[0034] The first decompression module directly decompresses the first data block;

[0035] The second decompression module is used to decompress the next data block when the end symbol of the first data block is obtained, and repeat this step until the compression task flow ends.

[0036] The second judgment module is used to determine whether the end character of the current data block has been obtained when the compression task flow ends. If the end character of the current data block has not been obtained, the sending module is started.

[0037] The sending module is used to send the control information of the current data block to the host so that the control information of the current data block can be obtained from the host in the next task.

[0038] To address the aforementioned problems, this application also provides a decompression device, including a memory for storing computer programs;

[0039] A processor for executing the computer program to implement the steps of the decompression method described above.

[0040] To address the aforementioned problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the decompression method described above.

[0041] The decompression method provided in this application determines whether the control information of the first data block needs to be obtained after receiving the compression task stream by checking whether a frame header exists in the first data block. After the compression task stream is completed, it checks whether the end-of-block character of the current data block has been obtained. If not, the control information and undecoded data information of the current data block are sent to the host for subsequent decompression. This differs from the traditional method where hardware generates an interrupt to the host CPU when an incomplete data block is detected. After detecting the interrupt, the CPU saves the Huffman tree information of the corresponding data block and saves the undecoded compressed stream to the data buffer unit. In this method, the CPU only needs to transmit the data to the decompression device, without requiring CPU control software to identify and save the control information in the corresponding data block. This reduces the CPU load, and since decompression is also handled entirely by hardware without the need for CPU control software, the CPU load is further reduced.

[0042] The decompression device and readable storage medium provided in this application correspond to the decompression method described above and have the same beneficial effects. Attached Figure Description

[0043] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 A flowchart of a decompression method is provided for embodiments of this application;

[0045] Figure 2 A flowchart of a data block decompression scheme provided in this application embodiment;

[0046] Figure 3 This is a schematic diagram of a decompression device provided in an embodiment of this application;

[0047] Figure 4A structural diagram of a preferred specific compression device provided in an embodiment of this application;

[0048] Figure 5 This is a structural diagram of a decompression device provided in another embodiment of this application. Detailed Implementation

[0049] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.

[0050] The core of this application is to provide a decompression method to solve the problem of excessive CPU load caused by existing decompression methods.

[0051] It should be noted that this solution is specifically designed for compression and decompression of data using the deflate format compression algorithm. In the field of data compression, deflate is a very common and widely used algorithm. It is relatively hardware-friendly and offers a high data compression ratio.

[0052] First, the original data stream is LZ77 encoded. LZ77 encoding is a lossless encoding algorithm. It records the matched strings as matching pairs by finding the positions of characters within a sliding window. Each matching pair contains two components: distance (in bytes) and length (in bytes). If the current string does not appear within the sliding window, it is recorded in its original form at the current position. Therefore, after LZ77 encoding, the data exists in three forms: the original text, the length, and the distance.

[0053] Next, Huffman coding is performed. The LZ77 encoded data stream is grouped. The original text and length are grouped together and encoded using codewords from 0 to 285. 0 to 255 are ASCII codes, 256 is the block terminator, and 257 to 285 are used to encode the length. The distance is grouped separately and encoded using codewords from 0 to 29.

[0054] Huffman coding is a coding algorithm based on codeword frequency. After frequency statistics, codewords that appear more frequently have shorter code lengths, and vice versa. In the deflate format, the maximum code length is 15. Two data streams are Huffman encoded separately, and the resulting bitstream is the code length sequence (CL). The code length sequence for the original text and length is labeled CL1, and the code length sequence for distance is labeled CL2.

[0055] Then, since the code length is limited to 0-15, for larger file compression, the same code length will correspond to a large number of codewords. This manifests as a large number of identical code length values ​​being repeated continuously. This significantly impacts the data compression ratio. Therefore, the algorithm requires another run-length encoding at this stage. The principle of run-length encoding is very simple: it records the repeating code length sequence using special codewords. Therefore, two elements are needed: the repeating codeword and the number of times that codeword is repeated. Here, we introduce three codewords 16, 17, and 18 on top of the codewords 0-15. 16 and 17 represent repeating the previous codeword, with the specific value representing the corresponding number of repetitions. 18 represents repeating 0, with the specific data representing the number of times 0 is repeated. After run-length encoding, the codewords in the data stream exist in the form of 0-18.

[0056] Finally, Huffman coding is performed again on run-length codes 0-18. This generates a CCL bitstream. Encoding is then complete.

[0057] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0058] Figure 1 This application provides a flowchart of a decompression method, applicable to a decompression device connected to a host computer, such as... Figure 1 As shown, the method includes;

[0059] S10: Receive the compressed task stream sent by the host;

[0060] It should be noted that the specific content of the compression task stream is not limited in this embodiment. It can be a stateless decompression task stream or a state full decompression task stream. The method of receiving the compression task stream from the host is also not limited. The hardware device implementing this solution is connected to the host through the PCIe interface. The data can be sent through the PCIe interface or through other methods, such as data caching.

[0061] S11: First judgment module, used to determine whether the compression task flow is a State less task flow or a State full task flow. If it is a State full task flow, proceed to S12; if it is a State less task flow, proceed to S13.

[0062] In practical applications, for a state-full task flow, the data blocks can be arbitrarily divided according to its actual needs, while a state-less task flow must be a complete data block. Therefore, to determine whether a compression task flow is a stateless task flow or a state-full task flow, since the task flow itself has a relevant identification mark, the decompression device only needs to detect the task flow, which will not be elaborated here.

[0063] S12: Obtain control information for the first data block from the host and decompress the first data block;

[0064] It should be noted that the control information includes the Huffman code table of the first data block and the data information that could not be decoded during the last decoding. However, in a state-full task flow, there may be a case where the first data block is complete. In this case, the obtained control information is empty, so it is only necessary to decompress the first data block normally. In practical applications, the content in the control information is based on the data sent to the host by the decompression device and stored during the last decoding. It is immediately apparent that for incomplete data blocks, some of the data information cannot be decoded. Therefore, it is necessary to retrieve the Huffman code table from the control information and decompress it according to the Huffman code table. In this embodiment, the decompression method for the first data block and all subsequent data blocks is not limited.

[0065] S13: Directly decompress the first data block;

[0066] It should be noted that the decompression of the first data block here is complete. Therefore, the frame header of the first data block needs to be decoded first to obtain the Huffman code table and proceed with subsequent steps. Thus, the decompression content includes the acquisition of the Huffman code table. That is, in S12, obtaining control information (i.e., the Huffman code table) and undecoded data information from the host are all acquisition steps. In the steps of S12, the content of the Huffman code table in the control information still needs to be called for subsequent decompression. Therefore, the two decompression methods are the same decompression method.

[0067] S14: When the end marker of the first data block is obtained, decompress the next data block and repeat this step until the compression task flow ends;

[0068] It is understandable that when the end marker of the first data block is obtained, it indicates that the data block has been decompressed. After the end marker of the data block is the frame header of the next data block, the next data block is decompressed. It is also understandable that when the second data block is decompressed, that is, after the end marker of the second data block is obtained, the third data block is decompressed, and so on, until the compression task flow ends. In this embodiment, the specific number of data blocks, i.e., their content, is not limited.

[0069] S15: When the compression task flow ends, determine whether the end marker of the current data block has been obtained. If not, proceed to S16.

[0070] It should be noted that for the compression task flow, the end is determined when the decompression device has decompressed all data. The determination method only needs to verify the working status of the decompression device, which will not be elaborated here. It should be noted that when the compression task flow ends, the current data block is the last data block of the compression task flow. Determining whether the end symbol of the current data block is obtained is equivalent to determining whether the last data block is complete. The determination method here is the same as the determination method of the frame header, that is, directly checking whether the end symbol exists.

[0071] S16: Send the control information of the current data block to the host so that it can be retrieved from the host in the next task.

[0072] It should be noted that this embodiment does not limit the method of sending control information for the current data block.

[0073] The decompression method provided in this embodiment determines whether the control information of the first data block needs to be obtained after receiving the compression task stream by checking whether a frame header exists in the first data block. After the compression task stream is completed, it checks whether the end-of-block character of the current data block has been obtained. If not, the control information and undecoded data information of the current data block are sent to the host for subsequent decompression. This differs from the traditional method where hardware generates an interrupt to the host CPU when an incomplete data block is detected. After detecting the interrupt, the CPU saves the Huffman tree information of the corresponding data block and saves the undecoded compressed stream to the data buffer unit. In this method, the CPU only needs to transmit the data to the decompression device, without requiring CPU control software to identify and save the control information in the corresponding data block. This reduces the CPU load, and since decompression is also handled entirely by hardware without the need for CPU control software, the CPU load is further reduced.

[0074] In the above embodiments, the specific method of decompression is not limited; however, a preferred solution is proposed here. Figure 2A flowchart of a data block decompression scheme provided in this application embodiment is shown below. Figure 2 The decompressed data block shown includes:

[0075] Decode the CCL information to obtain the SQ code table;

[0076] Run-length encoding is obtained by decoding the SQ bitstream information;

[0077] Based on the numbers of CL1 and CL2, the lit length code sequence and the distance code sequence are obtained through decoding. These two sets of code length sequences can be used to generate the LIT code table and the DIST code table.

[0078] Complete the decoding of the LIT or DIST stream to obtain the LZ77 encoded data;

[0079] Based on the already decoded original text in the sliding window, complete the decoding of LZ77.

[0080] It should be noted that CCL stands for Common Command Language, SQ code table is the content code table of bit stream information required to decode the original text and the code length sequence (Code Length 1, CL1) formed by Huffman compression of length and distance, and the code length sequence (Code Length 1, CL2) formed by Huffman compression of distance. Original text (Literal, LIT) and length (distance, DIST) are also mentioned. LZ77 is a lossless compression algorithm based on sliding window.

[0081] The article mentioned above states that in practical applications, the data compression algorithm for the Deflate format can be simply divided into the following steps: LZ77 encoding is performed on the original data stream, followed by Huffman coding. The LZ77-encoded data stream is then grouped, and run-length encoding is performed again. Finally, Huffman coding is performed on the run-length codes to generate the CCL bitstream, ending the encoding process. The decoding process for the Deflate format provided in this embodiment is the reverse of the above encoding process.

[0082] In this embodiment, each decoding step corresponds to a decoding engine: the CCL decoding engine, the SQ decoding engine, the run-length decoding engine, and the LZ77 decoding engine. After the last data input in the task flow, each of these engines sends its decoding status and undecoded data information to the data distribution module. It should be noted that this embodiment does not limit the specific form of the decoding engine, and since the decoding engines are all provided by the method in this solution, using these decoding engines can ensure the correctness of the decompression of the compressed task flow and improve decompression efficiency.

[0083] The above embodiments mention specific decompression methods. Considering that the final step requires uploading the control information of the data block, i.e., code table information and undecoded data information, to the host, a preferred solution is proposed: the method further includes:

[0084] When decoding CCL information, the decoded CCL information is saved and the number of valid bits is calculated.

[0085] Based on the above reasons, a preferred solution is proposed here: when decoding SQ, the progress of SQ decoding can be determined by the number of CL1 and CL2 output by the SQ decoding engine. After SQ decoding is completed, all valid SQ bits are stored in the storage medium according to the offset value output by the engine, and the total number of bits of SQ is calculated.

[0086] Based on the above reasons, a preferred solution is proposed here, which further includes: caching the undecoded bitstream.

[0087] Based on the above reasons, a preferred solution is proposed here. The method further includes storing 32KB of decoded data of the current data block to facilitate LZ77 decoding.

[0088] The final step of this method requires uploading the control information of the data block, i.e., the code table information and the undecoded data information, to the host. Therefore, during normal decoding, all code table information and data information of the current data block need to be cached. When switching occurs after the data block decoding is completed, the information of the data block is cleared, and the information of the current data block is updated as the decoding of the current data block progresses. Each preferred scheme in the above scheme corresponds to a different caching unit, namely, the CCL caching unit, the SQ caching unit, the undecoded caching unit, and the decoded data caching unit. The cached data corresponding to each unit is different, so the efficiency is also different. For example, the CCL caching unit caches CCL information, i.e., the parsed SQ code table information. In this embodiment, the specific location of the cache is not limited. The above cached information can be cached in different locations or in the same database.

[0089] In the above embodiments, the caching scheme is limited. Caching different data can clearly record the steps, making it easier for staff to find the source of errors when they occur. It also facilitates the later data coordination. For this method, it increases security and the convenience of later processing. In addition, the cached data is also easier to transmit to the host.

[0090] Since direct reception by the decompression device during data transmission can lead to data loss and the reception of large data packets is inconvenient, a preferred solution is proposed here. The decompression device also includes DMA and a data buffer pool to receive the compression task stream sent by the host.

[0091] Receive the control information of the compressed task stream and the first data block that the host-side configuration DMA sends to the data buffer pool through the PCIe interface;

[0092] Retrieve the compression task stream from the data cache pool;

[0093] The control information for obtaining the first data block includes:

[0094] Retrieve control information for the first data block from the data cache pool.

[0095] Direct Memory Access (DMA) transfers copy data from one address space to another. While the CPU initiates the transfer, the DMA controller performs and completes the transfer itself. A typical example is moving a block of external memory to a faster internal memory region. Such operations do not delay the processor; instead, they can be rescheduled for other tasks. DMA transfers are crucial for high-performance embedded system algorithms and networks. During DMA transfers, the DMA controller directly manages the bus, thus presenting a bus control transfer issue. Before a DMA transfer, the CPU must relinquish bus control to the DMA controller, and after the transfer, the DMA controller should immediately return bus control to the CPU.

[0096] It should be noted that since DMA moves the data to the data cache, subsequent steps do not require CPU involvement. The CPU only needs to communicate the information required by the decompression device with the DMA in a single transaction, reducing the CPU load and increasing efficiency.

[0097] In the above embodiments, the decompression method has been described in detail. This application also provides embodiments corresponding to the decompression device. It should be noted that this application describes the embodiments of the device from two perspectives: one is based on the functional modules, and the other is based on the hardware.

[0098] Figure 3 This is a schematic diagram of a decompression device provided in an embodiment of this application, as shown below. Figure 3 As shown, the device includes:

[0099] Receiver module 10 is used to receive the compressed task stream sent by the host;

[0100] The first judgment module 11 is used to determine whether the compression task flow is a State less task flow or a State full task flow. If it is a State full task flow, the acquisition module is enabled; if it is a State less task flow, the first decompression module is enabled.

[0101] The acquisition module 12 is used to acquire the control information of the first data block from the host and decompress the first data block. The control information includes the Huffman code table of the first data block and the data information that could not be decoded during the last decoding.

[0102] The first decompression module 13 directly decompresses the first data block;

[0103] The second decompression module 14 is used to decompress the next data block when the end symbol of the first data block is obtained, and repeat this step until the compression task flow ends.

[0104] The second judgment module 15 is used to determine whether the end character of the current data block has been obtained when the compression task flow ends. If the end character of the current data block has not been obtained, the sending module is started.

[0105] The sending module 16 is used to send the control information of the current data block to the host so that it can be retrieved from the host in the next task.

[0106] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here. The beneficial effects are also described in the method section, which will not be repeated here either.

[0107] Considering a series of issues such as storage and information transmission, Figure 4 A structural diagram of a preferred specific compression device provided in the embodiments of this application is shown below. Figure 4 As shown, the device includes a decoding engine, a controller, a DMA, and a data buffer pool. During operation, the DMA first transfers data to the data buffer pool via the PCIe interface. Then, the controller retrieves the compression task flow and control information from the data buffer pool and combines this information with the decoding engine to perform subsequent decompression steps. Finally, the data is...

[0108] Figure 5 A structural diagram of a decompression device provided in another embodiment of this application is shown below. Figure 5 As shown, the decompression device includes: a memory 20 for storing computer programs;

[0109] The processor 21 is used to implement the steps of the decompression method mentioned in the above embodiments when executing a computer program.

[0110] The decompression device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.

[0111] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.

[0112] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the decompression method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the aforementioned decompression method.

[0113] In some embodiments, the decompression device may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.

[0114] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here. The beneficial effects are also described in the method section, which will not be repeated here either.

[0115] Those skilled in the art will understand that Figure 5The structure shown does not constitute a limitation on the decompression device and may include more or fewer components than shown.

[0116] The decompression apparatus provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: the decompression method mentioned in the above embodiments.

[0117] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.

[0118] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods recorded in the above embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0119] Since the embodiments of the storage medium section correspond to the embodiments of the method section, please refer to the description of the embodiments of the method section for the embodiments of the storage medium section, which will not be repeated here. The beneficial effects are also described in the method section, which will not be repeated here either.

[0120] The foregoing has provided a detailed description of a decompression method, apparatus, and readable storage medium provided in this application. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.

[0121] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A decompression method, characterized in that, The method, applied to a decompression device connected to a host computer, includes: Receive the compressed task stream sent by the host; Determine whether the compressed task flow is a State less task flow or a State full task flow; If it is a state full task flow, the control information of the first data block is obtained from the host, and the first data block is decompressed. The control information includes the Huffman code table of the first data block and the data information that could not be decoded during the last decoding. If it is a stateless task flow, then directly decompress the first data block; When the end-of-compression character of the first data block is obtained, the next data block is decompressed, and this step is repeated until the compression task flow ends; when the compression task flow ends, it is determined whether the end-of-compression character of the current data block has been obtained. If the end-of-file marker of the current data block is not obtained, the control information of the current data block is sent to the host so that the control information of the current data block can be obtained from the host in the next task. The decompressed data blocks include: Decode the CCL information to obtain the SQ code table; Run-length encoding is obtained by decoding the SQ bitstream information. In the run-length encoding, three codewords 16, 17, and 18 are introduced on the basis of codewords 0 to 15. 16 and 17 represent repeating the previous codeword, and the specific value represents the number of times the codeword is repeated. 18 represents repeating 0, and the specific value represents the number of times 0 is repeated. Based on the number of CL1 and CL2, the lit length code length sequence and the distance code length sequence are obtained by decoding. These two sets of code length sequences are used to generate the LIT code table and the DIST code table. Decode the LIT or DIST stream to obtain the LZ77 encoding. Based on the already decoded original text in the sliding window, complete the decoding of LZ77; The method further includes: when decoding CCL information, saving the already decoded CCL information and calculating the number of valid bits; The decompression device also includes a DMA and a data cache pool, and receives the compression task stream sent by the host; The host-side configuration DMA sends the compression task stream and control information of the first data block to the data buffer pool via the PCIE protocol; Obtain the compression task stream from the data cache pool; The control information for obtaining the first data block includes: Retrieve the control information of the first data block from the data cache pool; The method further includes: When decoding SQ, the progress of SQ decoding can be determined by the number of CL1 and CL2 output by the SQ decoding engine. After SQ decoding is completed, all valid SQ bits are stored in the storage medium according to the offset value output by the engine, and the total number of SQ bits is calculated. The method further includes: caching the undecoded bitstream; The method further includes storing 32KB of decoded data from the current data block to facilitate LZ77 decoding.

2. A decompression device, characterized in that, include: The receiving module is used to receive the compressed task stream sent by the host; The first judgment module is used to determine whether the compression task flow is a state less task flow or a state full task flow. If it is a state full task flow, the acquisition module is activated; if it is a state less task flow, the first decompression module is activated. The acquisition module is used to acquire control information of the first data block from the host and decompress the first data block. The control information includes the Huffman code table of the first data block and data information that could not be decoded during the last decoding. The first decompression module directly decompresses the first data block; The second decompression module is used to decompress the next data block when the end symbol of the first data block is obtained, and repeat this step until the compression task flow ends. The second judgment module is used to determine whether the end character of the current data block has been obtained when the compression task flow ends. If the end character of the current data block has not been obtained, the sending module is started. The sending module is used to send the control information of the current data block to the host so that the control information of the current data block can be obtained from the host in the next task. The decompressed data block includes: decoding CCL information to obtain the SQ code table; decoding the SQ bitstream information to obtain run-length encoding, where the run-length encoding introduces three codewords 16, 17, and 18 on top of codewords 0-15; 16 and 17 represent repeating the previous codeword, with the specific value representing the number of repetitions; 18 represents repeating 0, with the specific value representing the number of times 0 is repeated; and decoding based on the number of CL1 and CL2 to obtain lit. The length code sequence and the distance code sequence are used to generate LIT code tables and DIST code tables; the LIT or DIST stream is decoded to obtain LZ77 encoding; the LZ77 encoding is completed based on the decoded plaintext within the sliding window; when decoding CCL information, the decoded CCL information is saved and the number of valid bits is calculated; the decompression device also includes DMA and a data buffer pool, and receives the compression task stream sent by the host; receives the compression task stream and the control information of the first data block sent by the host-side DMA through the PCIE protocol to the data buffer pool; and retrieves the compression task stream from the data buffer pool. The step of obtaining the control information of the first data block includes: obtaining the control information of the first data block from the data cache pool; Also includes: When decoding SQ, the progress of SQ decoding can be determined by the number of CL1 and CL2 output by the SQ decoding engine. After SQ decoding is completed, all valid SQ bits are stored in the storage medium according to the offset value output by the engine, and the total number of SQ bits is calculated. Buffer the undecoded bitstream; Store 32KB of decoded data from the current data block to facilitate LZ77 decoding.

3. A decompression device, characterized in that, Includes memory used to store computer programs; A processor, configured to implement the steps of the decompression method as described in claim 1 when executing the computer program.

4. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the decompression method as described in claim 1.

Citation Information

Patent Citations

  • Hardware accelerators and methods for offload operations

    CN109690475A

  • Compressed Data Transmissions in Networks Implementing Interior Gateway Protocol

    US20210377367A1