module

Brotli::Huffman

Constants

REVERSE_BITS_LOWEST = 1_u64 << (REVERSE_BITS_MAX - 1)

Class methods

build_code_lengths_huffman_table(table : Slice(HuffmanCode), code_lengths : Slice(UInt8), count : Slice(UInt16)) : Nil

BrotliBuildCodeLengthsHuffmanTable: builds the table for the code length alphabet itself. code_lengths has CODE_LENGTH_CODES entries; count is the histogram (index 0 unused, 1..5 meaningful).

Source
build_huffman_table(root_table : Slice(HuffmanCode), root_bits : Int32, symbol_lists : Slice(UInt16), count : Slice(UInt16)) : UInt32

BrotliBuildHuffmanTable: returns size of resulting table. symbol_lists is indexed by (code_length - 16) like upstream; each entry is the next symbol of that length, 0xFFFF terminator.

Source
build_simple_huffman_table(table : Slice(HuffmanCode), root_bits : Int32, val : Slice(UInt16), num_symbols : UInt32) : UInt32

BrotliBuildSimpleHuffmanTable. num_symbols semantics (C comments): 0 => 1 symbol; 1 => 2; 2 => 3; 3 => 4 with lengths [2,2,2,2]; 4 => 4 with lengths [1,2,3,3]. val is modified (sorted) in place.

Source
reverse_bits(num : UInt64) : UInt64
Source