shithub: libvpx

Download patch

ref: 17b2d63196c5f3f7c7e5a44a31517bb3a3605bfe
parent: cc8ea84d3d4a3645395f19f8041507f9a9d68f2b
parent: ee29b7e85c10acdcebd59640bc9e0c1bb38bfbbf
author: Paul Wilkins <paulwilkins@google.com>
date: Thu Dec 19 23:21:56 EST 2013

Merge "Adjust gf_group_error_left for arf groups."

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1714,7 +1714,6 @@
     }
   }
 
-
   // Set the interval until the next gf or arf.
   cpi->rc.baseline_gf_interval = i;
 
@@ -1920,15 +1919,18 @@
     if (cpi->twopass.kf_group_bits < 0)
       cpi->twopass.kf_group_bits = 0;
 
-    // Note the error score left in the remaining frames of the group.
-    // For normal GFs we want to remove the error score for the first frame
-    // of the group (except in Key frame case where this has already
-    // happened)
-    if (!cpi->rc.source_alt_ref_pending && cpi->common.frame_type != KEY_FRAME)
+    // If this is an arf update we want to remove the score for the
+    // overlay frame at the end which will usually be very cheap to code.
+    // For normal GFs remove the score for the GF itself unless this is
+    // also a key frame in which case it has already been accounted for.
+    if (cpi->rc.source_alt_ref_pending) {
+      cpi->twopass.gf_group_error_left = (int64_t)gf_group_err - mod_frame_err;
+    } else if (cpi->common.frame_type != KEY_FRAME) {
       cpi->twopass.gf_group_error_left = (int64_t)(gf_group_err
                                                    - gf_first_frame_err);
-    else
+    } else {
       cpi->twopass.gf_group_error_left = (int64_t)gf_group_err;
+    }
 
     cpi->twopass.gf_group_bits -= cpi->twopass.gf_bits
         - cpi->rc.min_frame_bandwidth;