Skip to main content

ParallelTileDecoder

Struct ParallelTileDecoder 

Source
pub struct ParallelTileDecoder {
    pub frame_width: u32,
    pub frame_height: u32,
    pub tile_cols: u32,
    pub tile_rows: u32,
}
Expand description

Parallel tile decoder for AV1 frames.

Divides a frame into a grid of tile_cols × tile_rows tiles, decodes them concurrently with rayon, and assembles the results into a planar YUV 4:2:0 buffer.

Fields§

§frame_width: u32

Frame width in pixels.

§frame_height: u32

Frame height in pixels.

§tile_cols: u32

Number of tile columns.

§tile_rows: u32

Number of tile rows.

Implementations§

Source§

impl ParallelTileDecoder

Source

pub fn new( frame_width: u32, frame_height: u32, tile_cols: u32, tile_rows: u32, ) -> Self

Create a new ParallelTileDecoder.

§Panics

Does not panic; use Self::decode_tiles_parallel error return for invalid configurations.

Source

pub fn split_into_tiles(&self, frame_data: &[u8]) -> Vec<TileJob>

Split frame_data (luma plane bytes, row-major) into TileJobs.

The frame is divided into a tile_cols × tile_rows grid. The last tile column and row absorb any remainder pixels.

frame_data is interpreted as a contiguous luma plane of frame_width × frame_height bytes. If frame_data is shorter than the expected luma plane size the available bytes are distributed proportionally across tiles.

Source

pub fn decode_tiles_parallel(&self, tiles: Vec<TileJob>) -> CodecResult<Vec<u8>>

Decode all tiles in parallel using rayon and assemble the output frame.

Returns a planar YUV 4:2:0 buffer of length frame_width × frame_height × 3 / 2.

§Errors

Returns CodecError::InvalidParameter when the tile grid dimensions are zero, or CodecError::InvalidBitstream when an individual tile fails to decode.

Source

pub fn assemble_frame(&self, tile_outputs: &[(TileJob, Vec<u8>)]) -> Vec<u8>

Assemble decoded tile outputs into a full planar YUV 4:2:0 frame.

The luma (Y) plane is filled from each tile’s decoded bytes. The chroma (Cb, Cr) planes are zeroed (neutral grey), which is appropriate for a structural pass that does not yet decode chroma.

Returns a buffer of frame_width × frame_height × 3 / 2 bytes:

  • bytes [0 .. W*H) — luma
  • bytes [W*H .. W*H + W*H/4) — Cb (zeroed)
  • bytes [W*H + W*H/4 .. W*H*3/2) — Cr (zeroed)

Trait Implementations§

Source§

impl Clone for ParallelTileDecoder

Source§

fn clone(&self) -> ParallelTileDecoder

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ParallelTileDecoder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.