shithub: libvpx

Download patch

ref: da39e505dd99c3cf89a9585e0dfee477f436de37
parent: e68894fa03c03a93da8e5607be82c69e9782c585
parent: fd41cb849147b49466f0cb5a3efd09265c1dff20
author: John Koleszar <jkoleszar@google.com>
date: Mon Jul 18 02:07:50 EDT 2011

Merge "Fixed rate histogram calculation"

--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1339,6 +1339,11 @@
      * adjustment (5/4) to account for alt-refs
      */
     hist->samples = cfg->rc_buf_sz * 5 / 4 * fps->num / fps->den / 1000;
+
+    // prevent division by zero
+    if (hist->samples == 0)
+      hist->samples=1;
+
     hist->pts = calloc(hist->samples, sizeof(*hist->pts));
     hist->sz = calloc(hist->samples, sizeof(*hist->sz));
     for(i=0; i<RATE_BINS; i++)