Fix reset on rolling rate.

Fix bug whereby rolling target vs actual rate for arf groups
were reset before the final pass.

Change-Id: I3703a65d2ac8d5f23c77d90ab790ca63bab9c2b7
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index b9ed687..de3e8b9 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -2559,10 +2559,6 @@
         rc->baseline_gf_interval);
   }
 
-  // Reset rolling actual and target bits counters for ARF groups.
-  twopass->rolling_arf_group_target_bits = 1;
-  twopass->rolling_arf_group_actual_bits = 1;
-
   av1_gop_bit_allocation(cpi, rc, gf_group, rc->frames_since_key == 0,
                          use_alt_ref, gf_group_bits);
 
@@ -2575,6 +2571,10 @@
   // TODO(jingning): Generalize this condition.
   if (is_final_pass) {
     cpi->gf_state.arf_gf_boost_lst = use_alt_ref;
+
+    // Reset rolling actual and target bits counters for ARF groups.
+    twopass->rolling_arf_group_target_bits = 1;
+    twopass->rolling_arf_group_actual_bits = 1;
   }
 }