









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An in-depth exploration of compression techniques, focusing on huffman codes. Learn about the benefits of compression, sources of compressibility, types of compression, and the effectiveness of lossless and lossy compression. Discover the principles of huffman coding and its advantages over other methods.
Typology: Study notes
1 / 16
This page cannot be seen from the preview
Don't miss anything!










1
2
Sources Types Effectiveness
Huffman tree (encoding) Decoding
3
Compression
(number of bits needed to represent data)
Reduce transmission cost / latency / bandwidth
4
Compression Examples
Audio^ .jpg, .gif Video^ .wav (CD), .mp3, .wma, .aac General^ mpeg1 (LD,VCD), mpeg2 (DVD), mpeg4 (Divx) .zip, .gz
7
Effectiveness of Compression
2 bits / byte 8 bits / byte โโ ยผ original sizeno compression Percentage 75% compression โ ยผ original size
8
Effectiveness of Compression
Organized data^ Example: 1001110100 โ easy^ โ^? Example: 1111111111 โ 1 ร 10
9
Effectiveness of Compression
Reduce size 1 bit Example โ can only store ยฝ of data If compression is always possible (alternative view)^ 000, 001, 010, 011, 100, 101, 110, 111^ โ^ 00, 01, 10, 11 Compress file (reduce size by 1 bit) Recompress output Repeat (until we can store data with 0 bits)
10
Lossless Compression Techniques
Replace patterns with index into dictionary
13
Huffman Code Data Structures
Edge Leaf โ โ symbol code (0 or 1) Path to leaf Example โ encoding A = โ11โ, H = โ10โ, C = โ0โ
14
Huffman Code Algorithm Overview
Create binary tree representing โbestโ encoding Use binary tree to encode compressed file For each symbol, output path from root to leaf Size of encoding = length of path Save binary tree
15
Huffman Code โ Creating Tree
Select two trees L and R (initially leafs)^ Weight of leaf = symbol frequency Create new (internal) node^ Such that L, R have lowest frequencies in tree Left child Right child โ โ L R Repeat until all nodes merged into one tree^ New frequency^ โ^ frequency( L ) + frequency( R )
16
Huffman Tree Construction 1
3 5 8 2 7
19
Huffman Tree Construction 4
3 5
20
Huffman Tree Construction 5
3 5 8
EI == (^0100) CA == (^10111) H = 110
21
Huffman Coding Example
EI == (^0100) C = 10 AH == (^111110)
22
Huffman Code Algorithm Overview
Use binary tree to decode file Follow path from root to leaf
25
Huffman Decoding 3
3 5 8
1111001 A
26
Huffman Decoding 4
3 5 8
1111001 A
27
Huffman Decoding 5
3 5 8
1111001 AC
28
Huffman Decoding 6
3 5 8
1111001 AC
31
Huffman Code Properties
Combines 2 trees with lowest frequency
Based on statistical frequency