blob: e60f5dca5dbd0cc06865a7df556384288743f353 [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",
74 "level_estimator_impl.cc",
75 "level_estimator_impl.h",
76 "noise_suppression_impl.cc",
77 "noise_suppression_impl.h",
78 "processing_component.cc",
79 "processing_component.h",
80 "rms_level.cc",
81 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +000082 "splitting_filter.cc",
83 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -070084 "three_band_filter_bank.cc",
85 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000086 "transient/common.h",
87 "transient/daubechies_8_wavelet_coeffs.h",
88 "transient/dyadic_decimator.h",
89 "transient/moving_moments.cc",
90 "transient/moving_moments.h",
91 "transient/transient_detector.cc",
92 "transient/transient_detector.h",
93 "transient/transient_suppressor.cc",
94 "transient/transient_suppressor.h",
95 "transient/wpd_node.cc",
96 "transient/wpd_node.h",
97 "transient/wpd_tree.cc",
98 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000099 "typing_detection.cc",
100 "typing_detection.h",
101 "utility/delay_estimator.c",
102 "utility/delay_estimator.h",
103 "utility/delay_estimator_internal.h",
104 "utility/delay_estimator_wrapper.c",
105 "utility/delay_estimator_wrapper.h",
Alejandro Luebs34be1262015-06-18 12:33:51 -0700106 "vad/common.h",
107 "vad/gmm.cc",
108 "vad/gmm.h",
109 "vad/noise_gmm_tables.h",
110 "vad/pitch_based_vad.cc",
111 "vad/pitch_based_vad.h",
112 "vad/pitch_internal.cc",
113 "vad/pitch_internal.h",
114 "vad/pole_zero_filter.cc",
115 "vad/pole_zero_filter.h",
116 "vad/standalone_vad.cc",
117 "vad/standalone_vad.h",
118 "vad/vad_audio_proc.cc",
119 "vad/vad_audio_proc.h",
120 "vad/vad_audio_proc_internal.h",
121 "vad/vad_circular_buffer.cc",
122 "vad/vad_circular_buffer.h",
123 "vad/voice_activity_detector.cc",
124 "vad/voice_activity_detector.h",
125 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000126 "voice_detection_impl.cc",
127 "voice_detection_impl.h",
128 ]
129
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000130 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000131 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000132
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000133 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200134 deps = [
135 "../..:webrtc_common",
136 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000137
138 if (aec_debug_dump) {
139 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
140 }
141
142 if (aec_untrusted_delay_for_testing) {
143 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
144 }
145
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000146 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000147 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
148 deps += [ ":audioproc_debug_proto" ]
149 }
150
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000151 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000152 defines += [ "WEBRTC_NS_FIXED" ]
153 sources += [
154 "ns/include/noise_suppression_x.h",
155 "ns/noise_suppression_x.c",
156 "ns/nsx_core.c",
157 "ns/nsx_core.h",
158 "ns/nsx_defines.h",
159 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000160 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000161 sources += [ "ns/nsx_core_mips.c" ]
162 } else {
163 sources += [ "ns/nsx_core_c.c" ]
164 }
165 } else {
166 defines += [ "WEBRTC_NS_FLOAT" ]
167 sources += [
168 "ns/defines.h",
169 "ns/include/noise_suppression.h",
170 "ns/noise_suppression.c",
171 "ns/ns_core.c",
172 "ns/ns_core.h",
173 "ns/windows_private.h",
174 ]
175 }
176
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000177 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000178 deps += [ ":audio_processing_sse2" ]
179 }
180
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000181 if (rtc_build_armv7_neon || current_cpu == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000182 deps += [ ":audio_processing_neon" ]
183 }
184
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000185 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000186 sources += [ "aecm/aecm_core_mips.c" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000187 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000188 sources += [
189 "aec/aec_core_mips.c",
190 "aec/aec_rdft_mips.c",
191 ]
192 }
193 } else {
194 sources += [ "aecm/aecm_core_c.c" ]
195 }
196
197 if (is_win) {
198 cflags = [
199 # TODO(jschuh): Bug 1348: fix this warning.
200 "/wd4267", # size_t to int truncations
201 ]
202 }
203
204 if (is_clang) {
205 # Suppress warnings from Chrome's Clang plugins.
206 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
207 configs -= [ "//build/config/clang:find_bad_constructs" ]
208 }
209
210 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000211 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000212 "../../common_audio",
213 "../../system_wrappers",
214 ]
215}
216
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000217if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000218 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200219 sources = [
220 "debug.proto",
221 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000222
223 proto_out_dir = "webrtc/audio_processing"
224 }
225}
226
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000227if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000228 source_set("audio_processing_sse2") {
229 sources = [
230 "aec/aec_core_sse2.c",
231 "aec/aec_rdft_sse2.c",
232 ]
233
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200234 if (is_posix) {
235 cflags = [ "-msse2" ]
236 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000237
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000238 configs += [ "../..:common_config" ]
239 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000240 }
241}
242
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000243if (rtc_build_armv7_neon || current_cpu == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000244 source_set("audio_processing_neon") {
245 sources = [
246 "aec/aec_core_neon.c",
247 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000248 "aecm/aecm_core_neon.c",
249 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000250 ]
251
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000252 configs += [ "../..:common_config" ]
253 public_configs = [ "../..:common_inherited_config" ]
254
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200255 deps = [
256 "../../common_audio",
257 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000258
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000259 # Enable compilation for the ARM v7 Neon instruction set. This is needed
260 # since //build/config/arm.gni only enables Neon for iOS, not Android.
261 # This provides the same functionality as webrtc/build/arm_neon.gypi.
262 # TODO(kjellander): Investigate if this can be moved into webrtc.gni or
263 # //build/config/arm.gni instead, to reduce code duplication.
264 # Remove the -mfpu=vfpv3-d16 cflag.
265 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000266
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000267 # "-mfpu=neon" is not requried for arm64 in GCC.
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000268 if (current_cpu != "arm64") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200269 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000270 }
271
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000272 # Disable LTO in audio_processing_neon target due to compiler bug.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000273 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000274 cflags -= [
275 "-flto",
276 "-ffat-lto-objects",
277 ]
278 }
279 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000280}