Bug 1151175 - Update libvpx update.py for 1.4.0. r=rillian, a=sledru
authorJan Gerber <j@mailb.org>
Wed, 17 Jun 2015 20:43:46 +0200
changeset 262733 a0ace403b8a916238fcd4ea4262c76c0f1bd19cd
parent 262732 1401e3301b8dc5d1bf1ba72d5bd6dfc7fd38edfd
child 262734 ad7b4c50532ef7e22a1e0e715e2c21959c9a04ea
push id8147
push userryanvm@gmail.com
push dateWed, 24 Jun 2015 20:48:50 +0000
treeherdermozilla-aurora@ad7b4c50532e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian, sledru
bugs1151175
milestone40.0a2
Bug 1151175 - Update libvpx update.py for 1.4.0. r=rillian, a=sledru
media/libvpx/Makefile.in
media/libvpx/apple-clang.patch
media/libvpx/moz.build
media/libvpx/msvc2015.patch
media/libvpx/update.py
--- a/media/libvpx/Makefile.in
+++ b/media/libvpx/Makefile.in
@@ -18,111 +18,30 @@ ifdef VPX_ARM_ASM
 # Building on an ARM platform with a supported assembler, include
 # the optimized assembly in the build.
 
 ifeq ($(OS_TARGET),Android)
 # For cpu-features.h
 LOCAL_INCLUDES += -I$(ANDROID_NDK)/sources/android/cpufeatures
 endif
 
-ASM_OFFSETS = vpx_scale_asm_offsets.asm vp8_asm_enc_offsets.asm
-
-
 ifdef VPX_AS_CONVERSION
 # The ARM asm is written in ARM RVCT syntax, but we actually build it with
 # gas using GNU syntax. Add some rules to perform the conversion.
 
 GENERATED_DIRS += $(dir $(ASFILES))
 
 %.asm.$(ASM_SUFFIX): %.asm $(ASM_OFFSETS)
 	$(VPX_AS_CONVERSION) < $< > $@
 
 endif
 endif
 
-ifdef VPX_NEED_OBJ_INT_EXTRACT
-
-# We don't have a compiler that supports a compatible inline asm syntax, so we
-# have to resort to extracting asm offsets from a compiled object. This only
-# works if we have the appropriate system headers obj_int_extract needs to
-# parse that format, and so only has limited support for cross-compilation.
-
-ifdef VPX_ARM_ASM
-VPX_OIE_FORMAT := rvds
-else
-VPX_OIE_FORMAT := gas
-endif
-
-GARBAGE += vpx_scale_asm_offsets.$(OBJ_SUFFIX) vpx_scale_asm_offsets.asm
-GARBAGE += vp8_asm_enc_offsets.$(OBJ_SUFFIX) vp8_asm_enc_offsets.asm
-
-else
-
-# We can extract the asm offsets directly from generated assembly using inline
-# asm. This is the preferred method. However we need to strip out CFLAGS that
-# cause LTO because then the resulting .S file is useless.
-
-vpx_scale_asm_offsets.s: CFLAGS := -DINLINE_ASM
-
-OFFSET_PATTERN := '^[a-zA-Z0-9_]* EQU'
-
-# This rule, as well as the rule for vp8_asm_enc_offsets.s further below are here
-# because the generic rule in rules.mk was made to not be implicit, and we
-# can't put the C files in CSRCS.
-vpx_scale_asm_offsets.s: $(srcdir)/vpx_scale/vpx_scale_asm_offsets.c
-	$(REPORT_BUILD)
-	$(CC) -S $(COMPILE_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
-
-vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.s
-	grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \
-	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
-
-GARBAGE += vpx_scale_asm_offsets.s vpx_scale_asm_offsets.asm
-
-vp8_asm_enc_offsets.s: CFLAGS := -DINLINE_ASM
-
-vp8_asm_enc_offsets.s: $(srcdir)/vp8/encoder/vp8_asm_enc_offsets.c
-	$(REPORT_BUILD)
-	$(CC) -S $(COMPILE_CFLAGS) $(NO_INTEGRATED_AS_CFLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS)
-
-vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.s
-	grep $(OFFSET_PATTERN) $< | sed -e 's/[$$\#]//g' \
-	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
-
-GARBAGE += vp8_asm_enc_offsets.s vp8_asm_enc_offsets.asm
-
-endif
-
-EXTRA_MDDEPEND_FILES = vp8_asm_enc_offsets.s.pp vp8_asm_enc_offsets.$(OBJ_SUFFIX).pp vpx_scale_asm_offsets.s.pp vpx_scale_asm_offsets.$(OBJ_SUFFIX).pp
-
 include $(topsrcdir)/config/rules.mk
 
-quantize_sse4.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm
-quantize_ssse3.$(OBJ_SUFFIX): vp8_asm_enc_offsets.asm
-
-ifdef VPX_NEED_OBJ_INT_EXTRACT
-
-vpx_scale_asm_offsets.asm: vpx_scale_asm_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
-	./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \
-	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
-
-# Filter out this object, because we don't want to link against it.
-# It was generated solely so it could be parsed by obj_int_extract.
-OBJS := $(filter-out vpx_scale_asm_offsets.$(OBJ_SUFFIX),$(OBJS))
-
-vp8_asm_enc_offsets.asm: vp8_asm_enc_offsets.$(OBJ_SUFFIX) $(HOST_PROGRAM)
-	./$(HOST_PROGRAM) $(VPX_OIE_FORMAT) $< \
-	    $(if $(VPX_AS_CONVERSION),| $(VPX_AS_CONVERSION)) > $@
-
-# Filter out this object, because we don't want to link against it.
-# It was generated solely so it could be parsed by obj_int_extract.
-OBJS := $(filter-out vp8_asm_enc_offsets.$(OBJ_SUFFIX),$(OBJS))
-
-endif
-
 # Workaround a bug of Sun Studio (CR 6963410)
 ifdef SOLARIS_SUNPRO_CC
 ifeq (86,$(findstring 86,$(OS_TEST)))
 filter.o: filter.c Makefile.in
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO_CC)
 	$(CC) -o $@ -c $(patsubst -xO[45],-xO3,$(COMPILE_CFLAGS)) $<
 endif
deleted file mode 100644
--- a/media/libvpx/apple-clang.patch
+++ /dev/null
@@ -1,71 +0,0 @@
-diff --git a/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c b/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
-index 0ffb1bc..733693d 100644
---- a/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
-+++ b/media/libvpx/vp9/common/x86/vp9_subpixel_8t_intrin_avx2.c
-@@ -28,6 +28,26 @@ DECLARE_ALIGNED(32, const unsigned char, filt4_global_avx2[32])= {
-   6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14,
-   6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14};
- 
-+#if defined(__clang__)
-+# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ <= 3) || \
-+     (defined(__APPLE__) && __clang_major__ == 5 && __clang_minor__ == 0)
-+#  define MM256_BROADCASTSI128_SI256(x) \
-+         _mm_broadcastsi128_si256((__m128i const *)&(x))
-+# else  // clang > 3.3, and not 5.0 on macosx.
-+#  define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
-+# endif  // clang <= 3.3
-+#elif defined(__GNUC__)
-+# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 6)
-+#  define MM256_BROADCASTSI128_SI256(x) \
-+         _mm_broadcastsi128_si256((__m128i const *)&(x))
-+# elif __GNUC__ == 4 && __GNUC_MINOR__ == 7
-+#  define MM256_BROADCASTSI128_SI256(x) _mm_broadcastsi128_si256(x)
-+# else  // gcc > 4.7
-+#  define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
-+# endif  // gcc <= 4.6
-+#else  // !(gcc || clang)
-+# define MM256_BROADCASTSI128_SI256(x) _mm256_broadcastsi128_si256(x)
-+#endif  // __clang__
- 
- void vp9_filter_block1d16_h8_avx2(unsigned char *src_ptr,
-                                   unsigned int src_pixels_per_line,
-@@ -50,18 +70,7 @@ void vp9_filter_block1d16_h8_avx2(unsigned char *src_ptr,
-   // in both lanes of 128 bit register.
-   filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-   // have the same data in both lanes of a 256 bit register
--#if defined (__GNUC__)
--#if ( __GNUC__ < 4 || (__GNUC__ == 4 && \
--(__GNUC_MINOR__ < 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0))))
--  filtersReg32 = _mm_broadcastsi128_si256((__m128i const *)&filtersReg);
--#elif(__GNUC__ == 4 && (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ > 0))
--  filtersReg32 = _mm_broadcastsi128_si256(filtersReg);
--#else
--  filtersReg32 = _mm256_broadcastsi128_si256(filtersReg);
--#endif
--#else
--  filtersReg32 = _mm256_broadcastsi128_si256(filtersReg);
--#endif
-+  filtersReg32 = MM256_BROADCASTSI128_SI256(filtersReg);
- 
-   // duplicate only the first 16 bits (first and second byte)
-   // across 256 bit register
-@@ -306,18 +315,7 @@ void vp9_filter_block1d16_v8_avx2(unsigned char *src_ptr,
-   // same data in both lanes of 128 bit register.
-   filtersReg =_mm_packs_epi16(filtersReg, filtersReg);
-   // have the same data in both lanes of a 256 bit register
--#if defined (__GNUC__)
--#if ( __GNUC__ < 4 || (__GNUC__ == 4 && \
--(__GNUC_MINOR__ < 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0))))
--  filtersReg32 = _mm_broadcastsi128_si256((__m128i const *)&filtersReg);
--#elif(__GNUC__ == 4 && (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ > 0))
--  filtersReg32 = _mm_broadcastsi128_si256(filtersReg);
--#else
--  filtersReg32 = _mm256_broadcastsi128_si256(filtersReg);
--#endif
--#else
--  filtersReg32 = _mm256_broadcastsi128_si256(filtersReg);
--#endif
-+  filtersReg32 = MM256_BROADCASTSI128_SI256(filtersReg);
- 
-   // duplicate only the first 16 bits (first and second byte)
-   // across 256 bit register
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -6,39 +6,21 @@
 
 with Files('*'):
     BUG_COMPONENT = ('Core', 'Video/Audio')
 
 include('sources.mozbuild')
 
 EXPORTS.vpx += files['EXPORTS']
 
-if CONFIG['VPX_NEED_OBJ_INT_EXTRACT']:
-    HOST_SOURCES += [
-        'build/make/obj_int_extract.c',
-    ]
-
-    HostProgram('host_obj_int_extract')
-
 SOURCES += files['SOURCES']
 
 if CONFIG['MOZ_VPX_ERROR_CONCEALMENT']:
     SOURCES += files['ERROR_CONCEALMENT']
 
-if CONFIG['VPX_X86_ASM'] and CONFIG['OS_TARGET'] == 'WINNT':
-    offset_sources = [
-        'vp8/encoder/vp8_asm_enc_offsets.c',
-        'vpx_scale/vpx_scale_asm_offsets.c',
-    ]
-    SOURCES += offset_sources
-    # Bug 934984 - MSVC bustage when /GL is specified
-    if CONFIG['_MSC_VER']:
-        for s in offset_sources:
-            SOURCES[s].flags += ['-GL-']
-
 if CONFIG['VPX_X86_ASM']:
     SOURCES += files['X86_ASM']
 
     if '64' in CONFIG['OS_TEST']:
         SOURCES += files['X86-64_ASM']
 
     # AVX2 only supported on
     # Darwin and Windows toolchains right now
--- a/media/libvpx/msvc2015.patch
+++ b/media/libvpx/msvc2015.patch
@@ -1,24 +1,15 @@
-diff --git a/media/libvpx/vp9/common/vp9_systemdependent.h b/media/libvpx/vp9/common/vp9_systemdependent.h
---- a/media/libvpx/vp9/common/vp9_systemdependent.h
-+++ b/media/libvpx/vp9/common/vp9_systemdependent.h
-@@ -12,17 +12,19 @@
- #define VP9_COMMON_VP9_SYSTEMDEPENDENT_H_
- 
- #ifdef _MSC_VER
- # if _MSC_VER > 1310 && (defined(_M_X64) || defined(_M_IX86))
+diff --git a/vp9/common/vp9_systemdependent.h b/vp9/common/vp9_systemdependent.h
+index e971158..19d445d 100644
+--- a/vp9/common/vp9_systemdependent.h
++++ b/vp9/common/vp9_systemdependent.h
+@@ -17,7 +17,9 @@
  #  include <intrin.h>
  #  define USE_MSC_INTRIN
  # endif
- # include <math.h>
 -# define snprintf _snprintf
 +# if _MSC_VER < 1900
 +#  define snprintf _snprintf
 +# endif
  #endif
  
  #ifdef __cplusplus
- extern "C" {
- #endif
- 
- #include "./vpx_config.h"
- #if ARCH_X86 || ARCH_X86_64
--- a/media/libvpx/update.py
+++ b/media/libvpx/update.py
@@ -72,60 +72,74 @@ MODULES = {
         'API_SRCS-$(CONFIG_VP9_ENCODER)',
         'VP8_CX_EXPORTS',
         'VP8_CX_SRCS-$(CONFIG_MULTI_RES_ENCODING)',
         'VP8_CX_SRCS-$(CONFIG_MULTITHREAD)',
         'VP8_CX_SRCS-$(CONFIG_TEMPORAL_DENOISING)',
         'VP8_CX_SRCS-no',
         'VP8_CX_SRCS_REMOVE-no',
         'VP8_CX_SRCS_REMOVE-yes',
+        'VP8_CX_SRCS_REMOVE-yes+$(CONFIG_REALTIME_ONLY)',
         'VP8_CX_SRCS-yes',
         'VP9_CX_EXPORTS',
         'VP9_CX_SRCS-no',
         'VP9_CX_SRCS_REMOVE-no',
         'VP9_CX_SRCS_REMOVE-yes',
         'VP9_CX_SRCS-yes',
     ],
     'X86_ASM': [
         'PORTS_SRCS-$(BUILD_LIBVPX)',
+        'PORTS_SRCS-$(BUILD_LIBVPX)+$(ARCH_X86)$(ARCH_X86_64)',
         'VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
         'VP8_COMMON_SRCS-$(HAVE_MMX)',
+        'VP8_COMMON_SRCS-$(HAVE_MMX)+$(CONFIG_POSTPROC)',
         'VP8_COMMON_SRCS-$(HAVE_SSE2)',
+        'VP8_COMMON_SRCS-$(HAVE_SSE2)+$(CONFIG_POSTPROC)',
         'VP8_COMMON_SRCS-$(HAVE_SSE3)',
         'VP8_COMMON_SRCS-$(HAVE_SSE4_1)',
         'VP8_COMMON_SRCS-$(HAVE_SSSE3)',
+        'VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
+        'VP8_CX_SRCS-$(HAVE_MMX)',
+        'VP8_CX_SRCS-$(HAVE_SSE2)',
+        'VP8_CX_SRCS-$(HAVE_SSE2)+$(CONFIG_TEMPORAL_DENOISING)',
+        'VP8_CX_SRCS-$(HAVE_SSE4_1)',
+        'VP8_CX_SRCS-$(HAVE_SSSE3)',
+        'VP8_CX_SRCS_REMOVE-$(HAVE_SSE2)',
+        'VP8_CX_SRCS_REMOVE-$(HAVE_SSE2)+$(CONFIG_REALTIME_ONLY)',
         'VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
         'VP9_COMMON_SRCS-$(HAVE_MMX)',
         'VP9_COMMON_SRCS-$(HAVE_SSE2)',
+        'VP9_COMMON_SRCS-$(HAVE_SSE2)+$(CONFIG_USE_X86INC)',
         'VP9_COMMON_SRCS-$(HAVE_SSSE3)',
-        'VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
-        'VP8_CX_SRCS-$(HAVE_MMX)',
-        'VP8_CX_SRCS-$(HAVE_SSE2)',
-        'VP8_CX_SRCS-$(HAVE_SSE4_1)',
-        'VP8_CX_SRCS-$(HAVE_SSSE3)',
-        'VP8_CX_SRCS_REMOVE-$(HAVE_SSE2)',
+        'VP9_COMMON_SRCS-$(HAVE_SSSE3)+$(CONFIG_USE_X86INC)',
         'VP9_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
         'VP9_CX_SRCS-$(HAVE_MMX)',
+        'VP9_CX_SRCS-$(HAVE_MMX)+$(CONFIG_USE_X86INC)',
         'VP9_CX_SRCS-$(HAVE_SSE2)',
+        'VP9_CX_SRCS-$(HAVE_SSE2)+$(CONFIG_USE_X86INC)',
         'VP9_CX_SRCS-$(HAVE_SSE3)',
         'VP9_CX_SRCS-$(HAVE_SSE4_1)',
         'VP9_CX_SRCS-$(HAVE_SSSE3)',
     ],
     'X86-64_ASM': [
+        'VP8_COMMON_SRCS-$(HAVE_SSE2)+$(ARCH_X86_64)',
         'VP8_CX_SRCS-$(ARCH_X86_64)',
+        'VP9_COMMON_SRCS-$(HAVE_SSSE3)+$(ARCH_X86_64)',
         'VP9_CX_SRCS-$(ARCH_X86_64)',
+        'VP9_CX_SRCS-$(HAVE_SSSE3)+$(ARCH_X86_64)',
     ],
     'ARM_ASM': [
         'PORTS_SRCS-$(ARCH_ARM)',
         'SCALE_SRCS-$(HAVE_NEON)',
         'VP8_COMMON_SRCS-$(ARCH_ARM)',
         'VP8_COMMON_SRCS-$(HAVE_MEDIA)',
         'VP8_COMMON_SRCS-$(HAVE_NEON)',
         'VP9_COMMON_SRCS-$(HAVE_NEON)',
         'VP9_COMMON_SRCS-$(HAVE_NEON_ASM)',
+        'VP9_COMMON_SRCS-yes+$(HAVE_NEON_ASM)',
         'VP8_CX_SRCS-$(ARCH_ARM)',
         'VP8_CX_SRCS-$(HAVE_EDSP)',
         'VP8_CX_SRCS-$(HAVE_MEDIA)',
         'VP8_CX_SRCS-$(HAVE_NEON)',
         'VP8_CX_SRCS-$(HAVE_NEON_ASM)',
         'VP9_CX_SRCS-$(HAVE_NEON)',
     ],
     'ERROR_CONCEALMENT': [
@@ -135,38 +149,48 @@ MODULES = {
         'VP9_COMMON_SRCS-$(HAVE_AVX2)',
         'VP9_CX_SRCS-$(HAVE_AVX2)',
     ],
     'VP8_POSTPROC': [
         'VP8_COMMON_SRCS-$(CONFIG_POSTPROC)',
     ],
     'VP9_POSTPROC': [
         'VP9_COMMON_SRCS-$(CONFIG_VP9_POSTPROC)',
+        'VP9_COMMON_SRCS-$(HAVE_SSE2)+$(CONFIG_VP9_POSTPROC)',
     ]
 }
 
 DISABLED_MODULES = [
     'API_SRCS-$(CONFIG_SPATIAL_SVC)',
+    'API_SRCS-$(CONFIG_SPATIAL_SVC)+$(CONFIG_VP9_ENCODER)',
     'MEM_SRCS-$(CONFIG_MEM_MANAGER)',
     'MEM_SRCS-$(CONFIG_MEM_TRACKER)',
     'VP8_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER)',
     'VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER)',
     'VP8_CX_SRCS-$(CONFIG_INTERNAL_STATS)',
     'VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS)',
+    'VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS)+$(CONFIG_VP9_POSTPROC)',
     'VP9_CX_SRCS-$(CONFIG_VP9_TEMPORAL_DENOISING)',
+    'VP9_CX_SRCS-$(HAVE_SSE2)+$(CONFIG_VP9_TEMPORAL_DENOISING)',
+    'VP9_COMMON_SRCS-$(HAVE_SSE2)+$(CONFIG_VP9_HIGHBITDEPTH)',
+    'VP9_CX_SRCS-$(HAVE_SSE2)+$(CONFIG_VP9_HIGHBITDEPTH)',
+
+    # use asm implementations instead of intrinsics
+    # neon exists as assembly and intrinsics implementations.
+    # If both are available prefer assembly (HAVE_NEON_ASM)
+    'VP9_COMMON_SRCS-yes+$(HAVE_NEON)',
 
     # mips files are also ignored via ignored_folders
     'SCALE_SRCS-$(HAVE_DSPR2)',
     'VP8_COMMON_SRCS-$(HAVE_DSPR2)',
     'VP9_COMMON_SRCS-$(HAVE_DSPR2)',
     'VP8_CX_SRCS_REMOVE-$(HAVE_EDSP)',
 ]
 
 libvpx_files = [
-    'build/make/obj_int_extract.c',
     'build/make/ads2gas.pl',
     'build/make/thumb.pm',
     'LICENSE',
     'PATENTS',
 ]
 
 ignore_files = [
     'vp8/common/context.c',
@@ -190,16 +214,22 @@ ignore_folders = [
     'libyuv/',
     'mips/',
     'nestegg/',
     'objdir/',
     'ppc/',
     'test/',
     'vpx_mem/memory_manager/',
 ]
+
+rename_files = {
+    #avoid clash with common/arm/neon/vp9_avg_neon.c
+    'vp9/encoder/arm/neon/vp9_avg_neon.c': 'vp9/encoder/arm/neon/vp9enc_avg_neon.c'
+}
+
 files = {
     'EXPORTS': [
         'vpx_mem/include/vpx_mem_intrnl.h',
         'vpx_mem/vpx_mem.h',
         'vpx_ports/arm.h',
         'vpx_ports/mem.h',
         'vpx_ports/vpx_timer.h',
         'vpx_ports/x86.h',
@@ -212,26 +242,23 @@ files = {
         'vpx/vpx_decoder.h',
         'vpx/vpx_encoder.h',
         'vpx/vpx_frame_buffer.h',
         'vpx/vpx_image.h',
         'vpx/vpx_integer.h',
     ],
     'X86-64_ASM': [
         'third_party/x86inc/x86inc.asm',
-        'vp8/common/x86/loopfilter_block_sse2.asm',
-        'vp9/encoder/x86/vp9_quantize_ssse3.asm',
     ],
     'SOURCES': [
         'vp8/common/rtcd.c',
         'vp8/common/sad_c.c',
         'vp8/encoder/bitstream.c',
         'vp8/encoder/onyx_if.c',
         'vp8/vp8_dx_iface.c',
-        'vp9/common/generic/vp9_systemdependent.c',
         'vp9/common/vp9_alloccommon.c',
         'vp9/common/vp9_blockd.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',
@@ -251,47 +278,43 @@ files = {
         'vp9/common/vp9_scan.c',
         'vp9/common/vp9_seg_common.c',
         'vp9/common/vp9_tile_common.c',
         'vp9/decoder/vp9_decodeframe.c',
         'vp9/decoder/vp9_decodemv.c',
         'vp9/decoder/vp9_detokenize.c',
         'vp9/decoder/vp9_dsubexp.c',
         'vp9/decoder/vp9_dthread.c',
-        'vp9/decoder/vp9_onyxd_if.c',
         'vp9/decoder/vp9_reader.c',
         'vp9/encoder/vp9_bitstream.c',
         'vp9/encoder/vp9_dct.c',
         'vp9/encoder/vp9_encodeframe.c',
         'vp9/encoder/vp9_encodemb.c',
         'vp9/encoder/vp9_encodemv.c',
         'vp9/encoder/vp9_extend.c',
         'vp9/encoder/vp9_firstpass.c',
         'vp9/encoder/vp9_lookahead.c',
         'vp9/encoder/vp9_mbgraph.c',
         'vp9/encoder/vp9_mcomp.c',
-        'vp9/encoder/vp9_onyx_if.c',
         'vp9/encoder/vp9_picklpf.c',
         'vp9/encoder/vp9_pickmode.c',
         'vp9/encoder/vp9_quantize.c',
         'vp9/encoder/vp9_ratectrl.c',
         'vp9/encoder/vp9_rdopt.c',
         'vp9/encoder/vp9_resize.c',
         'vp9/encoder/vp9_sad.c',
         'vp9/encoder/vp9_segmentation.c',
         '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',
         'vp9/encoder/vp9_writer.c',
         'vp9/vp9_cx_iface.c',
         'vp9/vp9_dx_iface.c',
-        'vpx/src/svc_encodeframe.c',
         'vpx/src/vpx_encoder.c',
         'vpx_mem/vpx_mem.c',
         'vpx_scale/vpx_scale_rtcd.c',
         'vpx_scale/generic/yv12config.c',
         'vpx_scale/generic/yv12extend.c',
     ]
 }
 
@@ -398,29 +421,37 @@ def get_libvpx_files(prefix):
 def get_sources(prefix):
     source = {}
     unknown = {}
     disabled = {}
 
     for mk in mk_files:
         with open(os.path.join(prefix, mk)) as f:
             base = os.path.dirname(mk)
+            extra = ''
             for l in f:
+                m = re.compile('ifeq +\((.*?\)), *yes\)').findall(l)
+                if m:
+                    extra = '+' + m[0]
+                if extra and l.startswith('else') or l.startswith('endif'):
+                    extra = ''
                 if '+=' in l:
                     l = l.split('+=')
                     key = l[0].strip()
+                    key += extra
                     value = l[1].strip().replace('$(ASM)', '.asm')
                     value = os.path.join(base, value)
                     if not key.startswith('#') and os.path.splitext(value)[-1] in extensions:
                         if key not in source:
                             source[key] = []
                         source[key].append(value)
 
     for key in source:
         for f in source[key]:
+            f = rename_files.get(f, f)
             if key.endswith('EXPORTS') and f.endswith('.h'):
                 files['EXPORTS'].append(f)
             if os.path.splitext(f)[-1] in ('.c', '.asm') and not f in manual:
                 module = get_module(key)
                 if module:
                     if not module in files:
                         files[module] = []
                     t = files[module]
@@ -479,16 +510,17 @@ def update_and_remove_files(prefix, libv
 
     # Update files
     first = True
     for f in libvpx_files:
         fdir = os.path.dirname(f)
         if fdir and not os.path.exists(fdir):
             os.makedirs(fdir)
         s = os.path.join(prefix, f)
+        f = rename_files.get(f, f)
         if is_new(f, s):
             if first:
                 print "Copy files:"
                 first = False
             copy(s, f)
 
     # Copy configuration files for each platform
     for target in PLATFORMS:
@@ -505,30 +537,28 @@ def update_and_remove_files(prefix, libv
 
     # Copy vpx_version.h from one of the build targets
     s = os.path.join(prefix, 'objdir/x86-linux-gcc/vpx_version.h')
     f = 'vpx_version.h'
     if is_new(s, f):
         copy(s, f)
 
     # Remove unknown files from tree
-    removed_files = [f for f in current_files if f not in libvpx_files]
+    removed_files = [f for f in current_files if f not in libvpx_files and f not in rename_files.values()]
     if removed_files:
         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 -p0 < stdint.patch")
-    # Patch for AVX intrinsic support with Apple's clang.
-    os.system("patch -p3 < apple-clang.patch")
     # Patch to allow MSVC 2015 to compile libvpx
-    os.system("patch -p3 < msvc2015.patch")
+    os.system("patch -p1 < msvc2015.patch")
     # Patch to fix a crash caused by MSVC 2013
     os.system("patch -p3 < bug1137614.patch")
 
 def update_readme(commit):
     with open('README_MOZILLA') as f:
         readme = f.read()
 
     if 'The git commit ID used was' in readme: