| Name | ATX_imgdec_pvr |
| Name strings | KD_ATX_imgdec_pvr |
| Contributors | Russell Wood, Phil Huxley, Elizabeth Wootten, Tim Renouf |
| Contacts | Antix Labs Limited |
| Status | Implemented by Antix Labs |
| Version | Version 5, 2009-02-04 |
| Number | 13 |
| Dependencies | Requires OpenKODE Core 1.0 and the ATX_imgdec extension. This extension is written based on the wording of the OpenKODE Core 1.0 specification and version 4 of the ATX_imgdec extension. |
This OpenKODE Core extension adds to the ATX_imgdec extension the ability to decode Imagination Technologies PVR files containing PVRTC and DXT compressed images, as well as a subset of the uncompressed formats supported by PVR files. The ATX_imgdec extension provides the functions to decode the image, and the definitions of what output formats are available. The present ATX_imgdec_pvr extension defines which output formats are available for the PVR decoder.
When this extension is present, its facilities are accessed by including its header file:
#include <KD/ATX_imgdec_pvr.h>
This also includes KD/ATX_imgdec.h if that has
not already been done.
Add new output formats:
KD_IMAGE_FORMAT_DXT1_ATX #define KD_IMAGE_FORMAT_DXT1_ATX 123
This compressed format stores RGB data and optionally 1-bit alpha in S3TC DXT1 format.
Alignment of buffers for all levels is 4 byte.
For this output format, the
KD_IMAGE_FLAG_FLIP_X_ATX and
KD_IMAGE_FLAG_FLIP_Y_ATX
flags are ignored.
KD_IMAGE_FORMAT_DXT3_ATX #define KD_IMAGE_FORMAT_DXT3_ATX 124
This compressed format stores RGBA data in S3TC DXT3 format.
Alignment of buffers for all levels is 4 byte.
For this output format, the
KD_IMAGE_FLAG_FLIP_X_ATX and
KD_IMAGE_FLAG_FLIP_Y_ATX
flags are ignored.
KD_IMAGE_FORMAT_DXT5_ATX #define KD_IMAGE_FORMAT_DXT5_ATX 125
This compressed format stores RGBA data in S3TC DXT5 format.
Alignment of buffers for all levels is 4 byte.
For this output format, the
KD_IMAGE_FLAG_FLIP_X_ATX and
KD_IMAGE_FLAG_FLIP_Y_ATX
flags are ignored.
KD_IMAGE_FORMAT_PVRTC2_ATX #define KD_IMAGE_FORMAT_PVRTC2_ATX 126
This compressed format stores RGBA data in PVRTC 2-bit format.
Alignment of buffers for all levels is 4 byte.
For this output format, the
KD_IMAGE_FLAG_FLIP_X_ATX and
KD_IMAGE_FLAG_FLIP_Y_ATX
flags are ignored.
KD_IMAGE_FORMAT_PVRTC4_ATX #define KD_IMAGE_FORMAT_PVRTC4_ATX 127
This compressed format stores RGBA data in PVRTC 4-bit format.
Alignment of buffers for all levels is 4 byte.
For this output format, the
KD_IMAGE_FLAG_FLIP_X_ATX and
KD_IMAGE_FLAG_FLIP_Y_ATX
flags are ignored.
This decoder supports decoding of PVR files as defined in [PVR]. It supports PVR files containing PVRTC or DXT compressed images, and a subset of the uncompressed formats supported by PVR files. The OpenGL extensions GL_IMG_texture_compression_pvrtc and GL_EXT_texture_compression_s3tc describe the PVRTC and DXT data formats.
The associated file extension, where applicable, is
.pvr.
Not all PVR formats are supported, and, for each supported format,
only certain image output formats may be specified to
kdGetImageATX or
kdGetImageFromStreamATX.
If the PVR file contains a compressed image,
any of the uncompressed output formats may be specified.
KD_IMAGE_FORMAT_COMPRESSED_ATX
may be used, resulting in one of the output formats
KD_IMAGE_FORMAT_DXT1_ATX,
KD_IMAGE_FORMAT_DXT3_ATX,
KD_IMAGE_FORMAT_DXT5_ATX,
KD_IMAGE_FORMAT_PVRTC2_ATX or
KD_IMAGE_FORMAT_PVRTC4_ATX.
Supported PVR formats, together with the supported image output
formats for each, are listed here. In addition, the first mentioned
supported image output format is the value that the
KD_IMAGE_FORMAT_ATX attribute takes when an
informational image object is created by
kdGetImageInfoATX or
kdGetImageInfoFromStreamATX.
| PVR format code | supported image output formats |
|---|---|
| ARGB_8888 (0x5) | KD_IMAGE_FORMAT_BGRA8888_ATX, KD_IMAGE_FORMAT_RGBA8888_ATX |
| OGL_RGBA_8888 (0x12) | KD_IMAGE_FORMAT_RGBA8888_ATX, KD_IMAGE_FORMAT_BGRA8888_ATX |
| RGB_888 (0x4) | KD_IMAGE_FORMAT_RGB888_ATX |
| OGL_RGB_888 (0x15) | KD_IMAGE_FORMAT_RGB888_ATX |
| RGB_565 (0x2) | KD_IMAGE_FORMAT_RGB565_ATX |
| OGL_RGB565 (0x13) | KD_IMAGE_FORMAT_RGB565_ATX |
| ARGB_1555 (0x1) | KD_IMAGE_FORMAT_RGBA5551_ATX |
| OGL_RGBA_5551 (0x11) | KD_IMAGE_FORMAT_RGBA5551_ATX |
| ARGB_4444 (0x0) | KD_IMAGE_FORMAT_RGBA4444_ATX |
| OGL_RGBA_4444 (0x10) | KD_IMAGE_FORMAT_RGBA4444_ATX |
| I_8 (0x7) | KD_IMAGE_FORMAT_LUM8_ATX |
| OGL_I_8 (0x16) | KD_IMAGE_FORMAT_LUM8_ATX |
| AI_88 (0x8) | KD_IMAGE_FORMAT_LUMALPHA88_ATX |
| OGL_AI_88 (0x17) | KD_IMAGE_FORMAT_LUMALPHA88_ATX |
| PVRTC2 (0xc) | KD_IMAGE_FORMAT_PVRTC2_ATX, plus all uncompressed formats |
| OGL_PVRTC2 (0x18) | KD_IMAGE_FORMAT_PVRTC2_ATX, plus all uncompressed formats |
| PVRTC4 (0xd) | KD_IMAGE_FORMAT_PVRTC4_ATX, plus all uncompressed formats |
| OGL_PVRTC4 (0x19) | KD_IMAGE_FORMAT_PVRTC4_ATX, plus all uncompressed formats |
| D3D_DXT1 (0x20) | KD_IMAGE_FORMAT_DXT1_ATX, plus all uncompressed formats |
| D3D_DXT3 (0x22) | KD_IMAGE_FORMAT_DXT3_ATX, plus all uncompressed formats |
| D3D_DXT5 (0x24) | KD_IMAGE_FORMAT_DXT5_ATX, plus all uncompressed formats |
Note that for OGL_* PVR formats the images are stored vertically flipped.
Some of the compressed output formats specified above correspond to formats in the GL_IMG_texture_compression_pvrtc extension:
| KD_ATX_imgdec_pvr format | GL_IMG_texture_compression_pvrtc format |
| KD_IMAGE_FORMAT_PVRTC2_ATX | GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG |
| KD_IMAGE_FORMAT_PVRTC4_ATX | GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG |
The rest of the compressed output formats specified above correspond to formats in the GL_EXT_texture_compression_s3tc extension:
| KD_ATX_imgdec_pvr format | GL_EXT_texture_compression_s3tc format |
| KD_IMAGE_FORMAT_DXT1_ATX | GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT |
| KD_IMAGE_FORMAT_DXT3_ATX | GL_COMPRESSED_RGBA_S3TC_DXT3_EXT |
| KD_IMAGE_FORMAT_DXT5_ATX | GL_COMPRESSED_RGBA_S3TC_DXT5_EXT |