OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 /* | 11 /* |
12 * Specifies the interface for the AEC core. | 12 * Specifies the interface for the AEC core. |
13 */ | 13 */ |
14 | 14 |
15 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_ | 15 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_ |
16 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_ | 16 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_ |
17 | 17 |
18 #include <stddef.h> | 18 #include <stddef.h> |
19 | 19 |
20 #include "webrtc/typedefs.h" | 20 #include "webrtc/typedefs.h" |
21 | 21 |
22 #define FRAME_LEN 80 | 22 #define FRAME_LEN 80 |
23 #define PART_LEN 64 // Length of partition | 23 #define PART_LEN 64 // Length of partition |
24 #define PART_LEN1 (PART_LEN + 1) // Unique fft coefficients | 24 #define PART_LEN1 (PART_LEN + 1) // Unique fft coefficients |
25 #define PART_LEN2 (PART_LEN * 2) // Length of partition * 2 | 25 #define PART_LEN2 (PART_LEN * 2) // Length of partition * 2 |
26 #define NUM_HIGH_BANDS_MAX 2 // Max number of high bands | 26 #define NUM_HIGH_BANDS_MAX 2 // Max number of high bands |
27 | 27 |
28 typedef float complex_t[2]; | 28 typedef float complex_t[2]; |
29 // For performance reasons, some arrays of complex numbers are replaced by twice | 29 // For performance reasons, some arrays of complex numbers are replaced by twice |
30 // as long arrays of float, all the real parts followed by all the imaginary | 30 // as long arrays of float, all the real parts followed by all the imaginary |
31 // ones (complex_t[SIZE] -> float[2][SIZE]). This allows SIMD optimizations and | 31 // ones (complex_t[SIZE] -> float[2][SIZE]). This allows SIMD optimizations and |
32 // is better than two arrays (one for the real parts and one for the imaginary | 32 // is better than two arrays (one for the real parts and one for the imaginary |
33 // parts) as this other way would require two pointers instead of one and cause | 33 // parts) as this other way would require two pointers instead of one and cause |
34 // extra register spilling. This also allows the offsets to be calculated at | 34 // extra register spilling. This also allows the offsets to be calculated at |
35 // compile time. | 35 // compile time. |
36 | 36 |
37 // Metrics | 37 // Metrics |
38 enum { | 38 enum { kOffsetLevel = -100 }; |
39 kOffsetLevel = -100 | |
40 }; | |
41 | 39 |
42 typedef struct Stats { | 40 typedef struct Stats { |
43 float instant; | 41 float instant; |
44 float average; | 42 float average; |
45 float min; | 43 float min; |
46 float max; | 44 float max; |
47 float sum; | 45 float sum; |
48 float hisum; | 46 float hisum; |
49 float himean; | 47 float himean; |
50 int counter; | 48 int counter; |
(...skipping 25 matching lines...) Expand all Loading... |
76 // Returns the number of elements moved, and adjusts |system_delay| by the | 74 // Returns the number of elements moved, and adjusts |system_delay| by the |
77 // corresponding amount in ms. | 75 // corresponding amount in ms. |
78 int WebRtcAec_MoveFarReadPtr(AecCore* aec, int elements); | 76 int WebRtcAec_MoveFarReadPtr(AecCore* aec, int elements); |
79 | 77 |
80 // Calculates the median, standard deviation and amount of poor values among the | 78 // Calculates the median, standard deviation and amount of poor values among the |
81 // delay estimates aggregated up to the first call to the function. After that | 79 // delay estimates aggregated up to the first call to the function. After that |
82 // first call the metrics are aggregated and updated every second. With poor | 80 // first call the metrics are aggregated and updated every second. With poor |
83 // values we mean values that most likely will cause the AEC to perform poorly. | 81 // values we mean values that most likely will cause the AEC to perform poorly. |
84 // TODO(bjornv): Consider changing tests and tools to handle constant | 82 // TODO(bjornv): Consider changing tests and tools to handle constant |
85 // constant aggregation window throughout the session instead. | 83 // constant aggregation window throughout the session instead. |
86 int WebRtcAec_GetDelayMetricsCore(AecCore* self, int* median, int* std, | 84 int WebRtcAec_GetDelayMetricsCore(AecCore* self, |
| 85 int* median, |
| 86 int* std, |
87 float* fraction_poor_delays); | 87 float* fraction_poor_delays); |
88 | 88 |
89 // Returns the echo state (1: echo, 0: no echo). | 89 // Returns the echo state (1: echo, 0: no echo). |
90 int WebRtcAec_echo_state(AecCore* self); | 90 int WebRtcAec_echo_state(AecCore* self); |
91 | 91 |
92 // Gets statistics of the echo metrics ERL, ERLE, A_NLP. | 92 // Gets statistics of the echo metrics ERL, ERLE, A_NLP. |
93 void WebRtcAec_GetEchoStats(AecCore* self, | 93 void WebRtcAec_GetEchoStats(AecCore* self, |
94 Stats* erl, | 94 Stats* erl, |
95 Stats* erle, | 95 Stats* erle, |
96 Stats* a_nlp); | 96 Stats* a_nlp); |
(...skipping 23 matching lines...) Expand all Loading... |
120 // Returns the current |system_delay|, i.e., the buffered difference between | 120 // Returns the current |system_delay|, i.e., the buffered difference between |
121 // far-end and near-end. | 121 // far-end and near-end. |
122 int WebRtcAec_system_delay(AecCore* self); | 122 int WebRtcAec_system_delay(AecCore* self); |
123 | 123 |
124 // Sets the |system_delay| to |value|. Note that if the value is changed | 124 // Sets the |system_delay| to |value|. Note that if the value is changed |
125 // improperly, there can be a performance regression. So it should be used with | 125 // improperly, there can be a performance regression. So it should be used with |
126 // care. | 126 // care. |
127 void WebRtcAec_SetSystemDelay(AecCore* self, int delay); | 127 void WebRtcAec_SetSystemDelay(AecCore* self, int delay); |
128 | 128 |
129 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_ | 129 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_AEC_CORE_H_ |
OLD | NEW |