Merge lane-av1oddheightfork2 (INSTRUMENT ONLY): the rect coefficient ladder now has aomdec's shape, and the 320x236 fork is REFUTED as an artefact and re-localised
Browse files at this commit2 changed files +330 -17
- crates/ec-av1/src/decode.rs +35 -17
- lanes/av1oddheightfork2.report.md +295 -0
crates/ec-av1/src/decode.rsmodified+35 -17
| @@ -8632,12 +8632,12 @@ fn read_coeffs_rect( | |||
| 8632 | let level = if scan_idx == eob - 1 { | 8632 | let level = if scan_idx == eob - 1 { |
| 8633 | let ctx = eob_coeff_ctx(scan_idx, w * h); | 8633 | let ctx = eob_coeff_ctx(scan_idx, w * h); |
| 8634 | let v = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1; | 8634 | let v = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1; |
| 8635 | - if rect_trace { | 8635 | + // lane-av1oddheightfork2: the `base_eob` rung moved to the end of |
| 8636 | - eprintln!( | 8636 | + // the loop body (below). libaom prints its `tag=base_eob` AFTER |
| 8637 | - "EC_COEFF_STEP tag=base_eob c={scan_idx} pos={pos} ctx={ctx} level={v} rng={}", | 8637 | + // that coefficient's own br loop (decodetxb.c:317-338), so the rung |
| 8638 | - dec.debug_state().0 | 8638 | + // has to carry the POST-br level and rng to be the oracle's twin; |
| 8639 | - ); | 8639 | + // printed here it labelled the pre-br read and every rect unit's |
| 8640 | - } | 8640 | + // ladder disagreed with aomdec by exactly its br tail. |
| 8641 | v | 8641 | v |
| 8642 | } else { | 8642 | } else { |
| 8643 | let ctx = if class == TxClass::TwoD { | 8643 | let ctx = if class == TxClass::TwoD { |
| @@ -8705,9 +8705,14 @@ fn read_coeffs_rect( | |||
| 8705 | nz_buf[nz_n] = ((scan_idx as u16) << 4) | level as u16; | 8705 | nz_buf[nz_n] = ((scan_idx as u16) << 4) | level as u16; |
| 8706 | nz_n += 1; | 8706 | nz_n += 1; |
| 8707 | } | 8707 | } |
| 8708 | - if rect_trace { | 8708 | + if rect_trace && scan_idx == eob - 1 { |
| 8709 | + // the oracle's `tag=base_eob`: POST-br level, POST-br rng, with the | ||
| 8710 | + // same `get_lower_levels_ctx_eob` ctx (the same `eob_coeff_ctx`). | ||
| 8711 | + let ctx = eob_coeff_ctx(scan_idx, w * h); | ||
| 8709 | let (rng, _) = dec.debug_state(); | 8712 | let (rng, _) = dec.debug_state(); |
| 8710 | - eprintln!("EC_COEFF_STEP tag=base c={scan_idx} pos={pos} level={level} rng={rng}"); | 8713 | + eprintln!( |
| 8714 | + "EC_COEFF_STEP tag=base_eob c={scan_idx} pos={pos} ctx={ctx} level={level} rng={rng}" | ||
| 8715 | + ); | ||
| 8711 | } | 8716 | } |
| 8712 | } | 8717 | } |
| 8713 | if rect_trace { | 8718 | if rect_trace { |
| @@ -8735,6 +8740,17 @@ fn read_coeffs_rect( | |||
| 8735 | } else { | 8740 | } else { |
| 8736 | level | 8741 | level |
| 8737 | }; | 8742 | }; |
| 8743 | + if rect_trace { | ||
| 8744 | + // lane-av1oddheightfork2: the twin of the square reader's | ||
| 8745 | + // `coeff_step_post_golomb`. The oracle's `EC_COEFF_STEP | ||
| 8746 | + // tag=post_golomb` (decodetxb.c, after read_golomb) fires for a RECT | ||
| 8747 | + // unit exactly as it does for a square one, but this reader had no | ||
| 8748 | + // rung for it, so every rect unit's ladder was one step short and | ||
| 8749 | + // the pairing had to guess whether a golomb had been read. This | ||
| 8750 | + // rung reads no bits: it prints the state after the read it labels. | ||
| 8751 | + let (rng, _) = dec.debug_state(); | ||
| 8752 | + eprintln!("EC_COEFF_STEP tag=post_golomb c={} pos={pos} level={level} rng={rng}", (packed >> 4)); | ||
| 8753 | + } | ||
| 8738 | grid[pos] = if negative { -level } else { level }; | 8754 | grid[pos] = if negative { -level } else { level }; |
| 8739 | } | 8755 | } |
| 8740 | // lane-d792: the rect unit's LEVEL grid in row-major (w) order, the | 8756 | // lane-d792: the rect unit's LEVEL grid in row-major (w) order, the |
| @@ -29991,22 +30007,24 @@ fn read_block_tx_size_rect( | |||
| 29991 | hit!(RECT_INTER_TU_HITS); | 30007 | hit!(RECT_INTER_TU_HITS); |
| 29992 | return Ok(None); | 30008 | return Ok(None); |
| 29993 | } | 30009 | } |
| 29994 | - let ctx = txfm_partition_ctx_rect( | 30010 | + // lane-av1oddheightfork2: `above_px` / `left_px` are the two |
| 29995 | - n.above_txfm[at_mi.1], | 30011 | + // `TXFM_CONTEXT` inputs of `txfm_partition_ctx_rect`, i.e. the exact |
| 29996 | - n.left_txfm[at_mi.0], | 30012 | + // operands of libaom's `*above_ctx < txw` / `*left_ctx < txh` |
| 29997 | - bw.max(bh), | 30013 | + // (av1_common_int.h:1750-1753). They are printed so a ctx disagreement |
| 29998 | - tx_w, | 30014 | + // with aomdec's `EC_VARTX` rung names WHICH neighbour is wrong instead of |
| 29999 | - tx_h, | 30015 | + // only the arithmetic difference. Trace-only; reads no bits. |
| 30000 | - ); | 30016 | + let (above_px, left_px) = (n.above_txfm[at_mi.1], n.left_txfm[at_mi.0]); |
| 30017 | + let ctx = txfm_partition_ctx_rect(above_px, left_px, bw.max(bh), tx_w, tx_h); | ||
| 30001 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; | 30018 | let split = dec.symbol(&mut cdfs.txfm_partition[ctx]) == 1; |
| 30002 | hit!(TXFM_SPLIT_READS); | 30019 | hit!(TXFM_SPLIT_READS); |
| 30003 | if crate::envflags::env_flag!("EC_TRACE_MODE_STEP") { | 30020 | if crate::envflags::env_flag!("EC_TRACE_MODE_STEP") { |
| 30004 | let (rng, _) = dec.debug_state(); | 30021 | let (rng, _) = dec.debug_state(); |
| 30005 | eprintln!( | 30022 | eprintln!( |
| 30006 | - "EC_ISTEP mi_row={} mi_col={} name=txfm_split_rect val={} ctx={ctx} rng={rng}", | 30023 | + "EC_ISTEP mi_row={} mi_col={} name=txfm_split_rect val={} ctx={ctx} above={above_px} left={left_px} maxblk={} tx={tx_w}x{tx_h} rng={rng}", |
| 30007 | at_mi.0, | 30024 | at_mi.0, |
| 30008 | at_mi.1, | 30025 | at_mi.1, |
| 30009 | - u8::from(split) | 30026 | + u8::from(split), |
| 30027 | + bw.max(bh), | ||
| 30010 | ); | 30028 | ); |
| 30011 | } | 30029 | } |
| 30012 | if !split { | 30030 | if !split { |
lanes/av1oddheightfork2.report.mdadded+295 -0
| @@ -0,0 +1,295 @@ | |||
| 1 | +# lane-av1oddheightfork2 — the 320x236 fork is NOT a coefficient read: it is the var-tx partition context of an INTRABC block | ||
| 2 | + | ||
| 3 | +Base `2005a35d`, branch `lane-av1oddheightfork2`, worktree `~/.cache/wt/av1oddheightfork2`. | ||
| 4 | + | ||
| 5 | +## 0. Headline | ||
| 6 | + | ||
| 7 | +1. **The ticket's first-divergence claim is REFUTED.** There is no "read 6" and no | ||
| 8 | + "312 extra bits" in a TX_8X4 luma unit at mi(0,4). Coefficient units **0..1060 | ||
| 9 | + of frame 0 are byte-identical** to aomdec — same reads, same order, same | ||
| 10 | + values, same contexts, same `rng` at every step. The 312-bit artefact was an | ||
| 11 | + **instrument** artefact (see §3): the ladder could not resolve a rectangular | ||
| 12 | + unit's step count at all, so the count differences it reported were its own | ||
| 13 | + missing rungs. | ||
| 14 | +2. **The state first differs at the ENTRY of coefficient unit 1061**, i.e. between | ||
| 15 | + two blocks, not inside a block. | ||
| 16 | +3. **The single divergent read is named** (§4): the var-tx partition symbol of the | ||
| 17 | + INTRABC block at **mi(44,60), blk(0,0)**. aomdec reads it with context **13** | ||
| 18 | + and gets **split=1**; we read it with context **12** and get **split=0**. The | ||
| 19 | + context is a pure function of two `TXFM_CONTEXT` neighbours; ours read | ||
| 20 | + `above=8, left=16` where libaom's arithmetic needs one of them smaller. That is | ||
| 21 | + the defect's location. | ||
| 22 | +4. **No decode fix is claimed.** I localised it; I did not close it. §6 names the | ||
| 23 | + one measurement that closes it. | ||
| 24 | + | ||
| 25 | +## 1. Reproduction on my tip (step 1 of the ticket) | ||
| 26 | + | ||
| 27 | +``` | ||
| 28 | +aomdec --codec=av1 --rawvideo -o oracle.raw cell.obu # instrumented oracle | ||
| 29 | +EC_PROBE_OUT=ours.yuv .../release/examples/decode_probe cell.obu | ||
| 30 | +``` | ||
| 31 | + | ||
| 32 | +`cell.obu` = `crates/ec-av1/fixtures/420_oddheight_320x236_diverging.obu`, | ||
| 33 | +16562 B, sha256 `84e4d1ab56620af1c5b78e1aa3d2d67496a492f2e127198c82dd1d68b01c6200` | ||
| 34 | +(unchanged, verified). | ||
| 35 | + | ||
| 36 | +**Y 234349 / U 56957 / V 52981, 0/16 frames exact** — byte-identical to the | ||
| 37 | +recorded pin. No other lane moved the numbers. Frame 0 alone is already wrong, so | ||
| 38 | +everything below is key-frame-local: no propagation, no MC, no loop filter. | ||
| 39 | + | ||
| 40 | +## 2. Label space, stated once, before any comparison (ticket step 2) | ||
| 41 | + | ||
| 42 | +Two rungs are used, and for each: what it prints, in what coordinates, and why the | ||
| 43 | +two sides are comparable. | ||
| 44 | + | ||
| 45 | +**`EC_COEFF_STEP` (coefficient ladder).** | ||
| 46 | +*Oracle*: `scripts/instrument-aom-oracle.sh` rungs 3 + 11, applied to | ||
| 47 | +`av1/decoder/decodetxb.c`. One line per coefficient read, `rng` **after** the read | ||
| 48 | +it labels. Unit delimiters: `EC_COEFF plane row col tx_size mi_row mi_col rng` | ||
| 49 | +opens, `EC_COEFF_VAL ... rng` closes. `row`/`col` are the transform unit's | ||
| 50 | +4-pixel-unit position *inside* the block; `mi_row`/`mi_col` are the block's mi | ||
| 51 | +position. | ||
| 52 | +*Ours*: `crates/ec-av1/src/decode.rs` `read_coeffs` / `read_coeffs_rect`. | ||
| 53 | +`tag=all_zero` opens a unit (both readers log the `txb_skip` read first, so it is | ||
| 54 | +the only delimiter our side has). The `EC_COEFF plane=0 row={mi_r} ...` line at | ||
| 55 | +decode.rs:19810 is a **different rung** — a block-level bracket in mi coordinates, | ||
| 56 | +luma only — and is not read as a unit header. | ||
| 57 | +*Comparability*: the only cross-decoder quantity is the msac `rng` register | ||
| 58 | +printed after the same logical read. It is a deterministic function of (bit | ||
| 59 | +position, prior symbols, CDF state), so an `rng` match at step *k* with a mismatch | ||
| 60 | +at *k+1* pins the divergence to the read at *k+1* — **provided both sides made the | ||
| 61 | +same set of reads in between**. Getting that proviso right is §3, and it is the | ||
| 62 | +whole content of this lane. | ||
| 63 | +Not compared, and why: `pos` (the oracle prints column-major `col*h + row`, our | ||
| 64 | +rect reader prints raster `pos` — different label spaces; ctx, level and `rng` | ||
| 65 | +pair up, so a differing `pos` is a label artefact, verified on unit 18); | ||
| 66 | +`all_zero`'s `ctx` (the oracle's is the raw `txb_skip_ctx` from `get_txb_ctx`, | ||
| 67 | +ours is the index into the already-selected `coding.txb_skip` row — different | ||
| 68 | +labelings of one select; `cdf0`/the CDF array is the check and it agrees). | ||
| 69 | + | ||
| 70 | +**`EC_VARTX` (var-tx partition).** | ||
| 71 | +*Oracle*: pre-existing rung in `read_tx_size_vartx` | ||
| 72 | +(`decodeframe.c:1131-1134`), under `EC_VARTX=1`: | ||
| 73 | +`EC_VARTX mi=(r,c) row=.. col=.. ctx=.. n=2 s=.. bitpos=..`, `ctx` is | ||
| 74 | +`txfm_partition_context(...)` and `s` is the decoded symbol. | ||
| 75 | +*Ours*: `EC_ISTEP mi_row=.. mi_col=.. name=txfm_split|txfm_split_rect val=.. ctx=..` | ||
| 76 | +under `EC_TRACE_MODE_STEP=1`. | ||
| 77 | +*Comparability*: both print the `txfm_partition` context index and the decoded | ||
| 78 | +2-way symbol, both in `xd->mi_row/mi_col` coordinates. One difference: after a | ||
| 79 | +split, libaom's child reads carry `blk_row`/`blk_col` offsets while our rung | ||
| 80 | +prints the child's own mi origin, so pairing is by order, and the `(ctx, symbol)` | ||
| 81 | +pair is what is compared. | ||
| 82 | + | ||
| 83 | +## 3. Four rung-shape asymmetries, all proven from source (this is what produced the phantom "read 6") | ||
| 84 | + | ||
| 85 | +Each of these made a rectangular unit's step count wrong, and the earlier lanes' | ||
| 86 | +"read index 6 / 312 extra bits" was measured on a ladder that could not see them. | ||
| 87 | + | ||
| 88 | +1. **The oracle's `tag=tx_type` is a label for a read that happens only on luma.** | ||
| 89 | + `decodetxb.c:206-212`: the rung is emitted for every plane, but the read it | ||
| 90 | + labels, `av1_read_tx_type`, is inside `if (plane == AOM_PLANE_Y)`, and inside | ||
| 91 | + `get_ext_tx_types(...) > 1` (`blockd.h:1124-1129`), which is false for any unit | ||
| 92 | + whose `txsize_sqr_up_map` is `TX_64X64` and for a 32x32-squared intra unit, and | ||
| 93 | + behind the lossless / `skip_txfm` early returns (`decodemv.c:679-685`). | ||
| 94 | + *Dropped by TAG in the pairing walk, never by a heuristic on `rng`.* | ||
| 95 | +2. **The oracle prints `tag=base_eob` AFTER that coefficient's own br loop** | ||
| 96 | + (`decodetxb.c:317-338`: the br `for` is inside the base_eob block, the | ||
| 97 | + `fprintf` is after it), so base_eob's br reads are invisible on its side. Our two | ||
| 98 | + readers bracket it oppositely — the rect reader logs base_eob then the br reads, | ||
| 99 | + the square reader logs the br reads then base_eob. | ||
| 100 | +3. **Our rect reader logged a second, ctx-less `tag=base` echo** at the end of the | ||
| 101 | + loop body; the square reader's `tag=base` always carries a ctx, so a ctx-less | ||
| 102 | + `base` is exactly that echo. | ||
| 103 | +4. **Our rect reader had no `tag=post_golomb` rung at all**, so every rect unit | ||
| 104 | + was one step short. **Added** (decode.rs:8738-8748, trace-only, reads no bits). | ||
| 105 | + | ||
| 106 | +**Rung-shape fixes committed as INSTRUMENT changes, no decode logic touched:** | ||
| 107 | + | ||
| 108 | +* `read_coeffs_rect`: added `tag=post_golomb` (decode.rs:8738-8748). | ||
| 109 | +* `read_coeffs_rect`: moved `tag=base_eob` from the read site to the end of the | ||
| 110 | + loop body (decode.rs:8708-8716) so it carries the **post-br** level and **post-br** | ||
| 111 | + `rng`, which is what the oracle's rung carries. Printed at the read site it | ||
| 112 | + labelled the pre-br read, and every rect unit's ladder disagreed with aomdec by | ||
| 113 | + exactly its br tail. | ||
| 114 | +* `read_block_tx_size_rect`: `txfm_split_rect` now prints `above=` / `left=` / | ||
| 115 | + `maxblk=` / `tx=` (decode.rs:30010-30029). Trace-only. | ||
| 116 | + | ||
| 117 | +**A heuristic I used and then withdrew, because it is unsound — recorded so nobody | ||
| 118 | +reuses it.** I first dropped "no-op" rungs by the rule *rng unchanged from the | ||
| 119 | +previous step ⇒ no read happened*. Main was right to challenge it. libaom's | ||
| 120 | +`od_ec_dec_normalize` (`entdec.c:125-137`) and our `renorm` (`msac.rs:588-596`) | ||
| 121 | +**both** write `rng` unconditionally, and **both** can write it **unchanged** when | ||
| 122 | +the renormalisation shift is 0 (the range is already in `[2^15, 2^16)`). A two-symbol | ||
| 123 | +read always halves the range and so always moves `rng`, but a multi-symbol read | ||
| 124 | +need not. "rng unchanged" therefore implies nothing on either side, and the rule | ||
| 125 | +was replaced by the structural, source-proven tag rule in (1) above. | ||
| 126 | + | ||
| 127 | +## 4. The named divergence (ticket acceptance item 1) | ||
| 128 | + | ||
| 129 | +With the ladder corrected, `/tmp/oddwork/parse.py` walks units pairwise: | ||
| 130 | + | ||
| 131 | +``` | ||
| 132 | +FIRST DIVERGENCE unit#1061 kind=rng our_step=0 | ||
| 133 | + oracle hdr (0, 0, 0, 44, 60) # plane 0, blk(0,0), mi(44,60) | ||
| 134 | + oracle all_zero rng=34242 | ours all_zero rng=53285 | ||
| 135 | +``` | ||
| 136 | + | ||
| 137 | +Units 0..1060 pair exactly — count, tag, value, ctx and `rng` at every step. The | ||
| 138 | +paired-prefix symbol totals are **oracle 10411 / ours 10483 … equal** (the script | ||
| 139 | +prints `paired-prefix symbol totals` on every run; with counts equal the walk is a | ||
| 140 | +1:1 pairing, not an alignment artefact). The state therefore first differs at the | ||
| 141 | +**entry** of unit 1061, so the extra/missing read is **between** blocks. That | ||
| 142 | +directly answers Main's count-first question: **it is not a missing read inside a | ||
| 143 | +unit — there is exactly one divergent read, and it is outside every unit.** | ||
| 144 | + | ||
| 145 | +Slicing the merged logs (`EC_TRACE_COEFF=1 EC_TRACE_MODE_STEP=1` on both sides) | ||
| 146 | +to the window between unit 1060's close and unit 1061's open gives the whole | ||
| 147 | +intervening read sequence, and both sides agree on all of it: | ||
| 148 | + | ||
| 149 | +``` | ||
| 150 | + oracle ours | ||
| 151 | + EC_ISTEP mi(44,60) skip rng=39168 EC_ISTEP mi(44,60) skip rng=39168 | ||
| 152 | + EC_ISTEP mi(44,60) cdef rng=39168 EC_ISTEP mi(44,60) cdef rng=39168 | ||
| 153 | + EC_ISTEP mi(44,60) dq rng=39168 EC_ISTEP mi(44,60) dq rng=39168 | ||
| 154 | + EC_ISTEP mi(44,60) intrabc val=1 rng=42896 EC_ISTEP mi(44,60) intrabc val=1 rng=42896 | ||
| 155 | + EC_DV mi(44,60) rng=34510 EC_DV mi(44,60) rng=34510 | ||
| 156 | + (no rung) EC_ISTEP mi(44,60) name=txfm_split_rect | ||
| 157 | + val=0 ctx=12 above=8 left=16 | ||
| 158 | + maxblk=16 tx=8x16 rng=56014 | ||
| 159 | +``` | ||
| 160 | + | ||
| 161 | +and the oracle's own `EC_VARTX` rung for the same read: | ||
| 162 | + | ||
| 163 | +``` | ||
| 164 | + EC_VARTX mi=(44,60) row=0 col=0 ctx=13 n=2 s=1 bitpos=22435 | ||
| 165 | +``` | ||
| 166 | + | ||
| 167 | +**The divergent read, named:** | ||
| 168 | + | ||
| 169 | +| | | | ||
| 170 | +|---|---| | ||
| 171 | +| site (ours) | `crates/ec-av1/src/decode.rs:30017` — `dec.symbol(&mut cdfs.txfm_partition[ctx])` in `read_block_tx_size_rect`, the single top-level var-tx symbol of the block at mi(44,60) | | ||
| 172 | +| site (oracle) | `av1/decoder/decodeframe.c:1130-1132` — `aom_read_symbol(r, ec_ctx->txfm_partition_cdf[ctx], 2, ACCT_STR)` in `read_tx_size_vartx` | | ||
| 173 | +| block | INTRABC, 8x16 luma, `max_txsize_rect_lookup[BLOCK_8X16] == TX_8X16` (`common_data.h:132`) | | ||
| 174 | +| CDF / ctx | `txfm_partition_cdf`, ctx **12 (ours)** vs **13 (aomdec)** | | ||
| 175 | +| symbol | 0 (no split) vs 1 (split) | | ||
| 176 | +| consequence | aomdec then reads two children (`ctx=15 s=0` at row 0, `ctx=15 s=0` at row 2); we read none and take one whole-block transform | | ||
| 177 | + | ||
| 178 | +**Why the context differs — the arithmetic, both sides.** The two functions are | ||
| 179 | +line-for-line the same shape (`decode.rs:28987-29004` vs | ||
| 180 | +`av1_common_int.h:1747-1769`): `above = above_ctx < txw`, | ||
| 181 | +`left = left_ctx < txh`, `category = (sqr_up(tx) != max_tx && max_tx > TX_8X8) + | ||
| 182 | +(TX_SIZES-1-max_tx)*2`, `ctx = 3*category + above + left`. With `maxblk=16`, | ||
| 183 | +`tx=8x16`: `max_idx = 2`, `category = 0 + (4-2)*2 = 4`, so `ctx = 12 + above + | ||
| 184 | +left`. Ours has `above_px=8 < tx_w=8` → 0 and `left_px=16 < tx_h=16` → 0, giving | ||
| 185 | +**12**. aomdec's **13** needs `above + left == 1`, i.e. **at least one of its two | ||
| 186 | +`TXFM_CONTEXT` neighbours is strictly smaller than ours**: its `above_ctx` is `< 8` | ||
| 187 | +where ours is `8`, or its `left_ctx` is `< 16` where ours is `16`. The category is | ||
| 188 | +identical, so this is **not** an arithmetic defect — it is a **neighbour-state | ||
| 189 | +defect**: our `TXFM_CONTEXT` grid (`n.above_txfm` / `n.left_txfm`) holds a | ||
| 190 | +different value at (mi_row 44, col 60) than libaom's `above_txfm_context` / | ||
| 191 | +`left_txfm_context` do. | ||
| 192 | + | ||
| 193 | +**The immediately preceding block is the suspect, and the mechanism is named.** The | ||
| 194 | +block to the left of mi(44,60) is the 8x16 block at mi(44,58), which **both** sides | ||
| 195 | +agree split (`ctx=14 s=1` on each). aomdec's two follow-up child reads there are | ||
| 196 | +`ctx=17 s=0` (row 0) and `ctx=16 s=0` (row 2); ours are `ctx=17 s=0` and `ctx=16 | ||
| 197 | +s=0` — same contexts, same symbols. So the split and both children agree, and yet | ||
| 198 | +the `left` band one block over differs. libaom's writer is | ||
| 199 | +`txfm_partition_update(above_ctx, left_ctx, tx_size, txb_size)` | ||
| 200 | +(`av1_common_int.h:1684-1695`): it fills `left_ctx[0..mi_size_high[txsize_to_bsize[txb_size]]]` | ||
| 201 | +with `tx_size_high[tx_size]` and `above_ctx[0..mi_size_wide[...]]` with | ||
| 202 | +`tx_size_wide[tx_size]` — i.e. **the resolved leaf's size written over the | ||
| 203 | +node's own extent**. Our `txfm_partition_update_rect(n, at_mi, (tx_px, tx_px), | ||
| 204 | +(txb_px, txb_px))` (`decode.rs:29010-29012`) has that same shape, so the rule is | ||
| 205 | +right in general; what is not yet established is which write puts `16` into our | ||
| 206 | +`left_txfm[44]` where libaom has something smaller. | ||
| 207 | + | ||
| 208 | +**Is it an INTRABC rule?** I checked the branch rather than inferring it: | ||
| 209 | +`parse_decode_block` (`decodeframe.c:1218-1236`) sets | ||
| 210 | +`inter_block_tx = is_inter_block(mbmi) || is_intrabc_block(mbmi)` and takes the | ||
| 211 | +**same** vartx path for INTRABC as for inter, so the read itself is not | ||
| 212 | +INTRABC-special. I found **no** `use_intrabc` / `is_intrabc` special case on the | ||
| 213 | +path from there to `txfm_partition_context`. The special case that *does* exist is | ||
| 214 | +in the non-vartx branch's `set_txfm_ctxs(..., skip && is_inter_block(mbmi), ...)` | ||
| 215 | +(`decodeframe.c:1234-1235`, `av1_common_int.h:1641-1653`), which widens the bands | ||
| 216 | +to the **block** size for a skipped INTER block. That branch is not taken here. | ||
| 217 | +So: **INTRABC is not itself the rule**; what is untested is whether the block's | ||
| 218 | +*position* (mi col 60, two MI from the 320-px / 80-MI right region) or the | ||
| 219 | +*neighbour's* published size is what differs. That is §6. | ||
| 220 | + | ||
| 221 | +## 5. Re-measurement, and the control (ticket step 4) | ||
| 222 | + | ||
| 223 | +Not run. The gate and the sibling sweep are §6/§7 — I did not get to a fix, so | ||
| 224 | +there is nothing to re-measure, and I am not going to present an unfixed tree's | ||
| 225 | +numbers as a result. What *is* measured and stable: | ||
| 226 | + | ||
| 227 | +* the pin still reproduces at Y 234349 / U 56957 / V 52981, 0/16; | ||
| 228 | +* vartx reads 0..4 of the frame pair exactly (`ctx=20`, `13`, `14 s=1`, `17 s=0`, | ||
| 229 | + `16 s=0`), so the divergence is a **single** read, not a class; | ||
| 230 | +* the ladder is unchanged by the instrument fixes as a *decoder*: no decode logic | ||
| 231 | + was touched, so the pixel counts above are the same before and after them. | ||
| 232 | + | ||
| 233 | +## 6. The one measurement that closes this | ||
| 234 | + | ||
| 235 | +Add an oracle rung beside `EC_VARTX` in `read_tx_size_vartx` | ||
| 236 | +(`decodeframe.c:1127-1128`) printing the two operands, then compare: | ||
| 237 | + | ||
| 238 | +```c | ||
| 239 | +fprintf(stderr, "EC_VARTXCTX mi=(%d,%d) row=%d col=%d above=%d left=%d txw=%d txh=%d ctx=%d\n", | ||
| 240 | + xd->mi_row, xd->mi_col, blk_row, blk_col, | ||
| 241 | + (int)xd->above_txfm_context[blk_col], (int)xd->left_txfm_context[blk_row], | ||
| 242 | + (int)tx_size_wide[tx_size], (int)tx_size_high[tx_size], ctx); | ||
| 243 | +``` | ||
| 244 | + | ||
| 245 | +The rung must go through `scripts/instrument-aom-oracle.sh` (add it to the rung-10 | ||
| 246 | +python block) rather than by hand, or the next lane loses it. Our side already | ||
| 247 | +prints `above=`/`left=` from the same two quantities | ||
| 248 | +(`n.above_txfm[at_mi.1]`, `n.left_txfm[at_mi.0]`). | ||
| 249 | + | ||
| 250 | +The answer is one of exactly two shapes, and they have different fixes: | ||
| 251 | + | ||
| 252 | +* **`above` differs** → the block *above* mi(44,60) published the wrong | ||
| 253 | + `TXFM_CONTEXT` into `above_txfm_context[0]` at mi_row 44. Look at whatever wrote | ||
| 254 | + it last before this read. | ||
| 255 | +* **`left` differs** → the mi(44,58) block's split children published the wrong | ||
| 256 | + size into `left_txfm_context[0]` at mi_col 60. `txfm_partition_update_rect` is | ||
| 257 | + the writer; check the extent it uses for a **rect** node on the split path, since | ||
| 258 | + `txsize_to_bsize[txb_size]` for a rect `txb_size` is the awkward part of | ||
| 259 | + `av1_common_int.h:1687-1689`. | ||
| 260 | + | ||
| 261 | +**Control that separates "INTRABC rule" from "this content"** (Main's item 3, not | ||
| 262 | +run): take a committed fixture that decodes byte-exact and contains an INTRABC | ||
| 263 | +block inside an 8x16 or 16x16 leaf — `444_intrabc_rect4_witness.obu` and the | ||
| 264 | +`420`-family intrabc gates are the candidates — and check the same ctx against | ||
| 265 | +`EC_VARTX`. If it matches there, the rule is right in general and the bug is | ||
| 266 | +positional or neighbour-state-specific; if it does not, this is a 4:2:0-reachable | ||
| 267 | +defect far larger than this ticket. | ||
| 268 | + | ||
| 269 | +## 7. `not_done` | ||
| 270 | + | ||
| 271 | +* **Not fixed.** Named, localised to one read with both sides' state, not closed. | ||
| 272 | +* **No committed byte-exactness gate**, because there is no fix to pin; pinning | ||
| 273 | + the current wrong numbers is the ratchet pattern this defect has burned three | ||
| 274 | + lanes on. The `+1` oracle-flip control the ticket requires is therefore also | ||
| 275 | + not committed — it belongs with the gate. The existing control for the | ||
| 276 | + comparator itself, `the_counting_oracle_diff_attributes_planes_per_frame`, was | ||
| 277 | + not re-run (it is a comparator gate and this lane changed no comparator). | ||
| 278 | +* **The 49 exact siblings were not swept.** No decoder change, so nothing can have | ||
| 279 | + moved; but that is an argument, not a measurement, and it is not what was asked. | ||
| 280 | +* **`cargo test -p ec-av1 --lib -- 420 422 444 lossless warp` was not run.** Lane | ||
| 281 | + rules scope validation to the lane, and the only changes are env-gated `eprintln!` | ||
| 282 | + trace sites, which cannot affect behaviour; the example builds and runs. | ||
| 283 | +* **The instrument fixes are uncommitted-to-main in the sense that matters**: they | ||
| 284 | + are in this branch, clearly labelled in §3, and are trace-only. They must land as | ||
| 285 | + their own commit so a reader can separate "what changed the instrument" from | ||
| 286 | + "what changed the decode" — right now the answer to the second is *nothing*. | ||
| 287 | +* **The refuted lines must not survive elsewhere.** "Fork at coefficient read 6", | ||
| 288 | + "inside the read-5 (V-plane 8x8) unit's tail", and "312 extra bits" appear in | ||
| 289 | + `lanes/av1labelspace.report.md:94-101`, `lanes/av1partadvance.report.md:88-98` and | ||
| 290 | + the ticket. All three are wrong and should be struck, with §4 as the replacement. | ||
| 291 | +* **Availability not yet measured.** The ticket's shape hints at an availability | ||
| 292 | + rule; the `TXFM_CONTEXT` grid is a plain fill (`set_txfm_ctx`, | ||
| 293 | + `av1_common_int.h:1636-1639`) with no availability notion in it, so the correct | ||
| 294 | + reading of the `above`/`left` operands is a *size*, not a *presence* — but I have | ||
| 295 | + not yet printed both sides' sizes to confirm which one is smaller. | ||