Expand description
Range decoder primitives for the Opus codec.
This module implements the bit-exact range decoder described in
RFC 6716 §4.1 (docs/audio/opus/rfc6716-opus.txt). The implementation
is clean-room: every routine is transcribed from the prose and
pseudocode equations in the RFC; no external library source was
consulted.
The range decoder is the SHARED entropy primitive that both the SILK
and CELT layers of Opus invoke for every coded symbol. The
[oxideav-celt] crate carries its own copy of the same primitive;
each crate owns its copy until a shared low-level primitive crate
exists in the workspace. The two copies are independent clean-room
transcriptions of the same RFC sections and are expected to be
behaviourally identical.
The following routines are wired up:
- Initialization (§4.1.1).
- Symbol-update internal helper (§4.1.2).
- Renormalization (§4.1.2.1).
RangeDecoder::decode_binfor power-of-twoftsymbols (§4.1.3.1).RangeDecoder::dec_bit_logp(§4.1.3.2).RangeDecoder::dec_icdffor inverse-CDF table decoding (§4.1.3.3).RangeDecoder::dec_bitsfor raw bits (§4.1.4).RangeDecoder::dec_uintfor uniformly-distributed integers (§4.1.5).RangeDecoder::tellfor whole-bit accounting (§4.1.6.1).RangeDecoder::tell_fracfor 1/8th-bit-precision accounting (§4.1.6.2).RangeDecoder::ec_decode/RangeDecoder::ec_dec_updatefor the generic two-step symbol path (§4.1.2). These are the building blocks for custom symbol decoders that an inverse-CDF table cannot express directly — notably the CELT §4.3.2.1 coarse-energy Laplace decoder and the §4.3.3 allocation interpolation search, both of which decode against a frequency model computed at run time rather than a fixedicdf[]table.
Structs§
- Range
Decoder - Bit-exact CELT/SILK range decoder state per RFC 6716 §4.1.