Skip to main content

GainMapExtractConfig

Struct GainMapExtractConfig 

Source
#[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
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§scale_factor: u8

Subsampling divisor for the output gain map (1 = full resolution, 4 = ¼-res UltraHDR standard; output dimensions are div_ceil(scale_factor)).

§downsample: GainMapDownsample

Downsampling filter applied when scale_factor > 1.

§multi_channel: bool

false = 1-channel luminance gain map (GainMapChannels::Shared); true = 3-channel RGB gain map (GainMapChannels::PerChannel).

§sample_type: SampleType

Sample storage type (U8 default, or U16 for 10/12/16-bit AVIF/JXL maps).

§packing: BitPacking

Bit packing for integer gain-map samples (BitPacking::Full default; e.g. BitPacking::Lsb { bits: 10 } for 10-bit AVIF/JXL maps).

§min_gain_stops: f32

Minimum encoded log₂ gain stop (code 0).

§max_gain_stops: f32

Maximum encoded log₂ gain stop (code max_code).

§gamma: f32

Gain-map gamma (> 0.0, default 1.0).

§base_offset: f32

Linear base offset (k_base, default 1/64).

§alternate_offset: f32

Linear alternate offset (k_alt, default 1/64).

§base_hdr_headroom_stops: f32

Base rendition HDR headroom in log₂ stops (0.0 = SDR base).

§alternate_hdr_headroom_stops: f32

Alternate rendition HDR headroom in log₂ stops (> base = Forward, < base = Reverse).

§application_space: GainMapColorSpace

Primaries in which channelwise gain is computed (Base or Alternate).

§content_fit: bool

When 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: ConvertPolicy

Conversion policy used to linearize base and alternate inputs.

Implementations§

Source§

impl GainMapExtractConfig

Source

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).

Source

pub fn with_scale_factor(self, scale_factor: u8) -> Self

Set gain-map subsampling divisor (>= 1).

Source

pub fn with_downsample(self, downsample: GainMapDownsample) -> Self

Set downsampling filter when scale_factor > 1.

Source

pub fn with_multi_channel(self, multi_channel: bool) -> Self

Select 1-channel (false) vs 3-channel RGB (true) gain map.

Source

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 })).

Source

pub fn with_gain_range_stops(self, min_stops: f32, max_stops: f32) -> Self

Set quantization grid in log₂ stops.

Source

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).

Source

pub fn with_gamma(self, gamma: f32) -> Self

Set gain-map encoding gamma (> 0.0).

Source

pub fn with_offsets(self, base_offset: f32, alternate_offset: f32) -> Self

Set linear base & alternate offsets.

Source

pub fn with_headroom_stops(self, base_stops: f32, alternate_stops: f32) -> Self

Set base and alternate HDR headrooms in log₂ stops.

Source

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).

Source

pub fn with_application_space(self, space: GainMapColorSpace) -> Self

Choose whether gain is computed in Base or Alternate linear primaries.

Source

pub fn with_content_fit(self, content_fit: bool) -> Self

Enable 2-pass content-fit grid narrowing to the observed content gain range.

Source

pub fn with_policy(self, policy: ConvertPolicy) -> Self

Set conversion policy used to linearize base and alternate images.

Source

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

Source§

fn clone(&self) -> GainMapExtractConfig

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 GainMapExtractConfig

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for GainMapExtractConfig

Source§

fn default() -> Self

Returns the “default value” for a type. 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.