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: f32Offset on the base (SDR) image. Maps to GainMapChannel.base_offset.
Default 1/64 matches ultrahdr-core::GainMapConfig.
alternate_offset: f32Offset on the alternate (HDR) image. Maps to GainMapChannel.alternate_offset.
Default 1/64 matches ultrahdr-core::GainMapConfig.
min_log2: f32Sanity floor on log2 gain. Default -4.0 (1/16×) tolerates
shadow-lifting curves like BT.2446 Method A.
max_log2: f32Sanity ceiling on log2 gain. Default 6.0 (64×) covers Apple
Ultra HDR’s ~9-stop headroom plus margin.
pre_desaturate: f32Pre-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 + α·BThis 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: HlgOotfModeHLG 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
impl Clone for SplitConfig
Source§fn clone(&self) -> SplitConfig
fn clone(&self) -> SplitConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more