NS-SWB: Actived SWB processing at once, i.e., no startup phase.

Performance verified on a few 32 kHz files.
BUG=
TEST=audioproc, audioproc_unittest

Updated output_data_float.pb
Changes in SWB tests (3, 6, 9 and 12) as

Running test 3 of 12...
src/modules/audio_processing/test/unit_test.cc:1182: Failure
Value of: max_output_average
  Actual: 1363
Expected: test->max_output_average()
Which is: 1386

Running test 6 of 12...
src/modules/audio_processing/test/unit_test.cc:1182: Failure
Value of: max_output_average
  Actual: 2070
Expected: test->max_output_average()
Which is: 2109

Running test 9 of 12...
src/modules/audio_processing/test/unit_test.cc:1182: Failure
Value of: max_output_average
  Actual: 1314
Expected: test->max_output_average()
Which is: 1336

Running test 12 of 12...
src/modules/audio_processing/test/unit_test.cc:1182: Failure
Value of: max_output_average
  Actual: 2049
Expected: test->max_output_average()
Which is: 2085
Review URL: https://webrtc-codereview.appspot.com/344013

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1465 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org 2012-01-19 08:56:38 +00:00
parent 17585856f5
commit 12cccddc63
2 changed files with 23 additions and 25 deletions

View File

@ -1254,31 +1254,29 @@ int WebRtcNs_ProcessCore(NSinst_t* inst,
for (i = 0; i < inst->magnLen; i++) { for (i = 0; i < inst->magnLen; i++) {
inst->speechProbHB[i] = probSpeechFinal[i]; inst->speechProbHB[i] = probSpeechFinal[i];
} }
if (inst->blockInd > END_STARTUP_LONG) { // average speech prob from low band
// average speech prob from low band // avg over second half (i.e., 4->8kHz) of freq. spectrum
// avg over second half (i.e., 4->8kHz) of freq. spectrum avgProbSpeechHB = 0.0;
avgProbSpeechHB = 0.0; for (i = inst->magnLen - deltaBweHB - 1; i < inst->magnLen - 1; i++) {
for (i = inst->magnLen - deltaBweHB - 1; i < inst->magnLen - 1; i++) { avgProbSpeechHB += inst->speechProbHB[i];
avgProbSpeechHB += inst->speechProbHB[i]; }
} avgProbSpeechHB = avgProbSpeechHB / ((float)deltaBweHB);
avgProbSpeechHB = avgProbSpeechHB / ((float)deltaBweHB); // average filter gain from low band
// average filter gain from low band // average over second half (i.e., 4->8kHz) of freq. spectrum
// average over second half (i.e., 4->8kHz) of freq. spectrum avgFilterGainHB = 0.0;
avgFilterGainHB = 0.0; for (i = inst->magnLen - deltaGainHB - 1; i < inst->magnLen - 1; i++) {
for (i = inst->magnLen - deltaGainHB - 1; i < inst->magnLen - 1; i++) { avgFilterGainHB += inst->smooth[i];
avgFilterGainHB += inst->smooth[i]; }
} avgFilterGainHB = avgFilterGainHB / ((float)(deltaGainHB));
avgFilterGainHB = avgFilterGainHB / ((float)(deltaGainHB)); avgProbSpeechHBTmp = (float)2.0 * avgProbSpeechHB - (float)1.0;
avgProbSpeechHBTmp = (float)2.0 * avgProbSpeechHB - (float)1.0; // gain based on speech prob:
// gain based on speech prob: gainModHB = (float)0.5 * ((float)1.0 + (float)tanh(gainMapParHB * avgProbSpeechHBTmp));
gainModHB = (float)0.5 * ((float)1.0 + (float)tanh(gainMapParHB * avgProbSpeechHBTmp)); //combine gain with low band gain
//combine gain with low band gain gainTimeDomainHB = (float)0.5 * gainModHB + (float)0.5 * avgFilterGainHB;
gainTimeDomainHB = (float)0.5 * gainModHB + (float)0.5 * avgFilterGainHB; if (avgProbSpeechHB >= (float)0.5) {
if (avgProbSpeechHB >= (float)0.5) { gainTimeDomainHB = (float)0.25 * gainModHB + (float)0.75 * avgFilterGainHB;
gainTimeDomainHB = (float)0.25 * gainModHB + (float)0.75 * avgFilterGainHB; }
} gainTimeDomainHB = gainTimeDomainHB * decayBweHB;
gainTimeDomainHB = gainTimeDomainHB * decayBweHB;
} // end of converged
//make sure gain is within flooring range //make sure gain is within flooring range
// flooring bottom // flooring bottom
if (gainTimeDomainHB < inst->denoiseBound) { if (gainTimeDomainHB < inst->denoiseBound) {