Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2014 The LibYuv Project Authors. All rights reserved. | 1 # Copyright 2014 The LibYuv Project Authors. All rights reserved. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license | 3 # Use of this source code is governed by a BSD-style license |
| 4 # that can be found in the LICENSE file in the root of the source | 4 # that can be found in the LICENSE file in the root of the source |
| 5 # tree. An additional intellectual property rights grant can be found | 5 # tree. An additional intellectual property rights grant can be found |
| 6 # in the file PATENTS. All contributing project authors may | 6 # in the file PATENTS. All contributing project authors may |
| 7 # be found in the AUTHORS file in the root of the source tree. | 7 # be found in the AUTHORS file in the root of the source tree. |
| 8 | 8 |
| 9 import("//build/config/arm.gni") | 9 import("libyuv.gni") |
| 10 import("//build/config/sanitizers/sanitizers.gni") | 10 import("//testing/test.gni") |
| 11 | 11 |
| 12 config("libyuv_config") { | 12 config("libyuv_config") { |
| 13 include_dirs = [ | 13 include_dirs = [ "include" ] |
| 14 ".", | 14 if (is_android && current_cpu=="arm64") { |
| 15 "include", | 15 ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ] |
| 16 ] | 16 } |
| 17 if (is_android && current_cpu != "arm64") { | |
| 18 ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ] | |
| 19 } | |
| 17 } | 20 } |
| 18 | 21 |
| 19 use_neon = current_cpu == "arm64" || (current_cpu == "arm" && (arm_use_neon || a rm_optionally_use_neon)) | |
| 20 | |
| 21 static_library("libyuv") { | 22 static_library("libyuv") { |
| 22 sources = [ | 23 sources = [ |
| 23 # Headers | 24 # Headers |
| 24 "include/libyuv.h", | 25 "include/libyuv.h", |
| 25 "include/libyuv/basic_types.h", | 26 "include/libyuv/basic_types.h", |
| 26 "include/libyuv/compare.h", | 27 "include/libyuv/compare.h", |
| 27 "include/libyuv/convert.h", | 28 "include/libyuv/convert.h", |
| 28 "include/libyuv/convert_argb.h", | 29 "include/libyuv/convert_argb.h", |
| 29 "include/libyuv/convert_from.h", | 30 "include/libyuv/convert_from.h", |
| 30 "include/libyuv/convert_from_argb.h", | 31 "include/libyuv/convert_from_argb.h", |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 "source/scale.cc", | 73 "source/scale.cc", |
| 73 "source/scale_any.cc", | 74 "source/scale_any.cc", |
| 74 "source/scale_argb.cc", | 75 "source/scale_argb.cc", |
| 75 "source/scale_common.cc", | 76 "source/scale_common.cc", |
| 76 "source/scale_mips.cc", | 77 "source/scale_mips.cc", |
| 77 "source/scale_gcc.cc", | 78 "source/scale_gcc.cc", |
| 78 "source/scale_win.cc", | 79 "source/scale_win.cc", |
| 79 "source/video_common.cc", | 80 "source/video_common.cc", |
| 80 ] | 81 ] |
| 81 | 82 |
| 82 public_configs = [ ":libyuv_config" ] | 83 public_configs = [ ":libyuv_config" ] |
| 83 | 84 |
| 84 defines = [] | 85 defines = [] |
| 85 deps = [] | 86 deps = [] |
| 86 | 87 |
| 87 if (!is_ios) { | 88 if (!is_ios) { |
| 88 defines += [ "HAVE_JPEG" ] | 89 defines += [ "HAVE_JPEG" ] |
| 89 deps += [ "//third_party:jpeg" ] | 90 deps += [ "//third_party:jpeg" ] |
| 90 } | 91 } |
| 91 | 92 |
| 92 if (use_neon) { | 93 if (libyuv_use_neon) { |
| 93 deps += [ ":libyuv_neon" ] | 94 deps += [ ":libyuv_neon" ] |
| 94 } | 95 } |
| 95 | 96 |
| 96 if (is_nacl) { | 97 if (is_nacl) { |
| 97 # Always enable optimization under NaCl to workaround crbug.com/538243 . | 98 # Always enable optimization under NaCl to workaround crbug.com/538243 . |
| 98 configs -= [ "//build/config/compiler:default_optimization" ] | 99 configs -= [ "//build/config/compiler:default_optimization" ] |
| 99 configs += [ "//build/config/compiler:optimize_max" ] | 100 configs += [ "//build/config/compiler:optimize_max" ] |
| 100 } | 101 } |
| 101 } | 102 } |
| 102 | 103 |
| 103 if (use_neon) { | 104 if (libyuv_use_neon) { |
| 104 static_library("libyuv_neon") { | 105 static_library("libyuv_neon") { |
| 105 sources = [ | 106 sources = [ |
| 106 # ARM Source Files | 107 # ARM Source Files |
| 107 "source/compare_neon.cc", | 108 "source/compare_neon.cc", |
| 108 "source/compare_neon64.cc", | 109 "source/compare_neon64.cc", |
| 109 "source/rotate_neon.cc", | 110 "source/rotate_neon.cc", |
| 110 "source/rotate_neon64.cc", | 111 "source/rotate_neon64.cc", |
| 111 "source/row_neon.cc", | 112 "source/row_neon.cc", |
| 112 "source/row_neon64.cc", | 113 "source/row_neon64.cc", |
| 113 "source/scale_neon.cc", | 114 "source/scale_neon.cc", |
| 114 "source/scale_neon64.cc", | 115 "source/scale_neon64.cc", |
| 115 ] | 116 ] |
| 116 | 117 |
| 117 public_configs = [ ":libyuv_config" ] | 118 public_configs = [ ":libyuv_config" ] |
| 118 | 119 |
| 119 if (current_cpu != "arm64") { | 120 if (current_cpu != "arm64") { |
| 120 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] | 121 configs -= [ "//build/config/compiler:compiler_arm_fpu" ] |
| 121 cflags = [ "-mfpu=neon" ] | 122 cflags = [ "-mfpu=neon" ] |
| 122 } | 123 } |
| 123 } | 124 } |
| 124 } | 125 } |
| 126 | |
| 127 if (libyuv_include_tests) { | |
| 128 config("libyuv_unittest_warnings_config") { | |
| 129 if (!is_win) { | |
| 130 cflags = [ | |
| 131 "-Wno-sign-compare", | |
|
fbarchard1
2016/09/12 18:59:45
// todo(fbarchard): fix sign and unused variable w
| |
| 132 "-Wno-unused-variable" | |
| 133 ] | |
| 134 } | |
| 135 if (is_win) { | |
| 136 cflags = [ | |
| 137 "/wd4245", # signed/unsigned mismatch | |
| 138 "/wd4189", # local variable is initialized but not referenced | |
| 139 ] | |
| 140 } | |
| 141 } | |
| 142 config("libyuv_unittest_config") { | |
| 143 defines = [ "GTEST_RELATIVE_PATH" ] | |
| 144 } | |
| 145 | |
| 146 test("libyuv_unittest") { | |
|
fbarchard1
2016/09/12 18:59:45
should this be yuv_unittest for android?
kjellander_chromium
2016/09/12 20:14:57
No need - that naming was just a workaround for ht
| |
| 147 testonly = true | |
| 148 | |
| 149 sources = [ | |
| 150 # headers | |
| 151 "unit_test/unit_test.h", | |
| 152 # sources | |
| 153 "unit_test/basictypes_test.cc", | |
| 154 "unit_test/compare_test.cc", | |
| 155 "unit_test/color_test.cc", | |
| 156 "unit_test/convert_test.cc", | |
| 157 "unit_test/cpu_test.cc", | |
| 158 "unit_test/math_test.cc", | |
| 159 "unit_test/planar_test.cc", | |
| 160 "unit_test/rotate_argb_test.cc", | |
| 161 "unit_test/rotate_test.cc", | |
| 162 "unit_test/scale_argb_test.cc", | |
| 163 "unit_test/scale_test.cc", | |
| 164 "unit_test/unit_test.cc", | |
| 165 "unit_test/video_common_test.cc", | |
| 166 ] | |
| 167 | |
| 168 deps = [ | |
| 169 ":libyuv", | |
| 170 "//testing/gtest", | |
| 171 "//third_party/gflags", | |
| 172 ] | |
| 173 | |
| 174 configs += [ ":libyuv_unittest_warnings_config" ] | |
| 175 | |
| 176 public_deps = [ "//testing/gtest" ] | |
| 177 public_configs = [ ":libyuv_unittest_config" ] | |
| 178 | |
| 179 defines = [] | |
| 180 | |
| 181 if (is_linux) { | |
| 182 cflags = [ "-fexceptions" ] | |
| 183 } | |
| 184 if (is_ios && target_cpu=="arm64") { | |
| 185 defines += [ "LIBYUV_DISABLE_NEON" ] | |
| 186 } | |
| 187 if (is_ios) { | |
| 188 configs -= [ "//build/config/compiler:default_symbols" ] | |
| 189 configs += [ "//build/config/compiler:symbols" ] | |
| 190 cflags = [ "-Wno-sometimes-uninitialized" ] | |
| 191 } | |
| 192 if (!is_ios && !libyuv_disable_jpeg) { | |
| 193 defines += [ "HAVE_JPEG" ] | |
| 194 } | |
| 195 if (is_android) { | |
| 196 deps += [ "//testing/android/native_test:native_test_native_code" ] | |
| 197 } | |
| 198 | |
| 199 # TODO(YangZhang): These lines can be removed when high accuracy | |
| 200 # YUV to RGB to Neon is ported. | |
| 201 if ((target_cpu=="armv7" || target_cpu=="armv7s" || | |
| 202 (target_cpu=="arm" && arm_version >= 7) || target_cpu=="arm64") && | |
| 203 (arm_use_neon || arm_optionally_use_neon)) { | |
| 204 defines += [ "LIBYUV_NEON" ] | |
| 205 } | |
| 206 | |
| 207 defines += [ | |
| 208 # Enable the following 3 macros to turn off assembly for specified CPU. | |
| 209 # "LIBYUV_DISABLE_X86", | |
| 210 # "LIBYUV_DISABLE_NEON", | |
| 211 # "LIBYUV_DISABLE_MIPS", | |
| 212 # Enable the following macro to build libyuv as a shared library (dll). | |
| 213 # "LIBYUV_USING_SHARED_LIBRARY" | |
| 214 ] | |
| 215 } | |
| 216 | |
| 217 executable("compare") { | |
| 218 sources = [ | |
| 219 # sources | |
| 220 "util/compare.cc" | |
| 221 ] | |
| 222 deps = [ ":libyuv" ] | |
| 223 if (is_linux) { | |
| 224 cflags = [ "-fexceptions" ] | |
| 225 } | |
| 226 } | |
| 227 | |
| 228 executable("convert") { | |
| 229 sources = [ | |
| 230 # sources | |
| 231 "util/convert.cc" | |
| 232 ] | |
| 233 deps = [ ":libyuv" ] | |
| 234 if (is_linux) { | |
| 235 cflags = [ "-fexceptions" ] | |
| 236 } | |
| 237 } | |
| 238 | |
| 239 executable("psnr") { | |
| 240 sources = [ | |
| 241 # sources | |
| 242 "util/psnr_main.cc", | |
| 243 "util/psnr.cc", | |
| 244 "util/ssim.cc" | |
| 245 ] | |
| 246 deps = [ ":libyuv" ] | |
| 247 | |
| 248 if (is_ios && target_cpu=="arm64") { | |
| 249 defines = [ "LIBYUV_DISABLE_NEON" ] | |
|
fbarchard1
2016/09/12 18:59:45
enable? why is neon disabled for ios?
kjellander_chromium
2016/09/12 20:14:57
This is just to keep things identical to https://c
fbarchard1
2016/09/12 22:53:15
That needs a TODO or a bug to get Neon enabled. I
| |
| 250 } | |
| 251 if (!is_ios && !libyuv_disable_jpeg) { | |
| 252 defines = [ "HAVE_JPEG" ] | |
| 253 } | |
| 254 } | |
| 255 | |
| 256 executable("cpuid") { | |
|
fbarchard1
2016/09/12 18:59:45
can you document how to launch cpuid, psnr and con
kjellander_chromium
2016/09/12 20:14:57
I think we can wait with that to another CL, and n
fbarchard1
2016/09/12 22:53:15
The cpuid binary just needs to be pushed and run w
| |
| 257 sources = [ | |
| 258 # sources | |
| 259 "util/cpuid.c" | |
| 260 ] | |
| 261 deps = [ ":libyuv" ] | |
| 262 } | |
| 263 } | |
| OLD | NEW |