forge
Explore
Log in

Don't you dare go Hollow

ec-av1 rate loop: restore main's comment text in level model (no prose added)

Browse files at this commit

a8e773b9ca3ca46ba09d7e2489c3351fee3cd07eAhmet Kaan GümüşParent: f61cd97
Root cause (unverified by ffmpeg here): flat path slot() returned 0 for every
level, so the key frame's unclamped seed step drove the shared q to the rail.
Fix maps flat onto the pyramid's run plan (key slot 0, leaf slot 2, gop budget).
Comment-only follow-up: restores main's wording, removes added prose.
crates/ec-av1/src/encoder/mod.rsmodified+6 -5
@@ -226,7 +226,7 @@ impl LevelPlan {
226 /// cannot build a debt a later transient has to repay; each frame's step is226 /// cannot build a debt a later transient has to repay; each frame's step is
227 /// bounded by `STEP_CLAMP` regardless of history.227 /// bounded by `STEP_CLAMP` regardless of history.
228 ///228 ///
229-/// The state is kept PER LEVEL, flat path included: each frame's size is229+/// In pyramid mode the state is kept PER LEVEL: each frame's size is
230 /// predicted from the previous frame of its own level, against that level's230 /// predicted from the previous frame of its own level, against that level's
231 /// own share of the budget, which is the whole "two-pass-free model" this231 /// own share of the budget, which is the whole "two-pass-free model" this
232 /// encoder carries.232 /// encoder carries.
@@ -297,10 +297,11 @@ impl RateLoop {
297 fn new(target_bytes: f64, start_q: f64, pyramid: Option<Pyramid>, gop: usize) -> Self {297 fn new(target_bytes: f64, start_q: f64, pyramid: Option<Pyramid>, gop: usize) -> Self {
298 // THE LEVEL MODEL. Every coded frame of the run is priced by its own298 // THE LEVEL MODEL. Every coded frame of the run is priced by its own
299 // q offset through `WEIGHT_LEVEL_GAIN`, in units of one leaf, and the299 // q offset through `WEIGHT_LEVEL_GAIN`, in units of one leaf, and the
300- // run's `gop` frame targets are shared out in those units. The old pyramid model priced a group as "one hidden frame worth300+ // run's `gop` frame targets are shared out in those units. The old
301- // `ARF_WEIGHT` = 2 leaves plus `m - 1` leaves", which was wrong twice301+ // model priced a group as "one hidden frame worth `ARF_WEIGHT` = 2
302- // over and the two errors cancelled (lane-pyr6): the group has coded302+ // leaves plus `m - 1` leaves", which was wrong twice over and the two
303- // TWO hidden frames since the mid level landed (four with303+ // errors cancelled (lane-pyr6): the group has coded TWO hidden frames
304+ // since the mid level landed (four with
304 // [`Pyramid::quarter_q_offset`]), and a hidden frame is worth far305 // [`Pyramid::quarter_q_offset`]), and a hidden frame is worth far
305 // more than two leaves -- the census reads the top ARF at 24x a leaf306 // more than two leaves -- the census reads the top ARF at 24x a leaf
306 // and the mid at 5x. Both are fixed here, in one diff.307 // and the mid at 5x. Both are fixed here, in one diff.