forge
Explore
Log in

Don't you dare go Hollow

Assert the frame-edge OBMC neighbour span fires on the 128-SB inter witness

Browse files at this commit

7aad309d737d8237d0b636ca9b6a26dbaf904d82Ahmet Kaan GümüşParent: 715a65d
  • test
    • assert the frame-edge OBMC neighbour span fires on the 128-SB inter witness
Show full message
test(av1): assert the frame-edge OBMC neighbour span fires on the 128-SB inter witness

obmc_edge_span_hits counts OBMC neighbour strips whose span runs past mi_rows/
mi_cols -- the shape the previous commit fixed. The 10-bit 1920x792 128-SB
witness (198 mi rows, so every bottom-row block overhangs) fires it 33 times
and the gate now hard-asserts it, so the fix cannot silently regress.
crates/ec-av1/src/decode.rsmodified+21 -0
@@ -2338,6 +2338,21 @@ pub(crate) fn obmc_pair_filter_hits() -> usize {
23382338 OBMC_PAIR_FILTER_HITS.with(|c| c.get())
23392339 }
23402340
2341+// lane-t900 r14: how many OBMC neighbour predictions run PAST the frame edge
2342+// -- libaom's `op_mi_size` is `AOMMIN(xd->width|height, mi_step)`, the block's
2343+// own side, so a block overhanging the bottom/right still predicts the full
2344+// neighbour strip (the destination write is what clips). We used to shrink the
2345+// prediction to the visible part, which at 4 chroma rows/cols also swaps the
2346+// vertical/horizontal kernel to the 4-tap one. The gate's proof the shape fired.
2347+thread_local! {
2348+ static OBMC_EDGE_SPAN_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
2349+}
2350+
2351+/// Current value of [`OBMC_EDGE_SPAN_HITS`].
2352+pub(crate) fn obmc_edge_span_hits() -> usize {
2353+ OBMC_EDGE_SPAN_HITS.with(|c| c.get())
2354+}
2355+
23412356 /// Current value of [`OBMC_HITS_8`].
23422357 pub(crate) fn obmc_hits_8() -> usize {
23432358 OBMC_HITS_8.with(|c| c.get())
@@ -19597,6 +19612,9 @@ fn obmc_blend(
1959719612 ec_obmc_trace("above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind);
1959819613 let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?;
1959919614 let nb_scale = mc::scale_factor(ny.width, frame_width);
19615+ if mi_col + off4 + span4 > mi_cols {
19616+ OBMC_EDGE_SPAN_HITS.with(|c| c.set(c.get() + 1));
19617+ }
1960019618 let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4);
1960119619 // lane-t900 r14: the prediction is `op_mi_size` wide (kernel choice
1960219620 // included); only the WRITE is clipped to this block's own buffer.
@@ -19630,6 +19648,9 @@ fn obmc_blend(
1963019648 ec_obmc_trace("left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind);
1963119649 let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?;
1963219650 let nb_scale = mc::scale_factor(ny.width, frame_width);
19651+ if mi_row + off4 + span4 > mi_rows {
19652+ OBMC_EDGE_SPAN_HITS.with(|c| c.set(c.get() + 1));
19653+ }
1963319654 let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4);
1963419655 let tmp_y = obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, h_kind, v_kind, nb_scale);
1963519656 obmc_blend_h(pred_y, side, 0, oy, bw, bh.min(write_h - oy), &tmp_y);
crates/ec-av1/src/stream.rsmodified+7 -1
@@ -30472,10 +30472,15 @@ mod tests {
3047230472 // lane-t900 r10: the rect warp top-right reach (600 blocks here).
3047330473 let tr_before = crate::decode::tr_reach_longer_side_hits();
3047430474 let i16_before = crate::decode::intra16x4_in_inter_hits();
30475+ // lane-t900 r14: OBMC neighbour strips that run past the frame edge
30476+ // (792 luma rows = 198 mi rows, so every bottom-row 32x32 block
30477+ // overhangs) -- the shape whose prediction size used to be clamped.
30478+ let edge_before = crate::decode::obmc_edge_span_hits();
3047530479 let frames = match decode_stream(&stream) {
3047630480 Ok(frames) => frames,
3047730481 Err(e) => panic!("{NAME}: decode_stream refused: {e}"),
3047830482 };
30483+ let obmc_edge_span = crate::decode::obmc_edge_span_hits() - edge_before;
3047930484 let fired = (
3048030485 crate::decode::warp_plane_suppress_hits() - before.0,
3048130486 crate::decode::cdef_idx_hits() - before.1,
@@ -30508,6 +30513,7 @@ mod tests {
3050830513 ("sub8_chroma_tx_from_ref", sub8tx),
3050930514 ("inter_neighbour_not_smooth", notsmooth),
3051030515 ("tr_reach_longer_side", tr),
30516+ ("obmc_edge_span", obmc_edge_span),
3051130517 ] {
3051230518 assert!(
3051330519 n > 0,
@@ -30534,7 +30540,7 @@ mod tests {
3053430540 cdef_idx={} inter_sb128_vert={} interintra_rect={} non_chroma_ref_ctx_skip={} \
3053530541 intra_in_inter_txctx={} edge_filter_mi_fix={} intra16x4_in_inter={:?} \
3053630542 sub8_chroma_tx_from_ref={sub8tx} inter_neighbour_not_smooth={notsmooth} \
30537- tr_reach_longer_side={tr}",
30543+ tr_reach_longer_side={tr} obmc_edge_span={obmc_edge_span}",
3053830544 fired.0, fired.1, fired.2, fired.3, fired.4, fired.5, fired.6, i16
3053930545 );
3054030546 }