File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -235,7 +235,6 @@ namespace Peano
235235 auto denoise = m_nMaxColor > 2 ;
236236 auto diffuse = BlueNoise::TELL_BLUE_NOISE[bidx & 4095 ] > thresold;
237237 error.yDiff = sortedByYDiff ? CIELABConvertor::Y_Diff (pixel, c2) : 1 ;
238- auto illusion = !diffuse && BlueNoise::TELL_BLUE_NOISE[(int )(error.yDiff * 4096 ) & 4095 ] > thresold;
239238
240239 auto unaccepted = false ;
241240 int errLength = denoise ? error.length () - 1 : 0 ;
@@ -244,12 +243,16 @@ namespace Peano
244243 if (sortedByYDiff && m_saliencies != nullptr )
245244 unaccepted = true ;
246245
246+ if (m_hasAlpha && m_saliencies == nullptr ) {
247+ if (abs (error.p [j]) >= (ditherMax * 2 ))
248+ error.p [j] = (float )tanh (error.p [j] / maxErr * 20 ) * (ditherMax - 1 );
249+ continue ;
250+ }
251+
247252 if (diffuse)
248253 error[j] = (float )tanh (error.p [j] / maxErr * 20 ) * (ditherMax - 1 );
249- else if (illusion)
250- error[j] = (float )(error.p [j] / maxErr * error.yDiff ) * (ditherMax - 1 );
251254 else
252- error[j] /= ( float )( 1 + _sqrt (ditherMax)) ;
255+ unaccepted = true ;
253256 }
254257
255258 if (sortedByYDiff && m_saliencies == nullptr && abs (error.p [j]) >= DITHER_MAX)
You can’t perform that action at this time.
0 commit comments