]> granicus.if.org Git - libvpx/commitdiff
Fixed integer overflow for large input video
authorYaowu Xu <yaowu@google.com>
Fri, 24 Jan 2014 19:34:41 +0000 (11:34 -0800)
committerYaowu Xu <yaowu@google.com>
Fri, 24 Jan 2014 19:34:41 +0000 (11:34 -0800)
The sum of squared mv components can go beyond int range for large
 input resolution. This commit changed the type to int64 to avoid
overflow.

Change-Id: Ib21ea2817845cea1435f893064e6417c79c5bc64

vp9/encoder/vp9_firstpass.c

index 812c1314857359d060e18b0c0f11b72d745b74ed..395ce20086e24a9e0ec749b7dd75d3ee106c8de9 100644 (file)
@@ -471,7 +471,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
 
   int sum_mvr = 0, sum_mvc = 0;
   int sum_mvr_abs = 0, sum_mvc_abs = 0;
-  int sum_mvrs = 0, sum_mvcs = 0;
+  int64_t sum_mvrs = 0, sum_mvcs = 0;
   int mvcount = 0;
   int intercount = 0;
   int second_ref_count = 0;