PTWM
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).

rsmod

ptwm_core::entropy::huff_llm

crates/ptwm-core/src/entropy/huff_llm/mod.rs:1
mod huff_llm

Field-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)
rsfn

ptwm_core::entropy::huff_llm::decode_plane

crates/ptwm-core/src/entropy/huff_llm/mod.rs:161
pub fn decode_plane(state: &[u8], payload: &[u8]) -> Result<Vec<u16>, PtwmCoreError>

Decode a plane from its `state_bytes` and `payload`.

rsfn

ptwm_core::entropy::huff_llm::encode_plane

crates/ptwm-core/src/entropy/huff_llm/mod.rs:140
pub fn encode_plane(words: &[u16]) -> Result<PlaneEncoding, PtwmCoreError>

Encode a 16-bit word plane, trialing both layouts and keeping the smaller.

rstype

ptwm_core::entropy::huff_llm::PlaneEncoding

crates/ptwm-core/src/entropy/huff_llm/mod.rs:68
pub struct PlaneEncoding

Serialized result for one plane: `state_bytes` (layout tag + 3 length tables) and `payload` (n_words + sign bits + 3 group bitstreams).