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 extern "C" { | 14 extern "C" { |
15 #include "webrtc/common_audio/ring_buffer.h" | 15 #include "webrtc/common_audio/ring_buffer.h" |
16 } | 16 } |
17 #include "webrtc/common_audio/wav_file.h" | 17 #include "webrtc/common_audio/wav_file.h" |
18 #include "webrtc/modules/audio_processing/aec/aec_common.h" | 18 #include "webrtc/modules/audio_processing/aec/aec_common.h" |
19 #include "webrtc/modules/audio_processing/aec/aec_core.h" | 19 #include "webrtc/modules/audio_processing/aec/aec_core.h" |
| 20 #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h" |
20 #include "webrtc/typedefs.h" | 21 #include "webrtc/typedefs.h" |
21 | 22 |
22 namespace webrtc { | 23 namespace webrtc { |
23 | 24 |
24 // Number of partitions for the extended filter mode. The first one is an enum | 25 // Number of partitions for the extended filter mode. The first one is an enum |
25 // to be used in array declarations, as it represents the maximum filter length. | 26 // to be used in array declarations, as it represents the maximum filter length. |
26 enum { kExtendedNumPartitions = 32 }; | 27 enum { kExtendedNumPartitions = 32 }; |
27 static const int kNormalNumPartitions = 12; | 28 static const int kNormalNumPartitions = 12; |
28 | 29 |
29 // Delay estimator constants, used for logging and delay compensation if | 30 // Delay estimator constants, used for logging and delay compensation if |
30 // if reported delays are disabled. | 31 // if reported delays are disabled. |
31 enum { kLookaheadBlocks = 15 }; | 32 enum { kLookaheadBlocks = 15 }; |
32 enum { | 33 enum { |
33 // 500 ms for 16 kHz which is equivalent with the limit of reported delays. | 34 // 500 ms for 16 kHz which is equivalent with the limit of reported delays. |
34 kHistorySizeBlocks = 125 | 35 kHistorySizeBlocks = 125 |
35 }; | 36 }; |
36 | 37 |
37 // Extended filter adaptation parameters. | 38 // Extended filter adaptation parameters. |
38 // TODO(ajm): No narrowband tuning yet. | 39 // TODO(ajm): No narrowband tuning yet. |
39 static const float kExtendedMu = 0.4f; | 40 static const float kExtendedMu = 0.4f; |
40 static const float kExtendedErrorThreshold = 1.0e-6f; | 41 static const float kExtendedErrorThreshold = 1.0e-6f; |
41 | 42 |
42 typedef struct PowerLevel { | 43 typedef struct PowerLevel { |
43 float sfrsum; | 44 PowerLevel(); |
44 int sfrcounter; | 45 |
45 float framelevel; | 46 BlockMeanCalculator framelevel; |
46 float frsum; | 47 BlockMeanCalculator averagelevel; |
47 int frcounter; | |
48 float minlevel; | 48 float minlevel; |
49 float averagelevel; | |
50 } PowerLevel; | 49 } PowerLevel; |
51 | 50 |
52 struct AecCore { | 51 struct AecCore { |
| 52 AecCore(); |
| 53 |
53 int farBufWritePos, farBufReadPos; | 54 int farBufWritePos, farBufReadPos; |
54 | 55 |
55 int knownDelay; | 56 int knownDelay; |
56 int inSamples, outSamples; | 57 int inSamples, outSamples; |
57 int delayEstCtr; | 58 int delayEstCtr; |
58 | 59 |
59 RingBuffer* nearFrBuf; | 60 RingBuffer* nearFrBuf; |
60 RingBuffer* outFrBuf; | 61 RingBuffer* outFrBuf; |
61 | 62 |
62 RingBuffer* nearFrBufH[NUM_HIGH_BANDS_MAX]; | 63 RingBuffer* nearFrBufH[NUM_HIGH_BANDS_MAX]; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 typedef void (*WebRtcAecStoreAsComplex)(const float* data, | 226 typedef void (*WebRtcAecStoreAsComplex)(const float* data, |
226 float data_complex[2][PART_LEN1]); | 227 float data_complex[2][PART_LEN1]); |
227 extern WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; | 228 extern WebRtcAecStoreAsComplex WebRtcAec_StoreAsComplex; |
228 | 229 |
229 typedef void (*WebRtcAecWindowData)(float* x_windowed, const float* x); | 230 typedef void (*WebRtcAecWindowData)(float* x_windowed, const float* x); |
230 extern WebRtcAecWindowData WebRtcAec_WindowData; | 231 extern WebRtcAecWindowData WebRtcAec_WindowData; |
231 | 232 |
232 } // namespace webrtc | 233 } // namespace webrtc |
233 | 234 |
234 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ | 235 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_INTERNAL_H_ |
OLD | NEW |