Working in the YUV color space simplifies the calculations involved for PROCAMP adjustment control of a video stream.
Y processing
To perform ProcAmp adjustment for the Y component, subtract from the Y value to position the black level at zero. This removes, the DC offset so, adjusting the contrast does not vary the black level. Because y values might is less than, negative Y values should is supported at this point. Contrast is adjusted by multiplying the YUV pixel values by a constant. If U and V are not adjusted, a color shift would result whenever the contrast is changed. The Brightness property value was added (or subtracted) from the contrast adjusted Y values; This was done to avoid introducing a DC offset due to adjusting the contrast. Finally, the value of added to reposition the black level at 16.
The following equation summarizes the steps described in the previous paragraph. C is the contrast value and B are the brightness value.
Y ' = ((Y-16) x C) + B + 16
UV processing
To perform ProcAmp adjustment for the U and V components, subtract-both U and V values to position the range Arou nd zero. The hue is implemented by mixing the U and V values together as shown in the following equations. H is the desired hue angle:
U ' = (U-128) x cos (h) + (V-128) x sin (h) V ' = (V-128) x cos (h)-(U-128) x Sin (h)
Saturation is adjusted by multiplying U ' and V ' by a pair of constants, and then by adding. The combined processing of hue and saturation on the UV data are shown in the following equations. H is the desired hue angle, C is the contrast value, and S is the saturation value:
U ' = ((U-128) x cos (h) + (V-128) x Sin (h)) x C x s) + 128V "= (((V-128) x cos (h)-(U-128) x Sin (h)) x C x s) + 128http S://msdn.microsoft.com/en-us/library/ff569191%28v=vs.85%29.aspx
Processing in the 8-bit YUV Color Space