Skip to main content

YUVSource

Trait YUVSource 

Source
pub trait YUVSource {
    // Required methods
    fn dimensions(&self) -> (usize, usize);
    fn strides(&self) -> (usize, usize, usize);
    fn y(&self) -> &[u8] ;
    fn u(&self) -> &[u8] ;
    fn v(&self) -> &[u8] ;

    // Provided methods
    fn dimensions_i32(&self) -> (i32, i32) { ... }
    fn strides_i32(&self) -> (i32, i32, i32) { ... }
    fn rgb8_len(&self) -> usize { ... }
    fn rgba8_len(&self) -> usize { ... }
}
Expand description

Allows the Encoder to be generic over a YUV source.

Required Methods§

Source

fn dimensions(&self) -> (usize, usize)

Size of the image as (w, h).

Source

fn strides(&self) -> (usize, usize, usize)

YUV strides as (y, u, v).

For now you should make sure u == v.

Source

fn y(&self) -> &[u8]

Y buffer, should be of size dimension.1 * strides.0.

Source

fn u(&self) -> &[u8]

U buffer, should be of size dimension.1 * strides.1.

Source

fn v(&self) -> &[u8]

V buffer, should be of size dimension.1 * strides.2.

Provided Methods§

Source

fn dimensions_i32(&self) -> (i32, i32)

Size of the image as (w, h).

Source

fn strides_i32(&self) -> (i32, i32, i32)

YUV strides as (y, u, v).

For now you should make sure u == v.

Source

fn rgb8_len(&self) -> usize

Estimates how many bytes you’ll need to store this YUV in an &[u8] RGB array.

This function should return w * h * 3.

Source

fn rgba8_len(&self) -> usize

Estimates how many bytes you’ll need to store this YUV in an &[u8] RGBA array.

This function should return w * h * 4.

Implementors§