Skip to main content

CabacEngine

Struct CabacEngine 

Source
pub struct CabacEngine<'a> {
    data: &'a [u8],
    pos: usize,
    range: u32,
    offset: u32,
    state: [u8; 460],
}
Expand description

CABAC の復号エンジンとコンテキスト状態。

Fields§

§data: &'a [u8]§pos: usize

次に読むビット位置(先頭から)。

§range: u32§offset: u32§state: [u8; 460]

各 ctxIdx の状態(pStateIdx << 1 | valMPS)。

Implementations§

Source§

impl<'a> CabacEngine<'a>

Source

pub fn new( data: &'a [u8], bit_pos: usize, slice_qp: i32, cabac_init_idc: Option<u32>, ) -> Self

bit_pos はスライスヘッダ直後の位置(cabac_alignment_one_bit を飛ばしてバイト境界へ揃える)。 cabac_init_idc は I スライスなら None。

Source

fn init_engine(&mut self)

9.3.1.2: codIRange = 510、codIOffset = read_bits(9)。I_PCM の後にも呼ぶ。

Source

fn bit(&mut self) -> u32

Source

pub fn decision(&mut self, ctx: usize) -> u32

DecodeDecision(9.3.3.2.1)。

Source

pub fn bypass(&mut self) -> u32

DecodeBypass(9.3.3.2.3)。

Source

pub fn terminate(&mut self) -> u32

DecodeTerminate(9.3.3.2.2)。end_of_slice_flag と I_PCM の mb_type の判定に使う。

Source

pub fn read_pcm(&mut self, out: &mut [u8])

I_PCM: terminate = 1 の直後に呼ぶ。バイト境界からの out.len() バイトを読み、エンジンを初期化し直す。

Auto Trait Implementations§

§

impl<'a> Freeze for CabacEngine<'a>

§

impl<'a> RefUnwindSafe for CabacEngine<'a>

§

impl<'a> Send for CabacEngine<'a>

§

impl<'a> Sync for CabacEngine<'a>

§

impl<'a> Unpin for CabacEngine<'a>

§

impl<'a> UnsafeUnpin for CabacEngine<'a>

§

impl<'a> UnwindSafe for CabacEngine<'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> Same for T

Source§

type Output = T

Should always be Self
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.