blob: 3b49745dd6eed3448ae2285e5941f7157ec679be [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",
27 "aec/aec_core_internal.h",
28 "aec/aec_rdft.c",
29 "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",
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",
peahbe615622016-02-13 16:40:47 -080071 "gain_control_for_experimental_agc.cc",
72 "gain_control_for_experimental_agc.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000073 "gain_control_impl.cc",
74 "gain_control_impl.h",
75 "high_pass_filter_impl.cc",
76 "high_pass_filter_impl.h",
77 "include/audio_processing.h",
ekmdb4fecf2015-06-22 17:49:08 -070078 "intelligibility/intelligibility_enhancer.cc",
79 "intelligibility/intelligibility_enhancer.h",
80 "intelligibility/intelligibility_utils.cc",
81 "intelligibility/intelligibility_utils.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000082 "level_estimator_impl.cc",
83 "level_estimator_impl.h",
peah9e69abf2015-08-28 04:41:25 -070084 "logging/aec_logging.h",
85 "logging/aec_logging_file_handling.cc",
86 "logging/aec_logging_file_handling.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000087 "noise_suppression_impl.cc",
88 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -080089 "render_queue_item_verifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000090 "rms_level.cc",
91 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +000092 "splitting_filter.cc",
93 "splitting_filter.h",
Alejandro Luebs5a92aa82015-04-27 11:34:45 -070094 "three_band_filter_bank.cc",
95 "three_band_filter_bank.h",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000096 "transient/common.h",
97 "transient/daubechies_8_wavelet_coeffs.h",
98 "transient/dyadic_decimator.h",
99 "transient/moving_moments.cc",
100 "transient/moving_moments.h",
101 "transient/transient_detector.cc",
102 "transient/transient_detector.h",
103 "transient/transient_suppressor.cc",
104 "transient/transient_suppressor.h",
105 "transient/wpd_node.cc",
106 "transient/wpd_node.h",
107 "transient/wpd_tree.cc",
108 "transient/wpd_tree.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000109 "typing_detection.cc",
110 "typing_detection.h",
111 "utility/delay_estimator.c",
112 "utility/delay_estimator.h",
113 "utility/delay_estimator_internal.h",
114 "utility/delay_estimator_wrapper.c",
115 "utility/delay_estimator_wrapper.h",
aluebsecf6b812015-06-25 12:28:48 -0700116 "vad/common.h",
117 "vad/gmm.cc",
118 "vad/gmm.h",
119 "vad/noise_gmm_tables.h",
120 "vad/pitch_based_vad.cc",
121 "vad/pitch_based_vad.h",
122 "vad/pitch_internal.cc",
123 "vad/pitch_internal.h",
124 "vad/pole_zero_filter.cc",
125 "vad/pole_zero_filter.h",
126 "vad/standalone_vad.cc",
127 "vad/standalone_vad.h",
128 "vad/vad_audio_proc.cc",
129 "vad/vad_audio_proc.h",
130 "vad/vad_audio_proc_internal.h",
131 "vad/vad_circular_buffer.cc",
132 "vad/vad_circular_buffer.h",
133 "vad/voice_activity_detector.cc",
134 "vad/voice_activity_detector.h",
135 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000136 "voice_detection_impl.cc",
137 "voice_detection_impl.h",
138 ]
139
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000140 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000141 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000142
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000143 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200144 deps = [
145 "../..:webrtc_common",
kwiberg98ab3a42015-09-30 21:54:21 -0700146 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200147 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000148
149 if (aec_debug_dump) {
150 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
151 }
152
153 if (aec_untrusted_delay_for_testing) {
154 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
155 }
156
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000157 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000158 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
159 deps += [ ":audioproc_debug_proto" ]
160 }
161
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000162 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000163 defines += [ "WEBRTC_NS_FIXED" ]
164 sources += [
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000165 "ns/noise_suppression_x.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100166 "ns/noise_suppression_x.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000167 "ns/nsx_core.c",
168 "ns/nsx_core.h",
169 "ns/nsx_defines.h",
170 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000171 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000172 sources += [ "ns/nsx_core_mips.c" ]
173 } else {
174 sources += [ "ns/nsx_core_c.c" ]
175 }
176 } else {
177 defines += [ "WEBRTC_NS_FLOAT" ]
178 sources += [
179 "ns/defines.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000180 "ns/noise_suppression.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100181 "ns/noise_suppression.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000182 "ns/ns_core.c",
183 "ns/ns_core.h",
184 "ns/windows_private.h",
185 ]
186 }
187
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000188 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000189 deps += [ ":audio_processing_sse2" ]
190 }
191
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700192 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000193 deps += [ ":audio_processing_neon" ]
194 }
195
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000196 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000197 sources += [ "aecm/aecm_core_mips.c" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000198 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000199 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800200 "aec/aec_core_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000201 "aec/aec_rdft_mips.c",
202 ]
203 }
204 } else {
205 sources += [ "aecm/aecm_core_c.c" ]
206 }
207
208 if (is_win) {
209 cflags = [
210 # TODO(jschuh): Bug 1348: fix this warning.
211 "/wd4267", # size_t to int truncations
212 ]
213 }
214
215 if (is_clang) {
216 # Suppress warnings from Chrome's Clang plugins.
217 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
218 configs -= [ "//build/config/clang:find_bad_constructs" ]
219 }
220
221 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000222 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000223 "../../common_audio",
224 "../../system_wrappers",
225 ]
226}
227
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000228if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000229 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200230 sources = [
231 "debug.proto",
232 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000233
kjellander78ddd732016-02-09 08:13:06 -0800234 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000235 }
236}
237
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000238if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000239 source_set("audio_processing_sse2") {
240 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800241 "aec/aec_core_sse2.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000242 "aec/aec_rdft_sse2.c",
243 ]
244
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200245 if (is_posix) {
246 cflags = [ "-msse2" ]
247 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000248
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000249 configs += [ "../..:common_config" ]
250 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000251 }
252}
253
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700254if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000255 source_set("audio_processing_neon") {
256 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800257 "aec/aec_core_neon.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000258 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000259 "aecm/aecm_core_neon.c",
260 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000261 ]
262
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000263 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700264 # Enable compilation for the NEON instruction set. This is needed
265 # since //build/config/arm.gni only enables NEON for iOS, not Android.
266 # This provides the same functionality as webrtc/build/arm_neon.gypi.
267 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200268 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000269 }
270
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700271 # Disable LTO on NEON targets due to compiler bug.
272 # TODO(fdegans): Enable this. See crbug.com/408997.
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 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700279
280 configs += [ "../..:common_config" ]
281 public_configs = [ "../..:common_inherited_config" ]
282
283 deps = [
284 "../../common_audio",
285 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000286 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000287}