This refactoring CL moves the nlp_mode member value from aecpc_t to aec_t, since it it never used at that level. Further, I removed two suppression variables by depending on nlp_mode directly.
TEST=audioproc_unittest, trybots BUG=None Review URL: https://webrtc-codereview.appspot.com/1095007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3538 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
cea70f4055
commit
5fc829200c
@ -105,6 +105,11 @@ const float WebRtcAec_overDriveCurve[65] = {
|
||||
1.9682f, 1.9763f, 1.9843f, 1.9922f, 2.0000f
|
||||
};
|
||||
|
||||
// Target suppression levels for nlp modes.
|
||||
// log{0.001, 0.00001, 0.00000001}
|
||||
static const float kTargetSupp[3] = { -6.9f, -11.5f, -18.4f };
|
||||
static const float kMinOverDrive[3] = { 1.0f, 2.0f, 5.0f };
|
||||
|
||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||
extern int webrtc_aec_instance_count;
|
||||
#endif
|
||||
@ -464,9 +469,8 @@ int WebRtcAec_InitAec(aec_t *aec, int sampFreq)
|
||||
aec->delay_logging_enabled = 0;
|
||||
memset(aec->delay_histogram, 0, sizeof(aec->delay_histogram));
|
||||
|
||||
// Default target suppression level
|
||||
aec->targetSupp = -11.5;
|
||||
aec->minOverDrive = 2.0;
|
||||
// Default target suppression mode.
|
||||
aec->nlp_mode = 1;
|
||||
|
||||
// Sampling frequency multiplier
|
||||
// SWB is processed as 160 frame size
|
||||
@ -1139,7 +1143,7 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
||||
|
||||
if (aec->hNlXdAvgMin == 1) {
|
||||
aec->echoState = 0;
|
||||
aec->overDrive = aec->minOverDrive;
|
||||
aec->overDrive = kMinOverDrive[aec->nlp_mode];
|
||||
|
||||
if (aec->stNearState == 1) {
|
||||
memcpy(hNl, cohde, sizeof(hNl));
|
||||
@ -1193,8 +1197,9 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
||||
if (aec->hNlMinCtr == 2) {
|
||||
aec->hNlNewMin = 0;
|
||||
aec->hNlMinCtr = 0;
|
||||
aec->overDrive = WEBRTC_SPL_MAX(aec->targetSupp /
|
||||
((float)log(aec->hNlFbMin + 1e-10f) + 1e-10f), aec->minOverDrive);
|
||||
aec->overDrive = WEBRTC_SPL_MAX(kTargetSupp[aec->nlp_mode] /
|
||||
((float)log(aec->hNlFbMin + 1e-10f) + 1e-10f),
|
||||
kMinOverDrive[aec->nlp_mode]);
|
||||
}
|
||||
|
||||
// Smooth the overdrive.
|
||||
|
@ -102,7 +102,7 @@ typedef struct {
|
||||
float hNlXdAvgMin;
|
||||
int hNlNewMin, hNlMinCtr;
|
||||
float overDrive, overDriveSm;
|
||||
float targetSupp, minOverDrive;
|
||||
int nlp_mode;
|
||||
float outBuf[PART_LEN];
|
||||
int delayIdx;
|
||||
|
||||
|
@ -35,10 +35,6 @@
|
||||
|
||||
static const int kMaxBufSizeStart = 62; // In partitions
|
||||
static const int sampMsNb = 8; // samples per ms in nb
|
||||
// Target suppression levels for nlp modes
|
||||
// log{0.001, 0.00001, 0.00000001}
|
||||
static const float targetSupp[3] = {-6.9f, -11.5f, -18.4f};
|
||||
static const float minOverDrive[3] = {1.0f, 2.0f, 5.0f};
|
||||
static const int initCheck = 42;
|
||||
|
||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||
@ -558,9 +554,7 @@ WebRtc_Word32 WebRtcAec_set_config(void *aecInst, AecConfig config)
|
||||
aecpc->lastError = AEC_BAD_PARAMETER_ERROR;
|
||||
return -1;
|
||||
}
|
||||
aecpc->nlpMode = config.nlpMode;
|
||||
aecpc->aec->targetSupp = targetSupp[aecpc->nlpMode];
|
||||
aecpc->aec->minOverDrive = minOverDrive[aecpc->nlpMode];
|
||||
aecpc->aec->nlp_mode = config.nlpMode;
|
||||
|
||||
if (config.metricsMode != kAecFalse && config.metricsMode != kAecTrue) {
|
||||
aecpc->lastError = AEC_BAD_PARAMETER_ERROR;
|
||||
@ -601,7 +595,7 @@ WebRtc_Word32 WebRtcAec_get_config(void *aecInst, AecConfig *config)
|
||||
return -1;
|
||||
}
|
||||
|
||||
config->nlpMode = aecpc->nlpMode;
|
||||
config->nlpMode = aecpc->aec->nlp_mode;
|
||||
config->skewMode = aecpc->skewMode;
|
||||
config->metricsMode = aecpc->aec->metricsMode;
|
||||
config->delay_logging = aecpc->aec->delay_logging_enabled;
|
||||
|
@ -19,7 +19,6 @@ typedef struct {
|
||||
int splitSampFreq;
|
||||
int scSampFreq;
|
||||
float sampFactor; // scSampRate / sampFreq
|
||||
short nlpMode;
|
||||
short autoOnOff;
|
||||
short activity;
|
||||
short skewMode;
|
||||
|
Loading…
x
Reference in New Issue
Block a user