This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

arithdeco

Decode binary code using arithmetic decoding

Syntax

dseq = arithdeco(code,counts,len)

Description

dseq = arithdeco(code,counts,len) decodes the binary arithmetic code in the vector code to recover the corresponding sequence of len symbols. The vector counts represents the source's statistics by listing the number of times each symbol of the source's alphabet occurs in a test data set. This function assumes that the data in code was produced by the arithenco function.

Examples

collapse all

Set the counts vector so that a one occurs 99% of the time.

counts = [99 1];

Set the sequence length to 1000. Generate a random sequence.

len = 1000;
seq = randsrc(1,len,[1 2; .99 .01]);

Arithmetically encode the random sequence then, decode the encoded sequence.

code = arithenco(seq,counts);
dseq = arithdeco(code,counts,length(seq));

Verify that the decoded sequence matches the original sequence.

isequal(seq,dseq)
ans = logical
   1

Algorithms

This function uses the algorithm described in [1].

References

[1] Sayood, Khalid, Introduction to Data Compression, San Francisco, Morgan Kaufmann, 2000.

Introduced before R2006a