Add recode loop test for global motion usage

Adds a feature to recode if global motion is used for a reference but
has very few blocks in the frame actually using it.

lowres improves to -0.512% on average.

Change-Id: I61a36770e1b7103b9a27706909443c3f14ee4e42
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index efa5c69..a7c88ce 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -4330,6 +4330,9 @@
 }
 
 #if CONFIG_GLOBAL_MOTION
+#define GLOBAL_MOTION_COST_AMORTIZATION_BLKS 8
+
+#if GLOBAL_MOTION_COST_AMORTIZATION_BLKS > 0
 static int get_gmbitcost(const WarpedMotionParams *gm, const aom_prob *probs) {
   int gmtype_cost[TRANS_TYPES];
   int bits;
@@ -4354,9 +4357,6 @@
   return bits ? (bits << AV1_PROB_COST_SHIFT) + gmtype_cost[type] : 0;
 }
 
-#define GLOBAL_MOTION_COST_AMORTIZATION_BLKS 8
-
-#if GLOBAL_MOTION_COST_AMORTIZATION_BLKS > 0
 #define GLOBAL_MOTION_RATE(ref)                                         \
   (cpi->global_motion_used[ref] >= GLOBAL_MOTION_COST_AMORTIZATION_BLKS \
        ? 0                                                              \