diff options
author | Chong Zhang <chz@google.com> | 2019-06-27 14:28:37 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2019-06-27 16:38:44 -0700 |
commit | ab123ac62c872f89e20f10c96e651ead21414ffc (patch) | |
tree | 61f45a95ef42e952ec121583ed73b8649e058bc1 /files/BUILD.gn | |
parent | ad97fd58c110036d9dfcdce8bf98282e92707a89 (diff) | |
download | libyuv-ab123ac62c872f89e20f10c96e651ead21414ffc.tar.gz |
libyuv roll to r1722 to pick up a few methods
that we've been manually cherry-picking.
bug: 132357297
test: MediaMetadataRetriever test; manual testing
thumbnails in Photos.
Exempt-From-Owner-Approval:
files/infra/config/OWNERS owner names are not in android
gerrit, CL fail to push with these. Delete of file need
to bypass owner.
Change-Id: Ic22346e45671452429716be8b0a1999eeaea0d7b
Diffstat (limited to 'files/BUILD.gn')
-rw-r--r-- | files/BUILD.gn | 92 |
1 files changed, 76 insertions, 16 deletions
diff --git a/files/BUILD.gn b/files/BUILD.gn index a50aab5f..8904fd6c 100644 --- a/files/BUILD.gn +++ b/files/BUILD.gn @@ -12,6 +12,11 @@ import("//testing/test.gni") declare_args() { # Set to false to disable building with gflags. libyuv_use_gflags = true + + # When building a shared library using a target in WebRTC or + # Chromium projects that depends on libyuv, setting this flag + # to true makes libyuv symbols visible inside that library. + libyuv_symbols_visible = false } config("libyuv_config") { @@ -33,29 +38,52 @@ group("default") { if (libyuv_include_tests) { deps += [ ":compare", - ":yuvconvert", ":cpuid", ":libyuv_unittest", ":psnr", + ":yuvconvert", ] } } group("libyuv") { - public_configs = [ ":libyuv_config" ] + all_dependent_configs = [ ":libyuv_config" ] + deps = [] if (is_win && target_cpu == "x64") { + # Compile with clang in order to get inline assembly public_deps = [ - ":libyuv_internal(//build/toolchain/win:clang_x64)", + ":libyuv_internal(//build/toolchain/win:win_clang_x64)", ] } else { public_deps = [ ":libyuv_internal", ] } + + if (libyuv_use_neon) { + deps += [ ":libyuv_neon" ] + } + + if (libyuv_use_msa) { + deps += [ ":libyuv_msa" ] + } + + if (libyuv_use_mmi) { + deps += [ ":libyuv_mmi" ] + } + + if (!is_ios) { + # Make sure that clients of libyuv link with libjpeg. This can't go in + # libyuv_internal because in Windows x64 builds that will generate a clang + # build of libjpeg, and we don't want two copies. + deps += [ "//third_party:jpeg" ] + } } static_library("libyuv_internal") { + visibility = [ ":*" ] + sources = [ # Headers "include/libyuv.h", @@ -98,19 +126,16 @@ static_library("libyuv_internal") { "source/rotate_any.cc", "source/rotate_argb.cc", "source/rotate_common.cc", - "source/rotate_dspr2.cc", "source/rotate_gcc.cc", "source/rotate_win.cc", "source/row_any.cc", "source/row_common.cc", - "source/row_dspr2.cc", "source/row_gcc.cc", "source/row_win.cc", "source/scale.cc", "source/scale_any.cc", "source/scale_argb.cc", "source/scale_common.cc", - "source/scale_dspr2.cc", "source/scale_gcc.cc", "source/scale_win.cc", "source/video_common.cc", @@ -120,17 +145,17 @@ static_library("libyuv_internal") { defines = [] deps = [] - if (!is_ios) { - defines += [ "HAVE_JPEG" ] - deps += [ "//third_party:jpeg" ] + if (libyuv_symbols_visible) { + configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] + configs += [ "//build/config/gcc:symbol_visibility_default" ] } - if (libyuv_use_neon) { - deps += [ ":libyuv_neon" ] - } + if (!is_ios) { + defines += [ "HAVE_JPEG" ] - if (libyuv_use_msa) { - deps += [ ":libyuv_msa" ] + # Needed to pull in libjpeg headers. Can't add //third_party:jpeg to deps + # because in Windows x64 build it will get compiled with clang. + deps += [ "//third_party:jpeg_includes" ] } # Always enable optimization for Release and NaCl builds (to workaround @@ -143,7 +168,14 @@ static_library("libyuv_internal") { } # To enable AVX2 or other cpu optimization, pass flag here - # cflags = [ "-mavx2" ] + if (!is_win) { + cflags = [ + # "-mpopcnt", + # "-mavx2", + # "-mfma", + "-ffp-contract=fast", # Enable fma vectorization for NEON. + ] + } } if (libyuv_use_neon) { @@ -160,6 +192,10 @@ if (libyuv_use_neon) { "source/scale_neon64.cc", ] + deps = [ + ":libyuv_internal", + ] + public_configs = [ ":libyuv_config" ] # Always enable optimization for Release and NaCl builds (to workaround @@ -168,6 +204,7 @@ if (libyuv_use_neon) { configs -= [ "//build/config/compiler:default_optimization" ] # Enable optimize for speed (-O2) over size (-Os). + # TODO(fbarchard): Consider optimize_speed which is O3. configs += [ "//build/config/compiler:optimize_max" ] } @@ -182,11 +219,34 @@ if (libyuv_use_msa) { static_library("libyuv_msa") { sources = [ # MSA Source Files + "source/compare_msa.cc", "source/rotate_msa.cc", "source/row_msa.cc", "source/scale_msa.cc", ] + deps = [ + ":libyuv_internal", + ] + + public_configs = [ ":libyuv_config" ] + } +} + +if (libyuv_use_mmi) { + static_library("libyuv_mmi") { + sources = [ + # MMI Source Files + "source/compare_mmi.cc", + "source/rotate_mmi.cc", + "source/row_mmi.cc", + "source/scale_mmi.cc", + ] + + deps = [ + ":libyuv_internal", + ] + public_configs = [ ":libyuv_config" ] } } @@ -222,6 +282,7 @@ if (libyuv_include_tests) { "unit_test/compare_test.cc", "unit_test/convert_test.cc", "unit_test/cpu_test.cc", + "unit_test/cpu_thread_test.cc", "unit_test/math_test.cc", "unit_test/planar_test.cc", "unit_test/rotate_argb_test.cc", @@ -278,7 +339,6 @@ if (libyuv_include_tests) { # Enable the following 3 macros to turn off assembly for specified CPU. # "LIBYUV_DISABLE_X86", # "LIBYUV_DISABLE_NEON", - # "LIBYUV_DISABLE_DSPR2", # Enable the following macro to build libyuv as a shared library (dll). # "LIBYUV_USING_SHARED_LIBRARY" ] |