blob: df272ab73f3f8a4e20b66a7bdaf331db8f9aa8a2 [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",
peah522d71b2017-02-23 05:16:26 -080029 "aec3/adaptive_fir_filter.cc",
30 "aec3/adaptive_fir_filter.h",
31 "aec3/aec3_common.cc",
32 "aec3/aec3_common.h",
33 "aec3/aec3_fft.cc",
34 "aec3/aec3_fft.h",
35 "aec3/aec_state.cc",
36 "aec3/aec_state.h",
peahd0263542017-01-03 04:20:34 -080037 "aec3/block_framer.cc",
38 "aec3/block_framer.h",
39 "aec3/block_processor.cc",
40 "aec3/block_processor.h",
41 "aec3/cascaded_biquad_filter.cc",
42 "aec3/cascaded_biquad_filter.h",
peah522d71b2017-02-23 05:16:26 -080043 "aec3/comfort_noise_generator.cc",
44 "aec3/comfort_noise_generator.h",
peah21920892017-02-08 05:08:56 -080045 "aec3/decimator_by_4.cc",
46 "aec3/decimator_by_4.h",
peahe0eae3c2016-12-14 01:16:23 -080047 "aec3/echo_canceller3.cc",
48 "aec3/echo_canceller3.h",
peah69221db2017-01-27 03:28:19 -080049 "aec3/echo_path_delay_estimator.cc",
50 "aec3/echo_path_delay_estimator.h",
peah522d71b2017-02-23 05:16:26 -080051 "aec3/echo_path_variability.cc",
peah69221db2017-01-27 03:28:19 -080052 "aec3/echo_path_variability.h",
53 "aec3/echo_remover.cc",
54 "aec3/echo_remover.h",
peah522d71b2017-02-23 05:16:26 -080055 "aec3/erl_estimator.cc",
56 "aec3/erl_estimator.h",
57 "aec3/erle_estimator.cc",
58 "aec3/erle_estimator.h",
59 "aec3/fft_buffer.cc",
60 "aec3/fft_buffer.h",
61 "aec3/fft_data.h",
peahd0263542017-01-03 04:20:34 -080062 "aec3/frame_blocker.cc",
63 "aec3/frame_blocker.h",
peah522d71b2017-02-23 05:16:26 -080064 "aec3/main_filter_update_gain.cc",
65 "aec3/main_filter_update_gain.h",
peah21920892017-02-08 05:08:56 -080066 "aec3/matched_filter.cc",
67 "aec3/matched_filter.h",
68 "aec3/matched_filter_lag_aggregator.cc",
69 "aec3/matched_filter_lag_aggregator.h",
peah522d71b2017-02-23 05:16:26 -080070 "aec3/output_selector.cc",
71 "aec3/output_selector.h",
72 "aec3/power_echo_model.cc",
73 "aec3/power_echo_model.h",
peah69221db2017-01-27 03:28:19 -080074 "aec3/render_delay_buffer.cc",
75 "aec3/render_delay_buffer.h",
76 "aec3/render_delay_controller.cc",
77 "aec3/render_delay_controller.h",
peah522d71b2017-02-23 05:16:26 -080078 "aec3/render_signal_analyzer.cc",
79 "aec3/render_signal_analyzer.h",
80 "aec3/residual_echo_estimator.cc",
81 "aec3/residual_echo_estimator.h",
82 "aec3/shadow_filter_update_gain.cc",
83 "aec3/shadow_filter_update_gain.h",
84 "aec3/subtractor.cc",
85 "aec3/subtractor.h",
86 "aec3/subtractor_output.h",
87 "aec3/suppression_filter.cc",
88 "aec3/suppression_filter.h",
89 "aec3/suppression_gain.cc",
90 "aec3/suppression_gain.h",
peah27045122016-04-10 22:38:14 -070091 "aecm/aecm_core.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000092 "aecm/aecm_core.h",
peah27045122016-04-10 22:38:14 -070093 "aecm/echo_control_mobile.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010094 "aecm/echo_control_mobile.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000095 "agc/agc.cc",
96 "agc/agc.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000097 "agc/agc_manager_direct.cc",
98 "agc/agc_manager_direct.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000099 "agc/gain_map_internal.h",
peahbbe42332016-06-08 06:42:02 -0700100 "agc/loudness_histogram.cc",
101 "agc/loudness_histogram.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000102 "agc/utility.cc",
103 "agc/utility.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000104 "audio_buffer.cc",
105 "audio_buffer.h",
106 "audio_processing_impl.cc",
107 "audio_processing_impl.h",
aluebs4a66e4a2015-10-19 18:02:39 -0700108 "beamformer/array_util.cc",
109 "beamformer/array_util.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +0000110 "beamformer/complex_matrix.h",
111 "beamformer/covariance_matrix_generator.cc",
112 "beamformer/covariance_matrix_generator.h",
113 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +0000114 "beamformer/nonlinear_beamformer.cc",
115 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000116 "common.h",
117 "echo_cancellation_impl.cc",
118 "echo_cancellation_impl.h",
119 "echo_control_mobile_impl.cc",
120 "echo_control_mobile_impl.h",
ivocaf27ed02016-10-28 07:04:03 -0700121 "echo_detector/circular_buffer.cc",
122 "echo_detector/circular_buffer.h",
123 "echo_detector/mean_variance_estimator.cc",
124 "echo_detector/mean_variance_estimator.h",
ivoc4e477a12017-01-15 08:29:46 -0800125 "echo_detector/moving_max.cc",
126 "echo_detector/moving_max.h",
ivocaf27ed02016-10-28 07:04:03 -0700127 "echo_detector/normalized_covariance_estimator.cc",
128 "echo_detector/normalized_covariance_estimator.h",
peahbe615622016-02-13 16:40:47 -0800129 "gain_control_for_experimental_agc.cc",
130 "gain_control_for_experimental_agc.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000131 "gain_control_impl.cc",
132 "gain_control_impl.h",
peahc19f3122016-10-07 14:54:10 -0700133 "include/audio_processing.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000134 "include/audio_processing.h",
solenberg88499ec2016-09-07 07:34:41 -0700135 "include/config.cc",
136 "include/config.h",
peahca4cac72016-06-29 15:26:12 -0700137 "level_controller/biquad_filter.cc",
138 "level_controller/biquad_filter.h",
139 "level_controller/down_sampler.cc",
140 "level_controller/down_sampler.h",
141 "level_controller/gain_applier.cc",
142 "level_controller/gain_applier.h",
143 "level_controller/gain_selector.cc",
144 "level_controller/gain_selector.h",
peahca4cac72016-06-29 15:26:12 -0700145 "level_controller/level_controller.cc",
146 "level_controller/level_controller.h",
peahc19f3122016-10-07 14:54:10 -0700147 "level_controller/level_controller_constants.h",
peahca4cac72016-06-29 15:26:12 -0700148 "level_controller/noise_level_estimator.cc",
149 "level_controller/noise_level_estimator.h",
150 "level_controller/noise_spectrum_estimator.cc",
151 "level_controller/noise_spectrum_estimator.h",
152 "level_controller/peak_level_estimator.cc",
153 "level_controller/peak_level_estimator.h",
154 "level_controller/saturating_gain_estimator.cc",
155 "level_controller/saturating_gain_estimator.h",
156 "level_controller/signal_classifier.cc",
157 "level_controller/signal_classifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000158 "level_estimator_impl.cc",
159 "level_estimator_impl.h",
peahb46083e2016-05-03 07:01:18 -0700160 "logging/apm_data_dumper.cc",
161 "logging/apm_data_dumper.h",
peah8271d042016-11-22 07:24:52 -0800162 "low_cut_filter.cc",
163 "low_cut_filter.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000164 "noise_suppression_impl.cc",
165 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -0800166 "render_queue_item_verifier.h",
ivoc9f4a4a02016-10-28 05:39:16 -0700167 "residual_echo_detector.cc",
168 "residual_echo_detector.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000169 "rms_level.cc",
170 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +0000171 "splitting_filter.cc",
172 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -0700173 "three_band_filter_bank.cc",
174 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000175 "transient/common.h",
176 "transient/daubechies_8_wavelet_coeffs.h",
177 "transient/dyadic_decimator.h",
178 "transient/moving_moments.cc",
179 "transient/moving_moments.h",
180 "transient/transient_detector.cc",
181 "transient/transient_detector.h",
182 "transient/transient_suppressor.cc",
183 "transient/transient_suppressor.h",
184 "transient/wpd_node.cc",
185 "transient/wpd_node.h",
186 "transient/wpd_tree.cc",
187 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000188 "typing_detection.cc",
189 "typing_detection.h",
minyue84db6fa2016-03-24 14:36:25 -0700190 "utility/block_mean_calculator.cc",
191 "utility/block_mean_calculator.h",
peahbdb7af62016-04-12 14:47:40 -0700192 "utility/delay_estimator.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000193 "utility/delay_estimator.h",
194 "utility/delay_estimator_internal.h",
peahbdb7af62016-04-12 14:47:40 -0700195 "utility/delay_estimator_wrapper.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000196 "utility/delay_estimator_wrapper.h",
peah81b92912016-10-06 06:46:20 -0700197 "utility/ooura_fft.cc",
198 "utility/ooura_fft.h",
199 "utility/ooura_fft_tables_common.h",
aluebsecf6b812015-06-25 12:28:48 -0700200 "vad/common.h",
201 "vad/gmm.cc",
202 "vad/gmm.h",
203 "vad/noise_gmm_tables.h",
204 "vad/pitch_based_vad.cc",
205 "vad/pitch_based_vad.h",
206 "vad/pitch_internal.cc",
207 "vad/pitch_internal.h",
208 "vad/pole_zero_filter.cc",
209 "vad/pole_zero_filter.h",
210 "vad/standalone_vad.cc",
211 "vad/standalone_vad.h",
212 "vad/vad_audio_proc.cc",
213 "vad/vad_audio_proc.h",
214 "vad/vad_audio_proc_internal.h",
215 "vad/vad_circular_buffer.cc",
216 "vad/vad_circular_buffer.h",
217 "vad/voice_activity_detector.cc",
218 "vad/voice_activity_detector.h",
219 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000220 "voice_detection_impl.cc",
221 "voice_detection_impl.h",
222 ]
223
224 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200225 deps = [
226 "../..:webrtc_common",
aleloi6321b492016-12-05 01:46:09 -0800227 "../../audio/utility:audio_frame_operations",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800228 "../../base:gtest_prod",
kwiberg98ab3a42015-09-30 21:54:21 -0700229 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200230 ]
kjellander7439f972016-12-05 22:47:46 -0800231 public_deps = [
232 ":audio_processing_c",
233 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000234
peahf28a3892016-09-01 08:58:21 -0700235 if (apm_debug_dump) {
236 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700237 } else {
peahf28a3892016-09-01 08:58:21 -0700238 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000239 }
240
241 if (aec_untrusted_delay_for_testing) {
242 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
243 }
244
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000245 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000246 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
247 deps += [ ":audioproc_debug_proto" ]
248 }
249
peah1bcfce52016-08-26 07:16:04 -0700250 if (rtc_enable_intelligibility_enhancer) {
251 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
252 sources += [
253 "intelligibility/intelligibility_enhancer.cc",
254 "intelligibility/intelligibility_enhancer.h",
255 "intelligibility/intelligibility_utils.cc",
256 "intelligibility/intelligibility_utils.h",
257 ]
258 } else {
259 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
260 }
261
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000262 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000263 defines += [ "WEBRTC_NS_FIXED" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000264 } else {
265 defines += [ "WEBRTC_NS_FLOAT" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000266 }
267
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000268 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000269 deps += [ ":audio_processing_sse2" ]
270 }
271
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700272 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000273 deps += [ ":audio_processing_neon" ]
274 }
275
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000276 if (current_cpu == "mipsel") {
peah27045122016-04-10 22:38:14 -0700277 sources += [ "aecm/aecm_core_mips.cc" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000278 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000279 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800280 "aec/aec_core_mips.cc",
peah81b92912016-10-06 06:46:20 -0700281 "utility/ooura_fft_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000282 ]
283 }
284 } else {
peah27045122016-04-10 22:38:14 -0700285 sources += [ "aecm/aecm_core_c.cc" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000286 }
287
kjellander8f4419b2016-06-02 02:09:52 -0700288 # TODO(jschuh): Bug 1348: fix this warning.
289 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000290
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000291 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000292 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000293 "../../common_audio",
294 "../../system_wrappers",
295 ]
296}
297
kjellander7439f972016-12-05 22:47:46 -0800298rtc_source_set("audio_processing_c") {
299 visibility = [ ":*" ] # Only targets in this file can depend on this.
300 sources = [
301 "agc/legacy/analog_agc.c",
302 "agc/legacy/analog_agc.h",
303 "agc/legacy/digital_agc.c",
304 "agc/legacy/digital_agc.h",
305 "agc/legacy/gain_control.h",
306 ]
307
308 if (rtc_prefer_fixed_point) {
309 sources += [
310 "ns/noise_suppression_x.c",
311 "ns/noise_suppression_x.h",
312 "ns/nsx_core.c",
313 "ns/nsx_core.h",
314 "ns/nsx_defines.h",
315 ]
316 if (current_cpu == "mipsel") {
317 sources += [ "ns/nsx_core_mips.c" ]
318 } else {
319 sources += [ "ns/nsx_core_c.c" ]
320 }
321 } else {
322 sources += [
323 "ns/defines.h",
324 "ns/noise_suppression.c",
325 "ns/noise_suppression.h",
326 "ns/ns_core.c",
327 "ns/ns_core.h",
328 "ns/windows_private.h",
329 ]
330 }
331
332 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800333 "../..:webrtc_common",
kjellander7439f972016-12-05 22:47:46 -0800334 "../../base:rtc_base_approved",
335 "../../common_audio",
336 "../../system_wrappers",
337 ]
mbonadeie5dc3ce2017-01-25 05:34:46 -0800338
339 if (rtc_build_with_neon) {
340 deps += [ ":audio_processing_neon_c" ]
341 }
kjellander7439f972016-12-05 22:47:46 -0800342}
343
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000344if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000345 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200346 sources = [
347 "debug.proto",
348 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000349
kjellander78ddd732016-02-09 08:13:06 -0800350 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000351 }
352}
353
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000354if (current_cpu == "x86" || current_cpu == "x64") {
kjellanderb62dbbe2016-09-23 00:38:52 -0700355 rtc_static_library("audio_processing_sse2") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800356 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
357 # Errors on cyclic dependency with :audio_processing if enabled.
358 check_includes = false
359
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000360 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800361 "aec/aec_core_sse2.cc",
peah81b92912016-10-06 06:46:20 -0700362 "utility/ooura_fft_sse2.cc",
363 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000364 ]
365
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200366 if (is_posix) {
367 cflags = [ "-msse2" ]
368 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000369
peahf28a3892016-09-01 08:58:21 -0700370 if (apm_debug_dump) {
371 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700372 } else {
peahf28a3892016-09-01 08:58:21 -0700373 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700374 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000375 }
376}
377
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700378if (rtc_build_with_neon) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700379 rtc_static_library("audio_processing_neon") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800380 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
381 # Errors on cyclic dependency with :audio_processing if enabled.
382 check_includes = false
383
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000384 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800385 "aec/aec_core_neon.cc",
peah27045122016-04-10 22:38:14 -0700386 "aecm/aecm_core_neon.cc",
peah81b92912016-10-06 06:46:20 -0700387 "utility/ooura_fft_neon.cc",
388 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000389 ]
390
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000391 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700392 # Enable compilation for the NEON instruction set. This is needed
393 # since //build/config/arm.gni only enables NEON for iOS, not Android.
394 # This provides the same functionality as webrtc/build/arm_neon.gypi.
ehmaldonado38a21322016-09-02 04:10:34 -0700395 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200396 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000397 }
398
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700399 # Disable LTO on NEON targets due to compiler bug.
400 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000401 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000402 cflags -= [
403 "-flto",
404 "-ffat-lto-objects",
405 ]
406 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700407
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700408 deps = [
409 "../../common_audio",
410 ]
kjellander7439f972016-12-05 22:47:46 -0800411 public_deps = [
412 ":audio_processing_neon_c",
413 ]
peahb46083e2016-05-03 07:01:18 -0700414
peahf28a3892016-09-01 08:58:21 -0700415 if (apm_debug_dump) {
416 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700417 } else {
peahf28a3892016-09-01 08:58:21 -0700418 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700419 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000420 }
kjellander7439f972016-12-05 22:47:46 -0800421
422 rtc_static_library("audio_processing_neon_c") {
mbonadeie5dc3ce2017-01-25 05:34:46 -0800423 # TODO(mbonadei): Remove (bugs.webrtc.org/6828)
424 # Errors on cyclic dependency with :audio_processing_c if enabled.
425 check_includes = false
426
kjellander7439f972016-12-05 22:47:46 -0800427 sources = [
428 "ns/nsx_core_neon.c",
429 ]
430
431 if (current_cpu != "arm64") {
432 # Enable compilation for the NEON instruction set. This is needed
433 # since //build/config/arm.gni only enables NEON for iOS, not Android.
434 # This provides the same functionality as webrtc/build/arm_neon.gypi.
435 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
436 cflags = [ "-mfpu=neon" ]
437 }
438
439 # Disable LTO on NEON targets due to compiler bug.
440 # TODO(fdegans): Enable this. See crbug.com/408997.
441 if (rtc_use_lto) {
442 cflags -= [
443 "-flto",
444 "-ffat-lto-objects",
445 ]
446 }
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800447 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800448 "../../base:rtc_base_approved",
449 ]
kjellander7439f972016-12-05 22:47:46 -0800450 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000451}
kjellanderfb114242016-06-13 00:19:48 -0700452
453if (rtc_include_tests) {
kjellander6ceab082016-10-28 05:44:03 -0700454 group("audio_processing_tests") {
455 testonly = true
456 public_deps = [
kjellander6ceab082016-10-28 05:44:03 -0700457 ":audioproc_test_utils",
458 ":click_annotate",
459 ":nonlinear_beamformer_test",
460 ":transient_suppression_test",
kjellander6ceab082016-10-28 05:44:03 -0700461 ]
462
463 if (rtc_enable_intelligibility_enhancer) {
464 public_deps += [ ":intelligibility_proc" ]
465 }
466
467 if (rtc_enable_protobuf) {
ehmaldonado1fd08c12017-01-17 02:37:34 -0800468 public_deps += [
469 ":audioproc_f",
470 ":audioproc_unittest_proto",
471 ":unpack_aecdump",
alessiob306d1bf2017-02-24 05:32:21 -0800472 "test/py_quality_assessment",
ehmaldonado1fd08c12017-01-17 02:37:34 -0800473 ]
kjellander6ceab082016-10-28 05:44:03 -0700474 }
475 }
476
ehmaldonado36268652017-01-19 08:27:11 -0800477 rtc_source_set("audio_processing_unittests") {
478 testonly = true
479 sources = [
480 "aec/echo_cancellation_unittest.cc",
481 "aec/system_delay_unittest.cc",
482 "agc/agc_manager_direct_unittest.cc",
483 "agc/loudness_histogram_unittest.cc",
484 "agc/mock_agc.h",
485 "audio_buffer_unittest.cc",
486 "beamformer/array_util_unittest.cc",
487 "beamformer/complex_matrix_unittest.cc",
488 "beamformer/covariance_matrix_generator_unittest.cc",
489 "beamformer/matrix_unittest.cc",
490 "beamformer/mock_nonlinear_beamformer.h",
ehmaldonado36268652017-01-19 08:27:11 -0800491 "config_unittest.cc",
492 "echo_cancellation_impl_unittest.cc",
493 "splitting_filter_unittest.cc",
494 "transient/dyadic_decimator_unittest.cc",
495 "transient/file_utils.cc",
496 "transient/file_utils.h",
497 "transient/file_utils_unittest.cc",
498 "transient/moving_moments_unittest.cc",
499 "transient/transient_detector_unittest.cc",
500 "transient/transient_suppressor_unittest.cc",
501 "transient/wpd_node_unittest.cc",
502 "transient/wpd_tree_unittest.cc",
503 "utility/block_mean_calculator_unittest.cc",
504 "utility/delay_estimator_unittest.cc",
505 "vad/gmm_unittest.cc",
506 "vad/pitch_based_vad_unittest.cc",
507 "vad/pitch_internal_unittest.cc",
508 "vad/pole_zero_filter_unittest.cc",
509 "vad/standalone_vad_unittest.cc",
510 "vad/vad_audio_proc_unittest.cc",
511 "vad/vad_circular_buffer_unittest.cc",
512 "vad/voice_activity_detector_unittest.cc",
513 ]
514
515 deps = [
516 ":audio_processing",
ehmaldonado36268652017-01-19 08:27:11 -0800517 ":audioproc_test_utils",
518 "../..:webrtc_common",
519 "../../base:gtest_prod",
520 "../../base:rtc_base",
521 "../../base:rtc_base_approved",
522 "../../common_audio:common_audio",
523 "../../system_wrappers:system_wrappers",
524 "../../test:test_support",
525 "../audio_coding:neteq_unittest_tools",
526 "//testing/gmock",
527 "//testing/gtest",
528 ]
529
530 defines = []
531
532 if (apm_debug_dump) {
533 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
534 } else {
535 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
536 }
537
538 if (rtc_enable_intelligibility_enhancer) {
539 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
540 sources += [
541 "intelligibility/intelligibility_enhancer_unittest.cc",
542 "intelligibility/intelligibility_utils_unittest.cc",
543 ]
544 } else {
545 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
546 }
547
548 if (rtc_prefer_fixed_point) {
549 defines += [ "WEBRTC_AUDIOPROC_FIXED_PROFILE" ]
550 } else {
551 defines += [ "WEBRTC_AUDIOPROC_FLOAT_PROFILE" ]
552 }
553
554 if (rtc_enable_protobuf) {
555 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
556 deps += [
ehmaldonadof49ff262017-01-23 04:26:02 -0800557 ":audioproc_debug_proto",
ehmaldonado36268652017-01-19 08:27:11 -0800558 ":audioproc_protobuf_utils",
559 ":audioproc_unittest_proto",
560 ]
561 sources += [
peah522d71b2017-02-23 05:16:26 -0800562 "aec3/adaptive_fir_filter_unittest.cc",
563 "aec3/aec3_fft_unittest.cc",
564 "aec3/aec_state_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800565 "aec3/block_framer_unittest.cc",
566 "aec3/block_processor_unittest.cc",
567 "aec3/cascaded_biquad_filter_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800568 "aec3/comfort_noise_generator_unittest.cc",
peah21920892017-02-08 05:08:56 -0800569 "aec3/decimator_by_4_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800570 "aec3/echo_canceller3_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800571 "aec3/echo_path_delay_estimator_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800572 "aec3/echo_path_variability_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800573 "aec3/echo_remover_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800574 "aec3/erl_estimator_unittest.cc",
575 "aec3/erle_estimator_unittest.cc",
576 "aec3/fft_buffer_unittest.cc",
577 "aec3/fft_data_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800578 "aec3/frame_blocker_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800579 "aec3/main_filter_update_gain_unittest.cc",
peah21920892017-02-08 05:08:56 -0800580 "aec3/matched_filter_lag_aggregator_unittest.cc",
581 "aec3/matched_filter_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800582 "aec3/output_selector_unittest.cc",
583 "aec3/power_echo_model_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800584 "aec3/render_delay_buffer_unittest.cc",
585 "aec3/render_delay_controller_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800586 "aec3/render_signal_analyzer_unittest.cc",
587 "aec3/residual_echo_estimator_unittest.cc",
588 "aec3/shadow_filter_update_gain_unittest.cc",
589 "aec3/subtractor_unittest.cc",
590 "aec3/suppression_filter_unittest.cc",
591 "aec3/suppression_gain_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800592 "audio_processing_impl_locking_unittest.cc",
593 "audio_processing_impl_unittest.cc",
594 "audio_processing_unittest.cc",
ehmaldonadof49ff262017-01-23 04:26:02 -0800595 "beamformer/nonlinear_beamformer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800596 "echo_cancellation_bit_exact_unittest.cc",
597 "echo_control_mobile_unittest.cc",
598 "echo_detector/circular_buffer_unittest.cc",
599 "echo_detector/mean_variance_estimator_unittest.cc",
600 "echo_detector/moving_max_unittest.cc",
601 "echo_detector/normalized_covariance_estimator_unittest.cc",
602 "gain_control_unittest.cc",
603 "level_controller/level_controller_unittest.cc",
604 "level_estimator_unittest.cc",
605 "low_cut_filter_unittest.cc",
606 "noise_suppression_unittest.cc",
607 "residual_echo_detector_unittest.cc",
608 "rms_level_unittest.cc",
609 "test/bitexactness_tools.cc",
610 "test/bitexactness_tools.h",
611 "test/debug_dump_replayer.cc",
612 "test/debug_dump_replayer.h",
613 "test/debug_dump_test.cc",
peah69221db2017-01-27 03:28:19 -0800614 "test/echo_canceller_test_tools.cc",
615 "test/echo_canceller_test_tools.h",
616 "test/echo_canceller_test_tools_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800617 "test/test_utils.h",
618 "voice_detection_unittest.cc",
619 ]
620 }
621
622 if ((!build_with_chromium || is_win) && is_clang) {
623 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
624 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
625 }
626 }
627
ehmaldonado021eef32017-01-05 07:09:50 -0800628 rtc_source_set("audio_processing_perf_tests") {
629 # Has problems with autogenerated targets on Android and iOS
630 # Dependency chain (there may also be others):
631 # //webrtc/modules/audio_processing:audio_processing_perf_tests -->
632 # //webrtc/modules:modules_unittests --[private]-->
633 # //webrtc/modules:modules_unittests_apk -->
634 # //webrtc/modules:modules_unittests_apk__create -->
635 # //webrtc/modules:modules_unittests_apk__create__finalize -->
636 # //webrtc/modules:modules_unittests_apk__create__package --[private]-->
637 # //webrtc/modules:_modules_unittests__library
638 check_includes = false
639 testonly = true
640 sources = [
641 "audio_processing_performance_unittest.cc",
642 "level_controller/level_controller_complexity_unittest.cc",
643 "residual_echo_detector_complexity_unittest.cc",
644 ]
645 deps = [
646 ":audio_processing",
647 ":audioproc_test_utils",
648 "//testing/gtest",
649 ]
650 if (rtc_enable_intelligibility_enhancer) {
651 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
652 } else {
653 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
654 }
655 }
656
ehmaldonado1fd08c12017-01-17 02:37:34 -0800657 if (rtc_enable_protobuf) {
658 rtc_executable("unpack_aecdump") {
659 testonly = true
660 sources = [
661 "test/unpack.cc",
662 ]
peahc3ec1fd2016-08-07 23:19:30 -0700663
ehmaldonado1fd08c12017-01-17 02:37:34 -0800664 deps = [
665 ":audio_processing",
666 ":audioproc_debug_proto",
667 ":audioproc_protobuf_utils",
668 ":audioproc_test_utils",
669 "../..:webrtc_common",
670 "../../base:rtc_base_approved",
671 "../../common_audio",
672 "../../system_wrappers:system_wrappers_default",
673 "//third_party/gflags:gflags",
674 ]
675 } # unpack_aecdump
peahc3ec1fd2016-08-07 23:19:30 -0700676
ehmaldonado1fd08c12017-01-17 02:37:34 -0800677 rtc_executable("audioproc_f") {
678 testonly = true
679 sources = [
680 "test/aec_dump_based_simulator.cc",
681 "test/aec_dump_based_simulator.h",
682 "test/audio_processing_simulator.cc",
683 "test/audio_processing_simulator.h",
684 "test/audioproc_float.cc",
685 "test/wav_based_simulator.cc",
686 "test/wav_based_simulator.h",
687 ]
peahc3ec1fd2016-08-07 23:19:30 -0700688
ehmaldonado1fd08c12017-01-17 02:37:34 -0800689 deps = [
690 ":audio_processing",
691 ":audioproc_debug_proto",
692 ":audioproc_protobuf_utils",
693 ":audioproc_test_utils",
694 "../../base:rtc_base_approved",
695 "../../common_audio:common_audio",
696 "../../system_wrappers",
697 "../../system_wrappers:system_wrappers_default",
698 "../../test:test_support",
699 "//testing/gtest",
700 "//third_party/gflags:gflags",
701 ]
702 } # audioproc_f
703 }
peahc3ec1fd2016-08-07 23:19:30 -0700704
ehmaldonado38a21322016-09-02 04:10:34 -0700705 rtc_source_set("audioproc_test_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700706 testonly = true
707 sources = [
ehmaldonado529f83c2016-07-27 08:14:32 -0700708 "test/audio_buffer_tools.cc",
709 "test/audio_buffer_tools.h",
ivoc3cfb3ef2016-11-24 04:17:28 -0800710 "test/performance_timer.cc",
711 "test/performance_timer.h",
712 "test/simulator_buffers.cc",
713 "test/simulator_buffers.h",
kjellanderfb114242016-06-13 00:19:48 -0700714 "test/test_utils.cc",
715 "test/test_utils.h",
716 ]
717
kjellanderfb114242016-06-13 00:19:48 -0700718 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800719 ":audio_processing",
kjellanderfb114242016-06-13 00:19:48 -0700720 "../../base:rtc_base_approved",
721 "../../common_audio",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800722 "../../system_wrappers:system_wrappers",
kjellanderfb114242016-06-13 00:19:48 -0700723 ]
724 }
725
ehmaldonado38a21322016-09-02 04:10:34 -0700726 rtc_executable("transient_suppression_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700727 testonly = true
728 sources = [
729 "transient/file_utils.cc",
730 "transient/file_utils.h",
731 "transient/transient_suppression_test.cc",
732 ]
733 deps = [
734 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800735 "../..:webrtc_common",
736 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700737 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800738 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700739 "../../test:test_support",
740 "//testing/gtest",
741 "//third_party/gflags",
742 ]
kwiberg7a770e02016-08-25 02:32:43 -0700743 }
744
ehmaldonado38a21322016-09-02 04:10:34 -0700745 rtc_executable("click_annotate") {
kwiberg7a770e02016-08-25 02:32:43 -0700746 testonly = true
747 sources = [
748 "transient/click_annotate.cc",
749 "transient/file_utils.cc",
750 "transient/file_utils.h",
751 ]
752 deps = [
753 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800754 "../..:webrtc_common",
kwiberg7a770e02016-08-25 02:32:43 -0700755 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800756 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700757 ]
758 }
759
ehmaldonado38a21322016-09-02 04:10:34 -0700760 rtc_executable("nonlinear_beamformer_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700761 testonly = true
762 sources = [
763 "beamformer/nonlinear_beamformer_test.cc",
764 ]
765 deps = [
766 ":audio_processing",
767 ":audioproc_test_utils",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800768 "../../base:rtc_base_approved",
769 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700770 "../../system_wrappers:metrics_default",
771 "//third_party/gflags",
772 ]
kwiberg7a770e02016-08-25 02:32:43 -0700773 }
774
peah1bcfce52016-08-26 07:16:04 -0700775 if (rtc_enable_intelligibility_enhancer) {
ehmaldonado38a21322016-09-02 04:10:34 -0700776 rtc_executable("intelligibility_proc") {
peah1bcfce52016-08-26 07:16:04 -0700777 testonly = true
778 sources = [
779 "intelligibility/test/intelligibility_proc.cc",
780 ]
781 deps = [
782 ":audio_processing",
783 ":audioproc_test_utils",
784 "../../system_wrappers:metrics_default",
785 "../../test:test_support",
786 "//testing/gtest",
787 "//third_party/gflags",
788 ]
kwiberg7a770e02016-08-25 02:32:43 -0700789 }
790 }
791
kjellanderfb114242016-06-13 00:19:48 -0700792 if (rtc_enable_protobuf) {
793 proto_library("audioproc_unittest_proto") {
794 sources = [
795 "test/unittest.proto",
796 ]
797 proto_out_dir = "webrtc/modules/audio_processing"
798 }
799
kjellanderb62dbbe2016-09-23 00:38:52 -0700800 rtc_static_library("audioproc_protobuf_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700801 sources = [
802 "test/protobuf_utils.cc",
803 "test/protobuf_utils.h",
804 ]
805
806 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700807 ":audioproc_debug_proto",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800808 "../..:webrtc_common",
809 "../../base:rtc_base_approved",
kjellanderfb114242016-06-13 00:19:48 -0700810 ]
811 }
812 }
813}