pub struct Plane<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: PlaneConfigPlane configuration.
Implementations§
source§impl<T: Pixel> Plane<T>
 
impl<T: Pixel> Plane<T>
sourcepub fn new(
    width: usize,
    height: usize,
    xdec: usize,
    ydec: usize,
    xpad: usize,
    ypad: usize
) -> Self
 
pub fn new( width: usize, height: usize, xdec: usize, ydec: usize, xpad: usize, ypad: usize ) -> Self
Allocates and returns a new plane.
sourcepub fn from_slice(data: &[T], stride: usize) -> Self
 
pub fn from_slice(data: &[T], stride: usize) -> Self
§Panics
- If 
lenis not a multiple ofstride 
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>
sourcepub fn row_range_cropped(&self, x: isize, y: isize) -> Range<usize>
 
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
sourcepub fn row_range(&self, x: isize, y: isize) -> Range<usize>
 
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
sourcepub fn data_origin(&self) -> &[T]
 
pub fn data_origin(&self) -> &[T]
Returns plane data starting from the origin.
sourcepub fn data_origin_mut(&mut self) -> &mut [T]
 
pub fn data_origin_mut(&mut self) -> &mut [T]
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.
§Panics
- If 
source_bytewidthdoes not match the genericTofPlane 
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.
§Panics
- If 
dest_bytewidthdoes not match the genericTofPlane 
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.
§Panics
- If the requested width and height are > half the input width or height
 
sourcepub fn downscale<const SCALE: usize>(&self) -> Plane<T>
 
pub fn downscale<const SCALE: usize>(&self) -> Plane<T>
Returns a plane downscaled from the source plane by a factor of scale (not padded)
sourcepub fn downscale_in_place<const SCALE: usize>(&self, in_plane: &mut Plane<T>)
 
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)
§Panics
- If the current plane’s width and height are not at least 
SCALEtimes thein_plane’s 
sourcepub fn iter(&self) -> PlaneIter<'_, T> ⓘ
 
pub fn iter(&self) -> PlaneIter<'_, T> ⓘ
Iterates over the pixels in the plane, skipping the padding.