From b8d3de0038ffaed8c068822ec2b15c92394c5c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Dec 2026 12:13:10 +0300 Subject: [PATCH] ec-av1 rate loop: geometric-mean smoothing only when not repaying. Root cause of Bitrate 384k flat leaf 1720 -> 2002 (+7.4% -> +21.3%): c-round3-full.log (11:25) predates d6f79ca2 (11:28), c-round4.log (12:06) includes it, so the smoothing is the only Bitrate change between them; with replan moving the target every frame the lagged ratio (taken against an older target) fights the repay. BytesPerFrame (fixed target) keeps smoothing. cargo check -p ec-av1 --all-targets clean; remaining +7.4% not addressed, tests left to orchestrator --- crates/ec-av1/src/encoder/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ec-av1/src/encoder/mod.rs b/crates/ec-av1/src/encoder/mod.rs index 0f8a17ab..21c12c9a 100644 --- a/crates/ec-av1/src/encoder/mod.rs +++ b/crates/ec-av1/src/encoder/mod.rs @@ -425,7 +425,7 @@ impl RateLoop { // the second frame on the clamp is back, and nothing is accumulated // between frames, so [[vorbis-rate-loop-windup]]'s bound still holds. let seeded = std::mem::replace(&mut self.seeded[slot], true); - let smoothed = if seeded { + let smoothed = if seeded && !self.repay { (ratio * self.prev_ratio[slot]).sqrt() } else { ratio