Skip to main content

TransferFunction

Enum TransferFunction 

Source
pub enum TransferFunction {
    SRgb,
    SegmentedGamma {
        gamma: f64,
        offset: f64,
        linear_part: bool,
    },
    Gamma(f64),
    Linear,
    Pq,
    Hlg {
        peak_luminance: f64,
    },
}
Expand description

Electro-optical transfer function describing how an encoded RGB signal maps to linear light. Each variant defines an eotf (encoded -> linear) and its analytic inverse oetf (linear -> encoded); the pair is exact so that rgb_to_xyz / xyz_to_rgb round-trip.

Variants§

§

SRgb

sRGB / Display P3 piecewise transfer function (IEC 61966-2-1).

§

SegmentedGamma

Parameterized sRGB-family piecewise transfer function used by the legacy srgb_to_xyz / xyz_to_srgb: value = ((E - offset) / (1 - offset)) ^ gamma, with a linear toe E / 12.92 when linear_part is set.

Fields

§gamma: f64
§offset: f64
§linear_part: bool
§

Gamma(f64)

Pure power law linear = encoded ^ gamma (e.g. Adobe RGB gamma 2.2).

§

Linear

Identity transfer (values are already linear).

§

Pq

SMPTE ST 2084 (PQ) perceptual quantizer. Linear 1.0 is the 10000 cd/m² peak.

§

Hlg

ARIB STD-B67 / Rec.2100 HLG. peak_luminance (cd/m²) sets the display system gamma; linear 1.0 is the peak white.

Fields

§peak_luminance: f64

Implementations§

Source§

impl TransferFunction

Source

pub fn eotf(self, encoded: f64) -> f64

Encoded signal value -> linear light (both in [0, 1] for sRGB/P3/gamma; PQ/HLG output is normalized so 1.0 is the display peak).

Source

pub fn oetf(self, linear: f64) -> f64

Linear light -> encoded signal value (analytic inverse of eotf).

Trait Implementations§

Source§

impl Clone for TransferFunction

Source§

fn clone(&self) -> TransferFunction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TransferFunction

Source§

impl Debug for TransferFunction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TransferFunction

Source§

fn eq(&self, other: &TransferFunction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TransferFunction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.