common_audio/signal_processing: Remove macro WEBRTC_SPL_UMUL_32_16_RSFT16
Macros should in general be avoided. WEBRTC_SPL_UMUL_32_16_RSFT16 is only used in iSAC fixed point as part of multiplying with LSB and MSB. A better approach is to have one function for that complete operation in iSAC. This CL removes the macro and replace the operation locally. BUG=3148, 3353 TESTED=locally on Linux and trybots R=tina.legrand@webrtc.org, turaj@webrtc.org Review URL: https://webrtc-codereview.appspot.com/16349004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6907 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
a84b0a6dab
commit
1e3ef4b999
@ -57,8 +57,6 @@
|
||||
((uint32_t) (uint16_t)(a) * (uint16_t)(b))
|
||||
#define WEBRTC_SPL_UMUL_32_16(a, b) \
|
||||
((uint32_t) ((uint32_t)(a) * (uint16_t)(b)))
|
||||
#define WEBRTC_SPL_UMUL_32_16_RSFT16(a, b) \
|
||||
((uint32_t) ((uint32_t)(a) * (uint16_t)(b)) >> 16)
|
||||
#define WEBRTC_SPL_MUL_16_U16(a, b) \
|
||||
((int32_t)(int16_t)(a) * (uint16_t)(b))
|
||||
#define WEBRTC_SPL_DIV(a, b) \
|
||||
|
@ -48,7 +48,6 @@ TEST_F(SplTest, MacroTest) {
|
||||
b = WEBRTC_SPL_WORD16_MAX >> 1;
|
||||
EXPECT_EQ(1073627139u, WEBRTC_SPL_UMUL_16_16(a, b));
|
||||
EXPECT_EQ(4294918147u, WEBRTC_SPL_UMUL_32_16(a, b));
|
||||
EXPECT_EQ(65535u, WEBRTC_SPL_UMUL_32_16_RSFT16(a, b));
|
||||
EXPECT_EQ(-49149, WEBRTC_SPL_MUL_16_U16(a, b));
|
||||
|
||||
a = b;
|
||||
|
@ -195,7 +195,7 @@ int16_t WebRtcIsacfix_DecHistBisectMulti(int16_t *data,
|
||||
for ( ;; )
|
||||
{
|
||||
W_tmp = WEBRTC_SPL_UMUL_32_16(W_upper_MSB, *cdfPtr);
|
||||
W_tmp += WEBRTC_SPL_UMUL_32_16_RSFT16(W_upper_LSB, *cdfPtr);
|
||||
W_tmp += (W_upper_LSB * (*cdfPtr)) >> 16;
|
||||
sizeTmp = WEBRTC_SPL_RSHIFT_W16(sizeTmp, 1);
|
||||
if (sizeTmp == 0) {
|
||||
break;
|
||||
@ -325,7 +325,7 @@ int16_t WebRtcIsacfix_DecHistOneStepMulti(int16_t *data,
|
||||
/* start at the specified table entry */
|
||||
cdfPtr = *cdf + (*initIndex++);
|
||||
W_tmp = WEBRTC_SPL_UMUL_32_16(W_upper_MSB, *cdfPtr);
|
||||
W_tmp += WEBRTC_SPL_UMUL_32_16_RSFT16(W_upper_LSB, *cdfPtr);
|
||||
W_tmp += (W_upper_LSB * (*cdfPtr)) >> 16;
|
||||
|
||||
if (streamval > W_tmp)
|
||||
{
|
||||
@ -339,7 +339,7 @@ int16_t WebRtcIsacfix_DecHistOneStepMulti(int16_t *data,
|
||||
}
|
||||
|
||||
W_tmp = WEBRTC_SPL_UMUL_32_16(W_upper_MSB, *++cdfPtr);
|
||||
W_tmp += WEBRTC_SPL_UMUL_32_16_RSFT16(W_upper_LSB, *cdfPtr);
|
||||
W_tmp += (W_upper_LSB * (*cdfPtr)) >> 16;
|
||||
|
||||
if (streamval <= W_tmp) {
|
||||
break;
|
||||
@ -359,7 +359,7 @@ int16_t WebRtcIsacfix_DecHistOneStepMulti(int16_t *data,
|
||||
}
|
||||
|
||||
W_tmp = WEBRTC_SPL_UMUL_32_16(W_upper_MSB, *cdfPtr);
|
||||
W_tmp += WEBRTC_SPL_UMUL_32_16_RSFT16(W_upper_LSB, *cdfPtr);
|
||||
W_tmp += (W_upper_LSB * (*cdfPtr)) >> 16;
|
||||
|
||||
if (streamval > W_tmp) {
|
||||
break;
|
||||
|
@ -150,9 +150,9 @@ int WebRtcIsacfix_EncLogisticMulti2(Bitstr_enc *streamData,
|
||||
W_upper_LSB = (uint16_t)W_upper;
|
||||
W_upper_MSB = (uint16_t)WEBRTC_SPL_RSHIFT_U32(W_upper, 16);
|
||||
W_lower = WEBRTC_SPL_UMUL_32_16(cdfLo, W_upper_MSB);
|
||||
W_lower += WEBRTC_SPL_UMUL_32_16_RSFT16(cdfLo, W_upper_LSB);
|
||||
W_lower += (cdfLo * W_upper_LSB) >> 16;
|
||||
W_upper = WEBRTC_SPL_UMUL_32_16(cdfHi, W_upper_MSB);
|
||||
W_upper += WEBRTC_SPL_UMUL_32_16_RSFT16(cdfHi, W_upper_LSB);
|
||||
W_upper += (cdfHi * W_upper_LSB) >> 16;
|
||||
|
||||
/* shift interval such that it begins at zero */
|
||||
W_upper -= ++W_lower;
|
||||
|
Loading…
Reference in New Issue
Block a user