YCbCr Formats

From MediaCoderWiki

Jump to: navigation, search

Contents

YCbCr

Many modern video codecs rely on a YCbCr colorspace. More correctly written this is YCbCr, with the 'b' and 'r' characters as subscripts. This is what the components represent:

  • Y = luminance, or intensity
  • Cb = "blue chrominance", or more precisely the color deviation from gray on a blue-yellow axis
  • Cr = "red chrominance", or more precisely the color deviation from gray on a red-cyan axis

Green can be calculated based on these three values.

YCbCr is often falsely mixed up with YUV, which is a different colorspace that is not used in digigal media but in analog PAL-based stuff as analog TV transmission or analog video tapes.

Note that with most digital RGB color encodings, every single pixel has a different R, G and B sample. The same is not true with many YCbCr color encodings. These YCbCr variants operate on the empirical evidence that the human eye is more sensitive to variations in the intensity of a pixel rather than variations in color. Thus, every pixel in an image of such a YCbCr variant has an associated Y sample, but groups of pixels share Cb and Cr samples.

YCbCr 1:1:1

YCbCr 1:1:1 refers to a packed YCbCr format in which each pixel is represented by one Y , one Cb and one Cr sample.

YCbCr 2:1:1

YCbCr 2:1:1 refers to a packed YCbCr format in which 2 pixels in a group of 2 consecutive pixels in a row is represented by one Y sample for each pixel but both pixels share a single Cb sample and a single Cr sample.

YCbCr 4:1:0

Note that thes FourCCs and other "YUV" names only reflect that YCbCr is often falsely mixed up with YUV, which is not YCbCr but a different color space that is used in analog PAL-based stuff (analog TV, video tapes, ...) and not in digital media.

YCbCr 4:1:0 indicates a planar YCbCr colorspace where a 4x4 block of pixels in an image is represented by 16 Y samples, 1 for each pixel, but all 16 pixels share a Cb sample and a Cr sample.

If YCbCr 4:1:0 data is stored in YUV9 or IFO9 format, it is stored with all of its Y data first, then its Cb data, then its Cr data. YVU9 data swaps the Cr and Cr planes.

For trivia, the 9 in YUV9/YVU9 most likely refers to the number of bits needed to represent a single pixel. Since 18 bytes, or 144 bits represent 16 pixels, an average of 9 bits are required to represent a single pixel in this scheme.

YCbCr 4:1:1

YCbCr 4:1:1 refers to a packed YCbCr format in which 4 pixels in a group of 4 consecutive pixels in a row is represented by one Y sample for each pixel but all 4 pixels share a single Cb sample and a single Cr sample.

YCbCr 4:2:0

  • FourCCs: I420, YV12

(These FourCC names only reflect that YCbCr is often falsely mixed up with analog PAL's YUV color space.)

YCbCr 4:2:0 indicates a planar YCbCr colorspace where a 2x2 block of pixels in an image is represented by 4 Y samples, 1 for each pixel, but all 4 pixels share a Cb sample and a Cr sample.

YCbCr 4:2:0 can be transported within a general purpose container format. When the data is designated with a FourCC of I420 all of the Y data appears first, followed by the Cb data, then then Cr data. YV12 is the same with the order of the Cb and Cr planes revered.

For trivia, the 12 in YV12 most likely refers to the number of bits needed to represent a single pixel. Since 6 bytes, or 48 bits represent 4 pixels, an average of 12 bits are required to represent a single pixel in this scheme.

YCbCr 4:2:2

  • FourCCs: YUY2, UYVY

(These FourCC names only reflect that the YCbCr of digital media is often falsely mixed up with analog PAL's YUV color space.)

YCbCr 4:2:2 is a packed YCbCr format in which a pair of consecutive pixels is represented by 1 Y sample each but share a Cb sample and a Cr sample.

This type of data may be packaged in a container format with a a FourCC of YUY2 which indicates the following byte formatting:

 Y0 Cb Y1 Cr

The first pixel is a a function of (Y0, Cb, Cr) and the second pixel is a function of (Y1, Cb, Cr). Alternately, the FourCC UYVY is used to indicate YCbCr 4:2:2 data with a byteswapped order:

 Cb Y0 Cr Y1

For trivia, the 2 in YUY2 most likely refers to the number of bytes needed to represent a single pixel. Since 4 bytes represent 2 pixels, an average of 2 bytes are required to represent a single pixel in this scheme.

See Also


Personal tools