The eye is sensitive to brightness and dull to color, so codecs work in luma (Y) and chroma (Cb, Cr) instead of RGB. Includes BT.709 formulas and full vs limited range.
Camera sensors and display panels both work in RGB. Yet codecs take video in YCbCr (commonly called YUV) almost without exception. Why bother converting?
① Human vision is sensitive to brightness and dull to color. If brightness and color are separated, you can cut data from the color side alone. ② R, G, and B are highly correlated with one another. Where it's bright, R, G, and B are all large. If you concentrate the overlapping information into one channel (Y), the information in the other two channels drops sharply.
The BT.709 (HD standard) conversion is below. Note that the coefficients give the greatest weight to G. The human eye is most sensitive to green.
Y' = 0.2126 R' + 0.7152 G' + 0.0722 B'
Cb' = (B' - Y') / 1.8556
Cr' = (R' - Y') / 1.5748
* The prime (') means the value has gamma correction applied.
Almost everything a codec handles is a primed value.YUV was originally a term from analog PAL broadcasting, while YCbCr is the digital representation. In the field everyone habitually calls it all 'YUV,' but when writing spec documents, YCbCr is correct. Add the distinction between Y'CbCr (gamma applied) and YCbCr (linear), and it gets more complicated still. What we handle is, in practice, always Y'CbCr.
The value range of 8-bit video is 0–255. But because of broadcast legacy, two conventions coexist.
The headroom (0–15, 236–255) was space to hold overshoot/undershoot in the analog era.
99% of "the video looks washed out" or "black shows up as gray" is a misinterpreted range flag. Reading limited-range video as full kills the contrast; the opposite blows out highlights and shadows (clipping). Accidents where the bitstream's video_full_range_flag and the container metadata disagree happen really often.
The gamma-corrected brightness component. Makes up most of a codec's data.
Color information with brightness removed. Blue difference and red difference.
The set of RGB↔YCbCr conversion coefficients. BT.601, 709, and 2020 each differ.
A bit signaling whether the full 0–255 is used or it's limited to 16–235.
Luminance is physical linear brightness (Y); luma is Y' after gamma. Often distinguished in papers.
What is the main reason codecs use YCbCr instead of RGB?
In 8-bit limited-range video, what Y value corresponds to 'pure black'?