Skip to content

Commit

Permalink
wip: change rolling average window to all frames
Browse files Browse the repository at this point in the history
  • Loading branch information
superyu1337 committed Dec 5, 2024
1 parent 45b492e commit e533072
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/video.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::cmp::min;
use std::collections::BTreeMap;
use std::io::stderr;
use std::sync::{mpsc, Arc, Mutex};
Expand Down Expand Up @@ -483,15 +482,15 @@ fn compare_videos_inner<D: Decoder + 'static, E: Decoder + 'static>(
};

let mut results = BTreeMap::new();
let mut avg = 0f64;
let mut rolling_mean = 0f64;
for score in result_rx {
if verbose {
println!("Frame {}: {:.8}", score.0, score.1);
}

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

Expand Down

0 comments on commit e533072

Please sign in to comment.