blob: fe2f1078ab080a623c632c3598323e86f7267f4d [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",
22 "../../..:typedefs",
23 "../../..:webrtc_common",
24 "../../../rtc_base:checks",
25 "../../../rtc_base:logging",
26 "../../../rtc_base:macromagic",
27 "../../../rtc_base:safe_minmax",
28 "../../../system_wrappers:metrics_api",
Alex Loiko2ffafa82018-07-06 15:35:42 +020029 "../agc2:level_estimation_agc",
Alex Loikoed8ff642018-07-06 14:54:30 +020030 "../vad",
31 ]
32}
33
34rtc_source_set("level_estimation") {
35 sources = [
36 "agc.cc",
37 "agc.h",
38 "loudness_histogram.cc",
39 "loudness_histogram.h",
40 "utility.cc",
41 "utility.h",
42 ]
43 deps = [
44 "../../..:typedefs",
45 "../../..:webrtc_common",
46 "../../../rtc_base:checks",
47 "../../../rtc_base:macromagic",
48 "../vad",
49 ]
50}
51
52rtc_source_set("agc_legacy_c") {
53 visibility = [
54 ":*",
55 "..:*",
56 ] # Only targets in this file and in
57 # audio_processing can depend on
58 # this.
59
60 sources = [
61 "legacy/analog_agc.c",
62 "legacy/analog_agc.h",
63 "legacy/digital_agc.c",
64 "legacy/digital_agc.h",
65 "legacy/gain_control.h",
66 ]
67
68 deps = [
69 "../../..:typedefs",
70 "../../..:webrtc_common",
71 "../../../common_audio",
72 "../../../common_audio:common_audio_c",
73 "../../../common_audio:fft4g",
74 "../../../rtc_base:checks",
75 "../../../rtc_base:rtc_base_approved",
76 "../../../system_wrappers:cpu_features_api",
77 ]
78
79 if (rtc_build_with_neon) {
80 if (current_cpu != "arm64") {
81 # Enable compilation for the NEON instruction set. This is needed
82 # since //build/config/arm.gni only enables NEON for iOS, not Android.
83 # This provides the same functionality as webrtc/build/arm_neon.gypi.
84 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
85 cflags = [ "-mfpu=neon" ]
86 }
87
88 # Disable LTO on NEON targets due to compiler bug.
89 # TODO(fdegans): Enable this. See crbug.com/408997.
90 if (rtc_use_lto) {
91 cflags -= [
92 "-flto",
93 "-ffat-lto-objects",
94 ]
95 }
96 }
97}
98
99rtc_source_set("gain_map") {
100 sources = [
101 "gain_map_internal.h",
102 ]
103}
104
105if (rtc_include_tests) {
106 rtc_source_set("agc_unittests") {
107 testonly = true
108 sources = [
109 "agc_manager_direct_unittest.cc",
110 "loudness_histogram_unittest.cc",
111 "mock_agc.h",
112 ]
113 configs += [ "..:apm_debug_dump" ]
114
115 if ((!build_with_chromium || is_win) && is_clang) {
116 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
117 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
118 }
119
120 deps = [
121 ":agc",
122 ":level_estimation",
123 "..:mocks",
124 "../../..:webrtc_common",
125 "../../../test:fileutils",
126 "../../../test:test_support",
127 "//testing/gtest",
128 ]
129 }
130}