xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Common::Huffman Class Reference

Decode a Huffman'd bitstream. More...

#include <huffman.h>

Collaboration diagram for Common::Huffman:
Collaboration graph
[legend]

Classes

struct  Symbol
 

Public Member Functions

 Huffman (uint8 maxLength, size_t codeCount, const uint32 *codes, const uint8 *lengths, const uint32 *symbols=0)
 Construct a Huffman decoder. More...
 
 Huffman (const HuffmanTable &table)
 
 ~Huffman ()
 
void setSymbols (const uint32 *symbols=0)
 Modify the codes' symbols. More...
 
uint32 getSymbol (BitStream &bits) const
 Return the next symbol in the bitstream. More...
 

Private Types

typedef std::list< SymbolCodeList
 
typedef std::vector< CodeListCodeLists
 
typedef std::vector< Symbol * > SymbolList
 

Private Member Functions

void init (uint8 maxLength, size_t codeCount, const uint32 *codes, const uint8 *lengths, const uint32 *symbols)
 

Private Attributes

CodeLists _codes
 Lists of codes and their symbols, sorted by code length. More...
 
SymbolList _symbols
 Sorted list of pointers to the symbols. More...
 

Detailed Description

Decode a Huffman'd bitstream.

Definition at line 47 of file huffman.h.

Member Typedef Documentation

◆ CodeList

typedef std::list<Symbol> Common::Huffman::CodeList
private

Definition at line 76 of file huffman.h.

◆ CodeLists

typedef std::vector<CodeList> Common::Huffman::CodeLists
private

Definition at line 77 of file huffman.h.

◆ SymbolList

typedef std::vector<Symbol *> Common::Huffman::SymbolList
private

Definition at line 78 of file huffman.h.

Constructor & Destructor Documentation

◆ Huffman() [1/2]

Common::Huffman::Huffman ( uint8  maxLength,
size_t  codeCount,
const uint32 codes,
const uint8 lengths,
const uint32 symbols = 0 
)

Construct a Huffman decoder.

Parameters
maxLengthMaximal code length. If 0, it's 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.

Definition at line 42 of file huffman.cpp.

References init().

Here is the call graph for this function:

◆ Huffman() [2/2]

Common::Huffman::Huffman ( const HuffmanTable table)

◆ ~Huffman()

Common::Huffman::~Huffman ( )

Definition at line 77 of file huffman.cpp.

Member Function Documentation

◆ getSymbol()

uint32 Common::Huffman::getSymbol ( BitStream bits) const

Return the next symbol in the bitstream.

Definition at line 85 of file huffman.cpp.

References _codes, and Common::BitStream::addBit().

Referenced by Video::XMVWMV2Codec::decodeIBlock(), and Sound::WMACodec::decodeRunLevel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ init()

void Common::Huffman::init ( uint8  maxLength,
size_t  codeCount,
const uint32 codes,
const uint8 lengths,
const uint32 symbols 
)
private

Definition at line 48 of file huffman.cpp.

References _codes, _symbols, and MAX().

Referenced by Huffman().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setSymbols()

void Common::Huffman::setSymbols ( const uint32 symbols = 0)

Modify the codes' symbols.

Definition at line 80 of file huffman.cpp.

References _symbols.

Member Data Documentation

◆ _codes

CodeLists Common::Huffman::_codes
private

Lists of codes and their symbols, sorted by code length.

Definition at line 81 of file huffman.h.

Referenced by getSymbol(), and init().

◆ _symbols

SymbolList Common::Huffman::_symbols
private

Sorted list of pointers to the symbols.

Definition at line 84 of file huffman.h.

Referenced by init(), and setSymbols().


The documentation for this class was generated from the following files: