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.
5 import("//build/config/arm.gni")
7 # If fixed point implementation shall be used (otherwise float).
8 use_opus_fixed_point = cpu_arch == "arm" || cpu_arch == "arm64"
10 # If ARM optimizations shall be used to accelerate performance.
11 use_opus_arm_optimization = cpu_arch == "arm"
13 # If OPUS Run Time CPU Detections (RTCD) shall be used.
14 # Based on the conditions in celt/arm/armcpu.c:
15 # defined(_MSC_VER) || defined(__linux__).
16 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux)
18 config("opus_config") {
19 include_dirs = [ "src/include" ]
23 action("convert_rtcd_assembler") {
24 script = "convert_rtcd_assembler.py"
25 outputs = [ "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S" ]
27 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir),
28 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s",
30 rebase_path("$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", root_build_dir),
36 gypi_values = exec_script("//build/gypi_to_gn.py",
37 [ rebase_path("opus_srcs.gypi") ],
40 sources = gypi_values.opus_common_sources
52 configs -= [ "//build/config/compiler:chromium_code" ]
53 configs += [ "//build/config/compiler:no_chromium_code" ]
54 public_configs = [ ":opus_config" ]
63 "/wd4305", # Disable truncation warning in celt/pitch.c .
64 "/wd4334", # Disable 32-bit shift warning in src/opus_encoder.c .
74 if (is_posix && !is_android) {
75 # Suppress a warning given by opus_decoder.c that tells us
76 # optimizations are turned off.
77 cflags = [ "-Wno-#pragma-messages" ]
80 if (!is_debug && is_posix && (cpu_arch == "arm" || cpu_arch == "arm64")) {
81 configs -= [ "//build/config/compiler:optimize" ]
82 configs += [ "//build/config/compiler:optimize_max" ]
85 if (use_opus_fixed_point) {
86 sources += gypi_values.opus_fixed_sources
88 defines += [ "FIXED_POINT" ]
90 include_dirs += [ "src/silk/fixed" ]
92 sources += gypi_values.opus_float_sources
94 include_dirs += [ "src/silk/float" ]
97 if (use_opus_arm_optimization) {
99 "src/celt/arm/fixed_armv4.h",
100 "src/celt/arm/fixed_armv5e.h",
101 "src/celt/arm/kiss_fft_armv4.h",
102 "src/celt/arm/kiss_fft_armv5e.h",
103 "src/celt/pitch_arm.h",
104 "src/silk/arm/macro_armv4.h",
105 "src/silk/arm/macro_armv5e.h",
106 "src/silk/arm/SigProc_FIX_armv4.h",
107 "src/silk/arm/SigProc_FIX_armv5e.h",
112 "OPUS_ARM_INLINE_ASM",
113 "OPUS_ARM_INLINE_EDSP",
118 "src/celt/arm/arm_celt_map.c",
119 "src/celt/arm/armcpu.c",
120 "src/celt/arm/armcpu.h",
121 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S",
125 "OPUS_ARM_MAY_HAVE_EDSP",
126 "OPUS_ARM_MAY_HAVE_MEDIA",
127 "OPUS_ARM_MAY_HAVE_NEON",
132 ":convert_rtcd_assembler",
138 executable("opus_demo") {
140 "src/src/opus_demo.c",
143 configs -= [ "//build/config/compiler:chromium_code" ]
144 configs += [ "//build/config/compiler:no_chromium_code" ]
152 defines = [ "inline=__inline" ]
158 cflags = [ "-Wno-absolute-value" ]