measure(av1): OBMC on the real film rows and at the long GOP, and the interp-filter census
Browse files at this commit6a9a0fcf0d3d4bb86391350acc4eee83b4c2189dParent: 9e3436c2 changed files +137 -0
- crates/ec-av1/src/encode.rs +37 -0
- lanes/obmc3.report.md +100 -0
crates/ec-av1/src/encode.rsmodified+37 -0
| @@ -1868,6 +1868,16 @@ pub fn inter_frame_headers_slots( | |||
| 1868 | idx | 1868 | idx |
| 1869 | }, | 1869 | }, |
| 1870 | allow_high_precision_mv: false, | 1870 | allow_high_precision_mv: false, |
| 1871 | + // A FIXED frame-level filter, so no block codes an `interp_filter` | ||
| 1872 | + // symbol. lane-obmc3 instrumented whether that costs anything: a | ||
| 1873 | + // libaom `cpu-used 6` crf 41 stream of the long-GOP film B window | ||
| 1874 | + // (45941 B, the same point `lanes/libcen.report.md` matched) read | ||
| 1875 | + // back through `EC_AV1_BITCENSUS=1 syntax_census` codes | ||
| 1876 | + // `switchable_interp 0/0` in EVERY frame -- libaom picks a fixed | ||
| 1877 | + // frame filter here too, so there are ZERO per-block filter bits at | ||
| 1878 | + // stake on this content and the per-block switchable search was not | ||
| 1879 | + // built (the charter's premise that libaom codes switchable interp | ||
| 1880 | + // per block on film B is refuted by its own stream). | ||
| 1871 | interpolation_filter: ec_av1_syntax::InterpolationFilter::Eighttap, | 1881 | interpolation_filter: ec_av1_syntax::InterpolationFilter::Eighttap, |
| 1872 | // lane-av1obmc: with this bit set every single-reference inter block | 1882 | // lane-av1obmc: with this bit set every single-reference inter block |
| 1873 | // libaom's `motion_mode_allowed` accepts carries a `motion_mode` | 1883 | // libaom's `motion_mode_allowed` accepts carries a `motion_mode` |
| @@ -3574,6 +3584,33 @@ pub(crate) fn warp_on() -> bool { | |||
| 3574 | /// margin is loosened. On warp alone it looked like a keep (+16.3/-0.9 at | 3584 | /// margin is loosened. On warp alone it looked like a keep (+16.3/-0.9 at |
| 3575 | /// min 8, +16.6/-0.7 at min 16 against warp's +16.7/-0.5) -- that gain and | 3585 | /// min 8, +16.6/-0.7 at min 16 against warp's +16.7/-0.5) -- that gain and |
| 3576 | /// the margin's gain are the same bytes. It stays OFF. | 3586 | /// the margin's gain are the same bytes. It stays OFF. |
| 3587 | +/// | ||
| 3588 | +/// RE-MEASURED on lane-obmc3 (2026-09-08) on the REAL film rows -- every | ||
| 3589 | +/// judgement above was taken when the gate's "film" rows were the `testsrc2` | ||
| 3590 | +/// COLOUR BARS fixtures (class `gate film rows are colour bars`), so this is | ||
| 3591 | +/// the first OBMC measurement on film. BD vs libaom / vs rav1e, 12 pictures, | ||
| 3592 | +/// the standing native keep table (`bd_rate_screen_native`): | ||
| 3593 | +/// | ||
| 3594 | +/// | arm | film A | film B | screen | OBMC fire A/B | | ||
| 3595 | +/// |---|---|---|---|---| | ||
| 3596 | +/// | off (control) | +21.7 / -4.4 | +26.9 / -0.6 | +20.1 / -30.4 | 0% / 0% | | ||
| 3597 | +/// | min side 8 | +21.7 / -4.3 | +27.2 / -0.3 | +20.0 / -30.4 | 15.5% / 9.7% | | ||
| 3598 | +/// | min side 16 | +21.5 / -4.5 | +27.6 / +0.1 | +20.1 / -30.4 | 10.0% / 6.9% | | ||
| 3599 | +/// | ||
| 3600 | +/// and on the LONG-GOP gate (`bd_rate_film_long_gop`, 48 pictures, film B | ||
| 3601 | +/// only), where the anchors' non-skip area is the known gap: | ||
| 3602 | +/// | ||
| 3603 | +/// | arm | film B long GOP | wall ours | | ||
| 3604 | +/// |---|---|---| | ||
| 3605 | +/// | off (control) | +89.8 / +9.1 | 477.5s | | ||
| 3606 | +/// | min side 8 | +89.6 / +9.0 | 514.1s | | ||
| 3607 | +/// | ||
| 3608 | +/// The two gates disagree in SIGN on film B -- 0.3/0.3 worse over 12 | ||
| 3609 | +/// pictures, 0.2/0.1 better over 48 -- and film A moves 0.2/0.1 the good way | ||
| 3610 | +/// only at min side 16, which is exactly where film B loses 0.7 on both | ||
| 3611 | +/// columns. Nothing here meets the keep rule (both films down on both | ||
| 3612 | +/// columns, or one down >=0.5 with the other flat), and the long-GOP gain | ||
| 3613 | +/// costs +7.7% wall. OBMC stays OFF at every preset. | ||
| 3577 | fn obmc_min_side() -> usize { | 3614 | fn obmc_min_side() -> usize { |
| 3578 | static N: std::sync::OnceLock<usize> = std::sync::OnceLock::new(); | 3615 | static N: std::sync::OnceLock<usize> = std::sync::OnceLock::new(); |
| 3579 | *N.get_or_init(|| { | 3616 | *N.get_or_init(|| { |
lanes/obmc3.report.mdadded+100 -0
| @@ -0,0 +1,100 @@ | |||
| 1 | +# lane-obmc3 — OBMC on the real film rows, the interp filter, the reference set | ||
| 2 | + | ||
| 3 | +Worktree `edith_codecs-obmc3`, branch `lane-obmc3` off main 19668acf. Every arm | ||
| 4 | +is the prebuilt release lib-test binary running `bd_rate_screen_native` (12 | ||
| 5 | +pictures, `gop 12`, four quantizers) or `bd_rate_film_long_gop` (48 pictures, | ||
| 6 | +`gop 48`), each row read off that log's own header line. | ||
| 7 | + | ||
| 8 | +## 0. The controls reproduce (charter said to check) | ||
| 9 | + | ||
| 10 | +| clip | control vs libaom / vs rav1e | charter | | ||
| 11 | +|---|---|---| | ||
| 12 | +| film A, 12 frames | +21.7 / -4.4 | +21.7 / -4.4 | | ||
| 13 | +| film B, 12 frames | +26.9 / -0.6 | +26.9 / -0.6 | | ||
| 14 | +| screen, 12 frames | +20.1 / -30.4 | +20.8 / -30.1 (STALE by 0.7/0.3) | | ||
| 15 | +| film B, long GOP | +89.8 / +9.1 | +89.8 / +9.1 | | ||
| 16 | + | ||
| 17 | +Three of the four land to the digit; the charter's screen number is stale. | ||
| 18 | + | ||
| 19 | +## 1. OBMC on the 12-frame native gate — REJECTED | ||
| 20 | + | ||
| 21 | +`EC_AV1_OBMC=1`, `EC_AV1_OBMC_MIN` as named; the fire column is the log's own | ||
| 22 | +`motion_mode ... % OBMC of N eligible` line. | ||
| 23 | + | ||
| 24 | +| arm | film A | film B | screen | OBMC fire A / B | | ||
| 25 | +|---|---|---|---|---| | ||
| 26 | +| off (control) | +21.7 / -4.4 | +26.9 / -0.6 | +20.1 / -30.4 | 0% / 0% | | ||
| 27 | +| min side 8 | +21.7 / -4.3 | **+27.2 / -0.3** | +20.0 / -30.4 | 15.5% / 9.7% | | ||
| 28 | +| min side 16 | **+21.5 / -4.5** | **+27.6 / +0.1** | +20.1 / -30.4 | 10.0% / 6.9% | | ||
| 29 | + | ||
| 30 | +min 8 is 0.3 worse on BOTH film B columns and 0.1 worse on film A's rav1e | ||
| 31 | +column; min 16 buys film A 0.2/0.1 and costs film B 0.7/0.7. The screen row is | ||
| 32 | +flat (+/-0.1) at both sizes, so the screen gate is not the obstacle — the film | ||
| 33 | +rows are. Walls are within the parallel-arm noise (film A 193.5s control vs | ||
| 34 | +195.7s min 8 vs 196.7s min 16, film B 144.4 / 145.8 / 146.2s), i.e. OBMC costs | ||
| 35 | +~1% of encode wall on this gate. | ||
| 36 | + | ||
| 37 | +## 2. OBMC on the long-GOP gate (film B, 48 pictures) — a 0.1-0.2 gain, still not a keep | ||
| 38 | + | ||
| 39 | +| arm | film B | OBMC fire | wall ours:libaom:rav1e | | ||
| 40 | +|---|---|---|---| | ||
| 41 | +| off (control) | +89.8 / +9.1 | 0.0% of 238881 eligible | 477.5s:79.0s:61.9s | | ||
| 42 | +| min side 8 | +89.6 / +9.0 | 10.7% of 241966 | 514.1s:96.1s:55.5s | | ||
| 43 | + | ||
| 44 | +The two gates disagree in SIGN on film B: 0.3/0.3 worse over 12 pictures, | ||
| 45 | +0.2/0.1 better over 48. A 0.1-0.2 move is far under the keep rule (both films | ||
| 46 | +down on both columns, or one down >=0.5 with the other flat) and it costs | ||
| 47 | ++7.7% wall. **Decision: OBMC stays OFF at every preset**, `speed.rs` untouched. | ||
| 48 | +This is now the sixth refutation and the first one taken on real film content | ||
| 49 | +rather than the colour-bars fixtures. | ||
| 50 | + | ||
| 51 | +## 3. The interp filter — the charter's premise is refuted by libaom's own stream | ||
| 52 | + | ||
| 53 | +Ours: `encode.rs` writes `interpolation_filter: Eighttap` in every frame | ||
| 54 | +header, so no block codes an `interp_filter` symbol and every prediction runs | ||
| 55 | +the REGULAR kernel (`Some(mc::InterpFilterKind::Regular)` at the search, trial | ||
| 56 | +and recon call sites). | ||
| 57 | + | ||
| 58 | +libaom: the long-GOP film B window re-encoded exactly as `external_ladder` | ||
| 59 | +does it (`-cpu-used 6 -b:v 0 -crf 41 -g 48 -threads 1 -f obu`, 45941 B against | ||
| 60 | +`lanes/libcen.report.md`'s matched 45938 B) and read back with | ||
| 61 | +`EC_AV1_BITCENSUS=1 syntax_census` codes | ||
| 62 | + | ||
| 63 | + switchable_interp 0/0 | ||
| 64 | + | ||
| 65 | +in EVERY level row (key, ARFs, leaves) — libaom picks a fixed frame filter on | ||
| 66 | +this content too. There are ZERO per-block interp-filter bits at stake on film | ||
| 67 | +B, so the per-block switchable search was NOT built (ladder rung 1: it does not | ||
| 68 | +need to exist). The finding is recorded next to the header field in | ||
| 69 | +`encode.rs`. Open follow-up, if anyone wants it: libaom chooses WHICH fixed | ||
| 70 | +filter per frame; we always send REGULAR. That is a frame-level knob, not a | ||
| 71 | +per-block search, and it was not measured here. | ||
| 72 | + | ||
| 73 | +## 4. The reference set — deferred, with the reason | ||
| 74 | + | ||
| 75 | +`encoder.rs:1663` maps `ref_frame_idx` as `[LAST, LAST2, LAST3, GOLDEN, ...] = | ||
| 76 | +[last_slot, last_slot, last_slot, GOLDEN_SLOT, last_slot, last_slot, | ||
| 77 | +altref_slot]`: LAST2/LAST3 name the SAME DPB slot as LAST, so a second past | ||
| 78 | +reference is not merely unoffered by the search, it is not retained. A | ||
| 79 | +best-of-{LAST, LAST2} SAD census therefore needs the slot bookkeeping built | ||
| 80 | +first (a second retained past slot + the search offering it + a witness), which | ||
| 81 | +is feature work, not instrumentation. Deferred; unblocked by a lane that owns | ||
| 82 | +`encoder.rs`'s DPB slots. | ||
| 83 | + | ||
| 84 | +## 5. What ships | ||
| 85 | + | ||
| 86 | +Nothing but the measurements: two doc blocks in `crates/ec-av1/src/encode.rs` | ||
| 87 | +(the OBMC table at `obmc_min_side`, the interp census at the header field) and | ||
| 88 | +this report. No default moves, no pin is re-pinned (8562 / 33357 stay OFF), no | ||
| 89 | +`speed.rs` edit. | ||
| 90 | + | ||
| 91 | +## 6. Invariants | ||
| 92 | + | ||
| 93 | +Diff is doc comments only — no code path moves, so the shipped bytes are | ||
| 94 | +unchanged by construction. | ||
| 95 | + | ||
| 96 | +* `timeout 900 cargo check --workspace --all-targets -j4`: 0 errors, 0 ec-av1 | ||
| 97 | + warnings (the 21 ec-opus + 1 ec-vorbis warnings pre-date this lane). | ||
| 98 | +* `cargo test -p ec-av1 --release --lib` (detached): **569 passed; 0 failed; | ||
| 99 | + 45 ignored**, 858.8s — the expected totals exactly. | ||
| 100 | +* Pins 8562 / 33357 stay OFF and were not re-pinned (no arm passed). | ||