Advanced | Help | Encyclopedia Directory

# YUV

Example of U-V color plane, Y value = 0.5

YUV is the color space used in the PAL system of television broadcasting which is the standard in most of Europe and some other places. Y stands for the luminance component (the brightness) and U and V are the chrominance (color) components. The YCbCr or YPbPr color space, used in computer component video, is derived from it (Cb/Pb and Cr/Pr are simply scaled versions of U and V), and is sometimes inaccurately called "YUV". The YIQ color space used in the NTSC television broadcasting system is related to it, although in a less simple way.

YUV signals are created from an original RGB (red, green and blue) source. The weighted values of R, G and B are added together to produce a single Y signal, representing the overall brightness, or luminance, of that spot. The U signal is then created by subtracting the Y from the blue signal of the original RGB, and then scaling; and V by subtracting the Y from the red, and then scaling by a different factor. This can be accomplished easily with analog circuitry.

The following equations can be used to derive Y, U and V from R, G and B:

 [itex]Y[itex] [itex]= 0.299 R + 0.587 G + 0.114 B[itex] [itex]U[itex] [itex]= 0.492 (B – Y)[itex] [itex]= -0.147 R – 0.289 G + 0.436 B[itex] [itex]V[itex] [itex]= 0.877 (R – Y)[itex] [itex]= 0.615 R – 0.515 G – 0.100 B[itex]

or using matrices

[itex] \begin{bmatrix} Y \\ U \\ V \end{bmatrix} = \begin{bmatrix} 0.299 & 0.587 & 0.114 \\ -0.147 & -0.289 & 0.436 \\ 0.615 & -0.515 & -0.100 \end{bmatrix} \begin{bmatrix} R \\ G \\ B \end{bmatrix} [itex]

Here, R, G and B are assumed to range from 0 to 1, with 0 representing the minimum intensity and 1 the maximum.

Two things to note:

• The top row is identical to that of the YIQ color space
• If [itex]\begin{bmatrix} R & G & B \end{bmatrix}^{T} = \begin{bmatrix} 1 & 1 & 1 \end{bmatrix}[itex] then [itex]\begin{bmatrix} Y & U & V \end{bmatrix}^{T} = \begin{bmatrix} 1 & 0 & 0 \end{bmatrix}[itex]. In other words, the top row coefficients sum to unity and the last two rows sum to zero.

(Note that this formula uses an outdated, but common, model of Y; HDTV uses a slightly different formula)

As most actual uses of RGB->YUV are in integer math, it's convenient to have a fixed-point approximation as well.

 Y := min(abs(r * 2104 + g * 4130 + b * 802 + 4096 + 131072) >> 13,235)
U := min(abs(r * -1214 + g * -2384 + b * 3598 + 4096 + 1048576) >> 13,240)
V := min(abs(r * 3598 + g * -3013 + b * -585 + 4096 + 1048576) >> 13,240)


## Luminance/chrominance systems in general

The primary advantage of luminance/chrominance systems such as YUV and its relatives YIQ and YDbDr is that they remain compatible (thanks to Georges Valensi) with black and white analog television. The Y signal is essentially the same signal that would be broadcast from a normal black and white camera (with some subtle changes), and the U and V signals can simply be ignored. When used in a color setting the subtraction process is reversed, resulting in the original RGB color space.

Another advantage is that the signal in YUV can be easily manipulated to deliberately discard some information in order to reduce bandwidth. The human eye actually has fairly low color resolution: the high-resolution color images we see are processed by the visual system by combining the high-resolution black and white image with the low-resolution color image. Using this information to their advantage, standards such as NTSC reduce the amount of signal in the chrominance considerably, leaving the eye to recombine them. For instance, NTSC saves only 11% of the original blue and 30% of the original red, throwing out the rest. Since the green is already encoded in the Y signal, the resulting U and V signals are substantially smaller than they would otherwise be if the original RGB or YUV signals were sent. This filtering out of the blue and red signals is trivial to accomplish once the signal is in YUV format.

However this process, obviously, reduces the quality of the image. In the 1950s when NTSC was being created this was not a real concern because common equipment could not display images any better than the quality of the signal they were already receiving. But today a modern television can display more information than is contained in these lossy signals. This has led to a number of attempts to record images with as much of the YUV signal as possible, including S-Video on VCRs. YUV was also used as the standard format for common video compression algorithms such as MPEG-2, which is used in digital television and for DVDs. The professional CCIR 601 uncompressed digital video format also uses the YUV color space, for compatibility with previous analog video formats, which can then be easily mixed into any output format needed.

YUV is a versatile format which can be easily combined into other legacy video formats. For instance if you amplitude-modulate the U and V signals onto quadrature phases of a subcarrier you end up with a single signal called C, for chroma, which can then make the YC signal that is S-Video. If you mix the Y and C signals, you end up with composite video, which almost any television can handle. All of this modulating can be accomplished easily in low-cost circuitry, while the demodulation is often very difficult indeed. Leaving the signal in the original YUV format thus made DVDs very simple to construct, as they could easily downmix to support either S-video or composite and thus guarantee compability with simple circuits, while still retaining all of the original information from the source RGB signal.

## Types of sampling

To get a digital signal, YUV images can be sampled in several different ways; see chroma subsampling.