8#ifndef HPP_ALIB_BITBUFFER_AC_V1_HUFFMAN
9#define HPP_ALIB_BITBUFFER_AC_V1_HUFFMAN 1
11#if !defined (HPP_AWORX_ALIB_BITBUFFER)
15namespace alib {
namespace bitbuffer {
namespace ac_v1 {
107 NString256(
"Try to write symbol unknown to Huffman table: ")
108 << symbol <<
", " << bitsLeft )
111 "Try to write symbol unknown to Huffman table: ", symbol )
115 auto* word= rec.words;
194 if( node->
left ==
nullptr)
198 node= v ? node->
right
void Write(TIntegral value)
int npNext
The next node in nodePool to use.
BitReader & br
The bit reader given in the constructor.
static constexpr int MAX_NODES
The maximum number of nodes in the tree.
Node tree
The root node of the symbol tree.
Node nodePool[MAX_NODES]
Pre-allocated node objects.
HuffmanDecoder(BitReader &bitReader)
static constexpr int WORD_SIZE
Symbol symbols[256]
The symbol table.
void Write(uint8_t symbol)
static constexpr int MAX_CODE_LENGTH
static constexpr int MAX_WORDS
ALIB_FORCE_INLINE void CountSymbol(uint8_t symbol)
BitWriter & bw
The bit writer to use for encoding the data.
#define ALIB_WARNINGS_RESTORE
#define ALIB_FORCE_INLINE
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
NLocalString< 256 > NString256
Type alias name for TLocalString<nchar,256> .
int ShiftOpRHS
Type alias in namespace alib.
Node * right
The right child node.
Node * left
The left child node.
uint32_t words[MAX_WORDS]
The bitcode of the symbol.
alib::ShiftOpRHS wordLength
0: symbol not used, otherwise between 1 and 255.
std::size_t frequency
The number of occurrences of the symbol.