S3TC

From MultimediaWiki
Revision as of 09:53, 30 April 2007 by Ivo (talk | contribs) (first draft, explain dxt1 format)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

S3 Texture Compression (S3TC) is a family of image compression algorithms developed by S3 for their Savage 3D line of graphics cards. It is also known as DXTn or DXTC.

Introduction

S3TC is a lossy compression algorithm that transforms blocks of 4x4 RGBA32 pixels to either 64 or 128 bits. The different compression schemes are often denoted by their Microsoft assigned FourCC.

DXT1

16 input pixels are encoded as follows:

uint16_t c0;
uint16_t c1;
uint32_t pixels;

c0 and c1 are RGB565 color values. pixels are 16 2-bit pixels, referring to c0..c3. Each component of c2 and c3 is calculated by:

if (c0 > c1)
 c2 = (2 * c0 + c1) / 3
 c3 = (2 * c1 + c0) / 3
else
 c2 = (c0 + c1) / 2
 c3 = 0

The pixels are stored in raster scan order and start at the least significant two bits of pixels.

DXT2/3

DXT4/5

Containers

S3TC compressed textures can be found in the following containers: