Microsoft has developed an algorithm (TREC - Texture and Rendering Engine
Compression) that can compress and decompress texture and image data as it is
stored and retrieved from image memory.
The TREC algorithm uses a DCT block-based algorithm similar to JPEG with
several key differences:
- It operates individually and independently on small blocks (8 by 8
pixels) of a complete image or texture; such a small image region is
likely to have coherent information statistics that produce a high
compression.
- It allows a variable compression ratio within an image, for either
rate control or quality control. It compresses the alpha-blending
(opacity) component as well as the usual color components (R, G, and B or
Y, U, and V).
- Its implementation requires a lower gate complexity due to
simplifications in color-space conversion and quantization.
For textures, the discrete cosine transform (DCT) calculates coefficients that
multiply the basis functions of the DCT. Applying the DCT to an image or
texture yields a set of coefficients that equivalently represent the image or
texture. An image or texture in this form is in the frequency domain.
Analysis
TREC Texture Compression ratio is about 10x.
Decoding is very difficult with JPEG compression. JPEG compression is based
on the discrete cosine transformation (DCT) and that is a relatively complex
mathematical calculation. Special hardware can handle this in realtime but its
cost is expensive. The cost is not just the large amount of logic required to
do the decoding. Because of the large latency incurred in decoding a block of
TREC or JPEG texture, a significant amount of latency-compensating buffering
is required as well, further increasing the cost and complexity of the logic
around the decoder. Select a single block or pixel from a JPEG image and
decompressing that without decompressing the whole block or image is almost
impossible. Because of the changing compression ratio (varies in the
image) you don't know where a specific pixel is situated in the file.
TREC is expensive to implement and the quality of many images will
still look better with Block Decomposition. Also, DCT-based compression
introduces low frequency artifacts - ringing or blocky artifacts - that are
not easily removed with standard texture filtering algorithms like trilinear
filtering.