Copy global motion to mbmi to help with context
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index b2d812a..a104738 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -481,6 +481,8 @@
 #else
   WarpedMotionParams wm_params;
 #endif  // CONFIG_EXTENDED_WARP_PREDICTION
+  /*! \brief Whether global affine warp is used for the block */
+  int global_mv_block[2];
   /*! \brief The type of intra mode used by inter-intra */
   INTERINTRA_MODE interintra_mode;
   /*! \brief The type of wedge used in interintra mode. */
diff --git a/av1/common/mvref_common.c b/av1/common/mvref_common.c
index 9c7c461..36a6bb5 100644
--- a/av1/common/mvref_common.c
+++ b/av1/common/mvref_common.c
@@ -384,7 +384,6 @@
     const MV_REFERENCE_FRAME rf[2], uint8_t *refmv_count,
     uint8_t *ref_match_count, uint8_t *newmv_count, CANDIDATE_MV *ref_mv_stack,
     uint16_t *ref_mv_weight, int_mv *gm_mv_candidates,
-    const WarpedMotionParams *gm_params[INTER_REFS_PER_FRAME],
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
     const MB_MODE_INFO *mbmi,
     MV_REFERENCE_FRAME ref_frame_idx0[MAX_REF_MV_STACK_SIZE],
@@ -437,7 +436,7 @@
 #endif
       int_mv this_refmv[2];
       for (ref = 0; ref < 2; ++ref) {
-        if (is_global_mv_block(candidate, gm_params[rf[ref]]->wmtype))
+        if (candidate->global_mv_block[ref])
           this_refmv[ref] = gm_mv_candidates[ref];
         else
           this_refmv[ref] = get_block_mv(candidate,
@@ -488,10 +487,9 @@
 #endif  // CONFIG_C071_SUBBLK_WARPMV
                                     ref);
         } else {
-          const int is_gm_block =
-              rf[0] == NONE_FRAME || rf[0] == INTRA_FRAME
-                  ? 0
-                  : is_global_mv_block(candidate, gm_params[rf[0]]->wmtype);
+          const int is_gm_block = rf[0] == NONE_FRAME || rf[0] == INTRA_FRAME
+                                      ? 0
+                                      : candidate->global_mv_block[ref];
           this_refmv = is_gm_block ? gm_mv_candidates[0]
                                    : get_block_mv(candidate,
 #if CONFIG_C071_SUBBLK_WARPMV
@@ -500,10 +498,9 @@
                                                   ref);
         }
 #else
-        const int is_gm_block =
-            rf[0] == NONE_FRAME || rf[0] == INTRA_FRAME
-                ? 0
-                : is_global_mv_block(candidate, gm_params[rf[0]]->wmtype);
+        const int is_gm_block = rf[0] == NONE_FRAME || rf[0] == INTRA_FRAME
+                                    ? 0
+                                    : candidate->global_mv_block[ref];
         const int_mv this_refmv = is_gm_block ? gm_mv_candidates[0]
                                               : get_block_mv(candidate,
 #if CONFIG_C071_SUBBLK_WARPMV
@@ -554,8 +551,7 @@
           const int cand_to_ref_dist =
               cm->ref_frame_relative_dist[candidate->ref_frame[ref]];
 
-          const int is_gm_block = is_global_mv_block(
-              candidate, gm_params[candidate->ref_frame[ref]]->wmtype);
+          const int is_gm_block = candidate->global_mv_block[ref];
           const int_mv cand_refmv = is_gm_block ? gm_mv_candidates[0]
                                                 : get_block_mv(candidate,
 #if CONFIG_C071_SUBBLK_WARPMV
@@ -616,7 +612,7 @@
         int_mv this_refmv[2];
 
         for (ref = 0; ref < 2; ++ref) {
-          if (is_global_mv_block(candidate, gm_params[rf[ref]]->wmtype))
+          if (candidate->global_mv_block[ref])
             this_refmv[ref] = gm_mv_candidates[ref];
           else
             this_refmv[ref] = get_block_mv(candidate,
@@ -666,8 +662,8 @@
 
         if (candidate_ref_idx0 != -1 && candidate_ref_idx1 != -1) {
           int_mv this_refmv[2];
-          const int is_gm_block = is_global_mv_block(
-              candidate, gm_params[rf[candidate_ref_idx0]]->wmtype);
+          const int is_gm_block =
+              candidate->global_mv_block[candidate_ref_idx0];
           this_refmv[candidate_ref_idx0] =
               is_gm_block ? gm_mv_candidates[candidate_ref_idx0]
                           : get_block_mv(candidate,
@@ -819,7 +815,6 @@
     int mi_col, const MV_REFERENCE_FRAME rf[2], int row_offset,
     CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight, uint8_t *refmv_count,
     uint8_t *ref_match_count, uint8_t *newmv_count, int_mv *gm_mv_candidates,
-    const WarpedMotionParams *gm_params[INTER_REFS_PER_FRAME],
     int max_row_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
     MV_REFERENCE_FRAME *ref_frame_idx0, MV_REFERENCE_FRAME *ref_frame_idx1,
@@ -922,7 +917,6 @@
 #endif  // CONFIG_C071_SUBBLK_WARPMV
                          rf, refmv_count, ref_match_count, newmv_count,
                          ref_mv_stack, ref_mv_weight, gm_mv_candidates,
-                         gm_params,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                          xd->mi[0], ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -981,9 +975,7 @@
 #endif  // CONFIG_TIP || CONFIG_EXT_RECUR_PARTITIONS
     const MV_REFERENCE_FRAME rf[2], int col_offset, CANDIDATE_MV *ref_mv_stack,
     uint16_t *ref_mv_weight, uint8_t *refmv_count, uint8_t *ref_match_count,
-    uint8_t *newmv_count, int_mv *gm_mv_candidates,
-    const WarpedMotionParams *gm_params[INTER_REFS_PER_FRAME],
-    int max_col_offset,
+    uint8_t *newmv_count, int_mv *gm_mv_candidates, int max_col_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
     MV_REFERENCE_FRAME *ref_frame_idx0, MV_REFERENCE_FRAME *ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1083,7 +1075,6 @@
 #endif  // CONFIG_C071_SUBBLK_WARPMV
                          rf, refmv_count, ref_match_count, newmv_count,
                          ref_mv_stack, ref_mv_weight, gm_mv_candidates,
-                         gm_params,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                          xd->mi[0], ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1131,7 +1122,6 @@
     const int mi_col, const MV_REFERENCE_FRAME rf[2], int row_offset,
     int col_offset, CANDIDATE_MV *ref_mv_stack, uint16_t *ref_mv_weight,
     uint8_t *ref_match_count, uint8_t *newmv_count, int_mv *gm_mv_candidates,
-    const WarpedMotionParams *gm_params[INTER_REFS_PER_FRAME],
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
     MV_REFERENCE_FRAME *ref_frame_idx0, MV_REFERENCE_FRAME *ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1193,7 +1183,6 @@
 #endif  // CONFIG_C071_SUBBLK_WARPMV
                          rf, refmv_count, ref_match_count, newmv_count,
                          ref_mv_stack, ref_mv_weight, gm_mv_candidates,
-                         gm_params,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                          xd->mi[0], ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1789,10 +1778,6 @@
   const int has_bl = has_bottom_left(cm, xd, mi_row, mi_col, bs);
 #endif  // CONFIG_C043_MVP_IMPROVEMENTS
 #endif  // CONFIG_EXT_RECUR_PARTITIONS
-  const WarpedMotionParams *gm_params[INTER_REFS_PER_FRAME];
-  for (int r = 0; r < INTER_REFS_PER_FRAME; ++r) {
-    gm_params[r] = effective_global_motion(xd, r);
-  }
 
   MV_REFERENCE_FRAME rf[2];
   const TileInfo *const tile = &xd->tile;
@@ -1862,7 +1847,7 @@
   if (xd->left_available) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, (xd->height - 1), -1,
                   ref_mv_stack, ref_mv_weight, &col_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1881,7 +1866,7 @@
   if (xd->up_available) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, (xd->width - 1), ref_mv_stack,
                   ref_mv_weight, &row_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1898,7 +1883,7 @@
   if (xd->left_available) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, 0, -1, ref_mv_stack,
                   ref_mv_weight, &col_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1917,7 +1902,7 @@
   if (xd->up_available) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, 0, ref_mv_stack,
                   ref_mv_weight, &row_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1934,7 +1919,7 @@
   if (has_bl) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, xd->height, -1, ref_mv_stack,
                   ref_mv_weight, &col_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1951,7 +1936,7 @@
   if (has_tr) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, xd->width, ref_mv_stack,
                   ref_mv_weight, &row_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1970,7 +1955,7 @@
     uint8_t dummy_new_mv_count = 0;
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, -1, ref_mv_stack,
                   ref_mv_weight, &dummy_ref_match_count, &dummy_new_mv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -1987,7 +1972,7 @@
   if (xd->left_available) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, (xd->height >> 1), -1,
                   ref_mv_stack, ref_mv_weight, &col_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -2006,7 +1991,7 @@
   if (xd->up_available) {
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, (xd->width >> 1),
                   ref_mv_stack, ref_mv_weight, &row_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -2028,7 +2013,7 @@
                   mi_row,
 #endif  // CONFIG_TIP || CONFIG_EXT_RECUR_PARTITIONS
                   mi_col, rf, -1, ref_mv_stack, ref_mv_weight, refmv_count,
-                  &row_match_count, &newmv_count, gm_mv_candidates, gm_params,
+                  &row_match_count, &newmv_count, gm_mv_candidates,
                   max_row_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
@@ -2050,7 +2035,7 @@
                   mi_col,
 #endif  // CONFIG_TIP || CONFIG_EXT_RECUR_PARTITIONS
                   rf, -1, ref_mv_stack, ref_mv_weight, refmv_count,
-                  &col_match_count, &newmv_count, gm_mv_candidates, gm_params,
+                  &col_match_count, &newmv_count, gm_mv_candidates,
                   max_col_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
@@ -2069,7 +2054,7 @@
   if (has_tr)
     scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, xd->width, ref_mv_stack,
                   ref_mv_weight, &row_match_count, &newmv_count,
-                  gm_mv_candidates, gm_params,
+                  gm_mv_candidates,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                   ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -2206,7 +2191,6 @@
   // Scan the second outer area.
   scan_blk_mbmi(cm, xd, mi_row, mi_col, rf, -1, -1, ref_mv_stack, ref_mv_weight,
                 &row_match_count, &dummy_newmv_count, gm_mv_candidates,
-                gm_params,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                 ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -2232,7 +2216,7 @@
 #endif  // CONFIG_TIP || CONFIG_EXT_RECUR_PARTITIONS
                     rf, col_offset, ref_mv_stack, ref_mv_weight, refmv_count,
                     &col_match_count, &dummy_newmv_count, gm_mv_candidates,
-                    gm_params, max_col_offset,
+                    max_col_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                     ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -2258,7 +2242,7 @@
 #endif  // CONFIG_TIP || CONFIG_EXT_RECUR_PARTITIONS
                     mi_col, rf, row_offset, ref_mv_stack, ref_mv_weight,
                     refmv_count, &row_match_count, &dummy_newmv_count,
-                    gm_mv_candidates, gm_params, max_row_offset,
+                    gm_mv_candidates, max_row_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                     ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
@@ -2277,7 +2261,7 @@
 #endif  // CONFIG_TIP || CONFIG_EXT_RECUR_PARTITIONS
                     rf, col_offset, ref_mv_stack, ref_mv_weight, refmv_count,
                     &col_match_count, &dummy_newmv_count, gm_mv_candidates,
-                    gm_params, max_col_offset,
+                    max_col_offset,
 #if CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
                     ref_frame_idx0, ref_frame_idx1,
 #endif  // CONFIG_SKIP_MODE_DRL_WITH_REF_IDX
diff --git a/av1/common/mvref_common.h b/av1/common/mvref_common.h
index e86a73a..ee36d33 100644
--- a/av1/common/mvref_common.h
+++ b/av1/common/mvref_common.h
@@ -981,7 +981,7 @@
       }
     }
   }
-  *params = effective_global_motion(xd, mbmi->ref_frame[0]);
+  *params = *effective_global_motion(xd, mbmi->ref_frame[0]);
 #else
   assert(mbmi->warp_ref_idx < mbmi->max_num_warp_candidates);
   *params = warp_param_stack[mbmi->warp_ref_idx].wm_params;
@@ -1007,13 +1007,11 @@
                                                const MACROBLOCKD *xd,
                                                const MB_MODE_INFO *neighbor_mi,
                                                WarpedMotionParams *wm_params) {
-  const WarpedMotionParams *gm_params =
-      &cm->global_motion[neighbor_mi->ref_frame[0]];
-
+  (void)cm;
   if (is_warp_mode(neighbor_mi->motion_mode)) {
     *wm_params = neighbor_mi->wm_params[0];
-  } else if (is_global_mv_block(neighbor_mi, gm_params->wmtype)) {
-    *wm_params = *gm_params;
+  } else if (neighbor_mi->global_mv_block[0]) {
+    *wm_params = neighbor_mi->wm_params[0];
   } else {
     // Neighbor block is translation-only, so doesn't have
     // a warp model. So we need to synthesize one.
@@ -1057,11 +1055,9 @@
         xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col];
     if (!is_inter_ref_frame(left_mi->ref_frame[0])) return 1;
     if (left_mi->ref_frame[0] != mbmi->ref_frame[0]) return 1;
-    const WarpedMotionParams *gm_params =
-        &xd->global_motion[left_mi->ref_frame[0]];
     if (is_warp_mode(left_mi->motion_mode)) {
       return 2;
-    } else if (is_global_mv_block(left_mi, gm_params->wmtype)) {
+    } else if (left_mi->global_mv_block[0]) {
       return 3;
     } else {
       // Neighbor block is translation-only
@@ -1084,11 +1080,9 @@
         xd->mi[mi_pos.row * xd->mi_stride + mi_pos.col];
     if (!is_inter_ref_frame(above_mi->ref_frame[0])) return 1;
     if (above_mi->ref_frame[0] != mbmi->ref_frame[0]) return 1;
-    const WarpedMotionParams *gm_params =
-        &xd->global_motion[above_mi->ref_frame[0]];
     if (is_warp_mode(above_mi->motion_mode)) {
       return 2;
-    } else if (is_global_mv_block(above_mi, gm_params->wmtype)) {
+    } else if (above_mi->global_mv_block[0]) {
       return 3;
     } else {
       // Neighbor block is translation-only
diff --git a/av1/common/warped_motion.h b/av1/common/warped_motion.h
index 7ac8e0d..0d44c49 100644
--- a/av1/common/warped_motion.h
+++ b/av1/common/warped_motion.h
@@ -366,6 +366,38 @@
   wm_params->wmtype = HOMOGRAPHY;
 }
 
+static INLINE void copy_global_motion_to_mbmi(const MACROBLOCKD *xd,
+                                              MB_MODE_INFO *mbmi) {
+  const BLOCK_SIZE bsize = mbmi->sb_type[PLANE_TYPE_Y];
+  const int block_size_allowed =
+      AOMMIN(block_size_wide[bsize], block_size_high[bsize]) >= 8;
+  mbmi->global_mv_block[0] = 0;
+  mbmi->global_mv_block[1] = 0;
+  if (!block_size_allowed) return;
+  const PREDICTION_MODE this_mode = mbmi->mode;
+  if (this_mode == GLOBALMV) {
+    const WarpedMotionParams *gm0 =
+        effective_global_motion(xd, mbmi->ref_frame[0]);
+    if (gm0->wmtype > TRANSLATION) {
+      mbmi->wm_params[0] = *gm0;
+      mbmi->global_mv_block[0] = 1;
+    }
+  } else if (this_mode == GLOBAL_GLOBALMV) {
+    const WarpedMotionParams *gm0 =
+        effective_global_motion(xd, mbmi->ref_frame[0]);
+    const WarpedMotionParams *gm1 =
+        effective_global_motion(xd, mbmi->ref_frame[1]);
+    if (gm0->wmtype > TRANSLATION) {
+      mbmi->wm_params[0] = *gm0;
+      mbmi->global_mv_block[0] = 1;
+    }
+    if (gm1->wmtype > TRANSLATION) {
+      mbmi->wm_params[1] = *gm1;
+      mbmi->global_mv_block[1] = 1;
+    }
+  }
+}
+
 #if CONFIG_IMPROVED_GLOBAL_MOTION
 static INLINE void av1_scale_warp_model(const WarpedMotionParams *in_params,
                                         int in_distance,
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index e47ee97..0df31b6 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -3191,6 +3191,10 @@
   AV1_COMMON *const cm = &pbi->common;
   MACROBLOCKD *const xd = &dcb->xd;
   MB_MODE_INFO *const mi = xd->mi[0];
+  mi->wm_params[0] = default_warp_params;
+  mi->wm_params[1] = default_warp_params;
+  mi->global_mv_block[0] = 0;
+  mi->global_mv_block[1] = 0;
   mi->use_intrabc[xd->tree_type == CHROMA_PART] = 0;
 
   if (xd->tree_type == SHARED_PART)
@@ -3210,6 +3214,7 @@
                            y_inside_boundary);
   } else {
     read_inter_frame_mode_info(pbi, dcb, r);
+    copy_global_motion_to_mbmi(xd, mi);
 #if CONFIG_BVP_IMPROVEMENT && CONFIG_REF_MV_BANK
     if (cm->seq_params.enable_refmvbank) {
       MB_MODE_INFO *const mbmi = xd->mi[0];
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index da3e767..7dd0b37 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5599,6 +5599,10 @@
   ctx->rd_stats.skip_txfm = 0;
   mbmi->ref_frame[0] = INTRA_FRAME;
   mbmi->ref_frame[1] = NONE_FRAME;
+  mbmi->wm_params[0] = default_warp_params;
+  mbmi->wm_params[1] = default_warp_params;
+  mbmi->global_mv_block[0] = 0;
+  mbmi->global_mv_block[1] = 0;
   mbmi->use_intrabc[xd->tree_type == CHROMA_PART] = 0;
   if (xd->tree_type != CHROMA_PART) {
     mbmi->mv[0].as_int = 0;
@@ -7154,6 +7158,11 @@
   mbmi->mv[0].as_int = mbmi->mv[1].as_int = 0;
   mbmi->motion_mode = SIMPLE_TRANSLATION;
   mbmi->interintra_mode = (INTERINTRA_MODE)(II_DC_PRED - 1);
+  mbmi->wm_params[0] = default_warp_params;
+  mbmi->wm_params[1] = default_warp_params;
+  mbmi->global_mv_block[0] = 0;
+  mbmi->global_mv_block[1] = 0;
+  copy_global_motion_to_mbmi(xd, mbmi);
   set_default_interp_filters(mbmi,
 #if CONFIG_OPTFLOW_REFINEMENT
                              cm,
@@ -8907,6 +8916,7 @@
       assert(mbmi->interp_fltr == av1_unswitchable_filter(interp_filter));
     }
   }
+  copy_global_motion_to_mbmi(xd, mbmi);
 
   for (i = 0; i < REFERENCE_MODES; ++i) {
     if (search_state.intra_search_state.best_pred_rd[i] == INT64_MAX) {
@@ -9015,6 +9025,11 @@
   const MV_REFERENCE_FRAME last_frame = get_closest_pastcur_ref_index(cm);
   mbmi->ref_frame[0] = last_frame;
   mbmi->ref_frame[1] = NONE_FRAME;
+  mbmi->wm_params[0] = default_warp_params;
+  mbmi->wm_params[1] = default_warp_params;
+  mbmi->global_mv_block[0] = 0;
+  mbmi->global_mv_block[1] = 0;
+  copy_global_motion_to_mbmi(xd, mbmi);
 #if CONFIG_TIP
   if (is_tip_ref_frame(mbmi->ref_frame[0])) {
     mbmi->mv[0].as_int = 0;
@@ -9129,6 +9144,7 @@
   }
 
   av1_zero(best_pred_diff);
+  copy_global_motion_to_mbmi(xd, mbmi);
 
   store_coding_context(x, ctx, best_pred_diff, 0
 #if CONFIG_C071_SUBBLK_WARPMV