#[non_exhaustive]pub struct GainMapParams {
pub channels: [GainMapChannel; 3],
pub base_hdr_headroom: f64,
pub alternate_hdr_headroom: f64,
pub use_base_color_space: bool,
pub backward_direction: bool,
}Expand description
ISO 21496-1 gain map parameters. Canonical cross-codec representation.
Gains and headroom are in log2 domain. Gamma and offsets are in linear domain. This matches the ISO 21496-1 wire format directly, avoiding the domain confusion that occurs when converting between log2 and linear representations.
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.channels: [GainMapChannel; 3]Per-channel parameters. [0] = R (or all channels if single-channel),
[1] = G, [2] = B.
base_hdr_headroom: f64Log2 of base image HDR headroom. 0.0 = SDR (peak luminance ratio 1:1).
alternate_hdr_headroom: f64Log2 of alternate image HDR headroom.
use_base_color_space: boolWhether the gain map is encoded in the base image’s color space.
backward_direction: boolISO 21496-1 backward direction flag (bit 2 of flags byte).
When true, the base and alternate roles are reversed: the base
image is the HDR rendition and the alternate is SDR. This is the
authoritative encoder signal — direction()
derives the same information from headroom comparison as a fallback.
Implementations§
Source§impl GainMapParams
impl GainMapParams
Sourcepub fn is_single_channel(&self) -> bool
pub fn is_single_channel(&self) -> bool
Whether all three channels have identical parameters.
Sourcepub fn direction(&self) -> GainMapDirection
pub fn direction(&self) -> GainMapDirection
Derive direction from headroom comparison.
The image with greater headroom is the HDR rendition.
Sourcepub fn linear_base_headroom(&self) -> f64
pub fn linear_base_headroom(&self) -> f64
Base HDR headroom in linear domain: 2^base_hdr_headroom.
Sourcepub fn linear_alternate_headroom(&self) -> f64
pub fn linear_alternate_headroom(&self) -> f64
Alternate HDR headroom in linear domain: 2^alternate_hdr_headroom.
Sourcepub fn validate(&self) -> Result<(), GainMapParseError>
pub fn validate(&self) -> Result<(), GainMapParseError>
Validate parameters for correctness.
Checks for NaN/infinity, positive gamma, and min ≤ max per channel.
Trait Implementations§
Source§impl Clone for GainMapParams
impl Clone for GainMapParams
Source§fn clone(&self) -> GainMapParams
fn clone(&self) -> GainMapParams
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more