ec-av1: lane-av1-422 r1 -- 4:2:2 chroma class fixes behind the header refusal
Browse files at this commit14d0a2fab516e8344dc5d98f8a94dd2c76d18e89Parent: 38b69192 changed files +173 -13
- crates/ec-av1/src/decode.rs +109 -13
- lanes/av1422.report.md +64 -0
crates/ec-av1/src/decode.rsmodified+109 -13
| @@ -1990,6 +1990,23 @@ pub(crate) fn rect_split_chroma_shape_hits() -> [usize; 4] { | ||
| 1990 | 1990 | RECT_SPLIT_CHROMA_SHAPE_HITS.with(|c| c.get()) |
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | +// lane-av1-422: how many SQUARE chroma coefficient units the strip path read | |
| 1994 | +// on a 4:2:2 frame (ss 1,0) -- the half-width, unhalved-height shape whose | |
| 1995 | +// tables only exist because of the square rows in the chroma_tiled arm. A | |
| 1996 | +// 4:2:0 or 4:4:4 frame can never increment it (their rect strips' chroma is | |
| 1997 | +// itself rect), and a restored `/2 chroma height` diverts 4:2:2 squares onto | |
| 1998 | +// the rect rows, so the witness gate reads 0 there and fails. | |
| 1999 | +thread_local! { | |
| 2000 | + static CHROMA422_SQUARE_HITS: std::cell::Cell<usize> = | |
| 2001 | + const { std::cell::Cell::new(0) }; | |
| 2002 | +} | |
| 2003 | + | |
| 2004 | +/// Current value of [`CHROMA422_SQUARE_HITS`]. | |
| 2005 | +#[allow(dead_code)] // read only from the `#[cfg(test)]` gates | |
| 2006 | +pub(crate) fn chroma422_square_hits() -> usize { | |
| 2007 | + CHROMA422_SQUARE_HITS.with(|c| c.get()) | |
| 2008 | +} | |
| 2009 | + | |
| 1993 | 2010 | // How many HORZ/VERT intra strips actually predicted with filter intra |
| 1994 | 2011 | // (lane-rectsplit r1) -- the case `decode_block_rect` refused by name |
| 1995 | 2012 | // ("this decoder predicts square-only") until `predict_filter_intra` took |
| @@ -10116,7 +10133,12 @@ fn decode_rect_split( | ||
| 10116 | 10133 | // A 4:4:4 64-axis strip's chroma plane block is larger than one adjusted |
| 10117 | 10134 | // UV transform (TX_64X32 adjusts to TX_32X32). Those sizes are tiled |
| 10118 | 10135 | // below; everything else still needs a single-unit table. |
| 10119 | - let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64)); | |
| 10136 | + // lane-av1-422: a 4:2:2 strip's chroma plane keeps the strip's HEIGHT and | |
| 10137 | + // halves only the width, so a rect luma strip codes a SQUARE chroma block | |
| 10138 | + // (16x8 luma -> 8x8 chroma) -- the square rows below. At 4:2:0 and 4:4:4 a | |
| 10139 | + // rect strip's chroma is itself rect, so the square rows are unreachable | |
| 10140 | + // there and cannot change their results. | |
| 10141 | + let chroma_tiled = matches!((chroma_w, chroma_h), (64, 32) | (32, 64) | (64, 16) | (16, 64) | (32, 32) | (16, 16) | (8, 8)); | |
| 10120 | 10142 | if !m.skip && chroma.is_none() && !chroma_tiled { |
| 10121 | 10143 | return Err(unsupported( |
| 10122 | 10144 | "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", |
| @@ -10487,11 +10509,20 @@ fn decode_rect_split( | ||
| 10487 | 10509 | (ug, vg) |
| 10488 | 10510 | } else if chroma_tiled { |
| 10489 | 10511 | let (uw, uh, set, scan): (usize, usize, TxbSet, &[u16]) = match (chroma_w, chroma_h) { |
| 10490 | - (64, 32) | (32, 64) => (32, 32, TxbSet::Chroma32, default_scan(32)), | |
| 10512 | + (64, 32) | (32, 64) | (32, 32) => (32, 32, TxbSet::Chroma32, default_scan(32)), | |
| 10491 | 10513 | (64, 16) => (32, 16, TxbSet::ChromaRect32x16, &SCAN_32X16), |
| 10492 | 10514 | (16, 64) => (16, 32, TxbSet::ChromaRect32x16, &SCAN_16X32), |
| 10515 | + // lane-av1-422: the 4:2:2 square chroma planes (height unhalved), | |
| 10516 | + // through the square reader like every other square chroma unit. | |
| 10517 | + (16, 16) => (16, 16, TxbSet::Chroma16, default_scan(16)), | |
| 10518 | + (8, 8) => (8, 8, TxbSet::Chroma8, default_scan(8)), | |
| 10493 | 10519 | _ => unreachable!("chroma_tiled"), |
| 10494 | 10520 | }; |
| 10521 | + // lane-av1-422: the witness counter, keyed to ss (1,0) so only a 4:2:2 | |
| 10522 | + // frame's square chroma units count it. | |
| 10523 | + if uw == uh && ss_x(fctx) == 1 && ss_y(fctx) == 0 { | |
| 10524 | + hit!(CHROMA422_SQUARE_HITS); | |
| 10525 | + } | |
| 10495 | 10526 | let (nw, nh) = (chroma_w / uw, chroma_h / uh); |
| 10496 | 10527 | let bigger = chroma_w * chroma_h > uw * uh; |
| 10497 | 10528 | let default_tx = TxType::DctDct; |
| @@ -12518,6 +12549,16 @@ fn decode_block_rect( | ||
| 12518 | 12549 | (16, 32) => (TxbSet::ChromaRect32x16, &SCAN_16X32), |
| 12519 | 12550 | (16, 8) => (TxbSet::ChromaRect16x8, &SCAN_16X8), |
| 12520 | 12551 | (8, 16) => (TxbSet::ChromaRect16x8, &SCAN_8X16), |
| 12552 | + // lane-av1-422: a 4:2:2 strip halves only the width. A 32x16 | |
| 12553 | + // luma strip's chroma is a 16x16 SQUARE (`TxbSet::Chroma16`, the | |
| 12554 | + // set any 16x16 chroma plane reads); a 16x32 strip's chroma is | |
| 12555 | + // 8x32, whose entropy set is the 16x16 one and whose DCT-only | |
| 12556 | + // default follows the >=32 rule below -- the same pairing the | |
| 12557 | + // (8,32) row of [`decode_rect_split`]'s chroma table proves. At | |
| 12558 | + // 4:2:0 and 4:4:4 a strip's chroma is itself rect, so neither row | |
| 12559 | + // is reachable there. | |
| 12560 | + (16, 16) => (TxbSet::Chroma16, default_scan(16)), | |
| 12561 | + (8, 32) => (TxbSet::Chroma16, &SCAN_8X32), | |
| 12521 | 12562 | _ => { |
| 12522 | 12563 | return Err(unsupported( |
| 12523 | 12564 | "a rectangular chroma transform whose size has no coefficient table", |
| @@ -13366,7 +13407,17 @@ fn decode_block_rect4( | ||
| 13366 | 13407 | (4, 16) => (TxbSet::Chroma8, &SCAN_4X16[..]), |
| 13367 | 13408 | (32, 8) => (TxbSet::Chroma16, &SCAN_32X8[..]), |
| 13368 | 13409 | (8, 32) => (TxbSet::Chroma16, &SCAN_8X32[..]), |
| 13369 | - _ => unreachable!("decode_block_rect4 chroma shape set is closed"), | |
| 13410 | + // lane-av1-422: a 4:2:2 1:4 strip halves only the width, so the | |
| 13411 | + // landscape leaves (32x8, 16x4 luma) code their chroma as the RECT | |
| 13412 | + // (16,8)/(8,4) -- the same TxbSet/scan pair the (16,8)/(8,4) rows of | |
| 13413 | + // [`decode_rect_split`]'s chroma table use. The portrait leaves are | |
| 13414 | + // unreachable: ss_size_lookup marks them BLOCK_INVALID at (1,0), so | |
| 13415 | + // a conformant 4:2:2 stream cannot carry that leaf size. | |
| 13416 | + (16, 8) => (TxbSet::ChromaRect16x8, &SCAN_16X8[..]), | |
| 13417 | + (8, 4) => (TxbSet::ChromaRect8x4, &SCAN_8X4[..]), | |
| 13418 | + _ => unreachable!( | |
| 13419 | + "decode_block_rect4 chroma shape set is closed: {chroma_w}x{chroma_h}" | |
| 13420 | + ), | |
| 13370 | 13421 | }; |
| 13371 | 13422 | let luma_scan: &[u16] = if bw > bh { &SCAN_32X8 } else { &SCAN_8X32 }; |
| 13372 | 13423 | let (luma_levels, u_levels, v_levels) = if skip { |
| @@ -13635,7 +13686,7 @@ fn decode_rect4_16( | ||
| 13635 | 13686 | // lane-av1-444: at 4:4:4 every strip is its own chroma reference |
| 13636 | 13687 | // (no mi-parity test at ss 0/0, and the strip's own chroma block is |
| 13637 | 13688 | // already >= 4x4) -- there is no 4:2:0 pair to close. |
| 13638 | - let has_chroma = i % 2 == 1 || (ss_x(fctx) == 0 && ss_y(fctx) == 0); | |
| 13689 | + let has_chroma = i % 2 == 1 || ss_y(fctx) == 0; | |
| 13639 | 13690 | let (mode, uv, _tx) = decode_rect4_16_strip( |
| 13640 | 13691 | dec, |
| 13641 | 13692 | cdfs, |
| @@ -14537,6 +14588,17 @@ fn decode_rect4_16_strip( | ||
| 14537 | 14588 | // ss 0/0, so the neighbour reads below anchor at the strip.) |
| 14538 | 14589 | let (pair_mi, pw, ph) = if ss_x(fctx) == 0 && ss_y(fctx) == 0 { |
| 14539 | 14590 | (lmi, bw, bh) |
| 14591 | + } else if ss_y(fctx) == 0 { | |
| 14592 | + // lane-av1-422: chroma height is NOT subsampled, so every | |
| 14593 | + // strip is its own chroma reference (libaom is_chroma_reference | |
| 14594 | + // loses its row-parity clause) and codes its own | |
| 14595 | + // `ss_size_lookup[bsize][1][0]` chroma block -- the 8x4 of a | |
| 14596 | + // 16x4 luma strip. The 4:2:0 pair merge below never applies, | |
| 14597 | + // exactly like the ss 0/0 arm above. (A VERTICAL 4x16 strip | |
| 14598 | + // cannot reach this arm at 4:2:2: its chroma block | |
| 14599 | + // `ss_size_lookup[BLOCK_4X16][1][0]` is BLOCK_INVALID, so a | |
| 14600 | + // conformant stream carries no such leaf.) | |
| 14601 | + (lmi, bw, bh) | |
| 14540 | 14602 | } else if horz { |
| 14541 | 14603 | ((lmi.0 - 1, lmi.1), 16, 8) |
| 14542 | 14604 | } else { |
| @@ -14694,6 +14756,17 @@ fn decode_rect4_16_strip( | ||
| 14694 | 14756 | (4, 8) => (TxbSet::ChromaRect8x4, &SCAN_4X8[..]), |
| 14695 | 14757 | (16, 4) => (TxbSet::Chroma8, &SCAN_16X4[..]), |
| 14696 | 14758 | (4, 16) => (TxbSet::Chroma8, &SCAN_4X16[..]), |
| 14759 | + // lane-av1-422: a 4:2:2 HORZ pair (16x8 luma) keeps the | |
| 14760 | + // pair's height: an 8x8 SQUARE chroma block, the same | |
| 14761 | + // `TxbSet::Chroma8` set any 8x8 chroma plane reads. The | |
| 14762 | + // 4:2:0 pair's chroma is 8x4 and 4:4:4's is 16x4, so this | |
| 14763 | + // row is unreachable there. It is also the witness arm: | |
| 14764 | + // a restored `/2 chroma height` lands on (8,4) and the | |
| 14765 | + // counter reads 0. | |
| 14766 | + (8, 8) => { | |
| 14767 | + hit!(CHROMA422_SQUARE_HITS); | |
| 14768 | + (TxbSet::Chroma8, default_scan(8)) | |
| 14769 | + } | |
| 14697 | 14770 | _ => unreachable!("decode_rect4_16_strip chroma shape set is closed"), |
| 14698 | 14771 | }; |
| 14699 | 14772 | let mut planes = Vec::with_capacity(2); |
| @@ -15797,6 +15870,29 @@ fn cfl_ac_ss( | ||
| 15797 | 15870 | let avg = (sum + num_pel / 2) >> num_pel.trailing_zeros(); |
| 15798 | 15871 | ac.iter_mut().for_each(|v| *v -= avg); |
| 15799 | 15872 | ac |
| 15873 | + } else if ss_x == 1 && ss_y == 0 { | |
| 15874 | + // lane-av1-422: `cfl_luma_subsampling_422_lbd_c` -- each chroma sample | |
| 15875 | + // averages the HORIZONTAL luma pair above it, at full chroma height | |
| 15876 | + // (`(a + b) >> 1` in Q3 is `(a + b) << 2`). A rect luma strip's chroma | |
| 15877 | + // is square here, and the 4:2:0 rect/square helpers below would halve | |
| 15878 | + // the height it must keep. | |
| 15879 | + let (cw, ch) = (bw >> 1, bh); | |
| 15880 | + let mut ac = vec![0i32; cw * ch]; | |
| 15881 | + let mut sum = 0i32; | |
| 15882 | + for row in 0..ch { | |
| 15883 | + for col in 0..cw { | |
| 15884 | + let (lx, ly) = (px + col * 2, py + row); | |
| 15885 | + let q3 = (i32::from(y.data[ly * y.width + lx]) | |
| 15886 | + + i32::from(y.data[ly * y.width + lx + 1])) | |
| 15887 | + << 2; | |
| 15888 | + ac[row * cw + col] = q3; | |
| 15889 | + sum += q3; | |
| 15890 | + } | |
| 15891 | + } | |
| 15892 | + let num_pel = (cw * ch) as i32; | |
| 15893 | + let avg = (sum + num_pel / 2) >> num_pel.trailing_zeros(); | |
| 15894 | + ac.iter_mut().for_each(|v| *v -= avg); | |
| 15895 | + ac | |
| 15800 | 15896 | } else if bw == bh { |
| 15801 | 15897 | cfl_ac_q3(y, px, py, bw) |
| 15802 | 15898 | } else { |
| @@ -16694,13 +16790,13 @@ fn decode_block( | ||
| 16694 | 16790 | let mut ub = vec![0u16; chroma_side * chroma_side]; |
| 16695 | 16791 | mc::predict_with_filter( |
| 16696 | 16792 | &u.data, u.width, u.true_width, u.true_height, |
| 16697 | - mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_x(fctx)), | |
| 16793 | + mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)), | |
| 16698 | 16794 | chroma_side, chroma_side, mc::InterpFilterKind::Bilinear, &mut ub, fctx, |
| 16699 | 16795 | ); |
| 16700 | 16796 | let mut vb = vec![0u16; chroma_side * chroma_side]; |
| 16701 | 16797 | mc::predict_with_filter( |
| 16702 | 16798 | &v.data, v.width, v.true_width, v.true_height, |
| 16703 | - mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_x(fctx)), | |
| 16799 | + mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)), | |
| 16704 | 16800 | chroma_side, chroma_side, mc::InterpFilterKind::Bilinear, &mut vb, fctx, |
| 16705 | 16801 | ); |
| 16706 | 16802 | (yb, ub, vb) |
| @@ -18074,13 +18170,13 @@ fn decode_leaf8( | ||
| 18074 | 18170 | let mut ub = vec![0u16; 4 * 4]; |
| 18075 | 18171 | mc::predict_with_filter( |
| 18076 | 18172 | &u.data, u.width, u.true_width, u.true_height, |
| 18077 | - mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_x(fctx)), | |
| 18173 | + mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)), | |
| 18078 | 18174 | 4, 4, mc::InterpFilterKind::Bilinear, &mut ub, fctx, |
| 18079 | 18175 | ); |
| 18080 | 18176 | let mut vb = vec![0u16; 4 * 4]; |
| 18081 | 18177 | mc::predict_with_filter( |
| 18082 | 18178 | &v.data, v.width, v.true_width, v.true_height, |
| 18083 | - mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_x(fctx)), | |
| 18179 | + mv_to_q4(cpx, dv_col, ss_x(fctx)), mv_to_q4(cpy, dv_row, ss_y(fctx)), | |
| 18084 | 18180 | 4, 4, mc::InterpFilterKind::Bilinear, &mut vb, fctx, |
| 18085 | 18181 | ); |
| 18086 | 18182 | (yb, ub, vb) |
| @@ -19189,13 +19285,13 @@ fn decode_leaf_split4( | ||
| 19189 | 19285 | let mut ub = vec![0u16; 16]; |
| 19190 | 19286 | mc::predict_with_filter( |
| 19191 | 19287 | &u.data, u.width, u.true_width, u.true_height, |
| 19192 | - mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_x(fctx)), | |
| 19288 | + mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_y(fctx)), | |
| 19193 | 19289 | 4, 4, mc::InterpFilterKind::Bilinear, &mut ub, fctx, |
| 19194 | 19290 | ); |
| 19195 | 19291 | let mut vb = vec![0u16; 16]; |
| 19196 | 19292 | mc::predict_with_filter( |
| 19197 | 19293 | &v.data, v.width, v.true_width, v.true_height, |
| 19198 | - mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_x(fctx)), | |
| 19294 | + mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_y(fctx)), | |
| 19199 | 19295 | 4, 4, mc::InterpFilterKind::Bilinear, &mut vb, fctx, |
| 19200 | 19296 | ); |
| 19201 | 19297 | let chroma_around = neighbours.around_mi(leaf_mi, 8); |
| @@ -19872,13 +19968,13 @@ fn decode_leaf_rect8( | ||
| 19872 | 19968 | let mut ub = vec![0u16; 16]; |
| 19873 | 19969 | mc::predict_with_filter( |
| 19874 | 19970 | &u.data, u.width, u.true_width, u.true_height, |
| 19875 | - mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_x(fctx)), | |
| 19971 | + mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_y(fctx)), | |
| 19876 | 19972 | 4, 4, mc::InterpFilterKind::Bilinear, &mut ub, fctx, |
| 19877 | 19973 | ); |
| 19878 | 19974 | let mut vb = vec![0u16; 16]; |
| 19879 | 19975 | mc::predict_with_filter( |
| 19880 | 19976 | &v.data, v.width, v.true_width, v.true_height, |
| 19881 | - mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_x(fctx)), | |
| 19977 | + mv_to_q4(cpx, dv.1, ss_x(fctx)), mv_to_q4(cpy, dv.0, ss_y(fctx)), | |
| 19882 | 19978 | 4, 4, mc::InterpFilterKind::Bilinear, &mut vb, fctx, |
| 19883 | 19979 | ); |
| 19884 | 19980 | if leaf_skips[1] { |
| @@ -40550,7 +40646,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 40550 | 40646 | // and predicts its own chroma from its |
| 40551 | 40647 | // own motion (`prev` = None). |
| 40552 | 40648 | let strip_has_chroma = |
| 40553 | - i % 2 == 1 || (ss_x(fctx) == 0 && ss_y(fctx) == 0); | |
| 40649 | + i % 2 == 1 || ss_y(fctx) == 0; | |
| 40554 | 40650 | let pair_mi = if !strip_has_chroma || ss_x(fctx) == 0 { |
| 40555 | 40651 | at_mi |
| 40556 | 40652 | } else if horz { |
lanes/av1422.report.mdadded+64 -0
| @@ -0,0 +1,64 @@ | ||
| 1 | +# lane-av1-422 — 4:2:2 chroma behind the header refusal | |
| 2 | + | |
| 3 | +## Outcome | |
| 4 | + | |
| 5 | +STOP with the refusal in place (`stream.rs` `subsampling_x != subsampling_y`, byte-identical to main). | |
| 6 | +Not pixel-exact yet: the bypassed-refusal probe still desyncs/pantes on the census fixture | |
| 7 | +(`aomenc --profile=2`, 256x144, 16 frames, testsrc2 422 y4m). Next wrong site named below. | |
| 8 | + | |
| 9 | +Landed on this branch: the finished, provably 420/444-invariant slice of the class fix. | |
| 10 | +`cargo check -p ec-av1 --all-targets`: **0 warnings**. | |
| 11 | + | |
| 12 | +## Fixture provenance | |
| 13 | + | |
| 14 | +- `ffmpeg -f lavfi -i testsrc2=256x144:rate=30 -frames:v 16 -pix_fmt yuv422p /tmp/t422.y4m` | |
| 15 | +- `aomenc --codec=av1 --profile=2 --obu -w 256 -h 144 --passes=1 --end-usage=q --cq-level=32 --cpu-used=3 --limit=16` | |
| 16 | +- Refusal string confirmed firing on main before any edit (decode_probe on the OBU). | |
| 17 | +- Oracle decode: `$HOME/.cache/aom-oracle/build/aomdec` (I422 raw). ffmpeg 8.1.2 available; aomdec used as primary pixel oracle. | |
| 18 | + | |
| 19 | +## Class (confirmed against the aom oracle source, `~/.cache/aom-oracle/src`) | |
| 20 | + | |
| 21 | +At ss (1,0) chroma width halves, height does not. Sites assume either a single shared | |
| 22 | +`ss` for both axes or an `ss==(0,0) ? 444 : 420` two-arm split, so 422 falls into the 420 arm. | |
| 23 | +Ground truth tables: `av1_ss_size_lookup` (common_data.c:17), `is_chroma_reference` | |
| 24 | +(av1_common_int.h:1454), `av1_get_max_uv_txsize` (blockd.h:1372). | |
| 25 | + | |
| 26 | +## Fixes landed (all keyed to reachability only at ss 1,0; 420/444 arms byte-identical) | |
| 27 | + | |
| 28 | +1. `decode_rect_split` chroma: square chroma rows (8,8)/(16,16)/(32,32) routed through the | |
| 29 | + square reader via the `chroma_tiled` arm (libaom: chroma of a 16x8/32x16/64x32 luma strip | |
| 30 | + is an 8x8/16x16/32x32 square). Includes 4:2:2 CFL strip support via the same path. | |
| 31 | +2. `decode_rect4_16_strip`: (8,8) arm + 422 strips are their own chroma reference | |
| 32 | + (`ss_size_lookup[16X4][1][0]` = BLOCK_8X4, per-strip, no 4:2:0 pair merge); also fixed a | |
| 33 | + `lmi.1 - 1` underflow the 422 has_chroma change exposed. | |
| 34 | +3. `decode_leaf_rect` chroma match: (16,16) and (8,32) rows. | |
| 35 | +4. `decode_block_rect4` chroma match: (16,8) and (8,4) rows; the portrait-leaf unreachable now | |
| 36 | + names the shape. | |
| 37 | +5. `cfl_ac_ss`: `cfl_luma_subsampling_422_lbd_c` branch (horizontal luma pairs, full height, | |
| 38 | + `(a+b) << 2`), before the 4:2:0 square/rect helpers. | |
| 39 | +6. `mv_to_q4` Y axis: 8 call sites passed `ss_x(fctx)` for the row component — now `ss_y` | |
| 40 | + (sub-8x8/inter chroma MC bilinear predict sites). | |
| 41 | +7. `has_chroma` for 1:4 strip pairs (decode_rect4_16 + inter twin): `i % 2 == 1 || ss_y == 0` | |
| 42 | + (is_chroma_reference's row-parity clause drops out when ss_y=0). | |
| 43 | +8. `CHROMA422_SQUARE_HITS` counter (decode.rs): incremented only when a square chroma | |
| 44 | + coefficient unit is read on a frame with ss (1,0); a restored `/2 chroma height` diverts | |
| 45 | + 4:2:2 squares onto the rect rows and the counter reads 0. Accessor `chroma422_square_hits()`. | |
| 46 | + No gate asserts it yet — the refusal still gates all 422 decode (deferred below). | |
| 47 | + | |
| 48 | +## Next wrong site (first blocker on the fixture, in parent's order) | |
| 49 | + | |
| 50 | +`decode_block` (~line 16621 on this tree): the `ss==(0,0) ? 444 : 420` tx-size arm. Its whole | |
| 51 | +chroma section walks `cn x cn` square `chroma_tx` units; at 4:2:2 a square luma block's chroma | |
| 52 | +is (side/2, side) — a RECT plane block (e.g. 8x16 for a 16x16 block) needing rect chroma sets | |
| 53 | +and a non-square unit walk. Same open class after it: `decode_inter_block`'s square-chroma | |
| 54 | +arms (~31922/33422), `film_grain.rs` `apply_grain` (hardcoded 420 subblock halving), and the | |
| 55 | +1:4 portrait-leaf question — `ss_size_lookup[BLOCK_8X32][1][0]` is BLOCK_INVALID yet the | |
| 56 | +aomenc fixture carries 8x32 leaves that aomdec accepts, so the upstream desync (decode_block / | |
| 57 | +inter chroma) is still producing phantom partitions; that ordering must be re-checked once the | |
| 58 | +square-chroma sites land. | |
| 59 | + | |
| 60 | +## Deferred | |
| 61 | + | |
| 62 | +- Refusal lift + witness gate (`chroma422_square_hits()` + pixel-exact vs aomdec/ffmpeg): | |
| 63 | + deferred(until decode_block/inter square-chroma class lands and the probe is pixel-exact). | |
| 64 | + Refusal stays; a lifted refusal with wrong pixels is a fail. |