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 = ((is_android || is_chromeos ||
9 (is_ios && arm_version == 7)) && cpu_arch == "arm")
11 # If ARM optimizations shall be used to accelerate performance.
12 use_opus_arm_optimization = use_opus_fixed_point
14 # If OPUS Run Time CPU Detections (RTCD) shall be used.
15 use_opus_rtcd = ((is_android || is_chromeos) && cpu_arch == "arm")
17 config("opus_config") {
24 action("convert_rtcd_assembler") {
25 script = "convert_rtcd_assembler.py"
26 outputs = [ "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S" ]
28 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl",
30 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s",
32 rebase_path("$target_gen_dir/celt_pitch_xcorr_arm_gnu.S",
39 gypi_values = exec_script(
40 "//build/gypi_to_gn.py",
41 [ rebase_path("opus_srcs.gypi") ],
44 sources = gypi_values.opus_common_sources
56 configs -= [ "//build/config/compiler:chromium_code" ]
57 configs += [ "//build/config/compiler:no_chromium_code" ]
58 public_configs = [ ":opus_config" ]
67 "/wd4305", # Disable truncation warning in celt/pitch.c .
68 "/wd4334", # Disable 32-bit shift warning in src/opus_encoder.c .
78 if (is_posix && !is_android) {
79 # Suppress a warning given by opus_decoder.c that tells us
80 # optimizations are turned off.
82 "-Wno-#pragma-messages",
86 if (use_opus_fixed_point) {
87 sources += gypi_values.opus_fixed_sources
89 defines += [ "FIXED_POINT" ]
95 sources += gypi_values.opus_float_sources
102 if (use_opus_arm_optimization) {
104 "src/celt/arm/fixed_armv4.h",
105 "src/celt/arm/fixed_armv5e.h",
106 "src/celt/arm/kiss_fft_armv4.h",
107 "src/celt/arm/kiss_fft_armv5e.h",
108 "src/celt/pitch_arm.h",
109 "src/silk/arm/macro_armv4.h",
110 "src/silk/arm/macro_armv5e.h",
111 "src/silk/arm/SigProc_FIX_armv4.h",
112 "src/silk/arm/SigProc_FIX_armv5e.h",
117 "OPUS_ARM_INLINE_ASM",
118 "OPUS_ARM_INLINE_EDSP",
123 "src/celt/arm/arm_celt_map.c",
124 "src/celt/arm/armcpu.c",
125 "src/celt/arm/armcpu.h",
126 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S",
130 "OPUS_ARM_MAY_HAVE_EDSP",
131 "OPUS_ARM_MAY_HAVE_MEDIA",
132 "OPUS_ARM_MAY_HAVE_NEON",
136 deps = [ ":convert_rtcd_assembler" ]
141 executable("opus_demo") {
143 "src/src/opus_demo.c",
146 configs -= [ "//build/config/compiler:chromium_code" ]
147 configs += [ "//build/config/compiler:no_chromium_code" ]
155 defines = [ "inline=__inline" ]
161 cflags = [ "-Wno-absolute-value" ]