blob: c18c1d80cfe054063253707ad24d3dede9b647bd [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",
peah21a395d2016-04-13 07:53:48 -070028 "aec/aec_rdft.cc",
pbos@webrtc.org788acd12014-12-15 09:41:24 +000029 "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",
peah27045122016-04-10 22:38:14 -070035 "aecm/aecm_core.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000036 "aecm/aecm_core.h",
peah27045122016-04-10 22:38:14 -070037 "aecm/echo_control_mobile.cc",
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",
peahb46083e2016-05-03 07:01:18 -070084 "logging/apm_data_dumper.cc",
85 "logging/apm_data_dumper.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000086 "noise_suppression_impl.cc",
87 "noise_suppression_impl.h",
peah737f4b82016-03-10 23:05:28 -080088 "render_queue_item_verifier.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000089 "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",
minyue84db6fa2016-03-24 14:36:25 -0700110 "utility/block_mean_calculator.cc",
111 "utility/block_mean_calculator.h",
peahbdb7af62016-04-12 14:47:40 -0700112 "utility/delay_estimator.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000113 "utility/delay_estimator.h",
114 "utility/delay_estimator_internal.h",
peahbdb7af62016-04-12 14:47:40 -0700115 "utility/delay_estimator_wrapper.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000116 "utility/delay_estimator_wrapper.h",
aluebsecf6b812015-06-25 12:28:48 -0700117 "vad/common.h",
118 "vad/gmm.cc",
119 "vad/gmm.h",
120 "vad/noise_gmm_tables.h",
121 "vad/pitch_based_vad.cc",
122 "vad/pitch_based_vad.h",
123 "vad/pitch_internal.cc",
124 "vad/pitch_internal.h",
125 "vad/pole_zero_filter.cc",
126 "vad/pole_zero_filter.h",
127 "vad/standalone_vad.cc",
128 "vad/standalone_vad.h",
129 "vad/vad_audio_proc.cc",
130 "vad/vad_audio_proc.h",
131 "vad/vad_audio_proc_internal.h",
132 "vad/vad_circular_buffer.cc",
133 "vad/vad_circular_buffer.h",
134 "vad/voice_activity_detector.cc",
135 "vad/voice_activity_detector.h",
136 "vad/voice_gmm_tables.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000137 "voice_detection_impl.cc",
138 "voice_detection_impl.h",
139 ]
140
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000141 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000142 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +0000143
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000144 defines = []
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200145 deps = [
146 "../..:webrtc_common",
kwiberg98ab3a42015-09-30 21:54:21 -0700147 "../audio_coding:isac",
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200148 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000149
150 if (aec_debug_dump) {
peahb46083e2016-05-03 07:01:18 -0700151 defines += [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
152 } else {
153 defines += [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000154 }
155
156 if (aec_untrusted_delay_for_testing) {
157 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
158 }
159
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000160 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000161 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
162 deps += [ ":audioproc_debug_proto" ]
163 }
164
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000165 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000166 defines += [ "WEBRTC_NS_FIXED" ]
167 sources += [
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000168 "ns/noise_suppression_x.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100169 "ns/noise_suppression_x.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000170 "ns/nsx_core.c",
171 "ns/nsx_core.h",
172 "ns/nsx_defines.h",
173 ]
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000174 if (current_cpu == "mipsel") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000175 sources += [ "ns/nsx_core_mips.c" ]
176 } else {
177 sources += [ "ns/nsx_core_c.c" ]
178 }
179 } else {
180 defines += [ "WEBRTC_NS_FLOAT" ]
181 sources += [
182 "ns/defines.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000183 "ns/noise_suppression.c",
Henrik Kjellander9b72af92015-11-11 20:16:11 +0100184 "ns/noise_suppression.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000185 "ns/ns_core.c",
186 "ns/ns_core.h",
187 "ns/windows_private.h",
188 ]
189 }
190
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000191 if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000192 deps += [ ":audio_processing_sse2" ]
193 }
194
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700195 if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000196 deps += [ ":audio_processing_neon" ]
197 }
198
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000199 if (current_cpu == "mipsel") {
peah27045122016-04-10 22:38:14 -0700200 sources += [ "aecm/aecm_core_mips.cc" ]
kjellander@webrtc.org6dab6d72015-03-04 09:50:31 +0000201 if (mips_float_abi == "hard") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000202 sources += [
peah8df5d4f2016-02-23 14:34:59 -0800203 "aec/aec_core_mips.cc",
peah21a395d2016-04-13 07:53:48 -0700204 "aec/aec_rdft_mips.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000205 ]
206 }
207 } else {
peah27045122016-04-10 22:38:14 -0700208 sources += [ "aecm/aecm_core_c.cc" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000209 }
210
211 if (is_win) {
212 cflags = [
213 # TODO(jschuh): Bug 1348: fix this warning.
214 "/wd4267", # size_t to int truncations
215 ]
216 }
217
218 if (is_clang) {
219 # Suppress warnings from Chrome's Clang plugins.
220 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
221 configs -= [ "//build/config/clang:find_bad_constructs" ]
222 }
223
224 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000225 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000226 "../../common_audio",
227 "../../system_wrappers",
228 ]
229}
230
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000231if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000232 proto_library("audioproc_debug_proto") {
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200233 sources = [
234 "debug.proto",
235 ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000236
kjellander78ddd732016-02-09 08:13:06 -0800237 proto_out_dir = "webrtc/modules/audio_processing"
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000238 }
239}
240
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000241if (current_cpu == "x86" || current_cpu == "x64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000242 source_set("audio_processing_sse2") {
243 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800244 "aec/aec_core_sse2.cc",
peah21a395d2016-04-13 07:53:48 -0700245 "aec/aec_rdft_sse2.cc",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000246 ]
247
Henrik Kjellanderf2497cf2015-04-16 08:57:16 +0200248 if (is_posix) {
249 cflags = [ "-msse2" ]
250 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000251
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000252 configs += [ "../..:common_config" ]
253 public_configs = [ "../..:common_inherited_config" ]
peahb46083e2016-05-03 07:01:18 -0700254
255 if (aec_debug_dump) {
256 defines = [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
257 } else {
258 defines = [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
259 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000260 }
261}
262
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700263if (rtc_build_with_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000264 source_set("audio_processing_neon") {
265 sources = [
peah8df5d4f2016-02-23 14:34:59 -0800266 "aec/aec_core_neon.cc",
peah21a395d2016-04-13 07:53:48 -0700267 "aec/aec_rdft_neon.cc",
peah27045122016-04-10 22:38:14 -0700268 "aecm/aecm_core_neon.cc",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000269 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000270 ]
271
kjellander@webrtc.org72273912015-02-23 19:08:31 +0000272 if (current_cpu != "arm64") {
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700273 # Enable compilation for the NEON instruction set. This is needed
274 # since //build/config/arm.gni only enables NEON for iOS, not Android.
275 # This provides the same functionality as webrtc/build/arm_neon.gypi.
276 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
Henrik Kjellander57e5fd22015-05-25 12:55:39 +0200277 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000278 }
279
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700280 # Disable LTO on NEON targets due to compiler bug.
281 # TODO(fdegans): Enable this. See crbug.com/408997.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000282 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000283 cflags -= [
284 "-flto",
285 "-ffat-lto-objects",
286 ]
287 }
Andrew MacDonaldac4234c2015-06-24 18:25:54 -0700288
289 configs += [ "../..:common_config" ]
290 public_configs = [ "../..:common_inherited_config" ]
291
292 deps = [
293 "../../common_audio",
294 ]
peahb46083e2016-05-03 07:01:18 -0700295
296 if (aec_debug_dump) {
297 defines = [ "WEBRTC_AEC_DEBUG_DUMP=1" ]
298 } else {
299 defines = [ "WEBRTC_AEC_DEBUG_DUMP=0" ]
300 }
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000301 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000302}