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
impl Decoder
Sourcepub fn decode(
&mut self,
annex_b: &[u8],
) -> Result<Option<YuvFrame>, DecodeError>
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.
Sourcepub fn decode_stream(
&mut self,
annex_b: &[u8],
) -> Result<Vec<YuvFrame>, DecodeError>
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.
Sourcepub fn decode_stream_threaded(
&mut self,
annex_b: &[u8],
threads: usize,
) -> Result<Vec<YuvFrame>, DecodeError>
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).
Sourcepub fn decode_stream_threaded_sink(
&mut self,
annex_b: &[u8],
threads: usize,
sink: impl FnMut(YuvFrame),
) -> Result<usize, DecodeError>
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).
Sourcepub fn content_route(&self) -> Option<ContentRoute>
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.