Skip to main content

SliceDec

Struct SliceDec 

Source
pub struct SliceDec<'a> {
Show 24 fields pub sps: &'a Sps, pub pps: &'a Pps, pub hdr: &'a SliceHeader, pub slice_num: u32, pub pic: &'a mut CurPic, pub dpb: &'a [RefPic], pub refs: &'a [Vec<RefEntry>; 2], pub frefs: &'a [[Vec<RefEntry>; 2]; 2], pub tables: &'a CavlcTables, pub mb_x: usize, pub mb_y: usize, pub addr: usize, pub mbaff: bool, pub mb_field: bool, pub vmb_y: usize, pub geo: Geo, pub qp: i32, pub prev_qp_nz: bool, pub ctx: Vec<Ctx>, pub bd_y: u32, pub bd_c: u32, pub chroma: bool, pub c422: bool, pub syn: MbSyn, /* private fields */
}
Available on crate feature decode only.

Fields§

§sps: &'a Sps§pps: &'a Pps§hdr: &'a SliceHeader§slice_num: u32§pic: &'a mut CurPic§dpb: &'a [RefPic]§refs: &'a [Vec<RefEntry>; 2]§frefs: &'a [[Vec<RefEntry>; 2]; 2]

MBAFF: the field lists, [parity][list] (see Decoder::field_lists).

§tables: &'a CavlcTables§mb_x: usize§mb_y: usize

Macroblock row in the picture (MBAFF: 2 * pair row + bottom).

§addr: usize

Raster index of the macroblock in pic.mbs.

§mbaff: bool

MbaffFrameFlag.

§mb_field: bool

The current macroblock is a field macroblock of an MBAFF frame.

§vmb_y: usize

Macroblock row in the current macroblock’s own sample view: mb_y, or the pair row for an MBAFF field macroblock.

§geo: Geo

How that view’s rows map onto picture rows.

§qp: i32

QPY of the previous macroblock in decoding order.

§prev_qp_nz: bool

Whether the previous macroblock had a non-zero mb_qp_delta.

§ctx: Vec<Ctx>§bd_y: u32§bd_c: u32§chroma: bool§c422: bool

4:2:2: chroma macroblocks are 8×16.

§syn: MbSyn

Implementations§

Source§

impl SliceDec<'_>

Source

pub fn cabac_field_flag(&mut self, c: &mut Cabac<'_>) -> bool

mb_field_decoding_flag (ctxIdx 70-72), read at a pair’s top macroblock. The left term is the flag the pair inherited, as ffmpeg has it (the left pair’s, within a slice).

Source

pub fn cabac_skip_flag(&mut self, c: &mut Cabac<'_>) -> bool

Source

pub fn parse_mb_cabac(&mut self, c: &mut Cabac<'_>) -> Result<()>

Source§

impl SliceDec<'_>

Source

pub fn set_i16(&mut self, t: u32)

Set up syn for an Intra 16×16 mb_type (1-24).

Source

pub fn read_pcm(&mut self, r: &mut BitReader<'_>)

Source

pub fn parse_mb_cavlc(&mut self, r: &mut BitReader<'_>) -> Result<()>

Source

pub fn fill_mvd( &mut self, l: usize, x: usize, y: usize, w: usize, h: usize, d: [i32; 2], )

Record an mvd over a partition’s 4×4 blocks — CABAC context selection reads it back from neighbours, and motion derivation from the partition’s top-left block.

Source§

impl<'a> SliceDec<'a>

Source

pub fn new( sps: &'a Sps, pps: &'a Pps, hdr: &'a SliceHeader, slice_num: u32, pic: &'a mut CurPic, dpb: &'a [RefPic], refs: &'a [Vec<RefEntry>; 2], frefs: &'a [[Vec<RefEntry>; 2]; 2], tables: &'a CavlcTables, ) -> Self

Source

pub fn set_field(&mut self, field: bool)

Set the current macroblock’s mb_field_decoding_flag (MBAFF).

Source

pub fn decode(&mut self, rbsp: &[u8]) -> Result<()>

Decode the slice’s macroblocks.

Source

pub fn rl(&self, l: usize) -> &'a [RefEntry]

Reference list l as the current macroblock indexes it: an MBAFF field macroblock’s is the field list of its parity.

Source

pub fn num_ref(&self, l: usize) -> u32

num_ref_idx_lX_active for the current macroblock (doubled for an MBAFF field macroblock).

Source

pub fn field_coded(&self) -> bool

Field scans and CABAC field contexts: a field picture or an MBAFF field macroblock.

Source

pub fn mb_nb(&self, dx: isize, dy: isize) -> Option<usize>

Address of the macroblock at offset (dx, dy), if it is available: inside the picture, already decoded, and in this slice. In an MBAFF frame, the macroblock covering luma location (-1, 0), (0, -1), (16, -1) or (-1, -1) (§6.4.11.1).

Source

pub fn loc_nb( &self, xn: isize, yn: isize, maxw: isize, maxh: isize, ) -> Option<(usize, usize, usize)>

MBAFF neighbouring location (§6.4.12.2): the available macroblock covering location (xn, yn) of the current macroblock’s view, in a component whose macroblocks are maxw × maxh, and the location within it. A location maps onto the picture row it shows (every other row in a field macroblock), and from there into whichever macroblock of the pair holds that row: this is Table 6-4, and ffmpeg’s left_block_options / top_xy / topleft_xy adjustments.

Source

pub fn blk_nb(&self, x: isize, y: isize) -> Option<(usize, usize)>

The 4×4 block at (x, y) (4-sample units relative to the current macroblock, x in -1..=4, y in -1..=3): (mb address, raster index). The current macroblock is returned too; callers that care whether its block is decoded yet check that themselves.

Source

pub fn blk_nb_row( &self, x: isize, y: isize, last_row: bool, ) -> Option<(usize, usize)>

Self::blk_nb, locating the block by its last sample row instead of its first: neighbour D of a partition is luma location (x - 1, y - 1), the bottom row of the block above-left. Only an MBAFF left pair of the other kind tells the two apart.

Source

pub fn cblk_nb(&self, x: isize, y: isize) -> Option<(usize, usize)>

The chroma 4×4 block at (x, y) (x in -1..2, y in -1..rows): (mb address, index into nnz_c).

Source

pub fn decode_skip(&mut self) -> Result<()>

Source

pub fn decode_mb(&mut self) -> Result<()>

Auto Trait Implementations§

§

impl<'a> !UnwindSafe for SliceDec<'a>

§

impl<'a> Forget for SliceDec<'a>

§

impl<'a> Freeze for SliceDec<'a>

§

impl<'a> Move for SliceDec<'a>

§

impl<'a> RefUnwindSafe for SliceDec<'a>

§

impl<'a> Send for SliceDec<'a>

§

impl<'a> Sync for SliceDec<'a>

§

impl<'a> Unpin for SliceDec<'a>

§

impl<'a> UnsafeUnpin for SliceDec<'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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.