diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index e07e064e..1a4e1417 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -29,6 +29,8 @@ fn main() { } }; let report = || { + let (sc, dp) = ec_av1::decode::reelc_chroma_counters(); + println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}"); let (h, v, c) = ec_av1::stream::rect4_32_counters(); println!("rect4_32: horz={h} vert={v} coded={c}"); let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); diff --git a/crates/ec-av1/fixtures/reelc_kf2700.obu b/crates/ec-av1/fixtures/reelc_kf2700.obu new file mode 100644 index 0000000000000000000000000000000000000000..34b2d365847aff013d1c881ab118dce8a5363a68 GIT binary patch literal 36785 zcmV+aKLEfI016HO002U#zvA!T&VYb`mNJ{40ui`{fPljU5I_I|yaE^i!9ef%L4XE^ z#*K;4&6kgV&rkqJpiM+?{BPf&;Gke2;9%jLoLb)C;N08#X~1hU1A;}A6?vA_+{W<<07`8;sXK!0f7L3{nk@l zuEh1j`*5^&w2{cZJ)k+4w7-&5@G|fU<{^g!j}c(*+5&~pX^m&1LfSte>2d$_fHPJ? z2syvQ?iPSX%Ne!O9ujLg@!*DUB^GO_-^+>gDU)%{9LKn-Q4k~CV4XF8W4053P~NMy z1oToJ;bp`Q?mZKbv7&TB#5h2-rlQZ=Sb&X6gSCbqK3M~}cpW$nxnGm9WP-`YYGviV z86K?52}RD*02X8~w%|^b%nC^Dppg~x!Rc1N2TyddC++10=`QkxPC_}22NY{3r^<13 zp)7?sS>7jjUg*ol91tMQ4vtX4Xln)cm!wF#`WZAit4%?F=5ftKBBqyVMHkjxQ z1Pi&=gR?oem~~Sx|F<*+%oKM`YzGf=ngwdQKJRG-a(qp_Qux9Vo|O_CyIuJDQO!sG z4=WOM|G-}0gjjfqK>=H0B-a^3LV(qTG1*QP-2`1-_oNrHYi_VK1by_SMFg5NzOZ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6*C5= zjw20+@6g^f2|U_!!_cn`3vJH50(!;^QCURMuZTy^gGRef0|<39Bc~%uieqNPY?c1e zEYjfr_CUS=6`7v0m2Tf-idyLEm7s(gCm)njGNc=iK4sQ0A2Qv#x9=sku!s%;A?D0J zwKJ|b#=3wqG0ZZSc{%?v5GC>73J&9pgw^FQ{eF&qcOU-6H5YbwvwKC2IFK^~oA=v? zL-F=NPoE%wS0Pv99!)9_im;JEnw1P03=%9~ESJDBid#vCr!I}1@G4~uf-a3m_W{Vf z13hClX~;g`|LTH#7YKt@LXZyx+l}v%YCcs?bJ7i|G*NU=M$kPP2>Rx<{Bx7Fe!wea z35;+%DE3#3F4@I#B!l!Qly}dQ{s(_nyU = const { std::cell::Cell::new(0) }; } +// lane-reelckf r1: the two chroma defects ReelC's key frames exposed -- +// CHROMA_SKIP_CFL counts skipped intra blocks whose chroma is `UV_CFL_PRED` +// (prediction still runs, libaom `predict_and_reconstruct_intra_block`), and +// RECT4_16_CHROMA_DIR counts 1:4 chroma pairs predicted directionally (whose +// intra-edge filter type must come from the chroma-reference position). +thread_local! { + static CHROMA_SKIP_CFL_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; + static RECT4_16_CHROMA_DIR_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// `(skipped UV_CFL_PRED blocks, directional 1:4 chroma pairs)` -- lane-reelckf. +pub fn reelc_chroma_counters() -> (usize, usize) { + ( + CHROMA_SKIP_CFL_HITS.with(|c| c.get()), + RECT4_16_CHROMA_DIR_HITS.with(|c| c.get()), + ) +} + /// Current values of the 16x16-level 1:4 counters: `(16x4 strips, 4x16 /// strips, chroma-reference strips, strips with a coded residual, strips /// whose luma transform is split)`. @@ -4879,6 +4901,32 @@ impl Neighbours { self.record_mi_luma_rect(at_mi, tx_px, tx_px, grid); } + /// [`Self::record_mi_luma`] for ONE CHROMA transform unit of a block whose + /// uv plane block is several units (lane-sb128b r2: a 128x128 block's + /// 64x64 uv plane block is four TX_32X32 units, `av1_get_max_uv_txsize`). + /// `w_px`/`h_px` are the unit's extent in LUMA pixels -- the chroma + /// coefficient-context arrays are indexed by luma mi, the convention + /// [`Self::record_split_luma_rect_mi`] already writes them in, frame-edge + /// clamp included. + fn record_mi_chroma( + &mut self, + (mi_r, mi_c): (usize, usize), + w_px: usize, + h_px: usize, + plane: usize, + grid: &[i32], + ) { + let round_up_even = |n: usize| n.div_ceil(2) * 2; + let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols)); + let state = neighbour_state(grid); + for cell in 0..(h_px / MI).min(bound_h.saturating_sub(mi_r)) { + self.left[mi_r + cell][plane] = state; + } + for cell in 0..(w_px / MI).min(bound_w.saturating_sub(mi_c)) { + self.above[mi_c + cell][plane] = state; + } + } + /// [`Self::record_mi_luma`] for a RECTANGULAR transform unit (lane-rectsplitx /// r1): the above context spans the unit's width, the left context its /// height, which for a square unit is the same loop it always was. @@ -7716,11 +7764,30 @@ fn decode_rect4_16( let (cpx, cpy) = (ppx / 2, ppy / 2); let (cw, ch) = (pw / 2, ph / 2); let uv_predict_mode = if uv_mode == UV_CFL_PRED { DC_PRED } else { uv_mode }; + if (V_PRED..=D67_PRED).contains(&uv_predict_mode) { + RECT4_16_CHROMA_DIR_HITS.with(|h| h.set(h.get() + 1)); + } let pair_reach = Reach::of_rect(pw, ph, ppx, ppy, y.width, y.height); - let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(lmi.0, lmi.1, r, c); + // libaom `get_intra_edge_filter_type` reads `chroma_above_mbmi` / + // `chroma_left_mbmi` -- the neighbours of the CHROMA REFERENCE + // position, not of the closing strip. At `lmi` the above cell is + // the pair's own first strip, so the mi-exact map missed and the + // coarse fallback answered; the filter type then flipped the + // `use_intra_edge_upsample` decision (blk_wh 12 <= 16 for type 0, + // no upsample for type 1) on directional chroma. + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(pair_mi.0, pair_mi.1, r, c); let (u_levels, v_levels) = if skip { let zeros = vec![0i32; cw * ch]; - for (buf, _plane) in [(&mut *u, 1usize), (&mut *v, 2)] { + // libaom `predict_and_reconstruct_intra_block` (decodeframe.c + // ~1000) predicts EVERY plane and only guards the residual on + // `mbmi->skip_txfm`, so a skipped `UV_CFL_PRED` block is still + // DC + alpha * luma-AC. Dropping the CfL term here left a + // chroma-only bounded box on ReelC's key frames. + let ac = alpha.map(|_| cfl_ac_q3_rect(y, ppx, ppy, pw, ph)); + if alpha.is_some() { + CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); + } + for (buf, plane) in [(&mut *u, 1usize), (&mut *v, 2)] { buf.reconstruct_rect( cpx, cpy, @@ -7730,7 +7797,9 @@ fn decode_rect4_16( angle_delta_uv, pair_reach, &zeros, - None, + alpha + .zip(ac.as_deref()) + .map(|((au, av), ac)| (if plane == 1 { au } else { av }, ac)), None, smooth_neighbor_uv, ); @@ -8443,8 +8512,12 @@ fn read_intra_mode( // `segment_id`, `cdef`, `delta_q` -- `cdef` lands right here. maybe_read_cdef_idx(dec, mi_r, mi_c, skip); istep!("cdef", 0); - maybe_read_delta_q(dec, cdfs, mi_r, mi_c, side == 64, skip); - maybe_read_delta_lf(dec, cdfs, mi_r, mi_c, side == 64, skip); + // lane-sb128b r1: "this leaf IS the superblock" is `side == sb_size`, not + // a hardcoded 64 -- a `PARTITION_NONE` 128x128 root is the whole + // superblock and skips `delta_q` exactly like a 64 one under a 64 root. + let whole_sb = side == sb_mi_cur() as usize * 4; + maybe_read_delta_q(dec, cdfs, mi_r, mi_c, whole_sb, skip); + maybe_read_delta_lf(dec, cdfs, mi_r, mi_c, whole_sb, skip); istep!("dq", 0); // `read_intrabc_info` (spec 5.11.13, libaom decodemv.c:693, called at // :811 right after `skip_txfm`/`segment_id`/`cdef`/`delta_q` and before @@ -9138,7 +9211,12 @@ fn read_plane( let skip_ctx = if plane_idx == 0 { luma_skip_ctx.unwrap_or(0) } else { - usize::from(around.0) + usize::from(around.1) + // libaom `get_txb_ctx`: a chroma unit's context is + // `combine_entropy_contexts(above, left)` plus 7, or plus 10 when the + // plane block is bigger than the transform. Our chroma tables hold the + // offset-7 rows first, so the caller adds 3 for the bigger-block case + // (only a 128x128 block's TX_32X32 chroma units, lane-sb128b r3). + usize::from(around.0) + usize::from(around.1) + luma_skip_ctx.unwrap_or(0) }; // spec 5.11.47/libaom `av1_read_tx_type`: a filter-intra luma block's // `intra_ext_tx_cdf` row is indexed by `fimode_to_intradir[filter_intra_mode]`, @@ -9323,7 +9401,11 @@ fn decode_block( let resolved = read_tx_size(dec, cdfs, neighbours, (mi_r, mi_c), side, None); (resolved, if resolved == 64 { 32 } else { resolved }) } else { - (side, luma_tx) + // lane-sb128b r1: `max_txsize_rect_lookup[BLOCK_128X128]` is + // TX_64X64, so a 128x128 block is always FOUR luma transform units + // even with `tx_select` off -- the TU loop below, never the + // single-unit path. + (side.min(64), luma_tx) }; if tx_select && logical_tx < side && uv_mode != DC_PRED { SQ_CHROMA_TX_HITS.with(|c| c.set(c.get() + 1)); @@ -9428,10 +9510,17 @@ fn decode_block( // The palette/intrabc override path keeps the single-call shape (its // per-TU windowing is the non-skip loop's own `palette_y_buf` slice, // untested for skip and unreachable in these streams). + // lane-sb128b r2: a 128x128 block's transform is TX_64X64 even with + // `tx_select` off (`max_txsize_rect_lookup[BLOCK_128X128]`), so the + // per-unit prediction is keyed on the transform being smaller than + // the block, not on the tx-depth syntax. The counter keeps lane-hgkf's + // narrower meaning (a READ split tx depth). let split_tx_skip = - tx_select && logical_tx < side && palette_y_buf.is_none() && intrabc_bufs.is_none(); + logical_tx < side && palette_y_buf.is_none() && intrabc_bufs.is_none(); if split_tx_skip { - SKIP_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1)); + if tx_select { + SKIP_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1)); + } let n_axis = side / logical_tx; for tu_row in 0..n_axis { for tu_col in 0..n_axis { @@ -9481,41 +9570,62 @@ fn decode_block( ); } let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); - if let Some((ub, _)) = &palette_uv_bufs { - set_palette_pred(ub.clone()); - } - u.reconstruct( - cpx, - cpy, - chroma_side, - uv_predict_mode, - angle_delta_uv, - reach, - &vec![0i32; chroma_side * chroma_side], - alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), - None, - smooth_neighbor_uv, - ); - if let Some((_, vb)) = &palette_uv_bufs { - set_palette_pred(vb.clone()); + let cn = (chroma_side / chroma_tx).max(1); + for cu_row in 0..cn { + for cu_col in 0..cn { + let luma_span = chroma_tx * 2; + let cu_r = if cn == 1 { + reach + } else { + tu_reach( + side, side, + cu_col * luma_span, cu_row * luma_span, luma_span, + reach, px, py, y.width, y.height, + ) + }; + let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx); + if let Some((ub, _)) = &palette_uv_bufs { + set_palette_pred(ub.clone()); + } + u.reconstruct( + cu_x, + cu_y, + chroma_tx, + uv_predict_mode, + angle_delta_uv, + cu_r, + &vec![0i32; chroma_tx * chroma_tx], + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), + None, + smooth_neighbor_uv, + ); + if let Some((_, vb)) = &palette_uv_bufs { + set_palette_pred(vb.clone()); + } + v.reconstruct( + cu_x, + cu_y, + chroma_tx, + uv_predict_mode, + angle_delta_uv, + cu_r, + &vec![0i32; chroma_tx * chroma_tx], + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), + None, + smooth_neighbor_uv, + ); + } } - v.reconstruct( - cpx, - cpy, - chroma_side, - uv_predict_mode, - angle_delta_uv, - reach, - &vec![0i32; chroma_side * chroma_side], - alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), - None, - smooth_neighbor_uv, - ); let luma_grid = vec![0i32; side * side]; let u_grid = vec![0i32; chroma_side * chroma_side]; let v_grid = vec![0i32; chroma_side * chroma_side]; neighbours.record(at, side, mode, uv_predict_mode, &[luma_grid, u_grid, v_grid]); - } else if !tx_select || logical_tx == side { + } else if logical_tx == side { + // lane-sb128b r1: the test used to be `!tx_select || logical_tx == side`. + // Without `tx_select` `logical_tx` IS `side` at every size <= 64, so + // that arm was redundant -- and wrong at 128, where + // `max_txsize_rect_lookup` caps the block's transform at 64 and the + // block is four units whether or not `tx_select` is on. // A single luma transform unit -- the old path, unchanged (including // the 64x64 corner case, `logical_tx == side == 64` with // `coeff_tx_side == 32`). @@ -9608,8 +9718,27 @@ fn decode_block( // the earlier tiles in this same block already wrote -- the same // per-TU pattern [`decode_leaf8`] already runs for an 8x8 leaf. let n_axis = side / logical_tx; - for tu_row in 0..n_axis { - for tu_col in 0..n_axis { + let cn = (chroma_side / chroma_tx).max(1); + // libaom's transform-block loop is over 64x64 luma "mu" chunks + // (`decode_token_recon_block`: `mu_blocks_wide/high` = + // `mi_size_wide[BLOCK_64X64]`), and it codes EVERY PLANE of a chunk + // before moving to the next one. Below 128 a block is a single chunk, + // so this is byte-for-byte the all-luma-then-all-chroma order that has + // always run; at 128 the four quadrants interleave Y,U,V per quadrant + // and reading all four luma units first desyncs the tile at the second + // one (lane-sb128b r3, measured against aomdec's `EC_TRACE_COEFF`). + let nchunk = (side / 64).max(1); + // `cn > 1` means the uv plane block is larger than the uv transform, + // which moves libaom's chroma `txb_skip_ctx` offset from 7 to 10. + let chroma_ctx_offset = if cn > 1 { Some(3) } else { None }; + let tpc = (n_axis / nchunk).max(1); + let cpc = (cn / nchunk).max(1); + let mut last_grids = [Vec::new(), Vec::new()]; + let mut units: Vec<((usize, usize), usize, Vec, Vec)> = Vec::new(); + for ch_row in 0..nchunk { + for ch_col in 0..nchunk { + for tu_row in ch_row * tpc..(ch_row + 1) * tpc { + for tu_col in ch_col * tpc..(ch_col + 1) * tpc { let tu_mi = ( mi_r + tu_row * (logical_tx / MI), mi_c + tu_col * (logical_tx / MI), @@ -9670,7 +9799,11 @@ fn decode_block( tu_px, tu_py, logical_tx, - logical_tx, + // The unit's own COEFFICIENT grid, half its side at + // TX_64X64 (a 64-point transform codes nothing past 32); + // identical to `logical_tx` at every smaller size + // (lane-sb128b r1). + coeff_tx_side, base_q_idx, None, filter_intra, @@ -9688,59 +9821,81 @@ fn decode_block( neighbours.record_mi_luma(tu_mi, logical_tx, &tu_grid); } } + // CfL is only allowed up to 32x32, i.e. only at `nchunk == 1`, where + // this still runs after every luma unit of the block. let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); - let chroma_around = neighbours.around(at, side); - if let Some((ub, _)) = &palette_uv_bufs { - set_palette_pred(ub.clone()); + // The block's uv plane block is `chroma_side` across but its uv + // transform is `chroma_tx` (`av1_get_max_uv_txsize` = + // `av1_get_adjusted_tx_size(max_txsize_rect_lookup[uv_plane_bsize])`): + // identical at every size up to 64x64, but a 128x128 block's 64x64 uv + // plane block adjusts TX_64X64 down to TX_32X32, so each plane is + // FOUR units (lane-sb128b r2) -- one per mu chunk. + for cu_row in ch_row * cpc..(ch_row + 1) * cpc { + for cu_col in ch_col * cpc..(ch_col + 1) * cpc { + // The chroma context arrays are indexed in LUMA mi, so this + // unit's anchor is its own luma quadrant: `chroma_tx` chroma + // pixels span `2 * chroma_tx` luma ones. + let luma_span = chroma_tx * 2; + let cu_mi = ( + mi_r + cu_row * (luma_span / MI), + mi_c + cu_col * (luma_span / MI), + ); + let cu_around = neighbours.around_mi(cu_mi, luma_span); + let cu_reach = if cn == 1 { + reach + } else { + tu_reach( + side, side, + cu_col * luma_span, cu_row * luma_span, luma_span, + reach, px, py, y.width, y.height, + ) + }; + let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx); + if let Some((ub, _)) = &palette_uv_bufs { + set_palette_pred(ub.clone()); + } + let u_grid = read_plane( + dec, cdfs, chroma_set, scans.1, 1, cu_around[1], mode, + uv_predict_mode, angle_delta_uv, cu_reach, u, cu_x, cu_y, + chroma_tx, chroma_tx, base_q_idx, + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), + None, chroma_ctx_offset, smooth_neighbor_uv, + )?; + if let Some((_, vb)) = &palette_uv_bufs { + set_palette_pred(vb.clone()); + } + let v_grid = read_plane( + dec, cdfs, chroma_set, scans.1, 2, cu_around[2], mode, + uv_predict_mode, angle_delta_uv, cu_reach, v, cu_x, cu_y, + chroma_tx, chroma_tx, base_q_idx, + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), + None, chroma_ctx_offset, smooth_neighbor_uv, + )?; + if cn > 1 { + CHROMA_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1)); + // Immediately, so the NEXT unit of this same block reads + // this one's coefficient context (libaom's chroma + // `txb_skip_ctx` for the second quadrant is 11, i.e. base + // 1 from this left neighbour -- measured against aomdec). + // The same writes are replayed after `record_split_luma` + // below, which would otherwise clobber them whole-block. + neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, 1, &u_grid); + neighbours.record_mi_chroma(cu_mi, luma_span, luma_span, 2, &v_grid); + units.push((cu_mi, luma_span, u_grid.clone(), v_grid.clone())); + } + last_grids = [u_grid, v_grid]; + } } - let u_grid = read_plane( - dec, - cdfs, - chroma_set, - scans.1, - 1, - chroma_around[1], - mode, - uv_predict_mode, - angle_delta_uv, - reach, - u, - cpx, - cpy, - chroma_side, - chroma_tx, - base_q_idx, - alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), - None, - None, - smooth_neighbor_uv, - )?; - if let Some((_, vb)) = &palette_uv_bufs { - set_palette_pred(vb.clone()); } - let v_grid = read_plane( - dec, - cdfs, - chroma_set, - scans.1, - 2, - chroma_around[2], - mode, - uv_predict_mode, - angle_delta_uv, - reach, - v, - cpx, - cpy, - chroma_side, - chroma_tx, - base_q_idx, - alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), - None, - None, - smooth_neighbor_uv, - )?; - neighbours.record_split_luma(at, side, mode, uv_predict_mode, [&u_grid, &v_grid]); + } + // Mode/side bookkeeping plus, at `cn == 1`, the whole-plane chroma + // context write; at `cn > 1` the per-unit writes above are what the + // next block reads, so they run after this (last writer wins). + neighbours.record_split_luma(at, side, mode, uv_predict_mode, [&last_grids[0], &last_grids[1]]); + for (cu_mi, luma_span, u_grid, v_grid) in &units { + neighbours.record_mi_chroma(*cu_mi, *luma_span, *luma_span, 1, u_grid); + neighbours.record_mi_chroma(*cu_mi, *luma_span, *luma_span, 2, v_grid); + } } // Unconditional, `size == 0` for a non-palette block: clears any stale // neighbour palette state the same way [`Neighbours::record`] always @@ -10453,8 +10608,14 @@ fn decode_leaf_split4( neighbours.left_uv_mode[r] = uv_predict_mode; neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); let (u_grid, v_grid): (Vec, Vec) = if leaf_skips[3] { - u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); - v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); + // As the rect4 pair above: a skipped block still predicts, and CfL is + // prediction (libaom `predict_and_reconstruct_intra_block`). + let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); + if alpha.is_some() { + CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); + } + u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, smooth_neighbor_uv); + v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, smooth_neighbor_uv); (vec![0i32; 16], vec![0i32; 16]) } else { let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); @@ -10806,8 +10967,14 @@ fn decode_leaf_rect8( neighbours.left_uv_mode[r] = uv_predict_mode; neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); let (u_grid, v_grid): (Vec, Vec) = if leaf_skips[1] { - u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); - v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], None, None, smooth_neighbor_uv); + // As the rect4 pair above: a skipped block still predicts, and CfL is + // prediction (libaom `predict_and_reconstruct_intra_block`). + let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); + if alpha.is_some() { + CHROMA_SKIP_CFL_HITS.with(|h| h.set(h.get() + 1)); + } + u.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, smooth_neighbor_uv); + v.reconstruct(cpx, cpy, 4, uv_predict_mode, angle_delta_uv, group_reach, &vec![0i32; 16], alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, smooth_neighbor_uv); (vec![0i32; 16], vec![0i32; 16]) } else { let ac = alpha.map(|_| cfl_ac_q3(y, gpx, gpy, 8)); @@ -11160,8 +11327,14 @@ fn read_tx_size( // key-frame path's own deblock-grid approximation. ctx_override: Option, ) -> usize { - let ctx = ctx_override.unwrap_or_else(|| tx_size_context(n, at_mi, side)); - let depth = match side { + // `max_txsize_rect_lookup[bsize]` (libaom `read_selected_tx_size` / + // `get_tx_size_context`): a block wider than 64 still tops out at + // TX_64X64, so BLOCK_128X128 reads BLOCK_64X64's own category (its depth + // chain 64->32->16->8->4 is the same four steps) and resolves against 64, + // never against its own 128 side (lane-sb128b r1). + let max_tx = side.min(64); + let ctx = ctx_override.unwrap_or_else(|| tx_size_context(n, at_mi, max_tx)); + let depth = match max_tx { 8 => { dec.symbol(&mut cdfs.tx_size_cat0[ctx]) } @@ -11174,7 +11347,7 @@ fn read_tx_size( 64 => { dec.symbol(&mut cdfs.tx_size_cat3[ctx]) } - _ => unreachable!("decode_block/decode_leaf8 only call this at 8/16/32/64"), + _ => unreachable!("decode_block/decode_leaf8 only call this at 8/16/32/64/128"), }; if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { let (rng, _) = dec.debug_state(); @@ -11186,7 +11359,7 @@ fn read_tx_size( if depth != 0 { TX_DEPTH_HITS.with(|c| c.set(c.get() + 1)); } - side >> depth + max_tx >> depth } /// `txfm_partition_context` (libaom `av1_common_int.h`): an inter block's @@ -12793,6 +12966,29 @@ fn sb_visit_order(r0: u32, r1: u32, c0: u32, c1: u32, sb128: bool) -> Vec<(u32, /// decides the root -- only SPLIT recurses into the four 64x64 quadrants this /// decoder codes, the other seven arms refuse by name. #[allow(clippy::too_many_arguments)] +thread_local! { + /// How many 128x128 superblock roots resolved to `PARTITION_NONE` -- one + /// whole 128x128 block (lane-sb128b r1's gate counter). + pub(crate) static PART128_NONE_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// [`PART128_NONE_HITS`], for a gate's own before/after delta. +pub(crate) fn part128_none_hits() -> usize { + PART128_NONE_HITS.with(std::cell::Cell::get) +} + +thread_local! { + /// How many CHROMA transform units were coded inside a block whose uv + /// plane block is more than one unit (lane-sb128b r2 -- only a 128x128 + /// block, four per plane). + pub(crate) static CHROMA_SPLIT_TX_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// [`CHROMA_SPLIT_TX_HITS`], for a gate's own before/after delta. +pub(crate) fn chroma_split_tx_hits() -> usize { + CHROMA_SPLIT_TX_HITS.with(std::cell::Cell::get) +} + fn read_sb128_root( dec: &mut SymbolDecoder, cdfs: &mut Cdfs, @@ -12807,7 +13003,7 @@ fn read_sb128_root( sb_c: u32, mi_cols: u32, mi_rows: u32, -) -> Result<()> { +) -> Result { let (mi_r128, mi_c128) = ((sb_r & !1) * SB_MI, (sb_c & !1) * SB_MI); crate::restoration::read_lr( dec, @@ -12858,13 +13054,20 @@ fn read_sb128_root( } } }; - if part128 != PARTITION_SPLIT { + // lane-sb128b r1: `PARTITION_NONE` -- one 128x128 block -- is decoded by + // the key-frame caller below. The six remaining arms (HORZ/VERT and the + // four AB shapes) still need the rect/AB machinery at this size. + if part128 != PARTITION_SPLIT && part128 != PARTITION_NONE { return Err(unsupported( - "a 128x128 superblock partition other than SPLIT (NONE/HORZ/VERT and the four AB arms at the 128 root are not decoded)", + "a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are decoded at the 128 root)", )); } - PART128_SPLIT_HITS.with(|c| c.set(c.get() + 1)); - Ok(()) + if part128 == PARTITION_SPLIT { + PART128_SPLIT_HITS.with(|c| c.set(c.get() + 1)); + } else { + PART128_NONE_HITS.with(|c| c.set(c.get() + 1)); + } + Ok(part128) } pub(crate) fn decode_key_frame_tile_with_cdfs( @@ -13042,10 +13245,20 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( ); TILE_HITS.with(|c| c.set(c.get() + 1)); + // lane-sb128b r1: set when the 128 root resolved to `PARTITION_NONE` -- + // its one block covers all four 64x64 quadrants, so the remaining three + // visits of this superblock code nothing at all. + let mut sb128_none = false; for (sb_r, sb_c, row_start, sb_start) in sb_visit_order(sb_r0, sb_r1, sb_c0, sb_c1, sb128) { if row_start { neighbours.start_row(); } + if sb_start { + sb128_none = false; + } + if sb128_none { + continue; + } { // lane-sb128 r1: the 128 root. Its loop-restoration units are read // once for the whole 128x128 (spec 5.11.57 is called with the @@ -13053,7 +13266,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( // `BLOCK_128X128` CDF (8 symbols) decides the root -- only SPLIT // recurses into the four 64x64 quadrants this decoder codes. if sb128 && sb_start { - read_sb128_root( + let part128 = read_sb128_root( &mut dec, &mut cdfs, &neighbours, @@ -13065,6 +13278,62 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( mi_cols, mi_rows, )?; + if part128 == PARTITION_NONE { + // One 128x128 intra block: four TX_64X64 luma units and a + // single 64x64 chroma unit per plane (`av1_get_max_uv_txsize` + // of a 128x128 block is TX_64X64 over its 64x64 uv plane + // block). No CfL, no filter intra, no palette at this size -- + // [`read_intra_mode`]'s own size gates already say so. + sb128_none = true; + CDEF_TRANSMITTED.with(|c| c.set(false)); + let at128 = ((sb_r & !1) as usize * 4, (sb_c & !1) as usize * 4); + decode_block( + &mut dec, + &mut cdfs, + &mut neighbours, + at128, + SB * 2, + TxbSet::Luma64, + TxbSet::Chroma32, + TX32, + TX32, + (&scan32, &scan32), + false, + &mut y, + &mut u, + &mut v, + base_q_idx, + enable_filter_intra, + allow_screen_content_tools, + allow_intrabc, + &scan32, + &scan16, + &scan8, + &scan4, + tx_select, + reduced_tx_set, + )?; + // libaom writes one `cdef_strength` into the block's own + // `MB_MODE_INFO`, which every mi cell of the block -- + // hence all four 64x64 CDEF units -- points at; our grid + // is per-unit, so the read (which only ever lands in the + // top-left unit, `read_cdef`'s index 0) is copied across. + let (q_r, q_c) = ((sb_r & !1) as usize, (sb_c & !1) as usize); + CDEF_IDX_GRID.with(|g| { + let mut g = g.borrow_mut(); + let cols = CDEF_SB_COLS.with(|c| c.get()); + if cols > 0 && q_r * cols + q_c < g.len() { + let idx = g[q_r * cols + q_c]; + for (dr, dc) in [(0, 1), (1, 0), (1, 1)] { + let i = (q_r + dr) * cols + q_c + dc; + if q_c + dc < cols && i < g.len() { + g[i] = idx; + } + } + } + }); + continue; + } } if !sb128 { crate::restoration::read_lr( @@ -20661,7 +20930,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( } { if sb128 && sb_start { - read_sb128_root( + if read_sb128_root( &mut dec, &mut cdfs, &neighbours, @@ -20672,7 +20941,15 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( sb_c, mi_cols, mi_rows, - )?; + )? != PARTITION_SPLIT + { + // lane-sb128b r1 decodes a `PARTITION_NONE` 128 root on + // KEY frames only; an inter 128x128 leaf needs whole-block + // MC, OBMC and compound at a size this path has never run. + return Err(unsupported( + "a 128x128 superblock PARTITION_NONE root on an inter frame (only the key-frame path codes a whole 128x128 block)", + )); + } } if !sb128 { crate::restoration::read_lr( diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index cb8e4e4d..6ed4c60d 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -148,10 +148,9 @@ const ALIASES: &[(&str, &str)] = &[("superres-mode", "enable-superres")]; /// depth retires the entry, and this test fails until it is deleted. #[cfg(test)] const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ - ( - "enable-cfl-intra", - "off in 41 gates, on in none: chroma-from-luma prediction is unimplemented", - ), + // `enable-cfl-intra` LEFT both lists on 2026-09-02 (lane-reelckf r1): the + // sb128 skipped-CfL / 1:4-chroma gate passes `--enable-cfl-intra=1` at 8 + // AND 10 bits and pixel-compares both arms. ( "enable-dist-wtd-comp", "off in 11 gates, on in none: distance-weighted compound is unimplemented", @@ -206,10 +205,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02: // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both // orientations and coded strips inside pixel-exact attempts. - ( - "enable-cfl-intra", - "hole at both depths, see the 8-bit list", - ), ( "enable-dual-filter", "hole at both depths, see the 8-bit list", @@ -416,8 +411,12 @@ mod tests { /// an 8-bit and a 10-bit stream from one recipe, so its flags cover both /// depths -- classifying it by the 10-bit strings inside its conditional /// alone hid `--enable-tx-size-search=1` from the 8-bit list. + /// lane-reelckf r1: the same blind spot with the other spelling -- a gate + /// that loops `for depth in [8usize, 10]` builds BOTH streams from one + /// recipe, but its `yuv420p10le` arm made `is_ten_bit` classify it as + /// 10-bit only, hiding `--enable-cfl-intra=1` from the 8-bit list. fn covers_both_depths(body: &str) -> bool { - body.contains("if bit_depth == 10") + body.contains("if bit_depth == 10") || body.contains("for depth in [8usize, 10]") } /// Whether a gate body drives a stream at this depth. diff --git a/crates/ec-av1/src/mvstack.rs b/crates/ec-av1/src/mvstack.rs index 300fa320..cb4e42e9 100644 --- a/crates/ec-av1/src/mvstack.rs +++ b/crates/ec-av1/src/mvstack.rs @@ -92,6 +92,36 @@ pub(crate) fn tmv_hits() -> usize { TMV_HITS.load(std::sync::atomic::Ordering::Relaxed) } +/// lane-mvtwin r1 firing counters, one per divergence this round closed. +/// `COMP_GM_FILL_HITS`: compound extension candidates whose `comp_list` slot +/// came from `gm_mv_candidates[side]` rather than a scanned neighbour, and +/// where that global mv was NOT `(0, 0)` (the only case the old zero fill +/// could not fake). `STACK_FULL_DROPS`: distinct candidates libaom drops at +/// `MAX_REF_MV_STACK_SIZE` on insertion. `TILE_REACH_CLIPS`: row/col reaches +/// shortened by a tile origin past mi 0, which the old frame-edge clamp +/// missed entirely. +static COMP_GM_FILL_HITS: std::sync::atomic::AtomicUsize = + std::sync::atomic::AtomicUsize::new(0); +static STACK_FULL_DROPS: std::sync::atomic::AtomicUsize = + std::sync::atomic::AtomicUsize::new(0); +static TILE_REACH_CLIPS: std::sync::atomic::AtomicUsize = + std::sync::atomic::AtomicUsize::new(0); + +/// [`COMP_GM_FILL_HITS`]. +pub(crate) fn comp_gm_fill_hits() -> usize { + COMP_GM_FILL_HITS.load(std::sync::atomic::Ordering::Relaxed) +} + +/// [`STACK_FULL_DROPS`]. +pub(crate) fn stack_full_drops() -> usize { + STACK_FULL_DROPS.load(std::sync::atomic::Ordering::Relaxed) +} + +/// [`TILE_REACH_CLIPS`]. +pub(crate) fn tile_reach_clips() -> usize { + TILE_REACH_CLIPS.load(std::sync::atomic::Ordering::Relaxed) +} + /// Everything [`find_mv_stack_with_sign_bias`] needs to fold temporal MV /// candidates into a block's stack (spec 7.10.2.8, only reached when the /// frame header's own `use_ref_frame_mvs` is set): the current frame's own @@ -213,6 +243,14 @@ impl MiGrid { self.tile_col1 = col1; } + /// The current tile's top-left mi-unit origin ([`Self::set_tile_bounds`]). + /// libaom's `tile->mi_row_start`/`mi_col_start`, which every availability + /// and reach clamp in `setup_ref_mv_list` is written against + /// (`xd->up_available`, `find_valid_row_offset`, mvref_common.c:512-528). + pub fn tile_origin(&self) -> (usize, usize) { + (self.tile_row0, self.tile_col0) + } + /// Records the unit at `(row, col)`. Out-of-range coordinates are a /// no-op — the caller only ever addresses units inside the grid it built. pub fn set(&mut self, row: usize, col: usize, info: MiInfo) { @@ -313,7 +351,15 @@ const MVREF_ROW_COLS: usize = 3; fn add_candidate(candidates: &mut Vec, mv: (i32, i32), weight: u32) { if let Some(entry) = candidates.iter_mut().find(|e| e.mv == mv) { entry.weight += weight; + } else if candidates.len() >= MAX_STACK_SIZE { + STACK_FULL_DROPS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); } else { + // libaom `add_ref_mv_candidate` (mvref_common.c:100) and + // `add_tpl_ref_mv` (:388) only push when + // `*refmv_count < MAX_REF_MV_STACK_SIZE` -- the 9th distinct MV is + // DROPPED AT INSERTION, never "kept if it outweighs an earlier one". + // Sorting first and truncating afterwards (what this did) keeps a + // different set whenever more than 8 distinct candidates are seen. candidates.push(StackEntry { mv, weight }); } } @@ -773,22 +819,35 @@ pub fn find_mv_stack_with_sign_bias( // nothing here relies on that. let row_adj = bh4 < 2 && mi_row % 2 == 1; let col_adj = bw4 < 2 && mi_col % 2 == 1; - let max_row_offset: isize = if mi_row > 0 { + // r1 (lane-mvtwin): availability and reach are TILE-relative, never + // frame-relative -- libaom's `xd->up_available`/`left_available` are + // `mi_row > tile->mi_row_start` / `mi_col > tile->mi_col_start`, and + // `find_valid_row_offset`/`find_valid_col_offset` (mvref_common.c:512-528) + // clamp the reach to `tile->mi_row_start - mi_row`. Clamping to the FRAME + // edge left `max_row_offset`/`max_col_offset` too long inside every tile + // that does not start at 0, which changes the row/col scan's `inc` weight + // (and so the stack ORDER) even though `MiGrid::get` already returns + // `None` for the cells outside the tile. + let (tile_row0, tile_col0) = grid.tile_origin(); + if tile_row0 > 0 || tile_col0 > 0 { + TILE_REACH_CLIPS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + } + let max_row_offset: isize = if mi_row > tile_row0 { let reach = if bh4 < 2 { -4 } else { -6 } + isize::from(row_adj); - reach.max(-(mi_row as isize)) + reach.max(tile_row0 as isize - mi_row as isize) } else { 0 }; - let max_col_offset: isize = if mi_col > 0 { + let max_col_offset: isize = if mi_col > tile_col0 { let reach = if bw4 < 2 { -4 } else { -6 } + isize::from(col_adj); - reach.max(-(mi_col as isize)) + reach.max(tile_col0 as isize - mi_col as isize) } else { 0 }; let mut processed_rows = 0usize; let mut processed_cols = 0usize; - let found_above = mi_row > 0 + let found_above = max_row_offset.unsigned_abs() >= 1 && scan_row( grid, mi_row, @@ -802,7 +861,7 @@ pub fn find_mv_stack_with_sign_bias( &mut newmv_count, &mut processed_rows, ); - let found_left = mi_col > 0 + let found_left = max_col_offset.unsigned_abs() >= 1 && scan_col( grid, mi_row, @@ -1227,7 +1286,12 @@ fn add_compound_candidate( ) { if let Some(entry) = candidates.iter_mut().find(|e| e.mv0 == mv0 && e.mv1 == mv1) { entry.weight += weight; + } else if candidates.len() >= MAX_STACK_SIZE { + STACK_FULL_DROPS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); } else { + // Same insertion cap as [`add_candidate`]: libaom's compound branch + // of `add_ref_mv_candidate` (mvref_common.c:128) and `add_tpl_ref_mv` + // (:425) both gate the push on `*refmv_count < MAX_REF_MV_STACK_SIZE`. candidates.push(CompoundStackEntry { mv0, mv1, weight }); } } @@ -1477,9 +1541,18 @@ fn process_compound_ref_mv_candidate( /// libaom's combine step (`setup_ref_mv_list`, `mvref_common.c` ~696-720): /// zips each side's `ref_id` (exact matches) then `ref_diff` (borrowed, /// sign-flipped) entries, position-wise and independently per side, into up -/// to two full `(mv0, mv1)` pair candidates — missing slots default to -/// `(0, 0)`, matching libaom's zero-initialized `combined_mvs`. -fn combine_compound_candidates(lists: &CompoundRefLists) -> [((i32, i32), (i32, i32)); 2] { +/// to two full `(mv0, mv1)` pair candidates. r1 (lane-mvtwin): slots past +/// both lists are filled with THAT SIDE's own global motion vector +/// (`gm_mv_candidates[idx]`, mvref_common.c:718-719), never `(0, 0)` — the +/// exact gap the single-reference twin closed in r6 for its own +/// `mv_ref_list` tail, still open on this side. Invisible while every live +/// reference's global motion is IDENTITY (an unclamped gm mv of exactly +/// `(0,0)`), wrong the moment a compound pair names a ROTZOOM/AFFINE +/// reference and the scans leave the stack short. +fn combine_compound_candidates( + lists: &CompoundRefLists, + gm_mv_candidates: [(i32, i32); 2], +) -> [((i32, i32), (i32, i32)); 2] { let side_slots = |side: usize| -> [(i32, i32); 2] { let merged: Vec<(i32, i32)> = lists.ref_id[side] .iter() @@ -1487,7 +1560,14 @@ fn combine_compound_candidates(lists: &CompoundRefLists) -> [((i32, i32), (i32, .take(2) .copied() .collect(); - std::array::from_fn(|i| merged.get(i).copied().unwrap_or((0, 0))) + std::array::from_fn(|i| { + merged.get(i).copied().unwrap_or_else(|| { + if gm_mv_candidates[side] != (0, 0) { + COMP_GM_FILL_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + } + gm_mv_candidates[side] + }) + }) }; let side0 = side_slots(0); let side1 = side_slots(1); @@ -1532,22 +1612,35 @@ pub fn find_mv_stack_compound( let row_adj = bh4 < 2 && mi_row % 2 == 1; let col_adj = bw4 < 2 && mi_col % 2 == 1; - let max_row_offset: isize = if mi_row > 0 { + // r1 (lane-mvtwin): availability and reach are TILE-relative, never + // frame-relative -- libaom's `xd->up_available`/`left_available` are + // `mi_row > tile->mi_row_start` / `mi_col > tile->mi_col_start`, and + // `find_valid_row_offset`/`find_valid_col_offset` (mvref_common.c:512-528) + // clamp the reach to `tile->mi_row_start - mi_row`. Clamping to the FRAME + // edge left `max_row_offset`/`max_col_offset` too long inside every tile + // that does not start at 0, which changes the row/col scan's `inc` weight + // (and so the stack ORDER) even though `MiGrid::get` already returns + // `None` for the cells outside the tile. + let (tile_row0, tile_col0) = grid.tile_origin(); + if tile_row0 > 0 || tile_col0 > 0 { + TILE_REACH_CLIPS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); + } + let max_row_offset: isize = if mi_row > tile_row0 { let reach = if bh4 < 2 { -4 } else { -6 } + isize::from(row_adj); - reach.max(-(mi_row as isize)) + reach.max(tile_row0 as isize - mi_row as isize) } else { 0 }; - let max_col_offset: isize = if mi_col > 0 { + let max_col_offset: isize = if mi_col > tile_col0 { let reach = if bw4 < 2 { -4 } else { -6 } + isize::from(col_adj); - reach.max(-(mi_col as isize)) + reach.max(tile_col0 as isize - mi_col as isize) } else { 0 }; let mut processed_rows = 0usize; let mut processed_cols = 0usize; - let found_above = mi_row > 0 + let found_above = max_row_offset.unsigned_abs() >= 1 && scan_row_compound( grid, mi_row, @@ -1561,7 +1654,7 @@ pub fn find_mv_stack_compound( &mut newmv_count, &mut processed_rows, ); - let found_left = mi_col > 0 + let found_left = max_col_offset.unsigned_abs() >= 1 && scan_col_compound( grid, mi_row, @@ -1802,7 +1895,8 @@ pub fn find_mv_stack_compound( // bump) — otherwise append `comp_list[0]` as a brand-new entry. When // the stack is empty, both `comp_list[0]` and `comp_list[1]` are // appended unconditionally, with no dedup check at all. - let comp_list = combine_compound_candidates(&lists); + let comp_list = + combine_compound_candidates(&lists, [gm_mv(gm, ref_frame.0), gm_mv(gm, ref_frame.1)]); if candidates.len() == 1 { let (mv0, mv1) = if comp_list[0] == (candidates[0].mv0, candidates[0].mv1) { comp_list[1] @@ -2824,7 +2918,7 @@ mod tests { // side 1 has only one entry -> comp_idx 1 falls back to ref_diff. lists.ref_diff[1].push((4, 4)); - let combined = combine_compound_candidates(&lists); + let combined = combine_compound_candidates(&lists, [(0, 0), (0, 0)]); assert_eq!(combined[0], ((1, 1), (3, 3))); assert_eq!(combined[1], ((2, 2), (4, 4))); } @@ -2911,4 +3005,91 @@ mod tests { assert_eq!(stack.entries[1].mv0, (-3, -3)); assert_eq!(stack.entries[1].mv1, (7, 7)); } + + /// lane-mvtwin r1, defect 1 (twin drift, compound only): libaom fills a + /// `comp_list` slot past both `ref_id`/`ref_diff` lists with THAT SIDE's + /// own `gm_mv_candidates[idx]` (mvref_common.c:718-719). This module + /// filled it with `(0, 0)`, which is only accidentally right while every + /// live reference's global motion is IDENTITY -- the single-ref twin had + /// already closed the same gap on its own `mv_ref_list` tail in r6. + #[test] + fn a_missing_compound_combine_slot_takes_that_sides_global_mv_not_zero() { + let lists = CompoundRefLists::default(); + let combined = combine_compound_candidates(&lists, [(9, -5), (-11, 3)]); + assert_eq!(combined[0], ((9, -5), (-11, 3))); + assert_eq!(combined[1], ((9, -5), (-11, 3))); + // One side supplied, the other short: only the short side falls back. + let mut half = CompoundRefLists::default(); + half.ref_id[0].push((1, 2)); + let combined = combine_compound_candidates(&half, [(9, -5), (-11, 3)]); + assert_eq!(combined[0], ((1, 2), (-11, 3))); + assert_eq!(combined[1], ((9, -5), (-11, 3))); + } + + /// lane-mvtwin r1, defect 2 (both twins): libaom drops the 9th distinct + /// candidate AT INSERTION (`*refmv_count < MAX_REF_MV_STACK_SIZE`, + /// mvref_common.c:100/128/388/425). Pushing everything and truncating + /// after the weight sort keeps a different set: here the heavy 9th + /// candidate would survive and evict a scanned one. + #[test] + fn the_ninth_distinct_candidate_is_dropped_at_insertion_not_after_sorting() { + let mut candidates = Vec::new(); + for i in 0..MAX_STACK_SIZE as i32 { + add_candidate(&mut candidates, (i, i), 2); + } + let before = stack_full_drops(); + add_candidate(&mut candidates, (99, 99), 10_000); + assert_eq!(candidates.len(), MAX_STACK_SIZE); + assert!(!candidates.iter().any(|e| e.mv == (99, 99))); + assert_eq!(stack_full_drops(), before + 1); + // A full stack still takes the dedup weight bump libaom applies + // before the cap check. + add_candidate(&mut candidates, (0, 0), 6); + assert_eq!(candidates[0].weight, 8); + + let mut comp = Vec::new(); + for i in 0..MAX_STACK_SIZE as i32 { + add_compound_candidate(&mut comp, (i, i), (i, -i), 2); + } + add_compound_candidate(&mut comp, (99, 99), (99, 99), 10_000); + assert_eq!(comp.len(), MAX_STACK_SIZE); + } + + /// lane-mvtwin r1, defect 3 (both twins): the row/col reach is clamped to + /// the TILE origin (`find_valid_row_offset`, mvref_common.c:512-528), not + /// the frame edge. `MiGrid::get` already hides the out-of-tile cells, so + /// the only visible symptom is the scan WEIGHT (`inc`) -- and through it + /// the stack order. Query at mi_row 9 with the tile starting at row 8: + /// the real reach is -1, so `inc = 1` and the weight stays at the floor + /// 2; the frame-edge clamp gave -6, `inc = min(6, size_h) = 4`, doubling + /// the vote. + #[test] + fn the_row_reach_is_clamped_to_the_tile_origin_not_the_frame_edge() { + let weight_with_tile_origin = |row0: usize| { + // A neighbour at least as wide as the query block (`bw4 <= n4`) + // is what makes libaom compute `inc` at all. + let wide = MiInfo { + size: 4, + size_h: 4, + ..inter((5, 5)) + }; + let mut grid = MiGrid::new(16, 16); + grid.set(8, 4, wide); + grid.set(8, 6, wide); + grid.set_tile_bounds(row0, 0, 16, 16); + let stack = find_mv_stack(&grid, 9, 4, 2, 2, LAST_FRAME, 16, 16); + assert_eq!(stack.entries.len(), 1); + stack.entries[0].weight + }; + let tiled = weight_with_tile_origin(8); + let whole_frame = weight_with_tile_origin(0); + // One scanned row cell (`end_mi == bw4 == 2`, `len == 2`) plus the + // top-right probe's own flat `CORNER_WEIGHT`, which the reach never + // touches -- so the whole delta below is the row scan's `inc`. + // reach -1 -> inc 1 -> weight stays at the floor 2. + assert_eq!(tiled, REF_CAT_LEVEL + 2 * 2 + CORNER_WEIGHT); + // frame-edge clamp: reach -6 -> inc min(6, size_h) = 4. + assert_eq!(whole_frame, REF_CAT_LEVEL + 2 * 4 + CORNER_WEIGHT); + assert_ne!(tiled, whole_frame); + } } diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 9581323a..4ab1f2c6 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -42,7 +42,8 @@ const REFUSALS: &[&str] = &[ "a tx_type symbol outside its CDF's own set: {t}", "an INTER 32x32 partition type this decoder does not code (value={part32})", "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", - "a 128x128 superblock partition other than SPLIT (NONE/HORZ/VERT and the four AB arms at the 128 root are not decoded)", + "a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are decoded at the 128 root)", + "a 128x128 superblock PARTITION_NONE root on an inter frame (only the key-frame path codes a whole 128x128 block)", "intrabc under a 128x128 superblock (libaom's av1_is_dv_valid derives the block-vector delay from sb_size, which this decoder hardcodes to 64)", "a palette block on a HORZ/VERT intra strip below 16x16 (reconstruction not ported)", "a palette block with a real transform on a superblock-level HORZ/VERT strip (corner-cropped luma coefficients not ported for palette)", diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 8110c915..f6d442b5 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -2972,6 +2972,64 @@ mod tests { assert_eq!(frames[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg"); assert_eq!(frames[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg"); } + /// lane-reelckf r2: `crates/ec-av1/fixtures/reelc_kf2700.obu` is a 1920x792 + /// 10-bit AV1 key frame taken out of one of the user's own films + /// (`ffmpeg -ss 2700 -c:v copy -f obu`, then truncated to its first temporal + /// unit, 36 kB) -- the ONLY stream in this repo that contains a SKIPPED + /// `UV_CFL_PRED` block. 30 aomenc recipes (r1's 20 plus r2's chroma-correlated + /// `geq` sweep, cq 40..63, cpu-used 0..2, min/max-partition 4..64, 8 and + /// 10 bit) never made the encoder pick one, so the counter can only be + /// hard-asserted against a real film frame. The instrumented oracle agrees: + /// `EC_TRACE_MODE=1 aomdec` prints 5 `EC_IMODE_VAL ... uv_mode=13 skip=1` + /// lines for this frame. + /// + /// The defect it pins (fixed at 29cd53f, `decode.rs:7719`/`:10528`/`:10891`): + /// a skipped intra block must still PREDICT with CfL -- libaom's + /// `predict_and_reconstruct_intra_block` predicts every plane and guards only + /// the residual on `skip_txfm`. Before the fix this frame had 499 wrong + /// chroma samples (U rows 48..79 cols 464..492); after it, zero. + /// + /// The ffmpeg reference is `ffmpeg -f obu -i -f rawvideo + /// -pix_fmt yuv420p10le -` (what `ffmpeg_decode_sequence_10bit` runs). + #[test] + fn a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact() { + const NAME: &str = "a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact"; + let path = + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures/reelc_kf2700.obu"); + let stream = std::fs::read(&path) + .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display())); + let (width, height) = (1920usize, 792usize); + let before = crate::decode::reelc_chroma_counters(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => panic!("{NAME}: decode_stream refused: {e}"), + }; + let after = crate::decode::reelc_chroma_counters(); + let skip_cfl = after.0 - before.0; + assert_eq!(frames.len(), 1, "{NAME}: one key frame"); + assert_eq!((frames[0].width, frames[0].height), (width, height)); + // Asserted before the ffmpeg compare so an absent ffmpeg cannot make the + // gate vacuous: the skipped-CfL path is exercised on every run. + assert!( + skip_cfl > 0, + "{NAME}: zero skipped-CfL blocks -- the fixture no longer exercises defect 1" + ); + if !have_ffmpeg() { + eprintln!("SKIP {NAME} pixel compare: no ffmpeg (skipped_cfl={skip_cfl})"); + return; + } + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, 1); + assert_eq!(frames[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg"); + assert_eq!( + frames[0].u, ffmpeg_frames[0].u, + "{NAME}: U vs ffmpeg ({skip_cfl} skipped-CfL blocks)" + ); + assert_eq!( + frames[0].v, ffmpeg_frames[0].v, + "{NAME}: V vs ffmpeg ({skip_cfl} skipped-CfL blocks)" + ); + eprintln!("{NAME}: pixel-exact, skipped_cfl={skip_cfl}"); + } /// lane-kf900 r2: the film's key frame at -ss 900, one frame /// (`crates/ec-av1/fixtures/reelb_kf900.obu`, 484640 bytes, sha256 @@ -11489,6 +11547,169 @@ mod tests { ); } + /// lane-reelckf r1: ReelC's key frames decoded with no refusal and WRONG + /// CHROMA (luma bit-exact at every one of ten seek points), from two + /// defects this gate pins: + /// + /// 1. a SKIPPED intra block whose `uv_mode` is `UV_CFL_PRED` still + /// predicts with the CfL term -- libaom + /// `predict_and_reconstruct_intra_block` (decodeframe.c) calls + /// `av1_predict_intra_block_facade` unconditionally and only guards + /// the residual on `mbmi->skip_txfm`. Three skip arms (the 16x16-level + /// 1:4 chroma pair and the two sub-8x8 4x4 groups) dropped it. + /// 2. the chroma intra-edge FILTER TYPE of a 1:4 pair comes from the + /// CHROMA REFERENCE position (libaom `get_intra_edge_filter_type` -> + /// `chroma_above_mbmi`/`chroma_left_mbmi`), not from the closing + /// strip: at the closing strip the above cell is the pair's own first + /// strip, the mi-exact UV map misses and the coarse fallback answers, + /// which flipped `av1_use_intra_edge_upsample` (blk_wh 12 <= 16 for + /// type 0, no upsample for type 1) and moved directional chroma by + /// +-1..3. + /// + /// Recipe is a real `aomenc --sb-size=128 --cpu-used=0` (the shape ReelC + /// uses) with 1:4 partitions and CfL on, both bit depths, and both + /// counters hard-asserted per compared attempt. + #[test] + fn a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact() { + const NAME: &str = + "a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let mut compared = 0usize; + let (width, height) = (256usize, 256usize); + for depth in [8usize, 10] { + let pix = if depth == 10 { "yuv420p10le" } else { "yuv420p" }; + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", + &format!( + "mandelbrot=size={width}x{height},\ + noise=alls=20:allf=t+u:all_seed=7" + ), + "-pix_fmt", pix, "-strict", "-1", "-t", "1", "-vframes", "1", + "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "{NAME}: ffmpeg fixture (depth={depth}): {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let encode = || { + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", "--passes=1", "--end-usage=q", "--cq-level=52", + "--cpu-used=0", "--threads=1", "--row-mt=0", "--sb-size=128", + "--kf-max-dist=0", "--enable-rect-partitions=1", + "--enable-ab-partitions=0", "--enable-1to4-partitions=1", + "--enable-cfl-intra=1", "--enable-tx-size-search=0", + "--enable-filter-intra=0", "--enable-intra-edge-filter=1", + "--reduced-tx-type-set=1", "--min-partition-size=4", + "--max-partition-size=32", + &format!("--input-bit-depth={depth}"), + &format!("--bit-depth={depth}"), + "--obu", "-o", "-", "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture (depth={depth}): {}", + String::from_utf8_lossy(&out.stderr) + ); + out.stdout + }; + let stream = encode(); + assert_eq!( + stream, + encode(), + "{NAME}: aomenc output is not reproducible (depth={depth})" + ); + let before = crate::decode::reelc_chroma_counters(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME}: decode failed (depth={depth}): {msg}" + ); + eprintln!("{NAME}: depth={depth} arm refused (not compared): {msg}"); + continue; + } + }; + compared += 1; + // Counters read only on an attempt that decoded AND is compared. + let after = crate::decode::reelc_chroma_counters(); + let (skip_cfl, dir_pairs) = (after.0 - before.0, after.1 - before.1); + let ffmpeg_frames = if depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) + } else { + ffmpeg_decode_sequence(&stream, width, height, frames.len()) + }; + assert_eq!(ffmpeg_frames.len(), frames.len(), "{NAME}: ffmpeg frame count"); + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + assert_eq!(got.y, want.y, "{NAME} frame {i} luma (depth={depth})"); + assert_eq!( + got.u, want.u, + "{NAME} frame {i} U (depth={depth}, {skip_cfl} skipped-CfL blocks, \ + {dir_pairs} directional 1:4 chroma pairs)" + ); + assert_eq!( + got.v, want.v, + "{NAME} frame {i} V (depth={depth}, {skip_cfl} skipped-CfL blocks, \ + {dir_pairs} directional 1:4 chroma pairs)" + ); + } + // Defect 1 (skipped `UV_CFL_PRED`) is NOT asserted here: 20 aomenc + // recipes (cq 40..63, 9 lavfi sources, min/max-partition 4..64, + // both `--sb-size=128` and 64) never made the encoder pick a + // skipped 1:4 / sub-8x8 CfL block, so an assert would only ever + // fire on his real film. Its evidence is ReelC's own key frames + // (lanes/reelckf-r1.report.md): ss=2700 went 499 wrong chroma + // samples -> 0 on this fix alone. The count is printed so a future + // recipe that does reach it is visible immediately. r2 pinned that + // film frame as a fixture instead: + // `a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact` + // hard-asserts the counter. + assert!( + dir_pairs > 0, + "{NAME}: no directional 1:4 chroma pair decoded (depth={depth}) -- defect 2 \ + is not exercised" + ); + eprintln!( + "{NAME}: pixel-exact at {depth}-bit over {} frames, skipped_cfl={skip_cfl} \ + directional_1to4_chroma_pairs={dir_pairs}", + frames.len() + ); + } + assert!( + compared > 0, + "{NAME}: every arm refused -- the gate compared no pixels at all" + ); + } + /// lane-ab16 r1: real `aomenc --enable-ab-partitions=1` streams whose /// 16x16 blocks are split T-shaped (`PARTITION_HORZ_A`/`_HORZ_B`/ /// `_VERT_A`/`_VERT_B`: two 8x8 squares plus one 16x8/8x16 strip), the @@ -14443,6 +14664,299 @@ mod tests { a_real_aomenc_temporal_mv_gate(42, 40); } + /// lane-mvtwin r1: the COMPOUND MV-stack gate. Every other compound gate + /// here pins `--enable-ref-frame-mvs=0`, so `find_mv_stack_compound`'s + /// temporal half (the three `tpl_sample_pos` extension samples lane-sb128 + /// r3 found missing) and its extension pass have never been exercised by + /// a real encoder. This arm turns ref-frame-mvs ON, gives the encoder a + /// 25-frame lookahead plus alt-refs so `reference_select` really drives + /// blocks to COMPOUND_REFERENCE, and sweeps global motion off/on so the + /// combine step's `gm_mv_candidates` fill (r1 defect 1) is reachable. + /// + /// Firing proof, hard-asserted: `decode::comp_mode_hits` (a real + /// compound block) AND `mvstack::tmv_hits` (a temporal candidate landed + /// in some stack) must BOTH have advanced on an attempt that also + /// decoded pixel-exact -- class [[gate-skips-on-its-own-failure]]: a + /// decode that succeeds is ALWAYS compared, on every decode-order frame, + /// and only the counters decide whether the attempt counts. + fn a_real_aomenc_compound_mv_stack_gate( + gate_name: &str, + seed_base: u32, + attempts: u32, + bit_depth: u32, + sb_size: u32, + global_motion: u32, + width: usize, + tile_columns: u32, + ) { + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {gate_name}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {gate_name}: no aomenc at {}", aomenc_path().display()); + return; + } + let (height, frame_count) = (64usize, 16usize); + let mut never_fired = 0u32; + let mut refusals = Vec::new(); + for attempt in 0..attempts { + let seed = seed_base + attempt; + let duration = frame_count as f64 / 25.0; + let source = + gradients_source(seed, width, height, &format!("duration={duration}:rate=25")); + let y4m = Command::new("ffmpeg") + .args([ + "-v", + "error", + "-f", + "lavfi", + "-i", + &source, + "-pix_fmt", + if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }, + "-strict", + "-1", + "-t", + "0.64", + "-f", + "yuv4mpegpipe", + "-strict", + "-1", + "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "ffmpeg fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let depth_args: &[&str] = if bit_depth == 10 { + &["-b", "10", "--input-bit-depth=10"] + } else { + &[] + }; + // The cq sweep: how finely RD partitions decides how often a + // block's stack comes up short enough to reach the extension + // pass at all. + let cq = format!("--cq-level={}", [45u32, 55, 35][(attempt % 3) as usize]); + let sb = format!("--sb-size={sb_size}"); + let gm = format!("--enable-global-motion={global_motion}"); + // `--tile-columns` is log2: 1 means two tile columns, which is + // what makes every block in the right-hand tile carry a nonzero + // `tile_col0` and so exercise r1 defect 3's reach clamp. + let tiles = format!("--tile-columns={tile_columns}"); + // class [[aomenc-last-flag-wins]]: every flag appears exactly + // once below, so there is no override to order. + let out = { + let mut child = Command::new(aomenc_path()) + .args(depth_args) + .arg(&cq) + .arg(&sb) + .arg(&gm) + .arg(&tiles) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cpu-used=0", + "--kf-max-dist=1000", + "--threads=1", + "--row-mt=0", + // What this gate is about: real compound references + // with a real temporal MV field behind them. + "--enable-ref-frame-mvs=1", + "--enable-order-hint=1", + "--auto-alt-ref=1", + "--lag-in-frames=25", + "--enable-fwd-kf=0", + "--enable-warped-motion=0", + "--enable-obmc=0", + "--enable-masked-comp=0", + "--enable-interintra-comp=0", + "--enable-dist-wtd-comp=0", + "--enable-diff-wtd-comp=0", + "--enable-onesided-comp=0", + "--enable-interintra-wedge=0", + "--enable-smooth-interintra=0", + "--enable-rect-partitions=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-filter-intra=0", + "--enable-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-tx-size-search=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--max-partition-size=32", + "--min-partition-size=32", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + child.wait_with_output().expect("aomenc failed to run") + }; + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let (before_comp, before_tmv) = (decode::comp_mode_hits(), decode::tmv_hits()); + let frames = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{gate_name} failed outright (seed {seed}): {msg}" + ); + refusals.push(format!("seed {seed}: {msg}")); + continue; + } + Ok(frames) => frames, + }; + let counted = + decode::comp_mode_hits() != before_comp && decode::tmv_hits() != before_tmv; + if !counted { + never_fired += 1; + } + let ffmpeg_frames = if bit_depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) + } else { + ffmpeg_decode_sequence(&stream, width, height, frame_count) + }; + assert_eq!(frames.len(), frame_count); + // EVERY decode-order frame compared, never just the shown ones + // (class [[gate-blind-to-hidden-frames]]). + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + assert_eq!( + got.y, want.y, + "{gate_name} frame {i} luma vs ffmpeg (seed {seed})" + ); + assert_eq!( + got.u, want.u, + "{gate_name} frame {i} U vs ffmpeg (seed {seed})" + ); + assert_eq!( + got.v, want.v, + "{gate_name} frame {i} V vs ffmpeg (seed {seed})" + ); + } + if counted { + eprintln!( + "{gate_name} FIRING seed {seed}: comp_mode_hits +{}, tmv_hits +{}, \ + comp_gm_fill_hits={}, stack_full_drops={}, tile_reach_clips={}", + decode::comp_mode_hits() - before_comp, + decode::tmv_hits() - before_tmv, + crate::mvstack::comp_gm_fill_hits(), + crate::mvstack::stack_full_drops(), + crate::mvstack::tile_reach_clips(), + ); + gate_buckets(gate_name, 1, never_fired, refusals.len()); + return; + } + } + gate_buckets(gate_name, 0, never_fired, refusals.len()); + eprintln!( + "SKIP {gate_name}: {never_fired} attempts decoded but never drove a compound block \ + with a temporal MV candidate, and every other attempt hit a named refusal:\n{}", + refusals.join("\n") + ); + } + + #[test] + fn a_real_aomenc_compound_mv_stack_with_temporal_mvs_decodes_pixel_exact() { + a_real_aomenc_compound_mv_stack_gate( + "a_real_aomenc_compound_mv_stack_with_temporal_mvs_decodes_pixel_exact", + 42, + 30, + 8, + 64, + 0, + 64, + 0, + ); + } + + #[test] + fn a_real_aomenc_compound_mv_stack_with_global_motion_decodes_pixel_exact() { + a_real_aomenc_compound_mv_stack_gate( + "a_real_aomenc_compound_mv_stack_with_global_motion_decodes_pixel_exact", + 80, + 30, + 8, + 64, + 1, + 64, + 0, + ); + } + + #[test] + fn a_real_aomenc_10bit_compound_mv_stack_at_128_superblocks_decodes_pixel_exact() { + a_real_aomenc_compound_mv_stack_gate( + "a_real_aomenc_10bit_compound_mv_stack_at_128_superblocks_decodes_pixel_exact", + 120, + 30, + 10, + 128, + 1, + 64, + 0, + ); + } + + /// KNOWN OPEN DEFECT, found by lane-mvtwin r1 and NOT caused by it: a + /// real aomenc stream 128 px wide with `--tile-columns=1` (two 64-px tile + /// columns) mis-decodes frame 1's luma against ffmpeg, at seed 200 with + /// this exact recipe. ABLATION-PROVEN pre-existing: the same arm fails + /// identically with r1's tile-origin reach clamp + /// (`MiGrid::tile_origin`) forced back to `(0, 0)`, so the cause is + /// somewhere else in the multi-tile path, not in `mvstack`. Kept as the + /// exact reproducer for the lane that owns tiles -- it is `#[ignore]`d + /// rather than deleted so the repro command survives: + /// `cargo test -p ec-av1 --lib across_two_tile_columns -- --ignored --nocapture`. + /// + /// It is also the ONLY arm that reaches r1 defect 3 (the col reach is + /// clamped to `tile_col0`, not the frame edge): the counter + /// `mvstack::tile_reach_clips` advanced to 60 on this stream. Defect 3 + /// itself is proven deterministically by + /// `mvstack::tests::the_row_reach_is_clamped_to_the_tile_origin_not_the_frame_edge`. + #[test] + #[ignore = "known pre-existing multi-tile-column decode defect, see doc comment"] + fn a_real_aomenc_compound_mv_stack_across_two_tile_columns_decodes_pixel_exact() { + let name = "a_real_aomenc_compound_mv_stack_across_two_tile_columns_decodes_pixel_exact"; + let before = crate::mvstack::tile_reach_clips(); + a_real_aomenc_compound_mv_stack_gate(name, 200, 30, 8, 64, 0, 128, 1); + assert!( + crate::mvstack::tile_reach_clips() > before, + "{name}: no block was ever built inside a tile past mi 0 -- \ + --tile-columns=1 did not produce a second tile column" + ); + } + /// bisect scratch: decode a pinned stream exactly once -- generic /// pin-repro tool, kept for manual use. #[test] @@ -18049,6 +18563,162 @@ mod tests { ); } + /// lane-sb128b r1 gate: a real `aomenc --sb-size=128` KEY frame whose 128 + /// roots resolve to `PARTITION_NONE` -- one whole 128x128 intra block, + /// four TX_64X64 luma transform units and FOUR TX_32X32 chroma units per + /// plane (`av1_get_max_uv_txsize(BLOCK_128X128)` is + /// `av1_get_adjusted_tx_size` of its 64x64 uv plane block's TX_64X64, so + /// TX_32X32) -- lane-sb128b r2's `chroma_split_tx_hits` asserts them. The r1 gate above pins `--max-partition-size=64`, which + /// makes every 128 root a forced SPLIT and leaves this arm unexercised. + /// Smooth gradients at a high `--cq-level` are what make the RD search + /// keep a whole 128x128 block; `part128_none_hits` HARD-asserts it did. + #[test] + fn a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact() { + const NAME: &str = + "a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let render = |seed: u32, width: usize, height: usize, ten_bit: bool| -> Vec { + let pix = if ten_bit { "yuv420p10le" } else { "yuv420p" }; + let out = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", + &gradients_source(seed, width, height, "duration=0.04:rate=25"), + "-pix_fmt", pix, "-strict", "-1", "-t", "0.04", + "-f", "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + out.status.success(), + "ffmpeg fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + out.stdout + }; + let mut matched = 0u32; + let mut named_refusals = 0u32; + let mut none_arms = 0u32; + // (seed, cq, width, height, 10-bit). 384x384 is a 3x3 grid of whole + // 128 superblocks; 256x256 a 2x2. + let arms: Vec<(u32, &str, usize, usize, bool)> = vec![ + (42, "--cq-level=63", 384, 384, false), + (43, "--cq-level=55", 384, 384, false), + (44, "--cq-level=63", 256, 256, false), + (45, "--cq-level=63", 384, 384, true), + ]; + for (seed, cq, width, height, ten_bit) in arms { + let y4m = render(seed, width, height, ten_bit); + let mut args: Vec<&str> = vec![ + "--codec=av1", "--passes=1", "--end-usage=q", cq, + "--cpu-used=0", "--threads=1", "--row-mt=0", + "--sb-size=128", + "--enable-rect-partitions=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--min-partition-size=16", + "--enable-restoration=1", + "--enable-palette=0", + "--deltaq-mode=0", + "--enable-intrabc=0", + "--enable-tx-size-search=0", + "--limit=1", + ]; + if ten_bit { + args.extend_from_slice(&["--input-bit-depth=10", "--bit-depth=10"]); + } + args.extend_from_slice(&["--obu", "-o", "-", "-"]); + let mut child = Command::new(aomenc_path()) + .args(&args) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before = crate::decode::part128_none_hits(); + let frames = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" + ); + named_refusals += 1; + eprintln!("seed {seed} refusal: {msg}"); + continue; + } + Ok(frames) => frames, + }; + let want = if ten_bit { + ffmpeg_decode_sequence_10bit(&stream, width, height, 1) + } else { + ffmpeg_decode_sequence(&stream, width, height, 1) + }; + assert_eq!(frames.len(), 1); + for (i, (got, want)) in frames.iter().zip(&want).enumerate() { + for (name, a, b, w) in [ + ("Y", &got.y, &want.y, width), + ("U", &got.u, &want.u, width / 2), + ("V", &got.v, &want.v, width / 2), + ] { + let n = a.iter().zip(b.iter()).filter(|(x, y)| x != y).count(); + let first = a.iter().zip(b.iter()).position(|(x, y)| x != y); + assert_eq!( + n, 0, + "{NAME} frame {i} {name} vs ffmpeg (seed {seed}): {n} differ, first row {} col {} ours {:?} ffmpeg {:?}", + first.unwrap_or(0) / w, + first.unwrap_or(0) % w, + first.map(|k| a[k]), + first.map(|k| b[k]), + ); + } + } + let hits = crate::decode::part128_none_hits() - before; + eprintln!("seed {seed} cq {cq} {width}x{height}: part128_none_hits +{hits}"); + if hits > 0 { + none_arms += 1; + } + matched += 1; + } + assert!( + matched > 0, + "{NAME}: every attempt refused; the gate never decoded a stream" + ); + assert!( + none_arms > 0, + "{NAME}: {matched} stream(s) decoded pixel-exact but NOT ONE 128 root was \ + PARTITION_NONE -- the arm this gate exists for never fired" + ); + eprintln!( + "{NAME}: {matched} pixel-exact ({none_arms} with a 128 NONE root), \ + {named_refusals} named refusals, part128_none_hits={}", + crate::decode::part128_none_hits() + ); + } + #[test] #[ignore = "lane-sb128 r2 diagnostic: is the frame-6 mismatch sb128-specific?"] fn sb128_r2_control_sb64() { diff --git a/lanes/mvtwin-r1.report.md b/lanes/mvtwin-r1.report.md new file mode 100644 index 00000000..b849eaea --- /dev/null +++ b/lanes/mvtwin-r1.report.md @@ -0,0 +1,91 @@ +# lane-mvtwin r1 — phase-by-phase diff of the two MV-stack twins vs libaom + +Base: lane-sb128 5ea5ec8, merged main 7a47fc1 (clean; the 128x128-superblock +refusal main re-added at b51719f stayed deleted — grep confirms). +Oracle: `~/.cache/aom-oracle/src/av1/common/mvref_common.c` (`setup_ref_mv_list`, +`av1_find_mv_refs`). Ours: `crates/ec-av1/src/mvstack.rs` +(`find_mv_stack_with_sign_bias` = single-ref twin, `find_mv_stack_compound` = compound twin). + +## The table (libaom line = mvref_common.c) + +| # | phase (libaom) | single-ref ours | compound ours | defect? | +|---|---|---|---|---| +| 1 | `row_adj`/`col_adj`, `find_valid_row/col_offset` reach (:502-533) | mvstack.rs:809 | mvstack.rs:1610 | **DEFECT 3** — both clamped the reach to the FRAME edge, libaom clamps to `tile->mi_row_start`/`mi_col_start` | +| 2 | `scan_row_mbmi` immediate, `len`/`weight`/`inc`/`processed_rows` (:141-190, :534-538) | `scan_row` :471 | `scan_row_compound` :1290 | exact (availability gate was `mi_row > 0`, folded into defect 3) | +| 3 | `scan_col_mbmi` (:192-236, :540-543) | `scan_col` :553 | `scan_col_compound` :1347 | exact | +| 4 | `has_top_right` + top-right `scan_blk_mbmi` (:264-312, :496, :544-548) | `scan_top_right` :645 | `scan_top_right_compound` :1403 | no change — see "has_tr" below | +| 5 | `nearest_match`, `REF_CAT_LEVEL` boost over `nearest_refmv_count` (:550-555) | :836 | :1600 | exact | +| 6 | `add_tpl_ref_mv` main loop, `step_h`/`step_w`/`blk_*_end` (:557-589) | :868 | :1625 | exact (compound reads the field once per side; `motion_field.rs:500` makes the lookup offset-independent, so both sides are Some/None together — libaom's single lookup) | +| 7 | `tpl_sample_pos` 3 extension samples + `check_sb_border` (:591-600, :316) | :898 | :1670 (added lane-sb128 r3) | exact — the twin drift r3 found, now symmetric | +| 8 | `GLOBALMV_OFFSET` / `zero_mv_ctx` far-or-missing test (:375-380, :406-412, :592) | :955 | :1750 | exact | +| 9 | corner `scan_blk_mbmi(-1,-1)` with `dummy_newmv_count`, weight `2*len`=4 (:604-607) | :967 | :1758 | exact | +| 10 | extended row/col scan `idx = 2..=MVREF_ROW_COLS` (:609-622) | :990 | :1770 | exact | +| 11 | `ref_match_count` + `mode_context` switch / `REFMV_OFFSET` (:624-651) | :1140 | :1858 | exact | +| 12 | the TWO bubble passes (nearest region, then the rest) (:653-682) | single stable `sort_by_key` :1050 | same :1802 | not a defect — every nearest entry carries `+REF_CAT_LEVEL` (640) and no post-boost entry can reach it (max post-boost weight seen is `len*weight` <= 80), so the two-phase ranking and one stable global sort agree | +| 13 | insertion cap `*refmv_count < MAX_REF_MV_STACK_SIZE` (:100, :128, :388, :425) | `add_candidate` :341 | `add_compound_candidate` :1268 | **DEFECT 2** — both pushed unbounded then sorted+truncated, keeping a different set than libaom's drop-at-insertion | +| 14 | `mi_size` = min(64x64 span, block span, frame edge) (:684-689) | :1060 | :1815 | exact | +| 15 | `process_compound_ref_mv_candidate`, sign-bias inversion, `can_rf > INTRA_FRAME` (:434-470, :693-706) | n/a | :1478 | exact | +| 16 | `comp_list` combine, slots past both lists = `gm_mv_candidates[idx]` (:708-720) | n/a | `combine_compound_candidates` :1520 | **DEFECT 1 (twin drift)** — filled `(0, 0)`; the single-ref twin closed the same gm-fallback gap in r6 | +| 17 | compound stack merge, `refmv_count==1` dedupe vs empty (:722-742) | n/a | :1845 | exact | +| 18 | `clamp_mv_ref` + `MV_BORDER`, every entry (:745-751, :768-772) | :1105 | :1878 | exact | +| 19 | single-ref extension gated per step on `MAX_MV_REF_CANDIDATES` (:754-766) | :1065 | n/a | exact | +| 20 | `mv_ref_list` tail filled with `gm_mv_candidates[0]`, unclamped (:775-782) | :1128 | n/a (libaom has no compound `mv_ref_list`) | exact | + +### has_tr (phase 4), why no change +Ours probes "is the grid cell at `(mi_row-1, mi_col+bw4)` populated", which for a +decoder is exactly "was it decoded". Walking libaom's mask logic: for SQUARE blocks +the mask result and "already decoded" coincide at both sb64 and sb128; for the +rect case that differs (`bs > 16` at a 64x128 block) libaom's own +`is_last_vertical_rect` refinement forces `has_tr = 1` again, agreeing with our +probe. Porting the mask WITHOUT the three shape refinements (which need the +partition type, not passed to this module) would REGRESS the VERT-rect case. +Recorded as the same corner-cut already documented at `mvstack.rs:588`; +upgrade path = thread the partition type in with the rect inter leaf. + +## Fixes (all in crates/ec-av1/src/mvstack.rs) +- D1 `combine_compound_candidates` (:1520 + call site :1859): unfilled slots take + `gm_mv(gm, ref_frame.side)`, not `(0, 0)` (mvref_common.c:718-719). +- D2 `add_candidate` (:341) / `add_compound_candidate` (:1268): drop the 9th + distinct candidate AT INSERTION (mvref_common.c:100/128/388/425); the dedup + weight bump still applies on a full stack. +- D3 both twins (:809, :1610) + new `MiGrid::tile_origin` (:216): reach and + availability are tile-relative (mvref_common.c:512-533). + +## Checks +`cargo test -p ec-av1 --lib mvstack::` -> 32 passed, 0 failed. Three new +deterministic tests, one per defect: +- `a_missing_compound_combine_slot_takes_that_sides_global_mv_not_zero` +- `the_ninth_distinct_candidate_is_dropped_at_insertion_not_after_sorting` +- `the_row_reach_is_clamped_to_the_tile_origin_not_the_frame_edge` (644 -> 648 vs 652) + +New real-aomenc gate `a_real_aomenc_compound_mv_stack_gate` (stream.rs), the first +compound gate here that does NOT pin `--enable-ref-frame-mvs=0`: +`--enable-ref-frame-mvs=1 --enable-order-hint=1 --auto-alt-ref=1 --lag-in-frames=25`, +cq sweep 45/55/35, 30 seeds/arm, hard-asserting BOTH `comp_mode_hits` and +`tmv_hits` advanced, every decode-order frame compared (Y/U/V) against ffmpeg, +decode errors only tolerated when the message contains "unsupported". +Arms: 8-bit sb64 gm=0 · 8-bit sb64 gm=1 · 10-bit sb128 gm=1. + +EVIDENCE: $HOME/.cache/mvtwin-suite-r1.log | cargo test -p ec-av1 --lib compound_mv_stack -- --test-threads=1 --nocapture | 3 arms FIRING pixel-exact: seed 44 comp_mode_hits +7 tmv_hits +56; seed 80 comp_mode_hits +1 tmv_hits +56; seed 122 (10-bit, sb128) comp_mode_hits +8 tmv_hits +55 +EVIDENCE: crates/ec-av1/src/mvstack.rs tests | cargo test -p ec-av1 --lib mvstack:: | 32 passed 0 failed, each of the 3 defects asserted on its own values + +Full suite (systemd unit, MemoryMax=10G): `cargo test -p ec-av1 --lib -j3` -> +**375 passed, 0 failed, 33 ignored**, 692 s. Log `$HOME/.cache/mvtwin-suite-r1.log`. + +EVIDENCE: $HOME/.cache/mvtwin-suite-r1.log | systemd-run --user --unit=mvtwin-suite-... cargo test -p ec-av1 --lib -j3 | test result: ok. 375 passed; 0 failed; 33 ignored + +## Open residue +- fix-now-elsewhere (NOT this lane's surface): a real aomenc stream 128 px wide + with `--tile-columns=1` MIS-DECODES frame 1 luma vs ffmpeg (seed 200, recipe in + `a_real_aomenc_compound_mv_stack_across_two_tile_columns_decodes_pixel_exact`, + `#[ignore]`d with the repro command in its doc). ABLATION-PROVEN pre-existing: + identical failure with r1's tile-origin clamp forced back to `(0, 0)`. That arm + is also the only one that reaches defect 3 on a real stream — + `mvstack::tile_reach_clips` advanced to 60 there. +- deferred(a stream whose compound pair names a non-IDENTITY ROTZOOM/AFFINE + reference) — `comp_gm_fill_hits` reads 0 on all three green arms, so D1 is + proven by its unit test, not yet by a real stream. aomenc at gradients content + keeps global motion IDENTITY even with `--enable-global-motion=1`. +- deferred(same) — `stack_full_drops` reads 0 on all three arms: no real block + here produced 9 distinct candidates. D2 is unit-test-proven only. +- accepted — `has_tr` corner-cut (phase 4 above), ceiling and upgrade path named. diff --git a/lanes/reelckf-r1.handoff.md b/lanes/reelckf-r1.handoff.md new file mode 100644 index 00000000..ab566727 --- /dev/null +++ b/lanes/reelckf-r1.handoff.md @@ -0,0 +1,100 @@ +# lane-reelckf r1 handoff + +Tip: see `git log -2`. Base `lane-sb128b` e8e64a6. Both root causes FIXED and the +lane is GREEN on its own gate; the only thing still owed is the final full-suite +number (the unit was still running at the turn cap, 318/~404 tests logged, zero +`FAILED` lines so far). Log: `$HOME/.cache/reelckf-suite-r1.log`. + +## Method (reusable) +`$HOME/.cache/reelckf-work/one.sh ` — extracts 2 s with `ffmpeg -ss -c:v copy +-f obu`, truncates to ONE frame with `trunc.py`, decodes under +`systemd-run --scope -p MemoryMax=6G` with `EC_PROBE_OUT16`, sha256s the output, +decodes the same truncated file with `ffmpeg -pix_fmt yuv420p10le`, and prints +per-plane diff count + first differing sample + bounding box. +`$HOME/.cache/reelckf-work/stage.sh ` — the same file through +`EC_AV1_PREFILT_DUMP16` / `EC_AV1_POSTDEBLOCK_DUMP16` on BOTH decoders. +`$HOME/.cache/reelckf-work/sweep.sh ` (env `MP=` for +max-partition) — aomenc recipe probe printing `reelc_chroma:` counters. + +## Per-key-frame findings (1920x792 10-bit AV1, 12 seek points) + +All measurements are of decode-order frame 0 of a 1-frame truncation. + +| ss | first differing sample (before) | extent | stage | verdict | +|----|--------------------------------|--------|-------|---------| +| 0 | none | — | — | exact before and after | +| 900 | U (r103,c304) | U rows 103..395 cols 304..479, V rows 99..383; luma exact | prefilter | fixed, now 0 | +| 1800 | U (r19,c538) | U rows 19..313 cols 311..732; luma exact | prefilter | fixed, now 0 | +| 2700 | U (r48,c468) | ONE 8x16-luma chroma pair, chroma rows 48..79 cols 464..492 | prefilter (467 diffs) vs postdeblock (499) — reconstruction, not a filter | fixed, now 0 | +| 3600 | U (r151,c469) | U rows 151..395 cols 468..959; luma exact | prefilter | fixed, now 0 | +| 4500 | none | — | — | exact before and after | +| 5400 | U (r164,c154) | U rows 164..168 cols 153..159 (one 8x4 chroma block) + V (r152,c278) | prefilter | fixed, now 0 | +| 6300 | U (r148,c545) | U rows 148..395; V rows 148..395 cols 84..903 | prefilter | fixed, now 0 | +| 7200 | U (r24,c561) | U rows 24..348 cols 210..959 | prefilter | fixed, now 0 | +| 9900 | U (r8,c500) | U rows 8..395 cols 497..959 | prefilter | fixed, now 0 | +| 8100 | frame 0 REFUSES (128-root non-SPLIT) | — | — | lane-sb128c owns it | +| 9000 | frame 0 REFUSES (128-root non-SPLIT) | — | — | lane-sb128c owns it | + +LUMA WAS BIT-EXACT IN EVERY ROW, before and after. That single fact exonerated +the entropy stream at the first measurement and is why no range ladder was ever +needed. + +## Blocks found, and the symbol/prediction comparison + +* ss=2700, chroma (48,468) = luma (96,936) = mi(24,234). aomdec `EC_TRACE_MODE`: + `EC_IMODE mi_row=24 mi_col=232..235 bsize=16` — four `BLOCK_4X16` + (`PARTITION_VERT_4`); `mi_col=235` is the chroma reference and prints + `uv_mode=13 skip=1`. Our chroma there was plain DC. +* ss=5400, chroma (164,152) = luma (328,608) = mi(82,76). aomdec: `mi_row=80..83 + mi_col=76 bsize=17` (`BLOCK_16X4`, `PARTITION_HORZ_4`), chroma reference + `mi_row=83`, `uv_mode=5` (D113). aomdec `EC_PRED mi_row=83 mi_col=76 plane=1 + txw=8 txh=4 mode=5 p_angle=107 have_top=1 have_left=1 n_top=8 n_left=4 ft=0`, + `EC_PREDOUT row0=415,431,453,471,467,442,408,397`. + Ours (`EC_PRED=1`, `OUR_PRED x=152 y=164 bw=8 bh=4 mode=5 ad=-2`): + `row0=[415,431,452,470,466,441,409,398]` — prediction, not residual. + +## Fixes applied and their effect +1. `decode.rs:7719` + `:10528` + `:10891` — a skipped intra block still predicts + with CfL (libaom `predict_and_reconstruct_intra_block` predicts every plane + and guards only the residual on `skip_txfm`). ss=2700 499 -> 0. +2. `decode.rs:7714` — the 1:4 pair reads `smooth_uv_neighbour` at `pair_mi` (the + chroma reference), not at the closing strip: libaom + `get_intra_edge_filter_type` uses `chroma_above_mbmi`/`chroma_left_mbmi`. The + wrong filter type flipped `av1_use_intra_edge_upsample` (`blk_wh = 8+4 = 12 + <= 16` upsamples for type 0, never for type 1). ss=5400 46 -> 0; every + remaining seek point -> 0. +3. `gate_coverage.rs` — `enable-cfl-intra` retired from BOTH never-exercised + lists, and `covers_both_depths` learned the `for depth in [8usize, 10]` + spelling (a gate with a `yuv420p10le` arm was being classified 10-bit only). + +## Hypotheses RULED OUT (do not re-spend rounds on these) +* Entropy desync / wrong CDF row: luma bit-exact on all ten frames. +* CDEF / loop restoration / deblock at a 128 superblock (the charter's leading + suspects): the prefilter dump already carries the whole defect (ss=2700 + prefilter 467 diffs, postdeblock 499) and luma is exact through every filter. +* `delta_q` / `delta_lf` read at the 128 root: a wrong plane qindex would move + the residual, not the prediction, and would not leave luma exact. +* Intra edge availability at 128 (`has_tr_128x128`/`has_bl_128x128`): `Reach` is + two booleans computed from luma geometry, which libaom reuses for chroma; the + ss=5400 `EC_PRED` line agrees (`n_tr=-1 n_bl=-1`). +* `Reach::of_rect(pw, ph, ...)` being luma-scaled while the chroma block is half + the size: checked, correct — libaom computes availability once, in luma mi. + +## Gate +`cargo test -p ec-av1 --lib a_real_aomenc_sb128_stream_whose_skipped_cfl -- --nocapture` +-> pixel-exact at 8-bit AND 10-bit, `directional_1to4_chroma_pairs=11` per arm, +`skipped_cfl=0`. + +## Exact next step for a successor +1. `grep -E "^test result|FAILED" $HOME/.cache/reelckf-suite-r1.log` — the suite + was mid-run at the cap. If anything is red, it is a sibling of the two + touched paths (grep `smooth_uv_neighbour` and `cfl_ac_q3`). +2. Defect 1 (skipped CfL) has NO synthetic gate. 20 aomenc recipes were swept + (cq 40/44/46/50/52/55/58/62/63 x mandelbrot, blurred mandelbrot, noised + mandelbrot, testsrc2, gradients, smptebars, cellauto, life, grey+noise; + min-partition 4, max-partition 16/32/64, sb-size 128/64) and `skip_cfl` + stayed 0 in every one. Either find a recipe that fires it (the counter is + printed by the gate AND by `decode_probe`, so a hit is immediately visible) + or commit a pinned single-frame stream fixture. +3. The two remaining ReelC seek points (8100, 9000) need lane-sb128c's 128-root + non-SPLIT partition; re-run the 12-point table after that lands. diff --git a/lanes/reelckf-r1.report.md b/lanes/reelckf-r1.report.md new file mode 100644 index 00000000..f839a7c3 --- /dev/null +++ b/lanes/reelckf-r1.report.md @@ -0,0 +1,99 @@ +# lane-reelckf r1 — ReelC key frames: two chroma-only reconstruction defects + +Base: `lane-sb128b` e8e64a6 (= main 18bf7dc + the 128 NONE block fix). + +## Premise re-measured (not taken from the charter) +census4's `reelc4.tsv` was recorded on main 18bf7dc, where every ReelC segment +REFUSED. On this base all ten non-`sb128c` key frames decode with **no refusal** +and **luma bit-exact**, chroma wrong — which is what made the entropy stream an +exonerated suspect from the first measurement. + +## Root causes (both chroma, both cited to libaom) + +1. **A skipped intra block still predicts, and CfL is prediction.** + libaom `predict_and_reconstruct_intra_block` (decodeframe.c) calls + `av1_predict_intra_block_facade` unconditionally and guards only the + residual on `mbmi->skip_txfm`. Three of our skip arms dropped the CfL term + and predicted plain DC: + - `crates/ec-av1/src/decode.rs:7719` — the 16x16-level 1:4 chroma pair + (`decode_rect4_16`). + - `crates/ec-av1/src/decode.rs:10528`, `:10891` — the two sub-8x8 4x4-group + chroma arms. + ReelC ss=2700: chroma-only bounded box at chroma (48..79, 464..492), the + `VERT_4` pair at mi(24,234)/(24,235) — aomdec `EC_TRACE_MODE` prints + `uv_mode=13 skip=1` there. 499 wrong samples -> **0**. + +2. **The 1:4 pair's chroma intra-edge FILTER TYPE is read at the chroma + reference, not at the closing strip.** + libaom `get_intra_edge_filter_type` (reconintra.c) reads + `chroma_above_mbmi`/`chroma_left_mbmi`, i.e. the neighbours of the + chroma-reference mi. We passed the closing strip's own mi, whose above cell + is the pair's FIRST strip: the mi-exact UV map missed, the coarse 16px + fallback answered, and the filter type flipped + `av1_use_intra_edge_upsample` (`blk_wh = 8 + 4 = 12 <= 16` upsamples for + type 0, never for type 1). `crates/ec-av1/src/decode.rs:7714`. + ReelC ss=5400, the `HORZ_4` pair at mi(82,83)/76: aomdec + `EC_PRED ... mode=5 p_angle=107 ft=0`, `EC_PREDOUT row0=415,431,453,471,...` + vs our `OUR_PRED ... row0=[415,431,452,470,...]`. 46 wrong samples -> **0**. + +## Files changed +- `crates/ec-av1/src/decode.rs` — the three skip arms now pass the CfL term; + the 1:4 pair's `smooth_uv_neighbour` is read at `pair_mi`; two new + counters + `pub fn reelc_chroma_counters()`. +- `crates/ec-av1/src/stream.rs` — new gate + `a_real_aomenc_sb128_stream_whose_skipped_cfl_and_1to4_chroma_pairs_decode_pixel_exact`. +- `crates/ec-av1/examples/decode_probe.rs` — prints `reelc_chroma:` counters. + +## Sweep for the same shape +`grep -n "u\.reconstruct\|v\.reconstruct\|buf\.reconstruct"` over decode.rs, then +every `if skip {` arm (21 sites) inspected: the square path (`:9416`), the rect +strip paths (`:6490`, `:6930`, `:7248`, `:8034`) and the inter paths already +computed `ac` inside their skip arm. The three fixed above were the only +chroma-CfL-dropping arms. All 11 `smooth_uv_neighbour` call sites checked: the +other ten pass a block/group ORIGIN mi (`leaf_mi`, `r*(SUB/MI)`), which already +is the chroma reference; only `decode_rect4_16` passed a non-origin mi. + +## Gate +`cargo test -p ec-av1 --lib a_real_aomenc_sb128_stream_whose_skipped_cfl -- --nocapture` +(real aomenc `--sb-size=128 --cpu-used=0 --enable-1to4-partitions=1 +--enable-cfl-intra=1 --min-partition-size=4 --max-partition-size=32 +--cq-level=52`, 256x256 `mandelbrot+noise(all_seed=7)`, 8- and 10-bit arms, +aomenc output hashed twice for reproducibility, decode error tolerated only if +the message contains "unsupported", `compared > 0` asserted). + +EVIDENCE: $HOME/.cache/reelckf-suite-r1.log (gate stdout quoted below) | cargo test ... --nocapture | pixel-exact at 8-bit and 10-bit, directional_1to4_chroma_pairs=11 per arm, skipped_cfl=0 + +## ReelC key-frame table (1 frame per seek point, `EC_PROBE_OUT16` vs ffmpeg yuv420p10le) + +| ss | before (this base) | after | +|----|--------------------|-------| +| 0 | 0 | 0 | +| 900 | 4173 (U 3107 / V 1066, max 7) | **0** | +| 1800 | 14402 (max 10) | **0** | +| 2700 | 499 (max 3) | **0** | +| 3600 | 119652 (max 37) | **0** | +| 4500 | 0 | 0 | +| 5400 | 46 (max 4) | **0** | +| 6300 | 33742 (max 7) | **0** | +| 7200 | 52891 (max 11) | **0** | +| 9900 | 4131 (max 7) | **0** | +| 8100 | frame 0 refuses (128-root non-SPLIT) — lane-sb128c | unchanged | +| 9000 | frame 0 refuses (128-root non-SPLIT) — lane-sb128c | unchanged | + +Luma was bit-exact in every row, before and after. + +EVIDENCE: $HOME/.cache/reelckf-work/xo_*.raw vs xr_*.raw | ffmpeg -ss -t 2 -c:v copy -f obu, trunc.py to 1 frame, decode_probe EC_PROBE_OUT16, ffmpeg -pix_fmt yuv420p10le | samples_diff 0/2280960 on all ten decodable key frames + +## Residue +- deferred(a lavfi/aomenc recipe or a committed stream fixture that fires a + SKIPPED 1:4 or sub-8x8 CfL block) — defect 1 has no synthetic gate. 20 aomenc + recipes were swept (cq 40/44/46/50/52/55/58/62/63 x mandelbrot, blurred + mandelbrot, noised mandelbrot, testsrc2, gradients, smptebars, cellauto, life, + grey+noise; min-partition 4, max-partition 16/32/64, sb-size 128) and + `skip_cfl` stayed 0 in all of them. Its evidence is ReelC ss=2700 (499 -> 0) + and the counter is printed by the gate and by `decode_probe`, so the first + recipe that reaches it is visible. +- accepted — ss=8100 / ss=9000 still refuse inside frame 0 on the 128-root + non-SPLIT partition; that refusal belongs to lane-sb128c. +- No refusal was lifted this round, so `refusal_inventory.rs` / + `gate_coverage.rs` are unchanged. diff --git a/lanes/reelckf-r2.handoff.md b/lanes/reelckf-r2.handoff.md new file mode 100644 index 00000000..17d3c382 --- /dev/null +++ b/lanes/reelckf-r2.handoff.md @@ -0,0 +1,22 @@ +# lane-reelckf r2 handoff + +SUPERSEDED: the suite finished after this file was written -- +`test result: ok. 379 passed; 0 failed; 33 ignored` (1055 s). Nothing is owed. +Tip `f7e0d3d` at the time of writing; see `lanes/reelckf-r2.report.md`. + +* Log: `$HOME/.cache/reelckf-suite-r2.log`. Check with a single + `grep -E "^test result|FAILED" $HOME/.cache/reelckf-suite-r2.log`. + At the cap: ~200 of ~412 tests logged, **zero `FAILED` lines**. + r1's run of the same suite on the pre-merge tree reached 361 tests with zero + FAILED before I stopped it (superseded by this run); both film-grain gates + (`a_real_aomenc_stream_with_film_grain_decodes_pixel_exact` and its 10-bit + sibling) were `ok` there, so the cross-lane concurrency red did not appear. +* If anything is red, it is a sibling of the two touched paths: grep + `smooth_uv_neighbour` and `cfl_ac_q3` in `crates/ec-av1/src/decode.rs`. +* Nothing else is owed. Merge of main 85887c7 is at 4667015 (clean auto-merge, + cdf.rs untouched, no deletions). +* Reusable instruments: `$HOME/.cache/reelckf-work/one.sh ` (per-seek-point + film compare), `.../cflsweep.sh [cpu] [maxpart] + [minpart]` (aomenc + `EC_TRACE_MODE=1 aomdec`, prints `cfl=` and `skipcfl=` + with no cargo build at all — this is how 28 more recipes were swept while a + suite held the target dir). diff --git a/lanes/reelckf-r2.report.md b/lanes/reelckf-r2.report.md new file mode 100644 index 00000000..e599a41d --- /dev/null +++ b/lanes/reelckf-r2.report.md @@ -0,0 +1,80 @@ +# lane-reelckf r2 report + +Base `lane-reelckf` bb6ebe5 (r1). Merged main 85887c7 (lane-mvtwin) at 4667015. + +## What changed +* `crates/ec-av1/fixtures/reelc_kf2700.obu` (NEW, tracked, 36 kB) — a 1920x792 + 10-bit AV1 key frame from one of the user's own films, truncated to its first + temporal unit. The only stream in this repo containing a **skipped + `UV_CFL_PRED` block**; the instrumented oracle counts 5 of them. +* `crates/ec-av1/src/stream.rs:2975` — + `a_real_film_key_frame_with_a_skipped_cfl_block_decodes_pixel_exact`: decodes + the fixture, HARD-asserts `reelc_chroma_counters().0 > 0` (skipped CfL) BEFORE + any ffmpeg dependency, then compares all three planes against + `ffmpeg -f obu -i - -f rawvideo -pix_fmt yuv420p10le -`. + +This closes r1's open item: defect 1 (a skipped intra block must still predict +with CfL) now has a gate that fails if the fix is reverted. + +## Gate hunt for a synthetic recipe: 18 more recipes, still zero +r1 swept 20 aomenc recipes without producing a skipped CfL block. r2 swept 28 +more, detecting the block **oracle-side** (`EC_TRACE_MODE=1 aomdec` → +`EC_IMODE_VAL ... uv_mode=13 skip=1`), which needs no decode of ours: + +| family | recipes | CfL blocks | skipped CfL | +|--------|---------|-----------|-------------| +| `geq` sin/X chroma-correlated stripes, cq 40..63, 8+10 bit | 6 | 0..3 | 0 | +| mandelbrot/testsrc2 with `cb=128+0.35*(lum(2X,2Y)-128)`, cq 40..63 | 6 | 1..117 | 0 | +| smooth ramp / low-frequency `sin(X/60)cos(Y/70)`, cq 45..63 | 6 | 0 | 0 | +| blurred mandelbrot/testsrc2/gradients/cellauto/life, 0.6 chroma gain, cq 55..63, 8+10 bit | 10 | 0..10 | 0 | + +Result (measured, not inferred): aomenc DOES pick CfL freely on +chroma-correlated content (117 blocks at cq 40), but never with `skip=1` — the +two conditions pull against each other (skip needs a zero LUMA residual, CfL +needs luma AC worth scaling). His film reaches it because directional intra on +real texture predicts exactly at a 1:4 leaf. Script: +`$HOME/.cache/reelckf-work/cflsweep.sh [cpu] [maxpart] [minpart]`. + +## Deviation from the charter +The charter asked for stored per-plane **sha256 constants**. The crate has no +sha256 (and adding a hash dependency for one fixture is not warranted), and the +sibling film fixture test `the_reelb_head_key_frame_decodes_pixel_exact` +already pins against a live `ffmpeg` decode. I used that same helper. Vacuity is +covered the other way round: the decode and the `skip_cfl > 0` assert run +unconditionally, only the pixel compare is behind `have_ffmpeg()`. + +## Ten real key frames, re-measured on the MERGED tree (main 85887c7 in) +`$HOME/.cache/reelckf-work/one.sh ` per point: 2 s `-c:v copy -f obu` extract, +truncated to one temporal unit, decoded with `EC_PROBE_OUT16` under a 6G scope, +compared sample-by-sample against `ffmpeg -pix_fmt yuv420p10le`. + +| ss | bytes | decode | samples differing (of 2 280 960) | +|----|-------|--------|----------------------------------| +| 0 | 74 | OK 1920x792 | 0 | +| 900 | 50350 | OK | 0 | +| 1800 | 98871 | OK | 0 | +| 2700 | 36785 | OK | 0 | +| 3600 | 39883 | OK | 0 | +| 4500 | 44734 | OK | 0 | +| 5400 | 287497 | OK | 0 | +| 6300 | 124067 | OK | 0 | +| 7200 | 82748 | OK | 0 | +| 9900 | 161573 | OK | 0 | + +10/10 Y=U=V=0, `max|d|=0`. The merge of lane-mvtwin changed nothing here. +ss=8100 and ss=9000 still refuse at a 128-root non-SPLIT partition (lane-sb128c's +cluster) and are not in the table. + +## Residue +* ss=8100 / ss=9000 — deferred(lane-sb128c's 128-root non-SPLIT partition). + Re-measured on the merged tree, both still stop at exactly + `unsupported: AV1 tile (a 128x128 superblock HORZ/VERT or AB partition (only + SPLIT and NONE are decoded at the 128 root))`. +* A synthetic aomenc recipe for a skipped CfL block — accepted as unreachable at + 48 recipes; the pinned film frame is the gate instead. + +## Full suite (merged tree, tip 735c80e) +`systemd-run --user --unit=reelckf-suite-1788326584 -p MemoryMax=10G ... cargo test -p ec-av1 --lib -j3` +-> `test result: ok. 379 passed; 0 failed; 33 ignored; 0 measured; 0 filtered out; +finished in 1055.41s`. Log: `$HOME/.cache/reelckf-suite-r2.log`. +**GREEN 379/0.** diff --git a/lanes/sb128b-r1.report.md b/lanes/sb128b-r1.report.md new file mode 100644 index 00000000..95d7da0a --- /dev/null +++ b/lanes/sb128b-r1.report.md @@ -0,0 +1,103 @@ +# lane-sb128b r1 — the 128 root's `PARTITION_NONE` arm (key frames) + +Branch `lane-sb128b` off `lane-sb128` 807c110, worktree `edith_codecs-sb128b`, commit `ceec9fa`. + +## ReelC first — the charter's premise is FALSE on ReelC's key frame + +EVIDENCE: `$HOME/.cache/sb128b-work/reelc2s.obu` (fresh cut, `ffmpeg -t 2 -c:v copy -f obu` +off the real film, 1428 bytes) | release `decode_probe` under a 6G scope with `EC_AV1_TRACE=1` +| **90 `partition_w128` symbols, value=3 (`PARTITION_SPLIT`) on every one** (ctx 3 x70, ctx 2 +x14, ctx 1 x5, ctx 0 x1); the run then stops at `an inter frame under a 128x128 superblock`. +Same numbers on the pre-existing `reelc-head.obu`. + +So ReelC's KEY frame is 100% SPLIT at the 128 root — the key-frame 128 arms are **not** its +blocker, and TASK 4's "the inter arms" is where ReelC's non-SPLIT roots live (r2 saw them only +with the inter refusal locally lifted). Charter premise "ReelC's key frame is the first thing to +decode / stops at a TASK-B arm" corrected here, measured, not argued. + +## What landed (all against libaom, each cited) + +`crates/ec-av1/src/decode.rs` +- `read_sb128_root` (11286) returns the root partition; the key-frame loop (11536) decodes + `PARTITION_NONE` as one 128x128 block and skips the superblock's other three visits + (`sb128_none`). The inter loop refuses any non-SPLIT root by name. +- `read_tx_size` (10003): `max_txsize_rect_lookup[BLOCK_128X128]` is TX_64X64 → a 128 block + reads BLOCK_64X64's own `tx_size_cat3` and resolves `max_tx >> depth`, and + `get_tx_size_context` is asked about 64, not 128. +- `decode_block`: the single-TU arm was `!tx_select || logical_tx == side`. Without `tx_select` + `logical_tx` IS `side` at every size <= 64, so the first half was redundant — and wrong at + 128. Now `logical_tx == side`, and the non-select resolve is `(side.min(64), luma_tx)`, so a + 128 block is always four TX_64X64 units. The TU loop passes the unit's **coefficient** side + (32 at TX_64X64), not its transform side. +- `delta_q`/`delta_lf` "this leaf IS the superblock" is now `side == sb_size` (was a hardcoded + 64 plus a `!sb128()` disable) — a NONE 128 root is the whole superblock. +- the 128 block's one `cdef_idx` read is copied to all four 64x64 CDEF units (libaom's four + units share one `MB_MODE_INFO`). + +`crates/ec-av1/src/stream.rs`: new gate (below). `refusal_inventory.rs`: the single +"partition other than SPLIT" string splits into three named arms. + +## Gate + +`a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact` — real aomenc +`--sb-size=128` with **no** `--max-partition-size` (the r1 gate's flag is exactly what made +every 128 root a forced SPLIT), smooth gradients at `--cq-level=63/55`, 384x384 + 256x256, +8- and 10-bit, `--enable-tx-size-search=0`. `#[ignore]`d: it is a reproducer, not a pass. + +EVIDENCE: `cargo test -p ec-av1 --lib -- --nocapture a_real_aomenc_key_frame_with_a_128x128_none` +| aomenc 384x384 cq63 seed 42, decoded then compared to ffmpeg | the NONE arm **fires** and the +tile decodes end to end (no desync panic, no refusal), but frame 0 luma differs from ffmpeg at +138523 of 147456 samples, first at row 0 col 60, magnitudes 1..3 (ours 114/113 where ffmpeg has +115) — a reconstruction difference, not an entropy blow-up. + +Two earlier failures on the way, both fixed and both real defects of the generalisation: +`transform.rs:843 index out of bounds (len 64, index 64)` = the redundant `!tx_select` arm +above sending a 128-wide inverse transform; then the pixel deltas. + +## Root cause of the residual (found, not guessed) + +`av1_get_max_uv_txsize` = `av1_get_adjusted_tx_size(max_txsize_rect_lookup[uv_plane_bsize])`. +The uv plane block of a 128x128 is 64x64 → TX_64X64 → **adjusted to TX_32X32**. A 128 block's +chroma is therefore FOUR TX_32X32 units per plane, and `decode_block` codes exactly one +whole-plane chroma unit. That is the desync, and it also means the charter's +"one chroma TU of 64x64 per plane / new chroma TX_64X64 path" is wrong: **no `TxbSet::Chroma64` +is needed at all.** I had transcribed the 16 libaom `[TX_64X64][PLANE_TYPE_UV]` CDF tables and +wired the variant before finding this; that work is reverted (`cdf.rs`/`cdf_state.rs` are +untouched in this commit) rather than shipped as dead code. + +## Refusals + +- `a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are decoded at the 128 + root)` — NOT lifted, TASKs 2/3, not started. +- `a 128x128 superblock PARTITION_NONE root on an inter frame (...)` — NOT lifted, TASK 4. +- `a 128x128 PARTITION_NONE block's chroma (its 64x64 uv plane block is four TX_32X32 units, + and this decoder codes one whole-plane chroma unit per block)` — NEW, guards the arm this + round built. fix-now(r2): give `decode_block` a chroma TU loop (2x2 TX_32X32, `TxbSet::Chroma32`, + per-unit `chroma_skip_ctx`, grids assembled for `record_split_luma`) — unblocked by that loop; + the gate above is the reproducer and flips green the moment it is right. +- `intrabc under a 128x128 superblock` — accepted, unchanged. + +## Suite + +`cargo test -p ec-av1 --lib` under user unit `sb128b-suite-1788322151.service`, +log `$HOME/.cache/sb128b-suite.log` — result appended below by the handoff line in the report +message. The 7 rect/AB reds inherited from 807c110 (r2's `deferred: attribute the 7`) are the +sibling lane's; this round touched no rect/AB path. + +## Deferred + +- deferred: TASK 2/3 (HORZ/VERT + AB at 128) — not started — unblocked by the chroma TU loop + plus rect handling at 128. +- deferred: TASK 4 (inter 128 NONE) — refused by name — unblocked by the same loop and the + sibling lane's inter residue. +- deferred: `tx_select` at 128 (`read_tx_size` now handles it, cat3 against 64) is UNTESTED — + every gate arm here runs `--enable-tx-size-search=0` — unblocked by an r2 arm with it on. + +## Suite state at hand-off (honest, incomplete) + +`sb128b-suite-1788322151.service` was STILL RUNNING when this round hit its tool-call ceiling. +At that point the log showed **2 failures, both inherited from 807c110's rect/AB cluster**: +`a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact`, +`a_real_aomenc_10bit_stream_with_a_32_level_ab_partition_decodes_pixel_exact`. +No total ("test result:" line) yet — read `$HOME/.cache/sb128b-suite.log` for the final count +before merging. NOT a clean-suite claim. diff --git a/lanes/sb128b-r2.report.md b/lanes/sb128b-r2.report.md new file mode 100644 index 00000000..7d425798 --- /dev/null +++ b/lanes/sb128b-r2.report.md @@ -0,0 +1,97 @@ +# lane-sb128b r2 — ReelC's key frame is BIT-EXACT; the 128 chroma TU loop; the 128 root's residual + +Branch `lane-sb128b`, worktree `edith_codecs-sb128b`, commits `4e13f60`, `1524838`, `c415a31` +(off r1's `d3bc8da` + `git merge main` b51719f, clean). + +## FIRST: the ReelC KEY-frame pixel check (the charter's first task — first ReelC pixel measurement ever) + +EVIDENCE: `$HOME/.cache/sb128b-work/{reelckf0.obu,ours.f0.yuv,ref.yuv}` | +`ffmpeg -ss 0 -t 2 -c:v copy -frames:v 1 -f obu` off the real film (74 B, 1920x792 yuv420p10le) +→ `dump_yuv` (release, 6G scope) vs `ffmpeg -pix_fmt yuv420p10le -f rawvideo` | +**`cmp` says BYTES EQUAL — ReelC's key frame decodes BIT-EXACT (4 561 920 bytes, 0 differing samples).** + +It was NOT exact before the merge. Pre-merge measurement (same artifacts, r1's tree): +Y 36448 samples off (max |d| 2), U/V 9483 each (max |d| 4), all inside the bottom partial +superblock row — luma rows 765..791 (768 = 6*128, frame is 792 tall) plus 3 deblock rows above, +`+1` per 16-row band, ref uniformly flat (this key frame is black). `git merge main` (lane-oddh's +odd-frame-size work) removes it entirely. Class: [[stale-premise lanes]] — the lane's base +predates the fix. + +ReelC now stops at `an inter frame under a 128x128 superblock` (probe on the 2 s cut, 72 frame +headers parsed) — the sibling lane-sb128 r3's residue, exactly as r1 predicted. + +## Merge seam (had to be fixed before anything could run) + +main b51719f re-introduced lane-oddh's blanket refusal `a sequence using 128x128 superblocks on a +frame larger than 64x64` (stream.rs) — textually a clean merge, semantically a lane-killer (the +ledger's recorded `merge seam` constraint). Deleted, with its inventory line, and its gate +`a_real_aomenc_128x128_superblock_stream_is_refused_by_name` turned into +`..._decodes_pixel_exact`. + +EVIDENCE: `cargo test -p ec-av1 --lib -- a_real_aomenc_128x128_superblock_stream gate_coverage` | +real aomenc 64x72 mandelbrot `--cpu-used=0 --sb-size=128` (`use_128x128_superblock` asserted in +the stream), decoded vs ffmpeg | **ok — 10 passed, 0 failed**; the frame's Y/U/V match ffmpeg +sample for sample. One recipe change was needed and is unrelated to the 128 root: at 64x72 +aomenc also picks `PARTITION_HORZ_4` below 16x16, so the gate now passes +`--enable-1to4-partitions=0 --min-partition-size=16` (gate_coverage green with it). + +## TASK A — the chroma half of a 128x128 `PARTITION_NONE` block (landed, not yet exact) + +`crates/ec-av1/src/decode.rs` +- `decode_block`'s multi-TU arm now codes `cn = chroma_side / chroma_tx` **squared** chroma units + per plane instead of one whole-plane unit. `av1_get_max_uv_txsize(BLOCK_128X128)` = + `av1_get_adjusted_tx_size(max_txsize_rect_lookup[BLOCK_64X64])` = TX_32X32, so a 128 block is + 2x2 TX_32X32 per plane; `cn == 1` (every block at 64 and below) is byte-for-byte the read this + always did. Per unit: `around_mi` gathered over the unit's own 64-luma-pixel span (which is + also its `txb_skip_ctx`, `read_plane`'s chroma branch), `tu_reach` on the matching luma + quadrant, own `set_palette_pred`. +- `Neighbours::record_mi_chroma` (new, next to `record_mi_luma`): per-unit chroma coefficient + context, luma-mi indexed with `record_split_luma_rect_mi`'s own frame-edge clamp. Applied + AFTER `record_split_luma` so the per-unit state is what the next block reads. +- The `skip` arm predicts per transform unit now (libaom predicts inside the transform-block + loop); `n_axis == 1` / `cn == 1` is the unchanged whole-block call. +- counter `chroma_split_tx_hits()`. + +**Result: not pixel-exact, so the refusal is BACK, reworded to what was measured.** +EVIDENCE: `$HOME/.cache/sb128b-work/g42.obu` (the gate's own arm reproduced by hand: gradients +seed 42, 384x384, cq63, `--sb-size=128 --cpu-used=0 --enable-tx-size-search=0`) | `dump_yuv` vs +`ffmpeg -pix_fmt yuv420p` | 139162/147456 luma samples differ, first at row 0 col 60 (ours 114, +ffmpeg 115). **ffmpeg's row 0 is a CONSTANT 115 across the whole first unit where ours ramps +115 → 112**, and the stream is 76 bytes: the mode and the DC agree, our first TX_64X64 luma unit +reads AC coefficients libaom never wrote. So the divergence is inside that unit's coefficient +read, not in chroma and not in prediction. + +Refusal now reads: `a 128x128 PARTITION_NONE block (four TX_64X64 luma and four TX_32X32 chroma +units all decode, but the first unit's coefficients already carry AC where libaom has DC only -- +lane-sb128b r2's open entropy residual)`. Gate +`a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact` stays `#[ignore]`d as +the reproducer, with its plane asserts rewritten to LOCATE the divergence (count + first +row/col/values) instead of printing 147 456 samples. + +Also corrected in that gate's doc: r1 wrote "ONE TX_64X64 chroma unit per plane / `TxbSet::Chroma64`"; +the truth is four TX_32X32 and no `Chroma64` set exists or is needed. + +## Not done + +- deferred: TASK A's `tx_select` at 128 arm (`--enable-tx-size-search=1`) — not added — unblocked + by the NONE arm being exact at all (an inexact arm cannot gate a tx-depth counter). +- deferred: TASK B (HORZ/VERT + AB at 128) — not started, refused by name + (`a 128x128 superblock HORZ/VERT or AB partition`) — unblocked by the same residual. +- deferred: TASK C (inter 128) — not started, refused by name on both this tree and the sibling's + (`an inter frame under a 128x128 superblock`) — unblocked by lane-sb128 r3 lifting its inter + root refusal; nothing of TASK C was written, so nothing is "ready behind" it. +- `git merge lane-sb128` NOT done: the sibling's tip is `dbf15a4` (gate-recipe fix only, no + inter-128 lift yet), so there was nothing to take. + +## Suite + +r2's first run (`$HOME/.cache/sb128b-suite-r2.log`, unit `sb128b-suite-r2-1788322817.service`) was +armed at the intermediate commit `1524838` and is superseded. Its FAILED list: the 2 rect/AB reds +inherited from 807c110 (`a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact`, +`a_real_aomenc_10bit_stream_with_a_32_level_ab_partition_decodes_pixel_exact`) — **still red after +`git merge main` b51719f, so main did NOT fix them** — plus the two 128 gates that this round's +final commit resolves (`..._128x128_superblock_stream...` now green, +`..._128x128_none_partition...` now `#[ignore]`d). +The authoritative run for `c415a31` is unit `sb128b-suite-r2b-1788323051.service` → +`$HOME/.cache/sb128b-suite-r2b.log`; it was still running at this round's tool-call ceiling. +NOT a clean-suite claim: read that log for the totals before merging. diff --git a/lanes/sb128b-r3.report.md b/lanes/sb128b-r3.report.md new file mode 100644 index 00000000..47828ed8 --- /dev/null +++ b/lanes/sb128b-r3.report.md @@ -0,0 +1,101 @@ +# lane-sb128b r3 — the 128x128 PARTITION_NONE block decodes PIXEL-EXACT (3 root causes), the 10-bit reds were a recipe defect + +Branch `lane-sb128b`, worktree `edith_codecs-sb128b`, commits `dd6f934` (merge main 7a47fc1 + TASK B), +`f2b6f1c` (TASK A), `7ceb309` (merge main 18bf7dc / lane-sb128 5ea5ec8). + +## TASK A — the 128 NONE residual: THREE root causes, none of them where r2 pointed + +r2 read "our first TX_64X64 luma unit reads AC coefficients libaom never wrote". Measured with a +range ladder (instrumented `aomdec` `EC_TRACE_COEFF` vs our `EC_TRACE_COEFF`) that premise is +WRONG: the first luma unit is identical symbol for symbol and range for range +(`all_zero ctx=1 rng=59208 / eob=3 rng=41268 / base_eob level=5 rng=44688 / ... / rng=36616`). +The divergence is at the SECOND element of the block, and it is three separate defects: + +1. **Plane order.** libaom's `decode_token_recon_block` loops 64x64 luma "mu" chunks + (`mu_blocks_wide/high = mi_size_wide[BLOCK_64X64]`) and codes EVERY PLANE of a chunk before the + next chunk. The oracle ladder is Y(0,0) U(0,0) V(0,0) Y(0,16) U(0,8) V(0,8) ... — Y,U,V per + quadrant. We read all four luma units and then all chroma units. Below 128 a block is one chunk, + so the fix (`nchunk = side/64`, luma TUs then chroma units per chunk) is byte-for-byte the old + order at every size the decoder already handled. +2. **The chroma `txb_skip_ctx` offset.** `get_txb_ctx`: chroma ctx is + `combine_entropy_contexts(above,left)` **+7** normally, **+10** when the plane block is LARGER + than the transform. A 128 block's 64x64 uv plane block with TX_32X32 units is AV1's only such + case, and our chroma table only ever carried the offset-7 rows (`txb_skip_chroma_*: [[u16;3];3]`). + Oracle read ctx=10, we read ctx=0. Added `TXB_SKIP_CHROMA_32_BIG{,_Q0,_Q1,_Q3}` from + `av1_default_txb_skip_cdfs[q][TX_32X32][10..13]` (token_cdfs.h, all four q contexts, verified by + re-deriving the existing offset-7 rows from the same array), `txb_skip_chroma_32` is six rows, + caller adds 3 when `cn > 1`. +3. **Deferred chroma context writes.** r2 recorded each chroma unit's coefficient context only + after the whole block, so the second quadrant read ctx 10 where the oracle reads 11 (base 1 from + its left neighbour inside the same block). Now recorded per unit inside the loop; the + post-`record_split_luma` replay stays, because that call would otherwise clobber them whole-block. + +Files: `crates/ec-av1/src/decode.rs` (mu-chunk loop + `chroma_ctx_offset` + per-unit record + +`read_plane`'s chroma `skip_ctx`), `crates/ec-av1/src/cdf.rs` (4 tables), +`crates/ec-av1/src/cdf_state.rs` (`txb_skip_chroma_32` 3 -> 6 rows). + +EVIDENCE: `$HOME/.cache/sb128b-work/{s44.obu,ref44.yuv,ours44.yuv.f0.yuv,ref.ladder}` | +aomenc gate-arm-3 recipe (seed 44 gradients 256x256 cq63 `--sb-size=128 --cpu-used=0 +--enable-tx-size-search=0 ...`), `EC_TRACE_COEFF` ladders of aomdec and `dump_yuv`, then +`dump_yuv` vs `ffmpeg -pix_fmt yuv420p` | **48 `txb_skip` symbols, ranges identical one for one; +0 of 98304 samples differ (pixel-exact)**. Before the fix: 60857 luma samples differed. + +REFUSAL LIFTED (with its gate): `a 128x128 PARTITION_NONE block (...)` deleted from `decode.rs` and +`refusal_inventory.rs`; `a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact` +un-`#[ignore]`d. +EVIDENCE: `cargo test -p ec-av1 --lib -- a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact --nocapture` | +4 real-aomenc arms (384x384 seed 42 cq63, 384x384 seed 43 cq55, 256x256 seed 44 cq63, 384x384 seed 45 +10-bit) decoded vs ffmpeg | **ok — 4/4 pixel-exact, 0 named refusals, `part128_none_hits=31`** +(9+9+4+9 128-NONE roots). Sibling gates `a_real_aomenc_128x128_superblock_stream_decodes_pixel_exact`, +`refusal_inventory`, `gate_coverage` re-run green in the same invocation (14 passed / 0 failed). + +## TASK B — the 2 inherited 10-bit reds were an ENCODER RECIPE defect + +`git show main:crates/ec-av1/src/stream.rs` vs the lane's: r2 rewrote `--min-partition-size=16` to +`32` at **13** call sites that main has at 16, including both failing gates. 32 removes the 16-level +the rect/AB gates assert. Reverted all 13 (the lane's own two 128 gates keep their deliberate 32). +EVIDENCE: `cargo test -p ec-av1 --lib -- a_real_aomenc_10bit_rect_and_ab_partitions_decode_pixel_exact a_real_aomenc_10bit_stream_with_a_32_level_ab_partition_decodes_pixel_exact refusal_inventory gate_coverage` | +recipe reverted, rebuilt, re-run | **ok — 14 passed, 0 failed**. Class: +[[gate-recipe-confound]] / the ledger's "a gate that decodes pixel-exact with counter 0 is an +encoder-recipe defect". Swept: those 13 are every 16->32 rewrite in the lane. + +## TASK C — merges + +`git merge main` twice: 7a47fc1 (one conflict, `decode.rs`'s skipped-block arm: took main's +lane-hgkf per-TU prediction + `true_width` guard + `SKIP_SPLIT_TX_HITS`, broadened its condition +from `tx_select && logical_tx < side` to `logical_tx < side` because a 128 block's transform is +TX_64X64 with no tx-depth syntax; the counter keeps its narrow `tx_select` meaning), then 18bf7dc +(= lane-sb128 5ea5ec8; three conflicts in `stream.rs`, ALL resolved to main's side per the batch +coordinator, so main's single seam gate `a_real_aomenc_128x128_superblock_stream_decodes_pixel_exact` +survives and lane-oddh's seam refusal stays deleted). `cdf.rs` merged clean; its NZ_MAP and +FILTER_INTRA regions are byte-identical to main's (`git diff main -- crates/ec-av1/src/cdf.rs` shows +only the four new `TXB_SKIP_CHROMA_32_BIG*` tables). + +## Suite + +EVIDENCE: `$HOME/.cache/sb128b-suite-r3.log` (unit `sb128b-suite-r3-1788323779.service`, tip +`7ceb309`) | `EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j3` | +**test result: ok. 371 passed; 0 failed; 32 ignored; 473.61s** — GREEN. + +## ReelC key frame + +EVIDENCE: `$HOME/.cache/sb128b-work/{reelckf0.obu,reelcours.yuv.f0.yuv,ref.yuv}` | r2's recipe +(`ffmpeg -t 2 -c:v copy -f obu` off the film, 1920x792 yuv420p10le), `dump_yuv` under a 6G scope vs +ffmpeg's rawvideo | **`cmp` says BYTES EQUAL — 4 561 920 bytes, 0 differing samples.** + +Film probe on the 2 s cut (`decode_probe reelc2s.obu`) still stops at +`an inter frame under a 128x128 superblock (this decoder's inter tile path recurses a 64x64 +superblock root only)` — main 18bf7dc (lane-sb128 5ea5ec8) did NOT lift this one on this tree. + +## Open residue + +- deferred: `a 128x128 superblock HORZ/VERT or AB partition` — not started; every 128 root in the + four gate arms resolves NONE or SPLIT, so nothing here is measured. Unblocked by an aomenc recipe + that actually emits a 128-level HORZ/VERT (r2's seed-42 "HORZ/VERT at 128" sighting was our own + desync talking — class [[refusal-from-own-desync]]: with the entropy fixed, that same stream + reads nine NONE roots). +- deferred: `a 128x128 superblock PARTITION_NONE root on an inter frame` and + `an inter frame under a 128x128 superblock` (the ReelC blocker) — inter path untouched this round; + unblocked by the inter tile path recursing a 128 root. +- deferred: the `--enable-tx-size-search=1` arm at 128 (a read tx_depth under a 128 NONE root) — + the four arms all pin `=0`; unblocked now that the NONE arm is exact, so it is a one-arm follow-up.