blob: b20e3b5ad18d011cfe23d9fd58042dc35af6522c [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",
peahe985b3f2017-02-28 22:08:53 -080041 "aec3/block_processor_metrics.cc",
42 "aec3/block_processor_metrics.h",
peahd0263542017-01-03 04:20:34 -080043 "aec3/cascaded_biquad_filter.cc",
44 "aec3/cascaded_biquad_filter.h",
peah522d71b2017-02-23 05:16:26 -080045 "aec3/comfort_noise_generator.cc",
46 "aec3/comfort_noise_generator.h",
peah21920892017-02-08 05:08:56 -080047 "aec3/decimator_by_4.cc",
48 "aec3/decimator_by_4.h",
peahe0eae3c2016-12-14 01:16:23 -080049 "aec3/echo_canceller3.cc",
50 "aec3/echo_canceller3.h",
peah69221db2017-01-27 03:28:19 -080051 "aec3/echo_path_delay_estimator.cc",
52 "aec3/echo_path_delay_estimator.h",
peah522d71b2017-02-23 05:16:26 -080053 "aec3/echo_path_variability.cc",
peah69221db2017-01-27 03:28:19 -080054 "aec3/echo_path_variability.h",
55 "aec3/echo_remover.cc",
56 "aec3/echo_remover.h",
peahe985b3f2017-02-28 22:08:53 -080057 "aec3/echo_remover_metrics.cc",
58 "aec3/echo_remover_metrics.h",
peah522d71b2017-02-23 05:16:26 -080059 "aec3/erl_estimator.cc",
60 "aec3/erl_estimator.h",
61 "aec3/erle_estimator.cc",
62 "aec3/erle_estimator.h",
63 "aec3/fft_buffer.cc",
64 "aec3/fft_buffer.h",
65 "aec3/fft_data.h",
peahd0263542017-01-03 04:20:34 -080066 "aec3/frame_blocker.cc",
67 "aec3/frame_blocker.h",
peah522d71b2017-02-23 05:16:26 -080068 "aec3/main_filter_update_gain.cc",
69 "aec3/main_filter_update_gain.h",
peah21920892017-02-08 05:08:56 -080070 "aec3/matched_filter.cc",
71 "aec3/matched_filter.h",
72 "aec3/matched_filter_lag_aggregator.cc",
73 "aec3/matched_filter_lag_aggregator.h",
peah522d71b2017-02-23 05:16:26 -080074 "aec3/output_selector.cc",
75 "aec3/output_selector.h",
76 "aec3/power_echo_model.cc",
77 "aec3/power_echo_model.h",
peah69221db2017-01-27 03:28:19 -080078 "aec3/render_delay_buffer.cc",
79 "aec3/render_delay_buffer.h",
80 "aec3/render_delay_controller.cc",
81 "aec3/render_delay_controller.h",
peahe985b3f2017-02-28 22:08:53 -080082 "aec3/render_delay_controller_metrics.cc",
83 "aec3/render_delay_controller_metrics.h",
peah522d71b2017-02-23 05:16:26 -080084 "aec3/render_signal_analyzer.cc",
85 "aec3/render_signal_analyzer.h",
86 "aec3/residual_echo_estimator.cc",
87 "aec3/residual_echo_estimator.h",
88 "aec3/shadow_filter_update_gain.cc",
89 "aec3/shadow_filter_update_gain.h",
90 "aec3/subtractor.cc",
91 "aec3/subtractor.h",
92 "aec3/subtractor_output.h",
93 "aec3/suppression_filter.cc",
94 "aec3/suppression_filter.h",
95 "aec3/suppression_gain.cc",
96 "aec3/suppression_gain.h",
peah27045122016-04-10 22:38:14 -070097 "aecm/aecm_core.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000098 "aecm/aecm_core.h",
peah27045122016-04-10 22:38:14 -070099 "aecm/echo_control_mobile.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100100 "aecm/echo_control_mobile.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000101 "agc/agc.cc",
102 "agc/agc.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000103 "agc/agc_manager_direct.cc",
104 "agc/agc_manager_direct.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000105 "agc/gain_map_internal.h",
peahbbe42332016-06-08 06:42:02 -0700106 "agc/loudness_histogram.cc",
107 "agc/loudness_histogram.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000108 "agc/utility.cc",
109 "agc/utility.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000110 "audio_buffer.cc",
111 "audio_buffer.h",
112 "audio_processing_impl.cc",
113 "audio_processing_impl.h",
aluebs4a66e4a2015-10-19 18:02:39 -0700114 "beamformer/array_util.cc",
115 "beamformer/array_util.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +0000116 "beamformer/complex_matrix.h",
117 "beamformer/covariance_matrix_generator.cc",
118 "beamformer/covariance_matrix_generator.h",
119 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +0000120 "beamformer/nonlinear_beamformer.cc",
121 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000122 "common.h",
123 "echo_cancellation_impl.cc",
124 "echo_cancellation_impl.h",
125 "echo_control_mobile_impl.cc",
126 "echo_control_mobile_impl.h",
ivocaf27ed02016-10-28 07:04:03 -0700127 "echo_detector/circular_buffer.cc",
128 "echo_detector/circular_buffer.h",
129 "echo_detector/mean_variance_estimator.cc",
130 "echo_detector/mean_variance_estimator.h",
ivoc4e477a12017-01-15 08:29:46 -0800131 "echo_detector/moving_max.cc",
132 "echo_detector/moving_max.h",
ivocaf27ed02016-10-28 07:04:03 -0700133 "echo_detector/normalized_covariance_estimator.cc",
134 "echo_detector/normalized_covariance_estimator.h",
peahbe615622016-02-13 16:40:47 -0800135 "gain_control_for_experimental_agc.cc",
136 "gain_control_for_experimental_agc.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000137 "gain_control_impl.cc",
138 "gain_control_impl.h",
peahc19f3122016-10-07 14:54:10 -0700139 "include/audio_processing.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000140 "include/audio_processing.h",
solenberg88499ec2016-09-07 07:34:41 -0700141 "include/config.cc",
142 "include/config.h",
peahca4cac72016-06-29 15:26:12 -0700143 "level_controller/biquad_filter.cc",
144 "level_controller/biquad_filter.h",
145 "level_controller/down_sampler.cc",
146 "level_controller/down_sampler.h",
147 "level_controller/gain_applier.cc",
148 "level_controller/gain_applier.h",
149 "level_controller/gain_selector.cc",
150 "level_controller/gain_selector.h",
peahca4cac72016-06-29 15:26:12 -0700151 "level_controller/level_controller.cc",
152 "level_controller/level_controller.h",
peahc19f3122016-10-07 14:54:10 -0700153 "level_controller/level_controller_constants.h",
peahca4cac72016-06-29 15:26:12 -0700154 "level_controller/noise_level_estimator.cc",
155 "level_controller/noise_level_estimator.h",
156 "level_controller/noise_spectrum_estimator.cc",
157 "level_controller/noise_spectrum_estimator.h",
158 "level_controller/peak_level_estimator.cc",
159 "level_controller/peak_level_estimator.h",
160 "level_controller/saturating_gain_estimator.cc",
161 "level_controller/saturating_gain_estimator.h",
162 "level_controller/signal_classifier.cc",
163 "level_controller/signal_classifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000164 "level_estimator_impl.cc",
165 "level_estimator_impl.h",
peahb46083e2016-05-03 07:01:18 -0700166 "logging/apm_data_dumper.cc",
167 "logging/apm_data_dumper.h",
peah8271d042016-11-22 07:24:52 -0800168 "low_cut_filter.cc",
169 "low_cut_filter.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000170 "noise_suppression_impl.cc",
171 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -0800172 "render_queue_item_verifier.h",
ivoc9f4a4a02016-10-28 05:39:16 -0700173 "residual_echo_detector.cc",
174 "residual_echo_detector.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000175 "rms_level.cc",
176 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +0000177 "splitting_filter.cc",
178 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -0700179 "three_band_filter_bank.cc",
180 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000181 "transient/common.h",
182 "transient/daubechies_8_wavelet_coeffs.h",
183 "transient/dyadic_decimator.h",
184 "transient/moving_moments.cc",
185 "transient/moving_moments.h",
186 "transient/transient_detector.cc",
187 "transient/transient_detector.h",
188 "transient/transient_suppressor.cc",
189 "transient/transient_suppressor.h",
190 "transient/wpd_node.cc",
191 "transient/wpd_node.h",
192 "transient/wpd_tree.cc",
193 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000194 "typing_detection.cc",
195 "typing_detection.h",
minyue84db6fa2016-03-24 14:36:25 -0700196 "utility/block_mean_calculator.cc",
197 "utility/block_mean_calculator.h",
peahbdb7af62016-04-12 14:47:40 -0700198 "utility/delay_estimator.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000199 "utility/delay_estimator.h",
200 "utility/delay_estimator_internal.h",
peahbdb7af62016-04-12 14:47:40 -0700201 "utility/delay_estimator_wrapper.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000202 "utility/delay_estimator_wrapper.h",
peah81b92912016-10-06 06:46:20 -0700203 "utility/ooura_fft.cc",
204 "utility/ooura_fft.h",
205 "utility/ooura_fft_tables_common.h",
aluebsecf6b812015-06-25 12:28:48 -0700206 "vad/common.h",
207 "vad/gmm.cc",
208 "vad/gmm.h",
209 "vad/noise_gmm_tables.h",
210 "vad/pitch_based_vad.cc",
211 "vad/pitch_based_vad.h",
212 "vad/pitch_internal.cc",
213 "vad/pitch_internal.h",
214 "vad/pole_zero_filter.cc",
215 "vad/pole_zero_filter.h",
216 "vad/standalone_vad.cc",
217 "vad/standalone_vad.h",
218 "vad/vad_audio_proc.cc",
219 "vad/vad_audio_proc.h",
220 "vad/vad_audio_proc_internal.h",
221 "vad/vad_circular_buffer.cc",
222 "vad/vad_circular_buffer.h",
223 "vad/voice_activity_detector.cc",
224 "vad/voice_activity_detector.h",
225 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000226 "voice_detection_impl.cc",
227 "voice_detection_impl.h",
228 ]
229
230 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200231 deps = [
232 "../..:webrtc_common",
aleloi6321b492016-12-05 01:46:09 -0800233 "../../audio/utility:audio_frame_operations",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800234 "../../base:gtest_prod",
kwiberg98ab3a42015-09-30 21:54:21 -0700235 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200236 ]
kjellander7439f972016-12-05 22:47:46 -0800237 public_deps = [
238 ":audio_processing_c",
239 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000240
peahf28a3892016-09-01 08:58:21 -0700241 if (apm_debug_dump) {
242 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700243 } else {
peahf28a3892016-09-01 08:58:21 -0700244 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000245 }
246
247 if (aec_untrusted_delay_for_testing) {
248 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
249 }
250
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000251 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000252 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
253 deps += [ ":audioproc_debug_proto" ]
254 }
255
peah1bcfce52016-08-26 07:16:04 -0700256 if (rtc_enable_intelligibility_enhancer) {
257 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
258 sources += [
259 "intelligibility/intelligibility_enhancer.cc",
260 "intelligibility/intelligibility_enhancer.h",
261 "intelligibility/intelligibility_utils.cc",
262 "intelligibility/intelligibility_utils.h",
263 ]
264 } else {
265 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
266 }
267
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000268 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000269 defines += [ "WEBRTC_NS_FIXED" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000270 } else {
271 defines += [ "WEBRTC_NS_FLOAT" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000272 }
273
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000274 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000275 deps += [ ":audio_processing_sse2" ]
276 }
277
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700278 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000279 deps += [ ":audio_processing_neon" ]
280 }
281
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000282 if (current_cpu == "mipsel") {
peah27045122016-04-10 22:38:14 -0700283 sources += [ "aecm/aecm_core_mips.cc" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000284 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000285 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800286 "aec/aec_core_mips.cc",
peah81b92912016-10-06 06:46:20 -0700287 "utility/ooura_fft_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000288 ]
289 }
290 } else {
peah27045122016-04-10 22:38:14 -0700291 sources += [ "aecm/aecm_core_c.cc" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000292 }
293
kjellander8f4419b2016-06-02 02:09:52 -0700294 # TODO(jschuh): Bug 1348: fix this warning.
295 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000296
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000297 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000298 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000299 "../../common_audio",
300 "../../system_wrappers",
301 ]
302}
303
kjellander7439f972016-12-05 22:47:46 -0800304rtc_source_set("audio_processing_c") {
305 visibility = [ ":*" ] # Only targets in this file can depend on this.
306 sources = [
307 "agc/legacy/analog_agc.c",
308 "agc/legacy/analog_agc.h",
309 "agc/legacy/digital_agc.c",
310 "agc/legacy/digital_agc.h",
311 "agc/legacy/gain_control.h",
312 ]
313
314 if (rtc_prefer_fixed_point) {
315 sources += [
316 "ns/noise_suppression_x.c",
317 "ns/noise_suppression_x.h",
318 "ns/nsx_core.c",
319 "ns/nsx_core.h",
320 "ns/nsx_defines.h",
321 ]
322 if (current_cpu == "mipsel") {
323 sources += [ "ns/nsx_core_mips.c" ]
324 } else {
325 sources += [ "ns/nsx_core_c.c" ]
326 }
327 } else {
328 sources += [
329 "ns/defines.h",
330 "ns/noise_suppression.c",
331 "ns/noise_suppression.h",
332 "ns/ns_core.c",
333 "ns/ns_core.h",
334 "ns/windows_private.h",
335 ]
336 }
337
338 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800339 "../..:webrtc_common",
kjellander7439f972016-12-05 22:47:46 -0800340 "../../base:rtc_base_approved",
341 "../../common_audio",
342 "../../system_wrappers",
343 ]
mbonadeie5dc3ce2017-01-25 05:34:46 -0800344
345 if (rtc_build_with_neon) {
346 deps += [ ":audio_processing_neon_c" ]
347 }
kjellander7439f972016-12-05 22:47:46 -0800348}
349
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000350if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000351 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200352 sources = [
353 "debug.proto",
354 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000355
kjellander78ddd732016-02-09 08:13:06 -0800356 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000357 }
358}
359
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000360if (current_cpu == "x86" || current_cpu == "x64") {
kjellanderb62dbbe2016-09-23 00:38:52 -0700361 rtc_static_library("audio_processing_sse2") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800362 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
363 # Errors on cyclic dependency with :audio_processing if enabled.
364 check_includes = false
365
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000366 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800367 "aec/aec_core_sse2.cc",
peah81b92912016-10-06 06:46:20 -0700368 "utility/ooura_fft_sse2.cc",
369 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000370 ]
371
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200372 if (is_posix) {
373 cflags = [ "-msse2" ]
374 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000375
peahf28a3892016-09-01 08:58:21 -0700376 if (apm_debug_dump) {
377 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700378 } else {
peahf28a3892016-09-01 08:58:21 -0700379 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700380 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000381 }
382}
383
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700384if (rtc_build_with_neon) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700385 rtc_static_library("audio_processing_neon") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800386 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
387 # Errors on cyclic dependency with :audio_processing if enabled.
388 check_includes = false
389
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000390 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800391 "aec/aec_core_neon.cc",
peah27045122016-04-10 22:38:14 -0700392 "aecm/aecm_core_neon.cc",
peah81b92912016-10-06 06:46:20 -0700393 "utility/ooura_fft_neon.cc",
394 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000395 ]
396
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000397 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700398 # Enable compilation for the NEON instruction set. This is needed
399 # since //build/config/arm.gni only enables NEON for iOS, not Android.
400 # This provides the same functionality as webrtc/build/arm_neon.gypi.
ehmaldonado38a21322016-09-02 04:10:34 -0700401 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200402 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000403 }
404
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700405 # Disable LTO on NEON targets due to compiler bug.
406 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000407 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000408 cflags -= [
409 "-flto",
410 "-ffat-lto-objects",
411 ]
412 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700413
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700414 deps = [
415 "../../common_audio",
416 ]
kjellander7439f972016-12-05 22:47:46 -0800417 public_deps = [
418 ":audio_processing_neon_c",
419 ]
peahb46083e2016-05-03 07:01:18 -0700420
peahf28a3892016-09-01 08:58:21 -0700421 if (apm_debug_dump) {
422 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700423 } else {
peahf28a3892016-09-01 08:58:21 -0700424 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700425 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000426 }
kjellander7439f972016-12-05 22:47:46 -0800427
428 rtc_static_library("audio_processing_neon_c") {
mbonadeie5dc3ce2017-01-25 05:34:46 -0800429 # TODO(mbonadei): Remove (bugs.webrtc.org/6828)
430 # Errors on cyclic dependency with :audio_processing_c if enabled.
431 check_includes = false
432
kjellander7439f972016-12-05 22:47:46 -0800433 sources = [
434 "ns/nsx_core_neon.c",
435 ]
436
437 if (current_cpu != "arm64") {
438 # Enable compilation for the NEON instruction set. This is needed
439 # since //build/config/arm.gni only enables NEON for iOS, not Android.
440 # This provides the same functionality as webrtc/build/arm_neon.gypi.
441 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
442 cflags = [ "-mfpu=neon" ]
443 }
444
445 # Disable LTO on NEON targets due to compiler bug.
446 # TODO(fdegans): Enable this. See crbug.com/408997.
447 if (rtc_use_lto) {
448 cflags -= [
449 "-flto",
450 "-ffat-lto-objects",
451 ]
452 }
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800453 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800454 "../../base:rtc_base_approved",
455 ]
kjellander7439f972016-12-05 22:47:46 -0800456 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000457}
kjellanderfb114242016-06-13 00:19:48 -0700458
459if (rtc_include_tests) {
kjellander6ceab082016-10-28 05:44:03 -0700460 group("audio_processing_tests") {
461 testonly = true
462 public_deps = [
kjellander6ceab082016-10-28 05:44:03 -0700463 ":audioproc_test_utils",
464 ":click_annotate",
465 ":nonlinear_beamformer_test",
466 ":transient_suppression_test",
kjellander6ceab082016-10-28 05:44:03 -0700467 ]
468
469 if (rtc_enable_intelligibility_enhancer) {
470 public_deps += [ ":intelligibility_proc" ]
471 }
472
473 if (rtc_enable_protobuf) {
ehmaldonado1fd08c12017-01-17 02:37:34 -0800474 public_deps += [
475 ":audioproc_f",
476 ":audioproc_unittest_proto",
477 ":unpack_aecdump",
alessiob5f32aca2017-03-18 02:29:13 -0700478 "test/conversational_speech",
alessiob306d1bf2017-02-24 05:32:21 -0800479 "test/py_quality_assessment",
ehmaldonado1fd08c12017-01-17 02:37:34 -0800480 ]
kjellander6ceab082016-10-28 05:44:03 -0700481 }
482 }
483
ehmaldonado36268652017-01-19 08:27:11 -0800484 rtc_source_set("audio_processing_unittests") {
485 testonly = true
486 sources = [
487 "aec/echo_cancellation_unittest.cc",
488 "aec/system_delay_unittest.cc",
489 "agc/agc_manager_direct_unittest.cc",
490 "agc/loudness_histogram_unittest.cc",
491 "agc/mock_agc.h",
492 "audio_buffer_unittest.cc",
493 "beamformer/array_util_unittest.cc",
494 "beamformer/complex_matrix_unittest.cc",
495 "beamformer/covariance_matrix_generator_unittest.cc",
496 "beamformer/matrix_unittest.cc",
497 "beamformer/mock_nonlinear_beamformer.h",
ehmaldonado36268652017-01-19 08:27:11 -0800498 "config_unittest.cc",
499 "echo_cancellation_impl_unittest.cc",
500 "splitting_filter_unittest.cc",
501 "transient/dyadic_decimator_unittest.cc",
502 "transient/file_utils.cc",
503 "transient/file_utils.h",
504 "transient/file_utils_unittest.cc",
505 "transient/moving_moments_unittest.cc",
506 "transient/transient_detector_unittest.cc",
507 "transient/transient_suppressor_unittest.cc",
508 "transient/wpd_node_unittest.cc",
509 "transient/wpd_tree_unittest.cc",
510 "utility/block_mean_calculator_unittest.cc",
511 "utility/delay_estimator_unittest.cc",
512 "vad/gmm_unittest.cc",
513 "vad/pitch_based_vad_unittest.cc",
514 "vad/pitch_internal_unittest.cc",
515 "vad/pole_zero_filter_unittest.cc",
516 "vad/standalone_vad_unittest.cc",
517 "vad/vad_audio_proc_unittest.cc",
518 "vad/vad_circular_buffer_unittest.cc",
519 "vad/voice_activity_detector_unittest.cc",
520 ]
521
522 deps = [
523 ":audio_processing",
ehmaldonado36268652017-01-19 08:27:11 -0800524 ":audioproc_test_utils",
525 "../..:webrtc_common",
526 "../../base:gtest_prod",
527 "../../base:rtc_base",
528 "../../base:rtc_base_approved",
529 "../../common_audio:common_audio",
530 "../../system_wrappers:system_wrappers",
531 "../../test:test_support",
532 "../audio_coding:neteq_unittest_tools",
533 "//testing/gmock",
534 "//testing/gtest",
535 ]
536
537 defines = []
538
539 if (apm_debug_dump) {
540 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
541 } else {
542 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
543 }
544
545 if (rtc_enable_intelligibility_enhancer) {
546 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
547 sources += [
548 "intelligibility/intelligibility_enhancer_unittest.cc",
549 "intelligibility/intelligibility_utils_unittest.cc",
550 ]
551 } else {
552 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
553 }
554
555 if (rtc_prefer_fixed_point) {
556 defines += [ "WEBRTC_AUDIOPROC_FIXED_PROFILE" ]
557 } else {
558 defines += [ "WEBRTC_AUDIOPROC_FLOAT_PROFILE" ]
559 }
560
561 if (rtc_enable_protobuf) {
562 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
563 deps += [
ehmaldonadof49ff262017-01-23 04:26:02 -0800564 ":audioproc_debug_proto",
ehmaldonado36268652017-01-19 08:27:11 -0800565 ":audioproc_protobuf_utils",
566 ":audioproc_unittest_proto",
567 ]
568 sources += [
peah522d71b2017-02-23 05:16:26 -0800569 "aec3/adaptive_fir_filter_unittest.cc",
570 "aec3/aec3_fft_unittest.cc",
571 "aec3/aec_state_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800572 "aec3/block_framer_unittest.cc",
peahe985b3f2017-02-28 22:08:53 -0800573 "aec3/block_processor_metrics_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800574 "aec3/block_processor_unittest.cc",
575 "aec3/cascaded_biquad_filter_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800576 "aec3/comfort_noise_generator_unittest.cc",
peah21920892017-02-08 05:08:56 -0800577 "aec3/decimator_by_4_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800578 "aec3/echo_canceller3_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800579 "aec3/echo_path_delay_estimator_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800580 "aec3/echo_path_variability_unittest.cc",
peahe985b3f2017-02-28 22:08:53 -0800581 "aec3/echo_remover_metrics_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800582 "aec3/echo_remover_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800583 "aec3/erl_estimator_unittest.cc",
584 "aec3/erle_estimator_unittest.cc",
585 "aec3/fft_buffer_unittest.cc",
586 "aec3/fft_data_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800587 "aec3/frame_blocker_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800588 "aec3/main_filter_update_gain_unittest.cc",
peah21920892017-02-08 05:08:56 -0800589 "aec3/matched_filter_lag_aggregator_unittest.cc",
590 "aec3/matched_filter_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800591 "aec3/output_selector_unittest.cc",
592 "aec3/power_echo_model_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800593 "aec3/render_delay_buffer_unittest.cc",
peahe985b3f2017-02-28 22:08:53 -0800594 "aec3/render_delay_controller_metrics_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800595 "aec3/render_delay_controller_unittest.cc",
peah522d71b2017-02-23 05:16:26 -0800596 "aec3/render_signal_analyzer_unittest.cc",
597 "aec3/residual_echo_estimator_unittest.cc",
598 "aec3/shadow_filter_update_gain_unittest.cc",
599 "aec3/subtractor_unittest.cc",
600 "aec3/suppression_filter_unittest.cc",
601 "aec3/suppression_gain_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800602 "audio_processing_impl_locking_unittest.cc",
603 "audio_processing_impl_unittest.cc",
604 "audio_processing_unittest.cc",
ehmaldonadof49ff262017-01-23 04:26:02 -0800605 "beamformer/nonlinear_beamformer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800606 "echo_cancellation_bit_exact_unittest.cc",
607 "echo_control_mobile_unittest.cc",
608 "echo_detector/circular_buffer_unittest.cc",
609 "echo_detector/mean_variance_estimator_unittest.cc",
610 "echo_detector/moving_max_unittest.cc",
611 "echo_detector/normalized_covariance_estimator_unittest.cc",
612 "gain_control_unittest.cc",
613 "level_controller/level_controller_unittest.cc",
614 "level_estimator_unittest.cc",
615 "low_cut_filter_unittest.cc",
616 "noise_suppression_unittest.cc",
617 "residual_echo_detector_unittest.cc",
618 "rms_level_unittest.cc",
619 "test/bitexactness_tools.cc",
620 "test/bitexactness_tools.h",
621 "test/debug_dump_replayer.cc",
622 "test/debug_dump_replayer.h",
623 "test/debug_dump_test.cc",
peah69221db2017-01-27 03:28:19 -0800624 "test/echo_canceller_test_tools.cc",
625 "test/echo_canceller_test_tools.h",
626 "test/echo_canceller_test_tools_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800627 "test/test_utils.h",
628 "voice_detection_unittest.cc",
629 ]
630 }
631
632 if ((!build_with_chromium || is_win) && is_clang) {
633 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
634 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
635 }
636 }
637
ehmaldonado021eef32017-01-05 07:09:50 -0800638 rtc_source_set("audio_processing_perf_tests") {
639 # Has problems with autogenerated targets on Android and iOS
640 # Dependency chain (there may also be others):
641 # //webrtc/modules/audio_processing:audio_processing_perf_tests -->
642 # //webrtc/modules:modules_unittests --[private]-->
643 # //webrtc/modules:modules_unittests_apk -->
644 # //webrtc/modules:modules_unittests_apk__create -->
645 # //webrtc/modules:modules_unittests_apk__create__finalize -->
646 # //webrtc/modules:modules_unittests_apk__create__package --[private]-->
647 # //webrtc/modules:_modules_unittests__library
648 check_includes = false
649 testonly = true
650 sources = [
651 "audio_processing_performance_unittest.cc",
652 "level_controller/level_controller_complexity_unittest.cc",
653 "residual_echo_detector_complexity_unittest.cc",
654 ]
655 deps = [
656 ":audio_processing",
657 ":audioproc_test_utils",
658 "//testing/gtest",
659 ]
660 if (rtc_enable_intelligibility_enhancer) {
661 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
662 } else {
663 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
664 }
665 }
666
ehmaldonado1fd08c12017-01-17 02:37:34 -0800667 if (rtc_enable_protobuf) {
668 rtc_executable("unpack_aecdump") {
669 testonly = true
670 sources = [
671 "test/unpack.cc",
672 ]
peahc3ec1fd2016-08-07 23:19:30 -0700673
ehmaldonado1fd08c12017-01-17 02:37:34 -0800674 deps = [
675 ":audio_processing",
676 ":audioproc_debug_proto",
677 ":audioproc_protobuf_utils",
678 ":audioproc_test_utils",
679 "../..:webrtc_common",
680 "../../base:rtc_base_approved",
681 "../../common_audio",
682 "../../system_wrappers:system_wrappers_default",
683 "//third_party/gflags:gflags",
684 ]
685 } # unpack_aecdump
peahc3ec1fd2016-08-07 23:19:30 -0700686
ehmaldonado1fd08c12017-01-17 02:37:34 -0800687 rtc_executable("audioproc_f") {
688 testonly = true
689 sources = [
690 "test/aec_dump_based_simulator.cc",
691 "test/aec_dump_based_simulator.h",
692 "test/audio_processing_simulator.cc",
693 "test/audio_processing_simulator.h",
694 "test/audioproc_float.cc",
695 "test/wav_based_simulator.cc",
696 "test/wav_based_simulator.h",
697 ]
peahc3ec1fd2016-08-07 23:19:30 -0700698
ehmaldonado1fd08c12017-01-17 02:37:34 -0800699 deps = [
700 ":audio_processing",
701 ":audioproc_debug_proto",
702 ":audioproc_protobuf_utils",
703 ":audioproc_test_utils",
704 "../../base:rtc_base_approved",
705 "../../common_audio:common_audio",
706 "../../system_wrappers",
707 "../../system_wrappers:system_wrappers_default",
708 "../../test:test_support",
709 "//testing/gtest",
710 "//third_party/gflags:gflags",
711 ]
712 } # audioproc_f
713 }
peahc3ec1fd2016-08-07 23:19:30 -0700714
ehmaldonado38a21322016-09-02 04:10:34 -0700715 rtc_source_set("audioproc_test_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700716 testonly = true
717 sources = [
ehmaldonado529f83c2016-07-27 08:14:32 -0700718 "test/audio_buffer_tools.cc",
719 "test/audio_buffer_tools.h",
ivoc3cfb3ef2016-11-24 04:17:28 -0800720 "test/performance_timer.cc",
721 "test/performance_timer.h",
722 "test/simulator_buffers.cc",
723 "test/simulator_buffers.h",
kjellanderfb114242016-06-13 00:19:48 -0700724 "test/test_utils.cc",
725 "test/test_utils.h",
726 ]
727
kjellanderfb114242016-06-13 00:19:48 -0700728 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800729 ":audio_processing",
kjellanderfb114242016-06-13 00:19:48 -0700730 "../../base:rtc_base_approved",
731 "../../common_audio",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800732 "../../system_wrappers:system_wrappers",
kjellanderfb114242016-06-13 00:19:48 -0700733 ]
734 }
735
ehmaldonado38a21322016-09-02 04:10:34 -0700736 rtc_executable("transient_suppression_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700737 testonly = true
738 sources = [
739 "transient/file_utils.cc",
740 "transient/file_utils.h",
741 "transient/transient_suppression_test.cc",
742 ]
743 deps = [
744 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800745 "../..:webrtc_common",
746 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700747 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800748 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700749 "../../test:test_support",
750 "//testing/gtest",
751 "//third_party/gflags",
752 ]
kwiberg7a770e02016-08-25 02:32:43 -0700753 }
754
ehmaldonado38a21322016-09-02 04:10:34 -0700755 rtc_executable("click_annotate") {
kwiberg7a770e02016-08-25 02:32:43 -0700756 testonly = true
757 sources = [
758 "transient/click_annotate.cc",
759 "transient/file_utils.cc",
760 "transient/file_utils.h",
761 ]
762 deps = [
763 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800764 "../..:webrtc_common",
kwiberg7a770e02016-08-25 02:32:43 -0700765 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800766 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700767 ]
768 }
769
ehmaldonado38a21322016-09-02 04:10:34 -0700770 rtc_executable("nonlinear_beamformer_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700771 testonly = true
772 sources = [
773 "beamformer/nonlinear_beamformer_test.cc",
774 ]
775 deps = [
776 ":audio_processing",
777 ":audioproc_test_utils",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800778 "../../base:rtc_base_approved",
779 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700780 "../../system_wrappers:metrics_default",
781 "//third_party/gflags",
782 ]
kwiberg7a770e02016-08-25 02:32:43 -0700783 }
784
peah1bcfce52016-08-26 07:16:04 -0700785 if (rtc_enable_intelligibility_enhancer) {
ehmaldonado38a21322016-09-02 04:10:34 -0700786 rtc_executable("intelligibility_proc") {
peah1bcfce52016-08-26 07:16:04 -0700787 testonly = true
788 sources = [
789 "intelligibility/test/intelligibility_proc.cc",
790 ]
791 deps = [
792 ":audio_processing",
793 ":audioproc_test_utils",
794 "../../system_wrappers:metrics_default",
795 "../../test:test_support",
796 "//testing/gtest",
797 "//third_party/gflags",
798 ]
kwiberg7a770e02016-08-25 02:32:43 -0700799 }
800 }
801
kjellanderfb114242016-06-13 00:19:48 -0700802 if (rtc_enable_protobuf) {
803 proto_library("audioproc_unittest_proto") {
804 sources = [
805 "test/unittest.proto",
806 ]
kjellandere3e902e2017-02-28 08:01:46 -0800807 proto_out_dir = "webrtc/modules/audio_processing/test"
kjellanderfb114242016-06-13 00:19:48 -0700808 }
809
kjellanderb62dbbe2016-09-23 00:38:52 -0700810 rtc_static_library("audioproc_protobuf_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700811 sources = [
812 "test/protobuf_utils.cc",
813 "test/protobuf_utils.h",
814 ]
815
816 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700817 ":audioproc_debug_proto",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800818 "../..:webrtc_common",
819 "../../base:rtc_base_approved",
kjellanderfb114242016-06-13 00:19:48 -0700820 ]
821 }
822 }
823}