report(av1): lane-superres r4 -- verified f167362 compiles + 237/238 green, residue narrowed to deblock-vs-margin, not closed
Browse files at this commit461c34fd450c5715231a0b648b902df343fb97ffParent: ee923221 changed file +93 -0
- lanes/superres-r4.report.md +93 -0
lanes/superres-r4.report.mdadded+93 -0
| @@ -0,0 +1,93 @@ | ||
| 1 | +VERDICT: WIP -- f167362 verified compiling and 237/238 green; target gate still 2/4096 pixels off, root cause narrowed but not closed | |
| 2 | + | |
| 3 | +## What this round did | |
| 4 | +r3's work at f167362 was committed by the orchestrator at its 75-turn cap, | |
| 5 | +never seen to compile. Job one per the charter: verify it. | |
| 6 | + | |
| 7 | +- `cargo check -p ec-av1 --lib --tests`: clean (warnings only, no errors). | |
| 8 | +- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j4`: **237 passed, 1 | |
| 9 | + failed, 17 ignored**. The only failure is the target gate, | |
| 10 | + `a_real_aomenc_superres_key_frame_sequence_decodes_pixel_exact`. r3's two | |
| 11 | + landed fixes (superres-kf-denominator flag, chroma-crop rounding, and this | |
| 12 | + round's own margin-threading commit) cost nothing elsewhere -- no | |
| 13 | + regressions against the 232/0 baseline this tree started from. | |
| 14 | +- No code changes landed this round (all diagnostic instrumentation added | |
| 15 | + during investigation was reverted with `git checkout --` before finishing; | |
| 16 | + `git status` is clean at f167362). | |
| 17 | + | |
| 18 | +## The residue, narrowed | |
| 19 | +r3 closed 3 of 5 mismatched pixels with the wide-margin threading fix | |
| 20 | +(committed in f167362). The remaining 2 (frame 2, rows 17/18, output column | |
| 21 | +62 -- the `--superres-kf-denominator=12`, 43->64 gate) were traced further | |
| 22 | +this round: | |
| 23 | + | |
| 24 | +1. Dumped pre-deblock and post-deblock pixel values at columns 40-47 for | |
| 25 | + frame 2, rows 8-23 (temporary `eprintln`, reverted). The only edge that | |
| 26 | + touches these rows is a single horizontal deblock edge at `y0=16`, | |
| 27 | + `level=5`, category `len=14` (the wide-filter class), covering columns | |
| 28 | + 40-47 in two 4-column groups. | |
| 29 | +2. Hand-computed `filter8`'s flat-branch formula (`decode.rs`'s | |
| 30 | + `filter14`/`filter8`) against the dumped pre-deblock values for every | |
| 31 | + affected column (43, 44, 45) and every affected row (13-18) -- | |
| 32 | + **matched our own post-deblock output exactly in all cases tried**. The | |
| 33 | + tap-weight arithmetic itself is self-consistent with the spec 7.14.6.3/ | |
| 34 | + 7.14.6.4 formulas; no bug found there. | |
| 35 | +3. Confirmed the margin our decoder stashes for superres (`real_right` in | |
| 36 | + `upscale_row`) is exactly this same post-deblock data -- so if the | |
| 37 | + pre-deblock reconstruction and the deblock level/mask decision are both | |
| 38 | + correct, the margin is correct too. | |
| 39 | +4. Ruled out a false lead: swapping row 17's and row 18's *margin* arrays in | |
| 40 | + the pin harness (`scripts/superres-pin-harness.c`'s `row17-margin`/ | |
| 41 | + `row18-margin` cases) happens to reproduce ffmpeg's expected value for | |
| 42 | + both rows. This looked like a smoking-gun row-index swap, but the two | |
| 43 | + margins differ by at most 1 in any position (smooth gradient content) -- | |
| 44 | + entirely consistent with the *real* defect being a single-unit error | |
| 45 | + that happens to land near a rounding boundary shared by both rows, not | |
| 46 | + an actual row transposition. Src/margin pairing was independently | |
| 47 | + confirmed correct at the Rust level (both come from the same row `r` of | |
| 48 | + the same `y.data` buffer via the same `crop` closure). | |
| 49 | +5. Ruled out: CDEF (frame flags force `cdef.*_strength == 0`, `apply_cdef` | |
| 50 | + returns immediately); intra-prediction edge availability using the wrong | |
| 51 | + width (`frame_width` is never read inside `decode_key_frame_tile_with_cdfs` | |
| 52 | + except at the crop/margin-stash tail -- prediction always sees the true | |
| 53 | + mi-aligned width). | |
| 54 | + | |
| 55 | +## What's not yet ruled out | |
| 56 | +- The deblock **level** itself (`edge_params`'s `cur_level != 0 ? cur_level | |
| 57 | + : pv_level`, `decode.rs:3980`) for this specific margin-straddling edge -- | |
| 58 | + verified the *arithmetic* given `level=5`, not whether `5` is the level | |
| 59 | + real libaom computes for this edge. This logic already passes broader | |
| 60 | + deblock gates elsewhere (both intra and inter), so a narrow, edge-case-only | |
| 61 | + divergence (e.g. a block whose transform straddles `frame_width` itself) | |
| 62 | + is the remaining live suspect. | |
| 63 | +- The pre-deblock reconstruction at columns 44-47 (the block whose right | |
| 64 | + half falls in the margin) was hand-verified for internal consistency, not | |
| 65 | + against real libaom -- there is still no ground truth for the *pre-deblock* | |
| 66 | + row content, only for the final post-superres pixel (which is 2 rounding | |
| 67 | + steps downstream: deblock, then the upscale convolution). | |
| 68 | + | |
| 69 | +## Next step (needs libaom instrumentation, not more hand tracing) | |
| 70 | +Per r3's own charter fallback: build a small aomdec `EC_TRACE`-style patch | |
| 71 | +(matching the one already used for msac/partition tracing elsewhere in this | |
| 72 | +lane family) that dumps the post-deblock, pre-superres row content at | |
| 73 | +`frame_width..true_width` for a real decode of this fixture, and diff it | |
| 74 | +column-by-column against `decode.rs`'s stashed margin. That is the only | |
| 75 | +instrument that can distinguish "our level/mask decision is wrong" from | |
| 76 | +"our level/mask decision is right and the pre-deblock reconstruction is | |
| 77 | +wrong" -- hand-tracing the arithmetic (this round) cannot, since it can only | |
| 78 | +prove self-consistency, not correctness against libaom's real output. | |
| 79 | + | |
| 80 | +## Not reached | |
| 81 | +Stage 4 (inter-frame superres, spec 7.11.3.3) -- blocked on stage 3 closing | |
| 82 | +first, per both r3's and this charter's own ordering. Untouched this round. | |
| 83 | + | |
| 84 | +## Commands | |
| 85 | +- `cargo check -p ec-av1 --lib --tests` -- clean. | |
| 86 | +- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j4` -- 237 passed, 1 | |
| 87 | + failed (the target gate), 17 ignored, 193s. | |
| 88 | +- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib | |
| 89 | + a_real_aomenc_superres_key_frame_sequence -j4 -- --nocapture` -- FAILED, | |
| 90 | + same 2-pixel mismatch (frame 2, rows 17/18, col 62 of the upscaled output). | |
| 91 | + | |
| 92 | +## Refusal strings | |
| 93 | +None added, renamed or removed this round. |