WebRtc_Word32 => int32_t etc. in audio_coding/

BUG=314

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3789 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
pbos@webrtc.org
2013-04-09 00:28:06 +00:00
parent 6faf71d27b
commit 0946a56023
382 changed files with 8469 additions and 8488 deletions

View File

@ -25,22 +25,22 @@
*---------------------------------------------------------------*/
void WebRtcIlbcfix_Smooth(
WebRtc_Word16 *odata, /* (o) smoothed output */
WebRtc_Word16 *current, /* (i) the un enhanced residual for
int16_t *odata, /* (o) smoothed output */
int16_t *current, /* (i) the un enhanced residual for
this block */
WebRtc_Word16 *surround /* (i) The approximation from the
int16_t *surround /* (i) The approximation from the
surrounding sequences */
) {
WebRtc_Word16 maxtot, scale, scale1, scale2;
WebRtc_Word16 A, B, C, denomW16;
WebRtc_Word32 B_W32, denom, num;
WebRtc_Word32 errs;
WebRtc_Word32 w00,w10,w11, endiff, crit;
WebRtc_Word32 w00prim, w10prim, w11_div_w00;
WebRtc_Word16 w11prim;
WebRtc_Word16 bitsw00, bitsw10, bitsw11;
WebRtc_Word32 w11w00, w10w10, w00w00;
WebRtc_Word16 max1, max2;
int16_t maxtot, scale, scale1, scale2;
int16_t A, B, C, denomW16;
int32_t B_W32, denom, num;
int32_t errs;
int32_t w00,w10,w11, endiff, crit;
int32_t w00prim, w10prim, w11_div_w00;
int16_t w11prim;
int16_t bitsw00, bitsw10, bitsw11;
int32_t w11w00, w10w10, w00w00;
int16_t max1, max2;
/* compute some inner products (ensure no overflow by first calculating proper scale factor) */
@ -51,7 +51,7 @@ void WebRtcIlbcfix_Smooth(
maxtot=WEBRTC_SPL_MAX(max1, max2);
scale=WebRtcSpl_GetSizeInBits(maxtot);
scale = (WebRtc_Word16)WEBRTC_SPL_MUL_16_16(2,scale)-26;
scale = (int16_t)WEBRTC_SPL_MUL_16_16(2,scale)-26;
scale=WEBRTC_SPL_MAX(0, scale);
w00=WebRtcSpl_DotProductWithScale(current,current,ENH_BLOCKL,scale);
@ -77,13 +77,13 @@ void WebRtcIlbcfix_Smooth(
}
w00prim = WEBRTC_SPL_LSHIFT_W32(w00, scale1);
w11prim = (WebRtc_Word16) WEBRTC_SPL_SHIFT_W32(w11, scale2);
w11prim = (int16_t) WEBRTC_SPL_SHIFT_W32(w11, scale2);
/* Perform C = sqrt(w11/w00) (C is in Q11 since (16+6)/2=11) */
if (w11prim>64) {
endiff = WEBRTC_SPL_LSHIFT_W32(
(WebRtc_Word32)WebRtcSpl_DivW32W16(w00prim, w11prim), 6);
C = (WebRtc_Word16)WebRtcSpl_SqrtFloor(endiff); /* C is in Q11 */
(int32_t)WebRtcSpl_DivW32W16(w00prim, w11prim), 6);
C = (int16_t)WebRtcSpl_SqrtFloor(endiff); /* C is in Q11 */
} else {
C = 1;
}
@ -123,23 +123,23 @@ void WebRtcIlbcfix_Smooth(
}
w11w00 = WEBRTC_SPL_MUL_16_16(
(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(w11, -scale),
(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(w00, -scale));
(int16_t)WEBRTC_SPL_SHIFT_W32(w11, -scale),
(int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale));
w10w10 = WEBRTC_SPL_MUL_16_16(
(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(w10, -scale),
(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(w10, -scale));
(int16_t)WEBRTC_SPL_SHIFT_W32(w10, -scale),
(int16_t)WEBRTC_SPL_SHIFT_W32(w10, -scale));
w00w00 = WEBRTC_SPL_MUL_16_16(
(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(w00, -scale),
(WebRtc_Word16)WEBRTC_SPL_SHIFT_W32(w00, -scale));
(int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale),
(int16_t)WEBRTC_SPL_SHIFT_W32(w00, -scale));
/* Calculate (w11*w00-w10*w10)/(w00*w00) in Q16 */
if (w00w00>65536) {
endiff = (w11w00-w10w10);
endiff = WEBRTC_SPL_MAX(0, endiff);
/* denom is in Q16 */
denom = WebRtcSpl_DivW32W16(endiff, (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(w00w00, 16));
denom = WebRtcSpl_DivW32W16(endiff, (int16_t)WEBRTC_SPL_RSHIFT_W32(w00w00, 16));
} else {
denom = 65536;
}
@ -151,20 +151,20 @@ void WebRtcIlbcfix_Smooth(
if (scale>0) {
/* denomW16 is in Q(16+scale) */
denomW16=(WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(denom, scale);
denomW16=(int16_t)WEBRTC_SPL_RSHIFT_W32(denom, scale);
/* num in Q(34-scale) */
num=WEBRTC_SPL_RSHIFT_W32(ENH_A0_MINUS_A0A0DIV4, scale);
} else {
/* denomW16 is in Q16 */
denomW16=(WebRtc_Word16)denom;
denomW16=(int16_t)denom;
/* num in Q34 */
num=ENH_A0_MINUS_A0A0DIV4;
}
/* A sqrt( (ENH_A0-(ENH_A0^2)/4)*(w00*w00)/(w11*w00 + w10*w10) ) in Q9 */
A = (WebRtc_Word16)WebRtcSpl_SqrtFloor(WebRtcSpl_DivW32W16(num, denomW16));
A = (int16_t)WebRtcSpl_SqrtFloor(WebRtcSpl_DivW32W16(num, denomW16));
/* B_W32 is in Q30 ( B = 1 - ENH_A0/2 - A * w10/w00 ) */
scale1 = 31-bitsw10;
@ -179,15 +179,15 @@ void WebRtcIlbcfix_Smooth(
}
if ((w00prim>0)&&(w10prim>0)) {
w11_div_w00=WebRtcSpl_DivW32W16(w10prim, (WebRtc_Word16)w00prim);
w11_div_w00=WebRtcSpl_DivW32W16(w10prim, (int16_t)w00prim);
if (WebRtcSpl_GetSizeInBits(w11_div_w00)+WebRtcSpl_GetSizeInBits(A)>31) {
B_W32 = 0;
} else {
B_W32 = (WebRtc_Word32)1073741824 - (WebRtc_Word32)ENH_A0DIV2 -
B_W32 = (int32_t)1073741824 - (int32_t)ENH_A0DIV2 -
WEBRTC_SPL_MUL(A, w11_div_w00);
}
B = (WebRtc_Word16)WEBRTC_SPL_RSHIFT_W32(B_W32, 16); /* B in Q14 */
B = (int16_t)WEBRTC_SPL_RSHIFT_W32(B_W32, 16); /* B in Q14 */
} else {
/* No smoothing */
A = 0;