OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/arm.gni") | 5 import("//build/config/arm.gni") |
6 import("//build/config/mips.gni") | 6 import("//build/config/mips.gni") |
| 7 import("//testing/test.gni") |
7 | 8 |
8 # If fixed point implementation shall be used (otherwise float). | 9 # If fixed point implementation shall be used (otherwise float). |
9 # TODO(wtc): change "mipselx" to "mipsel" in this file when the compilation | 10 # TODO(wtc): change "mipselx" to "mipsel" in this file when the compilation |
10 # errors in the MIPS optimizations are fixed. | 11 # errors in the MIPS optimizations are fixed. |
11 use_opus_fixed_point = | 12 use_opus_fixed_point = |
12 cpu_arch == "arm" || cpu_arch == "arm64" || cpu_arch == "mipselx" | 13 cpu_arch == "arm" || cpu_arch == "arm64" || cpu_arch == "mipselx" |
13 | 14 |
14 # If ARM optimizations shall be used to accelerate performance. | 15 # If ARM optimizations shall be used to accelerate performance. |
15 use_opus_arm_optimization = cpu_arch == "arm" | 16 use_opus_arm_optimization = cpu_arch == "arm" |
16 | 17 |
17 # If MIPS optimizations shall be used to accelerate performance. | 18 # If MIPS optimizations shall be used to accelerate performance. |
18 use_opus_mips_optimization = cpu_arch == "mipselx" | 19 use_opus_mips_optimization = cpu_arch == "mipselx" |
19 | 20 |
20 # If OPUS Run Time CPU Detections (RTCD) shall be used. | 21 # If OPUS Run Time CPU Detections (RTCD) shall be used. |
21 # Based on the conditions in celt/arm/armcpu.c: | 22 # Based on the conditions in celt/arm/armcpu.c: |
22 # defined(_MSC_VER) || defined(__linux__). | 23 # defined(_MSC_VER) || defined(__linux__). |
23 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) | 24 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) |
24 | 25 |
25 config("opus_config") { | 26 config("opus_config") { |
26 include_dirs = [ "src/include" ] | 27 include_dirs = [ "src/include" ] |
27 } | 28 } |
28 | 29 |
| 30 config("opus_test_config") { |
| 31 include_dirs = [ |
| 32 "src/celt", |
| 33 "src/silk", |
| 34 ] |
| 35 |
| 36 if (is_win) { |
| 37 defines = [ "inline=__inline" ] |
| 38 } |
| 39 if (is_android) { |
| 40 libs = [ "log" ] |
| 41 } |
| 42 if (is_clang) { |
| 43 cflags = [ "-Wno-absolute-value" ] |
| 44 } |
| 45 } |
| 46 |
29 if (use_opus_rtcd) { | 47 if (use_opus_rtcd) { |
30 action("convert_rtcd_assembler") { | 48 action("convert_rtcd_assembler") { |
31 script = "convert_rtcd_assembler.py" | 49 script = "convert_rtcd_assembler.py" |
32 outputs = [ | 50 outputs = [ |
33 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", | 51 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", |
34 ] | 52 ] |
35 args = [ | 53 args = [ |
36 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), | 54 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), |
37 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", | 55 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", |
38 root_build_dir), | 56 root_build_dir), |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 ] | 184 ] |
167 } | 185 } |
168 } | 186 } |
169 | 187 |
170 executable("opus_compare") { | 188 executable("opus_compare") { |
171 sources = [ | 189 sources = [ |
172 "src/src/opus_compare.c", | 190 "src/src/opus_compare.c", |
173 ] | 191 ] |
174 | 192 |
175 configs -= [ "//build/config/compiler:chromium_code" ] | 193 configs -= [ "//build/config/compiler:chromium_code" ] |
176 configs += [ "//build/config/compiler:no_chromium_code" ] | 194 configs += [ |
177 | 195 "//build/config/compiler:no_chromium_code", |
178 include_dirs = [ | 196 ":opus_test_config", |
179 "src/celt", | |
180 "src/silk", | |
181 ] | 197 ] |
182 | 198 |
183 if (is_win) { | |
184 defines = [ "inline=__inline" ] | |
185 } | |
186 if (is_android) { | |
187 libs = [ "log" ] | |
188 } | |
189 if (is_clang) { | |
190 cflags = [ "-Wno-absolute-value" ] | |
191 } | |
192 | |
193 deps = [ | 199 deps = [ |
194 ":opus", | 200 ":opus", |
195 ] | 201 ] |
196 } | 202 } |
197 | 203 |
198 executable("opus_demo") { | 204 executable("opus_demo") { |
199 sources = [ | 205 sources = [ |
200 "src/src/opus_demo.c", | 206 "src/src/opus_demo.c", |
201 ] | 207 ] |
202 | 208 |
203 configs -= [ "//build/config/compiler:chromium_code" ] | 209 configs -= [ "//build/config/compiler:chromium_code" ] |
204 configs += [ "//build/config/compiler:no_chromium_code" ] | 210 configs += [ |
205 | 211 "//build/config/compiler:no_chromium_code", |
206 include_dirs = [ | 212 ":opus_test_config", |
207 "src/celt", | |
208 "src/silk", | |
209 ] | 213 ] |
210 | 214 |
211 if (is_win) { | 215 deps = [ |
212 defines = [ "inline=__inline" ] | 216 ":opus", |
213 } | 217 ] |
214 if (is_android) { | 218 } |
215 libs = [ "log" ] | 219 |
216 } | 220 test("test_opus_api") { |
217 if (is_clang) { | 221 sources = [ |
218 cflags = [ "-Wno-absolute-value" ] | 222 "src/tests/test_opus_api.c", |
| 223 ] |
| 224 |
| 225 configs -= [ "//build/config/compiler:chromium_code" ] |
| 226 configs += [ |
| 227 "//build/config/compiler:no_chromium_code", |
| 228 ":opus_test_config", |
| 229 ] |
| 230 |
| 231 deps = [ |
| 232 ":opus", |
| 233 ] |
| 234 } |
| 235 |
| 236 test("test_opus_encode") { |
| 237 sources = [ |
| 238 "src/tests/test_opus_encode.c", |
| 239 ] |
| 240 |
| 241 configs -= [ "//build/config/compiler:chromium_code" ] |
| 242 configs += [ |
| 243 "//build/config/compiler:no_chromium_code", |
| 244 ":opus_test_config", |
| 245 ] |
| 246 |
| 247 deps = [ |
| 248 ":opus", |
| 249 ] |
| 250 } |
| 251 |
| 252 test("test_opus_decode") { |
| 253 sources = [ |
| 254 "src/tests/test_opus_decode.c", |
| 255 ] |
| 256 |
| 257 configs -= [ "//build/config/compiler:chromium_code" ] |
| 258 configs += [ |
| 259 "//build/config/compiler:no_chromium_code", |
| 260 ":opus_test_config", |
| 261 ] |
| 262 |
| 263 # test_opus_decode passes a null pointer to opus_decode() for an argument |
| 264 # marked as requiring a non-null value by the nonnull function attribute, |
| 265 # and expects opus_decode() to fail. Disable the -Wnonnull option to avoid |
| 266 # a compilation error if -Werror is specified. |
| 267 if (is_posix) { |
| 268 cflags = [ "-Wno-nonnull" ] |
219 } | 269 } |
220 | 270 |
221 deps = [ | 271 deps = [ |
222 ":opus", | 272 ":opus", |
223 ] | 273 ] |
224 } | 274 } |
| 275 |
| 276 test("test_opus_padding") { |
| 277 sources = [ |
| 278 "src/tests/test_opus_padding.c", |
| 279 ] |
| 280 |
| 281 configs -= [ "//build/config/compiler:chromium_code" ] |
| 282 configs += [ |
| 283 "//build/config/compiler:no_chromium_code", |
| 284 ":opus_test_config", |
| 285 ] |
| 286 |
| 287 deps = [ |
| 288 ":opus", |
| 289 ] |
| 290 } |
OLD | NEW |