Skip to content

Commit 00df9f5

Browse files
authored
Add files via upload
1 parent 65302c6 commit 00df9f5

2 files changed

Lines changed: 1 addition & 19 deletions

File tree

nQuantCpp/PnnLABQuantizer.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -557,23 +557,6 @@ namespace PnnLABQuant
557557
return closest[idx];
558558
}
559559

560-
bool PnnLABQuantizer::quantize_image(const ARGB* pixels, const ARGB* pPalette, const UINT nMaxColors, unsigned short* qPixels, const UINT width, const UINT height, const bool dither)
561-
{
562-
auto NearestColorIndex = [this, nMaxColors](const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos) -> unsigned short {
563-
return closestColorIndex(pPalette, nMaxColors, argb, pos);
564-
};
565-
566-
if (dither)
567-
return dither_image(pixels, pPalette, nMaxColors, NearestColorIndex, hasSemiTransparency, m_transparentPixelIndex, qPixels, width, height);
568-
569-
UINT pixelIndex = 0;
570-
for (int j = 0; j < height; ++j) {
571-
for (int i = 0; i < width; ++i)
572-
qPixels[pixelIndex++] = NearestColorIndex(pPalette, nMaxColors, pixels[pixelIndex], i + j);
573-
}
574-
return true;
575-
}
576-
577560
void PnnLABQuantizer::clear()
578561
{
579562
saliencies.clear();
@@ -627,7 +610,7 @@ namespace PnnLABQuant
627610
auto NearestColorIndex = [this, nMaxColors](const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos) -> unsigned short {
628611
if (nMaxColors <= 4)
629612
return nearestColorIndex(pPalette, nMaxColors, argb, pos);
630-
if (IsGA() && nMaxColors < 16)
613+
if (weight < .0005 && nMaxColors < 16)
631614
return hybridColorIndex(pPalette, nMaxColors, argb, pos);
632615
return closestColorIndex(pPalette, nMaxColors, argb, pos);
633616
};

nQuantCpp/PnnLABQuantizer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ namespace PnnLABQuant
4343
void find_nn(pnnbin* bins, int idx, bool texicab);
4444
unsigned short closestColorIndex(const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos);
4545
unsigned short hybridColorIndex(const ARGB* pPalette, const UINT nMaxColors, ARGB argb, const UINT pos);
46-
bool quantize_image(const ARGB* pixels, const ARGB* pPalette, const UINT nMaxColors, unsigned short* qPixels, const UINT width, const UINT height, const bool dither);
4746

4847
public:
4948
PnnLABQuantizer();

0 commit comments

Comments
 (0)