Struct av_metrics::video::Plane

source ·
pub struct Plane<T>where
    T: Pixel,{
    pub data: PlaneData<T>,
    pub cfg: PlaneConfig,
}
Expand description

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§

source§

impl<T> Plane<T>where T: Pixel,

source

pub fn new( width: usize, height: usize, xdec: usize, ydec: usize, xpad: usize, ypad: usize ) -> Plane<T>

Allocates and returns a new plane.

source

pub fn from_slice(data: &[T], stride: usize) -> Plane<T>

Panics
  • If len is not a multiple of stride
source

pub fn pad(&mut self, w: usize, h: usize)

source

pub fn probe_padding(&self, w: usize, h: usize) -> bool

Minimally test that the plane has been padded.

source

pub fn slice(&self, po: PlaneOffset) -> PlaneSlice<'_, T>

source

pub fn mut_slice(&mut self, po: PlaneOffset) -> PlaneMutSlice<'_, T>

source

pub 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

source

pub 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

source

pub fn p(&self, x: usize, y: usize) -> T

Returns the pixel at the given coordinates.

source

pub fn data_origin(&self) -> &[T]

Returns plane data starting from the origin.

source

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

Returns mutable plane data starting from the origin.

source

pub 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_bytewidth does not match the generic T of Plane
source

pub 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_bytewidth does not match the generic T of Plane
source

pub 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_width and frame_height.

Panics
  • If the requested width and height are > half the input width or height
source

pub fn downscale<const SCALE: usize>(&self) -> Plane<T>

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

source

pub 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 to in_plane (not padded)

in_plane’s width and height must be sufficient for scale.

source

pub fn iter(&self) -> PlaneIter<'_, T>

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

source

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

Iterates over the lines of the plane

source

pub fn rows_iter_mut(&mut self) -> RowsIterMut<'_, T>

source

pub fn row(&self, y: isize) -> &[T]

Return a line

Trait Implementations§

source§

impl<T> Clone for Plane<T>where T: Clone + Pixel,

source§

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

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for Plane<T>where T: Pixel + Display,

source§

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

Formats the value using the given formatter. Read more
source§

impl<T> PartialEq<Plane<T>> for Plane<T>where T: PartialEq<T> + Pixel,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Eq for Plane<T>where T: Eq + Pixel,

source§

impl<T> StructuralEq for Plane<T>where T: Pixel,

source§

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

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Plane<T>where T: RefUnwindSafe,

§

impl<T> Send for Plane<T>

§

impl<T> Sync for Plane<T>

§

impl<T> Unpin for Plane<T>where T: Unpin,

§

impl<T> UnwindSafe for Plane<T>where T: UnwindSafe + RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.