PTWM
transforms

ptwm_core::transforms::move_to_front

MoveToFront op — the move-to-front (MTF) byte transform.

ptwm_core::transforms::move_to_front

MoveToFront op — the move-to-front (MTF) byte transform.

rsmod

ptwm_core::transforms::move_to_front

crates/ptwm-core/src/transforms/move_to_front.rs:1
mod move_to_front

`MoveToFront` op — the move-to-front (MTF) byte transform.

MTF maintains a list of the 256 byte values, initialised to the identity order `0, 1, …, 255`. Each input byte is replaced by its current index in the list, and that byte is then moved to the front. Bytes that recur close together therefore map to small indices, which is exactly what a downstream entropy coder (Huffman / rANS) codes cheaply. ## Why it pairs with [`crate::transforms::BurrowsWheeler`] After the bit-reorder + byte-split chain, the exponent plane is mostly long runs of similar bytes. A Burrows–Wheeler pass clusters identical bytes into long runs; MTF then turns those runs into long runs of zeros (the front of the list), which collapse under the entropy coder. This is the classic bzip2 pipeline (BWT → MTF → entropy). The two ops are kept separate so each is independently addressable in a chain — MTF on its own still helps any plane with strong local byte locality. ## Element widths MTF is a pure byte remap; it is defined on the raw byte stream regardless of the logical element width. Nibble-packed planes are rejected because their half-byte storage has no unambiguous byte interpretation. The descriptor (length, role, layout, width) passes through unchanged — MTF is length-preserving. Round-trip is exact for every input: `inverse(forward(x)) == x`.
rstype

ptwm_core::transforms::move_to_front::MoveToFront

crates/ptwm-core/src/transforms/move_to_front.rs:38
pub struct MoveToFront;

Move-to-front byte transform.