From 798ed37af2e9a8ec1beb3f49ffd6333833295f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 21:35:26 +0300 Subject: [PATCH] docs(av1): lane-t900 r5 handoff -- per-plane warp bail-out and the 128-root second half's cdef literal --- lanes/t900-r5.handoff.md | 144 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 lanes/t900-r5.handoff.md diff --git a/lanes/t900-r5.handoff.md b/lanes/t900-r5.handoff.md new file mode 100644 index 00000000..0d2d587d --- /dev/null +++ b/lanes/t900-r5.handoff.md @@ -0,0 +1,144 @@ +# lane-t900 r5 handoff -- two root causes closed; 14 exact decode-order frames on the 900 s cut + +Branch `lane-t900`, tip `2e59d5a4` (3 commits this round, all on top of r4's +`28f176cb`). Worktree `edith_codecs-t900`. +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900-b` carries the release +`decode_probe`. Reproduction still needs BOTH `EC_INTRA128_IN_INTER=1` and +`EC_INTRA16X4_DECODE=1`. NO suite was run this round (turn cap) -- `cargo +build -p ec-av1 --release --example decode_probe` is clean, `cargo test` +UNRUN. That is the first thing the next round must do. + +## ROOT CAUSE 1 (`e9f287af`) -- the per-plane warp bail-out used the SQUARE side + +STEP 1 of the charter asked whether `mc::predict`'s kernel choice is wrong +for chroma of rect luma blocks. It is NOT. Measured, not assumed: + +* libaom `av1_get_interp_filter_params_with_block_size` (filter.h:247) takes + the X filter from `block_width` and the Y filter from `block_height` + (`init_interp_filter_params`, reconinter.h:169-181), `w <= 4` picking + `av1_interp_4tap[interp_filter]` -- and `av1_interp_4tap[MULTITAP_SHARP]` + is `av1_sub_pel_filters_4`, i.e. the regular 4-tap, exactly what + `InterpFilterKind::tables()` (mc.rs:183-190) already returns. +* our chroma calls already pass `kern_w = write_chroma_w = write_w / 2` + (decode.rs:19803), so an 8x16 luma block's chroma passes `kern_w = 4` and + takes the 4-tap horizontally / 8-tap vertically. Correct before this round. + +The real defect was one rung further down. `EC_MC_TRACE` on the first bad +block (`EC_IB px=728 py=96 side=16 w=8 h=16`, mi(24,182)) showed the block +is WARPED, not convolved: `EC_MC_WARP x=728 y=96 w=16 h=16` and +`EC_MC_WARP x=364 y=48 w=8 h=8` for chroma. libaom `av1_init_warp_params` +(reconinter.c:58-60) returns before setting `WARP_PRED` when +`inter_pred_params->block_height < 8 || block_width < 8`, and those are the +PLANE's own dims -- so in 4:2:0 the chroma of every luma block narrower or +shorter than 16 is predicted translationally while its luma warps. Every +warp site gated that on `chroma_side` (`side / 2`), which for an 8x16 or +16x8 luma block is 8 while the real chroma block is 4x8 / 8x4. + +Fix: `warp_plane_allowed(w, h)` (decode.rs, next to `cdef_idx_hits`) at all +5 chroma sites (single-ref + both compound taps for U and V) and the 3 luma +sites, reading `write_chroma_w/h` and `write_w/h`; a counter +`decode::warp_plane_suppress_hits()` counts every suppression (gate proof -- +NOT yet asserted anywhere, see BELOW). The luma half also matters: a +PARTITION_HORZ/VERT strip is `write_w x write_h`, so a 16x4 / 4x16 strip +under global motion warped where libaom does not. + +2-frame cut `~/.cache/inter128intra-tmp/t900_2.obu`, prefilter compare +(`~/.cache/t900-tmp/pf.sh` + `sb.py`): + +| | f0 | f1 Y | f1 U | f1 V | final (cmp.sh) | +|---|---|---|---|---|---| +| before | EXACT | 0 | 98 | 62 | 258 bytes | +| after | EXACT | 0 | **0** | **0** | **0 bytes, both frames EXACT** | + +## ROOT CAUSE 2 (`4261ea72`) -- the second 128-root HORZ/VERT half read no cdef_idx + +STEP 3's four 2 s cuts: `~/.cache/rectres-tmp/t900.obu` first differed at +decode-order frame 10. A 0.6 s re-cut `~/.cache/t900-tmp/t900_h.obu` +(`ffmpeg -c copy -t 0.6`, 16 decode-order frames) reproduces it. + +Localisation: first differing luma pixel px(192,0) of frame 10 = mi(0,48). +The `EC_MODE`-only greedy ladder (`~/.cache/t900-tmp/lad.py`, the r2 recipe +restricted to the ONE rung both decoders emit -- `EC_MODE_VAL` is NOT +comparable, aomdec prints it after the mv and we print it before the interp +filter) is exact through mi(0,32) and splits at mi(0,48): aomdec rng 40079, +ours 39850. The coefficient traces of the block in between are +IDENTICAL rung for rung and both end at rng 57521, so the divergence is in +the pre-mode symbols of the second half -- a literal, invisible to a value +ladder (class `literal-width-invisible-to-ladder`). + +libaom keeps `cdef_transmitted[4]`, one flag per 64x64 CDEF unit of a +128x128 superblock, indexed `(mi_col & 16) != 0 + 2 * ((mi_row & 16) != 0)` +(`read_cdef`, decodemv.c:50-81), reset only at the SB origin. Ours is a +single bool reset per coded piece; the INTER tile loop's 128-root HORZ/VERT +arm (decode.rs `sb128_rect`) was the one arm that never reset it between the +two halves -- the key-frame loop already did -- so the right half skipped a +`cdef_bits`-wide literal. + +Prefilter compare of the 16-frame cut, differing bytes per decode-order frame: + +| frame | 10 | 11 | 12 | 13 | 14 | 15 | +|---|---|---|---|---|---|---| +| before | 2316966 | 1746025 | 1307747 | 2161740 | 1914869 | 2164666 | +| after | **0** | **0** | **0** | **0** | 14 | 24 | + +frames 0..9 exact before and after. + +## FILM TABLE (decode-order compare, `~/.cache/t900-tmp/cmp.sh`, after both fixes) + +| cut | frames (aomdec/ours) | first differing frame | bytes there | bad frames | +|---|---|---|---|---| +| t900 2 s | 267 / 267 | **14** (was 10) | 32 | 234 | +| t5400 2 s | 275 / 275 | 1 | 794216 | 273 | +| t6300 2 s | 125 / 125 | 1 | 2674129 | 124 | +| t8100 2 s | 96 / 32 | 1 | 2027 | 31 + REFUSED "a Golomb tail longer than this decoder reads" at frame 32 | +| t900_2 (2 frames) | 2 / 2 | -- | -- | **0, fully exact** | + +## STEP 2 (modes_above_left sweep) -- NOT DONE + +No site was changed and no ladder was re-run for it: the two root causes +above consumed the round. The r4 table stands unchanged -- callers at +decode.rs 7813, 9656, 11178, 11839, 13059, 22499, 23664 are unswept (12162 +already wraps, 7668 was fixed in r4), and 7813 / 13059 feed the intra-mode +CDF row so they need the r2 rng ladder after any change. + +## STEP 4/5 (witness fixture, lifts, named gates, suite) -- NOT DONE + +Nothing was pinned, no refusal was lifted, no gate was written or run, and +the suite was not run. `warp_plane_suppress_hits()` exists but has NO +assert. Both fixes are currently proven only by the two cuts above. + +## EXACT NEXT STEP + +1. `cargo test -p ec-av1 --lib` (systemd unit form, COMMON's SUITE RUNS + recipe) -- the round's changes are UNVERIFIED against the suite. The + `cdef_transmitted` reset and the warp bail-out both touch shipped gates + (grep `warp`, `sb128`, `cdef` in stream.rs); the sibling-gate rule applies. +2. Pin a witness. `~/.cache/t900-tmp/t900_h.obu` (177773 bytes, 16 + decode-order frames, 15 shown) is the natural one for root cause 2 but + its frames 14/15 still differ -- cut it back to 14 decode-order frames + (`ffmpeg -c copy -t ~0.52`, hash twice) before pinning, or pin it and + assert only what is exact and say so. Counters to hard-assert: + `decode::warp_plane_suppress_hits()` (root cause 1), + `INTER_SB128_VERT_HITS` / `cdef_idx_hits()` (root cause 2). Gate shape: + copy `a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact` + (stream.rs:30240) -- fixture read, `decode_stream`, delta-counted + counter assert, all shown frames vs `ffmpeg_decode_sequence_10bit`. + `git add -f` under crates/ec-av1/fixtures/. +3. Next defect on this cut: decode-order frame 14, U plane ONLY, 14 samples + (f15: 24), all inside SB(4,7) px(896,512), first chroma sample (472,284) + = luma px(944,568) = mi(142,236). Our mode trace has that block as an + INTRA block inside an inter frame at 8-px granularity (mi cols 236, 238, + 239 on row 142) -- U-only with V exact smells like the CfL alpha or the + chroma DC of an intra-in-inter leaf. `~/.cache/t900-tmp/o14.mode` has the + trace; frame 14 is the second-to-last block group in it. +4. Then t5400 / t6300 / t8100 frame 1 (three separate defects, untouched), + and t8100's Golomb-tail refusal at frame 32. + +## Artifacts + +`~/.cache/t900-tmp/`: `t900_h.obu` (0.6 s 16-frame cut), `pf.sh` `cmp.sh` +`sb.py` `px.py` `reg.py` (as r4), NEW `lad.py` (EC_MODE-only greedy ladder, +prints last match + both sides' next line), `a10.mode`/`o10.mode`, +`a10.co`/`o10.co` (coefficient traces, 80 MB each), `a10.st` (aomdec +`EC_TRACE_MODE_STEP`, has the `motion_mode`/`interp` rungs), `o14.mode`, +`pf_t900h/`, `pf_t900_2/`, `d_t900/ d_t5400/ d_t6300/ d_t8100/`.