audio_processing: Removed use of macro WEBRTC_SPL_UMUL_16_16
The macro replaced is a trivial multiplication after explicit casts to uint16_t and uint32_t. This CL replaces its use with "*" and adds explicit casts if necessary.
Affected components:
* AECMobile
* AGC
* Noise Suppression (fixed point version)
BUG=3348,3353
TESTED=locally on linux and trybots
R=kwiberg@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/27389004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7101 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c
index db81478..340eacf 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core.c
@@ -330,8 +330,7 @@
echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i],
far_spectrum[i]);
(*far_energy) += (uint32_t)(far_spectrum[i]);
- (*echo_energy_adapt) += WEBRTC_SPL_UMUL_16_16(aecm->channelAdapt16[i],
- far_spectrum[i]);
+ *echo_energy_adapt += aecm->channelAdapt16[i] * far_spectrum[i];
(*echo_energy_stored) += (uint32_t)echo_est[i];
}
}
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_mips.c b/webrtc/modules/audio_processing/aecm/aecm_core_mips.c
index aedd25b..909a52e 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_mips.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_mips.c
@@ -512,8 +512,7 @@
echo_est[PART_LEN] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[PART_LEN],
far_spectrum[PART_LEN]);
par1 += (uint32_t)(far_spectrum[PART_LEN]);
- par2 += WEBRTC_SPL_UMUL_16_16(aecm->channelAdapt16[PART_LEN],
- far_spectrum[PART_LEN]);
+ par2 += aecm->channelAdapt16[PART_LEN] * far_spectrum[PART_LEN];
par3 += (uint32_t)echo_est[PART_LEN];
(*far_energy) = par1;
diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_neon.c b/webrtc/modules/audio_processing/aecm/aecm_core_neon.c
index 484ad71..4031790 100644
--- a/webrtc/modules/audio_processing/aecm/aecm_core_neon.c
+++ b/webrtc/modules/audio_processing/aecm/aecm_core_neon.c
@@ -267,8 +267,7 @@
__asm __volatile("vadd.u32 q8, q10" : : : "q10", "q8");
__asm __volatile("vadd.u32 q8, q11" : : : "q11", "q8");
- // echo_energy_adapt += WEBRTC_SPL_UMUL_16_16(
- // aecm->channelAdapt16[i], far_spectrum[i]);
+ // echo_energy_adapt += aecm->channelAdapt16[i] * far_spectrum[i];
__asm __volatile("vld1.16 {d24, d25}, [%0, :128]" : : "r"(&aecm->channelAdapt16[i]) : "q12");
__asm __volatile("vmull.u16 q10, d26, d24" : : : "q12", "q13", "q10");
__asm __volatile("vmull.u16 q11, d27, d25" : : : "q12", "q13", "q11");
@@ -292,8 +291,8 @@
echo_est[i] = WEBRTC_SPL_MUL_16_U16(aecm->channelStored[i], far_spectrum[i]);
*echo_energy_stored = echo_energy_stored_r + (uint32_t)echo_est[i];
*far_energy = far_energy_r + (uint32_t)(far_spectrum[i]);
- *echo_energy_adapt = echo_energy_adapt_r + WEBRTC_SPL_UMUL_16_16(
- aecm->channelAdapt16[i], far_spectrum[i]);
+ *echo_energy_adapt = echo_energy_adapt_r +
+ aecm->channelAdapt16[i] * far_spectrum[i];
}
void WebRtcAecm_StoreAdaptiveChannelNeon(AecmCore_t* aecm,
diff --git a/webrtc/modules/audio_processing/agc/digital_agc.c b/webrtc/modules/audio_processing/agc/digital_agc.c
index e439e09..e74bb4c 100644
--- a/webrtc/modules/audio_processing/agc/digital_agc.c
+++ b/webrtc/modules/audio_processing/agc/digital_agc.c
@@ -153,7 +153,7 @@
intPart = (uint16_t)WEBRTC_SPL_RSHIFT_U32(absInLevel, 14);
fracPart = (uint16_t)(absInLevel & 0x00003FFF); // extract the fractional part
tmpU16 = kGenFuncTable[intPart + 1] - kGenFuncTable[intPart]; // Q8
- tmpU32no1 = WEBRTC_SPL_UMUL_16_16(tmpU16, fracPart); // Q22
+ tmpU32no1 = tmpU16 * fracPart; // Q22
tmpU32no1 += (uint32_t)kGenFuncTable[intPart] << 14; // Q22
logApprox = WEBRTC_SPL_RSHIFT_U32(tmpU32no1, 8); // Q14
// Compensate for negative exponent using the relation:
diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c
index 19ad1a9..930c2c2 100644
--- a/webrtc/modules/audio_processing/ns/nsx_core.c
+++ b/webrtc/modules/audio_processing/ns/nsx_core.c
@@ -1771,7 +1771,8 @@
}
// calculate prevNearSnr[i] and save for later instead of recalculating it later
- nearMagnEst = WEBRTC_SPL_UMUL_16_16(inst->prevMagnU16[i], inst->noiseSupFilter[i]); // Q(prevQMagn+14)
+ // |nearMagnEst| in Q(prevQMagn + 14)
+ nearMagnEst = inst->prevMagnU16[i] * inst->noiseSupFilter[i];
tmpU32no1 = nearMagnEst << 3; // Q(prevQMagn+17)
tmpU32no2 = WEBRTC_SPL_RSHIFT_U32(inst->prevNoiseU32[i], nShifts); // Q(prevQMagn+6)
@@ -2016,11 +2017,9 @@
// Weight in the parametric Wiener filter during startup
if (inst->blockIndex < END_STARTUP_SHORT) {
// Weight the two suppression filters
- tmpU32no1 = WEBRTC_SPL_UMUL_16_16(inst->noiseSupFilter[i],
- (uint16_t)inst->blockIndex);
- tmpU32no2 = WEBRTC_SPL_UMUL_16_16(noiseSupFilterTmp[i],
- (uint16_t)(END_STARTUP_SHORT
- - inst->blockIndex));
+ tmpU32no1 = inst->noiseSupFilter[i] * inst->blockIndex;
+ tmpU32no2 = noiseSupFilterTmp[i] *
+ (END_STARTUP_SHORT - inst->blockIndex);
tmpU32no1 += tmpU32no2;
inst->noiseSupFilter[i] = (uint16_t)WebRtcSpl_DivU32U16(tmpU32no1,
END_STARTUP_SHORT);