PTWM
entropy

ptwm_core::entropy::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.

ptwm_core::entropy::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.

rsmod

ptwm_core::entropy::stream_frame

crates/ptwm-core/src/entropy/stream_frame.rs:1
mod 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.

The jump table stores all four lengths as little-endian `u32` (16 bytes total).
rsconst

ptwm_core::entropy::stream_frame::JUMP_TABLE_BYTES

crates/ptwm-core/src/entropy/stream_frame.rs:11
pub const JUMP_TABLE_BYTES

Size of the jump table in bytes: 4 × u32 LE.

rsfn

ptwm_core::entropy::stream_frame::read_jump_table

crates/ptwm-core/src/entropy/stream_frame.rs:53
pub fn read_jump_table(src: &[u8]) -> Result<([u32; 4], usize), TruncatedJumpTable>

Read 4 × u32 LE jump-table entries from the start of `src`. Returns the four lengths and the number of bytes consumed. Errors if `src` is shorter than [`JUMP_TABLE_BYTES`].

rsfn

ptwm_core::entropy::stream_frame::split_four

crates/ptwm-core/src/entropy/stream_frame.rs:27
pub fn split_four(len: usize) -> [(usize, usize); 4]

Split a buffer length into 4 roughly-equal contiguous segments. The first `len % 4` segments are 1 byte larger than the remainder.

rstype

ptwm_core::entropy::stream_frame::TruncatedJumpTable

crates/ptwm-core/src/entropy/stream_frame.rs:17
pub struct TruncatedJumpTable;

Error returned when the jump-table payload is shorter than expected. The shared framing module is codec-agnostic; each caller (`huffman::decompress`, `rans::decompress`) wraps this into its own `PtwmCoreError` variant.

rsfn

ptwm_core::entropy::stream_frame::write_jump_table

crates/ptwm-core/src/entropy/stream_frame.rs:43
pub fn write_jump_table(dst: &mut [u8], lens: &[u32; 4])

Write `lens` into `dst` as 4 × u32 LE. `dst` must be at least [`JUMP_TABLE_BYTES`] long; a debug assertion catches a too-small slice.