OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ |
13 | 13 |
| 14 #include <memory> |
| 15 |
14 extern "C" { | 16 extern "C" { |
15 #include "webrtc/common_audio/ring_buffer.h" | 17 #include "webrtc/common_audio/ring_buffer.h" |
16 } | 18 } |
17 #include "webrtc/common_audio/wav_file.h" | 19 #include "webrtc/common_audio/wav_file.h" |
18 #include "webrtc/modules/audio_processing/aec/aec_common.h" | 20 #include "webrtc/modules/audio_processing/aec/aec_common.h" |
19 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 21 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
| 22 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
20 #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h" | 23 #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h" |
21 #include "webrtc/typedefs.h" | 24 #include "webrtc/typedefs.h" |
22 | 25 |
23 namespace webrtc { | 26 namespace webrtc { |
24 | 27 |
25 // Number of partitions for the extended filter mode. The first one is an enum | 28 // Number of partitions for the extended filter mode. The first one is an enum |
26 // to be used in array declarations, as it represents the maximum filter length. | 29 // to be used in array declarations, as it represents the maximum filter length. |
27 enum { kExtendedNumPartitions = 32 }; | 30 enum { kExtendedNumPartitions = 32 }; |
28 static const int kNormalNumPartitions = 12; | 31 static const int kNormalNumPartitions = 12; |
29 | 32 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 void Clear(); | 65 void Clear(); |
63 | 66 |
64 size_t count_; | 67 size_t count_; |
65 size_t occurrence_; | 68 size_t occurrence_; |
66 float fraction_; | 69 float fraction_; |
67 | 70 |
68 RTC_DISALLOW_COPY_AND_ASSIGN(DivergentFilterFraction); | 71 RTC_DISALLOW_COPY_AND_ASSIGN(DivergentFilterFraction); |
69 }; | 72 }; |
70 | 73 |
71 struct AecCore { | 74 struct AecCore { |
72 AecCore(); | 75 explicit AecCore(int instance_index); |
| 76 ~AecCore(); |
| 77 |
| 78 std::unique_ptr<ApmDataDumper> data_dumper; |
73 | 79 |
74 int farBufWritePos, farBufReadPos; | 80 int farBufWritePos, farBufReadPos; |
75 | 81 |
76 int knownDelay; | 82 int knownDelay; |
77 int inSamples, outSamples; | 83 int inSamples, outSamples; |
78 int delayEstCtr; | 84 int delayEstCtr; |
79 | 85 |
80 RingBuffer* nearFrBuf; | 86 RingBuffer* nearFrBuf; |
81 RingBuffer* outFrBuf; | 87 RingBuffer* outFrBuf; |
82 | 88 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // 1 = next generation aec mode enabled, 0 = disabled. | 180 // 1 = next generation aec mode enabled, 0 = disabled. |
175 int aec3_enabled; | 181 int aec3_enabled; |
176 bool refined_adaptive_filter_enabled; | 182 bool refined_adaptive_filter_enabled; |
177 | 183 |
178 // Runtime selection of number of filter partitions. | 184 // Runtime selection of number of filter partitions. |
179 int num_partitions; | 185 int num_partitions; |
180 | 186 |
181 // Flag that extreme filter divergence has been detected by the Echo | 187 // Flag that extreme filter divergence has been detected by the Echo |
182 // Suppressor. | 188 // Suppressor. |
183 int extreme_filter_divergence; | 189 int extreme_filter_divergence; |
184 | |
185 #ifdef WEBRTC_AEC_DEBUG_DUMP | |
186 // Sequence number of this AEC instance, so that different instances can | |
187 // choose different dump file names. | |
188 int instance_index; | |
189 | |
190 // Number of times we've restarted dumping; used to pick new dump file names | |
191 // each time. | |
192 int debug_dump_count; | |
193 | |
194 rtc_WavWriter* farFile; | |
195 rtc_WavWriter* nearFile; | |
196 rtc_WavWriter* outFile; | |
197 rtc_WavWriter* outLinearFile; | |
198 FILE* e_fft_file; | |
199 #endif | |
200 }; | 190 }; |
201 | 191 |
202 typedef void (*WebRtcAecFilterFar)( | 192 typedef void (*WebRtcAecFilterFar)( |
203 int num_partitions, | 193 int num_partitions, |
204 int x_fft_buf_block_pos, | 194 int x_fft_buf_block_pos, |
205 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], | 195 float x_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
206 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1], | 196 float h_fft_buf[2][kExtendedNumPartitions * PART_LEN1], |
207 float y_fft[2][PART_LEN1]); | 197 float y_fft[2][PART_LEN1]); |
208 extern WebRtcAecFilterFar WebRtcAec_FilterFar; | 198 extern WebRtcAecFilterFar WebRtcAec_FilterFar; |
209 typedef void (*WebRtcAecScaleErrorSignal)(float mu, | 199 typedef void (*WebRtcAecScaleErrorSignal)(float mu, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 typedef void (*WebRtcAecStoreAsComplex)(const float* data, | 237 typedef void (*WebRtcAecStoreAsComplex)(const float* data, |
248 float data_complex[2][PART_LEN1]); | 238 float data_complex[2][PART_LEN1]); |
249 extern WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; | 239 extern WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; |
250 | 240 |
251 typedef void (*WebRtcAecWindowData)(float* x_windowed, const float* x); | 241 typedef void (*WebRtcAecWindowData)(float* x_windowed, const float* x); |
252 extern WebRtcAecWindowData WebRtcAec_WindowData; | 242 extern WebRtcAecWindowData WebRtcAec_WindowData; |
253 | 243 |
254 } // namespace webrtc | 244 } // namespace webrtc |
255 | 245 |
256 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ | 246 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ |
OLD | NEW |