Arithmetic Coding Example
P(a) = 1/3, P(b) = 2/3
C(a) = 0, C(b) = 1/3
abba
symbol l r w output
0 1 1
a 0 1/3 1/3
0 2/3 2/3 0
b 2/9 6/9 4/9
b 10/27 18/27 8/27
a 30/81 46/81 16/81
.0101... .1001... 1
w := r - l;
l := l + w C(x);
r := l + w P(x)
Note: Code for abb is the same as that for abba. The decoder
knows the length to be able to distinguish.
Previous slide
Next slide
Back to first slide
View graphic version