diff --git a/media/libyuv/libyuv/include/libyuv/row.h b/media/libyuv/libyuv/include/libyuv/row.h --- a/media/libyuv/libyuv/include/libyuv/row.h +++ b/media/libyuv/libyuv/include/libyuv/row.h @@ -175,12 +175,13 @@ #define HAS_ARGBATTENUATEROW_SSSE3 #endif // 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 #define HAS_I444ALPHATOARGBROW_SSSE3 #endif @@ -245,12 +246,13 @@ #define HAS_BLENDPLANEROW_AVX2 #if !defined(LIBYUV_BIT_EXACT) #define HAS_ARGBATTENUATEROW_AVX2 #endif -#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 #define HAS_I444ALPHATOARGBROW_AVX2 #endif diff --git a/media/libyuv/libyuv/libyuv.gyp b/media/libyuv/libyuv/libyuv.gyp --- a/media/libyuv/libyuv/libyuv.gyp +++ b/media/libyuv/libyuv/libyuv.gyp @@ -50,11 +50,11 @@ 'type': 'static_library', 'variables': { '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', { 'cflags': [ '-Wno-unused-parameter', @@ -68,10 +68,15 @@ '-mfpu=vfp', '-mfpu=vfpv3', '-mfpu=vfpv3-d16', # '-mthumb', # arm32 not thumb ], + 'cflags_mozilla!': [ + '-mfpu=vfp', + '-mfpu=vfpv3', + '-mfpu=vfpv3-d16', + ], 'conditions': [ # Disable LTO in libyuv_neon target due to gcc 4.9 compiler bug. ['clang == 0 and use_lto == 1', { 'cflags!': [ '-flto', @@ -82,19 +87,30 @@ ['target_arch != "arm64"', { 'cflags': [ '-mfpu=neon', # '-marm', # arm32 not thumb ], + 'cflags_mozilla': [ + '-mfpu=neon', + ], }], ], }], ['build_msa != 0', { 'defines': [ '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' ], 'conditions': [ # Caveat system jpeg support may not support motion jpeg diff --git a/media/libyuv/libyuv/source/mjpeg_decoder.cc b/media/libyuv/libyuv/source/mjpeg_decoder.cc --- a/media/libyuv/libyuv/source/mjpeg_decoder.cc +++ b/media/libyuv/libyuv/source/mjpeg_decoder.cc @@ -77,12 +77,14 @@ #ifdef HAVE_SETJMP error_mgr_ = new SetJmpErrorMgr; 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; source_mgr_->fill_input_buffer = &fill_input_buffer; source_mgr_->skip_input_data = &skip_input_data; source_mgr_->resync_to_restart = &jpeg_resync_to_restart; @@ -461,15 +463,16 @@ // This rewinds the call stack to the point of the corresponding setjmp() // and causes it to return (for a second time) with value 1. 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) { if (num_outbufs != num_outbufs_) { // We could perhaps optimize this case to resize the output buffers without