blob: 9bf4da07ad7c9c6d1503837f6b0fa96c226d4889 [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" ]
82 direct_dependent_configs = [ "../..:common_inherited_config" ]
83
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
182 configs += [ "../..:common_inherited_config" ]
183 }
184}
185
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000186if (rtc_build_armv7_neon) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000187 source_set("audio_processing_neon") {
188 sources = [
189 "aec/aec_core_neon.c",
190 "aec/aec_rdft_neon.c",
191 ]
192
193 deps = [ "../../common_audio" ]
194
195 if (is_android || is_ios) {
196 sources += [
197 # TODO(andrew): Re-enable these once webrtc:3580 is resolved.
198 #"aecm/aecm_core_neon.S",
199 #"ns/nsx_core_neon.S",
200 ]
201
202 include_dirs = [ target_out_dir ]
203 } else {
204 sources += [
205 "aecm/aecm_core_neon.c",
206 "ns/nsx_core_neon.c",
207 ]
208 }
209
210 # Enable compilation for the ARM v7 Neon instruction set. This is needed
211 # since //build/config/arm.gni only enables Neon for iOS, not Android.
212 # This provides the same functionality as webrtc/build/arm_neon.gypi.
213 # TODO(kjellander): Investigate if this can be moved into webrtc.gni or
214 # //build/config/arm.gni instead, to reduce code duplication.
215 # Remove the -mfpu=vfpv3-d16 cflag.
216 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
217 cflags = [
218 "-flax-vector-conversions",
219 "-mfpu=neon",
220 ]
221
222 # Disable LTO in audio_processing_neon target due to compiler bug.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000223 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000224 cflags -= [
225 "-flto",
226 "-ffat-lto-objects",
227 ]
228 }
229 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000230}