blob: 6eb5be87e749dc4a38022f17afe134d3ef3643e3 [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")
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000011import("../../build/webrtc.gni")
12
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000013declare_args() {
14 # Outputs some low-level debug files.
15 aec_debug_dump = false
16
17 # Disables the usual mode where we trust the reported system delay
18 # values the AEC receives. The corresponding define is set appropriately
19 # in the code, but it can be force-enabled here for testing.
20 aec_untrusted_delay_for_testing = false
21}
22
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +000023source_set("audio_processing") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000024 sources = [
peah8df5d4f2016-02-23 14:34:59 -080025 "aec/aec_core.cc",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000026 "aec/aec_core.h",
peahe687f782016-05-09 03:57:33 -070027 "aec/aec_core_optimized_methods.h",
peah21a395d2016-04-13 07:53:48 -070028 "aec/aec_rdft.cc",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000029 "aec/aec_rdft.h",
peah88950cf2016-03-04 00:12:40 -080030 "aec/aec_resampler.cc",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000031 "aec/aec_resampler.h",
peah8df5d4f2016-02-23 14:34:59 -080032 "aec/echo_cancellation.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010033 "aec/echo_cancellation.h",
peah27045122016-04-10 22:38:14 -070034 "aecm/aecm_core.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000035 "aecm/aecm_core.h",
peah27045122016-04-10 22:38:14 -070036 "aecm/echo_control_mobile.cc",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010037 "aecm/echo_control_mobile.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000038 "agc/agc.cc",
39 "agc/agc.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000040 "agc/agc_manager_direct.cc",
41 "agc/agc_manager_direct.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000042 "agc/gain_map_internal.h",
bjornv@webrtc.orgb395a5e2014-12-16 10:38:10 +000043 "agc/legacy/analog_agc.c",
44 "agc/legacy/analog_agc.h",
45 "agc/legacy/digital_agc.c",
46 "agc/legacy/digital_agc.h",
47 "agc/legacy/gain_control.h",
peahbbe42332016-06-08 06:42:02 -070048 "agc/loudness_histogram.cc",
49 "agc/loudness_histogram.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000050 "agc/utility.cc",
51 "agc/utility.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000052 "audio_buffer.cc",
53 "audio_buffer.h",
54 "audio_processing_impl.cc",
55 "audio_processing_impl.h",
aluebs4a66e4a2015-10-19 18:02:39 -070056 "beamformer/array_util.cc",
57 "beamformer/array_util.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +000058 "beamformer/complex_matrix.h",
59 "beamformer/covariance_matrix_generator.cc",
60 "beamformer/covariance_matrix_generator.h",
61 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +000062 "beamformer/nonlinear_beamformer.cc",
63 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000064 "common.h",
65 "echo_cancellation_impl.cc",
66 "echo_cancellation_impl.h",
67 "echo_control_mobile_impl.cc",
68 "echo_control_mobile_impl.h",
peahbe615622016-02-13 16:40:47 -080069 "gain_control_for_experimental_agc.cc",
70 "gain_control_for_experimental_agc.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000071 "gain_control_impl.cc",
72 "gain_control_impl.h",
73 "high_pass_filter_impl.cc",
74 "high_pass_filter_impl.h",
75 "include/audio_processing.h",
ekmdb4fecf2015-06-22 17:49:08 -070076 "intelligibility/intelligibility_enhancer.cc",
77 "intelligibility/intelligibility_enhancer.h",
78 "intelligibility/intelligibility_utils.cc",
79 "intelligibility/intelligibility_utils.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000080 "level_estimator_impl.cc",
81 "level_estimator_impl.h",
peahb46083e2016-05-03 07:01:18 -070082 "logging/apm_data_dumper.cc",
83 "logging/apm_data_dumper.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000084 "noise_suppression_impl.cc",
85 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -080086 "render_queue_item_verifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000087 "rms_level.cc",
88 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +000089 "splitting_filter.cc",
90 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -070091 "three_band_filter_bank.cc",
92 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000093 "transient/common.h",
94 "transient/daubechies_8_wavelet_coeffs.h",
95 "transient/dyadic_decimator.h",
96 "transient/moving_moments.cc",
97 "transient/moving_moments.h",
98 "transient/transient_detector.cc",
99 "transient/transient_detector.h",
100 "transient/transient_suppressor.cc",
101 "transient/transient_suppressor.h",
102 "transient/wpd_node.cc",
103 "transient/wpd_node.h",
104 "transient/wpd_tree.cc",
105 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000106 "typing_detection.cc",
107 "typing_detection.h",
minyue84db6fa2016-03-24 14:36:25 -0700108 "utility/block_mean_calculator.cc",
109 "utility/block_mean_calculator.h",
peahbdb7af62016-04-12 14:47:40 -0700110 "utility/delay_estimator.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000111 "utility/delay_estimator.h",
112 "utility/delay_estimator_internal.h",
peahbdb7af62016-04-12 14:47:40 -0700113 "utility/delay_estimator_wrapper.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000114 "utility/delay_estimator_wrapper.h",
aluebsecf6b812015-06-25 12:28:48 -0700115 "vad/common.h",
116 "vad/gmm.cc",
117 "vad/gmm.h",
118 "vad/noise_gmm_tables.h",
119 "vad/pitch_based_vad.cc",
120 "vad/pitch_based_vad.h",
121 "vad/pitch_internal.cc",
122 "vad/pitch_internal.h",
123 "vad/pole_zero_filter.cc",
124 "vad/pole_zero_filter.h",
125 "vad/standalone_vad.cc",
126 "vad/standalone_vad.h",
127 "vad/vad_audio_proc.cc",
128 "vad/vad_audio_proc.h",
129 "vad/vad_audio_proc_internal.h",
130 "vad/vad_circular_buffer.cc",
131 "vad/vad_circular_buffer.h",
132 "vad/voice_activity_detector.cc",
133 "vad/voice_activity_detector.h",
134 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000135 "voice_detection_impl.cc",
136 "voice_detection_impl.h",
137 ]
138
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000139 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000140 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000141
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000142 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200143 deps = [
144 "../..:webrtc_common",
kwiberg98ab3a42015-09-30 21:54:21 -0700145 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200146 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000147
148 if (aec_debug_dump) {
peahb46083e2016-05-03 07:01:18 -0700149 defines += [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
150 } else {
151 defines += [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000152 }
153
154 if (aec_untrusted_delay_for_testing) {
155 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
156 }
157
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000158 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000159 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
160 deps += [ ":audioproc_debug_proto" ]
161 }
162
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000163 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000164 defines += [ "WEBRTC_NS_FIXED" ]
165 sources += [
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000166 "ns/noise_suppression_x.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100167 "ns/noise_suppression_x.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000168 "ns/nsx_core.c",
169 "ns/nsx_core.h",
170 "ns/nsx_defines.h",
171 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000172 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000173 sources += [ "ns/nsx_core_mips.c" ]
174 } else {
175 sources += [ "ns/nsx_core_c.c" ]
176 }
177 } else {
178 defines += [ "WEBRTC_NS_FLOAT" ]
179 sources += [
180 "ns/defines.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000181 "ns/noise_suppression.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100182 "ns/noise_suppression.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000183 "ns/ns_core.c",
184 "ns/ns_core.h",
185 "ns/windows_private.h",
186 ]
187 }
188
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000189 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000190 deps += [ ":audio_processing_sse2" ]
191 }
192
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700193 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000194 deps += [ ":audio_processing_neon" ]
195 }
196
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000197 if (current_cpu == "mipsel") {
peah27045122016-04-10 22:38:14 -0700198 sources += [ "aecm/aecm_core_mips.cc" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000199 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000200 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800201 "aec/aec_core_mips.cc",
peah21a395d2016-04-13 07:53:48 -0700202 "aec/aec_rdft_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000203 ]
204 }
205 } else {
peah27045122016-04-10 22:38:14 -0700206 sources += [ "aecm/aecm_core_c.cc" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000207 }
208
kjellander8f4419b2016-06-02 02:09:52 -0700209 # TODO(jschuh): Bug 1348: fix this warning.
210 configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000211
212 if (is_clang) {
kjellanderfb114242016-06-13 00:19:48 -0700213 # Suppress warnings from the Chromium Clang plugins (bugs.webrtc.org/163).
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000214 configs -= [ "//build/config/clang:find_bad_constructs" ]
215 }
216
217 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000218 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000219 "../../common_audio",
220 "../../system_wrappers",
221 ]
222}
223
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000224if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000225 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200226 sources = [
227 "debug.proto",
228 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000229
kjellander78ddd732016-02-09 08:13:06 -0800230 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000231 }
232}
233
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000234if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000235 source_set("audio_processing_sse2") {
236 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800237 "aec/aec_core_sse2.cc",
peah21a395d2016-04-13 07:53:48 -0700238 "aec/aec_rdft_sse2.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000239 ]
240
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200241 if (is_posix) {
242 cflags = [ "-msse2" ]
243 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000244
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000245 configs += [ "../..:common_config" ]
246 public_configs = [ "../..:common_inherited_config" ]
peahb46083e2016-05-03 07:01:18 -0700247
248 if (aec_debug_dump) {
249 defines = [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
250 } else {
251 defines = [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
252 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000253 }
254}
255
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700256if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000257 source_set("audio_processing_neon") {
258 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800259 "aec/aec_core_neon.cc",
peah21a395d2016-04-13 07:53:48 -0700260 "aec/aec_rdft_neon.cc",
peah27045122016-04-10 22:38:14 -0700261 "aecm/aecm_core_neon.cc",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000262 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000263 ]
264
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000265 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700266 # Enable compilation for the NEON instruction set. This is needed
267 # since //build/config/arm.gni only enables NEON for iOS, not Android.
268 # This provides the same functionality as webrtc/build/arm_neon.gypi.
269 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200270 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000271 }
272
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700273 # Disable LTO on NEON targets due to compiler bug.
274 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000275 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000276 cflags -= [
277 "-flto",
278 "-ffat-lto-objects",
279 ]
280 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700281
282 configs += [ "../..:common_config" ]
283 public_configs = [ "../..:common_inherited_config" ]
284
285 deps = [
286 "../../common_audio",
287 ]
peahb46083e2016-05-03 07:01:18 -0700288
289 if (aec_debug_dump) {
290 defines = [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
291 } else {
292 defines = [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
293 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000294 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000295}
kjellanderfb114242016-06-13 00:19:48 -0700296
297if (rtc_include_tests) {
298 source_set("audioproc_test_utils") {
299 testonly = true
300 sources = [
301 "test/test_utils.cc",
302 "test/test_utils.h",
303 ]
304
305 configs += [ "../..:common_config" ]
306 public_configs = [ "../..:common_inherited_config" ]
307
308 if (is_clang) {
309 # Suppress warnings from the Chromium Clang plugins (bugs.webrtc.org/163).
310 configs -= [ "//build/config/clang:find_bad_constructs" ]
311 }
312
313 deps = [
314 "../../base:rtc_base_approved",
315 "../../common_audio",
316 ]
317 }
318
319 if (rtc_enable_protobuf) {
320 proto_library("audioproc_unittest_proto") {
321 sources = [
322 "test/unittest.proto",
323 ]
324 proto_out_dir = "webrtc/modules/audio_processing"
325 }
326
327 source_set("audioproc_protobuf_utils") {
328 sources = [
329 "test/protobuf_utils.cc",
330 "test/protobuf_utils.h",
331 ]
332
333 deps = [
334 ":audioproc_unittest_proto",
335 ]
336 }
337 }
338}