YUV - Numerical Approximations

Numerical Approximations

Prior to the development of fast SIMD floating-point processors, most digital implementations of RGB->Y'UV used integer math, in particular fixed-point approximations. In the following examples, the operator "" denotes a right-shift of a by b bits.

Traditional 8 bit representation of Y'UV with unsigned integers uses the following

1. Basic transform

\begin{bmatrix}Y' \\ U \\ V \end{bmatrix} =
\begin{bmatrix} 66 & 129 & 25 \\ -38 & -74 & 112 \\ 112 & -94 & -18
\end{bmatrix}
\begin{bmatrix} R \\ G \\ B \end{bmatrix}

2. Scale down to 8 bits with rounding


\begin{array}{rcl}
Y' &=& (Y' + 128) \gg 8\\
U &=& (U + 128) \gg 8\\
V &=& (V + 128) \gg 8
\end{array}

3. Shift values


\begin{array}{rcl}
Y' &=& Y' + 16\\
U &=& U + 128\\
V &=& V + 128
\end{array}

Y' values are conventionally shifted and scaled to the range (referred to as studio swing) rather than using the full range of (referred to as full swing). This confusing practice derives from the MPEG standards and explains why 16 is added to Y' and why the Y' coefficients in the basic transform sum to 220 instead of 255. U and V values, which may be positive or negative, are summed with 128 to make them always positive.

Read more about this topic:  YUV

Famous quotes containing the word numerical:

    There is a genius of a nation, which is not to be found in the numerical citizens, but which characterizes the society.
    Ralph Waldo Emerson (1803–1882)