Arithmetic coding

Vicente González Ruiz

December 14, 2022

Contents

 1 Basics
 2 An ideal encoder
  2.1 Example
 3 An ideal decoder
 4 Incremental transmission
 References

1 Basics

2 An ideal encoder

  1. Let \([L,H)\leftarrow [0.0,1.0)\) an interval of real numbers.
  2. While the input is not exhausted:

    1. Split \([L,H)\) into so many sub-intervals as different symbols are in the alphabet. The size of each sub-interval is proportional to the probability of the corresponding symbol.
    2. Select the sub-interval \([L',H')\) associated with the encoded symbol.
    3. \([L,H)\leftarrow [L',H')\).
  3. Output a real number \(x\in [L,H)\) (the arithmetic code-stream). The number of decimals of \(x\) should be large enough to distinguish the final sub-interval \([L,H)\) from the rest of possibilities.

2.1 Example

3 An ideal decoder

  1. Let \([L,H)\leftarrow [0.0,1.0)\) the initial interval.
  2. While the input is not exhausted:

    1. Split \([L,H)\) in so many sub-intervals as different symbols are in the alphabet. The size of each sub-interval is proportional to the probability of the corresponding symbol.
    2. Input so many bits of \(x\) as they are needed to:

      1. Select the sub-interval \([L',H')\) that contains \(x\).
      2. Output the symbol that \([L',H')\) represents.
      3. \([L,H)\leftarrow [L',H')\).

4 Incremental transmission

[1]   Nelson M. and Gailly J. The Data Compression Book. M&T Books, 1996.

[2]   Jorma Rissanen and Glen G. Langdon. Arithmetic coding. IBM Journal of research and development, 23(2):149–162, 1979.

[3]   Ian H Witten, Radford M Neal, and John G Cleary. Arithmetic coding for data compression. Communications of the ACM, 30(6):520–540, 1987.