blob: dfedbee11ca304e7195a9a1df620ed37db090ae6 [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",
peah69221db2017-01-27 03:28:19 -080038 "aec3/echo_path_delay_estimator.cc",
39 "aec3/echo_path_delay_estimator.h",
40 "aec3/echo_path_variability.h",
41 "aec3/echo_remover.cc",
42 "aec3/echo_remover.h",
peahd0263542017-01-03 04:20:34 -080043 "aec3/frame_blocker.cc",
44 "aec3/frame_blocker.h",
peah69221db2017-01-27 03:28:19 -080045 "aec3/render_delay_buffer.cc",
46 "aec3/render_delay_buffer.h",
47 "aec3/render_delay_controller.cc",
48 "aec3/render_delay_controller.h",
peah27045122016-04-10 22:38:14 -070049 "aecm/aecm_core.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000050 "aecm/aecm_core.h",
peah27045122016-04-10 22:38:14 -070051 "aecm/echo_control_mobile.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010052 "aecm/echo_control_mobile.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000053 "agc/agc.cc",
54 "agc/agc.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000055 "agc/agc_manager_direct.cc",
56 "agc/agc_manager_direct.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000057 "agc/gain_map_internal.h",
peahbbe42332016-06-08 06:42:02 -070058 "agc/loudness_histogram.cc",
59 "agc/loudness_histogram.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000060 "agc/utility.cc",
61 "agc/utility.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000062 "audio_buffer.cc",
63 "audio_buffer.h",
64 "audio_processing_impl.cc",
65 "audio_processing_impl.h",
aluebs4a66e4a2015-10-19 18:02:39 -070066 "beamformer/array_util.cc",
67 "beamformer/array_util.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +000068 "beamformer/complex_matrix.h",
69 "beamformer/covariance_matrix_generator.cc",
70 "beamformer/covariance_matrix_generator.h",
71 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +000072 "beamformer/nonlinear_beamformer.cc",
73 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000074 "common.h",
75 "echo_cancellation_impl.cc",
76 "echo_cancellation_impl.h",
77 "echo_control_mobile_impl.cc",
78 "echo_control_mobile_impl.h",
ivocaf27ed02016-10-28 07:04:03 -070079 "echo_detector/circular_buffer.cc",
80 "echo_detector/circular_buffer.h",
81 "echo_detector/mean_variance_estimator.cc",
82 "echo_detector/mean_variance_estimator.h",
ivoc4e477a12017-01-15 08:29:46 -080083 "echo_detector/moving_max.cc",
84 "echo_detector/moving_max.h",
ivocaf27ed02016-10-28 07:04:03 -070085 "echo_detector/normalized_covariance_estimator.cc",
86 "echo_detector/normalized_covariance_estimator.h",
peahbe615622016-02-13 16:40:47 -080087 "gain_control_for_experimental_agc.cc",
88 "gain_control_for_experimental_agc.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000089 "gain_control_impl.cc",
90 "gain_control_impl.h",
peahc19f3122016-10-07 14:54:10 -070091 "include/audio_processing.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000092 "include/audio_processing.h",
solenberg88499ec2016-09-07 07:34:41 -070093 "include/config.cc",
94 "include/config.h",
peahca4cac72016-06-29 15:26:12 -070095 "level_controller/biquad_filter.cc",
96 "level_controller/biquad_filter.h",
97 "level_controller/down_sampler.cc",
98 "level_controller/down_sampler.h",
99 "level_controller/gain_applier.cc",
100 "level_controller/gain_applier.h",
101 "level_controller/gain_selector.cc",
102 "level_controller/gain_selector.h",
peahca4cac72016-06-29 15:26:12 -0700103 "level_controller/level_controller.cc",
104 "level_controller/level_controller.h",
peahc19f3122016-10-07 14:54:10 -0700105 "level_controller/level_controller_constants.h",
peahca4cac72016-06-29 15:26:12 -0700106 "level_controller/noise_level_estimator.cc",
107 "level_controller/noise_level_estimator.h",
108 "level_controller/noise_spectrum_estimator.cc",
109 "level_controller/noise_spectrum_estimator.h",
110 "level_controller/peak_level_estimator.cc",
111 "level_controller/peak_level_estimator.h",
112 "level_controller/saturating_gain_estimator.cc",
113 "level_controller/saturating_gain_estimator.h",
114 "level_controller/signal_classifier.cc",
115 "level_controller/signal_classifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000116 "level_estimator_impl.cc",
117 "level_estimator_impl.h",
peahb46083e2016-05-03 07:01:18 -0700118 "logging/apm_data_dumper.cc",
119 "logging/apm_data_dumper.h",
peah8271d042016-11-22 07:24:52 -0800120 "low_cut_filter.cc",
121 "low_cut_filter.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000122 "noise_suppression_impl.cc",
123 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -0800124 "render_queue_item_verifier.h",
ivoc9f4a4a02016-10-28 05:39:16 -0700125 "residual_echo_detector.cc",
126 "residual_echo_detector.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000127 "rms_level.cc",
128 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +0000129 "splitting_filter.cc",
130 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -0700131 "three_band_filter_bank.cc",
132 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000133 "transient/common.h",
134 "transient/daubechies_8_wavelet_coeffs.h",
135 "transient/dyadic_decimator.h",
136 "transient/moving_moments.cc",
137 "transient/moving_moments.h",
138 "transient/transient_detector.cc",
139 "transient/transient_detector.h",
140 "transient/transient_suppressor.cc",
141 "transient/transient_suppressor.h",
142 "transient/wpd_node.cc",
143 "transient/wpd_node.h",
144 "transient/wpd_tree.cc",
145 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000146 "typing_detection.cc",
147 "typing_detection.h",
minyue84db6fa2016-03-24 14:36:25 -0700148 "utility/block_mean_calculator.cc",
149 "utility/block_mean_calculator.h",
peahbdb7af62016-04-12 14:47:40 -0700150 "utility/delay_estimator.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000151 "utility/delay_estimator.h",
152 "utility/delay_estimator_internal.h",
peahbdb7af62016-04-12 14:47:40 -0700153 "utility/delay_estimator_wrapper.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000154 "utility/delay_estimator_wrapper.h",
peah81b92912016-10-06 06:46:20 -0700155 "utility/ooura_fft.cc",
156 "utility/ooura_fft.h",
157 "utility/ooura_fft_tables_common.h",
aluebsecf6b812015-06-25 12:28:48 -0700158 "vad/common.h",
159 "vad/gmm.cc",
160 "vad/gmm.h",
161 "vad/noise_gmm_tables.h",
162 "vad/pitch_based_vad.cc",
163 "vad/pitch_based_vad.h",
164 "vad/pitch_internal.cc",
165 "vad/pitch_internal.h",
166 "vad/pole_zero_filter.cc",
167 "vad/pole_zero_filter.h",
168 "vad/standalone_vad.cc",
169 "vad/standalone_vad.h",
170 "vad/vad_audio_proc.cc",
171 "vad/vad_audio_proc.h",
172 "vad/vad_audio_proc_internal.h",
173 "vad/vad_circular_buffer.cc",
174 "vad/vad_circular_buffer.h",
175 "vad/voice_activity_detector.cc",
176 "vad/voice_activity_detector.h",
177 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000178 "voice_detection_impl.cc",
179 "voice_detection_impl.h",
180 ]
181
182 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200183 deps = [
184 "../..:webrtc_common",
aleloi6321b492016-12-05 01:46:09 -0800185 "../../audio/utility:audio_frame_operations",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800186 "../../base:gtest_prod",
kwiberg98ab3a42015-09-30 21:54:21 -0700187 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200188 ]
kjellander7439f972016-12-05 22:47:46 -0800189 public_deps = [
190 ":audio_processing_c",
191 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000192
peahf28a3892016-09-01 08:58:21 -0700193 if (apm_debug_dump) {
194 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700195 } else {
peahf28a3892016-09-01 08:58:21 -0700196 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000197 }
198
199 if (aec_untrusted_delay_for_testing) {
200 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
201 }
202
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000203 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000204 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
205 deps += [ ":audioproc_debug_proto" ]
206 }
207
peah1bcfce52016-08-26 07:16:04 -0700208 if (rtc_enable_intelligibility_enhancer) {
209 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
210 sources += [
211 "intelligibility/intelligibility_enhancer.cc",
212 "intelligibility/intelligibility_enhancer.h",
213 "intelligibility/intelligibility_utils.cc",
214 "intelligibility/intelligibility_utils.h",
215 ]
216 } else {
217 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
218 }
219
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000220 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000221 defines += [ "WEBRTC_NS_FIXED" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000222 } else {
223 defines += [ "WEBRTC_NS_FLOAT" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000224 }
225
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000226 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000227 deps += [ ":audio_processing_sse2" ]
228 }
229
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700230 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000231 deps += [ ":audio_processing_neon" ]
232 }
233
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000234 if (current_cpu == "mipsel") {
peah27045122016-04-10 22:38:14 -0700235 sources += [ "aecm/aecm_core_mips.cc" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000236 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000237 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800238 "aec/aec_core_mips.cc",
peah81b92912016-10-06 06:46:20 -0700239 "utility/ooura_fft_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000240 ]
241 }
242 } else {
peah27045122016-04-10 22:38:14 -0700243 sources += [ "aecm/aecm_core_c.cc" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000244 }
245
kjellander8f4419b2016-06-02 02:09:52 -0700246 # TODO(jschuh): Bug 1348: fix this warning.
247 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000248
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000249 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000250 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000251 "../../common_audio",
252 "../../system_wrappers",
253 ]
254}
255
kjellander7439f972016-12-05 22:47:46 -0800256rtc_source_set("audio_processing_c") {
257 visibility = [ ":*" ] # Only targets in this file can depend on this.
258 sources = [
259 "agc/legacy/analog_agc.c",
260 "agc/legacy/analog_agc.h",
261 "agc/legacy/digital_agc.c",
262 "agc/legacy/digital_agc.h",
263 "agc/legacy/gain_control.h",
264 ]
265
266 if (rtc_prefer_fixed_point) {
267 sources += [
268 "ns/noise_suppression_x.c",
269 "ns/noise_suppression_x.h",
270 "ns/nsx_core.c",
271 "ns/nsx_core.h",
272 "ns/nsx_defines.h",
273 ]
274 if (current_cpu == "mipsel") {
275 sources += [ "ns/nsx_core_mips.c" ]
276 } else {
277 sources += [ "ns/nsx_core_c.c" ]
278 }
279 } else {
280 sources += [
281 "ns/defines.h",
282 "ns/noise_suppression.c",
283 "ns/noise_suppression.h",
284 "ns/ns_core.c",
285 "ns/ns_core.h",
286 "ns/windows_private.h",
287 ]
288 }
289
290 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800291 "../..:webrtc_common",
kjellander7439f972016-12-05 22:47:46 -0800292 "../../base:rtc_base_approved",
293 "../../common_audio",
294 "../../system_wrappers",
295 ]
mbonadeie5dc3ce2017-01-25 05:34:46 -0800296
297 if (rtc_build_with_neon) {
298 deps += [ ":audio_processing_neon_c" ]
299 }
kjellander7439f972016-12-05 22:47:46 -0800300}
301
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000302if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000303 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200304 sources = [
305 "debug.proto",
306 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000307
kjellander78ddd732016-02-09 08:13:06 -0800308 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000309 }
310}
311
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000312if (current_cpu == "x86" || current_cpu == "x64") {
kjellanderb62dbbe2016-09-23 00:38:52 -0700313 rtc_static_library("audio_processing_sse2") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800314 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
315 # Errors on cyclic dependency with :audio_processing if enabled.
316 check_includes = false
317
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000318 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800319 "aec/aec_core_sse2.cc",
peah81b92912016-10-06 06:46:20 -0700320 "utility/ooura_fft_sse2.cc",
321 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000322 ]
323
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200324 if (is_posix) {
325 cflags = [ "-msse2" ]
326 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000327
peahf28a3892016-09-01 08:58:21 -0700328 if (apm_debug_dump) {
329 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700330 } else {
peahf28a3892016-09-01 08:58:21 -0700331 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700332 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000333 }
334}
335
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700336if (rtc_build_with_neon) {
kjellanderb62dbbe2016-09-23 00:38:52 -0700337 rtc_static_library("audio_processing_neon") {
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800338 # TODO(ehmaldonado): Remove (bugs.webrtc.org/6828)
339 # Errors on cyclic dependency with :audio_processing if enabled.
340 check_includes = false
341
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000342 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800343 "aec/aec_core_neon.cc",
peah27045122016-04-10 22:38:14 -0700344 "aecm/aecm_core_neon.cc",
peah81b92912016-10-06 06:46:20 -0700345 "utility/ooura_fft_neon.cc",
346 "utility/ooura_fft_tables_neon_sse2.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000347 ]
348
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000349 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700350 # Enable compilation for the NEON instruction set. This is needed
351 # since //build/config/arm.gni only enables NEON for iOS, not Android.
352 # This provides the same functionality as webrtc/build/arm_neon.gypi.
ehmaldonado38a21322016-09-02 04:10:34 -0700353 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200354 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000355 }
356
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700357 # Disable LTO on NEON targets due to compiler bug.
358 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000359 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000360 cflags -= [
361 "-flto",
362 "-ffat-lto-objects",
363 ]
364 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700365
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700366 deps = [
367 "../../common_audio",
368 ]
kjellander7439f972016-12-05 22:47:46 -0800369 public_deps = [
370 ":audio_processing_neon_c",
371 ]
peahb46083e2016-05-03 07:01:18 -0700372
peahf28a3892016-09-01 08:58:21 -0700373 if (apm_debug_dump) {
374 defines = [ "WEBRTC_APM_DEBUG_DUMP=1" ]
peahb46083e2016-05-03 07:01:18 -0700375 } else {
peahf28a3892016-09-01 08:58:21 -0700376 defines = [ "WEBRTC_APM_DEBUG_DUMP=0" ]
peahb46083e2016-05-03 07:01:18 -0700377 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000378 }
kjellander7439f972016-12-05 22:47:46 -0800379
380 rtc_static_library("audio_processing_neon_c") {
mbonadeie5dc3ce2017-01-25 05:34:46 -0800381 # TODO(mbonadei): Remove (bugs.webrtc.org/6828)
382 # Errors on cyclic dependency with :audio_processing_c if enabled.
383 check_includes = false
384
kjellander7439f972016-12-05 22:47:46 -0800385 sources = [
386 "ns/nsx_core_neon.c",
387 ]
388
389 if (current_cpu != "arm64") {
390 # Enable compilation for the NEON instruction set. This is needed
391 # since //build/config/arm.gni only enables NEON for iOS, not Android.
392 # This provides the same functionality as webrtc/build/arm_neon.gypi.
393 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
394 cflags = [ "-mfpu=neon" ]
395 }
396
397 # Disable LTO on NEON targets due to compiler bug.
398 # TODO(fdegans): Enable this. See crbug.com/408997.
399 if (rtc_use_lto) {
400 cflags -= [
401 "-flto",
402 "-ffat-lto-objects",
403 ]
404 }
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800405 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800406 "../../base:rtc_base_approved",
407 ]
kjellander7439f972016-12-05 22:47:46 -0800408 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000409}
kjellanderfb114242016-06-13 00:19:48 -0700410
411if (rtc_include_tests) {
kjellander6ceab082016-10-28 05:44:03 -0700412 group("audio_processing_tests") {
413 testonly = true
414 public_deps = [
kjellander6ceab082016-10-28 05:44:03 -0700415 ":audioproc_test_utils",
416 ":click_annotate",
417 ":nonlinear_beamformer_test",
418 ":transient_suppression_test",
kjellander6ceab082016-10-28 05:44:03 -0700419 ]
420
421 if (rtc_enable_intelligibility_enhancer) {
422 public_deps += [ ":intelligibility_proc" ]
423 }
424
425 if (rtc_enable_protobuf) {
ehmaldonado1fd08c12017-01-17 02:37:34 -0800426 public_deps += [
427 ":audioproc_f",
428 ":audioproc_unittest_proto",
429 ":unpack_aecdump",
430 ]
kjellander6ceab082016-10-28 05:44:03 -0700431 }
432 }
433
ehmaldonado36268652017-01-19 08:27:11 -0800434 rtc_source_set("audio_processing_unittests") {
435 testonly = true
436 sources = [
437 "aec/echo_cancellation_unittest.cc",
438 "aec/system_delay_unittest.cc",
439 "agc/agc_manager_direct_unittest.cc",
440 "agc/loudness_histogram_unittest.cc",
441 "agc/mock_agc.h",
442 "audio_buffer_unittest.cc",
443 "beamformer/array_util_unittest.cc",
444 "beamformer/complex_matrix_unittest.cc",
445 "beamformer/covariance_matrix_generator_unittest.cc",
446 "beamformer/matrix_unittest.cc",
447 "beamformer/mock_nonlinear_beamformer.h",
ehmaldonado36268652017-01-19 08:27:11 -0800448 "config_unittest.cc",
449 "echo_cancellation_impl_unittest.cc",
450 "splitting_filter_unittest.cc",
451 "transient/dyadic_decimator_unittest.cc",
452 "transient/file_utils.cc",
453 "transient/file_utils.h",
454 "transient/file_utils_unittest.cc",
455 "transient/moving_moments_unittest.cc",
456 "transient/transient_detector_unittest.cc",
457 "transient/transient_suppressor_unittest.cc",
458 "transient/wpd_node_unittest.cc",
459 "transient/wpd_tree_unittest.cc",
460 "utility/block_mean_calculator_unittest.cc",
461 "utility/delay_estimator_unittest.cc",
462 "vad/gmm_unittest.cc",
463 "vad/pitch_based_vad_unittest.cc",
464 "vad/pitch_internal_unittest.cc",
465 "vad/pole_zero_filter_unittest.cc",
466 "vad/standalone_vad_unittest.cc",
467 "vad/vad_audio_proc_unittest.cc",
468 "vad/vad_circular_buffer_unittest.cc",
469 "vad/voice_activity_detector_unittest.cc",
470 ]
471
472 deps = [
473 ":audio_processing",
ehmaldonado36268652017-01-19 08:27:11 -0800474 ":audioproc_test_utils",
475 "../..:webrtc_common",
476 "../../base:gtest_prod",
477 "../../base:rtc_base",
478 "../../base:rtc_base_approved",
479 "../../common_audio:common_audio",
480 "../../system_wrappers:system_wrappers",
481 "../../test:test_support",
482 "../audio_coding:neteq_unittest_tools",
483 "//testing/gmock",
484 "//testing/gtest",
485 ]
486
487 defines = []
488
489 if (apm_debug_dump) {
490 defines += [ "WEBRTC_APM_DEBUG_DUMP=1" ]
491 } else {
492 defines += [ "WEBRTC_APM_DEBUG_DUMP=0" ]
493 }
494
495 if (rtc_enable_intelligibility_enhancer) {
496 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
497 sources += [
498 "intelligibility/intelligibility_enhancer_unittest.cc",
499 "intelligibility/intelligibility_utils_unittest.cc",
500 ]
501 } else {
502 defines += [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
503 }
504
505 if (rtc_prefer_fixed_point) {
506 defines += [ "WEBRTC_AUDIOPROC_FIXED_PROFILE" ]
507 } else {
508 defines += [ "WEBRTC_AUDIOPROC_FLOAT_PROFILE" ]
509 }
510
511 if (rtc_enable_protobuf) {
512 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
513 deps += [
ehmaldonadof49ff262017-01-23 04:26:02 -0800514 ":audioproc_debug_proto",
ehmaldonado36268652017-01-19 08:27:11 -0800515 ":audioproc_protobuf_utils",
516 ":audioproc_unittest_proto",
517 ]
518 sources += [
519 "aec3/block_framer_unittest.cc",
520 "aec3/block_processor_unittest.cc",
521 "aec3/cascaded_biquad_filter_unittest.cc",
522 "aec3/echo_canceller3_unittest.cc",
peah69221db2017-01-27 03:28:19 -0800523 "aec3/echo_path_delay_estimator_unittest.cc",
524 "aec3/echo_remover_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800525 "aec3/frame_blocker_unittest.cc",
526 "aec3/mock/mock_block_processor.h",
peah69221db2017-01-27 03:28:19 -0800527 "aec3/mock/mock_echo_remover.h",
528 "aec3/mock/mock_render_delay_buffer.h",
529 "aec3/mock/mock_render_delay_controller.h",
530 "aec3/render_delay_buffer_unittest.cc",
531 "aec3/render_delay_controller_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800532 "audio_processing_impl_locking_unittest.cc",
533 "audio_processing_impl_unittest.cc",
534 "audio_processing_unittest.cc",
ehmaldonadof49ff262017-01-23 04:26:02 -0800535 "beamformer/nonlinear_beamformer_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800536 "echo_cancellation_bit_exact_unittest.cc",
537 "echo_control_mobile_unittest.cc",
538 "echo_detector/circular_buffer_unittest.cc",
539 "echo_detector/mean_variance_estimator_unittest.cc",
540 "echo_detector/moving_max_unittest.cc",
541 "echo_detector/normalized_covariance_estimator_unittest.cc",
542 "gain_control_unittest.cc",
543 "level_controller/level_controller_unittest.cc",
544 "level_estimator_unittest.cc",
545 "low_cut_filter_unittest.cc",
546 "noise_suppression_unittest.cc",
547 "residual_echo_detector_unittest.cc",
548 "rms_level_unittest.cc",
549 "test/bitexactness_tools.cc",
550 "test/bitexactness_tools.h",
551 "test/debug_dump_replayer.cc",
552 "test/debug_dump_replayer.h",
553 "test/debug_dump_test.cc",
peah69221db2017-01-27 03:28:19 -0800554 "test/echo_canceller_test_tools.cc",
555 "test/echo_canceller_test_tools.h",
556 "test/echo_canceller_test_tools_unittest.cc",
ehmaldonado36268652017-01-19 08:27:11 -0800557 "test/test_utils.h",
558 "voice_detection_unittest.cc",
559 ]
560 }
561
562 if ((!build_with_chromium || is_win) && is_clang) {
563 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
564 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
565 }
566 }
567
ehmaldonado021eef32017-01-05 07:09:50 -0800568 rtc_source_set("audio_processing_perf_tests") {
569 # Has problems with autogenerated targets on Android and iOS
570 # Dependency chain (there may also be others):
571 # //webrtc/modules/audio_processing:audio_processing_perf_tests -->
572 # //webrtc/modules:modules_unittests --[private]-->
573 # //webrtc/modules:modules_unittests_apk -->
574 # //webrtc/modules:modules_unittests_apk__create -->
575 # //webrtc/modules:modules_unittests_apk__create__finalize -->
576 # //webrtc/modules:modules_unittests_apk__create__package --[private]-->
577 # //webrtc/modules:_modules_unittests__library
578 check_includes = false
579 testonly = true
580 sources = [
581 "audio_processing_performance_unittest.cc",
582 "level_controller/level_controller_complexity_unittest.cc",
583 "residual_echo_detector_complexity_unittest.cc",
584 ]
585 deps = [
586 ":audio_processing",
587 ":audioproc_test_utils",
588 "//testing/gtest",
589 ]
590 if (rtc_enable_intelligibility_enhancer) {
591 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=1" ]
592 } else {
593 defines = [ "WEBRTC_INTELLIGIBILITY_ENHANCER=0" ]
594 }
595 }
596
ehmaldonado1fd08c12017-01-17 02:37:34 -0800597 if (rtc_enable_protobuf) {
598 rtc_executable("unpack_aecdump") {
599 testonly = true
600 sources = [
601 "test/unpack.cc",
602 ]
peahc3ec1fd2016-08-07 23:19:30 -0700603
ehmaldonado1fd08c12017-01-17 02:37:34 -0800604 deps = [
605 ":audio_processing",
606 ":audioproc_debug_proto",
607 ":audioproc_protobuf_utils",
608 ":audioproc_test_utils",
609 "../..:webrtc_common",
610 "../../base:rtc_base_approved",
611 "../../common_audio",
612 "../../system_wrappers:system_wrappers_default",
613 "//third_party/gflags:gflags",
614 ]
615 } # unpack_aecdump
peahc3ec1fd2016-08-07 23:19:30 -0700616
ehmaldonado1fd08c12017-01-17 02:37:34 -0800617 rtc_executable("audioproc_f") {
618 testonly = true
619 sources = [
620 "test/aec_dump_based_simulator.cc",
621 "test/aec_dump_based_simulator.h",
622 "test/audio_processing_simulator.cc",
623 "test/audio_processing_simulator.h",
624 "test/audioproc_float.cc",
625 "test/wav_based_simulator.cc",
626 "test/wav_based_simulator.h",
627 ]
peahc3ec1fd2016-08-07 23:19:30 -0700628
ehmaldonado1fd08c12017-01-17 02:37:34 -0800629 deps = [
630 ":audio_processing",
631 ":audioproc_debug_proto",
632 ":audioproc_protobuf_utils",
633 ":audioproc_test_utils",
634 "../../base:rtc_base_approved",
635 "../../common_audio:common_audio",
636 "../../system_wrappers",
637 "../../system_wrappers:system_wrappers_default",
638 "../../test:test_support",
639 "//testing/gtest",
640 "//third_party/gflags:gflags",
641 ]
642 } # audioproc_f
643 }
peahc3ec1fd2016-08-07 23:19:30 -0700644
ehmaldonado38a21322016-09-02 04:10:34 -0700645 rtc_source_set("audioproc_test_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700646 testonly = true
647 sources = [
ehmaldonado529f83c2016-07-27 08:14:32 -0700648 "test/audio_buffer_tools.cc",
649 "test/audio_buffer_tools.h",
ivoc3cfb3ef2016-11-24 04:17:28 -0800650 "test/performance_timer.cc",
651 "test/performance_timer.h",
652 "test/simulator_buffers.cc",
653 "test/simulator_buffers.h",
kjellanderfb114242016-06-13 00:19:48 -0700654 "test/test_utils.cc",
655 "test/test_utils.h",
656 ]
657
kjellanderfb114242016-06-13 00:19:48 -0700658 deps = [
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800659 ":audio_processing",
kjellanderfb114242016-06-13 00:19:48 -0700660 "../../base:rtc_base_approved",
661 "../../common_audio",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800662 "../../system_wrappers:system_wrappers",
kjellanderfb114242016-06-13 00:19:48 -0700663 ]
664 }
665
ehmaldonado38a21322016-09-02 04:10:34 -0700666 rtc_executable("transient_suppression_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700667 testonly = true
668 sources = [
669 "transient/file_utils.cc",
670 "transient/file_utils.h",
671 "transient/transient_suppression_test.cc",
672 ]
673 deps = [
674 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800675 "../..:webrtc_common",
676 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700677 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800678 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700679 "../../test:test_support",
680 "//testing/gtest",
681 "//third_party/gflags",
682 ]
kwiberg7a770e02016-08-25 02:32:43 -0700683 }
684
ehmaldonado38a21322016-09-02 04:10:34 -0700685 rtc_executable("click_annotate") {
kwiberg7a770e02016-08-25 02:32:43 -0700686 testonly = true
687 sources = [
688 "transient/click_annotate.cc",
689 "transient/file_utils.cc",
690 "transient/file_utils.h",
691 ]
692 deps = [
693 ":audio_processing",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800694 "../..:webrtc_common",
kwiberg7a770e02016-08-25 02:32:43 -0700695 "../../system_wrappers:metrics_default",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800696 "../../system_wrappers:system_wrappers",
kwiberg7a770e02016-08-25 02:32:43 -0700697 ]
698 }
699
ehmaldonado38a21322016-09-02 04:10:34 -0700700 rtc_executable("nonlinear_beamformer_test") {
kwiberg7a770e02016-08-25 02:32:43 -0700701 testonly = true
702 sources = [
703 "beamformer/nonlinear_beamformer_test.cc",
704 ]
705 deps = [
706 ":audio_processing",
707 ":audioproc_test_utils",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800708 "../../base:rtc_base_approved",
709 "../../common_audio:common_audio",
kwiberg7a770e02016-08-25 02:32:43 -0700710 "../../system_wrappers:metrics_default",
711 "//third_party/gflags",
712 ]
kwiberg7a770e02016-08-25 02:32:43 -0700713 }
714
peah1bcfce52016-08-26 07:16:04 -0700715 if (rtc_enable_intelligibility_enhancer) {
ehmaldonado38a21322016-09-02 04:10:34 -0700716 rtc_executable("intelligibility_proc") {
peah1bcfce52016-08-26 07:16:04 -0700717 testonly = true
718 sources = [
719 "intelligibility/test/intelligibility_proc.cc",
720 ]
721 deps = [
722 ":audio_processing",
723 ":audioproc_test_utils",
724 "../../system_wrappers:metrics_default",
725 "../../test:test_support",
726 "//testing/gtest",
727 "//third_party/gflags",
728 ]
kwiberg7a770e02016-08-25 02:32:43 -0700729 }
730 }
731
kjellanderfb114242016-06-13 00:19:48 -0700732 if (rtc_enable_protobuf) {
733 proto_library("audioproc_unittest_proto") {
734 sources = [
735 "test/unittest.proto",
736 ]
737 proto_out_dir = "webrtc/modules/audio_processing"
738 }
739
kjellanderb62dbbe2016-09-23 00:38:52 -0700740 rtc_static_library("audioproc_protobuf_utils") {
kjellanderfb114242016-06-13 00:19:48 -0700741 sources = [
742 "test/protobuf_utils.cc",
743 "test/protobuf_utils.h",
744 ]
745
746 deps = [
ehmaldonadobcba64a2016-08-19 02:11:07 -0700747 ":audioproc_debug_proto",
ehmaldonado64c4a7e2016-12-08 04:10:01 -0800748 "../..:webrtc_common",
749 "../../base:rtc_base_approved",
kjellanderfb114242016-06-13 00:19:48 -0700750 ]
751 }
752 }
753}