Separate EXT_ARFs' frame context index

This commit separate the frame index of EXT_ARFs' from other frame
types in the ext-refs setting.

It improves the average RD performance by

0.206% in the lowres, and
0.173% in the midres.

The overall gains for the ext-refs compared to the baseline are

5.665% in the lowres, and
4.883% in the midres.

Change-Id: I6591ad29120880c1aef0bd0b7cf15238c3f3b8f3
diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c
index caac3ee..3f28008 100644
--- a/vp10/encoder/encoder.c
+++ b/vp10/encoder/encoder.c
@@ -283,8 +283,16 @@
   if (frame_is_intra_only(cm) || cm->error_resilient_mode) {
     vp10_setup_past_independence(cm);
   } else {
+#if CONFIG_EXT_REFS
+    const GF_GROUP *gf_group = &cpi->twopass.gf_group;
+    if (gf_group->rf_level[gf_group->index] == GF_ARF_LOW)
+      cm->frame_context_idx = EXT_ARF_FRAME;
+    else if (cpi->refresh_alt_ref_frame)
+      cm->frame_context_idx = ARF_FRAME;
+#else
     if (cpi->refresh_alt_ref_frame)
       cm->frame_context_idx = ARF_FRAME;
+#endif
     else if (cpi->rc.is_src_frame_alt_ref)
       cm->frame_context_idx = OVERLAY_FRAME;
     else if (cpi->refresh_golden_frame)
diff --git a/vp10/encoder/encoder.h b/vp10/encoder/encoder.h
index fca8b6f..b1b5855 100644
--- a/vp10/encoder/encoder.h
+++ b/vp10/encoder/encoder.h
@@ -81,6 +81,8 @@
 #if CONFIG_EXT_REFS
   // backward reference frame
   BRF_FRAME = 4,
+  // extra alternate reference frame
+  EXT_ARF_FRAME = 5
 #endif
 } FRAME_CONTEXT_INDEX;