RGBToYUV422

Convert from RGB to YUV with 4:2:2 sampling

Synopsis

FwStatus   fwiRGBToYUV422_8u_C3C2R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYUV422_8u_P3R ( const Fw8u * const pSrc[3]int srcStepFw8u * pDst[3]int dstStep[3]FwiSize roiSize );
FwStatus   fwiRGBToYUV422_8u_P3 ( const Fw8u * const pSrc[3]Fw8u * pDst[3]FwiSize imgSize );
FwStatus   fwiRGBToYUV422_8u_C3P3R ( const Fw8u * pSrcint srcStepFw8u * pDst[3]int dstStep[3]FwiSize roiSize );
FwStatus   fwiRGBToYUV422_8u_C3P3 ( const Fw8u * pSrcFw8u * pDst[3]FwiSize imgSize );

Parameters

dstStep   Destination buffer step size (width of the buffer in bytes).
dstStep[3]   Destination three-channel planar buffer step size (array values define width of each plane in bytes).
imgSize   Specifies the dimensions of an entire image.
pDst   Pointer to a location in a destination buffer.
pDst[3]   Pointer to a location in a three-channel planar destination buffer (array values point to a location in each plane).
pSrc   Pointer to a location in a source buffer.
pSrc[3]   Pointer to a location in a three-channel planar source buffer (array values point to a location in each plane).
roiSize   Specifies the height and width of an ROI.
srcStep   Source buffer step size (width of the buffer in bytes).

Description

These functions convert data in a source buffer from the RGB color model to the YUV color space with 4:2:2 chroma subsampling, and write the converted data to a destination buffer.

The repeating versions of the functions step through an ROI in a source buffer and write the converted data to a destination buffer.

A gamma-corrected RGB image (pSrc) is converted to a YUV image with 4:2:2 chroma subsampling.

The following conversion formulas are used:

 Y = 0.299*R + 0.587*G + 0.114*B
 U = -0.147*R + 0.289*G + 0.436*B
 V = 0.615*R - 0.515*G - 0.100*B
Where:

The input RGB contains the range [0 to 255].
The output Y contains the range [0 to 255].
The output U contains the range [16 to 240], with 128 corresponding to zero.
The output V ranges from [-157 to 157].

Versions of the functions that don't specify an ROI apply the conversion to the whole image buffer.