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
impl GainMapApplier
Sourcepub fn for_view(
dual: &DualLayerHdrView<'_>,
config: &GainMapApplyConfig,
) -> Result<Self, At<ConvertError>>
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.
Sourcepub fn new(
base: GainMapLayer,
gain_map: GainMapLayer,
metadata: GainMapMetadata,
alternate_color_space: Option<&ColorSpace>,
config: &GainMapApplyConfig,
) -> Result<Self, At<ConvertError>>
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.
Sourcepub fn destination_format(&self) -> &PixelFormat
pub fn destination_format(&self) -> &PixelFormat
Output PixelFormat produced by this applier (in stored-frame coordinates).
Sourcepub const fn pending_orientation(&self) -> Orientation
pub const fn pending_orientation(&self) -> Orientation
Pending EXIF Orientation captured from DualLayerHdrView (Orientation::Identity
when constructed directly via GainMapApplier::new).
Sourcepub const fn signed_weight(&self) -> f32
pub const fn signed_weight(&self) -> f32
Signed ISO 21496-1 application weight (0.0 = exact base bypass, >0 = Forward, <0 = Reverse).
Sourcepub const fn is_zero_weight(&self) -> bool
pub const fn is_zero_weight(&self) -> bool
Whether gain-map sampling and additive offsets are bypassed completely (signed_weight == 0.0).
Sourcepub fn reset_cache(&mut self)
pub fn reset_cache(&mut self)
Clear cached horizontally-upsampled gain rows (call before reusing on a different gain map).
Sourcepub fn apply_row(
&mut self,
row_index: u32,
base_row: &[u8],
gain_map: &PixelView<'_>,
dst_row: &mut [u8],
) -> Result<(), At<ConvertError>>
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.
Sourcepub 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>>
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>>
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.
Sourcepub 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>>
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
impl Clone for GainMapApplier
Source§fn clone(&self) -> GainMapApplier
fn clone(&self) -> GainMapApplier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more