Skip to main content

Decoder

Struct Decoder 

Source
pub struct Decoder { /* private fields */ }
Expand description

A Constrained Baseline H.264 decoder. Holds the most recent parameter sets and the previous decoded picture (the inter reference) across calls.

Implementations§

Source§

impl Decoder

Source

pub fn new() -> Self

Creates a decoder with no parameter sets yet.

Source

pub fn decode( &mut self, annex_b: &[u8], ) -> Result<Option<YuvFrame>, DecodeError>

Decodes a complete Annex-B access unit, returning the reconstructed, cropped frame if the access unit contained a coded picture.

Source

pub fn decode_stream( &mut self, annex_b: &[u8], ) -> Result<Vec<YuvFrame>, DecodeError>

Decodes a complete Annex-B byte stream and returns every picture in display order (PicOrderCnt within each GOP; an IDR ends a GOP).

This is the convenient whole-stream entry point — it handles access-unit splitting, multi-slice picture assembly, and B-picture reordering — versus the lower-level per-access-unit Decoder::decode, which returns pictures in decode order.

When RS_H264_FRAME_THREADS is set to N>1 (or the caller uses Decoder::decode_stream_threaded), pictures decode on a worker pool under a full-reference barrier (campaign #1 Phase A). Measure with bench/pinmt.ps1 (WALL+CPU, multi-core mask) — not the 1T CPU race.

Source

pub fn decode_stream_threaded( &mut self, annex_b: &[u8], threads: usize, ) -> Result<Vec<YuvFrame>, DecodeError>

Force frame-MT with an explicit worker count (0/1 = serial).

Source

pub fn decode_stream_threaded_sink( &mut self, annex_b: &[u8], threads: usize, sink: impl FnMut(YuvFrame), ) -> Result<usize, DecodeError>

Frame-MT decode that invokes sink for each display-ordered frame (avoids retaining all YUV — use from decode_bench timed path).

Source

pub fn content_route(&self) -> Option<ContentRoute>

The PicOrderCnt of the most recently returned picture. Pictures are returned in decode order; sorting them by this value yields display order (the only difference is reordered B-pictures). GATE 1 content route of the last completed picture — the 4-way cost tier from big-oppy-decoder §2. Trailing signal: consumers apply it to the NEXT picture. None until the first picture completes.

Source

pub fn last_poc(&self) -> i32

Trait Implementations§

Source§

impl Default for Decoder

Source§

fn default() -> Decoder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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 = !

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.