Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3007a7

Browse files
committed
Avoid confusing divisor
1 parent6aad8f2 commite3007a7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎src/hist.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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.)asf32;
323+
let max_perceptual_weight =((0.1/255.)*temp.iter().map(|t| f64::from(t.weight)).sum::<f64>())asf32;
324324

325325
let lut =gamma_lut(gamma);
326326
letmut 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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp