@@ -87,7 +87,7 @@ private GilbertCurve(int width, int height, int[] pixels, Color[] palette, int[]
8787
8888 if ( palette . Length > 64 || ( palette . Length > 4 && weight > .02 ) )
8989 beta *= .4f ;
90- if ( palette . Length > 128 && weight < .02 )
90+ if ( palette . Length > 64 && weight < .02 )
9191 beta = .2f ;
9292
9393 DITHER_MAX = ( byte ) ( weight < .015 ? ( weight > .0025 ) ? 25 : 16 : 9 ) ;
@@ -119,7 +119,8 @@ private int DitherPixel(int x, int y, Color c2, float beta)
119119 if ( palette . Length <= 4 && saliencies [ bidx ] > .2f && saliencies [ bidx ] < .25f )
120120 c2 = BlueNoise . Diffuse ( pixel , palette [ qPixels [ bidx ] ] , beta * 2 / saliencies [ bidx ] , strength , x , y ) ;
121121 else if ( palette . Length <= 4 || CIELABConvertor . Y_Diff ( pixel , c2 ) < ( 2 * acceptedDiff ) ) {
122- c2 = BlueNoise . Diffuse ( pixel , palette [ qPixels [ bidx ] ] , beta * .5f / saliencies [ bidx ] , strength , x , y ) ;
122+ if ( palette . Length <= 128 || BlueNoise . TELL_BLUE_NOISE [ bidx & 4095 ] > 0 )
123+ c2 = BlueNoise . Diffuse ( pixel , palette [ qPixels [ bidx ] ] , beta * .5f / saliencies [ bidx ] , strength , x , y ) ;
123124 if ( palette . Length <= 4 && CIELABConvertor . U_Diff ( pixel , c2 ) > ( 8 * acceptedDiff ) ) {
124125 var c1 = saliencies [ bidx ] > .65f ? pixel : Color . FromArgb ( a_pix , r_pix , g_pix , b_pix ) ;
125126 c2 = BlueNoise . Diffuse ( c1 , palette [ qPixels [ bidx ] ] , beta * saliencies [ bidx ] , strength , x , y ) ;
0 commit comments