blob: 4dcf7d90d166c0b55bdcf69cd31e1358341d477e [file] [log] [blame]
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +00001# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +00009import("//build/config/arm.gni")
10import("//third_party/protobuf/proto_library.gni")
mbonadei9aa3f0a2017-01-24 06:58:22 -080011import("../../webrtc.gni")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000012
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000013declare_args() {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000014 # Disables the usual mode where we trust the reported system delay
15 # values the AEC receives. The corresponding define is set appropriately
16 # in the code, but it can be force-enabled here for testing.
17 aec_untrusted_delay_for_testing = false
18}
19
kjellanderb62dbbe2016-09-23 00:38:52 -070020rtc_static_library("audio_processing") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000021 sources = [
peah8df5d4f2016-02-23 14:34:59 -080022 "aec/aec_core.cc",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000023 "aec/aec_core.h",
peahe687f782016-05-09 03:57:33 -070024 "aec/aec_core_optimized_methods.h",
peah88950cf2016-03-04 00:12:40 -080025 "aec/aec_resampler.cc",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000026 "aec/aec_resampler.h",
peah8df5d4f2016-02-23 14:34:59 -080027 "aec/echo_cancellation.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010028 "aec/echo_cancellation.h",
peahd0263542017-01-03 04:20:34 -080029 "aec3/aec3_constants.h",
30 "aec3/block_framer.cc",
31 "aec3/block_framer.h",
32 "aec3/block_processor.cc",
33 "aec3/block_processor.h",
34 "aec3/cascaded_biquad_filter.cc",
35 "aec3/cascaded_biquad_filter.h",
peahe0eae3c2016-12-14 01:16:23 -080036 "aec3/echo_canceller3.cc",
37 "aec3/echo_canceller3.h",
peahd0263542017-01-03 04:20:34 -080038 "aec3/frame_blocker.cc",
39 "aec3/frame_blocker.h",
peah27045122016-04-10 22:38:14 -070040 "aecm/aecm_core.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000041 "aecm/aecm_core.h",
peah27045122016-04-10 22:38:14 -070042 "aecm/echo_control_mobile.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010043 "aecm/echo_control_mobile.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000044 "agc/agc.cc",
45 "agc/agc.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000046 "agc/agc_manager_direct.cc",
47 "agc/agc_manager_direct.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000048 "agc/gain_map_internal.h",
peahbbe42332016-06-08 06:42:02 -070049 "agc/loudness_histogram.cc",
50 "agc/loudness_histogram.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000051 "agc/utility.cc",
52 "agc/utility.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000053 "audio_buffer.cc",
54 "audio_buffer.h",
55 "audio_processing_impl.cc",
56 "audio_processing_impl.h",
aluebs4a66e4a2015-10-19 18:02:39 -070057 "beamformer/array_util.cc",
58 "beamformer/array_util.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +000059 "beamformer/complex_matrix.h",
60 "beamformer/covariance_matrix_generator.cc",
61 "beamformer/covariance_matrix_generator.h",
62 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +000063 "beamformer/nonlinear_beamformer.cc",
64 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000065 "common.h",
66 "echo_cancellation_impl.cc",
67 "echo_cancellation_impl.h",
68 "echo_control_mobile_impl.cc",
69 "echo_control_mobile_impl.h",
ivocaf27ed02016-10-28 07:04:03 -070070 "echo_detector/circular_buffer.cc",
71 "echo_detector/circular_buffer.h",
72 "echo_detector/mean_variance_estimator.cc",
73 "echo_detector/mean_variance_estimator.h",
ivoc4e477a12017-01-15 08:29:46 -080074 "echo_detector/moving_max.cc",
75 "echo_detector/moving_max.h",
ivocaf27ed02016-10-28 07:04:03 -070076 "echo_detector/normalized_covariance_estimator.cc",
77 "echo_detector/normalized_covariance_estimator.h",
peahbe615622016-02-13 16:40:47 -080078 "gain_control_for_experimental_agc.cc",
79 "gain_control_for_experimental_agc.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000080 "gain_control_impl.cc",
81 "gain_control_impl.h",
peahc19f3122016-10-07 14:54:10 -070082 "include/audio_processing.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000083 "include/audio_processing.h",
solenberg88499ec2016-09-07 07:34:41 -070084 "include/config.cc",
85 "include/config.h",
peahca4cac72016-06-29 15:26:12 -070086 "level_controller/biquad_filter.cc",
87 "level_controller/biquad_filter.h",
88 "level_controller/down_sampler.cc",
89 "level_controller/down_sampler.h",
90 "level_controller/gain_applier.cc",
91 "level_controller/gain_applier.h",
92 "level_controller/gain_selector.cc",
93 "level_controller/gain_selector.h",
peahca4cac72016-06-29 15:26:12 -070094 "level_controller/level_controller.cc",
95 "level_controller/level_controller.h",
peahc19f3122016-10-07 14:54:10 -070096 "level_controller/level_controller_constants.h",
peahca4cac72016-06-29 15:26:12 -070097 "level_controller/noise_level_estimator.cc",
98 "level_controller/noise_level_estimator.h",
99 "level_controller/noise_spectrum_estimator.cc",
100 "level_controller/noise_spectrum_estimator.h",
101 "level_controller/peak_level_estimator.cc",
102 "level_controller/peak_level_estimator.h",
103 "level_controller/saturating_gain_estimator.cc",
104 "level_controller/saturating_gain_estimator.h",
105 "level_controller/signal_classifier.cc",
106 "level_controller/signal_classifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000107 "level_estimator_impl.cc",
108 "level_estimator_impl.h",
peahb46083e2016-05-03 07:01:18 -0700109 "logging/apm_data_dumper.cc",
110 "logging/apm_data_dumper.h",
peah8271d042016-11-22 07:24:52 -0800111 "low_cut_filter.cc",
112 "low_cut_filter.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000113 "noise_suppression_impl.cc",
114 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -0800115 "render_queue_item_verifier.h",
ivoc9f4a4a02016-10-28 05:39:16 -0700116 "residual_echo_detector.cc",
117 "residual_echo_detector.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000118 "rms_level.cc",
119 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +0000120 "splitting_filter.cc",
121 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -0700122 "three_band_filter_bank.cc",
123 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000124 "transient/common.h",
125 "transient/daubechies_8_wavelet_coeffs.h",
126 "transient/dyadic_decimator.h",
127 "transient/moving_moments.cc",
128 "transient/moving_moments.h",
129 "transient/transient_detector.cc",
130 "transient/transient_detector.h",
131 "transient/transient_suppressor.cc",
132 "transient/transient_suppressor.h",
133 "transient/wpd_node.cc",
134 "transient/wpd_node.h",
135 "transient/wpd_tree.cc",
136 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000137 "typing_detection.cc",
138 "typing_detection.h",
minyue84db6fa2016-03-24 14:36:25 -0700139 "utility/block_mean_calculator.cc",
140 "utility/block_mean_calculator.h",
peahbdb7af62016-04-12 14:47:40 -0700141 "utility/delay_estimator.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000142 "utility/delay_estimator.h",
143 "utility/delay_estimator_internal.h",
peahbdb7af62016-04-12 14:47:40 -0700144 "utility/delay_estimator_wrapper.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000145 "utility/delay_estimator_wrapper.h",
peah81b92912016-10-06 06:46:20 -0700146 "utility/ooura_fft.cc",
147 "utility/ooura_fft.h",
148 "utility/ooura_fft_tables_common.h",
aluebsecf6b812015-06-25 12:28:48 -0700149 "vad/common.h",
150 "vad/gmm.cc",
151 "vad/gmm.h",
152 "vad/noise_gmm_tables.h",
153 "vad/pitch_based_vad.cc",
154 "vad/pitch_based_vad.h",
155 "vad/pitch_internal.cc",
156 "vad/pitch_internal.h",
157 "vad/pole_zero_filter.cc",
158 "vad/pole_zero_filter.h",
159 "vad/standalone_vad.cc",
160 "vad/standalone_vad.h",
161 "vad/vad_audio_proc.cc",
162 "vad/vad_audio_proc.h",
163 "vad/vad_audio_proc_internal.h",
164 "vad/vad_circular_buffer.cc",
165 "vad/vad_circular_buffer.h",
166 "vad/voice_activity_detector.cc",
167 "vad/voice_activity_detector.h",
168 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000169 "voice_detection_impl.cc",
170 "voice_detection_impl.h",
171 ]
172
173 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200174 deps = [
175 "../..:webrtc_common",
aleloi6321b492016-12-05 01:46:09 -0800176 "../../audio/utility:audio_frame_operations",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800177 "../../base:gtest_prod",
kwiberg98ab3a42015-09-30 21:54:21 -0700178 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200179 ]
kjellander7439f972016-12-05 22:47:46 -0800180 public_deps = [
181 ":audio_processing_c",
182 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000183
peahf28a3892016-09-01 08:58:21 -0700184 if (apm_debug_dump) {
185 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700186 } else {
peahf28a3892016-09-01 08:58:21 -0700187 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000188 }
189
190 if (aec_untrusted_delay_for_testing) {
191 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
192 }
193
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000194 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000195 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
196 deps += [ ":audioproc_debug_proto" ]
197 }
198
peah1bcfce52016-08-26 07:16:04 -0700199 if (rtc_enable_intelligibility_enhancer) {
200 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
201 sources += [
202 "intelligibility/intelligibility_enhancer.cc",
203 "intelligibility/intelligibility_enhancer.h",
204 "intelligibility/intelligibility_utils.cc",
205 "intelligibility/intelligibility_utils.h",
206 ]
207 } else {
208 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
209 }
210
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000211 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000212 defines += [ "WEBRTC_NS_FIXED" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000213 } else {
214 defines += [ "WEBRTC_NS_FLOAT" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000215 }
216
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000217 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000218 deps += [ ":audio_processing_sse2" ]
219 }
220
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700221 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000222 deps += [ ":audio_processing_neon" ]
223 }
224
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000225 if (current_cpu == "mipsel") {
peah27045122016-04-10 22:38:14 -0700226 sources += [ "aecm/aecm_core_mips.cc" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000227 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000228 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800229 "aec/aec_core_mips.cc",
peah81b92912016-10-06 06:46:20 -0700230 "utility/ooura_fft_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000231 ]
232 }
233 } else {
peah27045122016-04-10 22:38:14 -0700234 sources += [ "aecm/aecm_core_c.cc" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000235 }
236
kjellander8f4419b2016-06-02 02:09:52 -0700237 # TODO(jschuh): Bug 1348: fix this warning.
238 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000239
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000240 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000241 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000242 "../../common_audio",
243 "../../system_wrappers",
244 ]
245}
246
kjellander7439f972016-12-05 22:47:46 -0800247rtc_source_set("audio_processing_c") {
248 visibility = [ ":*" ] # Only targets in this file can depend on this.
249 sources = [
250 "agc/legacy/analog_agc.c",
251 "agc/legacy/analog_agc.h",
252 "agc/legacy/digital_agc.c",
253 "agc/legacy/digital_agc.h",
254 "agc/legacy/gain_control.h",
255 ]
256
257 if (rtc_prefer_fixed_point) {
258 sources += [
259 "ns/noise_suppression_x.c",
260 "ns/noise_suppression_x.h",
261 "ns/nsx_core.c",
262 "ns/nsx_core.h",
263 "ns/nsx_defines.h",
264 ]
265 if (current_cpu == "mipsel") {
266 sources += [ "ns/nsx_core_mips.c" ]
267 } else {
268 sources += [ "ns/nsx_core_c.c" ]
269 }
270 } else {
271 sources += [
272 "ns/defines.h",
273 "ns/noise_suppression.c",
274 "ns/noise_suppression.h",
275 "ns/ns_core.c",
276 "ns/ns_core.h",
277 "ns/windows_private.h",
278 ]
279 }
280
281 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800282 "../..:webrtc_common",
kjellander7439f972016-12-05 22:47:46 -0800283 "../../base:rtc_base_approved",
284 "../../common_audio",
285 "../../system_wrappers",
286 ]
mbonadeie5dc3ce2017-01-25 05:34:46 -0800287
288 if (rtc_build_with_neon) {
289 deps += [ ":audio_processing_neon_c" ]
290 }
kjellander7439f972016-12-05 22:47:46 -0800291}
292
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000293if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000294 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200295 sources = [
296 "debug.proto",
297 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000298
kjellander78ddd732016-02-09 08:13:06 -0800299 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000300 }
301}
302
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000303if (current_cpu == "x86" || current_cpu == "x64") {
kjellanderb62dbbe2016-09-23 00:38:52 -0700304 rtc_static_library("audio_processing_sse2") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800305 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
306 # Errors on cyclic dependency with :audio_processing if enabled.
307 check_includes = false
308
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000309 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800310 "aec/aec_core_sse2.cc",
peah81b92912016-10-06 06:46:20 -0700311 "utility/ooura_fft_sse2.cc",
312 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000313 ]
314
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200315 if (is_posix) {
316 cflags = [ "-msse2" ]
317 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000318
peahf28a3892016-09-01 08:58:21 -0700319 if (apm_debug_dump) {
320 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700321 } else {
peahf28a3892016-09-01 08:58:21 -0700322 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700323 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000324 }
325}
326
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700327if (rtc_build_with_neon) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700328 rtc_static_library("audio_processing_neon") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800329 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
330 # Errors on cyclic dependency with :audio_processing if enabled.
331 check_includes = false
332
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000333 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800334 "aec/aec_core_neon.cc",
peah27045122016-04-10 22:38:14 -0700335 "aecm/aecm_core_neon.cc",
peah81b92912016-10-06 06:46:20 -0700336 "utility/ooura_fft_neon.cc",
337 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000338 ]
339
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000340 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700341 # Enable compilation for the NEON instruction set. This is needed
342 # since //build/config/arm.gni only enables NEON for iOS, not Android.
343 # This provides the same functionality as webrtc/build/arm_neon.gypi.
ehmaldonado38a21322016-09-02 04:10:34 -0700344 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200345 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000346 }
347
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700348 # Disable LTO on NEON targets due to compiler bug.
349 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000350 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000351 cflags -= [
352 "-flto",
353 "-ffat-lto-objects",
354 ]
355 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700356
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700357 deps = [
358 "../../common_audio",
359 ]
kjellander7439f972016-12-05 22:47:46 -0800360 public_deps = [
361 ":audio_processing_neon_c",
362 ]
peahb46083e2016-05-03 07:01:18 -0700363
peahf28a3892016-09-01 08:58:21 -0700364 if (apm_debug_dump) {
365 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700366 } else {
peahf28a3892016-09-01 08:58:21 -0700367 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700368 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000369 }
kjellander7439f972016-12-05 22:47:46 -0800370
371 rtc_static_library("audio_processing_neon_c") {
mbonadeie5dc3ce2017-01-25 05:34:46 -0800372 # TODO(mbonadei): Remove (bugs.webrtc.org/6828)
373 # Errors on cyclic dependency with :audio_processing_c if enabled.
374 check_includes = false
375
kjellander7439f972016-12-05 22:47:46 -0800376 sources = [
377 "ns/nsx_core_neon.c",
378 ]
379
380 if (current_cpu != "arm64") {
381 # Enable compilation for the NEON instruction set. This is needed
382 # since //build/config/arm.gni only enables NEON for iOS, not Android.
383 # This provides the same functionality as webrtc/build/arm_neon.gypi.
384 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
385 cflags = [ "-mfpu=neon" ]
386 }
387
388 # Disable LTO on NEON targets due to compiler bug.
389 # TODO(fdegans): Enable this. See crbug.com/408997.
390 if (rtc_use_lto) {
391 cflags -= [
392 "-flto",
393 "-ffat-lto-objects",
394 ]
395 }
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800396 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800397 "../../base:rtc_base_approved",
398 ]
kjellander7439f972016-12-05 22:47:46 -0800399 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000400}
kjellanderfb114242016-06-13 00:19:48 -0700401
402if (rtc_include_tests) {
kjellander6ceab082016-10-28 05:44:03 -0700403 group("audio_processing_tests") {
404 testonly = true
405 public_deps = [
kjellander6ceab082016-10-28 05:44:03 -0700406 ":audioproc_test_utils",
407 ":click_annotate",
408 ":nonlinear_beamformer_test",
409 ":transient_suppression_test",
kjellander6ceab082016-10-28 05:44:03 -0700410 ]
411
412 if (rtc_enable_intelligibility_enhancer) {
413 public_deps += [ ":intelligibility_proc" ]
414 }
415
416 if (rtc_enable_protobuf) {
ehmaldonado1fd08c12017-01-17 02:37:34 -0800417 public_deps += [
418 ":audioproc_f",
419 ":audioproc_unittest_proto",
420 ":unpack_aecdump",
421 ]
kjellander6ceab082016-10-28 05:44:03 -0700422 }
423 }
424
ehmaldonado36268652017-01-19 08:27:11 -0800425 rtc_source_set("audio_processing_unittests") {
426 testonly = true
427 sources = [
428 "aec/echo_cancellation_unittest.cc",
429 "aec/system_delay_unittest.cc",
430 "agc/agc_manager_direct_unittest.cc",
431 "agc/loudness_histogram_unittest.cc",
432 "agc/mock_agc.h",
433 "audio_buffer_unittest.cc",
434 "beamformer/array_util_unittest.cc",
435 "beamformer/complex_matrix_unittest.cc",
436 "beamformer/covariance_matrix_generator_unittest.cc",
437 "beamformer/matrix_unittest.cc",
438 "beamformer/mock_nonlinear_beamformer.h",
ehmaldonado36268652017-01-19 08:27:11 -0800439 "config_unittest.cc",
440 "echo_cancellation_impl_unittest.cc",
441 "splitting_filter_unittest.cc",
442 "transient/dyadic_decimator_unittest.cc",
443 "transient/file_utils.cc",
444 "transient/file_utils.h",
445 "transient/file_utils_unittest.cc",
446 "transient/moving_moments_unittest.cc",
447 "transient/transient_detector_unittest.cc",
448 "transient/transient_suppressor_unittest.cc",
449 "transient/wpd_node_unittest.cc",
450 "transient/wpd_tree_unittest.cc",
451 "utility/block_mean_calculator_unittest.cc",
452 "utility/delay_estimator_unittest.cc",
453 "vad/gmm_unittest.cc",
454 "vad/pitch_based_vad_unittest.cc",
455 "vad/pitch_internal_unittest.cc",
456 "vad/pole_zero_filter_unittest.cc",
457 "vad/standalone_vad_unittest.cc",
458 "vad/vad_audio_proc_unittest.cc",
459 "vad/vad_circular_buffer_unittest.cc",
460 "vad/voice_activity_detector_unittest.cc",
461 ]
462
463 deps = [
464 ":audio_processing",
ehmaldonado36268652017-01-19 08:27:11 -0800465 ":audioproc_test_utils",
466 "../..:webrtc_common",
467 "../../base:gtest_prod",
468 "../../base:rtc_base",
469 "../../base:rtc_base_approved",
470 "../../common_audio:common_audio",
471 "../../system_wrappers:system_wrappers",
472 "../../test:test_support",
473 "../audio_coding:neteq_unittest_tools",
474 "//testing/gmock",
475 "//testing/gtest",
476 ]
477
478 defines = []
479
480 if (apm_debug_dump) {
481 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
482 } else {
483 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
484 }
485
486 if (rtc_enable_intelligibility_enhancer) {
487 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
488 sources += [
489 "intelligibility/intelligibility_enhancer_unittest.cc",
490 "intelligibility/intelligibility_utils_unittest.cc",
491 ]
492 } else {
493 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
494 }
495
496 if (rtc_prefer_fixed_point) {
497 defines += [ "WEBRTC_AUDIOPROC_FIXED_PROFILE" ]
498 } else {
499 defines += [ "WEBRTC_AUDIOPROC_FLOAT_PROFILE" ]
500 }
501
502 if (rtc_enable_protobuf) {
503 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
504 deps += [
ehmaldonadof49ff262017-01-23 04:26:02 -0800505 ":audioproc_debug_proto",
ehmaldonado36268652017-01-19 08:27:11 -0800506 ":audioproc_protobuf_utils",
507 ":audioproc_unittest_proto",
508 ]
509 sources += [
510 "aec3/block_framer_unittest.cc",
511 "aec3/block_processor_unittest.cc",
512 "aec3/cascaded_biquad_filter_unittest.cc",
513 "aec3/echo_canceller3_unittest.cc",
514 "aec3/frame_blocker_unittest.cc",
515 "aec3/mock/mock_block_processor.h",
516 "audio_processing_impl_locking_unittest.cc",
517 "audio_processing_impl_unittest.cc",
518 "audio_processing_unittest.cc",
ehmaldonadof49ff262017-01-23 04:26:02 -0800519 "beamformer/nonlinear_beamformer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800520 "echo_cancellation_bit_exact_unittest.cc",
521 "echo_control_mobile_unittest.cc",
522 "echo_detector/circular_buffer_unittest.cc",
523 "echo_detector/mean_variance_estimator_unittest.cc",
524 "echo_detector/moving_max_unittest.cc",
525 "echo_detector/normalized_covariance_estimator_unittest.cc",
526 "gain_control_unittest.cc",
527 "level_controller/level_controller_unittest.cc",
528 "level_estimator_unittest.cc",
529 "low_cut_filter_unittest.cc",
530 "noise_suppression_unittest.cc",
531 "residual_echo_detector_unittest.cc",
532 "rms_level_unittest.cc",
533 "test/bitexactness_tools.cc",
534 "test/bitexactness_tools.h",
535 "test/debug_dump_replayer.cc",
536 "test/debug_dump_replayer.h",
537 "test/debug_dump_test.cc",
538 "test/test_utils.h",
539 "voice_detection_unittest.cc",
540 ]
541 }
542
543 if ((!build_with_chromium || is_win) && is_clang) {
544 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
545 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
546 }
547 }
548
ehmaldonado021eef32017-01-05 07:09:50 -0800549 rtc_source_set("audio_processing_perf_tests") {
550 # Has problems with autogenerated targets on Android and iOS
551 # Dependency chain (there may also be others):
552 # //webrtc/modules/audio_processing:audio_processing_perf_tests -->
553 # //webrtc/modules:modules_unittests --[private]-->
554 # //webrtc/modules:modules_unittests_apk -->
555 # //webrtc/modules:modules_unittests_apk__create -->
556 # //webrtc/modules:modules_unittests_apk__create__finalize -->
557 # //webrtc/modules:modules_unittests_apk__create__package --[private]-->
558 # //webrtc/modules:_modules_unittests__library
559 check_includes = false
560 testonly = true
561 sources = [
562 "audio_processing_performance_unittest.cc",
563 "level_controller/level_controller_complexity_unittest.cc",
564 "residual_echo_detector_complexity_unittest.cc",
565 ]
566 deps = [
567 ":audio_processing",
568 ":audioproc_test_utils",
569 "//testing/gtest",
570 ]
571 if (rtc_enable_intelligibility_enhancer) {
572 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
573 } else {
574 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
575 }
576 }
577
ehmaldonado1fd08c12017-01-17 02:37:34 -0800578 if (rtc_enable_protobuf) {
579 rtc_executable("unpack_aecdump") {
580 testonly = true
581 sources = [
582 "test/unpack.cc",
583 ]
peahc3ec1fd2016-08-07 23:19:30 -0700584
ehmaldonado1fd08c12017-01-17 02:37:34 -0800585 deps = [
586 ":audio_processing",
587 ":audioproc_debug_proto",
588 ":audioproc_protobuf_utils",
589 ":audioproc_test_utils",
590 "../..:webrtc_common",
591 "../../base:rtc_base_approved",
592 "../../common_audio",
593 "../../system_wrappers:system_wrappers_default",
594 "//third_party/gflags:gflags",
595 ]
596 } # unpack_aecdump
peahc3ec1fd2016-08-07 23:19:30 -0700597
ehmaldonado1fd08c12017-01-17 02:37:34 -0800598 rtc_executable("audioproc_f") {
599 testonly = true
600 sources = [
601 "test/aec_dump_based_simulator.cc",
602 "test/aec_dump_based_simulator.h",
603 "test/audio_processing_simulator.cc",
604 "test/audio_processing_simulator.h",
605 "test/audioproc_float.cc",
606 "test/wav_based_simulator.cc",
607 "test/wav_based_simulator.h",
608 ]
peahc3ec1fd2016-08-07 23:19:30 -0700609
ehmaldonado1fd08c12017-01-17 02:37:34 -0800610 deps = [
611 ":audio_processing",
612 ":audioproc_debug_proto",
613 ":audioproc_protobuf_utils",
614 ":audioproc_test_utils",
615 "../../base:rtc_base_approved",
616 "../../common_audio:common_audio",
617 "../../system_wrappers",
618 "../../system_wrappers:system_wrappers_default",
619 "../../test:test_support",
620 "//testing/gtest",
621 "//third_party/gflags:gflags",
622 ]
623 } # audioproc_f
624 }
peahc3ec1fd2016-08-07 23:19:30 -0700625
ehmaldonado38a21322016-09-02 04:10:34 -0700626 rtc_source_set("audioproc_test_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700627 testonly = true
628 sources = [
ehmaldonado529f83c2016-07-27 08:14:32 -0700629 "test/audio_buffer_tools.cc",
630 "test/audio_buffer_tools.h",
ivoc3cfb3ef2016-11-24 04:17:28 -0800631 "test/performance_timer.cc",
632 "test/performance_timer.h",
633 "test/simulator_buffers.cc",
634 "test/simulator_buffers.h",
kjellanderfb114242016-06-13 00:19:48 -0700635 "test/test_utils.cc",
636 "test/test_utils.h",
637 ]
638
kjellanderfb114242016-06-13 00:19:48 -0700639 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800640 ":audio_processing",
kjellanderfb114242016-06-13 00:19:48 -0700641 "../../base:rtc_base_approved",
642 "../../common_audio",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800643 "../../system_wrappers:system_wrappers",
kjellanderfb114242016-06-13 00:19:48 -0700644 ]
645 }
646
ehmaldonado38a21322016-09-02 04:10:34 -0700647 rtc_executable("transient_suppression_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700648 testonly = true
649 sources = [
650 "transient/file_utils.cc",
651 "transient/file_utils.h",
652 "transient/transient_suppression_test.cc",
653 ]
654 deps = [
655 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800656 "../..:webrtc_common",
657 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700658 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800659 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700660 "../../test:test_support",
661 "//testing/gtest",
662 "//third_party/gflags",
663 ]
kwiberg7a770e02016-08-25 02:32:43 -0700664 }
665
ehmaldonado38a21322016-09-02 04:10:34 -0700666 rtc_executable("click_annotate") {
kwiberg7a770e02016-08-25 02:32:43 -0700667 testonly = true
668 sources = [
669 "transient/click_annotate.cc",
670 "transient/file_utils.cc",
671 "transient/file_utils.h",
672 ]
673 deps = [
674 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800675 "../..:webrtc_common",
kwiberg7a770e02016-08-25 02:32:43 -0700676 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800677 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700678 ]
679 }
680
ehmaldonado38a21322016-09-02 04:10:34 -0700681 rtc_executable("nonlinear_beamformer_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700682 testonly = true
683 sources = [
684 "beamformer/nonlinear_beamformer_test.cc",
685 ]
686 deps = [
687 ":audio_processing",
688 ":audioproc_test_utils",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800689 "../../base:rtc_base_approved",
690 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700691 "../../system_wrappers:metrics_default",
692 "//third_party/gflags",
693 ]
kwiberg7a770e02016-08-25 02:32:43 -0700694 }
695
peah1bcfce52016-08-26 07:16:04 -0700696 if (rtc_enable_intelligibility_enhancer) {
ehmaldonado38a21322016-09-02 04:10:34 -0700697 rtc_executable("intelligibility_proc") {
peah1bcfce52016-08-26 07:16:04 -0700698 testonly = true
699 sources = [
700 "intelligibility/test/intelligibility_proc.cc",
701 ]
702 deps = [
703 ":audio_processing",
704 ":audioproc_test_utils",
705 "../../system_wrappers:metrics_default",
706 "../../test:test_support",
707 "//testing/gtest",
708 "//third_party/gflags",
709 ]
kwiberg7a770e02016-08-25 02:32:43 -0700710 }
711 }
712
kjellanderfb114242016-06-13 00:19:48 -0700713 if (rtc_enable_protobuf) {
714 proto_library("audioproc_unittest_proto") {
715 sources = [
716 "test/unittest.proto",
717 ]
718 proto_out_dir = "webrtc/modules/audio_processing"
719 }
720
kjellanderb62dbbe2016-09-23 00:38:52 -0700721 rtc_static_library("audioproc_protobuf_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700722 sources = [
723 "test/protobuf_utils.cc",
724 "test/protobuf_utils.h",
725 ]
726
727 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700728 ":audioproc_debug_proto",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800729 "../..:webrtc_common",
730 "../../base:rtc_base_approved",
kjellanderfb114242016-06-13 00:19:48 -0700731 ]
732 }
733 }
734}