Skip to main content

Lut

Struct Lut 

Source
pub struct Lut {
    pub title: Option<String>,
    pub size: usize,
    pub domain_min: [f32; 3],
    pub domain_max: [f32; 3],
    pub data: Vec<[f32; 3]>,
    pub path: Option<PathBuf>,
}
Expand description

A 3D LUT: size^3 RGB entries, red varying fastest (.cube order).

Fields§

§title: Option<String>§size: usize§domain_min: [f32; 3]§domain_max: [f32; 3]§data: Vec<[f32; 3]>

size^3 entries, index r + g * size + b * size * size.

§path: Option<PathBuf>

Where it was loaded from, if anywhere.

Implementations§

Source§

impl Lut

Source

pub fn from_cube_file(path: impl AsRef<Path>) -> Result<Lut, Error>

Reads an Adobe/Resolve .cube 3D LUT.

Source

pub fn mixed(self, strength: f32) -> Lut

This LUT mixed with identity by strength (0..1, lut_strength): each lattice entry moved from its identity value (in the LUT’s domain) towards its own by strength.

Source

pub fn identity(size: usize) -> Lut

The identity LUT of the given size.

Source

pub fn at(&self, r: usize, g: usize, b: usize) -> [f32; 3]

Nearest-entry lookup at lattice coordinates (for tests and debugging; the GPU interpolates).

Source

pub fn sample(&self, rgb: [f32; 3]) -> [f32; 3]

Trilinear lookup of rgb (in the LUT’s domain, clamped to it): how libplacebo samples a pl_custom_lut (a linearly filtered 3D texture), so baked LUTs agree with the GPU.

Source

pub fn with_input_gain(&self, gain: [f32; 3]) -> Lut

This LUT after a per-channel gain on its input, clamped to 0..1 (ffmpeg’s colorchannelmixer rr:gg:bb ahead of lut3d), resampled on the same lattice.

Source

pub fn to_cube(&self) -> String

The LUT as .cube text (TITLE, LUT_3D_SIZE, the domain if not 0..1, then entries).

Source

pub fn write_cube(&self, path: &Path) -> Result<(), Error>

Writes the LUT as a .cube file.

Trait Implementations§

Source§

impl Clone for Lut

Source§

fn clone(&self) -> Lut

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 Debug for Lut

Source§

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

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

impl PartialEq for Lut

Source§

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

Auto Trait Implementations§

§

impl Forget for Lut

§

impl Freeze for Lut

§

impl RefUnwindSafe for Lut

§

impl Send for Lut

§

impl Sync for Lut

§

impl Unpin for Lut

§

impl UnsafeUnpin for Lut

§

impl UnwindSafe for Lut

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.