#include "android_astc_decomp.h"
#include <assert.h>
#include <algorithm>
#include <fenv.h>
#include <math.h>
#define DE_LENGTH_OF_ARRAY(x) …
#define DE_UNREF(x) …
deUint8;
deInt8;
deUint32;
deInt32;
deUint16;
deInt16;
deInt64;
deUint64;
#define DE_ASSERT …
#ifdef _MSC_VER
#pragma warning (disable:4505)
#elif defined(__GNUC__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
#endif
namespace basisu_astc
{
template <typename S> inline S maximum(S a, S b) { … }
template <typename S> inline S maximum(S a, S b, S c) { … }
template <typename S> inline S maximum(S a, S b, S c, S d) { … }
static bool inBounds(int v, int l, int h)
{ … }
static bool inRange(int v, int l, int h)
{ … }
template<typename T>
static inline T max(T a, T b)
{ … }
template<typename T>
static inline T min(T a, T b)
{ … }
template<typename T>
static inline T clamp(T a, T l, T h)
{ … }
struct UVec4
{ … };
struct IVec4
{ … };
struct IVec3
{ … };
static uint32_t deDivRoundUp32(uint32_t a, uint32_t b)
{ … }
static bool deInBounds32(uint32_t v, uint32_t l, uint32_t h)
{ … }
namespace astc
{
vector;
namespace
{
enum
{ … };
inline deUint32 getBit (deUint32 src, int ndx)
{ … }
inline deUint32 getBits (deUint32 src, int low, int high)
{ … }
inline bool isBitSet (deUint32 src, int ndx)
{ … }
inline deUint32 reverseBits (deUint32 src, int numBits)
{ … }
inline deUint32 bitReplicationScale (deUint32 src, int numSrcBits, int numDstBits)
{ … }
inline deInt32 signExtend (deInt32 src, int numSrcBits)
{ … }
deFloat16;
inline bool isFloat16InfOrNan (deFloat16 v)
{ … }
float deFloat16To32(deFloat16 val16)
{ … }
enum ISEMode
{ … };
struct ISEParams
{ … };
inline int computeNumRequiredBits (const ISEParams& iseParams, int numValues)
{ … }
ISEParams computeMaximumRangeISEParams (int numAvailableBits, int numValuesInSequence)
{ … }
inline int computeNumColorEndpointValues (deUint32 endpointMode)
{ … }
enum DecompressResult
{ … };
class Block128
{ … };
class BitAccessStream
{ … };
struct ISEDecodedResult
{ … };
struct ASTCBlockMode
{ … };
inline int computeNumWeights (const ASTCBlockMode& mode)
{ … }
struct ColorEndpointPair
{ … };
struct TexelWeightPair
{ … };
ASTCBlockMode getASTCBlockMode (deUint32 blockModeData)
{ … }
inline void setASTCErrorColorBlock (void* dst, int blockWidth, int blockHeight, bool isSRGB)
{ … }
DecompressResult decodeVoidExtentBlock (void* dst, const Block128& blockData, int blockWidth, int blockHeight, bool isSRGB, bool isLDRMode)
{ … }
void decodeColorEndpointModes (deUint32* endpointModesDst, const Block128& blockData, int numPartitions, int extraCemBitsStart)
{ … }
int computeNumColorEndpointValues (const deUint32* endpointModes, int numPartitions)
{ … }
void decodeISETritBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& data, int numBits)
{ … }
void decodeISEQuintBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& data, int numBits)
{ … }
inline void decodeISEBitBlock (ISEDecodedResult* dst, BitAccessStream& data, int numBits)
{ … }
void decodeISE (ISEDecodedResult* dst, int numValues, BitAccessStream& data, const ISEParams& params)
{ … }
void unquantizeColorEndpoints (deUint32* dst, const ISEDecodedResult* iseResults, int numEndpoints, const ISEParams& iseParams)
{ … }
inline void bitTransferSigned (deInt32& a, deInt32& b)
{ … }
inline UVec4 clampedRGBA (const IVec4& rgba)
{ … }
inline IVec4 blueContract (int r, int g, int b, int a)
{ … }
inline bool isColorEndpointModeHDR (deUint32 mode)
{ … }
void decodeHDREndpointMode7 (UVec4& e0, UVec4& e1, deUint32 v0, deUint32 v1, deUint32 v2, deUint32 v3)
{ … }
void decodeHDREndpointMode11 (UVec4& e0, UVec4& e1, deUint32 v0, deUint32 v1, deUint32 v2, deUint32 v3, deUint32 v4, deUint32 v5)
{ … }
void decodeHDREndpointMode15(UVec4& e0, UVec4& e1, deUint32 v0, deUint32 v1, deUint32 v2, deUint32 v3, deUint32 v4, deUint32 v5, deUint32 v6In, deUint32 v7In)
{ … }
void decodeColorEndpoints (ColorEndpointPair* dst, const deUint32* unquantizedEndpoints, const deUint32* endpointModes, int numPartitions)
{ … }
void computeColorEndpoints (ColorEndpointPair* dst, const Block128& blockData, const deUint32* endpointModes, int numPartitions, int numColorEndpointValues, const ISEParams& iseParams, int numBitsAvailable)
{ … }
void unquantizeWeights (deUint32 dst[64], const ISEDecodedResult* weightGrid, const ASTCBlockMode& blockMode)
{ … }
void interpolateWeights (TexelWeightPair* dst, const deUint32 (&unquantizedWeights) [64], int blockWidth, int blockHeight, const ASTCBlockMode& blockMode)
{ … }
void computeTexelWeights (TexelWeightPair* dst, const Block128& blockData, int blockWidth, int blockHeight, const ASTCBlockMode& blockMode)
{ … }
inline deUint32 hash52 (deUint32 v)
{ … }
int computeTexelPartition (deUint32 seedIn, deUint32 xIn, deUint32 yIn, deUint32 zIn, int numPartitions, bool smallBlock)
{ … }
DecompressResult setTexelColors (void* dst, ColorEndpointPair* colorEndpoints, TexelWeightPair* texelWeights, int ccs, deUint32 partitionIndexSeed,
int numPartitions, int blockWidth, int blockHeight, bool isSRGB, bool isLDRMode, const deUint32* colorEndpointModes)
{ … }
DecompressResult decompressBlock (void* dst, const Block128& blockData, int blockWidth, int blockHeight, bool isSRGB, bool isLDR)
{ … }
int isHDR(const Block128& blockData, int blockWidth, int blockHeight)
{ … }
half_float;
half_float float_to_half(float val, bool toward_zero)
{ … }
float half_to_float(half_float hval)
{ … }
}
static void convert_to_half_prec(uint32_t n, float* pVals)
{ … }
bool decompress_ldr(uint8_t *pDst, const uint8_t * data, bool isSRGB, int blockWidth, int blockHeight)
{ … }
bool decompress_hdr(float* pDstRGBA, const uint8_t* data, int blockWidth, int blockHeight)
{ … }
bool is_hdr(const uint8_t* data, int blockWidth, int blockHeight, bool &is_hdr)
{ … }
}
}
#if defined(__GNUC__)
#pragma GCC diagnostic pop
#endif