Index: webrtc/modules/audio_processing/aec/aec_core.c |
diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c |
index 70927074f8e66caeb1278e44a67a427d1416d704..35a8ba15c3d1027956f27796c94cae67055b138b 100644 |
--- a/webrtc/modules/audio_processing/aec/aec_core.c |
+++ b/webrtc/modules/audio_processing/aec/aec_core.c |
@@ -32,6 +32,7 @@ |
#include "webrtc/modules/audio_processing/utility/delay_estimator_wrapper.h" |
#include "webrtc/system_wrappers/interface/cpu_features_wrapper.h" |
#include "webrtc/typedefs.h" |
+#include "webrtc/modules/audio_processing/logging/aec_logging.h" |
the sun
2015/08/11 08:48:26
include order
peah-webrtc
2015/08/12 20:25:51
Done.
|
// Buffer size (samples) |
static const size_t kBufSizePartitions = 250; // 1 second of audio in 16 kHz. |
@@ -1219,8 +1220,8 @@ static void ProcessBlock(AecCore* aec) { |
float farend[PART_LEN]; |
float* farend_ptr = NULL; |
WebRtc_ReadBuffer(aec->far_time_buf, (void**)&farend_ptr, farend, 1); |
- rtc_WavWriteSamples(aec->farFile, farend_ptr, PART_LEN); |
- rtc_WavWriteSamples(aec->nearFile, nearend_ptr, PART_LEN); |
+ WEBRTC_AEC_DEBUG_WAV_WRITE(aec->farFile, farend_ptr, PART_LEN); |
+ WEBRTC_AEC_DEBUG_WAV_WRITE(aec->nearFile, nearend_ptr, PART_LEN); |
} |
#endif |
@@ -1347,6 +1348,10 @@ static void ProcessBlock(AecCore* aec) { |
ef[1][i] = fft[2 * i + 1]; |
} |
+ WEBRTC_AEC_DEBUG_RAW_WRITE(aec->e_fft_file, |
+ &ef[0][0], |
+ sizeof(ef[0][0]) * PART_LEN1 * 2); |
+ |
if (aec->metricsMode == 1) { |
// Note that the first PART_LEN samples in fft (before transformation) are |
// zero. Hence, the scaling by two in UpdateLevel() should not be |
@@ -1373,10 +1378,8 @@ static void ProcessBlock(AecCore* aec) { |
WebRtc_WriteBuffer(aec->outFrBufH[i], outputH[i], PART_LEN); |
} |
-#ifdef WEBRTC_AEC_DEBUG_DUMP |
- rtc_WavWriteSamples(aec->outLinearFile, e, PART_LEN); |
- rtc_WavWriteSamples(aec->outFile, output, PART_LEN); |
-#endif |
+ WEBRTC_AEC_DEBUG_WAV_WRITE(aec->outLinearFile, e, PART_LEN); |
+ WEBRTC_AEC_DEBUG_WAV_WRITE(aec->outFile, output, PART_LEN); |
} |
AecCore* WebRtcAec_CreateAec() { |
@@ -1511,40 +1514,19 @@ void WebRtcAec_FreeAec(AecCore* aec) { |
WebRtc_FreeBuffer(aec->far_buf_windowed); |
#ifdef WEBRTC_AEC_DEBUG_DUMP |
WebRtc_FreeBuffer(aec->far_time_buf); |
- rtc_WavClose(aec->farFile); |
- rtc_WavClose(aec->nearFile); |
- rtc_WavClose(aec->outFile); |
- rtc_WavClose(aec->outLinearFile); |
#endif |
+ WEBRTC_AEC_DEBUG_WAV_CLOSE(aec->farFile); |
+ WEBRTC_AEC_DEBUG_WAV_CLOSE(aec->nearFile); |
+ WEBRTC_AEC_DEBUG_WAV_CLOSE(aec->outFile); |
+ WEBRTC_AEC_DEBUG_WAV_CLOSE(aec->outLinearFile); |
+ WEBRTC_AEC_DEBUG_RAW_CLOSE(aec->e_fft_file); |
+ |
WebRtc_FreeDelayEstimator(aec->delay_estimator); |
WebRtc_FreeDelayEstimatorFarend(aec->delay_estimator_farend); |
free(aec); |
} |
-#ifdef WEBRTC_AEC_DEBUG_DUMP |
-// Open a new Wav file for writing. If it was already open with a different |
-// sample frequency, close it first. |
-static void ReopenWav(rtc_WavWriter** wav_file, |
- const char* name, |
- int seq1, |
- int seq2, |
- int sample_rate) { |
- int written ATTRIBUTE_UNUSED; |
- char filename[64]; |
- if (*wav_file) { |
- if (rtc_WavSampleRate(*wav_file) == sample_rate) |
- return; |
- rtc_WavClose(*wav_file); |
- } |
- written = snprintf(filename, sizeof(filename), "%s%d-%d.wav", |
- name, seq1, seq2); |
- assert(written >= 0); // no output error |
- assert((size_t)written < sizeof(filename)); // buffer was large enough |
- *wav_file = rtc_WavOpen(filename, sample_rate, 1); |
-} |
-#endif // WEBRTC_AEC_DEBUG_DUMP |
- |
int WebRtcAec_InitAec(AecCore* aec, int sampFreq) { |
int i; |
@@ -1574,15 +1556,20 @@ int WebRtcAec_InitAec(AecCore* aec, int sampFreq) { |
WebRtc_InitBuffer(aec->far_time_buf); |
{ |
int process_rate = sampFreq > 16000 ? 16000 : sampFreq; |
- ReopenWav(&aec->farFile, "aec_far", |
+ WEBRTC_AEC_DEBUG_WAV_REOPEN(&aec->farFile, "aec_far", |
aec->instance_index, aec->debug_dump_count, process_rate); |
- ReopenWav(&aec->nearFile, "aec_near", |
+ WEBRTC_AEC_DEBUG_WAV_REOPEN(&aec->nearFile, "aec_near", |
aec->instance_index, aec->debug_dump_count, process_rate); |
- ReopenWav(&aec->outFile, "aec_out", |
+ WEBRTC_AEC_DEBUG_WAV_REOPEN(&aec->outFile, "aec_out", |
aec->instance_index, aec->debug_dump_count, process_rate); |
- ReopenWav(&aec->outLinearFile, "aec_out_linear", |
+ WEBRTC_AEC_DEBUG_WAV_REOPEN(&aec->outLinearFile, "aec_out_linear", |
aec->instance_index, aec->debug_dump_count, process_rate); |
} |
+ |
+ WEBRTC_AEC_DEBUG_RAW_OPEN(&aec->e_fft_file, |
+ "aec_eFFT", |
Andrew MacDonald
2015/08/10 15:25:54
nit: "aec_efft" or "aec_e_fft"
peah-webrtc
2015/08/12 20:25:51
Done.
|
+ aec->debug_dump_count); |
+ |
++aec->debug_dump_count; |
#endif |
aec->system_delay = 0; |