Bug 1816576 - Apply mozilla patches for libyuv 2bdc210be9eb11ded16bf3ef1f6cadb0d4dcb0c2 r=ng

Depends on D185940

Differential Revision: https://phabricator.services.mozilla.com/D185941
This commit is contained in:
az 2023-10-11 16:22:33 +00:00
Родитель 436a11e04d
Коммит b030c9ae65
3 изменённых файлов: 28 добавлений и 7 удалений

Просмотреть файл

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

Просмотреть файл

@ -52,7 +52,7 @@
'optimize': 'max', # enable O2 and ltcg. 'optimize': 'max', # enable O2 and ltcg.
}, },
# Allows libyuv.a redistributable library without external dependencies. # Allows libyuv.a redistributable library without external dependencies.
'standalone_static_library': 1, # 'standalone_static_library': 1,
'conditions': [ 'conditions': [
# Disable -Wunused-parameter # Disable -Wunused-parameter
['clang == 1', { ['clang == 1', {
@ -70,6 +70,11 @@
'-mfpu=vfpv3-d16', '-mfpu=vfpv3-d16',
# '-mthumb', # arm32 not thumb # '-mthumb', # arm32 not thumb
], ],
'cflags_mozilla!': [
'-mfpu=vfp',
'-mfpu=vfpv3',
'-mfpu=vfpv3-d16',
],
'conditions': [ 'conditions': [
# Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug. # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug.
['clang == 0 and use_lto == 1', { ['clang == 0 and use_lto == 1', {
@ -84,6 +89,9 @@
'-mfpu=neon', '-mfpu=neon',
# '-marm', # arm32 not thumb # '-marm', # arm32 not thumb
], ],
'cflags_mozilla': [
'-mfpu=neon',
],
}], }],
], ],
}], }],
@ -92,7 +100,15 @@
'LIBYUV_MSA', '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': [ 'defines': [
'HAVE_JPEG' 'HAVE_JPEG'
], ],

Просмотреть файл

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