From 69c2edfaf71f5494ab7a3caf26e8ab782d49781d Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 18 May 2011 12:30:22 +0300 Subject: [PATCH 1/2] stagefright amrnb: Fix a bug on architectures where long is 64 bit Initially, this code gave a warning "comparison is always false due to limited range of data type" if long was 64 bit. Additionally, the output from the AMR encoder was mostly noise. This was committed on the master branch of the opencore repository in commit f532d145194e474cb30d8644b8eee83873ad24cc, based on AOSP contribution 10904. Change-Id: I822dcc74beeae548d3032ffda759de9c8cd1fcfe --- media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp index bd99b30969af6..4135f30ea73f2 100644 --- a/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp +++ b/media/libstagefright/codecs/amrnb/common/src/az_lsp.cpp @@ -299,7 +299,7 @@ static Word16 Chebps(Word16 x, t0 += (Word32) * (p_f) << 13; - if ((UWord32)(t0 - 0xfe000000L) < 0x01ffffffL - 0xfe000000L) + if ((UWord32)(t0 - 0xfe000000L) < (UWord32)0x03ffffffL) { cheb = (Word16)(t0 >> 10); } From 3a8221c0ffd4309a9179cc777b15b2558a07bc4e Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Wed, 18 May 2011 12:30:02 +0300 Subject: [PATCH 2/2] stagefright amrnb: Properly negate all values Initially, input values -32768 weren't negated properly. This was committed on the master branch of the opencore repository in commit f532d145194e474cb30d8644b8eee83873ad24cc, based on AOSP contribution 10906. Change-Id: I903353c5539a8fe94b7fc5f26b95eaeac57df5f4 --- media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp b/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp index dedf91acd7e79..d626de37e5a49 100644 --- a/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp +++ b/media/libstagefright/codecs/amrnb/enc/src/set_sign.cpp @@ -552,10 +552,10 @@ void set_sign12k2( else { *(p_sign--) = -32767; /* sign = -1 */ - cor = - (cor); + cor = negate(cor); /* modify dn[] according to the fixed sign */ - dn[i] = - val; + dn[i] = negate(val); } *(p_en--) = cor;