]> granicus.if.org Git - libvpx/commitdiff
Allow arf just before kfs or end of sequence.
authorPaul Wilkins <paulwilkins@google.com>
Wed, 11 Dec 2013 15:03:04 +0000 (15:03 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Thu, 19 Dec 2013 16:52:38 +0000 (16:52 +0000)
This will hurt metrics in some cases (particularly for static
clips at low data rates where there is extra overhead, but it
helps smooth transitions around forced key frames between
stitched kf sections.

Change-Id: I7e1026ae0de6c77bba863061e115136d7f283cc0

vp9/encoder/vp9_firstpass.c

index d2bcabe27a352bcc7071df41adf5ece0566272c3..2d7ac7ce5b62231ccb6f6545cbd3c3526a07b62e 100644 (file)
@@ -1639,9 +1639,8 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
     active_max_gf_interval = cpi->rc.max_gf_interval;
 
   i = 0;
-  while (((i < cpi->twopass.static_scene_max_gf_interval) ||
-          ((cpi->rc.frames_to_key - i) < MIN_GF_INTERVAL)) &&
-         (i < cpi->rc.frames_to_key)) {
+  while ((i < cpi->twopass.static_scene_max_gf_interval) &&
+         (i < (cpi->rc.frames_to_key - 1))) {
     i++;    // Increment the loop counter
 
     // Accumulate error score of frames in this gf group
@@ -1695,8 +1694,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
       (
         // Don't break out with a very short interval
         (i > MIN_GF_INTERVAL) &&
-        // Don't break out very close to a key frame
-        ((cpi->rc.frames_to_key - i) >= MIN_GF_INTERVAL) &&
         ((boost_score > 125.0) || (next_frame.pcnt_inter < 0.75)) &&
         (!flash_detected) &&
         ((mv_ratio_accumulator > mv_ratio_accumulator_thresh) ||
@@ -1716,7 +1713,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
 
   // Don't allow a gf too near the next kf
   if ((cpi->rc.frames_to_key - i) < MIN_GF_INTERVAL) {
-    while (i < cpi->rc.frames_to_key) {
+    while (i < (cpi->rc.frames_to_key - 1)) {
       i++;
 
       if (EOF == input_stats(cpi, this_frame))
@@ -1729,6 +1726,7 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
     }
   }
 
+
   // Set the interval until the next gf or arf.
   cpi->rc.baseline_gf_interval = i;
 
@@ -1748,8 +1746,6 @@ static void define_gf_group(VP9_COMP *cpi, FIRSTPASS_STATS *this_frame) {
   if (allow_alt_ref &&
       (i < cpi->oxcf.lag_in_frames) &&
       (i >= MIN_GF_INTERVAL) &&
-      // dont use ARF very near next kf
-      (i <= (cpi->rc.frames_to_key - MIN_GF_INTERVAL)) &&
       ((next_frame.pcnt_inter > 0.75) ||
        (next_frame.pcnt_second_ref > 0.5)) &&
       ((mv_in_out_accumulator / (double)i > -0.2) ||