The LAST2 census table and the SMOOTH arm on the 12-frame gate
Browse files at this commit56cd82ea565970648e341674c1b7fb928a9dd72aParent: 06bd77f- docs
- the LAST2 census table and the SMOOTH arm on the 12-frame gate
1 changed file +71 -16
- lanes/refs.report.md +71 -16
lanes/refs.report.mdmodified+71 -16
| @@ -1,28 +1,83 @@ | ||
| 1 | -# lane-refs — the reference set and the frame interpolation filter | |
| 1 | +# lane-refs — the reference set (LAST2) and the frame interpolation filter | |
| 2 | 2 | |
| 3 | 3 | Worktree `edith_codecs-refs`, branch `lane-refs` off main 68e96c56. Every gate |
| 4 | -arm is the prebuilt release lib-test binary; rows are read off each log's own | |
| 5 | -header line. | |
| 4 | +arm is the prebuilt release lib-test binary running `bd_rate_screen_native` | |
| 5 | +(12 pictures, `gop 12`, four quantizers); each row is read off that log's own | |
| 6 | +header line, one selector env var per arm (the 5-row gate does not fit a 900 s | |
| 7 | +timeout). | |
| 6 | 8 | |
| 7 | -## 0. Controls (12-frame native gate) | |
| 9 | +## 0. The controls reproduce, to the digit | |
| 8 | 10 | |
| 9 | -(pending — arms `rf-c1`/`rf-c2` running) | |
| 11 | +| clip | control vs libaom / vs rav1e | charter | | |
| 12 | +|---|---|---| | |
| 13 | +| film A, 12 frames | +21.7 / -4.4 | +21.7 / -4.4 | | |
| 14 | +| film B, 12 frames | +26.9 / -0.6 | +26.9 / -0.6 | | |
| 15 | +| screen capture, 12 frames | +20.1 / -30.4 | +20.1 / -30.4 | | |
| 10 | 16 | |
| 11 | -## 1. LAST2 — the census first | |
| 17 | +## 1. LAST2 — the census, taken BEFORE the slot bookkeeping | |
| 12 | 18 | |
| 13 | 19 | `encoder.rs`'s `ref_frame_idx` maps LAST2/LAST3 onto LAST's own DPB slot, so |
| 14 | -the second past picture is not merely unoffered, it is not retained. Before | |
| 15 | -building the slot bookkeeping + a second motion search (the stage that already | |
| 16 | -owns most of the encode wall; `search_inter_block`'s `extra` references are | |
| 17 | -search-FREE for exactly that reason), `last2_census` prices the lever. | |
| 20 | +the picture before LAST is not merely unoffered to the search, it is not | |
| 21 | +retained. Building the real thing is not a small diff (a second retained | |
| 22 | +slot at every level, `ref_frame_idx`/`refresh_frame_flags`, sign bias, order | |
| 23 | +hints, `record_mi`, the motion field, the search offering LAST2 through the | |
| 24 | +per-reference mv stack, and a second MOTION SEARCH per block -- today even | |
| 25 | +GOLDEN and ALTREF are offered search-FREE, `search_inter_block`'s `extra` | |
| 26 | +prices only their NEARESTMV/GLOBALMV, precisely because a second search | |
| 27 | +doubles the stage that already owns most of the encode wall). | |
| 18 | 28 | |
| 19 | -(table pending) | |
| 29 | +So `last2_census` (`encode.rs`, `--ignored`) prices the lever first, on the | |
| 30 | +gate's OWN window and loader (`probe::gate_crop`, 12 pictures): every 16x16 | |
| 31 | +luma block of every picture gets one full-pel diamond search against the NEAR | |
| 32 | +reference and the same search against the FAR one, at the two lags the pyramid | |
| 33 | +offers -- (1, 2) for the leaf chain, (4, 8) for the ARF level (rav1e's own | |
| 34 | +pair: its ARFs read LAST@-4 + LAST2@-8). | |
| 35 | + | |
| 36 | + cargo test -p ec-av1 --release --lib -- --ignored last2_census --nocapture | |
| 37 | + | |
| 38 | +| clip | level (near/far lag) | blocks | far wins | far wins >10% | SAD near | SAD best-of | prediction energy removed | | |
| 39 | +|---|---|---|---|---|---|---|---| | |
| 40 | +| film A | leaf (1/2) | 57600 | 38.7% | 19.0% | 20974762 | 19509622 | **6.99%** | | |
| 41 | +| film A | ARF (4/8) | 23040 | 37.8% | 21.0% | 12015492 | 10776319 | **10.31%** | | |
| 42 | +| film B | leaf (1/2) | 76800 | 38.1% | 21.2% | 18946199 | 17572121 | **7.25%** | | |
| 43 | +| film B | ARF (4/8) | 30720 | 44.3% | 22.5% | 8539904 | 7824079 | **8.38%** | | |
| 44 | + | |
| 45 | +READ IT HONESTLY: the last column is prediction ENERGY (SAD), not bytes. A | |
| 46 | +second reference wins about 4 blocks in 10 and wins by more than 10% on 1 in 5, | |
| 47 | +and best-of-{LAST, LAST2} removes 7-10% of the frame's total absolute | |
| 48 | +prediction error -- before any of it is paid back in the `single_ref` bits | |
| 49 | +that name the second reference, the mv bits its own stack costs, and the | |
| 50 | +second motion search's wall. 7-10% of SAD is the CEILING of the lever, and the | |
| 51 | +ARF level (10.3% / 8.4%) is where it sits, not the leaf chain. | |
| 20 | 52 | |
| 21 | 53 | ## 2. The frame interpolation filter |
| 22 | 54 | |
| 23 | -Wired: `FrameCtx::interp_filter` carries the frame's kernel to the search, | |
| 24 | -the trials, the compound predictors and the trial decode, and | |
| 25 | -`encode_inter_frame` writes the SAME kernel into the header. `EC_AV1_INTERP= | |
| 26 | -smooth|sharp` selects it; the default stays REGULAR and byte-identical. | |
| 55 | +Wired (this lane): `mc::predict` hardwired `InterpFilterKind::Regular`, so the | |
| 56 | +encoder could not have coded a non-REGULAR frame whatever its header said. | |
| 57 | +The kernel now lives on `FrameCtx::interp_filter` (copied into every | |
| 58 | +tile-search worker by `filter_ctx_copy`), `encode_inter_frame` writes the SAME | |
| 59 | +kernel into the frame header, and the search, the block trials, the compound | |
| 60 | +predictors and the trial decode all read it. `EC_AV1_INTERP=smooth|sharp` or | |
| 61 | +the process-global `set_frame_interp` select it; the default stays REGULAR and | |
| 62 | +byte-identical. | |
| 63 | + | |
| 64 | +Witness (not ignored): | |
| 65 | +`each_frame_interpolation_filter_codes_its_own_stream_ffmpeg_decodes_exactly` | |
| 66 | +-- the three kernels code three DIFFERENT streams (a filter that never reached | |
| 67 | +the prediction would code REGULAR's bytes, class `symbol consumption gap`) and | |
| 68 | +ffmpeg reconstructs every frame of each of them exactly. | |
| 69 | + | |
| 70 | +### SMOOTH on the 12-frame gate | |
| 71 | + | |
| 72 | +| clip | control | EC_AV1_INTERP=smooth | | |
| 73 | +|---|---|---| | |
| 74 | +| film A | +21.7 / -4.4 | **+40.9 / +10.2** | | |
| 75 | +| film B | +26.9 / -0.6 | **+26.3 / -0.4** | | |
| 76 | +| bars 1080p | -1.0 / -16.8 | -1.4 / -17.2 | | |
| 77 | +| bars 2160p | +9.4 / -12.7 | +9.3 / -12.9 | | |
| 78 | + | |
| 79 | +Film B and both bars rows improve; film A loses NINETEEN BD points (0.2 dB at | |
| 80 | +every quantizer). The two real films disagree in sign, so SMOOTH is not a | |
| 81 | +default -- the keep rule ("both film rows improve") is unmet by a wide margin. | |
| 27 | 82 | |
| 28 | -(table pending) | |
| 83 | +(SHARP arms pending.) |