Convert

Struct Convert 

Source
pub struct Convert;
Expand description

Color conversion utilities

Implementations§

Source§

impl Convert

Source

pub fn backend() -> ColorConversionBackend

Get current color conversion backend

Source

pub fn set_backend(backend: ColorConversionBackend) -> Result<()>

Set color conversion backend

Source

pub fn has_avx2() -> bool

Check if AVX2 is available

Source

pub fn has_apple_accelerate() -> bool

Check if Apple Accelerate is available

Source

pub fn has_neon() -> bool

Check if NEON is available

Source

pub fn yuyv_to_rgb24( src_data: &[u8], src_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert YUYV to RGB24

§Errors

Returns CcapError::InvalidParameter if src_data is too small for the given dimensions.

Source

pub fn yuyv_to_bgr24( src_data: &[u8], src_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert YUYV to BGR24

§Errors

Returns CcapError::InvalidParameter if src_data is too small for the given dimensions.

Source

pub fn rgb_to_bgr( src_data: &[u8], src_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert RGB to BGR

§Errors

Returns CcapError::InvalidParameter if src_data is too small for the given dimensions.

Source

pub fn bgr_to_rgb( src_data: &[u8], src_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert BGR to RGB

§Errors

Returns CcapError::InvalidParameter if src_data is too small for the given dimensions.

Source

pub fn nv12_to_rgb24( y_data: &[u8], y_stride: usize, uv_data: &[u8], uv_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert NV12 to RGB24

§Errors

Returns CcapError::InvalidParameter if buffers are too small for the given dimensions.

Source

pub fn nv12_to_bgr24( y_data: &[u8], y_stride: usize, uv_data: &[u8], uv_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert NV12 to BGR24

§Errors

Returns CcapError::InvalidParameter if buffers are too small for the given dimensions.

Source

pub fn i420_to_rgb24( y_data: &[u8], y_stride: usize, u_data: &[u8], u_stride: usize, v_data: &[u8], v_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert I420 to RGB24

§Errors

Returns CcapError::InvalidParameter if buffers are too small for the given dimensions.

Source

pub fn i420_to_bgr24( y_data: &[u8], y_stride: usize, u_data: &[u8], u_stride: usize, v_data: &[u8], v_stride: usize, width: u32, height: u32, ) -> Result<Vec<u8>>

Convert I420 to BGR24

§Errors

Returns CcapError::InvalidParameter if buffers are too small for the given dimensions.

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