<< histcalc Huffman Coding Toolbox huffdeco >>

Huffman Coding Toolbox >> Huffman Coding Toolbox > huffcode

huffcode

huffman coding of a sequence

Calling Sequence

[QT,QM]=huffcode(A)

Parameters

A:

vector representing a input sequence. A is converted in the function to type INT. The elements of A must be greater or equal 1.

QT:

A string containing 1s and 0s. QT represents the binary output sequence of the huffman coded signal. QT can be converted into a scalar vector with str2code.

QM:

the huffman code table, containg symbols, bit sequences and number of bits of a symbol

Description

The function converts the scalar input sequence (vector or matrix) into a compressed bit sequence. The bit sequence is represented by a string containing 1s and 0s.

huffcode requires the function "fasthist" and "huffman". The reverse operation is performed by the scilab function "huffdeco".

Examples

// Generate a Testmatrix
A=testmatrix('frk',10)+1;
A=A(:).';
[QT,QM]=huffcode(A);
disp('compressed Bit sequence:');
disp(QT);
disp('Code Table:');
disp(QM);

See also

Authors


Report an issue
<< histcalc Huffman Coding Toolbox huffdeco >>