Enum yuv::convert::RGBConvert

source ·
pub enum RGBConvert<T = u8> {
    Matrix(Matrix<T>),
    Copy(CopyGBR<T>),
    IdentityScale(IdentityScale<T>),
}
Expand description

Enum containing concrete type of converter used.

Use RGBConvert::new to create a new instance.

Variants of this enum are indivdually optimized for specific color spaces. You can either call RGBConvert::to_rgb() for convenient method, or match on the enum, and use ToRGB trait with each of the variants to make Rust generate optimized functions for each.

Variants§

§

Matrix(Matrix<T>)

Converter YCbCr color spaces

§

Copy(CopyGBR<T>)

No conversion

§

IdentityScale(IdentityScale<T>)

Scale numbers from 10/12-bit to 16-bit, and/or from studio range to full range. All channels use Y range.

Implementations§

source§

impl RGBConvert<u8>

source

pub fn new(range: Range, matrix: MatrixCoefficients) -> Result<Self, Error>

Use RGBConvert::<u8>::new() to call this method, because there’s also a u16 version

source§

impl RGBConvert<u16>

source

pub fn new( range: Range, matrix: MatrixCoefficients, depth: Depth ) -> Result<Self, Error>

Use RGBConvert::<u16>::new() to call this method, because there’s also a u8 version

source§

impl<T> RGBConvert<T>
where Matrix<T>: ToRGB<T, T>, IdentityScale<T>: ToRGB<T, T>,

source

pub fn to_rgb(&self, px: YUV<T>) -> RGB<T>

Convert a single YUV pixel to an RGB pixel.

This method has a match internally, which may or may not be the fastest way to do this (dependin on optimizer). If you want to have optimal code, use variants of this enum individually. They all implement ToRGB trait.

source

pub fn to_luma(&self, px: T) -> T

Convert a single Y (Luma) value to a grayscale value.

Trait Implementations§

source§

impl<T: Clone> Clone for RGBConvert<T>

source§

fn clone(&self) -> RGBConvert<T>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T: Debug> Debug for RGBConvert<T>

source§

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

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

impl<T> ToRGB<T, T> for RGBConvert<T>
where Matrix<T>: ToRGB<T, T>, IdentityScale<T>: ToRGB<T, T>,

source§

fn to_rgb(&self, px: YUV<T>) -> RGB<T>

Convert a single YUV pixel to an RGB pixel.

This method has a match internally, which may or may not be the fastest way to do this (dependin on optimizer). If you want to have optimal code, use variants of this enum individually. They all implement ToRGB trait.

source§

fn to_luma(&self, y: T) -> T

Convert a single Y (Luma) value to a grayscale value.

Auto Trait Implementations§

§

impl<T> Freeze for RGBConvert<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for RGBConvert<T>
where T: RefUnwindSafe,

§

impl<T> Send for RGBConvert<T>
where T: Send,

§

impl<T> Sync for RGBConvert<T>
where T: Sync,

§

impl<T> Unpin for RGBConvert<T>
where T: Unpin,

§

impl<T> UnwindSafe for RGBConvert<T>
where T: UnwindSafe,

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> 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,

§

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>,

§

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>,

§

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.