456 V Transfers
31.2 Overview of DXT Compression
DXT compression, also S3 Texture Compression, S3TC [S3TC 12], refers to a group
of lossy, ﬁxed-rate image-compression algorithms that are now widely supported in
graphics hardware, as they are well suited for hardware-accelerated texture decom-
pression for 3D graphics.
The compression ratio is ﬁxed, either 8:1 or 6:1 for the DXT1 format with 1-
bit transparency or without alpha, respectively. Formats with higher quality alpha
encoding have 4:1 compression ratios.
All compression schemes encode the RGB part in the same way by compressing
blocks of 4 × 4 input pixels in 64 bits of color output. The output consists of two
16-bit RGB 5:6:5 quantized color values, followed by 16 2-bit values that determine
how the corresponding pixel color is computed: either one of the two colors or a
blend between them.
The a lpha component can be encoded in several ways depending on the mode.
F or DXT4 and DXT5, it’s encoded using a scheme similar to the color part but with
two 8-bit alpha values and 3-bit interpolation values for each pixel.
DXT compression has some limitations, and the image quality can be degraded
if used naively on some images with sharp changes in colors (Figure 31.3). However,
it is well suited for most of the textures used in 3D graphics, as these are usually more
The quality loss is offset by the signiﬁcantly reduced memory and bandwidth
requirements; compressed textures of the same dimensions render faster as the result.
Alternatively, a gain in quality can be achieved by using higher-resolution textures
for the same amount of memory.
31.3 DXT Compression Algorithms
While the decompression algorithm is deﬁned exactly, there are multiple compression
algorithms with different quality output. The quality mainly depends on the way
the two endpoint color values are selected [Brown 06]. High-quality compression
algorithms try to ﬁnd the best endpoints for the given set of pixels. Testing all possible
endpoints by a bruteforce method is very time consuming, so the goal is to reduce
the number of combinations to be tested.
Colors in a 4 × 4 block can be considered points in 3D RGB space. Resulting
compressed colors must lie on a line between two selected endpoints in this space.
The direction along which the points vary the most can be found using the technique
of principal components analysis. It is likely that this direction, called the principal
axis, is very close to the direction of the line through the optimal endpoints, and it
can b e used to seed the search.
Nevertheless, these algorithms are still too slow for real-time compression, for
which we need a fast selection of the compression line. We can use the extents of