rtc: 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 possible 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. We also need to move up the check on use_ref_frame_mask, otherwise the frame_mv (in the force_zeromv_skip_for_blk check) may not be set. This is a re-application of the patch https://aomedia-review.googlesource.com/c/aom/+/188741, with the fix for the valgrind issue. Bitexact on screen, with neutral IC speedup. Change-Id: I33d4fcb25022abf43a109e7412cf7ea6b12f053b
diff --git a/av1/encoder/nonrd_pickmode.c b/av1/encoder/nonrd_pickmode.c index 57c74f6..fdc10de 100644 --- a/av1/encoder/nonrd_pickmode.c +++ b/av1/encoder/nonrd_pickmode.c
@@ -2361,6 +2361,18 @@ (*this_mode != GLOBALMV || *ref_frame != LAST_FRAME)) return true; + // 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; + 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 @@ -2400,18 +2412,6 @@ mi->ref_frame[0] = *ref_frame; mi->ref_frame[1] = *ref_frame2; - // 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 &&