ec-av1: lane-av1422mi24 -- the t422 inter ladder continued from the mi(24,60) first divergence: the first divergent symbol is the mi(24,56) 16x16 inter block's U dc_sign (ours dc_sign_cdf[0], oracle row 1; every level read around it matches rng-for-rng, so the SCAN placement is correct -- the codebase's row-major SCAN_8X16/SCAN_16X8 and libaom's column-major default_scan_8x16/16x8 enumerate identical (row,col) orders, verified cell by cell); root cause is the ctxgather lane's per-mi chroma gather class at ss (1,0) in three more block classes: decode_inter_block's block around (single-TU and var-tx arms, square + rect_tu), decode_rect_split's chroma_tiled else branch (the 16x8 intra-in-inter strip's (8,8) chroma unit at mi(26,60) read its U dc_sign one row high) and its unsplit single-TU arm, and decode_intrabc_rect's two chroma gathers (unreachable on the pinned fixture, gated-only verification); all edits gated ss_x==1 && ss_y==0 with the other arm verbatim; around_mi_422_chroma gains the EC_DCDUMP422 dump for diagnostic parity; frame-1 partition walk now matches the oracle rng-for-rng 300/300 and ALL frames 1-15 decode LUMA-exact at prefilt and postdeb (frame 0 stays exact at all stages); the residual is a chroma pixel-level class (entropy-identical), first site the mi(0,22) 8x8 leaf's chroma U rows 4..7 -- named for the owning lane; 4:2:0/4:4:4 identity by the 8 lossless gates (3 named) green; cargo check 0 warnings
Browse files at this commitbbcf2acafa3bdfb644e4762f19fa23c145d6f3bdParent: 76c34662 changed files +221 -6
- crates/ec-av1/src/decode.rs +115 -6
- lanes/av1422mi24.report.md +106 -0
crates/ec-av1/src/decode.rsmodified+115 -6
| @@ -8586,6 +8586,22 @@ impl Neighbours { | ||
| 8586 | 8586 | o.2 += dc_vote(left[plane].dc); |
| 8587 | 8587 | } |
| 8588 | 8588 | } |
| 8589 | + if crate::envflags::env_flag!("EC_DCDUMP") { | |
| 8590 | + // lane-av1422mi24: same dump [`Self::around_mi_rect`] prints, so | |
| 8591 | + // a rerouted 4:2:2 chroma gather stays visible under EC_DCDUMP=1. | |
| 8592 | + // The above rows are the SAMPLED (every-second) cells. | |
| 8593 | + for (plane, o) in out.iter().enumerate() { | |
| 8594 | + let vote = o.2; | |
| 8595 | + let ab: Vec<String> = (0..above_mi) | |
| 8596 | + .step_by(2) | |
| 8597 | + .map(|k| format!("{:?}/{}", self.above[mi_c + k][plane].dc, self.above[mi_c + k][plane].level)) | |
| 8598 | + .collect(); | |
| 8599 | + let lf: Vec<String> = (0..left_mi) | |
| 8600 | + .map(|k| format!("{:?}/{}", self.left[mi_r + k][plane].dc, self.left[mi_r + k][plane].level)) | |
| 8601 | + .collect(); | |
| 8602 | + eprintln!("EC_DCDUMP422 mi=({mi_r},{mi_c}) plane={plane} wh=({w},{h}) vote={vote} above=[{}] left=[{}]", ab.join(","), lf.join(",")); | |
| 8603 | + } | |
| 8604 | + } | |
| 8589 | 8605 | out |
| 8590 | 8606 | } |
| 8591 | 8607 | |
| @@ -10755,7 +10771,16 @@ fn decode_rect_split( | ||
| 10755 | 10771 | // rule) -- the plain rect walk samples one chroma cell |
| 10756 | 10772 | // twice at ss_x 1. Every pre-existing shape keeps its own |
| 10757 | 10773 | // walk. |
| 10758 | - let cu_around = if chroma_422_oob { | |
| 10774 | + // lane-av1422mi24: the plain rect walk's double-count | |
| 10775 | + // hits EVERY unit shape at ss (1,0), not just the (4, 8) | |
| 10776 | + // one -- the (8, 8) unit of a 16x8 intra-in-inter strip | |
| 10777 | + // read its above dc votes twice and its U dc_sign one | |
| 10778 | + // ctx row high (t422 frame 1). Route every ss (1,0) | |
| 10779 | + // unit through the every-second-above-cell sampling; | |
| 10780 | + // 4:2:0/4:4:4 keep the plain walk verbatim. | |
| 10781 | + let cu_around = if chroma_422_oob | |
| 10782 | + || (ss_x(fctx) == 1 && ss_y(fctx) == 0) | |
| 10783 | + { | |
| 10759 | 10784 | neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y) |
| 10760 | 10785 | } else { |
| 10761 | 10786 | neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y) |
| @@ -10844,7 +10869,19 @@ fn decode_rect_split( | ||
| 10844 | 10869 | } else { |
| 10845 | 10870 | default_intra_tx_type(m.uv_predict_mode as u8) |
| 10846 | 10871 | }; |
| 10847 | - let around = neighbours.around_mi_rect(at_mi, bw, bh); | |
| 10872 | + // lane-av1422mi24: at ss (1,0) the chroma above span is `bw >> 1` | |
| 10873 | + // chroma cells spread over `bw` luma mi columns -- the per-mi gather | |
| 10874 | + // counts every chroma column's whole-unit dc sign twice (the t422 | |
| 10875 | + // frame-1 mi(26,60) intra-in-inter strip's U dc_sign read one ctx | |
| 10876 | + // row high). Luma keeps the per-mi gather; the two chroma planes | |
| 10877 | + // take [`Neighbours::around_mi_422_chroma`]'s every-second | |
| 10878 | + // above-cell sampling, like every other 4:2:2 chroma gather. | |
| 10879 | + let mut around = neighbours.around_mi_rect(at_mi, bw, bh); | |
| 10880 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 10881 | + let c = neighbours.around_mi_422_chroma(at_mi, bw, bh); | |
| 10882 | + around[1] = c[1]; | |
| 10883 | + around[2] = c[2]; | |
| 10884 | + } | |
| 10848 | 10885 | let mut grids: Vec<Grid> = Vec::with_capacity(2); |
| 10849 | 10886 | for plane_idx in 1..=2 { |
| 10850 | 10887 | let skip_ctx = |
| @@ -11848,7 +11885,21 @@ fn decode_intrabc_rect( | ||
| 11848 | 11885 | match leaves.as_ref() { |
| 11849 | 11886 | None => { |
| 11850 | 11887 | // One whole-block rectangular transform unit. |
| 11851 | - let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | |
| 11888 | + // lane-av1422mi24: at ss (1,0) the chroma above span is | |
| 11889 | + // `bw >> 1` chroma cells spread over `bw` luma mi columns -- | |
| 11890 | + // the per-mi gather counts every chroma column's whole-unit | |
| 11891 | + // dc sign twice (t422 frame 1, the mi(26,60) intra-in-inter | |
| 11892 | + // strip's U dc_sign read ctx 1 where the oracle's cell sum | |
| 11893 | + // is 0 -> ctx 0). Luma keeps the per-mi gather; the two | |
| 11894 | + // chroma planes take | |
| 11895 | + // [`Neighbours::around_mi_422_chroma`]'s every-second | |
| 11896 | + // above-cell sampling, like every other 4:2:2 chroma gather. | |
| 11897 | + let mut around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | |
| 11898 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 11899 | + let c = neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh); | |
| 11900 | + around[1] = c[1]; | |
| 11901 | + around[2] = c[2]; | |
| 11902 | + } | |
| 11852 | 11903 | let (grid, tx_type) = read_inter_plane_rect( |
| 11853 | 11904 | dec, |
| 11854 | 11905 | cdfs, |
| @@ -11973,7 +12024,15 @@ fn decode_intrabc_rect( | ||
| 11973 | 12024 | // `av1_get_tx_type`'s chroma lookup lands on the colocated |
| 11974 | 12025 | // LUMA unit, which for a split block is the top-left one. |
| 11975 | 12026 | luma_tx_type = first_tx_type; |
| 11976 | - let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | |
| 12027 | + // lane-av1422mi24: same 4:2:2 chroma gather rule as the | |
| 12028 | + // `None` arm above -- the per-mi rect gather double-counts | |
| 12029 | + // each chroma column's whole-unit dc sign at ss (1,0). | |
| 12030 | + let mut around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | |
| 12031 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 12032 | + let c = neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh); | |
| 12033 | + around[1] = c[1]; | |
| 12034 | + around[2] = c[2]; | |
| 12035 | + } | |
| 11977 | 12036 | let (ug, _) = read_inter_plane_rect( |
| 11978 | 12037 | dec, |
| 11979 | 12038 | cdfs, |
| @@ -33084,7 +33143,39 @@ fn decode_inter_block( | ||
| 33084 | 33143 | // OWN width above and height left -- reading `side` cells both |
| 33085 | 33144 | // ways indexes past the tile's last mi row for a bottom strip. |
| 33086 | 33145 | let around = if rect_tu { |
| 33087 | - neighbours.around_mi_rect(at_mi, write_w, write_h) | |
| 33146 | + // lane-av1422mi24: at ss (1,0) the rect strip's chroma | |
| 33147 | + // above span is `write_w >> 1` chroma cells spread over | |
| 33148 | + // `write_w` luma mi columns -- the per-mi gather counts | |
| 33149 | + // every chroma column's whole-unit dc sign twice (the | |
| 33150 | + // t422 frame-1 mi(26,60) strip's U dc_sign read one row | |
| 33151 | + // high). Luma keeps the per-mi extents; chroma takes | |
| 33152 | + // [`Neighbours::around_mi_422_chroma`]'s every-second- | |
| 33153 | + // above-cell sampling. | |
| 33154 | + let mut a = neighbours.around_mi_rect(at_mi, write_w, write_h); | |
| 33155 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 33156 | + let c = neighbours.around_mi_422_chroma(at_mi, write_w, write_h); | |
| 33157 | + a[1] = c[1]; | |
| 33158 | + a[2] = c[2]; | |
| 33159 | + } | |
| 33160 | + a | |
| 33161 | + } else if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 33162 | + // lane-av1422mi24: at ss (1,0) a square block's chroma | |
| 33163 | + // plane block is (side/2, side) -- `side` chroma 4-px | |
| 33164 | + // above cells spread over `side` luma mi columns, one | |
| 33165 | + // chroma column per PAIR of luma mi cells. The plain | |
| 33166 | + // per-mi gather samples every second chroma column, and | |
| 33167 | + // its dc-vote sum lands one sign row off (t422 frame 1, | |
| 33168 | + // mi(24,56) U dc_sign: ours read dc_sign_cdf[0] where | |
| 33169 | + // the oracle read row 1). Luma keeps the per-mi gather | |
| 33170 | + // verbatim; only the two chroma planes take | |
| 33171 | + // [`Neighbours::around_mi_422_chroma`]'s every-second- | |
| 33172 | + // above-cell sampling (the same measured rule the strip | |
| 33173 | + // and chunk arms already run). | |
| 33174 | + let mut a = neighbours.around_mi(at, side); | |
| 33175 | + let c = neighbours.around_mi_422_chroma(at, write_w, write_h); | |
| 33176 | + a[1] = c[1]; | |
| 33177 | + a[2] = c[2]; | |
| 33178 | + a | |
| 33088 | 33179 | } else { |
| 33089 | 33180 | neighbours.around_mi(at, side) |
| 33090 | 33181 | }; |
| @@ -34572,7 +34663,25 @@ fn decode_inter_block( | ||
| 34572 | 34663 | // OWN width above and height left -- reading `side` cells both |
| 34573 | 34664 | // ways indexes past the tile's last mi row for a bottom strip. |
| 34574 | 34665 | let around = if rect_tu { |
| 34575 | - neighbours.around_mi_rect(at_mi, write_w, write_h) | |
| 34666 | + // lane-av1422mi24: same 4:2:2 rect-strip chroma gather | |
| 34667 | + // rule as the single-TU path above -- luma per-mi, | |
| 34668 | + // chroma every-second above cell. | |
| 34669 | + let mut a = neighbours.around_mi_rect(at_mi, write_w, write_h); | |
| 34670 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 34671 | + let c = neighbours.around_mi_422_chroma(at_mi, write_w, write_h); | |
| 34672 | + a[1] = c[1]; | |
| 34673 | + a[2] = c[2]; | |
| 34674 | + } | |
| 34675 | + a | |
| 34676 | + } else if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 34677 | + // lane-av1422mi24: same 4:2:2 square-block chroma gather | |
| 34678 | + // rule as the single-TU path above -- luma per-mi, chroma | |
| 34679 | + // every-second above cell. | |
| 34680 | + let mut a = neighbours.around_mi(at, side); | |
| 34681 | + let c = neighbours.around_mi_422_chroma(at, write_w, write_h); | |
| 34682 | + a[1] = c[1]; | |
| 34683 | + a[2] = c[2]; | |
| 34684 | + a | |
| 34576 | 34685 | } else { |
| 34577 | 34686 | neighbours.around_mi(at, side) |
| 34578 | 34687 | }; |
lanes/av1422mi24.report.mdadded+106 -0
| @@ -0,0 +1,106 @@ | ||
| 1 | +# lane-av1422mi24 — the t422 inter ladder continued from mi(24,60): the | |
| 2 | +# square/rect block chroma context gathers routed through the 4:2:2 | |
| 3 | +# every-second-above-cell sampling; frame-1 entropy now in FULL rng lockstep | |
| 4 | +# and ALL frames' LUMA decodes exact; the residual is a chroma pixel-level | |
| 5 | +# class (entropy-identical), first site named below | |
| 6 | + | |
| 7 | +## Outcome | |
| 8 | + | |
| 9 | +1. **Reproduction at HEAD 95408ed3.** The ctxgather lane's named residual | |
| 10 | + reproduced exactly: frame 0 exact at prefilt/postdeb/postcdef; frame 1 | |
| 11 | + prefilt first diffs Y (96,240) = mi(24,60), U chroma (2,44), V (0,44). | |
| 12 | +2. **The mi(24,60) divergence localized (rng-anchored lockstep, | |
| 13 | + EC_TRACE_PART + EC_AV1_TRACE pairing vs the oracle's EC_PART).** 293 | |
| 14 | + partition reads matched rng-for-rng; the walk first misaligned at the | |
| 15 | + NEXT 16x16 read (mi(24,60) pre-read rng 52112 vs oracle 64776). Window | |
| 16 | + diff (EC_ISTEP / EC_COEFF / EC_COEFF_STEP) pinned the first divergent | |
| 17 | + symbol: the **U dc_sign read of the mi(24,56) 16x16 inter block** — ours | |
| 18 | + `dc_sign_cdf[0]`, oracle row 1. Every level read around it matched | |
| 19 | + rng-for-rng: the coefficient scan placement is CORRECT (the codebase's | |
| 20 | + row-major SCAN_8X16/SCAN_16X8 pair and libaom's column-major | |
| 21 | + default_scan_8x16/default_scan_16x8 enumerate identical (row, col) | |
| 22 | + orders; verified cell by cell against the oracle source). | |
| 23 | +3. **Root cause, class `per-mi chroma context gather` (the ctxgather | |
| 24 | + lane's own rule, three more sites).** At ss (1,0) one chroma 4-px | |
| 25 | + column spans TWO luma mi columns; the plain | |
| 26 | + [`Neighbours::around_mi_rect`]/[`around_mi`] walk samples the above | |
| 27 | + span per luma mi and counts every chroma column's whole-unit dc sign | |
| 28 | + twice, so `dc_sign_ctx`'s vote sum lands one sign row off. Three block | |
| 29 | + classes still gathered per-mi at ss (1,0): | |
| 30 | + * `decode_inter_block`'s block `around` — single-TU arm AND the | |
| 31 | + var-tx/mu arm (square blocks: the mi(24,56) 16x16; rect_tu strips: | |
| 32 | + 16x8 pieces), previously only the strip-pair `around_c` was routed; | |
| 33 | + * `decode_rect_split`'s `chroma_tiled` arm — the else branch kept the | |
| 34 | + plain walk for every non-(4,32) unit, so a 16x8 intra-in-inter | |
| 35 | + strip's (8, 8) chroma unit (mi(26,60), the frame-1 HORZ pair's second | |
| 36 | + piece) read its U dc_sign one row high; | |
| 37 | + * `decode_rect_split`'s unsplit single-TU chroma arm (line ~10863) | |
| 38 | + and `decode_intrabc_rect`'s two chroma gathers — same class, fixed | |
| 39 | + under the same ss (1,0) gate. The intrabc arms are UNREACHABLE on the | |
| 40 | + pinned fixture (`intrabc_hits: 0`): verified by gating only, not by a | |
| 41 | + 4:2:2-intrabc witness (per the intrabc inventory discipline the | |
| 42 | + owning lane should witness them). | |
| 43 | + Every edit is gated `ss_x == 1 && ss_y == 0` with the non-4:2:2 arm the | |
| 44 | + original expression verbatim. | |
| 45 | +4. **Diagnostic parity (Main's request): [`around_mi_422_chroma`] now | |
| 46 | + prints the same env-gated `EC_DCDUMP422` block `around_mi_rect` prints** | |
| 47 | + (sampled above cells), so a rerouted 4:2:2 chroma gather stays visible | |
| 48 | + under `EC_DCDUMP=1`. | |
| 49 | +5. **Oracle ground truth used:** the instrumented aomdec's `EC_DBGCTX` | |
| 50 | + chroma context dump (cells + the built binary's `dc_sign_contexts` | |
| 51 | + table, extracted from the binary: signum semantics {neg:1, 0:0, | |
| 52 | + pos:2}, matching our `dc_sign_ctx`). The src tree's table literal | |
| 53 | + differs from the built one; the binary is authoritative. | |
| 54 | + | |
| 55 | +## Verification | |
| 56 | + | |
| 57 | +- **Partition lockstep, frame 1, post-fix (decode_probe + | |
| 58 | + EC_TRACE_PART vs oracle EC_PART, 2-frame fixture):** 300/300 oracle | |
| 59 | + partition reads match rng-for-rng in walk order (ours consumes 4 extra | |
| 60 | + gathered `EC_PARTG` prints the oracle does not emit) — **no rng | |
| 61 | + mismatch anywhere in the frame**. | |
| 62 | +- **t422 inter ladder re-measured** (decode_probe + | |
| 63 | + EC_AV1_{PREFILT,POSTDEBLOCK,POSTCDEF}_DUMP vs the oracle stage dumps, | |
| 64 | + our dumps /tmp/i422/av1422mi24/*{prefilt,postdeb,postcdef}*8): | |
| 65 | + * frame 0: exact at all three stages; | |
| 66 | + * **LUMA: 0 diffs on EVERY frame 1–15 at prefilt AND postdeb** (frame 1 | |
| 67 | + was 2146 diffs pre-lane; frame 3 was 25163). Frame 15 postcdef shows | |
| 68 | + Y=5059 — a CDEF knock-on: CDEF decisions read the (still wrong) | |
| 69 | + chroma, not a luma defect (postdeb f15 Y=0); | |
| 70 | + * chroma: frame 1 U 4346 → 4175, V 4974 → 4636; frames 3–14 chroma | |
| 71 | + improved on every plane (e.g. f3 U 12610 → 4363); first U diff moved | |
| 72 | + to chroma (4,44). | |
| 73 | +- **Frame exactness claimed ONLY where measured 0:** frame 0 all stages; | |
| 74 | + frames 1–15 LUMA at prefilt/postdeb. Frames 1+ chroma are NOT claimed. | |
| 75 | +- **The residual, site named (next lane's first diff).** With entropy in | |
| 76 | + full lockstep (luma exact everywhere proves it), the remaining chroma | |
| 77 | + diffs are a PIXEL-level class, entropy-identical: first frame-1 diffs | |
| 78 | + U chroma (4,44) → luma (88,8) — the 8x8 inter leaf mi(0,22)'s chroma: | |
| 79 | + U rows 0..3 exact, rows 4..7 wrong; V col 44,45 rows 0..15. The oracle | |
| 80 | + reads NO U residual there (no `EC_COEFF plane=1` at chroma cell | |
| 81 | + (11,0)), so this is a chroma prediction/reconstruction defect for sub-8 | |
| 82 | + 4:2:2 leaves (`chroma422_sub8` / `sub8_inter_split` territory), not a | |
| 83 | + context-gather defect. CDEF-stage luma diffs on f15 are downstream of | |
| 84 | + it. | |
| 85 | +- **4:2:0/4:4:4 identity:** every edit is ss (1,0)-gated with the other | |
| 86 | + arm verbatim; the lossless gate battery stays green — 8 passed 0 failed | |
| 87 | + including `a_lossless_libaom_key_frame_decodes_sample_exact`, | |
| 88 | + `a_lossless_libaom_inter_frame_decodes_sample_exact`, | |
| 89 | + `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`. | |
| 90 | +- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422mi24`): | |
| 91 | + **0 warnings, 0 errors**. | |
| 92 | +- The `EC_AV1_ALLOW_422_PROBE` bypass was applied to stream.rs for the | |
| 93 | + probe runs and REVERTED; `git status` names only decode.rs. | |
| 94 | +- Charter note: the s2.obu mandelbrot re-run was DONE by Agent104 (still | |
| 95 | + panics at decode.rs:3709, empty pred slice — bigblock lane's defect); | |
| 96 | + dropped from this lane per Main. | |
| 97 | + | |
| 98 | +## State | |
| 99 | + | |
| 100 | +- Commit on lane-av1-422mi24 (no push): the ss (1,0) chroma-gather fixes | |
| 101 | + in `crates/ec-av1/src/decode.rs` + this report. | |
| 102 | +- Next stop named for the owning lane: the chroma pixel-level class — | |
| 103 | + first site the frame-1 8x8 inter leaf mi(0,22)'s chroma (U rows 4..7, | |
| 104 | + V rows 0..7, chroma cols 44..47), prediction/reconstruction for sub-8 | |
| 105 | + 4:2:2 leaves with entropy in lockstep; and the f15 postcdef CDEF | |
| 106 | + knock-on disappears with it. |