What is the difference between texture compression and file/storage compression?

What is the difference between texture compression and file/storage compression?

Developers are familiar with compressed image file formats such as jpg or png, however it is

important to remember that there is a distinction between these forms of ‘storage’ compression and

the texture compression discussed in this document.

Storage compression

The primary requirement of ‘storage’ compression schemes (such as ZIP, TAR, RAR & 7ZIP) is that files compressed using them should occupy as small an amount of storage in a file system as possible; there is no requirement that the data stay compressed while in use. The result is that ‘storage-based’ image file formats tend to produce very small file sizes, often for very high (or lossless) image quality. The downside is that these images must be decompressed before they are uploaded to the GPU driver, which also results in a large memory bandwidth cost as the data is transferred at 24/32bits per pixel.

Texture compression

Texture compression schemes, such as PVRTC, are designed to be directly usable by the GPU. There are two features common to most texture compression formats that make them more efficient for the GPU; a lower number of bits per pixel and optimizations for random access (typically in the form of a fixed bit rate).

A lower bit rate (such as 16, 8, 4 & 2 bits per pixel) reduces the amount of data that needs to be sent over the bus from memory to the GPU. This reduction in memory bandwidth is particularly important on mobile devices where it is limited and frequently a bottleneck for graphics applications. Once the compressed data has been send to the GPU it is then decompressed on-chip into a standard 24/32bit RGB/RGBA value that can be used in shaders.

Can I use texture compression and storage compression?

Yes. Even when textures have been compressed into a format that is more efficient for GPU usage, they can also be ‘storage compressed’ to further reduce their file size.

As texture compression schemes - such as PVRTC - tend to be fixed bit rate and optimized for data locality, they are well suited to storage compression.