Skip to content

Commit 40eec77

Browse files
authored
Add files via upload
1 parent 975672f commit 40eec77

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

nQuantCpp/DblGNGQuantizer.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,7 @@ namespace GrowingNeuralGas
338338
}
339339
}
340340
if (winner != nullptr) {
341-
// Replaces Java's synchronized(winner) block cleanly
342-
#pragma omp critical(WinnerErrorAccumulation)
341+
#pragma omp critical(WinnerErrorAccumulation)
343342
{
344343
winner->error += minDist;
345344
}
@@ -626,9 +625,6 @@ namespace GrowingNeuralGas
626625
void gngquan(const vector<ARGB>& pixels, ARGB* pPalette, UINT& nMaxColors)
627626
{
628627
maxNodes = nMaxColors; // number of colours used
629-
auto mDivn = min(0.9, nMaxColors * 1.0 / pixelMap.size());
630-
if (hasSemiTransparency)
631-
mDivn *= -1;
632628

633629
auto GetColorIndex = [&](const Color& c) -> int {
634630
return GetARGBIndex(c, hasSemiTransparency, hasAlpha());
@@ -687,6 +683,10 @@ namespace GrowingNeuralGas
687683
return;
688684
}
689685

686+
auto mDivn = min(0.9, nMaxColors * 1.0 / pixelMap.size());
687+
if (hasSemiTransparency)
688+
mDivn *= -1;
689+
690690
vector<shared_ptr<GNGNode>> stdDevSamples;
691691
for (const auto& [pixel, count] : histogram) {
692692
auto freq = static_cast<int>(sqrt(count));

0 commit comments

Comments
 (0)