From e533072942a2679b824ed811ad99c2271079fcde Mon Sep 17 00:00:00 2001 From: Janek Date: Thu, 5 Dec 2024 12:05:07 +0100 Subject: [PATCH] wip: change rolling average window to all frames --- src/video.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/video.rs b/src/video.rs index a5ffd0c..f5a5166 100644 --- a/src/video.rs +++ b/src/video.rs @@ -1,4 +1,3 @@ -use std::cmp::min; use std::collections::BTreeMap; use std::io::stderr; use std::sync::{mpsc, Arc, Mutex}; @@ -483,15 +482,15 @@ fn compare_videos_inner( }; 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); }