]> granicus.if.org Git - libvpx/commitdiff
Cleaned a code in define_gf_group() for firstpass
authorZoe Liu <zoeliu@google.com>
Sat, 23 Jan 2016 01:13:03 +0000 (17:13 -0800)
committerZoe Liu <zoeliu@google.com>
Mon, 25 Jan 2016 17:38:45 +0000 (09:38 -0800)
Change-Id: I0b8eff9e74e3446024482d011ec4fb28b19136d3

vp10/encoder/firstpass.c
vp9/encoder/vp9_firstpass.c

index c41fa3e3993e3eb3a064abdf4dd9cb6a06c18776..73ea408d6a94116d5aa91785befae5b902f05c91 100644 (file)
@@ -1819,10 +1819,10 @@ static void define_gf_group(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
   {
     int int_max_q =
       (int)(vp10_convert_qindex_to_q(twopass->active_worst_quality,
-                                   cpi->common.bit_depth));
+                                     cpi->common.bit_depth));
     int int_lbq =
       (int)(vp10_convert_qindex_to_q(rc->last_boosted_qindex,
-                                   cpi->common.bit_depth));
+                                     cpi->common.bit_depth));
     active_min_gf_interval = rc->min_gf_interval + VPXMIN(2, int_max_q / 200);
     if (active_min_gf_interval > rc->max_gf_interval)
       active_min_gf_interval = rc->max_gf_interval;
@@ -1835,13 +1835,12 @@ static void define_gf_group(VP10_COMP *cpi, FIRSTPASS_STATS *this_frame) {
       // 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 + VPXMIN(4, (int_lbq / 6));
-      if (active_max_gf_interval < active_min_gf_interval)
-        active_max_gf_interval = active_min_gf_interval;
 
-      if (active_max_gf_interval > rc->max_gf_interval)
-        active_max_gf_interval = rc->max_gf_interval;
+      // We have: active_min_gf_interval <= rc->max_gf_interval
       if (active_max_gf_interval < active_min_gf_interval)
         active_max_gf_interval = active_min_gf_interval;
+      else if (active_max_gf_interval > rc->max_gf_interval)
+        active_max_gf_interval = rc->max_gf_interval;
     }
   }
 
index 43fcdbd2eabb5de0a63b27cfe6eebfaebcb384f2..aa982f0e9728d8535bf8f5dee9b95bcb20b64b85 100644 (file)
@@ -1939,13 +1939,12 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
       // 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 + VPXMIN(4, (int_lbq / 6));
-      if (active_max_gf_interval < active_min_gf_interval)
-        active_max_gf_interval = active_min_gf_interval;
 
-      if (active_max_gf_interval > rc->max_gf_interval)
-        active_max_gf_interval = rc->max_gf_interval;
+      // We have: active_min_gf_interval <= rc->max_gf_interval
       if (active_max_gf_interval < active_min_gf_interval)
         active_max_gf_interval = active_min_gf_interval;
+      else if (active_max_gf_interval > rc->max_gf_interval)
+        active_max_gf_interval = rc->max_gf_interval;
     }
   }