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