pub struct LumaGainMapSplitter<T>where
T: LumaToneMap,{ /* private fields */ }Expand description
Splits HDR rows into (SDR, log2-gain) pairs around a LumaToneMap.
Stateless after construction. Safe to share across threads (Sync)
when the inner curve is Sync.
Implementations§
Source§impl<T> LumaGainMapSplitter<T>where
T: LumaToneMap,
impl<T> LumaGainMapSplitter<T>where
T: LumaToneMap,
Sourcepub fn new(curve: T, cfg: SplitConfig) -> LumaGainMapSplitter<T>
pub fn new(curve: T, cfg: SplitConfig) -> LumaGainMapSplitter<T>
Construct from a curve and config.
Sourcepub fn config(&self) -> &SplitConfig
pub fn config(&self) -> &SplitConfig
Borrow the configuration (e.g. to feed into GainMapParams).
Sourcepub fn split_row(
&self,
hdr: &[f32],
sdr_out: &mut [f32],
gain_out: &mut [f32],
channels: u8,
stats: &mut SplitStats,
)
pub fn split_row( &self, hdr: &[f32], sdr_out: &mut [f32], gain_out: &mut [f32], channels: u8, stats: &mut SplitStats, )
Encode one row.
hdr: linear-light HDR (length = pixels · channels).
sdr_out: receives linear SDR; must match hdr.len().
gain_out: receives one log2 gain per pixel; length = pixels.
stats: accumulator; updated in place.
Panics if channels is not 3 or 4, or if lengths mismatch.
Sourcepub fn apply_row(
&self,
sdr: &[f32],
gain: &[f32],
hdr_out: &mut [f32],
channels: u8,
)
pub fn apply_row( &self, sdr: &[f32], gain: &[f32], hdr_out: &mut [f32], channels: u8, )
Decode one row: SDR + log2 gain → HDR.
Inverse of Self::split_row (modulo SDR clipping recorded in
SplitStats::clipped_sdr_pixels and any external u8 quantization
of the gain map).
Sourcepub fn split_pq_row(
&self,
pq: &[f32],
sdr_linear: &mut [f32],
gain: &mut [f32],
channels: u8,
content_peak_nits: f32,
stats: &mut SplitStats,
)
pub fn split_pq_row( &self, pq: &[f32], sdr_linear: &mut [f32], gain: &mut [f32], channels: u8, content_peak_nits: f32, stats: &mut SplitStats, )
Encode one PQ-encoded HDR row (BT.2020 or BT.709 wire), normalizing
internally so 1.0 = content_peak_nits before applying the curve.
PQ samples range [0, 1] mapping to [0, 10000 nits] (ST.2084).
This method linearizes, rescales to 1.0 = content_peak_nits, runs
Self::split_row, and emits linear-light SDR in [0, 1].
Caller may then sRGB-encode for storage. Allocates a transient
linear buffer; for hot paths, call pq_to_normalized_linear_row
Self::split_rowdirectly with reused buffers.
Sourcepub fn split_hlg_row(
&self,
hlg: &[f32],
sdr_linear: &mut [f32],
gain: &mut [f32],
channels: u8,
display_peak_nits: f32,
content_peak_nits: f32,
stats: &mut SplitStats,
)
pub fn split_hlg_row( &self, hlg: &[f32], sdr_linear: &mut [f32], gain: &mut [f32], channels: u8, display_peak_nits: f32, content_peak_nits: f32, stats: &mut SplitStats, )
Encode one HLG-encoded HDR row. Linearizes via the HLG inverse OETF +
OOTF, rescales so 1.0 = content_peak_nits, then splits.
Allocates a transient linear buffer; for hot paths, call
hlg_to_normalized_linear_row + Self::split_row with reused
buffers.
Sourcepub fn apply_hlg_row(
&self,
sdr_linear: &[f32],
gain: &[f32],
hlg_out: &mut [f32],
channels: u8,
display_peak_nits: f32,
content_peak_nits: f32,
)
pub fn apply_hlg_row( &self, sdr_linear: &[f32], gain: &[f32], hlg_out: &mut [f32], channels: u8, display_peak_nits: f32, content_peak_nits: f32, )
Decode a linear-light SDR row + log2 gain row back to HLG-encoded HDR.
Inverse of Self::split_hlg_row.
Sourcepub fn apply_pq_row(
&self,
sdr_linear: &[f32],
gain: &[f32],
pq_out: &mut [f32],
channels: u8,
content_peak_nits: f32,
)
pub fn apply_pq_row( &self, sdr_linear: &[f32], gain: &[f32], pq_out: &mut [f32], channels: u8, content_peak_nits: f32, )
Decode a linear-light SDR row + log2 gain row back to PQ-encoded HDR.
Inverse of Self::split_pq_row.