File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ impl Histogram {
320320
321321 // Limit perceptual weight to 1/10th of the image surface area to prevent
322322 // a single color from dominating all others.
323- let max_perceptual_weight = 0.1 * ( temp. iter ( ) . map ( |t| f64:: from ( t. weight ) ) . sum :: < f64 > ( ) / 256. ) as f32 ;
323+ let max_perceptual_weight = ( ( 0.1 / 255. ) * temp. iter ( ) . map ( |t| f64:: from ( t. weight ) ) . sum :: < f64 > ( ) ) as f32 ;
324324
325325 let lut = gamma_lut ( gamma) ;
326326 let mut total_perceptual_weight = 0. ;
@@ -331,9 +331,9 @@ impl Histogram {
331331
332332 // weight == 0 means it's a fixed color
333333 let weight = if temp_item. weight > 0. {
334- ( temp_item. weight * ( 1. / 256 .) ) . min ( max_perceptual_weight)
334+ ( temp_item. weight * ( 1. / 255 .) ) . min ( max_perceptual_weight)
335335 } else {
336- max_perceptual_weight * 10 .
336+ max_perceptual_weight * 16 .
337337 } ;
338338 total_perceptual_weight += f64:: from ( weight) ;
339339
You can’t perform that action at this time.
0 commit comments