Bug 1151175 - Update libvpx update.py for 1.4.0. r=rillian

This commit is contained in:
Jan Gerber 2015-06-17 20:43:46 +02:00
parent 9e687fd8d0
commit b8b9ea477d
5 changed files with 51 additions and 200 deletions

View File

@ -16,9 +16,6 @@ ifeq ($(OS_TARGET),Android)
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.
@ -31,86 +28,8 @@ GENERATED_DIRS += $(dir $(ASFILES))
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)))

View File

@ -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

View File

@ -11,29 +11,11 @@ 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']

View File

@ -1,15 +1,11 @@
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
@ -17,8 +13,3 @@ diff --git a/media/libvpx/vp9/common/vp9_systemdependent.h b/media/libvpx/vp9/co
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include "./vpx_config.h"
#if ARCH_X86 || ARCH_X86_64

View File

@ -77,6 +77,7 @@ MODULES = {
'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',
@ -86,32 +87,44 @@ MODULES = {
],
'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)',
'VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
'VP9_COMMON_SRCS-$(HAVE_MMX)',
'VP9_COMMON_SRCS-$(HAVE_SSE2)',
'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_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)',
'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)',
@ -121,6 +134,7 @@ MODULES = {
'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)',
@ -140,18 +154,29 @@ MODULES = {
],
'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)',
@ -161,7 +186,6 @@ DISABLED_MODULES = [
]
libvpx_files = [
'build/make/obj_int_extract.c',
'build/make/ads2gas.pl',
'build/make/thumb.pm',
'LICENSE',
@ -195,6 +219,12 @@ ignore_folders = [
'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',
@ -217,8 +247,6 @@ files = {
],
'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',
@ -226,7 +254,6 @@ files = {
'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',
@ -256,7 +283,6 @@ files = {
'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',
@ -268,7 +294,6 @@ files = {
'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',
@ -281,12 +306,10 @@ files = {
'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',
@ -403,10 +426,17 @@ def get_sources(prefix):
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:
@ -416,6 +446,7 @@ def get_sources(prefix):
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:
@ -484,6 +515,7 @@ def update_and_remove_files(prefix, libvpx_files, files):
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:"
@ -510,7 +542,7 @@ def update_and_remove_files(prefix, libvpx_files, files):
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:
@ -520,10 +552,8 @@ def update_and_remove_files(prefix, libvpx_files, files):
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")