row_win.cc rewrite into intrinsics

- remove inline asm which was only for 32 bit
- add ARGBToYMatrixRow_AVX2
- add gn flag libyuv_enable_rowwin=true

Example of building with GN and Ninja:

Without the new flag:
  gn gen out/Release "--args=is_debug=false"
  ninja -C out/Release

With the new flag:
 gn gen out/Release "--args=is_debug=false libyuv_enable_rowwin=true"
 ninja -C out/Release

Bug: libyuv:42280806, 477295731, libyuv:42280902, libyuv:439628764
R=​dalecurtis@chromium.org, rrwinterton@gmail.com

Change-Id: I451bf814622fba690005c02fbf5816819c6a08c2
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/7765790
Reviewed-by: richard winterton <rrwinterton@gmail.com>
Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
Frank Barchard 2026-04-15 19:30:13 -07:00 committed by libyuv-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 0d8494abc0
commit 94644361b4
11 changed files with 145 additions and 6372 deletions

View File

@ -32,6 +32,9 @@ config("libyuv_config") {
# Define CHROMIUM to tell cpu_id to avoid sandbox unsafe system calls.
defines = [ "CHROMIUM" ]
if (libyuv_enable_rowwin) {
defines += [ "LIBYUV_ENABLE_ROWWIN=1" ]
}
if (!libyuv_use_neon) {
defines += [ "LIBYUV_DISABLE_NEON" ]
}

2
OWNERS
View File

@ -1,7 +1,7 @@
mbonadei@chromium.org
fbarchard@chromium.org
magjed@chromium.org
wtc@google.com
magjed@chromium.org
jansson@google.com
per-file *.gn=mbonadei@chromium.org,jansson@google.com

View File

@ -1,6 +1,6 @@
Name: libyuv
URL: https://chromium.googlesource.com/libyuv/libyuv/
Version: 1926
Version: 1928
Revision: DEPS
License: BSD-3-Clause
License File: LICENSE

View File

@ -22,11 +22,19 @@ namespace libyuv {
extern "C" {
#endif
// The following are available on all x86 platforms:
#if !defined(LIBYUV_DISABLE_X86) && \
(defined(_M_IX86) || \
(defined(__x86_64__) && !defined(LIBYUV_ENABLE_ROWWIN)) || \
defined(__i386__))
// This module is for Visual C 32/64 bit
#if !defined(LIBYUV_DISABLE_X86) && \
(defined(__x86_64__) || defined(__i386__) || \
defined(_M_X64) || defined(_M_X86))
#if ((defined(_MSC_VER) && !defined(__clang__)) || defined(LIBYUV_ENABLE_ROWWIN))
#define USE_ROW_WIN
#else
#define USE_ROW_GCC
#endif
#endif
// The following are available on clang x86 platforms:
#if defined(USE_ROW_GCC)
// Conversions:
#define HAS_ARGB1555TOARGBROW_SSE2
#define HAS_ARGB4444TOARGBROW_SSE2
@ -132,7 +140,7 @@ extern "C" {
// The following are available on all x86 platforms, but
// require VS2012, clang 3.4 or gcc 4.7.
#if !defined(LIBYUV_DISABLE_X86) && \
#if !defined(LIBYUV_DISABLE_X86) && defined(USE_ROW_GCC) && \
(defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2) || \
defined(GCC_HAS_AVX2))
#define HAS_ARGBCOPYALPHAROW_AVX2
@ -181,31 +189,9 @@ extern "C" {
#define HAS_BLENDPLANEROW_AVX2
#endif
// The following are available for AVX2 Visual C 32 bit:
// TODO(fbarchard): Port to gcc.
#if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && defined(_MSC_VER) && \
!defined(__clang__) && defined(VISUALC_HAS_AVX2)
#define HAS_ARGB1555TOARGBROW_AVX2
#define HAS_ARGB4444TOARGBROW_AVX2
#define HAS_ARGBTOARGB1555ROW_AVX2
#define HAS_ARGBTOARGB4444ROW_AVX2
#define HAS_ARGBTORGB565ROW_AVX2
#define HAS_J400TOARGBROW_AVX2
#define HAS_RGB565TOARGBROW_AVX2
#endif
// 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_I444ALPHATOARGBROW_SSSE3
#define HAS_I444TOARGBROW_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) && \
#if !defined(LIBYUV_DISABLE_X86) && defined(USE_ROW_GCC) && \
(defined(__x86_64__) || defined(__i386__)) && \
!defined(LIBYUV_ENABLE_ROWWIN)
#define HAS_RAWTOYJROW_SSSE3
@ -286,7 +272,7 @@ extern "C" {
// The following are available for AVX2 gcc/clang x86 platforms:
// TODO(fbarchard): Port to Visual C
#if !defined(LIBYUV_DISABLE_X86) && \
#if !defined(LIBYUV_DISABLE_X86) && defined(USE_ROW_GCC) && \
(defined(__x86_64__) || defined(__i386__)) && \
(defined(CLANG_HAS_AVX2) || defined(GCC_HAS_AVX2)) && \
!defined(LIBYUV_ENABLE_ROWWIN)
@ -362,6 +348,21 @@ extern "C" {
#endif
#endif
// This module is for Visual C 32/64 bit
#if !defined(LIBYUV_DISABLE_X86) && defined(USE_ROW_WIN) && \
(defined(__x86_64__) || defined(__i386__) || \
defined(_M_X64) || defined(_M_X86)) && \
((defined(_MSC_VER) && !defined(__clang__)) || \
defined(LIBYUV_ENABLE_ROWWIN))
#define HAS_ARGBTOYROW_AVX2
#define HAS_ABGRTOYROW_AVX2
#define HAS_ARGBTOYJROW_AVX2
#define HAS_ABGRTOYJROW_AVX2
#define HAS_RGBATOYJROW_AVX2
#define HAS_RGBATOYROW_AVX2
#define HAS_BGRATOYROW_AVX2
#endif
// The following are available for AVX512 clang x86 platforms:
// TODO(fbarchard): Port to GCC and Visual C
// TODO(b/42280744): re-enable HAS_ARGBTORGB24ROW_AVX512VBMI.

View File

@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_
#define LIBYUV_VERSION 1926
#define LIBYUV_VERSION 1928
#endif // INCLUDE_LIBYUV_VERSION_H_

View File

@ -15,6 +15,7 @@ declare_args() {
libyuv_include_tests = !build_with_chromium
libyuv_disable_jpeg = false
libyuv_disable_rvv = false
libyuv_enable_rowwin = false
libyuv_use_neon = current_cpu == "arm64" || current_cpu == "arm"
libyuv_use_sve = current_cpu == "arm64"

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,7 @@
#include "libyuv/row.h" /* For ARGBToAR30Row_AVX2 */
#endif
#if defined(__riscv) && !defined(__clang__)
#if (defined(__riscv) && !defined(__clang__)) || defined(__hexagon__)
#define DISABLE_SLOW_TESTS
#undef ENABLE_FULL_TESTS
#undef ENABLE_ROW_TESTS

View File

@ -27,7 +27,7 @@
#include "libyuv/rotate.h"
#include "libyuv/video_common.h"
#if defined(__riscv) && !defined(__clang__)
#if (defined(__riscv) && !defined(__clang__)) || defined(__hexagon__)
#define DISABLE_SLOW_TESTS
#undef ENABLE_FULL_TESTS
#define LEAN_TESTS

View File

@ -22,7 +22,7 @@
#define STRINGIZE(line) #line
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
#if defined(__riscv) && !defined(__clang__)
#if (defined(__riscv) && !defined(__clang__)) || defined(__hexagon__)
#define DISABLE_SLOW_TESTS
#undef ENABLE_FULL_TESTS
#undef ENABLE_ROW_TESTS

View File

@ -22,7 +22,7 @@
#define STRINGIZE(line) #line
#define FILELINESTR(file, line) file ":" STRINGIZE(line)
#if defined(__riscv) && !defined(__clang__)
#if (defined(__riscv) && !defined(__clang__)) || defined(__hexagon__)
#define DISABLE_SLOW_TESTS
#undef ENABLE_FULL_TESTS
#endif