Using-Basis-Universal-to-decompress-any-supported-GPU-texture-format

This content was automatically converted from the project's wiki Markdown to HTML. See the Basis Universal GitHub wiki for the latest content.

The Basis Universal encoder/transcoder libraries contain easy to use functions to unpack the following standard compressed GPU texture formats:

Full support:

Limited support (just what we encode to):

Before you can unpack textures, be sure to call basisu_encoder_init() once at startup.

To unpack individual 4x4 (or 8x4 for FXT1) texel blocks to raw RGBA pixels, use one of these functions declared in encoder/basisu_gpu_texture.h:

bool unpack_block(texture_format fmt, const void *pBlock, color_rgba *pPixels, bool astc_srgb);
bool unpack_block_hdr(texture_format fmt, const void* pBlock, vec4F* pPixels);

This doesn't work on PVRTC1 textures, because the decoder needs access to the surrounding blocks. Alternately, you can create a basisu::gpu_image object, then call gpu_image::unpack() or gpu_image::unpack_hdr(). This works on any supported format, including PVRTC1.