Struct Plane
pub struct Plane<T: Pixel> { pub data: PlaneData<T>, pub cfg: PlaneConfig }
One data plane of a frame.
For example, a plane can be a Y luma plane or a U or V chroma plane.
Fields
data: PlaneData<T>cfg: PlaneConfigPlane configuration.
Implementations
impl<T: Pixel> Plane<T>
fn new(width: usize, height: usize, xdec: usize, ydec: usize, xpad: usize, ypad: usize) -> SelfAllocates and returns a new plane.
fn from_slice(data: &[T], stride: usize) -> SelfPanics
- If
lenis not a multiple ofstride
- If
fn pad(&mut self, w: usize, h: usize)fn probe_padding(&self, w: usize, h: usize) -> boolMinimally test that the plane has been padded.
fn slice(&self, po: PlaneOffset) -> PlaneSlice<'_, T>fn mut_slice(&mut self, po: PlaneOffset) -> PlaneMutSlice<'_, T>fn row_range_cropped(&self, x: isize, y: isize) -> Range<usize>This version of the function crops off the padding on the right side of the image
fn row_range(&self, x: isize, y: isize) -> Range<usize>This version of the function includes the padding on the right side of the image
fn p(&self, x: usize, y: usize) -> TReturns the pixel at the given coordinates.
fn data_origin(&self) -> &[T]Returns plane data starting from the origin.
fn data_origin_mut(&mut self) -> &mut [T]Returns mutable plane data starting from the origin.
fn copy_from_raw_u8(&mut self, source: &[u8], source_stride: usize, source_bytewidth: usize)Copies data into the plane from a pixel array.
Panics
- If
source_bytewidthdoes not match the genericTofPlane
- If
fn copy_to_raw_u8(&self, dest: &mut [u8], dest_stride: usize, dest_bytewidth: usize)Copies data from a plane into a pixel array.
Panics
- If
dest_bytewidthdoes not match the genericTofPlane
- If
fn downsampled(&self, frame_width: usize, frame_height: usize) -> Plane<T>Returns plane with half the resolution for width and height. Downscaled with 2x2 box filter. Padded to dimensions with
frame_widthandframe_height.Panics
- If the requested width and height are > half the input width or height
fn downscale<const SCALE: usize>(&self) -> Plane<T>Returns a plane downscaled from the source plane by a factor of
scale(not padded)fn downscale_in_place<const SCALE: usize>(&self, in_plane: &mut Plane<T>)Downscales the source plane by a factor of
scale, writing the result toin_plane(not padded)Panics
- If the current plane's width and height are not at least
SCALEtimes thein_plane's
- If the current plane's width and height are not at least
fn iter(&self) -> PlaneIter<'_, T>Iterates over the pixels in the plane, skipping the padding.
fn rows_iter(&self) -> RowsIter<'_, T>Iterates over the lines of the plane
fn rows_iter_mut(&mut self) -> RowsIterMut<'_, T>fn row(&self, y: isize) -> &[T]Return a line
Trait Implementations
impl<T> Debug for Plane<T>
where
T: Display + Pixel,
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T: Clone + Pixel> Clone for Plane<T>
fn clone(&self) -> Self
impl<T: Eq + Pixel> Eq for Plane<T>
impl<T: PartialEq + Pixel> PartialEq for Plane<T>
fn eq(&self, other: &Self) -> bool
impl<T: PartialEq + Pixel> StructuralPartialEq for Plane<T>
Auto Trait Implementations
impl<T> Freeze for Plane<T>
where
PlaneData<T>: Freeze,
impl<T> RefUnwindSafe for Plane<T>
where
PlaneData<T>: RefUnwindSafe,
impl<T> Send for Plane<T>
where
PlaneData<T>: Send,
impl<T> Sync for Plane<T>
where
PlaneData<T>: Sync,
impl<T> Unpin for Plane<T>
where
PlaneData<T>: Unpin,
impl<T> UnsafeUnpin for Plane<T>
where
PlaneData<T>: UnsafeUnpin,
impl<T> UnwindSafe for Plane<T>
where
PlaneData<T>: UnwindSafe,
Blanket Implementations
impl<T> Any for Plane<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Plane<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Plane<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Plane<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Plane<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Plane<T>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Plane<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Plane<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Plane<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>