From 96338e58bb1c9605677e82ed21d6b6e7368b935c 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 10:40:44 +0300 Subject: [PATCH] ec-av1 rate loop: GAIN = 1/WEIGHT_LEVEL_GAIN (was 1/0.0154). Measured slope is 0.0557, so the old gain was ~3.6x loop gain, a period-2 limit cycle (sizes alternating ~4800/~1800, settled mean 3094 vs 4000) that also biased the mean low. Matched gain gives ~1x, one source of truth for the slope. --- 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 80c4a490..494d4318 100644 --- a/crates/ec-av1/src/encoder/mod.rs +++ b/crates/ec-av1/src/encoder/mod.rs @@ -281,7 +281,7 @@ impl RateLoop { const STEP_CLAMP: f64 = 12.0; /// The calibration sweep's own slope (see the struct doc), inverted to /// convert a bytes ratio into a `q_idx` step. - const GAIN: f64 = 1.0 / 0.0154; + const GAIN: f64 = 1.0 / WEIGHT_LEVEL_GAIN; /// The windup bound on [`RateLoop::replan`]: however much a bound level /// fails to spend, no other level's target may grow past this multiple of /// its opening share. Without it a run whose hidden levels are all at the