#[non_exhaustive]pub struct GainMapMetadata { /* private fields */ }Expand description
Full re-export of zenpixels core types (zero module name collisions!).
ISO 21496-1 / UltraHDR gain-map reconstruction parameters in exact rational form.
Preserves exact unreduced rational pairs for lossless metadata transcoding across
JPEG APP2, AVIF tmap, and JXL jhgm while projecting cleanly to float for rendering.
Implementations§
Source§impl GainMapMetadata
impl GainMapMetadata
Sourcepub const fn new(
channels: GainMapChannels,
base_hdr_headroom: UnsignedFraction,
alternate_hdr_headroom: UnsignedFraction,
application_space: GainMapColorSpace,
) -> Option<GainMapMetadata>
pub const fn new( channels: GainMapChannels, base_hdr_headroom: UnsignedFraction, alternate_hdr_headroom: UnsignedFraction, application_space: GainMapColorSpace, ) -> Option<GainMapMetadata>
Construct and validate an exact ISO 21496-1 parameter set.
Rejects non-positive gamma, min > max, or equal base_hdr_headroom == alternate_hdr_headroom
(ISO 21496-1 §5.2.7 requires unequal headrooms).
Sourcepub const fn with_backward_direction(
self,
backward: bool,
) -> Option<GainMapMetadata>
pub const fn with_backward_direction( self, backward: bool, ) -> Option<GainMapMetadata>
Set the explicit ISO 21496-1 direction flag when it agrees with the headroom ordering.
true declares the reverse direction. false declares the forward direction.
Sourcepub const fn with_headrooms(
self,
base: UnsignedFraction,
alternate: UnsignedFraction,
) -> Option<GainMapMetadata>
pub const fn with_headrooms( self, base: UnsignedFraction, alternate: UnsignedFraction, ) -> Option<GainMapMetadata>
Replace both exact headrooms. Rejects equal values or a conflict with the explicit direction.
Sourcepub const fn channels(self) -> GainMapChannels
pub const fn channels(self) -> GainMapChannels
Shared or per-channel gain parameters.
Sourcepub const fn base_hdr_headroom(self) -> UnsignedFraction
pub const fn base_hdr_headroom(self) -> UnsignedFraction
Exact base rendition headroom in log₂ stops.
Sourcepub const fn alternate_hdr_headroom(self) -> UnsignedFraction
pub const fn alternate_hdr_headroom(self) -> UnsignedFraction
Exact alternate rendition headroom in log₂ stops.
Sourcepub const fn application_space(self) -> GainMapColorSpace
pub const fn application_space(self) -> GainMapColorSpace
RGB primaries in which gain is applied.
Sourcepub const fn backward_direction(self) -> Option<bool>
pub const fn backward_direction(self) -> Option<bool>
Explicit ISO 21496-1 direction flag, if present.
Sourcepub fn sdr_to_hdr_stops(max_boost_stops: f32) -> Option<GainMapMetadata>
pub fn sdr_to_hdr_stops(max_boost_stops: f32) -> Option<GainMapMetadata>
Fallibly construct a forward SDR-base (0 stops) → HDR-alternate (+max_boost_stops)
gain-map parameter set with [0, +max_boost_stops] gain range and standard 1/64
base/alternate offsets.
Returns None if max_boost_stops is non-finite, <= 0.0, or rounds to zero at
1/1_000_000 precision.
Sourcepub const fn is_valid(self) -> bool
pub const fn is_valid(self) -> bool
Validate all exact rational invariants (gamma > 0, min <= max, H_base != H_alt,
and any explicit backward_direction flag agrees with the
headroom ordering).
Sourcepub const fn direction(self) -> Option<GainMapDirection>
pub const fn direction(self) -> Option<GainMapDirection>
Exact gain-map direction (Forward if H_alt > H_base, Reverse if H_base > H_alt),
returning None if headrooms are equal or an explicit backward_direction
flag contradicts the headroom ordering.
Sourcepub const fn channel(self, c: usize) -> GainMapComponent
pub const fn channel(self, c: usize) -> GainMapComponent
Access parameter record for channel c (0..3).
Trait Implementations§
Source§impl Clone for GainMapMetadata
impl Clone for GainMapMetadata
Source§fn clone(&self) -> GainMapMetadata
fn clone(&self) -> GainMapMetadata
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more