pub struct Picture<'a> {
pub width: u32,
pub height: u32,
pub y: &'a [u8],
pub u: &'a [u8],
pub v: &'a [u8],
pub y_stride: usize,
pub uv_stride: usize,
}Expand description
A borrowed planar YUV 4:2:0 (I420) picture.
The decoder returns one; the encoder takes one. Chroma planes are
(width + 1) / 2 by (height + 1) / 2.
Fields§
§width: u32Display width in pixels.
height: u32Display height in pixels.
y: &'a [u8]The luma plane; row r starts at r * y_stride.
u: &'a [u8]The Cb plane; row r starts at r * uv_stride.
v: &'a [u8]The Cr plane; row r starts at r * uv_stride.
y_stride: usizeBytes between luma rows.
uv_stride: usizeBytes between chroma rows.
Implementations§
Source§impl<'a> Picture<'a>
impl<'a> Picture<'a>
Sourcepub fn chroma_width(&self) -> u32
pub fn chroma_width(&self) -> u32
Width of the chroma planes.
Sourcepub fn chroma_height(&self) -> u32
pub fn chroma_height(&self) -> u32
Height of the chroma planes.
Sourcepub fn from_i420(data: &'a [u8], width: u32, height: u32) -> Option<Picture<'a>>
pub fn from_i420(data: &'a [u8], width: u32, height: u32) -> Option<Picture<'a>>
Wraps a tightly packed I420 buffer (Y, then U, then V, no padding).
Returns None if data is shorter than such a picture needs.
Sourcepub fn write_i420(&self, out: &mut Vec<u8>)
pub fn write_i420(&self, out: &mut Vec<u8>)
Appends the picture to out as tightly packed I420 (Y, U, V).
Trait Implementations§
Auto Trait Implementations§
impl<'a> Forget for Picture<'a>
impl<'a> Freeze for Picture<'a>
impl<'a> RefUnwindSafe for Picture<'a>
impl<'a> Send for Picture<'a>
impl<'a> Sync for Picture<'a>
impl<'a> Unpin for Picture<'a>
impl<'a> UnsafeUnpin for Picture<'a>
impl<'a> UnwindSafe for Picture<'a>
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
Mutably borrows from an owned value. Read more