mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-27 22:34:16 +01:00
Formatting.
This commit is contained in:
parent
6505944f57
commit
7fa561f67f
@ -225,23 +225,19 @@ double RGBACluster::QuantizedError(
|
|||||||
) const {
|
) const {
|
||||||
|
|
||||||
// nBuckets should be a power of two.
|
// nBuckets should be a power of two.
|
||||||
|
const uint8 indexPrec = log2(nBuckets);
|
||||||
assert(!(nBuckets & (nBuckets - 1)));
|
assert(!(nBuckets & (nBuckets - 1)));
|
||||||
const uint8 indexPrec = 8-CountBitsInMask(~(nBuckets - 1));
|
assert(indexPrec >= 2 && indexPrec <= 4);
|
||||||
|
|
||||||
typedef uint32 tInterpPair[2];
|
typedef uint32 tInterpPair[2];
|
||||||
typedef tInterpPair tInterpLevel[16];
|
typedef tInterpPair tInterpLevel[16];
|
||||||
const tInterpLevel *interpVals =
|
const tInterpLevel *interpVals = BPTCC::kInterpolationValues + (indexPrec - 1);
|
||||||
(nBuckets == 3)? BPTCC::kInterpolationValues
|
|
||||||
: BPTCC::kInterpolationValues + (indexPrec - 1);
|
|
||||||
|
|
||||||
assert(indexPrec >= 2 && indexPrec <= 4);
|
|
||||||
|
|
||||||
uint32 qp1, qp2;
|
uint32 qp1, qp2;
|
||||||
if(pbits) {
|
if(pbits) {
|
||||||
qp1 = p1.ToPixel(bitMask, pbits[0]);
|
qp1 = p1.ToPixel(bitMask, pbits[0]);
|
||||||
qp2 = p2.ToPixel(bitMask, pbits[1]);
|
qp2 = p2.ToPixel(bitMask, pbits[1]);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
qp1 = p1.ToPixel(bitMask);
|
qp1 = p1.ToPixel(bitMask);
|
||||||
qp2 = p2.ToPixel(bitMask);
|
qp2 = p2.ToPixel(bitMask);
|
||||||
}
|
}
|
||||||
@ -265,12 +261,12 @@ double RGBACluster::QuantizedError(
|
|||||||
uint32 interp1 = (*interpVals)[j][1];
|
uint32 interp1 = (*interpVals)[j][1];
|
||||||
|
|
||||||
RGBAVector errorVec (0.0f);
|
RGBAVector errorVec (0.0f);
|
||||||
for(uint32 k = 0; k < kNumColorChannels; k++) {
|
for(uint32 k = 0; k < 4; k++) {
|
||||||
const uint32 ip = (((pqp1[k] * interp0) + (pqp2[k] * interp1) + 32) >> 6) & 0xFF;
|
const uint32 ip = (((pqp1[k] * interp0) + (pqp2[k] * interp1) + 32) >> 6) & 0xFF;
|
||||||
const uint8 dist = sad<uint8>(pb[k], ip);
|
const uint8 dist = sad<uint8>(pb[k], ip);
|
||||||
errorVec[k] = static_cast<float>(dist) * metric[k];
|
errorVec[k] = static_cast<float>(dist) * metric[k];
|
||||||
}
|
}
|
||||||
|
|
||||||
float error = errorVec * errorVec;
|
float error = errorVec * errorVec;
|
||||||
if(error < minError) {
|
if(error < minError) {
|
||||||
minError = error;
|
minError = error;
|
||||||
|
@ -170,12 +170,6 @@ public:
|
|||||||
|
|
||||||
// Returns the error if we were to quantize the colors right now with the
|
// Returns the error if we were to quantize the colors right now with the
|
||||||
// given number of buckets and bit mask.
|
// given number of buckets and bit mask.
|
||||||
template<const uint8 nBuckets>
|
|
||||||
double QuantizedError(
|
|
||||||
const RGBAVector &p1, const RGBAVector &p2,
|
|
||||||
uint32 bitMask, const RGBAVector &errorMetricVec,
|
|
||||||
const int pbits[2] = NULL, uint8 *indices = NULL) const;
|
|
||||||
|
|
||||||
double QuantizedError(
|
double QuantizedError(
|
||||||
const RGBAVector &p1, const RGBAVector &p2,
|
const RGBAVector &p1, const RGBAVector &p2,
|
||||||
uint32 nBuckets, uint32 bitMask, const RGBAVector &errorMetricVec,
|
uint32 nBuckets, uint32 bitMask, const RGBAVector &errorMetricVec,
|
||||||
@ -228,6 +222,12 @@ public:
|
|||||||
uint8 m_PointMap[kMaxNumDataPoints];
|
uint8 m_PointMap[kMaxNumDataPoints];
|
||||||
RGBAVector m_Min, m_Max;
|
RGBAVector m_Min, m_Max;
|
||||||
|
|
||||||
|
template<const uint8 nBuckets>
|
||||||
|
double QuantizedError(
|
||||||
|
const RGBAVector &p1, const RGBAVector &p2,
|
||||||
|
uint32 bitMask, const RGBAVector &errorMetricVec,
|
||||||
|
const int pbits[2] = NULL, uint8 *indices = NULL) const;
|
||||||
|
|
||||||
void Recalculate() {
|
void Recalculate() {
|
||||||
m_NumPoints = 0;
|
m_NumPoints = 0;
|
||||||
m_Avg = RGBAVector(0.0f);
|
m_Avg = RGBAVector(0.0f);
|
||||||
|
Loading…
Reference in New Issue
Block a user