Game Development Reference
C b C r
YC b C r
Figure 2.2. Chroma subsampling patterns.
number of vertical samples. Example results of chroma subsampling are illus-
trated in Figure 2.2, where decoded samples are shown by combining luminance
and chrominance information.
Forward Discrete Cosine Transform
After chroma subsampling, a forward discrete cosine transform (FDCT) is applied
to each 8
8 block. Before applying FDCT, color components are level shifted
to the range [
128 , 127]. The level shift is applied by subtracting 128 from each
component. Subsampled and level-shifted components are grouped into an 8
matrix referred to as M . The FDCT is calculated by matrix multiplications, seen
in Equation (2.3), where matrices F and F T are defined using Equation (2.2):
if i =0,
F i,j =
8 cos (2 j +1) iπ
if i> 0,
D = FMF T .
FDCT converts color information to a frequency domainwheremoreecient
encoding schemes can be used. When applying FDCT, components are divided
into differing intensity frequencies. The frequency values are referred to as DCT
coecients . Coecients are usually grouped in a 8
8 matrix, which is referred to
as D . The coecient D 00 is called the DC coecient , which has zero frequency in
both dimensions. The remaining 63 coecients are called AC coecients ,which
have nonzero frequency information. FDCT concentrates most signal information
in the lower spatial frequencies, which often results in multiple coecients with
zero or near-zero amplitude. Frequency amplitudes that are zero or near-zero are
ignored in the following steps.