Asymmetric Numeral Systems (ANS) entropy coding primitives.
This crate provides a small, dependency-light implementation of rANS (range Asymmetric Numeral Systems), suitable as a building block for higher-level compression schemes (e.g. “bits-back” constructions used in ROC / set coding).
Design
- Explicit model: callers provide counts (frequencies) and the precision.
- Small surface: encode/decode with a [
FrequencyTable]. - No I/O: this crate is pure in-memory coding.
Notes
- This is not tuned for maximum speed; it is meant to be correct and easy to integrate.
- Encoding returns a byte vector in a stack format: the decoder consumes bytes from the end (LIFO). This avoids reversing buffers.