Commit 10566b238b for aom

commit 10566b238bbc72155bc7c976fdc7e94dc6e1a8c3
Author: Marco Paniconi <marpan@google.com>
Date:   Wed May 20 18:03:52 2026 +0000

    rtc: Fix to sad pruning for real-time mode

    Check if motion vector is within bounds before
    using that predictor sad to reduce the bias
    min_prev_mv_sad. Otherwise an invalid predictor
    could be causing the sad threshold to go too low
    and prune out other valid references and modes.

    Bug: 514816767
    Change-Id: I7017dda883a789ab73d68987c08cef9bffaf5b96

diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 3ebbd10701..0ee6f482ea 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4114,7 +4114,13 @@ static inline void init_mode_skip_mask(mode_skip_mask_t *mask,
     for (int r_idx = 0; r_idx < num_rt_refs; r_idx++) {
       const MV_REFERENCE_FRAME ref = real_time_ref_combos[r_idx][0];
       if (ref != INTRA_FRAME) {
-        min_pred_mv_sad = AOMMIN(min_pred_mv_sad, x->pred_mv_sad[ref]);
+        const MV_REFERENCE_FRAME ref_frames[2] = { ref, NONE_FRAME };
+        const int_mv ref_mv =
+            av1_get_ref_mv_from_stack(0, ref_frames, 0, &x->mbmi_ext);
+        const FULLPEL_MV full_mv = get_fullmv_from_mv(&ref_mv.as_mv);
+        if (av1_is_fullmv_in_range(&x->mv_limits, full_mv)) {
+          min_pred_mv_sad = AOMMIN(min_pred_mv_sad, x->pred_mv_sad[ref]);
+        }
       }
     }
   } else {