API Documentation
HuffmanLut.h
1 // HuffmanLut.h
3 //
5 
6 namespace nkMemory
7 {
11  struct HuffmanTreeDescriptor final
12  {
14  unsigned char _perBitsCounts [16] = {0u} ;
15  } ;
16 
20  struct HuffmanSymbol final
21  {
22  unsigned short _size = 0 ;
23  unsigned short _value = 0 ;
24  } ;
25 }
26 
27 namespace nkMemory
28 {
59  class HuffmanLut
60  {
61  public :
62 
63  // Constructor, destructor
86  HuffmanLut (const HuffmanTreeDescriptor& descriptor) noexcept ;
99  HuffmanLut (nkMemory::BufferView<unsigned short> canonicalDescription) noexcept ;
100 
101  // Getters
116  HuffmanSymbol get (unsigned int input) const ;
120  unsigned int getLutSize () const ;
124  unsigned int getMaxSymbolSize () const ;
125  } ;
126 }
nkMemory::HuffmanLut::HuffmanLut
HuffmanLut(const HuffmanTreeDescriptor &descriptor) noexcept
nkMemory::HuffmanLut::getLutSize
unsigned int getLutSize() const
nkMemory::HuffmanLut::getMaxSymbolSize
unsigned int getMaxSymbolSize() const
nkMemory::HuffmanLut::getLut
BufferView< HuffmanSymbol > getLut() const
nkMemory::HuffmanTreeDescriptor::_table
BufferCast< unsigned short > _table
The table of symbols to encode into the LUT.
Definition: HuffmanLut.h:13
nkMemory::BufferView
A view over data.
Definition: BufferView.h:18
nkMemory::HuffmanTreeDescriptor::_perBitsCounts
unsigned char _perBitsCounts[16]
The number of symbols assigned to each bit count code in the dictionary.
Definition: HuffmanLut.h:14
nkMemory::HuffmanLut::get
HuffmanSymbol get(unsigned int input) const
nkMemory::HuffmanSymbol::_value
unsigned short _value
Its symbol value, attached to the code used for looking up.
Definition: HuffmanLut.h:23
nkMemory::HuffmanTreeDescriptor
Descriptor for a Huffman LUT creation.
Definition: HuffmanLut.h:12
nkMemory::HuffmanLut::HuffmanLut
HuffmanLut(nkMemory::BufferView< unsigned short > canonicalDescription) noexcept
nkMemory::BufferCast< unsigned short >
nkMemory::HuffmanSymbol::_size
unsigned short _size
Its code size, in bits.
Definition: HuffmanLut.h:22
nkMemory::HuffmanSymbol
Holds a symbol's information within the Huffman LUT.
Definition: HuffmanLut.h:21
nkMemory::HuffmanLut
Allows to create a Look-Up-Table (LUT) of a Huffman tree.
Definition: HuffmanLut.h:60
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7