Skip to content

Commit

Permalink
Bug 1945602 - Update libyuv to 96f98f6915885f84b895dddcf8a553dc50a35a…
Browse files Browse the repository at this point in the history
…ad r=ng

Differential Revision: https://phabricator.services.mozilla.com/D236578
  • Loading branch information
updatebot-ci committed Feb 25, 2025
1 parent ae64a6b commit 58bdae1
Show file tree
Hide file tree
Showing 39 changed files with 1,809 additions and 1,657 deletions.
4 changes: 1 addition & 3 deletions media/libyuv/libyuv/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ if (libyuv_include_tests) {

if (is_linux || is_chromeos) {
cflags = [ "-fexceptions" ]

# For enabling ASLR.
ldflags = [ "-pie" ]
}
Expand All @@ -406,9 +407,6 @@ if (libyuv_include_tests) {
if (!is_ios && !libyuv_disable_jpeg) {
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.
Expand Down
2 changes: 1 addition & 1 deletion media/libyuv/libyuv/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CMakeLists for libyuv
# Originally created for "roxlu build system" to compile libyuv on windows
# Run with -DTEST=ON to build unit tests
# Run with -DUNIT_TEST=ON to build unit tests

include(CheckCSourceCompiles)

Expand Down
1,699 changes: 508 additions & 1,191 deletions media/libyuv/libyuv/DEPS

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion media/libyuv/libyuv/README.chromium
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Name: libyuv
URL: https://chromium.googlesource.com/libyuv/libyuv/
Version: 1899
Version: 1902
License: BSD
License File: LICENSE
Shipped: yes
Security Critical: yes

Description:
libyuv is an open source project that includes YUV conversion and scaling functionality.
Expand Down
5 changes: 3 additions & 2 deletions media/libyuv/libyuv/build_overrides/build.gni
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ ignore_elf32_limitations = true

# Use bundled hermetic Xcode installation maintained by Chromium,
# except for local iOS builds where it is unsupported.
if (host_os == "mac") {
# Allow for mac cross compile on linux machines.
if (host_os == "mac" || host_os == "linux") {
_result = exec_script("//build/mac/should_use_hermetic_xcode.py",
[ target_os ],
"value")
assert(_result != 2,
"Do not allow building targets with the default" +
"Do not allow building targets with the default " +
"hermetic toolchain if the minimum OS version is not met.")
use_system_xcode = _result == 0
}
Expand Down
1 change: 1 addition & 0 deletions media/libyuv/libyuv/docs/environment_variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ By default the cpu is detected and the most advanced form of SIMD is used. But
LIBYUV_DISABLE_AVX512VBMI2
LIBYUV_DISABLE_AVX512VBITALG
LIBYUV_DISABLE_AVX10
LIBYUV_DISABLE_AVX10_2
LIBYUV_DISABLE_AVXVNNI
LIBYUV_DISABLE_AVXVNNIINT8
LIBYUV_DISABLE_AMXINT8
Expand Down
30 changes: 30 additions & 0 deletions media/libyuv/libyuv/include/libyuv/convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,23 @@ int I400ToI420(const uint8_t* src_y,
int width,
int height);

// Convert J420 to I420.
LIBYUV_API
int J420ToI420(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 I400 (grey) to NV21.
LIBYUV_API
int I400ToNV21(const uint8_t* src_y,
Expand Down Expand Up @@ -920,6 +937,19 @@ int RAWToJ420(const uint8_t* src_raw,
int width,
int height);

// RGB big endian (rgb in memory) to J444.
LIBYUV_API
int RAWToJ444(const uint8_t* src_raw,
int src_stride_raw,
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);

// RGB16 (RGBP fourcc) little endian to I420.
LIBYUV_API
int RGB565ToI420(const uint8_t* src_rgb565,
Expand Down
13 changes: 13 additions & 0 deletions media/libyuv/libyuv/include/libyuv/convert_from_argb.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ int ARGBToJ422(const uint8_t* src_argb,
int width,
int height);

// Convert ARGB to J444.
LIBYUV_API
int ARGBToJ444(const uint8_t* src_argb,
int src_stride_argb,
uint8_t* dst_yj,
int dst_stride_yj,
uint8_t* dst_uj,
int dst_stride_uj,
uint8_t* dst_vj,
int dst_stride_vj,
int width,
int height);

// Convert ARGB to J400. (JPeg full range).
LIBYUV_API
int ARGBToJ400(const uint8_t* src_argb,
Expand Down
7 changes: 4 additions & 3 deletions media/libyuv/libyuv/include/libyuv/cpu_id.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ static const int kCpuHasAVX512VBMI = 0x200000;
static const int kCpuHasAVX512VBMI2 = 0x400000;
static const int kCpuHasAVX512VBITALG = 0x800000;
static const int kCpuHasAVX10 = 0x1000000;
static const int kCpuHasAVXVNNI = 0x2000000;
static const int kCpuHasAVXVNNIINT8 = 0x4000000;
static const int kCpuHasAMXINT8 = 0x8000000;
static const int kCpuHasAVX10_2 = 0x2000000;
static const int kCpuHasAVXVNNI = 0x4000000;
static const int kCpuHasAVXVNNIINT8 = 0x8000000;
static const int kCpuHasAMXINT8 = 0x10000000;

// These flags are only valid on MIPS processors.
static const int kCpuHasMIPS = 0x10;
Expand Down
10 changes: 10 additions & 0 deletions media/libyuv/libyuv/include/libyuv/planar_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ void Convert8To16Plane(const uint8_t* src_y,
int width,
int height);

LIBYUV_API
void Convert8To8Plane(const uint8_t* src_y,
int src_stride_y,
uint8_t* dst_y,
int dst_stride_y,
int scale, // 220 for Y, 225 for U,V
int bias, // 16
int width,
int height);

// Set a plane of data to a 32 bit value.
LIBYUV_API
void SetPlane(uint8_t* dst_y,
Expand Down
73 changes: 67 additions & 6 deletions media/libyuv/libyuv/include/libyuv/row.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,8 @@ extern "C" {

// The following functions fail on gcc/clang 32 bit with fpic and framepointer.
// caveat: clangcl uses row_win.cc which works.
#if !defined(MOZ_PROFILING) && \
(defined(__x86_64__) || !defined(__pic__) || defined(__clang__) || \
defined(_MSC_VER))
#if defined(__x86_64__) || !defined(__pic__) || defined(__clang__) || \
defined(_MSC_VER)
// TODO(fbarchard): fix build error on android_full_debug=1
// https://code.google.com/p/libyuv/issues/detail?id=517
#define HAS_I422ALPHATOARGBROW_SSSE3
Expand Down Expand Up @@ -193,9 +192,8 @@ extern "C" {
#define HAS_ARGBSUBTRACTROW_AVX2
#define HAS_BLENDPLANEROW_AVX2

#if !defined(MOZ_PROFILING) && \
(defined(__x86_64__) || !defined(__pic__) || defined(__clang__) || \
defined(_MSC_VER))
#if defined(__x86_64__) || !defined(__pic__) || defined(__clang__) || \
defined(_MSC_VER)
// TODO(fbarchard): fix build error on android_full_debug=1
// https://code.google.com/p/libyuv/issues/detail?id=517
#define HAS_I422ALPHATOARGBROW_AVX2
Expand Down Expand Up @@ -303,6 +301,7 @@ extern "C" {
#define HAS_ARGBUNATTENUATEROW_AVX2
#define HAS_CONVERT16TO8ROW_AVX2
#define HAS_CONVERT8TO16ROW_AVX2
#define HAS_CONVERT8TO8ROW_AVX2
#define HAS_DETILEROW_16_AVX
#define HAS_DIVIDEROW_16_AVX2
#define HAS_HALFMERGEUVROW_AVX2
Expand Down Expand Up @@ -396,6 +395,7 @@ extern "C" {
#define HAS_ARGBTORGB565DITHERROW_NEON
#define HAS_ARGBTORGB565ROW_NEON
#define HAS_ARGBTOUV444ROW_NEON
#define HAS_ARGBTOUVJ444ROW_NEON
#define HAS_ARGBTOUVJROW_NEON
#define HAS_ARGBTOUVROW_NEON
#define HAS_ARGBTOYJROW_NEON
Expand All @@ -407,6 +407,7 @@ extern "C" {
#define HAS_BGRATOYROW_NEON
#define HAS_BYTETOFLOATROW_NEON
#define HAS_CONVERT16TO8ROW_NEON
#define HAS_CONVERT8TO8ROW_NEON
#define HAS_COPYROW_NEON
#define HAS_DETILEROW_16_NEON
#define HAS_DETILEROW_NEON
Expand Down Expand Up @@ -537,6 +538,7 @@ extern "C" {

#define HAS_ARGBCOLORMATRIXROW_NEON_I8MM
#define HAS_ARGBTOUV444ROW_NEON_I8MM
#define HAS_ARGBTOUVJ444ROW_NEON_I8MM
#endif

// The following are available on AArch64 SVE platforms:
Expand All @@ -553,6 +555,7 @@ extern "C" {
#define HAS_AYUVTOUVROW_SVE2
#define HAS_AYUVTOVUROW_SVE2
#define HAS_BGRATOUVROW_SVE2
#define HAS_CONVERT8TO8ROW_SVE2
#define HAS_DIVIDEROW_16_SVE2
#define HAS_HALFFLOATROW_SVE2
#define HAS_I210ALPHATOARGBROW_SVE2
Expand Down Expand Up @@ -595,6 +598,7 @@ extern "C" {
defined(__aarch64__)
#define HAS_ARGBMULTIPLYROW_SME
#define HAS_CONVERT16TO8ROW_SME
#define HAS_CONVERT8TO8ROW_SME
#define HAS_COPYROW_SME
#define HAS_I210ALPHATOARGBROW_SME
#define HAS_I210TOAR30ROW_SME
Expand Down Expand Up @@ -1856,6 +1860,14 @@ void ARGBToUV444Row_NEON_I8MM(const uint8_t* src_argb,
uint8_t* dst_u,
uint8_t* dst_v,
int width);
void ARGBToUVJ444Row_NEON(const uint8_t* src_argb,
uint8_t* dst_u,
uint8_t* dst_v,
int width);
void ARGBToUVJ444Row_NEON_I8MM(const uint8_t* src_argb,
uint8_t* dst_u,
uint8_t* dst_v,
int width);
void ARGBToUVRow_NEON(const uint8_t* src_argb,
int src_stride_argb,
uint8_t* dst_u,
Expand Down Expand Up @@ -2367,6 +2379,14 @@ void ARGBToUV444Row_Any_NEON_I8MM(const uint8_t* src_ptr,
uint8_t* dst_u,
uint8_t* dst_v,
int width);
void ARGBToUVJ444Row_Any_NEON(const uint8_t* src_ptr,
uint8_t* dst_u,
uint8_t* dst_v,
int width);
void ARGBToUVJ444Row_Any_NEON_I8MM(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,
uint8_t* dst_u,
Expand Down Expand Up @@ -2684,6 +2704,11 @@ void ARGBToUV444Row_C(const uint8_t* src_argb,
uint8_t* dst_v,
int width);

void ARGBToUVJ444Row_C(const uint8_t* src_argb,
uint8_t* dst_u,
uint8_t* dst_v,
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);
Expand Down Expand Up @@ -3643,6 +3668,42 @@ void Convert16To8Row_SME(const uint16_t* src_y,
int scale,
int width);

void Convert8To8Row_C(const uint8_t* src_y,
uint8_t* dst_y,
int scale,
int bias,
int width);
void Convert8To8Row_NEON(const uint8_t* src_y,
uint8_t* dst_y,
int scale,
int bias,
int width);
void Convert8To8Row_Any_NEON(const uint8_t* src_ptr,
uint8_t* dst_ptr,
int scale,
int bias,
int width);
void Convert8To8Row_SVE2(const uint8_t* src_y,
uint8_t* dst_y,
int scale,
int bias,
int width);
void Convert8To8Row_SME(const uint8_t* src_y,
uint8_t* dst_y,
int scale,
int bias,
int width);
void Convert8To8Row_AVX2(const uint8_t* src_y,
uint8_t* dst_y,
int scale,
int bias,
int width);
void Convert8To8Row_Any_AVX2(const uint8_t* src_ptr,
uint8_t* dst_ptr,
int scale,
int bias,
int width);

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_AVX512BW(const uint8_t* src, uint8_t* dst, int width);
Expand Down
54 changes: 54 additions & 0 deletions media/libyuv/libyuv/include/libyuv/row_sve.h
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,60 @@ static inline void I212ToARGBRow_SVE_SC(const uint16_t* src_y,
: "cc", "memory", YUVTORGB_SVE_REGS);
}

#define CONVERT8TO8_SVE \
"ld1b {z0.b}, p0/z, [%[src]] \n" \
"ld1b {z1.b}, p1/z, [%[src], #1, mul vl] \n" \
"incb %[src], all, mul #2 \n" \
"subs %w[width], %w[width], %w[vl], lsl #1 \n" \
"umulh z0.b, z0.b, z2.b \n" \
"umulh z1.b, z1.b, z2.b \n" \
"prfm pldl1keep, [%[src], 448] \n" \
"add z0.b, z0.b, z3.b \n" \
"add z1.b, z1.b, z3.b \n" \
"st1b {z0.b}, p0, [%[dst]] \n" \
"st1b {z1.b}, p1, [%[dst], #1, mul vl] \n" \
"incb %[dst], all, mul #2 \n"

static inline void Convert8To8Row_SVE_SC(const uint8_t* src_y,
uint8_t* dst_y,
int scale,
int bias,
int width) STREAMING_COMPATIBLE {
uint64_t vl;
asm volatile(
"dup z2.b, %w[scale] \n"
"dup z3.b, %w[bias] \n"
"cntb %[vl] \n"
"subs %w[width], %w[width], %w[vl], lsl #1 \n"
"b.lt 2f \n"

// Run bulk of computation with all-true predicates to avoid predicate
// generation overhead.
"ptrue p0.b \n"
"ptrue p1.b \n"
"1: \n" //
CONVERT8TO8_SVE
"b.ge 1b \n"

"2: \n"
"adds %w[width], %w[width], %w[vl], lsl #1 \n"
"b.eq 99f \n"

// Calculate predicates for the final iteration to deal with the tail.
"whilelt p0.b, wzr, %w2 \n"
"whilelt p1.b, %w[vl], %w2 \n" //
CONVERT8TO8_SVE

"99: \n"
: [src] "+r"(src_y), // %[src]
[dst] "+r"(dst_y), // %[dst]
[width] "+r"(width), // %[width]
[vl] "=&r"(vl) // %[vl]
: [scale] "r"(scale), // %[scale]
[bias] "r"(bias) // %[bias]
: "cc", "memory", "z0", "z1", "z2", "z3", "p0", "p1");
}

#endif // !defined(LIBYUV_DISABLE_SVE) && defined(__aarch64__)

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion media/libyuv/libyuv/include/libyuv/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
#ifndef INCLUDE_LIBYUV_VERSION_H_
#define INCLUDE_LIBYUV_VERSION_H_

#define LIBYUV_VERSION 1899
#define LIBYUV_VERSION 1902

#endif // INCLUDE_LIBYUV_VERSION_H_
2 changes: 1 addition & 1 deletion media/libyuv/libyuv/infra/config/commit-queue.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ config_groups {
}
builders {
name: "libyuv/try/linux_msan"
experiment_percentage: 100
}
builders {
name: "libyuv/try/linux_rel"
}
builders {
name: "libyuv/try/linux_tsan2"
experiment_percentage: 100
}
builders {
name: "libyuv/try/linux_ubsan"
Expand Down
Loading

0 comments on commit 58bdae1

Please sign in to comment.