ScummVM API documentation
Huffman bit stream decoding

Description

API for operations related to Huffman bit stream decoding.

Used in engines:

Classes

class  Common::Huffman< BITSTREAM >
 

Functions

uint32 Common::REVERSEBITS (uint32 x)
 
static Huffman Common::Huffman< BITSTREAM >::fromFrequencies (std::initializer_list< uint32 > freqs)
 
static Huffman Common::Huffman< BITSTREAM >::fromFrequencies (uint32 freqCount, const uint32 *freq, const uint32 *symbols)
 
 Common::Huffman< BITSTREAM >::Huffman (uint8 maxLength, uint32 codeCount, const uint32 *codes, const uint8 *lengths, const uint32 *symbols=nullptr)
 
uint32 Common::Huffman< BITSTREAM >::getSymbol (BITSTREAM &bits) const
 

Function Documentation

◆ fromFrequencies() [1/2]

template<class BITSTREAM >
Huffman< BITSTREAM > Common::Huffman< BITSTREAM >::fromFrequencies ( std::initializer_list< uint32 >  freqs)
static

Construct Huffman decoder from the symbol frequencies using canonical huffman algorithm. Symbols added for each non-zero frequency in the list

Parameters
freqsFrequencies,

◆ fromFrequencies() [2/2]

template<class BITSTREAM >
Huffman< BITSTREAM > Common::Huffman< BITSTREAM >::fromFrequencies ( uint32  freqCount,
const uint32 *  freq,
const uint32 *  symbols 
)
static

Construct Huffman decoder from the symbol frequencies using canonical huffman algorithm.

Parameters
freqCountNumber of frequencies.
freqFrequencies.
symbolsSymbols.

◆ Huffman()

template<class BITSTREAM >
Common::Huffman< BITSTREAM >::Huffman ( uint8  maxLength,
uint32  codeCount,
const uint32 *  codes,
const uint8 *  lengths,
const uint32 *  symbols = nullptr 
)

Construct a Huffman decoder.

Parameters
maxLengthMaximal code length. If 0, it is searched for.
codeCountNumber of codes.
codesThe actual codes.
lengthsLengths of the individual codes.
symbolsThe symbols. If 0, assume they are identical to the code indices.

◆ getSymbol()

template<class BITSTREAM >
uint32 Common::Huffman< BITSTREAM >::getSymbol ( BITSTREAM &  bits) const

Return the next symbol in the bit stream.