shithub: libvpx

Download patch

ref: 034cea5e726b851294baad4d77e81bb6ce45703c
parent: eacaabc5921d22438e1123a8ac2a256dbefce187
parent: bb0ca87a0d7c347e924dae4b83af81fe9454dad2
author: John Koleszar <jkoleszar@google.com>
date: Wed Jun 29 07:36:51 EDT 2011

Merge "guard against space/time distortion"

--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1347,6 +1347,8 @@
     if(now < cfg->rc_buf_initial_sz)
         return;
 
+    then = now;
+
     /* Sum the size over the past rc_buf_sz ms */
     for(i = hist->frames; i > 0 && hist->frames - i < hist->samples; i--)
     {
@@ -1357,6 +1359,9 @@
             break;
         sum_sz += hist->sz[i_idx];
     }
+
+    if (now == then)
+        return;
 
     avg_bitrate = sum_sz * 8 * 1000 / (now - then);
     idx = avg_bitrate * (RATE_BINS/2) / (cfg->rc_target_bitrate * 1000);
--