Add global motion experiment to rdopt

This patch completes the global motion experiment
implementation. It modifies the format of the motion
parameters to use the mv union to facilitate faster
copying and checks for parameters equal to 0 that occur
frequently in rdopt. The rd decisions for the global motion experiment
have also been added to rdopt.
Change-Id: Idfb9f0c6d23e538221763881099c5a2a3891f5a9
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c
index 47cfea6..59554a4 100644
--- a/av1/decoder/decodemv.c
+++ b/av1/decoder/decodemv.c
@@ -938,6 +938,7 @@
 
 static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
                             PREDICTION_MODE mode,
+                            MV_REFERENCE_FRAME ref_frame[2],
 #if CONFIG_REF_MV
                             int block,
 #endif
@@ -952,6 +953,7 @@
   int_mv *pred_mv =
       (bsize >= BLOCK_8X8) ? mbmi->pred_mv : xd->mi[0]->bmi[block].pred_mv_s8;
 #endif
+  (void)ref_frame;
 
   switch (mode) {
 #if CONFIG_EXT_INTER
@@ -1006,8 +1008,16 @@
       break;
     }
     case ZEROMV: {
+#if CONFIG_GLOBAL_MOTION
+      mv[0].as_int =
+          cm->global_motion[ref_frame[0]].motion_params.wmmat[0].as_int;
+      if (is_compound)
+        mv[1].as_int =
+            cm->global_motion[ref_frame[1]].motion_params.wmmat[0].as_int;
+#else
       mv[0].as_int = 0;
       if (is_compound) mv[1].as_int = 0;
+#endif  // CONFIG_GLOBAL_MOTION
 
 #if CONFIG_REF_MV
       pred_mv[0].as_int = 0;
@@ -1428,7 +1438,7 @@
         (void)ref_mv_s8;
 #endif
 
-        if (!assign_mv(cm, xd, b_mode,
+        if (!assign_mv(cm, xd, b_mode, mbmi->ref_frame,
 #if CONFIG_REF_MV
                        j,
 #endif
@@ -1480,7 +1490,7 @@
     }
 
     xd->corrupted |=
-        !assign_mv(cm, xd, mbmi->mode,
+        !assign_mv(cm, xd, mbmi->mode, mbmi->ref_frame,
 #if CONFIG_REF_MV
                    0,
 #endif