Skip to main content

RowPlan

Struct RowPlan 

Source
pub struct RowPlan { /* private fields */ }
Expand description

Compiled, reusable, thread-safe single-row pixel converter.

Built via RowPlan::build with an explicit optional hdr_peak: Option<Nits>. Calling convert_row on native routes allocates zero heap memory and uses a 1 KiB stack-allocated 64-pixel SoA tile.

Implementations§

Source§

impl RowPlan

Source

pub fn build( src: impl AsRef<PixelFormat>, dst: impl AsRef<PixelFormat>, policy: &ConvertPolicy, resolved_source_peak: Option<Nits>, ) -> Result<Self, At<ConvertError>>

Compile a single-row conversion plan from src to dst under policy.

Accepts either borrowed &PixelFormat or owned PixelFormat at the call site (retaining internal clones inside the compiled plan).

For HDR → SDR tone mapping with a pipeline-managed mapper, pass resolved_source_peak: Some(nits) (None means no peak supplied — never “measure this row”). To measure peak automatically over a whole image, use ImagePlan::build with PeakSource::Measured.

Source

pub fn build_with_pulse( src: impl AsRef<PixelFormat>, dst: impl AsRef<PixelFormat>, policy: &ConvertPolicy, resolved_source_peak: Option<Nits>, pulse: Option<&dyn Pulse>, ) -> Result<Self, At<ConvertError>>

Build a compiled RowPlan with optional cooperative cancellation and progress via pulse (forwarded to CmsBackend::build_transform and ToneMapper::prepare; pass None when not needed).

Source

pub fn source_format(&self) -> &PixelFormat

Source image specification.

Source

pub fn destination_format(&self) -> &PixelFormat

Destination image specification.

Source

pub const fn output_claims(&self) -> SampleClaims

Proven SampleClaims guaranteed on pixels emitted by this plan.

Source

pub fn is_identity(&self) -> bool

Whether this plan executes as a direct byte-copy (Memcpy) route with no per-sample work.

Includes identical src == dst (unless unverified AlphaMode::Opaque requires alpha canonicalization) as well as same-layout proven-opaque Straight <-> Premultiplied or same-layout metadata relabels that need no pixel transformation.

Source

pub fn convert_row( &self, src_row: &[u8], dst_row: &mut [u8], width_pixels: u32, ) -> Result<(), At<ConvertError>>

Convert a single row of width_pixels pixels from src_row into dst_row with zero heap allocation.

Uses row index 0 for ordered dithering. When converting a multi-row image with DepthPolicy::OrderedDither, use convert_row_at to pass the vertical row coordinate so the 2D Bayer 4×4 matrix varies across rows.

Source

pub fn convert_row_at( &self, row_index: u32, src_row: &[u8], dst_row: &mut [u8], width_pixels: u32, ) -> Result<(), At<ConvertError>>

Convert a single row of width_pixels pixels at vertical coordinate row_index from src_row into dst_row with zero heap allocation.

row_index selects the vertical phase of the 2D Bayer 4×4 matrix under DepthPolicy::OrderedDither so strips and bands produce identical dither patterns to whole-image conversion.

Trait Implementations§

Source§

impl Clone for RowPlan

Source§

fn clone(&self) -> RowPlan

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 Debug for RowPlan

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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.