pub struct HdrToneMapper { /* private fields */ }Expand description
HDR tone mapper operating on RGB f32 pixel data.
Pixels are expected to arrive in linear, scene-referred light normalised
so that 1.0 == config.peak_brightness nits (i.e. values may exceed 1.0
for content brighter than the configured peak).
Use HdrToneMapper::map_pixel for single pixels or
HdrToneMapper::map_frame to process a flat interleaved RGB f32 buffer.
Implementations§
Source§impl HdrToneMapper
impl HdrToneMapper
Sourcepub fn new(config: ToneMappingConfig) -> Self
pub fn new(config: ToneMappingConfig) -> Self
Create a new tone mapper from configuration.
Sourcepub fn config(&self) -> &ToneMappingConfig
pub fn config(&self) -> &ToneMappingConfig
Return a reference to the current configuration.
Sourcepub fn map_pixel(&self, rgb: [f32; 3]) -> [f32; 3]
pub fn map_pixel(&self, rgb: [f32; 3]) -> [f32; 3]
Apply tone mapping to a single RGB pixel.
Input: linear, scene-referred RGB where values may exceed 1.0.
The absolute maximum representable brightness is config.peak_brightness.
Output: gamma-encoded SDR RGB in [0, 1].
Sourcepub fn map_frame(&self, buffer: &mut [f32])
pub fn map_frame(&self, buffer: &mut [f32])
Process a flat interleaved RGB f32 frame in-place.
The buffer must have length == width * height * 3.
Each triple [r, g, b] is processed by Self::map_pixel.
Sourcepub fn map_frame_owned(&self, input: &[f32]) -> Vec<f32>
pub fn map_frame_owned(&self, input: &[f32]) -> Vec<f32>
Process a frame from a read-only input buffer into a new output Vec.
Allocates a new Vec<f32> of the same length as input.
Sourcepub fn pq_eotf_nits(signal: f32) -> f32
pub fn pq_eotf_nits(signal: f32) -> f32
Apply the PQ EOTF to a normalised signal [0, 1] and return linear nits.
Useful when building custom pipelines that feed PQ-encoded data.
Sourcepub fn bt709_oetf(linear: f32) -> f32
pub fn bt709_oetf(linear: f32) -> f32
Apply the BT.709 OETF (gamma encode) to a linear value in [0, 1].
Source§impl HdrToneMapper
impl HdrToneMapper
Sourcepub fn aces_hdr10() -> Self
pub fn aces_hdr10() -> Self
Create a mapper using ToneMapOperator::AcesFilmic with typical HDR10 parameters.
Peak: 1 000 nits, white point: 203 nits, neutral saturation.
Sourcepub fn hable_hdr10() -> Self
pub fn hable_hdr10() -> Self
Create a mapper using ToneMapOperator::Hable with typical HDR10 parameters.
Sourcepub fn pq_to_sdr_hdr10() -> Self
pub fn pq_to_sdr_hdr10() -> Self
Create a mapper using ToneMapOperator::PqToSdr for HDR10 → SDR conversion.
Sourcepub fn reinhard_hdr10() -> Self
pub fn reinhard_hdr10() -> Self
Create a mapper using ToneMapOperator::ReinhardLocal with default HDR10 parameters.
Trait Implementations§
Source§impl Clone for HdrToneMapper
impl Clone for HdrToneMapper
Source§fn clone(&self) -> HdrToneMapper
fn clone(&self) -> HdrToneMapper
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for HdrToneMapper
impl RefUnwindSafe for HdrToneMapper
impl Send for HdrToneMapper
impl Sync for HdrToneMapper
impl Unpin for HdrToneMapper
impl UnsafeUnpin for HdrToneMapper
impl UnwindSafe for HdrToneMapper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more