audio_processing: Replaced macro WEBRTC_SPL_RSHIFT_W32 with >>

Also includes a typo in a comment.
Affects
* aecm
* hpf

BUG=3348,3353
TESTED=locally on linux and trybots
R=kwiberg@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7456 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2014-10-15 12:51:23 +00:00
parent f02ba9be54
commit f87c0aff7f
5 changed files with 14 additions and 26 deletions

View File

@ -958,9 +958,8 @@ void WebRtcAecm_UpdateChannel(AecmCore_t * aecm,
{ {
// We need to shift down before multiplication // We need to shift down before multiplication
shiftChFar = 32 - zerosCh - zerosFar; shiftChFar = 32 - zerosCh - zerosFar;
tmpU32no1 = WEBRTC_SPL_UMUL_32_16( tmpU32no1 = (aecm->channelAdapt32[i] >> shiftChFar) *
WEBRTC_SPL_RSHIFT_W32(aecm->channelAdapt32[i], shiftChFar), far_spectrum[i];
far_spectrum[i]);
} }
// Determine Q-domain of numerator // Determine Q-domain of numerator
zerosNum = WebRtcSpl_NormU32(tmpU32no1); zerosNum = WebRtcSpl_NormU32(tmpU32no1);
@ -1019,14 +1018,10 @@ void WebRtcAecm_UpdateChannel(AecmCore_t * aecm,
shiftNum = 32 - (zerosNum + zerosFar); shiftNum = 32 - (zerosNum + zerosFar);
if (tmp32no1 > 0) if (tmp32no1 > 0)
{ {
tmp32no2 = (int32_t)WEBRTC_SPL_UMUL_32_16( tmp32no2 = (tmp32no1 >> shiftNum) * far_spectrum[i];
WEBRTC_SPL_RSHIFT_W32(tmp32no1, shiftNum),
far_spectrum[i]);
} else } else
{ {
tmp32no2 = -(int32_t)WEBRTC_SPL_UMUL_32_16( tmp32no2 = -((-tmp32no1 >> shiftNum) * far_spectrum[i]);
WEBRTC_SPL_RSHIFT_W32(-tmp32no1, shiftNum),
far_spectrum[i]);
} }
} }
// Normalize with respect to frequency bin // Normalize with respect to frequency bin
@ -1047,8 +1042,8 @@ void WebRtcAecm_UpdateChannel(AecmCore_t * aecm,
// We can never have negative channel gain // We can never have negative channel gain
aecm->channelAdapt32[i] = 0; aecm->channelAdapt32[i] = 0;
} }
aecm->channelAdapt16[i] aecm->channelAdapt16[i] =
= (int16_t)WEBRTC_SPL_RSHIFT_W32(aecm->channelAdapt32[i], 16); (int16_t)(aecm->channelAdapt32[i] >> 16);
} }
} }
} }

View File

@ -487,10 +487,7 @@ int WebRtcAecm_ProcessBlock(AecmCore_t * aecm,
} else } else
{ {
// Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16) // Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16)
echoEst32Gained = WEBRTC_SPL_UMUL_32_16((uint32_t)WEBRTC_SPL_RSHIFT_W32( echoEst32Gained = (aecm->echoFilt[i] >> tmp16no1) * supGain;
aecm->echoFilt[i],
tmp16no1),
(uint16_t)supGain);
} }
} }
@ -509,7 +506,7 @@ int WebRtcAecm_ProcessBlock(AecmCore_t * aecm,
tmp16no2 = ptrDfaClean[i]; tmp16no2 = ptrDfaClean[i];
} }
tmp32no1 = (int32_t)(tmp16no2 - tmp16no1); tmp32no1 = (int32_t)(tmp16no2 - tmp16no1);
tmp16no2 = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32no1, 4); tmp16no2 = (int16_t)(tmp32no1 >> 4);
tmp16no2 += tmp16no1; tmp16no2 += tmp16no1;
zeros16 = WebRtcSpl_NormW16(tmp16no2); zeros16 = WebRtcSpl_NormW16(tmp16no2);
if ((tmp16no2) & (-qDomainDiff > zeros16)) { if ((tmp16no2) & (-qDomainDiff > zeros16)) {
@ -743,7 +740,7 @@ static void ComfortNoise(AecmCore_t* aecm,
for (i = 0; i < PART_LEN1; i++) for (i = 0; i < PART_LEN1; i++)
{ {
tmp32 = WEBRTC_SPL_RSHIFT_W32(aecm->noiseEst[i], shiftFromNearToNoise); tmp32 = aecm->noiseEst[i] >> shiftFromNearToNoise;
if (tmp32 > 32767) if (tmp32 > 32767)
{ {
tmp32 = 32767; tmp32 = 32767;

View File

@ -991,10 +991,7 @@ int WebRtcAecm_ProcessBlock(AecmCore_t* aecm,
supGain >> tmp16no1); supGain >> tmp16no1);
} else { } else {
// Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16) // Result in Q-(RESOLUTION_CHANNEL+RESOLUTION_SUPGAIN-16)
echoEst32Gained = WEBRTC_SPL_UMUL_32_16( echoEst32Gained = (aecm->echoFilt[i] >> tmp16no1) * supGain;
(uint32_t)WEBRTC_SPL_RSHIFT_W32(aecm->echoFilt[i],
tmp16no1),
(uint16_t)supGain);
} }
} }
@ -1014,7 +1011,7 @@ int WebRtcAecm_ProcessBlock(AecmCore_t* aecm,
} }
tmp32no1 = (int32_t)(tmp16no2 - tmp16no1); tmp32no1 = (int32_t)(tmp16no2 - tmp16no1);
tmp16no2 = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp32no1, 4); tmp16no2 = (int16_t)(tmp32no1 >> 4);
tmp16no2 += tmp16no1; tmp16no2 += tmp16no1;
zeros16 = WebRtcSpl_NormW16(tmp16no2); zeros16 = WebRtcSpl_NormW16(tmp16no2);
if ((tmp16no2) & (-qDomainDiff > zeros16)) { if ((tmp16no2) & (-qDomainDiff > zeros16)) {

View File

@ -93,9 +93,8 @@ int Filter(FilterState* hpf, int16_t* data, int length) {
tmp_int32, tmp_int32,
static_cast<int32_t>(-134217728)); static_cast<int32_t>(-134217728));
// Convert back to Q0 and use rounding // Convert back to Q0 and use rounding.
data[i] = (int16_t)WEBRTC_SPL_RSHIFT_W32(tmp_int32, 12); data[i] = (int16_t)(tmp_int32 >> 12);
} }
return AudioProcessing::kNoError; return AudioProcessing::kNoError;

View File

@ -1472,7 +1472,7 @@ void WebRtcNsx_DataSynthesis(NsxInst_t* inst, short* outFrame) {
- inst->scaleEnergyIn); - inst->scaleEnergyIn);
} else { } else {
// |energyIn| is currently in Q(|scaleEnergyIn|), but to later on end up // |energyIn| is currently in Q(|scaleEnergyIn|), but to later on end up
// with an |energyRation| in Q8 we need to change the Q-domain to // with an |energyRatio| in Q8 we need to change the Q-domain to
// Q(-8-scaleEnergyOut). // Q(-8-scaleEnergyOut).
inst->energyIn >>= 8 + scaleEnergyOut - inst->scaleEnergyIn; inst->energyIn >>= 8 + scaleEnergyOut - inst->scaleEnergyIn;
} }