Bug 947979 - Build parts of media/libvpx in unified mode; r=rillian
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 11 Dec 2013 09:40:07 -0500
changeset 175959 fc689fd8899e706a2a8d44d7e9ed6dac75be32e0
parent 175958 012b1baf2b19c37d45d83fe36c94f13c0580f0e9
child 175960 14567e58c1ea6d1c2e3b1a59af45eb4f744930eb
push idunknown
push userunknown
push dateunknown
reviewersrillian
bugs947979
milestone29.0a1
Bug 947979 - Build parts of media/libvpx in unified mode; r=rillian
media/libvpx/moz.build
media/libvpx/sources.mozbuild
media/libvpx/unified.patch
media/libvpx/update.py
media/libvpx/vp8/common/setupintrarecon.h
media/libvpx/vpx_ports/vpx_once.h
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -10,17 +10,21 @@ EXPORTS.vpx += files['EXPORTS']
 
 if CONFIG['VPX_NEED_OBJ_INT_EXTRACT']:
     HOST_SOURCES += [
         'build/make/obj_int_extract.c',
     ]
 
     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']
 
 if CONFIG['VPX_X86_ASM'] and CONFIG['OS_TARGET'] == 'WINNT':
     SOURCES += [
         'vp8/encoder/vp8_asm_enc_offsets.c',
         'vpx_scale/vpx_scale_asm_offsets.c',
--- a/media/libvpx/sources.mozbuild
+++ b/media/libvpx/sources.mozbuild
@@ -100,17 +100,17 @@ files = {
     'vpx_ports/arm_cpudetect.c',
     'vpx_scale/arm/neon/vp8_vpxyv12_copy_y_neon.asm',
     'vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm',
     'vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm',
     'vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm',
     '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',
     'vp8/common/dequantize.c',
     'vp8/common/entropy.c',
     'vp8/common/entropymode.c',
     'vp8/common/entropymv.c',
     'vp8/common/extend.c',
@@ -122,18 +122,16 @@ files = {
     'vp8/common/loopfilter.c',
     'vp8/common/loopfilter_filters.c',
     'vp8/common/mbpitch.c',
     'vp8/common/modecont.c',
     'vp8/common/quant_common.c',
     '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',
     'vp8/common/variance_c.c',
     'vp8/decoder/dboolhuff.c',
     'vp8/decoder/decodemv.c',
     'vp8/decoder/decodframe.c',
     'vp8/decoder/detokenize.c',
@@ -159,50 +157,46 @@ files = {
     'vp8/encoder/quantize.c',
     'vp8/encoder/ratectrl.c',
     'vp8/encoder/rdopt.c',
     'vp8/encoder/segmentation.c',
     'vp8/encoder/temporal_filter.c',
     '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',
     'vp9/common/vp9_convolve.c',
     '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',
     'vp9/common/vp9_idct.c',
     'vp9/common/vp9_loopfilter.c',
     'vp9/common/vp9_loopfilter_filters.c',
     'vp9/common/vp9_mvref_common.c',
     'vp9/common/vp9_pred_common.c',
     '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',
     'vp9/common/vp9_tile_common.c',
     'vp9/common/vp9_treecoder.c',
     'vp9/decoder/vp9_dboolhuff.c',
     'vp9/decoder/vp9_decodemv.c',
     'vp9/decoder/vp9_decodframe.c',
     'vp9/decoder/vp9_detokenize.c',
     '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',
     'vp9/encoder/vp9_encodeintra.c',
     'vp9/encoder/vp9_encodemb.c',
     'vp9/encoder/vp9_encodemv.c',
     'vp9/encoder/vp9_firstpass.c',
     'vp9/encoder/vp9_lookahead.c',
@@ -220,28 +214,36 @@ files = {
     'vp9/encoder/vp9_subexp.c',
     'vp9/encoder/vp9_temporal_filter.c',
     'vp9/encoder/vp9_tokenize.c',
     'vp9/encoder/vp9_treewriter.c',
     'vp9/encoder/vp9_vaq.c',
     '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',
              'vpx/vp8dx.h',
              'vpx/vpx_codec.h',
              'vpx/vpx_decoder.h',
              'vpx/vpx_encoder.h',
              'vpx/vpx_image.h',
new file mode 100644
--- /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 <windows.h>
+ #include <stdlib.h>
+ 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
--- a/media/libvpx/update.py
+++ b/media/libvpx/update.py
@@ -439,16 +439,17 @@ def update_and_remove_files(prefix, libv
         print "Remove files:"
         for f in removed_files:
             os.unlink(f)
             print '    ', f
 
 def apply_patches():
     # Patch to permit vpx users to specify their own <stdint.h> types.
     os.system("patch -p3 < stdint.patch")
+    os.system("patch -p3 < unified.patch")
 
 def update_readme(commit):
     with open('README_MOZILLA') as f:
         readme = f.read()
 
     if 'The git commit ID used was' in readme:
         new_readme = re.sub('The git commit ID used was [a-f0-9]+',
             'The git commit ID used was %s' % commit, readme)
--- 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 cha
         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
--- 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 <windows.h>
 #include <stdlib.h>
 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