common_audio: Removed macro WEBRTC_SPL_RSHIFT_W16
Replaced the trivial right shift macro at remaining 4 places and removed from signal_processing. Affected components: * vad * aecm BUG=3348,3353 TESTED=locally on linux and trybots R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/25849004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7434 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -89,7 +89,6 @@
|
|||||||
|
|
||||||
// Shifting with negative numbers not allowed
|
// Shifting with negative numbers not allowed
|
||||||
// We cannot do casting here due to signed/unsigned problem
|
// We cannot do casting here due to signed/unsigned problem
|
||||||
#define WEBRTC_SPL_RSHIFT_W16(x, c) ((x) >> (c))
|
|
||||||
#define WEBRTC_SPL_RSHIFT_W32(x, c) ((x) >> (c))
|
#define WEBRTC_SPL_RSHIFT_W32(x, c) ((x) >> (c))
|
||||||
#define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c))
|
#define WEBRTC_SPL_LSHIFT_W32(x, c) ((x) << (c))
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ TEST_F(SplTest, MacroTest) {
|
|||||||
|
|
||||||
// Shifting with negative numbers not allowed
|
// Shifting with negative numbers not allowed
|
||||||
// We cannot do casting here due to signed/unsigned problem
|
// We cannot do casting here due to signed/unsigned problem
|
||||||
EXPECT_EQ(8191, WEBRTC_SPL_RSHIFT_W16(a, 1));
|
|
||||||
EXPECT_EQ(8191, WEBRTC_SPL_RSHIFT_W32(a, 1));
|
EXPECT_EQ(8191, WEBRTC_SPL_RSHIFT_W32(a, 1));
|
||||||
EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_W32(a, 1));
|
EXPECT_EQ(32766, WEBRTC_SPL_LSHIFT_W32(a, 1));
|
||||||
|
|
||||||
|
@ -639,10 +639,10 @@ int WebRtcVad_CalcVad32khz(VadInstT* inst, const int16_t* speech_frame,
|
|||||||
// Downsample signal 32->16->8 before doing VAD
|
// Downsample signal 32->16->8 before doing VAD
|
||||||
WebRtcVad_Downsampling(speech_frame, speechWB, &(inst->downsampling_filter_states[2]),
|
WebRtcVad_Downsampling(speech_frame, speechWB, &(inst->downsampling_filter_states[2]),
|
||||||
frame_length);
|
frame_length);
|
||||||
len = WEBRTC_SPL_RSHIFT_W16(frame_length, 1);
|
len = frame_length / 2;
|
||||||
|
|
||||||
WebRtcVad_Downsampling(speechWB, speechNB, inst->downsampling_filter_states, len);
|
WebRtcVad_Downsampling(speechWB, speechNB, inst->downsampling_filter_states, len);
|
||||||
len = WEBRTC_SPL_RSHIFT_W16(len, 1);
|
len /= 2;
|
||||||
|
|
||||||
// Do VAD on an 8 kHz signal
|
// Do VAD on an 8 kHz signal
|
||||||
vad = WebRtcVad_CalcVad8khz(inst, speechNB, len);
|
vad = WebRtcVad_CalcVad8khz(inst, speechNB, len);
|
||||||
@ -660,7 +660,7 @@ int WebRtcVad_CalcVad16khz(VadInstT* inst, const int16_t* speech_frame,
|
|||||||
WebRtcVad_Downsampling(speech_frame, speechNB, inst->downsampling_filter_states,
|
WebRtcVad_Downsampling(speech_frame, speechNB, inst->downsampling_filter_states,
|
||||||
frame_length);
|
frame_length);
|
||||||
|
|
||||||
len = WEBRTC_SPL_RSHIFT_W16(frame_length, 1);
|
len = frame_length / 2;
|
||||||
vad = WebRtcVad_CalcVad8khz(inst, speechNB, len);
|
vad = WebRtcVad_CalcVad8khz(inst, speechNB, len);
|
||||||
|
|
||||||
return vad;
|
return vad;
|
||||||
|
@ -818,10 +818,8 @@ void WebRtcAecm_CalcEnergies(AecmCore_t * aecm,
|
|||||||
{
|
{
|
||||||
if (aecm->farEnergyVAD > aecm->farLogEnergy)
|
if (aecm->farEnergyVAD > aecm->farLogEnergy)
|
||||||
{
|
{
|
||||||
aecm->farEnergyVAD += WEBRTC_SPL_RSHIFT_W16(aecm->farLogEnergy +
|
aecm->farEnergyVAD +=
|
||||||
tmp16 -
|
(aecm->farLogEnergy + tmp16 - aecm->farEnergyVAD) >> 6;
|
||||||
aecm->farEnergyVAD,
|
|
||||||
6);
|
|
||||||
aecm->vadUpdateCount = 0;
|
aecm->vadUpdateCount = 0;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user