Skip to content

Commit 56c20b4

Browse files
authored
Add files via upload
1 parent 6d48d84 commit 56c20b4

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

nQuantCpp/GilbertCurve.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ namespace Peano
257257

258258
if (unaccepted) {
259259
if (m_saliencies != nullptr)
260-
qPixelIndex = ditherPixel(x, y, c2, 1.25f);
260+
qPixelIndex = ditherPixel(x, y, c2, beta);
261261
else if (CIELABConvertor::Y_Diff(pixel, c2) > 3 && CIELABConvertor::U_Diff(pixel, c2) > 3) {
262262
auto strength = 1 / 3.0f;
263263
c2 = BlueNoise::diffuse(pixel, m_pPalette[qPixelIndex], strength, strength, x, y);

nQuantCpp/PnnLABQuantizer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ namespace PnnLABQuant
334334

335335
unsigned short PnnLABQuantizer::nearestColorIndex(const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos)
336336
{
337-
int offset = GetARGBIndex(argb, hasSemiTransparency, hasAlpha());
337+
int offset = nMaxColors > 32 ? argb : GetARGBIndex(argb, hasSemiTransparency, hasAlpha());
338338
auto got = nearestMap.find(offset);
339339
if (got != nearestMap.end())
340340
return got->second;
@@ -424,7 +424,7 @@ namespace PnnLABQuant
424424

425425
unsigned short PnnLABQuantizer::hybridColorIndex(const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos)
426426
{
427-
int offset = GetARGBIndex(argb, hasSemiTransparency, hasAlpha());
427+
int offset = nMaxColors > 32 ? argb : GetARGBIndex(argb, hasSemiTransparency, hasAlpha());
428428
auto got = nearestMap.find(offset);
429429
if (got != nearestMap.end())
430430
return got->second;
@@ -491,7 +491,7 @@ namespace PnnLABQuant
491491
return nearestColorIndex(pPalette, nMaxColors, argb, pos);
492492

493493
vector<unsigned short> closest(4);
494-
int offset = GetARGBIndex(argb, hasSemiTransparency, hasAlpha());
494+
int offset = nMaxColors > 32 ? argb : GetARGBIndex(argb, hasSemiTransparency, hasAlpha());
495495
auto got = closestMap.find(offset);
496496
if (got == closestMap.end()) {
497497
closest[2] = closest[3] = USHRT_MAX;

nQuantCpp/PnnQuantizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ namespace PnnQuant
246246

247247
unsigned short nearestColorIndex(const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos)
248248
{
249-
int offset = GetARGBIndex(argb, hasSemiTransparency, m_transparentPixelIndex >= 0);
249+
int offset = nMaxColors > 32 ? argb : GetARGBIndex(argb, hasSemiTransparency, m_transparentPixelIndex >= 0);
250250
auto got = nearestMap.find(offset);
251251
if (got != nearestMap.end())
252252
return got->second;
@@ -297,7 +297,7 @@ namespace PnnQuant
297297
return nearestColorIndex(pPalette, nMaxColors, argb, pos);
298298

299299
vector<unsigned short> closest(4);
300-
int offset = GetARGBIndex(argb, hasSemiTransparency, m_transparentPixelIndex >= 0);
300+
int offset = nMaxColors > 32 ? argb : GetARGBIndex(argb, hasSemiTransparency, m_transparentPixelIndex >= 0);
301301
auto got = closestMap.find(offset);
302302
if (got == closestMap.end()) {
303303
closest[2] = closest[3] = USHRT_MAX;

0 commit comments

Comments
 (0)