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
|
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
|
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||||
extern int webrtc_aec_instance_count;
|
extern int webrtc_aec_instance_count;
|
||||||
#endif
|
#endif
|
||||||
@ -464,9 +469,8 @@ int WebRtcAec_InitAec(aec_t *aec, int sampFreq)
|
|||||||
aec->delay_logging_enabled = 0;
|
aec->delay_logging_enabled = 0;
|
||||||
memset(aec->delay_histogram, 0, sizeof(aec->delay_histogram));
|
memset(aec->delay_histogram, 0, sizeof(aec->delay_histogram));
|
||||||
|
|
||||||
// Default target suppression level
|
// Default target suppression mode.
|
||||||
aec->targetSupp = -11.5;
|
aec->nlp_mode = 1;
|
||||||
aec->minOverDrive = 2.0;
|
|
||||||
|
|
||||||
// Sampling frequency multiplier
|
// Sampling frequency multiplier
|
||||||
// SWB is processed as 160 frame size
|
// 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) {
|
if (aec->hNlXdAvgMin == 1) {
|
||||||
aec->echoState = 0;
|
aec->echoState = 0;
|
||||||
aec->overDrive = aec->minOverDrive;
|
aec->overDrive = kMinOverDrive[aec->nlp_mode];
|
||||||
|
|
||||||
if (aec->stNearState == 1) {
|
if (aec->stNearState == 1) {
|
||||||
memcpy(hNl, cohde, sizeof(hNl));
|
memcpy(hNl, cohde, sizeof(hNl));
|
||||||
@ -1193,8 +1197,9 @@ static void NonLinearProcessing(aec_t *aec, short *output, short *outputH)
|
|||||||
if (aec->hNlMinCtr == 2) {
|
if (aec->hNlMinCtr == 2) {
|
||||||
aec->hNlNewMin = 0;
|
aec->hNlNewMin = 0;
|
||||||
aec->hNlMinCtr = 0;
|
aec->hNlMinCtr = 0;
|
||||||
aec->overDrive = WEBRTC_SPL_MAX(aec->targetSupp /
|
aec->overDrive = WEBRTC_SPL_MAX(kTargetSupp[aec->nlp_mode] /
|
||||||
((float)log(aec->hNlFbMin + 1e-10f) + 1e-10f), aec->minOverDrive);
|
((float)log(aec->hNlFbMin + 1e-10f) + 1e-10f),
|
||||||
|
kMinOverDrive[aec->nlp_mode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Smooth the overdrive.
|
// Smooth the overdrive.
|
||||||
|
@ -102,7 +102,7 @@ typedef struct {
|
|||||||
float hNlXdAvgMin;
|
float hNlXdAvgMin;
|
||||||
int hNlNewMin, hNlMinCtr;
|
int hNlNewMin, hNlMinCtr;
|
||||||
float overDrive, overDriveSm;
|
float overDrive, overDriveSm;
|
||||||
float targetSupp, minOverDrive;
|
int nlp_mode;
|
||||||
float outBuf[PART_LEN];
|
float outBuf[PART_LEN];
|
||||||
int delayIdx;
|
int delayIdx;
|
||||||
|
|
||||||
|
@ -35,10 +35,6 @@
|
|||||||
|
|
||||||
static const int kMaxBufSizeStart = 62; // In partitions
|
static const int kMaxBufSizeStart = 62; // In partitions
|
||||||
static const int sampMsNb = 8; // samples per ms in nb
|
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;
|
static const int initCheck = 42;
|
||||||
|
|
||||||
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
#ifdef WEBRTC_AEC_DEBUG_DUMP
|
||||||
@ -558,9 +554,7 @@ WebRtc_Word32 WebRtcAec_set_config(void *aecInst, AecConfig config)
|
|||||||
aecpc->lastError = AEC_BAD_PARAMETER_ERROR;
|
aecpc->lastError = AEC_BAD_PARAMETER_ERROR;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
aecpc->nlpMode = config.nlpMode;
|
aecpc->aec->nlp_mode = config.nlpMode;
|
||||||
aecpc->aec->targetSupp = targetSupp[aecpc->nlpMode];
|
|
||||||
aecpc->aec->minOverDrive = minOverDrive[aecpc->nlpMode];
|
|
||||||
|
|
||||||
if (config.metricsMode != kAecFalse && config.metricsMode != kAecTrue) {
|
if (config.metricsMode != kAecFalse && config.metricsMode != kAecTrue) {
|
||||||
aecpc->lastError = AEC_BAD_PARAMETER_ERROR;
|
aecpc->lastError = AEC_BAD_PARAMETER_ERROR;
|
||||||
@ -601,7 +595,7 @@ WebRtc_Word32 WebRtcAec_get_config(void *aecInst, AecConfig *config)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
config->nlpMode = aecpc->nlpMode;
|
config->nlpMode = aecpc->aec->nlp_mode;
|
||||||
config->skewMode = aecpc->skewMode;
|
config->skewMode = aecpc->skewMode;
|
||||||
config->metricsMode = aecpc->aec->metricsMode;
|
config->metricsMode = aecpc->aec->metricsMode;
|
||||||
config->delay_logging = aecpc->aec->delay_logging_enabled;
|
config->delay_logging = aecpc->aec->delay_logging_enabled;
|
||||||
|
@ -19,7 +19,6 @@ typedef struct {
|
|||||||
int splitSampFreq;
|
int splitSampFreq;
|
||||||
int scSampFreq;
|
int scSampFreq;
|
||||||
float sampFactor; // scSampRate / sampFreq
|
float sampFactor; // scSampRate / sampFreq
|
||||||
short nlpMode;
|
|
||||||
short autoOnOff;
|
short autoOnOff;
|
||||||
short activity;
|
short activity;
|
||||||
short skewMode;
|
short skewMode;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user