blob: 49b562798f8ebe9c80972bbe7d51188afeaaf07b [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",
aluebs@webrtc.orgbe05c742014-11-14 22:18:10 +000066 "splitting_filter.cc",
67 "splitting_filter.h",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000068 "typing_detection.cc",
69 "typing_detection.h",
70 "utility/delay_estimator.c",
71 "utility/delay_estimator.h",
72 "utility/delay_estimator_internal.h",
73 "utility/delay_estimator_wrapper.c",
74 "utility/delay_estimator_wrapper.h",
75 "utility/fft4g.c",
76 "utility/fft4g.h",
77 "utility/ring_buffer.c",
78 "utility/ring_buffer.h",
79 "voice_detection_impl.cc",
80 "voice_detection_impl.h",
81 ]
82
brettw@chromium.org87ff9c82014-09-09 23:34:56 +000083 configs += [ "../..:common_config" ]
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +000084 public_configs = [ "../..:common_inherited_config" ]
brettw@chromium.org87ff9c82014-09-09 23:34:56 +000085
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000086 defines = []
87 deps = []
88
89 if (aec_debug_dump) {
90 defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
91 }
92
93 if (aec_untrusted_delay_for_testing) {
94 defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
95 }
96
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +000097 if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +000098 defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
99 deps += [ ":audioproc_debug_proto" ]
100 }
101
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000102 if (rtc_prefer_fixed_point) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000103 defines += [ "WEBRTC_NS_FIXED" ]
104 sources += [
105 "ns/include/noise_suppression_x.h",
106 "ns/noise_suppression_x.c",
107 "ns/nsx_core.c",
108 "ns/nsx_core.h",
109 "ns/nsx_defines.h",
110 ]
111 if (cpu_arch == "mipsel") {
112 sources += [ "ns/nsx_core_mips.c" ]
113 } else {
114 sources += [ "ns/nsx_core_c.c" ]
115 }
116 } else {
117 defines += [ "WEBRTC_NS_FLOAT" ]
118 sources += [
119 "ns/defines.h",
120 "ns/include/noise_suppression.h",
121 "ns/noise_suppression.c",
122 "ns/ns_core.c",
123 "ns/ns_core.h",
124 "ns/windows_private.h",
125 ]
126 }
127
128 if (cpu_arch == "x86" || cpu_arch == "x64") {
129 deps += [ ":audio_processing_sse2" ]
130 }
131
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000132 if (rtc_build_armv7_neon || cpu_arch == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000133 deps += [ ":audio_processing_neon" ]
134 }
135
136 if (cpu_arch == "mipsel") {
137 sources += [ "aecm/aecm_core_mips.c" ]
138 if (mips_fpu) {
139 sources += [
140 "aec/aec_core_mips.c",
141 "aec/aec_rdft_mips.c",
142 ]
143 }
144 } else {
145 sources += [ "aecm/aecm_core_c.c" ]
146 }
147
148 if (is_win) {
149 cflags = [
150 # TODO(jschuh): Bug 1348: fix this warning.
151 "/wd4267", # size_t to int truncations
152 ]
153 }
154
155 if (is_clang) {
156 # Suppress warnings from Chrome's Clang plugins.
157 # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
158 configs -= [ "//build/config/clang:find_bad_constructs" ]
159 }
160
161 deps += [
xians@webrtc.orge46bc772014-10-10 08:36:56 +0000162 "../../base:rtc_base_approved",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000163 "../../common_audio",
164 "../../system_wrappers",
165 ]
166}
167
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000168if (rtc_enable_protobuf) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000169 proto_library("audioproc_debug_proto") {
170 sources = [ "debug.proto" ]
171
172 proto_out_dir = "webrtc/audio_processing"
173 }
174}
175
176if (cpu_arch == "x86" || cpu_arch == "x64") {
177 source_set("audio_processing_sse2") {
178 sources = [
179 "aec/aec_core_sse2.c",
180 "aec/aec_rdft_sse2.c",
181 ]
182
183 cflags = [ "-msse2" ]
184
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000185 configs += [ "../..:common_config" ]
186 public_configs = [ "../..:common_inherited_config" ]
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000187 }
188}
189
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000190if (rtc_build_armv7_neon || cpu_arch == "arm64") {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000191 source_set("audio_processing_neon") {
192 sources = [
193 "aec/aec_core_neon.c",
194 "aec/aec_rdft_neon.c",
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000195 "aecm/aecm_core_neon.c",
196 "ns/nsx_core_neon.c",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000197 ]
198
kjellander@webrtc.orgf21ea912014-09-28 17:37:22 +0000199 configs += [ "../..:common_config" ]
200 public_configs = [ "../..:common_inherited_config" ]
201
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000202 deps = [ "../../common_audio" ]
203
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000204 # Enable compilation for the ARM v7 Neon instruction set. This is needed
205 # since //build/config/arm.gni only enables Neon for iOS, not Android.
206 # This provides the same functionality as webrtc/build/arm_neon.gypi.
207 # TODO(kjellander): Investigate if this can be moved into webrtc.gni or
208 # //build/config/arm.gni instead, to reduce code duplication.
209 # Remove the -mfpu=vfpv3-d16 cflag.
210 configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
211 cflags = [
212 "-flax-vector-conversions",
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000213 ]
214
andrew@webrtc.orga56a2c52014-11-26 17:01:40 +0000215 # "-mfpu=neon" is not requried for arm64 in GCC.
216 if (cpu_arch != "arm64") {
217 cflags += [ "-mfpu=neon" ]
218 }
219
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000220 # Disable LTO in audio_processing_neon target due to compiler bug.
kjellander@webrtc.org6d08ca62014-09-07 17:36:10 +0000221 if (rtc_use_lto) {
kjellander@webrtc.org524b8f72014-08-31 20:32:53 +0000222 cflags -= [
223 "-flto",
224 "-ffat-lto-objects",
225 ]
226 }
227 }
kjellander@webrtc.org1227ab82014-06-23 19:21:07 +0000228}