Skip to main content

Cabac

Struct Cabac 

Source
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>

Source

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).

Source

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).

Source

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.

Source

pub fn decode_bypass(&mut self) -> u32

Decodes a bypass (equiprobable) bin (spec §9.3.3.2.3).

Source

pub fn decode_bypass_bits(&mut self, n: u32) -> u32

Decodes n bypass bins as an unsigned value (MSB first).

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for Cabac<'a>

§

impl<'a> RefUnwindSafe for Cabac<'a>

§

impl<'a> Send for Cabac<'a>

§

impl<'a> Sync for Cabac<'a>

§

impl<'a> Unpin for Cabac<'a>

§

impl<'a> UnsafeUnpin for Cabac<'a>

§

impl<'a> UnwindSafe for Cabac<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.