Game Development Reference
Figure 2.1. Baseline JPEG compression scheme.
the process of encoding uncompressed RGB data into compressed JPEG data.
The sequential baseline is the codec implemented in the presented GPU technique.
The JPEG codec is widely used and sucient for most applications. Several
encoding steps are required and a brief introduction to each step is presented.
Figure 2.1 outlines the main steps that are applied to 8
8 blocks of pixels
independently in each color-space component plane. Images with dimensions
that are not multiples of 8 have border pixels padded by repeating the edge
color. Processed blocks are appended to a final JPEG bit stream.
2.1.2 Color-Space Transform
This first step in the encoding process is optional as the JPEG algorithm is not
bound to any specific color space, such as RGB or YC b C r . Encoders often sample
and convert source-image RGB data into YC b C r color-space data, where lumi-
nance and chrominance information are separated. Luminance data is stored in
the Y component and chrominance data in the C b
and C r
components. RGB to
YC b C r
conversion—see Equation (2.1)—is defined in the ITU-R BT.601 stan-
0 . 587G
0 . 114B ,
0 . 168736R
0 . 331264G
0 . 5B ,
0 . 5R
0 . 418688G
0 . 081312B .
2.1.3 Chroma Subsampling
Chroma subsampling describes different sampling patterns used to lower resolu-
tion of the C b C r planes. Chroma resolution can be reduced because human vision
is more sensitive to luminance variations than to chrominance variations [Pen-
nebaker and Mitchell 93]. Luminance information is rarely modified, normally
maintaining source-image resolution. One common approach to lower chromi-
nance resolution is by averaging adjacent chroma components together [Kerr 12].
Sampling patterns are described as W : H : V ,where W represents sampling
width, H represents the number of horizontal samples, and V