Bug 1346291: Update libyuv to upstream 98a0a157dcf5dee0882b2dfcc9578ab1f44afb12 rs=jib,sotaro
authorRandell Jesup <rjesup@jesup.org>
Wed, 09 May 2018 23:59:16 -0400
changeset 417697 7f2b06896dfd3ff141251d365cf72c49edeac9c3
parent 417696 738b40299efa52cec742647002f4a8737c3e1397
child 417698 1feb2371c435c5928e8c7b0abcc1a695b4ef4b60
push id33977
push userncsoregi@mozilla.com
push dateThu, 10 May 2018 16:43:24 +0000
treeherdermozilla-central@17db33b6a124 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjib, sotaro
bugs1346291
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1346291: Update libyuv to upstream 98a0a157dcf5dee0882b2dfcc9578ab1f44afb12 rs=jib,sotaro
media/libyuv/README_MOZILLA
media/libyuv/libyuv/.gn
media/libyuv/libyuv/.vpython
media/libyuv/libyuv/Android.bp
media/libyuv/libyuv/Android.mk
media/libyuv/libyuv/BUILD.gn
media/libyuv/libyuv/CMakeLists.txt
media/libyuv/libyuv/DEPS
media/libyuv/libyuv/OWNERS
media/libyuv/libyuv/README.chromium
media/libyuv/libyuv/README.md
media/libyuv/libyuv/build_overrides/build.gni
media/libyuv/libyuv/cleanup_links.py
media/libyuv/libyuv/docs/deprecated_builds.md
media/libyuv/libyuv/docs/environment_variables.md
media/libyuv/libyuv/docs/formats.md
media/libyuv/libyuv/docs/getting_started.md
media/libyuv/libyuv/gyp_libyuv
media/libyuv/libyuv/include/libyuv/basic_types.h
media/libyuv/libyuv/include/libyuv/compare.h
media/libyuv/libyuv/include/libyuv/compare_row.h
media/libyuv/libyuv/include/libyuv/convert.h
media/libyuv/libyuv/include/libyuv/convert_argb.h
media/libyuv/libyuv/include/libyuv/convert_from.h
media/libyuv/libyuv/include/libyuv/convert_from_argb.h
media/libyuv/libyuv/include/libyuv/cpu_id.h
media/libyuv/libyuv/include/libyuv/macros_msa.h
media/libyuv/libyuv/include/libyuv/mjpeg_decoder.h
media/libyuv/libyuv/include/libyuv/planar_functions.h
media/libyuv/libyuv/include/libyuv/rotate.h
media/libyuv/libyuv/include/libyuv/rotate_argb.h
media/libyuv/libyuv/include/libyuv/rotate_row.h
media/libyuv/libyuv/include/libyuv/row.h
media/libyuv/libyuv/include/libyuv/scale.h
media/libyuv/libyuv/include/libyuv/scale_argb.h
media/libyuv/libyuv/include/libyuv/scale_row.h
media/libyuv/libyuv/include/libyuv/version.h
media/libyuv/libyuv/include/libyuv/video_common.h
media/libyuv/libyuv/infra/config/OWNERS
media/libyuv/libyuv/infra/config/cq.cfg
media/libyuv/libyuv/libyuv.gyp
media/libyuv/libyuv/libyuv.gypi
media/libyuv/libyuv/libyuv_test.gyp
media/libyuv/libyuv/linux.mk
media/libyuv/libyuv/source/compare.cc
media/libyuv/libyuv/source/compare_common.cc
media/libyuv/libyuv/source/compare_gcc.cc
media/libyuv/libyuv/source/compare_msa.cc
media/libyuv/libyuv/source/compare_neon.cc
media/libyuv/libyuv/source/compare_neon64.cc
media/libyuv/libyuv/source/compare_win.cc
media/libyuv/libyuv/source/convert.cc
media/libyuv/libyuv/source/convert_argb.cc
media/libyuv/libyuv/source/convert_argb.cc.orig
media/libyuv/libyuv/source/convert_from.cc
media/libyuv/libyuv/source/convert_from_argb.cc
media/libyuv/libyuv/source/convert_jpeg.cc
media/libyuv/libyuv/source/convert_to_argb.cc
media/libyuv/libyuv/source/convert_to_i420.cc
media/libyuv/libyuv/source/cpu_id.cc
media/libyuv/libyuv/source/mjpeg_decoder.cc
media/libyuv/libyuv/source/mjpeg_validate.cc
media/libyuv/libyuv/source/planar_functions.cc
media/libyuv/libyuv/source/rotate.cc
media/libyuv/libyuv/source/rotate_any.cc
media/libyuv/libyuv/source/rotate_argb.cc
media/libyuv/libyuv/source/rotate_common.cc
media/libyuv/libyuv/source/rotate_dspr2.cc
media/libyuv/libyuv/source/rotate_gcc.cc
media/libyuv/libyuv/source/rotate_msa.cc
media/libyuv/libyuv/source/rotate_neon.cc
media/libyuv/libyuv/source/rotate_neon64.cc
media/libyuv/libyuv/source/rotate_win.cc
media/libyuv/libyuv/source/row_any.cc
media/libyuv/libyuv/source/row_common.cc
media/libyuv/libyuv/source/row_dspr2.cc
media/libyuv/libyuv/source/row_gcc.cc
media/libyuv/libyuv/source/row_msa.cc
media/libyuv/libyuv/source/row_neon.cc
media/libyuv/libyuv/source/row_neon64.cc
media/libyuv/libyuv/source/row_win.cc
media/libyuv/libyuv/source/scale.cc
media/libyuv/libyuv/source/scale_any.cc
media/libyuv/libyuv/source/scale_argb.cc
media/libyuv/libyuv/source/scale_common.cc
media/libyuv/libyuv/source/scale_dspr2.cc
media/libyuv/libyuv/source/scale_gcc.cc
media/libyuv/libyuv/source/scale_msa.cc
media/libyuv/libyuv/source/scale_neon.cc
media/libyuv/libyuv/source/scale_neon64.cc
media/libyuv/libyuv/source/scale_win.cc
media/libyuv/libyuv/source/video_common.cc
media/libyuv/libyuv/tools_libyuv/OWNERS
media/libyuv/libyuv/tools_libyuv/autoroller/roll_deps.py
media/libyuv/libyuv/tools_libyuv/autoroller/unittests/roll_deps_test.py
media/libyuv/libyuv/tools_libyuv/get_landmines.py
media/libyuv/libyuv/tools_libyuv/msan/OWNERS
media/libyuv/libyuv/tools_libyuv/ubsan/OWNERS
media/libyuv/libyuv/tools_libyuv/ubsan/vptr_blacklist.txt
media/libyuv/libyuv/tools_libyuv/valgrind/chrome_tests.bat
media/libyuv/libyuv/tools_libyuv/valgrind/chrome_tests.py
media/libyuv/libyuv/tools_libyuv/valgrind/chrome_tests.sh
media/libyuv/libyuv/tools_libyuv/valgrind/common.py
media/libyuv/libyuv/tools_libyuv/valgrind/gdb_helper.py
media/libyuv/libyuv/tools_libyuv/valgrind/libyuv_tests.py
media/libyuv/libyuv/tools_libyuv/valgrind/libyuv_tests.sh
media/libyuv/libyuv/tools_libyuv/valgrind/locate_valgrind.sh
media/libyuv/libyuv/tools_libyuv/valgrind/memcheck/suppressions.txt
media/libyuv/libyuv/tools_libyuv/valgrind/memcheck_analyze.py
media/libyuv/libyuv/tools_libyuv/valgrind/valgrind.sh
media/libyuv/libyuv/tools_libyuv/valgrind/valgrind_test.py
media/libyuv/libyuv/unit_test/basictypes_test.cc
media/libyuv/libyuv/unit_test/color_test.cc
media/libyuv/libyuv/unit_test/compare_test.cc
media/libyuv/libyuv/unit_test/convert_test.cc
media/libyuv/libyuv/unit_test/cpu_test.cc
media/libyuv/libyuv/unit_test/cpu_thread_test.cc
media/libyuv/libyuv/unit_test/math_test.cc
media/libyuv/libyuv/unit_test/planar_test.cc
media/libyuv/libyuv/unit_test/scale_argb_test.cc
media/libyuv/libyuv/unit_test/scale_test.cc
media/libyuv/libyuv/unit_test/unit_test.cc
media/libyuv/libyuv/unit_test/unit_test.h
media/libyuv/libyuv/unit_test/video_common_test.cc
media/libyuv/libyuv/util/Makefile
media/libyuv/libyuv/util/compare.cc
media/libyuv/libyuv/util/convert.cc
media/libyuv/libyuv/util/cpuid.c
media/libyuv/libyuv/util/psnr.cc
media/libyuv/libyuv/util/psnr.h
media/libyuv/libyuv/util/psnr_main.cc
media/libyuv/libyuv/util/ssim.cc
media/libyuv/libyuv/util/ssim.h
media/libyuv/libyuv/util/yuvconvert.cc
--- a/media/libyuv/README_MOZILLA
+++ b/media/libyuv/README_MOZILLA
@@ -4,9 +4,9 @@ The source in this directory was copied 
 update.py script from media/libyuv. Any changes made relative to upstream
 should be reflected in that script, e.g. by applying patch files after the
 copy step.
 
 The upstream repository is https://chromium.googlesource.com/libyuv/libyuv
 Updates before this file was added were done manually; the last import was
 r1602 (svn).
 
-The git commit ID last used to import was 054ec37f8e31e6131c8f19eb74395d29009d6604 (2017-02-21 23:59:57)
+The git commit ID last used to import was 98a0a157dcf5dee0882b2dfcc9578ab1f44afb12 (2018-03-02 19:09:38)
--- a/media/libyuv/libyuv/.gn
+++ b/media/libyuv/libyuv/.gn
@@ -1,16 +1,18 @@
 # Copyright 2015 The LibYuv 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
 # be found in the AUTHORS file in the root of the source tree.
 
+import("//build/dotfile_settings.gni")
+
 # The location of the build configuration file.
 buildconfig = "//build/config/BUILDCONFIG.gn"
 
 # The secondary source root is a parallel directory tree where
 # GN build files are placed when they can not be placed directly
 # in the source tree, e.g. for third party source trees.
 secondary_source = "//build/secondary/"
 
@@ -18,32 +20,20 @@ secondary_source = "//build/secondary/"
 # matching these patterns (see "gn help label_pattern" for format) will have
 # their includes checked for proper dependencies when you run either
 # "gn check" or "gn gen --check".
 check_targets = [ "//libyuv/*" ]
 
 # These are the list of GN files that run exec_script. This whitelist exists
 # to force additional review for new uses of exec_script, which is strongly
 # discouraged except for gypi_to_gn calls.
-exec_script_whitelist = [
-  "//build/config/android/BUILD.gn",
-  "//build/config/android/config.gni",
-  "//build/config/android/internal_rules.gni",
-  "//build/config/android/rules.gni",
-  "//build/config/BUILD.gn",
-  "//build/config/compiler/BUILD.gn",
-  "//build/config/gcc/gcc_version.gni",
-  "//build/config/ios/ios_sdk.gni",
-  "//build/config/linux/BUILD.gn",
-  "//build/config/linux/pkg_config.gni",
-  "//build/config/mac/mac_sdk.gni",
-  "//build/config/posix/BUILD.gn",
-  "//build/config/sysroot.gni",
-  "//build/config/win/BUILD.gn",
-  "//build/config/win/visual_studio_version.gni",
-  "//build/gn_helpers.py",
-  "//build/gypi_to_gn.py",
-  "//build/toolchain/concurrent_links.gni",
-  "//build/toolchain/gcc_toolchain.gni",
-  "//build/toolchain/mac/BUILD.gn",
-  "//build/toolchain/win/BUILD.gn",
-]
+exec_script_whitelist = build_dotfile_settings.exec_script_whitelist +
+                        [ "//build_overrides/build.gni" ]
+
+default_args = {
+  mac_sdk_min = "10.11"
 
+  # LibYUV does not want to switch to C++14 yet.
+  use_cxx11 = true
+
+  # LibYUV relies on Chromium's Android test infrastructure.
+  use_cxx11_on_android = false
+}
new file mode 100644
--- /dev/null
+++ b/media/libyuv/libyuv/.vpython
@@ -0,0 +1,32 @@
+# This is a vpython "spec" file.
+#
+# It describes patterns for python wheel dependencies of the python scripts in
+# the chromium repo, particularly for dependencies that have compiled components
+# (since pure-python dependencies can be easily vendored into third_party).
+#
+# When vpython is invoked, it finds this file and builds a python VirtualEnv,
+# containing all of the dependencies described in this file, fetching them from
+# CIPD (the "Chrome Infrastructure Package Deployer" service). Unlike `pip`,
+# this never requires the end-user machine to have a working python extension
+# compilation environment. All of these packages are built using:
+#   https://chromium.googlesource.com/infra/infra/+/master/infra/tools/dockerbuild/
+#
+# All python scripts in the repo share this same spec, to avoid dependency
+# fragmentation.
+#
+# If you have depot_tools installed in your $PATH, you can invoke python scripts
+# in this repo by running them as you normally would run them, except
+# substituting `vpython` instead of `python` on the command line, e.g.:
+#   vpython path/to/script.py some --arguments
+#
+# Read more about `vpython` and how to modify this file here:
+#   https://chromium.googlesource.com/infra/infra/+/master/doc/users/vpython.md
+
+python_version: "2.7"
+
+# Used by:
+#   third_party/catapult
+wheel: <
+  name: "infra/python/wheels/psutil/${platform}_${py_python}_${py_abi}"
+  version: "version:5.2.2"
+>
new file mode 100644
--- /dev/null
+++ b/media/libyuv/libyuv/Android.bp
@@ -0,0 +1,132 @@
+cc_library {
+    name: "libyuv",
+    vendor_available: true,
+    vndk: {
+        enabled: true,
+    },
+
+    srcs: [
+        "source/compare.cc",
+        "source/compare_common.cc",
+        "source/compare_gcc.cc",
+        "source/compare_neon.cc",
+        "source/compare_neon64.cc",
+        "source/compare_msa.cc",
+        "source/convert.cc",
+        "source/convert_argb.cc",
+        "source/convert_from.cc",
+        "source/convert_from_argb.cc",
+        "source/convert_to_argb.cc",
+        "source/convert_to_i420.cc",
+        "source/cpu_id.cc",
+        "source/planar_functions.cc",
+        "source/rotate.cc",
+        "source/rotate_any.cc",
+        "source/rotate_argb.cc",
+        "source/rotate_common.cc",
+        "source/rotate_gcc.cc",
+        "source/rotate_msa.cc",
+        "source/rotate_neon.cc",
+        "source/rotate_neon64.cc",
+        "source/row_any.cc",
+        "source/row_common.cc",
+        "source/row_gcc.cc",
+        "source/row_msa.cc",
+        "source/row_neon.cc",
+        "source/row_neon64.cc",
+        "source/scale.cc",
+        "source/scale_any.cc",
+        "source/scale_argb.cc",
+        "source/scale_common.cc",
+        "source/scale_gcc.cc",
+        "source/scale_msa.cc",
+        "source/scale_neon.cc",
+        "source/scale_neon64.cc",
+        "source/video_common.cc",
+
+        "source/convert_jpeg.cc",
+        "source/mjpeg_decoder.cc",
+        "source/mjpeg_validate.cc",
+    ],
+
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+        "-fexceptions",
+        "-DHAVE_JPEG",
+    ],
+
+    shared_libs: ["libjpeg"],
+
+    export_include_dirs: ["include"],
+}
+
+// compatibilty static library until all uses of libyuv_static are replaced
+// with libyuv (b/37646797)
+cc_library_static {
+    name: "libyuv_static",
+    whole_static_libs: ["libyuv"],
+}
+
+cc_test {
+    name: "libyuv_unittest",
+    static_libs: ["libyuv"],
+    shared_libs: ["libjpeg"],
+    cflags: ["-Wall", "-Werror"],
+    srcs: [
+        "unit_test/unit_test.cc",
+        "unit_test/basictypes_test.cc",
+        "unit_test/color_test.cc",
+        "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",
+        "unit_test/rotate_test.cc",
+        "unit_test/scale_argb_test.cc",
+        "unit_test/scale_test.cc",
+        "unit_test/video_common_test.cc",
+    ],
+}
+
+cc_test {
+    name: "compare",
+    gtest: false,
+    srcs: [
+        "util/compare.cc",
+    ],
+    static_libs: ["libyuv"],
+}
+
+cc_test {
+    name: "cpuid",
+    gtest: false,
+    srcs: [
+        "util/cpuid.c",
+    ],
+    static_libs: ["libyuv"],
+}
+
+cc_test {
+    name: "psnr",
+    gtest: false,
+    srcs: [
+        "util/psnr_main.cc",
+        "util/psnr.cc",
+        "util/ssim.cc",
+    ],
+    static_libs: ["libyuv"],
+}
+
+cc_test {
+    name: "yuvconvert",
+    gtest: false,
+    srcs: [
+        "util/yuvconvert.cc",
+    ],
+    static_libs: ["libyuv"],
+    shared_libs: ["libjpeg"],
+}
--- a/media/libyuv/libyuv/Android.mk
+++ b/media/libyuv/libyuv/Android.mk
@@ -1,70 +1,100 @@
-# This is the Android makefile for libyuv for both platform and NDK.
+# This is the Android makefile for libyuv for NDK.
 LOCAL_PATH:= $(call my-dir)
 
 include $(CLEAR_VARS)
 
 LOCAL_CPP_EXTENSION := .cc
 
 LOCAL_SRC_FILES := \
     source/compare.cc           \
     source/compare_common.cc    \
     source/compare_gcc.cc       \
+    source/compare_msa.cc       \
     source/compare_neon.cc      \
     source/compare_neon64.cc    \
     source/convert.cc           \
     source/convert_argb.cc      \
     source/convert_from.cc      \
     source/convert_from_argb.cc \
-    source/convert_jpeg.cc      \
     source/convert_to_argb.cc   \
     source/convert_to_i420.cc   \
     source/cpu_id.cc            \
-    source/mjpeg_decoder.cc     \
-    source/mjpeg_validate.cc    \
     source/planar_functions.cc  \
     source/rotate.cc            \
     source/rotate_any.cc        \
     source/rotate_argb.cc       \
     source/rotate_common.cc     \
-    source/rotate_dspr2.cc      \
     source/rotate_gcc.cc        \
     source/rotate_msa.cc        \
     source/rotate_neon.cc       \
     source/rotate_neon64.cc     \
     source/row_any.cc           \
     source/row_common.cc        \
-    source/row_dspr2.cc         \
     source/row_gcc.cc           \
     source/row_msa.cc           \
     source/row_neon.cc          \
     source/row_neon64.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_msa.cc         \
     source/scale_neon.cc        \
     source/scale_neon64.cc      \
     source/video_common.cc
 
-common_CFLAGS := -Wall -fexceptions -DHAVE_JPEG -Wno-unused-parameter
+common_CFLAGS := -Wall -fexceptions
+ifneq ($(LIBYUV_DISABLE_JPEG), "yes")
+LOCAL_SRC_FILES += \
+    source/convert_jpeg.cc      \
+    source/mjpeg_decoder.cc     \
+    source/mjpeg_validate.cc
+common_CFLAGS += -DHAVE_JPEG
+LOCAL_SHARED_LIBRARIES := libjpeg
+endif
+
 LOCAL_CFLAGS += $(common_CFLAGS)
-LOCAL_SHARED_LIBRARIES := libjpeg
 LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
 LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
 LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
 
 LOCAL_MODULE := libyuv_static
 LOCAL_MODULE_TAGS := optional
 
 include $(BUILD_STATIC_LIBRARY)
 
 include $(CLEAR_VARS)
 
 LOCAL_WHOLE_STATIC_LIBRARIES := libyuv_static
 LOCAL_MODULE := libyuv
+ifneq ($(LIBYUV_DISABLE_JPEG), "yes")
 LOCAL_SHARED_LIBRARIES := libjpeg
+endif
 
 include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_STATIC_LIBRARIES := libyuv_static
+LOCAL_SHARED_LIBRARIES := libjpeg
+LOCAL_MODULE_TAGS := tests
+LOCAL_CPP_EXTENSION := .cc
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
+LOCAL_SRC_FILES := \
+    unit_test/unit_test.cc        \
+    unit_test/basictypes_test.cc  \
+    unit_test/color_test.cc       \
+    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 \
+    unit_test/rotate_test.cc      \
+    unit_test/scale_argb_test.cc  \
+    unit_test/scale_test.cc       \
+    unit_test/video_common_test.cc
+
+LOCAL_MODULE := libyuv_unittest
+include $(BUILD_NATIVE_TEST)
--- a/media/libyuv/libyuv/BUILD.gn
+++ b/media/libyuv/libyuv/BUILD.gn
@@ -4,44 +4,87 @@
 # 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
 # be found in the AUTHORS file in the root of the source tree.
 
 import("libyuv.gni")
 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") {
   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") {
     ldflags = [ "-Wl,--dynamic-linker,/system/bin/linker" ]
   }
 }
 
 # This target is built when no specific target is specified on the command line.
 group("default") {
   testonly = true
   deps = [
     ":libyuv",
   ]
   if (libyuv_include_tests) {
     deps += [
       ":compare",
-      ":convert",
       ":cpuid",
       ":libyuv_unittest",
       ":psnr",
+      ":yuvconvert",
     ]
   }
 }
 
-static_library("libyuv") {
+group("libyuv") {
+  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:win_clang_x64)",
+    ]
+  } else {
+    public_deps = [
+      ":libyuv_internal",
+    ]
+  }
+
+  if (libyuv_use_neon) {
+    deps += [ ":libyuv_neon" ]
+  }
+
+  if (libyuv_use_msa) {
+    deps += [ ":libyuv_msa" ]
+  }
+
+  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",
     "include/libyuv/basic_types.h",
     "include/libyuv/compare.h",
     "include/libyuv/convert.h",
     "include/libyuv/convert_argb.h",
     "include/libyuv/convert_from.h",
@@ -74,164 +117,184 @@ static_library("libyuv") {
     "source/cpu_id.cc",
     "source/mjpeg_decoder.cc",
     "source/mjpeg_validate.cc",
     "source/planar_functions.cc",
     "source/rotate.cc",
     "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",
   ]
 
-  public_configs = [ ":libyuv_config" ]
-
+  configs += [ ":libyuv_config" ]
   defines = []
   deps = []
 
+  if (libyuv_symbols_visible) {
+    configs -= [ "//build/config/gcc:symbol_visibility_hidden" ]
+    configs += [ "//build/config/gcc:symbol_visibility_default" ]
+  }
+
   if (!is_ios) {
     defines += [ "HAVE_JPEG" ]
-    deps += [ "//third_party:jpeg" ]
-  }
 
-  if (libyuv_use_neon) {
-    deps += [ ":libyuv_neon" ]
-  }
-
-  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
   # 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 (!is_win) {
+    cflags = [
+      # "-mpopcnt",
+      # "-mavx2",
+      # "-mfma",
+      "-ffp-contract=fast",  # Enable fma vectorization for NEON.
+    ]
+  }
 }
 
 if (libyuv_use_neon) {
   static_library("libyuv_neon") {
     sources = [
       # ARM Source Files
       "source/compare_neon.cc",
       "source/compare_neon64.cc",
       "source/rotate_neon.cc",
       "source/rotate_neon64.cc",
       "source/row_neon.cc",
       "source/row_neon64.cc",
       "source/scale_neon.cc",
       "source/scale_neon64.cc",
     ]
 
+    deps = [
+      ":libyuv_internal",
+    ]
+
     public_configs = [ ":libyuv_config" ]
 
     # Always enable optimization for Release and NaCl builds (to workaround
     # crbug.com/538243).
     if (!is_debug) {
       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" ]
     }
 
     if (current_cpu != "arm64") {
       configs -= [ "//build/config/compiler:compiler_arm_fpu" ]
       cflags = [ "-mfpu=neon" ]
     }
   }
 }
 
 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",
-      "source/rotate_msa.cc",
+    ]
+
+    deps = [
+      ":libyuv_internal",
     ]
 
     public_configs = [ ":libyuv_config" ]
   }
 }
 
 if (libyuv_include_tests) {
   config("libyuv_unittest_warnings_config") {
     if (!is_win) {
       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
       ]
     }
   }
   config("libyuv_unittest_config") {
     defines = [ "GTEST_RELATIVE_PATH" ]
   }
 
   test("libyuv_unittest") {
     testonly = true
 
     sources = [
+      # sources
       # headers
-      "unit_test/unit_test.h",
-      # sources
       "unit_test/basictypes_test.cc",
+      "unit_test/color_test.cc",
       "unit_test/compare_test.cc",
-      "unit_test/color_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",
       "unit_test/rotate_test.cc",
       "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",
     ]
 
     deps = [
       ":libyuv",
       "//testing/gtest",
-      "//third_party/gflags",
     ]
 
+    defines = []
+    if (libyuv_use_gflags) {
+      defines += [ "LIBYUV_USE_GFLAGS" ]
+      deps += [ "//third_party/gflags" ]
+    }
+
     configs += [ ":libyuv_unittest_warnings_config" ]
 
-    public_deps = [ "//testing/gtest" ]
+    public_deps = [
+      "//testing/gtest",
+    ]
     public_configs = [ ":libyuv_unittest_config" ]
 
-    defines = []
-
     if (is_linux) {
       cflags = [ "-fexceptions" ]
     }
     if (is_ios) {
       configs -= [ "//build/config/compiler:default_symbols" ]
       configs += [ "//build/config/compiler:symbols" ]
       cflags = [ "-Wno-sometimes-uninitialized" ]
     }
@@ -239,68 +302,79 @@ if (libyuv_include_tests) {
       defines += [ "HAVE_JPEG" ]
     }
     if (is_android) {
       deps += [ "//testing/android/native_test:native_test_native_code" ]
     }
 
     # 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" ]
     }
 
     defines += [
       # 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"
     ]
   }
 
   executable("compare") {
     sources = [
       # sources
-      "util/compare.cc"
+      "util/compare.cc",
     ]
-    deps = [ ":libyuv" ]
+    deps = [
+      ":libyuv",
+      "//build/config:exe_and_shlib_deps",  # for asan on llvm libc++
+    ]
     if (is_linux) {
       cflags = [ "-fexceptions" ]
     }
   }
 
-  executable("convert") {
+  executable("yuvconvert") {
     sources = [
       # sources
-      "util/convert.cc"
+      "util/yuvconvert.cc",
     ]
-    deps = [ ":libyuv" ]
+    deps = [
+      ":libyuv",
+      "//build/config:exe_and_shlib_deps",  # for new[] on llvm libc++
+    ]
     if (is_linux) {
       cflags = [ "-fexceptions" ]
     }
   }
 
   executable("psnr") {
     sources = [
       # sources
+      "util/psnr.cc",
       "util/psnr_main.cc",
-      "util/psnr.cc",
-      "util/ssim.cc"
+      "util/ssim.cc",
     ]
-    deps = [ ":libyuv" ]
+    deps = [
+      ":libyuv",
+      "//build/config:exe_and_shlib_deps",  # for new[] on llvm libc++
+    ]
 
     if (!is_ios && !libyuv_disable_jpeg) {
       defines = [ "HAVE_JPEG" ]
     }
   }
 
   executable("cpuid") {
     sources = [
       # sources
-      "util/cpuid.c"
+      "util/cpuid.c",
     ]
-    deps = [ ":libyuv" ]
+    deps = [
+      ":libyuv",
+      "//build/config:exe_and_shlib_deps",  # for asan on llvm libc++
+    ]
   }
 }
--- a/media/libyuv/libyuv/CMakeLists.txt
+++ b/media/libyuv/libyuv/CMakeLists.txt
@@ -26,24 +26,24 @@ INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir
 ADD_LIBRARY				( ${ly_lib_static} STATIC ${ly_source_files} )
 
 # this creates the shared library (.so)
 ADD_LIBRARY				( ${ly_lib_shared} SHARED ${ly_source_files} )
 SET_TARGET_PROPERTIES	( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" )
 SET_TARGET_PROPERTIES	( ${ly_lib_shared} PROPERTIES PREFIX "lib" )
 
 # this creates the conversion tool
-ADD_EXECUTABLE			( convert ${ly_base_dir}/util/convert.cc )
-TARGET_LINK_LIBRARIES	( convert ${ly_lib_static} )
+ADD_EXECUTABLE			( yuvconvert ${ly_base_dir}/util/yuvconvert.cc )
+TARGET_LINK_LIBRARIES	( yuvconvert ${ly_lib_static} )
 
 
 INCLUDE ( FindJPEG )
 if (JPEG_FOUND)
   include_directories( ${JPEG_INCLUDE_DIR} )
-  target_link_libraries( convert ${JPEG_LIBRARY} )
+  target_link_libraries( yuvconvert ${JPEG_LIBRARY} )
   add_definitions( -DHAVE_JPEG )
 endif()
 
 if(TEST)
   find_library(GTEST_LIBRARY gtest)
   if(GTEST_LIBRARY STREQUAL "GTEST_LIBRARY-NOTFOUND")
     set(GTEST_SRC_DIR /usr/src/gtest CACHE STRING "Location of gtest sources")
     if(EXISTS ${GTEST_SRC_DIR}/src/gtest-all.cc)
@@ -68,16 +68,16 @@ if(TEST)
     target_link_libraries(libyuv_unittest glibc-compat)
   endif()
 
   target_link_libraries(libyuv_unittest gflags)
 endif()
 
 
 # install the conversion tool, .so, .a, and all the header files
-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/convert			DESTINATION bin RENAME yuvconvert )
+INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert			DESTINATION bin )
 INSTALL ( TARGETS ${ly_lib_static}						DESTINATION lib )
 INSTALL ( TARGETS ${ly_lib_shared} LIBRARY				DESTINATION lib )
 INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/		DESTINATION include )
 
 # create the .deb and .rpm packages using cpack
 INCLUDE ( CM_linux_packages.cmake )
 
--- a/media/libyuv/libyuv/DEPS
+++ b/media/libyuv/libyuv/DEPS
@@ -1,453 +1,358 @@
 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': '80f0c5570649c35a869429b2ab8c381a0a7246cb',
+  'swarming_revision': '88229872dd17e71658fe96763feaa77915d8cbd6',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling lss
   # and whatever else without interference from each other.
-  'lss_revision': '3f6478ac95edf86cd3da300c2c0d34a438f5dbeb',
+  'lss_revision': 'e6527b0cd469e3ff5764785dadcb39bf7d787154',
   # 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': 'e7298f36f7912f2caa122086cfbe71734d04b73f',
 }
 
 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':
-    Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + '6f8a66431cb592dad629028a50b3dd418a408c87',
-  Var('root_dir') + '/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':
-   Var('chromium_git') + '/external/github.com/catapult-project/catapult.git' + '@' + Var('catapult_revision'),
-  Var('root_dir') + '/third_party/colorama/src':
+  'src/build':
+    Var('chromium_git') + '/chromium/src/build' + '@' + '39738e75b27f39d4c0030a0b11d5d2ddd34715f7',
+  'src/buildtools':
+    Var('chromium_git') + '/chromium/buildtools.git' + '@' + 'a09e064635a49f08e585e3b173d5fbc3dd3f485e',
+  'src/testing':
+    Var('chromium_git') + '/chromium/src/testing' + '@' + '5f7e36cad6434fd3d65674af96653a23ecc9f694',
+  'src/third_party':
+    Var('chromium_git') + '/chromium/src/third_party' + '@' + '2c0ced3ddbf84ce1c0759b277d9538da42f23650',
+  'src/third_party/catapult':
+    Var('chromium_git') + '/catapult.git' + '@' + Var('catapult_revision'),
+  'src/third_party/colorama/src':
     Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8',
-  Var('root_dir') + '/third_party/libjpeg_turbo':
-    Var('chromium_git') + '/chromium/deps/libjpeg_turbo.git' + '@' + '7260e4d8b8e1e40b17f03fafdf1cd83296900f76',
-  Var('root_dir') + '/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':
-    Var('chromium_git') + '/external/gyp.git' + '@' + 'e7079f0e0e14108ab0dba58728ff219637458563',
-   Var('root_dir') + '/tools/swarming_client':
-     Var('chromium_git') + '/external/swarming.client.git' + '@' +  Var('swarming_revision'),
+  'src/third_party/googletest/src':
+    Var('chromium_git') + '/external/github.com/google/googletest.git' + '@' + '0062e4869f07a3ef235703ddf63af604b712446c',
+  'src/third_party/libjpeg_turbo':
+    Var('chromium_git') + '/chromium/deps/libjpeg_turbo.git' + '@' + 'a1750dbc79a8792dde3d3f7d7d8ac28ba01ac9dd',
+  'src/third_party/yasm/source/patched-yasm':
+    Var('chromium_git') + '/chromium/deps/yasm/patched-yasm.git' + '@' + 'b98114e18d8b9b84586b10d24353ab8616d4c5fc',
+  'src/tools':
+    Var('chromium_git') + '/chromium/src/tools' + '@' + '6202b67fc46a9984097caf237e12e3b8f7a9f7da',
+  'src/tools/gyp':
+    Var('chromium_git') + '/external/gyp.git' + '@' + 'd61a9397e668fa9843c4aa7da9e79460fe590bfb',
+   'src/tools/swarming_client':
+     Var('chromium_git') + '/infra/luci/client-py.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',
+
+  'src/third_party/lss': {
+    'url': Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'),
+    'condition': 'checkout_android or checkout_linux',
+  },
 
-deps_os = {
-  'android': {
-    Var('root_dir') + '/base':
-      Var('chromium_git') + '/chromium/src/base' + '@' + 'b9d4d9b0e5373bbdb5403c68d51e7385d78a09d0',
-    Var('root_dir') + '/third_party/android_tools':
-      Var('chromium_git') + '/android_tools.git' + '@' + 'b43a6a289a7588b1769814f04dd6c7d7176974cc',
-    Var('root_dir') + '/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':
-      Var('chromium_git') + '/external/jsr-305.git' + '@' + '642c508235471f7220af6d5df2d3210e3bfc0919',
-    Var('root_dir') + '/third_party/junit/src':
-      Var('chromium_git') + '/external/junit.git' + '@' + '64155f8a9babcfcf4263cf4d08253a1556e75481',
-    Var('root_dir') + '/third_party/lss':
-      Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'),
-    Var('root_dir') + '/third_party/mockito/src':
-      Var('chromium_git') + '/external/mockito/mockito.git' + '@' + 'de83ad4598ad4cf5ea53c69a8a8053780b04b850',
-    Var('root_dir') + '/third_party/requests/src':
-      Var('chromium_git') + '/external/github.com/kennethreitz/requests.git' + '@' + 'f172b30356d821d180fa4ecfa3e71c7274a32de4',
-    Var('root_dir') + '/third_party/robolectric/robolectric':
-      Var('chromium_git') + '/external/robolectric.git' + '@' + 'e38b49a12fdfa17a94f0382cc8ffaf69132fd09b',
+  # Android deps:
+  'src/third_party/auto/src': {
+    'url': Var('chromium_git') + '/external/github.com/google/auto.git' + '@' + '8a81a858ae7b78a1aef71ac3905fade0bbd64e82',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/auto/src': {
+    'url': Var('chromium_git') + '/external/github.com/google/auto.git' + '@' + '8a81a858ae7b78a1aef71ac3905fade0bbd64e82',
+    'condition': 'checkout_android',
+  },
+  'src/base': {
+    'url': Var('chromium_git') + '/chromium/src/base' + '@' + 'ac3d2b81181b085a9952cb83dba748420eefe691',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/android_ndk': {
+    'url': Var('chromium_git') + '/android_ndk.git' + '@' + 'e951c37287c7d8cd915bf8d4149fd4a06d808b55',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/android_tools': {
+    'url': Var('chromium_git') + '/android_tools.git' + '@' + '9a70d48fcdd68cd0e7e968f342bd767ee6323bd1',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/ced/src': {
+    'url': Var('chromium_git') + '/external/github.com/google/compact_enc_det.git' + '@' + '94c367a1fe3a13207f4b22604fcfd1d9f9ddf6d9',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/errorprone/lib': {
+      'url': Var('chromium_git') + '/chromium/third_party/errorprone.git' + '@' + 'ecc57c2b00627667874744b9ad8efe10734d97a8',
+      'condition': 'checkout_android',
+  },
+  'src/third_party/findbugs': {
+    'url': Var('chromium_git') + '/chromium/deps/findbugs.git' + '@' + '4275d9ac8610db6b1bc9a5e887f97e41b33fac67',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/icu': {
+    'url': Var('chromium_git') + '/chromium/deps/icu.git' + '@' + 'd888fd2a1be890f4d35e43f68d6d79f42519a357',
   },
-  'ios': {
-    Var('root_dir') + '/ios':
-      Var('chromium_git') + '/chromium/src/ios' + '@' + '291daef6af7764f8475089c65808d52ee50b496e',
+  'src/third_party/jsr-305/src': {
+    'url': Var('chromium_git') + '/external/jsr-305.git' + '@' + '642c508235471f7220af6d5df2d3210e3bfc0919',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/junit/src': {
+    'url': Var('chromium_git') + '/external/junit.git' + '@' + '64155f8a9babcfcf4263cf4d08253a1556e75481',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/mockito/src': {
+    'url': Var('chromium_git') + '/external/mockito/mockito.git' + '@' + 'de83ad4598ad4cf5ea53c69a8a8053780b04b850',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/requests/src': {
+    'url': Var('chromium_git') + '/external/github.com/kennethreitz/requests.git' + '@' + 'f172b30356d821d180fa4ecfa3e71c7274a32de4',
+    'condition': 'checkout_android',
   },
-  'unix': {
-    Var('root_dir') + '/third_party/lss':
-      Var('chromium_git') + '/linux-syscall-support.git' + '@' + Var('lss_revision'),
+  'src/third_party/robolectric/robolectric': {
+    'url': Var('chromium_git') + '/external/robolectric.git' + '@' + '7e067f1112e1502caa742f7be72d37b5678d3403',
+    'condition': 'checkout_android',
+  },
+  'src/third_party/ub-uiautomator/lib': {
+    'url': Var('chromium_git') + '/chromium/third_party/ub-uiautomator.git' + '@' + '00270549ce3161ae72ceb24712618ea28b4f9434',
+    'condition': 'checkout_android',
   },
-  'win': {
-    # Dependencies used by libjpeg-turbo
-    Var('root_dir') + '/third_party/yasm/binaries':
-      Var('chromium_git') + '/chromium/deps/yasm/binaries.git' + '@' + '52f9b3f4b0aa06da24ef8b123058bb61ee468881',
+
+  # iOS deps:
+  'src/ios': {
+    'url': Var('chromium_git') + '/chromium/src/ios' + '@' + '299ef76e844a74a1f2f4ce7f06d101861fb49aba',
+    'condition': 'checkout_ios'
+  },
+
+  # Win deps:
+  # Dependencies used by libjpeg-turbo
+  'src/third_party/yasm/binaries': {
+    'url': Var('chromium_git') + '/chromium/deps/yasm/binaries.git' + '@' + '52f9b3f4b0aa06da24ef8b123058bb61ee468881',
+    'condition': 'checkout_win',
   },
 }
 
 # Define rules for which include paths are allowed in our source.
 include_rules = [ '+gflags' ]
 
 pre_deps_hooks = [
   {
     # Remove any symlinks from before 177567c518b121731e507e9b9c4049c4dc96e4c8.
     # 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'],
   },
 ]
 
 hooks = [
   {
     # This clobbers when necessary (based on get_landmines.py). It should be
     # an early hook but it will need to be run after syncing Chromium and
     # setting up the links, so the script actually exists.
     'name': 'landmines',
     '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',
+    ],
+  },
+  # Downloads the current stable linux sysroot to build/linux/ if needed.
+  {
+    'name': 'sysroot_arm',
+    'pattern': '.',
+    'condition': 'checkout_linux and checkout_arm',
+    'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py',
+               '--arch=arm'],
+  },
+  {
+    'name': 'sysroot_arm64',
+    'pattern': '.',
+    'condition': 'checkout_linux and checkout_arm64',
+    'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py',
+               '--arch=arm64'],
+  },
+  {
+    'name': 'sysroot_x86',
+    'pattern': '.',
+    'condition': 'checkout_linux and (checkout_x86 or checkout_x64)',
+    'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py',
+               '--arch=x86'],
+  },
+  {
+    'name': 'sysroot_mips',
+    'pattern': '.',
+    'condition': 'checkout_linux and checkout_mips',
+    'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py',
+               '--arch=mips'],
+  },
+  {
+    'name': 'sysroot_x64',
+    'pattern': '.',
+    'condition': 'checkout_linux and checkout_x64',
+    'action': ['python', 'src/build/linux/sysroot_scripts/install-sysroot.py',
+               '--arch=x64'],
+  },
+  {
+    # Update the Windows toolchain if necessary.
+    'name': 'win_toolchain',
+    'pattern': '.',
+    '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': 'src/third_party/binutils',
+    'action': [
+        'python',
+        'src/third_party/binutils/download.py',
+    ],
+  },
+  {
+    # Pull clang if needed or requested via GYP_DEFINES.
+    # Note: On Win, this should run after win_toolchain, as it may use it.
+    'name': 'clang',
+    'pattern': '.',
+    'action': ['python', 'src/tools/clang/scripts/update.py', '--if-needed'],
+  },
+  {
+    # Update LASTCHANGE.
+    'name': 'lastchange',
+    'pattern': '.',
+    'action': ['python', 'src/build/util/lastchange.py',
+               '-o', 'src/build/util/LASTCHANGE'],
+  },
+  # Pull GN binaries.
+  {
+    'name': 'gn_win',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=win32',
+                '--no_auth',
+                '--bucket', 'chromium-gn',
+                '-s', 'src/buildtools/win/gn.exe.sha1',
+    ],
+  },
+  {
+    'name': 'gn_mac',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=darwin',
+                '--no_auth',
+                '--bucket', 'chromium-gn',
+                '-s', 'src/buildtools/mac/gn.sha1',
+    ],
+  },
+  {
+    'name': 'gn_linux64',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=linux*',
+                '--no_auth',
+                '--bucket', 'chromium-gn',
+                '-s', 'src/buildtools/linux64/gn.sha1',
+    ],
+  },
+  # Pull clang-format binaries using checked-in hashes.
+  {
+    'name': 'clang_format_win',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=win32',
+                '--no_auth',
+                '--bucket', 'chromium-clang-format',
+                '-s', 'src/buildtools/win/clang-format.exe.sha1',
+    ],
+  },
+  {
+    'name': 'clang_format_mac',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=darwin',
+                '--no_auth',
+                '--bucket', 'chromium-clang-format',
+                '-s', 'src/buildtools/mac/clang-format.sha1',
+    ],
+  },
+  {
+    'name': 'clang_format_linux',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=linux*',
+                '--no_auth',
+                '--bucket', 'chromium-clang-format',
+                '-s', 'src/buildtools/linux64/clang-format.sha1',
+    ],
+  },
+  # Pull luci-go binaries (isolate, swarming) using checked-in hashes.
+  {
+    'name': 'luci-go_win',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=win32',
+                '--no_auth',
+                '--bucket', 'chromium-luci',
+                '-d', 'src/tools/luci-go/win64',
+    ],
+  },
+  {
+    'name': 'luci-go_mac',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=darwin',
+                '--no_auth',
+                '--bucket', 'chromium-luci',
+                '-d', 'src/tools/luci-go/mac64',
+    ],
+  },
+  {
+    'name': 'luci-go_linux',
+    'pattern': '.',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--platform=linux*',
+                '--no_auth',
+                '--bucket', 'chromium-luci',
+                '-d', 'src/tools/luci-go/linux64',
+    ],
+  },
+  {
+    'name': 'Android CIPD Ensure',
+    'pattern': '.',
+    'condition': 'checkout_android',
+    'action': ['src/build/cipd/cipd_wrapper.py',
+               '--chromium-root', 'src',
+               '--ensure-file', 'src/build/cipd/android/android.ensure',
     ],
   },
   # Android dependencies. Many are downloaded using Google Storage these days.
   # They're copied from https://cs.chromium.org/chromium/src/DEPS for all
   # such dependencies we share with Chromium.
   {
     # This downloads SDK extras and puts them in the
     # third_party/android_tools/sdk/extras directory.
     'name': 'sdkextras',
     'pattern': '.',
     # 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'
     ],
   },
-  {
-    'name': 'intellij',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-intellij',
-               '-l', 'third_party/intellij'
-    ],
-  },
-  {
-    'name': 'javax_inject',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-javax-inject',
-               '-l', 'third_party/javax_inject'
-    ],
-  },
-  {
-    'name': 'hamcrest',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-hamcrest',
-               '-l', 'third_party/hamcrest'
-    ],
-  },
-  {
-    'name': 'guava',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-guava',
-               '-l', 'third_party/guava'
-    ],
-  },
-  {
-    'name': 'android_support_test_runner',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-android-support-test-runner',
-               '-l', 'third_party/android_support_test_runner'
-    ],
-  },
-  {
-    'name': 'byte_buddy',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-byte-buddy',
-               '-l', 'third_party/byte_buddy'
-    ],
-  },
-  {
-    'name': 'espresso',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-espresso',
-               '-l', 'third_party/espresso'
-    ],
-  },
-  {
-    'name': 'robolectric_libs',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-robolectric',
-               '-l', 'third_party/robolectric'
-    ],
-  },
-  {
-    'name': 'apache_velocity',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-apache-velocity',
-               '-l', 'third_party/apache_velocity'
-    ],
-  },
-  {
-    'name': 'ow2_asm',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-ow2-asm',
-               '-l', 'third_party/ow2_asm'
-    ],
-  },
-  {
-    'name': 'icu4j',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-icu4j',
-               '-l', 'third_party/icu4j'
-    ],
-  },
-  {
-    'name': 'accessibility_test_framework',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-accessibility-test-framework',
-               '-l', 'third_party/accessibility_test_framework'
-    ],
-  },
-  {
-    'name': 'bouncycastle',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-bouncycastle',
-               '-l', 'third_party/bouncycastle'
-    ],
-  },
-  {
-    'name': 'sqlite4java',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-sqlite4java',
-               '-l', 'third_party/sqlite4java'
-    ],
-  },
-  {
-    'name': 'objenesis',
-    'pattern': '.',
-    'action': ['python',
-               Var('root_dir') + '/build/android/update_deps/update_third_party_deps.py',
-               'download',
-               '-b', 'chromium-objenesis',
-               '-l', 'third_party/objenesis'
-    ],
-  },
-  {
-    # Downloads the current stable linux sysroot to build/linux/ if needed.
-    # This sysroot updates at about the same rate that the chrome build deps
-    # change. This script is a no-op except for linux users who are doing
-    # official chrome builds or cross compiling.
-    'name': 'sysroot',
-    'pattern': '.',
-    'action': ['python', Var('root_dir') + '/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'],
-  },
-  # 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',
-    'action': [
-        'python',
-        Var('root_dir') + '/third_party/binutils/download.py',
-    ],
-  },
-  {
-    # Pull clang if needed or requested via GYP_DEFINES.
-    # 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'],
-  },
-  {
-    # Update LASTCHANGE.
-    'name': 'lastchange',
-    'pattern': '.',
-    'action': ['python', Var('root_dir') + '/build/util/lastchange.py',
-               '-o', Var('root_dir') + '/build/util/LASTCHANGE'],
-  },
-  # Pull GN binaries.
-  {
-    'name': 'gn_win',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=win32',
-                '--no_auth',
-                '--bucket', 'chromium-gn',
-                '-s', Var('root_dir') + '/buildtools/win/gn.exe.sha1',
-    ],
-  },
-  {
-    'name': 'gn_mac',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=darwin',
-                '--no_auth',
-                '--bucket', 'chromium-gn',
-                '-s', Var('root_dir') + '/buildtools/mac/gn.sha1',
-    ],
-  },
-  {
-    'name': 'gn_linux64',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=linux*',
-                '--no_auth',
-                '--bucket', 'chromium-gn',
-                '-s', Var('root_dir') + '/buildtools/linux64/gn.sha1',
-    ],
-  },
-  # Pull clang-format binaries using checked-in hashes.
-  {
-    'name': 'clang_format_win',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=win32',
-                '--no_auth',
-                '--bucket', 'chromium-clang-format',
-                '-s', Var('root_dir') + '/buildtools/win/clang-format.exe.sha1',
-    ],
-  },
-  {
-    'name': 'clang_format_mac',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=darwin',
-                '--no_auth',
-                '--bucket', 'chromium-clang-format',
-                '-s', Var('root_dir') + '/buildtools/mac/clang-format.sha1',
-    ],
-  },
-  {
-    'name': 'clang_format_linux',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=linux*',
-                '--no_auth',
-                '--bucket', 'chromium-clang-format',
-                '-s', Var('root_dir') + '/buildtools/linux64/clang-format.sha1',
-    ],
-  },
-  # Pull luci-go binaries (isolate, swarming) using checked-in hashes.
-  {
-    'name': 'luci-go_win',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=win32',
-                '--no_auth',
-                '--bucket', 'chromium-luci',
-                '-d', Var('root_dir') + '/tools/luci-go/win64',
-    ],
-  },
-  {
-    'name': 'luci-go_mac',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=darwin',
-                '--no_auth',
-                '--bucket', 'chromium-luci',
-                '-d', Var('root_dir') + '/tools/luci-go/mac64',
-    ],
-  },
-  {
-    'name': 'luci-go_linux',
-    'pattern': '.',
-    'action': [ 'download_from_google_storage',
-                '--no_resume',
-                '--platform=linux*',
-                '--no_auth',
-                '--bucket', 'chromium-luci',
-                '-d', Var('root_dir') + '/tools/luci-go/linux64',
-    ],
-  },
-  {
-    # Pull sanitizer-instrumented third-party libraries if requested via
-    # GYP_DEFINES.
-    # See src/third_party/instrumented_libraries/scripts/download_binaries.py.
-    # 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'],
-  },
-  {
-    'name': 'clang_format_merge_driver',
-    'pattern': '.',
-    'action': [ 'python',
-                Var('root_dir') + '/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',
 ]
--- a/media/libyuv/libyuv/OWNERS
+++ b/media/libyuv/libyuv/OWNERS
@@ -1,13 +1,8 @@
 fbarchard@chromium.org
 magjed@chromium.org
-torbjorng@chromium.org
 
-per-file *.gyp=kjellander@chromium.org
-per-file *.gn=kjellander@chromium.org
+per-file *.gn=phoglund@chromium.org
 per-file .gitignore=*
 per-file AUTHORS=*
 per-file DEPS=*
-per-file PRESUBMIT.py=kjellander@chromium.org
-per-file gyp_libyuv.py=kjellander@chromium.org
-per-file setup_links.py=*
-per-file sync_chromium.py=kjellander@chromium.org
+per-file PRESUBMIT.py=phoglund@chromium.org
--- a/media/libyuv/libyuv/README.chromium
+++ b/media/libyuv/libyuv/README.chromium
@@ -1,8 +1,8 @@
 Name: libyuv
 URL: http://code.google.com/p/libyuv/
-Version: 1644
+Version: 1703
 License: BSD
 License File: LICENSE
 
 Description:
 libyuv is an open source project that includes YUV conversion and scaling functionality.
--- a/media/libyuv/libyuv/README.md
+++ b/media/libyuv/libyuv/README.md
@@ -1,17 +1,17 @@
 **libyuv** is an open source project that includes YUV scaling and conversion functionality.
 
 * Scale YUV to prepare content for compression, with point, bilinear or box filter.
-* Convert to YUV from webcam formats.
-* Convert from YUV to formats for rendering/effects.
+* Convert to YUV from webcam formats for compression.
+* Convert to RGB formats for rendering/effects.
 * Rotate by 90/180/270 degrees to adjust for mobile devices in portrait mode.
-* Optimized for SSE2/SSSE3/AVX2 on x86/x64.
+* Optimized for SSSE3/AVX2 on x86/x64.
 * Optimized for Neon on Arm.
-* Optimized for DSP R2 on Mips.
+* Optimized for MSA on Mips.
 
 ### Development
 
 See [Getting started] [1] for instructions on how to get started developing.
 
 You can also browse the [docs directory] [2] for more documentation.
 
 [1]: https://chromium.googlesource.com/libyuv/libyuv/+/master/docs/getting_started.md
--- a/media/libyuv/libyuv/build_overrides/build.gni
+++ b/media/libyuv/libyuv/build_overrides/build.gni
@@ -1,24 +1,16 @@
 # Copyright 2016 The LibYuv 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
 # be found in the AUTHORS file in the root of the source tree.
 
-# Using same overrides as WebRTC
-# See https://bugs.chromium.org/p/webrtc/issues/detail?id=5453.
-# Some WebRTC targets require the 10.7 deployment version of the Mac SDK and a
-# 10.11 min SDK but those targets are only used in non-Chromium builds. We can
-# remove this when Chromium drops 10.6 support and also requires 10.7.
-mac_sdk_min_build_override = "10.11"
-mac_deployment_target_build_override = "10.7"
-
 # Some non-Chromium builds don't use Chromium's third_party/binutils.
 linux_use_bundled_binutils_override = true
 
 # Variable that can be used to support multiple build scenarios, like having
 # Chromium specific targets in a client project's GN file etc.
 build_with_chromium = false
 
 # Some non-Chromium builds don't support building java targets.
old mode 100644
new mode 100755
--- a/media/libyuv/libyuv/docs/deprecated_builds.md
+++ b/media/libyuv/libyuv/docs/deprecated_builds.md
@@ -160,21 +160,21 @@ ia32
 mipsel
 
     GYP_DEFINES="OS=android target_arch=mipsel" GYP_CROSSCOMPILE=1 ./gyp_libyuv
     ninja -j7 -C out/Debug yuv_unittest_apk
     ninja -j7 -C out/Release yuv_unittest_apk
 
 arm32 disassembly:
 
-    third_party/android_tools/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-objdump -d out/Release/obj/source/libyuv.row_neon.o
+    third_party/android_ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-objdump -d out/Release/obj/source/libyuv.row_neon.o
 
 arm64 disassembly:
 
-    third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d out/Release/obj/source/libyuv.row_neon64.o
+    third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d out/Release/obj/source/libyuv.row_neon64.o
 
 Running tests:
 
     build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=*
 
 Running test as benchmark:
 
     build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1"
@@ -233,17 +233,17 @@ After this command follow the building t
 If you get a compile error for atlthunk.lib on Windows, read http://www.chromium.org/developers/how-tos/build-instructions-windows
 
 
 ### Build targets
 
     ninja -C out/Debug libyuv
     ninja -C out/Debug libyuv_unittest
     ninja -C out/Debug compare
-    ninja -C out/Debug convert
+    ninja -C out/Debug yuvconvert
     ninja -C out/Debug psnr
     ninja -C out/Debug cpuid
 
 
 ## Building the Library with make
 
 ### Linux
 
--- a/media/libyuv/libyuv/docs/environment_variables.md
+++ b/media/libyuv/libyuv/docs/environment_variables.md
@@ -9,20 +9,20 @@ By default the cpu is detected and the m
     LIBYUV_DISABLE_ASM
     LIBYUV_DISABLE_X86
     LIBYUV_DISABLE_SSE2
     LIBYUV_DISABLE_SSSE3
     LIBYUV_DISABLE_SSE41
     LIBYUV_DISABLE_SSE42
     LIBYUV_DISABLE_AVX
     LIBYUV_DISABLE_AVX2
-    LIBYUV_DISABLE_AVX3
+    LIBYUV_DISABLE_AVX512BW
     LIBYUV_DISABLE_ERMS
     LIBYUV_DISABLE_FMA3
-    LIBYUV_DISABLE_DSPR2
+    LIBYUV_DISABLE_MSA
     LIBYUV_DISABLE_NEON
 
 # Test Width/Height/Repeat
 
 The unittests default to a small image (128x72) to run fast.  This can be set by environment variable to test a specific resolutions.
 You can also repeat the test a specified number of iterations, allowing benchmarking and profiling.
 
     set LIBYUV_WIDTH=1280
--- a/media/libyuv/libyuv/docs/formats.md
+++ b/media/libyuv/libyuv/docs/formats.md
@@ -30,58 +30,55 @@ This is how OSX formats map to libyuv
       kCMPixelFormat_444YpCbCr10     = 'v410',  Not supported.
       kCMPixelFormat_8IndexedGray_WhiteIsZero = 0x00000028,  Not supported.
     };
 
 
 # FOURCC (Four Charactacter Code) List
 
 The following is extracted from video_common.h as a complete list of formats supported by libyuv.
-
     enum FourCC {
-      // 8 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
+      // 9 Primary YUV formats: 5 planar, 2 biplanar, 2 packed.
       FOURCC_I420 = FOURCC('I', '4', '2', '0'),
       FOURCC_I422 = FOURCC('I', '4', '2', '2'),
       FOURCC_I444 = FOURCC('I', '4', '4', '4'),
       FOURCC_I400 = FOURCC('I', '4', '0', '0'),
       FOURCC_NV21 = FOURCC('N', 'V', '2', '1'),
       FOURCC_NV12 = FOURCC('N', 'V', '1', '2'),
       FOURCC_YUY2 = FOURCC('Y', 'U', 'Y', '2'),
       FOURCC_UYVY = FOURCC('U', 'Y', 'V', 'Y'),
+      FOURCC_H010 = FOURCC('H', '0', '1', '0'),  // unofficial fourcc. 10 bit lsb
 
-      // 1 Secondary YUV formats: row biplanar.
+      // 1 Secondary YUV format: row biplanar.
       FOURCC_M420 = FOURCC('M', '4', '2', '0'),
 
-      // 9 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp.
+      // 11 Primary RGB formats: 4 32 bpp, 2 24 bpp, 3 16 bpp, 1 10 bpc
       FOURCC_ARGB = FOURCC('A', 'R', 'G', 'B'),
       FOURCC_BGRA = FOURCC('B', 'G', 'R', 'A'),
       FOURCC_ABGR = FOURCC('A', 'B', 'G', 'R'),
+      FOURCC_AR30 = FOURCC('A', 'R', '3', '0'),  // 10 bit per channel. 2101010.
+      FOURCC_AB30 = FOURCC('A', 'B', '3', '0'),  // ABGR version of 10 bit
       FOURCC_24BG = FOURCC('2', '4', 'B', 'G'),
-      FOURCC_RAW  = FOURCC('r', 'a', 'w', ' '),
+      FOURCC_RAW = FOURCC('r', 'a', 'w', ' '),
       FOURCC_RGBA = FOURCC('R', 'G', 'B', 'A'),
       FOURCC_RGBP = FOURCC('R', 'G', 'B', 'P'),  // rgb565 LE.
       FOURCC_RGBO = FOURCC('R', 'G', 'B', 'O'),  // argb1555 LE.
       FOURCC_R444 = FOURCC('R', '4', '4', '4'),  // argb4444 LE.
 
-      // 4 Secondary RGB formats: 4 Bayer Patterns.
-      FOURCC_RGGB = FOURCC('R', 'G', 'G', 'B'),
-      FOURCC_BGGR = FOURCC('B', 'G', 'G', 'R'),
-      FOURCC_GRBG = FOURCC('G', 'R', 'B', 'G'),
-      FOURCC_GBRG = FOURCC('G', 'B', 'R', 'G'),
-
       // 1 Primary Compressed YUV format.
       FOURCC_MJPG = FOURCC('M', 'J', 'P', 'G'),
 
-      // 5 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
+      // 7 Auxiliary YUV variations: 3 with U and V planes are swapped, 1 Alias.
       FOURCC_YV12 = FOURCC('Y', 'V', '1', '2'),
       FOURCC_YV16 = FOURCC('Y', 'V', '1', '6'),
       FOURCC_YV24 = FOURCC('Y', 'V', '2', '4'),
       FOURCC_YU12 = FOURCC('Y', 'U', '1', '2'),  // Linux version of I420.
       FOURCC_J420 = FOURCC('J', '4', '2', '0'),
-      FOURCC_J400 = FOURCC('J', '4', '0', '0'),
+      FOURCC_J400 = FOURCC('J', '4', '0', '0'),  // unofficial fourcc
+      FOURCC_H420 = FOURCC('H', '4', '2', '0'),  // unofficial fourcc
 
       // 14 Auxiliary aliases.  CanonicalFourCC() maps these to canonical fourcc.
       FOURCC_IYUV = FOURCC('I', 'Y', 'U', 'V'),  // Alias for I420.
       FOURCC_YU16 = FOURCC('Y', 'U', '1', '6'),  // Alias for I422.
       FOURCC_YU24 = FOURCC('Y', 'U', '2', '4'),  // Alias for I444.
       FOURCC_YUYV = FOURCC('Y', 'U', 'Y', 'V'),  // Alias for YUY2.
       FOURCC_YUVS = FOURCC('y', 'u', 'v', 's'),  // Alias for YUY2 on Mac.
       FOURCC_HDYC = FOURCC('H', 'D', 'Y', 'C'),  // Alias for UYVY.
@@ -92,19 +89,16 @@ The following is extracted from video_co
       FOURCC_RGB3 = FOURCC('R', 'G', 'B', '3'),  // Alias for RAW.
       FOURCC_BGR3 = FOURCC('B', 'G', 'R', '3'),  // Alias for 24BG.
       FOURCC_CM32 = FOURCC(0, 0, 0, 32),  // Alias for BGRA kCMPixelFormat_32ARGB
       FOURCC_CM24 = FOURCC(0, 0, 0, 24),  // Alias for RAW kCMPixelFormat_24RGB
       FOURCC_L555 = FOURCC('L', '5', '5', '5'),  // Alias for RGBO.
       FOURCC_L565 = FOURCC('L', '5', '6', '5'),  // Alias for RGBP.
       FOURCC_5551 = FOURCC('5', '5', '5', '1'),  // Alias for RGBO.
 
-      // 1 Auxiliary compressed YUV format set aside for capturer.
-      FOURCC_H264 = FOURCC('H', '2', '6', '4'),
-
 # Planar YUV
       The following formats contains a full size Y plane followed by 1 or 2
         planes for UV: I420, I422, I444, I400, NV21, NV12, I400
       The size (subsampling) of the UV varies.
         I420, NV12 and NV21 are half width, half height
         I422, NV16 and NV61 are half width, full height
         I444, NV24 and NV42 are full width, full height
         I400 and J400 have no chroma channel.
@@ -133,8 +127,36 @@ All formats can be converted to/from ARG
 
 Most 'planar_functions' work on ARGB (e.g. ARGBBlend).
 
 Some are channel order agnostic (e.g. ARGBScale).
 
 Some functions are symmetric (e.g. ARGBToBGRA is the same as BGRAToARGB, so its a macro).
 
 ARGBBlend expects preattenuated ARGB. The R,G,B are premultiplied by alpha.  Other functions don't care.
+
+# RGB24 and RAW
+
+There are 2 RGB layouts - RGB24 (aka 24BG) and RAW
+
+RGB24 is B,G,R in memory
+RAW is R,G,B in memory
+
+# AR30 and XR30
+
+AR30 is 2 10 10 10 ARGB stored in little endian order.
+The 2 bit alpha has 4 values.  Here are the comparable 8 bit alpha values.
+0 - 0.    00000000b = 0x00 = 0
+1 - 33%.  01010101b = 0x55 = 85
+2 - 66%.  10101010b = 0xaa = 170
+3 - 100%. 11111111b = 0xff = 255
+The 10 bit RGB values range from 0 to 1023.
+XR30 is the same as AR30 but with no alpha channel.
+
+# NV12 and NV21
+
+NV12 is a biplanar format with a full sized Y plane followed by a single
+chroma plane with weaved U and V values.
+NV21 is the same but with weaved V and U values.
+The 12 in NV12 refers to 12 bits per pixel.  NV12 has a half width and half
+height chroma channel, and therefore is a 420 subsampling.
+NV16 is 16 bits per pixel, with half width and full height.  aka 422.
+NV24 is 24 bits per pixel with full sized chroma channel. aka 444.
--- a/media/libyuv/libyuv/docs/getting_started.md
+++ b/media/libyuv/libyuv/docs/getting_started.md
@@ -6,23 +6,23 @@ How to get and build the libyuv code.
 
 You'll need to have depot tools installed: https://www.chromium.org/developers/how-tos/install-depot-tools
 Refer to chromium instructions for each platform for other prerequisites.
 
 ## Getting the Code
 
 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,
         "custom_deps" : {
         },
         "safesync_url": "",
       },
     ];
@@ -30,75 +30,52 @@ Then you'll get a .gclient file like:
 For iOS add `;target_os=['ios'];` to your OSX .gclient and run `GYP_DEFINES="OS=ios" gclient sync.`
 
 Browse the Git reprository: https://chromium.googlesource.com/libyuv/libyuv/+/master
 
 ### Android
 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,
         "custom_deps" : {
         },
         "safesync_url": "",
       },
     ];
     target_os = ["android", "linux"];
 
 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):
 
     git clone https://chromium.googlesource.com/libyuv/libyuv
 
 
 ## Building the Library and Unittests
 
 ### Windows
 
-    call gn gen out/Release "--args=is_debug=false target_cpu=\"x86\""
-    call gn gen out/Debug "--args=is_debug=true target_cpu=\"x86\""
-    ninja -v -C out/Release
-    ninja -v -C out/Debug
-
-    call gn gen out/Release "--args=is_debug=false target_cpu=\"x64\""
-    call gn gen out/Debug "--args=is_debug=true target_cpu=\"x64\""
-    ninja -v -C out/Release
-    ninja -v -C out/Debug
-
-#### Building with clang-cl
+    call gn gen out\Release "--args=is_debug=false target_cpu=\"x64\""
+    call gn gen out\Debug "--args=is_debug=true target_cpu=\"x64\""
+    ninja -v -C out\Release
+    ninja -v -C out\Debug
 
-    set GYP_DEFINES=clang=1 target_arch=ia32
-    call python tools\clang\scripts\update.py
-
-    call gn gen out/Release "--args=is_debug=false is_official_build=false is_clang=true target_cpu=\"x86\""
-    call gn gen out/Debug "--args=is_debug=true is_official_build=false is_clang=true target_cpu=\"x86\""
-    ninja -v -C out/Release
-    ninja -v -C out/Debug
-
-    call gn gen out/Release "--args=is_debug=false is_official_build=false is_clang=true target_cpu=\"x64\""
-    call gn gen out/Debug "--args=is_debug=true is_official_build=false is_clang=true target_cpu=\"x64\""
-    ninja -v -C out/Release
-    ninja -v -C out/Debug
+    call gn gen out\Release "--args=is_debug=false target_cpu=\"x86\""
+    call gn gen out\Debug "--args=is_debug=true target_cpu=\"x86\""
+    ninja -v -C out\Release
+    ninja -v -C out\Debug
 
 ### macOS and Linux
 
     gn gen out/Release "--args=is_debug=false"
     gn gen out/Debug "--args=is_debug=true"
     ninja -v -C out/Release
     ninja -v -C out/Debug
 
@@ -126,56 +103,51 @@ ios simulator
     ninja -v -C out/Debug libyuv_unittest
     ninja -v -C out/Release libyuv_unittest
 
 ### Android
 https://code.google.com/p/chromium/wiki/AndroidBuildInstructions
 
 Add to .gclient last line: `target_os=['android'];`
 
+arm64
+
+    gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm64\""
+    gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"arm64\""
+    ninja -v -C out/Debug libyuv_unittest
+    ninja -v -C out/Release libyuv_unittest
+
 armv7
 
     gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm\""
     gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"arm\""
     ninja -v -C out/Debug libyuv_unittest
     ninja -v -C out/Release libyuv_unittest
 
-arm64
-
-    gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm64\""
-    gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"arm64\""
-    ninja -v -C out/Debug libyuv_unittest
-    ninja -v -C out/Release libyuv_unittest
-
 ia32
 
     gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"x86\""
     gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"x86\""
     ninja -v -C out/Debug libyuv_unittest
     ninja -v -C out/Release libyuv_unittest
 
-mipsel
+mips
 
-    gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"mipsel\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=false"
-    gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"mipsel\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=false"
-    ninja -v -C out/Debug libyuv_unittest
-    ninja -v -C out/Release libyuv_unittest
-
-    gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=false"
-    gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=false"
+    gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=true"
+    gn gen out/Debug "--args=is_debug=true target_os=\"android\" target_cpu=\"mips64el\" mips_arch_variant=\"r6\" mips_use_msa=true is_component_build=true is_clang=true"
     ninja -v -C out/Debug libyuv_unittest
     ninja -v -C out/Release libyuv_unittest
 
 arm disassembly:
 
-    third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv/row_common.o >row_common.txt
+    third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv/row_common.o >row_common.txt
 
-    third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv_neon/row_neon.o >row_neon.txt
+    third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv_neon/row_neon.o >row_neon.txt
 
-    third_party/android_tools/ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv_neon/row_neon64.o >row_neon64.txt
+    third_party/android_ndk/toolchains/aarch64-linux-android-4.9/prebuilt/linux-x86_64/bin/aarch64-linux-android-objdump -d ./out/Release/obj/libyuv_neon/row_neon64.o >row_neon64.txt
 
 Running tests:
 
     build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=*
 
 Running test as benchmark:
 
     build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=-1  --libyuv_cpu_info=-1"
@@ -184,17 +156,17 @@ Running test with C code:
 
     build/android/test_runner.py gtest -s libyuv_unittest -t 7200 --verbose --release --gtest_filter=* -a "--libyuv_width=1280 --libyuv_height=720 --libyuv_repeat=999 --libyuv_flags=1 --libyuv_cpu_info=1"
 
 ### Build targets
 
     ninja -C out/Debug libyuv
     ninja -C out/Debug libyuv_unittest
     ninja -C out/Debug compare
-    ninja -C out/Debug convert
+    ninja -C out/Debug yuvconvert
     ninja -C out/Debug psnr
     ninja -C out/Debug cpuid
 
 ### ARM Linux
 
     gn gen out/Release "--args=is_debug=false target_cpu=\"arm64\""
     gn gen out/Debug "--args=is_debug=true target_cpu=\"arm64\""
     ninja -v -C out/Debug libyuv_unittest
@@ -254,44 +226,47 @@ See also https://www.ccoderun.ca/program
     arm-linux-gnueabihf-objdump -d psnr
 
 ## Running Unittests
 
 ### Windows
 
     out\Release\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter="*"
 
-### OSX
+### macOS and Linux
 
     out/Release/libyuv_unittest --gtest_filter="*"
 
-### Linux
-
-    out/Release/libyuv_unittest --gtest_filter="*"
-
-Replace --gtest_filter="*" with specific unittest to run.  May include wildcards. e.g.
-
+Replace --gtest_filter="*" with specific unittest to run.  May include wildcards.
     out/Release/libyuv_unittest --gtest_filter=*I420ToARGB_Opt
 
 ## CPU Emulator tools
 
 ### Intel SDE (Software Development Emulator)
 
 Pre-requisite: Install IntelSDE: http://software.intel.com/en-us/articles/intel-software-development-emulator
 
 Then run:
 
     c:\intelsde\sde -hsw -- out\Release\libyuv_unittest.exe --gtest_filter=*
 
     ~/intelsde/sde -skx -- out/Release/libyuv_unittest --gtest_filter=**I420ToARGB_Opt
 
+### Intel Architecture Code Analyzer
+
+Inset these 2 macros into assembly code to be analyzed:
+    IACA_ASM_START
+    IACA_ASM_END
+Build the code as usual, then run iaca on the object file.
+    ~/iaca-lin64/bin/iaca.sh -reduceout -arch HSW out/Release/obj/libyuv_internal/compare_gcc.o
+
 ## Sanitizers
 
-    gn gen out/Debug "--args=is_debug=true is_asan=true"
-    ninja -v -C out/Debug
+    gn gen out/Release "--args=is_debug=false is_msan=true"
+    ninja -v -C out/Release
 
-    Sanitizers available: tsan, msan, asan, ubsan, lsan
+Sanitizers available: asan, msan, tsan, ubsan, lsan, ubsan_vptr
 
 ### Running Dr Memory memcheck for Windows
 
 Pre-requisite: Install Dr Memory for Windows and add it to your path: http://www.drmemory.org/docs/page_install_windows.html
 
     drmemory out\Debug\libyuv_unittest.exe --gtest_catch_exceptions=0 --gtest_filter=*
old mode 100644
new mode 100755
--- a/media/libyuv/libyuv/include/libyuv/basic_types.h
+++ b/media/libyuv/libyuv/include/libyuv/basic_types.h
@@ -6,105 +6,43 @@
  *  tree. An additional intellectual property rights grant can be found
  *  in the file PATENTS. All contributing project authors may
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
 #ifndef INCLUDE_LIBYUV_BASIC_TYPES_H_
 #define INCLUDE_LIBYUV_BASIC_TYPES_H_
 
-#include <stddef.h>  // for NULL, size_t
+#include <stddef.h>  // For size_t and NULL
+
+#if !defined(INT_TYPES_DEFINED) && !defined(GG_LONGLONG)
+#define INT_TYPES_DEFINED
 
 #if defined(_MSC_VER) && (_MSC_VER < 1600)
 #include <sys/types.h>  // for uintptr_t on x86
+typedef unsigned __int64 uint64_t;
+typedef __int64 int64_t;
+typedef unsigned int uint32_t;
+typedef int int32_t;
+typedef unsigned short uint16_t;
+typedef short int16_t;
+typedef unsigned char uint8_t;
+typedef signed char int8_t;
 #else
-#include <stdint.h>  // for uintptr_t
-#endif
-
+#include <stdint.h>  // for uintptr_t and C99 types
+#endif               // defined(_MSC_VER) && (_MSC_VER < 1600)
 typedef uint64_t uint64;
-typedef int64_t  int64;
-#if defined(_MSC_VER)
-// nsprpub/pr/include/obsolete/protypes.h defines these weirdly
-typedef long int32;
-typedef unsigned long uint32;
-#else
+typedef int64_t int64;
 typedef uint32_t uint32;
-typedef int32_t  int32;
-#endif
+typedef int32_t int32;
 typedef uint16_t uint16;
-typedef int16_t  int16;
-typedef uint8_t  uint8;
-typedef int8_t   int8;
-#define INT_TYPES_DEFINED 1
-
-#ifndef GG_LONGLONG
-#ifndef INT_TYPES_DEFINED
-#define INT_TYPES_DEFINED
-#ifdef COMPILER_MSVC
-typedef unsigned __int64 uint64;
-typedef __int64 int64;
-#ifndef INT64_C
-#define INT64_C(x) x##I64
-#endif
-#ifndef UINT64_C
-#define UINT64_C(x) x##UI64
-#endif
-#define INT64_F "I64"
-#else  // COMPILER_MSVC
-#if defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
-typedef unsigned long uint64;  // NOLINT
-typedef long int64;            // NOLINT
-#ifndef INT64_C
-#define INT64_C(x) x##L
-#endif
-#ifndef UINT64_C
-#define UINT64_C(x) x##UL
-#endif
-#define INT64_F "l"
-#else  // defined(__LP64__) && !defined(__OpenBSD__) && !defined(__APPLE__)
-typedef unsigned long long uint64;  // NOLINT
-typedef long long int64;            // NOLINT
-#ifndef INT64_C
-#define INT64_C(x) x##LL
-#endif
-#ifndef UINT64_C
-#define UINT64_C(x) x##ULL
-#endif
-#define INT64_F "ll"
-#endif  // __LP64__
-#endif  // COMPILER_MSVC
-typedef unsigned int uint32;
-typedef int int32;
-typedef unsigned short uint16;  // NOLINT
-typedef short int16;            // NOLINT
-typedef unsigned char uint8;
-typedef signed char int8;
+typedef int16_t int16;
+typedef uint8_t uint8;
+typedef int8_t int8;
 #endif  // INT_TYPES_DEFINED
-#endif  // GG_LONGLONG
-
-// Detect compiler is for x86 or x64.
-#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
-    defined(_M_IX86)
-#define CPU_X86 1
-#endif
-// Detect compiler is for ARM.
-#if defined(__arm__) || defined(_M_ARM)
-#define CPU_ARM 1
-#endif
-
-#ifndef ALIGNP
-#ifdef __cplusplus
-#define ALIGNP(p, t)        \
-  reinterpret_cast<uint8*>( \
-      ((reinterpret_cast<uintptr_t>(p) + ((t)-1)) & ~((t)-1)))
-#else
-#define ALIGNP(p, t) \
-  (uint8*)((((uintptr_t)(p) + ((t)-1)) & ~((t)-1))) /* NOLINT */
-#endif
-#endif
 
 #if !defined(LIBYUV_API)
 #if defined(_WIN32) || defined(__CYGWIN__)
 #if defined(LIBYUV_BUILDING_SHARED_LIBRARY)
 #define LIBYUV_API __declspec(dllexport)
 #elif defined(LIBYUV_USING_SHARED_LIBRARY)
 #define LIBYUV_API __declspec(dllimport)
 #else
@@ -114,20 +52,14 @@ typedef signed char int8;
     (defined(LIBYUV_BUILDING_SHARED_LIBRARY) ||                      \
      defined(LIBYUV_USING_SHARED_LIBRARY))
 #define LIBYUV_API __attribute__((visibility("default")))
 #else
 #define LIBYUV_API
 #endif  // __GNUC__
 #endif  // LIBYUV_API
 
+// TODO(fbarchard): Remove bool macros.
 #define LIBYUV_BOOL int
 #define LIBYUV_FALSE 0
 #define LIBYUV_TRUE 1
 
-// Visual C x86 or GCC little endian.
-#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
-    defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) ||     \
-    (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
-#define LIBYUV_LITTLE_ENDIAN
-#endif
-
 #endif  // INCLUDE_LIBYUV_BASIC_TYPES_H_
--- a/media/libyuv/libyuv/include/libyuv/compare.h
+++ b/media/libyuv/libyuv/include/libyuv/compare.h
@@ -15,84 +15,95 @@
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
 // Compute a hash for specified memory. Seed of 5381 recommended.
 LIBYUV_API
-uint32 HashDjb2(const uint8* src, uint64 count, uint32 seed);
+uint32_t HashDjb2(const uint8_t* src, uint64_t count, uint32_t seed);
+
+// Hamming Distance
+LIBYUV_API
+uint64_t ComputeHammingDistance(const uint8_t* src_a,
+                                const uint8_t* src_b,
+                                int count);
 
 // Scan an opaque argb image and return fourcc based on alpha offset.
 // Returns FOURCC_ARGB, FOURCC_BGRA, or 0 if unknown.
 LIBYUV_API
-uint32 ARGBDetect(const uint8* argb, int stride_argb, int width, int height);
+uint32_t ARGBDetect(const uint8_t* argb,
+                    int stride_argb,
+                    int width,
+                    int height);
 
 // Sum Square Error - used to compute Mean Square Error or PSNR.
 LIBYUV_API
-uint64 ComputeSumSquareError(const uint8* src_a, const uint8* src_b, int count);
+uint64_t ComputeSumSquareError(const uint8_t* src_a,
+                               const uint8_t* src_b,
+                               int count);
 
 LIBYUV_API
-uint64 ComputeSumSquareErrorPlane(const uint8* src_a,
-                                  int stride_a,
-                                  const uint8* src_b,
-                                  int stride_b,
-                                  int width,
-                                  int height);
+uint64_t ComputeSumSquareErrorPlane(const uint8_t* src_a,
+                                    int stride_a,
+                                    const uint8_t* src_b,
+                                    int stride_b,
+                                    int width,
+                                    int height);
 
 static const int kMaxPsnr = 128;
 
 LIBYUV_API
-double SumSquareErrorToPsnr(uint64 sse, uint64 count);
+double SumSquareErrorToPsnr(uint64_t sse, uint64_t count);
 
 LIBYUV_API
-double CalcFramePsnr(const uint8* src_a,
+double CalcFramePsnr(const uint8_t* src_a,
                      int stride_a,
-                     const uint8* src_b,
+                     const uint8_t* src_b,
                      int stride_b,
                      int width,
                      int height);
 
 LIBYUV_API
-double I420Psnr(const uint8* src_y_a,
+double I420Psnr(const uint8_t* src_y_a,
                 int stride_y_a,
-                const uint8* src_u_a,
+                const uint8_t* src_u_a,
                 int stride_u_a,
-                const uint8* src_v_a,
+                const uint8_t* src_v_a,
                 int stride_v_a,
-                const uint8* src_y_b,
+                const uint8_t* src_y_b,
                 int stride_y_b,
-                const uint8* src_u_b,
+                const uint8_t* src_u_b,
                 int stride_u_b,
-                const uint8* src_v_b,
+                const uint8_t* src_v_b,
                 int stride_v_b,
                 int width,
                 int height);
 
 LIBYUV_API
-double CalcFrameSsim(const uint8* src_a,
+double CalcFrameSsim(const uint8_t* src_a,
                      int stride_a,
-                     const uint8* src_b,
+                     const uint8_t* src_b,
                      int stride_b,
                      int width,
                      int height);
 
 LIBYUV_API
-double I420Ssim(const uint8* src_y_a,
+double I420Ssim(const uint8_t* src_y_a,
                 int stride_y_a,
-                const uint8* src_u_a,
+                const uint8_t* src_u_a,
                 int stride_u_a,
-                const uint8* src_v_a,
+                const uint8_t* src_v_a,
                 int stride_v_a,
-                const uint8* src_y_b,
+                const uint8_t* src_y_b,
                 int stride_y_b,
-                const uint8* src_u_b,
+                const uint8_t* src_u_b,
                 int stride_u_b,
-                const uint8* src_v_b,
+                const uint8_t* src_v_b,
                 int stride_v_b,
                 int width,
                 int height);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
--- a/media/libyuv/libyuv/include/libyuv/compare_row.h
+++ b/media/libyuv/libyuv/include/libyuv/compare_row.h
@@ -13,72 +13,125 @@
 
 #include "libyuv/basic_types.h"
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
-#if defined(__pnacl__) || defined(__CLR_VER) || \
+#if defined(__pnacl__) || defined(__CLR_VER) ||            \
+    (defined(__native_client__) && defined(__x86_64__)) || \
     (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
 #define LIBYUV_DISABLE_X86
 #endif
+#if defined(__native_client__)
+#define LIBYUV_DISABLE_NEON
+#endif
 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
 #if defined(__has_feature)
 #if __has_feature(memory_sanitizer)
 #define LIBYUV_DISABLE_X86
 #endif
 #endif
-
 // Visual C 2012 required for AVX2.
 #if defined(_M_IX86) && !defined(__clang__) && defined(_MSC_VER) && \
     _MSC_VER >= 1700
 #define VISUALC_HAS_AVX2 1
 #endif  // VisualStudio >= 2012
 
 // clang >= 3.4.0 required for AVX2.
 #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
 #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
 #define CLANG_HAS_AVX2 1
 #endif  // clang >= 3.4
 #endif  // __clang__
 
+// The following are available for Visual C:
 #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \
     (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
 #define HAS_HASHDJB2_AVX2
 #endif
 
 // The following are available for Visual C and GCC:
 #if !defined(LIBYUV_DISABLE_X86) && \
-    (defined(__x86_64__) || (defined(__i386__) || defined(_M_IX86)))
+    (defined(__x86_64__) || defined(__i386__) || defined(_M_IX86))
 #define HAS_HASHDJB2_SSE41
 #define HAS_SUMSQUAREERROR_SSE2
+#define HAS_HAMMINGDISTANCE_SSE42
 #endif
 
 // The following are available for Visual C and clangcl 32 bit:
 #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \
     (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
 #define HAS_HASHDJB2_AVX2
 #define HAS_SUMSQUAREERROR_AVX2
 #endif
 
+// The following are available for GCC and clangcl 64 bit:
+#if !defined(LIBYUV_DISABLE_X86) && \
+    (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER)))
+#define HAS_HAMMINGDISTANCE_SSSE3
+#endif
+
+// The following are available for GCC and clangcl 64 bit:
+#if !defined(LIBYUV_DISABLE_X86) && defined(CLANG_HAS_AVX2) && \
+    (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER)))
+#define HAS_HAMMINGDISTANCE_AVX2
+#endif
+
 // The following are available for Neon:
 #if !defined(LIBYUV_DISABLE_NEON) && \
     (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
 #define HAS_SUMSQUAREERROR_NEON
+#define HAS_HAMMINGDISTANCE_NEON
+#endif
+
+#if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
+#define HAS_HAMMINGDISTANCE_MSA
+#define HAS_SUMSQUAREERROR_MSA
 #endif
 
-uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count);
-uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count);
-uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count);
-uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count);
+uint32_t HammingDistance_C(const uint8_t* src_a,
+                           const uint8_t* src_b,
+                           int count);
+uint32_t HammingDistance_SSE42(const uint8_t* src_a,
+                               const uint8_t* src_b,
+                               int count);
+uint32_t HammingDistance_SSSE3(const uint8_t* src_a,
+                               const uint8_t* src_b,
+                               int count);
+uint32_t HammingDistance_AVX2(const uint8_t* src_a,
+                              const uint8_t* src_b,
+                              int count);
+uint32_t HammingDistance_NEON(const uint8_t* src_a,
+                              const uint8_t* src_b,
+                              int count);
+uint32_t HammingDistance_MSA(const uint8_t* src_a,
+                             const uint8_t* src_b,
+                             int count);
 
-uint32 HashDjb2_C(const uint8* src, int count, uint32 seed);
-uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed);
-uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed);
+uint32_t SumSquareError_C(const uint8_t* src_a,
+                          const uint8_t* src_b,
+                          int count);
+uint32_t SumSquareError_SSE2(const uint8_t* src_a,
+                             const uint8_t* src_b,
+                             int count);
+uint32_t SumSquareError_AVX2(const uint8_t* src_a,
+                             const uint8_t* src_b,
+                             int count);
+uint32_t SumSquareError_NEON(const uint8_t* src_a,
+                             const uint8_t* src_b,
+                             int count);
+uint32_t SumSquareError_MSA(const uint8_t* src_a,
+                            const uint8_t* src_b,
+                            int count);
+
+uint32_t HashDjb2_C(const uint8_t* src, int count, uint32_t seed);
+uint32_t HashDjb2_SSE41(const uint8_t* src, int count, uint32_t seed);
+uint32_t HashDjb2_AVX2(const uint8_t* src, int count, uint32_t seed);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
 
 #endif  // INCLUDE_LIBYUV_COMPARE_ROW_H_
--- a/media/libyuv/libyuv/include/libyuv/convert.h
+++ b/media/libyuv/libyuv/include/libyuv/convert.h
@@ -22,305 +22,345 @@
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
 // Convert I444 to I420.
 LIBYUV_API
-int I444ToI420(const uint8* src_y,
+int I444ToI420(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert I422 to I420.
 LIBYUV_API
-int I422ToI420(const uint8* src_y,
+int I422ToI420(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Copy I420 to I420.
 #define I420ToI420 I420Copy
 LIBYUV_API
-int I420Copy(const uint8* src_y,
+int I420Copy(const uint8_t* src_y,
              int src_stride_y,
-             const uint8* src_u,
+             const uint8_t* src_u,
              int src_stride_u,
-             const uint8* src_v,
+             const uint8_t* src_v,
              int src_stride_v,
-             uint8* dst_y,
+             uint8_t* dst_y,
              int dst_stride_y,
-             uint8* dst_u,
+             uint8_t* dst_u,
              int dst_stride_u,
-             uint8* dst_v,
+             uint8_t* dst_v,
              int dst_stride_v,
              int width,
              int height);
 
+// Copy I010 to I010
+#define I010ToI010 I010Copy
+#define H010ToH010 I010Copy
+LIBYUV_API
+int I010Copy(const uint16_t* src_y,
+             int src_stride_y,
+             const uint16_t* src_u,
+             int src_stride_u,
+             const uint16_t* src_v,
+             int src_stride_v,
+             uint16_t* dst_y,
+             int dst_stride_y,
+             uint16_t* dst_u,
+             int dst_stride_u,
+             uint16_t* dst_v,
+             int dst_stride_v,
+             int width,
+             int height);
+
+// Convert 10 bit YUV to 8 bit
+#define H010ToH420 I010ToI420
+LIBYUV_API
+int I010ToI420(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_u,
+               int dst_stride_u,
+               uint8_t* dst_v,
+               int dst_stride_v,
+               int width,
+               int height);
+
 // Convert I400 (grey) to I420.
 LIBYUV_API
-int I400ToI420(const uint8* src_y,
+int I400ToI420(const uint8_t* src_y,
                int src_stride_y,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 #define J400ToJ420 I400ToI420
 
 // Convert NV12 to I420.
 LIBYUV_API
-int NV12ToI420(const uint8* src_y,
+int NV12ToI420(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_uv,
+               const uint8_t* src_uv,
                int src_stride_uv,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert NV21 to I420.
 LIBYUV_API
-int NV21ToI420(const uint8* src_y,
+int NV21ToI420(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_vu,
+               const uint8_t* src_vu,
                int src_stride_vu,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert YUY2 to I420.
 LIBYUV_API
-int YUY2ToI420(const uint8* src_yuy2,
+int YUY2ToI420(const uint8_t* src_yuy2,
                int src_stride_yuy2,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert UYVY to I420.
 LIBYUV_API
-int UYVYToI420(const uint8* src_uyvy,
+int UYVYToI420(const uint8_t* src_uyvy,
                int src_stride_uyvy,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert M420 to I420.
 LIBYUV_API
-int M420ToI420(const uint8* src_m420,
+int M420ToI420(const uint8_t* src_m420,
                int src_stride_m420,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert Android420 to I420.
 LIBYUV_API
-int Android420ToI420(const uint8* src_y,
+int Android420ToI420(const uint8_t* src_y,
                      int src_stride_y,
-                     const uint8* src_u,
+                     const uint8_t* src_u,
                      int src_stride_u,
-                     const uint8* src_v,
+                     const uint8_t* src_v,
                      int src_stride_v,
-                     int pixel_stride_uv,
-                     uint8* dst_y,
+                     int src_pixel_stride_uv,
+                     uint8_t* dst_y,
                      int dst_stride_y,
-                     uint8* dst_u,
+                     uint8_t* dst_u,
                      int dst_stride_u,
-                     uint8* dst_v,
+                     uint8_t* dst_v,
                      int dst_stride_v,
                      int width,
                      int height);
 
 // ARGB little endian (bgra in memory) to I420.
 LIBYUV_API
-int ARGBToI420(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_y,
+int ARGBToI420(const uint8_t* src_argb,
+               int src_stride_argb,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // BGRA little endian (argb in memory) to I420.
 LIBYUV_API
-int BGRAToI420(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_y,
+int BGRAToI420(const uint8_t* src_bgra,
+               int src_stride_bgra,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // ABGR little endian (rgba in memory) to I420.
 LIBYUV_API
-int ABGRToI420(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_y,
+int ABGRToI420(const uint8_t* src_abgr,
+               int src_stride_abgr,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // RGBA little endian (abgr in memory) to I420.
 LIBYUV_API
-int RGBAToI420(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_y,
+int RGBAToI420(const uint8_t* src_rgba,
+               int src_stride_rgba,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // RGB little endian (bgr in memory) to I420.
 LIBYUV_API
-int RGB24ToI420(const uint8* src_frame,
-                int src_stride_frame,
-                uint8* dst_y,
+int RGB24ToI420(const uint8_t* src_rgb24,
+                int src_stride_rgb24,
+                uint8_t* dst_y,
                 int dst_stride_y,
-                uint8* dst_u,
+                uint8_t* dst_u,
                 int dst_stride_u,
-                uint8* dst_v,
+                uint8_t* dst_v,
                 int dst_stride_v,
                 int width,
                 int height);
 
 // RGB big endian (rgb in memory) to I420.
 LIBYUV_API
-int RAWToI420(const uint8* src_frame,
-              int src_stride_frame,
-              uint8* dst_y,
+int RAWToI420(const uint8_t* src_raw,
+              int src_stride_raw,
+              uint8_t* dst_y,
               int dst_stride_y,
-              uint8* dst_u,
+              uint8_t* dst_u,
               int dst_stride_u,
-              uint8* dst_v,
+              uint8_t* dst_v,
               int dst_stride_v,
               int width,
               int height);
 
 // RGB16 (RGBP fourcc) little endian to I420.
 LIBYUV_API
-int RGB565ToI420(const uint8* src_frame,
-                 int src_stride_frame,
-                 uint8* dst_y,
+int RGB565ToI420(const uint8_t* src_rgb565,
+                 int src_stride_rgb565,
+                 uint8_t* dst_y,
                  int dst_stride_y,
-                 uint8* dst_u,
+                 uint8_t* dst_u,
                  int dst_stride_u,
-                 uint8* dst_v,
+                 uint8_t* dst_v,
                  int dst_stride_v,
                  int width,
                  int height);
 
 // RGB15 (RGBO fourcc) little endian to I420.
 LIBYUV_API
-int ARGB1555ToI420(const uint8* src_frame,
-                   int src_stride_frame,
-                   uint8* dst_y,
+int ARGB1555ToI420(const uint8_t* src_argb1555,
+                   int src_stride_argb1555,
+                   uint8_t* dst_y,
                    int dst_stride_y,
-                   uint8* dst_u,
+                   uint8_t* dst_u,
                    int dst_stride_u,
-                   uint8* dst_v,
+                   uint8_t* dst_v,
                    int dst_stride_v,
                    int width,
                    int height);
 
 // RGB12 (R444 fourcc) little endian to I420.
 LIBYUV_API
-int ARGB4444ToI420(const uint8* src_frame,
-                   int src_stride_frame,
-                   uint8* dst_y,
+int ARGB4444ToI420(const uint8_t* src_argb4444,
+                   int src_stride_argb4444,
+                   uint8_t* dst_y,
                    int dst_stride_y,
-                   uint8* dst_u,
+                   uint8_t* dst_u,
                    int dst_stride_u,
-                   uint8* dst_v,
+                   uint8_t* dst_v,
                    int dst_stride_v,
                    int width,
                    int height);
 
 #ifdef HAVE_JPEG
 // src_width/height provided by capture.
 // dst_width/height for clipping determine final size.
 LIBYUV_API
-int MJPGToI420(const uint8* sample,
+int MJPGToI420(const uint8_t* sample,
                size_t sample_size,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int src_width,
                int src_height,
                int dst_width,
                int dst_height);
 
 // Query size of MJPG in pixels.
 LIBYUV_API
-int MJPGSize(const uint8* sample, size_t sample_size, int* width, int* height);
+int MJPGSize(const uint8_t* sample,
+             size_t sample_size,
+             int* width,
+             int* height);
 #endif
 
 // Convert camera sample to I420 with cropping, rotation and vertical flip.
 // "src_size" is needed to parse MJPG.
 // "dst_stride_y" number of bytes in a row of the dst_y plane.
 //   Normally this would be the same as dst_width, with recommended alignment
 //   to 16 bytes for better efficiency.
 //   If rotation of 90 or 270 is used, stride is affected. The caller should
@@ -333,34 +373,34 @@ int MJPGSize(const uint8* sample, size_t
 //   To center, crop_x = (src_width - dst_width) / 2
 //              crop_y = (src_height - dst_height) / 2
 // "src_width" / "src_height" is size of src_frame in pixels.
 //   "src_height" can be negative indicating a vertically flipped image source.
 // "crop_width" / "crop_height" is the size to crop the src to.
 //    Must be less than or equal to src_width/src_height
 //    Cropping parameters are pre-rotation.
 // "rotation" can be 0, 90, 180 or 270.
-// "format" is a fourcc. ie 'I420', 'YUY2'
+// "fourcc" is a fourcc. ie 'I420', 'YUY2'
 // Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
 LIBYUV_API
-int ConvertToI420(const uint8* src_frame,
-                  size_t src_size,
-                  uint8* dst_y,
+int ConvertToI420(const uint8_t* sample,
+                  size_t sample_size,
+                  uint8_t* dst_y,
                   int dst_stride_y,
-                  uint8* dst_u,
+                  uint8_t* dst_u,
                   int dst_stride_u,
-                  uint8* dst_v,
+                  uint8_t* dst_v,
                   int dst_stride_v,
                   int crop_x,
                   int crop_y,
                   int src_width,
                   int src_height,
                   int crop_width,
                   int crop_height,
                   enum RotationMode rotation,
-                  uint32 format);
+                  uint32_t fourcc);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
 
 #endif  // INCLUDE_LIBYUV_CONVERT_H_
--- a/media/libyuv/libyuv/include/libyuv/convert_argb.h
+++ b/media/libyuv/libyuv/include/libyuv/convert_argb.h
@@ -25,410 +25,643 @@ namespace libyuv {
 extern "C" {
 #endif
 
 // Alias.
 #define ARGBToARGB ARGBCopy
 
 // Copy ARGB to ARGB.
 LIBYUV_API
-int ARGBCopy(const uint8* src_argb,
+int ARGBCopy(const uint8_t* src_argb,
              int src_stride_argb,
-             uint8* dst_argb,
+             uint8_t* dst_argb,
              int dst_stride_argb,
              int width,
              int height);
 
 // Convert I420 to ARGB.
 LIBYUV_API
-int I420ToARGB(const uint8* src_y,
+int I420ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Duplicate prototype for function in convert_from.h for remoting.
 LIBYUV_API
-int I420ToABGR(const uint8* src_y,
+int I420ToABGR(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert I010 to ARGB.
+LIBYUV_API
+int I010ToARGB(const uint16_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_argb,
+               int dst_stride_argb,
+               int width,
+               int height);
+
+// Convert I010 to ARGB.
+LIBYUV_API
+int I010ToARGB(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_argb,
+               int dst_stride_argb,
+               int width,
+               int height);
+
+// Convert I010 to ABGR.
+LIBYUV_API
+int I010ToABGR(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert H010 to ARGB.
+LIBYUV_API
+int H010ToARGB(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
+// Convert H010 to ABGR.
+LIBYUV_API
+int H010ToABGR(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
 // Convert I422 to ARGB.
 LIBYUV_API
-int I422ToARGB(const uint8* src_y,
+int I422ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert I444 to ARGB.
 LIBYUV_API
-int I444ToARGB(const uint8* src_y,
+int I444ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 LIBYUV_API
-int H444ToARGB(const uint8* src_y,
+int H444ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert J444 to ARGB.
 LIBYUV_API
-int J444ToARGB(const uint8* src_y,
+int J444ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert I444 to ABGR.
 LIBYUV_API
-int I444ToABGR(const uint8* src_y,
+int I444ToABGR(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_abgr,
+               uint8_t* dst_abgr,
                int dst_stride_abgr,
                int width,
                int height);
 
 // Convert I420 with Alpha to preattenuated ARGB.
 LIBYUV_API
-int I420AlphaToARGB(const uint8* src_y,
+int I420AlphaToARGB(const uint8_t* src_y,
                     int src_stride_y,
-                    const uint8* src_u,
+                    const uint8_t* src_u,
                     int src_stride_u,
-                    const uint8* src_v,
+                    const uint8_t* src_v,
                     int src_stride_v,
-                    const uint8* src_a,
+                    const uint8_t* src_a,
                     int src_stride_a,
-                    uint8* dst_argb,
+                    uint8_t* dst_argb,
                     int dst_stride_argb,
                     int width,
                     int height,
                     int attenuate);
 
 // Convert I420 with Alpha to preattenuated ABGR.
 LIBYUV_API
-int I420AlphaToABGR(const uint8* src_y,
+int I420AlphaToABGR(const uint8_t* src_y,
                     int src_stride_y,
-                    const uint8* src_u,
+                    const uint8_t* src_u,
                     int src_stride_u,
-                    const uint8* src_v,
+                    const uint8_t* src_v,
                     int src_stride_v,
-                    const uint8* src_a,
+                    const uint8_t* src_a,
                     int src_stride_a,
-                    uint8* dst_abgr,
+                    uint8_t* dst_abgr,
                     int dst_stride_abgr,
                     int width,
                     int height,
                     int attenuate);
 
 // Convert I400 (grey) to ARGB.  Reverse of ARGBToI400.
 LIBYUV_API
-int I400ToARGB(const uint8* src_y,
+int I400ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert J400 (jpeg grey) to ARGB.
 LIBYUV_API
-int J400ToARGB(const uint8* src_y,
+int J400ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Alias.
 #define YToARGB I400ToARGB
 
 // Convert NV12 to ARGB.
 LIBYUV_API
-int NV12ToARGB(const uint8* src_y,
+int NV12ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_uv,
+               const uint8_t* src_uv,
                int src_stride_uv,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert NV21 to ARGB.
 LIBYUV_API
-int NV21ToARGB(const uint8* src_y,
+int NV21ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_vu,
+               const uint8_t* src_vu,
                int src_stride_vu,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
+// Convert NV12 to ABGR.
+int NV12ToABGR(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_uv,
+               int src_stride_uv,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert NV21 to ABGR.
+LIBYUV_API
+int NV21ToABGR(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_vu,
+               int src_stride_vu,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert NV12 to RGB24.
+LIBYUV_API
+int NV12ToRGB24(const uint8_t* src_y,
+                int src_stride_y,
+                const uint8_t* src_uv,
+                int src_stride_uv,
+                uint8_t* dst_rgb24,
+                int dst_stride_rgb24,
+                int width,
+                int height);
+
+// Convert NV21 to RGB24.
+LIBYUV_API
+int NV21ToRGB24(const uint8_t* src_y,
+                int src_stride_y,
+                const uint8_t* src_vu,
+                int src_stride_vu,
+                uint8_t* dst_rgb24,
+                int dst_stride_rgb24,
+                int width,
+                int height);
+
 // Convert M420 to ARGB.
 LIBYUV_API
-int M420ToARGB(const uint8* src_m420,
+int M420ToARGB(const uint8_t* src_m420,
                int src_stride_m420,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert YUY2 to ARGB.
 LIBYUV_API
-int YUY2ToARGB(const uint8* src_yuy2,
+int YUY2ToARGB(const uint8_t* src_yuy2,
                int src_stride_yuy2,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert UYVY to ARGB.
 LIBYUV_API
-int UYVYToARGB(const uint8* src_uyvy,
+int UYVYToARGB(const uint8_t* src_uyvy,
                int src_stride_uyvy,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert J420 to ARGB.
 LIBYUV_API
-int J420ToARGB(const uint8* src_y,
+int J420ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert J422 to ARGB.
 LIBYUV_API
-int J422ToARGB(const uint8* src_y,
+int J422ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert J420 to ABGR.
 LIBYUV_API
-int J420ToABGR(const uint8* src_y,
+int J420ToABGR(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_abgr,
+               uint8_t* dst_abgr,
                int dst_stride_abgr,
                int width,
                int height);
 
 // Convert J422 to ABGR.
 LIBYUV_API
-int J422ToABGR(const uint8* src_y,
+int J422ToABGR(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_abgr,
+               uint8_t* dst_abgr,
                int dst_stride_abgr,
                int width,
                int height);
 
 // Convert H420 to ARGB.
 LIBYUV_API
-int H420ToARGB(const uint8* src_y,
+int H420ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert H422 to ARGB.
 LIBYUV_API
-int H422ToARGB(const uint8* src_y,
+int H422ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Convert H420 to ABGR.
 LIBYUV_API
-int H420ToABGR(const uint8* src_y,
+int H420ToABGR(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_abgr,
+               uint8_t* dst_abgr,
                int dst_stride_abgr,
                int width,
                int height);
 
 // Convert H422 to ABGR.
 LIBYUV_API
-int H422ToABGR(const uint8* src_y,
+int H422ToABGR(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert H010 to ARGB.
+LIBYUV_API
+int H010ToARGB(const uint16_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_argb,
+               int dst_stride_argb,
+               int width,
+               int height);
+
+// Convert I010 to AR30.
+LIBYUV_API
+int I010ToAR30(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_ar30,
+               int dst_stride_ar30,
+               int width,
+               int height);
+
+// Convert H010 to AR30.
+LIBYUV_API
+int H010ToAR30(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
                int src_stride_v,
-               uint8* dst_abgr,
-               int dst_stride_abgr,
+               uint8_t* dst_ar30,
+               int dst_stride_ar30,
+               int width,
+               int height);
+
+// Convert I010 to AB30.
+LIBYUV_API
+int I010ToAB30(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_ab30,
+               int dst_stride_ab30,
+               int width,
+               int height);
+
+// Convert H010 to AB30.
+LIBYUV_API
+int H010ToAB30(const uint16_t* src_y,
+               int src_stride_y,
+               const uint16_t* src_u,
+               int src_stride_u,
+               const uint16_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_ab30,
+               int dst_stride_ab30,
                int width,
                int height);
 
 // BGRA little endian (argb in memory) to ARGB.
 LIBYUV_API
-int BGRAToARGB(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_argb,
+int BGRAToARGB(const uint8_t* src_bgra,
+               int src_stride_bgra,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // ABGR little endian (rgba in memory) to ARGB.
 LIBYUV_API
-int ABGRToARGB(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_argb,
+int ABGRToARGB(const uint8_t* src_abgr,
+               int src_stride_abgr,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // RGBA little endian (abgr in memory) to ARGB.
 LIBYUV_API
-int RGBAToARGB(const uint8* src_frame,
-               int src_stride_frame,
-               uint8* dst_argb,
+int RGBAToARGB(const uint8_t* src_rgba,
+               int src_stride_rgba,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 // Deprecated function name.
 #define BG24ToARGB RGB24ToARGB
 
 // RGB little endian (bgr in memory) to ARGB.
 LIBYUV_API
-int RGB24ToARGB(const uint8* src_frame,
-                int src_stride_frame,
-                uint8* dst_argb,
+int RGB24ToARGB(const uint8_t* src_rgb24,
+                int src_stride_rgb24,
+                uint8_t* dst_argb,
                 int dst_stride_argb,
                 int width,
                 int height);
 
 // RGB big endian (rgb in memory) to ARGB.
 LIBYUV_API
-int RAWToARGB(const uint8* src_frame,
-              int src_stride_frame,
-              uint8* dst_argb,
+int RAWToARGB(const uint8_t* src_raw,
+              int src_stride_raw,
+              uint8_t* dst_argb,
               int dst_stride_argb,
               int width,
               int height);
 
 // RGB16 (RGBP fourcc) little endian to ARGB.
 LIBYUV_API
-int RGB565ToARGB(const uint8* src_frame,
-                 int src_stride_frame,
-                 uint8* dst_argb,
+int RGB565ToARGB(const uint8_t* src_rgb565,
+                 int src_stride_rgb565,
+                 uint8_t* dst_argb,
                  int dst_stride_argb,
                  int width,
                  int height);
 
 // RGB15 (RGBO fourcc) little endian to ARGB.
 LIBYUV_API
-int ARGB1555ToARGB(const uint8* src_frame,
-                   int src_stride_frame,
-                   uint8* dst_argb,
+int ARGB1555ToARGB(const uint8_t* src_argb1555,
+                   int src_stride_argb1555,
+                   uint8_t* dst_argb,
                    int dst_stride_argb,
                    int width,
                    int height);
 
 // RGB12 (R444 fourcc) little endian to ARGB.
 LIBYUV_API
-int ARGB4444ToARGB(const uint8* src_frame,
-                   int src_stride_frame,
-                   uint8* dst_argb,
+int ARGB4444ToARGB(const uint8_t* src_argb4444,
+                   int src_stride_argb4444,
+                   uint8_t* dst_argb,
                    int dst_stride_argb,
                    int width,
                    int height);
 
+// Aliases
+#define AB30ToARGB AR30ToABGR
+#define AB30ToABGR AR30ToARGB
+#define AB30ToAR30 AR30ToAB30
+
+// Convert AR30 To ARGB.
+LIBYUV_API
+int AR30ToARGB(const uint8_t* src_ar30,
+               int src_stride_ar30,
+               uint8_t* dst_argb,
+               int dst_stride_argb,
+               int width,
+               int height);
+
+// Convert AR30 To ABGR.
+LIBYUV_API
+int AR30ToABGR(const uint8_t* src_ar30,
+               int src_stride_ar30,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert AR30 To AB30.
+LIBYUV_API
+int AR30ToAB30(const uint8_t* src_ar30,
+               int src_stride_ar30,
+               uint8_t* dst_ab30,
+               int dst_stride_ab30,
+               int width,
+               int height);
+
 #ifdef HAVE_JPEG
 // src_width/height provided by capture
 // dst_width/height for clipping determine final size.
 LIBYUV_API
-int MJPGToARGB(const uint8* sample,
+int MJPGToARGB(const uint8_t* sample,
                size_t sample_size,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int src_width,
                int src_height,
                int dst_width,
                int dst_height);
 #endif
 
+// Convert Android420 to ARGB.
+LIBYUV_API
+int Android420ToARGB(const uint8_t* src_y,
+                     int src_stride_y,
+                     const uint8_t* src_u,
+                     int src_stride_u,
+                     const uint8_t* src_v,
+                     int src_stride_v,
+                     int src_pixel_stride_uv,
+                     uint8_t* dst_argb,
+                     int dst_stride_argb,
+                     int width,
+                     int height);
+
+// Convert Android420 to ABGR.
+LIBYUV_API
+int Android420ToABGR(const uint8_t* src_y,
+                     int src_stride_y,
+                     const uint8_t* src_u,
+                     int src_stride_u,
+                     const uint8_t* src_v,
+                     int src_stride_v,
+                     int src_pixel_stride_uv,
+                     uint8_t* dst_abgr,
+                     int dst_stride_abgr,
+                     int width,
+                     int height);
+
 // Convert camera sample to ARGB with cropping, rotation and vertical flip.
-// "src_size" is needed to parse MJPG.
+// "sample_size" is needed to parse MJPG.
 // "dst_stride_argb" number of bytes in a row of the dst_argb plane.
 //   Normally this would be the same as dst_width, with recommended alignment
 //   to 16 bytes for better efficiency.
 //   If rotation of 90 or 270 is used, stride is affected. The caller should
 //   allocate the I420 buffer according to rotation.
 // "dst_stride_u" number of bytes in a row of the dst_u plane.
 //   Normally this would be the same as (dst_width + 1) / 2, with
 //   recommended alignment to 16 bytes for better efficiency.
@@ -437,30 +670,30 @@ int MJPGToARGB(const uint8* sample,
 //   To center, crop_x = (src_width - dst_width) / 2
 //              crop_y = (src_height - dst_height) / 2
 // "src_width" / "src_height" is size of src_frame in pixels.
 //   "src_height" can be negative indicating a vertically flipped image source.
 // "crop_width" / "crop_height" is the size to crop the src to.
 //    Must be less than or equal to src_width/src_height
 //    Cropping parameters are pre-rotation.
 // "rotation" can be 0, 90, 180 or 270.
-// "format" is a fourcc. ie 'I420', 'YUY2'
+// "fourcc" is a fourcc. ie 'I420', 'YUY2'
 // Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
 LIBYUV_API
-int ConvertToARGB(const uint8* src_frame,
-                  size_t src_size,
-                  uint8* dst_argb,
+int ConvertToARGB(const uint8_t* sample,
+                  size_t sample_size,
+                  uint8_t* dst_argb,
                   int dst_stride_argb,
                   int crop_x,
                   int crop_y,
                   int src_width,
                   int src_height,
                   int crop_width,
                   int crop_height,
                   enum RotationMode rotation,
-                  uint32 format);
+                  uint32_t fourcc);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
 
 #endif  // INCLUDE_LIBYUV_CONVERT_ARGB_H_
--- a/media/libyuv/libyuv/include/libyuv/convert_from.h
+++ b/media/libyuv/libyuv/include/libyuv/convert_from.h
@@ -16,250 +16,327 @@
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
 // See Also convert.h for conversions from formats to I420.
 
-// I420Copy in convert to I420ToI420.
-
-LIBYUV_API
-int I420ToI422(const uint8* src_y,
+// Convert 8 bit YUV to 10 bit.
+#define H420ToH010 I420ToI010
+int I420ToI010(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint16_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint16_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint16_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToI444(const uint8* src_y,
+int I420ToI422(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
+               int dst_stride_v,
+               int width,
+               int height);
+
+LIBYUV_API
+int I420ToI444(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_u,
+               int dst_stride_u,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Copy to I400. Source can be I420, I422, I444, I400, NV12 or NV21.
 LIBYUV_API
-int I400Copy(const uint8* src_y,
+int I400Copy(const uint8_t* src_y,
              int src_stride_y,
-             uint8* dst_y,
+             uint8_t* dst_y,
              int dst_stride_y,
              int width,
              int height);
 
 LIBYUV_API
-int I420ToNV12(const uint8* src_y,
+int I420ToNV12(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_uv,
+               uint8_t* dst_uv,
                int dst_stride_uv,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToNV21(const uint8* src_y,
+int I420ToNV21(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_vu,
+               uint8_t* dst_vu,
                int dst_stride_vu,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToYUY2(const uint8* src_y,
+int I420ToYUY2(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_frame,
-               int dst_stride_frame,
+               uint8_t* dst_yuy2,
+               int dst_stride_yuy2,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToUYVY(const uint8* src_y,
+int I420ToUYVY(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_frame,
-               int dst_stride_frame,
+               uint8_t* dst_uyvy,
+               int dst_stride_uyvy,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToARGB(const uint8* src_y,
+int I420ToARGB(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
-               int dst_stride_argb,
-               int width,
-               int height);
-
-LIBYUV_API
-int I420ToBGRA(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToABGR(const uint8* src_y,
+int I420ToBGRA(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_argb,
-               int dst_stride_argb,
+               uint8_t* dst_bgra,
+               int dst_stride_bgra,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToRGBA(const uint8* src_y,
+int I420ToABGR(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_rgba,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+LIBYUV_API
+int I420ToRGBA(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_rgba,
                int dst_stride_rgba,
                int width,
                int height);
 
 LIBYUV_API
-int I420ToRGB24(const uint8* src_y,
+int I420ToRGB24(const uint8_t* src_y,
                 int src_stride_y,
-                const uint8* src_u,
+                const uint8_t* src_u,
                 int src_stride_u,
-                const uint8* src_v,
+                const uint8_t* src_v,
                 int src_stride_v,
-                uint8* dst_frame,
-                int dst_stride_frame,
+                uint8_t* dst_rgb24,
+                int dst_stride_rgb24,
                 int width,
                 int height);
 
 LIBYUV_API
-int I420ToRAW(const uint8* src_y,
+int I420ToRAW(const uint8_t* src_y,
               int src_stride_y,
-              const uint8* src_u,
+              const uint8_t* src_u,
               int src_stride_u,
-              const uint8* src_v,
+              const uint8_t* src_v,
               int src_stride_v,
-              uint8* dst_frame,
-              int dst_stride_frame,
+              uint8_t* dst_raw,
+              int dst_stride_raw,
               int width,
               int height);
 
 LIBYUV_API
-int I420ToRGB565(const uint8* src_y,
+int H420ToRGB24(const uint8_t* src_y,
+                int src_stride_y,
+                const uint8_t* src_u,
+                int src_stride_u,
+                const uint8_t* src_v,
+                int src_stride_v,
+                uint8_t* dst_rgb24,
+                int dst_stride_rgb24,
+                int width,
+                int height);
+
+LIBYUV_API
+int H420ToRAW(const uint8_t* src_y,
+              int src_stride_y,
+              const uint8_t* src_u,
+              int src_stride_u,
+              const uint8_t* src_v,
+              int src_stride_v,
+              uint8_t* dst_raw,
+              int dst_stride_raw,
+              int width,
+              int height);
+
+LIBYUV_API
+int I420ToRGB565(const uint8_t* src_y,
                  int src_stride_y,
-                 const uint8* src_u,
+                 const uint8_t* src_u,
                  int src_stride_u,
-                 const uint8* src_v,
+                 const uint8_t* src_v,
                  int src_stride_v,
-                 uint8* dst_frame,
-                 int dst_stride_frame,
+                 uint8_t* dst_rgb565,
+                 int dst_stride_rgb565,
+                 int width,
+                 int height);
+
+LIBYUV_API
+int I422ToRGB565(const uint8_t* src_y,
+                 int src_stride_y,
+                 const uint8_t* src_u,
+                 int src_stride_u,
+                 const uint8_t* src_v,
+                 int src_stride_v,
+                 uint8_t* dst_rgb565,
+                 int dst_stride_rgb565,
                  int width,
                  int height);
 
 // Convert I420 To RGB565 with 4x4 dither matrix (16 bytes).
 // Values in dither matrix from 0 to 7 recommended.
 // The order of the dither matrix is first byte is upper left.
 
 LIBYUV_API
-int I420ToRGB565Dither(const uint8* src_y,
+int I420ToRGB565Dither(const uint8_t* src_y,
                        int src_stride_y,
-                       const uint8* src_u,
+                       const uint8_t* src_u,
                        int src_stride_u,
-                       const uint8* src_v,
+                       const uint8_t* src_v,
                        int src_stride_v,
-                       uint8* dst_frame,
-                       int dst_stride_frame,
-                       const uint8* dither4x4,
+                       uint8_t* dst_rgb565,
+                       int dst_stride_rgb565,
+                       const uint8_t* dither4x4,
                        int width,
                        int height);
 
 LIBYUV_API
-int I420ToARGB1555(const uint8* src_y,
+int I420ToARGB1555(const uint8_t* src_y,
                    int src_stride_y,
-                   const uint8* src_u,
+                   const uint8_t* src_u,
                    int src_stride_u,
-                   const uint8* src_v,
+                   const uint8_t* src_v,
                    int src_stride_v,
-                   uint8* dst_frame,
-                   int dst_stride_frame,
+                   uint8_t* dst_argb1555,
+                   int dst_stride_argb1555,
                    int width,
                    int height);
 
 LIBYUV_API
-int I420ToARGB4444(const uint8* src_y,
+int I420ToARGB4444(const uint8_t* src_y,
                    int src_stride_y,
-                   const uint8* src_u,
+                   const uint8_t* src_u,
                    int src_stride_u,
-                   const uint8* src_v,
+                   const uint8_t* src_v,
                    int src_stride_v,
-                   uint8* dst_frame,
-                   int dst_stride_frame,
+                   uint8_t* dst_argb4444,
+                   int dst_stride_argb4444,
                    int width,
                    int height);
 
+// Convert I420 to AR30.
+LIBYUV_API
+int I420ToAR30(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_ar30,
+               int dst_stride_ar30,
+               int width,
+               int height);
+
+// Convert H420 to AR30.
+LIBYUV_API
+int H420ToAR30(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_ar30,
+               int dst_stride_ar30,
+               int width,
+               int height);
+
 // Convert I420 to specified format.
 // "dst_sample_stride" is bytes in a row for the destination. Pass 0 if the
 //    buffer has contiguous rows. Can be negative. A multiple of 16 is optimal.
 LIBYUV_API
-int ConvertFromI420(const uint8* y,
+int ConvertFromI420(const uint8_t* y,
                     int y_stride,
-                    const uint8* u,
+                    const uint8_t* u,
                     int u_stride,
-                    const uint8* v,
+                    const uint8_t* v,
                     int v_stride,
-                    uint8* dst_sample,
+                    uint8_t* dst_sample,
                     int dst_sample_stride,
                     int width,
                     int height,
-                    uint32 format);
+                    uint32_t fourcc);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
 
 #endif  // INCLUDE_LIBYUV_CONVERT_FROM_H_
--- a/media/libyuv/libyuv/include/libyuv/convert_from_argb.h
+++ b/media/libyuv/libyuv/include/libyuv/convert_from_argb.h
@@ -16,248 +16,270 @@
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
 // Copy ARGB to ARGB.
 #define ARGBToARGB ARGBCopy
 LIBYUV_API
-int ARGBCopy(const uint8* src_argb,
+int ARGBCopy(const uint8_t* src_argb,
              int src_stride_argb,
-             uint8* dst_argb,
+             uint8_t* dst_argb,
              int dst_stride_argb,
              int width,
              int height);
 
 // Convert ARGB To BGRA.
 LIBYUV_API
-int ARGBToBGRA(const uint8* src_argb,
+int ARGBToBGRA(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_bgra,
+               uint8_t* dst_bgra,
                int dst_stride_bgra,
                int width,
                int height);
 
 // Convert ARGB To ABGR.
 LIBYUV_API
-int ARGBToABGR(const uint8* src_argb,
+int ARGBToABGR(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_abgr,
+               uint8_t* dst_abgr,
                int dst_stride_abgr,
                int width,
                int height);
 
 // Convert ARGB To RGBA.
 LIBYUV_API
-int ARGBToRGBA(const uint8* src_argb,
+int ARGBToRGBA(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_rgba,
+               uint8_t* dst_rgba,
                int dst_stride_rgba,
                int width,
                int height);
 
+// Aliases
+#define ARGBToAB30 ABGRToAR30
+#define ABGRToAB30 ARGBToAR30
+
+// Convert ABGR To AR30.
+LIBYUV_API
+int ABGRToAR30(const uint8_t* src_abgr,
+               int src_stride_abgr,
+               uint8_t* dst_ar30,
+               int dst_stride_ar30,
+               int width,
+               int height);
+
+// Convert ARGB To AR30.
+LIBYUV_API
+int ARGBToAR30(const uint8_t* src_argb,
+               int src_stride_argb,
+               uint8_t* dst_ar30,
+               int dst_stride_ar30,
+               int width,
+               int height);
+
 // Convert ARGB To RGB24.
 LIBYUV_API
-int ARGBToRGB24(const uint8* src_argb,
+int ARGBToRGB24(const uint8_t* src_argb,
                 int src_stride_argb,
-                uint8* dst_rgb24,
+                uint8_t* dst_rgb24,
                 int dst_stride_rgb24,
                 int width,
                 int height);
 
 // Convert ARGB To RAW.
 LIBYUV_API
-int ARGBToRAW(const uint8* src_argb,
+int ARGBToRAW(const uint8_t* src_argb,
               int src_stride_argb,
-              uint8* dst_rgb,
-              int dst_stride_rgb,
+              uint8_t* dst_raw,
+              int dst_stride_raw,
               int width,
               int height);
 
 // Convert ARGB To RGB565.
 LIBYUV_API
-int ARGBToRGB565(const uint8* src_argb,
+int ARGBToRGB565(const uint8_t* src_argb,
                  int src_stride_argb,
-                 uint8* dst_rgb565,
+                 uint8_t* dst_rgb565,
                  int dst_stride_rgb565,
                  int width,
                  int height);
 
 // Convert ARGB To RGB565 with 4x4 dither matrix (16 bytes).
 // Values in dither matrix from 0 to 7 recommended.
 // The order of the dither matrix is first byte is upper left.
 // TODO(fbarchard): Consider pointer to 2d array for dither4x4.
-// const uint8(*dither)[4][4];
+// const uint8_t(*dither)[4][4];
 LIBYUV_API
-int ARGBToRGB565Dither(const uint8* src_argb,
+int ARGBToRGB565Dither(const uint8_t* src_argb,
                        int src_stride_argb,
-                       uint8* dst_rgb565,
+                       uint8_t* dst_rgb565,
                        int dst_stride_rgb565,
-                       const uint8* dither4x4,
+                       const uint8_t* dither4x4,
                        int width,
                        int height);
 
 // Convert ARGB To ARGB1555.
 LIBYUV_API
-int ARGBToARGB1555(const uint8* src_argb,
+int ARGBToARGB1555(const uint8_t* src_argb,
                    int src_stride_argb,
-                   uint8* dst_argb1555,
+                   uint8_t* dst_argb1555,
                    int dst_stride_argb1555,
                    int width,
                    int height);
 
 // Convert ARGB To ARGB4444.
 LIBYUV_API
-int ARGBToARGB4444(const uint8* src_argb,
+int ARGBToARGB4444(const uint8_t* src_argb,
                    int src_stride_argb,
-                   uint8* dst_argb4444,
+                   uint8_t* dst_argb4444,
                    int dst_stride_argb4444,
                    int width,
                    int height);
 
 // Convert ARGB To I444.
 LIBYUV_API
-int ARGBToI444(const uint8* src_argb,
+int ARGBToI444(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert ARGB To I422.
 LIBYUV_API
-int ARGBToI422(const uint8* src_argb,
+int ARGBToI422(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert ARGB To I420. (also in convert.h)
 LIBYUV_API
-int ARGBToI420(const uint8* src_argb,
+int ARGBToI420(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert ARGB to J420. (JPeg full range I420).
 LIBYUV_API
-int ARGBToJ420(const uint8* src_argb,
+int ARGBToJ420(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_yj,
+               uint8_t* dst_yj,
                int dst_stride_yj,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert ARGB to J422.
 LIBYUV_API
-int ARGBToJ422(const uint8* src_argb,
+int ARGBToJ422(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_yj,
+               uint8_t* dst_yj,
                int dst_stride_yj,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
                int width,
                int height);
 
 // Convert ARGB to J400. (JPeg full range).
 LIBYUV_API
-int ARGBToJ400(const uint8* src_argb,
+int ARGBToJ400(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_yj,
+               uint8_t* dst_yj,
                int dst_stride_yj,
                int width,
                int height);
 
 // Convert ARGB to I400.
 LIBYUV_API
-int ARGBToI400(const uint8* src_argb,
+int ARGBToI400(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
                int width,
                int height);
 
 // Convert ARGB to G. (Reverse of J400toARGB, which replicates G back to ARGB)
 LIBYUV_API
-int ARGBToG(const uint8* src_argb,
+int ARGBToG(const uint8_t* src_argb,
             int src_stride_argb,
-            uint8* dst_g,
+            uint8_t* dst_g,
             int dst_stride_g,
             int width,
             int height);
 
 // Convert ARGB To NV12.
 LIBYUV_API
-int ARGBToNV12(const uint8* src_argb,
+int ARGBToNV12(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_uv,
+               uint8_t* dst_uv,
                int dst_stride_uv,
                int width,
                int height);
 
 // Convert ARGB To NV21.
 LIBYUV_API
-int ARGBToNV21(const uint8* src_argb,
+int ARGBToNV21(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_vu,
+               uint8_t* dst_vu,
                int dst_stride_vu,
                int width,
                int height);
 
 // Convert ARGB To NV21.
 LIBYUV_API
-int ARGBToNV21(const uint8* src_argb,
+int ARGBToNV21(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_vu,
+               uint8_t* dst_vu,
                int dst_stride_vu,
                int width,
                int height);
 
 // Convert ARGB To YUY2.
 LIBYUV_API
-int ARGBToYUY2(const uint8* src_argb,
+int ARGBToYUY2(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_yuy2,
+               uint8_t* dst_yuy2,
                int dst_stride_yuy2,
                int width,
                int height);
 
 // Convert ARGB To UYVY.
 LIBYUV_API
-int ARGBToUYVY(const uint8* src_argb,
+int ARGBToUYVY(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_uyvy,
+               uint8_t* dst_uyvy,
                int dst_stride_uyvy,
                int width,
                int height);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
--- a/media/libyuv/libyuv/include/libyuv/cpu_id.h
+++ b/media/libyuv/libyuv/include/libyuv/cpu_id.h
@@ -31,53 +31,64 @@ static const int kCpuHasX86 = 0x10;
 static const int kCpuHasSSE2 = 0x20;
 static const int kCpuHasSSSE3 = 0x40;
 static const int kCpuHasSSE41 = 0x80;
 static const int kCpuHasSSE42 = 0x100;  // unused at this time.
 static const int kCpuHasAVX = 0x200;
 static const int kCpuHasAVX2 = 0x400;
 static const int kCpuHasERMS = 0x800;
 static const int kCpuHasFMA3 = 0x1000;
-static const int kCpuHasAVX3 = 0x2000;
-static const int kCpuHasF16C = 0x4000;
-
-// 0x8000 reserved for future X86 flags.
+static const int kCpuHasF16C = 0x2000;
+static const int kCpuHasGFNI = 0x4000;
+static const int kCpuHasAVX512BW = 0x8000;
+static const int kCpuHasAVX512VL = 0x10000;
+static const int kCpuHasAVX512VBMI = 0x20000;
+static const int kCpuHasAVX512VBMI2 = 0x40000;
+static const int kCpuHasAVX512VBITALG = 0x80000;
+static const int kCpuHasAVX512VPOPCNTDQ = 0x100000;
 
 // These flags are only valid on MIPS processors.
-static const int kCpuHasMIPS = 0x10000;
-static const int kCpuHasDSPR2 = 0x20000;
-static const int kCpuHasMSA = 0x40000;
+static const int kCpuHasMIPS = 0x200000;
+static const int kCpuHasMSA = 0x400000;
 
-// Internal function used to auto-init.
+// Optional init function. TestCpuFlag does an auto-init.
+// Returns cpu_info flags.
 LIBYUV_API
 int InitCpuFlags(void);
 
+// Detect CPU has SSE2 etc.
+// Test_flag parameter should be one of kCpuHas constants above.
+// Returns non-zero if instruction set is detected
+static __inline int TestCpuFlag(int test_flag) {
+  LIBYUV_API extern int cpu_info_;
+#ifdef __ATOMIC_RELAXED
+  int cpu_info = __atomic_load_n(&cpu_info_, __ATOMIC_RELAXED);
+#else
+  int cpu_info = cpu_info_;
+#endif
+  return (!cpu_info ? InitCpuFlags() : cpu_info) & test_flag;
+}
+
 // Internal function for parsing /proc/cpuinfo.
 LIBYUV_API
 int ArmCpuCaps(const char* cpuinfo_name);
 
-// Detect CPU has SSE2 etc.
-// Test_flag parameter should be one of kCpuHas constants above.
-// returns non-zero if instruction set is detected
-static __inline int TestCpuFlag(int test_flag) {
-  LIBYUV_API extern int cpu_info_;
-  return (!cpu_info_ ? InitCpuFlags() : cpu_info_) & test_flag;
-}
-
 // For testing, allow CPU flags to be disabled.
 // ie MaskCpuFlags(~kCpuHasSSSE3) to disable SSSE3.
 // MaskCpuFlags(-1) to enable all cpu specific optimizations.
 // MaskCpuFlags(1) to disable all cpu specific optimizations.
+// MaskCpuFlags(0) to reset state so next call will auto init.
+// Returns cpu_info flags.
 LIBYUV_API
-void MaskCpuFlags(int enable_flags);
+int MaskCpuFlags(int enable_flags);
 
 // Low level cpuid for X86. Returns zeros on other CPUs.
 // eax is the info type that you want.
 // ecx is typically the cpu number, and should normally be zero.
 LIBYUV_API
-void CpuId(uint32 eax, uint32 ecx, uint32* cpu_info);
+void CpuId(int info_eax, int info_ecx, int* cpu_info);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
 
 #endif  // INCLUDE_LIBYUV_CPU_ID_H_
--- a/media/libyuv/libyuv/include/libyuv/macros_msa.h
+++ b/media/libyuv/libyuv/include/libyuv/macros_msa.h
@@ -11,48 +11,48 @@
 #ifndef INCLUDE_LIBYUV_MACROS_MSA_H_
 #define INCLUDE_LIBYUV_MACROS_MSA_H_
 
 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
 #include <msa.h>
 #include <stdint.h>
 
 #if (__mips_isa_rev >= 6)
-#define LW(psrc)                                    \
-  ({                                                \
-    uint8* psrc_lw_m = (uint8*)(psrc); /* NOLINT */ \
-    uint32 val_m;                                   \
-    asm volatile("lw  %[val_m],  %[psrc_lw_m]  \n"  \
-                 : [val_m] "=r"(val_m)              \
-                 : [psrc_lw_m] "m"(*psrc_lw_m));    \
-    val_m;                                          \
+#define LW(psrc)                                        \
+  ({                                                    \
+    uint8_t* psrc_lw_m = (uint8_t*)(psrc); /* NOLINT */ \
+    uint32_t val_m;                                     \
+    asm volatile("lw  %[val_m],  %[psrc_lw_m]  \n"      \
+                 : [val_m] "=r"(val_m)                  \
+                 : [psrc_lw_m] "m"(*psrc_lw_m));        \
+    val_m;                                              \
   })
 
 #if (__mips == 64)
-#define LD(psrc)                                    \
-  ({                                                \
-    uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */ \
-    uint64 val_m = 0;                               \
-    asm volatile("ld  %[val_m],  %[psrc_ld_m]  \n"  \
-                 : [val_m] "=r"(val_m)              \
-                 : [psrc_ld_m] "m"(*psrc_ld_m));    \
-    val_m;                                          \
+#define LD(psrc)                                        \
+  ({                                                    \
+    uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */ \
+    uint64_t val_m = 0;                                 \
+    asm volatile("ld  %[val_m],  %[psrc_ld_m]  \n"      \
+                 : [val_m] "=r"(val_m)                  \
+                 : [psrc_ld_m] "m"(*psrc_ld_m));        \
+    val_m;                                              \
   })
 #else  // !(__mips == 64)
-#define LD(psrc)                                                       \
-  ({                                                                   \
-    uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */                    \
-    uint32 val0_m, val1_m;                                             \
-    uint64 val_m = 0;                                                  \
-    val0_m = LW(psrc_ld_m);                                            \
-    val1_m = LW(psrc_ld_m + 4);                                        \
-    val_m = (uint64)(val1_m);                             /* NOLINT */ \
-    val_m = (uint64)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
-    val_m = (uint64)(val_m | (uint64)val0_m);             /* NOLINT */ \
-    val_m;                                                             \
+#define LD(psrc)                                                         \
+  ({                                                                     \
+    uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */                  \
+    uint32_t val0_m, val1_m;                                             \
+    uint64_t val_m = 0;                                                  \
+    val0_m = LW(psrc_ld_m);                                              \
+    val1_m = LW(psrc_ld_m + 4);                                          \
+    val_m = (uint64_t)(val1_m);                             /* NOLINT */ \
+    val_m = (uint64_t)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
+    val_m = (uint64_t)(val_m | (uint64_t)val0_m);           /* NOLINT */ \
+    val_m;                                                               \
   })
 #endif  // (__mips == 64)
 
 #define SW(val, pdst)                                   \
   ({                                                    \
     uint8_t* pdst_sw_m = (uint8_t*)(pdst); /* NOLINT */ \
     uint32_t val_m = (val);                             \
     asm volatile("sw  %[val_m],  %[pdst_sw_m]  \n"      \
@@ -76,48 +76,48 @@
     uint32_t val0_m, val1_m;                                 \
     val0_m = (uint32_t)((val)&0x00000000FFFFFFFF);           \
     val1_m = (uint32_t)(((val) >> 32) & 0x00000000FFFFFFFF); \
     SW(val0_m, pdst_sd_m);                                   \
     SW(val1_m, pdst_sd_m + 4);                               \
   })
 #endif  // !(__mips == 64)
 #else   // !(__mips_isa_rev >= 6)
-#define LW(psrc)                                    \
-  ({                                                \
-    uint8* psrc_lw_m = (uint8*)(psrc); /* NOLINT */ \
-    uint32 val_m;                                   \
-    asm volatile("ulw  %[val_m],  %[psrc_lw_m]  \n" \
-                 : [val_m] "=r"(val_m)              \
-                 : [psrc_lw_m] "m"(*psrc_lw_m));    \
-    val_m;                                          \
+#define LW(psrc)                                        \
+  ({                                                    \
+    uint8_t* psrc_lw_m = (uint8_t*)(psrc); /* NOLINT */ \
+    uint32_t val_m;                                     \
+    asm volatile("ulw  %[val_m],  %[psrc_lw_m]  \n"     \
+                 : [val_m] "=r"(val_m)                  \
+                 : [psrc_lw_m] "m"(*psrc_lw_m));        \
+    val_m;                                              \
   })
 
 #if (__mips == 64)
-#define LD(psrc)                                    \
-  ({                                                \
-    uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */ \
-    uint64 val_m = 0;                               \
-    asm volatile("uld  %[val_m],  %[psrc_ld_m]  \n" \
-                 : [val_m] "=r"(val_m)              \
-                 : [psrc_ld_m] "m"(*psrc_ld_m));    \
-    val_m;                                          \
+#define LD(psrc)                                        \
+  ({                                                    \
+    uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */ \
+    uint64_t val_m = 0;                                 \
+    asm volatile("uld  %[val_m],  %[psrc_ld_m]  \n"     \
+                 : [val_m] "=r"(val_m)                  \
+                 : [psrc_ld_m] "m"(*psrc_ld_m));        \
+    val_m;                                              \
   })
 #else  // !(__mips == 64)
-#define LD(psrc)                                                       \
-  ({                                                                   \
-    uint8* psrc_ld_m = (uint8*)(psrc); /* NOLINT */                    \
-    uint32 val0_m, val1_m;                                             \
-    uint64 val_m = 0;                                                  \
-    val0_m = LW(psrc_ld_m);                                            \
-    val1_m = LW(psrc_ld_m + 4);                                        \
-    val_m = (uint64)(val1_m);                             /* NOLINT */ \
-    val_m = (uint64)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
-    val_m = (uint64)(val_m | (uint64)val0_m);             /* NOLINT */ \
-    val_m;                                                             \
+#define LD(psrc)                                                         \
+  ({                                                                     \
+    uint8_t* psrc_ld_m = (uint8_t*)(psrc); /* NOLINT */                  \
+    uint32_t val0_m, val1_m;                                             \
+    uint64_t val_m = 0;                                                  \
+    val0_m = LW(psrc_ld_m);                                              \
+    val1_m = LW(psrc_ld_m + 4);                                          \
+    val_m = (uint64_t)(val1_m);                             /* NOLINT */ \
+    val_m = (uint64_t)((val_m << 32) & 0xFFFFFFFF00000000); /* NOLINT */ \
+    val_m = (uint64_t)(val_m | (uint64_t)val0_m);           /* NOLINT */ \
+    val_m;                                                               \
   })
 #endif  // (__mips == 64)
 
 #define SW(val, pdst)                                   \
   ({                                                    \
     uint8_t* pdst_sw_m = (uint8_t*)(pdst); /* NOLINT */ \
     uint32_t val_m = (val);                             \
     asm volatile("usw  %[val_m],  %[pdst_sw_m]  \n"     \
--- a/media/libyuv/libyuv/include/libyuv/mjpeg_decoder.h
+++ b/media/libyuv/libyuv/include/libyuv/mjpeg_decoder.h
@@ -21,34 +21,34 @@ struct jpeg_decompress_struct;
 struct jpeg_source_mgr;
 
 namespace libyuv {
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-LIBYUV_BOOL ValidateJpeg(const uint8* sample, size_t sample_size);
+LIBYUV_BOOL ValidateJpeg(const uint8_t* sample, size_t sample_size);
 
 #ifdef __cplusplus
 }  // extern "C"
 #endif
 
-static const uint32 kUnknownDataSize = 0xFFFFFFFF;
+static const uint32_t kUnknownDataSize = 0xFFFFFFFF;
 
 enum JpegSubsamplingType {
   kJpegYuv420,
   kJpegYuv422,
   kJpegYuv444,
   kJpegYuv400,
   kJpegUnknown
 };
 
 struct Buffer {
-  const uint8* data;
+  const uint8_t* data;
   int len;
 };
 
 struct BufferVector {
   Buffer* buffers;
   int len;
   int pos;
 };
@@ -60,17 +60,17 @@ struct SetJmpErrorMgr;
 // It is rarely used in video transmission, but is common as a camera capture
 // format, especially in Logitech devices. This class implements a decoder for
 // MJPEG frames.
 //
 // See http://tools.ietf.org/html/rfc2435
 class LIBYUV_API MJpegDecoder {
  public:
   typedef void (*CallbackFunction)(void* opaque,
-                                   const uint8* const* data,
+                                   const uint8_t* const* data,
                                    const int* strides,
                                    int rows);
 
   static const int kColorSpaceUnknown;
   static const int kColorSpaceGrayscale;
   static const int kColorSpaceRgb;
   static const int kColorSpaceYCbCr;
   static const int kColorSpaceCMYK;
@@ -80,17 +80,17 @@ class LIBYUV_API MJpegDecoder {
   ~MJpegDecoder();
 
   // Loads a new frame, reads its headers, and determines the uncompressed
   // image format.
   // Returns LIBYUV_TRUE if image looks valid and format is supported.
   // If return value is LIBYUV_TRUE, then the values for all the following
   // getters are populated.
   // src_len is the size of the compressed mjpeg frame in bytes.
-  LIBYUV_BOOL LoadFrame(const uint8* src, size_t src_len);
+  LIBYUV_BOOL LoadFrame(const uint8_t* src, size_t src_len);
 
   // Returns width of the last loaded frame in pixels.
   int GetWidth();
 
   // Returns height of the last loaded frame in pixels.
   int GetHeight();
 
   // Returns format of the last loaded frame. The return value is one of the
@@ -133,17 +133,17 @@ class LIBYUV_API MJpegDecoder {
 
   // Decodes the entire image into a one-buffer-per-color-component format.
   // dst_width must match exactly. dst_height must be <= to image height; if
   // less, the image is cropped. "planes" must have size equal to at least
   // GetNumComponents() and they must point to non-overlapping buffers of size
   // at least GetComponentSize(i). The pointers in planes are incremented
   // to point to after the end of the written data.
   // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
-  LIBYUV_BOOL DecodeToBuffers(uint8** planes, int dst_width, int dst_height);
+  LIBYUV_BOOL DecodeToBuffers(uint8_t** planes, int dst_width, int dst_height);
 
   // Decodes the entire image and passes the data via repeated calls to a
   // callback function. Each call will get the data for a whole number of
   // image scanlines.
   // TODO(fbarchard): Add dst_x, dst_y to allow specific rect to be decoded.
   LIBYUV_BOOL DecodeToCallback(CallbackFunction fn,
                                void* opaque,
                                int dst_width,
@@ -157,39 +157,39 @@ class LIBYUV_API MJpegDecoder {
 
  private:
   void AllocOutputBuffers(int num_outbufs);
   void DestroyOutputBuffers();
 
   LIBYUV_BOOL StartDecode();
   LIBYUV_BOOL FinishDecode();
 
-  void SetScanlinePointers(uint8** data);
+  void SetScanlinePointers(uint8_t** data);
   LIBYUV_BOOL DecodeImcuRow();
 
   int GetComponentScanlinePadding(int component);
 
   // A buffer holding the input data for a frame.
-  Buffer buf_;
-  BufferVector buf_vec_;
+  Buffer buf_{};
+  BufferVector buf_vec_{};
 
   jpeg_decompress_struct* decompress_struct_;
   jpeg_source_mgr* source_mgr_;
   SetJmpErrorMgr* error_mgr_;
 
   // LIBYUV_TRUE iff at least one component has scanline padding. (i.e.,
   // GetComponentScanlinePadding() != 0.)
   LIBYUV_BOOL has_scanline_padding_;
 
   // Temporaries used to point to scanline outputs.
   int num_outbufs_;  // Outermost size of all arrays below.
-  uint8*** scanlines_;
-  int* scanlines_sizes_;
+  uint8_t*** scanlines_{};
+  int* scanlines_sizes_{};
   // Temporary buffer used for decoding when we can't decode directly to the
   // output buffers. Large enough for just one iMCU row.
-  uint8** databuf_;
-  int* databuf_strides_;
+  uint8_t** databuf_{};
+  int* databuf_strides_{};
 };
 
 }  // namespace libyuv
 
 #endif  //  __cplusplus
 #endif  // INCLUDE_LIBYUV_MJPEG_DECODER_H_
--- a/media/libyuv/libyuv/include/libyuv/planar_functions.h
+++ b/media/libyuv/libyuv/include/libyuv/planar_functions.h
@@ -17,778 +17,829 @@
 #include "libyuv/convert.h"
 #include "libyuv/convert_argb.h"
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
-// Copy a plane of data.
-LIBYUV_API
-void CopyPlane(const uint8* src_y,
-               int src_stride_y,
-               uint8* dst_y,
-               int dst_stride_y,
-               int width,
-               int height);
-
-LIBYUV_API
-void CopyPlane_16(const uint16* src_y,
-                  int src_stride_y,
-                  uint16* dst_y,
-                  int dst_stride_y,
-                  int width,
-                  int height);
-
-// Set a plane of data to a 32 bit value.
-LIBYUV_API
-void SetPlane(uint8* dst_y,
-              int dst_stride_y,
-              int width,
-              int height,
-              uint32 value);
-
-// Split interleaved UV plane into separate U and V planes.
-LIBYUV_API
-void SplitUVPlane(const uint8* src_uv,
-                  int src_stride_uv,
-                  uint8* dst_u,
-                  int dst_stride_u,
-                  uint8* dst_v,
-                  int dst_stride_v,
-                  int width,
-                  int height);
-
-// Merge separate U and V planes into one interleaved UV plane.
-LIBYUV_API
-void MergeUVPlane(const uint8* src_u,
-                  int src_stride_u,
-                  const uint8* src_v,
-                  int src_stride_v,
-                  uint8* dst_uv,
-                  int dst_stride_uv,
-                  int width,
-                  int height);
-
-// Copy I400.  Supports inverting.
-LIBYUV_API
-int I400ToI400(const uint8* src_y,
-               int src_stride_y,
-               uint8* dst_y,
-               int dst_stride_y,
-               int width,
-               int height);
-
-#define J400ToJ400 I400ToI400
-
-// Copy I422 to I422.
-#define I422ToI422 I422Copy
-LIBYUV_API
-int I422Copy(const uint8* src_y,
-             int src_stride_y,
-             const uint8* src_u,
-             int src_stride_u,
-             const uint8* src_v,
-             int src_stride_v,
-             uint8* dst_y,
-             int dst_stride_y,
-             uint8* dst_u,
-             int dst_stride_u,
-             uint8* dst_v,
-             int dst_stride_v,
-             int width,
-             int height);
-
-// Copy I444 to I444.
-#define I444ToI444 I444Copy
-LIBYUV_API
-int I444Copy(const uint8* src_y,
-             int src_stride_y,
-             const uint8* src_u,
-             int src_stride_u,
-             const uint8* src_v,
-             int src_stride_v,
-             uint8* dst_y,
-             int dst_stride_y,
-             uint8* dst_u,
-             int dst_stride_u,
-             uint8* dst_v,
-             int dst_stride_v,
-             int width,
-             int height);
-
-// Convert YUY2 to I422.
-LIBYUV_API
-int YUY2ToI422(const uint8* src_yuy2,
-               int src_stride_yuy2,
-               uint8* dst_y,
-               int dst_stride_y,
-               uint8* dst_u,
-               int dst_stride_u,
-               uint8* dst_v,
-               int dst_stride_v,
-               int width,
-               int height);
-
-// Convert UYVY to I422.
-LIBYUV_API
-int UYVYToI422(const uint8* src_uyvy,
-               int src_stride_uyvy,
-               uint8* dst_y,
-               int dst_stride_y,
-               uint8* dst_u,
-               int dst_stride_u,
-               uint8* dst_v,
-               int dst_stride_v,
-               int width,
-               int height);
-
-LIBYUV_API
-int YUY2ToNV12(const uint8* src_yuy2,
-               int src_stride_yuy2,
-               uint8* dst_y,
-               int dst_stride_y,
-               uint8* dst_uv,
-               int dst_stride_uv,
-               int width,
-               int height);
-
-LIBYUV_API
-int UYVYToNV12(const uint8* src_uyvy,
-               int src_stride_uyvy,
-               uint8* dst_y,
-               int dst_stride_y,
-               uint8* dst_uv,
-               int dst_stride_uv,
-               int width,
-               int height);
-
-LIBYUV_API
-int YUY2ToY(const uint8* src_yuy2,
-            int src_stride_yuy2,
-            uint8* dst_y,
-            int dst_stride_y,
-            int width,
-            int height);
-
-// Convert I420 to I400. (calls CopyPlane ignoring u/v).
-LIBYUV_API
-int I420ToI400(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_y,
-               int dst_stride_y,
-               int width,
-               int height);
-
-// Alias
-#define J420ToJ400 I420ToI400
-#define I420ToI420Mirror I420Mirror
-
-// I420 mirror.
-LIBYUV_API
-int I420Mirror(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_y,
-               int dst_stride_y,
-               uint8* dst_u,
-               int dst_stride_u,
-               uint8* dst_v,
-               int dst_stride_v,
-               int width,
-               int height);
-
-// Alias
-#define I400ToI400Mirror I400Mirror
-
-// I400 mirror.  A single plane is mirrored horizontally.
-// Pass negative height to achieve 180 degree rotation.
-LIBYUV_API
-int I400Mirror(const uint8* src_y,
-               int src_stride_y,
-               uint8* dst_y,
-               int dst_stride_y,
-               int width,
-               int height);
-
-// Alias
-#define ARGBToARGBMirror ARGBMirror
-
-// ARGB mirror.
-LIBYUV_API
-int ARGBMirror(const uint8* src_argb,
-               int src_stride_argb,
-               uint8* dst_argb,
-               int dst_stride_argb,
-               int width,
-               int height);
-
-// Convert NV12 to RGB565.
-LIBYUV_API
-int NV12ToRGB565(const uint8* src_y,
-                 int src_stride_y,
-                 const uint8* src_uv,
-                 int src_stride_uv,
-                 uint8* dst_rgb565,
-                 int dst_stride_rgb565,
-                 int width,
-                 int height);
-
-// I422ToARGB is in convert_argb.h
-// Convert I422 to BGRA.
-LIBYUV_API
-int I422ToBGRA(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_bgra,
-               int dst_stride_bgra,
-               int width,
-               int height);
-
-// Convert I422 to ABGR.
-LIBYUV_API
-int I422ToABGR(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_abgr,
-               int dst_stride_abgr,
-               int width,
-               int height);
-
-// Convert I422 to RGBA.
-LIBYUV_API
-int I422ToRGBA(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_rgba,
-               int dst_stride_rgba,
-               int width,
-               int height);
-
-// Alias
-#define RGB24ToRAW RAWToRGB24
-
-LIBYUV_API
-int RAWToRGB24(const uint8* src_raw,
-               int src_stride_raw,
-               uint8* dst_rgb24,
-               int dst_stride_rgb24,
-               int width,
-               int height);
-
-// Draw a rectangle into I420.
-LIBYUV_API
-int I420Rect(uint8* dst_y,
-             int dst_stride_y,
-             uint8* dst_u,
-             int dst_stride_u,
-             uint8* dst_v,
-             int dst_stride_v,
-             int x,
-             int y,
-             int width,
-             int height,
-             int value_y,
-             int value_u,
-             int value_v);
-
-// Draw a rectangle into ARGB.
-LIBYUV_API
-int ARGBRect(uint8* dst_argb,
-             int dst_stride_argb,
-             int x,
-             int y,
-             int width,
-             int height,
-             uint32 value);
-
-// Convert ARGB to gray scale ARGB.
-LIBYUV_API
-int ARGBGrayTo(const uint8* src_argb,
-               int src_stride_argb,
-               uint8* dst_argb,
-               int dst_stride_argb,
-               int width,
-               int height);
-
-// Make a rectangle of ARGB gray scale.
-LIBYUV_API
-int ARGBGray(uint8* dst_argb,
-             int dst_stride_argb,
-             int x,
-             int y,
-             int width,
-             int height);
-
-// Make a rectangle of ARGB Sepia tone.
-LIBYUV_API
-int ARGBSepia(uint8* dst_argb,
-              int dst_stride_argb,
-              int x,
-              int y,
-              int width,
-              int height);
-
-// Apply a matrix rotation to each ARGB pixel.
-// matrix_argb is 4 signed ARGB values. -128 to 127 representing -2 to 2.
-// The first 4 coefficients apply to B, G, R, A and produce B of the output.
-// The next 4 coefficients apply to B, G, R, A and produce G of the output.
-// The next 4 coefficients apply to B, G, R, A and produce R of the output.
-// The last 4 coefficients apply to B, G, R, A and produce A of the output.
-LIBYUV_API
-int ARGBColorMatrix(const uint8* src_argb,
-                    int src_stride_argb,
-                    uint8* dst_argb,
-                    int dst_stride_argb,
-                    const int8* matrix_argb,
-                    int width,
-                    int height);
-
-// Deprecated. Use ARGBColorMatrix instead.
-// Apply a matrix rotation to each ARGB pixel.
-// matrix_argb is 3 signed ARGB values. -128 to 127 representing -1 to 1.
-// The first 4 coefficients apply to B, G, R, A and produce B of the output.
-// The next 4 coefficients apply to B, G, R, A and produce G of the output.
-// The last 4 coefficients apply to B, G, R, A and produce R of the output.
-LIBYUV_API
-int RGBColorMatrix(uint8* dst_argb,
-                   int dst_stride_argb,
-                   const int8* matrix_rgb,
-                   int x,
-                   int y,
-                   int width,
-                   int height);
-
-// Apply a color table each ARGB pixel.
-// Table contains 256 ARGB values.
-LIBYUV_API
-int ARGBColorTable(uint8* dst_argb,
-                   int dst_stride_argb,
-                   const uint8* table_argb,
-                   int x,
-                   int y,
-                   int width,
-                   int height);
-
-// Apply a color table each ARGB pixel but preserve destination alpha.
-// Table contains 256 ARGB values.
-LIBYUV_API
-int RGBColorTable(uint8* dst_argb,
-                  int dst_stride_argb,
-                  const uint8* table_argb,
-                  int x,
-                  int y,
-                  int width,
-                  int height);
-
-// Apply a luma/color table each ARGB pixel but preserve destination alpha.
-// Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from
-// RGB (YJ style) and C is an 8 bit color component (R, G or B).
-LIBYUV_API
-int ARGBLumaColorTable(const uint8* src_argb,
-                       int src_stride_argb,
-                       uint8* dst_argb,
-                       int dst_stride_argb,
-                       const uint8* luma_rgb_table,
-                       int width,
-                       int height);
-
-// Apply a 3 term polynomial to ARGB values.
-// poly points to a 4x4 matrix.  The first row is constants.  The 2nd row is
-// coefficients for b, g, r and a.  The 3rd row is coefficients for b squared,
-// g squared, r squared and a squared.  The 4rd row is coefficients for b to
-// the 3, g to the 3, r to the 3 and a to the 3.  The values are summed and
-// result clamped to 0 to 255.
-// A polynomial approximation can be dirived using software such as 'R'.
-
-LIBYUV_API
-int ARGBPolynomial(const uint8* src_argb,
-                   int src_stride_argb,
-                   uint8* dst_argb,
-                   int dst_stride_argb,
-                   const float* poly,
-                   int width,
-                   int height);
-
-// Convert plane of 16 bit shorts to half floats.
-// Source values are multiplied by scale before storing as half float.
-LIBYUV_API
-int HalfFloatPlane(const uint16* src_y,
-                   int src_stride_y,
-                   uint16* dst_y,
-                   int dst_stride_y,
-                   float scale,
-                   int width,
-                   int height);
-
-// Quantize a rectangle of ARGB. Alpha unaffected.
-// scale is a 16 bit fractional fixed point scaler between 0 and 65535.
-// interval_size should be a value between 1 and 255.
-// interval_offset should be a value between 0 and 255.
-LIBYUV_API
-int ARGBQuantize(uint8* dst_argb,
-                 int dst_stride_argb,
-                 int scale,
-                 int interval_size,
-                 int interval_offset,
-                 int x,
-                 int y,
-                 int width,
-                 int height);
-
-// Copy ARGB to ARGB.
-LIBYUV_API
-int ARGBCopy(const uint8* src_argb,
-             int src_stride_argb,
-             uint8* dst_argb,
-             int dst_stride_argb,
-             int width,
-             int height);
-
-// Copy Alpha channel of ARGB to alpha of ARGB.
-LIBYUV_API
-int ARGBCopyAlpha(const uint8* src_argb,
-                  int src_stride_argb,
-                  uint8* dst_argb,
-                  int dst_stride_argb,
-                  int width,
-                  int height);
-
-// Extract the alpha channel from ARGB.
-LIBYUV_API
-int ARGBExtractAlpha(const uint8* src_argb,
-                     int src_stride_argb,
-                     uint8* dst_a,
-                     int dst_stride_a,
-                     int width,
-                     int height);
-
-// Copy Y channel to Alpha of ARGB.
-LIBYUV_API
-int ARGBCopyYToAlpha(const uint8* src_y,
-                     int src_stride_y,
-                     uint8* dst_argb,
-                     int dst_stride_argb,
-                     int width,
-                     int height);
-
-typedef void (*ARGBBlendRow)(const uint8* src_argb0,
-                             const uint8* src_argb1,
-                             uint8* dst_argb,
-                             int width);
-
-// Get function to Alpha Blend ARGB pixels and store to destination.
-LIBYUV_API
-ARGBBlendRow GetARGBBlend();
-
-// Alpha Blend ARGB images and store to destination.
-// Source is pre-multiplied by alpha using ARGBAttenuate.
-// Alpha of destination is set to 255.
-LIBYUV_API
-int ARGBBlend(const uint8* src_argb0,
-              int src_stride_argb0,
-              const uint8* src_argb1,
-              int src_stride_argb1,
-              uint8* dst_argb,
-              int dst_stride_argb,
-              int width,
-              int height);
-
-// Alpha Blend plane and store to destination.
-// Source is not pre-multiplied by alpha.
-LIBYUV_API
-int BlendPlane(const uint8* src_y0,
-               int src_stride_y0,
-               const uint8* src_y1,
-               int src_stride_y1,
-               const uint8* alpha,
-               int alpha_stride,
-               uint8* dst_y,
-               int dst_stride_y,
-               int width,
-               int height);
-
-// Alpha Blend YUV images and store to destination.
-// Source is not pre-multiplied by alpha.
-// Alpha is full width x height and subsampled to half size to apply to UV.
-LIBYUV_API
-int I420Blend(const uint8* src_y0,
-              int src_stride_y0,
-              const uint8* src_u0,
-              int src_stride_u0,
-              const uint8* src_v0,
-              int src_stride_v0,
-              const uint8* src_y1,
-              int src_stride_y1,
-              const uint8* src_u1,
-              int src_stride_u1,
-              const uint8* src_v1,
-              int src_stride_v1,
-              const uint8* alpha,
-              int alpha_stride,
-              uint8* dst_y,
-              int dst_stride_y,
-              uint8* dst_u,
-              int dst_stride_u,
-              uint8* dst_v,
-              int dst_stride_v,
-              int width,
-              int height);
-
-// Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255.
-LIBYUV_API
-int ARGBMultiply(const uint8* src_argb0,
-                 int src_stride_argb0,
-                 const uint8* src_argb1,
-                 int src_stride_argb1,
-                 uint8* dst_argb,
-                 int dst_stride_argb,
-                 int width,
-                 int height);
-
-// Add ARGB image with ARGB image. Saturates to 255.
-LIBYUV_API
-int ARGBAdd(const uint8* src_argb0,
-            int src_stride_argb0,
-            const uint8* src_argb1,
-            int src_stride_argb1,
-            uint8* dst_argb,
-            int dst_stride_argb,
-            int width,
-            int height);
-
-// Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0.
-LIBYUV_API
-int ARGBSubtract(const uint8* src_argb0,
-                 int src_stride_argb0,
-                 const uint8* src_argb1,
-                 int src_stride_argb1,
-                 uint8* dst_argb,
-                 int dst_stride_argb,
-                 int width,
-                 int height);
-
-// Convert I422 to YUY2.
-LIBYUV_API
-int I422ToYUY2(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_frame,
-               int dst_stride_frame,
-               int width,
-               int height);
-
-// Convert I422 to UYVY.
-LIBYUV_API
-int I422ToUYVY(const uint8* src_y,
-               int src_stride_y,
-               const uint8* src_u,
-               int src_stride_u,
-               const uint8* src_v,
-               int src_stride_v,
-               uint8* dst_frame,
-               int dst_stride_frame,
-               int width,
-               int height);
-
-// Convert unattentuated ARGB to preattenuated ARGB.
-LIBYUV_API
-int ARGBAttenuate(const uint8* src_argb,
-                  int src_stride_argb,
-                  uint8* dst_argb,
-                  int dst_stride_argb,
-                  int width,
-                  int height);
-
-// Convert preattentuated ARGB to unattenuated ARGB.
-LIBYUV_API
-int ARGBUnattenuate(const uint8* src_argb,
-                    int src_stride_argb,
-                    uint8* dst_argb,
-                    int dst_stride_argb,
-                    int width,
-                    int height);
-
-// Internal function - do not call directly.
-// Computes table of cumulative sum for image where the value is the sum
-// of all values above and to the left of the entry. Used by ARGBBlur.
-LIBYUV_API
-int ARGBComputeCumulativeSum(const uint8* src_argb,
-                             int src_stride_argb,
-                             int32* dst_cumsum,
-                             int dst_stride32_cumsum,
-                             int width,
-                             int height);
-
-// Blur ARGB image.
-// dst_cumsum table of width * (height + 1) * 16 bytes aligned to
-//   16 byte boundary.
-// dst_stride32_cumsum is number of ints in a row (width * 4).
-// radius is number of pixels around the center.  e.g. 1 = 3x3. 2=5x5.
-// Blur is optimized for radius of 5 (11x11) or less.
-LIBYUV_API
-int ARGBBlur(const uint8* src_argb,
-             int src_stride_argb,
-             uint8* dst_argb,
-             int dst_stride_argb,
-             int32* dst_cumsum,
-             int dst_stride32_cumsum,
-             int width,
-             int height,
-             int radius);
-
-// Multiply ARGB image by ARGB value.
-LIBYUV_API
-int ARGBShade(const uint8* src_argb,
-              int src_stride_argb,
-              uint8* dst_argb,
-              int dst_stride_argb,
-              int width,
-              int height,
-              uint32 value);
-
-// Interpolate between two images using specified amount of interpolation
-// (0 to 255) and store to destination.
-// 'interpolation' is specified as 8 bit fraction where 0 means 100% src0
-// and 255 means 1% src0 and 99% src1.
-LIBYUV_API
-int InterpolatePlane(const uint8* src0,
-                     int src_stride0,
-                     const uint8* src1,
-                     int src_stride1,
-                     uint8* dst,
-                     int dst_stride,
-                     int width,
-                     int height,
-                     int interpolation);
-
-// Interpolate between two ARGB images using specified amount of interpolation
-// Internally calls InterpolatePlane with width * 4 (bpp).
-LIBYUV_API
-int ARGBInterpolate(const uint8* src_argb0,
-                    int src_stride_argb0,
-                    const uint8* src_argb1,
-                    int src_stride_argb1,
-                    uint8* dst_argb,
-                    int dst_stride_argb,
-                    int width,
-                    int height,
-                    int interpolation);
-
-// Interpolate between two YUV images using specified amount of interpolation
-// Internally calls InterpolatePlane on each plane where the U and V planes
-// are half width and half height.
-LIBYUV_API
-int I420Interpolate(const uint8* src0_y,
-                    int src0_stride_y,
-                    const uint8* src0_u,
-                    int src0_stride_u,
-                    const uint8* src0_v,
-                    int src0_stride_v,
-                    const uint8* src1_y,
-                    int src1_stride_y,
-                    const uint8* src1_u,
-                    int src1_stride_u,
-                    const uint8* src1_v,
-                    int src1_stride_v,
-                    uint8* dst_y,
-                    int dst_stride_y,
-                    uint8* dst_u,
-                    int dst_stride_u,
-                    uint8* dst_v,
-                    int dst_stride_v,
-                    int width,
-                    int height,
-                    int interpolation);
-
-#if defined(__pnacl__) || defined(__CLR_VER) || \
+// TODO(fbarchard): Move cpu macros to row.h
+#if defined(__pnacl__) || defined(__CLR_VER) ||            \
+    (defined(__native_client__) && defined(__x86_64__)) || \
     (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
 #define LIBYUV_DISABLE_X86
 #endif
 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
 #if defined(__has_feature)
 #if __has_feature(memory_sanitizer)
 #define LIBYUV_DISABLE_X86
 #endif
 #endif
 // The following are available on all x86 platforms:
 #if !defined(LIBYUV_DISABLE_X86) && \
     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
 #define HAS_ARGBAFFINEROW_SSE2
 #endif
 
+// Copy a plane of data.
+LIBYUV_API
+void CopyPlane(const uint8_t* src_y,
+               int src_stride_y,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               int width,
+               int height);
+
+LIBYUV_API
+void CopyPlane_16(const uint16_t* src_y,
+                  int src_stride_y,
+                  uint16_t* dst_y,
+                  int dst_stride_y,
+                  int width,
+                  int height);
+
+LIBYUV_API
+void Convert16To8Plane(const uint16_t* src_y,
+                       int src_stride_y,
+                       uint8_t* dst_y,
+                       int dst_stride_y,
+                       int scale,  // 16384 for 10 bits
+                       int width,
+                       int height);
+
+LIBYUV_API
+void Convert8To16Plane(const uint8_t* src_y,
+                       int src_stride_y,
+                       uint16_t* dst_y,
+                       int dst_stride_y,
+                       int scale,  // 1024 for 10 bits
+                       int width,
+                       int height);
+
+// Set a plane of data to a 32 bit value.
+LIBYUV_API
+void SetPlane(uint8_t* dst_y,
+              int dst_stride_y,
+              int width,
+              int height,
+              uint32_t value);
+
+// Split interleaved UV plane into separate U and V planes.
+LIBYUV_API
+void SplitUVPlane(const uint8_t* src_uv,
+                  int src_stride_uv,
+                  uint8_t* dst_u,
+                  int dst_stride_u,
+                  uint8_t* dst_v,
+                  int dst_stride_v,
+                  int width,
+                  int height);
+
+// Merge separate U and V planes into one interleaved UV plane.
+LIBYUV_API
+void MergeUVPlane(const uint8_t* src_u,
+                  int src_stride_u,
+                  const uint8_t* src_v,
+                  int src_stride_v,
+                  uint8_t* dst_uv,
+                  int dst_stride_uv,
+                  int width,
+                  int height);
+
+// Split interleaved RGB plane into separate R, G and B planes.
+LIBYUV_API
+void SplitRGBPlane(const uint8_t* src_rgb,
+                   int src_stride_rgb,
+                   uint8_t* dst_r,
+                   int dst_stride_r,
+                   uint8_t* dst_g,
+                   int dst_stride_g,
+                   uint8_t* dst_b,
+                   int dst_stride_b,
+                   int width,
+                   int height);
+
+// Merge separate R, G and B planes into one interleaved RGB plane.
+LIBYUV_API
+void MergeRGBPlane(const uint8_t* src_r,
+                   int src_stride_r,
+                   const uint8_t* src_g,
+                   int src_stride_g,
+                   const uint8_t* src_b,
+                   int src_stride_b,
+                   uint8_t* dst_rgb,
+                   int dst_stride_rgb,
+                   int width,
+                   int height);
+
+// Copy I400.  Supports inverting.
+LIBYUV_API
+int I400ToI400(const uint8_t* src_y,
+               int src_stride_y,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               int width,
+               int height);
+
+#define J400ToJ400 I400ToI400
+
+// Copy I422 to I422.
+#define I422ToI422 I422Copy
+LIBYUV_API
+int I422Copy(const uint8_t* src_y,
+             int src_stride_y,
+             const uint8_t* src_u,
+             int src_stride_u,
+             const uint8_t* src_v,
+             int src_stride_v,
+             uint8_t* dst_y,
+             int dst_stride_y,
+             uint8_t* dst_u,
+             int dst_stride_u,
+             uint8_t* dst_v,
+             int dst_stride_v,
+             int width,
+             int height);
+
+// Copy I444 to I444.
+#define I444ToI444 I444Copy
+LIBYUV_API
+int I444Copy(const uint8_t* src_y,
+             int src_stride_y,
+             const uint8_t* src_u,
+             int src_stride_u,
+             const uint8_t* src_v,
+             int src_stride_v,
+             uint8_t* dst_y,
+             int dst_stride_y,
+             uint8_t* dst_u,
+             int dst_stride_u,
+             uint8_t* dst_v,
+             int dst_stride_v,
+             int width,
+             int height);
+
+// Convert YUY2 to I422.
+LIBYUV_API
+int YUY2ToI422(const uint8_t* src_yuy2,
+               int src_stride_yuy2,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_u,
+               int dst_stride_u,
+               uint8_t* dst_v,
+               int dst_stride_v,
+               int width,
+               int height);
+
+// Convert UYVY to I422.
+LIBYUV_API
+int UYVYToI422(const uint8_t* src_uyvy,
+               int src_stride_uyvy,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_u,
+               int dst_stride_u,
+               uint8_t* dst_v,
+               int dst_stride_v,
+               int width,
+               int height);
+
+LIBYUV_API
+int YUY2ToNV12(const uint8_t* src_yuy2,
+               int src_stride_yuy2,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_uv,
+               int dst_stride_uv,
+               int width,
+               int height);
+
+LIBYUV_API
+int UYVYToNV12(const uint8_t* src_uyvy,
+               int src_stride_uyvy,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_uv,
+               int dst_stride_uv,
+               int width,
+               int height);
+
+LIBYUV_API
+int YUY2ToY(const uint8_t* src_yuy2,
+            int src_stride_yuy2,
+            uint8_t* dst_y,
+            int dst_stride_y,
+            int width,
+            int height);
+
+// Convert I420 to I400. (calls CopyPlane ignoring u/v).
+LIBYUV_API
+int I420ToI400(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               int width,
+               int height);
+
+// Alias
+#define J420ToJ400 I420ToI400
+#define I420ToI420Mirror I420Mirror
+
+// I420 mirror.
+LIBYUV_API
+int I420Mirror(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               uint8_t* dst_u,
+               int dst_stride_u,
+               uint8_t* dst_v,
+               int dst_stride_v,
+               int width,
+               int height);
+
+// Alias
+#define I400ToI400Mirror I400Mirror
+
+// I400 mirror.  A single plane is mirrored horizontally.
+// Pass negative height to achieve 180 degree rotation.
+LIBYUV_API
+int I400Mirror(const uint8_t* src_y,
+               int src_stride_y,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               int width,
+               int height);
+
+// Alias
+#define ARGBToARGBMirror ARGBMirror
+
+// ARGB mirror.
+LIBYUV_API
+int ARGBMirror(const uint8_t* src_argb,
+               int src_stride_argb,
+               uint8_t* dst_argb,
+               int dst_stride_argb,
+               int width,
+               int height);
+
+// Convert NV12 to RGB565.
+LIBYUV_API
+int NV12ToRGB565(const uint8_t* src_y,
+                 int src_stride_y,
+                 const uint8_t* src_uv,
+                 int src_stride_uv,
+                 uint8_t* dst_rgb565,
+                 int dst_stride_rgb565,
+                 int width,
+                 int height);
+
+// I422ToARGB is in convert_argb.h
+// Convert I422 to BGRA.
+LIBYUV_API
+int I422ToBGRA(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_bgra,
+               int dst_stride_bgra,
+               int width,
+               int height);
+
+// Convert I422 to ABGR.
+LIBYUV_API
+int I422ToABGR(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_abgr,
+               int dst_stride_abgr,
+               int width,
+               int height);
+
+// Convert I422 to RGBA.
+LIBYUV_API
+int I422ToRGBA(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_rgba,
+               int dst_stride_rgba,
+               int width,
+               int height);
+
+// Alias
+#define RGB24ToRAW RAWToRGB24
+
+LIBYUV_API
+int RAWToRGB24(const uint8_t* src_raw,
+               int src_stride_raw,
+               uint8_t* dst_rgb24,
+               int dst_stride_rgb24,
+               int width,
+               int height);
+
+// Draw a rectangle into I420.
+LIBYUV_API
+int I420Rect(uint8_t* dst_y,
+             int dst_stride_y,
+             uint8_t* dst_u,
+             int dst_stride_u,
+             uint8_t* dst_v,
+             int dst_stride_v,
+             int x,
+             int y,
+             int width,
+             int height,
+             int value_y,
+             int value_u,
+             int value_v);
+
+// Draw a rectangle into ARGB.
+LIBYUV_API
+int ARGBRect(uint8_t* dst_argb,
+             int dst_stride_argb,
+             int dst_x,
+             int dst_y,
+             int width,
+             int height,
+             uint32_t value);
+
+// Convert ARGB to gray scale ARGB.
+LIBYUV_API
+int ARGBGrayTo(const uint8_t* src_argb,
+               int src_stride_argb,
+               uint8_t* dst_argb,
+               int dst_stride_argb,
+               int width,
+               int height);
+
+// Make a rectangle of ARGB gray scale.
+LIBYUV_API
+int ARGBGray(uint8_t* dst_argb,
+             int dst_stride_argb,
+             int dst_x,
+             int dst_y,
+             int width,
+             int height);
+
+// Make a rectangle of ARGB Sepia tone.
+LIBYUV_API
+int ARGBSepia(uint8_t* dst_argb,
+              int dst_stride_argb,
+              int dst_x,
+              int dst_y,
+              int width,
+              int height);
+
+// Apply a matrix rotation to each ARGB pixel.
+// matrix_argb is 4 signed ARGB values. -128 to 127 representing -2 to 2.
+// The first 4 coefficients apply to B, G, R, A and produce B of the output.
+// The next 4 coefficients apply to B, G, R, A and produce G of the output.
+// The next 4 coefficients apply to B, G, R, A and produce R of the output.
+// The last 4 coefficients apply to B, G, R, A and produce A of the output.
+LIBYUV_API
+int ARGBColorMatrix(const uint8_t* src_argb,
+                    int src_stride_argb,
+                    uint8_t* dst_argb,
+                    int dst_stride_argb,
+                    const int8_t* matrix_argb,
+                    int width,
+                    int height);
+
+// Deprecated. Use ARGBColorMatrix instead.
+// Apply a matrix rotation to each ARGB pixel.
+// matrix_argb is 3 signed ARGB values. -128 to 127 representing -1 to 1.
+// The first 4 coefficients apply to B, G, R, A and produce B of the output.
+// The next 4 coefficients apply to B, G, R, A and produce G of the output.
+// The last 4 coefficients apply to B, G, R, A and produce R of the output.
+LIBYUV_API
+int RGBColorMatrix(uint8_t* dst_argb,
+                   int dst_stride_argb,
+                   const int8_t* matrix_rgb,
+                   int dst_x,
+                   int dst_y,
+                   int width,
+                   int height);
+
+// Apply a color table each ARGB pixel.
+// Table contains 256 ARGB values.
+LIBYUV_API
+int ARGBColorTable(uint8_t* dst_argb,
+                   int dst_stride_argb,
+                   const uint8_t* table_argb,
+                   int dst_x,
+                   int dst_y,
+                   int width,
+                   int height);
+
+// Apply a color table each ARGB pixel but preserve destination alpha.
+// Table contains 256 ARGB values.
+LIBYUV_API
+int RGBColorTable(uint8_t* dst_argb,
+                  int dst_stride_argb,
+                  const uint8_t* table_argb,
+                  int dst_x,
+                  int dst_y,
+                  int width,
+                  int height);
+
+// Apply a luma/color table each ARGB pixel but preserve destination alpha.
+// Table contains 32768 values indexed by [Y][C] where 7 it 7 bit luma from
+// RGB (YJ style) and C is an 8 bit color component (R, G or B).
+LIBYUV_API
+int ARGBLumaColorTable(const uint8_t* src_argb,
+                       int src_stride_argb,
+                       uint8_t* dst_argb,
+                       int dst_stride_argb,
+                       const uint8_t* luma,
+                       int width,
+                       int height);
+
+// Apply a 3 term polynomial to ARGB values.
+// poly points to a 4x4 matrix.  The first row is constants.  The 2nd row is
+// coefficients for b, g, r and a.  The 3rd row is coefficients for b squared,
+// g squared, r squared and a squared.  The 4rd row is coefficients for b to
+// the 3, g to the 3, r to the 3 and a to the 3.  The values are summed and
+// result clamped to 0 to 255.
+// A polynomial approximation can be dirived using software such as 'R'.
+
+LIBYUV_API
+int ARGBPolynomial(const uint8_t* src_argb,
+                   int src_stride_argb,
+                   uint8_t* dst_argb,
+                   int dst_stride_argb,
+                   const float* poly,
+                   int width,
+                   int height);
+
+// Convert plane of 16 bit shorts to half floats.
+// Source values are multiplied by scale before storing as half float.
+LIBYUV_API
+int HalfFloatPlane(const uint16_t* src_y,
+                   int src_stride_y,
+                   uint16_t* dst_y,
+                   int dst_stride_y,
+                   float scale,
+                   int width,
+                   int height);
+
+// Convert a buffer of bytes to floats, scale the values and store as floats.
+LIBYUV_API
+int ByteToFloat(const uint8_t* src_y, float* dst_y, float scale, int width);
+
+// Quantize a rectangle of ARGB. Alpha unaffected.
+// scale is a 16 bit fractional fixed point scaler between 0 and 65535.
+// interval_size should be a value between 1 and 255.
+// interval_offset should be a value between 0 and 255.
+LIBYUV_API
+int ARGBQuantize(uint8_t* dst_argb,
+                 int dst_stride_argb,
+                 int scale,
+                 int interval_size,
+                 int interval_offset,
+                 int dst_x,
+                 int dst_y,
+                 int width,
+                 int height);
+
+// Copy ARGB to ARGB.
+LIBYUV_API
+int ARGBCopy(const uint8_t* src_argb,
+             int src_stride_argb,
+             uint8_t* dst_argb,
+             int dst_stride_argb,
+             int width,
+             int height);
+
+// Copy Alpha channel of ARGB to alpha of ARGB.
+LIBYUV_API
+int ARGBCopyAlpha(const uint8_t* src_argb,
+                  int src_stride_argb,
+                  uint8_t* dst_argb,
+                  int dst_stride_argb,
+                  int width,
+                  int height);
+
+// Extract the alpha channel from ARGB.
+LIBYUV_API
+int ARGBExtractAlpha(const uint8_t* src_argb,
+                     int src_stride_argb,
+                     uint8_t* dst_a,
+                     int dst_stride_a,
+                     int width,
+                     int height);
+
+// Copy Y channel to Alpha of ARGB.
+LIBYUV_API
+int ARGBCopyYToAlpha(const uint8_t* src_y,
+                     int src_stride_y,
+                     uint8_t* dst_argb,
+                     int dst_stride_argb,
+                     int width,
+                     int height);
+
+typedef void (*ARGBBlendRow)(const uint8_t* src_argb0,
+                             const uint8_t* src_argb1,
+                             uint8_t* dst_argb,
+                             int width);
+
+// Get function to Alpha Blend ARGB pixels and store to destination.
+LIBYUV_API
+ARGBBlendRow GetARGBBlend();
+
+// Alpha Blend ARGB images and store to destination.
+// Source is pre-multiplied by alpha using ARGBAttenuate.
+// Alpha of destination is set to 255.
+LIBYUV_API
+int ARGBBlend(const uint8_t* src_argb0,
+              int src_stride_argb0,
+              const uint8_t* src_argb1,
+              int src_stride_argb1,
+              uint8_t* dst_argb,
+              int dst_stride_argb,
+              int width,
+              int height);
+
+// Alpha Blend plane and store to destination.
+// Source is not pre-multiplied by alpha.
+LIBYUV_API
+int BlendPlane(const uint8_t* src_y0,
+               int src_stride_y0,
+               const uint8_t* src_y1,
+               int src_stride_y1,
+               const uint8_t* alpha,
+               int alpha_stride,
+               uint8_t* dst_y,
+               int dst_stride_y,
+               int width,
+               int height);
+
+// Alpha Blend YUV images and store to destination.
+// Source is not pre-multiplied by alpha.
+// Alpha is full width x height and subsampled to half size to apply to UV.
+LIBYUV_API
+int I420Blend(const uint8_t* src_y0,
+              int src_stride_y0,
+              const uint8_t* src_u0,
+              int src_stride_u0,
+              const uint8_t* src_v0,
+              int src_stride_v0,
+              const uint8_t* src_y1,
+              int src_stride_y1,
+              const uint8_t* src_u1,
+              int src_stride_u1,
+              const uint8_t* src_v1,
+              int src_stride_v1,
+              const uint8_t* alpha,
+              int alpha_stride,
+              uint8_t* dst_y,
+              int dst_stride_y,
+              uint8_t* dst_u,
+              int dst_stride_u,
+              uint8_t* dst_v,
+              int dst_stride_v,
+              int width,
+              int height);
+
+// Multiply ARGB image by ARGB image. Shifted down by 8. Saturates to 255.
+LIBYUV_API
+int ARGBMultiply(const uint8_t* src_argb0,
+                 int src_stride_argb0,
+                 const uint8_t* src_argb1,
+                 int src_stride_argb1,
+                 uint8_t* dst_argb,
+                 int dst_stride_argb,
+                 int width,
+                 int height);
+
+// Add ARGB image with ARGB image. Saturates to 255.
+LIBYUV_API
+int ARGBAdd(const uint8_t* src_argb0,
+            int src_stride_argb0,
+            const uint8_t* src_argb1,
+            int src_stride_argb1,
+            uint8_t* dst_argb,
+            int dst_stride_argb,
+            int width,
+            int height);
+
+// Subtract ARGB image (argb1) from ARGB image (argb0). Saturates to 0.
+LIBYUV_API
+int ARGBSubtract(const uint8_t* src_argb0,
+                 int src_stride_argb0,
+                 const uint8_t* src_argb1,
+                 int src_stride_argb1,
+                 uint8_t* dst_argb,
+                 int dst_stride_argb,
+                 int width,
+                 int height);
+
+// Convert I422 to YUY2.
+LIBYUV_API
+int I422ToYUY2(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_yuy2,
+               int dst_stride_yuy2,
+               int width,
+               int height);
+
+// Convert I422 to UYVY.
+LIBYUV_API
+int I422ToUYVY(const uint8_t* src_y,
+               int src_stride_y,
+               const uint8_t* src_u,
+               int src_stride_u,
+               const uint8_t* src_v,
+               int src_stride_v,
+               uint8_t* dst_uyvy,
+               int dst_stride_uyvy,
+               int width,
+               int height);
+
+// Convert unattentuated ARGB to preattenuated ARGB.
+LIBYUV_API
+int ARGBAttenuate(const uint8_t* src_argb,
+                  int src_stride_argb,
+                  uint8_t* dst_argb,
+                  int dst_stride_argb,
+                  int width,
+                  int height);
+
+// Convert preattentuated ARGB to unattenuated ARGB.
+LIBYUV_API
+int ARGBUnattenuate(const uint8_t* src_argb,
+                    int src_stride_argb,
+                    uint8_t* dst_argb,
+                    int dst_stride_argb,
+                    int width,
+                    int height);
+
+// Internal function - do not call directly.
+// Computes table of cumulative sum for image where the value is the sum
+// of all values above and to the left of the entry. Used by ARGBBlur.
+LIBYUV_API
+int ARGBComputeCumulativeSum(const uint8_t* src_argb,
+                             int src_stride_argb,
+                             int32_t* dst_cumsum,
+                             int dst_stride32_cumsum,
+                             int width,
+                             int height);
+
+// Blur ARGB image.
+// dst_cumsum table of width * (height + 1) * 16 bytes aligned to
+//   16 byte boundary.
+// dst_stride32_cumsum is number of ints in a row (width * 4).
+// radius is number of pixels around the center.  e.g. 1 = 3x3. 2=5x5.
+// Blur is optimized for radius of 5 (11x11) or less.
+LIBYUV_API
+int ARGBBlur(const uint8_t* src_argb,
+             int src_stride_argb,
+             uint8_t* dst_argb,
+             int dst_stride_argb,
+             int32_t* dst_cumsum,
+             int dst_stride32_cumsum,
+             int width,
+             int height,
+             int radius);
+
+// Multiply ARGB image by ARGB value.
+LIBYUV_API
+int ARGBShade(const uint8_t* src_argb,
+              int src_stride_argb,
+              uint8_t* dst_argb,
+              int dst_stride_argb,
+              int width,
+              int height,
+              uint32_t value);
+
+// Interpolate between two images using specified amount of interpolation
+// (0 to 255) and store to destination.
+// 'interpolation' is specified as 8 bit fraction where 0 means 100% src0
+// and 255 means 1% src0 and 99% src1.
+LIBYUV_API
+int InterpolatePlane(const uint8_t* src0,
+                     int src_stride0,
+                     const uint8_t* src1,
+                     int src_stride1,
+                     uint8_t* dst,
+                     int dst_stride,
+                     int width,
+                     int height,
+                     int interpolation);
+
+// Interpolate between two ARGB images using specified amount of interpolation
+// Internally calls InterpolatePlane with width * 4 (bpp).
+LIBYUV_API
+int ARGBInterpolate(const uint8_t* src_argb0,
+                    int src_stride_argb0,
+                    const uint8_t* src_argb1,
+                    int src_stride_argb1,
+                    uint8_t* dst_argb,
+                    int dst_stride_argb,
+                    int width,
+                    int height,
+                    int interpolation);
+
+// Interpolate between two YUV images using specified amount of interpolation
+// Internally calls InterpolatePlane on each plane where the U and V planes
+// are half width and half height.
+LIBYUV_API
+int I420Interpolate(const uint8_t* src0_y,
+                    int src0_stride_y,
+                    const uint8_t* src0_u,
+                    int src0_stride_u,
+                    const uint8_t* src0_v,
+                    int src0_stride_v,
+                    const uint8_t* src1_y,
+                    int src1_stride_y,
+                    const uint8_t* src1_u,
+                    int src1_stride_u,
+                    const uint8_t* src1_v,
+                    int src1_stride_v,
+                    uint8_t* dst_y,
+                    int dst_stride_y,
+                    uint8_t* dst_u,
+                    int dst_stride_u,
+                    uint8_t* dst_v,
+                    int dst_stride_v,
+                    int width,
+                    int height,
+                    int interpolation);
+
 // Row function for copying pixels from a source with a slope to a row
 // of destination. Useful for scaling, rotation, mirror, texture mapping.
 LIBYUV_API
-void ARGBAffineRow_C(const uint8* src_argb,
+void ARGBAffineRow_C(const uint8_t* src_argb,
                      int src_argb_stride,
-                     uint8* dst_argb,
+                     uint8_t* dst_argb,
                      const float* uv_dudv,
                      int width);
+// TODO(fbarchard): Move ARGBAffineRow_SSE2 to row.h
 LIBYUV_API
-void ARGBAffineRow_SSE2(const uint8* src_argb,
+void ARGBAffineRow_SSE2(const uint8_t* src_argb,
                         int src_argb_stride,
-                        uint8* dst_argb,
+                        uint8_t* dst_argb,
                         const float* uv_dudv,
                         int width);
 
 // Shuffle ARGB channel order.  e.g. BGRA to ARGB.
 // shuffler is 16 bytes and must be aligned.
 LIBYUV_API
-int ARGBShuffle(const uint8* src_bgra,
+int ARGBShuffle(const uint8_t* src_bgra,
                 int src_stride_bgra,
-                uint8* dst_argb,
+                uint8_t* dst_argb,
                 int dst_stride_argb,
-                const uint8* shuffler,
+                const uint8_t* shuffler,
                 int width,
                 int height);
 
 // Sobel ARGB effect with planar output.
 LIBYUV_API
-int ARGBSobelToPlane(const uint8* src_argb,
+int ARGBSobelToPlane(const uint8_t* src_argb,
                      int src_stride_argb,
-                     uint8* dst_y,
+                     uint8_t* dst_y,
                      int dst_stride_y,
                      int width,
                      int height);
 
 // Sobel ARGB effect.
 LIBYUV_API
-int ARGBSobel(const uint8* src_argb,
+int ARGBSobel(const uint8_t* src_argb,
               int src_stride_argb,
-              uint8* dst_argb,
+              uint8_t* dst_argb,
               int dst_stride_argb,
               int width,
               int height);
 
 // Sobel ARGB effect w/ Sobel X, Sobel, Sobel Y in ARGB.
 LIBYUV_API
-int ARGBSobelXY(const uint8* src_argb,
+int ARGBSobelXY(const uint8_t* src_argb,
                 int src_stride_argb,
-                uint8* dst_argb,
+                uint8_t* dst_argb,
                 int dst_stride_argb,
                 int width,
                 int height);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
--- a/media/libyuv/libyuv/include/libyuv/rotate.h
+++ b/media/libyuv/libyuv/include/libyuv/rotate.h
@@ -28,135 +28,135 @@ typedef enum RotationMode {
   // Deprecated.
   kRotateNone = 0,
   kRotateClockwise = 90,
   kRotateCounterClockwise = 270,
 } RotationModeEnum;
 
 // Rotate I420 frame.
 LIBYUV_API
-int I420Rotate(const uint8* src_y,
+int I420Rotate(const uint8_t* src_y,
                int src_stride_y,
-               const uint8* src_u,
+               const uint8_t* src_u,
                int src_stride_u,
-               const uint8* src_v,
+               const uint8_t* src_v,
                int src_stride_v,
-               uint8* dst_y,
+               uint8_t* dst_y,
                int dst_stride_y,
-               uint8* dst_u,
+               uint8_t* dst_u,
                int dst_stride_u,
-               uint8* dst_v,
+               uint8_t* dst_v,
                int dst_stride_v,
-               int src_width,
-               int src_height,
+               int width,
+               int height,
                enum RotationMode mode);
 
 // Rotate NV12 input and store in I420.
 LIBYUV_API
-int NV12ToI420Rotate(const uint8* src_y,
+int NV12ToI420Rotate(const uint8_t* src_y,
                      int src_stride_y,
-                     const uint8* src_uv,
+                     const uint8_t* src_uv,
                      int src_stride_uv,
-                     uint8* dst_y,
+                     uint8_t* dst_y,
                      int dst_stride_y,
-                     uint8* dst_u,
+                     uint8_t* dst_u,
                      int dst_stride_u,
-                     uint8* dst_v,
+                     uint8_t* dst_v,
                      int dst_stride_v,
-                     int src_width,
-                     int src_height,
+                     int width,
+                     int height,
                      enum RotationMode mode);
 
 // Rotate a plane by 0, 90, 180, or 270.
 LIBYUV_API
-int RotatePlane(const uint8* src,
+int RotatePlane(const uint8_t* src,
                 int src_stride,
-                uint8* dst,
+                uint8_t* dst,
                 int dst_stride,
-                int src_width,
-                int src_height,
+                int width,
+                int height,
                 enum RotationMode mode);
 
 // Rotate planes by 90, 180, 270. Deprecated.
 LIBYUV_API
-void RotatePlane90(const uint8* src,
+void RotatePlane90(const uint8_t* src,
                    int src_stride,
-                   uint8* dst,
+                   uint8_t* dst,
                    int dst_stride,
                    int width,
                    int height);
 
 LIBYUV_API
-void RotatePlane180(const uint8* src,
+void RotatePlane180(const uint8_t* src,
                     int src_stride,
-                    uint8* dst,
+                    uint8_t* dst,
                     int dst_stride,
                     int width,
                     int height);
 
 LIBYUV_API
-void RotatePlane270(const uint8* src,
+void RotatePlane270(const uint8_t* src,
                     int src_stride,
-                    uint8* dst,
+                    uint8_t* dst,
                     int dst_stride,
                     int width,
                     int height);
 
 LIBYUV_API
-void RotateUV90(const uint8* src,
+void RotateUV90(const uint8_t* src,
                 int src_stride,
-                uint8* dst_a,
+                uint8_t* dst_a,
                 int dst_stride_a,
-                uint8* dst_b,
+                uint8_t* dst_b,
                 int dst_stride_b,
                 int width,
                 int height);
 
 // Rotations for when U and V are interleaved.
 // These functions take one input pointer and
 // split the data into two buffers while
 // rotating them. Deprecated.
 LIBYUV_API
-void RotateUV180(const uint8* src,
+void RotateUV180(const uint8_t* src,
                  int src_stride,
-                 uint8* dst_a,
+                 uint8_t* dst_a,
                  int dst_stride_a,
-                 uint8* dst_b,
+                 uint8_t* dst_b,
                  int dst_stride_b,
                  int width,
                  int height);
 
 LIBYUV_API
-void RotateUV270(const uint8* src,
+void RotateUV270(const uint8_t* src,
                  int src_stride,
-                 uint8* dst_a,
+                 uint8_t* dst_a,
                  int dst_stride_a,
-                 uint8* dst_b,
+                 uint8_t* dst_b,
                  int dst_stride_b,
                  int width,
                  int height);
 
 // The 90 and 270 functions are based on transposes.
 // Doing a transpose with reversing the read/write
 // order will result in a rotation by +- 90 degrees.
 // Deprecated.
 LIBYUV_API
-void TransposePlane(const uint8* src,
+void TransposePlane(const uint8_t* src,
                     int src_stride,
-                    uint8* dst,
+                    uint8_t* dst,
                     int dst_stride,
                     int width,
                     int height);
 
 LIBYUV_API
-void TransposeUV(const uint8* src,
+void TransposeUV(const uint8_t* src,
                  int src_stride,
-                 uint8* dst_a,
+                 uint8_t* dst_a,
                  int dst_stride_a,
-                 uint8* dst_b,
+                 uint8_t* dst_b,
                  int dst_stride_b,
                  int width,
                  int height);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
--- a/media/libyuv/libyuv/include/libyuv/rotate_argb.h
+++ b/media/libyuv/libyuv/include/libyuv/rotate_argb.h
@@ -16,19 +16,19 @@
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
 // Rotate ARGB frame
 LIBYUV_API
-int ARGBRotate(const uint8* src_argb,
+int ARGBRotate(const uint8_t* src_argb,
                int src_stride_argb,
-               uint8* dst_argb,
+               uint8_t* dst_argb,
                int dst_stride_argb,
                int src_width,
                int src_height,
                enum RotationMode mode);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
--- a/media/libyuv/libyuv/include/libyuv/rotate_row.h
+++ b/media/libyuv/libyuv/include/libyuv/rotate_row.h
@@ -13,215 +13,181 @@
 
 #include "libyuv/basic_types.h"
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
-#if defined(__pnacl__) || defined(__CLR_VER) || \
+#if defined(__pnacl__) || defined(__CLR_VER) ||            \
+    (defined(__native_client__) && defined(__x86_64__)) || \
     (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
 #define LIBYUV_DISABLE_X86
 #endif
+#if defined(__native_client__)
+#define LIBYUV_DISABLE_NEON
+#endif
 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
 #if defined(__has_feature)
 #if __has_feature(memory_sanitizer)
 #define LIBYUV_DISABLE_X86
 #endif
 #endif
 // The following are available for Visual C and clangcl 32 bit:
-#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86)
+#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && defined(_MSC_VER)
 #define HAS_TRANSPOSEWX8_SSSE3
 #define HAS_TRANSPOSEUVWX8_SSE2
 #endif
 
-// The following are available for GCC 32 or 64 bit but not NaCL for 64 bit:
-#if !defined(LIBYUV_DISABLE_X86) && \
-    (defined(__i386__) ||           \
-     (defined(__x86_64__) && !defined(__native_client__)))
+// The following are available for GCC 32 or 64 bit:
+#if !defined(LIBYUV_DISABLE_X86) && (defined(__i386__) || defined(__x86_64__))
 #define HAS_TRANSPOSEWX8_SSSE3
 #endif
 
-// The following are available for 64 bit GCC but not NaCL:
-#if !defined(LIBYUV_DISABLE_X86) && !defined(__native_client__) && \
-    defined(__x86_64__)
+// The following are available for 64 bit GCC:
+#if !defined(LIBYUV_DISABLE_X86) && defined(__x86_64__)
 #define HAS_TRANSPOSEWX8_FAST_SSSE3
 #define HAS_TRANSPOSEUVWX8_SSE2
 #endif
 
-#if !defined(LIBYUV_DISABLE_NEON) && !defined(__native_client__) && \
+#if !defined(LIBYUV_DISABLE_NEON) && \
     (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
 #define HAS_TRANSPOSEWX8_NEON
 #define HAS_TRANSPOSEUVWX8_NEON
 #endif
 
-#if !defined(LIBYUV_DISABLE_DSPR2) && !defined(__native_client__) && \
-    defined(__mips__) && defined(__mips_dsp) && (__mips_dsp_rev >= 2)
-#define HAS_TRANSPOSEWX8_DSPR2
-#define HAS_TRANSPOSEUVWX8_DSPR2
-#endif  // defined(__mips__)
-
 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
 #define HAS_TRANSPOSEWX16_MSA
 #define HAS_TRANSPOSEUVWX16_MSA
 #endif
 
-void TransposeWxH_C(const uint8* src,
+void TransposeWxH_C(const uint8_t* src,
                     int src_stride,
-                    uint8* dst,
+                    uint8_t* dst,
                     int dst_stride,
                     int width,
                     int height);
 
-void TransposeWx8_C(const uint8* src,
+void TransposeWx8_C(const uint8_t* src,
                     int src_stride,
-                    uint8* dst,
+                    uint8_t* dst,
                     int dst_stride,
                     int width);
-void TransposeWx16_C(const uint8* src,
+void TransposeWx16_C(const uint8_t* src,
                      int src_stride,
-                     uint8* dst,
+                     uint8_t* dst,
                      int dst_stride,
                      int width);
-void TransposeWx8_NEON(const uint8* src,
+void TransposeWx8_NEON(const uint8_t* src,
                        int src_stride,
-                       uint8* dst,
+                       uint8_t* dst,
                        int dst_stride,
                        int width);
-void TransposeWx8_SSSE3(const uint8* src,
+void TransposeWx8_SSSE3(const uint8_t* src,
                         int src_stride,
-                        uint8* dst,
+                        uint8_t* dst,
                         int dst_stride,
                         int width);
-void TransposeWx8_Fast_SSSE3(const uint8* src,
+void TransposeWx8_Fast_SSSE3(const uint8_t* src,
                              int src_stride,
-                             uint8* dst,
+                             uint8_t* dst,
                              int dst_stride,
                              int width);
-void TransposeWx8_DSPR2(const uint8* src,
-                        int src_stride,
-                        uint8* dst,
-                        int dst_stride,
-                        int width);
-void TransposeWx8_Fast_DSPR2(const uint8* src,
-                             int src_stride,
-                             uint8* dst,
-                             int dst_stride,
-                             int width);
-void TransposeWx16_MSA(const uint8* src,
+void TransposeWx16_MSA(const uint8_t* src,
                        int src_stride,
-                       uint8* dst,
+                       uint8_t* dst,
                        int dst_stride,
                        int width);
 
-void TransposeWx8_Any_NEON(const uint8* src,
+void TransposeWx8_Any_NEON(const uint8_t* src,
                            int src_stride,
-                           uint8* dst,
+                           uint8_t* dst,
                            int dst_stride,
                            int width);
-void TransposeWx8_Any_SSSE3(const uint8* src,
+void TransposeWx8_Any_SSSE3(const uint8_t* src,
                             int src_stride,
-                            uint8* dst,
+                            uint8_t* dst,
                             int dst_stride,
                             int width);
-void TransposeWx8_Fast_Any_SSSE3(const uint8* src,
+void TransposeWx8_Fast_Any_SSSE3(const uint8_t* src,
                                  int src_stride,
-                                 uint8* dst,
+                                 uint8_t* dst,
                                  int dst_stride,
                                  int width);
-void TransposeWx8_Any_DSPR2(const uint8* src,
-                            int src_stride,
-                            uint8* dst,
-                            int dst_stride,
-                            int width);
-void TransposeWx16_Any_MSA(const uint8* src,
+void TransposeWx16_Any_MSA(const uint8_t* src,
                            int src_stride,
-                           uint8* dst,
+                           uint8_t* dst,
                            int dst_stride,
                            int width);
 
-void TransposeUVWxH_C(const uint8* src,
+void TransposeUVWxH_C(const uint8_t* src,
                       int src_stride,
-                      uint8* dst_a,
+                      uint8_t* dst_a,
                       int dst_stride_a,
-                      uint8* dst_b,
+                      uint8_t* dst_b,
                       int dst_stride_b,
                       int width,
                       int height);
 
-void TransposeUVWx8_C(const uint8* src,
+void TransposeUVWx8_C(const uint8_t* src,
                       int src_stride,
-                      uint8* dst_a,
+                      uint8_t* dst_a,
                       int dst_stride_a,
-                      uint8* dst_b,
+                      uint8_t* dst_b,
                       int dst_stride_b,
                       int width);
-void TransposeUVWx16_C(const uint8* src,
+void TransposeUVWx16_C(const uint8_t* src,
                        int src_stride,
-                       uint8* dst_a,
+                       uint8_t* dst_a,
                        int dst_stride_a,
-                       uint8* dst_b,
+                       uint8_t* dst_b,
                        int dst_stride_b,
                        int width);
-void TransposeUVWx8_SSE2(const uint8* src,
+void TransposeUVWx8_SSE2(const uint8_t* src,
                          int src_stride,
-                         uint8* dst_a,
+                         uint8_t* dst_a,
                          int dst_stride_a,
-                         uint8* dst_b,
+                         uint8_t* dst_b,
                          int dst_stride_b,
                          int width);
-void TransposeUVWx8_NEON(const uint8* src,
+void TransposeUVWx8_NEON(const uint8_t* src,
                          int src_stride,
-                         uint8* dst_a,
+                         uint8_t* dst_a,
                          int dst_stride_a,
-                         uint8* dst_b,
+                         uint8_t* dst_b,
                          int dst_stride_b,
                          int width);
-void TransposeUVWx8_DSPR2(const uint8* src,
-                          int src_stride,
-                          uint8* dst_a,
-                          int dst_stride_a,
-                          uint8* dst_b,
-                          int dst_stride_b,
-                          int width);
-void TransposeUVWx16_MSA(const uint8* src,
+void TransposeUVWx16_MSA(const uint8_t* src,
                          int src_stride,
-                         uint8* dst_a,
+                         uint8_t* dst_a,
                          int dst_stride_a,
-                         uint8* dst_b,
+                         uint8_t* dst_b,
                          int dst_stride_b,
                          int width);
 
-void TransposeUVWx8_Any_SSE2(const uint8* src,
+void TransposeUVWx8_Any_SSE2(const uint8_t* src,
                              int src_stride,
-                             uint8* dst_a,
+                             uint8_t* dst_a,
                              int dst_stride_a,
-                             uint8* dst_b,
+                             uint8_t* dst_b,
                              int dst_stride_b,
                              int width);
-void TransposeUVWx8_Any_NEON(const uint8* src,
+void TransposeUVWx8_Any_NEON(const uint8_t* src,
                              int src_stride,
-                             uint8* dst_a,
+                             uint8_t* dst_a,
                              int dst_stride_a,
-                             uint8* dst_b,
+                             uint8_t* dst_b,
                              int dst_stride_b,
                              int width);
-void TransposeUVWx8_Any_DSPR2(const uint8* src,
-                              int src_stride,
-                              uint8* dst_a,
-                              int dst_stride_a,
-                              uint8* dst_b,
-                              int dst_stride_b,
-                              int width);
-void TransposeUVWx16_Any_MSA(const uint8* src,
+void TransposeUVWx16_Any_MSA(const uint8_t* src,
                              int src_stride,
-                             uint8* dst_a,
+                             uint8_t* dst_a,
                              int dst_stride_a,
-                             uint8* dst_b,
+                             uint8_t* dst_b,
                              int dst_stride_b,
                              int width);
 
 #ifdef __cplusplus
 }  // extern "C"
 }  // namespace libyuv
 #endif
 
--- a/media/libyuv/libyuv/include/libyuv/row.h
+++ b/media/libyuv/libyuv/include/libyuv/row.h
@@ -15,44 +15,30 @@
 
 #include "libyuv/basic_types.h"
 
 #ifdef __cplusplus
 namespace libyuv {
 extern "C" {
 #endif
 
-#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a)-1)))
-
-#define align_buffer_64(var, size)                                       \
-  uint8* var##_mem = (uint8*)(malloc((size) + 63));         /* NOLINT */ \
-  uint8* var = (uint8*)(((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */
-
-#define free_aligned_buffer_64(var) \
-  free(var##_mem);                  \
-  var = 0
-
-#if defined(__pnacl__) || defined(__CLR_VER) || \
+#if defined(__pnacl__) || defined(__CLR_VER) ||            \
+    (defined(__native_client__) && defined(__x86_64__)) || \
     (defined(__i386__) && !defined(__SSE__) && !defined(__clang__))
 #define LIBYUV_DISABLE_X86
 #endif
+#if defined(__native_client__)
+#define LIBYUV_DISABLE_NEON
+#endif
 // MemorySanitizer does not support assembly code yet. http://crbug.com/344505
 #if defined(__has_feature)
 #if __has_feature(memory_sanitizer)
 #define LIBYUV_DISABLE_X86
 #endif
 #endif
-// True if compiling for SSSE3 as a requirement.
-#if defined(__SSSE3__) || (defined(_M_IX86_FP) && (_M_IX86_FP >= 3))
-#define LIBYUV_SSSE3_ONLY
-#endif
-
-#if defined(__native_client__)
-#define LIBYUV_DISABLE_NEON
-#endif
 // clang >= 3.5.0 required for Arm64.
 #if defined(__clang__) && defined(__aarch64__) && !defined(LIBYUV_DISABLE_NEON)
 #if (__clang_major__ < 3) || (__clang_major__ == 3 && (__clang_minor__ < 5))
 #define LIBYUV_DISABLE_NEON
 #endif  // clang >= 3.5
 #endif  // __clang__
 
 // GCC >= 4.7.0 required for AVX2.
@@ -71,26 +57,25 @@ extern "C" {
 
 // Visual C 2012 required for AVX2.
 #if defined(_M_IX86) && !defined(__clang__) && defined(_MSC_VER) && \
     _MSC_VER >= 1700
 #define VISUALC_HAS_AVX2 1
 #endif  // VisualStudio >= 2012
 
 // The following are available on all x86 platforms:
-#if !defined(LIBYUV_DISABLE_X86) && \
+#if !defined(LIBYUV_DISABLE_AVX2) && !defined(LIBYUV_DISABLE_X86) && \
     (defined(_M_IX86) || defined(__x86_64__) || defined(__i386__))
 // Conversions:
 #define HAS_ABGRTOUVROW_SSSE3
 #define HAS_ABGRTOYROW_SSSE3
 #define HAS_ARGB1555TOARGBROW_SSE2
 #define HAS_ARGB4444TOARGBROW_SSE2
 #define HAS_ARGBEXTRACTALPHAROW_SSE2
 #define HAS_ARGBSETROW_X86
-#define HAS_ARGBSHUFFLEROW_SSE2
 #define HAS_ARGBSHUFFLEROW_SSSE3
 #define HAS_ARGBTOARGB1555ROW_SSE2
 #define HAS_ARGBTOARGB4444ROW_SSE2
 #define HAS_ARGBTORAWROW_SSSE3
 #define HAS_ARGBTORGB24ROW_SSSE3
 #define HAS_ARGBTORGB565DITHERROW_SSE2
 #define HAS_ARGBTORGB565ROW_SSE2
 #define HAS_ARGBTOUV444ROW_SSSE3
@@ -180,18 +165,17 @@ extern "C" {
 // TODO(fbarchard): fix build error on android_full_debug=1
 // https://code.google.com/p/libyuv/issues/detail?id=517
 #define HAS_I422ALPHATOARGBROW_SSSE3
 #endif
 #endif
 
 // The following are available on all x86 platforms, but
 // require VS2012, clang 3.4 or gcc 4.7.
-// The code supports NaCL but requires a new compiler and validator.
-#if !defined(LIBYUV_DISABLE_AVX2) && !defined(LIBYUV_DISABLE_X86) &&                          \
+#if !defined(LIBYUV_DISABLE_X86) &&                          \
     (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2) || \
      defined(GCC_HAS_AVX2))
 #define HAS_ARGBCOPYALPHAROW_AVX2
 #define HAS_ARGBCOPYYTOALPHAROW_AVX2
 #define HAS_ARGBEXTRACTALPHAROW_AVX2
 #define HAS_ARGBMIRRORROW_AVX2
 #define HAS_ARGBPOLYNOMIALROW_AVX2
 #define HAS_ARGBSHUFFLEROW_AVX2
@@ -261,16 +245,50 @@ extern "C" {
 
 // The following are also available on x64 Visual C.
 #if !defined(LIBYUV_DISABLE_X86) && defined(_MSC_VER) && defined(_M_X64) && \
     (!defined(__clang__) || defined(__SSSE3__))
 #define HAS_I422ALPHATOARGBROW_SSSE3
 #define HAS_I422TOARGBROW_SSSE3
 #endif
 
+// The following are available for gcc/clang x86 platforms:
+// TODO(fbarchard): Port to Visual C
+#if !defined(LIBYUV_DISABLE_X86) && \
+    (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER)))
+#define HAS_ABGRTOAR30ROW_SSSE3
+#define HAS_ARGBTOAR30ROW_SSSE3
+#define HAS_CONVERT16TO8ROW_SSSE3
+#define HAS_CONVERT8TO16ROW_SSE2
+// I210 is for H010.  2 = 422.  I for 601 vs H for 709.
+#define HAS_I210TOAR30ROW_SSSE3
+#define HAS_I210TOARGBROW_SSSE3
+#define HAS_I422TOAR30ROW_SSSE3
+#define HAS_MERGERGBROW_SSSE3
+#define HAS_SPLITRGBROW_SSSE3
+#endif
+
+// The following are available for AVX2 gcc/clang x86 platforms:
+// TODO(fbarchard): Port to Visual C
+#if !defined(LIBYUV_DISABLE_X86) &&                                       \
+    (defined(__x86_64__) || (defined(__i386__) && !defined(_MSC_VER))) && \
+    (defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2))
+#define HAS_ABGRTOAR30ROW_AVX2
+#define HAS_ARGBTOAR30ROW_AVX2
+#define HAS_CONVERT16TO8ROW_AVX2
+#define HAS_CONVERT8TO16ROW_AVX2
+#define HAS_I210TOARGBROW_AVX2
+#define HAS_I210TOAR30ROW_AVX2
+#define HAS_I422TOAR30ROW_AVX2
+#define HAS_I422TOUYVYROW_AVX2
+#define HAS_I422TOYUY2ROW_AVX2
+#define HAS_MERGEUVROW_16_AVX2
+#define HAS_MULTIPLYROW_16_AVX2
+#endif
+
 // The following are available on Neon platforms:
 #if !defined(LIBYUV_DISABLE_NEON) && \
     (defined(__aarch64__) || defined(__ARM_NEON__) || defined(LIBYUV_NEON))
 #define HAS_ABGRTOUVROW_NEON
 #define HAS_ABGRTOYROW_NEON
 #define HAS_ARGB1555TOARGBROW_NEON
 #define HAS_ARGB1555TOUVROW_NEON
 #define HAS_ARGB1555TOYROW_NEON
@@ -287,16 +305,17 @@ extern "C" {
 #define HAS_ARGBTORGB565ROW_NEON
 #define HAS_ARGBTOUV444ROW_NEON
 #define HAS_ARGBTOUVJROW_NEON
 #define HAS_ARGBTOUVROW_NEON
 #define HAS_ARGBTOYJROW_NEON
 #define HAS_ARGBTOYROW_NEON
 #define HAS_BGRATOUVROW_NEON
 #define HAS_BGRATOYROW_NEON
+#define HAS_BYTETOFLOATROW_NEON
 #define HAS_COPYROW_NEON
 #define HAS_HALFFLOATROW_NEON
 #define HAS_I400TOARGBROW_NEON
 #define HAS_I422ALPHATOARGBROW_NEON
 #define HAS_I422TOARGB1555ROW_NEON
 #define HAS_I422TOARGB4444ROW_NEON
 #define HAS_I422TOARGBROW_NEON
 #define HAS_I422TORGB24ROW_NEON
@@ -305,31 +324,34 @@ extern "C" {
 #define HAS_I422TOUYVYROW_NEON
 #define HAS_I422TOYUY2ROW_NEON
 #define HAS_I444TOARGBROW_NEON
 #define HAS_J400TOARGBROW_NEON
 #define HAS_MERGEUVROW_NEON
 #define HAS_MIRRORROW_NEON
 #define HAS_MIRRORUVROW_NEON
 #define HAS_NV12TOARGBROW_NEON
+#define HAS_NV12TORGB24ROW_NEON
 #define HAS_NV12TORGB565ROW_NEON
 #define HAS_NV21TOARGBROW_NEON
+#define HAS_NV21TORGB24ROW_NEON
 #define HAS_RAWTOARGBROW_NEON
 #define HAS_RAWTORGB24ROW_NEON
 #define HAS_RAWTOUVROW_NEON
 #define HAS_RAWTOYROW_NEON
 #define HAS_RGB24TOARGBROW_NEON
 #define HAS_RGB24TOUVROW_NEON
 #define HAS_RGB24TOYROW_NEON
 #define HAS_RGB565TOARGBROW_NEON
 #define HAS_RGB565TOUVROW_NEON
 #define HAS_RGB565TOYROW_NEON
 #define HAS_RGBATOUVROW_NEON
 #define HAS_RGBATOYROW_NEON
 #define HAS_SETROW_NEON
+#define HAS_SPLITRGBROW_NEON
 #define HAS_SPLITUVROW_NEON
 #define HAS_UYVYTOARGBROW_NEON
 #define HAS_UYVYTOUV422ROW_NEON
 #define HAS_UYVYTOUVROW_NEON
 #define HAS_UYVYTOYROW_NEON
 #define HAS_YUY2TOARGBROW_NEON
 #define HAS_YUY2TOUV422ROW_NEON
 #define HAS_YUY2TOUVROW_NEON
@@ -351,162 +373,150 @@ extern "C" {
 #define HAS_INTERPOLATEROW_NEON
 #define HAS_SOBELROW_NEON
 #define HAS_SOBELTOPLANEROW_NEON
 #define HAS_SOBELXROW_NEON
 #define HAS_SOBELXYROW_NEON
 #define HAS_SOBELYROW_NEON
 #endif
 
-// The following are available on Mips platforms:
-#if !defined(LIBYUV_DISABLE_DSPR2) && defined(__mips__) && \
-    (_MIPS_SIM == _MIPS_SIM_ABI32) && (__mips_isa_rev < 6)
-#define HAS_COPYROW_MIPS
-#if defined(__mips_dsp) && (__mips_dsp_rev >= 2)
-#define HAS_I422TOARGBROW_DSPR2
-#define HAS_INTERPOLATEROW_DSPR2
-#define HAS_MIRRORROW_DSPR2
-#define HAS_MIRRORUVROW_DSPR2
-#define HAS_SPLITUVROW_DSPR2
-#define HAS_RGB24TOARGBROW_DSPR2
-#define HAS_RAWTOARGBROW_DSPR2
-#define HAS_RGB565TOARGBROW_DSPR2
-#define HAS_ARGB1555TOARGBROW_DSPR2
-#define HAS_ARGB4444TOARGBROW_DSPR2
-#define HAS_I444TOARGBROW_DSPR2
-#define HAS_I422TOARGB4444ROW_DSPR2
-#define HAS_I422TOARGB1555ROW_DSPR2
-#define HAS_NV12TOARGBROW_DSPR2
-#define HAS_BGRATOUVROW_DSPR2
-#define HAS_BGRATOYROW_DSPR2
-#define HAS_ABGRTOUVROW_DSPR2
-#define HAS_ARGBTOYROW_DSPR2
-#define HAS_ABGRTOYROW_DSPR2
-#define HAS_RGBATOUVROW_DSPR2
-#define HAS_RGBATOYROW_DSPR2
-#define HAS_ARGBTOUVROW_DSPR2
+// The following are available on AArch64 platforms:
+#if !defined(LIBYUV_DISABLE_NEON) && defined(__aarch64__)
+#define HAS_SCALESUMSAMPLES_NEON
 #endif
-#endif
-
 #if !defined(LIBYUV_DISABLE_MSA) && defined(__mips_msa)
+#define HAS_ABGRTOUVROW_MSA
+#define HAS_ABGRTOYROW_MSA
+#define HAS_ARGB1555TOARGBROW_MSA
+#define HAS_ARGB1555TOUVROW_MSA
+#define HAS_ARGB1555TOYROW_MSA
+#define HAS_ARGB4444TOARGBROW_MSA
+#define HAS_ARGBADDROW_MSA
+#define HAS_ARGBATTENUATEROW_MSA
+#define HAS_ARGBBLENDROW_MSA
+#define HAS_ARGBCOLORMATRIXROW_MSA
+#define HAS_ARGBEXTRACTALPHAROW_MSA
+#define HAS_ARGBGRAYROW_MSA
 #define HAS_ARGBMIRRORROW_MSA
+#define HAS_ARGBMULTIPLYROW_MSA
+#define HAS_ARGBQUANTIZEROW_MSA
+#define HAS_ARGBSEPIAROW_MSA
+#define HAS_ARGBSETROW_MSA
+#define HAS_ARGBSHADEROW_MSA
+#define HAS_ARGBSHUFFLEROW_MSA
+#define HAS_ARGBSUBTRACTROW_MSA
+#define HAS_ARGBTOARGB1555ROW_MSA
+#define HAS_ARGBTOARGB4444ROW_MSA
+#define HAS_ARGBTORAWROW_MSA
+#define HAS_ARGBTORGB24ROW_MSA
+#define HAS_ARGBTORGB565DITHERROW_MSA
+#define HAS_ARGBTORGB565ROW_MSA
+#define HAS_ARGBTOUV444ROW_MSA
+#define HAS_ARGBTOUVJROW_MSA
+#define HAS_ARGBTOUVROW_MSA
+#define HAS_ARGBTOYJROW_MSA
+#define HAS_ARGBTOYROW_MSA
+#define HAS_BGRATOUVROW_MSA
+#define HAS_BGRATOYROW_MSA
+#define HAS_HALFFLOATROW_MSA
+#define HAS_I400TOARGBROW_MSA
+#define HAS_I422ALPHATOARGBROW_MSA
+#define HAS_I422TOARGBROW_MSA
+#define HAS_I422TORGB24ROW_MSA
+#define HAS_I422TORGBAROW_MSA
 #define HAS_I422TOUYVYROW_MSA
 #define HAS_I422TOYUY2ROW_MSA
+#define HAS_I444TOARGBROW_MSA
+#define HAS_INTERPOLATEROW_MSA
+#define HAS_J400TOARGBROW_MSA
+#define HAS_MERGEUVROW_MSA
 #define HAS_MIRRORROW_MSA
+#define HAS_MIRRORUVROW_MSA
+#define HAS_NV12TOARGBROW_MSA
+#define HAS_NV12TORGB565ROW_MSA
+#define HAS_NV21TOARGBROW_MSA
+#define HAS_RAWTOARGBROW_MSA
+#define HAS_RAWTORGB24ROW_MSA
+#define HAS_RAWTOUVROW_MSA
+#define HAS_RAWTOYROW_MSA
+#define HAS_RGB24TOARGBROW_MSA
+#define HAS_RGB24TOUVROW_MSA
+#define HAS_RGB24TOYROW_MSA
+#define HAS_RGB565TOARGBROW_MSA
+#define HAS_RGB565TOUVROW_MSA
+#define HAS_RGB565TOYROW_MSA
+#define HAS_RGBATOUVROW_MSA
+#define HAS_RGBATOYROW_MSA
+#define HAS_SETROW_MSA
+#define HAS_SOBELROW_MSA
+#define HAS_SOBELTOPLANEROW_MSA
+#define HAS_SOBELXROW_MSA
+#define HAS_SOBELXYROW_MSA
+#define HAS_SOBELYROW_MSA
+#define HAS_SPLITUVROW_MSA
+#define HAS_UYVYTOARGBROW_MSA
 #define HAS_UYVYTOUVROW_MSA
 #define HAS_UYVYTOYROW_MSA
+#define HAS_YUY2TOARGBROW_MSA
 #define HAS_YUY2TOUV422ROW_MSA
 #define HAS_YUY2TOUVROW_MSA
 #define HAS_YUY2TOYROW_MSA
-#define HAS_ARGB4444TOARGBROW_MSA
-#define HAS_ARGBTOYROW_MSA
-#define HAS_ARGBTOUVROW_MSA
-#define HAS_I422TOARGBROW_MSA
-#define HAS_I422TORGBAROW_MSA
-#define HAS_I422ALPHATOARGBROW_MSA
-#define HAS_I422TORGB24ROW_MSA
-#define HAS_ARGBTORGB24ROW_MSA
-#define HAS_ARGBTORAWROW_MSA
-#define HAS_ARGBTORGB565ROW_MSA
-#define HAS_ARGBTOARGB1555ROW_MSA
-#define HAS_ARGBTOARGB4444ROW_MSA
-#define HAS_ARGBTOUV444ROW_MSA
-#define HAS_ARGBMULTIPLYROW_MSA
-#define HAS_ARGBADDROW_MSA
-#define HAS_ARGBSUBTRACTROW_MSA
-#define HAS_ARGBATTENUATEROW_MSA
-#define HAS_ARGBTORGB565DITHERROW_MSA
-#define HAS_ARGBSHUFFLEROW_MSA
-#define HAS_ARGBSHADEROW_MSA
-#define HAS_ARGBGRAYROW_MSA
-#define HAS_ARGBSEPIAROW_MSA
-#define HAS_ARGB1555TOARGBROW_MSA
-#define HAS_RGB565TOARGBROW_MSA
-#define HAS_RGB24TOARGBROW_MSA
-#define HAS_RAWTOARGBROW_MSA
-#define HAS_ARGB1555TOYROW_MSA
-#define HAS_RGB565TOYROW_MSA
-#define HAS_RGB24TOYROW_MSA
-#define HAS_RAWTOYROW_MSA
-#define HAS_ARGB1555TOUVROW_MSA
-#define HAS_RGB565TOUVROW_MSA
-#define HAS_RGB24TOUVROW_MSA
-#define HAS_RAWTOUVROW_MSA
-#define HAS_NV12TOARGBROW_MSA
-#define HAS_NV12TORGB565ROW_MSA
-#define HAS_NV21TOARGBROW_MSA
-#define HAS_SOBELROW_MSA
-#define HAS_SOBELTOPLANEROW_MSA
-#define HAS_SOBELXYROW_MSA
-#define HAS_ARGBTOYJROW_MSA
-#define HAS_BGRATOYROW_MSA
-#define HAS_ABGRTOYROW_MSA
-#define HAS_RGBATOYROW_MSA
-#define HAS_ARGBTOUVJROW_MSA
-#define HAS_BGRATOUVROW_MSA
-#define HAS_ABGRTOUVROW_MSA
-#define HAS_RGBATOUVROW_MSA
-#define HAS_I444TOARGBROW_MSA
-#define HAS_I400TOARGBROW_MSA
-#define HAS_J400TOARGBROW_MSA
-#define HAS_YUY2TOARGBROW_MSA
-#define HAS_UYVYTOARGBROW_MSA
 #endif
 
 #if defined(_MSC_VER) && !defined(__CLR_VER) && !defined(__clang__)
 #if defined(VISUALC_HAS_AVX2)
 #define SIMD_ALIGNED(var) __declspec(align(32)) var
 #else
 #define SIMD_ALIGNED(var) __declspec(align(16)) var
 #endif
-typedef __declspec(align(16)) int16 vec16[8];
-typedef __declspec(align(16)) int32 vec32[4];
-typedef __declspec(align(16)) int8 vec8[16];
-typedef __declspec(align(16)) uint16 uvec16[8];
-typedef __declspec(align(16)) uint32 uvec32[4];
-typedef __declspec(align(16)) uint8 uvec8[16];
-typedef __declspec(align(32)) int16 lvec16[16];
-typedef __declspec(align(32)) int32 lvec32[8];
-typedef __declspec(align(32)) int8 lvec8[32];
-typedef __declspec(align(32)) uint16 ulvec16[16];
-typedef __declspec(align(32)) uint32 ulvec32[8];
-typedef __declspec(align(32)) uint8 ulvec8[32];
+typedef __declspec(align(16)) int16_t vec16[8];
+typedef __declspec(align(16)) int32_t vec32[4];
+typedef __declspec(align(16)) int8_t vec8[16];
+typedef __declspec(align(16)) uint16_t uvec16[8];
+typedef __declspec(align(16)) uint32_t uvec32[4];
+typedef __declspec(align(16)) uint8_t uvec8[16];
+typedef __declspec(align(32)) int16_t lvec16[16];
+typedef __declspec(align(32)) int32_t lvec32[8];
+typedef __declspec(align(32)) int8_t lvec8[32];
+typedef __declspec(align(32)) uint16_t ulvec16[16];
+typedef __declspec(align(32)) uint32_t ulvec32[8];
+typedef __declspec(align(32)) uint8_t ulvec8[32];
 #elif !defined(__pnacl__) && (defined(__GNUC__) || defined(__clang__))
 // Caveat GCC 4.2 to 4.7 have a known issue using vectors with const.
 #if defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)
 #define SIMD_ALIGNED(var) var __attribute__((aligned(32)))
 #else
 #define SIMD_ALIGNED(var) var __attribute__((aligned(16)))
 #endif
-typedef int16 __attribute__((vector_size(16))) vec16;
-typedef int32 __attribute__((vector_size(16))) vec32;
-typedef int8 __attribute__((vector_size(16))) vec8;
-typedef uint16 __attribute__((vector_size(16))) uvec16;
-typedef uint32 __attribute__((vector_size(16))) uvec32;
-typedef uint8 __attribute__((vector_size(16))) uvec8;
-typedef int16 __attribute__((vector_size(32))) lvec16;
-typedef int32 __attribute__((vector_size(32))) lvec32;
-typedef int8 __attribute__((vector_size(32))) lvec8;
-typedef uint16 __attribute__((vector_size(32))) ulvec16;
-typedef uint32 __attribute__((vector_size(32))) ulvec32;
-typedef uint8 __attribute__((vector_size(32))) ulvec8;
+typedef int16_t __attribute__((vector_size(16))) vec16;
+typedef int32_t __attribute__((vector_size(16))) vec32;
+typedef int8_t __attribute__((vector_size(16))) vec8;
+typedef uint16_t __attribute__((vector_size(16))) uvec16;
+typedef uint32_t __attribute__((vector_size(16))) uvec32;
+typedef uint8_t __attribute__((vector_size(16))) uvec8;
+typedef int16_t __attribute__((vector_size(32))) lvec16;
+typedef int32_t __attribute__((vector_size(32))) lvec32;
+typedef int8_t __attribute__((vector_size(32))) lvec8;
+typedef uint16_t __attribute__((vector_size(32))) ulvec16;
+typedef uint32_t __attribute__((vector_size(32))) ulvec32;
+typedef uint8_t __attribute__((vector_size(32))) ulvec8;
 #else
 #define SIMD_ALIGNED(var) var
-typedef int16 vec16[8];
-typedef int32 vec32[4];
-typedef int8 vec8[16];
-typedef uint16 uvec16[8];
-typedef uint32 uvec32[4];
-typedef uint8 uvec8[16];
-typedef int16 lvec16[16];
-typedef int32 lvec32[8];
-typedef int8 lvec8[32];
-typedef uint16 ulvec16[16];
-typedef uint32 ulvec32[8];
-typedef uint8 ulvec8[32];
+typedef int16_t vec16[8];
+typedef int32_t vec32[4];
+typedef int8_t vec8[16];
+typedef uint16_t uvec16[8];
+typedef uint32_t uvec32[4];
+typedef uint8_t uvec8[16];
+typedef int16_t lvec16[16];
+typedef int32_t lvec32[8];
+typedef int8_t lvec8[32];
+typedef uint16_t ulvec16[16];
+typedef uint32_t ulvec32[8];
+typedef uint8_t ulvec8[32];
 #endif
 
 #if defined(__aarch64__)
 // This struct is for Arm64 color conversion.
 struct YuvConstants {
   uvec16 kUVToRB;
   uvec16 kUVToRB2;
   uvec16 kUVToG;
@@ -520,23 +530,23 @@ struct YuvConstants {
   uvec8 kUVToRB;
   uvec8 kUVToG;
   vec16 kUVBiasBGR;
   vec32 kYToRgb;
 };
 #else
 // This struct is for Intel color conversion.
 struct YuvConstants {
-  int8 kUVToB[32];
-  int8 kUVToG[32];
-  int8 kUVToR[32];
-  int16 kUVBiasB[16];
-  int16 kUVBiasG[16];
-  int16 kUVBiasR[16];
-  int16 kYToRgb[16];
+  int8_t kUVToB[32];
+  int8_t kUVToG[32];
+  int8_t kUVToR[32];
+  int16_t kUVBiasB[16];
+  int16_t kUVBiasG[16];
+  int16_t kUVBiasR[16];
+  int16_t kYToRgb[16];
 };
 
 // Offsets into YuvConstants structure
 #define KUVTOB 0
 #define KUVTOG 32
 #define KUVTOR 64
 #define KUVBIASB 96
 #define KUVBIASG 128
@@ -549,93 +559,38 @@ extern const struct YuvConstants SIMD_AL
 extern const struct YuvConstants SIMD_ALIGNED(kYuvJPEGConstants);  // JPeg
 extern const struct YuvConstants SIMD_ALIGNED(kYuvH709Constants);  // BT.709
 
 // Conversion matrix for YVU to BGR
 extern const struct YuvConstants SIMD_ALIGNED(kYvuI601Constants);  // BT.601
 extern const struct YuvConstants SIMD_ALIGNED(kYvuJPEGConstants);  // JPeg
 extern const struct YuvConstants SIMD_ALIGNED(kYvuH709Constants);  // BT.709
 
+#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a)-1)))
+
+#define align_buffer_64(var, size)                                           \
+  uint8_t* var##_mem = (uint8_t*)(malloc((size) + 63));         /* NOLINT */ \
+  uint8_t* var = (uint8_t*)(((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */
+
+#define free_aligned_buffer_64(var) \
+  free(var##_mem);                  \
+  var = 0
+
 #if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__)
 #define OMITFP
 #else
 #define OMITFP __attribute__((optimize("omit-frame-pointer")))
 #endif
 
 // NaCL macros for GCC x86 and x64.
 #if defined(__native_client__)
 #define LABELALIGN ".p2align 5\n"
 #else
 #define LABELALIGN
 #endif
-#if defined(__native_client__) && defined(__x86_64__)
-// r14 is used for MEMOP macros.
-#define NACL_R14 "r14",
-#define BUNDLELOCK ".bundle_lock\n"
-#define BUNDLEUNLOCK ".bundle_unlock\n"
-#define MEMACCESS(base) "%%nacl:(%%r15,%q" #base ")"
-#define MEMACCESS2(offset, base) "%%nacl:" #offset "(%%r15,%q" #base ")"
-#define MEMLEA(offset, base) #offset "(%q" #base ")"
-#define MEMLEA3(offset, index, scale) #offset "(,%q" #index "," #scale ")"
-#define MEMLEA4(offset, base, index, scale) \
-  #offset "(%q" #base ",%q" #index "," #scale ")"
-#define MEMMOVESTRING(s, d) "%%nacl:(%q" #s "),%%nacl:(%q" #d "), %%r15"
-#define MEMSTORESTRING(reg, d) "%%" #reg ",%%nacl:(%q" #d "), %%r15"
-#define MEMOPREG(opcode, offset, base, index, scale, reg)                 \
-  BUNDLELOCK                                                              \
-  "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" #opcode \
-  " (%%r15,%%r14),%%" #reg "\n" BUNDLEUNLOCK
-#define MEMOPMEM(opcode, reg, offset, base, index, scale)                 \
-  BUNDLELOCK                                                              \
-  "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" #opcode \
-  " %%" #reg ",(%%r15,%%r14)\n" BUNDLEUNLOCK
-#define MEMOPARG(opcode, offset, base, index, scale, arg)                 \
-  BUNDLELOCK                                                              \
-  "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" #opcode \
-  " (%%r15,%%r14),%" #arg "\n" BUNDLEUNLOCK
-#define VMEMOPREG(opcode, offset, base, index, scale, reg1, reg2)         \
-  BUNDLELOCK                                                              \
-  "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" #opcode \
-  " (%%r15,%%r14),%%" #reg1 ",%%" #reg2 "\n" BUNDLEUNLOCK
-#define VEXTOPMEM(op, sel, reg, offset, base, index, scale)           \
-  BUNDLELOCK                                                          \
-  "lea " #offset "(%q" #base ",%q" #index "," #scale "),%%r14d\n" #op \
-  " $" #sel ",%%" #reg ",(%%r15,%%r14)\n" BUNDLEUNLOCK
-#else  // defined(__native_client__) && defined(__x86_64__)
-#define NACL_R14
-#define BUNDLEALIGN
-#define MEMACCESS(base) "(%" #base ")"
-#define MEMACCESS2(offset, base) #offset "(%" #base ")"
-#define MEMLEA(offset, base) #offset "(%" #base ")"
-#define MEMLEA3(offset, index, scale) #offset "(,%" #index "," #scale ")"
-#define MEMLEA4(offset, base, index, scale) \
-  #offset "(%" #base ",%" #index "," #scale ")"
-#define MEMMOVESTRING(s, d)
-#define MEMSTORESTRING(reg, d)
-#define MEMOPREG(opcode, offset, base, index, scale, reg) \
-  #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg "\n"
-#define MEMOPMEM(opcode, reg, offset, base, index, scale) \
-  #opcode " %%" #reg "," #offset "(%" #base ",%" #index "," #scale ")\n"
-#define MEMOPARG(opcode, offset, base, index, scale, arg) \
-  #opcode " " #offset "(%" #base ",%" #index "," #scale "),%" #arg "\n"
-#define VMEMOPREG(opcode, offset, base, index, scale, reg1, reg2)    \
-  #opcode " " #offset "(%" #base ",%" #index "," #scale "),%%" #reg1 \
-          ",%%" #reg2 "\n"
-#define VEXTOPMEM(op, sel, reg, offset, base, index, scale) \
-  #op " $" #sel ",%%" #reg "," #offset "(%" #base ",%" #index "," #scale ")\n"
-#endif  // defined(__native_client__) && defined(__x86_64__)
-
-#if defined(__arm__) || defined(__aarch64__)
-#undef MEMACCESS
-#if defined(__native_client__)
-#define MEMACCESS(base) ".p2align 3\nbic %" #base ", #0xc0000000\n"
-#else
-#define MEMACCESS(base)
-#endif
-#endif
 
 // Intel Code Analizer markers.  Insert IACA_START IACA_END around code to be
 // measured and then run with iaca -64 libyuv_unittest.
 // IACA_ASM_START amd IACA_ASM_END are equivalents that can be used within
 // inline assembly blocks.
 // example of iaca:
 // ~/iaca-lin64/bin/iaca.sh -64 -analysis LATENCY out/Release/libyuv_unittest
 
@@ -678,2460 +633,2765 @@ extern const struct YuvConstants SIMD_AL
     IACA_SSC_MARK(111) \
   }
 #define IACA_END       \
   {                    \
     IACA_SSC_MARK(222) \
     IACA_UD_BYTES      \
   }
 
-void I444ToARGBRow_NEON(const uint8* src_y,
-                        const uint8* src_u,
-                        const uint8* src_v,
-                        uint8* dst_argb,
+void I444ToARGBRow_NEON(const uint8_t* src_y,
+                        const uint8_t* src_u,
+                        const uint8_t* src_v,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void I422ToARGBRow_NEON(const uint8* src_y,
-                        const uint8* src_u,
-                        const uint8* src_v,
-                        uint8* dst_argb,
+void I422ToARGBRow_NEON(const uint8_t* src_y,
+                        const uint8_t* src_u,
+                        const uint8_t* src_v,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void I422AlphaToARGBRow_NEON(const uint8* y_buf,
-                             const uint8* u_buf,
-                             const uint8* v_buf,
-                             const uint8* a_buf,
-                             uint8* dst_argb,
+void I422AlphaToARGBRow_NEON(const uint8_t* src_y,
+                             const uint8_t* src_u,
+                             const uint8_t* src_v,
+                             const uint8_t* src_a,
+                             uint8_t* dst_argb,
                              const struct YuvConstants* yuvconstants,
                              int width);
-void I422ToARGBRow_NEON(const uint8* src_y,
-                        const uint8* src_u,
-                        const uint8* src_v,
-                        uint8* dst_argb,
+void I422ToARGBRow_NEON(const uint8_t* src_y,
+                        const uint8_t* src_u,
+                        const uint8_t* src_v,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void I422ToRGBARow_NEON(const uint8* src_y,
-                        const uint8* src_u,
-                        const uint8* src_v,
-                        uint8* dst_rgba,
+void I422ToRGBARow_NEON(const uint8_t* src_y,
+                        const uint8_t* src_u,
+                        const uint8_t* src_v,
+                        uint8_t* dst_rgba,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void I422ToRGB24Row_NEON(const uint8* src_y,
-                         const uint8* src_u,
-                         const uint8* src_v,
-                         uint8* dst_rgb24,
+void I422ToRGB24Row_NEON(const uint8_t* src_y,
+                         const uint8_t* src_u,
+                         const uint8_t* src_v,
+                         uint8_t* dst_rgb24,
                          const struct YuvConstants* yuvconstants,
                          int width);
-void I422ToRGB565Row_NEON(const uint8* src_y,
-                          const uint8* src_u,
-                          const uint8* src_v,
-                          uint8* dst_rgb565,
+void I422ToRGB565Row_NEON(const uint8_t* src_y,
+                          const uint8_t* src_u,
+                          const uint8_t* src_v,
+                          uint8_t* dst_rgb565,
                           const struct YuvConstants* yuvconstants,
                           int width);
-void I422ToARGB1555Row_NEON(const uint8* src_y,
-                            const uint8* src_u,
-                            const uint8* src_v,
-                            uint8* dst_argb1555,
+void I422ToARGB1555Row_NEON(const uint8_t* src_y,
+                            const uint8_t* src_u,
+                            const uint8_t* src_v,
+                            uint8_t* dst_argb1555,
                             const struct YuvConstants* yuvconstants,
                             int width);
-void I422ToARGB4444Row_NEON(const uint8* src_y,
-                            const uint8* src_u,
-                            const uint8* src_v,
-                            uint8* dst_argb4444,
+void I422ToARGB4444Row_NEON(const uint8_t* src_y,
+                            const uint8_t* src_u,
+                            const uint8_t* src_v,
+                            uint8_t* dst_argb4444,
                             const struct YuvConstants* yuvconstants,
                             int width);
-void NV12ToARGBRow_NEON(const uint8* src_y,
-                        const uint8* src_uv,
-                        uint8* dst_argb,
+void NV12ToARGBRow_NEON(const uint8_t* src_y,
+                        const uint8_t* src_uv,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void NV12ToRGB565Row_NEON(const uint8* src_y,
-                          const uint8* src_uv,
-                          uint8* dst_rgb565,
+void NV12ToRGB565Row_NEON(const uint8_t* src_y,
+                          const uint8_t* src_uv,
+                          uint8_t* dst_rgb565,
                           const struct YuvConstants* yuvconstants,
                           int width);
-void NV21ToARGBRow_NEON(const uint8* src_y,
-                        const uint8* src_vu,
-                        uint8* dst_argb,
+void NV21ToARGBRow_NEON(const uint8_t* src_y,
+                        const uint8_t* src_vu,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void YUY2ToARGBRow_NEON(const uint8* src_yuy2,
-                        uint8* dst_argb,
+void NV12ToRGB24Row_NEON(const uint8_t* src_y,
+                         const uint8_t* src_uv,
+                         uint8_t* dst_rgb24,
+                         const struct YuvConstants* yuvconstants,
+                         int width);
+void NV21ToRGB24Row_NEON(const uint8_t* src_y,
+                         const uint8_t* src_vu,
+                         uint8_t* dst_rgb24,
+                         const struct YuvConstants* yuvconstants,
+                         int width);
+void YUY2ToARGBRow_NEON(const uint8_t* src_yuy2,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void UYVYToARGBRow_NEON(const uint8* src_uyvy,
-                        uint8* dst_argb,
+void UYVYToARGBRow_NEON(const uint8_t* src_uyvy,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void I444ToARGBRow_MSA(const uint8* src_y,
-                       const uint8* src_u,
-                       const uint8* src_v,
-                       uint8* dst_argb,
+void I444ToARGBRow_MSA(const uint8_t* src_y,
+                       const uint8_t* src_u,
+                       const uint8_t* src_v,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
-void I444ToARGBRow_DSPR2(const uint8* src_y,
-                         const uint8* src_u,
-                         const uint8* src_v,
-                         uint8* dst_argb,
-                         const struct YuvConstants* yuvconstants,
-                         int width);
-void I422ToARGB4444Row_DSPR2(const uint8* src_y,
-                             const uint8* src_u,
-                             const uint8* src_v,
-                             uint8* dst_argb4444,
-                             const struct YuvConstants* yuvconstants,
-                             int width);
-void I422ToARGB1555Row_DSPR2(const uint8* src_y,
-                             const uint8* src_u,
-                             const uint8* src_v,
-                             uint8* dst_argb1555,
-                             const struct YuvConstants* yuvconstants,
-                             int width);
-void NV12ToARGBRow_DSPR2(const uint8* src_y,
-                         const uint8* src_uv,
-                         uint8* dst_argb,
-                         const struct YuvConstants* yuvconstants,
-                         int width);
 
-void I422ToARGBRow_MSA(const uint8* src_y,
-                       const uint8* src_u,
-                       const uint8* src_v,
-                       uint8* dst_argb,
+void I422ToARGBRow_MSA(const uint8_t* src_y,
+                       const uint8_t* src_u,
+                       const uint8_t* src_v,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
-void I422ToRGBARow_MSA(const uint8* src_y,
-                       const uint8* src_u,
-                       const uint8* src_v,
-                       uint8* dst_rgba,
+void I422ToRGBARow_MSA(const uint8_t* src_y,
+                       const uint8_t* src_u,
+                       const uint8_t* src_v,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
-void I422AlphaToARGBRow_MSA(const uint8* y_buf,
-                            const uint8* u_buf,
-                            const uint8* v_buf,
-                            const uint8* a_buf,
-                            uint8* dst_argb,
+void I422AlphaToARGBRow_MSA(const uint8_t* src_y,
+                            const uint8_t* src_u,
+                            const uint8_t* src_v,
+                            const uint8_t* src_a,
+                            uint8_t* dst_argb,
                             const struct YuvConstants* yuvconstants,
                             int width);
-void I422ToRGB24Row_MSA(const uint8* src_y,
-                        const uint8* src_u,
-                        const uint8* src_v,
-                        uint8* dst_rgb24,
+void I422ToRGB24Row_MSA(const uint8_t* src_y,
+                        const uint8_t* src_u,
+                        const uint8_t* src_v,
+                        uint8_t* dst_argb,
                         const struct YuvConstants* yuvconstants,
                         int width);
-void I422ToRGB565Row_MSA(const uint8* src_y,
-                         const uint8* src_u,
-                         const uint8* src_v,
-                         uint8* dst_rgb565,
+void I422ToRGB565Row_MSA(const uint8_t* src_y,
+                         const uint8_t* src_u,
+                         const uint8_t* src_v,
+                         uint8_t* dst_rgb565,
                          const struct YuvConstants* yuvconstants,
                          int width);
-void I422ToARGB4444Row_MSA(const uint8* src_y,
-                           const uint8* src_u,
-                           const uint8* src_v,
-                           uint8* dst_argb4444,
+void I422ToARGB4444Row_MSA(const uint8_t* src_y,
+                           const uint8_t* src_u,
+                           const uint8_t* src_v,
+                           uint8_t* dst_argb4444,
                            const struct YuvConstants* yuvconstants,
                            int width);
-void I422ToARGB1555Row_MSA(const uint8* src_y,
-                           const uint8* src_u,
-                           const uint8* src_v,
-                           uint8* dst_argb1555,
+void I422ToARGB1555Row_MSA(const uint8_t* src_y,
+                           const uint8_t* src_u,
+                           const uint8_t* src_v,
+                           uint8_t* dst_argb1555,
                            const struct YuvConstants* yuvconstants,
                            int width);
-void NV12ToARGBRow_MSA(const uint8* src_y,
-                       const uint8* src_uv,
-                       uint8* dst_argb,
+void NV12ToARGBRow_MSA(const uint8_t* src_y,
+                       const uint8_t* src_uv,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
-void NV12ToRGB565Row_MSA(const uint8* src_y,
-                         const uint8* src_uv,
-                         uint8* dst_rgb565,
+void NV12ToRGB565Row_MSA(const uint8_t* src_y,
+                         const uint8_t* src_uv,
+                         uint8_t* dst_rgb565,
                          const struct YuvConstants* yuvconstants,
                          int width);
-void NV21ToARGBRow_MSA(const uint8* src_y,
-                       const uint8* src_vu,
-                       uint8* dst_argb,
+void NV21ToARGBRow_MSA(const uint8_t* src_y,
+                       const uint8_t* src_vu,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
-void YUY2ToARGBRow_MSA(const uint8* src_yuy2,
-                       uint8* dst_argb,
+void YUY2ToARGBRow_MSA(const uint8_t* src_yuy2,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
-void UYVYToARGBRow_MSA(const uint8* src_uyvy,
-                       uint8* dst_argb,
+void UYVYToARGBRow_MSA(const uint8_t* src_uyvy,
+                       uint8_t* dst_argb,
                        const struct YuvConstants* yuvconstants,
                        int width);
 
-void ARGBToYRow_AVX2(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYRow_Any_AVX2(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYRow_SSSE3(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_AVX2(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_Any_AVX2(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_SSSE3(const uint8* src_argb, uint8* dst_y, int width);
-void BGRAToYRow_SSSE3(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_SSSE3(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_SSSE3(const uint8* src_rgba, uint8* dst_y, int width);
-void RGB24ToYRow_SSSE3(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_SSSE3(const uint8* src_raw, uint8* dst_y, int width);
-void ARGBToYRow_NEON(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_NEON(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYRow_MSA(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_MSA(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToUV444Row_NEON(const uint8* src_argb,
-                         uint8* dst_u,
-                         uint8* dst_v,
+void ARGBToYRow_AVX2(const uint8_t* src_argb, uint8_t* dst_y, int width);
+void ARGBToYRow_Any_AVX2(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGBToYRow_SSSE3(const uint8_t* src_argb, uint8_t* dst_y, int width);
+void ARGBToYJRow_AVX2(const uint8_t* src_argb, uint8_t* dst_y, int width);
+void ARGBToYJRow_Any_AVX2(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGBToYJRow_SSSE3(const uint8_t* src_argb, uint8_t* dst_y, int width);
+void BGRAToYRow_SSSE3(const uint8_t* src_bgra, uint8_t* dst_y, int width);
+void ABGRToYRow_SSSE3(const uint8_t* src_abgr, uint8_t* dst_y, int width);
+void RGBAToYRow_SSSE3(const uint8_t* src_rgba, uint8_t* dst_y, int width);
+void RGB24ToYRow_SSSE3(const uint8_t* src_rgb24, uint8_t* dst_y, int width);
+void RAWToYRow_SSSE3(const uint8_t* src_raw, uint8_t* dst_y, int width);
+void ARGBToYRow_NEON(const uint8_t* src_argb, uint8_t* dst_y, int width);
+void ARGBToYJRow_NEON(const uint8_t* src_argb, uint8_t* dst_y, int width);
+void ARGBToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void ARGBToYJRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void ARGBToUV444Row_NEON(const uint8_t* src_argb,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
                          int width);
-void ARGBToUVRow_NEON(const uint8* src_argb,
+void ARGBToUVRow_NEON(const uint8_t* src_argb,
                       int src_stride_argb,
-                      uint8* dst_u,
-                      uint8* dst_v,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
-void ARGBToUV444Row_MSA(const uint8* src_argb,
-                        uint8* dst_u,
-                        uint8* dst_v,
+void ARGBToUV444Row_MSA(const uint8_t* src_argb,
+                        uint8_t* dst_u,
+                        uint8_t* dst_v,
                         int width);
-void ARGBToUVRow_MSA(const uint8* src_argb,
+void ARGBToUVRow_MSA(const uint8_t* src_argb0,
                      int src_stride_argb,
-                     uint8* dst_u,
-                     uint8* dst_v,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
                      int width);
-void ARGBToUVJRow_NEON(const uint8* src_argb,
+void ARGBToUVJRow_NEON(const uint8_t* src_argb,
                        int src_stride_argb,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void BGRAToUVRow_NEON(const uint8* src_bgra,
+void BGRAToUVRow_NEON(const uint8_t* src_bgra,
                       int src_stride_bgra,
-                      uint8* dst_u,
-                      uint8* dst_v,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
-void ABGRToUVRow_NEON(const uint8* src_abgr,
+void ABGRToUVRow_NEON(const uint8_t* src_abgr,
                       int src_stride_abgr,
-                      uint8* dst_u,
-                      uint8* dst_v,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
-void RGBAToUVRow_NEON(const uint8* src_rgba,
+void RGBAToUVRow_NEON(const uint8_t* src_rgba,
                       int src_stride_rgba,
-                      uint8* dst_u,
-                      uint8* dst_v,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
-void RGB24ToUVRow_NEON(const uint8* src_rgb24,
+void RGB24ToUVRow_NEON(const uint8_t* src_rgb24,
                        int src_stride_rgb24,
-                       uint8* dst_u,
-                       uint8* dst_v,
-                       int width);
-void RAWToUVRow_NEON(const uint8* src_raw,
-                     int src_stride_raw,
-                     uint8* dst_u,
-                     uint8* dst_v,
-                     int width);
-void RGB565ToUVRow_NEON(const uint8* src_rgb565,
-                        int src_stride_rgb565,
-                        uint8* dst_u,
-                        uint8* dst_v,
-                        int width);
-void ARGB1555ToUVRow_NEON(const uint8* src_argb1555,
-                          int src_stride_argb1555,
-                          uint8* dst_u,
-                          uint8* dst_v,
-                          int width);
-void ARGB4444ToUVRow_NEON(const uint8* src_argb4444,
-                          int src_stride_argb4444,
-                          uint8* dst_u,
-                          uint8* dst_v,
-                          int width);
-void ARGBToUVJRow_MSA(const uint8* src_argb,
-                      int src_stride_argb,
-                      uint8* dst_u,
-                      uint8* dst_v,
-                      int width);
-void BGRAToUVRow_MSA(const uint8* src_bgra,
-                     int src_stride_bgra,
-                     uint8* dst_u,
-                     uint8* dst_v,
-                     int width);
-void ABGRToUVRow_MSA(const uint8* src_abgr,
-                     int src_stride_abgr,
-                     uint8* dst_u,
-                     uint8* dst_v,
-                     int width);
-void RGBAToUVRow_MSA(const uint8* src_rgba,
-                     int src_stride_rgba,
-                     uint8* dst_u,
-                     uint8* dst_v,
-                     int width);
-void RGB24ToUVRow_MSA(const uint8* src_rgb24,
-                      int src_stride_rgb24,
-                      uint8* dst_u,
-                      uint8* dst_v,
-                      int width);
-void RAWToUVRow_MSA(const uint8* src_raw,
-                    int src_stride_raw,
-                    uint8* dst_u,
-                    uint8* dst_v,
-                    int width);
-void RGB565ToUVRow_MSA(const uint8* src_rgb565,
-                       int src_stride_rgb565,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ARGB1555ToUVRow_MSA(const uint8* src_argb1555,
-                         int src_stride_argb1555,
-                         uint8* dst_u,
-                         uint8* dst_v,
-                         int width);
-void BGRAToYRow_NEON(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_NEON(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_NEON(const uint8* src_rgba, uint8* dst_y, int width);
-void RGB24ToYRow_NEON(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_NEON(const uint8* src_raw, uint8* dst_y, int width);
-void RGB565ToYRow_NEON(const uint8* src_rgb565, uint8* dst_y, int width);
-void ARGB1555ToYRow_NEON(const uint8* src_argb1555, uint8* dst_y, int width);
-void ARGB4444ToYRow_NEON(const uint8* src_argb4444, uint8* dst_y, int width);
-void BGRAToYRow_MSA(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_MSA(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_MSA(const uint8* src_rgba, uint8* dst_y, int width);
-void RGB24ToYRow_MSA(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_MSA(const uint8* src_raw, uint8* dst_y, int width);
-void RGB565ToYRow_MSA(const uint8* src_rgb565, uint8* dst_y, int width);
-void ARGB1555ToYRow_MSA(const uint8* src_argb1555, uint8* dst_y, int width);
-void BGRAToUVRow_DSPR2(const uint8* src_bgra,
-                       int src_stride_bgra,
-                       uint8* dst_u,
-                       uint8* dst_v,
-                       int width);
-void BGRAToYRow_DSPR2(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToUVRow_DSPR2(const uint8* src_abgr,
-                       int src_stride_abgr,
-                       uint8* dst_u,
-                       uint8* dst_v,
-                       int width);
-void ARGBToYRow_DSPR2(const uint8* src_argb, uint8* dst_y, int width);
-void ABGRToYRow_DSPR2(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToUVRow_DSPR2(const uint8* src_rgba,
-                       int src_stride_rgba,
-                       uint8* dst_u,
-                       uint8* dst_v,
-                       int width);
-void RGBAToYRow_DSPR2(const uint8* src_rgba, uint8* dst_y, int width);
-void ARGBToUVRow_DSPR2(const uint8* src_argb,
-                       int src_stride_argb,
-                       uint8* dst_u,
-                       uint8* dst_v,
+void RAWToUVRow_NEON(const uint8_t* src_raw,
+                     int src_stride_raw,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void RGB565ToUVRow_NEON(const uint8_t* src_rgb565,
+                        int src_stride_rgb565,
+                        uint8_t* dst_u,
+                        uint8_t* dst_v,
+                        int width);
+void ARGB1555ToUVRow_NEON(const uint8_t* src_argb1555,
+                          int src_stride_argb1555,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
+                          int width);
+void ARGB4444ToUVRow_NEON(const uint8_t* src_argb4444,
+                          int src_stride_argb4444,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
+                          int width);
+void ARGBToUVJRow_MSA(const uint8_t* src_rgb0,
+                      int src_stride_rgb,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
+                      int width);
+void BGRAToUVRow_MSA(const uint8_t* src_rgb0,
+                     int src_stride_rgb,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void ABGRToUVRow_MSA(const uint8_t* src_rgb0,
+                     int src_stride_rgb,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void RGBAToUVRow_MSA(const uint8_t* src_rgb0,
+                     int src_stride_rgb,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void RGB24ToUVRow_MSA(const uint8_t* src_rgb0,
+                      int src_stride_rgb,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
+                      int width);
+void RAWToUVRow_MSA(const uint8_t* src_rgb0,
+                    int src_stride_rgb,
+                    uint8_t* dst_u,
+                    uint8_t* dst_v,
+                    int width);
+void RGB565ToUVRow_MSA(const uint8_t* src_rgb565,
+                       int src_stride_rgb565,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ARGBToYRow_C(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_C(const uint8* src_argb, uint8* dst_y, int width);
-void BGRAToYRow_C(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_C(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_C(const uint8* src_rgba, uint8* dst_y, int width);
-void RGB24ToYRow_C(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_C(const uint8* src_raw, uint8* dst_y, int width);
-void RGB565ToYRow_C(const uint8* src_rgb565, uint8* dst_y, int width);
-void ARGB1555ToYRow_C(const uint8* src_argb1555, uint8* dst_y, int width);
-void ARGB4444ToYRow_C(const uint8* src_argb4444, uint8* dst_y, int width);
-void ARGBToYRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_Any_SSSE3(const uint8* src_argb, uint8* dst_y, int width);
-void BGRAToYRow_Any_SSSE3(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_Any_SSSE3(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_Any_SSSE3(const uint8* src_rgba, uint8* dst_y, int width);
-void RGB24ToYRow_Any_SSSE3(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_Any_SSSE3(const uint8* src_raw, uint8* dst_y, int width);
-void ARGBToYRow_Any_NEON(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYJRow_Any_NEON(const uint8* src_argb, uint8* dst_y, int width);
-void BGRAToYRow_Any_NEON(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_Any_NEON(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_Any_NEON(const uint8* src_rgba, uint8* dst_y, int width);
-void RGB24ToYRow_Any_NEON(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_Any_NEON(const uint8* src_raw, uint8* dst_y, int width);
-void RGB565ToYRow_Any_NEON(const uint8* src_rgb565, uint8* dst_y, int width);
-void ARGB1555ToYRow_Any_NEON(const uint8* src_argb1555,
-                             uint8* dst_y,
-                             int width);
-void BGRAToYRow_Any_DSPR2(const uint8* src_bgra, uint8* dst_y, int width);
-void ARGBToYRow_Any_DSPR2(const uint8* src_argb, uint8* dst_y, int width);
-void ABGRToYRow_Any_DSPR2(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_Any_DSPR2(const uint8* src_rgba, uint8* dst_y, int width);
-void ARGB4444ToYRow_Any_NEON(const uint8* src_argb4444,
-                             uint8* dst_y,
+void ARGB1555ToUVRow_MSA(const uint8_t* src_argb1555,
+                         int src_stride_argb1555,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void BGRAToYRow_NEON(const uint8_t* src_bgra, uint8_t* dst_y, int width);
+void ABGRToYRow_NEON(const uint8_t* src_abgr, uint8_t* dst_y, int width);
+void RGBAToYRow_NEON(const uint8_t* src_rgba, uint8_t* dst_y, int width);
+void RGB24ToYRow_NEON(const uint8_t* src_rgb24, uint8_t* dst_y, int width);
+void RAWToYRow_NEON(const uint8_t* src_raw, uint8_t* dst_y, int width);
+void RGB565ToYRow_NEON(const uint8_t* src_rgb565, uint8_t* dst_y, int width);
+void ARGB1555ToYRow_NEON(const uint8_t* src_argb1555,
+                         uint8_t* dst_y,
+                         int width);
+void ARGB4444ToYRow_NEON(const uint8_t* src_argb4444,
+                         uint8_t* dst_y,
+                         int width);
+void BGRAToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void ABGRToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RGBAToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RGB24ToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RAWToYRow_MSA(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RGB565ToYRow_MSA(const uint8_t* src_rgb565, uint8_t* dst_y, int width);
+void ARGB1555ToYRow_MSA(const uint8_t* src_argb1555, uint8_t* dst_y, int width);
+void ARGBToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void ARGBToYJRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void BGRAToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void ABGRToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RGBAToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RGB24ToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RAWToYRow_C(const uint8_t* src_argb0, uint8_t* dst_y, int width);
+void RGB565ToYRow_C(const uint8_t* src_rgb565, uint8_t* dst_y, int width);
+void ARGB1555ToYRow_C(const uint8_t* src_argb1555, uint8_t* dst_y, int width);
+void ARGB4444ToYRow_C(const uint8_t* src_argb4444, uint8_t* dst_y, int width);
+void ARGBToYRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGBToYJRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void BGRAToYRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ABGRToYRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGBAToYRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGB24ToYRow_Any_SSSE3(const uint8_t* src_rgb24, uint8_t* dst_y, int width);
+void RAWToYRow_Any_SSSE3(const uint8_t* src_raw, uint8_t* dst_y, int width);
+void ARGBToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGBToYJRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void BGRAToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ABGRToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGBAToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGB24ToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RAWToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGB565ToYRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGB1555ToYRow_Any_NEON(const uint8_t* src_ptr,
+                             uint8_t* dst_ptr,
                              int width);
-void BGRAToYRow_Any_MSA(const uint8* src_bgra, uint8* dst_y, int width);
-void ABGRToYRow_Any_MSA(const uint8* src_abgr, uint8* dst_y, int width);
-void RGBAToYRow_Any_MSA(const uint8* src_rgba, uint8* dst_y, int width);
-void ARGBToYJRow_Any_MSA(const uint8* src_argb, uint8* dst_y, int width);
-void ARGBToYRow_Any_MSA(const uint8* src_argb, uint8* dst_y, int width);
-void RGB24ToYRow_Any_MSA(const uint8* src_rgb24, uint8* dst_y, int width);
-void RAWToYRow_Any_MSA(const uint8* src_raw, uint8* dst_y, int width);
-void RGB565ToYRow_Any_MSA(const uint8* src_rgb565, uint8* dst_y, int width);
-void ARGB1555ToYRow_Any_MSA(const uint8* src_argb1555, uint8* dst_y, int width);
+void ARGB4444ToYRow_Any_NEON(const uint8_t* src_ptr,
+                             uint8_t* dst_ptr,
+                             int width);
+void BGRAToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ABGRToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGBAToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGBToYJRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGBToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGB24ToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RAWToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void RGB565ToYRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void ARGB1555ToYRow_Any_MSA(const uint8_t* src_ptr,
+                            uint8_t* dst_ptr,
+                            int width);
 
-void ARGBToUVRow_AVX2(const uint8* src_argb,
+void ARGBToUVRow_AVX2(const uint8_t* src_argb0,
                       int src_stride_argb,
-                      uint8* dst_u,
-                      uint8* dst_v,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
-void ARGBToUVJRow_AVX2(const uint8* src_argb,
+void ARGBToUVJRow_AVX2(const uint8_t* src_argb0,
                        int src_stride_argb,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ARGBToUVRow_SSSE3(const uint8* src_argb,
+void ARGBToUVRow_SSSE3(const uint8_t* src_argb0,
                        int src_stride_argb,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ARGBToUVJRow_SSSE3(const uint8* src_argb,
+void ARGBToUVJRow_SSSE3(const uint8_t* src_argb0,
                         int src_stride_argb,
-                        uint8* dst_u,
-                        uint8* dst_v,
+                        uint8_t* dst_u,
+                        uint8_t* dst_v,
                         int width);
-void BGRAToUVRow_SSSE3(const uint8* src_bgra,
+void BGRAToUVRow_SSSE3(const uint8_t* src_bgra0,
                        int src_stride_bgra,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ABGRToUVRow_SSSE3(const uint8* src_abgr,
+void ABGRToUVRow_SSSE3(const uint8_t* src_abgr0,
                        int src_stride_abgr,
-                       uint8* dst_u,
-                       uint8* dst_v,
-                       int width);
-void RGBAToUVRow_SSSE3(const uint8* src_rgba,
-                       int src_stride_rgba,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ARGBToUVRow_Any_AVX2(const uint8* src_argb,
-                          int src_stride_argb,
-                          uint8* dst_u,
-                          uint8* dst_v,
-                          int width);
-void ARGBToUVJRow_Any_AVX2(const uint8* src_argb,
-                           int src_stride_argb,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ARGBToUVRow_Any_SSSE3(const uint8* src_argb,
-                           int src_stride_argb,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ARGBToUVJRow_Any_SSSE3(const uint8* src_argb,
-                            int src_stride_argb,
-                            uint8* dst_u,
-                            uint8* dst_v,
-                            int width);
-void BGRAToUVRow_Any_SSSE3(const uint8* src_bgra,
-                           int src_stride_bgra,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ABGRToUVRow_Any_SSSE3(const uint8* src_abgr,
-                           int src_stride_abgr,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void RGBAToUVRow_Any_SSSE3(const uint8* src_rgba,
-                           int src_stride_rgba,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ARGBToUV444Row_Any_NEON(const uint8* src_argb,
-                             uint8* dst_u,
-                             uint8* dst_v,
-                             int width);
-void ARGBToUVRow_Any_NEON(const uint8* src_argb,
-                          int src_stride_argb,
-                          uint8* dst_u,
-                          uint8* dst_v,
+void RGBAToUVRow_SSSE3(const uint8_t* src_rgba0,
+                       int src_stride_rgba,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
+                       int width);
+void ARGBToUVRow_Any_AVX2(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
                           int width);
-void ARGBToUV444Row_Any_MSA(const uint8* src_argb,
-                            uint8* dst_u,
-                            uint8* dst_v,
-                            int width);
-void ARGBToUVRow_Any_MSA(const uint8* src_argb,
-                         int src_stride_argb,
-                         uint8* dst_u,
-                         uint8* dst_v,
-                         int width);
-void ARGBToUVJRow_Any_NEON(const uint8* src_argb,
-                           int src_stride_argb,
-                           uint8* dst_u,
-                           uint8* dst_v,
+void ARGBToUVJRow_Any_AVX2(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
+                           int width);
+void ARGBToUVRow_Any_SSSE3(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
                            int width);
-void BGRAToUVRow_Any_NEON(const uint8* src_bgra,
-                          int src_stride_bgra,
-                          uint8* dst_u,
-                          uint8* dst_v,
-                          int width);
-void ABGRToUVRow_Any_NEON(const uint8* src_abgr,
-                          int src_stride_abgr,
-                          uint8* dst_u,
-                          uint8* dst_v,
-                          int width);
-void RGBAToUVRow_Any_NEON(const uint8* src_rgba,
-                          int src_stride_rgba,
-                          uint8* dst_u,
-                          uint8* dst_v,
+void ARGBToUVJRow_Any_SSSE3(const uint8_t* src_ptr,
+                            int src_stride_ptr,
+                            uint8_t* dst_u,
+                            uint8_t* dst_v,
+                            int width);
+void BGRAToUVRow_Any_SSSE3(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
+                           int width);
+void ABGRToUVRow_Any_SSSE3(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
+                           int width);
+void RGBAToUVRow_Any_SSSE3(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
+                           int width);
+void ARGBToUV444Row_Any_NEON(const uint8_t* src_ptr,
+                             uint8_t* dst_u,
+                             uint8_t* dst_v,
+                             int width);
+void ARGBToUVRow_Any_NEON(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
                           int width);
-void RGB24ToUVRow_Any_NEON(const uint8* src_rgb24,
-                           int src_stride_rgb24,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void RAWToUVRow_Any_NEON(const uint8* src_raw,
-                         int src_stride_raw,
-                         uint8* dst_u,
-                         uint8* dst_v,
-                         int width);
-void RGB565ToUVRow_Any_NEON(const uint8* src_rgb565,
-                            int src_stride_rgb565,
-                            uint8* dst_u,
-                            uint8* dst_v,
+void ARGBToUV444Row_Any_MSA(const uint8_t* src_ptr,
+                            uint8_t* dst_u,
+                            uint8_t* dst_v,
                             int width);
-void ARGB1555ToUVRow_Any_NEON(const uint8* src_argb1555,
-                              int src_stride_argb1555,
-                              uint8* dst_u,
-                              uint8* dst_v,
-                              int width);
-void ARGB4444ToUVRow_Any_NEON(const uint8* src_argb4444,
-                              int src_stride_argb4444,
-                              uint8* dst_u,
-                              uint8* dst_v,
-                              int width);
-void ARGBToUVJRow_Any_MSA(const uint8* src_argb,
-                          int src_stride_argb,
-                          uint8* dst_u,
-                          uint8* dst_v,
+void ARGBToUVRow_Any_MSA(const uint8_t* src_ptr,
+                         int src_stride_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void ARGBToUVJRow_Any_NEON(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
+                           int width);
+void BGRAToUVRow_Any_NEON(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
+                          int width);
+void ABGRToUVRow_Any_NEON(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
+                          int width);
+void RGBAToUVRow_Any_NEON(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
                           int width);
-void BGRAToUVRow_Any_MSA(const uint8* src_bgra,
-                         int src_stride_bgra,
-                         uint8* dst_u,
-                         uint8* dst_v,
-                         int width);
-void ABGRToUVRow_Any_MSA(const uint8* src_abgr,
-                         int src_stride_abgr,
-                         uint8* dst_u,
-                         uint8* dst_v,
+void RGB24ToUVRow_Any_NEON(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
+                           int width);
+void RAWToUVRow_Any_NEON(const uint8_t* src_ptr,
+                         int src_stride_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
                          int width);
-void RGBAToUVRow_Any_MSA(const uint8* src_rgba,
-                         int src_stride_rgba,
-                         uint8* dst_u,
-                         uint8* dst_v,
+void RGB565ToUVRow_Any_NEON(const uint8_t* src_ptr,
+                            int src_stride_ptr,
+                            uint8_t* dst_u,
+                            uint8_t* dst_v,
+                            int width);
+void ARGB1555ToUVRow_Any_NEON(const uint8_t* src_ptr,
+                              int src_stride_ptr,
+                              uint8_t* dst_u,
+                              uint8_t* dst_v,
+                              int width);
+void ARGB4444ToUVRow_Any_NEON(const uint8_t* src_ptr,
+                              int src_stride_ptr,
+                              uint8_t* dst_u,
+                              uint8_t* dst_v,
+                              int width);
+void ARGBToUVJRow_Any_MSA(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
+                          int width);
+void BGRAToUVRow_Any_MSA(const uint8_t* src_ptr,
+                         int src_stride_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
                          int width);
-void RGB24ToUVRow_Any_MSA(const uint8* src_rgb24,
-                          int src_stride_rgb24,
-                          uint8* dst_u,
-                          uint8* dst_v,
+void ABGRToUVRow_Any_MSA(const uint8_t* src_ptr,
+                         int src_stride_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void RGBAToUVRow_Any_MSA(const uint8_t* src_ptr,
+                         int src_stride_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void RGB24ToUVRow_Any_MSA(const uint8_t* src_ptr,
+                          int src_stride_ptr,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
                           int width);
-void RAWToUVRow_Any_MSA(const uint8* src_raw,
-                        int src_stride_raw,
-                        uint8* dst_u,
-                        uint8* dst_v,
+void RAWToUVRow_Any_MSA(const uint8_t* src_ptr,
+                        int src_stride_ptr,
+                        uint8_t* dst_u,
+                        uint8_t* dst_v,
                         int width);
-void RGB565ToUVRow_Any_MSA(const uint8* src_rgb565,
-                           int src_stride_rgb565,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ARGB1555ToUVRow_Any_MSA(const uint8* src_argb1555,
-                             int src_stride_argb1555,
-                             uint8* dst_u,
-                             uint8* dst_v,
-                             int width);
-void BGRAToUVRow_Any_DSPR2(const uint8* src_bgra,
-                           int src_stride_bgra,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ABGRToUVRow_Any_DSPR2(const uint8* src_abgr,
-                           int src_stride_abgr,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void RGBAToUVRow_Any_DSPR2(const uint8* src_rgba,
-                           int src_stride_rgba,
-                           uint8* dst_u,
-                           uint8* dst_v,
-                           int width);
-void ARGBToUVRow_Any_DSPR2(const uint8* src_argb,
-                           int src_stride_argb,
-                           uint8* dst_u,
-                           uint8* dst_v,
+void RGB565ToUVRow_Any_MSA(const uint8_t* src_ptr,
+                           int src_stride_ptr,
+                           uint8_t* dst_u,
+                           uint8_t* dst_v,
                            int width);
-void ARGBToUVRow_C(const uint8* src_argb,
-                   int src_stride_argb,
-                   uint8* dst_u,
-                   uint8* dst_v,
-                   int width);
-void ARGBToUVJRow_C(const uint8* src_argb,
-                    int src_stride_argb,
-                    uint8* dst_u,
-                    uint8* dst_v,
-                    int width);
-void ARGBToUVRow_C(const uint8* src_argb,
-                   int src_stride_argb,
-                   uint8* dst_u,
-                   uint8* dst_v,
+void ARGB1555ToUVRow_Any_MSA(const uint8_t* src_ptr,
+                             int src_stride_ptr,
+                             uint8_t* dst_u,
+                             uint8_t* dst_v,
+                             int width);
+void ARGBToUVRow_C(const uint8_t* src_rgb0,
+                   int src_stride_rgb,
+                   uint8_t* dst_u,
+                   uint8_t* dst_v,
                    int width);
-void ARGBToUVJRow_C(const uint8* src_argb,
-                    int src_stride_argb,
-                    uint8* dst_u,
-                    uint8* dst_v,
+void ARGBToUVJRow_C(const uint8_t* src_rgb0,
+                    int src_stride_rgb,
+                    uint8_t* dst_u,
+                    uint8_t* dst_v,
                     int width);
-void BGRAToUVRow_C(const uint8* src_bgra,
-                   int src_stride_bgra,
-                   uint8* dst_u,
-                   uint8* dst_v,
+void ARGBToUVRow_C(const uint8_t* src_rgb0,
+                   int src_stride_rgb,
+                   uint8_t* dst_u,
+                   uint8_t* dst_v,
                    int width);
-void ABGRToUVRow_C(const uint8* src_abgr,
-                   int src_stride_abgr,
-                   uint8* dst_u,
-                   uint8* dst_v,
+void ARGBToUVJRow_C(const uint8_t* src_rgb0,
+                    int src_stride_rgb,
+                    uint8_t* dst_u,
+                    uint8_t* dst_v,
+                    int width);
+void BGRAToUVRow_C(const uint8_t* src_rgb0,
+                   int src_stride_rgb,
+                   uint8_t* dst_u,
+                   uint8_t* dst_v,
                    int width);
-void RGBAToUVRow_C(const uint8* src_rgba,
-                   int src_stride_rgba,
-                   uint8* dst_u,
-                   uint8* dst_v,
+void ABGRToUVRow_C(const uint8_t* src_rgb0,
+                   int src_stride_rgb,
+                   uint8_t* dst_u,
+                   uint8_t* dst_v,
+                   int width);
+void RGBAToUVRow_C(const uint8_t* src_rgb0,
+                   int src_stride_rgb,
+                   uint8_t* dst_u,
+                   uint8_t* dst_v,
                    int width);
-void RGB24ToUVRow_C(const uint8* src_rgb24,
-                    int src_stride_rgb24,
-                    uint8* dst_u,
-                    uint8* dst_v,
+void RGB24ToUVRow_C(const uint8_t* src_rgb0,
+                    int src_stride_rgb,
+                    uint8_t* dst_u,
+                    uint8_t* dst_v,
                     int width);
-void RAWToUVRow_C(const uint8* src_raw,
-                  int src_stride_raw,
-                  uint8* dst_u,
-                  uint8* dst_v,
+void RAWToUVRow_C(const uint8_t* src_rgb0,
+                  int src_stride_rgb,
+                  uint8_t* dst_u,
+                  uint8_t* dst_v,
                   int width);
-void RGB565ToUVRow_C(const uint8* src_rgb565,
+void RGB565ToUVRow_C(const uint8_t* src_rgb565,
                      int src_stride_rgb565,
-                     uint8* dst_u,
-                     uint8* dst_v,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
                      int width);
-void ARGB1555ToUVRow_C(const uint8* src_argb1555,
+void ARGB1555ToUVRow_C(const uint8_t* src_argb1555,
                        int src_stride_argb1555,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void ARGB4444ToUVRow_C(const uint8* src_argb4444,
+void ARGB4444ToUVRow_C(const uint8_t* src_argb4444,
                        int src_stride_argb4444,
-                       uint8* dst_u,
-                       uint8* dst_v,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
 
-void ARGBToUV444Row_SSSE3(const uint8* src_argb,
-                          uint8* dst_u,
-                          uint8* dst_v,
+void ARGBToUV444Row_SSSE3(const uint8_t* src_argb,
+                          uint8_t* dst_u,
+                          uint8_t* dst_v,
                           int width);
-void ARGBToUV444Row_Any_SSSE3(const uint8* src_argb,
-                              uint8* dst_u,
-                              uint8* dst_v,
+void ARGBToUV444Row_Any_SSSE3(const uint8_t* src_ptr,
+                              uint8_t* dst_u,
+                              uint8_t* dst_v,
                               int width);
 
-void ARGBToUV444Row_C(const uint8* src_argb,
-                      uint8* dst_u,
-                      uint8* dst_v,
+void ARGBToUV444Row_C(const uint8_t* src_argb,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
 
-void MirrorRow_AVX2(const uint8* src, uint8* dst, int width);
-void MirrorRow_SSSE3(const uint8* src, uint8* dst, int width);
-void MirrorRow_NEON(const uint8* src, uint8* dst, int width);
-void MirrorRow_DSPR2(const uint8* src, uint8* dst, int width);
-void MirrorRow_MSA(const uint8* src, uint8* dst, int width);
-void MirrorRow_C(const uint8* src, uint8* dst, int width);
-void MirrorRow_Any_AVX2(const uint8* src, uint8* dst, int width);
-void MirrorRow_Any_SSSE3(const uint8* src, uint8* dst, int width);
-void MirrorRow_Any_SSE2(const uint8* src, uint8* dst, int width);
-void MirrorRow_Any_NEON(const uint8* src, uint8* dst, int width);
-void MirrorRow_Any_MSA(const uint8* src, uint8* dst, int width);
+void MirrorRow_AVX2(const uint8_t* src, uint8_t* dst, int width);
+void MirrorRow_SSSE3(const uint8_t* src, uint8_t* dst, int width);
+void MirrorRow_NEON(const uint8_t* src, uint8_t* dst, int width);
+void MirrorRow_MSA(const uint8_t* src, uint8_t* dst, int width);
+void MirrorRow_C(const uint8_t* src, uint8_t* dst, int width);
+void MirrorRow_Any_AVX2(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void MirrorRow_Any_SSSE3(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void MirrorRow_Any_SSE2(const uint8_t* src, uint8_t* dst, int width);
+void MirrorRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void MirrorRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
 
-void MirrorUVRow_SSSE3(const uint8* src_uv,
-                       uint8* dst_u,
-                       uint8* dst_v,
+void MirrorUVRow_SSSE3(const uint8_t* src,
+                       uint8_t* dst_u,
+                       uint8_t* dst_v,
                        int width);
-void MirrorUVRow_NEON(const uint8* src_uv,
-                      uint8* dst_u,
-                      uint8* dst_v,
+void MirrorUVRow_NEON(const uint8_t* src_uv,
+                      uint8_t* dst_u,
+                      uint8_t* dst_v,
                       int width);
-void MirrorUVRow_DSPR2(const uint8* src_uv,
-                       uint8* dst_u,
-                       uint8* dst_v,
-                       int width);
-void MirrorUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width);
+void MirrorUVRow_MSA(const uint8_t* src_uv,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void MirrorUVRow_C(const uint8_t* src_uv,
+                   uint8_t* dst_u,
+                   uint8_t* dst_v,
+                   int width);
+
+void ARGBMirrorRow_AVX2(const uint8_t* src, uint8_t* dst, int width);
+void ARGBMirrorRow_SSE2(const uint8_t* src, uint8_t* dst, int width);
+void ARGBMirrorRow_NEON(const uint8_t* src, uint8_t* dst, int width);
+void ARGBMirrorRow_MSA(const uint8_t* src, uint8_t* dst, int width);
+void ARGBMirrorRow_C(const uint8_t* src, uint8_t* dst, int width);
+void ARGBMirrorRow_Any_AVX2(const uint8_t* src_ptr,
+                            uint8_t* dst_ptr,
+                            int width);
+void ARGBMirrorRow_Any_SSE2(const uint8_t* src_ptr,
+                            uint8_t* dst_ptr,
+                            int width);
+void ARGBMirrorRow_Any_NEON(const uint8_t* src_ptr,
+                            uint8_t* dst_ptr,
+                            int width);
+void ARGBMirrorRow_Any_MSA(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
 
-void ARGBMirrorRow_AVX2(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_SSE2(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_NEON(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_MSA(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_C(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_Any_AVX2(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_Any_SSE2(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_Any_NEON(const uint8* src, uint8* dst, int width);
-void ARGBMirrorRow_Any_MSA(const uint8* src, uint8* dst, int width);
+void SplitUVRow_C(const uint8_t* src_uv,
+                  uint8_t* dst_u,
+                  uint8_t* dst_v,
+                  int width);
+void SplitUVRow_SSE2(const uint8_t* src_uv,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void SplitUVRow_AVX2(const uint8_t* src_uv,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void SplitUVRow_NEON(const uint8_t* src_uv,
+                     uint8_t* dst_u,
+                     uint8_t* dst_v,
+                     int width);
+void SplitUVRow_MSA(const uint8_t* src_uv,
+                    uint8_t* dst_u,
+                    uint8_t* dst_v,
+                    int width);
+void SplitUVRow_Any_SSE2(const uint8_t* src_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void SplitUVRow_Any_AVX2(const uint8_t* src_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void SplitUVRow_Any_NEON(const uint8_t* src_ptr,
+                         uint8_t* dst_u,
+                         uint8_t* dst_v,
+                         int width);
+void SplitUVRow_Any_MSA(const uint8_t* src_ptr,
+                        uint8_t* dst_u,
+                        uint8_t* dst_v,
+                        int width);
 
-void SplitUVRow_C(const uint8* src_uv, uint8* dst_u, uint8* dst_v, int width);
-void SplitUVRow_SSE2(const uint8* src_uv,
-                     uint8* dst_u,
-                     uint8* dst_v,
+void MergeUVRow_C(const uint8_t* src_u,
+                  const uint8_t* src_v,
+                  uint8_t* dst_uv,
+                  int width);
+void MergeUVRow_SSE2(const uint8_t* src_u,
+                     const uint8_t* src_v,
+                     uint8_t* dst_uv,
                      int width);
-void SplitUVRow_AVX2(const uint8* src_uv,
-                     uint8* dst_u,
-                     uint8* dst_v,
+void MergeUVRow_AVX2(const uint8_t* src_u,
+                     const uint8_t* src_v,
+                     uint8_t* dst_uv,
                      int width);
-void SplitUVRow_NEON(const uint8* src_uv,
-                     uint8* dst_u,
-                     uint8* dst_v,
+void MergeUVRow_NEON(const uint8_t* src_u,
+                     const uint8_t* src_v,
+                     uint8_t* dst_uv,
                      int width);
-void SplitUVRow_DSPR2(const uint8* src_uv,
-                      uint8* dst_u,
-                      uint8* dst_v,
-                      int width);
-void SplitUVRow_Any_SSE2(const uint8* src_uv,
-                         uint8* dst_u,
-                         uint8* dst_v,
+void MergeUVRow_MSA(const uint8_t* src_u,
+                    const uint8_t* src_v,
+                    uint8_t* dst_uv,
+                    int width);
+void MergeUVRow_Any_SSE2(const uint8_t* y_buf,
+                         const uint8_t* uv_buf,
+                         uint8_t* dst_ptr,
+                         int width);
+void MergeUVRow_Any_AVX2(const uint8_t* y_buf,
+                         const uint8_t* uv_buf,
+                         uint8_t* dst_ptr,
+                         int width);
+void MergeUVRow_Any_NEON(const uint8_t* y_buf,
+                         const uint8_t* uv_buf,
+                         uint8_t* dst_ptr,
                          int width);
-void SplitUVRow_Any_AVX2(const uint8* src_uv,
-                         uint8* dst_u,
-                         uint8* dst_v,
-                         int width);
-void SplitUVRow_Any_NEON(const uint8* src_uv,
-                         uint8* dst_u,
-                         uint8* dst_v,
-                         int width);
-void SplitUVRow_Any_DSPR2(const uint8* src_uv,
-                          uint8* dst_u,
-                          uint8* dst_v,
+void MergeUVRow_Any_MSA(const uint8_t* y_buf,
+                        const uint8_t* uv_buf,
+                        uint8_t* dst_ptr,
+                        int width);
+
+void SplitRGBRow_C(const uint8_t* src_rgb,
+                   uint8_t* dst_r,
+                   uint8_t* dst_g,
+                   uint8_t* dst_b,
+                   int width);
+void SplitRGBRow_SSSE3(const uint8_t* src_rgb,
+                       uint8_t* dst_r,
+                       uint8_t* dst_g,
+                       uint8_t* dst_b,
+                       int width);
+void SplitRGBRow_NEON(const uint8_t* src_rgb,
+                      uint8_t* dst_r,
+                      uint8_t* dst_g,
+                      uint8_t* dst_b,
+                      int width);
+void SplitRGBRow_Any_SSSE3(const uint8_t* src_ptr,
+                           uint8_t* dst_r,
+                           uint8_t* dst_g,
+                           uint8_t* dst_b,
+                           int width);
+void SplitRGBRow_Any_NEON(const uint8_t* src_ptr,
+                          uint8_t* dst_r,
+                          uint8_t* dst_g,
+                          uint8_t* dst_b,
                           int width);
 
-void MergeUVRow_C(const uint8* src_u,
-                  const uint8* src_v,
-                  uint8* dst_uv,
-                  int width);
-void MergeUVRow_SSE2(const uint8* src_u,
-                     const uint8* src_v,
-                     uint8* dst_uv,
-                     int width);
-void MergeUVRow_AVX2(const uint8* src_u,
-                     const uint8* src_v,
-                     uint8* dst_uv,
+void MergeRGBRow_C(const uint8_t* src_r,
+                   const uint8_t* src_g,
+                   const uint8_t* src_b,
+                   uint8_t* dst_rgb,
+                   int width);
+void MergeRGBRow_SSSE3(const uint8_t* src_r,
+                       const uint8_t* src_g,
+                       const uint8_t* src_b,
+                       uint8_t* dst_rgb,
+                       int width);
+void MergeRGBRow_NEON(const uint8_t* src_r,
+                      const uint8_t* src_g,
+                      const uint8_t* src_b,
+                      uint8_t* dst_rgb,
+                      int width);
+void MergeRGBRow_Any_SSSE3(const uint8_t* y_buf,
+                           const uint8_t* u_buf,
+                           const uint8_t* v_buf,
+                           uint8_t* dst_ptr,
+                           int width);
+void MergeRGBRow_Any_NEON(const uint8_t* src_r,
+                          const uint8_t* src_g,
+                          const uint8_t* src_b,
+                          uint8_t* dst_rgb,
+                          int width);
+
+void MergeUVRow_16_C(const uint16_t* src_u,
+                     const uint16_t* src_v,
+                     uint16_t* dst_uv,
+                     int scale, /* 64 for 10 bit */
                      int width);
-void MergeUVRow_NEON(const uint8* src_u,
-                     const uint8* src_v,
-                     uint8* dst_uv,
-                     int width);
-void MergeUVRow_Any_SSE2(const uint8* src_u,
-                         const uint8* src_v,
-                         uint8* dst_uv,
-                         int width);
-void MergeUVRow_Any_AVX2(const uint8* src_u,
-                         const uint8* src_v,
-                         uint8* dst_uv,
+void MergeUVRow_16_AVX2(const uint16_t* src_u,
+                        const uint16_t* src_v,
+                        uint16_t* dst_uv,
+                        int scale,
+                        int width);
+
+void MultiplyRow_16_AVX2(const uint16_t* src_y,
+                         uint16_t* dst_y,
+                         int scale,
                          int width);
-void MergeUVRow_Any_NEON(const uint8* src_u,
-                         const uint8* src_v,
-                         uint8* dst_uv,
-                         int width);
+void MultiplyRow_16_C(const uint16_t* src_y,
+                      uint16_t* dst_y,
+                      int scale,
+                      int width);
+
+void Convert8To16Row_C(const uint8_t* src_y,
+                       uint16_t* dst_y,
+                       int scale,
+                       int width);
+void Convert8To16Row_SSE2(const uint8_t* src_y,
+                          uint16_t* dst_y,
+                          int scale,
+                          int width);
+void Convert8To16Row_AVX2(const uint8_t* src_y,
+                          uint16_t* dst_y,
+                          int scale,
+                          int width);
+void Convert8To16Row_Any_SSE2(const uint8_t* src_ptr,
+                              uint16_t* dst_ptr,
+                              int scale,
+                              int width);
+void Convert8To16Row_Any_AVX2(const uint8_t* src_ptr,
+                              uint16_t* dst_ptr,
+                              int scale,
+                              int width);
 
-void CopyRow_SSE2(const uint8* src, uint8* dst, int count);
-void CopyRow_AVX(const uint8* src, uint8* dst, int count);
-void CopyRow_ERMS(const uint8* src, uint8* dst, int count);
-void CopyRow_NEON(const uint8* src, uint8* dst, int count);
-void CopyRow_MIPS(const uint8* src, uint8* dst, int count);
-void CopyRow_C(const uint8* src, uint8* dst, int count);
-void CopyRow_Any_SSE2(const uint8* src, uint8* dst, int count);
-void CopyRow_Any_AVX(const uint8* src, uint8* dst, int count);
-void CopyRow_Any_NEON(const uint8* src, uint8* dst, int count);
+void Convert16To8Row_C(const uint16_t* src_y,
+                       uint8_t* dst_y,
+                       int scale,
+                       int width);
+void Convert16To8Row_SSSE3(const uint16_t* src_y,
+                           uint8_t* dst_y,
+                           int scale,
+                           int width);
+void Convert16To8Row_AVX2(const uint16_t* src_y,
+                          uint8_t* dst_y,
+                          int scale,
+                          int width);
+void Convert16To8Row_Any_SSSE3(const uint16_t* src_ptr,
+                               uint8_t* dst_ptr,
+                               int scale,
+                               int width);
+void Convert16To8Row_Any_AVX2(const uint16_t* src_ptr,
+                              uint8_t* dst_ptr,
+                              int scale,
+                              int width);
 
-void CopyRow_16_C(const uint16* src, uint16* dst, int count);
+void CopyRow_SSE2(const uint8_t* src, uint8_t* dst, int width);
+void CopyRow_AVX(const uint8_t* src, uint8_t* dst, int width);
+void CopyRow_ERMS(const uint8_t* src, uint8_t* dst, int width);
+void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int width);
+void CopyRow_MIPS(const uint8_t* src, uint8_t* dst, int count);
+void CopyRow_C(const uint8_t* src, uint8_t* dst, int count);
+void CopyRow_Any_SSE2(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void CopyRow_Any_AVX(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
+void CopyRow_Any_NEON(const uint8_t* src_ptr, uint8_t* dst_ptr, int width);
 
-void ARGBCopyAlphaRow_C(const uint8* src_argb, uint8* dst_argb, int width);
-void ARGBCopyAlphaRow_SSE2(const uint8* src_argb, uint8* dst_argb, int width);
-void ARGBCopyAlphaRow_AVX2(const uint8* src_argb, uint8* dst_argb, int width);
-void ARGBCopyAlphaRow_Any_SSE2(const uint8* src_argb,
-                               uint8* dst_argb,
+void CopyRow_16_C(const uint16_t* src, uint16_t* dst, int count);
+
+void ARGBCopyAlphaRow_C(const uint8_t* src, uint8_t* dst, int width);
+void ARGBCopyAlphaRow_SSE2(const uint8_t* src, uint8_t* dst, int width);
+void ARGBCopyAlphaRow_AVX2(const uint8_t* src, uint8_t* dst, int width);
+void ARGBCopyAlphaRow_Any_SSE2(const uint8_t* src_ptr,
+                               uint8_t* dst_ptr,
                                int width);
-void ARGBCopyAlphaRow_Any_AVX2(const uint8* src_argb,
-                               uint8* dst_argb,
+void ARGBCopyAlphaRow_Any_AVX2(const uint8_t* src_ptr,
+                               uint8_t* dst_ptr,
                                int width);
 
-void ARGBExtractAlphaRow_C(const uint8* src_argb, uint8* dst_a, int width);
-void ARGBExtractAlphaRow_SSE2(const uint8* src_argb, uint8* dst_a, int width);
-void ARGBExtractAlphaRow_AVX2(const uint8* src_argb, uint8* dst_a, int width);
-void ARGBExtractAlphaRow_NEON(const uint8* src_argb, uint8* dst_a, int width);
-void ARGBExtractAlphaRow_Any_SSE2(const uint8* src_argb,
-                                  uint8* dst_a,
-                                  int width);
-void ARGBExtractAlphaRow_Any_AVX2(const uint8* src_argb,
-                                  uint8* dst_a,
+void ARGBExtractAlphaRow_C(const uint8_t* src_argb, uint8_t* dst_a, int width);
+void ARGBExtractAlphaRow_SSE2(const uint8_t* src_argb,
+                              uint8_t* dst_a,
+                              int width);
+void ARGBExtractAlphaRow_AVX2(const uint8_t* src_argb,
+                              uint8_t* dst_a,
+                              int width);
+void ARGBExtractAlphaRow_NEON(const uint8_t* src_argb,
+                              uint8_t* dst_a,
+                              int width);
+void ARGBExtractAlphaRow_MSA(const uint8_t* src_argb,
+                             uint8_t* dst_a,
+                             int width);
+void ARGBExtractAlphaRow_Any_SSE2(const uint8_t* src_ptr,
+                                  uint8_t* dst_ptr,
                                   int width);
-void ARGBExtractAlphaRow_Any_NEON(const uint8* src_argb,