Cleanup 4 means compressor.

This commit is contained in:
castano 2008-11-24 10:35:07 +00:00
parent a4f56b65b8
commit 1ec115c7ec

View File

@ -489,58 +489,21 @@ void QuickCompress::compressDXT1(const ColorBlock & rgba, BlockDXT1 * dxtBlock)
Vector3 cluster[4];
int count = Compute4Means(16, block, weights, Vector3(1, 1, 1), cluster);
Vector3 maxColor = cluster[0];
Vector3 minColor = cluster[0];
Vector3 maxColor, minColor;
float bestError = FLT_MAX;
float bestError = evaluatePaletteError4(block, maxColor, minColor);
if (count >= 2)
for (int i = 1; i < 4; i++)
{
float error = evaluatePaletteError4(block, cluster[0], cluster[1]);
if (error < bestError) {
bestError = error;
maxColor = cluster[0];
minColor = cluster[1];
}
if (count >= 3)
for (int j = 0; j < i; j++)
{
error = evaluatePaletteError4(block, cluster[0], cluster[2]);
if (error < bestError) {
bestError = error;
maxColor = cluster[0];
minColor = cluster[2];
}
uint16 color0 = roundAndExpand(&cluster[i]);
uint16 color1 = roundAndExpand(&cluster[j]);
error = evaluatePaletteError4(block, cluster[1], cluster[2]);
float error = evaluatePaletteError4(block, cluster[i], cluster[j]);
if (error < bestError) {
bestError = error;
maxColor = cluster[1];
minColor = cluster[2];
}
if (count >= 4)
{
error = evaluatePaletteError4(block, cluster[0], cluster[3]);
if (error < bestError) {
bestError = error;
maxColor = cluster[0];
minColor = cluster[3];
}
error = evaluatePaletteError4(block, cluster[1], cluster[3]);
if (error < bestError) {
bestError = error;
maxColor = cluster[1];
minColor = cluster[3];
}
error = evaluatePaletteError4(block, cluster[2], cluster[3]);
if (error < bestError) {
bestError = error;
maxColor = cluster[2];
minColor = cluster[3];
}
maxColor = cluster[i];
minColor = cluster[j];
}
}
}