# lane-av1-444sb — the 128-rect 4:4:4 chroma-span desync: NAMED and FIXED (r2) ## Outcome 1. REMEASURED first (pinned fixture `crates/ec-av1/fixtures/444_sb128rect_lr_witness.obu`, sha256 `27825e14633a4b23e37d48a2acdc7f5d814ca4fadd0b8797d72a1ffb34061e80`, generated per the report recipe: `ffmpeg -i bands444.y4m -frames:v 3 -vf scale=192:160 -pix_fmt yuv444p -f yuv4mpegpipe` piped to `aomenc --codec=av1 --profile=1 --passes=1 --end-usage=q --cq-level=32 --cpu-used=0 --threads=1 --row-mt=0 --sb-size=128 --lag-in-frames=0 --auto-alt-ref=0 --kf-max-dist=1000 --i444 --enable-restoration=1 --obu --limit=3`): at 76f8c3fe frame 0 diverges at EC_AV1_PREFILT_DUMP with Y 9700 @ (128,64), U 12272 @ (160,0), V 13175 @ (128,0) — the ticket's class (first diffs on the 64/128 grid, chroma columns 160/128 matching the finding). The synthetic-content variants tried first (testsrc2, testsrc, smptebars, mandelbrot, gradients × cpu-used × cq) all decode frame 0 exact — the damage needs an edge-forced 128-root rect, which real content provides. 2. DEFECT 1 (this lane's, FIXED) — **`decode_block_128rect`'s chroma unit walk is hardcoded to the 4:2:0 mu-chunk span**. One 32x32 chroma unit per 64x64 mu chunk per plane (`cn = 32 / chroma_tx` = 1), chunk offsets `ch_col * 32` / `ch_row * 32`, and a per-chunk clip step of `ch_col * 8`: all three are the 4:2:0 numbers. At 4:4:4 a 64x64 luma chunk covers 64 chroma pixels and needs TWO 32x32 units per axis. The units never pushed (measured by env-gated per-unit exec tracing): (160,0),(160,32) of the 64x128 PART_VERT block at (128,0), all four units of its second chunk, (64,128),(96,128) of the bottom-row 128x64 — exactly the PREFILT damage cells. Because the missing units' coefficients are still in the bitstream, the entropy decoder desyncs from the first 128-rect intra block on: SB(0,0) decodes byte-exact and every later superblock of frames 0/1 carries damage. 3. FIX (one site, decode.rs `decode_block_128rect`): per-chunk unit count `(64 >> ss) / chroma_tx`, chunk chroma offsets `64 >> ss`, clip step `16 >> ss` — every expression reduces to the old constant at ss=1, so 4:2:0 is bit-identical by construction; the stale `debug_assert!` (which stated the 4:2:0 invariant and would fire on 444 in debug builds) now states the ss-aware one. 4. DEFECT 2 (fixed by CHERRY-PICK, not this lane's code) — after DEFECT 1's fix the review still failed frames 1-2: frame 1 U/V full rows 54 and 118 +-1 — the LR boundary-band signature. `lane-av1-422filter`'s e3798a34 (LR boundary-band snapshot ss_y + CDEF conv422 remap) was NOT in this branch's ancestry; cherry-picked as 168442bd. Frame 1 went byte-exact. An r1 experiment had concluded the cherry-pick "changed nothing on 444" — that conclusion was an artifact of a broken comparison (see 6) and is retracted. 5. DEFECT 3 (NAMED, NOT FIXED — stop-with-site) — frame 2 still diverges at FINAL: Y 7308 / U 9685 / V 14012 vs aomdec, deterministic. Stage ladder: PREFILT, POSTDEBLOCK and POSTCDEF are byte-exact vs the oracle; the damage is introduced by the LOOP RESTORATION stage, and its shape is **LR stripe 0 (RU row 0, rows 0..63, full width, all three planes) is never restored** — our final equals the post-CDEF plane above row 63 (our LR-changed rows start at 63; the oracle's start at 0), while stripes 1-2 are restored (imperfectly vs the oracle only through the reference shift this induces in rows above? no: rows 64..159 also still differ — the stripe-0 skip is the dominant, first-introduced defect; stripe delta details in the r2 measurement notes). Site: the pipelined LR band accounting — `pipe_run_lr`'s `rrows: Some` branch (restoration.rs) refills only the RU rows its caller passes, and the band release (`ls.note(k - 2)` / `ls.close(nb, false)`, decode.rs filter pipeline ~25000-25032) never flushes RU row 0 on this frame — the frame whose top superblock row carries a 128-root rect block (f2's inter 64x128 at (128,0); f0's 128-rects sit on the keyframe path and f1 codes no 128-root rect, which is why only f2 shows it). Fixing the flush is its own scoped change; asserting f2's current samples in a gate would pin the bug. 6. MEASUREMENT-METHOD CORRECTION (r1's false "all frames exact"): the r1 final comparisons sliced the raw YUV with a plane-stride instead of a frame-stride, so every "fN vs aomdec" row actually compared row 0 of plane N — frame 2 was never truly compared and the 0-diff results were an illusion. All r2 numbers above come from per-frame strided slices (92160 bytes/frame), cross-checked against BOTH aomdec and ffmpeg, with the binary's provenance pinned by a fresh-target-dir sha256 match (incremental `Finished` in <2s does NOT imply a rebuild; `cargo clean -p` without error checking can silently no-op — twice caught this wave). ## Verification - `cargo check -p ec-av1`: 0 warnings, 0 errors (target `$HOME/.cache/cargo-target-av1444sb`). - New pinned gate (this commit): `a_444_sb128_root_rect_stream_with_restoration_decodes_pixel_exact` — pins the fixture by length + FNV1a64, proves non-vacuity via the `decode::intra_sb128_hits` delta, and asserts frames 0/1 byte-exact against BOTH the oracle aomdec and ffmpeg (frame 2 = DEFECT 3, named in the test body; pinning its current samples would freeze the bug). - Gates green with fix + cherry-pick (EC_AV1_REQUIRE_AOMENC=1): `a_real_aomenc_stream_with_restoration_reads_lr_symbols_correctly`, `a_superres_key_frame_with_cdef_and_loop_restoration_decodes_pixel_exact`, `a_non_420_subsampled_sequence_header_is_refused_by_name`, `a_real_aomenc_stream_with_a_skipped_8x8_intra_leaf_whose_tx_split_ decodes_pixel_exact` — 4 passed. ## Decision - DEFECT 1: one site, fixed. `decode_block_128rect` serves the kf PART128 HORZ/VERT and AB arms plus the intra-in-inter 128 path (`in_inter` flag) — one walk, all callers covered. - DEFECT 2: fixed upstream-of-merge by cherry-pick (168442bd), kept. - DEFECT 3: STOP-WITH-SITE per charter — the LR stripe-0 flush on inter frames whose top SB row carries a 128-root rect. Named function/lines above; the stage-dump evidence (PC exact, FINAL wrong, delta rows 63+) is in the r2 notes. - NOT touched: `sub8_leaf_chroma444`'s rect arm (sibling lane, distinct open defect), `decode_leaf8` OOB (leaf8oob's), the 4:2:0 group-tail chroma SKIP arm (reserved), `read_coeffs_rect`. - Temp EC_TRACE_444SB / EREAD_RECT / TEMP-444SB instrumentation removed before commit; the commits carry only the fix, the assert, the gate and the reports. ## State - Commits on lane-av1-444sb (no push): 349b3918 (DEFECT 1 fix + fixture + r1 report), 168442bd (cherry-pick of e3798a34), this commit (DEFECT 3 named, gate added/scoped, r2 report).