Skip to main content

Module gainmap

Module gainmap 

Source
Expand description

ISO 21496-1 / UltraHDR dual-layer gain-map reconstruction, resampling, orientation, and extraction.

Subsumes pure ISO 21496-1 pixel math in no_std + alloc, #![forbid(unsafe_code)] with 0-bit Accelerators::ALL == Accelerators::SCALAR parity and O(width) streaming memory:

Structs§

GainMapApplier
Reusable, O(width)-memory, row-streaming ISO 21496-1 gain-map reconstructor.
GainMapApplyConfig
Configuration for ISO 21496-1 gain-map reconstruction via GainMapApplier, apply_gain_map_oriented, or apply_gain_map_with.
GainMapExtractConfig
Configuration for ISO 21496-1 gain-map extraction (extract_gain_map_only, GainMapRowExtractor).
GainMapLayer
Layer format and stored pixel dimensions passed to GainMapApplier::new.
GainMapRowExtractor
Row-streaming linear-f32 ISO 21496-1 gain-map encoder.

Enums§

GainMapDownsample
Downsampling filter used during gain-map extraction when scale_factor > 1.
GainMapOrientation
Policy controlling how pending EXIF Orientation on a DualLayerHdrBuf / DualLayerHdrView is handled during whole-image gain-map reconstruction.
GainMapResample
Resampling filter used when the gain map resolution differs from the base image.
GainMapTarget
Target display headroom or explicit rendition endpoint for ISO 21496-1 reconstruction.
LinearInputChannels
Interleaved channel layout for linear f32 row buffers passed to GainMapRowExtractor::encode_row_linear_f32.

Constants§

CONTENT_FIT_MIN_SPAN_STOPS
Minimum log₂ span (1/16 stop) enforced by content-fitted extraction grids so uniform images never degenerate to a zero-width quantization range.

Functions§

apply_gain_map_oriented
Reconstruct a PixelBuf and its resulting pending Orientation from a zero-copy DualLayerHdrView according to config.orientation, with optional cooperative cancellation and progress via pulse (pass None when not needed):
apply_gain_map_with
Reconstruct a PixelBuf from a zero-copy DualLayerHdrView with full control over target headroom/rendition (GainMapApplyConfig::from_headroom_stops or GainMapApplyConfig::from_display_boost_linear), resampling kernel, orientation policy, conversion policy, optional target PixelFormat, and optional cooperative Pulse cancellation/progress (pass None when not needed).
bake_dual_layer_orientation
Physically bake dual.orientation() into both base and gain_map, returning an owned aligned DualLayerHdrBuf with Orientation::Identity.
bake_dual_layer_orientation_after
Physically bake dual.orientation().then(delta) into both base and gain_map, keeping both layers strictly registered and returning an owned DualLayerHdrBuf with Orientation::Identity.
bake_dual_layer_orientation_after_with_pulse
Physically bake dual.orientation().then(delta) into both base and gain_map with optional cooperative cancellation and progress via pulse (pass None when not needed).
bake_dual_layer_orientation_with_pulse
Physically bake dual.orientation() into both base and gain_map with optional cooperative cancellation and progress via pulse (pass None when not needed).
display_boost_to_headroom_stops
Convert a linear display boost ratio (e.g. 1.0 = SDR, 4.0 = 4× HDR) into ISO 21496-1 log₂ headroom stops (0.0 for <= 1.0 or non-finite).
extract_gain_map
Extract an ISO 21496-1 DualLayerHdrBuf at 1:1 resolution from base_src and alternate_src using exact caller-supplied metadata verbatim.
extract_gain_map_only
Extract only the numeric gain-map PixelBuf and exact GainMapMetadata from borrowed base_src and alternate_src views without duplicating the base raster, observing optional cooperative cancellation and progress via pulse (pass None when not needed).
extract_gain_map_with_pulse
Extract an ISO 21496-1 DualLayerHdrBuf at 1:1 resolution with optional cooperative cancellation and progress via pulse (pass None when not needed).
full_reconstruction_headroom_stops
Full-reconstruction display headroom in log₂ stops (metadata.alternate_hdr_headroom()).
signed_weight
Compute the ISO 21496-1 signed application weight for display_headroom_stops using exact i128 rational cross-products (never divides by zero or yields NaN on close valid rationals):
signed_weight_for_target
Compute a target’s signed application weight. See GainMapTarget::signed_weight.