Reduce the number of bits sent for global translation model

When a global translation model is found, the only 3 bits
of precision are used for the motion parameters. This case
uses a smaller precision than the translation parameters
in a global model that is rotzoom or greater.
Change-Id: Ic972e9edf46e301f2894cce2b723960d0297c8e8
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 3867e2b..fd223f3 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -4395,9 +4395,12 @@
 
 #if CONFIG_GLOBAL_MOTION
 static void read_global_motion_params(WarpedMotionParams *params,
-                                      aom_prob *probs, aom_reader *r) {
+                                      aom_prob *probs, aom_reader *r,
+                                      int allow_hp) {
   TransformationType type =
       aom_read_tree(r, av1_global_motion_types_tree, probs, ACCT_STR);
+  int trans_bits;
+  int trans_dec_factor;
   set_default_gmparams(params);
   params->wmtype = type;
   switch (type) {
@@ -4434,10 +4437,15 @@
       }
     // fallthrough intended
     case TRANSLATION:
-      params->wmmat[0] = aom_read_primitive_symmetric(r, GM_ABS_TRANS_BITS) *
-                         GM_TRANS_DECODE_FACTOR;
-      params->wmmat[1] = aom_read_primitive_symmetric(r, GM_ABS_TRANS_BITS) *
-                         GM_TRANS_DECODE_FACTOR;
+      trans_bits = (type == TRANSLATION) ? GM_ABS_TRANS_ONLY_BITS - !allow_hp
+                                         : GM_ABS_TRANS_BITS;
+      trans_dec_factor = (type == TRANSLATION)
+                             ? GM_TRANS_ONLY_DECODE_FACTOR * (1 << !allow_hp)
+                             : GM_TRANS_DECODE_FACTOR;
+      params->wmmat[0] =
+          aom_read_primitive_symmetric(r, trans_bits) * trans_dec_factor;
+      params->wmmat[1] =
+          aom_read_primitive_symmetric(r, trans_bits) * trans_dec_factor;
       break;
     case IDENTITY: break;
     default: assert(0);
@@ -4450,7 +4458,8 @@
   int frame;
   for (frame = LAST_FRAME; frame <= ALTREF_FRAME; ++frame) {
     read_global_motion_params(&cm->global_motion[frame],
-                              cm->fc->global_motion_types_prob, r);
+                              cm->fc->global_motion_types_prob, r,
+                              cm->allow_high_precision_mv);
     /*
     printf("Dec Ref %d [%d/%d]: %d %d %d %d\n",
            frame, cm->current_video_frame, cm->show_frame,