forge
Explore
Log in

Don't you dare go Hollow

Lane-rectwire r1 charter (wire rect transforms into decode)

Browse files at this commit

8775a262a53e932bfcb85aa449682d07ab446765Ahmet Kaan GümüşParent: 384a874
  • docs
    • lane-rectwire r1 charter (wire rect transforms into decode)
Show full message
docs(av1): lane-rectwire r1 charter (wire rect transforms into decode)
lanes/rectwire-r1.charter.mdadded+74 -0
@@ -0,0 +1,74 @@
1+# lane-rectwire r1 charter — wire the rectangular transform into decode.rs
2+
3+## Where you are
4+Worktree /home/user/Documents/Code/Rust/edith_codecs-rectwire, branch
5+lane-rectwire @ main (6e54e47).
6+Build/test ONLY:
7+ `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-rectwire CARGO_BUILD_JOBS=4 nice -n 19 cargo test -p ec-av1 --release --lib <name> -- --nocapture`
8+FOREGROUND, EC_AV1_REQUIRE_AOMENC=1 on gates. Never push. Never touch the main
9+checkout or the sibling -gm worktree. WIP COMMIT after every green milestone.
10+
11+## The primitive already exists — do not rebuild it
12+lane-recttx landed the rectangular inverse transform this lane consumes:
13+`transform.rs::inverse_transform_2d_typed_wh(dequant, w, h, bit_depth, tx_type)`
14+and `dequant_and_inverse_typed_wh`, with `quant.rs::dequant_wh` beside them.
15+All 14 rect sizes are pinned by checksum against real libaom kernels
16+(`transform.rs::tests::rect_sizes_pinned_against_libaom`) and the square path
17+is proven bit-identical. Read `lanes/recttx-r1.report.md` first. The transform
18+MATH is done; this lane is the decode-side wiring it named as still owed.
19+
20+## What is missing (the report's own list)
21+1. **Rectangular scan order.** Only square zig-zag/diagonal tables are wired.
22+ libaom's scan tables live in `~/.cache/aom-oracle/src/av1/common/scan.c`
23+ (`av1_default_scan_<w>x<h>` and the class/`av1_scan_orders` table).
24+2. **Rectangular eob context.** The `get_eob_ctx` family is keyed on a square
25+ tx size class today; libaom keys it on the real tx size
26+ (`av1/common/txb_common.h`, `av1/decoder/decodetxb.c`).
27+3. **`max_txsize_rect_lookup` threading** through partition and tx-size
28+ selection, so a rect block asks for its real tx size instead of a square
29+ approximation.
30+
31+## Two refusals this is meant to lift, in priority order
32+- `decode.rs`'s refusal of every INTER partition below 16x16 (grep
33+ "an inter partition below 16x16"). This is why the 8x8-OBMC gate has never
34+ fired one 8x8 OBMC block in 80 attempts, despite the encoder writing them
35+ constantly.
36+- The intra HORZ/VERT strips' skip-only restriction (grep "a non-skip HORZ/VERT
37+ intra strip"), and the strip refusal in screen-content frames beside it.
38+
39+Lifting EITHER one with pixel-exact evidence is a good round. Do not attempt
40+both if the first is not clean — a partial landing that refuses precisely is
41+worth more than a wide one that decodes wrong.
42+
43+## Traps this repo has already paid for — read these before you start
44+- **Cross-axis scan weights.** A scan weight or step can use the CROSS axis
45+ where libaom says so; square candidates hide every axis swap. Sweep a WxH
46+ case together with its HxW twin in the SAME test, always.
47+- **A reference's layout is not the spec's.** libaom's coefficient buffer is
48+ column-major; ours is row-major. Transpose at the boundary, never in our
49+ code, or a real axis bug gets cancelled by a transposed harness.
50+- **A new tx size threads more surfaces than you expect** — scan, eob, context
51+ derivation, the tx-set tables. Grep the reference for every indexed surface
52+ and sweep them in ONE round rather than discovering them one desync at a time.
53+- **Adapting CDF four-site wiring**: struct field, defaults, save/restore,
54+ per-frame counter reset. A table missing from the counter reset has the right
55+ values and the wrong adaptation rate, and desyncs only after many reads.
56+
57+## Method
58+Refuse-by-name first, decode second: it is always acceptable to read every
59+symbol correctly and refuse the reconstruction by name. A desync is not
60+acceptable. On any pixel mismatch, self-pin with
61+`EC_AV1_GATE_DUMP=/tmp/claude-1000/rectwire-flake-N.obu`, then localize by
62+comparing the msac RANGE (never `tell()` — baselines differ by fixed constants
63+between decoders) from our `EC_AV1_TRACE` output against the instrumented
64+`~/.cache/aom-oracle/build/aomdec` under `EC_TRACE=1`. Ranges equal up to the
65+bad block means a prediction defect; ranges diverging means a consumption
66+defect. Do NOT guess-fix.
67+
68+## Done criteria
69+Full lib suite stays 226 passed / 0 failed. At least one of the two refusals
70+narrowed or lifted with pixel-exact evidence, and the gate that proves it
71+fires and HARD-ASSERTS its firing count (a gate that cannot fire the feature it
72+names measures nothing — the 8x8-OBMC gate is the cautionary example).
73+REPORT `lanes/rectwire-r1.report.md`, VERDICT on the FIRST line, with the
74+before/after refusal counts and the firing count.