shithub: libvpx

Download patch

ref: 824e9410c61e25a39d2c19a9418e1740e53c8e8c
parent: 8c5b73de2a3534b2ca964e33b33474c1fd6fb488
parent: 9f002bee53b5372f97b6dbc01f97c598ff585fcf
author: John Koleszar <jkoleszar@google.com>
date: Mon Jun 6 03:02:29 EDT 2011

Merge "Don't allow very short GF groups even when the GF is predicted from an ARF."

--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -1558,6 +1558,24 @@
 
     cpi->gfu_boost = (int)(boost_score * 100.0) >> 4;
 
+    // Dont allow conventional gf too near the next kf
+    if ((cpi->twopass.frames_to_key - i) < MIN_GF_INTERVAL)
+    {
+        while (i < cpi->twopass.frames_to_key)
+        {
+            i++;
+
+            if (EOF == input_stats(cpi, this_frame))
+                break;
+
+            if (i < cpi->twopass.frames_to_key)
+            {
+                mod_frame_err = calculate_modified_err(cpi, this_frame);
+                gf_group_err += mod_frame_err;
+            }
+        }
+    }
+
     // Should we use the alternate refernce frame
     if (allow_alt_ref &&
         (i >= MIN_GF_INTERVAL) &&
@@ -1678,25 +1696,6 @@
     {
         cpi->source_alt_ref_pending = FALSE;
         cpi->baseline_gf_interval = i;
-    }
-
-    // Conventional GF
-    if (!cpi->source_alt_ref_pending)
-    {
-        // Dont allow conventional gf too near the next kf
-        if ((cpi->twopass.frames_to_key - cpi->baseline_gf_interval) < MIN_GF_INTERVAL)
-        {
-            while (cpi->baseline_gf_interval < cpi->twopass.frames_to_key)
-            {
-                if (EOF == input_stats(cpi, this_frame))
-                    break;
-
-                cpi->baseline_gf_interval++;
-
-                if (cpi->baseline_gf_interval < cpi->twopass.frames_to_key)
-                    gf_group_err += calculate_modified_err(cpi, this_frame);
-            }
-        }
     }
 
     // Now decide how many bits should be allocated to the GF group as  a proportion of those remaining in the kf group.