Skip to main content

GammaLutOutput

Trait GammaLutOutput 

Source
pub unsafe trait GammaLutOutput: Sealed {
    type TableValue;

    const MAX: Self;
    const BITS: u32;
    const MAN_INDEX_WIDTH: u32;

    // Required methods
    fn from_table_value(value: Self::TableValue) -> Self;
    unsafe fn lookup(
        linear: f32,
        linear_slope: f32,
        min_float_bits: u32,
        table: &[Self::TableValue],
    ) -> Self;
}
Expand description

A possible output type for a GammaLut.

§Safety

The constants in this trait need to be valid for the lookup table algorithm.

Required Associated Constants§

Source

const MAX: Self

The maximum value of Self.

Source

const BITS: u32

The number of bits in Self.

Source

const MAN_INDEX_WIDTH: u32

The number of mantissa bits used to index into the lookup table.

Required Associated Types§

Source

type TableValue

The type of values stored in the lookup table.

Required Methods§

Source

fn from_table_value(value: Self::TableValue) -> Self

Convert a table value to Self.

This is called in the final stage of the lookup, when the table value is expected to be in range for Self.

Source

unsafe fn lookup( linear: f32, linear_slope: f32, min_float_bits: u32, table: &[Self::TableValue], ) -> Self

Look up a value of this output type, called by GammaLut.

§Safety

The lookup algorithm may assume certain properties and values from the input, such as range and table length. These invariants are upheld by GammaLut and GammaLutBuilder.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl GammaLutOutput for u8

Source§

const MAX: u8 = Self::MAX

Source§

const BITS: u32 = Self::BITS

Source§

const MAN_INDEX_WIDTH: u32 = U8_MAN_INDEX_WIDTH

Source§

type TableValue = u32

Source§

fn from_table_value(value: <u8 as GammaLutOutput>::TableValue) -> u8

Source§

unsafe fn lookup( linear: f32, _linear_slope: f32, min_float_bits: u32, table: &[<u8 as GammaLutOutput>::TableValue], ) -> u8

Source§

impl GammaLutOutput for u16

Source§

const MAX: u16 = Self::MAX

Source§

const BITS: u32 = Self::BITS

Source§

const MAN_INDEX_WIDTH: u32 = U16_MAN_INDEX_WIDTH

Source§

type TableValue = u64

Source§

fn from_table_value(value: <u16 as GammaLutOutput>::TableValue) -> u16

Source§

unsafe fn lookup( linear: f32, linear_slope: f32, min_float_bits: u32, table: &[<u16 as GammaLutOutput>::TableValue], ) -> u16

Implementors§