| 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") | |
| 8 | 7 |
| 9 # If fixed point implementation shall be used (otherwise float). | 8 # If fixed point implementation shall be used (otherwise float). |
| 10 # TODO(wtc): change "mipselx" to "mipsel" in this file when the compilation | 9 # TODO(wtc): change "mipselx" to "mipsel" in this file when the compilation |
| 11 # errors in the MIPS optimizations are fixed. | 10 # errors in the MIPS optimizations are fixed. |
| 12 use_opus_fixed_point = | 11 use_opus_fixed_point = |
| 13 cpu_arch == "arm" || cpu_arch == "arm64" || cpu_arch == "mipselx" | 12 cpu_arch == "arm" || cpu_arch == "arm64" || cpu_arch == "mipselx" |
| 14 | 13 |
| 15 # If ARM optimizations shall be used to accelerate performance. | 14 # If ARM optimizations shall be used to accelerate performance. |
| 16 use_opus_arm_optimization = cpu_arch == "arm" | 15 use_opus_arm_optimization = cpu_arch == "arm" |
| 17 | 16 |
| 18 # If MIPS optimizations shall be used to accelerate performance. | 17 # If MIPS optimizations shall be used to accelerate performance. |
| 19 use_opus_mips_optimization = cpu_arch == "mipselx" | 18 use_opus_mips_optimization = cpu_arch == "mipselx" |
| 20 | 19 |
| 21 # If OPUS Run Time CPU Detections (RTCD) shall be used. | 20 # If OPUS Run Time CPU Detections (RTCD) shall be used. |
| 22 # Based on the conditions in celt/arm/armcpu.c: | 21 # Based on the conditions in celt/arm/armcpu.c: |
| 23 # defined(_MSC_VER) || defined(__linux__). | 22 # defined(_MSC_VER) || defined(__linux__). |
| 24 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) | 23 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) |
| 25 | 24 |
| 26 config("opus_config") { | 25 config("opus_config") { |
| 27 include_dirs = [ "src/include" ] | 26 include_dirs = [ "src/include" ] |
| 28 } | 27 } |
| 29 | 28 |
| 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 | |
| 47 if (use_opus_rtcd) { | 29 if (use_opus_rtcd) { |
| 48 action("convert_rtcd_assembler") { | 30 action("convert_rtcd_assembler") { |
| 49 script = "convert_rtcd_assembler.py" | 31 script = "convert_rtcd_assembler.py" |
| 50 outputs = [ | 32 outputs = [ |
| 51 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", | 33 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", |
| 52 ] | 34 ] |
| 53 args = [ | 35 args = [ |
| 54 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), | 36 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), |
| 55 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", | 37 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", |
| 56 root_build_dir), | 38 root_build_dir), |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 ] | 166 ] |
| 185 } | 167 } |
| 186 } | 168 } |
| 187 | 169 |
| 188 executable("opus_compare") { | 170 executable("opus_compare") { |
| 189 sources = [ | 171 sources = [ |
| 190 "src/src/opus_compare.c", | 172 "src/src/opus_compare.c", |
| 191 ] | 173 ] |
| 192 | 174 |
| 193 configs -= [ "//build/config/compiler:chromium_code" ] | 175 configs -= [ "//build/config/compiler:chromium_code" ] |
| 194 configs += [ | 176 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 195 "//build/config/compiler:no_chromium_code", | 177 |
| 196 ":opus_test_config", | 178 include_dirs = [ |
| 179 "src/celt", |
| 180 "src/silk", |
| 197 ] | 181 ] |
| 198 | 182 |
| 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 |
| 199 deps = [ | 193 deps = [ |
| 200 ":opus", | 194 ":opus", |
| 201 ] | 195 ] |
| 202 } | 196 } |
| 203 | 197 |
| 204 executable("opus_demo") { | 198 executable("opus_demo") { |
| 205 sources = [ | 199 sources = [ |
| 206 "src/src/opus_demo.c", | 200 "src/src/opus_demo.c", |
| 207 ] | 201 ] |
| 208 | 202 |
| 209 configs -= [ "//build/config/compiler:chromium_code" ] | 203 configs -= [ "//build/config/compiler:chromium_code" ] |
| 210 configs += [ | 204 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 211 "//build/config/compiler:no_chromium_code", | 205 |
| 212 ":opus_test_config", | 206 include_dirs = [ |
| 207 "src/celt", |
| 208 "src/silk", |
| 213 ] | 209 ] |
| 214 | 210 |
| 215 deps = [ | 211 if (is_win) { |
| 216 ":opus", | 212 defines = [ "inline=__inline" ] |
| 217 ] | 213 } |
| 218 } | 214 if (is_android) { |
| 219 | 215 libs = [ "log" ] |
| 220 test("test_opus_api") { | 216 } |
| 221 sources = [ | 217 if (is_clang) { |
| 222 "src/tests/test_opus_api.c", | 218 cflags = [ "-Wno-absolute-value" ] |
| 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" ] | |
| 269 } | 219 } |
| 270 | 220 |
| 271 deps = [ | 221 deps = [ |
| 272 ":opus", | 222 ":opus", |
| 273 ] | 223 ] |
| 274 } | 224 } |
| 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 |