OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 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 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "webrtc/base/array_view.h" | 13 #include "webrtc/base/array_view.h" |
14 #include "webrtc/modules/audio_processing/audio_buffer.h" | 14 #include "webrtc/modules/audio_processing/audio_buffer.h" |
15 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" | 15 #include "webrtc/modules/audio_processing/echo_cancellation_impl.h" |
16 #include "webrtc/modules/audio_processing/test/audio_buffer_tools.h" | 16 #include "webrtc/modules/audio_processing/test/audio_buffer_tools.h" |
17 #include "webrtc/modules/audio_processing/test/bitexactness_tools.h" | 17 #include "webrtc/modules/audio_processing/test/bitexactness_tools.h" |
18 | 18 |
19 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
20 defined(WEBRTC_ANDROID)) | |
21 | |
22 namespace webrtc { | 19 namespace webrtc { |
23 namespace { | 20 namespace { |
24 | 21 |
25 const int kNumFramesToProcess = 100; | 22 const int kNumFramesToProcess = 100; |
26 | 23 |
27 void SetupComponent(int sample_rate_hz, | 24 void SetupComponent(int sample_rate_hz, |
28 EchoCancellation::SuppressionLevel suppression_level, | 25 EchoCancellation::SuppressionLevel suppression_level, |
29 bool drift_compensation_enabled, | 26 bool drift_compensation_enabled, |
30 EchoCancellationImpl* echo_canceller) { | 27 EchoCancellationImpl* echo_canceller) { |
31 echo_canceller->Initialize(sample_rate_hz, 1, 1, 1); | 28 echo_canceller->Initialize(sample_rate_hz, 1, 1, 1); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 output_reference, capture_output, kTolerance)); | 128 output_reference, capture_output, kTolerance)); |
132 } | 129 } |
133 | 130 |
134 const bool kStreamHasEchoReference = false; | 131 const bool kStreamHasEchoReference = false; |
135 | 132 |
136 } // namespace | 133 } // namespace |
137 | 134 |
138 // TODO(peah): Activate all these tests for ARM and ARM64 once the issue on the | 135 // TODO(peah): Activate all these tests for ARM and ARM64 once the issue on the |
139 // Chromium ARM and ARM64 boths have been identified. | 136 // Chromium ARM and ARM64 boths have been identified. |
140 | 137 |
138 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
hlundin-webrtc
2016/03/30 08:27:28
Avoid the verbose repetition by doing
#define DISA
peah-webrtc
2016/03/30 12:31:24
Nice! But it seems like the there is a compiler wa
hlundin-webrtc
2016/03/30 12:50:03
OK. It was worth a try.
| |
139 defined(WEBRTC_ANDROID)) | |
141 TEST(EchoCancellationBitExactnessTest, | 140 TEST(EchoCancellationBitExactnessTest, |
142 Mono8kHz_HighLevel_NoDrift_StreamDelay0) { | 141 Mono8kHz_HighLevel_NoDrift_StreamDelay0) { |
142 #else | |
143 TEST(EchoCancellationBitExactnessTest, | |
144 DISABLED_Mono8kHz_HighLevel_NoDrift_StreamDelay0) { | |
145 #endif | |
143 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f}; | 146 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f}; |
144 RunBitexactnessTest(8000, 1, 0, false, 0, | 147 RunBitexactnessTest(8000, 1, 0, false, 0, |
145 EchoCancellation::SuppressionLevel::kHighSuppression, | 148 EchoCancellation::SuppressionLevel::kHighSuppression, |
146 kStreamHasEchoReference, kOutputReference); | 149 kStreamHasEchoReference, kOutputReference); |
147 } | 150 } |
148 | 151 |
152 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
153 defined(WEBRTC_ANDROID)) | |
149 TEST(EchoCancellationBitExactnessTest, | 154 TEST(EchoCancellationBitExactnessTest, |
150 Mono16kHz_HighLevel_NoDrift_StreamDelay0) { | 155 Mono16kHz_HighLevel_NoDrift_StreamDelay0) { |
156 #else | |
157 TEST(EchoCancellationBitExactnessTest, | |
158 DISABLED_Mono16kHz_HighLevel_NoDrift_StreamDelay0) { | |
159 #endif | |
151 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 160 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
152 RunBitexactnessTest(16000, 1, 0, false, 0, | 161 RunBitexactnessTest(16000, 1, 0, false, 0, |
153 EchoCancellation::SuppressionLevel::kHighSuppression, | 162 EchoCancellation::SuppressionLevel::kHighSuppression, |
154 kStreamHasEchoReference, kOutputReference); | 163 kStreamHasEchoReference, kOutputReference); |
155 } | 164 } |
156 | 165 |
166 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
167 defined(WEBRTC_ANDROID)) | |
157 TEST(EchoCancellationBitExactnessTest, | 168 TEST(EchoCancellationBitExactnessTest, |
158 Mono32kHz_HighLevel_NoDrift_StreamDelay0) { | 169 Mono32kHz_HighLevel_NoDrift_StreamDelay0) { |
170 #else | |
171 TEST(EchoCancellationBitExactnessTest, | |
172 DISABLED_Mono32kHz_HighLevel_NoDrift_StreamDelay0) { | |
173 #endif | |
159 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f}; | 174 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f}; |
160 RunBitexactnessTest(32000, 1, 0, false, 0, | 175 RunBitexactnessTest(32000, 1, 0, false, 0, |
161 EchoCancellation::SuppressionLevel::kHighSuppression, | 176 EchoCancellation::SuppressionLevel::kHighSuppression, |
162 kStreamHasEchoReference, kOutputReference); | 177 kStreamHasEchoReference, kOutputReference); |
163 } | 178 } |
164 | 179 |
180 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
181 defined(WEBRTC_ANDROID)) | |
165 TEST(EchoCancellationBitExactnessTest, | 182 TEST(EchoCancellationBitExactnessTest, |
166 Mono48kHz_HighLevel_NoDrift_StreamDelay0) { | 183 Mono48kHz_HighLevel_NoDrift_StreamDelay0) { |
184 #else | |
185 TEST(EchoCancellationBitExactnessTest, | |
186 DISABLED_Mono48kHz_HighLevel_NoDrift_StreamDelay0) { | |
187 #endif | |
167 const float kOutputReference[] = {-0.009554f, -0.009857f, -0.009868f}; | 188 const float kOutputReference[] = {-0.009554f, -0.009857f, -0.009868f}; |
168 RunBitexactnessTest(48000, 1, 0, false, 0, | 189 RunBitexactnessTest(48000, 1, 0, false, 0, |
169 EchoCancellation::SuppressionLevel::kHighSuppression, | 190 EchoCancellation::SuppressionLevel::kHighSuppression, |
170 kStreamHasEchoReference, kOutputReference); | 191 kStreamHasEchoReference, kOutputReference); |
171 } | 192 } |
172 | 193 |
194 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
195 defined(WEBRTC_ANDROID)) | |
173 TEST(EchoCancellationBitExactnessTest, | 196 TEST(EchoCancellationBitExactnessTest, |
174 Mono16kHz_LowLevel_NoDrift_StreamDelay0) { | 197 Mono16kHz_LowLevel_NoDrift_StreamDelay0) { |
198 #else | |
199 TEST(EchoCancellationBitExactnessTest, | |
200 DISABLED_Mono16kHz_LowLevel_NoDrift_StreamDelay0) { | |
201 #endif | |
175 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 202 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
176 RunBitexactnessTest(16000, 1, 0, false, 0, | 203 RunBitexactnessTest(16000, 1, 0, false, 0, |
177 EchoCancellation::SuppressionLevel::kLowSuppression, | 204 EchoCancellation::SuppressionLevel::kLowSuppression, |
178 kStreamHasEchoReference, kOutputReference); | 205 kStreamHasEchoReference, kOutputReference); |
179 } | 206 } |
180 | 207 |
208 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
209 defined(WEBRTC_ANDROID)) | |
181 TEST(EchoCancellationBitExactnessTest, | 210 TEST(EchoCancellationBitExactnessTest, |
182 Mono16kHz_ModerateLevel_NoDrift_StreamDelay0) { | 211 Mono16kHz_ModerateLevel_NoDrift_StreamDelay0) { |
212 #else | |
213 TEST(EchoCancellationBitExactnessTest, | |
214 DISABLED_Mono16kHz_ModerateLevel_NoDrift_StreamDelay0) { | |
215 #endif | |
183 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 216 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
184 RunBitexactnessTest(16000, 1, 0, false, 0, | 217 RunBitexactnessTest(16000, 1, 0, false, 0, |
185 EchoCancellation::SuppressionLevel::kModerateSuppression, | 218 EchoCancellation::SuppressionLevel::kModerateSuppression, |
186 kStreamHasEchoReference, kOutputReference); | 219 kStreamHasEchoReference, kOutputReference); |
187 } | 220 } |
188 | 221 |
222 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
223 defined(WEBRTC_ANDROID)) | |
189 TEST(EchoCancellationBitExactnessTest, | 224 TEST(EchoCancellationBitExactnessTest, |
190 Mono16kHz_HighLevel_NoDrift_StreamDelay10) { | 225 Mono16kHz_HighLevel_NoDrift_StreamDelay10) { |
226 #else | |
227 TEST(EchoCancellationBitExactnessTest, | |
228 DISABLED_Mono16kHz_HighLevel_NoDrift_StreamDelay10) { | |
229 #endif | |
191 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 230 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
192 RunBitexactnessTest(16000, 1, 10, false, 0, | 231 RunBitexactnessTest(16000, 1, 10, false, 0, |
193 EchoCancellation::SuppressionLevel::kHighSuppression, | 232 EchoCancellation::SuppressionLevel::kHighSuppression, |
194 kStreamHasEchoReference, kOutputReference); | 233 kStreamHasEchoReference, kOutputReference); |
195 } | 234 } |
196 | 235 |
236 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
237 defined(WEBRTC_ANDROID)) | |
197 TEST(EchoCancellationBitExactnessTest, | 238 TEST(EchoCancellationBitExactnessTest, |
198 Mono16kHz_HighLevel_NoDrift_StreamDelay20) { | 239 Mono16kHz_HighLevel_NoDrift_StreamDelay20) { |
240 #else | |
241 TEST(EchoCancellationBitExactnessTest, | |
242 DISABLED_Mono16kHz_HighLevel_NoDrift_StreamDelay20) { | |
243 #endif | |
199 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 244 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
200 RunBitexactnessTest(16000, 1, 20, false, 0, | 245 RunBitexactnessTest(16000, 1, 20, false, 0, |
201 EchoCancellation::SuppressionLevel::kHighSuppression, | 246 EchoCancellation::SuppressionLevel::kHighSuppression, |
202 kStreamHasEchoReference, kOutputReference); | 247 kStreamHasEchoReference, kOutputReference); |
203 } | 248 } |
204 | 249 |
250 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
251 defined(WEBRTC_ANDROID)) | |
205 TEST(EchoCancellationBitExactnessTest, | 252 TEST(EchoCancellationBitExactnessTest, |
206 Mono16kHz_HighLevel_Drift0_StreamDelay0) { | 253 Mono16kHz_HighLevel_Drift0_StreamDelay0) { |
254 #else | |
255 TEST(EchoCancellationBitExactnessTest, | |
256 DISABLED_Mono16kHz_HighLevel_Drift0_StreamDelay0) { | |
257 #endif | |
207 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 258 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
208 RunBitexactnessTest(16000, 1, 0, true, 0, | 259 RunBitexactnessTest(16000, 1, 0, true, 0, |
209 EchoCancellation::SuppressionLevel::kHighSuppression, | 260 EchoCancellation::SuppressionLevel::kHighSuppression, |
210 kStreamHasEchoReference, kOutputReference); | 261 kStreamHasEchoReference, kOutputReference); |
211 } | 262 } |
212 | 263 |
264 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
265 defined(WEBRTC_ANDROID)) | |
213 TEST(EchoCancellationBitExactnessTest, | 266 TEST(EchoCancellationBitExactnessTest, |
214 Mono16kHz_HighLevel_Drift5_StreamDelay0) { | 267 Mono16kHz_HighLevel_Drift5_StreamDelay0) { |
268 #else | |
269 TEST(EchoCancellationBitExactnessTest, | |
270 DISABLED_Mono16kHz_HighLevel_Drift5_StreamDelay0) { | |
271 #endif | |
215 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 272 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
216 RunBitexactnessTest(16000, 1, 0, true, 5, | 273 RunBitexactnessTest(16000, 1, 0, true, 5, |
217 EchoCancellation::SuppressionLevel::kHighSuppression, | 274 EchoCancellation::SuppressionLevel::kHighSuppression, |
218 kStreamHasEchoReference, kOutputReference); | 275 kStreamHasEchoReference, kOutputReference); |
219 } | 276 } |
220 | 277 |
278 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
279 defined(WEBRTC_ANDROID)) | |
221 TEST(EchoCancellationBitExactnessTest, | 280 TEST(EchoCancellationBitExactnessTest, |
222 Stereo8kHz_HighLevel_NoDrift_StreamDelay0) { | 281 Stereo8kHz_HighLevel_NoDrift_StreamDelay0) { |
282 #else | |
283 TEST(EchoCancellationBitExactnessTest, | |
284 DISABLED_Stereo8kHz_HighLevel_NoDrift_StreamDelay0) { | |
285 #endif | |
223 const float kOutputReference[] = {-0.027359f, -0.015823f, -0.028488f, | 286 const float kOutputReference[] = {-0.027359f, -0.015823f, -0.028488f, |
224 -0.027359f, -0.015823f, -0.028488f}; | 287 -0.027359f, -0.015823f, -0.028488f}; |
225 RunBitexactnessTest(8000, 2, 0, false, 0, | 288 RunBitexactnessTest(8000, 2, 0, false, 0, |
226 EchoCancellation::SuppressionLevel::kHighSuppression, | 289 EchoCancellation::SuppressionLevel::kHighSuppression, |
227 kStreamHasEchoReference, kOutputReference); | 290 kStreamHasEchoReference, kOutputReference); |
228 } | 291 } |
229 | 292 |
293 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
294 defined(WEBRTC_ANDROID)) | |
230 TEST(EchoCancellationBitExactnessTest, | 295 TEST(EchoCancellationBitExactnessTest, |
231 Stereo16kHz_HighLevel_NoDrift_StreamDelay0) { | 296 Stereo16kHz_HighLevel_NoDrift_StreamDelay0) { |
297 #else | |
298 TEST(EchoCancellationBitExactnessTest, | |
299 DISABLED_Stereo16kHz_HighLevel_NoDrift_StreamDelay0) { | |
300 #endif | |
232 const float kOutputReference[] = {-0.027298f, -0.015900f, -0.028107f, | 301 const float kOutputReference[] = {-0.027298f, -0.015900f, -0.028107f, |
233 -0.027298f, -0.015900f, -0.028107f}; | 302 -0.027298f, -0.015900f, -0.028107f}; |
234 RunBitexactnessTest(16000, 2, 0, false, 0, | 303 RunBitexactnessTest(16000, 2, 0, false, 0, |
235 EchoCancellation::SuppressionLevel::kHighSuppression, | 304 EchoCancellation::SuppressionLevel::kHighSuppression, |
236 kStreamHasEchoReference, kOutputReference); | 305 kStreamHasEchoReference, kOutputReference); |
237 } | 306 } |
238 | 307 |
308 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
309 defined(WEBRTC_ANDROID)) | |
239 TEST(EchoCancellationBitExactnessTest, | 310 TEST(EchoCancellationBitExactnessTest, |
240 Stereo32kHz_HighLevel_NoDrift_StreamDelay0) { | 311 Stereo32kHz_HighLevel_NoDrift_StreamDelay0) { |
312 #else | |
313 TEST(EchoCancellationBitExactnessTest, | |
314 DISABLED_Stereo32kHz_HighLevel_NoDrift_StreamDelay0) { | |
315 #endif | |
241 const float kOutputReference[] = {0.004547f, -0.004456f, -0.000946f, | 316 const float kOutputReference[] = {0.004547f, -0.004456f, -0.000946f, |
242 0.004547f, -0.004456f, -0.000946f}; | 317 0.004547f, -0.004456f, -0.000946f}; |
243 RunBitexactnessTest(32000, 2, 0, false, 0, | 318 RunBitexactnessTest(32000, 2, 0, false, 0, |
244 EchoCancellation::SuppressionLevel::kHighSuppression, | 319 EchoCancellation::SuppressionLevel::kHighSuppression, |
245 kStreamHasEchoReference, kOutputReference); | 320 kStreamHasEchoReference, kOutputReference); |
246 } | 321 } |
247 | 322 |
323 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ | |
324 defined(WEBRTC_ANDROID)) | |
248 TEST(EchoCancellationBitExactnessTest, | 325 TEST(EchoCancellationBitExactnessTest, |
249 Stereo48kHz_HighLevel_NoDrift_StreamDelay0) { | 326 Stereo48kHz_HighLevel_NoDrift_StreamDelay0) { |
327 #else | |
328 TEST(EchoCancellationBitExactnessTest, | |
329 DISABLED_Stereo48kHz_HighLevel_NoDrift_StreamDelay0) { | |
330 #endif | |
250 const float kOutputReference[] = {-0.003500f, -0.001894f, -0.003176f, | 331 const float kOutputReference[] = {-0.003500f, -0.001894f, -0.003176f, |
251 -0.003500f, -0.001894f, -0.003176f}; | 332 -0.003500f, -0.001894f, -0.003176f}; |
252 RunBitexactnessTest(48000, 2, 0, false, 0, | 333 RunBitexactnessTest(48000, 2, 0, false, 0, |
253 EchoCancellation::SuppressionLevel::kHighSuppression, | 334 EchoCancellation::SuppressionLevel::kHighSuppression, |
254 kStreamHasEchoReference, kOutputReference); | 335 kStreamHasEchoReference, kOutputReference); |
255 } | 336 } |
256 | 337 |
257 } // namespace webrtc | 338 } // namespace webrtc |
258 | |
259 #endif | |
OLD | NEW |