Communications Toolbox    

Arithmetic Coding

Arithmetic coding offers a way to compress data and can be useful for data sources having a small alphabet. The length of an arithmetic code, instead of being fixed relative to the number of symbols being encoded, depends on the statistical frequency with which the source produces each symbol from its alphabet.

The arithenco and arithdeco functions support arithmetic coding and decoding.

Representing Arithmetic Coding Parameters

Arithmetic coding requires statistical information about the source of the data being encoded. In particular, the counts input argument in the arithenco and arithdeco functions lists the frequency with which the source produces each symbol in its alphabet. You can determine the frequencies by studying a set of test data from the source. The set of test data can have any size you choose, as long as each symbol in the alphabet has a nonzero frequency.

For example, before encoding data from a source that produces 10 x's, 10 y's, and 80 z's in a typical 100-symbol set of test data, define

Alternatively, if a larger set of test data from the source contains 22 x's, 23 y's, and 185 z's, then define

Example: Creating and Decoding an Arithmetic Code

The example below performs arithmetic encoding and decoding, using a source whose alphabet has three symbols.


  Companding a Signal Selected Bibliography for Source Coding