rom-properties/extlib/PowerVR/PVRTDecompress.h
David Korth 42bf06e82c [PowerVR] PVRTDecompress.cpp: Initial support for PVRTC-II decoding.
Main changes:
- Color A and Color B now share an opaque flag.
- Color B: The low bit of alpha is always 1, not 0.
- Tiles are stored in linear order, not Morton order.

To make it easier to support both formats with minimal changes, the
original PVRTC code has been changed to use templated functions.
Simple non-templated wrapper functions are provided for external use.

PowerVR3, KhronosKTX: Handle PVRTC-II. Note that there's no FourCC
defined for DDS, so we're not updating DirectDrawSurface.

TODO:
- The Hard transition flag isn't supported. PVRTexToolCLI didn't use the
  hard transition flag when creating the test images.

[libromdata/tests] ImageDecoderTest: Added some PVRTC-II test images.
Based on tctest's example.png. Note that the PVRTC-II test images are
the full 512x512, whereas the PVRTC-I test image was 256x256.
2019-12-15 02:43:22 -05:00

33 lines
1.6 KiB
C++
Vendored

/*!
\brief Contains functions to decompress PVRTC or ETC formats into RGBA8888.
\file PVRCore/texture/PVRTDecompress.h
\author PowerVR by Imagination, Developer Technology Team
\copyright Copyright (c) Imagination Technologies Limited.
*/
#pragma once
#include <stdint.h>
namespace pvr {
// rom-properties: Swap R and B channels.
#define PVRTC_SWAP_R_B_CHANNELS 1
/// <summary>Decompresses PVRTC to RGBA 8888.</summary>
/// <param name="compressedData">The PVRTC texture data to decompress</param>
/// <param name="do2bitMode">Signifies whether the data is PVRTC2 or PVRTC4</param>
/// <param name="xDim">X dimension of the texture</param>
/// <param name="yDim">Y dimension of the texture</param>
/// <param name="outResultImage">The decompressed texture data</param>
/// <returns>Return the amount of data that was decompressed.</returns>
uint32_t PVRTDecompressPVRTC(const void* compressedData, uint32_t do2bitMode, uint32_t xDim, uint32_t yDim, uint8_t* outResultImage);
/// <summary>Decompresses PVRTC-II to RGBA 8888.</summary>
/// <param name="compressedData">The PVRTC-II texture data to decompress</param>
/// <param name="do2bitMode">Signifies whether the data is PVRTC2 or PVRTC4</param>
/// <param name="xDim">X dimension of the texture</param>
/// <param name="yDim">Y dimension of the texture</param>
/// <param name="outResultImage">The decompressed texture data</param>
/// <returns>Return the amount of data that was decompressed.</returns>
uint32_t PVRTDecompressPVRTCII(const void* compressedData, uint32_t do2bitMode, uint32_t xDim, uint32_t yDim, uint8_t* outResultImage);
} // namespace pvr