xref: /aosp_15_r20/external/webrtc/common_audio/BUILD.gn (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
2*d9f75844SAndroid Build Coastguard Worker#
3*d9f75844SAndroid Build Coastguard Worker# Use of this source code is governed by a BSD-style license
4*d9f75844SAndroid Build Coastguard Worker# that can be found in the LICENSE file in the root of the source
5*d9f75844SAndroid Build Coastguard Worker# tree. An additional intellectual property rights grant can be found
6*d9f75844SAndroid Build Coastguard Worker# in the file PATENTS.  All contributing project authors may
7*d9f75844SAndroid Build Coastguard Worker# be found in the AUTHORS file in the root of the source tree.
8*d9f75844SAndroid Build Coastguard Worker
9*d9f75844SAndroid Build Coastguard Workerimport("../webrtc.gni")
10*d9f75844SAndroid Build Coastguard Worker
11*d9f75844SAndroid Build Coastguard Workervisibility = [ ":*" ]
12*d9f75844SAndroid Build Coastguard Worker
13*d9f75844SAndroid Build Coastguard Workerrtc_library("common_audio") {
14*d9f75844SAndroid Build Coastguard Worker  visibility += [ "*" ]
15*d9f75844SAndroid Build Coastguard Worker  sources = [
16*d9f75844SAndroid Build Coastguard Worker    "audio_converter.cc",
17*d9f75844SAndroid Build Coastguard Worker    "audio_converter.h",
18*d9f75844SAndroid Build Coastguard Worker    "audio_util.cc",
19*d9f75844SAndroid Build Coastguard Worker    "channel_buffer.cc",
20*d9f75844SAndroid Build Coastguard Worker    "channel_buffer.h",
21*d9f75844SAndroid Build Coastguard Worker    "include/audio_util.h",
22*d9f75844SAndroid Build Coastguard Worker    "real_fourier.cc",
23*d9f75844SAndroid Build Coastguard Worker    "real_fourier.h",
24*d9f75844SAndroid Build Coastguard Worker    "real_fourier_ooura.cc",
25*d9f75844SAndroid Build Coastguard Worker    "real_fourier_ooura.h",
26*d9f75844SAndroid Build Coastguard Worker    "resampler/include/push_resampler.h",
27*d9f75844SAndroid Build Coastguard Worker    "resampler/include/resampler.h",
28*d9f75844SAndroid Build Coastguard Worker    "resampler/push_resampler.cc",
29*d9f75844SAndroid Build Coastguard Worker    "resampler/push_sinc_resampler.cc",
30*d9f75844SAndroid Build Coastguard Worker    "resampler/push_sinc_resampler.h",
31*d9f75844SAndroid Build Coastguard Worker    "resampler/resampler.cc",
32*d9f75844SAndroid Build Coastguard Worker    "resampler/sinc_resampler.cc",
33*d9f75844SAndroid Build Coastguard Worker    "smoothing_filter.cc",
34*d9f75844SAndroid Build Coastguard Worker    "smoothing_filter.h",
35*d9f75844SAndroid Build Coastguard Worker    "vad/include/vad.h",
36*d9f75844SAndroid Build Coastguard Worker    "vad/vad.cc",
37*d9f75844SAndroid Build Coastguard Worker    "wav_file.cc",
38*d9f75844SAndroid Build Coastguard Worker    "wav_file.h",
39*d9f75844SAndroid Build Coastguard Worker    "wav_header.cc",
40*d9f75844SAndroid Build Coastguard Worker    "wav_header.h",
41*d9f75844SAndroid Build Coastguard Worker    "window_generator.cc",
42*d9f75844SAndroid Build Coastguard Worker    "window_generator.h",
43*d9f75844SAndroid Build Coastguard Worker  ]
44*d9f75844SAndroid Build Coastguard Worker
45*d9f75844SAndroid Build Coastguard Worker  deps = [
46*d9f75844SAndroid Build Coastguard Worker    ":common_audio_c",
47*d9f75844SAndroid Build Coastguard Worker    ":sinc_resampler",
48*d9f75844SAndroid Build Coastguard Worker    "../api:array_view",
49*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:checks",
50*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:gtest_prod",
51*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:logging",
52*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:safe_conversions",
53*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:sanitizer",
54*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:timeutils",
55*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/memory:aligned_malloc",
56*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/system:arch",
57*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/system:file_wrapper",
58*d9f75844SAndroid Build Coastguard Worker    "../system_wrappers",
59*d9f75844SAndroid Build Coastguard Worker    "third_party/ooura:fft_size_256",
60*d9f75844SAndroid Build Coastguard Worker  ]
61*d9f75844SAndroid Build Coastguard Worker  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
62*d9f75844SAndroid Build Coastguard Worker
63*d9f75844SAndroid Build Coastguard Worker  defines = []
64*d9f75844SAndroid Build Coastguard Worker
65*d9f75844SAndroid Build Coastguard Worker  if (rtc_build_with_neon) {
66*d9f75844SAndroid Build Coastguard Worker    deps += [ ":common_audio_neon" ]
67*d9f75844SAndroid Build Coastguard Worker  }
68*d9f75844SAndroid Build Coastguard Worker
69*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "x86" || current_cpu == "x64") {
70*d9f75844SAndroid Build Coastguard Worker    deps += [ ":common_audio_sse2" ]
71*d9f75844SAndroid Build Coastguard Worker    deps += [ ":common_audio_avx2" ]
72*d9f75844SAndroid Build Coastguard Worker  }
73*d9f75844SAndroid Build Coastguard Worker}
74*d9f75844SAndroid Build Coastguard Worker
75*d9f75844SAndroid Build Coastguard Workerrtc_source_set("mock_common_audio") {
76*d9f75844SAndroid Build Coastguard Worker  visibility += webrtc_default_visibility
77*d9f75844SAndroid Build Coastguard Worker  testonly = true
78*d9f75844SAndroid Build Coastguard Worker  sources = [
79*d9f75844SAndroid Build Coastguard Worker    "mocks/mock_smoothing_filter.h",
80*d9f75844SAndroid Build Coastguard Worker    "vad/mock/mock_vad.h",
81*d9f75844SAndroid Build Coastguard Worker  ]
82*d9f75844SAndroid Build Coastguard Worker  deps = [
83*d9f75844SAndroid Build Coastguard Worker    ":common_audio",
84*d9f75844SAndroid Build Coastguard Worker    "../test:test_support",
85*d9f75844SAndroid Build Coastguard Worker  ]
86*d9f75844SAndroid Build Coastguard Worker}
87*d9f75844SAndroid Build Coastguard Worker
88*d9f75844SAndroid Build Coastguard Workerrtc_source_set("common_audio_c_arm_asm") {
89*d9f75844SAndroid Build Coastguard Worker  sources = []
90*d9f75844SAndroid Build Coastguard Worker  deps = []
91*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "arm") {
92*d9f75844SAndroid Build Coastguard Worker    sources += [ "signal_processing/complex_bit_reverse_arm.S" ]
93*d9f75844SAndroid Build Coastguard Worker
94*d9f75844SAndroid Build Coastguard Worker    if (arm_version >= 7) {
95*d9f75844SAndroid Build Coastguard Worker      sources += [ "signal_processing/filter_ar_fast_q12_armv7.S" ]
96*d9f75844SAndroid Build Coastguard Worker    } else {
97*d9f75844SAndroid Build Coastguard Worker      sources += [ "signal_processing/filter_ar_fast_q12.c" ]
98*d9f75844SAndroid Build Coastguard Worker    }
99*d9f75844SAndroid Build Coastguard Worker    deps += [ "../rtc_base/system:asm_defines" ]
100*d9f75844SAndroid Build Coastguard Worker  }
101*d9f75844SAndroid Build Coastguard Worker}
102*d9f75844SAndroid Build Coastguard Worker
103*d9f75844SAndroid Build Coastguard Workerrtc_library("common_audio_c") {
104*d9f75844SAndroid Build Coastguard Worker  visibility += webrtc_default_visibility
105*d9f75844SAndroid Build Coastguard Worker  sources = [
106*d9f75844SAndroid Build Coastguard Worker    "ring_buffer.c",
107*d9f75844SAndroid Build Coastguard Worker    "ring_buffer.h",
108*d9f75844SAndroid Build Coastguard Worker    "signal_processing/auto_corr_to_refl_coef.c",
109*d9f75844SAndroid Build Coastguard Worker    "signal_processing/auto_correlation.c",
110*d9f75844SAndroid Build Coastguard Worker    "signal_processing/complex_fft_tables.h",
111*d9f75844SAndroid Build Coastguard Worker    "signal_processing/copy_set_operations.c",
112*d9f75844SAndroid Build Coastguard Worker    "signal_processing/cross_correlation.c",
113*d9f75844SAndroid Build Coastguard Worker    "signal_processing/division_operations.c",
114*d9f75844SAndroid Build Coastguard Worker    "signal_processing/downsample_fast.c",
115*d9f75844SAndroid Build Coastguard Worker    "signal_processing/energy.c",
116*d9f75844SAndroid Build Coastguard Worker    "signal_processing/filter_ar.c",
117*d9f75844SAndroid Build Coastguard Worker    "signal_processing/filter_ma_fast_q12.c",
118*d9f75844SAndroid Build Coastguard Worker    "signal_processing/get_hanning_window.c",
119*d9f75844SAndroid Build Coastguard Worker    "signal_processing/get_scaling_square.c",
120*d9f75844SAndroid Build Coastguard Worker    "signal_processing/ilbc_specific_functions.c",
121*d9f75844SAndroid Build Coastguard Worker    "signal_processing/include/real_fft.h",
122*d9f75844SAndroid Build Coastguard Worker    "signal_processing/include/signal_processing_library.h",
123*d9f75844SAndroid Build Coastguard Worker    "signal_processing/include/spl_inl.h",
124*d9f75844SAndroid Build Coastguard Worker    "signal_processing/include/spl_inl_armv7.h",
125*d9f75844SAndroid Build Coastguard Worker    "signal_processing/levinson_durbin.c",
126*d9f75844SAndroid Build Coastguard Worker    "signal_processing/lpc_to_refl_coef.c",
127*d9f75844SAndroid Build Coastguard Worker    "signal_processing/min_max_operations.c",
128*d9f75844SAndroid Build Coastguard Worker    "signal_processing/randomization_functions.c",
129*d9f75844SAndroid Build Coastguard Worker    "signal_processing/real_fft.c",
130*d9f75844SAndroid Build Coastguard Worker    "signal_processing/refl_coef_to_lpc.c",
131*d9f75844SAndroid Build Coastguard Worker    "signal_processing/resample.c",
132*d9f75844SAndroid Build Coastguard Worker    "signal_processing/resample_48khz.c",
133*d9f75844SAndroid Build Coastguard Worker    "signal_processing/resample_by_2.c",
134*d9f75844SAndroid Build Coastguard Worker    "signal_processing/resample_by_2_internal.c",
135*d9f75844SAndroid Build Coastguard Worker    "signal_processing/resample_by_2_internal.h",
136*d9f75844SAndroid Build Coastguard Worker    "signal_processing/resample_fractional.c",
137*d9f75844SAndroid Build Coastguard Worker    "signal_processing/spl_init.c",
138*d9f75844SAndroid Build Coastguard Worker    "signal_processing/spl_inl.c",
139*d9f75844SAndroid Build Coastguard Worker    "signal_processing/spl_sqrt.c",
140*d9f75844SAndroid Build Coastguard Worker    "signal_processing/splitting_filter.c",
141*d9f75844SAndroid Build Coastguard Worker    "signal_processing/sqrt_of_one_minus_x_squared.c",
142*d9f75844SAndroid Build Coastguard Worker    "signal_processing/vector_scaling_operations.c",
143*d9f75844SAndroid Build Coastguard Worker    "vad/include/webrtc_vad.h",
144*d9f75844SAndroid Build Coastguard Worker    "vad/vad_core.c",
145*d9f75844SAndroid Build Coastguard Worker    "vad/vad_core.h",
146*d9f75844SAndroid Build Coastguard Worker    "vad/vad_filterbank.c",
147*d9f75844SAndroid Build Coastguard Worker    "vad/vad_filterbank.h",
148*d9f75844SAndroid Build Coastguard Worker    "vad/vad_gmm.c",
149*d9f75844SAndroid Build Coastguard Worker    "vad/vad_gmm.h",
150*d9f75844SAndroid Build Coastguard Worker    "vad/vad_sp.c",
151*d9f75844SAndroid Build Coastguard Worker    "vad/vad_sp.h",
152*d9f75844SAndroid Build Coastguard Worker    "vad/webrtc_vad.c",
153*d9f75844SAndroid Build Coastguard Worker  ]
154*d9f75844SAndroid Build Coastguard Worker
155*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "mipsel") {
156*d9f75844SAndroid Build Coastguard Worker    sources += [
157*d9f75844SAndroid Build Coastguard Worker      "signal_processing/complex_bit_reverse_mips.c",
158*d9f75844SAndroid Build Coastguard Worker      "signal_processing/complex_fft_mips.c",
159*d9f75844SAndroid Build Coastguard Worker      "signal_processing/cross_correlation_mips.c",
160*d9f75844SAndroid Build Coastguard Worker      "signal_processing/downsample_fast_mips.c",
161*d9f75844SAndroid Build Coastguard Worker      "signal_processing/filter_ar_fast_q12_mips.c",
162*d9f75844SAndroid Build Coastguard Worker      "signal_processing/include/spl_inl_mips.h",
163*d9f75844SAndroid Build Coastguard Worker      "signal_processing/min_max_operations_mips.c",
164*d9f75844SAndroid Build Coastguard Worker      "signal_processing/resample_by_2_mips.c",
165*d9f75844SAndroid Build Coastguard Worker    ]
166*d9f75844SAndroid Build Coastguard Worker    if (mips_dsp_rev > 0) {
167*d9f75844SAndroid Build Coastguard Worker      sources += [ "signal_processing/vector_scaling_operations_mips.c" ]
168*d9f75844SAndroid Build Coastguard Worker    }
169*d9f75844SAndroid Build Coastguard Worker  } else {
170*d9f75844SAndroid Build Coastguard Worker    sources += [ "signal_processing/complex_fft.c" ]
171*d9f75844SAndroid Build Coastguard Worker  }
172*d9f75844SAndroid Build Coastguard Worker
173*d9f75844SAndroid Build Coastguard Worker  if (current_cpu != "arm" && current_cpu != "mipsel") {
174*d9f75844SAndroid Build Coastguard Worker    sources += [
175*d9f75844SAndroid Build Coastguard Worker      "signal_processing/complex_bit_reverse.c",
176*d9f75844SAndroid Build Coastguard Worker      "signal_processing/filter_ar_fast_q12.c",
177*d9f75844SAndroid Build Coastguard Worker    ]
178*d9f75844SAndroid Build Coastguard Worker  }
179*d9f75844SAndroid Build Coastguard Worker
180*d9f75844SAndroid Build Coastguard Worker  deps = [
181*d9f75844SAndroid Build Coastguard Worker    ":common_audio_c_arm_asm",
182*d9f75844SAndroid Build Coastguard Worker    ":common_audio_cc",
183*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:checks",
184*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:compile_assert_c",
185*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:sanitizer",
186*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/system:arch",
187*d9f75844SAndroid Build Coastguard Worker    "../system_wrappers",
188*d9f75844SAndroid Build Coastguard Worker    "third_party/ooura:fft_size_256",
189*d9f75844SAndroid Build Coastguard Worker    "third_party/spl_sqrt_floor",
190*d9f75844SAndroid Build Coastguard Worker  ]
191*d9f75844SAndroid Build Coastguard Worker}
192*d9f75844SAndroid Build Coastguard Worker
193*d9f75844SAndroid Build Coastguard Workerrtc_library("common_audio_cc") {
194*d9f75844SAndroid Build Coastguard Worker  sources = [
195*d9f75844SAndroid Build Coastguard Worker    "signal_processing/dot_product_with_scale.cc",
196*d9f75844SAndroid Build Coastguard Worker    "signal_processing/dot_product_with_scale.h",
197*d9f75844SAndroid Build Coastguard Worker  ]
198*d9f75844SAndroid Build Coastguard Worker
199*d9f75844SAndroid Build Coastguard Worker  deps = [
200*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:safe_conversions",
201*d9f75844SAndroid Build Coastguard Worker    "../system_wrappers",
202*d9f75844SAndroid Build Coastguard Worker  ]
203*d9f75844SAndroid Build Coastguard Worker}
204*d9f75844SAndroid Build Coastguard Worker
205*d9f75844SAndroid Build Coastguard Workerrtc_source_set("sinc_resampler") {
206*d9f75844SAndroid Build Coastguard Worker  sources = [ "resampler/sinc_resampler.h" ]
207*d9f75844SAndroid Build Coastguard Worker  deps = [
208*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:gtest_prod",
209*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/memory:aligned_malloc",
210*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/system:arch",
211*d9f75844SAndroid Build Coastguard Worker    "../system_wrappers",
212*d9f75844SAndroid Build Coastguard Worker  ]
213*d9f75844SAndroid Build Coastguard Worker}
214*d9f75844SAndroid Build Coastguard Worker
215*d9f75844SAndroid Build Coastguard Workerrtc_source_set("fir_filter") {
216*d9f75844SAndroid Build Coastguard Worker  visibility += webrtc_default_visibility
217*d9f75844SAndroid Build Coastguard Worker  sources = [ "fir_filter.h" ]
218*d9f75844SAndroid Build Coastguard Worker}
219*d9f75844SAndroid Build Coastguard Worker
220*d9f75844SAndroid Build Coastguard Workerrtc_library("fir_filter_factory") {
221*d9f75844SAndroid Build Coastguard Worker  visibility += webrtc_default_visibility
222*d9f75844SAndroid Build Coastguard Worker  sources = [
223*d9f75844SAndroid Build Coastguard Worker    "fir_filter_c.cc",
224*d9f75844SAndroid Build Coastguard Worker    "fir_filter_c.h",
225*d9f75844SAndroid Build Coastguard Worker    "fir_filter_factory.cc",
226*d9f75844SAndroid Build Coastguard Worker    "fir_filter_factory.h",
227*d9f75844SAndroid Build Coastguard Worker  ]
228*d9f75844SAndroid Build Coastguard Worker  deps = [
229*d9f75844SAndroid Build Coastguard Worker    ":fir_filter",
230*d9f75844SAndroid Build Coastguard Worker    "../rtc_base:checks",
231*d9f75844SAndroid Build Coastguard Worker    "../rtc_base/system:arch",
232*d9f75844SAndroid Build Coastguard Worker    "../system_wrappers",
233*d9f75844SAndroid Build Coastguard Worker  ]
234*d9f75844SAndroid Build Coastguard Worker  if (current_cpu == "x86" || current_cpu == "x64") {
235*d9f75844SAndroid Build Coastguard Worker    deps += [ ":common_audio_sse2" ]
236*d9f75844SAndroid Build Coastguard Worker    deps += [ ":common_audio_avx2" ]
237*d9f75844SAndroid Build Coastguard Worker  }
238*d9f75844SAndroid Build Coastguard Worker  if (rtc_build_with_neon) {
239*d9f75844SAndroid Build Coastguard Worker    deps += [ ":common_audio_neon" ]
240*d9f75844SAndroid Build Coastguard Worker  }
241*d9f75844SAndroid Build Coastguard Worker}
242*d9f75844SAndroid Build Coastguard Worker
243*d9f75844SAndroid Build Coastguard Workerif (current_cpu == "x86" || current_cpu == "x64") {
244*d9f75844SAndroid Build Coastguard Worker  rtc_library("common_audio_sse2") {
245*d9f75844SAndroid Build Coastguard Worker    sources = [
246*d9f75844SAndroid Build Coastguard Worker      "fir_filter_sse.cc",
247*d9f75844SAndroid Build Coastguard Worker      "fir_filter_sse.h",
248*d9f75844SAndroid Build Coastguard Worker      "resampler/sinc_resampler_sse.cc",
249*d9f75844SAndroid Build Coastguard Worker    ]
250*d9f75844SAndroid Build Coastguard Worker
251*d9f75844SAndroid Build Coastguard Worker    if (is_posix || is_fuchsia) {
252*d9f75844SAndroid Build Coastguard Worker      cflags = [ "-msse2" ]
253*d9f75844SAndroid Build Coastguard Worker    }
254*d9f75844SAndroid Build Coastguard Worker
255*d9f75844SAndroid Build Coastguard Worker    deps = [
256*d9f75844SAndroid Build Coastguard Worker      ":fir_filter",
257*d9f75844SAndroid Build Coastguard Worker      ":sinc_resampler",
258*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:checks",
259*d9f75844SAndroid Build Coastguard Worker      "../rtc_base/memory:aligned_malloc",
260*d9f75844SAndroid Build Coastguard Worker    ]
261*d9f75844SAndroid Build Coastguard Worker  }
262*d9f75844SAndroid Build Coastguard Worker
263*d9f75844SAndroid Build Coastguard Worker  rtc_library("common_audio_avx2") {
264*d9f75844SAndroid Build Coastguard Worker    sources = [
265*d9f75844SAndroid Build Coastguard Worker      "fir_filter_avx2.cc",
266*d9f75844SAndroid Build Coastguard Worker      "fir_filter_avx2.h",
267*d9f75844SAndroid Build Coastguard Worker      "resampler/sinc_resampler_avx2.cc",
268*d9f75844SAndroid Build Coastguard Worker    ]
269*d9f75844SAndroid Build Coastguard Worker
270*d9f75844SAndroid Build Coastguard Worker    if (is_win) {
271*d9f75844SAndroid Build Coastguard Worker      cflags = [ "/arch:AVX2" ]
272*d9f75844SAndroid Build Coastguard Worker    } else {
273*d9f75844SAndroid Build Coastguard Worker      cflags = [
274*d9f75844SAndroid Build Coastguard Worker        "-mavx2",
275*d9f75844SAndroid Build Coastguard Worker        "-mfma",
276*d9f75844SAndroid Build Coastguard Worker      ]
277*d9f75844SAndroid Build Coastguard Worker    }
278*d9f75844SAndroid Build Coastguard Worker
279*d9f75844SAndroid Build Coastguard Worker    deps = [
280*d9f75844SAndroid Build Coastguard Worker      ":fir_filter",
281*d9f75844SAndroid Build Coastguard Worker      ":sinc_resampler",
282*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:checks",
283*d9f75844SAndroid Build Coastguard Worker      "../rtc_base/memory:aligned_malloc",
284*d9f75844SAndroid Build Coastguard Worker    ]
285*d9f75844SAndroid Build Coastguard Worker  }
286*d9f75844SAndroid Build Coastguard Worker}
287*d9f75844SAndroid Build Coastguard Worker
288*d9f75844SAndroid Build Coastguard Workerif (rtc_build_with_neon) {
289*d9f75844SAndroid Build Coastguard Worker  rtc_library("common_audio_neon") {
290*d9f75844SAndroid Build Coastguard Worker    sources = [
291*d9f75844SAndroid Build Coastguard Worker      "fir_filter_neon.cc",
292*d9f75844SAndroid Build Coastguard Worker      "fir_filter_neon.h",
293*d9f75844SAndroid Build Coastguard Worker      "resampler/sinc_resampler_neon.cc",
294*d9f75844SAndroid Build Coastguard Worker    ]
295*d9f75844SAndroid Build Coastguard Worker
296*d9f75844SAndroid Build Coastguard Worker    if (current_cpu != "arm64") {
297*d9f75844SAndroid Build Coastguard Worker      # Enable compilation for the NEON instruction set.
298*d9f75844SAndroid Build Coastguard Worker      suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
299*d9f75844SAndroid Build Coastguard Worker      cflags = [ "-mfpu=neon" ]
300*d9f75844SAndroid Build Coastguard Worker    }
301*d9f75844SAndroid Build Coastguard Worker
302*d9f75844SAndroid Build Coastguard Worker    deps = [
303*d9f75844SAndroid Build Coastguard Worker      ":common_audio_neon_c",
304*d9f75844SAndroid Build Coastguard Worker      ":fir_filter",
305*d9f75844SAndroid Build Coastguard Worker      ":sinc_resampler",
306*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:checks",
307*d9f75844SAndroid Build Coastguard Worker      "../rtc_base/memory:aligned_malloc",
308*d9f75844SAndroid Build Coastguard Worker    ]
309*d9f75844SAndroid Build Coastguard Worker  }
310*d9f75844SAndroid Build Coastguard Worker
311*d9f75844SAndroid Build Coastguard Worker  rtc_library("common_audio_neon_c") {
312*d9f75844SAndroid Build Coastguard Worker    visibility += webrtc_default_visibility
313*d9f75844SAndroid Build Coastguard Worker    sources = [
314*d9f75844SAndroid Build Coastguard Worker      "signal_processing/cross_correlation_neon.c",
315*d9f75844SAndroid Build Coastguard Worker      "signal_processing/downsample_fast_neon.c",
316*d9f75844SAndroid Build Coastguard Worker      "signal_processing/min_max_operations_neon.c",
317*d9f75844SAndroid Build Coastguard Worker    ]
318*d9f75844SAndroid Build Coastguard Worker
319*d9f75844SAndroid Build Coastguard Worker    if (current_cpu != "arm64") {
320*d9f75844SAndroid Build Coastguard Worker      # Enable compilation for the NEON instruction set.
321*d9f75844SAndroid Build Coastguard Worker      suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
322*d9f75844SAndroid Build Coastguard Worker      cflags = [ "-mfpu=neon" ]
323*d9f75844SAndroid Build Coastguard Worker    }
324*d9f75844SAndroid Build Coastguard Worker
325*d9f75844SAndroid Build Coastguard Worker    deps = [
326*d9f75844SAndroid Build Coastguard Worker      ":common_audio_c",
327*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:checks",
328*d9f75844SAndroid Build Coastguard Worker      "../rtc_base/system:arch",
329*d9f75844SAndroid Build Coastguard Worker    ]
330*d9f75844SAndroid Build Coastguard Worker  }
331*d9f75844SAndroid Build Coastguard Worker}
332*d9f75844SAndroid Build Coastguard Worker
333*d9f75844SAndroid Build Coastguard Workerif (rtc_include_tests && !build_with_chromium) {
334*d9f75844SAndroid Build Coastguard Worker  rtc_test("common_audio_unittests") {
335*d9f75844SAndroid Build Coastguard Worker    visibility += webrtc_default_visibility
336*d9f75844SAndroid Build Coastguard Worker    testonly = true
337*d9f75844SAndroid Build Coastguard Worker
338*d9f75844SAndroid Build Coastguard Worker    sources = [
339*d9f75844SAndroid Build Coastguard Worker      "audio_converter_unittest.cc",
340*d9f75844SAndroid Build Coastguard Worker      "audio_util_unittest.cc",
341*d9f75844SAndroid Build Coastguard Worker      "channel_buffer_unittest.cc",
342*d9f75844SAndroid Build Coastguard Worker      "fir_filter_unittest.cc",
343*d9f75844SAndroid Build Coastguard Worker      "real_fourier_unittest.cc",
344*d9f75844SAndroid Build Coastguard Worker      "resampler/push_resampler_unittest.cc",
345*d9f75844SAndroid Build Coastguard Worker      "resampler/push_sinc_resampler_unittest.cc",
346*d9f75844SAndroid Build Coastguard Worker      "resampler/resampler_unittest.cc",
347*d9f75844SAndroid Build Coastguard Worker      "resampler/sinusoidal_linear_chirp_source.cc",
348*d9f75844SAndroid Build Coastguard Worker      "resampler/sinusoidal_linear_chirp_source.h",
349*d9f75844SAndroid Build Coastguard Worker      "ring_buffer_unittest.cc",
350*d9f75844SAndroid Build Coastguard Worker      "signal_processing/real_fft_unittest.cc",
351*d9f75844SAndroid Build Coastguard Worker      "signal_processing/signal_processing_unittest.cc",
352*d9f75844SAndroid Build Coastguard Worker      "smoothing_filter_unittest.cc",
353*d9f75844SAndroid Build Coastguard Worker      "vad/vad_core_unittest.cc",
354*d9f75844SAndroid Build Coastguard Worker      "vad/vad_filterbank_unittest.cc",
355*d9f75844SAndroid Build Coastguard Worker      "vad/vad_gmm_unittest.cc",
356*d9f75844SAndroid Build Coastguard Worker      "vad/vad_sp_unittest.cc",
357*d9f75844SAndroid Build Coastguard Worker      "vad/vad_unittest.cc",
358*d9f75844SAndroid Build Coastguard Worker      "vad/vad_unittest.h",
359*d9f75844SAndroid Build Coastguard Worker      "wav_file_unittest.cc",
360*d9f75844SAndroid Build Coastguard Worker      "wav_header_unittest.cc",
361*d9f75844SAndroid Build Coastguard Worker      "window_generator_unittest.cc",
362*d9f75844SAndroid Build Coastguard Worker    ]
363*d9f75844SAndroid Build Coastguard Worker
364*d9f75844SAndroid Build Coastguard Worker    # Does not compile on iOS for arm: webrtc:5544.
365*d9f75844SAndroid Build Coastguard Worker    if (!is_ios || target_cpu != "arm") {
366*d9f75844SAndroid Build Coastguard Worker      sources += [ "resampler/sinc_resampler_unittest.cc" ]
367*d9f75844SAndroid Build Coastguard Worker    }
368*d9f75844SAndroid Build Coastguard Worker
369*d9f75844SAndroid Build Coastguard Worker    deps = [
370*d9f75844SAndroid Build Coastguard Worker      ":common_audio",
371*d9f75844SAndroid Build Coastguard Worker      ":common_audio_c",
372*d9f75844SAndroid Build Coastguard Worker      ":fir_filter",
373*d9f75844SAndroid Build Coastguard Worker      ":fir_filter_factory",
374*d9f75844SAndroid Build Coastguard Worker      ":sinc_resampler",
375*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:checks",
376*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:macromagic",
377*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:rtc_base_tests_utils",
378*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:stringutils",
379*d9f75844SAndroid Build Coastguard Worker      "../rtc_base:timeutils",
380*d9f75844SAndroid Build Coastguard Worker      "../rtc_base/system:arch",
381*d9f75844SAndroid Build Coastguard Worker      "../system_wrappers",
382*d9f75844SAndroid Build Coastguard Worker      "../test:fileutils",
383*d9f75844SAndroid Build Coastguard Worker      "../test:rtc_expect_death",
384*d9f75844SAndroid Build Coastguard Worker      "../test:test_main",
385*d9f75844SAndroid Build Coastguard Worker      "../test:test_support",
386*d9f75844SAndroid Build Coastguard Worker      "//testing/gtest",
387*d9f75844SAndroid Build Coastguard Worker    ]
388*d9f75844SAndroid Build Coastguard Worker
389*d9f75844SAndroid Build Coastguard Worker    if (is_android) {
390*d9f75844SAndroid Build Coastguard Worker      deps += [ "//testing/android/native_test:native_test_support" ]
391*d9f75844SAndroid Build Coastguard Worker
392*d9f75844SAndroid Build Coastguard Worker      shard_timeout = 900
393*d9f75844SAndroid Build Coastguard Worker    }
394*d9f75844SAndroid Build Coastguard Worker  }
395*d9f75844SAndroid Build Coastguard Worker}
396