• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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
9import("//build/config/arm.gni")
10import("//third_party/protobuf/proto_library.gni")
11import("../../build/webrtc.gni")
12
13declare_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
23source_set("audio_processing") {
24  sources = [
25    "aec/aec_core.c",
26    "aec/aec_core.h",
27    "aec/aec_core_internal.h",
28    "aec/aec_rdft.c",
29    "aec/aec_rdft.h",
30    "aec/aec_resampler.c",
31    "aec/aec_resampler.h",
32    "aec/echo_cancellation.c",
33    "aec/echo_cancellation.h",
34    "aec/echo_cancellation_internal.h",
35    "aecm/aecm_core.c",
36    "aecm/aecm_core.h",
37    "aecm/echo_control_mobile.c",
38    "aecm/echo_control_mobile.h",
39    "agc/agc.cc",
40    "agc/agc.h",
41    "agc/agc_manager_direct.cc",
42    "agc/agc_manager_direct.h",
43    "agc/gain_map_internal.h",
44    "agc/histogram.cc",
45    "agc/histogram.h",
46    "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",
51    "agc/utility.cc",
52    "agc/utility.h",
53    "audio_buffer.cc",
54    "audio_buffer.h",
55    "audio_processing_impl.cc",
56    "audio_processing_impl.h",
57    "beamformer/array_util.cc",
58    "beamformer/array_util.h",
59    "beamformer/beamformer.h",
60    "beamformer/complex_matrix.h",
61    "beamformer/covariance_matrix_generator.cc",
62    "beamformer/covariance_matrix_generator.h",
63    "beamformer/matrix.h",
64    "beamformer/nonlinear_beamformer.cc",
65    "beamformer/nonlinear_beamformer.h",
66    "common.h",
67    "echo_cancellation_impl.cc",
68    "echo_cancellation_impl.h",
69    "echo_control_mobile_impl.cc",
70    "echo_control_mobile_impl.h",
71    "gain_control_impl.cc",
72    "gain_control_impl.h",
73    "high_pass_filter_impl.cc",
74    "high_pass_filter_impl.h",
75    "include/audio_processing.h",
76    "intelligibility/intelligibility_enhancer.cc",
77    "intelligibility/intelligibility_enhancer.h",
78    "intelligibility/intelligibility_utils.cc",
79    "intelligibility/intelligibility_utils.h",
80    "level_estimator_impl.cc",
81    "level_estimator_impl.h",
82    "logging/aec_logging.h",
83    "logging/aec_logging_file_handling.cc",
84    "logging/aec_logging_file_handling.h",
85    "noise_suppression_impl.cc",
86    "noise_suppression_impl.h",
87    "processing_component.cc",
88    "processing_component.h",
89    "rms_level.cc",
90    "rms_level.h",
91    "splitting_filter.cc",
92    "splitting_filter.h",
93    "three_band_filter_bank.cc",
94    "three_band_filter_bank.h",
95    "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",
108    "typing_detection.cc",
109    "typing_detection.h",
110    "utility/delay_estimator.c",
111    "utility/delay_estimator.h",
112    "utility/delay_estimator_internal.h",
113    "utility/delay_estimator_wrapper.c",
114    "utility/delay_estimator_wrapper.h",
115    "vad/common.h",
116    "vad/gmm.cc",
117    "vad/gmm.h",
118    "vad/noise_gmm_tables.h",
119    "vad/pitch_based_vad.cc",
120    "vad/pitch_based_vad.h",
121    "vad/pitch_internal.cc",
122    "vad/pitch_internal.h",
123    "vad/pole_zero_filter.cc",
124    "vad/pole_zero_filter.h",
125    "vad/standalone_vad.cc",
126    "vad/standalone_vad.h",
127    "vad/vad_audio_proc.cc",
128    "vad/vad_audio_proc.h",
129    "vad/vad_audio_proc_internal.h",
130    "vad/vad_circular_buffer.cc",
131    "vad/vad_circular_buffer.h",
132    "vad/voice_activity_detector.cc",
133    "vad/voice_activity_detector.h",
134    "vad/voice_gmm_tables.h",
135    "voice_detection_impl.cc",
136    "voice_detection_impl.h",
137  ]
138
139  configs += [ "../..:common_config" ]
140  public_configs = [ "../..:common_inherited_config" ]
141
142  defines = []
143  deps = [
144    "../..:webrtc_common",
145    "../audio_coding:isac",
146  ]
147
148  if (aec_debug_dump) {
149    defines += [ "WEBRTC_AEC_DEBUG_DUMP" ]
150  }
151
152  if (aec_untrusted_delay_for_testing) {
153    defines += [ "WEBRTC_UNTRUSTED_DELAY" ]
154  }
155
156  if (rtc_enable_protobuf) {
157    defines += [ "WEBRTC_AUDIOPROC_DEBUG_DUMP" ]
158    deps += [ ":audioproc_debug_proto" ]
159  }
160
161  if (rtc_prefer_fixed_point) {
162    defines += [ "WEBRTC_NS_FIXED" ]
163    sources += [
164      "ns/noise_suppression_x.c",
165      "ns/noise_suppression_x.h",
166      "ns/nsx_core.c",
167      "ns/nsx_core.h",
168      "ns/nsx_defines.h",
169    ]
170    if (current_cpu == "mipsel") {
171      sources += [ "ns/nsx_core_mips.c" ]
172    } else {
173      sources += [ "ns/nsx_core_c.c" ]
174    }
175  } else {
176    defines += [ "WEBRTC_NS_FLOAT" ]
177    sources += [
178      "ns/defines.h",
179      "ns/noise_suppression.c",
180      "ns/noise_suppression.h",
181      "ns/ns_core.c",
182      "ns/ns_core.h",
183      "ns/windows_private.h",
184    ]
185  }
186
187  if (current_cpu == "x86" || current_cpu == "x64") {
188    deps += [ ":audio_processing_sse2" ]
189  }
190
191  if (rtc_build_with_neon) {
192    deps += [ ":audio_processing_neon" ]
193  }
194
195  if (current_cpu == "mipsel") {
196    sources += [ "aecm/aecm_core_mips.c" ]
197    if (mips_float_abi == "hard") {
198      sources += [
199        "aec/aec_core_mips.c",
200        "aec/aec_rdft_mips.c",
201      ]
202    }
203  } else {
204    sources += [ "aecm/aecm_core_c.c" ]
205  }
206
207  if (is_win) {
208    cflags = [
209      # TODO(jschuh): Bug 1348: fix this warning.
210      "/wd4267",  # size_t to int truncations
211    ]
212  }
213
214  if (is_clang) {
215    # Suppress warnings from Chrome's Clang plugins.
216    # See http://code.google.com/p/webrtc/issues/detail?id=163 for details.
217    configs -= [ "//build/config/clang:find_bad_constructs" ]
218  }
219
220  deps += [
221    "../../base:rtc_base_approved",
222    "../../common_audio",
223    "../../system_wrappers",
224  ]
225}
226
227if (rtc_enable_protobuf) {
228  proto_library("audioproc_debug_proto") {
229    sources = [
230      "debug.proto",
231    ]
232
233    proto_out_dir = "webrtc/audio_processing"
234  }
235}
236
237if (current_cpu == "x86" || current_cpu == "x64") {
238  source_set("audio_processing_sse2") {
239    sources = [
240      "aec/aec_core_sse2.c",
241      "aec/aec_rdft_sse2.c",
242    ]
243
244    if (is_posix) {
245      cflags = [ "-msse2" ]
246    }
247
248    configs += [ "../..:common_config" ]
249    public_configs = [ "../..:common_inherited_config" ]
250  }
251}
252
253if (rtc_build_with_neon) {
254  source_set("audio_processing_neon") {
255    sources = [
256      "aec/aec_core_neon.c",
257      "aec/aec_rdft_neon.c",
258      "aecm/aecm_core_neon.c",
259      "ns/nsx_core_neon.c",
260    ]
261
262    if (current_cpu != "arm64") {
263      # Enable compilation for the NEON instruction set. This is needed
264      # since //build/config/arm.gni only enables NEON for iOS, not Android.
265      # This provides the same functionality as webrtc/build/arm_neon.gypi.
266      configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
267      cflags = [ "-mfpu=neon" ]
268    }
269
270    # Disable LTO on NEON targets due to compiler bug.
271    # TODO(fdegans): Enable this. See crbug.com/408997.
272    if (rtc_use_lto) {
273      cflags -= [
274        "-flto",
275        "-ffat-lto-objects",
276      ]
277    }
278
279    configs += [ "../..:common_config" ]
280    public_configs = [ "../..:common_inherited_config" ]
281
282    deps = [
283      "../../common_audio",
284    ]
285  }
286}
287