Remove Global_Motion_Params and GLOBAL_MOTION_TYPE

After https://aomedia-review.googlesource.com/#/c/5589/ ,
the Global_Motion_Params and GLOBAL_MOTION_TYPE types
are redundant, and can be removed in favour of
WarpedMotionParams and TransformationType respectively.

Change-Id: I33f3796e5c469e595fd012ccdb65a672dd1bb86c
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index e8bf18c..4c8c2fa 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -104,7 +104,7 @@
 static struct av1_token ext_tx_encodings[TX_TYPES];
 #endif  // CONFIG_EXT_TX
 #if CONFIG_GLOBAL_MOTION
-static struct av1_token global_motion_types_encodings[GLOBAL_MOTION_TYPES];
+static struct av1_token global_motion_types_encodings[GLOBAL_TRANS_TYPES];
 #endif  // CONFIG_GLOBAL_MOTION
 #if CONFIG_EXT_INTRA
 static struct av1_token intra_filter_encodings[INTRA_FILTERS];
@@ -3952,39 +3952,35 @@
 }
 
 #if CONFIG_GLOBAL_MOTION
-static void write_global_motion_params(Global_Motion_Params *params,
+static void write_global_motion_params(WarpedMotionParams *params,
                                        aom_prob *probs, aom_writer *w) {
-  GLOBAL_MOTION_TYPE gmtype = params->gmtype;
+  TransformationType type = params->wmtype;
   av1_write_token(w, av1_global_motion_types_tree, probs,
-                  &global_motion_types_encodings[gmtype]);
-  switch (gmtype) {
-    case GLOBAL_ZERO: break;
-    case GLOBAL_AFFINE:
-    case GLOBAL_ROTZOOM:
+                  &global_motion_types_encodings[type]);
+  switch (type) {
+    case IDENTITY: break;
+    case AFFINE:
+    case ROTZOOM:
       aom_write_primitive_symmetric(
-          w, (params->motion_params.wmmat[2] >> GM_ALPHA_PREC_DIFF) -
-                 (1 << GM_ALPHA_PREC_BITS),
+          w,
+          (params->wmmat[2] >> GM_ALPHA_PREC_DIFF) - (1 << GM_ALPHA_PREC_BITS),
           GM_ABS_ALPHA_BITS);
-      aom_write_primitive_symmetric(
-          w, (params->motion_params.wmmat[3] >> GM_ALPHA_PREC_DIFF),
-          GM_ABS_ALPHA_BITS);
-      if (gmtype == GLOBAL_AFFINE) {
+      aom_write_primitive_symmetric(w, (params->wmmat[3] >> GM_ALPHA_PREC_DIFF),
+                                    GM_ABS_ALPHA_BITS);
+      if (type == AFFINE) {
         aom_write_primitive_symmetric(
-            w, (params->motion_params.wmmat[4] >> GM_ALPHA_PREC_DIFF),
-            GM_ABS_ALPHA_BITS);
-        aom_write_primitive_symmetric(
-            w, (params->motion_params.wmmat[5] >> GM_ALPHA_PREC_DIFF) -
-                   (1 << GM_ALPHA_PREC_BITS),
-            GM_ABS_ALPHA_BITS);
+            w, (params->wmmat[4] >> GM_ALPHA_PREC_DIFF), GM_ABS_ALPHA_BITS);
+        aom_write_primitive_symmetric(w,
+                                      (params->wmmat[5] >> GM_ALPHA_PREC_DIFF) -
+                                          (1 << GM_ALPHA_PREC_BITS),
+                                      GM_ABS_ALPHA_BITS);
       }
     // fallthrough intended
-    case GLOBAL_TRANSLATION:
-      aom_write_primitive_symmetric(
-          w, (params->motion_params.wmmat[0] >> GM_TRANS_PREC_DIFF),
-          GM_ABS_TRANS_BITS);
-      aom_write_primitive_symmetric(
-          w, (params->motion_params.wmmat[1] >> GM_TRANS_PREC_DIFF),
-          GM_ABS_TRANS_BITS);
+    case TRANSLATION:
+      aom_write_primitive_symmetric(w, (params->wmmat[0] >> GM_TRANS_PREC_DIFF),
+                                    GM_ABS_TRANS_BITS);
+      aom_write_primitive_symmetric(w, (params->wmmat[1] >> GM_TRANS_PREC_DIFF),
+                                    GM_ABS_TRANS_BITS);
       break;
     default: assert(0);
   }
@@ -4003,10 +3999,10 @@
     printf("Enc Ref %d [%d/%d] (used %d): %d %d %d %d\n",
            frame, cm->current_video_frame, cm->show_frame,
            cpi->global_motion_used[frame],
-           cm->global_motion[frame].motion_params.wmmat[0],
-           cm->global_motion[frame].motion_params.wmmat[1],
-           cm->global_motion[frame].motion_params.wmmat[2],
-           cm->global_motion[frame].motion_params.wmmat[3]);
+           cm->global_motion[frame].wmmat[0],
+           cm->global_motion[frame].wmmat[1],
+           cm->global_motion[frame].wmmat[2],
+           cm->global_motion[frame].wmmat[3]);
            */
   }
 }
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index ffa77d6..b624cbb 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -4757,10 +4757,9 @@
 }
 
 static void convert_model_to_params(const double *params,
-                                    Global_Motion_Params *model) {
-  convert_to_params(params, model->motion_params.wmmat);
-  model->gmtype = get_gmtype(model);
-  model->motion_params.wmtype = gm_to_trans_type(model->gmtype);
+                                    WarpedMotionParams *model) {
+  convert_to_params(params, model->wmmat);
+  model->wmtype = get_gmtype(model);
 }
 #endif  // CONFIG_GLOBAL_MOTION
 
@@ -4802,9 +4801,9 @@
         if (compute_global_motion_feature_based(GLOBAL_MOTION_MODEL,
                                                 cpi->Source, ref_buf, params)) {
           convert_model_to_params(params, &cm->global_motion[frame]);
-          if (cm->global_motion[frame].gmtype > GLOBAL_ZERO) {
+          if (cm->global_motion[frame].wmtype != IDENTITY) {
             refine_integerized_param(
-                &cm->global_motion[frame].motion_params,
+                &cm->global_motion[frame],
 #if CONFIG_AOM_HIGHBITDEPTH
                 xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
 #endif  // CONFIG_AOM_HIGHBITDEPTH
@@ -4813,7 +4812,7 @@
                 cpi->Source->y_height, cpi->Source->y_stride, 3);
             // compute the advantage of using gm parameters over 0 motion
             erroradvantage = av1_warp_erroradv(
-                &cm->global_motion[frame].motion_params,
+                &cm->global_motion[frame],
 #if CONFIG_AOM_HIGHBITDEPTH
                 xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH, xd->bd,
 #endif  // CONFIG_AOM_HIGHBITDEPTH
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 52114b0..49e8b2d 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4312,23 +4312,23 @@
 }
 
 #if CONFIG_GLOBAL_MOTION
-static int get_gmbitcost(const Global_Motion_Params *gm,
-                         const aom_prob *probs) {
-  int gmtype_cost[GLOBAL_MOTION_TYPES];
+static int get_gmbitcost(const WarpedMotionParams *gm, const aom_prob *probs) {
+  int gmtype_cost[TRANS_TYPES];
   int bits;
+  TransformationType type = gm->wmtype;
   av1_cost_tokens(gmtype_cost, probs, av1_global_motion_types_tree);
-  switch (gm->gmtype) {
-    case GLOBAL_AFFINE:
-      bits = (GM_ABS_TRANS_BITS + 1) * 2 + 4 * GM_ABS_ALPHA_BITS + 4;
+  switch (type) {
+    case AFFINE:
+      bits = (GM_ABS_TRANS_BITS + 1) * 2 + (GM_ABS_ALPHA_BITS + 1) * 4;
       break;
-    case GLOBAL_ROTZOOM:
-      bits = (GM_ABS_TRANS_BITS + 1) * 2 + 2 * GM_ABS_ALPHA_BITS + 2;
+    case ROTZOOM:
+      bits = (GM_ABS_TRANS_BITS + 1) * 2 + (GM_ABS_ALPHA_BITS + 1) * 2;
       break;
-    case GLOBAL_TRANSLATION: bits = (GM_ABS_TRANS_BITS + 1) * 2; break;
-    case GLOBAL_ZERO: bits = 0; break;
+    case TRANSLATION: bits = (GM_ABS_TRANS_BITS + 1) * 2; break;
+    case IDENTITY: bits = 0; break;
     default: assert(0); return 0;
   }
-  return bits ? (bits << AV1_PROB_COST_SHIFT) + gmtype_cost[gm->gmtype] : 0;
+  return bits ? (bits << AV1_PROB_COST_SHIFT) + gmtype_cost[type] : 0;
 }
 
 #define GLOBAL_MOTION_RATE(ref)                            \
@@ -5337,9 +5337,9 @@
 #endif  // CONFIG_REF_MV
 
 #if CONFIG_GLOBAL_MOTION
-        if (cm->global_motion[mbmi->ref_frame[0]].gmtype == GLOBAL_ZERO &&
+        if (cm->global_motion[mbmi->ref_frame[0]].wmtype == IDENTITY &&
             (!has_second_rf ||
-             cm->global_motion[mbmi->ref_frame[1]].gmtype == GLOBAL_ZERO))
+             cm->global_motion[mbmi->ref_frame[1]].wmtype == IDENTITY))
 #endif  // CONFIG_GLOBAL_MOTION
 
           if (!check_best_zero_mv(cpi, mbmi_ext->mode_context,
@@ -8857,9 +8857,9 @@
         }
       }
 #if CONFIG_GLOBAL_MOTION
-    } else if (cm->global_motion[ref_frame].gmtype == GLOBAL_ZERO &&
+    } else if (cm->global_motion[ref_frame].wmtype == IDENTITY &&
                (!comp_pred ||
-                cm->global_motion[second_ref_frame].gmtype == GLOBAL_ZERO)) {
+                cm->global_motion[second_ref_frame].wmtype == IDENTITY)) {
 #else   // CONFIG_GLOBAL_MOTION
     } else {
 #endif  // CONFIG_GLOBAL_MOTION