Skip to content
Snippets Groups Projects
Commit d56952d6 authored by Guillaume Roguez's avatar Guillaume Roguez
Browse files

vp8: fine-tune vpx encoder to support realtime encoding

This patch uses lastest available revision of vpx library
to profit of last bugfixes and performance improvements.

Refs #68788

Change-Id: I71116ea7bab0307d5a797fe224f0059a9dafb52f
parent f84be9e4
Branches
Tags
No related merge requests found
libvpx's configure script hard-codes the SDK location of previous Xcode release in the /Developer folder. However, starting with Xcode 4.3, the SDKs moved to /Applications/Xcode.app/blabla
VLC's contrib system is clever enough to detect this, but libvpx fails miserably. However, they are providing a work-around for iOS and Android, which is expanded by this patch.
diff -ru libvpx/build/make/configure.sh libvpx/build/make/configure.sh
--- libvpx/build/make/configure.sh 2012-06-08 10:26:47.000000000 +0200
+++ libvpx-fixed/build/make/configure.sh 2012-06-08 10:26:07.000000000 +0200
@@ -628,6 +628,11 @@
if [ -d "/Developer/SDKs/MacOSX10.7.sdk" ]; then
osx_sdk_dir="/Developer/SDKs/MacOSX10.7.sdk"
fi
+ if [ -d "${sdk_path}" ]; then
+ case "${sdk_path}" in
+ darwin*) osx_sdk_dir=${sdk_path} ;;
+ esac
+ fi
case ${toolchain} in
*-darwin8-*)
--- libvpx-v1.0.0/build/make/configure.sh.orig 2012-01-29 04:59:36.976441000 -0500
+++ libvpx-v1.0.0/build/make/configure.sh 2012-01-29 04:59:46.684441001 -0500
@@ -680,7 +680,6 @@
case ${tgt_cc} in
gcc)
- CROSS=${CROSS:-arm-none-linux-gnueabi-}
link_with_cc=gcc
setup_gnu_toolchain
arch_int=${tgt_isa##armv}
Our contrib system already passes the correct sysroot to the compiler, so there
is no need to set an alternate libc path. If that path is empty the script will
try to look for it in some fashion, but since the SDKROOT may be in a
non standard location the look up may fail.
This patch avoids that case and relies on the user configuration for the
correct sysroot.
See also https://code.google.com/p/webm/issues/detail?id=809
diff --git a/build/make/configure.sh b/build/make/configure.sh
index d4124c7..c420d25 100755
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -939,8 +939,11 @@ EOF
awk '{ print $1 }' | tail -1`
fi
- add_cflags "--sysroot=${alt_libc}"
- add_ldflags "--sysroot=${alt_libc}"
+ # this may happen if toolchain binaries are outside the ndk dir
+ if [ "${alt_libc}" ]; then
+ add_cflags "--sysroot=${alt_libc}"
+ add_ldflags "--sysroot=${alt_libc}"
+ fi
# linker flag that routes around a CPU bug in some
# Cortex-A8 implementations (NDK Dev Guide)
--
1.8.3.2
# libvpx # libvpx
VPX_VERSION := v1.3.0 VPX_HASH := 4640a0c4804b49f1870d5a2d17df0c7d0a77af2f
VPX_URL := http://webm.googlecode.com/files/libvpx-$(VPX_VERSION).tar.bz2 VPX_URL := http://libvpx.webm.googlecode.com/archive/$(VPX_HASH).tar.gz
#VPX_GITURL := https://code.google.com/p/webm.libvpx
$(TARBALLS)/libvpx-$(VPX_VERSION).tar.bz2: $(TARBALLS)/libvpx-$(VPX_HASH).tar.gz:
$(call download,$(VPX_URL)) $(call download,$(VPX_URL))
.sum-vpx: libvpx-$(VPX_VERSION).tar.bz2 .sum-vpx: libvpx-$(VPX_HASH).tar.gz
$(warning $@ not implemented)
touch $@
libvpx: libvpx-$(VPX_VERSION).tar.bz2 .sum-vpx libvpx: libvpx-$(VPX_HASH).tar.gz .sum-vpx
$(UNPACK) rm -Rf $@-$(VPX_HASH)
$(APPLY) $(SRC)/vpx/libvpx-sysroot.patch mkdir -p $@-$(VPX_HASH)
$(APPLY) $(SRC)/vpx/libvpx-no-cross.patch (cd $@-$(VPX_HASH) && tar xv --strip-components=1 -f ../$<)
$(APPLY) $(SRC)/vpx/libvpx-mac.patch
$(MOVE) $(MOVE)
DEPS_vpx = DEPS_vpx =
...@@ -72,12 +74,15 @@ endif ...@@ -72,12 +74,15 @@ endif
VPX_CONF := \ VPX_CONF := \
--as=yasm \ --as=yasm \
--enable-runtime-cpu-detect \
--disable-docs \ --disable-docs \
--disable-examples \ --disable-examples \
--disable-unit-tests \ --disable-unit-tests \
--disable-install-bins \ --disable-install-bins \
--disable-install-docs --disable-install-docs \
--enable-realtime-only \
--enable-error-concealment \
--disable-runtime-cpu-detect \
--disable-webm-io
ifndef HAVE_WIN32 ifndef HAVE_WIN32
VPX_CONF += --enable-pic VPX_CONF += --enable-pic
......
...@@ -131,7 +131,15 @@ MediaEncoder::openOutput(const char *filename, ...@@ -131,7 +131,15 @@ MediaEncoder::openOutput(const char *filename,
extractProfileLevelID(args.parameters, encoderCtx_); extractProfileLevelID(args.parameters, encoderCtx_);
forcePresetX264(); forcePresetX264();
} else if (args.codec->systemCodecInfo.avcodecId == AV_CODEC_ID_VP8) { } else if (args.codec->systemCodecInfo.avcodecId == AV_CODEC_ID_VP8) {
// Using information given on this page:
// http://www.webmproject.org/docs/encoder-parameters/
av_opt_set(encoderCtx_->priv_data, "quality", "realtime", 0); av_opt_set(encoderCtx_->priv_data, "quality", "realtime", 0);
av_opt_set_int(encoderCtx_->priv_data, "error-resilient", 1, 0);
av_opt_set_int(encoderCtx_->priv_data, "cpu-used", 3, 0);
encoderCtx_->slices = 2; // VP8E_SET_TOKEN_PARTITIONS
encoderCtx_->qmin = 4;
encoderCtx_->qmax = 56;
encoderCtx_->gop_size = 999999;
} }
int ret; int ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment