Convert from RGB to YCbCr
MT, SSE2, Family10h
FwStatus | fwiRGBToYCbCr_8u_C3R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToYCbCr_8u_AC4R | ( | const Fw8u * pSrc, int srcStep, Fw8u * pDst, int dstStep, FwiSize roiSize ); | |
FwStatus | fwiRGBToYCbCr_8u_P3R | ( | const Fw8u * const pSrc[3], int srcStep, Fw8u * const pDst[3], int dstStep, FwiSize roiSize ); |
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). |
These functions step through an ROI in a source buffer, convert the source data from the RGB color model to the YCbCr color space, and write the converted data to a destination buffer.
A gamma-corrected RGB image (pSrc) declared in the ROI (roiSize) is converted to a YCbCr image (pDst).
The following conversion formulas are used:
Y = 0.257*R + 0.504*G + 0.098*B + 16 Cb = -0.148*R - 0.291*G + 0.439*B + 128 Cr = 0.439*R - 0.368*G - 0.071*B + 128
The input RGB contains the range [0 to 255].
The output Y nominally contains the range [16 to 235].
The output Cb and Cr contains the range [16 to 240], with 128 corresponding to zero.