ec-av1 rate loop: flat path key frame no longer slams shared q
Browse files at this commitf61cd974c015e2649a9e24e7cb6804db690ca27bParent: 4b941751 changed file +2 -8
crates/ec-av1/src/encoder/mod.rsmodified+2 -8
| @@ -226,7 +226,7 @@ impl LevelPlan { | |||
| 226 | /// cannot build a debt a later transient has to repay; each frame's step is | 226 | /// 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 | -/// In pyramid mode the state is kept PER LEVEL: each frame's size is | 229 | +/// The state is kept PER LEVEL, flat path included: each frame's size is |
| 230 | /// predicted from the previous frame of its own level, against that level's | 230 | /// 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" this | 231 | /// own share of the budget, which is the whole "two-pass-free model" this |
| 232 | /// encoder carries. | 232 | /// encoder carries. |
| @@ -297,11 +297,7 @@ 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 own | 298 | // 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 the | 299 | // 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 flat | 300 | + // run's `gop` frame targets are shared out in those units. The old pyramid model priced a group as "one hidden frame worth |
| 301 | - // path is the same run with no hidden levels and no offsets, so the | ||
| 302 | - // key frame is budgeted against the GOP there too: its overshoot is | ||
| 303 | - // re-planned over the leaves, never slammed into their shared `q`. | ||
| 304 | - // The old pyramid model priced a group as "one hidden frame worth | ||
| 305 | // `ARF_WEIGHT` = 2 leaves plus `m - 1` leaves", which was wrong twice | 301 | // `ARF_WEIGHT` = 2 leaves plus `m - 1` leaves", which was wrong twice |
| 306 | // over and the two errors cancelled (lane-pyr6): the group has coded | 302 | // over and the two errors cancelled (lane-pyr6): the group has coded |
| 307 | // TWO hidden frames since the mid level landed (four with | 303 | // TWO hidden frames since the mid level landed (four with |
| @@ -372,8 +368,6 @@ impl RateLoop { | |||
| 372 | .position(|p| p.is_some_and(|p| p.slot == slot && (slot != 1 || p.offset == offset))) | 368 | .position(|p| p.is_some_and(|p| p.slot == slot && (slot != 1 || p.offset == offset))) |
| 373 | } | 369 | } |
| 374 | 370 | ||
| 375 | - /// Which controller a level uses: the key, the hidden ARF levels and the | ||
| 376 | - /// leaves each steer their own `q`. | ||
| 377 | fn slot(&self, level: Level) -> usize { | 371 | fn slot(&self, level: Level) -> usize { |
| 378 | match level { | 372 | match level { |
| 379 | Level::Key => 0, | 373 | Level::Key => 0, |