| 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 | 6 |
| 7 # If fixed point implementation shall be used (otherwise float). | 7 # If fixed point implementation shall be used (otherwise float). |
| 8 use_opus_fixed_point = (cpu_arch == "arm" || cpu_arch == "arm64") | 8 use_opus_fixed_point = cpu_arch == "arm" || cpu_arch == "arm64" |
| 9 | 9 |
| 10 # If ARM optimizations shall be used to accelerate performance. | 10 # If ARM optimizations shall be used to accelerate performance. |
| 11 use_opus_arm_optimization = (cpu_arch == "arm") | 11 use_opus_arm_optimization = cpu_arch == "arm" |
| 12 | 12 |
| 13 # If OPUS Run Time CPU Detections (RTCD) shall be used. | 13 # If OPUS Run Time CPU Detections (RTCD) shall be used. |
| 14 # Based on the conditions in celt/arm/armcpu.c: | 14 # Based on the conditions in celt/arm/armcpu.c: |
| 15 # defined(_MSC_VER) || defined(__linux__). | 15 # defined(_MSC_VER) || defined(__linux__). |
| 16 use_opus_rtcd = (cpu_arch == "arm" && (is_win || is_android || is_linux)) | 16 use_opus_rtcd = cpu_arch == "arm" && (is_win || is_android || is_linux) |
| 17 | 17 |
| 18 config("opus_config") { | 18 config("opus_config") { |
| 19 include_dirs = [ | 19 include_dirs = [ "src/include" ] |
| 20 "src/include", | |
| 21 ] | |
| 22 } | 20 } |
| 23 | 21 |
| 24 if (use_opus_rtcd) { | 22 if (use_opus_rtcd) { |
| 25 action("convert_rtcd_assembler") { | 23 action("convert_rtcd_assembler") { |
| 26 script = "convert_rtcd_assembler.py" | 24 script = "convert_rtcd_assembler.py" |
| 27 outputs = [ "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S" ] | 25 outputs = [ "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S" ] |
| 28 args = [ | 26 args = [ |
| 29 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", | 27 rebase_path("//third_party/opus/src/celt/arm/arm2gnu.pl", root_build_dir), |
| 30 root_build_dir), | |
| 31 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", | 28 rebase_path("//third_party/opus/src/celt/arm/celt_pitch_xcorr_arm.s", |
| 32 root_build_dir), | 29 root_build_dir), |
| 33 rebase_path("$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", | 30 rebase_path("$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", root_build_dir), |
| 34 root_build_dir), | |
| 35 ] | 31 ] |
| 36 } | 32 } |
| 37 } | 33 } |
| 38 | 34 |
| 39 source_set("opus") { | 35 source_set("opus") { |
| 40 gypi_values = exec_script( | 36 gypi_values = exec_script("//build/gypi_to_gn.py", |
| 41 "//build/gypi_to_gn.py", | 37 [ rebase_path("opus_srcs.gypi") ], |
| 42 [ rebase_path("opus_srcs.gypi") ], | 38 "scope", |
| 43 "scope", | 39 [ "opus_srcs.gypi" ]) |
| 44 [ "opus_srcs.gypi" ]) | |
| 45 sources = gypi_values.opus_common_sources | 40 sources = gypi_values.opus_common_sources |
| 46 | 41 |
| 47 defines = [ | 42 defines = [ |
| 48 "OPUS_BUILD", | 43 "OPUS_BUILD", |
| 49 "OPUS_EXPORT=", | 44 "OPUS_EXPORT=", |
| 50 ] | 45 ] |
| 51 | 46 |
| 52 include_dirs = [ | 47 include_dirs = [ |
| 53 "src/celt", | 48 "src/celt", |
| 54 "src/silk", | 49 "src/silk", |
| (...skipping 17 matching lines...) Expand all Loading... |
| 72 defines += [ | 67 defines += [ |
| 73 "HAVE_LRINT", | 68 "HAVE_LRINT", |
| 74 "HAVE_LRINTF", | 69 "HAVE_LRINTF", |
| 75 "VAR_ARRAYS", | 70 "VAR_ARRAYS", |
| 76 ] | 71 ] |
| 77 } | 72 } |
| 78 | 73 |
| 79 if (is_posix && !is_android) { | 74 if (is_posix && !is_android) { |
| 80 # Suppress a warning given by opus_decoder.c that tells us | 75 # Suppress a warning given by opus_decoder.c that tells us |
| 81 # optimizations are turned off. | 76 # optimizations are turned off. |
| 82 cflags = [ | 77 cflags = [ "-Wno-#pragma-messages" ] |
| 83 "-Wno-#pragma-messages", | |
| 84 ] | |
| 85 } | 78 } |
| 86 | 79 |
| 87 if (!is_debug && is_posix && (cpu_arch == "arm" || cpu_arch == "arm64")) { | 80 if (!is_debug && is_posix && (cpu_arch == "arm" || cpu_arch == "arm64")) { |
| 88 configs -= [ "//build/config/compiler:optimize" ] | 81 configs -= [ "//build/config/compiler:optimize" ] |
| 89 configs += [ "//build/config/compiler:optimize_max" ] | 82 configs += [ "//build/config/compiler:optimize_max" ] |
| 90 } | 83 } |
| 91 | 84 |
| 92 if (use_opus_fixed_point) { | 85 if (use_opus_fixed_point) { |
| 93 sources += gypi_values.opus_fixed_sources | 86 sources += gypi_values.opus_fixed_sources |
| 94 | 87 |
| 95 defines += [ "FIXED_POINT" ] | 88 defines += [ "FIXED_POINT" ] |
| 96 | 89 |
| 97 include_dirs += [ | 90 include_dirs += [ "src/silk/fixed" ] |
| 98 "src/silk/fixed", | |
| 99 ] | |
| 100 } else { | 91 } else { |
| 101 sources += gypi_values.opus_float_sources | 92 sources += gypi_values.opus_float_sources |
| 102 | 93 |
| 103 include_dirs += [ | 94 include_dirs += [ "src/silk/float" ] |
| 104 "src/silk/float", | |
| 105 ] | |
| 106 } | 95 } |
| 107 | 96 |
| 108 if (use_opus_arm_optimization) { | 97 if (use_opus_arm_optimization) { |
| 109 sources += [ | 98 sources += [ |
| 110 "src/celt/arm/fixed_armv4.h", | 99 "src/celt/arm/fixed_armv4.h", |
| 111 "src/celt/arm/fixed_armv5e.h", | 100 "src/celt/arm/fixed_armv5e.h", |
| 112 "src/celt/arm/kiss_fft_armv4.h", | 101 "src/celt/arm/kiss_fft_armv4.h", |
| 113 "src/celt/arm/kiss_fft_armv5e.h", | 102 "src/celt/arm/kiss_fft_armv5e.h", |
| 114 "src/celt/pitch_arm.h", | 103 "src/celt/pitch_arm.h", |
| 115 "src/silk/arm/macro_armv4.h", | 104 "src/silk/arm/macro_armv4.h", |
| (...skipping 16 matching lines...) Expand all Loading... |
| 132 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", | 121 "$target_gen_dir/celt_pitch_xcorr_arm_gnu.S", |
| 133 ] | 122 ] |
| 134 | 123 |
| 135 defines += [ | 124 defines += [ |
| 136 "OPUS_ARM_MAY_HAVE_EDSP", | 125 "OPUS_ARM_MAY_HAVE_EDSP", |
| 137 "OPUS_ARM_MAY_HAVE_MEDIA", | 126 "OPUS_ARM_MAY_HAVE_MEDIA", |
| 138 "OPUS_ARM_MAY_HAVE_NEON", | 127 "OPUS_ARM_MAY_HAVE_NEON", |
| 139 "OPUS_HAVE_RTCD", | 128 "OPUS_HAVE_RTCD", |
| 140 ] | 129 ] |
| 141 | 130 |
| 142 deps = [ ":convert_rtcd_assembler" ] | 131 deps = [ |
| 132 ":convert_rtcd_assembler", |
| 133 ] |
| 143 } | 134 } |
| 144 } | 135 } |
| 145 } | 136 } |
| 146 | 137 |
| 147 executable("opus_demo") { | 138 executable("opus_demo") { |
| 148 sources = [ | 139 sources = [ |
| 149 "src/src/opus_demo.c", | 140 "src/src/opus_demo.c", |
| 150 ] | 141 ] |
| 151 | 142 |
| 152 configs -= [ "//build/config/compiler:chromium_code" ] | 143 configs -= [ "//build/config/compiler:chromium_code" ] |
| 153 configs += [ "//build/config/compiler:no_chromium_code" ] | 144 configs += [ "//build/config/compiler:no_chromium_code" ] |
| 154 | 145 |
| 155 include_dirs = [ | 146 include_dirs = [ |
| 156 "src/celt", | 147 "src/celt", |
| 157 "src/silk", | 148 "src/silk", |
| 158 ] | 149 ] |
| 159 | 150 |
| 160 if (is_win) { | 151 if (is_win) { |
| 161 defines = [ "inline=__inline" ] | 152 defines = [ "inline=__inline" ] |
| 162 } | 153 } |
| 163 if (is_android) { | 154 if (is_android) { |
| 164 libs = [ "log" ] | 155 libs = [ "log" ] |
| 165 } | 156 } |
| 166 if (is_clang) { | 157 if (is_clang) { |
| 167 cflags = [ "-Wno-absolute-value" ] | 158 cflags = [ "-Wno-absolute-value" ] |
| 168 } | 159 } |
| 169 | 160 |
| 170 deps = [ ":opus" ] | 161 deps = [ |
| 162 ":opus", |
| 163 ] |
| 171 } | 164 } |
| OLD | NEW |