Skip to main content

GainMapApplier

Struct GainMapApplier 

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

Reusable, O(width)-memory, row-streaming ISO 21496-1 gain-map reconstructor.

Operates in stored-frame coordinates (base_w × base_h) and exposes pending_orientation so streaming callers can pass pending EXIF orientation through or bake it after decode. All internal scratch rows are padded to a multiple of 8 (w_pad), allowing SIMD vertical blend, exp2 gain decode, and linear RGB(A) combine kernels to run pure SIMD-only loops.

Implementations§

Source§

impl GainMapApplier

Source

pub fn for_view( dual: &DualLayerHdrView<'_>, config: &GainMapApplyConfig, ) -> Result<Self, At<ConvertError>>

Construct a streaming applier directly from a validated DualLayerHdrView.

Rejects non-Identity orientation when config.orientation == GainMapOrientation::RequireIdentity.

Source

pub fn new( base: GainMapLayer, gain_map: GainMapLayer, metadata: GainMapMetadata, alternate_color_space: Option<&ColorSpace>, config: &GainMapApplyConfig, ) -> Result<Self, At<ConvertError>>

Construct a streaming applier from explicit base and gain-map layer descriptors and metadata.

Source

pub fn destination_format(&self) -> &PixelFormat

Output PixelFormat produced by this applier (in stored-frame coordinates).

Source

pub const fn pending_orientation(&self) -> Orientation

Pending EXIF Orientation captured from DualLayerHdrView (Orientation::Identity when constructed directly via GainMapApplier::new).

Source

pub const fn signed_weight(&self) -> f32

Signed ISO 21496-1 application weight (0.0 = exact base bypass, >0 = Forward, <0 = Reverse).

Source

pub const fn is_zero_weight(&self) -> bool

Whether gain-map sampling and additive offsets are bypassed completely (signed_weight == 0.0).

Source

pub fn reset_cache(&mut self)

Clear cached horizontally-upsampled gain rows (call before reusing on a different gain map).

Source

pub fn apply_row( &mut self, row_index: u32, base_row: &[u8], gain_map: &PixelView<'_>, dst_row: &mut [u8], ) -> Result<(), At<ConvertError>>

Reconstruct row row_index from base_row and a borrowed decoded gain_map view into dst_row.

Source

pub fn apply_row_with_provider<'a, F>( &mut self, row_index: u32, base_row: &[u8], fetch_gm_row: F, dst_row: &mut [u8], ) -> Result<(), At<ConvertError>>
where F: FnMut(u32) -> Result<&'a [u8], At<ConvertError>>,

Reconstruct row row_index while lazily pulling gain-map rows gy on demand via a fallible fetch_gm_row provider.

On resampled paths (Bilinear, Bicubic, Mitchell), horizontally-upsampled gain rows are cached across consecutive row_index so fetch_gm_row is invoked at most once per unique gain-map row during sequential top-to-bottom decode. Short provider rows return Err(ConvertError::DimensionMismatch) rather than panicking.

Source

pub fn apply_into<S: PixelSource + ?Sized, D: PixelSink + ?Sized>( &mut self, base: &S, gain_map: &PixelView<'_>, dst: &mut D, pulse: Option<&dyn Pulse>, ) -> Result<(), At<ConvertError>>

Stream an entire image from any PixelSource + borrowed gain_map into any PixelSink (PixelBuf, PixelViewMut, BandedBuf) in stored-frame coordinates using O(width) scratch memory, observing optional cooperative cancellation and row progress via pulse (pass None when not needed).

Trait Implementations§

Source§

impl Clone for GainMapApplier

Source§

fn clone(&self) -> GainMapApplier

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 GainMapApplier

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.