Table of contents
GDI
TOC
Collapse the table of content
Expand the table of content

Processing in the 8-bit YUV Color Space

Last Updated: 2/14/2017

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 16 from the Y value to position the black level at zero. This removes the DC offset so that adjusting the contrast does not vary the black level. Because Y values might be less than 16, negative Y values should be 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 will result whenever the contrast is changed. The brightness property value is added (or subtracted) from the contrast adjusted Y values; this is done to avoid introducing a DC offset due to adjusting the contrast. Finally, the value 16 is 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 is the brightness value.

Y' = ((Y - 16) x C) + B + 16

UV Processing

To perform ProcAmp adjustment for the U and V components, subtract 128 from both U and V values to position the range around zero. The hue property 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 128 to each. The combined processing of hue and saturation on the UV data is 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) + 128
V'' = (((V-128) x Cos(H) - (U-128) x Sin(H)) x C x S) + 128

Send comments about this topic to Microsoft

© 2017 Microsoft