pub struct Srgb;Expand description
sRGB transfer function.
Uses the linear-srgb crate’s LUT-based conversion for u8↔f32 and
compile-time constant tables for u8↔i12. The u8 path is heavily optimized
with SIMD-friendly LUT lookups.
For u16 input, values are normalized to [0, 1] and passed through the scalar sRGB curve. This is slower than the u8 LUT path but exact.
Trait Implementations§
Source§impl TransferCurve for Srgb
impl TransferCurve for Srgb
Source§type Luts = ()
type Luts = ()
Cached state (LUTs, etc.). Built once by
build_luts(), passed to batch methods. Read moreSource§fn to_linear(&self, encoded: f32) -> f32
fn to_linear(&self, encoded: f32) -> f32
Encode a linear-light value to this TF’s encoded space.
Both input and output are in [0, 1] for SDR TFs.
Source§fn from_linear(&self, linear: f32) -> f32
fn from_linear(&self, linear: f32) -> f32
Decode a value from this TF’s encoded space to linear light.
Source§fn build_luts(&self) -> Self::Luts
fn build_luts(&self) -> Self::Luts
Build or retrieve cached LUTs.
Source§fn u8_to_linear_f32(
&self,
src: &[u8],
dst: &mut [f32],
_luts: &(),
channels: usize,
has_alpha: bool,
premul: bool,
)
fn u8_to_linear_f32( &self, src: &[u8], dst: &mut [f32], _luts: &(), channels: usize, has_alpha: bool, premul: bool, )
Convert a row of u8 encoded pixels to premultiplied linear f32. Read more
Source§fn linear_f32_to_u8(
&self,
src: &[f32],
dst: &mut [u8],
_luts: &(),
channels: usize,
has_alpha: bool,
unpremul: bool,
)
fn linear_f32_to_u8( &self, src: &[f32], dst: &mut [u8], _luts: &(), channels: usize, has_alpha: bool, unpremul: bool, )
Convert a row of premultiplied linear f32 to u8 encoded pixels. Read more
Source§fn u16_to_linear_f32(
&self,
src: &[u16],
dst: &mut [f32],
_luts: &(),
channels: usize,
has_alpha: bool,
premul: bool,
)
fn u16_to_linear_f32( &self, src: &[u16], dst: &mut [f32], _luts: &(), channels: usize, has_alpha: bool, premul: bool, )
Convert a row of u16 encoded pixels to premultiplied linear f32. Read more
Source§fn linear_f32_to_u16(
&self,
src: &[f32],
dst: &mut [u16],
_luts: &(),
channels: usize,
has_alpha: bool,
unpremul: bool,
)
fn linear_f32_to_u16( &self, src: &[f32], dst: &mut [u16], _luts: &(), channels: usize, has_alpha: bool, unpremul: bool, )
Convert premultiplied linear f32 to u16 encoded pixels.
Source§fn u8_to_linear_i12(&self, src: &[u8], dst: &mut [i16], _luts: &())
fn u8_to_linear_i12(&self, src: &[u8], dst: &mut [i16], _luts: &())
Convert a row of u8 encoded pixels to linear i12 (0-4095).
All channels converted; no premul/unpremul (I16Work doesn’t support premul).
Source§fn linear_i12_to_u8(&self, src: &[i16], dst: &mut [u8], _luts: &())
fn linear_i12_to_u8(&self, src: &[i16], dst: &mut [u8], _luts: &())
Convert a row of linear i12 to u8 encoded pixels.
Source§fn f32_to_linear_inplace(
&self,
row: &mut [f32],
channels: usize,
has_alpha: bool,
premul: bool,
)
fn f32_to_linear_inplace( &self, row: &mut [f32], channels: usize, has_alpha: bool, premul: bool, )
Convert f32 encoded values to premultiplied linear f32 in-place.
Source§fn linear_to_f32_inplace(
&self,
row: &mut [f32],
channels: usize,
has_alpha: bool,
unpremul: bool,
)
fn linear_to_f32_inplace( &self, row: &mut [f32], channels: usize, has_alpha: bool, unpremul: bool, )
Convert premultiplied linear f32 to f32 encoded in-place.
Does NOT clamp — output can have values outside [0, 1] for wide gamut.
Source§fn is_identity(&self) -> bool
fn is_identity(&self) -> bool
Whether this TF is the identity (no conversion needed).
impl Copy for Srgb
Auto Trait Implementations§
impl Freeze for Srgb
impl RefUnwindSafe for Srgb
impl Send for Srgb
impl Sync for Srgb
impl Unpin for Srgb
impl UnsafeUnpin for Srgb
impl UnwindSafe for Srgb
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
Mutably borrows from an owned value. Read more