common_audio/signal_processing: Removes macro WEBRTC_SPL_RSHIFT_U16

This macro is only used at a few places and implies a cast to uint16_t before right shifting. All places already use uint16_t. Further, the amount of shifts applied in the macro has no sanity check for negativity, makes the macro dangerous to use.

BUG=3348,3353
TESTED=trybots and manually
R=kwiberg@webrtc.org, tina.legrand@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6393 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org
2014-06-11 06:53:20 +00:00
parent 782978cfcb
commit 18026abd82
5 changed files with 5 additions and 7 deletions

View File

@@ -123,7 +123,6 @@
#define WEBRTC_SPL_RSHIFT_W32(x, c) ((x) >> (c))
#define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c))
#define WEBRTC_SPL_RSHIFT_U16(x, c) ((uint16_t)(x) >> (c))
#define WEBRTC_SPL_LSHIFT_U16(x, c) ((uint16_t)(x) << (c))
#define WEBRTC_SPL_RSHIFT_U32(x, c) ((uint32_t)(x) >> (c))
#define WEBRTC_SPL_LSHIFT_U32(x, c) ((uint32_t)(x) << (c))

View File

@@ -89,7 +89,6 @@ TEST_F(SplTest, MacroTest) {
EXPECT_EQ(8191, WEBRTC_SPL_RSHIFT_W32(a, 1));
EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_W32(a, 1));
EXPECT_EQ(8191, WEBRTC_SPL_RSHIFT_U16(a, 1));
EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_U16(a, 1));
EXPECT_EQ(8191u, WEBRTC_SPL_RSHIFT_U32(a, 1));
EXPECT_EQ(32766u, WEBRTC_SPL_LSHIFT_U32(a, 1));

View File

@@ -383,7 +383,7 @@ int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7,
streamData->full = 1;
} else {
streamVal = WEBRTC_SPL_LSHIFT_W32(streamVal, 8) |
WEBRTC_SPL_RSHIFT_U16(*streamPtr, 8);
((*streamPtr) >> 8);
streamData->full = 0;
}
} else {

View File

@@ -118,7 +118,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
limiterLvlX = analogTarget - limiterOffset;
limiterIdx = 2
+ WebRtcSpl_DivW32W16ResW16(WEBRTC_SPL_LSHIFT_W32((int32_t)limiterLvlX, 13),
WEBRTC_SPL_RSHIFT_U16(kLog10_2, 1));
(kLog10_2 / 2));
tmp16no1 = WebRtcSpl_DivW32W16ResW16(limiterOffset + (kCompRatio >> 1), kCompRatio);
limiterLvl = targetLevelDbfs + tmp16no1;

View File

@@ -1409,7 +1409,7 @@ void WebRtcNsx_DataAnalysis(NsxInst_t* inst, short* speechFrame, uint16_t* magnU
// Shift the largest value of sum_log_i and tmp32no3 before multiplication
tmp_u16 = WEBRTC_SPL_LSHIFT_U16((uint16_t)sum_log_i, 1); // Q6
if ((uint32_t)sum_log_i > tmpU32no1) {
tmp_u16 = WEBRTC_SPL_RSHIFT_U16(tmp_u16, zeros);
tmp_u16 >>= zeros;
} else {
tmpU32no1 = WEBRTC_SPL_RSHIFT_U32(tmpU32no1, zeros);
}
@@ -2071,8 +2071,8 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram
tmpU16no1 += nonSpeechProbFinal[i]; // Q8
tmpU32no1 += (uint32_t)(inst->noiseSupFilter[i]); // Q14
}
avgProbSpeechHB = (int16_t)(4096
- WEBRTC_SPL_RSHIFT_U16(tmpU16no1, inst->stages - 7)); // Q12
assert(inst->stages >= 7);
avgProbSpeechHB = (4096 - (tmpU16no1 >> (inst->stages - 7))); // Q12
avgFilterGainHB = (int16_t)WEBRTC_SPL_RSHIFT_U32(
tmpU32no1, inst->stages - 3); // Q14