forge
Explore
Log in

Don't you dare go Hollow

Post-merge pyramid sweep, why it ships off and what unblocks it

Browse files at this commit

51ea72dd96007f172e8f9fbb89d1a0696adca2acAhmet Kaan GümüşParent: 28f2d42
  • docs
    • post-merge pyramid sweep, why it ships off and what unblocks it
Show full message
docs(av1): post-merge pyramid sweep, why it ships off and what unblocks it
crates/ec-av1/src/encoder.rsmodified+46 -17
@@ -332,7 +332,12 @@ impl Default for Pyramid {
332 /// The best point of the offset sweep run through the BD gate's own332 /// The best point of the offset sweep run through the BD gate's own
333 /// `EC_AV1_PYRAMID=<mini_gop>[:<arf_q_offset>:<leaf_q_offset>]` knob333 /// `EC_AV1_PYRAMID=<mini_gop>[:<arf_q_offset>:<leaf_q_offset>]` knob
334 /// (`encode::tests::bd_rate_vs_libaom_and_rav1e`, 12 frames of each of334 /// (`encode::tests::bd_rate_vs_libaom_and_rav1e`, 12 frames of each of
335- /// the three gate clips, BD-rate vs libaom / vs rav1e):335+ /// the three gate clips, BD-rate vs libaom / vs rav1e, wall = the four
336+ /// encodes of the ladder together).
337+ ///
338+ /// First sweep, before the motion-search lane merged (its extra-reference
339+ /// `NEWMV` is exactly what a pyramid leaf needs to reach its hidden
340+ /// frame), so read it for the OFFSETS, not for the verdict:
336 ///341 ///
337 /// | mini_gop:arf:leaf | 1080p | 2160p | screen |342 /// | mini_gop:arf:leaf | 1080p | 2160p | screen |
338 /// |---|---|---|---|343 /// |---|---|---|---|
@@ -344,23 +349,47 @@ impl Default for Pyramid {
344 /// | 2:-8:4 | +143.1 / +89.1 | +196.2 / +141.6 | +82.5 / +20.4 |349 /// | 2:-8:4 | +143.1 / +89.1 | +196.2 / +141.6 | +82.5 / +20.4 |
345 /// | 2:-16:8 | +137.6 / +84.5 | +187.2 / +130.6 | +84.9 / +23.1 |350 /// | 2:-16:8 | +137.6 / +84.5 | +187.2 / +130.6 | +84.9 / +23.1 |
346 ///351 ///
347- /// Two things the sweep says. The quantizer offsets are real and in the352+ /// `0:0` is the worst row at both mini-GOP sizes and `-16/+8` buys 12-16
348- /// direction libaom's `gf_group` spends them (0/0 is the worst row at353+ /// BD points over it, in the direction libaom's `gf_group` spends them
349- /// every mini-GOP; -16/+8 buys 12-16 BD points over it), which is what354+ /// (lowest quantizer on the frame everything else predicts from). Those
350- /// these defaults are. And the pyramid as a whole does NOT yet pay: no355+ /// are these defaults.
351- /// row beats the flat baseline on all three clips, and 2160p is 40-70356+ ///
352- /// points worse everywhere.357+ /// Re-measured after that lane merged (wall ours, 1080p/2160p/screen):
358+ ///
359+ /// | arm | 1080p | 2160p | screen | wall |
360+ /// |---|---|---|---|---|
361+ /// | flat (no pyramid) | +121.1 / +71.8 | +146.1 / +97.5 | +79.3 / +17.2 | 6.3 / 5.8 / 6.2 s |
362+ /// | 4:-16:8 | +131.9 / +81.1 | +178.7 / +123.6 | +78.4 / +19.5 | 6.2 / 5.6 / 5.5 s |
363+ /// | 2:-16:8 | +125.4 / +76.2 | +173.0 / +119.5 | +84.9 / +23.1 | 6.2 / 5.6 / 6.2 s |
364+ ///
365+ /// So the pyramid still does NOT pay, and ships OFF: it wins 0.9 points
366+ /// on screen capture at `4:-16:8` and loses 11 on 1080p and 33 on 2160p.
367+ /// What keeps it from paying, in the order the numbers point at it:
368+ ///
369+ /// * The hidden frame predicts `mini_gop` pictures ahead of its own
370+ /// reference with the SAME forward search a neighbouring frame gets,
371+ /// and it is the largest frame in the group (73.8 kB of the 1080p
372+ /// ladder's 184 kB at `4:-16:8`). On the 2160p clip, whose motion the
373+ /// search only just reaches at distance 1, distance 4 is where it
374+ /// falls off — that clip loses twice what 1080p does, and shrinking
375+ /// the mini-GOP to 2 recovers most of the gap (+178.7 -> +173.0,
376+ /// +131.9 -> +125.4). A distance-scaled search range is the fix, and
377+ /// it lives in the motion-search lane, not here.
378+ /// * The leaves reach the hidden frame through the extra-reference
379+ /// modes only: `ALTREF_FRAME` wins about 13% of blocks
380+ /// (`encode::take_ref_frame_hits`, printed by the round-trip test),
381+ /// up from 4% before the motion lane merged. A compound
382+ /// (`LAST` + `ALTREF`) prediction mode is the other half of what a
383+ /// real B frame buys, and this crate codes no compound blocks at all.
353 ///384 ///
354- /// The reason is measurable, not mysterious: the leaves may only reach385+ /// Neither is a defect in the pyramid itself: the reordering is exact
355- /// the hidden frame through the SEARCH-FREE modes (`NEARESTMV` off the386+ /// (`encoder::tests::a_pyramid_stream_decodes_in_display_order_through_both_decoders`
356- /// stack and `GLOBALMV`) — this lane adds no motion search — so387+ /// checks every shown frame in display order against ffmpeg AND our own
357- /// `ALTREF_FRAME` wins about 4% of blocks, while the hidden frame itself388+ /// decoder, with the hidden frame proven to win blocks), and the
358- /// pays the full cost of predicting `mini_gop` pictures ahead of its own389+ /// quantizer offsets behave. Nothing selects the pyramid but an explicit
359- /// reference. Backward `NEWMV` is the missing half, and it lives in the390+ /// [`Av1Encoder::with_pyramid`] call (or `EC_AV1_PYRAMID` on the gate and
360- /// motion-search lane. Until it lands the pyramid ships OFF: nothing391+ /// on `ec-bench`); the default one-in-one-out path is byte-identical to
361- /// selects it but an explicit [`Av1Encoder::with_pyramid`] call (or392+ /// before it existed.
362- /// `EC_AV1_PYRAMID` on the gate and on `ec-bench`), and the default
363- /// one-in-one-out path is byte-identical to before it existed.
364 fn default() -> Self {393 fn default() -> Self {
365 Self {394 Self {
366 mini_gop: 4,395 mini_gop: 4,