Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mcychan committed Apr 30, 2024
1 parent 41c7bd6 commit 62eac4e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nQuantCpp/EdgeAwareSQuantizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ namespace EdgeAwareSQuant
auto paletteSize = palette.size() * 1.0f;
const auto maxDelta = hasSemiTransparency ? 4.0 : 1.0;
auto rate = 2.0 / log2(paletteSize);
int count = 0, idx = image.size() > 1000000 ? -1 : 20;

while (coarse_level >= 0) {
// calculate the distance between centroids
Expand Down Expand Up @@ -467,7 +468,13 @@ namespace EdgeAwareSQuant
int repeat_inner = 0;

while (repeat_inner++ == 0 || pixels_changed > 0.0001 * rate * total_pixels) {
rate += 0.001;
if (count++ % idx == 0)
rate += 0.001 * count;
else if(idx < 0)
rate += 10 * count;
else
rate += 0.001;

pixels_changed = 0;
pixels_visited = 0;

Expand Down

0 comments on commit 62eac4e

Please sign in to comment.