aom: Move force_zeromv_skip logic up in nonrd_pickmode

From 04d6253b0c1689f49563a6da9ce047bd3e1b584f Mon Sep 17 00:00:00 2001
From: Marco Paniconi <[EMAIL REDACTED]>
Date: Tue, 2 Apr 2024 18:06:24 +0000
Subject: [PATCH] Move force_zeromv_skip logic up in nonrd_pickmode

Move the skip logic for force_zeromv_for_blk further up
in the nonrd_pickmode, to avoid possibel conflict with
the sb_me_block feature, which has an early exit that
conflict with force_zeromv_skip. Currently this has no
effect, but change it now in case the sb_me_block feature
is modified.

Bitexact on speed 6-11 for screen, with neutral
IC speedup.

Change-Id: I94160ac6c6dd2b7a4025c20bcf62d2c9e97eff65
---
 av1/encoder/nonrd_pickmode.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c
index 57c74f66d..ff8f6af56 100644
--- a/av1/encoder/nonrd_pickmode.c
+++ b/av1/encoder/nonrd_pickmode.c
@@ -2361,6 +2361,15 @@ static AOM_FORCE_INLINE bool skip_inter_mode_nonrd(
       (*this_mode != GLOBALMV || *ref_frame != LAST_FRAME))
     return true;
 
+  // Skip mode for some modes and reference frames when
+  // force_zeromv_skip_for_blk flag is true.
+  if (x->force_zeromv_skip_for_blk &&
+      ((!(*this_mode == NEARESTMV &&
+          search_state->frame_mv[*this_mode][*ref_frame].as_int == 0) &&
+        *this_mode != GLOBALMV) ||
+       *ref_frame != LAST_FRAME))
+    return true;
+
   if (x->sb_me_block && *ref_frame == LAST_FRAME) {
     // We want to make sure to test the superblock MV:
     // so don't skip (return false) for NEAREST_LAST or NEAR_LAST if they
@@ -2403,15 +2412,6 @@ static AOM_FORCE_INLINE bool skip_inter_mode_nonrd(
   // Skip the mode if use reference frame mask flag is not set.
   if (!search_state->use_ref_frame_mask[*ref_frame]) return true;
 
-  // Skip mode for some modes and reference frames when
-  // force_zeromv_skip_for_blk flag is true.
-  if (x->force_zeromv_skip_for_blk &&
-      ((!(*this_mode == NEARESTMV &&
-          search_state->frame_mv[*this_mode][*ref_frame].as_int == 0) &&
-        *this_mode != GLOBALMV) ||
-       *ref_frame != LAST_FRAME))
-    return true;
-
   // Skip compound mode based on variance of previously evaluated single
   // reference modes.
   if (rt_sf->prune_compoundmode_with_singlemode_var && !*is_single_pred &&