Refactor audio_processing/agc: Removes usage of macro WEBRTC_SPL_MUL_16_16_RSFT

The macro is defined as
#define WEBRTC_SPL_MUL_16_16_RSFT(a, b, c) \
(WEBRTC_SPL_MUL_16_16(a, b) >> (c))

where the latter macro is in C defined as
#define WEBRTC_SPL_MUL_16_16(a, b) \
((int32_t) (((int16_t)(a)) * ((int16_t)(b))))
(For definitions on ARMv7 and MIPS, see common_audio/signal_processing/include/spl_inl_{armv7,mips}.h)

The replacement consists of
- avoiding casts to int16_t if inputs already are int16_t
- adding explicit cast to <type> if result is assigned to <type> (other than int or int32_t)
- minor cleanups like remove of unnecessary parentheses and style changes

BUG=3348,3353
TESTED=locally on Mac and trybots
R=kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/47449004

Cr-Commit-Position: refs/heads/master@{#8664}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8664 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2015-03-10 06:37:47 +00:00
parent f9a75d99b9
commit 1afbdc7555

View File

@ -493,8 +493,7 @@ void WebRtcAgc_SaturationCtrl(LegacyAgc* stt,
}
/* stt->envSum *= 0.99; */
stt->envSum = (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(stt->envSum,
(int16_t)32440, 15);
stt->envSum = (int16_t)((stt->envSum * 32440) >> 15);
}
void WebRtcAgc_ZeroCtrl(LegacyAgc* stt, int32_t* inMicLevel, int32_t* env) {
@ -975,9 +974,8 @@ int32_t WebRtcAgc_ProcessAnalog(void *state, int32_t inMicLevel,
WebRtcAgc_ExpCurve(volNormFIX, &index);
/* Compute weighting factor for the volume increase, 32^(-2*X)/2+1.05 */
weightFIX = kOffset1[index]
- (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(kSlope1[index],
volNormFIX, 13);
weightFIX = kOffset1[index] -
(int16_t)((kSlope1[index] * volNormFIX) >> 13);
/* stt->Rxx160_LPw32 *= 1.047 [~0.2 dB]; */
stt->Rxx160_LPw32 = (stt->Rxx160_LPw32 / 64) * 67;
@ -1035,9 +1033,8 @@ int32_t WebRtcAgc_ProcessAnalog(void *state, int32_t inMicLevel,
WebRtcAgc_ExpCurve(volNormFIX, &index);
/* Compute weighting factor for the volume increase, (3.^(-2.*X))/8+1 */
weightFIX = kOffset2[index]
- (int16_t)WEBRTC_SPL_MUL_16_16_RSFT(kSlope2[index],
volNormFIX, 13);
weightFIX = kOffset2[index] -
(int16_t)((kSlope2[index] * volNormFIX) >> 13);
/* stt->Rxx160_LPw32 *= 1.047 [~0.2 dB]; */
stt->Rxx160_LPw32 = (stt->Rxx160_LPw32 / 64) * 67;