File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff 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) {
You can’t perform that action at this time.
0 commit comments