Merge c5d88f0b (422mi24) — suite green: 422mi24 623/0
Browse files at this commit3 changed files +377 -14
- crates/ec-av1/src/decode.rs +182 -14
- lanes/av1422ctxgather.report.md +89 -0
- lanes/av1422mi24.report.md +106 -0
crates/ec-av1/src/decode.rsmodified+182 -14
| @@ -8687,6 +8687,22 @@ impl Neighbours { | |||
| 8687 | o.2 += dc_vote(left[plane].dc); | 8687 | o.2 += dc_vote(left[plane].dc); |
| 8688 | } | 8688 | } |
| 8689 | } | 8689 | } |
| 8690 | + if crate::envflags::env_flag!("EC_DCDUMP") { | ||
| 8691 | + // lane-av1422mi24: same dump [`Self::around_mi_rect`] prints, so | ||
| 8692 | + // a rerouted 4:2:2 chroma gather stays visible under EC_DCDUMP=1. | ||
| 8693 | + // The above rows are the SAMPLED (every-second) cells. | ||
| 8694 | + for (plane, o) in out.iter().enumerate() { | ||
| 8695 | + let vote = o.2; | ||
| 8696 | + let ab: Vec<String> = (0..above_mi) | ||
| 8697 | + .step_by(2) | ||
| 8698 | + .map(|k| format!("{:?}/{}", self.above[mi_c + k][plane].dc, self.above[mi_c + k][plane].level)) | ||
| 8699 | + .collect(); | ||
| 8700 | + let lf: Vec<String> = (0..left_mi) | ||
| 8701 | + .map(|k| format!("{:?}/{}", self.left[mi_r + k][plane].dc, self.left[mi_r + k][plane].level)) | ||
| 8702 | + .collect(); | ||
| 8703 | + eprintln!("EC_DCDUMP422 mi=({mi_r},{mi_c}) plane={plane} wh=({w},{h}) vote={vote} above=[{}] left=[{}]", ab.join(","), lf.join(",")); | ||
| 8704 | + } | ||
| 8705 | + } | ||
| 8690 | out | 8706 | out |
| 8691 | } | 8707 | } |
| 8692 | 8708 | ||
| @@ -10879,7 +10895,16 @@ fn decode_rect_split( | |||
| 10879 | // rule) -- the plain rect walk samples one chroma cell | 10895 | // rule) -- the plain rect walk samples one chroma cell |
| 10880 | // twice at ss_x 1. Every pre-existing shape keeps its own | 10896 | // twice at ss_x 1. Every pre-existing shape keeps its own |
| 10881 | // walk. | 10897 | // walk. |
| 10882 | - let cu_around = if chroma_422_oob { | 10898 | + // lane-av1422mi24: the plain rect walk's double-count |
| 10899 | + // hits EVERY unit shape at ss (1,0), not just the (4, 8) | ||
| 10900 | + // one -- the (8, 8) unit of a 16x8 intra-in-inter strip | ||
| 10901 | + // read its above dc votes twice and its U dc_sign one | ||
| 10902 | + // ctx row high (t422 frame 1). Route every ss (1,0) | ||
| 10903 | + // unit through the every-second-above-cell sampling; | ||
| 10904 | + // 4:2:0/4:4:4 keep the plain walk verbatim. | ||
| 10905 | + let cu_around = if chroma_422_oob | ||
| 10906 | + || (ss_x(fctx) == 1 && ss_y(fctx) == 0) | ||
| 10907 | + { | ||
| 10883 | neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y) | 10908 | neighbours.around_mi_422_chroma(cu_mi, luma_span_x, luma_span_y) |
| 10884 | } else { | 10909 | } else { |
| 10885 | neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y) | 10910 | neighbours.around_mi_rect(cu_mi, luma_span_x, luma_span_y) |
| @@ -10968,7 +10993,19 @@ fn decode_rect_split( | |||
| 10968 | } else { | 10993 | } else { |
| 10969 | default_intra_tx_type(m.uv_predict_mode as u8) | 10994 | default_intra_tx_type(m.uv_predict_mode as u8) |
| 10970 | }; | 10995 | }; |
| 10971 | - let around = neighbours.around_mi_rect(at_mi, bw, bh); | 10996 | + // lane-av1422mi24: at ss (1,0) the chroma above span is `bw >> 1` |
| 10997 | + // chroma cells spread over `bw` luma mi columns -- the per-mi gather | ||
| 10998 | + // counts every chroma column's whole-unit dc sign twice (the t422 | ||
| 10999 | + // frame-1 mi(26,60) intra-in-inter strip's U dc_sign read one ctx | ||
| 11000 | + // row high). Luma keeps the per-mi gather; the two chroma planes | ||
| 11001 | + // take [`Neighbours::around_mi_422_chroma`]'s every-second | ||
| 11002 | + // above-cell sampling, like every other 4:2:2 chroma gather. | ||
| 11003 | + let mut around = neighbours.around_mi_rect(at_mi, bw, bh); | ||
| 11004 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 11005 | + let c = neighbours.around_mi_422_chroma(at_mi, bw, bh); | ||
| 11006 | + around[1] = c[1]; | ||
| 11007 | + around[2] = c[2]; | ||
| 11008 | + } | ||
| 10972 | let mut grids: Vec<Grid> = Vec::with_capacity(2); | 11009 | let mut grids: Vec<Grid> = Vec::with_capacity(2); |
| 10973 | for plane_idx in 1..=2 { | 11010 | for plane_idx in 1..=2 { |
| 10974 | let skip_ctx = | 11011 | let skip_ctx = |
| @@ -11972,7 +12009,21 @@ fn decode_intrabc_rect( | |||
| 11972 | match leaves.as_ref() { | 12009 | match leaves.as_ref() { |
| 11973 | None => { | 12010 | None => { |
| 11974 | // One whole-block rectangular transform unit. | 12011 | // One whole-block rectangular transform unit. |
| 11975 | - let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | 12012 | + // lane-av1422mi24: at ss (1,0) the chroma above span is |
| 12013 | + // `bw >> 1` chroma cells spread over `bw` luma mi columns -- | ||
| 12014 | + // the per-mi gather counts every chroma column's whole-unit | ||
| 12015 | + // dc sign twice (t422 frame 1, the mi(26,60) intra-in-inter | ||
| 12016 | + // strip's U dc_sign read ctx 1 where the oracle's cell sum | ||
| 12017 | + // is 0 -> ctx 0). Luma keeps the per-mi gather; the two | ||
| 12018 | + // chroma planes take | ||
| 12019 | + // [`Neighbours::around_mi_422_chroma`]'s every-second | ||
| 12020 | + // above-cell sampling, like every other 4:2:2 chroma gather. | ||
| 12021 | + let mut around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | ||
| 12022 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 12023 | + let c = neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh); | ||
| 12024 | + around[1] = c[1]; | ||
| 12025 | + around[2] = c[2]; | ||
| 12026 | + } | ||
| 11976 | let (grid, tx_type) = read_inter_plane_rect( | 12027 | let (grid, tx_type) = read_inter_plane_rect( |
| 11977 | dec, | 12028 | dec, |
| 11978 | cdfs, | 12029 | cdfs, |
| @@ -12097,7 +12148,15 @@ fn decode_intrabc_rect( | |||
| 12097 | // `av1_get_tx_type`'s chroma lookup lands on the colocated | 12148 | // `av1_get_tx_type`'s chroma lookup lands on the colocated |
| 12098 | // LUMA unit, which for a split block is the top-left one. | 12149 | // LUMA unit, which for a split block is the top-left one. |
| 12099 | luma_tx_type = first_tx_type; | 12150 | luma_tx_type = first_tx_type; |
| 12100 | - let around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | 12151 | + // lane-av1422mi24: same 4:2:2 chroma gather rule as the |
| 12152 | + // `None` arm above -- the per-mi rect gather double-counts | ||
| 12153 | + // each chroma column's whole-unit dc sign at ss (1,0). | ||
| 12154 | + let mut around = neighbours.around_mi_rect((mi_r, mi_c), bw, bh); | ||
| 12155 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 12156 | + let c = neighbours.around_mi_422_chroma((mi_r, mi_c), bw, bh); | ||
| 12157 | + around[1] = c[1]; | ||
| 12158 | + around[2] = c[2]; | ||
| 12159 | + } | ||
| 12101 | let (ug, _) = read_inter_plane_rect( | 12160 | let (ug, _) = read_inter_plane_rect( |
| 12102 | dec, | 12161 | dec, |
| 12103 | cdfs, | 12162 | cdfs, |
| @@ -15483,7 +15542,18 @@ fn decode_rect4_16_strip( | |||
| 15483 | } | 15542 | } |
| 15484 | (Grid::Zero(cw * ch), Grid::Zero(cw * ch)) | 15543 | (Grid::Zero(cw * ch), Grid::Zero(cw * ch)) |
| 15485 | } else { | 15544 | } else { |
| 15486 | - let around = neighbours.around_mi_rect(pair_mi, pw, ph); | 15545 | + // lane-av1422ctxgather: 4:2:2's chroma above votes sample |
| 15546 | + // every second luma-mi cell | ||
| 15547 | + // ([`Neighbours::around_mi_422_chroma`]: at ss_x 1 one | ||
| 15548 | + // chroma 4-px column spans two luma mi columns, and the | ||
| 15549 | + // plain per-mi gather counts each column's whole-unit dc | ||
| 15550 | + // sign twice). The left extent is unsubsampled at ss_y 0, | ||
| 15551 | + // so its per-mi cells already line up one-to-one. | ||
| 15552 | + let around = if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 15553 | + neighbours.around_mi_422_chroma(pair_mi, pw, ph) | ||
| 15554 | + } else { | ||
| 15555 | + neighbours.around_mi_rect(pair_mi, pw, ph) | ||
| 15556 | + }; | ||
| 15487 | // lane-av1-444: the strip's own 16x4 / 4x16 chroma at ss 0/0 | 15557 | // lane-av1-444: the strip's own 16x4 / 4x16 chroma at ss 0/0 |
| 15488 | // (`TxbSet::Chroma8`, `get_txsize_entropy_ctx(TX_16X4)` = | 15558 | // (`TxbSet::Chroma8`, `get_txsize_entropy_ctx(TX_16X4)` = |
| 15489 | // the 8x8 set); 4:2:0 keeps the pair's 8x4 / 4x8. | 15559 | // the 8x8 set); 4:2:0 keeps the pair's 8x4 / 4x8. |
| @@ -23879,7 +23949,19 @@ fn read_inter_rect_chroma( | |||
| 23879 | at_mi.1 + cu_col * (span_x / MI), | 23949 | at_mi.1 + cu_col * (span_x / MI), |
| 23880 | ); | 23950 | ); |
| 23881 | let cu_around = if multi { | 23951 | let cu_around = if multi { |
| 23882 | - neighbours.around_mi_rect(cu_mi, span_x, span_y) | 23952 | + // lane-av1422ctxgather: at ss (1,0) the unit's above |
| 23953 | + // span covers `uw` chroma px = `2*uw` luma mi columns, | ||
| 23954 | + // so the plain per-mi gather counts every chroma | ||
| 23955 | + // column's whole-unit dc sign twice | ||
| 23956 | + // ([`Neighbours::around_mi_422_chroma`]; the left | ||
| 23957 | + // extent is 1:1 at ss_y 0). 4:2:0 keeps the per-mi | ||
| 23958 | + // gather (both extents duplicated there, measured | ||
| 23959 | + // elsewhere). | ||
| 23960 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 23961 | + neighbours.around_mi_422_chroma(cu_mi, span_x, span_y) | ||
| 23962 | + } else { | ||
| 23963 | + neighbours.around_mi_rect(cu_mi, span_x, span_y) | ||
| 23964 | + } | ||
| 23883 | } else { | 23965 | } else { |
| 23884 | around | 23966 | around |
| 23885 | }; | 23967 | }; |
| @@ -33762,7 +33844,39 @@ fn decode_inter_block( | |||
| 33762 | // OWN width above and height left -- reading `side` cells both | 33844 | // OWN width above and height left -- reading `side` cells both |
| 33763 | // ways indexes past the tile's last mi row for a bottom strip. | 33845 | // ways indexes past the tile's last mi row for a bottom strip. |
| 33764 | let around = if rect_tu { | 33846 | let around = if rect_tu { |
| 33765 | - neighbours.around_mi_rect(at_mi, write_w, write_h) | 33847 | + // lane-av1422mi24: at ss (1,0) the rect strip's chroma |
| 33848 | + // above span is `write_w >> 1` chroma cells spread over | ||
| 33849 | + // `write_w` luma mi columns -- the per-mi gather counts | ||
| 33850 | + // every chroma column's whole-unit dc sign twice (the | ||
| 33851 | + // t422 frame-1 mi(26,60) strip's U dc_sign read one row | ||
| 33852 | + // high). Luma keeps the per-mi extents; chroma takes | ||
| 33853 | + // [`Neighbours::around_mi_422_chroma`]'s every-second- | ||
| 33854 | + // above-cell sampling. | ||
| 33855 | + let mut a = neighbours.around_mi_rect(at_mi, write_w, write_h); | ||
| 33856 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 33857 | + let c = neighbours.around_mi_422_chroma(at_mi, write_w, write_h); | ||
| 33858 | + a[1] = c[1]; | ||
| 33859 | + a[2] = c[2]; | ||
| 33860 | + } | ||
| 33861 | + a | ||
| 33862 | + } else if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 33863 | + // lane-av1422mi24: at ss (1,0) a square block's chroma | ||
| 33864 | + // plane block is (side/2, side) -- `side` chroma 4-px | ||
| 33865 | + // above cells spread over `side` luma mi columns, one | ||
| 33866 | + // chroma column per PAIR of luma mi cells. The plain | ||
| 33867 | + // per-mi gather samples every second chroma column, and | ||
| 33868 | + // its dc-vote sum lands one sign row off (t422 frame 1, | ||
| 33869 | + // mi(24,56) U dc_sign: ours read dc_sign_cdf[0] where | ||
| 33870 | + // the oracle read row 1). Luma keeps the per-mi gather | ||
| 33871 | + // verbatim; only the two chroma planes take | ||
| 33872 | + // [`Neighbours::around_mi_422_chroma`]'s every-second- | ||
| 33873 | + // above-cell sampling (the same measured rule the strip | ||
| 33874 | + // and chunk arms already run). | ||
| 33875 | + let mut a = neighbours.around_mi(at, side); | ||
| 33876 | + let c = neighbours.around_mi_422_chroma(at, write_w, write_h); | ||
| 33877 | + a[1] = c[1]; | ||
| 33878 | + a[2] = c[2]; | ||
| 33879 | + a | ||
| 33766 | } else { | 33880 | } else { |
| 33767 | neighbours.around_mi(at, side) | 33881 | neighbours.around_mi(at, side) |
| 33768 | }; | 33882 | }; |
| @@ -35257,7 +35371,25 @@ fn decode_inter_block( | |||
| 35257 | // OWN width above and height left -- reading `side` cells both | 35371 | // OWN width above and height left -- reading `side` cells both |
| 35258 | // ways indexes past the tile's last mi row for a bottom strip. | 35372 | // ways indexes past the tile's last mi row for a bottom strip. |
| 35259 | let around = if rect_tu { | 35373 | let around = if rect_tu { |
| 35260 | - neighbours.around_mi_rect(at_mi, write_w, write_h) | 35374 | + // lane-av1422mi24: same 4:2:2 rect-strip chroma gather |
| 35375 | + // rule as the single-TU path above -- luma per-mi, | ||
| 35376 | + // chroma every-second above cell. | ||
| 35377 | + let mut a = neighbours.around_mi_rect(at_mi, write_w, write_h); | ||
| 35378 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 35379 | + let c = neighbours.around_mi_422_chroma(at_mi, write_w, write_h); | ||
| 35380 | + a[1] = c[1]; | ||
| 35381 | + a[2] = c[2]; | ||
| 35382 | + } | ||
| 35383 | + a | ||
| 35384 | + } else if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 35385 | + // lane-av1422mi24: same 4:2:2 square-block chroma gather | ||
| 35386 | + // rule as the single-TU path above -- luma per-mi, chroma | ||
| 35387 | + // every-second above cell. | ||
| 35388 | + let mut a = neighbours.around_mi(at, side); | ||
| 35389 | + let c = neighbours.around_mi_422_chroma(at, write_w, write_h); | ||
| 35390 | + a[1] = c[1]; | ||
| 35391 | + a[2] = c[2]; | ||
| 35392 | + a | ||
| 35261 | } else { | 35393 | } else { |
| 35262 | neighbours.around_mi(at, side) | 35394 | neighbours.around_mi(at, side) |
| 35263 | }; | 35395 | }; |
| @@ -35265,12 +35397,31 @@ fn decode_inter_block( | |||
| 35265 | // EVEN strip's mi origin and spans both strips, so its | 35397 | // EVEN strip's mi origin and spans both strips, so its |
| 35266 | // above/left coefficient context is the pair's, not this | 35398 | // above/left coefficient context is the pair's, not this |
| 35267 | // strip's row. | 35399 | // strip's row. |
| 35400 | + // lane-av1422ctxgather: at 4:2:2 (ss 1,0) a HORZ strip is | ||
| 35401 | + // its own chroma reference (`is_chroma_reference`'s | ||
| 35402 | + // `!(subsampling_y)` row clause) -- pair_mi is the strip | ||
| 35403 | + // itself and the context reads the strip's own 8x4, ONE | ||
| 35404 | + // luma-mi row tall, with the 4:2:2 above sampling | ||
| 35405 | + // ([`Neighbours::around_mi_422_chroma`]). The 4:2:0 pair | ||
| 35406 | + // merge keeps the (16, 8) span and the plain per-mi gather | ||
| 35407 | + // (as do 4:4:4 and every VERT shape). | ||
| 35268 | let around_c = match strip_chroma { | 35408 | let around_c = match strip_chroma { |
| 35269 | - Some(s) if s.has_chroma => neighbours.around_mi_rect( | 35409 | + Some(s) if s.has_chroma => { |
| 35270 | - s.pair_mi, | 35410 | + let (pw, ph) = if s.horz { |
| 35271 | - if s.horz { 16 } else { 8 }, | 35411 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { |
| 35272 | - if s.horz { 8 } else { 16 }, | 35412 | + (16, 4) |
| 35273 | - ), | 35413 | + } else { |
| 35414 | + (16, 8) | ||
| 35415 | + } | ||
| 35416 | + } else { | ||
| 35417 | + (8, 16) | ||
| 35418 | + }; | ||
| 35419 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 35420 | + neighbours.around_mi_422_chroma(s.pair_mi, pw, ph) | ||
| 35421 | + } else { | ||
| 35422 | + neighbours.around_mi_rect(s.pair_mi, pw, ph) | ||
| 35423 | + } | ||
| 35424 | + } | ||
| 35274 | _ => around, | 35425 | _ => around, |
| 35275 | }; | 35426 | }; |
| 35276 | let luma_tx_type; | 35427 | let luma_tx_type; |
| @@ -37023,7 +37174,24 @@ fn decode_inter_block( | |||
| 37023 | } | 37174 | } |
| 37024 | } | 37175 | } |
| 37025 | if let Some((s, u_state, v_state)) = pair_chroma { | 37176 | if let Some((s, u_state, v_state)) = pair_chroma { |
| 37026 | - let (pw, ph) = if s.horz { (16usize, 8usize) } else { (8, 16) }; | 37177 | + // lane-av1422ctxgather: at 4:2:2 (ss 1,0) a horz strip is its own |
| 37178 | + // chroma reference -- no pair merge ever happened, so the write | ||
| 37179 | + // covers the strip's own 8x4: ONE luma-mi left row (libaom's | ||
| 37180 | + // `av1_set_contexts` for the TX_8X4 at ss_y 0 stamps | ||
| 37181 | + // `tx_size_high_unit` = 1 cell). The 4:2:0 pair's two-row (16, 8) | ||
| 37182 | + // span would overwrite the NEXT row's leaf-stamped level state | ||
| 37183 | + // (measured: t422 frame 1, the strip at mi(8,4) zeroed | ||
| 37184 | + // left[9][1] under the mi(8,2) 8x8's level 5 before the mi(9,4) | ||
| 37185 | + // strip's own all_zero read it one ctx row low). | ||
| 37186 | + let (pw, ph) = if s.horz { | ||
| 37187 | + if ss_x(fctx) == 1 && ss_y(fctx) == 0 { | ||
| 37188 | + (16usize, 4usize) | ||
| 37189 | + } else { | ||
| 37190 | + (16usize, 8usize) | ||
| 37191 | + } | ||
| 37192 | + } else { | ||
| 37193 | + (8, 16) | ||
| 37194 | + }; | ||
| 37027 | let round_up_even = |n: usize| n.div_ceil(2) * 2; | 37195 | let round_up_even = |n: usize| n.div_ceil(2) * 2; |
| 37028 | let (bound_h, bound_w) = ( | 37196 | let (bound_h, bound_w) = ( |
| 37029 | round_up_even(neighbours.mi_rows), | 37197 | round_up_even(neighbours.mi_rows), |
lanes/av1422ctxgather.report.mdadded+89 -0
| @@ -0,0 +1,89 @@ | |||
| 1 | +# lane-av1422ctxgather — the 4:2:2 strip chroma context gather and the | ||
| 2 | +# clobbering pair write fixed at source; 4:2:0/4:4:4 byte-identical; the | ||
| 3 | +# 4:2:2 header refusal STAYS | ||
| 4 | + | ||
| 5 | +## Outcome | ||
| 6 | + | ||
| 7 | +1. **The clobber (the anchor's root cause).** `decode_inter_block`'s | ||
| 8 | + `pair_chroma` write hardcoded the 4:2:0 pair span `(pw, ph) = (16, 8)` | ||
| 9 | + for every horz strip. At 4:2:2 (ss 1,0) a horz 16x4 strip is its OWN | ||
| 10 | + chroma reference (`is_chroma_reference`'s `!(subsampling_y)` row | ||
| 11 | + clause) — no pair merge ever happened, `pair_mi` is the strip itself, | ||
| 12 | + and the two-row span overwrote one row it does not own. Measured | ||
| 13 | + (t422 frame 1, EC422WATCH probe, since removed): the inter strip at | ||
| 14 | + mi(8,4) zeroed `left[9][1]` under the mi(8,2) 8x8 leaf's level 5 | ||
| 15 | + before the mi(9,4) strip's own U `all_zero` read it one ctx row low | ||
| 16 | + (ours base 0 + 7, oracle base 1 + 7 — the parent lane's anchor | ||
| 17 | + facts, reproduced). The span is now `(16, 4)` at ss (1,0); 4:2:0 | ||
| 18 | + keeps `(16, 8)`; VERT keeps `(8, 16)` in every format. | ||
| 19 | +2. **The inter strip's chroma gather.** `decode_inter_block`'s | ||
| 20 | + `around_c` gathered the horz strip's context with | ||
| 21 | + `around_mi_rect(pair_mi, 16, 8)` — the pair span AND the plain | ||
| 22 | + per-mi above sampling (one chroma 4-px column spans two luma mi | ||
| 23 | + columns at ss_x 1, so every column's whole-unit dc sign is counted | ||
| 24 | + twice). At ss (1,0) it now reads `(16, 4)` through | ||
| 25 | + [`Neighbours::around_mi_422_chroma`]; the 4:2:0 pair merge keeps the | ||
| 26 | + (16, 8) span and the per-mi gather, as do 4:4:4 and every VERT shape. | ||
| 27 | +3. **The intra strip's chroma gather** (the charter's named site, | ||
| 28 | + `decode_rect4_16_strip` ~15331): the else arm's | ||
| 29 | + `around_mi_rect(pair_mi, pw, ph)` is routed through | ||
| 30 | + [`around_mi_422_chroma`] at ss (1,0) — the same measured rule as the | ||
| 31 | + other chroma gathers (10754/13774/15297/17862/18061). Shapes at other | ||
| 32 | + subsamplings keep the original gather. | ||
| 33 | +4. **Class sweep found one more instance, fixed:** | ||
| 34 | + `read_inter_rect_chroma`'s chunked units (`multi` arm) gathered each | ||
| 35 | + unit with `around_mi_rect(cu_mi, span_x, span_y)`; at ss (1,0) the | ||
| 36 | + unit's above span covers `2*uw` luma mi columns and the per-mi gather | ||
| 37 | + double-counts every column. Now routed through [`around_mi_422_chroma`] | ||
| 38 | + at ss (1,0) only; the `else` (4:2:0/4:4:4) arm is the original | ||
| 39 | + expression verbatim. | ||
| 40 | +5. Untouched, byte-identical: the intra strip's own chroma write (its | ||
| 41 | + pair is already `(16, 4)` at 4:2:2), `decode_rect4_16_intrabc`'s pair | ||
| 42 | + write (intrabc counters are 0 on the pinned fixture and intrabc has | ||
| 43 | + its own inventory discipline), the 4:2:0 group-tail chroma SKIP arm | ||
| 44 | + (reserved for its owning lane), `stream.rs`, and the 4:2:2 header | ||
| 45 | + refusal. The `EC_AV1_ALLOW_422_PROBE` bypass was applied to stream.rs | ||
| 46 | + for the probe runs and reverted; `git status` names only decode.rs. | ||
| 47 | + | ||
| 48 | +## Verification | ||
| 49 | + | ||
| 50 | +- **The anchor, before/after (probed, EC422WATCH + EC_DCDUMP):** before, | ||
| 51 | + `inter_pair` wrote `left[9][1] 5 -> 0` and the mi(9,4) strip's U gather | ||
| 52 | + read `left=[None/0]` -> base 0; after, nothing writes row 9 between the | ||
| 53 | + leaf's stamp and the gather, the gather reads `left=[Some(true)/5]` -> | ||
| 54 | + base 1 = the oracle's row. First U divergence at the parent's anchor | ||
| 55 | + (pre-all_zero rng 49672) is gone. | ||
| 56 | +- **t422 inter ladder re-measured** (decode_probe + EC_AV1_{PREFILT, | ||
| 57 | + POSTDEBLOCK,POSTCDEF}_DUMP vs the parent's oracle dumps, | ||
| 58 | + /tmp/i422/ladder/oracle, our dumps /tmp/i422/av1422ctxgather/final): | ||
| 59 | + frame 0 is **exact at all three stages (0 diffs per plane per frame)**. | ||
| 60 | + Frame 1 pre-fix Y=23948 U=13513 V=13544 -> post-fix Y=1739 U=4346 | ||
| 61 | + V=4974 (first Y diff moved from the anchor's ctx row to y=96 x=240; | ||
| 62 | + first chroma diffs at chroma (0,44)/(2,44)). Frames 2-15 improved on | ||
| 63 | + every plane (no frame regressed) but remain nonzero. | ||
| 64 | +- **Frame exactness claimed ONLY where measured 0:** frame 0 at all | ||
| 65 | + stages. Frames 1+ are NOT claimed. The residual is downstream of this | ||
| 66 | + lane's class: frame 1's first Y diff sits at (96, 240) (mi(24,60)) and | ||
| 67 | + the first U/V diffs at chroma (2,44)/(0,44) — neither is a strip | ||
| 68 | + gather nor a pair write; attributing them is the next lane's first | ||
| 69 | + diff. | ||
| 70 | +- **4:2:0/4:4:4 identity:** all four edits are gated | ||
| 71 | + `ss_x(fctx) == 1 && ss_y(fctx) == 0` with the non-4:2:2 arm the | ||
| 72 | + original expression verbatim; the lossless 4:4:4 stream gates stay | ||
| 73 | + green — `a_lossless_libaom_key_frame_decodes_sample_exact`, | ||
| 74 | + `a_lossless_libaom_inter_frame_decodes_sample_exact`, | ||
| 75 | + `a_real_aomenc_mixed_lossless_segment_frame_decodes_sample_exact`: | ||
| 76 | + 3 passed, 0 failed. | ||
| 77 | +- `cargo check -p ec-av1` (target dir `~/.cache/cargo-target-av1422ctxgather`): | ||
| 78 | + **0 warnings, 0 errors**. | ||
| 79 | +- Probes: the temporary EC422WATCH write-watch was removed before the | ||
| 80 | + final build and commit; the final ladder was re-run on the clean tree | ||
| 81 | + and matches the probed run exactly (the watch was eprintln-only). | ||
| 82 | + | ||
| 83 | +## State | ||
| 84 | + | ||
| 85 | +- Commit on lane-av1422ctxgather (no push): the four gated edits in | ||
| 86 | + `crates/ec-av1/src/decode.rs` + this report. | ||
| 87 | +- Next stop named for the owning lane: the frame-1 Y diff at mi(24,60) | ||
| 88 | + and the chroma diffs at chroma (0,44)/(2,44) — re-run the stage ladder | ||
| 89 | + and the EC_ISTEP/EC_COEFF pairing from there. | ||
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. | ||