pub struct PlanarView<'a> { /* private fields */ }Expand description
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>
impl<'a> PlanarView<'a>
Sourcepub fn new(
width: u32,
height: u32,
planes: &[PlaneView<'a>],
) -> Result<PlanarView<'a>, At<BufferError>>
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).
Sourcepub fn new_with_crop_origin(
width: u32,
height: u32,
crop_origin: (u32, u32),
chroma_siting: ChromaSiting,
planes: &[PlaneView<'a>],
) -> Result<PlanarView<'a>, At<BufferError>>
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.
Sourcepub const fn crop_origin(&self) -> (u32, u32)
pub const fn crop_origin(&self) -> (u32, u32)
Crop origin (x, y) in full-resolution parent-frame coordinates.
Sourcepub const fn chroma_siting(&self) -> ChromaSiting
pub const fn chroma_siting(&self) -> ChromaSiting
Chroma sample siting for subsampled planes.
Sourcepub fn with_chroma_siting(self, siting: ChromaSiting) -> PlanarView<'a>
pub fn with_chroma_siting(self, siting: ChromaSiting) -> PlanarView<'a>
Replace chroma sample siting on this borrowed view.
Sourcepub fn color(&self) -> Option<&ColorSpace>
pub fn color(&self) -> Option<&ColorSpace>
Optional color interpretation of these planes.
Sourcepub fn with_color(self, color: ColorSpace) -> PlanarView<'a>
pub fn with_color(self, color: ColorSpace) -> PlanarView<'a>
Attach color interpretation to this borrowed planar view.
Sourcepub fn with_color_ref(self, color: &'a ColorSpace) -> PlanarView<'a>
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.
Sourcepub const fn matrix_coefficients(&self) -> Option<MatrixCoefficients>
pub const fn matrix_coefficients(&self) -> Option<MatrixCoefficients>
Optional ITU-T H.273 MatrixCoefficients (BT709, BT601, BT2020_NCL, IDENTITY, etc.).
Sourcepub fn with_matrix_coefficients(
self,
matrix: MatrixCoefficients,
) -> PlanarView<'a>
pub fn with_matrix_coefficients( self, matrix: MatrixCoefficients, ) -> PlanarView<'a>
Attach ITU-T H.273 MatrixCoefficients.
Sourcepub const fn range_override(&self) -> Option<SignalRange>
pub const fn range_override(&self) -> Option<SignalRange>
Explicit signal range override, if set separately from color.
Sourcepub fn effective_range(&self) -> Option<SignalRange>
pub fn effective_range(&self) -> Option<SignalRange>
Effective signal range (range_override or color’s range).
Sourcepub fn with_range_override(self, range: SignalRange) -> PlanarView<'a>
pub fn with_range_override(self, range: SignalRange) -> PlanarView<'a>
Attach an explicit signal range override.
Sourcepub const fn alpha_override(&self) -> Option<AlphaMode>
pub const fn alpha_override(&self) -> Option<AlphaMode>
Explicit alpha association override, if set separately from color.
Sourcepub fn effective_alpha(&self) -> Option<AlphaMode>
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.
Sourcepub fn with_alpha_override(self, alpha: AlphaMode) -> PlanarView<'a>
pub fn with_alpha_override(self, alpha: AlphaMode) -> PlanarView<'a>
Attach an explicit alpha association override.
Sourcepub fn hdr(&self) -> HdrMetadata
pub fn hdr(&self) -> HdrMetadata
Descriptive HDR container metadata attached to this planar view.
Sourcepub fn hdr_ref(&self) -> Option<&HdrMetadata>
pub fn hdr_ref(&self) -> Option<&HdrMetadata>
Zero-copy reference to attached non-empty HDR metadata (None if empty/unset).
Sourcepub fn with_hdr(self, hdr: HdrMetadata) -> PlanarView<'a>
pub fn with_hdr(self, hdr: HdrMetadata) -> PlanarView<'a>
Attach descriptive HDR container metadata to this planar view.
Sourcepub fn with_hdr_ref(self, hdr: &'a HdrMetadata) -> PlanarView<'a>
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()).
Sourcepub const fn origin(&self) -> Option<&'a ColorOrigin>
pub const fn origin(&self) -> Option<&'a ColorOrigin>
Borrowed original container color provenance, if attached.
Sourcepub const fn with_origin(self, origin: &'a ColorOrigin) -> PlanarView<'a>
pub const fn with_origin(self, origin: &'a ColorOrigin) -> PlanarView<'a>
Attach borrowed container color provenance to this planar view.
Sourcepub const fn orientation(&self) -> Orientation
pub const fn orientation(&self) -> Orientation
Pending EXIF display orientation attached to this planar view.
Sourcepub const fn display_dimensions(&self) -> (u32, u32)
pub const fn display_dimensions(&self) -> (u32, u32)
Display-oriented (width, height) after applying orientation.
Sourcepub fn with_orientation(self, orientation: Orientation) -> PlanarView<'a>
pub fn with_orientation(self, orientation: Orientation) -> PlanarView<'a>
Replace pending EXIF display orientation on this planar view.
Sourcepub fn compose_orientation(self, delta: Orientation) -> PlanarView<'a>
pub fn compose_orientation(self, delta: Orientation) -> PlanarView<'a>
Compose an additional display transform onto pending orientation in O(1).
Sourcepub fn plane_by_role(&self, role: PlaneRole) -> Option<PlaneView<'a>>
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.
Sourcepub fn crop(&self, rect: PixelRect) -> Result<PlanarView<'a>, At<BufferError>>
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.
Sourcepub fn sub_rows(
&self,
start_y: u32,
row_count: u32,
) -> Result<PlanarView<'a>, At<BufferError>>
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<'_>
impl PlanarView<'_>
Sourcepub fn hash_with(&self, inclusions: HashInclusions) -> u64
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>
impl<'a> Clone for PlanarView<'a>
Source§fn clone(&self) -> PlanarView<'a>
fn clone(&self) -> PlanarView<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for PlanarView<'a>
impl<'a> Debug for PlanarView<'a>
Source§impl PlanarConvertExt for PlanarView<'_>
impl PlanarConvertExt for PlanarView<'_>
Source§fn reconstruct_f32(
&self,
options: &PlanarReconstructionOptions,
) -> Result<PixelBuf, At<ConvertError>>
fn reconstruct_f32( &self, options: &PlanarReconstructionOptions, ) -> Result<PixelBuf, At<ConvertError>>
RGBF32 / RGBAF32 PixelBuf directly from a tagged
PlanarView (color(), effective_range(), matrix_coefficients(),
effective_alpha(), hdr(), origin(), and orientation()). Read moreSource§fn reconstruct_to_buf(
&self,
dst_layout: SampleLayout,
options: &PlanarReconstructionOptions,
) -> Result<PixelBuf, At<ConvertError>>
fn reconstruct_to_buf( &self, dst_layout: SampleLayout, options: &PlanarReconstructionOptions, ) -> Result<PixelBuf, At<ConvertError>>
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 moreSource§fn reconstruct_into(
&self,
dst: &mut PixelViewMut<'_>,
options: &PlanarReconstructionOptions,
) -> Result<(), At<ConvertError>>
fn reconstruct_into( &self, dst: &mut PixelViewMut<'_>, options: &PlanarReconstructionOptions, ) -> Result<(), At<ConvertError>>
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