Bug 1905842 - update libyuv to 616bee5420b, apply patches;r=chunmin

Differential Revision: https://phabricator.services.mozilla.com/D215669
This commit is contained in:
Nico Grunbaum 2024-07-28 06:49:14 +00:00
parent e69d3b8e53
commit 65b1e660c0
4 changed files with 132 additions and 15 deletions

View File

@ -176,8 +176,9 @@ 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(__x86_64__) || !defined(__pic__) || defined(__clang__) || \
defined(_MSC_VER)
#if !defined(MOZ_PROFILING) && \
(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
@ -242,8 +243,9 @@ extern "C" {
#define HAS_ARGBSUBTRACTROW_AVX2
#define HAS_BLENDPLANEROW_AVX2
#if defined(__x86_64__) || !defined(__pic__) || defined(__clang__) || \
defined(_MSC_VER)
#if !defined(MOZ_PROFILING) && \
(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

View File

@ -52,7 +52,7 @@
'optimize': 'max', # enable O2 and ltcg.
},
# Allows libyuv.a redistributable library without external dependencies.
'standalone_static_library': 1,
# 'standalone_static_library': 1,
'conditions': [
# Disable -Wunused-parameter
['clang == 1', {
@ -70,6 +70,9 @@
'-mfpu=vfpv3-d16',
# '-mthumb', # arm32 not thumb
],
'cflags_mozilla!': [
'<@(moz_neon_cflags_block_list)',
],
'conditions': [
# Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
['clang == 0 and use_lto == 1', {
@ -84,6 +87,9 @@
'-mfpu=neon',
# '-marm', # arm32 not thumb
],
'cflags_mozilla': [
'-mfpu=neon',
],
}],
],
}],
@ -92,7 +98,15 @@
'LIBYUV_MSA',
],
}],
['OS != "ios" and libyuv_disable_jpeg != 1', {
['build_with_mozilla == 1', {
'defines': [
'HAVE_JPEG'
],
'cflags_mozilla': [
'$(MOZ_JPEG_CFLAGS)',
],
}],
['OS != "ios" and libyuv_disable_jpeg != 1 and build_with_mozilla != 1', {
'defines': [
'HAVE_JPEG'
],
@ -146,12 +160,95 @@
'-Wl,--dynamic-linker,/system/bin/linker',
],
}],
['target_arch == "armv7" or target_arch == "arm64" and moz_have_arm_i8mm_and_dot_prod == 1 and build_with_mozilla == 1', {
'dependencies': [
':libyuv_neon',
],
}],
['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', {
'dependencies': [
':libyuv_sve',
],
'defines' :[
'LIBYUV_SVE',
]
}],
['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', {
'dependencies': [
':libyuv_sve',
],
'defines' :[
'LIBYUV_SVE',
]
}],
], #conditions
},
'sources': [
'<@(libyuv_sources)',
],
},
{
'target_name': 'libyuv_neon',
'type': 'static_library',
'variables': {
'optimize': 'max', # enable O2 and ltcg.
},
'conditions': [
['target_arch == "arm64" and moz_have_arm_i8mm_and_dot_prod == 1 and build_with_mozilla == 1', {
'cflags_mozilla': [
'-march=armv8.2-a+dotprod+i8mm',
],
}],
['build_neon != 0', {
'cflags_mozilla!': [
'<@(moz_neon_cflags_block_list)',
],
'sources': [
'<@(libyuv_neon_sources)',
],
}],
], #conditions
'include_dirs': [
'include',
'.',
],
'direct_dependent_settings': {
'include_dirs': [
'include',
'.',
], #conditions
},
},
{
'target_name': 'libyuv_sve',
'type': 'static_library',
'variables': {
'optimize': 'max', # enable O2 and ltcg.
},
'conditions': [
['target_arch == "arm64" and moz_have_arm_sve2 == 1 and build_with_mozilla == 1', {
'cflags_mozilla!': [
'<@(moz_neon_cflags_block_list)',
],
'cflags_mozilla': [
'-march=armv9-a+dotprod+sve2+i8mm',
],
'sources': [
'<@(libyuv_sve_sources)',
],
}],
], #conditions
'include_dirs': [
'include',
'.',
],
'direct_dependent_settings': {
'include_dirs': [
'include',
'.',
], #conditions
},
},
], # targets.
}

View File

@ -8,6 +8,29 @@
{
'variables': {
'moz_have_arm_sve2%': '<(moz_have_arm_sve2)',
'moz_have_arm_i8mm_and_dot_prod%': '<(moz_have_arm_i8mm_and_dot_prod)',
'moz_neon_cflags_block_list': [
'-mfpu=vfp',
'-mfpu=vfpv3',
'-mfpu=vfpv3-d16',
],
# Needs to be reflected in upstream gyp file.
'libyuv_sve_sources': [
# sources.
'source/row_sve.cc',
],
'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",
],
'libyuv_sources': [
# includes.
'include/libyuv.h',
@ -40,8 +63,6 @@
'source/compare_common.cc',
'source/compare_gcc.cc',
'source/compare_msa.cc',
'source/compare_neon.cc',
'source/compare_neon64.cc',
'source/compare_win.cc',
'source/convert.cc',
'source/convert_argb.cc',
@ -60,15 +81,11 @@
'source/rotate_common.cc',
'source/rotate_gcc.cc',
'source/rotate_msa.cc',
'source/rotate_neon.cc',
'source/rotate_neon64.cc',
'source/rotate_win.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/row_win.cc',
'source/scale.cc',
'source/scale_any.cc',
@ -76,8 +93,6 @@
'source/scale_common.cc',
'source/scale_gcc.cc',
'source/scale_msa.cc',
'source/scale_neon.cc',
'source/scale_neon64.cc',
'source/scale_rgb.cc',
'source/scale_uv.cc',
'source/scale_win.cc',

View File

@ -78,7 +78,9 @@ MJpegDecoder::MJpegDecoder()
decompress_struct_->err = jpeg_std_error(&error_mgr_->base);
// Override standard exit()-based error handler.
error_mgr_->base.error_exit = &ErrorHandler;
#ifndef DEBUG_MJPEG
error_mgr_->base.output_message = &OutputHandler;
#endif
#endif
decompress_struct_->client_data = NULL;
source_mgr_->init_source = &init_source;
@ -462,11 +464,12 @@ void ErrorHandler(j_common_ptr cinfo) {
longjmp(mgr->setjmp_buffer, 1);
}
#ifndef DEBUG_MJPEG
// Suppress fprintf warnings.
void OutputHandler(j_common_ptr cinfo) {
(void)cinfo;
}
#endif
#endif // HAVE_SETJMP
void MJpegDecoder::AllocOutputBuffers(int num_outbufs) {