RGBToYUV

Convert from RGB to YUV

Supported Technologies

MT, SSE2, Family10h

Synopsis

FwStatus   fwiRGBToYUV_8u_C3R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYUV_8u_AC4R ( const Fw8u * pSrcint srcStepFw8u * pDstint dstStepFwiSize roiSize );
FwStatus   fwiRGBToYUV_8u_P3R ( const Fw8u * const pSrc[3]int srcStepFw8u * pDst[3]int dstStepFwiSize roiSize );
FwStatus   fwiRGBToYUV_8u_C3P3R ( const Fw8u * pSrcint srcStepFw8u * pDst[3]int dstStepFwiSize roiSize );

Parameters

dstStep   Destination buffer step size (width of the buffer in bytes).
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 step through an ROI in a source buffer, convert the source data from the RGB color model to the YUV color space, and write the converted data to a destination buffer.

A gamma-corrected RGB image (pSrc) declared in the ROI is converted to a YUV image (pDst).

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

In order to fit the range [0 to 255], a constant value of 128 is added and the values are saturated to the range [0 to 255].