summaryrefslogtreecommitdiff
path: root/vp9/common/vp9_scale.c
diff options
context:
space:
mode:
authorYaowu Xu <yaowu@google.com>2014-03-27 12:54:06 -0700
committerYaowu Xu <yaowu@google.com>2014-03-28 16:40:29 -0700
commit4f857bacd22ea4e95c0bd8a0de3da3dcd017eff3 (patch)
tree71789f1e8585b2eb6c1d9c655f05211f8a900b87 /vp9/common/vp9_scale.c
parent6fc20a8434352793f4ecb09e6369112c92952456 (diff)
downloadlibvpx-4f857bacd22ea4e95c0bd8a0de3da3dcd017eff3.tar
libvpx-4f857bacd22ea4e95c0bd8a0de3da3dcd017eff3.tar.gz
libvpx-4f857bacd22ea4e95c0bd8a0de3da3dcd017eff3.tar.bz2
libvpx-4f857bacd22ea4e95c0bd8a0de3da3dcd017eff3.zip
[BITSTREAM]Fix the scaling calculation
For very large size video image, the scaling calculation may need use value beyond the range of int. This commit upgrade the value to 64bit to make sure the calculation do not wrap around INT_MAX. The change corrected the decoder behavior. The bug affects only very large resolution video because the scaling calculation was sufficient for image size smaller than 2^13. This resolves issue: https://code.google.com/p/webm/issues/detail?id=750 Change-Id: I2d2ed303ca6482f31f819f3c07d6d3e98ef3adc5
Diffstat (limited to 'vp9/common/vp9_scale.c')
-rw-r--r--vp9/common/vp9_scale.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vp9/common/vp9_scale.c b/vp9/common/vp9_scale.c
index e0f1e3410..d3405fcdb 100644
--- a/vp9/common/vp9_scale.c
+++ b/vp9/common/vp9_scale.c
@@ -13,11 +13,11 @@
#include "vp9/common/vp9_scale.h"
static INLINE int scaled_x(int val, const struct scale_factors *sf) {
- return val * sf->x_scale_fp >> REF_SCALE_SHIFT;
+ return (int)((int64_t)val * sf->x_scale_fp >> REF_SCALE_SHIFT);
}
static INLINE int scaled_y(int val, const struct scale_factors *sf) {
- return val * sf->y_scale_fp >> REF_SCALE_SHIFT;
+ return (int)((int64_t)val * sf->y_scale_fp >> REF_SCALE_SHIFT);
}
static int unscaled_value(int val, const struct scale_factors *sf) {