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("level_estimation_agc") {
19  sources = [
20    "adaptive_mode_level_estimator_agc.cc",
21    "adaptive_mode_level_estimator_agc.h",
22  ]
23  configs += [ "..:apm_debug_dump" ]
24  deps = [
25    ":adaptive_digital",
26    ":common",
27    ":gain_applier",
28    ":noise_level_estimator",
29    ":rnn_vad_with_level",
30    "..:api",
31    "..:apm_logging",
32    "..:audio_frame_view",
33    "../../../api:array_view",
34    "../../../common_audio",
35    "../../../rtc_base:checks",
36    "../../../rtc_base:rtc_base_approved",
37    "../../../rtc_base:safe_minmax",
38    "../agc:level_estimation",
39    "../vad",
40  ]
41}
42
43rtc_library("adaptive_digital") {
44  sources = [
45    "adaptive_agc.cc",
46    "adaptive_agc.h",
47    "adaptive_digital_gain_applier.cc",
48    "adaptive_digital_gain_applier.h",
49    "adaptive_mode_level_estimator.cc",
50    "adaptive_mode_level_estimator.h",
51    "saturation_protector.cc",
52    "saturation_protector.h",
53  ]
54
55  configs += [ "..:apm_debug_dump" ]
56
57  deps = [
58    ":common",
59    ":gain_applier",
60    ":noise_level_estimator",
61    ":rnn_vad_with_level",
62    "..:api",
63    "..:apm_logging",
64    "..:audio_frame_view",
65    "../../../api:array_view",
66    "../../../common_audio",
67    "../../../rtc_base:checks",
68    "../../../rtc_base:rtc_base_approved",
69    "../../../rtc_base:safe_minmax",
70    "../../../system_wrappers:metrics",
71  ]
72}
73
74rtc_library("biquad_filter") {
75  visibility = [ "./*" ]
76  sources = [
77    "biquad_filter.cc",
78    "biquad_filter.h",
79  ]
80  deps = [
81    "../../../api:array_view",
82    "../../../rtc_base:rtc_base_approved",
83  ]
84}
85
86rtc_library("common") {
87  sources = [
88    "agc2_common.cc",
89    "agc2_common.h",
90  ]
91  deps = [
92    "../../../rtc_base:rtc_base_approved",
93    "../../../system_wrappers:field_trial",
94  ]
95}
96
97rtc_library("fixed_digital") {
98  sources = [
99    "fixed_digital_level_estimator.cc",
100    "fixed_digital_level_estimator.h",
101    "interpolated_gain_curve.cc",
102    "interpolated_gain_curve.h",
103    "limiter.cc",
104    "limiter.h",
105  ]
106
107  configs += [ "..:apm_debug_dump" ]
108
109  deps = [
110    ":common",
111    "..:apm_logging",
112    "..:audio_frame_view",
113    "../../../api:array_view",
114    "../../../common_audio",
115    "../../../rtc_base:checks",
116    "../../../rtc_base:gtest_prod",
117    "../../../rtc_base:rtc_base_approved",
118    "../../../rtc_base:safe_minmax",
119    "../../../system_wrappers:metrics",
120  ]
121}
122
123rtc_library("gain_applier") {
124  sources = [
125    "gain_applier.cc",
126    "gain_applier.h",
127  ]
128  deps = [
129    ":common",
130    "..:audio_frame_view",
131    "../../../api:array_view",
132    "../../../rtc_base:safe_minmax",
133  ]
134}
135
136rtc_library("noise_level_estimator") {
137  sources = [
138    "down_sampler.cc",
139    "down_sampler.h",
140    "noise_level_estimator.cc",
141    "noise_level_estimator.h",
142    "noise_spectrum_estimator.cc",
143    "noise_spectrum_estimator.h",
144    "signal_classifier.cc",
145    "signal_classifier.h",
146  ]
147  deps = [
148    ":biquad_filter",
149    "..:apm_logging",
150    "..:audio_frame_view",
151    "../../../api:array_view",
152    "../../../common_audio",
153    "../../../common_audio/third_party/ooura:fft_size_128",
154    "../../../rtc_base:checks",
155    "../../../rtc_base:macromagic",
156    "../../../system_wrappers:cpu_features_api",
157  ]
158
159  configs += [ "..:apm_debug_dump" ]
160}
161
162rtc_library("rnn_vad_with_level") {
163  sources = [
164    "vad_with_level.cc",
165    "vad_with_level.h",
166  ]
167  deps = [
168    "..:audio_frame_view",
169    "../../../api:array_view",
170    "../../../common_audio",
171    "../../../rtc_base:checks",
172    "rnn_vad",
173  ]
174}
175
176rtc_library("adaptive_digital_unittests") {
177  testonly = true
178  configs += [ "..:apm_debug_dump" ]
179
180  sources = [
181    "adaptive_digital_gain_applier_unittest.cc",
182    "adaptive_mode_level_estimator_unittest.cc",
183    "gain_applier_unittest.cc",
184    "saturation_protector_unittest.cc",
185  ]
186  deps = [
187    ":adaptive_digital",
188    ":common",
189    ":gain_applier",
190    ":test_utils",
191    "..:apm_logging",
192    "..:audio_frame_view",
193    "../../../api:array_view",
194    "../../../common_audio",
195    "../../../rtc_base:checks",
196    "../../../rtc_base:gunit_helpers",
197    "../../../rtc_base:rtc_base_approved",
198  ]
199}
200
201rtc_library("biquad_filter_unittests") {
202  testonly = true
203  sources = [ "biquad_filter_unittest.cc" ]
204  deps = [
205    ":biquad_filter",
206    "../../../rtc_base:gunit_helpers",
207  ]
208}
209
210rtc_library("fixed_digital_unittests") {
211  testonly = true
212  configs += [ "..:apm_debug_dump" ]
213
214  sources = [
215    "agc2_testing_common_unittest.cc",
216    "compute_interpolated_gain_curve.cc",
217    "compute_interpolated_gain_curve.h",
218    "fixed_digital_level_estimator_unittest.cc",
219    "interpolated_gain_curve_unittest.cc",
220    "limiter_db_gain_curve.cc",
221    "limiter_db_gain_curve.h",
222    "limiter_db_gain_curve_unittest.cc",
223    "limiter_unittest.cc",
224  ]
225  deps = [
226    ":common",
227    ":fixed_digital",
228    ":test_utils",
229    "..:apm_logging",
230    "..:audio_frame_view",
231    "../../../api:array_view",
232    "../../../common_audio",
233    "../../../rtc_base:checks",
234    "../../../rtc_base:gunit_helpers",
235    "../../../rtc_base:rtc_base_approved",
236    "../../../system_wrappers:metrics",
237  ]
238}
239
240rtc_library("noise_estimator_unittests") {
241  testonly = true
242  configs += [ "..:apm_debug_dump" ]
243
244  sources = [
245    "noise_level_estimator_unittest.cc",
246    "signal_classifier_unittest.cc",
247  ]
248  deps = [
249    ":noise_level_estimator",
250    ":test_utils",
251    "..:apm_logging",
252    "..:audio_frame_view",
253    "../../../api:array_view",
254    "../../../rtc_base:checks",
255    "../../../rtc_base:gunit_helpers",
256    "../../../rtc_base:rtc_base_approved",
257  ]
258}
259
260rtc_library("rnn_vad_with_level_unittests") {
261  testonly = true
262  sources = [ "vad_with_level_unittest.cc" ]
263  deps = [
264    ":rnn_vad_with_level",
265    "..:audio_frame_view",
266    "../../../rtc_base:gunit_helpers",
267  ]
268}
269
270rtc_library("test_utils") {
271  testonly = true
272  visibility = [
273    ":*",
274    "..:audio_processing_unittests",
275  ]
276  sources = [
277    "agc2_testing_common.cc",
278    "agc2_testing_common.h",
279    "vector_float_frame.cc",
280    "vector_float_frame.h",
281  ]
282  deps = [
283    "..:audio_frame_view",
284    "../../../rtc_base:checks",
285    "../../../rtc_base:rtc_base_approved",
286  ]
287}
288