xoreos
0.0.5
|
Decode a Huffman'd bitstream. More...
#include <huffman.h>
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< Symbol > | CodeList |
typedef std::vector< CodeList > | CodeLists |
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... | |
|
private |
|
private |
|
private |
Common::Huffman::Huffman | ( | uint8 | maxLength, |
size_t | codeCount, | ||
const uint32 * | codes, | ||
const uint8 * | lengths, | ||
const uint32 * | symbols = 0 |
||
) |
Construct a Huffman decoder.
maxLength | Maximal code length. If 0, it's searched for. |
codeCount | Number of codes. |
codes | The actual codes. |
lengths | Lengths of the individual codes. |
symbols | The symbols. If 0, assume they are identical to the code indices. |
Definition at line 42 of file huffman.cpp.
References init().
Common::Huffman::Huffman | ( | const HuffmanTable & | table | ) |
Definition at line 38 of file huffman.cpp.
References Common::HuffmanTable::codeCount, Common::HuffmanTable::codes, init(), Common::HuffmanTable::lengths, Common::HuffmanTable::maxLength, and Common::HuffmanTable::symbols.
Common::Huffman::~Huffman | ( | ) |
Definition at line 77 of file huffman.cpp.
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().
void Common::Huffman::setSymbols | ( | const uint32 * | symbols = 0 | ) |
|
private |
Lists of codes and their symbols, sorted by code length.
Definition at line 81 of file huffman.h.
Referenced by getSymbol(), and init().
|
private |
Sorted list of pointers to the symbols.
Definition at line 84 of file huffman.h.
Referenced by init(), and setSymbols().