Skip to content

Commit b25d9fe

Browse files
authored
Change rolling average window to all frames (#46)
* change rolling average window to all frames * stop using format with parameter
1 parent 45b492e commit b25d9fe

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/video.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::cmp::min;
21
use std::collections::BTreeMap;
32
use std::io::stderr;
43
use std::sync::{mpsc, Arc, Mutex};
@@ -483,15 +482,15 @@ fn compare_videos_inner<D: Decoder + 'static, E: Decoder + 'static>(
483482
};
484483

485484
let mut results = BTreeMap::new();
486-
let mut avg = 0f64;
485+
let mut rolling_mean = 0f64;
487486
for score in result_rx {
488487
if verbose {
489488
println!("Frame {}: {:.8}", score.0, score.1);
490489
}
491490

492491
results.insert(score.0, score.1);
493-
avg = avg + (score.1 - avg) / (min(results.len(), 10) as f64);
494-
progress.set_message(format!(", avg: {:.1$}", avg, 2));
492+
rolling_mean = rolling_mean + (score.1 - rolling_mean) / (results.len() as f64);
493+
progress.set_message(format!(", mean: {rolling_mean:.2}"));
495494
progress.inc(1);
496495
}
497496

0 commit comments

Comments
 (0)