]> granicus.if.org Git - libvpx/commitdiff
Fix minor bug in calculation of max arf group length.
authorPaul Wilkins <paulwilkins@google.com>
Thu, 27 Sep 2018 09:55:05 +0000 (10:55 +0100)
committerPaul Wilkins <paulwilkins@google.com>
Fri, 28 Sep 2018 16:13:31 +0000 (17:13 +0100)
Their is no valid last boosted Q availably when estimating the maximum
group length for the first ARF group in a clip, so use a value based on
the current max q.

Change-Id: Ida0b4bfb7ce7433089ad808abed7f59c88527a81

vp9/encoder/vp9_firstpass.c

index 4c287311d73e6c873a8fb3c97e438555cdb0e370..f132836b405cc9bbc106c28ddb112e7aa182a5fa 100644 (file)
@@ -2523,8 +2523,11 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
   {
     int int_max_q = (int)(vp9_convert_qindex_to_q(twopass->active_worst_quality,
                                                   cpi->common.bit_depth));
-    int int_lbq = (int)(vp9_convert_qindex_to_q(rc->last_boosted_qindex,
-                                                cpi->common.bit_depth));
+    int q_term = (cm->current_video_frame == 0)
+                     ? int_max_q / 32
+                     : (int)(vp9_convert_qindex_to_q(rc->last_boosted_qindex,
+                                                     cpi->common.bit_depth) /
+                             6);
     active_min_gf_interval =
         rc->min_gf_interval + arf_active_or_kf + VPXMIN(2, int_max_q / 200);
     active_min_gf_interval =
@@ -2534,7 +2537,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
     // bits to spare and are better with a smaller interval and smaller boost.
     // At high Q when there are few bits to spare we are better with a longer
     // interval to spread the cost of the GF.
-    active_max_gf_interval = 12 + arf_active_or_kf + VPXMIN(4, (int_lbq / 6));
+    active_max_gf_interval = 12 + arf_active_or_kf + VPXMIN(4, q_term);
 
     // We have: active_min_gf_interval <=
     // rc->max_gf_interval + arf_active_or_kf.