xref: /aosp_15_r20/external/webrtc/modules/audio_processing/agc/BUILD.gn (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1# Copyright (c) 2018 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
11rtc_source_set("gain_control_interface") {
12  sources = [ "gain_control.h" ]
13}
14
15rtc_library("agc") {
16  sources = [
17    "agc_manager_direct.cc",
18    "agc_manager_direct.h",
19  ]
20  configs += [ "..:apm_debug_dump" ]
21  deps = [
22    ":gain_control_interface",
23    ":level_estimation",
24    "..:api",
25    "..:apm_logging",
26    "..:audio_buffer",
27    "..:audio_frame_view",
28    "../../../api:array_view",
29    "../../../common_audio",
30    "../../../common_audio:common_audio_c",
31    "../../../rtc_base:checks",
32    "../../../rtc_base:gtest_prod",
33    "../../../rtc_base:logging",
34    "../../../rtc_base:safe_minmax",
35    "../../../system_wrappers:field_trial",
36    "../../../system_wrappers:metrics",
37    "../agc2:clipping_predictor",
38    "../agc2:gain_map",
39    "../vad",
40  ]
41  absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
42}
43
44rtc_library("level_estimation") {
45  sources = [
46    "agc.cc",
47    "agc.h",
48    "loudness_histogram.cc",
49    "loudness_histogram.h",
50    "utility.cc",
51    "utility.h",
52  ]
53  deps = [
54    "../../../api:array_view",
55    "../../../rtc_base:checks",
56    "../vad",
57  ]
58}
59
60rtc_library("legacy_agc") {
61  visibility = [
62    ":*",
63    "..:*",
64  ]  # Only targets in this file and in
65     # audio_processing can depend on
66     # this.
67
68  sources = [
69    "legacy/analog_agc.cc",
70    "legacy/analog_agc.h",
71    "legacy/digital_agc.cc",
72    "legacy/digital_agc.h",
73    "legacy/gain_control.h",
74  ]
75
76  deps = [
77    "../../../common_audio",
78    "../../../common_audio:common_audio_c",
79    "../../../common_audio/third_party/ooura:fft_size_256",
80    "../../../rtc_base:checks",
81    "../../../system_wrappers",
82  ]
83
84  if (rtc_build_with_neon) {
85    if (current_cpu != "arm64") {
86      # Enable compilation for the NEON instruction set.
87      suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
88      cflags = [ "-mfpu=neon" ]
89    }
90  }
91}
92
93if (rtc_include_tests) {
94  rtc_library("agc_unittests") {
95    testonly = true
96    sources = [
97      "agc_manager_direct_unittest.cc",
98      "loudness_histogram_unittest.cc",
99      "mock_agc.h",
100    ]
101    configs += [ "..:apm_debug_dump" ]
102
103    deps = [
104      ":agc",
105      ":gain_control_interface",
106      ":level_estimation",
107      "..:mocks",
108      "../../../api:array_view",
109      "../../../rtc_base:checks",
110      "../../../rtc_base:random",
111      "../../../rtc_base:safe_conversions",
112      "../../../rtc_base:safe_minmax",
113      "../../../rtc_base:stringutils",
114      "../../../system_wrappers:metrics",
115      "../../../test:field_trial",
116      "../../../test:fileutils",
117      "../../../test:test_support",
118      "//testing/gtest",
119    ]
120    absl_deps = [
121      "//third_party/abseil-cpp/absl/strings",
122      "//third_party/abseil-cpp/absl/types:optional",
123    ]
124  }
125}
126