Struct Plane

struct Plane<T: Pixel> { ... }

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: PlaneConfig

Plane configuration.

Implementations

impl<T: Pixel> Plane<T>

fn new(width: usize, height: usize, xdec: usize, ydec: usize, xpad: usize, ypad: usize) -> Self

Allocates and returns a new plane.

fn from_slice(data: &[T], stride: usize) -> Self

Panics

  • If len is not a multiple of stride
fn pad(self: &mut Self, w: usize, h: usize)
fn probe_padding(self: &Self, w: usize, h: usize) -> bool

Minimally test that the plane has been padded.

fn slice(self: &Self, po: PlaneOffset) -> PlaneSlice<'_, T>
fn mut_slice(self: &mut Self, po: PlaneOffset) -> PlaneMutSlice<'_, T>
fn row_range_cropped(self: &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: &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: &Self, x: usize, y: usize) -> T

Returns the pixel at the given coordinates.

fn data_origin(self: &Self) -> &[T]

Returns plane data starting from the origin.

fn data_origin_mut(self: &mut Self) -> &mut [T]

Returns mutable plane data starting from the origin.

fn copy_from_raw_u8(self: &mut Self, source: &[u8], source_stride: usize, source_bytewidth: usize)

Copies data into the plane from a pixel array.

Panics

  • If source_bytewidth does not match the generic T of Plane
fn copy_to_raw_u8(self: &Self, dest: &mut [u8], dest_stride: usize, dest_bytewidth: usize)

Copies data from a plane into a pixel array.

Panics

  • If dest_bytewidth does not match the generic T of Plane
fn downsampled(self: &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_width and frame_height.

Panics

  • If the requested width and height are > half the input width or height
fn downscale<SCALE: usize>(self: &Self) -> Plane<T>

Returns a plane downscaled from the source plane by a factor of scale (not padded)

fn downscale_in_place<SCALE: usize>(self: &Self, in_plane: &mut Plane<T>)

Downscales the source plane by a factor of scale, writing the result to in_plane (not padded)

Panics

  • If the current plane's width and height are not at least SCALE times the in_plane's
fn iter(self: &Self) -> PlaneIter<'_, T>

Iterates over the pixels in the plane, skipping the padding.

fn rows_iter(self: &Self) -> RowsIter<'_, T>

Iterates over the lines of the plane

fn rows_iter_mut(self: &mut Self) -> RowsIterMut<'_, T>
fn row(self: &Self, y: isize) -> &[T]

Return a line

impl<T> Any for Plane<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Plane<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Plane<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Plane<T>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> Debug for Plane<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T> Freeze for Plane<T>

impl<T> From for Plane<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for Plane<T>

impl<T> Send for Plane<T>

impl<T> Sync for Plane<T>

impl<T> ToOwned for Plane<T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> Unpin for Plane<T>

impl<T> UnsafeUnpin for Plane<T>

impl<T> UnwindSafe for Plane<T>

impl<T, U> Into for Plane<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Plane<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Plane<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::clone::Clone + Pixel> Clone for Plane<T>

fn clone(self: &Self) -> Plane<T>

impl<T: $crate::cmp::Eq + Pixel> Eq for Plane<T>

impl<T: $crate::cmp::PartialEq + Pixel> PartialEq for Plane<T>

fn eq(self: &Self, other: &Plane<T>) -> bool

impl<T: Pixel> StructuralPartialEq for Plane<T>