blob: 9a45cecd6c8533ceedd6f73d2d4a7f14e8a8876f [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",
33 "aec/echo_cancellation_internal.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000034 "aec/include/echo_cancellation.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",
38 "aecm/include/echo_control_mobile.h",
39 "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",
Michael Graczykdfa36052015-03-25 16:37:27 -070057 "beamformer/beamformer.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",
69 "gain_control_impl.cc",
70 "gain_control_impl.h",
71 "high_pass_filter_impl.cc",
72 "high_pass_filter_impl.h",
73 "include/audio_processing.h",
ekmdb4fecf2015-06-22 17:49:08 -070074 "intelligibility/intelligibility_enhancer.cc",
75 "intelligibility/intelligibility_enhancer.h",
76 "intelligibility/intelligibility_utils.cc",
77 "intelligibility/intelligibility_utils.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000078 "level_estimator_impl.cc",
79 "level_estimator_impl.h",
peah9e69abf2015-08-28 04:41:25 -070080 "logging/aec_logging.h",
81 "logging/aec_logging_file_handling.cc",
82 "logging/aec_logging_file_handling.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000083 "noise_suppression_impl.cc",
84 "noise_suppression_impl.h",
85 "processing_component.cc",
86 "processing_component.h",
87 "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",
108 "utility/delay_estimator.c",
109 "utility/delay_estimator.h",
110 "utility/delay_estimator_internal.h",
111 "utility/delay_estimator_wrapper.c",
112 "utility/delay_estimator_wrapper.h",
aluebsecf6b812015-06-25 12:28:48 -0700113 "vad/common.h",
114 "vad/gmm.cc",
115 "vad/gmm.h",
116 "vad/noise_gmm_tables.h",
117 "vad/pitch_based_vad.cc",
118 "vad/pitch_based_vad.h",
119 "vad/pitch_internal.cc",
120 "vad/pitch_internal.h",
121 "vad/pole_zero_filter.cc",
122 "vad/pole_zero_filter.h",
123 "vad/standalone_vad.cc",
124 "vad/standalone_vad.h",
125 "vad/vad_audio_proc.cc",
126 "vad/vad_audio_proc.h",
127 "vad/vad_audio_proc_internal.h",
128 "vad/vad_circular_buffer.cc",
129 "vad/vad_circular_buffer.h",
130 "vad/voice_activity_detector.cc",
131 "vad/voice_activity_detector.h",
132 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000133 "voice_detection_impl.cc",
134 "voice_detection_impl.h",
135 ]
136
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000137 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000138 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000139
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000140 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200141 deps = [
142 "../..:webrtc_common",
kwiberg98ab3a42015-09-30 21:54:21 -0700143 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200144 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000145
146 if (aec_debug_dump) {
147 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
148 }
149
150 if (aec_untrusted_delay_for_testing) {
151 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
152 }
153
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000154 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000155 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
156 deps += [ ":audioproc_debug_proto" ]
157 }
158
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000159 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000160 defines += [ "WEBRTC_NS_FIXED" ]
161 sources += [
162 "ns/include/noise_suppression_x.h",
163 "ns/noise_suppression_x.c",
164 "ns/nsx_core.c",
165 "ns/nsx_core.h",
166 "ns/nsx_defines.h",
167 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000168 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000169 sources += [ "ns/nsx_core_mips.c" ]
170 } else {
171 sources += [ "ns/nsx_core_c.c" ]
172 }
173 } else {
174 defines += [ "WEBRTC_NS_FLOAT" ]
175 sources += [
176 "ns/defines.h",
177 "ns/include/noise_suppression.h",
178 "ns/noise_suppression.c",
179 "ns/ns_core.c",
180 "ns/ns_core.h",
181 "ns/windows_private.h",
182 ]
183 }
184
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000185 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000186 deps += [ ":audio_processing_sse2" ]
187 }
188
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700189 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000190 deps += [ ":audio_processing_neon" ]
191 }
192
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000193 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000194 sources += [ "aecm/aecm_core_mips.c" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000195 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000196 sources += [
197 "aec/aec_core_mips.c",
198 "aec/aec_rdft_mips.c",
199 ]
200 }
201 } else {
202 sources += [ "aecm/aecm_core_c.c" ]
203 }
204
205 if (is_win) {
206 cflags = [
207 # TODO(jschuh): Bug 1348: fix this warning.
208 "/wd4267", # size_t to int truncations
209 ]
210 }
211
212 if (is_clang) {
213 # Suppress warnings from Chrome's Clang plugins.
214 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
215 configs -= [ "//build/config/clang:find_bad_constructs" ]
216 }
217
218 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000219 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000220 "../../common_audio",
221 "../../system_wrappers",
222 ]
223}
224
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000225if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000226 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200227 sources = [
228 "debug.proto",
229 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000230
231 proto_out_dir = "webrtc/audio_processing"
232 }
233}
234
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000235if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000236 source_set("audio_processing_sse2") {
237 sources = [
238 "aec/aec_core_sse2.c",
239 "aec/aec_rdft_sse2.c",
240 ]
241
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200242 if (is_posix) {
243 cflags = [ "-msse2" ]
244 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000245
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000246 configs += [ "../..:common_config" ]
247 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000248 }
249}
250
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700251if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000252 source_set("audio_processing_neon") {
253 sources = [
254 "aec/aec_core_neon.c",
255 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000256 "aecm/aecm_core_neon.c",
257 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000258 ]
259
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000260 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700261 # Enable compilation for the NEON instruction set. This is needed
262 # since //build/config/arm.gni only enables NEON for iOS, not Android.
263 # This provides the same functionality as webrtc/build/arm_neon.gypi.
264 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200265 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000266 }
267
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700268 # Disable LTO on NEON targets due to compiler bug.
269 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000270 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000271 cflags -= [
272 "-flto",
273 "-ffat-lto-objects",
274 ]
275 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700276
277 configs += [ "../..:common_config" ]
278 public_configs = [ "../..:common_inherited_config" ]
279
280 deps = [
281 "../../common_audio",
282 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000283 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000284}