audio_coding/codec/ilbc: Removed usage of macro WEBRTC_SPL_MUL_16_16

The macro is in C defined as
#define WEBRTC_SPL_MUL_16_16(a, b) ((int32_t) (((int16_t)(a)) * ((int16_t)(b))))
(For definition on ARMv7 and MIPS, see common_audio/signal_processing/include/spl_inl_armv7.h and common_audio/signal_processing/include/spl_inl_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)

Some other minor code cleanup also exists.

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

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

Cr-Commit-Position: refs/heads/master@{#8358}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8358 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org
2015-02-13 09:51:40 +00:00
parent 2bd299a172
commit ba97ea69f0
30 changed files with 122 additions and 126 deletions

View File

@ -60,7 +60,8 @@ void WebRtcIlbcfix_StateConstruct(
for(k=0; k<len; k++){
/*the shifting is due to the Q13 in sq4_fixQ13[i], also the adding of 2097152 (= 0.5 << 22)
maxVal is in Q8 and result is in Q(-1) */
(*tmp1) = (int16_t) ((WEBRTC_SPL_MUL_16_16(maxVal,WebRtcIlbcfix_kStateSq3[(*tmp2)])+(int32_t)2097152) >> 22);
*tmp1 = (int16_t)((maxVal * WebRtcIlbcfix_kStateSq3[*tmp2] + 2097152) >>
22);
tmp1++;
tmp2--;
}
@ -68,7 +69,8 @@ void WebRtcIlbcfix_StateConstruct(
for(k=0; k<len; k++){
/*the shifting is due to the Q13 in sq4_fixQ13[i], also the adding of 262144 (= 0.5 << 19)
maxVal is in Q5 and result is in Q(-1) */
(*tmp1) = (int16_t) ((WEBRTC_SPL_MUL_16_16(maxVal,WebRtcIlbcfix_kStateSq3[(*tmp2)])+(int32_t)262144) >> 19);
*tmp1 = (int16_t)((maxVal * WebRtcIlbcfix_kStateSq3[*tmp2] + 262144) >>
19);
tmp1++;
tmp2--;
}
@ -76,7 +78,8 @@ void WebRtcIlbcfix_StateConstruct(
for(k=0; k<len; k++){
/*the shifting is due to the Q13 in sq4_fixQ13[i], also the adding of 65536 (= 0.5 << 17)
maxVal is in Q3 and result is in Q(-1) */
(*tmp1) = (int16_t) ((WEBRTC_SPL_MUL_16_16(maxVal,WebRtcIlbcfix_kStateSq3[(*tmp2)])+(int32_t)65536) >> 17);
*tmp1 = (int16_t)((maxVal * WebRtcIlbcfix_kStateSq3[*tmp2] + 65536) >>
17);
tmp1++;
tmp2--;
}