Skip to content

Commit

Permalink
Update stale kdtree validation routine. Tree itself is fine.
Browse files Browse the repository at this point in the history
  • Loading branch information
brazilofmux committed Jan 15, 2011
1 parent c53bce5 commit 6b47a36
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions color/kdtree.cpp
Expand Up @@ -380,6 +380,8 @@ int NearestIndex(YUV &yuv)

for (int i = 1; i < NUM_ENTRIES; i++)
{
if (table[i].fDisable) continue;

INT64 r = diff(yuv, table[i].yuv);
if (r < rNearest)
{
Expand Down Expand Up @@ -640,7 +642,10 @@ void ValidateTree(int iRoot)
if ( i != j
&& diff(yuv16, table[i].yuv) != diff_tree(yuv16, table[j].yuv))
{
printf("(%d,%d,%d) gives %d (%d,%d,%d)(%f) versus %d (%d,%d,%d)(%f)\n", yuv16.y, yuv16.u, yuv16.v, i, table[i].yuv.y, table[i].yuv.u, table[i].yuv.v, diff(yuv16, table[i].yuv), j, table[j].yuv.y, table[j].yuv.u, table[j].yuv.v, diff(yuv16, table[j].yuv));
printf("(%d,%d,%d) gives %d (%d,%d,%d)(%lld) versus %d (%d,%d,%d)(%lld)\n",
yuv16.y, yuv16.u, yuv16.v,
i, table[i].yuv.y, table[i].yuv.u, table[i].yuv.v, diff(yuv16, table[i].yuv),
j, table[j].yuv.y, table[j].yuv.u, table[j].yuv.v, diff(yuv16, table[j].yuv));
//abort();
}
}
Expand Down Expand Up @@ -747,7 +752,7 @@ int main(int argc, char *argv[])
table[i].color8 = iNearest;
}
//DumpTree(kdroot, 0);
//ValidateTree(kdroot);
//ValidateTree(kdroot256);
DumpTable(kdroot16, kdroot256);

return 0;
Expand Down

0 comments on commit 6b47a36

Please sign in to comment.