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:

    The moment a mere numerical superiority by either states or voters in this country proceeds to ignore the needs and desires of the minority, and for their own selfish purpose or advancement, hamper or oppress that minority, or debar them in any way from equal privileges and equal rights—that moment will mark the failure of our constitutional system.
    Franklin D. Roosevelt (1882–1945)