25 #ifndef COMMON_HUFFMAN_H 26 #define COMMON_HUFFMAN_H 92 #endif // COMMON_HUFFMAN_H void setSymbols(const uint32 *symbols=0)
Modify the codes' symbols.
Symbol(uint32 c, uint32 s)
std::list< Symbol > CodeList
const uint8 * lengths
The lengths of the individual codes.
uint32 getSymbol(BitStream &bits) const
Return the next symbol in the bitstream.
uint8 maxLength
Maximal code length. If 0, it's searched for.
Huffman(uint8 maxLength, size_t codeCount, const uint32 *codes, const uint8 *lengths, const uint32 *symbols=0)
Construct a Huffman decoder.
Decode a Huffman'd bitstream.
std::vector< Symbol * > SymbolList
Low-level type definitions to handle fixed width types portably.
SymbolList _symbols
Sorted list of pointers to the symbols.
const uint32 * symbols
The symbols, 0 if identical to the codes.
CodeLists _codes
Lists of codes and their symbols, sorted by code length.
size_t codeCount
Number of codes.
const uint32 * codes
The actual codes.
void init(uint8 maxLength, size_t codeCount, const uint32 *codes, const uint8 *lengths, const uint32 *symbols)
std::vector< CodeList > CodeLists