Use 3-tier global motion cost thresholds

Change-Id: I338e4220e039db4082609de88bd8bfd30a877ef4
diff --git a/av1/encoder/global_motion.c b/av1/encoder/global_motion.c
index f396479..f07d1bc 100644
--- a/av1/encoder/global_motion.c
+++ b/av1/encoder/global_motion.c
@@ -32,22 +32,14 @@
 // Border over which to compute the global motion
 #define ERRORADV_BORDER 0
 
-#define ERRORADV_MAX_THRESH_0 0.75
-#define ERRORADV_MAX_THRESH_1 0.70
-#define ERRORADV_MAX_THRESH_2 0.65
-#define ERRORADV_COST_PRODUCT_THRESH 26000
+static const double erroradv_tr[] = { 0.75, 0.70, 0.65 };
+static const double erroradv_prod_tr[] = { 22000, 20000, 18000 };
 
 int is_enough_erroradvantage(double best_erroradvantage, int params_cost,
                              int erroradv_type) {
-  double erroradv_tr = 0;
-  switch (erroradv_type) {
-    case GM_ERRORADV_TR_0: erroradv_tr = ERRORADV_MAX_THRESH_0; break;
-    case GM_ERRORADV_TR_1: erroradv_tr = ERRORADV_MAX_THRESH_1; break;
-    case GM_ERRORADV_TR_2: erroradv_tr = ERRORADV_MAX_THRESH_2; break;
-    default: assert(0 && "Invalid ERRORADV Type"); return 0;
-  }
-  return best_erroradvantage < erroradv_tr &&
-         best_erroradvantage * params_cost < ERRORADV_COST_PRODUCT_THRESH;
+  assert(erroradv_type < GM_ERRORADV_TR_TYPES);
+  return best_erroradvantage < erroradv_tr[erroradv_type] &&
+         best_erroradvantage * params_cost < erroradv_prod_tr[erroradv_type];
 }
 
 static void convert_to_params(const double *params, int32_t *model) {
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 1434b34..02aaaf1 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -282,6 +282,7 @@
   GM_ERRORADV_TR_0,
   GM_ERRORADV_TR_1,
   GM_ERRORADV_TR_2,
+  GM_ERRORADV_TR_TYPES,
 } GM_ERRORADV_TYPE;
 
 typedef enum {