blob: d631adc2b2b6566d7a05ec99730c1ee2a674cbdc [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",
48 "common.h",
49 "echo_cancellation_impl.cc",
50 "echo_cancellation_impl.h",
51 "echo_control_mobile_impl.cc",
52 "echo_control_mobile_impl.h",
53 "gain_control_impl.cc",
54 "gain_control_impl.h",
55 "high_pass_filter_impl.cc",
56 "high_pass_filter_impl.h",
57 "include/audio_processing.h",
58 "level_estimator_impl.cc",
59 "level_estimator_impl.h",
60 "noise_suppression_impl.cc",
61 "noise_suppression_impl.h",
62 "processing_component.cc",
63 "processing_component.h",
64 "rms_level.cc",
65 "rms_level.h",
66 "typing_detection.cc",
67 "typing_detection.h",
68 "utility/delay_estimator.c",
69 "utility/delay_estimator.h",
70 "utility/delay_estimator_internal.h",
71 "utility/delay_estimator_wrapper.c",
72 "utility/delay_estimator_wrapper.h",
73 "utility/fft4g.c",
74 "utility/fft4g.h",
75 "utility/ring_buffer.c",
76 "utility/ring_buffer.h",
77 "voice_detection_impl.cc",
78 "voice_detection_impl.h",
79 ]
80
brettw@chromium.org87ff9c82014-09-09 23:34:56 +000081 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +000082 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +000083
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000084 defines = []
85 deps = []
86
87 if (aec_debug_dump) {
88 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
89 }
90
91 if (aec_untrusted_delay_for_testing) {
92 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
93 }
94
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000095 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000096 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
97 deps += [ ":audioproc_debug_proto" ]
98 }
99
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000100 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000101 defines += [ "WEBRTC_NS_FIXED" ]
102 sources += [
103 "ns/include/noise_suppression_x.h",
104 "ns/noise_suppression_x.c",
105 "ns/nsx_core.c",
106 "ns/nsx_core.h",
107 "ns/nsx_defines.h",
108 ]
109 if (cpu_arch == "mipsel") {
110 sources += [ "ns/nsx_core_mips.c" ]
111 } else {
112 sources += [ "ns/nsx_core_c.c" ]
113 }
114 } else {
115 defines += [ "WEBRTC_NS_FLOAT" ]
116 sources += [
117 "ns/defines.h",
118 "ns/include/noise_suppression.h",
119 "ns/noise_suppression.c",
120 "ns/ns_core.c",
121 "ns/ns_core.h",
122 "ns/windows_private.h",
123 ]
124 }
125
126 if (cpu_arch == "x86" || cpu_arch == "x64") {
127 deps += [ ":audio_processing_sse2" ]
128 }
129
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000130 if (rtc_build_armv7_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000131 deps += [ ":audio_processing_neon" ]
132 }
133
134 if (cpu_arch == "mipsel") {
135 sources += [ "aecm/aecm_core_mips.c" ]
136 if (mips_fpu) {
137 sources += [
138 "aec/aec_core_mips.c",
139 "aec/aec_rdft_mips.c",
140 ]
141 }
142 } else {
143 sources += [ "aecm/aecm_core_c.c" ]
144 }
145
146 if (is_win) {
147 cflags = [
148 # TODO(jschuh): Bug 1348: fix this warning.
149 "/wd4267", # size_t to int truncations
150 ]
151 }
152
153 if (is_clang) {
154 # Suppress warnings from Chrome's Clang plugins.
155 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
156 configs -= [ "//build/config/clang:find_bad_constructs" ]
157 }
158
159 deps += [
160 "../../common_audio",
161 "../../system_wrappers",
162 ]
163}
164
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000165if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000166 proto_library("audioproc_debug_proto") {
167 sources = [ "debug.proto" ]
168
169 proto_out_dir = "webrtc/audio_processing"
170 }
171}
172
173if (cpu_arch == "x86" || cpu_arch == "x64") {
174 source_set("audio_processing_sse2") {
175 sources = [
176 "aec/aec_core_sse2.c",
177 "aec/aec_rdft_sse2.c",
178 ]
179
180 cflags = [ "-msse2" ]
181
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000182 configs += [ "../..:common_config" ]
183 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000184 }
185}
186
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000187if (rtc_build_armv7_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000188 source_set("audio_processing_neon") {
189 sources = [
190 "aec/aec_core_neon.c",
191 "aec/aec_rdft_neon.c",
192 ]
193
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000194 configs += [ "../..:common_config" ]
195 public_configs = [ "../..:common_inherited_config" ]
196
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000197 deps = [ "../../common_audio" ]
198
199 if (is_android || is_ios) {
200 sources += [
201 # TODO(andrew): Re-enable these once webrtc:3580 is resolved.
202 #"aecm/aecm_core_neon.S",
203 #"ns/nsx_core_neon.S",
204 ]
205
206 include_dirs = [ target_out_dir ]
207 } else {
208 sources += [
209 "aecm/aecm_core_neon.c",
210 "ns/nsx_core_neon.c",
211 ]
212 }
213
214 # Enable compilation for the ARM v7 Neon instruction set. This is needed
215 # since //build/config/arm.gni only enables Neon for iOS, not Android.
216 # This provides the same functionality as webrtc/build/arm_neon.gypi.
217 # TODO(kjellander): Investigate if this can be moved into webrtc.gni or
218 # //build/config/arm.gni instead, to reduce code duplication.
219 # Remove the -mfpu=vfpv3-d16 cflag.
220 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
221 cflags = [
222 "-flax-vector-conversions",
223 "-mfpu=neon",
224 ]
225
226 # Disable LTO in audio_processing_neon target due to compiler bug.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000227 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000228 cflags -= [
229 "-flto",
230 "-ffat-lto-objects",
231 ]
232 }
233 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000234}