xref: /aosp_15_r20/external/webrtc/modules/audio_processing/agc2/BUILD.gn (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1# Copyright (c) 2017 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("../../../webrtc.gni")
10
11group("agc2") {
12  deps = [
13    ":adaptive_digital",
14    ":fixed_digital",
15  ]
16}
17
18rtc_library("speech_level_estimator") {
19  sources = [
20    "speech_level_estimator.cc",
21    "speech_level_estimator.h",
22  ]
23
24  visibility = [
25    "..:gain_controller2",
26    "./*",
27  ]
28
29  configs += [ "..:apm_debug_dump" ]
30
31  deps = [
32    ":common",
33    "..:api",
34    "..:apm_logging",
35    "../../../api:array_view",
36    "../../../rtc_base:checks",
37    "../../../rtc_base:logging",
38    "../../../rtc_base:safe_minmax",
39  ]
40}
41
42rtc_library("adaptive_digital") {
43  sources = [
44    "adaptive_digital_gain_controller.cc",
45    "adaptive_digital_gain_controller.h",
46  ]
47
48  visibility = [
49    "..:gain_controller2",
50    "./*",
51  ]
52
53  configs += [ "..:apm_debug_dump" ]
54
55  deps = [
56    ":adaptive_digital_gain_applier",
57    ":noise_level_estimator",
58    ":saturation_protector",
59    ":speech_level_estimator",
60    "..:api",
61    "..:apm_logging",
62    "..:audio_frame_view",
63    "../../../common_audio",
64    "../../../rtc_base:checks",
65    "../../../rtc_base:logging",
66  ]
67
68  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
69}
70
71rtc_library("adaptive_digital_gain_applier") {
72  sources = [
73    "adaptive_digital_gain_applier.cc",
74    "adaptive_digital_gain_applier.h",
75  ]
76
77  visibility = [
78    "..:gain_controller2",
79    "./*",
80  ]
81
82  configs += [ "..:apm_debug_dump" ]
83
84  deps = [
85    ":common",
86    ":gain_applier",
87    "..:api",
88    "..:apm_logging",
89    "..:audio_frame_view",
90    "../../../common_audio",
91    "../../../rtc_base:checks",
92    "../../../rtc_base:logging",
93    "../../../rtc_base:safe_minmax",
94    "../../../system_wrappers:metrics",
95  ]
96}
97
98rtc_library("saturation_protector") {
99  sources = [
100    "saturation_protector.cc",
101    "saturation_protector.h",
102    "saturation_protector_buffer.cc",
103    "saturation_protector_buffer.h",
104  ]
105
106  visibility = [
107    "..:gain_controller2",
108    "./*",
109  ]
110
111  configs += [ "..:apm_debug_dump" ]
112
113  deps = [
114    ":common",
115    "..:apm_logging",
116    "../../../rtc_base:checks",
117    "../../../rtc_base:safe_compare",
118    "../../../rtc_base:safe_minmax",
119  ]
120
121  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
122}
123
124rtc_library("biquad_filter") {
125  visibility = [ "./*" ]
126  sources = [
127    "biquad_filter.cc",
128    "biquad_filter.h",
129  ]
130  deps = [
131    "../../../api:array_view",
132    "../../../rtc_base:macromagic",
133  ]
134}
135
136rtc_library("clipping_predictor") {
137  visibility = [
138    "../agc:agc",
139    "./*",
140  ]
141
142  sources = [
143    "clipping_predictor.cc",
144    "clipping_predictor.h",
145    "clipping_predictor_level_buffer.cc",
146    "clipping_predictor_level_buffer.h",
147  ]
148
149  deps = [
150    ":gain_map",
151    "..:api",
152    "..:audio_frame_view",
153    "../../../common_audio",
154    "../../../rtc_base:checks",
155    "../../../rtc_base:logging",
156    "../../../rtc_base:safe_minmax",
157  ]
158
159  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
160}
161
162rtc_source_set("common") {
163  sources = [ "agc2_common.h" ]
164}
165
166rtc_library("fixed_digital") {
167  sources = [
168    "fixed_digital_level_estimator.cc",
169    "fixed_digital_level_estimator.h",
170    "interpolated_gain_curve.cc",
171    "interpolated_gain_curve.h",
172    "limiter.cc",
173    "limiter.h",
174  ]
175
176  visibility = [
177    "..:gain_controller2",
178    "../../audio_mixer:audio_mixer_impl",
179    "./*",
180  ]
181
182  configs += [ "..:apm_debug_dump" ]
183
184  deps = [
185    ":common",
186    "..:apm_logging",
187    "..:audio_frame_view",
188    "../../../api:array_view",
189    "../../../common_audio",
190    "../../../rtc_base:checks",
191    "../../../rtc_base:gtest_prod",
192    "../../../rtc_base:safe_conversions",
193    "../../../rtc_base:safe_minmax",
194    "../../../rtc_base:stringutils",
195    "../../../system_wrappers:metrics",
196  ]
197  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
198}
199
200rtc_library("gain_applier") {
201  sources = [
202    "gain_applier.cc",
203    "gain_applier.h",
204  ]
205
206  visibility = [
207    "..:gain_controller2",
208    "./*",
209  ]
210
211  deps = [
212    ":common",
213    "..:audio_frame_view",
214    "../../../api:array_view",
215    "../../../rtc_base:safe_minmax",
216  ]
217}
218
219rtc_source_set("gain_map") {
220  visibility = [
221    "..:analog_mic_simulation",
222    "../agc:agc",
223    "./*",
224  ]
225
226  sources = [ "gain_map_internal.h" ]
227}
228
229rtc_library("input_volume_controller") {
230  sources = [
231    "input_volume_controller.cc",
232    "input_volume_controller.h",
233    "speech_probability_buffer.cc",
234    "speech_probability_buffer.h",
235  ]
236
237  visibility = [
238    "..:gain_controller2",
239    "./*",
240  ]
241
242  configs += [ "..:apm_debug_dump" ]
243
244  deps = [
245    ":clipping_predictor",
246    ":gain_map",
247    "..:api",
248    "..:audio_buffer",
249    "..:audio_frame_view",
250    "../../../api:array_view",
251    "../../../rtc_base:checks",
252    "../../../rtc_base:checks",
253    "../../../rtc_base:gtest_prod",
254    "../../../rtc_base:gtest_prod",
255    "../../../rtc_base:logging",
256    "../../../rtc_base:safe_minmax",
257    "../../../system_wrappers:field_trial",
258    "../../../system_wrappers:metrics",
259  ]
260
261  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
262}
263
264rtc_library("noise_level_estimator") {
265  sources = [
266    "noise_level_estimator.cc",
267    "noise_level_estimator.h",
268  ]
269  visibility = [ "./*" ]
270  deps = [
271    ":biquad_filter",
272    "..:apm_logging",
273    "..:audio_frame_view",
274    "../../../api:array_view",
275    "../../../rtc_base:checks",
276    "../../../system_wrappers",
277  ]
278
279  configs += [ "..:apm_debug_dump" ]
280}
281
282rtc_library("vad_wrapper") {
283  sources = [
284    "vad_wrapper.cc",
285    "vad_wrapper.h",
286  ]
287
288  visibility = [
289    "..:gain_controller2",
290    "./*",
291  ]
292
293  defines = []
294  if (rtc_build_with_neon && current_cpu != "arm64") {
295    suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
296    cflags = [ "-mfpu=neon" ]
297  }
298
299  deps = [
300    ":common",
301    ":cpu_features",
302    "..:audio_frame_view",
303    "../../../api:array_view",
304    "../../../common_audio",
305    "../../../rtc_base:checks",
306    "rnn_vad",
307    "rnn_vad:rnn_vad_common",
308  ]
309}
310
311rtc_library("cpu_features") {
312  sources = [
313    "cpu_features.cc",
314    "cpu_features.h",
315  ]
316
317  visibility = [
318    "..:gain_controller2",
319    "./*",
320  ]
321
322  deps = [
323    "../../../rtc_base:stringutils",
324    "../../../rtc_base/system:arch",
325    "../../../system_wrappers",
326  ]
327}
328
329rtc_library("speech_level_estimator_unittest") {
330  testonly = true
331  configs += [ "..:apm_debug_dump" ]
332
333  sources = [ "speech_level_estimator_unittest.cc" ]
334  deps = [
335    ":common",
336    ":speech_level_estimator",
337    "..:api",
338    "..:apm_logging",
339    "../../../rtc_base:gunit_helpers",
340    "../../../test:test_support",
341  ]
342}
343
344rtc_library("adaptive_digital_gain_applier_unittest") {
345  testonly = true
346  configs += [ "..:apm_debug_dump" ]
347
348  sources = [ "adaptive_digital_gain_applier_unittest.cc" ]
349
350  deps = [
351    ":adaptive_digital_gain_applier",
352    ":common",
353    ":test_utils",
354    "..:api",
355    "..:apm_logging",
356    "..:audio_frame_view",
357    "../../../common_audio",
358    "../../../rtc_base:gunit_helpers",
359    "../../../test:test_support",
360  ]
361}
362
363rtc_library("gain_applier_unittest") {
364  testonly = true
365  configs += [ "..:apm_debug_dump" ]
366
367  sources = [ "gain_applier_unittest.cc" ]
368  deps = [
369    ":gain_applier",
370    ":test_utils",
371    "..:audio_frame_view",
372    "../../../rtc_base:gunit_helpers",
373    "../../../test:test_support",
374  ]
375}
376
377rtc_library("saturation_protector_unittest") {
378  testonly = true
379  configs += [ "..:apm_debug_dump" ]
380
381  sources = [
382    "saturation_protector_buffer_unittest.cc",
383    "saturation_protector_unittest.cc",
384  ]
385  deps = [
386    ":common",
387    ":saturation_protector",
388    "..:apm_logging",
389    "../../../rtc_base:gunit_helpers",
390    "../../../test:test_support",
391  ]
392}
393
394rtc_library("biquad_filter_unittests") {
395  testonly = true
396  sources = [ "biquad_filter_unittest.cc" ]
397  deps = [
398    ":biquad_filter",
399    "../../../rtc_base:gunit_helpers",
400  ]
401}
402
403rtc_library("fixed_digital_unittests") {
404  testonly = true
405  configs += [ "..:apm_debug_dump" ]
406
407  sources = [
408    "agc2_testing_common_unittest.cc",
409    "compute_interpolated_gain_curve.cc",
410    "compute_interpolated_gain_curve.h",
411    "fixed_digital_level_estimator_unittest.cc",
412    "interpolated_gain_curve_unittest.cc",
413    "limiter_db_gain_curve.cc",
414    "limiter_db_gain_curve.h",
415    "limiter_db_gain_curve_unittest.cc",
416    "limiter_unittest.cc",
417  ]
418  deps = [
419    ":common",
420    ":fixed_digital",
421    ":test_utils",
422    "..:apm_logging",
423    "..:audio_frame_view",
424    "../../../api:array_view",
425    "../../../common_audio",
426    "../../../rtc_base:checks",
427    "../../../rtc_base:gunit_helpers",
428    "../../../system_wrappers:metrics",
429  ]
430}
431
432rtc_library("input_volume_controller_unittests") {
433  testonly = true
434  sources = [
435    "clipping_predictor_level_buffer_unittest.cc",
436    "clipping_predictor_unittest.cc",
437    "input_volume_controller_unittest.cc",
438    "speech_probability_buffer_unittest.cc",
439  ]
440
441  configs += [ "..:apm_debug_dump" ]
442
443  deps = [
444    ":clipping_predictor",
445    ":gain_map",
446    ":input_volume_controller",
447    "..:api",
448    "../../../api:array_view",
449    "../../../rtc_base:checks",
450    "../../../rtc_base:random",
451    "../../../rtc_base:safe_conversions",
452    "../../../rtc_base:safe_minmax",
453    "../../../rtc_base:stringutils",
454    "../../../system_wrappers:metrics",
455    "../../../test:field_trial",
456    "../../../test:fileutils",
457    "../../../test:test_support",
458    "//testing/gtest",
459  ]
460
461  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
462}
463
464rtc_library("noise_estimator_unittests") {
465  testonly = true
466  configs += [ "..:apm_debug_dump" ]
467
468  sources = [ "noise_level_estimator_unittest.cc" ]
469  deps = [
470    ":noise_level_estimator",
471    ":test_utils",
472    "..:apm_logging",
473    "..:audio_frame_view",
474    "../../../api:array_view",
475    "../../../api:function_view",
476    "../../../rtc_base:checks",
477    "../../../rtc_base:gunit_helpers",
478  ]
479}
480
481rtc_library("vad_wrapper_unittests") {
482  testonly = true
483  sources = [ "vad_wrapper_unittest.cc" ]
484  deps = [
485    ":common",
486    ":vad_wrapper",
487    "..:audio_frame_view",
488    "../../../rtc_base:checks",
489    "../../../rtc_base:gunit_helpers",
490    "../../../rtc_base:safe_compare",
491    "../../../test:test_support",
492  ]
493}
494
495rtc_library("test_utils") {
496  testonly = true
497  visibility = [
498    ":*",
499    "..:audio_processing_unittests",
500  ]
501  sources = [
502    "agc2_testing_common.cc",
503    "agc2_testing_common.h",
504    "vector_float_frame.cc",
505    "vector_float_frame.h",
506  ]
507  deps = [
508    "..:audio_frame_view",
509    "../../../rtc_base:checks",
510    "../../../rtc_base:random",
511  ]
512}
513
514rtc_library("input_volume_stats_reporter") {
515  sources = [
516    "input_volume_stats_reporter.cc",
517    "input_volume_stats_reporter.h",
518  ]
519  deps = [
520    "../../../rtc_base:gtest_prod",
521    "../../../rtc_base:logging",
522    "../../../rtc_base:safe_minmax",
523    "../../../rtc_base:stringutils",
524    "../../../system_wrappers:metrics",
525  ]
526  absl_deps = [
527    "//third_party/abseil-cpp/absl/strings",
528    "//third_party/abseil-cpp/absl/types:optional",
529  ]
530}
531
532rtc_library("input_volume_stats_reporter_unittests") {
533  testonly = true
534  sources = [ "input_volume_stats_reporter_unittest.cc" ]
535  deps = [
536    ":input_volume_stats_reporter",
537    "../../../rtc_base:stringutils",
538    "../../../system_wrappers:metrics",
539    "../../../test:test_support",
540  ]
541  absl_deps = [ "//third_party/abseil-cpp/absl/strings" ]
542}
543