Ic23 Unit03 Script
Ic23 Unit03 Script
MI
A
1 2
Recently on Image Compression ... 3 4
5 6
7 8
What did we learn in the last learning unit? 9 10
For infinite size alphabets, we have several tools at our disposal. 11 12
13 14
Golomb coding can adapt to geometric distributions. 15 16
19 20
Questions: 21 22
23 24
For finite alphabets, Huffman Coding is still our best option. 25 26
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
41 42
43 44
Outline MI
A
1 2
Learning Unit 03: 3 4
Arithmetic Coding 5 6
7 8
9 10
11 12
13 14
15 16
Contents 17 18
1. Pure Zeroth-Order Arithmetic Encoding 19 20
21 22
2. Pure Zeroth-Order: Problems and Improvements 23 24
3. Pure Zeroth-Order Decoding 25 26
27 28
4. Integer Arithmetic Encoding 29 30
5. Integer Arithmetic Decoding 31 32
33 34
6. Integer Arithmetic Coding: Practical Issues 35 36
37 38
39 40
c 2023 Christian Schmaltz, Pascal Peter 41 42
43 44
Motivation MI
A
1 2
Motivation 3 4
5 6
Huffman coding is optimal, but it requires at least one bit for each symbol.
7 8
Extended Huffman coding resolves that, but creates overhead. 9 10
11 12
One would like to use a “fractional” amount of bits for each symbol.
13 14
Arithmetic coding 15 16
17 18
• does not have this restriction.
19 20
• can not be described by an encoding scheme 21 22
23 24
• replaces the complete source word by a single code word
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Pure Zeroth-Order Arithmetic Coding MI
A
1 2
Pure Zeroth-Order Arithmetic Coding 3 4
5 6
We start with Pure Zeroth-Order Arithmetic Coding:
7 8
• “Pure”: Practical problems are ignored for the moment. 9 10
11 12
• “Zeroth-Order”: Symbols are independent and identically distributed.
13 14
This algorithm is not used in practise, but shows the main ideas very well. 15 16
17 18
Note that it is not necessary to order the symbols by their probability.
19 20
All examples for Zeroth-Order Coding use the following symbols and probabilities: 21 22
23 24
25 26
27 28
i 1 2 3 4 29 30
31 32
si A D B C
33 34
pi 0.4 0.3 0.2 0.1 35 36
Occurring symbols and their probabilities. 37 38
39 40
41 42
43 44
7 8
• Assign each source word si1 · · · siN to an interval I(i1, . . . , iN ). 9 10
• Store each source word si1 · · · siN as a number r ∈ I(i1, . . . , iN ). 11 12
13 14
15 16
17 18
19 20
21 22
23 24
25 26
27 28
Open questions: 29 30
• Which intervals should be chosen? 31 32
33 34
• Which number r should be stored? 35 36
37 38
39 40
41 42
43 44
Arithmetic Coding: Idea MI
A
1 2
Illustration of Arithmetic Coding
3 4
1.0 0.70 0.520 0.5080 5 6
0.9 C 0.67 C 0.508 C 0.5056 C 7 8
9 10
B B B B
0.7 0.61 0.484 0.5008 11 12
13 14
D D D D 15 16
17 18
0.4 0.52 0.448 0.4936
19 20
21 22
A A A A
23 24
0.0 0.40 0.400 0.4840 25 26
27 28
Graphical illustration of encoding the word “DABD” with arithmetic coding: any 29 30
number in the interval [0.4936, 0.5008) can be used as code word. 31 32
33 34
35 36
37 38
39 40
41 42
43 44
7 8
Theoretically, any number r ∈ I(i1, . . . , iN ) can be used to encode the word 9 10
s i1 · · · s iN . 11 12
Since r is stored in binary representation, this representation must be finite, 13 14
though: 15 16
a 17 18
∃a ∈ Z, b ∈ N : r = b
2 19 20
Such numbers are called dyadic fractions or dyadic rationals. 21 22
b bits are necessary to store the number r. Thus, the smaller b, the better. 23 24
25 26
The smaller the intervals, the more digits are usually necessary to store r. Thus,
27 28
the intervals should be as large as possible. 29 30
31 32
33 34
Conclusion: Use the dyadic fraction with smallest denominator. 35 36
37 38
39 40
41 42
43 44
Pure Zeroth-Order Arithmetic Coding MI
A
1 2
Finding the Dyadic Fraction with Least Denominator
3 4
How to find the dyadic fraction with least denominator in the interval [α, β)? 5 6
7 8
Method I 9 10
11 12
1. Find the smallest integer t with 13 14
15 16
1 17 18
≤l ⇒ 2−t ≤ l < 2−t+1 19 20
2t
21 22
2. Find an integer y satisfying: 23 24
y 25 26
α≤ <β
2t 27 28
Remark: This inequality can have one or two solutions. If there are two solutions,
29 30
you must take the even one.
31 32
y
3. Reduce the fraction r = 2t
33 34
35 36
(The binary representation of y will be stored in pure arithmetic coding)
37 38
39 40
41 42
43 44
7 8
9 10
α = 0.4936, β = 0.5008, l = 0.0072
11 12
13 14
Computing t yields: 15 16
17 18
1
t = log2 = log2 138.8 = log2 256 = 8 19 20
l 21 22
23 24
Next, we solve the inequalities for y ∈ Z 25 26
27 28
y 29 30
α≤ <β
2t 31 32
y
⇔ 0.4936 ≤ < 0.5008 33 34
256
35 36
⇔ 126.3616 ≤ y < 128.2048 37 38
⇔ y ∈ {127, 128} 39 40
41 42
43 44
Pure Zeroth-Order Arithmetic Coding MI
A
1 2
Example (continued)
3 4
5 6
Since there are two solutions, we chose the even one:
7 8
9 10
y = 128
11 12
13 14
Next, we reduce the fraction: 15 16
17 18
y 128 1
r= = = = 0.12 19 20
2 t 256 2 21 22
23 24
Thus, the word “DABD” is encoded as 1.
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
7 8
Remedy: 9 10
11 12
Method II 13 14
15 16
Compute the binary expansions of α and β until they differ: 17 18
19 20
α =(0.a1 · · · at−10at+1 · · · )2 21 22
β =(0.a1 · · · at−11bt+1 · · · )2 23 24
25 26
27 28
The dyadic fraction with least denominator is then given by
29 30
31 32
r = 0.a1 · · · at−11
33 34
35 36
Careful: There are two exceptions (see next slide). 37 38
39 40
41 42
43 44
Pure Zeroth-Order Arithmetic Coding MI
A
1 2
Exception I: If α = (0.a1 · · · at−1)2, then r = α (since this is shorter than
3 4
(0.a1 · · · at−11)2).
5 6
Exception II: If α > (0.a1 · · · at−1)2 and β = (0.a1 · · · at−11)2, then 7 8
7 8
9 10
α = 0.4936, β = 0.5008, l = 0.0072
11 12
13 14
Since 15 16
17 18
α =0.01 . . . 19 20
β =0.10 . . . , β 6= 0.12 21 22
23 24
25 26
27 28
it follows that r = 0.12.
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Outline MI
A
1 2
Learning Unit 03: 3 4
Arithmetic Coding 5 6
7 8
9 10
11 12
13 14
15 16
Contents 17 18
1. Pure Zeroth-Order Arithmetic Encoding 19 20
21 22
2. Pure Zeroth-Order: Problems and Improvements 23 24
3. Pure Zeroth-Order Decoding 25 26
27 28
4. Integer Arithmetic Encoding 29 30
5. Integer Arithmetic Decoding 31 32
33 34
6. Integer Arithmetic Coding: Practical Issues 35 36
37 38
39 40
c 2023 Christian Schmaltz, Pascal Peter 41 42
43 44
11 12
word are known.
13 14
Solution: Shift out known bits and rescale: 15 16
17 18
If α < β ≤ 12 , then r < 1
= 0.12.
2 19 20
• Thus, the code starts with 0. 21 22
23 24
• We shift out this 0, resulting in the interval [2α, 2β).
25 26
1 1
If ≤ α < β, then r ≥ = 0.12. 27 28
2 2
37 38
In both cases, l is doubled.
39 40
Furthermore, this helps to prevent the interval [α, β) from getting very small. 41 42
43 44
Problems and Improvements MI
A
1 2
Example
3 4
next symbol α l new bits 5 6
or operation 7 8
0 1 9 10
B 0 + 0.7 · 1 = 0.7 1 · 0.2 = 0.2 11 12
x → 2x − 1 2 · 0.7 − 1 = 0.4 2 · 0.2 = 0.4 1 13 14
B 0.4 + 0.4 · 0.7 = 0.68 0.4 · 0.2 = 0.08 15 16
x → 2x − 1 2 · 0.68 − 1 = 0.36 2 · 0.08 = 0.16 1 17 18
C 0.36 + 0.9 · 0.16 = 0.504 0.16 · 0.1 = 0.016 19 20
21 22
x → 2x − 1 2 · 0.504 − 1 = 0.008 2 · 0.016 = 0.032 1
23 24
x → 2x 2 · 0.008 = 0.016 2 · 0.032 = 0.064 0
25 26
x → 2x 2 · 0.016 = 0.032 2 · 0.064 = 0.128 0
27 28
x → 2x 2 · 0.032 = 0.064 2 · 0.128 = 0.256 0
29 30
x → 2x 2 · 0.064 = 0.128 2 · 0.256 = 0.512 0 31 32
A 0.128 + 0 · 0.512 = 0.128 0.512 · 0.4 = 0.2048 33 34
x → 2x 2 · 0.128 = 0.256 2 · 0.2048 = 0.4096 0 35 36
1 37 38
Encoding of the word “BBCA” with rescaling. Since ∈ [0.256, 0.256 + 0.4096), the
2 39 40
encoded word is 111000001.
41 42
43 44
7 8
Answer: Yes, in special cases we can “look two bits into the future” and shift 9 10
4 2 4
15 16
Then, either 17 18
19 20
1 1 21 22
r0 ∈ α, ⇒ r0 = (0.01 . . .)2 since α ≥
2 4 23 24
25 26
or
0 1 0 3 27 28
r ∈ ,β ⇒ r = (0.10 . . .)2 since β ≤ 29 30
2 4
31 32
Thus, the first two bits always differ, i.e. if we know one, we know the other.
33 34
35 36
37 38
39 40
41 42
43 44
Problems and Improvements MI
A
1 2
Underflow Expansion
3 4
Thus, we can remove the second bit from α and β with the transformation: 5 6
7 8
1 9 10
x → 2x − 11 12
2
13 14
• If x = (0.01x3x4 . . .), then 2x − 12 = (0.0x3x4 . . .) 15 16
17 18
• If x = (0.10x3x4 . . .), then 2x − 21 = (0.1x3x4 . . .) 19 20
This transformation doubles the length of the interval [α, β). 21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Performance MI
A
1 2
Theorem
3 4
5 6
The average length of code words generated with arithmetic coding for source words 7 8
of length N is not greater than N H(S) + 1. 9 10
11 12
This means that H(S) + N1 bits are necessary on average to encode one symbol when 13 14
encoding a word of length N .
15 16
(No proof will be given, here) 17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
Conclusion: Pure arithmetic coding is optimal among lossless zeroth-order entropy 37 38
coding methods. 39 40
41 42
43 44
Outline MI
A
1 2
Learning Unit 03: 3 4
Arithmetic Coding 5 6
7 8
9 10
11 12
13 14
15 16
Contents 17 18
1. Pure Zeroth-Order Arithmetic Encoding 19 20
21 22
2. Pure Zeroth-Order: Problems and Improvements 23 24
3. Pure Zeroth-Order Decoding 25 26
27 28
4. Integer Arithmetic Encoding 29 30
5. Integer Arithmetic Decoding 31 32
33 34
6. Integer Arithmetic Coding: Practical Issues 35 36
37 38
39 40
c 2023 Christian Schmaltz, Pascal Peter 41 42
43 44
Decoding MI
A
1 2
Pure Zeroth-Order Decoding 3 4
5 6
To decode r, find the index i1 such that r ∈ I(i1), followed by i2 such that
7 8
r ∈ I(i1, i2), followed by i3 such that . . ..
9 10
11 12
Assumption: The decoder knows the length N of the original source word.
13 14
Details 15 16
17 18
Assume I(i1, . . . , ik ) := [α, α + l) has already been found. 19 20
21 22
Then, ik+1 with r ∈ I(i1, . . . , ik+1) satisfies
23 24
25 26
X X 27 28
α+ pi l ≤ r <α+ pi l
29 30
i<ik+1 i≤ik+1
31 32
X r−α X
⇔ pi ≤ < pi 33 34
i<ik+1
l 35 36
i≤ik+1
37 38
39 40
41 42
43 44
Decoding MI
A
1 2
Example
3 4
r−α 5 6
α l interval decoded symbol
l 7 8
0 1 0.5 0.5 ∈ [0.4, 0.7) D 9 10
0.4 0.3 0.3 0.3 ∈ [0.0, 0.4) A 11 12
(0 + 1 · 0.4) (1 · 0.3) ( 0.5−0.4 13 14
0.3 )
15 16
0.4 0.12 0.83 0.83 ∈ [0.7, 0.9) B
17 18
(0.4 + 0.3 · 0.0) (0.3 · 0.4) ( 0.5−0.4
0.12 )
19 20
0.484 0.024 0.6 0.6 ∈ [0.4, 0.7) D 21 22
(0.4 + 0.12 · 0.7) (0.12 · 0.2) ( 0.5−0.484
0.024 ) 23 24
25 26
Decoding the word 1 with N = 4 yields “DABD”. (Compare slides 4 and 19). 27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Decoding MI
A
1 2
Rescaling and Underflow Expansion While Decoding
3 4
The rescaling and underflow operations introduced for encoding are also possible 5 6
while decoding. 7 8
9 10
The prerequisites stay the same. 11 12
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Decoding MI
A
1 2
Example
3 4
r−α 5 6
α l r l symbol or operation
7 8
449 449
0 1 512 512 ≈ 0.88 B 9 10
449
0.7 0.2 512 – x → 2x − 1 11 12
193
193 −0.4 13 14
0.4 0.4 256
256
0.4 ≈ 0.88 B
15 16
193
0.68 0.08 256 – x → 2x − 1 17 18
65
0.36 0.16 128 – x → 2x − 12 19 20
33
33 −0.22 21 22
0.22 0.32 64
64
0.32 ≈ 0.92 C
33
23 24
0.508 0.032 64 – x → 2x − 1 25 26
1
0.016 0.064 32 – x → 2x 27 28
0.032 0.128 1
– x → 2x 29 30
16
0.064 0.256 1
– x → 2x 31 32
8
1 −0.128 33 34
1
0.128 0.512 4
4
0.512 ≈ 0.24 A 35 36
37 38
Decoding the code word 111000001 with N = 4 yields “BBCA”. (Compare slide 15). 39 40
41 42
43 44
13 14
Drawbacks 15 16
17 18
Pure arithmetic coding requires exact computations. 19 20
21 22
Run-time and memory requirements rise drastically with the source word length.
23 24
There are many patents which cover arithmetic coding (mostly IBM). 25 26
27 28
Those patents have (presumably) all expired now.
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Outline MI
A
1 2
Learning Unit 03: 3 4
Arithmetic Coding 5 6
7 8
9 10
11 12
13 14
15 16
Contents 17 18
1. Pure Zeroth-Order Arithmetic Encoding 19 20
21 22
2. Pure Zeroth-Order: Problems and Improvements 23 24
3. Pure Zeroth-Order Decoding 25 26
27 28
4. Integer Arithmetic Encoding 29 30
5. Integer Arithmetic Decoding 31 32
33 34
6. Integer Arithmetic Coding: Practical Issues 35 36
37 38
39 40
c 2023 Christian Schmaltz, Pascal Peter 41 42
43 44
7 8
Here, we introduce a method by Witten, Neal, and Cleary from 1987, 9 10
abbreviated as WNC-algorithm. 11 12
13 14
Idea: Replace the interval [0, 1) with some finite set {0, . . . , M − 1} and
15 16
perform only integer operations.
17 18
This way, pure arithmetic coding is approximated. 19 20
21 22
Remark: Note that the WNC-algorithm includes EOF as an additional symbol.
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Integer Arithmetic Coding MI
A
1 2
Intuition Behind the Choice of M
3 4
For the sake of simplicity, M is chosen to be a multiple of 4. 5 6
7 8
The larger M . . . 9 10
• the more accurate the approximation will be, i.e. the better the compression 11 12
ratio. 13 14
15 16
• the slower and more memory consuming the algorithm will be. 17 18
For A, B ∈ N, A < B, we will write sets of the form 19 20
21 22
{A, A + 1, . . . , B − 2, B − 1} = [A, B) ∩ N 23 24
25 26
27 28
as [A, B) to simplify the notation.
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
by v. Remove v from r. 13 14
When rescaling or applying underflow expansion, remove the first bit b from r 15 16
and update v: v → v + b. 17 18
19 20
Whenever a symbol is to be decoded, there is no general formula how to find the
21 22
correct interval:
j k 23 24
r−α v−L 25 26
• Emulating l from the pure decoding by H−L does not work in general.
27 28
• We deal with this problem in the last part of the learning unit (slide 40). 29 30
In the following example, we compute all intervals for all symbol to be decoded. 31 32
33 34
35 36
37 38
39 40
41 42
43 44
Integer Arithmetic Coding MI
A
1 2
Example
3 4
v L H [LA, HA) [LB , HB ) [LEOF, HEOF) symbol 5 6
or operation 7 8
(0110)2 = 6 0 16 [0,9) [9,14) [14,16) A 9 10
(0110)2 = 6 0 9 [0,5) [5,8) [8,9) B 11 12
(0110)2 = 6 5 8 x → 2x 13 14
(1101)2 =13 10 16 x → 2x − 16 15 16
(1010)2 =10 4 16 [4,11) [11,14) [14,16) A 17 18
(1010)2 =10 4 11 x → 2x − 8 19 20
21 22
(1100)2 =12 0 14 [0,8) [8,12) [12,14) EOF
23 24
Decoding the code word “01101001” with M = 16, pA = 0.6, pB = 0.3, pEOF = 0.1. 25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Outline MI
A
1 2
Learning Unit 03: 3 4
Arithmetic Coding 5 6
7 8
9 10
11 12
13 14
15 16
Contents 17 18
1. Pure Zeroth-Order Arithmetic Encoding 19 20
21 22
2. Pure Zeroth-Order: Problems and Improvements 23 24
3. Pure Zeroth-Order Decoding 25 26
27 28
4. Integer Arithmetic Encoding 29 30
5. Integer Arithmetic Decoding 31 32
33 34
6. Integer Arithmetic Coding: Practical Issues 35 36
37 38
39 40
c 2023 Christian Schmaltz, Pascal Peter 41 42
43 44
Integer Arithmetic Coding MI
A
1 2
Possible Problems and Solutions 3 4
5 6
Problem: An empty interval might occur.
7 8
Solution: This can be prevented by choosing M appropriately: 9 10
11 12
Where do we modify intervals? 13 14
15 16
Initial interval [0, M ) is non-empty for M ≥ 1. 17 18
19 20
Underflow expansion:
21 22
• For [L, H) → [2L − M M
2 , 2H − 2 ) 23 24
25 26
• Not an issue if L 6= H, independently of choice of M .
27 28
Rescaling: 29 30
7 8
9 10
Xi−1 Xi
11 12
[L, H) → L + pj (H − L) , L + pj (H − L)
j=1 j=1 13 14
15 16
17 18
Could be problematic due to floor function:
19 20
21 22
Xi−1 X i
23 24
pj (H − L) = pj (H − L)
25 26
j=1 j=1
27 28
29 30
No problem for: pi(H − L) ≥ 1
31 32
We have pi ≥ pmin = minj pj , but what can we say about H − L? 33 34
M M
35 36
• after rescaling: L < 2 and H > 2 37 38
• after underflow expansion: L < M
or H > 34 M . 39 40
4
41 42
43 44
Integer Arithmetic Coding MI
A
M M
1 2
Case 1: L < 4 ,H > 2:
3 4
5 6
M M 1 7 8
H −L> − = M
2 4 4 9 10
11 12
M
Case 2: L < 2 ,H > 34 M : 13 14
15 16
3 M 1 17 18
H −L> M − = M
4 2 4 19 20
21 22
Thus, we always have 23 24
M
pi(H − L) > pmin 25 26
4 27 28
And with 29 30
M 4
pmin >1 ⇔ M> 31 32
4 p min
33 34
we obtain a lower bound for M that guarantees no empty intervals. 35 36
37 38
39 40
41 42
43 44
3 4
5 6
Theorem
7 8
For a source alphabet S = {s1, . . . , sm} whose symbols appear with probabilities 9 10
p1, . . . pm, no empty interval appears in the WNC algorithm if 11 12
13 14
• M is divisible by 4
15 16
17 18
and
19 20
• 21 22
4
M≥ − 8, where pmin = min pi 23 24
pmin i
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Integer Arithmetic Coding MI
A
1 2
Possible Problems and Solutions
3 4
Problem: It can happen that a new bit is necessary due to a rescaling or 5 6
underflow expansion even if the complete code word has already been used. 7 8
9 10
Solution: Any bit can be used in this situation. 11 12
11 12
However, we might need more bits than have actually been written. 13 14
15 16
This is fine if the file ends early, but not if more data follows!
17 18
19 20
Solutions:
21 22
Write more bits during encoding or add arbitrary bits if end of file was reached.
23 24
How to find out how many bits we should write in addition? 25 26
Consider how decoding would work, count excess number of bits needed. 27 28
29 30
cost additional bits, but no EOF symbol required if source word length known 31 32
33 34
35 36
37 38
39 40
41 42
43 44
Integer Arithmetic Coding MI
A
1 2
Approximating Probabilities
3 4
In practice, the probabilities pi are estimated, i.e. they have the form 5 6
7 8
ci 9 10
pi = ci ∈ N0,
C 11 12
13 14
where m 15 16
X
cj = C and 17 18
j=1 19 20
Pi−1 21 22
Similar to the definition of Pi := j=1 pj in Shannon’s method, we can define
23 24
Ci as 25 26
i
X
Ci = cj 27 28
j=1 29 30
with C0 = 0. 31 32
Ci
33 34
Obviously, Cm = C, and = Pi+1.
C 35 36
37 38
39 40
41 42
43 44
7 8
jP k jP k 9 10
i−1 i
L+ j=1 pj (H − L) ≤ v < L+ j=1 pj (H − L) 11 12
jC k j k 13 14
i−1 Ci
⇒ C (H − L) ≤ v−L < C (H − L) 15 16
j k
⇒
Ci−1 Ci 17 18
C (H − L) < v−L+1 ≤ C (H − L)
19 20
⇒ Ci−1(H − L) < (v − L + 1)C ≤ Ci(H − L) 21 22
23 24
⇒ Ci−1(H − L) ≤ (v − L + 1)C − 1 < Ci(H − L)
25 26
j k
⇒ Ci−1 ≤ w := (v−L+1)C−1 < Ci
27 28
H−L
29 30
31 32
Conclusion: w can be used to find the interval containing the next symbol to be 33 34
decoded. 35 36
37 38
39 40
41 42
43 44
Integer Arithmetic Coding MI
A
1 2
Example
3 4
j k 5 6
(v−L+1)C−1
v L H w= H−L symbol 7 8
or operation 9 10
j k 69
(6−0+1)10−1 11 12
(0110)2 = 6 0 16 16−0 = 16 = 4 ∈ [0, 6) A
j k 13 14
69
(0110)2 = 6 0 9 (6−0+1)10−1
= = 7 ∈ [6, 9) B 15 16
9−0 9
17 18
(0110)2 = 6 5 8 x → 2x 19 20
21 22
(1101)2 =13 10 16 x → 2x − 16 23 24
j k 69
(10−4+1)10−1 25 26
(1010)2 =10 4 16 16−4 = 12 = 5 ∈ [0, 6) A
27 28
(1010)2 =10 4 11 x → 2x − 8 29 30
j k 129 31 32
(12−0+1)10−1
(1100)2 =12 0 14 14−0 = 14 = 9 ∈ [9, 10) EOF 33 34
35 36
Decoding the code word “01101001” with M = 16, C1 = 6, C2 = 9, C3 = C = 10 37 38
(compare slide 30). 39 40
41 42
43 44
coding. 15 16
17 18
19 20
21 22
23 24
25 26
27 28
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44
Summary MI
A
1 2
Summary 3 4
5 6
Arithmetic coding can outperform any encoding scheme by:
7 8
• Encoding function maps the source word directly to a binary code. 9 10
11 12
• This is achieved by subdividing intervals proportionally to probabilities.
13 14
• Represent interval by dyadic fraction with shortest binary representation. 15 16
17 18
Rescaling and underflow expansions keep the interval size large.
19 20
Integer arithmetic coding approximates pure zeroth order coding. 21 22
23 24
25 26
Outlook 27 28
29 30
Can we reduce overhead generated by the methods introduced so far?
31 32
What should we do if we do not know probabilities a priori? 33 34
35 36
37 38
39 40
41 42
43 44
References MI
A
1 2
References
3 4
C. E. Shannon and W. Weaver. The mathematical theory of communication. 5 6
25 26
Series. Prentice Hall, Englewood Cliffs, 1990.
27 28
(Yet another detailed introduction to arithmetic coding.)
29 30
31 32
33 34
35 36
37 38
39 40
41 42
43 44