Skip to main content

PlanarView

Struct PlanarView 

Source
pub struct PlanarView<'a> { /* private fields */ }
Expand description

Full re-export of zenpixels core types (zero module name collisions!). Borrowed multi-plane view (zero heap allocation for 1..=4 planes; spills cleanly for 5..=64 planes).

Tracks crop_origin in full-resolution luma coordinates, ChromaSiting, and optional color interpretation (color, matrix_coefficients, range_override, alpha_override) so subsampled chroma crops and YCbCr decoders carry full color authority.

Implementations§

Source§

impl<'a> PlanarView<'a>

Source

pub fn new( width: u32, height: u32, planes: &[PlaneView<'a>], ) -> Result<PlanarView<'a>, At<BufferError>>

Construct a validated multi-plane borrowed view (1..=64 planes) at crop origin (0, 0).

Source

pub fn new_with_crop_origin( width: u32, height: u32, crop_origin: (u32, u32), chroma_siting: ChromaSiting, planes: &[PlaneView<'a>], ) -> Result<PlanarView<'a>, At<BufferError>>

Construct a validated multi-plane borrowed view with explicit parent-frame crop_origin and ChromaSiting.

Color, chroma, and alpha planes must match cropped_plane_dimensions; auxiliary planes (PlaneRole::is_auxiliary: GainMap, Depth, Matte, Thermal, Extra) may carry arbitrary independent positive dimensions.

Source

pub const fn width(&self) -> u32

Frame width in pixels.

Source

pub const fn height(&self) -> u32

Frame height in rows.

Source

pub const fn crop_origin(&self) -> (u32, u32)

Crop origin (x, y) in full-resolution parent-frame coordinates.

Source

pub const fn chroma_siting(&self) -> ChromaSiting

Chroma sample siting for subsampled planes.

Source

pub fn with_chroma_siting(self, siting: ChromaSiting) -> PlanarView<'a>

Replace chroma sample siting on this borrowed view.

Source

pub fn color(&self) -> Option<&ColorSpace>

Optional color interpretation of these planes.

Source

pub fn with_color(self, color: ColorSpace) -> PlanarView<'a>

Attach color interpretation to this borrowed planar view.

Source

pub fn with_color_ref(self, color: &'a ColorSpace) -> PlanarView<'a>

Borrow color interpretation onto this planar view with zero heap allocation and zero atomic refcount overhead.

Source

pub const fn matrix_coefficients(&self) -> Option<MatrixCoefficients>

Optional ITU-T H.273 MatrixCoefficients (BT709, BT601, BT2020_NCL, IDENTITY, etc.).

Source

pub fn with_matrix_coefficients( self, matrix: MatrixCoefficients, ) -> PlanarView<'a>

Attach ITU-T H.273 MatrixCoefficients.

Source

pub const fn range_override(&self) -> Option<SignalRange>

Explicit signal range override, if set separately from color.

Source

pub fn effective_range(&self) -> Option<SignalRange>

Effective signal range (range_override or color’s range).

Source

pub fn with_range_override(self, range: SignalRange) -> PlanarView<'a>

Attach an explicit signal range override.

Source

pub const fn alpha_override(&self) -> Option<AlphaMode>

Explicit alpha association override, if set separately from color.

Source

pub fn effective_alpha(&self) -> Option<AlphaMode>

Plane-aware effective alpha association mode.

Returns None when no PlaneRole::Alpha (or PlaneRole::Packed) plane is present. Otherwise checks alpha_override first and falls back to color’s alpha mode, ignoring AlphaMode::None / AlphaMode::Undefined.

Source

pub fn with_alpha_override(self, alpha: AlphaMode) -> PlanarView<'a>

Attach an explicit alpha association override.

Source

pub fn hdr(&self) -> HdrMetadata

Descriptive HDR container metadata attached to this planar view.

Source

pub fn hdr_ref(&self) -> Option<&HdrMetadata>

Zero-copy reference to attached non-empty HDR metadata (None if empty/unset).

Source

pub fn with_hdr(self, hdr: HdrMetadata) -> PlanarView<'a>

Attach descriptive HDR container metadata to this planar view.

Source

pub fn with_hdr_ref(self, hdr: &'a HdrMetadata) -> PlanarView<'a>

Borrow descriptive HDR container metadata onto this planar view with zero heap allocation and zero atomic refcount overhead (ignores empty HdrMetadata::default()).

Source

pub const fn origin(&self) -> Option<&'a ColorOrigin>

Borrowed original container color provenance, if attached.

Source

pub const fn with_origin(self, origin: &'a ColorOrigin) -> PlanarView<'a>

Attach borrowed container color provenance to this planar view.

Source

pub const fn orientation(&self) -> Orientation

Pending EXIF display orientation attached to this planar view.

Source

pub const fn display_dimensions(&self) -> (u32, u32)

Display-oriented (width, height) after applying orientation.

Source

pub fn with_orientation(self, orientation: Orientation) -> PlanarView<'a>

Replace pending EXIF display orientation on this planar view.

Source

pub fn compose_orientation(self, delta: Orientation) -> PlanarView<'a>

Compose an additional display transform onto pending orientation in O(1).

Source

pub fn planes(&self) -> &[PlaneView<'a>]

Borrowed planes slice.

Source

pub fn plane_by_role(&self, role: PlaneRole) -> Option<PlaneView<'a>>

Look up the first plane matching role (e.g. PlaneRole::Y, PlaneRole::CbCr), returning a copy tied directly to 'a.

Source

pub fn crop(&self, rect: PixelRect) -> Result<PlanarView<'a>, At<BufferError>>

Zero-copy rectangular crop of all planes preserving exact parent-frame chroma phase even for odd (x, y) origins on 4:2:0 / 4:2:2 subsampled frames.

Source

pub fn sub_rows( &self, start_y: u32, row_count: u32, ) -> Result<PlanarView<'a>, At<BufferError>>

Zero-copy full-width horizontal strip of all planes preserving parent-frame chroma phase.

Source§

impl PlanarView<'_>

Source

pub fn hash_with(&self, inclusions: HashInclusions) -> u64

Compute a portable, endian- and stride-independent XXH3 fingerprint of this planar view.

Trait Implementations§

Source§

impl<'a> Clone for PlanarView<'a>

Source§

fn clone(&self) -> PlanarView<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for PlanarView<'a>

Source§

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

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

impl PlanarConvertExt for PlanarView<'_>

Source§

fn reconstruct_f32( &self, options: &PlanarReconstructionOptions, ) -> Result<PixelBuf, At<ConvertError>>

Reconstruct a full-range RGBF32 / RGBAF32 PixelBuf directly from a tagged PlanarView (color(), effective_range(), matrix_coefficients(), effective_alpha(), hdr(), origin(), and orientation()). Read more
Source§

fn reconstruct_to_buf( &self, dst_layout: SampleLayout, options: &PlanarReconstructionOptions, ) -> Result<PixelBuf, At<ConvertError>>

Reconstruct an interleaved PixelBuf with caller-chosen SampleLayout (RGB8, RGBA8, BGR8, BGRA8, RGBX8, BGRX8, RGB16, RGBA16, RGBF32, RGBAF32, GRAY8, GRAYA8, GRAY16, GRAYA16, GRAYF32, GRAYAF32) directly from a tagged PlanarView using explicit PlanarReconstructionOptions (e.g. siting-exact ChromaUpsample::Bilinear). Read more
Source§

fn reconstruct_into( &self, dst: &mut PixelViewMut<'_>, options: &PlanarReconstructionOptions, ) -> Result<(), At<ConvertError>>

Reconstruct a tagged PlanarView (YCbCr, GBR, planar RGB/RGBA, or monochrome) directly into a caller-provided strided U8, U16, or F32 PixelViewMut (RGB, RGBA, BGR, BGRA, RGBX, BGRX, Gray, GrayAlpha) with zero heap allocation. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PlanarView<'a>

§

impl<'a> RefUnwindSafe for PlanarView<'a>

§

impl<'a> Send for PlanarView<'a>

§

impl<'a> Sync for PlanarView<'a>

§

impl<'a> Unpin for PlanarView<'a>

§

impl<'a> UnsafeUnpin for PlanarView<'a>

§

impl<'a> UnwindSafe for PlanarView<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.