Skip to content

Commit

Permalink
fixed BC7b algorithm but still too slow
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethatron committed Apr 15, 2013
1 parent d040de4 commit cd22c69
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 109 deletions.
20 changes: 20 additions & 0 deletions paletteclusterfit.cpp
Expand Up @@ -1623,6 +1623,26 @@ void PaletteClusterFit::CompressS23(void* block, vQuantizer &q, int mode)
// the error coming back from the palettesinglefit is not entirely exact with OLD_QUANTIZERR
if (!(error < m_besterror))
return;

#ifndef NDEBUG
fprintf(stderr, "ClstrFit m: %1d, s: %1d+%1d, n:", mode, isets, asets);
fprintf(stderr, " %2d", 0 < (isets + asets) ? m_palette->GetCount(0) : 0);
fprintf(stderr, " %2d", 1 < (isets + asets) ? m_palette->GetCount(1) : 0);
fprintf(stderr, " %2d", 2 < (isets + asets) ? m_palette->GetCount(2) : 0);
fprintf(stderr, ", c: %1d, a: %1d", cb, ab);
if (GetPartitionBits(mode) > 0)
fprintf(stderr, ", p: %2d", m_palette->GetPartition());
else if (GetRotationBits(mode) > 0)
fprintf(stderr, ", r: %2d", m_palette->GetRotation());
else
fprintf(stderr, ", r: --");
if (GetSelectionBits(mode) > 0)
fprintf(stderr, ", i: %1d,%1d", !m_swapindex ? ib : jb, !m_swapindex ? jb : ib);
else
fprintf(stderr, ", i: %1d ", ib);

fprintf(stderr, ", e: %.8f (< %.8f)\n", error.X(), m_besterror.X() == FLT_MAX ? -1.0f : m_besterror.X());
#endif
#endif

// use these shared bit configuration
Expand Down
20 changes: 20 additions & 0 deletions paletterangefit.cpp
Expand Up @@ -521,6 +521,26 @@ void PaletteRangeFit::Compress(void* block, vQuantizer &q, int mode)

if (!(error < m_besterror))
return;

#ifndef NDEBUG
fprintf(stderr, "RangeFit m: %1d, s: %1d+%1d, n:", mode, isets, asets);
fprintf(stderr, " %2d", 0 < (isets + asets) ? m_palette->GetCount(0) : 0);
fprintf(stderr, " %2d", 1 < (isets + asets) ? m_palette->GetCount(1) : 0);
fprintf(stderr, " %2d", 2 < (isets + asets) ? m_palette->GetCount(2) : 0);
fprintf(stderr, ", c: %1d, a: %1d", cb, ab);
if (GetPartitionBits(mode) > 0)
fprintf(stderr, ", p: %2d", m_palette->GetPartition());
else if (GetRotationBits(mode) > 0)
fprintf(stderr, ", r: %2d", m_palette->GetRotation());
else
fprintf(stderr, ", r: --");
if (GetSelectionBits(mode) > 0)
fprintf(stderr, ", i: %1d,%1d", !m_swapindex ? ib : jb, !m_swapindex ? jb : ib);
else
fprintf(stderr, ", i: %1d ", ib);

fprintf(stderr, ", e: %.8f (< %.8f)\n", error.X(), m_besterror.X() == FLT_MAX ? -1.0f : m_besterror.X());
#endif
#endif

// remap the indices
Expand Down

0 comments on commit cd22c69

Please sign in to comment.