Professional Documents
Culture Documents
Lesson - Huffman and Entropy Coding
Lesson - Huffman and Entropy Coding
Note:
Fixed-length encoding
ASCII, Unicode
e,3 d,2 u,2 l,2 sp,2 k,1 b,1 v,1 i,1 s,1
Huffman Coding (Cont.)
We then pick the nodes with the smallest frequency and combine
them together to form a new node.
– The selection of these nodes is the Greedy part
The two selected nodes are removed from the set, but replace by the
combined node.
This continues until we have only 1 node left in the set.
Huffman Coding (Cont.)
e,3 d,2 u,2 l,2 sp,2 k,1 b,1 v,1 i,1 s,1
Huffman Coding (Cont.)
i,1 s,1
Huffman Coding (Cont.)
b,1 v,1
Huffman Coding (Cont.)
b,1 v,1
Huffman Coding (Cont.)
e,3 4 4 3 2
b,1 v,1
Huffman Coding (Cont.)
e,3 4 4 5
b,1 v,1
Huffman Coding (Cont.)
7 4 5
b,1 v,1
Huffman Coding (Cont.)
7 9
e,3 4 4 5
b,1 v,1
Huffman Coding (Cont.)
16
7 9
e,3 4 4 5
b,1 v,1
Huffman Coding (Cont.)
16
e 00
7 9
d 010
u 011
e,3 4 4 5
l 100
sp 101
d,2 u,2 l,2 sp,2 2 3
i 1100
i,1 s,1 k,1 2 s 1101
k 1110
b,1 v,1 b 11110
v 11111
Huffman Coding (Cont.)
Codes /
Code words Decoder
(decompression)
Output
Data
Compression Techniques
Entropy Coding
– Semantics of the information to encoded are ignored
– Lossless compression technique
– Can be used for different media regardless of their characteristics
Source Coding
– Takes into account the semantics of the information to be encoded.
– Often lossy compression technique
– Characteristics of medium are exploited
Hybrid Coding
– Most multimedia compression algorithms are hybrid techniques
Entropy Encoding
n n
1
H ( S ) pi log 2 pi log 2 pi
i 1 pi i 1