Chroma subsampling

Our eyes see fine detail in brightness, but only coarse detail in color. Image and video formats exploit this: they convert to YCbCr and store the color channels CbC_b and CrC_r at a lower resolution than the luma YY. Reduce the resolution of either and compare how much you notice.

Original click to set the zoom center
Subsampled reduced channel upsampled back to 320 × 240 px
Channels of the subsampled image mid gray means Cb=Cr=128C_b = C_r = 128: no color
YY
CbC_b
CrC_r

Luma and chroma

The YCbCr transform splits a color into the luma YY, a weighted sum of R, G and B, and two color differences CbC_b and CrC_r:

Y=0.299 R+0.587 G+0.114 B,Cb=128+B−Y1.772,Cr=128+R−Y1.402Y = 0.299\,R + 0.587\,G + 0.114\,B, \qquad C_b = 128 + \frac{B - Y}{1.772}, \qquad C_r = 128 + \frac{R - Y}{1.402}

Edges, texture and text live almost entirely in YY. The chroma channels mostly contain large, smooth regions, because object colors change much less often than shading does. The visual system matches this: its resolution for color differences is several times lower than for brightness.

Subsampling schemes

The chroma channels are stored at a reduced resolution, one value per fx×fyf_x \times f_y block (here the block average). The notation J:a:bJ{:}a{:}b describes a region 4 pixels wide and 2 rows high: J=4J = 4 luma samples per row, aa chroma samples in the first row and bb additional ones in the second.

With fx×fyf_x \times f_y blocks, the number of stored values per pixel drops from 3 to

1+2fxfy,e.g. 1.5 for 4:2:0, which halves the raw data.1 + \frac{2}{f_x f_y}, \qquad \text{e.g. } 1.5 \text{ for 4:2:0, which halves the raw data.}

To display the image, the decoder upsamples the chroma channels back to full size, by repeating each value (nearest neighbor) or by interpolating between block centers (bilinear), and converts back to RGB.

Where it fails. Subsampling is nearly invisible in natural images, but not for sharp edges between strongly colored regions of similar brightness, such as red text on blue. There the edge is mostly a chroma edge, and it gets blurred or blocky. This is why screenshots with colored text often look smeared after JPEG compression.

Try this