Assert the frame-edge OBMC neighbour span fires on the 128-SB inter witness
Browse files at this commit7aad309d737d8237d0b636ca9b6a26dbaf904d82Parent: 715a65d- test
- assert the frame-edge OBMC neighbour span fires on the 128-SB inter witness
2 changed files +28 -1
crates/ec-av1/src/decode.rsmodified+21 -0
| @@ -2338,6 +2338,21 @@ pub(crate) fn obmc_pair_filter_hits() -> usize { | ||
| 2338 | 2338 | OBMC_PAIR_FILTER_HITS.with(|c| c.get()) |
| 2339 | 2339 | } |
| 2340 | 2340 | |
| 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 | + | |
| 2341 | 2356 | /// Current value of [`OBMC_HITS_8`]. |
| 2342 | 2357 | pub(crate) fn obmc_hits_8() -> usize { |
| 2343 | 2358 | OBMC_HITS_8.with(|c| c.get()) |
| @@ -19597,6 +19612,9 @@ fn obmc_blend( | ||
| 19597 | 19612 | ec_obmc_trace("above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind); |
| 19598 | 19613 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 19599 | 19614 | 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 | + } | |
| 19600 | 19618 | let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4); |
| 19601 | 19619 | // lane-t900 r14: the prediction is `op_mi_size` wide (kernel choice |
| 19602 | 19620 | // included); only the WRITE is clipped to this block's own buffer. |
| @@ -19630,6 +19648,9 @@ fn obmc_blend( | ||
| 19630 | 19648 | ec_obmc_trace("left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind); |
| 19631 | 19649 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 19632 | 19650 | 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 | + } | |
| 19633 | 19654 | let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4); |
| 19634 | 19655 | let tmp_y = obmc_neighbour_pred(ny, px, py + oy, nb.mv, bw, bh, true, h_kind, v_kind, nb_scale); |
| 19635 | 19656 | 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 { | ||
| 30472 | 30472 | // lane-t900 r10: the rect warp top-right reach (600 blocks here). |
| 30473 | 30473 | let tr_before = crate::decode::tr_reach_longer_side_hits(); |
| 30474 | 30474 | 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(); | |
| 30475 | 30479 | let frames = match decode_stream(&stream) { |
| 30476 | 30480 | Ok(frames) => frames, |
| 30477 | 30481 | Err(e) => panic!("{NAME}: decode_stream refused: {e}"), |
| 30478 | 30482 | }; |
| 30483 | + let obmc_edge_span = crate::decode::obmc_edge_span_hits() - edge_before; | |
| 30479 | 30484 | let fired = ( |
| 30480 | 30485 | crate::decode::warp_plane_suppress_hits() - before.0, |
| 30481 | 30486 | crate::decode::cdef_idx_hits() - before.1, |
| @@ -30508,6 +30513,7 @@ mod tests { | ||
| 30508 | 30513 | ("sub8_chroma_tx_from_ref", sub8tx), |
| 30509 | 30514 | ("inter_neighbour_not_smooth", notsmooth), |
| 30510 | 30515 | ("tr_reach_longer_side", tr), |
| 30516 | + ("obmc_edge_span", obmc_edge_span), | |
| 30511 | 30517 | ] { |
| 30512 | 30518 | assert!( |
| 30513 | 30519 | n > 0, |
| @@ -30534,7 +30540,7 @@ mod tests { | ||
| 30534 | 30540 | cdef_idx={} inter_sb128_vert={} interintra_rect={} non_chroma_ref_ctx_skip={} \ |
| 30535 | 30541 | intra_in_inter_txctx={} edge_filter_mi_fix={} intra16x4_in_inter={:?} \ |
| 30536 | 30542 | 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}", | |
| 30538 | 30544 | fired.0, fired.1, fired.2, fired.3, fired.4, fired.5, fired.6, i16 |
| 30539 | 30545 | ); |
| 30540 | 30546 | } |