Lane-superres r7 report -- gate closed, deblock clip is the root cause
Browse files at this commit0642e9cd69d2c0ff82aa391255d2387aa972f9d2Parent: 81df735- docs
- lane-superres r7 report -- gate closed, deblock clip is the root cause
1 changed file +89 -0
- lanes/superres-r7.report.md +89 -0
lanes/superres-r7.report.mdadded+89 -0
| @@ -0,0 +1,89 @@ | ||
| 1 | +VERDICT: CLOSED -- the superres gate is pixel-exact; charter hypothesis 1 was the root cause. | |
| 2 | + | |
| 3 | +## What was tested | |
| 4 | + | |
| 5 | +Charter hypothesis 1: "libaom clips the deblock loop to the coded frame's width, our | |
| 6 | +`true_width`/`true_height` (mi-aligned, `mi_cols*4`/`mi_rows*4`) includes a padding | |
| 7 | +margin libaom never filters." Confirmed on the first try -- did not need hypothesis 2 | |
| 8 | +(margin vs replicated-border upscaler feed) or the gdb dispatch hunt. | |
| 9 | + | |
| 10 | +## Fix | |
| 11 | + | |
| 12 | +`crates/ec-av1/src/decode.rs`: `deblock_plane` (and its caller `apply_deblock`) now take | |
| 13 | +`frame_width`/`frame_height` and bound their `x0`/`y0` loops by | |
| 14 | +`plane.true_width.min(cw)` / `plane.true_height.min(ch)` where `cw`/`ch` are the coded | |
| 15 | +frame's own dimensions (`frame_height.div_ceil(2)` for chroma, matching the 4:2:0 | |
| 16 | +subsampling this decoder assumes), instead of always looping the full mi-aligned | |
| 17 | +`true_width`/`true_height`. Both call sites (`decode_key_frame_tile_with_cdfs`, | |
| 18 | +`decode_inter_frame_tile_with_cdfs`) updated to pass `frame_width as usize, frame_height | |
| 19 | +as usize`. | |
| 20 | + | |
| 21 | +## Ground truth, not just gate-green | |
| 22 | + | |
| 23 | +Read libaom's `set_lpf_parameters` (`av1/common/av1_loopfilter.c:224`) while removing the | |
| 24 | +throwaway trace lines there (see Housekeeping below) and found the actual normative | |
| 25 | +check directly: | |
| 26 | + | |
| 27 | +```c | |
| 28 | +const uint32_t width = plane_ptr->dst.width; | |
| 29 | +const uint32_t height = plane_ptr->dst.height; | |
| 30 | +if ((width <= x) || (height <= y)) { | |
| 31 | + // just return the smallest transform unit size | |
| 32 | + return TX_4X4; | |
| 33 | +} | |
| 34 | +``` | |
| 35 | + | |
| 36 | +`plane_ptr->dst.width`/`height` is the destination plane's coded width/height (the same | |
| 37 | +quantity our `frame_width`/`frame_height` already carries), not the mi-grid-padded | |
| 38 | +extent. This is the third dispatch path r6 was hunting for with `EC_LF_TRACE`/ | |
| 39 | +`EC_LF_TRACE2` at `set_lpf_parameters`/`set_one_param_for_line_luma` -- both traces r6 | |
| 40 | +added never fired because they were placed *after* this early return already skipped | |
| 41 | +the block; the trace at line 298 (inside `set_lpf_parameters`, guarded on | |
| 42 | +`edge_dir==HORZ_EDGE && x==44`) sat downstream of this `if`, so it correctly never | |
| 43 | +printed for x=44 once x exceeded `plane_ptr->dst.width` -- r6's "neither candidate | |
| 44 | +fires" was itself the evidence for hypothesis 1, not a dead end (class | |
| 45 | +`equal-range-means-unread`, per the charter). | |
| 46 | + | |
| 47 | +## Verification | |
| 48 | + | |
| 49 | +- `cargo check -p ec-av1`: clean. | |
| 50 | +- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib stream::tests::a_real_aomenc_superres_key_frame_sequence_decodes_pixel_exact -- --nocapture`: | |
| 51 | + `3 frames pixel-exact, superres_hits=3` -- **PASS** (was the lane's one failing gate | |
| 52 | + since r5). | |
| 53 | +- `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1` (full crate, 600s timeout): **238 | |
| 54 | + passed, 0 failed, 17 ignored** -- no regression from the clip (the mi-alignment | |
| 55 | + margin only ever held decode scratch space beyond the coded picture; nothing else | |
| 56 | + reads or filters it). | |
| 57 | + | |
| 58 | +Commit: `f64f5cd` on `lane-superres` (this worktree). | |
| 59 | + | |
| 60 | +## Housekeeping | |
| 61 | + | |
| 62 | +r6's throwaway `EC_LF_TRACE`/`EC_LF_TRACE2` `fprintf` diagnostics in | |
| 63 | +`~/.cache/aom-oracle/src/av1/common/av1_loopfilter.c` (lines 298-301, 714-717) removed -- | |
| 64 | +their placement (downstream of the early-return this round found) is itself part of the | |
| 65 | +evidence above, so they are recorded in this report rather than folded into | |
| 66 | +`scripts/instrument-aom-oracle.sh` as a permanent rung; the oracle source tree is back to | |
| 67 | +a pristine, uncommitted state. Not rebuilt (`ninja`) this round since nothing further | |
| 68 | +needed the oracle binary -- `scripts/build-aom-oracle.sh` will produce a clean build from | |
| 69 | +this source on next use, no stale trace code left behind. | |
| 70 | + | |
| 71 | +## Refusal strings | |
| 72 | + | |
| 73 | +None added, renamed, or removed this round. | |
| 74 | + | |
| 75 | +## Merge | |
| 76 | + | |
| 77 | +Not attempted -- turn budget went to landing and verifying the fix + housekeeping. Left | |
| 78 | +for the next lane; charter's "consider `git merge main` here" is conditional on budget | |
| 79 | +and main has moved substantially (per r6's merge note) since `92d8beb`. | |
| 80 | + | |
| 81 | +## Disposition | |
| 82 | + | |
| 83 | +- deferred: `git merge main` (charter's note: multi-tile decode, CDEF index, chroma | |
| 84 | + modes, `bit_depth != 8` refusal, three reworded partition refusals, three guard tests | |
| 85 | + landed there since 92d8beb) -- next lane in this worktree, or whoever picks this branch | |
| 86 | + up, should merge and re-run the full `ec-av1` suite before anything further. | |
| 87 | +- deferred: Stage 4, inter-frame superres (spec 7.11.3.3, scaled-reference MC, | |
| 88 | + `av1_setup_scale_factors_for_frame` / `av1_convolve_2d_scale`) -- unstarted, whole | |
| 89 | + stage, per charter's "Then" section. |