Implementation Approaches To Huffman Decoding
Implementation Approaches To Huffman Decoding
Satish D. Warhade
Senior Software Engineer
Wipro Technologies,
26,Chamundi Complex, Bommanahalli
Bangalore-560068 INDIA
Tel +91-80-5732296
[email protected]
1. INTRODUCTION Table
Selection Table Number
Compression technology has gained significance due to various Logic
reasons. A typical audio clip lasts for at least 3 minutes. This
would amount to a storage requirement of around 8-9MB for Table Number
PCM audio samples. VLSI technology is enabling faster DSPs
Table
Table
symbol selected
selected Encoded Bit-stream, symbol
Table Number
Huffman Encoder Huffman Decoder
miss Table4, Tabel5, Table6 and Table7 are converted Look-Up Tables
for 3-Level Look-Up Table method of Table3:
T3 T5
Note: Hit = 1 and Miss = 0
0 2 1 1 0 10 7 1
1 2 1 1 1 10 7 1
2 2 1 1 2 10 7 1
3 2 1 1 3 10 7 1
4 Table 5 3 0 4 27 9 1
5 5 3 1 5 31 9 1
6 4 2 1 6 17 8 1
7 4 2 1 7 17 8 1
0 1 {
0 1 symbol = symbol/offset[Address]
11
10 0 1 break
0 1 }
19 25
17 else
0 1 {
[M3] 3-Level
Look-Up Table 8*4*3 = 96 16
4. IMPLEMENTATION CONSIDERATION method
• For Huffman code tables having small maximum length [M4] 4-Level
the Look-Up Table Method is efficient both in terms of Look-Up Table 28*3 = 84 21
memory and speed. But, if maximum length is large, this method
implementation will require huge memory.
[M5] Binary
• On the other hand, Binary Tree Search Method is a Tree search 22*2 = 44 54
memory efficient method since it consumes least method
memory space. But, the speed will reduce by a factor of
maximum length of Huffman code. Note: Operations include extraction of bits, table look-up, pointer
arithmetic etc. Extraction of bits from the bit-stream is considered
• If both memory and speed is a concern, which is as a single operation.
generally a requirement, a combination of these two
methods can be employed after careful analysis of the
Huffman tables. In most of the tables, the code words
will be entered in the decreasing order of probability. If
that is not the case, it can be arranged so. This would
help in splitting of the tables appropriately in order to
combine the two methods to have fast decoding in most
of the cases and consuming less memory. In this case,
first search will be done on first part of the table using
Look-Up Table method. If there is a miss, the search
will be done in the second part of the table using Binary
Tree Search method.
• In the above method, if the sequence of code words is
such that very frequently the search visits second table
then there will be excessive overhead.
• N-Level Look-Up Table method is a compromise
between memory and speed. This method guarantees
sustained better performance relative to the combination
6. ACKNOWLEDGEMENT
My sincere thanks to Mr. Arun D. Naik without whose everlasting
of methods 1 and 3 in terms of speed. But the challenge
inspiration and valuable suggestions, this paper would not have
here is to arrive at the combination of optimum N-level
been possible. I want to express my gratitude to Mr. Madhu
and the number of bits (L1,L2,…) in each level. These
Parthasarathy for his constant encouragement and moral support. I
values have to be chosen after careful analysis of the
am deeply indebted to review team members and all my friends
tables to fit the decoding scheme within acceptable
for their valuable comments to improve this paper.
limits of memory and speed.
• In most of the applications, just one method for all 7. REFERENCE
tables may not provide required memory and speed.
[1] “Practical Huffman Coding” by Michael Schindler
Hence, different methods have to be judiciously chosen
for various Huffman tables. (www.compressconsult.com/huffman)