| Index: webrtc/modules/audio_processing/aec/aec_core.cc
|
| diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
|
| index 0c3fc523eea61e5eabcabbfc3e3f3fdc4db9e41c..efc2489da4fa5152a6fe67abffc81a78fbb0702d 100644
|
| --- a/webrtc/modules/audio_processing/aec/aec_core.cc
|
| +++ b/webrtc/modules/audio_processing/aec/aec_core.cc
|
| @@ -14,10 +14,6 @@
|
|
|
| #include "webrtc/modules/audio_processing/aec/aec_core.h"
|
|
|
| -#ifdef WEBRTC_AEC_DEBUG_DUMP
|
| -#include <stdio.h>
|
| -#endif
|
| -
|
| #include <algorithm>
|
| #include <assert.h>
|
| #include <math.h>
|
| @@ -34,7 +30,6 @@ extern "C" {
|
| extern "C" {
|
| #include "webrtc/modules/audio_processing/aec/aec_rdft.h"
|
| }
|
| -#include "webrtc/modules/audio_processing/logging/aec_logging.h"
|
| extern "C" {
|
| #include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h"
|
| }
|
| @@ -137,6 +132,8 @@ enum { kPrefBandSize = 24 };
|
|
|
| #ifdef WEBRTC_AEC_DEBUG_DUMP
|
| extern int webrtc_aec_instance_count;
|
| +#else
|
| +const int webrtc_aec_instance_count = 0;
|
| #endif
|
|
|
| WebRtcAecFilterFar WebRtcAec_FilterFar;
|
| @@ -209,7 +206,7 @@ void DivergentFilterFraction::Clear() {
|
| }
|
|
|
| // TODO(minyue): Moving some initialization from WebRtcAec_CreateAec() to ctor.
|
| -AecCore::AecCore() = default;
|
| +AecCore::AecCore(int instance_index) : data_dumper(instance_index) {}
|
|
|
| static int CmpFloat(const void* a, const void* b) {
|
| const float* da = (const float*)a;
|
| @@ -1001,8 +998,7 @@ static void EchoSubtraction(AecCore* aec,
|
| memcpy(e_extended + PART_LEN, e, sizeof(float) * PART_LEN);
|
| Fft(e_extended, e_fft);
|
|
|
| - RTC_AEC_DEBUG_RAW_WRITE(aec->e_fft_file, &e_fft[0][0],
|
| - sizeof(e_fft[0][0]) * PART_LEN1 * 2);
|
| + aec->data_dumper.DumpRaw("aec_e_fft", PART_LEN1 * 2, &e_fft[0][0]);
|
|
|
| // Scale error signal inversely with far power.
|
| WebRtcAec_ScaleErrorSignal(extended_filter_enabled, normal_mu,
|
| @@ -1293,15 +1289,10 @@ static void ProcessBlock(AecCore* aec) {
|
| WebRtc_ReadBuffer(aec->far_time_buf, reinterpret_cast<void**>(&farend_ptr),
|
| farend, 1);
|
|
|
| -#ifdef WEBRTC_AEC_DEBUG_DUMP
|
| - {
|
| - // TODO(minyue): |farend_ptr| starts from buffered samples. This will be
|
| - // modified when |aec->far_time_buf| is revised.
|
| - RTC_AEC_DEBUG_WAV_WRITE(aec->farFile, &farend_ptr[PART_LEN], PART_LEN);
|
| -
|
| - RTC_AEC_DEBUG_WAV_WRITE(aec->nearFile, nearend_ptr, PART_LEN);
|
| - }
|
| -#endif
|
| + aec->data_dumper.DumpWav("aec_far", PART_LEN, &farend_ptr[PART_LEN],
|
| + aec->sampFreq > 16000 ? 16000 : aec->sampFreq);
|
| + aec->data_dumper.DumpWav("aec_near", PART_LEN, nearend_ptr,
|
| + aec->sampFreq > 16000 ? 16000 : aec->sampFreq);
|
|
|
| if (aec->metricsMode == 1) {
|
| // Update power levels
|
| @@ -1387,7 +1378,8 @@ static void ProcessBlock(AecCore* aec) {
|
| &aec->xfBufBlockPos, aec->xfBuf, nearend_ptr, aec->xPow,
|
| aec->wfBuf, echo_subtractor_output);
|
|
|
| - RTC_AEC_DEBUG_WAV_WRITE(aec->outLinearFile, echo_subtractor_output, PART_LEN);
|
| + aec->data_dumper.DumpWav("aec_out_linear", PART_LEN, echo_subtractor_output,
|
| + aec->sampFreq > 16000 ? 16000 : aec->sampFreq);
|
|
|
| if (aec->metricsMode == 1) {
|
| UpdateLevel(&aec->linoutlevel,
|
| @@ -1409,12 +1401,14 @@ static void ProcessBlock(AecCore* aec) {
|
| WebRtc_WriteBuffer(aec->outFrBufH[i], outputH[i], PART_LEN);
|
| }
|
|
|
| - RTC_AEC_DEBUG_WAV_WRITE(aec->outFile, output, PART_LEN);
|
| + aec->data_dumper.DumpWav("aec_out", PART_LEN, output,
|
| + aec->sampFreq > 16000 ? 16000 : aec->sampFreq);
|
| }
|
|
|
| AecCore* WebRtcAec_CreateAec() {
|
| int i;
|
| - AecCore* aec = new AecCore;
|
| + AecCore* aec = new AecCore(webrtc_aec_instance_count);
|
| +
|
| if (!aec) {
|
| return NULL;
|
| }
|
| @@ -1458,12 +1452,6 @@ AecCore* WebRtcAec_CreateAec() {
|
| return NULL;
|
| }
|
|
|
| -#ifdef WEBRTC_AEC_DEBUG_DUMP
|
| - aec->instance_index = webrtc_aec_instance_count;
|
| -
|
| - aec->farFile = aec->nearFile = aec->outFile = aec->outLinearFile = NULL;
|
| - aec->debug_dump_count = 0;
|
| -#endif
|
| aec->delay_estimator_farend =
|
| WebRtc_CreateDelayEstimatorFarend(PART_LEN1, kHistorySizeBlocks);
|
| if (aec->delay_estimator_farend == NULL) {
|
| @@ -1540,12 +1528,6 @@ void WebRtcAec_FreeAec(AecCore* aec) {
|
|
|
| WebRtc_FreeBuffer(aec->far_time_buf);
|
|
|
| - RTC_AEC_DEBUG_WAV_CLOSE(aec->farFile);
|
| - RTC_AEC_DEBUG_WAV_CLOSE(aec->nearFile);
|
| - RTC_AEC_DEBUG_WAV_CLOSE(aec->outFile);
|
| - RTC_AEC_DEBUG_WAV_CLOSE(aec->outLinearFile);
|
| - RTC_AEC_DEBUG_RAW_CLOSE(aec->e_fft_file);
|
| -
|
| WebRtc_FreeDelayEstimator(aec->delay_estimator);
|
| WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend);
|
|
|
| @@ -1554,6 +1536,7 @@ void WebRtcAec_FreeAec(AecCore* aec) {
|
|
|
| int WebRtcAec_InitAec(AecCore* aec, int sampFreq) {
|
| int i;
|
| + aec->data_dumper.Initialize();
|
|
|
| aec->sampFreq = sampFreq;
|
|
|
| @@ -1577,27 +1560,6 @@ int WebRtcAec_InitAec(AecCore* aec, int sampFreq) {
|
| // Initialize far-end buffers.
|
| WebRtc_InitBuffer(aec->far_time_buf);
|
|
|
| -#ifdef WEBRTC_AEC_DEBUG_DUMP
|
| - {
|
| - int process_rate = sampFreq > 16000 ? 16000 : sampFreq;
|
| - RTC_AEC_DEBUG_WAV_REOPEN("aec_far", aec->instance_index,
|
| - aec->debug_dump_count, process_rate,
|
| - &aec->farFile);
|
| - RTC_AEC_DEBUG_WAV_REOPEN("aec_near", aec->instance_index,
|
| - aec->debug_dump_count, process_rate,
|
| - &aec->nearFile);
|
| - RTC_AEC_DEBUG_WAV_REOPEN("aec_out", aec->instance_index,
|
| - aec->debug_dump_count, process_rate,
|
| - &aec->outFile);
|
| - RTC_AEC_DEBUG_WAV_REOPEN("aec_out_linear", aec->instance_index,
|
| - aec->debug_dump_count, process_rate,
|
| - &aec->outLinearFile);
|
| - }
|
| -
|
| - RTC_AEC_DEBUG_RAW_OPEN("aec_e_fft", aec->debug_dump_count, &aec->e_fft_file);
|
| -
|
| - ++aec->debug_dump_count;
|
| -#endif
|
| aec->system_delay = 0;
|
|
|
| if (WebRtc_InitDelayEstimatorFarend(aec->delay_estimator_farend) != 0) {
|
|
|