WO2014029081A1 - Compression method and apparatus - Google Patents

Compression method and apparatus Download PDF

Info

Publication number
WO2014029081A1
WO2014029081A1 PCT/CN2012/080429 CN2012080429W WO2014029081A1 WO 2014029081 A1 WO2014029081 A1 WO 2014029081A1 CN 2012080429 W CN2012080429 W CN 2012080429W WO 2014029081 A1 WO2014029081 A1 WO 2014029081A1
Authority
WO
WIPO (PCT)
Prior art keywords
compression
bit stream
text file
processor
length
Prior art date
Application number
PCT/CN2012/080429
Other languages
French (fr)
Chinese (zh)
Inventor
覃祥菊
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2012/080429 priority Critical patent/WO2014029081A1/en
Priority to CN201280002780.2A priority patent/CN103210590B/en
Publication of WO2014029081A1 publication Critical patent/WO2014029081A1/en

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/3084Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction using adaptive string matching, e.g. the Lempel-Ziv method

Definitions

  • the present application relates to compression technology, and in particular, to a compression method and device. Background technique
  • GZIP compression technology mainly includes two-part processing mode, one part of which is LZ77 compression mode and the other part of which is Huffman coding mode.
  • the LZ77 compression method is a phrase compression algorithm. When a string in a text file has a string that is completely repeated before it, the ⁇ repeating length, the distance between the two ⁇ can be utilized. The dual group replaces the former to achieve the purpose of data compression; if a string in a text file does not exist before it is completely repeated, it will not be processed.
  • Huffman coding is a method of encoding data that can be compressed. It can be based on the frequency difference between different characters in a text file, using shorter code words instead of higher frequency characters, and using longer code words.
  • the Huffman coding method may include a static Huffman coding method and a dynamic Huffman coding method.
  • the static Huffman coding method encodes characters according to the fixed code table specified by the protocol, and the compression effect is limited;
  • the dynamic Huffman coding method is to count the frequency of occurrence of characters in the text file to be compressed, according to the statistical result.
  • the encoding code table is generated, and the compression effect is obvious, but it is necessary to consume resources and time to count the appearance frequency of the characters and generate the encoding code table, and the output bit stream also needs to carry additional encoding code table information, and the output data is increased. the amount.
  • GZIP compression technology can be implemented using hardware devices.
  • the processor the Central Processing Unit (CPU)
  • CPU Central Processing Unit
  • the processor can combine the bit streams output by each compression engine to obtain a compressed text file.
  • the processor when it combines the bit streams output by each compression engine, it needs to perform a shift splicing operation to obtain a bit stream whose length is an integer multiple of the minimum data unit that the processor can process.
  • aspects of the present application provide a compression method and apparatus for saving processor processing resources Source.
  • a compression method including:
  • the first bit stream and the second bit stream are output for processing by the processor.
  • the foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner includes a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
  • the non-compression processing method includes an uncompressed coding mode in the GZIP compression technology.
  • the foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner further includes an LZ77 compression mode in the GZIP compression technology.
  • an implementation is further provided, the second part comprising at least one byte of an end of the text file.
  • the data unit includes a byte.
  • a compression device including:
  • a receiving unit configured to acquire a text file to be compressed, and transmit the text file to a processing unit, where the text file includes a first part and a second part;
  • the processing unit is configured to process the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream, and transmit the first bit stream to an output unit; Decoding a length of the first bit stream, processing the second portion by a non-compression processing manner to generate a second bit stream, and transmitting the second bit stream to the output unit, the first bit stream
  • the sum of the length of the second bit stream and the length of the second bit stream is an integer multiple of the smallest unit of data that the processor can process;
  • the output unit is configured to output the first bit stream and the second bit stream for processing by the processor.
  • the foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner includes a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
  • the non-compression processing method includes an uncompressed coding mode in the GZIP compression technology.
  • the foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner further includes an LZ77 compression mode in the GZIP compression technology.
  • an implementation is further provided, the second part comprising at least one byte of an end of the text file.
  • the data unit includes a byte.
  • a compression device including:
  • a receiver configured to acquire a text file to be compressed, and transmit the text file to a processor, the text file including a first part and a second part;
  • the processor is configured to process the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream, and transmit the first bit stream to a transmitter; Decoding a length of the first bitstream, processing the second portion by a non-compression processing manner to generate a second bitstream, and transmitting the second bitstream to the transmitter, the first bitstream
  • the sum of the length of the second bit stream and the length of the second bit stream is an integer multiple of the smallest unit of data that the processor can process;
  • the transmitter is configured to output the first bit stream and the second bit stream for processing by the processor.
  • the compression processing manner includes a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology
  • the non-compression processing method includes an uncompressed coding mode in the GZIP compression technology.
  • the foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner further includes an LZ77 compression mode in the GZIP compression technology.
  • an implementation is further provided, the second part comprising at least one byte of an end of the text file.
  • the most d, the data unit includes bytes.
  • the second part of the text file to be compressed is processed by an uncompressed (Uncompressed or Stored) coding method in the second part of the text file to be compressed, for example, by using an uncompressed (Stored) method in the GZIP compression technology.
  • the second bit stream may be such that the length of the output complete bit stream, that is, the sum of the lengths of the first bit stream and the second bit stream, is a minimum data unit that the processor can process, for example, an integer multiple of a byte (Byte), such that The processor no longer needs to perform a shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
  • FIG. 1 is a schematic flowchart of a compression method according to an embodiment of the present application
  • FIG. 1B is a schematic diagram showing the processing manners of the first part and the second part included in the text file to be compressed in the embodiment corresponding to FIG. 1A;
  • FIG. 1 C is a schematic diagram of a data flow after processing a second portion included in a text file to be compressed in the embodiment corresponding to FIG. 1A;
  • 1D is a schematic diagram of data flow after processing the first part and the second part included in the text file to be compressed in the embodiment corresponding to FIG. 1A;
  • FIG. 2 is a schematic structural diagram of a compression device according to another embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a compression device according to another embodiment of the present disclosure.
  • the technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present application.
  • the embodiments are part of the embodiments of the present application, and not all of the embodiments. Based on the embodiments in the present application, those of ordinary skill in the art obtain the following without creative efforts. All other embodiments obtained are within the scope of the protection of the present application.
  • FIG. 1A is a schematic flowchart of a compression method according to an embodiment of the present application.
  • Process the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream.
  • Which processing method is selected to process the first part and may be selected according to a preset processing strategy. For example, the processing method with the highest compression ratio may be selected.
  • the second part is processed by using a non-compression processing manner to generate a second bit stream, the length of the first bit stream and the length of the second bit stream, according to the length of the first bit stream.
  • the sum is an integer multiple of the smallest unit of data that the processor can handle.
  • the execution body of 101 ⁇ 104 may be each of at least two compression engines in a hardware device.
  • the text file to be compressed acquired by each compression engine may be obtained by dividing the original text file by the processor according to the processing capability of each compression engine. Both the original text file and the text file to be compressed are in the smallest unit of data that the processor can handle, for example, a byte (Byte).
  • the compression processing manner may include a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
  • the non-compression processing method may include the GZIP Uncompressed or Stored encoding in compression technology, as shown in Figure 1B.
  • the static Huffman coding method, the dynamic Huffman coding method, and the uncompressed or uncompressed coding method in the GZIP compression technology refer to the prior art. The relevant content in the content is not described here.
  • the compression processing manner may further include an LZ77 compression manner in the GZIP compression technology.
  • the first part may be processed by using an LZ77 compression method, and then processed by the LZ77 compression method by using a static Huffman coding method or a Dynamic Huffman coding method. The first part of the process is processed.
  • the second part may include at least one byte of an end of the text file.
  • the second bit stream may include a flag bit "xOO" of 3 bits (bit), a length code (LEN) of 0 bits, a length code of 1 byte, and a length code of 1 byte. (NLEN) and the data contained in the second part, as shown in Figure 1C.
  • the sum of the length, the 3 bits, the m bits, the 1 byte, the 1 byte, and the length of the data included in the second portion of the first bit stream is the minimum data that the processor can process.
  • the unit is, for example, an integer multiple of a byte (Byte).
  • the text file to be compressed may be divided into a plurality of data blocks (blocks) as a basic unit of a static Huffman coding method or a dynamic Huffman coding method, each data block.
  • the size is usually 4k ⁇ 32k bytes.
  • the 100 bytes of the text file to be compressed may include the first part, that is, the first 96 bytes and the second part, that is, the following 4 bytes. It is assumed that the data included in the first part is processed by the compression processing method and/or the non-compression processing manner, and the generated first bit stream has a length of 207 bits.
  • the sum of the first bit stream, the 3-bit flag bit "100", the 1-byte LEN, the 1-byte NLEN, and the length of the data contained in the second portion is (207+3+) 8+8+32) bits, ie 258 bits.
  • the last part (ie, the second part) of the text file to be compressed is processed by an uncompressed processing method, for example, an uncompressed (Stored) method in the GZIP compression technology.
  • Generating a second bit stream such that the length of the output complete bit stream, that is, the sum of the lengths of the first bit stream and the second bit stream, is a minimum data unit that the processor can process, for example, an integer multiple of a byte (Byte), This makes it unnecessary for the processor to perform the shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
  • FIG. 2 is a schematic structural diagram of a compression device according to another embodiment of the present disclosure.
  • the compression device of this embodiment may include a receiving unit 21, a processing unit 22, and an output unit 23.
  • the receiving unit 21 is configured to acquire a text file to be compressed, and transmit the text file to the processing unit 22, where the text file includes a first part and a second part.
  • the processing unit 22 is configured to utilize compression processing.
  • the second portion is processed by the non-compression processing to generate a second bit stream, and the second bit stream is transmitted to the output unit 23, the length of the first bit stream and the second bit
  • the sum of the lengths of the streams is an integer multiple of the smallest unit of data that the processor can process; the output unit 23 is configured to output the first bit stream and the second bit stream for processing by the processor.
  • the compression device provided in this embodiment may be at least two of a hardware device. Any compression engine in the compression engine.
  • the text file to be compressed acquired by the receiving unit 21 may be obtained by the processor by dividing the original text file according to the processing capability of each compression engine. Both the original text file and the text file to be compressed are in the smallest unit of data that the processor can handle, for example, Bytes.
  • the compression processing manner may include a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
  • the uncompressed processing manner may include an uncompressed (Stored) or Unstamped encoding method in the GZIP compression technology, as shown in FIG. 1B.
  • the compression processing manner may further include an LZ77 compression manner in the GZIP compression technology.
  • the processing unit 22 may first process the first part by using an LZ77 compression method, and then use a static Huffman coding method or a dynamic Huffman coding method to pass the LZ77. The first portion of the compression mode processing is processed.
  • the second part may include at least one byte of an end of the text file.
  • the second bit stream may include a 3-bit flag bit "xOO", m bits of 0, a 1-byte length code (LEN), and a 1-byte length code inverse code (NLEN).
  • LN 1-byte length code
  • NLEN 1-byte length code inverse code
  • the sum of the length of the first bit stream, 3 bits, m bits, 1 byte, 1 byte, and the length of data included in the second part is the minimum data that the processor can process.
  • the unit is, for example, an integer multiple of a byte (Byte). Wherein, if the second part is the last data block of the text file to be compressed, X takes a value of "1"; if the second part is not the last data of the text file to be compressed Block, then X takes the value "0".
  • the 100 bytes of the text file to be compressed may include The first part is the first 96 bytes and the second part is the last 4 bytes. It is assumed that the data included in the first part is processed by the compression processing method and/or the non-compression processing manner, and the generated first bit stream has a length of 207 bits.
  • the sum of the first bit stream, the 3-bit flag bit "100", the 1-byte LEN, the 1-byte NLEN, and the length of the data contained in the second portion is (207+3+) 8+8+32) bits, ie 258 bits.
  • the compression device provided in this embodiment is used to perform the method in the embodiment shown in FIG. 1A, and details have been described in the embodiment shown in FIG. 1A, and details are not described herein again.
  • the last part (ie, the second part) of the text file to be compressed by the processing unit is used in an uncompressed processing manner, for example, an uncompressed or unscheduled encoding method in the GZIP compression technology.
  • the length of the complete bit stream output by the output unit that is, the sum of the lengths of the first bit stream and the second bit stream, is the smallest data unit that the processor can process, for example, a byte (Byte) Integer multiples, so that the processor does not need to perform a shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
  • FIG. 3 is a schematic structural diagram of a compression device according to another embodiment of the present disclosure.
  • the compression device of this embodiment may include a receiver 31, a processor 32, and a transmitter 33.
  • the receiver 31 is configured to acquire a text file to be compressed, and transmit the text file to the processor 32, where the text file includes a first part and a second part, and the processor 32 is configured to utilize compression processing.
  • the first portion is processed by the non-compression processing to generate a second bit stream, and the second bit stream is transmitted to the transmitter 33, the length of the first bit stream and the second bit
  • the sum of the lengths of the streams is an integer multiple of the smallest unit of data that the processor can process; the transmitter 33 is configured to output the first bit stream and the second bit stream for processing by the processor.
  • the compression device may be any one of at least two compression engines in a hardware device.
  • the text file to be compressed acquired by the receiver 31 may be obtained by dividing the original text file by the processor according to the processing capability of each compression engine. Both the original text file and the text file to be compressed are in the smallest unit of data that the processor can handle, for example, Bytes.
  • the compression processing manner may include a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
  • the uncompressed processing manner may include an uncompressed (Stored) or Unstamped encoding method in the GZIP compression technology, as shown in FIG. 1B.
  • the compression processing manner may further include an LZ77 compression manner in the GZIP compression technology.
  • the processor 32 may first process the first part by using an LZ77 compression method, and then use a static Huffman coding method or a dynamic Huffman coding method to pass the LZ77. The first portion of the compression mode processing is processed.
  • the second part may include at least one byte of an end of the text file.
  • the second bit stream may include a 3-bit flag bit "xOO", m bits of 0, a 1-byte length code (LEN), and a 1-byte length code inverse code (NLEN).
  • LN 1-byte length code
  • NLEN 1-byte length code inverse code
  • the sum of the length of the first bit stream, 3 bits, m bits, 1 byte, 1 byte, and the length of data included in the second part is the minimum data that the processor can process.
  • the unit is, for example, an integer multiple of a byte (Byte). Wherein, if the second part is the last data block of the text file to be compressed, X takes a value of "1"; if the second part is not the last data of the text file to be compressed Block, then X takes the value "0".
  • the 100 bytes of the text file to be compressed may include the first part, that is, the first 96 bytes and the second part, that is, the following 4 bytes.
  • the generated first bit stream has a length of 207 bits.
  • the sum of the first bit stream, the 3-bit flag bit "100", the 1-byte LEN, the 1-byte NLEN, and the length of the data contained in the second portion is (207+3+) 8+8+32) bits, ie 258 bits.
  • the compression device provided in this embodiment is used to perform the method in the embodiment shown in FIG. 1A, and details have been described in the embodiment shown in FIG. 1A, and details are not described herein again.
  • the last part (ie, the second part) of the text file to be compressed by the processor is processed by an uncompressed processing method, for example, an uncompressed or stored code in the GZIP compression technology.
  • processing to generate the second bit stream the length of the complete bit stream output by the transmitter, that is, the sum of the lengths of the first bit stream and the second bit stream, is the smallest unit of data that the processor can process, for example, a byte (Byte) Integer multiples, so that the processor does not need to perform a shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
  • the disclosed systems, devices, and methods may be implemented in other ways.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed.
  • the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. You can choose some of them according to actual needs or All units are used to achieve the objectives of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
  • the above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium.
  • the above software functional unit is stored in a storage medium and includes a plurality of instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute the method of the various embodiments of the present application. Part of the steps.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a Read-Only Memory (ROM), a random access memory (RAM), a disk or an optical disk, and the like, which can store program codes. .

Abstract

Embodiments of the present application provide a compression method and apparatus. A second bit stream is generated by processing, by using an uncompressed processing manner, for example, an uncompressed (uncompressed or stored) encoding mode in the GZIP compression technology, a final part (that is, a second part) of a text file to be compressed, which makes the length of the complete output bit stream, that is, the sum of the length of a first bit stream and the length of the second bit stream, to be a smallest data unit capable of being processed by a processor, such as an integral multiple of a byte (Byte), so that the processor does not need to perform shift and joint operations when combining bit streams output from each compression engine, thereby saving processing resources of the processor.

Description

压缩方法及设备  Compression method and device
技术领域 Technical field
本申请涉及压缩技术, 尤其涉及一种压缩方法及设备。 背景技术  The present application relates to compression technology, and in particular, to a compression method and device. Background technique
GZIP压缩技术主要包括两部分处理方式, 一部分处理方式为 LZ77压缩 方式, 另一部分处理方式为霍夫曼(Huffman )编码方式。 其中, LZ77压缩 方式是一种短语式压缩算法, 当一个文本文件中某个字符串之前存在一段与 其完全重复的字符串时,可以利用{重复长度,二者之间的距离}这种较短的二 元组来代替前者, 以实现数据压缩的目的; 若一个文本文件中某个字符串之 前不存在与其完全重复的字符串时, 则不作处理。 霍夫曼编码方式是一种能 压缩数据的编码方式, 可以基于文本文件中不同的字符出现的频率差异, 利 用较短的码字来代替出现频率较高的字符, 利用较长的码字来代替出现频率 较低的字符, 以实现数据压缩的目的。 霍夫曼编码方式可以包括静态霍夫曼 ( Fixed Huffman )编码方式和动态霍夫曼 ( Dynamic Huffman )编码方式。 其中, 静态霍夫曼编码方式是按协议规定的固定码表对字符进行编码, 其压 缩效果有限; 动态霍夫曼编码方式是通过对待压缩的文本文件中字符的出现 频率进行统计, 根据统计结果生成编码码表, 其压缩效果较为明显, 但需要 消耗资源和时间去统计字符的出现频率和生成编码码表, 另外输出的比特流 中也需要携带额外的编码码表信息, 增加了输出的数据量。  GZIP compression technology mainly includes two-part processing mode, one part of which is LZ77 compression mode and the other part of which is Huffman coding mode. The LZ77 compression method is a phrase compression algorithm. When a string in a text file has a string that is completely repeated before it, the {repeating length, the distance between the two} can be utilized. The dual group replaces the former to achieve the purpose of data compression; if a string in a text file does not exist before it is completely repeated, it will not be processed. Huffman coding is a method of encoding data that can be compressed. It can be based on the frequency difference between different characters in a text file, using shorter code words instead of higher frequency characters, and using longer code words. Instead of appearing lower frequency characters, the purpose of data compression is achieved. The Huffman coding method may include a static Huffman coding method and a dynamic Huffman coding method. Among them, the static Huffman coding method encodes characters according to the fixed code table specified by the protocol, and the compression effect is limited; the dynamic Huffman coding method is to count the frequency of occurrence of characters in the text file to be compressed, according to the statistical result. The encoding code table is generated, and the compression effect is obvious, but it is necessary to consume resources and time to count the appearance frequency of the characters and generate the encoding code table, and the output bit stream also needs to carry additional encoding code table information, and the output data is increased. the amount.
可以釆用硬件设备实现 GZIP 压缩技术。 比如处理器即中央处理单元 ( Central Processing Unit, CPU )可以对每个压缩引擎输出的比特流进行合 并, 以获得压缩之后的文本文件。 现有技术中, 处理器在对每个压缩引擎输 出的比特流进行合并时, 需要进行移位拼接操作, 才能够获得长度为该处理 器所能够处理的最小数据单位的整数倍的比特流。 发明内容  GZIP compression technology can be implemented using hardware devices. For example, the processor, the Central Processing Unit (CPU), can combine the bit streams output by each compression engine to obtain a compressed text file. In the prior art, when the processor combines the bit streams output by each compression engine, it needs to perform a shift splicing operation to obtain a bit stream whose length is an integer multiple of the minimum data unit that the processor can process. Summary of the invention
本申请的多个方面提供一种压缩方法及设备, 用以节省处理器的处理资 源。 Aspects of the present application provide a compression method and apparatus for saving processor processing resources Source.
本申请的一方面, 提供一种压缩方法, 包括:  In an aspect of the application, a compression method is provided, including:
获取待压缩的文本文件, 所述文本文件包括第一部分和第二部分; 利用压缩处理方式和 /或非压缩处理方式, 对所述第一部分进行处理, 以 生成第一比特流;  Obtaining a text file to be compressed, where the text file includes a first part and a second part; processing the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream;
根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分进行 处理, 以生成第二比特流, 所述第一比特流的长度与所述第二比特流的长度 之和为处理器能够处理的最小数据单位的整数倍;  And processing, according to the length of the first bit stream, the second part by using a non-compression processing manner to generate a second bit stream, a length of the first bit stream and a length of the second bit stream An integer multiple of the smallest unit of data that the processor can handle;
输出所述第一比特流和所述第二比特流, 以供所述处理器进行处理。 如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述压缩处理方式包括 GZIP压缩技术中的静态霍夫曼编码方式和动态 霍夫曼编码方式;  The first bit stream and the second bit stream are output for processing by the processor. The foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner includes a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
所述非压缩处理方式包括所述 GZIP压缩技术中的非压缩编码方式。 如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述压缩处理方式还包括所述 GZIP压缩技术中的 LZ77压缩方式。  The non-compression processing method includes an uncompressed coding mode in the GZIP compression technology. The foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner further includes an LZ77 compression mode in the GZIP compression technology.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述第二部分包括所述文本文件的结尾的至少一个字节。  In an aspect as described above and any possible implementation, an implementation is further provided, the second part comprising at least one byte of an end of the text file.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述最 d、数据单位包括字节。  The above aspect and any possible implementation manner further provide an implementation manner, where the most d, the data unit includes a byte.
本申请的另一方面, 提供一种压缩设备, 包括:  In another aspect of the present application, a compression device is provided, including:
接收单元, 用于获取待压缩的文本文件, 以及将所述文本文件传输给处 理单元, 所述文本文件包括第一部分和第二部分;  a receiving unit, configured to acquire a text file to be compressed, and transmit the text file to a processing unit, where the text file includes a first part and a second part;
所述处理单元, 用于利用压缩处理方式和 /或非压缩处理方式, 对所述第 一部分进行处理, 以生成第一比特流, 以及将所述第一比特流传输给输出单 元; 以及根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分 进行处理, 以生成第二比特流, 以及将所述第二比特流传输给所述输出单元, 所述第一比特流的长度与所述第二比特流的长度之和为处理器能够处理的最 小数据单位的整数倍;  The processing unit is configured to process the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream, and transmit the first bit stream to an output unit; Decoding a length of the first bit stream, processing the second portion by a non-compression processing manner to generate a second bit stream, and transmitting the second bit stream to the output unit, the first bit stream The sum of the length of the second bit stream and the length of the second bit stream is an integer multiple of the smallest unit of data that the processor can process;
所述输出单元, 用于输出所述第一比特流和所述第二比特流, 以供所述 处理器进行处理。 如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述压缩处理方式包括 GZIP压缩技术中的静态霍夫曼编码方式和动态 霍夫曼编码方式; The output unit is configured to output the first bit stream and the second bit stream for processing by the processor. The foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner includes a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
所述非压缩处理方式包括所述 GZIP压缩技术中的非压缩编码方式。 如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述压缩处理方式还包括所述 GZIP压缩技术中的 LZ77压缩方式。  The non-compression processing method includes an uncompressed coding mode in the GZIP compression technology. The foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner further includes an LZ77 compression mode in the GZIP compression technology.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述第二部分包括所述文本文件的结尾的至少一个字节。  In an aspect as described above and any possible implementation, an implementation is further provided, the second part comprising at least one byte of an end of the text file.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述最 d、数据单位包括字节。  The above aspect and any possible implementation manner further provide an implementation manner, where the most d, the data unit includes a byte.
本申请的另一方面, 提供一种压缩设备, 包括:  In another aspect of the present application, a compression device is provided, including:
接收器, 用于获取待压缩的文本文件, 以及将所述文本文件传输给处理 器, 所述文本文件包括第一部分和第二部分;  a receiver, configured to acquire a text file to be compressed, and transmit the text file to a processor, the text file including a first part and a second part;
所述处理器, 用于利用压缩处理方式和 /或非压缩处理方式, 对所述第一 部分进行处理, 以生成第一比特流, 以及将所述第一比特流传输给发送器; 以及根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分进行 处理, 以生成第二比特流, 以及将所述第二比特流传输给所述发送器, 所述 第一比特流的长度与所述第二比特流的长度之和为处理器能够处理的最小数 据单位的整数倍;  The processor is configured to process the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream, and transmit the first bit stream to a transmitter; Decoding a length of the first bitstream, processing the second portion by a non-compression processing manner to generate a second bitstream, and transmitting the second bitstream to the transmitter, the first bitstream The sum of the length of the second bit stream and the length of the second bit stream is an integer multiple of the smallest unit of data that the processor can process;
所述发送器, 用于输出所述第一比特流和所述第二比特流, 以供所述处 理器进行处理。  The transmitter is configured to output the first bit stream and the second bit stream for processing by the processor.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述压缩处理方式包括 GZIP压缩技术中的静态霍夫曼编码方式和动态 霍夫曼编码方式;  The foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner includes a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology;
所述非压缩处理方式包括所述 GZIP压缩技术中的非压缩编码方式。 如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述压缩处理方式还包括所述 GZIP压缩技术中的 LZ77压缩方式。  The non-compression processing method includes an uncompressed coding mode in the GZIP compression technology. The foregoing aspect and any possible implementation manner further provide an implementation manner, where the compression processing manner further includes an LZ77 compression mode in the GZIP compression technology.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述第二部分包括所述文本文件的结尾的至少一个字节。  In an aspect as described above and any possible implementation, an implementation is further provided, the second part comprising at least one byte of an end of the text file.
如上所述的方面和任一可能的实现方式, 进一步提供一种实现方式, 所述最 d、数据单位包括字节。 An aspect as described above and any possible implementation manner further provide an implementation manner, The most d, the data unit includes bytes.
由上述技术方案可知, 本申请实施例通过对待压缩的文本文件的第二部 分釆用非压缩处理方式, 例如, 所述 GZIP 压缩技术中的非压缩 ( Uncompressed或 Stored )编码方式, 进行处理以生成第二比特流, 可以 使得输出的完整的比特流的长度即第一比特流与第二比特流的长度之和为处 理器能够处理的最小数据单位例如, 字节 (Byte ) 的整数倍, 使得处理器在 对每个压缩引擎输出的比特流进行合并时不再需要进行移位拼接操作, 从而 节省了处理器的处理资源。 附图说明 为了更清楚地说明本申请实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见地, 下 面描述中的附图是本申请的一些实施例, 对于本领域普通技术人员来讲, 在 不付出创造性劳动性的前提下, 还可以根据这些附图获得其他的附图。  According to the foregoing technical solution, the second part of the text file to be compressed is processed by an uncompressed (Uncompressed or Stored) coding method in the second part of the text file to be compressed, for example, by using an uncompressed (Stored) method in the GZIP compression technology. The second bit stream may be such that the length of the output complete bit stream, that is, the sum of the lengths of the first bit stream and the second bit stream, is a minimum data unit that the processor can process, for example, an integer multiple of a byte (Byte), such that The processor no longer needs to perform a shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor. BRIEF DESCRIPTION OF THE DRAWINGS In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief description of the drawings used in the embodiments or the prior art description will be briefly described below. The drawings are some embodiments of the present application, and those skilled in the art can obtain other drawings based on these drawings without any inventive labor.
图 1 A为本申请一实施例提供的压缩方法的流程示意图;  FIG. 1 is a schematic flowchart of a compression method according to an embodiment of the present application;
图 1 B为图 1A对应的实施例中待压缩的文本文件所包括的第一部分和第 二部分所釆用的处理方式的示意图;  1B is a schematic diagram showing the processing manners of the first part and the second part included in the text file to be compressed in the embodiment corresponding to FIG. 1A;
图 1 C为图 1A对应的实施例中待压缩的文本文件中所包括的第二部分经 过处理之后的数据流示意图;  1 C is a schematic diagram of a data flow after processing a second portion included in a text file to be compressed in the embodiment corresponding to FIG. 1A;
图 1 D为图 1A对应的实施例中待压缩的文本文件中所包括的第一部分和 第二部分经过处理之后的数据流示意图;  1D is a schematic diagram of data flow after processing the first part and the second part included in the text file to be compressed in the embodiment corresponding to FIG. 1A;
图 2为本申请另一实施例提供的压缩设备的结构示意图;  2 is a schematic structural diagram of a compression device according to another embodiment of the present application;
图 3为本申请另一实施例提供的压缩设备的结构示意图。 具体实施方式 为使本申请实施例的目的、 技术方案和优点更加清楚, 下面将结合本申 请实施例中的附图, 对本申请实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本申请一部分实施例, 而不是全部的实施例。 基于 本申请中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本申请保护的范围。 FIG. 3 is a schematic structural diagram of a compression device according to another embodiment of the present disclosure. The technical solutions in the embodiments of the present application are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present application. The embodiments are part of the embodiments of the present application, and not all of the embodiments. Based on the embodiments in the present application, those of ordinary skill in the art obtain the following without creative efforts. All other embodiments obtained are within the scope of the protection of the present application.
另外, 本文中术语"和 /或", 仅仅是一种描述关联对象的关联关系, 表示 可以存在三种关系, 例如, A和 /或 B, 可以表示: 单独存在 A , 同时存在 A 和 B, 单独存在 B这三种情况。 另外, 本文中字符' 7", —般表示前后关联对 象是一种"或"的关系。 在某些情况下, 一些文本文件经过 LZ77压缩方式和霍夫曼编码方式进 行处理之后, 压缩效果不明显, 甚至处理之后的文件可能比原始的文本文件 更大。 因此, GZIP 压缩技术还可以进一步包括另一部分处理方式即非压缩 ( Uncompressed或 Stored )编码方式, 即不进行 LZ77压缩和霍夫曼编码, 直接对原始的文本文件添加标志位之后, 输出。 图 1A为本申请一实施例提供的压缩方法的流程示意图, 如图 1A所示。 In addition, the term "and/or" in this context is merely an association describing the associated object, indicating that there may be three relationships, for example, A and / or B, which may indicate: A exists separately, and A and B exist simultaneously. There are three cases of B alone. In addition, the character '7' in this article generally indicates that the contextual object is an "or" relationship. In some cases, after some text files are processed by LZ77 compression and Huffman coding, the compression effect is not Obviously, even the processed file may be larger than the original text file. Therefore, GZIP compression technology can further include another part of the processing method, that is, uncompressed or stored, that is, LZ77 compression and Huffman coding are not performed. After the flag is directly added to the original text file, the output is shown in FIG. 1A. FIG. 1A is a schematic flowchart of a compression method according to an embodiment of the present application.
101、 获取待压缩的文本文件, 所述文本文件包括第一部分和第二部分。101. Acquire a text file to be compressed, where the text file includes a first part and a second part.
102、 利用压缩处理方式和 /或非压缩处理方式, 对所述第一部分进行处 理, 以生成第一比特流。 102. Process the first part by using a compression processing manner and/or a non-compression processing manner to generate a first bit stream.
选择哪一种处理方式对第一部分进行处理, 具体可以根据预先设置的处 理策略进行选择, 例如, 可以选择压缩率最高的处理方式处理。  Which processing method is selected to process the first part, and may be selected according to a preset processing strategy. For example, the processing method with the highest compression ratio may be selected.
103、根据所述第一比特流的长度,利用非压缩处理方式对所述第二部分 进行处理, 以生成第二比特流, 所述第一比特流的长度与所述第二比特流的 长度之和为处理器能够处理的最小数据单位的整数倍。  103. The second part is processed by using a non-compression processing manner to generate a second bit stream, the length of the first bit stream and the length of the second bit stream, according to the length of the first bit stream. The sum is an integer multiple of the smallest unit of data that the processor can handle.
104、输出所述第一比特流和所述第二比特流,以供所述处理器进行处理。 需要说明的是, 101~104的执行主体可以为一硬件设备中的至少两个压 缩引擎中的每个压缩引擎。  104. Output the first bit stream and the second bit stream for processing by the processor. It should be noted that the execution body of 101~104 may be each of at least two compression engines in a hardware device.
需要说明的是, 每个压缩引擎所获取的待压缩的文本文件, 可以为处理 器根据每个压缩引擎的处理能力, 对原始文本文件进行分割获得的。 原始文 本文件和待压缩的文本文件均是以处理器能够处理的最小数据单位例如, 字 节 (Byte ) 为单位的。  It should be noted that the text file to be compressed acquired by each compression engine may be obtained by dividing the original text file by the processor according to the processing capability of each compression engine. Both the original text file and the text file to be compressed are in the smallest unit of data that the processor can handle, for example, a byte (Byte).
可选的, 本实施例的一个可能的实现方式中, 所述压缩处理方式可以包 括 GZIP压缩技术中的静态霍夫曼(Fixed Huffman )编码方式和动态霍夫曼 ( Dynamic Huffman )编码方式; 所述非压缩处理方式可以包括所述 GZIP 压缩技术中的非压缩( Uncompressed或 Stored )编码方式, 如图 1 B所示。 其中,所述 GZIP压缩技术中的静态霍夫曼(Fixed Huffman )编码方式、 动态霍夫曼 ( Dynamic Huffman ) 编码方式, 以及非压缩 ( Uncompressed 或 Stored )编码方式的详细描述具体可以参见现有技术中的相关内容, 此处 不再赘述。 Optionally, in a possible implementation manner of this embodiment, the compression processing manner may include a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology; The non-compression processing method may include the GZIP Uncompressed or Stored encoding in compression technology, as shown in Figure 1B. For a detailed description of the static Huffman coding method, the dynamic Huffman coding method, and the uncompressed or uncompressed coding method in the GZIP compression technology, refer to the prior art. The relevant content in the content is not described here.
可选的, 本实施例的一个可能的实现方式中, 所述压缩处理方式还可以 进一步包括所述 GZIP压缩技术中的 LZ77压缩方式。 具体地, 可以先利用 LZ77压缩方式,对所述第一部分进行处理, 然后,再利用静态霍夫曼(Fixed Huffman )编码方式或动态霍夫曼(Dynamic Huffman )编码方式, 对经过 LZ77压缩方式处理的所述第一部分进行处理。  Optionally, in a possible implementation manner of the embodiment, the compression processing manner may further include an LZ77 compression manner in the GZIP compression technology. Specifically, the first part may be processed by using an LZ77 compression method, and then processed by the LZ77 compression method by using a static Huffman coding method or a Dynamic Huffman coding method. The first part of the process is processed.
可选的, 本实施例的一个可能的实现方式中, 所述第二部分可以包括所 述文本文件的结尾的至少一个字节。  Optionally, in a possible implementation manner of this embodiment, the second part may include at least one byte of an end of the text file.
具体地, 所述第二比特流可以包括 3个比特(Bit )的标志位 "xOO" 、 m 个比特的 0、 1个字节的长度码(LEN ) 、 1个字节的长度码反码 ( NLEN ) 和所述第二部分所包含的数据, 如图 1 C所示。 其中, 所述第一比特流的长 度、 3个比特、 m个比特、 1个字节、 1个字节和所述第二部分所包含的数据 的长度之和为处理器能够处理的最小数据单位例如, 字节(Byte )的整数倍。 其中, 若所述第二部分为所述待压缩的文本文件的最后一个数据块, 则 X取 值为 "1 " ; 若所述第二部分不为所述待压缩的文本文件的最后一个数据块, 则 X取值为 "0" 。 其中, 所述待压缩的文本文件可以被分成若干个数据块 ( block ) , 作为静态霍夫曼 ( Fixed Huffman ) 编码方式或动态霍夫曼 ( Dynamic Huffman )编码方式的基本单位, 每个数据块大小通常为 4k~32k 字节。  Specifically, the second bit stream may include a flag bit "xOO" of 3 bits (bit), a length code (LEN) of 0 bits, a length code of 1 byte, and a length code of 1 byte. (NLEN) and the data contained in the second part, as shown in Figure 1C. The sum of the length, the 3 bits, the m bits, the 1 byte, the 1 byte, and the length of the data included in the second portion of the first bit stream is the minimum data that the processor can process. The unit is, for example, an integer multiple of a byte (Byte). Wherein, if the second part is the last data block of the text file to be compressed, X is a value of "1"; if the second part is not the last data of the text file to be compressed Block, then X takes the value "0". The text file to be compressed may be divided into a plurality of data blocks (blocks) as a basic unit of a static Huffman coding method or a dynamic Huffman coding method, each data block. The size is usually 4k~32k bytes.
为使得本申请实施例提供的方法更加清楚, 下面将以 100个字节的待压 缩的文本文件作为举例。 其中, 该 100个字节的待压缩的文本文件可以包括 第一部分即前面的 96个字节和第二部分即后面的 4个字节。假设所述第一部 分所包含的数据, 经过压缩处理方式和 /或非压缩处理方式进行处理之后, 生 成的第一比特流的长度为 207个比特。 所述第一比特流、 3个比特的标志位 "100" 、 1个字节的 LEN、 1个字节的 NLEN和所述第二部分所包含的数据 的长度之和为 (207+3+8+8+32 )个比特, 即 258个比特。 此时, 258个比 特以 8个比特为一组划分之后, 余下 2个比特, 因此, 为了使得所述第一比 特流的长度、 3个比特、 m个比特、 1个字节、 1个字节和所述第二部分所包 含的数据的长度之和为字节的整数倍, 可以得到 m的取值为 6个比特, 如图 1 D所示。 In order to make the method provided by the embodiment of the present application clearer, a 100-byte text file to be compressed will be taken as an example. Wherein, the 100 bytes of the text file to be compressed may include the first part, that is, the first 96 bytes and the second part, that is, the following 4 bytes. It is assumed that the data included in the first part is processed by the compression processing method and/or the non-compression processing manner, and the generated first bit stream has a length of 207 bits. The sum of the first bit stream, the 3-bit flag bit "100", the 1-byte LEN, the 1-byte NLEN, and the length of the data contained in the second portion is (207+3+) 8+8+32) bits, ie 258 bits. At this time, 258 ratios After dividing into 8 groups, the remaining 2 bits are left. Therefore, in order to make the length of the first bit stream, 3 bits, m bits, 1 byte, 1 byte, and the number The sum of the lengths of the data contained in the two parts is an integer multiple of the byte, and the value of m can be obtained as 6 bits, as shown in FIG.
本实施例中, 通过对待压缩的文本文件的最后一个部分(即第二部分) 釆用非压缩处理方式,例如,所述 GZIP压缩技术中的非压缩( Uncompressed 或 Stored )编码方式, 进行处理以生成第二比特流, 可以使得输出的完整的 比特流的长度即第一比特流与第二比特流的长度之和为处理器能够处理的最 小数据单位例如, 字节 (Byte ) 的整数倍, 使得处理器在对每个压缩引擎输 出的比特流进行合并时不再需要进行移位拼接操作, 从而节省了处理器的处 理资源。  In this embodiment, the last part (ie, the second part) of the text file to be compressed is processed by an uncompressed processing method, for example, an uncompressed (Stored) method in the GZIP compression technology. Generating a second bit stream, such that the length of the output complete bit stream, that is, the sum of the lengths of the first bit stream and the second bit stream, is a minimum data unit that the processor can process, for example, an integer multiple of a byte (Byte), This makes it unnecessary for the processor to perform the shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
需要说明的是, 对于前述的各方法实施例, 为了简单描述, 故将其都表 述为一系列的动作组合, 但是本领域技术人员应该知悉, 本申请并不受所描 述的动作顺序的限制, 因为依据本申请, 某些步骤可以釆用其他顺序或者同 时进行。 其次, 本领域技术人员也应该知悉, 说明书中所描述的实施例均属 于优选实施例, 所涉及的动作和模块并不一定是本申请所必须的。  It should be noted that, for the foregoing method embodiments, for the sake of brevity, they are all described as a series of action combinations, but those skilled in the art should understand that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or concurrently. In addition, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
在上述实施例中, 对各个实施例的描述都各有侧重, 某个实施例中没有 详述的部分, 可以参见其他实施例的相关描述。  In the above embodiments, the descriptions of the various embodiments are different, and the parts that are not detailed in a certain embodiment can be referred to the related descriptions of other embodiments.
图 2为本申请另一实施例提供的压缩设备的结构示意图, 如图 2所示, 本实施例的压缩设备可以包括接收单元 21、 处理单元 22和输出单元 23。 其 中, 接收单元 21 , 用于获取待压缩的文本文件, 以及将所述文本文件传输给 处理单元 22, 所述文本文件包括第一部分和第二部分; 所述处理单元 22, 用于利用压缩处理方式和 /或非压缩处理方式, 对所述第一部分进行处理, 以 生成第一比特流, 以及将所述第一比特流传输给输出单元 23; 以及根据所述 第一比特流的长度, 利用非压缩处理方式对所述第二部分进行处理, 以生成 第二比特流, 以及将所述第二比特流传输给所述输出单元 23, 所述第一比特 流的长度与所述第二比特流的长度之和为处理器能够处理的最小数据单位的 整数倍; 所述输出单元 23, 用于输出所述第一比特流和所述第二比特流, 以 供所述处理器进行处理。  FIG. 2 is a schematic structural diagram of a compression device according to another embodiment of the present disclosure. As shown in FIG. 2, the compression device of this embodiment may include a receiving unit 21, a processing unit 22, and an output unit 23. The receiving unit 21 is configured to acquire a text file to be compressed, and transmit the text file to the processing unit 22, where the text file includes a first part and a second part. The processing unit 22 is configured to utilize compression processing. And processing the first portion to generate a first bit stream, and transmitting the first bit stream to the output unit 23; and utilizing the length of the first bit stream according to a manner and/or a non-compression processing manner The second portion is processed by the non-compression processing to generate a second bit stream, and the second bit stream is transmitted to the output unit 23, the length of the first bit stream and the second bit The sum of the lengths of the streams is an integer multiple of the smallest unit of data that the processor can process; the output unit 23 is configured to output the first bit stream and the second bit stream for processing by the processor.
需要说明的是, 本实施例提供的压缩设备可以为一硬件设备中的至少两 个压缩引擎中的任一压缩引擎。 It should be noted that the compression device provided in this embodiment may be at least two of a hardware device. Any compression engine in the compression engine.
需要说明的是,接收单元 21所获取的待压缩的文本文件, 可以为处理器 根据每个压缩引擎的处理能力, 对原始文本文件进行分割获得的。 原始文本 文件和待压缩的文本文件均是以处理器能够处理的最小数据单位例如, 字节 ( Byte ) 为单位的。  It should be noted that the text file to be compressed acquired by the receiving unit 21 may be obtained by the processor by dividing the original text file according to the processing capability of each compression engine. Both the original text file and the text file to be compressed are in the smallest unit of data that the processor can handle, for example, Bytes.
可选的, 本实施例的一个可能的实现方式中, 所述压缩处理方式可以包 括 GZIP压缩技术中的静态霍夫曼(Fixed Huffman )编码方式和动态霍夫曼 ( Dynamic Huffman )编码方式; 所述非压缩处理方式可以包括所述 GZIP 压缩技术中的非压缩( Uncompressed或 Stored )编码方式, 如图 1 B所示。  Optionally, in a possible implementation manner of this embodiment, the compression processing manner may include a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology; The uncompressed processing manner may include an uncompressed (Stored) or Unstamped encoding method in the GZIP compression technology, as shown in FIG. 1B.
其中,所述 GZIP压缩技术中的静态霍夫曼(Fixed Huffman )编码方式、 动态霍夫曼 ( Dynamic Huffman ) 编码方式, 以及非压缩 ( Uncompressed 或 Stored )编码方式, 的详细描述具体可以参见现有技术中的相关内容, 此 处不再赘述。  The detailed description of the static Huffman coding method, the dynamic Huffman coding method, and the uncompressed or uncompressed coding mode in the GZIP compression technology can be found in the existing The relevant content in the technology will not be described here.
可选的, 本实施例的一个可能的实现方式中, 所述压缩处理方式还可以 进一步包括所述 GZIP压缩技术中的 LZ77压缩方式。 具体地, 处理单元 22 可以先利用 LZ77压缩方式, 对所述第一部分进行处理, 然后, 再利用静态 霍夫曼( Fixed Huffman )编码方式或动态霍夫曼( Dynamic Huffman )编码 方式, 对经过 LZ77压缩方式处理的所述第一部分进行处理。  Optionally, in a possible implementation manner of the embodiment, the compression processing manner may further include an LZ77 compression manner in the GZIP compression technology. Specifically, the processing unit 22 may first process the first part by using an LZ77 compression method, and then use a static Huffman coding method or a dynamic Huffman coding method to pass the LZ77. The first portion of the compression mode processing is processed.
可选的, 本实施例的一个可能的实现方式中, 所述第二部分可以包括所 述文本文件的结尾的至少一个字节。  Optionally, in a possible implementation manner of this embodiment, the second part may include at least one byte of an end of the text file.
具体地, 所述第二比特流可以包括 3个比特的标志位 "xOO" 、 m个比 特的 0、 1个字节的长度码(LEN ) 、 1个字节的长度码反码 ( NLEN )和所 述第二部分所包含的数据, 如图 1 C所示。 其中, 所述第一比特流的长度、 3 个比特、 m个比特、 1个字节、 1个字节和所述第二部分所包含的数据的长度 之和为处理器能够处理的最小数据单位例如, 字节(Byte )的整数倍。 其中, 若所述第二部分为所述待压缩的文本文件的最后一个数据块, 则 X取值为 "1 " ; 若所述第二部分不为所述待压缩的文本文件的最后一个数据块, 则 X 取值为 "0" 。  Specifically, the second bit stream may include a 3-bit flag bit "xOO", m bits of 0, a 1-byte length code (LEN), and a 1-byte length code inverse code (NLEN). And the data contained in the second part, as shown in FIG. 1C. The sum of the length of the first bit stream, 3 bits, m bits, 1 byte, 1 byte, and the length of data included in the second part is the minimum data that the processor can process. The unit is, for example, an integer multiple of a byte (Byte). Wherein, if the second part is the last data block of the text file to be compressed, X takes a value of "1"; if the second part is not the last data of the text file to be compressed Block, then X takes the value "0".
为使得本申请实施例提供的方法更加清楚, 下面将以 100个字节的待压 缩的文本文件作为举例。 其中, 该 100个字节的待压缩的文本文件可以包括 第一部分即前面的 96个字节和第二部分即后面的 4个字节。假设所述第一部 分所包含的数据, 经过压缩处理方式和 /或非压缩处理方式进行处理之后, 生 成的第一比特流的长度为 207个比特。 所述第一比特流、 3个比特的标志位 "100" 、 1个字节的 LEN、 1个字节的 NLEN和所述第二部分所包含的数据 的长度之和为 (207+3+8+8+32 )个比特, 即 258个比特。 此时, 258个比 特以 8个比特为一组划分之后, 余下 2个比特, 因此, 为了使得所述第一比 特流的长度、 3个比特、 m个比特、 1个字节、 1个字节和所述第二部分所包 含的数据的长度之和为字节的整数倍, 可以得到 m的取值为 6个比特, 如图 1 D所示。 In order to make the method provided by the embodiment of the present application clearer, a 100-byte text file to be compressed will be taken as an example. Wherein, the 100 bytes of the text file to be compressed may include The first part is the first 96 bytes and the second part is the last 4 bytes. It is assumed that the data included in the first part is processed by the compression processing method and/or the non-compression processing manner, and the generated first bit stream has a length of 207 bits. The sum of the first bit stream, the 3-bit flag bit "100", the 1-byte LEN, the 1-byte NLEN, and the length of the data contained in the second portion is (207+3+) 8+8+32) bits, ie 258 bits. At this time, after 258 bits are divided into groups of 8 bits, the remaining 2 bits are left. Therefore, in order to make the length of the first bit stream, 3 bits, m bits, 1 byte, 1 word The sum of the lengths of the data included in the section and the second part is an integer multiple of the byte, and the value of m can be obtained as 6 bits, as shown in FIG.
本实施例提供的压缩设备用于对应执行如图 1A所示实施例的方法, 对 于图 1A所示实施例已经描述的细节, 此处不再赘述。  The compression device provided in this embodiment is used to perform the method in the embodiment shown in FIG. 1A, and details have been described in the embodiment shown in FIG. 1A, and details are not described herein again.
本实施例中, 通过处理单元对待压缩的文本文件的最后一个部分(即第 二部分) 釆用非压缩处理方式, 例如, 所述 GZIP 压缩技术中的非压缩 ( Uncompressed或 Stored )编码方式, 进行处理以生成第二比特流, 可以 使得输出单元输出的完整的比特流的长度即第一比特流与第二比特流的长度 之和为处理器能够处理的最小数据单位例如, 字节 (Byte ) 的整数倍, 使得 处理器在对每个压缩引擎输出的比特流进行合并时不再需要进行移位拼接操 作, 从而节省了处理器的处理资源。  In this embodiment, the last part (ie, the second part) of the text file to be compressed by the processing unit is used in an uncompressed processing manner, for example, an uncompressed or unscheduled encoding method in the GZIP compression technology. Processing to generate the second bit stream, the length of the complete bit stream output by the output unit, that is, the sum of the lengths of the first bit stream and the second bit stream, is the smallest data unit that the processor can process, for example, a byte (Byte) Integer multiples, so that the processor does not need to perform a shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
图 3为本申请另一实施例提供的压缩设备的结构示意图, 如图 3所示, 本实施例的压缩设备可以包括接收器 31、 处理器 32和发送器 33。 其中, 接 收器 31 ,用于获取待压缩的文本文件,以及将所述文本文件传输给处理器 32, 所述文本文件包括第一部分和第二部分; 所述处理器 32, 用于利用压缩处理 方式和 /或非压缩处理方式, 对所述第一部分进行处理, 以生成第一比特流, 以及将所述第一比特流传输给发送器 33; 以及根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分进行处理, 以生成第二比特流, 以及将 所述第二比特流传输给所述发送器 33, 所述第一比特流的长度与所述第二比 特流的长度之和为处理器能够处理的最小数据单位的整数倍; 所述发送器 33, 用于输出所述第一比特流和所述第二比特流, 以供所述处理器进行处理。  FIG. 3 is a schematic structural diagram of a compression device according to another embodiment of the present disclosure. As shown in FIG. 3, the compression device of this embodiment may include a receiver 31, a processor 32, and a transmitter 33. The receiver 31 is configured to acquire a text file to be compressed, and transmit the text file to the processor 32, where the text file includes a first part and a second part, and the processor 32 is configured to utilize compression processing. And processing the first portion to generate a first bit stream, and transmitting the first bit stream to the transmitter 33; and utilizing the length of the first bit stream according to a manner and/or a non-compression processing manner The second portion is processed by the non-compression processing to generate a second bit stream, and the second bit stream is transmitted to the transmitter 33, the length of the first bit stream and the second bit The sum of the lengths of the streams is an integer multiple of the smallest unit of data that the processor can process; the transmitter 33 is configured to output the first bit stream and the second bit stream for processing by the processor.
需要说明的是, 本实施例提供的压缩设备可以为一硬件设备中的至少两 个压缩引擎中的任一压缩引擎。 需要说明的是,接收器 31所获取的待压缩的文本文件,可以为处理器根 据每个压缩引擎的处理能力, 对原始文本文件进行分割获得的。 原始文本文 件和待压缩的文本文件均是以处理器能够处理的最小数据单位例如, 字节 ( Byte ) 为单位的。 It should be noted that the compression device provided in this embodiment may be any one of at least two compression engines in a hardware device. It should be noted that the text file to be compressed acquired by the receiver 31 may be obtained by dividing the original text file by the processor according to the processing capability of each compression engine. Both the original text file and the text file to be compressed are in the smallest unit of data that the processor can handle, for example, Bytes.
可选的, 本实施例的一个可能的实现方式中, 所述压缩处理方式可以包 括 GZIP压缩技术中的静态霍夫曼(Fixed Huffman )编码方式和动态霍夫曼 ( Dynamic Huffman )编码方式; 所述非压缩处理方式可以包括所述 GZIP 压缩技术中的非压缩( Uncompressed或 Stored )编码方式, 如图 1 B所示。  Optionally, in a possible implementation manner of this embodiment, the compression processing manner may include a static Huffman coding method and a dynamic Huffman coding method in a GZIP compression technology; The uncompressed processing manner may include an uncompressed (Stored) or Unstamped encoding method in the GZIP compression technology, as shown in FIG. 1B.
其中,所述 GZIP压缩技术中的静态霍夫曼(Fixed Huffman )编码方式、 动态霍夫曼(Dynamic Huffman ) 编码方式, 以及非压缩 (Uncompressed 或 Stored )编码方式, 的详细描述具体可以参见现有技术中的相关内容, 此 处不再赘述。  The detailed descriptions of the static Huffman coding method, the dynamic Huffman coding method, and the uncompressed or the uncompressed coding method in the GZIP compression technology may be specifically described in the existing The relevant content in the technology will not be described here.
可选的, 本实施例的一个可能的实现方式中, 所述压缩处理方式还可以 进一步包括所述 GZIP压缩技术中的 LZ77压缩方式。 具体地, 处理器 32可 以先利用 LZ77压缩方式, 对所述第一部分进行处理, 然后, 再利用静态霍 夫曼 ( Fixed Huffman )编码方式或动态霍夫曼 ( Dynamic Huffman )编码方 式, 对经过 LZ77压缩方式处理的所述第一部分进行处理。  Optionally, in a possible implementation manner of the embodiment, the compression processing manner may further include an LZ77 compression manner in the GZIP compression technology. Specifically, the processor 32 may first process the first part by using an LZ77 compression method, and then use a static Huffman coding method or a dynamic Huffman coding method to pass the LZ77. The first portion of the compression mode processing is processed.
可选的, 本实施例的一个可能的实现方式中, 所述第二部分可以包括所 述文本文件的结尾的至少一个字节。  Optionally, in a possible implementation manner of this embodiment, the second part may include at least one byte of an end of the text file.
具体地, 所述第二比特流可以包括 3个比特的标志位 "xOO" 、 m个比 特的 0、 1个字节的长度码(LEN ) 、 1个字节的长度码反码 ( NLEN )和所 述第二部分所包含的数据, 如图 1 C所示。 其中, 所述第一比特流的长度、 3 个比特、 m个比特、 1个字节、 1个字节和所述第二部分所包含的数据的长度 之和为处理器能够处理的最小数据单位例如, 字节(Byte )的整数倍。 其中, 若所述第二部分为所述待压缩的文本文件的最后一个数据块, 则 X取值为 "1 " ; 若所述第二部分不为所述待压缩的文本文件的最后一个数据块, 则 X 取值为 "0" 。  Specifically, the second bit stream may include a 3-bit flag bit "xOO", m bits of 0, a 1-byte length code (LEN), and a 1-byte length code inverse code (NLEN). And the data contained in the second part, as shown in FIG. 1C. The sum of the length of the first bit stream, 3 bits, m bits, 1 byte, 1 byte, and the length of data included in the second part is the minimum data that the processor can process. The unit is, for example, an integer multiple of a byte (Byte). Wherein, if the second part is the last data block of the text file to be compressed, X takes a value of "1"; if the second part is not the last data of the text file to be compressed Block, then X takes the value "0".
为使得本申请实施例提供的方法和装置更加清楚, 下面将以 100个字节 的待压缩的文本文件作为举例。 其中, 该 100个字节的待压缩的文本文件可 以包括第一部分即前面的 96个字节和第二部分即后面的 4个字节。假设所述 第一部分所包含的数据, 经过压缩处理方式和 /或非压缩处理方式进行处理之 后, 生成的第一比特流的长度为 207个比特。 所述第一比特流、 3个比特的 标志位 "100" 、 1个字节的 LEN、 1个字节的 NLEN和所述第二部分所包含 的数据的长度之和为(207+3+8+8+32 )个比特, 即 258个比特。 此时, 258 个比特以 8个比特为一组划分之后, 余下 2个比特, 因此, 为了使得所述第 一比特流的长度、 3个比特、 m个比特、 1个字节、 1个字节和所述第二部分 所包含的数据的长度之和为字节的整数倍, 可以得到 m的取值为 6个比特, 如图 1 D所示。 To make the method and apparatus provided by the embodiments of the present application clearer, a 100-byte text file to be compressed will be taken as an example. Wherein, the 100 bytes of the text file to be compressed may include the first part, that is, the first 96 bytes and the second part, that is, the following 4 bytes. Assume that After the data contained in the first part is processed by the compression processing method and/or the non-compression processing method, the generated first bit stream has a length of 207 bits. The sum of the first bit stream, the 3-bit flag bit "100", the 1-byte LEN, the 1-byte NLEN, and the length of the data contained in the second portion is (207+3+) 8+8+32) bits, ie 258 bits. At this time, after 258 bits are divided into groups of 8 bits, the remaining 2 bits are left. Therefore, in order to make the length of the first bit stream, 3 bits, m bits, 1 byte, 1 word The sum of the lengths of the data included in the section and the second part is an integer multiple of the byte, and the value of m can be obtained as 6 bits, as shown in FIG.
本实施例提供的压缩设备用于对应执行如图 1A所示实施例的方法, 对 于图 1A所示实施例已经描述的细节, 此处不再赘述。  The compression device provided in this embodiment is used to perform the method in the embodiment shown in FIG. 1A, and details have been described in the embodiment shown in FIG. 1A, and details are not described herein again.
本实施例中, 通过处理器对待压缩的文本文件的最后一个部分(即第二 部分) 釆用非压缩处理方式, 例如, 所述 GZIP 压缩技术中的非压缩 ( Uncompressed或 Stored )编码方式, 进行处理以生成第二比特流, 可以 使得发送器输出的完整的比特流的长度即第一比特流与第二比特流的长度之 和为处理器能够处理的最小数据单位例如, 字节 (Byte ) 的整数倍, 使得处 理器在对每个压缩引擎输出的比特流进行合并时不再需要进行移位拼接操 作, 从而节省了处理器的处理资源。  In this embodiment, the last part (ie, the second part) of the text file to be compressed by the processor is processed by an uncompressed processing method, for example, an uncompressed or stored code in the GZIP compression technology. Processing to generate the second bit stream, the length of the complete bit stream output by the transmitter, that is, the sum of the lengths of the first bit stream and the second bit stream, is the smallest unit of data that the processor can process, for example, a byte (Byte) Integer multiples, so that the processor does not need to perform a shift splicing operation when merging the bit streams output by each compression engine, thereby saving the processing resources of the processor.
所属领域的技术人员可以清楚地了解到, 为描述的方便和简洁, 上述描 述的系统, 装置和单元的具体工作过程, 可以参考前述方法实施例中的对应 过程, 在此不再赘述。  A person skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中, 应该理解到, 所揭露的系统, 装置和 方法, 可以通过其它的方式实现。 例如, 以上所描述的装置实施例仅仅是示 意性的, 例如, 所述单元的划分, 仅仅为一种逻辑功能划分, 实际实现时可 以有另外的划分方式, 例如多个单元或组件可以结合或者可以集成到另一个 系统, 或一些特征可以忽略, 或不执行。 另一点, 所显示或讨论的相互之间 的耦合或直接耦合或通信连接可以是通过一些接口, 装置或单元的间接耦合 或通信连接, 可以是电性, 机械或其它的形式。  In the several embodiments provided herein, it should be understood that the disclosed systems, devices, and methods may be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be electrical, mechanical or otherwise.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的, 作 为单元显示的部件可以是或者也可以不是物理单元, 即可以位于一个地方, 或者也可以分布到多个网络单元上。 可以根据实际的需要选择其中的部分或 者全部单元来实现本实施例方案的目的。 The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. You can choose some of them according to actual needs or All units are used to achieve the objectives of the solution of this embodiment.
另夕卜,在本申请各个实施例中的各功能单元可以集成在一个处理单元中, 也可以是各个单元单独物理存在, 也可以两个或两个以上单元集成在一个单 元中。 上述集成的单元既可以釆用硬件的形式实现, 也可以釆用硬件加软件 功能单元的形式实现。  In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional units.
上述以软件功能单元的形式实现的集成的单元, 可以存储在一个计算机 可读取存储介质中。 上述软件功能单元存储在一个存储介质中, 包括若干指 令用以使得一台计算机设备(可以是个人计算机, 服务器, 或者网络设备等) 或处理器(processor )执行本申请各个实施例所述方法的部分步骤。 而前述 的存储介质包括: U盘、移动硬盘、只读存储器( Read-Only Memory, ROM ) , 随机存取存储器( Random Access Memory, RAM ) 、 磁碟或者光盘等各种 可以存储程序代码的介质。  The above-described integrated unit implemented in the form of a software functional unit can be stored in a computer readable storage medium. The above software functional unit is stored in a storage medium and includes a plurality of instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor to execute the method of the various embodiments of the present application. Part of the steps. The foregoing storage medium includes: a U disk, a mobile hard disk, a Read-Only Memory (ROM), a random access memory (RAM), a disk or an optical disk, and the like, which can store program codes. .
最后应说明的是: 以上实施例仅用以说明本申请的技术方案, 而非对其 限制; 尽管参照前述实施例对本申请进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技 术方案的本质脱离本申请各实施例技术方案的精神和范围。  Finally, it should be noted that the above embodiments are only used to explain the technical solutions of the present application, and are not limited thereto; although the present application is described in detail with reference to the foregoing embodiments, it will be understood by those skilled in the art that: The technical solutions described in the foregoing embodiments are modified, or some of the technical features are equivalently substituted; and the modifications or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

权利 要求 书 claims
1、 一种压缩方法, 其特征在于, 包括: 1. A compression method, characterized by including:
获取待压缩的文本文件, 所述文本文件包括第一部分和第二部分; 利用压缩处理方式和 /或非压缩处理方式, 对所述第一部分进行处理, 以 生成第一比特流; Obtain a text file to be compressed, where the text file includes a first part and a second part; process the first part using a compression processing method and/or a non-compression processing method to generate a first bit stream;
根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分进行 处理, 以生成第二比特流, 所述第一比特流的长度与所述第二比特流的长度 之和为处理器能够处理的最小数据单位的整数倍; According to the length of the first bit stream, the second part is processed using a non-compression processing method to generate a second bit stream. The sum of the length of the first bit stream and the length of the second bit stream is It is an integer multiple of the smallest data unit that the processor can process;
输出所述第一比特流和所述第二比特流, 以供所述处理器进行处理。 The first bit stream and the second bit stream are output for processing by the processor.
2、 根据权利要求 1 所述的方法, 其特征在于, 所述压缩处理方式包括2. The method according to claim 1, characterized in that the compression processing method includes
GZIP压缩技术中的静态霍夫曼编码方式和动态霍夫曼编码方式;所述非压缩 处理方式包括所述 GZIP压缩技术中的非压缩编码方式。 The static Huffman coding method and the dynamic Huffman coding method in the GZIP compression technology; the non-compression processing method includes the non-compression coding method in the GZIP compression technology.
3、 根据权利要求 2所述的方法, 其特征在于, 所述压缩处理方式还包括 所述 GZIP压缩技术中的 LZ77压缩方式。 3. The method according to claim 2, characterized in that the compression processing method also includes the LZ77 compression method in the GZIP compression technology.
4、 根据权利要求 1~3任一权利要求所述的方法, 其特征在于, 所述第 二部分包括所述文本文件的结尾的至少一个字节。 4. The method according to any one of claims 1 to 3, characterized in that the second part includes at least one byte at the end of the text file.
5、 根据权利要求 1~4任一权利要求所述的方法, 其特征在于, 所述最 小数据单位包括字节。 5. The method according to any one of claims 1 to 4, characterized in that the minimum data unit includes bytes.
6、 一种压缩设备, 其特征在于, 包括: 6. A compression device, characterized in that it includes:
接收单元, 用于获取待压缩的文本文件, 以及将所述文本文件传输给处 理单元, 所述文本文件包括第一部分和第二部分; A receiving unit, configured to obtain a text file to be compressed and transmit the text file to the processing unit, where the text file includes a first part and a second part;
所述处理单元, 用于利用压缩处理方式和 /或非压缩处理方式, 对所述第 一部分进行处理, 以生成第一比特流, 以及将所述第一比特流传输给输出单 元; 以及根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分 进行处理, 以生成第二比特流, 以及将所述第二比特流传输给所述输出单元, 所述第一比特流的长度与所述第二比特流的长度之和为处理器能够处理的最 小数据单位的整数倍; The processing unit is configured to process the first part using a compression processing method and/or a non-compression processing method to generate a first bit stream, and transmit the first bit stream to an output unit; and according to the The length of the first bit stream, processing the second part using a non-compression processing method to generate a second bit stream, and transmitting the second bit stream to the output unit, the first bit stream The sum of the length and the length of the second bit stream is an integer multiple of the smallest data unit that the processor can process;
所述输出单元, 用于输出所述第一比特流和所述第二比特流, 以供所述 处理器进行处理。 The output unit is used to output the first bit stream and the second bit stream for processing by the processor.
7、 根据权利要求 6 所述的设备, 其特征在于, 所述压缩处理方式包括 GZIP压缩技术中的静态霍夫曼编码方式和动态霍夫曼编码方式;所述非压缩 处理方式包括所述 GZIP压缩技术中的非压缩编码方式。 7. The device according to claim 6, characterized in that the compression processing method includes The static Huffman coding method and the dynamic Huffman coding method in the GZIP compression technology; the non-compression processing method includes the non-compression coding method in the GZIP compression technology.
8、 根据权利要求 7所述的设备, 其特征在于, 所述压缩处理方式还包括 所述 GZIP压缩技术中的 LZ77压缩方式。 8. The device according to claim 7, wherein the compression processing method further includes the LZ77 compression method in the GZIP compression technology.
9、 根据权利要求 6~8任一权利要求所述的设备, 其特征在于, 所述第 二部分包括所述文本文件的结尾的至少一个字节。 9. The device according to any one of claims 6 to 8, characterized in that the second part includes at least one byte at the end of the text file.
10、 根据权利要求 6~9任一权利要求所述的设备, 其特征在于, 所述最 小数据单位包括字节。 10. The device according to any one of claims 6 to 9, characterized in that the minimum data unit includes bytes.
11、 一种压缩设备, 其特征在于, 包括: 11. A compression device, characterized in that it includes:
接收器, 用于获取待压缩的文本文件, 以及将所述文本文件传输给处理 器, 所述文本文件包括第一部分和第二部分; A receiver, used to obtain a text file to be compressed and transmit the text file to the processor, where the text file includes a first part and a second part;
所述处理器, 用于利用压缩处理方式和 /或非压缩处理方式, 对所述第一 部分进行处理, 以生成第一比特流, 以及将所述第一比特流传输给发送器; 以及根据所述第一比特流的长度, 利用非压缩处理方式对所述第二部分进行 处理, 以生成第二比特流, 以及将所述第二比特流传输给所述发送器, 所述 第一比特流的长度与所述第二比特流的长度之和为处理器能够处理的最小数 据单位的整数倍; The processor is configured to process the first part using a compression processing method and/or a non-compression processing method to generate a first bit stream, and transmit the first bit stream to the transmitter; and according to the The length of the first bit stream, processing the second part using a non-compression processing method to generate a second bit stream, and transmitting the second bit stream to the sender, the first bit stream The sum of the length and the length of the second bit stream is an integer multiple of the smallest data unit that the processor can process;
所述发送器, 用于输出所述第一比特流和所述第二比特流, 以供所述处 理器进行处理。 The transmitter is configured to output the first bit stream and the second bit stream for processing by the processor.
12、 根据权利要求 11 所述的设备, 其特征在于, 所述压缩处理方式包 括 GZIP压缩技术中的静态霍夫曼编码方式和动态霍夫曼编码方式; 所述非 压缩处理方式包括所述 GZIP压缩技术中的非压缩编码方式。 12. The device according to claim 11, wherein the compression processing method includes the static Huffman coding method and the dynamic Huffman coding method in the GZIP compression technology; the non-compression processing method includes the GZIP Non-compression coding method in compression technology.
13、 根据权利要求 12 所述的设备, 其特征在于, 所述压缩处理方式还 包括所述 GZIP压缩技术中的 LZ77压缩方式。 13. The device according to claim 12, characterized in that the compression processing method also includes the LZ77 compression method in the GZIP compression technology.
14、 根据权利要求 11 ~13任一权利要求所述的设备, 其特征在于, 所述 第二部分包括所述文本文件的结尾的至少一个字节。 14. The device according to any one of claims 11 to 13, wherein the second part includes at least one byte at the end of the text file.
15、 根据权利要求 11 ~14任一权利要求所述的设备, 其特征在于, 所述 最小数据单位包括字节。 15. The device according to any one of claims 11 to 14, characterized in that the minimum data unit includes bytes.
PCT/CN2012/080429 2012-08-21 2012-08-21 Compression method and apparatus WO2014029081A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2012/080429 WO2014029081A1 (en) 2012-08-21 2012-08-21 Compression method and apparatus
CN201280002780.2A CN103210590B (en) 2012-08-21 2012-08-21 Compression method and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/080429 WO2014029081A1 (en) 2012-08-21 2012-08-21 Compression method and apparatus

Publications (1)

Publication Number Publication Date
WO2014029081A1 true WO2014029081A1 (en) 2014-02-27

Family

ID=48756622

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/080429 WO2014029081A1 (en) 2012-08-21 2012-08-21 Compression method and apparatus

Country Status (2)

Country Link
CN (1) CN103210590B (en)
WO (1) WO2014029081A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104199951B (en) * 2014-09-12 2018-09-04 百度在线网络技术(北京)有限公司 Web page processing method and device
CN106789871B (en) * 2016-11-10 2020-05-01 东软集团股份有限公司 Attack detection method and device, network equipment and terminal equipment
CN109302187A (en) * 2018-08-31 2019-02-01 中国海洋大学 A kind of data compression method for subsurface buoy thermohaline depth data
CN112199922B (en) * 2020-08-25 2023-08-22 中国物品编码中心 Encoding method, apparatus, device, and computer-readable storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100079314A1 (en) * 2008-09-30 2010-04-01 Apple Inc. Method and apparatus for compressing and decompressing data
CN102143039A (en) * 2010-06-29 2011-08-03 华为技术有限公司 Data segmentation method and equipment for data compression
CN102291773A (en) * 2011-07-18 2011-12-21 电信科学技术研究院 Data compression method and equipment
US20120106861A1 (en) * 2010-10-29 2012-05-03 Altek Corporation Image compression method
CN102469306A (en) * 2010-10-29 2012-05-23 华晶科技股份有限公司 Image compression method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100079314A1 (en) * 2008-09-30 2010-04-01 Apple Inc. Method and apparatus for compressing and decompressing data
CN102143039A (en) * 2010-06-29 2011-08-03 华为技术有限公司 Data segmentation method and equipment for data compression
US20120106861A1 (en) * 2010-10-29 2012-05-03 Altek Corporation Image compression method
CN102469306A (en) * 2010-10-29 2012-05-23 华晶科技股份有限公司 Image compression method
CN102291773A (en) * 2011-07-18 2011-12-21 电信科学技术研究院 Data compression method and equipment

Also Published As

Publication number Publication date
CN103210590B (en) 2016-09-28
CN103210590A (en) 2013-07-17

Similar Documents

Publication Publication Date Title
US9223765B1 (en) Encoding and decoding data using context model grouping
RU2377670C2 (en) Data compression
US8872677B2 (en) Method and apparatus for compressing data-carrying signals
US9137337B2 (en) Hierarchical bitmasks for indicating the presence or absence of serialized data fields
US11424760B2 (en) System and method for data compaction and security with extended functionality
US11586588B2 (en) System and methods for bandwidth-efficient cryptographic data transfer
CN105052040A (en) System and method for multi-stream compression and decompression
WO2012155683A1 (en) Low-density parity check method and device as the same
WO2014029081A1 (en) Compression method and apparatus
US11762557B2 (en) System and method for data compaction and encryption of anonymized datasets
CN112399479A (en) Method, electronic device and storage medium for data transmission
US20230401173A1 (en) System and methods for secure deduplication of compacted data
US20230283292A1 (en) System and method for data compaction and security with extended functionality
US20220129421A1 (en) System and methods for bandwidth-efficient encoding of genomic data
CN104518850B (en) Reference template is synchronized to the method and information processing system of data flow
US20210013900A1 (en) Real-time history-based byte stream compression
KR100997870B1 (en) Coding scheme for serial data communications
CN112328373A (en) Distributed simulation-oriented data distribution service DDS automatic discovery method
CN103929447B (en) A kind of method of the parsing HTTP chunked coded datas based on PEEK operations
Jain et al. An efficient compression algorithm (ECA) for text data
CN110995274B (en) Decompression method and device
US20190020743A1 (en) Data transmitting apparatus, data receiving apparatus and method thereof
WO2023179800A1 (en) Communication receiving method and apparatus thereof
CN112597082B (en) Bus data transmission method and electronic equipment
WO2021087001A1 (en) System and methods for bandwidth-efficient cryptographic data transfer

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12883328

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12883328

Country of ref document: EP

Kind code of ref document: A1