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