pub struct Cabac<'a> { /* private fields */ }Expand description
The CABAC decoder: arithmetic engine reading MSB-first from the RBSP plus the 460 adaptive context models.
Implementations§
Source§impl<'a> Cabac<'a>
impl<'a> Cabac<'a>
Sourcepub fn new(
data: &'a [u8],
start_byte: usize,
qp: i32,
init_idc: u32,
is_i: bool,
) -> Self
pub fn new( data: &'a [u8], start_byte: usize, qp: i32, init_idc: u32, is_i: bool, ) -> Self
Initializes from the RBSP data at byte offset start_byte (the slice
data, byte-aligned past the header), the slice’s qp (clamped 0..51),
cabac_init_idc, and whether the slice is I/SI (spec §9.3.1).
Sourcepub fn dbg_state(&self) -> (u32, u32)
pub fn dbg_state(&self) -> (u32, u32)
Engine state (codIRange, codIOffset) — for bring-up verification against the
oracle’s symbol 0 (Brick 1.1). At slice start this is (510, first-9-bits).
Sourcepub fn decode_decision(&mut self, ctx_idx: usize) -> u32
pub fn decode_decision(&mut self, ctx_idx: usize) -> u32
Decodes a context-coded bin (spec §9.3.3.2.1), updating the context model. STATE-RESIDENCY REFUTED (WHYS Part 21): this attribute was added on the Part 19 hypothesis that the engine state round-tripped memory per bin through an outlined call. The symbol table refuted it — LLVM already fully inlined this method in the un-attributed build (zero outlined copies in either binary), and the A/B was null as that predicts. The Part 19 ns/bin sizing was also census-tax-inflated: the true engine cost is ~4 ns/bin, and the residual gap vs ffmpeg’s ~2 is the engine’s per-bin WORK (u64-window renorm bookkeeping vs a 16-bit lazy refill), not call overhead. The attribute stays as documentation + insurance.
Sourcepub fn decode_bypass(&mut self) -> u32
pub fn decode_bypass(&mut self) -> u32
Decodes a bypass (equiprobable) bin (spec §9.3.3.2.3).
Sourcepub fn decode_bypass_bits(&mut self, n: u32) -> u32
pub fn decode_bypass_bits(&mut self, n: u32) -> u32
Decodes n bypass bins as an unsigned value (MSB first).
Sourcepub fn decode_terminate(&mut self) -> bool
pub fn decode_terminate(&mut self) -> bool
Decodes the terminate bin (spec §9.3.3.2.4); true ends the slice (or
marks I_PCM). No renormalization on terminate.