Path: blob/master/thirdparty/cvtt/ConvectionKernels_S3TC.h
9896 views
#pragma once1#ifndef __CVTT_S3TC_H__2#define __CVTT_S3TC_H__34#include "ConvectionKernels_ParallelMath.h"56namespace cvtt7{8namespace Internal9{10template<int TVectorSize>11class EndpointRefiner;12}1314struct PixelBlockU8;15}1617namespace cvtt18{19namespace Internal20{21class S3TCComputer22{23public:24typedef ParallelMath::Float MFloat;25typedef ParallelMath::SInt16 MSInt16;26typedef ParallelMath::UInt15 MUInt15;27typedef ParallelMath::UInt16 MUInt16;28typedef ParallelMath::SInt32 MSInt32;2930static void Init(MFloat& error);31static void QuantizeTo6Bits(MUInt15& v);32static void QuantizeTo5Bits(MUInt15& v);33static void QuantizeTo565(MUInt15 endPoint[3]);34static MFloat ParanoidFactorForSpan(const MSInt16& span);35static MFloat ParanoidDiff(const MUInt15& a, const MUInt15& b, const MFloat& d);36static void TestSingleColor(uint32_t flags, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], int range, const float* channelWeights,37MFloat &bestError, MUInt15 bestEndpoints[2][3], MUInt15 bestIndexes[16], MUInt15 &bestRange, const ParallelMath::RoundTowardNearestForScope *rtn);38static void TestEndpoints(uint32_t flags, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], const MFloat preWeightedPixels[16][4], const MUInt15 unquantizedEndPoints[2][3], int range, const float* channelWeights,39MFloat &bestError, MUInt15 bestEndpoints[2][3], MUInt15 bestIndexes[16], MUInt15 &bestRange, EndpointRefiner<3> *refiner, const ParallelMath::RoundTowardNearestForScope *rtn);40static void TestCounts(uint32_t flags, const int *counts, int nCounts, const MUInt15 &numElements, const MUInt15 pixels[16][4], const MFloat floatPixels[16][4], const MFloat preWeightedPixels[16][4], bool alphaTest,41const MFloat floatSortedInputs[16][4], const MFloat preWeightedFloatSortedInputs[16][4], const float *channelWeights, MFloat &bestError, MUInt15 bestEndpoints[2][3], MUInt15 bestIndexes[16], MUInt15 &bestRange,42const ParallelMath::RoundTowardNearestForScope* rtn);43static void PackExplicitAlpha(uint32_t flags, const PixelBlockU8* inputs, int inputChannel, uint8_t* packedBlocks, size_t packedBlockStride);44static void PackInterpolatedAlpha(uint32_t flags, const PixelBlockU8* inputs, int inputChannel, uint8_t* packedBlocks, size_t packedBlockStride, bool isSigned, int maxTweakRounds, int numRefineRounds);45static void PackRGB(uint32_t flags, const PixelBlockU8* inputs, uint8_t* packedBlocks, size_t packedBlockStride, const float channelWeights[4], bool alphaTest, float alphaThreshold, bool exhaustive, int maxTweakRounds, int numRefineRounds);46};47}48}4950#endif515253