blob: fbc1e7a581b7a29cabe3542f6b2304554f878caf [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 = [
25 "aec/include/echo_cancellation.h",
26 "aec/echo_cancellation.c",
27 "aec/echo_cancellation_internal.h",
28 "aec/aec_core.h",
29 "aec/aec_core.c",
30 "aec/aec_core_internal.h",
31 "aec/aec_rdft.h",
32 "aec/aec_rdft.c",
33 "aec/aec_resampler.h",
34 "aec/aec_resampler.c",
35 "aecm/include/echo_control_mobile.h",
36 "aecm/echo_control_mobile.c",
37 "aecm/aecm_core.c",
38 "aecm/aecm_core.h",
39 "agc/include/gain_control.h",
40 "agc/analog_agc.c",
41 "agc/analog_agc.h",
42 "agc/digital_agc.c",
43 "agc/digital_agc.h",
44 "audio_buffer.cc",
45 "audio_buffer.h",
46 "audio_processing_impl.cc",
47 "audio_processing_impl.h",
aluebs@webrtc.org79b9eba2014-11-26 20:21:38 +000048 "channel_buffer.cc",
49 "channel_buffer.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000050 "common.h",
51 "echo_cancellation_impl.cc",
52 "echo_cancellation_impl.h",
53 "echo_control_mobile_impl.cc",
54 "echo_control_mobile_impl.h",
55 "gain_control_impl.cc",
56 "gain_control_impl.h",
57 "high_pass_filter_impl.cc",
58 "high_pass_filter_impl.h",
59 "include/audio_processing.h",
60 "level_estimator_impl.cc",
61 "level_estimator_impl.h",
62 "noise_suppression_impl.cc",
63 "noise_suppression_impl.h",
64 "processing_component.cc",
65 "processing_component.h",
66 "rms_level.cc",
67 "rms_level.h",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +000068 "splitting_filter.cc",
69 "splitting_filter.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000070 "typing_detection.cc",
71 "typing_detection.h",
72 "utility/delay_estimator.c",
73 "utility/delay_estimator.h",
74 "utility/delay_estimator_internal.h",
75 "utility/delay_estimator_wrapper.c",
76 "utility/delay_estimator_wrapper.h",
77 "utility/fft4g.c",
78 "utility/fft4g.h",
79 "utility/ring_buffer.c",
80 "utility/ring_buffer.h",
81 "voice_detection_impl.cc",
82 "voice_detection_impl.h",
83 ]
84
brettw@chromium.org87ff9c82014-09-09 23:34:56 +000085 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +000086 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +000087
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000088 defines = []
89 deps = []
90
91 if (aec_debug_dump) {
92 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
93 }
94
95 if (aec_untrusted_delay_for_testing) {
96 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
97 }
98
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000099 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000100 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
101 deps += [ ":audioproc_debug_proto" ]
102 }
103
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000104 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000105 defines += [ "WEBRTC_NS_FIXED" ]
106 sources += [
107 "ns/include/noise_suppression_x.h",
108 "ns/noise_suppression_x.c",
109 "ns/nsx_core.c",
110 "ns/nsx_core.h",
111 "ns/nsx_defines.h",
112 ]
113 if (cpu_arch == "mipsel") {
114 sources += [ "ns/nsx_core_mips.c" ]
115 } else {
116 sources += [ "ns/nsx_core_c.c" ]
117 }
118 } else {
119 defines += [ "WEBRTC_NS_FLOAT" ]
120 sources += [
121 "ns/defines.h",
122 "ns/include/noise_suppression.h",
123 "ns/noise_suppression.c",
124 "ns/ns_core.c",
125 "ns/ns_core.h",
126 "ns/windows_private.h",
127 ]
128 }
129
130 if (cpu_arch == "x86" || cpu_arch == "x64") {
131 deps += [ ":audio_processing_sse2" ]
132 }
133
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000134 if (rtc_build_armv7_neon || cpu_arch == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000135 deps += [ ":audio_processing_neon" ]
136 }
137
138 if (cpu_arch == "mipsel") {
139 sources += [ "aecm/aecm_core_mips.c" ]
140 if (mips_fpu) {
141 sources += [
142 "aec/aec_core_mips.c",
143 "aec/aec_rdft_mips.c",
144 ]
145 }
146 } else {
147 sources += [ "aecm/aecm_core_c.c" ]
148 }
149
150 if (is_win) {
151 cflags = [
152 # TODO(jschuh): Bug 1348: fix this warning.
153 "/wd4267", # size_t to int truncations
154 ]
155 }
156
157 if (is_clang) {
158 # Suppress warnings from Chrome's Clang plugins.
159 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
160 configs -= [ "//build/config/clang:find_bad_constructs" ]
161 }
162
163 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000164 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000165 "../../common_audio",
166 "../../system_wrappers",
167 ]
168}
169
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000170if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000171 proto_library("audioproc_debug_proto") {
172 sources = [ "debug.proto" ]
173
174 proto_out_dir = "webrtc/audio_processing"
175 }
176}
177
178if (cpu_arch == "x86" || cpu_arch == "x64") {
179 source_set("audio_processing_sse2") {
180 sources = [
181 "aec/aec_core_sse2.c",
182 "aec/aec_rdft_sse2.c",
183 ]
184
185 cflags = [ "-msse2" ]
186
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000187 configs += [ "../..:common_config" ]
188 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000189 }
190}
191
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000192if (rtc_build_armv7_neon || cpu_arch == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000193 source_set("audio_processing_neon") {
194 sources = [
195 "aec/aec_core_neon.c",
196 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000197 "aecm/aecm_core_neon.c",
198 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000199 ]
200
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000201 configs += [ "../..:common_config" ]
202 public_configs = [ "../..:common_inherited_config" ]
203
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000204 deps = [ "../../common_audio" ]
205
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000206 # Enable compilation for the ARM v7 Neon instruction set. This is needed
207 # since //build/config/arm.gni only enables Neon for iOS, not Android.
208 # This provides the same functionality as webrtc/build/arm_neon.gypi.
209 # TODO(kjellander): Investigate if this can be moved into webrtc.gni or
210 # //build/config/arm.gni instead, to reduce code duplication.
211 # Remove the -mfpu=vfpv3-d16 cflag.
212 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000213
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000214 # "-mfpu=neon" is not requried for arm64 in GCC.
215 if (cpu_arch != "arm64") {
andrew@webrtc.org1751ee72014-12-02 19:36:14 +0000216 cflags = [ "-mfpu=neon" ]
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000217 }
218
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000219 # Disable LTO in audio_processing_neon target due to compiler bug.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000220 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000221 cflags -= [
222 "-flto",
223 "-ffat-lto-objects",
224 ]
225 }
226 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000227}