Skip to main content

CabacReader

Struct CabacReader 

Source
struct CabacReader<'a> {
Show 14 fields e: CabacEngine<'a>, blk_w: usize, mb_w: usize, cur_mb: usize, cur_intra: bool, mb_flags: Vec<u8>, mb_cbp: Vec<u8>, mb_dc: Vec<u8>, mb_cpm: Vec<u8>, prev_dqp: i32, cur_dqp: i32, mvd: [Vec<[u8; 2]>; 2], ref_gt0: [Vec<bool>; 2], direct: Vec<bool>,
}
Expand description

CABAC の MB 層の読み手(9.3.2 二値化・9.3.3.1.1 文脈選択)。近傍の情報は同じスライスの MB だけを見る(可用性は DecState::avail_px)。スライスごとに作り直す。

Fields§

§e: CabacEngine<'a>§blk_w: usize§mb_w: usize§cur_mb: usize§cur_intra: bool§mb_flags: Vec<u8>

MB ごと: MBF_* フラグ・coded_block_pattern・DC の coded_block_flag(bit0 輝度, bit1 Cb, bit2 Cr)・ intra_chroma_pred_mode。

§mb_cbp: Vec<u8>§mb_dc: Vec<u8>§mb_cpm: Vec<u8>§prev_dqp: i32§cur_dqp: i32§mvd: [Vec<[u8; 2]>; 2]

4x4 ごと: |mvd|(成分ごと、70 で頭打ち)・refIdx > 0 か・ダイレクト予測か。

§ref_gt0: [Vec<bool>; 2]§direct: Vec<bool>

Implementations§

Source§

impl<'a> CabacReader<'a>

Source

fn new(e: CabacEngine<'a>, st: &DecState) -> Self

Source

fn start_mb(&mut self, mb_idx: usize)

MB の復号を始める(mb_qp_delta の文脈は直前の MB の値)。

Source

fn nb_mbs( &self, st: &DecState, mb_x: u32, mb_y: u32, ) -> (Option<usize>, Option<usize>)

左(A)・上(B)の MB 番号(同じスライスで可用なときだけ)。

Source

fn mb_skip( &mut self, st: &DecState, mb_x: u32, mb_y: u32, kind: SliceKind, ) -> bool

mb_skip_flag(P: ctxIdx 11..13、B: 24..26)。真なら P_Skip / B_Skip として記録する。

Source

fn intra_mb_type(&mut self, base: usize, intra_slice: bool, inc: usize) -> u32

イントラの mb_type(表 9-36)。base は I スライスで 3、P で 17、B で 32。

Source

fn mvd_comp( &mut self, base: usize, amvd: u32, ) -> Result<(i16, u8), &'static str>

1 つの mvd 成分(UEG3、uCoff = 9、符号付き)。base は x で 40、y で 47。

Source

fn blk_ok(st: &DecState, bx4: isize, by4: isize) -> bool

4x4 ブロック (bx4, by4) が同じスライスで可用か。

Trait Implementations§

Source§

impl MbSyntax for CabacReader<'_>

Source§

fn residual8x8( &mut self, _st: &DecState, _bx4: usize, _by4: usize, ) -> Result<([i32; 64], [u8; 4]), &'static str>

輝度 8x8(cat 5)。4:2:0 では coded_block_flag は無く常に 1(7.4.5.3.3)。

Source§

fn mb_type( &mut self, st: &DecState, mb_x: u32, mb_y: u32, kind: SliceKind, ) -> Result<u32, &'static str>

Source§

fn sub_mb_type(&mut self, kind: SliceKind) -> Result<u32, &'static str>

Source§

fn intra4x4_rem(&mut self) -> Option<i32>

prev_intra4x4_pred_mode_flag が 1 なら None、0 なら rem_intra4x4_pred_mode。
Source§

fn intra_chroma_mode( &mut self, st: &DecState, mb_x: u32, mb_y: u32, ) -> Result<u8, &'static str>

Source§

fn cbp( &mut self, st: &DecState, mb_x: u32, mb_y: u32, _intra: bool, ) -> Result<u32, &'static str>

Source§

fn qp_delta(&mut self) -> Result<i32, &'static str>

Source§

fn ref_idx( &mut self, st: &DecState, list: usize, px: usize, py: usize, pw: usize, ph: usize, num_ref: u32, ) -> Result<i8, &'static str>

パーティション (px, py, pw, ph) の ref_idx_lX。
Source§

fn mvd( &mut self, st: &DecState, list: usize, px: usize, py: usize, pw: usize, ph: usize, ) -> Result<[i16; 2], &'static str>

パーティション (px, py, pw, ph) の mvd_lX。
Source§

fn residual( &mut self, st: &DecState, blk: ResBlock, ) -> Result<([i32; 16], u8), &'static str>

残差 1 ブロック(走査順の係数, 非ゼロ係数の数)。
Source§

fn pcm(&mut self, out: &mut [u8; 384])

I_PCM の 384 バイト(Y 256・Cb 64・Cr 64)。
Source§

fn transform_8x8(&mut self, st: &DecState, mb_x: u32, mb_y: u32) -> bool

transform_size_8x8_flag。
Source§

fn mark_direct(&mut self, px: usize, py: usize, pw: usize, ph: usize)

B_Skip / B_Direct の領域を記録する(CABAC の ref_idx の文脈用)。

Auto Trait Implementations§

§

impl<'a> Freeze for CabacReader<'a>

§

impl<'a> RefUnwindSafe for CabacReader<'a>

§

impl<'a> Send for CabacReader<'a>

§

impl<'a> Sync for CabacReader<'a>

§

impl<'a> Unpin for CabacReader<'a>

§

impl<'a> UnsafeUnpin for CabacReader<'a>

§

impl<'a> UnwindSafe for CabacReader<'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.