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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 EXPECT_TRUE(test::BitExactFrame( | 126 EXPECT_TRUE(test::BitExactFrame( |
130 capture_config.num_frames(), capture_config.num_channels(), | 127 capture_config.num_frames(), capture_config.num_channels(), |
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. This is tracked in the |
| 137 // issue https://bugs.chromium.org/p/webrtc/issues/detail?id=5711. |
140 | 138 |
| 139 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 140 defined(WEBRTC_ANDROID)) |
141 TEST(EchoCancellationBitExactnessTest, | 141 TEST(EchoCancellationBitExactnessTest, |
142 Mono8kHz_HighLevel_NoDrift_StreamDelay0) { | 142 Mono8kHz_HighLevel_NoDrift_StreamDelay0) { |
| 143 #else |
| 144 TEST(EchoCancellationBitExactnessTest, |
| 145 DISABLED_Mono8kHz_HighLevel_NoDrift_StreamDelay0) { |
| 146 #endif |
143 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f}; | 147 const float kOutputReference[] = {-0.006622f, -0.002747f, 0.001587f}; |
144 RunBitexactnessTest(8000, 1, 0, false, 0, | 148 RunBitexactnessTest(8000, 1, 0, false, 0, |
145 EchoCancellation::SuppressionLevel::kHighSuppression, | 149 EchoCancellation::SuppressionLevel::kHighSuppression, |
146 kStreamHasEchoReference, kOutputReference); | 150 kStreamHasEchoReference, kOutputReference); |
147 } | 151 } |
148 | 152 |
| 153 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 154 defined(WEBRTC_ANDROID)) |
149 TEST(EchoCancellationBitExactnessTest, | 155 TEST(EchoCancellationBitExactnessTest, |
150 Mono16kHz_HighLevel_NoDrift_StreamDelay0) { | 156 Mono16kHz_HighLevel_NoDrift_StreamDelay0) { |
| 157 #else |
| 158 TEST(EchoCancellationBitExactnessTest, |
| 159 DISABLED_Mono16kHz_HighLevel_NoDrift_StreamDelay0) { |
| 160 #endif |
151 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 161 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
152 RunBitexactnessTest(16000, 1, 0, false, 0, | 162 RunBitexactnessTest(16000, 1, 0, false, 0, |
153 EchoCancellation::SuppressionLevel::kHighSuppression, | 163 EchoCancellation::SuppressionLevel::kHighSuppression, |
154 kStreamHasEchoReference, kOutputReference); | 164 kStreamHasEchoReference, kOutputReference); |
155 } | 165 } |
156 | 166 |
| 167 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 168 defined(WEBRTC_ANDROID)) |
157 TEST(EchoCancellationBitExactnessTest, | 169 TEST(EchoCancellationBitExactnessTest, |
158 Mono32kHz_HighLevel_NoDrift_StreamDelay0) { | 170 Mono32kHz_HighLevel_NoDrift_StreamDelay0) { |
| 171 #else |
| 172 TEST(EchoCancellationBitExactnessTest, |
| 173 DISABLED_Mono32kHz_HighLevel_NoDrift_StreamDelay0) { |
| 174 #endif |
159 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f}; | 175 const float kOutputReference[] = {-0.010162f, -0.009155f, -0.008301f}; |
160 RunBitexactnessTest(32000, 1, 0, false, 0, | 176 RunBitexactnessTest(32000, 1, 0, false, 0, |
161 EchoCancellation::SuppressionLevel::kHighSuppression, | 177 EchoCancellation::SuppressionLevel::kHighSuppression, |
162 kStreamHasEchoReference, kOutputReference); | 178 kStreamHasEchoReference, kOutputReference); |
163 } | 179 } |
164 | 180 |
| 181 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 182 defined(WEBRTC_ANDROID)) |
165 TEST(EchoCancellationBitExactnessTest, | 183 TEST(EchoCancellationBitExactnessTest, |
166 Mono48kHz_HighLevel_NoDrift_StreamDelay0) { | 184 Mono48kHz_HighLevel_NoDrift_StreamDelay0) { |
| 185 #else |
| 186 TEST(EchoCancellationBitExactnessTest, |
| 187 DISABLED_Mono48kHz_HighLevel_NoDrift_StreamDelay0) { |
| 188 #endif |
167 const float kOutputReference[] = {-0.009554f, -0.009857f, -0.009868f}; | 189 const float kOutputReference[] = {-0.009554f, -0.009857f, -0.009868f}; |
168 RunBitexactnessTest(48000, 1, 0, false, 0, | 190 RunBitexactnessTest(48000, 1, 0, false, 0, |
169 EchoCancellation::SuppressionLevel::kHighSuppression, | 191 EchoCancellation::SuppressionLevel::kHighSuppression, |
170 kStreamHasEchoReference, kOutputReference); | 192 kStreamHasEchoReference, kOutputReference); |
171 } | 193 } |
172 | 194 |
| 195 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 196 defined(WEBRTC_ANDROID)) |
173 TEST(EchoCancellationBitExactnessTest, | 197 TEST(EchoCancellationBitExactnessTest, |
174 Mono16kHz_LowLevel_NoDrift_StreamDelay0) { | 198 Mono16kHz_LowLevel_NoDrift_StreamDelay0) { |
| 199 #else |
| 200 TEST(EchoCancellationBitExactnessTest, |
| 201 DISABLED_Mono16kHz_LowLevel_NoDrift_StreamDelay0) { |
| 202 #endif |
175 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 203 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
176 RunBitexactnessTest(16000, 1, 0, false, 0, | 204 RunBitexactnessTest(16000, 1, 0, false, 0, |
177 EchoCancellation::SuppressionLevel::kLowSuppression, | 205 EchoCancellation::SuppressionLevel::kLowSuppression, |
178 kStreamHasEchoReference, kOutputReference); | 206 kStreamHasEchoReference, kOutputReference); |
179 } | 207 } |
180 | 208 |
| 209 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 210 defined(WEBRTC_ANDROID)) |
181 TEST(EchoCancellationBitExactnessTest, | 211 TEST(EchoCancellationBitExactnessTest, |
182 Mono16kHz_ModerateLevel_NoDrift_StreamDelay0) { | 212 Mono16kHz_ModerateLevel_NoDrift_StreamDelay0) { |
| 213 #else |
| 214 TEST(EchoCancellationBitExactnessTest, |
| 215 DISABLED_Mono16kHz_ModerateLevel_NoDrift_StreamDelay0) { |
| 216 #endif |
183 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 217 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
184 RunBitexactnessTest(16000, 1, 0, false, 0, | 218 RunBitexactnessTest(16000, 1, 0, false, 0, |
185 EchoCancellation::SuppressionLevel::kModerateSuppression, | 219 EchoCancellation::SuppressionLevel::kModerateSuppression, |
186 kStreamHasEchoReference, kOutputReference); | 220 kStreamHasEchoReference, kOutputReference); |
187 } | 221 } |
188 | 222 |
| 223 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 224 defined(WEBRTC_ANDROID)) |
189 TEST(EchoCancellationBitExactnessTest, | 225 TEST(EchoCancellationBitExactnessTest, |
190 Mono16kHz_HighLevel_NoDrift_StreamDelay10) { | 226 Mono16kHz_HighLevel_NoDrift_StreamDelay10) { |
| 227 #else |
| 228 TEST(EchoCancellationBitExactnessTest, |
| 229 DISABLED_Mono16kHz_HighLevel_NoDrift_StreamDelay10) { |
| 230 #endif |
191 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 231 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
192 RunBitexactnessTest(16000, 1, 10, false, 0, | 232 RunBitexactnessTest(16000, 1, 10, false, 0, |
193 EchoCancellation::SuppressionLevel::kHighSuppression, | 233 EchoCancellation::SuppressionLevel::kHighSuppression, |
194 kStreamHasEchoReference, kOutputReference); | 234 kStreamHasEchoReference, kOutputReference); |
195 } | 235 } |
196 | 236 |
| 237 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 238 defined(WEBRTC_ANDROID)) |
197 TEST(EchoCancellationBitExactnessTest, | 239 TEST(EchoCancellationBitExactnessTest, |
198 Mono16kHz_HighLevel_NoDrift_StreamDelay20) { | 240 Mono16kHz_HighLevel_NoDrift_StreamDelay20) { |
| 241 #else |
| 242 TEST(EchoCancellationBitExactnessTest, |
| 243 DISABLED_Mono16kHz_HighLevel_NoDrift_StreamDelay20) { |
| 244 #endif |
199 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 245 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
200 RunBitexactnessTest(16000, 1, 20, false, 0, | 246 RunBitexactnessTest(16000, 1, 20, false, 0, |
201 EchoCancellation::SuppressionLevel::kHighSuppression, | 247 EchoCancellation::SuppressionLevel::kHighSuppression, |
202 kStreamHasEchoReference, kOutputReference); | 248 kStreamHasEchoReference, kOutputReference); |
203 } | 249 } |
204 | 250 |
| 251 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 252 defined(WEBRTC_ANDROID)) |
205 TEST(EchoCancellationBitExactnessTest, | 253 TEST(EchoCancellationBitExactnessTest, |
206 Mono16kHz_HighLevel_Drift0_StreamDelay0) { | 254 Mono16kHz_HighLevel_Drift0_StreamDelay0) { |
| 255 #else |
| 256 TEST(EchoCancellationBitExactnessTest, |
| 257 DISABLED_Mono16kHz_HighLevel_Drift0_StreamDelay0) { |
| 258 #endif |
207 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 259 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
208 RunBitexactnessTest(16000, 1, 0, true, 0, | 260 RunBitexactnessTest(16000, 1, 0, true, 0, |
209 EchoCancellation::SuppressionLevel::kHighSuppression, | 261 EchoCancellation::SuppressionLevel::kHighSuppression, |
210 kStreamHasEchoReference, kOutputReference); | 262 kStreamHasEchoReference, kOutputReference); |
211 } | 263 } |
212 | 264 |
| 265 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 266 defined(WEBRTC_ANDROID)) |
213 TEST(EchoCancellationBitExactnessTest, | 267 TEST(EchoCancellationBitExactnessTest, |
214 Mono16kHz_HighLevel_Drift5_StreamDelay0) { | 268 Mono16kHz_HighLevel_Drift5_StreamDelay0) { |
| 269 #else |
| 270 TEST(EchoCancellationBitExactnessTest, |
| 271 DISABLED_Mono16kHz_HighLevel_Drift5_StreamDelay0) { |
| 272 #endif |
215 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; | 273 const float kOutputReference[] = {-0.006561f, -0.004608f, -0.002899f}; |
216 RunBitexactnessTest(16000, 1, 0, true, 5, | 274 RunBitexactnessTest(16000, 1, 0, true, 5, |
217 EchoCancellation::SuppressionLevel::kHighSuppression, | 275 EchoCancellation::SuppressionLevel::kHighSuppression, |
218 kStreamHasEchoReference, kOutputReference); | 276 kStreamHasEchoReference, kOutputReference); |
219 } | 277 } |
220 | 278 |
| 279 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 280 defined(WEBRTC_ANDROID)) |
221 TEST(EchoCancellationBitExactnessTest, | 281 TEST(EchoCancellationBitExactnessTest, |
222 Stereo8kHz_HighLevel_NoDrift_StreamDelay0) { | 282 Stereo8kHz_HighLevel_NoDrift_StreamDelay0) { |
| 283 #else |
| 284 TEST(EchoCancellationBitExactnessTest, |
| 285 DISABLED_Stereo8kHz_HighLevel_NoDrift_StreamDelay0) { |
| 286 #endif |
223 const float kOutputReference[] = {-0.027359f, -0.015823f, -0.028488f, | 287 const float kOutputReference[] = {-0.027359f, -0.015823f, -0.028488f, |
224 -0.027359f, -0.015823f, -0.028488f}; | 288 -0.027359f, -0.015823f, -0.028488f}; |
225 RunBitexactnessTest(8000, 2, 0, false, 0, | 289 RunBitexactnessTest(8000, 2, 0, false, 0, |
226 EchoCancellation::SuppressionLevel::kHighSuppression, | 290 EchoCancellation::SuppressionLevel::kHighSuppression, |
227 kStreamHasEchoReference, kOutputReference); | 291 kStreamHasEchoReference, kOutputReference); |
228 } | 292 } |
229 | 293 |
| 294 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 295 defined(WEBRTC_ANDROID)) |
230 TEST(EchoCancellationBitExactnessTest, | 296 TEST(EchoCancellationBitExactnessTest, |
231 Stereo16kHz_HighLevel_NoDrift_StreamDelay0) { | 297 Stereo16kHz_HighLevel_NoDrift_StreamDelay0) { |
| 298 #else |
| 299 TEST(EchoCancellationBitExactnessTest, |
| 300 DISABLED_Stereo16kHz_HighLevel_NoDrift_StreamDelay0) { |
| 301 #endif |
232 const float kOutputReference[] = {-0.027298f, -0.015900f, -0.028107f, | 302 const float kOutputReference[] = {-0.027298f, -0.015900f, -0.028107f, |
233 -0.027298f, -0.015900f, -0.028107f}; | 303 -0.027298f, -0.015900f, -0.028107f}; |
234 RunBitexactnessTest(16000, 2, 0, false, 0, | 304 RunBitexactnessTest(16000, 2, 0, false, 0, |
235 EchoCancellation::SuppressionLevel::kHighSuppression, | 305 EchoCancellation::SuppressionLevel::kHighSuppression, |
236 kStreamHasEchoReference, kOutputReference); | 306 kStreamHasEchoReference, kOutputReference); |
237 } | 307 } |
238 | 308 |
| 309 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 310 defined(WEBRTC_ANDROID)) |
239 TEST(EchoCancellationBitExactnessTest, | 311 TEST(EchoCancellationBitExactnessTest, |
240 Stereo32kHz_HighLevel_NoDrift_StreamDelay0) { | 312 Stereo32kHz_HighLevel_NoDrift_StreamDelay0) { |
| 313 #else |
| 314 TEST(EchoCancellationBitExactnessTest, |
| 315 DISABLED_Stereo32kHz_HighLevel_NoDrift_StreamDelay0) { |
| 316 #endif |
241 const float kOutputReference[] = {0.004547f, -0.004456f, -0.000946f, | 317 const float kOutputReference[] = {0.004547f, -0.004456f, -0.000946f, |
242 0.004547f, -0.004456f, -0.000946f}; | 318 0.004547f, -0.004456f, -0.000946f}; |
243 RunBitexactnessTest(32000, 2, 0, false, 0, | 319 RunBitexactnessTest(32000, 2, 0, false, 0, |
244 EchoCancellation::SuppressionLevel::kHighSuppression, | 320 EchoCancellation::SuppressionLevel::kHighSuppression, |
245 kStreamHasEchoReference, kOutputReference); | 321 kStreamHasEchoReference, kOutputReference); |
246 } | 322 } |
247 | 323 |
| 324 #if !(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM) || \ |
| 325 defined(WEBRTC_ANDROID)) |
248 TEST(EchoCancellationBitExactnessTest, | 326 TEST(EchoCancellationBitExactnessTest, |
249 Stereo48kHz_HighLevel_NoDrift_StreamDelay0) { | 327 Stereo48kHz_HighLevel_NoDrift_StreamDelay0) { |
| 328 #else |
| 329 TEST(EchoCancellationBitExactnessTest, |
| 330 DISABLED_Stereo48kHz_HighLevel_NoDrift_StreamDelay0) { |
| 331 #endif |
250 const float kOutputReference[] = {-0.003500f, -0.001894f, -0.003176f, | 332 const float kOutputReference[] = {-0.003500f, -0.001894f, -0.003176f, |
251 -0.003500f, -0.001894f, -0.003176f}; | 333 -0.003500f, -0.001894f, -0.003176f}; |
252 RunBitexactnessTest(48000, 2, 0, false, 0, | 334 RunBitexactnessTest(48000, 2, 0, false, 0, |
253 EchoCancellation::SuppressionLevel::kHighSuppression, | 335 EchoCancellation::SuppressionLevel::kHighSuppression, |
254 kStreamHasEchoReference, kOutputReference); | 336 kStreamHasEchoReference, kOutputReference); |
255 } | 337 } |
256 | 338 |
257 } // namespace webrtc | 339 } // namespace webrtc |
258 | |
259 #endif | |
OLD | NEW |