In NS, replaced a divide calculatoin by shifting, and thus saved the MIPS by 5%(ARMv7) and 10%(ARMv7-Neon). Bit is not exact with the original. Quality is similar.

Review URL: http://webrtc-codereview.appspot.com/298004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1112 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kma@webrtc.org 2011-12-06 18:04:48 +00:00
parent b6e58eb5a1
commit 4a8b1eaf6e
2 changed files with 9 additions and 8 deletions

View File

@ -472,7 +472,6 @@ static void NoiseEstimationC(NsxInst_t* inst,
uint16_t* magn,
uint32_t* noise,
int16_t* q_noise) {
WebRtc_Word32 numerator = FACTOR_Q16;
WebRtc_Word16 lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
WebRtc_Word16 countProd, delta, zeros, frac;
WebRtc_Word16 log2, tabind, logval, tmp16, tmp16no1, tmp16no2;
@ -526,8 +525,9 @@ static void NoiseEstimationC(NsxInst_t* inst,
for (i = 0; i < inst->magnLen; i++) {
// compute delta
if (inst->noiseEstDensity[offset + i] > 512) {
delta = WebRtcSpl_DivW32W16ResW16(numerator,
inst->noiseEstDensity[offset + i]);
// Get the value for delta by shifting intead of dividing.
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i]);
delta = (int16_t)(FACTOR_Q16 >> (14 - factor));
} else {
delta = FACTOR_Q7;
if (inst->blockIndex < END_STARTUP_LONG) {

View File

@ -96,7 +96,6 @@ static void NoiseEstimationNeon(NsxInst_t* inst,
uint16_t* magn,
uint32_t* noise,
int16_t* q_noise) {
int32_t numerator = FACTOR_Q16;
int16_t lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
int16_t countProd, delta, zeros, frac;
int16_t log2, tabind, logval, tmp16, tmp16no1, tmp16no2;
@ -181,8 +180,9 @@ static void NoiseEstimationNeon(NsxInst_t* inst,
int j;
for (j = 0; j < 8; j++) {
if (inst->noiseEstDensity[offset + i + j] > 512) {
deltaBuff[j] = WebRtcSpl_DivW32W16ResW16(
numerator, inst->noiseEstDensity[offset + i + j]);
// Get values for deltaBuff by shifting intead of dividing.
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i + j]);
deltaBuff[j] = (int16_t)(FACTOR_Q16 >> (14 - factor));
}
}
@ -254,8 +254,9 @@ static void NoiseEstimationNeon(NsxInst_t* inst,
// Last iteration over magnitude spectrum:
// compute delta
if (inst->noiseEstDensity[offset + i] > 512) {
delta = WebRtcSpl_DivW32W16ResW16(numerator,
inst->noiseEstDensity[offset + i]);
// Get values for deltaBuff by shifting intead of dividing.
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i]);
delta = (int16_t)(FACTOR_Q16 >> (14 - factor));
} else {
delta = FACTOR_Q7;
if (inst->blockIndex < END_STARTUP_LONG) {