diff options
author | Frank Barchard <fbarchard@google.com> | 2017-03-10 12:03:05 -0800 |
---|---|---|
committer | Frank Barchard <fbarchard@google.com> | 2017-03-10 15:46:01 -0800 |
commit | cead1e07666bcc5914f8927712c2f89b9b789f9b (patch) | |
tree | f6f34bb792f4bce88e17f19e782b6e6741210fc1 /files | |
parent | b83bb38f0a92bedeb52baa31e515220927ef53bb (diff) | |
download | libyuv-cead1e07666bcc5914f8927712c2f89b9b789f9b.tar.gz |
roll to version r1649 for halffloat memory underflow
on odd sized images (e.g. 1 pixel) the temporary buffer
copied in bytes, not shorts. This CL fixes that and
applies lint and clang-format fixes.
Bug: None
Test: local mm build is clean with full warnings enabled
Change-Id: I9aa95261678113365d289b65375c8b7943c2d486
Diffstat (limited to 'files')
27 files changed, 663 insertions, 403 deletions
diff --git a/files/BUILD.gn b/files/BUILD.gn index 57771b72..4f56cdc2 100644 --- a/files/BUILD.gn +++ b/files/BUILD.gn @@ -11,7 +11,7 @@ import("//testing/test.gni") config("libyuv_config") { include_dirs = [ "include" ] - if (is_android && current_cpu=="arm64") { + if (is_android && current_cpu == "arm64") { ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker64" ] } if (is_android && current_cpu != "arm64") { @@ -36,7 +36,21 @@ group("default") { } } -static_library("libyuv") { +group("libyuv") { + public_configs = [ ":libyuv_config" ] + + if (is_win && target_cpu == "x64") { + public_deps = [ + ":libyuv_internal(//build/toolchain/win:clang_x64)", + ] + } else { + public_deps = [ + ":libyuv_internal", + ] + } +} + +static_library("libyuv_internal") { sources = [ # Headers "include/libyuv.h", @@ -97,8 +111,7 @@ static_library("libyuv") { "source/video_common.cc", ] - public_configs = [ ":libyuv_config" ] - + configs += [ ":libyuv_config" ] defines = [] deps = [] @@ -119,13 +132,13 @@ static_library("libyuv") { # crbug.com/538243). if (!is_debug || is_nacl) { configs -= [ "//build/config/compiler:default_optimization" ] + # Enable optimize for speed (-O2) over size (-Os). configs += [ "//build/config/compiler:optimize_max" ] } # To enable AVX2 or other cpu optimization, pass flag here # cflags = [ "-mavx2" ] - } if (libyuv_use_neon) { @@ -148,6 +161,7 @@ if (libyuv_use_neon) { # crbug.com/538243). if (!is_debug) { configs -= [ "//build/config/compiler:default_optimization" ] + # Enable optimize for speed (-O2) over size (-Os). configs += [ "//build/config/compiler:optimize_max" ] } @@ -163,9 +177,9 @@ if (libyuv_use_msa) { static_library("libyuv_msa") { sources = [ # MSA Source Files + "source/rotate_msa.cc", "source/row_msa.cc", "source/scale_msa.cc", - "source/rotate_msa.cc", ] public_configs = [ ":libyuv_config" ] @@ -178,13 +192,13 @@ if (libyuv_include_tests) { cflags = [ # TODO(fbarchard): Fix sign and unused variable warnings. "-Wno-sign-compare", - "-Wno-unused-variable" + "-Wno-unused-variable", ] } if (is_win) { cflags = [ - "/wd4245", # signed/unsigned mismatch - "/wd4189", # local variable is initialized but not referenced + "/wd4245", # signed/unsigned mismatch + "/wd4189", # local variable is initialized but not referenced ] } } @@ -196,12 +210,11 @@ if (libyuv_include_tests) { testonly = true sources = [ - # headers - "unit_test/unit_test.h", # sources + # headers "unit_test/basictypes_test.cc", - "unit_test/compare_test.cc", "unit_test/color_test.cc", + "unit_test/compare_test.cc", "unit_test/convert_test.cc", "unit_test/cpu_test.cc", "unit_test/math_test.cc", @@ -211,6 +224,7 @@ if (libyuv_include_tests) { "unit_test/scale_argb_test.cc", "unit_test/scale_test.cc", "unit_test/unit_test.cc", + "unit_test/unit_test.h", "unit_test/video_common_test.cc", ] @@ -222,7 +236,9 @@ if (libyuv_include_tests) { configs += [ ":libyuv_unittest_warnings_config" ] - public_deps = [ "//testing/gtest" ] + public_deps = [ + "//testing/gtest", + ] public_configs = [ ":libyuv_unittest_config" ] defines = [] @@ -244,8 +260,8 @@ if (libyuv_include_tests) { # TODO(YangZhang): These lines can be removed when high accuracy # YUV to RGB to Neon is ported. - if ((target_cpu=="armv7" || target_cpu=="armv7s" || - (target_cpu=="arm" && arm_version >= 7) || target_cpu=="arm64") && + if ((target_cpu == "armv7" || target_cpu == "armv7s" || + (target_cpu == "arm" && arm_version >= 7) || target_cpu == "arm64") && (arm_use_neon || arm_optionally_use_neon)) { defines += [ "LIBYUV_NEON" ] } @@ -263,9 +279,11 @@ if (libyuv_include_tests) { executable("compare") { sources = [ # sources - "util/compare.cc" + "util/compare.cc", + ] + deps = [ + ":libyuv", ] - deps = [ ":libyuv" ] if (is_linux) { cflags = [ "-fexceptions" ] } @@ -274,9 +292,11 @@ if (libyuv_include_tests) { executable("convert") { sources = [ # sources - "util/convert.cc" + "util/convert.cc", + ] + deps = [ + ":libyuv", ] - deps = [ ":libyuv" ] if (is_linux) { cflags = [ "-fexceptions" ] } @@ -285,11 +305,13 @@ if (libyuv_include_tests) { executable("psnr") { sources = [ # sources - "util/psnr_main.cc", "util/psnr.cc", - "util/ssim.cc" + "util/psnr_main.cc", + "util/ssim.cc", + ] + deps = [ + ":libyuv", ] - deps = [ ":libyuv" ] if (!is_ios && !libyuv_disable_jpeg) { defines = [ "HAVE_JPEG" ] @@ -299,8 +321,10 @@ if (libyuv_include_tests) { executable("cpuid") { sources = [ # sources - "util/cpuid.c" + "util/cpuid.c", + ] + deps = [ + ":libyuv", ] - deps = [ ":libyuv" ] } } @@ -1,10 +1,7 @@ vars = { - # Override root_dir in your .gclient's custom_vars to specify a custom root - # folder name. - 'root_dir': 'libyuv', 'chromium_git': 'https://chromium.googlesource.com', - 'chromium_revision': '222a3fe7a738486a887bb53cffb8e3b52376f609', - 'swarming_revision': 'ebc8dab6f8b8d79ec221c94de39a921145abd404', + 'chromium_revision': '7950721f084767700b62bb6e1c90ea155efae980', + 'swarming_revision': '11e31afa5d330756ff87aa12064bb5d032896cb5', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling lss # and whatever else without interference from each other. @@ -12,80 +9,80 @@ vars = { # Three lines of non-changing comments so that # the commit queue can handle CLs rolling catapult # and whatever else without interference from each other. - 'catapult_revision': '4ee31ea3b497ffe08391e88a5434e0a340e48342', + 'catapult_revision': '353ee60a4567ec80252bb4047e54b2df3151717e', } deps = { - Var('root_dir') + '/build': - Var('chromium_git') + '/chromium/src/build' + '@' + '47e07d6798693fd71c02e25097c97865b5271c40', - Var('root_dir') + '/buildtools': - Var('chromium_git') + '/chromium/buildtools.git' + '@' + 'a7cc7a3e21a061975b33dcdcd81a9716ba614c3c', - Var('root_dir') + '/testing': - Var('chromium_git') + '/chromium/src/testing' + '@' + '178a302b13e943c679f3bbeb0a7e511f7c318404', - Var('root_dir') + '/testing/gtest': + 'src/build': + Var('chromium_git') + '/chromium/src/build' + '@' + 'bf8911f59bebb1cdd075e612c78e985cb14eca29', + 'src/buildtools': + Var('chromium_git') + '/chromium/buildtools.git' + '@' + 'b3771b1935ea74c388b6fb1750e83f5d83b39dec', + 'src/testing': + Var('chromium_git') + '/chromium/src/testing' + '@' + 'c2c74bc1d165ccc01ed03e424f72aa313eeb9120', + 'src/testing/gtest': Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + '6f8a66431cb592dad629028a50b3dd418a408c87', - Var('root_dir') + '/testing/gmock': + 'src/testing/gmock': Var('chromium_git') + '/external/googlemock.git' + '@' + '0421b6f358139f02e102c9c332ce19a33faf75be', # from svn revision 566 - Var('root_dir') + '/third_party': - Var('chromium_git') + '/chromium/src/third_party' + '@' + '4f196478f68c139a5deec388fd1f426a9251b4b0', - Var('root_dir') + '/third_party/catapult': + 'src/third_party': + Var('chromium_git') + '/chromium/src/third_party' + '@' + '4c0908d22e7c4cd423da28f69c64c6fd293b0e99', + 'src/third_party/catapult': Var('chromium_git') + '/external/github.com/catapult-project/catapult.git' + '@' + Var('catapult_revision'), - Var('root_dir') + '/third_party/colorama/src': + 'src/third_party/colorama/src': Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8', - Var('root_dir') + '/third_party/libjpeg_turbo': + 'src/third_party/libjpeg_turbo': Var('chromium_git') + '/chromium/deps/libjpeg_turbo.git' + '@' + '7260e4d8b8e1e40b17f03fafdf1cd83296900f76', - Var('root_dir') + '/third_party/yasm/source/patched-yasm': + 'src/third_party/yasm/source/patched-yasm': Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git' + '@' + '7da28c6c7c6a1387217352ce02b31754deb54d2a', - Var('root_dir') + '/tools': - Var('chromium_git') + '/chromium/src/tools' + '@' + '54fd165044db88eca930ab9d20a6340b76136d91', - Var('root_dir') + '/tools/gyp': + 'src/tools': + Var('chromium_git') + '/chromium/src/tools' + '@' + '14318cc69b7116d7b4aa23ee58cdf3d7c71d4038', + 'src/tools/gyp': Var('chromium_git') + '/external/gyp.git' + '@' + 'e7079f0e0e14108ab0dba58728ff219637458563', - Var('root_dir') + '/tools/swarming_client': + 'src/tools/swarming_client': Var('chromium_git') + '/external/swarming.client.git' + '@' + Var('swarming_revision'), # libyuv-only dependencies (not present in Chromium). - Var('root_dir') + '/third_party/gflags': + 'src/third_party/gflags': Var('chromium_git') + '/external/webrtc/deps/third_party/gflags' + '@' + '892576179b45861b53e04a112996a738309cf364', - Var('root_dir') + '/third_party/gflags/src': + 'src/third_party/gflags/src': Var('chromium_git') + '/external/github.com/gflags/gflags' + '@' + '03bebcb065c83beff83d50ae025a55a4bf94dfca', - Var('root_dir') + '/third_party/gtest-parallel': - Var('chromium_git') + '/external/webrtc/deps/third_party/gtest-parallel' + '@' + '8768563f5c580f8fc416a13c35c8f23b8a602821', + 'src/third_party/gtest-parallel': + Var('chromium_git') + '/external/webrtc/deps/third_party/gtest-parallel' + '@' + '1dad0e9f6d82ff994130b529d7d814b40eb32b0e', } deps_os = { 'android': { - Var('root_dir') + '/base': - Var('chromium_git') + '/chromium/src/base' + '@' + 'b9d4d9b0e5373bbdb5403c68d51e7385d78a09d0', - Var('root_dir') + '/third_party/android_tools': + 'src/base': + Var('chromium_git') + '/chromium/src/base' + '@' + 'd75864a2c554db298f34b188c07a11133c8bd88b', + 'src/third_party/android_tools': Var('chromium_git') + '/android_tools.git' + '@' + 'b43a6a289a7588b1769814f04dd6c7d7176974cc', - Var('root_dir') + '/third_party/ced/src': + 'src/third_party/ced/src': Var('chromium_git') + '/external/github.com/google/compact_enc_det.git' + '@' + '368a9cc09ad868a3d28f0b5ad4a733f263c46409', - Var('root_dir') + '/third_party/icu': - Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '9cd2828740572ba6f694b9365236a8356fd06147', - Var('root_dir') + '/third_party/jsr-305/src': + 'src/third_party/icu': + Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '450be73c9ee8ae29d43d4fdc82febb2a5f62bfb5', + 'src/third_party/jsr-305/src': Var('chromium_git') + '/external/jsr-305.git' + '@' + '642c508235471f7220af6d5df2d3210e3bfc0919', - Var('root_dir') + '/third_party/junit/src': + 'src/third_party/junit/src': Var('chromium_git') + '/external/junit.git' + '@' + '64155f8a9babcfcf4263cf4d08253a1556e75481', - Var('root_dir') + '/third_party/lss': + 'src/third_party/lss': Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'), - Var('root_dir') + '/third_party/mockito/src': + 'src/third_party/mockito/src': Var('chromium_git') + '/external/mockito/mockito.git' + '@' + 'de83ad4598ad4cf5ea53c69a8a8053780b04b850', - Var('root_dir') + '/third_party/requests/src': + 'src/third_party/requests/src': Var('chromium_git') + '/external/github.com/kennethreitz/requests.git' + '@' + 'f172b30356d821d180fa4ecfa3e71c7274a32de4', - Var('root_dir') + '/third_party/robolectric/robolectric': + 'src/third_party/robolectric/robolectric': Var('chromium_git') + '/external/robolectric.git' + '@' + 'e38b49a12fdfa17a94f0382cc8ffaf69132fd09b', }, 'ios': { - Var('root_dir') + '/ios': - Var('chromium_git') + '/chromium/src/ios' + '@' + '291daef6af7764f8475089c65808d52ee50b496e', + 'src/ios': + Var('chromium_git') + '/chromium/src/ios' + '@' + '8b8111f841dfdc04bb5591dfd1315120f95709a4', }, 'unix': { - Var('root_dir') + '/third_party/lss': + 'src/third_party/lss': Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'), }, 'win': { # Dependencies used by libjpeg-turbo - Var('root_dir') + '/third_party/yasm/binaries': + 'src/third_party/yasm/binaries': Var('chromium_git') + '/chromium/deps/yasm/binaries.git' + '@' + '52f9b3f4b0aa06da24ef8b123058bb61ee468881', }, } @@ -99,7 +96,7 @@ pre_deps_hooks = [ # TODO(kjellander): Remove this in March 2017. 'name': 'cleanup_links', 'pattern': '.', - 'action': ['python', Var('root_dir') + '/cleanup_links.py'], + 'action': ['python', 'src/cleanup_links.py'], }, ] @@ -112,11 +109,11 @@ hooks = [ 'pattern': '.', 'action': [ 'python', - Var('root_dir') + '/build/landmines.py', + 'src/build/landmines.py', '--landmine-scripts', - Var('root_dir') + '/tools_libyuv/get_landmines.py', + 'src/tools_libyuv/get_landmines.py', '--src-dir', - Var('root_dir') + '', + 'src', ], }, # Android dependencies. Many are downloaded using Google Storage these days. @@ -130,7 +127,7 @@ hooks = [ # When adding a new sdk extras package to download, add the package # directory and zip file to .gitignore in third_party/android_tools. 'action': ['python', - Var('root_dir') + '/build/android/play_services/update.py', + 'src/build/android/play_services/update.py', 'download' ], }, @@ -138,7 +135,7 @@ hooks = [ 'name': 'intellij', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-intellij', '-l', 'third_party/intellij' @@ -148,7 +145,7 @@ hooks = [ 'name': 'javax_inject', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-javax-inject', '-l', 'third_party/javax_inject' @@ -158,7 +155,7 @@ hooks = [ 'name': 'hamcrest', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-hamcrest', '-l', 'third_party/hamcrest' @@ -168,7 +165,7 @@ hooks = [ 'name': 'guava', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-guava', '-l', 'third_party/guava' @@ -178,7 +175,7 @@ hooks = [ 'name': 'android_support_test_runner', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-android-support-test-runner', '-l', 'third_party/android_support_test_runner' @@ -188,7 +185,7 @@ hooks = [ 'name': 'byte_buddy', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-byte-buddy', '-l', 'third_party/byte_buddy' @@ -198,7 +195,7 @@ hooks = [ 'name': 'espresso', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-espresso', '-l', 'third_party/espresso' @@ -208,7 +205,7 @@ hooks = [ 'name': 'robolectric_libs', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-robolectric', '-l', 'third_party/robolectric' @@ -218,7 +215,7 @@ hooks = [ 'name': 'apache_velocity', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-apache-velocity', '-l', 'third_party/apache_velocity' @@ -228,7 +225,7 @@ hooks = [ 'name': 'ow2_asm', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-ow2-asm', '-l', 'third_party/ow2_asm' @@ -238,7 +235,7 @@ hooks = [ 'name': 'icu4j', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-icu4j', '-l', 'third_party/icu4j' @@ -248,7 +245,7 @@ hooks = [ 'name': 'accessibility_test_framework', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-accessibility-test-framework', '-l', 'third_party/accessibility_test_framework' @@ -258,7 +255,7 @@ hooks = [ 'name': 'bouncycastle', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-bouncycastle', '-l', 'third_party/bouncycastle' @@ -268,7 +265,7 @@ hooks = [ 'name': 'sqlite4java', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-sqlite4java', '-l', 'third_party/sqlite4java' @@ -278,7 +275,7 @@ hooks = [ 'name': 'objenesis', 'pattern': '.', 'action': ['python', - Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py', + 'src/build/android/update_deps/update_third_party_deps.py', 'download', '-b', 'chromium-objenesis', '-l', 'third_party/objenesis' @@ -291,24 +288,24 @@ hooks = [ # official chrome builds or cross compiling. 'name': 'sysroot', 'pattern': '.', - 'action': ['python', Var('root_dir') + '/build/linux/sysroot_scripts/install-sysroot.py', + 'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py', '--running-as-hook'], }, { # Update the Windows toolchain if necessary. 'name': 'win_toolchain', 'pattern': '.', - 'action': ['python', Var('root_dir') + '/build/vs_toolchain.py', 'update'], + 'action': ['python', 'src/build/vs_toolchain.py', 'update'], }, # Pull binutils for linux, enabled debug fission for faster linking / # debugging when used with clang on Ubuntu Precise. # https://code.google.com/p/chromium/issues/detail?id=352046 { 'name': 'binutils', - 'pattern': Var('root_dir') + '/third_party/binutils', + 'pattern': 'src/third_party/binutils', 'action': [ 'python', - Var('root_dir') + '/third_party/binutils/download.py', + 'src/third_party/binutils/download.py', ], }, { @@ -316,14 +313,14 @@ hooks = [ # Note: On Win, this should run after win_toolchain, as it may use it. 'name': 'clang', 'pattern': '.', - 'action': ['python', Var('root_dir') + '/tools/clang/scripts/update.py', '--if-needed'], + 'action': ['python', 'src/tools/clang/scripts/update.py', '--if-needed'], }, { # Update LASTCHANGE. 'name': 'lastchange', 'pattern': '.', - 'action': ['python', Var('root_dir') + '/build/util/lastchange.py', - '-o', Var('root_dir') + '/build/util/LASTCHANGE'], + 'action': ['python', 'src/build/util/lastchange.py', + '-o', 'src/build/util/LASTCHANGE'], }, # Pull GN binaries. { @@ -334,7 +331,7 @@ hooks = [ '--platform=win32', '--no_auth', '--bucket', 'chromium-gn', - '-s', Var('root_dir') + '/buildtools/win/gn.exe.sha1', + '-s', 'src/buildtools/win/gn.exe.sha1', ], }, { @@ -345,7 +342,7 @@ hooks = [ '--platform=darwin', '--no_auth', '--bucket', 'chromium-gn', - '-s', Var('root_dir') + '/buildtools/mac/gn.sha1', + '-s', 'src/buildtools/mac/gn.sha1', ], }, { @@ -356,7 +353,7 @@ hooks = [ '--platform=linux*', '--no_auth', '--bucket', 'chromium-gn', - '-s', Var('root_dir') + '/buildtools/linux64/gn.sha1', + '-s', 'src/buildtools/linux64/gn.sha1', ], }, # Pull clang-format binaries using checked-in hashes. @@ -368,7 +365,7 @@ hooks = [ '--platform=win32', '--no_auth', '--bucket', 'chromium-clang-format', - '-s', Var('root_dir') + '/buildtools/win/clang-format.exe.sha1', + '-s', 'src/buildtools/win/clang-format.exe.sha1', ], }, { @@ -379,7 +376,7 @@ hooks = [ '--platform=darwin', '--no_auth', '--bucket', 'chromium-clang-format', - '-s', Var('root_dir') + '/buildtools/mac/clang-format.sha1', + '-s', 'src/buildtools/mac/clang-format.sha1', ], }, { @@ -390,7 +387,7 @@ hooks = [ '--platform=linux*', '--no_auth', '--bucket', 'chromium-clang-format', - '-s', Var('root_dir') + '/buildtools/linux64/clang-format.sha1', + '-s', 'src/buildtools/linux64/clang-format.sha1', ], }, # Pull luci-go binaries (isolate, swarming) using checked-in hashes. @@ -402,7 +399,7 @@ hooks = [ '--platform=win32', '--no_auth', '--bucket', 'chromium-luci', - '-d', Var('root_dir') + '/tools/luci-go/win64', + '-d', 'src/tools/luci-go/win64', ], }, { @@ -413,7 +410,7 @@ hooks = [ '--platform=darwin', '--no_auth', '--bucket', 'chromium-luci', - '-d', Var('root_dir') + '/tools/luci-go/mac64', + '-d', 'src/tools/luci-go/mac64', ], }, { @@ -424,7 +421,7 @@ hooks = [ '--platform=linux*', '--no_auth', '--bucket', 'chromium-luci', - '-d', Var('root_dir') + '/tools/luci-go/linux64', + '-d', 'src/tools/luci-go/linux64', ], }, { @@ -434,20 +431,20 @@ hooks = [ # TODO(kjellander): Update comment when GYP is completely cleaned up. 'name': 'instrumented_libraries', 'pattern': '\\.sha1', - 'action': ['python', Var('root_dir') + '/third_party/instrumented_libraries/scripts/download_binaries.py'], + 'action': ['python', 'src/third_party/instrumented_libraries/scripts/download_binaries.py'], }, { 'name': 'clang_format_merge_driver', 'pattern': '.', 'action': [ 'python', - Var('root_dir') + '/tools/clang_format_merge_driver/install_git_hook.py', + 'src/tools/clang_format_merge_driver/install_git_hook.py', ], }, ] recursedeps = [ # buildtools provides clang_format, libc++, and libc++abi. - Var('root_dir') + '/buildtools', + 'src/buildtools', # android_tools manages the NDK. - Var('root_dir') + '/third_party/android_tools', + 'src/third_party/android_tools', ] diff --git a/files/OWNERS b/files/OWNERS index e231f7b0..2db52d30 100644 --- a/files/OWNERS +++ b/files/OWNERS @@ -1,7 +1,6 @@ -fbarchard@google.com -kjellander@google.com -# magjed@chromium.org -# torbjorng@chromium.org +fbarchard@chromium.org +magjed@chromium.org +torbjorng@chromium.org per-file *.gyp=kjellander@chromium.org per-file *.gn=kjellander@chromium.org diff --git a/files/README.chromium b/files/README.chromium index b502436f..2512b38d 100644 --- a/files/README.chromium +++ b/files/README.chromium @@ -1,6 +1,6 @@ Name: libyuv URL: http://code.google.com/p/libyuv/ -Version: 1645 +Version: 1649 License: BSD License File: LICENSE diff --git a/files/docs/getting_started.md b/files/docs/getting_started.md index 46c591b6..5df4c30d 100644 --- a/files/docs/getting_started.md +++ b/files/docs/getting_started.md @@ -11,13 +11,13 @@ Refer to chromium instructions for each platform for other prerequisites. Create a working directory, enter it, and run: - gclient config https://chromium.googlesource.com/libyuv/libyuv + gclient config --name src https://chromium.googlesource.com/libyuv/libyuv gclient sync Then you'll get a .gclient file like: solutions = [ - { "name" : "libyuv", + { "name" : "src", "url" : "https://chromium.googlesource.com/libyuv/libyuv", "deps_file" : "DEPS", "managed" : True, @@ -35,7 +35,7 @@ Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/ma For Android add `;target_os=['android'];` to your Linux .gclient solutions = [ - { "name" : "libyuv", + { "name" : "src", "url" : "https://chromium.googlesource.com/libyuv/libyuv", "deps_file" : "DEPS", "managed" : True, @@ -51,14 +51,6 @@ Then run: export GYP_DEFINES="OS=android" gclient sync -Caveat: Theres an error with Google Play services updates. If you get the error "Your version of the Google Play services library is not up to date", run the following: - - cd chromium/src - ./build/android/play_services/update.py download - cd ../.. - -For Windows the gclient sync must be done from an Administrator command prompt. - The sync will generate native build files for your environment using gyp (Windows: Visual Studio, OSX: XCode, Linux: make). This generation can also be forced manually: `gclient runhooks` To get just the source (not buildable): diff --git a/files/include/libyuv/version.h b/files/include/libyuv/version.h index dccc479b..5d56cf06 100644 --- a/files/include/libyuv/version.h +++ b/files/include/libyuv/version.h @@ -11,6 +11,6 @@ #ifndef INCLUDE_LIBYUV_VERSION_H_ #define INCLUDE_LIBYUV_VERSION_H_ -#define LIBYUV_VERSION 1645 +#define LIBYUV_VERSION 1649 #endif // INCLUDE_LIBYUV_VERSION_H_ diff --git a/files/infra/config/cq.cfg b/files/infra/config/cq.cfg index 7a0d2d84..ff0347d6 100644 --- a/files/infra/config/cq.cfg +++ b/files/infra/config/cq.cfg @@ -15,6 +15,11 @@ rietveld { verifiers { reviewer_lgtm { committer_list: "project-libyuv-committers" + dry_run_access_list: "project-libyuv-tryjob-access" + } + gerrit_cq_ability { + committer_list: "project-libyuv-committers" + dry_run_access_list: "project-libyuv-tryjob-access" } try_job { diff --git a/files/source/convert.cc b/files/source/convert.cc index f79acaca..dfa83a5a 100644 --- a/files/source/convert.cc +++ b/files/source/convert.cc @@ -14,8 +14,8 @@ #include "libyuv/cpu_id.h" #include "libyuv/planar_functions.h" #include "libyuv/rotate.h" -#include "libyuv/scale.h" // For ScalePlane() #include "libyuv/row.h" +#include "libyuv/scale.h" // For ScalePlane() #ifdef __cplusplus namespace libyuv { @@ -1018,44 +1018,47 @@ int RGB24ToI420(const uint8* src_rgb24, } } #endif +#endif + { +#if !(defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_MSA)) // Allocate 2 rows of ARGB. const int kRowSize = (width * 4 + 31) & ~31; align_buffer_64(row, kRowSize * 2); #endif - for (y = 0; y < height - 1; y += 2) { + for (y = 0; y < height - 1; y += 2) { #if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_MSA)) - RGB24ToUVRow(src_rgb24, src_stride_rgb24, dst_u, dst_v, width); - RGB24ToYRow(src_rgb24, dst_y, width); - RGB24ToYRow(src_rgb24 + src_stride_rgb24, dst_y + dst_stride_y, width); + RGB24ToUVRow(src_rgb24, src_stride_rgb24, dst_u, dst_v, width); + RGB24ToYRow(src_rgb24, dst_y, width); + RGB24ToYRow(src_rgb24 + src_stride_rgb24, dst_y + dst_stride_y, width); #else - RGB24ToARGBRow(src_rgb24, row, width); - RGB24ToARGBRow(src_rgb24 + src_stride_rgb24, row + kRowSize, width); - ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); - ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); + RGB24ToARGBRow(src_rgb24, row, width); + RGB24ToARGBRow(src_rgb24 + src_stride_rgb24, row + kRowSize, width); + ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); + ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); #endif - src_rgb24 += src_stride_rgb24 * 2; - dst_y += dst_stride_y * 2; - dst_u += dst_stride_u; - dst_v += dst_stride_v; - } - if (height & 1) { + src_rgb24 += src_stride_rgb24 * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; + } + if (height & 1) { #if (defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_MSA)) - RGB24ToUVRow(src_rgb24, 0, dst_u, dst_v, width); - RGB24ToYRow(src_rgb24, dst_y, width); + RGB24ToUVRow(src_rgb24, 0, dst_u, dst_v, width); + RGB24ToYRow(src_rgb24, dst_y, width); #else - RGB24ToARGBRow(src_rgb24, row, width); - ARGBToUVRow(row, 0, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); + RGB24ToARGBRow(src_rgb24, row, width); + ARGBToUVRow(row, 0, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); #endif - } + } #if !(defined(HAS_RGB24TOYROW_NEON) || defined(HAS_RGB24TOYROW_MSA)) - free_aligned_buffer_64(row); -} + free_aligned_buffer_64(row); #endif -return 0; + } + return 0; } // Convert RAW to I420. @@ -1118,79 +1121,74 @@ int RAWToI420(const uint8* src_raw, // Other platforms do intermediate conversion from RAW to ARGB. #else #if defined(HAS_RAWTOARGBROW_SSSE3) - if (TestCpuFlag(kCpuHasSSSE3)) { - RAWToARGBRow = RAWToARGBRow_Any_SSSE3; - if (IS_ALIGNED(width, 16)) { - RAWToARGBRow = RAWToARGBRow_SSSE3; - } + if (TestCpuFlag(kCpuHasSSSE3)) { + RAWToARGBRow = RAWToARGBRow_Any_SSSE3; + if (IS_ALIGNED(width, 16)) { + RAWToARGBRow = RAWToARGBRow_SSSE3; } + } #endif #if defined(HAS_ARGBTOYROW_SSSE3) && defined(HAS_ARGBTOUVROW_SSSE3) - if (TestCpuFlag(kCpuHasSSSE3)) { - ARGBToUVRow = ARGBToUVRow_Any_SSSE3; - ARGBToYRow = ARGBToYRow_Any_SSSE3; - if (IS_ALIGNED(width, 16)) { - ARGBToUVRow = ARGBToUVRow_SSSE3; - ARGBToYRow = ARGBToYRow_SSSE3; - } + if (TestCpuFlag(kCpuHasSSSE3)) { + ARGBToUVRow = ARGBToUVRow_Any_SSSE3; + ARGBToYRow = ARGBToYRow_Any_SSSE3; + if (IS_ALIGNED(width, 16)) { + ARGBToUVRow = ARGBToUVRow_SSSE3; + ARGBToYRow = ARGBToYRow_SSSE3; } + } #endif #if defined(HAS_ARGBTOYROW_AVX2) && defined(HAS_ARGBTOUVROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - ARGBToUVRow = ARGBToUVRow_Any_AVX2; - ARGBToYRow = ARGBToYRow_Any_AVX2; - if (IS_ALIGNED(width, 32)) { - ARGBToUVRow = ARGBToUVRow_AVX2; - ARGBToYRow = ARGBToYRow_AVX2; - } + if (TestCpuFlag(kCpuHasAVX2)) { + ARGBToUVRow = ARGBToUVRow_Any_AVX2; + ARGBToYRow = ARGBToYRow_Any_AVX2; + if (IS_ALIGNED(width, 32)) { + ARGBToUVRow = ARGBToUVRow_AVX2; + ARGBToYRow = ARGBToYRow_AVX2; } + } #endif -#if defined(HAS_RAWTOARGBROW_DSPR2) - if (TestCpuFlag(kCpuHasDSPR2)) { - RAWToARGBRow = RAWToARGBRow_Any_DSPR2; - if (IS_ALIGNED(width, 4)) { - RAWToARGBRow = RAWToARGBRow_DSPR2; - } - } #endif - { - // Allocate 2 rows of ARGB. - const int kRowSize = (width * 4 + 31) & ~31; - align_buffer_64(row, kRowSize * 2); + + { +#if !(defined(HAS_RAWTOYROW_NEON) || defined(HAS_RAWTOYROW_MSA)) + // Allocate 2 rows of ARGB. + const int kRowSize = (width * 4 + 31) & ~31; + align_buffer_64(row, kRowSize * 2); #endif - for (y = 0; y < height - 1; y += 2) { + for (y = 0; y < height - 1; y += 2) { #if (defined(HAS_RAWTOYROW_NEON) || defined(HAS_RAWTOYROW_MSA)) - RAWToUVRow(src_raw, src_stride_raw, dst_u, dst_v, width); - RAWToYRow(src_raw, dst_y, width); - RAWToYRow(src_raw + src_stride_raw, dst_y + dst_stride_y, width); + RAWToUVRow(src_raw, src_stride_raw, dst_u, dst_v, width); + RAWToYRow(src_raw, dst_y, width); + RAWToYRow(src_raw + src_stride_raw, dst_y + dst_stride_y, width); #else - RAWToARGBRow(src_raw, row, width); - RAWToARGBRow(src_raw + src_stride_raw, row + kRowSize, width); - ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); - ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); + RAWToARGBRow(src_raw, row, width); + RAWToARGBRow(src_raw + src_stride_raw, row + kRowSize, width); + ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); + ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); #endif - src_raw += src_stride_raw * 2; - dst_y += dst_stride_y * 2; - dst_u += dst_stride_u; - dst_v += dst_stride_v; - } - if (height & 1) { + src_raw += src_stride_raw * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; + } + if (height & 1) { #if (defined(HAS_RAWTOYROW_NEON) || defined(HAS_RAWTOYROW_MSA)) - RAWToUVRow(src_raw, 0, dst_u, dst_v, width); - RAWToYRow(src_raw, dst_y, width); + RAWToUVRow(src_raw, 0, dst_u, dst_v, width); + RAWToYRow(src_raw, dst_y, width); #else - RAWToARGBRow(src_raw, row, width); - ARGBToUVRow(row, 0, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); + RAWToARGBRow(src_raw, row, width); + ARGBToUVRow(row, 0, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); #endif - } + } #if !(defined(HAS_RAWTOYROW_NEON) || defined(HAS_RAWTOYROW_MSA)) - free_aligned_buffer_64(row); -} + free_aligned_buffer_64(row); #endif -return 0; + } + return 0; } // Convert RGB565 to I420. @@ -1254,87 +1252,88 @@ int RGB565ToI420(const uint8* src_rgb565, // Other platforms do intermediate conversion from RGB565 to ARGB. #else #if defined(HAS_RGB565TOARGBROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2)) { - RGB565ToARGBRow = RGB565ToARGBRow_Any_SSE2; - if (IS_ALIGNED(width, 8)) { - RGB565ToARGBRow = RGB565ToARGBRow_SSE2; - } - } + if (TestCpuFlag(kCpuHasSSE2)) { + RGB565ToARGBRow = RGB565ToARGBRow_Any_SSE2; + if (IS_ALIGNED(width, 8)) { + RGB565ToARGBRow = RGB565ToARGBRow_SSE2; + } + } #endif #if defined(HAS_RGB565TOARGBROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - RGB565ToARGBRow = RGB565ToARGBRow_Any_AVX2; - if (IS_ALIGNED(width, 16)) { - RGB565ToARGBRow = RGB565ToARGBRow_AVX2; - } - } + if (TestCpuFlag(kCpuHasAVX2)) { + RGB565ToARGBRow = RGB565ToARGBRow_Any_AVX2; + if (IS_ALIGNED(width, 16)) { + RGB565ToARGBRow = RGB565ToARGBRow_AVX2; + } + } #endif #if defined(HAS_ARGBTOYROW_SSSE3) && defined(HAS_ARGBTOUVROW_SSSE3) - if (TestCpuFlag(kCpuHasSSSE3)) { - ARGBToUVRow = ARGBToUVRow_Any_SSSE3; - ARGBToYRow = ARGBToYRow_Any_SSSE3; - if (IS_ALIGNED(width, 16)) { - ARGBToUVRow = ARGBToUVRow_SSSE3; - ARGBToYRow = ARGBToYRow_SSSE3; - } - } + if (TestCpuFlag(kCpuHasSSSE3)) { + ARGBToUVRow = ARGBToUVRow_Any_SSSE3; + ARGBToYRow = ARGBToYRow_Any_SSSE3; + if (IS_ALIGNED(width, 16)) { + ARGBToUVRow = ARGBToUVRow_SSSE3; + ARGBToYRow = ARGBToYRow_SSSE3; + } + } #endif #if defined(HAS_ARGBTOYROW_AVX2) && defined(HAS_ARGBTOUVROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - ARGBToUVRow = ARGBToUVRow_Any_AVX2; - ARGBToYRow = ARGBToYRow_Any_AVX2; - if (IS_ALIGNED(width, 32)) { - ARGBToUVRow = ARGBToUVRow_AVX2; - ARGBToYRow = ARGBToYRow_AVX2; - } - } + if (TestCpuFlag(kCpuHasAVX2)) { + ARGBToUVRow = ARGBToUVRow_Any_AVX2; + ARGBToYRow = ARGBToYRow_Any_AVX2; + if (IS_ALIGNED(width, 32)) { + ARGBToUVRow = ARGBToUVRow_AVX2; + ARGBToYRow = ARGBToYRow_AVX2; + } + } #endif #if defined(HAS_RGB565TOARGBROW_DSPR2) - if (TestCpuFlag(kCpuHasDSPR2)) { - RGB565ToARGBRow = RGB565ToARGBRow_Any_DSPR2; - if (IS_ALIGNED(width, 8)) { - RGB565ToARGBRow = RGB565ToARGBRow_DSPR2; - } - } + if (TestCpuFlag(kCpuHasDSPR2)) { + RGB565ToARGBRow = RGB565ToARGBRow_Any_DSPR2; + if (IS_ALIGNED(width, 8)) { + RGB565ToARGBRow = RGB565ToARGBRow_DSPR2; + } + } #endif - { - // Allocate 2 rows of ARGB. - const int kRowSize = (width * 4 + 31) & ~31; - align_buffer_64(row, kRowSize * 2); #endif - - for (y = 0; y < height - 1; y += 2) { + { +#if !(defined(HAS_RGB565TOYROW_NEON) || defined(HAS_RGB565TOYROW_MSA)) + // Allocate 2 rows of ARGB. + const int kRowSize = (width * 4 + 31) & ~31; + align_buffer_64(row, kRowSize * 2); +#endif + for (y = 0; y < height - 1; y += 2) { #if (defined(HAS_RGB565TOYROW_NEON) || defined(HAS_RGB565TOYROW_MSA)) - RGB565ToUVRow(src_rgb565, src_stride_rgb565, dst_u, dst_v, width); - RGB565ToYRow(src_rgb565, dst_y, width); - RGB565ToYRow(src_rgb565 + src_stride_rgb565, dst_y + dst_stride_y, width); + RGB565ToUVRow(src_rgb565, src_stride_rgb565, dst_u, dst_v, width); + RGB565ToYRow(src_rgb565, dst_y, width); + RGB565ToYRow(src_rgb565 + src_stride_rgb565, dst_y + dst_stride_y, width); #else - RGB565ToARGBRow(src_rgb565, row, width); - RGB565ToARGBRow(src_rgb565 + src_stride_rgb565, row + kRowSize, width); - ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); - ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); + RGB565ToARGBRow(src_rgb565, row, width); + RGB565ToARGBRow(src_rgb565 + src_stride_rgb565, row + kRowSize, width); + ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); + ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); #endif - src_rgb565 += src_stride_rgb565 * 2; - dst_y += dst_stride_y * 2; - dst_u += dst_stride_u; - dst_v += dst_stride_v; - } - if (height & 1) { + src_rgb565 += src_stride_rgb565 * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; + } + if (height & 1) { #if (defined(HAS_RGB565TOYROW_NEON) || defined(HAS_RGB565TOYROW_MSA)) - RGB565ToUVRow(src_rgb565, 0, dst_u, dst_v, width); - RGB565ToYRow(src_rgb565, dst_y, width); + RGB565ToUVRow(src_rgb565, 0, dst_u, dst_v, width); + RGB565ToYRow(src_rgb565, dst_y, width); #else - RGB565ToARGBRow(src_rgb565, row, width); - ARGBToUVRow(row, 0, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); + RGB565ToARGBRow(src_rgb565, row, width); + ARGBToUVRow(row, 0, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); #endif - } + } #if !(defined(HAS_RGB565TOYROW_NEON) || defined(HAS_RGB565TOYROW_MSA)) - free_aligned_buffer_64(row); -} + free_aligned_buffer_64(row); #endif -return 0; + } + return 0; } // Convert ARGB1555 to I420. @@ -1399,81 +1398,83 @@ int ARGB1555ToI420(const uint8* src_argb1555, // Other platforms do intermediate conversion from ARGB1555 to ARGB. #else #if defined(HAS_ARGB1555TOARGBROW_SSE2) - if (TestCpuFlag(kCpuHasSSE2)) { - ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_SSE2; - if (IS_ALIGNED(width, 8)) { - ARGB1555ToARGBRow = ARGB1555ToARGBRow_SSE2; - } - } + if (TestCpuFlag(kCpuHasSSE2)) { + ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_SSE2; + if (IS_ALIGNED(width, 8)) { + ARGB1555ToARGBRow = ARGB1555ToARGBRow_SSE2; + } + } #endif #if defined(HAS_ARGB1555TOARGBROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_AVX2; - if (IS_ALIGNED(width, 16)) { - ARGB1555ToARGBRow = ARGB1555ToARGBRow_AVX2; - } - } + if (TestCpuFlag(kCpuHasAVX2)) { + ARGB1555ToARGBRow = ARGB1555ToARGBRow_Any_AVX2; + if (IS_ALIGNED(width, 16)) { + ARGB1555ToARGBRow = ARGB1555ToARGBRow_AVX2; + } + } #endif #if defined(HAS_ARGBTOYROW_SSSE3) && defined(HAS_ARGBTOUVROW_SSSE3) - if (TestCpuFlag(kCpuHasSSSE3)) { - ARGBToUVRow = ARGBToUVRow_Any_SSSE3; - ARGBToYRow = ARGBToYRow_Any_SSSE3; - if (IS_ALIGNED(width, 16)) { - ARGBToUVRow = ARGBToUVRow_SSSE3; - ARGBToYRow = ARGBToYRow_SSSE3; - } - } + if (TestCpuFlag(kCpuHasSSSE3)) { + ARGBToUVRow = ARGBToUVRow_Any_SSSE3; + ARGBToYRow = ARGBToYRow_Any_SSSE3; + if (IS_ALIGNED(width, 16)) { + ARGBToUVRow = ARGBToUVRow_SSSE3; + ARGBToYRow = ARGBToYRow_SSSE3; + } + } #endif #if defined(HAS_ARGBTOYROW_AVX2) && defined(HAS_ARGBTOUVROW_AVX2) - if (TestCpuFlag(kCpuHasAVX2)) { - ARGBToUVRow = ARGBToUVRow_Any_AVX2; - ARGBToYRow = ARGBToYRow_Any_AVX2; - if (IS_ALIGNED(width, 32)) { - ARGBToUVRow = ARGBToUVRow_AVX2; - ARGBToYRow = ARGBToYRow_AVX2; - } - } -#endif - { - // Allocate 2 rows of ARGB. - const int kRowSize = (width * 4 + 31) & ~31; - align_buffer_64(row, kRowSize * 2); + if (TestCpuFlag(kCpuHasAVX2)) { + ARGBToUVRow = ARGBToUVRow_Any_AVX2; + ARGBToYRow = ARGBToYRow_Any_AVX2; + if (IS_ALIGNED(width, 32)) { + ARGBToUVRow = ARGBToUVRow_AVX2; + ARGBToYRow = ARGBToYRow_AVX2; + } + } +#endif +#endif + { +#if !(defined(HAS_ARGB1555TOYROW_NEON) || defined(HAS_ARGB1555TOYROW_MSA)) + // Allocate 2 rows of ARGB. + const int kRowSize = (width * 4 + 31) & ~31; + align_buffer_64(row, kRowSize * 2); #endif - for (y = 0; y < height - 1; y += 2) { + for (y = 0; y < height - 1; y += 2) { #if (defined(HAS_ARGB1555TOYROW_NEON) || defined(HAS_ARGB1555TOYROW_MSA)) - ARGB1555ToUVRow(src_argb1555, src_stride_argb1555, dst_u, dst_v, width); - ARGB1555ToYRow(src_argb1555, dst_y, width); - ARGB1555ToYRow(src_argb1555 + src_stride_argb1555, dst_y + dst_stride_y, - width); + ARGB1555ToUVRow(src_argb1555, src_stride_argb1555, dst_u, dst_v, width); + ARGB1555ToYRow(src_argb1555, dst_y, width); + ARGB1555ToYRow(src_argb1555 + src_stride_argb1555, dst_y + dst_stride_y, + width); #else - ARGB1555ToARGBRow(src_argb1555, row, width); - ARGB1555ToARGBRow(src_argb1555 + src_stride_argb1555, row + kRowSize, - width); - ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); - ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); -#endif - src_argb1555 += src_stride_argb1555 * 2; - dst_y += dst_stride_y * 2; - dst_u += dst_stride_u; - dst_v += dst_stride_v; - } - if (height & 1) { + ARGB1555ToARGBRow(src_argb1555, row, width); + ARGB1555ToARGBRow(src_argb1555 + src_stride_argb1555, row + kRowSize, + width); + ARGBToUVRow(row, kRowSize, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); + ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); +#endif + src_argb1555 += src_stride_argb1555 * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; + } + if (height & 1) { #if (defined(HAS_ARGB1555TOYROW_NEON) || defined(HAS_ARGB1555TOYROW_MSA)) - ARGB1555ToUVRow(src_argb1555, 0, dst_u, dst_v, width); - ARGB1555ToYRow(src_argb1555, dst_y, width); + ARGB1555ToUVRow(src_argb1555, 0, dst_u, dst_v, width); + ARGB1555ToYRow(src_argb1555, dst_y, width); #else - ARGB1555ToARGBRow(src_argb1555, row, width); - ARGBToUVRow(row, 0, dst_u, dst_v, width); - ARGBToYRow(row, dst_y, width); + ARGB1555ToARGBRow(src_argb1555, row, width); + ARGBToUVRow(row, 0, dst_u, dst_v, width); + ARGBToYRow(row, dst_y, width); #endif - } + } #if !(defined(HAS_ARGB1555TOYROW_NEON) || defined(HAS_ARGB1555TOYROW_MSA)) - free_aligned_buffer_64(row); -} + free_aligned_buffer_64(row); #endif -return 0; + } + return 0; } // Convert ARGB4444 to I420. @@ -1584,18 +1585,21 @@ int ARGB4444ToI420(const uint8* src_argb4444, } } #endif +#endif + { +#if !defined(HAS_ARGB4444TOYROW_NEON) // Allocate 2 rows of ARGB. const int kRowSize = (width * 4 + 31) & ~31; align_buffer_64(row, kRowSize * 2); #endif - for (y = 0; y < height - 1; y += 2) { + for (y = 0; y < height - 1; y += 2) { #if defined(HAS_ARGB4444TOYROW_NEON) - ARGB4444ToUVRow(src_argb4444, src_stride_argb4444, dst_u, dst_v, width); - ARGB4444ToYRow(src_argb4444, dst_y, width); - ARGB4444ToYRow(src_argb4444 + src_stride_argb4444, dst_y + dst_stride_y, - width); + ARGB4444ToUVRow(src_argb4444, src_stride_argb4444, dst_u, dst_v, width); + ARGB4444ToYRow(src_argb4444, dst_y, width); + ARGB4444ToYRow(src_argb4444 + src_stride_argb4444, dst_y + dst_stride_y, + width); #else ARGB4444ToARGBRow(src_argb4444, row, width); ARGB4444ToARGBRow(src_argb4444 + src_stride_argb4444, row + kRowSize, @@ -1604,26 +1608,26 @@ int ARGB4444ToI420(const uint8* src_argb4444, ARGBToYRow(row, dst_y, width); ARGBToYRow(row + kRowSize, dst_y + dst_stride_y, width); #endif - src_argb4444 += src_stride_argb4444 * 2; - dst_y += dst_stride_y * 2; - dst_u += dst_stride_u; - dst_v += dst_stride_v; - } - if (height & 1) { + src_argb4444 += src_stride_argb4444 * 2; + dst_y += dst_stride_y * 2; + dst_u += dst_stride_u; + dst_v += dst_stride_v; + } + if (height & 1) { #if defined(HAS_ARGB4444TOYROW_NEON) - ARGB4444ToUVRow(src_argb4444, 0, dst_u, dst_v, width); - ARGB4444ToYRow(src_argb4444, dst_y, width); + ARGB4444ToUVRow(src_argb4444, 0, dst_u, dst_v, width); + ARGB4444ToYRow(src_argb4444, dst_y, width); #else ARGB4444ToARGBRow(src_argb4444, row, width); ARGBToUVRow(row, 0, dst_u, dst_v, width); ARGBToYRow(row, dst_y, width); #endif - } + } #if !defined(HAS_ARGB4444TOYROW_NEON) - free_aligned_buffer_64(row); -} + free_aligned_buffer_64(row); #endif -return 0; + } + return 0; } static void SplitPixels(const uint8* src_u, diff --git a/files/source/convert_from.cc b/files/source/convert_from.cc index e6ff5243..ab5afc06 100644 --- a/files/source/convert_from.cc +++ b/files/source/convert_from.cc @@ -15,9 +15,9 @@ #include "libyuv/cpu_id.h" #include "libyuv/planar_functions.h" #include "libyuv/rotate.h" +#include "libyuv/row.h" #include "libyuv/scale.h" // For ScalePlane() #include "libyuv/video_common.h" -#include "libyuv/row.h" #ifdef __cplusplus namespace libyuv { diff --git a/files/source/cpu_id.cc b/files/source/cpu_id.cc index 9ff93263..afb5d282 100644 --- a/files/source/cpu_id.cc +++ b/files/source/cpu_id.cc @@ -174,9 +174,7 @@ LIBYUV_API SAFEBUFFERS int MipsCpuCaps(const char* cpuinfo_name, if (strcmp(ase, " msa") == 0) { return kCpuHasMSA; } - if (strcmp(ase, " dspr2") == 0) { - return kCpuHasDSPR2; - } + return kCpuHasDSPR2; } while (fgets(cpuinfo_line, sizeof(cpuinfo_line) - 1, f)) { if (memcmp(cpuinfo_line, "ASEs implemented", 16) == 0) { @@ -186,9 +184,7 @@ LIBYUV_API SAFEBUFFERS int MipsCpuCaps(const char* cpuinfo_name, if (strcmp(ase, " msa") == 0) { return kCpuHasMSA; } - if (strcmp(ase, " dspr2") == 0) { - return kCpuHasDSPR2; - } + return kCpuHasDSPR2; } } } diff --git a/files/source/rotate.cc b/files/source/rotate.cc index 277c53b2..4330884c 100644 --- a/files/source/rotate.cc +++ b/files/source/rotate.cc @@ -10,8 +10,8 @@ #include "libyuv/rotate.h" -#include "libyuv/cpu_id.h" #include "libyuv/convert.h" +#include "libyuv/cpu_id.h" #include "libyuv/planar_functions.h" #include "libyuv/rotate_row.h" #include "libyuv/row.h" diff --git a/files/source/rotate_argb.cc b/files/source/rotate_argb.cc index b458d8fa..ede4eafa 100644 --- a/files/source/rotate_argb.cc +++ b/files/source/rotate_argb.cc @@ -10,8 +10,8 @@ #include "libyuv/rotate.h" -#include "libyuv/cpu_id.h" #include "libyuv/convert.h" +#include "libyuv/cpu_id.h" #include "libyuv/planar_functions.h" #include "libyuv/row.h" diff --git a/files/source/rotate_common.cc b/files/source/rotate_common.cc index cdd231fa..89357e73 100644 --- a/files/source/rotate_common.cc +++ b/files/source/rotate_common.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/row.h" #include "libyuv/rotate_row.h" +#include "libyuv/row.h" #ifdef __cplusplus namespace libyuv { diff --git a/files/source/rotate_dspr2.cc b/files/source/rotate_dspr2.cc index 2dce9107..5d2338de 100644 --- a/files/source/rotate_dspr2.cc +++ b/files/source/rotate_dspr2.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/row.h" #include "libyuv/rotate_row.h" +#include "libyuv/row.h" #include "libyuv/basic_types.h" diff --git a/files/source/rotate_gcc.cc b/files/source/rotate_gcc.cc index 85b41dd8..74b48ac4 100644 --- a/files/source/rotate_gcc.cc +++ b/files/source/rotate_gcc.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/row.h" #include "libyuv/rotate_row.h" +#include "libyuv/row.h" #ifdef __cplusplus namespace libyuv { diff --git a/files/source/rotate_neon.cc b/files/source/rotate_neon.cc index 41ec34ec..ef5c2356 100644 --- a/files/source/rotate_neon.cc +++ b/files/source/rotate_neon.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/row.h" #include "libyuv/rotate_row.h" +#include "libyuv/row.h" #include "libyuv/basic_types.h" diff --git a/files/source/rotate_neon64.cc b/files/source/rotate_neon64.cc index 3cf17930..f52b0ed0 100644 --- a/files/source/rotate_neon64.cc +++ b/files/source/rotate_neon64.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/row.h" #include "libyuv/rotate_row.h" +#include "libyuv/row.h" #include "libyuv/basic_types.h" diff --git a/files/source/rotate_win.cc b/files/source/rotate_win.cc index 201643e7..044048d3 100644 --- a/files/source/rotate_win.cc +++ b/files/source/rotate_win.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/row.h" #include "libyuv/rotate_row.h" +#include "libyuv/row.h" #ifdef __cplusplus namespace libyuv { diff --git a/files/source/row_any.cc b/files/source/row_any.cc index 74a6621f..af5d1fbc 100644 --- a/files/source/row_any.cc +++ b/files/source/row_any.cc @@ -19,6 +19,14 @@ namespace libyuv { extern "C" { #endif +// memset for temp is meant to clear the source buffer (not dest) so that +// SIMD that reads full multiple of 16 bytes will not trigger msan errors. +// memset is not needed for production, as the garbage values are processed but +// not used, although there may be edge cases for subsampling. +// The size of the buffer is based on the largest read, which can be inferred +// by the source type (e.g. ARGB) and the mask (last parameter), or by examining +// the source code for how much the source pointers are advanced. + // Subsampled source needs to be increase by 1 of not even. #define SS(width, shift) (((width) + (1 << (shift)) - 1) >> (shift)) @@ -618,17 +626,17 @@ ANY11(ARGBExtractAlphaRow_Any_NEON, ARGBExtractAlphaRow_NEON, 0, 4, 1, 15) // Any 1 to 1 blended. Destination is read, modify, write. #define ANY11B(NAMEANY, ANY_SIMD, UVSHIFT, SBPP, BPP, MASK) \ void NAMEANY(const uint8* src_ptr, uint8* dst_ptr, int width) { \ - SIMD_ALIGNED(uint8 temp[128 * 2]); \ - memset(temp, 0, 128 * 2); /* for YUY2 and msan */ \ + SIMD_ALIGNED(uint8 temp[64 * 2]); \ + memset(temp, 0, 64 * 2); /* for msan */ \ int r = width & MASK; \ int n = width & ~MASK; \ if (n > 0) { \ ANY_SIMD(src_ptr, dst_ptr, n); \ } \ memcpy(temp, src_ptr + (n >> UVSHIFT) * SBPP, SS(r, UVSHIFT) * SBPP); \ - memcpy(temp + 128, dst_ptr + n * BPP, r * BPP); \ - ANY_SIMD(temp, temp + 128, MASK + 1); \ - memcpy(dst_ptr + n * BPP, temp + 128, r * BPP); \ + memcpy(temp + 64, dst_ptr + n * BPP, r * BPP); \ + ANY_SIMD(temp, temp + 64, MASK + 1); \ + memcpy(dst_ptr + n * BPP, temp + 64, r * BPP); \ } #ifdef HAS_ARGBCOPYALPHAROW_AVX2 @@ -713,31 +721,31 @@ ANY11P(ARGBShuffleRow_Any_MSA, ARGBShuffleRow_MSA, const uint8*, 4, 4, 7) #define ANY11P16(NAMEANY, ANY_SIMD, T, SBPP, BPP, MASK) \ void NAMEANY(const uint16* src_ptr, uint16* dst_ptr, T shuffler, \ int width) { \ - SIMD_ALIGNED(uint16 temp[32 * 2]); \ - memset(temp, 0, 64); /* for msan */ \ + SIMD_ALIGNED(uint16 temp[16 * 2]); \ + memset(temp, 0, 32); /* for msan */ \ int r = width & MASK; \ int n = width & ~MASK; \ if (n > 0) { \ ANY_SIMD(src_ptr, dst_ptr, shuffler, n); \ } \ - memcpy(temp, src_ptr + n * SBPP, r * SBPP); \ - ANY_SIMD(temp, temp + 64, shuffler, MASK + 1); \ - memcpy(dst_ptr + n * BPP, temp + 64, r * BPP); \ + memcpy(temp, src_ptr + n, r * SBPP); \ + ANY_SIMD(temp, temp + 16, shuffler, MASK + 1); \ + memcpy(dst_ptr + n, temp + 16, r * BPP); \ } #ifdef HAS_HALFFLOATROW_SSE2 -ANY11P16(HalfFloatRow_Any_SSE2, HalfFloatRow_SSE2, float, 1, 1, 7) +ANY11P16(HalfFloatRow_Any_SSE2, HalfFloatRow_SSE2, float, 2, 2, 7) #endif #ifdef HAS_HALFFLOATROW_AVX2 -ANY11P16(HalfFloatRow_Any_AVX2, HalfFloatRow_AVX2, float, 1, 1, 15) +ANY11P16(HalfFloatRow_Any_AVX2, HalfFloatRow_AVX2, float, 2, 2, 15) #endif #ifdef HAS_HALFFLOATROW_F16C -ANY11P16(HalfFloatRow_Any_F16C, HalfFloatRow_F16C, float, 1, 1, 15) -ANY11P16(HalfFloat1Row_Any_F16C, HalfFloat1Row_F16C, float, 1, 1, 15) +ANY11P16(HalfFloatRow_Any_F16C, HalfFloatRow_F16C, float, 2, 2, 15) +ANY11P16(HalfFloat1Row_Any_F16C, HalfFloat1Row_F16C, float, 2, 2, 15) #endif #ifdef HAS_HALFFLOATROW_NEON -ANY11P16(HalfFloatRow_Any_NEON, HalfFloatRow_NEON, float, 1, 1, 7) -ANY11P16(HalfFloat1Row_Any_NEON, HalfFloat1Row_NEON, float, 1, 1, 7) +ANY11P16(HalfFloatRow_Any_NEON, HalfFloatRow_NEON, float, 2, 2, 7) +ANY11P16(HalfFloat1Row_Any_NEON, HalfFloat1Row_NEON, float, 2, 2, 7) #endif #undef ANY11P16 diff --git a/files/source/scale.cc b/files/source/scale.cc index a5c7f7ad..010ad9d4 100644 --- a/files/source/scale.cc +++ b/files/source/scale.cc @@ -45,9 +45,10 @@ static void ScalePlaneDown2(int src_width, int y; void (*ScaleRowDown2)(const uint8* src_ptr, ptrdiff_t src_stride, uint8* dst_ptr, int dst_width) = - filtering == kFilterNone ? ScaleRowDown2_C : (filtering == kFilterLinear - ? ScaleRowDown2Linear_C - : ScaleRowDown2Box_C); + filtering == kFilterNone + ? ScaleRowDown2_C + : (filtering == kFilterLinear ? ScaleRowDown2Linear_C + : ScaleRowDown2Box_C); int row_stride = src_stride << 1; (void)src_width; (void)src_height; diff --git a/files/source/scale_neon64.cc b/files/source/scale_neon64.cc index a98b9d03..1ff5f2bf 100644 --- a/files/source/scale_neon64.cc +++ b/files/source/scale_neon64.cc @@ -8,8 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ -#include "libyuv/scale.h" #include "libyuv/row.h" +#include "libyuv/scale.h" #include "libyuv/scale_row.h" #ifdef __cplusplus diff --git a/files/third_party/gflags/BUILD.gn b/files/third_party/gflags/BUILD.gn index 69a07232..af41b7ec 100644 --- a/files/third_party/gflags/BUILD.gn +++ b/files/third_party/gflags/BUILD.gn @@ -1,14 +1,11 @@ -# -# Copyright 2014 The LibYuv Project Authors. All rights reserved. +# Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. # # Use of this source code is governed by a BSD-style license # that can be found in the LICENSE file in the root of the source # tree. An additional intellectual property rights grant can be found -# in the file PATENTS. All contributing project authors may +# in the file PATENTS. All contributing project authors may # be found in the AUTHORS file in the root of the source tree. -# This is a copy of WebRTC's BUILD.gn. - if (is_win) { gflags_gen_arch_root = "gen/win" } else { diff --git a/files/tools/OWNERS b/files/tools/OWNERS index e96cf04d..ac607d42 100644 --- a/files/tools/OWNERS +++ b/files/tools/OWNERS @@ -1,2 +1,55 @@ -fbarchard@google.com -kjellander@google.com +# You can add new small tools to this directory at your desire, feel free +# to owners-TBR new folders (assuming you have a regular review already, +# of course). Include an OWNERS file with at least two people for your new +# folder. +# If you're changing existing tools, have your change reviewed by the +# OWNERS of the existing tool. + +dpranke@chromium.org +scottmg@chromium.org +thakis@chromium.org + + +per-file bisect*.py=anantha@chromium.org +per-file bisect*.py=prasadv@chromium.org +per-file bisect*.py=robertocn@chromium.org +per-file run-bisect*.py=prasadv@chromium.org +per-file run-bisect*.py=robertocn@chromium.org +per-file prepare-bisect*.py=prasadv@chromium.org +per-file prepare-bisect*.py=robertocn@chromium.org + +per-file boilerplate.py=rsesek@chromium.org + +per-file check_git_config.py=iannucci@chromium.org +per-file check_git_config.py=vadimsh@chromium.org + +per-file check_grd_for_unused_strings.py=estade@chromium.org + +per-file gyp-explain.py=thakis@chromium.org + +per-file gypv8shy.py=jochen@chromium.org + +per-file include_tracer.py=thakis@chromium.org + +per-file ipc_messages_log.py=yfriedman@chromium.org + +per-file licenses.py=file://tools/copyright_scanner/OWNERS + +per-file remove_stale_pyc_files.py=dtu@chromium.org + +per-file roll_angle.py=kbr@chromium.org +per-file roll_angle.py=kjellander@chromium.org +per-file roll_angle.py=geofflang@chromium.org +per-file roll_webgl_conformance.py=bajones@chromium.org +per-file roll_webgl_conformance.py=kbr@chromium.org +per-file roll_webgl_conformance.py=kjellander@chromium.org +per-file roll_webgl_conformance.py=geofflang@chromium.org +per-file roll_webgl_conformance.py=zmo@chromium.org +per-file roll_webrtc.py=kjellander@chromium.org + +per-file safely-roll-deps.py=borenet@chromium.org + +per-file sort-headers.py=satorux@chromium.org +per-file sort-sources.py=satorux@chromium.org +per-file yes_no.py=satorux@chromium.org + diff --git a/files/tools/msan/blacklist.txt b/files/tools/msan/blacklist.txt index 8b5e42a7..40ea4b83 100644 --- a/files/tools/msan/blacklist.txt +++ b/files/tools/msan/blacklist.txt @@ -1,9 +1,24 @@ -# The rules in this file are only applied at compile time. -# Because the Chrome buildsystem does not automatically touch the files -# mentioned here, changing this file requires clobbering all MSan bots. +# The rules in this file are only applied at compile time. If you can modify the +# source in question, consider function attributes to disable instrumentation. # # Please think twice before you add or remove these rules. -# This is a stripped down copy of Chromium's blacklist.txt, to enable -# adding libyuv-specific blacklist entries. +# False positive in ffmpeg due to assembly code. http://crbug.com/344505 +fun:ff_get_cpu_flags_x86 +# Benign uninits in zlib. +# http://crbug.com/116277 +fun:*MOZ_Z_deflate* +# http://crbug.com/418383 +fun:longest_match + +# Uninit in zlib with SIMD intrinsic http://crbug.com/426868 +fun:crc_fold512_to_32 + +# Uninit in OSMesa. http://crbug.com/347967 +fun:unpack_RGBA8888 +fun:unpack_RGB888 + +# False positives due to use of linux_syscall_support. http://crbug.com/394028 +src:*/breakpad/src/* +src:*/components/crash/content/app/breakpad_linux.cc diff --git a/files/tools/ubsan/blacklist.txt b/files/tools/ubsan/blacklist.txt index 8bcb2907..e1e3c08a 100644 --- a/files/tools/ubsan/blacklist.txt +++ b/files/tools/ubsan/blacklist.txt @@ -1,9 +1,5 @@ ############################################################################# # UBSan blacklist. -# Please think twice before you add or remove these rules. - -# This is a stripped down copy of Chromium's blacklist.txt, to enable -# adding WebRTC-specific blacklist entries. ############################################################################# # YASM does some funny things that UBsan doesn't like. @@ -11,5 +7,71 @@ src:*/third_party/yasm/* ############################################################################# +# V8 gives too many false positives. Ignore them for now. +src:*/v8/* + +############################################################################# # Ignore system libraries. src:*/usr/* + +############################################################################# +# V8 UBsan supressions, commented out for now since we are ignorning v8 +# completely. +# fun:*v8*internal*FastD2I* +# fun:*v8*internal*ComputeIntegerHash* +# fun:*v8*internal*ComputeLongHash* +# fun:*v8*internal*ComputePointerHash* +# src:*/v8/src/base/bits.cc +# src:*/v8/src/base/functional.cc +# Undefined behaviour (integer overflow) is expected but ignored in this +# function. +# fun:*JsonParser*ParseJsonNumber* + +# Runtime numeric functions. +# src:*/v8/src/runtime/runtime-numbers.cc + +# Shifts of negative numbers +# fun:*v8*internal*HPositionInfo*TagPosition* +# fun:*v8*internal*Range*Shl* +# fun:*v8*internal*RelocInfoWriter*WriteTaggedData* + +############################################################################# +# Undefined arithmetic that can be safely ignored. +src:*/base/numerics/saturated_arithmetic.h +src:*/ppapi/shared_impl/id_assignment.h + +############################################################################# +# ICU supressions. Mostly hash functions where integer overflow is OK. +fun:*hashEntry* +fun:*LocaleCacheKey*hashCode* +fun:*google*protobuf*hash* +fun:*(hash|Hash)* + +############################################################################# +# Bounds blacklist. +# Array at the end of struct pattern: +# Maybe UBSan itself can be improved here? +# e.g. +# struct blah { +# int a; +# char foo[2]; // not actually 2 +# } +src:*/net/disk_cache/blockfile/backend_impl.cc +src:*/net/disk_cache/blockfile/entry_impl.cc +src:*/third_party/icu/source/common/rbbi.cpp +src:*/third_party/icu/source/common/rbbitblb.cpp +src:*/third_party/icu/source/common/ucmndata.c + +############################################################################# +# Delete in destructor on a this where this == nullptr +fun:*re2*RegexpD* + +############################################################################# +# Harmless float division by zero. +fun:*RendererFrameManager*CullUnlockedFrames* + +############################################################################# +# libc++ __tree and map are not UBSAN clean +# https://llvm.org/bugs/show_bug.cgi?id=19302 +src:*/third_party/libc\+\+/trunk/include/__tree +src:*/third_party/libc\+\+/trunk/include/map diff --git a/files/tools/ubsan/vptr_blacklist.txt b/files/tools/ubsan/vptr_blacklist.txt index 8ed070c0..e8382039 100644 --- a/files/tools/ubsan/vptr_blacklist.txt +++ b/files/tools/ubsan/vptr_blacklist.txt @@ -4,11 +4,68 @@ # tricky to represent C++ types. For now, any possible changes by name manglings # are simply represented as wildcard expressions of regexp, and thus it might be # over-blacklisted. -# -# Please think twice before you add or remove these rules. -# -# This is a stripped down copy of Chromium's vptr_blacklist.txt, to enable -# adding libyuv-specific blacklist entries. + +############################################################################# +# Identical layouts. +# If base and derived classes have identifical memory layouts (i.e., the same +# object size) and both have no virtual functions, we blacklist them as there +# would be not much security implications. + +fun:*LifecycleNotifier*addObserver* +fun:*LifecycleNotifier*removeObserver* +fun:*toWebInputElement* +type:*base*MessageLoopForIO* +type:*BlockRefType* +type:*SkAutoTUnref* +type:*WDResult* +type:*ExecutionContext* +type:*WebInputElement* +type:*WebFormControlElement* + +# Avoid identical layout cases for 86 different classes in InspectorTypeBuilder, +# all of which are guarded using COMPILER_ASSERT on the object size. Two more +# types are also blacklisted due to the template class (JSONArray <-> Array<T>). + +src:*InspectorTypeBuilder.h* +type:*TypeBuilder* +type:*JSONArray* + +############################################################################# +# Base class's constructor accesses a derived class's member. + +fun:*DoublyLinkedListNode* +type:*content*WebUIExtensionData* + +# RenderFrameObserverTracker<T>::RenderFrameObserverTracker() +fun:*content*RenderFrameObserverTracker*RenderFrame* + +# RenderViewObserverTracker<T>::RenderViewObserverTracker() +fun:*content*RenderViewObserverTracker*RenderView* + +############################################################################# +# Base class's destructor accesses a derived class. + +fun:*DatabaseContext*contextDestroyed* + +# FIXME: Cannot handle template function LifecycleObserver<>::setContext, +# so exclude source file for now. +src:*LifecycleObserver.h* + +############################################################################# +# static_cast into itself in the constructor. + +fun:*RefCountedGarbageCollected*makeKeepAlive* +fun:*ThreadSafeRefCountedGarbageCollected*makeKeepAlive* + +############################################################################# +# Accessing data in destructors where the class has virtual inheritances. + +type:*content*RenderWidgetHost* + +# Match mangled name for X::~X(). +fun:*content*RenderThreadImplD* +fun:*content*RenderViewHostImplD* +fun:*content*UtilityThreadImplD* ############################################################################# # Using raw pointer values. @@ -16,6 +73,56 @@ # A raw pointer value (16) is used to infer the field offset by # GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET. -# Example: -# src:*/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc +src:*/third_party/protobuf/src/google/protobuf/compiler/plugin.pb.cc +src:*/third_party/protobuf/src/google/protobuf/compiler/cpp/cpp_message.cc +src:*/third_party/protobuf/src/google/protobuf/descriptor.pb.cc + +############################################################################# +# Avoid link errors. +# Ubsan vptr needs typeinfo on the target class, but it looks like typeinfo is +# not avaiable if the class is not exported. For now, simply blacklisted to +# avoid link errors; e.g., undefined reference to 'typeinfo for [CLASS_NAME]'. + +# obj/ppapi/libppapi_proxy.a(obj/ppapi/proxy/ppapi_proxy.proxy_channel.o):../../ppapi/proxy/proxy_channel.cc:__unnamed_53: error: undefined reference to 'typeinfo for IPC::TestSink' +src:*/ppapi/proxy/proxy_channel.cc + +# obj/chrome/libbrowser.a(obj/chrome/browser/net/browser.predictor.o):../../chrome/browser/net/predictor.cc:__unnamed_577: error: undefined reference to 'typeinfo for ProxyAdvisor' +src:*/chrome/browser/net/predictor.cc + +# obj/third_party/pdfium/libfpdfapi.a(obj/third_party/pdfium/core/src/fpdfapi/fpdf_render/fpdfapi.fpdf_render_text.o):../../third_party/pdfium/core/src/fpdfapi/fpdf_render/:__unnamed_360: error: undefined reference to 'typeinfo for CPDF_InlineImages' +src:*/third_party/pdfium/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp + +# obj/third_party/libwebm/libwebm.a(obj/third_party/libwebm/source/libwebm.mkvmuxer.o)(.data.rel..L__unnamed_2+0x18): error: undefined reference to 'typeinfo for mkvparser::IMkvReader' +src:*/third_party/libwebm/source/mkvmuxer.cpp + +############################################################################# +# LLVM is not UBSan vptr clean. +src:*third_party/swiftshader/third_party/LLVM* + +############################################################################# +# UBSan seems to be emit false positives when virtual base classes are +# involved, see e.g. crbug.com/448102. +type:*v8*internal*OFStream* + +############################################################################# +# UBsan is unable to handle static_cast<A*>(nullptr) and crashes on SIGSEGV. +# + +# static_cast<StartPageService*> in StartPageServiceFactory::GetForProfile. +type:*StartPageService* + +# Remove once function attribute level blacklisting is implemented. +# See crbug.com/476063. +fun:*forbidGCDuringConstruction* + +############################################################################# +# UBsan goes into an infinite recursion when __dynamic_cast instrumented with +# "vptr". See crbug.com/609786. + +src:*/third_party/libc\+\+abi/trunk/src/private_typeinfo.cpp + +############################################################################# +# invalid downcasts for IPC messages +# https://crbug.com/520760 +src:*nacl_message_scanner.cc diff --git a/files/unit_test/planar_test.cc b/files/unit_test/planar_test.cc index 2d53cc02..28d557a5 100644 --- a/files/unit_test/planar_test.cc +++ b/files/unit_test/planar_test.cc @@ -11,6 +11,7 @@ #include <stdlib.h> #include <time.h> +#include "../unit_test/unit_test.h" #include "libyuv/compare.h" #include "libyuv/convert.h" #include "libyuv/convert_argb.h" @@ -19,7 +20,6 @@ #include "libyuv/cpu_id.h" #include "libyuv/planar_functions.h" #include "libyuv/rotate.h" -#include "../unit_test/unit_test.h" namespace libyuv { |