From da0ce28fe3a73905b2cd7a07f3298a229a16c03d Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Thu, 26 Sep 2013 09:20:15 -0700 Subject: [PATCH] fixed integer overflow warnings Jenkins warns on left shift of negative numbers and non-aligned read of int. This commit fixed the two issues. Change-Id: I389a7fb6a572c643902e40a4c10fefef94500d2c --- vp8/common/x86/vp8_asm_stubs.c | 8 ++------ vp8/encoder/dct.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/vp8/common/x86/vp8_asm_stubs.c b/vp8/common/x86/vp8_asm_stubs.c index c0416b7..b409293 100644 --- a/vp8/common/x86/vp8_asm_stubs.c +++ b/vp8/common/x86/vp8_asm_stubs.c @@ -611,16 +611,12 @@ void vp8_sixtap_predict4x4_ssse3 for (r = 0; r < 4; r++) { - #if !(CONFIG_FAST_UNALIGNED) dst_ptr[0] = src_ptr[0]; dst_ptr[1] = src_ptr[1]; dst_ptr[2] = src_ptr[2]; dst_ptr[3] = src_ptr[3]; - #else - *(uint32_t *)dst_ptr = *(uint32_t *)src_ptr ; - #endif - dst_ptr += dst_pitch; - src_ptr += src_pixels_per_line; + dst_ptr += dst_pitch; + src_ptr += src_pixels_per_line; } } } diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c index b5a11ae..091554a 100644 --- a/vp8/encoder/dct.c +++ b/vp8/encoder/dct.c @@ -20,10 +20,10 @@ void vp8_short_fdct4x4_c(short *input, short *output, int pitch) for (i = 0; i < 4; i++) { - a1 = ((ip[0] + ip[3])<<3); - b1 = ((ip[1] + ip[2])<<3); - c1 = ((ip[1] - ip[2])<<3); - d1 = ((ip[0] - ip[3])<<3); + a1 = ((ip[0] + ip[3]) * 8); + b1 = ((ip[1] + ip[2]) * 8); + c1 = ((ip[1] - ip[2]) * 8); + d1 = ((ip[0] - ip[3]) * 8); op[0] = a1 + b1; op[2] = a1 - b1; @@ -72,10 +72,10 @@ void vp8_short_walsh4x4_c(short *input, short *output, int pitch) for (i = 0; i < 4; i++) { - a1 = ((ip[0] + ip[2])<<2); - d1 = ((ip[1] + ip[3])<<2); - c1 = ((ip[1] - ip[3])<<2); - b1 = ((ip[0] - ip[2])<<2); + a1 = ((ip[0] + ip[2]) * 4); + d1 = ((ip[1] + ip[3]) * 4); + c1 = ((ip[1] - ip[3]) * 4); + b1 = ((ip[0] - ip[2]) * 4); op[0] = a1 + d1 + (a1!=0); op[1] = b1 + c1; -- 2.7.4