entropy
ptwm_core::entropy::huff_llm
Field-separated Huffman coding of 16-bit float planes (Huff-LLM).
ptwm_core::entropy::huff_llm
Field-separated Huffman coding of 16-bit float planes (Huff-LLM).
ptwm_core::entropy::huff_llm
crates/ptwm-core/src/entropy/huff_llm/mod.rs:1mod huff_llmField-separated Huffman coding of 16-bit float planes (Huff-LLM).
Each 16-bit word is partitioned MSB-first into `[sign:1][g0][g1][g2]`.
The sign bit is stored raw; each group is coded with an independent
canonical Huffman table (`group_codec`). Two layouts are supported and the
caller trials both, keeping the smaller:
* FP16 `{1,5,5,5}` — sign · exp(5) · mantissa-hi(5) · mantissa-lo(5)
* BF16 `{1,4,4,7}` — sign · exp-hi(4) · exp-lo(4) · mantissa(7)
ptwm_core::entropy::huff_llm::decode_plane
crates/ptwm-core/src/entropy/huff_llm/mod.rs:161pub fn decode_plane(state: &[u8], payload: &[u8]) -> Result<Vec<u16>, PtwmCoreError>Decode a plane from its `state_bytes` and `payload`.
ptwm_core::entropy::huff_llm::encode_plane
crates/ptwm-core/src/entropy/huff_llm/mod.rs:140pub fn encode_plane(words: &[u16]) -> Result<PlaneEncoding, PtwmCoreError>Encode a 16-bit word plane, trialing both layouts and keeping the smaller.
ptwm_core::entropy::huff_llm::PlaneEncoding
crates/ptwm-core/src/entropy/huff_llm/mod.rs:68pub struct PlaneEncodingSerialized result for one plane: `state_bytes` (layout tag + 3 length tables) and `payload` (n_words + sign bits + 3 group bitstreams).