From 32c633628f2e84ea138455e865e86408ea7da618 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Thu, 12 Jun 2014 15:46:55 +0200 Subject: [PATCH] Fix VP8 for armv7s --- submodules/build/builders.d/libvpx.mk | 18 +++--- submodules/build/builders.d/libvpx.patch | 76 +++++++++++++++++++----- 2 files changed, 69 insertions(+), 25 deletions(-) diff --git a/submodules/build/builders.d/libvpx.mk b/submodules/build/builders.d/libvpx.mk index d6590d60e..a5cfe8faa 100644 --- a/submodules/build/builders.d/libvpx.mk +++ b/submodules/build/builders.d/libvpx.mk @@ -30,20 +30,20 @@ all_p+=armv7s-darwin-gcc #neon Cortex-A8 ifeq ($(force_non_binary_libvpx),1) take_binary= +libvpx_configure_options+= --extra-cflags="-fno-strict-aliasing" endif -# $(BUILDER_SRC_DIR)/$(libvpx_dir)/patched.stamp: -# cd $(BUILDER_SRC_DIR)/$(libvpx_dir) \ -# && git apply $(BUILDER_SRC_DIR)/build/builders.d/libvpx.patch \ -# && touch $@ +$(BUILDER_SRC_DIR)/$(libvpx_dir)/patched.stamp: + cd $(BUILDER_SRC_DIR)/$(libvpx_dir) \ + && git apply $(BUILDER_SRC_DIR)/build/builders.d/libvpx.patch \ + && touch $@ -#$(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk: $(BUILDER_SRC_DIR)/$(libvpx_dir)/patched.stamp -$(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk: +$(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk: $(BUILDER_SRC_DIR)/$(libvpx_dir)/patched.stamp mkdir -p $(BUILDER_BUILD_DIR)/$(libvpx_dir) cd $(BUILDER_BUILD_DIR)/$(libvpx_dir)/ \ && host_alias=${host} . $(BUILDER_SRC_DIR)/build/$(config_site) \ - && export all_platforms="${all_p}" && $(BUILDER_SRC_DIR)/$(libvpx_dir)/configure --prefix=$(prefix) --sdk-path=$$SDK_BIN_PATH/../../ --libc=$$SYSROOT_PATH $(libvpx_configure_options) --extra-cflags="-fno-strict-aliasing" + && export all_platforms="${all_p}" && $(BUILDER_SRC_DIR)/$(libvpx_dir)/configure --prefix=$(prefix) --sdk-path=$$SDK_BIN_PATH/../../ --libc=$$SYSROOT_PATH $(libvpx_configure_options) build-libvpx: $(BUILDER_BUILD_DIR)/$(libvpx_dir)/config.mk cd $(BUILDER_BUILD_DIR)/$(libvpx_dir) \ @@ -53,7 +53,7 @@ ifeq ($(force_non_binary_libvpx),1) @echo "\033[01;32m DON'T get BINARY version of libvpx for $(take_binary), because 'force_non_binary_libvpx' is 1 \033[0m" endif ifneq (,$(take_binary)) -# we have to take binary version of libvpx for ARM because Clang introduces bugs in optimized assembly +# sometimes when clang gets updated we have to take binary version of libvpx for ARM because the compiler introduces bugs in optimized assembly @echo "\033[01;32m Getting BINARY version of libvpx for $(take_binary) \033[0m" cp $(BUILDER_SRC_DIR)/binaries/libvpx-$(take_binary).a $(prefix)/lib/libvpx.a endif @@ -64,7 +64,7 @@ clean-libvpx: veryclean-libvpx: -cd $(BUILDER_BUILD_DIR)/$(libvpx_dir) && make distclean cd $(BUILDER_SRC_DIR)/$(libvpx_dir) \ - && git clean -f && git reset --hard + && git clean -f && git reset --hard && rm patched.stamp rm -rf $(BUILDER_BUILD_DIR)/$(libvpx_dir) clean-makefile-libvpx: diff --git a/submodules/build/builders.d/libvpx.patch b/submodules/build/builders.d/libvpx.patch index ff22c185b..2835a1d17 100644 --- a/submodules/build/builders.d/libvpx.patch +++ b/submodules/build/builders.d/libvpx.patch @@ -1,17 +1,61 @@ -diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c -index 16da78a..fd9ca61 100644 ---- a/vp8/decoder/decodframe.c -+++ b/vp8/decoder/decodframe.c -@@ -248,7 +248,11 @@ static void decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, +diff --git a/build/make/configure.sh b/build/make/configure.sh +index a65d395..579e0d6 100755 +--- a/build/make/configure.sh ++++ b/build/make/configure.sh +@@ -172,6 +172,7 @@ add_cflags() { - vp8_short_inv_walsh4x4(&b->dqcoeff[0], - xd->qcoeff); -- vpx_memset(b->qcoeff, 0, 16 * sizeof(b->qcoeff[0])); -+ // TODO(johannkoenig): figure out why bzero below -+ // works great on iOS Release but memset or -+ // vpx_memset create terrible corruption on decode -+ // (https://code.google.com/p/webm/issues/detail?id=603). -+ bzero(b->qcoeff, 16 * sizeof(b->qcoeff[0])); - } - else - { + + add_cflags_only() { ++ log_echo "Adding $@ to CFLAGS" + CFLAGS="${CFLAGS} $@" + } + +@@ -792,7 +793,7 @@ process_common_toolchain() { + arm*) + # on arm, isa versions are supersets + case ${tgt_isa} in +- armv7) ++ armv7*) + soft_enable neon + soft_enable media + soft_enable edsp +@@ -820,7 +821,9 @@ process_common_toolchain() { + arch_int=${arch_int%%te} + check_add_asflags --defsym ARCHITECTURE=${arch_int} + tune_cflags="-mtune=" +- if [ ${tgt_isa} = "armv7" ]; then ++ ++ case ${tgt_isa} in ++ armv7*) + if [ -z "${float_abi}" ]; then + check_cpp <