US20080122664A1 - Huffman decoding method - Google Patents

Huffman decoding method Download PDF

Info

Publication number
US20080122664A1
US20080122664A1 US11/673,379 US67337907A US2008122664A1 US 20080122664 A1 US20080122664 A1 US 20080122664A1 US 67337907 A US67337907 A US 67337907A US 2008122664 A1 US2008122664 A1 US 2008122664A1
Authority
US
United States
Prior art keywords
huffman
code
codes
bit
size
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
US11/673,379
Other versions
US7375660B1 (en
Inventor
Wen-Tsung Chang
Che-Sheng Chuang
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Primax Electronics Ltd
Original Assignee
Primax Electronics Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Primax Electronics Ltd filed Critical Primax Electronics Ltd
Assigned to PRIMAX ELECTRONICS LTD. reassignment PRIMAX ELECTRONICS LTD. ASSIGNMENT OF ASSIGNORS INTEREST (SEE DOCUMENT FOR DETAILS). Assignors: CHANG, WEN-TSUNG, CHUANG, CHE-SHENG
Application granted granted Critical
Publication of US7375660B1 publication Critical patent/US7375660B1/en
Publication of US20080122664A1 publication Critical patent/US20080122664A1/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/40Conversion to or from variable length codes, e.g. Shannon-Fano code, Huffman code, Morse code

Definitions

  • the present invention relates to a decoding method, and more particularly to a Huffman decoding method.
  • Huffman encoding algorithm is widely used in compression of video and image data, for example in JPEG and MPEG compression.
  • identical symbols e.g. A, B, C, etc.
  • Huffman encoding algorithm encodes symbols by assigning thereto respective codewords having lengths corresponding to probabilities of occurrence of the symbols. In a case that the occurrence of a symbol is more frequent, the length of the encoded symbol is shorter.
  • the symbol D Since the symbol D has the most probable occurrence, the symbol D is assigned with a codeword having the shortest code length or bit-size. In contrast, since the symbol A has the least probable occurrence, the symbol A is assigned with a codeword having the longest code length or bit-size. For example, the symbol A is assigned with a codeword “11111111”, the symbol B is assigned with a codeword “00000”, the symbol C is assigned with a codeword “111” and the symbol D is assigned with a codeword “00”.
  • Huffman compression is a variable-length encoding system of reducing the size of files being compressed.
  • the compressed file should be decompressed and then decoded by using a Huffman table as shown in FIG. 1 .
  • the Huffman table includes several columns such as an address column, a symbol column, a size column and a codeword column.
  • the address column denotes the address of the codeword stored in the memory.
  • the size column denotes the bit-size of the codeword.
  • the codeword column denotes the Huffman code of the encoded symbol.
  • the symbol J shown in FIG. 1 is assigned with a codeword “0110110” having a bit size of 7 (i.e. 7 bits).
  • the input data “0110110” are encoded by the Huffman decoder into a corresponding symbol J and the bit-size is 7.
  • a Huffman decoding method of using a binary tree-based search was disclosed in U.S. Pat. No. 6,621,429.
  • the Huffman table describes a binary tree corresponding to the Huffman code. Starting from the uppermost node, each node has two branches connected thereto so as to construct the binary tree.
  • FIG. 2 is a schematic view showing a binary tree created from the Huffman table of FIG. 1 .
  • the binary tree of FIG. 2 stores each data (symbol) in a corresponding leaf node.
  • a Huffman decoder By a Huffman decoder, a symbol search begins at the root of a binary tree and ends at any of the leaves. One bit for each node is extracted from bit-stream while traversing the binary tree. The code for a symbol is obtained by following the path from the root to the leaf node containing that symbol. The low-level bit 0 of the input data is assigned to a left branch, and the high-level bit 1 is assigned to a right branch. After a symbol corresponding to the bit is searched, a next bit of the input data is extracted and then decoded as described above.
  • an input data stream “011101” to be decoded is illustrated with reference to FIG. 2 .
  • the first bit data “0” is assigned to the left branch to the node 12 .
  • the second bit data “1” is assigned to the right branch to the node 13 .
  • the third bit data “1” is assigned to the right branch to the node 14 .
  • the fourth bit data “1” is assigned to the right branch to the node 19 .
  • the fifth bit data “0” is assigned to the left branch to the node 20 .
  • the sixth bit data “1” is assigned to the right branch to the leaf node storing that symbol F. That is, the input data stream “011101 may be decoded into the symbol F.
  • a new input data stream is continuously read and a symbol search begins at the root node 11 again. The binary tree search procedures are repeated until all input data streams are recoded.
  • a Huffman decoding method for decoding a compression bit stream into corresponding size/symbol codes. Firstly, a Huffman table including multiple Huffman codes and multiple corresponding size/symbol codes is extracted. Each Huffman code includes a codeword having variable code length and each size/symbol code includes a size code and a symbol code. Then, multiple mask codes are generated according to the size codes. Then, masking operations are performed on successive 16 bits of the compression bit stream and the mask codes, thereby outputting multiple masking results.
  • each mask code is composed of 16 binary codes and includes a valid bit portion and an invalid bit portion, wherein the bit-size of the valid bit portion of the mask code is determined according to the size code.
  • an AND gate and an OR gate are used for performing the masking operation and the logic operation, respectively, when the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit.
  • an OR gate and an AND gate are used for performing the masking operation and the logic operation, respectively, when the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit.
  • a Huffman decoding device for decoding a compression bit stream into corresponding size/symbol codes.
  • the Huffman decoding device comprises a Huffman table extracting and processing unit, a Huffman memory, a symbol and size code memory, a mask memory, a compression bit stream processing unit, a Huffman code processing unit and a Huffman decoding unit.
  • the Huffman table extracting and processing unit is used for extracting a Huffman table and generating multiple mask codes.
  • the Huffman table includes multiple Huffman codes and multiple corresponding size/symbol codes.
  • Each Huffman code includes a codeword having variable code length, each size/symbol code includes a size code and a symbol code, and the mask codes are generated according to the size codes.
  • the Huffman memory is electrically connected to the Huffman table extracting and processing unit for storing the Huffman codes therein.
  • the symbol and size code memory is electrically connected to the Huffman table extracting and processing unit for storing the size/symbol codes therein.
  • the mask memory is electrically connected to the Huffman table extracting and processing unit for storing the mask codes therein.
  • the compression bit stream processing unit is electrically connected to the mask memory and performing masking operations on successive 16 bits of the compression bit stream and the mask codes, thereby outputting multiple masking results.
  • the Huffman code processing unit is communicated with the Huffman table extracting and processing unit for performing logic operations on the masking results and the Huffman codes, thereby generating multiple new Huffman codes, wherein each new Huffman code includes the codeword.
  • the Huffman decoding unit is communicated with the Huffman table extracting and processing unit for discriminating whether the 16 bits of the compression bit stream complies with a specific one of new Huffman codes, thereby outputting the size/symbol code corresponding to the specific new Huffman code.
  • FIG. 1 schematically illustrates a conventional Huffman table
  • FIG. 2 is a schematic view showing a binary tree created from the Huffman table of FIG. 1 ;
  • FIG. 3( a ) schematically illustrates a data code definition for the Huffman table used in the present invention
  • FIG. 3( b ) schematically illustrates a Huffman table used in the present invention
  • FIG. 3( c ) is a schematic circuit block diagram of a Huffman decoding device according to a first preferred embodiment of the present invention.
  • FIG. 3( d ) is a schematic circuit block diagram of a Huffman decoding device according to a second preferred embodiment of the present invention.
  • the present invention relates to a Huffman decoding method.
  • a Huffman table is provided in a Huffman decoder to describe the Huffman codes.
  • a standard JPEG Huffman table has been previously provided in the decoder.
  • the standard JPEG Huffman table includes codewords for most JPEG files in order to be used for decoding most compressed JPEG data.
  • the application of the standard JPEG Huffman table is restricted because some JPEG files have specific decompression requirements.
  • the manufacture may design specified Huffman tables as required. These specified Huffman table are stored in the header of the JPEG file. When the decoding operation is initiated, the specified Huffman tables will be downloaded from the JPEG file to the decoder through the bus.
  • the data code 310 is a 32-bit code.
  • the first two bits of the data code 310 denote chroma value, luma value, AC coefficient and DC coefficient.
  • the next twenty bits indicate the Huffman code 320 .
  • Each Huffman code 320 includes a codeword having variable code length.
  • the next five bits denotes a symbol code 3301 .
  • the five bits subsequent to the symbol code 3301 is a size code 3302 .
  • the symbol code 3301 and the size code 3302 are cooperatively referred as a size/symbol code 330 .
  • the Huffman code 320 is illustrated by referring to a 16-bit code because the 16-bit Huffman code is commonly used. Nevertheless, the Huffman code 320 of the present invention can be expanded to 20 bits in order to decode higher-bit Huffman code and increase the application spectrum.
  • the Huffman table includes several columns such as an address column, a symbol column, a size column and a Huffman code column.
  • the meanings of the address column, the symbol column and the size column are identical to those described in FIG. 1 , and are not described redundantly herein.
  • the codeword column in the conventional Huffman table denotes the Huffman code of the encoded symbol.
  • the preceding one or more bits of the Huffman code shown in the Huffman code column of FIG. 3( b ) denotes the codeword.
  • the codeword having variable code length is included in the 16-bit Huffman code.
  • the Huffman decoder may perform the decoding operations regardless of whether the exact code length of the codeword is realized.
  • the size code denotes bit-size of the codeword and is measure of deciding the mask code.
  • the mask code includes a valid bit portion and an invalid bit portion.
  • the bit-size of the valid bit portion of the mask code is determined according to the size code.
  • the Huffman code includes the codeword and the valid bit portion of the mask code. The low-level bit “0” is assigned to the valid bit portion and the high-level bit “1” is assigned to the invalid bit portion.
  • the symbol A at the address “0” has a size code “1” and is assigned with a codeword “1”
  • the Huffman code is “1000,0000,0000,0000”, which includes the size code “1” and the remainder 15 valid bits “0”.
  • the Huffman code of the symbol A is “111,1111,1111,1111” which includes the size code “1” and the remainder 15 valid bits “1”.
  • FIG. 3( c ) a schematic circuit block diagram of a Huffman decoding device according to a first preferred embodiment of the present invention is illustrated.
  • the Huffman decoding device 300 is electrically connected to a bus 301 .
  • the data code 310 stored in the header of a compressed file e.g. a JPEG file
  • the data code 310 may be transmitted to the Huffman decoding device 300 , so that the data code 310 is obtained by the Huffman decoding device 300 .
  • a compressed file e.g. a JPEG file
  • the Huffman decoding device 300 includes a bus interface 302 , a Huffman table extracting and processing unit 303 , a Huffman memory 304 , a symbol and size code memory 305 , a mask memory 306 , a compression bit stream processing unit 307 , a Huffman code processing unit 308 and a Huffman decoding unit 309 .
  • the Huffman decoding device 300 is communicated with the bus 301 through the bus interface 302 so as to receive the data code 310 .
  • the data code 310 is processed by the Huffman table extracting and processing unit 303 and classified into a Huffman code 320 , a symbol code 3301 and a size code 3302 , in which the symbol code 3301 and the size code 3302 are cooperatively referred as a size/symbol code 330 .
  • a mask code 350 is generated.
  • the Huffman code 320 is stored in the Huffman memory 304 .
  • the size/symbol code 330 is stored in the symbol and size code memory 305 .
  • the mask code 350 is stored in the mask memory 306 .
  • the compression bit stream processing unit 307 is employed to receive the compression bit stream 360 to be decoded. In response to the mask code 350 , the compression bit stream processing unit 307 performs a masking operation on the compression bit stream 360 , thereby outputting a masking result 370 . By the Huffman code processing unit 308 , a logic operation is performed on the masking result 370 and the Huffman code 320 , thereby generating a new Huffman code 380 . In response to the new Huffman code 380 , the compression bit stream 360 is decoded by the Huffman decoding unit 309 .
  • the compressed file to be decoded is transmitted to the Huffman decoding device 300 via the bus 301 .
  • the compressed file to be decoded includes for example the compression bit stream 360 and the data code 310 .
  • Multiple data codes 310 are transmitted to the Huffman table extracting and processing unit 303 through the bus interface 302 .
  • the multiple data codes 310 are processed by the Huffman table extracting and processing unit 303 and thus classified into Huffman codes 320 , symbol codes 3301 and size codes 3302 .
  • corresponding mask codes 350 are generated.
  • Each mask code 350 includes a valid bit portion and an invalid bit portion.
  • the bit-size of the valid bit portion of the mask code 350 is determined according to the size code 3302 .
  • the Huffman codes 320 , the size/symbol codes 330 and the mask codes 350 are stored in the Huffman memory 304 , the symbol and size code memory 305 and the mask memory 306 , respectively.
  • 16 bits of a compression bit stream 360 are successively inputted into the compression bit stream processing unit 307 , and the mask codes 350 are issued from the mask memory 306 to the bit stream processing unit 307 .
  • the compression bit stream processing unit 307 may perform a masking operation on the 16-bit compression bit stream 360 and the mask code 350 , thereby outputting a masking result 370 .
  • the Huffman code processing unit 308 receives the Huffman codes 320 from the Huffman memory 304 , and then performs a logic operation on the Huffman codes 320 and the masking result 370 , thereby generating a new Huffman code 380 .
  • the new Huffman code 380 also includes a codeword having variable code length.
  • the Huffman decoding unit 309 receives the size/symbol codes 330 from the symbol and size code memory 305 and successively receives the 16 bits of the compression bit stream 360 .
  • the 16-bit compression bit stream 360 is compared with the new Huffman code 380 .
  • the Huffman decoding unit 309 will output the corresponding size/symbol codes 330 .
  • the codeword of the Huffman codes 320 is identical to the codeword of the new Huffman code 380 .
  • the compression bit stream indicates a stream of input data having a codeword.
  • decoded used herein means that the size and the symbol on the Huffman table corresponding to the codeword of the compression bit stream are read out.
  • the codeword using in the conventional encoding system have variable code length. For example, in a case that nine bits of a stream of input data are successively received, the first bit may indicate a first codeword having a size of 1, the second to sixth bits may indicate a second codeword having a size of 5, and the seventh to ninth bits may indicate a third codeword having a size of 3. Since the conventional Huffman decoder fails to identify which bits of the input data stream indicate a complete codeword, the bits of the input data stream need to be decoded one by one according to the conventional binary tree search technique.
  • the Huffman decoding device 300 of the present invention By means of the Huffman decoding device 300 of the present invention, 16 bits of the compression bit stream 360 are decoded at one time and thus the decoding speed is enhanced.
  • the 16-bit compression bit stream 360 may be simultaneously compared with multiple Huffman codes included in the Huffman table. After the comparison, the size/symbol code corresponding to a first codeword of the compression bit stream is decoded.
  • the preceding 16 bits of a compression bit stream 360 (e.g. “1010,1010,1010,1010”) are successively inputted. Then, the input data stream “1010,1010,1010,10” is compared with the 12 Huffman codes included in the Huffman table so as to obtain the corresponding Huffman code.
  • the symbol A at the address “0” has a size code “1” and a Huffman code “1000,0000,0000,0000”.
  • a corresponding 16-bit mask code is generated.
  • the mask code includes a valid bit portion and an invalid bit portion, and the bit-size of the valid bit portion of the mask code is determined according to the size code.
  • the first bit and the remainder 15 bits of the 16-bit mask code belong to the valid portion and invalid portion, respectively. If the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit, the obtained mask code is “0111,1111,1111,1111”.
  • the obtained mask code is 1000,0000,0000,0000′′.
  • the size code 3302 indicates the bit-size of the codeword included in the Huffman code 320 and the mask code 350 is determined according to the size code 3302 . Since the Huffman code “1000,0000,0000,0000” has a size code “1”, the first bit “1” of this Huffman code 320 denotes the corresponding codeword.
  • the compression bit stream processing unit 307 performs a masking operation on the mask code 350 (“0111,1111,1111,1111”) and the 16-bit compression bit stream 360 (“1010,1010,1010”), thereby outputting a masking result 370 .
  • the term “masking operation” used herein indicates that the 16-bit mask code and the 16-bit compression bit stream are operated by an AND gate or an OR gate. In a case that the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit, the AND gate is selected for performing the masking operation. Whereas, in a case that the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit, the OR gate is selected for performing the masking operation. In this embodiment, the AND gate is selected for performing the masking operation, and the obtained masking result 370 is “0010,1010,10,10”.
  • the Huffman code processing unit 308 receives the Huffman codes 320 (“1000,0000,0000,0000”) from the Huffman memory 304 , and performs a logic operation on the Huffman codes 320 (“0010,1010,1010,10”) and the masking result 370 (“0010,1010,1010,1010”).
  • logic operation indicates that the 16-bit Huffman code 320 and the 16-bit masking result 370 are operated by an AND gate or an OR gate. In a case that the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit, the OR gate is selected for performing the logic operation.
  • the AND gate is selected for performing the logic operation.
  • the OR gate is selected for performing the logic operation, thereby generating a new Huffman code 380 (i.e. “1010,1010,1010,1010”).
  • the new Huffman code 380 also includes a codeword “1”.
  • the new Huffman code 380 (“1010,1010,1010,1010”) is compared with the 16-bit compression bit stream 360 (“1010,1010,1010”). Since the 16-bit compression bit stream 360 complies with the new Huffman code 380 , the Huffman decoding unit 309 will output the corresponding size/symbol code 330 . In this embodiment, since the first bit of the input data stream denotes the codeword at the address “0”, the size/symbol code of 1/A will be read out.
  • the Huffman decoding device 300 will receive an addition bit in order that the next compression bit stream still has 16 bits.
  • the above embodiment is illustrated by referring to one Huffman code processing procedure. Nevertheless, the Huffman decoding method of the present invention can be applied to process multiple Huffman codes so as to obtain multiple new Huffman codes. Therefore, the successive 16 bits of the compression bit stream may be simultaneously compared with multiple Huffman codes.
  • the 16 bits of a compression bit stream 360 (e.g. “1010,1010,1010,1010”) are successively inputted.
  • the 12 Huffman codes included in the Huffman table are processed as described above, thereby obtaining 12 new Huffman codes, “1010,1010,1010,1010”, “0010,1010,1010,1010”, . . . , and so on. Since the first new Huffman code complies with the compression bit stream 360 , the size/symbol code of 1/A will be read out. Meanwhile, since the first bit of the compression bit stream 360 has been decoded, the codeword having a bit size of 1 is removed and the remaindering input data stream includes 15 bits, i.e.
  • an additional bit e.g. “0” is supplemented such that a next input data stream “0101,0101,0101,0100” is intended to be further decoded.
  • one or additional bits to be supplemented are determined according to the existing bits of the compression bit stream 360 .
  • the 12 Huffman codes included in the Huffman table are processed as described above, thereby obtaining 12 new Huffman codes.
  • the first new Huffman code is “1101,0101,0101,0100”
  • the second Huffman code is “0001,0101,0101,0100”.
  • the third Huffman code is “0101,0101,0101,0100”.
  • the fourth Huffman code is “0111,1101,0101,0100”.
  • the fifth Huffman code is “0101,0101,0101,0100”. The rest may be deduced by analogy.
  • the new input data stream “0101,0101,0101,0100” is successively compared with the 12 new Huffman codes.
  • the data matching result shows that the first new Huffman code and the second new Huffman code do not comply with the new input data stream, but the third Huffman code complies with the new input data stream.
  • the size/symbol code of 5/D is read out and the codeword having a bit size of 5 is removed. For maintaining 16 bits, five additional bits are supplemented into a next input data stream. The above decoding procedures are continued until all bits of the compression bit stream 360 have been recorded.
  • the Huffman decoding device 300 is effective for decoding the compression bit stream at an enhanced speed.
  • the Huffman table shown in FIG. 3( b ) contains only 12 Huffman codes.
  • the Huffman table used in the industry may contain several hundreds of Huffman codes.
  • the circuitry and the hardware required for establishing the Huffman decoding device become more complicated and huge and thus the Huffman decoding device is not cost-effective.
  • FIG. 3( d ) is a schematic circuit block diagram of a Huffman decoding device according to a second preferred embodiment of the present invention.
  • a multi-stage processing unit 311 is electrically connected downstream of the Huffman decoding device 300 and the Huffman table extracting and processing unit 303 has a function of dividing the Huffman table into several groups.
  • 500 data codes 310 are transmitted to the Huffman table extracting and processing unit 303 through the bus interface 302 .
  • These data codes 310 are processed by the Huffman table extracting and processing unit 303 , thereby generating corresponding Huffman codes 320 , size/symbol codes 330 and mask codes 350 .
  • these 500 Huffman codes 320 which are stored in the Huffman memory 304 are divided into 5 groups such that each group contains 100 Huffman codes 320 .
  • the size/symbol codes 330 in the symbol and size code memory 305 and the mask codes 350 in the mask memory 306 are also divided into 5 groups. In every stage, only one group of Huffman codes 320 , size/symbol code 330 and mask codes 350 are processed.
  • 16 bits of a compression bit stream 360 are successively inputted into the compression bit stream processing unit 307 , and a first group of mask codes 350 are issued from the mask memory 306 to the bit stream processing unit 307 .
  • the compression bit stream processing unit 307 performs masking operations on the 16-bit compression bit stream 360 and the first group of mask codes 350 , thereby outputting 100 masking results 370 .
  • the Huffman code processing unit 308 logic operations are performed on these 100 masking results 370 and the first group of Huffman code 320 , thereby generating a first group of 100 new Huffman codes 380 .
  • the Huffman decoding unit 309 receives the first group of size/symbol codes 330 from the symbol and size code memory 305 and successively receives the 16 bits of the compression bit stream 360 .
  • the 16-bit compression bit stream 360 is compared with these 100 new Huffman codes 380 at a time.
  • a null signal “0” is transmitted to the multi-stage processing unit 311 .
  • a second group of mask codes 350 are issued from the mask memory 306 , and the above-mentioned masking operations and logic operations are performed to generate a second group of 100 new Huffman codes 380 .
  • a null signal “0” is transmitted to the multi-stage processing unit 311 .
  • the above procedures are repeated until a specific new Huffman code 380 complies with the 16-bit compression bit stream 360 .
  • the Huffman decoding unit 309 will transmit the corresponding size/symbol code 330 to the multi-stage processing unit 311 .
  • the null signals “0” and the decoded size/symbol code 330 are operated by an OR gate, thereby outputting the decoded size/symbol code 330 .
  • the codeword having a bit size corresponding to the decoded size/symbol code 330 is removed, and identical number of bits corresponding to the removed codeword is supplemented into a next input data stream so as to maintain 16 bits. The above decoding procedures are continued until all bits of the compression bit stream 360 have been recorded.
  • the second embodiment since a group of 100 new Huffman codes participate in the data-matching procedure at one time, at most five data-matching procedures are required for processing 500 new Huffman codes. As a consequence, the overall decoding time may be extended when compared with the first embodiment of FIG. 3( c ). However, since the circuitry and the hardware required for establishing the Huffman decoding device of FIG. 3( d ) are simplified, the second embodiment is more cost-effective.
  • the Huffman decoding method and the Huffman decoding device of the present invention are effective for implementing data matching of multiple Huffman codes.
  • the Huffman decoding method of the present invention may be implemented at an enhanced decoding speed.

Abstract

The present invention relates to a Huffman decoding method. Firstly, a Huffman table including multiple Huffman codes and multiple corresponding size/symbol codes is extracted. Each Huffman code comprises a codeword and each size/symbol code comprises a size code and a symbol code. Then, multiple mask codes are generated according to the size codes. Then, masking operations are performed on successive 16 bits of the compression bit stream and the mask codes, thereby outputting multiple masking results. Subsequently, logic operations on the masking results and the Huffman codes, thereby generating multiple are performed on the new Huffman codes, wherein each new Huffman code includes the codeword. It is discriminated whether the 16 bits of the compression bit stream complies with a specific one of new Huffman codes, thereby outputting the size/symbol code corresponding to the codeword.

Description

    FIELD OF THE INVENTION
  • The present invention relates to a decoding method, and more particularly to a Huffman decoding method.
  • BACKGROUND OF THE INVENTION
  • Huffman encoding algorithm is widely used in compression of video and image data, for example in JPEG and MPEG compression. As known, identical symbols (e.g. A, B, C, etc.) included in a file to be compressed may be repeatedly occurred. Based on the frequency of occurrence of the symbols in the file that is being compressed, Huffman encoding algorithm encodes symbols by assigning thereto respective codewords having lengths corresponding to probabilities of occurrence of the symbols. In a case that the occurrence of a symbol is more frequent, the length of the encoded symbol is shorter. Take a file having data ABCBCDCDDD for example. The frequency of occurrence for the symbol A is 1, for the symbol B is 2, for the symbol C is 3 and for the symbol D is 4. Since the symbol D has the most probable occurrence, the symbol D is assigned with a codeword having the shortest code length or bit-size. In contrast, since the symbol A has the least probable occurrence, the symbol A is assigned with a codeword having the longest code length or bit-size. For example, the symbol A is assigned with a codeword “11111111”, the symbol B is assigned with a codeword “00000”, the symbol C is assigned with a codeword “111” and the symbol D is assigned with a codeword “00”. By assigning smaller codes to more frequently used symbols and larger codes for less frequently used symbols, Huffman compression is a variable-length encoding system of reducing the size of files being compressed.
  • For reading the contents of the original file, the compressed file should be decompressed and then decoded by using a Huffman table as shown in FIG. 1. Referring to FIG. 1, the Huffman table includes several columns such as an address column, a symbol column, a size column and a codeword column. The address column denotes the address of the codeword stored in the memory. The size column denotes the bit-size of the codeword. The codeword column denotes the Huffman code of the encoded symbol. For example, the symbol J shown in FIG. 1 is assigned with a codeword “0110110” having a bit size of 7 (i.e. 7 bits). In other words, the input data “0110110” are encoded by the Huffman decoder into a corresponding symbol J and the bit-size is 7.
  • Nowadays, a nice way of visualizing the process of decoding a file compressed with Huffman encoding is to use a binary tree. A Huffman decoding method of using a binary tree-based search was disclosed in U.S. Pat. No. 6,621,429. According to the binary tree-based search, the Huffman table describes a binary tree corresponding to the Huffman code. Starting from the uppermost node, each node has two branches connected thereto so as to construct the binary tree.
  • Please refer to FIG. 2, which is a schematic view showing a binary tree created from the Huffman table of FIG. 1. Generally, if the Huffman table is changed, the configurations of the binary tree are varied. The binary tree of FIG. 2 stores each data (symbol) in a corresponding leaf node. By a Huffman decoder, a symbol search begins at the root of a binary tree and ends at any of the leaves. One bit for each node is extracted from bit-stream while traversing the binary tree. The code for a symbol is obtained by following the path from the root to the leaf node containing that symbol. The low-level bit 0 of the input data is assigned to a left branch, and the high-level bit 1 is assigned to a right branch. After a symbol corresponding to the bit is searched, a next bit of the input data is extracted and then decoded as described above.
  • For example, an input data stream “011101” to be decoded is illustrated with reference to FIG. 2. As to the node 11, the first bit data “0” is assigned to the left branch to the node 12. As to the node 12, the second bit data “1” is assigned to the right branch to the node 13. As to the node 13, the third bit data “1” is assigned to the right branch to the node 14. As to the node 14, the fourth bit data “1” is assigned to the right branch to the node 19. As to the node 19, the fifth bit data “0” is assigned to the left branch to the node 20. As to the node 20, the sixth bit data “1” is assigned to the right branch to the leaf node storing that symbol F. That is, the input data stream “011101 may be decoded into the symbol F. After the leaf node is searched, a new input data stream is continuously read and a symbol search begins at the root node 11 again. The binary tree search procedures are repeated until all input data streams are recoded.
  • Since the bits of the input data stream are decoded one by one, the processing speed of such binary tree search method is very slow and is not suitable to decode abundant compressed files. Therefore, there is a need to provide a Huffman decoding method for decoding Huffman codes at a high speed.
  • SUMMARY OF THE INVENTION
  • It is an object of the present invention to provide a Huffman decoding method capable of decoding Huffman codes at a high speed.
  • In accordance with a first aspect of the present invention, there is provided a Huffman decoding method for decoding a compression bit stream into corresponding size/symbol codes. Firstly, a Huffman table including multiple Huffman codes and multiple corresponding size/symbol codes is extracted. Each Huffman code includes a codeword having variable code length and each size/symbol code includes a size code and a symbol code. Then, multiple mask codes are generated according to the size codes. Then, masking operations are performed on successive 16 bits of the compression bit stream and the mask codes, thereby outputting multiple masking results. Subsequently, logic operations are performed on the masking results and the Huffman codes, thereby generating multiple the new Huffman codes, wherein each new Huffman code includes the codeword. It is discriminated whether the 16 bits of the compression bit stream complies with a specific one of new Huffman codes, thereby outputting the size/symbol code corresponding to the codeword.
  • In an embodiment, each mask code is composed of 16 binary codes and includes a valid bit portion and an invalid bit portion, wherein the bit-size of the valid bit portion of the mask code is determined according to the size code.
  • In an embodiment, an AND gate and an OR gate are used for performing the masking operation and the logic operation, respectively, when the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit.
  • In an embodiment, an OR gate and an AND gate are used for performing the masking operation and the logic operation, respectively, when the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit.
  • In accordance with a second aspect of the present invention, there is provided a Huffman decoding device for decoding a compression bit stream into corresponding size/symbol codes. The Huffman decoding device comprises a Huffman table extracting and processing unit, a Huffman memory, a symbol and size code memory, a mask memory, a compression bit stream processing unit, a Huffman code processing unit and a Huffman decoding unit. The Huffman table extracting and processing unit is used for extracting a Huffman table and generating multiple mask codes. The Huffman table includes multiple Huffman codes and multiple corresponding size/symbol codes. Each Huffman code includes a codeword having variable code length, each size/symbol code includes a size code and a symbol code, and the mask codes are generated according to the size codes. The Huffman memory is electrically connected to the Huffman table extracting and processing unit for storing the Huffman codes therein. The symbol and size code memory is electrically connected to the Huffman table extracting and processing unit for storing the size/symbol codes therein. The mask memory is electrically connected to the Huffman table extracting and processing unit for storing the mask codes therein. The compression bit stream processing unit is electrically connected to the mask memory and performing masking operations on successive 16 bits of the compression bit stream and the mask codes, thereby outputting multiple masking results. The Huffman code processing unit is communicated with the Huffman table extracting and processing unit for performing logic operations on the masking results and the Huffman codes, thereby generating multiple new Huffman codes, wherein each new Huffman code includes the codeword. The Huffman decoding unit is communicated with the Huffman table extracting and processing unit for discriminating whether the 16 bits of the compression bit stream complies with a specific one of new Huffman codes, thereby outputting the size/symbol code corresponding to the specific new Huffman code.
  • The above objects and advantages of the present invention will become more readily apparent to those ordinarily skilled in the art after reviewing the following detailed description and accompanying drawings, in which:
  • BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 1 schematically illustrates a conventional Huffman table;
  • FIG. 2 is a schematic view showing a binary tree created from the Huffman table of FIG. 1;
  • FIG. 3( a) schematically illustrates a data code definition for the Huffman table used in the present invention;
  • FIG. 3( b) schematically illustrates a Huffman table used in the present invention;
  • FIG. 3( c) is a schematic circuit block diagram of a Huffman decoding device according to a first preferred embodiment of the present invention; and
  • FIG. 3( d) is a schematic circuit block diagram of a Huffman decoding device according to a second preferred embodiment of the present invention.
  • DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT
  • The present invention relates to a Huffman decoding method. First of all, a Huffman table is provided in a Huffman decoder to describe the Huffman codes. Take a JPEG file for example. Generally, a standard JPEG Huffman table has been previously provided in the decoder. The standard JPEG Huffman table includes codewords for most JPEG files in order to be used for decoding most compressed JPEG data. On the other hand, the application of the standard JPEG Huffman table is restricted because some JPEG files have specific decompression requirements. As a consequence, the manufacture may design specified Huffman tables as required. These specified Huffman table are stored in the header of the JPEG file. When the decoding operation is initiated, the specified Huffman tables will be downloaded from the JPEG file to the decoder through the bus.
  • Referring to FIG. 3( a), a data code definition for the Huffman table used in the present invention is illustrated. The data code 310 is a 32-bit code. The first two bits of the data code 310 denote chroma value, luma value, AC coefficient and DC coefficient. The next twenty bits indicate the Huffman code 320. Each Huffman code 320 includes a codeword having variable code length. The next five bits denotes a symbol code 3301. The five bits subsequent to the symbol code 3301 is a size code 3302. In this embodiment, the symbol code 3301 and the size code 3302 are cooperatively referred as a size/symbol code 330. In this embodiment, the Huffman code 320 is illustrated by referring to a 16-bit code because the 16-bit Huffman code is commonly used. Nevertheless, the Huffman code 320 of the present invention can be expanded to 20 bits in order to decode higher-bit Huffman code and increase the application spectrum.
  • Referring to FIG. 3( b), an embodiment of a Huffman table used in the present invention is illustrated. As shown in FIG. 3( b), the Huffman table includes several columns such as an address column, a symbol column, a size column and a Huffman code column. The meanings of the address column, the symbol column and the size column are identical to those described in FIG. 1, and are not described redundantly herein. As previously described, the codeword column in the conventional Huffman table denotes the Huffman code of the encoded symbol. Instead of the codeword column, the preceding one or more bits of the Huffman code shown in the Huffman code column of FIG. 3( b) denotes the codeword. In other words, the codeword having variable code length is included in the 16-bit Huffman code. As a consequence, the Huffman decoder may perform the decoding operations regardless of whether the exact code length of the codeword is realized. In addition, the size code denotes bit-size of the codeword and is measure of deciding the mask code. The mask code includes a valid bit portion and an invalid bit portion. The bit-size of the valid bit portion of the mask code is determined according to the size code. In this embodiment, the Huffman code includes the codeword and the valid bit portion of the mask code. The low-level bit “0” is assigned to the valid bit portion and the high-level bit “1” is assigned to the invalid bit portion. For example, the symbol A at the address “0” has a size code “1” and is assigned with a codeword “1”, the Huffman code is “1000,0000,0000,0000”, which includes the size code “1” and the remainder 15 valid bits “0”. Whereas, if the high-level bit “1” is assigned to the valid bit portion and the low-level bit “0” is assigned to the invalid bit portion, the Huffman code of the symbol A is “111,1111,1111,1111” which includes the size code “1” and the remainder 15 valid bits “1”.
  • Referring to FIG. 3( c), a schematic circuit block diagram of a Huffman decoding device according to a first preferred embodiment of the present invention is illustrated. The Huffman decoding device 300 is electrically connected to a bus 301. Via the bus 301, the data code 310 stored in the header of a compressed file (e.g. a JPEG file) may be transmitted to the Huffman decoding device 300, so that the data code 310 is obtained by the Huffman decoding device 300. As shown in FIG. 3( c), the Huffman decoding device 300 includes a bus interface 302, a Huffman table extracting and processing unit 303, a Huffman memory 304, a symbol and size code memory 305, a mask memory 306, a compression bit stream processing unit 307, a Huffman code processing unit 308 and a Huffman decoding unit 309.
  • The Huffman decoding device 300 is communicated with the bus 301 through the bus interface 302 so as to receive the data code 310. The data code 310 is processed by the Huffman table extracting and processing unit 303 and classified into a Huffman code 320, a symbol code 3301 and a size code 3302, in which the symbol code 3301 and the size code 3302 are cooperatively referred as a size/symbol code 330. According to the size code 3302, a mask code 350 is generated. The Huffman code 320 is stored in the Huffman memory 304. The size/symbol code 330 is stored in the symbol and size code memory 305. The mask code 350 is stored in the mask memory 306. The compression bit stream processing unit 307 is employed to receive the compression bit stream 360 to be decoded. In response to the mask code 350, the compression bit stream processing unit 307 performs a masking operation on the compression bit stream 360, thereby outputting a masking result 370. By the Huffman code processing unit 308, a logic operation is performed on the masking result 370 and the Huffman code 320, thereby generating a new Huffman code 380. In response to the new Huffman code 380, the compression bit stream 360 is decoded by the Huffman decoding unit 309.
  • Hereinafter, the operation principle of the circuit block diagram of FIG. 3( c) will be illustrated as follows.
  • First of all, the compressed file to be decoded is transmitted to the Huffman decoding device 300 via the bus 301. In this embodiment, the compressed file to be decoded includes for example the compression bit stream 360 and the data code 310. Multiple data codes 310 are transmitted to the Huffman table extracting and processing unit 303 through the bus interface 302.
  • Subsequently, as shown in FIG. 3( c), the multiple data codes 310 are processed by the Huffman table extracting and processing unit 303 and thus classified into Huffman codes 320, symbol codes 3301 and size codes 3302. According to the size codes 3302, corresponding mask codes 350 are generated. Each mask code 350 includes a valid bit portion and an invalid bit portion. The bit-size of the valid bit portion of the mask code 350 is determined according to the size code 3302. Next, the Huffman codes 320, the size/symbol codes 330 and the mask codes 350 are stored in the Huffman memory 304, the symbol and size code memory 305 and the mask memory 306, respectively. Then, 16 bits of a compression bit stream 360 are successively inputted into the compression bit stream processing unit 307, and the mask codes 350 are issued from the mask memory 306 to the bit stream processing unit 307. The compression bit stream processing unit 307 may perform a masking operation on the 16-bit compression bit stream 360 and the mask code 350, thereby outputting a masking result 370.
  • The Huffman code processing unit 308 receives the Huffman codes 320 from the Huffman memory 304, and then performs a logic operation on the Huffman codes 320 and the masking result 370, thereby generating a new Huffman code 380. The new Huffman code 380 also includes a codeword having variable code length.
  • The Huffman decoding unit 309 receives the size/symbol codes 330 from the symbol and size code memory 305 and successively receives the 16 bits of the compression bit stream 360. By means of the Huffman decoding unit 309, the 16-bit compression bit stream 360 is compared with the new Huffman code 380. When the 16-bit compression bit stream 360 complies with the new Huffman code 380, the Huffman decoding unit 309 will output the corresponding size/symbol codes 330. Under this circumstance, the codeword of the Huffman codes 320 is identical to the codeword of the new Huffman code 380.
  • An implementation example of the present invention will be illustrated with reference to the Huffman table of FIG. 3( b) and the circuit block diagram of FIG. 3( c).
  • In the present description, the compression bit stream indicates a stream of input data having a codeword. The term “decoded” used herein means that the size and the symbol on the Huffman table corresponding to the codeword of the compression bit stream are read out. As previously described, the codeword using in the conventional encoding system have variable code length. For example, in a case that nine bits of a stream of input data are successively received, the first bit may indicate a first codeword having a size of 1, the second to sixth bits may indicate a second codeword having a size of 5, and the seventh to ninth bits may indicate a third codeword having a size of 3. Since the conventional Huffman decoder fails to identify which bits of the input data stream indicate a complete codeword, the bits of the input data stream need to be decoded one by one according to the conventional binary tree search technique.
  • By means of the Huffman decoding device 300 of the present invention, 16 bits of the compression bit stream 360 are decoded at one time and thus the decoding speed is enhanced. The 16-bit compression bit stream 360 may be simultaneously compared with multiple Huffman codes included in the Huffman table. After the comparison, the size/symbol code corresponding to a first codeword of the compression bit stream is decoded.
  • Hereinafter, a procedure of comparing the compression bit stream with the Huffman table will be illustrated as follows.
  • Firstly, the preceding 16 bits of a compression bit stream 360 (e.g. “1010,1010,1010,1010”) are successively inputted. Then, the input data stream “1010,1010,1010,1010” is compared with the 12 Huffman codes included in the Huffman table so as to obtain the corresponding Huffman code.
  • For example, the symbol A at the address “0” has a size code “1” and a Huffman code “1000,0000,0000,0000”. According to the size code, a corresponding 16-bit mask code is generated. The mask code includes a valid bit portion and an invalid bit portion, and the bit-size of the valid bit portion of the mask code is determined according to the size code. In the size code, the first bit and the remainder 15 bits of the 16-bit mask code belong to the valid portion and invalid portion, respectively. If the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit, the obtained mask code is “0111,1111,1111,1111”. Whereas, if the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit, the obtained mask code is 1000,0000,0000,0000″. The rest may be deduced by analogy. In the embodiment, the size code 3302 indicates the bit-size of the codeword included in the Huffman code 320 and the mask code 350 is determined according to the size code 3302. Since the Huffman code “1000,0000,0000,0000” has a size code “1”, the first bit “1” of this Huffman code 320 denotes the corresponding codeword.
  • Next, the compression bit stream processing unit 307 performs a masking operation on the mask code 350 (“0111,1111,1111,1111”) and the 16-bit compression bit stream 360 (“1010,1010,1010,1010”), thereby outputting a masking result 370. The term “masking operation” used herein indicates that the 16-bit mask code and the 16-bit compression bit stream are operated by an AND gate or an OR gate. In a case that the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit, the AND gate is selected for performing the masking operation. Whereas, in a case that the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit, the OR gate is selected for performing the masking operation. In this embodiment, the AND gate is selected for performing the masking operation, and the obtained masking result 370 is “0010,1010,1010,1010”.
  • Next, the Huffman code processing unit 308 receives the Huffman codes 320 (“1000,0000,0000,0000”) from the Huffman memory 304, and performs a logic operation on the Huffman codes 320 (“0010,1010,1010,1010”) and the masking result 370 (“0010,1010,1010,1010”). The term “logic operation” used herein indicates that the 16-bit Huffman code 320 and the 16-bit masking result 370 are operated by an AND gate or an OR gate. In a case that the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit, the OR gate is selected for performing the logic operation. Whereas, in a case that the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit, the AND gate is selected for performing the logic operation. In this embodiment, the OR gate is selected for performing the logic operation, thereby generating a new Huffman code 380 (i.e. “1010,1010,1010,1010”). The new Huffman code 380 also includes a codeword “1”.
  • By means of the Huffman decoding unit 309, the new Huffman code 380 (“1010,1010,1010,1010”) is compared with the 16-bit compression bit stream 360 (“1010,1010,1010,1010”). Since the 16-bit compression bit stream 360 complies with the new Huffman code 380, the Huffman decoding unit 309 will output the corresponding size/symbol code 330. In this embodiment, since the first bit of the input data stream denotes the codeword at the address “0”, the size/symbol code of 1/A will be read out.
  • The procedures of comparing the compression bit stream with the other 11 Huffman codes included in the Huffman table are identical to that described above. Since the Huffman table has been established by encoding all possible compression bit streams, every 16-bit compression bit stream will correspond to a Huffman code at a specific address. In the above embodiment, the first bit of the input data stream denotes the codeword of the Huffman code at the address “0”. Since one size/symbol code at the address “0” has been decoded, the Huffman codes at other addresses are impossible to match the input data stream.
  • Since the first bit of the 16-bit compression bit stream has been decoded, the Huffman decoding device 300 will receive an addition bit in order that the next compression bit stream still has 16 bits.
  • The above embodiment is illustrated by referring to one Huffman code processing procedure. Nevertheless, the Huffman decoding method of the present invention can be applied to process multiple Huffman codes so as to obtain multiple new Huffman codes. Therefore, the successive 16 bits of the compression bit stream may be simultaneously compared with multiple Huffman codes.
  • Hereinafter, a procedure of simultaneously comparing the compression bit stream with 12 Huffman codes in the Huffman table of FIG. 3( b) will be illustrated as follows.
  • Firstly, the 16 bits of a compression bit stream 360 (e.g. “1010,1010,1010,1010”) are successively inputted. Then, the 12 Huffman codes included in the Huffman table are processed as described above, thereby obtaining 12 new Huffman codes, “1010,1010,1010,1010”, “0010,1010,1010,1010”, . . . , and so on. Since the first new Huffman code complies with the compression bit stream 360, the size/symbol code of 1/A will be read out. Meanwhile, since the first bit of the compression bit stream 360 has been decoded, the codeword having a bit size of 1 is removed and the remaindering input data stream includes 15 bits, i.e. “0101,0101,0101,010”. For maintaining 16 bits, an additional bit, e.g. “0”, is supplemented such that a next input data stream “0101,0101,0101,0100” is intended to be further decoded. Generally, one or additional bits to be supplemented are determined according to the existing bits of the compression bit stream 360.
  • After the new input data stream “0101,0101,0101,0100” is received, the 12 Huffman codes included in the Huffman table are processed as described above, thereby obtaining 12 new Huffman codes. The first new Huffman code is “1101,0101,0101,0100”, the second Huffman code is “0001,0101,0101,0100”. The third Huffman code is “0101,0101,0101,0100”. The fourth Huffman code is “0111,1101,0101,0100”. The fifth Huffman code is “0101,0101,0101,0100”. The rest may be deduced by analogy. Next, the new input data stream “0101,0101,0101,0100” is successively compared with the 12 new Huffman codes. The data matching result shows that the first new Huffman code and the second new Huffman code do not comply with the new input data stream, but the third Huffman code complies with the new input data stream. Meanwhile, the size/symbol code of 5/D is read out and the codeword having a bit size of 5 is removed. For maintaining 16 bits, five additional bits are supplemented into a next input data stream. The above decoding procedures are continued until all bits of the compression bit stream 360 have been recorded.
  • In the above embodiment, the Huffman decoding device 300 is effective for decoding the compression bit stream at an enhanced speed. The Huffman table shown in FIG. 3( b) contains only 12 Huffman codes. In practice, the Huffman table used in the industry may contain several hundreds of Huffman codes. In this circumstance, the circuitry and the hardware required for establishing the Huffman decoding device become more complicated and huge and thus the Huffman decoding device is not cost-effective.
  • Hereinafter, a further embodiment of a Huffman decoding device with reduced hardware and cost will be illustrated as follows with reference to FIG. 3( d).
  • FIG. 3( d) is a schematic circuit block diagram of a Huffman decoding device according to a second preferred embodiment of the present invention. In comparison with FIG. 3( c), a multi-stage processing unit 311 is electrically connected downstream of the Huffman decoding device 300 and the Huffman table extracting and processing unit 303 has a function of dividing the Huffman table into several groups. For example, 500 data codes 310 are transmitted to the Huffman table extracting and processing unit 303 through the bus interface 302. These data codes 310 are processed by the Huffman table extracting and processing unit 303, thereby generating corresponding Huffman codes 320, size/symbol codes 330 and mask codes 350. Moreover, during the decoding process, these 500 Huffman codes 320 which are stored in the Huffman memory 304 are divided into 5 groups such that each group contains 100 Huffman codes 320. Likewise, the size/symbol codes 330 in the symbol and size code memory 305 and the mask codes 350 in the mask memory 306 are also divided into 5 groups. In every stage, only one group of Huffman codes 320, size/symbol code 330 and mask codes 350 are processed.
  • Then, 16 bits of a compression bit stream 360 are successively inputted into the compression bit stream processing unit 307, and a first group of mask codes 350 are issued from the mask memory 306 to the bit stream processing unit 307. In response to the mask codes 350, the compression bit stream processing unit 307 performs masking operations on the 16-bit compression bit stream 360 and the first group of mask codes 350, thereby outputting 100 masking results 370. By the Huffman code processing unit 308, logic operations are performed on these 100 masking results 370 and the first group of Huffman code 320, thereby generating a first group of 100 new Huffman codes 380. The Huffman decoding unit 309 receives the first group of size/symbol codes 330 from the symbol and size code memory 305 and successively receives the 16 bits of the compression bit stream 360. By means of the Huffman decoding unit 309, the 16-bit compression bit stream 360 is compared with these 100 new Huffman codes 380 at a time. In a case that none of the first group of new Huffman codes 380 complies with the 16-bit compression bit stream 360, a null signal “0” is transmitted to the multi-stage processing unit 311. Subsequently, a second group of mask codes 350 are issued from the mask memory 306, and the above-mentioned masking operations and logic operations are performed to generate a second group of 100 new Huffman codes 380. In a case that none of the second group of new Huffman codes 380 complies with the 16-bit compression bit stream 360, a null signal “0” is transmitted to the multi-stage processing unit 311. The above procedures are repeated until a specific new Huffman code 380 complies with the 16-bit compression bit stream 360. Once the specific new Huffman code 380 is searched, the Huffman decoding unit 309 will transmit the corresponding size/symbol code 330 to the multi-stage processing unit 311. In the multi-stage processing unit 311, the null signals “0” and the decoded size/symbol code 330 are operated by an OR gate, thereby outputting the decoded size/symbol code 330. Similarly, the codeword having a bit size corresponding to the decoded size/symbol code 330 is removed, and identical number of bits corresponding to the removed codeword is supplemented into a next input data stream so as to maintain 16 bits. The above decoding procedures are continued until all bits of the compression bit stream 360 have been recorded.
  • From the second embodiment, since a group of 100 new Huffman codes participate in the data-matching procedure at one time, at most five data-matching procedures are required for processing 500 new Huffman codes. As a consequence, the overall decoding time may be extended when compared with the first embodiment of FIG. 3( c). However, since the circuitry and the hardware required for establishing the Huffman decoding device of FIG. 3( d) are simplified, the second embodiment is more cost-effective.
  • From the above description, the Huffman decoding method and the Huffman decoding device of the present invention are effective for implementing data matching of multiple Huffman codes. In comparison with the conventional binary tree search technique of decoding the bits of the input data stream one by one, the Huffman decoding method of the present invention may be implemented at an enhanced decoding speed.
  • While the invention has been described in terms of what is presently considered to be the most practical and preferred embodiments, it is to be understood that the invention needs not be limited to the disclosed embodiment. On the contrary, it is intended to cover various modifications and similar arrangements included within the spirit and scope of the appended claims which are to be accorded with the broadest interpretation so as to encompass all such modifications and similar structures.

Claims (8)

1. A Huffman decoding method for decoding a compression bit stream into corresponding size/symbol codes, said Huffman decoding method comprising steps of:
extracting a Huffman table comprising multiple Huffman codes and multiple corresponding size/symbol codes, wherein each Huffman code comprises a codeword having variable code length and each size/symbol code comprises a size code and a symbol code;
generating multiple mask codes according to said size codes;
performing masking operations on successive 16 bits of said compression bit stream and said mask codes, thereby outputting multiple masking results;
performing logic operations on said masking results and said Huffman codes, thereby generating multiple new Huffman codes, wherein each new Huffman code includes said codeword;
discriminating whether said 16 bits of said compression bit stream complies with a specific one of new Huffman codes; and
outputting the size/symbol code corresponding to said codeword.
2. The Huffman decoding method according to claim 1 wherein each mask code is composed of 16 binary codes and includes a valid bit portion and an invalid bit portion, wherein the bit-size of said valid bit portion of said mask code is determined according to said size code.
3. The Huffman decoding method according to claim 2 wherein an AND gate and an OR gate are used for performing said masking operation and said logic operation, respectively, if the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit.
4. The Huffman decoding method according to claim 2 wherein an OR gate and an AND gate are used for performing said masking operation and said logic operation, respectively, if the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit.
5. A Huffman decoding device for decoding a compression bit stream into corresponding size/symbol codes, said Huffman decoding device comprising:
a Huffman table extracting and processing unit for extracting a Huffman table and generating multiple mask codes, said Huffman table comprising multiple Huffman codes and multiple corresponding size/symbol codes, wherein each Huffman code comprises a codeword having variable code length, each size/symbol code includes a size code and a symbol code, and said mask codes are generated according to said size codes;
a Huffman memory electrically connected to said Huffman table extracting and processing unit for storing said Huffman codes therein;
a symbol and size code memory electrically connected to said Huffman table extracting and processing unit for storing said size/symbol codes therein;
a mask memory electrically connected to said Huffman table extracting and processing unit for storing said mask codes therein;
a compression bit stream processing unit electrically connected to said mask memory and performing masking operations on successive 16 bits of said compression bit stream and said mask codes, thereby outputting multiple masking results;
a Huffman code processing unit communicated with said Huffman table extracting and processing unit for performing logic operations on said masking results and said Huffman codes, thereby generating multiple new Huffman codes, wherein each new Huffman code includes said codeword; and
a Huffman decoding unit communicated with said Huffman table extracting and processing unit for discriminating whether said 16 bits of said compression bit stream complies with a specific one of new Huffman codes, thereby outputting the size/symbol code corresponding to said specific new Huffman code.
6. The Huffman decoding device according to claim 5 wherein each mask code is composed of 16 binary codes and includes a valid bit portion and an invalid bit portion, wherein the bit-size of said valid bit portion of said mask code is determined according to said size code.
7. The Huffman decoding device according to claim 6 wherein an AND gate and an OR gate are used for performing said masking operation and said logic operation, respectively, if the bit “0” indicates a valid bit and the bit “1” indicates an invalid bit.
8. The Huffman decoding device according to claim 6 wherein an OR gate and an AND gate are used for performing said masking operation and said logic operation, respectively, if the bit “1” indicates a valid bit and the bit “0” indicates an invalid bit.
US11/673,379 2006-11-24 2007-02-09 Huffman decoding method Expired - Fee Related US7375660B1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
TW095143505 2006-11-24
TW095143505A TWI330473B (en) 2006-11-24 2006-11-24 Huffman decoding method

Publications (2)

Publication Number Publication Date
US7375660B1 US7375660B1 (en) 2008-05-20
US20080122664A1 true US20080122664A1 (en) 2008-05-29

Family

ID=39387616

Family Applications (1)

Application Number Title Priority Date Filing Date
US11/673,379 Expired - Fee Related US7375660B1 (en) 2006-11-24 2007-02-09 Huffman decoding method

Country Status (2)

Country Link
US (1) US7375660B1 (en)
TW (1) TWI330473B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080253668A1 (en) * 2007-04-13 2008-10-16 Brian Lamb Method of decoding entropy-encoded data
US20100195739A1 (en) * 2009-02-04 2010-08-05 Novatek Microelectronics Corp. Adaptive canonical huffman decoder and method thereof and video decoder
US20110016096A1 (en) * 2009-07-16 2011-01-20 Teerlink Craig N Optimal sequential (de)compression of digital data
US20110225659A1 (en) * 2010-03-10 2011-09-15 Isaacson Scott A Semantic controls on data storage and access
CN102298782A (en) * 2010-06-25 2011-12-28 英特尔公司 System, method, and computer program product for parameter estimation for lossless video compression
US8832103B2 (en) 2010-04-13 2014-09-09 Novell, Inc. Relevancy filter for new data based on underlying files
US8971413B2 (en) 2010-05-24 2015-03-03 Intel Corporation Techniques for storing and retrieving pixel data

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8321326B2 (en) 2009-09-15 2012-11-27 Auerbach Group Llc Method and system for enhancing the efficiency of a digitally communicated data exchange
KR101725223B1 (en) * 2011-03-25 2017-04-11 삼성전자 주식회사 Data compressing method of storage device
US9378560B2 (en) 2011-06-17 2016-06-28 Advanced Micro Devices, Inc. Real time on-chip texture decompression using shader processors

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4899149A (en) * 1986-02-28 1990-02-06 Gary Kahan Method of and apparatus for decoding Huffman or variable-length coees
US6563439B1 (en) * 2000-10-31 2003-05-13 Intel Corporation Method of performing Huffman decoding
US6636167B1 (en) * 2000-10-31 2003-10-21 Intel Corporation Method of generating Huffman code length information
US7205915B2 (en) * 2003-07-15 2007-04-17 Intel Corporation Method of decoding variable length prefix codes

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4899149A (en) * 1986-02-28 1990-02-06 Gary Kahan Method of and apparatus for decoding Huffman or variable-length coees
US6563439B1 (en) * 2000-10-31 2003-05-13 Intel Corporation Method of performing Huffman decoding
US6636167B1 (en) * 2000-10-31 2003-10-21 Intel Corporation Method of generating Huffman code length information
US6646577B2 (en) * 2000-10-31 2003-11-11 Intel Corporation Method of performing Huffman decoding
US7190287B2 (en) * 2000-10-31 2007-03-13 Intel Corporation Method of generating Huffman code length information
US7205915B2 (en) * 2003-07-15 2007-04-17 Intel Corporation Method of decoding variable length prefix codes

Cited By (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080253668A1 (en) * 2007-04-13 2008-10-16 Brian Lamb Method of decoding entropy-encoded data
US8457419B2 (en) * 2007-04-13 2013-06-04 Research In Motion Limited Method of decoding entropy-encoded data
US20100195739A1 (en) * 2009-02-04 2010-08-05 Novatek Microelectronics Corp. Adaptive canonical huffman decoder and method thereof and video decoder
US8306108B2 (en) * 2009-02-04 2012-11-06 Novatek Microelectronics Corp. Adaptive canonical Huffman decoder and method thereof and video decoder
US20110016136A1 (en) * 2009-07-16 2011-01-20 Isaacson Scott A Grouping and Differentiating Files Based on Underlying Grouped and Differentiated Files
US8874578B2 (en) 2009-07-16 2014-10-28 Novell, Inc. Stopping functions for grouping and differentiating files based on content
US20110016135A1 (en) * 2009-07-16 2011-01-20 Teerlink Craig N Digital spectrum of file based on contents
US20110013777A1 (en) * 2009-07-16 2011-01-20 Teerlink Craig N Encryption/decryption of digital data using related, but independent keys
US9390098B2 (en) 2009-07-16 2016-07-12 Novell, Inc. Fast approximation to optimal compression of digital data
US9348835B2 (en) 2009-07-16 2016-05-24 Novell, Inc. Stopping functions for grouping and differentiating files based on content
US9298722B2 (en) 2009-07-16 2016-03-29 Novell, Inc. Optimal sequential (de)compression of digital data
US20110016124A1 (en) * 2009-07-16 2011-01-20 Isaacson Scott A Optimized Partitions For Grouping And Differentiating Files Of Data
US20110016096A1 (en) * 2009-07-16 2011-01-20 Teerlink Craig N Optimal sequential (de)compression of digital data
US8566323B2 (en) 2009-07-16 2013-10-22 Novell, Inc. Grouping and differentiating files based on underlying grouped and differentiated files
US9053120B2 (en) 2009-07-16 2015-06-09 Novell, Inc. Grouping and differentiating files based on content
US8811611B2 (en) 2009-07-16 2014-08-19 Novell, Inc. Encryption/decryption of digital data using related, but independent keys
US8983959B2 (en) 2009-07-16 2015-03-17 Novell, Inc. Optimized partitions for grouping and differentiating files of data
US20110016138A1 (en) * 2009-07-16 2011-01-20 Teerlink Craig N Grouping and Differentiating Files Based on Content
US8782734B2 (en) 2010-03-10 2014-07-15 Novell, Inc. Semantic controls on data storage and access
US20110225659A1 (en) * 2010-03-10 2011-09-15 Isaacson Scott A Semantic controls on data storage and access
US8832103B2 (en) 2010-04-13 2014-09-09 Novell, Inc. Relevancy filter for new data based on underlying files
US8971413B2 (en) 2010-05-24 2015-03-03 Intel Corporation Techniques for storing and retrieving pixel data
US20110317759A1 (en) * 2010-06-25 2011-12-29 Thomas Vinay S System, method, and computer program product for parameter estimation for lossless video compression
CN102298782A (en) * 2010-06-25 2011-12-28 英特尔公司 System, method, and computer program product for parameter estimation for lossless video compression

Also Published As

Publication number Publication date
TWI330473B (en) 2010-09-11
US7375660B1 (en) 2008-05-20
TW200824306A (en) 2008-06-01

Similar Documents

Publication Publication Date Title
US7375660B1 (en) Huffman decoding method
US10033405B2 (en) Data compression systems and method
WO2019153700A1 (en) Encoding and decoding method, apparatus and encoding and decoding device
KR100894002B1 (en) Device and data method for selective compression and decompression and data format for compressed data
JP4905562B2 (en) Data compression apparatus and data restoration apparatus
KR100527891B1 (en) Method of performing huffman decoding
US20130307709A1 (en) Efficient techniques for aligned fixed-length compression
JP2003218703A (en) Data coder and data decoder
US7148821B2 (en) System and method for partition and pattern-match decoding of variable length codes
JP2011114525A (en) Method and device for encoding/decoding numerical data string
CN104682966B (en) The lossless compression method of table data
JP2536422B2 (en) Data compression device and data decompression device
CN116208171A (en) Data compression and decompression method and device, electronic equipment and storage medium
JP2014078994A (en) Method and device for encoding/decoding numerical data string
KR100686354B1 (en) Huffman decoding method and device for using variable length tree
KR20170031868A (en) Apparatus for binary data real time compressing method of classifying binary clusters topology based on their type and value
JP2005175926A (en) Decoder and decoding method
KR20220028388A (en) Huffman and bl-alpha code data compression
Park et al. High speed search and an area efficient Huffman decoder
JP2002344326A (en) Method for compressing data by synthetic index and method for restoring compressed data completely
JPH0659857A (en) Data compressor
KR20160055986A (en) Data compression method of mapping binary clusters with universal codes
BRPI0806178A2 (en) method and apparatus for digital signal compression and decompression

Legal Events

Date Code Title Description
AS Assignment

Owner name: PRIMAX ELECTRONICS LTD., TAIWAN

Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:CHANG, WEN-TSUNG;CHUANG, CHE-SHENG;REEL/FRAME:018877/0199

Effective date: 20070206

CC Certificate of correction
FPAY Fee payment

Year of fee payment: 4

REMI Maintenance fee reminder mailed
LAPS Lapse for failure to pay maintenance fees
STCH Information on status: patent discontinuation

Free format text: PATENT EXPIRED DUE TO NONPAYMENT OF MAINTENANCE FEES UNDER 37 CFR 1.362

FP Lapsed due to failure to pay maintenance fee

Effective date: 20160520