File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -244,11 +244,11 @@ namespace Peano
244244
245245 if (m_hasAlpha && m_saliencies == nullptr ) {
246246 if (abs (error[j]) >= (ditherMax * M_E * M_PI ) || error[3 ] < 0 )
247- error[j] = ( float ) tanh (error[j] / maxErr * 20 ) * (ditherMax - 1 );
247+ error[j] = tanh (error[j] / maxErr * 20 ) * (ditherMax - 1 );
248248 continue ;
249249 }
250250
251- error[j] = ( float ) tanh (error[j] / maxErr * 20 ) * (ditherMax - 1 );
251+ error[j] = tanh (error[j] / maxErr * 20 ) * (ditherMax - 1 );
252252 }
253253
254254 if (sortedByYDiff && m_saliencies == nullptr && abs (error[j]) >= DITHER_MAX )
@@ -384,6 +384,8 @@ namespace Peano
384384 auto edge = m_hasAlpha ? 1 : exp (weight) - .25 ;
385385 if (saliencies != nullptr && (m_hasAlpha || (sortedByYDiff && weight < .03 )))
386386 ditherMax = (BYTE )(DITHER_MAX / weight);
387+ else if (m_hasAlpha)
388+ ditherMax = (BYTE )(DITHER_MAX / _sqrt (weight));
387389 else {
388390 auto deviation = !m_hasAlpha && weight > .0025 ? -.25 : 1 ;
389391 ditherMax = (m_hasAlpha || DITHER_MAX > 9 ) ? (BYTE )sqr (_sqrt (DITHER_MAX ) + edge * deviation) : (BYTE )(DITHER_MAX * (saliencies != nullptr ? 2 : M_E ));
You can’t perform that action at this time.
0 commit comments