Skip to main content

SplitConfig

Struct SplitConfig 

Source
pub struct SplitConfig {
    pub luma_weights: [f32; 3],
    pub base_offset: f32,
    pub alternate_offset: f32,
    pub min_log2: f32,
    pub max_log2: f32,
    pub pre_desaturate: f32,
    pub hlg_ootf_mode: HlgOotfMode,
}
Expand description

Splitter configuration.

Defaults are chosen so the splitter “just works” with any qualifying curve, including shadow-lifters like BT.2446 Method A. The min_log2 and max_log2 fields are safety clamps that prevent infinite gain at black or unreasonable values from numerical edge cases — they are not quality knobs. The actual gain range to store in zencodec::GainMapChannel.{min,max} should come from the SplitStats::observed_min_log2 / SplitStats::observed_max_log2 after a pass over the image.

Fields§

§luma_weights: [f32; 3]

RGB → Y weights. Must match the input primaries. Default: LUMA_BT2020.

§base_offset: f32

Offset on the base (SDR) image. Maps to GainMapChannel.base_offset. Default 1/64 matches ultrahdr-core::GainMapConfig.

§alternate_offset: f32

Offset on the alternate (HDR) image. Maps to GainMapChannel.alternate_offset. Default 1/64 matches ultrahdr-core::GainMapConfig.

§min_log2: f32

Sanity floor on log2 gain. Default -4.0 (1/16×) tolerates shadow-lifting curves like BT.2446 Method A.

§max_log2: f32

Sanity ceiling on log2 gain. Default 6.0 (64×) covers Apple Ultra HDR’s ~9-stop headroom plus margin.

§pre_desaturate: f32

Pre-desaturation (crosstalk) parameter in [0.0, 0.33).

Before the chromaticity-preserving RGB rescale, each HDR channel is blended toward the pixel’s mean:

R' = (1 − 2α)·R + α·G + α·B

This pulls saturated primaries toward gray, reducing the chance that the SDR rescale pushes a channel above 1.0 (out-of-gamut). The inverse matrix is applied after the gain is computed, so the desaturation is transparent to the round-trip.

0.0 = disabled (default). 0.10 is a conservative starting point; BT.2446-C uses up to 0.33 (but 0.33 is degenerate — collapses to grayscale).

§hlg_ootf_mode: HlgOotfMode

HLG OOTF formula used when linearizing HLG inputs.

Default: crate::pipeline::HlgOotfMode::Exact — spec-correct, luminance-preserving.

Set to crate::pipeline::HlgOotfMode::LibultrahdrCompat for bit-parity with libultrahdr’s encode path, which uses per-channel pow(c, γ). Only affects LumaGainMapSplitter::split_hlg_row / LumaGainMapSplitter::apply_hlg_row (and the public crate::gainmap::hlg_to_normalized_linear_row_with_mode helper); PQ paths are unaffected.

Trait Implementations§

Source§

impl Clone for SplitConfig

Source§

fn clone(&self) -> SplitConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SplitConfig

Source§

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

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

impl Default for SplitConfig

Source§

fn default() -> SplitConfig

Returns the “default value” for a type. Read more
Source§

impl Copy for SplitConfig

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.