File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -381,9 +381,13 @@ namespace Peano
381381 DITHER_MAX = 25 ;
382382 }
383383
384- auto edge = m_hasAlpha ? 1 : exp (weight) + .25 ;
385- auto deviation = !m_hasAlpha && weight > .002 ? .25 : 1 ;
386- ditherMax = (m_hasAlpha || DITHER_MAX > 9 ) ? (BYTE )sqr (_sqrt (DITHER_MAX ) + edge * deviation) : (BYTE ) (DITHER_MAX * 1.5 );
384+ auto edge = m_hasAlpha ? 1 : exp (weight) - .25 ;
385+ if (sortedByYDiff)
386+ ditherMax = (BYTE )(DITHER_MAX / weight);
387+ else {
388+ auto deviation = !m_hasAlpha && weight > .0025 ? -.25 : 1 ;
389+ ditherMax = (m_hasAlpha || DITHER_MAX > 9 ) ? (BYTE )sqr (_sqrt (DITHER_MAX ) + edge * deviation) : (BYTE )(DITHER_MAX * (saliencies != nullptr ? 2 : M_E ));
390+ }
387391 int density = m_nMaxColor > 16 ? 3200 : 1500 ;
388392 if (m_nMaxColor / weight > 5000 && (weight > .045 || (weight > .01 && m_nMaxColor < 64 )))
389393 ditherMax = (BYTE )sqr (5 + edge);
You can’t perform that action at this time.
0 commit comments