pub struct Bt2446A { /* private fields */ }Expand description
BT.2446 Method A tonemapper with explicit baked HDR/SDR peak luminances.
Construct with with_peaks, then apply directly via
map_rgb_bt2020_peak_normalized or
map_strip_bt2020_peak_normalized,
or pass into ConvertPolicy::with_tone_mapper.
For pipeline-managed peak resolution (measuring or reading declared metadata
at ToneMapper::prepare time), use
Bt2446APipelineManaged (or Bt2446A::pipeline_managed).
Input is linear-light BT.2020 RGB normalized so 1.0 = hdr_peak_nits. Output
is linear-light BT.2020 RGB normalized so 1.0 = sdr_peak_nits — the
BT.2446-1 §4 pipeline natively emits gamma-encoded R'_TMO G'_TMO B'_TMO
(BT.1886 1/2.4); we apply the BT.1886 EOTF (^2.4) at the output to deliver
a linear-light contract (matching libplacebo’s own bt2446a which ends with
bt1886_eotf).
§When to pick this
The most rigorously validated HDR → SDR curve published — the only one with a peer-reviewed psychophysical study showing imperceptible degradation after a full HDR → SDR → HDR round-trip on graded content. Pick when broadcast-grade fidelity matters.
Reference: ITU-R BT.2446-1 (03/2021) §4 + Annex 1 (12 participants, 115 images, Sony BVM-X300, 2AFC, p ≈ 0.17 indistinguishability).
§Examples
use zenpixels_convert::{Nits, tonemap::Bt2446A};
let curve = Bt2446A::with_peaks(
Nits::new_positive_or_panic(1000.0),
Nits::new_positive_or_panic(100.0),
);
let sdr = curve.map_rgb_bt2020_peak_normalized([0.6, 0.4, 0.2]);
assert!(sdr.iter().all(|&c| (0.0..=1.0).contains(&c)));Implementations§
Source§impl Bt2446A
impl Bt2446A
Sourcepub fn with_peaks(hdr_peak: Nits, sdr_peak: Nits) -> Self
pub fn with_peaks(hdr_peak: Nits, sdr_peak: Nits) -> Self
Create a new BT.2446 Method A tonemapper with explicit typed peak luminances baked in.
hdr_peak: peak luminance of HDR content (e.g.Nits::new_positive_or_panic(1000.0)).sdr_peak: peak luminance of SDR target (e.g.Nits::new_positive_or_panic(100.0)).
Use this when the source peak is already known at construction time.
For pipeline-orchestrated peak resolution via
PeakSource (Measured, Declared, or Fixed)
at prepare() time, use pipeline_managed /
Bt2446APipelineManaged instead.
Sourcepub const fn pipeline_managed() -> Bt2446APipelineManaged
pub const fn pipeline_managed() -> Bt2446APipelineManaged
Construct a pipeline-managed BT.2446-A descriptor (Bt2446APipelineManaged)
whose peaks are supplied by the pipeline at
ToneMapper::prepare time.
Use this when you don’t know the source peak nits at the
builder-construction site and want ImagePlan to
resolve peaks via PeakSource or
measure_content_light_level.
Sourcepub const fn source_peak(&self) -> Nits
pub const fn source_peak(&self) -> Nits
Baked HDR source peak luminance in cd/m².
Sourcepub const fn target_peak(&self) -> Nits
pub const fn target_peak(&self) -> Nits
Baked SDR target peak luminance in cd/m².
Sourcepub fn map_rgb_bt2020_peak_normalized(&self, rgb: [f32; 3]) -> [f32; 3]
pub fn map_rgb_bt2020_peak_normalized(&self, rgb: [f32; 3]) -> [f32; 3]
Map a single HDR pixel (linear-light BT.2020 RGB normalized so
1.0 = source_peak()) to an SDR pixel (linear-light BT.2020 RGB
normalized so 1.0 = target_peak()).
Input must be finite; NaN/negative channels are not scrubbed here
(see Self::map_strip_bt2020_peak_normalized).
Implemented as a 1-element strip through
Self::map_strip_bt2020_peak_normalized. A single pixel runs the
same lanes as a row, padded.
Sourcepub fn map_strip_bt2020_peak_normalized(&self, strip: &mut [[f32; 3]])
pub fn map_strip_bt2020_peak_normalized(&self, strip: &mut [[f32; 3]])
Apply the curve to a strip of linear-light BT.2020 RGB pixels
(normalized so 1.0 = source_peak() on input and 1.0 = target_peak()
on output) in place, dispatching to the widest available SIMD tier.
§Input contract
Expects finite linear-light BT.2020 RGB. Non-finite input is
not scrubbed, and NaN/inf can reach the output. The conversion pipeline
scrubs non-finite values before calling this; direct callers own that themselves.
Trait Implementations§
impl Copy for Bt2446A
Source§impl ToneMapper for Bt2446A
impl ToneMapper for Bt2446A
Source§fn requirements(&self) -> Requirements
fn requirements(&self) -> Requirements
PreparedMapper? Read more