blob: c5d4fbaa61d8864978a0cfb00cf32dd994a96690 [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",
29 "../vad",
30 ]
31}
32
33rtc_source_set("level_estimation") {
34 sources = [
35 "agc.cc",
36 "agc.h",
37 "loudness_histogram.cc",
38 "loudness_histogram.h",
39 "utility.cc",
40 "utility.h",
41 ]
42 deps = [
43 "../../..:typedefs",
44 "../../..:webrtc_common",
45 "../../../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 = [
68 "../../..:typedefs",
69 "../../..:webrtc_common",
70 "../../../common_audio",
71 "../../../common_audio:common_audio_c",
72 "../../../common_audio:fft4g",
73 "../../../rtc_base:checks",
74 "../../../rtc_base:rtc_base_approved",
75 "../../../system_wrappers:cpu_features_api",
76 ]
77
78 if (rtc_build_with_neon) {
79 if (current_cpu != "arm64") {
80 # Enable compilation for the NEON instruction set. This is needed
81 # since //build/config/arm.gni only enables NEON for iOS, not Android.
82 # This provides the same functionality as webrtc/build/arm_neon.gypi.
83 suppressed_configs += [ "//build/config/compiler:compiler_arm_fpu" ]
84 cflags = [ "-mfpu=neon" ]
85 }
86
87 # Disable LTO on NEON targets due to compiler bug.
88 # TODO(fdegans): Enable this. See crbug.com/408997.
89 if (rtc_use_lto) {
90 cflags -= [
91 "-flto",
92 "-ffat-lto-objects",
93 ]
94 }
95 }
96}
97
98rtc_source_set("gain_map") {
99 sources = [
100 "gain_map_internal.h",
101 ]
102}
103
104if (rtc_include_tests) {
105 rtc_source_set("agc_unittests") {
106 testonly = true
107 sources = [
108 "agc_manager_direct_unittest.cc",
109 "loudness_histogram_unittest.cc",
110 "mock_agc.h",
111 ]
112 configs += [ "..:apm_debug_dump" ]
113
114 if ((!build_with_chromium || is_win) && is_clang) {
115 # Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
116 suppressed_configs += [ "//build/config/clang:find_bad_constructs" ]
117 }
118
119 deps = [
120 ":agc",
121 ":level_estimation",
122 "..:mocks",
123 "../../..:webrtc_common",
124 "../../../test:fileutils",
125 "../../../test:test_support",
126 "//testing/gtest",
127 ]
128 }
129}