Rework ARF layers for GOP

Use the recursive GOP partition to automatically decide the ARF
layer and distribution. Most clips remain identical. A few clips
gain 0.5 - 1.4% in PSNR/SSIM in vbr speed 1 setting.

STATS_CHANGED

Change-Id: Ia4a57c4e68e633b700485c456a0eeac8e0621bdb
diff --git a/av1/encoder/firstpass.h b/av1/encoder/firstpass.h
index 87b1344..57d5233 100644
--- a/av1/encoder/firstpass.h
+++ b/av1/encoder/firstpass.h
@@ -30,7 +30,7 @@
 
 #define VLOW_MOTION_THRESHOLD 950
 
-#define MAX_ARF_LAYERS 6
+#define MAX_ARF_LAYERS 5
 
 typedef struct {
   // Frame number in display order, if stats are for a single frame.
@@ -125,6 +125,8 @@
   // mechanism is in place.
   int layer_depth[MAX_STATIC_GF_GROUP_LENGTH];
   int arf_boost[MAX_STATIC_GF_GROUP_LENGTH];
+  int max_layer_depth;
+  int max_layer_depth_allowed;
   // This is currently only populated for AOM_Q mode
   unsigned char q_val[MAX_STATIC_GF_GROUP_LENGTH];
   int bit_allocation[MAX_STATIC_GF_GROUP_LENGTH];