mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-08 06:25:31 +00:00
Some small formatting changes
This commit is contained in:
parent
5bd306d09b
commit
671454f57d
|
@ -295,6 +295,13 @@ CompressionMode::kModeAttributes[kNumModes] = {
|
||||||
false, false, CompressionMode::ePBitType_NotShared },
|
false, false, CompressionMode::ePBitType_NotShared },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ALIGN_SSE const float kErrorMetrics[kNumErrorMetrics][kNumColorChannels] = {
|
||||||
|
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
||||||
|
{ sqrtf(0.3f), sqrtf(0.56f), sqrtf(0.11f), 1.0f }
|
||||||
|
};
|
||||||
|
|
||||||
|
const float *GetErrorMetric(ErrorMetric e) { return kErrorMetrics[e]; }
|
||||||
|
|
||||||
void CompressionMode::ClampEndpointsToGrid(
|
void CompressionMode::ClampEndpointsToGrid(
|
||||||
RGBAVector &p1, RGBAVector &p2, uint8 &bestPBitCombo
|
RGBAVector &p1, RGBAVector &p2, uint8 &bestPBitCombo
|
||||||
) const {
|
) const {
|
||||||
|
@ -417,7 +424,7 @@ double CompressionMode::CompressSingleColor(
|
||||||
dist[ci] = std::max(bestChannelDist, dist[ci]);
|
dist[ci] = std::max(bestChannelDist, dist[ci]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float *errorWeights = BPTCC::GetErrorMetric(this->m_ErrorMetric);
|
const float *errorWeights = kErrorMetrics[this->m_ErrorMetric];
|
||||||
float error = 0.0;
|
float error = 0.0;
|
||||||
for(uint32 i = 0; i < kNumColorChannels; i++) {
|
for(uint32 i = 0; i < kNumColorChannels; i++) {
|
||||||
float e = static_cast<float>(dist[i]) * errorWeights[i];
|
float e = static_cast<float>(dist[i]) * errorWeights[i];
|
||||||
|
@ -1459,13 +1466,6 @@ double CompressionMode::Compress(
|
||||||
return totalErr;
|
return totalErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ALIGN_SSE const float kErrorMetrics[kNumErrorMetrics][kNumColorChannels] = {
|
|
||||||
{ 1.0f, 1.0f, 1.0f, 1.0f },
|
|
||||||
{ sqrtf(0.3f), sqrtf(0.56f), sqrtf(0.11f), 1.0f }
|
|
||||||
};
|
|
||||||
|
|
||||||
const float *GetErrorMetric(ErrorMetric e) { return kErrorMetrics[e]; }
|
|
||||||
|
|
||||||
class BlockLogger {
|
class BlockLogger {
|
||||||
public:
|
public:
|
||||||
BlockLogger(uint64 blockIdx, std::ostream &os)
|
BlockLogger(uint64 blockIdx, std::ostream &os)
|
||||||
|
@ -1725,7 +1725,7 @@ static double EstimateTwoClusterError(ErrorMetric metric, RGBACluster &c) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float *w = BPTCC::GetErrorMetric(metric);
|
const float *w = kErrorMetrics[metric];
|
||||||
|
|
||||||
double error = 0.0001;
|
double error = 0.0001;
|
||||||
error += c.QuantizedError(Min, Max, 8,
|
error += c.QuantizedError(Min, Max, 8,
|
||||||
|
@ -1741,7 +1741,7 @@ static double EstimateThreeClusterError(ErrorMetric metric, RGBACluster &c) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float *w = BPTCC::GetErrorMetric(metric);
|
const float *w = kErrorMetrics[metric];
|
||||||
double error = 0.0001;
|
double error = 0.0001;
|
||||||
error += c.QuantizedError(Min, Max, 4,
|
error += c.QuantizedError(Min, Max, 4,
|
||||||
0xFFFFFFFF, RGBAVector(w[0], w[1], w[2], w[3]));
|
0xFFFFFFFF, RGBAVector(w[0], w[1], w[2], w[3]));
|
||||||
|
@ -1804,37 +1804,36 @@ static ShapeSelection BoxSelection(
|
||||||
|
|
||||||
// There are not 3 subset blocks that support alpha, so only check these
|
// There are not 3 subset blocks that support alpha, so only check these
|
||||||
// if the entire block is opaque.
|
// if the entire block is opaque.
|
||||||
if(opaque) {
|
if(!opaque) {
|
||||||
for(unsigned int i = 0; i < kNumShapes3; i++) {
|
result.m_SelectedModes &= kAlphaModes;
|
||||||
cluster.SetShapeIndex(i, 3);
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
double err = 0.0;
|
// If it's opaque, we get more value out of mode 6 than modes
|
||||||
for(int ci = 0; ci < 3; ci++) {
|
// 4 and 5, so just ignore those.
|
||||||
cluster.SetPartition(ci);
|
result.m_SelectedModes &=
|
||||||
err += EstimateThreeClusterError(metric, cluster);
|
~(static_cast<uint32>(eBlockMode_Four) |
|
||||||
}
|
static_cast<uint32>(eBlockMode_Five));
|
||||||
|
|
||||||
if(err < bestError[1]) {
|
for(unsigned int i = 0; i < kNumShapes3; i++) {
|
||||||
bestError[1] = err;
|
cluster.SetShapeIndex(i, 3);
|
||||||
result.m_ThreeShapeIndex = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If it's small, we'll take it!
|
double err = 0.0;
|
||||||
if(err < 1e-9) {
|
for(int ci = 0; ci < 3; ci++) {
|
||||||
result.m_SelectedModes = kThreePartitionModes;
|
cluster.SetPartition(ci);
|
||||||
return result;
|
err += EstimateThreeClusterError(metric, cluster);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's opaque, we get more value out of mode 6 than modes
|
if(err < bestError[1]) {
|
||||||
// 4 and 5, so just ignore those.
|
bestError[1] = err;
|
||||||
result.m_SelectedModes &=
|
result.m_ThreeShapeIndex = i;
|
||||||
~(static_cast<uint32>(eBlockMode_Four) |
|
}
|
||||||
static_cast<uint32>(eBlockMode_Five));
|
|
||||||
|
|
||||||
} else {
|
// If it's small, we'll take it!
|
||||||
// Only some modes support alpha
|
if(err < 1e-9) {
|
||||||
result.m_SelectedModes &= kAlphaModes;
|
result.m_SelectedModes = kThreePartitionModes;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1941,7 +1940,7 @@ static double EstimateTwoClusterErrorStats(
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float *w = BPTCC::GetErrorMetric(metric);
|
const float *w = kErrorMetrics[metric];
|
||||||
|
|
||||||
const double err1 = c.QuantizedError(
|
const double err1 = c.QuantizedError(
|
||||||
Min, Max, 8, 0xFFFCFCFC, RGBAVector(w[0], w[1], w[2], w[3])
|
Min, Max, 8, 0xFFFCFCFC, RGBAVector(w[0], w[1], w[2], w[3])
|
||||||
|
@ -1979,7 +1978,7 @@ static double EstimateThreeClusterErrorStats(
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float *w = BPTCC::GetErrorMetric(metric);
|
const float *w = kErrorMetrics[metric];
|
||||||
const double err0 = 0.0001 + c.QuantizedError(
|
const double err0 = 0.0001 + c.QuantizedError(
|
||||||
Min, Max, 4, 0xFFF0F0F0, RGBAVector(w[0], w[1], w[2], w[3])
|
Min, Max, 4, 0xFFF0F0F0, RGBAVector(w[0], w[1], w[2], w[3])
|
||||||
);
|
);
|
||||||
|
@ -2123,7 +2122,7 @@ static void CompressBC7Block(
|
||||||
if(v * v == 0) {
|
if(v * v == 0) {
|
||||||
modeEstimate[6] = 0.0;
|
modeEstimate[6] = 0.0;
|
||||||
} else {
|
} else {
|
||||||
const float *w = GetErrorMetric(settings.m_ErrorMetric);
|
const float *w = kErrorMetrics[settings.m_ErrorMetric];
|
||||||
const double err = 0.0001 + blockCluster.QuantizedError(
|
const double err = 0.0001 + blockCluster.QuantizedError(
|
||||||
Min, Max, 4, 0xFEFEFEFE, RGBAVector(w[0], w[1], w[2], w[3])
|
Min, Max, 4, 0xFEFEFEFE, RGBAVector(w[0], w[1], w[2], w[3])
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue