blob: ce750b636c08f87faf05d613997e6f68d0582bf8 [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",
Alejandro Luebsf260fc22015-06-19 11:23:55 -070041 "agc/agc_audio_proc.cc",
42 "agc/agc_audio_proc.h",
43 "agc/agc_audio_proc_internal.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000044 "agc/agc_manager_direct.cc",
45 "agc/agc_manager_direct.h",
Alejandro Luebsf260fc22015-06-19 11:23:55 -070046 "agc/circular_buffer.cc",
47 "agc/circular_buffer.h",
48 "agc/common.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000049 "agc/gain_map_internal.h",
Alejandro Luebsf260fc22015-06-19 11:23:55 -070050 "agc/gmm.cc",
51 "agc/gmm.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000052 "agc/histogram.cc",
53 "agc/histogram.h",
bjornv@webrtc.orgb395a5e2014-12-16 10:38:10 +000054 "agc/legacy/analog_agc.c",
55 "agc/legacy/analog_agc.h",
56 "agc/legacy/digital_agc.c",
57 "agc/legacy/digital_agc.h",
58 "agc/legacy/gain_control.h",
Alejandro Luebsf260fc22015-06-19 11:23:55 -070059 "agc/noise_gmm_tables.h",
60 "agc/pitch_based_vad.cc",
61 "agc/pitch_based_vad.h",
62 "agc/pitch_internal.cc",
63 "agc/pitch_internal.h",
64 "agc/pole_zero_filter.cc",
65 "agc/pole_zero_filter.h",
66 "agc/standalone_vad.cc",
67 "agc/standalone_vad.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000068 "agc/utility.cc",
69 "agc/utility.h",
Alejandro Luebsf260fc22015-06-19 11:23:55 -070070 "agc/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000071 "audio_buffer.cc",
72 "audio_buffer.h",
73 "audio_processing_impl.cc",
74 "audio_processing_impl.h",
Michael Graczykdfa36052015-03-25 16:37:27 -070075 "beamformer/beamformer.h",
aluebs@webrtc.org0c39e912014-12-18 22:22:04 +000076 "beamformer/complex_matrix.h",
77 "beamformer/covariance_matrix_generator.cc",
78 "beamformer/covariance_matrix_generator.h",
79 "beamformer/matrix.h",
andrew@webrtc.orgbd8c8652015-03-20 00:28:22 +000080 "beamformer/nonlinear_beamformer.cc",
81 "beamformer/nonlinear_beamformer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000082 "common.h",
83 "echo_cancellation_impl.cc",
84 "echo_cancellation_impl.h",
85 "echo_control_mobile_impl.cc",
86 "echo_control_mobile_impl.h",
87 "gain_control_impl.cc",
88 "gain_control_impl.h",
89 "high_pass_filter_impl.cc",
90 "high_pass_filter_impl.h",
91 "include/audio_processing.h",
ekmdb4fecf2015-06-22 17:49:08 -070092 "intelligibility/intelligibility_enhancer.cc",
93 "intelligibility/intelligibility_enhancer.h",
94 "intelligibility/intelligibility_utils.cc",
95 "intelligibility/intelligibility_utils.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000096 "level_estimator_impl.cc",
97 "level_estimator_impl.h",
98 "noise_suppression_impl.cc",
99 "noise_suppression_impl.h",
100 "processing_component.cc",
101 "processing_component.h",
102 "rms_level.cc",
103 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +0000104 "splitting_filter.cc",
105 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -0700106 "three_band_filter_bank.cc",
107 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +0000108 "transient/common.h",
109 "transient/daubechies_8_wavelet_coeffs.h",
110 "transient/dyadic_decimator.h",
111 "transient/moving_moments.cc",
112 "transient/moving_moments.h",
113 "transient/transient_detector.cc",
114 "transient/transient_detector.h",
115 "transient/transient_suppressor.cc",
116 "transient/transient_suppressor.h",
117 "transient/wpd_node.cc",
118 "transient/wpd_node.h",
119 "transient/wpd_tree.cc",
120 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000121 "typing_detection.cc",
122 "typing_detection.h",
123 "utility/delay_estimator.c",
124 "utility/delay_estimator.h",
125 "utility/delay_estimator_internal.h",
126 "utility/delay_estimator_wrapper.c",
127 "utility/delay_estimator_wrapper.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000128 "voice_detection_impl.cc",
129 "voice_detection_impl.h",
130 ]
131
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000132 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000133 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000134
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000135 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200136 deps = [
137 "../..:webrtc_common",
138 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000139
140 if (aec_debug_dump) {
141 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
142 }
143
144 if (aec_untrusted_delay_for_testing) {
145 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
146 }
147
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000148 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000149 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
150 deps += [ ":audioproc_debug_proto" ]
151 }
152
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000153 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000154 defines += [ "WEBRTC_NS_FIXED" ]
155 sources += [
156 "ns/include/noise_suppression_x.h",
157 "ns/noise_suppression_x.c",
158 "ns/nsx_core.c",
159 "ns/nsx_core.h",
160 "ns/nsx_defines.h",
161 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000162 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000163 sources += [ "ns/nsx_core_mips.c" ]
164 } else {
165 sources += [ "ns/nsx_core_c.c" ]
166 }
167 } else {
168 defines += [ "WEBRTC_NS_FLOAT" ]
169 sources += [
170 "ns/defines.h",
171 "ns/include/noise_suppression.h",
172 "ns/noise_suppression.c",
173 "ns/ns_core.c",
174 "ns/ns_core.h",
175 "ns/windows_private.h",
176 ]
177 }
178
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000179 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000180 deps += [ ":audio_processing_sse2" ]
181 }
182
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000183 if (rtc_build_armv7_neon || current_cpu == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000184 deps += [ ":audio_processing_neon" ]
185 }
186
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000187 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000188 sources += [ "aecm/aecm_core_mips.c" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000189 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000190 sources += [
191 "aec/aec_core_mips.c",
192 "aec/aec_rdft_mips.c",
193 ]
194 }
195 } else {
196 sources += [ "aecm/aecm_core_c.c" ]
197 }
198
199 if (is_win) {
200 cflags = [
201 # TODO(jschuh): Bug 1348: fix this warning.
202 "/wd4267", # size_t to int truncations
203 ]
204 }
205
206 if (is_clang) {
207 # Suppress warnings from Chrome's Clang plugins.
208 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
209 configs -= [ "//build/config/clang:find_bad_constructs" ]
210 }
211
212 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000213 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000214 "../../common_audio",
215 "../../system_wrappers",
216 ]
217}
218
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000219if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000220 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200221 sources = [
222 "debug.proto",
223 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000224
225 proto_out_dir = "webrtc/audio_processing"
226 }
227}
228
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000229if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000230 source_set("audio_processing_sse2") {
231 sources = [
232 "aec/aec_core_sse2.c",
233 "aec/aec_rdft_sse2.c",
234 ]
235
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200236 if (is_posix) {
237 cflags = [ "-msse2" ]
238 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000239
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000240 configs += [ "../..:common_config" ]
241 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000242 }
243}
244
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000245if (rtc_build_armv7_neon || current_cpu == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000246 source_set("audio_processing_neon") {
247 sources = [
248 "aec/aec_core_neon.c",
249 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000250 "aecm/aecm_core_neon.c",
251 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000252 ]
253
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000254 configs += [ "../..:common_config" ]
255 public_configs = [ "../..:common_inherited_config" ]
256
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200257 deps = [
258 "../../common_audio",
259 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000260
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000261 # Enable compilation for the ARM v7 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 # TODO(kjellander): Investigate if this can be moved into webrtc.gni or
265 # //build/config/arm.gni instead, to reduce code duplication.
266 # Remove the -mfpu=vfpv3-d16 cflag.
267 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000268
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000269 # "-mfpu=neon" is not requried for arm64 in GCC.
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000270 if (current_cpu != "arm64") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200271 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000272 }
273
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000274 # Disable LTO in audio_processing_neon target due to compiler bug.
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 }
281 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000282}