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
This commit is contained in:
@@ -330,8 +330,7 @@ static void CalcLinearEnergiesC(AecmCore_t* aecm,
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
@@ -512,8 +512,7 @@ void WebRtcAecm_CalcLinearEnergies_mips(AecmCore_t* aecm,
|
||||
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;
|
||||
|
@@ -267,8 +267,7 @@ void WebRtcAecm_CalcLinearEnergiesNeon(AecmCore_t* aecm,
|
||||
__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 @@ void WebRtcAecm_CalcLinearEnergiesNeon(AecmCore_t* aecm,
|
||||
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,
|
||||
|
@@ -153,7 +153,7 @@ int32_t WebRtcAgc_CalculateGainTable(int32_t *gainTable, // Q16
|
||||
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:
|
||||
|
@@ -1771,7 +1771,8 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram
|
||||
}
|
||||
|
||||
// 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 @@ int WebRtcNsx_ProcessCore(NsxInst_t* inst, short* speechFrame, short* speechFram
|
||||
// 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);
|
||||
|
Reference in New Issue
Block a user