|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
One-pass adaptive Huffman coding of bytes using FGK updates. More...
#include <climits>#include <cstddef>#include <cstdint>#include <limits>#include <string>#include <string_view>#include <ah-errors.H>#include <bitArray.H>Go to the source code of this file.
Classes | |
| struct | Aleph::adaptive_huffman_detail::Model |
| struct | Aleph::adaptive_huffman_detail::Model::Node |
| class | Aleph::Adaptive_Huffman_Encoder |
| Stateful, one-pass FGK Huffman encoder for binary byte strings. More... | |
| class | Aleph::Adaptive_Huffman_Decoder |
| Incremental FGK decoder accepting arbitrarily fragmented bits. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::adaptive_huffman_detail |
One-pass adaptive Huffman coding of bytes using FGK updates.
Encoder and decoder start with a single NYT (not yet transmitted) leaf. An unseen byte is represented by the current NYT path followed by its eight bits, most significant bit first. A known byte uses its current leaf path. Left edges are 0 and right edges are 1. Both sides update the tree after each complete byte using the Faller-Gallager-Knuth rule. The NYT leaf is retained even after all 256 bytes have appeared.
There is no tree header, end marker, padding, or checksum. The caller must preserve the exact bit count (for example with BitArray::save()/load()) or frame the transmission separately. finish() detects a partial final codeword; it cannot detect missing complete codewords or arbitrary bit corruption. This format is independent of the static codec in Huffman.H.
Definition in file Adaptive_Huffman.H.