Set furthestV to first v in case compute_distances does not assign it

This commit is contained in:
Andrew Murray 2022-05-01 23:26:54 +10:00
parent b299d7cfc2
commit 44494a1171

View File

@ -1577,6 +1577,7 @@ quantize2(
data.new.c.b = (int)(.5 + (double)mean[2] / (double)nPixels); data.new.c.b = (int)(.5 + (double)mean[2] / (double)nPixels);
for (i = 0; i < nQuantPixels; i++) { for (i = 0; i < nQuantPixels; i++) {
data.furthestDistance = 0; data.furthestDistance = 0;
data.furthestV = pixelData[0].v;
data.secondPixel = (i == 1) ? 1 : 0; data.secondPixel = (i == 1) ? 1 : 0;
hashtable_foreach_update(h, compute_distances, &data); hashtable_foreach_update(h, compute_distances, &data);
p[i].v = data.furthestV; p[i].v = data.furthestV;