rgb_to_yuv420

Function rgb_to_yuv420 

Source
pub fn rgb_to_yuv420(
    planar_image: &mut YuvPlanarImageMut<'_, u8>,
    rgb: &[u8],
    rgb_stride: u32,
    range: YuvRange,
    matrix: YuvStandardMatrix,
    mode: YuvConversionMode,
) -> Result<(), YuvError>
Expand description

Convert RGB image data to YUV 420 planar format.

This function performs RGB to YUV conversion and stores the result in YUV420 planar format, with separate planes for Y (luminance), U (chrominance), and V (chrominance) components.

§Arguments

  • planar_image - Target planar image.
  • rgb - The input RGB image data slice.
  • rgb_stride - The stride (components per row) for the RGB image data.
  • range - The YUV range (limited or full).
  • matrix - The YUV standard matrix (BT.601 or BT.709 or BT.2020 or other).
  • mode - See YuvConversionMode for more info.

§Panics

This function panics if the lengths of the planes or the input RGB data are not valid based on the specified width, height, and strides, or if invalid YUV range or matrix is provided.