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:
parent
b6e58eb5a1
commit
4a8b1eaf6e
@ -472,7 +472,6 @@ static void NoiseEstimationC(NsxInst_t* inst,
|
|||||||
uint16_t* magn,
|
uint16_t* magn,
|
||||||
uint32_t* noise,
|
uint32_t* noise,
|
||||||
int16_t* q_noise) {
|
int16_t* q_noise) {
|
||||||
WebRtc_Word32 numerator = FACTOR_Q16;
|
|
||||||
WebRtc_Word16 lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
|
WebRtc_Word16 lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
|
||||||
WebRtc_Word16 countProd, delta, zeros, frac;
|
WebRtc_Word16 countProd, delta, zeros, frac;
|
||||||
WebRtc_Word16 log2, tabind, logval, tmp16, tmp16no1, tmp16no2;
|
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++) {
|
for (i = 0; i < inst->magnLen; i++) {
|
||||||
// compute delta
|
// compute delta
|
||||||
if (inst->noiseEstDensity[offset + i] > 512) {
|
if (inst->noiseEstDensity[offset + i] > 512) {
|
||||||
delta = WebRtcSpl_DivW32W16ResW16(numerator,
|
// Get the value for delta by shifting intead of dividing.
|
||||||
inst->noiseEstDensity[offset + i]);
|
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i]);
|
||||||
|
delta = (int16_t)(FACTOR_Q16 >> (14 - factor));
|
||||||
} else {
|
} else {
|
||||||
delta = FACTOR_Q7;
|
delta = FACTOR_Q7;
|
||||||
if (inst->blockIndex < END_STARTUP_LONG) {
|
if (inst->blockIndex < END_STARTUP_LONG) {
|
||||||
|
@ -96,7 +96,6 @@ static void NoiseEstimationNeon(NsxInst_t* inst,
|
|||||||
uint16_t* magn,
|
uint16_t* magn,
|
||||||
uint32_t* noise,
|
uint32_t* noise,
|
||||||
int16_t* q_noise) {
|
int16_t* q_noise) {
|
||||||
int32_t numerator = FACTOR_Q16;
|
|
||||||
int16_t lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
|
int16_t lmagn[HALF_ANAL_BLOCKL], counter, countDiv;
|
||||||
int16_t countProd, delta, zeros, frac;
|
int16_t countProd, delta, zeros, frac;
|
||||||
int16_t log2, tabind, logval, tmp16, tmp16no1, tmp16no2;
|
int16_t log2, tabind, logval, tmp16, tmp16no1, tmp16no2;
|
||||||
@ -181,8 +180,9 @@ static void NoiseEstimationNeon(NsxInst_t* inst,
|
|||||||
int j;
|
int j;
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
if (inst->noiseEstDensity[offset + i + j] > 512) {
|
if (inst->noiseEstDensity[offset + i + j] > 512) {
|
||||||
deltaBuff[j] = WebRtcSpl_DivW32W16ResW16(
|
// Get values for deltaBuff by shifting intead of dividing.
|
||||||
numerator, inst->noiseEstDensity[offset + i + j]);
|
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:
|
// Last iteration over magnitude spectrum:
|
||||||
// compute delta
|
// compute delta
|
||||||
if (inst->noiseEstDensity[offset + i] > 512) {
|
if (inst->noiseEstDensity[offset + i] > 512) {
|
||||||
delta = WebRtcSpl_DivW32W16ResW16(numerator,
|
// Get values for deltaBuff by shifting intead of dividing.
|
||||||
inst->noiseEstDensity[offset + i]);
|
int factor = WebRtcSpl_NormW16(inst->noiseEstDensity[offset + i]);
|
||||||
|
delta = (int16_t)(FACTOR_Q16 >> (14 - factor));
|
||||||
} else {
|
} else {
|
||||||
delta = FACTOR_Q7;
|
delta = FACTOR_Q7;
|
||||||
if (inst->blockIndex < END_STARTUP_LONG) {
|
if (inst->blockIndex < END_STARTUP_LONG) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user