AfterDawn.com

RGB

For our purposes we'll consider 24 bit RGB (R'G'B') to be uncompressed color. The number 24 refers to the total number of bpp (bits per pixel) used to describe color. A 24 bit number has a range of 0 (no color or black) to 16,777,215 for a total of 16,777,216 different colors. Since Red, Green, and Blue are each described by 8 bits (24/3), which gives a range of 0 (no Red, no Green, or No Blue) to 255 for a total of 256 possible variations of each primary color. From this you can start to get an idea of why using RGB color presents storage challenges. If you were to use the lowest resolution allowed for an NTSC DVD frame (352x240) with RGB24 color (the common name for 24 bit RGB) you'd end up with 352x240x24 = 2,027,520 bits or 253,440 Bytes for each frame. And that's without any of the additional information required for correct playback. At that bitrate, a single second of video is over 7 Megabytes, a minute is nearly 2/3 of a CD, and a full hour is over 25 Gigabytes - more than five DVD-9 discs. At the highest DVD resolution, which most DVDs are encoded at, it would be over 100GB per hour.

Color Space

The term color space refers to a method of describing color. RGB is one color space, but not the only one. Just as the human eye is more sensitive to certain wavelengths of light than others, it's also more sensitive to changes in luminosity (how bright something is), than chromaticity (changes in hue and saturation of each primary color). Therefore it makes sense to use a color space that takes that handles luminosity and chromaticity separately. The analog color space that does this is called YUV or YPbPr. Since both are technically analog terms, you may also see this referred to with the correct terminology of Y'U'V' or Y'CbCr. As the notation suggests, The difference is that YUV values are calculated from linear scaled analog RGB, while Y'U'V' values are figured from gamma corrected R'G'B'.

Note: Even though most digital compression formats use YUV, that doesn't mean YUV itself is compressed. It's simply a more sophisticated model of human perception than RGB.

How YUV Works

The most important difference between RGB and YUV is separation of luminosity and chromaticity characteristics, commonly referred to as luminance and chrominance in the analog (ie linear scaled) domain. For digital video they're actually given the names luma and chroma to denote the use of Y', Cb, and Cr calculations vs. Y, Pb, and Pr. Since most luma is actually perceived in green light waves, and conversely most information the human eye perceives from the color green is luminance, green can be omitted from the chroma information completely. That leaves us with chroma components of only Red and Blue. Each of the three components may also be referred to as a channel, as in the Y (Luma) Channel, U (Blue) Channel, and V (Red) Channel.

Regardless of what color space is used to store video, it always starts out and is displayed in RGB format. In order to make sure the RGB values used for display are as close as possible to the ones oroginally encoded to YUV, both the encoder and decoder need to use the same calculations. Those calculations are called colorimetry. Fortunately there are specific standards that cover this. For the most part, the only two standards you need to know about are Rec. 601 (aka ITU.601, BT.601, or SMPTE 170M) and Rec. 709 (aka ITU.709 or BT.709). Rec. 601 is used for MPEG-1, MPEG-4 ASP (DiVX, XViD, and the like), and DV. MPEG-2 may use Rec. 601, Rec. 709, or SMPTE 240M (almost the same as Rec. 709). HDTV and DVD video are always supposed to use Rec. 709. Just as with nearly everything related to digital video this isn't always as simple as it should be. Some HDTV signals and DVDs are encoded with Rec. 601, and sometimes the colorimetry even changes in the middle of a video stream. In the case of MPEG-2, although the colorimetry used is stored in the file (since it supports multiple standards) sometimes it's missing so Rec. 709 is assumed. Since there's no way to confirm this from the actual frame data this may or may not be a correct assumption.

previous  | next

Table of Contents

  1. 1. Introduction
  2. 2. Basic Facts
  3. 3. Color Encoding
  4. 4. Color Compression
  5. 5. Common Color Spaces
Written by: Rich Fiscus