Skip to main content

Transfer

Enum Transfer 

Source
#[non_exhaustive]
pub enum Transfer {
Show 19 variants Linear, Srgb, Bt709, Gamma22, Gamma28, Bt601, Smpte240M, Log100, Log100Sqrt10, Iec61966_2_4, Bt1361, Bt2020_10bit, Bt2020_12bit, AdobeRgb, DciCinema, Gamma(Gamma), Pq, Hlg(HlgMode), Unknown,
}
Expand description

Full re-export of zenpixels core types (zero module name collisions!). Electro-optical transfer function (non-linear curve between stored values and light).

Covers all 16 standardized ITU-T H.273 Table 3 TransferCharacteristics codes losslessly (Transfer::from_cicp(tc)?.to_cicp() == Some(tc)), plus Adobe RGB (563/256) and arbitrary validated pure-power Gamma.

Distinct variants that share an identical mathematical curve (e.g. Self::Bt709, Self::Bt601, Self::Iec61966_2_4, Self::Bt2020_10bit, Self::Bt2020_12bit) preserve their exact H.273 code on round-trip while reporting true from Transfer::same_curve.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Linear

Linear light (L = v, CICP 8).

§

Srgb

IEC 61966-2-1 sRGB curve (CICP 13).

§

Bt709

ITU-R BT.709-6 camera curve (CICP 1).

§

Gamma22

Pure power curve v^2.2 (ITU-R BT.470-6 System M, CICP 4).

Distinct from Self::AdobeRgb (v^(563/256) = 2.19921875).

§

Gamma28

Pure power curve v^2.8 (ITU-R BT.470-6 System B, G, CICP 5).

§

Bt601

ITU-R BT.601-7 / SMPTE 170M curve (CICP 6; identical curve to Self::Bt709, distinct code).

§

Smpte240M

SMPTE 240M curve (α = 1.1115, slope 4.0, CICP 7).

§

Log100

Logarithmic transfer (100:1 dynamic range, CICP 9).

§

Log100Sqrt10

Logarithmic transfer (100 * sqrt(10):1 dynamic range, CICP 10).

§

Iec61966_2_4

IEC 61966-2-4 extended xvYCC curve (CICP 11; odd-symmetric BT.709).

§

Bt1361

ITU-R BT.1361-0 extended colour gamut system (CICP 12).

§

Bt2020_10bit

ITU-R BT.2020-2 10-bit curve (CICP 14; identical curve to Self::Bt709, distinct code).

§

Bt2020_12bit

ITU-R BT.2020-2 12-bit curve (CICP 15; identical curve to Self::Bt709, distinct code).

§

AdobeRgb

Adobe RGB (1998) pure power curve v^(563/256) (2.19921875, no exact H.273 code).

§

DciCinema

SMPTE ST 428-1 digital cinema transfer (CICP 17: L = (52.37 / 48.0) * v^2.6, where L = 1.0 = 48 cd/m² theater white encodes to (48 / 52.37)^(1/2.6) ≈ 0.967043).

Distinct from pure power Self::Gamma(Gamma::DCI_2_6) (L = v^2.6).

§

Gamma(Gamma)

Explicit validated pure decoding gamma L = v^gamma (JXL, pure 2.6, PNG gAMA).

§

Pq

SMPTE ST 2084 Perceptual Quantizer (absolute 0..=10,000 cd/m², CICP 16).

§

Hlg(HlgMode)

ARIB STD-B67 / ITU-R BT.2100 Hybrid Log-Gamma (CICP 18).

§

Unknown

Unspecified / unknown transfer curve.

Implementations§

Source§

impl Transfer

Source

pub const fn is_linear(self) -> bool

Whether this transfer encodes linear light directly.

Source

pub const fn is_hdr(self) -> bool

Whether this transfer is an HDR transfer (Pq or Hlg).

Source

pub const fn is_bt709_curve(self) -> bool

Whether this transfer uses the exact BT.709 / BT.601 / BT.2020 / xvYCC transfer equation.

Source

pub const fn same_curve(self, other: Transfer) -> bool

Whether self and other evaluate the exact same mathematical transfer curve (for instance Self::Bt709, Self::Bt601, Self::Iec61966_2_4, Self::Bt2020_10bit, and Self::Bt2020_12bit, or Self::Gamma matching a named pure-power curve bit-for-bit).

Source

pub const fn from_cicp(code: u8) -> Option<Transfer>

Map an ITU-T H.273 Table 3 TransferCharacteristics code to Transfer.

Lossless bijection across all 16 standardized codes (1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18).

Source

pub const fn to_cicp(self) -> Option<u8>

Map Transfer to an ITU-T H.273 Table 3 TransferCharacteristics code, when standardized.

Note: Self::AdobeRgb (563/256) and pure Self::Gamma return None so they are never silently relabeled as H.273 TC=4 (2.2) or TC=17 (SMPTE ST 428-1).

Trait Implementations§

Source§

impl Clone for Transfer

Source§

fn clone(&self) -> Transfer

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 Transfer

Source§

impl Debug for Transfer

Source§

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

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

impl Default for Transfer

Source§

fn default() -> Transfer

Returns the “default value” for a type. Read more
Source§

impl Eq for Transfer

Source§

impl Hash for Transfer

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Transfer

Source§

fn eq(&self, other: &Transfer) -> 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 Transfer

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.