Lane-superres r6 report -- gate localized to last-column horz deblock edge, root cause deferred
Browse files at this commitf8ce07016ece206ee48e54329e9ab0e85a0ab228Parent: 397bfd7- docs
- lane-superres r6 report -- gate localized to last-column horz deblock edge, root cause deferred
1 changed file +87 -0
- lanes/superres-r6.report.md +87 -0
lanes/superres-r6.report.mdadded+87 -0
| @@ -0,0 +1,87 @@ | |||
| 1 | +VERDICT: PARTIAL -- r5's decode.rs work verified green, gate residue localized to a specific | ||
| 2 | +deblock edge, root cause not yet found (defer to r7). | ||
| 3 | + | ||
| 4 | +## Step 1: verify r5's uncommitted work | ||
| 5 | + | ||
| 6 | +`cargo check` clean, `cargo test -p ec-av1` (EC_AV1_REQUIRE_AOMENC=1, 600s timeout): 237 passed, | ||
| 7 | +1 failed (the known `a_real_aomenc_superres_key_frame_sequence_decodes_pixel_exact`, the gate | ||
| 8 | +this lane exists to close), 17 ignored. Nothing else regressed. No fix was needed -- working | ||
| 9 | +tree was clean at a69e1bd/3462632, so no commit was made for step 1 itself. | ||
| 10 | + | ||
| 11 | +## Step 2: use the rungs | ||
| 12 | + | ||
| 13 | +Reproduced the gate's exact failing stream (added `EC_SUPERRES_STREAM_DUMP` to the test, one | ||
| 14 | +run, one seed -- avoids the seeded-fixture-not-reproducible dead-end since it's now a captured | ||
| 15 | +file, not a re-rendered lavfi seed) and ran both oracle rungs plus our own matching decode.rs | ||
| 16 | +dumps (`EC_AV1_PREFILT_WIDE_DUMP` exists on both sides already; `EC_AV1_MARGIN_DUMP` is our own | ||
| 17 | +post-deblock+cdef dump, CDEF is off in this stream so it's a valid post-deblock comparison | ||
| 18 | +point) against frame 2 (the failing frame): | ||
| 19 | + | ||
| 20 | +- **Pre-deblock (`ours-prefilt.f2` vs `lib-prefilt.f2`): 0 diffs, byte-exact.** Reconstruction | ||
| 21 | + (predict+residual, all of coefficient decode) is proven correct for this frame including the | ||
| 22 | + whole margin region -- rules out mode/tx/coefficient decode as the cause. | ||
| 23 | +- **Post-deblock (`ours-margin.f2` Y vs `lib-postdeblock.f2` Y): 37 diffs, ALL in columns 44-47** | ||
| 24 | + (the coded frame's rightmost mi column, mi_c=11 of mi_cols=12, true_width=48) across rows | ||
| 25 | + 9-38ish. Nowhere else in the frame differs. | ||
| 26 | + | ||
| 27 | +This localizes the bug to `deblock_plane`'s horizontal-edge pass at the rightmost mi column. | ||
| 28 | +Traced the specific edges firing there (`EC_AV1_DEBLOCK_TRACE=1`): three horizontal edges per | ||
| 29 | +frame at x0=44, y0∈{16,32,48}, `len=14 level=5 sharpness=0`. Hand-reimplemented `filter14`'s | ||
| 30 | +flat-branch formula in Python against the bit-exact pre-deblock input at columns 44-47: it | ||
| 31 | +**exactly reproduces our own Rust decoder's output** (op2..oq2 match `ours-margin.f2` to the | ||
| 32 | +byte) -- our filter math is spec-correct and self-consistent. But **libaom's real post-deblock | ||
| 33 | +output at these exact samples equals the unfiltered pre-deblock input** -- libaom did not filter | ||
| 34 | +this edge at all, at 3 of the 4 columns in the group (col 44 happened to be a no-op already). | ||
| 35 | + | ||
| 36 | +## What's not yet found | ||
| 37 | + | ||
| 38 | +Read `av1_loopfilter.c`'s two candidate skip conditions (`curr_skipped = skip_txfm && | ||
| 39 | +is_inter_block`) -- both are INTER-only gates; this is a key frame (`--kf-max-dist=0`), so intra | ||
| 40 | +blocks never hit that suppression, and by the source's own logic this edge (nonzero level on an | ||
| 41 | +intra PU boundary, `pu_edge = mi_prev != mbmi` true) should still filter. To get ground truth | ||
| 42 | +instead of re-deriving the C by eye, patched two candidate real call sites | ||
| 43 | +(`set_lpf_parameters` and `set_one_param_for_line_luma`, in | ||
| 44 | +`~/.cache/aom-oracle/src/av1/common/av1_loopfilter.c`, rebuilt via `ninja -C | ||
| 45 | +~/.cache/aom-oracle/build aomdec`) with `EC_LF_TRACE`/`EC_LF_TRACE2` eprintln diagnostics gated | ||
| 46 | +on `mi_col==11` and `!is_vert` -- **neither ever fired** for this stream, meaning the real | ||
| 47 | +horizontal-edge loop-filter path for this exact column takes a THIRD, unlocated code path in | ||
| 48 | +libaom (a SIMD/quad-batch variant most likely, or a per-line-luma variant reached from a | ||
| 49 | +different fast path than the two I found via `grep set_lpf_parameters`). That third path is | ||
| 50 | +where the actual "why libaom doesn't filter here" answer lives -- I ran out of turn budget | ||
| 51 | +finding it. The libaom source patches are throwaway (in `~/.cache/aom-oracle/src`, not part of | ||
| 52 | +this repo, not committed) and can be re-applied/removed freely by r7; `scripts/build-aom-oracle.sh` | ||
| 53 | ++ `scripts/instrument-aom-oracle.sh` rebuild from clean if you want a pristine tree first. | ||
| 54 | + | ||
| 55 | +## Left in the repo (committed, `8ef70ff`) | ||
| 56 | + | ||
| 57 | +- `EC_SUPERRES_STREAM_DUMP` (stream.rs, the superres key-frame gate test): dumps the exact OBU | ||
| 58 | + bytes fed to aomenc/decode_stream to a file when set -- makes the gate's stream reproducible | ||
| 59 | + for oracle diffing without relying on lavfi seed determinism. | ||
| 60 | +- `EC_AV1_DEBLOCK_TRACE` (decode.rs, `deblock_plane`'s horizontal-edge loop): eprintln's | ||
| 61 | + `x0/y0/len/level/sharpness` when `x0==44` and `plane_idx==0` -- narrow and hardcoded to this | ||
| 62 | + investigation; r7 should widen or remove it once the real cause is found. | ||
| 63 | + | ||
| 64 | +Both are env-gated, off by default, zero behavior change to any existing test. | ||
| 65 | + | ||
| 66 | +## Step 3: inter-frame superres (spec 7.11.3.3) | ||
| 67 | + | ||
| 68 | +Not started -- all turn budget went to step 2's localization. Deferred to r7/next lane. | ||
| 69 | + | ||
| 70 | +## Refusal strings | ||
| 71 | + | ||
| 72 | +None added, renamed, or removed this round. | ||
| 73 | + | ||
| 74 | +## Merge | ||
| 75 | + | ||
| 76 | +Not attempted -- no time budget left to verify a `git merge main` cleanly after the above; left | ||
| 77 | +for r7 to decide, per charter's "consider `git merge main` here first" being conditional on | ||
| 78 | +budget. | ||
| 79 | + | ||
| 80 | +## Disposition | ||
| 81 | + | ||
| 82 | +- deferred: the actual libaom code path for the last-column horizontal edge -- unblocks with | ||
| 83 | + either `perf`/`gdb break set_lpf_parameters_for_line_luma` on the real aomdec binary while it | ||
| 84 | + decodes this exact stream (fastest: confirms which function body genuinely executes), or | ||
| 85 | + grep `av1_filter_block_plane_horz`/AVX2 variants under `av1/common/x86/av1_loopfilter_sse2.c` | ||
| 86 | + for a scalar-bypassing fast path. | ||
| 87 | +- deferred: stage 4 (inter-frame superres, scaled-reference MC) -- unstarted, whole stage. | ||