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
sourceimpl<T> Plane<T> where
T: Pixel,
impl<T> Plane<T> where
T: Pixel,
sourcepub fn new(
width: usize,
height: usize,
xdec: usize,
ydec: usize,
xpad: usize,
ypad: usize
) -> Plane<T>
pub fn new(
width: usize,
height: usize,
xdec: usize,
ydec: usize,
xpad: usize,
ypad: usize
) -> Plane<T>
Allocates and returns a new plane.
pub fn from_slice(data: &[T], stride: usize) -> Plane<T>
pub fn pad(&mut self, w: usize, h: usize)
sourcepub fn probe_padding(&self, w: usize, h: usize) -> bool
pub fn probe_padding(&self, w: usize, h: usize) -> bool
Minimally test that the plane has been padded.
pub fn slice(&self, po: PlaneOffset) -> PlaneSlice<'_, T>
pub fn mut_slice(&mut self, po: PlaneOffset) -> PlaneMutSlice<'_, T>
pub fn row_range(&self, x: isize, y: isize) -> Range<usize>
sourcepub fn data_origin(&self) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn data_origin(&self) -> &[T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns plane data starting from the origin.
sourcepub fn data_origin_mut(&mut self) -> &mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn data_origin_mut(&mut self) -> &mut [T]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns mutable plane data starting from the origin.
sourcepub fn copy_from_raw_u8(
&mut self,
source: &[u8],
source_stride: usize,
source_bytewidth: usize
)
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.
sourcepub fn copy_to_raw_u8(
&self,
dest: &mut [u8],
dest_stride: usize,
dest_bytewidth: usize
)
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.
sourcepub fn downsampled(&self, frame_width: usize, frame_height: usize) -> Plane<T>
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.
sourcepub fn downscale(&self, scale: usize) -> Plane<T>
pub fn downscale(&self, scale: usize) -> Plane<T>
Returns a plane downscaled from the source plane by a factor of scale
(not padded)
sourcepub fn downscale_in_place(&self, scale: usize, in_plane: &mut Plane<T>)
pub fn downscale_in_place(&self, scale: usize, 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
.
Trait Implementations
impl<T> Eq for Plane<T> where
T: Eq + Pixel,
impl<T> StructuralEq for Plane<T> where
T: Pixel,
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more