Professional Documents
Culture Documents
Lect7 Compress2
Lect7 Compress2
Lect7 Compress2
P(B) = 0.51
P(CE) = 0.20
P(DA) = 0.29
0 1
P(CE) = 0.20
P(DA) = 0.29
0 1
0 1
0 1
P(CE) = 0.20
P(DA) = 0.29
0 1
0 1
B 0.30
C 0.12
D 0.15
E 0.18
Characteristics of Solution
Symbol (S) Code
A 01
B 11
C 100
D 101
E 00
B 11
C 100
Decode “0101100”
D 101
E 00
H = 2.24 bits
Average Codeword Length
N
L p ( si )codelength( si ) Symbol P(S) Code
i 1 A 0.25 01
= .25(2) + B 0.30 11
.30(2) + C 0.12 100
.12(3) +
.15(3) + D 0.15 101
.18(2) E 0.18 00
L = 2.27 bits
Code Length Relative to
Entropy
N N
L p ( si )codelength( si ) H p ( si ) log 2 p( si )
i 1 i 1
= .08 B 0.99 0
L = .01(1) +
.99(1)
=1
C 0.4
Compute average
D 0.2
code length
E 0.1
Code “BCCADE”
B 1 P(B) = 0.51
B 01 P(B) = 1/3
C 011 P( C) = 0.09
C 001 P(C ) = 1/6
RLE, Huffman
Arithmetic
Coding
CS 414 - Spring 2011
Picture Preparation
Generation of appropriate digital
representation
Image division into 8x8 blocks
Fix number of bits per pixel (first level
quantization – mapping from real numbers
to bit representation)
Sun (.au)
Apple (.aif)
Microsoft (.wav)
B 0.2 110
Build Huffman tree
C 0.4 0
Compute code length D 0.2 111
L = 2.2 bits
E 0.1 101