Skip to main content

YuvUploadNode

Struct YuvUploadNode 

Source
pub struct YuvUploadNode {
    pub format: YuvFormat,
    pub width: u32,
    pub height: u32,
    /* private fields */
}
Expand description

Upload raw YUV plane buffers to the GPU and convert to RGBA in a fragment shader, bypassing CPU-side sws_scale.

The node has input_count() = 0; it sources all pixel data from the plane buffers set via YuvUploadNode::set_planes. Call set_planes once per frame before the graph processes it.

Fields§

§format: YuvFormat

Pixel sub-sampling format.

§width: u32

Frame width in pixels.

§height: u32

Frame height in pixels.

Implementations§

Source§

impl YuvUploadNode

Source

pub fn new(format: YuvFormat, width: u32, height: u32) -> Self

Create a new node. Plane buffers are initialised to neutral values (Y = 0, Cb = Cr = 128).

Source

pub fn set_planes(&mut self, y: Vec<u8>, cb: Vec<u8>, cr: Vec<u8>)

Replace the stored plane buffers.

Expected sizes for width × height at format:

  • y: width × height bytes
  • cb, cr: chroma_w × chroma_h bytes (sub-sampled per YuvFormat)

Trait Implementations§

Source§

impl Default for YuvUploadNode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl RenderNodeCpu for YuvUploadNode

Source§

fn process_cpu(&self, rgba: &mut [u8], w: u32, h: u32)

Process rgba in-place. Read more

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.