Skip to main content

PlanarConvertExt

Trait PlanarConvertExt 

Source
pub trait PlanarConvertExt: Sealed {
    // Required methods
    fn reconstruct_f32(
        &self,
        options: &PlanarReconstructionOptions,
    ) -> Result<PixelBuf, At<ConvertError>>;
    fn reconstruct_to_buf(
        &self,
        dst_layout: SampleLayout,
        options: &PlanarReconstructionOptions,
    ) -> Result<PixelBuf, At<ConvertError>>;
    fn reconstruct_into(
        &self,
        dst: &mut PixelViewMut<'_>,
        options: &PlanarReconstructionOptions,
    ) -> Result<(), At<ConvertError>>;
}
Expand description

Reconstruct interleaved pixels from a tagged PlanarView.

Required Methods§

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()).

Handles 3-plane YCbCr (Y, Cb, Cr), 2-plane semi-planar YCbCr (Y, CbCr / CrCb, e.g. NV12 / P010), 3-plane RGB (R, G, B), and 1-plane monochrome (Y), each with optional Alpha plane, using caller-chosen PlanarReconstructionOptions (e.g. PlanarReconstructionOptions::bilinear() or PlanarReconstructionOptions::nearest()).

Refuses views missing required range, color space (Rgb / Gray), or (for YCbCr chroma views) recognized ITU-T H.273 MatrixCoefficients with ConvertError::UnsupportedRoute.

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).

Reads source interpretation (color(), effective_range(), matrix_coefficients(), effective_alpha()) from self, derives the output ColorSpace, and propagates self.hdr(), self.origin(), and self.orientation() onto the returned PixelBuf.

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.

Uses the exact same source interpretation metadata as Self::reconstruct_to_buf (color(), effective_range(), matrix_coefficients(), effective_alpha()), and validates that dst.format().color matches the derived full-range destination color space (refusing mismatched primaries, transfer, white point, narrow range, or conflicting alpha semantics rather than silently converting). Sets dst.set_orientation(src.orientation()); hdr() and origin() remain caller-managed on the destination storage.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§