Fix normalization of noise estimate in NoiseSuppressor

R=henrik.lundin@webrtc.org, peah@webrtc.org, turaj@webrtc.org

Review URL: https://codereview.webrtc.org/1821443003 .

Cr-Commit-Position: refs/heads/master@{#12201}
This commit is contained in:
Alejandro Luebs
2016-04-01 13:54:36 -07:00
parent 7ff1737e7c
commit 3b14996046
6 changed files with 31 additions and 23 deletions

View File

@ -45,11 +45,14 @@ void WebRtcNsx_Process(NsxHandle* nsxInst,
num_bands, outFrame);
}
const uint32_t* WebRtcNsx_noise_estimate(const NsxHandle* nsxInst) {
const uint32_t* WebRtcNsx_noise_estimate(const NsxHandle* nsxInst,
int* q_noise) {
*q_noise = 11;
const NoiseSuppressionFixedC* self = (const NoiseSuppressionFixedC*)nsxInst;
if (nsxInst == NULL || self->initFlag == 0) {
return NULL;
}
*q_noise += self->prevQNoise;
return self->prevNoiseU32;
}

View File

@ -88,12 +88,16 @@ void WebRtcNsx_Process(NsxHandle* nsxInst,
*
* Input
* - nsxInst : NSx instance. Needs to be initiated before call.
* - q_noise : Q value of the noise estimate, which is the number of
* bits that it needs to be right-shifted to be
* normalized.
*
* Return value : Pointer to the noise estimate per frequency bin.
* Returns NULL if the input is a NULL pointer or an
* uninitialized instance.
*/
const uint32_t* WebRtcNsx_noise_estimate(const NsxHandle* nsxInst);
const uint32_t* WebRtcNsx_noise_estimate(const NsxHandle* nsxInst,
int* q_noise);
/* Returns the number of frequency bins, which is the length of the noise
* estimate for example.