diff options
author | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-04-09 16:40:28 +0000 |
---|---|---|
committer | pbos@webrtc.org <pbos@webrtc.org@4adac7df-926f-26a2-2b94-8c16560cd09d> | 2013-04-09 16:40:28 +0000 |
commit | c49ec1327c1d956c6c889cf1f32a7f9920d76149 (patch) | |
tree | b797f8d1012b153cb22660887b809970f209c0ac /common_audio/signal_processing/resample_by_2.c | |
parent | 73ebe67b3e6f0a65efed02efd4eee4dfb1b7729e (diff) | |
download | webrtc-c49ec1327c1d956c6c889cf1f32a7f9920d76149.tar.gz |
WebRtc_Word32 -> int32_t in common_audio/
BUG=314
Review URL: https://webrtc-codereview.appspot.com/1299004
git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@3803 4adac7df-926f-26a2-2b94-8c16560cd09d
Diffstat (limited to 'common_audio/signal_processing/resample_by_2.c')
-rw-r--r-- | common_audio/signal_processing/resample_by_2.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/common_audio/signal_processing/resample_by_2.c b/common_audio/signal_processing/resample_by_2.c index 2e33cafa..20c62e5c 100644 --- a/common_audio/signal_processing/resample_by_2.c +++ b/common_audio/signal_processing/resample_by_2.c @@ -20,17 +20,17 @@ #ifdef WEBRTC_ARCH_ARM_V7 // allpass filter coefficients. -static const WebRtc_UWord32 kResampleAllpass1[3] = {3284, 24441, 49528 << 15}; -static const WebRtc_UWord32 kResampleAllpass2[3] = +static const uint32_t kResampleAllpass1[3] = {3284, 24441, 49528 << 15}; +static const uint32_t kResampleAllpass2[3] = {12199, 37471 << 15, 60255 << 15}; // Multiply two 32-bit values and accumulate to another input value. // Return: state + ((diff * tbl_value) >> 16) -static __inline WebRtc_Word32 MUL_ACCUM_1(WebRtc_Word32 tbl_value, - WebRtc_Word32 diff, - WebRtc_Word32 state) { - WebRtc_Word32 result; +static __inline int32_t MUL_ACCUM_1(int32_t tbl_value, + int32_t diff, + int32_t state) { + int32_t result; __asm __volatile ("smlawb %0, %1, %2, %3": "=r"(result): "r"(diff), "r"(tbl_value), "r"(state)); return result; @@ -43,10 +43,10 @@ static __inline WebRtc_Word32 MUL_ACCUM_1(WebRtc_Word32 tbl_value, // instruction (in MUL_ACCUM_1) due to input value range, we can still use // smmla to save some cycles. -static __inline WebRtc_Word32 MUL_ACCUM_2(WebRtc_Word32 tbl_value, - WebRtc_Word32 diff, - WebRtc_Word32 state) { - WebRtc_Word32 result; +static __inline int32_t MUL_ACCUM_2(int32_t tbl_value, + int32_t diff, + int32_t state) { + int32_t result; __asm __volatile ("smmla %0, %1, %2, %3": "=r"(result): "r"(diff << 1), "r"(tbl_value), "r"(state)); return result; @@ -55,8 +55,8 @@ static __inline WebRtc_Word32 MUL_ACCUM_2(WebRtc_Word32 tbl_value, #else // allpass filter coefficients. -static const WebRtc_UWord16 kResampleAllpass1[3] = {3284, 24441, 49528}; -static const WebRtc_UWord16 kResampleAllpass2[3] = {12199, 37471, 60255}; +static const uint16_t kResampleAllpass1[3] = {3284, 24441, 49528}; +static const uint16_t kResampleAllpass2[3] = {12199, 37471, 60255}; // Multiply a 32-bit value with a 16-bit value and accumulate to another input: #define MUL_ACCUM_1(a, b, c) WEBRTC_SPL_SCALEDIFF32(a, b, c) @@ -67,23 +67,23 @@ static const WebRtc_UWord16 kResampleAllpass2[3] = {12199, 37471, 60255}; // decimator #if !defined(MIPS32_LE) -void WebRtcSpl_DownsampleBy2(const WebRtc_Word16* in, const WebRtc_Word16 len, - WebRtc_Word16* out, WebRtc_Word32* filtState) { - WebRtc_Word32 tmp1, tmp2, diff, in32, out32; - WebRtc_Word16 i; - - register WebRtc_Word32 state0 = filtState[0]; - register WebRtc_Word32 state1 = filtState[1]; - register WebRtc_Word32 state2 = filtState[2]; - register WebRtc_Word32 state3 = filtState[3]; - register WebRtc_Word32 state4 = filtState[4]; - register WebRtc_Word32 state5 = filtState[5]; - register WebRtc_Word32 state6 = filtState[6]; - register WebRtc_Word32 state7 = filtState[7]; +void WebRtcSpl_DownsampleBy2(const int16_t* in, const int16_t len, + int16_t* out, int32_t* filtState) { + int32_t tmp1, tmp2, diff, in32, out32; + int16_t i; + + register int32_t state0 = filtState[0]; + register int32_t state1 = filtState[1]; + register int32_t state2 = filtState[2]; + register int32_t state3 = filtState[3]; + register int32_t state4 = filtState[4]; + register int32_t state5 = filtState[5]; + register int32_t state6 = filtState[6]; + register int32_t state7 = filtState[7]; for (i = (len >> 1); i > 0; i--) { // lower allpass filter - in32 = (WebRtc_Word32)(*in++) << 10; + in32 = (int32_t)(*in++) << 10; diff = in32 - state1; tmp1 = MUL_ACCUM_1(kResampleAllpass2[0], diff, state0); state0 = in32; @@ -95,7 +95,7 @@ void WebRtcSpl_DownsampleBy2(const WebRtc_Word16* in, const WebRtc_Word16 len, state2 = tmp2; // upper allpass filter - in32 = (WebRtc_Word32)(*in++) << 10; + in32 = (int32_t)(*in++) << 10; diff = in32 - state5; tmp1 = MUL_ACCUM_1(kResampleAllpass1[0], diff, state4); state4 = in32; @@ -125,23 +125,23 @@ void WebRtcSpl_DownsampleBy2(const WebRtc_Word16* in, const WebRtc_Word16 len, #endif // #if defined(MIPS32_LE) -void WebRtcSpl_UpsampleBy2(const WebRtc_Word16* in, WebRtc_Word16 len, - WebRtc_Word16* out, WebRtc_Word32* filtState) { - WebRtc_Word32 tmp1, tmp2, diff, in32, out32; - WebRtc_Word16 i; +void WebRtcSpl_UpsampleBy2(const int16_t* in, int16_t len, + int16_t* out, int32_t* filtState) { + int32_t tmp1, tmp2, diff, in32, out32; + int16_t i; - register WebRtc_Word32 state0 = filtState[0]; - register WebRtc_Word32 state1 = filtState[1]; - register WebRtc_Word32 state2 = filtState[2]; - register WebRtc_Word32 state3 = filtState[3]; - register WebRtc_Word32 state4 = filtState[4]; - register WebRtc_Word32 state5 = filtState[5]; - register WebRtc_Word32 state6 = filtState[6]; - register WebRtc_Word32 state7 = filtState[7]; + register int32_t state0 = filtState[0]; + register int32_t state1 = filtState[1]; + register int32_t state2 = filtState[2]; + register int32_t state3 = filtState[3]; + register int32_t state4 = filtState[4]; + register int32_t state5 = filtState[5]; + register int32_t state6 = filtState[6]; + register int32_t state7 = filtState[7]; for (i = len; i > 0; i--) { // lower allpass filter - in32 = (WebRtc_Word32)(*in++) << 10; + in32 = (int32_t)(*in++) << 10; diff = in32 - state1; tmp1 = MUL_ACCUM_1(kResampleAllpass1[0], diff, state0); state0 = in32; |