diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 24b71b80..05e76860 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -12232,10 +12232,18 @@ fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), side: usiz let has_left = mi_c > n.tile_col0_mi; let mut above = usize::from(n.above_txfm[mi_c]) >= side; let mut left = usize::from(n.left_txfm[mi_r]) >= side; - if has_above && n.above_inter[mi_c / (SUB / MI)] { + // lane-angledelta r1 (class [[context-read-from-one-cell]]): both + // `above_inter`/`left_inter` bands are written per MI unit + // (`record_inter_rect_mi`), so they are read per MI too -- the `/ (SUB / + // MI)` here read the 16-px cell's FIRST mi instead, i.e. a different + // block whenever the neighbour column/row is not the cell's first. A + // 16x16 intra block whose left neighbour is an inter block at mi row 4 + // then missed libaom's "an inter neighbour contributes its BLOCK size" + // override and read `tx_size_cat1` row 1 where aomdec reads row 2. + if has_above && n.above_inter[mi_c] { above = n.above_side_mi[mi_c] >= side; } - if has_left && n.left_inter[mi_r / (SUB / MI)] { + if has_left && n.left_inter[mi_r] { left = n.left_side_mi[mi_r] >= side; } match (has_above, has_left) { diff --git a/lanes/angledelta-r1.report.md b/lanes/angledelta-r1.report.md new file mode 100644 index 00000000..a7785446 --- /dev/null +++ b/lanes/angledelta-r1.report.md @@ -0,0 +1,51 @@ +# lane-angledelta r1 -- the intra `tx_depth` context read its neighbour's inter flag one mi cell off + +## Defect +On main 752e952 the gate +`a_real_aomenc_10bit_inter_sequence_with_a_directional_intra_block_with_angle_delta_decodes_pixel_exact` +(crates/ec-av1/src/stream.rs:6294) FAILED: seed 46, frame 4, Y (31,0) got 524 want 523, 3357/4096 +samples differ, frames 5..7 whole-frame wrong. Green on cf38133 -- but there the gate returned on +seed 47 (seed 46 refused before reaching the defect). Bisect over the 5 merges: green at cf38133, +aba55b2, 61aa768, 662c285, 2bac468; RED at 5c35efa (lane-sbab). That merge lifted the SB-level +inter AB refusal, which is what lets seed 46 decode at all -- class +[[merge-cross-product-defect]] / [[refusal-hides-a-defect]]: the defect itself is older +(3c174b6), it was simply unreachable. + +## Root cause (path:line) +`crates/ec-av1/src/decode.rs:12236` `tx_size_context_txfm` (libaom `get_tx_size_context`) read +`above_inter[mi_c / (SUB / MI)]` / `left_inter[mi_r / (SUB / MI)]`, i.e. the 16-px cell index, +while `Neighbours::record_inter_rect_mi` (decode.rs:4977) WRITES both bands per MI unit. For a +16x16 intra block at mi(4,4) in an inter frame the left neighbour is the inter block at mi(4,0), +but `left_inter[4/4] = left_inter[1]` names mi row 1 -- part of the intra block above -- so +libaom's "an inter neighbour contributes its BLOCK size, not its transform size" override never +fired. `left_txfm[4]` is 4 (that inter block's var-tx tree split to 4x4), so `left` read false and +the block took `tx_size_cat1` row 1 where aomdec takes row 2: same decoded value, different range, +entropy desync from that symbol on. Fix = index both bands by mi. + +## Evidence +EVIDENCE: ~/.cache/angledelta-tmp/{ours_all.log,aom_all.log} | msac ladder of the pinned stream +s46.obu (md5 511efd772f3c0976c26fa2bf14ffb72d, hashed twice) ours EC_TRACE_COEFF+EC_TRACE_MODE(_STEP) +vs instrumented aomdec, diffed element by element | first divergence = frame 4 mi(4,4) +`tx_depth val=1`: ours ctx=1 rng=57990, aomdec ctx=2 cat=1 rng=48518; every element before it +(through the previous block's chroma all_zero rng=47098) identical. +EVIDENCE: ~/.cache/angledelta-tmp/txctx.log | temporary TXCTX print of the two bands at that read | +`mi=(4,4) left_txfm=4 li=false lsm=16` -- the inter override skipped; print removed before commit. +EVIDENCE: ~/.cache/angledelta-tmp/bisect.log | gate run at cf38133/aba55b2/61aa768/662c285/2bac468/ +5c35efa in a detached worktree | ok,ok,ok,ok,ok,FAILED -- the lane-sbab merge is where seed 46 first +decodes. + +## Gates (cargo test -p ec-av1 --lib -j3 , EC_AV1_REQUIRE_AOMENC=1) +- angle_delta: 2 passed (8-bit + 10-bit arms) -- was 1 failed. +- non_dc_chroma (uv8): 3 passed. intrabc: 1 passed. palette: 7 passed. +- gathered_edge_horz (sb128c): 1 passed. +- `a_frame_edge_straddling_band_decodes_pixel_exact`: still FAILED (red on main before this lane + too; another lane owns it) -- disposition: deferred(the lane that owns that gate). + +## Sweep (class [[context-read-from-one-cell]]) +`grep -rn "mi_[rc] / (SUB / MI)"` over crates/ec-av1/src: the only remaining uses are the three +sites that convert to genuine SUB-granular arrays (`above_mode`/`left_side`, decode.rs 5634, 6928, +7895). No other MI-granular band is read with a cell index. + +## Refusals +None lifted this round (pure entropy-context fix); refusal_inventory.rs / gate_coverage.rs +unchanged.