entropy
ptwm_core::entropy::rans
rANS (range Asymmetric Numeral Systems) entropy codec.
ptwm_core::entropy::rans
rANS (range Asymmetric Numeral Systems) entropy codec.
ptwm_core::entropy::rans
crates/ptwm-core/src/entropy/rans/mod.rs:1mod ransrANS (range Asymmetric Numeral Systems) entropy codec.
Drop-in alternative to the Huffman codec with the same public interface.
Uses 4 interleaved 32-bit rANS streams with 11-bit probability precision
and byte-granularity renormalization.
ptwm_core::entropy::rans::compress
crates/ptwm-core/src/entropy/rans/mod.rs:25pub fn compress(dst: &mut [u8], src: &[u8]) -> Result<usize, PtwmCoreError>Pipeline-style entrypoint: returns the encoded length, or 0 for any non-encoded outcome. The caller (chunk pipeline) treats 0 as "store raw".
ptwm_core::entropy::rans::decompress
crates/ptwm-core/src/entropy/rans/mod.rs:29pub fn decompress(dst: &mut [u8], src: &[u8]) -> Result<usize, PtwmCoreError>outcome
Typed return for the [huffman]crate::entropy::huffman and [rans]crate::entropy::rans compressors.
stream_frame
Shared framing helpers for the 4-stream interleaved entropy codecs (huffman::compress / rans::compress). Both codecs split their input into 4 roughly-equal segments, encode each segment as an independent stream, and record per-stream compressed lengths in a fixed-size jump table so the decoder can locate each stream without scanning.