blob: 13da8d6c493a02e5ff4f41717b66842d999753da [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 = [
pbos@webrtc.org788acd12014-12-15 09:41:24 +000025 "aec/aec_core.c",
26 "aec/aec_core.h",
27 "aec/aec_core_internal.h",
28 "aec/aec_rdft.c",
29 "aec/aec_rdft.h",
30 "aec/aec_resampler.c",
31 "aec/aec_resampler.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000032 "aec/echo_cancellation.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010033 "aec/echo_cancellation.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000034 "aec/echo_cancellation_internal.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000035 "aecm/aecm_core.c",
36 "aecm/aecm_core.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000037 "aecm/echo_control_mobile.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +010038 "aecm/echo_control_mobile.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000039 "agc/agc.cc",
40 "agc/agc.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000041 "agc/agc_manager_direct.cc",
42 "agc/agc_manager_direct.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000043 "agc/gain_map_internal.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000044 "agc/histogram.cc",
45 "agc/histogram.h",
bjornv@webrtc.orgb395a5e2014-12-16 10:38:10 +000046 "agc/legacy/analog_agc.c",
47 "agc/legacy/analog_agc.h",
48 "agc/legacy/digital_agc.c",
49 "agc/legacy/digital_agc.h",
50 "agc/legacy/gain_control.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000051 "agc/utility.cc",
52 "agc/utility.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000053 "audio_buffer.cc",
54 "audio_buffer.h",
55 "audio_processing_impl.cc",
56 "audio_processing_impl.h",
aluebs4a66e4a2015-10-19 18:02:39 -070057 "beamformer/array_util.cc",
58 "beamformer/array_util.h",
Michael Graczykdfa36052015-03-25 16:37:27 -070059 "beamformer/beamformer.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +000060 "beamformer/complex_matrix.h",
61 "beamformer/covariance_matrix_generator.cc",
62 "beamformer/covariance_matrix_generator.h",
63 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +000064 "beamformer/nonlinear_beamformer.cc",
65 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000066 "common.h",
67 "echo_cancellation_impl.cc",
68 "echo_cancellation_impl.h",
69 "echo_control_mobile_impl.cc",
70 "echo_control_mobile_impl.h",
71 "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",
peah9e69abf2015-08-28 04:41:25 -070082 "logging/aec_logging.h",
83 "logging/aec_logging_file_handling.cc",
84 "logging/aec_logging_file_handling.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000085 "noise_suppression_impl.cc",
86 "noise_suppression_impl.h",
87 "processing_component.cc",
88 "processing_component.h",
89 "rms_level.cc",
90 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +000091 "splitting_filter.cc",
92 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -070093 "three_band_filter_bank.cc",
94 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000095 "transient/common.h",
96 "transient/daubechies_8_wavelet_coeffs.h",
97 "transient/dyadic_decimator.h",
98 "transient/moving_moments.cc",
99 "transient/moving_moments.h",
100 "transient/transient_detector.cc",
101 "transient/transient_detector.h",
102 "transient/transient_suppressor.cc",
103 "transient/transient_suppressor.h",
104 "transient/wpd_node.cc",
105 "transient/wpd_node.h",
106 "transient/wpd_tree.cc",
107 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000108 "typing_detection.cc",
109 "typing_detection.h",
110 "utility/delay_estimator.c",
111 "utility/delay_estimator.h",
112 "utility/delay_estimator_internal.h",
113 "utility/delay_estimator_wrapper.c",
114 "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) {
149 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
150 }
151
152 if (aec_untrusted_delay_for_testing) {
153 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
154 }
155
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000156 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000157 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
158 deps += [ ":audioproc_debug_proto" ]
159 }
160
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000161 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000162 defines += [ "WEBRTC_NS_FIXED" ]
163 sources += [
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000164 "ns/noise_suppression_x.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100165 "ns/noise_suppression_x.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000166 "ns/nsx_core.c",
167 "ns/nsx_core.h",
168 "ns/nsx_defines.h",
169 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000170 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000171 sources += [ "ns/nsx_core_mips.c" ]
172 } else {
173 sources += [ "ns/nsx_core_c.c" ]
174 }
175 } else {
176 defines += [ "WEBRTC_NS_FLOAT" ]
177 sources += [
178 "ns/defines.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000179 "ns/noise_suppression.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100180 "ns/noise_suppression.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000181 "ns/ns_core.c",
182 "ns/ns_core.h",
183 "ns/windows_private.h",
184 ]
185 }
186
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000187 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000188 deps += [ ":audio_processing_sse2" ]
189 }
190
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700191 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000192 deps += [ ":audio_processing_neon" ]
193 }
194
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000195 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000196 sources += [ "aecm/aecm_core_mips.c" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000197 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000198 sources += [
199 "aec/aec_core_mips.c",
200 "aec/aec_rdft_mips.c",
201 ]
202 }
203 } else {
204 sources += [ "aecm/aecm_core_c.c" ]
205 }
206
207 if (is_win) {
208 cflags = [
209 # TODO(jschuh): Bug 1348: fix this warning.
210 "/wd4267", # size_t to int truncations
211 ]
212 }
213
214 if (is_clang) {
215 # Suppress warnings from Chrome's Clang plugins.
216 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
217 configs -= [ "//build/config/clang:find_bad_constructs" ]
218 }
219
220 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000221 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000222 "../../common_audio",
223 "../../system_wrappers",
224 ]
225}
226
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000227if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000228 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200229 sources = [
230 "debug.proto",
231 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000232
kjellander78ddd732016-02-09 08:13:06 -0800233 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000234 }
235}
236
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000237if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000238 source_set("audio_processing_sse2") {
239 sources = [
240 "aec/aec_core_sse2.c",
241 "aec/aec_rdft_sse2.c",
242 ]
243
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200244 if (is_posix) {
245 cflags = [ "-msse2" ]
246 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000247
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000248 configs += [ "../..:common_config" ]
249 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000250 }
251}
252
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700253if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000254 source_set("audio_processing_neon") {
255 sources = [
256 "aec/aec_core_neon.c",
257 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000258 "aecm/aecm_core_neon.c",
259 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000260 ]
261
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000262 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700263 # Enable compilation for the NEON instruction set. This is needed
264 # since //build/config/arm.gni only enables NEON for iOS, not Android.
265 # This provides the same functionality as webrtc/build/arm_neon.gypi.
266 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200267 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000268 }
269
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700270 # Disable LTO on NEON targets due to compiler bug.
271 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000272 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000273 cflags -= [
274 "-flto",
275 "-ffat-lto-objects",
276 ]
277 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700278
279 configs += [ "../..:common_config" ]
280 public_configs = [ "../..:common_inherited_config" ]
281
282 deps = [
283 "../../common_audio",
284 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000285 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000286}