#[non_exhaustive]pub struct GainMapExtractConfig {Show 15 fields
pub scale_factor: u8,
pub downsample: GainMapDownsample,
pub multi_channel: bool,
pub sample_type: SampleType,
pub packing: BitPacking,
pub min_gain_stops: f32,
pub max_gain_stops: f32,
pub gamma: f32,
pub base_offset: f32,
pub alternate_offset: f32,
pub base_hdr_headroom_stops: f32,
pub alternate_hdr_headroom_stops: f32,
pub application_space: GainMapColorSpace,
pub content_fit: bool,
pub policy: ConvertPolicy,
}Expand description
Configuration for ISO 21496-1 gain-map extraction (extract_gain_map_only,
GainMapRowExtractor).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.scale_factor: u8Subsampling divisor for the output gain map (1 = full resolution, 4 = ¼-res
UltraHDR standard; output dimensions are div_ceil(scale_factor)).
downsample: GainMapDownsampleDownsampling filter applied when scale_factor > 1.
multi_channel: boolfalse = 1-channel luminance gain map (GainMapChannels::Shared);
true = 3-channel RGB gain map (GainMapChannels::PerChannel).
sample_type: SampleTypeSample storage type (U8 default, or U16 for 10/12/16-bit AVIF/JXL maps).
packing: BitPackingBit packing for integer gain-map samples (BitPacking::Full default; e.g.
BitPacking::Lsb { bits: 10 } for 10-bit AVIF/JXL maps).
min_gain_stops: f32Minimum encoded log₂ gain stop (code 0).
max_gain_stops: f32Maximum encoded log₂ gain stop (code max_code).
gamma: f32Gain-map gamma (> 0.0, default 1.0).
base_offset: f32Linear base offset (k_base, default 1/64).
alternate_offset: f32Linear alternate offset (k_alt, default 1/64).
base_hdr_headroom_stops: f32Base rendition HDR headroom in log₂ stops (0.0 = SDR base).
alternate_hdr_headroom_stops: f32Alternate rendition HDR headroom in log₂ stops (> base = Forward, < base = Reverse).
application_space: GainMapColorSpacePrimaries in which channelwise gain is computed (Base or Alternate).
content_fit: boolWhen true, performs a 2-pass content-fit scan that narrows the quantization grid
to the content’s observed gain range within [min_gain_stops, max_gain_stops]
(minimum span CONTENT_FIT_MIN_SPAN_STOPS).
policy: ConvertPolicyConversion policy used to linearize base and alternate inputs.
Implementations§
Source§impl GainMapExtractConfig
impl GainMapExtractConfig
Sourcepub fn ultrahdr() -> Self
pub fn ultrahdr() -> Self
Standard UltraHDR preset (¼-res scale_factor = 4, 1-ch U8, [0, ~2.58] stops =
1×..=6× linear boost, 1/64 offsets, Box area downsampling).
Sourcepub fn with_scale_factor(self, scale_factor: u8) -> Self
pub fn with_scale_factor(self, scale_factor: u8) -> Self
Set gain-map subsampling divisor (>= 1).
Sourcepub fn with_downsample(self, downsample: GainMapDownsample) -> Self
pub fn with_downsample(self, downsample: GainMapDownsample) -> Self
Set downsampling filter when scale_factor > 1.
Sourcepub fn with_multi_channel(self, multi_channel: bool) -> Self
pub fn with_multi_channel(self, multi_channel: bool) -> Self
Select 1-channel (false) vs 3-channel RGB (true) gain map.
Sourcepub fn with_sample_storage(
self,
sample_type: SampleType,
packing: BitPacking,
) -> Self
pub fn with_sample_storage( self, sample_type: SampleType, packing: BitPacking, ) -> Self
Select integer storage type & packing (e.g. (SampleType::U16, BitPacking::Lsb { bits: 10 })).
Sourcepub fn with_gain_range_stops(self, min_stops: f32, max_stops: f32) -> Self
pub fn with_gain_range_stops(self, min_stops: f32, max_stops: f32) -> Self
Set quantization grid in log₂ stops.
Sourcepub fn with_boost_range_linear(self, min_boost: f32, max_boost: f32) -> Self
pub fn with_boost_range_linear(self, min_boost: f32, max_boost: f32) -> Self
Set quantization grid from positive linear boost ratios (e.g. 1.0, 6.0).
Sourcepub fn with_gamma(self, gamma: f32) -> Self
pub fn with_gamma(self, gamma: f32) -> Self
Set gain-map encoding gamma (> 0.0).
Sourcepub fn with_offsets(self, base_offset: f32, alternate_offset: f32) -> Self
pub fn with_offsets(self, base_offset: f32, alternate_offset: f32) -> Self
Set linear base & alternate offsets.
Sourcepub fn with_headroom_stops(self, base_stops: f32, alternate_stops: f32) -> Self
pub fn with_headroom_stops(self, base_stops: f32, alternate_stops: f32) -> Self
Set base and alternate HDR headrooms in log₂ stops.
Sourcepub fn with_headroom_boost_linear(
self,
base_boost: f32,
alternate_boost: f32,
) -> Self
pub fn with_headroom_boost_linear( self, base_boost: f32, alternate_boost: f32, ) -> Self
Set base and alternate HDR headrooms from linear boost ratios (1.0 → 0.0 stops).
Sourcepub fn with_application_space(self, space: GainMapColorSpace) -> Self
pub fn with_application_space(self, space: GainMapColorSpace) -> Self
Choose whether gain is computed in Base or Alternate linear primaries.
Sourcepub fn with_content_fit(self, content_fit: bool) -> Self
pub fn with_content_fit(self, content_fit: bool) -> Self
Enable 2-pass content-fit grid narrowing to the observed content gain range.
Sourcepub fn with_policy(self, policy: ConvertPolicy) -> Self
pub fn with_policy(self, policy: ConvertPolicy) -> Self
Set conversion policy used to linearize base and alternate images.
Sourcepub fn to_metadata(&self) -> Result<GainMapMetadata, At<ConvertError>>
pub fn to_metadata(&self) -> Result<GainMapMetadata, At<ConvertError>>
Build the exact GainMapMetadata matching this configuration’s quantization grid.
Trait Implementations§
Source§impl Clone for GainMapExtractConfig
impl Clone for GainMapExtractConfig
Source§fn clone(&self) -> GainMapExtractConfig
fn clone(&self) -> GainMapExtractConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more