Skip to content

Commit 26589bb

Browse files
authored
Add files via upload
1 parent d14b462 commit 26589bb

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

nQuantCpp/GilbertCurve.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ namespace Peano
333333
errorq.clear();
334334
weight = m_weight = abs(weight);
335335
margin = weight < .0025 ? 12 : weight < .004 ? 8 : 6;
336-
sortedByYDiff = m_saliencies && m_nMaxColor >= 128 && (!m_hasAlpha || weight < .18);
336+
sortedByYDiff = m_saliencies && m_nMaxColor >= 128 && weight >= .02 && (!m_hasAlpha || weight < .18);
337337
beta = m_nMaxColor > 4 ? (float) (.6f - .00625f * m_nMaxColor) : 1;
338338
if (m_nMaxColor > 4) {
339339
auto boundary = .005 - .0000625 * m_nMaxColor;
@@ -343,8 +343,12 @@ namespace Peano
343343
}
344344
else
345345
beta *= .95f;
346+
346347
if (m_nMaxColor > 64 || (m_nMaxColor > 4 && weight > .02))
347348
beta *= .4f;
349+
if (m_nMaxColor > 128 && weight < .02)
350+
beta = .2f;
351+
348352
DITHER_MAX = weight < .015 ? (weight > .0025) ? (BYTE)25 : 16 : 9;
349353
auto edge = m_hasAlpha ? 1 : exp(weight) + .25;
350354
auto deviation = !m_hasAlpha && weight > .002 ? .25 : 1;

nQuantCpp/PnnLABQuantizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ namespace PnnLABQuant
549549
if (hasSemiTransparency)
550550
weight *= -1;
551551

552-
if (dither && !hasSemiTransparency && saliencies.empty() && (nMaxColors <= 128 || weight > .99)) {
552+
if (dither && !hasSemiTransparency && saliencies.empty() && (nMaxColors <= 256 || weight > .99)) {
553553
saliencies.resize(pixels.size());
554554
auto saliencyBase = .1f;
555555
for (int i = 0; i < pixels.size(); ++i) {

0 commit comments

Comments
 (0)