Properly disable GLOBALMV when it's disabled from command line

Currently, when GLOBALMV is disabled from the command line with
--enable-global-motion=0, the encoder merely sets the GLOBALMV to
ZEROMV, but it can still transmit GLOBALMV in the bitstream.

This commit fixes it to properly disable GLOBALMV. Note that this
does not change the is_global signaling.

 SPD_SET | TESTSET | AVG_PSNR | OVR_PSNR |  SSIM   |  SPD
---------+---------+----------+----------+---------+-------
    5    |rtc_derf | +0.043%  | +0.013%  | +0.044% | +3.1%
    5    |   rtc   | +0.096%  | +0.106%  | +0.120% | +1.9%
---------+---------+----------+----------+---------+-------

STATS_CHANGED

Change-Id: I046ad68ad3cdabeb9deacc139afc5bd9034fe0e4
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 2143fc9..0696fc5 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3668,6 +3668,13 @@
     disable_reference(INTRA_FRAME, mask->ref_combo);
   }
 
+  if (!cpi->oxcf.tool_cfg.enable_global_motion) {
+    for (ref_frame = LAST_FRAME; ref_frame <= ALTREF_FRAME; ++ref_frame) {
+      mask->pred_modes[ref_frame] |= (1 << GLOBALMV);
+      mask->pred_modes[ref_frame] |= (1 << GLOBAL_GLOBALMV);
+    }
+  }
+
   mask->pred_modes[INTRA_FRAME] |=
       ~(sf->intra_sf.intra_y_mode_mask[max_txsize_lookup[bsize]]);
 }