rgb_to_sharp_yuv420

Function rgb_to_sharp_yuv420 

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

Convert RGB image data to YUV 420 planar format using bi-linear interpolation and gamma correction ( sharp YUV algorithm ).

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

§Arguments

  • y_plane - A mutable slice to store the Y (luminance) plane data.
  • y_stride - The stride (components per row) for the Y plane.
  • u_plane - A mutable slice to store the U (chrominance) plane data.
  • u_stride - The stride (components per row) for the U plane.
  • v_plane - A mutable slice to store the V (chrominance) plane data.
  • v_stride - The stride (components per row) for the V plane.
  • rgb - The input RGB image data slice.
  • rgb_stride - The stride (components per row) for the RGB image data.
  • width - The width of the image in pixels.
  • height - The height of the image in pixels.
  • range - The YUV range (limited or full).
  • matrix - The YUV standard matrix (BT.601 or BT.709 or BT.2020 or other).

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