shithub: libvpx

Download patch

ref: a07bed2b2b2ca84fdb145ee8e4f1ca100d39915e
parent: 67978d1380ee460991edb876a3abaa235da4e413
author: James Zern <jzern@google.com>
date: Thu Feb 28 10:45:29 EST 2013

firstpass.c: correct casting around gf_group_bits

gf_group_bits is int64_t remove casts to int.

Change-Id: I3b4225905041fac9af9fdfcbcb6f1c357ea4b593

--- a/vp8/encoder/firstpass.c
+++ b/vp8/encoder/firstpass.c
@@ -2118,17 +2118,17 @@
         (cpi->twopass.kf_group_error_left > 0))
     {
         cpi->twopass.gf_group_bits =
-            (int)((double)cpi->twopass.kf_group_bits *
-                  (gf_group_err / (double)cpi->twopass.kf_group_error_left));
+            (int64_t)(cpi->twopass.kf_group_bits *
+                      (gf_group_err / cpi->twopass.kf_group_error_left));
     }
     else
         cpi->twopass.gf_group_bits = 0;
 
-    cpi->twopass.gf_group_bits = (int)(
+    cpi->twopass.gf_group_bits =
         (cpi->twopass.gf_group_bits < 0)
             ? 0
             : (cpi->twopass.gf_group_bits > cpi->twopass.kf_group_bits)
-                ? cpi->twopass.kf_group_bits : cpi->twopass.gf_group_bits);
+                ? cpi->twopass.kf_group_bits : cpi->twopass.gf_group_bits;
 
     /* Clip cpi->twopass.gf_group_bits based on user supplied data rate
      * variability limit (cpi->oxcf.two_pass_vbrmax_section)
@@ -2450,7 +2450,7 @@
          */
         if (cpi->oxcf.error_resilient_mode)
         {
-            cpi->twopass.gf_group_bits = (int)cpi->twopass.kf_group_bits;
+            cpi->twopass.gf_group_bits = cpi->twopass.kf_group_bits;
             cpi->twopass.gf_group_error_left =
                                   (int)cpi->twopass.kf_group_error_left;
             cpi->baseline_gf_interval = cpi->twopass.frames_to_key;
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -1695,8 +1695,8 @@
   if ((cpi->twopass.kf_group_bits > 0) &&
       (cpi->twopass.kf_group_error_left > 0)) {
     cpi->twopass.gf_group_bits =
-      (int)((double)cpi->twopass.kf_group_bits *
-            (gf_group_err / cpi->twopass.kf_group_error_left));
+      (int64_t)(cpi->twopass.kf_group_bits *
+                (gf_group_err / cpi->twopass.kf_group_error_left));
   } else
     cpi->twopass.gf_group_bits = 0;