Possible
Applications for VQ
Your
project may benefit from VQ image compression if you have
access to the renderer and you can implement decompression
directly inside it. It is also helpful if you can't rely on
your hardware renderer supporting a particular standard texture-compression
format and still need to stream from disk significant amounts
of image data.
What
about DXTn texture compression, you might ask? Well, if you
can count on hardware support for a texture-compression scheme
on your minimum target platform, it is most certainly a good
idea to stick with it: after all, somebody has already paid
for the tens of thousands of transistors to implement it,
and you'd better make good use of them, save tons of RAM on
the video card, and keep its precious memory bandwidth down.
However, if, for some reason—for example, software rendering
(gasp!), texture preprocessing, or support for legacy hardware
(where "legacy" may mean "older than nine months"
in our business)—you need to have at some point in your
application access to the decompressed pixels of your texture,
VQ might provide a better answer. DXTn compresses textures
to 4 bits/pixel (for fully opaque or single-bit-alpha images)
or 8 bits/pixel (for images with alpha), while in our experiments
we rarely needed more than about 3 bits/pixel with VQ. Decompression
times for DXTn are much larger than those for VQ: in our experiments
with a 1024x1024 true-color image, DXTn decompression took
about 200ms, straight copying of uncompressed data took about
25ms, and VQ decompression from a 256-entry codebook took
about 16ms. (Note: We didn't have access to DXTn decompression
source code, so we did what most developers would do to decompress
DXTn textures, we made the DirectX drivers do it for us. Driver
code may or may not be optimized, so above figures should
be taken with a grain of salt. Still, the nature of DXTn compression
makes us believe that it's impossible to reach VQ decompression
speeds.)
Here's
a quick summary of pros and cons of VQ for image compression:
Pros: