Functions
VXLIB_colorConvert_RGBtoNV12_i8u_o8u

Functions

VXLIB_STATUS VXLIB_colorConvert_RGBtoNV12_i8u_o8u (const uint8_t src[restrict], const VXLIB_bufParams2D_t *src_addr, uint8_t dst0[restrict], const VXLIB_bufParams2D_t *dst0_addr, uint8_t dst1[restrict], const VXLIB_bufParams2D_t *dst1_addr, uint8_t scratch[restrict], uint32_t scratch_size)
 
VXLIB_STATUS VXLIB_colorConvert_RGBtoNV12_i8u_o8u_checkParams (const uint8_t src[], const VXLIB_bufParams2D_t *src_addr, const uint8_t dst0[], const VXLIB_bufParams2D_t *dst0_addr, const uint8_t dst1[], const VXLIB_bufParams2D_t *dst1_addr, const uint8_t scratch[], const uint32_t scratch_size)
 

Detailed Description

Function Documentation

◆ VXLIB_colorConvert_RGBtoNV12_i8u_o8u()

VXLIB_STATUS VXLIB_colorConvert_RGBtoNV12_i8u_o8u ( const uint8_t  src[restrict],
const VXLIB_bufParams2D_t *  src_addr,
uint8_t  dst0[restrict],
const VXLIB_bufParams2D_t *  dst0_addr,
uint8_t  dst1[restrict],
const VXLIB_bufParams2D_t *  dst1_addr,
uint8_t  scratch[restrict],
uint32_t  scratch_size 
)
Description:
Performs a color conversion operation from RGB to NV12.
Method:
Uses 8-bit fixed point approximation of BT.709 coefficients
     Y'=  (( 54*R' + 183*G' + 18*B')+128)/256
     U'=  ((-15*R' -  49*G' + 64*B')+64)/128 + 128
     V'=  (( 64*R' -  58*G' -  6*B')+64)/128 + 128
Parameters
[in]src[]Pointer to array containing input RGB image (UQ8.0)
[in]src_addr[]Pointer to structure containing dimensional information of src
[out]dst0[]Pointer to array containing output luma plane (UQ8.0)
[in]dst0_addr[]Pointer to structure containing dimensional information of dst0
[out]dst1[]Pointer to array containing output interleaved UV plane (UQ8.0)
[in]dst1_addr[]Pointer to structure containing dimensional information of dst1
[in]scratch[]Pointer to array of scratch memory (UQ8.0)
[in]scratch_sizeParameter indicating the size of scratch memory
Assumptions:
  • I/O buffer pointers are assumed to be not aliased.
  • RGB Input (1 plane): src_addr
    • 'dim_x' refers to the number of RGB pixel units per line
    • 'dim_y' refers to the number of lines in the image
    • 'stride_y' should be at least ('dim_x' * 3 * 1) bytes
  • NV12 (2 planes)
    • dst0_addr
      • 'dim_x' refers to the number of luma pixel units per line
      • 'dim_y' refers to the number of lines in the luma plane
      • 'stride_y' refers to the stride of the luma plane, and should be at least ('dim_x' * 1) bytes
    • dst1_addr
      • 'dim_x' refers to the number of bytes per line (should be equal to dst0_addr.dim_x)
      • 'dim_y' refers to the number of lines in the interleaved chroma plane (should be equal to dst0_addr.dim_y / 2)
      • 'stride_y' refers to the stride of the interleaved chroma plane, and should be at least ('dim_x' * 1) bytes
  • Scratch size is equal to at least dst0_addr.dim_x * 4 bytes
Performance Considerations:
  • For best performance, the following parameter settings are recommended:
    • Set widths equal to strides
    • Align all pointers to 8 byte boundaries
    • Set all stride and width values to a multiple of 8

◆ VXLIB_colorConvert_RGBtoNV12_i8u_o8u_checkParams()

VXLIB_STATUS VXLIB_colorConvert_RGBtoNV12_i8u_o8u_checkParams ( const uint8_t  src[],
const VXLIB_bufParams2D_t *  src_addr,
const uint8_t  dst0[],
const VXLIB_bufParams2D_t *  dst0_addr,
const uint8_t  dst1[],
const VXLIB_bufParams2D_t *  dst1_addr,
const uint8_t  scratch[],
const uint32_t  scratch_size 
)
Description:
Checks the parameters for programming errors for the VXLIB_colorConvert_RGBtoNV12_i8u_o8u function.
Method:
The following checks are made:
  • There shall be no NULL pointers
  • Both images shall have the same x and y dimensions
  • The stride_y of the src image shall be equal to or greater than dim_x * 3
  • The stride_y of the dst image shall be equal to or greater than dim_x
  • scratch_size shall be equal to or greater than dst_addr->stride_y * 4 bytes
Parameters
[in]src[]Pointer to array containing input RGB image (UQ8.0)
[in]src_addr[]Pointer to structure containing dimensional information of src
[out]dst0[]Pointer to array containing output luma plane (UQ8.0)
[in]dst0_addr[]Pointer to structure containing dimensional information of dst0
[out]dst1[]Pointer to array containing output interleaved UV plane (UQ8.0)
[in]dst1_addr[]Pointer to structure containing dimensional information of dst1
[in]scratch[]Pointer to array of scratch memory (UQ8.0)
[in]scratch_sizeParameter indicating the size of scratch memory

Copyright 2023, Texas Instruments Incorporated