pub struct YuvaPlanes<'a> {
pub y: &'a mut [u8],
pub y_stride: usize,
pub u: &'a mut [u8],
pub v: &'a mut [u8],
pub uv_stride: usize,
pub a: Option<&'a mut [u8]>,
pub a_stride: usize,
}Expand description
The caller’s Y, U, V and optional A planes, the input of
Picture::from_yuva.
Strides count elements of the slices’ type, which are bytes. The Y and A
planes have height rows of width samples, the U and V planes
(height + 1) / 2 rows of (width + 1) / 2 samples; each stride is at
least its row length and at most i32::MAX, and each plane holds at least
(rows - 1) * stride + row length samples. a_stride is ignored when a
is None.
§Examples
use webp::api::encode::{Picture, YuvaPlanes};
// 3 by 3: chroma planes of 2 by 2, alpha omitted.
let (mut y, mut u, mut v) = (vec![128_u8; 9], vec![128_u8; 4], vec![128_u8; 4]);
let planes = YuvaPlanes {
y: &mut y, y_stride: 3,
u: &mut u, v: &mut v, uv_stride: 2,
a: None, a_stride: 0,
};
let picture = Picture::from_yuva(3, 3, planes)?;
assert_eq!(picture.owned_sample_bytes(), 0);Fields§
§y: &'a mut [u8]The luma plane.
y_stride: usizeThe distance between luma rows, in bytes.
u: &'a mut [u8]The U (Cb) chroma plane.
v: &'a mut [u8]The V (Cr) chroma plane.
uv_stride: usizeThe distance between rows of both chroma planes, in bytes.
a: Option<&'a mut [u8]>The alpha plane, straight alpha, or None for an opaque picture.
a_stride: usizeThe distance between alpha rows, in bytes.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for YuvaPlanes<'a>
impl<'a> Forget for YuvaPlanes<'a>
impl<'a> Freeze for YuvaPlanes<'a>
impl<'a> Move for YuvaPlanes<'a>
impl<'a> RefUnwindSafe for YuvaPlanes<'a>
impl<'a> Send for YuvaPlanes<'a>
impl<'a> Sync for YuvaPlanes<'a>
impl<'a> Unpin for YuvaPlanes<'a>
impl<'a> UnsafeUnpin for YuvaPlanes<'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