blob: 09781b24288ac60bb9ebd6a42b544081ace53bcf [file] [log] [blame]
Alex Loikoed8ff642018-07-06 14:54:30 +02001# 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("agc") {
12 sources = [
13 "agc_manager_direct.cc",
14 "agc_manager_direct.h",
15 ]
16 configs += [ "..:apm_debug_dump" ]
17 deps = [
18 ":gain_map",
19 ":level_estimation",
20 "..:apm_logging",
21 "..:gain_control_interface",
Per Ã…hgren928146f2019-08-20 09:19:21 +020022 "../../../common_audio",
23 "../../../common_audio:common_audio_c",
Alex Loikoed8ff642018-07-06 14:54:30 +020024 "../../../rtc_base:checks",
Alex Loiko9489c3a2018-08-09 15:04:24 +020025 "../../../rtc_base:gtest_prod",
Alex Loikoed8ff642018-07-06 14:54:30 +020026 "../../../rtc_base:logging",
27 "../../../rtc_base:macromagic",
28 "../../../rtc_base:safe_minmax",
Mirko Bonadei17f48782018-09-28 08:51:10 +020029 "../../../system_wrappers:metrics",
Alex Loiko2ffafa82018-07-06 15:35:42 +020030 "../agc2:level_estimation_agc",
Alex Loikoed8ff642018-07-06 14:54:30 +020031 "../vad",
32 ]
33}
34
35rtc_source_set("level_estimation") {
36 sources = [
37 "agc.cc",
38 "agc.h",
39 "loudness_histogram.cc",
40 "loudness_histogram.h",
41 "utility.cc",
42 "utility.h",
43 ]
44 deps = [
Alex Loikoed8ff642018-07-06 14:54:30 +020045 "../../../rtc_base:checks",
46 "../../../rtc_base:macromagic",
47 "../vad",
48 ]
49}
50
51rtc_source_set("agc_legacy_c") {
52 visibility = [
53 ":*",
54 "..:*",
55 ] # Only targets in this file and in
56 # audio_processing can depend on
57 # this.
58
59 sources = [
60 "legacy/analog_agc.c",
61 "legacy/analog_agc.h",
62 "legacy/digital_agc.c",
63 "legacy/digital_agc.h",
64 "legacy/gain_control.h",
65 ]
66
67 deps = [
Alex Loikoed8ff642018-07-06 14:54:30 +020068 "../../../common_audio",
69 "../../../common_audio:common_audio_c",
Artem Titov333a5052018-07-25 16:56:18 +020070 "../../../common_audio/third_party/fft4g",
Alex Loikoed8ff642018-07-06 14:54:30 +020071 "../../../rtc_base:checks",
72 "../../../rtc_base:rtc_base_approved",
73 "../../../system_wrappers:cpu_features_api",
74 ]
75
76 if (rtc_build_with_neon) {
77 if (current_cpu != "arm64") {
Oleh Prypind2f4e8b2018-08-01 12:18:05 +020078 # Enable compilation for the NEON instruction set.
Alex Loikoed8ff642018-07-06 14:54:30 +020079 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
80 cflags = [ "-mfpu=neon" ]
81 }
82
83 # Disable LTO on NEON targets due to compiler bug.
84 # TODO(fdegans): Enable this. See crbug.com/408997.
85 if (rtc_use_lto) {
86 cflags -= [
87 "-flto",
88 "-ffat-lto-objects",
89 ]
90 }
91 }
92}
93
94rtc_source_set("gain_map") {
95 sources = [
96 "gain_map_internal.h",
97 ]
98}
99
100if (rtc_include_tests) {
101 rtc_source_set("agc_unittests") {
102 testonly = true
103 sources = [
104 "agc_manager_direct_unittest.cc",
105 "loudness_histogram_unittest.cc",
106 "mock_agc.h",
107 ]
108 configs += [ "..:apm_debug_dump" ]
109
Alex Loikoed8ff642018-07-06 14:54:30 +0200110 deps = [
111 ":agc",
112 ":level_estimation",
113 "..:mocks",
Alex Loikoed8ff642018-07-06 14:54:30 +0200114 "../../../test:fileutils",
115 "../../../test:test_support",
116 "//testing/gtest",
117 ]
118 }
119}