Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: webrtc/modules/audio_coding/codecs/opus/opus/BUILD.gn

Issue 1612443002: Create local copy of Opus v1.1.2 Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: testing if neteq4_opus_network_stats.dat.sha1 needs to be updated Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import("//build/config/arm.gni")
6 import("//testing/test.gni")
7
8 # If fixed point implementation shall be used (otherwise float).
9 use_opus_fixed_point = current_cpu == "arm" || current_cpu == "arm64"
10
11 # If ARM optimizations shall be used to accelerate performance.
12 use_opus_arm_optimization = current_cpu == "arm"
13
14 # If OPUS Run Time CPU Detections (RTCD) shall be used.
15 # Based on the conditions in celt/arm/armcpu.c:
16 # defined(_MSC_VER) || defined(__linux__).
17 use_opus_rtcd = current_cpu == "arm" && (is_win || is_android || is_linux)
18
19 config("opus_config") {
20 include_dirs = [ "src/include" ]
21
22 if (use_opus_fixed_point) {
23 defines = [ "OPUS_FIXED_POINT" ]
24 }
25 }
26
27 config("opus_test_config") {
28 include_dirs = [
29 "src/celt",
30 "src/silk",
31 ]
32
33 if (is_win) {
34 defines = [ "inline=__inline" ]
35 }
36 if (is_android) {
37 libs = [ "log" ]
38 }
39 if (is_clang) {
40 cflags = [ "-Wno-absolute-value" ]
41 }
42 }
43
44 if (use_opus_rtcd) {
45 action("convert_rtcd_assembler") {
46 script = "convert_rtcd_assembler.py"
47 outputs = [
48 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S",
49 ]
50 args = [
51 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir),
52 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s",
53 root_build_dir),
54 rebase_path("$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", root_build_dir),
55 ]
56 }
57 }
58
59 source_set("opus") {
60 gypi_values = exec_script("//build/gypi_to_gn.py",
61 [ rebase_path("opus_srcs.gypi") ],
62 "scope",
63 [ "opus_srcs.gypi" ])
64 sources = gypi_values.opus_common_sources
65
66 defines = [
67 "OPUS_BUILD",
68 "OPUS_EXPORT=",
69 ]
70
71 include_dirs = [
72 "src/celt",
73 "src/silk",
74 ]
75
76 configs -= [ "//build/config/compiler:chromium_code" ]
77 configs += [ "//build/config/compiler:no_chromium_code" ]
78 public_configs = [ ":opus_config" ]
79
80 if (is_win) {
81 defines += [
82 "USE_ALLOCA",
83 "inline=__inline",
84 ]
85
86 cflags = [
87 "/wd4305", # Disable truncation warning in celt/pitch.c .
88 "/wd4334", # Disable 32-bit shift warning in src/opus_encoder.c .
89 ]
90 } else {
91 defines += [
92 "HAVE_LRINT",
93 "HAVE_LRINTF",
94 "VAR_ARRAYS",
95 ]
96 }
97
98 if (is_posix && !is_android) {
99 # Suppress a warning given by opus_decoder.c that tells us
100 # optimizations are turned off.
101 cflags = [ "-Wno-#pragma-messages" ]
102 }
103
104 if (!is_debug && is_posix &&
105 (current_cpu == "arm" || current_cpu == "arm64")) {
106 configs -= [ "//build/config/compiler:default_optimization" ]
107 configs += [ "//build/config/compiler:optimize_max" ]
108 }
109
110 if (use_opus_fixed_point) {
111 sources += gypi_values.opus_fixed_sources
112
113 defines += [ "FIXED_POINT" ]
114
115 include_dirs += [ "src/silk/fixed" ]
116 } else {
117 sources += gypi_values.opus_float_sources
118
119 include_dirs += [ "src/silk/float" ]
120 }
121
122 if (use_opus_arm_optimization) {
123 sources += [
124 "src/celt/arm/fixed_armv4.h",
125 "src/celt/arm/fixed_armv5e.h",
126 "src/celt/arm/kiss_fft_armv4.h",
127 "src/celt/arm/kiss_fft_armv5e.h",
128 "src/celt/pitch_arm.h",
129 "src/silk/arm/SigProc_FIX_armv4.h",
130 "src/silk/arm/SigProc_FIX_armv5e.h",
131 "src/silk/arm/macro_armv4.h",
132 "src/silk/arm/macro_armv5e.h",
133 ]
134
135 defines += [
136 "OPUS_ARM_ASM",
137 "OPUS_ARM_INLINE_ASM",
138 "OPUS_ARM_INLINE_EDSP",
139 ]
140
141 if (use_opus_rtcd) {
142 sources += [
143 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S",
144 "src/celt/arm/arm_celt_map.c",
145 "src/celt/arm/armcpu.c",
146 "src/celt/arm/armcpu.h",
147 ]
148
149 defines += [
150 "OPUS_ARM_MAY_HAVE_EDSP",
151 "OPUS_ARM_MAY_HAVE_MEDIA",
152 "OPUS_ARM_MAY_HAVE_NEON",
153 "OPUS_HAVE_RTCD",
154 ]
155
156 deps = [
157 ":convert_rtcd_assembler",
158 ]
159 }
160 }
161 }
162
163 executable("opus_compare") {
164 sources = [
165 "src/src/opus_compare.c",
166 ]
167
168 configs -= [ "//build/config/compiler:chromium_code" ]
169 configs += [
170 "//build/config/compiler:no_chromium_code",
171 ":opus_test_config",
172 ]
173
174 deps = [
175 ":opus",
176 "//build/config/sanitizers:deps",
177 ]
178 }
179
180 executable("opus_demo") {
181 sources = [
182 "src/src/opus_demo.c",
183 ]
184
185 configs -= [ "//build/config/compiler:chromium_code" ]
186 configs += [
187 "//build/config/compiler:no_chromium_code",
188 ":opus_test_config",
189 ]
190
191 deps = [
192 ":opus",
193 "//build/config/sanitizers:deps",
194 ]
195 }
196
197 test("test_opus_api") {
198 sources = [
199 "src/tests/test_opus_api.c",
200 ]
201
202 configs -= [ "//build/config/compiler:chromium_code" ]
203 configs += [
204 "//build/config/compiler:no_chromium_code",
205 ":opus_test_config",
206 ]
207
208 deps = [
209 ":opus",
210 ]
211 }
212
213 test("test_opus_encode") {
214 sources = [
215 "src/tests/test_opus_encode.c",
216 ]
217
218 configs -= [ "//build/config/compiler:chromium_code" ]
219 configs += [
220 "//build/config/compiler:no_chromium_code",
221 ":opus_test_config",
222 ]
223
224 deps = [
225 ":opus",
226 ]
227 }
228
229 # GN orders flags on a target before flags from configs. The default config
230 # adds -Wall, and this flag have to be after -Wall -- so they need to
231 # come from a config and can't be on the target directly.
232 config("test_opus_decode_config") {
233 # test_opus_decode passes a null pointer to opus_decode() for an argument
234 # marked as requiring a non-null value by the nonnull function attribute,
235 # and expects opus_decode() to fail. Disable the -Wnonnull option to avoid
236 # a compilation error if -Werror is specified.
237 if (is_posix) {
238 cflags = [ "-Wno-nonnull" ]
239 }
240 }
241
242 test("test_opus_decode") {
243 sources = [
244 "src/tests/test_opus_decode.c",
245 ]
246
247 configs -= [ "//build/config/compiler:chromium_code" ]
248 configs += [
249 "//build/config/compiler:no_chromium_code",
250 ":opus_test_config",
251 ":test_opus_decode_config",
252 ]
253
254 deps = [
255 ":opus",
256 ]
257 }
258
259 test("test_opus_padding") {
260 sources = [
261 "src/tests/test_opus_padding.c",
262 ]
263
264 configs -= [ "//build/config/compiler:chromium_code" ]
265 configs += [
266 "//build/config/compiler:no_chromium_code",
267 ":opus_test_config",
268 ]
269
270 deps = [
271 ":opus",
272 ]
273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698