Lane-tplfut report -- the top ARF's tpl window, control vs three arms
Browse files at this commitd695be9cd92b2cfdf077e0669f335c0e7d07b845Parent: 3dc2378- docs
- lane-tplfut report -- the top ARF's tpl window, control vs three arms
1 changed file +120 -0
- lanes/tplfut.report.md +120 -0
lanes/tplfut.report.mdadded+120 -0
| @@ -0,0 +1,120 @@ | |||
| 1 | +# lane-tplfut: the top ARF's temporal lambda window | ||
| 2 | + | ||
| 3 | +## 1. What the tpl window MEANS on each path | ||
| 4 | + | ||
| 5 | +`encode_inter_frame`'s `lookahead` argument (encode.rs:12333) is turned into | ||
| 6 | +`frames = [current, w0, w1, ...]` and `tpl_lambda_factors` (encode.rs:11785) | ||
| 7 | +runs one coarse motion pass per ADJACENT pair, `tpl_coarse_pass(frames[f-1], | ||
| 8 | +frames[f])`, then propagates `mc_dep` from the far end back to `frames[0]`. | ||
| 9 | +So the window is ordered NEAREST-FIRST and the propagation assumes each entry | ||
| 10 | +is one display step further from the current frame along a continuous chain. | ||
| 11 | + | ||
| 12 | +* Flat path (encode.rs:13783): `rest[i+1..].take(tpl_depth()-1)` -- strictly | ||
| 13 | + display-FUTURE, nearest first. Forward in time, like libaom. | ||
| 14 | +* Pyramid leaves and the mid/quarter ARFs (`code_group`'s `tpl_window(pos, | ||
| 15 | + false)`): the group's own display-order successors. Also forward. | ||
| 16 | +* The TOP ARF: `tpl_window(group.len()-1, true)` = `group[..pos].iter().rev()` | ||
| 17 | + -- the group's own sources, which are all display-PAST of it (the top ARF is | ||
| 18 | + its group's LAST picture). Nearest-first is still an adjacent chain, so the | ||
| 19 | + propagation is well-formed, but it runs BACKWARD in time: the window is | ||
| 20 | + TIME-REVERSED relative to the flat path and to libaom's tpl at an ARF, which | ||
| 21 | + looks forward over the next group. That is the premise this lane tested, and | ||
| 22 | + it is confirmed in code. | ||
| 23 | + | ||
| 24 | +## 2. The arm | ||
| 25 | + | ||
| 26 | +`speed::TPL_FUT` / `EC_AV1_TPL_FUT=<n>`, read in `Av1Encoder::code_group` | ||
| 27 | +(encoder.rs), applying to the TOP ARF only; falls back to mode 0's window | ||
| 28 | +whenever `future` is empty (lookahead off, end of stream). The ARF source | ||
| 29 | +filter window (`arf_tf_window_future`) is untouched. | ||
| 30 | + | ||
| 31 | +* 0 -- the display-past window, the shipped behaviour. | ||
| 32 | +* 1 -- future-only, nearest first, up to `tpl_depth()-1`. | ||
| 33 | +* 2 -- past then future concatenated nearest-first, half the budget each side | ||
| 34 | + (`EC_AV1_TPL_FUT_HALF=<n>` moves the split; default 3 past + 4 future at | ||
| 35 | + `tpl_depth()=8`). The chain has ONE discontinuity in the middle. | ||
| 36 | +* 3 -- future-only over the WHOLE buffered next group, ignoring `tpl_depth`. | ||
| 37 | + | ||
| 38 | +## 3. Deciding gate: `encode::tests::bd_rate_film_long_gop` (48 pictures) | ||
| 39 | + | ||
| 40 | +BD-rate vs libaom / vs rav1e, lower better; wall is ours. | ||
| 41 | + | ||
| 42 | +| arm | film A | film B | wall A | wall B | | ||
| 43 | +|---|---|---|---|---| | ||
| 44 | +| 0, past (control, reproduced) | +21.3% / -8.8% | +72.1% / -1.2% | 671.1s | 461.6s | | ||
| 45 | +| 1, future only | +22.0% / -8.6% | +73.1% / -1.1% | 629.6s | 583.1s | | ||
| 46 | +| **2, 3 past + 4 future (SHIPS)** | **+21.2% / -8.8%** | **+71.6% / -1.5%** | 692.3s | 462.5s | | ||
| 47 | +| 3, whole next group | +21.9% / -8.7% | +72.7% / -1.4% | 573.1s | 455.7s | | ||
| 48 | + | ||
| 49 | +The control reproduces the standing table (film A +21.2/-8.8, film B | ||
| 50 | ++72.1/-1.2 at 152996c8), so the arms are read against a live baseline. | ||
| 51 | + | ||
| 52 | +A future-ONLY window LOSES on every column of both films (modes 1 and 3): the | ||
| 53 | +nearest display-past neighbours are what carries the map's propagation for a | ||
| 54 | +frame the whole group predicts from. Mode 2 is film B -0.5 / -0.3 and film A | ||
| 55 | +-0.1 / 0.0, i.e. one row >=0.5 down and the other flat within +-0.3 -- the | ||
| 56 | +lane's keep rule -- at +3.2% (film A) and +0.2% (film B) wall, well under the | ||
| 57 | ++15% ceiling. `speed::TPL_FUT` defaults to 2. | ||
| 58 | + | ||
| 59 | +Honest ceiling: mode 2's win is 0.5 point on a +72 number and the split | ||
| 60 | +(3+4) was not swept. `EC_AV1_TPL_FUT_HALF` exists for that sweep. | ||
| 61 | + | ||
| 62 | +## 4. 12-picture native guard (`bd_rate_screen_native`, all three clips on) | ||
| 63 | + | ||
| 64 | +STRUCTURALLY BLIND to this lever: `group_target` absorbs the 12-picture tail | ||
| 65 | +into ONE group of 11, so no next group is ever buffered and mode 2 falls back | ||
| 66 | +to the past window on every ARF. Run only as a no-regression guard: | ||
| 67 | + | ||
| 68 | +| clip | BD vs libaom | BD vs rav1e | | ||
| 69 | +|---|---|---| | ||
| 70 | +| bars 1080p | -3.2% | -18.8% | | ||
| 71 | +| bars 2160p | +8.4% | -13.9% | | ||
| 72 | +| film A | +17.9% | -6.3% | | ||
| 73 | +| film B | +22.4% | -3.9% | | ||
| 74 | +| screen capture | +14.4% | -33.2% | | ||
| 75 | + | ||
| 76 | +## 5. Witness | ||
| 77 | + | ||
| 78 | +`encoder::tests::the_future_tpl_window_still_codes_every_picture_and_moves_the_stream` | ||
| 79 | +(sibling of the lane-lookahead one), coded at q=60 -- NOT 120, where this | ||
| 80 | +fixture's ARF is almost pure skip and re-quantises to identical bytes. At GOP | ||
| 81 | +32 and 8, run lengths 1/7/8/9/17, every mode: coding order and levels | ||
| 82 | +unchanged, every picture coded, decoded exact through our decoder AND ffmpeg. | ||
| 83 | +Modes 1 and 3 MOVE the stream against mode 0 at 17 pictures. | ||
| 84 | + | ||
| 85 | +Mode 2 does NOT move it on that 128x128 fixture at its default split: it keeps | ||
| 86 | +the three nearest past neighbours, which dominate the propagation, and no RD | ||
| 87 | +decision flips. Measured, not assumed -- the same run with | ||
| 88 | +`EC_AV1_TPL_FUT_HALF=1` (one past, six future) DOES move the stream, and the | ||
| 89 | +long-GOP gate above measures mode 2 moving on real content. The witness names | ||
| 90 | +this instead of asserting it. | ||
| 91 | + | ||
| 92 | +## 6. Other gates | ||
| 93 | + | ||
| 94 | +* Pins `encode::tests::the_encoders_own_streams_are_byte_identical_to_their_pins`: | ||
| 95 | + PASS at the default AND at `EC_AV1_SPEED=6`, unchanged (its 4-picture | ||
| 96 | + fixture has no next group, so the fallback keeps the past window). | ||
| 97 | +* `encoder::tests::every_speed_preset_decodes_sample_exact_through_both_decoders` | ||
| 98 | + (--ignored): PASS. | ||
| 99 | +* `encoder::tests::bitrate_target_lands_within_5_percent_over_48_frames`: | ||
| 100 | + PASS. Pyramid arm -1.9% is flat: 384k +1.5%, 768k +0.0%, 1536k +0.0%, | ||
| 101 | + 2000k +0.0%; the flat arm -1.9% / -2.6% / -2.8% / -1.7%. | ||
| 102 | +* Suite in three lanes and `cargo check --workspace --all-targets`: see the | ||
| 103 | + suite line at the end of this file. | ||
| 104 | + | ||
| 105 | +## Deviations | ||
| 106 | + | ||
| 107 | +* The charter's sub-arm (b) "past (+) future concatenated nearest-first" does | ||
| 108 | + not define the split; half-and-half with an env override is what shipped, | ||
| 109 | + and the split is unswept (named above). | ||
| 110 | +* `EC_AV1_TPL_FUT_HALF` is an extra knob the charter did not ask for; it is | ||
| 111 | + what makes the witness's mode-2 inertness a measurement rather than a story. | ||
| 112 | + | ||
| 113 | +## Suite line | ||
| 114 | + | ||
| 115 | +`ec-av1` lib suite, three detached lanes off one release binary: 347 passed / | ||
| 116 | +0 failed (`--skip stream::`), 202 / 0 (`stream:: --skip 10bit`), 42 / 0 | ||
| 117 | +(`10bit`) -- 591 passed, 0 failed, 55 ignored. | ||
| 118 | +`cargo check --workspace --all-targets -j4`: 0 errors, 0 ec-av1 warnings (the | ||
| 119 | +21 ec-opus missing-doc warnings and the ec-vorbis oracle one are pre-existing | ||
| 120 | +and untouched). | ||