pub struct PackedFrame {
pub width: u32,
pub height: u32,
pub bit_depth: u8,
pub y: Vec<u8>,
pub uv: Vec<u8>,
pub color: ColorInfo,
}Expand description
A 4:2:0 picture as hardware decoders keep it: a luma plane and one plane of Cb and Cr interleaved (NV12; P010 above 8 bits, two little-endian bytes a sample with the value in the high bits). VideoToolbox, NVDEC, VAAPI and the browser’s WebCodecs all decode to this, so handing it on as it is, to a GPU that converts it, costs no pass over the pixels.
Fields§
§width: u32Display width in pixels.
height: u32Display height in pixels.
bit_depth: u8Bits a sample: 8 (NV12), or 10 to 16 (P010, P016).
y: Vec<u8>Luma, width * height samples, tightly packed.
uv: Vec<u8>Cb, Cr, Cb, Cr…: ceil(width / 2) * ceil(height / 2) pairs.
color: ColorInfoWhat the stream says about its colour.
Implementations§
Source§impl PackedFrame
impl PackedFrame
Sourcepub fn bytes_per_sample(&self) -> usize
pub fn bytes_per_sample(&self) -> usize
Bytes a sample: 1 for NV12, 2 above 8 bits.
Sourcepub fn to_decoded(&self) -> DecodedFrame
pub fn to_decoded(&self) -> DecodedFrame
As planes of u16 samples, the form the native decoders give: one
pass over the picture, for callers that want DecodedFrame.
Trait Implementations§
Source§impl Clone for PackedFrame
impl Clone for PackedFrame
Auto Trait Implementations§
impl Forget for PackedFrame
impl Freeze for PackedFrame
impl Move for PackedFrame
impl RefUnwindSafe for PackedFrame
impl Send for PackedFrame
impl Sync for PackedFrame
impl Unpin for PackedFrame
impl UnsafeUnpin for PackedFrame
impl UnwindSafe for PackedFrame
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