# lane-t900 r10 -- the r9 top-right hunk was half a port; with libaom's rect shape refinements the 1080p cut's mode stream is exact for all 264 frames Tip on `lane-t900` (see git log). Suite: see below. ## STEP 0 -- verdict on the unverified r9 hunk `5c8ab7f2`: KEPT, but only after completing it Named gates at `6d2ba001` (before any r10 edit), unit `t900-named-r10b`: `128sb_film interintra hidden_arf rect64_corner_tus sub8 obmc mv_stack refusal_inventory gate_coverage` -> **34 passed, 0 failed, 1 ignored** (98.6 s, `$HOME/.cache/t900-named-r10.log`). So the r9 hunk reddened nothing. libaom, cited: `av1_findSamples` probes the top-right warp sample with `has_top_right(cm, xd, mi_row, mi_col, AOMMAX(xd->width, xd->height))` (`mvref_common.c:1235`) -- r9's premise is correct, and it is the ONLY place that uses the longer side for that probe in a way our port reaches (`mvstack::has_top_right` has exactly one caller, `decode::find_samples`; the mv-stack scan's own `bs = AOMMAX(w,h)` at `mvref_common.c:496` is served by the separate `top_right_scan_allowed`). For a 64x128 block `bs = 32`, and `has_top_right` returns 0 at once (`if (bs > mi_size_wide[BLOCK_64X64]) return 0`, `mvref_common.c:270`) -- so YES, libaom uses max(w,h) there and a 128-tall block gets no top-right warp sample. r9's mi(64,144) analysis stands. **Why it moved the divergence earlier**: our `has_top_right` port never carried libaom's two rect shape refinements (`av1_common_int.h:1419-1428`) is_last_vertical_rect = !((mi_col + width) & (height - 1)) [w < h] is_first_horizontal_rect = !( mi_row & (width - 1)) [w > h] which are applied AFTER the mask loop and only bite when `bw4 != bh4` -- i.e. exactly the blocks whose probe size r9 changed. Probing at the longer side without them is half a port. Root cause fixed in `b5e1cbde` (`crates/ec-av1/src/mvstack.rs:705-733`, call site `crates/ec-av1/src/decode.rs:18995`), NOT reverted. ## Result on the 10-bit 1920x792 264-frame cut (`~/.cache/t900-tmp/cut_900.obu`) | ladder | r9 tip `5c8ab7f2` | r10 tip | |---|---|---| | first EC_MODE divergence | frame 49, mi(24,376)->mi(24,380) | **none in 264 frames** | | mode-ladder opcodes vs aomdec | replace at frame 48 | 915 equal / 914 insert / **0 replace, 0 delete** | | frames differing vs aomdec | 218 of 267 (frame 49 alone 2.26 MB) | **36 of 267, 1-3 bytes each** | | first differing frame | 41 | 41 (the known r8 chroma-MC bottom-row clamp, 1 byte) | The 914 "insert" runs are lines only WE emit (per-sub-block EC_MODE prints where libaom prints once per block, and intra blocks in inter frames); every `(mi_row, mi_col, rng)` triple aomdec emits is matched in order. EVIDENCE: `~/.cache/t900-tmp/o900e.mode` + `a900.mode` | `python3 lad2.py a900.mode o900e_i.mode` (difflib over (frame,mi_row,mi_col,rng)) | Counter({'equal': 915, 'insert': 914}), first delete/replace: None EVIDENCE: `~/.cache/t900-tmp/d_r10_900/` | `bash cmp.sh r10_900 cut_900.obu` (aomdec EC_AV1_FINAL_DUMP vs ours, 267 decode-order frames) | 231/267 bit-exact, 36 differ by 1-3 bytes, worst frame 55 = 3 bytes ## STEP 2 -- witness gates * `crates/ec-av1/fixtures/gm_small_side_witness.obu`, **1158066 bytes**, sha256 `f1cdbcbb8d6d469c7957d70252ab42b24ab75f48a717600ffa25991458775dca` (truncated twice independently, identical hashes): first 50 frame-carrying OBUs of a 2 s 10-bit 1920x792 cut, 34 decode-order frames, 33 shown. It is the SMALLEST such prefix that fires `gm_nontrans_small_side` (N=49 fires 0, N=50 fires 1) and it is decode-exact: all 34 decode-order frames byte-identical to aomdec. New gate `a_10bit_film_frames_with_small_side_globalmv_and_rect_warp_reach_decode_pixel_exact` (`crates/ec-av1/src/stream.rs`): 33 shown frames vs ffmpeg on every plane, hard asserts `gm_nontrans_small_side_hits > 0` (1) and `tr_reach_longer_side_hits > 0` (2295). * The existing 128-SB witness gate now also hard-asserts `tr_reach_longer_side` (fires 600 on `reelc_sb128_inter_witness.obu`); `gm_nontrans_small_side` fires 0 there and on every other fixture in the repo, which is why the new fixture was needed. EVIDENCE: `~/.cache/t900-tmp/d_r10_t54w/` | `bash cmp.sh r10_t54w t54w_a.obu` | 34/34 decode-order frames exact, first differing frame: None EVIDENCE: `$HOME/.cache/t900-gm-r10.log` | `cargo test -p ec-av1 --lib -- small_side_globalmv 128sb_film gate_coverage refusal_inventory` | 14 passed, 0 failed, 51.46 s; gate prints "33 shown frames pixel-exact on every plane; gm_nontrans_small_side=1 tr_reach_longer_side=2295" ## Film / stream table at the r10 tip (`cmp.sh`, aomdec EC_AV1_FINAL_DUMP vs ours) | stream | decode | frames differing | first bad | worst | |---|---|---|---|---| | 10-bit 1080p cut @900s (267 f) | OK 264 shown | 36 | 41 | 3 bytes | | 10-bit 1080p head 0-10s (241 f) | OK 240 shown | 78 | 86 (2 bytes) | f130 1143 bytes | | 10-bit 1080p cut @5400s (275 f) | OK 273 shown | 134 | 61 (1 byte) | f113 1942 bytes | | 10-bit 1080p cut @6300s (125 f) | OK 122 shown | 86 | 11 (2 bytes) | ~6 bytes | | 10-bit 1080p cut @8100s (96 f) | OK 95 shown | 18 | 66 (2 bytes) | ~4 bytes | | 10-bit 2160p head 0-10s, 148-OBU prefix (100 f) | OK 97 shown | **1** | 88 (221 bytes) | 221 bytes | No stream refuses. Every remaining 1-6 byte residue sits on a block/frame BOTTOM edge (the r8 chroma-MC clamp class). ## Open residue * fix-now(next round): 2160p decode frame 88 of the 0-10 s head -- 221 bytes, 218 luma + 3 chroma, ALL in picture rows 1593-1607 / chroma rows 799-801 (the last rows of 1608). It is the only frame in that 100-frame prefix that is not exact and the only one whose header carries `lr=[Sgrproj, Sgrproj, Sgrproj]` on the luma plane -- prime suspect is the self-guided restoration's last stripe at the frame bottom, NOT the chroma-MC clamp. Independent of the r9/r10 warp work (the N=147 prefix, which fires no gm hit, shows the same 221 bytes). * deferred(a round of its own): the 1000+ byte walls at 1080p head f130 and @5400 f113 -- unmeasured this round. * accepted: the 1-3 byte bottom-edge chroma-MC clamp residue (r8, class `reach-is-per-transform-unit` neighbours), unchanged this round. * corner-cut: libaom's third `has_top_right` refinement (the PARTITION_VERT_A bottom-left square) still not ported -- needs the parent partition type threaded into `mvstack::has_top_right`; ceiling + upgrade path in its doc comment. ## Class fixed on the way: ffmpeg pipe deadlock in every gate helper `ffmpeg_decode_sequence_10bit` (and 6 sibling helpers, one shape, in `stream.rs` x2, `decode.rs` x2, `tile.rs` x1, `encode.rs` x2) wrote the whole stream to ffmpeg's stdin INLINE and only then read stdout. With a 1.1 MB fixture that decodes to ~150 MB the stdout pipe fills first and both processes park at 0% CPU -- the new gate sat there for 45 minutes before I killed it (`ps` showed `ffmpeg -f obu -i -` at 0.0% and the test binary at 2.5%). All 7 now write on their own thread. Same run afterwards: **51.5 s**. EVIDENCE: `$HOME/.cache/t900-gm-r10d.log` | same test command as the 45-min hang | `test result: ok. 14 passed; 0 failed` in 51.46 s ## Suite `cargo test -p ec-av1 --lib` (unit `t900-suite-r10`, log `$HOME/.cache/t900-suite-r10.log`): **427 passed, 0 failed, 38 ignored**, 718.4 s -- r6 baseline was 426/0/38, the +1 is this round's new gate.