Expand description
Adaptive binary arithmetic coding — integer only, bit-exact everywhere.
A carry-propagating 32-bit range coder (the LZMA construction) driven by
16-bit probabilities. Everything from a probability to an output byte is
integer arithmetic, so any backend that feeds the same probabilities
produces and consumes the same bytes. Probabilities come either from
BitModel (two-rate adaptive counter) or straight from a model (e.g. the
fixed-point network in crate::learned) via Encoder::encode_p.
Structs§
- BitModel
- Two-rate adaptive bit model (fast + slow exponential counters, averaged).
- Decoder
- Range decoder over a byte slice (reads past the end as zeros).
- Encoder
- Range encoder.
- Uint
Model - Adaptive Elias-gamma style coder for unbounded non-negative integers:
unary bucket
k = ⌊log₂(v+1)⌋with one model per bucket position, then thekmantissa bits (topMODELEDwith models, the rest raw).
Constants§
- ONE
- Probability scale:
p1 ∈ [P_MIN, ONE − P_MIN]meansP(bit = 1) = p1 / ONE. - P_MIN
- Smallest probability either symbol may get.