Home /Modules/compression/HUFFMAN.md

HUFFMAN.md

compression/compressors/huffman/HUFFMAN.md · 36 line(s) · markdown

Canonical Huffman

Algorithm id: SLEELA_COMPRESSION_HUFFMAN · State: Native · Extensions: .huff · MIME: application/x-huffman

Static canonical Huffman coding. The encoder counts symbol frequencies, builds a Huffman tree, caps code lengths at 32 bits, and emits an MSB-first bitstream behind a self-describing header:

magic    "SHF1"        (4 bytes)
orig_len u64 LE        (8 bytes)
lengths  256 bytes     (code length per symbol; 0 = absent)
payload  canonical-Huffman bitstream of orig_len symbols

The decoder rebuilds the identical canonical codes from the stored length table alone, so the codes themselves are never transmitted.

Files

FileLanguageRole
huffman.cCPlugin vtable (sleela_compressor_plugin_huffman), buffer ownership.
huffman_detail.cppC++Tree build, canonical coding, bit I/O (sleela_huffman_encode / ..._decode).
huffman_detail.h—C-linkage declaration.

Capabilities

SLeeLa calls the Compression Manager, which loads this plugin by id; it never calls the plugin directly.