From 2abebe7bafe3887ed20756031beb2b514313d0c6 Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Mon, 20 Oct 2014 08:26:41 +0000 Subject: [PATCH] audio_coding/codecs/isac/main: Replaced macro WEBRTC_SPL_RSHIFT_W32 with >> BUG=3348,3353 TESTED=locally on linux and trybots R=henrik.lundin@webrtc.org, kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/30739004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7474 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../codecs/isac/main/source/entropy_coding.c | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c b/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c index 9ae69a0bbf..6cd331052b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/entropy_coding.c @@ -106,14 +106,13 @@ static void FindInvArSpec(const int16_t* ARCoefQ12, for (n = 0; n < AR_ORDER + 1; n++) { sum += WEBRTC_SPL_MUL(ARCoefQ12[n], ARCoefQ12[n]); /* Q24 */ } - sum = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL(WEBRTC_SPL_RSHIFT_W32(sum, 6), - 65) + 32768, 16); /* Q8 */ - CorrQ11[0] = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL(sum, gainQ10) + 256, 9); + sum = ((sum >> 6) * 65 + 32768) >> 16; /* Q8 */ + CorrQ11[0] = (sum * gainQ10 + 256) >> 9; /* To avoid overflow, we shift down gainQ10 if it is large. * We will not lose any precision */ if (gainQ10 > 400000) { - tmpGain = WEBRTC_SPL_RSHIFT_W32(gainQ10, 3); + tmpGain = gainQ10 >> 3; round = 32; shftVal = 6; } else { @@ -126,9 +125,8 @@ static void FindInvArSpec(const int16_t* ARCoefQ12, sum = 16384; for (n = k; n < AR_ORDER + 1; n++) sum += WEBRTC_SPL_MUL(ARCoefQ12[n - k], ARCoefQ12[n]); /* Q24 */ - sum = WEBRTC_SPL_RSHIFT_W32(sum, 15); - CorrQ11[k] = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL(sum, tmpGain) + round, - shftVal); + sum >>= 15; + CorrQ11[k] = (sum * tmpGain + round) >> shftVal; } sum = WEBRTC_SPL_LSHIFT_W32(CorrQ11[0], 7); for (n = 0; n < FRAMESAMPLES / 8; n++) { @@ -136,8 +134,7 @@ static void FindInvArSpec(const int16_t* ARCoefQ12, } for (k = 1; k < AR_ORDER; k += 2) { for (n = 0; n < FRAMESAMPLES / 8; n++) { - CurveQ16[n] += WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL( - WebRtcIsac_kCos[k][n], CorrQ11[k + 1]) + 2, 2); + CurveQ16[n] += (WebRtcIsac_kCos[k][n] * CorrQ11[k + 1] + 2) >> 2; } } @@ -155,14 +152,12 @@ static void FindInvArSpec(const int16_t* ARCoefQ12, shftVal = 0; } for (n = 0; n < FRAMESAMPLES / 8; n++) { - diffQ16[n] = WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL( - CS_ptrQ9[n], WEBRTC_SPL_RSHIFT_W32(CorrQ11[1], shftVal)) + 2, 2); + diffQ16[n] = (CS_ptrQ9[n] * (CorrQ11[1] >> shftVal) + 2) >> 2; } for (k = 2; k < AR_ORDER; k += 2) { CS_ptrQ9 = WebRtcIsac_kCos[k]; for (n = 0; n < FRAMESAMPLES / 8; n++) { - diffQ16[n] += WEBRTC_SPL_RSHIFT_W32(WEBRTC_SPL_MUL( - CS_ptrQ9[n], WEBRTC_SPL_RSHIFT_W32(CorrQ11[k + 1], shftVal)) + 2, 2); + diffQ16[n] += (CS_ptrQ9[n] * (CorrQ11[k + 1] >> shftVal) + 2) >> 2; } }