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: u32Frame width in pixels.
frame_height: u32Frame height in pixels.
tile_cols: u32Number of tile columns.
tile_rows: u32Number of tile rows.
Implementations§
Source§impl ParallelTileDecoder
impl ParallelTileDecoder
Sourcepub fn new(
frame_width: u32,
frame_height: u32,
tile_cols: u32,
tile_rows: u32,
) -> Self
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.
Sourcepub fn split_into_tiles(&self, frame_data: &[u8]) -> Vec<TileJob>
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.
Sourcepub fn decode_tiles_parallel(&self, tiles: Vec<TileJob>) -> CodecResult<Vec<u8>>
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.
Sourcepub fn assemble_frame(&self, tile_outputs: &[(TileJob, Vec<u8>)]) -> Vec<u8> ⓘ
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
impl Clone for ParallelTileDecoder
Source§fn clone(&self) -> ParallelTileDecoder
fn clone(&self) -> ParallelTileDecoder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ParallelTileDecoder
impl RefUnwindSafe for ParallelTileDecoder
impl Send for ParallelTileDecoder
impl Sync for ParallelTileDecoder
impl Unpin for ParallelTileDecoder
impl UnsafeUnpin for ParallelTileDecoder
impl UnwindSafe for ParallelTileDecoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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