From c74c912a0461964953391597b535eaa7ca1472de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 26 Sep 2026 05:00:18 +0300 Subject: [PATCH] ec-av1: lane-av1-422bigblock -- the 128-root 4:2:2 chroma chunk de-square-cut on the per-axis plane-block model and the reference plane resolution taught the third subsampling shape Both witnessed defects are fixed and both pinned witnesses decode pixel-exact vs aomdec on the local EC_AV1_ALLOW_422_PROBE patch-run-restore build. Defect 1 (422_allskip_2f.obu) does NOT reproduce at this HEAD: the block-half port already entropy-locks it -- all 20 key-frame coefficient units pair rng-for-rng with the instrumented oracle and the all-skip inter frame reads zero units on both sides; the shown frame is byte-identical to aomdec. Re-verified, no change needed. Defect 2 (422_sb128_3f.obu, the f2 128x128 PARTITION_NONE non-skip inter block) had three stacked causes under the historical range-end panic: decode_inter_block's mu-chunk chroma walk cut each chunk's 32x64 chroma into a chroma_side-square 64x64 (twice the oracle's 16 units, 8 per plane, 2 stacked per chunk) -- now per-axis with per-unit luma spans through around_mi_rect and per-axis record_mi_chroma; the unit prediction window was indexed at the square chroma_side instead of the buffer's own chroma_stride (the empty-slice densify panic) -- now the real stride while the assembled grid keeps the square stride the block-tail re-stamp already indexes; and RefPix::planes guessed every non-4:4:4 reference quarter-height, so inter prediction off the slot read a clamped row-63 edge over chroma rows 64..127 -- now a three-way length inference (luma-sized, half-width, quarter) that is exact for every dimension. Defect 3 (s2.obu crash, via parent IRC): the same class in decode_block_128rect's intra chroma walk -- square cn, chunk offsets and clamp strides, square around_mi/tu_reach -- now per-axis; s2 decodes all 16 frames with no panic. Its remaining frame-0 divergence is named in the report for the owning lane: an entropy desync from coefficient unit 38, a plane-2 TX_4X8 chroma unit at mi(12,24) (oracle 1089 units, ours 541), the sub-8 4:2:2 class, pre-existing -- the base tree panics at frame 0 and never produced pixels. decode_intrabc_128rect carries the same square-cut walk unwitnessed; deferred with its unblock named in the report. 4:2:0/4:4:4 identity: the 10-bit inter sequence gate, the two-tile-rows aomenc gate, the 4:4:4 lossless sb128 gate and both 128-root encoder round-trip gates are green; t422 frame 0 stays byte-exact vs the instrumented oracle at PREFILT, POSTDEBLOCK, POSTCDEF and FINAL on all three planes. Both witnesses are pinned with git add -f and gated by the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name (byte pins plus the unconditional refusal-by-name contract; the decode-level assertions are probe-measured and reproducible from the report's recipe because decode_stream still refuses 4:2:2 unconditionally). cargo check: 0 warnings. --- crates/ec-av1/fixtures/422_allskip_2f.obu | Bin 0 -> 62 bytes crates/ec-av1/fixtures/422_sb128_3f.obu | Bin 0 -> 12543 bytes crates/ec-av1/src/decode.rs | 270 ++++++++++++++++------ crates/ec-av1/src/stream.rs | 56 +++++ lanes/av1422bigblock.report.md | 156 +++++++++++++ 5 files changed, 406 insertions(+), 76 deletions(-) create mode 100644 crates/ec-av1/fixtures/422_allskip_2f.obu create mode 100644 crates/ec-av1/fixtures/422_sb128_3f.obu create mode 100644 lanes/av1422bigblock.report.md diff --git a/crates/ec-av1/fixtures/422_allskip_2f.obu b/crates/ec-av1/fixtures/422_allskip_2f.obu new file mode 100644 index 0000000000000000000000000000000000000000..d6f493d80d3d2c40b8c970b21b73815baff4137f GIT binary patch literal 62 zcmWe);No&%U|=@?|4#S-hY_y;Ln{LV69WUoGMSnMLJUUy2FwQ<7#JK&85md?7_KM? Hp{NG{e4z~a literal 0 HcmV?d00001 diff --git a/crates/ec-av1/fixtures/422_sb128_3f.obu b/crates/ec-av1/fixtures/422_sb128_3f.obu new file mode 100644 index 0000000000000000000000000000000000000000..86b8f18931706043a83d8b202d2743355e2d41c7 GIT binary patch literal 12543 zcmV;20EB=50)PxyX`r~s5&#McKmY&(H~;Pvzz8yr zPZR(oU;qH1@XHUmM(FTr3OV_6$-Vf-7EYqHG9QLdt1+UE6Rpq#c|Y5E-o%dz$+Qy7 zM!KinBt2e^z6}$(EPrJYbCuai6Y(K5+W0G61^>Wp59rJR%K~(I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P=O3lhur6dy9I>G>j9gGfKT6y=MHlAvCu2m|Ns1p zT%|N`-TzSTQV(dSQM1?wu)gbc`rfo7siaH1jhd#l`a3Ra$#&1VlrhbI^nzj=zXFCiA^aF4k)} z0?{OC=_R&{rSM4$z7Qy^yf}G@iX}&uaQqUohjk7Nk``dBF!Y!=H9LNaK(+>+D;_wp z179P$^ioxI+(z<8v61x>N>y{xuFmqDZ~D;vua;iV2XHub|MH}$;IqEc>}G~N6b=6l z574}T?0sK@s!QdK$UR9a#Ig@^-1n(%+G))Q-ZZ_d$layMEuc883Y77$7h9a7BL&Bf zFLQOwq$Vr7X{JBV6~2QJsa?Ornz;}CmWOm-XUaNl0PNOPd<>w10HFdH@a#n>ri&ovNSN^GAz|h~Dk~}oq zg?z%@sOHw} zC+ygJF$ofR5uz#;|kebrf-af8j@lq_~mCudFA3f`T z9BI3ASw}I^{D(K$g99Gp zrp2}y(OL=N!J}N@%5$e&S|o@OD_iW_QE6QZOkh%HtOty>`^((tYxpv=?Blt_z_#7+ zmKB4kaeYb4q1=7+Sn>ZlZJ)mNs(m*4U+VIK6*)7mMnCPM9k&Do*Xn*$`3KcW{4kn< z1`?#v*O@c&0SFzuAVQhAZKG@~s8fV+5XT^h)K)G}-;*ObOsC>d(z1P~BoE6y?|x*@ V_UKfvl7;3rNh(7BDyLwdn-0q-VYvVR literal 0 HcmV?d00001 diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 2bd42aa6..e4cbfbe8 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -18566,8 +18566,19 @@ fn decode_block_128rect( let mi_rows = 2 * y.true_height.div_ceil(8); let max_w_mi = (bw / MI).min(mi_cols.saturating_sub(mi_c)); let max_h_mi = (bh / MI).min(mi_rows.saturating_sub(mi_r)); - // Non-lossless: one 32x32 chroma unit per mu chunk, per plane. - debug_assert!(lossless_frame || (chroma_w / chroma_tx, chroma_h / chroma_tx) == (nch_x, nch_y)); + // Non-lossless: per mu chunk, the chroma units per axis are + // ((64 >> ss_x) / chroma_tx, (64 >> ss_y) / chroma_tx) -- one 32x32 unit + // per chunk at 4:2:0, TWO stacked on the tall axis at 4:2:2 (the chunk's + // chroma plane block is 32x64), four at 4:4:4. The old square-cut assert + // demanded one unit per chunk on BOTH axes, which no 4:2:2 stream can + // satisfy (lane-av1-422bigblock: the s2.obu witness). + let chunk_cw = (64usize) >> ss_x(fctx); + let chunk_ch = (64usize) >> ss_y(fctx); + debug_assert!( + lossless_frame + || (nch_x * (chunk_cw / chroma_tx), nch_y * (chunk_ch / chroma_tx)) + == (chroma_w / chroma_tx, chroma_h / chroma_tx) + ); let tpc = 64 / logical_tx; let zero_tu = vec![0i32; logical_tx * logical_tx]; let zero_cu = vec![0i32; chroma_tx * chroma_tx]; @@ -18576,6 +18587,7 @@ fn decode_block_128rect( // The chroma context arrays are indexed in LUMA mi; every chroma unit of // every chunk shares this luma span (2 chroma pixels per luma unit). let luma_span = chroma_tx << ss_x(fctx); + let luma_span_h = chroma_tx << ss_y(fctx); for ch_row in 0..nch_y { for ch_col in 0..nch_x { for tu_row in ch_row * tpc..(ch_row + 1) * tpc { @@ -18645,9 +18657,12 @@ fn decode_block_128rect( neighbours.record_mi_luma(tu_mi, logical_tx, &tu_grid); } } - // Transform units per axis inside this mu chunk's 32x32 chroma - // span: one 32x32 unit normally, 8x8 TX_4X4 units when lossless. - let cn = (32 / chroma_tx).max(1); + // Transform units per axis inside this mu chunk's chroma span + // -- (64 >> ss_x) x (64 >> ss_y): one 32x32 unit at 4:2:0, TWO + // stacked TX_32X32 at 4:2:2, four at 4:4:4; 8x8 TX_4X4 units + // when lossless. + let cn_w = (chunk_cw / chroma_tx).max(1); + let cn_h = (chunk_ch / chroma_tx).max(1); // libaom's per-chunk `unit_width/height` (plane-mi units of the // luma mi grid): `min(mu_blocks + col, max_blocks) >> ss`. let unit_w = ((ch_col + 1) * 16).min(max_w_mi) >> ss_x(fctx); @@ -18659,25 +18674,28 @@ fn decode_block_128rect( // symbol order the interleaved pair used to read; a lossless // frame's 4x4 chroma units are where it becomes observable. for plane_pass in 1..=2usize { - for ci_row in 0..cn { - for ci_col in 0..cn { - if ch_col * 8 + ci_col * stepc >= unit_w - || ch_row * 8 + ci_row * stepc >= unit_h + for ci_row in 0..cn_h { + for ci_col in 0..cn_w { + // The clamp strides are the CHUNK's chroma mi extent + // per axis: 16 luma mi >> the axis's own ss. + if ch_col * (16 >> ss_x(fctx)) + ci_col * stepc >= unit_w + || ch_row * (16 >> ss_y(fctx)) + ci_row * stepc >= unit_h { continue; } - let cu_x = cpx + ch_col * 32 + ci_col * chroma_tx; - let cu_y = cpy + ch_row * 32 + ci_row * chroma_tx; + let cu_x = cpx + ch_col * chunk_cw + ci_col * chroma_tx; + let cu_y = cpy + ch_row * chunk_ch + ci_row * chroma_tx; let cu_mi = ( mi_r + ch_row * 16 + ci_row * ((chroma_tx << ss_y(fctx)) / 4), mi_c + ch_col * 16 + ci_col * ((chroma_tx << ss_x(fctx)) / 4), ); - let cu_r = tu_reach( + let cu_r = tu_reach_rect( bw, bh, ch_col * 64 + ci_col * luma_span, - ch_row * 64 + ci_row * luma_span, + ch_row * 64 + ci_row * luma_span_h, luma_span, + luma_span_h, reach, px, py, @@ -18691,7 +18709,8 @@ fn decode_block_128rect( ); continue; } - let cu_around = neighbours.around_mi(cu_mi, luma_span); + let cu_around = + neighbours.around_mi_rect(cu_mi, luma_span, luma_span_h); let buf: &mut PlaneBuf<'static> = if plane_pass == 1 { &mut *u } else { &mut *v }; let grid = read_plane( @@ -18705,7 +18724,13 @@ fn decode_block_128rect( // reads this one's coefficient context; replayed after // `record_split_luma_rect` below, which would otherwise // clobber them whole-block. - neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, plane_pass, &grid); + neighbours.record_mi_chroma( + cu_mi, + luma_span, + luma_span_h, + plane_pass, + &grid, + ); units.push((plane_pass, cu_mi, grid)); } } @@ -30233,15 +30258,42 @@ impl<'p> RefPix<'p> { ( whole_plane(&g.y, g.width, g.height), { - // Reference pictures carry no subsampling field. A - // 4:4:4 chroma plane is luma-sized; 4:2:0 is the quarter. - let full = g.u.len() == g.width * g.height; - let (cw, ch) = if full { (g.width, g.height) } else { (g.width / 2, g.height / 2) }; + // Reference pictures carry no subsampling field -- the + // plane's own shape is inferred from its length: + // luma-sized is 4:4:4, `halfw x height` is 4:2:2 + // (ss_x 1, ss_y 0 -- the chroma plane is HALF-width + // and FULL-height), `halfw x halfh` is 4:2:0. The + // three lengths are pairwise distinct for every + // w, h >= 1, so the guess is exact. The old + // two-way guess read every 4:2:2 reference as + // quarter-height: a 128x128 frame's chroma resolved + // 64x64, the bottom mu-chunk row's prediction + // sampled a clamped row-63 edge and the frame's + // own pixels were right (the crop is ss-aware) -- + // only INTER prediction off the slot was wrong + // (lane-av1-422bigblock: the sb128 witness's + // frame-2 chroma, rows 64..127). + let halfw = (g.width + 1) / 2; + let halfh = (g.height + 1) / 2; + let (cw, ch) = if g.u.len() == g.width * g.height { + (g.width, g.height) + } else if g.u.len() == halfw * g.height { + (halfw, g.height) + } else { + (halfw, halfh) + }; whole_plane(&g.u, cw, ch) }, { - let full = g.v.len() == g.width * g.height; - let (cw, ch) = if full { (g.width, g.height) } else { (g.width / 2, g.height / 2) }; + let halfw = (g.width + 1) / 2; + let halfh = (g.height + 1) / 2; + let (cw, ch) = if g.v.len() == g.width * g.height { + (g.width, g.height) + } else if g.v.len() == halfw * g.height { + (halfw, g.height) + } else { + (halfw, halfh) + }; whole_plane(&g.v, cw, ch) }, ) @@ -32828,7 +32880,7 @@ fn decode_inter_block( pu0.true_width, pu0.true_height, mv_to_q4(cpx, mv0.1, ss_x(fctx)), - mv_to_q4(cpy, mv0.0, ss_x(fctx)), + mv_to_q4(cpy, mv0.0, ss_y(fctx)), scale0, chroma_stride, chroma_buf_h, @@ -32856,7 +32908,7 @@ fn decode_inter_block( pu1.true_width, pu1.true_height, mv_to_q4(cpx, mv1.1, ss_x(fctx)), - mv_to_q4(cpy, mv1.0, ss_x(fctx)), + mv_to_q4(cpy, mv1.0, ss_y(fctx)), scale1, chroma_stride, chroma_buf_h, @@ -32906,7 +32958,7 @@ fn decode_inter_block( pv0.true_width, pv0.true_height, mv_to_q4(cpx, mv0.1, ss_x(fctx)), - mv_to_q4(cpy, mv0.0, ss_x(fctx)), + mv_to_q4(cpy, mv0.0, ss_y(fctx)), scale0, chroma_stride, chroma_buf_h, @@ -32934,7 +32986,7 @@ fn decode_inter_block( pv1.true_width, pv1.true_height, mv_to_q4(cpx, mv1.1, ss_x(fctx)), - mv_to_q4(cpy, mv1.0, ss_x(fctx)), + mv_to_q4(cpy, mv1.0, ss_y(fctx)), scale1, chroma_stride, chroma_buf_h, @@ -33176,18 +33228,35 @@ fn decode_inter_block( // this arm has always coded. `chroma_side` // already carries the subsampling. let cu_tx = 32usize; - let chunk_chroma = chroma_side * 64 / side; - let units = chunk_chroma / cu_tx; + // lane-av1-422bigblock: a 64x64 mu chunk's + // chroma plane block is PER-AXIS + // (64 >> ss_x) x (64 >> ss_y) -- 32x64 at + // ss (1,0), i.e. TWO stacked TX_32X32 units + // per plane (`av1_get_max_uv_txsize` caps the + // unit at 32 on each axis). The old square-cut + // model walked `chroma_side`-square chunks: + // twice the units the oracle codes at 4:2:2, + // prediction windows indexed at the square + // `chroma_side` instead of the prediction + // buffer's own `chroma_stride`, and chunk + // columns at 64.. of a 64-wide chroma plane. + let chunk_chroma_w = (64usize) >> ss_x(fctx); + let chunk_chroma_h = (64usize) >> ss_y(fctx); + let units_w = chunk_chroma_w / cu_tx; + let units_h = chunk_chroma_h / cu_tx; // The unit's own footprint on the LUMA mi - // grid: 64 px (16 mi) at 4:2:0, 32 px (8 mi) - // at ss 0/0. `around_mi` reads and + // grid, per axis (32 << ss) px: 64x64 (16x16 + // mi) at 4:2:0, 32x32 (8x8 mi) at 4:4:4, + // 64x32 (16x8 mi) at 4:2:2. `around_mi_rect` + // reads and // `record_mi_chroma` stamps span exactly the // unit's own cells -- `get_txb_ctx` reads the // 8 context cells of the TX_32X32 itself, and // `av1_set_entropy_contexts` memsets the same // 8, so the unit over never sees this unit's // state and the unit below always does. - let unit_luma = cu_tx * (side / chroma_side); + let unit_luma_w = cu_tx << ss_x(fctx); + let unit_luma_h = cu_tx << ss_y(fctx); let cu_scan = default_scan(cu_tx); if lossless(fctx) { // lane-lossless2: TX_4X4 units over this @@ -33195,8 +33264,8 @@ fn decode_inter_block( read_inter_chroma_lossless( dec, cdfs, neighbours, u, v, su, sv, at_mi, (cpx, cpy), - (cc * chunk_chroma, cr * chunk_chroma), - (chunk_chroma, chunk_chroma), + (cc * chunk_chroma_w, cr * chunk_chroma_h), + (chunk_chroma_w, chunk_chroma_h), (write_chroma_w, write_chroma_h), chroma_side, mode_for_tx, base_q_idx, &mut u_units, &mut v_units, fctx, @@ -33213,24 +33282,28 @@ fn decode_inter_block( // Plane-major per chunk (libaom's plane // loop is outermost inside the mu walk); // within a plane the units walk raster. - for ur in 0..units { - for uc in 0..units { + for ur in 0..units_h { + for uc in 0..units_w { let unit_mi = ( at_mi.0 + cr * 16 - + ur * (unit_luma / MI), + + ur * (unit_luma_h / MI), at_mi.1 + cc * 16 - + uc * (unit_luma / MI), + + uc * (unit_luma_w / MI), ); // Per unit, AFTER the earlier // units' stamps: this unit's // coefficient context must see // them. let cu_around = neighbours - .around_mi(unit_mi, unit_luma); + .around_mi_rect( + unit_mi, + unit_luma_w, + unit_luma_h, + ); let (cu_x, cu_y) = ( - cpx + cc * chunk_chroma + cpx + cc * chunk_chroma_w + uc * cu_tx, - cpy + cr * chunk_chroma + cpy + cr * chunk_chroma_h + ur * cu_tx, ); // `av1_get_tx_type` (blockd.h: @@ -33261,11 +33334,16 @@ fn decode_inter_block( }, ) .map(|(_, _, _, _, t)| t); + // The prediction buffer is + // `chroma_stride`-strided (the + // plane block's own width at + // 4:2:2), not the square + // `chroma_side`. let cu_pred = src.offset( - (cr * chunk_chroma + (cr * chunk_chroma_h + ur * cu_tx) - * chroma_side - + cc * chunk_chroma + * chroma_stride + + cc * chunk_chroma_w + uc * cu_tx, ); let cu_grid = read_inter_plane( @@ -33295,8 +33373,8 @@ fn decode_inter_block( // context. neighbours.record_mi_chroma( unit_mi, - unit_luma, - unit_luma, + unit_luma_w, + unit_luma_h, plane_idx, &cu_grid, ); @@ -33311,11 +33389,18 @@ fn decode_inter_block( chroma_side * chroma_side, ); for rr in 0..cu_tx { - let start = (cr * chunk_chroma + // The ASSEMBLED grid stays at + // the square `chroma_side` + // stride the block tail's + // `mu_chroma_units` re-stamp + // indexes; the unit's true + // per-axis position is what + // changes. + let start = (cr * chunk_chroma_h + ur * cu_tx + rr) * chroma_side - + cc * chunk_chroma + + cc * chunk_chroma_w + uc * cu_tx; dst[start..start + cu_tx] .copy_from_slice( @@ -34262,7 +34347,7 @@ fn decode_inter_block( pu_ref.true_width, pu_ref.true_height, mv_to_q4(cpx, mv.1, ss_x(fctx)), - mv_to_q4(cpy, mv.0, ss_x(fctx)), + mv_to_q4(cpy, mv.0, ss_y(fctx)), chroma_stride, chroma_buf_h, write_chroma_w, @@ -34277,7 +34362,7 @@ fn decode_inter_block( pv_ref.true_width, pv_ref.true_height, mv_to_q4(cpx, mv.1, ss_x(fctx)), - mv_to_q4(cpy, mv.0, ss_x(fctx)), + mv_to_q4(cpy, mv.0, ss_y(fctx)), chroma_stride, chroma_buf_h, write_chroma_w, @@ -34309,7 +34394,7 @@ fn decode_inter_block( pu_ref.true_width, pu_ref.true_height, mv_to_q4(cpx, mv.1, ss_x(fctx)), - mv_to_q4(cpy, mv.0, ss_x(fctx)), + mv_to_q4(cpy, mv.0, ss_y(fctx)), luma_scale, chroma_stride, chroma_buf_h, @@ -34325,7 +34410,7 @@ fn decode_inter_block( pv_ref.true_width, pv_ref.true_height, mv_to_q4(cpx, mv.1, ss_x(fctx)), - mv_to_q4(cpy, mv.0, ss_x(fctx)), + mv_to_q4(cpy, mv.0, ss_y(fctx)), luma_scale, chroma_stride, chroma_buf_h, @@ -34420,7 +34505,7 @@ fn decode_inter_block( src.true_width, src.true_height, mv_to_q4(cpx, prev_mv.1, ss_x(fctx)), - mv_to_q4(cpy, prev_mv.0, ss_x(fctx)), + mv_to_q4(cpy, prev_mv.0, ss_y(fctx)), prev_scale, piece_w, piece_h, @@ -34676,18 +34761,35 @@ fn decode_inter_block( // this arm has always coded. `chroma_side` // already carries the subsampling. let cu_tx = 32usize; - let chunk_chroma = chroma_side * 64 / side; - let units = chunk_chroma / cu_tx; + // lane-av1-422bigblock: a 64x64 mu chunk's + // chroma plane block is PER-AXIS + // (64 >> ss_x) x (64 >> ss_y) -- 32x64 at + // ss (1,0), i.e. TWO stacked TX_32X32 units + // per plane (`av1_get_max_uv_txsize` caps the + // unit at 32 on each axis). The old square-cut + // model walked `chroma_side`-square chunks: + // twice the units the oracle codes at 4:2:2, + // prediction windows indexed at the square + // `chroma_side` instead of the prediction + // buffer's own `chroma_stride`, and chunk + // columns at 64.. of a 64-wide chroma plane. + let chunk_chroma_w = (64usize) >> ss_x(fctx); + let chunk_chroma_h = (64usize) >> ss_y(fctx); + let units_w = chunk_chroma_w / cu_tx; + let units_h = chunk_chroma_h / cu_tx; // The unit's own footprint on the LUMA mi - // grid: 64 px (16 mi) at 4:2:0, 32 px (8 mi) - // at ss 0/0. `around_mi` reads and + // grid, per axis (32 << ss) px: 64x64 (16x16 + // mi) at 4:2:0, 32x32 (8x8 mi) at 4:4:4, + // 64x32 (16x8 mi) at 4:2:2. `around_mi_rect` + // reads and // `record_mi_chroma` stamps span exactly the // unit's own cells -- `get_txb_ctx` reads the // 8 context cells of the TX_32X32 itself, and // `av1_set_entropy_contexts` memsets the same // 8, so the unit over never sees this unit's // state and the unit below always does. - let unit_luma = cu_tx * (side / chroma_side); + let unit_luma_w = cu_tx << ss_x(fctx); + let unit_luma_h = cu_tx << ss_y(fctx); let cu_scan = default_scan(cu_tx); if lossless(fctx) { // lane-lossless2: TX_4X4 units over this @@ -34695,8 +34797,8 @@ fn decode_inter_block( read_inter_chroma_lossless( dec, cdfs, neighbours, u, v, su, sv, at_mi, (cpx, cpy), - (cc * chunk_chroma, cr * chunk_chroma), - (chunk_chroma, chunk_chroma), + (cc * chunk_chroma_w, cr * chunk_chroma_h), + (chunk_chroma_w, chunk_chroma_h), (write_chroma_w, write_chroma_h), chroma_side, mode_for_tx, base_q_idx, &mut u_units, &mut v_units, fctx, @@ -34713,24 +34815,28 @@ fn decode_inter_block( // Plane-major per chunk (libaom's plane // loop is outermost inside the mu walk); // within a plane the units walk raster. - for ur in 0..units { - for uc in 0..units { + for ur in 0..units_h { + for uc in 0..units_w { let unit_mi = ( at_mi.0 + cr * 16 - + ur * (unit_luma / MI), + + ur * (unit_luma_h / MI), at_mi.1 + cc * 16 - + uc * (unit_luma / MI), + + uc * (unit_luma_w / MI), ); // Per unit, AFTER the earlier // units' stamps: this unit's // coefficient context must see // them. let cu_around = neighbours - .around_mi(unit_mi, unit_luma); + .around_mi_rect( + unit_mi, + unit_luma_w, + unit_luma_h, + ); let (cu_x, cu_y) = ( - cpx + cc * chunk_chroma + cpx + cc * chunk_chroma_w + uc * cu_tx, - cpy + cr * chunk_chroma + cpy + cr * chunk_chroma_h + ur * cu_tx, ); // `av1_get_tx_type` (blockd.h: @@ -34761,11 +34867,16 @@ fn decode_inter_block( }, ) .map(|(_, _, _, _, t)| t); + // The prediction buffer is + // `chroma_stride`-strided (the + // plane block's own width at + // 4:2:2), not the square + // `chroma_side`. let cu_pred = src.offset( - (cr * chunk_chroma + (cr * chunk_chroma_h + ur * cu_tx) - * chroma_side - + cc * chunk_chroma + * chroma_stride + + cc * chunk_chroma_w + uc * cu_tx, ); let cu_grid = read_inter_plane( @@ -34795,8 +34906,8 @@ fn decode_inter_block( // context. neighbours.record_mi_chroma( unit_mi, - unit_luma, - unit_luma, + unit_luma_w, + unit_luma_h, plane_idx, &cu_grid, ); @@ -34811,11 +34922,18 @@ fn decode_inter_block( chroma_side * chroma_side, ); for rr in 0..cu_tx { - let start = (cr * chunk_chroma + // The ASSEMBLED grid stays at + // the square `chroma_side` + // stride the block tail's + // `mu_chroma_units` re-stamp + // indexes; the unit's true + // per-axis position is what + // changes. + let start = (cr * chunk_chroma_h + ur * cu_tx + rr) * chroma_side - + cc * chunk_chroma + + cc * chunk_chroma_w + uc * cu_tx; dst[start..start + cu_tx] .copy_from_slice( @@ -39382,7 +39500,7 @@ fn decode_inter_block8( pu0.true_width, pu0.true_height, mv_to_q4(cpx, mv0.1, ss_x(fctx)), - mv_to_q4(cpy, mv0.0, ss_x(fctx)), + mv_to_q4(cpy, mv0.0, ss_y(fctx)), scale0, chroma_w, chroma_h, @@ -39397,7 +39515,7 @@ fn decode_inter_block8( pu1.true_width, pu1.true_height, mv_to_q4(cpx, mv1.1, ss_x(fctx)), - mv_to_q4(cpy, mv1.0, ss_x(fctx)), + mv_to_q4(cpy, mv1.0, ss_y(fctx)), scale1, chroma_w, chroma_h, @@ -39429,7 +39547,7 @@ ss_y(fctx), pv0.true_width, pv0.true_height, mv_to_q4(cpx, mv0.1, ss_x(fctx)), - mv_to_q4(cpy, mv0.0, ss_x(fctx)), + mv_to_q4(cpy, mv0.0, ss_y(fctx)), scale0, chroma_w, chroma_h, @@ -39444,7 +39562,7 @@ ss_y(fctx), pv1.true_width, pv1.true_height, mv_to_q4(cpx, mv1.1, ss_x(fctx)), - mv_to_q4(cpy, mv1.0, ss_x(fctx)), + mv_to_q4(cpy, mv1.0, ss_y(fctx)), scale1, chroma_w, chroma_h, diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index fc5f3f9f..40602509 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -2209,6 +2209,62 @@ pub(crate) mod tests { let frames = decode_stream(&stream).expect("the 4:2:0 control must decode"); assert_eq!(frames.len(), 1, "{NAME}: the 4:2:0 control decoded no frame"); } + /// lane-av1-422bigblock: the two witnessed 4:2:2 big-block defects, pinned + /// as fixtures (`git add -f`; `fixtures/` is gitignored). + /// + /// `422_allskip_2f.obu` (62 bytes) is a 128x128 profile-2 key frame plus + /// its all-skip first inter frame: the pre-port decoder read phantom + /// coefficient units in the inter frame and then panicked in + /// `reconstruct_mc_rect` on a full-height 4:2:2 chroma rect. At this + /// lane's HEAD the block-half port's per-axis plane-block model already + /// has it entropy-locked (all 20 key-frame coefficient units pair + /// rng-for-rng with the instrumented oracle, the inter frame reads + /// zero, matching the oracle) and pixel-exact vs aomdec. + /// + /// `422_sb128_3f.obu` (12543 bytes) carries the f2 128x128 + /// `PARTITION_NONE` non-skip inter block: the mu-chunk chroma walk cut + /// each chunk's 32x64 chroma into a `chroma_side`-square 64x64 (twice + /// the units the oracle codes), indexed the prediction buffer at the + /// square `chroma_side` instead of `chroma_stride` (the empty-slice + /// panic at `push_mc_rect_tx`'s densify), and the reference plane + /// resolution guessed every non-4:4:4 picture quarter-height, so the + /// bottom mu-chunk row predicted from a clamped row-63 edge. All fixed; + /// both witnesses decode pixel-exact vs aomdec on the lane's local + /// `EC_AV1_ALLOW_422_PROBE` patch-run-restore build (recipe and measured + /// numbers in `lanes/av1422bigblock.report.md`). + /// + /// `decode_stream` itself still refuses 4:2:2 at the sequence header -- + /// unconditionally, per the standing family rule -- so the committed + /// assertion is the byte pin (fnv1a64, the same load-bearing-identity + /// fingerprint as the cdf-forwarding gate) plus the refusal-by-name + /// contract over the pinned bytes. + #[test] + fn the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name() { + const NAME: &str = "the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name"; + const REFUSAL: &str = "a chroma format of 4:2:2"; + for (file, bytes, fp) in [ + ("422_allskip_2f.obu", 62usize, 0x7e4d69d3c728c55f_u64), + ("422_sb128_3f.obu", 12543, 0x5171e0aab8000da7), + ] { + let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR")) + .join("fixtures") + .join(file); + let data = std::fs::read(&path).unwrap_or_else(|e| { + panic!( + "{NAME}: pinned witness {} is missing ({e}) -- the gate cannot run", + path.display() + ) + }); + assert_eq!(data.len(), bytes, "{NAME}: {file} size drifted"); + assert_eq!(fnv1a64(&data), fp, "{NAME}: {file} bytes drifted"); + let err = decode_stream(&data).unwrap_err().to_string(); + assert!( + err.contains(REFUSAL), + "{NAME}: {file} must refuse by name, got: {err}" + ); + } + } + /// lane-av1-qmatrix: WITNESS for the lifted `using_qmatrix` refusal (the /// old gate `a_frame_using_quantisation_matrices_is_refused_by_name` is diff --git a/lanes/av1422bigblock.report.md b/lanes/av1422bigblock.report.md new file mode 100644 index 00000000..7ee938bd --- /dev/null +++ b/lanes/av1422bigblock.report.md @@ -0,0 +1,156 @@ +# lane-av1-422bigblock — the two witnessed 4:2:2 big-block defects + +Branch `lane-av1-422bigblock`, HEAD `213c1eb0` (contains the block-half port). +Target dir `$HOME/.cache/cargo-target-av1422bigblock` throughout. No push. + +## Verdict + +Both witnessed defects are fixed and both witnesses are pixel-exact vs aomdec. +The panic the ticket predicted for defect 1 no longer reproduces at this HEAD — +the block-half port had already fixed the all-skip inter frame; re-verified, not +assumed. Defect 2 needed three fixes, two of them found below the historical +panic line. The 4:2:0/4:4:4 behavior is unchanged (targeted gates green, t422 +frame 0 byte-exact at all four stages). Defect 3 (Main's IRC addition, the +s2.obu crash) is fixed as a crash; s2's remaining divergence is a pre-existing +sub-8 chroma class, fingerprinted for its owning lane. Committed code still +refuses 4:2:2 at the sequence header; the `EC_AV1_ALLOW_422_PROBE` bypass was +applied and reverted per probe run and is **not** in the commit. + +## Fixtures (pinned, `git add -f`; `fixtures/` is gitignored) + +| fixture | bytes | sha256 | fnv1a64 | +|---|---|---|---| +| `422_allskip_2f.obu` | 62 | `ba4932c14f95971b5f25321b04abce80c9fdd5de4b1fe6fffcdad82aaea87ce1` | `0x7e4d69d3c728c55f` | +| `422_sb128_3f.obu` | 12543 | `0b851799d99cb4d141a7d042138a3999aad7e0fb24d69c670bca1d38c286dce9` | `0x5171e0aab8000da7` | + +Provenance: the witness hunt's artifacts under `~/.cache/av1422sb128wit/` +(`422_allskip_2f.obu` = `b422_wit2f.obu`, `422_sb128_3f.obu` = `b422b_3f.obu`; +oracle refs `b422_wit.ref.yuv`). NOTE: the ticket said `422_sb128_3f.obu` is +10175 bytes; the live file is 12543 bytes and its sha256 matches the ticket — +the byte count in the charter is stale, the hash is authoritative. + +Gate: `the_pinned_422_bigblock_witnesses_are_present_and_refuse_by_name` +(stream.rs) asserts both byte pins and the refusal-by-name contract. +`decode_stream` still refuses 4:2:2 unconditionally in committed code, so a +committed gate cannot decode these streams; the decode-completes + counters + +pixel-exact assertions were measured through the probe build and are +reproducible from the recipe below. The counters over the sb128 witness: +`chroma422_square: 32`; over s2: `chroma422_square: 68, chroma422_rect: 222, +chroma422_sub8: 24, chroma422_chunk: 40`, `part128 none=3`. + +## Reproduce (patch-run-restore, local only) + +``` +sed 's/if seq.subsampling_x != seq.subsampling_y {/if seq.subsampling_x != seq.subsampling_y \&\& std::env::var_os("EC_AV1_ALLOW_422_PROBE").is_none() {/' -i crates/ec-av1/src/stream.rs +CARGO_TARGET_DIR=$HOME/.cache/cargo-target-av1422bigblock cargo build -p ec-av1 --example decode_probe --features gate-counters +EC_AV1_ALLOW_422_PROBE=1 EC_PROBE_OUT=/tmp/ours.raw \ + $HOME/.cache/cargo-target-av1422bigblock/debug/examples/decode_probe crates/ec-av1/fixtures/422_sb128_3f.obu +$HOME/.cache/aom-oracle/build/aomdec --rawvideo -o /tmp/oracle.raw crates/ec-av1/fixtures/422_sb128_3f.obu +cmp /tmp/ours.raw /tmp/oracle.raw # identical +git checkout -- crates/ec-av1/src/stream.rs +``` + +## Defect 1 — all-skip 422 inter desync: NOT REPRODUCING at HEAD (fixed upstream) + +At `213c1eb0` the witness decodes clean: `OK: 2 frames decoded, 128x128`, no +panic, no phantom reads. Evidence: + +- Entropy: our `EC_TRACE_COEFF` pairs rng-for-rng with the instrumented + oracle's — frame 0 codes 20 coefficient units (one nonzero 32x32 luma unit + + 4 stacked-chroma per 32x32 quadrant), identical rng sequence on both sides; + frame 1 codes **zero** units on both sides (all-skip, as the oracle). +- Pixels: the shown frame is byte-identical to `aomdec --rawvideo`. + +The ticket's "~20 phantom units + reconstruct_mc_rect side=64 w=64 h=128 panic" +is the pre-blockhalf state; the per-axis plane-block model fixed both the +phantom reads and the geometry. No code change needed here. The full hunt +stream `b422_wit.obu` (6 frames) also decodes OK at HEAD. + +## Defect 2 — 128-root square-cut chroma chunking: three stacked causes + +The historical `range end 4128 > 4096` (decode.rs:34279) no longer reproduces; +at HEAD the same block panicked deeper, in `push_mc_rect_tx`'s stride-densify +(`range end index 32 out of range for slice of length 0`). The f2 128x128 +PARTITION_NONE non-skip inter block carries all three causes; the oracle codes +16 chroma units (8 per plane, 2 stacked TX_32X32 per 64x64 mu chunk). + +1. **Square-cut chunking** (`decode_inter_block`, both the inter-luma and the + intra-in-inter walk): `chunk_chroma = chroma_side * 64 / side` cut each + chunk's per-axis `(64>>ss_x) x (64>>ss_y)` chroma into a + `chroma_side`-square 64x64 — twice the units the oracle codes at 4:2:2. + Fixed per-axis (`chunk_cw/chunk_ch`, `units_w/units_h`), unit luma spans + `(32<