forge
Explore
Log in

Don't you dare go Hollow

Lane-superres r3 charter -- pin the real 43->64 scale case

Browse files at this commit

5dae35de0d7757901aa7e6e3a1068e5e22554250Ahmet Kaan GümüşParent: 018d991
  • docs
    • lane-superres r3 charter -- pin the real 43->64 scale case
Show full message
docs(av1): lane-superres r3 charter -- pin the real 43->64 scale case
lanes/superres-r3.charter.mdadded+71 -0
@@ -0,0 +1,71 @@
1+# lane-superres r3 — close the 5-pixel residue by pinning the REAL scale case
2+
3+Worktree `/home/user/Documents/Code/Rust/edith_codecs-superres`, branch
4+`lane-superres`, at 2022b4c. Read `lanes/superres.report.md` first — it is
5+short, accurate, and lists what r2 already ruled out. Do not re-derive it
6+(class `worker-cap-spent-reading`).
7+
8+## State
9+Landed and committed: refusal-by-name (79252c8), the spec 7.16 upscaler pinned
10+against real libaom (aec76d1), stage-3 wiring (150bbdc), and r2's two real
11+fixes (85c070b): the gate needed `--superres-kf-denominator=12` (libaom's
12+`--superres-denominator` only controls NON-key frames, and this fixture makes
13+every frame a key frame, so `use_superres` was silently decoding false), and
14+`decode.rs` cropped chroma with floor `fw / 2` where AV1 wants
15+`ROUND_POWER_OF_TWO(fw, 1)` — a real general decoder bug, swept across both
16+constructors of the cropped `Picture`.
17+
18+Still failing: `a_real_aomenc_superres_key_frame_sequence_decodes_pixel_exact`,
19+5 of 4096 luma pixels off by exactly 1, all at x in 59..62 of a 64-wide frame.
20+
21+## The decisive move, before any theory
22+r1 pinned the upscaler against libaom for **in8->out12 and in8->out16**. The
23+failing case is **43 -> 64**. A kernel pinned at two small symmetric ratios says
24+nothing about the phase/step arithmetic at the ratio that actually fails —
25+class `instrument-at-bound`: a search result at its own edge is not a result.
26+
27+So: extend `scripts/superres-pin-harness.c` (committed, builds against
28+`~/.cache/aom-oracle/build/libaom.a`) to run the EXACT failing case — input
29+width 43, output width 64, 8-bit, with the same row bytes our decoder holds at
30+the failing row — through the real exported
31+`av1_get_upscale_convolve_step` / `av1_convolve_horiz_rs_c` /
32+`av1_resize_filter_normative`, and print every output column. Compare column by
33+column with ours. That either localises the defect to a specific
34+`x_qn` / `int_pel` / `filter_idx` at x=59..62, or proves our kernel is right at
35+this ratio and moves the suspicion to what we feed it.
36+
37+Two specific things to check in that harness run, because they are where the
38+ratio matters:
39+- `x0_qn` initialisation (libaom `get_upscale_convolve_x0`) — the starting
40+ phase, which the symmetric ratios r1 pinned may make degenerate.
41+- The right-edge source clamp. r2's theory is that we edge-replicate from the
42+ cropped row where libaom uses a real decoded pixel. Note that libaom runs
43+ `av1_extend_frame_borders` before `av1_superres_upscale`, which replicates
44+ from column `y_crop_width - 1` — i.e. replication is probably RIGHT and the
45+ theory probably wrong. Let the harness settle it rather than the reasoning:
46+ feed it a row whose column 43+ differs from a replicate of column 42 and see
47+ whether the reference output changes at all.
48+
49+## Then
50+1. Fix whatever the harness localises; the gate must decode pixel-exact and
51+ hard-assert `superres_hits() > 0`. COMMIT.
52+2. Full scoped suite `EC_AV1_REQUIRE_AOMENC=1 nice -n 19 cargo test -p ec-av1 --lib -j4`,
53+ timeout >= 600000 ms. Baseline on this tree 232/0; main is at 234 with two
54+ new guard tests you inherit at merge. r2 never ran the suite after landing
55+ the `decode.rs` chroma-crop fix, so this run is also that fix's first real
56+ check. COMMIT.
57+3. Stage 4 — inter-frame superres, scaled-reference MC (spec 7.11.3.3, libaom
58+ `av1_setup_scale_factors_for_frame` / `av1_convolve_2d_scale`). Its own gate,
59+ its own firing counter, its own commit.
60+4. Update `lanes/superres.report.md`, VERDICT on the first line.
61+
62+## Hard rules
63+- `export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-superres`. Foreground
64+ builds, `nice -n 19 cargo ... -j4`; every `cargo test` gets a timeout of at
65+ least 600000 ms.
66+- Sibling worktrees (edith_codecs, -chroma, -realworld, -lr, -tiles, -palette)
67+ have live agents. Never build in or edit them.
68+- NEVER push, never merge, never touch `main`. Commit on `lane-superres` only.
69+- 75-turn cap and it does NOT reset on resume: commit at every green step, and
70+ commit the extended harness itself — it belongs in `scripts/`, not in a
71+ scratchpad that gets reaped (class `oracle-in-reaped-dir`).