From 36f94a0cf01070dcb27162db0a3c8178f6c95bf7 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 11 Dec 2013 09:40:07 -0500 Subject: [PATCH] Bug 947979 - Build parts of media/libvpx in unified mode; r=rillian --- media/libvpx/moz.build | 4 ++ media/libvpx/sources.mozbuild | 20 ++++--- media/libvpx/unified.patch | 69 +++++++++++++++++++++++ media/libvpx/update.py | 1 + media/libvpx/vp8/common/setupintrarecon.h | 4 ++ media/libvpx/vpx_ports/vpx_once.h | 5 ++ 6 files changed, 94 insertions(+), 9 deletions(-) create mode 100644 media/libvpx/unified.patch diff --git a/media/libvpx/moz.build b/media/libvpx/moz.build index ee96971d343..944007d4650 100644 --- a/media/libvpx/moz.build +++ b/media/libvpx/moz.build @@ -15,7 +15,11 @@ if CONFIG['VPX_NEED_OBJ_INT_EXTRACT']: HOST_PROGRAM = 'host_obj_int_extract' +# Unify fewer files together to reduce the chance of name collision +FILES_PER_UNIFIED_FILE = 8 + SOURCES += files['SOURCES'] +UNIFIED_SOURCES += files['UNIFIED_SOURCES'] if CONFIG['MOZ_VPX_ERROR_CONCEALMENT']: SOURCES += files['ERROR_CONCEALMENT'] diff --git a/media/libvpx/sources.mozbuild b/media/libvpx/sources.mozbuild index 97db8398334..8ef7c8ca703 100644 --- a/media/libvpx/sources.mozbuild +++ b/media/libvpx/sources.mozbuild @@ -105,7 +105,7 @@ files = { 'vpx_scale/arm/neon/yv12extend_arm.c' ], 'AVX2': ['vp9/common/x86/vp9_loopfilter_intrin_avx2.c'], - 'SOURCES': [ + 'UNIFIED_SOURCES': [ 'vp8/common/alloccommon.c', 'vp8/common/blockd.c', 'vp8/common/debugmodes.c', @@ -127,8 +127,6 @@ files = { 'vp8/common/reconinter.c', 'vp8/common/reconintra.c', 'vp8/common/reconintra4x4.c', - 'vp8/common/rtcd.c', - 'vp8/common/sad_c.c', 'vp8/common/setupintrarecon.c', 'vp8/common/swapyv12buffer.c', 'vp8/common/treecoder.c', @@ -164,7 +162,6 @@ files = { 'vp8/encoder/tokenize.c', 'vp8/encoder/treewriter.c', 'vp8/vp8_cx_iface.c', - 'vp8/vp8_dx_iface.c', 'vp9/common/generic/vp9_systemdependent.c', 'vp9/common/vp9_alloccommon.c', 'vp9/common/vp9_common_data.c', @@ -172,7 +169,6 @@ files = { 'vp9/common/vp9_debugmodes.c', 'vp9/common/vp9_entropy.c', 'vp9/common/vp9_entropymode.c', - 'vp9/common/vp9_entropymv.c', 'vp9/common/vp9_extend.c', 'vp9/common/vp9_filter.c', 'vp9/common/vp9_findnearmv.c', @@ -184,7 +180,6 @@ files = { 'vp9/common/vp9_quant_common.c', 'vp9/common/vp9_reconinter.c', 'vp9/common/vp9_reconintra.c', - 'vp9/common/vp9_rtcd.c', 'vp9/common/vp9_scale.c', 'vp9/common/vp9_scan.c', 'vp9/common/vp9_seg_common.c', @@ -197,7 +192,6 @@ files = { 'vp9/decoder/vp9_dsubexp.c', 'vp9/decoder/vp9_onyxd_if.c', 'vp9/decoder/vp9_thread.c', - 'vp9/encoder/vp9_bitstream.c', 'vp9/encoder/vp9_boolhuff.c', 'vp9/encoder/vp9_dct.c', 'vp9/encoder/vp9_encodeframe.c', @@ -225,18 +219,26 @@ files = { 'vp9/encoder/vp9_variance_c.c', 'vp9/vp9_cx_iface.c', 'vp9/vp9_dx_iface.c', - 'vpx/src/svc_encodeframe.c', 'vpx/src/vpx_codec.c', 'vpx/src/vpx_decoder.c', 'vpx/src/vpx_encoder.c', 'vpx/src/vpx_image.c', - 'vpx_mem/vpx_mem.c', 'vpx_scale/generic/gen_scalers.c', 'vpx_scale/generic/vpx_scale.c', 'vpx_scale/generic/yv12config.c', 'vpx_scale/generic/yv12extend.c', 'vpx_scale/vpx_scale_rtcd.c' ], + 'SOURCES': [ + 'vp8/common/rtcd.c', + 'vp8/common/sad_c.c', + 'vp8/vp8_dx_iface.c', + 'vp9/common/vp9_entropymv.c', + 'vp9/common/vp9_rtcd.c', + 'vp9/encoder/vp9_bitstream.c', + 'vpx/src/svc_encodeframe.c', + 'vpx_mem/vpx_mem.c', + ], 'ERROR_CONCEALMENT': ['vp8/decoder/error_concealment.c'], 'EXPORTS': ['vpx/vp8.h', 'vpx/vp8cx.h', diff --git a/media/libvpx/unified.patch b/media/libvpx/unified.patch new file mode 100644 index 00000000000..13501ae2dee --- /dev/null +++ b/media/libvpx/unified.patch @@ -0,0 +1,69 @@ +diff --git a/media/libvpx/vp8/common/setupintrarecon.h b/media/libvpx/vp8/common/setupintrarecon.h +index e515c3a..9317a6d 100644 +--- a/media/libvpx/vp8/common/setupintrarecon.h ++++ b/media/libvpx/vp8/common/setupintrarecon.h +@@ -3,16 +3,18 @@ + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + ++#ifndef SETUPINTRARECON_H ++#define SETUPINTRARECON_H + + #include "vpx_scale/yv12config.h" + extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); + extern void vp8_setup_intra_recon_top_line(YV12_BUFFER_CONFIG *ybf); + + static + void setup_intra_recon_left(unsigned char *y_buffer, + unsigned char *u_buffer, +@@ -26,8 +28,10 @@ void setup_intra_recon_left(unsigned char *y_buffer, + y_buffer[y_stride *i] = (unsigned char) 129; + + for (i = 0; i < 8; i++) + u_buffer[uv_stride *i] = (unsigned char) 129; + + for (i = 0; i < 8; i++) + v_buffer[uv_stride *i] = (unsigned char) 129; + } ++ ++#endif +diff --git a/media/libvpx/vpx_ports/vpx_once.h b/media/libvpx/vpx_ports/vpx_once.h +index 16a735c..0387a71 100644 +--- a/media/libvpx/vpx_ports/vpx_once.h ++++ b/media/libvpx/vpx_ports/vpx_once.h +@@ -2,16 +2,19 @@ + * Copyright (c) 2011 The WebM project authors. All Rights Reserved. + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ ++#ifndef VPX_ONCE_H ++#define VPX_ONCE_H ++ + #include "vpx_config.h" + + #if CONFIG_MULTITHREAD && defined(_WIN32) + #include + #include + static void once(void (*func)(void)) + { + static CRITICAL_SECTION *lock; +@@ -90,8 +93,10 @@ static void once(void (*func)(void)) + + if(!done) + { + func(); + done = 1; + } + } + #endif ++ ++#endif diff --git a/media/libvpx/update.py b/media/libvpx/update.py index a1d7b392188..32f82bc730a 100755 --- a/media/libvpx/update.py +++ b/media/libvpx/update.py @@ -444,6 +444,7 @@ def update_and_remove_files(prefix, libvpx_files, files): def apply_patches(): # Patch to permit vpx users to specify their own types. os.system("patch -p3 < stdint.patch") + os.system("patch -p3 < unified.patch") def update_readme(commit): with open('README_MOZILLA') as f: diff --git a/media/libvpx/vp8/common/setupintrarecon.h b/media/libvpx/vp8/common/setupintrarecon.h index e515c3a005b..8b6c50bd3c7 100644 --- a/media/libvpx/vp8/common/setupintrarecon.h +++ b/media/libvpx/vp8/common/setupintrarecon.h @@ -8,6 +8,8 @@ * be found in the AUTHORS file in the root of the source tree. */ +#ifndef SETUPINTRARECON_H +#define SETUPINTRARECON_H #include "vpx_scale/yv12config.h" extern void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf); @@ -31,3 +33,5 @@ void setup_intra_recon_left(unsigned char *y_buffer, for (i = 0; i < 8; i++) v_buffer[uv_stride *i] = (unsigned char) 129; } + +#endif diff --git a/media/libvpx/vpx_ports/vpx_once.h b/media/libvpx/vpx_ports/vpx_once.h index 16a735ccdbe..2687d63939d 100644 --- a/media/libvpx/vpx_ports/vpx_once.h +++ b/media/libvpx/vpx_ports/vpx_once.h @@ -7,6 +7,9 @@ * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ +#ifndef VPX_ONCE_H +#define VPX_ONCE_H + #include "vpx_config.h" #if CONFIG_MULTITHREAD && defined(_WIN32) @@ -95,3 +98,5 @@ static void once(void (*func)(void)) } } #endif + +#endif