aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Manison <amanison@anselsystems.com>2010-06-19 09:05:29 +0000
committerAndrew Manison <amanison@anselsystems.com>2010-06-19 09:05:29 +0000
commitcd39cdcaac4bb080e939cd79288a3fa626528f7f (patch)
tree9ff9f55a84f988b8095d02240e74ae91eddd3e24
parent85fd77589be2f6c970ca6895afa1520e0a2fda04 (diff)
parentbf31029cd1255d11b787a857a103139ddbe2b29d (diff)
downloadalpine_aports-cd39cdcaac4bb080e939cd79288a3fa626528f7f.tar.bz2
alpine_aports-cd39cdcaac4bb080e939cd79288a3fa626528f7f.tar.xz
alpine_aports-cd39cdcaac4bb080e939cd79288a3fa626528f7f.zip
Merge remote branch 'alpine/master'
-rw-r--r--main/abiword/APKBUILD6
-rw-r--r--main/apk-tools/0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch42
-rw-r--r--main/apk-tools/APKBUILD28
-rw-r--r--main/apk-tools/triggers.patch42
-rw-r--r--main/bacula/bacula.post-install1
-rw-r--r--main/cups/APKBUILD6
-rw-r--r--main/curl/APKBUILD6
-rw-r--r--main/dahdi-linux-grsec/APKBUILD4
-rw-r--r--main/dhcpcd/APKBUILD6
-rw-r--r--main/expat/APKBUILD2
-rw-r--r--main/fakeroot/APKBUILD9
-rw-r--r--main/ffmpeg/APKBUILD26
-rw-r--r--main/ffmpeg/pic.patch10
-rw-r--r--main/file/APKBUILD2
-rw-r--r--main/gcc/APKBUILD8
-rw-r--r--main/geany/APKBUILD6
-rw-r--r--main/gst-plugins-bad/APKBUILD6
-rw-r--r--main/gst-plugins-good/APKBUILD6
-rw-r--r--main/gst-plugins-ugly/APKBUILD6
-rw-r--r--main/libcap/APKBUILD2
-rw-r--r--main/libpng/APKBUILD6
-rw-r--r--main/libvpx/APKBUILD37
-rw-r--r--main/libvpx/git100617.patch27956
-rw-r--r--main/linux-grsec/APKBUILD4
-rw-r--r--main/linux-grsec/kernelconfig.x8626
-rw-r--r--main/linux-vserver/APKBUILD4
-rw-r--r--main/linux-vserver/kernelconfig.x8639
-rw-r--r--main/lua/APKBUILD4
-rw-r--r--main/mkinitfs/APKBUILD8
-rw-r--r--main/ncurses/APKBUILD6
-rw-r--r--main/open-iscsi-grsec/APKBUILD (renamed from testing/open-iscsi-grsec/APKBUILD)0
-rw-r--r--main/open-iscsi-grsec/CVE-2009-1297.patch (renamed from testing/open-iscsi-grsec/CVE-2009-1297.patch)0
-rw-r--r--main/open-iscsi-grsec/Makefile.kernel.patch (renamed from testing/open-iscsi-grsec/Makefile.kernel.patch)0
-rw-r--r--main/open-iscsi-grsec/open-iscsi-2.0.871-makefile-cleanup.patch (renamed from testing/open-iscsi-grsec/open-iscsi-2.0.871-makefile-cleanup.patch)0
-rw-r--r--main/open-iscsi/APKBUILD (renamed from testing/open-iscsi/APKBUILD)9
-rw-r--r--main/open-iscsi/CVE-2009-1297.patch (renamed from testing/open-iscsi/CVE-2009-1297.patch)0
-rw-r--r--main/open-iscsi/iscsid.confd13
-rw-r--r--main/open-iscsi/iscsid.initd (renamed from testing/open-iscsi/iscsid.initd)0
-rw-r--r--main/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch (renamed from testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch)0
-rw-r--r--main/readline/APKBUILD2
-rw-r--r--main/wpa_supplicant/APKBUILD20
-rw-r--r--main/wpa_supplicant/wpa_supplicant.confd6
-rw-r--r--main/wpa_supplicant/wpa_supplicant.initd70
-rw-r--r--main/wv/APKBUILD18
-rw-r--r--main/wv/fix-soname.patch14
-rw-r--r--testing/awstats/APKBUILD58
-rw-r--r--testing/btrfs-progs/APKBUILD33
-rw-r--r--testing/cairomm/APKBUILD2
-rw-r--r--testing/cherokee/APKBUILD2
-rw-r--r--testing/coova-chilli/APKBUILD24
-rw-r--r--testing/coova-chilli/coova-chilli-ssl.patch26
-rw-r--r--testing/kamailio/APKBUILD16
-rw-r--r--testing/kamailio/kamailio.cfg2
-rw-r--r--testing/libsigc++/APKBUILD2
-rw-r--r--testing/lua-lgob/APKBUILD34
55 files changed, 28481 insertions, 184 deletions
diff --git a/main/abiword/APKBUILD b/main/abiword/APKBUILD
index c134f19920..ef0be3ab81 100644
--- a/main/abiword/APKBUILD
+++ b/main/abiword/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=abiword 2pkgname=abiword
3pkgver=2.8.4 3pkgver=2.8.6
4pkgrel=2 4pkgrel=0
5pkgdesc="A fully-featured word processor" 5pkgdesc="A fully-featured word processor"
6url="http://www.abisource.com" 6url="http://www.abisource.com"
7license="GPL" 7license="GPL"
@@ -65,4 +65,4 @@ plugins() {
65 mkdir -p "$subpkgdir" 65 mkdir -p "$subpkgdir"
66} 66}
67 67
68md5sums="f782ecb8e07d07ec179f7a143353cc29 abiword-2.8.4.tar.gz" 68md5sums="f883b0a7f26229a9c66fd6a1a94381aa abiword-2.8.6.tar.gz"
diff --git a/main/apk-tools/0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch b/main/apk-tools/0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch
new file mode 100644
index 0000000000..52ef141863
--- /dev/null
+++ b/main/apk-tools/0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch
@@ -0,0 +1,42 @@
1From fc4c60f233ebe9fe85b7b03d0cf5deec4ab1b32d Mon Sep 17 00:00:00 2001
2From: Natanael Copa <ncopa@alpinelinux.org>
3Date: Wed, 16 Jun 2010 07:37:17 +0000
4Subject: [PATCH] Makefile: do not require lua pkgconfig unless you intend build lua module
5
6---
7 src/Makefile | 11 ++++++-----
8 1 files changed, 6 insertions(+), 5 deletions(-)
9
10diff --git a/src/Makefile b/src/Makefile
11index 50f9664..bea288e 100644
12--- a/src/Makefile
13+++ b/src/Makefile
14@@ -1,12 +1,9 @@
15-PKGDEPS := openssl zlib lua
16-
17-ifeq ($(shell pkg-config --print-errors --exists $(PKGDEPS) || echo fail),fail)
18-$(error Build dependencies are not met)
19-endif
20+PKGDEPS := openssl zlib
21
22 # lua module
23 ifneq ($(LUAAPK),)
24 LIBAPK := YesPlease
25+PKGDEPS += lua
26 shlibs-y += apk.so
27 apk.so-objs := lua-apk.o
28 CFLAGS_lua-apk.o := -DAPK_VERSION=\"$(FULL_VERSION)\"
29@@ -16,6 +13,10 @@ install-LUA_LIB-y := $(INSTALLDIR) $(DESTDIR)$(LUA_LIBDIR) \
30 $(INSTALL) $(LUA_LIB-y) $(DESTDIR)$(LUA_LIBDIR)
31 endif
32
33+ifeq ($(shell pkg-config --print-errors --exists $(PKGDEPS) || echo fail),fail)
34+$(error Build dependencies are not met)
35+endif
36+
37 progs-y += apk
38 apk-objs := apk.o add.o del.o fix.o update.o info.o \
39 search.o upgrade.o cache.o ver.o index.o fetch.o \
40--
411.7.1
42
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index 0fafb00356..2c96805b48 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,33 +1,37 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=apk-tools 2pkgname=apk-tools
3pkgver=2.0.3 3pkgver=2.0.5
4pkgrel=1 4pkgrel=0
5pkgdesc="Alpine Package Keeper - package manager for alpine" 5pkgdesc="Alpine Package Keeper - package manager for alpine"
6subpackages="$pkgname-static" 6subpackages="$pkgname-static"
7depends= 7depends=
8makedepends="zlib-dev openssl-dev pkgconfig" 8makedepends="zlib-dev openssl-dev pkgconfig"
9source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 9source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
10 triggers.patch 10 0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch
11 " 11 "
12 12
13
14url="http://git.alpinelinux.org/cgit/apk-tools/" 13url="http://git.alpinelinux.org/cgit/apk-tools/"
15license=GPL-2 14license=GPL-2
16 15
17prepare() { 16prepare() {
18 cd "$srcdir/$pkgname-$pkgver" 17 cd "$srcdir/$pkgname-$pkgver"
19 sed -i -e 's:-Werror::' Make.rules 18 sed -i -e 's:-Werror::' Make.rules
20 for i in ../*.patch; do 19 for i in $source; do
21 [ -f $i ] || continue 20 case $i in
22 patch -p1 -i $i || return 1 21 *.patch) patch -p1 -i "$srcdir"/$i || return 1
22 esac
23 done 23 done
24} 24}
25 25
26build() { 26build() {
27 cd "$srcdir/$pkgname-$pkgver" 27 cd "$srcdir/$pkgname-$pkgver"
28 make || return 1 28 make FULL_VERSION="$pkgver-r$pkgrel" || return 1
29 make static || return 1 29 make FULL_VERSION="$pkgver-r$pkgrel" static || return 1
30 make DESTDIR="$pkgdir" install 30}
31
32package() {
33 cd "$srcdir/$pkgname-$pkgver"
34 make FULL_VERSION="$pkgver-r$pkgrel" DESTDIR="$pkgdir" install
31 cd "$pkgdir/sbin" 35 cd "$pkgdir/sbin"
32 ln -s apk apk_add 36 ln -s apk apk_add
33 ln -s apk apk_audit 37 ln -s apk apk_audit
@@ -44,5 +48,5 @@ static() {
44 "$subpkgdir"/sbin/apk.static 48 "$subpkgdir"/sbin/apk.static
45} 49}
46 50
47md5sums="191938ff9433745a1e24dfab6f8f7249 apk-tools-2.0.3.tar.bz2 51md5sums="7f9234ab210557b064d7bd9b42833f0a apk-tools-2.0.5.tar.bz2
48b4679e85ed85914141312fcbd357bb0f triggers.patch" 52f63d483b724e8e9344ce8cb965d5ed22 0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch"
diff --git a/main/apk-tools/triggers.patch b/main/apk-tools/triggers.patch
deleted file mode 100644
index 4702e0f85a..0000000000
--- a/main/apk-tools/triggers.patch
+++ /dev/null
@@ -1,42 +0,0 @@
1commit 60b537e356dfcd0ed9a3516152c6a170912efcef
2Author: Natanael Copa <ncopa@alpinelinux.org>
3Date: Thu Jun 10 17:50:11 2010 +0000
4
5 db: do not free trigger list after package is unpacked
6
7 The triggers are read during apk_db_unpack_pkg(). If we delete the
8 triggers list after then unpack we delete the triggers which is not
9 what we want.
10
11 This fixes bug introduced in ce3cf8bff901e7fcacbca640ffedaeea2b3bdf7f
12
13diff --git a/src/database.c b/src/database.c
14index 7421e1b..11864cb 100644
15--- a/src/database.c
16+++ b/src/database.c
17@@ -2100,6 +2100,12 @@ int apk_db_install_pkg(struct apk_database *db,
18
19 /* Install the new stuff */
20 ipkg = apk_pkg_install(db, newpkg);
21+ ipkg->flags |= APK_IPKGF_RUN_ALL_TRIGGERS;
22+ if (ipkg->triggers->num != 0) {
23+ list_del(&ipkg->trigger_pkgs_list);
24+ apk_string_array_free(&ipkg->triggers);
25+ }
26+
27 if (newpkg->installed_size != 0) {
28 r = apk_db_unpack_pkg(db, ipkg, (oldpkg != NULL),
29 (oldpkg == newpkg), cb, cb_ctx,
30@@ -2110,12 +2116,6 @@ int apk_db_install_pkg(struct apk_database *db,
31 }
32 }
33
34- ipkg->flags |= APK_IPKGF_RUN_ALL_TRIGGERS;
35- if (ipkg->triggers->num != 0) {
36- list_del(&ipkg->trigger_pkgs_list);
37- apk_string_array_free(&ipkg->triggers);
38- }
39-
40 if (oldpkg != NULL && oldpkg != newpkg && oldpkg->ipkg != NULL) {
41 apk_db_purge_pkg(db, oldpkg->ipkg, NULL);
42 apk_pkg_uninstall(db, oldpkg);
diff --git a/main/bacula/bacula.post-install b/main/bacula/bacula.post-install
index a092957361..e64a59915d 100644
--- a/main/bacula/bacula.post-install
+++ b/main/bacula/bacula.post-install
@@ -1,4 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2mkdir /var/lib/bacula /var/log/bacula
2for dir in /var/bacula /var/log/bacula /var/run/bacula /var/lib/bacula /etc/bacula/scripts/make_catalog_backup* 3for dir in /var/bacula /var/log/bacula /var/run/bacula /var/lib/bacula /etc/bacula/scripts/make_catalog_backup*
3do 4do
4 chown bacula.bacula $dir 5 chown bacula.bacula $dir
diff --git a/main/cups/APKBUILD b/main/cups/APKBUILD
index d63b0c147c..863d76b204 100644
--- a/main/cups/APKBUILD
+++ b/main/cups/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=cups 2pkgname=cups
3pkgver=1.4.3 3pkgver=1.4.4
4pkgrel=3 4pkgrel=0
5pkgdesc="The CUPS Printing System" 5pkgdesc="The CUPS Printing System"
6url="http://www.cups.org/" 6url="http://www.cups.org/"
7license="GPL" 7license="GPL"
@@ -89,6 +89,6 @@ client() {
89 touch "$subpkgdir"/usr/share/cups/charmaps/us-ascii.txt 89 touch "$subpkgdir"/usr/share/cups/charmaps/us-ascii.txt
90} 90}
91 91
92md5sums="e70b1c3f60143d7310c1d74c111a21ab cups-1.4.3-source.tar.bz2 92md5sums="8776403ad60fea9e85eab9c04d88560d cups-1.4.4-source.tar.bz2
93f861b18f4446c43918c8643dcbbd7f6d cups.logrotate 93f861b18f4446c43918c8643dcbbd7f6d cups.logrotate
941154ed66fdcfa0523f929a369079f43c cupsd.initd" 941154ed66fdcfa0523f929a369079f43c cupsd.initd"
diff --git a/main/curl/APKBUILD b/main/curl/APKBUILD
index f7d6c504f1..3cc68d2f98 100644
--- a/main/curl/APKBUILD
+++ b/main/curl/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Carlo Landmeter <clandmeter at gmail.com> 1# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
2pkgname=curl 2pkgname=curl
3pkgver=7.20.1 3pkgver=7.21.0
4pkgrel=1 4pkgrel=0
5pkgdesc="An URL retrival utility and library" 5pkgdesc="An URL retrival utility and library"
6url="http://curl.haxx.se" 6url="http://curl.haxx.se"
7license="MIT" 7license="MIT"
@@ -26,4 +26,4 @@ package() {
26 make DESTDIR="$pkgdir" install 26 make DESTDIR="$pkgdir" install
27} 27}
28 28
29md5sums="244b16b2a38c70e47130c8494b7371b9 curl-7.20.1.tar.bz2" 29md5sums="e1a2a773e93a39f3c04cab92c55bf197 curl-7.21.0.tar.bz2"
diff --git a/main/dahdi-linux-grsec/APKBUILD b/main/dahdi-linux-grsec/APKBUILD
index bc685c79ba..247826c313 100644
--- a/main/dahdi-linux-grsec/APKBUILD
+++ b/main/dahdi-linux-grsec/APKBUILD
@@ -16,7 +16,7 @@ _realname=dahdi-linux
16pkgname=${_realname}-${_flavor} 16pkgname=${_realname}-${_flavor}
17pkgver=$pkgver 17pkgver=$pkgver
18_dahdiver=2.2.0.2 18_dahdiver=2.2.0.2
19_mypkgrel=1 19_mypkgrel=2
20pkgrel=$(( $_kpkgrel + $_mypkgrel )) 20pkgrel=$(( $_kpkgrel + $_mypkgrel ))
21pkgdesc="Digium Asterisk Hardware Device Interface drivers $_dahdiver" 21pkgdesc="Digium Asterisk Hardware Device Interface drivers $_dahdiver"
22url="http://www.asterisk.org" 22url="http://www.asterisk.org"
@@ -54,7 +54,7 @@ build() {
54package() { 54package() {
55 cd "$srcdir/$_realname-$_dahdiver" 55 cd "$srcdir/$_realname-$_dahdiver"
56 make KVERS="${_abi_release}" DYNFS="yes" MODULES_EXTRA="zaphfc" \ 56 make KVERS="${_abi_release}" DYNFS="yes" MODULES_EXTRA="zaphfc" \
57 DESTDIR="$pkgdir" install-modules 57 DESTDIR="$pkgdir" install-modules || return 1
58 rm -rf "$pkgdir"/lib/firmware "$pkgdir"/usr/lib/hotplug/firmware \ 58 rm -rf "$pkgdir"/lib/firmware "$pkgdir"/usr/lib/hotplug/firmware \
59 "$pkgdir"/usr/include 59 "$pkgdir"/usr/include
60} 60}
diff --git a/main/dhcpcd/APKBUILD b/main/dhcpcd/APKBUILD
index 17f3bd0d45..ec04e0ac77 100644
--- a/main/dhcpcd/APKBUILD
+++ b/main/dhcpcd/APKBUILD
@@ -1,8 +1,8 @@
1# Contributor: Michael Mason <ms13sp@gmail.com> 1# Contributor: Michael Mason <ms13sp@gmail.com>
2# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 2# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3pkgname=dhcpcd 3pkgname=dhcpcd
4pkgver=5.2.2 4pkgver=5.2.5
5pkgrel=1 5pkgrel=0
6pkgdesc="RFC2131 compliant DHCP client" 6pkgdesc="RFC2131 compliant DHCP client"
7url="http://roy.marples.name/projects/dhcpcd/" 7url="http://roy.marples.name/projects/dhcpcd/"
8license="BSD-2" 8license="BSD-2"
@@ -25,4 +25,4 @@ package() {
25 make DESTDIR="$pkgdir" install 25 make DESTDIR="$pkgdir" install
26} 26}
27 27
28md5sums="30a161c93bd4548a28d97041329bf335 dhcpcd-5.2.2.tar.bz2" 28md5sums="79f5452252026c0547886f89ab87adf1 dhcpcd-5.2.5.tar.bz2"
diff --git a/main/expat/APKBUILD b/main/expat/APKBUILD
index 3fb6c6212c..2e6e4fe7e0 100644
--- a/main/expat/APKBUILD
+++ b/main/expat/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Carlo Landmeter <clandmeter at gmail.com> 1# Maintainer: Carlo Landmeter <clandmeter at gmail.com>
2pkgname=expat 2pkgname=expat
3pkgver=2.0.1 3pkgver=2.0.1
4pkgrel=2 4pkgrel=3
5pkgdesc="An XML Parser library written in C" 5pkgdesc="An XML Parser library written in C"
6url="http://www.libexpat.org/" 6url="http://www.libexpat.org/"
7license='AS IS' 7license='AS IS'
diff --git a/main/fakeroot/APKBUILD b/main/fakeroot/APKBUILD
index 6c84461691..b388d086a3 100644
--- a/main/fakeroot/APKBUILD
+++ b/main/fakeroot/APKBUILD
@@ -1,12 +1,12 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=fakeroot 2pkgname=fakeroot
3pkgver=1.14.4 3pkgver=1.14.4
4pkgrel=1 4pkgrel=3
5pkgdesc="Gives a fake root environment, useful for building packages as a non-privileged user" 5pkgdesc="Gives a fake root environment, useful for building packages as a non-privileged user"
6license='GPL' 6license='GPL'
7url="http://packages.debian.org/fakeroot" 7url="http://packages.debian.org/fakeroot"
8depends= 8depends=
9subpackages="$pkgname-dev $pkgname-doc" 9subpackages="$pkgname-doc"
10source="http://ftp.debian.org/debian/pool/main/f/$pkgname/${pkgname}_${pkgver}.orig.tar.bz2 10source="http://ftp.debian.org/debian/pool/main/f/$pkgname/${pkgname}_${pkgver}.orig.tar.bz2
11 busybox-compat.patch" 11 busybox-compat.patch"
12 12
@@ -17,13 +17,14 @@ prepare() {
17 17
18build() { 18build() {
19 cd $startdir/src/$pkgname-$pkgver 19 cd $startdir/src/$pkgname-$pkgver
20 CONFIG_SHELL=/bin/sh ./configure --prefix=/usr 20 CONFIG_SHELL=/bin/sh ./configure --prefix=/usr --disable-static
21 make || return 1 21 make || return 1
22} 22}
23 23
24package() { 24package() {
25 cd $startdir/src/$pkgname-$pkgver 25 cd $startdir/src/$pkgname-$pkgver
26 make DESTDIR="$pkgdir" install 26 make DESTDIR="$pkgdir" install || return 1
27 rm "$pkgdir"/usr/lib/*.la
27} 28}
28 29
29md5sums="bea628be77838aaa7323a2f7601c2d7e fakeroot_1.14.4.orig.tar.bz2 30md5sums="bea628be77838aaa7323a2f7601c2d7e fakeroot_1.14.4.orig.tar.bz2
diff --git a/main/ffmpeg/APKBUILD b/main/ffmpeg/APKBUILD
index 840d01f6f2..6d1dcd4d54 100644
--- a/main/ffmpeg/APKBUILD
+++ b/main/ffmpeg/APKBUILD
@@ -1,36 +1,40 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=ffmpeg 2pkgname=ffmpeg
3_svnrev=30526 3pkgver=0.6
4pkgver=0.5_svn$_svnrev 4pkgrel=0
5pkgrel=3
6pkgdesc="Complete and free Internet live audio and video broadcasting solution for Linux/Unix" 5pkgdesc="Complete and free Internet live audio and video broadcasting solution for Linux/Unix"
7url="http://ffmpeg.mplayerhq.hu/" 6url="http://ffmpeg.mplayerhq.hu/"
8license="GPL" 7license="GPL"
9subpackages="$pkgname-dev $pkgname-doc" 8subpackages="$pkgname-dev $pkgname-doc"
10makedepends="lame-dev libvorbis-dev faad2-dev faac-dev xvidcore-dev zlib-dev 9makedepends="lame-dev libvorbis-dev faad2-dev faac-dev xvidcore-dev zlib-dev
11 imlib2-dev x264-dev libtheora-dev coreutils bzip2-dev perl" 10 imlib2-dev x264-dev libtheora-dev coreutils bzip2-dev perl libvpx-dev"
12depends= 11depends=
13source="ftp://ftp.archlinux.org/other/ffmpeg/ffmpeg-$_svnrev.tar.bz2 12source="http://ffmpeg.org/releases/ffmpeg-$pkgver.tar.bz2
14 pic.patch" 13 pic.patch"
15 14
16_builddir="$srcdir"/$pkgname 15_builddir="$srcdir"/$pkgname-$pkgver
17build() { 16prepare() {
18 cd "$_builddir" 17 cd "$_builddir"
19 patch -p1 < ../pic.patch || return 1 18 patch -p1 -i "$srcdir"/pic.patch
19}
20 20
21build() {
22 cd "$_builddir"
21 ./configure --prefix=/usr \ 23 ./configure --prefix=/usr \
22 --enable-gpl \ 24 --enable-gpl \
23 --enable-libmp3lame \ 25 --enable-libmp3lame \
24 --enable-libvorbis \ 26 --enable-libvorbis \
25 --enable-libfaac \ 27 --enable-libfaac \
26 --enable-libfaad \ 28 --enable-libfaad \
29 --enable-libvpx \
27 --enable-libxvid \ 30 --enable-libxvid \
28 --enable-libx264 \ 31 --enable-libx264 \
29 --enable-libtheora \ 32 --enable-libtheora \
30 --enable-nonfree \ 33 --enable-nonfree \
31 --enable-postproc \ 34 --enable-postproc \
32 --enable-shared \ 35 --enable-pic \
33 --enable-pthreads \ 36 --enable-pthreads \
37 --enable-shared \
34 --enable-x11grab \ 38 --enable-x11grab \
35 --disable-mmx \ 39 --disable-mmx \
36 --disable-mmx2 \ 40 --disable-mmx2 \
@@ -47,5 +51,5 @@ package() {
47 install -D -m755 tools/qt-faststart "$pkgdir/usr/bin/qt-faststart" || return 1 51 install -D -m755 tools/qt-faststart "$pkgdir/usr/bin/qt-faststart" || return 1
48# strip --strip-debug "$pkgdir"/usr/lib/*.a || return 1 52# strip --strip-debug "$pkgdir"/usr/lib/*.a || return 1
49} 53}
50md5sums="36710a8fa2bb91556c355aeb0e662c81 ffmpeg-30526.tar.bz2 54md5sums="d6142a9a5821d6a6262a6edb903faa24 ffmpeg-0.6.tar.bz2
513c5d446db8d512a3bca5f5a860bbcc04 pic.patch" 55d4870ae7350caed041d2b39e406a173b pic.patch"
diff --git a/main/ffmpeg/pic.patch b/main/ffmpeg/pic.patch
index 9651f31ef1..737e30ddeb 100644
--- a/main/ffmpeg/pic.patch
+++ b/main/ffmpeg/pic.patch
@@ -1,11 +1,11 @@
1--- a/libswscale/rgb2rgb.c 2009-07-10 14:27:39.000000000 +0000 1--- ./libswscale/rgb2rgb.c.orig
2+++ b/libswscale/rgb2rgb.c 2009-07-10 14:53:45.000000000 +0000 2+++ ./libswscale/rgb2rgb.c
3@@ -149,7 +149,7 @@ 3@@ -159,7 +159,7 @@
4 #define RENAME(a) a ## _C 4 #define RENAME(a) a ## _C
5 #include "rgb2rgb_template.c" 5 #include "rgb2rgb_template.c"
6 6
7-#if ARCH_X86 && CONFIG_GPL 7-#if ARCH_X86
8+#if ARCH_X86 && CONFIG_GPL && !defined(PIC) 8+#if ARCH_X86 && !defined(PIC)
9 9
10 //MMX versions 10 //MMX versions
11 #undef RENAME 11 #undef RENAME
diff --git a/main/file/APKBUILD b/main/file/APKBUILD
index 0602565b6c..417ab0d957 100644
--- a/main/file/APKBUILD
+++ b/main/file/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=file 2pkgname=file
3pkgver=5.04 3pkgver=5.04
4pkgrel=1 4pkgrel=2
5pkgdesc="File type identification utility" 5pkgdesc="File type identification utility"
6url="http://www.darwinsys.com/file/" 6url="http://www.darwinsys.com/file/"
7license="custom" 7license="custom"
diff --git a/main/gcc/APKBUILD b/main/gcc/APKBUILD
index da3bdc129f..3beecf2377 100644
--- a/main/gcc/APKBUILD
+++ b/main/gcc/APKBUILD
@@ -6,7 +6,7 @@ _specsver=0.1.7
6_espfver=0.3.6 6_espfver=0.3.6
7_uclibc_abiver=0.9.32 7_uclibc_abiver=0.9.32
8 8
9pkgrel=0 9pkgrel=1
10pkgdesc="The GNU Compiler Collection" 10pkgdesc="The GNU Compiler Collection"
11url="http://gcc.gnu.org" 11url="http://gcc.gnu.org"
12license="GPL LGPL" 12license="GPL LGPL"
@@ -93,7 +93,7 @@ libcxx() {
93 pkgdesc="GNU C++ standard runtime library" 93 pkgdesc="GNU C++ standard runtime library"
94 depends= 94 depends=
95 mkdir -p "$subpkgdir"/usr/lib 95 mkdir -p "$subpkgdir"/usr/lib
96 mv "$pkgdir"/usr/lib/libstdc++.so* "$subpkgdir"/usr/lib/ 96 mv "$pkgdir"/usr/lib/libstdc++.so.* "$subpkgdir"/usr/lib/
97} 97}
98 98
99gpp() { 99gpp() {
@@ -115,7 +115,7 @@ libgcc() {
115 pkgdesc="GNU C compiler runtime libraries" 115 pkgdesc="GNU C compiler runtime libraries"
116 depends= 116 depends=
117 mkdir -p "$subpkgdir"/usr/lib 117 mkdir -p "$subpkgdir"/usr/lib
118 mv "$pkgdir"/usr/lib/libgcc_s.so* "$subpkgdir"/usr/lib/ 118 mv "$pkgdir"/usr/lib/libgcc_s.so.* "$subpkgdir"/usr/lib/
119} 119}
120 120
121libgomp() { 121libgomp() {
@@ -123,7 +123,7 @@ libgomp() {
123 depends= 123 depends=
124 replaces="gcc" 124 replaces="gcc"
125 mkdir -p "$subpkgdir"/usr/lib 125 mkdir -p "$subpkgdir"/usr/lib
126 mv "$pkgdir"/usr/lib/libgomp.so* "$subpkgdir"/usr/lib/ 126 mv "$pkgdir"/usr/lib/libgomp.so.* "$subpkgdir"/usr/lib/
127} 127}
128 128
129md5sums="eb68755f64b9a4e37751992abb41c4fc gcc-core-4.4.4.tar.bz2 129md5sums="eb68755f64b9a4e37751992abb41c4fc gcc-core-4.4.4.tar.bz2
diff --git a/main/geany/APKBUILD b/main/geany/APKBUILD
index 36e77f4226..ac10761869 100644
--- a/main/geany/APKBUILD
+++ b/main/geany/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=geany 2pkgname=geany
3pkgver=0.18.1 3pkgver=0.19
4pkgrel=1 4pkgrel=0
5pkgdesc="A fast and lightweight IDE" 5pkgdesc="A fast and lightweight IDE"
6url="http://www.geany.org" 6url="http://www.geany.org"
7license="GPL" 7license="GPL"
@@ -24,4 +24,4 @@ package() {
24 sed -i 's|Sh=|Sh=APKBUILD;|' data/filetype_extensions.conf || return 1 24 sed -i 's|Sh=|Sh=APKBUILD;|' data/filetype_extensions.conf || return 1
25 make DESTDIR="$pkgdir" install || return 1 25 make DESTDIR="$pkgdir" install || return 1
26} 26}
27md5sums="bd1f70a5ee9a7f10c3c4f17bd263a0b1 geany-0.18.1.tar.gz" 27md5sums="727cec2936846850bb088b476faad5f2 geany-0.19.tar.gz"
diff --git a/main/gst-plugins-bad/APKBUILD b/main/gst-plugins-bad/APKBUILD
index 4821c459ca..8155aa2a18 100644
--- a/main/gst-plugins-bad/APKBUILD
+++ b/main/gst-plugins-bad/APKBUILD
@@ -1,6 +1,6 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=gst-plugins-bad 2pkgname=gst-plugins-bad
3pkgver=0.10.18 3pkgver=0.10.19
4pkgrel=0 4pkgrel=0
5pkgdesc="GStreamer bad plugins" 5pkgdesc="GStreamer bad plugins"
6url="http://gstreamer.freedesktop.org/" 6url="http://gstreamer.freedesktop.org/"
@@ -8,7 +8,7 @@ license="LGPL GPL"
8depends="" 8depends=""
9makedepends="pkgconfig gst-plugins-base-dev gstreamer-dev xvidcore-dev 9makedepends="pkgconfig gst-plugins-base-dev gstreamer-dev xvidcore-dev
10 bzip2-dev neon-dev faac-dev libexif-dev faad2-dev glib-dev liboil-dev 10 bzip2-dev neon-dev faac-dev libexif-dev faad2-dev glib-dev liboil-dev
11 alsa-lib-dev libx11-dev sdl-dev" 11 alsa-lib-dev libx11-dev sdl-dev libvpx-dev"
12 12
13#'libdca>=0.0.5' 'bzip2' 'libdc1394>=2.1.0' 'exempi>=2.1.0' 'jack-audio-connection-kit>=0.116.2' 'neon>=0.28.4' 'faac>=1.28' 'libexif>=0.6.17' 'musicbrainz>=2.1.5' 'faad2>=2.7' 'libmms>=0.4' 'libcdaudio>=0.99.12' 'libmpcdec>=1.2.6' 'mjpegtools>=1.9.0' 'libdvdnav>=4.1.3' 'libmodplug>=0.8.7' 'jasper>=1.900.1' 'liblrdf>=0.4.0' 'libofa>=0.9.3') 13#'libdca>=0.0.5' 'bzip2' 'libdc1394>=2.1.0' 'exempi>=2.1.0' 'jack-audio-connection-kit>=0.116.2' 'neon>=0.28.4' 'faac>=1.28' 'libexif>=0.6.17' 'musicbrainz>=2.1.5' 'faad2>=2.7' 'libmms>=0.4' 'libcdaudio>=0.99.12' 'libmpcdec>=1.2.6' 'mjpegtools>=1.9.0' 'libdvdnav>=4.1.3' 'libmodplug>=0.8.7' 'jasper>=1.900.1' 'liblrdf>=0.4.0' 'libofa>=0.9.3')
14source="http://gstreamer.freedesktop.org//src/gst-plugins-bad/gst-plugins-bad-$pkgver.tar.bz2" 14source="http://gstreamer.freedesktop.org//src/gst-plugins-bad/gst-plugins-bad-$pkgver.tar.bz2"
@@ -31,4 +31,4 @@ package() {
31 make DESTDIR="$pkgdir" install 31 make DESTDIR="$pkgdir" install
32} 32}
33 33
34md5sums="84838893b447e774d401a698ff812b32 gst-plugins-bad-0.10.18.tar.bz2" 34md5sums="368f72e2a1c7a6e8fe60394e4315259b gst-plugins-bad-0.10.19.tar.bz2"
diff --git a/main/gst-plugins-good/APKBUILD b/main/gst-plugins-good/APKBUILD
index d493cc2ad6..94ff700a93 100644
--- a/main/gst-plugins-good/APKBUILD
+++ b/main/gst-plugins-good/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=gst-plugins-good 2pkgname=gst-plugins-good
3pkgver=0.10.22 3pkgver=0.10.23
4pkgrel=1 4pkgrel=0
5pkgdesc="GStreamer Multimedia Framework Good Plugins" 5pkgdesc="GStreamer Multimedia Framework Good Plugins"
6url="http://gstreamer.freedesktop.org/" 6url="http://gstreamer.freedesktop.org/"
7license="LGPL" 7license="LGPL"
@@ -42,4 +42,4 @@ package() {
42 cd "$srcdir"/$pkgname-$pkgver 42 cd "$srcdir"/$pkgname-$pkgver
43 make DESTDIR="$pkgdir" install || return 1 43 make DESTDIR="$pkgdir" install || return 1
44} 44}
45md5sums="4804aaa32044af9846914304991cc9d6 gst-plugins-good-0.10.22.tar.bz2" 45md5sums="9cddbb0e7e90677f0cc05c23feffef5c gst-plugins-good-0.10.23.tar.bz2"
diff --git a/main/gst-plugins-ugly/APKBUILD b/main/gst-plugins-ugly/APKBUILD
index 818b3ec94b..7642d78a0f 100644
--- a/main/gst-plugins-ugly/APKBUILD
+++ b/main/gst-plugins-ugly/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=gst-plugins-ugly 2pkgname=gst-plugins-ugly
3pkgver=0.10.14 3pkgver=0.10.15
4pkgrel=1 4pkgrel=0
5pkgdesc="GStreamer Multimedia Framework Ugly Plugins (gst-plugins-ugly)" 5pkgdesc="GStreamer Multimedia Framework Ugly Plugins (gst-plugins-ugly)"
6url="http://gstreamer.freedesktop.org/" 6url="http://gstreamer.freedesktop.org/"
7license="LGPL" 7license="LGPL"
@@ -27,4 +27,4 @@ package() {
27 cd "$srcdir"/$pkgname-$pkgver 27 cd "$srcdir"/$pkgname-$pkgver
28 make DESTDIR="$pkgdir" install || return 1 28 make DESTDIR="$pkgdir" install || return 1
29} 29}
30md5sums="0bc0d27bcce88c73ef6c81e88624e686 gst-plugins-ugly-0.10.14.tar.bz2" 30md5sums="21c034a762a5da252f91640e53bfe457 gst-plugins-ugly-0.10.15.tar.bz2"
diff --git a/main/libcap/APKBUILD b/main/libcap/APKBUILD
index e379bee196..bed9af6ce5 100644
--- a/main/libcap/APKBUILD
+++ b/main/libcap/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=libcap 2pkgname=libcap
3pkgver=2.19 3pkgver=2.19
4pkgrel=1 4pkgrel=2
5pkgdesc="POSIX 1003.1e capabilities" 5pkgdesc="POSIX 1003.1e capabilities"
6license="GPL" 6license="GPL"
7url="http://www.friedhoff.org/posixfilecaps.html" 7url="http://www.friedhoff.org/posixfilecaps.html"
diff --git a/main/libpng/APKBUILD b/main/libpng/APKBUILD
index 70f15d01bc..39a12f7cdf 100644
--- a/main/libpng/APKBUILD
+++ b/main/libpng/APKBUILD
@@ -1,8 +1,8 @@
1# Contributor: Carlo Landmeter <clandmeter at gmail> 1# Contributor: Carlo Landmeter <clandmeter at gmail>
2# Maintainer: Carlo Landmeter <clandmeter at gmail> 2# Maintainer: Carlo Landmeter <clandmeter at gmail>
3pkgname=libpng 3pkgname=libpng
4pkgver=1.4.1 4pkgver=1.4.2
5pkgrel=1 5pkgrel=0
6pkgdesc="Portable Network Graphics library" 6pkgdesc="Portable Network Graphics library"
7url="http://www.libpng.org/" 7url="http://www.libpng.org/"
8license="GPL" 8license="GPL"
@@ -27,4 +27,4 @@ package() {
27 install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE || return 1 27 install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE || return 1
28} 28}
29 29
30md5sums="fa0b2a84733463f90d3ac9f43ccafabc libpng-1.4.1.tar.gz" 30md5sums="89fd334dc5fc84ff146b9269c4fa452f libpng-1.4.2.tar.gz"
diff --git a/main/libvpx/APKBUILD b/main/libvpx/APKBUILD
new file mode 100644
index 0000000000..b69f364339
--- /dev/null
+++ b/main/libvpx/APKBUILD
@@ -0,0 +1,37 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=libvpx
3pkgver=0.9.1
4pkgrel=0
5pkgdesc="Library for the vp8 codec"
6url="http://www.webmproject.org/"
7license="GPL"
8depends=
9makedepends="coreutils yasm bash perl"
10install=
11subpackages="$pkgname-dev"
12source="http://webm.googlecode.com/files/libvpx-$pkgver.tar.bz2"
13
14_builddir="$srcdir"/$pkgname-$pkgver
15
16prepare() {
17 cd "$_builddir"
18}
19
20build() {
21 cd "$_builddir"
22 ./configure \
23 --enable-pic \
24 --enable-libs \
25 --enable-runtime-cpu-detect \
26 --enable-vp8 \
27 --disable-install-srcs \
28 || return 1
29 make || return 1
30}
31
32package() {
33 cd "$_builddir"
34 make DIST_DIR="$pkgdir"/usr install
35}
36
37md5sums="e1442e74d0cca228785083fa520735a2 libvpx-0.9.1.tar.bz2"
diff --git a/main/libvpx/git100617.patch b/main/libvpx/git100617.patch
new file mode 100644
index 0000000000..3c5eece135
--- /dev/null
+++ b/main/libvpx/git100617.patch
@@ -0,0 +1,27956 @@
1diff --git a/AUTHORS b/AUTHORS
2index 9686ac1..4ab6881 100644
3--- a/AUTHORS
4+++ b/AUTHORS
5@@ -2,3 +2,6 @@
6 # Name or Organization <email address>
7
8 Google Inc.
9+The Mozilla Foundation
10+Timothy B. Terriberry <tterriberry@mozilla.com>
11+The Xiph.Org Foundation
12diff --git a/LICENSE b/LICENSE
13index 6b0e867..7a6f995 100644
14--- a/LICENSE
15+++ b/LICENSE
16@@ -1,22 +1,20 @@
17-Copyright (c) 2010, Google, Inc.
18-
19-All rights reserved.
20+Copyright (c) 2010, Google Inc. All rights reserved.
21
22 Redistribution and use in source and binary forms, with or without
23-modification, are permitted provided that the following conditions
24-are met:
25+modification, are permitted provided that the following conditions are
26+met:
27
28-- Redistributions of source code must retain the above copyright
29- notice, this list of conditions and the following disclaimer.
30+ * Redistributions of source code must retain the above copyright
31+ notice, this list of conditions and the following disclaimer.
32
33-- Redistributions in binary form must reproduce the above
34- copyright notice, this list of conditions and the following
35- disclaimer in the documentation and/or other materials provided
36- with the distribution.
37+ * Redistributions in binary form must reproduce the above copyright
38+ notice, this list of conditions and the following disclaimer in
39+ the documentation and/or other materials provided with the
40+ distribution.
41
42-- Neither the name of Google nor the names of its contributors may
43- be used to endorse or promote products derived from this software
44- without specific prior written permission.
45+ * Neither the name of Google nor the names of its contributors may
46+ be used to endorse or promote products derived from this software
47+ without specific prior written permission.
48
49 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51@@ -30,19 +28,3 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
54
55-Subject to the terms and conditions of the above License, Google
56-hereby grants to You a perpetual, worldwide, non-exclusive,
57-no-charge, royalty-free, irrevocable (except as stated in this
58-section) patent license to make, have made, use, offer to sell, sell,
59-import, and otherwise transfer this implementation of VP8, where such
60-license applies only to those patent claims, both currently owned by
61-Google and acquired in the future, licensable by Google that are
62-necessarily infringed by this implementation of VP8. If You or your
63-agent or exclusive licensee institute or order or agree to the
64-institution of patent litigation against any entity (including a
65-cross-claim or counterclaim in a lawsuit) alleging that this
66-implementation of VP8 or any code incorporated within this
67-implementation of VP8 constitutes direct or contributory patent
68-infringement, or inducement of patent infringement, then any rights
69-granted to You under this License for this implementation of VP8
70-shall terminate as of the date such litigation is filed.
71diff --git a/PATENTS b/PATENTS
72new file mode 100644
73index 0000000..4414d83
74--- /dev/null
75+++ b/PATENTS
76@@ -0,0 +1,22 @@
77+Additional IP Rights Grant (Patents)
78+
79+"This implementation" means the copyrightable works distributed by
80+Google as part of the WebM Project.
81+
82+Google hereby grants to you a perpetual, worldwide, non-exclusive,
83+no-charge, royalty-free, irrevocable (except as stated in this section)
84+patent license to make, have made, use, offer to sell, sell, import,
85+transfer, and otherwise run, modify and propagate the contents of this
86+implementation of VP8, where such license applies only to those patent
87+claims, both currently owned by Google and acquired in the future,
88+licensable by Google that are necessarily infringed by this
89+implementation of VP8. This grant does not include claims that would be
90+infringed only as a consequence of further modification of this
91+implementation. If you or your agent or exclusive licensee institute or
92+order or agree to the institution of patent litigation against any
93+entity (including a cross-claim or counterclaim in a lawsuit) alleging
94+that this implementation of VP8 or any code incorporated within this
95+implementation of VP8 constitutes direct or contributory patent
96+infringement, or inducement of patent infringement, then any patent
97+rights granted to you under this License for this implementation of VP8
98+shall terminate as of the date such litigation is filed.
99diff --git a/args.c b/args.c
100index f2ad697..5fd0466 100644
101--- a/args.c
102+++ b/args.c
103@@ -1,10 +1,11 @@
104 /*
105 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
106 *
107- * Use of this source code is governed by a BSD-style license and patent
108- * grant that can be found in the LICENSE file in the root of the source
109- * tree. All contributing project authors may be found in the AUTHORS
110- * file in the root of the source tree.
111+ * Use of this source code is governed by a BSD-style license
112+ * that can be found in the LICENSE file in the root of the source
113+ * tree. An additional intellectual property rights grant can be found
114+ * in the file PATENTS. All contributing project authors may
115+ * be found in the AUTHORS file in the root of the source tree.
116 */
117
118
119diff --git a/args.h b/args.h
120index c063f53..f1ec6c0 100644
121--- a/args.h
122+++ b/args.h
123@@ -1,10 +1,11 @@
124 /*
125 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
126 *
127- * Use of this source code is governed by a BSD-style license and patent
128- * grant that can be found in the LICENSE file in the root of the source
129- * tree. All contributing project authors may be found in the AUTHORS
130- * file in the root of the source tree.
131+ * Use of this source code is governed by a BSD-style license
132+ * that can be found in the LICENSE file in the root of the source
133+ * tree. An additional intellectual property rights grant can be found
134+ * in the file PATENTS. All contributing project authors may
135+ * be found in the AUTHORS file in the root of the source tree.
136 */
137
138
139diff --git a/build/.gitattributes b/build/.gitattributes
140new file mode 100644
141index 0000000..03db79b
142--- /dev/null
143+++ b/build/.gitattributes
144@@ -0,0 +1,2 @@
145+*-vs8/*.rules -crlf
146+*-msvs/*.rules -crlf
147diff --git a/build/arm-wince-vs8/.gitattributes b/build/arm-wince-vs8/.gitattributes
148deleted file mode 100644
149index be1eeb9..0000000
150--- a/build/arm-wince-vs8/.gitattributes
151+++ /dev/null
152@@ -1 +0,0 @@
153-*.rules -crlf
154diff --git a/build/arm-wince-vs8/obj_int_extract.bat b/build/arm-wince-vs8/obj_int_extract.bat
155index e58bdd6..3069160 100644
156--- a/build/arm-wince-vs8/obj_int_extract.bat
157+++ b/build/arm-wince-vs8/obj_int_extract.bat
158@@ -1,12 +1,13 @@
159 @echo off
160 REM Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
161 REM
162-REM Use of this source code is governed by a BSD-style license and patent
163-REM grant that can be found in the LICENSE file in the root of the source
164-REM tree. All contributing project authors may be found in the AUTHORS
165-REM file in the root of the source tree.
166+REM Use of this source code is governed by a BSD-style license
167+REM that can be found in the LICENSE file in the root of the source
168+REM tree. An additional intellectual property rights grant can be found
169+REM in the file PATENTS. All contributing project authors may
170+REM be found in the AUTHORS file in the root of the source tree.
171 echo on
172
173
174-cl /I ".\\" /I "..\vp6_decoder_sdk" /I "..\vp6_decoder_sdk\vpx_ports" /D "NDEBUG" /D "_WIN32_WCE=0x420" /D "UNDER_CE" /D "WIN32_PLATFORM_PSPC" /D "WINCE" /D "_LIB" /D "ARM" /D "_ARM_" /D "_UNICODE" /D "UNICODE" /D "HAVE_CONFIG_H" /FD /EHsc /MT /GS- /fp:fast /GR- /Fo"Pocket_PC_2003__ARMV4_\%1/" /Fd"Pocket_PC_2003__ARMV4_\%1/vc80.pdb" /W3 /nologo /c /TC ..\vp6_decoder_sdk\vp6_decoder\algo\common\arm\dec_asm_offsets_arm.c
175+cl /I ".\\" /I "..\vp6_decoder_sdk" /I "..\vp6_decoder_sdk\vpx_ports" /D "NDEBUG" /D "_WIN32_WCE=0x420" /D "UNDER_CE" /D "WIN32_PLATFORM_PSPC" /D "WINCE" /D "_LIB" /D "ARM" /D "_ARM_" /D "_UNICODE" /D "UNICODE" /FD /EHsc /MT /GS- /fp:fast /GR- /Fo"Pocket_PC_2003__ARMV4_\%1/" /Fd"Pocket_PC_2003__ARMV4_\%1/vc80.pdb" /W3 /nologo /c /TC ..\vp6_decoder_sdk\vp6_decoder\algo\common\arm\dec_asm_offsets_arm.c
176 obj_int_extract.exe rvds "Pocket_PC_2003__ARMV4_\%1/dec_asm_offsets_arm.obj"
177diff --git a/build/make/Makefile b/build/make/Makefile
178index 412629e..4f7df43 100755
179--- a/build/make/Makefile
180+++ b/build/make/Makefile
181@@ -1,10 +1,11 @@
182 ##
183 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
184-##
185-## Use of this source code is governed by a BSD-style license and patent
186-## grant that can be found in the LICENSE file in the root of the source
187-## tree. All contributing project authors may be found in the AUTHORS
188-## file in the root of the source tree.
189+##
190+## Use of this source code is governed by a BSD-style license
191+## that can be found in the LICENSE file in the root of the source
192+## tree. An additional intellectual property rights grant can be found
193+## in the file PATENTS. All contributing project authors may
194+## be found in the AUTHORS file in the root of the source tree.
195 ##
196
197
198@@ -18,6 +19,7 @@ ifeq ($(target),)
199 done
200 all: .DEFAULT
201 clean:: .DEFAULT
202+install:: .DEFAULT
203
204
205 # Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
206@@ -29,7 +31,7 @@ md5sum := $(firstword $(wildcard \
207 md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum))
208
209 TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
210-install:
211+dist:
212 @for t in $(ALL_TARGETS); do \
213 $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
214 done
215@@ -37,7 +39,7 @@ install:
216 @if [ -d "$(DIST_DIR)/src" ]; then \
217 mkdir -p "$(DIST_DIR)/build"; \
218 cd "$(DIST_DIR)/build"; \
219- if [ $(TGT_CC) = "rvct" ] ; then \
220+ if [ "$(TGT_CC)" = "rvct" ] ; then \
221 echo "../src/configure --target=$(TOOLCHAIN) --libc=$(ALT_LIBC)"; \
222 ../src/configure --target=$(TOOLCHAIN) --libc=$(ALT_LIBC); \
223 else \
224@@ -94,10 +96,10 @@ clean::
225 rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s)
226 rm -f $(CLEAN-OBJS)
227
228+.PHONY: dist
229+dist:
230 .PHONY: install
231-install:
232-.PHONY: install-helper
233-install-helper:
234+install::
235
236 $(BUILD_PFX)%.c.d: %.c
237 $(if $(quiet),@echo " [DEP] $@")
238@@ -218,6 +220,20 @@ $(1):
239 $(qexec)$$(AR) $$(ARFLAGS) $$@ $$?
240 endef
241
242+define so_template
243+# Not using a pattern rule here because we don't want to generate empty
244+# archives when they are listed as a dependency in files not responsible
245+# for creating them.
246+#
247+# This needs further abstraction for dealing with non-GNU linkers.
248+$(1):
249+ $(if $(quiet),@echo " [LD] $$@")
250+ $(qexec)$$(LD) -shared $$(LDFLAGS) \
251+ -Wl,--no-undefined -Wl,-soname,$$(SONAME) \
252+ -Wl,--version-script,$$(SO_VERSION_SCRIPT) -o $$@ \
253+ $$(filter %.o,$$?) $$(extralibs)
254+endef
255+
256 define lipo_lib_template
257 $(1): $(addsuffix /$(1),$(FAT_ARCHS))
258 $(if $(quiet),@echo " [LIPO] $$@")
259@@ -254,6 +270,9 @@ DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS)
260 @touch $@
261
262 INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS)
263+ifeq ($(MAKECMDGOALS),dist)
264+INSTALL-DOCS+=$(call cond_enabled,CONFIG_INSTALL_DOCS,DIST-DOCS)
265+endif
266 .install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS))
267 @touch $@
268
269@@ -265,6 +284,9 @@ BINS=$(call enabled,BINS)
270 @touch $@
271
272 INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS)
273+ifeq ($(MAKECMDGOALS),dist)
274+INSTALL-BINS+=$(call cond_enabled,CONFIG_INSTALL_BINS,DIST-BINS)
275+endif
276 .install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS))
277 @touch $@
278
279@@ -275,8 +297,12 @@ LIBS=$(call enabled,LIBS)
280 .libs: $(LIBS)
281 @touch $@
282 $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
283+$(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
284
285 INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS)
286+ifeq ($(MAKECMDGOALS),dist)
287+INSTALL-LIBS+=$(call cond_enabled,CONFIG_INSTALL_LIBS,DIST-LIBS)
288+endif
289 .install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS))
290 @touch $@
291
292@@ -289,6 +315,9 @@ PROJECTS=$(call enabled,PROJECTS)
293 @touch $@
294
295 INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS)
296+ifeq ($(MAKECMDGOALS),dist)
297+INSTALL-PROJECTS+=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,DIST-PROJECTS)
298+endif
299 .install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS))
300 @touch $@
301
302@@ -296,26 +325,29 @@ clean::
303 rm -f .projects .install-projects $(PROJECTS)
304 endif
305
306-# If there are any source files to be installed, then include the build
307+# If there are any source files to be distributed, then include the build
308 # system too.
309-ifneq ($(call enabled,INSTALL-SRCS),)
310- INSTALL-SRCS-yes += configure
311- INSTALL-SRCS-yes += build/make/configure.sh
312- INSTALL-SRCS-yes += build/make/gen_asm_deps.sh
313- INSTALL-SRCS-yes += build/make/Makefile
314- INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
315- INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
316- INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
317- INSTALL-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
318+ifneq ($(call enabled,DIST-SRCS),)
319+ DIST-SRCS-yes += configure
320+ DIST-SRCS-yes += build/make/configure.sh
321+ DIST-SRCS-yes += build/make/gen_asm_deps.sh
322+ DIST-SRCS-yes += build/make/Makefile
323+ DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
324+ DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
325+ DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
326+ DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
327 #
328 # This isn't really ARCH_ARM dependent, it's dependant on whether we're
329 # using assembly code or not (CONFIG_OPTIMIZATIONS maybe). Just use
330 # this for now.
331- INSTALL-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c
332- INSTALL-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
333- INSTALL-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
334+ DIST-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c
335+ DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
336+ DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
337 endif
338 INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS)
339+ifeq ($(MAKECMDGOALS),dist)
340+INSTALL-SRCS += $(call cond_enabled,CONFIG_INSTALL_SRCS,DIST-SRCS)
341+endif
342 .install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS))
343 @touch $@
344
345@@ -329,7 +361,8 @@ endif
346 BUILD_TARGETS += .docs .libs .bins
347 INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
348 all-$(target): $(BUILD_TARGETS)
349-install: $(INSTALL_TARGETS)
350+install:: $(INSTALL_TARGETS)
351+dist: $(INSTALL_TARGETS)
352
353 #
354 # Development helper targets
355diff --git a/build/make/ads2gas.pl b/build/make/ads2gas.pl
356index 6fcba84..bd5e772 100755
357--- a/build/make/ads2gas.pl
358+++ b/build/make/ads2gas.pl
359@@ -1,11 +1,12 @@
360 #!/usr/bin/perl
361 ##
362 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
363-##
364-## Use of this source code is governed by a BSD-style license and patent
365-## grant that can be found in the LICENSE file in the root of the source
366-## tree. All contributing project authors may be found in the AUTHORS
367-## file in the root of the source tree.
368+##
369+## Use of this source code is governed by a BSD-style license
370+## that can be found in the LICENSE file in the root of the source
371+## tree. An additional intellectual property rights grant can be found
372+## in the file PATENTS. All contributing project authors may
373+## be found in the AUTHORS file in the root of the source tree.
374 ##
375
376
377diff --git a/build/make/ads2gas_apple.pl b/build/make/ads2gas_apple.pl
378index 569c3e7..7a32445 100755
379--- a/build/make/ads2gas_apple.pl
380+++ b/build/make/ads2gas_apple.pl
381@@ -1,11 +1,12 @@
382 #!/usr/bin/env perl
383 ##
384 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
385-##
386-## Use of this source code is governed by a BSD-style license and patent
387-## grant that can be found in the LICENSE file in the root of the source
388-## tree. All contributing project authors may be found in the AUTHORS
389-## file in the root of the source tree.
390+##
391+## Use of this source code is governed by a BSD-style license
392+## that can be found in the LICENSE file in the root of the source
393+## tree. An additional intellectual property rights grant can be found
394+## in the file PATENTS. All contributing project authors may
395+## be found in the AUTHORS file in the root of the source tree.
396 ##
397
398
399diff --git a/build/make/armlink_adapter.sh b/build/make/armlink_adapter.sh
400index dcaa82c..25fb627 100755
401--- a/build/make/armlink_adapter.sh
402+++ b/build/make/armlink_adapter.sh
403@@ -2,10 +2,11 @@
404 ##
405 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
406 ##
407-## Use of this source code is governed by a BSD-style license and patent
408-## grant that can be found in the LICENSE file in the root of the source
409-## tree. All contributing project authors may be found in the AUTHORS
410-## file in the root of the source tree.
411+## Use of this source code is governed by a BSD-style license
412+## that can be found in the LICENSE file in the root of the source
413+## tree. An additional intellectual property rights grant can be found
414+## in the file PATENTS. All contributing project authors may
415+## be found in the AUTHORS file in the root of the source tree.
416 ##
417
418
419diff --git a/build/make/configure.sh b/build/make/configure.sh
420index ed3a34f..05e550f 100755
421--- a/build/make/configure.sh
422+++ b/build/make/configure.sh
423@@ -1,13 +1,13 @@
424 #!/bin/bash
425 ##
426-## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
427+## configure.sh
428 ##
429-## Use of this source code is governed by a BSD-style license and patent
430-## grant that can be found in the LICENSE file in the root of the source
431-## tree. All contributing project authors may be found in the AUTHORS
432-## file in the root of the source tree.
433+## This script is sourced by the main configure script and contains
434+## utility functions and other common bits that aren't strictly libvpx
435+## related.
436+##
437+## This build system is based in part on the FFmpeg configure script.
438 ##
439-
440
441
442 #
443@@ -120,8 +120,8 @@ EOF
444
445 show_targets() {
446 while [ -n "$*" ]; do
447- if [ "${1%%-*}" == "${2%%-*}" ]; then
448- if [ "${2%%-*}" == "${3%%-*}" ]; then
449+ if [ "${1%%-*}" = "${2%%-*}" ]; then
450+ if [ "${2%%-*}" = "${3%%-*}" ]; then
451 printf " %-24s %-24s %-24s\n" "$1" "$2" "$3"
452 shift; shift; shift
453 else
454@@ -348,7 +348,6 @@ true
455 }
456
457 write_common_target_config_mk() {
458- [ -n "$2" ] && local have_config_h="-DHAVE_CONFIG_H=\"${2##*/}\""
459 local CC=${CC}
460 enabled ccache && CC="ccache ${CC}"
461
462@@ -367,7 +366,7 @@ AS=${AS}
463 STRIP=${STRIP}
464 NM=${NM}
465
466-CFLAGS = ${CFLAGS} ${have_config_h}
467+CFLAGS = ${CFLAGS}
468 ARFLAGS = -rus\$(if \$(quiet),c,v)
469 LDFLAGS = ${LDFLAGS}
470 ASFLAGS = ${ASFLAGS}
471@@ -443,7 +442,13 @@ process_common_cmdline() {
472 disable builtin_libc
473 alt_libc="${optval}"
474 ;;
475- --libc)
476+ --prefix=*)
477+ prefix="${optval}"
478+ ;;
479+ --libdir=*)
480+ libdir="${optval}"
481+ ;;
482+ --libc|--prefix|--libdir)
483 die "Option ${opt} requires argument"
484 ;;
485 --help|-h) show_help
486@@ -464,6 +469,18 @@ process_cmdline() {
487 done
488 }
489
490+
491+post_process_common_cmdline() {
492+ prefix="${prefix:-/usr/local}"
493+ prefix="${prefix%/}"
494+ libdir="${libdir:-${prefix}/lib}"
495+ libdir="${libdir%/}"
496+ if [ "${libdir#${prefix}}" = "${libdir}" ]; then
497+ die "Libdir ${libdir} must be a subdirectory of ${prefix}"
498+ fi
499+}
500+
501+
502 post_process_cmdline() {
503 true;
504 }
505@@ -479,6 +496,42 @@ setup_gnu_toolchain() {
506 }
507
508 process_common_toolchain() {
509+ if [ -z "$toolchain" ]; then
510+ gcctarget="$(gcc -dumpmachine 2> /dev/null)"
511+
512+ # detect tgt_isa
513+ case "$gcctarget" in
514+ *x86_64*|*amd64*)
515+ tgt_isa=x86_64
516+ ;;
517+ *i[3456]86*)
518+ tgt_isa=x86
519+ ;;
520+ esac
521+
522+ # detect tgt_os
523+ case "$gcctarget" in
524+ *darwin8*)
525+ tgt_isa=universal
526+ tgt_os=darwin8
527+ ;;
528+ *darwin9*)
529+ tgt_isa=universal
530+ tgt_os=darwin9
531+ ;;
532+ *mingw32*|*cygwin*)
533+ tgt_os=win32
534+ ;;
535+ *linux*|*bsd*)
536+ tgt_os=linux
537+ ;;
538+ esac
539+
540+ if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
541+ toolchain=${tgt_isa}-${tgt_os}-gcc
542+ fi
543+ fi
544+
545 toolchain=${toolchain:-generic-gnu}
546
547 is_in ${toolchain} ${all_platforms} || enabled force_toolchain \
548@@ -781,6 +834,7 @@ process_common_toolchain() {
549 ;;
550 universal*|*-gcc|generic-gnu)
551 link_with_cc=gcc
552+ enable gcc
553 setup_gnu_toolchain
554 ;;
555 esac
556@@ -844,8 +898,8 @@ process_toolchain() {
557 }
558
559 print_config_mk() {
560- prefix=$1
561- makefile=$2
562+ local prefix=$1
563+ local makefile=$2
564 shift 2
565 for cfg; do
566 upname="`toupper $cfg`"
567@@ -856,8 +910,8 @@ print_config_mk() {
568 }
569
570 print_config_h() {
571- prefix=$1
572- header=$2
573+ local prefix=$1
574+ local header=$2
575 shift 2
576 for cfg; do
577 upname="`toupper $cfg`"
578@@ -888,6 +942,7 @@ process() {
579 else
580 echo "# ${self} $@" > ${logfile}
581 fi
582+ post_process_common_cmdline
583 post_process_cmdline
584 process_toolchain
585 process_detect
586diff --git a/build/make/gen_asm_deps.sh b/build/make/gen_asm_deps.sh
587index c1118e1..2c972e5 100755
588--- a/build/make/gen_asm_deps.sh
589+++ b/build/make/gen_asm_deps.sh
590@@ -2,10 +2,11 @@
591 ##
592 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
593 ##
594-## Use of this source code is governed by a BSD-style license and patent
595-## grant that can be found in the LICENSE file in the root of the source
596-## tree. All contributing project authors may be found in the AUTHORS
597-## file in the root of the source tree.
598+## Use of this source code is governed by a BSD-style license
599+## that can be found in the LICENSE file in the root of the source
600+## tree. An additional intellectual property rights grant can be found
601+## in the file PATENTS. All contributing project authors may
602+## be found in the AUTHORS file in the root of the source tree.
603 ##
604
605
606diff --git a/build/make/gen_msvs_def.sh b/build/make/gen_msvs_def.sh
607index 68b2406..b5c54fd 100755
608--- a/build/make/gen_msvs_def.sh
609+++ b/build/make/gen_msvs_def.sh
610@@ -2,10 +2,11 @@
611 ##
612 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
613 ##
614-## Use of this source code is governed by a BSD-style license and patent
615-## grant that can be found in the LICENSE file in the root of the source
616-## tree. All contributing project authors may be found in the AUTHORS
617-## file in the root of the source tree.
618+## Use of this source code is governed by a BSD-style license
619+## that can be found in the LICENSE file in the root of the source
620+## tree. An additional intellectual property rights grant can be found
621+## in the file PATENTS. All contributing project authors may
622+## be found in the AUTHORS file in the root of the source tree.
623 ##
624
625
626diff --git a/build/make/gen_msvs_proj.sh b/build/make/gen_msvs_proj.sh
627index eb482a4..d94ae4d 100755
628--- a/build/make/gen_msvs_proj.sh
629+++ b/build/make/gen_msvs_proj.sh
630@@ -2,15 +2,17 @@
631 ##
632 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
633 ##
634-## Use of this source code is governed by a BSD-style license and patent
635-## grant that can be found in the LICENSE file in the root of the source
636-## tree. All contributing project authors may be found in the AUTHORS
637-## file in the root of the source tree.
638+## Use of this source code is governed by a BSD-style license
639+## that can be found in the LICENSE file in the root of the source
640+## tree. An additional intellectual property rights grant can be found
641+## in the file PATENTS. All contributing project authors may
642+## be found in the AUTHORS file in the root of the source tree.
643 ##
644
645
646 self=$0
647 self_basename=${self##*/}
648+self_dirname=$(dirname "$0")
649 EOL=$'\n'
650
651 show_help() {
652@@ -291,8 +293,8 @@ case "$target" in
653 x86*)
654 platforms[0]="Win32"
655 # these are only used by vs7
656- asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} \$(InputPath)"
657- asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} \$(InputPath)"
658+ asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
659+ asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
660 ;;
661 arm*|iwmmx*)
662 case "${name}" in
663@@ -342,19 +344,19 @@ generate_vcproj() {
664
665 open_tag ToolFiles
666 case "$target" in
667- x86*) $uses_asm && tag DefaultToolFile FileName="yasm.rules"
668+ x86*) $uses_asm && tag ToolFile RelativePath="$self_dirname/../x86-msvs/yasm.rules"
669 ;;
670 arm*|iwmmx*)
671 if [ "$name" == "vpx_decoder" ];then
672 case "$target" in
673 armv5*)
674- tag DefaultToolFile FileName="armasmv5.rules"
675+ tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmv5.rules"
676 ;;
677 armv6*)
678- tag DefaultToolFile FileName="armasmv6.rules"
679+ tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmv6.rules"
680 ;;
681 iwmmxt*)
682- tag DefaultToolFile FileName="armasmxscale.rules"
683+ tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmxscale.rules"
684 ;;
685 esac
686 fi
687@@ -385,7 +387,7 @@ generate_vcproj() {
688 ExecutionBucket="7" \
689 Optimization="0" \
690 AdditionalIncludeDirectories="$incs" \
691- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
692+ PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
693 MinimalRebuild="true" \
694 RuntimeLibrary="1" \
695 BufferSecurityCheck="false" \
696@@ -404,7 +406,7 @@ generate_vcproj() {
697 ExecutionBucket="7" \
698 Optimization="0" \
699 AdditionalIncludeDirectories="$incs" \
700- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
701+ PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
702 MinimalRebuild="true" \
703 RuntimeLibrary="1" \
704 BufferSecurityCheck="false" \
705@@ -544,7 +546,7 @@ generate_vcproj() {
706 Optimization="2" \
707 FavorSizeOrSpeed="1" \
708 AdditionalIncludeDirectories="$incs" \
709- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
710+ PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
711 RuntimeLibrary="0" \
712 BufferSecurityCheck="false" \
713 UsePrecompiledHeader="0" \
714@@ -563,7 +565,7 @@ generate_vcproj() {
715 Optimization="2" \
716 FavorSizeOrSpeed="1" \
717 AdditionalIncludeDirectories="$incs" \
718- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
719+ PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
720 RuntimeLibrary="0" \
721 BufferSecurityCheck="false" \
722 UsePrecompiledHeader="0" \
723diff --git a/build/make/gen_msvs_sln.sh b/build/make/gen_msvs_sln.sh
724index b670ec5..ef425f5 100755
725--- a/build/make/gen_msvs_sln.sh
726+++ b/build/make/gen_msvs_sln.sh
727@@ -2,10 +2,11 @@
728 ##
729 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
730 ##
731-## Use of this source code is governed by a BSD-style license and patent
732-## grant that can be found in the LICENSE file in the root of the source
733-## tree. All contributing project authors may be found in the AUTHORS
734-## file in the root of the source tree.
735+## Use of this source code is governed by a BSD-style license
736+## that can be found in the LICENSE file in the root of the source
737+## tree. An additional intellectual property rights grant can be found
738+## in the file PATENTS. All contributing project authors may
739+## be found in the AUTHORS file in the root of the source tree.
740 ##
741
742
743diff --git a/build/make/obj_int_extract.c b/build/make/obj_int_extract.c
744index cef14e7..0f64e89 100644
745--- a/build/make/obj_int_extract.c
746+++ b/build/make/obj_int_extract.c
747@@ -1,10 +1,11 @@
748 /*
749 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
750 *
751- * Use of this source code is governed by a BSD-style license and patent
752- * grant that can be found in the LICENSE file in the root of the source
753- * tree. All contributing project authors may be found in the AUTHORS
754- * file in the root of the source tree.
755+ * Use of this source code is governed by a BSD-style license
756+ * that can be found in the LICENSE file in the root of the source
757+ * tree. An additional intellectual property rights grant can be found
758+ * in the file PATENTS. All contributing project authors may
759+ * be found in the AUTHORS file in the root of the source tree.
760 */
761
762
763@@ -16,7 +17,7 @@
764 #if defined(_MSC_VER)
765 #include <io.h>
766 #include <share.h>
767-#include "vpx_ports/vpx_integer.h"
768+#include "vpx/vpx_integer.h"
769 #else
770 #include <stdint.h>
771 #include <unistd.h>
772diff --git a/build/make/version.sh b/build/make/version.sh
773index 2bda701..81682d6 100755
774--- a/build/make/version.sh
775+++ b/build/make/version.sh
776@@ -2,10 +2,11 @@
777 ##
778 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
779 ##
780-## Use of this source code is governed by a BSD-style license and patent
781-## grant that can be found in the LICENSE file in the root of the source
782-## tree. All contributing project authors may be found in the AUTHORS
783-## file in the root of the source tree.
784+## Use of this source code is governed by a BSD-style license
785+## that can be found in the LICENSE file in the root of the source
786+## tree. An additional intellectual property rights grant can be found
787+## in the file PATENTS. All contributing project authors may
788+## be found in the AUTHORS file in the root of the source tree.
789 ##
790
791
792diff --git a/build/x86-msvs/yasm.rules b/build/x86-msvs/yasm.rules
793new file mode 100644
794index 0000000..ee1fefb
795--- /dev/null
796+++ b/build/x86-msvs/yasm.rules
797@@ -0,0 +1,115 @@
798+<?xml version="1.0" encoding="utf-8"?>
799+<VisualStudioToolFile
800+ Name="Yasm"
801+ Version="8.00"
802+ >
803+ <Rules>
804+ <CustomBuildRule
805+ Name="YASM"
806+ DisplayName="Yasm Assembler"
807+ CommandLine="yasm -Xvc -f $(PlatformName) [AllOptions] [AdditionalOptions] [Inputs]"
808+ Outputs="[$ObjectFileName]"
809+ FileExtensions="*.asm"
810+ ExecutionDescription="Assembling $(InputFileName)"
811+ ShowOnlyRuleProperties="false"
812+ >
813+ <Properties>
814+ <StringProperty
815+ Name="Defines"
816+ DisplayName="Definitions"
817+ Category="Pre-Defined Symbols"
818+ Description="Specify pre-defined symbols (&apos;symbol&apos; or &apos;symbol = value&apos;) "
819+ Switch="-D [value]"
820+ Delimited="true"
821+ Inheritable="true"
822+ />
823+ <StringProperty
824+ Name="IncludePaths"
825+ DisplayName="Include Paths"
826+ Category="Configuration"
827+ Description="Set the paths for any additional include files"
828+ Switch="-I [value]"
829+ Delimited="true"
830+ Inheritable="true"
831+ />
832+ <StringProperty
833+ Name="UnDefines"
834+ DisplayName="Remove Definitions"
835+ Category="Pre-Defined Symbols"
836+ Description="Remove pre-defined symbols "
837+ Switch="-U [value]"
838+ Delimited="true"
839+ Inheritable="true"
840+ />
841+ <StringProperty
842+ Name="ObjectFileName"
843+ DisplayName="Object File Name"
844+ Category="Output"
845+ Description="Select the output file name"
846+ Switch="-o [value]"
847+ DefaultValue="$(IntDir)\$(InputName).obj"
848+ />
849+ <StringProperty
850+ Name="ListFileName"
851+ DisplayName="List File Name"
852+ Category="Output"
853+ Description="Select an output listing by setting its file name"
854+ Switch="-l [value]"
855+ />
856+ <StringProperty
857+ Name="PreIncludeFile"
858+ DisplayName="Pre Include File"
859+ Category="Configuration"
860+ Description="Select a pre-included file by setting its name"
861+ Switch="-P [value]"
862+ />
863+ <BooleanProperty
864+ Name="Debug"
865+ DisplayName="Debug Information"
866+ Category="Output"
867+ Description="Generate debugging information"
868+ Switch="-g cv8"
869+ />
870+ <EnumProperty
871+ Name="PreProc"
872+ DisplayName="Pre-Processor"
873+ Category="Configuration"
874+ Description="Select the pre-processor (&apos;nasm&apos; or &apos;raw&apos;)"
875+ >
876+ <Values>
877+ <EnumValue
878+ Value="0"
879+ Switch="-rnasm"
880+ DisplayName="Nasm "
881+ />
882+ <EnumValue
883+ Value="1"
884+ Switch="-rraw"
885+ DisplayName="Raw"
886+ />
887+ </Values>
888+ </EnumProperty>
889+ <EnumProperty
890+ Name="Parser"
891+ DisplayName="Parser"
892+ Category="Configuration"
893+ Description="Select the parser for Intel (&apos;nasm&apos;) or AT&amp;T ( &apos;gas&apos;) syntax"
894+ >
895+ <Values>
896+ <EnumValue
897+ Value="0"
898+ Switch="-pnasm"
899+ DisplayName="Nasm"
900+ />
901+ <EnumValue
902+ Value="1"
903+ Switch="-pgas"
904+ DisplayName="Gas"
905+ />
906+ </Values>
907+ </EnumProperty>
908+ </Properties>
909+ </CustomBuildRule>
910+ </Rules>
911+</VisualStudioToolFile>
912+
913diff --git a/configure b/configure
914index 3083343..9a3269a 100755
915--- a/configure
916+++ b/configure
917@@ -1,13 +1,16 @@
918 #!/bin/bash
919 ##
920-## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
921+## configure
922 ##
923-## Use of this source code is governed by a BSD-style license and patent
924-## grant that can be found in the LICENSE file in the root of the source
925-## tree. All contributing project authors may be found in the AUTHORS
926-## file in the root of the source tree.
927+## This script is the front-end to the build system. It provides a similar
928+## interface to standard configure scripts with some extra bits for dealing
929+## with toolchains that differ from the standard POSIX interface and
930+## for extracting subsets of the source tree. In theory, reusable parts
931+## of this script were intended to live in build/make/configure.sh,
932+## but in practice, the line is pretty blurry.
933+##
934+## This build system is based in part on the FFmpeg configure script.
935 ##
936-
937
938 #source_path="`dirname \"$0\"`"
939 source_path=${0%/*}
940@@ -24,18 +27,17 @@ Advanced options:
941 supported by hardware [auto]
942 ${toggle_codec_srcs} in/exclude codec library source code
943 ${toggle_debug_libs} in/exclude debug version of libraries
944- ${toggle_eval_limit} enable limited evaluation build
945 ${toggle_md5} support for output of checksum data
946 ${toggle_static_msvcrt} use static MSVCRT (VS builds only)
947 ${toggle_vp8} VP8 codec support
948 ${toggle_psnr} output of PSNR data, if supported (encoders)
949 ${toggle_mem_tracker} track memory usage
950- ${toggle_eval_limit} decoder limitted to 500 frames
951 ${toggle_postproc} postprocessing
952 ${toggle_multithread} multithreaded encoding and decoding.
953 ${toggle_spatial_resampling} spatial sampling (scaling) support
954 ${toggle_realtime_only} enable this option while building for real-time encoding
955 ${toggle_runtime_cpu_detect} runtime cpu detection
956+ ${toggle_shared} shared library support
957
958 Codecs:
959 Codecs can be selectively enabled or disabled individually, or by family:
960@@ -135,11 +137,12 @@ if [ ${doxy_major:-0} -ge 1 ]; then
961 [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen
962 fi
963
964-# install everything, by default
965+# install everything except the sources, by default. sources will have
966+# to be enabled when doing dist builds, since that's no longer a common
967+# case.
968 enabled doxygen && php -v >/dev/null 2>&1 && enable install_docs
969 enable install_bins
970 enable install_libs
971-enable install_srcs
972
973 enable optimizations
974 enable fast_unaligned #allow unaligned accesses, if supported by hw
975@@ -157,8 +160,8 @@ if ! enabled alt_tree_layout; then
976 [ -d ${source_path}/vp8 ] && CODECS="${CODECS} vp8_encoder vp8_decoder"
977 else
978 # customer environment
979-[ -f ${source_path}/../include/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
980-[ -f ${source_path}/../include/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
981+[ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
982+[ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
983
984 [ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt
985 fi
986@@ -225,7 +228,6 @@ CONFIG_LIST="
987 dequant_tokens
988 dc_recon
989 new_tokens
990- eval_limit
991 runtime_cpu_detect
992 postproc
993 postproc_generic
994@@ -238,6 +240,7 @@ CONFIG_LIST="
995 static_msvcrt
996 spatial_resampling
997 realtime_only
998+ shared
999 "
1000 CMDLINE_SELECT="
1001 extra_warnings
1002@@ -265,7 +268,6 @@ CMDLINE_SELECT="
1003 dequant_tokens
1004 dc_recon
1005 new_tokens
1006- eval_limit
1007 postproc
1008 postproc_generic
1009 multithread
1010@@ -276,6 +278,7 @@ CMDLINE_SELECT="
1011 mem_tracker
1012 spatial_resampling
1013 realtime_only
1014+ shared
1015 "
1016
1017 process_cmdline() {
1018@@ -354,7 +357,6 @@ process_targets() {
1019 enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
1020 ! enabled postproc && DIST_DIR="${DIST_DIR}-nopost"
1021 ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
1022- enabled eval_limit && DIST_DIR="${DIST_DIR}-eval"
1023 ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
1024 DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
1025 case "${tgt_os}" in
1026@@ -365,8 +367,26 @@ process_targets() {
1027 if [ -f "${source_path}/build/make/version.sh" ]; then
1028 local ver=`"$source_path/build/make/version.sh" --bare $source_path`
1029 DIST_DIR="${DIST_DIR}-${ver}"
1030+ ver=${ver%%-*}
1031+ VERSION_PATCH=${ver##*.}
1032+ ver=${ver%.*}
1033+ VERSION_MINOR=${ver##*.}
1034+ ver=${ver#v}
1035+ VERSION_MAJOR=${ver%.*}
1036 fi
1037- enabled child || echo "DIST_DIR?=${DIST_DIR}" >> config.mk
1038+ enabled child || cat <<EOF >> config.mk
1039+ifeq (\$(MAKECMDGOALS),dist)
1040+DIST_DIR?=${DIST_DIR}
1041+else
1042+DIST_DIR?=\$(DESTDIR)${prefix}
1043+endif
1044+LIBSUBDIR=${libdir##${prefix}/}
1045+
1046+VERSION_MAJOR=${VERSION_MAJOR}
1047+VERSION_MINOR=${VERSION_MINOR}
1048+VERSION_PATCH=${VERSION_PATCH}
1049+
1050+EOF
1051 enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
1052
1053 #
1054@@ -385,6 +405,12 @@ process_targets() {
1055 }
1056
1057 process_detect() {
1058+ if enabled shared; then
1059+ # Can only build shared libs on a subset of platforms. Doing this check
1060+ # here rather than at option parse time because the target auto-detect
1061+ # magic happens after the command line has been parsed.
1062+ enabled linux || die "--enable-shared only supported on ELF for now"
1063+ fi
1064 if [ -z "$CC" ]; then
1065 echo "Bypassing toolchain for environment detection."
1066 enable external_build
1067@@ -419,7 +445,7 @@ EOF
1068 check_header pthread.h
1069 check_header sys/mman.h
1070
1071- check_header vpx_ports/vpx_integer.h -I${source_path} && enable vpx_ports
1072+ check_header vpx/vpx_integer.h -I${source_path} && enable vpx_ports
1073 }
1074
1075 process_toolchain() {
1076diff --git a/docs.mk b/docs.mk
1077index 3e7b5cd..f60a482 100644
1078--- a/docs.mk
1079+++ b/docs.mk
1080@@ -1,10 +1,11 @@
1081 ##
1082 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1083 ##
1084-## Use of this source code is governed by a BSD-style license and patent
1085-## grant that can be found in the LICENSE file in the root of the source
1086-## tree. All contributing project authors may be found in the AUTHORS
1087-## file in the root of the source tree.
1088+## Use of this source code is governed by a BSD-style license
1089+## that can be found in the LICENSE file in the root of the source
1090+## tree. An additional intellectual property rights grant can be found
1091+## in the file PATENTS. All contributing project authors may
1092+## be found in the AUTHORS file in the root of the source tree.
1093 ##
1094
1095
1096@@ -47,8 +48,8 @@ docs/html/index.html: doxyfile $(CODEC_DOX) $(TXT_DOX)
1097 @doxygen $<
1098 DOCS-yes += docs/html/index.html
1099
1100-INSTALL-DOCS-yes = $(wildcard docs/html/*)
1101-INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX))
1102-INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template
1103-INSTALL-DOCS-yes += CHANGELOG
1104-INSTALL-DOCS-yes += README
1105+DIST-DOCS-yes = $(wildcard docs/html/*)
1106+DIST-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX))
1107+DIST-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template
1108+DIST-DOCS-yes += CHANGELOG
1109+DIST-DOCS-yes += README
1110diff --git a/example_xma.c b/example_xma.c
1111index cc4e591..e5eca7a 100644
1112--- a/example_xma.c
1113+++ b/example_xma.c
1114@@ -1,10 +1,11 @@
1115 /*
1116 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1117 *
1118- * Use of this source code is governed by a BSD-style license and patent
1119- * grant that can be found in the LICENSE file in the root of the source
1120- * tree. All contributing project authors may be found in the AUTHORS
1121- * file in the root of the source tree.
1122+ * Use of this source code is governed by a BSD-style license
1123+ * that can be found in the LICENSE file in the root of the source
1124+ * tree. An additional intellectual property rights grant can be found
1125+ * in the file PATENTS. All contributing project authors may
1126+ * be found in the AUTHORS file in the root of the source tree.
1127 */
1128
1129
1130@@ -15,10 +16,10 @@
1131 #include <string.h>
1132 #define VPX_CODEC_DISABLE_COMPAT 1
1133 #include "vpx_config.h"
1134-#include "vpx_decoder.h"
1135-#include "vpx_integer.h"
1136+#include "vpx/vpx_decoder.h"
1137+#include "vpx/vpx_integer.h"
1138 #if CONFIG_VP8_DECODER
1139-#include "vp8dx.h"
1140+#include "vpx/vp8dx.h"
1141 #endif
1142
1143 static char *exec_name;
1144diff --git a/examples.mk b/examples.mk
1145index 036a423..bca0d9c 100644
1146--- a/examples.mk
1147+++ b/examples.mk
1148@@ -1,10 +1,11 @@
1149 ##
1150 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1151 ##
1152-## Use of this source code is governed by a BSD-style license and patent
1153-## grant that can be found in the LICENSE file in the root of the source
1154-## tree. All contributing project authors may be found in the AUTHORS
1155-## file in the root of the source tree.
1156+## Use of this source code is governed by a BSD-style license
1157+## that can be found in the LICENSE file in the root of the source
1158+## tree. An additional intellectual property rights grant can be found
1159+## in the file PATENTS. All contributing project authors may
1160+## be found in the AUTHORS file in the root of the source tree.
1161 ##
1162
1163
1164@@ -14,18 +15,21 @@
1165 UTILS-$(CONFIG_DECODERS) += ivfdec.c
1166 ivfdec.SRCS += md5_utils.c md5_utils.h
1167 ivfdec.SRCS += vpx_ports/vpx_timer.h
1168-ivfdec.SRCS += vpx_ports/vpx_integer.h
1169+ivfdec.SRCS += vpx/vpx_integer.h
1170 ivfdec.SRCS += args.c args.h vpx_ports/config.h
1171 ivfdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
1172 ivfdec.DESCRIPTION = Full featured decoder
1173 UTILS-$(CONFIG_ENCODERS) += ivfenc.c
1174-ivfenc.SRCS += args.c args.h vpx_ports/config.h
1175-ivfenc.SRCS += vpx_ports/mem_ops.h vpx_ports/mem_ops_aligned.h
1176+ivfenc.SRCS += args.c args.h y4minput.c y4minput.h
1177+ivfenc.SRCS += vpx_ports/config.h vpx_ports/mem_ops.h
1178+ivfenc.SRCS += vpx_ports/mem_ops_aligned.h
1179 ivfenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
1180 ivfenc.DESCRIPTION = Full featured encoder
1181-UTILS-$(CONFIG_DECODERS) += example_xma.c
1182-example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022
1183-example_xma.DESCRIPTION = External Memory Allocation mode usage
1184+
1185+# XMA example disabled for now, not used in VP8
1186+#UTILS-$(CONFIG_DECODERS) += example_xma.c
1187+#example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022
1188+#example_xma.DESCRIPTION = External Memory Allocation mode usage
1189
1190 GEN_EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
1191 simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
1192@@ -84,8 +88,6 @@ ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
1193 INC_PATH := $(SRC_PATH_BARE)/../include
1194 else
1195 LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
1196- INC_PATH-yes += $(SRC_PATH_BARE)/vpx_codec
1197- INC_PATH-yes += $(SRC_PATH_BARE)/vpx_ports
1198 INC_PATH-$(CONFIG_VP8_DECODER) += $(SRC_PATH_BARE)/vp8
1199 INC_PATH-$(CONFIG_VP8_ENCODER) += $(SRC_PATH_BARE)/vp8
1200 LIB_PATH := $(call enabled,LIB_PATH)
1201@@ -99,6 +101,7 @@ LDFLAGS += $(addprefix -L,$(LIB_PATH))
1202 UTILS = $(call enabled,UTILS)
1203 GEN_EXAMPLES = $(call enabled,GEN_EXAMPLES)
1204 ALL_EXAMPLES = $(UTILS) $(GEN_EXAMPLES)
1205+UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
1206 ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS))
1207 CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
1208
1209@@ -120,8 +123,10 @@ $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes)
1210 # Create build/install dependencies for all examples. The common case
1211 # is handled here. The MSVS case is handled below.
1212 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
1213-INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
1214-INSTALL-SRCS-yes += $(ALL_SRCS)
1215+DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
1216+INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=))
1217+DIST-SRCS-yes += $(ALL_SRCS)
1218+INSTALL-SRCS-yes += $(UTIL_SRCS)
1219 OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
1220 BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=))
1221
1222diff --git a/examples/decode_to_md5.txt b/examples/decode_to_md5.txt
1223index 0599b13..b3dd568 100644
1224--- a/examples/decode_to_md5.txt
1225+++ b/examples/decode_to_md5.txt
1226@@ -26,21 +26,21 @@ is processed, then U, then V. It is important to honor the image's `stride`
1227 values.
1228 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX
1229 unsigned char md5_sum[16];
1230-md5_ctx_t md5;
1231+MD5Context md5;
1232 int i;
1233
1234-md5_init(&md5);
1235+MD5Init(&md5);
1236
1237 for(plane=0; plane < 3; plane++) {
1238 unsigned char *buf =img->planes[plane];
1239
1240 for(y=0; y<img->d_h >> (plane?1:0); y++) {
1241- md5_update(&md5, buf, img->d_w >> (plane?1:0));
1242+ MD5Update(&md5, buf, img->d_w >> (plane?1:0));
1243 buf += img->stride[plane];
1244 }
1245 }
1246
1247-md5_finalize(&md5, md5_sum);
1248+MD5Final(md5_sum, &md5);
1249 for(i=0; i<16; i++)
1250 fprintf(outfile, "%02x",md5_sum[i]);
1251 fprintf(outfile, " img-%dx%d-%04d.i420\n", img->d_w, img->d_h,
1252diff --git a/examples/decoder_tmpl.c b/examples/decoder_tmpl.c
1253index deea449..826ad20 100644
1254--- a/examples/decoder_tmpl.c
1255+++ b/examples/decoder_tmpl.c
1256@@ -1,10 +1,11 @@
1257 /*
1258 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1259 *
1260- * Use of this source code is governed by a BSD-style license and patent
1261- * grant that can be found in the LICENSE file in the root of the source
1262- * tree. All contributing project authors may be found in the AUTHORS
1263- * file in the root of the source tree.
1264+ * Use of this source code is governed by a BSD-style license
1265+ * that can be found in the LICENSE file in the root of the source
1266+ * tree. An additional intellectual property rights grant can be found
1267+ * in the file PATENTS. All contributing project authors may
1268+ * be found in the AUTHORS file in the root of the source tree.
1269 */
1270
1271
1272@@ -16,11 +17,9 @@
1273 #include <stdarg.h>
1274 #include <string.h>
1275 #define VPX_CODEC_DISABLE_COMPAT 1
1276-#include "vpx_decoder.h"
1277-#if CONFIG_VP8_DECODER && !defined(interface)
1278-#include "vp8dx.h"
1279+#include "vpx/vpx_decoder.h"
1280+#include "vpx/vp8dx.h"
1281 #define interface (&vpx_codec_vp8_dx_algo)
1282-#endif
1283 @EXTRA_INCLUDES
1284
1285
1286diff --git a/examples/decoder_tmpl.txt b/examples/decoder_tmpl.txt
1287index 3287d50..6da38c2 100644
1288--- a/examples/decoder_tmpl.txt
1289+++ b/examples/decoder_tmpl.txt
1290@@ -1,7 +1,7 @@
1291 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INCLUDES
1292 #define VPX_CODEC_DISABLE_COMPAT 1
1293-#include "vpx_decoder.h"
1294-#include "vp8dx.h"
1295+#include "vpx/vpx_decoder.h"
1296+#include "vpx/vp8dx.h"
1297 #define interface (&vpx_codec_vp8_dx_algo)
1298 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INCLUDES
1299
1300diff --git a/examples/encoder_tmpl.c b/examples/encoder_tmpl.c
1301index 2df893a..9e262e9 100644
1302--- a/examples/encoder_tmpl.c
1303+++ b/examples/encoder_tmpl.c
1304@@ -1,10 +1,11 @@
1305 /*
1306 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1307 *
1308- * Use of this source code is governed by a BSD-style license and patent
1309- * grant that can be found in the LICENSE file in the root of the source
1310- * tree. All contributing project authors may be found in the AUTHORS
1311- * file in the root of the source tree.
1312+ * Use of this source code is governed by a BSD-style license
1313+ * that can be found in the LICENSE file in the root of the source
1314+ * tree. An additional intellectual property rights grant can be found
1315+ * in the file PATENTS. All contributing project authors may
1316+ * be found in the AUTHORS file in the root of the source tree.
1317 */
1318
1319
1320@@ -16,12 +17,10 @@
1321 #include <stdarg.h>
1322 #include <string.h>
1323 #define VPX_CODEC_DISABLE_COMPAT 1
1324-#include "vpx_encoder.h"
1325-#if CONFIG_VP8_ENCODER && !defined(interface)
1326-#include "vp8cx.h"
1327+#include "vpx/vpx_encoder.h"
1328+#include "vpx/vp8cx.h"
1329 #define interface (&vpx_codec_vp8_cx_algo)
1330 #define fourcc 0x30385056
1331-#endif
1332 @EXTRA_INCLUDES
1333
1334 #define IVF_FILE_HDR_SZ (32)
1335@@ -129,7 +128,7 @@ int main(int argc, char **argv) {
1336 height = strtol(argv[2], NULL, 0);
1337 if(width < 16 || width%2 || height <16 || height%2)
1338 die("Invalid resolution: %ldx%ld", width, height);
1339- if(!vpx_img_alloc(&raw, IMG_FMT_YV12, width, height, 1))
1340+ if(!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 1))
1341 die("Faile to allocate image", width, height);
1342 if(!(outfile = fopen(argv[4], "wb")))
1343 die("Failed to open %s for writing", argv[4]);
1344diff --git a/examples/encoder_tmpl.txt b/examples/encoder_tmpl.txt
1345index db1ea77..87055ca 100644
1346--- a/examples/encoder_tmpl.txt
1347+++ b/examples/encoder_tmpl.txt
1348@@ -1,7 +1,7 @@
1349 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INCLUDES
1350 #define VPX_CODEC_DISABLE_COMPAT 1
1351-#include "vpx_encoder.h"
1352-#include "vp8cx.h"
1353+#include "vpx/vpx_encoder.h"
1354+#include "vpx/vp8cx.h"
1355 #define interface (&vpx_codec_vp8_cx_algo)
1356 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INCLUDES
1357
1358diff --git a/examples/gen_example_code.sh b/examples/gen_example_code.sh
1359index f2e45c5..dc7ad72 100755
1360--- a/examples/gen_example_code.sh
1361+++ b/examples/gen_example_code.sh
1362@@ -2,10 +2,11 @@
1363 ##
1364 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1365 ##
1366-## Use of this source code is governed by a BSD-style license and patent
1367-## grant that can be found in the LICENSE file in the root of the source
1368-## tree. All contributing project authors may be found in the AUTHORS
1369-## file in the root of the source tree.
1370+## Use of this source code is governed by a BSD-style license
1371+## that can be found in the LICENSE file in the root of the source
1372+## tree. An additional intellectual property rights grant can be found
1373+## in the file PATENTS. All contributing project authors may
1374+## be found in the AUTHORS file in the root of the source tree.
1375 ##
1376
1377
1378diff --git a/examples/gen_example_doxy.php b/examples/gen_example_doxy.php
1379index 08beade..ba2617f 100755
1380--- a/examples/gen_example_doxy.php
1381+++ b/examples/gen_example_doxy.php
1382@@ -2,10 +2,11 @@
1383 /*
1384 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1385 *
1386- * Use of this source code is governed by a BSD-style license and patent
1387- * grant that can be found in the LICENSE file in the root of the source
1388- * tree. All contributing project authors may be found in the AUTHORS
1389- * file in the root of the source tree.
1390+ * Use of this source code is governed by a BSD-style license
1391+ * that can be found in the LICENSE file in the root of the source
1392+ * tree. An additional intellectual property rights grant can be found
1393+ * in the file PATENTS. All contributing project authors may
1394+ * be found in the AUTHORS file in the root of the source tree.
1395 */
1396
1397
1398diff --git a/examples/gen_example_text.sh b/examples/gen_example_text.sh
1399index 0e1f796..fcc73d8 100755
1400--- a/examples/gen_example_text.sh
1401+++ b/examples/gen_example_text.sh
1402@@ -2,10 +2,11 @@
1403 ##
1404 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
1405 ##
1406-## Use of this source code is governed by a BSD-style license and patent
1407-## grant that can be found in the LICENSE file in the root of the source
1408-## tree. All contributing project authors may be found in the AUTHORS
1409-## file in the root of the source tree.
1410+## Use of this source code is governed by a BSD-style license
1411+## that can be found in the LICENSE file in the root of the source
1412+## tree. An additional intellectual property rights grant can be found
1413+## in the file PATENTS. All contributing project authors may
1414+## be found in the AUTHORS file in the root of the source tree.
1415 ##
1416
1417
1418diff --git a/examples/includes/PHP-Markdown-Extra-1.2.3/markdown.php.orig b/examples/includes/PHP-Markdown-Extra-1.2.3/markdown.php.orig
1419deleted file mode 100644
1420index b0ed7c9..0000000
1421--- a/examples/includes/PHP-Markdown-Extra-1.2.3/markdown.php.orig
1422+++ /dev/null
1423@@ -1,2909 +0,0 @@
1424-<?php
1425-#
1426-# Markdown Extra - A text-to-HTML conversion tool for web writers
1427-#
1428-# PHP Markdown & Extra
1429-# Copyright (c) 2004-2008 Michel Fortin
1430-# <http://www.michelf.com/projects/php-markdown/>
1431-#
1432-# Original Markdown
1433-# Copyright (c) 2004-2006 John Gruber
1434-# <http://daringfireball.net/projects/markdown/>
1435-#
1436-
1437-
1438-define( 'MARKDOWN_VERSION', "1.0.1m" ); # Sat 21 Jun 2008
1439-define( 'MARKDOWNEXTRA_VERSION', "1.2.3" ); # Wed 31 Dec 2008
1440-
1441-
1442-#
1443-# Global default settings:
1444-#
1445-
1446-# Change to ">" for HTML output
1447-@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX', " />");
1448-
1449-# Define the width of a tab for code blocks.
1450-@define( 'MARKDOWN_TAB_WIDTH', 4 );
1451-
1452-# Optional title attribute for footnote links and backlinks.
1453-@define( 'MARKDOWN_FN_LINK_TITLE', "" );
1454-@define( 'MARKDOWN_FN_BACKLINK_TITLE', "" );
1455-
1456-# Optional class attribute for footnote links and backlinks.
1457-@define( 'MARKDOWN_FN_LINK_CLASS', "" );
1458-@define( 'MARKDOWN_FN_BACKLINK_CLASS', "" );
1459-
1460-
1461-#
1462-# WordPress settings:
1463-#
1464-
1465-# Change to false to remove Markdown from posts and/or comments.
1466-@define( 'MARKDOWN_WP_POSTS', true );
1467-@define( 'MARKDOWN_WP_COMMENTS', true );
1468-
1469-
1470-
1471-### Standard Function Interface ###
1472-
1473-@define( 'MARKDOWN_PARSER_CLASS', 'MarkdownExtra_Parser' );
1474-
1475-function Markdown($text) {
1476-#
1477-# Initialize the parser and return the result of its transform method.
1478-#
1479- # Setup static parser variable.
1480- static $parser;
1481- if (!isset($parser)) {
1482- $parser_class = MARKDOWN_PARSER_CLASS;
1483- $parser = new $parser_class;
1484- }
1485-
1486- # Transform text using parser.
1487- return $parser->transform($text);
1488-}
1489-
1490-
1491-### WordPress Plugin Interface ###
1492-
1493-/*
1494-Plugin Name: Markdown Extra
1495-Plugin URI: http://www.michelf.com/projects/php-markdown/
1496-Description: <a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://www.michelf.com/projects/php-markdown/">More...</a>
1497-Version: 1.2.2
1498-Author: Michel Fortin
1499-Author URI: http://www.michelf.com/
1500-*/
1501-
1502-if (isset($wp_version)) {
1503- # More details about how it works here:
1504- # <http://www.michelf.com/weblog/2005/wordpress-text-flow-vs-markdown/>
1505-
1506- # Post content and excerpts
1507- # - Remove WordPress paragraph generator.
1508- # - Run Markdown on excerpt, then remove all tags.
1509- # - Add paragraph tag around the excerpt, but remove it for the excerpt rss.
1510- if (MARKDOWN_WP_POSTS) {
1511- remove_filter('the_content', 'wpautop');
1512- remove_filter('the_content_rss', 'wpautop');
1513- remove_filter('the_excerpt', 'wpautop');
1514- add_filter('the_content', 'mdwp_MarkdownPost', 6);
1515- add_filter('the_content_rss', 'mdwp_MarkdownPost', 6);
1516- add_filter('get_the_excerpt', 'mdwp_MarkdownPost', 6);
1517- add_filter('get_the_excerpt', 'trim', 7);
1518- add_filter('the_excerpt', 'mdwp_add_p');
1519- add_filter('the_excerpt_rss', 'mdwp_strip_p');
1520-
1521- remove_filter('content_save_pre', 'balanceTags', 50);
1522- remove_filter('excerpt_save_pre', 'balanceTags', 50);
1523- add_filter('the_content', 'balanceTags', 50);
1524- add_filter('get_the_excerpt', 'balanceTags', 9);
1525- }
1526-
1527- # Add a footnote id prefix to posts when inside a loop.
1528- function mdwp_MarkdownPost($text) {
1529- static $parser;
1530- if (!$parser) {
1531- $parser_class = MARKDOWN_PARSER_CLASS;
1532- $parser = new $parser_class;
1533- }
1534- if (is_single() || is_page() || is_feed()) {
1535- $parser->fn_id_prefix = "";
1536- } else {
1537- $parser->fn_id_prefix = get_the_ID() . ".";
1538- }
1539- return $parser->transform($text);
1540- }
1541-
1542- # Comments
1543- # - Remove WordPress paragraph generator.
1544- # - Remove WordPress auto-link generator.
1545- # - Scramble important tags before passing them to the kses filter.
1546- # - Run Markdown on excerpt then remove paragraph tags.
1547- if (MARKDOWN_WP_COMMENTS) {
1548- remove_filter('comment_text', 'wpautop', 30);
1549- remove_filter('comment_text', 'make_clickable');
1550- add_filter('pre_comment_content', 'Markdown', 6);
1551- add_filter('pre_comment_content', 'mdwp_hide_tags', 8);
1552- add_filter('pre_comment_content', 'mdwp_show_tags', 12);
1553- add_filter('get_comment_text', 'Markdown', 6);
1554- add_filter('get_comment_excerpt', 'Markdown', 6);
1555- add_filter('get_comment_excerpt', 'mdwp_strip_p', 7);
1556-
1557- global $mdwp_hidden_tags, $mdwp_placeholders;
1558- $mdwp_hidden_tags = explode(' ',
1559- '<p> </p> <pre> </pre> <ol> </ol> <ul> </ul> <li> </li>');
1560- $mdwp_placeholders = explode(' ', str_rot13(
1561- 'pEj07ZbbBZ U1kqgh4w4p pre2zmeN6K QTi31t9pre ol0MP1jzJR '.
1562- 'ML5IjmbRol ulANi1NsGY J7zRLJqPul liA8ctl16T K9nhooUHli'));
1563- }
1564-
1565- function mdwp_add_p($text) {
1566- if (!preg_match('{^$|^<(p|ul|ol|dl|pre|blockquote)>}i', $text)) {
1567- $text = '<p>'.$text.'</p>';
1568- $text = preg_replace('{\n{2,}}', "</p>\n\n<p>", $text);
1569- }
1570- return $text;
1571- }
1572-
1573- function mdwp_strip_p($t) { return preg_replace('{</?p>}i', '', $t); }
1574-
1575- function mdwp_hide_tags($text) {
1576- global $mdwp_hidden_tags, $mdwp_placeholders;
1577- return str_replace($mdwp_hidden_tags, $mdwp_placeholders, $text);
1578- }
1579- function mdwp_show_tags($text) {
1580- global $mdwp_hidden_tags, $mdwp_placeholders;
1581- return str_replace($mdwp_placeholders, $mdwp_hidden_tags, $text);
1582- }
1583-}
1584-
1585-
1586-### bBlog Plugin Info ###
1587-
1588-function identify_modifier_markdown() {
1589- return array(
1590- 'name' => 'markdown',
1591- 'type' => 'modifier',
1592- 'nicename' => 'PHP Markdown Extra',
1593- 'description' => 'A text-to-HTML conversion tool for web writers',
1594- 'authors' => 'Michel Fortin and John Gruber',
1595- 'licence' => 'GPL',
1596- 'version' => MARKDOWNEXTRA_VERSION,
1597- 'help' => '<a href="http://daringfireball.net/projects/markdown/syntax">Markdown syntax</a> allows you to write using an easy-to-read, easy-to-write plain text format. Based on the original Perl version by <a href="http://daringfireball.net/">John Gruber</a>. <a href="http://www.michelf.com/projects/php-markdown/">More...</a>',
1598- );
1599-}
1600-
1601-
1602-### Smarty Modifier Interface ###
1603-
1604-function smarty_modifier_markdown($text) {
1605- return Markdown($text);
1606-}
1607-
1608-
1609-### Textile Compatibility Mode ###
1610-
1611-# Rename this file to "classTextile.php" and it can replace Textile everywhere.
1612-
1613-if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
1614- # Try to include PHP SmartyPants. Should be in the same directory.
1615- @include_once 'smartypants.php';
1616- # Fake Textile class. It calls Markdown instead.
1617- class Textile {
1618- function TextileThis($text, $lite='', $encode='') {
1619- if ($lite == '' && $encode == '') $text = Markdown($text);
1620- if (function_exists('SmartyPants')) $text = SmartyPants($text);
1621- return $text;
1622- }
1623- # Fake restricted version: restrictions are not supported for now.
1624- function TextileRestricted($text, $lite='', $noimage='') {
1625- return $this->TextileThis($text, $lite);
1626- }
1627- # Workaround to ensure compatibility with TextPattern 4.0.3.
1628- function blockLite($text) { return $text; }
1629- }
1630-}
1631-
1632-
1633-
1634-#
1635-# Markdown Parser Class
1636-#
1637-
1638-class Markdown_Parser {
1639-
1640- # Regex to match balanced [brackets].
1641- # Needed to insert a maximum bracked depth while converting to PHP.
1642- var $nested_brackets_depth = 6;
1643- var $nested_brackets_re;
1644-
1645- var $nested_url_parenthesis_depth = 4;
1646- var $nested_url_parenthesis_re;
1647-
1648- # Table of hash values for escaped characters:
1649- var $escape_chars = '\`*_{}[]()>#+-.!';
1650- var $escape_chars_re;
1651-
1652- # Change to ">" for HTML output.
1653- var $empty_element_suffix = MARKDOWN_EMPTY_ELEMENT_SUFFIX;
1654- var $tab_width = MARKDOWN_TAB_WIDTH;
1655-
1656- # Change to `true` to disallow markup or entities.
1657- var $no_markup = false;
1658- var $no_entities = true;
1659-
1660- # Predefined urls and titles for reference links and images.
1661- var $predef_urls = array();
1662- var $predef_titles = array();
1663-
1664-
1665- function Markdown_Parser() {
1666- #
1667- # Constructor function. Initialize appropriate member variables.
1668- #
1669- $this->_initDetab();
1670- $this->prepareItalicsAndBold();
1671-
1672- $this->nested_brackets_re =
1673- str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
1674- str_repeat('\])*', $this->nested_brackets_depth);
1675-
1676- $this->nested_url_parenthesis_re =
1677- str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
1678- str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
1679-
1680- $this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
1681-
1682- # Sort document, block, and span gamut in ascendent priority order.
1683- asort($this->document_gamut);
1684- asort($this->block_gamut);
1685- asort($this->span_gamut);
1686- }
1687-
1688-
1689- # Internal hashes used during transformation.
1690- var $urls = array();
1691- var $titles = array();
1692- var $html_hashes = array();
1693-
1694- # Status flag to avoid invalid nesting.
1695- var $in_anchor = false;
1696-
1697-
1698- function setup() {
1699- #
1700- # Called before the transformation process starts to setup parser
1701- # states.
1702- #
1703- # Clear global hashes.
1704- $this->urls = $this->predef_urls;
1705- $this->titles = $this->predef_titles;
1706- $this->html_hashes = array();
1707-
1708- $in_anchor = false;
1709- }
1710-
1711- function teardown() {
1712- #
1713- # Called after the transformation process to clear any variable
1714- # which may be taking up memory unnecessarly.
1715- #
1716- $this->urls = array();
1717- $this->titles = array();
1718- $this->html_hashes = array();
1719- }
1720-
1721-
1722- function transform($text) {
1723- #
1724- # Main function. Performs some preprocessing on the input text
1725- # and pass it through the document gamut.
1726- #
1727- $this->setup();
1728-
1729- # Remove UTF-8 BOM and marker character in input, if present.
1730- $text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
1731-
1732- # Standardize line endings:
1733- # DOS to Unix and Mac to Unix
1734- $text = preg_replace('{\r\n?}', "\n", $text);
1735-
1736- # Make sure $text ends with a couple of newlines:
1737- $text .= "\n\n";
1738-
1739- # Convert all tabs to spaces.
1740- $text = $this->detab($text);
1741-
1742- # Turn block-level HTML blocks into hash entries
1743- $text = $this->hashHTMLBlocks($text);
1744-
1745- # Strip any lines consisting only of spaces and tabs.
1746- # This makes subsequent regexen easier to write, because we can
1747- # match consecutive blank lines with /\n+/ instead of something
1748- # contorted like /[ ]*\n+/ .
1749- $text = preg_replace('/^[ ]+$/m', '', $text);
1750-
1751- # Run document gamut methods.
1752- foreach ($this->document_gamut as $method => $priority) {
1753- $text = $this->$method($text);
1754- }
1755-
1756- $this->teardown();
1757-
1758- return $text . "\n";
1759- }
1760-
1761- var $document_gamut = array(
1762- # Strip link definitions, store in hashes.
1763- "stripLinkDefinitions" => 20,
1764-
1765- "runBasicBlockGamut" => 30,
1766- );
1767-
1768-
1769- function stripLinkDefinitions($text) {
1770- #
1771- # Strips link definitions from text, stores the URLs and titles in
1772- # hash references.
1773- #
1774- $less_than_tab = $this->tab_width - 1;
1775-
1776- # Link defs are in the form: ^[id]: url "optional title"
1777- $text = preg_replace_callback('{
1778- ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1
1779- [ ]*
1780- \n? # maybe *one* newline
1781- [ ]*
1782- <?(\S+?)>? # url = $2
1783- [ ]*
1784- \n? # maybe one newline
1785- [ ]*
1786- (?:
1787- (?<=\s) # lookbehind for whitespace
1788- ["(]
1789- (.*?) # title = $3
1790- [")]
1791- [ ]*
1792- )? # title is optional
1793- (?:\n+|\Z)
1794- }xm',
1795- array(&$this, '_stripLinkDefinitions_callback'),
1796- $text);
1797- return $text;
1798- }
1799- function _stripLinkDefinitions_callback($matches) {
1800- $link_id = strtolower($matches[1]);
1801- $this->urls[$link_id] = $matches[2];
1802- $this->titles[$link_id] =& $matches[3];
1803- return ''; # String that will replace the block
1804- }
1805-
1806-
1807- function hashHTMLBlocks($text) {
1808- if ($this->no_markup) return $text;
1809-
1810- $less_than_tab = $this->tab_width - 1;
1811-
1812- # Hashify HTML blocks:
1813- # We only want to do this for block-level HTML tags, such as headers,
1814- # lists, and tables. That's because we still want to wrap <p>s around
1815- # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
1816- # phrase emphasis, and spans. The list of tags we're looking for is
1817- # hard-coded:
1818- #
1819- # * List "a" is made of tags which can be both inline or block-level.
1820- # These will be treated block-level when the start tag is alone on
1821- # its line, otherwise they're not matched here and will be taken as
1822- # inline later.
1823- # * List "b" is made of tags which are always block-level;
1824- #
1825- $block_tags_a_re = 'ins|del';
1826- $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
1827- 'script|noscript|form|fieldset|iframe|math';
1828-
1829- # Regular expression for the content of a block tag.
1830- $nested_tags_level = 4;
1831- $attr = '
1832- (?> # optional tag attributes
1833- \s # starts with whitespace
1834- (?>
1835- [^>"/]+ # text outside quotes
1836- |
1837- /+(?!>) # slash not followed by ">"
1838- |
1839- "[^"]*" # text inside double quotes (tolerate ">")
1840- |
1841- \'[^\']*\' # text inside single quotes (tolerate ">")
1842- )*
1843- )?
1844- ';
1845- $content =
1846- str_repeat('
1847- (?>
1848- [^<]+ # content without tag
1849- |
1850- <\2 # nested opening tag
1851- '.$attr.' # attributes
1852- (?>
1853- />
1854- |
1855- >', $nested_tags_level). # end of opening tag
1856- '.*?'. # last level nested tag content
1857- str_repeat('
1858- </\2\s*> # closing nested tag
1859- )
1860- |
1861- <(?!/\2\s*> # other tags with a different name
1862- )
1863- )*',
1864- $nested_tags_level);
1865- $content2 = str_replace('\2', '\3', $content);
1866-
1867- # First, look for nested blocks, e.g.:
1868- # <div>
1869- # <div>
1870- # tags for inner block must be indented.
1871- # </div>
1872- # </div>
1873- #
1874- # The outermost tags must start at the left margin for this to match, and
1875- # the inner nested divs must be indented.
1876- # We need to do this before the next, more liberal match, because the next
1877- # match will start at the first `<div>` and stop at the first `</div>`.
1878- $text = preg_replace_callback('{(?>
1879- (?>
1880- (?<=\n\n) # Starting after a blank line
1881- | # or
1882- \A\n? # the beginning of the doc
1883- )
1884- ( # save in $1
1885-
1886- # Match from `\n<tag>` to `</tag>\n`, handling nested tags
1887- # in between.
1888-
1889- [ ]{0,'.$less_than_tab.'}
1890- <('.$block_tags_b_re.')# start tag = $2
1891- '.$attr.'> # attributes followed by > and \n
1892- '.$content.' # content, support nesting
1893- </\2> # the matching end tag
1894- [ ]* # trailing spaces/tabs
1895- (?=\n+|\Z) # followed by a newline or end of document
1896-
1897- | # Special version for tags of group a.
1898-
1899- [ ]{0,'.$less_than_tab.'}
1900- <('.$block_tags_a_re.')# start tag = $3
1901- '.$attr.'>[ ]*\n # attributes followed by >
1902- '.$content2.' # content, support nesting
1903- </\3> # the matching end tag
1904- [ ]* # trailing spaces/tabs
1905- (?=\n+|\Z) # followed by a newline or end of document
1906-
1907- | # Special case just for <hr />. It was easier to make a special
1908- # case than to make the other regex more complicated.
1909-
1910- [ ]{0,'.$less_than_tab.'}
1911- <(hr) # start tag = $2
1912- '.$attr.' # attributes
1913- /?> # the matching end tag
1914- [ ]*
1915- (?=\n{2,}|\Z) # followed by a blank line or end of document
1916-
1917- | # Special case for standalone HTML comments:
1918-
1919- [ ]{0,'.$less_than_tab.'}
1920- (?s:
1921- <!-- .*? -->
1922- )
1923- [ ]*
1924- (?=\n{2,}|\Z) # followed by a blank line or end of document
1925-
1926- | # PHP and ASP-style processor instructions (<? and <%)
1927-
1928- [ ]{0,'.$less_than_tab.'}
1929- (?s:
1930- <([?%]) # $2
1931- .*?
1932- \2>
1933- )
1934- [ ]*
1935- (?=\n{2,}|\Z) # followed by a blank line or end of document
1936-
1937- )
1938- )}Sxmi',
1939- array(&$this, '_hashHTMLBlocks_callback'),
1940- $text);
1941-
1942- return $text;
1943- }
1944- function _hashHTMLBlocks_callback($matches) {
1945- $text = $matches[1];
1946- $key = $this->hashBlock($text);
1947- return "\n\n$key\n\n";
1948- }
1949-
1950-
1951- function hashPart($text, $boundary = 'X') {
1952- #
1953- # Called whenever a tag must be hashed when a function insert an atomic
1954- # element in the text stream. Passing $text to through this function gives
1955- # a unique text-token which will be reverted back when calling unhash.
1956- #
1957- # The $boundary argument specify what character should be used to surround
1958- # the token. By convension, "B" is used for block elements that needs not
1959- # to be wrapped into paragraph tags at the end, ":" is used for elements
1960- # that are word separators and "X" is used in the general case.
1961- #
1962- # Swap back any tag hash found in $text so we do not have to `unhash`
1963- # multiple times at the end.
1964- $text = $this->unhash($text);
1965-
1966- # Then hash the block.
1967- static $i = 0;
1968- $key = "$boundary\x1A" . ++$i . $boundary;
1969- $this->html_hashes[$key] = $text;
1970- return $key; # String that will replace the tag.
1971- }
1972-
1973-
1974- function hashBlock($text) {
1975- #
1976- # Shortcut function for hashPart with block-level boundaries.
1977- #
1978- return $this->hashPart($text, 'B');
1979- }
1980-
1981-
1982- var $block_gamut = array(
1983- #
1984- # These are all the transformations that form block-level
1985- # tags like paragraphs, headers, and list items.
1986- #
1987- "doHeaders" => 10,
1988- "doHorizontalRules" => 20,
1989-
1990- "doLists" => 40,
1991- "doCodeBlocks" => 50,
1992- "doBlockQuotes" => 60,
1993- );
1994-
1995- function runBlockGamut($text) {
1996- #
1997- # Run block gamut tranformations.
1998- #
1999- # We need to escape raw HTML in Markdown source before doing anything
2000- # else. This need to be done for each block, and not only at the
2001- # begining in the Markdown function since hashed blocks can be part of
2002- # list items and could have been indented. Indented blocks would have
2003- # been seen as a code block in a previous pass of hashHTMLBlocks.
2004- $text = $this->hashHTMLBlocks($text);
2005-
2006- return $this->runBasicBlockGamut($text);
2007- }
2008-
2009- function runBasicBlockGamut($text) {
2010- #
2011- # Run block gamut tranformations, without hashing HTML blocks. This is
2012- # useful when HTML blocks are known to be already hashed, like in the first
2013- # whole-document pass.
2014- #
2015- foreach ($this->block_gamut as $method => $priority) {
2016- $text = $this->$method($text);
2017- }
2018-
2019- # Finally form paragraph and restore hashed blocks.
2020- $text = $this->formParagraphs($text);
2021-
2022- return $text;
2023- }
2024-
2025-
2026- function doHorizontalRules($text) {
2027- # Do Horizontal Rules:
2028- return preg_replace(
2029- '{
2030- ^[ ]{0,3} # Leading space
2031- ([-*_]) # $1: First marker
2032- (?> # Repeated marker group
2033- [ ]{0,2} # Zero, one, or two spaces.
2034- \1 # Marker character
2035- ){2,} # Group repeated at least twice
2036- [ ]* # Tailing spaces
2037- $ # End of line.
2038- }mx',
2039- "\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n",
2040- $text);
2041- }
2042-
2043-
2044- var $span_gamut = array(
2045- #
2046- # These are all the transformations that occur *within* block-level
2047- # tags like paragraphs, headers, and list items.
2048- #
2049- # Process character escapes, code spans, and inline HTML
2050- # in one shot.
2051- "parseSpan" => -30,
2052-
2053- # Process anchor and image tags. Images must come first,
2054- # because ![foo][f] looks like an anchor.
2055- "doImages" => 10,
2056- "doAnchors" => 20,
2057-
2058- # Make links out of things like `<http://example.com/>`
2059- # Must come after doAnchors, because you can use < and >
2060- # delimiters in inline links like [this](<url>).
2061- "doAutoLinks" => 30,
2062- "encodeAmpsAndAngles" => 40,
2063-
2064- "doItalicsAndBold" => 50,
2065- "doHardBreaks" => 60,
2066- );
2067-
2068- function runSpanGamut($text) {
2069- #
2070- # Run span gamut tranformations.
2071- #
2072- foreach ($this->span_gamut as $method => $priority) {
2073- $text = $this->$method($text);
2074- }
2075-
2076- return $text;
2077- }
2078-
2079-
2080- function doHardBreaks($text) {
2081- # Do hard breaks:
2082- return preg_replace_callback('/ {2,}\n/',
2083- array(&$this, '_doHardBreaks_callback'), $text);
2084- }
2085- function _doHardBreaks_callback($matches) {
2086- return $this->hashPart("<br$this->empty_element_suffix\n");
2087- }
2088-
2089-
2090- function doAnchors($text) {
2091- #
2092- # Turn Markdown link shortcuts into XHTML <a> tags.
2093- #
2094- if ($this->in_anchor) return $text;
2095- $this->in_anchor = true;
2096-
2097- #
2098- # First, handle reference-style links: [link text] [id]
2099- #
2100- $text = preg_replace_callback('{
2101- ( # wrap whole match in $1
2102- \[
2103- ('.$this->nested_brackets_re.') # link text = $2
2104- \]
2105-
2106- [ ]? # one optional space
2107- (?:\n[ ]*)? # one optional newline followed by spaces
2108-
2109- \[
2110- (.*?) # id = $3
2111- \]
2112- )
2113- }xs',
2114- array(&$this, '_doAnchors_reference_callback'), $text);
2115-
2116- #
2117- # Next, inline-style links: [link text](url "optional title")
2118- #
2119- $text = preg_replace_callback('{
2120- ( # wrap whole match in $1
2121- \[
2122- ('.$this->nested_brackets_re.') # link text = $2
2123- \]
2124- \( # literal paren
2125- [ ]*
2126- (?:
2127- <(\S*)> # href = $3
2128- |
2129- ('.$this->nested_url_parenthesis_re.') # href = $4
2130- )
2131- [ ]*
2132- ( # $5
2133- ([\'"]) # quote char = $6
2134- (.*?) # Title = $7
2135- \6 # matching quote
2136- [ ]* # ignore any spaces/tabs between closing quote and )
2137- )? # title is optional
2138- \)
2139- )
2140- }xs',
2141- array(&$this, '_DoAnchors_inline_callback'), $text);
2142-
2143- #
2144- # Last, handle reference-style shortcuts: [link text]
2145- # These must come last in case you've also got [link test][1]
2146- # or [link test](/foo)
2147- #
2148-// $text = preg_replace_callback('{
2149-// ( # wrap whole match in $1
2150-// \[
2151-// ([^\[\]]+) # link text = $2; can\'t contain [ or ]
2152-// \]
2153-// )
2154-// }xs',
2155-// array(&$this, '_doAnchors_reference_callback'), $text);
2156-
2157- $this->in_anchor = false;
2158- return $text;
2159- }
2160- function _doAnchors_reference_callback($matches) {
2161- $whole_match = $matches[1];
2162- $link_text = $matches[2];
2163- $link_id =& $matches[3];
2164-
2165- if ($link_id == "") {
2166- # for shortcut links like [this][] or [this].
2167- $link_id = $link_text;
2168- }
2169-
2170- # lower-case and turn embedded newlines into spaces
2171- $link_id = strtolower($link_id);
2172- $link_id = preg_replace('{[ ]?\n}', ' ', $link_id);
2173-
2174- if (isset($this->urls[$link_id])) {
2175- $url = $this->urls[$link_id];
2176- $url = $this->encodeAttribute($url);
2177-
2178- $result = "<a href=\"$url\"";
2179- if ( isset( $this->titles[$link_id] ) ) {
2180- $title = $this->titles[$link_id];
2181- $title = $this->encodeAttribute($title);
2182- $result .= " title=\"$title\"";
2183- }
2184-
2185- $link_text = $this->runSpanGamut($link_text);
2186- $result .= ">$link_text</a>";
2187- $result = $this->hashPart($result);
2188- }
2189- else {
2190- $result = $whole_match;
2191- }
2192- return $result;
2193- }
2194- function _doAnchors_inline_callback($matches) {
2195- $whole_match = $matches[1];
2196- $link_text = $this->runSpanGamut($matches[2]);
2197- $url = $matches[3] == '' ? $matches[4] : $matches[3];
2198- $title =& $matches[7];
2199-
2200- $url = $this->encodeAttribute($url);
2201-
2202- $result = "<a href=\"$url\"";
2203- if (isset($title)) {
2204- $title = $this->encodeAttribute($title);
2205- $result .= " title=\"$title\"";
2206- }
2207-
2208- $link_text = $this->runSpanGamut($link_text);
2209- $result .= ">$link_text</a>";
2210-
2211- return $this->hashPart($result);
2212- }
2213-
2214-
2215- function doImages($text) {
2216- #
2217- # Turn Markdown image shortcuts into <img> tags.
2218- #
2219- #
2220- # First, handle reference-style labeled images: ![alt text][id]
2221- #
2222- $text = preg_replace_callback('{
2223- ( # wrap whole match in $1
2224- !\[
2225- ('.$this->nested_brackets_re.') # alt text = $2
2226- \]
2227-
2228- [ ]? # one optional space
2229- (?:\n[ ]*)? # one optional newline followed by spaces
2230-
2231- \[
2232- (.*?) # id = $3
2233- \]
2234-
2235- )
2236- }xs',
2237- array(&$this, '_doImages_reference_callback'), $text);
2238-
2239- #
2240- # Next, handle inline images: ![alt text](url "optional title")
2241- # Don't forget: encode * and _
2242- #
2243- $text = preg_replace_callback('{
2244- ( # wrap whole match in $1
2245- !\[
2246- ('.$this->nested_brackets_re.') # alt text = $2
2247- \]
2248- \s? # One optional whitespace character
2249- \( # literal paren
2250- [ ]*
2251- (?:
2252- <(\S*)> # src url = $3
2253- |
2254- ('.$this->nested_url_parenthesis_re.') # src url = $4
2255- )
2256- [ ]*
2257- ( # $5
2258- ([\'"]) # quote char = $6
2259- (.*?) # title = $7
2260- \6 # matching quote
2261- [ ]*
2262- )? # title is optional
2263- \)
2264- )
2265- }xs',
2266- array(&$this, '_doImages_inline_callback'), $text);
2267-
2268- return $text;
2269- }
2270- function _doImages_reference_callback($matches) {
2271- $whole_match = $matches[1];
2272- $alt_text = $matches[2];
2273- $link_id = strtolower($matches[3]);
2274-
2275- if ($link_id == "") {
2276- $link_id = strtolower($alt_text); # for shortcut links like ![this][].
2277- }
2278-
2279- $alt_text = $this->encodeAttribute($alt_text);
2280- if (isset($this->urls[$link_id])) {
2281- $url = $this->encodeAttribute($this->urls[$link_id]);
2282- $result = "<img src=\"$url\" alt=\"$alt_text\"";
2283- if (isset($this->titles[$link_id])) {
2284- $title = $this->titles[$link_id];
2285- $title = $this->encodeAttribute($title);
2286- $result .= " title=\"$title\"";
2287- }
2288- $result .= $this->empty_element_suffix;
2289- $result = $this->hashPart($result);
2290- }
2291- else {
2292- # If there's no such link ID, leave intact:
2293- $result = $whole_match;
2294- }
2295-
2296- return $result;
2297- }
2298- function _doImages_inline_callback($matches) {
2299- $whole_match = $matches[1];
2300- $alt_text = $matches[2];
2301- $url = $matches[3] == '' ? $matches[4] : $matches[3];
2302- $title =& $matches[7];
2303-
2304- $alt_text = $this->encodeAttribute($alt_text);
2305- $url = $this->encodeAttribute($url);
2306- $result = "<img src=\"$url\" alt=\"$alt_text\"";
2307- if (isset($title)) {
2308- $title = $this->encodeAttribute($title);
2309- $result .= " title=\"$title\""; # $title already quoted
2310- }
2311- $result .= $this->empty_element_suffix;
2312-
2313- return $this->hashPart($result);
2314- }
2315-
2316-
2317- function doHeaders($text) {
2318- # Setext-style headers:
2319- # Header 1
2320- # ========
2321- #
2322- # Header 2
2323- # --------
2324- #
2325- $text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
2326- array(&$this, '_doHeaders_callback_setext'), $text);
2327-
2328- # atx-style headers:
2329- # # Header 1
2330- # ## Header 2
2331- # ## Header 2 with closing hashes ##
2332- # ...
2333- # ###### Header 6
2334- #
2335- $text = preg_replace_callback('{
2336- ^(\#{1,6}) # $1 = string of #\'s
2337- [ ]*
2338- (.+?) # $2 = Header text
2339- [ ]*
2340- \#* # optional closing #\'s (not counted)
2341- \n+
2342- }xm',
2343- array(&$this, '_doHeaders_callback_atx'), $text);
2344-
2345- return $text;
2346- }
2347- function _doHeaders_callback_setext($matches) {
2348- # Terrible hack to check we haven't found an empty list item.
2349- if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
2350- return $matches[0];
2351-
2352- $level = $matches[2]{0} == '=' ? 1 : 2;
2353- $block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
2354- return "\n" . $this->hashBlock($block) . "\n\n";
2355- }
2356- function _doHeaders_callback_atx($matches) {
2357- $level = strlen($matches[1]);
2358- $block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>";
2359- return "\n" . $this->hashBlock($block) . "\n\n";
2360- }
2361-
2362-
2363- function doLists($text) {
2364- #
2365- # Form HTML ordered (numbered) and unordered (bulleted) lists.
2366- #
2367- $less_than_tab = $this->tab_width - 1;
2368-
2369- # Re-usable patterns to match list item bullets and number markers:
2370- $marker_ul_re = '[*+-]';
2371- $marker_ol_re = '\d+[.]';
2372- $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
2373-
2374- $markers_relist = array($marker_ul_re, $marker_ol_re);
2375-
2376- foreach ($markers_relist as $marker_re) {
2377- # Re-usable pattern to match any entirel ul or ol list:
2378- $whole_list_re = '
2379- ( # $1 = whole list
2380- ( # $2
2381- [ ]{0,'.$less_than_tab.'}
2382- ('.$marker_re.') # $3 = first list item marker
2383- [ ]+
2384- )
2385- (?s:.+?)
2386- ( # $4
2387- \z
2388- |
2389- \n{2,}
2390- (?=\S)
2391- (?! # Negative lookahead for another list item marker
2392- [ ]*
2393- '.$marker_re.'[ ]+
2394- )
2395- )
2396- )
2397- '; // mx
2398-
2399- # We use a different prefix before nested lists than top-level lists.
2400- # See extended comment in _ProcessListItems().
2401-
2402- if ($this->list_level) {
2403- $text = preg_replace_callback('{
2404- ^
2405- '.$whole_list_re.'
2406- }mx',
2407- array(&$this, '_doLists_callback'), $text);
2408- }
2409- else {
2410- $text = preg_replace_callback('{
2411- (?:(?<=\n)\n|\A\n?) # Must eat the newline
2412- '.$whole_list_re.'
2413- }mx',
2414- array(&$this, '_doLists_callback'), $text);
2415- }
2416- }
2417-
2418- return $text;
2419- }
2420- function _doLists_callback($matches) {
2421- # Re-usable patterns to match list item bullets and number markers:
2422- $marker_ul_re = '[*+-]';
2423- $marker_ol_re = '\d+[.]';
2424- $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
2425-
2426- $list = $matches[1];
2427- $list_type = preg_match("/$marker_ul_re/", $matches[3]) ? "ul" : "ol";
2428-
2429- $marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
2430-
2431- $list .= "\n";
2432- $result = $this->processListItems($list, $marker_any_re);
2433-
2434- $result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
2435- return "\n". $result ."\n\n";
2436- }
2437-
2438- var $list_level = 0;
2439-
2440- function processListItems($list_str, $marker_any_re) {
2441- #
2442- # Process the contents of a single ordered or unordered list, splitting it
2443- # into individual list items.
2444- #
2445- # The $this->list_level global keeps track of when we're inside a list.
2446- # Each time we enter a list, we increment it; when we leave a list,
2447- # we decrement. If it's zero, we're not in a list anymore.
2448- #
2449- # We do this because when we're not inside a list, we want to treat
2450- # something like this:
2451- #
2452- # I recommend upgrading to version
2453- # 8. Oops, now this line is treated
2454- # as a sub-list.
2455- #
2456- # As a single paragraph, despite the fact that the second line starts
2457- # with a digit-period-space sequence.
2458- #
2459- # Whereas when we're inside a list (or sub-list), that line will be
2460- # treated as the start of a sub-list. What a kludge, huh? This is
2461- # an aspect of Markdown's syntax that's hard to parse perfectly
2462- # without resorting to mind-reading. Perhaps the solution is to
2463- # change the syntax rules such that sub-lists must start with a
2464- # starting cardinal number; e.g. "1." or "a.".
2465-
2466- $this->list_level++;
2467-
2468- # trim trailing blank lines:
2469- $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
2470-
2471- $list_str = preg_replace_callback('{
2472- (\n)? # leading line = $1
2473- (^[ ]*) # leading whitespace = $2
2474- ('.$marker_any_re.' # list marker and space = $3
2475- (?:[ ]+|(?=\n)) # space only required if item is not empty
2476- )
2477- ((?s:.*?)) # list item text = $4
2478- (?:(\n+(?=\n))|\n) # tailing blank line = $5
2479- (?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n))))
2480- }xm',
2481- array(&$this, '_processListItems_callback'), $list_str);
2482-
2483- $this->list_level--;
2484- return $list_str;
2485- }
2486- function _processListItems_callback($matches) {
2487- $item = $matches[4];
2488- $leading_line =& $matches[1];
2489- $leading_space =& $matches[2];
2490- $marker_space = $matches[3];
2491- $tailing_blank_line =& $matches[5];
2492-
2493- if ($leading_line || $tailing_blank_line ||
2494- preg_match('/\n{2,}/', $item))
2495- {
2496- # Replace marker with the appropriate whitespace indentation
2497- $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
2498- $item = $this->runBlockGamut($this->outdent($item)."\n");
2499- }
2500- else {
2501- # Recursion for sub-lists:
2502- $item = $this->doLists($this->outdent($item));
2503- $item = preg_replace('/\n+$/', '', $item);
2504- $item = $this->runSpanGamut($item);
2505- }
2506-
2507- return "<li>" . $item . "</li>\n";
2508- }
2509-
2510-
2511- function doCodeBlocks($text) {
2512- #
2513- # Process Markdown `<pre><code>` blocks.
2514- #
2515- $text = preg_replace_callback('{
2516- (?:\n\n|\A\n?)
2517- ( # $1 = the code block -- one or more lines, starting with a space/tab
2518- (?>
2519- [ ]{'.$this->tab_width.'} # Lines must start with a tab or a tab-width of spaces
2520- .*\n+
2521- )+
2522- )
2523- ((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
2524- }xm',
2525- array(&$this, '_doCodeBlocks_callback'), $text);
2526-
2527- return $text;
2528- }
2529- function _doCodeBlocks_callback($matches) {
2530- $codeblock = $matches[1];
2531-
2532- $codeblock = $this->outdent($codeblock);
2533- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
2534-
2535- # trim leading newlines and trailing newlines
2536- $codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
2537-
2538- $codeblock = "<pre><code>$codeblock\n</code></pre>";
2539- return "\n\n".$this->hashBlock($codeblock)."\n\n";
2540- }
2541-
2542-
2543- function makeCodeSpan($code) {
2544- #
2545- # Create a code span markup for $code. Called from handleSpanToken.
2546- #
2547- $code = htmlspecialchars(trim($code), ENT_NOQUOTES);
2548- return $this->hashPart("<code>$code</code>");
2549- }
2550-
2551-
2552- var $em_relist = array(
2553- '' => '(?:(?<!\*)\*(?!\*)|(?<!_)_(?!_))(?=\S)(?![.,:;]\s)',
2554- '*' => '(?<=\S)(?<!\*)\*(?!\*)',
2555- '_' => '(?<=\S)(?<!_)_(?!_)',
2556- );
2557- var $strong_relist = array(
2558- '' => '(?:(?<!\*)\*\*(?!\*)|(?<!_)__(?!_))(?=\S)(?![.,:;]\s)',
2559- '**' => '(?<=\S)(?<!\*)\*\*(?!\*)',
2560- '__' => '(?<=\S)(?<!_)__(?!_)',
2561- );
2562- var $em_strong_relist = array(
2563- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<!_)___(?!_))(?=\S)(?![.,:;]\s)',
2564- '***' => '(?<=\S)(?<!\*)\*\*\*(?!\*)',
2565- '___' => '(?<=\S)(?<!_)___(?!_)',
2566- );
2567- var $em_strong_prepared_relist;
2568-
2569- function prepareItalicsAndBold() {
2570- #
2571- # Prepare regular expressions for seraching emphasis tokens in any
2572- # context.
2573- #
2574- foreach ($this->em_relist as $em => $em_re) {
2575- foreach ($this->strong_relist as $strong => $strong_re) {
2576- # Construct list of allowed token expressions.
2577- $token_relist = array();
2578- if (isset($this->em_strong_relist["$em$strong"])) {
2579- $token_relist[] = $this->em_strong_relist["$em$strong"];
2580- }
2581- $token_relist[] = $em_re;
2582- $token_relist[] = $strong_re;
2583-
2584- # Construct master expression from list.
2585- $token_re = '{('. implode('|', $token_relist) .')}';
2586- $this->em_strong_prepared_relist["$em$strong"] = $token_re;
2587- }
2588- }
2589- }
2590-
2591- function doItalicsAndBold($text) {
2592- $token_stack = array('');
2593- $text_stack = array('');
2594- $em = '';
2595- $strong = '';
2596- $tree_char_em = false;
2597-
2598- while (1) {
2599- #
2600- # Get prepared regular expression for seraching emphasis tokens
2601- # in current context.
2602- #
2603- $token_re = $this->em_strong_prepared_relist["$em$strong"];
2604-
2605- #
2606- # Each loop iteration seach for the next emphasis token.
2607- # Each token is then passed to handleSpanToken.
2608- #
2609- $parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
2610- $text_stack[0] .= $parts[0];
2611- $token =& $parts[1];
2612- $text =& $parts[2];
2613-
2614- if (empty($token)) {
2615- # Reached end of text span: empty stack without emitting.
2616- # any more emphasis.
2617- while ($token_stack[0]) {
2618- $text_stack[1] .= array_shift($token_stack);
2619- $text_stack[0] .= array_shift($text_stack);
2620- }
2621- break;
2622- }
2623-
2624- $token_len = strlen($token);
2625- if ($tree_char_em) {
2626- # Reached closing marker while inside a three-char emphasis.
2627- if ($token_len == 3) {
2628- # Three-char closing marker, close em and strong.
2629- array_shift($token_stack);
2630- $span = array_shift($text_stack);
2631- $span = $this->runSpanGamut($span);
2632- $span = "<strong><em>$span</em></strong>";
2633- $text_stack[0] .= $this->hashPart($span);
2634- $em = '';
2635- $strong = '';
2636- } else {
2637- # Other closing marker: close one em or strong and
2638- # change current token state to match the other
2639- $token_stack[0] = str_repeat($token{0}, 3-$token_len);
2640- $tag = $token_len == 2 ? "strong" : "em";
2641- $span = $text_stack[0];
2642- $span = $this->runSpanGamut($span);
2643- $span = "<$tag>$span</$tag>";
2644- $text_stack[0] = $this->hashPart($span);
2645- $$tag = ''; # $$tag stands for $em or $strong
2646- }
2647- $tree_char_em = false;
2648- } else if ($token_len == 3) {
2649- if ($em) {
2650- # Reached closing marker for both em and strong.
2651- # Closing strong marker:
2652- for ($i = 0; $i < 2; ++$i) {
2653- $shifted_token = array_shift($token_stack);
2654- $tag = strlen($shifted_token) == 2 ? "strong" : "em";
2655- $span = array_shift($text_stack);
2656- $span = $this->runSpanGamut($span);
2657- $span = "<$tag>$span</$tag>";
2658- $text_stack[0] .= $this->hashPart($span);
2659- $$tag = ''; # $$tag stands for $em or $strong
2660- }
2661- } else {
2662- # Reached opening three-char emphasis marker. Push on token
2663- # stack; will be handled by the special condition above.
2664- $em = $token{0};
2665- $strong = "$em$em";
2666- array_unshift($token_stack, $token);
2667- array_unshift($text_stack, '');
2668- $tree_char_em = true;
2669- }
2670- } else if ($token_len == 2) {
2671- if ($strong) {
2672- # Unwind any dangling emphasis marker:
2673- if (strlen($token_stack[0]) == 1) {
2674- $text_stack[1] .= array_shift($token_stack);
2675- $text_stack[0] .= array_shift($text_stack);
2676- }
2677- # Closing strong marker:
2678- array_shift($token_stack);
2679- $span = array_shift($text_stack);
2680- $span = $this->runSpanGamut($span);
2681- $span = "<strong>$span</strong>";
2682- $text_stack[0] .= $this->hashPart($span);
2683- $strong = '';
2684- } else {
2685- array_unshift($token_stack, $token);
2686- array_unshift($text_stack, '');
2687- $strong = $token;
2688- }
2689- } else {
2690- # Here $token_len == 1
2691- if ($em) {
2692- if (strlen($token_stack[0]) == 1) {
2693- # Closing emphasis marker:
2694- array_shift($token_stack);
2695- $span = array_shift($text_stack);
2696- $span = $this->runSpanGamut($span);
2697- $span = "<em>$span</em>";
2698- $text_stack[0] .= $this->hashPart($span);
2699- $em = '';
2700- } else {
2701- $text_stack[0] .= $token;
2702- }
2703- } else {
2704- array_unshift($token_stack, $token);
2705- array_unshift($text_stack, '');
2706- $em = $token;
2707- }
2708- }
2709- }
2710- return $text_stack[0];
2711- }
2712-
2713-
2714- function doBlockQuotes($text) {
2715- $text = preg_replace_callback('/
2716- ( # Wrap whole match in $1
2717- (?>
2718- ^[ ]*>[ ]? # ">" at the start of a line
2719- .+\n # rest of the first line
2720- (.+\n)* # subsequent consecutive lines
2721- \n* # blanks
2722- )+
2723- )
2724- /xm',
2725- array(&$this, '_doBlockQuotes_callback'), $text);
2726-
2727- return $text;
2728- }
2729- function _doBlockQuotes_callback($matches) {
2730- $bq = $matches[1];
2731- # trim one level of quoting - trim whitespace-only lines
2732- $bq = preg_replace('/^[ ]*>[ ]?|^[ ]+$/m', '', $bq);
2733- $bq = $this->runBlockGamut($bq); # recurse
2734-
2735- $bq = preg_replace('/^/m', " ", $bq);
2736- # These leading spaces cause problem with <pre> content,
2737- # so we need to fix that:
2738- $bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
2739- array(&$this, '_DoBlockQuotes_callback2'), $bq);
2740-
2741- return "\n". $this->hashBlock("<blockquote>\n$bq\n</blockquote>")."\n\n";
2742- }
2743- function _doBlockQuotes_callback2($matches) {
2744- $pre = $matches[1];
2745- $pre = preg_replace('/^ /m', '', $pre);
2746- return $pre;
2747- }
2748-
2749-
2750- function formParagraphs($text) {
2751- #
2752- # Params:
2753- # $text - string to process with html <p> tags
2754- #
2755- # Strip leading and trailing lines:
2756- $text = preg_replace('/\A\n+|\n+\z/', '', $text);
2757-
2758- $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
2759-
2760- #
2761- # Wrap <p> tags and unhashify HTML blocks
2762- #
2763- foreach ($grafs as $key => $value) {
2764- if (!preg_match('/^B\x1A[0-9]+B$/', $value)) {
2765- # Is a paragraph.
2766- $value = $this->runSpanGamut($value);
2767- $value = preg_replace('/^([ ]*)/', "<p>", $value);
2768- $value .= "</p>";
2769- $grafs[$key] = $this->unhash($value);
2770- }
2771- else {
2772- # Is a block.
2773- # Modify elements of @grafs in-place...
2774- $graf = $value;
2775- $block = $this->html_hashes[$graf];
2776- $graf = $block;
2777-// if (preg_match('{
2778-// \A
2779-// ( # $1 = <div> tag
2780-// <div \s+
2781-// [^>]*
2782-// \b
2783-// markdown\s*=\s* ([\'"]) # $2 = attr quote char
2784-// 1
2785-// \2
2786-// [^>]*
2787-// >
2788-// )
2789-// ( # $3 = contents
2790-// .*
2791-// )
2792-// (</div>) # $4 = closing tag
2793-// \z
2794-// }xs', $block, $matches))
2795-// {
2796-// list(, $div_open, , $div_content, $div_close) = $matches;
2797-//
2798-// # We can't call Markdown(), because that resets the hash;
2799-// # that initialization code should be pulled into its own sub, though.
2800-// $div_content = $this->hashHTMLBlocks($div_content);
2801-//
2802-// # Run document gamut methods on the content.
2803-// foreach ($this->document_gamut as $method => $priority) {
2804-// $div_content = $this->$method($div_content);
2805-// }
2806-//
2807-// $div_open = preg_replace(
2808-// '{\smarkdown\s*=\s*([\'"]).+?\1}', '', $div_open);
2809-//
2810-// $graf = $div_open . "\n" . $div_content . "\n" . $div_close;
2811-// }
2812- $grafs[$key] = $graf;
2813- }
2814- }
2815-
2816- return implode("\n\n", $grafs);
2817- }
2818-
2819-
2820- function encodeAttribute($text) {
2821- #
2822- # Encode text for a double-quoted HTML attribute. This function
2823- # is *not* suitable for attributes enclosed in single quotes.
2824- #
2825- $text = $this->encodeAmpsAndAngles($text);
2826- $text = str_replace('"', '&quot;', $text);
2827- return $text;
2828- }
2829-
2830-
2831- function encodeAmpsAndAngles($text) {
2832- #
2833- # Smart processing for ampersands and angle brackets that need to
2834- # be encoded. Valid character entities are left alone unless the
2835- # no-entities mode is set.
2836- #
2837- if ($this->no_entities) {
2838- $text = str_replace('&', '&amp;', $text);
2839- } else {
2840- # Ampersand-encoding based entirely on Nat Irons's Amputator
2841- # MT plugin: <http://bumppo.net/projects/amputator/>
2842- $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
2843- '&amp;', $text);;
2844- }
2845- # Encode remaining <'s
2846- $text = str_replace('<', '&lt;', $text);
2847-
2848- return $text;
2849- }
2850-
2851-
2852- function doAutoLinks($text) {
2853- $text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i',
2854- array(&$this, '_doAutoLinks_url_callback'), $text);
2855-
2856- # Email addresses: <address@domain.foo>
2857- $text = preg_replace_callback('{
2858- <
2859- (?:mailto:)?
2860- (
2861- [-.\w\x80-\xFF]+
2862- \@
2863- [-a-z0-9\x80-\xFF]+(\.[-a-z0-9\x80-\xFF]+)*\.[a-z]+
2864- )
2865- >
2866- }xi',
2867- array(&$this, '_doAutoLinks_email_callback'), $text);
2868-
2869- return $text;
2870- }
2871- function _doAutoLinks_url_callback($matches) {
2872- $url = $this->encodeAttribute($matches[1]);
2873- $link = "<a href=\"$url\">$url</a>";
2874- return $this->hashPart($link);
2875- }
2876- function _doAutoLinks_email_callback($matches) {
2877- $address = $matches[1];
2878- $link = $this->encodeEmailAddress($address);
2879- return $this->hashPart($link);
2880- }
2881-
2882-
2883- function encodeEmailAddress($addr) {
2884- #
2885- # Input: an email address, e.g. "foo@example.com"
2886- #
2887- # Output: the email address as a mailto link, with each character
2888- # of the address encoded as either a decimal or hex entity, in
2889- # the hopes of foiling most address harvesting spam bots. E.g.:
2890- #
2891- # <p><a href="&#109;&#x61;&#105;&#x6c;&#116;&#x6f;&#58;&#x66;o&#111;
2892- # &#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;&#101;&#46;&#x63;&#111;
2893- # &#x6d;">&#x66;o&#111;&#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;
2894- # &#101;&#46;&#x63;&#111;&#x6d;</a></p>
2895- #
2896- # Based by a filter by Matthew Wickline, posted to BBEdit-Talk.
2897- # With some optimizations by Milian Wolff.
2898- #
2899- $addr = "mailto:" . $addr;
2900- $chars = preg_split('/(?<!^)(?!$)/', $addr);
2901- $seed = (int)abs(crc32($addr) / strlen($addr)); # Deterministic seed.
2902-
2903- foreach ($chars as $key => $char) {
2904- $ord = ord($char);
2905- # Ignore non-ascii chars.
2906- if ($ord < 128) {
2907- $r = ($seed * (1 + $key)) % 100; # Pseudo-random function.
2908- # roughly 10% raw, 45% hex, 45% dec
2909- # '@' *must* be encoded. I insist.
2910- if ($r > 90 && $char != '@') /* do nothing */;
2911- else if ($r < 45) $chars[$key] = '&#x'.dechex($ord).';';
2912- else $chars[$key] = '&#'.$ord.';';
2913- }
2914- }
2915-
2916- $addr = implode('', $chars);
2917- $text = implode('', array_slice($chars, 7)); # text without `mailto:`
2918- $addr = "<a href=\"$addr\">$text</a>";
2919-
2920- return $addr;
2921- }
2922-
2923-
2924- function parseSpan($str) {
2925- #
2926- # Take the string $str and parse it into tokens, hashing embeded HTML,
2927- # escaped characters and handling code spans.
2928- #
2929- $output = '';
2930-
2931- $span_re = '{
2932- (
2933- \\\\'.$this->escape_chars_re.'
2934- |
2935- (?<![`\\\\])
2936- `+ # code span marker
2937- '.( $this->no_markup ? '' : '
2938- |
2939- <!-- .*? --> # comment
2940- |
2941- <\?.*?\?> | <%.*?%> # processing instruction
2942- |
2943- <[/!$]?[-a-zA-Z0-9:]+ # regular tags
2944- (?>
2945- \s
2946- (?>[^"\'>]+|"[^"]*"|\'[^\']*\')*
2947- )?
2948- >
2949- ').'
2950- )
2951- }xs';
2952-
2953- while (1) {
2954- #
2955- # Each loop iteration seach for either the next tag, the next
2956- # openning code span marker, or the next escaped character.
2957- # Each token is then passed to handleSpanToken.
2958- #
2959- $parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE);
2960-
2961- # Create token from text preceding tag.
2962- if ($parts[0] != "") {
2963- $output .= $parts[0];
2964- }
2965-
2966- # Check if we reach the end.
2967- if (isset($parts[1])) {
2968- $output .= $this->handleSpanToken($parts[1], $parts[2]);
2969- $str = $parts[2];
2970- }
2971- else {
2972- break;
2973- }
2974- }
2975-
2976- return $output;
2977- }
2978-
2979-
2980- function handleSpanToken($token, &$str) {
2981- #
2982- # Handle $token provided by parseSpan by determining its nature and
2983- # returning the corresponding value that should replace it.
2984- #
2985- switch ($token{0}) {
2986- case "\\":
2987- return $this->hashPart("&#". ord($token{1}). ";");
2988- case "`":
2989- # Search for end marker in remaining text.
2990- if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
2991- $str, $matches))
2992- {
2993- $str = $matches[2];
2994- $codespan = $this->makeCodeSpan($matches[1]);
2995- return $this->hashPart($codespan);
2996- }
2997- return $token; // return as text since no ending marker found.
2998- default:
2999- return $this->hashPart($token);
3000- }
3001- }
3002-
3003-
3004- function outdent($text) {
3005- #
3006- # Remove one level of line-leading tabs or spaces
3007- #
3008- return preg_replace('/^(\t|[ ]{1,'.$this->tab_width.'})/m', '', $text);
3009- }
3010-
3011-
3012- # String length function for detab. `_initDetab` will create a function to
3013- # hanlde UTF-8 if the default function does not exist.
3014- var $utf8_strlen = 'mb_strlen';
3015-
3016- function detab($text) {
3017- #
3018- # Replace tabs with the appropriate amount of space.
3019- #
3020- # For each line we separate the line in blocks delemited by
3021- # tab characters. Then we reconstruct every line by adding the
3022- # appropriate number of space between each blocks.
3023-
3024- $text = preg_replace_callback('/^.*\t.*$/m',
3025- array(&$this, '_detab_callback'), $text);
3026-
3027- return $text;
3028- }
3029- function _detab_callback($matches) {
3030- $line = $matches[0];
3031- $strlen = $this->utf8_strlen; # strlen function for UTF-8.
3032-
3033- # Split in blocks.
3034- $blocks = explode("\t", $line);
3035- # Add each blocks to the line.
3036- $line = $blocks[0];
3037- unset($blocks[0]); # Do not add first block twice.
3038- foreach ($blocks as $block) {
3039- # Calculate amount of space, insert spaces, insert block.
3040- $amount = $this->tab_width -
3041- $strlen($line, 'UTF-8') % $this->tab_width;
3042- $line .= str_repeat(" ", $amount) . $block;
3043- }
3044- return $line;
3045- }
3046- function _initDetab() {
3047- #
3048- # Check for the availability of the function in the `utf8_strlen` property
3049- # (initially `mb_strlen`). If the function is not available, create a
3050- # function that will loosely count the number of UTF-8 characters with a
3051- # regular expression.
3052- #
3053- if (function_exists($this->utf8_strlen)) return;
3054- $this->utf8_strlen = create_function('$text', 'return preg_match_all(
3055- "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
3056- $text, $m);');
3057- }
3058-
3059-
3060- function unhash($text) {
3061- #
3062- # Swap back in all the tags hashed by _HashHTMLBlocks.
3063- #
3064- return preg_replace_callback('/(.)\x1A[0-9]+\1/',
3065- array(&$this, '_unhash_callback'), $text);
3066- }
3067- function _unhash_callback($matches) {
3068- return $this->html_hashes[$matches[0]];
3069- }
3070-
3071-}
3072-
3073-
3074-#
3075-# Markdown Extra Parser Class
3076-#
3077-
3078-class MarkdownExtra_Parser extends Markdown_Parser {
3079-
3080- # Prefix for footnote ids.
3081- var $fn_id_prefix = "";
3082-
3083- # Optional title attribute for footnote links and backlinks.
3084- var $fn_link_title = MARKDOWN_FN_LINK_TITLE;
3085- var $fn_backlink_title = MARKDOWN_FN_BACKLINK_TITLE;
3086-
3087- # Optional class attribute for footnote links and backlinks.
3088- var $fn_link_class = MARKDOWN_FN_LINK_CLASS;
3089- var $fn_backlink_class = MARKDOWN_FN_BACKLINK_CLASS;
3090-
3091- # Predefined abbreviations.
3092- var $predef_abbr = array();
3093-
3094-
3095- function MarkdownExtra_Parser() {
3096- #
3097- # Constructor function. Initialize the parser object.
3098- #
3099- # Add extra escapable characters before parent constructor
3100- # initialize the table.
3101- $this->escape_chars .= ':|';
3102-
3103- # Insert extra document, block, and span transformations.
3104- # Parent constructor will do the sorting.
3105- $this->document_gamut += array(
3106- "doFencedCodeBlocks" => 5,
3107- "stripFootnotes" => 15,
3108- "stripAbbreviations" => 25,
3109- "appendFootnotes" => 50,
3110- );
3111- $this->block_gamut += array(
3112- "doFencedCodeBlocks" => 5,
3113- "doTables" => 15,
3114- "doDefLists" => 45,
3115- );
3116- $this->span_gamut += array(
3117- "doFootnotes" => 5,
3118- "doAbbreviations" => 70,
3119- );
3120-
3121- parent::Markdown_Parser();
3122- }
3123-
3124-
3125- # Extra variables used during extra transformations.
3126- var $footnotes = array();
3127- var $footnotes_ordered = array();
3128- var $abbr_desciptions = array();
3129- var $abbr_word_re = '';
3130-
3131- # Give the current footnote number.
3132- var $footnote_counter = 1;
3133-
3134-
3135- function setup() {
3136- #
3137- # Setting up Extra-specific variables.
3138- #
3139- parent::setup();
3140-
3141- $this->footnotes = array();
3142- $this->footnotes_ordered = array();
3143- $this->abbr_desciptions = array();
3144- $this->abbr_word_re = '';
3145- $this->footnote_counter = 1;
3146-
3147- foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
3148- if ($this->abbr_word_re)
3149- $this->abbr_word_re .= '|';
3150- $this->abbr_word_re .= preg_quote($abbr_word);
3151- $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
3152- }
3153- }
3154-
3155- function teardown() {
3156- #
3157- # Clearing Extra-specific variables.
3158- #
3159- $this->footnotes = array();
3160- $this->footnotes_ordered = array();
3161- $this->abbr_desciptions = array();
3162- $this->abbr_word_re = '';
3163-
3164- parent::teardown();
3165- }
3166-
3167-
3168- ### HTML Block Parser ###
3169-
3170- # Tags that are always treated as block tags:
3171- var $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend';
3172-
3173- # Tags treated as block tags only if the opening tag is alone on it's line:
3174- var $context_block_tags_re = 'script|noscript|math|ins|del';
3175-
3176- # Tags where markdown="1" default to span mode:
3177- var $contain_span_tags_re = 'p|h[1-6]|li|dd|dt|td|th|legend|address';
3178-
3179- # Tags which must not have their contents modified, no matter where
3180- # they appear:
3181- var $clean_tags_re = 'script|math';
3182-
3183- # Tags that do not need to be closed.
3184- var $auto_close_tags_re = 'hr|img';
3185-
3186-
3187- function hashHTMLBlocks($text) {
3188- #
3189- # Hashify HTML Blocks and "clean tags".
3190- #
3191- # We only want to do this for block-level HTML tags, such as headers,
3192- # lists, and tables. That's because we still want to wrap <p>s around
3193- # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
3194- # phrase emphasis, and spans. The list of tags we're looking for is
3195- # hard-coded.
3196- #
3197- # This works by calling _HashHTMLBlocks_InMarkdown, which then calls
3198- # _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1"
3199- # attribute is found whitin a tag, _HashHTMLBlocks_InHTML calls back
3200- # _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag.
3201- # These two functions are calling each other. It's recursive!
3202- #
3203- #
3204- # Call the HTML-in-Markdown hasher.
3205- #
3206- list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text);
3207-
3208- return $text;
3209- }
3210- function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
3211- $enclosing_tag_re = '', $span = false)
3212- {
3213- #
3214- # Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags.
3215- #
3216- # * $indent is the number of space to be ignored when checking for code
3217- # blocks. This is important because if we don't take the indent into
3218- # account, something like this (which looks right) won't work as expected:
3219- #
3220- # <div>
3221- # <div markdown="1">
3222- # Hello World. <-- Is this a Markdown code block or text?
3223- # </div> <-- Is this a Markdown code block or a real tag?
3224- # <div>
3225- #
3226- # If you don't like this, just don't indent the tag on which
3227- # you apply the markdown="1" attribute.
3228- #
3229- # * If $enclosing_tag_re is not empty, stops at the first unmatched closing
3230- # tag with that name. Nested tags supported.
3231- #
3232- # * If $span is true, text inside must treated as span. So any double
3233- # newline will be replaced by a single newline so that it does not create
3234- # paragraphs.
3235- #
3236- # Returns an array of that form: ( processed text , remaining text )
3237- #
3238- if ($text === '') return array('', '');
3239-
3240- # Regex to check for the presense of newlines around a block tag.
3241- $newline_before_re = '/(?:^\n?|\n\n)*$/';
3242- $newline_after_re =
3243- '{
3244- ^ # Start of text following the tag.
3245- (?>[ ]*<!--.*?-->)? # Optional comment.
3246- [ ]*\n # Must be followed by newline.
3247- }xs';
3248-
3249- # Regex to match any tag.
3250- $block_tag_re =
3251- '{
3252- ( # $2: Capture hole tag.
3253- </? # Any opening or closing tag.
3254- (?> # Tag name.
3255- '.$this->block_tags_re.' |
3256- '.$this->context_block_tags_re.' |
3257- '.$this->clean_tags_re.' |
3258- (?!\s)'.$enclosing_tag_re.'
3259- )
3260- (?:
3261- (?=[\s"\'/a-zA-Z0-9]) # Allowed characters after tag name.
3262- (?>
3263- ".*?" | # Double quotes (can contain `>`)
3264- \'.*?\' | # Single quotes (can contain `>`)
3265- .+? # Anything but quotes and `>`.
3266- )*?
3267- )?
3268- > # End of tag.
3269- |
3270- <!-- .*? --> # HTML Comment
3271- |
3272- <\?.*?\?> | <%.*?%> # Processing instruction
3273- |
3274- <!\[CDATA\[.*?\]\]> # CData Block
3275- |
3276- # Code span marker
3277- `+
3278- '. ( !$span ? ' # If not in span.
3279- |
3280- # Indented code block
3281- (?> ^[ ]*\n? | \n[ ]*\n )
3282- [ ]{'.($indent+4).'}[^\n]* \n
3283- (?>
3284- (?: [ ]{'.($indent+4).'}[^\n]* | [ ]* ) \n
3285- )*
3286- |
3287- # Fenced code block marker
3288- (?> ^ | \n )
3289- [ ]{'.($indent).'}~~~+[ ]*\n
3290- ' : '' ). ' # End (if not is span).
3291- )
3292- }xs';
3293-
3294-
3295- $depth = 0; # Current depth inside the tag tree.
3296- $parsed = ""; # Parsed text that will be returned.
3297-
3298- #
3299- # Loop through every tag until we find the closing tag of the parent
3300- # or loop until reaching the end of text if no parent tag specified.
3301- #
3302- do {
3303- #
3304- # Split the text using the first $tag_match pattern found.
3305- # Text before pattern will be first in the array, text after
3306- # pattern will be at the end, and between will be any catches made
3307- # by the pattern.
3308- #
3309- $parts = preg_split($block_tag_re, $text, 2,
3310- PREG_SPLIT_DELIM_CAPTURE);
3311-
3312- # If in Markdown span mode, add a empty-string span-level hash
3313- # after each newline to prevent triggering any block element.
3314- if ($span) {
3315- $void = $this->hashPart("", ':');
3316- $newline = "$void\n";
3317- $parts[0] = $void . str_replace("\n", $newline, $parts[0]) . $void;
3318- }
3319-
3320- $parsed .= $parts[0]; # Text before current tag.
3321-
3322- # If end of $text has been reached. Stop loop.
3323- if (count($parts) < 3) {
3324- $text = "";
3325- break;
3326- }
3327-
3328- $tag = $parts[1]; # Tag to handle.
3329- $text = $parts[2]; # Remaining text after current tag.
3330- $tag_re = preg_quote($tag); # For use in a regular expression.
3331-
3332- #
3333- # Check for: Code span marker
3334- #
3335- if ($tag{0} == "`") {
3336- # Find corresponding end marker.
3337- $tag_re = preg_quote($tag);
3338- if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}',
3339- $text, $matches))
3340- {
3341- # End marker found: pass text unchanged until marker.
3342- $parsed .= $tag . $matches[0];
3343- $text = substr($text, strlen($matches[0]));
3344- }
3345- else {
3346- # Unmatched marker: just skip it.
3347- $parsed .= $tag;
3348- }
3349- }
3350- #
3351- # Check for: Indented code block or fenced code block marker.
3352- #
3353- else if ($tag{0} == "\n" || $tag{0} == "~") {
3354- if ($tag{1} == "\n" || $tag{1} == " ") {
3355- # Indented code block: pass it unchanged, will be handled
3356- # later.
3357- $parsed .= $tag;
3358- }
3359- else {
3360- # Fenced code block marker: find matching end marker.
3361- $tag_re = preg_quote(trim($tag));
3362- if (preg_match('{^(?>.*\n)+?'.$tag_re.' *\n}', $text,
3363- $matches))
3364- {
3365- # End marker found: pass text unchanged until marker.
3366- $parsed .= $tag . $matches[0];
3367- $text = substr($text, strlen($matches[0]));
3368- }
3369- else {
3370- # No end marker: just skip it.
3371- $parsed .= $tag;
3372- }
3373- }
3374- }
3375- #
3376- # Check for: Opening Block level tag or
3377- # Opening Context Block tag (like ins and del)
3378- # used as a block tag (tag is alone on it's line).
3379- #
3380- else if (preg_match('{^<(?:'.$this->block_tags_re.')\b}', $tag) ||
3381- ( preg_match('{^<(?:'.$this->context_block_tags_re.')\b}', $tag) &&
3382- preg_match($newline_before_re, $parsed) &&
3383- preg_match($newline_after_re, $text) )
3384- )
3385- {
3386- # Need to parse tag and following text using the HTML parser.
3387- list($block_text, $text) =
3388- $this->_hashHTMLBlocks_inHTML($tag . $text, "hashBlock", true);
3389-
3390- # Make sure it stays outside of any paragraph by adding newlines.
3391- $parsed .= "\n\n$block_text\n\n";
3392- }
3393- #
3394- # Check for: Clean tag (like script, math)
3395- # HTML Comments, processing instructions.
3396- #
3397- else if (preg_match('{^<(?:'.$this->clean_tags_re.')\b}', $tag) ||
3398- $tag{1} == '!' || $tag{1} == '?')
3399- {
3400- # Need to parse tag and following text using the HTML parser.
3401- # (don't check for markdown attribute)
3402- list($block_text, $text) =
3403- $this->_hashHTMLBlocks_inHTML($tag . $text, "hashClean", false);
3404-
3405- $parsed .= $block_text;
3406- }
3407- #
3408- # Check for: Tag with same name as enclosing tag.
3409- #
3410- else if ($enclosing_tag_re !== '' &&
3411- # Same name as enclosing tag.
3412- preg_match('{^</?(?:'.$enclosing_tag_re.')\b}', $tag))
3413- {
3414- #
3415- # Increase/decrease nested tag count.
3416- #
3417- if ($tag{1} == '/') $depth--;
3418- else if ($tag{strlen($tag)-2} != '/') $depth++;
3419-
3420- if ($depth < 0) {
3421- #
3422- # Going out of parent element. Clean up and break so we
3423- # return to the calling function.
3424- #
3425- $text = $tag . $text;
3426- break;
3427- }
3428-
3429- $parsed .= $tag;
3430- }
3431- else {
3432- $parsed .= $tag;
3433- }
3434- } while ($depth >= 0);
3435-
3436- return array($parsed, $text);
3437- }
3438- function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
3439- #
3440- # Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags.
3441- #
3442- # * Calls $hash_method to convert any blocks.
3443- # * Stops when the first opening tag closes.
3444- # * $md_attr indicate if the use of the `markdown="1"` attribute is allowed.
3445- # (it is not inside clean tags)
3446- #
3447- # Returns an array of that form: ( processed text , remaining text )
3448- #
3449- if ($text === '') return array('', '');
3450-
3451- # Regex to match `markdown` attribute inside of a tag.
3452- $markdown_attr_re = '
3453- {
3454- \s* # Eat whitespace before the `markdown` attribute
3455- markdown
3456- \s*=\s*
3457- (?>
3458- (["\']) # $1: quote delimiter
3459- (.*?) # $2: attribute value
3460- \1 # matching delimiter
3461- |
3462- ([^\s>]*) # $3: unquoted attribute value
3463- )
3464- () # $4: make $3 always defined (avoid warnings)
3465- }xs';
3466-
3467- # Regex to match any tag.
3468- $tag_re = '{
3469- ( # $2: Capture hole tag.
3470- </? # Any opening or closing tag.
3471- [\w:$]+ # Tag name.
3472- (?:
3473- (?=[\s"\'/a-zA-Z0-9]) # Allowed characters after tag name.
3474- (?>
3475- ".*?" | # Double quotes (can contain `>`)
3476- \'.*?\' | # Single quotes (can contain `>`)
3477- .+? # Anything but quotes and `>`.
3478- )*?
3479- )?
3480- > # End of tag.
3481- |
3482- <!-- .*? --> # HTML Comment
3483- |
3484- <\?.*?\?> | <%.*?%> # Processing instruction
3485- |
3486- <!\[CDATA\[.*?\]\]> # CData Block
3487- )
3488- }xs';
3489-
3490- $original_text = $text; # Save original text in case of faliure.
3491-
3492- $depth = 0; # Current depth inside the tag tree.
3493- $block_text = ""; # Temporary text holder for current text.
3494- $parsed = ""; # Parsed text that will be returned.
3495-
3496- #
3497- # Get the name of the starting tag.
3498- # (This pattern makes $base_tag_name_re safe without quoting.)
3499- #
3500- if (preg_match('/^<([\w:$]*)\b/', $text, $matches))
3501- $base_tag_name_re = $matches[1];
3502-
3503- #
3504- # Loop through every tag until we find the corresponding closing tag.
3505- #
3506- do {
3507- #
3508- # Split the text using the first $tag_match pattern found.
3509- # Text before pattern will be first in the array, text after
3510- # pattern will be at the end, and between will be any catches made
3511- # by the pattern.
3512- #
3513- $parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
3514-
3515- if (count($parts) < 3) {
3516- #
3517- # End of $text reached with unbalenced tag(s).
3518- # In that case, we return original text unchanged and pass the
3519- # first character as filtered to prevent an infinite loop in the
3520- # parent function.
3521- #
3522- return array($original_text{0}, substr($original_text, 1));
3523- }
3524-
3525- $block_text .= $parts[0]; # Text before current tag.
3526- $tag = $parts[1]; # Tag to handle.
3527- $text = $parts[2]; # Remaining text after current tag.
3528-
3529- #
3530- # Check for: Auto-close tag (like <hr/>)
3531- # Comments and Processing Instructions.
3532- #
3533- if (preg_match('{^</?(?:'.$this->auto_close_tags_re.')\b}', $tag) ||
3534- $tag{1} == '!' || $tag{1} == '?')
3535- {
3536- # Just add the tag to the block as if it was text.
3537- $block_text .= $tag;
3538- }
3539- else {
3540- #
3541- # Increase/decrease nested tag count. Only do so if
3542- # the tag's name match base tag's.
3543- #
3544- if (preg_match('{^</?'.$base_tag_name_re.'\b}', $tag)) {
3545- if ($tag{1} == '/') $depth--;
3546- else if ($tag{strlen($tag)-2} != '/') $depth++;
3547- }
3548-
3549- #
3550- # Check for `markdown="1"` attribute and handle it.
3551- #
3552- if ($md_attr &&
3553- preg_match($markdown_attr_re, $tag, $attr_m) &&
3554- preg_match('/^1|block|span$/', $attr_m[2] . $attr_m[3]))
3555- {
3556- # Remove `markdown` attribute from opening tag.
3557- $tag = preg_replace($markdown_attr_re, '', $tag);
3558-
3559- # Check if text inside this tag must be parsed in span mode.
3560- $this->mode = $attr_m[2] . $attr_m[3];
3561- $span_mode = $this->mode == 'span' || $this->mode != 'block' &&
3562- preg_match('{^<(?:'.$this->contain_span_tags_re.')\b}', $tag);
3563-
3564- # Calculate indent before tag.
3565- if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) {
3566- $strlen = $this->utf8_strlen;
3567- $indent = $strlen($matches[1], 'UTF-8');
3568- } else {
3569- $indent = 0;
3570- }
3571-
3572- # End preceding block with this tag.
3573- $block_text .= $tag;
3574- $parsed .= $this->$hash_method($block_text);
3575-
3576- # Get enclosing tag name for the ParseMarkdown function.
3577- # (This pattern makes $tag_name_re safe without quoting.)
3578- preg_match('/^<([\w:$]*)\b/', $tag, $matches);
3579- $tag_name_re = $matches[1];
3580-
3581- # Parse the content using the HTML-in-Markdown parser.
3582- list ($block_text, $text)
3583- = $this->_hashHTMLBlocks_inMarkdown($text, $indent,
3584- $tag_name_re, $span_mode);
3585-
3586- # Outdent markdown text.
3587- if ($indent > 0) {
3588- $block_text = preg_replace("/^[ ]{1,$indent}/m", "",
3589- $block_text);
3590- }
3591-
3592- # Append tag content to parsed text.
3593- if (!$span_mode) $parsed .= "\n\n$block_text\n\n";
3594- else $parsed .= "$block_text";
3595-
3596- # Start over a new block.
3597- $block_text = "";
3598- }
3599- else $block_text .= $tag;
3600- }
3601-
3602- } while ($depth > 0);
3603-
3604- #
3605- # Hash last block text that wasn't processed inside the loop.
3606- #
3607- $parsed .= $this->$hash_method($block_text);
3608-
3609- return array($parsed, $text);
3610- }
3611-
3612-
3613- function hashClean($text) {
3614- #
3615- # Called whenever a tag must be hashed when a function insert a "clean" tag
3616- # in $text, it pass through this function and is automaticaly escaped,
3617- # blocking invalid nested overlap.
3618- #
3619- return $this->hashPart($text, 'C');
3620- }
3621-
3622-
3623- function doHeaders($text) {
3624- #
3625- # Redefined to add id attribute support.
3626- #
3627- # Setext-style headers:
3628- # Header 1 {#header1}
3629- # ========
3630- #
3631- # Header 2 {#header2}
3632- # --------
3633- #
3634- $text = preg_replace_callback(
3635- '{
3636- (^.+?) # $1: Header text
3637- (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? # $2: Id attribute
3638- [ ]*\n(=+|-+)[ ]*\n+ # $3: Header footer
3639- }mx',
3640- array(&$this, '_doHeaders_callback_setext'), $text);
3641-
3642- # atx-style headers:
3643- # # Header 1 {#header1}
3644- # ## Header 2 {#header2}
3645- # ## Header 2 with closing hashes ## {#header3}
3646- # ...
3647- # ###### Header 6 {#header2}
3648- #
3649- $text = preg_replace_callback('{
3650- ^(\#{1,6}) # $1 = string of #\'s
3651- [ ]*
3652- (.+?) # $2 = Header text
3653- [ ]*
3654- \#* # optional closing #\'s (not counted)
3655- (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? # id attribute
3656- [ ]*
3657- \n+
3658- }xm',
3659- array(&$this, '_doHeaders_callback_atx'), $text);
3660-
3661- return $text;
3662- }
3663- function _doHeaders_attr($attr) {
3664- if (empty($attr)) return "";
3665- return " id=\"$attr\"";
3666- }
3667- function _doHeaders_callback_setext($matches) {
3668- if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
3669- return $matches[0];
3670- $level = $matches[3]{0} == '=' ? 1 : 2;
3671- $attr = $this->_doHeaders_attr($id =& $matches[2]);
3672- $block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";
3673- return "\n" . $this->hashBlock($block) . "\n\n";
3674- }
3675- function _doHeaders_callback_atx($matches) {
3676- $level = strlen($matches[1]);
3677- $attr = $this->_doHeaders_attr($id =& $matches[3]);
3678- $block = "<h$level$attr>".$this->runSpanGamut($matches[2])."</h$level>";
3679- return "\n" . $this->hashBlock($block) . "\n\n";
3680- }
3681-
3682-
3683- function doTables($text) {
3684- #
3685- # Form HTML tables.
3686- #
3687- $less_than_tab = $this->tab_width - 1;
3688- #
3689- # Find tables with leading pipe.
3690- #
3691- # | Header 1 | Header 2
3692- # | -------- | --------
3693- # | Cell 1 | Cell 2
3694- # | Cell 3 | Cell 4
3695- #
3696- $text = preg_replace_callback('
3697- {
3698- ^ # Start of a line
3699- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
3700- [|] # Optional leading pipe (present)
3701- (.+) \n # $1: Header row (at least one pipe)
3702-
3703- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
3704- [|] ([ ]*[-:]+[-| :]*) \n # $2: Header underline
3705-
3706- ( # $3: Cells
3707- (?>
3708- [ ]* # Allowed whitespace.
3709- [|] .* \n # Row content.
3710- )*
3711- )
3712- (?=\n|\Z) # Stop at final double newline.
3713- }xm',
3714- array(&$this, '_doTable_leadingPipe_callback'), $text);
3715-
3716- #
3717- # Find tables without leading pipe.
3718- #
3719- # Header 1 | Header 2
3720- # -------- | --------
3721- # Cell 1 | Cell 2
3722- # Cell 3 | Cell 4
3723- #
3724- $text = preg_replace_callback('
3725- {
3726- ^ # Start of a line
3727- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
3728- (\S.*[|].*) \n # $1: Header row (at least one pipe)
3729-
3730- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
3731- ([-:]+[ ]*[|][-| :]*) \n # $2: Header underline
3732-
3733- ( # $3: Cells
3734- (?>
3735- .* [|] .* \n # Row content
3736- )*
3737- )
3738- (?=\n|\Z) # Stop at final double newline.
3739- }xm',
3740- array(&$this, '_DoTable_callback'), $text);
3741-
3742- return $text;
3743- }
3744- function _doTable_leadingPipe_callback($matches) {
3745- $head = $matches[1];
3746- $underline = $matches[2];
3747- $content = $matches[3];
3748-
3749- # Remove leading pipe for each row.
3750- $content = preg_replace('/^ *[|]/m', '', $content);
3751-
3752- return $this->_doTable_callback(array($matches[0], $head, $underline, $content));
3753- }
3754- function _doTable_callback($matches) {
3755- $head = $matches[1];
3756- $underline = $matches[2];
3757- $content = $matches[3];
3758-
3759- # Remove any tailing pipes for each line.
3760- $head = preg_replace('/[|] *$/m', '', $head);
3761- $underline = preg_replace('/[|] *$/m', '', $underline);
3762- $content = preg_replace('/[|] *$/m', '', $content);
3763-
3764- # Reading alignement from header underline.
3765- $separators = preg_split('/ *[|] */', $underline);
3766- foreach ($separators as $n => $s) {
3767- if (preg_match('/^ *-+: *$/', $s)) $attr[$n] = ' align="right"';
3768- else if (preg_match('/^ *:-+: *$/', $s))$attr[$n] = ' align="center"';
3769- else if (preg_match('/^ *:-+ *$/', $s)) $attr[$n] = ' align="left"';
3770- else $attr[$n] = '';
3771- }
3772-
3773- # Parsing span elements, including code spans, character escapes,
3774- # and inline HTML tags, so that pipes inside those gets ignored.
3775- $head = $this->parseSpan($head);
3776- $headers = preg_split('/ *[|] */', $head);
3777- $col_count = count($headers);
3778-
3779- # Write column headers.
3780- $text = "<table>\n";
3781- $text .= "<thead>\n";
3782- $text .= "<tr>\n";
3783- foreach ($headers as $n => $header)
3784- $text .= " <th$attr[$n]>".$this->runSpanGamut(trim($header))."</th>\n";
3785- $text .= "</tr>\n";
3786- $text .= "</thead>\n";
3787-
3788- # Split content by row.
3789- $rows = explode("\n", trim($content, "\n"));
3790-
3791- $text .= "<tbody>\n";
3792- foreach ($rows as $row) {
3793- # Parsing span elements, including code spans, character escapes,
3794- # and inline HTML tags, so that pipes inside those gets ignored.
3795- $row = $this->parseSpan($row);
3796-
3797- # Split row by cell.
3798- $row_cells = preg_split('/ *[|] */', $row, $col_count);
3799- $row_cells = array_pad($row_cells, $col_count, '');
3800-
3801- $text .= "<tr>\n";
3802- foreach ($row_cells as $n => $cell)
3803- $text .= " <td$attr[$n]>".$this->runSpanGamut(trim($cell))."</td>\n";
3804- $text .= "</tr>\n";
3805- }
3806- $text .= "</tbody>\n";
3807- $text .= "</table>";
3808-
3809- return $this->hashBlock($text) . "\n";
3810- }
3811-
3812-
3813- function doDefLists($text) {
3814- #
3815- # Form HTML definition lists.
3816- #
3817- $less_than_tab = $this->tab_width - 1;
3818-
3819- # Re-usable pattern to match any entire dl list:
3820- $whole_list_re = '(?>
3821- ( # $1 = whole list
3822- ( # $2
3823- [ ]{0,'.$less_than_tab.'}
3824- ((?>.*\S.*\n)+) # $3 = defined term
3825- \n?
3826- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
3827- )
3828- (?s:.+?)
3829- ( # $4
3830- \z
3831- |
3832- \n{2,}
3833- (?=\S)
3834- (?! # Negative lookahead for another term
3835- [ ]{0,'.$less_than_tab.'}
3836- (?: \S.*\n )+? # defined term
3837- \n?
3838- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
3839- )
3840- (?! # Negative lookahead for another definition
3841- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
3842- )
3843- )
3844- )
3845- )'; // mx
3846-
3847- $text = preg_replace_callback('{
3848- (?>\A\n?|(?<=\n\n))
3849- '.$whole_list_re.'
3850- }mx',
3851- array(&$this, '_doDefLists_callback'), $text);
3852-
3853- return $text;
3854- }
3855- function _doDefLists_callback($matches) {
3856- # Re-usable patterns to match list item bullets and number markers:
3857- $list = $matches[1];
3858-
3859- # Turn double returns into triple returns, so that we can make a
3860- # paragraph for the last item in a list, if necessary:
3861- $result = trim($this->processDefListItems($list));
3862- $result = "<dl>\n" . $result . "\n</dl>";
3863- return $this->hashBlock($result) . "\n\n";
3864- }
3865-
3866-
3867- function processDefListItems($list_str) {
3868- #
3869- # Process the contents of a single definition list, splitting it
3870- # into individual term and definition list items.
3871- #
3872- $less_than_tab = $this->tab_width - 1;
3873-
3874- # trim trailing blank lines:
3875- $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
3876-
3877- # Process definition terms.
3878- $list_str = preg_replace_callback('{
3879- (?>\A\n?|\n\n+) # leading line
3880- ( # definition terms = $1
3881- [ ]{0,'.$less_than_tab.'} # leading whitespace
3882- (?![:][ ]|[ ]) # negative lookahead for a definition
3883- # mark (colon) or more whitespace.
3884- (?> \S.* \n)+? # actual term (not whitespace).
3885- )
3886- (?=\n?[ ]{0,3}:[ ]) # lookahead for following line feed
3887- # with a definition mark.
3888- }xm',
3889- array(&$this, '_processDefListItems_callback_dt'), $list_str);
3890-
3891- # Process actual definitions.
3892- $list_str = preg_replace_callback('{
3893- \n(\n+)? # leading line = $1
3894- ( # marker space = $2
3895- [ ]{0,'.$less_than_tab.'} # whitespace before colon
3896- [:][ ]+ # definition mark (colon)
3897- )
3898- ((?s:.+?)) # definition text = $3
3899- (?= \n+ # stop at next definition mark,
3900- (?: # next term or end of text
3901- [ ]{0,'.$less_than_tab.'} [:][ ] |
3902- <dt> | \z
3903- )
3904- )
3905- }xm',
3906- array(&$this, '_processDefListItems_callback_dd'), $list_str);
3907-
3908- return $list_str;
3909- }
3910- function _processDefListItems_callback_dt($matches) {
3911- $terms = explode("\n", trim($matches[1]));
3912- $text = '';
3913- foreach ($terms as $term) {
3914- $term = $this->runSpanGamut(trim($term));
3915- $text .= "\n<dt>" . $term . "</dt>";
3916- }
3917- return $text . "\n";
3918- }
3919- function _processDefListItems_callback_dd($matches) {
3920- $leading_line = $matches[1];
3921- $marker_space = $matches[2];
3922- $def = $matches[3];
3923-
3924- if ($leading_line || preg_match('/\n{2,}/', $def)) {
3925- # Replace marker with the appropriate whitespace indentation
3926- $def = str_repeat(' ', strlen($marker_space)) . $def;
3927- $def = $this->runBlockGamut($this->outdent($def . "\n\n"));
3928- $def = "\n". $def ."\n";
3929- }
3930- else {
3931- $def = rtrim($def);
3932- $def = $this->runSpanGamut($this->outdent($def));
3933- }
3934-
3935- return "\n<dd>" . $def . "</dd>\n";
3936- }
3937-
3938-
3939- function doFencedCodeBlocks($text) {
3940- #
3941- # Adding the fenced code block syntax to regular Markdown:
3942- #
3943- # ~~~
3944- # Code block
3945- # ~~~
3946- #
3947- $less_than_tab = $this->tab_width;
3948-
3949- $text = preg_replace_callback('{
3950- (?:\n|\A)
3951- # 1: Opening marker
3952- (
3953- ~{3,} # Marker: three tilde or more.
3954- )
3955- [ ]* \n # Whitespace and newline following marker.
3956-
3957- # 2: Content
3958- (
3959- (?>
3960- (?!\1 [ ]* \n) # Not a closing marker.
3961- .*\n+
3962- )+
3963- )
3964-
3965- # Closing marker.
3966- \1 [ ]* \n
3967- }xm',
3968- array(&$this, '_doFencedCodeBlocks_callback'), $text);
3969-
3970- return $text;
3971- }
3972- function _doFencedCodeBlocks_callback($matches) {
3973- $codeblock = $matches[2];
3974- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
3975- $codeblock = preg_replace_callback('/^\n+/',
3976- array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
3977- $codeblock = "<pre><code>$codeblock</code></pre>";
3978- return "\n\n".$this->hashBlock($codeblock)."\n\n";
3979- }
3980- function _doFencedCodeBlocks_newlines($matches) {
3981- return str_repeat("<br$this->empty_element_suffix",
3982- strlen($matches[0]));
3983- }
3984-
3985-
3986- #
3987- # Redefining emphasis markers so that emphasis by underscore does not
3988- # work in the middle of a word.
3989- #
3990- var $em_relist = array(
3991- '' => '(?:(?<!\*)\*(?!\*)|(?<![a-zA-Z0-9_])_(?!_))(?=\S)(?![.,:;]\s)',
3992- '*' => '(?<=\S)(?<!\*)\*(?!\*)',
3993- '_' => '(?<=\S)(?<!_)_(?![a-zA-Z0-9_])',
3994- );
3995- var $strong_relist = array(
3996- '' => '(?:(?<!\*)\*\*(?!\*)|(?<![a-zA-Z0-9_])__(?!_))(?=\S)(?![.,:;]\s)',
3997- '**' => '(?<=\S)(?<!\*)\*\*(?!\*)',
3998- '__' => '(?<=\S)(?<!_)__(?![a-zA-Z0-9_])',
3999- );
4000- var $em_strong_relist = array(
4001- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<![a-zA-Z0-9_])___(?!_))(?=\S)(?![.,:;]\s)',
4002- '***' => '(?<=\S)(?<!\*)\*\*\*(?!\*)',
4003- '___' => '(?<=\S)(?<!_)___(?![a-zA-Z0-9_])',
4004- );
4005-
4006-
4007- function formParagraphs($text) {
4008- #
4009- # Params:
4010- # $text - string to process with html <p> tags
4011- #
4012- # Strip leading and trailing lines:
4013- $text = preg_replace('/\A\n+|\n+\z/', '', $text);
4014-
4015- $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
4016-
4017- #
4018- # Wrap <p> tags and unhashify HTML blocks
4019- #
4020- foreach ($grafs as $key => $value) {
4021- $value = trim($this->runSpanGamut($value));
4022-
4023- # Check if this should be enclosed in a paragraph.
4024- # Clean tag hashes & block tag hashes are left alone.
4025- $is_p = !preg_match('/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value);
4026-
4027- if ($is_p) {
4028- $value = "<p>$value</p>";
4029- }
4030- $grafs[$key] = $value;
4031- }
4032-
4033- # Join grafs in one text, then unhash HTML tags.
4034- $text = implode("\n\n", $grafs);
4035-
4036- # Finish by removing any tag hashes still present in $text.
4037- $text = $this->unhash($text);
4038-
4039- return $text;
4040- }
4041-
4042-
4043- ### Footnotes
4044-
4045- function stripFootnotes($text) {
4046- #
4047- # Strips link definitions from text, stores the URLs and titles in
4048- # hash references.
4049- #
4050- $less_than_tab = $this->tab_width - 1;
4051-
4052- # Link defs are in the form: [^id]: url "optional title"
4053- $text = preg_replace_callback('{
4054- ^[ ]{0,'.$less_than_tab.'}\[\^(.+?)\][ ]?: # note_id = $1
4055- [ ]*
4056- \n? # maybe *one* newline
4057- ( # text = $2 (no blank lines allowed)
4058- (?:
4059- .+ # actual text
4060- |
4061- \n # newlines but
4062- (?!\[\^.+?\]:\s)# negative lookahead for footnote marker.
4063- (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed
4064- # by non-indented content
4065- )*
4066- )
4067- }xm',
4068- array(&$this, '_stripFootnotes_callback'),
4069- $text);
4070- return $text;
4071- }
4072- function _stripFootnotes_callback($matches) {
4073- $note_id = $this->fn_id_prefix . $matches[1];
4074- $this->footnotes[$note_id] = $this->outdent($matches[2]);
4075- return ''; # String that will replace the block
4076- }
4077-
4078-
4079- function doFootnotes($text) {
4080- #
4081- # Replace footnote references in $text [^id] with a special text-token
4082- # which will be replaced by the actual footnote marker in appendFootnotes.
4083- #
4084- if (!$this->in_anchor) {
4085- $text = preg_replace('{\[\^(.+?)\]}', "F\x1Afn:\\1\x1A:", $text);
4086- }
4087- return $text;
4088- }
4089-
4090-
4091- function appendFootnotes($text) {
4092- #
4093- # Append footnote list to text.
4094- #
4095- $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
4096- array(&$this, '_appendFootnotes_callback'), $text);
4097-
4098- if (!empty($this->footnotes_ordered)) {
4099- $text .= "\n\n";
4100- $text .= "<div class=\"footnotes\">\n";
4101- $text .= "<hr". MARKDOWN_EMPTY_ELEMENT_SUFFIX ."\n";
4102- $text .= "<ol>\n\n";
4103-
4104- $attr = " rev=\"footnote\"";
4105- if ($this->fn_backlink_class != "") {
4106- $class = $this->fn_backlink_class;
4107- $class = $this->encodeAttribute($class);
4108- $attr .= " class=\"$class\"";
4109- }
4110- if ($this->fn_backlink_title != "") {
4111- $title = $this->fn_backlink_title;
4112- $title = $this->encodeAttribute($title);
4113- $attr .= " title=\"$title\"";
4114- }
4115- $num = 0;
4116-
4117- while (!empty($this->footnotes_ordered)) {
4118- $footnote = reset($this->footnotes_ordered);
4119- $note_id = key($this->footnotes_ordered);
4120- unset($this->footnotes_ordered[$note_id]);
4121-
4122- $footnote .= "\n"; # Need to append newline before parsing.
4123- $footnote = $this->runBlockGamut("$footnote\n");
4124- $footnote = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
4125- array(&$this, '_appendFootnotes_callback'), $footnote);
4126-
4127- $attr = str_replace("%%", ++$num, $attr);
4128- $note_id = $this->encodeAttribute($note_id);
4129-
4130- # Add backlink to last paragraph; create new paragraph if needed.
4131- $backlink = "<a href=\"#fnref:$note_id\"$attr>&#8617;</a>";
4132- if (preg_match('{</p>$}', $footnote)) {
4133- $footnote = substr($footnote, 0, -4) . "&#160;$backlink</p>";
4134- } else {
4135- $footnote .= "\n\n<p>$backlink</p>";
4136- }
4137-
4138- $text .= "<li id=\"fn:$note_id\">\n";
4139- $text .= $footnote . "\n";
4140- $text .= "</li>\n\n";
4141- }
4142-
4143- $text .= "</ol>\n";
4144- $text .= "</div>";
4145- }
4146- return $text;
4147- }
4148- function _appendFootnotes_callback($matches) {
4149- $node_id = $this->fn_id_prefix . $matches[1];
4150-
4151- # Create footnote marker only if it has a corresponding footnote *and*
4152- # the footnote hasn't been used by another marker.
4153- if (isset($this->footnotes[$node_id])) {
4154- # Transfert footnote content to the ordered list.
4155- $this->footnotes_ordered[$node_id] = $this->footnotes[$node_id];
4156- unset($this->footnotes[$node_id]);
4157-
4158- $num = $this->footnote_counter++;
4159- $attr = " rel=\"footnote\"";
4160- if ($this->fn_link_class != "") {
4161- $class = $this->fn_link_class;
4162- $class = $this->encodeAttribute($class);
4163- $attr .= " class=\"$class\"";
4164- }
4165- if ($this->fn_link_title != "") {
4166- $title = $this->fn_link_title;
4167- $title = $this->encodeAttribute($title);
4168- $attr .= " title=\"$title\"";
4169- }
4170-
4171- $attr = str_replace("%%", $num, $attr);
4172- $node_id = $this->encodeAttribute($node_id);
4173-
4174- return
4175- "<sup id=\"fnref:$node_id\">".
4176- "<a href=\"#fn:$node_id\"$attr>$num</a>".
4177- "</sup>";
4178- }
4179-
4180- return "[^".$matches[1]."]";
4181- }
4182-
4183-
4184- ### Abbreviations ###
4185-
4186- function stripAbbreviations($text) {
4187- #
4188- # Strips abbreviations from text, stores titles in hash references.
4189- #
4190- $less_than_tab = $this->tab_width - 1;
4191-
4192- # Link defs are in the form: [id]*: url "optional title"
4193- $text = preg_replace_callback('{
4194- ^[ ]{0,'.$less_than_tab.'}\*\[(.+?)\][ ]?: # abbr_id = $1
4195- (.*) # text = $2 (no blank lines allowed)
4196- }xm',
4197- array(&$this, '_stripAbbreviations_callback'),
4198- $text);
4199- return $text;
4200- }
4201- function _stripAbbreviations_callback($matches) {
4202- $abbr_word = $matches[1];
4203- $abbr_desc = $matches[2];
4204- if ($this->abbr_word_re)
4205- $this->abbr_word_re .= '|';
4206- $this->abbr_word_re .= preg_quote($abbr_word);
4207- $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
4208- return ''; # String that will replace the block
4209- }
4210-
4211-
4212- function doAbbreviations($text) {
4213- #
4214- # Find defined abbreviations in text and wrap them in <abbr> elements.
4215- #
4216- if ($this->abbr_word_re) {
4217- // cannot use the /x modifier because abbr_word_re may
4218- // contain significant spaces:
4219- $text = preg_replace_callback('{'.
4220- '(?<![\w\x1A])'.
4221- '(?:'.$this->abbr_word_re.')'.
4222- '(?![\w\x1A])'.
4223- '}',
4224- array(&$this, '_doAbbreviations_callback'), $text);
4225- }
4226- return $text;
4227- }
4228- function _doAbbreviations_callback($matches) {
4229- $abbr = $matches[0];
4230- if (isset($this->abbr_desciptions[$abbr])) {
4231- $desc = $this->abbr_desciptions[$abbr];
4232- if (empty($desc)) {
4233- return $this->hashPart("<abbr>$abbr</abbr>");
4234- } else {
4235- $desc = $this->encodeAttribute($desc);
4236- return $this->hashPart("<abbr title=\"$desc\">$abbr</abbr>");
4237- }
4238- } else {
4239- return $matches[0];
4240- }
4241- }
4242-
4243-}
4244-
4245-
4246-/*
4247-
4248-PHP Markdown Extra
4249-==================
4250-
4251-Description
4252------------
4253-
4254-This is a PHP port of the original Markdown formatter written in Perl
4255-by John Gruber. This special "Extra" version of PHP Markdown features
4256-further enhancements to the syntax for making additional constructs
4257-such as tables and definition list.
4258-
4259-Markdown is a text-to-HTML filter; it translates an easy-to-read /
4260-easy-to-write structured text format into HTML. Markdown's text format
4261-is most similar to that of plain text email, and supports features such
4262-as headers, *emphasis*, code blocks, blockquotes, and links.
4263-
4264-Markdown's syntax is designed not as a generic markup language, but
4265-specifically to serve as a front-end to (X)HTML. You can use span-level
4266-HTML tags anywhere in a Markdown document, and you can use block level
4267-HTML tags (like <div> and <table> as well).
4268-
4269-For more information about Markdown's syntax, see:
4270-
4271-<http://daringfireball.net/projects/markdown/>
4272-
4273-
4274-Bugs
4275-----
4276-
4277-To file bug reports please send email to:
4278-
4279-<michel.fortin@michelf.com>
4280-
4281-Please include with your report: (1) the example input; (2) the output you
4282-expected; (3) the output Markdown actually produced.
4283-
4284-
4285-Version History
4286----------------
4287-
4288-See the readme file for detailed release notes for this version.
4289-
4290-
4291-Copyright and License
4292----------------------
4293-
4294-PHP Markdown & Extra
4295-Copyright (c) 2004-2008 Michel Fortin
4296-<http://www.michelf.com/>
4297-All rights reserved.
4298-
4299-Based on Markdown
4300-Copyright (c) 2003-2006 John Gruber
4301-<http://daringfireball.net/>
4302-All rights reserved.
4303-
4304-Redistribution and use in source and binary forms, with or without
4305-modification, are permitted provided that the following conditions are
4306-met:
4307-
4308-* Redistributions of source code must retain the above copyright notice,
4309- this list of conditions and the following disclaimer.
4310-
4311-* Redistributions in binary form must reproduce the above copyright
4312- notice, this list of conditions and the following disclaimer in the
4313- documentation and/or other materials provided with the distribution.
4314-
4315-* Neither the name "Markdown" nor the names of its contributors may
4316- be used to endorse or promote products derived from this software
4317- without specific prior written permission.
4318-
4319-This software is provided by the copyright holders and contributors "as
4320-is" and any express or implied warranties, including, but not limited
4321-to, the implied warranties of merchantability and fitness for a
4322-particular purpose are disclaimed. In no event shall the copyright owner
4323-or contributors be liable for any direct, indirect, incidental, special,
4324-exemplary, or consequential damages (including, but not limited to,
4325-procurement of substitute goods or services; loss of use, data, or
4326-profits; or business interruption) however caused and on any theory of
4327-liability, whether in contract, strict liability, or tort (including
4328-negligence or otherwise) arising in any way out of the use of this
4329-software, even if advised of the possibility of such damage.
4330-
4331-*/
4332-?>
4333\ No newline at end of file
4334diff --git a/ivfdec.c b/ivfdec.c
4335index e4c9981..2b26d55 100644
4336--- a/ivfdec.c
4337+++ b/ivfdec.c
4338@@ -1,10 +1,11 @@
4339 /*
4340 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
4341 *
4342- * Use of this source code is governed by a BSD-style license and patent
4343- * grant that can be found in the LICENSE file in the root of the source
4344- * tree. All contributing project authors may be found in the AUTHORS
4345- * file in the root of the source tree.
4346+ * Use of this source code is governed by a BSD-style license
4347+ * that can be found in the LICENSE file in the root of the source
4348+ * tree. An additional intellectual property rights grant can be found
4349+ * in the file PATENTS. All contributing project authors may
4350+ * be found in the AUTHORS file in the root of the source tree.
4351 */
4352
4353
4354@@ -17,10 +18,10 @@
4355 #include <string.h>
4356 #define VPX_CODEC_DISABLE_COMPAT 1
4357 #include "vpx_config.h"
4358-#include "vpx_decoder.h"
4359+#include "vpx/vpx_decoder.h"
4360 #include "vpx_ports/vpx_timer.h"
4361 #if CONFIG_VP8_DECODER
4362-#include "vp8dx.h"
4363+#include "vpx/vp8dx.h"
4364 #endif
4365 #if CONFIG_MD5
4366 #include "md5_utils.h"
4367@@ -62,8 +63,10 @@ static const arg_def_t postprocarg = ARG_DEF(NULL, "postproc", 0,
4368 "Postprocess decoded frames");
4369 static const arg_def_t summaryarg = ARG_DEF(NULL, "summary", 0,
4370 "Show timing summary");
4371-static const arg_def_t outputfile = ARG_DEF("o", "output-raw-file", 1,
4372+static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
4373 "Output raw yv12 file instead of images");
4374+static const arg_def_t usey4marg = ARG_DEF("y", "y4m", 0,
4375+ "Output file is YUV4MPEG2");
4376 static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1,
4377 "Max threads to use");
4378 static const arg_def_t quietarg = ARG_DEF("q", "quiet", 0,
4379@@ -77,7 +80,7 @@ static const arg_def_t *all_args[] =
4380 {
4381 &codecarg, &prefixarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg,
4382 &progressarg, &limitarg, &postprocarg, &summaryarg, &outputfile,
4383- &threadsarg, &quietarg,
4384+ &usey4marg, &threadsarg, &quietarg,
4385 #if CONFIG_MD5
4386 &md5arg,
4387 #endif
4388@@ -232,9 +235,9 @@ void *out_open(const char *out_fn, int do_md5)
4389 if (do_md5)
4390 {
4391 #if CONFIG_MD5
4392- md5_ctx_t *md5_ctx = out = malloc(sizeof(md5_ctx_t));
4393+ MD5Context *md5_ctx = out = malloc(sizeof(MD5Context));
4394 (void)out_fn;
4395- md5_init(md5_ctx);
4396+ MD5Init(md5_ctx);
4397 #endif
4398 }
4399 else
4400@@ -256,7 +259,7 @@ void out_put(void *out, const uint8_t *buf, unsigned int len, int do_md5)
4401 if (do_md5)
4402 {
4403 #if CONFIG_MD5
4404- md5_update(out, buf, len);
4405+ MD5Update(out, buf, len);
4406 #endif
4407 }
4408 else
4409@@ -273,7 +276,7 @@ void out_close(void *out, const char *out_fn, int do_md5)
4410 uint8_t md5[16];
4411 int i;
4412
4413- md5_finalize(out, md5);
4414+ MD5Final(md5, out);
4415 free(out);
4416
4417 for (i = 0; i < 16; i++)
4418@@ -288,7 +291,12 @@ void out_close(void *out, const char *out_fn, int do_md5)
4419 }
4420 }
4421
4422-unsigned int file_is_ivf(FILE *infile, unsigned int *fourcc)
4423+unsigned int file_is_ivf(FILE *infile,
4424+ unsigned int *fourcc,
4425+ unsigned int *width,
4426+ unsigned int *height,
4427+ unsigned int *timebase_num,
4428+ unsigned int *timebase_den)
4429 {
4430 char raw_hdr[32];
4431 int is_ivf = 0;
4432@@ -305,6 +313,10 @@ unsigned int file_is_ivf(FILE *infile, unsigned int *fourcc)
4433 " decode properly.");
4434
4435 *fourcc = mem_get_le32(raw_hdr + 8);
4436+ *width = mem_get_le16(raw_hdr + 12);
4437+ *height = mem_get_le16(raw_hdr + 14);
4438+ *timebase_den = mem_get_le32(raw_hdr + 16);
4439+ *timebase_num = mem_get_le32(raw_hdr + 20);
4440 }
4441 }
4442
4443@@ -330,6 +342,11 @@ int main(int argc, const char **argv_)
4444 struct arg arg;
4445 char **argv, **argi, **argj;
4446 const char *fn2 = 0;
4447+ int use_y4m = 0;
4448+ unsigned int width;
4449+ unsigned int height;
4450+ unsigned int timebase_num;
4451+ unsigned int timebase_den;
4452 void *out = NULL;
4453 vpx_codec_dec_cfg_t cfg = {0};
4454 #if CONFIG_VP8_DECODER
4455@@ -361,6 +378,8 @@ int main(int argc, const char **argv_)
4456 }
4457 else if (arg_match(&arg, &outputfile, argi))
4458 fn2 = arg.val;
4459+ else if (arg_match(&arg, &usey4marg, argi))
4460+ use_y4m = 1;
4461 else if (arg_match(&arg, &prefixarg, argi))
4462 prefix = strdup(arg.val);
4463 else if (arg_match(&arg, &use_yv12, argi))
4464@@ -446,10 +465,31 @@ int main(int argc, const char **argv_)
4465 if (fn2)
4466 out = out_open(fn2, do_md5);
4467
4468- is_ivf = file_is_ivf(infile, &fourcc);
4469+ is_ivf = file_is_ivf(infile, &fourcc, &width, &height,
4470+ &timebase_num, &timebase_den);
4471
4472 if (is_ivf)
4473 {
4474+ if (use_y4m)
4475+ {
4476+ char buffer[128];
4477+ if (!fn2)
4478+ {
4479+ fprintf(stderr, "YUV4MPEG2 output only supported with -o.\n");
4480+ return EXIT_FAILURE;
4481+ }
4482+ /*Correct for the factor of 2 applied to the timebase in the
4483+ encoder.*/
4484+ if(timebase_den&1)timebase_num<<=1;
4485+ else timebase_den>>=1;
4486+ /*Note: We can't output an aspect ratio here because IVF doesn't
4487+ store one, and neither does VP8.
4488+ That will have to wait until these tools support WebM natively.*/
4489+ sprintf(buffer, "YUV4MPEG2 C%s W%u H%u F%u:%u I%c\n",
4490+ "420jpeg", width, height, timebase_den, timebase_num, 'p');
4491+ out_put(out, (unsigned char *)buffer, strlen(buffer), do_md5);
4492+ }
4493+
4494 /* Try to determine the codec from the fourcc. */
4495 for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
4496 if ((fourcc & ifaces[i].fourcc_mask) == ifaces[i].fourcc)
4497@@ -465,6 +505,11 @@ int main(int argc, const char **argv_)
4498 break;
4499 }
4500 }
4501+ else if(use_y4m)
4502+ {
4503+ fprintf(stderr, "YUV4MPEG2 output only supported from IVF input.\n");
4504+ return EXIT_FAILURE;
4505+ }
4506
4507 if (vpx_codec_dec_init(&decoder, iface ? iface : ifaces[0].iface, &cfg,
4508 postproc ? VPX_CODEC_USE_POSTPROC : 0))
4509@@ -533,29 +578,31 @@ int main(int argc, const char **argv_)
4510 prefix, img->d_w, img->d_h, frame_in, sfx);
4511 out = out_open(out_fn, do_md5);
4512 }
4513+ else if(use_y4m)
4514+ out_put(out, (unsigned char *)"FRAME\n", 6, do_md5);
4515
4516- buf = img->planes[PLANE_Y];
4517+ buf = img->planes[VPX_PLANE_Y];
4518
4519 for (y = 0; y < img->d_h; y++)
4520 {
4521 out_put(out, buf, img->d_w, do_md5);
4522- buf += img->stride[PLANE_Y];
4523+ buf += img->stride[VPX_PLANE_Y];
4524 }
4525
4526- buf = img->planes[flipuv?PLANE_V:PLANE_U];
4527+ buf = img->planes[flipuv?VPX_PLANE_V:VPX_PLANE_U];
4528
4529 for (y = 0; y < (1 + img->d_h) / 2; y++)
4530 {
4531 out_put(out, buf, (1 + img->d_w) / 2, do_md5);
4532- buf += img->stride[PLANE_U];
4533+ buf += img->stride[VPX_PLANE_U];
4534 }
4535
4536- buf = img->planes[flipuv?PLANE_U:PLANE_V];
4537+ buf = img->planes[flipuv?VPX_PLANE_U:VPX_PLANE_V];
4538
4539 for (y = 0; y < (1 + img->d_h) / 2; y++)
4540 {
4541 out_put(out, buf, (1 + img->d_w) / 2, do_md5);
4542- buf += img->stride[PLANE_V];
4543+ buf += img->stride[VPX_PLANE_V];
4544 }
4545
4546 if (!fn2)
4547diff --git a/ivfenc.c b/ivfenc.c
4548index bef3d58..11f2a8f 100644
4549--- a/ivfenc.c
4550+++ b/ivfenc.c
4551@@ -1,23 +1,28 @@
4552 /*
4553 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
4554 *
4555- * Use of this source code is governed by a BSD-style license and patent
4556- * grant that can be found in the LICENSE file in the root of the source
4557- * tree. All contributing project authors may be found in the AUTHORS
4558- * file in the root of the source tree.
4559+ * Use of this source code is governed by a BSD-style license
4560+ * that can be found in the LICENSE file in the root of the source
4561+ * tree. An additional intellectual property rights grant can be found
4562+ * in the file PATENTS. All contributing project authors may
4563+ * be found in the AUTHORS file in the root of the source tree.
4564 */
4565
4566
4567 /* This is a simple program that encodes YV12 files and generates ivf
4568 * files using the new interface.
4569 */
4570-#define USE_POSIX_MMAP HAVE_SYS_MMAN_H
4571+#if defined(_WIN32)
4572+#define USE_POSIX_MMAP 0
4573+#else
4574+#define USE_POSIX_MMAP 1
4575+#endif
4576
4577 #include <stdio.h>
4578 #include <stdlib.h>
4579 #include <stdarg.h>
4580 #include <string.h>
4581-#include "vpx_encoder.h"
4582+#include "vpx/vpx_encoder.h"
4583 #if USE_POSIX_MMAP
4584 #include <sys/types.h>
4585 #include <sys/stat.h>
4586@@ -25,11 +30,10 @@
4587 #include <fcntl.h>
4588 #include <unistd.h>
4589 #endif
4590-#if CONFIG_VP8_ENCODER
4591-#include "vp8cx.h"
4592-#endif
4593+#include "vpx/vp8cx.h"
4594 #include "vpx_ports/mem_ops.h"
4595 #include "vpx_ports/vpx_timer.h"
4596+#include "y4minput.h"
4597
4598 static const char *exec_name;
4599
4600@@ -51,8 +55,8 @@ void die(const char *fmt, ...)
4601 {
4602 va_list ap;
4603 va_start(ap, fmt);
4604- vprintf(fmt, ap);
4605- printf("\n");
4606+ vfprintf(stderr, fmt, ap);
4607+ fprintf(stderr, "\n");
4608 usage_exit();
4609 }
4610
4611@@ -62,10 +66,10 @@ static void ctx_exit_on_error(vpx_codec_ctx_t *ctx, const char *s)
4612 {
4613 const char *detail = vpx_codec_error_detail(ctx);
4614
4615- printf("%s: %s\n", s, vpx_codec_error(ctx));
4616+ fprintf(stderr, "%s: %s\n", s, vpx_codec_error(ctx));
4617
4618 if (detail)
4619- printf(" %s\n", detail);
4620+ fprintf(stderr, " %s\n", detail);
4621
4622 exit(EXIT_FAILURE);
4623 }
4624@@ -215,49 +219,79 @@ vpx_fixed_buf_t stats_get(stats_io_t *stats)
4625 return stats->buf;
4626 }
4627
4628+enum video_file_type
4629+{
4630+ FILE_TYPE_RAW,
4631+ FILE_TYPE_IVF,
4632+ FILE_TYPE_Y4M
4633+};
4634+
4635+struct detect_buffer {
4636+ char buf[4];
4637+ int valid;
4638+};
4639+
4640+
4641 #define IVF_FRAME_HDR_SZ (4+8) /* 4 byte size + 8 byte timestamp */
4642-static int read_frame(FILE *f, vpx_image_t *img, unsigned int is_ivf)
4643+static int read_frame(FILE *f, vpx_image_t *img, unsigned int file_type,
4644+ y4m_input *y4m, struct detect_buffer *detect)
4645 {
4646 int plane = 0;
4647
4648- if (is_ivf)
4649+ if (file_type == FILE_TYPE_Y4M)
4650 {
4651- char junk[IVF_FRAME_HDR_SZ];
4652-
4653- /* Skip the frame header. We know how big the frame should be. See
4654- * write_ivf_frame_header() for documentation on the frame header
4655- * layout.
4656- */
4657- fread(junk, 1, IVF_FRAME_HDR_SZ, f);
4658+ if (y4m_input_fetch_frame(y4m, f, img) < 0)
4659+ return 0;
4660 }
4661-
4662- for (plane = 0; plane < 3; plane++)
4663+ else
4664 {
4665- unsigned char *ptr;
4666- int w = (plane ? (1 + img->d_w) / 2 : img->d_w);
4667- int h = (plane ? (1 + img->d_h) / 2 : img->d_h);
4668- int r;
4669-
4670- /* Determine the correct plane based on the image format. The for-loop
4671- * always counts in Y,U,V order, but this may not match the order of
4672- * the data on disk.
4673- */
4674- switch (plane)
4675+ if (file_type == FILE_TYPE_IVF)
4676 {
4677- case 1:
4678- ptr = img->planes[img->fmt==IMG_FMT_YV12? PLANE_V : PLANE_U];
4679- break;
4680- case 2:
4681- ptr = img->planes[img->fmt==IMG_FMT_YV12?PLANE_U : PLANE_V];
4682- break;
4683- default:
4684- ptr = img->planes[plane];
4685+ char junk[IVF_FRAME_HDR_SZ];
4686+
4687+ /* Skip the frame header. We know how big the frame should be. See
4688+ * write_ivf_frame_header() for documentation on the frame header
4689+ * layout.
4690+ */
4691+ fread(junk, 1, IVF_FRAME_HDR_SZ, f);
4692 }
4693
4694- for (r = 0; r < h; r++)
4695+ for (plane = 0; plane < 3; plane++)
4696 {
4697- fread(ptr, 1, w, f);
4698- ptr += img->stride[plane];
4699+ unsigned char *ptr;
4700+ int w = (plane ? (1 + img->d_w) / 2 : img->d_w);
4701+ int h = (plane ? (1 + img->d_h) / 2 : img->d_h);
4702+ int r;
4703+
4704+ /* Determine the correct plane based on the image format. The for-loop
4705+ * always counts in Y,U,V order, but this may not match the order of
4706+ * the data on disk.
4707+ */
4708+ switch (plane)
4709+ {
4710+ case 1:
4711+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12? VPX_PLANE_V : VPX_PLANE_U];
4712+ break;
4713+ case 2:
4714+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12?VPX_PLANE_U : VPX_PLANE_V];
4715+ break;
4716+ default:
4717+ ptr = img->planes[plane];
4718+ }
4719+
4720+ for (r = 0; r < h; r++)
4721+ {
4722+ if (detect->valid)
4723+ {
4724+ memcpy(ptr, detect->buf, 4);
4725+ fread(ptr+4, 1, w-4, f);
4726+ detect->valid = 0;
4727+ }
4728+ else
4729+ fread(ptr, 1, w, f);
4730+
4731+ ptr += img->stride[plane];
4732+ }
4733 }
4734 }
4735
4736@@ -265,22 +299,36 @@ static int read_frame(FILE *f, vpx_image_t *img, unsigned int is_ivf)
4737 }
4738
4739
4740+unsigned int file_is_y4m(FILE *infile,
4741+ y4m_input *y4m,
4742+ char detect[4])
4743+{
4744+ if(memcmp(detect, "YUV4", 4) == 0)
4745+ {
4746+ return 1;
4747+ }
4748+ return 0;
4749+}
4750+
4751 #define IVF_FILE_HDR_SZ (32)
4752 unsigned int file_is_ivf(FILE *infile,
4753 unsigned int *fourcc,
4754 unsigned int *width,
4755- unsigned int *height)
4756+ unsigned int *height,
4757+ char detect[4])
4758 {
4759 char raw_hdr[IVF_FILE_HDR_SZ];
4760 int is_ivf = 0;
4761
4762+ if(memcmp(detect, "DKIF", 4) != 0)
4763+ return 0;
4764+
4765 /* See write_ivf_file_header() for more documentation on the file header
4766 * layout.
4767 */
4768- if (fread(raw_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ)
4769+ if (fread(raw_hdr + 4, 1, IVF_FILE_HDR_SZ - 4, infile)
4770+ == IVF_FILE_HDR_SZ - 4)
4771 {
4772- if (raw_hdr[0] == 'D' && raw_hdr[1] == 'K'
4773- && raw_hdr[2] == 'I' && raw_hdr[3] == 'F')
4774 {
4775 is_ivf = 1;
4776
4777@@ -297,8 +345,6 @@ unsigned int file_is_ivf(FILE *infile,
4778 *width = mem_get_le16(raw_hdr + 12);
4779 *height = mem_get_le16(raw_hdr + 14);
4780 }
4781- else
4782- rewind(infile);
4783
4784 return is_ivf;
4785 }
4786@@ -512,28 +558,28 @@ static void usage_exit()
4787 {
4788 int i;
4789
4790- printf("Usage: %s <options> src_filename dst_filename\n", exec_name);
4791+ fprintf(stderr, "Usage: %s <options> src_filename dst_filename\n", exec_name);
4792
4793- printf("\n_options:\n");
4794+ fprintf(stderr, "\n_options:\n");
4795 arg_show_usage(stdout, main_args);
4796- printf("\n_encoder Global Options:\n");
4797+ fprintf(stderr, "\n_encoder Global Options:\n");
4798 arg_show_usage(stdout, global_args);
4799- printf("\n_rate Control Options:\n");
4800+ fprintf(stderr, "\n_rate Control Options:\n");
4801 arg_show_usage(stdout, rc_args);
4802- printf("\n_twopass Rate Control Options:\n");
4803+ fprintf(stderr, "\n_twopass Rate Control Options:\n");
4804 arg_show_usage(stdout, rc_twopass_args);
4805- printf("\n_keyframe Placement Options:\n");
4806+ fprintf(stderr, "\n_keyframe Placement Options:\n");
4807 arg_show_usage(stdout, kf_args);
4808 #if CONFIG_VP8_ENCODER
4809- printf("\n_vp8 Specific Options:\n");
4810+ fprintf(stderr, "\n_vp8 Specific Options:\n");
4811 arg_show_usage(stdout, vp8_args);
4812 #endif
4813- printf("\n"
4814+ fprintf(stderr, "\n"
4815 "Included encoders:\n"
4816 "\n");
4817
4818 for (i = 0; i < sizeof(codecs) / sizeof(codecs[0]); i++)
4819- printf(" %-6s - %s\n",
4820+ fprintf(stderr, " %-6s - %s\n",
4821 codecs[i].name,
4822 vpx_codec_iface_name(codecs[i].iface));
4823
4824@@ -566,8 +612,10 @@ int main(int argc, const char **argv_)
4825 static const int *ctrl_args_map = NULL;
4826 int verbose = 0, show_psnr = 0;
4827 int arg_use_i420 = 1;
4828+ int arg_have_timebase = 0;
4829 unsigned long cx_time = 0;
4830- unsigned int is_ivf, fourcc;
4831+ unsigned int file_type, fourcc;
4832+ y4m_input y4m;
4833
4834 exec_name = argv_[0];
4835
4836@@ -651,7 +699,7 @@ int main(int argc, const char **argv_)
4837 /* DWIM: Assume the user meant passes=2 if pass=2 is specified */
4838 if (one_pass_only > arg_passes)
4839 {
4840- printf("Warning: Assuming --pass=%d implies --passes=%d\n",
4841+ fprintf(stderr, "Warning: Assuming --pass=%d implies --passes=%d\n",
4842 one_pass_only, one_pass_only);
4843 arg_passes = one_pass_only;
4844 }
4845@@ -665,7 +713,8 @@ int main(int argc, const char **argv_)
4846
4847 if (res)
4848 {
4849- printf("Failed to get config: %s\n", vpx_codec_err_to_string(res));
4850+ fprintf(stderr, "Failed to get config: %s\n",
4851+ vpx_codec_err_to_string(res));
4852 return EXIT_FAILURE;
4853 }
4854
4855@@ -684,7 +733,10 @@ int main(int argc, const char **argv_)
4856 else if (arg_match(&arg, &height, argi))
4857 cfg.g_h = arg_parse_uint(&arg);
4858 else if (arg_match(&arg, &timebase, argi))
4859+ {
4860 cfg.g_timebase = arg_parse_rational(&arg);
4861+ arg_have_timebase = 1;
4862+ }
4863 else if (arg_match(&arg, &error_resilient, argi))
4864 cfg.g_error_resilient = arg_parse_uint(&arg);
4865 else if (arg_match(&arg, &lag_in_frames, argi))
4866@@ -722,24 +774,27 @@ int main(int argc, const char **argv_)
4867 cfg.rc_2pass_vbr_bias_pct = arg_parse_uint(&arg);
4868
4869 if (arg_passes < 2)
4870- printf("Warning: option %s ignored in one-pass mode.\n",
4871- arg.name);
4872+ fprintf(stderr,
4873+ "Warning: option %s ignored in one-pass mode.\n",
4874+ arg.name);
4875 }
4876 else if (arg_match(&arg, &minsection_pct, argi))
4877 {
4878 cfg.rc_2pass_vbr_minsection_pct = arg_parse_uint(&arg);
4879
4880 if (arg_passes < 2)
4881- printf("Warning: option %s ignored in one-pass mode.\n",
4882- arg.name);
4883+ fprintf(stderr,
4884+ "Warning: option %s ignored in one-pass mode.\n",
4885+ arg.name);
4886 }
4887 else if (arg_match(&arg, &maxsection_pct, argi))
4888 {
4889 cfg.rc_2pass_vbr_maxsection_pct = arg_parse_uint(&arg);
4890
4891 if (arg_passes < 2)
4892- printf("Warning: option %s ignored in one-pass mode.\n",
4893- arg.name);
4894+ fprintf(stderr,
4895+ "Warning: option %s ignored in one-pass mode.\n",
4896+ arg.name);
4897 }
4898 else if (arg_match(&arg, &kf_min_dist, argi))
4899 cfg.kf_min_dist = arg_parse_uint(&arg);
4900@@ -787,7 +842,7 @@ int main(int argc, const char **argv_)
4901
4902 /* Check for unrecognized options */
4903 for (argi = argv; *argi; argi++)
4904- if (argi[0][0] == '-')
4905+ if (argi[0][0] == '-' && argi[0][1])
4906 die("Error: Unrecognized option %s\n", *argi);
4907
4908 /* Handle non-option arguments */
4909@@ -797,106 +852,134 @@ int main(int argc, const char **argv_)
4910 if (!in_fn || !out_fn)
4911 usage_exit();
4912
4913- /* Parse certain options from the input file, if possible */
4914- infile = fopen(in_fn, "rb");
4915-
4916- if (!infile)
4917- {
4918- printf("Failed to open input file");
4919- return EXIT_FAILURE;
4920- }
4921-
4922- is_ivf = file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h);
4923-
4924- if (is_ivf)
4925- {
4926- switch (fourcc)
4927- {
4928- case 0x32315659:
4929- arg_use_i420 = 0;
4930- break;
4931- case 0x30323449:
4932- arg_use_i420 = 1;
4933- break;
4934- default:
4935- printf("Unsupported fourcc (%08x) in IVF\n", fourcc);
4936- return EXIT_FAILURE;
4937- }
4938- }
4939-
4940- fclose(infile);
4941-
4942-
4943-#define SHOW(field) printf(" %-28s = %d\n", #field, cfg.field)
4944-
4945- if (verbose)
4946- {
4947- printf("Codec: %s\n", vpx_codec_iface_name(codec->iface));
4948- printf("Source file: %s Format: %s\n", in_fn, arg_use_i420 ? "I420" : "YV12");
4949- printf("Destination file: %s\n", out_fn);
4950- printf("Encoder parameters:\n");
4951-
4952- SHOW(g_usage);
4953- SHOW(g_threads);
4954- SHOW(g_profile);
4955- SHOW(g_w);
4956- SHOW(g_h);
4957- SHOW(g_timebase.num);
4958- SHOW(g_timebase.den);
4959- SHOW(g_error_resilient);
4960- SHOW(g_pass);
4961- SHOW(g_lag_in_frames);
4962- SHOW(rc_dropframe_thresh);
4963- SHOW(rc_resize_allowed);
4964- SHOW(rc_resize_up_thresh);
4965- SHOW(rc_resize_down_thresh);
4966- SHOW(rc_end_usage);
4967- SHOW(rc_target_bitrate);
4968- SHOW(rc_min_quantizer);
4969- SHOW(rc_max_quantizer);
4970- SHOW(rc_undershoot_pct);
4971- SHOW(rc_overshoot_pct);
4972- SHOW(rc_buf_sz);
4973- SHOW(rc_buf_initial_sz);
4974- SHOW(rc_buf_optimal_sz);
4975- SHOW(rc_2pass_vbr_bias_pct);
4976- SHOW(rc_2pass_vbr_minsection_pct);
4977- SHOW(rc_2pass_vbr_maxsection_pct);
4978- SHOW(kf_mode);
4979- SHOW(kf_min_dist);
4980- SHOW(kf_max_dist);
4981- }
4982-
4983- vpx_img_alloc(&raw, arg_use_i420 ? IMG_FMT_I420 : IMG_FMT_YV12,
4984- cfg.g_w, cfg.g_h, 1);
4985-
4986- // This was added so that ivfenc will create monotically increasing
4987- // timestamps. Since we create new timestamps for alt-reference frames
4988- // we need to make room in the series of timestamps. Since there can
4989- // only be 1 alt-ref frame ( current bitstream) multiplying by 2
4990- // gives us enough room.
4991- cfg.g_timebase.den *= 2;
4992-
4993 memset(&stats, 0, sizeof(stats));
4994
4995 for (pass = one_pass_only ? one_pass_only - 1 : 0; pass < arg_passes; pass++)
4996 {
4997 int frames_in = 0, frames_out = 0;
4998 unsigned long nbytes = 0;
4999+ struct detect_buffer detect;
5000
5001- infile = fopen(in_fn, "rb");
5002+ /* Parse certain options from the input file, if possible */
5003+ infile = strcmp(in_fn, "-") ? fopen(in_fn, "rb") : stdin;
5004
5005 if (!infile)
5006 {
5007- printf("Failed to open input file");
5008+ fprintf(stderr, "Failed to open input file\n");
5009 return EXIT_FAILURE;
5010 }
5011
5012- outfile = fopen(out_fn, "wb");
5013+ fread(detect.buf, 1, 4, infile);
5014+ detect.valid = 0;
5015+
5016+ if (file_is_y4m(infile, &y4m, detect.buf))
5017+ {
5018+ if (y4m_input_open(&y4m, infile, detect.buf, 4) >= 0)
5019+ {
5020+ file_type = FILE_TYPE_Y4M;
5021+ cfg.g_w = y4m.pic_w;
5022+ cfg.g_h = y4m.pic_h;
5023+ /* Use the frame rate from the file only if none was specified
5024+ * on the command-line.
5025+ */
5026+ if (!arg_have_timebase)
5027+ {
5028+ cfg.g_timebase.num = y4m.fps_d;
5029+ cfg.g_timebase.den = y4m.fps_n;
5030+ }
5031+ arg_use_i420 = 0;
5032+ }
5033+ else
5034+ {
5035+ fprintf(stderr, "Unsupported Y4M stream.\n");
5036+ return EXIT_FAILURE;
5037+ }
5038+ }
5039+ else if (file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))
5040+ {
5041+ file_type = FILE_TYPE_IVF;
5042+ switch (fourcc)
5043+ {
5044+ case 0x32315659:
5045+ arg_use_i420 = 0;
5046+ break;
5047+ case 0x30323449:
5048+ arg_use_i420 = 1;
5049+ break;
5050+ default:
5051+ fprintf(stderr, "Unsupported fourcc (%08x) in IVF\n", fourcc);
5052+ return EXIT_FAILURE;
5053+ }
5054+ }
5055+ else
5056+ {
5057+ file_type = FILE_TYPE_RAW;
5058+ detect.valid = 1;
5059+ }
5060+#define SHOW(field) fprintf(stderr, " %-28s = %d\n", #field, cfg.field)
5061+
5062+ if (verbose && pass == 0)
5063+ {
5064+ fprintf(stderr, "Codec: %s\n", vpx_codec_iface_name(codec->iface));
5065+ fprintf(stderr, "Source file: %s Format: %s\n", in_fn,
5066+ arg_use_i420 ? "I420" : "YV12");
5067+ fprintf(stderr, "Destination file: %s\n", out_fn);
5068+ fprintf(stderr, "Encoder parameters:\n");
5069+
5070+ SHOW(g_usage);
5071+ SHOW(g_threads);
5072+ SHOW(g_profile);
5073+ SHOW(g_w);
5074+ SHOW(g_h);
5075+ SHOW(g_timebase.num);
5076+ SHOW(g_timebase.den);
5077+ SHOW(g_error_resilient);
5078+ SHOW(g_pass);
5079+ SHOW(g_lag_in_frames);
5080+ SHOW(rc_dropframe_thresh);
5081+ SHOW(rc_resize_allowed);
5082+ SHOW(rc_resize_up_thresh);
5083+ SHOW(rc_resize_down_thresh);
5084+ SHOW(rc_end_usage);
5085+ SHOW(rc_target_bitrate);
5086+ SHOW(rc_min_quantizer);
5087+ SHOW(rc_max_quantizer);
5088+ SHOW(rc_undershoot_pct);
5089+ SHOW(rc_overshoot_pct);
5090+ SHOW(rc_buf_sz);
5091+ SHOW(rc_buf_initial_sz);
5092+ SHOW(rc_buf_optimal_sz);
5093+ SHOW(rc_2pass_vbr_bias_pct);
5094+ SHOW(rc_2pass_vbr_minsection_pct);
5095+ SHOW(rc_2pass_vbr_maxsection_pct);
5096+ SHOW(kf_mode);
5097+ SHOW(kf_min_dist);
5098+ SHOW(kf_max_dist);
5099+ }
5100+
5101+ if(pass == (one_pass_only ? one_pass_only - 1 : 0)) {
5102+ if (file_type == FILE_TYPE_Y4M)
5103+ /*The Y4M reader does its own allocation.
5104+ Just initialize this here to avoid problems if we never read any
5105+ frames.*/
5106+ memset(&raw, 0, sizeof(raw));
5107+ else
5108+ vpx_img_alloc(&raw, arg_use_i420 ? VPX_IMG_FMT_I420 : VPX_IMG_FMT_YV12,
5109+ cfg.g_w, cfg.g_h, 1);
5110+
5111+ // This was added so that ivfenc will create monotically increasing
5112+ // timestamps. Since we create new timestamps for alt-reference frames
5113+ // we need to make room in the series of timestamps. Since there can
5114+ // only be 1 alt-ref frame ( current bitstream) multiplying by 2
5115+ // gives us enough room.
5116+ cfg.g_timebase.den *= 2;
5117+ }
5118+
5119+ outfile = strcmp(out_fn, "-") ? fopen(out_fn, "wb") : stdout;
5120
5121 if (!outfile)
5122 {
5123- printf("Failed to open output file");
5124+ fprintf(stderr, "Failed to open output file\n");
5125 return EXIT_FAILURE;
5126 }
5127
5128@@ -904,7 +987,7 @@ int main(int argc, const char **argv_)
5129 {
5130 if (!stats_open_file(&stats, stats_fn, pass))
5131 {
5132- printf("Failed to open statistics store\n");
5133+ fprintf(stderr, "Failed to open statistics store\n");
5134 return EXIT_FAILURE;
5135 }
5136 }
5137@@ -912,7 +995,7 @@ int main(int argc, const char **argv_)
5138 {
5139 if (!stats_open_mem(&stats, pass))
5140 {
5141- printf("Failed to open statistics store\n");
5142+ fprintf(stderr, "Failed to open statistics store\n");
5143 return EXIT_FAILURE;
5144 }
5145 }
5146@@ -947,8 +1030,8 @@ int main(int argc, const char **argv_)
5147 for (i = 0; i < arg_ctrl_cnt; i++)
5148 {
5149 if (vpx_codec_control_(&encoder, arg_ctrls[i][0], arg_ctrls[i][1]))
5150- printf("Error: Tried to set control %d = %d\n",
5151- arg_ctrls[i][0], arg_ctrls[i][1]);
5152+ fprintf(stderr, "Error: Tried to set control %d = %d\n",
5153+ arg_ctrls[i][0], arg_ctrls[i][1]);
5154
5155 ctx_exit_on_error(&encoder, "Failed to control codec");
5156 }
5157@@ -964,13 +1047,15 @@ int main(int argc, const char **argv_)
5158
5159 if (!arg_limit || frames_in < arg_limit)
5160 {
5161- frame_avail = read_frame(infile, &raw, is_ivf);
5162+ frame_avail = read_frame(infile, &raw, file_type, &y4m,
5163+ &detect);
5164
5165 if (frame_avail)
5166 frames_in++;
5167
5168- printf("\rPass %d/%d frame %4d/%-4d %7ldB \033[K", pass + 1,
5169- arg_passes, frames_in, frames_out, nbytes);
5170+ fprintf(stderr,
5171+ "\rPass %d/%d frame %4d/%-4d %7ldB \033[K", pass + 1,
5172+ arg_passes, frames_in, frames_out, nbytes);
5173 }
5174 else
5175 frame_avail = 0;
5176@@ -989,24 +1074,25 @@ int main(int argc, const char **argv_)
5177 while ((pkt = vpx_codec_get_cx_data(&encoder, &iter)))
5178 {
5179 got_data = 1;
5180- nbytes += pkt->data.raw.sz;
5181
5182 switch (pkt->kind)
5183 {
5184 case VPX_CODEC_CX_FRAME_PKT:
5185 frames_out++;
5186- printf(" %6luF",
5187- (unsigned long)pkt->data.frame.sz);
5188+ fprintf(stderr, " %6luF",
5189+ (unsigned long)pkt->data.frame.sz);
5190 write_ivf_frame_header(outfile, pkt);
5191 fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile);
5192+ nbytes += pkt->data.raw.sz;
5193 break;
5194 case VPX_CODEC_STATS_PKT:
5195 frames_out++;
5196- printf(" %6luS",
5197+ fprintf(stderr, " %6luS",
5198 (unsigned long)pkt->data.twopass_stats.sz);
5199 stats_write(&stats,
5200 pkt->data.twopass_stats.buf,
5201 pkt->data.twopass_stats.sz);
5202+ nbytes += pkt->data.raw.sz;
5203 break;
5204 case VPX_CODEC_PSNR_PKT:
5205
5206@@ -1015,7 +1101,7 @@ int main(int argc, const char **argv_)
5207 int i;
5208
5209 for (i = 0; i < 4; i++)
5210- printf("%.3lf ", pkt->data.psnr.psnr[i]);
5211+ fprintf(stderr, "%.3lf ", pkt->data.psnr.psnr[i]);
5212 }
5213
5214 break;
5215@@ -1030,10 +1116,11 @@ int main(int argc, const char **argv_)
5216 /* this bitrate calc is simplified and relies on the fact that this
5217 * application uses 1/timebase for framerate.
5218 */
5219- printf("\rPass %d/%d frame %4d/%-4d %7ldB %7ldb/f %7"PRId64"b/s"
5220+ fprintf(stderr,
5221+ "\rPass %d/%d frame %4d/%-4d %7ldB %7ldb/f %7"PRId64"b/s"
5222 " %7lu %s (%.2f fps)\033[K", pass + 1,
5223 arg_passes, frames_in, frames_out, nbytes, nbytes * 8 / frames_in,
5224- nbytes * 8 *(int64_t)cfg.g_timebase.den / cfg.g_timebase.num / frames_in,
5225+ nbytes * 8 *(int64_t)cfg.g_timebase.den/2/ cfg.g_timebase.num / frames_in,
5226 cx_time > 9999999 ? cx_time / 1000 : cx_time,
5227 cx_time > 9999999 ? "ms" : "us",
5228 (float)frames_in * 1000000.0 / (float)cx_time);
5229@@ -1047,7 +1134,7 @@ int main(int argc, const char **argv_)
5230
5231 fclose(outfile);
5232 stats_close(&stats);
5233- printf("\n");
5234+ fprintf(stderr, "\n");
5235
5236 if (one_pass_only)
5237 break;
5238diff --git a/libs.doxy_template b/libs.doxy_template
5239index eb37dfc..ce8fde6 100644
5240--- a/libs.doxy_template
5241+++ b/libs.doxy_template
5242@@ -1,10 +1,11 @@
5243 ##
5244 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
5245-##
5246-## Use of this source code is governed by a BSD-style license and patent
5247-## grant that can be found in the LICENSE file in the root of the source
5248-## tree. All contributing project authors may be found in the AUTHORS
5249-## file in the root of the source tree.
5250+##
5251+## Use of this source code is governed by a BSD-style license
5252+## that can be found in the LICENSE file in the root of the source
5253+## tree. An additional intellectual property rights grant can be found
5254+## in the file PATENTS. All contributing project authors may
5255+## be found in the AUTHORS file in the root of the source tree.
5256 ##
5257
5258
5259diff --git a/libs.mk b/libs.mk
5260index f741dba..115ceb5 100644
5261--- a/libs.mk
5262+++ b/libs.mk
5263@@ -1,17 +1,18 @@
5264 ##
5265 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
5266 ##
5267-## Use of this source code is governed by a BSD-style license and patent
5268-## grant that can be found in the LICENSE file in the root of the source
5269-## tree. All contributing project authors may be found in the AUTHORS
5270-## file in the root of the source tree.
5271+## Use of this source code is governed by a BSD-style license
5272+## that can be found in the LICENSE file in the root of the source
5273+## tree. An additional intellectual property rights grant can be found
5274+## in the file PATENTS. All contributing project authors may
5275+## be found in the AUTHORS file in the root of the source tree.
5276 ##
5277
5278
5279 ASM:=$(if $(filter yes,$(CONFIG_GCC)),.asm.s,.asm)
5280
5281-include $(SRC_PATH_BARE)/vpx_codec/vpx_codec.mk
5282-CODEC_SRCS-yes += $(addprefix vpx_codec/,$(call enabled,API_SRCS))
5283+include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
5284+CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
5285
5286 include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
5287 CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
5288@@ -19,18 +20,16 @@ CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
5289 include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
5290 CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
5291
5292-# Add vpx_codec/ to the include path to allow vp_n[cd]x.h to reference
5293-# vpx_codec_impl_*.h without extra ifdeffery
5294-CFLAGS += -I$(SRC_PATH_BARE)/vpx_codec
5295
5296 ifeq ($(CONFIG_VP8_ENCODER),yes)
5297 VP8_PREFIX=vp8/
5298 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
5299 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
5300 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
5301- CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk
5302- INSTALL_MAPS += include/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
5303- CODEC_DOC_SRCS += vp8/vp8.h vp8/vp8cx.h
5304+ CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h vpx/vp8e.h
5305+ INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8e.h include/vpx/vp8cx.h
5306+ INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
5307+ CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
5308 CODEC_DOC_SECTIONS += vp8 vp8_encoder
5309 endif
5310
5311@@ -39,9 +38,10 @@ ifeq ($(CONFIG_VP8_DECODER),yes)
5312 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
5313 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
5314 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
5315- CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk
5316- INSTALL_MAPS += include/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
5317- CODEC_DOC_SRCS += vp8/vp8.h vp8/vp8dx.h
5318+ CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
5319+ INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
5320+ INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
5321+ CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
5322 CODEC_DOC_SECTIONS += vp8 vp8_decoder
5323 endif
5324
5325@@ -64,13 +64,13 @@ endif
5326
5327 # The following pairs define a mapping of locations in the distribution
5328 # tree to locations in the source/build trees.
5329-INSTALL_MAPS += include/% $(SRC_PATH_BARE)/vpx_codec/%
5330-INSTALL_MAPS += include/% $(SRC_PATH_BARE)/vpx_ports/%
5331-INSTALL_MAPS += lib/% %
5332+INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
5333+INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
5334+INSTALL_MAPS += $(LIBSUBDIR)/% %
5335 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
5336 ifeq ($(CONFIG_MSVS),yes)
5337-INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Release/%)
5338-INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Debug/%)
5339+INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
5340+INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
5341 endif
5342
5343 # If this is a universal (fat) binary, then all the subarchitectures have
5344@@ -81,7 +81,7 @@ endif
5345 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
5346
5347 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
5348-CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_integer.h
5349+CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
5350 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
5351 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
5352 CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
5353@@ -92,26 +92,28 @@ CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
5354 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
5355 endif
5356 CODEC_SRCS-$(ARCH_ARM) += $(BUILD_PFX)vpx_config.asm
5357-CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx_codec/exports
5358-
5359-INSTALL-LIBS-yes += include/vpx_codec.h
5360-INSTALL-LIBS-yes += include/vpx_image.h
5361-INSTALL-LIBS-yes += include/vpx_integer.h
5362-INSTALL-LIBS-yes += include/vpx_codec_impl_top.h
5363-INSTALL-LIBS-yes += include/vpx_codec_impl_bottom.h
5364-INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx_decoder.h
5365-INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx_decoder_compat.h
5366-INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx_encoder.h
5367+CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
5368+CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
5369+CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
5370+
5371+INSTALL-LIBS-yes += include/vpx/vpx_codec.h
5372+INSTALL-LIBS-yes += include/vpx/vpx_image.h
5373+INSTALL-LIBS-yes += include/vpx/vpx_integer.h
5374+INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
5375+INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
5376+INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
5377+INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
5378+INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
5379 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
5380 ifeq ($(CONFIG_MSVS),yes)
5381-INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB).lib)
5382-INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB)d.lib)
5383-INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.dll)
5384-INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.exp)
5385+INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
5386+INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
5387+INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
5388+INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
5389 endif
5390 else
5391-INSTALL-LIBS-yes += lib/libvpx.a
5392-INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += lib/libvpx_g.a
5393+INSTALL-LIBS-yes += $(LIBSUBDIR)/libvpx.a
5394+INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
5395 endif
5396
5397 CODEC_SRCS=$(call enabled,CODEC_SRCS)
5398@@ -130,7 +132,6 @@ ARM_ARCH=v6
5399 endif
5400 obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
5401 @cp $(SRC_PATH_BARE)/build/arm-wince-vs8/obj_int_extract.bat .
5402- @cp $(SRC_PATH_BARE)/build/arm-wince-vs8/armasm$(ARM_ARCH).rules .
5403 @echo " [CREATE] $@"
5404 $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\
5405 --exe\
5406@@ -175,6 +176,31 @@ LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
5407 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
5408 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
5409 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
5410+
5411+BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
5412+LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
5413+LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)
5414+$(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) libvpx.ver
5415+$(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm -pthread
5416+$(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
5417+$(BUILD_PFX)$(LIBVPX_SO): SO_VERSION_SCRIPT = libvpx.ver
5418+LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
5419+ libvpx.so libvpx.so.$(VERSION_MAJOR) \
5420+ libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
5421+
5422+libvpx.ver: $(call enabled,CODEC_EXPORTS)
5423+ @echo " [CREATE] $@"
5424+ $(qexec)echo "{ global:" > $@
5425+ $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
5426+ $(qexec)echo "local: *; };" >> $@
5427+CLEAN-OBJS += libvpx.ver
5428+
5429+$(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)):
5430+ @echo " [LN] $@"
5431+ $(qexec)ln -sf $(LIBVPX_SO) $@
5432+
5433+INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
5434+INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
5435 endif
5436
5437 LIBS-$(LIPO_LIBVPX) += libvpx.a
5438@@ -209,10 +235,10 @@ $(filter %.asm.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
5439 $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
5440 CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
5441
5442-CODEC_DOC_SRCS += vpx_codec/vpx_codec.h \
5443- vpx_codec/vpx_decoder.h \
5444- vpx_codec/vpx_encoder.h \
5445- vpx_codec/vpx_image.h
5446+CODEC_DOC_SRCS += vpx/vpx_codec.h \
5447+ vpx/vpx_decoder.h \
5448+ vpx/vpx_encoder.h \
5449+ vpx/vpx_image.h
5450
5451 CLEAN-OBJS += libs.doxy
5452 DOCS-yes += libs.doxy
5453diff --git a/md5_utils.c b/md5_utils.c
5454index 16c6f7e..455d9cd 100644
5455--- a/md5_utils.c
5456+++ b/md5_utils.c
5457@@ -1,298 +1,253 @@
5458 /*
5459- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
5460+ * This code implements the MD5 message-digest algorithm.
5461+ * The algorithm is due to Ron Rivest. This code was
5462+ * written by Colin Plumb in 1993, no copyright is claimed.
5463+ * This code is in the public domain; do with it what you wish.
5464 *
5465- * Use of this source code is governed by a BSD-style license and patent
5466- * grant that can be found in the LICENSE file in the root of the source
5467- * tree. All contributing project authors may be found in the AUTHORS
5468- * file in the root of the source tree.
5469+ * Equivalent code is available from RSA Data Security, Inc.
5470+ * This code has been tested against that, and is equivalent,
5471+ * except that you don't need to include two pages of legalese
5472+ * with every copy.
5473+ *
5474+ * To compute the message digest of a chunk of bytes, declare an
5475+ * MD5Context structure, pass it to MD5Init, call MD5Update as
5476+ * needed on buffers full of bytes, and then call MD5Final, which
5477+ * will fill a supplied 16-byte array with the digest.
5478+ *
5479+ * Changed so as no longer to depend on Colin Plumb's `usual.h' header
5480+ * definitions
5481+ * - Ian Jackson <ian@chiark.greenend.org.uk>.
5482+ * Still in the public domain.
5483 */
5484
5485+#include <sys/types.h> /* for stupid systems */
5486
5487-/*
5488-Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
5489-rights reserved.
5490-
5491-License to copy and use this software is granted provided that it
5492-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
5493-Algorithm" in all material mentioning or referencing this software
5494-or this function.
5495-
5496-License is also granted to make and use derivative works provided
5497-that such works are identified as "derived from the RSA Data
5498-Security, Inc. MD5 Message-Digest Algorithm" in all material
5499-mentioning or referencing the derived work.
5500-
5501-RSA Data Security, Inc. makes no representations concerning either
5502-the merchantability of this software or the suitability of this
5503-software for any particular purpose. It is provided "as is"
5504-without express or implied warranty of any kind.
5505-
5506-These notices must be retained in any copies of any part of this
5507-documentation and/or software.
5508-*/
5509+#include <string.h> /* for memcpy() */
5510
5511 #include "md5_utils.h"
5512-#include <string.h>
5513
5514-/* Constants for md5_transform routine.
5515- */
5516-#define S11 7
5517-#define S12 12
5518-#define S13 17
5519-#define S14 22
5520-#define S21 5
5521-#define S22 9
5522-#define S23 14
5523-#define S24 20
5524-#define S31 4
5525-#define S32 11
5526-#define S33 16
5527-#define S34 23
5528-#define S41 6
5529-#define S42 10
5530-#define S43 15
5531-#define S44 21
5532-
5533-static void md5_transform(uint32_t state[4], const uint8_t block[64]);
5534-static void Encode(uint8_t *output, const uint32_t *input, unsigned int len);
5535-static void Decode(uint32_t *output, const uint8_t *input, unsigned int len);
5536-#define md5_memset memset
5537-#define md5_memcpy memcpy
5538-
5539-static unsigned char PADDING[64] =
5540+void
5541+byteSwap(UWORD32 *buf, unsigned words)
5542 {
5543- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5544- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
5545- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
5546-};
5547+ md5byte *p;
5548
5549-/* F, G, H and I are basic MD5 functions.
5550- */
5551-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
5552-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
5553-#define H(x, y, z) ((x) ^ (y) ^ (z))
5554-#define I(x, y, z) ((y) ^ ((x) | (~z)))
5555+ /* Only swap bytes for big endian machines */
5556+ int i = 1;
5557
5558-/* ROTATE_LEFT rotates x left n bits.
5559- */
5560-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
5561+ if (*(char *)&i == 1)
5562+ return;
5563
5564-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
5565-Rotation is separate from addition to prevent recomputation.
5566- */
5567-#define FF(a, b, c, d, x, s, ac) { \
5568- (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \
5569- (a) = ROTATE_LEFT ((a), (s)); \
5570- (a) += (b); \
5571- }
5572-#define GG(a, b, c, d, x, s, ac) { \
5573- (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \
5574- (a) = ROTATE_LEFT ((a), (s)); \
5575- (a) += (b); \
5576- }
5577-#define HH(a, b, c, d, x, s, ac) { \
5578- (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \
5579- (a) = ROTATE_LEFT ((a), (s)); \
5580- (a) += (b); \
5581- }
5582-#define II(a, b, c, d, x, s, ac) { \
5583- (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \
5584- (a) = ROTATE_LEFT ((a), (s)); \
5585- (a) += (b); \
5586+ p = (md5byte *)buf;
5587+
5588+ do
5589+ {
5590+ *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
5591+ ((unsigned)p[1] << 8 | p[0]);
5592+ p += 4;
5593 }
5594+ while (--words);
5595+}
5596
5597-/* MD5 initialization. Begins an MD5 operation, writing a new context.
5598+/*
5599+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
5600+ * initialization constants.
5601 */
5602-void md5_init(md5_ctx_t *context)
5603+void
5604+MD5Init(struct MD5Context *ctx)
5605 {
5606- context->count[0] = context->count[1] = 0;
5607- /* Load magic initialization constants.
5608- */
5609- context->state[0] = 0x67452301;
5610- context->state[1] = 0xefcdab89;
5611- context->state[2] = 0x98badcfe;
5612- context->state[3] = 0x10325476;
5613+ ctx->buf[0] = 0x67452301;
5614+ ctx->buf[1] = 0xefcdab89;
5615+ ctx->buf[2] = 0x98badcfe;
5616+ ctx->buf[3] = 0x10325476;
5617+
5618+ ctx->bytes[0] = 0;
5619+ ctx->bytes[1] = 0;
5620 }
5621
5622-/* MD5 block update operation. Continues an MD5 message-digest
5623- operation, processing another message block, and updating the
5624- context.
5625+/*
5626+ * Update context to reflect the concatenation of another buffer full
5627+ * of bytes.
5628 */
5629-void md5_update(md5_ctx_t *context, const uint8_t *input, unsigned int input_len)
5630+void
5631+MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
5632 {
5633- unsigned int i, index, part_len;
5634+ UWORD32 t;
5635
5636- /* Compute number of bytes mod 64 */
5637- index = (unsigned int)((context->count[0] >> 3) & 0x3F);
5638+ /* Update byte count */
5639
5640- /* Update number of bits */
5641- if ((context->count[0] += ((uint32_t)input_len << 3))
5642- < ((uint32_t)input_len << 3))
5643- context->count[1]++;
5644+ t = ctx->bytes[0];
5645
5646- context->count[1] += ((uint32_t)input_len >> 29);
5647+ if ((ctx->bytes[0] = t + len) < t)
5648+ ctx->bytes[1]++; /* Carry from low to high */
5649
5650- part_len = 64 - index;
5651+ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
5652
5653- /* Transform as many times as possible. */
5654- if (input_len >= part_len)
5655+ if (t > len)
5656 {
5657- memcpy(&context->buffer[index], input, part_len);
5658- md5_transform(context->state, context->buffer);
5659+ memcpy((md5byte *)ctx->in + 64 - t, buf, len);
5660+ return;
5661+ }
5662
5663- for (i = part_len; i + 63 < input_len; i += 64)
5664- md5_transform(context->state, &input[i]);
5665+ /* First chunk is an odd size */
5666+ memcpy((md5byte *)ctx->in + 64 - t, buf, t);
5667+ byteSwap(ctx->in, 16);
5668+ MD5Transform(ctx->buf, ctx->in);
5669+ buf += t;
5670+ len -= t;
5671
5672- index = 0;
5673+ /* Process data in 64-byte chunks */
5674+ while (len >= 64)
5675+ {
5676+ memcpy(ctx->in, buf, 64);
5677+ byteSwap(ctx->in, 16);
5678+ MD5Transform(ctx->buf, ctx->in);
5679+ buf += 64;
5680+ len -= 64;
5681 }
5682- else
5683- i = 0;
5684
5685- /* Buffer remaining input */
5686- memcpy(&context->buffer[index], &input[i], input_len - i);
5687+ /* Handle any remaining bytes of data. */
5688+ memcpy(ctx->in, buf, len);
5689 }
5690
5691-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
5692- the message digest and zeroizing the context.
5693+/*
5694+ * Final wrapup - pad to 64-byte boundary with the bit pattern
5695+ * 1 0* (64-bit count of bits processed, MSB-first)
5696 */
5697-void md5_finalize(md5_ctx_t *context, uint8_t digest[16])
5698+void
5699+MD5Final(md5byte digest[16], struct MD5Context *ctx)
5700 {
5701- unsigned char bits[8];
5702- unsigned int index, pad_len;
5703-
5704- /* Save number of bits */
5705- Encode(bits, context->count, 8);
5706-
5707- /* Pad out to 56 mod 64.
5708- */
5709- index = (unsigned int)((context->count[0] >> 3) & 0x3f);
5710- pad_len = (index < 56) ? (56 - index) : (120 - index);
5711- md5_update(context, PADDING, pad_len);
5712-
5713- /* Append length (before padding) */
5714- md5_update(context, bits, 8);
5715- /* Store state in digest */
5716- Encode(digest, context->state, 16);
5717-
5718- /* Zeroize sensitive information.
5719- */
5720- memset(context, 0, sizeof(*context));
5721-}
5722+ int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
5723+ md5byte *p = (md5byte *)ctx->in + count;
5724
5725-/* MD5 basic transformation. Transforms state based on block.
5726- */
5727-static void md5_transform(uint32_t state[4], const uint8_t block[64])
5728-{
5729- uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
5730-
5731- Decode(x, block, 64);
5732-
5733- /* Round 1 */
5734- FF(a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
5735- FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
5736- FF(c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
5737- FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
5738- FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
5739- FF(d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
5740- FF(c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
5741- FF(b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
5742- FF(a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
5743- FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
5744- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
5745- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
5746- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
5747- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
5748- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
5749- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
5750-
5751- /* Round 2 */
5752- GG(a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
5753- GG(d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
5754- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
5755- GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
5756- GG(a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
5757- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
5758- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
5759- GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
5760- GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
5761- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
5762- GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
5763- GG(b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
5764- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
5765- GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
5766- GG(c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
5767- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
5768-
5769- /* Round 3 */
5770- HH(a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
5771- HH(d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
5772- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
5773- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
5774- HH(a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
5775- HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
5776- HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
5777- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
5778- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
5779- HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
5780- HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
5781- HH(b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
5782- HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
5783- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
5784- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
5785- HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
5786-
5787- /* Round 4 */
5788- II(a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
5789- II(d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
5790- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
5791- II(b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
5792- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
5793- II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
5794- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
5795- II(b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
5796- II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
5797- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
5798- II(c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
5799- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
5800- II(a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
5801- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
5802- II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
5803- II(b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
5804-
5805- state[0] += a;
5806- state[1] += b;
5807- state[2] += c;
5808- state[3] += d;
5809-
5810- /* Zeroize sensitive information.
5811- */
5812- memset(x, 0, sizeof(x));
5813-}
5814+ /* Set the first char of padding to 0x80. There is always room. */
5815+ *p++ = 0x80;
5816
5817-/* Encodes input (uint32_t) into output (unsigned char). Assumes len is
5818- a multiple of 4.
5819- */
5820-static void Encode(uint8_t *output, const uint32_t *input, unsigned int len)
5821-{
5822- unsigned int i, j;
5823+ /* Bytes of padding needed to make 56 bytes (-8..55) */
5824+ count = 56 - 1 - count;
5825
5826- for (i = 0, j = 0; j < len; i++, j += 4)
5827+ if (count < 0) /* Padding forces an extra block */
5828 {
5829- output[j] = (unsigned char)(input[i] & 0xff);
5830- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
5831- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
5832- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
5833+ memset(p, 0, count + 8);
5834+ byteSwap(ctx->in, 16);
5835+ MD5Transform(ctx->buf, ctx->in);
5836+ p = (md5byte *)ctx->in;
5837+ count = 56;
5838 }
5839+
5840+ memset(p, 0, count);
5841+ byteSwap(ctx->in, 14);
5842+
5843+ /* Append length in bits and transform */
5844+ ctx->in[14] = ctx->bytes[0] << 3;
5845+ ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
5846+ MD5Transform(ctx->buf, ctx->in);
5847+
5848+ byteSwap(ctx->buf, 4);
5849+ memcpy(digest, ctx->buf, 16);
5850+ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
5851 }
5852
5853-/* Decodes input (unsigned char) into output (uint32_t). Assumes len is
5854- a multiple of 4.
5855+#ifndef ASM_MD5
5856+
5857+/* The four core functions - F1 is optimized somewhat */
5858+
5859+/* #define F1(x, y, z) (x & y | ~x & z) */
5860+#define F1(x, y, z) (z ^ (x & (y ^ z)))
5861+#define F2(x, y, z) F1(z, x, y)
5862+#define F3(x, y, z) (x ^ y ^ z)
5863+#define F4(x, y, z) (y ^ (x | ~z))
5864+
5865+/* This is the central step in the MD5 algorithm. */
5866+#define MD5STEP(f,w,x,y,z,in,s) \
5867+ (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
5868+
5869+/*
5870+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
5871+ * reflect the addition of 16 longwords of new data. MD5Update blocks
5872+ * the data and converts bytes into longwords for this routine.
5873 */
5874-static void Decode(uint32_t *output, const uint8_t *input, unsigned int len)
5875+void
5876+MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
5877 {
5878- unsigned int i, j;
5879-
5880- for (i = 0, j = 0; j < len; i++, j += 4)
5881- output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) |
5882- (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24);
5883+ register UWORD32 a, b, c, d;
5884+
5885+ a = buf[0];
5886+ b = buf[1];
5887+ c = buf[2];
5888+ d = buf[3];
5889+
5890+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
5891+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
5892+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
5893+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
5894+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
5895+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
5896+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
5897+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
5898+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
5899+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
5900+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
5901+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
5902+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
5903+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
5904+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
5905+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
5906+
5907+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
5908+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
5909+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
5910+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
5911+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
5912+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
5913+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
5914+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
5915+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
5916+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
5917+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
5918+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
5919+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
5920+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
5921+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
5922+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
5923+
5924+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
5925+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
5926+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
5927+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
5928+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
5929+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
5930+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
5931+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
5932+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
5933+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
5934+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
5935+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
5936+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
5937+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
5938+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
5939+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
5940+
5941+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
5942+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
5943+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
5944+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
5945+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
5946+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
5947+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
5948+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
5949+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
5950+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
5951+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
5952+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
5953+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
5954+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
5955+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
5956+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
5957+
5958+ buf[0] += a;
5959+ buf[1] += b;
5960+ buf[2] += c;
5961+ buf[3] += d;
5962 }
5963+
5964+#endif
5965diff --git a/md5_utils.h b/md5_utils.h
5966index 8dda8d1..5ca1b5f 100644
5967--- a/md5_utils.h
5968+++ b/md5_utils.h
5969@@ -1,51 +1,42 @@
5970 /*
5971- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
5972+ * This is the header file for the MD5 message-digest algorithm.
5973+ * The algorithm is due to Ron Rivest. This code was
5974+ * written by Colin Plumb in 1993, no copyright is claimed.
5975+ * This code is in the public domain; do with it what you wish.
5976 *
5977- * Use of this source code is governed by a BSD-style license and patent
5978- * grant that can be found in the LICENSE file in the root of the source
5979- * tree. All contributing project authors may be found in the AUTHORS
5980- * file in the root of the source tree.
5981+ * Equivalent code is available from RSA Data Security, Inc.
5982+ * This code has been tested against that, and is equivalent,
5983+ * except that you don't need to include two pages of legalese
5984+ * with every copy.
5985+ *
5986+ * To compute the message digest of a chunk of bytes, declare an
5987+ * MD5Context structure, pass it to MD5Init, call MD5Update as
5988+ * needed on buffers full of bytes, and then call MD5Final, which
5989+ * will fill a supplied 16-byte array with the digest.
5990+ *
5991+ * Changed so as no longer to depend on Colin Plumb's `usual.h'
5992+ * header definitions
5993+ * - Ian Jackson <ian@chiark.greenend.org.uk>.
5994+ * Still in the public domain.
5995 */
5996
5997-/*
5998-Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
5999-rights reserved.
6000-
6001-License to copy and use this software is granted provided that it
6002-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
6003-Algorithm" in all material mentioning or referencing this software
6004-or this function.
6005+#ifndef MD5_H
6006+#define MD5_H
6007
6008-License is also granted to make and use derivative works provided
6009-that such works are identified as "derived from the RSA Data
6010-Security, Inc. MD5 Message-Digest Algorithm" in all material
6011-mentioning or referencing the derived work.
6012+#define md5byte unsigned char
6013+#define UWORD32 unsigned int
6014
6015-RSA Data Security, Inc. makes no representations concerning either
6016-the merchantability of this software or the suitability of this
6017-software for any particular purpose. It is provided "as is"
6018-without express or implied warranty of any kind.
6019-
6020-These notices must be retained in any copies of any part of this
6021-documentation and/or software.
6022-*/
6023-#ifndef HAVE_VPX_PORTS
6024-#define HAVE_VPX_PORTS 0
6025-#endif
6026-#if HAVE_VPX_PORTS
6027-#include "vpx_ports/vpx_integer.h"
6028-#else
6029-#include "vpx_integer.h"
6030-#endif
6031-
6032-/* MD5 context. */
6033-typedef struct
6034+typedef struct MD5Context MD5Context;
6035+struct MD5Context
6036 {
6037- uint32_t state[4]; /* state (ABCD) */
6038- uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
6039- uint8_t buffer[64]; /* input buffer */
6040-} md5_ctx_t;
6041+ UWORD32 buf[4];
6042+ UWORD32 bytes[2];
6043+ UWORD32 in[16];
6044+};
6045+
6046+void MD5Init(struct MD5Context *context);
6047+void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
6048+void MD5Final(unsigned char digest[16], struct MD5Context *context);
6049+void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
6050
6051-void md5_init(md5_ctx_t *ctx);
6052-void md5_update(md5_ctx_t *ctx, const uint8_t *buf, unsigned int len);
6053-void md5_finalize(md5_ctx_t *ctx, uint8_t md5[16]);
6054+#endif /* !MD5_H */
6055diff --git a/release.sh b/release.sh
6056index 3b77dad..880ad0f 100755
6057--- a/release.sh
6058+++ b/release.sh
6059@@ -1,11 +1,12 @@
6060-#!/bin/bash
6061+#!/bin/sh
6062 ##
6063 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6064 ##
6065-## Use of this source code is governed by a BSD-style license and patent
6066-## grant that can be found in the LICENSE file in the root of the source
6067-## tree. All contributing project authors may be found in the AUTHORS
6068-## file in the root of the source tree.
6069+## Use of this source code is governed by a BSD-style license
6070+## that can be found in the LICENSE file in the root of the source
6071+## tree. An additional intellectual property rights grant can be found
6072+## in the file PATENTS. All contributing project authors may
6073+## be found in the AUTHORS file in the root of the source tree.
6074 ##
6075
6076
6077@@ -20,7 +21,7 @@ for opt; do
6078 esac
6079 done
6080
6081-TAB=$'\t'
6082+TAB="$(printf '\t')"
6083 cat > release.mk << EOF
6084 %\$(BUILD_SFX).tar.bz2: %/.done
6085 ${TAB}@echo "\$(subst .tar.bz2,,\$@): tarball"
6086@@ -185,7 +186,7 @@ for cfg in $CONFIGS; do
6087 esac
6088 opts="$opts --enable-postproc"
6089
6090- [ "x${clean}" == "xyes" ] \
6091+ [ "x${clean}" = "xyes" ] \
6092 && rm -rf ${full_cfg}${BUILD_SFX}${TAR_SFX} \
6093 && rm -rf logs/${full_cfg}${BUILD_SFX}.log.bz2
6094
6095diff --git a/solution.mk b/solution.mk
6096index 783c6f8..21bf065 100644
6097--- a/solution.mk
6098+++ b/solution.mk
6099@@ -1,10 +1,11 @@
6100 ##
6101 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6102 ##
6103-## Use of this source code is governed by a BSD-style license and patent
6104-## grant that can be found in the LICENSE file in the root of the source
6105-## tree. All contributing project authors may be found in the AUTHORS
6106-## file in the root of the source tree.
6107+## Use of this source code is governed by a BSD-style license
6108+## that can be found in the LICENSE file in the root of the source
6109+## tree. An additional intellectual property rights grant can be found
6110+## in the file PATENTS. All contributing project authors may
6111+## be found in the AUTHORS file in the root of the source tree.
6112 ##
6113
6114
6115diff --git a/tools/gen_authors.sh b/tools/gen_authors.sh
6116new file mode 100755
6117index 0000000..e1246f0
6118--- /dev/null
6119+++ b/tools/gen_authors.sh
6120@@ -0,0 +1,13 @@
6121+#!/bin/bash
6122+
6123+# Add organization names manually.
6124+
6125+cat <<EOF
6126+# This file is automatically generated from the git commit history
6127+# by tools/gen_authors.sh.
6128+
6129+$(git log --pretty=format:"%aN <%aE>" | sort | uniq)
6130+Google Inc.
6131+The Mozilla Foundation
6132+The Xiph.Org Foundation
6133+EOF
6134diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c
6135index ac110f7..9f6397e 100644
6136--- a/vp8/common/alloccommon.c
6137+++ b/vp8/common/alloccommon.c
6138@@ -1,13 +1,15 @@
6139 /*
6140 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6141 *
6142- * Use of this source code is governed by a BSD-style license and patent
6143- * grant that can be found in the LICENSE file in the root of the source
6144- * tree. All contributing project authors may be found in the AUTHORS
6145- * file in the root of the source tree.
6146+ * Use of this source code is governed by a BSD-style license
6147+ * that can be found in the LICENSE file in the root of the source
6148+ * tree. An additional intellectual property rights grant can be found
6149+ * in the file PATENTS. All contributing project authors may
6150+ * be found in the AUTHORS file in the root of the source tree.
6151 */
6152
6153
6154+#include "vpx_ports/config.h"
6155 #include "blockd.h"
6156 #include "vpx_mem/vpx_mem.h"
6157 #include "onyxc_int.h"
6158@@ -16,9 +18,6 @@
6159 #include "systemdependent.h"
6160 #include "vpxerrors.h"
6161
6162-#ifdef HAVE_CONFIG_H
6163-#include "vpx_config.h"
6164-#endif
6165
6166 extern void vp8_init_scan_order_mask();
6167
6168diff --git a/vp8/common/alloccommon.h b/vp8/common/alloccommon.h
6169index 73c7383..b877412 100644
6170--- a/vp8/common/alloccommon.h
6171+++ b/vp8/common/alloccommon.h
6172@@ -1,10 +1,11 @@
6173 /*
6174 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6175 *
6176- * Use of this source code is governed by a BSD-style license and patent
6177- * grant that can be found in the LICENSE file in the root of the source
6178- * tree. All contributing project authors may be found in the AUTHORS
6179- * file in the root of the source tree.
6180+ * Use of this source code is governed by a BSD-style license
6181+ * that can be found in the LICENSE file in the root of the source
6182+ * tree. An additional intellectual property rights grant can be found
6183+ * in the file PATENTS. All contributing project authors may
6184+ * be found in the AUTHORS file in the root of the source tree.
6185 */
6186
6187
6188diff --git a/vp8/common/arm/armv6/bilinearfilter_v6.asm b/vp8/common/arm/armv6/bilinearfilter_v6.asm
6189index 4428cf8..ac0d333 100644
6190--- a/vp8/common/arm/armv6/bilinearfilter_v6.asm
6191+++ b/vp8/common/arm/armv6/bilinearfilter_v6.asm
6192@@ -1,10 +1,11 @@
6193 ;
6194 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6195 ;
6196-; Use of this source code is governed by a BSD-style license and patent
6197-; grant that can be found in the LICENSE file in the root of the source
6198-; tree. All contributing project authors may be found in the AUTHORS
6199-; file in the root of the source tree.
6200+; Use of this source code is governed by a BSD-style license
6201+; that can be found in the LICENSE file in the root of the source
6202+; tree. An additional intellectual property rights grant can be found
6203+; in the file PATENTS. All contributing project authors may
6204+; be found in the AUTHORS file in the root of the source tree.
6205 ;
6206
6207
6208diff --git a/vp8/common/arm/armv6/copymem16x16_v6.asm b/vp8/common/arm/armv6/copymem16x16_v6.asm
6209index 00e9739..344c453 100644
6210--- a/vp8/common/arm/armv6/copymem16x16_v6.asm
6211+++ b/vp8/common/arm/armv6/copymem16x16_v6.asm
6212@@ -1,10 +1,11 @@
6213 ;
6214 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6215 ;
6216-; Use of this source code is governed by a BSD-style license and patent
6217-; grant that can be found in the LICENSE file in the root of the source
6218-; tree. All contributing project authors may be found in the AUTHORS
6219-; file in the root of the source tree.
6220+; Use of this source code is governed by a BSD-style license
6221+; that can be found in the LICENSE file in the root of the source
6222+; tree. An additional intellectual property rights grant can be found
6223+; in the file PATENTS. All contributing project authors may
6224+; be found in the AUTHORS file in the root of the source tree.
6225 ;
6226
6227
6228diff --git a/vp8/common/arm/armv6/copymem8x4_v6.asm b/vp8/common/arm/armv6/copymem8x4_v6.asm
6229index 94473ca..3556b3a 100644
6230--- a/vp8/common/arm/armv6/copymem8x4_v6.asm
6231+++ b/vp8/common/arm/armv6/copymem8x4_v6.asm
6232@@ -1,10 +1,11 @@
6233 ;
6234 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6235 ;
6236-; Use of this source code is governed by a BSD-style license and patent
6237-; grant that can be found in the LICENSE file in the root of the source
6238-; tree. All contributing project authors may be found in the AUTHORS
6239-; file in the root of the source tree.
6240+; Use of this source code is governed by a BSD-style license
6241+; that can be found in the LICENSE file in the root of the source
6242+; tree. An additional intellectual property rights grant can be found
6243+; in the file PATENTS. All contributing project authors may
6244+; be found in the AUTHORS file in the root of the source tree.
6245 ;
6246
6247
6248diff --git a/vp8/common/arm/armv6/copymem8x8_v6.asm b/vp8/common/arm/armv6/copymem8x8_v6.asm
6249index 7cfa533..1da0ff5 100644
6250--- a/vp8/common/arm/armv6/copymem8x8_v6.asm
6251+++ b/vp8/common/arm/armv6/copymem8x8_v6.asm
6252@@ -1,10 +1,11 @@
6253 ;
6254 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6255 ;
6256-; Use of this source code is governed by a BSD-style license and patent
6257-; grant that can be found in the LICENSE file in the root of the source
6258-; tree. All contributing project authors may be found in the AUTHORS
6259-; file in the root of the source tree.
6260+; Use of this source code is governed by a BSD-style license
6261+; that can be found in the LICENSE file in the root of the source
6262+; tree. An additional intellectual property rights grant can be found
6263+; in the file PATENTS. All contributing project authors may
6264+; be found in the AUTHORS file in the root of the source tree.
6265 ;
6266
6267
6268diff --git a/vp8/common/arm/armv6/filter_v6.asm b/vp8/common/arm/armv6/filter_v6.asm
6269index a7863fc..cdc74ba 100644
6270--- a/vp8/common/arm/armv6/filter_v6.asm
6271+++ b/vp8/common/arm/armv6/filter_v6.asm
6272@@ -1,10 +1,11 @@
6273 ;
6274 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6275 ;
6276-; Use of this source code is governed by a BSD-style license and patent
6277-; grant that can be found in the LICENSE file in the root of the source
6278-; tree. All contributing project authors may be found in the AUTHORS
6279-; file in the root of the source tree.
6280+; Use of this source code is governed by a BSD-style license
6281+; that can be found in the LICENSE file in the root of the source
6282+; tree. An additional intellectual property rights grant can be found
6283+; in the file PATENTS. All contributing project authors may
6284+; be found in the AUTHORS file in the root of the source tree.
6285 ;
6286
6287
6288diff --git a/vp8/common/arm/armv6/idct_v6.asm b/vp8/common/arm/armv6/idct_v6.asm
6289index 25c5165..9e932fa 100644
6290--- a/vp8/common/arm/armv6/idct_v6.asm
6291+++ b/vp8/common/arm/armv6/idct_v6.asm
6292@@ -1,10 +1,11 @@
6293 ;
6294 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6295 ;
6296-; Use of this source code is governed by a BSD-style license and patent
6297-; grant that can be found in the LICENSE file in the root of the source
6298-; tree. All contributing project authors may be found in the AUTHORS
6299-; file in the root of the source tree.
6300+; Use of this source code is governed by a BSD-style license
6301+; that can be found in the LICENSE file in the root of the source
6302+; tree. An additional intellectual property rights grant can be found
6303+; in the file PATENTS. All contributing project authors may
6304+; be found in the AUTHORS file in the root of the source tree.
6305 ;
6306
6307
6308diff --git a/vp8/common/arm/armv6/iwalsh_v6.asm b/vp8/common/arm/armv6/iwalsh_v6.asm
6309index 8747568..4606783 100644
6310--- a/vp8/common/arm/armv6/iwalsh_v6.asm
6311+++ b/vp8/common/arm/armv6/iwalsh_v6.asm
6312@@ -1,10 +1,11 @@
6313 ;
6314 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6315 ;
6316-; Use of this source code is governed by a BSD-style license and patent
6317-; grant that can be found in the LICENSE file in the root of the source
6318-; tree. All contributing project authors may be found in the AUTHORS
6319-; file in the root of the source tree.
6320+; Use of this source code is governed by a BSD-style license
6321+; that can be found in the LICENSE file in the root of the source
6322+; tree. An additional intellectual property rights grant can be found
6323+; in the file PATENTS. All contributing project authors may
6324+; be found in the AUTHORS file in the root of the source tree.
6325 ;
6326
6327 EXPORT |vp8_short_inv_walsh4x4_armv6|
6328diff --git a/vp8/common/arm/armv6/loopfilter_v6.asm b/vp8/common/arm/armv6/loopfilter_v6.asm
6329index c2b02dc..eeeacd3 100644
6330--- a/vp8/common/arm/armv6/loopfilter_v6.asm
6331+++ b/vp8/common/arm/armv6/loopfilter_v6.asm
6332@@ -1,10 +1,11 @@
6333 ;
6334 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6335 ;
6336-; Use of this source code is governed by a BSD-style license and patent
6337-; grant that can be found in the LICENSE file in the root of the source
6338-; tree. All contributing project authors may be found in the AUTHORS
6339-; file in the root of the source tree.
6340+; Use of this source code is governed by a BSD-style license
6341+; that can be found in the LICENSE file in the root of the source
6342+; tree. An additional intellectual property rights grant can be found
6343+; in the file PATENTS. All contributing project authors may
6344+; be found in the AUTHORS file in the root of the source tree.
6345 ;
6346
6347
6348diff --git a/vp8/common/arm/armv6/recon_v6.asm b/vp8/common/arm/armv6/recon_v6.asm
6349index 085ff80..6f3ccbe 100644
6350--- a/vp8/common/arm/armv6/recon_v6.asm
6351+++ b/vp8/common/arm/armv6/recon_v6.asm
6352@@ -1,10 +1,11 @@
6353 ;
6354 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6355 ;
6356-; Use of this source code is governed by a BSD-style license and patent
6357-; grant that can be found in the LICENSE file in the root of the source
6358-; tree. All contributing project authors may be found in the AUTHORS
6359-; file in the root of the source tree.
6360+; Use of this source code is governed by a BSD-style license
6361+; that can be found in the LICENSE file in the root of the source
6362+; tree. An additional intellectual property rights grant can be found
6363+; in the file PATENTS. All contributing project authors may
6364+; be found in the AUTHORS file in the root of the source tree.
6365 ;
6366
6367
6368diff --git a/vp8/common/arm/armv6/simpleloopfilter_v6.asm b/vp8/common/arm/armv6/simpleloopfilter_v6.asm
6369index 15c6c7d..b820ced 100644
6370--- a/vp8/common/arm/armv6/simpleloopfilter_v6.asm
6371+++ b/vp8/common/arm/armv6/simpleloopfilter_v6.asm
6372@@ -1,10 +1,11 @@
6373 ;
6374 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6375 ;
6376-; Use of this source code is governed by a BSD-style license and patent
6377-; grant that can be found in the LICENSE file in the root of the source
6378-; tree. All contributing project authors may be found in the AUTHORS
6379-; file in the root of the source tree.
6380+; Use of this source code is governed by a BSD-style license
6381+; that can be found in the LICENSE file in the root of the source
6382+; tree. An additional intellectual property rights grant can be found
6383+; in the file PATENTS. All contributing project authors may
6384+; be found in the AUTHORS file in the root of the source tree.
6385 ;
6386
6387
6388diff --git a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
6389index 551d863..6415463 100644
6390--- a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
6391+++ b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
6392@@ -1,10 +1,11 @@
6393 ;
6394 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6395 ;
6396-; Use of this source code is governed by a BSD-style license and patent
6397-; grant that can be found in the LICENSE file in the root of the source
6398-; tree. All contributing project authors may be found in the AUTHORS
6399-; file in the root of the source tree.
6400+; Use of this source code is governed by a BSD-style license
6401+; that can be found in the LICENSE file in the root of the source
6402+; tree. An additional intellectual property rights grant can be found
6403+; in the file PATENTS. All contributing project authors may
6404+; be found in the AUTHORS file in the root of the source tree.
6405 ;
6406
6407
6408diff --git a/vp8/common/arm/bilinearfilter_arm.c b/vp8/common/arm/bilinearfilter_arm.c
6409index bf972a3..b93539c 100644
6410--- a/vp8/common/arm/bilinearfilter_arm.c
6411+++ b/vp8/common/arm/bilinearfilter_arm.c
6412@@ -1,10 +1,11 @@
6413 /*
6414 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6415 *
6416- * Use of this source code is governed by a BSD-style license and patent
6417- * grant that can be found in the LICENSE file in the root of the source
6418- * tree. All contributing project authors may be found in the AUTHORS
6419- * file in the root of the source tree.
6420+ * Use of this source code is governed by a BSD-style license
6421+ * that can be found in the LICENSE file in the root of the source
6422+ * tree. An additional intellectual property rights grant can be found
6423+ * in the file PATENTS. All contributing project authors may
6424+ * be found in the AUTHORS file in the root of the source tree.
6425 */
6426
6427
6428diff --git a/vp8/common/arm/filter_arm.c b/vp8/common/arm/filter_arm.c
6429index 2a4640c..233be24 100644
6430--- a/vp8/common/arm/filter_arm.c
6431+++ b/vp8/common/arm/filter_arm.c
6432@@ -1,10 +1,11 @@
6433 /*
6434 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6435 *
6436- * Use of this source code is governed by a BSD-style license and patent
6437- * grant that can be found in the LICENSE file in the root of the source
6438- * tree. All contributing project authors may be found in the AUTHORS
6439- * file in the root of the source tree.
6440+ * Use of this source code is governed by a BSD-style license
6441+ * that can be found in the LICENSE file in the root of the source
6442+ * tree. An additional intellectual property rights grant can be found
6443+ * in the file PATENTS. All contributing project authors may
6444+ * be found in the AUTHORS file in the root of the source tree.
6445 */
6446
6447
6448diff --git a/vp8/common/arm/idct_arm.h b/vp8/common/arm/idct_arm.h
6449index f9ed21e..cfd9d76 100644
6450--- a/vp8/common/arm/idct_arm.h
6451+++ b/vp8/common/arm/idct_arm.h
6452@@ -1,10 +1,11 @@
6453 /*
6454 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6455 *
6456- * Use of this source code is governed by a BSD-style license and patent
6457- * grant that can be found in the LICENSE file in the root of the source
6458- * tree. All contributing project authors may be found in the AUTHORS
6459- * file in the root of the source tree.
6460+ * Use of this source code is governed by a BSD-style license
6461+ * that can be found in the LICENSE file in the root of the source
6462+ * tree. An additional intellectual property rights grant can be found
6463+ * in the file PATENTS. All contributing project authors may
6464+ * be found in the AUTHORS file in the root of the source tree.
6465 */
6466
6467
6468diff --git a/vp8/common/arm/loopfilter_arm.c b/vp8/common/arm/loopfilter_arm.c
6469index fa7c626..d98c908 100644
6470--- a/vp8/common/arm/loopfilter_arm.c
6471+++ b/vp8/common/arm/loopfilter_arm.c
6472@@ -1,10 +1,11 @@
6473 /*
6474 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6475 *
6476- * Use of this source code is governed by a BSD-style license and patent
6477- * grant that can be found in the LICENSE file in the root of the source
6478- * tree. All contributing project authors may be found in the AUTHORS
6479- * file in the root of the source tree.
6480+ * Use of this source code is governed by a BSD-style license
6481+ * that can be found in the LICENSE file in the root of the source
6482+ * tree. An additional intellectual property rights grant can be found
6483+ * in the file PATENTS. All contributing project authors may
6484+ * be found in the AUTHORS file in the root of the source tree.
6485 */
6486
6487
6488diff --git a/vp8/common/arm/loopfilter_arm.h b/vp8/common/arm/loopfilter_arm.h
6489index 4bb4945..b59e2b5 100644
6490--- a/vp8/common/arm/loopfilter_arm.h
6491+++ b/vp8/common/arm/loopfilter_arm.h
6492@@ -1,10 +1,11 @@
6493 /*
6494 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6495 *
6496- * Use of this source code is governed by a BSD-style license and patent
6497- * grant that can be found in the LICENSE file in the root of the source
6498- * tree. All contributing project authors may be found in the AUTHORS
6499- * file in the root of the source tree.
6500+ * Use of this source code is governed by a BSD-style license
6501+ * that can be found in the LICENSE file in the root of the source
6502+ * tree. An additional intellectual property rights grant can be found
6503+ * in the file PATENTS. All contributing project authors may
6504+ * be found in the AUTHORS file in the root of the source tree.
6505 */
6506
6507
6508diff --git a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
6509index a2fea2b..076a3d3 100644
6510--- a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
6511+++ b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
6512@@ -1,10 +1,11 @@
6513 ;
6514 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6515 ;
6516-; Use of this source code is governed by a BSD-style license and patent
6517-; grant that can be found in the LICENSE file in the root of the source
6518-; tree. All contributing project authors may be found in the AUTHORS
6519-; file in the root of the source tree.
6520+; Use of this source code is governed by a BSD-style license
6521+; that can be found in the LICENSE file in the root of the source
6522+; tree. An additional intellectual property rights grant can be found
6523+; in the file PATENTS. All contributing project authors may
6524+; be found in the AUTHORS file in the root of the source tree.
6525 ;
6526
6527
6528diff --git a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
6529index 74d2db5..f199ba3 100644
6530--- a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
6531+++ b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
6532@@ -1,10 +1,11 @@
6533 ;
6534 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6535 ;
6536-; Use of this source code is governed by a BSD-style license and patent
6537-; grant that can be found in the LICENSE file in the root of the source
6538-; tree. All contributing project authors may be found in the AUTHORS
6539-; file in the root of the source tree.
6540+; Use of this source code is governed by a BSD-style license
6541+; that can be found in the LICENSE file in the root of the source
6542+; tree. An additional intellectual property rights grant can be found
6543+; in the file PATENTS. All contributing project authors may
6544+; be found in the AUTHORS file in the root of the source tree.
6545 ;
6546
6547
6548diff --git a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
6549index 46ebb0e..9a3a039 100644
6550--- a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
6551+++ b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
6552@@ -1,10 +1,11 @@
6553 ;
6554 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6555 ;
6556-; Use of this source code is governed by a BSD-style license and patent
6557-; grant that can be found in the LICENSE file in the root of the source
6558-; tree. All contributing project authors may be found in the AUTHORS
6559-; file in the root of the source tree.
6560+; Use of this source code is governed by a BSD-style license
6561+; that can be found in the LICENSE file in the root of the source
6562+; tree. An additional intellectual property rights grant can be found
6563+; in the file PATENTS. All contributing project authors may
6564+; be found in the AUTHORS file in the root of the source tree.
6565 ;
6566
6567
6568diff --git a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
6569index 80728d4..10a6366 100644
6570--- a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
6571+++ b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
6572@@ -1,10 +1,11 @@
6573 ;
6574 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6575 ;
6576-; Use of this source code is governed by a BSD-style license and patent
6577-; grant that can be found in the LICENSE file in the root of the source
6578-; tree. All contributing project authors may be found in the AUTHORS
6579-; file in the root of the source tree.
6580+; Use of this source code is governed by a BSD-style license
6581+; that can be found in the LICENSE file in the root of the source
6582+; tree. An additional intellectual property rights grant can be found
6583+; in the file PATENTS. All contributing project authors may
6584+; be found in the AUTHORS file in the root of the source tree.
6585 ;
6586
6587
6588diff --git a/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm b/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
6589index f42ac63..7cd9d75 100644
6590--- a/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
6591+++ b/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
6592@@ -1,10 +1,11 @@
6593 ;
6594 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6595 ;
6596-; Use of this source code is governed by a BSD-style license and patent
6597-; grant that can be found in the LICENSE file in the root of the source
6598-; tree. All contributing project authors may be found in the AUTHORS
6599-; file in the root of the source tree.
6600+; Use of this source code is governed by a BSD-style license
6601+; that can be found in the LICENSE file in the root of the source
6602+; tree. An additional intellectual property rights grant can be found
6603+; in the file PATENTS. All contributing project authors may
6604+; be found in the AUTHORS file in the root of the source tree.
6605 ;
6606
6607
6608diff --git a/vp8/common/arm/neon/copymem16x16_neon.asm b/vp8/common/arm/neon/copymem16x16_neon.asm
6609index 89d5e10..b25bfdc 100644
6610--- a/vp8/common/arm/neon/copymem16x16_neon.asm
6611+++ b/vp8/common/arm/neon/copymem16x16_neon.asm
6612@@ -1,10 +1,11 @@
6613 ;
6614 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6615 ;
6616-; Use of this source code is governed by a BSD-style license and patent
6617-; grant that can be found in the LICENSE file in the root of the source
6618-; tree. All contributing project authors may be found in the AUTHORS
6619-; file in the root of the source tree.
6620+; Use of this source code is governed by a BSD-style license
6621+; that can be found in the LICENSE file in the root of the source
6622+; tree. An additional intellectual property rights grant can be found
6623+; in the file PATENTS. All contributing project authors may
6624+; be found in the AUTHORS file in the root of the source tree.
6625 ;
6626
6627
6628diff --git a/vp8/common/arm/neon/copymem8x4_neon.asm b/vp8/common/arm/neon/copymem8x4_neon.asm
6629index 302f734..0c62ee2 100644
6630--- a/vp8/common/arm/neon/copymem8x4_neon.asm
6631+++ b/vp8/common/arm/neon/copymem8x4_neon.asm
6632@@ -1,10 +1,11 @@
6633 ;
6634 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6635 ;
6636-; Use of this source code is governed by a BSD-style license and patent
6637-; grant that can be found in the LICENSE file in the root of the source
6638-; tree. All contributing project authors may be found in the AUTHORS
6639-; file in the root of the source tree.
6640+; Use of this source code is governed by a BSD-style license
6641+; that can be found in the LICENSE file in the root of the source
6642+; tree. An additional intellectual property rights grant can be found
6643+; in the file PATENTS. All contributing project authors may
6644+; be found in the AUTHORS file in the root of the source tree.
6645 ;
6646
6647
6648diff --git a/vp8/common/arm/neon/copymem8x8_neon.asm b/vp8/common/arm/neon/copymem8x8_neon.asm
6649index 50d39ef..84e0afd 100644
6650--- a/vp8/common/arm/neon/copymem8x8_neon.asm
6651+++ b/vp8/common/arm/neon/copymem8x8_neon.asm
6652@@ -1,10 +1,11 @@
6653 ;
6654 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6655 ;
6656-; Use of this source code is governed by a BSD-style license and patent
6657-; grant that can be found in the LICENSE file in the root of the source
6658-; tree. All contributing project authors may be found in the AUTHORS
6659-; file in the root of the source tree.
6660+; Use of this source code is governed by a BSD-style license
6661+; that can be found in the LICENSE file in the root of the source
6662+; tree. An additional intellectual property rights grant can be found
6663+; in the file PATENTS. All contributing project authors may
6664+; be found in the AUTHORS file in the root of the source tree.
6665 ;
6666
6667
6668diff --git a/vp8/common/arm/neon/iwalsh_neon.asm b/vp8/common/arm/neon/iwalsh_neon.asm
6669index 4fc744c..b8199ce 100644
6670--- a/vp8/common/arm/neon/iwalsh_neon.asm
6671+++ b/vp8/common/arm/neon/iwalsh_neon.asm
6672@@ -1,10 +1,11 @@
6673 ;
6674 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6675 ;
6676-; Use of this source code is governed by a BSD-style license and patent
6677-; grant that can be found in the LICENSE file in the root of the source
6678-; tree. All contributing project authors may be found in the AUTHORS
6679-; file in the root of the source tree.
6680+; Use of this source code is governed by a BSD-style license
6681+; that can be found in the LICENSE file in the root of the source
6682+; tree. An additional intellectual property rights grant can be found
6683+; in the file PATENTS. All contributing project authors may
6684+; be found in the AUTHORS file in the root of the source tree.
6685 ;
6686 EXPORT |vp8_short_inv_walsh4x4_neon|
6687 EXPORT |vp8_short_inv_walsh4x4_1_neon|
6688diff --git a/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm b/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm
6689index e3e8e8a..5d25e3d 100644
6690--- a/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm
6691+++ b/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm
6692@@ -1,10 +1,11 @@
6693 ;
6694 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6695 ;
6696-; Use of this source code is governed by a BSD-style license and patent
6697-; grant that can be found in the LICENSE file in the root of the source
6698-; tree. All contributing project authors may be found in the AUTHORS
6699-; file in the root of the source tree.
6700+; Use of this source code is governed by a BSD-style license
6701+; that can be found in the LICENSE file in the root of the source
6702+; tree. An additional intellectual property rights grant can be found
6703+; in the file PATENTS. All contributing project authors may
6704+; be found in the AUTHORS file in the root of the source tree.
6705 ;
6706
6707
6708diff --git a/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm b/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm
6709index f11055d..ebe52fc 100644
6710--- a/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm
6711+++ b/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm
6712@@ -1,10 +1,11 @@
6713 ;
6714 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6715 ;
6716-; Use of this source code is governed by a BSD-style license and patent
6717-; grant that can be found in the LICENSE file in the root of the source
6718-; tree. All contributing project authors may be found in the AUTHORS
6719-; file in the root of the source tree.
6720+; Use of this source code is governed by a BSD-style license
6721+; that can be found in the LICENSE file in the root of the source
6722+; tree. An additional intellectual property rights grant can be found
6723+; in the file PATENTS. All contributing project authors may
6724+; be found in the AUTHORS file in the root of the source tree.
6725 ;
6726
6727
6728diff --git a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
6729index 6d74fab..dbbdd74 100644
6730--- a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
6731+++ b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
6732@@ -1,10 +1,11 @@
6733 ;
6734 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6735 ;
6736-; Use of this source code is governed by a BSD-style license and patent
6737-; grant that can be found in the LICENSE file in the root of the source
6738-; tree. All contributing project authors may be found in the AUTHORS
6739-; file in the root of the source tree.
6740+; Use of this source code is governed by a BSD-style license
6741+; that can be found in the LICENSE file in the root of the source
6742+; tree. An additional intellectual property rights grant can be found
6743+; in the file PATENTS. All contributing project authors may
6744+; be found in the AUTHORS file in the root of the source tree.
6745 ;
6746
6747
6748diff --git a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
6749index 2bb6222..480e318 100644
6750--- a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
6751+++ b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
6752@@ -1,10 +1,11 @@
6753 ;
6754 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6755 ;
6756-; Use of this source code is governed by a BSD-style license and patent
6757-; grant that can be found in the LICENSE file in the root of the source
6758-; tree. All contributing project authors may be found in the AUTHORS
6759-; file in the root of the source tree.
6760+; Use of this source code is governed by a BSD-style license
6761+; that can be found in the LICENSE file in the root of the source
6762+; tree. An additional intellectual property rights grant can be found
6763+; in the file PATENTS. All contributing project authors may
6764+; be found in the AUTHORS file in the root of the source tree.
6765 ;
6766
6767
6768diff --git a/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm b/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm
6769index d79cc68..a402282 100644
6770--- a/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm
6771+++ b/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm
6772@@ -1,10 +1,11 @@
6773 ;
6774 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6775 ;
6776-; Use of this source code is governed by a BSD-style license and patent
6777-; grant that can be found in the LICENSE file in the root of the source
6778-; tree. All contributing project authors may be found in the AUTHORS
6779-; file in the root of the source tree.
6780+; Use of this source code is governed by a BSD-style license
6781+; that can be found in the LICENSE file in the root of the source
6782+; tree. An additional intellectual property rights grant can be found
6783+; in the file PATENTS. All contributing project authors may
6784+; be found in the AUTHORS file in the root of the source tree.
6785 ;
6786
6787
6788diff --git a/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm b/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm
6789index 3a230a9..18eba9f 100644
6790--- a/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm
6791+++ b/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm
6792@@ -1,10 +1,11 @@
6793 ;
6794 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6795 ;
6796-; Use of this source code is governed by a BSD-style license and patent
6797-; grant that can be found in the LICENSE file in the root of the source
6798-; tree. All contributing project authors may be found in the AUTHORS
6799-; file in the root of the source tree.
6800+; Use of this source code is governed by a BSD-style license
6801+; that can be found in the LICENSE file in the root of the source
6802+; tree. An additional intellectual property rights grant can be found
6803+; in the file PATENTS. All contributing project authors may
6804+; be found in the AUTHORS file in the root of the source tree.
6805 ;
6806
6807
6808diff --git a/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm b/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm
6809index 86eddaa..21b85da 100644
6810--- a/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm
6811+++ b/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm
6812@@ -1,10 +1,11 @@
6813 ;
6814 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6815 ;
6816-; Use of this source code is governed by a BSD-style license and patent
6817-; grant that can be found in the LICENSE file in the root of the source
6818-; tree. All contributing project authors may be found in the AUTHORS
6819-; file in the root of the source tree.
6820+; Use of this source code is governed by a BSD-style license
6821+; that can be found in the LICENSE file in the root of the source
6822+; tree. An additional intellectual property rights grant can be found
6823+; in the file PATENTS. All contributing project authors may
6824+; be found in the AUTHORS file in the root of the source tree.
6825 ;
6826
6827
6828diff --git a/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm b/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm
6829index 2ab0fc2..64d98c6 100644
6830--- a/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm
6831+++ b/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm
6832@@ -1,10 +1,11 @@
6833 ;
6834 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6835 ;
6836-; Use of this source code is governed by a BSD-style license and patent
6837-; grant that can be found in the LICENSE file in the root of the source
6838-; tree. All contributing project authors may be found in the AUTHORS
6839-; file in the root of the source tree.
6840+; Use of this source code is governed by a BSD-style license
6841+; that can be found in the LICENSE file in the root of the source
6842+; tree. An additional intellectual property rights grant can be found
6843+; in the file PATENTS. All contributing project authors may
6844+; be found in the AUTHORS file in the root of the source tree.
6845 ;
6846
6847
6848diff --git a/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm b/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm
6849index ad5afba..0e72e80 100644
6850--- a/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm
6851+++ b/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm
6852@@ -1,10 +1,11 @@
6853 ;
6854 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6855 ;
6856-; Use of this source code is governed by a BSD-style license and patent
6857-; grant that can be found in the LICENSE file in the root of the source
6858-; tree. All contributing project authors may be found in the AUTHORS
6859-; file in the root of the source tree.
6860+; Use of this source code is governed by a BSD-style license
6861+; that can be found in the LICENSE file in the root of the source
6862+; tree. An additional intellectual property rights grant can be found
6863+; in the file PATENTS. All contributing project authors may
6864+; be found in the AUTHORS file in the root of the source tree.
6865 ;
6866
6867
6868diff --git a/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm b/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm
6869index 60e5175..91396a1 100644
6870--- a/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm
6871+++ b/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm
6872@@ -1,10 +1,11 @@
6873 ;
6874 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6875 ;
6876-; Use of this source code is governed by a BSD-style license and patent
6877-; grant that can be found in the LICENSE file in the root of the source
6878-; tree. All contributing project authors may be found in the AUTHORS
6879-; file in the root of the source tree.
6880+; Use of this source code is governed by a BSD-style license
6881+; that can be found in the LICENSE file in the root of the source
6882+; tree. An additional intellectual property rights grant can be found
6883+; in the file PATENTS. All contributing project authors may
6884+; be found in the AUTHORS file in the root of the source tree.
6885 ;
6886
6887
6888diff --git a/vp8/common/arm/neon/recon16x16mb_neon.asm b/vp8/common/arm/neon/recon16x16mb_neon.asm
6889index b9ba1cb..7c06c03 100644
6890--- a/vp8/common/arm/neon/recon16x16mb_neon.asm
6891+++ b/vp8/common/arm/neon/recon16x16mb_neon.asm
6892@@ -1,10 +1,11 @@
6893 ;
6894 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6895 ;
6896-; Use of this source code is governed by a BSD-style license and patent
6897-; grant that can be found in the LICENSE file in the root of the source
6898-; tree. All contributing project authors may be found in the AUTHORS
6899-; file in the root of the source tree.
6900+; Use of this source code is governed by a BSD-style license
6901+; that can be found in the LICENSE file in the root of the source
6902+; tree. An additional intellectual property rights grant can be found
6903+; in the file PATENTS. All contributing project authors may
6904+; be found in the AUTHORS file in the root of the source tree.
6905 ;
6906
6907
6908diff --git a/vp8/common/arm/neon/recon2b_neon.asm b/vp8/common/arm/neon/recon2b_neon.asm
6909index 25aaf8c..3d87e2d 100644
6910--- a/vp8/common/arm/neon/recon2b_neon.asm
6911+++ b/vp8/common/arm/neon/recon2b_neon.asm
6912@@ -1,10 +1,11 @@
6913 ;
6914 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6915 ;
6916-; Use of this source code is governed by a BSD-style license and patent
6917-; grant that can be found in the LICENSE file in the root of the source
6918-; tree. All contributing project authors may be found in the AUTHORS
6919-; file in the root of the source tree.
6920+; Use of this source code is governed by a BSD-style license
6921+; that can be found in the LICENSE file in the root of the source
6922+; tree. An additional intellectual property rights grant can be found
6923+; in the file PATENTS. All contributing project authors may
6924+; be found in the AUTHORS file in the root of the source tree.
6925 ;
6926
6927
6928diff --git a/vp8/common/arm/neon/recon4b_neon.asm b/vp8/common/arm/neon/recon4b_neon.asm
6929index a4f5b80..63cd987 100644
6930--- a/vp8/common/arm/neon/recon4b_neon.asm
6931+++ b/vp8/common/arm/neon/recon4b_neon.asm
6932@@ -1,10 +1,11 @@
6933 ;
6934 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6935 ;
6936-; Use of this source code is governed by a BSD-style license and patent
6937-; grant that can be found in the LICENSE file in the root of the source
6938-; tree. All contributing project authors may be found in the AUTHORS
6939-; file in the root of the source tree.
6940+; Use of this source code is governed by a BSD-style license
6941+; that can be found in the LICENSE file in the root of the source
6942+; tree. An additional intellectual property rights grant can be found
6943+; in the file PATENTS. All contributing project authors may
6944+; be found in the AUTHORS file in the root of the source tree.
6945 ;
6946
6947
6948diff --git a/vp8/common/arm/neon/reconb_neon.asm b/vp8/common/arm/neon/reconb_neon.asm
6949index 16d85a0..0ecdc14 100644
6950--- a/vp8/common/arm/neon/reconb_neon.asm
6951+++ b/vp8/common/arm/neon/reconb_neon.asm
6952@@ -1,10 +1,11 @@
6953 ;
6954 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6955 ;
6956-; Use of this source code is governed by a BSD-style license and patent
6957-; grant that can be found in the LICENSE file in the root of the source
6958-; tree. All contributing project authors may be found in the AUTHORS
6959-; file in the root of the source tree.
6960+; Use of this source code is governed by a BSD-style license
6961+; that can be found in the LICENSE file in the root of the source
6962+; tree. An additional intellectual property rights grant can be found
6963+; in the file PATENTS. All contributing project authors may
6964+; be found in the AUTHORS file in the root of the source tree.
6965 ;
6966
6967
6968diff --git a/vp8/common/arm/neon/save_neon_reg.asm b/vp8/common/arm/neon/save_neon_reg.asm
6969index 4873e44..f5db2a8 100644
6970--- a/vp8/common/arm/neon/save_neon_reg.asm
6971+++ b/vp8/common/arm/neon/save_neon_reg.asm
6972@@ -1,10 +1,11 @@
6973 ;
6974 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6975 ;
6976-; Use of this source code is governed by a BSD-style license and patent
6977-; grant that can be found in the LICENSE file in the root of the source
6978-; tree. All contributing project authors may be found in the AUTHORS
6979-; file in the root of the source tree.
6980+; Use of this source code is governed by a BSD-style license
6981+; that can be found in the LICENSE file in the root of the source
6982+; tree. An additional intellectual property rights grant can be found
6983+; in the file PATENTS. All contributing project authors may
6984+; be found in the AUTHORS file in the root of the source tree.
6985 ;
6986
6987
6988diff --git a/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm b/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm
6989index 7d06ff9..24e5fed 100644
6990--- a/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm
6991+++ b/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm
6992@@ -1,10 +1,11 @@
6993 ;
6994 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
6995 ;
6996-; Use of this source code is governed by a BSD-style license and patent
6997-; grant that can be found in the LICENSE file in the root of the source
6998-; tree. All contributing project authors may be found in the AUTHORS
6999-; file in the root of the source tree.
7000+; Use of this source code is governed by a BSD-style license
7001+; that can be found in the LICENSE file in the root of the source
7002+; tree. An additional intellectual property rights grant can be found
7003+; in the file PATENTS. All contributing project authors may
7004+; be found in the AUTHORS file in the root of the source tree.
7005 ;
7006
7007
7008diff --git a/vp8/common/arm/neon/shortidct4x4llm_neon.asm b/vp8/common/arm/neon/shortidct4x4llm_neon.asm
7009index ffecfbf..c566c67 100644
7010--- a/vp8/common/arm/neon/shortidct4x4llm_neon.asm
7011+++ b/vp8/common/arm/neon/shortidct4x4llm_neon.asm
7012@@ -1,10 +1,11 @@
7013 ;
7014 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7015 ;
7016-; Use of this source code is governed by a BSD-style license and patent
7017-; grant that can be found in the LICENSE file in the root of the source
7018-; tree. All contributing project authors may be found in the AUTHORS
7019-; file in the root of the source tree.
7020+; Use of this source code is governed by a BSD-style license
7021+; that can be found in the LICENSE file in the root of the source
7022+; tree. An additional intellectual property rights grant can be found
7023+; in the file PATENTS. All contributing project authors may
7024+; be found in the AUTHORS file in the root of the source tree.
7025 ;
7026
7027
7028diff --git a/vp8/common/arm/neon/sixtappredict16x16_neon.asm b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
7029index 9f5f0d2..6f3716d 100644
7030--- a/vp8/common/arm/neon/sixtappredict16x16_neon.asm
7031+++ b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
7032@@ -1,10 +1,11 @@
7033 ;
7034 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7035 ;
7036-; Use of this source code is governed by a BSD-style license and patent
7037-; grant that can be found in the LICENSE file in the root of the source
7038-; tree. All contributing project authors may be found in the AUTHORS
7039-; file in the root of the source tree.
7040+; Use of this source code is governed by a BSD-style license
7041+; that can be found in the LICENSE file in the root of the source
7042+; tree. An additional intellectual property rights grant can be found
7043+; in the file PATENTS. All contributing project authors may
7044+; be found in the AUTHORS file in the root of the source tree.
7045 ;
7046
7047
7048diff --git a/vp8/common/arm/neon/sixtappredict4x4_neon.asm b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
7049index c23a9db..6fe9ead 100644
7050--- a/vp8/common/arm/neon/sixtappredict4x4_neon.asm
7051+++ b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
7052@@ -1,10 +1,11 @@
7053 ;
7054 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7055 ;
7056-; Use of this source code is governed by a BSD-style license and patent
7057-; grant that can be found in the LICENSE file in the root of the source
7058-; tree. All contributing project authors may be found in the AUTHORS
7059-; file in the root of the source tree.
7060+; Use of this source code is governed by a BSD-style license
7061+; that can be found in the LICENSE file in the root of the source
7062+; tree. An additional intellectual property rights grant can be found
7063+; in the file PATENTS. All contributing project authors may
7064+; be found in the AUTHORS file in the root of the source tree.
7065 ;
7066
7067
7068diff --git a/vp8/common/arm/neon/sixtappredict8x4_neon.asm b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
7069index 18e19f9..a6ff4f7 100644
7070--- a/vp8/common/arm/neon/sixtappredict8x4_neon.asm
7071+++ b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
7072@@ -1,10 +1,11 @@
7073 ;
7074 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7075 ;
7076-; Use of this source code is governed by a BSD-style license and patent
7077-; grant that can be found in the LICENSE file in the root of the source
7078-; tree. All contributing project authors may be found in the AUTHORS
7079-; file in the root of the source tree.
7080+; Use of this source code is governed by a BSD-style license
7081+; that can be found in the LICENSE file in the root of the source
7082+; tree. An additional intellectual property rights grant can be found
7083+; in the file PATENTS. All contributing project authors may
7084+; be found in the AUTHORS file in the root of the source tree.
7085 ;
7086
7087
7088diff --git a/vp8/common/arm/neon/sixtappredict8x8_neon.asm b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
7089index d27485e..bb35ae4 100644
7090--- a/vp8/common/arm/neon/sixtappredict8x8_neon.asm
7091+++ b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
7092@@ -1,10 +1,11 @@
7093 ;
7094 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7095 ;
7096-; Use of this source code is governed by a BSD-style license and patent
7097-; grant that can be found in the LICENSE file in the root of the source
7098-; tree. All contributing project authors may be found in the AUTHORS
7099-; file in the root of the source tree.
7100+; Use of this source code is governed by a BSD-style license
7101+; that can be found in the LICENSE file in the root of the source
7102+; tree. An additional intellectual property rights grant can be found
7103+; in the file PATENTS. All contributing project authors may
7104+; be found in the AUTHORS file in the root of the source tree.
7105 ;
7106
7107
7108diff --git a/vp8/common/arm/recon_arm.c b/vp8/common/arm/recon_arm.c
7109index 130059e..2cc9ee7 100644
7110--- a/vp8/common/arm/recon_arm.c
7111+++ b/vp8/common/arm/recon_arm.c
7112@@ -1,10 +1,11 @@
7113 /*
7114 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7115 *
7116- * Use of this source code is governed by a BSD-style license and patent
7117- * grant that can be found in the LICENSE file in the root of the source
7118- * tree. All contributing project authors may be found in the AUTHORS
7119- * file in the root of the source tree.
7120+ * Use of this source code is governed by a BSD-style license
7121+ * that can be found in the LICENSE file in the root of the source
7122+ * tree. An additional intellectual property rights grant can be found
7123+ * in the file PATENTS. All contributing project authors may
7124+ * be found in the AUTHORS file in the root of the source tree.
7125 */
7126
7127
7128diff --git a/vp8/common/arm/recon_arm.h b/vp8/common/arm/recon_arm.h
7129index fd9f85e..392297b 100644
7130--- a/vp8/common/arm/recon_arm.h
7131+++ b/vp8/common/arm/recon_arm.h
7132@@ -1,10 +1,11 @@
7133 /*
7134 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7135 *
7136- * Use of this source code is governed by a BSD-style license and patent
7137- * grant that can be found in the LICENSE file in the root of the source
7138- * tree. All contributing project authors may be found in the AUTHORS
7139- * file in the root of the source tree.
7140+ * Use of this source code is governed by a BSD-style license
7141+ * that can be found in the LICENSE file in the root of the source
7142+ * tree. An additional intellectual property rights grant can be found
7143+ * in the file PATENTS. All contributing project authors may
7144+ * be found in the AUTHORS file in the root of the source tree.
7145 */
7146
7147
7148diff --git a/vp8/common/arm/reconintra4x4_arm.c b/vp8/common/arm/reconintra4x4_arm.c
7149index 334d352..65fb1f0 100644
7150--- a/vp8/common/arm/reconintra4x4_arm.c
7151+++ b/vp8/common/arm/reconintra4x4_arm.c
7152@@ -1,10 +1,11 @@
7153 /*
7154 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7155 *
7156- * Use of this source code is governed by a BSD-style license and patent
7157- * grant that can be found in the LICENSE file in the root of the source
7158- * tree. All contributing project authors may be found in the AUTHORS
7159- * file in the root of the source tree.
7160+ * Use of this source code is governed by a BSD-style license
7161+ * that can be found in the LICENSE file in the root of the source
7162+ * tree. An additional intellectual property rights grant can be found
7163+ * in the file PATENTS. All contributing project authors may
7164+ * be found in the AUTHORS file in the root of the source tree.
7165 */
7166
7167
7168diff --git a/vp8/common/arm/reconintra_arm.c b/vp8/common/arm/reconintra_arm.c
7169index d7ee1dd..29f4a2c 100644
7170--- a/vp8/common/arm/reconintra_arm.c
7171+++ b/vp8/common/arm/reconintra_arm.c
7172@@ -1,10 +1,11 @@
7173 /*
7174 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7175 *
7176- * Use of this source code is governed by a BSD-style license and patent
7177- * grant that can be found in the LICENSE file in the root of the source
7178- * tree. All contributing project authors may be found in the AUTHORS
7179- * file in the root of the source tree.
7180+ * Use of this source code is governed by a BSD-style license
7181+ * that can be found in the LICENSE file in the root of the source
7182+ * tree. An additional intellectual property rights grant can be found
7183+ * in the file PATENTS. All contributing project authors may
7184+ * be found in the AUTHORS file in the root of the source tree.
7185 */
7186
7187
7188diff --git a/vp8/common/arm/subpixel_arm.h b/vp8/common/arm/subpixel_arm.h
7189index 56aec55..0eb2c58 100644
7190--- a/vp8/common/arm/subpixel_arm.h
7191+++ b/vp8/common/arm/subpixel_arm.h
7192@@ -1,10 +1,11 @@
7193 /*
7194 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7195 *
7196- * Use of this source code is governed by a BSD-style license and patent
7197- * grant that can be found in the LICENSE file in the root of the source
7198- * tree. All contributing project authors may be found in the AUTHORS
7199- * file in the root of the source tree.
7200+ * Use of this source code is governed by a BSD-style license
7201+ * that can be found in the LICENSE file in the root of the source
7202+ * tree. An additional intellectual property rights grant can be found
7203+ * in the file PATENTS. All contributing project authors may
7204+ * be found in the AUTHORS file in the root of the source tree.
7205 */
7206
7207
7208diff --git a/vp8/common/arm/systemdependent.c b/vp8/common/arm/systemdependent.c
7209index ecc6929..27d3dee 100644
7210--- a/vp8/common/arm/systemdependent.c
7211+++ b/vp8/common/arm/systemdependent.c
7212@@ -1,10 +1,11 @@
7213 /*
7214 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7215 *
7216- * Use of this source code is governed by a BSD-style license and patent
7217- * grant that can be found in the LICENSE file in the root of the source
7218- * tree. All contributing project authors may be found in the AUTHORS
7219- * file in the root of the source tree.
7220+ * Use of this source code is governed by a BSD-style license
7221+ * that can be found in the LICENSE file in the root of the source
7222+ * tree. An additional intellectual property rights grant can be found
7223+ * in the file PATENTS. All contributing project authors may
7224+ * be found in the AUTHORS file in the root of the source tree.
7225 */
7226
7227
7228diff --git a/vp8/common/arm/vpx_asm_offsets.c b/vp8/common/arm/vpx_asm_offsets.c
7229index 68634bf..ff4d752 100644
7230--- a/vp8/common/arm/vpx_asm_offsets.c
7231+++ b/vp8/common/arm/vpx_asm_offsets.c
7232@@ -1,10 +1,11 @@
7233 /*
7234 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7235 *
7236- * Use of this source code is governed by a BSD-style license and patent
7237- * grant that can be found in the LICENSE file in the root of the source
7238- * tree. All contributing project authors may be found in the AUTHORS
7239- * file in the root of the source tree.
7240+ * Use of this source code is governed by a BSD-style license
7241+ * that can be found in the LICENSE file in the root of the source
7242+ * tree. An additional intellectual property rights grant can be found
7243+ * in the file PATENTS. All contributing project authors may
7244+ * be found in the AUTHORS file in the root of the source tree.
7245 */
7246
7247
7248diff --git a/vp8/common/bigend.h b/vp8/common/bigend.h
7249index 6a91ba1..cd6b988 100644
7250--- a/vp8/common/bigend.h
7251+++ b/vp8/common/bigend.h
7252@@ -1,10 +1,11 @@
7253 /*
7254 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7255 *
7256- * Use of this source code is governed by a BSD-style license and patent
7257- * grant that can be found in the LICENSE file in the root of the source
7258- * tree. All contributing project authors may be found in the AUTHORS
7259- * file in the root of the source tree.
7260+ * Use of this source code is governed by a BSD-style license
7261+ * that can be found in the LICENSE file in the root of the source
7262+ * tree. An additional intellectual property rights grant can be found
7263+ * in the file PATENTS. All contributing project authors may
7264+ * be found in the AUTHORS file in the root of the source tree.
7265 */
7266
7267
7268diff --git a/vp8/common/blockd.c b/vp8/common/blockd.c
7269index 53f5e72..e0ed561 100644
7270--- a/vp8/common/blockd.c
7271+++ b/vp8/common/blockd.c
7272@@ -1,10 +1,11 @@
7273 /*
7274 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7275 *
7276- * Use of this source code is governed by a BSD-style license and patent
7277- * grant that can be found in the LICENSE file in the root of the source
7278- * tree. All contributing project authors may be found in the AUTHORS
7279- * file in the root of the source tree.
7280+ * Use of this source code is governed by a BSD-style license
7281+ * that can be found in the LICENSE file in the root of the source
7282+ * tree. An additional intellectual property rights grant can be found
7283+ * in the file PATENTS. All contributing project authors may
7284+ * be found in the AUTHORS file in the root of the source tree.
7285 */
7286
7287
7288diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
7289index 84ed53a..2b25f62 100644
7290--- a/vp8/common/blockd.h
7291+++ b/vp8/common/blockd.h
7292@@ -1,10 +1,11 @@
7293 /*
7294 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7295 *
7296- * Use of this source code is governed by a BSD-style license and patent
7297- * grant that can be found in the LICENSE file in the root of the source
7298- * tree. All contributing project authors may be found in the AUTHORS
7299- * file in the root of the source tree.
7300+ * Use of this source code is governed by a BSD-style license
7301+ * that can be found in the LICENSE file in the root of the source
7302+ * tree. An additional intellectual property rights grant can be found
7303+ * in the file PATENTS. All contributing project authors may
7304+ * be found in the AUTHORS file in the root of the source tree.
7305 */
7306
7307
7308@@ -173,9 +174,8 @@ typedef struct
7309 int dc_diff;
7310 unsigned char segment_id; // Which set of segmentation parameters should be used for this MB
7311 int force_no_skip;
7312-
7313+ int need_to_clamp_mvs;
7314 B_MODE_INFO partition_bmi[16];
7315-
7316 } MB_MODE_INFO;
7317
7318
7319diff --git a/vp8/common/boolcoder.h b/vp8/common/boolcoder.h
7320index 0659d48..66f67c2 100644
7321--- a/vp8/common/boolcoder.h
7322+++ b/vp8/common/boolcoder.h
7323@@ -1,10 +1,11 @@
7324 /*
7325 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7326 *
7327- * Use of this source code is governed by a BSD-style license and patent
7328- * grant that can be found in the LICENSE file in the root of the source
7329- * tree. All contributing project authors may be found in the AUTHORS
7330- * file in the root of the source tree.
7331+ * Use of this source code is governed by a BSD-style license
7332+ * that can be found in the LICENSE file in the root of the source
7333+ * tree. An additional intellectual property rights grant can be found
7334+ * in the file PATENTS. All contributing project authors may
7335+ * be found in the AUTHORS file in the root of the source tree.
7336 */
7337
7338
7339diff --git a/vp8/common/codec_common_interface.h b/vp8/common/codec_common_interface.h
7340index 7881b0a..d836564 100644
7341--- a/vp8/common/codec_common_interface.h
7342+++ b/vp8/common/codec_common_interface.h
7343@@ -1,10 +1,11 @@
7344 /*
7345 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7346 *
7347- * Use of this source code is governed by a BSD-style license and patent
7348- * grant that can be found in the LICENSE file in the root of the source
7349- * tree. All contributing project authors may be found in the AUTHORS
7350- * file in the root of the source tree.
7351+ * Use of this source code is governed by a BSD-style license
7352+ * that can be found in the LICENSE file in the root of the source
7353+ * tree. An additional intellectual property rights grant can be found
7354+ * in the file PATENTS. All contributing project authors may
7355+ * be found in the AUTHORS file in the root of the source tree.
7356 */
7357
7358 #ifndef CODEC_COMMON_INTERFACE_H
7359diff --git a/vp8/common/coefupdateprobs.h b/vp8/common/coefupdateprobs.h
7360index 99affd6..6131d12 100644
7361--- a/vp8/common/coefupdateprobs.h
7362+++ b/vp8/common/coefupdateprobs.h
7363@@ -1,10 +1,11 @@
7364 /*
7365 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7366 *
7367- * Use of this source code is governed by a BSD-style license and patent
7368- * grant that can be found in the LICENSE file in the root of the source
7369- * tree. All contributing project authors may be found in the AUTHORS
7370- * file in the root of the source tree.
7371+ * Use of this source code is governed by a BSD-style license
7372+ * that can be found in the LICENSE file in the root of the source
7373+ * tree. An additional intellectual property rights grant can be found
7374+ * in the file PATENTS. All contributing project authors may
7375+ * be found in the AUTHORS file in the root of the source tree.
7376 */
7377
7378
7379diff --git a/vp8/common/common.h b/vp8/common/common.h
7380index 29f6d37..bfa8a9c 100644
7381--- a/vp8/common/common.h
7382+++ b/vp8/common/common.h
7383@@ -1,10 +1,11 @@
7384 /*
7385 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7386 *
7387- * Use of this source code is governed by a BSD-style license and patent
7388- * grant that can be found in the LICENSE file in the root of the source
7389- * tree. All contributing project authors may be found in the AUTHORS
7390- * file in the root of the source tree.
7391+ * Use of this source code is governed by a BSD-style license
7392+ * that can be found in the LICENSE file in the root of the source
7393+ * tree. An additional intellectual property rights grant can be found
7394+ * in the file PATENTS. All contributing project authors may
7395+ * be found in the AUTHORS file in the root of the source tree.
7396 */
7397
7398
7399diff --git a/vp8/common/common_types.h b/vp8/common/common_types.h
7400index deb5ed8..a307ed6 100644
7401--- a/vp8/common/common_types.h
7402+++ b/vp8/common/common_types.h
7403@@ -1,10 +1,11 @@
7404 /*
7405 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7406 *
7407- * Use of this source code is governed by a BSD-style license and patent
7408- * grant that can be found in the LICENSE file in the root of the source
7409- * tree. All contributing project authors may be found in the AUTHORS
7410- * file in the root of the source tree.
7411+ * Use of this source code is governed by a BSD-style license
7412+ * that can be found in the LICENSE file in the root of the source
7413+ * tree. An additional intellectual property rights grant can be found
7414+ * in the file PATENTS. All contributing project authors may
7415+ * be found in the AUTHORS file in the root of the source tree.
7416 */
7417
7418
7419diff --git a/vp8/common/context.c b/vp8/common/context.c
7420index 17ee8c3..f0cb838 100644
7421--- a/vp8/common/context.c
7422+++ b/vp8/common/context.c
7423@@ -1,10 +1,11 @@
7424 /*
7425 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7426 *
7427- * Use of this source code is governed by a BSD-style license and patent
7428- * grant that can be found in the LICENSE file in the root of the source
7429- * tree. All contributing project authors may be found in the AUTHORS
7430- * file in the root of the source tree.
7431+ * Use of this source code is governed by a BSD-style license
7432+ * that can be found in the LICENSE file in the root of the source
7433+ * tree. An additional intellectual property rights grant can be found
7434+ * in the file PATENTS. All contributing project authors may
7435+ * be found in the AUTHORS file in the root of the source tree.
7436 */
7437
7438
7439diff --git a/vp8/common/debugmodes.c b/vp8/common/debugmodes.c
7440index e2d2d2c..e669814 100644
7441--- a/vp8/common/debugmodes.c
7442+++ b/vp8/common/debugmodes.c
7443@@ -1,10 +1,11 @@
7444 /*
7445 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7446 *
7447- * Use of this source code is governed by a BSD-style license and patent
7448- * grant that can be found in the LICENSE file in the root of the source
7449- * tree. All contributing project authors may be found in the AUTHORS
7450- * file in the root of the source tree.
7451+ * Use of this source code is governed by a BSD-style license
7452+ * that can be found in the LICENSE file in the root of the source
7453+ * tree. An additional intellectual property rights grant can be found
7454+ * in the file PATENTS. All contributing project authors may
7455+ * be found in the AUTHORS file in the root of the source tree.
7456 */
7457
7458
7459diff --git a/vp8/common/defaultcoefcounts.h b/vp8/common/defaultcoefcounts.h
7460index ccdf326..f9247d2 100644
7461--- a/vp8/common/defaultcoefcounts.h
7462+++ b/vp8/common/defaultcoefcounts.h
7463@@ -1,10 +1,11 @@
7464 /*
7465 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7466 *
7467- * Use of this source code is governed by a BSD-style license and patent
7468- * grant that can be found in the LICENSE file in the root of the source
7469- * tree. All contributing project authors may be found in the AUTHORS
7470- * file in the root of the source tree.
7471+ * Use of this source code is governed by a BSD-style license
7472+ * that can be found in the LICENSE file in the root of the source
7473+ * tree. An additional intellectual property rights grant can be found
7474+ * in the file PATENTS. All contributing project authors may
7475+ * be found in the AUTHORS file in the root of the source tree.
7476 */
7477
7478
7479diff --git a/vp8/common/dma_desc.h b/vp8/common/dma_desc.h
7480index 5e6fa0c..765405d 100644
7481--- a/vp8/common/dma_desc.h
7482+++ b/vp8/common/dma_desc.h
7483@@ -1,10 +1,11 @@
7484 /*
7485 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7486 *
7487- * Use of this source code is governed by a BSD-style license and patent
7488- * grant that can be found in the LICENSE file in the root of the source
7489- * tree. All contributing project authors may be found in the AUTHORS
7490- * file in the root of the source tree.
7491+ * Use of this source code is governed by a BSD-style license
7492+ * that can be found in the LICENSE file in the root of the source
7493+ * tree. An additional intellectual property rights grant can be found
7494+ * in the file PATENTS. All contributing project authors may
7495+ * be found in the AUTHORS file in the root of the source tree.
7496 */
7497
7498
7499diff --git a/vp8/common/duck_io.h b/vp8/common/duck_io.h
7500index f63a5cd..02f6895 100644
7501--- a/vp8/common/duck_io.h
7502+++ b/vp8/common/duck_io.h
7503@@ -1,10 +1,11 @@
7504 /*
7505 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7506 *
7507- * Use of this source code is governed by a BSD-style license and patent
7508- * grant that can be found in the LICENSE file in the root of the source
7509- * tree. All contributing project authors may be found in the AUTHORS
7510- * file in the root of the source tree.
7511+ * Use of this source code is governed by a BSD-style license
7512+ * that can be found in the LICENSE file in the root of the source
7513+ * tree. An additional intellectual property rights grant can be found
7514+ * in the file PATENTS. All contributing project authors may
7515+ * be found in the AUTHORS file in the root of the source tree.
7516 */
7517
7518
7519diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c
7520index e524c2a..8d01bf8 100644
7521--- a/vp8/common/entropy.c
7522+++ b/vp8/common/entropy.c
7523@@ -1,10 +1,11 @@
7524 /*
7525 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7526 *
7527- * Use of this source code is governed by a BSD-style license and patent
7528- * grant that can be found in the LICENSE file in the root of the source
7529- * tree. All contributing project authors may be found in the AUTHORS
7530- * file in the root of the source tree.
7531+ * Use of this source code is governed by a BSD-style license
7532+ * that can be found in the LICENSE file in the root of the source
7533+ * tree. An additional intellectual property rights grant can be found
7534+ * in the file PATENTS. All contributing project authors may
7535+ * be found in the AUTHORS file in the root of the source tree.
7536 */
7537
7538
7539diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h
7540index 1415832..29be82c 100644
7541--- a/vp8/common/entropy.h
7542+++ b/vp8/common/entropy.h
7543@@ -1,10 +1,11 @@
7544 /*
7545 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7546 *
7547- * Use of this source code is governed by a BSD-style license and patent
7548- * grant that can be found in the LICENSE file in the root of the source
7549- * tree. All contributing project authors may be found in the AUTHORS
7550- * file in the root of the source tree.
7551+ * Use of this source code is governed by a BSD-style license
7552+ * that can be found in the LICENSE file in the root of the source
7553+ * tree. An additional intellectual property rights grant can be found
7554+ * in the file PATENTS. All contributing project authors may
7555+ * be found in the AUTHORS file in the root of the source tree.
7556 */
7557
7558
7559diff --git a/vp8/common/entropymode.c b/vp8/common/entropymode.c
7560index 7dc1acd..72cbd64 100644
7561--- a/vp8/common/entropymode.c
7562+++ b/vp8/common/entropymode.c
7563@@ -1,10 +1,11 @@
7564 /*
7565 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7566 *
7567- * Use of this source code is governed by a BSD-style license and patent
7568- * grant that can be found in the LICENSE file in the root of the source
7569- * tree. All contributing project authors may be found in the AUTHORS
7570- * file in the root of the source tree.
7571+ * Use of this source code is governed by a BSD-style license
7572+ * that can be found in the LICENSE file in the root of the source
7573+ * tree. An additional intellectual property rights grant can be found
7574+ * in the file PATENTS. All contributing project authors may
7575+ * be found in the AUTHORS file in the root of the source tree.
7576 */
7577
7578
7579diff --git a/vp8/common/entropymode.h b/vp8/common/entropymode.h
7580index ff630a4..bd44b83 100644
7581--- a/vp8/common/entropymode.h
7582+++ b/vp8/common/entropymode.h
7583@@ -1,10 +1,11 @@
7584 /*
7585 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7586 *
7587- * Use of this source code is governed by a BSD-style license and patent
7588- * grant that can be found in the LICENSE file in the root of the source
7589- * tree. All contributing project authors may be found in the AUTHORS
7590- * file in the root of the source tree.
7591+ * Use of this source code is governed by a BSD-style license
7592+ * that can be found in the LICENSE file in the root of the source
7593+ * tree. An additional intellectual property rights grant can be found
7594+ * in the file PATENTS. All contributing project authors may
7595+ * be found in the AUTHORS file in the root of the source tree.
7596 */
7597
7598
7599diff --git a/vp8/common/entropymv.c b/vp8/common/entropymv.c
7600index 2b00c17..176fecd 100644
7601--- a/vp8/common/entropymv.c
7602+++ b/vp8/common/entropymv.c
7603@@ -1,10 +1,11 @@
7604 /*
7605 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7606 *
7607- * Use of this source code is governed by a BSD-style license and patent
7608- * grant that can be found in the LICENSE file in the root of the source
7609- * tree. All contributing project authors may be found in the AUTHORS
7610- * file in the root of the source tree.
7611+ * Use of this source code is governed by a BSD-style license
7612+ * that can be found in the LICENSE file in the root of the source
7613+ * tree. An additional intellectual property rights grant can be found
7614+ * in the file PATENTS. All contributing project authors may
7615+ * be found in the AUTHORS file in the root of the source tree.
7616 */
7617
7618
7619diff --git a/vp8/common/entropymv.h b/vp8/common/entropymv.h
7620index d940c59..395984c 100644
7621--- a/vp8/common/entropymv.h
7622+++ b/vp8/common/entropymv.h
7623@@ -1,10 +1,11 @@
7624 /*
7625 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7626 *
7627- * Use of this source code is governed by a BSD-style license and patent
7628- * grant that can be found in the LICENSE file in the root of the source
7629- * tree. All contributing project authors may be found in the AUTHORS
7630- * file in the root of the source tree.
7631+ * Use of this source code is governed by a BSD-style license
7632+ * that can be found in the LICENSE file in the root of the source
7633+ * tree. An additional intellectual property rights grant can be found
7634+ * in the file PATENTS. All contributing project authors may
7635+ * be found in the AUTHORS file in the root of the source tree.
7636 */
7637
7638
7639diff --git a/vp8/common/extend.c b/vp8/common/extend.c
7640index 7407952..43d7aed 100644
7641--- a/vp8/common/extend.c
7642+++ b/vp8/common/extend.c
7643@@ -1,10 +1,11 @@
7644 /*
7645 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7646 *
7647- * Use of this source code is governed by a BSD-style license and patent
7648- * grant that can be found in the LICENSE file in the root of the source
7649- * tree. All contributing project authors may be found in the AUTHORS
7650- * file in the root of the source tree.
7651+ * Use of this source code is governed by a BSD-style license
7652+ * that can be found in the LICENSE file in the root of the source
7653+ * tree. An additional intellectual property rights grant can be found
7654+ * in the file PATENTS. All contributing project authors may
7655+ * be found in the AUTHORS file in the root of the source tree.
7656 */
7657
7658
7659diff --git a/vp8/common/extend.h b/vp8/common/extend.h
7660index 6809ae7..bb8a016 100644
7661--- a/vp8/common/extend.h
7662+++ b/vp8/common/extend.h
7663@@ -1,10 +1,11 @@
7664 /*
7665 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7666 *
7667- * Use of this source code is governed by a BSD-style license and patent
7668- * grant that can be found in the LICENSE file in the root of the source
7669- * tree. All contributing project authors may be found in the AUTHORS
7670- * file in the root of the source tree.
7671+ * Use of this source code is governed by a BSD-style license
7672+ * that can be found in the LICENSE file in the root of the source
7673+ * tree. An additional intellectual property rights grant can be found
7674+ * in the file PATENTS. All contributing project authors may
7675+ * be found in the AUTHORS file in the root of the source tree.
7676 */
7677
7678
7679diff --git a/vp8/common/filter_c.c b/vp8/common/filter_c.c
7680index 38991cb..f24f8a2 100644
7681--- a/vp8/common/filter_c.c
7682+++ b/vp8/common/filter_c.c
7683@@ -1,10 +1,11 @@
7684 /*
7685 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7686 *
7687- * Use of this source code is governed by a BSD-style license and patent
7688- * grant that can be found in the LICENSE file in the root of the source
7689- * tree. All contributing project authors may be found in the AUTHORS
7690- * file in the root of the source tree.
7691+ * Use of this source code is governed by a BSD-style license
7692+ * that can be found in the LICENSE file in the root of the source
7693+ * tree. An additional intellectual property rights grant can be found
7694+ * in the file PATENTS. All contributing project authors may
7695+ * be found in the AUTHORS file in the root of the source tree.
7696 */
7697
7698
7699diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c
7700index fcb1f20..550681e 100644
7701--- a/vp8/common/findnearmv.c
7702+++ b/vp8/common/findnearmv.c
7703@@ -1,10 +1,11 @@
7704 /*
7705 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7706 *
7707- * Use of this source code is governed by a BSD-style license and patent
7708- * grant that can be found in the LICENSE file in the root of the source
7709- * tree. All contributing project authors may be found in the AUTHORS
7710- * file in the root of the source tree.
7711+ * Use of this source code is governed by a BSD-style license
7712+ * that can be found in the LICENSE file in the root of the source
7713+ * tree. An additional intellectual property rights grant can be found
7714+ * in the file PATENTS. All contributing project authors may
7715+ * be found in the AUTHORS file in the root of the source tree.
7716 */
7717
7718
7719diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h
7720index 2c02033..3e0718a 100644
7721--- a/vp8/common/findnearmv.h
7722+++ b/vp8/common/findnearmv.h
7723@@ -1,10 +1,11 @@
7724 /*
7725 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7726 *
7727- * Use of this source code is governed by a BSD-style license and patent
7728- * grant that can be found in the LICENSE file in the root of the source
7729- * tree. All contributing project authors may be found in the AUTHORS
7730- * file in the root of the source tree.
7731+ * Use of this source code is governed by a BSD-style license
7732+ * that can be found in the LICENSE file in the root of the source
7733+ * tree. An additional intellectual property rights grant can be found
7734+ * in the file PATENTS. All contributing project authors may
7735+ * be found in the AUTHORS file in the root of the source tree.
7736 */
7737
7738
7739diff --git a/vp8/common/fourcc.hpp b/vp8/common/fourcc.hpp
7740index 5f1faed..9823b56 100644
7741--- a/vp8/common/fourcc.hpp
7742+++ b/vp8/common/fourcc.hpp
7743@@ -1,10 +1,11 @@
7744 /*
7745 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7746 *
7747- * Use of this source code is governed by a BSD-style license and patent
7748- * grant that can be found in the LICENSE file in the root of the source
7749- * tree. All contributing project authors may be found in the AUTHORS
7750- * file in the root of the source tree.
7751+ * Use of this source code is governed by a BSD-style license
7752+ * that can be found in the LICENSE file in the root of the source
7753+ * tree. An additional intellectual property rights grant can be found
7754+ * in the file PATENTS. All contributing project authors may
7755+ * be found in the AUTHORS file in the root of the source tree.
7756 */
7757
7758
7759diff --git a/vp8/common/g_common.h b/vp8/common/g_common.h
7760index e68c53e..3f43401 100644
7761--- a/vp8/common/g_common.h
7762+++ b/vp8/common/g_common.h
7763@@ -1,10 +1,11 @@
7764 /*
7765 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7766 *
7767- * Use of this source code is governed by a BSD-style license and patent
7768- * grant that can be found in the LICENSE file in the root of the source
7769- * tree. All contributing project authors may be found in the AUTHORS
7770- * file in the root of the source tree.
7771+ * Use of this source code is governed by a BSD-style license
7772+ * that can be found in the LICENSE file in the root of the source
7773+ * tree. An additional intellectual property rights grant can be found
7774+ * in the file PATENTS. All contributing project authors may
7775+ * be found in the AUTHORS file in the root of the source tree.
7776 */
7777
7778
7779diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c
7780index 0011ae0..6e64885 100644
7781--- a/vp8/common/generic/systemdependent.c
7782+++ b/vp8/common/generic/systemdependent.c
7783@@ -1,10 +1,11 @@
7784 /*
7785 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7786 *
7787- * Use of this source code is governed by a BSD-style license and patent
7788- * grant that can be found in the LICENSE file in the root of the source
7789- * tree. All contributing project authors may be found in the AUTHORS
7790- * file in the root of the source tree.
7791+ * Use of this source code is governed by a BSD-style license
7792+ * that can be found in the LICENSE file in the root of the source
7793+ * tree. An additional intellectual property rights grant can be found
7794+ * in the file PATENTS. All contributing project authors may
7795+ * be found in the AUTHORS file in the root of the source tree.
7796 */
7797
7798
7799diff --git a/vp8/common/header.h b/vp8/common/header.h
7800index 8b2b009..b8b9059 100644
7801--- a/vp8/common/header.h
7802+++ b/vp8/common/header.h
7803@@ -1,10 +1,11 @@
7804 /*
7805 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7806 *
7807- * Use of this source code is governed by a BSD-style license and patent
7808- * grant that can be found in the LICENSE file in the root of the source
7809- * tree. All contributing project authors may be found in the AUTHORS
7810- * file in the root of the source tree.
7811+ * Use of this source code is governed by a BSD-style license
7812+ * that can be found in the LICENSE file in the root of the source
7813+ * tree. An additional intellectual property rights grant can be found
7814+ * in the file PATENTS. All contributing project authors may
7815+ * be found in the AUTHORS file in the root of the source tree.
7816 */
7817
7818
7819diff --git a/vp8/common/idct.h b/vp8/common/idct.h
7820index 47b5f05..2185bd3 100644
7821--- a/vp8/common/idct.h
7822+++ b/vp8/common/idct.h
7823@@ -1,10 +1,11 @@
7824 /*
7825 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7826 *
7827- * Use of this source code is governed by a BSD-style license and patent
7828- * grant that can be found in the LICENSE file in the root of the source
7829- * tree. All contributing project authors may be found in the AUTHORS
7830- * file in the root of the source tree.
7831+ * Use of this source code is governed by a BSD-style license
7832+ * that can be found in the LICENSE file in the root of the source
7833+ * tree. An additional intellectual property rights grant can be found
7834+ * in the file PATENTS. All contributing project authors may
7835+ * be found in the AUTHORS file in the root of the source tree.
7836 */
7837
7838
7839diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
7840index 57cf858..4261d24 100644
7841--- a/vp8/common/idctllm.c
7842+++ b/vp8/common/idctllm.c
7843@@ -1,10 +1,11 @@
7844 /*
7845 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7846 *
7847- * Use of this source code is governed by a BSD-style license and patent
7848- * grant that can be found in the LICENSE file in the root of the source
7849- * tree. All contributing project authors may be found in the AUTHORS
7850- * file in the root of the source tree.
7851+ * Use of this source code is governed by a BSD-style license
7852+ * that can be found in the LICENSE file in the root of the source
7853+ * tree. An additional intellectual property rights grant can be found
7854+ * in the file PATENTS. All contributing project authors may
7855+ * be found in the AUTHORS file in the root of the source tree.
7856 */
7857
7858
7859diff --git a/vp8/common/invtrans.c b/vp8/common/invtrans.c
7860index 1ff596e..00502c6 100644
7861--- a/vp8/common/invtrans.c
7862+++ b/vp8/common/invtrans.c
7863@@ -1,10 +1,11 @@
7864 /*
7865 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7866 *
7867- * Use of this source code is governed by a BSD-style license and patent
7868- * grant that can be found in the LICENSE file in the root of the source
7869- * tree. All contributing project authors may be found in the AUTHORS
7870- * file in the root of the source tree.
7871+ * Use of this source code is governed by a BSD-style license
7872+ * that can be found in the LICENSE file in the root of the source
7873+ * tree. An additional intellectual property rights grant can be found
7874+ * in the file PATENTS. All contributing project authors may
7875+ * be found in the AUTHORS file in the root of the source tree.
7876 */
7877
7878
7879diff --git a/vp8/common/invtrans.h b/vp8/common/invtrans.h
7880index 93a40f9..be30ca0 100644
7881--- a/vp8/common/invtrans.h
7882+++ b/vp8/common/invtrans.h
7883@@ -1,10 +1,11 @@
7884 /*
7885 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7886 *
7887- * Use of this source code is governed by a BSD-style license and patent
7888- * grant that can be found in the LICENSE file in the root of the source
7889- * tree. All contributing project authors may be found in the AUTHORS
7890- * file in the root of the source tree.
7891+ * Use of this source code is governed by a BSD-style license
7892+ * that can be found in the LICENSE file in the root of the source
7893+ * tree. An additional intellectual property rights grant can be found
7894+ * in the file PATENTS. All contributing project authors may
7895+ * be found in the AUTHORS file in the root of the source tree.
7896 */
7897
7898
7899diff --git a/vp8/common/littlend.h b/vp8/common/littlend.h
7900index 08c525c..0961163 100644
7901--- a/vp8/common/littlend.h
7902+++ b/vp8/common/littlend.h
7903@@ -1,10 +1,11 @@
7904 /*
7905 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7906 *
7907- * Use of this source code is governed by a BSD-style license and patent
7908- * grant that can be found in the LICENSE file in the root of the source
7909- * tree. All contributing project authors may be found in the AUTHORS
7910- * file in the root of the source tree.
7911+ * Use of this source code is governed by a BSD-style license
7912+ * that can be found in the LICENSE file in the root of the source
7913+ * tree. An additional intellectual property rights grant can be found
7914+ * in the file PATENTS. All contributing project authors may
7915+ * be found in the AUTHORS file in the root of the source tree.
7916 */
7917
7918
7919diff --git a/vp8/common/loopfilter.c b/vp8/common/loopfilter.c
7920index 79e6177..4937195 100644
7921--- a/vp8/common/loopfilter.c
7922+++ b/vp8/common/loopfilter.c
7923@@ -1,10 +1,11 @@
7924 /*
7925 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7926 *
7927- * Use of this source code is governed by a BSD-style license and patent
7928- * grant that can be found in the LICENSE file in the root of the source
7929- * tree. All contributing project authors may be found in the AUTHORS
7930- * file in the root of the source tree.
7931+ * Use of this source code is governed by a BSD-style license
7932+ * that can be found in the LICENSE file in the root of the source
7933+ * tree. An additional intellectual property rights grant can be found
7934+ * in the file PATENTS. All contributing project authors may
7935+ * be found in the AUTHORS file in the root of the source tree.
7936 */
7937
7938
7939diff --git a/vp8/common/loopfilter.h b/vp8/common/loopfilter.h
7940index c6ce508..a9a976e 100644
7941--- a/vp8/common/loopfilter.h
7942+++ b/vp8/common/loopfilter.h
7943@@ -1,10 +1,11 @@
7944 /*
7945 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7946 *
7947- * Use of this source code is governed by a BSD-style license and patent
7948- * grant that can be found in the LICENSE file in the root of the source
7949- * tree. All contributing project authors may be found in the AUTHORS
7950- * file in the root of the source tree.
7951+ * Use of this source code is governed by a BSD-style license
7952+ * that can be found in the LICENSE file in the root of the source
7953+ * tree. An additional intellectual property rights grant can be found
7954+ * in the file PATENTS. All contributing project authors may
7955+ * be found in the AUTHORS file in the root of the source tree.
7956 */
7957
7958
7959diff --git a/vp8/common/loopfilter_filters.c b/vp8/common/loopfilter_filters.c
7960index 7d16e48..eaf7327 100644
7961--- a/vp8/common/loopfilter_filters.c
7962+++ b/vp8/common/loopfilter_filters.c
7963@@ -1,10 +1,11 @@
7964 /*
7965 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7966 *
7967- * Use of this source code is governed by a BSD-style license and patent
7968- * grant that can be found in the LICENSE file in the root of the source
7969- * tree. All contributing project authors may be found in the AUTHORS
7970- * file in the root of the source tree.
7971+ * Use of this source code is governed by a BSD-style license
7972+ * that can be found in the LICENSE file in the root of the source
7973+ * tree. An additional intellectual property rights grant can be found
7974+ * in the file PATENTS. All contributing project authors may
7975+ * be found in the AUTHORS file in the root of the source tree.
7976 */
7977
7978
7979diff --git a/vp8/common/mac_specs.h b/vp8/common/mac_specs.h
7980index 97bffc7..a12b8d5 100644
7981--- a/vp8/common/mac_specs.h
7982+++ b/vp8/common/mac_specs.h
7983@@ -1,10 +1,11 @@
7984 /*
7985 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
7986 *
7987- * Use of this source code is governed by a BSD-style license and patent
7988- * grant that can be found in the LICENSE file in the root of the source
7989- * tree. All contributing project authors may be found in the AUTHORS
7990- * file in the root of the source tree.
7991+ * Use of this source code is governed by a BSD-style license
7992+ * that can be found in the LICENSE file in the root of the source
7993+ * tree. An additional intellectual property rights grant can be found
7994+ * in the file PATENTS. All contributing project authors may
7995+ * be found in the AUTHORS file in the root of the source tree.
7996 */
7997
7998
7999diff --git a/vp8/common/mbpitch.c b/vp8/common/mbpitch.c
8000index a7e0ce9..b183b8e 100644
8001--- a/vp8/common/mbpitch.c
8002+++ b/vp8/common/mbpitch.c
8003@@ -1,10 +1,11 @@
8004 /*
8005 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8006 *
8007- * Use of this source code is governed by a BSD-style license and patent
8008- * grant that can be found in the LICENSE file in the root of the source
8009- * tree. All contributing project authors may be found in the AUTHORS
8010- * file in the root of the source tree.
8011+ * Use of this source code is governed by a BSD-style license
8012+ * that can be found in the LICENSE file in the root of the source
8013+ * tree. An additional intellectual property rights grant can be found
8014+ * in the file PATENTS. All contributing project authors may
8015+ * be found in the AUTHORS file in the root of the source tree.
8016 */
8017
8018
8019diff --git a/vp8/common/modecont.c b/vp8/common/modecont.c
8020index 9301a25..c008eef 100644
8021--- a/vp8/common/modecont.c
8022+++ b/vp8/common/modecont.c
8023@@ -1,10 +1,11 @@
8024 /*
8025 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8026 *
8027- * Use of this source code is governed by a BSD-style license and patent
8028- * grant that can be found in the LICENSE file in the root of the source
8029- * tree. All contributing project authors may be found in the AUTHORS
8030- * file in the root of the source tree.
8031+ * Use of this source code is governed by a BSD-style license
8032+ * that can be found in the LICENSE file in the root of the source
8033+ * tree. An additional intellectual property rights grant can be found
8034+ * in the file PATENTS. All contributing project authors may
8035+ * be found in the AUTHORS file in the root of the source tree.
8036 */
8037
8038
8039diff --git a/vp8/common/modecont.h b/vp8/common/modecont.h
8040index 0c57651..4b79722 100644
8041--- a/vp8/common/modecont.h
8042+++ b/vp8/common/modecont.h
8043@@ -1,10 +1,11 @@
8044 /*
8045 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8046 *
8047- * Use of this source code is governed by a BSD-style license and patent
8048- * grant that can be found in the LICENSE file in the root of the source
8049- * tree. All contributing project authors may be found in the AUTHORS
8050- * file in the root of the source tree.
8051+ * Use of this source code is governed by a BSD-style license
8052+ * that can be found in the LICENSE file in the root of the source
8053+ * tree. An additional intellectual property rights grant can be found
8054+ * in the file PATENTS. All contributing project authors may
8055+ * be found in the AUTHORS file in the root of the source tree.
8056 */
8057
8058
8059diff --git a/vp8/common/modecontext.c b/vp8/common/modecontext.c
8060index ceee74c..a4b2f76 100644
8061--- a/vp8/common/modecontext.c
8062+++ b/vp8/common/modecontext.c
8063@@ -1,10 +1,11 @@
8064 /*
8065 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8066 *
8067- * Use of this source code is governed by a BSD-style license and patent
8068- * grant that can be found in the LICENSE file in the root of the source
8069- * tree. All contributing project authors may be found in the AUTHORS
8070- * file in the root of the source tree.
8071+ * Use of this source code is governed by a BSD-style license
8072+ * that can be found in the LICENSE file in the root of the source
8073+ * tree. An additional intellectual property rights grant can be found
8074+ * in the file PATENTS. All contributing project authors may
8075+ * be found in the AUTHORS file in the root of the source tree.
8076 */
8077
8078
8079diff --git a/vp8/common/mv.h b/vp8/common/mv.h
8080index 3d84181..c3db5f0 100644
8081--- a/vp8/common/mv.h
8082+++ b/vp8/common/mv.h
8083@@ -1,10 +1,11 @@
8084 /*
8085 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8086 *
8087- * Use of this source code is governed by a BSD-style license and patent
8088- * grant that can be found in the LICENSE file in the root of the source
8089- * tree. All contributing project authors may be found in the AUTHORS
8090- * file in the root of the source tree.
8091+ * Use of this source code is governed by a BSD-style license
8092+ * that can be found in the LICENSE file in the root of the source
8093+ * tree. An additional intellectual property rights grant can be found
8094+ * in the file PATENTS. All contributing project authors may
8095+ * be found in the AUTHORS file in the root of the source tree.
8096 */
8097
8098
8099diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h
8100index b66c400..3ed6f2d 100644
8101--- a/vp8/common/onyx.h
8102+++ b/vp8/common/onyx.h
8103@@ -1,10 +1,11 @@
8104 /*
8105 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8106 *
8107- * Use of this source code is governed by a BSD-style license and patent
8108- * grant that can be found in the LICENSE file in the root of the source
8109- * tree. All contributing project authors may be found in the AUTHORS
8110- * file in the root of the source tree.
8111+ * Use of this source code is governed by a BSD-style license
8112+ * that can be found in the LICENSE file in the root of the source
8113+ * tree. An additional intellectual property rights grant can be found
8114+ * in the file PATENTS. All contributing project authors may
8115+ * be found in the AUTHORS file in the root of the source tree.
8116 */
8117
8118
8119@@ -16,7 +17,7 @@ extern "C"
8120 {
8121 #endif
8122
8123-#include "vpx_codec/internal/vpx_codec_internal.h"
8124+#include "vpx/internal/vpx_codec_internal.h"
8125 #include "vpx_scale/yv12config.h"
8126 #include "type_aliases.h"
8127 #include "ppflags.h"
8128diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h
8129index a40ffb9..d1cb766 100644
8130--- a/vp8/common/onyxc_int.h
8131+++ b/vp8/common/onyxc_int.h
8132@@ -1,18 +1,19 @@
8133 /*
8134 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8135 *
8136- * Use of this source code is governed by a BSD-style license and patent
8137- * grant that can be found in the LICENSE file in the root of the source
8138- * tree. All contributing project authors may be found in the AUTHORS
8139- * file in the root of the source tree.
8140+ * Use of this source code is governed by a BSD-style license
8141+ * that can be found in the LICENSE file in the root of the source
8142+ * tree. An additional intellectual property rights grant can be found
8143+ * in the file PATENTS. All contributing project authors may
8144+ * be found in the AUTHORS file in the root of the source tree.
8145 */
8146
8147
8148 #ifndef __INC_VP8C_INT_H
8149 #define __INC_VP8C_INT_H
8150
8151-#include "vpx_ports/config.h"
8152-#include "vpx_codec/internal/vpx_codec_internal.h"
8153+#include "vpx_config.h"
8154+#include "vpx/internal/vpx_codec_internal.h"
8155 #include "loopfilter.h"
8156 #include "entropymv.h"
8157 #include "entropy.h"
8158diff --git a/vp8/common/onyxd.h b/vp8/common/onyxd.h
8159index 644c0ec..ea04c14 100644
8160--- a/vp8/common/onyxd.h
8161+++ b/vp8/common/onyxd.h
8162@@ -1,10 +1,11 @@
8163 /*
8164 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8165 *
8166- * Use of this source code is governed by a BSD-style license and patent
8167- * grant that can be found in the LICENSE file in the root of the source
8168- * tree. All contributing project authors may be found in the AUTHORS
8169- * file in the root of the source tree.
8170+ * Use of this source code is governed by a BSD-style license
8171+ * that can be found in the LICENSE file in the root of the source
8172+ * tree. An additional intellectual property rights grant can be found
8173+ * in the file PATENTS. All contributing project authors may
8174+ * be found in the AUTHORS file in the root of the source tree.
8175 */
8176
8177
8178diff --git a/vp8/common/partialgfupdate.h b/vp8/common/partialgfupdate.h
8179index 32a55ee..355aa79 100644
8180--- a/vp8/common/partialgfupdate.h
8181+++ b/vp8/common/partialgfupdate.h
8182@@ -1,10 +1,11 @@
8183 /*
8184 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8185 *
8186- * Use of this source code is governed by a BSD-style license and patent
8187- * grant that can be found in the LICENSE file in the root of the source
8188- * tree. All contributing project authors may be found in the AUTHORS
8189- * file in the root of the source tree.
8190+ * Use of this source code is governed by a BSD-style license
8191+ * that can be found in the LICENSE file in the root of the source
8192+ * tree. An additional intellectual property rights grant can be found
8193+ * in the file PATENTS. All contributing project authors may
8194+ * be found in the AUTHORS file in the root of the source tree.
8195 */
8196
8197
8198diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c
8199index f019925..1f36d4e 100644
8200--- a/vp8/common/postproc.c
8201+++ b/vp8/common/postproc.c
8202@@ -1,10 +1,11 @@
8203 /*
8204 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8205 *
8206- * Use of this source code is governed by a BSD-style license and patent
8207- * grant that can be found in the LICENSE file in the root of the source
8208- * tree. All contributing project authors may be found in the AUTHORS
8209- * file in the root of the source tree.
8210+ * Use of this source code is governed by a BSD-style license
8211+ * that can be found in the LICENSE file in the root of the source
8212+ * tree. An additional intellectual property rights grant can be found
8213+ * in the file PATENTS. All contributing project authors may
8214+ * be found in the AUTHORS file in the root of the source tree.
8215 */
8216
8217
8218@@ -274,7 +275,7 @@ static void vp8_deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
8219
8220 }
8221
8222-extern void vp8_deblock(YV12_BUFFER_CONFIG *source,
8223+void vp8_deblock(YV12_BUFFER_CONFIG *source,
8224 YV12_BUFFER_CONFIG *post,
8225 int q,
8226 int low_var_thresh,
8227diff --git a/vp8/common/postproc.h b/vp8/common/postproc.h
8228index c45fe92..e148f2a 100644
8229--- a/vp8/common/postproc.h
8230+++ b/vp8/common/postproc.h
8231@@ -1,10 +1,11 @@
8232 /*
8233 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8234 *
8235- * Use of this source code is governed by a BSD-style license and patent
8236- * grant that can be found in the LICENSE file in the root of the source
8237- * tree. All contributing project authors may be found in the AUTHORS
8238- * file in the root of the source tree.
8239+ * Use of this source code is governed by a BSD-style license
8240+ * that can be found in the LICENSE file in the root of the source
8241+ * tree. An additional intellectual property rights grant can be found
8242+ * in the file PATENTS. All contributing project authors may
8243+ * be found in the AUTHORS file in the root of the source tree.
8244 */
8245
8246
8247@@ -87,4 +88,11 @@ void vp8_de_noise(YV12_BUFFER_CONFIG *source,
8248 int low_var_thresh,
8249 int flag,
8250 vp8_postproc_rtcd_vtable_t *rtcd);
8251+
8252+void vp8_deblock(YV12_BUFFER_CONFIG *source,
8253+ YV12_BUFFER_CONFIG *post,
8254+ int q,
8255+ int low_var_thresh,
8256+ int flag,
8257+ vp8_postproc_rtcd_vtable_t *rtcd);
8258 #endif
8259diff --git a/vp8/common/ppc/copy_altivec.asm b/vp8/common/ppc/copy_altivec.asm
8260index e87eb21..5ca2d17 100644
8261--- a/vp8/common/ppc/copy_altivec.asm
8262+++ b/vp8/common/ppc/copy_altivec.asm
8263@@ -1,10 +1,11 @@
8264 ;
8265 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8266 ;
8267-; Use of this source code is governed by a BSD-style license and patent
8268-; grant that can be found in the LICENSE file in the root of the source
8269-; tree. All contributing project authors may be found in the AUTHORS
8270-; file in the root of the source tree.
8271+; Use of this source code is governed by a BSD-style license
8272+; that can be found in the LICENSE file in the root of the source
8273+; tree. An additional intellectual property rights grant can be found
8274+; in the file PATENTS. All contributing project authors may
8275+; be found in the AUTHORS file in the root of the source tree.
8276 ;
8277
8278
8279diff --git a/vp8/common/ppc/filter_altivec.asm b/vp8/common/ppc/filter_altivec.asm
8280index 2a35507..1a7ebf7 100644
8281--- a/vp8/common/ppc/filter_altivec.asm
8282+++ b/vp8/common/ppc/filter_altivec.asm
8283@@ -1,10 +1,11 @@
8284 ;
8285 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8286 ;
8287-; Use of this source code is governed by a BSD-style license and patent
8288-; grant that can be found in the LICENSE file in the root of the source
8289-; tree. All contributing project authors may be found in the AUTHORS
8290-; file in the root of the source tree.
8291+; Use of this source code is governed by a BSD-style license
8292+; that can be found in the LICENSE file in the root of the source
8293+; tree. An additional intellectual property rights grant can be found
8294+; in the file PATENTS. All contributing project authors may
8295+; be found in the AUTHORS file in the root of the source tree.
8296 ;
8297
8298
8299diff --git a/vp8/common/ppc/filter_bilinear_altivec.asm b/vp8/common/ppc/filter_bilinear_altivec.asm
8300index 27e02a8..73e758e 100644
8301--- a/vp8/common/ppc/filter_bilinear_altivec.asm
8302+++ b/vp8/common/ppc/filter_bilinear_altivec.asm
8303@@ -1,10 +1,11 @@
8304 ;
8305 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8306 ;
8307-; Use of this source code is governed by a BSD-style license and patent
8308-; grant that can be found in the LICENSE file in the root of the source
8309-; tree. All contributing project authors may be found in the AUTHORS
8310-; file in the root of the source tree.
8311+; Use of this source code is governed by a BSD-style license
8312+; that can be found in the LICENSE file in the root of the source
8313+; tree. An additional intellectual property rights grant can be found
8314+; in the file PATENTS. All contributing project authors may
8315+; be found in the AUTHORS file in the root of the source tree.
8316 ;
8317
8318
8319diff --git a/vp8/common/ppc/idctllm_altivec.asm b/vp8/common/ppc/idctllm_altivec.asm
8320index e88af8d..9ebe6af 100644
8321--- a/vp8/common/ppc/idctllm_altivec.asm
8322+++ b/vp8/common/ppc/idctllm_altivec.asm
8323@@ -1,10 +1,11 @@
8324 ;
8325 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8326 ;
8327-; Use of this source code is governed by a BSD-style license and patent
8328-; grant that can be found in the LICENSE file in the root of the source
8329-; tree. All contributing project authors may be found in the AUTHORS
8330-; file in the root of the source tree.
8331+; Use of this source code is governed by a BSD-style license
8332+; that can be found in the LICENSE file in the root of the source
8333+; tree. An additional intellectual property rights grant can be found
8334+; in the file PATENTS. All contributing project authors may
8335+; be found in the AUTHORS file in the root of the source tree.
8336 ;
8337
8338
8339diff --git a/vp8/common/ppc/loopfilter_altivec.c b/vp8/common/ppc/loopfilter_altivec.c
8340index 586eed4..8bf5e57 100644
8341--- a/vp8/common/ppc/loopfilter_altivec.c
8342+++ b/vp8/common/ppc/loopfilter_altivec.c
8343@@ -1,10 +1,11 @@
8344 /*
8345 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8346 *
8347- * Use of this source code is governed by a BSD-style license and patent
8348- * grant that can be found in the LICENSE file in the root of the source
8349- * tree. All contributing project authors may be found in the AUTHORS
8350- * file in the root of the source tree.
8351+ * Use of this source code is governed by a BSD-style license
8352+ * that can be found in the LICENSE file in the root of the source
8353+ * tree. An additional intellectual property rights grant can be found
8354+ * in the file PATENTS. All contributing project authors may
8355+ * be found in the AUTHORS file in the root of the source tree.
8356 */
8357
8358
8359diff --git a/vp8/common/ppc/loopfilter_filters_altivec.asm b/vp8/common/ppc/loopfilter_filters_altivec.asm
8360index 78a5cf9..26c51a6 100644
8361--- a/vp8/common/ppc/loopfilter_filters_altivec.asm
8362+++ b/vp8/common/ppc/loopfilter_filters_altivec.asm
8363@@ -1,10 +1,11 @@
8364 ;
8365 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8366 ;
8367-; Use of this source code is governed by a BSD-style license and patent
8368-; grant that can be found in the LICENSE file in the root of the source
8369-; tree. All contributing project authors may be found in the AUTHORS
8370-; file in the root of the source tree.
8371+; Use of this source code is governed by a BSD-style license
8372+; that can be found in the LICENSE file in the root of the source
8373+; tree. An additional intellectual property rights grant can be found
8374+; in the file PATENTS. All contributing project authors may
8375+; be found in the AUTHORS file in the root of the source tree.
8376 ;
8377
8378
8379diff --git a/vp8/common/ppc/platform_altivec.asm b/vp8/common/ppc/platform_altivec.asm
8380index 227ef2a..23680c9 100644
8381--- a/vp8/common/ppc/platform_altivec.asm
8382+++ b/vp8/common/ppc/platform_altivec.asm
8383@@ -1,10 +1,11 @@
8384 ;
8385 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8386 ;
8387-; Use of this source code is governed by a BSD-style license and patent
8388-; grant that can be found in the LICENSE file in the root of the source
8389-; tree. All contributing project authors may be found in the AUTHORS
8390-; file in the root of the source tree.
8391+; Use of this source code is governed by a BSD-style license
8392+; that can be found in the LICENSE file in the root of the source
8393+; tree. An additional intellectual property rights grant can be found
8394+; in the file PATENTS. All contributing project authors may
8395+; be found in the AUTHORS file in the root of the source tree.
8396 ;
8397
8398
8399diff --git a/vp8/common/ppc/recon_altivec.asm b/vp8/common/ppc/recon_altivec.asm
8400index f478b95..212664d 100644
8401--- a/vp8/common/ppc/recon_altivec.asm
8402+++ b/vp8/common/ppc/recon_altivec.asm
8403@@ -1,10 +1,11 @@
8404 ;
8405 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8406 ;
8407-; Use of this source code is governed by a BSD-style license and patent
8408-; grant that can be found in the LICENSE file in the root of the source
8409-; tree. All contributing project authors may be found in the AUTHORS
8410-; file in the root of the source tree.
8411+; Use of this source code is governed by a BSD-style license
8412+; that can be found in the LICENSE file in the root of the source
8413+; tree. An additional intellectual property rights grant can be found
8414+; in the file PATENTS. All contributing project authors may
8415+; be found in the AUTHORS file in the root of the source tree.
8416 ;
8417
8418
8419diff --git a/vp8/common/ppc/systemdependent.c b/vp8/common/ppc/systemdependent.c
8420index 2847310..4ccf690 100644
8421--- a/vp8/common/ppc/systemdependent.c
8422+++ b/vp8/common/ppc/systemdependent.c
8423@@ -1,10 +1,11 @@
8424 /*
8425 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8426 *
8427- * Use of this source code is governed by a BSD-style license and patent
8428- * grant that can be found in the LICENSE file in the root of the source
8429- * tree. All contributing project authors may be found in the AUTHORS
8430- * file in the root of the source tree.
8431+ * Use of this source code is governed by a BSD-style license
8432+ * that can be found in the LICENSE file in the root of the source
8433+ * tree. An additional intellectual property rights grant can be found
8434+ * in the file PATENTS. All contributing project authors may
8435+ * be found in the AUTHORS file in the root of the source tree.
8436 */
8437
8438
8439diff --git a/vp8/common/ppflags.h b/vp8/common/ppflags.h
8440index c663976..57aeb1d 100644
8441--- a/vp8/common/ppflags.h
8442+++ b/vp8/common/ppflags.h
8443@@ -1,10 +1,11 @@
8444 /*
8445 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8446 *
8447- * Use of this source code is governed by a BSD-style license and patent
8448- * grant that can be found in the LICENSE file in the root of the source
8449- * tree. All contributing project authors may be found in the AUTHORS
8450- * file in the root of the source tree.
8451+ * Use of this source code is governed by a BSD-style license
8452+ * that can be found in the LICENSE file in the root of the source
8453+ * tree. An additional intellectual property rights grant can be found
8454+ * in the file PATENTS. All contributing project authors may
8455+ * be found in the AUTHORS file in the root of the source tree.
8456 */
8457
8458
8459diff --git a/vp8/common/pragmas.h b/vp8/common/pragmas.h
8460index 25a4b77..523c8b7 100644
8461--- a/vp8/common/pragmas.h
8462+++ b/vp8/common/pragmas.h
8463@@ -1,10 +1,11 @@
8464 /*
8465 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8466 *
8467- * Use of this source code is governed by a BSD-style license and patent
8468- * grant that can be found in the LICENSE file in the root of the source
8469- * tree. All contributing project authors may be found in the AUTHORS
8470- * file in the root of the source tree.
8471+ * Use of this source code is governed by a BSD-style license
8472+ * that can be found in the LICENSE file in the root of the source
8473+ * tree. An additional intellectual property rights grant can be found
8474+ * in the file PATENTS. All contributing project authors may
8475+ * be found in the AUTHORS file in the root of the source tree.
8476 */
8477
8478
8479diff --git a/vp8/common/predictdc.c b/vp8/common/predictdc.c
8480index df4c96e..18d7da8 100644
8481--- a/vp8/common/predictdc.c
8482+++ b/vp8/common/predictdc.c
8483@@ -1,10 +1,11 @@
8484 /*
8485 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8486 *
8487- * Use of this source code is governed by a BSD-style license and patent
8488- * grant that can be found in the LICENSE file in the root of the source
8489- * tree. All contributing project authors may be found in the AUTHORS
8490- * file in the root of the source tree.
8491+ * Use of this source code is governed by a BSD-style license
8492+ * that can be found in the LICENSE file in the root of the source
8493+ * tree. An additional intellectual property rights grant can be found
8494+ * in the file PATENTS. All contributing project authors may
8495+ * be found in the AUTHORS file in the root of the source tree.
8496 */
8497
8498
8499diff --git a/vp8/common/predictdc.h b/vp8/common/predictdc.h
8500index b8871e4..69036ee 100644
8501--- a/vp8/common/predictdc.h
8502+++ b/vp8/common/predictdc.h
8503@@ -1,10 +1,11 @@
8504 /*
8505 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8506 *
8507- * Use of this source code is governed by a BSD-style license and patent
8508- * grant that can be found in the LICENSE file in the root of the source
8509- * tree. All contributing project authors may be found in the AUTHORS
8510- * file in the root of the source tree.
8511+ * Use of this source code is governed by a BSD-style license
8512+ * that can be found in the LICENSE file in the root of the source
8513+ * tree. An additional intellectual property rights grant can be found
8514+ * in the file PATENTS. All contributing project authors may
8515+ * be found in the AUTHORS file in the root of the source tree.
8516 */
8517
8518
8519diff --git a/vp8/common/preproc.h b/vp8/common/preproc.h
8520index 00ec9a8..a02745c 100644
8521--- a/vp8/common/preproc.h
8522+++ b/vp8/common/preproc.h
8523@@ -1,10 +1,11 @@
8524 /*
8525 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8526 *
8527- * Use of this source code is governed by a BSD-style license and patent
8528- * grant that can be found in the LICENSE file in the root of the source
8529- * tree. All contributing project authors may be found in the AUTHORS
8530- * file in the root of the source tree.
8531+ * Use of this source code is governed by a BSD-style license
8532+ * that can be found in the LICENSE file in the root of the source
8533+ * tree. An additional intellectual property rights grant can be found
8534+ * in the file PATENTS. All contributing project authors may
8535+ * be found in the AUTHORS file in the root of the source tree.
8536 */
8537
8538
8539diff --git a/vp8/common/preprocif.h b/vp8/common/preprocif.h
8540index 986c45b..f700f76 100644
8541--- a/vp8/common/preprocif.h
8542+++ b/vp8/common/preprocif.h
8543@@ -1,10 +1,11 @@
8544 /*
8545 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8546 *
8547- * Use of this source code is governed by a BSD-style license and patent
8548- * grant that can be found in the LICENSE file in the root of the source
8549- * tree. All contributing project authors may be found in the AUTHORS
8550- * file in the root of the source tree.
8551+ * Use of this source code is governed by a BSD-style license
8552+ * that can be found in the LICENSE file in the root of the source
8553+ * tree. An additional intellectual property rights grant can be found
8554+ * in the file PATENTS. All contributing project authors may
8555+ * be found in the AUTHORS file in the root of the source tree.
8556 */
8557
8558
8559diff --git a/vp8/common/proposed.h b/vp8/common/proposed.h
8560index 1171ede..65b7834 100644
8561--- a/vp8/common/proposed.h
8562+++ b/vp8/common/proposed.h
8563@@ -1,10 +1,11 @@
8564 /*
8565 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8566 *
8567- * Use of this source code is governed by a BSD-style license and patent
8568- * grant that can be found in the LICENSE file in the root of the source
8569- * tree. All contributing project authors may be found in the AUTHORS
8570- * file in the root of the source tree.
8571+ * Use of this source code is governed by a BSD-style license
8572+ * that can be found in the LICENSE file in the root of the source
8573+ * tree. An additional intellectual property rights grant can be found
8574+ * in the file PATENTS. All contributing project authors may
8575+ * be found in the AUTHORS file in the root of the source tree.
8576 */
8577
8578
8579diff --git a/vp8/common/quant_common.c b/vp8/common/quant_common.c
8580index 09fe31f..6fd3bc0 100644
8581--- a/vp8/common/quant_common.c
8582+++ b/vp8/common/quant_common.c
8583@@ -1,10 +1,11 @@
8584 /*
8585 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8586 *
8587- * Use of this source code is governed by a BSD-style license and patent
8588- * grant that can be found in the LICENSE file in the root of the source
8589- * tree. All contributing project authors may be found in the AUTHORS
8590- * file in the root of the source tree.
8591+ * Use of this source code is governed by a BSD-style license
8592+ * that can be found in the LICENSE file in the root of the source
8593+ * tree. An additional intellectual property rights grant can be found
8594+ * in the file PATENTS. All contributing project authors may
8595+ * be found in the AUTHORS file in the root of the source tree.
8596 */
8597
8598
8599diff --git a/vp8/common/quant_common.h b/vp8/common/quant_common.h
8600index 0c92ce8..49d11bc 100644
8601--- a/vp8/common/quant_common.h
8602+++ b/vp8/common/quant_common.h
8603@@ -1,10 +1,11 @@
8604 /*
8605 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8606 *
8607- * Use of this source code is governed by a BSD-style license and patent
8608- * grant that can be found in the LICENSE file in the root of the source
8609- * tree. All contributing project authors may be found in the AUTHORS
8610- * file in the root of the source tree.
8611+ * Use of this source code is governed by a BSD-style license
8612+ * that can be found in the LICENSE file in the root of the source
8613+ * tree. An additional intellectual property rights grant can be found
8614+ * in the file PATENTS. All contributing project authors may
8615+ * be found in the AUTHORS file in the root of the source tree.
8616 */
8617
8618
8619diff --git a/vp8/common/recon.c b/vp8/common/recon.c
8620index d1268ea..b09ef37 100644
8621--- a/vp8/common/recon.c
8622+++ b/vp8/common/recon.c
8623@@ -1,10 +1,11 @@
8624 /*
8625 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8626 *
8627- * Use of this source code is governed by a BSD-style license and patent
8628- * grant that can be found in the LICENSE file in the root of the source
8629- * tree. All contributing project authors may be found in the AUTHORS
8630- * file in the root of the source tree.
8631+ * Use of this source code is governed by a BSD-style license
8632+ * that can be found in the LICENSE file in the root of the source
8633+ * tree. An additional intellectual property rights grant can be found
8634+ * in the file PATENTS. All contributing project authors may
8635+ * be found in the AUTHORS file in the root of the source tree.
8636 */
8637
8638
8639diff --git a/vp8/common/recon.h b/vp8/common/recon.h
8640index f65a90f..607895c 100644
8641--- a/vp8/common/recon.h
8642+++ b/vp8/common/recon.h
8643@@ -1,10 +1,11 @@
8644 /*
8645 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8646 *
8647- * Use of this source code is governed by a BSD-style license and patent
8648- * grant that can be found in the LICENSE file in the root of the source
8649- * tree. All contributing project authors may be found in the AUTHORS
8650- * file in the root of the source tree.
8651+ * Use of this source code is governed by a BSD-style license
8652+ * that can be found in the LICENSE file in the root of the source
8653+ * tree. An additional intellectual property rights grant can be found
8654+ * in the file PATENTS. All contributing project authors may
8655+ * be found in the AUTHORS file in the root of the source tree.
8656 */
8657
8658
8659diff --git a/vp8/common/reconinter.c b/vp8/common/reconinter.c
8660index c48886d..91ec76b 100644
8661--- a/vp8/common/reconinter.c
8662+++ b/vp8/common/reconinter.c
8663@@ -1,10 +1,11 @@
8664 /*
8665 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8666 *
8667- * Use of this source code is governed by a BSD-style license and patent
8668- * grant that can be found in the LICENSE file in the root of the source
8669- * tree. All contributing project authors may be found in the AUTHORS
8670- * file in the root of the source tree.
8671+ * Use of this source code is governed by a BSD-style license
8672+ * that can be found in the LICENSE file in the root of the source
8673+ * tree. An additional intellectual property rights grant can be found
8674+ * in the file PATENTS. All contributing project authors may
8675+ * be found in the AUTHORS file in the root of the source tree.
8676 */
8677
8678
8679diff --git a/vp8/common/reconinter.h b/vp8/common/reconinter.h
8680index b2d1ae9..9df4806 100644
8681--- a/vp8/common/reconinter.h
8682+++ b/vp8/common/reconinter.h
8683@@ -1,10 +1,11 @@
8684 /*
8685 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8686 *
8687- * Use of this source code is governed by a BSD-style license and patent
8688- * grant that can be found in the LICENSE file in the root of the source
8689- * tree. All contributing project authors may be found in the AUTHORS
8690- * file in the root of the source tree.
8691+ * Use of this source code is governed by a BSD-style license
8692+ * that can be found in the LICENSE file in the root of the source
8693+ * tree. An additional intellectual property rights grant can be found
8694+ * in the file PATENTS. All contributing project authors may
8695+ * be found in the AUTHORS file in the root of the source tree.
8696 */
8697
8698
8699diff --git a/vp8/common/reconintra.c b/vp8/common/reconintra.c
8700index e33bce3..23d87ee 100644
8701--- a/vp8/common/reconintra.c
8702+++ b/vp8/common/reconintra.c
8703@@ -1,10 +1,11 @@
8704 /*
8705 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8706 *
8707- * Use of this source code is governed by a BSD-style license and patent
8708- * grant that can be found in the LICENSE file in the root of the source
8709- * tree. All contributing project authors may be found in the AUTHORS
8710- * file in the root of the source tree.
8711+ * Use of this source code is governed by a BSD-style license
8712+ * that can be found in the LICENSE file in the root of the source
8713+ * tree. An additional intellectual property rights grant can be found
8714+ * in the file PATENTS. All contributing project authors may
8715+ * be found in the AUTHORS file in the root of the source tree.
8716 */
8717
8718
8719diff --git a/vp8/common/reconintra.h b/vp8/common/reconintra.h
8720index d63aa15..b7c4d1d 100644
8721--- a/vp8/common/reconintra.h
8722+++ b/vp8/common/reconintra.h
8723@@ -1,10 +1,11 @@
8724 /*
8725 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8726 *
8727- * Use of this source code is governed by a BSD-style license and patent
8728- * grant that can be found in the LICENSE file in the root of the source
8729- * tree. All contributing project authors may be found in the AUTHORS
8730- * file in the root of the source tree.
8731+ * Use of this source code is governed by a BSD-style license
8732+ * that can be found in the LICENSE file in the root of the source
8733+ * tree. An additional intellectual property rights grant can be found
8734+ * in the file PATENTS. All contributing project authors may
8735+ * be found in the AUTHORS file in the root of the source tree.
8736 */
8737
8738
8739diff --git a/vp8/common/reconintra4x4.c b/vp8/common/reconintra4x4.c
8740index d92d5c9..3b22423 100644
8741--- a/vp8/common/reconintra4x4.c
8742+++ b/vp8/common/reconintra4x4.c
8743@@ -1,10 +1,11 @@
8744 /*
8745 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8746 *
8747- * Use of this source code is governed by a BSD-style license and patent
8748- * grant that can be found in the LICENSE file in the root of the source
8749- * tree. All contributing project authors may be found in the AUTHORS
8750- * file in the root of the source tree.
8751+ * Use of this source code is governed by a BSD-style license
8752+ * that can be found in the LICENSE file in the root of the source
8753+ * tree. An additional intellectual property rights grant can be found
8754+ * in the file PATENTS. All contributing project authors may
8755+ * be found in the AUTHORS file in the root of the source tree.
8756 */
8757
8758
8759diff --git a/vp8/common/reconintra4x4.h b/vp8/common/reconintra4x4.h
8760index 788c8c4..881d091 100644
8761--- a/vp8/common/reconintra4x4.h
8762+++ b/vp8/common/reconintra4x4.h
8763@@ -1,10 +1,11 @@
8764 /*
8765 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8766 *
8767- * Use of this source code is governed by a BSD-style license and patent
8768- * grant that can be found in the LICENSE file in the root of the source
8769- * tree. All contributing project authors may be found in the AUTHORS
8770- * file in the root of the source tree.
8771+ * Use of this source code is governed by a BSD-style license
8772+ * that can be found in the LICENSE file in the root of the source
8773+ * tree. An additional intellectual property rights grant can be found
8774+ * in the file PATENTS. All contributing project authors may
8775+ * be found in the AUTHORS file in the root of the source tree.
8776 */
8777
8778
8779diff --git a/vp8/common/segmentation_common.c b/vp8/common/segmentation_common.c
8780index 72b8c87..2568c7c 100644
8781--- a/vp8/common/segmentation_common.c
8782+++ b/vp8/common/segmentation_common.c
8783@@ -1,10 +1,11 @@
8784 /*
8785 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8786 *
8787- * Use of this source code is governed by a BSD-style license and patent
8788- * grant that can be found in the LICENSE file in the root of the source
8789- * tree. All contributing project authors may be found in the AUTHORS
8790- * file in the root of the source tree.
8791+ * Use of this source code is governed by a BSD-style license
8792+ * that can be found in the LICENSE file in the root of the source
8793+ * tree. An additional intellectual property rights grant can be found
8794+ * in the file PATENTS. All contributing project authors may
8795+ * be found in the AUTHORS file in the root of the source tree.
8796 */
8797
8798
8799diff --git a/vp8/common/segmentation_common.h b/vp8/common/segmentation_common.h
8800index bb93533..7b36b49 100644
8801--- a/vp8/common/segmentation_common.h
8802+++ b/vp8/common/segmentation_common.h
8803@@ -1,10 +1,11 @@
8804 /*
8805 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8806 *
8807- * Use of this source code is governed by a BSD-style license and patent
8808- * grant that can be found in the LICENSE file in the root of the source
8809- * tree. All contributing project authors may be found in the AUTHORS
8810- * file in the root of the source tree.
8811+ * Use of this source code is governed by a BSD-style license
8812+ * that can be found in the LICENSE file in the root of the source
8813+ * tree. An additional intellectual property rights grant can be found
8814+ * in the file PATENTS. All contributing project authors may
8815+ * be found in the AUTHORS file in the root of the source tree.
8816 */
8817
8818
8819diff --git a/vp8/common/setupintrarecon.c b/vp8/common/setupintrarecon.c
8820index dcaafe6..e796d42 100644
8821--- a/vp8/common/setupintrarecon.c
8822+++ b/vp8/common/setupintrarecon.c
8823@@ -1,10 +1,11 @@
8824 /*
8825 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8826 *
8827- * Use of this source code is governed by a BSD-style license and patent
8828- * grant that can be found in the LICENSE file in the root of the source
8829- * tree. All contributing project authors may be found in the AUTHORS
8830- * file in the root of the source tree.
8831+ * Use of this source code is governed by a BSD-style license
8832+ * that can be found in the LICENSE file in the root of the source
8833+ * tree. An additional intellectual property rights grant can be found
8834+ * in the file PATENTS. All contributing project authors may
8835+ * be found in the AUTHORS file in the root of the source tree.
8836 */
8837
8838
8839@@ -16,21 +17,15 @@ void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf)
8840 int i;
8841
8842 // set up frame new frame for intra coded blocks
8843- vpx_memset(ybf->y_buffer - 1 - 2 * ybf->y_stride, 127, ybf->y_width + 5);
8844 vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
8845-
8846 for (i = 0; i < ybf->y_height; i++)
8847 ybf->y_buffer[ybf->y_stride *i - 1] = (unsigned char) 129;
8848
8849- vpx_memset(ybf->u_buffer - 1 - 2 * ybf->uv_stride, 127, ybf->uv_width + 5);
8850 vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
8851-
8852 for (i = 0; i < ybf->uv_height; i++)
8853 ybf->u_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
8854
8855- vpx_memset(ybf->v_buffer - 1 - 2 * ybf->uv_stride, 127, ybf->uv_width + 5);
8856 vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
8857-
8858 for (i = 0; i < ybf->uv_height; i++)
8859 ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
8860
8861diff --git a/vp8/common/setupintrarecon.h b/vp8/common/setupintrarecon.h
8862index 6ec79b2..ea4e342 100644
8863--- a/vp8/common/setupintrarecon.h
8864+++ b/vp8/common/setupintrarecon.h
8865@@ -1,10 +1,11 @@
8866 /*
8867 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8868 *
8869- * Use of this source code is governed by a BSD-style license and patent
8870- * grant that can be found in the LICENSE file in the root of the source
8871- * tree. All contributing project authors may be found in the AUTHORS
8872- * file in the root of the source tree.
8873+ * Use of this source code is governed by a BSD-style license
8874+ * that can be found in the LICENSE file in the root of the source
8875+ * tree. An additional intellectual property rights grant can be found
8876+ * in the file PATENTS. All contributing project authors may
8877+ * be found in the AUTHORS file in the root of the source tree.
8878 */
8879
8880
8881diff --git a/vp8/common/subpixel.h b/vp8/common/subpixel.h
8882index fbd5f4d..446697c 100644
8883--- a/vp8/common/subpixel.h
8884+++ b/vp8/common/subpixel.h
8885@@ -1,10 +1,11 @@
8886 /*
8887 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8888 *
8889- * Use of this source code is governed by a BSD-style license and patent
8890- * grant that can be found in the LICENSE file in the root of the source
8891- * tree. All contributing project authors may be found in the AUTHORS
8892- * file in the root of the source tree.
8893+ * Use of this source code is governed by a BSD-style license
8894+ * that can be found in the LICENSE file in the root of the source
8895+ * tree. An additional intellectual property rights grant can be found
8896+ * in the file PATENTS. All contributing project authors may
8897+ * be found in the AUTHORS file in the root of the source tree.
8898 */
8899
8900
8901diff --git a/vp8/common/swapyv12buffer.c b/vp8/common/swapyv12buffer.c
8902index afe6a88..5bdf431 100644
8903--- a/vp8/common/swapyv12buffer.c
8904+++ b/vp8/common/swapyv12buffer.c
8905@@ -1,10 +1,11 @@
8906 /*
8907 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8908 *
8909- * Use of this source code is governed by a BSD-style license and patent
8910- * grant that can be found in the LICENSE file in the root of the source
8911- * tree. All contributing project authors may be found in the AUTHORS
8912- * file in the root of the source tree.
8913+ * Use of this source code is governed by a BSD-style license
8914+ * that can be found in the LICENSE file in the root of the source
8915+ * tree. An additional intellectual property rights grant can be found
8916+ * in the file PATENTS. All contributing project authors may
8917+ * be found in the AUTHORS file in the root of the source tree.
8918 */
8919
8920
8921diff --git a/vp8/common/swapyv12buffer.h b/vp8/common/swapyv12buffer.h
8922index caf9499..f2c3b74 100644
8923--- a/vp8/common/swapyv12buffer.h
8924+++ b/vp8/common/swapyv12buffer.h
8925@@ -1,10 +1,11 @@
8926 /*
8927 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8928 *
8929- * Use of this source code is governed by a BSD-style license and patent
8930- * grant that can be found in the LICENSE file in the root of the source
8931- * tree. All contributing project authors may be found in the AUTHORS
8932- * file in the root of the source tree.
8933+ * Use of this source code is governed by a BSD-style license
8934+ * that can be found in the LICENSE file in the root of the source
8935+ * tree. An additional intellectual property rights grant can be found
8936+ * in the file PATENTS. All contributing project authors may
8937+ * be found in the AUTHORS file in the root of the source tree.
8938 */
8939
8940
8941diff --git a/vp8/common/systemdependent.h b/vp8/common/systemdependent.h
8942index 1829b64..56218e6 100644
8943--- a/vp8/common/systemdependent.h
8944+++ b/vp8/common/systemdependent.h
8945@@ -1,10 +1,11 @@
8946 /*
8947 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8948 *
8949- * Use of this source code is governed by a BSD-style license and patent
8950- * grant that can be found in the LICENSE file in the root of the source
8951- * tree. All contributing project authors may be found in the AUTHORS
8952- * file in the root of the source tree.
8953+ * Use of this source code is governed by a BSD-style license
8954+ * that can be found in the LICENSE file in the root of the source
8955+ * tree. An additional intellectual property rights grant can be found
8956+ * in the file PATENTS. All contributing project authors may
8957+ * be found in the AUTHORS file in the root of the source tree.
8958 */
8959
8960
8961diff --git a/vp8/common/textblit.c b/vp8/common/textblit.c
8962index a45937b..5d117f1 100644
8963--- a/vp8/common/textblit.c
8964+++ b/vp8/common/textblit.c
8965@@ -1,10 +1,11 @@
8966 /*
8967 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8968 *
8969- * Use of this source code is governed by a BSD-style license and patent
8970- * grant that can be found in the LICENSE file in the root of the source
8971- * tree. All contributing project authors may be found in the AUTHORS
8972- * file in the root of the source tree.
8973+ * Use of this source code is governed by a BSD-style license
8974+ * that can be found in the LICENSE file in the root of the source
8975+ * tree. An additional intellectual property rights grant can be found
8976+ * in the file PATENTS. All contributing project authors may
8977+ * be found in the AUTHORS file in the root of the source tree.
8978 */
8979
8980
8981diff --git a/vp8/common/threading.h b/vp8/common/threading.h
8982index a02cb24..7c94645 100644
8983--- a/vp8/common/threading.h
8984+++ b/vp8/common/threading.h
8985@@ -1,10 +1,11 @@
8986 /*
8987 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
8988 *
8989- * Use of this source code is governed by a BSD-style license and patent
8990- * grant that can be found in the LICENSE file in the root of the source
8991- * tree. All contributing project authors may be found in the AUTHORS
8992- * file in the root of the source tree.
8993+ * Use of this source code is governed by a BSD-style license
8994+ * that can be found in the LICENSE file in the root of the source
8995+ * tree. An additional intellectual property rights grant can be found
8996+ * in the file PATENTS. All contributing project authors may
8997+ * be found in the AUTHORS file in the root of the source tree.
8998 */
8999
9000
9001diff --git a/vp8/common/treecoder.c b/vp8/common/treecoder.c
9002index 4ad018d..0ccd64d 100644
9003--- a/vp8/common/treecoder.c
9004+++ b/vp8/common/treecoder.c
9005@@ -1,10 +1,11 @@
9006 /*
9007 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9008 *
9009- * Use of this source code is governed by a BSD-style license and patent
9010- * grant that can be found in the LICENSE file in the root of the source
9011- * tree. All contributing project authors may be found in the AUTHORS
9012- * file in the root of the source tree.
9013+ * Use of this source code is governed by a BSD-style license
9014+ * that can be found in the LICENSE file in the root of the source
9015+ * tree. An additional intellectual property rights grant can be found
9016+ * in the file PATENTS. All contributing project authors may
9017+ * be found in the AUTHORS file in the root of the source tree.
9018 */
9019
9020
9021diff --git a/vp8/common/treecoder.h b/vp8/common/treecoder.h
9022index 0356d2b..908dbcb 100644
9023--- a/vp8/common/treecoder.h
9024+++ b/vp8/common/treecoder.h
9025@@ -1,10 +1,11 @@
9026 /*
9027 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9028 *
9029- * Use of this source code is governed by a BSD-style license and patent
9030- * grant that can be found in the LICENSE file in the root of the source
9031- * tree. All contributing project authors may be found in the AUTHORS
9032- * file in the root of the source tree.
9033+ * Use of this source code is governed by a BSD-style license
9034+ * that can be found in the LICENSE file in the root of the source
9035+ * tree. An additional intellectual property rights grant can be found
9036+ * in the file PATENTS. All contributing project authors may
9037+ * be found in the AUTHORS file in the root of the source tree.
9038 */
9039
9040
9041diff --git a/vp8/common/type_aliases.h b/vp8/common/type_aliases.h
9042index addd264..a0d8717 100644
9043--- a/vp8/common/type_aliases.h
9044+++ b/vp8/common/type_aliases.h
9045@@ -1,10 +1,11 @@
9046 /*
9047 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9048 *
9049- * Use of this source code is governed by a BSD-style license and patent
9050- * grant that can be found in the LICENSE file in the root of the source
9051- * tree. All contributing project authors may be found in the AUTHORS
9052- * file in the root of the source tree.
9053+ * Use of this source code is governed by a BSD-style license
9054+ * that can be found in the LICENSE file in the root of the source
9055+ * tree. An additional intellectual property rights grant can be found
9056+ * in the file PATENTS. All contributing project authors may
9057+ * be found in the AUTHORS file in the root of the source tree.
9058 */
9059
9060
9061diff --git a/vp8/common/vfwsetting.hpp b/vp8/common/vfwsetting.hpp
9062index e352e7a..c01a0dd 100644
9063--- a/vp8/common/vfwsetting.hpp
9064+++ b/vp8/common/vfwsetting.hpp
9065@@ -1,10 +1,11 @@
9066 /*
9067 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9068 *
9069- * Use of this source code is governed by a BSD-style license and patent
9070- * grant that can be found in the LICENSE file in the root of the source
9071- * tree. All contributing project authors may be found in the AUTHORS
9072- * file in the root of the source tree.
9073+ * Use of this source code is governed by a BSD-style license
9074+ * that can be found in the LICENSE file in the root of the source
9075+ * tree. An additional intellectual property rights grant can be found
9076+ * in the file PATENTS. All contributing project authors may
9077+ * be found in the AUTHORS file in the root of the source tree.
9078 */
9079
9080
9081diff --git a/vp8/common/vpx_ref_build_prefix.h b/vp8/common/vpx_ref_build_prefix.h
9082index 40608c6..cded66c 100644
9083--- a/vp8/common/vpx_ref_build_prefix.h
9084+++ b/vp8/common/vpx_ref_build_prefix.h
9085@@ -1,10 +1,11 @@
9086 /*
9087 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9088 *
9089- * Use of this source code is governed by a BSD-style license and patent
9090- * grant that can be found in the LICENSE file in the root of the source
9091- * tree. All contributing project authors may be found in the AUTHORS
9092- * file in the root of the source tree.
9093+ * Use of this source code is governed by a BSD-style license
9094+ * that can be found in the LICENSE file in the root of the source
9095+ * tree. An additional intellectual property rights grant can be found
9096+ * in the file PATENTS. All contributing project authors may
9097+ * be found in the AUTHORS file in the root of the source tree.
9098 */
9099
9100
9101diff --git a/vp8/common/vpxblit.h b/vp8/common/vpxblit.h
9102index d03e0bd..2c7f673 100644
9103--- a/vp8/common/vpxblit.h
9104+++ b/vp8/common/vpxblit.h
9105@@ -1,10 +1,11 @@
9106 /*
9107 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9108 *
9109- * Use of this source code is governed by a BSD-style license and patent
9110- * grant that can be found in the LICENSE file in the root of the source
9111- * tree. All contributing project authors may be found in the AUTHORS
9112- * file in the root of the source tree.
9113+ * Use of this source code is governed by a BSD-style license
9114+ * that can be found in the LICENSE file in the root of the source
9115+ * tree. An additional intellectual property rights grant can be found
9116+ * in the file PATENTS. All contributing project authors may
9117+ * be found in the AUTHORS file in the root of the source tree.
9118 */
9119
9120
9121diff --git a/vp8/common/vpxblit_c64.h b/vp8/common/vpxblit_c64.h
9122index a8e28f5..7659b5c 100644
9123--- a/vp8/common/vpxblit_c64.h
9124+++ b/vp8/common/vpxblit_c64.h
9125@@ -1,10 +1,11 @@
9126 /*
9127 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9128 *
9129- * Use of this source code is governed by a BSD-style license and patent
9130- * grant that can be found in the LICENSE file in the root of the source
9131- * tree. All contributing project authors may be found in the AUTHORS
9132- * file in the root of the source tree.
9133+ * Use of this source code is governed by a BSD-style license
9134+ * that can be found in the LICENSE file in the root of the source
9135+ * tree. An additional intellectual property rights grant can be found
9136+ * in the file PATENTS. All contributing project authors may
9137+ * be found in the AUTHORS file in the root of the source tree.
9138 */
9139
9140
9141diff --git a/vp8/common/vpxerrors.h b/vp8/common/vpxerrors.h
9142index e4c9f3e..f0ec707 100644
9143--- a/vp8/common/vpxerrors.h
9144+++ b/vp8/common/vpxerrors.h
9145@@ -1,10 +1,11 @@
9146 /*
9147 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9148 *
9149- * Use of this source code is governed by a BSD-style license and patent
9150- * grant that can be found in the LICENSE file in the root of the source
9151- * tree. All contributing project authors may be found in the AUTHORS
9152- * file in the root of the source tree.
9153+ * Use of this source code is governed by a BSD-style license
9154+ * that can be found in the LICENSE file in the root of the source
9155+ * tree. An additional intellectual property rights grant can be found
9156+ * in the file PATENTS. All contributing project authors may
9157+ * be found in the AUTHORS file in the root of the source tree.
9158 */
9159
9160
9161diff --git a/vp8/common/x86/boolcoder.cxx b/vp8/common/x86/boolcoder.cxx
9162index 06faca6..cd9c495 100644
9163--- a/vp8/common/x86/boolcoder.cxx
9164+++ b/vp8/common/x86/boolcoder.cxx
9165@@ -1,10 +1,11 @@
9166 /*
9167 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9168 *
9169- * Use of this source code is governed by a BSD-style license and patent
9170- * grant that can be found in the LICENSE file in the root of the source
9171- * tree. All contributing project authors may be found in the AUTHORS
9172- * file in the root of the source tree.
9173+ * Use of this source code is governed by a BSD-style license
9174+ * that can be found in the LICENSE file in the root of the source
9175+ * tree. An additional intellectual property rights grant can be found
9176+ * in the file PATENTS. All contributing project authors may
9177+ * be found in the AUTHORS file in the root of the source tree.
9178 */
9179
9180
9181diff --git a/vp8/common/x86/idct_x86.h b/vp8/common/x86/idct_x86.h
9182index 5dfb212..1f2cb63 100644
9183--- a/vp8/common/x86/idct_x86.h
9184+++ b/vp8/common/x86/idct_x86.h
9185@@ -1,10 +1,11 @@
9186 /*
9187 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9188 *
9189- * Use of this source code is governed by a BSD-style license and patent
9190- * grant that can be found in the LICENSE file in the root of the source
9191- * tree. All contributing project authors may be found in the AUTHORS
9192- * file in the root of the source tree.
9193+ * Use of this source code is governed by a BSD-style license
9194+ * that can be found in the LICENSE file in the root of the source
9195+ * tree. An additional intellectual property rights grant can be found
9196+ * in the file PATENTS. All contributing project authors may
9197+ * be found in the AUTHORS file in the root of the source tree.
9198 */
9199
9200
9201diff --git a/vp8/common/x86/idctllm_mmx.asm b/vp8/common/x86/idctllm_mmx.asm
9202index 2751c69..5ec01e9 100644
9203--- a/vp8/common/x86/idctllm_mmx.asm
9204+++ b/vp8/common/x86/idctllm_mmx.asm
9205@@ -1,10 +1,11 @@
9206 ;
9207 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9208 ;
9209-; Use of this source code is governed by a BSD-style license and patent
9210-; grant that can be found in the LICENSE file in the root of the source
9211-; tree. All contributing project authors may be found in the AUTHORS
9212-; file in the root of the source tree.
9213+; Use of this source code is governed by a BSD-style license
9214+; that can be found in the LICENSE file in the root of the source
9215+; tree. An additional intellectual property rights grant can be found
9216+; in the file PATENTS. All contributing project authors may
9217+; be found in the AUTHORS file in the root of the source tree.
9218 ;
9219
9220
9221diff --git a/vp8/common/x86/iwalsh_mmx.asm b/vp8/common/x86/iwalsh_mmx.asm
9222index 562e590..6cb8979 100644
9223--- a/vp8/common/x86/iwalsh_mmx.asm
9224+++ b/vp8/common/x86/iwalsh_mmx.asm
9225@@ -1,10 +1,11 @@
9226 ;
9227 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9228 ;
9229-; Use of this source code is governed by a BSD-style license and patent
9230-; grant that can be found in the LICENSE file in the root of the source
9231-; tree. All contributing project authors may be found in the AUTHORS
9232-; file in the root of the source tree.
9233+; Use of this source code is governed by a BSD-style license
9234+; that can be found in the LICENSE file in the root of the source
9235+; tree. An additional intellectual property rights grant can be found
9236+; in the file PATENTS. All contributing project authors may
9237+; be found in the AUTHORS file in the root of the source tree.
9238 ;
9239
9240
9241diff --git a/vp8/common/x86/iwalsh_sse2.asm b/vp8/common/x86/iwalsh_sse2.asm
9242index 96943df..bb0d1d7 100644
9243--- a/vp8/common/x86/iwalsh_sse2.asm
9244+++ b/vp8/common/x86/iwalsh_sse2.asm
9245@@ -1,10 +1,11 @@
9246 ;
9247 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9248 ;
9249-; Use of this source code is governed by a BSD-style license and patent
9250-; grant that can be found in the LICENSE file in the root of the source
9251-; tree. All contributing project authors may be found in the AUTHORS
9252-; file in the root of the source tree.
9253+; Use of this source code is governed by a BSD-style license
9254+; that can be found in the LICENSE file in the root of the source
9255+; tree. An additional intellectual property rights grant can be found
9256+; in the file PATENTS. All contributing project authors may
9257+; be found in the AUTHORS file in the root of the source tree.
9258 ;
9259
9260
9261@@ -16,6 +17,7 @@ sym(vp8_short_inv_walsh4x4_sse2):
9262 push rbp
9263 mov rbp, rsp
9264 SHADOW_ARGS_TO_STACK 2
9265+ SAVE_XMM
9266 push rsi
9267 push rdi
9268 ; end prolog
9269@@ -100,6 +102,7 @@ sym(vp8_short_inv_walsh4x4_sse2):
9270 ; begin epilog
9271 pop rdi
9272 pop rsi
9273+ RESTORE_XMM
9274 UNSHADOW_ARGS
9275 pop rbp
9276 ret
9277diff --git a/vp8/common/x86/loopfilter_mmx.asm b/vp8/common/x86/loopfilter_mmx.asm
9278index 6e4d2b6..6e6efab 100644
9279--- a/vp8/common/x86/loopfilter_mmx.asm
9280+++ b/vp8/common/x86/loopfilter_mmx.asm
9281@@ -1,10 +1,11 @@
9282 ;
9283 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9284 ;
9285-; Use of this source code is governed by a BSD-style license and patent
9286-; grant that can be found in the LICENSE file in the root of the source
9287-; tree. All contributing project authors may be found in the AUTHORS
9288-; file in the root of the source tree.
9289+; Use of this source code is governed by a BSD-style license
9290+; that can be found in the LICENSE file in the root of the source
9291+; tree. An additional intellectual property rights grant can be found
9292+; in the file PATENTS. All contributing project authors may
9293+; be found in the AUTHORS file in the root of the source tree.
9294 ;
9295
9296
9297diff --git a/vp8/common/x86/loopfilter_sse2.asm b/vp8/common/x86/loopfilter_sse2.asm
9298index 5275dfa..d160dd6 100644
9299--- a/vp8/common/x86/loopfilter_sse2.asm
9300+++ b/vp8/common/x86/loopfilter_sse2.asm
9301@@ -1,10 +1,11 @@
9302 ;
9303 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9304 ;
9305-; Use of this source code is governed by a BSD-style license and patent
9306-; grant that can be found in the LICENSE file in the root of the source
9307-; tree. All contributing project authors may be found in the AUTHORS
9308-; file in the root of the source tree.
9309+; Use of this source code is governed by a BSD-style license
9310+; that can be found in the LICENSE file in the root of the source
9311+; tree. An additional intellectual property rights grant can be found
9312+; in the file PATENTS. All contributing project authors may
9313+; be found in the AUTHORS file in the root of the source tree.
9314 ;
9315
9316
9317@@ -25,6 +26,7 @@ sym(vp8_loop_filter_horizontal_edge_sse2):
9318 push rbp
9319 mov rbp, rsp
9320 SHADOW_ARGS_TO_STACK 6
9321+ SAVE_XMM
9322 GET_GOT rbx
9323 push rsi
9324 push rdi
9325@@ -211,6 +213,7 @@ sym(vp8_loop_filter_horizontal_edge_sse2):
9326 pop rdi
9327 pop rsi
9328 RESTORE_GOT
9329+ RESTORE_XMM
9330 UNSHADOW_ARGS
9331 pop rbp
9332 ret
9333@@ -230,6 +233,7 @@ sym(vp8_loop_filter_vertical_edge_sse2):
9334 push rbp
9335 mov rbp, rsp
9336 SHADOW_ARGS_TO_STACK 6
9337+ SAVE_XMM
9338 GET_GOT rbx
9339 push rsi
9340 push rdi
9341@@ -651,6 +655,7 @@ sym(vp8_loop_filter_vertical_edge_sse2):
9342 pop rdi
9343 pop rsi
9344 RESTORE_GOT
9345+ RESTORE_XMM
9346 UNSHADOW_ARGS
9347 pop rbp
9348 ret
9349@@ -670,6 +675,7 @@ sym(vp8_mbloop_filter_horizontal_edge_sse2):
9350 push rbp
9351 mov rbp, rsp
9352 SHADOW_ARGS_TO_STACK 6
9353+ SAVE_XMM
9354 GET_GOT rbx
9355 push rsi
9356 push rdi
9357@@ -1001,6 +1007,7 @@ sym(vp8_mbloop_filter_horizontal_edge_sse2):
9358 pop rdi
9359 pop rsi
9360 RESTORE_GOT
9361+ RESTORE_XMM
9362 UNSHADOW_ARGS
9363 pop rbp
9364 ret
9365@@ -1020,6 +1027,7 @@ sym(vp8_mbloop_filter_vertical_edge_sse2):
9366 push rbp
9367 mov rbp, rsp
9368 SHADOW_ARGS_TO_STACK 6
9369+ SAVE_XMM
9370 GET_GOT rbx
9371 push rsi
9372 push rdi
9373@@ -1563,6 +1571,7 @@ sym(vp8_mbloop_filter_vertical_edge_sse2):
9374 pop rdi
9375 pop rsi
9376 RESTORE_GOT
9377+ RESTORE_XMM
9378 UNSHADOW_ARGS
9379 pop rbp
9380 ret
9381@@ -1582,6 +1591,7 @@ sym(vp8_loop_filter_simple_horizontal_edge_sse2):
9382 push rbp
9383 mov rbp, rsp
9384 SHADOW_ARGS_TO_STACK 6
9385+ SAVE_XMM
9386 GET_GOT rbx
9387 push rsi
9388 push rdi
9389@@ -1678,6 +1688,7 @@ sym(vp8_loop_filter_simple_horizontal_edge_sse2):
9390 pop rdi
9391 pop rsi
9392 RESTORE_GOT
9393+ RESTORE_XMM
9394 UNSHADOW_ARGS
9395 pop rbp
9396 ret
9397@@ -1697,6 +1708,7 @@ sym(vp8_loop_filter_simple_vertical_edge_sse2):
9398 push rbp ; save old base pointer value.
9399 mov rbp, rsp ; set new base pointer value.
9400 SHADOW_ARGS_TO_STACK 6
9401+ SAVE_XMM
9402 GET_GOT rbx ; save callee-saved reg
9403 push rsi
9404 push rdi
9405@@ -1941,6 +1953,7 @@ sym(vp8_loop_filter_simple_vertical_edge_sse2):
9406 pop rdi
9407 pop rsi
9408 RESTORE_GOT
9409+ RESTORE_XMM
9410 UNSHADOW_ARGS
9411 pop rbp
9412 ret
9413diff --git a/vp8/common/x86/loopfilter_x86.c b/vp8/common/x86/loopfilter_x86.c
9414index 143ee74..f5af7cf 100644
9415--- a/vp8/common/x86/loopfilter_x86.c
9416+++ b/vp8/common/x86/loopfilter_x86.c
9417@@ -1,10 +1,11 @@
9418 /*
9419 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9420 *
9421- * Use of this source code is governed by a BSD-style license and patent
9422- * grant that can be found in the LICENSE file in the root of the source
9423- * tree. All contributing project authors may be found in the AUTHORS
9424- * file in the root of the source tree.
9425+ * Use of this source code is governed by a BSD-style license
9426+ * that can be found in the LICENSE file in the root of the source
9427+ * tree. An additional intellectual property rights grant can be found
9428+ * in the file PATENTS. All contributing project authors may
9429+ * be found in the AUTHORS file in the root of the source tree.
9430 */
9431
9432
9433diff --git a/vp8/common/x86/loopfilter_x86.h b/vp8/common/x86/loopfilter_x86.h
9434index c87f38a..503bf5b 100644
9435--- a/vp8/common/x86/loopfilter_x86.h
9436+++ b/vp8/common/x86/loopfilter_x86.h
9437@@ -1,10 +1,11 @@
9438 /*
9439 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9440 *
9441- * Use of this source code is governed by a BSD-style license and patent
9442- * grant that can be found in the LICENSE file in the root of the source
9443- * tree. All contributing project authors may be found in the AUTHORS
9444- * file in the root of the source tree.
9445+ * Use of this source code is governed by a BSD-style license
9446+ * that can be found in the LICENSE file in the root of the source
9447+ * tree. An additional intellectual property rights grant can be found
9448+ * in the file PATENTS. All contributing project authors may
9449+ * be found in the AUTHORS file in the root of the source tree.
9450 */
9451
9452
9453diff --git a/vp8/common/x86/postproc_mmx.asm b/vp8/common/x86/postproc_mmx.asm
9454index 721c8d6..0707651 100644
9455--- a/vp8/common/x86/postproc_mmx.asm
9456+++ b/vp8/common/x86/postproc_mmx.asm
9457@@ -1,10 +1,11 @@
9458 ;
9459 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9460 ;
9461-; Use of this source code is governed by a BSD-style license and patent
9462-; grant that can be found in the LICENSE file in the root of the source
9463-; tree. All contributing project authors may be found in the AUTHORS
9464-; file in the root of the source tree.
9465+; Use of this source code is governed by a BSD-style license
9466+; that can be found in the LICENSE file in the root of the source
9467+; tree. An additional intellectual property rights grant can be found
9468+; in the file PATENTS. All contributing project authors may
9469+; be found in the AUTHORS file in the root of the source tree.
9470 ;
9471
9472
9473diff --git a/vp8/common/x86/postproc_mmx.c b/vp8/common/x86/postproc_mmx.c
9474index 095797b..f3b2923 100644
9475--- a/vp8/common/x86/postproc_mmx.c
9476+++ b/vp8/common/x86/postproc_mmx.c
9477@@ -1,10 +1,11 @@
9478 /*
9479 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9480 *
9481- * Use of this source code is governed by a BSD-style license and patent
9482- * grant that can be found in the LICENSE file in the root of the source
9483- * tree. All contributing project authors may be found in the AUTHORS
9484- * file in the root of the source tree.
9485+ * Use of this source code is governed by a BSD-style license
9486+ * that can be found in the LICENSE file in the root of the source
9487+ * tree. An additional intellectual property rights grant can be found
9488+ * in the file PATENTS. All contributing project authors may
9489+ * be found in the AUTHORS file in the root of the source tree.
9490 */
9491
9492
9493diff --git a/vp8/common/x86/postproc_sse2.asm b/vp8/common/x86/postproc_sse2.asm
9494index bfa36fa..9e56429 100644
9495--- a/vp8/common/x86/postproc_sse2.asm
9496+++ b/vp8/common/x86/postproc_sse2.asm
9497@@ -1,10 +1,11 @@
9498 ;
9499 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9500 ;
9501-; Use of this source code is governed by a BSD-style license and patent
9502-; grant that can be found in the LICENSE file in the root of the source
9503-; tree. All contributing project authors may be found in the AUTHORS
9504-; file in the root of the source tree.
9505+; Use of this source code is governed by a BSD-style license
9506+; that can be found in the LICENSE file in the root of the source
9507+; tree. An additional intellectual property rights grant can be found
9508+; in the file PATENTS. All contributing project authors may
9509+; be found in the AUTHORS file in the root of the source tree.
9510 ;
9511
9512
9513@@ -25,6 +26,7 @@ sym(vp8_post_proc_down_and_across_xmm):
9514 push rbp
9515 mov rbp, rsp
9516 SHADOW_ARGS_TO_STACK 7
9517+ SAVE_XMM
9518 GET_GOT rbx
9519 push rsi
9520 push rdi
9521@@ -239,6 +241,7 @@ acrossnextcol:
9522 pop rdi
9523 pop rsi
9524 RESTORE_GOT
9525+ RESTORE_XMM
9526 UNSHADOW_ARGS
9527 pop rbp
9528 ret
9529@@ -253,6 +256,7 @@ sym(vp8_mbpost_proc_down_xmm):
9530 push rbp
9531 mov rbp, rsp
9532 SHADOW_ARGS_TO_STACK 5
9533+ SAVE_XMM
9534 GET_GOT rbx
9535 push rsi
9536 push rdi
9537@@ -438,6 +442,7 @@ loop_row:
9538 pop rdi
9539 pop rsi
9540 RESTORE_GOT
9541+ RESTORE_XMM
9542 UNSHADOW_ARGS
9543 pop rbp
9544 ret
9545@@ -451,6 +456,7 @@ sym(vp8_mbpost_proc_across_ip_xmm):
9546 push rbp
9547 mov rbp, rsp
9548 SHADOW_ARGS_TO_STACK 5
9549+ SAVE_XMM
9550 GET_GOT rbx
9551 push rsi
9552 push rdi
9553@@ -611,6 +617,7 @@ nextcol4:
9554 pop rdi
9555 pop rsi
9556 RESTORE_GOT
9557+ RESTORE_XMM
9558 UNSHADOW_ARGS
9559 pop rbp
9560 ret
9561diff --git a/vp8/common/x86/postproc_x86.h b/vp8/common/x86/postproc_x86.h
9562index 49a1907..f939427 100644
9563--- a/vp8/common/x86/postproc_x86.h
9564+++ b/vp8/common/x86/postproc_x86.h
9565@@ -1,10 +1,11 @@
9566 /*
9567 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9568 *
9569- * Use of this source code is governed by a BSD-style license and patent
9570- * grant that can be found in the LICENSE file in the root of the source
9571- * tree. All contributing project authors may be found in the AUTHORS
9572- * file in the root of the source tree.
9573+ * Use of this source code is governed by a BSD-style license
9574+ * that can be found in the LICENSE file in the root of the source
9575+ * tree. An additional intellectual property rights grant can be found
9576+ * in the file PATENTS. All contributing project authors may
9577+ * be found in the AUTHORS file in the root of the source tree.
9578 */
9579
9580
9581diff --git a/vp8/common/x86/recon_mmx.asm b/vp8/common/x86/recon_mmx.asm
9582index ba60c5d..95c308d 100644
9583--- a/vp8/common/x86/recon_mmx.asm
9584+++ b/vp8/common/x86/recon_mmx.asm
9585@@ -1,10 +1,11 @@
9586 ;
9587 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9588 ;
9589-; Use of this source code is governed by a BSD-style license and patent
9590-; grant that can be found in the LICENSE file in the root of the source
9591-; tree. All contributing project authors may be found in the AUTHORS
9592-; file in the root of the source tree.
9593+; Use of this source code is governed by a BSD-style license
9594+; that can be found in the LICENSE file in the root of the source
9595+; tree. An additional intellectual property rights grant can be found
9596+; in the file PATENTS. All contributing project authors may
9597+; be found in the AUTHORS file in the root of the source tree.
9598 ;
9599
9600
9601diff --git a/vp8/common/x86/recon_sse2.asm b/vp8/common/x86/recon_sse2.asm
9602index f2685a7..cfdbfad 100644
9603--- a/vp8/common/x86/recon_sse2.asm
9604+++ b/vp8/common/x86/recon_sse2.asm
9605@@ -1,10 +1,11 @@
9606 ;
9607 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9608 ;
9609-; Use of this source code is governed by a BSD-style license and patent
9610-; grant that can be found in the LICENSE file in the root of the source
9611-; tree. All contributing project authors may be found in the AUTHORS
9612-; file in the root of the source tree.
9613+; Use of this source code is governed by a BSD-style license
9614+; that can be found in the LICENSE file in the root of the source
9615+; tree. An additional intellectual property rights grant can be found
9616+; in the file PATENTS. All contributing project authors may
9617+; be found in the AUTHORS file in the root of the source tree.
9618 ;
9619
9620
9621@@ -66,6 +67,7 @@ sym(vp8_recon4b_sse2):
9622 push rbp
9623 mov rbp, rsp
9624 SHADOW_ARGS_TO_STACK 4
9625+ SAVE_XMM
9626 push rsi
9627 push rdi
9628 ; end prolog
9629@@ -118,6 +120,7 @@ sym(vp8_recon4b_sse2):
9630 ; begin epilog
9631 pop rdi
9632 pop rsi
9633+ RESTORE_XMM
9634 UNSHADOW_ARGS
9635 pop rbp
9636 ret
9637diff --git a/vp8/common/x86/recon_x86.h b/vp8/common/x86/recon_x86.h
9638index c469778..fcd429c 100644
9639--- a/vp8/common/x86/recon_x86.h
9640+++ b/vp8/common/x86/recon_x86.h
9641@@ -1,10 +1,11 @@
9642 /*
9643 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9644 *
9645- * Use of this source code is governed by a BSD-style license and patent
9646- * grant that can be found in the LICENSE file in the root of the source
9647- * tree. All contributing project authors may be found in the AUTHORS
9648- * file in the root of the source tree.
9649+ * Use of this source code is governed by a BSD-style license
9650+ * that can be found in the LICENSE file in the root of the source
9651+ * tree. An additional intellectual property rights grant can be found
9652+ * in the file PATENTS. All contributing project authors may
9653+ * be found in the AUTHORS file in the root of the source tree.
9654 */
9655
9656
9657diff --git a/vp8/common/x86/subpixel_mmx.asm b/vp8/common/x86/subpixel_mmx.asm
9658index c502118..b3e4ad5 100644
9659--- a/vp8/common/x86/subpixel_mmx.asm
9660+++ b/vp8/common/x86/subpixel_mmx.asm
9661@@ -1,10 +1,11 @@
9662 ;
9663 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9664 ;
9665-; Use of this source code is governed by a BSD-style license and patent
9666-; grant that can be found in the LICENSE file in the root of the source
9667-; tree. All contributing project authors may be found in the AUTHORS
9668-; file in the root of the source tree.
9669+; Use of this source code is governed by a BSD-style license
9670+; that can be found in the LICENSE file in the root of the source
9671+; tree. An additional intellectual property rights grant can be found
9672+; in the file PATENTS. All contributing project authors may
9673+; be found in the AUTHORS file in the root of the source tree.
9674 ;
9675
9676
9677diff --git a/vp8/common/x86/subpixel_sse2.asm b/vp8/common/x86/subpixel_sse2.asm
9678index dee04f2..ee383ad 100644
9679--- a/vp8/common/x86/subpixel_sse2.asm
9680+++ b/vp8/common/x86/subpixel_sse2.asm
9681@@ -1,10 +1,11 @@
9682 ;
9683 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
9684 ;
9685-; Use of this source code is governed by a BSD-style license and patent
9686-; grant that can be found in the LICENSE file in the root of the source
9687-; tree. All contributing project authors may be found in the AUTHORS
9688-; file in the root of the source tree.
9689+; Use of this source code is governed by a BSD-style license
9690+; that can be found in the LICENSE file in the root of the source
9691+; tree. An additional intellectual property rights grant can be found
9692+; in the file PATENTS. All contributing project authors may
9693+; be found in the AUTHORS file in the root of the source tree.
9694 ;
9695
9696
9697@@ -36,6 +37,7 @@ sym(vp8_filter_block1d8_h6_sse2):
9698 push rbp
9699 mov rbp, rsp
9700 SHADOW_ARGS_TO_STACK 7
9701+ SAVE_XMM
9702 GET_GOT rbx
9703 push rsi
9704 push rdi
9705@@ -128,6 +130,7 @@ filter_block1d8_h6_rowloop:
9706 pop rdi
9707 pop rsi
9708 RESTORE_GOT
9709+ RESTORE_XMM
9710 UNSHADOW_ARGS
9711 pop rbp
9712 ret
9713@@ -154,6 +157,7 @@ sym(vp8_filter_block1d16_h6_sse2):
9714 push rbp
9715 mov rbp, rsp
9716 SHADOW_ARGS_TO_STACK 7
9717+ SAVE_XMM
9718 GET_GOT rbx
9719 push rsi
9720 push rdi
9721@@ -303,6 +307,7 @@ filter_block1d16_h6_sse2_rowloop:
9722 pop rdi
9723 pop rsi
9724 RESTORE_GOT
9725+ RESTORE_XMM
9726 UNSHADOW_ARGS
9727 pop rbp
9728 ret
9729@@ -328,6 +333,7 @@ sym(vp8_filter_block1d8_v6_sse2):
9730 push rbp
9731 mov rbp, rsp
9732 SHADOW_ARGS_TO_STACK 8
9733+ SAVE_XMM
9734 GET_GOT rbx
9735 push rsi
9736 push rdi
9737@@ -396,221 +402,553 @@ vp8_filter_block1d8_v6_sse2_loop:
9738 pop rdi
9739 pop rsi
9740 RESTORE_GOT
9741+ RESTORE_XMM
9742 UNSHADOW_ARGS
9743 pop rbp
9744 ret
9745
9746
9747-;void vp8_unpack_block1d16_h6_sse2
9748+;void vp8_filter_block1d16_v6_sse2
9749+;(
9750+; unsigned short *src_ptr,
9751+; unsigned char *output_ptr,
9752+; int dst_ptich,
9753+; unsigned int pixels_per_line,
9754+; unsigned int pixel_step,
9755+; unsigned int output_height,
9756+; unsigned int output_width,
9757+; const short *vp8_filter
9758+;)
9759+;/************************************************************************************
9760+; Notes: filter_block1d16_v6 applies a 6 tap filter vertically to the input pixels. The
9761+; input pixel array has output_height rows.
9762+;*************************************************************************************/
9763+global sym(vp8_filter_block1d16_v6_sse2)
9764+sym(vp8_filter_block1d16_v6_sse2):
9765+ push rbp
9766+ mov rbp, rsp
9767+ SHADOW_ARGS_TO_STACK 8
9768+ SAVE_XMM
9769+ GET_GOT rbx
9770+ push rsi
9771+ push rdi
9772+ ; end prolog
9773+
9774+ mov rax, arg(7) ;vp8_filter
9775+ movsxd rdx, dword ptr arg(3) ;pixels_per_line
9776+
9777+ mov rdi, arg(1) ;output_ptr
9778+ mov rsi, arg(0) ;src_ptr
9779+
9780+ sub rsi, rdx
9781+ sub rsi, rdx
9782+
9783+ movsxd rcx, DWORD PTR arg(5) ;[output_height]
9784+%if ABI_IS_32BIT=0
9785+ movsxd r8, dword ptr arg(2) ; dst_ptich
9786+%endif
9787+
9788+vp8_filter_block1d16_v6_sse2_loop:
9789+; The order for adding 6-tap is 2 5 3 1 4 6. Read in data in that order.
9790+ movdqa xmm1, XMMWORD PTR [rsi + rdx] ; line 2
9791+ movdqa xmm2, XMMWORD PTR [rsi + rdx + 16]
9792+ pmullw xmm1, [rax + 16]
9793+ pmullw xmm2, [rax + 16]
9794+
9795+ movdqa xmm3, XMMWORD PTR [rsi + rdx * 4] ; line 5
9796+ movdqa xmm4, XMMWORD PTR [rsi + rdx * 4 + 16]
9797+ pmullw xmm3, [rax + 64]
9798+ pmullw xmm4, [rax + 64]
9799+
9800+ movdqa xmm5, XMMWORD PTR [rsi + rdx * 2] ; line 3
9801+ movdqa xmm6, XMMWORD PTR [rsi + rdx * 2 + 16]
9802+ pmullw xmm5, [rax + 32]
9803+ pmullw xmm6, [rax + 32]
9804+
9805+ movdqa xmm7, XMMWORD PTR [rsi] ; line 1
9806+ movdqa xmm0, XMMWORD PTR [rsi + 16]
9807+ pmullw xmm7, [rax]
9808+ pmullw xmm0, [rax]
9809+
9810+ paddsw xmm1, xmm3
9811+ paddsw xmm2, xmm4
9812+ paddsw xmm1, xmm5
9813+ paddsw xmm2, xmm6
9814+ paddsw xmm1, xmm7
9815+ paddsw xmm2, xmm0
9816+
9817+ add rsi, rdx
9818+
9819+ movdqa xmm3, XMMWORD PTR [rsi + rdx * 2] ; line 4
9820+ movdqa xmm4, XMMWORD PTR [rsi + rdx * 2 + 16]
9821+ pmullw xmm3, [rax + 48]
9822+ pmullw xmm4, [rax + 48]
9823+
9824+ movdqa xmm5, XMMWORD PTR [rsi + rdx * 4] ; line 6
9825+ movdqa xmm6, XMMWORD PTR [rsi + rdx * 4 + 16]
9826+ pmullw xmm5, [rax + 80]
9827+ pmullw xmm6, [rax + 80]
9828+
9829+ movdqa xmm7, XMMWORD PTR [rd GLOBAL]
9830+ pxor xmm0, xmm0 ; clear xmm0
9831+
9832+ paddsw xmm1, xmm3
9833+ paddsw xmm2, xmm4
9834+ paddsw xmm1, xmm5
9835+ paddsw xmm2, xmm6
9836+
9837+ paddsw xmm1, xmm7
9838+ paddsw xmm2, xmm7
9839+
9840+ psraw xmm1, 7
9841+ psraw xmm2, 7
9842+
9843+ packuswb xmm1, xmm2 ; pack and saturate
9844+ movdqa XMMWORD PTR [rdi], xmm1 ; store the results in the destination
9845+%if ABI_IS_32BIT
9846+ add rdi, DWORD PTR arg(2) ;[dst_ptich]
9847+%else
9848+ add rdi, r8
9849+%endif
9850+ dec rcx ; decrement count
9851+ jnz vp8_filter_block1d16_v6_sse2_loop ; next row
9852+
9853+ ; begin epilog
9854+ pop rdi
9855+ pop rsi
9856+ RESTORE_GOT
9857+ RESTORE_XMM
9858+ UNSHADOW_ARGS
9859+ pop rbp
9860+ ret
9861+
9862+
9863+;void vp8_filter_block1d8_h6_only_sse2
9864 ;(
9865 ; unsigned char *src_ptr,
9866-; unsigned short *output_ptr,
9867 ; unsigned int src_pixels_per_line,
9868+; unsigned char *output_ptr,
9869+; int dst_ptich,
9870 ; unsigned int output_height,
9871-; unsigned int output_width
9872+; const short *vp8_filter
9873 ;)
9874-global sym(vp8_unpack_block1d16_h6_sse2)
9875-sym(vp8_unpack_block1d16_h6_sse2):
9876+; First-pass filter only when yoffset==0
9877+global sym(vp8_filter_block1d8_h6_only_sse2)
9878+sym(vp8_filter_block1d8_h6_only_sse2):
9879 push rbp
9880 mov rbp, rsp
9881- SHADOW_ARGS_TO_STACK 5
9882+ SHADOW_ARGS_TO_STACK 6
9883+ SAVE_XMM
9884 GET_GOT rbx
9885 push rsi
9886 push rdi
9887 ; end prolog
9888
9889+ mov rdx, arg(5) ;vp8_filter
9890 mov rsi, arg(0) ;src_ptr
9891- mov rdi, arg(1) ;output_ptr
9892
9893- movsxd rcx, dword ptr arg(3) ;output_height
9894- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
9895+ mov rdi, arg(2) ;output_ptr
9896
9897- pxor xmm0, xmm0 ; clear xmm0 for unpack
9898+ movsxd rcx, dword ptr arg(4) ;output_height
9899+ movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
9900 %if ABI_IS_32BIT=0
9901- movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
9902+ movsxd r8, dword ptr arg(3) ;dst_ptich
9903 %endif
9904+ pxor xmm0, xmm0 ; clear xmm0 for unpack
9905
9906-unpack_block1d16_h6_sse2_rowloop:
9907- movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
9908- movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
9909+filter_block1d8_h6_only_rowloop:
9910+ movq xmm3, MMWORD PTR [rsi - 2]
9911+ movq xmm1, MMWORD PTR [rsi + 6]
9912+
9913+ prefetcht2 [rsi+rax-2]
9914+
9915+ pslldq xmm1, 8
9916+ por xmm1, xmm3
9917+
9918+ movdqa xmm4, xmm1
9919+ movdqa xmm5, xmm1
9920+
9921+ movdqa xmm6, xmm1
9922+ movdqa xmm7, xmm1
9923
9924 punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
9925- punpcklbw xmm1, xmm0
9926+ psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
9927+
9928+ pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
9929+ punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
9930+
9931+ psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
9932+ pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
9933+
9934+
9935+ punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
9936+ psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
9937+
9938+ pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
9939+
9940+ punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
9941+ psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
9942+
9943+ pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
9944+
9945+ punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
9946+ psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
9947+
9948+
9949+ pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
9950+
9951+ punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
9952+ pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
9953
9954- movdqa XMMWORD Ptr [rdi], xmm1
9955- movdqa XMMWORD Ptr [rdi + 16], xmm3
9956
9957+ paddsw xmm4, xmm7
9958+ paddsw xmm4, xmm5
9959+
9960+ paddsw xmm4, xmm3
9961+ paddsw xmm4, xmm6
9962+
9963+ paddsw xmm4, xmm1
9964+ paddsw xmm4, [rd GLOBAL]
9965+
9966+ psraw xmm4, 7
9967+
9968+ packuswb xmm4, xmm0
9969+
9970+ movq QWORD PTR [rdi], xmm4 ; store the results in the destination
9971 lea rsi, [rsi + rax]
9972+
9973 %if ABI_IS_32BIT
9974- add rdi, DWORD Ptr arg(4) ;[output_width]
9975+ add rdi, DWORD Ptr arg(3) ;dst_ptich
9976 %else
9977 add rdi, r8
9978 %endif
9979 dec rcx
9980- jnz unpack_block1d16_h6_sse2_rowloop ; next row
9981+
9982+ jnz filter_block1d8_h6_only_rowloop ; next row
9983
9984 ; begin epilog
9985 pop rdi
9986 pop rsi
9987 RESTORE_GOT
9988+ RESTORE_XMM
9989 UNSHADOW_ARGS
9990 pop rbp
9991 ret
9992
9993
9994-;void vp8_unpack_block1d8_h6_sse2
9995+;void vp8_filter_block1d16_h6_only_sse2
9996 ;(
9997 ; unsigned char *src_ptr,
9998-; unsigned short *output_ptr,
9999 ; unsigned int src_pixels_per_line,
10000+; unsigned char *output_ptr,
10001+; int dst_ptich,
10002 ; unsigned int output_height,
10003-; unsigned int output_width
10004+; const short *vp8_filter
10005 ;)
10006-global sym(vp8_unpack_block1d8_h6_sse2)
10007-sym(vp8_unpack_block1d8_h6_sse2):
10008+; First-pass filter only when yoffset==0
10009+global sym(vp8_filter_block1d16_h6_only_sse2)
10010+sym(vp8_filter_block1d16_h6_only_sse2):
10011 push rbp
10012 mov rbp, rsp
10013- SHADOW_ARGS_TO_STACK 5
10014+ SHADOW_ARGS_TO_STACK 6
10015+ SAVE_XMM
10016 GET_GOT rbx
10017 push rsi
10018 push rdi
10019 ; end prolog
10020
10021+ mov rdx, arg(5) ;vp8_filter
10022 mov rsi, arg(0) ;src_ptr
10023- mov rdi, arg(1) ;output_ptr
10024
10025- movsxd rcx, dword ptr arg(3) ;output_height
10026- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
10027+ mov rdi, arg(2) ;output_ptr
10028
10029- pxor xmm0, xmm0 ; clear xmm0 for unpack
10030+ movsxd rcx, dword ptr arg(4) ;output_height
10031+ movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
10032 %if ABI_IS_32BIT=0
10033- movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
10034+ movsxd r8, dword ptr arg(3) ;dst_ptich
10035 %endif
10036
10037-unpack_block1d8_h6_sse2_rowloop:
10038- movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
10039- lea rsi, [rsi + rax]
10040+ pxor xmm0, xmm0 ; clear xmm0 for unpack
10041
10042- punpcklbw xmm1, xmm0
10043- movdqa XMMWORD Ptr [rdi], xmm1
10044+filter_block1d16_h6_only_sse2_rowloop:
10045+ movq xmm3, MMWORD PTR [rsi - 2]
10046+ movq xmm1, MMWORD PTR [rsi + 6]
10047+
10048+ movq xmm2, MMWORD PTR [rsi +14]
10049+ pslldq xmm2, 8
10050+
10051+ por xmm2, xmm1
10052+ prefetcht2 [rsi+rax-2]
10053+
10054+ pslldq xmm1, 8
10055+ por xmm1, xmm3
10056
10057+ movdqa xmm4, xmm1
10058+ movdqa xmm5, xmm1
10059+
10060+ movdqa xmm6, xmm1
10061+ movdqa xmm7, xmm1
10062+
10063+ punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
10064+ psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
10065+
10066+ pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
10067+ punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
10068+
10069+ psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
10070+ pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
10071+
10072+ punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
10073+ psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
10074+
10075+ pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
10076+
10077+ punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
10078+ psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
10079+
10080+ pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
10081+
10082+ punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
10083+ psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
10084+
10085+ pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
10086+
10087+ punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
10088+ pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
10089+
10090+ paddsw xmm4, xmm7
10091+ paddsw xmm4, xmm5
10092+
10093+ paddsw xmm4, xmm3
10094+ paddsw xmm4, xmm6
10095+
10096+ paddsw xmm4, xmm1
10097+ paddsw xmm4, [rd GLOBAL]
10098+
10099+ psraw xmm4, 7
10100+
10101+ packuswb xmm4, xmm0 ; lower 8 bytes
10102+
10103+ movq QWORD Ptr [rdi], xmm4 ; store the results in the destination
10104+
10105+ movdqa xmm3, xmm2
10106+ movdqa xmm4, xmm2
10107+
10108+ movdqa xmm5, xmm2
10109+ movdqa xmm6, xmm2
10110+
10111+ movdqa xmm7, xmm2
10112+
10113+ punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
10114+ psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
10115+
10116+ pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
10117+ punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
10118+
10119+ psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
10120+ pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
10121+
10122+ punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
10123+ psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
10124+
10125+ pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
10126+
10127+ punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
10128+ psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
10129+
10130+ pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
10131+
10132+ punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
10133+ psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
10134+
10135+ pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
10136+
10137+ punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
10138+ pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
10139+
10140+ paddsw xmm4, xmm7
10141+ paddsw xmm4, xmm5
10142+
10143+ paddsw xmm4, xmm3
10144+ paddsw xmm4, xmm6
10145+
10146+ paddsw xmm4, xmm2
10147+ paddsw xmm4, [rd GLOBAL]
10148+
10149+ psraw xmm4, 7
10150+
10151+ packuswb xmm4, xmm0 ; higher 8 bytes
10152+
10153+ movq QWORD Ptr [rdi+8], xmm4 ; store the results in the destination
10154+
10155+ lea rsi, [rsi + rax]
10156 %if ABI_IS_32BIT
10157- add rdi, DWORD Ptr arg(4) ;[output_width]
10158+ add rdi, DWORD Ptr arg(3) ;dst_ptich
10159 %else
10160 add rdi, r8
10161 %endif
10162+
10163 dec rcx
10164- jnz unpack_block1d8_h6_sse2_rowloop ; next row
10165+ jnz filter_block1d16_h6_only_sse2_rowloop ; next row
10166
10167 ; begin epilog
10168 pop rdi
10169 pop rsi
10170 RESTORE_GOT
10171+ RESTORE_XMM
10172 UNSHADOW_ARGS
10173 pop rbp
10174 ret
10175
10176
10177-;void vp8_pack_block1d8_v6_sse2
10178+;void vp8_filter_block1d8_v6_only_sse2
10179 ;(
10180-; short *src_ptr,
10181+; unsigned char *src_ptr,
10182+; unsigned int src_pixels_per_line,
10183 ; unsigned char *output_ptr,
10184 ; int dst_ptich,
10185-; unsigned int pixels_per_line,
10186 ; unsigned int output_height,
10187-; unsigned int output_width
10188+; const short *vp8_filter
10189 ;)
10190-global sym(vp8_pack_block1d8_v6_sse2)
10191-sym(vp8_pack_block1d8_v6_sse2):
10192+; Second-pass filter only when xoffset==0
10193+global sym(vp8_filter_block1d8_v6_only_sse2)
10194+sym(vp8_filter_block1d8_v6_only_sse2):
10195 push rbp
10196 mov rbp, rsp
10197 SHADOW_ARGS_TO_STACK 6
10198+ SAVE_XMM
10199 GET_GOT rbx
10200 push rsi
10201 push rdi
10202 ; end prolog
10203
10204- movsxd rdx, dword ptr arg(3) ;pixels_per_line
10205- mov rdi, arg(1) ;output_ptr
10206-
10207 mov rsi, arg(0) ;src_ptr
10208- movsxd rcx, DWORD PTR arg(4) ;[output_height]
10209+ mov rdi, arg(2) ;output_ptr
10210+
10211+ movsxd rcx, dword ptr arg(4) ;output_height
10212+ movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
10213+
10214+ mov rax, arg(5) ;vp8_filter
10215+
10216+ pxor xmm0, xmm0 ; clear xmm0
10217+
10218+ movdqa xmm7, XMMWORD PTR [rd GLOBAL]
10219 %if ABI_IS_32BIT=0
10220- movsxd r8, dword ptr arg(5) ;output_width ; Pitch for Source
10221+ movsxd r8, dword ptr arg(3) ; dst_ptich
10222 %endif
10223
10224-pack_block1d8_v6_sse2_loop:
10225- movdqa xmm0, XMMWORD PTR [rsi]
10226- packuswb xmm0, xmm0
10227+vp8_filter_block1d8_v6_only_sse2_loop:
10228+ movq xmm1, MMWORD PTR [rsi]
10229+ movq xmm2, MMWORD PTR [rsi + rdx]
10230+ movq xmm3, MMWORD PTR [rsi + rdx * 2]
10231+ movq xmm5, MMWORD PTR [rsi + rdx * 4]
10232+ add rsi, rdx
10233+ movq xmm4, MMWORD PTR [rsi + rdx * 2]
10234+ movq xmm6, MMWORD PTR [rsi + rdx * 4]
10235+
10236+ punpcklbw xmm1, xmm0
10237+ pmullw xmm1, [rax]
10238+
10239+ punpcklbw xmm2, xmm0
10240+ pmullw xmm2, [rax + 16]
10241+
10242+ punpcklbw xmm3, xmm0
10243+ pmullw xmm3, [rax + 32]
10244+
10245+ punpcklbw xmm5, xmm0
10246+ pmullw xmm5, [rax + 64]
10247+
10248+ punpcklbw xmm4, xmm0
10249+ pmullw xmm4, [rax + 48]
10250+
10251+ punpcklbw xmm6, xmm0
10252+ pmullw xmm6, [rax + 80]
10253+
10254+ paddsw xmm2, xmm5
10255+ paddsw xmm2, xmm3
10256+
10257+ paddsw xmm2, xmm1
10258+ paddsw xmm2, xmm4
10259+
10260+ paddsw xmm2, xmm6
10261+ paddsw xmm2, xmm7
10262
10263- movq QWORD PTR [rdi], xmm0 ; store the results in the destination
10264- lea rsi, [rsi+rdx]
10265+ psraw xmm2, 7
10266+ packuswb xmm2, xmm0 ; pack and saturate
10267
10268+ movq QWORD PTR [rdi], xmm2 ; store the results in the destination
10269 %if ABI_IS_32BIT
10270- add rdi, DWORD Ptr arg(5) ;[output_width]
10271+ add rdi, DWORD PTR arg(3) ;[dst_ptich]
10272 %else
10273 add rdi, r8
10274 %endif
10275 dec rcx ; decrement count
10276- jnz pack_block1d8_v6_sse2_loop ; next row
10277+ jnz vp8_filter_block1d8_v6_only_sse2_loop ; next row
10278
10279 ; begin epilog
10280 pop rdi
10281 pop rsi
10282 RESTORE_GOT
10283+ RESTORE_XMM
10284 UNSHADOW_ARGS
10285 pop rbp
10286 ret
10287
10288
10289-;void vp8_pack_block1d16_v6_sse2
10290+;void vp8_unpack_block1d16_h6_sse2
10291 ;(
10292-; short *src_ptr,
10293-; unsigned char *output_ptr,
10294-; int dst_ptich,
10295-; unsigned int pixels_per_line,
10296-; unsigned int output_height,
10297-; unsigned int output_width
10298+; unsigned char *src_ptr,
10299+; unsigned short *output_ptr,
10300+; unsigned int src_pixels_per_line,
10301+; unsigned int output_height,
10302+; unsigned int output_width
10303 ;)
10304-global sym(vp8_pack_block1d16_v6_sse2)
10305-sym(vp8_pack_block1d16_v6_sse2):
10306+global sym(vp8_unpack_block1d16_h6_sse2)
10307+sym(vp8_unpack_block1d16_h6_sse2):
10308 push rbp
10309 mov rbp, rsp
10310- SHADOW_ARGS_TO_STACK 6
10311+ SHADOW_ARGS_TO_STACK 5
10312+ ;SAVE_XMM ;xmm6, xmm7 are not used here.
10313 GET_GOT rbx
10314 push rsi
10315 push rdi
10316 ; end prolog
10317
10318- movsxd rdx, dword ptr arg(3) ;pixels_per_line
10319+ mov rsi, arg(0) ;src_ptr
10320 mov rdi, arg(1) ;output_ptr
10321
10322- mov rsi, arg(0) ;src_ptr
10323- movsxd rcx, DWORD PTR arg(4) ;[output_height]
10324+ movsxd rcx, dword ptr arg(3) ;output_height
10325+ movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
10326+
10327+ pxor xmm0, xmm0 ; clear xmm0 for unpack
10328 %if ABI_IS_32BIT=0
10329- movsxd r8, dword ptr arg(2) ;dst_pitch
10330+ movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
10331 %endif
10332
10333-pack_block1d16_v6_sse2_loop:
10334- movdqa xmm0, XMMWORD PTR [rsi]
10335- movdqa xmm1, XMMWORD PTR [rsi+16]
10336+unpack_block1d16_h6_sse2_rowloop:
10337+ movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
10338+ movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
10339+
10340+ punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
10341+ punpcklbw xmm1, xmm0
10342
10343- packuswb xmm0, xmm1
10344- movdqa XMMWORD PTR [rdi], xmm0 ; store the results in the destination
10345+ movdqa XMMWORD Ptr [rdi], xmm1
10346+ movdqa XMMWORD Ptr [rdi + 16], xmm3
10347
10348- add rsi, rdx
10349+ lea rsi, [rsi + rax]
10350 %if ABI_IS_32BIT
10351- add rdi, DWORD Ptr arg(2) ;dst_pitch
10352+ add rdi, DWORD Ptr arg(4) ;[output_width]
10353 %else
10354 add rdi, r8
10355 %endif
10356- dec rcx ; decrement count
10357- jnz pack_block1d16_v6_sse2_loop ; next row
10358+ dec rcx
10359+ jnz unpack_block1d16_h6_sse2_rowloop ; next row
10360
10361 ; begin epilog
10362 pop rdi
10363 pop rsi
10364 RESTORE_GOT
10365+ ;RESTORE_XMM
10366 UNSHADOW_ARGS
10367 pop rbp
10368 ret
10369@@ -631,6 +969,7 @@ sym(vp8_bilinear_predict16x16_sse2):
10370 push rbp
10371 mov rbp, rsp
10372 SHADOW_ARGS_TO_STACK 6
10373+ SAVE_XMM
10374 GET_GOT rbx
10375 push rsi
10376 push rdi
10377@@ -878,6 +1217,7 @@ done:
10378 pop rdi
10379 pop rsi
10380 RESTORE_GOT
10381+ RESTORE_XMM
10382 UNSHADOW_ARGS
10383 pop rbp
10384 ret
10385@@ -898,6 +1238,7 @@ sym(vp8_bilinear_predict8x8_sse2):
10386 push rbp
10387 mov rbp, rsp
10388 SHADOW_ARGS_TO_STACK 6
10389+ SAVE_XMM
10390 GET_GOT rbx
10391 push rsi
10392 push rdi
10393@@ -1021,6 +1362,7 @@ next_row8x8:
10394 pop rdi
10395 pop rsi
10396 RESTORE_GOT
10397+ RESTORE_XMM
10398 UNSHADOW_ARGS
10399 pop rbp
10400 ret
10401diff --git a/vp8/common/x86/subpixel_x86.h b/vp8/common/x86/subpixel_x86.h
10402index efa7b2e..bd6859c 100644
10403--- a/vp8/common/x86/subpixel_x86.h
10404+++ b/vp8/common/x86/subpixel_x86.h
10405@@ -1,10 +1,11 @@
10406 /*
10407 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10408 *
10409- * Use of this source code is governed by a BSD-style license and patent
10410- * grant that can be found in the LICENSE file in the root of the source
10411- * tree. All contributing project authors may be found in the AUTHORS
10412- * file in the root of the source tree.
10413+ * Use of this source code is governed by a BSD-style license
10414+ * that can be found in the LICENSE file in the root of the source
10415+ * tree. An additional intellectual property rights grant can be found
10416+ * in the file PATENTS. All contributing project authors may
10417+ * be found in the AUTHORS file in the root of the source tree.
10418 */
10419
10420
10421diff --git a/vp8/common/x86/vp8_asm_stubs.c b/vp8/common/x86/vp8_asm_stubs.c
10422index 68454f7..163ec5b 100644
10423--- a/vp8/common/x86/vp8_asm_stubs.c
10424+++ b/vp8/common/x86/vp8_asm_stubs.c
10425@@ -1,10 +1,11 @@
10426 /*
10427 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10428 *
10429- * Use of this source code is governed by a BSD-style license and patent
10430- * grant that can be found in the LICENSE file in the root of the source
10431- * tree. All contributing project authors may be found in the AUTHORS
10432- * file in the root of the source tree.
10433+ * Use of this source code is governed by a BSD-style license
10434+ * that can be found in the LICENSE file in the root of the source
10435+ * tree. An additional intellectual property rights grant can be found
10436+ * in the file PATENTS. All contributing project authors may
10437+ * be found in the AUTHORS file in the root of the source tree.
10438 */
10439
10440
10441@@ -67,6 +68,17 @@ extern void vp8_filter_block1d8_v6_sse2
10442 unsigned int output_width,
10443 const short *vp8_filter
10444 );
10445+extern void vp8_filter_block1d16_v6_sse2
10446+(
10447+ unsigned short *src_ptr,
10448+ unsigned char *output_ptr,
10449+ int dst_ptich,
10450+ unsigned int pixels_per_line,
10451+ unsigned int pixel_step,
10452+ unsigned int output_height,
10453+ unsigned int output_width,
10454+ const short *vp8_filter
10455+);
10456 extern void vp8_unpack_block1d16_h6_sse2
10457 (
10458 unsigned char *src_ptr,
10459@@ -75,31 +87,32 @@ extern void vp8_unpack_block1d16_h6_sse2
10460 unsigned int output_height,
10461 unsigned int output_width
10462 );
10463-extern void vp8_unpack_block1d8_h6_sse2
10464+extern void vp8_filter_block1d8_h6_only_sse2
10465 (
10466 unsigned char *src_ptr,
10467- unsigned short *output_ptr,
10468 unsigned int src_pixels_per_line,
10469+ unsigned char *output_ptr,
10470+ int dst_ptich,
10471 unsigned int output_height,
10472- unsigned int output_width
10473+ const short *vp8_filter
10474 );
10475-extern void vp8_pack_block1d8_v6_sse2
10476+extern void vp8_filter_block1d16_h6_only_sse2
10477 (
10478- unsigned short *src_ptr,
10479- unsigned char *output_ptr,
10480+ unsigned char *src_ptr,
10481+ unsigned int src_pixels_per_line,
10482+ unsigned char *output_ptr,
10483 int dst_ptich,
10484- unsigned int pixels_per_line,
10485- unsigned int output_height,
10486- unsigned int output_width
10487+ unsigned int output_height,
10488+ const short *vp8_filter
10489 );
10490-extern void vp8_pack_block1d16_v6_sse2
10491+extern void vp8_filter_block1d8_v6_only_sse2
10492 (
10493- unsigned short *src_ptr,
10494+ unsigned char *src_ptr,
10495+ unsigned int src_pixels_per_line,
10496 unsigned char *output_ptr,
10497 int dst_ptich,
10498- unsigned int pixels_per_line,
10499- unsigned int output_height,
10500- unsigned int output_width
10501+ unsigned int output_height,
10502+ const short *vp8_filter
10503 );
10504 extern prototype_subpixel_predict(vp8_bilinear_predict8x8_mmx);
10505
10506@@ -246,23 +259,26 @@ void vp8_sixtap_predict16x16_sse2
10507
10508 if (xoffset)
10509 {
10510- HFilter = vp8_six_tap_mmx[xoffset];
10511- vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
10512+ if (yoffset)
10513+ {
10514+ HFilter = vp8_six_tap_mmx[xoffset];
10515+ vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
10516+ VFilter = vp8_six_tap_mmx[yoffset];
10517+ vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
10518+ }
10519+ else
10520+ {
10521+ // First-pass only
10522+ HFilter = vp8_six_tap_mmx[xoffset];
10523+ vp8_filter_block1d16_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, HFilter);
10524+ }
10525 }
10526 else
10527 {
10528- vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
10529- }
10530-
10531- if (yoffset)
10532- {
10533+ // Second-pass only
10534 VFilter = vp8_six_tap_mmx[yoffset];
10535- vp8_filter_block1d8_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, 16, VFilter);
10536- vp8_filter_block1d8_v6_sse2(FData2 + 40, dst_ptr + 8, dst_pitch, 32, 16 , 16, 16, VFilter);
10537- }
10538- else
10539- {
10540- vp8_pack_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16, 16);
10541+ vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
10542+ vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
10543 }
10544 }
10545
10546@@ -282,25 +298,26 @@ void vp8_sixtap_predict8x8_sse2
10547
10548 if (xoffset)
10549 {
10550- HFilter = vp8_six_tap_mmx[xoffset];
10551- vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
10552+ if (yoffset)
10553+ {
10554+ HFilter = vp8_six_tap_mmx[xoffset];
10555+ vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
10556+ VFilter = vp8_six_tap_mmx[yoffset];
10557+ vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, dst_pitch, VFilter);
10558+ }
10559+ else
10560+ {
10561+ // First-pass only
10562+ HFilter = vp8_six_tap_mmx[xoffset];
10563+ vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, HFilter);
10564+ }
10565 }
10566 else
10567 {
10568- vp8_unpack_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 13, 16);
10569- }
10570-
10571- if (yoffset)
10572- {
10573+ // Second-pass only
10574 VFilter = vp8_six_tap_mmx[yoffset];
10575- vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, dst_pitch, VFilter);
10576- }
10577- else
10578- {
10579- vp8_pack_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8, dst_pitch);
10580+ vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, VFilter);
10581 }
10582-
10583-
10584 }
10585
10586
10587@@ -319,24 +336,26 @@ void vp8_sixtap_predict8x4_sse2
10588
10589 if (xoffset)
10590 {
10591- HFilter = vp8_six_tap_mmx[xoffset];
10592- vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
10593+ if (yoffset)
10594+ {
10595+ HFilter = vp8_six_tap_mmx[xoffset];
10596+ vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
10597+ VFilter = vp8_six_tap_mmx[yoffset];
10598+ vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, dst_pitch, VFilter);
10599+ }
10600+ else
10601+ {
10602+ // First-pass only
10603+ HFilter = vp8_six_tap_mmx[xoffset];
10604+ vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, HFilter);
10605+ }
10606 }
10607 else
10608 {
10609- vp8_unpack_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 9, 16);
10610- }
10611-
10612- if (yoffset)
10613- {
10614+ // Second-pass only
10615 VFilter = vp8_six_tap_mmx[yoffset];
10616- vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, dst_pitch, VFilter);
10617+ vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, VFilter);
10618 }
10619- else
10620- {
10621- vp8_pack_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 4, dst_pitch);
10622- }
10623-
10624-
10625 }
10626+
10627 #endif
10628diff --git a/vp8/common/x86/x86_systemdependent.c b/vp8/common/x86/x86_systemdependent.c
10629index 5312e06..09ff3c5 100644
10630--- a/vp8/common/x86/x86_systemdependent.c
10631+++ b/vp8/common/x86/x86_systemdependent.c
10632@@ -1,10 +1,11 @@
10633 /*
10634 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10635 *
10636- * Use of this source code is governed by a BSD-style license and patent
10637- * grant that can be found in the LICENSE file in the root of the source
10638- * tree. All contributing project authors may be found in the AUTHORS
10639- * file in the root of the source tree.
10640+ * Use of this source code is governed by a BSD-style license
10641+ * that can be found in the LICENSE file in the root of the source
10642+ * tree. An additional intellectual property rights grant can be found
10643+ * in the file PATENTS. All contributing project authors may
10644+ * be found in the AUTHORS file in the root of the source tree.
10645 */
10646
10647
10648diff --git a/vp8/decoder/arm/armv5/dequantize_v5.asm b/vp8/decoder/arm/armv5/dequantize_v5.asm
10649index eb3f030..80b2e0c 100644
10650--- a/vp8/decoder/arm/armv5/dequantize_v5.asm
10651+++ b/vp8/decoder/arm/armv5/dequantize_v5.asm
10652@@ -1,10 +1,11 @@
10653 ;
10654 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10655 ;
10656-; Use of this source code is governed by a BSD-style license and patent
10657-; grant that can be found in the LICENSE file in the root of the source
10658-; tree. All contributing project authors may be found in the AUTHORS
10659-; file in the root of the source tree.
10660+; Use of this source code is governed by a BSD-style license
10661+; that can be found in the LICENSE file in the root of the source
10662+; tree. An additional intellectual property rights grant can be found
10663+; in the file PATENTS. All contributing project authors may
10664+; be found in the AUTHORS file in the root of the source tree.
10665 ;
10666
10667
10668diff --git a/vp8/decoder/arm/armv6/dboolhuff_v6.asm b/vp8/decoder/arm/armv6/dboolhuff_v6.asm
10669index 143e33e..eca8eeb 100644
10670--- a/vp8/decoder/arm/armv6/dboolhuff_v6.asm
10671+++ b/vp8/decoder/arm/armv6/dboolhuff_v6.asm
10672@@ -1,10 +1,11 @@
10673 ;
10674 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10675 ;
10676-; Use of this source code is governed by a BSD-style license and patent
10677-; grant that can be found in the LICENSE file in the root of the source
10678-; tree. All contributing project authors may be found in the AUTHORS
10679-; file in the root of the source tree.
10680+; Use of this source code is governed by a BSD-style license
10681+; that can be found in the LICENSE file in the root of the source
10682+; tree. An additional intellectual property rights grant can be found
10683+; in the file PATENTS. All contributing project authors may
10684+; be found in the AUTHORS file in the root of the source tree.
10685 ;
10686
10687
10688diff --git a/vp8/decoder/arm/armv6/dequantdcidct_v6.asm b/vp8/decoder/arm/armv6/dequantdcidct_v6.asm
10689index 3daa9b3..c5b0b7b 100644
10690--- a/vp8/decoder/arm/armv6/dequantdcidct_v6.asm
10691+++ b/vp8/decoder/arm/armv6/dequantdcidct_v6.asm
10692@@ -1,10 +1,11 @@
10693 ;
10694 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10695 ;
10696-; Use of this source code is governed by a BSD-style license and patent
10697-; grant that can be found in the LICENSE file in the root of the source
10698-; tree. All contributing project authors may be found in the AUTHORS
10699-; file in the root of the source tree.
10700+; Use of this source code is governed by a BSD-style license
10701+; that can be found in the LICENSE file in the root of the source
10702+; tree. An additional intellectual property rights grant can be found
10703+; in the file PATENTS. All contributing project authors may
10704+; be found in the AUTHORS file in the root of the source tree.
10705 ;
10706
10707
10708diff --git a/vp8/decoder/arm/armv6/dequantidct_v6.asm b/vp8/decoder/arm/armv6/dequantidct_v6.asm
10709index 61bb48d..0d1c6b4 100644
10710--- a/vp8/decoder/arm/armv6/dequantidct_v6.asm
10711+++ b/vp8/decoder/arm/armv6/dequantidct_v6.asm
10712@@ -1,10 +1,11 @@
10713 ;
10714 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10715 ;
10716-; Use of this source code is governed by a BSD-style license and patent
10717-; grant that can be found in the LICENSE file in the root of the source
10718-; tree. All contributing project authors may be found in the AUTHORS
10719-; file in the root of the source tree.
10720+; Use of this source code is governed by a BSD-style license
10721+; that can be found in the LICENSE file in the root of the source
10722+; tree. An additional intellectual property rights grant can be found
10723+; in the file PATENTS. All contributing project authors may
10724+; be found in the AUTHORS file in the root of the source tree.
10725 ;
10726
10727
10728diff --git a/vp8/decoder/arm/armv6/dequantize_v6.asm b/vp8/decoder/arm/armv6/dequantize_v6.asm
10729index 95e3859..c35e7c6 100644
10730--- a/vp8/decoder/arm/armv6/dequantize_v6.asm
10731+++ b/vp8/decoder/arm/armv6/dequantize_v6.asm
10732@@ -1,10 +1,11 @@
10733 ;
10734 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10735 ;
10736-; Use of this source code is governed by a BSD-style license and patent
10737-; grant that can be found in the LICENSE file in the root of the source
10738-; tree. All contributing project authors may be found in the AUTHORS
10739-; file in the root of the source tree.
10740+; Use of this source code is governed by a BSD-style license
10741+; that can be found in the LICENSE file in the root of the source
10742+; tree. An additional intellectual property rights grant can be found
10743+; in the file PATENTS. All contributing project authors may
10744+; be found in the AUTHORS file in the root of the source tree.
10745 ;
10746
10747
10748diff --git a/vp8/decoder/arm/dequantize_arm.c b/vp8/decoder/arm/dequantize_arm.c
10749index 54006a9..913267d 100644
10750--- a/vp8/decoder/arm/dequantize_arm.c
10751+++ b/vp8/decoder/arm/dequantize_arm.c
10752@@ -1,10 +1,11 @@
10753 /*
10754 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10755 *
10756- * Use of this source code is governed by a BSD-style license and patent
10757- * grant that can be found in the LICENSE file in the root of the source
10758- * tree. All contributing project authors may be found in the AUTHORS
10759- * file in the root of the source tree.
10760+ * Use of this source code is governed by a BSD-style license
10761+ * that can be found in the LICENSE file in the root of the source
10762+ * tree. An additional intellectual property rights grant can be found
10763+ * in the file PATENTS. All contributing project authors may
10764+ * be found in the AUTHORS file in the root of the source tree.
10765 */
10766
10767
10768diff --git a/vp8/decoder/arm/dequantize_arm.h b/vp8/decoder/arm/dequantize_arm.h
10769index c8a61a4..ae7cf8e 100644
10770--- a/vp8/decoder/arm/dequantize_arm.h
10771+++ b/vp8/decoder/arm/dequantize_arm.h
10772@@ -1,10 +1,11 @@
10773 /*
10774 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10775 *
10776- * Use of this source code is governed by a BSD-style license and patent
10777- * grant that can be found in the LICENSE file in the root of the source
10778- * tree. All contributing project authors may be found in the AUTHORS
10779- * file in the root of the source tree.
10780+ * Use of this source code is governed by a BSD-style license
10781+ * that can be found in the LICENSE file in the root of the source
10782+ * tree. An additional intellectual property rights grant can be found
10783+ * in the file PATENTS. All contributing project authors may
10784+ * be found in the AUTHORS file in the root of the source tree.
10785 */
10786
10787
10788diff --git a/vp8/decoder/arm/detokenizearm_sjl.c b/vp8/decoder/arm/detokenizearm_sjl.c
10789index c714452..a126a05 100644
10790--- a/vp8/decoder/arm/detokenizearm_sjl.c
10791+++ b/vp8/decoder/arm/detokenizearm_sjl.c
10792@@ -1,10 +1,11 @@
10793 /*
10794 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10795 *
10796- * Use of this source code is governed by a BSD-style license and patent
10797- * grant that can be found in the LICENSE file in the root of the source
10798- * tree. All contributing project authors may be found in the AUTHORS
10799- * file in the root of the source tree.
10800+ * Use of this source code is governed by a BSD-style license
10801+ * that can be found in the LICENSE file in the root of the source
10802+ * tree. An additional intellectual property rights grant can be found
10803+ * in the file PATENTS. All contributing project authors may
10804+ * be found in the AUTHORS file in the root of the source tree.
10805 */
10806
10807
10808diff --git a/vp8/decoder/arm/detokenizearm_v6.asm b/vp8/decoder/arm/detokenizearm_v6.asm
10809index 4d87ee5..439c9ab 100644
10810--- a/vp8/decoder/arm/detokenizearm_v6.asm
10811+++ b/vp8/decoder/arm/detokenizearm_v6.asm
10812@@ -1,10 +1,11 @@
10813 ;
10814 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10815 ;
10816-; Use of this source code is governed by a BSD-style license and patent
10817-; grant that can be found in the LICENSE file in the root of the source
10818-; tree. All contributing project authors may be found in the AUTHORS
10819-; file in the root of the source tree.
10820+; Use of this source code is governed by a BSD-style license
10821+; that can be found in the LICENSE file in the root of the source
10822+; tree. An additional intellectual property rights grant can be found
10823+; in the file PATENTS. All contributing project authors may
10824+; be found in the AUTHORS file in the root of the source tree.
10825 ;
10826
10827
10828diff --git a/vp8/decoder/arm/dsystemdependent.c b/vp8/decoder/arm/dsystemdependent.c
10829index 455c83a..f146d60 100644
10830--- a/vp8/decoder/arm/dsystemdependent.c
10831+++ b/vp8/decoder/arm/dsystemdependent.c
10832@@ -1,10 +1,11 @@
10833 /*
10834 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10835 *
10836- * Use of this source code is governed by a BSD-style license and patent
10837- * grant that can be found in the LICENSE file in the root of the source
10838- * tree. All contributing project authors may be found in the AUTHORS
10839- * file in the root of the source tree.
10840+ * Use of this source code is governed by a BSD-style license
10841+ * that can be found in the LICENSE file in the root of the source
10842+ * tree. An additional intellectual property rights grant can be found
10843+ * in the file PATENTS. All contributing project authors may
10844+ * be found in the AUTHORS file in the root of the source tree.
10845 */
10846
10847
10848diff --git a/vp8/decoder/arm/neon/dboolhuff_neon.asm b/vp8/decoder/arm/neon/dboolhuff_neon.asm
10849index 7ec62a3..01315a4 100644
10850--- a/vp8/decoder/arm/neon/dboolhuff_neon.asm
10851+++ b/vp8/decoder/arm/neon/dboolhuff_neon.asm
10852@@ -1,10 +1,11 @@
10853 ;
10854 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10855 ;
10856-; Use of this source code is governed by a BSD-style license and patent
10857-; grant that can be found in the LICENSE file in the root of the source
10858-; tree. All contributing project authors may be found in the AUTHORS
10859-; file in the root of the source tree.
10860+; Use of this source code is governed by a BSD-style license
10861+; that can be found in the LICENSE file in the root of the source
10862+; tree. An additional intellectual property rights grant can be found
10863+; in the file PATENTS. All contributing project authors may
10864+; be found in the AUTHORS file in the root of the source tree.
10865 ;
10866
10867
10868diff --git a/vp8/decoder/arm/neon/dequantdcidct_neon.asm b/vp8/decoder/arm/neon/dequantdcidct_neon.asm
10869index 3392f2c..482f02d 100644
10870--- a/vp8/decoder/arm/neon/dequantdcidct_neon.asm
10871+++ b/vp8/decoder/arm/neon/dequantdcidct_neon.asm
10872@@ -1,10 +1,11 @@
10873 ;
10874 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10875 ;
10876-; Use of this source code is governed by a BSD-style license and patent
10877-; grant that can be found in the LICENSE file in the root of the source
10878-; tree. All contributing project authors may be found in the AUTHORS
10879-; file in the root of the source tree.
10880+; Use of this source code is governed by a BSD-style license
10881+; that can be found in the LICENSE file in the root of the source
10882+; tree. An additional intellectual property rights grant can be found
10883+; in the file PATENTS. All contributing project authors may
10884+; be found in the AUTHORS file in the root of the source tree.
10885 ;
10886
10887
10888diff --git a/vp8/decoder/arm/neon/dequantidct_neon.asm b/vp8/decoder/arm/neon/dequantidct_neon.asm
10889index bba4d5d..3d00dbf 100644
10890--- a/vp8/decoder/arm/neon/dequantidct_neon.asm
10891+++ b/vp8/decoder/arm/neon/dequantidct_neon.asm
10892@@ -1,10 +1,11 @@
10893 ;
10894 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10895 ;
10896-; Use of this source code is governed by a BSD-style license and patent
10897-; grant that can be found in the LICENSE file in the root of the source
10898-; tree. All contributing project authors may be found in the AUTHORS
10899-; file in the root of the source tree.
10900+; Use of this source code is governed by a BSD-style license
10901+; that can be found in the LICENSE file in the root of the source
10902+; tree. An additional intellectual property rights grant can be found
10903+; in the file PATENTS. All contributing project authors may
10904+; be found in the AUTHORS file in the root of the source tree.
10905 ;
10906
10907
10908diff --git a/vp8/decoder/arm/neon/dequantizeb_neon.asm b/vp8/decoder/arm/neon/dequantizeb_neon.asm
10909index 1bde946..14698f8 100644
10910--- a/vp8/decoder/arm/neon/dequantizeb_neon.asm
10911+++ b/vp8/decoder/arm/neon/dequantizeb_neon.asm
10912@@ -1,10 +1,11 @@
10913 ;
10914 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10915 ;
10916-; Use of this source code is governed by a BSD-style license and patent
10917-; grant that can be found in the LICENSE file in the root of the source
10918-; tree. All contributing project authors may be found in the AUTHORS
10919-; file in the root of the source tree.
10920+; Use of this source code is governed by a BSD-style license
10921+; that can be found in the LICENSE file in the root of the source
10922+; tree. An additional intellectual property rights grant can be found
10923+; in the file PATENTS. All contributing project authors may
10924+; be found in the AUTHORS file in the root of the source tree.
10925 ;
10926
10927
10928diff --git a/vp8/decoder/dboolhuff.c b/vp8/decoder/dboolhuff.c
10929index 442054e..7027c0f 100644
10930--- a/vp8/decoder/dboolhuff.c
10931+++ b/vp8/decoder/dboolhuff.c
10932@@ -1,10 +1,11 @@
10933 /*
10934 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10935 *
10936- * Use of this source code is governed by a BSD-style license and patent
10937- * grant that can be found in the LICENSE file in the root of the source
10938- * tree. All contributing project authors may be found in the AUTHORS
10939- * file in the root of the source tree.
10940+ * Use of this source code is governed by a BSD-style license
10941+ * that can be found in the LICENSE file in the root of the source
10942+ * tree. An additional intellectual property rights grant can be found
10943+ * in the file PATENTS. All contributing project authors may
10944+ * be found in the AUTHORS file in the root of the source tree.
10945 */
10946
10947
10948diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
10949index f5c9822..c6d69e7 100644
10950--- a/vp8/decoder/dboolhuff.h
10951+++ b/vp8/decoder/dboolhuff.h
10952@@ -1,10 +1,11 @@
10953 /*
10954 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10955 *
10956- * Use of this source code is governed by a BSD-style license and patent
10957- * grant that can be found in the LICENSE file in the root of the source
10958- * tree. All contributing project authors may be found in the AUTHORS
10959- * file in the root of the source tree.
10960+ * Use of this source code is governed by a BSD-style license
10961+ * that can be found in the LICENSE file in the root of the source
10962+ * tree. An additional intellectual property rights grant can be found
10963+ * in the file PATENTS. All contributing project authors may
10964+ * be found in the AUTHORS file in the root of the source tree.
10965 */
10966
10967
10968@@ -12,7 +13,7 @@
10969 #define DBOOLHUFF_H
10970 #include "vpx_ports/config.h"
10971 #include "vpx_ports/mem.h"
10972-#include "vpx_ports/vpx_integer.h"
10973+#include "vpx/vpx_integer.h"
10974
10975 /* Size of the bool decoder backing storage
10976 *
10977diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
10978index 6035f3e..7e00423 100644
10979--- a/vp8/decoder/decodemv.c
10980+++ b/vp8/decoder/decodemv.c
10981@@ -1,10 +1,11 @@
10982 /*
10983 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
10984 *
10985- * Use of this source code is governed by a BSD-style license and patent
10986- * grant that can be found in the LICENSE file in the root of the source
10987- * tree. All contributing project authors may be found in the AUTHORS
10988- * file in the root of the source tree.
10989+ * Use of this source code is governed by a BSD-style license
10990+ * that can be found in the LICENSE file in the root of the source
10991+ * tree. An additional intellectual property rights grant can be found
10992+ * in the file PATENTS. All contributing project authors may
10993+ * be found in the AUTHORS file in the root of the source tree.
10994 */
10995
10996
10997@@ -170,6 +171,7 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
10998 VP8_COMMON *const pc = &pbi->common;
10999 MACROBLOCKD *xd = &pbi->mb;
11000
11001+ mbmi->need_to_clamp_mvs = 0;
11002 vp8dx_bool_decoder_fill(bc);
11003
11004 // Distance of Mb to the various image edges.
11005@@ -268,6 +270,17 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
11006 break;
11007 }
11008
11009+ if (mv->col < xd->mb_to_left_edge
11010+ - LEFT_TOP_MARGIN
11011+ || mv->col > xd->mb_to_right_edge
11012+ + RIGHT_BOTTOM_MARGIN
11013+ || mv->row < xd->mb_to_top_edge
11014+ - LEFT_TOP_MARGIN
11015+ || mv->row > xd->mb_to_bottom_edge
11016+ + RIGHT_BOTTOM_MARGIN
11017+ )
11018+ mbmi->need_to_clamp_mvs = 1;
11019+
11020 /* Fill (uniform) modes, mvs of jth subset.
11021 Must do it here because ensuing subsets can
11022 refer back to us via "left" or "above". */
11023@@ -324,27 +337,18 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
11024 read_mv(bc, mv, (const MV_CONTEXT *) mvc);
11025 mv->row += best_mv.row;
11026 mv->col += best_mv.col;
11027- /* Encoder should not produce invalid motion vectors, but since
11028- * arbitrary length MVs can be parsed from the bitstream, we
11029- * need to clamp them here in case we're reading bad data to
11030- * avoid a crash.
11031- */
11032-#if CONFIG_DEBUG
11033- assert(mv->col >= (xd->mb_to_left_edge - LEFT_TOP_MARGIN));
11034- assert(mv->col <= (xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN));
11035- assert(mv->row >= (xd->mb_to_top_edge - LEFT_TOP_MARGIN));
11036- assert(mv->row <= (xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN));
11037-#endif
11038
11039- if (mv->col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
11040- mv->col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
11041- else if (mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
11042- mv->col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
11043-
11044- if (mv->row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
11045- mv->row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
11046- else if (mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
11047- mv->row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
11048+ /* Don't need to check this on NEARMV and NEARESTMV modes
11049+ * since those modes clamp the MV. The NEWMV mode does not,
11050+ * so signal to the prediction stage whether special
11051+ * handling may be required.
11052+ */
11053+ if (mv->col < xd->mb_to_left_edge - LEFT_TOP_MARGIN
11054+ || mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN
11055+ || mv->row < xd->mb_to_top_edge - LEFT_TOP_MARGIN
11056+ || mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN
11057+ )
11058+ mbmi->need_to_clamp_mvs = 1;
11059
11060 propagate_mv: /* same MV throughout */
11061 {
11062@@ -380,7 +384,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
11063 assert(0);
11064 #endif
11065 }
11066-
11067 }
11068 else
11069 {
11070diff --git a/vp8/decoder/decodemv.h b/vp8/decoder/decodemv.h
11071index 4030071..8b7fb68 100644
11072--- a/vp8/decoder/decodemv.h
11073+++ b/vp8/decoder/decodemv.h
11074@@ -1,10 +1,11 @@
11075 /*
11076 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11077 *
11078- * Use of this source code is governed by a BSD-style license and patent
11079- * grant that can be found in the LICENSE file in the root of the source
11080- * tree. All contributing project authors may be found in the AUTHORS
11081- * file in the root of the source tree.
11082+ * Use of this source code is governed by a BSD-style license
11083+ * that can be found in the LICENSE file in the root of the source
11084+ * tree. An additional intellectual property rights grant can be found
11085+ * in the file PATENTS. All contributing project authors may
11086+ * be found in the AUTHORS file in the root of the source tree.
11087 */
11088
11089
11090diff --git a/vp8/decoder/decoderthreading.h b/vp8/decoder/decoderthreading.h
11091index ebc5c27..6c0363b 100644
11092--- a/vp8/decoder/decoderthreading.h
11093+++ b/vp8/decoder/decoderthreading.h
11094@@ -1,10 +1,11 @@
11095 /*
11096 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11097 *
11098- * Use of this source code is governed by a BSD-style license and patent
11099- * grant that can be found in the LICENSE file in the root of the source
11100- * tree. All contributing project authors may be found in the AUTHORS
11101- * file in the root of the source tree.
11102+ * Use of this source code is governed by a BSD-style license
11103+ * that can be found in the LICENSE file in the root of the source
11104+ * tree. An additional intellectual property rights grant can be found
11105+ * in the file PATENTS. All contributing project authors may
11106+ * be found in the AUTHORS file in the root of the source tree.
11107 */
11108
11109
11110diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
11111index 4edf4f6..0f1b879 100644
11112--- a/vp8/decoder/decodframe.c
11113+++ b/vp8/decoder/decodframe.c
11114@@ -1,10 +1,11 @@
11115 /*
11116 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11117 *
11118- * Use of this source code is governed by a BSD-style license and patent
11119- * grant that can be found in the LICENSE file in the root of the source
11120- * tree. All contributing project authors may be found in the AUTHORS
11121- * file in the root of the source tree.
11122+ * Use of this source code is governed by a BSD-style license
11123+ * that can be found in the LICENSE file in the root of the source
11124+ * tree. An additional intellectual property rights grant can be found
11125+ * in the file PATENTS. All contributing project authors may
11126+ * be found in the AUTHORS file in the root of the source tree.
11127 */
11128
11129
11130@@ -125,6 +126,62 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
11131 }
11132 }
11133
11134+
11135+static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
11136+{
11137+ /* If the MV points so far into the UMV border that no visible pixels
11138+ * are used for reconstruction, the subpel part of the MV can be
11139+ * discarded and the MV limited to 16 pixels with equivalent results.
11140+ *
11141+ * This limit kicks in at 19 pixels for the top and left edges, for
11142+ * the 16 pixels plus 3 taps right of the central pixel when subpel
11143+ * filtering. The bottom and right edges use 16 pixels plus 2 pixels
11144+ * left of the central pixel when filtering.
11145+ */
11146+ if (mv->col < (xd->mb_to_left_edge - (19 << 3)))
11147+ mv->col = xd->mb_to_left_edge - (16 << 3);
11148+ else if (mv->col > xd->mb_to_right_edge + (18 << 3))
11149+ mv->col = xd->mb_to_right_edge + (16 << 3);
11150+
11151+ if (mv->row < (xd->mb_to_top_edge - (19 << 3)))
11152+ mv->row = xd->mb_to_top_edge - (16 << 3);
11153+ else if (mv->row > xd->mb_to_bottom_edge + (18 << 3))
11154+ mv->row = xd->mb_to_bottom_edge + (16 << 3);
11155+}
11156+
11157+/* A version of the above function for chroma block MVs.*/
11158+static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
11159+{
11160+ if (2*mv->col < (xd->mb_to_left_edge - (19 << 3)))
11161+ mv->col = (xd->mb_to_left_edge - (16 << 3)) >> 1;
11162+ else if (2*mv->col > xd->mb_to_right_edge + (18 << 3))
11163+ mv->col = (xd->mb_to_right_edge + (16 << 3)) >> 1;
11164+
11165+ if (2*mv->row < (xd->mb_to_top_edge - (19 << 3)))
11166+ mv->row = (xd->mb_to_top_edge - (16 << 3)) >> 1;
11167+ else if (2*mv->row > xd->mb_to_bottom_edge + (18 << 3))
11168+ mv->row = (xd->mb_to_bottom_edge + (16 << 3)) >> 1;
11169+}
11170+
11171+static void clamp_mvs(MACROBLOCKD *xd)
11172+{
11173+ if (xd->mbmi.mode == SPLITMV)
11174+ {
11175+ int i;
11176+
11177+ for (i=0; i<16; i++)
11178+ clamp_mv_to_umv_border(&xd->block[i].bmi.mv.as_mv, xd);
11179+ for (i=16; i<24; i++)
11180+ clamp_uvmv_to_umv_border(&xd->block[i].bmi.mv.as_mv, xd);
11181+ }
11182+ else
11183+ {
11184+ clamp_mv_to_umv_border(&xd->mbmi.mv.as_mv, xd);
11185+ clamp_uvmv_to_umv_border(&xd->block[16].bmi.mv.as_mv, xd);
11186+ }
11187+
11188+}
11189+
11190 static void reconstruct_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
11191 {
11192 if (xd->frame_type == KEY_FRAME || xd->mbmi.ref_frame == INTRA_FRAME)
11193@@ -232,6 +289,8 @@ static void de_quantand_idct(VP8D_COMP *pbi, MACROBLOCKD *xd)
11194 void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
11195 {
11196 int eobtotal = 0;
11197+ MV orig_mvs[24];
11198+ int i, do_clamp = xd->mbmi.need_to_clamp_mvs;
11199
11200 if (xd->mbmi.mb_skip_coeff)
11201 {
11202@@ -242,20 +301,49 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
11203 eobtotal = vp8_decode_mb_tokens(pbi, xd);
11204 }
11205
11206+ /* Perform temporary clamping of the MV to be used for prediction */
11207+ if (do_clamp)
11208+ {
11209+ if (xd->mbmi.mode == SPLITMV)
11210+ for (i=0; i<24; i++)
11211+ orig_mvs[i] = xd->block[i].bmi.mv.as_mv;
11212+ else
11213+ {
11214+ orig_mvs[0] = xd->mbmi.mv.as_mv;
11215+ orig_mvs[1] = xd->block[16].bmi.mv.as_mv;
11216+ }
11217+ clamp_mvs(xd);
11218+ }
11219+
11220 xd->mode_info_context->mbmi.dc_diff = 1;
11221
11222 if (xd->mbmi.mode != B_PRED && xd->mbmi.mode != SPLITMV && eobtotal == 0)
11223 {
11224 xd->mode_info_context->mbmi.dc_diff = 0;
11225 skip_recon_mb(pbi, xd);
11226- return;
11227 }
11228+ else
11229+ {
11230+ if (xd->segmentation_enabled)
11231+ mb_init_dequantizer(pbi, xd);
11232
11233- if (xd->segmentation_enabled)
11234- mb_init_dequantizer(pbi, xd);
11235+ de_quantand_idct(pbi, xd);
11236+ reconstruct_mb(pbi, xd);
11237+ }
11238
11239- de_quantand_idct(pbi, xd);
11240- reconstruct_mb(pbi, xd);
11241+
11242+ /* Restore the original MV so as not to affect the entropy context. */
11243+ if (do_clamp)
11244+ {
11245+ if (xd->mbmi.mode == SPLITMV)
11246+ for (i=0; i<24; i++)
11247+ xd->block[i].bmi.mv.as_mv = orig_mvs[i];
11248+ else
11249+ {
11250+ xd->mbmi.mv.as_mv = orig_mvs[0];
11251+ xd->block[16].bmi.mv.as_mv = orig_mvs[1];
11252+ }
11253+ }
11254 }
11255
11256 static int get_delta_q(vp8_reader *bc, int prev, int *q_update)
11257@@ -313,7 +401,9 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
11258 for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
11259 {
11260 // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
11261- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi, 32); //sizeof(MB_MODE_INFO) );
11262+ // the partition_bmi array is unused in the decoder, so don't copy it.
11263+ vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
11264+ sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
11265
11266 if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
11267 {
11268@@ -360,7 +450,7 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
11269 vp8_build_uvmvs(xd, pc->full_pixel);
11270
11271 /*
11272- if(pbi->common.current_video_frame==0 &&mb_col==1 && mb_row==0)
11273+ if(pc->current_video_frame==0 &&mb_col==1 && mb_row==0)
11274 pbi->debugoutput =1;
11275 else
11276 pbi->debugoutput =0;
11277@@ -609,7 +699,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
11278 "Invalid frame height");
11279 }
11280
11281- if (vp8_alloc_frame_buffers(&pbi->common, pc->Width, pc->Height))
11282+ if (vp8_alloc_frame_buffers(pc, pc->Width, pc->Height))
11283 vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
11284 "Failed to allocate frame buffers");
11285 }
11286@@ -846,17 +936,17 @@ int vp8_decode_frame(VP8D_COMP *pbi)
11287 vpx_memcpy(&xd->block[0].bmi, &xd->mode_info_context->bmi[0], sizeof(B_MODE_INFO));
11288
11289
11290- if (pbi->b_multithreaded_lf && pbi->common.filter_level != 0)
11291+ if (pbi->b_multithreaded_lf && pc->filter_level != 0)
11292 vp8_start_lfthread(pbi);
11293
11294- if (pbi->b_multithreaded_rd && pbi->common.multi_token_partition != ONE_PARTITION)
11295+ if (pbi->b_multithreaded_rd && pc->multi_token_partition != ONE_PARTITION)
11296 {
11297 vp8_mtdecode_mb_rows(pbi, xd);
11298 }
11299 else
11300 {
11301 int ibc = 0;
11302- int num_part = 1 << pbi->common.multi_token_partition;
11303+ int num_part = 1 << pc->multi_token_partition;
11304
11305 // Decode the individual macro block
11306 for (mb_row = 0; mb_row < pc->mb_rows; mb_row++)
11307@@ -885,8 +975,11 @@ int vp8_decode_frame(VP8D_COMP *pbi)
11308 // vpx_log("Decoder: Frame Decoded, Size Roughly:%d bytes \n",bc->pos+pbi->bc2.pos);
11309
11310 // If this was a kf or Gf note the Q used
11311- if ((pc->frame_type == KEY_FRAME) || (pc->refresh_golden_frame) || pbi->common.refresh_alt_ref_frame)
11312+ if ((pc->frame_type == KEY_FRAME) ||
11313+ pc->refresh_golden_frame || pc->refresh_alt_ref_frame)
11314+ {
11315 pc->last_kf_gf_q = pc->base_qindex;
11316+ }
11317
11318 if (pc->refresh_entropy_probs == 0)
11319 {
11320diff --git a/vp8/decoder/demode.c b/vp8/decoder/demode.c
11321index fd05e6d..881b49e 100644
11322--- a/vp8/decoder/demode.c
11323+++ b/vp8/decoder/demode.c
11324@@ -1,10 +1,11 @@
11325 /*
11326 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11327 *
11328- * Use of this source code is governed by a BSD-style license and patent
11329- * grant that can be found in the LICENSE file in the root of the source
11330- * tree. All contributing project authors may be found in the AUTHORS
11331- * file in the root of the source tree.
11332+ * Use of this source code is governed by a BSD-style license
11333+ * that can be found in the LICENSE file in the root of the source
11334+ * tree. An additional intellectual property rights grant can be found
11335+ * in the file PATENTS. All contributing project authors may
11336+ * be found in the AUTHORS file in the root of the source tree.
11337 */
11338
11339
11340diff --git a/vp8/decoder/demode.h b/vp8/decoder/demode.h
11341index 51bbc5e..8d2fbee 100644
11342--- a/vp8/decoder/demode.h
11343+++ b/vp8/decoder/demode.h
11344@@ -1,10 +1,11 @@
11345 /*
11346 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11347 *
11348- * Use of this source code is governed by a BSD-style license and patent
11349- * grant that can be found in the LICENSE file in the root of the source
11350- * tree. All contributing project authors may be found in the AUTHORS
11351- * file in the root of the source tree.
11352+ * Use of this source code is governed by a BSD-style license
11353+ * that can be found in the LICENSE file in the root of the source
11354+ * tree. An additional intellectual property rights grant can be found
11355+ * in the file PATENTS. All contributing project authors may
11356+ * be found in the AUTHORS file in the root of the source tree.
11357 */
11358
11359
11360diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c
11361index 14798d9..2c286ec 100644
11362--- a/vp8/decoder/dequantize.c
11363+++ b/vp8/decoder/dequantize.c
11364@@ -1,10 +1,11 @@
11365 /*
11366 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11367 *
11368- * Use of this source code is governed by a BSD-style license and patent
11369- * grant that can be found in the LICENSE file in the root of the source
11370- * tree. All contributing project authors may be found in the AUTHORS
11371- * file in the root of the source tree.
11372+ * Use of this source code is governed by a BSD-style license
11373+ * that can be found in the LICENSE file in the root of the source
11374+ * tree. An additional intellectual property rights grant can be found
11375+ * in the file PATENTS. All contributing project authors may
11376+ * be found in the AUTHORS file in the root of the source tree.
11377 */
11378
11379
11380diff --git a/vp8/decoder/dequantize.h b/vp8/decoder/dequantize.h
11381index d16b02e..7fd7cbb 100644
11382--- a/vp8/decoder/dequantize.h
11383+++ b/vp8/decoder/dequantize.h
11384@@ -1,10 +1,11 @@
11385 /*
11386 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11387 *
11388- * Use of this source code is governed by a BSD-style license and patent
11389- * grant that can be found in the LICENSE file in the root of the source
11390- * tree. All contributing project authors may be found in the AUTHORS
11391- * file in the root of the source tree.
11392+ * Use of this source code is governed by a BSD-style license
11393+ * that can be found in the LICENSE file in the root of the source
11394+ * tree. An additional intellectual property rights grant can be found
11395+ * in the file PATENTS. All contributing project authors may
11396+ * be found in the AUTHORS file in the root of the source tree.
11397 */
11398
11399
11400diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
11401index a42f18d..d6f5ca2 100644
11402--- a/vp8/decoder/detokenize.c
11403+++ b/vp8/decoder/detokenize.c
11404@@ -1,10 +1,11 @@
11405 /*
11406 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11407 *
11408- * Use of this source code is governed by a BSD-style license and patent
11409- * grant that can be found in the LICENSE file in the root of the source
11410- * tree. All contributing project authors may be found in the AUTHORS
11411- * file in the root of the source tree.
11412+ * Use of this source code is governed by a BSD-style license
11413+ * that can be found in the LICENSE file in the root of the source
11414+ * tree. An additional intellectual property rights grant can be found
11415+ * in the file PATENTS. All contributing project authors may
11416+ * be found in the AUTHORS file in the root of the source tree.
11417 */
11418
11419
11420@@ -65,25 +66,43 @@ void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
11421
11422 ENTROPY_CONTEXT *a;
11423 ENTROPY_CONTEXT *l;
11424- int i;
11425-
11426- for (i = 0; i < 24; i++)
11427- {
11428-
11429- a = A[ vp8_block2context[i] ] + vp8_block2above[i];
11430- l = L[ vp8_block2context[i] ] + vp8_block2left[i];
11431-
11432- *a = *l = 0;
11433- }
11434
11435+ /* Clear entropy contexts for Y blocks */
11436+ a = A[Y1CONTEXT];
11437+ l = L[Y1CONTEXT];
11438+ *a = 0;
11439+ *(a+1) = 0;
11440+ *(a+2) = 0;
11441+ *(a+3) = 0;
11442+ *l = 0;
11443+ *(l+1) = 0;
11444+ *(l+2) = 0;
11445+ *(l+3) = 0;
11446+
11447+ /* Clear entropy contexts for U blocks */
11448+ a = A[UCONTEXT];
11449+ l = L[UCONTEXT];
11450+ *a = 0;
11451+ *(a+1) = 0;
11452+ *l = 0;
11453+ *(l+1) = 0;
11454+
11455+ /* Clear entropy contexts for V blocks */
11456+ a = A[VCONTEXT];
11457+ l = L[VCONTEXT];
11458+ *a = 0;
11459+ *(a+1) = 0;
11460+ *l = 0;
11461+ *(l+1) = 0;
11462+
11463+ /* Clear entropy contexts for Y2 blocks */
11464 if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
11465 {
11466- a = A[Y2CONTEXT] + vp8_block2above[24];
11467- l = L[Y2CONTEXT] + vp8_block2left[24];
11468- *a = *l = 0;
11469+ a = A[Y2CONTEXT];
11470+ l = L[Y2CONTEXT];
11471+ *a = 0;
11472+ *l = 0;
11473 }
11474-
11475-
11476 }
11477 DECLARE_ALIGNED(16, extern const unsigned int, vp8dx_bitreader_norm[256]);
11478 #define NORMALIZE \
11479diff --git a/vp8/decoder/detokenize.h b/vp8/decoder/detokenize.h
11480index 6a9a476..6cfb66b 100644
11481--- a/vp8/decoder/detokenize.h
11482+++ b/vp8/decoder/detokenize.h
11483@@ -1,10 +1,11 @@
11484 /*
11485 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11486 *
11487- * Use of this source code is governed by a BSD-style license and patent
11488- * grant that can be found in the LICENSE file in the root of the source
11489- * tree. All contributing project authors may be found in the AUTHORS
11490- * file in the root of the source tree.
11491+ * Use of this source code is governed by a BSD-style license
11492+ * that can be found in the LICENSE file in the root of the source
11493+ * tree. An additional intellectual property rights grant can be found
11494+ * in the file PATENTS. All contributing project authors may
11495+ * be found in the AUTHORS file in the root of the source tree.
11496 */
11497
11498
11499diff --git a/vp8/decoder/generic/dsystemdependent.c b/vp8/decoder/generic/dsystemdependent.c
11500index 302b64b..ad64a38 100644
11501--- a/vp8/decoder/generic/dsystemdependent.c
11502+++ b/vp8/decoder/generic/dsystemdependent.c
11503@@ -1,10 +1,11 @@
11504 /*
11505 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11506 *
11507- * Use of this source code is governed by a BSD-style license and patent
11508- * grant that can be found in the LICENSE file in the root of the source
11509- * tree. All contributing project authors may be found in the AUTHORS
11510- * file in the root of the source tree.
11511+ * Use of this source code is governed by a BSD-style license
11512+ * that can be found in the LICENSE file in the root of the source
11513+ * tree. An additional intellectual property rights grant can be found
11514+ * in the file PATENTS. All contributing project authors may
11515+ * be found in the AUTHORS file in the root of the source tree.
11516 */
11517
11518
11519diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
11520index 6875585..76387f5 100644
11521--- a/vp8/decoder/onyxd_if.c
11522+++ b/vp8/decoder/onyxd_if.c
11523@@ -1,10 +1,11 @@
11524 /*
11525 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11526 *
11527- * Use of this source code is governed by a BSD-style license and patent
11528- * grant that can be found in the LICENSE file in the root of the source
11529- * tree. All contributing project authors may be found in the AUTHORS
11530- * file in the root of the source tree.
11531+ * Use of this source code is governed by a BSD-style license
11532+ * that can be found in the LICENSE file in the root of the source
11533+ * tree. An additional intellectual property rights grant can be found
11534+ * in the file PATENTS. All contributing project authors may
11535+ * be found in the AUTHORS file in the root of the source tree.
11536 */
11537
11538
11539diff --git a/vp8/decoder/onyxd_if_sjl.c b/vp8/decoder/onyxd_if_sjl.c
11540index 363ad5d..12d28a5 100644
11541--- a/vp8/decoder/onyxd_if_sjl.c
11542+++ b/vp8/decoder/onyxd_if_sjl.c
11543@@ -1,10 +1,11 @@
11544 /*
11545 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11546 *
11547- * Use of this source code is governed by a BSD-style license and patent
11548- * grant that can be found in the LICENSE file in the root of the source
11549- * tree. All contributing project authors may be found in the AUTHORS
11550- * file in the root of the source tree.
11551+ * Use of this source code is governed by a BSD-style license
11552+ * that can be found in the LICENSE file in the root of the source
11553+ * tree. An additional intellectual property rights grant can be found
11554+ * in the file PATENTS. All contributing project authors may
11555+ * be found in the AUTHORS file in the root of the source tree.
11556 */
11557
11558
11559diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
11560index fa4fa48..2eea614 100644
11561--- a/vp8/decoder/onyxd_int.h
11562+++ b/vp8/decoder/onyxd_int.h
11563@@ -1,10 +1,11 @@
11564 /*
11565 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11566 *
11567- * Use of this source code is governed by a BSD-style license and patent
11568- * grant that can be found in the LICENSE file in the root of the source
11569- * tree. All contributing project authors may be found in the AUTHORS
11570- * file in the root of the source tree.
11571+ * Use of this source code is governed by a BSD-style license
11572+ * that can be found in the LICENSE file in the root of the source
11573+ * tree. An additional intellectual property rights grant can be found
11574+ * in the file PATENTS. All contributing project authors may
11575+ * be found in the AUTHORS file in the root of the source tree.
11576 */
11577
11578
11579diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c
11580index e35d175..87bba20 100644
11581--- a/vp8/decoder/threading.c
11582+++ b/vp8/decoder/threading.c
11583@@ -1,10 +1,11 @@
11584 /*
11585 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11586 *
11587- * Use of this source code is governed by a BSD-style license and patent
11588- * grant that can be found in the LICENSE file in the root of the source
11589- * tree. All contributing project authors may be found in the AUTHORS
11590- * file in the root of the source tree.
11591+ * Use of this source code is governed by a BSD-style license
11592+ * that can be found in the LICENSE file in the root of the source
11593+ * tree. An additional intellectual property rights grant can be found
11594+ * in the file PATENTS. All contributing project authors may
11595+ * be found in the AUTHORS file in the root of the source tree.
11596 */
11597
11598
11599@@ -153,7 +154,9 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
11600 }
11601
11602 // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
11603- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi, 32); //sizeof(MB_MODE_INFO) );
11604+ // the partition_bmi array is unused in the decoder, so don't copy it.
11605+ vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
11606+ sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
11607
11608 if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
11609 {
11610diff --git a/vp8/decoder/treereader.h b/vp8/decoder/treereader.h
11611index eb10e24..f1893df 100644
11612--- a/vp8/decoder/treereader.h
11613+++ b/vp8/decoder/treereader.h
11614@@ -1,10 +1,11 @@
11615 /*
11616 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11617 *
11618- * Use of this source code is governed by a BSD-style license and patent
11619- * grant that can be found in the LICENSE file in the root of the source
11620- * tree. All contributing project authors may be found in the AUTHORS
11621- * file in the root of the source tree.
11622+ * Use of this source code is governed by a BSD-style license
11623+ * that can be found in the LICENSE file in the root of the source
11624+ * tree. An additional intellectual property rights grant can be found
11625+ * in the file PATENTS. All contributing project authors may
11626+ * be found in the AUTHORS file in the root of the source tree.
11627 */
11628
11629
11630diff --git a/vp8/decoder/x86/dequantize_mmx.asm b/vp8/decoder/x86/dequantize_mmx.asm
11631index 02be487..1611e03 100644
11632--- a/vp8/decoder/x86/dequantize_mmx.asm
11633+++ b/vp8/decoder/x86/dequantize_mmx.asm
11634@@ -1,10 +1,11 @@
11635 ;
11636 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11637 ;
11638-; Use of this source code is governed by a BSD-style license and patent
11639-; grant that can be found in the LICENSE file in the root of the source
11640-; tree. All contributing project authors may be found in the AUTHORS
11641-; file in the root of the source tree.
11642+; Use of this source code is governed by a BSD-style license
11643+; that can be found in the LICENSE file in the root of the source
11644+; tree. An additional intellectual property rights grant can be found
11645+; in the file PATENTS. All contributing project authors may
11646+; be found in the AUTHORS file in the root of the source tree.
11647 ;
11648
11649
11650diff --git a/vp8/decoder/x86/dequantize_x86.h b/vp8/decoder/x86/dequantize_x86.h
11651index 5def406..4c91633 100644
11652--- a/vp8/decoder/x86/dequantize_x86.h
11653+++ b/vp8/decoder/x86/dequantize_x86.h
11654@@ -1,10 +1,11 @@
11655 /*
11656 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11657 *
11658- * Use of this source code is governed by a BSD-style license and patent
11659- * grant that can be found in the LICENSE file in the root of the source
11660- * tree. All contributing project authors may be found in the AUTHORS
11661- * file in the root of the source tree.
11662+ * Use of this source code is governed by a BSD-style license
11663+ * that can be found in the LICENSE file in the root of the source
11664+ * tree. An additional intellectual property rights grant can be found
11665+ * in the file PATENTS. All contributing project authors may
11666+ * be found in the AUTHORS file in the root of the source tree.
11667 */
11668
11669
11670diff --git a/vp8/decoder/x86/onyxdxv.c b/vp8/decoder/x86/onyxdxv.c
11671index 75a676a..22d0548 100644
11672--- a/vp8/decoder/x86/onyxdxv.c
11673+++ b/vp8/decoder/x86/onyxdxv.c
11674@@ -1,10 +1,11 @@
11675 /*
11676 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11677 *
11678- * Use of this source code is governed by a BSD-style license and patent
11679- * grant that can be found in the LICENSE file in the root of the source
11680- * tree. All contributing project authors may be found in the AUTHORS
11681- * file in the root of the source tree.
11682+ * Use of this source code is governed by a BSD-style license
11683+ * that can be found in the LICENSE file in the root of the source
11684+ * tree. An additional intellectual property rights grant can be found
11685+ * in the file PATENTS. All contributing project authors may
11686+ * be found in the AUTHORS file in the root of the source tree.
11687 */
11688
11689
11690diff --git a/vp8/decoder/x86/x86_dsystemdependent.c b/vp8/decoder/x86/x86_dsystemdependent.c
11691index 6d7cc36..2dfb469 100644
11692--- a/vp8/decoder/x86/x86_dsystemdependent.c
11693+++ b/vp8/decoder/x86/x86_dsystemdependent.c
11694@@ -1,10 +1,11 @@
11695 /*
11696 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11697 *
11698- * Use of this source code is governed by a BSD-style license and patent
11699- * grant that can be found in the LICENSE file in the root of the source
11700- * tree. All contributing project authors may be found in the AUTHORS
11701- * file in the root of the source tree.
11702+ * Use of this source code is governed by a BSD-style license
11703+ * that can be found in the LICENSE file in the root of the source
11704+ * tree. An additional intellectual property rights grant can be found
11705+ * in the file PATENTS. All contributing project authors may
11706+ * be found in the AUTHORS file in the root of the source tree.
11707 */
11708
11709
11710diff --git a/vp8/decoder/xprintf.c b/vp8/decoder/xprintf.c
11711index cb2221c..7465010 100644
11712--- a/vp8/decoder/xprintf.c
11713+++ b/vp8/decoder/xprintf.c
11714@@ -1,10 +1,11 @@
11715 /*
11716 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11717 *
11718- * Use of this source code is governed by a BSD-style license and patent
11719- * grant that can be found in the LICENSE file in the root of the source
11720- * tree. All contributing project authors may be found in the AUTHORS
11721- * file in the root of the source tree.
11722+ * Use of this source code is governed by a BSD-style license
11723+ * that can be found in the LICENSE file in the root of the source
11724+ * tree. An additional intellectual property rights grant can be found
11725+ * in the file PATENTS. All contributing project authors may
11726+ * be found in the AUTHORS file in the root of the source tree.
11727 */
11728
11729
11730diff --git a/vp8/decoder/xprintf.h b/vp8/decoder/xprintf.h
11731index 2f175e9..7656075 100644
11732--- a/vp8/decoder/xprintf.h
11733+++ b/vp8/decoder/xprintf.h
11734@@ -1,10 +1,11 @@
11735 /*
11736 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11737 *
11738- * Use of this source code is governed by a BSD-style license and patent
11739- * grant that can be found in the LICENSE file in the root of the source
11740- * tree. All contributing project authors may be found in the AUTHORS
11741- * file in the root of the source tree.
11742+ * Use of this source code is governed by a BSD-style license
11743+ * that can be found in the LICENSE file in the root of the source
11744+ * tree. An additional intellectual property rights grant can be found
11745+ * in the file PATENTS. All contributing project authors may
11746+ * be found in the AUTHORS file in the root of the source tree.
11747 */
11748
11749
11750diff --git a/vp8/encoder/arm/armv6/walsh_v6.asm b/vp8/encoder/arm/armv6/walsh_v6.asm
11751index 608c9ae..461e492 100644
11752--- a/vp8/encoder/arm/armv6/walsh_v6.asm
11753+++ b/vp8/encoder/arm/armv6/walsh_v6.asm
11754@@ -1,10 +1,11 @@
11755 ;
11756 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11757 ;
11758-; Use of this source code is governed by a BSD-style license and patent
11759-; grant that can be found in the LICENSE file in the root of the source
11760-; tree. All contributing project authors may be found in the AUTHORS
11761-; file in the root of the source tree.
11762+; Use of this source code is governed by a BSD-style license
11763+; that can be found in the LICENSE file in the root of the source
11764+; tree. An additional intellectual property rights grant can be found
11765+; in the file PATENTS. All contributing project authors may
11766+; be found in the AUTHORS file in the root of the source tree.
11767 ;
11768
11769 EXPORT |vp8_short_walsh4x4_armv6|
11770diff --git a/vp8/encoder/arm/boolhuff_arm.c b/vp8/encoder/arm/boolhuff_arm.c
11771index e70b3ad..8c0faff 100644
11772--- a/vp8/encoder/arm/boolhuff_arm.c
11773+++ b/vp8/encoder/arm/boolhuff_arm.c
11774@@ -1,10 +1,11 @@
11775 /*
11776 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11777 *
11778- * Use of this source code is governed by a BSD-style license and patent
11779- * grant that can be found in the LICENSE file in the root of the source
11780- * tree. All contributing project authors may be found in the AUTHORS
11781- * file in the root of the source tree.
11782+ * Use of this source code is governed by a BSD-style license
11783+ * that can be found in the LICENSE file in the root of the source
11784+ * tree. An additional intellectual property rights grant can be found
11785+ * in the file PATENTS. All contributing project authors may
11786+ * be found in the AUTHORS file in the root of the source tree.
11787 */
11788
11789
11790diff --git a/vp8/encoder/arm/csystemdependent.c b/vp8/encoder/arm/csystemdependent.c
11791index 0039796..7fba995 100644
11792--- a/vp8/encoder/arm/csystemdependent.c
11793+++ b/vp8/encoder/arm/csystemdependent.c
11794@@ -1,10 +1,11 @@
11795 /*
11796 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11797 *
11798- * Use of this source code is governed by a BSD-style license and patent
11799- * grant that can be found in the LICENSE file in the root of the source
11800- * tree. All contributing project authors may be found in the AUTHORS
11801- * file in the root of the source tree.
11802+ * Use of this source code is governed by a BSD-style license
11803+ * that can be found in the LICENSE file in the root of the source
11804+ * tree. An additional intellectual property rights grant can be found
11805+ * in the file PATENTS. All contributing project authors may
11806+ * be found in the AUTHORS file in the root of the source tree.
11807 */
11808
11809
11810diff --git a/vp8/encoder/arm/dct_arm.h b/vp8/encoder/arm/dct_arm.h
11811index a671862..bb60c9d 100644
11812--- a/vp8/encoder/arm/dct_arm.h
11813+++ b/vp8/encoder/arm/dct_arm.h
11814@@ -1,10 +1,11 @@
11815 /*
11816 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11817 *
11818- * Use of this source code is governed by a BSD-style license and patent
11819- * grant that can be found in the LICENSE file in the root of the source
11820- * tree. All contributing project authors may be found in the AUTHORS
11821- * file in the root of the source tree.
11822+ * Use of this source code is governed by a BSD-style license
11823+ * that can be found in the LICENSE file in the root of the source
11824+ * tree. An additional intellectual property rights grant can be found
11825+ * in the file PATENTS. All contributing project authors may
11826+ * be found in the AUTHORS file in the root of the source tree.
11827 */
11828
11829
11830diff --git a/vp8/encoder/arm/encodemb_arm.c b/vp8/encoder/arm/encodemb_arm.c
11831index 3f1d053..7d58f94 100644
11832--- a/vp8/encoder/arm/encodemb_arm.c
11833+++ b/vp8/encoder/arm/encodemb_arm.c
11834@@ -1,10 +1,11 @@
11835 /*
11836 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11837 *
11838- * Use of this source code is governed by a BSD-style license and patent
11839- * grant that can be found in the LICENSE file in the root of the source
11840- * tree. All contributing project authors may be found in the AUTHORS
11841- * file in the root of the source tree.
11842+ * Use of this source code is governed by a BSD-style license
11843+ * that can be found in the LICENSE file in the root of the source
11844+ * tree. An additional intellectual property rights grant can be found
11845+ * in the file PATENTS. All contributing project authors may
11846+ * be found in the AUTHORS file in the root of the source tree.
11847 */
11848
11849
11850diff --git a/vp8/encoder/arm/encodemb_arm.h b/vp8/encoder/arm/encodemb_arm.h
11851index 28f9e5c..525135a 100644
11852--- a/vp8/encoder/arm/encodemb_arm.h
11853+++ b/vp8/encoder/arm/encodemb_arm.h
11854@@ -1,10 +1,11 @@
11855 /*
11856 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11857 *
11858- * Use of this source code is governed by a BSD-style license and patent
11859- * grant that can be found in the LICENSE file in the root of the source
11860- * tree. All contributing project authors may be found in the AUTHORS
11861- * file in the root of the source tree.
11862+ * Use of this source code is governed by a BSD-style license
11863+ * that can be found in the LICENSE file in the root of the source
11864+ * tree. An additional intellectual property rights grant can be found
11865+ * in the file PATENTS. All contributing project authors may
11866+ * be found in the AUTHORS file in the root of the source tree.
11867 */
11868
11869
11870diff --git a/vp8/encoder/arm/mcomp_arm.c b/vp8/encoder/arm/mcomp_arm.c
11871index 07f2186..9418a60 100644
11872--- a/vp8/encoder/arm/mcomp_arm.c
11873+++ b/vp8/encoder/arm/mcomp_arm.c
11874@@ -1,10 +1,11 @@
11875 /*
11876 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11877 *
11878- * Use of this source code is governed by a BSD-style license and patent
11879- * grant that can be found in the LICENSE file in the root of the source
11880- * tree. All contributing project authors may be found in the AUTHORS
11881- * file in the root of the source tree.
11882+ * Use of this source code is governed by a BSD-style license
11883+ * that can be found in the LICENSE file in the root of the source
11884+ * tree. An additional intellectual property rights grant can be found
11885+ * in the file PATENTS. All contributing project authors may
11886+ * be found in the AUTHORS file in the root of the source tree.
11887 */
11888
11889
11890diff --git a/vp8/encoder/arm/neon/boolhuff_armv7.asm b/vp8/encoder/arm/neon/boolhuff_armv7.asm
11891index 9a5f366..674eea9 100644
11892--- a/vp8/encoder/arm/neon/boolhuff_armv7.asm
11893+++ b/vp8/encoder/arm/neon/boolhuff_armv7.asm
11894@@ -1,10 +1,11 @@
11895 ;
11896 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11897 ;
11898-; Use of this source code is governed by a BSD-style license and patent
11899-; grant that can be found in the LICENSE file in the root of the source
11900-; tree. All contributing project authors may be found in the AUTHORS
11901-; file in the root of the source tree.
11902+; Use of this source code is governed by a BSD-style license
11903+; that can be found in the LICENSE file in the root of the source
11904+; tree. An additional intellectual property rights grant can be found
11905+; in the file PATENTS. All contributing project authors may
11906+; be found in the AUTHORS file in the root of the source tree.
11907 ;
11908
11909
11910diff --git a/vp8/encoder/arm/neon/fastfdct4x4_neon.asm b/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
11911index d5dec44..44e6dfc 100644
11912--- a/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
11913+++ b/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
11914@@ -1,10 +1,11 @@
11915 ;
11916 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11917 ;
11918-; Use of this source code is governed by a BSD-style license and patent
11919-; grant that can be found in the LICENSE file in the root of the source
11920-; tree. All contributing project authors may be found in the AUTHORS
11921-; file in the root of the source tree.
11922+; Use of this source code is governed by a BSD-style license
11923+; that can be found in the LICENSE file in the root of the source
11924+; tree. An additional intellectual property rights grant can be found
11925+; in the file PATENTS. All contributing project authors may
11926+; be found in the AUTHORS file in the root of the source tree.
11927 ;
11928
11929
11930diff --git a/vp8/encoder/arm/neon/fastfdct8x4_neon.asm b/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
11931index de1c254..6a286f6 100644
11932--- a/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
11933+++ b/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
11934@@ -1,10 +1,11 @@
11935 ;
11936 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11937 ;
11938-; Use of this source code is governed by a BSD-style license and patent
11939-; grant that can be found in the LICENSE file in the root of the source
11940-; tree. All contributing project authors may be found in the AUTHORS
11941-; file in the root of the source tree.
11942+; Use of this source code is governed by a BSD-style license
11943+; that can be found in the LICENSE file in the root of the source
11944+; tree. An additional intellectual property rights grant can be found
11945+; in the file PATENTS. All contributing project authors may
11946+; be found in the AUTHORS file in the root of the source tree.
11947 ;
11948
11949
11950diff --git a/vp8/encoder/arm/neon/fastquantizeb_neon.asm b/vp8/encoder/arm/neon/fastquantizeb_neon.asm
11951index 1107037..e3a94a6 100644
11952--- a/vp8/encoder/arm/neon/fastquantizeb_neon.asm
11953+++ b/vp8/encoder/arm/neon/fastquantizeb_neon.asm
11954@@ -1,10 +1,11 @@
11955 ;
11956 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11957 ;
11958-; Use of this source code is governed by a BSD-style license and patent
11959-; grant that can be found in the LICENSE file in the root of the source
11960-; tree. All contributing project authors may be found in the AUTHORS
11961-; file in the root of the source tree.
11962+; Use of this source code is governed by a BSD-style license
11963+; that can be found in the LICENSE file in the root of the source
11964+; tree. An additional intellectual property rights grant can be found
11965+; in the file PATENTS. All contributing project authors may
11966+; be found in the AUTHORS file in the root of the source tree.
11967 ;
11968
11969
11970diff --git a/vp8/encoder/arm/neon/sad16_neon.asm b/vp8/encoder/arm/neon/sad16_neon.asm
11971index 6169f10..7e2ab13 100644
11972--- a/vp8/encoder/arm/neon/sad16_neon.asm
11973+++ b/vp8/encoder/arm/neon/sad16_neon.asm
11974@@ -1,10 +1,11 @@
11975 ;
11976 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11977 ;
11978-; Use of this source code is governed by a BSD-style license and patent
11979-; grant that can be found in the LICENSE file in the root of the source
11980-; tree. All contributing project authors may be found in the AUTHORS
11981-; file in the root of the source tree.
11982+; Use of this source code is governed by a BSD-style license
11983+; that can be found in the LICENSE file in the root of the source
11984+; tree. An additional intellectual property rights grant can be found
11985+; in the file PATENTS. All contributing project authors may
11986+; be found in the AUTHORS file in the root of the source tree.
11987 ;
11988
11989
11990diff --git a/vp8/encoder/arm/neon/sad8_neon.asm b/vp8/encoder/arm/neon/sad8_neon.asm
11991index 28604dd..fc8c4e1 100644
11992--- a/vp8/encoder/arm/neon/sad8_neon.asm
11993+++ b/vp8/encoder/arm/neon/sad8_neon.asm
11994@@ -1,10 +1,11 @@
11995 ;
11996 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
11997 ;
11998-; Use of this source code is governed by a BSD-style license and patent
11999-; grant that can be found in the LICENSE file in the root of the source
12000-; tree. All contributing project authors may be found in the AUTHORS
12001-; file in the root of the source tree.
12002+; Use of this source code is governed by a BSD-style license
12003+; that can be found in the LICENSE file in the root of the source
12004+; tree. An additional intellectual property rights grant can be found
12005+; in the file PATENTS. All contributing project authors may
12006+; be found in the AUTHORS file in the root of the source tree.
12007 ;
12008
12009
12010diff --git a/vp8/encoder/arm/neon/shortfdct_neon.asm b/vp8/encoder/arm/neon/shortfdct_neon.asm
12011index 26bc0d0..4399c97 100644
12012--- a/vp8/encoder/arm/neon/shortfdct_neon.asm
12013+++ b/vp8/encoder/arm/neon/shortfdct_neon.asm
12014@@ -1,10 +1,11 @@
12015 ;
12016 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12017 ;
12018-; Use of this source code is governed by a BSD-style license and patent
12019-; grant that can be found in the LICENSE file in the root of the source
12020-; tree. All contributing project authors may be found in the AUTHORS
12021-; file in the root of the source tree.
12022+; Use of this source code is governed by a BSD-style license
12023+; that can be found in the LICENSE file in the root of the source
12024+; tree. An additional intellectual property rights grant can be found
12025+; in the file PATENTS. All contributing project authors may
12026+; be found in the AUTHORS file in the root of the source tree.
12027 ;
12028
12029
12030diff --git a/vp8/encoder/arm/neon/subtract_neon.asm b/vp8/encoder/arm/neon/subtract_neon.asm
12031index 8781ca0..d4803ff 100644
12032--- a/vp8/encoder/arm/neon/subtract_neon.asm
12033+++ b/vp8/encoder/arm/neon/subtract_neon.asm
12034@@ -1,10 +1,11 @@
12035 ;
12036 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12037 ;
12038-; Use of this source code is governed by a BSD-style license and patent
12039-; grant that can be found in the LICENSE file in the root of the source
12040-; tree. All contributing project authors may be found in the AUTHORS
12041-; file in the root of the source tree.
12042+; Use of this source code is governed by a BSD-style license
12043+; that can be found in the LICENSE file in the root of the source
12044+; tree. An additional intellectual property rights grant can be found
12045+; in the file PATENTS. All contributing project authors may
12046+; be found in the AUTHORS file in the root of the source tree.
12047 ;
12048
12049
12050diff --git a/vp8/encoder/arm/neon/variance_neon.asm b/vp8/encoder/arm/neon/variance_neon.asm
12051index 64b83ca..b901693 100644
12052--- a/vp8/encoder/arm/neon/variance_neon.asm
12053+++ b/vp8/encoder/arm/neon/variance_neon.asm
12054@@ -1,10 +1,11 @@
12055 ;
12056 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12057 ;
12058-; Use of this source code is governed by a BSD-style license and patent
12059-; grant that can be found in the LICENSE file in the root of the source
12060-; tree. All contributing project authors may be found in the AUTHORS
12061-; file in the root of the source tree.
12062+; Use of this source code is governed by a BSD-style license
12063+; that can be found in the LICENSE file in the root of the source
12064+; tree. An additional intellectual property rights grant can be found
12065+; in the file PATENTS. All contributing project authors may
12066+; be found in the AUTHORS file in the root of the source tree.
12067 ;
12068
12069
12070diff --git a/vp8/encoder/arm/neon/vp8_memcpy_neon.asm b/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
12071index f26b4d7..0a372c3 100644
12072--- a/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
12073+++ b/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
12074@@ -1,10 +1,11 @@
12075 ;
12076 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12077 ;
12078-; Use of this source code is governed by a BSD-style license and patent
12079-; grant that can be found in the LICENSE file in the root of the source
12080-; tree. All contributing project authors may be found in the AUTHORS
12081-; file in the root of the source tree.
12082+; Use of this source code is governed by a BSD-style license
12083+; that can be found in the LICENSE file in the root of the source
12084+; tree. An additional intellectual property rights grant can be found
12085+; in the file PATENTS. All contributing project authors may
12086+; be found in the AUTHORS file in the root of the source tree.
12087 ;
12088
12089
12090diff --git a/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm b/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
12091index f535967..087ea17 100644
12092--- a/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
12093+++ b/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
12094@@ -1,10 +1,11 @@
12095 ;
12096 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12097 ;
12098-; Use of this source code is governed by a BSD-style license and patent
12099-; grant that can be found in the LICENSE file in the root of the source
12100-; tree. All contributing project authors may be found in the AUTHORS
12101-; file in the root of the source tree.
12102+; Use of this source code is governed by a BSD-style license
12103+; that can be found in the LICENSE file in the root of the source
12104+; tree. An additional intellectual property rights grant can be found
12105+; in the file PATENTS. All contributing project authors may
12106+; be found in the AUTHORS file in the root of the source tree.
12107 ;
12108
12109
12110diff --git a/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm b/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm
12111index 9c52c52..bfa97d7 100644
12112--- a/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm
12113+++ b/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm
12114@@ -1,10 +1,11 @@
12115 ;
12116 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12117 ;
12118-; Use of this source code is governed by a BSD-style license and patent
12119-; grant that can be found in the LICENSE file in the root of the source
12120-; tree. All contributing project authors may be found in the AUTHORS
12121-; file in the root of the source tree.
12122+; Use of this source code is governed by a BSD-style license
12123+; that can be found in the LICENSE file in the root of the source
12124+; tree. An additional intellectual property rights grant can be found
12125+; in the file PATENTS. All contributing project authors may
12126+; be found in the AUTHORS file in the root of the source tree.
12127 ;
12128
12129
12130diff --git a/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm b/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm
12131index 92b0989..334c88f 100644
12132--- a/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm
12133+++ b/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm
12134@@ -1,10 +1,11 @@
12135 ;
12136 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12137 ;
12138-; Use of this source code is governed by a BSD-style license and patent
12139-; grant that can be found in the LICENSE file in the root of the source
12140-; tree. All contributing project authors may be found in the AUTHORS
12141-; file in the root of the source tree.
12142+; Use of this source code is governed by a BSD-style license
12143+; that can be found in the LICENSE file in the root of the source
12144+; tree. An additional intellectual property rights grant can be found
12145+; in the file PATENTS. All contributing project authors may
12146+; be found in the AUTHORS file in the root of the source tree.
12147 ;
12148
12149
12150diff --git a/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm b/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm
12151index 6d5f882..267e216 100644
12152--- a/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm
12153+++ b/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm
12154@@ -1,10 +1,11 @@
12155 ;
12156 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12157 ;
12158-; Use of this source code is governed by a BSD-style license and patent
12159-; grant that can be found in the LICENSE file in the root of the source
12160-; tree. All contributing project authors may be found in the AUTHORS
12161-; file in the root of the source tree.
12162+; Use of this source code is governed by a BSD-style license
12163+; that can be found in the LICENSE file in the root of the source
12164+; tree. An additional intellectual property rights grant can be found
12165+; in the file PATENTS. All contributing project authors may
12166+; be found in the AUTHORS file in the root of the source tree.
12167 ;
12168
12169
12170diff --git a/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm b/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
12171index 5269c0a..ebd5dc1 100644
12172--- a/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
12173+++ b/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
12174@@ -1,10 +1,11 @@
12175 ;
12176 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12177 ;
12178-; Use of this source code is governed by a BSD-style license and patent
12179-; grant that can be found in the LICENSE file in the root of the source
12180-; tree. All contributing project authors may be found in the AUTHORS
12181-; file in the root of the source tree.
12182+; Use of this source code is governed by a BSD-style license
12183+; that can be found in the LICENSE file in the root of the source
12184+; tree. An additional intellectual property rights grant can be found
12185+; in the file PATENTS. All contributing project authors may
12186+; be found in the AUTHORS file in the root of the source tree.
12187 ;
12188
12189
12190diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
12191index aec716e..185277f 100644
12192--- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
12193+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
12194@@ -1,10 +1,11 @@
12195 ;
12196 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12197 ;
12198-; Use of this source code is governed by a BSD-style license and patent
12199-; grant that can be found in the LICENSE file in the root of the source
12200-; tree. All contributing project authors may be found in the AUTHORS
12201-; file in the root of the source tree.
12202+; Use of this source code is governed by a BSD-style license
12203+; that can be found in the LICENSE file in the root of the source
12204+; tree. An additional intellectual property rights grant can be found
12205+; in the file PATENTS. All contributing project authors may
12206+; be found in the AUTHORS file in the root of the source tree.
12207 ;
12208
12209
12210diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
12211index 3d02d7c..611b1e4 100644
12212--- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
12213+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
12214@@ -1,10 +1,11 @@
12215 ;
12216 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12217 ;
12218-; Use of this source code is governed by a BSD-style license and patent
12219-; grant that can be found in the LICENSE file in the root of the source
12220-; tree. All contributing project authors may be found in the AUTHORS
12221-; file in the root of the source tree.
12222+; Use of this source code is governed by a BSD-style license
12223+; that can be found in the LICENSE file in the root of the source
12224+; tree. An additional intellectual property rights grant can be found
12225+; in the file PATENTS. All contributing project authors may
12226+; be found in the AUTHORS file in the root of the source tree.
12227 ;
12228
12229
12230diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
12231index bd56761..614d48f 100644
12232--- a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
12233+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
12234@@ -1,10 +1,11 @@
12235 ;
12236 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12237 ;
12238-; Use of this source code is governed by a BSD-style license and patent
12239-; grant that can be found in the LICENSE file in the root of the source
12240-; tree. All contributing project authors may be found in the AUTHORS
12241-; file in the root of the source tree.
12242+; Use of this source code is governed by a BSD-style license
12243+; that can be found in the LICENSE file in the root of the source
12244+; tree. An additional intellectual property rights grant can be found
12245+; in the file PATENTS. All contributing project authors may
12246+; be found in the AUTHORS file in the root of the source tree.
12247 ;
12248
12249
12250diff --git a/vp8/encoder/arm/picklpf_arm.c b/vp8/encoder/arm/picklpf_arm.c
12251index 0586e55..fb0b3bd 100644
12252--- a/vp8/encoder/arm/picklpf_arm.c
12253+++ b/vp8/encoder/arm/picklpf_arm.c
12254@@ -1,10 +1,11 @@
12255 /*
12256 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12257 *
12258- * Use of this source code is governed by a BSD-style license and patent
12259- * grant that can be found in the LICENSE file in the root of the source
12260- * tree. All contributing project authors may be found in the AUTHORS
12261- * file in the root of the source tree.
12262+ * Use of this source code is governed by a BSD-style license
12263+ * that can be found in the LICENSE file in the root of the source
12264+ * tree. An additional intellectual property rights grant can be found
12265+ * in the file PATENTS. All contributing project authors may
12266+ * be found in the AUTHORS file in the root of the source tree.
12267 */
12268
12269
12270diff --git a/vp8/encoder/arm/quantize_arm.c b/vp8/encoder/arm/quantize_arm.c
12271index 46906d3..e8bd44b 100644
12272--- a/vp8/encoder/arm/quantize_arm.c
12273+++ b/vp8/encoder/arm/quantize_arm.c
12274@@ -1,10 +1,11 @@
12275 /*
12276 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12277 *
12278- * Use of this source code is governed by a BSD-style license and patent
12279- * grant that can be found in the LICENSE file in the root of the source
12280- * tree. All contributing project authors may be found in the AUTHORS
12281- * file in the root of the source tree.
12282+ * Use of this source code is governed by a BSD-style license
12283+ * that can be found in the LICENSE file in the root of the source
12284+ * tree. An additional intellectual property rights grant can be found
12285+ * in the file PATENTS. All contributing project authors may
12286+ * be found in the AUTHORS file in the root of the source tree.
12287 */
12288
12289
12290diff --git a/vp8/encoder/arm/quantize_arm.h b/vp8/encoder/arm/quantize_arm.h
12291index e93f0fe..14bc923 100644
12292--- a/vp8/encoder/arm/quantize_arm.h
12293+++ b/vp8/encoder/arm/quantize_arm.h
12294@@ -1,10 +1,11 @@
12295 /*
12296 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12297 *
12298- * Use of this source code is governed by a BSD-style license and patent
12299- * grant that can be found in the LICENSE file in the root of the source
12300- * tree. All contributing project authors may be found in the AUTHORS
12301- * file in the root of the source tree.
12302+ * Use of this source code is governed by a BSD-style license
12303+ * that can be found in the LICENSE file in the root of the source
12304+ * tree. An additional intellectual property rights grant can be found
12305+ * in the file PATENTS. All contributing project authors may
12306+ * be found in the AUTHORS file in the root of the source tree.
12307 */
12308
12309
12310diff --git a/vp8/encoder/arm/variance_arm.h b/vp8/encoder/arm/variance_arm.h
12311index d9fc9b3..1c16020 100644
12312--- a/vp8/encoder/arm/variance_arm.h
12313+++ b/vp8/encoder/arm/variance_arm.h
12314@@ -1,10 +1,11 @@
12315 /*
12316 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12317 *
12318- * Use of this source code is governed by a BSD-style license and patent
12319- * grant that can be found in the LICENSE file in the root of the source
12320- * tree. All contributing project authors may be found in the AUTHORS
12321- * file in the root of the source tree.
12322+ * Use of this source code is governed by a BSD-style license
12323+ * that can be found in the LICENSE file in the root of the source
12324+ * tree. An additional intellectual property rights grant can be found
12325+ * in the file PATENTS. All contributing project authors may
12326+ * be found in the AUTHORS file in the root of the source tree.
12327 */
12328
12329
12330diff --git a/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c b/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c
12331index 8cdf079..28aac70 100644
12332--- a/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c
12333+++ b/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c
12334@@ -1,10 +1,11 @@
12335 /*
12336 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12337 *
12338- * Use of this source code is governed by a BSD-style license and patent
12339- * grant that can be found in the LICENSE file in the root of the source
12340- * tree. All contributing project authors may be found in the AUTHORS
12341- * file in the root of the source tree.
12342+ * Use of this source code is governed by a BSD-style license
12343+ * that can be found in the LICENSE file in the root of the source
12344+ * tree. An additional intellectual property rights grant can be found
12345+ * in the file PATENTS. All contributing project authors may
12346+ * be found in the AUTHORS file in the root of the source tree.
12347 */
12348
12349
12350diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
12351index 31ad56a..ce9d2fd 100644
12352--- a/vp8/encoder/bitstream.c
12353+++ b/vp8/encoder/bitstream.c
12354@@ -1,10 +1,11 @@
12355 /*
12356 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12357 *
12358- * Use of this source code is governed by a BSD-style license and patent
12359- * grant that can be found in the LICENSE file in the root of the source
12360- * tree. All contributing project authors may be found in the AUTHORS
12361- * file in the root of the source tree.
12362+ * Use of this source code is governed by a BSD-style license
12363+ * that can be found in the LICENSE file in the root of the source
12364+ * tree. An additional intellectual property rights grant can be found
12365+ * in the file PATENTS. All contributing project authors may
12366+ * be found in the AUTHORS file in the root of the source tree.
12367 */
12368
12369
12370@@ -1385,8 +1386,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
12371 // every keyframe send startcode, width, height, scale factor, clamp and color type
12372 if (oh.type == KEY_FRAME)
12373 {
12374- int w, h, hs, vs;
12375-
12376 // Start / synch code
12377 cx_data[0] = 0x9D;
12378 cx_data[1] = 0x01;
12379diff --git a/vp8/encoder/bitstream.h b/vp8/encoder/bitstream.h
12380index ee69f66..de4b94d 100644
12381--- a/vp8/encoder/bitstream.h
12382+++ b/vp8/encoder/bitstream.h
12383@@ -1,10 +1,11 @@
12384 /*
12385 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12386 *
12387- * Use of this source code is governed by a BSD-style license and patent
12388- * grant that can be found in the LICENSE file in the root of the source
12389- * tree. All contributing project authors may be found in the AUTHORS
12390- * file in the root of the source tree.
12391+ * Use of this source code is governed by a BSD-style license
12392+ * that can be found in the LICENSE file in the root of the source
12393+ * tree. An additional intellectual property rights grant can be found
12394+ * in the file PATENTS. All contributing project authors may
12395+ * be found in the AUTHORS file in the root of the source tree.
12396 */
12397
12398
12399diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h
12400index cc4cbe0..2e866dd 100644
12401--- a/vp8/encoder/block.h
12402+++ b/vp8/encoder/block.h
12403@@ -1,10 +1,11 @@
12404 /*
12405 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12406 *
12407- * Use of this source code is governed by a BSD-style license and patent
12408- * grant that can be found in the LICENSE file in the root of the source
12409- * tree. All contributing project authors may be found in the AUTHORS
12410- * file in the root of the source tree.
12411+ * Use of this source code is governed by a BSD-style license
12412+ * that can be found in the LICENSE file in the root of the source
12413+ * tree. An additional intellectual property rights grant can be found
12414+ * in the file PATENTS. All contributing project authors may
12415+ * be found in the AUTHORS file in the root of the source tree.
12416 */
12417
12418
12419@@ -101,11 +102,9 @@ typedef struct
12420 void (*vp8_short_fdct8x4)(short *input, short *output, int pitch);
12421 void (*short_fdct4x4rd)(short *input, short *output, int pitch);
12422 void (*short_fdct8x4rd)(short *input, short *output, int pitch);
12423- void (*vp8_short_fdct4x4_ptr)(short *input, short *output, int pitch);
12424 void (*short_walsh4x4)(short *input, short *output, int pitch);
12425
12426 void (*quantize_b)(BLOCK *b, BLOCKD *d);
12427- void (*quantize_brd)(BLOCK *b, BLOCKD *d);
12428
12429
12430
12431diff --git a/vp8/encoder/boolhuff.c b/vp8/encoder/boolhuff.c
12432index c101384..2e95c75 100644
12433--- a/vp8/encoder/boolhuff.c
12434+++ b/vp8/encoder/boolhuff.c
12435@@ -1,10 +1,11 @@
12436 /*
12437 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12438 *
12439- * Use of this source code is governed by a BSD-style license and patent
12440- * grant that can be found in the LICENSE file in the root of the source
12441- * tree. All contributing project authors may be found in the AUTHORS
12442- * file in the root of the source tree.
12443+ * Use of this source code is governed by a BSD-style license
12444+ * that can be found in the LICENSE file in the root of the source
12445+ * tree. An additional intellectual property rights grant can be found
12446+ * in the file PATENTS. All contributing project authors may
12447+ * be found in the AUTHORS file in the root of the source tree.
12448 */
12449
12450
12451diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
12452index 0d929f0..95635e3 100644
12453--- a/vp8/encoder/boolhuff.h
12454+++ b/vp8/encoder/boolhuff.h
12455@@ -1,10 +1,11 @@
12456 /*
12457 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12458 *
12459- * Use of this source code is governed by a BSD-style license and patent
12460- * grant that can be found in the LICENSE file in the root of the source
12461- * tree. All contributing project authors may be found in the AUTHORS
12462- * file in the root of the source tree.
12463+ * Use of this source code is governed by a BSD-style license
12464+ * that can be found in the LICENSE file in the root of the source
12465+ * tree. An additional intellectual property rights grant can be found
12466+ * in the file PATENTS. All contributing project authors may
12467+ * be found in the AUTHORS file in the root of the source tree.
12468 */
12469
12470
12471diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c
12472index 5207e39..4f5f9f0 100644
12473--- a/vp8/encoder/dct.c
12474+++ b/vp8/encoder/dct.c
12475@@ -1,10 +1,11 @@
12476 /*
12477 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12478 *
12479- * Use of this source code is governed by a BSD-style license and patent
12480- * grant that can be found in the LICENSE file in the root of the source
12481- * tree. All contributing project authors may be found in the AUTHORS
12482- * file in the root of the source tree.
12483+ * Use of this source code is governed by a BSD-style license
12484+ * that can be found in the LICENSE file in the root of the source
12485+ * tree. An additional intellectual property rights grant can be found
12486+ * in the file PATENTS. All contributing project authors may
12487+ * be found in the AUTHORS file in the root of the source tree.
12488 */
12489
12490
12491diff --git a/vp8/encoder/dct.h b/vp8/encoder/dct.h
12492index fb307cf..2aaf731 100644
12493--- a/vp8/encoder/dct.h
12494+++ b/vp8/encoder/dct.h
12495@@ -1,10 +1,11 @@
12496 /*
12497 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12498 *
12499- * Use of this source code is governed by a BSD-style license and patent
12500- * grant that can be found in the LICENSE file in the root of the source
12501- * tree. All contributing project authors may be found in the AUTHORS
12502- * file in the root of the source tree.
12503+ * Use of this source code is governed by a BSD-style license
12504+ * that can be found in the LICENSE file in the root of the source
12505+ * tree. An additional intellectual property rights grant can be found
12506+ * in the file PATENTS. All contributing project authors may
12507+ * be found in the AUTHORS file in the root of the source tree.
12508 */
12509
12510
12511diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
12512index a4e3772..46b697e 100644
12513--- a/vp8/encoder/encodeframe.c
12514+++ b/vp8/encoder/encodeframe.c
12515@@ -1,10 +1,11 @@
12516 /*
12517 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12518 *
12519- * Use of this source code is governed by a BSD-style license and patent
12520- * grant that can be found in the LICENSE file in the root of the source
12521- * tree. All contributing project authors may be found in the AUTHORS
12522- * file in the root of the source tree.
12523+ * Use of this source code is governed by a BSD-style license
12524+ * that can be found in the LICENSE file in the root of the source
12525+ * tree. An additional intellectual property rights grant can be found
12526+ * in the file PATENTS. All contributing project authors may
12527+ * be found in the AUTHORS file in the root of the source tree.
12528 */
12529
12530
12531diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c
12532index 403d020..d632bd8 100644
12533--- a/vp8/encoder/encodeintra.c
12534+++ b/vp8/encoder/encodeintra.c
12535@@ -1,10 +1,11 @@
12536 /*
12537 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12538 *
12539- * Use of this source code is governed by a BSD-style license and patent
12540- * grant that can be found in the LICENSE file in the root of the source
12541- * tree. All contributing project authors may be found in the AUTHORS
12542- * file in the root of the source tree.
12543+ * Use of this source code is governed by a BSD-style license
12544+ * that can be found in the LICENSE file in the root of the source
12545+ * tree. An additional intellectual property rights grant can be found
12546+ * in the file PATENTS. All contributing project authors may
12547+ * be found in the AUTHORS file in the root of the source tree.
12548 */
12549
12550
12551@@ -67,7 +68,7 @@ void vp8_encode_intra4x4block_rd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x, BL
12552
12553 x->short_fdct4x4rd(be->src_diff, be->coeff, 32);
12554
12555- x->quantize_brd(be, b);
12556+ x->quantize_b(be, b);
12557
12558 x->e_mbd.mbmi.mb_skip_coeff &= (!b->eob);
12559
12560@@ -159,8 +160,7 @@ void vp8_encode_intra16x16mbyrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
12561
12562 x->e_mbd.mbmi.mb_skip_coeff = 1;
12563
12564- vp8_quantize_mbyrd(x);
12565-
12566+ vp8_quantize_mby(x);
12567
12568 vp8_inverse_transform_mby(IF_RTCD(&rtcd->common->idct), &x->e_mbd);
12569
12570@@ -226,9 +226,7 @@ void vp8_encode_intra16x16mbuvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
12571
12572 vp8_transform_mbuvrd(x);
12573
12574- vp8_quantize_mbuvrd(x);
12575-
12576-
12577+ vp8_quantize_mbuv(x);
12578
12579 vp8_inverse_transform_mbuv(IF_RTCD(&rtcd->common->idct), &x->e_mbd);
12580
12581diff --git a/vp8/encoder/encodeintra.h b/vp8/encoder/encodeintra.h
12582index 4a43ab2..49b3257 100644
12583--- a/vp8/encoder/encodeintra.h
12584+++ b/vp8/encoder/encodeintra.h
12585@@ -1,10 +1,11 @@
12586 /*
12587 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12588 *
12589- * Use of this source code is governed by a BSD-style license and patent
12590- * grant that can be found in the LICENSE file in the root of the source
12591- * tree. All contributing project authors may be found in the AUTHORS
12592- * file in the root of the source tree.
12593+ * Use of this source code is governed by a BSD-style license
12594+ * that can be found in the LICENSE file in the root of the source
12595+ * tree. An additional intellectual property rights grant can be found
12596+ * in the file PATENTS. All contributing project authors may
12597+ * be found in the AUTHORS file in the root of the source tree.
12598 */
12599
12600
12601diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c
12602index d825133..a66b90c 100644
12603--- a/vp8/encoder/encodemb.c
12604+++ b/vp8/encoder/encodemb.c
12605@@ -1,10 +1,11 @@
12606 /*
12607 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
12608 *
12609- * Use of this source code is governed by a BSD-style license and patent
12610- * grant that can be found in the LICENSE file in the root of the source
12611- * tree. All contributing project authors may be found in the AUTHORS
12612- * file in the root of the source tree.
12613+ * Use of this source code is governed by a BSD-style license
12614+ * that can be found in the LICENSE file in the root of the source
12615+ * tree. An additional intellectual property rights grant can be found
12616+ * in the file PATENTS. All contributing project authors may
12617+ * be found in the AUTHORS file in the root of the source tree.
12618 */
12619
12620
12621@@ -493,140 +494,6 @@ void vp8_optimize_b(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROPY_
12622 return;
12623 }
12624
12625-void vp8_optimize_bplus(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, const VP8_ENCODER_RTCD *rtcd)
12626-{
12627- BLOCK *b = &x->block[i];
12628- BLOCKD *bd = &x->e_mbd.block[i];
12629- short *dequant_ptr = &bd->dequant[0][0];
12630- int nzpos[16] = {0};
12631- short saved_qcoefs[16];
12632- short saved_dqcoefs[16];
12633- int baserate, baseerror, baserd;
12634- int rate, error, thisrd;
12635- int k;
12636- int nzcoefcount = 0;
12637- int nc, bestnc = 0;
12638- int besteob;
12639-
12640- // count potential coefficient to be optimized
12641- for (k = !type; k < 16; k++)
12642- {
12643- int qcoef = abs(bd->qcoeff[k]);
12644- int coef = abs(b->coeff[k]);
12645- int dq = dequant_ptr[k];
12646-
12647- if (qcoef && (qcoef * dq < coef) && (coef < (qcoef * dq + dq)))
12648- {
12649- nzpos[nzcoefcount] = k;
12650- nzcoefcount++;
12651- }
12652- }
12653-
12654- // if nothing here, do nothing for this block.
12655- if (!nzcoefcount)
12656- {
12657- //do not update context, we need do the other half.
12658- //*a = *l = (bd->eob != !type);
12659- return;
12660- }
12661-
12662- // save a copy of quantized coefficients
12663- vpx_memcpy(saved_qcoefs, bd->qcoeff, 32);
12664- vpx_memcpy(saved_dqcoefs, bd->dqcoeff, 32);
12665-
12666- besteob = bd->eob;
12667- baserate = cost_coeffs(x, bd, type, a, l);
12668- baseerror = ENCODEMB_INVOKE(&rtcd->encodemb, berr)(b->coeff, bd->dqcoeff) >> 2;
12669- baserd = RDFUNC(x->rdmult, x->rddiv, baserate, baseerror, 100);
12670-
12671- for (nc = 1; nc < (1 << nzcoefcount); nc++)
12672- {
12673- //reset coefficients
12674- vpx_memcpy(bd->qcoeff, saved_qcoefs, 32);
12675- vpx_memcpy(bd->dqcoeff, saved_dqcoefs, 32);
12676-
12677- for (k = 0; k < nzcoefcount; k++)
12678- {
12679- int pos = nzpos[k];
12680-
12681- if ((nc & (1 << k)))
12682- {
12683- int cur_qcoef = bd->qcoeff[pos];
12684-
12685- if (cur_qcoef < 0)
12686- {
12687- bd->qcoeff[pos]--;
12688- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
12689- }
12690- else
12691- {
12692- bd->qcoeff[pos]++;
12693- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
12694- }
12695- }
12696- }
12697-
12698- {
12699- int eob = -1;
12700- int rc;
12701- int m;
12702-
12703- for (m = 0; m < 16; m++)
12704- {
12705- rc = vp8_default_zig_zag1d[m];
12706-
12707- if (bd->qcoeff[rc])
12708- eob = m;
12709- }
12710-
12711- bd->eob = eob + 1;
12712- }
12713-
12714- rate = cost_coeffs(x, bd, type, a, l);
12715- error = ENCODEMB_INVOKE(&rtcd->encodemb, berr)(b->coeff, bd->dqcoeff) >> 2;
12716- thisrd = RDFUNC(x->rdmult, x->rddiv, rate, error, 100);
12717-
12718- if (thisrd < baserd)
12719- {
12720- baserd = thisrd;
12721- bestnc = nc;
12722- besteob = bd->eob;
12723- }
12724- }
12725-
12726- //reset coefficients
12727- vpx_memcpy(bd->qcoeff, saved_qcoefs, 32);
12728- vpx_memcpy(bd->dqcoeff, saved_dqcoefs, 32);
12729-
12730- if (bestnc)
12731- {
12732- for (k = 0; k < nzcoefcount; k++)
12733- {
12734- int pos = nzpos[k];
12735-
12736- if (bestnc & (1 << k))
12737- {
12738- int cur_qcoef = bd->qcoeff[pos];
12739-
12740- if (cur_qcoef < 0)
12741- {
12742- bd->qcoeff[pos]++;
12743- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
12744- }
12745- else
12746- {
12747- bd->qcoeff[pos]--;
12748- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
12749- }
12750- }
12751- }
12752- }
12753-
12754- bd->eob = besteob;
12755- //do not update context, we need do the other half.
12756- //*a = *l = (bd->eob != !type);
12757- return;
12758-}
12759
12760 void vp8_optimize_y2b(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, const VP8_ENCODER_RTCD *rtcd)
12761 {
12762@@ -718,7 +585,6 @@ void vp8_optimize_y2b(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROP
12763
12764 void vp8_optimize_mb(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
12765 {
12766- int cost = 0;
12767 int b;
12768 TEMP_CONTEXT t, t2;
12769 int type = 0;
12770@@ -752,181 +618,6 @@ void vp8_optimize_mb(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
12771
12772
12773
12774-void vp8_super_slow_yquant_optimization(MACROBLOCK *x, int type, const VP8_ENCODER_RTCD *rtcd)
12775-{
12776- BLOCK *b = &x->block[0];
12777- BLOCKD *bd = &x->e_mbd.block[0];
12778- short *dequant_ptr = &bd->dequant[0][0];
12779- struct
12780- {
12781- int block;
12782- int pos;
12783- } nzpos[256];
12784- short saved_qcoefs[256];
12785- short saved_dqcoefs[256];
12786- short *coef_ptr = x->coeff;
12787- short *qcoef_ptr = x->e_mbd.qcoeff;
12788- short *dqcoef_ptr = x->e_mbd.dqcoeff;
12789-
12790- int baserate, baseerror, baserd;
12791- int rate, error, thisrd;
12792- int i, k;
12793- int nzcoefcount = 0;
12794- int nc, bestnc = 0;
12795- int besteob;
12796-
12797- //this code has assumption in macroblock coeff buffer layout
12798- for (i = 0; i < 16; i++)
12799- {
12800- // count potential coefficient to be optimized
12801- for (k = !type; k < 16; k++)
12802- {
12803- int qcoef = abs(qcoef_ptr[i*16 + k]);
12804- int coef = abs(coef_ptr[i*16 + k]);
12805- int dq = dequant_ptr[k];
12806-
12807- if (qcoef && (qcoef * dq > coef) && (qcoef * dq < coef + dq))
12808- {
12809- nzpos[nzcoefcount].block = i;
12810- nzpos[nzcoefcount].pos = k;
12811- nzcoefcount++;
12812- }
12813- }
12814- }
12815-
12816- // if nothing here, do nothing for this macro_block.
12817- if (!nzcoefcount || nzcoefcount > 15)
12818- {
12819- return;
12820- }
12821-
12822- /******************************************************************************
12823- looking from each coeffient's perspective, each identifed coefficent above could
12824- have 2 values:roundeddown(x) and roundedup(x). Therefore the total number of
12825- different states is less than 2**nzcoefcount.
12826- ******************************************************************************/
12827- // save the qunatized coefficents and dequantized coefficicents
12828- vpx_memcpy(saved_qcoefs, x->e_mbd.qcoeff, 256);
12829- vpx_memcpy(saved_dqcoefs, x->e_mbd.dqcoeff, 256);
12830-
12831- baserate = mbycost_coeffs(x);
12832- baseerror = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(x, !type);
12833- baserd = RDFUNC(x->rdmult, x->rddiv, baserate, baseerror, 100);
12834-
12835- for (nc = 1; nc < (1 << nzcoefcount); nc++)
12836- {
12837- //reset coefficients
12838- vpx_memcpy(x->e_mbd.qcoeff, saved_qcoefs, 256);
12839- vpx_memcpy(x->e_mbd.dqcoeff, saved_dqcoefs, 256);
12840-
12841- for (k = 0; k < nzcoefcount; k++)
12842- {
12843- int bk = nzpos[k].block;
12844- int pos = nzpos[k].pos;
12845- int mbkpos = bk * 16 + pos;
12846-
12847- if ((nc & (1 << k)))
12848- {
12849- int cur_qcoef = x->e_mbd.qcoeff[mbkpos];
12850-
12851- if (cur_qcoef < 0)
12852- {
12853- x->e_mbd.qcoeff[mbkpos]++;
12854- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
12855- }
12856- else
12857- {
12858- x->e_mbd.qcoeff[mbkpos]--;
12859- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
12860- }
12861- }
12862- }
12863-
12864- for (i = 0; i < 16; i++)
12865- {
12866- BLOCKD *bd = &x->e_mbd.block[i];
12867- {
12868- int eob = -1;
12869- int rc;
12870- int l;
12871-
12872- for (l = 0; l < 16; l++)
12873- {
12874- rc = vp8_default_zig_zag1d[l];
12875-
12876- if (bd->qcoeff[rc])
12877- eob = l;
12878- }
12879-
12880- bd->eob = eob + 1;
12881- }
12882- }
12883-
12884- rate = mbycost_coeffs(x);
12885- error = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(x, !type);;
12886- thisrd = RDFUNC(x->rdmult, x->rddiv, rate, error, 100);
12887-
12888- if (thisrd < baserd)
12889- {
12890- baserd = thisrd;
12891- bestnc = nc;
12892- besteob = bd->eob;
12893- }
12894- }
12895-
12896- //reset coefficients
12897- vpx_memcpy(x->e_mbd.qcoeff, saved_qcoefs, 256);
12898- vpx_memcpy(x->e_mbd.dqcoeff, saved_dqcoefs, 256);
12899-
12900- if (bestnc)
12901- {
12902- for (k = 0; k < nzcoefcount; k++)
12903- {
12904- int bk = nzpos[k].block;
12905- int pos = nzpos[k].pos;
12906- int mbkpos = bk * 16 + pos;
12907-
12908- if ((nc & (1 << k)))
12909- {
12910- int cur_qcoef = x->e_mbd.qcoeff[mbkpos];
12911-
12912- if (cur_qcoef < 0)
12913- {
12914- x->e_mbd.qcoeff[mbkpos]++;
12915- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
12916- }
12917- else
12918- {
12919- x->e_mbd.qcoeff[mbkpos]--;
12920- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
12921- }
12922- }
12923- }
12924- }
12925-
12926- for (i = 0; i < 16; i++)
12927- {
12928- BLOCKD *bd = &x->e_mbd.block[i];
12929- {
12930- int eob = -1;
12931- int rc;
12932- int l;
12933-
12934- for (l = 0; l < 16; l++)
12935- {
12936- rc = vp8_default_zig_zag1d[l];
12937-
12938- if (bd->qcoeff[rc])
12939- eob = l;
12940- }
12941-
12942- bd->eob = eob + 1;
12943- }
12944- }
12945-
12946- return;
12947-}
12948-
12949 static void vp8_find_mb_skip_coef(MACROBLOCK *x)
12950 {
12951 int i;
12952@@ -955,46 +646,8 @@ static void vp8_find_mb_skip_coef(MACROBLOCK *x)
12953 }
12954
12955
12956-void vp8_optimize_mb_slow(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
12957-{
12958- int cost = 0;
12959- int b;
12960- TEMP_CONTEXT t, t2;
12961- int type = 0;
12962-
12963-
12964- vp8_setup_temp_context(&t, x->e_mbd.above_context[Y1CONTEXT], x->e_mbd.left_context[Y1CONTEXT], 4);
12965-
12966- if (x->e_mbd.mbmi.mode == SPLITMV || x->e_mbd.mbmi.mode == B_PRED)
12967- type = 3;
12968-
12969- vp8_super_slow_yquant_optimization(x, type, rtcd);
12970- /*
12971- for(b=0;b<16;b++)
12972- {
12973- vp8_optimize_b(x, b, type, t.a + vp8_block2above[b], t.l + vp8_block2left[b]);
12974- }
12975- */
12976-
12977- vp8_setup_temp_context(&t, x->e_mbd.above_context[UCONTEXT], x->e_mbd.left_context[UCONTEXT], 2);
12978-
12979- for (b = 16; b < 20; b++)
12980- {
12981- vp8_optimize_b(x, b, vp8_block2type[b], t.a + vp8_block2above[b], t.l + vp8_block2left[b], rtcd);
12982- }
12983-
12984- vp8_setup_temp_context(&t2, x->e_mbd.above_context[VCONTEXT], x->e_mbd.left_context[VCONTEXT], 2);
12985-
12986- for (b = 20; b < 24; b++)
12987- {
12988- vp8_optimize_b(x, b, vp8_block2type[b], t2.a + vp8_block2above[b], t2.l + vp8_block2left[b], rtcd);
12989- }
12990-}
12991-
12992-
12993 void vp8_optimize_mby(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
12994 {
12995- int cost = 0;
12996 int b;
12997 TEMP_CONTEXT t;
12998 int type = 0;
12999@@ -1019,10 +672,8 @@ void vp8_optimize_mby(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
13000
13001 void vp8_optimize_mbuv(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
13002 {
13003- int cost = 0;
13004 int b;
13005 TEMP_CONTEXT t, t2;
13006- int type = 0;
13007
13008 if (!x->e_mbd.above_context[UCONTEXT])
13009 return;
13010@@ -1124,6 +775,6 @@ void vp8_encode_inter16x16uvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
13011
13012 vp8_transform_mbuvrd(x);
13013
13014- vp8_quantize_mbuvrd(x);
13015+ vp8_quantize_mbuv(x);
13016
13017 }
13018diff --git a/vp8/encoder/encodemb.h b/vp8/encoder/encodemb.h
13019index 91ca8f5..5285a38 100644
13020--- a/vp8/encoder/encodemb.h
13021+++ b/vp8/encoder/encodemb.h
13022@@ -1,10 +1,11 @@
13023 /*
13024 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13025 *
13026- * Use of this source code is governed by a BSD-style license and patent
13027- * grant that can be found in the LICENSE file in the root of the source
13028- * tree. All contributing project authors may be found in the AUTHORS
13029- * file in the root of the source tree.
13030+ * Use of this source code is governed by a BSD-style license
13031+ * that can be found in the LICENSE file in the root of the source
13032+ * tree. An additional intellectual property rights grant can be found
13033+ * in the file PATENTS. All contributing project authors may
13034+ * be found in the AUTHORS file in the root of the source tree.
13035 */
13036
13037
13038diff --git a/vp8/encoder/encodemv.c b/vp8/encoder/encodemv.c
13039index f287edc..3b58a80 100644
13040--- a/vp8/encoder/encodemv.c
13041+++ b/vp8/encoder/encodemv.c
13042@@ -1,10 +1,11 @@
13043 /*
13044 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13045 *
13046- * Use of this source code is governed by a BSD-style license and patent
13047- * grant that can be found in the LICENSE file in the root of the source
13048- * tree. All contributing project authors may be found in the AUTHORS
13049- * file in the root of the source tree.
13050+ * Use of this source code is governed by a BSD-style license
13051+ * that can be found in the LICENSE file in the root of the source
13052+ * tree. An additional intellectual property rights grant can be found
13053+ * in the file PATENTS. All contributing project authors may
13054+ * be found in the AUTHORS file in the root of the source tree.
13055 */
13056
13057
13058@@ -282,8 +283,6 @@ static void write_component_probs(
13059
13060 //j=0
13061 {
13062- int j = 0;
13063-
13064 const int c = events [mv_max];
13065
13066 is_short_ct [0] += c; // Short vector
13067diff --git a/vp8/encoder/encodemv.h b/vp8/encoder/encodemv.h
13068index 1c1f450..bf6d7af 100644
13069--- a/vp8/encoder/encodemv.h
13070+++ b/vp8/encoder/encodemv.h
13071@@ -1,10 +1,11 @@
13072 /*
13073 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13074 *
13075- * Use of this source code is governed by a BSD-style license and patent
13076- * grant that can be found in the LICENSE file in the root of the source
13077- * tree. All contributing project authors may be found in the AUTHORS
13078- * file in the root of the source tree.
13079+ * Use of this source code is governed by a BSD-style license
13080+ * that can be found in the LICENSE file in the root of the source
13081+ * tree. An additional intellectual property rights grant can be found
13082+ * in the file PATENTS. All contributing project authors may
13083+ * be found in the AUTHORS file in the root of the source tree.
13084 */
13085
13086
13087diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c
13088index a0b50d2..11b1936 100644
13089--- a/vp8/encoder/ethreading.c
13090+++ b/vp8/encoder/ethreading.c
13091@@ -1,10 +1,11 @@
13092 /*
13093 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13094 *
13095- * Use of this source code is governed by a BSD-style license and patent
13096- * grant that can be found in the LICENSE file in the root of the source
13097- * tree. All contributing project authors may be found in the AUTHORS
13098- * file in the root of the source tree.
13099+ * Use of this source code is governed by a BSD-style license
13100+ * that can be found in the LICENSE file in the root of the source
13101+ * tree. An additional intellectual property rights grant can be found
13102+ * in the file PATENTS. All contributing project authors may
13103+ * be found in the AUTHORS file in the root of the source tree.
13104 */
13105
13106
13107@@ -259,10 +260,8 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc)
13108 z->short_fdct4x4rd = x->short_fdct4x4rd;
13109 z->short_fdct8x4rd = x->short_fdct8x4rd;
13110 z->short_fdct8x4rd = x->short_fdct8x4rd;
13111- z->vp8_short_fdct4x4_ptr = x->vp8_short_fdct4x4_ptr;
13112 z->short_walsh4x4 = x->short_walsh4x4;
13113 z->quantize_b = x->quantize_b;
13114- z->quantize_brd = x->quantize_brd;
13115
13116 /*
13117 z->mvc = x->mvc;
13118diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
13119index c519080..ced2d7c 100644
13120--- a/vp8/encoder/firstpass.c
13121+++ b/vp8/encoder/firstpass.c
13122@@ -1,10 +1,11 @@
13123 /*
13124 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13125 *
13126- * Use of this source code is governed by a BSD-style license and patent
13127- * grant that can be found in the LICENSE file in the root of the source
13128- * tree. All contributing project authors may be found in the AUTHORS
13129- * file in the root of the source tree.
13130+ * Use of this source code is governed by a BSD-style license
13131+ * that can be found in the LICENSE file in the root of the source
13132+ * tree. An additional intellectual property rights grant can be found
13133+ * in the file PATENTS. All contributing project authors may
13134+ * be found in the AUTHORS file in the root of the source tree.
13135 */
13136
13137
13138@@ -175,7 +176,6 @@ static double calculate_modified_err(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
13139 double vp8_simple_weight(YV12_BUFFER_CONFIG *source)
13140 {
13141 int i, j;
13142- int Total = 0;
13143
13144 unsigned char *src = source->y_buffer;
13145 unsigned char value;
13146@@ -779,7 +779,6 @@ void vp8_first_pass(VP8_COMP *cpi)
13147 vp8_clear_system_state(); //__asm emms;
13148 {
13149 double weight = 0.0;
13150- double weigth2 = 0.0;
13151
13152 FIRSTPASS_STATS fps;
13153
13154@@ -1193,7 +1192,6 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
13155 FIRSTPASS_STATS next_frame;
13156 FIRSTPASS_STATS *start_pos;
13157 int i;
13158- int count = 0;
13159 int image_size = cpi->common.last_frame.y_width * cpi->common.last_frame.y_height;
13160 double boost_score = 0.0;
13161 double old_boost_score = 0.0;
13162@@ -1234,6 +1232,8 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
13163
13164 start_pos = cpi->stats_in;
13165
13166+ vpx_memset(&next_frame, 0, sizeof(next_frame)); // assure clean
13167+
13168 // Preload the stats for the next frame.
13169 mod_frame_err = calculate_modified_err(cpi, this_frame);
13170
13171@@ -1871,6 +1871,18 @@ void vp8_second_pass(VP8_COMP *cpi)
13172 }
13173 }
13174
13175+ // Keep a globally available copy of this and the next frame's iiratio.
13176+ cpi->this_iiratio = this_frame_intra_error /
13177+ DOUBLE_DIVIDE_CHECK(this_frame_coded_error);
13178+ {
13179+ FIRSTPASS_STATS next_frame;
13180+ if ( lookup_next_frame_stats(cpi, &next_frame) != EOF )
13181+ {
13182+ cpi->next_iiratio = next_frame.intra_error /
13183+ DOUBLE_DIVIDE_CHECK(next_frame.coded_error);
13184+ }
13185+ }
13186+
13187 // Set nominal per second bandwidth for this frame
13188 cpi->target_bandwidth = cpi->per_frame_bandwidth * cpi->output_frame_rate;
13189 if (cpi->target_bandwidth < 0)
13190@@ -2028,6 +2040,8 @@ void vp8_find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
13191 double kf_group_coded_err = 0.0;
13192 double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
13193
13194+ vpx_memset(&next_frame, 0, sizeof(next_frame)); // assure clean
13195+
13196 vp8_clear_system_state(); //__asm emms;
13197 start_position = cpi->stats_in;
13198
13199diff --git a/vp8/encoder/firstpass.h b/vp8/encoder/firstpass.h
13200index d7b52f3..48257ce 100644
13201--- a/vp8/encoder/firstpass.h
13202+++ b/vp8/encoder/firstpass.h
13203@@ -1,10 +1,11 @@
13204 /*
13205 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13206 *
13207- * Use of this source code is governed by a BSD-style license and patent
13208- * grant that can be found in the LICENSE file in the root of the source
13209- * tree. All contributing project authors may be found in the AUTHORS
13210- * file in the root of the source tree.
13211+ * Use of this source code is governed by a BSD-style license
13212+ * that can be found in the LICENSE file in the root of the source
13213+ * tree. An additional intellectual property rights grant can be found
13214+ * in the file PATENTS. All contributing project authors may
13215+ * be found in the AUTHORS file in the root of the source tree.
13216 */
13217
13218
13219diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c
13220index 52aab66..96028b3 100644
13221--- a/vp8/encoder/generic/csystemdependent.c
13222+++ b/vp8/encoder/generic/csystemdependent.c
13223@@ -1,10 +1,11 @@
13224 /*
13225 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13226 *
13227- * Use of this source code is governed by a BSD-style license and patent
13228- * grant that can be found in the LICENSE file in the root of the source
13229- * tree. All contributing project authors may be found in the AUTHORS
13230- * file in the root of the source tree.
13231+ * Use of this source code is governed by a BSD-style license
13232+ * that can be found in the LICENSE file in the root of the source
13233+ * tree. An additional intellectual property rights grant can be found
13234+ * in the file PATENTS. All contributing project authors may
13235+ * be found in the AUTHORS file in the root of the source tree.
13236 */
13237
13238
13239diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c
13240index d80059d..3c1507f 100644
13241--- a/vp8/encoder/mcomp.c
13242+++ b/vp8/encoder/mcomp.c
13243@@ -1,10 +1,11 @@
13244 /*
13245 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13246 *
13247- * Use of this source code is governed by a BSD-style license and patent
13248- * grant that can be found in the LICENSE file in the root of the source
13249- * tree. All contributing project authors may be found in the AUTHORS
13250- * file in the root of the source tree.
13251+ * Use of this source code is governed by a BSD-style license
13252+ * that can be found in the LICENSE file in the root of the source
13253+ * tree. An additional intellectual property rights grant can be found
13254+ * in the file PATENTS. All contributing project authors may
13255+ * be found in the AUTHORS file in the root of the source tree.
13256 */
13257
13258
13259@@ -1137,7 +1138,6 @@ int vp8_diamond_search_sadx4
13260 }
13261
13262
13263-#if !(CONFIG_REALTIME_ONLY)
13264 int vp8_full_search_sad(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *ref_mv, int error_per_bit, int distance, vp8_variance_fn_ptr_t *fn_ptr, int *mvcost[2], int *mvsadcost[2])
13265 {
13266 unsigned char *what = (*(b->base_src) + b->src);
13267@@ -1350,7 +1350,6 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *ref_mv, int er
13268 else
13269 return INT_MAX;
13270 }
13271-#endif
13272
13273 #ifdef ENTROPY_STATS
13274 void print_mode_context(void)
13275diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h
13276index 921206f..40cbb07 100644
13277--- a/vp8/encoder/mcomp.h
13278+++ b/vp8/encoder/mcomp.h
13279@@ -1,10 +1,11 @@
13280 /*
13281 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13282 *
13283- * Use of this source code is governed by a BSD-style license and patent
13284- * grant that can be found in the LICENSE file in the root of the source
13285- * tree. All contributing project authors may be found in the AUTHORS
13286- * file in the root of the source tree.
13287+ * Use of this source code is governed by a BSD-style license
13288+ * that can be found in the LICENSE file in the root of the source
13289+ * tree. An additional intellectual property rights grant can be found
13290+ * in the file PATENTS. All contributing project authors may
13291+ * be found in the AUTHORS file in the root of the source tree.
13292 */
13293
13294
13295diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c
13296index 73170cf..6632a36 100644
13297--- a/vp8/encoder/modecosts.c
13298+++ b/vp8/encoder/modecosts.c
13299@@ -1,10 +1,11 @@
13300 /*
13301 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13302 *
13303- * Use of this source code is governed by a BSD-style license and patent
13304- * grant that can be found in the LICENSE file in the root of the source
13305- * tree. All contributing project authors may be found in the AUTHORS
13306- * file in the root of the source tree.
13307+ * Use of this source code is governed by a BSD-style license
13308+ * that can be found in the LICENSE file in the root of the source
13309+ * tree. An additional intellectual property rights grant can be found
13310+ * in the file PATENTS. All contributing project authors may
13311+ * be found in the AUTHORS file in the root of the source tree.
13312 */
13313
13314
13315diff --git a/vp8/encoder/modecosts.h b/vp8/encoder/modecosts.h
13316index 5ade265..0c46acd 100644
13317--- a/vp8/encoder/modecosts.h
13318+++ b/vp8/encoder/modecosts.h
13319@@ -1,10 +1,11 @@
13320 /*
13321 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13322 *
13323- * Use of this source code is governed by a BSD-style license and patent
13324- * grant that can be found in the LICENSE file in the root of the source
13325- * tree. All contributing project authors may be found in the AUTHORS
13326- * file in the root of the source tree.
13327+ * Use of this source code is governed by a BSD-style license
13328+ * that can be found in the LICENSE file in the root of the source
13329+ * tree. An additional intellectual property rights grant can be found
13330+ * in the file PATENTS. All contributing project authors may
13331+ * be found in the AUTHORS file in the root of the source tree.
13332 */
13333
13334
13335diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
13336index 7662720..98827f9 100644
13337--- a/vp8/encoder/onyx_if.c
13338+++ b/vp8/encoder/onyx_if.c
13339@@ -1,10 +1,11 @@
13340 /*
13341 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13342 *
13343- * Use of this source code is governed by a BSD-style license and patent
13344- * grant that can be found in the LICENSE file in the root of the source
13345- * tree. All contributing project authors may be found in the AUTHORS
13346- * file in the root of the source tree.
13347+ * Use of this source code is governed by a BSD-style license
13348+ * that can be found in the LICENSE file in the root of the source
13349+ * tree. An additional intellectual property rights grant can be found
13350+ * in the file PATENTS. All contributing project authors may
13351+ * be found in the AUTHORS file in the root of the source tree.
13352 */
13353
13354
13355@@ -281,7 +282,6 @@ static void segmentation_test_function(VP8_PTR ptr)
13356
13357 unsigned char *seg_map;
13358 signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
13359- int i, j;
13360
13361 // Create a temporary map for segmentation data.
13362 CHECK_MEM_ERROR(seg_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
13363@@ -811,7 +811,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
13364 sf->full_freq[1] = 31;
13365 sf->search_method = NSTEP;
13366
13367- if (!cpi->ref_frame_flags & VP8_LAST_FLAG)
13368+ if (!(cpi->ref_frame_flags & VP8_LAST_FLAG))
13369 {
13370 sf->thresh_mult[THR_NEWMV ] = INT_MAX;
13371 sf->thresh_mult[THR_NEARESTMV] = INT_MAX;
13372@@ -820,7 +820,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
13373 sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
13374 }
13375
13376- if (!cpi->ref_frame_flags & VP8_GOLD_FLAG)
13377+ if (!(cpi->ref_frame_flags & VP8_GOLD_FLAG))
13378 {
13379 sf->thresh_mult[THR_NEARESTG ] = INT_MAX;
13380 sf->thresh_mult[THR_ZEROG ] = INT_MAX;
13381@@ -829,7 +829,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
13382 sf->thresh_mult[THR_SPLITG ] = INT_MAX;
13383 }
13384
13385- if (!cpi->ref_frame_flags & VP8_ALT_FLAG)
13386+ if (!(cpi->ref_frame_flags & VP8_ALT_FLAG))
13387 {
13388 sf->thresh_mult[THR_NEARESTA ] = INT_MAX;
13389 sf->thresh_mult[THR_ZEROA ] = INT_MAX;
13390@@ -1144,18 +1144,15 @@ void vp8_set_speed_features(VP8_COMP *cpi)
13391 cpi->mb.short_fdct4x4rd = FDCT_INVOKE(&cpi->rtcd.fdct, fast4x4);
13392 }
13393
13394- cpi->mb.vp8_short_fdct4x4_ptr = FDCT_INVOKE(&cpi->rtcd.fdct, short4x4);
13395 cpi->mb.short_walsh4x4 = FDCT_INVOKE(&cpi->rtcd.fdct, walsh_short4x4);
13396
13397 if (cpi->sf.improved_quant)
13398 {
13399 cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, quantb);
13400- cpi->mb.quantize_brd = QUANTIZE_INVOKE(&cpi->rtcd.quantize, quantb);
13401 }
13402 else
13403 {
13404 cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, fastquantb);
13405- cpi->mb.quantize_brd = QUANTIZE_INVOKE(&cpi->rtcd.quantize, fastquantb);
13406 }
13407
13408 #if CONFIG_RUNTIME_CPU_DETECT
13409@@ -2252,7 +2249,7 @@ void vp8_remove_compressor(VP8_PTR *ptr)
13410 double total_psnr2 = vp8_mse2psnr(samples, 255.0, cpi->total_sq_error2);
13411 double total_ssim = 100 * pow(cpi->summed_quality / cpi->summed_weights, 8.0);
13412
13413- fprintf(f, "Bitrate\AVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\tVPXSSIM\t Time(us)\n");
13414+ fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\tVPXSSIM\t Time(us)\n");
13415 fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f %8.0f\n",
13416 dr, cpi->total / cpi->count, total_psnr, cpi->totalp / cpi->count, total_psnr2, total_ssim,
13417 total_encode_time);
13418@@ -4739,7 +4736,6 @@ void vp8_check_gf_quality(VP8_COMP *cpi)
13419 #if !(CONFIG_REALTIME_ONLY)
13420 static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
13421 {
13422- double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
13423
13424 if (!cpi->common.refresh_alt_ref_frame)
13425 vp8_second_pass(cpi);
13426@@ -4748,7 +4744,11 @@ static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
13427 cpi->bits_left -= 8 * *size;
13428
13429 if (!cpi->common.refresh_alt_ref_frame)
13430+ {
13431+ double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
13432+ *cpi->oxcf.two_pass_vbrmin_section / 100);
13433 cpi->bits_left += (long long)(two_pass_min_rate / cpi->oxcf.frame_rate);
13434+ }
13435 }
13436 #endif
13437
13438@@ -5402,7 +5402,7 @@ int vp8_calc_low_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, co
13439 {
13440 for (j = 0; j < source->y_width; j += 16)
13441 {
13442- unsigned int sse, sse2, sum2;
13443+ unsigned int sse;
13444 VARIANCE_INVOKE(rtcd, mse16x16)(src + j, source->y_stride, dst + j, dest->y_stride, &sse);
13445
13446 if (sse < 8096)
13447diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
13448index 29b120e..889bf73 100644
13449--- a/vp8/encoder/onyx_int.h
13450+++ b/vp8/encoder/onyx_int.h
13451@@ -1,10 +1,11 @@
13452 /*
13453 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13454 *
13455- * Use of this source code is governed by a BSD-style license and patent
13456- * grant that can be found in the LICENSE file in the root of the source
13457- * tree. All contributing project authors may be found in the AUTHORS
13458- * file in the root of the source tree.
13459+ * Use of this source code is governed by a BSD-style license
13460+ * that can be found in the LICENSE file in the root of the source
13461+ * tree. An additional intellectual property rights grant can be found
13462+ * in the file PATENTS. All contributing project authors may
13463+ * be found in the AUTHORS file in the root of the source tree.
13464 */
13465
13466
13467@@ -25,7 +26,7 @@
13468 #include "entropy.h"
13469 #include "threading.h"
13470 #include "vpx_ports/mem.h"
13471-#include "vpx_codec/internal/vpx_codec_internal.h"
13472+#include "vpx/internal/vpx_codec_internal.h"
13473 #include "mcomp.h"
13474
13475 #define INTRARDOPT
13476@@ -522,8 +523,8 @@ typedef struct
13477 int motion_lvl;
13478 int motion_speed;
13479 int motion_var;
13480- int next_iiratio;
13481- int this_iiratio;
13482+ unsigned int next_iiratio;
13483+ unsigned int this_iiratio;
13484 int this_frame_modified_error;
13485
13486 double norm_intra_err_per_mb;
13487diff --git a/vp8/encoder/parms.cpp b/vp8/encoder/parms.cpp
13488index 66fdafb..d7d30a8 100644
13489--- a/vp8/encoder/parms.cpp
13490+++ b/vp8/encoder/parms.cpp
13491@@ -1,10 +1,11 @@
13492 /*
13493 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13494 *
13495- * Use of this source code is governed by a BSD-style license and patent
13496- * grant that can be found in the LICENSE file in the root of the source
13497- * tree. All contributing project authors may be found in the AUTHORS
13498- * file in the root of the source tree.
13499+ * Use of this source code is governed by a BSD-style license
13500+ * that can be found in the LICENSE file in the root of the source
13501+ * tree. An additional intellectual property rights grant can be found
13502+ * in the file PATENTS. All contributing project authors may
13503+ * be found in the AUTHORS file in the root of the source tree.
13504 */
13505
13506
13507diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
13508index d61e2ce..a50f99b 100644
13509--- a/vp8/encoder/pickinter.c
13510+++ b/vp8/encoder/pickinter.c
13511@@ -1,10 +1,11 @@
13512 /*
13513 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13514 *
13515- * Use of this source code is governed by a BSD-style license and patent
13516- * grant that can be found in the LICENSE file in the root of the source
13517- * tree. All contributing project authors may be found in the AUTHORS
13518- * file in the root of the source tree.
13519+ * Use of this source code is governed by a BSD-style license
13520+ * that can be found in the LICENSE file in the root of the source
13521+ * tree. An additional intellectual property rights grant can be found
13522+ * in the file PATENTS. All contributing project authors may
13523+ * be found in the AUTHORS file in the root of the source tree.
13524 */
13525
13526
13527@@ -453,6 +454,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec
13528 vpx_memset(mode_mv, 0, sizeof(mode_mv));
13529 vpx_memset(nearest_mv, 0, sizeof(nearest_mv));
13530 vpx_memset(near_mv, 0, sizeof(near_mv));
13531+ vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
13532
13533
13534 // set up all the refframe dependent pointers.
13535diff --git a/vp8/encoder/pickinter.h b/vp8/encoder/pickinter.h
13536index fb28837..76fdb99 100644
13537--- a/vp8/encoder/pickinter.h
13538+++ b/vp8/encoder/pickinter.h
13539@@ -1,10 +1,11 @@
13540 /*
13541 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13542 *
13543- * Use of this source code is governed by a BSD-style license and patent
13544- * grant that can be found in the LICENSE file in the root of the source
13545- * tree. All contributing project authors may be found in the AUTHORS
13546- * file in the root of the source tree.
13547+ * Use of this source code is governed by a BSD-style license
13548+ * that can be found in the LICENSE file in the root of the source
13549+ * tree. An additional intellectual property rights grant can be found
13550+ * in the file PATENTS. All contributing project authors may
13551+ * be found in the AUTHORS file in the root of the source tree.
13552 */
13553
13554
13555diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c
13556index bbd7840..0527b80 100644
13557--- a/vp8/encoder/picklpf.c
13558+++ b/vp8/encoder/picklpf.c
13559@@ -1,10 +1,11 @@
13560 /*
13561 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13562 *
13563- * Use of this source code is governed by a BSD-style license and patent
13564- * grant that can be found in the LICENSE file in the root of the source
13565- * tree. All contributing project authors may be found in the AUTHORS
13566- * file in the root of the source tree.
13567+ * Use of this source code is governed by a BSD-style license
13568+ * that can be found in the LICENSE file in the root of the source
13569+ * tree. An additional intellectual property rights grant can be found
13570+ * in the file PATENTS. All contributing project authors may
13571+ * be found in the AUTHORS file in the root of the source tree.
13572 */
13573
13574
13575diff --git a/vp8/encoder/ppc/csystemdependent.c b/vp8/encoder/ppc/csystemdependent.c
13576index f99277f..66fca8f 100644
13577--- a/vp8/encoder/ppc/csystemdependent.c
13578+++ b/vp8/encoder/ppc/csystemdependent.c
13579@@ -1,10 +1,11 @@
13580 /*
13581 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13582 *
13583- * Use of this source code is governed by a BSD-style license and patent
13584- * grant that can be found in the LICENSE file in the root of the source
13585- * tree. All contributing project authors may be found in the AUTHORS
13586- * file in the root of the source tree.
13587+ * Use of this source code is governed by a BSD-style license
13588+ * that can be found in the LICENSE file in the root of the source
13589+ * tree. An additional intellectual property rights grant can be found
13590+ * in the file PATENTS. All contributing project authors may
13591+ * be found in the AUTHORS file in the root of the source tree.
13592 */
13593
13594
13595diff --git a/vp8/encoder/ppc/encodemb_altivec.asm b/vp8/encoder/ppc/encodemb_altivec.asm
13596index e0e976d..14a36a1 100644
13597--- a/vp8/encoder/ppc/encodemb_altivec.asm
13598+++ b/vp8/encoder/ppc/encodemb_altivec.asm
13599@@ -1,10 +1,11 @@
13600 ;
13601 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13602 ;
13603-; Use of this source code is governed by a BSD-style license and patent
13604-; grant that can be found in the LICENSE file in the root of the source
13605-; tree. All contributing project authors may be found in the AUTHORS
13606-; file in the root of the source tree.
13607+; Use of this source code is governed by a BSD-style license
13608+; that can be found in the LICENSE file in the root of the source
13609+; tree. An additional intellectual property rights grant can be found
13610+; in the file PATENTS. All contributing project authors may
13611+; be found in the AUTHORS file in the root of the source tree.
13612 ;
13613
13614
13615diff --git a/vp8/encoder/ppc/fdct_altivec.asm b/vp8/encoder/ppc/fdct_altivec.asm
13616index eaab14c..01f3364 100644
13617--- a/vp8/encoder/ppc/fdct_altivec.asm
13618+++ b/vp8/encoder/ppc/fdct_altivec.asm
13619@@ -1,10 +1,11 @@
13620 ;
13621 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13622 ;
13623-; Use of this source code is governed by a BSD-style license and patent
13624-; grant that can be found in the LICENSE file in the root of the source
13625-; tree. All contributing project authors may be found in the AUTHORS
13626-; file in the root of the source tree.
13627+; Use of this source code is governed by a BSD-style license
13628+; that can be found in the LICENSE file in the root of the source
13629+; tree. An additional intellectual property rights grant can be found
13630+; in the file PATENTS. All contributing project authors may
13631+; be found in the AUTHORS file in the root of the source tree.
13632 ;
13633
13634
13635diff --git a/vp8/encoder/ppc/rdopt_altivec.asm b/vp8/encoder/ppc/rdopt_altivec.asm
13636index 917bfe0..4f9b050 100644
13637--- a/vp8/encoder/ppc/rdopt_altivec.asm
13638+++ b/vp8/encoder/ppc/rdopt_altivec.asm
13639@@ -1,10 +1,11 @@
13640 ;
13641 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13642 ;
13643-; Use of this source code is governed by a BSD-style license and patent
13644-; grant that can be found in the LICENSE file in the root of the source
13645-; tree. All contributing project authors may be found in the AUTHORS
13646-; file in the root of the source tree.
13647+; Use of this source code is governed by a BSD-style license
13648+; that can be found in the LICENSE file in the root of the source
13649+; tree. An additional intellectual property rights grant can be found
13650+; in the file PATENTS. All contributing project authors may
13651+; be found in the AUTHORS file in the root of the source tree.
13652 ;
13653
13654
13655diff --git a/vp8/encoder/ppc/sad_altivec.asm b/vp8/encoder/ppc/sad_altivec.asm
13656index 1102ccf..6d92728 100644
13657--- a/vp8/encoder/ppc/sad_altivec.asm
13658+++ b/vp8/encoder/ppc/sad_altivec.asm
13659@@ -1,10 +1,11 @@
13660 ;
13661 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13662 ;
13663-; Use of this source code is governed by a BSD-style license and patent
13664-; grant that can be found in the LICENSE file in the root of the source
13665-; tree. All contributing project authors may be found in the AUTHORS
13666-; file in the root of the source tree.
13667+; Use of this source code is governed by a BSD-style license
13668+; that can be found in the LICENSE file in the root of the source
13669+; tree. An additional intellectual property rights grant can be found
13670+; in the file PATENTS. All contributing project authors may
13671+; be found in the AUTHORS file in the root of the source tree.
13672 ;
13673
13674
13675diff --git a/vp8/encoder/ppc/variance_altivec.asm b/vp8/encoder/ppc/variance_altivec.asm
13676index 952bf72..4e3fd59 100644
13677--- a/vp8/encoder/ppc/variance_altivec.asm
13678+++ b/vp8/encoder/ppc/variance_altivec.asm
13679@@ -1,10 +1,11 @@
13680 ;
13681 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13682 ;
13683-; Use of this source code is governed by a BSD-style license and patent
13684-; grant that can be found in the LICENSE file in the root of the source
13685-; tree. All contributing project authors may be found in the AUTHORS
13686-; file in the root of the source tree.
13687+; Use of this source code is governed by a BSD-style license
13688+; that can be found in the LICENSE file in the root of the source
13689+; tree. An additional intellectual property rights grant can be found
13690+; in the file PATENTS. All contributing project authors may
13691+; be found in the AUTHORS file in the root of the source tree.
13692 ;
13693
13694
13695diff --git a/vp8/encoder/ppc/variance_subpixel_altivec.asm b/vp8/encoder/ppc/variance_subpixel_altivec.asm
13696index 148a8d2..4dcf7e4 100644
13697--- a/vp8/encoder/ppc/variance_subpixel_altivec.asm
13698+++ b/vp8/encoder/ppc/variance_subpixel_altivec.asm
13699@@ -1,10 +1,11 @@
13700 ;
13701 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13702 ;
13703-; Use of this source code is governed by a BSD-style license and patent
13704-; grant that can be found in the LICENSE file in the root of the source
13705-; tree. All contributing project authors may be found in the AUTHORS
13706-; file in the root of the source tree.
13707+; Use of this source code is governed by a BSD-style license
13708+; that can be found in the LICENSE file in the root of the source
13709+; tree. An additional intellectual property rights grant can be found
13710+; in the file PATENTS. All contributing project authors may
13711+; be found in the AUTHORS file in the root of the source tree.
13712 ;
13713
13714
13715diff --git a/vp8/encoder/preproc.c b/vp8/encoder/preproc.c
13716index d2a13dc..e9cc075 100644
13717--- a/vp8/encoder/preproc.c
13718+++ b/vp8/encoder/preproc.c
13719@@ -1,10 +1,11 @@
13720 /*
13721 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13722 *
13723- * Use of this source code is governed by a BSD-style license and patent
13724- * grant that can be found in the LICENSE file in the root of the source
13725- * tree. All contributing project authors may be found in the AUTHORS
13726- * file in the root of the source tree.
13727+ * Use of this source code is governed by a BSD-style license
13728+ * that can be found in the LICENSE file in the root of the source
13729+ * tree. An additional intellectual property rights grant can be found
13730+ * in the file PATENTS. All contributing project authors may
13731+ * be found in the AUTHORS file in the root of the source tree.
13732 */
13733
13734
13735diff --git a/vp8/encoder/psnr.c b/vp8/encoder/psnr.c
13736index 0e34cec..c5e9dad 100644
13737--- a/vp8/encoder/psnr.c
13738+++ b/vp8/encoder/psnr.c
13739@@ -1,10 +1,11 @@
13740 /*
13741 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13742 *
13743- * Use of this source code is governed by a BSD-style license and patent
13744- * grant that can be found in the LICENSE file in the root of the source
13745- * tree. All contributing project authors may be found in the AUTHORS
13746- * file in the root of the source tree.
13747+ * Use of this source code is governed by a BSD-style license
13748+ * that can be found in the LICENSE file in the root of the source
13749+ * tree. An additional intellectual property rights grant can be found
13750+ * in the file PATENTS. All contributing project authors may
13751+ * be found in the AUTHORS file in the root of the source tree.
13752 */
13753
13754
13755diff --git a/vp8/encoder/psnr.h b/vp8/encoder/psnr.h
13756index 9f6ca0b..dd0b4e5 100644
13757--- a/vp8/encoder/psnr.h
13758+++ b/vp8/encoder/psnr.h
13759@@ -1,10 +1,11 @@
13760 /*
13761 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13762 *
13763- * Use of this source code is governed by a BSD-style license and patent
13764- * grant that can be found in the LICENSE file in the root of the source
13765- * tree. All contributing project authors may be found in the AUTHORS
13766- * file in the root of the source tree.
13767+ * Use of this source code is governed by a BSD-style license
13768+ * that can be found in the LICENSE file in the root of the source
13769+ * tree. An additional intellectual property rights grant can be found
13770+ * in the file PATENTS. All contributing project authors may
13771+ * be found in the AUTHORS file in the root of the source tree.
13772 */
13773
13774
13775diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c
13776index 6028ebf..73e80e3 100644
13777--- a/vp8/encoder/quantize.c
13778+++ b/vp8/encoder/quantize.c
13779@@ -1,10 +1,11 @@
13780 /*
13781 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13782 *
13783- * Use of this source code is governed by a BSD-style license and patent
13784- * grant that can be found in the LICENSE file in the root of the source
13785- * tree. All contributing project authors may be found in the AUTHORS
13786- * file in the root of the source tree.
13787+ * Use of this source code is governed by a BSD-style license
13788+ * that can be found in the LICENSE file in the root of the source
13789+ * tree. An additional intellectual property rights grant can be found
13790+ * in the file PATENTS. All contributing project authors may
13791+ * be found in the AUTHORS file in the root of the source tree.
13792 */
13793
13794
13795@@ -55,9 +56,7 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
13796 }
13797 }
13798 }
13799-
13800 d->eob = eob + 1;
13801-
13802 }
13803
13804 void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d)
13805@@ -111,61 +110,40 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d)
13806
13807 d->eob = eob + 1;
13808 }
13809+
13810 void vp8_quantize_mby(MACROBLOCK *x)
13811 {
13812 int i;
13813+ int has_2nd_order = (x->e_mbd.mbmi.mode != B_PRED
13814+ && x->e_mbd.mbmi.mode != SPLITMV);
13815
13816- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
13817+ for (i = 0; i < 16; i++)
13818 {
13819- for (i = 0; i < 16; i++)
13820- {
13821- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13822- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
13823- }
13824+ x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13825+ x->e_mbd.mbmi.mb_skip_coeff &=
13826+ (x->e_mbd.block[i].eob <= has_2nd_order);
13827+ }
13828
13829+ if(has_2nd_order)
13830+ {
13831 x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
13832 x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob);
13833-
13834- }
13835- else
13836- {
13837- for (i = 0; i < 16; i++)
13838- {
13839- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13840- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13841- }
13842 }
13843 }
13844
13845 void vp8_quantize_mb(MACROBLOCK *x)
13846 {
13847 int i;
13848+ int has_2nd_order=(x->e_mbd.mbmi.mode != B_PRED
13849+ && x->e_mbd.mbmi.mode != SPLITMV);
13850
13851 x->e_mbd.mbmi.mb_skip_coeff = 1;
13852-
13853- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
13854+ for (i = 0; i < 24+has_2nd_order; i++)
13855 {
13856- for (i = 0; i < 16; i++)
13857- {
13858- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13859- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
13860- }
13861-
13862- for (i = 16; i < 25; i++)
13863- {
13864- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13865- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13866- }
13867- }
13868- else
13869- {
13870- for (i = 0; i < 24; i++)
13871- {
13872- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13873- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13874- }
13875+ x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
13876+ x->e_mbd.mbmi.mb_skip_coeff &=
13877+ (x->e_mbd.block[i].eob <= (has_2nd_order && i<16));
13878 }
13879-
13880 }
13881
13882
13883@@ -179,71 +157,3 @@ void vp8_quantize_mbuv(MACROBLOCK *x)
13884 x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13885 }
13886 }
13887-
13888-// This function is not currently called
13889-void vp8_quantize_mbrd(MACROBLOCK *x)
13890-{
13891- int i;
13892-
13893- x->e_mbd.mbmi.mb_skip_coeff = 1;
13894-
13895- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
13896- {
13897- for (i = 0; i < 16; i++)
13898- {
13899- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
13900- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
13901- }
13902-
13903- for (i = 16; i < 25; i++)
13904- {
13905- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
13906- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13907- }
13908- }
13909- else
13910- {
13911- for (i = 0; i < 24; i++)
13912- {
13913- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
13914- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13915- }
13916- }
13917-}
13918-
13919-void vp8_quantize_mbuvrd(MACROBLOCK *x)
13920-{
13921- int i;
13922-
13923- for (i = 16; i < 24; i++)
13924- {
13925- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
13926- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13927- }
13928-}
13929-
13930-void vp8_quantize_mbyrd(MACROBLOCK *x)
13931-{
13932- int i;
13933-
13934- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
13935- {
13936- for (i = 0; i < 16; i++)
13937- {
13938- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
13939- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
13940- }
13941-
13942- x->quantize_brd(&x->block[24], &x->e_mbd.block[24]);
13943- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob);
13944-
13945- }
13946- else
13947- {
13948- for (i = 0; i < 16; i++)
13949- {
13950- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
13951- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
13952- }
13953- }
13954-}
13955diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h
13956index 868e8e3..ca073ef 100644
13957--- a/vp8/encoder/quantize.h
13958+++ b/vp8/encoder/quantize.h
13959@@ -1,10 +1,11 @@
13960 /*
13961 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
13962 *
13963- * Use of this source code is governed by a BSD-style license and patent
13964- * grant that can be found in the LICENSE file in the root of the source
13965- * tree. All contributing project authors may be found in the AUTHORS
13966- * file in the root of the source tree.
13967+ * Use of this source code is governed by a BSD-style license
13968+ * that can be found in the LICENSE file in the root of the source
13969+ * tree. An additional intellectual property rights grant can be found
13970+ * in the file PATENTS. All contributing project authors may
13971+ * be found in the AUTHORS file in the root of the source tree.
13972 */
13973
13974
13975@@ -16,6 +17,10 @@
13976 #define prototype_quantize_block(sym) \
13977 void (sym)(BLOCK *b,BLOCKD *d)
13978
13979+#if ARCH_X86 || ARCH_X86_64
13980+#include "x86/quantize_x86.h"
13981+#endif
13982+
13983 #if ARCH_ARM
13984 #include "arm/quantize_arm.h"
13985 #endif
13986@@ -45,8 +50,5 @@ typedef struct
13987 extern void vp8_quantize_mb(MACROBLOCK *x);
13988 extern void vp8_quantize_mbuv(MACROBLOCK *x);
13989 extern void vp8_quantize_mby(MACROBLOCK *x);
13990-extern void vp8_quantize_mbyrd(MACROBLOCK *x);
13991-extern void vp8_quantize_mbuvrd(MACROBLOCK *x);
13992-extern void vp8_quantize_mbrd(MACROBLOCK *x);
13993
13994 #endif
13995diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
13996index 05040d3..944a2e8 100644
13997--- a/vp8/encoder/ratectrl.c
13998+++ b/vp8/encoder/ratectrl.c
13999@@ -1,10 +1,11 @@
14000 /*
14001 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14002 *
14003- * Use of this source code is governed by a BSD-style license and patent
14004- * grant that can be found in the LICENSE file in the root of the source
14005- * tree. All contributing project authors may be found in the AUTHORS
14006- * file in the root of the source tree.
14007+ * Use of this source code is governed by a BSD-style license
14008+ * that can be found in the LICENSE file in the root of the source
14009+ * tree. An additional intellectual property rights grant can be found
14010+ * in the file PATENTS. All contributing project authors may
14011+ * be found in the AUTHORS file in the root of the source tree.
14012 */
14013
14014
14015@@ -1063,7 +1064,6 @@ void vp8_calc_pframe_target_size(VP8_COMP *cpi)
14016
14017 if (cpi->common.refresh_golden_frame == TRUE)
14018 {
14019- int isize_adjustment = 0;
14020 #if 0
14021
14022 if (0) // p_gw
14023@@ -1119,8 +1119,9 @@ void vp8_calc_pframe_target_size(VP8_COMP *cpi)
14024 cpi->this_frame_target = (baseline_bits_at_q(1, Q, cpi->common.MBs) * cpi->last_boost) / 100;
14025
14026 }
14027- // If there is an active ARF at this location use the minimum bits on this frame
14028- else
14029+ // If there is an active ARF at this location use the minimum
14030+ // bits on this frame unless it was a contructed arf.
14031+ else if (cpi->oxcf.arnr_max_frames == 0)
14032 {
14033 cpi->this_frame_target = 0; // Minimial spend on gf that is replacing an arf
14034 }
14035@@ -1171,7 +1172,8 @@ void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var)
14036 while (Z > 0)
14037 {
14038 Z --;
14039- projected_size_based_on_q *= (int)Factor;
14040+ projected_size_based_on_q =
14041+ (int)(Factor * projected_size_based_on_q);
14042 Factor += factor_adjustment;
14043
14044 if (Factor >= 0.999)
14045@@ -1362,7 +1364,8 @@ int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame)
14046 if (cpi->zbin_over_quant > zbin_oqmax)
14047 cpi->zbin_over_quant = zbin_oqmax;
14048
14049- bits_per_mb_at_this_q *= (int)Factor; // Each over-ruin step is assumed to equate to approximately 3% reduction in bitrate
14050+ // Adjust bits_per_mb_at_this_q estimate
14051+ bits_per_mb_at_this_q = (int)(Factor * bits_per_mb_at_this_q);
14052 Factor += factor_adjustment;
14053
14054 if (Factor >= 0.999)
14055diff --git a/vp8/encoder/ratectrl.h b/vp8/encoder/ratectrl.h
14056index 588c7a8..ff5778f 100644
14057--- a/vp8/encoder/ratectrl.h
14058+++ b/vp8/encoder/ratectrl.h
14059@@ -1,10 +1,11 @@
14060 /*
14061 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14062 *
14063- * Use of this source code is governed by a BSD-style license and patent
14064- * grant that can be found in the LICENSE file in the root of the source
14065- * tree. All contributing project authors may be found in the AUTHORS
14066- * file in the root of the source tree.
14067+ * Use of this source code is governed by a BSD-style license
14068+ * that can be found in the LICENSE file in the root of the source
14069+ * tree. An additional intellectual property rights grant can be found
14070+ * in the file PATENTS. All contributing project authors may
14071+ * be found in the AUTHORS file in the root of the source tree.
14072 */
14073
14074
14075diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
14076index 0846996..9a772a7 100644
14077--- a/vp8/encoder/rdopt.c
14078+++ b/vp8/encoder/rdopt.c
14079@@ -1,10 +1,11 @@
14080 /*
14081 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14082 *
14083- * Use of this source code is governed by a BSD-style license and patent
14084- * grant that can be found in the LICENSE file in the root of the source
14085- * tree. All contributing project authors may be found in the AUTHORS
14086- * file in the root of the source tree.
14087+ * Use of this source code is governed by a BSD-style license
14088+ * that can be found in the LICENSE file in the root of the source
14089+ * tree. An additional intellectual property rights grant can be found
14090+ * in the file PATENTS. All contributing project authors may
14091+ * be found in the AUTHORS file in the root of the source tree.
14092 */
14093
14094
14095@@ -170,15 +171,13 @@ static void fill_token_costs(
14096
14097 }
14098
14099-static int rd_iifactor [ 32 ] = { 16, 16, 16, 12, 8, 4, 2, 0,
14100+static int rd_iifactor [ 32 ] = { 4, 4, 3, 2, 1, 0, 0, 0,
14101 0, 0, 0, 0, 0, 0, 0, 0,
14102 0, 0, 0, 0, 0, 0, 0, 0,
14103 0, 0, 0, 0, 0, 0, 0, 0,
14104 };
14105
14106
14107-
14108-
14109 // The values in this table should be reviewed
14110 static int sad_per_bit16lut[128] =
14111 {
14112@@ -237,36 +236,32 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
14113
14114 vp8_clear_system_state(); //__asm emms;
14115
14116- cpi->RDMULT = (int)((0.00007 * (capped_q * capped_q * capped_q * capped_q)) - (0.0125 * (capped_q * capped_q * capped_q)) +
14117- (2.25 * (capped_q * capped_q)) - (12.5 * capped_q) + 25.0);
14118+ cpi->RDMULT = (int)( (0.0001 * (capped_q * capped_q * capped_q * capped_q))
14119+ -(0.015 * (capped_q * capped_q * capped_q))
14120+ +(3.25 * (capped_q * capped_q))
14121+ -(17.5 * capped_q) + 125.0);
14122
14123- if (cpi->RDMULT < 25)
14124- cpi->RDMULT = 25;
14125+ if (cpi->RDMULT < 125)
14126+ cpi->RDMULT = 125;
14127
14128- if (cpi->pass == 2)
14129+ if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME))
14130 {
14131- if (cpi->common.frame_type == KEY_FRAME)
14132- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[0]) / 16;
14133- else if (cpi->next_iiratio > 31)
14134- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) / 16;
14135+ if (cpi->next_iiratio > 31)
14136+ cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) >> 4;
14137 else
14138- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->next_iiratio]) / 16;
14139+ cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->next_iiratio]) >> 4;
14140 }
14141
14142
14143 // Extend rate multiplier along side quantizer zbin increases
14144 if (cpi->zbin_over_quant > 0)
14145 {
14146- // Extend rate multiplier along side quantizer zbin increases
14147- if (cpi->zbin_over_quant > 0)
14148- {
14149- double oq_factor = pow(1.006, cpi->zbin_over_quant);
14150+ double oq_factor = pow(1.006, cpi->zbin_over_quant);
14151
14152- if (oq_factor > (1.0 + ((double)cpi->zbin_over_quant / 64.0)))
14153- oq_factor = (1.0 + (double)cpi->zbin_over_quant / 64.0);
14154+ if (oq_factor > (1.0 + ((double)cpi->zbin_over_quant / 64.0)))
14155+ oq_factor = (1.0 + (double)cpi->zbin_over_quant / 64.0);
14156
14157- cpi->RDMULT *= (int)oq_factor;
14158- }
14159+ cpi->RDMULT = (int)(oq_factor * cpi->RDMULT);
14160 }
14161
14162 cpi->mb.errorperbit = (cpi->RDMULT / 100);
14163@@ -1037,7 +1032,7 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels
14164
14165 // set to 0 no way to account for 2nd order DC so discount
14166 //be->coeff[0] = 0;
14167- x->quantize_brd(be, bd);
14168+ x->quantize_b(be, bd);
14169
14170 distortion += ENCODEMB_INVOKE(rtcd, berr)(be->coeff, bd->dqcoeff);
14171 }
14172@@ -1075,7 +1070,7 @@ static void macro_block_yrd(MACROBLOCK *mb, int *Rate, int *Distortion, const vp
14173 // Quantization
14174 for (b = 0; b < 16; b++)
14175 {
14176- mb->quantize_brd(&mb->block[b], &mb->e_mbd.block[b]);
14177+ mb->quantize_b(&mb->block[b], &mb->e_mbd.block[b]);
14178 }
14179
14180 // DC predication and Quantization of 2nd Order block
14181@@ -1083,7 +1078,7 @@ static void macro_block_yrd(MACROBLOCK *mb, int *Rate, int *Distortion, const vp
14182 {
14183
14184 {
14185- mb->quantize_brd(mb_y2, x_y2);
14186+ mb->quantize_b(mb_y2, x_y2);
14187 }
14188 }
14189
14190@@ -1130,6 +1125,9 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes
14191 MV bmvs[16];
14192 int beobs[16];
14193
14194+ vpx_memset(beobs, 0, sizeof(beobs));
14195+
14196+
14197 for (segmentation = 0; segmentation < VP8_NUMMBSPLITS; segmentation++)
14198 {
14199 int label_count;
14200@@ -1464,6 +1462,8 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
14201
14202 *returnintra = INT_MAX;
14203
14204+ vpx_memset(&best_mbmode, 0, sizeof(best_mbmode)); // clean
14205+
14206 cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame
14207
14208 x->skip = 0;
14209diff --git a/vp8/encoder/rdopt.h b/vp8/encoder/rdopt.h
14210index c6eae4b..617241d 100644
14211--- a/vp8/encoder/rdopt.h
14212+++ b/vp8/encoder/rdopt.h
14213@@ -1,10 +1,11 @@
14214 /*
14215 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14216 *
14217- * Use of this source code is governed by a BSD-style license and patent
14218- * grant that can be found in the LICENSE file in the root of the source
14219- * tree. All contributing project authors may be found in the AUTHORS
14220- * file in the root of the source tree.
14221+ * Use of this source code is governed by a BSD-style license
14222+ * that can be found in the LICENSE file in the root of the source
14223+ * tree. An additional intellectual property rights grant can be found
14224+ * in the file PATENTS. All contributing project authors may
14225+ * be found in the AUTHORS file in the root of the source tree.
14226 */
14227
14228
14229diff --git a/vp8/encoder/sad_c.c b/vp8/encoder/sad_c.c
14230index 74c6bd7..1914c60 100644
14231--- a/vp8/encoder/sad_c.c
14232+++ b/vp8/encoder/sad_c.c
14233@@ -1,10 +1,11 @@
14234 /*
14235 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14236 *
14237- * Use of this source code is governed by a BSD-style license and patent
14238- * grant that can be found in the LICENSE file in the root of the source
14239- * tree. All contributing project authors may be found in the AUTHORS
14240- * file in the root of the source tree.
14241+ * Use of this source code is governed by a BSD-style license
14242+ * that can be found in the LICENSE file in the root of the source
14243+ * tree. An additional intellectual property rights grant can be found
14244+ * in the file PATENTS. All contributing project authors may
14245+ * be found in the AUTHORS file in the root of the source tree.
14246 */
14247
14248
14249diff --git a/vp8/encoder/ssim.c b/vp8/encoder/ssim.c
14250index df214a8..35dd10c 100644
14251--- a/vp8/encoder/ssim.c
14252+++ b/vp8/encoder/ssim.c
14253@@ -1,10 +1,11 @@
14254 /*
14255 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14256 *
14257- * Use of this source code is governed by a BSD-style license and patent
14258- * grant that can be found in the LICENSE file in the root of the source
14259- * tree. All contributing project authors may be found in the AUTHORS
14260- * file in the root of the source tree.
14261+ * Use of this source code is governed by a BSD-style license
14262+ * that can be found in the LICENSE file in the root of the source
14263+ * tree. An additional intellectual property rights grant can be found
14264+ * in the file PATENTS. All contributing project authors may
14265+ * be found in the AUTHORS file in the root of the source tree.
14266 */
14267
14268
14269diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
14270index 33ddd64..819f6a5 100644
14271--- a/vp8/encoder/tokenize.c
14272+++ b/vp8/encoder/tokenize.c
14273@@ -1,10 +1,11 @@
14274 /*
14275 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14276 *
14277- * Use of this source code is governed by a BSD-style license and patent
14278- * grant that can be found in the LICENSE file in the root of the source
14279- * tree. All contributing project authors may be found in the AUTHORS
14280- * file in the root of the source tree.
14281+ * Use of this source code is governed by a BSD-style license
14282+ * that can be found in the LICENSE file in the root of the source
14283+ * tree. An additional intellectual property rights grant can be found
14284+ * in the file PATENTS. All contributing project authors may
14285+ * be found in the AUTHORS file in the root of the source tree.
14286 */
14287
14288
14289diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h
14290index 02aacc2..51f912b 100644
14291--- a/vp8/encoder/tokenize.h
14292+++ b/vp8/encoder/tokenize.h
14293@@ -1,10 +1,11 @@
14294 /*
14295 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14296 *
14297- * Use of this source code is governed by a BSD-style license and patent
14298- * grant that can be found in the LICENSE file in the root of the source
14299- * tree. All contributing project authors may be found in the AUTHORS
14300- * file in the root of the source tree.
14301+ * Use of this source code is governed by a BSD-style license
14302+ * that can be found in the LICENSE file in the root of the source
14303+ * tree. An additional intellectual property rights grant can be found
14304+ * in the file PATENTS. All contributing project authors may
14305+ * be found in the AUTHORS file in the root of the source tree.
14306 */
14307
14308
14309diff --git a/vp8/encoder/treewriter.c b/vp8/encoder/treewriter.c
14310index e398044..942442b 100644
14311--- a/vp8/encoder/treewriter.c
14312+++ b/vp8/encoder/treewriter.c
14313@@ -1,10 +1,11 @@
14314 /*
14315 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14316 *
14317- * Use of this source code is governed by a BSD-style license and patent
14318- * grant that can be found in the LICENSE file in the root of the source
14319- * tree. All contributing project authors may be found in the AUTHORS
14320- * file in the root of the source tree.
14321+ * Use of this source code is governed by a BSD-style license
14322+ * that can be found in the LICENSE file in the root of the source
14323+ * tree. An additional intellectual property rights grant can be found
14324+ * in the file PATENTS. All contributing project authors may
14325+ * be found in the AUTHORS file in the root of the source tree.
14326 */
14327
14328
14329diff --git a/vp8/encoder/treewriter.h b/vp8/encoder/treewriter.h
14330index 05ac74c..075df50 100644
14331--- a/vp8/encoder/treewriter.h
14332+++ b/vp8/encoder/treewriter.h
14333@@ -1,10 +1,11 @@
14334 /*
14335 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14336 *
14337- * Use of this source code is governed by a BSD-style license and patent
14338- * grant that can be found in the LICENSE file in the root of the source
14339- * tree. All contributing project authors may be found in the AUTHORS
14340- * file in the root of the source tree.
14341+ * Use of this source code is governed by a BSD-style license
14342+ * that can be found in the LICENSE file in the root of the source
14343+ * tree. An additional intellectual property rights grant can be found
14344+ * in the file PATENTS. All contributing project authors may
14345+ * be found in the AUTHORS file in the root of the source tree.
14346 */
14347
14348
14349diff --git a/vp8/encoder/variance.h b/vp8/encoder/variance.h
14350index b3b55c3..6610e7d 100644
14351--- a/vp8/encoder/variance.h
14352+++ b/vp8/encoder/variance.h
14353@@ -1,10 +1,11 @@
14354 /*
14355 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14356 *
14357- * Use of this source code is governed by a BSD-style license and patent
14358- * grant that can be found in the LICENSE file in the root of the source
14359- * tree. All contributing project authors may be found in the AUTHORS
14360- * file in the root of the source tree.
14361+ * Use of this source code is governed by a BSD-style license
14362+ * that can be found in the LICENSE file in the root of the source
14363+ * tree. An additional intellectual property rights grant can be found
14364+ * in the file PATENTS. All contributing project authors may
14365+ * be found in the AUTHORS file in the root of the source tree.
14366 */
14367
14368
14369diff --git a/vp8/encoder/variance_c.c b/vp8/encoder/variance_c.c
14370index 85269b9..efcf2b7 100644
14371--- a/vp8/encoder/variance_c.c
14372+++ b/vp8/encoder/variance_c.c
14373@@ -1,10 +1,11 @@
14374 /*
14375 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14376 *
14377- * Use of this source code is governed by a BSD-style license and patent
14378- * grant that can be found in the LICENSE file in the root of the source
14379- * tree. All contributing project authors may be found in the AUTHORS
14380- * file in the root of the source tree.
14381+ * Use of this source code is governed by a BSD-style license
14382+ * that can be found in the LICENSE file in the root of the source
14383+ * tree. An additional intellectual property rights grant can be found
14384+ * in the file PATENTS. All contributing project authors may
14385+ * be found in the AUTHORS file in the root of the source tree.
14386 */
14387
14388
14389diff --git a/vp8/encoder/x86/csystemdependent.c b/vp8/encoder/x86/csystemdependent.c
14390index 186ee68..8bc6877 100644
14391--- a/vp8/encoder/x86/csystemdependent.c
14392+++ b/vp8/encoder/x86/csystemdependent.c
14393@@ -1,10 +1,11 @@
14394 /*
14395 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14396 *
14397- * Use of this source code is governed by a BSD-style license and patent
14398- * grant that can be found in the LICENSE file in the root of the source
14399- * tree. All contributing project authors may be found in the AUTHORS
14400- * file in the root of the source tree.
14401+ * Use of this source code is governed by a BSD-style license
14402+ * that can be found in the LICENSE file in the root of the source
14403+ * tree. An additional intellectual property rights grant can be found
14404+ * in the file PATENTS. All contributing project authors may
14405+ * be found in the AUTHORS file in the root of the source tree.
14406 */
14407
14408
14409diff --git a/vp8/encoder/x86/dct_mmx.asm b/vp8/encoder/x86/dct_mmx.asm
14410index e134237..3dfc47b 100644
14411--- a/vp8/encoder/x86/dct_mmx.asm
14412+++ b/vp8/encoder/x86/dct_mmx.asm
14413@@ -1,10 +1,11 @@
14414 ;
14415 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14416 ;
14417-; Use of this source code is governed by a BSD-style license and patent
14418-; grant that can be found in the LICENSE file in the root of the source
14419-; tree. All contributing project authors may be found in the AUTHORS
14420-; file in the root of the source tree.
14421+; Use of this source code is governed by a BSD-style license
14422+; that can be found in the LICENSE file in the root of the source
14423+; tree. An additional intellectual property rights grant can be found
14424+; in the file PATENTS. All contributing project authors may
14425+; be found in the AUTHORS file in the root of the source tree.
14426 ;
14427
14428
14429diff --git a/vp8/encoder/x86/dct_sse2.asm b/vp8/encoder/x86/dct_sse2.asm
14430index 3e5e9a7..8ddc5d7 100644
14431--- a/vp8/encoder/x86/dct_sse2.asm
14432+++ b/vp8/encoder/x86/dct_sse2.asm
14433@@ -1,10 +1,11 @@
14434 ;
14435 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14436 ;
14437-; Use of this source code is governed by a BSD-style license and patent
14438-; grant that can be found in the LICENSE file in the root of the source
14439-; tree. All contributing project authors may be found in the AUTHORS
14440-; file in the root of the source tree.
14441+; Use of this source code is governed by a BSD-style license
14442+; that can be found in the LICENSE file in the root of the source
14443+; tree. An additional intellectual property rights grant can be found
14444+; in the file PATENTS. All contributing project authors may
14445+; be found in the AUTHORS file in the root of the source tree.
14446 ;
14447
14448
14449diff --git a/vp8/encoder/x86/dct_x86.h b/vp8/encoder/x86/dct_x86.h
14450index bc80e64..fec1a2e 100644
14451--- a/vp8/encoder/x86/dct_x86.h
14452+++ b/vp8/encoder/x86/dct_x86.h
14453@@ -1,10 +1,11 @@
14454 /*
14455 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14456 *
14457- * Use of this source code is governed by a BSD-style license and patent
14458- * grant that can be found in the LICENSE file in the root of the source
14459- * tree. All contributing project authors may be found in the AUTHORS
14460- * file in the root of the source tree.
14461+ * Use of this source code is governed by a BSD-style license
14462+ * that can be found in the LICENSE file in the root of the source
14463+ * tree. An additional intellectual property rights grant can be found
14464+ * in the file PATENTS. All contributing project authors may
14465+ * be found in the AUTHORS file in the root of the source tree.
14466 */
14467
14468
14469diff --git a/vp8/encoder/x86/encodemb_x86.h b/vp8/encoder/x86/encodemb_x86.h
14470index 9397a6c..d1ba7d9 100644
14471--- a/vp8/encoder/x86/encodemb_x86.h
14472+++ b/vp8/encoder/x86/encodemb_x86.h
14473@@ -1,10 +1,11 @@
14474 /*
14475 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14476 *
14477- * Use of this source code is governed by a BSD-style license and patent
14478- * grant that can be found in the LICENSE file in the root of the source
14479- * tree. All contributing project authors may be found in the AUTHORS
14480- * file in the root of the source tree.
14481+ * Use of this source code is governed by a BSD-style license
14482+ * that can be found in the LICENSE file in the root of the source
14483+ * tree. An additional intellectual property rights grant can be found
14484+ * in the file PATENTS. All contributing project authors may
14485+ * be found in the AUTHORS file in the root of the source tree.
14486 */
14487
14488
14489diff --git a/vp8/encoder/x86/encodeopt.asm b/vp8/encoder/x86/encodeopt.asm
14490index 1940471..cdc17a5 100644
14491--- a/vp8/encoder/x86/encodeopt.asm
14492+++ b/vp8/encoder/x86/encodeopt.asm
14493@@ -1,10 +1,11 @@
14494 ;
14495 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14496 ;
14497-; Use of this source code is governed by a BSD-style license and patent
14498-; grant that can be found in the LICENSE file in the root of the source
14499-; tree. All contributing project authors may be found in the AUTHORS
14500-; file in the root of the source tree.
14501+; Use of this source code is governed by a BSD-style license
14502+; that can be found in the LICENSE file in the root of the source
14503+; tree. An additional intellectual property rights grant can be found
14504+; in the file PATENTS. All contributing project authors may
14505+; be found in the AUTHORS file in the root of the source tree.
14506 ;
14507
14508
14509diff --git a/vp8/encoder/x86/fwalsh_sse2.asm b/vp8/encoder/x86/fwalsh_sse2.asm
14510index 7d86201..1966697 100644
14511--- a/vp8/encoder/x86/fwalsh_sse2.asm
14512+++ b/vp8/encoder/x86/fwalsh_sse2.asm
14513@@ -1,10 +1,11 @@
14514 ;
14515 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14516 ;
14517-; Use of this source code is governed by a BSD-style license and patent
14518-; grant that can be found in the LICENSE file in the root of the source
14519-; tree. All contributing project authors may be found in the AUTHORS
14520-; file in the root of the source tree.
14521+; Use of this source code is governed by a BSD-style license
14522+; that can be found in the LICENSE file in the root of the source
14523+; tree. An additional intellectual property rights grant can be found
14524+; in the file PATENTS. All contributing project authors may
14525+; be found in the AUTHORS file in the root of the source tree.
14526 ;
14527
14528
14529diff --git a/vp8/encoder/x86/mcomp_x86.h b/vp8/encoder/x86/mcomp_x86.h
14530index 5661491..c2b4b36 100644
14531--- a/vp8/encoder/x86/mcomp_x86.h
14532+++ b/vp8/encoder/x86/mcomp_x86.h
14533@@ -1,10 +1,11 @@
14534 /*
14535 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14536 *
14537- * Use of this source code is governed by a BSD-style license and patent
14538- * grant that can be found in the LICENSE file in the root of the source
14539- * tree. All contributing project authors may be found in the AUTHORS
14540- * file in the root of the source tree.
14541+ * Use of this source code is governed by a BSD-style license
14542+ * that can be found in the LICENSE file in the root of the source
14543+ * tree. An additional intellectual property rights grant can be found
14544+ * in the file PATENTS. All contributing project authors may
14545+ * be found in the AUTHORS file in the root of the source tree.
14546 */
14547
14548
14549diff --git a/vp8/encoder/x86/preproc_mmx.c b/vp8/encoder/x86/preproc_mmx.c
14550index 69617ca..8b23bb5 100644
14551--- a/vp8/encoder/x86/preproc_mmx.c
14552+++ b/vp8/encoder/x86/preproc_mmx.c
14553@@ -1,10 +1,11 @@
14554 /*
14555 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14556 *
14557- * Use of this source code is governed by a BSD-style license and patent
14558- * grant that can be found in the LICENSE file in the root of the source
14559- * tree. All contributing project authors may be found in the AUTHORS
14560- * file in the root of the source tree.
14561+ * Use of this source code is governed by a BSD-style license
14562+ * that can be found in the LICENSE file in the root of the source
14563+ * tree. An additional intellectual property rights grant can be found
14564+ * in the file PATENTS. All contributing project authors may
14565+ * be found in the AUTHORS file in the root of the source tree.
14566 */
14567
14568
14569diff --git a/vp8/encoder/x86/quantize_mmx.asm b/vp8/encoder/x86/quantize_mmx.asm
14570index 847fc6e..25adca0 100644
14571--- a/vp8/encoder/x86/quantize_mmx.asm
14572+++ b/vp8/encoder/x86/quantize_mmx.asm
14573@@ -1,10 +1,11 @@
14574 ;
14575 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14576 ;
14577-; Use of this source code is governed by a BSD-style license and patent
14578-; grant that can be found in the LICENSE file in the root of the source
14579-; tree. All contributing project authors may be found in the AUTHORS
14580-; file in the root of the source tree.
14581+; Use of this source code is governed by a BSD-style license
14582+; that can be found in the LICENSE file in the root of the source
14583+; tree. An additional intellectual property rights grant can be found
14584+; in the file PATENTS. All contributing project authors may
14585+; be found in the AUTHORS file in the root of the source tree.
14586 ;
14587
14588
14589diff --git a/vp8/encoder/x86/quantize_sse2.asm b/vp8/encoder/x86/quantize_sse2.asm
14590new file mode 100644
14591index 0000000..c64a8ba
14592--- /dev/null
14593+++ b/vp8/encoder/x86/quantize_sse2.asm
14594@@ -0,0 +1,254 @@
14595+;
14596+; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14597+;
14598+; Use of this source code is governed by a BSD-style license and patent
14599+; grant that can be found in the LICENSE file in the root of the source
14600+; tree. All contributing project authors may be found in the AUTHORS
14601+; file in the root of the source tree.
14602+;
14603+
14604+
14605+%include "vpx_ports/x86_abi_support.asm"
14606+
14607+
14608+;int vp8_regular_quantize_b_impl_sse2(short *coeff_ptr, short *zbin_ptr,
14609+; short *qcoeff_ptr,short *dequant_ptr,
14610+; const int *default_zig_zag, short *round_ptr,
14611+; short *quant_ptr, short *dqcoeff_ptr,
14612+; unsigned short zbin_oq_value,
14613+; short *zbin_boost_ptr);
14614+;
14615+global sym(vp8_regular_quantize_b_impl_sse2)
14616+sym(vp8_regular_quantize_b_impl_sse2):
14617+ push rbp
14618+ mov rbp, rsp
14619+ SHADOW_ARGS_TO_STACK 10
14620+ push rsi
14621+ push rdi
14622+ push rbx
14623+ ; end prolog
14624+
14625+ ALIGN_STACK 16, rax
14626+
14627+ %define abs_minus_zbin_lo 0
14628+ %define abs_minus_zbin_hi 16
14629+ %define temp_qcoeff_lo 32
14630+ %define temp_qcoeff_hi 48
14631+ %define save_xmm6 64
14632+ %define save_xmm7 80
14633+ %define eob 96
14634+
14635+ %define vp8_regularquantizeb_stack_size eob + 16
14636+
14637+ sub rsp, vp8_regularquantizeb_stack_size
14638+
14639+ movdqa DQWORD PTR[rsp + save_xmm6], xmm6
14640+ movdqa DQWORD PTR[rsp + save_xmm7], xmm7
14641+
14642+ mov rdx, arg(0) ;coeff_ptr
14643+ mov eax, arg(8) ;zbin_oq_value
14644+
14645+ mov rcx, arg(1) ;zbin_ptr
14646+ movd xmm7, eax
14647+
14648+ movdqa xmm0, DQWORD PTR[rdx]
14649+ movdqa xmm4, DQWORD PTR[rdx + 16]
14650+
14651+ movdqa xmm1, xmm0
14652+ movdqa xmm5, xmm4
14653+
14654+ psraw xmm0, 15 ;sign of z (aka sz)
14655+ psraw xmm4, 15 ;sign of z (aka sz)
14656+
14657+ pxor xmm1, xmm0
14658+ pxor xmm5, xmm4
14659+
14660+ movdqa xmm2, DQWORD PTR[rcx] ;load zbin_ptr
14661+ movdqa xmm3, DQWORD PTR[rcx + 16] ;load zbin_ptr
14662+
14663+ pshuflw xmm7, xmm7, 0
14664+ psubw xmm1, xmm0 ;x = abs(z)
14665+
14666+ punpcklwd xmm7, xmm7 ;duplicated zbin_oq_value
14667+ psubw xmm5, xmm4 ;x = abs(z)
14668+
14669+ paddw xmm2, xmm7
14670+ paddw xmm3, xmm7
14671+
14672+ psubw xmm1, xmm2 ;sub (zbin_ptr + zbin_oq_value)
14673+ psubw xmm5, xmm3 ;sub (zbin_ptr + zbin_oq_value)
14674+
14675+ mov rdi, arg(5) ;round_ptr
14676+ mov rsi, arg(6) ;quant_ptr
14677+
14678+ movdqa DQWORD PTR[rsp + abs_minus_zbin_lo], xmm1
14679+ movdqa DQWORD PTR[rsp + abs_minus_zbin_hi], xmm5
14680+
14681+ paddw xmm1, xmm2 ;add (zbin_ptr + zbin_oq_value) back
14682+ paddw xmm5, xmm3 ;add (zbin_ptr + zbin_oq_value) back
14683+
14684+ movdqa xmm2, DQWORD PTR[rdi]
14685+ movdqa xmm3, DQWORD PTR[rsi]
14686+
14687+ movdqa xmm6, DQWORD PTR[rdi + 16]
14688+ movdqa xmm7, DQWORD PTR[rsi + 16]
14689+
14690+ paddw xmm1, xmm2
14691+ paddw xmm5, xmm6
14692+
14693+ pmulhw xmm1, xmm3
14694+ pmulhw xmm5, xmm7
14695+
14696+ mov rsi, arg(2) ;qcoeff_ptr
14697+ pxor xmm6, xmm6
14698+
14699+ pxor xmm1, xmm0
14700+ pxor xmm5, xmm4
14701+
14702+ psubw xmm1, xmm0
14703+ psubw xmm5, xmm4
14704+
14705+ movdqa DQWORD PTR[rsp + temp_qcoeff_lo], xmm1
14706+ movdqa DQWORD PTR[rsp + temp_qcoeff_hi], xmm5
14707+
14708+ movdqa DQWORD PTR[rsi], xmm6 ;zero qcoeff
14709+ movdqa DQWORD PTR[rsi + 16], xmm6 ;zero qcoeff
14710+
14711+ xor rax, rax
14712+ mov rcx, -1
14713+
14714+ mov [rsp + eob], rcx
14715+ mov rsi, arg(9) ;zbin_boost_ptr
14716+
14717+ mov rbx, arg(4) ;default_zig_zag
14718+
14719+rq_zigzag_loop:
14720+ movsxd rcx, DWORD PTR[rbx + rax*4] ;now we have rc
14721+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
14722+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
14723+
14724+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
14725+
14726+ sub edx, edi ;x - zbin
14727+ jl rq_zigzag_1
14728+
14729+ mov rdi, arg(2) ;qcoeff_ptr
14730+
14731+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
14732+
14733+ cmp edx, 0
14734+ je rq_zigzag_1
14735+
14736+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
14737+
14738+ mov rsi, arg(9) ;zbin_boost_ptr
14739+ mov [rsp + eob], rax ;eob = i
14740+
14741+rq_zigzag_1:
14742+ movsxd rcx, DWORD PTR[rbx + rax*4 + 4]
14743+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
14744+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
14745+
14746+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
14747+ lea rax, [rax + 1]
14748+
14749+ sub edx, edi ;x - zbin
14750+ jl rq_zigzag_1a
14751+
14752+ mov rdi, arg(2) ;qcoeff_ptr
14753+
14754+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
14755+
14756+ cmp edx, 0
14757+ je rq_zigzag_1a
14758+
14759+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
14760+
14761+ mov rsi, arg(9) ;zbin_boost_ptr
14762+ mov [rsp + eob], rax ;eob = i
14763+
14764+rq_zigzag_1a:
14765+ movsxd rcx, DWORD PTR[rbx + rax*4 + 4]
14766+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
14767+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
14768+
14769+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
14770+ lea rax, [rax + 1]
14771+
14772+ sub edx, edi ;x - zbin
14773+ jl rq_zigzag_1b
14774+
14775+ mov rdi, arg(2) ;qcoeff_ptr
14776+
14777+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
14778+
14779+ cmp edx, 0
14780+ je rq_zigzag_1b
14781+
14782+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
14783+
14784+ mov rsi, arg(9) ;zbin_boost_ptr
14785+ mov [rsp + eob], rax ;eob = i
14786+
14787+rq_zigzag_1b:
14788+ movsxd rcx, DWORD PTR[rbx + rax*4 + 4]
14789+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
14790+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
14791+
14792+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
14793+ lea rax, [rax + 1]
14794+
14795+ sub edx, edi ;x - zbin
14796+ jl rq_zigzag_1c
14797+
14798+ mov rdi, arg(2) ;qcoeff_ptr
14799+
14800+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
14801+
14802+ cmp edx, 0
14803+ je rq_zigzag_1c
14804+
14805+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
14806+
14807+ mov rsi, arg(9) ;zbin_boost_ptr
14808+ mov [rsp + eob], rax ;eob = i
14809+
14810+rq_zigzag_1c:
14811+ lea rax, [rax + 1]
14812+
14813+ cmp rax, 16
14814+ jl rq_zigzag_loop
14815+
14816+ mov rdi, arg(2) ;qcoeff_ptr
14817+ mov rcx, arg(3) ;dequant_ptr
14818+ mov rsi, arg(7) ;dqcoeff_ptr
14819+
14820+ movdqa xmm2, DQWORD PTR[rdi]
14821+ movdqa xmm3, DQWORD PTR[rdi + 16]
14822+
14823+ movdqa xmm0, DQWORD PTR[rcx]
14824+ movdqa xmm1, DQWORD PTR[rcx + 16]
14825+
14826+ pmullw xmm0, xmm2
14827+ pmullw xmm1, xmm3
14828+
14829+ movdqa DQWORD PTR[rsi], xmm0 ;store dqcoeff
14830+ movdqa DQWORD PTR[rsi + 16], xmm1 ;store dqcoeff
14831+
14832+ mov rax, [rsp + eob]
14833+
14834+ movdqa xmm6, DQWORD PTR[rsp + save_xmm6]
14835+ movdqa xmm7, DQWORD PTR[rsp + save_xmm7]
14836+
14837+ add rax, 1
14838+
14839+ add rsp, vp8_regularquantizeb_stack_size
14840+ pop rsp
14841+
14842+ ; begin epilog
14843+ pop rbx
14844+ pop rdi
14845+ pop rsi
14846+ UNSHADOW_ARGS
14847+ pop rbp
14848+ ret
14849diff --git a/vp8/encoder/x86/quantize_x86.h b/vp8/encoder/x86/quantize_x86.h
14850new file mode 100644
14851index 0000000..37d69a8
14852--- /dev/null
14853+++ b/vp8/encoder/x86/quantize_x86.h
14854@@ -0,0 +1,38 @@
14855+/*
14856+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14857+ *
14858+ * Use of this source code is governed by a BSD-style license and patent
14859+ * grant that can be found in the LICENSE file in the root of the source
14860+ * tree. All contributing project authors may be found in the AUTHORS
14861+ * file in the root of the source tree.
14862+ */
14863+
14864+#ifndef QUANTIZE_X86_H
14865+#define QUANTIZE_X86_H
14866+
14867+
14868+/* Note:
14869+ *
14870+ * This platform is commonly built for runtime CPU detection. If you modify
14871+ * any of the function mappings present in this file, be sure to also update
14872+ * them in the function pointer initialization code
14873+ */
14874+#if HAVE_MMX
14875+
14876+#endif
14877+
14878+
14879+#if HAVE_SSE2
14880+extern prototype_quantize_block(vp8_regular_quantize_b_sse2);
14881+
14882+#if !CONFIG_RUNTIME_CPU_DETECT
14883+
14884+#undef vp8_quantize_quantb
14885+#define vp8_quantize_quantb vp8_regular_quantize_b_sse2
14886+
14887+#endif
14888+
14889+#endif
14890+
14891+
14892+#endif
14893diff --git a/vp8/encoder/x86/sad_mmx.asm b/vp8/encoder/x86/sad_mmx.asm
14894index a825698..4b35749 100644
14895--- a/vp8/encoder/x86/sad_mmx.asm
14896+++ b/vp8/encoder/x86/sad_mmx.asm
14897@@ -1,10 +1,11 @@
14898 ;
14899 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14900 ;
14901-; Use of this source code is governed by a BSD-style license and patent
14902-; grant that can be found in the LICENSE file in the root of the source
14903-; tree. All contributing project authors may be found in the AUTHORS
14904-; file in the root of the source tree.
14905+; Use of this source code is governed by a BSD-style license
14906+; that can be found in the LICENSE file in the root of the source
14907+; tree. An additional intellectual property rights grant can be found
14908+; in the file PATENTS. All contributing project authors may
14909+; be found in the AUTHORS file in the root of the source tree.
14910 ;
14911
14912
14913diff --git a/vp8/encoder/x86/sad_sse2.asm b/vp8/encoder/x86/sad_sse2.asm
14914index 53240bb..f4ef551 100644
14915--- a/vp8/encoder/x86/sad_sse2.asm
14916+++ b/vp8/encoder/x86/sad_sse2.asm
14917@@ -1,10 +1,11 @@
14918 ;
14919 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14920 ;
14921-; Use of this source code is governed by a BSD-style license and patent
14922-; grant that can be found in the LICENSE file in the root of the source
14923-; tree. All contributing project authors may be found in the AUTHORS
14924-; file in the root of the source tree.
14925+; Use of this source code is governed by a BSD-style license
14926+; that can be found in the LICENSE file in the root of the source
14927+; tree. An additional intellectual property rights grant can be found
14928+; in the file PATENTS. All contributing project authors may
14929+; be found in the AUTHORS file in the root of the source tree.
14930 ;
14931
14932
14933diff --git a/vp8/encoder/x86/sad_sse3.asm b/vp8/encoder/x86/sad_sse3.asm
14934index 38cc029..edfe82f 100644
14935--- a/vp8/encoder/x86/sad_sse3.asm
14936+++ b/vp8/encoder/x86/sad_sse3.asm
14937@@ -1,10 +1,11 @@
14938 ;
14939 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14940 ;
14941-; Use of this source code is governed by a BSD-style license and patent
14942-; grant that can be found in the LICENSE file in the root of the source
14943-; tree. All contributing project authors may be found in the AUTHORS
14944-; file in the root of the source tree.
14945+; Use of this source code is governed by a BSD-style license
14946+; that can be found in the LICENSE file in the root of the source
14947+; tree. An additional intellectual property rights grant can be found
14948+; in the file PATENTS. All contributing project authors may
14949+; be found in the AUTHORS file in the root of the source tree.
14950 ;
14951
14952
14953diff --git a/vp8/encoder/x86/sad_ssse3.asm b/vp8/encoder/x86/sad_ssse3.asm
14954index 1bb9561..79c4b44 100644
14955--- a/vp8/encoder/x86/sad_ssse3.asm
14956+++ b/vp8/encoder/x86/sad_ssse3.asm
14957@@ -1,10 +1,11 @@
14958 ;
14959 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14960 ;
14961-; Use of this source code is governed by a BSD-style license and patent
14962-; grant that can be found in the LICENSE file in the root of the source
14963-; tree. All contributing project authors may be found in the AUTHORS
14964-; file in the root of the source tree.
14965+; Use of this source code is governed by a BSD-style license
14966+; that can be found in the LICENSE file in the root of the source
14967+; tree. An additional intellectual property rights grant can be found
14968+; in the file PATENTS. All contributing project authors may
14969+; be found in the AUTHORS file in the root of the source tree.
14970 ;
14971
14972
14973diff --git a/vp8/encoder/x86/subtract_mmx.asm b/vp8/encoder/x86/subtract_mmx.asm
14974index ce3e610..d9babd3 100644
14975--- a/vp8/encoder/x86/subtract_mmx.asm
14976+++ b/vp8/encoder/x86/subtract_mmx.asm
14977@@ -1,10 +1,11 @@
14978 ;
14979 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
14980 ;
14981-; Use of this source code is governed by a BSD-style license and patent
14982-; grant that can be found in the LICENSE file in the root of the source
14983-; tree. All contributing project authors may be found in the AUTHORS
14984-; file in the root of the source tree.
14985+; Use of this source code is governed by a BSD-style license
14986+; that can be found in the LICENSE file in the root of the source
14987+; tree. An additional intellectual property rights grant can be found
14988+; in the file PATENTS. All contributing project authors may
14989+; be found in the AUTHORS file in the root of the source tree.
14990 ;
14991
14992
14993diff --git a/vp8/encoder/x86/variance_impl_mmx.asm b/vp8/encoder/x86/variance_impl_mmx.asm
14994index d0da82a..31f66ec 100644
14995--- a/vp8/encoder/x86/variance_impl_mmx.asm
14996+++ b/vp8/encoder/x86/variance_impl_mmx.asm
14997@@ -1,10 +1,11 @@
14998 ;
14999 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15000 ;
15001-; Use of this source code is governed by a BSD-style license and patent
15002-; grant that can be found in the LICENSE file in the root of the source
15003-; tree. All contributing project authors may be found in the AUTHORS
15004-; file in the root of the source tree.
15005+; Use of this source code is governed by a BSD-style license
15006+; that can be found in the LICENSE file in the root of the source
15007+; tree. An additional intellectual property rights grant can be found
15008+; in the file PATENTS. All contributing project authors may
15009+; be found in the AUTHORS file in the root of the source tree.
15010 ;
15011
15012
15013diff --git a/vp8/encoder/x86/variance_impl_sse2.asm b/vp8/encoder/x86/variance_impl_sse2.asm
15014index 7e5ee28..1ccc6c5 100644
15015--- a/vp8/encoder/x86/variance_impl_sse2.asm
15016+++ b/vp8/encoder/x86/variance_impl_sse2.asm
15017@@ -1,10 +1,11 @@
15018 ;
15019 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15020 ;
15021-; Use of this source code is governed by a BSD-style license and patent
15022-; grant that can be found in the LICENSE file in the root of the source
15023-; tree. All contributing project authors may be found in the AUTHORS
15024-; file in the root of the source tree.
15025+; Use of this source code is governed by a BSD-style license
15026+; that can be found in the LICENSE file in the root of the source
15027+; tree. An additional intellectual property rights grant can be found
15028+; in the file PATENTS. All contributing project authors may
15029+; be found in the AUTHORS file in the root of the source tree.
15030 ;
15031
15032
15033diff --git a/vp8/encoder/x86/variance_mmx.c b/vp8/encoder/x86/variance_mmx.c
15034index 4a5b25b..788b833 100644
15035--- a/vp8/encoder/x86/variance_mmx.c
15036+++ b/vp8/encoder/x86/variance_mmx.c
15037@@ -1,10 +1,11 @@
15038 /*
15039 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15040 *
15041- * Use of this source code is governed by a BSD-style license and patent
15042- * grant that can be found in the LICENSE file in the root of the source
15043- * tree. All contributing project authors may be found in the AUTHORS
15044- * file in the root of the source tree.
15045+ * Use of this source code is governed by a BSD-style license
15046+ * that can be found in the LICENSE file in the root of the source
15047+ * tree. An additional intellectual property rights grant can be found
15048+ * in the file PATENTS. All contributing project authors may
15049+ * be found in the AUTHORS file in the root of the source tree.
15050 */
15051
15052
15053diff --git a/vp8/encoder/x86/variance_sse2.c b/vp8/encoder/x86/variance_sse2.c
15054index ea80753..78ecd7b 100644
15055--- a/vp8/encoder/x86/variance_sse2.c
15056+++ b/vp8/encoder/x86/variance_sse2.c
15057@@ -1,10 +1,11 @@
15058 /*
15059 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15060 *
15061- * Use of this source code is governed by a BSD-style license and patent
15062- * grant that can be found in the LICENSE file in the root of the source
15063- * tree. All contributing project authors may be found in the AUTHORS
15064- * file in the root of the source tree.
15065+ * Use of this source code is governed by a BSD-style license
15066+ * that can be found in the LICENSE file in the root of the source
15067+ * tree. An additional intellectual property rights grant can be found
15068+ * in the file PATENTS. All contributing project authors may
15069+ * be found in the AUTHORS file in the root of the source tree.
15070 */
15071
15072
15073diff --git a/vp8/encoder/x86/variance_x86.h b/vp8/encoder/x86/variance_x86.h
15074index 35fc90c..9cdd662 100644
15075--- a/vp8/encoder/x86/variance_x86.h
15076+++ b/vp8/encoder/x86/variance_x86.h
15077@@ -1,10 +1,11 @@
15078 /*
15079 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15080 *
15081- * Use of this source code is governed by a BSD-style license and patent
15082- * grant that can be found in the LICENSE file in the root of the source
15083- * tree. All contributing project authors may be found in the AUTHORS
15084- * file in the root of the source tree.
15085+ * Use of this source code is governed by a BSD-style license
15086+ * that can be found in the LICENSE file in the root of the source
15087+ * tree. An additional intellectual property rights grant can be found
15088+ * in the file PATENTS. All contributing project authors may
15089+ * be found in the AUTHORS file in the root of the source tree.
15090 */
15091
15092
15093@@ -240,7 +241,7 @@ extern prototype_sad_multi_dif_address(vp8_sad4x4x4d_sse3);
15094 #define vp8_variance_sad4x4x3 vp8_sad4x4x3_sse3
15095
15096 #undef vp8_variance_sad16x16x4d
15097-#define vp8_variance_sad16x16x4 vp8_sad16x16x4d_sse3
15098+#define vp8_variance_sad16x16x4d vp8_sad16x16x4d_sse3
15099
15100 #undef vp8_variance_sad16x8x4d
15101 #define vp8_variance_sad16x8x4d vp8_sad16x8x4d_sse3
15102diff --git a/vp8/encoder/x86/x86_csystemdependent.c b/vp8/encoder/x86/x86_csystemdependent.c
15103index f1391ba..f6123a8 100644
15104--- a/vp8/encoder/x86/x86_csystemdependent.c
15105+++ b/vp8/encoder/x86/x86_csystemdependent.c
15106@@ -1,10 +1,11 @@
15107 /*
15108 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15109 *
15110- * Use of this source code is governed by a BSD-style license and patent
15111- * grant that can be found in the LICENSE file in the root of the source
15112- * tree. All contributing project authors may be found in the AUTHORS
15113- * file in the root of the source tree.
15114+ * Use of this source code is governed by a BSD-style license
15115+ * that can be found in the LICENSE file in the root of the source
15116+ * tree. An additional intellectual property rights grant can be found
15117+ * in the file PATENTS. All contributing project authors may
15118+ * be found in the AUTHORS file in the root of the source tree.
15119 */
15120
15121
15122@@ -120,6 +121,40 @@ void vp8_fast_quantize_b_sse(BLOCK *b, BLOCKD *d)
15123 );
15124 }
15125
15126+int vp8_regular_quantize_b_impl_sse2(short *coeff_ptr, short *zbin_ptr,
15127+ short *qcoeff_ptr,short *dequant_ptr,
15128+ const int *default_zig_zag, short *round_ptr,
15129+ short *quant_ptr, short *dqcoeff_ptr,
15130+ unsigned short zbin_oq_value,
15131+ short *zbin_boost_ptr);
15132+
15133+void vp8_regular_quantize_b_sse2(BLOCK *b,BLOCKD *d)
15134+{
15135+ short *zbin_boost_ptr = &b->zrun_zbin_boost[0];
15136+ short *coeff_ptr = &b->coeff[0];
15137+ short *zbin_ptr = &b->zbin[0][0];
15138+ short *round_ptr = &b->round[0][0];
15139+ short *quant_ptr = &b->quant[0][0];
15140+ short *qcoeff_ptr = d->qcoeff;
15141+ short *dqcoeff_ptr = d->dqcoeff;
15142+ short *dequant_ptr = &d->dequant[0][0];
15143+ short zbin_oq_value = b->zbin_extra;
15144+
15145+ d->eob = vp8_regular_quantize_b_impl_sse2(
15146+ coeff_ptr,
15147+ zbin_ptr,
15148+ qcoeff_ptr,
15149+ dequant_ptr,
15150+ vp8_default_zig_zag1d,
15151+
15152+ round_ptr,
15153+ quant_ptr,
15154+ dqcoeff_ptr,
15155+ zbin_oq_value,
15156+ zbin_boost_ptr
15157+ );
15158+}
15159+
15160 int vp8_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
15161 int vp8_mbblock_error_xmm(MACROBLOCK *mb, int dc)
15162 {
15163@@ -250,6 +285,7 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
15164 /* cpi->rtcd.encodemb.sub* not implemented for wmt */
15165
15166 cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_sse;
15167+ cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse2;
15168 }
15169
15170 #endif
15171diff --git a/vp8/exports_dec b/vp8/exports_dec
15172new file mode 100644
15173index 0000000..f9b985c
15174--- /dev/null
15175+++ b/vp8/exports_dec
15176@@ -0,0 +1 @@
15177+data vpx_codec_vp8_dx_algo
15178diff --git a/vp8/exports_enc b/vp8/exports_enc
15179new file mode 100644
15180index 0000000..9967011
15181--- /dev/null
15182+++ b/vp8/exports_enc
15183@@ -0,0 +1 @@
15184+data vpx_codec_vp8_cx_algo
15185diff --git a/vp8/vp8.h b/vp8/vp8.h
15186deleted file mode 100644
15187index 87ca217..0000000
15188--- a/vp8/vp8.h
15189+++ /dev/null
15190@@ -1,116 +0,0 @@
15191-/*
15192- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15193- *
15194- * Use of this source code is governed by a BSD-style license and patent
15195- * grant that can be found in the LICENSE file in the root of the source
15196- * tree. All contributing project authors may be found in the AUTHORS
15197- * file in the root of the source tree.
15198- */
15199-
15200-
15201-/*!\defgroup vp8 VP8
15202- * \ingroup codecs
15203- * VP8 is vpx's newest video compression algorithm that uses motion
15204- * compensated prediction, Discrete Cosine Transform (DCT) coding of the
15205- * prediction error signal and context dependent entropy coding techniques
15206- * based on arithmatic principles. It features:
15207- * - YUV 4:2:0 image format
15208- * - Macro-block based coding (16x16 luma plus two 8x8 chroma)
15209- * - 1/4 (1/8) pixel accuracy motion compensated prediction
15210- * - 4x4 DCT transform
15211- * - 128 level linear quantizer
15212- * - In loop deblocking filter
15213- * - Context-based entropy coding
15214- *
15215- * @{
15216- */
15217-/*!\file vp8.h
15218- * \brief Provides controls common to both the VP8 encoder and decoder.
15219- */
15220-#ifndef VP8_H
15221-#define VP8_H
15222-#include "vpx_codec_impl_top.h"
15223-
15224-/*!\brief Control functions
15225- *
15226- * The set of macros define the control functions of VP8 interface
15227- */
15228-enum vp8_dec_control_id
15229-{
15230- VP8_SET_REFERENCE = 1, /**< pass in an external frame into decoder to be used as reference frame */
15231- VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
15232- VP8_SET_POSTPROC = 3, /**< set decoder's the post processing settings */
15233- VP8_COMMON_CTRL_ID_MAX
15234-};
15235-
15236-/*!\brief post process flags
15237- *
15238- * The set of macros define VP8 decoder post processing flags
15239- */
15240-enum vp8_postproc_level
15241-{
15242- VP8_NOFILTERING = 0,
15243- VP8_DEBLOCK = 1,
15244- VP8_DEMACROBLOCK = 2,
15245- VP8_ADDNOISE = 4,
15246-};
15247-
15248-/*!\brief post process flags
15249- *
15250- * This define a structure that describe the post processing settings. For
15251- * the best objective measure (using thet PSNR metric) set post_proc_flag
15252- * to VP8_DEBLOCK and deblocking_level to 1.
15253- */
15254-
15255-typedef struct vp8_postproc_cfg
15256-{
15257- int post_proc_flag; /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
15258- int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
15259- int noise_level; /**< the strength of additive noise, valid range [0, 16] */
15260-} vp8_postproc_cfg_t;
15261-
15262-/*!\brief reference frame type
15263- *
15264- * The set of macros define the type of VP8 reference frames
15265- */
15266-typedef enum vpx_ref_frame_type
15267-{
15268- VP8_LAST_FRAME = 1,
15269- VP8_GOLD_FRAME = 2,
15270- VP8_ALTR_FRAME = 4
15271-} vpx_ref_frame_type_t;
15272-
15273-/*!\brief reference frame data struct
15274- *
15275- * define the data struct to access vp8 reference frames
15276- */
15277-
15278-typedef struct vpx_ref_frame
15279-{
15280- vpx_ref_frame_type_t frame_type; /**< which reference frame */
15281- vpx_image_t img; /**< reference frame data in image format */
15282-} vpx_ref_frame_t;
15283-
15284-
15285-/*!\brief vp8 decoder control funciton parameter type
15286- *
15287- * defines the data type for each of VP8 decoder control funciton requires
15288- */
15289-
15290-VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *)
15291-VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
15292-VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
15293-
15294-
15295-/*! @} - end defgroup vp8 */
15296-
15297-#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
15298-/* The following definitions are provided for backward compatibility with
15299- * the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
15300- */
15301-
15302-DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
15303-#endif
15304-
15305-#include "vpx_codec_impl_bottom.h"
15306-#endif
15307diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk
15308index ec467c5..5ed53ba 100644
15309--- a/vp8/vp8_common.mk
15310+++ b/vp8/vp8_common.mk
15311@@ -1,19 +1,17 @@
15312 ##
15313 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15314 ##
15315-## Use of this source code is governed by a BSD-style license and patent
15316-## grant that can be found in the LICENSE file in the root of the source
15317-## tree. All contributing project authors may be found in the AUTHORS
15318-## file in the root of the source tree.
15319+## Use of this source code is governed by a BSD-style license
15320+## that can be found in the LICENSE file in the root of the source
15321+## tree. An additional intellectual property rights grant can be found
15322+## in the file PATENTS. All contributing project authors may
15323+## be found in the AUTHORS file in the root of the source tree.
15324 ##
15325
15326
15327 #add this file to the installed sources list
15328 VP8_COMMON_SRCS-yes += vp8_common.mk
15329
15330-#common interface
15331-VP8_COMMON_SRCS-yes += vp8.h
15332-
15333 CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)common
15334 VP8_COMMON_SRCS-yes += common/type_aliases.h
15335 VP8_COMMON_SRCS-yes += common/pragmas.h
15336diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
15337index e129ec9..d63c039 100644
15338--- a/vp8/vp8_cx_iface.c
15339+++ b/vp8/vp8_cx_iface.c
15340@@ -1,18 +1,19 @@
15341 /*
15342 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15343 *
15344- * Use of this source code is governed by a BSD-style license and patent
15345- * grant that can be found in the LICENSE file in the root of the source
15346- * tree. All contributing project authors may be found in the AUTHORS
15347- * file in the root of the source tree.
15348+ * Use of this source code is governed by a BSD-style license
15349+ * that can be found in the LICENSE file in the root of the source
15350+ * tree. An additional intellectual property rights grant can be found
15351+ * in the file PATENTS. All contributing project authors may
15352+ * be found in the AUTHORS file in the root of the source tree.
15353 */
15354
15355
15356-#include "vpx_codec/vpx_codec.h"
15357-#include "vpx_codec/internal/vpx_codec_internal.h"
15358+#include "vpx/vpx_codec.h"
15359+#include "vpx/internal/vpx_codec_internal.h"
15360 #include "vpx_version.h"
15361 #include "onyx_int.h"
15362-#include "vp8e.h"
15363+#include "vpx/vp8e.h"
15364 #include "onyx.h"
15365 #include <stdlib.h>
15366 #include <string.h>
15367@@ -52,15 +53,15 @@ static const struct extraconfig_map extracfg_map[] =
15368 NULL,
15369 #if !(CONFIG_REALTIME_ONLY)
15370 VP8_BEST_QUALITY_ENCODING, /* Encoding Mode */
15371- -4, /* cpu_used */
15372+ 0, /* cpu_used */
15373 #else
15374 VP8_REAL_TIME_ENCODING, /* Encoding Mode */
15375- -8, /* cpu_used */
15376+ 4, /* cpu_used */
15377 #endif
15378 0, /* enable_auto_alt_ref */
15379 0, /* noise_sensitivity */
15380 0, /* Sharpness */
15381- 800, /* static_thresh */
15382+ 0, /* static_thresh */
15383 VP8_ONE_TOKENPARTITION, /* token_partitions */
15384 0, /* arnr_max_frames */
15385 0, /* arnr_strength */
15386@@ -81,7 +82,7 @@ struct vpx_codec_alg_priv
15387 vpx_image_t preview_img;
15388 unsigned int next_frame_flag;
15389 vp8_postproc_cfg_t preview_ppcfg;
15390- vpx_codec_pkt_list_decl(26) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
15391+ vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
15392 int deprecated_mode;
15393 unsigned int fixed_kf_cntr;
15394 };
15395@@ -108,7 +109,7 @@ update_error_state(vpx_codec_alg_priv_t *ctx,
15396 } while(0)
15397
15398 #define RANGE_CHECK(p,memb,lo,hi) do {\
15399- if(!((p)->memb >= (lo) && (p)->memb <= hi)) \
15400+ if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \
15401 ERROR(#memb " out of range ["#lo".."#hi"]");\
15402 } while(0)
15403
15404@@ -211,10 +212,10 @@ static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
15405 {
15406 switch (img->fmt)
15407 {
15408- case IMG_FMT_YV12:
15409- case IMG_FMT_I420:
15410- case IMG_FMT_VPXI420:
15411- case IMG_FMT_VPXYV12:
15412+ case VPX_IMG_FMT_YV12:
15413+ case VPX_IMG_FMT_I420:
15414+ case VPX_IMG_FMT_VPXI420:
15415+ case VPX_IMG_FMT_VPXYV12:
15416 break;
15417 default:
15418 ERROR("Invalid image format. Only YV12 and I420 images are supported");
15419@@ -536,20 +537,20 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
15420 YV12_BUFFER_CONFIG *yv12)
15421 {
15422 vpx_codec_err_t res = VPX_CODEC_OK;
15423- yv12->y_buffer = img->planes[PLANE_Y];
15424- yv12->u_buffer = img->planes[PLANE_U];
15425- yv12->v_buffer = img->planes[PLANE_V];
15426+ yv12->y_buffer = img->planes[VPX_PLANE_Y];
15427+ yv12->u_buffer = img->planes[VPX_PLANE_U];
15428+ yv12->v_buffer = img->planes[VPX_PLANE_V];
15429
15430 yv12->y_width = img->d_w;
15431 yv12->y_height = img->d_h;
15432 yv12->uv_width = (1 + yv12->y_width) / 2;
15433 yv12->uv_height = (1 + yv12->y_height) / 2;
15434
15435- yv12->y_stride = img->stride[PLANE_Y];
15436- yv12->uv_stride = img->stride[PLANE_U];
15437+ yv12->y_stride = img->stride[VPX_PLANE_Y];
15438+ yv12->uv_stride = img->stride[VPX_PLANE_U];
15439
15440- yv12->border = (img->stride[PLANE_Y] - img->w) / 2;
15441- yv12->clrtype = (img->fmt == IMG_FMT_VPXI420 || img->fmt == IMG_FMT_VPXYV12); //REG_YUV = 0
15442+ yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
15443+ yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12); //REG_YUV = 0
15444 return res;
15445 }
15446
15447@@ -846,7 +847,7 @@ static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
15448 {
15449
15450 /*
15451- vpx_img_wrap(&ctx->preview_img, IMG_FMT_YV12,
15452+ vpx_img_wrap(&ctx->preview_img, VPX_IMG_FMT_YV12,
15453 sd.y_width + 2*VP8BORDERINPIXELS,
15454 sd.y_height + 2*VP8BORDERINPIXELS,
15455 1,
15456@@ -857,23 +858,23 @@ static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
15457 */
15458
15459 ctx->preview_img.bps = 12;
15460- ctx->preview_img.planes[PLANE_Y] = sd.y_buffer;
15461- ctx->preview_img.planes[PLANE_U] = sd.u_buffer;
15462- ctx->preview_img.planes[PLANE_V] = sd.v_buffer;
15463+ ctx->preview_img.planes[VPX_PLANE_Y] = sd.y_buffer;
15464+ ctx->preview_img.planes[VPX_PLANE_U] = sd.u_buffer;
15465+ ctx->preview_img.planes[VPX_PLANE_V] = sd.v_buffer;
15466
15467 if (sd.clrtype == REG_YUV)
15468- ctx->preview_img.fmt = IMG_FMT_I420;
15469+ ctx->preview_img.fmt = VPX_IMG_FMT_I420;
15470 else
15471- ctx->preview_img.fmt = IMG_FMT_VPXI420;
15472+ ctx->preview_img.fmt = VPX_IMG_FMT_VPXI420;
15473
15474 ctx->preview_img.x_chroma_shift = 1;
15475 ctx->preview_img.y_chroma_shift = 1;
15476
15477 ctx->preview_img.d_w = ctx->cfg.g_w;
15478 ctx->preview_img.d_h = ctx->cfg.g_h;
15479- ctx->preview_img.stride[PLANE_Y] = sd.y_stride;
15480- ctx->preview_img.stride[PLANE_U] = sd.uv_stride;
15481- ctx->preview_img.stride[PLANE_V] = sd.uv_stride;
15482+ ctx->preview_img.stride[VPX_PLANE_Y] = sd.y_stride;
15483+ ctx->preview_img.stride[VPX_PLANE_U] = sd.uv_stride;
15484+ ctx->preview_img.stride[VPX_PLANE_V] = sd.uv_stride;
15485 ctx->preview_img.w = sd.y_width;
15486 ctx->preview_img.h = sd.y_height;
15487
15488@@ -1067,7 +1068,7 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
15489 #endif
15490 vpx_codec_iface_t vpx_codec_vp8_cx_algo =
15491 {
15492- "vpx Technologies VP8 Encoder" VERSION_STRING,
15493+ "WebM Project VP8 Encoder" VERSION_STRING,
15494 VPX_CODEC_INTERNAL_ABI_VERSION,
15495 VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR,
15496 /* vpx_codec_caps_t caps; */
15497@@ -1156,7 +1157,7 @@ static vpx_codec_err_t api1_encode(vpx_codec_alg_priv_t *ctx,
15498
15499 vpx_codec_iface_t vpx_enc_vp8_algo =
15500 {
15501- "vpx Technologies VP8 Encoder (Deprecated API)" VERSION_STRING,
15502+ "WebM Project VP8 Encoder (Deprecated API)" VERSION_STRING,
15503 VPX_CODEC_INTERNAL_ABI_VERSION,
15504 VPX_CODEC_CAP_ENCODER,
15505 /* vpx_codec_caps_t caps; */
15506diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
15507index 3e6cdf4..a99364d 100644
15508--- a/vp8/vp8_dx_iface.c
15509+++ b/vp8/vp8_dx_iface.c
15510@@ -1,18 +1,19 @@
15511 /*
15512 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15513 *
15514- * Use of this source code is governed by a BSD-style license and patent
15515- * grant that can be found in the LICENSE file in the root of the source
15516- * tree. All contributing project authors may be found in the AUTHORS
15517- * file in the root of the source tree.
15518+ * Use of this source code is governed by a BSD-style license
15519+ * that can be found in the LICENSE file in the root of the source
15520+ * tree. An additional intellectual property rights grant can be found
15521+ * in the file PATENTS. All contributing project authors may
15522+ * be found in the AUTHORS file in the root of the source tree.
15523 */
15524
15525
15526 #include <stdlib.h>
15527 #include <string.h>
15528-#include "vpx_codec/vpx_decoder.h"
15529-#include "vp8dx.h"
15530-#include "vpx_codec/internal/vpx_codec_internal.h"
15531+#include "vpx/vpx_decoder.h"
15532+#include "vpx/vp8dx.h"
15533+#include "vpx/internal/vpx_codec_internal.h"
15534 #include "vpx_version.h"
15535 #include "onyxd.h"
15536 #include "onyxd_int.h"
15537@@ -257,12 +258,12 @@ static vpx_codec_err_t vp8_peek_si(const uint8_t *data,
15538
15539 vpx_codec_err_t res = VPX_CODEC_OK;
15540 {
15541- /*Parse from VP8 compressed data, the implies knowledge of the
15542- *VP8 bitsteam.
15543- * First 3 byte header including version, frame type and an offset
15544- * Next 3 bytes are image sizewith 12 bit each for width and height
15545+ /* Parse uncompresssed part of key frame header.
15546+ * 3 bytes:- including version, frame type and an offset
15547+ * 3 bytes:- sync code (0x9d, 0x01, 0x2a)
15548+ * 4 bytes:- including image width and height in the lowest 14 bits
15549+ * of each 2-byte value.
15550 */
15551-
15552 si->is_kf = 0;
15553
15554 if (data_sz >= 10 && !(data[0] & 0x01)) /* I-Frame */
15555@@ -434,7 +435,7 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
15556 unsigned int a_w = (sd.y_width + 15) & ~15;
15557 unsigned int a_h = (sd.y_height + 15) & ~15;
15558
15559- vpx_img_wrap(&ctx->img, IMG_FMT_I420,
15560+ vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
15561 a_w + 2 * VP8BORDERINPIXELS,
15562 a_h + 2 * VP8BORDERINPIXELS,
15563 1,
15564@@ -557,20 +558,20 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
15565 YV12_BUFFER_CONFIG *yv12)
15566 {
15567 vpx_codec_err_t res = VPX_CODEC_OK;
15568- yv12->y_buffer = img->planes[PLANE_Y];
15569- yv12->u_buffer = img->planes[PLANE_U];
15570- yv12->v_buffer = img->planes[PLANE_V];
15571+ yv12->y_buffer = img->planes[VPX_PLANE_Y];
15572+ yv12->u_buffer = img->planes[VPX_PLANE_U];
15573+ yv12->v_buffer = img->planes[VPX_PLANE_V];
15574
15575 yv12->y_width = img->d_w;
15576 yv12->y_height = img->d_h;
15577 yv12->uv_width = yv12->y_width / 2;
15578 yv12->uv_height = yv12->y_height / 2;
15579
15580- yv12->y_stride = img->stride[PLANE_Y];
15581- yv12->uv_stride = img->stride[PLANE_U];
15582+ yv12->y_stride = img->stride[VPX_PLANE_Y];
15583+ yv12->uv_stride = img->stride[VPX_PLANE_U];
15584
15585- yv12->border = (img->stride[PLANE_Y] - img->d_w) / 2;
15586- yv12->clrtype = (img->fmt == IMG_FMT_VPXI420 || img->fmt == IMG_FMT_VPXYV12);
15587+ yv12->border = (img->stride[VPX_PLANE_Y] - img->d_w) / 2;
15588+ yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12);
15589
15590 return res;
15591 }
15592@@ -656,7 +657,7 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] =
15593 #endif
15594 vpx_codec_iface_t vpx_codec_vp8_dx_algo =
15595 {
15596- "vpx Technologies VP8 Decoder" VERSION_STRING,
15597+ "WebM Project VP8 Decoder" VERSION_STRING,
15598 VPX_CODEC_INTERNAL_ABI_VERSION,
15599 VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
15600 /* vpx_codec_caps_t caps; */
15601@@ -679,7 +680,7 @@ vpx_codec_iface_t vpx_codec_vp8_dx_algo =
15602 */
15603 vpx_codec_iface_t vpx_codec_vp8_algo =
15604 {
15605- "vpx Technologies VP8 Decoder (Deprecated API)" VERSION_STRING,
15606+ "WebM Project VP8 Decoder (Deprecated API)" VERSION_STRING,
15607 VPX_CODEC_INTERNAL_ABI_VERSION,
15608 VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
15609 /* vpx_codec_caps_t caps; */
15610diff --git a/vp8/vp8cx.h b/vp8/vp8cx.h
15611deleted file mode 100644
15612index dd48c07..0000000
15613--- a/vp8/vp8cx.h
15614+++ /dev/null
15615@@ -1,261 +0,0 @@
15616-/*
15617- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15618- *
15619- * Use of this source code is governed by a BSD-style license and patent
15620- * grant that can be found in the LICENSE file in the root of the source
15621- * tree. All contributing project authors may be found in the AUTHORS
15622- * file in the root of the source tree.
15623- */
15624-
15625-
15626-/*!\defgroup vp8_encoder WebM VP8 Encoder
15627- * \ingroup vp8
15628- *
15629- * @{
15630- */
15631-#include "vp8.h"
15632-
15633-/*!\file vp8cx.h
15634- * \brief Provides definitions for using the VP8 encoder algorithm within the
15635- * vpx Codec Interface.
15636- */
15637-#ifndef VP8CX_H
15638-#define VP8CX_H
15639-#include "vpx_codec_impl_top.h"
15640-
15641-/*!\brief Algorithm interface for VP8
15642- *
15643- * This interface provides the capability to encode raw VP8 streams, as would
15644- * be found in AVI files.
15645- */
15646-extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
15647-
15648-
15649-/*
15650- * Algorithm Flags
15651- */
15652-
15653-/*!\brief Don't reference the last frame
15654- *
15655- * When this flag is set, the encoder will not use the last frame as a
15656- * predictor. When not set, the encoder will choose whether to use the
15657- * last frame or not automatically.
15658- */
15659-#define VP8_EFLAG_NO_REF_LAST (1<<16)
15660-
15661-
15662-/*!\brief Don't reference the golden frame
15663- *
15664- * When this flag is set, the encoder will not use the golden frame as a
15665- * predictor. When not set, the encoder will choose whether to use the
15666- * golden frame or not automatically.
15667- */
15668-#define VP8_EFLAG_NO_REF_GF (1<<17)
15669-
15670-
15671-/*!\brief Don't reference the alternate reference frame
15672- *
15673- * When this flag is set, the encoder will not use the alt ref frame as a
15674- * predictor. When not set, the encoder will choose whether to use the
15675- * alt ref frame or not automatically.
15676- */
15677-#define VP8_EFLAG_NO_REF_ARF (1<<21)
15678-
15679-
15680-/*!\brief Don't update the last frame
15681- *
15682- * When this flag is set, the encoder will not update the last frame with
15683- * the contents of the current frame.
15684- */
15685-#define VP8_EFLAG_NO_UPD_LAST (1<<18)
15686-
15687-
15688-/*!\brief Don't update the golden frame
15689- *
15690- * When this flag is set, the encoder will not update the golden frame with
15691- * the contents of the current frame.
15692- */
15693-#define VP8_EFLAG_NO_UPD_GF (1<<22)
15694-
15695-
15696-/*!\brief Don't update the alternate reference frame
15697- *
15698- * When this flag is set, the encoder will not update the alt ref frame with
15699- * the contents of the current frame.
15700- */
15701-#define VP8_EFLAG_NO_UPD_ARF (1<<23)
15702-
15703-
15704-/*!\brief Force golden frame update
15705- *
15706- * When this flag is set, the encoder copy the contents of the current frame
15707- * to the golden frame buffer.
15708- */
15709-#define VP8_EFLAG_FORCE_GF (1<<19)
15710-
15711-
15712-/*!\brief Force alternate reference frame update
15713- *
15714- * When this flag is set, the encoder copy the contents of the current frame
15715- * to the alternate reference frame buffer.
15716- */
15717-#define VP8_EFLAG_FORCE_ARF (1<<24)
15718-
15719-
15720-/*!\brief Disable entropy update
15721- *
15722- * When this flag is set, the encoder will not update its internal entropy
15723- * model based on the entropy of this frame.
15724- */
15725-#define VP8_EFLAG_NO_UPD_ENTROPY (1<<20)
15726-
15727-
15728-/*!\brief VP8 encoder control functions
15729- *
15730- * The set of macros define the control functions of VP8 encoder interface
15731- */
15732-enum vp8e_enc_control_id
15733-{
15734- VP8E_UPD_ENTROPY = 5, /**< control function to set mode of entropy update in encoder */
15735- VP8E_UPD_REFERENCE, /**< control function to set reference update mode in encoder */
15736- VP8E_USE_REFERENCE, /**< control function to set which reference frame encoder can use */
15737- VP8E_SET_ROI_MAP, /**< control function to pass an ROI map to encoder */
15738- VP8E_SET_ACTIVEMAP, /**< control function to pass an Active map to encoder */
15739- VP8E_SET_SCALEMODE = 11, /**< control function to set encoder scaling mode */
15740- VP8E_SET_CPUUSED = 13, /**< control function to set vp8 encoder cpuused */
15741- VP8E_SET_ENABLEAUTOALTREF, /**< control function to enable vp8 to automatic set and use altref frame */
15742- VP8E_SET_NOISE_SENSITIVITY, /**< control function to set noise sensitivity */
15743- VP8E_SET_SHARPNESS, /**< control function to set sharpness */
15744- VP8E_SET_STATIC_THRESHOLD, /**< control function to set the threshold for macroblocks treated static */
15745- VP8E_SET_TOKEN_PARTITIONS, /**< control function to set the number of token partitions */
15746- VP8E_GET_LAST_QUANTIZER, /**< return the quantizer chosen by the
15747- encoder for the last frame using the internal
15748- scale */
15749- VP8E_GET_LAST_QUANTIZER_64, /**< return the quantizer chosen by the
15750- encoder for the last frame, using the 0..63
15751- scale as used by the rc_*_quantizer config
15752- parameters */
15753- VP8E_SET_ARNR_MAXFRAMES, /**< control function to set the max number of frames blurred creating arf*/
15754- VP8E_SET_ARNR_STRENGTH , /**< control function to set the filter strength for the arf */
15755- VP8E_SET_ARNR_TYPE , /**< control function to set the type of filter to use for the arf*/
15756-} ;
15757-
15758-/*!\brief vpx 1-D scaling mode
15759- *
15760- * This set of constants define 1-D vpx scaling modes
15761- */
15762-typedef enum vpx_scaling_mode_1d
15763-{
15764- VP8E_NORMAL = 0,
15765- VP8E_FOURFIVE = 1,
15766- VP8E_THREEFIVE = 2,
15767- VP8E_ONETWO = 3
15768-} VPX_SCALING_MODE;
15769-
15770-
15771-/*!\brief vpx region of interest map
15772- *
15773- * These defines the data structures for the region of interest map
15774- *
15775- */
15776-
15777-typedef struct vpx_roi_map
15778-{
15779- unsigned char *roi_map; /**< specify an id between 0 and 3 for each 16x16 region within a frame */
15780- unsigned int rows; /**< number of rows */
15781- unsigned int cols; /**< number of cols */
15782- int delta_q[4]; /**< quantizer delta [-64, 64] off baseline for regions with id between 0 and 3*/
15783- int delta_lf[4]; /**< loop filter strength delta [-32, 32] for regions with id between 0 and 3 */
15784- unsigned int static_threshold[4];/**< threshold for region to be treated as static */
15785-} vpx_roi_map_t;
15786-
15787-/*!\brief vpx active region map
15788- *
15789- * These defines the data structures for active region map
15790- *
15791- */
15792-
15793-
15794-typedef struct vpx_active_map
15795-{
15796- unsigned char *active_map; /**< specify an on (1) or off (0) each 16x16 region within a frame */
15797- unsigned int rows; /**< number of rows */
15798- unsigned int cols; /**< number of cols */
15799-} vpx_active_map_t;
15800-
15801-/*!\brief vpx image scaling mode
15802- *
15803- * This defines the data structure for image scaling mode
15804- *
15805- */
15806-typedef struct vpx_scaling_mode
15807-{
15808- VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
15809- VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
15810-} vpx_scaling_mode_t;
15811-
15812-/*!\brief VP8 encoding mode
15813- *
15814- * This defines VP8 encoding mode
15815- *
15816- */
15817-typedef enum
15818-{
15819- VP8_BEST_QUALITY_ENCODING,
15820- VP8_GOOD_QUALITY_ENCODING,
15821- VP8_REAL_TIME_ENCODING
15822-} vp8e_encoding_mode;
15823-
15824-/*!\brief VP8 token partition mode
15825- *
15826- * This defines VP8 partitioning mode for compressed data, i.e., the number of
15827- * sub-streams in the bitstream. Used for parallelized decoding.
15828- *
15829- */
15830-
15831-typedef enum
15832-{
15833- VP8_ONE_TOKENPARTITION = 0,
15834- VP8_TWO_TOKENPARTITION = 1,
15835- VP8_FOUR_TOKENPARTITION = 2,
15836- VP8_EIGHT_TOKENPARTITION = 3,
15837-} vp8e_token_partitions;
15838-
15839-
15840-/*!\brief VP8 encoder control function parameter type
15841- *
15842- * Defines the data types that VP8E control functions take. Note that
15843- * additional common controls are defined in vp8.h
15844- *
15845- */
15846-
15847-
15848-/* These controls have been deprecated in favor of the flags parameter to
15849- * vpx_codec_encode(). See the definition of VP8_EFLAG_* above.
15850- */
15851-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
15852-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
15853-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
15854-
15855-VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
15856-VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
15857-VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
15858-
15859-VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
15860-VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
15861-VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
15862-VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
15863-VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
15864-VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, vp8e_token_partitions)
15865-
15866-VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
15867-VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH , unsigned int)
15868-VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_TYPE , unsigned int)
15869-
15870-
15871-VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
15872-VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
15873-
15874-/*! @} - end defgroup vp8_encoder */
15875-#include "vpx_codec_impl_bottom.h"
15876-#endif
15877diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk
15878index e7e7663..971a175 100644
15879--- a/vp8/vp8cx.mk
15880+++ b/vp8/vp8cx.mk
15881@@ -1,14 +1,18 @@
15882 ##
15883 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15884 ##
15885-## Use of this source code is governed by a BSD-style license and patent
15886-## grant that can be found in the LICENSE file in the root of the source
15887-## tree. All contributing project authors may be found in the AUTHORS
15888-## file in the root of the source tree.
15889+## Use of this source code is governed by a BSD-style license
15890+## that can be found in the LICENSE file in the root of the source
15891+## tree. An additional intellectual property rights grant can be found
15892+## in the file PATENTS. All contributing project authors may
15893+## be found in the AUTHORS file in the root of the source tree.
15894 ##
15895
15896
15897 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
15898+
15899+VP8_CX_EXPORTS += exports_enc
15900+
15901 VP8_CX_SRCS-yes += $(VP8_COMMON_SRCS-yes)
15902 VP8_CX_SRCS-no += $(VP8_COMMON_SRCS-no)
15903 VP8_CX_SRCS_REMOVE-yes += $(VP8_COMMON_SRCS_REMOVE-yes)
15904@@ -18,7 +22,7 @@ ifeq ($(ARCH_ARM),yes)
15905 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx_arm.mk
15906 endif
15907
15908-VP8_CX_SRCS-yes += vp8cx.h vp8e.h vp8_cx_iface.c
15909+VP8_CX_SRCS-yes += vp8_cx_iface.c
15910
15911 # encoder
15912 #INCLUDES += algo/vpx_common/vpx_mem/include
15913@@ -70,7 +74,7 @@ VP8_CX_SRCS-yes += encoder/quantize.c
15914 VP8_CX_SRCS-yes += encoder/ratectrl.c
15915 VP8_CX_SRCS-yes += encoder/rdopt.c
15916 VP8_CX_SRCS-yes += encoder/sad_c.c
15917-VP8_CX_SRCS-yes += encoder/ssim.c
15918+VP8_CX_SRCS-$(CONFIG_PSNR) += encoder/ssim.c
15919 VP8_CX_SRCS-yes += encoder/tokenize.c
15920 VP8_CX_SRCS-yes += encoder/treewriter.c
15921 VP8_CX_SRCS-yes += encoder/variance_c.c
15922@@ -94,11 +98,10 @@ VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/variance_impl_sse2.asm
15923 VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/sad_sse2.asm
15924 VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_sse2.asm
15925 VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/fwalsh_sse2.asm
15926+VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/quantize_sse2.asm
15927 VP8_CX_SRCS-$(HAVE_SSE3) += encoder/x86/sad_sse3.asm
15928 VP8_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/sad_ssse3.asm
15929 VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/quantize_mmx.asm
15930 VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/encodeopt.asm
15931
15932 VP8_CX_SRCS-yes := $(filter-out $(VP8_CX_SRCS_REMOVE-yes),$(VP8_CX_SRCS-yes))
15933-
15934-INSTALL-LIBS-yes += include/vp8.h include/vp8e.h include/vp8cx.h
15935diff --git a/vp8/vp8cx_arm.mk b/vp8/vp8cx_arm.mk
15936index f0753d9..16009f9 100644
15937--- a/vp8/vp8cx_arm.mk
15938+++ b/vp8/vp8cx_arm.mk
15939@@ -1,10 +1,11 @@
15940 ##
15941 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15942 ##
15943-## Use of this source code is governed by a BSD-style license and patent
15944-## grant that can be found in the LICENSE file in the root of the source
15945-## tree. All contributing project authors may be found in the AUTHORS
15946-## file in the root of the source tree.
15947+## Use of this source code is governed by a BSD-style license
15948+## that can be found in the LICENSE file in the root of the source
15949+## tree. An additional intellectual property rights grant can be found
15950+## in the file PATENTS. All contributing project authors may
15951+## be found in the AUTHORS file in the root of the source tree.
15952 ##
15953
15954
15955diff --git a/vp8/vp8dx.h b/vp8/vp8dx.h
15956deleted file mode 100644
15957index 7310b3b..0000000
15958--- a/vp8/vp8dx.h
15959+++ /dev/null
15960@@ -1,41 +0,0 @@
15961-/*
15962- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
15963- *
15964- * Use of this source code is governed by a BSD-style license and patent
15965- * grant that can be found in the LICENSE file in the root of the source
15966- * tree. All contributing project authors may be found in the AUTHORS
15967- * file in the root of the source tree.
15968- */
15969-
15970-
15971-#include "vp8.h"
15972-
15973-/*!\defgroup vp8_decoder WebM VP8 Decoder
15974- * \ingroup vp8
15975- *
15976- * @{
15977- */
15978-/*!\file vp8dx.h
15979- * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder
15980- * interface.
15981- */
15982-#ifndef VP8DX_H
15983-#define VP8DX_H
15984-#include "vpx_codec_impl_top.h"
15985-
15986-/*!\brief Algorithm interface for VP8
15987- *
15988- * This interface provides the capability to decode raw VP8 streams, as would
15989- * be found in AVI files and other non-Flash uses.
15990- */
15991-extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
15992-
15993-/* Include controls common to both the encoder and decoder */
15994-#include "vp8.h"
15995-
15996-
15997-/*! @} - end defgroup vp8_decoder */
15998-
15999-
16000-#include "vpx_codec_impl_bottom.h"
16001-#endif
16002diff --git a/vp8/vp8dx.mk b/vp8/vp8dx.mk
16003index e6af543..24f18b7 100644
16004--- a/vp8/vp8dx.mk
16005+++ b/vp8/vp8dx.mk
16006@@ -1,14 +1,18 @@
16007 ##
16008 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
16009 ##
16010-## Use of this source code is governed by a BSD-style license and patent
16011-## grant that can be found in the LICENSE file in the root of the source
16012-## tree. All contributing project authors may be found in the AUTHORS
16013-## file in the root of the source tree.
16014+## Use of this source code is governed by a BSD-style license
16015+## that can be found in the LICENSE file in the root of the source
16016+## tree. An additional intellectual property rights grant can be found
16017+## in the file PATENTS. All contributing project authors may
16018+## be found in the AUTHORS file in the root of the source tree.
16019 ##
16020
16021
16022 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
16023+
16024+VP8_DX_EXPORTS += exports_dec
16025+
16026 VP8_DX_SRCS-yes += $(VP8_COMMON_SRCS-yes)
16027 VP8_DX_SRCS-no += $(VP8_COMMON_SRCS-no)
16028 VP8_DX_SRCS_REMOVE-yes += $(VP8_COMMON_SRCS_REMOVE-yes)
16029@@ -18,7 +22,7 @@ ifeq ($(ARCH_ARM),yes)
16030 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx_arm.mk
16031 endif
16032
16033-VP8_DX_SRCS-yes += vp8dx.h vp8_dx_iface.c
16034+VP8_DX_SRCS-yes += vp8_dx_iface.c
16035
16036 CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)decoder
16037
16038@@ -69,8 +73,6 @@ VP8_DX_SRCS-yes += decoder/threading.c
16039
16040 VP8_DX_SRCS-yes := $(filter-out $(VP8_DX_SRCS_REMOVE-yes),$(VP8_DX_SRCS-yes))
16041
16042-INSTALL-LIBS-yes += include/vp8.h include/vp8dx.h
16043-
16044 VP8_DX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += decoder/x86/dequantize_x86.h
16045 VP8_DX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += decoder/x86/x86_dsystemdependent.c
16046 VP8_DX_SRCS-$(HAVE_MMX) += decoder/x86/dequantize_mmx.asm
16047diff --git a/vp8/vp8dx_arm.mk b/vp8/vp8dx_arm.mk
16048index 1b4a7ec..58ccac5 100644
16049--- a/vp8/vp8dx_arm.mk
16050+++ b/vp8/vp8dx_arm.mk
16051@@ -1,10 +1,11 @@
16052 ##
16053 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
16054 ##
16055-## Use of this source code is governed by a BSD-style license and patent
16056-## grant that can be found in the LICENSE file in the root of the source
16057-## tree. All contributing project authors may be found in the AUTHORS
16058-## file in the root of the source tree.
16059+## Use of this source code is governed by a BSD-style license
16060+## that can be found in the LICENSE file in the root of the source
16061+## tree. An additional intellectual property rights grant can be found
16062+## in the file PATENTS. All contributing project authors may
16063+## be found in the AUTHORS file in the root of the source tree.
16064 ##
16065
16066
16067diff --git a/vp8/vp8e.h b/vp8/vp8e.h
16068deleted file mode 100644
16069index a90aa2a..0000000
16070--- a/vp8/vp8e.h
16071+++ /dev/null
16072@@ -1,62 +0,0 @@
16073-/*
16074- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
16075- *
16076- * Use of this source code is governed by a BSD-style license and patent
16077- * grant that can be found in the LICENSE file in the root of the source
16078- * tree. All contributing project authors may be found in the AUTHORS
16079- * file in the root of the source tree.
16080- */
16081-
16082-
16083-/* This file contains backwards compatibility stubs for applications using
16084- * the VP8 version 1.0 API.
16085- */
16086-#ifndef VP8E_H
16087-#define VP8E_H
16088-#include "vpx_codec_impl_top.h"
16089-
16090-#if defined(VPX_CODEC_DISABLE_COMPAT) && VPX_CODEC_DISABLE_COMPAT
16091-#error "Backwards compatibility disabled: don't include vp8e.h"
16092-#endif
16093-
16094-#include "vp8cx.h"
16095-DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_enc_vp8_algo DEPRECATED;
16096-
16097-
16098-enum
16099-{
16100- VP8E_SET_REFERENCE = VP8_SET_REFERENCE,
16101- VP8E_COPY_REFERENCE = VP8_COPY_REFERENCE,
16102- VP8E_SET_PREVIEWPP = VP8_SET_POSTPROC,
16103- VP8E_SET_FLUSHFLAG = 4,
16104- VP8E_SET_FRAMETYPE = 10,
16105- VP8E_SET_ENCODING_MODE = 12
16106-};
16107-
16108-#define NORMAL_FRAME (0)
16109-#define KEY_FRAME (1)
16110-
16111-/* Change VP8E to VP8 to get the undeprecated version of these (defined in
16112- * vp8.h)
16113- */
16114-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_REFERENCE, vpx_ref_frame_t *)
16115-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_COPY_REFERENCE, vpx_ref_frame_t *)
16116-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_PREVIEWPP, vp8_postproc_cfg_t *)
16117-
16118-
16119-/* Flush is done by calling vpx_codec_encode with a NULL input image. */
16120-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FLUSHFLAG, int)
16121-
16122-
16123-/* Frame type is set with a flag to vpx_codec_control. See VPX_EFLAG_FORCE_KF
16124- */
16125-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FRAMETYPE, int)
16126-
16127-
16128-/* This control has been deprecated in favor of the duration parameter to
16129- * vpx_codec_encode(). Use the #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
16130- * #VPX_DL_BEST_QUALITY constants to that parameter instead.
16131- */
16132-VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ENCODING_MODE, vp8e_encoding_mode)
16133-#include "vpx_codec_impl_bottom.h"
16134-#endif
16135diff --git a/vpx/exports_com b/vpx/exports_com
16136new file mode 100644
16137index 0000000..2ab0509
16138--- /dev/null
16139+++ b/vpx/exports_com
16140@@ -0,0 +1,16 @@
16141+text vpx_codec_build_config
16142+text vpx_codec_control_
16143+text vpx_codec_destroy
16144+text vpx_codec_err_to_string
16145+text vpx_codec_error
16146+text vpx_codec_error_detail
16147+text vpx_codec_get_caps
16148+text vpx_codec_iface_name
16149+text vpx_codec_version
16150+text vpx_codec_version_extra_str
16151+text vpx_codec_version_str
16152+text vpx_img_alloc
16153+text vpx_img_flip
16154+text vpx_img_free
16155+text vpx_img_set_rect
16156+text vpx_img_wrap
16157diff --git a/vpx/exports_dec b/vpx/exports_dec
16158new file mode 100644
16159index 0000000..ed121f7
16160--- /dev/null
16161+++ b/vpx/exports_dec
16162@@ -0,0 +1,9 @@
16163+text vpx_codec_dec_init_ver
16164+text vpx_codec_decode
16165+text vpx_codec_get_frame
16166+text vpx_codec_get_mem_map
16167+text vpx_codec_get_stream_info
16168+text vpx_codec_peek_stream_info
16169+text vpx_codec_register_put_frame_cb
16170+text vpx_codec_register_put_slice_cb
16171+text vpx_codec_set_mem_map
16172diff --git a/vpx/exports_enc b/vpx/exports_enc
16173new file mode 100644
16174index 0000000..3d56749
16175--- /dev/null
16176+++ b/vpx/exports_enc
16177@@ -0,0 +1,8 @@
16178+text vpx_codec_enc_config_default
16179+text vpx_codec_enc_config_set
16180+text vpx_codec_enc_init_ver
16181+text vpx_codec_encode
16182+text vpx_codec_get_cx_data
16183+text vpx_codec_get_global_headers
16184+text vpx_codec_get_preview_frame
16185+text vpx_codec_set_cx_data_buf
16186diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
16187new file mode 100644
16188index 0000000..c653cc5
16189--- /dev/null
16190+++ b/vpx/internal/vpx_codec_internal.h
16191@@ -0,0 +1,457 @@
16192+/*
16193+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
16194+ *
16195+ * Use of this source code is governed by a BSD-style license
16196+ * that can be found in the LICENSE file in the root of the source
16197+ * tree. An additional intellectual property rights grant can be found
16198+ * in the file PATENTS. All contributing project authors may
16199+ * be found in the AUTHORS file in the root of the source tree.
16200+ */
16201+
16202+
16203+/*!\file decoder_impl.h
16204+ * \brief Describes the decoder algorithm interface for algorithm
16205+ * implementations.
16206+ *
16207+ * This file defines the private structures and data types that are only
16208+ * relevant to implementing an algorithm, as opposed to using it.
16209+ *
16210+ * To create a decoder algorithm class, an interface structure is put
16211+ * into the global namespace:
16212+ * <pre>
16213+ * my_codec.c:
16214+ * vpx_codec_iface_t my_codec = {
16215+ * "My Codec v1.0",
16216+ * VPX_CODEC_ALG_ABI_VERSION,
16217+ * ...
16218+ * };
16219+ * </pre>
16220+ *
16221+ * An application instantiates a specific decoder instance by using
16222+ * vpx_codec_init() and a pointer to the algorithm's interface structure:
16223+ * <pre>
16224+ * my_app.c:
16225+ * extern vpx_codec_iface_t my_codec;
16226+ * {
16227+ * vpx_codec_ctx_t algo;
16228+ * res = vpx_codec_init(&algo, &my_codec);
16229+ * }
16230+ * </pre>
16231+ *
16232+ * Once initialized, the instance is manged using other functions from
16233+ * the vpx_codec_* family.
16234+ */
16235+#ifndef VPX_CODEC_INTERNAL_H
16236+#define VPX_CODEC_INTERNAL_H
16237+#include "../vpx_decoder.h"
16238+#include "../vpx_encoder.h"
16239+#include <stdarg.h>
16240+
16241+
16242+/*!\brief Current ABI version number
16243+ *
16244+ * \internal
16245+ * If this file is altered in any way that changes the ABI, this value
16246+ * must be bumped. Examples include, but are not limited to, changing
16247+ * types, removing or reassigning enums, adding/removing/rearranging
16248+ * fields to structures
16249+ */
16250+#define VPX_CODEC_INTERNAL_ABI_VERSION (3) /**<\hideinitializer*/
16251+
16252+typedef struct vpx_codec_alg_priv vpx_codec_alg_priv_t;
16253+
16254+/*!\brief init function pointer prototype
16255+ *
16256+ * Performs algorithm-specific initialization of the decoder context. This
16257+ * function is called by the generic vpx_codec_init() wrapper function, so
16258+ * plugins implementing this interface may trust the input parameters to be
16259+ * properly initialized.
16260+ *
16261+ * \param[in] ctx Pointer to this instance's context
16262+ * \retval #VPX_CODEC_OK
16263+ * The input stream was recognized and decoder initialized.
16264+ * \retval #VPX_CODEC_MEM_ERROR
16265+ * Memory operation failed.
16266+ */
16267+typedef vpx_codec_err_t (*vpx_codec_init_fn_t)(vpx_codec_ctx_t *ctx);
16268+
16269+/*!\brief destroy function pointer prototype
16270+ *
16271+ * Performs algorithm-specific destruction of the decoder context. This
16272+ * function is called by the generic vpx_codec_destroy() wrapper function,
16273+ * so plugins implementing this interface may trust the input parameters
16274+ * to be properly initialized.
16275+ *
16276+ * \param[in] ctx Pointer to this instance's context
16277+ * \retval #VPX_CODEC_OK
16278+ * The input stream was recognized and decoder initialized.
16279+ * \retval #VPX_CODEC_MEM_ERROR
16280+ * Memory operation failed.
16281+ */
16282+typedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);
16283+
16284+/*!\brief parse stream info function pointer prototype
16285+ *
16286+ * Performs high level parsing of the bitstream. This function is called by
16287+ * the generic vpx_codec_parse_stream() wrapper function, so plugins implementing
16288+ * this interface may trust the input parameters to be properly initialized.
16289+ *
16290+ * \param[in] data Pointer to a block of data to parse
16291+ * \param[in] data_sz Size of the data buffer
16292+ * \param[in,out] si Pointer to stream info to update. The size member
16293+ * \ref MUST be properly initialized, but \ref MAY be
16294+ * clobbered by the algorithm. This parameter \ref MAY
16295+ * be NULL.
16296+ *
16297+ * \retval #VPX_CODEC_OK
16298+ * Bitstream is parsable and stream information updated
16299+ */
16300+typedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t *data,
16301+ unsigned int data_sz,
16302+ vpx_codec_stream_info_t *si);
16303+
16304+/*!\brief Return information about the current stream.
16305+ *
16306+ * Returns information about the stream that has been parsed during decoding.
16307+ *
16308+ * \param[in] ctx Pointer to this instance's context
16309+ * \param[in,out] si Pointer to stream info to update. The size member
16310+ * \ref MUST be properly initialized, but \ref MAY be
16311+ * clobbered by the algorithm. This parameter \ref MAY
16312+ * be NULL.
16313+ *
16314+ * \retval #VPX_CODEC_OK
16315+ * Bitstream is parsable and stream information updated
16316+ */
16317+typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t *ctx,
16318+ vpx_codec_stream_info_t *si);
16319+
16320+/*!\brief control function pointer prototype
16321+ *
16322+ * This function is used to exchange algorithm specific data with the decoder
16323+ * instance. This can be used to implement features specific to a particular
16324+ * algorithm.
16325+ *
16326+ * This function is called by the generic vpx_codec_control() wrapper
16327+ * function, so plugins implementing this interface may trust the input
16328+ * parameters to be properly initialized. However, this interface does not
16329+ * provide type safety for the exchanged data or assign meanings to the
16330+ * control codes. Those details should be specified in the algorithm's
16331+ * header file. In particular, the ctrl_id parameter is guaranteed to exist
16332+ * in the algorithm's control mapping table, and the data paramter may be NULL.
16333+ *
16334+ *
16335+ * \param[in] ctx Pointer to this instance's context
16336+ * \param[in] ctrl_id Algorithm specific control identifier
16337+ * \param[in,out] data Data to exchange with algorithm instance.
16338+ *
16339+ * \retval #VPX_CODEC_OK
16340+ * The internal state data was deserialized.
16341+ */
16342+typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
16343+ int ctrl_id,
16344+ va_list ap);
16345+
16346+/*!\brief control function pointer mapping
16347+ *
16348+ * This structure stores the mapping between control identifiers and
16349+ * implementing functions. Each algorithm provides a list of these
16350+ * mappings. This list is searched by the vpx_codec_control() wrapper
16351+ * function to determine which function to invoke. The special
16352+ * value {0, NULL} is used to indicate end-of-list, and must be
16353+ * present. The special value {0, <non-null>} can be used as a catch-all
16354+ * mapping. This implies that ctrl_id values chosen by the algorithm
16355+ * \ref MUST be non-zero.
16356+ */
16357+typedef const struct
16358+{
16359+ int ctrl_id;
16360+ vpx_codec_control_fn_t fn;
16361+} vpx_codec_ctrl_fn_map_t;
16362+
16363+/*!\brief decode data function pointer prototype
16364+ *
16365+ * Processes a buffer of coded data. If the processing results in a new
16366+ * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
16367+ * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
16368+ * function is called by the generic vpx_codec_decode() wrapper function,
16369+ * so plugins implementing this interface may trust the input parameters
16370+ * to be properly initialized.
16371+ *
16372+ * \param[in] ctx Pointer to this instance's context
16373+ * \param[in] data Pointer to this block of new coded data. If
16374+ * NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
16375+ * for the previously decoded frame.
16376+ * \param[in] data_sz Size of the coded data, in bytes.
16377+ *
16378+ * \return Returns #VPX_CODEC_OK if the coded data was processed completely
16379+ * and future pictures can be decoded without error. Otherwise,
16380+ * see the descriptions of the other error codes in ::vpx_codec_err_t
16381+ * for recoverability capabilities.
16382+ */
16383+typedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t *ctx,
16384+ const uint8_t *data,
16385+ unsigned int data_sz,
16386+ void *user_priv,
16387+ long deadline);
16388+
16389+/*!\brief Decoded frames iterator
16390+ *
16391+ * Iterates over a list of the frames available for display. The iterator
16392+ * storage should be initialized to NULL to start the iteration. Iteration is
16393+ * complete when this function returns NULL.
16394+ *
16395+ * The list of available frames becomes valid upon completion of the
16396+ * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
16397+ *
16398+ * \param[in] ctx Pointer to this instance's context
16399+ * \param[in out] iter Iterator storage, initialized to NULL
16400+ *
16401+ * \return Returns a pointer to an image, if one is ready for display. Frames
16402+ * produced will always be in PTS (presentation time stamp) order.
16403+ */
16404+typedef vpx_image_t*(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
16405+ vpx_codec_iter_t *iter);
16406+
16407+
16408+/*\brief e_xternal Memory Allocation memory map get iterator
16409+ *
16410+ * Iterates over a list of the memory maps requested by the decoder. The
16411+ * iterator storage should be initialized to NULL to start the iteration.
16412+ * Iteration is complete when this function returns NULL.
16413+ *
16414+ * \param[in out] iter Iterator storage, initialized to NULL
16415+ *
16416+ * \return Returns a pointer to an memory segment descriptor, or NULL to
16417+ * indicate end-of-list.
16418+ */
16419+typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *ctx,
16420+ vpx_codec_mmap_t *mmap,
16421+ vpx_codec_iter_t *iter);
16422+
16423+
16424+/*\brief e_xternal Memory Allocation memory map set iterator
16425+ *
16426+ * Sets a memory descriptor inside the decoder instance.
16427+ *
16428+ * \param[in] ctx Pointer to this instance's context
16429+ * \param[in] mmap Memory map to store.
16430+ *
16431+ * \retval #VPX_CODEC_OK
16432+ * The memory map was accepted and stored.
16433+ * \retval #VPX_CODEC_MEM_ERROR
16434+ * The memory map was rejected.
16435+ */
16436+typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
16437+ const vpx_codec_mmap_t *mmap);
16438+
16439+
16440+typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
16441+ const vpx_image_t *img,
16442+ vpx_codec_pts_t pts,
16443+ unsigned long duration,
16444+ vpx_enc_frame_flags_t flags,
16445+ unsigned long deadline);
16446+typedef const vpx_codec_cx_pkt_t*(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_priv_t *ctx,
16447+ vpx_codec_iter_t *iter);
16448+
16449+typedef vpx_codec_err_t
16450+(*vpx_codec_enc_config_set_fn_t)(vpx_codec_alg_priv_t *ctx,
16451+ const vpx_codec_enc_cfg_t *cfg);
16452+typedef vpx_fixed_buf_t *
16453+(*vpx_codec_get_global_headers_fn_t)(vpx_codec_alg_priv_t *ctx);
16454+
16455+typedef vpx_image_t *
16456+(*vpx_codec_get_preview_frame_fn_t)(vpx_codec_alg_priv_t *ctx);
16457+
16458+/*!\brief usage configuration mapping
16459+ *
16460+ * This structure stores the mapping between usage identifiers and
16461+ * configuration structures. Each algorithm provides a list of these
16462+ * mappings. This list is searched by the vpx_codec_enc_config_default()
16463+ * wrapper function to determine which config to return. The special value
16464+ * {-1, {0}} is used to indicate end-of-list, and must be present. At least
16465+ * one mapping must be present, in addition to the end-of-list.
16466+ *
16467+ */
16468+typedef const struct
16469+{
16470+ int usage;
16471+ vpx_codec_enc_cfg_t cfg;
16472+} vpx_codec_enc_cfg_map_t;
16473+
16474+#define NOT_IMPLEMENTED 0
16475+
16476+/*!\brief Decoder algorithm interface interface
16477+ *
16478+ * All decoders \ref MUST expose a variable of this type.
16479+ */
16480+struct vpx_codec_iface
16481+{
16482+ const char *name; /**< Identification String */
16483+ int abi_version; /**< Implemented ABI version */
16484+ vpx_codec_caps_t caps; /**< Decoder capabilities */
16485+ vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
16486+ vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
16487+ vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
16488+ vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
16489+ vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
16490+ struct
16491+ {
16492+ vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
16493+ vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
16494+ vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */
16495+ vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_fn_t */
16496+ } dec;
16497+ struct
16498+ {
16499+ vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_enc_cfg_map_t */
16500+ vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */
16501+ vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
16502+ vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
16503+ vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
16504+ vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
16505+ } enc;
16506+};
16507+
16508+/*!\brief Callback function pointer / user data pair storage */
16509+typedef struct vpx_codec_priv_cb_pair
16510+{
16511+ union
16512+ {
16513+ vpx_codec_put_frame_cb_fn_t put_frame;
16514+ vpx_codec_put_slice_cb_fn_t put_slice;
16515+ };
16516+ void *user_priv;
16517+} vpx_codec_priv_cb_pair_t;
16518+
16519+
16520+/*!\brief Instance private storage
16521+ *
16522+ * This structure is allocated by the algorithm's init function. It can be
16523+ * extended in one of two ways. First, a second, algorithm specific structure
16524+ * can be allocated and the priv member pointed to it. Alternatively, this
16525+ * structure can be made the first member of the algorithm specific structure,
16526+ * and the pointer casted to the proper type.
16527+ */
16528+struct vpx_codec_priv
16529+{
16530+ unsigned int sz;
16531+ vpx_codec_iface_t *iface;
16532+ struct vpx_codec_alg_priv *alg_priv;
16533+ const char *err_detail;
16534+ vpx_codec_flags_t init_flags;
16535+ struct
16536+ {
16537+ vpx_codec_priv_cb_pair_t put_frame_cb;
16538+ vpx_codec_priv_cb_pair_t put_slice_cb;
16539+ } dec;
16540+ struct
16541+ {
16542+ int tbd;
16543+ struct vpx_fixed_buf cx_data_dst_buf;
16544+ unsigned int cx_data_pad_before;
16545+ unsigned int cx_data_pad_after;
16546+ vpx_codec_cx_pkt_t cx_data_pkt;
16547+ } enc;
16548+};
16549+
16550+#undef VPX_CTRL_USE_TYPE
16551+#define VPX_CTRL_USE_TYPE(id, typ) \
16552+ static typ id##__value(va_list args) {return va_arg(args, typ);} \
16553+ static typ id##__convert(void *x)\
16554+ {\
16555+ union\
16556+ {\
16557+ void *x;\
16558+ typ d;\
16559+ } u;\
16560+ u.x = x;\
16561+ return u.d;\
16562+ }
16563+
16564+
16565+#undef VPX_CTRL_USE_TYPE_DEPRECATED
16566+#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
16567+ static typ id##__value(va_list args) {return va_arg(args, typ);} \
16568+ static typ id##__convert(void *x)\
16569+ {\
16570+ union\
16571+ {\
16572+ void *x;\
16573+ typ d;\
16574+ } u;\
16575+ u.x = x;\
16576+ return u.d;\
16577+ }
16578+
16579+#define CAST(id, arg) id##__value(arg)
16580+#define RECAST(id, x) id##__convert(x)
16581+
16582+
16583+/* Internal Utility Functions
16584+ *
16585+ * The following functions are indended to be used inside algorithms as
16586+ * utilities for manipulating vpx_codec_* data structures.
16587+ */
16588+struct vpx_codec_pkt_list
16589+{
16590+ unsigned int cnt;
16591+ unsigned int max;
16592+ struct vpx_codec_cx_pkt pkts[1];
16593+};
16594+
16595+#define vpx_codec_pkt_list_decl(n)\
16596+ union {struct vpx_codec_pkt_list head;\
16597+ struct {struct vpx_codec_pkt_list head;\
16598+ struct vpx_codec_cx_pkt pkts[n];} alloc;}
16599+
16600+#define vpx_codec_pkt_list_init(m)\
16601+ (m)->alloc.head.cnt = 0,\
16602+ (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
16603+
16604+int
16605+vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
16606+ const struct vpx_codec_cx_pkt *);
16607+
16608+const vpx_codec_cx_pkt_t*
16609+vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
16610+ vpx_codec_iter_t *iter);
16611+
16612+
16613+#include <stdio.h>
16614+#include <setjmp.h>
16615+struct vpx_internal_error_info
16616+{
16617+ vpx_codec_err_t error_code;
16618+ int has_detail;
16619+ char detail[80];
16620+ int setjmp;
16621+ jmp_buf jmp;
16622+};
16623+
16624+static void vpx_internal_error(struct vpx_internal_error_info *info,
16625+ vpx_codec_err_t error,
16626+ const char *fmt,
16627+ ...)
16628+{
16629+ va_list ap;
16630+
16631+ info->error_code = error;
16632+ info->has_detail = 0;
16633+
16634+ if (fmt)
16635+ {
16636+ size_t sz = sizeof(info->detail);
16637+
16638+ info->has_detail = 1;
16639+ va_start(ap, fmt);
16640+ vsnprintf(info->detail, sz - 1, fmt, ap);
16641+ va_end(ap);
16642+ info->detail[sz-1] = '\0';
16643+ }
16644+
16645+ if (info->setjmp)
16646+ longjmp(info->jmp, info->error_code);
16647+}
16648+#endif
16649diff --git a/vpx/src/vpx_codec.c b/vpx/src/vpx_codec.c
16650new file mode 100644
16651index 0000000..0ef3a7b
16652--- /dev/null
16653+++ b/vpx/src/vpx_codec.c
16654@@ -0,0 +1,150 @@
16655+/*
16656+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
16657+ *
16658+ * Use of this source code is governed by a BSD-style license
16659+ * that can be found in the LICENSE file in the root of the source
16660+ * tree. An additional intellectual property rights grant can be found
16661+ * in the file PATENTS. All contributing project authors may
16662+ * be found in the AUTHORS file in the root of the source tree.
16663+ */
16664+
16665+
16666+/*!\file vpx_decoder.c
16667+ * \brief Provides the high level interface to wrap decoder algorithms.
16668+ *
16669+ */
16670+#include <stdarg.h>
16671+#include "vpx/vpx_integer.h"
16672+#include "vpx/internal/vpx_codec_internal.h"
16673+#include "vpx_version.h"
16674+
16675+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
16676+
16677+int vpx_codec_version(void)
16678+{
16679+ return VERSION_PACKED;
16680+}
16681+
16682+
16683+const char *vpx_codec_version_str(void)
16684+{
16685+ return VERSION_STRING_NOSP;
16686+}
16687+
16688+
16689+const char *vpx_codec_version_extra_str(void)
16690+{
16691+ return VERSION_EXTRA;
16692+}
16693+
16694+
16695+const char *vpx_codec_iface_name(vpx_codec_iface_t *iface)
16696+{
16697+ return iface ? iface->name : "<invalid interface>";
16698+}
16699+
16700+const char *vpx_codec_err_to_string(vpx_codec_err_t err)
16701+{
16702+ switch (err)
16703+ {
16704+ case VPX_CODEC_OK:
16705+ return "Success";
16706+ case VPX_CODEC_ERROR:
16707+ return "Unspecified internal error";
16708+ case VPX_CODEC_MEM_ERROR:
16709+ return "Memory allocation error";
16710+ case VPX_CODEC_ABI_MISMATCH:
16711+ return "ABI version mismatch";
16712+ case VPX_CODEC_INCAPABLE:
16713+ return "Codec does not implement requested capability";
16714+ case VPX_CODEC_UNSUP_BITSTREAM:
16715+ return "Bitstream not supported by this decoder";
16716+ case VPX_CODEC_UNSUP_FEATURE:
16717+ return "Bitstream required feature not supported by this decoder";
16718+ case VPX_CODEC_CORRUPT_FRAME:
16719+ return "Corrupt frame detected";
16720+ case VPX_CODEC_INVALID_PARAM:
16721+ return "Invalid parameter";
16722+ case VPX_CODEC_LIST_END:
16723+ return "End of iterated list";
16724+ }
16725+
16726+ return "Unrecognized error code";
16727+}
16728+
16729+const char *vpx_codec_error(vpx_codec_ctx_t *ctx)
16730+{
16731+ return (ctx) ? vpx_codec_err_to_string(ctx->err)
16732+ : vpx_codec_err_to_string(VPX_CODEC_INVALID_PARAM);
16733+}
16734+
16735+const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
16736+{
16737+ if (ctx && ctx->err)
16738+ return ctx->priv ? ctx->priv->err_detail : ctx->err_detail;
16739+
16740+ return NULL;
16741+}
16742+
16743+
16744+vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
16745+{
16746+ vpx_codec_err_t res;
16747+
16748+ if (!ctx)
16749+ res = VPX_CODEC_INVALID_PARAM;
16750+ else if (!ctx->iface || !ctx->priv)
16751+ res = VPX_CODEC_ERROR;
16752+ else
16753+ {
16754+ if (ctx->priv->alg_priv)
16755+ ctx->iface->destroy(ctx->priv->alg_priv);
16756+
16757+ ctx->iface = NULL;
16758+ ctx->name = NULL;
16759+ ctx->priv = NULL;
16760+ res = VPX_CODEC_OK;
16761+ }
16762+
16763+ return SAVE_STATUS(ctx, res);
16764+}
16765+
16766+
16767+vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
16768+{
16769+ return (iface) ? iface->caps : 0;
16770+}
16771+
16772+
16773+vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
16774+ int ctrl_id,
16775+ ...)
16776+{
16777+ vpx_codec_err_t res;
16778+
16779+ if (!ctx || !ctrl_id)
16780+ res = VPX_CODEC_INVALID_PARAM;
16781+ else if (!ctx->iface || !ctx->priv || !ctx->iface->ctrl_maps)
16782+ res = VPX_CODEC_ERROR;
16783+ else
16784+ {
16785+ vpx_codec_ctrl_fn_map_t *entry;
16786+
16787+ res = VPX_CODEC_ERROR;
16788+
16789+ for (entry = ctx->iface->ctrl_maps; entry && entry->fn; entry++)
16790+ {
16791+ if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
16792+ {
16793+ va_list ap;
16794+
16795+ va_start(ap, ctrl_id);
16796+ res = entry->fn(ctx->priv->alg_priv, ctrl_id, ap);
16797+ va_end(ap);
16798+ break;
16799+ }
16800+ }
16801+ }
16802+
16803+ return SAVE_STATUS(ctx, res);
16804+}
16805diff --git a/vpx/src/vpx_decoder.c b/vpx/src/vpx_decoder.c
16806new file mode 100644
16807index 0000000..cbf5259
16808--- /dev/null
16809+++ b/vpx/src/vpx_decoder.c
16810@@ -0,0 +1,237 @@
16811+/*
16812+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
16813+ *
16814+ * Use of this source code is governed by a BSD-style license
16815+ * that can be found in the LICENSE file in the root of the source
16816+ * tree. An additional intellectual property rights grant can be found
16817+ * in the file PATENTS. All contributing project authors may
16818+ * be found in the AUTHORS file in the root of the source tree.
16819+ */
16820+
16821+
16822+/*!\file vpx_decoder.c
16823+ * \brief Provides the high level interface to wrap decoder algorithms.
16824+ *
16825+ */
16826+#include <string.h>
16827+#include "vpx/internal/vpx_codec_internal.h"
16828+
16829+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
16830+
16831+vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
16832+ vpx_codec_iface_t *iface,
16833+ vpx_codec_dec_cfg_t *cfg,
16834+ vpx_codec_flags_t flags,
16835+ int ver)
16836+{
16837+ vpx_codec_err_t res;
16838+
16839+ if (ver != VPX_DECODER_ABI_VERSION)
16840+ res = VPX_CODEC_ABI_MISMATCH;
16841+ else if (!ctx || !iface)
16842+ res = VPX_CODEC_INVALID_PARAM;
16843+ else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
16844+ res = VPX_CODEC_ABI_MISMATCH;
16845+ else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
16846+ res = VPX_CODEC_INCAPABLE;
16847+ else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
16848+ res = VPX_CODEC_INCAPABLE;
16849+ else
16850+ {
16851+ memset(ctx, 0, sizeof(*ctx));
16852+ ctx->iface = iface;
16853+ ctx->name = iface->name;
16854+ ctx->priv = NULL;
16855+ ctx->init_flags = flags;
16856+ ctx->config.dec = cfg;
16857+ res = VPX_CODEC_OK;
16858+
16859+ if (!(flags & VPX_CODEC_USE_XMA))
16860+ {
16861+ res = ctx->iface->init(ctx);
16862+
16863+ if (res)
16864+ {
16865+ ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
16866+ vpx_codec_destroy(ctx);
16867+ }
16868+
16869+ if (ctx->priv)
16870+ ctx->priv->iface = ctx->iface;
16871+ }
16872+ }
16873+
16874+ return SAVE_STATUS(ctx, res);
16875+}
16876+
16877+
16878+vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
16879+ const uint8_t *data,
16880+ unsigned int data_sz,
16881+ vpx_codec_stream_info_t *si)
16882+{
16883+ vpx_codec_err_t res;
16884+
16885+ if (!iface || !data || !data_sz || !si
16886+ || si->sz < sizeof(vpx_codec_stream_info_t))
16887+ res = VPX_CODEC_INVALID_PARAM;
16888+ else
16889+ {
16890+ /* Set default/unknown values */
16891+ si->w = 0;
16892+ si->h = 0;
16893+
16894+ res = iface->dec.peek_si(data, data_sz, si);
16895+ }
16896+
16897+ return res;
16898+}
16899+
16900+
16901+vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
16902+ vpx_codec_stream_info_t *si)
16903+{
16904+ vpx_codec_err_t res;
16905+
16906+ if (!ctx || !si || si->sz < sizeof(vpx_codec_stream_info_t))
16907+ res = VPX_CODEC_INVALID_PARAM;
16908+ else if (!ctx->iface || !ctx->priv)
16909+ res = VPX_CODEC_ERROR;
16910+ else
16911+ {
16912+ /* Set default/unknown values */
16913+ si->w = 0;
16914+ si->h = 0;
16915+
16916+ res = ctx->iface->dec.get_si(ctx->priv->alg_priv, si);
16917+ }
16918+
16919+ return SAVE_STATUS(ctx, res);
16920+}
16921+
16922+
16923+vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
16924+ const uint8_t *data,
16925+ unsigned int data_sz,
16926+ void *user_priv,
16927+ long deadline)
16928+{
16929+ vpx_codec_err_t res;
16930+
16931+ if (!ctx || !data || !data_sz)
16932+ res = VPX_CODEC_INVALID_PARAM;
16933+ else if (!ctx->iface || !ctx->priv)
16934+ res = VPX_CODEC_ERROR;
16935+ else
16936+ {
16937+ res = ctx->iface->dec.decode(ctx->priv->alg_priv, data, data_sz,
16938+ user_priv, deadline);
16939+ }
16940+
16941+ return SAVE_STATUS(ctx, res);
16942+}
16943+
16944+vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
16945+ vpx_codec_iter_t *iter)
16946+{
16947+ vpx_image_t *img;
16948+
16949+ if (!ctx || !iter || !ctx->iface || !ctx->priv)
16950+ img = NULL;
16951+ else
16952+ img = ctx->iface->dec.get_frame(ctx->priv->alg_priv, iter);
16953+
16954+ return img;
16955+}
16956+
16957+
16958+vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
16959+ vpx_codec_put_frame_cb_fn_t cb,
16960+ void *user_priv)
16961+{
16962+ vpx_codec_err_t res;
16963+
16964+ if (!ctx || !cb)
16965+ res = VPX_CODEC_INVALID_PARAM;
16966+ else if (!ctx->iface || !ctx->priv
16967+ || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
16968+ res = VPX_CODEC_ERROR;
16969+ else
16970+ {
16971+ ctx->priv->dec.put_frame_cb.put_frame = cb;
16972+ ctx->priv->dec.put_frame_cb.user_priv = user_priv;
16973+ res = VPX_CODEC_OK;
16974+ }
16975+
16976+ return SAVE_STATUS(ctx, res);
16977+}
16978+
16979+
16980+vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
16981+ vpx_codec_put_slice_cb_fn_t cb,
16982+ void *user_priv)
16983+{
16984+ vpx_codec_err_t res;
16985+
16986+ if (!ctx || !cb)
16987+ res = VPX_CODEC_INVALID_PARAM;
16988+ else if (!ctx->iface || !ctx->priv
16989+ || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
16990+ res = VPX_CODEC_ERROR;
16991+ else
16992+ {
16993+ ctx->priv->dec.put_slice_cb.put_slice = cb;
16994+ ctx->priv->dec.put_slice_cb.user_priv = user_priv;
16995+ res = VPX_CODEC_OK;
16996+ }
16997+
16998+ return SAVE_STATUS(ctx, res);
16999+}
17000+
17001+
17002+vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
17003+ vpx_codec_mmap_t *mmap,
17004+ vpx_codec_iter_t *iter)
17005+{
17006+ vpx_codec_err_t res = VPX_CODEC_OK;
17007+
17008+ if (!ctx || !mmap || !iter || !ctx->iface)
17009+ res = VPX_CODEC_INVALID_PARAM;
17010+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
17011+ res = VPX_CODEC_ERROR;
17012+ else
17013+ res = ctx->iface->get_mmap(ctx, mmap, iter);
17014+
17015+ return SAVE_STATUS(ctx, res);
17016+}
17017+
17018+
17019+vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
17020+ vpx_codec_mmap_t *mmap,
17021+ unsigned int num_maps)
17022+{
17023+ vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
17024+
17025+ if (!ctx || !mmap || !ctx->iface)
17026+ res = VPX_CODEC_INVALID_PARAM;
17027+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
17028+ res = VPX_CODEC_ERROR;
17029+ else
17030+ {
17031+ unsigned int i;
17032+
17033+ for (i = 0; i < num_maps; i++, mmap++)
17034+ {
17035+ if (!mmap->base)
17036+ break;
17037+
17038+ /* Everything look ok, set the mmap in the decoder */
17039+ res = ctx->iface->set_mmap(ctx, mmap);
17040+
17041+ if (res)
17042+ break;
17043+ }
17044+ }
17045+
17046+ return SAVE_STATUS(ctx, res);
17047+}
17048diff --git a/vpx/src/vpx_decoder_compat.c b/vpx/src/vpx_decoder_compat.c
17049new file mode 100644
17050index 0000000..d5cc16e
17051--- /dev/null
17052+++ b/vpx/src/vpx_decoder_compat.c
17053@@ -0,0 +1,201 @@
17054+/*
17055+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
17056+ *
17057+ * Use of this source code is governed by a BSD-style license
17058+ * that can be found in the LICENSE file in the root of the source
17059+ * tree. An additional intellectual property rights grant can be found
17060+ * in the file PATENTS. All contributing project authors may
17061+ * be found in the AUTHORS file in the root of the source tree.
17062+ */
17063+
17064+
17065+/*!\file vpx_decoder.c
17066+ * \brief Provides the high level interface to wrap decoder algorithms.
17067+ *
17068+ */
17069+#include <stdlib.h>
17070+#include <string.h>
17071+#include "vpx/vpx_decoder.h"
17072+#include "vpx/internal/vpx_codec_internal.h"
17073+
17074+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
17075+
17076+const char *vpx_dec_iface_name(vpx_dec_iface_t *iface)
17077+{
17078+ return vpx_codec_iface_name((vpx_codec_iface_t *)iface);
17079+}
17080+
17081+const char *vpx_dec_err_to_string(vpx_dec_err_t err)
17082+{
17083+ return vpx_codec_err_to_string(err);
17084+}
17085+
17086+const char *vpx_dec_error(vpx_dec_ctx_t *ctx)
17087+{
17088+ return vpx_codec_error((vpx_codec_ctx_t *)ctx);
17089+}
17090+
17091+const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx)
17092+{
17093+ return vpx_codec_error_detail((vpx_codec_ctx_t *)ctx);
17094+}
17095+
17096+
17097+vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
17098+ vpx_dec_iface_t *iface,
17099+ int ver)
17100+{
17101+ return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
17102+ (vpx_codec_iface_t *)iface,
17103+ NULL,
17104+ 0,
17105+ ver);
17106+}
17107+
17108+
17109+vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx)
17110+{
17111+ return vpx_codec_destroy((vpx_codec_ctx_t *)ctx);
17112+}
17113+
17114+
17115+vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface)
17116+{
17117+ return vpx_codec_get_caps((vpx_codec_iface_t *)iface);
17118+}
17119+
17120+
17121+vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
17122+ const uint8_t *data,
17123+ unsigned int data_sz,
17124+ vpx_dec_stream_info_t *si)
17125+{
17126+ return vpx_codec_peek_stream_info((vpx_codec_iface_t *)iface, data, data_sz,
17127+ (vpx_codec_stream_info_t *)si);
17128+}
17129+
17130+
17131+vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
17132+ vpx_dec_stream_info_t *si)
17133+{
17134+ return vpx_codec_get_stream_info((vpx_codec_ctx_t *)ctx,
17135+ (vpx_codec_stream_info_t *)si);
17136+}
17137+
17138+
17139+vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
17140+ int ctrl_id,
17141+ void *data)
17142+{
17143+ return vpx_codec_control_((vpx_codec_ctx_t *)ctx, ctrl_id, data);
17144+}
17145+
17146+
17147+vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
17148+ uint8_t *data,
17149+ unsigned int data_sz,
17150+ void *user_priv,
17151+ int rel_pts)
17152+{
17153+ (void)rel_pts;
17154+ return vpx_codec_decode((vpx_codec_ctx_t *)ctx, data, data_sz, user_priv,
17155+ 0);
17156+}
17157+
17158+vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
17159+ vpx_dec_iter_t *iter)
17160+{
17161+ return vpx_codec_get_frame((vpx_codec_ctx_t *)ctx, iter);
17162+}
17163+
17164+
17165+vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
17166+ vpx_dec_put_frame_cb_fn_t cb,
17167+ void *user_priv)
17168+{
17169+ return vpx_codec_register_put_frame_cb((vpx_codec_ctx_t *)ctx, cb,
17170+ user_priv);
17171+}
17172+
17173+
17174+vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
17175+ vpx_dec_put_slice_cb_fn_t cb,
17176+ void *user_priv)
17177+{
17178+ return vpx_codec_register_put_slice_cb((vpx_codec_ctx_t *)ctx, cb,
17179+ user_priv);
17180+}
17181+
17182+
17183+vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
17184+ vpx_dec_iface_t *iface,
17185+ int ver)
17186+{
17187+ return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
17188+ (vpx_codec_iface_t *)iface,
17189+ NULL,
17190+ VPX_CODEC_USE_XMA,
17191+ ver);
17192+}
17193+
17194+vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx_,
17195+ vpx_dec_mmap_t *mmap,
17196+ const vpx_dec_stream_info_t *si,
17197+ vpx_dec_iter_t *iter)
17198+{
17199+ vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
17200+ vpx_dec_err_t res = VPX_DEC_OK;
17201+
17202+ if (!ctx || !mmap || !si || !iter || !ctx->iface)
17203+ res = VPX_DEC_INVALID_PARAM;
17204+ else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
17205+ res = VPX_DEC_ERROR;
17206+ else
17207+ {
17208+ if (!ctx->config.dec)
17209+ {
17210+ ctx->config.dec = malloc(sizeof(vpx_codec_dec_cfg_t));
17211+ ctx->config.dec->w = si->w;
17212+ ctx->config.dec->h = si->h;
17213+ }
17214+
17215+ res = ctx->iface->get_mmap(ctx, mmap, iter);
17216+ }
17217+
17218+ return SAVE_STATUS(ctx, res);
17219+}
17220+
17221+
17222+vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx_,
17223+ vpx_dec_mmap_t *mmap,
17224+ unsigned int num_maps)
17225+{
17226+ vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
17227+ vpx_dec_err_t res = VPX_DEC_MEM_ERROR;
17228+
17229+ if (!ctx || !mmap || !ctx->iface)
17230+ res = VPX_DEC_INVALID_PARAM;
17231+ else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
17232+ res = VPX_DEC_ERROR;
17233+ else
17234+ {
17235+ void *save = (ctx->priv) ? NULL : ctx->config.dec;
17236+ unsigned int i;
17237+
17238+ for (i = 0; i < num_maps; i++, mmap++)
17239+ {
17240+ if (!mmap->base)
17241+ break;
17242+
17243+ /* Everything look ok, set the mmap in the decoder */
17244+ res = ctx->iface->set_mmap(ctx, mmap);
17245+
17246+ if (res)
17247+ break;
17248+ }
17249+
17250+ if (save) free(save);
17251+ }
17252+
17253+ return SAVE_STATUS(ctx, res);
17254+}
17255diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
17256new file mode 100644
17257index 0000000..f43328f
17258--- /dev/null
17259+++ b/vpx/src/vpx_encoder.c
17260@@ -0,0 +1,312 @@
17261+/*
17262+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
17263+ *
17264+ * Use of this source code is governed by a BSD-style license
17265+ * that can be found in the LICENSE file in the root of the source
17266+ * tree. An additional intellectual property rights grant can be found
17267+ * in the file PATENTS. All contributing project authors may
17268+ * be found in the AUTHORS file in the root of the source tree.
17269+ */
17270+
17271+
17272+/*!\file vpx_encoder.c
17273+ * \brief Provides the high level interface to wrap encoder algorithms.
17274+ *
17275+ */
17276+#include <limits.h>
17277+#include <string.h>
17278+#include "vpx/internal/vpx_codec_internal.h"
17279+
17280+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
17281+
17282+vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
17283+ vpx_codec_iface_t *iface,
17284+ vpx_codec_enc_cfg_t *cfg,
17285+ vpx_codec_flags_t flags,
17286+ int ver)
17287+{
17288+ vpx_codec_err_t res;
17289+
17290+ if (ver != VPX_ENCODER_ABI_VERSION)
17291+ res = VPX_CODEC_ABI_MISMATCH;
17292+ else if (!ctx || !iface || !cfg)
17293+ res = VPX_CODEC_INVALID_PARAM;
17294+ else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
17295+ res = VPX_CODEC_ABI_MISMATCH;
17296+ else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
17297+ res = VPX_CODEC_INCAPABLE;
17298+ else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
17299+ res = VPX_CODEC_INCAPABLE;
17300+ else if ((flags & VPX_CODEC_USE_PSNR)
17301+ && !(iface->caps & VPX_CODEC_CAP_PSNR))
17302+ res = VPX_CODEC_INCAPABLE;
17303+ else
17304+ {
17305+ ctx->iface = iface;
17306+ ctx->name = iface->name;
17307+ ctx->priv = NULL;
17308+ ctx->init_flags = flags;
17309+ ctx->config.enc = cfg;
17310+ res = ctx->iface->init(ctx);
17311+
17312+ if (res)
17313+ {
17314+ ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
17315+ vpx_codec_destroy(ctx);
17316+ }
17317+
17318+ if (ctx->priv)
17319+ ctx->priv->iface = ctx->iface;
17320+ }
17321+
17322+ return SAVE_STATUS(ctx, res);
17323+}
17324+
17325+
17326+
17327+vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
17328+ vpx_codec_enc_cfg_t *cfg,
17329+ unsigned int usage)
17330+{
17331+ vpx_codec_err_t res;
17332+ vpx_codec_enc_cfg_map_t *map;
17333+
17334+ if (!iface || !cfg || usage > INT_MAX)
17335+ res = VPX_CODEC_INVALID_PARAM;
17336+ else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
17337+ res = VPX_CODEC_INCAPABLE;
17338+ else
17339+ {
17340+ res = VPX_CODEC_INVALID_PARAM;
17341+
17342+ for (map = iface->enc.cfg_maps; map->usage >= 0; map++)
17343+ {
17344+ if (map->usage == (int)usage)
17345+ {
17346+ *cfg = map->cfg;
17347+ cfg->g_usage = usage;
17348+ res = VPX_CODEC_OK;
17349+ break;
17350+ }
17351+ }
17352+ }
17353+
17354+ return res;
17355+}
17356+
17357+
17358+#if ARCH_X86 || ARCH_X86_64
17359+/* On X86, disable the x87 unit's internal 80 bit precision for better
17360+ * consistency with the SSE unit's 64 bit precision.
17361+ */
17362+#include "vpx_ports/x86.h"
17363+#define FLOATING_POINT_INIT() do {\
17364+ unsigned short x87_orig_mode = x87_set_double_precision();
17365+#define FLOATING_POINT_RESTORE() \
17366+ x87_set_control_word(x87_orig_mode); }while(0)
17367+
17368+
17369+#else
17370+static void FLOATING_POINT_INIT() {}
17371+static void FLOATING_POINT_RESTORE() {}
17372+#endif
17373+
17374+
17375+vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
17376+ const vpx_image_t *img,
17377+ vpx_codec_pts_t pts,
17378+ unsigned long duration,
17379+ vpx_enc_frame_flags_t flags,
17380+ unsigned long deadline)
17381+{
17382+ vpx_codec_err_t res;
17383+
17384+ if (!ctx || (img && !duration))
17385+ res = VPX_CODEC_INVALID_PARAM;
17386+ else if (!ctx->iface || !ctx->priv)
17387+ res = VPX_CODEC_ERROR;
17388+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
17389+ res = VPX_CODEC_INCAPABLE;
17390+ else
17391+ {
17392+ /* Execute in a normalized floating point environment, if the platform
17393+ * requires it.
17394+ */
17395+ FLOATING_POINT_INIT();
17396+ res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
17397+ duration, flags, deadline);
17398+ FLOATING_POINT_RESTORE();
17399+ }
17400+
17401+ return SAVE_STATUS(ctx, res);
17402+}
17403+
17404+
17405+const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
17406+ vpx_codec_iter_t *iter)
17407+{
17408+ const vpx_codec_cx_pkt_t *pkt = NULL;
17409+
17410+ if (ctx)
17411+ {
17412+ if (!iter)
17413+ ctx->err = VPX_CODEC_INVALID_PARAM;
17414+ else if (!ctx->iface || !ctx->priv)
17415+ ctx->err = VPX_CODEC_ERROR;
17416+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
17417+ ctx->err = VPX_CODEC_INCAPABLE;
17418+ else
17419+ pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
17420+ }
17421+
17422+ if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT)
17423+ {
17424+ /* If the application has specified a destination area for the
17425+ * compressed data, and the codec has not placed the data there,
17426+ * and it fits, copy it.
17427+ */
17428+ char *dst_buf = ctx->priv->enc.cx_data_dst_buf.buf;
17429+
17430+ if (dst_buf
17431+ && pkt->data.raw.buf != dst_buf
17432+ && pkt->data.raw.sz
17433+ + ctx->priv->enc.cx_data_pad_before
17434+ + ctx->priv->enc.cx_data_pad_after
17435+ <= ctx->priv->enc.cx_data_dst_buf.sz)
17436+ {
17437+ vpx_codec_cx_pkt_t *modified_pkt = &ctx->priv->enc.cx_data_pkt;
17438+
17439+ memcpy(dst_buf + ctx->priv->enc.cx_data_pad_before,
17440+ pkt->data.raw.buf, pkt->data.raw.sz);
17441+ *modified_pkt = *pkt;
17442+ modified_pkt->data.raw.buf = dst_buf;
17443+ modified_pkt->data.raw.sz += ctx->priv->enc.cx_data_pad_before
17444+ + ctx->priv->enc.cx_data_pad_after;
17445+ pkt = modified_pkt;
17446+ }
17447+
17448+ if (dst_buf == pkt->data.raw.buf)
17449+ {
17450+ ctx->priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz;
17451+ ctx->priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz;
17452+ }
17453+ }
17454+
17455+ return pkt;
17456+}
17457+
17458+
17459+vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
17460+ const vpx_fixed_buf_t *buf,
17461+ unsigned int pad_before,
17462+ unsigned int pad_after)
17463+{
17464+ if (!ctx || !ctx->priv)
17465+ return VPX_CODEC_INVALID_PARAM;
17466+
17467+ if (buf)
17468+ {
17469+ ctx->priv->enc.cx_data_dst_buf = *buf;
17470+ ctx->priv->enc.cx_data_pad_before = pad_before;
17471+ ctx->priv->enc.cx_data_pad_after = pad_after;
17472+ }
17473+ else
17474+ {
17475+ ctx->priv->enc.cx_data_dst_buf.buf = NULL;
17476+ ctx->priv->enc.cx_data_dst_buf.sz = 0;
17477+ ctx->priv->enc.cx_data_pad_before = 0;
17478+ ctx->priv->enc.cx_data_pad_after = 0;
17479+ }
17480+
17481+ return VPX_CODEC_OK;
17482+}
17483+
17484+
17485+const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx)
17486+{
17487+ vpx_image_t *img = NULL;
17488+
17489+ if (ctx)
17490+ {
17491+ if (!ctx->iface || !ctx->priv)
17492+ ctx->err = VPX_CODEC_ERROR;
17493+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
17494+ ctx->err = VPX_CODEC_INCAPABLE;
17495+ else if (!ctx->iface->enc.get_preview)
17496+ ctx->err = VPX_CODEC_INCAPABLE;
17497+ else
17498+ img = ctx->iface->enc.get_preview(ctx->priv->alg_priv);
17499+ }
17500+
17501+ return img;
17502+}
17503+
17504+
17505+vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx)
17506+{
17507+ vpx_fixed_buf_t *buf = NULL;
17508+
17509+ if (ctx)
17510+ {
17511+ if (!ctx->iface || !ctx->priv)
17512+ ctx->err = VPX_CODEC_ERROR;
17513+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
17514+ ctx->err = VPX_CODEC_INCAPABLE;
17515+ else if (!ctx->iface->enc.get_glob_hdrs)
17516+ ctx->err = VPX_CODEC_INCAPABLE;
17517+ else
17518+ buf = ctx->iface->enc.get_glob_hdrs(ctx->priv->alg_priv);
17519+ }
17520+
17521+ return buf;
17522+}
17523+
17524+
17525+vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
17526+ const vpx_codec_enc_cfg_t *cfg)
17527+{
17528+ vpx_codec_err_t res;
17529+
17530+ if (!ctx || !ctx->iface || !ctx->priv || !cfg)
17531+ res = VPX_CODEC_INVALID_PARAM;
17532+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
17533+ res = VPX_CODEC_INCAPABLE;
17534+ else
17535+ res = ctx->iface->enc.cfg_set(ctx->priv->alg_priv, cfg);
17536+
17537+ return SAVE_STATUS(ctx, res);
17538+}
17539+
17540+
17541+int vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *list,
17542+ const struct vpx_codec_cx_pkt *pkt)
17543+{
17544+ if (list->cnt < list->max)
17545+ {
17546+ list->pkts[list->cnt++] = *pkt;
17547+ return 0;
17548+ }
17549+
17550+ return 1;
17551+}
17552+
17553+
17554+const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
17555+ vpx_codec_iter_t *iter)
17556+{
17557+ const vpx_codec_cx_pkt_t *pkt;
17558+
17559+ if (!(*iter))
17560+ {
17561+ *iter = list->pkts;
17562+ }
17563+
17564+ pkt = (const void *) * iter;
17565+
17566+ if (pkt - list->pkts < list->cnt)
17567+ *iter = pkt + 1;
17568+ else
17569+ pkt = NULL;
17570+
17571+ return pkt;
17572+}
17573diff --git a/vpx/src/vpx_image.c b/vpx/src/vpx_image.c
17574new file mode 100644
17575index 0000000..e8a2959
17576--- /dev/null
17577+++ b/vpx/src/vpx_image.c
17578@@ -0,0 +1,262 @@
17579+/*
17580+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
17581+ *
17582+ * Use of this source code is governed by a BSD-style license
17583+ * that can be found in the LICENSE file in the root of the source
17584+ * tree. An additional intellectual property rights grant can be found
17585+ * in the file PATENTS. All contributing project authors may
17586+ * be found in the AUTHORS file in the root of the source tree.
17587+ */
17588+
17589+
17590+#include <stdlib.h>
17591+#include <string.h>
17592+#include "vpx/vpx_image.h"
17593+
17594+static vpx_image_t *img_alloc_helper(vpx_image_t *img,
17595+ vpx_img_fmt_t fmt,
17596+ unsigned int d_w,
17597+ unsigned int d_h,
17598+ unsigned int stride_align,
17599+ unsigned char *img_data)
17600+{
17601+
17602+ unsigned int h, w, s, xcs, ycs, bps;
17603+ int align;
17604+
17605+ /* Treat align==0 like align==1 */
17606+ if (!stride_align)
17607+ stride_align = 1;
17608+
17609+ /* Validate alignment (must be power of 2) */
17610+ if (stride_align & (stride_align - 1))
17611+ goto fail;
17612+
17613+ /* Get sample size for this format */
17614+ switch (fmt)
17615+ {
17616+ case VPX_IMG_FMT_RGB32:
17617+ case VPX_IMG_FMT_RGB32_LE:
17618+ case VPX_IMG_FMT_ARGB:
17619+ case VPX_IMG_FMT_ARGB_LE:
17620+ bps = 32;
17621+ break;
17622+ case VPX_IMG_FMT_RGB24:
17623+ case VPX_IMG_FMT_BGR24:
17624+ bps = 24;
17625+ break;
17626+ case VPX_IMG_FMT_RGB565:
17627+ case VPX_IMG_FMT_RGB565_LE:
17628+ case VPX_IMG_FMT_RGB555:
17629+ case VPX_IMG_FMT_RGB555_LE:
17630+ case VPX_IMG_FMT_UYVY:
17631+ case VPX_IMG_FMT_YUY2:
17632+ case VPX_IMG_FMT_YVYU:
17633+ bps = 16;
17634+ break;
17635+ case VPX_IMG_FMT_I420:
17636+ case VPX_IMG_FMT_YV12:
17637+ case VPX_IMG_FMT_VPXI420:
17638+ case VPX_IMG_FMT_VPXYV12:
17639+ bps = 12;
17640+ break;
17641+ default:
17642+ bps = 16;
17643+ break;
17644+ }
17645+
17646+ /* Get chroma shift values for this format */
17647+ switch (fmt)
17648+ {
17649+ case VPX_IMG_FMT_I420:
17650+ case VPX_IMG_FMT_YV12:
17651+ case VPX_IMG_FMT_VPXI420:
17652+ case VPX_IMG_FMT_VPXYV12:
17653+ xcs = 1;
17654+ break;
17655+ default:
17656+ xcs = 0;
17657+ break;
17658+ }
17659+
17660+ switch (fmt)
17661+ {
17662+ case VPX_IMG_FMT_I420:
17663+ case VPX_IMG_FMT_YV12:
17664+ case VPX_IMG_FMT_VPXI420:
17665+ case VPX_IMG_FMT_VPXYV12:
17666+ ycs = 1;
17667+ break;
17668+ default:
17669+ ycs = 0;
17670+ break;
17671+ }
17672+
17673+ /* Calculate storage sizes given the chroma subsampling */
17674+ align = (1 << xcs) - 1;
17675+ w = (d_w + align) & ~align;
17676+ align = (1 << ycs) - 1;
17677+ h = (d_h + align) & ~align;
17678+ s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
17679+ s = (s + stride_align - 1) & ~(stride_align - 1);
17680+
17681+ /* Allocate the new image */
17682+ if (!img)
17683+ {
17684+ img = (vpx_image_t *)calloc(1, sizeof(vpx_image_t));
17685+
17686+ if (!img)
17687+ goto fail;
17688+
17689+ img->self_allocd = 1;
17690+ }
17691+ else
17692+ {
17693+ memset(img, 0, sizeof(vpx_image_t));
17694+ }
17695+
17696+ img->img_data = img_data;
17697+
17698+ if (!img_data)
17699+ {
17700+ img->img_data = malloc((fmt & VPX_IMG_FMT_PLANAR) ? h * w * bps / 8 : h * s);
17701+ img->img_data_owner = 1;
17702+ }
17703+
17704+ if (!img->img_data)
17705+ goto fail;
17706+
17707+ img->fmt = fmt;
17708+ img->w = w;
17709+ img->h = h;
17710+ img->x_chroma_shift = xcs;
17711+ img->y_chroma_shift = ycs;
17712+ img->bps = bps;
17713+
17714+ /* Calculate strides */
17715+ img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s;
17716+ img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs;
17717+
17718+ /* Default viewport to entire image */
17719+ if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
17720+ return img;
17721+
17722+fail:
17723+ vpx_img_free(img);
17724+ return NULL;
17725+}
17726+
17727+vpx_image_t *vpx_img_alloc(vpx_image_t *img,
17728+ vpx_img_fmt_t fmt,
17729+ unsigned int d_w,
17730+ unsigned int d_h,
17731+ unsigned int stride_align)
17732+{
17733+ return img_alloc_helper(img, fmt, d_w, d_h, stride_align, NULL);
17734+}
17735+
17736+vpx_image_t *vpx_img_wrap(vpx_image_t *img,
17737+ vpx_img_fmt_t fmt,
17738+ unsigned int d_w,
17739+ unsigned int d_h,
17740+ unsigned int stride_align,
17741+ unsigned char *img_data)
17742+{
17743+ return img_alloc_helper(img, fmt, d_w, d_h, stride_align, img_data);
17744+}
17745+
17746+int vpx_img_set_rect(vpx_image_t *img,
17747+ unsigned int x,
17748+ unsigned int y,
17749+ unsigned int w,
17750+ unsigned int h)
17751+{
17752+ unsigned char *data;
17753+
17754+ if (x + w <= img->w && y + h <= img->h)
17755+ {
17756+ img->d_w = w;
17757+ img->d_h = h;
17758+
17759+ /* Calculate plane pointers */
17760+ if (!(img->fmt & VPX_IMG_FMT_PLANAR))
17761+ {
17762+ img->planes[VPX_PLANE_PACKED] =
17763+ img->img_data + x * img->bps / 8 + y * img->stride[VPX_PLANE_PACKED];
17764+ }
17765+ else
17766+ {
17767+ data = img->img_data;
17768+
17769+ if (img->fmt & VPX_IMG_FMT_HAS_ALPHA)
17770+ {
17771+ img->planes[VPX_PLANE_ALPHA] =
17772+ data + x + y * img->stride[VPX_PLANE_ALPHA];
17773+ data += img->h * img->stride[VPX_PLANE_ALPHA];
17774+ }
17775+
17776+ img->planes[VPX_PLANE_Y] = data + x + y * img->stride[VPX_PLANE_Y];
17777+ data += img->h * img->stride[VPX_PLANE_Y];
17778+
17779+ if (!(img->fmt & VPX_IMG_FMT_UV_FLIP))
17780+ {
17781+ img->planes[VPX_PLANE_U] = data
17782+ + (x >> img->x_chroma_shift)
17783+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
17784+ data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
17785+ img->planes[VPX_PLANE_V] = data
17786+ + (x >> img->x_chroma_shift)
17787+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
17788+ }
17789+ else
17790+ {
17791+ img->planes[VPX_PLANE_V] = data
17792+ + (x >> img->x_chroma_shift)
17793+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
17794+ data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
17795+ img->planes[VPX_PLANE_U] = data
17796+ + (x >> img->x_chroma_shift)
17797+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
17798+ }
17799+ }
17800+
17801+ return 0;
17802+ }
17803+
17804+ return -1;
17805+}
17806+
17807+void vpx_img_flip(vpx_image_t *img)
17808+{
17809+ /* Note: In the calculation pointer adjustment calculation, we want the
17810+ * rhs to be promoted to a signed type. Section 6.3.1.8 of the ISO C99
17811+ * standard indicates that if the adjustment parameter is unsigned, the
17812+ * stride parameter will be promoted to unsigned, causing errors when
17813+ * the lhs is a larger type than the rhs.
17814+ */
17815+ img->planes[VPX_PLANE_Y] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_Y];
17816+ img->stride[VPX_PLANE_Y] = -img->stride[VPX_PLANE_Y];
17817+
17818+ img->planes[VPX_PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
17819+ * img->stride[VPX_PLANE_U];
17820+ img->stride[VPX_PLANE_U] = -img->stride[VPX_PLANE_U];
17821+
17822+ img->planes[VPX_PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
17823+ * img->stride[VPX_PLANE_V];
17824+ img->stride[VPX_PLANE_V] = -img->stride[VPX_PLANE_V];
17825+
17826+ img->planes[VPX_PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_ALPHA];
17827+ img->stride[VPX_PLANE_ALPHA] = -img->stride[VPX_PLANE_ALPHA];
17828+}
17829+
17830+void vpx_img_free(vpx_image_t *img)
17831+{
17832+ if (img)
17833+ {
17834+ if (img->img_data && img->img_data_owner)
17835+ free(img->img_data);
17836+
17837+ if (img->self_allocd)
17838+ free(img);
17839+ }
17840+}
17841diff --git a/vpx/vp8.h b/vpx/vp8.h
17842new file mode 100644
17843index 0000000..a493ef6
17844--- /dev/null
17845+++ b/vpx/vp8.h
17846@@ -0,0 +1,117 @@
17847+/*
17848+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
17849+ *
17850+ * Use of this source code is governed by a BSD-style license
17851+ * that can be found in the LICENSE file in the root of the source
17852+ * tree. An additional intellectual property rights grant can be found
17853+ * in the file PATENTS. All contributing project authors may
17854+ * be found in the AUTHORS file in the root of the source tree.
17855+ */
17856+
17857+
17858+/*!\defgroup vp8 VP8
17859+ * \ingroup codecs
17860+ * VP8 is vpx's newest video compression algorithm that uses motion
17861+ * compensated prediction, Discrete Cosine Transform (DCT) coding of the
17862+ * prediction error signal and context dependent entropy coding techniques
17863+ * based on arithmatic principles. It features:
17864+ * - YUV 4:2:0 image format
17865+ * - Macro-block based coding (16x16 luma plus two 8x8 chroma)
17866+ * - 1/4 (1/8) pixel accuracy motion compensated prediction
17867+ * - 4x4 DCT transform
17868+ * - 128 level linear quantizer
17869+ * - In loop deblocking filter
17870+ * - Context-based entropy coding
17871+ *
17872+ * @{
17873+ */
17874+/*!\file vp8.h
17875+ * \brief Provides controls common to both the VP8 encoder and decoder.
17876+ */
17877+#ifndef VP8_H
17878+#define VP8_H
17879+#include "vpx/vpx_codec_impl_top.h"
17880+
17881+/*!\brief Control functions
17882+ *
17883+ * The set of macros define the control functions of VP8 interface
17884+ */
17885+enum vp8_dec_control_id
17886+{
17887+ VP8_SET_REFERENCE = 1, /**< pass in an external frame into decoder to be used as reference frame */
17888+ VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
17889+ VP8_SET_POSTPROC = 3, /**< set decoder's the post processing settings */
17890+ VP8_COMMON_CTRL_ID_MAX
17891+};
17892+
17893+/*!\brief post process flags
17894+ *
17895+ * The set of macros define VP8 decoder post processing flags
17896+ */
17897+enum vp8_postproc_level
17898+{
17899+ VP8_NOFILTERING = 0,
17900+ VP8_DEBLOCK = 1,
17901+ VP8_DEMACROBLOCK = 2,
17902+ VP8_ADDNOISE = 4,
17903+};
17904+
17905+/*!\brief post process flags
17906+ *
17907+ * This define a structure that describe the post processing settings. For
17908+ * the best objective measure (using thet PSNR metric) set post_proc_flag
17909+ * to VP8_DEBLOCK and deblocking_level to 1.
17910+ */
17911+
17912+typedef struct vp8_postproc_cfg
17913+{
17914+ int post_proc_flag; /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
17915+ int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
17916+ int noise_level; /**< the strength of additive noise, valid range [0, 16] */
17917+} vp8_postproc_cfg_t;
17918+
17919+/*!\brief reference frame type
17920+ *
17921+ * The set of macros define the type of VP8 reference frames
17922+ */
17923+typedef enum vpx_ref_frame_type
17924+{
17925+ VP8_LAST_FRAME = 1,
17926+ VP8_GOLD_FRAME = 2,
17927+ VP8_ALTR_FRAME = 4
17928+} vpx_ref_frame_type_t;
17929+
17930+/*!\brief reference frame data struct
17931+ *
17932+ * define the data struct to access vp8 reference frames
17933+ */
17934+
17935+typedef struct vpx_ref_frame
17936+{
17937+ vpx_ref_frame_type_t frame_type; /**< which reference frame */
17938+ vpx_image_t img; /**< reference frame data in image format */
17939+} vpx_ref_frame_t;
17940+
17941+
17942+/*!\brief vp8 decoder control funciton parameter type
17943+ *
17944+ * defines the data type for each of VP8 decoder control funciton requires
17945+ */
17946+
17947+VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *)
17948+VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
17949+VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
17950+
17951+
17952+/*! @} - end defgroup vp8 */
17953+
17954+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
17955+/* The following definitions are provided for backward compatibility with
17956+ * the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
17957+ */
17958+
17959+DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
17960+#endif
17961+
17962+#include "vpx/vpx_codec_impl_bottom.h"
17963+#endif
17964diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
17965new file mode 100644
17966index 0000000..1104064
17967--- /dev/null
17968+++ b/vpx/vp8cx.h
17969@@ -0,0 +1,262 @@
17970+/*
17971+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
17972+ *
17973+ * Use of this source code is governed by a BSD-style license
17974+ * that can be found in the LICENSE file in the root of the source
17975+ * tree. An additional intellectual property rights grant can be found
17976+ * in the file PATENTS. All contributing project authors may
17977+ * be found in the AUTHORS file in the root of the source tree.
17978+ */
17979+
17980+
17981+/*!\defgroup vp8_encoder WebM VP8 Encoder
17982+ * \ingroup vp8
17983+ *
17984+ * @{
17985+ */
17986+#include "vp8.h"
17987+
17988+/*!\file vp8cx.h
17989+ * \brief Provides definitions for using the VP8 encoder algorithm within the
17990+ * vpx Codec Interface.
17991+ */
17992+#ifndef VP8CX_H
17993+#define VP8CX_H
17994+#include "vpx/vpx_codec_impl_top.h"
17995+
17996+/*!\brief Algorithm interface for VP8
17997+ *
17998+ * This interface provides the capability to encode raw VP8 streams, as would
17999+ * be found in AVI files.
18000+ */
18001+extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
18002+
18003+
18004+/*
18005+ * Algorithm Flags
18006+ */
18007+
18008+/*!\brief Don't reference the last frame
18009+ *
18010+ * When this flag is set, the encoder will not use the last frame as a
18011+ * predictor. When not set, the encoder will choose whether to use the
18012+ * last frame or not automatically.
18013+ */
18014+#define VP8_EFLAG_NO_REF_LAST (1<<16)
18015+
18016+
18017+/*!\brief Don't reference the golden frame
18018+ *
18019+ * When this flag is set, the encoder will not use the golden frame as a
18020+ * predictor. When not set, the encoder will choose whether to use the
18021+ * golden frame or not automatically.
18022+ */
18023+#define VP8_EFLAG_NO_REF_GF (1<<17)
18024+
18025+
18026+/*!\brief Don't reference the alternate reference frame
18027+ *
18028+ * When this flag is set, the encoder will not use the alt ref frame as a
18029+ * predictor. When not set, the encoder will choose whether to use the
18030+ * alt ref frame or not automatically.
18031+ */
18032+#define VP8_EFLAG_NO_REF_ARF (1<<21)
18033+
18034+
18035+/*!\brief Don't update the last frame
18036+ *
18037+ * When this flag is set, the encoder will not update the last frame with
18038+ * the contents of the current frame.
18039+ */
18040+#define VP8_EFLAG_NO_UPD_LAST (1<<18)
18041+
18042+
18043+/*!\brief Don't update the golden frame
18044+ *
18045+ * When this flag is set, the encoder will not update the golden frame with
18046+ * the contents of the current frame.
18047+ */
18048+#define VP8_EFLAG_NO_UPD_GF (1<<22)
18049+
18050+
18051+/*!\brief Don't update the alternate reference frame
18052+ *
18053+ * When this flag is set, the encoder will not update the alt ref frame with
18054+ * the contents of the current frame.
18055+ */
18056+#define VP8_EFLAG_NO_UPD_ARF (1<<23)
18057+
18058+
18059+/*!\brief Force golden frame update
18060+ *
18061+ * When this flag is set, the encoder copy the contents of the current frame
18062+ * to the golden frame buffer.
18063+ */
18064+#define VP8_EFLAG_FORCE_GF (1<<19)
18065+
18066+
18067+/*!\brief Force alternate reference frame update
18068+ *
18069+ * When this flag is set, the encoder copy the contents of the current frame
18070+ * to the alternate reference frame buffer.
18071+ */
18072+#define VP8_EFLAG_FORCE_ARF (1<<24)
18073+
18074+
18075+/*!\brief Disable entropy update
18076+ *
18077+ * When this flag is set, the encoder will not update its internal entropy
18078+ * model based on the entropy of this frame.
18079+ */
18080+#define VP8_EFLAG_NO_UPD_ENTROPY (1<<20)
18081+
18082+
18083+/*!\brief VP8 encoder control functions
18084+ *
18085+ * The set of macros define the control functions of VP8 encoder interface
18086+ */
18087+enum vp8e_enc_control_id
18088+{
18089+ VP8E_UPD_ENTROPY = 5, /**< control function to set mode of entropy update in encoder */
18090+ VP8E_UPD_REFERENCE, /**< control function to set reference update mode in encoder */
18091+ VP8E_USE_REFERENCE, /**< control function to set which reference frame encoder can use */
18092+ VP8E_SET_ROI_MAP, /**< control function to pass an ROI map to encoder */
18093+ VP8E_SET_ACTIVEMAP, /**< control function to pass an Active map to encoder */
18094+ VP8E_SET_SCALEMODE = 11, /**< control function to set encoder scaling mode */
18095+ VP8E_SET_CPUUSED = 13, /**< control function to set vp8 encoder cpuused */
18096+ VP8E_SET_ENABLEAUTOALTREF, /**< control function to enable vp8 to automatic set and use altref frame */
18097+ VP8E_SET_NOISE_SENSITIVITY, /**< control function to set noise sensitivity */
18098+ VP8E_SET_SHARPNESS, /**< control function to set sharpness */
18099+ VP8E_SET_STATIC_THRESHOLD, /**< control function to set the threshold for macroblocks treated static */
18100+ VP8E_SET_TOKEN_PARTITIONS, /**< control function to set the number of token partitions */
18101+ VP8E_GET_LAST_QUANTIZER, /**< return the quantizer chosen by the
18102+ encoder for the last frame using the internal
18103+ scale */
18104+ VP8E_GET_LAST_QUANTIZER_64, /**< return the quantizer chosen by the
18105+ encoder for the last frame, using the 0..63
18106+ scale as used by the rc_*_quantizer config
18107+ parameters */
18108+ VP8E_SET_ARNR_MAXFRAMES, /**< control function to set the max number of frames blurred creating arf*/
18109+ VP8E_SET_ARNR_STRENGTH , /**< control function to set the filter strength for the arf */
18110+ VP8E_SET_ARNR_TYPE , /**< control function to set the type of filter to use for the arf*/
18111+} ;
18112+
18113+/*!\brief vpx 1-D scaling mode
18114+ *
18115+ * This set of constants define 1-D vpx scaling modes
18116+ */
18117+typedef enum vpx_scaling_mode_1d
18118+{
18119+ VP8E_NORMAL = 0,
18120+ VP8E_FOURFIVE = 1,
18121+ VP8E_THREEFIVE = 2,
18122+ VP8E_ONETWO = 3
18123+} VPX_SCALING_MODE;
18124+
18125+
18126+/*!\brief vpx region of interest map
18127+ *
18128+ * These defines the data structures for the region of interest map
18129+ *
18130+ */
18131+
18132+typedef struct vpx_roi_map
18133+{
18134+ unsigned char *roi_map; /**< specify an id between 0 and 3 for each 16x16 region within a frame */
18135+ unsigned int rows; /**< number of rows */
18136+ unsigned int cols; /**< number of cols */
18137+ int delta_q[4]; /**< quantizer delta [-64, 64] off baseline for regions with id between 0 and 3*/
18138+ int delta_lf[4]; /**< loop filter strength delta [-32, 32] for regions with id between 0 and 3 */
18139+ unsigned int static_threshold[4];/**< threshold for region to be treated as static */
18140+} vpx_roi_map_t;
18141+
18142+/*!\brief vpx active region map
18143+ *
18144+ * These defines the data structures for active region map
18145+ *
18146+ */
18147+
18148+
18149+typedef struct vpx_active_map
18150+{
18151+ unsigned char *active_map; /**< specify an on (1) or off (0) each 16x16 region within a frame */
18152+ unsigned int rows; /**< number of rows */
18153+ unsigned int cols; /**< number of cols */
18154+} vpx_active_map_t;
18155+
18156+/*!\brief vpx image scaling mode
18157+ *
18158+ * This defines the data structure for image scaling mode
18159+ *
18160+ */
18161+typedef struct vpx_scaling_mode
18162+{
18163+ VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
18164+ VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
18165+} vpx_scaling_mode_t;
18166+
18167+/*!\brief VP8 encoding mode
18168+ *
18169+ * This defines VP8 encoding mode
18170+ *
18171+ */
18172+typedef enum
18173+{
18174+ VP8_BEST_QUALITY_ENCODING,
18175+ VP8_GOOD_QUALITY_ENCODING,
18176+ VP8_REAL_TIME_ENCODING
18177+} vp8e_encoding_mode;
18178+
18179+/*!\brief VP8 token partition mode
18180+ *
18181+ * This defines VP8 partitioning mode for compressed data, i.e., the number of
18182+ * sub-streams in the bitstream. Used for parallelized decoding.
18183+ *
18184+ */
18185+
18186+typedef enum
18187+{
18188+ VP8_ONE_TOKENPARTITION = 0,
18189+ VP8_TWO_TOKENPARTITION = 1,
18190+ VP8_FOUR_TOKENPARTITION = 2,
18191+ VP8_EIGHT_TOKENPARTITION = 3,
18192+} vp8e_token_partitions;
18193+
18194+
18195+/*!\brief VP8 encoder control function parameter type
18196+ *
18197+ * Defines the data types that VP8E control functions take. Note that
18198+ * additional common controls are defined in vp8.h
18199+ *
18200+ */
18201+
18202+
18203+/* These controls have been deprecated in favor of the flags parameter to
18204+ * vpx_codec_encode(). See the definition of VP8_EFLAG_* above.
18205+ */
18206+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
18207+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
18208+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
18209+
18210+VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
18211+VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
18212+VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
18213+
18214+VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
18215+VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
18216+VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
18217+VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
18218+VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
18219+VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, vp8e_token_partitions)
18220+
18221+VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
18222+VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH , unsigned int)
18223+VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_TYPE , unsigned int)
18224+
18225+
18226+VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
18227+VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
18228+
18229+/*! @} - end defgroup vp8_encoder */
18230+#include "vpx/vpx_codec_impl_bottom.h"
18231+#endif
18232diff --git a/vpx/vp8dx.h b/vpx/vp8dx.h
18233new file mode 100644
18234index 0000000..d602e80
18235--- /dev/null
18236+++ b/vpx/vp8dx.h
18237@@ -0,0 +1,42 @@
18238+/*
18239+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
18240+ *
18241+ * Use of this source code is governed by a BSD-style license
18242+ * that can be found in the LICENSE file in the root of the source
18243+ * tree. An additional intellectual property rights grant can be found
18244+ * in the file PATENTS. All contributing project authors may
18245+ * be found in the AUTHORS file in the root of the source tree.
18246+ */
18247+
18248+
18249+#include "vp8.h"
18250+
18251+/*!\defgroup vp8_decoder WebM VP8 Decoder
18252+ * \ingroup vp8
18253+ *
18254+ * @{
18255+ */
18256+/*!\file vp8dx.h
18257+ * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder
18258+ * interface.
18259+ */
18260+#ifndef VP8DX_H
18261+#define VP8DX_H
18262+#include "vpx/vpx_codec_impl_top.h"
18263+
18264+/*!\brief Algorithm interface for VP8
18265+ *
18266+ * This interface provides the capability to decode raw VP8 streams, as would
18267+ * be found in AVI files and other non-Flash uses.
18268+ */
18269+extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
18270+
18271+/* Include controls common to both the encoder and decoder */
18272+#include "vp8.h"
18273+
18274+
18275+/*! @} - end defgroup vp8_decoder */
18276+
18277+
18278+#include "vpx/vpx_codec_impl_bottom.h"
18279+#endif
18280diff --git a/vpx/vp8e.h b/vpx/vp8e.h
18281new file mode 100644
18282index 0000000..f72fd24
18283--- /dev/null
18284+++ b/vpx/vp8e.h
18285@@ -0,0 +1,63 @@
18286+/*
18287+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
18288+ *
18289+ * Use of this source code is governed by a BSD-style license
18290+ * that can be found in the LICENSE file in the root of the source
18291+ * tree. An additional intellectual property rights grant can be found
18292+ * in the file PATENTS. All contributing project authors may
18293+ * be found in the AUTHORS file in the root of the source tree.
18294+ */
18295+
18296+
18297+/* This file contains backwards compatibility stubs for applications using
18298+ * the VP8 version 1.0 API.
18299+ */
18300+#ifndef VP8E_H
18301+#define VP8E_H
18302+#include "vpx/vpx_codec_impl_top.h"
18303+
18304+#if defined(VPX_CODEC_DISABLE_COMPAT) && VPX_CODEC_DISABLE_COMPAT
18305+#error "Backwards compatibility disabled: don't include vp8e.h"
18306+#endif
18307+
18308+#include "vp8cx.h"
18309+DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_enc_vp8_algo DEPRECATED;
18310+
18311+
18312+enum
18313+{
18314+ VP8E_SET_REFERENCE = VP8_SET_REFERENCE,
18315+ VP8E_COPY_REFERENCE = VP8_COPY_REFERENCE,
18316+ VP8E_SET_PREVIEWPP = VP8_SET_POSTPROC,
18317+ VP8E_SET_FLUSHFLAG = 4,
18318+ VP8E_SET_FRAMETYPE = 10,
18319+ VP8E_SET_ENCODING_MODE = 12
18320+};
18321+
18322+#define NORMAL_FRAME (0)
18323+#define KEY_FRAME (1)
18324+
18325+/* Change VP8E to VP8 to get the undeprecated version of these (defined in
18326+ * vp8.h)
18327+ */
18328+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_REFERENCE, vpx_ref_frame_t *)
18329+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_COPY_REFERENCE, vpx_ref_frame_t *)
18330+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_PREVIEWPP, vp8_postproc_cfg_t *)
18331+
18332+
18333+/* Flush is done by calling vpx_codec_encode with a NULL input image. */
18334+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FLUSHFLAG, int)
18335+
18336+
18337+/* Frame type is set with a flag to vpx_codec_control. See VPX_EFLAG_FORCE_KF
18338+ */
18339+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FRAMETYPE, int)
18340+
18341+
18342+/* This control has been deprecated in favor of the duration parameter to
18343+ * vpx_codec_encode(). Use the #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
18344+ * #VPX_DL_BEST_QUALITY constants to that parameter instead.
18345+ */
18346+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ENCODING_MODE, vp8e_encoding_mode)
18347+#include "vpx/vpx_codec_impl_bottom.h"
18348+#endif
18349diff --git a/vpx/vpx_codec.h b/vpx/vpx_codec.h
18350new file mode 100644
18351index 0000000..f821559
18352--- /dev/null
18353+++ b/vpx/vpx_codec.h
18354@@ -0,0 +1,554 @@
18355+/*
18356+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
18357+ *
18358+ * Use of this source code is governed by a BSD-style license
18359+ * that can be found in the LICENSE file in the root of the source
18360+ * tree. An additional intellectual property rights grant can be found
18361+ * in the file PATENTS. All contributing project authors may
18362+ * be found in the AUTHORS file in the root of the source tree.
18363+ */
18364+
18365+
18366+/*!\defgroup codec Common Algorithm Interface
18367+ * This abstraction allows applications to easily support multiple video
18368+ * formats with minimal code duplication. This section describes the interface
18369+ * common to all codecs (both encoders and decoders).
18370+ * @{
18371+ */
18372+
18373+/*!\file vpx_codec.h
18374+ * \brief Describes the codec algorithm interface to applications.
18375+ *
18376+ * This file describes the interface between an application and a
18377+ * video codec algorithm.
18378+ *
18379+ * An application instantiates a specific codec instance by using
18380+ * vpx_codec_init() and a pointer to the algorithm's interface structure:
18381+ * <pre>
18382+ * my_app.c:
18383+ * extern vpx_codec_iface_t my_codec;
18384+ * {
18385+ * vpx_codec_ctx_t algo;
18386+ * res = vpx_codec_init(&algo, &my_codec);
18387+ * }
18388+ * </pre>
18389+ *
18390+ * Once initialized, the instance is manged using other functions from
18391+ * the vpx_codec_* family.
18392+ */
18393+#ifdef __cplusplus
18394+extern "C" {
18395+#endif
18396+
18397+#ifndef VPX_CODEC_H
18398+#define VPX_CODEC_H
18399+#include "vpx_integer.h"
18400+#include "vpx_image.h"
18401+
18402+ /*!\brief Decorator indicating a function is deprecated */
18403+#ifndef DEPRECATED
18404+#if defined(__GNUC__) && __GNUC__
18405+#define DEPRECATED __attribute__ ((deprecated))
18406+#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
18407+#elif defined(_MSC_VER)
18408+#define DEPRECATED
18409+#define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
18410+#else
18411+#define DEPRECATED
18412+#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
18413+#endif
18414+#endif
18415+
18416+ /*!\brief Decorator indicating a function is potentially unused */
18417+#ifdef UNUSED
18418+#elif __GNUC__
18419+#define UNUSED __attribute__ ((unused));
18420+#else
18421+#define UNUSED
18422+#endif
18423+
18424+ /*!\brief Current ABI version number
18425+ *
18426+ * \internal
18427+ * If this file is altered in any way that changes the ABI, this value
18428+ * must be bumped. Examples include, but are not limited to, changing
18429+ * types, removing or reassigning enums, adding/removing/rearranging
18430+ * fields to structures
18431+ */
18432+#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
18433+
18434+ /*!\brief Algorithm return codes */
18435+ typedef enum {
18436+ /*!\brief Operation completed without error */
18437+ VPX_CODEC_OK,
18438+
18439+ /*!\brief Unspecified error */
18440+ VPX_CODEC_ERROR,
18441+
18442+ /*!\brief Memory operation failed */
18443+ VPX_CODEC_MEM_ERROR,
18444+
18445+ /*!\brief ABI version mismatch */
18446+ VPX_CODEC_ABI_MISMATCH,
18447+
18448+ /*!\brief Algorithm does not have required capability */
18449+ VPX_CODEC_INCAPABLE,
18450+
18451+ /*!\brief The given bitstream is not supported.
18452+ *
18453+ * The bitstream was unable to be parsed at the highest level. The decoder
18454+ * is unable to proceed. This error \ref SHOULD be treated as fatal to the
18455+ * stream. */
18456+ VPX_CODEC_UNSUP_BITSTREAM,
18457+
18458+ /*!\brief Encoded bitstream uses an unsupported feature
18459+ *
18460+ * The decoder does not implement a feature required by the encoder. This
18461+ * return code should only be used for features that prevent future
18462+ * pictures from being properly decoded. This error \ref MAY be treated as
18463+ * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
18464+ */
18465+ VPX_CODEC_UNSUP_FEATURE,
18466+
18467+ /*!\brief The coded data for this stream is corrupt or incomplete
18468+ *
18469+ * There was a problem decoding the current frame. This return code
18470+ * should only be used for failures that prevent future pictures from
18471+ * being properly decoded. This error \ref MAY be treated as fatal to the
18472+ * stream or \ref MAY be treated as fatal to the current GOP. If decoding
18473+ * is continued for the current GOP, artifacts may be present.
18474+ */
18475+ VPX_CODEC_CORRUPT_FRAME,
18476+
18477+ /*!\brief An application-supplied parameter is not valid.
18478+ *
18479+ */
18480+ VPX_CODEC_INVALID_PARAM,
18481+
18482+ /*!\brief An iterator reached the end of list.
18483+ *
18484+ */
18485+ VPX_CODEC_LIST_END,
18486+
18487+ }
18488+ vpx_codec_err_t;
18489+
18490+
18491+ /*! \brief Codec capabilities bitfield
18492+ *
18493+ * Each codec advertises the capabilities it supports as part of its
18494+ * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
18495+ * or functionality, and are not required to be supported.
18496+ *
18497+ * The available flags are specified by VPX_CODEC_CAP_* defines.
18498+ */
18499+ typedef long vpx_codec_caps_t;
18500+#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
18501+#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
18502+#define VPX_CODEC_CAP_XMA 0x4 /**< Supports e_xternal Memory Allocation */
18503+
18504+
18505+ /*! \brief Initialization-time Feature Enabling
18506+ *
18507+ * Certain codec features must be known at initialization time, to allow for
18508+ * proper memory allocation.
18509+ *
18510+ * The available flags are specified by VPX_CODEC_USE_* defines.
18511+ */
18512+ typedef long vpx_codec_flags_t;
18513+#define VPX_CODEC_USE_XMA 0x00000001 /**< Use e_xternal Memory Allocation mode */
18514+
18515+
18516+ /*!\brief Codec interface structure.
18517+ *
18518+ * Contains function pointers and other data private to the codec
18519+ * implementation. This structure is opaque to the application.
18520+ */
18521+ typedef const struct vpx_codec_iface vpx_codec_iface_t;
18522+
18523+
18524+ /*!\brief Codec private data structure.
18525+ *
18526+ * Contains data private to the codec implementation. This structure is opaque
18527+ * to the application.
18528+ */
18529+ typedef struct vpx_codec_priv vpx_codec_priv_t;
18530+
18531+
18532+ /*!\brief Iterator
18533+ *
18534+ * Opaque storage used for iterating over lists.
18535+ */
18536+ typedef const void *vpx_codec_iter_t;
18537+
18538+
18539+ /*!\brief Codec context structure
18540+ *
18541+ * All codecs \ref MUST support this context structure fully. In general,
18542+ * this data should be considered private to the codec algorithm, and
18543+ * not be manipulated or examined by the calling application. Applications
18544+ * may reference the 'name' member to get a printable description of the
18545+ * algorithm.
18546+ */
18547+ typedef struct vpx_codec_ctx
18548+ {
18549+ const char *name; /**< Printable interface name */
18550+ vpx_codec_iface_t *iface; /**< Interface pointers */
18551+ vpx_codec_err_t err; /**< Last returned error */
18552+ const char *err_detail; /**< Detailed info, if available */
18553+ vpx_codec_flags_t init_flags; /**< Flags passed at init time */
18554+ union
18555+ {
18556+ struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */
18557+ struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */
18558+ void *raw;
18559+ } config; /**< Configuration pointer aliasing union */
18560+ vpx_codec_priv_t *priv; /**< Algorithm private storage */
18561+ } vpx_codec_ctx_t;
18562+
18563+
18564+ /*
18565+ * Library Version Number Interface
18566+ *
18567+ * For example, see the following sample return values:
18568+ * vpx_codec_version() (1<<16 | 2<<8 | 3)
18569+ * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
18570+ * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
18571+ */
18572+
18573+ /*!\brief Return the version information (as an integer)
18574+ *
18575+ * Returns a packed encoding of the library version number. This will only include
18576+ * the major.minor.patch component of the version number. Note that this encoded
18577+ * value should be accessed through the macros provided, as the encoding may change
18578+ * in the future.
18579+ *
18580+ */
18581+ int vpx_codec_version(void);
18582+#define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
18583+#define VPX_VERSION_MINOR(v) ((v>>8)&0xff) /**< extract minor from packed version */
18584+#define VPX_VERSION_PATCH(v) ((v>>0)&0xff) /**< extract patch from packed version */
18585+
18586+ /*!\brief Return the version major number */
18587+#define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
18588+
18589+ /*!\brief Return the version minr number */
18590+#define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
18591+
18592+ /*!\brief Return the version patch number */
18593+#define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
18594+
18595+
18596+ /*!\brief Return the version information (as a string)
18597+ *
18598+ * Returns a printable string containing the full library version number. This may
18599+ * contain additional text following the three digit version number, as to indicate
18600+ * release candidates, prerelease versions, etc.
18601+ *
18602+ */
18603+ const char *vpx_codec_version_str(void);
18604+
18605+
18606+ /*!\brief Return the version information (as a string)
18607+ *
18608+ * Returns a printable "extra string". This is the component of the string returned
18609+ * by vpx_codec_version_str() following the three digit version number.
18610+ *
18611+ */
18612+ const char *vpx_codec_version_extra_str(void);
18613+
18614+
18615+ /*!\brief Return the build configuration
18616+ *
18617+ * Returns a printable string containing an encoded version of the build
18618+ * configuration. This may be useful to vpx support.
18619+ *
18620+ */
18621+ const char *vpx_codec_build_config(void);
18622+
18623+
18624+ /*!\brief Return the name for a given interface
18625+ *
18626+ * Returns a human readable string for name of the given codec interface.
18627+ *
18628+ * \param[in] iface Interface pointer
18629+ *
18630+ */
18631+ const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
18632+
18633+
18634+ /*!\brief Convert error number to printable string
18635+ *
18636+ * Returns a human readable string for the last error returned by the
18637+ * algorithm. The returned error will be one line and will not contain
18638+ * any newline characters.
18639+ *
18640+ *
18641+ * \param[in] err Error number.
18642+ *
18643+ */
18644+ const char *vpx_codec_err_to_string(vpx_codec_err_t err);
18645+
18646+
18647+ /*!\brief Retrieve error synopsis for codec context
18648+ *
18649+ * Returns a human readable string for the last error returned by the
18650+ * algorithm. The returned error will be one line and will not contain
18651+ * any newline characters.
18652+ *
18653+ *
18654+ * \param[in] ctx Pointer to this instance's context.
18655+ *
18656+ */
18657+ const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
18658+
18659+
18660+ /*!\brief Retrieve detailed error information for codec context
18661+ *
18662+ * Returns a human readable string providing detailed information about
18663+ * the last error.
18664+ *
18665+ * \param[in] ctx Pointer to this instance's context.
18666+ *
18667+ * \retval NULL
18668+ * No detailed information is available.
18669+ */
18670+ const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
18671+
18672+
18673+ /* REQUIRED FUNCTIONS
18674+ *
18675+ * The following functions are required to be implemented for all codecs.
18676+ * They represent the base case functionality expected of all codecs.
18677+ */
18678+
18679+ /*!\brief Destroy a codec instance
18680+ *
18681+ * Destroys a codec context, freeing any associated memory buffers.
18682+ *
18683+ * \param[in] ctx Pointer to this instance's context
18684+ *
18685+ * \retval #VPX_CODEC_OK
18686+ * The codec algorithm initialized.
18687+ * \retval #VPX_CODEC_MEM_ERROR
18688+ * Memory allocation failed.
18689+ */
18690+ vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
18691+
18692+
18693+ /*!\brief Get the capabilities of an algorithm.
18694+ *
18695+ * Retrieves the capabliities bitfield from the algorithm's interface.
18696+ *
18697+ * \param[in] iface Pointer to the alogrithm interface
18698+ *
18699+ */
18700+ vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
18701+
18702+
18703+ /*!\brief Control algorithm
18704+ *
18705+ * This function is used to exchange algorithm specific data with the codec
18706+ * instance. This can be used to implement features specific to a particular
18707+ * algorithm.
18708+ *
18709+ * This wrapper function dispatches the request to the helper function
18710+ * associated with the given ctrl_id. It tries to call this function
18711+ * transparantly, but will return #VPX_CODEC_ERROR if the request could not
18712+ * be dispatched.
18713+ *
18714+ * Note that this function should not be used directly. Call the
18715+ * #vpx_codec_control wrapper macro instead.
18716+ *
18717+ * \param[in] ctx Pointer to this instance's context
18718+ * \param[in] ctrl_id Algorithm specific control identifier
18719+ *
18720+ * \retval #VPX_CODEC_OK
18721+ * The control request was processed.
18722+ * \retval #VPX_CODEC_ERROR
18723+ * The control request was not processed.
18724+ * \retval #VPX_CODEC_INVALID_PARAM
18725+ * The data was not valid.
18726+ */
18727+ vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
18728+ int ctrl_id,
18729+ ...);
18730+#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
18731+# define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
18732+# define VPX_CTRL_USE_TYPE(id, typ)
18733+# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
18734+# define VPX_CTRL_VOID(id, typ)
18735+
18736+#else
18737+ /*!\brief vpx_codec_control wrapper macro
18738+ *
18739+ * This macro allows for type safe conversions across the variadic parameter
18740+ * to vpx_codec_control_().
18741+ *
18742+ * \internal
18743+ * It works by dispatching the call to the control function through a wrapper
18744+ * function named with the id parameter.
18745+ */
18746+# define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
18747+ /**<\hideinitializer*/
18748+
18749+
18750+ /*!\brief vpx_codec_control type definition macro
18751+ *
18752+ * This macro allows for type safe conversions across the variadic parameter
18753+ * to vpx_codec_control_(). It defines the type of the argument for a given
18754+ * control identifier.
18755+ *
18756+ * \internal
18757+ * It defines a static function with
18758+ * the correctly typed arguments as a wrapper to the type-unsafe internal
18759+ * function.
18760+ */
18761+# define VPX_CTRL_USE_TYPE(id, typ) \
18762+ static vpx_codec_err_t \
18763+ vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
18764+ \
18765+ static vpx_codec_err_t \
18766+ vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
18767+ return vpx_codec_control_(ctx, ctrl_id, data);\
18768+ } /**<\hideinitializer*/
18769+
18770+
18771+ /*!\brief vpx_codec_control deprecated type definition macro
18772+ *
18773+ * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
18774+ * deprecated and should not be used. Consult the documentation for your
18775+ * codec for more information.
18776+ *
18777+ * \internal
18778+ * It defines a static function with the correctly typed arguments as a
18779+ * wrapper to the type-unsafe internal function.
18780+ */
18781+# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
18782+ DECLSPEC_DEPRECATED static vpx_codec_err_t \
18783+ vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
18784+ \
18785+ DECLSPEC_DEPRECATED static vpx_codec_err_t \
18786+ vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
18787+ return vpx_codec_control_(ctx, ctrl_id, data);\
18788+ } /**<\hideinitializer*/
18789+
18790+
18791+ /*!\brief vpx_codec_control void type definition macro
18792+ *
18793+ * This macro allows for type safe conversions across the variadic parameter
18794+ * to vpx_codec_control_(). It indicates that a given control identifier takes
18795+ * no argument.
18796+ *
18797+ * \internal
18798+ * It defines a static function without a data argument as a wrapper to the
18799+ * type-unsafe internal function.
18800+ */
18801+# define VPX_CTRL_VOID(id) \
18802+ static vpx_codec_err_t \
18803+ vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
18804+ \
18805+ static vpx_codec_err_t \
18806+ vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
18807+ return vpx_codec_control_(ctx, ctrl_id);\
18808+ } /**<\hideinitializer*/
18809+
18810+
18811+#endif
18812+
18813+
18814+ /*!\defgroup cap_xma External Memory Allocation Functions
18815+ *
18816+ * The following functions are required to be implemented for all codecs
18817+ * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions
18818+ * for codecs that don't advertise this capability will result in an error
18819+ * code being returned, usually VPX_CODEC_INCAPABLE
18820+ * @{
18821+ */
18822+
18823+
18824+ /*!\brief Memory Map Entry
18825+ *
18826+ * This structure is used to contain the properties of a memory segment. It
18827+ * is populated by the codec in the request phase, and by the calling
18828+ * application once the requested allocation has been performed.
18829+ */
18830+ typedef struct vpx_codec_mmap
18831+ {
18832+ /*
18833+ * The following members are set by the codec when requesting a segment
18834+ */
18835+ unsigned int id; /**< identifier for the segment's contents */
18836+ unsigned long sz; /**< size of the segment, in bytes */
18837+ unsigned int align; /**< required alignment of the segment, in bytes */
18838+ unsigned int flags; /**< bitfield containing segment properties */
18839+#define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
18840+#define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
18841+#define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
18842+
18843+ /* The following members are to be filled in by the allocation function */
18844+ void *base; /**< pointer to the allocated segment */
18845+ void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */
18846+ void *priv; /**< allocator private storage */
18847+ } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */
18848+
18849+
18850+ /*!\brief Iterate over the list of segments to allocate.
18851+ *
18852+ * Iterates over a list of the segments to allocate. The iterator storage
18853+ * should be initialized to NULL to start the iteration. Iteration is complete
18854+ * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to
18855+ * allocate is dependant upon the size of the encoded stream. In cases where the
18856+ * stream is not available at allocation time, a fixed size must be requested.
18857+ * The codec will not be able to operate on streams larger than the size used at
18858+ * allocation time.
18859+ *
18860+ * \param[in] ctx Pointer to this instance's context.
18861+ * \param[out] mmap Pointer to the memory map entry to populate.
18862+ * \param[in,out] iter Iterator storage, initialized to NULL
18863+ *
18864+ * \retval #VPX_CODEC_OK
18865+ * The memory map entry was populated.
18866+ * \retval #VPX_CODEC_ERROR
18867+ * Codec does not support XMA mode.
18868+ * \retval #VPX_CODEC_MEM_ERROR
18869+ * Unable to determine segment size from stream info.
18870+ */
18871+ vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
18872+ vpx_codec_mmap_t *mmap,
18873+ vpx_codec_iter_t *iter);
18874+
18875+
18876+ /*!\brief Identify allocated segments to codec instance
18877+ *
18878+ * Stores a list of allocated segments in the codec. Segments \ref MUST be
18879+ * passed in the order they are read from vpx_codec_get_mem_map(), but may be
18880+ * passed in groups of any size. Segments \ref MUST be set only once. The
18881+ * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member
18882+ * is non-NULL. If the segment requires cleanup handling (eg, calling free()
18883+ * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated.
18884+ *
18885+ * \param[in] ctx Pointer to this instance's context.
18886+ * \param[in] mmaps Pointer to the first memory map entry in the list.
18887+ * \param[in] num_maps Number of entries being set at this time
18888+ *
18889+ * \retval #VPX_CODEC_OK
18890+ * The segment was stored in the codec context.
18891+ * \retval #VPX_CODEC_INCAPABLE
18892+ * Codec does not support XMA mode.
18893+ * \retval #VPX_CODEC_MEM_ERROR
18894+ * Segment base address was not set, or segment was already stored.
18895+
18896+ */
18897+ vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
18898+ vpx_codec_mmap_t *mmaps,
18899+ unsigned int num_maps);
18900+
18901+ /*!@} - end defgroup cap_xma*/
18902+ /*!@} - end defgroup codec*/
18903+
18904+
18905+#endif
18906+#ifdef __cplusplus
18907+}
18908+#endif
18909diff --git a/vpx/vpx_codec.mk b/vpx/vpx_codec.mk
18910new file mode 100644
18911index 0000000..4e09b5f
18912--- /dev/null
18913+++ b/vpx/vpx_codec.mk
18914@@ -0,0 +1,27 @@
18915+##
18916+## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
18917+##
18918+## Use of this source code is governed by a BSD-style license
18919+## that can be found in the LICENSE file in the root of the source
18920+## tree. An additional intellectual property rights grant can be found
18921+## in the file PATENTS. All contributing project authors may
18922+## be found in the AUTHORS file in the root of the source tree.
18923+##
18924+
18925+
18926+API_EXPORTS += exports
18927+
18928+API_SRCS-$(CONFIG_DECODERS) += src/vpx_decoder.c
18929+API_SRCS-$(CONFIG_DECODERS) += src/vpx_decoder_compat.c
18930+API_SRCS-$(CONFIG_DECODERS) += vpx_decoder.h
18931+API_SRCS-$(CONFIG_DECODERS) += vpx_decoder_compat.h
18932+API_SRCS-$(CONFIG_ENCODERS) += src/vpx_encoder.c
18933+API_SRCS-$(CONFIG_ENCODERS) += vpx_encoder.h
18934+API_SRCS-yes += internal/vpx_codec_internal.h
18935+API_SRCS-yes += src/vpx_codec.c
18936+API_SRCS-yes += src/vpx_image.c
18937+API_SRCS-yes += vpx_codec.h
18938+API_SRCS-yes += vpx_codec.mk
18939+API_SRCS-yes += vpx_codec_impl_bottom.h
18940+API_SRCS-yes += vpx_codec_impl_top.h
18941+API_SRCS-yes += vpx_image.h
18942diff --git a/vpx/vpx_codec_impl_bottom.h b/vpx/vpx_codec_impl_bottom.h
18943new file mode 100644
18944index 0000000..02bf8b3
18945--- /dev/null
18946+++ b/vpx/vpx_codec_impl_bottom.h
18947@@ -0,0 +1,19 @@
18948+/*
18949+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
18950+ *
18951+ * Use of this source code is governed by a BSD-style license
18952+ * that can be found in the LICENSE file in the root of the source
18953+ * tree. An additional intellectual property rights grant can be found
18954+ * in the file PATENTS. All contributing project authors may
18955+ * be found in the AUTHORS file in the root of the source tree.
18956+ */
18957+
18958+
18959+/*
18960+ * This file is to be included at the bottom of the header files defining the
18961+ * interface to individual codecs and contains matching blocks to those defined
18962+ * in vpx_codec_impl_top.h
18963+ */
18964+#ifdef __cplusplus
18965+}
18966+#endif
18967diff --git a/vpx/vpx_codec_impl_top.h b/vpx/vpx_codec_impl_top.h
18968new file mode 100644
18969index 0000000..fce14c1
18970--- /dev/null
18971+++ b/vpx/vpx_codec_impl_top.h
18972@@ -0,0 +1,19 @@
18973+/*
18974+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
18975+ *
18976+ * Use of this source code is governed by a BSD-style license
18977+ * that can be found in the LICENSE file in the root of the source
18978+ * tree. An additional intellectual property rights grant can be found
18979+ * in the file PATENTS. All contributing project authors may
18980+ * be found in the AUTHORS file in the root of the source tree.
18981+ */
18982+
18983+
18984+/*
18985+ * This file is to be included at the top of the header files defining the
18986+ * interface to individual codecs and contains various workarounds common
18987+ * to all codec implementations.
18988+ */
18989+#ifdef __cplusplus
18990+extern "C" {
18991+#endif
18992diff --git a/vpx/vpx_decoder.h b/vpx/vpx_decoder.h
18993new file mode 100644
18994index 0000000..865f5df
18995--- /dev/null
18996+++ b/vpx/vpx_decoder.h
18997@@ -0,0 +1,317 @@
18998+/*
18999+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
19000+ *
19001+ * Use of this source code is governed by a BSD-style license
19002+ * that can be found in the LICENSE file in the root of the source
19003+ * tree. An additional intellectual property rights grant can be found
19004+ * in the file PATENTS. All contributing project authors may
19005+ * be found in the AUTHORS file in the root of the source tree.
19006+ */
19007+
19008+
19009+/*!\defgroup decoder Decoder Algorithm Interface
19010+ * \ingroup codec
19011+ * This abstraction allows applications using this decoder to easily support
19012+ * multiple video formats with minimal code duplication. This section describes
19013+ * the interface common to all decoders.
19014+ * @{
19015+ */
19016+
19017+/*!\file vpx_decoder.h
19018+ * \brief Describes the decoder algorithm interface to applications.
19019+ *
19020+ * This file describes the interface between an application and a
19021+ * video decoder algorithm.
19022+ *
19023+ */
19024+#ifdef __cplusplus
19025+extern "C" {
19026+#endif
19027+
19028+#ifndef VPX_DECODER_H
19029+#define VPX_DECODER_H
19030+#include "vpx_codec.h"
19031+
19032+ /*!\brief Current ABI version number
19033+ *
19034+ * \internal
19035+ * If this file is altered in any way that changes the ABI, this value
19036+ * must be bumped. Examples include, but are not limited to, changing
19037+ * types, removing or reassigning enums, adding/removing/rearranging
19038+ * fields to structures
19039+ */
19040+#define VPX_DECODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
19041+
19042+ /*! \brief Decoder capabilities bitfield
19043+ *
19044+ * Each decoder advertises the capabilities it supports as part of its
19045+ * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
19046+ * or functionality, and are not required to be supported by a decoder.
19047+ *
19048+ * The available flags are specifiedby VPX_CODEC_CAP_* defines.
19049+ */
19050+#define VPX_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
19051+#define VPX_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
19052+#define VPX_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
19053+
19054+ /*! \brief Initialization-time Feature Enabling
19055+ *
19056+ * Certain codec features must be known at initialization time, to allow for
19057+ * proper memory allocation.
19058+ *
19059+ * The available flags are specified by VPX_CODEC_USE_* defines.
19060+ */
19061+#define VPX_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
19062+
19063+ /*!\brief Stream properties
19064+ *
19065+ * This structure is used to query or set properties of the decoded
19066+ * stream. Algorithms may extend this structure with data specific
19067+ * to their bitstream by setting the sz member appropriately.
19068+ */
19069+ typedef struct vpx_codec_stream_info
19070+ {
19071+ unsigned int sz; /**< Size of this structure */
19072+ unsigned int w; /**< Width (or 0 for unknown/default) */
19073+ unsigned int h; /**< Height (or 0 for unknown/default) */
19074+ unsigned int is_kf; /**< Current frame is a keyframe */
19075+ } vpx_codec_stream_info_t;
19076+
19077+ /* REQUIRED FUNCTIONS
19078+ *
19079+ * The following functions are required to be implemented for all decoders.
19080+ * They represent the base case functionality expected of all decoders.
19081+ */
19082+
19083+
19084+ /*!\brief Initialization Configurations
19085+ *
19086+ * This structure is used to pass init time configuration options to the
19087+ * decoder.
19088+ */
19089+ typedef struct vpx_codec_dec_cfg
19090+ {
19091+ unsigned int threads; /**< Maximum number of threads to use, default 1 */
19092+ unsigned int w; /**< Width */
19093+ unsigned int h; /**< Height */
19094+ } vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */
19095+
19096+
19097+ /*!\brief Initialize a decoder instance
19098+ *
19099+ * Initializes a decoder context using the given interface. Applications
19100+ * should call the vpx_codec_dec_init convenience macro instead of this
19101+ * function directly, to ensure that the ABI version number parameter
19102+ * is properly initialized.
19103+ *
19104+ * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
19105+ * parameter), the storage pointed to by the cfg parameter must be
19106+ * kept readable and stable until all memory maps have been set.
19107+ *
19108+ * \param[in] ctx Pointer to this instance's context.
19109+ * \param[in] iface Pointer to the alogrithm interface to use.
19110+ * \param[in] cfg Configuration to use, if known. May be NULL.
19111+ * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
19112+ * \param[in] ver ABI version number. Must be set to
19113+ * VPX_DECODER_ABI_VERSION
19114+ * \retval #VPX_CODEC_OK
19115+ * The decoder algorithm initialized.
19116+ * \retval #VPX_CODEC_MEM_ERROR
19117+ * Memory allocation failed.
19118+ */
19119+ vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
19120+ vpx_codec_iface_t *iface,
19121+ vpx_codec_dec_cfg_t *cfg,
19122+ vpx_codec_flags_t flags,
19123+ int ver);
19124+
19125+ /*!\brief Convenience macro for vpx_codec_dec_init_ver()
19126+ *
19127+ * Ensures the ABI version parameter is properly set.
19128+ */
19129+#define vpx_codec_dec_init(ctx, iface, cfg, flags) \
19130+ vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
19131+
19132+
19133+ /*!\brief Parse stream info from a buffer
19134+ *
19135+ * Performs high level parsing of the bitstream. Construction of a decoder
19136+ * context is not necessary. Can be used to determine if the bitstream is
19137+ * of the proper format, and to extract information from the stream.
19138+ *
19139+ * \param[in] iface Pointer to the alogrithm interface
19140+ * \param[in] data Pointer to a block of data to parse
19141+ * \param[in] data_sz Size of the data buffer
19142+ * \param[in,out] si Pointer to stream info to update. The size member
19143+ * \ref MUST be properly initialized, but \ref MAY be
19144+ * clobbered by the algorithm. This parameter \ref MAY
19145+ * be NULL.
19146+ *
19147+ * \retval #VPX_CODEC_OK
19148+ * Bitstream is parsable and stream information updated
19149+ */
19150+ vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
19151+ const uint8_t *data,
19152+ unsigned int data_sz,
19153+ vpx_codec_stream_info_t *si);
19154+
19155+
19156+ /*!\brief Return information about the current stream.
19157+ *
19158+ * Returns information about the stream that has been parsed during decoding.
19159+ *
19160+ * \param[in] ctx Pointer to this instance's context
19161+ * \param[in,out] si Pointer to stream info to update. The size member
19162+ * \ref MUST be properly initialized, but \ref MAY be
19163+ * clobbered by the algorithm. This parameter \ref MAY
19164+ * be NULL.
19165+ *
19166+ * \retval #VPX_CODEC_OK
19167+ * Bitstream is parsable and stream information updated
19168+ */
19169+ vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
19170+ vpx_codec_stream_info_t *si);
19171+
19172+
19173+ /*!\brief Decode data
19174+ *
19175+ * Processes a buffer of coded data. If the processing results in a new
19176+ * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
19177+ * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
19178+ * time stamp) order. Frames produced will always be in PTS (presentation
19179+ * time stamp) order.
19180+ *
19181+ * \param[in] ctx Pointer to this instance's context
19182+ * \param[in] data Pointer to this block of new coded data. If
19183+ * NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
19184+ * for the previously decoded frame.
19185+ * \param[in] data_sz Size of the coded data, in bytes.
19186+ * \param[in] user_priv Application specific data to associate with
19187+ * this frame.
19188+ * \param[in] deadline Soft deadline the decoder should attempt to meet,
19189+ * in us. Set to zero for unlimited.
19190+ *
19191+ * \return Returns #VPX_CODEC_OK if the coded data was processed completely
19192+ * and future pictures can be decoded without error. Otherwise,
19193+ * see the descriptions of the other error codes in ::vpx_codec_err_t
19194+ * for recoverability capabilities.
19195+ */
19196+ vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
19197+ const uint8_t *data,
19198+ unsigned int data_sz,
19199+ void *user_priv,
19200+ long deadline);
19201+
19202+
19203+ /*!\brief Decoded frames iterator
19204+ *
19205+ * Iterates over a list of the frames available for display. The iterator
19206+ * storage should be initialized to NULL to start the iteration. Iteration is
19207+ * complete when this function returns NULL.
19208+ *
19209+ * The list of available frames becomes valid upon completion of the
19210+ * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
19211+ *
19212+ * \param[in] ctx Pointer to this instance's context
19213+ * \param[in,out] iter Iterator storage, initialized to NULL
19214+ *
19215+ * \return Returns a pointer to an image, if one is ready for display. Frames
19216+ * produced will always be in PTS (presentation time stamp) order.
19217+ */
19218+ vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
19219+ vpx_codec_iter_t *iter);
19220+
19221+
19222+ /*!\defgroup cap_put_frame Frame-Based Decoding Functions
19223+ *
19224+ * The following functions are required to be implemented for all decoders
19225+ * that advertise the VPX_CODEC_CAP_PUT_FRAME capability. Calling these functions
19226+ * for codecs that don't advertise this capability will result in an error
19227+ * code being returned, usually VPX_CODEC_ERROR
19228+ * @{
19229+ */
19230+
19231+ /*!\brief put frame callback prototype
19232+ *
19233+ * This callback is invoked by the decoder to notify the application of
19234+ * the availability of decoded image data.
19235+ */
19236+ typedef void (*vpx_codec_put_frame_cb_fn_t)(void *user_priv,
19237+ const vpx_image_t *img);
19238+
19239+
19240+ /*!\brief Register for notification of frame completion.
19241+ *
19242+ * Registers a given function to be called when a decoded frame is
19243+ * available.
19244+ *
19245+ * \param[in] ctx Pointer to this instance's context
19246+ * \param[in] cb Pointer to the callback function
19247+ * \param[in] user_priv User's private data
19248+ *
19249+ * \retval #VPX_CODEC_OK
19250+ * Callback successfully registered.
19251+ * \retval #VPX_CODEC_ERROR
19252+ * Decoder context not initialized, or algorithm not capable of
19253+ * posting slice completion.
19254+ */
19255+ vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
19256+ vpx_codec_put_frame_cb_fn_t cb,
19257+ void *user_priv);
19258+
19259+
19260+ /*!@} - end defgroup cap_put_frame */
19261+
19262+ /*!\defgroup cap_put_slice Slice-Based Decoding Functions
19263+ *
19264+ * The following functions are required to be implemented for all decoders
19265+ * that advertise the VPX_CODEC_CAP_PUT_SLICE capability. Calling these functions
19266+ * for codecs that don't advertise this capability will result in an error
19267+ * code being returned, usually VPX_CODEC_ERROR
19268+ * @{
19269+ */
19270+
19271+ /*!\brief put slice callback prototype
19272+ *
19273+ * This callback is invoked by the decoder to notify the application of
19274+ * the availability of partially decoded image data. The
19275+ */
19276+ typedef void (*vpx_codec_put_slice_cb_fn_t)(void *user_priv,
19277+ const vpx_image_t *img,
19278+ const vpx_image_rect_t *valid,
19279+ const vpx_image_rect_t *update);
19280+
19281+
19282+ /*!\brief Register for notification of slice completion.
19283+ *
19284+ * Registers a given function to be called when a decoded slice is
19285+ * available.
19286+ *
19287+ * \param[in] ctx Pointer to this instance's context
19288+ * \param[in] cb Pointer to the callback function
19289+ * \param[in] user_priv User's private data
19290+ *
19291+ * \retval #VPX_CODEC_OK
19292+ * Callback successfully registered.
19293+ * \retval #VPX_CODEC_ERROR
19294+ * Decoder context not initialized, or algorithm not capable of
19295+ * posting slice completion.
19296+ */
19297+ vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
19298+ vpx_codec_put_slice_cb_fn_t cb,
19299+ void *user_priv);
19300+
19301+
19302+ /*!@} - end defgroup cap_put_slice*/
19303+
19304+ /*!@} - end defgroup decoder*/
19305+
19306+#endif
19307+
19308+#ifdef __cplusplus
19309+}
19310+#endif
19311+
19312+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
19313+#include "vpx_decoder_compat.h"
19314+#endif
19315diff --git a/vpx/vpx_decoder_compat.h b/vpx/vpx_decoder_compat.h
19316new file mode 100644
19317index 0000000..e66a096
19318--- /dev/null
19319+++ b/vpx/vpx_decoder_compat.h
19320@@ -0,0 +1,587 @@
19321+/*
19322+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
19323+ *
19324+ * Use of this source code is governed by a BSD-style license
19325+ * that can be found in the LICENSE file in the root of the source
19326+ * tree. An additional intellectual property rights grant can be found
19327+ * in the file PATENTS. All contributing project authors may
19328+ * be found in the AUTHORS file in the root of the source tree.
19329+ */
19330+
19331+
19332+/*!\defgroup decoder Common Decoder Algorithm Interface
19333+ * This abstraction allows applications using this decoder to easily support
19334+ * multiple video formats with minimal code duplication. This section describes
19335+ * the interface common to all codecs.
19336+ * @{
19337+ */
19338+
19339+/*!\file vpx_decoder_compat.h
19340+ * \brief Provides a compatibility layer between version 1 and 2 of this API.
19341+ *
19342+ * This interface has been deprecated. Only existing code should make use
19343+ * of this interface, and therefore, it is only thinly documented. Existing
19344+ * code should be ported to the vpx_codec_* API.
19345+ */
19346+#ifdef __cplusplus
19347+extern "C" {
19348+#endif
19349+
19350+#ifndef VPX_DECODER_COMPAT_H
19351+#define VPX_DECODER_COMPAT_H
19352+
19353+ /*!\brief Decoder algorithm return codes */
19354+ typedef enum {
19355+ /*!\brief Operation completed without error */
19356+ VPX_DEC_OK = VPX_CODEC_OK,
19357+
19358+ /*!\brief Unspecified error */
19359+ VPX_DEC_ERROR = VPX_CODEC_ERROR,
19360+
19361+ /*!\brief Memory operation failed */
19362+ VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR,
19363+
19364+ /*!\brief ABI version mismatch */
19365+ VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
19366+
19367+ /*!\brief The given bitstream is not supported.
19368+ *
19369+ * The bitstream was unable to be parsed at the highest level. The decoder
19370+ * is unable to proceed. This error \ref SHOULD be treated as fatal to the
19371+ * stream. */
19372+ VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM,
19373+
19374+ /*!\brief Encoded bitstream uses an unsupported feature
19375+ *
19376+ * The decoder does not implement a feature required by the encoder. This
19377+ * return code should only be used for features that prevent future
19378+ * pictures from being properly decoded. This error \ref MAY be treated as
19379+ * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
19380+ */
19381+ VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE,
19382+
19383+ /*!\brief The coded data for this stream is corrupt or incomplete
19384+ *
19385+ * There was a problem decoding the current frame. This return code
19386+ * should only be used for failures that prevent future pictures from
19387+ * being properly decoded. This error \ref MAY be treated as fatal to the
19388+ * stream or \ref MAY be treated as fatal to the current GOP. If decoding
19389+ * is continued for the current GOP, artifacts may be present.
19390+ */
19391+ VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME,
19392+
19393+ /*!\brief An application-supplied parameter is not valid.
19394+ *
19395+ */
19396+ VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
19397+
19398+ /*!\brief An iterator reached the end of list.
19399+ *
19400+ */
19401+ VPX_DEC_LIST_END = VPX_CODEC_LIST_END,
19402+
19403+ }
19404+ vpx_dec_err_t;
19405+
19406+ /*! \brief Decoder capabilities bitfield
19407+ *
19408+ * Each decoder advertises the capabilities it supports as part of its
19409+ * ::vpx_dec_iface_t interface structure. Capabilities are extra interfaces
19410+ * or functionality, and are not required to be supported by a decoder.
19411+ *
19412+ * The available flags are specifiedby VPX_DEC_CAP_* defines.
19413+ */
19414+ typedef int vpx_dec_caps_t;
19415+#define VPX_DEC_CAP_PUT_SLICE 0x0001 /**< Will issue put_slice callbacks */
19416+#define VPX_DEC_CAP_PUT_FRAME 0x0002 /**< Will issue put_frame callbacks */
19417+#define VPX_DEC_CAP_XMA 0x0004 /**< Supports e_xternal Memory Allocation */
19418+
19419+ /*!\brief Stream properties
19420+ *
19421+ * This structure is used to query or set properties of the decoded
19422+ * stream. Algorithms may extend this structure with data specific
19423+ * to their bitstream by setting the sz member appropriately.
19424+ */
19425+#if 1
19426+ typedef vpx_codec_stream_info_t vpx_dec_stream_info_t;
19427+#else
19428+ typedef struct
19429+ {
19430+ unsigned int sz; /**< Size of this structure */
19431+ unsigned int w; /**< Width (or 0 for unknown/default) */
19432+ unsigned int h; /**< Height (or 0 for unknown/default) */
19433+ unsigned int is_kf; /**< Current frame is a keyframe */
19434+ } vpx_dec_stream_info_t;
19435+#endif
19436+
19437+
19438+ /*!\brief Decoder interface structure.
19439+ *
19440+ * Contains function pointers and other data private to the decoder
19441+ * implementation. This structure is opaque to the application.
19442+ */
19443+ typedef const struct vpx_codec_iface vpx_dec_iface_t;
19444+ typedef struct vpx_codec_priv vpx_dec_priv_t;
19445+
19446+ /*!\brief Iterator
19447+ *
19448+ * Opaque storage used for iterating over lists.
19449+ */
19450+ typedef vpx_codec_iter_t vpx_dec_iter_t;
19451+
19452+ /*!\brief Decoder context structure
19453+ *
19454+ * All decoders \ref MUST support this context structure fully. In general,
19455+ * this data should be considered private to the decoder algorithm, and
19456+ * not be manipulated or examined by the calling application. Applications
19457+ * may reference the 'name' member to get a printable description of the
19458+ * algorithm.
19459+ */
19460+#if 1
19461+ typedef vpx_codec_ctx_t vpx_dec_ctx_t;
19462+#else
19463+ typedef struct
19464+ {
19465+ const char *name; /**< Printable interface name */
19466+ vpx_dec_iface_t *iface; /**< Interface pointers */
19467+ vpx_dec_err_t err; /**< Last returned error */
19468+ vpx_dec_priv_t *priv; /**< Algorithm private storage */
19469+ } vpx_dec_ctx_t;
19470+#endif
19471+
19472+
19473+ /*!\brief Return the build configuration
19474+ *
19475+ * Returns a printable string containing an encoded version of the build
19476+ * configuration. This may be useful to vpx support.
19477+ *
19478+ */
19479+ const char *vpx_dec_build_config(void) DEPRECATED;
19480+
19481+ /*!\brief Return the name for a given interface
19482+ *
19483+ * Returns a human readable string for name of the given decoder interface.
19484+ *
19485+ * \param[in] iface Interface pointer
19486+ *
19487+ */
19488+ const char *vpx_dec_iface_name(vpx_dec_iface_t *iface) DEPRECATED;
19489+
19490+
19491+ /*!\brief Convert error number to printable string
19492+ *
19493+ * Returns a human readable string for the last error returned by the
19494+ * algorithm. The returned error will be one line and will not contain
19495+ * any newline characters.
19496+ *
19497+ *
19498+ * \param[in] err Error number.
19499+ *
19500+ */
19501+ const char *vpx_dec_err_to_string(vpx_dec_err_t err) DEPRECATED;
19502+
19503+
19504+ /*!\brief Retrieve error synopsis for decoder context
19505+ *
19506+ * Returns a human readable string for the last error returned by the
19507+ * algorithm. The returned error will be one line and will not contain
19508+ * any newline characters.
19509+ *
19510+ *
19511+ * \param[in] ctx Pointer to this instance's context.
19512+ *
19513+ */
19514+ const char *vpx_dec_error(vpx_dec_ctx_t *ctx) DEPRECATED;
19515+
19516+
19517+ /*!\brief Retrieve detailed error information for decoder context
19518+ *
19519+ * Returns a human readable string providing detailed information about
19520+ * the last error.
19521+ *
19522+ * \param[in] ctx Pointer to this instance's context.
19523+ *
19524+ * \retval NULL
19525+ * No detailed information is available.
19526+ */
19527+ const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx) DEPRECATED;
19528+
19529+
19530+ /* REQUIRED FUNCTIONS
19531+ *
19532+ * The following functions are required to be implemented for all decoders.
19533+ * They represent the base case functionality expected of all decoders.
19534+ */
19535+
19536+
19537+ /*!\brief Initialize a decoder instance
19538+ *
19539+ * Initializes a decoder context using the given interface. Applications
19540+ * should call the vpx_dec_init convenience macro instead of this
19541+ * function directly, to ensure that the ABI version number parameter
19542+ * is properly initialized.
19543+ *
19544+ * \param[in] ctx Pointer to this instance's context.
19545+ * \param[in] iface Pointer to the alogrithm interface to use.
19546+ * \param[in] ver ABI version number. Must be set to
19547+ * VPX_DECODER_ABI_VERSION
19548+ * \retval #VPX_DEC_OK
19549+ * The decoder algorithm initialized.
19550+ * \retval #VPX_DEC_MEM_ERROR
19551+ * Memory allocation failed.
19552+ */
19553+ vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
19554+ vpx_dec_iface_t *iface,
19555+ int ver) DEPRECATED;
19556+#define vpx_dec_init(ctx, iface) \
19557+ vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
19558+
19559+
19560+ /*!\brief Destroy a decoder instance
19561+ *
19562+ * Destroys a decoder context, freeing any associated memory buffers.
19563+ *
19564+ * \param[in] ctx Pointer to this instance's context
19565+ *
19566+ * \retval #VPX_DEC_OK
19567+ * The decoder algorithm initialized.
19568+ * \retval #VPX_DEC_MEM_ERROR
19569+ * Memory allocation failed.
19570+ */
19571+ vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx) DEPRECATED;
19572+
19573+
19574+ /*!\brief Get the capabilities of an algorithm.
19575+ *
19576+ * Retrieves the capabliities bitfield from the algorithm's interface.
19577+ *
19578+ * \param[in] iface Pointer to the alogrithm interface
19579+ *
19580+ */
19581+ vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface) DEPRECATED;
19582+
19583+
19584+ /*!\brief Parse stream info from a buffer
19585+ *
19586+ * Performs high level parsing of the bitstream. Construction of a decoder
19587+ * context is not necessary. Can be used to determine if the bitstream is
19588+ * of the proper format, and to extract information from the stream.
19589+ *
19590+ * \param[in] iface Pointer to the alogrithm interface
19591+ * \param[in] data Pointer to a block of data to parse
19592+ * \param[in] data_sz Size of the data buffer
19593+ * \param[in,out] si Pointer to stream info to update. The size member
19594+ * \ref MUST be properly initialized, but \ref MAY be
19595+ * clobbered by the algorithm. This parameter \ref MAY
19596+ * be NULL.
19597+ *
19598+ * \retval #VPX_DEC_OK
19599+ * Bitstream is parsable and stream information updated
19600+ */
19601+ vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
19602+ const uint8_t *data,
19603+ unsigned int data_sz,
19604+ vpx_dec_stream_info_t *si) DEPRECATED;
19605+
19606+
19607+ /*!\brief Return information about the current stream.
19608+ *
19609+ * Returns information about the stream that has been parsed during decoding.
19610+ *
19611+ * \param[in] ctx Pointer to this instance's context
19612+ * \param[in,out] si Pointer to stream info to update. The size member
19613+ * \ref MUST be properly initialized, but \ref MAY be
19614+ * clobbered by the algorithm. This parameter \ref MAY
19615+ * be NULL.
19616+ *
19617+ * \retval #VPX_DEC_OK
19618+ * Bitstream is parsable and stream information updated
19619+ */
19620+ vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
19621+ vpx_dec_stream_info_t *si) DEPRECATED;
19622+
19623+
19624+ /*!\brief Control algorithm
19625+ *
19626+ * This function is used to exchange algorithm specific data with the decoder
19627+ * instance. This can be used to implement features specific to a particular
19628+ * algorithm.
19629+ *
19630+ * This wrapper function dispatches the request to the helper function
19631+ * associated with the given ctrl_id. It tries to call this function
19632+ * transparantly, but will return #VPX_DEC_ERROR if the request could not
19633+ * be dispatched.
19634+ *
19635+ * \param[in] ctx Pointer to this instance's context
19636+ * \param[in] ctrl_id Algorithm specific control identifier
19637+ * \param[in,out] data Data to exchange with algorithm instance.
19638+ *
19639+ * \retval #VPX_DEC_OK
19640+ * The control request was processed.
19641+ * \retval #VPX_DEC_ERROR
19642+ * The control request was not processed.
19643+ * \retval #VPX_DEC_INVALID_PARAM
19644+ * The data was not valid.
19645+ */
19646+ vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
19647+ int ctrl_id,
19648+ void *data) DEPRECATED;
19649+
19650+ /*!\brief Decode data
19651+ *
19652+ * Processes a buffer of coded data. If the processing results in a new
19653+ * decoded frame becoming available, #VPX_DEC_CB_PUT_SLICE and
19654+ * #VPX_DEC_CB_PUT_FRAME events may be generated, as appropriate. Encoded data
19655+ * \ref MUST be passed in DTS (decode time stamp) order. Frames produced will
19656+ * always be in PTS (presentation time stamp) order.
19657+ *
19658+ * \param[in] ctx Pointer to this instance's context
19659+ * \param[in] data Pointer to this block of new coded data. If
19660+ * NULL, a VPX_DEC_CB_PUT_FRAME event is posted
19661+ * for the previously decoded frame.
19662+ * \param[in] data_sz Size of the coded data, in bytes.
19663+ * \param[in] user_priv Application specific data to associate with
19664+ * this frame.
19665+ * \param[in] rel_pts PTS relative to the previous frame, in us. If
19666+ * unknown or unavailable, set to zero.
19667+ *
19668+ * \return Returns #VPX_DEC_OK if the coded data was processed completely
19669+ * and future pictures can be decoded without error. Otherwise,
19670+ * see the descriptions of the other error codes in ::vpx_dec_err_t
19671+ * for recoverability capabilities.
19672+ */
19673+ vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
19674+ uint8_t *data,
19675+ unsigned int data_sz,
19676+ void *user_priv,
19677+ int rel_pts) DEPRECATED;
19678+
19679+
19680+ /*!\brief Decoded frames iterator
19681+ *
19682+ * Iterates over a list of the frames available for display. The iterator
19683+ * storage should be initialized to NULL to start the iteration. Iteration is
19684+ * complete when this function returns NULL.
19685+ *
19686+ * The list of available frames becomes valid upon completion of the
19687+ * vpx_dec_decode call, and remains valid until the next call to vpx_dec_decode.
19688+ *
19689+ * \param[in] ctx Pointer to this instance's context
19690+ * \param[in out] iter Iterator storage, initialized to NULL
19691+ *
19692+ * \return Returns a pointer to an image, if one is ready for display. Frames
19693+ * produced will always be in PTS (presentation time stamp) order.
19694+ */
19695+ vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
19696+ vpx_dec_iter_t *iter) DEPRECATED;
19697+
19698+
19699+ /*!\defgroup cap_put_frame Frame-Based Decoding Functions
19700+ *
19701+ * The following functions are required to be implemented for all decoders
19702+ * that advertise the VPX_DEC_CAP_PUT_FRAME capability. Calling these functions
19703+ * for codecs that don't advertise this capability will result in an error
19704+ * code being returned, usually VPX_DEC_ERROR
19705+ * @{
19706+ */
19707+
19708+ /*!\brief put frame callback prototype
19709+ *
19710+ * This callback is invoked by the decoder to notify the application of
19711+ * the availability of decoded image data.
19712+ */
19713+ typedef void (*vpx_dec_put_frame_cb_fn_t)(void *user_priv,
19714+ const vpx_image_t *img);
19715+
19716+
19717+ /*!\brief Register for notification of frame completion.
19718+ *
19719+ * Registers a given function to be called when a decoded frame is
19720+ * available.
19721+ *
19722+ * \param[in] ctx Pointer to this instance's context
19723+ * \param[in] cb Pointer to the callback function
19724+ * \param[in] user_priv User's private data
19725+ *
19726+ * \retval #VPX_DEC_OK
19727+ * Callback successfully registered.
19728+ * \retval #VPX_DEC_ERROR
19729+ * Decoder context not initialized, or algorithm not capable of
19730+ * posting slice completion.
19731+ */
19732+ vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
19733+ vpx_dec_put_frame_cb_fn_t cb,
19734+ void *user_priv) DEPRECATED;
19735+
19736+
19737+ /*!@} - end defgroup cap_put_frame */
19738+
19739+ /*!\defgroup cap_put_slice Slice-Based Decoding Functions
19740+ *
19741+ * The following functions are required to be implemented for all decoders
19742+ * that advertise the VPX_DEC_CAP_PUT_SLICE capability. Calling these functions
19743+ * for codecs that don't advertise this capability will result in an error
19744+ * code being returned, usually VPX_DEC_ERROR
19745+ * @{
19746+ */
19747+
19748+ /*!\brief put slice callback prototype
19749+ *
19750+ * This callback is invoked by the decoder to notify the application of
19751+ * the availability of partially decoded image data. The
19752+ */
19753+ typedef void (*vpx_dec_put_slice_cb_fn_t)(void *user_priv,
19754+ const vpx_image_t *img,
19755+ const vpx_image_rect_t *valid,
19756+ const vpx_image_rect_t *update);
19757+
19758+
19759+ /*!\brief Register for notification of slice completion.
19760+ *
19761+ * Registers a given function to be called when a decoded slice is
19762+ * available.
19763+ *
19764+ * \param[in] ctx Pointer to this instance's context
19765+ * \param[in] cb Pointer to the callback function
19766+ * \param[in] user_priv User's private data
19767+ *
19768+ * \retval #VPX_DEC_OK
19769+ * Callback successfully registered.
19770+ * \retval #VPX_DEC_ERROR
19771+ * Decoder context not initialized, or algorithm not capable of
19772+ * posting slice completion.
19773+ */
19774+ vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
19775+ vpx_dec_put_slice_cb_fn_t cb,
19776+ void *user_priv) DEPRECATED;
19777+
19778+
19779+ /*!@} - end defgroup cap_put_slice*/
19780+
19781+ /*!\defgroup cap_xma External Memory Allocation Functions
19782+ *
19783+ * The following functions are required to be implemented for all decoders
19784+ * that advertise the VPX_DEC_CAP_XMA capability. Calling these functions
19785+ * for codecs that don't advertise this capability will result in an error
19786+ * code being returned, usually VPX_DEC_ERROR
19787+ * @{
19788+ */
19789+
19790+ /*!\brief Memory Map Entry
19791+ *
19792+ * This structure is used to contain the properties of a memory segment. It
19793+ * is populated by the decoder in the request phase, and by the calling
19794+ * application once the requested allocation has been performed.
19795+ */
19796+#if 1
19797+#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
19798+#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
19799+#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
19800+ typedef struct vpx_codec_mmap vpx_dec_mmap_t;
19801+#else
19802+ typedef struct vpx_dec_mmap
19803+ {
19804+ /*
19805+ * The following members are set by the codec when requesting a segment
19806+ */
19807+ unsigned int id; /**< identifier for the segment's contents */
19808+ unsigned long sz; /**< size of the segment, in bytes */
19809+ unsigned int align; /**< required alignment of the segment, in bytes */
19810+ unsigned int flags; /**< bitfield containing segment properties */
19811+#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
19812+#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
19813+#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
19814+
19815+ /* The following members are to be filled in by the allocation function */
19816+ void *base; /**< pointer to the allocated segment */
19817+ void (*dtor)(struct vpx_dec_mmap *map); /**< destructor to call */
19818+ void *priv; /**< allocator private storage */
19819+ } vpx_dec_mmap_t;
19820+#endif
19821+
19822+ /*!\brief Initialize a decoder instance in external allocation mode
19823+ *
19824+ * Initializes a decoder context using the given interface. Applications
19825+ * should call the vpx_dec_xma_init convenience macro instead of this
19826+ * function directly, to ensure that the ABI version number parameter
19827+ * is properly initialized.
19828+ *
19829+ * \param[in] ctx Pointer to this instance's context.
19830+ * \param[in] iface Pointer to the alogrithm interface to use.
19831+ * \param[in] ver ABI version number. Must be set to
19832+ * VPX_DECODER_ABI_VERSION
19833+ * \retval #VPX_DEC_OK
19834+ * The decoder algorithm initialized.
19835+ * \retval #VPX_DEC_ERROR
19836+ * Decoder does not support XMA mode.
19837+ */
19838+ vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
19839+ vpx_dec_iface_t *iface,
19840+ int ver) DEPRECATED;
19841+#define vpx_dec_xma_init(ctx, iface) \
19842+ vpx_dec_xma_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
19843+
19844+
19845+ /*!\brief Iterate over the list of segments to allocate.
19846+ *
19847+ * Iterates over a list of the segments to allocate. The iterator storage
19848+ * should be initialized to NULL to start the iteration. Iteration is complete
19849+ * when this function returns VPX_DEC_LIST_END. The amount of memory needed to
19850+ * allocate is dependant upon the size of the encoded stream. This means that
19851+ * the stream info structure must be known at allocation time. It can be
19852+ * populated with the vpx_dec_peek_stream_info() function. In cases where the
19853+ * stream to be decoded is not available at allocation time, a fixed size must
19854+ * be requested. The decoder will not be able to decode streams larger than
19855+ * the size used at allocation time.
19856+ *
19857+ * \param[in] ctx Pointer to this instance's context.
19858+ * \param[out] mmap Pointer to the memory map entry to populate.
19859+ * \param[in] si Pointer to the stream info.
19860+ * \param[in out] iter Iterator storage, initialized to NULL
19861+ *
19862+ * \retval #VPX_DEC_OK
19863+ * The memory map entry was populated.
19864+ * \retval #VPX_DEC_ERROR
19865+ * Decoder does not support XMA mode.
19866+ * \retval #VPX_DEC_MEM_ERROR
19867+ * Unable to determine segment size from stream info.
19868+ */
19869+ vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx,
19870+ vpx_dec_mmap_t *mmap,
19871+ const vpx_dec_stream_info_t *si,
19872+ vpx_dec_iter_t *iter) DEPRECATED;
19873+
19874+
19875+ /*!\brief Identify allocated segments to decoder instance
19876+ *
19877+ * Stores a list of allocated segments in the decoder. Segments \ref MUST be
19878+ * passed in the order they are read from vpx_dec_get_mem_map(), but may be
19879+ * passed in groups of any size. Segments \ref MUST be set only once. The
19880+ * allocation function \ref MUST ensure that the vpx_dec_mmap_t::base member
19881+ * is non-NULL. If the segment requires cleanup handling (eg, calling free()
19882+ * or close()) then the vpx_dec_mmap_t::dtor member \ref MUST be populated.
19883+ *
19884+ * \param[in] ctx Pointer to this instance's context.
19885+ * \param[in] mmaps Pointer to the first memory map entry in the list.
19886+ * \param[in] num_maps Number of entries being set at this time
19887+ *
19888+ * \retval #VPX_DEC_OK
19889+ * The segment was stored in the decoder context.
19890+ * \retval #VPX_DEC_ERROR
19891+ * Decoder does not support XMA mode.
19892+ * \retval #VPX_DEC_MEM_ERROR
19893+ * Segment base address was not set, or segment was already stored.
19894+
19895+ */
19896+ vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx,
19897+ vpx_dec_mmap_t *mmaps,
19898+ unsigned int num_maps) DEPRECATED;
19899+
19900+ /*!@} - end defgroup cap_xma*/
19901+ /*!@} - end defgroup decoder*/
19902+
19903+
19904+#endif
19905+#ifdef __cplusplus
19906+}
19907+#endif
19908diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h
19909new file mode 100644
19910index 0000000..8ad7055
19911--- /dev/null
19912+++ b/vpx/vpx_encoder.h
19913@@ -0,0 +1,793 @@
19914+/*
19915+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
19916+ *
19917+ * Use of this source code is governed by a BSD-style license
19918+ * that can be found in the LICENSE file in the root of the source
19919+ * tree. An additional intellectual property rights grant can be found
19920+ * in the file PATENTS. All contributing project authors may
19921+ * be found in the AUTHORS file in the root of the source tree.
19922+ */
19923+
19924+
19925+/*!\defgroup encoder Encoder Algorithm Interface
19926+ * \ingroup codec
19927+ * This abstraction allows applications using this encoder to easily support
19928+ * multiple video formats with minimal code duplication. This section describes
19929+ * the interface common to all encoders.
19930+ * @{
19931+ */
19932+
19933+/*!\file vpx_encoder.h
19934+ * \brief Describes the encoder algorithm interface to applications.
19935+ *
19936+ * This file describes the interface between an application and a
19937+ * video encoder algorithm.
19938+ *
19939+ */
19940+#ifdef __cplusplus
19941+extern "C" {
19942+#endif
19943+
19944+#ifndef VPX_ENCODER_H
19945+#define VPX_ENCODER_H
19946+#include "vpx_codec.h"
19947+
19948+
19949+ /*!\brief Current ABI version number
19950+ *
19951+ * \internal
19952+ * If this file is altered in any way that changes the ABI, this value
19953+ * must be bumped. Examples include, but are not limited to, changing
19954+ * types, removing or reassigning enums, adding/removing/rearranging
19955+ * fields to structures
19956+ */
19957+#define VPX_ENCODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
19958+
19959+
19960+ /*! \brief Encoder capabilities bitfield
19961+ *
19962+ * Each encoder advertises the capabilities it supports as part of its
19963+ * ::vpx_codec_iface_t interface structure. Capabilities are extra
19964+ * interfaces or functionality, and are not required to be supported
19965+ * by an encoder.
19966+ *
19967+ * The available flags are specifiedby VPX_CODEC_CAP_* defines.
19968+ */
19969+#define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */
19970+
19971+
19972+ /*! \brief Initialization-time Feature Enabling
19973+ *
19974+ * Certain codec features must be known at initialization time, to allow
19975+ * for proper memory allocation.
19976+ *
19977+ * The available flags are specified by VPX_CODEC_USE_* defines.
19978+ */
19979+#define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */
19980+
19981+
19982+ /*!\brief Generic fixed size buffer structure
19983+ *
19984+ * This structure is able to hold a reference to any fixed size buffer.
19985+ */
19986+ typedef struct vpx_fixed_buf
19987+ {
19988+ void *buf; /**< Pointer to the data */
19989+ size_t sz; /**< Length of the buffer, in chars */
19990+ } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */
19991+
19992+
19993+ /*!\brief Time Stamp Type
19994+ *
19995+ * An integer, which when multiplied by the stream's time base, provides
19996+ * the absolute time of a sample.
19997+ */
19998+ typedef int64_t vpx_codec_pts_t;
19999+
20000+
20001+ /*!\brief Compressed Frame Flags
20002+ *
20003+ * This type represents a bitfield containing information about a compressed
20004+ * frame that may be useful to an application. The most significant 16 bits
20005+ * can be used by an algorithm to provide additional detail, for example to
20006+ * support frame types that are codec specific (MPEG-1 D-frames for example)
20007+ */
20008+ typedef uint32_t vpx_codec_frame_flags_t;
20009+#define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */
20010+#define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting
20011+ the stream (no future frame depends on
20012+ this one) */
20013+#define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
20014+ be shown */
20015+
20016+
20017+ /*!\brief Encoder output packet variants
20018+ *
20019+ * This enumeration lists the different kinds of data packets that can be
20020+ * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY
20021+ * extend this list to provide additional functionality.
20022+ */
20023+ enum vpx_codec_cx_pkt_kind
20024+ {
20025+ VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */
20026+ VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */
20027+ VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */
20028+ VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */
20029+ };
20030+
20031+
20032+ /*!\brief Encoder output packet
20033+ *
20034+ * This structure contains the different kinds of output data the encoder
20035+ * may produce while compressing a frame.
20036+ */
20037+ typedef struct vpx_codec_cx_pkt
20038+ {
20039+ enum vpx_codec_cx_pkt_kind kind; /**< packet variant */
20040+ union
20041+ {
20042+ struct
20043+ {
20044+ void *buf; /**< compressed data buffer */
20045+ size_t sz; /**< length of compressed data */
20046+ vpx_codec_pts_t pts; /**< time stamp to show frame
20047+ (in timebase units) */
20048+ unsigned long duration; /**< duration to show frame
20049+ (in timebase units) */
20050+ vpx_codec_frame_flags_t flags; /**< flags for this frame */
20051+ } frame; /**< data for compressed frame packet */
20052+ struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */
20053+ struct vpx_psnr_pkt
20054+ {
20055+ unsigned int samples[4]; /**< Number of samples, total/y/u/v */
20056+ uint64_t sse[4]; /**< sum squared error, total/y/u/v */
20057+ double psnr[4]; /**< PSNR, total/y/u/v */
20058+ } psnr; /**< data for PSNR packet */
20059+ struct vpx_fixed_buf raw; /**< data for arbitrary packets */
20060+
20061+ /* This packet size is fixed to allow codecs to extend this
20062+ * interface without having to manage storage for raw packets,
20063+ * ie if it's smaller than 128 bytes, you can store in the
20064+ * packet list directly.
20065+ */
20066+ char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */
20067+ } data; /**< packet data */
20068+ } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */
20069+
20070+
20071+ /*!\brief Rational Number
20072+ *
20073+ * This structure holds a fractional value.
20074+ */
20075+ typedef struct vpx_rational
20076+ {
20077+ int num; /**< fraction numerator */
20078+ int den; /**< fraction denominator */
20079+ } vpx_rational_t; /**< alias for struct vpx_rational */
20080+
20081+
20082+ /*!\brief Multi-pass Encoding Pass */
20083+ enum vpx_enc_pass
20084+ {
20085+ VPX_RC_ONE_PASS, /**< Single pass mode */
20086+ VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */
20087+ VPX_RC_LAST_PASS, /**< Final pass of multi-pass mode */
20088+ };
20089+
20090+
20091+ /*!\brief Rate control mode */
20092+ enum vpx_rc_mode
20093+ {
20094+ VPX_VBR, /**< Variable Bit Rate (VBR) mode */
20095+ VPX_CBR /**< Constant Bit Rate (CBR) mode */
20096+ };
20097+
20098+
20099+ /*!\brief Keyframe placement mode.
20100+ *
20101+ * This enumeration determines whether keyframes are placed automatically by
20102+ * the encoder or whether this behavior is disabled. Older releases of this
20103+ * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
20104+ * This name is confusing for this behavior, so the new symbols to be used
20105+ * are VPX_KF_AUTO and VPX_KF_DISABLED.
20106+ */
20107+ enum vpx_kf_mode
20108+ {
20109+ VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */
20110+ VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */
20111+ VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
20112+ };
20113+
20114+
20115+ /*!\brief Encoded Frame Flags
20116+ *
20117+ * This type indicates a bitfield to be passed to vpx_codec_encode(), defining
20118+ * per-frame boolean values. By convention, bits common to all codecs will be
20119+ * named VPX_EFLAG_*, and bits specific to an algorithm will be named
20120+ * /algo/_eflag_*. The lower order 16 bits are reserved for common use.
20121+ */
20122+ typedef long vpx_enc_frame_flags_t;
20123+#define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */
20124+
20125+
20126+ /*!\brief Encoder configuration structure
20127+ *
20128+ * This structure contains the encoder settings that have common representations
20129+ * across all codecs. This doesn't imply that all codecs support all features,
20130+ * however.
20131+ */
20132+ typedef struct vpx_codec_enc_cfg
20133+ {
20134+ /*
20135+ * generic settings (g)
20136+ */
20137+
20138+ /*!\brief Algorithm specific "usage" value
20139+ *
20140+ * Algorithms may define multiple values for usage, which may convey the
20141+ * intent of how the application intends to use the stream. If this value
20142+ * is non-zero, consult the documentation for the codec to determine its
20143+ * meaning.
20144+ */
20145+ unsigned int g_usage;
20146+
20147+
20148+ /*!\brief Maximum number of threads to use
20149+ *
20150+ * For multi-threaded implementations, use no more than this number of
20151+ * threads. The codec may use fewer threads than allowed. The value
20152+ * 0 is equivalent to the value 1.
20153+ */
20154+ unsigned int g_threads;
20155+
20156+
20157+ /*!\brief Bitstream profile to use
20158+ *
20159+ * Some codecs support a notion of multiple bitstream profiles. Typically
20160+ * this maps to a set of features that are turned on or off. Often the
20161+ * profile to use is determined by the features of the intended decoder.
20162+ * Consult the documentation for the codec to determine the valid values
20163+ * for this parameter, or set to zero for a sane default.
20164+ */
20165+ unsigned int g_profile; /**< profile of bitstream to use */
20166+
20167+
20168+
20169+ /*!\brief Width of the frame
20170+ *
20171+ * This value identifies the presentation resolution of the frame,
20172+ * in pixels. Note that the frames passed as input to the encoder must
20173+ * have this resolution. Frames will be presented by the decoder in this
20174+ * resolution, independent of any spatial resampling the encoder may do.
20175+ */
20176+ unsigned int g_w;
20177+
20178+
20179+ /*!\brief Height of the frame
20180+ *
20181+ * This value identifies the presentation resolution of the frame,
20182+ * in pixels. Note that the frames passed as input to the encoder must
20183+ * have this resolution. Frames will be presented by the decoder in this
20184+ * resolution, independent of any spatial resampling the encoder may do.
20185+ */
20186+ unsigned int g_h;
20187+
20188+
20189+ /*!\brief Stream timebase units
20190+ *
20191+ * Indicates the smallest interval of time, in seconds, used by the stream.
20192+ * For fixed frame rate material, or variable frame rate material where
20193+ * frames are timed at a multiple of a given clock (ex: video capture),
20194+ * the \ref RECOMMENDED method is to set the timebase to the reciprocal
20195+ * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
20196+ * pts to correspond to the frame number, which can be handy. For
20197+ * re-encoding video from containers with absolute time timestamps, the
20198+ * \ref RECOMMENDED method is to set the timebase to that of the parent
20199+ * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
20200+ */
20201+ struct vpx_rational g_timebase;
20202+
20203+
20204+ /*!\brief Enable error resilient mode.
20205+ *
20206+ * Error resilient mode indicates to the encoder that it should take
20207+ * measures appropriate for streaming over lossy or noisy links, if
20208+ * possible. Set to 1 to enable this feature, 0 to disable it.
20209+ */
20210+ unsigned int g_error_resilient;
20211+
20212+
20213+ /*!\brief Multi-pass Encoding Mode
20214+ *
20215+ * This value should be set to the current phase for multi-pass encoding.
20216+ * For single pass, set to #VPX_RC_ONE_PASS.
20217+ */
20218+ enum vpx_enc_pass g_pass;
20219+
20220+
20221+ /*!\brief Allow lagged encoding
20222+ *
20223+ * If set, this value allows the encoder to consume a number of input
20224+ * frames before producing output frames. This allows the encoder to
20225+ * base decisions for the current frame on future frames. This does
20226+ * increase the latency of the encoding pipeline, so it is not appropriate
20227+ * in all situations (ex: realtime encoding).
20228+ *
20229+ * Note that this is a maximum value -- the encoder may produce frames
20230+ * sooner than the given limit. Set this value to 0 to disable this
20231+ * feature.
20232+ */
20233+ unsigned int g_lag_in_frames;
20234+
20235+
20236+ /*
20237+ * rate control settings (rc)
20238+ */
20239+
20240+ /*!\brief Temporal resampling configuration, if supported by the codec.
20241+ *
20242+ * Temporal resampling allows the codec to "drop" frames as a strategy to
20243+ * meet its target data rate. This can cause temporal discontinuities in
20244+ * the encoded video, which may appear as stuttering during playback. This
20245+ * trade-off is often acceptable, but for many applications is not. It can
20246+ * be disabled in these cases.
20247+ *
20248+ * Note that not all codecs support this feature. All vpx VPx codecs do.
20249+ * For other codecs, consult the documentation for that algorithm.
20250+ *
20251+ * This threshold is described as a percentage of the target data buffer.
20252+ * When the data buffer falls below this percentage of fullness, a
20253+ * dropped frame is indicated. Set the threshold to zero (0) to disable
20254+ * this feature.
20255+ */
20256+ unsigned int rc_dropframe_thresh;
20257+
20258+
20259+ /*!\brief Enable/disable spatial resampling, if supported by the codec.
20260+ *
20261+ * Spatial resampling allows the codec to compress a lower resolution
20262+ * version of the frame, which is then upscaled by the encoder to the
20263+ * correct presentation resolution. This increases visual quality at
20264+ * low data rates, at the expense of CPU time on the encoder/decoder.
20265+ */
20266+ unsigned int rc_resize_allowed;
20267+
20268+
20269+ /*!\brief Spatial resampling up watermark.
20270+ *
20271+ * This threshold is described as a percentage of the target data buffer.
20272+ * When the data buffer rises above this percentage of fullness, the
20273+ * encoder will step up to a higher resolution version of the frame.
20274+ */
20275+ unsigned int rc_resize_up_thresh;
20276+
20277+
20278+ /*!\brief Spatial resampling down watermark.
20279+ *
20280+ * This threshold is described as a percentage of the target data buffer.
20281+ * When the data buffer falls below this percentage of fullness, the
20282+ * encoder will step down to a lower resolution version of the frame.
20283+ */
20284+ unsigned int rc_resize_down_thresh;
20285+
20286+
20287+ /*!\brief Rate control algorithm to use.
20288+ *
20289+ * Indicates whether the end usage of this stream is to be streamed over
20290+ * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
20291+ * mode should be used, or whether it will be played back on a high
20292+ * bandwidth link, as from a local disk, where higher variations in
20293+ * bitrate are acceptable.
20294+ */
20295+ enum vpx_rc_mode rc_end_usage;
20296+
20297+
20298+ /*!\brief Two-pass stats buffer.
20299+ *
20300+ * A buffer containing all of the stats packets produced in the first
20301+ * pass, concatenated.
20302+ */
20303+ struct vpx_fixed_buf rc_twopass_stats_in;
20304+
20305+
20306+ /*!\brief Target data rate
20307+ *
20308+ * Target bandwidth to use for this stream, in kilobits per second.
20309+ */
20310+ unsigned int rc_target_bitrate;
20311+
20312+
20313+ /*
20314+ * quantizer settings
20315+ */
20316+
20317+
20318+ /*!\brief Minimum (Best Quality) Quantizer
20319+ *
20320+ * The quantizer is the most direct control over the quality of the
20321+ * encoded image. The range of valid values for the quantizer is codec
20322+ * specific. Consult the documentation for the codec to determine the
20323+ * values to use. To determine the range programmatically, call
20324+ * vpx_codec_enc_config_default() with a usage value of 0.
20325+ */
20326+ unsigned int rc_min_quantizer;
20327+
20328+
20329+ /*!\brief Maximum (Worst Quality) Quantizer
20330+ *
20331+ * The quantizer is the most direct control over the quality of the
20332+ * encoded image. The range of valid values for the quantizer is codec
20333+ * specific. Consult the documentation for the codec to determine the
20334+ * values to use. To determine the range programmatically, call
20335+ * vpx_codec_enc_config_default() with a usage value of 0.
20336+ */
20337+ unsigned int rc_max_quantizer;
20338+
20339+
20340+ /*
20341+ * bitrate tolerance
20342+ */
20343+
20344+
20345+ /*!\brief Rate control undershoot tolerance
20346+ *
20347+ * This value, expressed as a percentage of the target bitrate, describes
20348+ * the target bitrate for easier frames, allowing bits to be saved for
20349+ * harder frames. Set to zero to use the codec default.
20350+ */
20351+ unsigned int rc_undershoot_pct;
20352+
20353+
20354+ /*!\brief Rate control overshoot tolerance
20355+ *
20356+ * This value, expressed as a percentage of the target bitrate, describes
20357+ * the maximum allowed bitrate for a given frame. Set to zero to use the
20358+ * codec default.
20359+ */
20360+ unsigned int rc_overshoot_pct;
20361+
20362+
20363+ /*
20364+ * decoder buffer model parameters
20365+ */
20366+
20367+
20368+ /*!\brief Decoder Buffer Size
20369+ *
20370+ * This value indicates the amount of data that may be buffered by the
20371+ * decoding application. Note that this value is expressed in units of
20372+ * time (milliseconds). For example, a value of 5000 indicates that the
20373+ * client will buffer (at least) 5000ms worth of encoded data. Use the
20374+ * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
20375+ * necessary.
20376+ */
20377+ unsigned int rc_buf_sz;
20378+
20379+
20380+ /*!\brief Decoder Buffer Initial Size
20381+ *
20382+ * This value indicates the amount of data that will be buffered by the
20383+ * decoding application prior to beginning playback. This value is
20384+ * expressed in units of time (milliseconds). Use the target bitrate
20385+ * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
20386+ */
20387+ unsigned int rc_buf_initial_sz;
20388+
20389+
20390+ /*!\brief Decoder Buffer Optimal Size
20391+ *
20392+ * This value indicates the amount of data that the encoder should try
20393+ * to maintain in the decoder's buffer. This value is expressed in units
20394+ * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
20395+ * to convert to bits/bytes, if necessary.
20396+ */
20397+ unsigned int rc_buf_optimal_sz;
20398+
20399+
20400+ /*
20401+ * 2 pass rate control parameters
20402+ */
20403+
20404+
20405+ /*!\brief Two-pass mode CBR/VBR bias
20406+ *
20407+ * Bias, expressed on a scale of 0 to 100, for determining target size
20408+ * for the current frame. The value 0 indicates the optimal CBR mode
20409+ * value should be used. The value 100 indicates the optimal VBR mode
20410+ * value should be used. Values in between indicate which way the
20411+ * encoder should "lean."
20412+ */
20413+ unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias between CBR and VBR(0-100: 0->CBR, 100->VBR) */
20414+
20415+
20416+ /*!\brief Two-pass mode per-GOP minimum bitrate
20417+ *
20418+ * This value, expressed as a percentage of the target bitrate, indicates
20419+ * the minimum bitrate to be used for a single GOP (aka "section")
20420+ */
20421+ unsigned int rc_2pass_vbr_minsection_pct;
20422+
20423+
20424+ /*!\brief Two-pass mode per-GOP maximum bitrate
20425+ *
20426+ * This value, expressed as a percentage of the target bitrate, indicates
20427+ * the maximum bitrate to be used for a single GOP (aka "section")
20428+ */
20429+ unsigned int rc_2pass_vbr_maxsection_pct;
20430+
20431+
20432+ /*
20433+ * keyframing settings (kf)
20434+ */
20435+
20436+ /*!\brief Keyframe placement mode
20437+ *
20438+ * This value indicates whether the encoder should place keyframes at a
20439+ * fixed interval, or determine the optimal placement automatically
20440+ * (as governed by the #kf_min_dist and #kf_max_dist parameters)
20441+ */
20442+ enum vpx_kf_mode kf_mode;
20443+
20444+
20445+ /*!\brief Keyframe minimum interval
20446+ *
20447+ * This value, expressed as a number of frames, prevents the encoder from
20448+ * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
20449+ * least kf_min_dist frames non-keyframes will be coded before the next
20450+ * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
20451+ */
20452+ unsigned int kf_min_dist;
20453+
20454+
20455+ /*!\brief Keyframe maximum interval
20456+ *
20457+ * This value, expressed as a number of frames, forces the encoder to code
20458+ * a keyframe if one has not been coded in the last kf_max_dist frames.
20459+ * A value of 0 implies all frames will be keyframes. Set kf_min_dist
20460+ * equal to kf_max_dist for a fixed interval.
20461+ */
20462+ unsigned int kf_max_dist;
20463+
20464+ } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */
20465+
20466+
20467+ /*!\brief Initialize an encoder instance
20468+ *
20469+ * Initializes a encoder context using the given interface. Applications
20470+ * should call the vpx_codec_enc_init convenience macro instead of this
20471+ * function directly, to ensure that the ABI version number parameter
20472+ * is properly initialized.
20473+ *
20474+ * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
20475+ * parameter), the storage pointed to by the cfg parameter must be
20476+ * kept readable and stable until all memory maps have been set.
20477+ *
20478+ * \param[in] ctx Pointer to this instance's context.
20479+ * \param[in] iface Pointer to the algorithm interface to use.
20480+ * \param[in] cfg Configuration to use, if known. May be NULL.
20481+ * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
20482+ * \param[in] ver ABI version number. Must be set to
20483+ * VPX_ENCODER_ABI_VERSION
20484+ * \retval #VPX_CODEC_OK
20485+ * The decoder algorithm initialized.
20486+ * \retval #VPX_CODEC_MEM_ERROR
20487+ * Memory allocation failed.
20488+ */
20489+ vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
20490+ vpx_codec_iface_t *iface,
20491+ vpx_codec_enc_cfg_t *cfg,
20492+ vpx_codec_flags_t flags,
20493+ int ver);
20494+
20495+
20496+ /*!\brief Convenience macro for vpx_codec_enc_init_ver()
20497+ *
20498+ * Ensures the ABI version parameter is properly set.
20499+ */
20500+#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
20501+ vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
20502+
20503+
20504+ /*!\brief Get a default configuration
20505+ *
20506+ * Initializes a encoder configuration structure with default values. Supports
20507+ * the notion of "usages" so that an algorithm may offer different default
20508+ * settings depending on the user's intended goal. This function \ref SHOULD
20509+ * be called by all applications to initialize the configuration structure
20510+ * before specializing the configuration with application specific values.
20511+ *
20512+ * \param[in] iface Pointer to the algorithm interface to use.
20513+ * \param[out] cfg Configuration buffer to populate
20514+ * \param[in] usage End usage. Set to 0 or use codec specific values.
20515+ *
20516+ * \retval #VPX_CODEC_OK
20517+ * The configuration was populated.
20518+ * \retval #VPX_CODEC_INCAPABLE
20519+ * Interface is not an encoder interface.
20520+ * \retval #VPX_CODEC_INVALID_PARAM
20521+ * A parameter was NULL, or the usage value was not recognized.
20522+ */
20523+ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
20524+ vpx_codec_enc_cfg_t *cfg,
20525+ unsigned int usage);
20526+
20527+
20528+ /*!\brief Set or change configuration
20529+ *
20530+ * Reconfigures an encoder instance according to the given configuration.
20531+ *
20532+ * \param[in] ctx Pointer to this instance's context
20533+ * \param[in] cfg Configuration buffer to use
20534+ *
20535+ * \retval #VPX_CODEC_OK
20536+ * The configuration was populated.
20537+ * \retval #VPX_CODEC_INCAPABLE
20538+ * Interface is not an encoder interface.
20539+ * \retval #VPX_CODEC_INVALID_PARAM
20540+ * A parameter was NULL, or the usage value was not recognized.
20541+ */
20542+ vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
20543+ const vpx_codec_enc_cfg_t *cfg);
20544+
20545+
20546+ /*!\brief Get global stream headers
20547+ *
20548+ * Retrieves a stream level global header packet, if supported by the codec.
20549+ *
20550+ * \param[in] ctx Pointer to this instance's context
20551+ *
20552+ * \retval NULL
20553+ * Encoder does not support global header
20554+ * \retval Non-NULL
20555+ * Pointer to buffer containing global header packet
20556+ */
20557+ vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx);
20558+
20559+
20560+#define VPX_DL_REALTIME (1) /**< deadline parameter analogous to
20561+ * VPx REALTIME mode. */
20562+#define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to
20563+ * VPx GOOD QUALITY mode. */
20564+#define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to
20565+ * VPx BEST QUALITY mode. */
20566+ /*!\brief Encode a frame
20567+ *
20568+ * Encodes a video frame at the given "presentation time." The presentation
20569+ * time stamp (PTS) \ref MUST be strictly increasing.
20570+ *
20571+ * The encoder supports the notion of a soft real-time deadline. Given a
20572+ * non-zero value to the deadline parameter, the encoder will make a "best
20573+ * effort" guarantee to return before the given time slice expires. It is
20574+ * implicit that limiting the available time to encode will degrade the
20575+ * output quality. The encoder can be given an unlimited time to produce the
20576+ * best possible frame by specifying a deadline of '0'. This deadline
20577+ * supercedes the VPx notion of "best quality, good quality, realtime".
20578+ * Applications that wish to map these former settings to the new deadline
20579+ * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
20580+ * and #VPX_DL_BEST_QUALITY.
20581+ *
20582+ * When the last frame has been passed to the encoder, this function should
20583+ * continue to be called, with the img parameter set to NULL. This will
20584+ * signal the end-of-stream condition to the encoder and allow it to encode
20585+ * any held buffers. Encoding is complete when vpx_codec_encode() is called
20586+ * and vpx_codec_get_cx_data() returns no data.
20587+ *
20588+ * \param[in] ctx Pointer to this instance's context
20589+ * \param[in] img Image data to encode, NULL to flush.
20590+ * \param[in] pts Presentation time stamp, in timebase units.
20591+ * \param[in] duration Duration to show frame, in timebase units.
20592+ * \param[in] flags Flags to use for encoding this frame.
20593+ * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
20594+ *
20595+ * \retval #VPX_CODEC_OK
20596+ * The configuration was populated.
20597+ * \retval #VPX_CODEC_INCAPABLE
20598+ * Interface is not an encoder interface.
20599+ * \retval #VPX_CODEC_INVALID_PARAM
20600+ * A parameter was NULL, the image format is unsupported, etc.
20601+ */
20602+ vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
20603+ const vpx_image_t *img,
20604+ vpx_codec_pts_t pts,
20605+ unsigned long duration,
20606+ vpx_enc_frame_flags_t flags,
20607+ unsigned long deadline);
20608+
20609+
20610+ /*!\brief Set compressed data output buffer
20611+ *
20612+ * Sets the buffer that the codec should output the compressed data
20613+ * into. This call effectively sets the buffer pointer returned in the
20614+ * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be
20615+ * appended into this buffer. The buffer is preserved across frames,
20616+ * so applications must periodically call this function after flushing
20617+ * the accumulated compressed data to disk or to the network to reset
20618+ * the pointer to the buffer's head.
20619+ *
20620+ * `pad_before` bytes will be skipped before writing the compressed
20621+ * data, and `pad_after` bytes will be appended to the packet. The size
20622+ * of the packet will be the sum of the size of the actual compressed
20623+ * data, pad_before, and pad_after. The padding bytes will be preserved
20624+ * (not overwritten).
20625+ *
20626+ * Note that calling this function does not guarantee that the returned
20627+ * compressed data will be placed into the specified buffer. In the
20628+ * event that the encoded data will not fit into the buffer provided,
20629+ * the returned packet \ref MAY point to an internal buffer, as it would
20630+ * if this call were never used. In this event, the output packet will
20631+ * NOT have any padding, and the application must free space and copy it
20632+ * to the proper place. This is of particular note in configurations
20633+ * that may output multiple packets for a single encoded frame (e.g., lagged
20634+ * encoding) or if the application does not reset the buffer periodically.
20635+ *
20636+ * Applications may restore the default behavior of the codec providing
20637+ * the compressed data buffer by calling this function with a NULL
20638+ * buffer.
20639+ *
20640+ * Applications \ref MUSTNOT call this function during iteration of
20641+ * vpx_codec_get_cx_data().
20642+ *
20643+ * \param[in] ctx Pointer to this instance's context
20644+ * \param[in] buf Buffer to store compressed data into
20645+ * \param[in] pad_before Bytes to skip before writing compressed data
20646+ * \param[in] pad_after Bytes to skip after writing compressed data
20647+ *
20648+ * \retval #VPX_CODEC_OK
20649+ * The buffer was set successfully.
20650+ * \retval #VPX_CODEC_INVALID_PARAM
20651+ * A parameter was NULL, the image format is unsupported, etc.
20652+ */
20653+ vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
20654+ const vpx_fixed_buf_t *buf,
20655+ unsigned int pad_before,
20656+ unsigned int pad_after);
20657+
20658+
20659+ /*!\brief Encoded data iterator
20660+ *
20661+ * Iterates over a list of data packets to be passed from the encoder to the
20662+ * application. The different kinds of packets available are enumerated in
20663+ * #vpx_codec_cx_pkt_kind.
20664+ *
20665+ * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's
20666+ * muxer. Multiple compressed frames may be in the list.
20667+ * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer.
20668+ *
20669+ * The application \ref MUST silently ignore any packet kinds that it does
20670+ * not recognize or support.
20671+ *
20672+ * The data buffers returned from this function are only guaranteed to be
20673+ * valid until the application makes another call to any vpx_codec_* function.
20674+ *
20675+ * \param[in] ctx Pointer to this instance's context
20676+ * \param[in,out] iter Iterator storage, initialized to NULL
20677+ *
20678+ * \return Returns a pointer to an output data packet (compressed frame data,
20679+ * two-pass statistics, etc.) or NULL to signal end-of-list.
20680+ *
20681+ */
20682+ const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
20683+ vpx_codec_iter_t *iter);
20684+
20685+
20686+ /*!\brief Get Preview Frame
20687+ *
20688+ * Returns an image that can be used as a preview. Shows the image as it would
20689+ * exist at the decompressor. The application \ref MUST NOT write into this
20690+ * image buffer.
20691+ *
20692+ * \param[in] ctx Pointer to this instance's context
20693+ *
20694+ * \return Returns a pointer to a preview image, or NULL if no image is
20695+ * available.
20696+ *
20697+ */
20698+ const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx);
20699+
20700+
20701+ /*!@} - end defgroup encoder*/
20702+
20703+#endif
20704+#ifdef __cplusplus
20705+}
20706+#endif
20707diff --git a/vpx/vpx_image.h b/vpx/vpx_image.h
20708new file mode 100644
20709index 0000000..7e4a03a
20710--- /dev/null
20711+++ b/vpx/vpx_image.h
20712@@ -0,0 +1,242 @@
20713+/*
20714+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
20715+ *
20716+ * Use of this source code is governed by a BSD-style license
20717+ * that can be found in the LICENSE file in the root of the source
20718+ * tree. An additional intellectual property rights grant can be found
20719+ * in the file PATENTS. All contributing project authors may
20720+ * be found in the AUTHORS file in the root of the source tree.
20721+ */
20722+
20723+
20724+/*!\file vpx_image.h
20725+ * \brief Describes the vpx image descriptor and associated operations
20726+ *
20727+ */
20728+#ifdef __cplusplus
20729+extern "C" {
20730+#endif
20731+
20732+#ifndef VPX_IMAGE_H
20733+#define VPX_IMAGE_H
20734+
20735+ /*!\brief Current ABI version number
20736+ *
20737+ * \internal
20738+ * If this file is altered in any way that changes the ABI, this value
20739+ * must be bumped. Examples include, but are not limited to, changing
20740+ * types, removing or reassigning enums, adding/removing/rearranging
20741+ * fields to structures
20742+ */
20743+#define VPX_IMAGE_ABI_VERSION (1) /**<\hideinitializer*/
20744+
20745+
20746+#define VPX_IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
20747+#define VPX_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
20748+#define VPX_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel componnent */
20749+
20750+
20751+ /*!\brief List of supported image formats */
20752+ typedef enum vpx_img_fmt {
20753+ VPX_IMG_FMT_NONE,
20754+ VPX_IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
20755+ VPX_IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
20756+ VPX_IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
20757+ VPX_IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
20758+ VPX_IMG_FMT_UYVY, /**< UYVY packed YUV */
20759+ VPX_IMG_FMT_YUY2, /**< YUYV packed YUV */
20760+ VPX_IMG_FMT_YVYU, /**< YVYU packed YUV */
20761+ VPX_IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
20762+ VPX_IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
20763+ VPX_IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
20764+ VPX_IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
20765+ VPX_IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
20766+ VPX_IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
20767+ VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
20768+ VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
20769+ VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
20770+ VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4, /** < planar 4:2:0 format with vpx color space */
20771+ }
20772+ vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */
20773+
20774+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
20775+#define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR /**< \deprecated Use #VPX_IMG_FMT_PLANAR */
20776+#define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP /**< \deprecated Use #VPX_IMG_FMT_UV_FLIP */
20777+#define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA /**< \deprecated Use #VPX_IMG_FMT_HAS_ALPHA */
20778+
20779+ /*!\brief Deprecated list of supported image formats
20780+ * \deprecated New code should use #vpx_img_fmt
20781+ */
20782+#define img_fmt vpx_img_fmt
20783+ /*!\brief alias for enum img_fmt.
20784+ * \deprecated New code should use #vpx_img_fmt_t
20785+ */
20786+#define img_fmt_t vpx_img_fmt_t
20787+
20788+#define IMG_FMT_NONE VPX_IMG_FMT_NONE /**< \deprecated Use #VPX_IMG_FMT_NONE */
20789+#define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24 /**< \deprecated Use #VPX_IMG_FMT_RGB24 */
20790+#define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32 /**< \deprecated Use #VPX_IMG_FMT_RGB32 */
20791+#define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565 /**< \deprecated Use #VPX_IMG_FMT_RGB565 */
20792+#define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555 /**< \deprecated Use #VPX_IMG_FMT_RGB555 */
20793+#define IMG_FMT_UYVY VPX_IMG_FMT_UYVY /**< \deprecated Use #VPX_IMG_FMT_UYVY */
20794+#define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2 /**< \deprecated Use #VPX_IMG_FMT_YUY2 */
20795+#define IMG_FMT_YVYU VPX_IMG_FMT_YVYU /**< \deprecated Use #VPX_IMG_FMT_YVYU */
20796+#define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24 /**< \deprecated Use #VPX_IMG_FMT_BGR24 */
20797+#define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE /**< \deprecated Use #VPX_IMG_FMT_RGB32_LE */
20798+#define IMG_FMT_ARGB VPX_IMG_FMT_ARGB /**< \deprecated Use #VPX_IMG_FMT_ARGB */
20799+#define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE /**< \deprecated Use #VPX_IMG_FMT_ARGB_LE */
20800+#define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE /**< \deprecated Use #VPX_IMG_FMT_RGB565_LE */
20801+#define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE /**< \deprecated Use #VPX_IMG_FMT_RGB555_LE */
20802+#define IMG_FMT_YV12 VPX_IMG_FMT_YV12 /**< \deprecated Use #VPX_IMG_FMT_YV12 */
20803+#define IMG_FMT_I420 VPX_IMG_FMT_I420 /**< \deprecated Use #VPX_IMG_FMT_I420 */
20804+#define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12 /**< \deprecated Use #VPX_IMG_FMT_VPXYV12 */
20805+#define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420 /**< \deprecated Use #VPX_IMG_FMT_VPXI420 */
20806+#endif /* VPX_CODEC_DISABLE_COMPAT */
20807+
20808+ /**\brief Image Descriptor */
20809+ typedef struct vpx_image
20810+ {
20811+ vpx_img_fmt_t fmt; /**< Image Format */
20812+
20813+ /* Image storage dimensions */
20814+ unsigned int w; /**< Stored image width */
20815+ unsigned int h; /**< Stored image height */
20816+
20817+ /* Image display dimensions */
20818+ unsigned int d_w; /**< Displayed image width */
20819+ unsigned int d_h; /**< Displayed image height */
20820+
20821+ /* Chroma subsampling info */
20822+ unsigned int x_chroma_shift; /**< subsampling order, X */
20823+ unsigned int y_chroma_shift; /**< subsampling order, Y */
20824+
20825+ /* Image data pointers. */
20826+#define VPX_PLANE_PACKED 0 /**< To be used for all packed formats */
20827+#define VPX_PLANE_Y 0 /**< Y (Luminance) plane */
20828+#define VPX_PLANE_U 1 /**< U (Chroma) plane */
20829+#define VPX_PLANE_V 2 /**< V (Chroma) plane */
20830+#define VPX_PLANE_ALPHA 3 /**< A (Transparancy) plane */
20831+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
20832+#define PLANE_PACKED VPX_PLANE_PACKED
20833+#define PLANE_Y VPX_PLANE_Y
20834+#define PLANE_U VPX_PLANE_U
20835+#define PLANE_V VPX_PLANE_V
20836+#define PLANE_ALPHA VPX_PLANE_ALPHA
20837+#endif
20838+ unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
20839+ int stride[4]; /**< stride between rows for each plane */
20840+
20841+ int bps; /**< bits per sample (for packed formats) */
20842+
20843+ /* The following member may be set by the application to associate data
20844+ * with this image.
20845+ */
20846+ void *user_priv; /**< may be set by the application to associate data
20847+ * with this image. */
20848+
20849+ /* The following members should be treated as private. */
20850+ unsigned char *img_data; /**< private */
20851+ int img_data_owner; /**< private */
20852+ int self_allocd; /**< private */
20853+ } vpx_image_t; /**< alias for struct vpx_image */
20854+
20855+ /**\brief Representation of a rectangle on a surface */
20856+ typedef struct vpx_image_rect
20857+ {
20858+ unsigned int x; /**< leftmost column */
20859+ unsigned int y; /**< topmost row */
20860+ unsigned int w; /**< width */
20861+ unsigned int h; /**< height */
20862+ } vpx_image_rect_t; /**< alias for struct vpx_image_rect */
20863+
20864+ /*!\brief Open a descriptor, allocating storage for the underlying image
20865+ *
20866+ * Returns a descriptor for storing an image of the given format. The
20867+ * storage for the descriptor is allocated on the heap.
20868+ *
20869+ * \param[in] img Pointer to storage for descriptor. If this parameter
20870+ * is NULL, the storage for the descriptor will be
20871+ * allocated on the heap.
20872+ * \param[in] fmt Format for the image
20873+ * \param[in] d_w Width of the image
20874+ * \param[in] d_h Height of the image
20875+ * \param[in] align Alignment, in bytes, of each row in the image.
20876+ *
20877+ * \return Returns a pointer to the initialized image descriptor. If the img
20878+ * parameter is non-null, the value of the img parameter will be
20879+ * returned.
20880+ */
20881+ vpx_image_t *vpx_img_alloc(vpx_image_t *img,
20882+ vpx_img_fmt_t fmt,
20883+ unsigned int d_w,
20884+ unsigned int d_h,
20885+ unsigned int align);
20886+
20887+ /*!\brief Open a descriptor, using existing storage for the underlying image
20888+ *
20889+ * Returns a descriptor for storing an image of the given format. The
20890+ * storage for descriptor has been allocated elsewhere, and a descriptor is
20891+ * desired to "wrap" that storage.
20892+ *
20893+ * \param[in] img Pointer to storage for descriptor. If this parameter
20894+ * is NULL, the storage for the descriptor will be
20895+ * allocated on the heap.
20896+ * \param[in] fmt Format for the image
20897+ * \param[in] d_w Width of the image
20898+ * \param[in] d_h Height of the image
20899+ * \param[in] align Alignment, in bytes, of each row in the image.
20900+ * \param[in] img_data Storage to use for the image
20901+ *
20902+ * \return Returns a pointer to the initialized image descriptor. If the img
20903+ * parameter is non-null, the value of the img parameter will be
20904+ * returned.
20905+ */
20906+ vpx_image_t *vpx_img_wrap(vpx_image_t *img,
20907+ vpx_img_fmt_t fmt,
20908+ unsigned int d_w,
20909+ unsigned int d_h,
20910+ unsigned int align,
20911+ unsigned char *img_data);
20912+
20913+
20914+ /*!\brief Set the rectangle identifying the displayed portion of the image
20915+ *
20916+ * Updates the displayed rectangle (aka viewport) on the image surface to
20917+ * match the specified coordinates and size.
20918+ *
20919+ * \param[in] img Image descriptor
20920+ * \param[in] x leftmost column
20921+ * \param[in] y topmost row
20922+ * \param[in] w width
20923+ * \param[in] h height
20924+ *
20925+ * \return 0 if the requested rectangle is valid, nonzero otherwise.
20926+ */
20927+ int vpx_img_set_rect(vpx_image_t *img,
20928+ unsigned int x,
20929+ unsigned int y,
20930+ unsigned int w,
20931+ unsigned int h);
20932+
20933+
20934+ /*!\brief Flip the image vertically (top for bottom)
20935+ *
20936+ * Adjusts the image descriptor's pointers and strides to make the image
20937+ * be referenced upside-down.
20938+ *
20939+ * \param[in] img Image descriptor
20940+ */
20941+ void vpx_img_flip(vpx_image_t *img);
20942+
20943+ /*!\brief Close an image descriptor
20944+ *
20945+ * Frees all allocated storage associated with an image descriptor.
20946+ *
20947+ * \param[in] img Image descriptor
20948+ */
20949+ void vpx_img_free(vpx_image_t *img);
20950+
20951+#endif
20952+#ifdef __cplusplus
20953+}
20954+#endif
20955diff --git a/vpx/vpx_integer.h b/vpx/vpx_integer.h
20956new file mode 100644
20957index 0000000..f06c641
20958--- /dev/null
20959+++ b/vpx/vpx_integer.h
20960@@ -0,0 +1,57 @@
20961+/*
20962+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
20963+ *
20964+ * Use of this source code is governed by a BSD-style license
20965+ * that can be found in the LICENSE file in the root of the source
20966+ * tree. An additional intellectual property rights grant can be found
20967+ * in the file PATENTS. All contributing project authors may
20968+ * be found in the AUTHORS file in the root of the source tree.
20969+ */
20970+
20971+
20972+#ifndef VPX_INTEGER_H
20973+#define VPX_INTEGER_H
20974+
20975+/* get ptrdiff_t, size_t, wchar_t, NULL */
20976+#include <stddef.h>
20977+
20978+#if defined(_MSC_VER) || defined(VPX_EMULATE_INTTYPES)
20979+typedef signed char int8_t;
20980+typedef signed short int16_t;
20981+typedef signed int int32_t;
20982+
20983+typedef unsigned char uint8_t;
20984+typedef unsigned short uint16_t;
20985+typedef unsigned int uint32_t;
20986+
20987+#if defined(_MSC_VER)
20988+typedef signed __int64 int64_t;
20989+typedef unsigned __int64 uint64_t;
20990+#define PRId64 "I64d"
20991+#endif
20992+
20993+#ifdef HAVE_ARMV6
20994+typedef unsigned int int_fast16_t;
20995+#else
20996+typedef signed short int_fast16_t;
20997+#endif
20998+typedef signed char int_fast8_t;
20999+typedef unsigned char uint_fast8_t;
21000+
21001+#ifndef _UINTPTR_T_DEFINED
21002+typedef unsigned int uintptr_t;
21003+#endif
21004+
21005+#else
21006+
21007+/* Most platforms have the C99 standard integer types. */
21008+
21009+#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
21010+#define __STDC_FORMAT_MACROS
21011+#endif
21012+#include <stdint.h>
21013+#include <inttypes.h>
21014+
21015+#endif
21016+
21017+#endif
21018diff --git a/vpx_codec/exports b/vpx_codec/exports
21019deleted file mode 100644
21020index f5e7473..0000000
21021--- a/vpx_codec/exports
21022+++ /dev/null
21023@@ -1,17 +0,0 @@
21024-text vpx_dec_control
21025-text vpx_dec_decode
21026-text vpx_dec_destroy
21027-text vpx_dec_err_to_string
21028-text vpx_dec_error
21029-text vpx_dec_error_detail
21030-text vpx_dec_get_caps
21031-text vpx_dec_get_frame
21032-text vpx_dec_get_mem_map
21033-text vpx_dec_get_stream_info
21034-text vpx_dec_iface_name
21035-text vpx_dec_init_ver
21036-text vpx_dec_peek_stream_info
21037-text vpx_dec_register_put_frame_cb
21038-text vpx_dec_register_put_slice_cb
21039-text vpx_dec_set_mem_map
21040-text vpx_dec_xma_init_ver
21041diff --git a/vpx_codec/internal/vpx_codec_internal.h b/vpx_codec/internal/vpx_codec_internal.h
21042deleted file mode 100644
21043index 0867552..0000000
21044--- a/vpx_codec/internal/vpx_codec_internal.h
21045+++ /dev/null
21046@@ -1,457 +0,0 @@
21047-/*
21048- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
21049- *
21050- * Use of this source code is governed by a BSD-style license and patent
21051- * grant that can be found in the LICENSE file in the root of the source
21052- * tree. All contributing project authors may be found in the AUTHORS
21053- * file in the root of the source tree.
21054- */
21055-
21056-
21057-/*!\file decoder_impl.h
21058- * \brief Describes the decoder algorithm interface for algorithm
21059- * implementations.
21060- *
21061- * This file defines the private structures and data types that are only
21062- * relevant to implementing an algorithm, as opposed to using it.
21063- *
21064- * To create a decoder algorithm class, an interface structure is put
21065- * into the global namespace:
21066- * <pre>
21067- * my_codec.c:
21068- * vpx_codec_iface_t my_codec = {
21069- * "My Codec v1.0",
21070- * VPX_CODEC_ALG_ABI_VERSION,
21071- * ...
21072- * };
21073- * </pre>
21074- *
21075- * An application instantiates a specific decoder instance by using
21076- * vpx_codec_init() and a pointer to the algorithm's interface structure:
21077- * <pre>
21078- * my_app.c:
21079- * extern vpx_codec_iface_t my_codec;
21080- * {
21081- * vpx_codec_ctx_t algo;
21082- * res = vpx_codec_init(&algo, &my_codec);
21083- * }
21084- * </pre>
21085- *
21086- * Once initialized, the instance is manged using other functions from
21087- * the vpx_codec_* family.
21088- */
21089-#ifndef VPX_CODEC_INTERNAL_H
21090-#define VPX_CODEC_INTERNAL_H
21091-#include "../vpx_decoder.h"
21092-#include "../vpx_encoder.h"
21093-#include <stdarg.h>
21094-
21095-
21096-/*!\brief Current ABI version number
21097- *
21098- * \internal
21099- * If this file is altered in any way that changes the ABI, this value
21100- * must be bumped. Examples include, but are not limited to, changing
21101- * types, removing or reassigning enums, adding/removing/rearranging
21102- * fields to structures
21103- */
21104-#define VPX_CODEC_INTERNAL_ABI_VERSION (2) /**<\hideinitializer*/
21105-
21106-typedef struct vpx_codec_alg_priv vpx_codec_alg_priv_t;
21107-
21108-/*!\brief init function pointer prototype
21109- *
21110- * Performs algorithm-specific initialization of the decoder context. This
21111- * function is called by the generic vpx_codec_init() wrapper function, so
21112- * plugins implementing this interface may trust the input parameters to be
21113- * properly initialized.
21114- *
21115- * \param[in] ctx Pointer to this instance's context
21116- * \retval #VPX_CODEC_OK
21117- * The input stream was recognized and decoder initialized.
21118- * \retval #VPX_CODEC_MEM_ERROR
21119- * Memory operation failed.
21120- */
21121-typedef vpx_codec_err_t (*vpx_codec_init_fn_t)(vpx_codec_ctx_t *ctx);
21122-
21123-/*!\brief destroy function pointer prototype
21124- *
21125- * Performs algorithm-specific destruction of the decoder context. This
21126- * function is called by the generic vpx_codec_destroy() wrapper function,
21127- * so plugins implementing this interface may trust the input parameters
21128- * to be properly initialized.
21129- *
21130- * \param[in] ctx Pointer to this instance's context
21131- * \retval #VPX_CODEC_OK
21132- * The input stream was recognized and decoder initialized.
21133- * \retval #VPX_CODEC_MEM_ERROR
21134- * Memory operation failed.
21135- */
21136-typedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);
21137-
21138-/*!\brief parse stream info function pointer prototype
21139- *
21140- * Performs high level parsing of the bitstream. This function is called by
21141- * the generic vpx_codec_parse_stream() wrapper function, so plugins implementing
21142- * this interface may trust the input parameters to be properly initialized.
21143- *
21144- * \param[in] data Pointer to a block of data to parse
21145- * \param[in] data_sz Size of the data buffer
21146- * \param[in,out] si Pointer to stream info to update. The size member
21147- * \ref MUST be properly initialized, but \ref MAY be
21148- * clobbered by the algorithm. This parameter \ref MAY
21149- * be NULL.
21150- *
21151- * \retval #VPX_CODEC_OK
21152- * Bitstream is parsable and stream information updated
21153- */
21154-typedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t *data,
21155- unsigned int data_sz,
21156- vpx_codec_stream_info_t *si);
21157-
21158-/*!\brief Return information about the current stream.
21159- *
21160- * Returns information about the stream that has been parsed during decoding.
21161- *
21162- * \param[in] ctx Pointer to this instance's context
21163- * \param[in,out] si Pointer to stream info to update. The size member
21164- * \ref MUST be properly initialized, but \ref MAY be
21165- * clobbered by the algorithm. This parameter \ref MAY
21166- * be NULL.
21167- *
21168- * \retval #VPX_CODEC_OK
21169- * Bitstream is parsable and stream information updated
21170- */
21171-typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t *ctx,
21172- vpx_codec_stream_info_t *si);
21173-
21174-/*!\brief control function pointer prototype
21175- *
21176- * This function is used to exchange algorithm specific data with the decoder
21177- * instance. This can be used to implement features specific to a particular
21178- * algorithm.
21179- *
21180- * This function is called by the generic vpx_codec_control() wrapper
21181- * function, so plugins implementing this interface may trust the input
21182- * parameters to be properly initialized. However, this interface does not
21183- * provide type safety for the exchanged data or assign meanings to the
21184- * control codes. Those details should be specified in the algorithm's
21185- * header file. In particular, the ctrl_id parameter is guaranteed to exist
21186- * in the algorithm's control mapping table, and the data paramter may be NULL.
21187- *
21188- *
21189- * \param[in] ctx Pointer to this instance's context
21190- * \param[in] ctrl_id Algorithm specific control identifier
21191- * \param[in,out] data Data to exchange with algorithm instance.
21192- *
21193- * \retval #VPX_CODEC_OK
21194- * The internal state data was deserialized.
21195- */
21196-typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
21197- int ctrl_id,
21198- va_list ap);
21199-
21200-/*!\brief control function pointer mapping
21201- *
21202- * This structure stores the mapping between control identifiers and
21203- * implementing functions. Each algorithm provides a list of these
21204- * mappings. This list is searched by the vpx_codec_control() wrapper
21205- * function to determine which function to invoke. The special
21206- * value {0, NULL} is used to indicate end-of-list, and must be
21207- * present. The special value {0, <non-null>} can be used as a catch-all
21208- * mapping. This implies that ctrl_id values chosen by the algorithm
21209- * \ref MUST be non-zero.
21210- */
21211-typedef const struct
21212-{
21213- int ctrl_id;
21214- vpx_codec_control_fn_t fn;
21215-} vpx_codec_ctrl_fn_map_t;
21216-
21217-/*!\brief decode data function pointer prototype
21218- *
21219- * Processes a buffer of coded data. If the processing results in a new
21220- * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
21221- * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
21222- * function is called by the generic vpx_codec_decode() wrapper function,
21223- * so plugins implementing this interface may trust the input parameters
21224- * to be properly initialized.
21225- *
21226- * \param[in] ctx Pointer to this instance's context
21227- * \param[in] data Pointer to this block of new coded data. If
21228- * NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
21229- * for the previously decoded frame.
21230- * \param[in] data_sz Size of the coded data, in bytes.
21231- *
21232- * \return Returns #VPX_CODEC_OK if the coded data was processed completely
21233- * and future pictures can be decoded without error. Otherwise,
21234- * see the descriptions of the other error codes in ::vpx_codec_err_t
21235- * for recoverability capabilities.
21236- */
21237-typedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t *ctx,
21238- const uint8_t *data,
21239- unsigned int data_sz,
21240- void *user_priv,
21241- long deadline);
21242-
21243-/*!\brief Decoded frames iterator
21244- *
21245- * Iterates over a list of the frames available for display. The iterator
21246- * storage should be initialized to NULL to start the iteration. Iteration is
21247- * complete when this function returns NULL.
21248- *
21249- * The list of available frames becomes valid upon completion of the
21250- * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
21251- *
21252- * \param[in] ctx Pointer to this instance's context
21253- * \param[in out] iter Iterator storage, initialized to NULL
21254- *
21255- * \return Returns a pointer to an image, if one is ready for display. Frames
21256- * produced will always be in PTS (presentation time stamp) order.
21257- */
21258-typedef vpx_image_t*(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
21259- vpx_codec_iter_t *iter);
21260-
21261-
21262-/*\brief e_xternal Memory Allocation memory map get iterator
21263- *
21264- * Iterates over a list of the memory maps requested by the decoder. The
21265- * iterator storage should be initialized to NULL to start the iteration.
21266- * Iteration is complete when this function returns NULL.
21267- *
21268- * \param[in out] iter Iterator storage, initialized to NULL
21269- *
21270- * \return Returns a pointer to an memory segment descriptor, or NULL to
21271- * indicate end-of-list.
21272- */
21273-typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *ctx,
21274- vpx_codec_mmap_t *mmap,
21275- vpx_codec_iter_t *iter);
21276-
21277-
21278-/*\brief e_xternal Memory Allocation memory map set iterator
21279- *
21280- * Sets a memory descriptor inside the decoder instance.
21281- *
21282- * \param[in] ctx Pointer to this instance's context
21283- * \param[in] mmap Memory map to store.
21284- *
21285- * \retval #VPX_CODEC_OK
21286- * The memory map was accepted and stored.
21287- * \retval #VPX_CODEC_MEM_ERROR
21288- * The memory map was rejected.
21289- */
21290-typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
21291- const vpx_codec_mmap_t *mmap);
21292-
21293-
21294-typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
21295- const vpx_image_t *img,
21296- vpx_codec_pts_t pts,
21297- unsigned long duration,
21298- vpx_enc_frame_flags_t flags,
21299- unsigned long deadline);
21300-typedef const vpx_codec_cx_pkt_t*(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_priv_t *ctx,
21301- vpx_codec_iter_t *iter);
21302-
21303-typedef vpx_codec_err_t
21304-(*vpx_codec_enc_config_set_fn_t)(vpx_codec_alg_priv_t *ctx,
21305- const vpx_codec_enc_cfg_t *cfg);
21306-typedef vpx_fixed_buf_t *
21307-(*vpx_codec_get_global_headers_fn_t)(vpx_codec_alg_priv_t *ctx);
21308-
21309-typedef vpx_image_t *
21310-(*vpx_codec_get_preview_frame_fn_t)(vpx_codec_alg_priv_t *ctx);
21311-
21312-/*!\brief usage configuration mapping
21313- *
21314- * This structure stores the mapping between usage identifiers and
21315- * configuration structures. Each algorithm provides a list of these
21316- * mappings. This list is searched by the vpx_codec_enc_config_default()
21317- * wrapper function to determine which config to return. The special value
21318- * {-1, {0}} is used to indicate end-of-list, and must be present. At least
21319- * one mapping must be present, in addition to the end-of-list.
21320- *
21321- */
21322-typedef const struct
21323-{
21324- int usage;
21325- vpx_codec_enc_cfg_t cfg;
21326-} vpx_codec_enc_cfg_map_t;
21327-
21328-#define NOT_IMPLEMENTED 0
21329-
21330-/*!\brief Decoder algorithm interface interface
21331- *
21332- * All decoders \ref MUST expose a variable of this type.
21333- */
21334-struct vpx_codec_iface
21335-{
21336- const char *name; /**< Identification String */
21337- int abi_version; /**< Implemented ABI version */
21338- vpx_codec_caps_t caps; /**< Decoder capabilities */
21339- vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
21340- vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
21341- vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
21342- vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
21343- vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
21344- struct
21345- {
21346- vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
21347- vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
21348- vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */
21349- vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_fn_t */
21350- } dec;
21351- struct
21352- {
21353- vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_enc_cfg_map_t */
21354- vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */
21355- vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
21356- vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
21357- vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
21358- vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
21359- } enc;
21360-};
21361-
21362-/*!\brief Callback function pointer / user data pair storage */
21363-typedef struct
21364-{
21365- union
21366- {
21367- vpx_codec_put_frame_cb_fn_t put_frame;
21368- vpx_codec_put_slice_cb_fn_t put_slice;
21369- };
21370- void *user_priv;
21371-} vpx_codec_priv_cb_pair_t;
21372-
21373-
21374-/*!\brief Instance private storage
21375- *
21376- * This structure is allocated by the algorithm's init function. It can be
21377- * extended in one of two ways. First, a second, algorithm specific structure
21378- * can be allocated and the priv member pointed to it. Alternatively, this
21379- * structure can be made the first member of the algorithm specific structure,
21380- * and the pointer casted to the proper type.
21381- */
21382-struct vpx_codec_priv
21383-{
21384- unsigned int sz;
21385- vpx_codec_iface_t *iface;
21386- struct vpx_codec_alg_priv *alg_priv;
21387- const char *err_detail;
21388- unsigned int eval_counter;
21389- vpx_codec_flags_t init_flags;
21390- struct
21391- {
21392- vpx_codec_priv_cb_pair_t put_frame_cb;
21393- vpx_codec_priv_cb_pair_t put_slice_cb;
21394- } dec;
21395- struct
21396- {
21397- int tbd;
21398- struct vpx_fixed_buf cx_data_dst_buf;
21399- unsigned int cx_data_pad_before;
21400- unsigned int cx_data_pad_after;
21401- vpx_codec_cx_pkt_t cx_data_pkt;
21402- } enc;
21403-};
21404-
21405-#undef VPX_CTRL_USE_TYPE
21406-#define VPX_CTRL_USE_TYPE(id, typ) \
21407- static typ id##__value(va_list args) {return va_arg(args, typ);} \
21408- static typ id##__convert(void *x)\
21409- {\
21410- union\
21411- {\
21412- void *x;\
21413- typ d;\
21414- } u;\
21415- u.x = x;\
21416- return u.d;\
21417- }
21418-
21419-
21420-#undef VPX_CTRL_USE_TYPE_DEPRECATED
21421-#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
21422- static typ id##__value(va_list args) {return va_arg(args, typ);} \
21423- static typ id##__convert(void *x)\
21424- {\
21425- union\
21426- {\
21427- void *x;\
21428- typ d;\
21429- } u;\
21430- u.x = x;\
21431- return u.d;\
21432- }
21433-
21434-#define CAST(id, arg) id##__value(arg)
21435-#define RECAST(id, x) id##__convert(x)
21436-
21437-
21438-/* Internal Utility Functions
21439- *
21440- * The following functions are indended to be used inside algorithms as
21441- * utilities for manipulating vpx_codec_* data structures.
21442- */
21443-struct vpx_codec_pkt_list
21444-{
21445- unsigned int cnt;
21446- unsigned int max;
21447- struct vpx_codec_cx_pkt pkts[1];
21448-};
21449-
21450-#define vpx_codec_pkt_list_decl(n)\
21451- union {struct vpx_codec_pkt_list head;\
21452- struct {struct vpx_codec_pkt_list head;\
21453- struct vpx_codec_cx_pkt pkts[n];} alloc;}
21454-
21455-#define vpx_codec_pkt_list_init(m)\
21456- (m)->alloc.head.cnt = 0,\
21457- (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
21458-
21459-int
21460-vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
21461- const struct vpx_codec_cx_pkt *);
21462-
21463-const vpx_codec_cx_pkt_t*
21464-vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
21465- vpx_codec_iter_t *iter);
21466-
21467-
21468-#include <stdio.h>
21469-#include <setjmp.h>
21470-struct vpx_internal_error_info
21471-{
21472- vpx_codec_err_t error_code;
21473- int has_detail;
21474- char detail[80];
21475- int setjmp;
21476- jmp_buf jmp;
21477-};
21478-
21479-static void vpx_internal_error(struct vpx_internal_error_info *info,
21480- vpx_codec_err_t error,
21481- const char *fmt,
21482- ...)
21483-{
21484- va_list ap;
21485-
21486- info->error_code = error;
21487- info->has_detail = 0;
21488-
21489- if (fmt)
21490- {
21491- size_t sz = sizeof(info->detail);
21492-
21493- info->has_detail = 1;
21494- va_start(ap, fmt);
21495- vsnprintf(info->detail, sz - 1, fmt, ap);
21496- va_end(ap);
21497- info->detail[sz-1] = '\0';
21498- }
21499-
21500- if (info->setjmp)
21501- longjmp(info->jmp, info->error_code);
21502-}
21503-#endif
21504diff --git a/vpx_codec/src/vpx_codec.c b/vpx_codec/src/vpx_codec.c
21505deleted file mode 100644
21506index 6366416..0000000
21507--- a/vpx_codec/src/vpx_codec.c
21508+++ /dev/null
21509@@ -1,196 +0,0 @@
21510-/*
21511- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
21512- *
21513- * Use of this source code is governed by a BSD-style license and patent
21514- * grant that can be found in the LICENSE file in the root of the source
21515- * tree. All contributing project authors may be found in the AUTHORS
21516- * file in the root of the source tree.
21517- */
21518-
21519-
21520-/*!\file vpx_decoder.c
21521- * \brief Provides the high level interface to wrap decoder algorithms.
21522- *
21523- */
21524-#include <stdlib.h>
21525-#include <string.h>
21526-#include "vpx_codec/internal/vpx_codec_internal.h"
21527-#include "vpx_version.h"
21528-
21529-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
21530-
21531-int vpx_codec_version(void)
21532-{
21533- return VERSION_PACKED;
21534-}
21535-
21536-
21537-const char *vpx_codec_version_str(void)
21538-{
21539- return VERSION_STRING_NOSP;
21540-}
21541-
21542-
21543-const char *vpx_codec_version_extra_str(void)
21544-{
21545- return VERSION_EXTRA;
21546-}
21547-
21548-
21549-const char *vpx_codec_iface_name(vpx_codec_iface_t *iface)
21550-{
21551- return iface ? iface->name : "<invalid interface>";
21552-}
21553-
21554-const char *vpx_codec_err_to_string(vpx_codec_err_t err)
21555-{
21556- switch (err)
21557- {
21558- case VPX_CODEC_OK:
21559- return "Success";
21560- case VPX_CODEC_ERROR:
21561- return "Unspecified internal error";
21562- case VPX_CODEC_MEM_ERROR:
21563- return "Memory allocation error";
21564- case VPX_CODEC_ABI_MISMATCH:
21565- return "ABI version mismatch";
21566- case VPX_CODEC_INCAPABLE:
21567- return "Codec does not implement requested capability";
21568- case VPX_CODEC_UNSUP_BITSTREAM:
21569- return "Bitstream not supported by this decoder";
21570- case VPX_CODEC_UNSUP_FEATURE:
21571- return "Bitstream required feature not supported by this decoder";
21572- case VPX_CODEC_CORRUPT_FRAME:
21573- return "Corrupt frame detected";
21574- case VPX_CODEC_INVALID_PARAM:
21575- return "Invalid parameter";
21576- case VPX_CODEC_LIST_END:
21577- return "End of iterated list";
21578- }
21579-
21580- return "Unrecognized error code";
21581-}
21582-
21583-const char *vpx_codec_error(vpx_codec_ctx_t *ctx)
21584-{
21585- return (ctx) ? vpx_codec_err_to_string(ctx->err)
21586- : vpx_codec_err_to_string(VPX_CODEC_INVALID_PARAM);
21587-}
21588-
21589-const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
21590-{
21591- if (ctx && ctx->err)
21592- return ctx->priv ? ctx->priv->err_detail : ctx->err_detail;
21593-
21594- return NULL;
21595-}
21596-
21597-
21598-vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
21599- vpx_codec_iface_t *iface,
21600- vpx_codec_dec_cfg_t *cfg,
21601- vpx_codec_flags_t flags,
21602- int ver)
21603-{
21604- vpx_codec_err_t res;
21605-
21606- if (ver != VPX_DECODER_ABI_VERSION)
21607- res = VPX_CODEC_ABI_MISMATCH;
21608- else if (!ctx || !iface)
21609- res = VPX_CODEC_INVALID_PARAM;
21610- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
21611- res = VPX_CODEC_ABI_MISMATCH;
21612- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
21613- res = VPX_CODEC_INCAPABLE;
21614- else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
21615- res = VPX_CODEC_INCAPABLE;
21616- else
21617- {
21618- memset(ctx, 0, sizeof(*ctx));
21619- ctx->iface = iface;
21620- ctx->name = iface->name;
21621- ctx->priv = NULL;
21622- ctx->init_flags = flags;
21623- ctx->config.dec = cfg;
21624- res = VPX_CODEC_OK;
21625-
21626- if (!(flags & VPX_CODEC_USE_XMA))
21627- {
21628- res = ctx->iface->init(ctx);
21629-
21630- if (res)
21631- {
21632- ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
21633- vpx_codec_destroy(ctx);
21634- }
21635-
21636- if (ctx->priv)
21637- ctx->priv->iface = ctx->iface;
21638- }
21639- }
21640-
21641- return SAVE_STATUS(ctx, res);
21642-}
21643-
21644-
21645-vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
21646-{
21647- vpx_codec_err_t res;
21648-
21649- if (!ctx)
21650- res = VPX_CODEC_INVALID_PARAM;
21651- else if (!ctx->iface || !ctx->priv)
21652- res = VPX_CODEC_ERROR;
21653- else
21654- {
21655- if (ctx->priv->alg_priv)
21656- ctx->iface->destroy(ctx->priv->alg_priv);
21657-
21658- ctx->iface = NULL;
21659- ctx->name = NULL;
21660- ctx->priv = NULL;
21661- res = VPX_CODEC_OK;
21662- }
21663-
21664- return SAVE_STATUS(ctx, res);
21665-}
21666-
21667-
21668-vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
21669-{
21670- return (iface) ? iface->caps : 0;
21671-}
21672-
21673-
21674-vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
21675- int ctrl_id,
21676- ...)
21677-{
21678- vpx_codec_err_t res;
21679-
21680- if (!ctx || !ctrl_id)
21681- res = VPX_CODEC_INVALID_PARAM;
21682- else if (!ctx->iface || !ctx->priv || !ctx->iface->ctrl_maps)
21683- res = VPX_CODEC_ERROR;
21684- else
21685- {
21686- vpx_codec_ctrl_fn_map_t *entry;
21687-
21688- res = VPX_CODEC_ERROR;
21689-
21690- for (entry = ctx->iface->ctrl_maps; entry && entry->fn; entry++)
21691- {
21692- if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
21693- {
21694- va_list ap;
21695-
21696- va_start(ap, ctrl_id);
21697- res = entry->fn(ctx->priv->alg_priv, ctrl_id, ap);
21698- va_end(ap);
21699- break;
21700- }
21701- }
21702- }
21703-
21704- return SAVE_STATUS(ctx, res);
21705-}
21706diff --git a/vpx_codec/src/vpx_decoder.c b/vpx_codec/src/vpx_decoder.c
21707deleted file mode 100644
21708index 7e8575f..0000000
21709--- a/vpx_codec/src/vpx_decoder.c
21710+++ /dev/null
21711@@ -1,201 +0,0 @@
21712-/*
21713- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
21714- *
21715- * Use of this source code is governed by a BSD-style license and patent
21716- * grant that can be found in the LICENSE file in the root of the source
21717- * tree. All contributing project authors may be found in the AUTHORS
21718- * file in the root of the source tree.
21719- */
21720-
21721-
21722-/*!\file vpx_decoder.c
21723- * \brief Provides the high level interface to wrap decoder algorithms.
21724- *
21725- */
21726-#include <stdlib.h>
21727-#include "vpx_codec/internal/vpx_codec_internal.h"
21728-
21729-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
21730-
21731-vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
21732- const uint8_t *data,
21733- unsigned int data_sz,
21734- vpx_codec_stream_info_t *si)
21735-{
21736- vpx_codec_err_t res;
21737-
21738- if (!iface || !data || !data_sz || !si
21739- || si->sz < sizeof(vpx_codec_stream_info_t))
21740- res = VPX_CODEC_INVALID_PARAM;
21741- else
21742- {
21743- /* Set default/unknown values */
21744- si->w = 0;
21745- si->h = 0;
21746-
21747- res = iface->dec.peek_si(data, data_sz, si);
21748- }
21749-
21750- return res;
21751-}
21752-
21753-
21754-vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
21755- vpx_codec_stream_info_t *si)
21756-{
21757- vpx_codec_err_t res;
21758-
21759- if (!ctx || !si || si->sz < sizeof(vpx_codec_stream_info_t))
21760- res = VPX_CODEC_INVALID_PARAM;
21761- else if (!ctx->iface || !ctx->priv)
21762- res = VPX_CODEC_ERROR;
21763- else
21764- {
21765- /* Set default/unknown values */
21766- si->w = 0;
21767- si->h = 0;
21768-
21769- res = ctx->iface->dec.get_si(ctx->priv->alg_priv, si);
21770- }
21771-
21772- return SAVE_STATUS(ctx, res);
21773-}
21774-
21775-
21776-vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
21777- const uint8_t *data,
21778- unsigned int data_sz,
21779- void *user_priv,
21780- long deadline)
21781-{
21782- vpx_codec_err_t res;
21783-
21784- if (!ctx || !data || !data_sz)
21785- res = VPX_CODEC_INVALID_PARAM;
21786- else if (!ctx->iface || !ctx->priv)
21787- res = VPX_CODEC_ERROR;
21788-
21789-#if CONFIG_EVAL_LIMIT
21790- else if (ctx->priv->eval_counter >= 500)
21791- {
21792- ctx->priv->err_detail = "Evaluation limit exceeded.";
21793- res = VPX_CODEC_ERROR;
21794- }
21795-
21796-#endif
21797- else
21798- {
21799- res = ctx->iface->dec.decode(ctx->priv->alg_priv, data, data_sz,
21800- user_priv, deadline);
21801-#if CONFIG_EVAL_LIMIT
21802- ctx->priv->eval_counter++;
21803-#endif
21804- }
21805-
21806- return SAVE_STATUS(ctx, res);
21807-}
21808-
21809-vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
21810- vpx_codec_iter_t *iter)
21811-{
21812- vpx_image_t *img;
21813-
21814- if (!ctx || !iter || !ctx->iface || !ctx->priv)
21815- img = NULL;
21816- else
21817- img = ctx->iface->dec.get_frame(ctx->priv->alg_priv, iter);
21818-
21819- return img;
21820-}
21821-
21822-
21823-vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
21824- vpx_codec_put_frame_cb_fn_t cb,
21825- void *user_priv)
21826-{
21827- vpx_codec_err_t res;
21828-
21829- if (!ctx || !cb)
21830- res = VPX_CODEC_INVALID_PARAM;
21831- else if (!ctx->iface || !ctx->priv
21832- || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
21833- res = VPX_CODEC_ERROR;
21834- else
21835- {
21836- ctx->priv->dec.put_frame_cb.put_frame = cb;
21837- ctx->priv->dec.put_frame_cb.user_priv = user_priv;
21838- res = VPX_CODEC_OK;
21839- }
21840-
21841- return SAVE_STATUS(ctx, res);
21842-}
21843-
21844-
21845-vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
21846- vpx_codec_put_slice_cb_fn_t cb,
21847- void *user_priv)
21848-{
21849- vpx_codec_err_t res;
21850-
21851- if (!ctx || !cb)
21852- res = VPX_CODEC_INVALID_PARAM;
21853- else if (!ctx->iface || !ctx->priv
21854- || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
21855- res = VPX_CODEC_ERROR;
21856- else
21857- {
21858- ctx->priv->dec.put_slice_cb.put_slice = cb;
21859- ctx->priv->dec.put_slice_cb.user_priv = user_priv;
21860- res = VPX_CODEC_OK;
21861- }
21862-
21863- return SAVE_STATUS(ctx, res);
21864-}
21865-
21866-
21867-vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
21868- vpx_codec_mmap_t *mmap,
21869- vpx_codec_iter_t *iter)
21870-{
21871- vpx_codec_err_t res = VPX_CODEC_OK;
21872-
21873- if (!ctx || !mmap || !iter || !ctx->iface)
21874- res = VPX_CODEC_INVALID_PARAM;
21875- else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
21876- res = VPX_CODEC_ERROR;
21877- else
21878- res = ctx->iface->get_mmap(ctx, mmap, iter);
21879-
21880- return SAVE_STATUS(ctx, res);
21881-}
21882-
21883-
21884-vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
21885- vpx_codec_mmap_t *mmap,
21886- unsigned int num_maps)
21887-{
21888- vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
21889-
21890- if (!ctx || !mmap || !ctx->iface)
21891- res = VPX_CODEC_INVALID_PARAM;
21892- else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
21893- res = VPX_CODEC_ERROR;
21894- else
21895- {
21896- unsigned int i;
21897-
21898- for (i = 0; i < num_maps; i++, mmap++)
21899- {
21900- if (!mmap->base)
21901- break;
21902-
21903- /* Everything look ok, set the mmap in the decoder */
21904- res = ctx->iface->set_mmap(ctx, mmap);
21905-
21906- if (res)
21907- break;
21908- }
21909- }
21910-
21911- return SAVE_STATUS(ctx, res);
21912-}
21913diff --git a/vpx_codec/src/vpx_decoder_compat.c b/vpx_codec/src/vpx_decoder_compat.c
21914deleted file mode 100644
21915index d5b04ae..0000000
21916--- a/vpx_codec/src/vpx_decoder_compat.c
21917+++ /dev/null
21918@@ -1,200 +0,0 @@
21919-/*
21920- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
21921- *
21922- * Use of this source code is governed by a BSD-style license and patent
21923- * grant that can be found in the LICENSE file in the root of the source
21924- * tree. All contributing project authors may be found in the AUTHORS
21925- * file in the root of the source tree.
21926- */
21927-
21928-
21929-/*!\file vpx_decoder.c
21930- * \brief Provides the high level interface to wrap decoder algorithms.
21931- *
21932- */
21933-#include <stdlib.h>
21934-#include <string.h>
21935-#include "vpx_codec/vpx_decoder.h"
21936-#include "vpx_codec/internal/vpx_codec_internal.h"
21937-
21938-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
21939-
21940-const char *vpx_dec_iface_name(vpx_dec_iface_t *iface)
21941-{
21942- return vpx_codec_iface_name((vpx_codec_iface_t *)iface);
21943-}
21944-
21945-const char *vpx_dec_err_to_string(vpx_dec_err_t err)
21946-{
21947- return vpx_codec_err_to_string(err);
21948-}
21949-
21950-const char *vpx_dec_error(vpx_dec_ctx_t *ctx)
21951-{
21952- return vpx_codec_error((vpx_codec_ctx_t *)ctx);
21953-}
21954-
21955-const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx)
21956-{
21957- return vpx_codec_error_detail((vpx_codec_ctx_t *)ctx);
21958-}
21959-
21960-
21961-vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
21962- vpx_dec_iface_t *iface,
21963- int ver)
21964-{
21965- return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
21966- (vpx_codec_iface_t *)iface,
21967- NULL,
21968- 0,
21969- ver);
21970-}
21971-
21972-
21973-vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx)
21974-{
21975- return vpx_codec_destroy((vpx_codec_ctx_t *)ctx);
21976-}
21977-
21978-
21979-vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface)
21980-{
21981- return vpx_codec_get_caps((vpx_codec_iface_t *)iface);
21982-}
21983-
21984-
21985-vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
21986- const uint8_t *data,
21987- unsigned int data_sz,
21988- vpx_dec_stream_info_t *si)
21989-{
21990- return vpx_codec_peek_stream_info((vpx_codec_iface_t *)iface, data, data_sz,
21991- (vpx_codec_stream_info_t *)si);
21992-}
21993-
21994-
21995-vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
21996- vpx_dec_stream_info_t *si)
21997-{
21998- return vpx_codec_get_stream_info((vpx_codec_ctx_t *)ctx,
21999- (vpx_codec_stream_info_t *)si);
22000-}
22001-
22002-
22003-vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
22004- int ctrl_id,
22005- void *data)
22006-{
22007- return vpx_codec_control_((vpx_codec_ctx_t *)ctx, ctrl_id, data);
22008-}
22009-
22010-
22011-vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
22012- uint8_t *data,
22013- unsigned int data_sz,
22014- void *user_priv,
22015- int rel_pts)
22016-{
22017- (void)rel_pts;
22018- return vpx_codec_decode((vpx_codec_ctx_t *)ctx, data, data_sz, user_priv,
22019- 0);
22020-}
22021-
22022-vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
22023- vpx_dec_iter_t *iter)
22024-{
22025- return vpx_codec_get_frame((vpx_codec_ctx_t *)ctx, iter);
22026-}
22027-
22028-
22029-vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
22030- vpx_dec_put_frame_cb_fn_t cb,
22031- void *user_priv)
22032-{
22033- return vpx_codec_register_put_frame_cb((vpx_codec_ctx_t *)ctx, cb,
22034- user_priv);
22035-}
22036-
22037-
22038-vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
22039- vpx_dec_put_slice_cb_fn_t cb,
22040- void *user_priv)
22041-{
22042- return vpx_codec_register_put_slice_cb((vpx_codec_ctx_t *)ctx, cb,
22043- user_priv);
22044-}
22045-
22046-
22047-vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
22048- vpx_dec_iface_t *iface,
22049- int ver)
22050-{
22051- return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
22052- (vpx_codec_iface_t *)iface,
22053- NULL,
22054- VPX_CODEC_USE_XMA,
22055- ver);
22056-}
22057-
22058-vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx_,
22059- vpx_dec_mmap_t *mmap,
22060- const vpx_dec_stream_info_t *si,
22061- vpx_dec_iter_t *iter)
22062-{
22063- vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
22064- vpx_dec_err_t res = VPX_DEC_OK;
22065-
22066- if (!ctx || !mmap || !si || !iter || !ctx->iface)
22067- res = VPX_DEC_INVALID_PARAM;
22068- else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
22069- res = VPX_DEC_ERROR;
22070- else
22071- {
22072- if (!ctx->config.dec)
22073- {
22074- ctx->config.dec = malloc(sizeof(vpx_codec_dec_cfg_t));
22075- ctx->config.dec->w = si->w;
22076- ctx->config.dec->h = si->h;
22077- }
22078-
22079- res = ctx->iface->get_mmap(ctx, mmap, iter);
22080- }
22081-
22082- return SAVE_STATUS(ctx, res);
22083-}
22084-
22085-
22086-vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx_,
22087- vpx_dec_mmap_t *mmap,
22088- unsigned int num_maps)
22089-{
22090- vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
22091- vpx_dec_err_t res = VPX_DEC_MEM_ERROR;
22092-
22093- if (!ctx || !mmap || !ctx->iface)
22094- res = VPX_DEC_INVALID_PARAM;
22095- else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
22096- res = VPX_DEC_ERROR;
22097- else
22098- {
22099- void *save = (ctx->priv) ? NULL : ctx->config.dec;
22100- unsigned int i;
22101-
22102- for (i = 0; i < num_maps; i++, mmap++)
22103- {
22104- if (!mmap->base)
22105- break;
22106-
22107- /* Everything look ok, set the mmap in the decoder */
22108- res = ctx->iface->set_mmap(ctx, mmap);
22109-
22110- if (res)
22111- break;
22112- }
22113-
22114- if (save) free(save);
22115- }
22116-
22117- return SAVE_STATUS(ctx, res);
22118-}
22119diff --git a/vpx_codec/src/vpx_encoder.c b/vpx_codec/src/vpx_encoder.c
22120deleted file mode 100644
22121index 98ad8ba..0000000
22122--- a/vpx_codec/src/vpx_encoder.c
22123+++ /dev/null
22124@@ -1,324 +0,0 @@
22125-/*
22126- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
22127- *
22128- * Use of this source code is governed by a BSD-style license and patent
22129- * grant that can be found in the LICENSE file in the root of the source
22130- * tree. All contributing project authors may be found in the AUTHORS
22131- * file in the root of the source tree.
22132- */
22133-
22134-
22135-/*!\file vpx_encoder.c
22136- * \brief Provides the high level interface to wrap encoder algorithms.
22137- *
22138- */
22139-#include <limits.h>
22140-#include <string.h>
22141-#include "vpx_codec/internal/vpx_codec_internal.h"
22142-
22143-#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
22144-
22145-vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
22146- vpx_codec_iface_t *iface,
22147- vpx_codec_enc_cfg_t *cfg,
22148- vpx_codec_flags_t flags,
22149- int ver)
22150-{
22151- vpx_codec_err_t res;
22152-
22153- if (ver != VPX_ENCODER_ABI_VERSION)
22154- res = VPX_CODEC_ABI_MISMATCH;
22155- else if (!ctx || !iface || !cfg)
22156- res = VPX_CODEC_INVALID_PARAM;
22157- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
22158- res = VPX_CODEC_ABI_MISMATCH;
22159- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
22160- res = VPX_CODEC_INCAPABLE;
22161- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
22162- res = VPX_CODEC_INCAPABLE;
22163- else if ((flags & VPX_CODEC_USE_PSNR)
22164- && !(iface->caps & VPX_CODEC_CAP_PSNR))
22165- res = VPX_CODEC_INCAPABLE;
22166- else
22167- {
22168- ctx->iface = iface;
22169- ctx->name = iface->name;
22170- ctx->priv = NULL;
22171- ctx->init_flags = flags;
22172- ctx->config.enc = cfg;
22173- res = ctx->iface->init(ctx);
22174-
22175- if (res)
22176- {
22177- ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
22178- vpx_codec_destroy(ctx);
22179- }
22180-
22181- if (ctx->priv)
22182- ctx->priv->iface = ctx->iface;
22183- }
22184-
22185- return SAVE_STATUS(ctx, res);
22186-}
22187-
22188-
22189-
22190-vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
22191- vpx_codec_enc_cfg_t *cfg,
22192- unsigned int usage)
22193-{
22194- vpx_codec_err_t res;
22195- vpx_codec_enc_cfg_map_t *map;
22196-
22197- if (!iface || !cfg || usage > INT_MAX)
22198- res = VPX_CODEC_INVALID_PARAM;
22199- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
22200- res = VPX_CODEC_INCAPABLE;
22201- else
22202- {
22203- res = VPX_CODEC_INVALID_PARAM;
22204-
22205- for (map = iface->enc.cfg_maps; map->usage >= 0; map++)
22206- {
22207- if (map->usage == (int)usage)
22208- {
22209- *cfg = map->cfg;
22210- cfg->g_usage = usage;
22211- res = VPX_CODEC_OK;
22212- break;
22213- }
22214- }
22215- }
22216-
22217- return res;
22218-}
22219-
22220-
22221-#if ARCH_X86 || ARCH_X86_64
22222-/* On X86, disable the x87 unit's internal 80 bit precision for better
22223- * consistency with the SSE unit's 64 bit precision.
22224- */
22225-#include "vpx_ports/x86.h"
22226-#define FLOATING_POINT_INIT() do {\
22227- unsigned short x87_orig_mode = x87_set_double_precision();
22228-#define FLOATING_POINT_RESTORE() \
22229- x87_set_control_word(x87_orig_mode); }while(0)
22230-
22231-
22232-#else
22233-static void FLOATING_POINT_INIT() {}
22234-static void FLOATING_POINT_RESTORE() {}
22235-#endif
22236-
22237-
22238-vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
22239- const vpx_image_t *img,
22240- vpx_codec_pts_t pts,
22241- unsigned long duration,
22242- vpx_enc_frame_flags_t flags,
22243- unsigned long deadline)
22244-{
22245- vpx_codec_err_t res;
22246-
22247- if (!ctx || (img && !duration))
22248- res = VPX_CODEC_INVALID_PARAM;
22249- else if (!ctx->iface || !ctx->priv)
22250- res = VPX_CODEC_ERROR;
22251- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
22252- res = VPX_CODEC_INCAPABLE;
22253-
22254-#if CONFIG_EVAL_LIMIT
22255- else if (ctx->priv->eval_counter >= 500)
22256- {
22257- ctx->priv->err_detail = "Evaluation limit exceeded.";
22258- res = VPX_CODEC_ERROR;
22259- }
22260-
22261-#endif
22262- else
22263- {
22264- /* Execute in a normalized floating point environment, if the platform
22265- * requires it.
22266- */
22267- FLOATING_POINT_INIT();
22268- res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
22269- duration, flags, deadline);
22270- FLOATING_POINT_RESTORE();
22271-
22272-#if CONFIG_EVAL_LIMIT
22273- ctx->priv->eval_counter++;
22274-#endif
22275- }
22276-
22277- return SAVE_STATUS(ctx, res);
22278-}
22279-
22280-
22281-const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
22282- vpx_codec_iter_t *iter)
22283-{
22284- const vpx_codec_cx_pkt_t *pkt = NULL;
22285-
22286- if (ctx)
22287- {
22288- if (!iter)
22289- ctx->err = VPX_CODEC_INVALID_PARAM;
22290- else if (!ctx->iface || !ctx->priv)
22291- ctx->err = VPX_CODEC_ERROR;
22292- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
22293- ctx->err = VPX_CODEC_INCAPABLE;
22294- else
22295- pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
22296- }
22297-
22298- if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT)
22299- {
22300- /* If the application has specified a destination area for the
22301- * compressed data, and the codec has not placed the data there,
22302- * and it fits, copy it.
22303- */
22304- char *dst_buf = ctx->priv->enc.cx_data_dst_buf.buf;
22305-
22306- if (dst_buf
22307- && pkt->data.raw.buf != dst_buf
22308- && pkt->data.raw.sz
22309- + ctx->priv->enc.cx_data_pad_before
22310- + ctx->priv->enc.cx_data_pad_after
22311- <= ctx->priv->enc.cx_data_dst_buf.sz)
22312- {
22313- vpx_codec_cx_pkt_t *modified_pkt = &ctx->priv->enc.cx_data_pkt;
22314-
22315- memcpy(dst_buf + ctx->priv->enc.cx_data_pad_before,
22316- pkt->data.raw.buf, pkt->data.raw.sz);
22317- *modified_pkt = *pkt;
22318- modified_pkt->data.raw.buf = dst_buf;
22319- modified_pkt->data.raw.sz += ctx->priv->enc.cx_data_pad_before
22320- + ctx->priv->enc.cx_data_pad_after;
22321- pkt = modified_pkt;
22322- }
22323-
22324- if (dst_buf == pkt->data.raw.buf)
22325- {
22326- ctx->priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz;
22327- ctx->priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz;
22328- }
22329- }
22330-
22331- return pkt;
22332-}
22333-
22334-
22335-vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
22336- const vpx_fixed_buf_t *buf,
22337- unsigned int pad_before,
22338- unsigned int pad_after)
22339-{
22340- if (!ctx || !ctx->priv)
22341- return VPX_CODEC_INVALID_PARAM;
22342-
22343- if (buf)
22344- {
22345- ctx->priv->enc.cx_data_dst_buf = *buf;
22346- ctx->priv->enc.cx_data_pad_before = pad_before;
22347- ctx->priv->enc.cx_data_pad_after = pad_after;
22348- }
22349- else
22350- {
22351- ctx->priv->enc.cx_data_dst_buf.buf = NULL;
22352- ctx->priv->enc.cx_data_dst_buf.sz = 0;
22353- ctx->priv->enc.cx_data_pad_before = 0;
22354- ctx->priv->enc.cx_data_pad_after = 0;
22355- }
22356-
22357- return VPX_CODEC_OK;
22358-}
22359-
22360-
22361-const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx)
22362-{
22363- vpx_image_t *img = NULL;
22364-
22365- if (ctx)
22366- {
22367- if (!ctx->iface || !ctx->priv)
22368- ctx->err = VPX_CODEC_ERROR;
22369- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
22370- ctx->err = VPX_CODEC_INCAPABLE;
22371- else if (!ctx->iface->enc.get_preview)
22372- ctx->err = VPX_CODEC_INCAPABLE;
22373- else
22374- img = ctx->iface->enc.get_preview(ctx->priv->alg_priv);
22375- }
22376-
22377- return img;
22378-}
22379-
22380-
22381-vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx)
22382-{
22383- vpx_fixed_buf_t *buf = NULL;
22384-
22385- if (ctx)
22386- {
22387- if (!ctx->iface || !ctx->priv)
22388- ctx->err = VPX_CODEC_ERROR;
22389- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
22390- ctx->err = VPX_CODEC_INCAPABLE;
22391- else if (!ctx->iface->enc.get_glob_hdrs)
22392- ctx->err = VPX_CODEC_INCAPABLE;
22393- else
22394- buf = ctx->iface->enc.get_glob_hdrs(ctx->priv->alg_priv);
22395- }
22396-
22397- return buf;
22398-}
22399-
22400-
22401-vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
22402- const vpx_codec_enc_cfg_t *cfg)
22403-{
22404- vpx_codec_err_t res;
22405-
22406- if (!ctx || !ctx->iface || !ctx->priv || !cfg)
22407- res = VPX_CODEC_INVALID_PARAM;
22408- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
22409- res = VPX_CODEC_INCAPABLE;
22410- else
22411- res = ctx->iface->enc.cfg_set(ctx->priv->alg_priv, cfg);
22412-
22413- return SAVE_STATUS(ctx, res);
22414-}
22415-
22416-
22417-int vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *list,
22418- const struct vpx_codec_cx_pkt *pkt)
22419-{
22420- if (list->cnt < list->max)
22421- {
22422- list->pkts[list->cnt++] = *pkt;
22423- return 0;
22424- }
22425-
22426- return 1;
22427-}
22428-
22429-
22430-const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
22431- vpx_codec_iter_t *iter)
22432-{
22433- const vpx_codec_cx_pkt_t *pkt;
22434-
22435- if (!(*iter))
22436- {
22437- *iter = list->pkts;
22438- }
22439-
22440- pkt = (const void *) * iter;
22441-
22442- if (pkt - list->pkts < list->cnt)
22443- *iter = pkt + 1;
22444- else
22445- pkt = NULL;
22446-
22447- return pkt;
22448-}
22449diff --git a/vpx_codec/src/vpx_image.c b/vpx_codec/src/vpx_image.c
22450deleted file mode 100644
22451index 8a16e58..0000000
22452--- a/vpx_codec/src/vpx_image.c
22453+++ /dev/null
22454@@ -1,261 +0,0 @@
22455-/*
22456- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
22457- *
22458- * Use of this source code is governed by a BSD-style license and patent
22459- * grant that can be found in the LICENSE file in the root of the source
22460- * tree. All contributing project authors may be found in the AUTHORS
22461- * file in the root of the source tree.
22462- */
22463-
22464-
22465-#include <stdlib.h>
22466-#include <string.h>
22467-#include "vpx_codec/vpx_image.h"
22468-
22469-static vpx_image_t *img_alloc_helper(vpx_image_t *img,
22470- img_fmt_t fmt,
22471- unsigned int d_w,
22472- unsigned int d_h,
22473- unsigned int stride_align,
22474- unsigned char *img_data)
22475-{
22476-
22477- unsigned int h, w, s, xcs, ycs, bps;
22478- int align;
22479-
22480- /* Treat align==0 like align==1 */
22481- if (!stride_align)
22482- stride_align = 1;
22483-
22484- /* Validate alignment (must be power of 2) */
22485- if (stride_align & (stride_align - 1))
22486- goto fail;
22487-
22488- /* Get sample size for this format */
22489- switch (fmt)
22490- {
22491- case IMG_FMT_RGB32:
22492- case IMG_FMT_RGB32_LE:
22493- case IMG_FMT_ARGB:
22494- case IMG_FMT_ARGB_LE:
22495- bps = 32;
22496- break;
22497- case IMG_FMT_RGB24:
22498- case IMG_FMT_BGR24:
22499- bps = 24;
22500- break;
22501- case IMG_FMT_RGB565:
22502- case IMG_FMT_RGB565_LE:
22503- case IMG_FMT_RGB555:
22504- case IMG_FMT_RGB555_LE:
22505- case IMG_FMT_UYVY:
22506- case IMG_FMT_YUY2:
22507- case IMG_FMT_YVYU:
22508- bps = 16;
22509- break;
22510- case IMG_FMT_I420:
22511- case IMG_FMT_YV12:
22512- case IMG_FMT_VPXI420:
22513- case IMG_FMT_VPXYV12:
22514- bps = 12;
22515- break;
22516- default:
22517- bps = 16;
22518- break;
22519- }
22520-
22521- /* Get chroma shift values for this format */
22522- switch (fmt)
22523- {
22524- case IMG_FMT_I420:
22525- case IMG_FMT_YV12:
22526- case IMG_FMT_VPXI420:
22527- case IMG_FMT_VPXYV12:
22528- xcs = 1;
22529- break;
22530- default:
22531- xcs = 0;
22532- break;
22533- }
22534-
22535- switch (fmt)
22536- {
22537- case IMG_FMT_I420:
22538- case IMG_FMT_YV12:
22539- case IMG_FMT_VPXI420:
22540- case IMG_FMT_VPXYV12:
22541- ycs = 1;
22542- break;
22543- default:
22544- ycs = 0;
22545- break;
22546- }
22547-
22548- /* Calculate storage sizes given the chroma subsampling */
22549- align = (1 << xcs) - 1;
22550- w = (d_w + align) & ~align;
22551- align = (1 << ycs) - 1;
22552- h = (d_h + align) & ~align;
22553- s = (fmt & IMG_FMT_PLANAR) ? w : bps * w / 8;
22554- s = (s + stride_align - 1) & ~(stride_align - 1);
22555-
22556- /* Allocate the new image */
22557- if (!img)
22558- {
22559- img = (vpx_image_t *)calloc(1, sizeof(vpx_image_t));
22560-
22561- if (!img)
22562- goto fail;
22563-
22564- img->self_allocd = 1;
22565- }
22566- else
22567- {
22568- memset(img, 0, sizeof(vpx_image_t));
22569- }
22570-
22571- img->img_data = img_data;
22572-
22573- if (!img_data)
22574- {
22575- img->img_data = malloc((fmt & IMG_FMT_PLANAR) ? h * w * bps / 8 : h * s);
22576- img->img_data_owner = 1;
22577- }
22578-
22579- if (!img->img_data)
22580- goto fail;
22581-
22582- img->fmt = fmt;
22583- img->w = w;
22584- img->h = h;
22585- img->x_chroma_shift = xcs;
22586- img->y_chroma_shift = ycs;
22587- img->bps = bps;
22588-
22589- /* Calculate strides */
22590- img->stride[PLANE_Y] = img->stride[PLANE_ALPHA] = s;
22591- img->stride[PLANE_U] = img->stride[PLANE_V] = s >> xcs;
22592-
22593- /* Default viewport to entire image */
22594- if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
22595- return img;
22596-
22597-fail:
22598- vpx_img_free(img);
22599- return NULL;
22600-}
22601-
22602-vpx_image_t *vpx_img_alloc(vpx_image_t *img,
22603- img_fmt_t fmt,
22604- unsigned int d_w,
22605- unsigned int d_h,
22606- unsigned int stride_align)
22607-{
22608- return img_alloc_helper(img, fmt, d_w, d_h, stride_align, NULL);
22609-}
22610-
22611-vpx_image_t *vpx_img_wrap(vpx_image_t *img,
22612- img_fmt_t fmt,
22613- unsigned int d_w,
22614- unsigned int d_h,
22615- unsigned int stride_align,
22616- unsigned char *img_data)
22617-{
22618- return img_alloc_helper(img, fmt, d_w, d_h, stride_align, img_data);
22619-}
22620-
22621-int vpx_img_set_rect(vpx_image_t *img,
22622- unsigned int x,
22623- unsigned int y,
22624- unsigned int w,
22625- unsigned int h)
22626-{
22627- unsigned char *data;
22628-
22629- if (x + w <= img->w && y + h <= img->h)
22630- {
22631- img->d_w = w;
22632- img->d_h = h;
22633-
22634- /* Calculate plane pointers */
22635- if (!(img->fmt & IMG_FMT_PLANAR))
22636- {
22637- img->planes[PLANE_PACKED] =
22638- img->img_data + x * img->bps / 8 + y * img->stride[PLANE_PACKED];
22639- }
22640- else
22641- {
22642- data = img->img_data;
22643-
22644- if (img->fmt & IMG_FMT_HAS_ALPHA)
22645- {
22646- img->planes[PLANE_ALPHA] =
22647- data + x + y * img->stride[PLANE_ALPHA];
22648- data += img->h * img->stride[PLANE_ALPHA];
22649- }
22650-
22651- img->planes[PLANE_Y] = data + x + y * img->stride[PLANE_Y];
22652- data += img->h * img->stride[PLANE_Y];
22653-
22654- if (!(img->fmt & IMG_FMT_UV_FLIP))
22655- {
22656- img->planes[PLANE_U] = data
22657- + (x >> img->x_chroma_shift)
22658- + (y >> img->y_chroma_shift) * img->stride[PLANE_U];
22659- data += (img->h >> img->y_chroma_shift) * img->stride[PLANE_U];
22660- img->planes[PLANE_V] = data
22661- + (x >> img->x_chroma_shift)
22662- + (y >> img->y_chroma_shift) * img->stride[PLANE_V];
22663- }
22664- else
22665- {
22666- img->planes[PLANE_V] = data
22667- + (x >> img->x_chroma_shift)
22668- + (y >> img->y_chroma_shift) * img->stride[PLANE_V];
22669- data += (img->h >> img->y_chroma_shift) * img->stride[PLANE_V];
22670- img->planes[PLANE_U] = data
22671- + (x >> img->x_chroma_shift)
22672- + (y >> img->y_chroma_shift) * img->stride[PLANE_U];
22673- }
22674- }
22675-
22676- return 0;
22677- }
22678-
22679- return -1;
22680-}
22681-
22682-void vpx_img_flip(vpx_image_t *img)
22683-{
22684- /* Note: In the calculation pointer adjustment calculation, we want the
22685- * rhs to be promoted to a signed type. Section 6.3.1.8 of the ISO C99
22686- * standard indicates that if the adjustment parameter is unsigned, the
22687- * stride parameter will be promoted to unsigned, causing errors when
22688- * the lhs is a larger type than the rhs.
22689- */
22690- img->planes[PLANE_Y] += (signed)(img->d_h - 1) * img->stride[PLANE_Y];
22691- img->stride[PLANE_Y] = -img->stride[PLANE_Y];
22692-
22693- img->planes[PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
22694- * img->stride[PLANE_U];
22695- img->stride[PLANE_U] = -img->stride[PLANE_U];
22696-
22697- img->planes[PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
22698- * img->stride[PLANE_V];
22699- img->stride[PLANE_V] = -img->stride[PLANE_V];
22700-
22701- img->planes[PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[PLANE_ALPHA];
22702- img->stride[PLANE_ALPHA] = -img->stride[PLANE_ALPHA];
22703-}
22704-
22705-void vpx_img_free(vpx_image_t *img)
22706-{
22707- if (img)
22708- {
22709- if (img->img_data && img->img_data_owner)
22710- free(img->img_data);
22711-
22712- if (img->self_allocd)
22713- free(img);
22714- }
22715-}
22716diff --git a/vpx_codec/vpx_codec.h b/vpx_codec/vpx_codec.h
22717deleted file mode 100644
22718index e2a79f9..0000000
22719--- a/vpx_codec/vpx_codec.h
22720+++ /dev/null
22721@@ -1,560 +0,0 @@
22722-/*
22723- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
22724- *
22725- * Use of this source code is governed by a BSD-style license and patent
22726- * grant that can be found in the LICENSE file in the root of the source
22727- * tree. All contributing project authors may be found in the AUTHORS
22728- * file in the root of the source tree.
22729- */
22730-
22731-
22732-/*!\defgroup codec Common Algorithm Interface
22733- * This abstraction allows applications to easily support multiple video
22734- * formats with minimal code duplication. This section describes the interface
22735- * common to all codecs (both encoders and decoders).
22736- * @{
22737- */
22738-
22739-/*!\file vpx_codec.h
22740- * \brief Describes the codec algorithm interface to applications.
22741- *
22742- * This file describes the interface between an application and a
22743- * video codec algorithm.
22744- *
22745- * An application instantiates a specific codec instance by using
22746- * vpx_codec_init() and a pointer to the algorithm's interface structure:
22747- * <pre>
22748- * my_app.c:
22749- * extern vpx_codec_iface_t my_codec;
22750- * {
22751- * vpx_codec_ctx_t algo;
22752- * res = vpx_codec_init(&algo, &my_codec);
22753- * }
22754- * </pre>
22755- *
22756- * Once initialized, the instance is manged using other functions from
22757- * the vpx_codec_* family.
22758- */
22759-#ifdef __cplusplus
22760-extern "C" {
22761-#endif
22762-
22763-#ifndef VPX_CODEC_H
22764-#define VPX_CODEC_H
22765-#ifdef HAVE_CONFIG_H
22766-# include "vpx_config.h"
22767-#endif
22768-#if defined(HAVE_VPX_PORTS) && HAVE_VPX_PORTS
22769-# include "vpx_ports/vpx_integer.h"
22770-#else
22771-# include "vpx_integer.h"
22772-#endif
22773-#include "vpx_image.h"
22774-
22775- /*!\brief Decorator indicating a function is deprecated */
22776-#ifndef DEPRECATED
22777-#if defined(__GNUC__) && __GNUC__
22778-#define DEPRECATED __attribute__ ((deprecated))
22779-#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
22780-#elif defined(_MSC_VER)
22781-#define DEPRECATED
22782-#define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
22783-#else
22784-#define DEPRECATED
22785-#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
22786-#endif
22787-#endif
22788-
22789- /*!\brief Decorator indicating a function is potentially unused */
22790-#ifdef UNUSED
22791-#elif __GNUC__
22792-#define UNUSED __attribute__ ((unused));
22793-#else
22794-#define UNUSED
22795-#endif
22796-
22797- /*!\brief Current ABI version number
22798- *
22799- * \internal
22800- * If this file is altered in any way that changes the ABI, this value
22801- * must be bumped. Examples include, but are not limited to, changing
22802- * types, removing or reassigning enums, adding/removing/rearranging
22803- * fields to structures
22804- */
22805-#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
22806-
22807- /*!\brief Algorithm return codes */
22808- typedef enum {
22809- /*!\brief Operation completed without error */
22810- VPX_CODEC_OK,
22811-
22812- /*!\brief Unspecified error */
22813- VPX_CODEC_ERROR,
22814-
22815- /*!\brief Memory operation failed */
22816- VPX_CODEC_MEM_ERROR,
22817-
22818- /*!\brief ABI version mismatch */
22819- VPX_CODEC_ABI_MISMATCH,
22820-
22821- /*!\brief Algorithm does not have required capability */
22822- VPX_CODEC_INCAPABLE,
22823-
22824- /*!\brief The given bitstream is not supported.
22825- *
22826- * The bitstream was unable to be parsed at the highest level. The decoder
22827- * is unable to proceed. This error \ref SHOULD be treated as fatal to the
22828- * stream. */
22829- VPX_CODEC_UNSUP_BITSTREAM,
22830-
22831- /*!\brief Encoded bitstream uses an unsupported feature
22832- *
22833- * The decoder does not implement a feature required by the encoder. This
22834- * return code should only be used for features that prevent future
22835- * pictures from being properly decoded. This error \ref MAY be treated as
22836- * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
22837- */
22838- VPX_CODEC_UNSUP_FEATURE,
22839-
22840- /*!\brief The coded data for this stream is corrupt or incomplete
22841- *
22842- * There was a problem decoding the current frame. This return code
22843- * should only be used for failures that prevent future pictures from
22844- * being properly decoded. This error \ref MAY be treated as fatal to the
22845- * stream or \ref MAY be treated as fatal to the current GOP. If decoding
22846- * is continued for the current GOP, artifacts may be present.
22847- */
22848- VPX_CODEC_CORRUPT_FRAME,
22849-
22850- /*!\brief An application-supplied parameter is not valid.
22851- *
22852- */
22853- VPX_CODEC_INVALID_PARAM,
22854-
22855- /*!\brief An iterator reached the end of list.
22856- *
22857- */
22858- VPX_CODEC_LIST_END,
22859-
22860- }
22861- vpx_codec_err_t;
22862-
22863-
22864- /*! \brief Codec capabilities bitfield
22865- *
22866- * Each codec advertises the capabilities it supports as part of its
22867- * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
22868- * or functionality, and are not required to be supported.
22869- *
22870- * The available flags are specified by VPX_CODEC_CAP_* defines.
22871- */
22872- typedef long vpx_codec_caps_t;
22873-#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
22874-#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
22875-#define VPX_CODEC_CAP_XMA 0x4 /**< Supports e_xternal Memory Allocation */
22876-
22877-
22878- /*! \brief Initialization-time Feature Enabling
22879- *
22880- * Certain codec features must be known at initialization time, to allow for
22881- * proper memory allocation.
22882- *
22883- * The available flags are specified by VPX_CODEC_USE_* defines.
22884- */
22885- typedef long vpx_codec_flags_t;
22886-#define VPX_CODEC_USE_XMA 0x00000001 /**< Use e_xternal Memory Allocation mode */
22887-
22888-
22889- /*!\brief Codec interface structure.
22890- *
22891- * Contains function pointers and other data private to the codec
22892- * implementation. This structure is opaque to the application.
22893- */
22894- typedef const struct vpx_codec_iface vpx_codec_iface_t;
22895-
22896-
22897- /*!\brief Codec private data structure.
22898- *
22899- * Contains data private to the codec implementation. This structure is opaque
22900- * to the application.
22901- */
22902- typedef struct vpx_codec_priv vpx_codec_priv_t;
22903-
22904-
22905- /*!\brief Iterator
22906- *
22907- * Opaque storage used for iterating over lists.
22908- */
22909- typedef const void *vpx_codec_iter_t;
22910-
22911-
22912- /*!\brief Codec context structure
22913- *
22914- * All codecs \ref MUST support this context structure fully. In general,
22915- * this data should be considered private to the codec algorithm, and
22916- * not be manipulated or examined by the calling application. Applications
22917- * may reference the 'name' member to get a printable description of the
22918- * algorithm.
22919- */
22920- typedef struct
22921- {
22922- const char *name; /**< Printable interface name */
22923- vpx_codec_iface_t *iface; /**< Interface pointers */
22924- vpx_codec_err_t err; /**< Last returned error */
22925- const char *err_detail; /**< Detailed info, if available */
22926- vpx_codec_flags_t init_flags; /**< Flags passed at init time */
22927- union
22928- {
22929- struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */
22930- struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */
22931- void *raw;
22932- } config; /**< Configuration pointer aliasing union */
22933- vpx_codec_priv_t *priv; /**< Algorithm private storage */
22934- } vpx_codec_ctx_t;
22935-
22936-
22937- /*
22938- * Library Version Number Interface
22939- *
22940- * For example, see the following sample return values:
22941- * vpx_codec_version() (1<<16 | 2<<8 | 3)
22942- * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
22943- * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
22944- */
22945-
22946- /*!\brief Return the version information (as an integer)
22947- *
22948- * Returns a packed encoding of the library version number. This will only include
22949- * the major.minor.patch component of the version number. Note that this encoded
22950- * value should be accessed through the macros provided, as the encoding may change
22951- * in the future.
22952- *
22953- */
22954- int vpx_codec_version(void);
22955-#define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
22956-#define VPX_VERSION_MINOR(v) ((v>>8)&0xff) /**< extract minor from packed version */
22957-#define VPX_VERSION_PATCH(v) ((v>>0)&0xff) /**< extract patch from packed version */
22958-
22959- /*!\brief Return the version major number */
22960-#define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
22961-
22962- /*!\brief Return the version minr number */
22963-#define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
22964-
22965- /*!\brief Return the version patch number */
22966-#define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
22967-
22968-
22969- /*!\brief Return the version information (as a string)
22970- *
22971- * Returns a printable string containing the full library version number. This may
22972- * contain additional text following the three digit version number, as to indicate
22973- * release candidates, prerelease versions, etc.
22974- *
22975- */
22976- const char *vpx_codec_version_str(void);
22977-
22978-
22979- /*!\brief Return the version information (as a string)
22980- *
22981- * Returns a printable "extra string". This is the component of the string returned
22982- * by vpx_codec_version_str() following the three digit version number.
22983- *
22984- */
22985- const char *vpx_codec_version_extra_str(void);
22986-
22987-
22988- /*!\brief Return the build configuration
22989- *
22990- * Returns a printable string containing an encoded version of the build
22991- * configuration. This may be useful to vpx support.
22992- *
22993- */
22994- const char *vpx_codec_build_config(void);
22995-
22996-
22997- /*!\brief Return the name for a given interface
22998- *
22999- * Returns a human readable string for name of the given codec interface.
23000- *
23001- * \param[in] iface Interface pointer
23002- *
23003- */
23004- const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
23005-
23006-
23007- /*!\brief Convert error number to printable string
23008- *
23009- * Returns a human readable string for the last error returned by the
23010- * algorithm. The returned error will be one line and will not contain
23011- * any newline characters.
23012- *
23013- *
23014- * \param[in] err Error number.
23015- *
23016- */
23017- const char *vpx_codec_err_to_string(vpx_codec_err_t err);
23018-
23019-
23020- /*!\brief Retrieve error synopsis for codec context
23021- *
23022- * Returns a human readable string for the last error returned by the
23023- * algorithm. The returned error will be one line and will not contain
23024- * any newline characters.
23025- *
23026- *
23027- * \param[in] ctx Pointer to this instance's context.
23028- *
23029- */
23030- const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
23031-
23032-
23033- /*!\brief Retrieve detailed error information for codec context
23034- *
23035- * Returns a human readable string providing detailed information about
23036- * the last error.
23037- *
23038- * \param[in] ctx Pointer to this instance's context.
23039- *
23040- * \retval NULL
23041- * No detailed information is available.
23042- */
23043- const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
23044-
23045-
23046- /* REQUIRED FUNCTIONS
23047- *
23048- * The following functions are required to be implemented for all codecs.
23049- * They represent the base case functionality expected of all codecs.
23050- */
23051-
23052- /*!\brief Destroy a codec instance
23053- *
23054- * Destroys a codec context, freeing any associated memory buffers.
23055- *
23056- * \param[in] ctx Pointer to this instance's context
23057- *
23058- * \retval #VPX_CODEC_OK
23059- * The codec algorithm initialized.
23060- * \retval #VPX_CODEC_MEM_ERROR
23061- * Memory allocation failed.
23062- */
23063- vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
23064-
23065-
23066- /*!\brief Get the capabilities of an algorithm.
23067- *
23068- * Retrieves the capabliities bitfield from the algorithm's interface.
23069- *
23070- * \param[in] iface Pointer to the alogrithm interface
23071- *
23072- */
23073- vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
23074-
23075-
23076- /*!\brief Control algorithm
23077- *
23078- * This function is used to exchange algorithm specific data with the codec
23079- * instance. This can be used to implement features specific to a particular
23080- * algorithm.
23081- *
23082- * This wrapper function dispatches the request to the helper function
23083- * associated with the given ctrl_id. It tries to call this function
23084- * transparantly, but will return #VPX_CODEC_ERROR if the request could not
23085- * be dispatched.
23086- *
23087- * Note that this function should not be used directly. Call the
23088- * #vpx_codec_control wrapper macro instead.
23089- *
23090- * \param[in] ctx Pointer to this instance's context
23091- * \param[in] ctrl_id Algorithm specific control identifier
23092- *
23093- * \retval #VPX_CODEC_OK
23094- * The control request was processed.
23095- * \retval #VPX_CODEC_ERROR
23096- * The control request was not processed.
23097- * \retval #VPX_CODEC_INVALID_PARAM
23098- * The data was not valid.
23099- */
23100- vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
23101- int ctrl_id,
23102- ...);
23103-#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
23104-# define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
23105-# define VPX_CTRL_USE_TYPE(id, typ)
23106-# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
23107-# define VPX_CTRL_VOID(id, typ)
23108-
23109-#else
23110- /*!\brief vpx_codec_control wrapper macro
23111- *
23112- * This macro allows for type safe conversions across the variadic parameter
23113- * to vpx_codec_control_().
23114- *
23115- * \internal
23116- * It works by dispatching the call to the control function through a wrapper
23117- * function named with the id parameter.
23118- */
23119-# define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
23120- /**<\hideinitializer*/
23121-
23122-
23123- /*!\brief vpx_codec_control type definition macro
23124- *
23125- * This macro allows for type safe conversions across the variadic parameter
23126- * to vpx_codec_control_(). It defines the type of the argument for a given
23127- * control identifier.
23128- *
23129- * \internal
23130- * It defines a static function with
23131- * the correctly typed arguments as a wrapper to the type-unsafe internal
23132- * function.
23133- */
23134-# define VPX_CTRL_USE_TYPE(id, typ) \
23135- static vpx_codec_err_t \
23136- vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
23137- \
23138- static vpx_codec_err_t \
23139- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
23140- return vpx_codec_control_(ctx, ctrl_id, data);\
23141- } /**<\hideinitializer*/
23142-
23143-
23144- /*!\brief vpx_codec_control deprecated type definition macro
23145- *
23146- * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
23147- * deprecated and should not be used. Consult the documentation for your
23148- * codec for more information.
23149- *
23150- * \internal
23151- * It defines a static function with the correctly typed arguments as a
23152- * wrapper to the type-unsafe internal function.
23153- */
23154-# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
23155- DECLSPEC_DEPRECATED static vpx_codec_err_t \
23156- vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
23157- \
23158- DECLSPEC_DEPRECATED static vpx_codec_err_t \
23159- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
23160- return vpx_codec_control_(ctx, ctrl_id, data);\
23161- } /**<\hideinitializer*/
23162-
23163-
23164- /*!\brief vpx_codec_control void type definition macro
23165- *
23166- * This macro allows for type safe conversions across the variadic parameter
23167- * to vpx_codec_control_(). It indicates that a given control identifier takes
23168- * no argument.
23169- *
23170- * \internal
23171- * It defines a static function without a data argument as a wrapper to the
23172- * type-unsafe internal function.
23173- */
23174-# define VPX_CTRL_VOID(id) \
23175- static vpx_codec_err_t \
23176- vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
23177- \
23178- static vpx_codec_err_t \
23179- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
23180- return vpx_codec_control_(ctx, ctrl_id);\
23181- } /**<\hideinitializer*/
23182-
23183-
23184-#endif
23185-
23186-
23187- /*!\defgroup cap_xma External Memory Allocation Functions
23188- *
23189- * The following functions are required to be implemented for all codecs
23190- * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions
23191- * for codecs that don't advertise this capability will result in an error
23192- * code being returned, usually VPX_CODEC_INCAPABLE
23193- * @{
23194- */
23195-
23196-
23197- /*!\brief Memory Map Entry
23198- *
23199- * This structure is used to contain the properties of a memory segment. It
23200- * is populated by the codec in the request phase, and by the calling
23201- * application once the requested allocation has been performed.
23202- */
23203- typedef struct vpx_codec_mmap
23204- {
23205- /*
23206- * The following members are set by the codec when requesting a segment
23207- */
23208- unsigned int id; /**< identifier for the segment's contents */
23209- unsigned long sz; /**< size of the segment, in bytes */
23210- unsigned int align; /**< required alignment of the segment, in bytes */
23211- unsigned int flags; /**< bitfield containing segment properties */
23212-#define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
23213-#define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
23214-#define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
23215-
23216- /* The following members are to be filled in by the allocation function */
23217- void *base; /**< pointer to the allocated segment */
23218- void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */
23219- void *priv; /**< allocator private storage */
23220- } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */
23221-
23222-
23223- /*!\brief Iterate over the list of segments to allocate.
23224- *
23225- * Iterates over a list of the segments to allocate. The iterator storage
23226- * should be initialized to NULL to start the iteration. Iteration is complete
23227- * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to
23228- * allocate is dependant upon the size of the encoded stream. In cases where the
23229- * stream is not available at allocation time, a fixed size must be requested.
23230- * The codec will not be able to operate on streams larger than the size used at
23231- * allocation time.
23232- *
23233- * \param[in] ctx Pointer to this instance's context.
23234- * \param[out] mmap Pointer to the memory map entry to populate.
23235- * \param[in,out] iter Iterator storage, initialized to NULL
23236- *
23237- * \retval #VPX_CODEC_OK
23238- * The memory map entry was populated.
23239- * \retval #VPX_CODEC_ERROR
23240- * Codec does not support XMA mode.
23241- * \retval #VPX_CODEC_MEM_ERROR
23242- * Unable to determine segment size from stream info.
23243- */
23244- vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
23245- vpx_codec_mmap_t *mmap,
23246- vpx_codec_iter_t *iter);
23247-
23248-
23249- /*!\brief Identify allocated segments to codec instance
23250- *
23251- * Stores a list of allocated segments in the codec. Segments \ref MUST be
23252- * passed in the order they are read from vpx_codec_get_mem_map(), but may be
23253- * passed in groups of any size. Segments \ref MUST be set only once. The
23254- * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member
23255- * is non-NULL. If the segment requires cleanup handling (eg, calling free()
23256- * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated.
23257- *
23258- * \param[in] ctx Pointer to this instance's context.
23259- * \param[in] mmaps Pointer to the first memory map entry in the list.
23260- * \param[in] num_maps Number of entries being set at this time
23261- *
23262- * \retval #VPX_CODEC_OK
23263- * The segment was stored in the codec context.
23264- * \retval #VPX_CODEC_INCAPABLE
23265- * Codec does not support XMA mode.
23266- * \retval #VPX_CODEC_MEM_ERROR
23267- * Segment base address was not set, or segment was already stored.
23268-
23269- */
23270- vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
23271- vpx_codec_mmap_t *mmaps,
23272- unsigned int num_maps);
23273-
23274- /*!@} - end defgroup cap_xma*/
23275- /*!@} - end defgroup codec*/
23276-
23277-
23278-#endif
23279-#ifdef __cplusplus
23280-}
23281-#endif
23282diff --git a/vpx_codec/vpx_codec.mk b/vpx_codec/vpx_codec.mk
23283deleted file mode 100644
23284index 75fbeea..0000000
23285--- a/vpx_codec/vpx_codec.mk
23286+++ /dev/null
23287@@ -1,26 +0,0 @@
23288-##
23289-## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
23290-##
23291-## Use of this source code is governed by a BSD-style license and patent
23292-## grant that can be found in the LICENSE file in the root of the source
23293-## tree. All contributing project authors may be found in the AUTHORS
23294-## file in the root of the source tree.
23295-##
23296-
23297-
23298-API_EXPORTS += exports
23299-
23300-API_SRCS-yes += internal/vpx_codec_internal.h
23301-API_SRCS-yes += vpx_codec.h
23302-API_SRCS-yes += vpx_codec.mk
23303-API_SRCS-yes += vpx_codec_impl_top.h
23304-API_SRCS-yes += vpx_codec_impl_bottom.h
23305-API_SRCS-yes += vpx_decoder.h
23306-API_SRCS-yes += vpx_decoder_compat.h
23307-API_SRCS-yes += vpx_encoder.h
23308-API_SRCS-yes += vpx_image.h
23309-API_SRCS-yes += src/vpx_codec.c
23310-API_SRCS-yes += src/vpx_decoder.c
23311-API_SRCS-yes += src/vpx_decoder_compat.c
23312-API_SRCS-yes += src/vpx_image.c
23313-API_SRCS-yes += src/vpx_encoder.c
23314diff --git a/vpx_codec/vpx_codec_impl_bottom.h b/vpx_codec/vpx_codec_impl_bottom.h
23315deleted file mode 100644
23316index c52654c..0000000
23317--- a/vpx_codec/vpx_codec_impl_bottom.h
23318+++ /dev/null
23319@@ -1,18 +0,0 @@
23320-/*
23321- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
23322- *
23323- * Use of this source code is governed by a BSD-style license and patent
23324- * grant that can be found in the LICENSE file in the root of the source
23325- * tree. All contributing project authors may be found in the AUTHORS
23326- * file in the root of the source tree.
23327- */
23328-
23329-
23330-/*
23331- * This file is to be included at the bottom of the header files defining the
23332- * interface to individual codecs and contains matching blocks to those defined
23333- * in vpx_codec_impl_top.h
23334- */
23335-#ifdef __cplusplus
23336-}
23337-#endif
23338diff --git a/vpx_codec/vpx_codec_impl_top.h b/vpx_codec/vpx_codec_impl_top.h
23339deleted file mode 100644
23340index f73809a..0000000
23341--- a/vpx_codec/vpx_codec_impl_top.h
23342+++ /dev/null
23343@@ -1,18 +0,0 @@
23344-/*
23345- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
23346- *
23347- * Use of this source code is governed by a BSD-style license and patent
23348- * grant that can be found in the LICENSE file in the root of the source
23349- * tree. All contributing project authors may be found in the AUTHORS
23350- * file in the root of the source tree.
23351- */
23352-
23353-
23354-/*
23355- * This file is to be included at the top of the header files defining the
23356- * interface to individual codecs and contains various workarounds common
23357- * to all codec implementations.
23358- */
23359-#ifdef __cplusplus
23360-extern "C" {
23361-#endif
23362diff --git a/vpx_codec/vpx_decoder.h b/vpx_codec/vpx_decoder.h
23363deleted file mode 100644
23364index 5e4968d..0000000
23365--- a/vpx_codec/vpx_decoder.h
23366+++ /dev/null
23367@@ -1,316 +0,0 @@
23368-/*
23369- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
23370- *
23371- * Use of this source code is governed by a BSD-style license and patent
23372- * grant that can be found in the LICENSE file in the root of the source
23373- * tree. All contributing project authors may be found in the AUTHORS
23374- * file in the root of the source tree.
23375- */
23376-
23377-
23378-/*!\defgroup decoder Decoder Algorithm Interface
23379- * \ingroup codec
23380- * This abstraction allows applications using this decoder to easily support
23381- * multiple video formats with minimal code duplication. This section describes
23382- * the interface common to all decoders.
23383- * @{
23384- */
23385-
23386-/*!\file vpx_decoder.h
23387- * \brief Describes the decoder algorithm interface to applications.
23388- *
23389- * This file describes the interface between an application and a
23390- * video decoder algorithm.
23391- *
23392- */
23393-#ifdef __cplusplus
23394-extern "C" {
23395-#endif
23396-
23397-#ifndef VPX_DECODER_H
23398-#define VPX_DECODER_H
23399-#include "vpx_codec.h"
23400-
23401- /*!\brief Current ABI version number
23402- *
23403- * \internal
23404- * If this file is altered in any way that changes the ABI, this value
23405- * must be bumped. Examples include, but are not limited to, changing
23406- * types, removing or reassigning enums, adding/removing/rearranging
23407- * fields to structures
23408- */
23409-#define VPX_DECODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
23410-
23411- /*! \brief Decoder capabilities bitfield
23412- *
23413- * Each decoder advertises the capabilities it supports as part of its
23414- * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
23415- * or functionality, and are not required to be supported by a decoder.
23416- *
23417- * The available flags are specifiedby VPX_CODEC_CAP_* defines.
23418- */
23419-#define VPX_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
23420-#define VPX_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
23421-#define VPX_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
23422-
23423- /*! \brief Initialization-time Feature Enabling
23424- *
23425- * Certain codec features must be known at initialization time, to allow for
23426- * proper memory allocation.
23427- *
23428- * The available flags are specified by VPX_CODEC_USE_* defines.
23429- */
23430-#define VPX_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
23431-
23432- /*!\brief Stream properties
23433- *
23434- * This structure is used to query or set properties of the decoded
23435- * stream. Algorithms may extend this structure with data specific
23436- * to their bitstream by setting the sz member appropriately.
23437- */
23438- typedef struct
23439- {
23440- unsigned int sz; /**< Size of this structure */
23441- unsigned int w; /**< Width (or 0 for unknown/default) */
23442- unsigned int h; /**< Height (or 0 for unknown/default) */
23443- unsigned int is_kf; /**< Current frame is a keyframe */
23444- } vpx_codec_stream_info_t;
23445-
23446- /* REQUIRED FUNCTIONS
23447- *
23448- * The following functions are required to be implemented for all decoders.
23449- * They represent the base case functionality expected of all decoders.
23450- */
23451-
23452-
23453- /*!\brief Initialization Configurations
23454- *
23455- * This structure is used to pass init time configuration options to the
23456- * decoder.
23457- */
23458- typedef struct vpx_codec_dec_cfg
23459- {
23460- unsigned int threads; /**< Maximum number of threads to use, default 1 */
23461- unsigned int w; /**< Width */
23462- unsigned int h; /**< Height */
23463- } vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */
23464-
23465-
23466- /*!\brief Initialize a decoder instance
23467- *
23468- * Initializes a decoder context using the given interface. Applications
23469- * should call the vpx_codec_dec_init convenience macro instead of this
23470- * function directly, to ensure that the ABI version number parameter
23471- * is properly initialized.
23472- *
23473- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
23474- * parameter), the storage pointed to by the cfg parameter must be
23475- * kept readable and stable until all memory maps have been set.
23476- *
23477- * \param[in] ctx Pointer to this instance's context.
23478- * \param[in] iface Pointer to the alogrithm interface to use.
23479- * \param[in] cfg Configuration to use, if known. May be NULL.
23480- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
23481- * \param[in] ver ABI version number. Must be set to
23482- * VPX_DECODER_ABI_VERSION
23483- * \retval #VPX_CODEC_OK
23484- * The decoder algorithm initialized.
23485- * \retval #VPX_CODEC_MEM_ERROR
23486- * Memory allocation failed.
23487- */
23488- vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
23489- vpx_codec_iface_t *iface,
23490- vpx_codec_dec_cfg_t *cfg,
23491- vpx_codec_flags_t flags,
23492- int ver);
23493-
23494- /*!\brief Convenience macro for vpx_codec_dec_init_ver()
23495- *
23496- * Ensures the ABI version parameter is properly set.
23497- */
23498-#define vpx_codec_dec_init(ctx, iface, cfg, flags) \
23499- vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
23500-
23501-
23502- /*!\brief Parse stream info from a buffer
23503- *
23504- * Performs high level parsing of the bitstream. Construction of a decoder
23505- * context is not necessary. Can be used to determine if the bitstream is
23506- * of the proper format, and to extract information from the stream.
23507- *
23508- * \param[in] iface Pointer to the alogrithm interface
23509- * \param[in] data Pointer to a block of data to parse
23510- * \param[in] data_sz Size of the data buffer
23511- * \param[in,out] si Pointer to stream info to update. The size member
23512- * \ref MUST be properly initialized, but \ref MAY be
23513- * clobbered by the algorithm. This parameter \ref MAY
23514- * be NULL.
23515- *
23516- * \retval #VPX_CODEC_OK
23517- * Bitstream is parsable and stream information updated
23518- */
23519- vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
23520- const uint8_t *data,
23521- unsigned int data_sz,
23522- vpx_codec_stream_info_t *si);
23523-
23524-
23525- /*!\brief Return information about the current stream.
23526- *
23527- * Returns information about the stream that has been parsed during decoding.
23528- *
23529- * \param[in] ctx Pointer to this instance's context
23530- * \param[in,out] si Pointer to stream info to update. The size member
23531- * \ref MUST be properly initialized, but \ref MAY be
23532- * clobbered by the algorithm. This parameter \ref MAY
23533- * be NULL.
23534- *
23535- * \retval #VPX_CODEC_OK
23536- * Bitstream is parsable and stream information updated
23537- */
23538- vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
23539- vpx_codec_stream_info_t *si);
23540-
23541-
23542- /*!\brief Decode data
23543- *
23544- * Processes a buffer of coded data. If the processing results in a new
23545- * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
23546- * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
23547- * time stamp) order. Frames produced will always be in PTS (presentation
23548- * time stamp) order.
23549- *
23550- * \param[in] ctx Pointer to this instance's context
23551- * \param[in] data Pointer to this block of new coded data. If
23552- * NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
23553- * for the previously decoded frame.
23554- * \param[in] data_sz Size of the coded data, in bytes.
23555- * \param[in] user_priv Application specific data to associate with
23556- * this frame.
23557- * \param[in] deadline Soft deadline the decoder should attempt to meet,
23558- * in us. Set to zero for unlimited.
23559- *
23560- * \return Returns #VPX_CODEC_OK if the coded data was processed completely
23561- * and future pictures can be decoded without error. Otherwise,
23562- * see the descriptions of the other error codes in ::vpx_codec_err_t
23563- * for recoverability capabilities.
23564- */
23565- vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
23566- const uint8_t *data,
23567- unsigned int data_sz,
23568- void *user_priv,
23569- long deadline);
23570-
23571-
23572- /*!\brief Decoded frames iterator
23573- *
23574- * Iterates over a list of the frames available for display. The iterator
23575- * storage should be initialized to NULL to start the iteration. Iteration is
23576- * complete when this function returns NULL.
23577- *
23578- * The list of available frames becomes valid upon completion of the
23579- * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
23580- *
23581- * \param[in] ctx Pointer to this instance's context
23582- * \param[in,out] iter Iterator storage, initialized to NULL
23583- *
23584- * \return Returns a pointer to an image, if one is ready for display. Frames
23585- * produced will always be in PTS (presentation time stamp) order.
23586- */
23587- vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
23588- vpx_codec_iter_t *iter);
23589-
23590-
23591- /*!\defgroup cap_put_frame Frame-Based Decoding Functions
23592- *
23593- * The following functions are required to be implemented for all decoders
23594- * that advertise the VPX_CODEC_CAP_PUT_FRAME capability. Calling these functions
23595- * for codecs that don't advertise this capability will result in an error
23596- * code being returned, usually VPX_CODEC_ERROR
23597- * @{
23598- */
23599-
23600- /*!\brief put frame callback prototype
23601- *
23602- * This callback is invoked by the decoder to notify the application of
23603- * the availability of decoded image data.
23604- */
23605- typedef void (*vpx_codec_put_frame_cb_fn_t)(void *user_priv,
23606- const vpx_image_t *img);
23607-
23608-
23609- /*!\brief Register for notification of frame completion.
23610- *
23611- * Registers a given function to be called when a decoded frame is
23612- * available.
23613- *
23614- * \param[in] ctx Pointer to this instance's context
23615- * \param[in] cb Pointer to the callback function
23616- * \param[in] user_priv User's private data
23617- *
23618- * \retval #VPX_CODEC_OK
23619- * Callback successfully registered.
23620- * \retval #VPX_CODEC_ERROR
23621- * Decoder context not initialized, or algorithm not capable of
23622- * posting slice completion.
23623- */
23624- vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
23625- vpx_codec_put_frame_cb_fn_t cb,
23626- void *user_priv);
23627-
23628-
23629- /*!@} - end defgroup cap_put_frame */
23630-
23631- /*!\defgroup cap_put_slice Slice-Based Decoding Functions
23632- *
23633- * The following functions are required to be implemented for all decoders
23634- * that advertise the VPX_CODEC_CAP_PUT_SLICE capability. Calling these functions
23635- * for codecs that don't advertise this capability will result in an error
23636- * code being returned, usually VPX_CODEC_ERROR
23637- * @{
23638- */
23639-
23640- /*!\brief put slice callback prototype
23641- *
23642- * This callback is invoked by the decoder to notify the application of
23643- * the availability of partially decoded image data. The
23644- */
23645- typedef void (*vpx_codec_put_slice_cb_fn_t)(void *user_priv,
23646- const vpx_image_t *img,
23647- const vpx_image_rect_t *valid,
23648- const vpx_image_rect_t *update);
23649-
23650-
23651- /*!\brief Register for notification of slice completion.
23652- *
23653- * Registers a given function to be called when a decoded slice is
23654- * available.
23655- *
23656- * \param[in] ctx Pointer to this instance's context
23657- * \param[in] cb Pointer to the callback function
23658- * \param[in] user_priv User's private data
23659- *
23660- * \retval #VPX_CODEC_OK
23661- * Callback successfully registered.
23662- * \retval #VPX_CODEC_ERROR
23663- * Decoder context not initialized, or algorithm not capable of
23664- * posting slice completion.
23665- */
23666- vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
23667- vpx_codec_put_slice_cb_fn_t cb,
23668- void *user_priv);
23669-
23670-
23671- /*!@} - end defgroup cap_put_slice*/
23672-
23673- /*!@} - end defgroup decoder*/
23674-
23675-#endif
23676-
23677-#ifdef __cplusplus
23678-}
23679-#endif
23680-
23681-#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
23682-#include "vpx_decoder_compat.h"
23683-#endif
23684diff --git a/vpx_codec/vpx_decoder_compat.h b/vpx_codec/vpx_decoder_compat.h
23685deleted file mode 100644
23686index 25bb5eb..0000000
23687--- a/vpx_codec/vpx_decoder_compat.h
23688+++ /dev/null
23689@@ -1,586 +0,0 @@
23690-/*
23691- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
23692- *
23693- * Use of this source code is governed by a BSD-style license and patent
23694- * grant that can be found in the LICENSE file in the root of the source
23695- * tree. All contributing project authors may be found in the AUTHORS
23696- * file in the root of the source tree.
23697- */
23698-
23699-
23700-/*!\defgroup decoder Common Decoder Algorithm Interface
23701- * This abstraction allows applications using this decoder to easily support
23702- * multiple video formats with minimal code duplication. This section describes
23703- * the interface common to all codecs.
23704- * @{
23705- */
23706-
23707-/*!\file vpx_decoder_compat.h
23708- * \brief Provides a compatibility layer between version 1 and 2 of this API.
23709- *
23710- * This interface has been deprecated. Only existing code should make use
23711- * of this interface, and therefore, it is only thinly documented. Existing
23712- * code should be ported to the vpx_codec_* API.
23713- */
23714-#ifdef __cplusplus
23715-extern "C" {
23716-#endif
23717-
23718-#ifndef VPX_DECODER_COMPAT_H
23719-#define VPX_DECODER_COMPAT_H
23720-
23721- /*!\brief Decoder algorithm return codes */
23722- typedef enum {
23723- /*!\brief Operation completed without error */
23724- VPX_DEC_OK = VPX_CODEC_OK,
23725-
23726- /*!\brief Unspecified error */
23727- VPX_DEC_ERROR = VPX_CODEC_ERROR,
23728-
23729- /*!\brief Memory operation failed */
23730- VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR,
23731-
23732- /*!\brief ABI version mismatch */
23733- VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
23734-
23735- /*!\brief The given bitstream is not supported.
23736- *
23737- * The bitstream was unable to be parsed at the highest level. The decoder
23738- * is unable to proceed. This error \ref SHOULD be treated as fatal to the
23739- * stream. */
23740- VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM,
23741-
23742- /*!\brief Encoded bitstream uses an unsupported feature
23743- *
23744- * The decoder does not implement a feature required by the encoder. This
23745- * return code should only be used for features that prevent future
23746- * pictures from being properly decoded. This error \ref MAY be treated as
23747- * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
23748- */
23749- VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE,
23750-
23751- /*!\brief The coded data for this stream is corrupt or incomplete
23752- *
23753- * There was a problem decoding the current frame. This return code
23754- * should only be used for failures that prevent future pictures from
23755- * being properly decoded. This error \ref MAY be treated as fatal to the
23756- * stream or \ref MAY be treated as fatal to the current GOP. If decoding
23757- * is continued for the current GOP, artifacts may be present.
23758- */
23759- VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME,
23760-
23761- /*!\brief An application-supplied parameter is not valid.
23762- *
23763- */
23764- VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
23765-
23766- /*!\brief An iterator reached the end of list.
23767- *
23768- */
23769- VPX_DEC_LIST_END = VPX_CODEC_LIST_END,
23770-
23771- }
23772- vpx_dec_err_t;
23773-
23774- /*! \brief Decoder capabilities bitfield
23775- *
23776- * Each decoder advertises the capabilities it supports as part of its
23777- * ::vpx_dec_iface_t interface structure. Capabilities are extra interfaces
23778- * or functionality, and are not required to be supported by a decoder.
23779- *
23780- * The available flags are specifiedby VPX_DEC_CAP_* defines.
23781- */
23782- typedef int vpx_dec_caps_t;
23783-#define VPX_DEC_CAP_PUT_SLICE 0x0001 /**< Will issue put_slice callbacks */
23784-#define VPX_DEC_CAP_PUT_FRAME 0x0002 /**< Will issue put_frame callbacks */
23785-#define VPX_DEC_CAP_XMA 0x0004 /**< Supports e_xternal Memory Allocation */
23786-
23787- /*!\brief Stream properties
23788- *
23789- * This structure is used to query or set properties of the decoded
23790- * stream. Algorithms may extend this structure with data specific
23791- * to their bitstream by setting the sz member appropriately.
23792- */
23793-#if 1
23794- typedef vpx_codec_stream_info_t vpx_dec_stream_info_t;
23795-#else
23796- typedef struct
23797- {
23798- unsigned int sz; /**< Size of this structure */
23799- unsigned int w; /**< Width (or 0 for unknown/default) */
23800- unsigned int h; /**< Height (or 0 for unknown/default) */
23801- unsigned int is_kf; /**< Current frame is a keyframe */
23802- } vpx_dec_stream_info_t;
23803-#endif
23804-
23805-
23806- /*!\brief Decoder interface structure.
23807- *
23808- * Contains function pointers and other data private to the decoder
23809- * implementation. This structure is opaque to the application.
23810- */
23811- typedef const struct vpx_codec_iface vpx_dec_iface_t;
23812- typedef struct vpx_codec_priv vpx_dec_priv_t;
23813-
23814- /*!\brief Iterator
23815- *
23816- * Opaque storage used for iterating over lists.
23817- */
23818- typedef vpx_codec_iter_t vpx_dec_iter_t;
23819-
23820- /*!\brief Decoder context structure
23821- *
23822- * All decoders \ref MUST support this context structure fully. In general,
23823- * this data should be considered private to the decoder algorithm, and
23824- * not be manipulated or examined by the calling application. Applications
23825- * may reference the 'name' member to get a printable description of the
23826- * algorithm.
23827- */
23828-#if 1
23829- typedef vpx_codec_ctx_t vpx_dec_ctx_t;
23830-#else
23831- typedef struct
23832- {
23833- const char *name; /**< Printable interface name */
23834- vpx_dec_iface_t *iface; /**< Interface pointers */
23835- vpx_dec_err_t err; /**< Last returned error */
23836- vpx_dec_priv_t *priv; /**< Algorithm private storage */
23837- } vpx_dec_ctx_t;
23838-#endif
23839-
23840-
23841- /*!\brief Return the build configuration
23842- *
23843- * Returns a printable string containing an encoded version of the build
23844- * configuration. This may be useful to vpx support.
23845- *
23846- */
23847- const char *vpx_dec_build_config(void) DEPRECATED;
23848-
23849- /*!\brief Return the name for a given interface
23850- *
23851- * Returns a human readable string for name of the given decoder interface.
23852- *
23853- * \param[in] iface Interface pointer
23854- *
23855- */
23856- const char *vpx_dec_iface_name(vpx_dec_iface_t *iface) DEPRECATED;
23857-
23858-
23859- /*!\brief Convert error number to printable string
23860- *
23861- * Returns a human readable string for the last error returned by the
23862- * algorithm. The returned error will be one line and will not contain
23863- * any newline characters.
23864- *
23865- *
23866- * \param[in] err Error number.
23867- *
23868- */
23869- const char *vpx_dec_err_to_string(vpx_dec_err_t err) DEPRECATED;
23870-
23871-
23872- /*!\brief Retrieve error synopsis for decoder context
23873- *
23874- * Returns a human readable string for the last error returned by the
23875- * algorithm. The returned error will be one line and will not contain
23876- * any newline characters.
23877- *
23878- *
23879- * \param[in] ctx Pointer to this instance's context.
23880- *
23881- */
23882- const char *vpx_dec_error(vpx_dec_ctx_t *ctx) DEPRECATED;
23883-
23884-
23885- /*!\brief Retrieve detailed error information for decoder context
23886- *
23887- * Returns a human readable string providing detailed information about
23888- * the last error.
23889- *
23890- * \param[in] ctx Pointer to this instance's context.
23891- *
23892- * \retval NULL
23893- * No detailed information is available.
23894- */
23895- const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx) DEPRECATED;
23896-
23897-
23898- /* REQUIRED FUNCTIONS
23899- *
23900- * The following functions are required to be implemented for all decoders.
23901- * They represent the base case functionality expected of all decoders.
23902- */
23903-
23904-
23905- /*!\brief Initialize a decoder instance
23906- *
23907- * Initializes a decoder context using the given interface. Applications
23908- * should call the vpx_dec_init convenience macro instead of this
23909- * function directly, to ensure that the ABI version number parameter
23910- * is properly initialized.
23911- *
23912- * \param[in] ctx Pointer to this instance's context.
23913- * \param[in] iface Pointer to the alogrithm interface to use.
23914- * \param[in] ver ABI version number. Must be set to
23915- * VPX_DECODER_ABI_VERSION
23916- * \retval #VPX_DEC_OK
23917- * The decoder algorithm initialized.
23918- * \retval #VPX_DEC_MEM_ERROR
23919- * Memory allocation failed.
23920- */
23921- vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
23922- vpx_dec_iface_t *iface,
23923- int ver) DEPRECATED;
23924-#define vpx_dec_init(ctx, iface) \
23925- vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
23926-
23927-
23928- /*!\brief Destroy a decoder instance
23929- *
23930- * Destroys a decoder context, freeing any associated memory buffers.
23931- *
23932- * \param[in] ctx Pointer to this instance's context
23933- *
23934- * \retval #VPX_DEC_OK
23935- * The decoder algorithm initialized.
23936- * \retval #VPX_DEC_MEM_ERROR
23937- * Memory allocation failed.
23938- */
23939- vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx) DEPRECATED;
23940-
23941-
23942- /*!\brief Get the capabilities of an algorithm.
23943- *
23944- * Retrieves the capabliities bitfield from the algorithm's interface.
23945- *
23946- * \param[in] iface Pointer to the alogrithm interface
23947- *
23948- */
23949- vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface) DEPRECATED;
23950-
23951-
23952- /*!\brief Parse stream info from a buffer
23953- *
23954- * Performs high level parsing of the bitstream. Construction of a decoder
23955- * context is not necessary. Can be used to determine if the bitstream is
23956- * of the proper format, and to extract information from the stream.
23957- *
23958- * \param[in] iface Pointer to the alogrithm interface
23959- * \param[in] data Pointer to a block of data to parse
23960- * \param[in] data_sz Size of the data buffer
23961- * \param[in,out] si Pointer to stream info to update. The size member
23962- * \ref MUST be properly initialized, but \ref MAY be
23963- * clobbered by the algorithm. This parameter \ref MAY
23964- * be NULL.
23965- *
23966- * \retval #VPX_DEC_OK
23967- * Bitstream is parsable and stream information updated
23968- */
23969- vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
23970- const uint8_t *data,
23971- unsigned int data_sz,
23972- vpx_dec_stream_info_t *si) DEPRECATED;
23973-
23974-
23975- /*!\brief Return information about the current stream.
23976- *
23977- * Returns information about the stream that has been parsed during decoding.
23978- *
23979- * \param[in] ctx Pointer to this instance's context
23980- * \param[in,out] si Pointer to stream info to update. The size member
23981- * \ref MUST be properly initialized, but \ref MAY be
23982- * clobbered by the algorithm. This parameter \ref MAY
23983- * be NULL.
23984- *
23985- * \retval #VPX_DEC_OK
23986- * Bitstream is parsable and stream information updated
23987- */
23988- vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
23989- vpx_dec_stream_info_t *si) DEPRECATED;
23990-
23991-
23992- /*!\brief Control algorithm
23993- *
23994- * This function is used to exchange algorithm specific data with the decoder
23995- * instance. This can be used to implement features specific to a particular
23996- * algorithm.
23997- *
23998- * This wrapper function dispatches the request to the helper function
23999- * associated with the given ctrl_id. It tries to call this function
24000- * transparantly, but will return #VPX_DEC_ERROR if the request could not
24001- * be dispatched.
24002- *
24003- * \param[in] ctx Pointer to this instance's context
24004- * \param[in] ctrl_id Algorithm specific control identifier
24005- * \param[in,out] data Data to exchange with algorithm instance.
24006- *
24007- * \retval #VPX_DEC_OK
24008- * The control request was processed.
24009- * \retval #VPX_DEC_ERROR
24010- * The control request was not processed.
24011- * \retval #VPX_DEC_INVALID_PARAM
24012- * The data was not valid.
24013- */
24014- vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
24015- int ctrl_id,
24016- void *data) DEPRECATED;
24017-
24018- /*!\brief Decode data
24019- *
24020- * Processes a buffer of coded data. If the processing results in a new
24021- * decoded frame becoming available, #VPX_DEC_CB_PUT_SLICE and
24022- * #VPX_DEC_CB_PUT_FRAME events may be generated, as appropriate. Encoded data
24023- * \ref MUST be passed in DTS (decode time stamp) order. Frames produced will
24024- * always be in PTS (presentation time stamp) order.
24025- *
24026- * \param[in] ctx Pointer to this instance's context
24027- * \param[in] data Pointer to this block of new coded data. If
24028- * NULL, a VPX_DEC_CB_PUT_FRAME event is posted
24029- * for the previously decoded frame.
24030- * \param[in] data_sz Size of the coded data, in bytes.
24031- * \param[in] user_priv Application specific data to associate with
24032- * this frame.
24033- * \param[in] rel_pts PTS relative to the previous frame, in us. If
24034- * unknown or unavailable, set to zero.
24035- *
24036- * \return Returns #VPX_DEC_OK if the coded data was processed completely
24037- * and future pictures can be decoded without error. Otherwise,
24038- * see the descriptions of the other error codes in ::vpx_dec_err_t
24039- * for recoverability capabilities.
24040- */
24041- vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
24042- uint8_t *data,
24043- unsigned int data_sz,
24044- void *user_priv,
24045- int rel_pts) DEPRECATED;
24046-
24047-
24048- /*!\brief Decoded frames iterator
24049- *
24050- * Iterates over a list of the frames available for display. The iterator
24051- * storage should be initialized to NULL to start the iteration. Iteration is
24052- * complete when this function returns NULL.
24053- *
24054- * The list of available frames becomes valid upon completion of the
24055- * vpx_dec_decode call, and remains valid until the next call to vpx_dec_decode.
24056- *
24057- * \param[in] ctx Pointer to this instance's context
24058- * \param[in out] iter Iterator storage, initialized to NULL
24059- *
24060- * \return Returns a pointer to an image, if one is ready for display. Frames
24061- * produced will always be in PTS (presentation time stamp) order.
24062- */
24063- vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
24064- vpx_dec_iter_t *iter) DEPRECATED;
24065-
24066-
24067- /*!\defgroup cap_put_frame Frame-Based Decoding Functions
24068- *
24069- * The following functions are required to be implemented for all decoders
24070- * that advertise the VPX_DEC_CAP_PUT_FRAME capability. Calling these functions
24071- * for codecs that don't advertise this capability will result in an error
24072- * code being returned, usually VPX_DEC_ERROR
24073- * @{
24074- */
24075-
24076- /*!\brief put frame callback prototype
24077- *
24078- * This callback is invoked by the decoder to notify the application of
24079- * the availability of decoded image data.
24080- */
24081- typedef void (*vpx_dec_put_frame_cb_fn_t)(void *user_priv,
24082- const vpx_image_t *img);
24083-
24084-
24085- /*!\brief Register for notification of frame completion.
24086- *
24087- * Registers a given function to be called when a decoded frame is
24088- * available.
24089- *
24090- * \param[in] ctx Pointer to this instance's context
24091- * \param[in] cb Pointer to the callback function
24092- * \param[in] user_priv User's private data
24093- *
24094- * \retval #VPX_DEC_OK
24095- * Callback successfully registered.
24096- * \retval #VPX_DEC_ERROR
24097- * Decoder context not initialized, or algorithm not capable of
24098- * posting slice completion.
24099- */
24100- vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
24101- vpx_dec_put_frame_cb_fn_t cb,
24102- void *user_priv) DEPRECATED;
24103-
24104-
24105- /*!@} - end defgroup cap_put_frame */
24106-
24107- /*!\defgroup cap_put_slice Slice-Based Decoding Functions
24108- *
24109- * The following functions are required to be implemented for all decoders
24110- * that advertise the VPX_DEC_CAP_PUT_SLICE capability. Calling these functions
24111- * for codecs that don't advertise this capability will result in an error
24112- * code being returned, usually VPX_DEC_ERROR
24113- * @{
24114- */
24115-
24116- /*!\brief put slice callback prototype
24117- *
24118- * This callback is invoked by the decoder to notify the application of
24119- * the availability of partially decoded image data. The
24120- */
24121- typedef void (*vpx_dec_put_slice_cb_fn_t)(void *user_priv,
24122- const vpx_image_t *img,
24123- const vpx_image_rect_t *valid,
24124- const vpx_image_rect_t *update);
24125-
24126-
24127- /*!\brief Register for notification of slice completion.
24128- *
24129- * Registers a given function to be called when a decoded slice is
24130- * available.
24131- *
24132- * \param[in] ctx Pointer to this instance's context
24133- * \param[in] cb Pointer to the callback function
24134- * \param[in] user_priv User's private data
24135- *
24136- * \retval #VPX_DEC_OK
24137- * Callback successfully registered.
24138- * \retval #VPX_DEC_ERROR
24139- * Decoder context not initialized, or algorithm not capable of
24140- * posting slice completion.
24141- */
24142- vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
24143- vpx_dec_put_slice_cb_fn_t cb,
24144- void *user_priv) DEPRECATED;
24145-
24146-
24147- /*!@} - end defgroup cap_put_slice*/
24148-
24149- /*!\defgroup cap_xma External Memory Allocation Functions
24150- *
24151- * The following functions are required to be implemented for all decoders
24152- * that advertise the VPX_DEC_CAP_XMA capability. Calling these functions
24153- * for codecs that don't advertise this capability will result in an error
24154- * code being returned, usually VPX_DEC_ERROR
24155- * @{
24156- */
24157-
24158- /*!\brief Memory Map Entry
24159- *
24160- * This structure is used to contain the properties of a memory segment. It
24161- * is populated by the decoder in the request phase, and by the calling
24162- * application once the requested allocation has been performed.
24163- */
24164-#if 1
24165-#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
24166-#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
24167-#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
24168- typedef struct vpx_codec_mmap vpx_dec_mmap_t;
24169-#else
24170- typedef struct vpx_dec_mmap
24171- {
24172- /*
24173- * The following members are set by the codec when requesting a segment
24174- */
24175- unsigned int id; /**< identifier for the segment's contents */
24176- unsigned long sz; /**< size of the segment, in bytes */
24177- unsigned int align; /**< required alignment of the segment, in bytes */
24178- unsigned int flags; /**< bitfield containing segment properties */
24179-#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
24180-#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
24181-#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
24182-
24183- /* The following members are to be filled in by the allocation function */
24184- void *base; /**< pointer to the allocated segment */
24185- void (*dtor)(struct vpx_dec_mmap *map); /**< destructor to call */
24186- void *priv; /**< allocator private storage */
24187- } vpx_dec_mmap_t;
24188-#endif
24189-
24190- /*!\brief Initialize a decoder instance in external allocation mode
24191- *
24192- * Initializes a decoder context using the given interface. Applications
24193- * should call the vpx_dec_xma_init convenience macro instead of this
24194- * function directly, to ensure that the ABI version number parameter
24195- * is properly initialized.
24196- *
24197- * \param[in] ctx Pointer to this instance's context.
24198- * \param[in] iface Pointer to the alogrithm interface to use.
24199- * \param[in] ver ABI version number. Must be set to
24200- * VPX_DECODER_ABI_VERSION
24201- * \retval #VPX_DEC_OK
24202- * The decoder algorithm initialized.
24203- * \retval #VPX_DEC_ERROR
24204- * Decoder does not support XMA mode.
24205- */
24206- vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
24207- vpx_dec_iface_t *iface,
24208- int ver) DEPRECATED;
24209-#define vpx_dec_xma_init(ctx, iface) \
24210- vpx_dec_xma_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
24211-
24212-
24213- /*!\brief Iterate over the list of segments to allocate.
24214- *
24215- * Iterates over a list of the segments to allocate. The iterator storage
24216- * should be initialized to NULL to start the iteration. Iteration is complete
24217- * when this function returns VPX_DEC_LIST_END. The amount of memory needed to
24218- * allocate is dependant upon the size of the encoded stream. This means that
24219- * the stream info structure must be known at allocation time. It can be
24220- * populated with the vpx_dec_peek_stream_info() function. In cases where the
24221- * stream to be decoded is not available at allocation time, a fixed size must
24222- * be requested. The decoder will not be able to decode streams larger than
24223- * the size used at allocation time.
24224- *
24225- * \param[in] ctx Pointer to this instance's context.
24226- * \param[out] mmap Pointer to the memory map entry to populate.
24227- * \param[in] si Pointer to the stream info.
24228- * \param[in out] iter Iterator storage, initialized to NULL
24229- *
24230- * \retval #VPX_DEC_OK
24231- * The memory map entry was populated.
24232- * \retval #VPX_DEC_ERROR
24233- * Decoder does not support XMA mode.
24234- * \retval #VPX_DEC_MEM_ERROR
24235- * Unable to determine segment size from stream info.
24236- */
24237- vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx,
24238- vpx_dec_mmap_t *mmap,
24239- const vpx_dec_stream_info_t *si,
24240- vpx_dec_iter_t *iter) DEPRECATED;
24241-
24242-
24243- /*!\brief Identify allocated segments to decoder instance
24244- *
24245- * Stores a list of allocated segments in the decoder. Segments \ref MUST be
24246- * passed in the order they are read from vpx_dec_get_mem_map(), but may be
24247- * passed in groups of any size. Segments \ref MUST be set only once. The
24248- * allocation function \ref MUST ensure that the vpx_dec_mmap_t::base member
24249- * is non-NULL. If the segment requires cleanup handling (eg, calling free()
24250- * or close()) then the vpx_dec_mmap_t::dtor member \ref MUST be populated.
24251- *
24252- * \param[in] ctx Pointer to this instance's context.
24253- * \param[in] mmaps Pointer to the first memory map entry in the list.
24254- * \param[in] num_maps Number of entries being set at this time
24255- *
24256- * \retval #VPX_DEC_OK
24257- * The segment was stored in the decoder context.
24258- * \retval #VPX_DEC_ERROR
24259- * Decoder does not support XMA mode.
24260- * \retval #VPX_DEC_MEM_ERROR
24261- * Segment base address was not set, or segment was already stored.
24262-
24263- */
24264- vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx,
24265- vpx_dec_mmap_t *mmaps,
24266- unsigned int num_maps) DEPRECATED;
24267-
24268- /*!@} - end defgroup cap_xma*/
24269- /*!@} - end defgroup decoder*/
24270-
24271-
24272-#endif
24273-#ifdef __cplusplus
24274-}
24275-#endif
24276diff --git a/vpx_codec/vpx_encoder.h b/vpx_codec/vpx_encoder.h
24277deleted file mode 100644
24278index 67393be..0000000
24279--- a/vpx_codec/vpx_encoder.h
24280+++ /dev/null
24281@@ -1,792 +0,0 @@
24282-/*
24283- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
24284- *
24285- * Use of this source code is governed by a BSD-style license and patent
24286- * grant that can be found in the LICENSE file in the root of the source
24287- * tree. All contributing project authors may be found in the AUTHORS
24288- * file in the root of the source tree.
24289- */
24290-
24291-
24292-/*!\defgroup encoder Encoder Algorithm Interface
24293- * \ingroup codec
24294- * This abstraction allows applications using this encoder to easily support
24295- * multiple video formats with minimal code duplication. This section describes
24296- * the interface common to all encoders.
24297- * @{
24298- */
24299-
24300-/*!\file vpx_encoder.h
24301- * \brief Describes the encoder algorithm interface to applications.
24302- *
24303- * This file describes the interface between an application and a
24304- * video encoder algorithm.
24305- *
24306- */
24307-#ifdef __cplusplus
24308-extern "C" {
24309-#endif
24310-
24311-#ifndef VPX_ENCODER_H
24312-#define VPX_ENCODER_H
24313-#include "vpx_codec.h"
24314-
24315-
24316- /*!\brief Current ABI version number
24317- *
24318- * \internal
24319- * If this file is altered in any way that changes the ABI, this value
24320- * must be bumped. Examples include, but are not limited to, changing
24321- * types, removing or reassigning enums, adding/removing/rearranging
24322- * fields to structures
24323- */
24324-#define VPX_ENCODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
24325-
24326-
24327- /*! \brief Encoder capabilities bitfield
24328- *
24329- * Each encoder advertises the capabilities it supports as part of its
24330- * ::vpx_codec_iface_t interface structure. Capabilities are extra
24331- * interfaces or functionality, and are not required to be supported
24332- * by an encoder.
24333- *
24334- * The available flags are specifiedby VPX_CODEC_CAP_* defines.
24335- */
24336-#define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */
24337-
24338-
24339- /*! \brief Initialization-time Feature Enabling
24340- *
24341- * Certain codec features must be known at initialization time, to allow
24342- * for proper memory allocation.
24343- *
24344- * The available flags are specified by VPX_CODEC_USE_* defines.
24345- */
24346-#define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */
24347-
24348-
24349- /*!\brief Generic fixed size buffer structure
24350- *
24351- * This structure is able to hold a reference to any fixed size buffer.
24352- */
24353- typedef struct vpx_fixed_buf
24354- {
24355- void *buf; /**< Pointer to the data */
24356- size_t sz; /**< Length of the buffer, in chars */
24357- } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */
24358-
24359-
24360- /*!\brief Time Stamp Type
24361- *
24362- * An integer, which when multiplied by the stream's time base, provides
24363- * the absolute time of a sample.
24364- */
24365- typedef int64_t vpx_codec_pts_t;
24366-
24367-
24368- /*!\brief Compressed Frame Flags
24369- *
24370- * This type represents a bitfield containing information about a compressed
24371- * frame that may be useful to an application. The most significant 16 bits
24372- * can be used by an algorithm to provide additional detail, for example to
24373- * support frame types that are codec specific (MPEG-1 D-frames for example)
24374- */
24375- typedef uint32_t vpx_codec_frame_flags_t;
24376-#define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */
24377-#define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting
24378- the stream (no future frame depends on
24379- this one) */
24380-#define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
24381- be shown */
24382-
24383-
24384- /*!\brief Encoder output packet variants
24385- *
24386- * This enumeration lists the different kinds of data packets that can be
24387- * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY
24388- * extend this list to provide additional functionality.
24389- */
24390- enum vpx_codec_cx_pkt_kind
24391- {
24392- VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */
24393- VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */
24394- VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */
24395- VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */
24396- };
24397-
24398-
24399- /*!\brief Encoder output packet
24400- *
24401- * This structure contains the different kinds of output data the encoder
24402- * may produce while compressing a frame.
24403- */
24404- typedef struct vpx_codec_cx_pkt
24405- {
24406- enum vpx_codec_cx_pkt_kind kind; /**< packet variant */
24407- union
24408- {
24409- struct
24410- {
24411- void *buf; /**< compressed data buffer */
24412- size_t sz; /**< length of compressed data */
24413- vpx_codec_pts_t pts; /**< time stamp to show frame
24414- (in timebase units) */
24415- unsigned long duration; /**< duration to show frame
24416- (in timebase units) */
24417- vpx_codec_frame_flags_t flags; /**< flags for this frame */
24418- } frame; /**< data for compressed frame packet */
24419- struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */
24420- struct vpx_psnr_pkt
24421- {
24422- unsigned int samples[4]; /**< Number of samples, total/y/u/v */
24423- uint64_t sse[4]; /**< sum squared error, total/y/u/v */
24424- double psnr[4]; /**< PSNR, total/y/u/v */
24425- } psnr; /**< data for PSNR packet */
24426- struct vpx_fixed_buf raw; /**< data for arbitrary packets */
24427-
24428- /* This packet size is fixed to allow codecs to extend this
24429- * interface without having to manage storage for raw packets,
24430- * ie if it's smaller than 128 bytes, you can store in the
24431- * packet list directly.
24432- */
24433- char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */
24434- } data; /**< packet data */
24435- } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */
24436-
24437-
24438- /*!\brief Rational Number
24439- *
24440- * This structure holds a fractional value.
24441- */
24442- typedef struct vpx_rational
24443- {
24444- int num; /**< fraction numerator */
24445- int den; /**< fraction denominator */
24446- } vpx_rational_t; /**< alias for struct vpx_rational */
24447-
24448-
24449- /*!\brief Multi-pass Encoding Pass */
24450- enum vpx_enc_pass
24451- {
24452- VPX_RC_ONE_PASS, /**< Single pass mode */
24453- VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */
24454- VPX_RC_LAST_PASS, /**< Final pass of multi-pass mode */
24455- };
24456-
24457-
24458- /*!\brief Rate control mode */
24459- enum vpx_rc_mode
24460- {
24461- VPX_VBR, /**< Variable Bit Rate (VBR) mode */
24462- VPX_CBR /**< Constant Bit Rate (CBR) mode */
24463- };
24464-
24465-
24466- /*!\brief Keyframe placement mode.
24467- *
24468- * This enumeration determines whether keyframes are placed automatically by
24469- * the encoder or whether this behavior is disabled. Older releases of this
24470- * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
24471- * This name is confusing for this behavior, so the new symbols to be used
24472- * are VPX_KF_AUTO and VPX_KF_DISABLED.
24473- */
24474- enum vpx_kf_mode
24475- {
24476- VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */
24477- VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */
24478- VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
24479- };
24480-
24481-
24482- /*!\brief Encoded Frame Flags
24483- *
24484- * This type indicates a bitfield to be passed to vpx_codec_encode(), defining
24485- * per-frame boolean values. By convention, bits common to all codecs will be
24486- * named VPX_EFLAG_*, and bits specific to an algorithm will be named
24487- * /algo/_eflag_*. The lower order 16 bits are reserved for common use.
24488- */
24489- typedef long vpx_enc_frame_flags_t;
24490-#define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */
24491-
24492-
24493- /*!\brief Encoder configuration structure
24494- *
24495- * This structure contains the encoder settings that have common representations
24496- * across all codecs. This doesn't imply that all codecs support all features,
24497- * however.
24498- */
24499- typedef struct vpx_codec_enc_cfg
24500- {
24501- /*
24502- * generic settings (g)
24503- */
24504-
24505- /*!\brief Algorithm specific "usage" value
24506- *
24507- * Algorithms may define multiple values for usage, which may convey the
24508- * intent of how the application intends to use the stream. If this value
24509- * is non-zero, consult the documentation for the codec to determine its
24510- * meaning.
24511- */
24512- unsigned int g_usage;
24513-
24514-
24515- /*!\brief Maximum number of threads to use
24516- *
24517- * For multi-threaded implementations, use no more than this number of
24518- * threads. The codec may use fewer threads than allowed. The value
24519- * 0 is equivalent to the value 1.
24520- */
24521- unsigned int g_threads;
24522-
24523-
24524- /*!\brief Bitstream profile to use
24525- *
24526- * Some codecs support a notion of multiple bitstream profiles. Typically
24527- * this maps to a set of features that are turned on or off. Often the
24528- * profile to use is determined by the features of the intended decoder.
24529- * Consult the documentation for the codec to determine the valid values
24530- * for this parameter, or set to zero for a sane default.
24531- */
24532- unsigned int g_profile; /**< profile of bitstream to use */
24533-
24534-
24535-
24536- /*!\brief Width of the frame
24537- *
24538- * This value identifies the presentation resolution of the frame,
24539- * in pixels. Note that the frames passed as input to the encoder must
24540- * have this resolution. Frames will be presented by the decoder in this
24541- * resolution, independent of any spatial resampling the encoder may do.
24542- */
24543- unsigned int g_w;
24544-
24545-
24546- /*!\brief Height of the frame
24547- *
24548- * This value identifies the presentation resolution of the frame,
24549- * in pixels. Note that the frames passed as input to the encoder must
24550- * have this resolution. Frames will be presented by the decoder in this
24551- * resolution, independent of any spatial resampling the encoder may do.
24552- */
24553- unsigned int g_h;
24554-
24555-
24556- /*!\brief Stream timebase units
24557- *
24558- * Indicates the smallest interval of time, in seconds, used by the stream.
24559- * For fixed frame rate material, or variable frame rate material where
24560- * frames are timed at a multiple of a given clock (ex: video capture),
24561- * the \ref RECOMMENDED method is to set the timebase to the reciprocal
24562- * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
24563- * pts to correspond to the frame number, which can be handy. For
24564- * re-encoding video from containers with absolute time timestamps, the
24565- * \ref RECOMMENDED method is to set the timebase to that of the parent
24566- * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
24567- */
24568- struct vpx_rational g_timebase;
24569-
24570-
24571- /*!\brief Enable error resilient mode.
24572- *
24573- * Error resilient mode indicates to the encoder that it should take
24574- * measures appropriate for streaming over lossy or noisy links, if
24575- * possible. Set to 1 to enable this feature, 0 to disable it.
24576- */
24577- unsigned int g_error_resilient;
24578-
24579-
24580- /*!\brief Multi-pass Encoding Mode
24581- *
24582- * This value should be set to the current phase for multi-pass encoding.
24583- * For single pass, set to #VPX_RC_ONE_PASS.
24584- */
24585- enum vpx_enc_pass g_pass;
24586-
24587-
24588- /*!\brief Allow lagged encoding
24589- *
24590- * If set, this value allows the encoder to consume a number of input
24591- * frames before producing output frames. This allows the encoder to
24592- * base decisions for the current frame on future frames. This does
24593- * increase the latency of the encoding pipeline, so it is not appropriate
24594- * in all situations (ex: realtime encoding).
24595- *
24596- * Note that this is a maximum value -- the encoder may produce frames
24597- * sooner than the given limit. Set this value to 0 to disable this
24598- * feature.
24599- */
24600- unsigned int g_lag_in_frames;
24601-
24602-
24603- /*
24604- * rate control settings (rc)
24605- */
24606-
24607- /*!\brief Temporal resampling configuration, if supported by the codec.
24608- *
24609- * Temporal resampling allows the codec to "drop" frames as a strategy to
24610- * meet its target data rate. This can cause temporal discontinuities in
24611- * the encoded video, which may appear as stuttering during playback. This
24612- * trade-off is often acceptable, but for many applications is not. It can
24613- * be disabled in these cases.
24614- *
24615- * Note that not all codecs support this feature. All vpx VPx codecs do.
24616- * For other codecs, consult the documentation for that algorithm.
24617- *
24618- * This threshold is described as a percentage of the target data buffer.
24619- * When the data buffer falls below this percentage of fullness, a
24620- * dropped frame is indicated. Set the threshold to zero (0) to disable
24621- * this feature.
24622- */
24623- unsigned int rc_dropframe_thresh;
24624-
24625-
24626- /*!\brief Enable/disable spatial resampling, if supported by the codec.
24627- *
24628- * Spatial resampling allows the codec to compress a lower resolution
24629- * version of the frame, which is then upscaled by the encoder to the
24630- * correct presentation resolution. This increases visual quality at
24631- * low data rates, at the expense of CPU time on the encoder/decoder.
24632- */
24633- unsigned int rc_resize_allowed;
24634-
24635-
24636- /*!\brief Spatial resampling up watermark.
24637- *
24638- * This threshold is described as a percentage of the target data buffer.
24639- * When the data buffer rises above this percentage of fullness, the
24640- * encoder will step up to a higher resolution version of the frame.
24641- */
24642- unsigned int rc_resize_up_thresh;
24643-
24644-
24645- /*!\brief Spatial resampling down watermark.
24646- *
24647- * This threshold is described as a percentage of the target data buffer.
24648- * When the data buffer falls below this percentage of fullness, the
24649- * encoder will step down to a lower resolution version of the frame.
24650- */
24651- unsigned int rc_resize_down_thresh;
24652-
24653-
24654- /*!\brief Rate control algorithm to use.
24655- *
24656- * Indicates whether the end usage of this stream is to be streamed over
24657- * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
24658- * mode should be used, or whether it will be played back on a high
24659- * bandwidth link, as from a local disk, where higher variations in
24660- * bitrate are acceptable.
24661- */
24662- enum vpx_rc_mode rc_end_usage;
24663-
24664-
24665- /*!\brief Two-pass stats buffer.
24666- *
24667- * A buffer containing all of the stats packets produced in the first
24668- * pass, concatenated.
24669- */
24670- struct vpx_fixed_buf rc_twopass_stats_in;
24671-
24672-
24673- /*!\brief Target data rate
24674- *
24675- * Target bandwidth to use for this stream, in kilobits per second.
24676- */
24677- unsigned int rc_target_bitrate;
24678-
24679-
24680- /*
24681- * quantizer settings
24682- */
24683-
24684-
24685- /*!\brief Minimum (Best Quality) Quantizer
24686- *
24687- * The quantizer is the most direct control over the quality of the
24688- * encoded image. The range of valid values for the quantizer is codec
24689- * specific. Consult the documentation for the codec to determine the
24690- * values to use. To determine the range programmatically, call
24691- * vpx_codec_enc_config_default() with a usage value of 0.
24692- */
24693- unsigned int rc_min_quantizer;
24694-
24695-
24696- /*!\brief Maximum (Worst Quality) Quantizer
24697- *
24698- * The quantizer is the most direct control over the quality of the
24699- * encoded image. The range of valid values for the quantizer is codec
24700- * specific. Consult the documentation for the codec to determine the
24701- * values to use. To determine the range programmatically, call
24702- * vpx_codec_enc_config_default() with a usage value of 0.
24703- */
24704- unsigned int rc_max_quantizer;
24705-
24706-
24707- /*
24708- * bitrate tolerance
24709- */
24710-
24711-
24712- /*!\brief Rate control undershoot tolerance
24713- *
24714- * This value, expressed as a percentage of the target bitrate, describes
24715- * the target bitrate for easier frames, allowing bits to be saved for
24716- * harder frames. Set to zero to use the codec default.
24717- */
24718- unsigned int rc_undershoot_pct;
24719-
24720-
24721- /*!\brief Rate control overshoot tolerance
24722- *
24723- * This value, expressed as a percentage of the target bitrate, describes
24724- * the maximum allowed bitrate for a given frame. Set to zero to use the
24725- * codec default.
24726- */
24727- unsigned int rc_overshoot_pct;
24728-
24729-
24730- /*
24731- * decoder buffer model parameters
24732- */
24733-
24734-
24735- /*!\brief Decoder Buffer Size
24736- *
24737- * This value indicates the amount of data that may be buffered by the
24738- * decoding application. Note that this value is expressed in units of
24739- * time (milliseconds). For example, a value of 5000 indicates that the
24740- * client will buffer (at least) 5000ms worth of encoded data. Use the
24741- * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
24742- * necessary.
24743- */
24744- unsigned int rc_buf_sz;
24745-
24746-
24747- /*!\brief Decoder Buffer Initial Size
24748- *
24749- * This value indicates the amount of data that will be buffered by the
24750- * decoding application prior to beginning playback. This value is
24751- * expressed in units of time (milliseconds). Use the target bitrate
24752- * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
24753- */
24754- unsigned int rc_buf_initial_sz;
24755-
24756-
24757- /*!\brief Decoder Buffer Optimal Size
24758- *
24759- * This value indicates the amount of data that the encoder should try
24760- * to maintain in the decoder's buffer. This value is expressed in units
24761- * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
24762- * to convert to bits/bytes, if necessary.
24763- */
24764- unsigned int rc_buf_optimal_sz;
24765-
24766-
24767- /*
24768- * 2 pass rate control parameters
24769- */
24770-
24771-
24772- /*!\brief Two-pass mode CBR/VBR bias
24773- *
24774- * Bias, expressed on a scale of 0 to 100, for determining target size
24775- * for the current frame. The value 0 indicates the optimal CBR mode
24776- * value should be used. The value 100 indicates the optimal VBR mode
24777- * value should be used. Values in between indicate which way the
24778- * encoder should "lean."
24779- */
24780- unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias between CBR and VBR(0-100: 0->CBR, 100->VBR) */
24781-
24782-
24783- /*!\brief Two-pass mode per-GOP minimum bitrate
24784- *
24785- * This value, expressed as a percentage of the target bitrate, indicates
24786- * the minimum bitrate to be used for a single GOP (aka "section")
24787- */
24788- unsigned int rc_2pass_vbr_minsection_pct;
24789-
24790-
24791- /*!\brief Two-pass mode per-GOP maximum bitrate
24792- *
24793- * This value, expressed as a percentage of the target bitrate, indicates
24794- * the maximum bitrate to be used for a single GOP (aka "section")
24795- */
24796- unsigned int rc_2pass_vbr_maxsection_pct;
24797-
24798-
24799- /*
24800- * keyframing settings (kf)
24801- */
24802-
24803- /*!\brief Keyframe placement mode
24804- *
24805- * This value indicates whether the encoder should place keyframes at a
24806- * fixed interval, or determine the optimal placement automatically
24807- * (as governed by the #kf_min_dist and #kf_max_dist parameters)
24808- */
24809- enum vpx_kf_mode kf_mode;
24810-
24811-
24812- /*!\brief Keyframe minimum interval
24813- *
24814- * This value, expressed as a number of frames, prevents the encoder from
24815- * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
24816- * least kf_min_dist frames non-keyframes will be coded before the next
24817- * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
24818- */
24819- unsigned int kf_min_dist;
24820-
24821-
24822- /*!\brief Keyframe maximum interval
24823- *
24824- * This value, expressed as a number of frames, forces the encoder to code
24825- * a keyframe if one has not been coded in the last kf_max_dist frames.
24826- * A value of 0 implies all frames will be keyframes. Set kf_min_dist
24827- * equal to kf_max_dist for a fixed interval.
24828- */
24829- unsigned int kf_max_dist;
24830-
24831- } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */
24832-
24833-
24834- /*!\brief Initialize an encoder instance
24835- *
24836- * Initializes a encoder context using the given interface. Applications
24837- * should call the vpx_codec_enc_init convenience macro instead of this
24838- * function directly, to ensure that the ABI version number parameter
24839- * is properly initialized.
24840- *
24841- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
24842- * parameter), the storage pointed to by the cfg parameter must be
24843- * kept readable and stable until all memory maps have been set.
24844- *
24845- * \param[in] ctx Pointer to this instance's context.
24846- * \param[in] iface Pointer to the algorithm interface to use.
24847- * \param[in] cfg Configuration to use, if known. May be NULL.
24848- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
24849- * \param[in] ver ABI version number. Must be set to
24850- * VPX_ENCODER_ABI_VERSION
24851- * \retval #VPX_CODEC_OK
24852- * The decoder algorithm initialized.
24853- * \retval #VPX_CODEC_MEM_ERROR
24854- * Memory allocation failed.
24855- */
24856- vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
24857- vpx_codec_iface_t *iface,
24858- vpx_codec_enc_cfg_t *cfg,
24859- vpx_codec_flags_t flags,
24860- int ver);
24861-
24862-
24863- /*!\brief Convenience macro for vpx_codec_enc_init_ver()
24864- *
24865- * Ensures the ABI version parameter is properly set.
24866- */
24867-#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
24868- vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
24869-
24870-
24871- /*!\brief Get a default configuration
24872- *
24873- * Initializes a encoder configuration structure with default values. Supports
24874- * the notion of "usages" so that an algorithm may offer different default
24875- * settings depending on the user's intended goal. This function \ref SHOULD
24876- * be called by all applications to initialize the configuration structure
24877- * before specializing the configuration with application specific values.
24878- *
24879- * \param[in] iface Pointer to the algorithm interface to use.
24880- * \param[out] cfg Configuration buffer to populate
24881- * \param[in] usage End usage. Set to 0 or use codec specific values.
24882- *
24883- * \retval #VPX_CODEC_OK
24884- * The configuration was populated.
24885- * \retval #VPX_CODEC_INCAPABLE
24886- * Interface is not an encoder interface.
24887- * \retval #VPX_CODEC_INVALID_PARAM
24888- * A parameter was NULL, or the usage value was not recognized.
24889- */
24890- vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
24891- vpx_codec_enc_cfg_t *cfg,
24892- unsigned int usage);
24893-
24894-
24895- /*!\brief Set or change configuration
24896- *
24897- * Reconfigures an encoder instance according to the given configuration.
24898- *
24899- * \param[in] ctx Pointer to this instance's context
24900- * \param[in] cfg Configuration buffer to use
24901- *
24902- * \retval #VPX_CODEC_OK
24903- * The configuration was populated.
24904- * \retval #VPX_CODEC_INCAPABLE
24905- * Interface is not an encoder interface.
24906- * \retval #VPX_CODEC_INVALID_PARAM
24907- * A parameter was NULL, or the usage value was not recognized.
24908- */
24909- vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
24910- const vpx_codec_enc_cfg_t *cfg);
24911-
24912-
24913- /*!\brief Get global stream headers
24914- *
24915- * Retrieves a stream level global header packet, if supported by the codec.
24916- *
24917- * \param[in] ctx Pointer to this instance's context
24918- *
24919- * \retval NULL
24920- * Encoder does not support global header
24921- * \retval Non-NULL
24922- * Pointer to buffer containing global header packet
24923- */
24924- vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx);
24925-
24926-
24927-#define VPX_DL_REALTIME (1) /**< deadline parameter analogous to
24928- * VPx REALTIME mode. */
24929-#define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to
24930- * VPx GOOD QUALITY mode. */
24931-#define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to
24932- * VPx BEST QUALITY mode. */
24933- /*!\brief Encode a frame
24934- *
24935- * Encodes a video frame at the given "presentation time." The presentation
24936- * time stamp (PTS) \ref MUST be strictly increasing.
24937- *
24938- * The encoder supports the notion of a soft real-time deadline. Given a
24939- * non-zero value to the deadline parameter, the encoder will make a "best
24940- * effort" guarantee to return before the given time slice expires. It is
24941- * implicit that limiting the available time to encode will degrade the
24942- * output quality. The encoder can be given an unlimited time to produce the
24943- * best possible frame by specifying a deadline of '0'. This deadline
24944- * supercedes the VPx notion of "best quality, good quality, realtime".
24945- * Applications that wish to map these former settings to the new deadline
24946- * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
24947- * and #VPX_DL_BEST_QUALITY.
24948- *
24949- * When the last frame has been passed to the encoder, this function should
24950- * continue to be called, with the img parameter set to NULL. This will
24951- * signal the end-of-stream condition to the encoder and allow it to encode
24952- * any held buffers. Encoding is complete when vpx_codec_encode() is called
24953- * and vpx_codec_get_cx_data() returns no data.
24954- *
24955- * \param[in] ctx Pointer to this instance's context
24956- * \param[in] img Image data to encode, NULL to flush.
24957- * \param[in] pts Presentation time stamp, in timebase units.
24958- * \param[in] duration Duration to show frame, in timebase units.
24959- * \param[in] flags Flags to use for encoding this frame.
24960- * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
24961- *
24962- * \retval #VPX_CODEC_OK
24963- * The configuration was populated.
24964- * \retval #VPX_CODEC_INCAPABLE
24965- * Interface is not an encoder interface.
24966- * \retval #VPX_CODEC_INVALID_PARAM
24967- * A parameter was NULL, the image format is unsupported, etc.
24968- */
24969- vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
24970- const vpx_image_t *img,
24971- vpx_codec_pts_t pts,
24972- unsigned long duration,
24973- vpx_enc_frame_flags_t flags,
24974- unsigned long deadline);
24975-
24976-
24977- /*!\brief Set compressed data output buffer
24978- *
24979- * Sets the buffer that the codec should output the compressed data
24980- * into. This call effectively sets the buffer pointer returned in the
24981- * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be
24982- * appended into this buffer. The buffer is preserved across frames,
24983- * so applications must periodically call this function after flushing
24984- * the accumulated compressed data to disk or to the network to reset
24985- * the pointer to the buffer's head.
24986- *
24987- * `pad_before` bytes will be skipped before writing the compressed
24988- * data, and `pad_after` bytes will be appended to the packet. The size
24989- * of the packet will be the sum of the size of the actual compressed
24990- * data, pad_before, and pad_after. The padding bytes will be preserved
24991- * (not overwritten).
24992- *
24993- * Note that calling this function does not guarantee that the returned
24994- * compressed data will be placed into the specified buffer. In the
24995- * event that the encoded data will not fit into the buffer provided,
24996- * the returned packet \ref MAY point to an internal buffer, as it would
24997- * if this call were never used. In this event, the output packet will
24998- * NOT have any padding, and the application must free space and copy it
24999- * to the proper place. This is of particular note in configurations
25000- * that may output multiple packets for a single encoded frame (e.g., lagged
25001- * encoding) or if the application does not reset the buffer periodically.
25002- *
25003- * Applications may restore the default behavior of the codec providing
25004- * the compressed data buffer by calling this function with a NULL
25005- * buffer.
25006- *
25007- * Applications \ref MUSTNOT call this function during iteration of
25008- * vpx_codec_get_cx_data().
25009- *
25010- * \param[in] ctx Pointer to this instance's context
25011- * \param[in] buf Buffer to store compressed data into
25012- * \param[in] pad_before Bytes to skip before writing compressed data
25013- * \param[in] pad_after Bytes to skip after writing compressed data
25014- *
25015- * \retval #VPX_CODEC_OK
25016- * The buffer was set successfully.
25017- * \retval #VPX_CODEC_INVALID_PARAM
25018- * A parameter was NULL, the image format is unsupported, etc.
25019- */
25020- vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
25021- const vpx_fixed_buf_t *buf,
25022- unsigned int pad_before,
25023- unsigned int pad_after);
25024-
25025-
25026- /*!\brief Encoded data iterator
25027- *
25028- * Iterates over a list of data packets to be passed from the encoder to the
25029- * application. The different kinds of packets available are enumerated in
25030- * #vpx_codec_cx_pkt_kind.
25031- *
25032- * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's
25033- * muxer. Multiple compressed frames may be in the list.
25034- * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer.
25035- *
25036- * The application \ref MUST silently ignore any packet kinds that it does
25037- * not recognize or support.
25038- *
25039- * The data buffers returned from this function are only guaranteed to be
25040- * valid until the application makes another call to any vpx_codec_* function.
25041- *
25042- * \param[in] ctx Pointer to this instance's context
25043- * \param[in,out] iter Iterator storage, initialized to NULL
25044- *
25045- * \return Returns a pointer to an output data packet (compressed frame data,
25046- * two-pass statistics, etc.) or NULL to signal end-of-list.
25047- *
25048- */
25049- const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
25050- vpx_codec_iter_t *iter);
25051-
25052-
25053- /*!\brief Get Preview Frame
25054- *
25055- * Returns an image that can be used as a preview. Shows the image as it would
25056- * exist at the decompressor. The application \ref MUST NOT write into this
25057- * image buffer.
25058- *
25059- * \param[in] ctx Pointer to this instance's context
25060- *
25061- * \return Returns a pointer to a preview image, or NULL if no image is
25062- * available.
25063- *
25064- */
25065- const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx);
25066-
25067-
25068- /*!@} - end defgroup encoder*/
25069-
25070-#endif
25071-#ifdef __cplusplus
25072-}
25073-#endif
25074diff --git a/vpx_codec/vpx_image.h b/vpx_codec/vpx_image.h
25075deleted file mode 100644
25076index a8a9416..0000000
25077--- a/vpx_codec/vpx_image.h
25078+++ /dev/null
25079@@ -1,201 +0,0 @@
25080-/*
25081- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25082- *
25083- * Use of this source code is governed by a BSD-style license and patent
25084- * grant that can be found in the LICENSE file in the root of the source
25085- * tree. All contributing project authors may be found in the AUTHORS
25086- * file in the root of the source tree.
25087- */
25088-
25089-
25090-/*!\file vpx_image.h
25091- * \brief Describes the vpx image descriptor and associated operations
25092- *
25093- */
25094-#ifdef __cplusplus
25095-extern "C" {
25096-#endif
25097-
25098-#ifndef VPX_IMAGE_H
25099-#define VPX_IMAGE_H
25100-
25101- /*!\brief Current ABI version number
25102- *
25103- * \internal
25104- * If this file is altered in any way that changes the ABI, this value
25105- * must be bumped. Examples include, but are not limited to, changing
25106- * types, removing or reassigning enums, adding/removing/rearranging
25107- * fields to structures
25108- */
25109-#define VPX_IMAGE_ABI_VERSION (1) /**<\hideinitializer*/
25110-
25111-
25112-#define IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
25113-#define IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
25114-#define IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel componnent */
25115-
25116-
25117- /*!\brief List of supported image formats */
25118- typedef enum img_fmt {
25119- IMG_FMT_NONE,
25120- IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
25121- IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
25122- IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
25123- IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
25124- IMG_FMT_UYVY, /**< UYVY packed YUV */
25125- IMG_FMT_YUY2, /**< YUYV packed YUV */
25126- IMG_FMT_YVYU, /**< YVYU packed YUV */
25127- IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
25128- IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
25129- IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
25130- IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
25131- IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
25132- IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
25133- IMG_FMT_YV12 = IMG_FMT_PLANAR | IMG_FMT_UV_FLIP | 1, /**< planar YVU */
25134- IMG_FMT_I420 = IMG_FMT_PLANAR | 2,
25135- IMG_FMT_VPXYV12 = IMG_FMT_PLANAR | IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
25136- IMG_FMT_VPXI420 = IMG_FMT_PLANAR | 4, /** < planar 4:2:0 format with vpx color space */
25137- }
25138- img_fmt_t; /**< alias for enum img_fmt */
25139-
25140-
25141- /**\brief Image Descriptor */
25142- typedef struct
25143- {
25144- img_fmt_t fmt; /**< Image Format */
25145-
25146- /* Image storage dimensions */
25147- unsigned int w; /**< Stored image width */
25148- unsigned int h; /**< Stored image height */
25149-
25150- /* Image display dimensions */
25151- unsigned int d_w; /**< Displayed image width */
25152- unsigned int d_h; /**< Displayed image height */
25153-
25154- /* Chroma subsampling info */
25155- unsigned int x_chroma_shift; /**< subsampling order, X */
25156- unsigned int y_chroma_shift; /**< subsampling order, Y */
25157-
25158- /* Image data pointers. */
25159-#define PLANE_PACKED 0 /**< To be used for all packed formats */
25160-#define PLANE_Y 0 /**< Y (Luminance) plane */
25161-#define PLANE_U 1 /**< U (Chroma) plane */
25162-#define PLANE_V 2 /**< V (Chroma) plane */
25163-#define PLANE_ALPHA 3 /**< A (Transparancy) plane */
25164- unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
25165- int stride[4]; /**< stride between rows for each plane */
25166-
25167- int bps; /**< bits per sample (for packed formats) */
25168-
25169- /* The following member may be set by the application to associate data
25170- * with this image.
25171- */
25172- void *user_priv; /**< may be set by the application to associate data
25173- * with this image. */
25174-
25175- /* The following members should be treated as private. */
25176- unsigned char *img_data; /**< private */
25177- int img_data_owner; /**< private */
25178- int self_allocd; /**< private */
25179- } vpx_image_t; /**< alias for struct vpx_image */
25180-
25181- /**\brief Representation of a rectangle on a surface */
25182- typedef struct vpx_image_rect
25183- {
25184- unsigned int x; /**< leftmost column */
25185- unsigned int y; /**< topmost row */
25186- unsigned int w; /**< width */
25187- unsigned int h; /**< height */
25188- } vpx_image_rect_t; /**< alias for struct vpx_image_rect */
25189-
25190- /*!\brief Open a descriptor, allocating storage for the underlying image
25191- *
25192- * Returns a descriptor for storing an image of the given format. The
25193- * storage for the descriptor is allocated on the heap.
25194- *
25195- * \param[in] img Pointer to storage for descriptor. If this parameter
25196- * is NULL, the storage for the descriptor will be
25197- * allocated on the heap.
25198- * \param[in] fmt Format for the image
25199- * \param[in] d_w Width of the image
25200- * \param[in] d_h Height of the image
25201- * \param[in] align Alignment, in bytes, of each row in the image.
25202- *
25203- * \return Returns a pointer to the initialized image descriptor. If the img
25204- * parameter is non-null, the value of the img parameter will be
25205- * returned.
25206- */
25207- vpx_image_t *vpx_img_alloc(vpx_image_t *img,
25208- img_fmt_t fmt,
25209- unsigned int d_w,
25210- unsigned int d_h,
25211- unsigned int align);
25212-
25213- /*!\brief Open a descriptor, using existing storage for the underlying image
25214- *
25215- * Returns a descriptor for storing an image of the given format. The
25216- * storage for descriptor has been allocated elsewhere, and a descriptor is
25217- * desired to "wrap" that storage.
25218- *
25219- * \param[in] img Pointer to storage for descriptor. If this parameter
25220- * is NULL, the storage for the descriptor will be
25221- * allocated on the heap.
25222- * \param[in] fmt Format for the image
25223- * \param[in] d_w Width of the image
25224- * \param[in] d_h Height of the image
25225- * \param[in] align Alignment, in bytes, of each row in the image.
25226- * \param[in] img_data Storage to use for the image
25227- *
25228- * \return Returns a pointer to the initialized image descriptor. If the img
25229- * parameter is non-null, the value of the img parameter will be
25230- * returned.
25231- */
25232- vpx_image_t *vpx_img_wrap(vpx_image_t *img,
25233- img_fmt_t fmt,
25234- unsigned int d_w,
25235- unsigned int d_h,
25236- unsigned int align,
25237- unsigned char *img_data);
25238-
25239-
25240- /*!\brief Set the rectangle identifying the displayed portion of the image
25241- *
25242- * Updates the displayed rectangle (aka viewport) on the image surface to
25243- * match the specified coordinates and size.
25244- *
25245- * \param[in] img Image descriptor
25246- * \param[in] x leftmost column
25247- * \param[in] y topmost row
25248- * \param[in] w width
25249- * \param[in] h height
25250- *
25251- * \return 0 if the requested rectangle is valid, nonzero otherwise.
25252- */
25253- int vpx_img_set_rect(vpx_image_t *img,
25254- unsigned int x,
25255- unsigned int y,
25256- unsigned int w,
25257- unsigned int h);
25258-
25259-
25260- /*!\brief Flip the image vertically (top for bottom)
25261- *
25262- * Adjusts the image descriptor's pointers and strides to make the image
25263- * be referenced upside-down.
25264- *
25265- * \param[in] img Image descriptor
25266- */
25267- void vpx_img_flip(vpx_image_t *img);
25268-
25269- /*!\brief Close an image descriptor
25270- *
25271- * Frees all allocated storage associated with an image descriptor.
25272- *
25273- * \param[in] img Image descriptor
25274- */
25275- void vpx_img_free(vpx_image_t *img);
25276-
25277-#endif
25278-#ifdef __cplusplus
25279-}
25280-#endif
25281diff --git a/vpx_mem/include/nds/vpx_mem_nds.h b/vpx_mem/include/nds/vpx_mem_nds.h
25282index c332403..361c29b 100644
25283--- a/vpx_mem/include/nds/vpx_mem_nds.h
25284+++ b/vpx_mem/include/nds/vpx_mem_nds.h
25285@@ -1,10 +1,11 @@
25286 /*
25287 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25288 *
25289- * Use of this source code is governed by a BSD-style license and patent
25290- * grant that can be found in the LICENSE file in the root of the source
25291- * tree. All contributing project authors may be found in the AUTHORS
25292- * file in the root of the source tree.
25293+ * Use of this source code is governed by a BSD-style license
25294+ * that can be found in the LICENSE file in the root of the source
25295+ * tree. An additional intellectual property rights grant can be found
25296+ * in the file PATENTS. All contributing project authors may
25297+ * be found in the AUTHORS file in the root of the source tree.
25298 */
25299
25300
25301diff --git a/vpx_mem/include/vpx_mem_intrnl.h b/vpx_mem/include/vpx_mem_intrnl.h
25302index 3b68d86..4605b34 100644
25303--- a/vpx_mem/include/vpx_mem_intrnl.h
25304+++ b/vpx_mem/include/vpx_mem_intrnl.h
25305@@ -1,10 +1,11 @@
25306 /*
25307 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25308 *
25309- * Use of this source code is governed by a BSD-style license and patent
25310- * grant that can be found in the LICENSE file in the root of the source
25311- * tree. All contributing project authors may be found in the AUTHORS
25312- * file in the root of the source tree.
25313+ * Use of this source code is governed by a BSD-style license
25314+ * that can be found in the LICENSE file in the root of the source
25315+ * tree. An additional intellectual property rights grant can be found
25316+ * in the file PATENTS. All contributing project authors may
25317+ * be found in the AUTHORS file in the root of the source tree.
25318 */
25319
25320
25321diff --git a/vpx_mem/include/vpx_mem_tracker.h b/vpx_mem/include/vpx_mem_tracker.h
25322index ab85d19..49f783e 100644
25323--- a/vpx_mem/include/vpx_mem_tracker.h
25324+++ b/vpx_mem/include/vpx_mem_tracker.h
25325@@ -1,10 +1,11 @@
25326 /*
25327 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25328 *
25329- * Use of this source code is governed by a BSD-style license and patent
25330- * grant that can be found in the LICENSE file in the root of the source
25331- * tree. All contributing project authors may be found in the AUTHORS
25332- * file in the root of the source tree.
25333+ * Use of this source code is governed by a BSD-style license
25334+ * that can be found in the LICENSE file in the root of the source
25335+ * tree. An additional intellectual property rights grant can be found
25336+ * in the file PATENTS. All contributing project authors may
25337+ * be found in the AUTHORS file in the root of the source tree.
25338 */
25339
25340
25341diff --git a/vpx_mem/intel_linux/vpx_mem.c b/vpx_mem/intel_linux/vpx_mem.c
25342index 002e407..7bce794 100644
25343--- a/vpx_mem/intel_linux/vpx_mem.c
25344+++ b/vpx_mem/intel_linux/vpx_mem.c
25345@@ -1,10 +1,11 @@
25346 /*
25347 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25348 *
25349- * Use of this source code is governed by a BSD-style license and patent
25350- * grant that can be found in the LICENSE file in the root of the source
25351- * tree. All contributing project authors may be found in the AUTHORS
25352- * file in the root of the source tree.
25353+ * Use of this source code is governed by a BSD-style license
25354+ * that can be found in the LICENSE file in the root of the source
25355+ * tree. An additional intellectual property rights grant can be found
25356+ * in the file PATENTS. All contributing project authors may
25357+ * be found in the AUTHORS file in the root of the source tree.
25358 */
25359
25360
25361diff --git a/vpx_mem/intel_linux/vpx_mem_tracker.c b/vpx_mem/intel_linux/vpx_mem_tracker.c
25362index fa023e3..fcbebc9 100644
25363--- a/vpx_mem/intel_linux/vpx_mem_tracker.c
25364+++ b/vpx_mem/intel_linux/vpx_mem_tracker.c
25365@@ -1,10 +1,11 @@
25366 /*
25367 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25368 *
25369- * Use of this source code is governed by a BSD-style license and patent
25370- * grant that can be found in the LICENSE file in the root of the source
25371- * tree. All contributing project authors may be found in the AUTHORS
25372- * file in the root of the source tree.
25373+ * Use of this source code is governed by a BSD-style license
25374+ * that can be found in the LICENSE file in the root of the source
25375+ * tree. An additional intellectual property rights grant can be found
25376+ * in the file PATENTS. All contributing project authors may
25377+ * be found in the AUTHORS file in the root of the source tree.
25378 */
25379
25380
25381diff --git a/vpx_mem/memory_manager/hmm_alloc.c b/vpx_mem/memory_manager/hmm_alloc.c
25382index 9abd81e..3f10097 100644
25383--- a/vpx_mem/memory_manager/hmm_alloc.c
25384+++ b/vpx_mem/memory_manager/hmm_alloc.c
25385@@ -1,10 +1,11 @@
25386 /*
25387 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25388 *
25389- * Use of this source code is governed by a BSD-style license and patent
25390- * grant that can be found in the LICENSE file in the root of the source
25391- * tree. All contributing project authors may be found in the AUTHORS
25392- * file in the root of the source tree.
25393+ * Use of this source code is governed by a BSD-style license
25394+ * that can be found in the LICENSE file in the root of the source
25395+ * tree. An additional intellectual property rights grant can be found
25396+ * in the file PATENTS. All contributing project authors may
25397+ * be found in the AUTHORS file in the root of the source tree.
25398 */
25399
25400
25401diff --git a/vpx_mem/memory_manager/hmm_base.c b/vpx_mem/memory_manager/hmm_base.c
25402index 0cacc3f..fbc36de 100644
25403--- a/vpx_mem/memory_manager/hmm_base.c
25404+++ b/vpx_mem/memory_manager/hmm_base.c
25405@@ -1,10 +1,11 @@
25406 /*
25407 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25408 *
25409- * Use of this source code is governed by a BSD-style license and patent
25410- * grant that can be found in the LICENSE file in the root of the source
25411- * tree. All contributing project authors may be found in the AUTHORS
25412- * file in the root of the source tree.
25413+ * Use of this source code is governed by a BSD-style license
25414+ * that can be found in the LICENSE file in the root of the source
25415+ * tree. An additional intellectual property rights grant can be found
25416+ * in the file PATENTS. All contributing project authors may
25417+ * be found in the AUTHORS file in the root of the source tree.
25418 */
25419
25420
25421diff --git a/vpx_mem/memory_manager/hmm_dflt_abort.c b/vpx_mem/memory_manager/hmm_dflt_abort.c
25422index dc59f55..71b41d9 100644
25423--- a/vpx_mem/memory_manager/hmm_dflt_abort.c
25424+++ b/vpx_mem/memory_manager/hmm_dflt_abort.c
25425@@ -1,10 +1,11 @@
25426 /*
25427 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25428 *
25429- * Use of this source code is governed by a BSD-style license and patent
25430- * grant that can be found in the LICENSE file in the root of the source
25431- * tree. All contributing project authors may be found in the AUTHORS
25432- * file in the root of the source tree.
25433+ * Use of this source code is governed by a BSD-style license
25434+ * that can be found in the LICENSE file in the root of the source
25435+ * tree. An additional intellectual property rights grant can be found
25436+ * in the file PATENTS. All contributing project authors may
25437+ * be found in the AUTHORS file in the root of the source tree.
25438 */
25439
25440
25441diff --git a/vpx_mem/memory_manager/hmm_grow.c b/vpx_mem/memory_manager/hmm_grow.c
25442index 79d75a7..a979c7a 100644
25443--- a/vpx_mem/memory_manager/hmm_grow.c
25444+++ b/vpx_mem/memory_manager/hmm_grow.c
25445@@ -1,10 +1,11 @@
25446 /*
25447 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25448 *
25449- * Use of this source code is governed by a BSD-style license and patent
25450- * grant that can be found in the LICENSE file in the root of the source
25451- * tree. All contributing project authors may be found in the AUTHORS
25452- * file in the root of the source tree.
25453+ * Use of this source code is governed by a BSD-style license
25454+ * that can be found in the LICENSE file in the root of the source
25455+ * tree. An additional intellectual property rights grant can be found
25456+ * in the file PATENTS. All contributing project authors may
25457+ * be found in the AUTHORS file in the root of the source tree.
25458 */
25459
25460
25461diff --git a/vpx_mem/memory_manager/hmm_largest.c b/vpx_mem/memory_manager/hmm_largest.c
25462index 5ebe398..82a6a36 100644
25463--- a/vpx_mem/memory_manager/hmm_largest.c
25464+++ b/vpx_mem/memory_manager/hmm_largest.c
25465@@ -1,10 +1,11 @@
25466 /*
25467 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25468 *
25469- * Use of this source code is governed by a BSD-style license and patent
25470- * grant that can be found in the LICENSE file in the root of the source
25471- * tree. All contributing project authors may be found in the AUTHORS
25472- * file in the root of the source tree.
25473+ * Use of this source code is governed by a BSD-style license
25474+ * that can be found in the LICENSE file in the root of the source
25475+ * tree. An additional intellectual property rights grant can be found
25476+ * in the file PATENTS. All contributing project authors may
25477+ * be found in the AUTHORS file in the root of the source tree.
25478 */
25479
25480
25481diff --git a/vpx_mem/memory_manager/hmm_resize.c b/vpx_mem/memory_manager/hmm_resize.c
25482index 6e3f2f0..cb93bb1 100644
25483--- a/vpx_mem/memory_manager/hmm_resize.c
25484+++ b/vpx_mem/memory_manager/hmm_resize.c
25485@@ -1,10 +1,11 @@
25486 /*
25487 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25488 *
25489- * Use of this source code is governed by a BSD-style license and patent
25490- * grant that can be found in the LICENSE file in the root of the source
25491- * tree. All contributing project authors may be found in the AUTHORS
25492- * file in the root of the source tree.
25493+ * Use of this source code is governed by a BSD-style license
25494+ * that can be found in the LICENSE file in the root of the source
25495+ * tree. An additional intellectual property rights grant can be found
25496+ * in the file PATENTS. All contributing project authors may
25497+ * be found in the AUTHORS file in the root of the source tree.
25498 */
25499
25500
25501diff --git a/vpx_mem/memory_manager/hmm_shrink.c b/vpx_mem/memory_manager/hmm_shrink.c
25502index 5ef9b23..d845136 100644
25503--- a/vpx_mem/memory_manager/hmm_shrink.c
25504+++ b/vpx_mem/memory_manager/hmm_shrink.c
25505@@ -1,10 +1,11 @@
25506 /*
25507 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25508 *
25509- * Use of this source code is governed by a BSD-style license and patent
25510- * grant that can be found in the LICENSE file in the root of the source
25511- * tree. All contributing project authors may be found in the AUTHORS
25512- * file in the root of the source tree.
25513+ * Use of this source code is governed by a BSD-style license
25514+ * that can be found in the LICENSE file in the root of the source
25515+ * tree. An additional intellectual property rights grant can be found
25516+ * in the file PATENTS. All contributing project authors may
25517+ * be found in the AUTHORS file in the root of the source tree.
25518 */
25519
25520
25521diff --git a/vpx_mem/memory_manager/hmm_true.c b/vpx_mem/memory_manager/hmm_true.c
25522index 41103c8..586fc22 100644
25523--- a/vpx_mem/memory_manager/hmm_true.c
25524+++ b/vpx_mem/memory_manager/hmm_true.c
25525@@ -1,10 +1,11 @@
25526 /*
25527 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25528 *
25529- * Use of this source code is governed by a BSD-style license and patent
25530- * grant that can be found in the LICENSE file in the root of the source
25531- * tree. All contributing project authors may be found in the AUTHORS
25532- * file in the root of the source tree.
25533+ * Use of this source code is governed by a BSD-style license
25534+ * that can be found in the LICENSE file in the root of the source
25535+ * tree. An additional intellectual property rights grant can be found
25536+ * in the file PATENTS. All contributing project authors may
25537+ * be found in the AUTHORS file in the root of the source tree.
25538 */
25539
25540
25541diff --git a/vpx_mem/memory_manager/include/cavl_if.h b/vpx_mem/memory_manager/include/cavl_if.h
25542index e2733ef..da1b148 100644
25543--- a/vpx_mem/memory_manager/include/cavl_if.h
25544+++ b/vpx_mem/memory_manager/include/cavl_if.h
25545@@ -1,10 +1,11 @@
25546 /*
25547 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25548 *
25549- * Use of this source code is governed by a BSD-style license and patent
25550- * grant that can be found in the LICENSE file in the root of the source
25551- * tree. All contributing project authors may be found in the AUTHORS
25552- * file in the root of the source tree.
25553+ * Use of this source code is governed by a BSD-style license
25554+ * that can be found in the LICENSE file in the root of the source
25555+ * tree. An additional intellectual property rights grant can be found
25556+ * in the file PATENTS. All contributing project authors may
25557+ * be found in the AUTHORS file in the root of the source tree.
25558 */
25559
25560
25561diff --git a/vpx_mem/memory_manager/include/cavl_impl.h b/vpx_mem/memory_manager/include/cavl_impl.h
25562index 267bc73..e67cc8a 100644
25563--- a/vpx_mem/memory_manager/include/cavl_impl.h
25564+++ b/vpx_mem/memory_manager/include/cavl_impl.h
25565@@ -1,10 +1,11 @@
25566 /*
25567 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25568 *
25569- * Use of this source code is governed by a BSD-style license and patent
25570- * grant that can be found in the LICENSE file in the root of the source
25571- * tree. All contributing project authors may be found in the AUTHORS
25572- * file in the root of the source tree.
25573+ * Use of this source code is governed by a BSD-style license
25574+ * that can be found in the LICENSE file in the root of the source
25575+ * tree. An additional intellectual property rights grant can be found
25576+ * in the file PATENTS. All contributing project authors may
25577+ * be found in the AUTHORS file in the root of the source tree.
25578 */
25579
25580
25581diff --git a/vpx_mem/memory_manager/include/heapmm.h b/vpx_mem/memory_manager/include/heapmm.h
25582index 933e30d..4e46c41 100644
25583--- a/vpx_mem/memory_manager/include/heapmm.h
25584+++ b/vpx_mem/memory_manager/include/heapmm.h
25585@@ -1,10 +1,11 @@
25586 /*
25587 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25588 *
25589- * Use of this source code is governed by a BSD-style license and patent
25590- * grant that can be found in the LICENSE file in the root of the source
25591- * tree. All contributing project authors may be found in the AUTHORS
25592- * file in the root of the source tree.
25593+ * Use of this source code is governed by a BSD-style license
25594+ * that can be found in the LICENSE file in the root of the source
25595+ * tree. An additional intellectual property rights grant can be found
25596+ * in the file PATENTS. All contributing project authors may
25597+ * be found in the AUTHORS file in the root of the source tree.
25598 */
25599
25600
25601diff --git a/vpx_mem/memory_manager/include/hmm_cnfg.h b/vpx_mem/memory_manager/include/hmm_cnfg.h
25602index 86e4e9f..715163c 100644
25603--- a/vpx_mem/memory_manager/include/hmm_cnfg.h
25604+++ b/vpx_mem/memory_manager/include/hmm_cnfg.h
25605@@ -1,10 +1,11 @@
25606 /*
25607 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25608 *
25609- * Use of this source code is governed by a BSD-style license and patent
25610- * grant that can be found in the LICENSE file in the root of the source
25611- * tree. All contributing project authors may be found in the AUTHORS
25612- * file in the root of the source tree.
25613+ * Use of this source code is governed by a BSD-style license
25614+ * that can be found in the LICENSE file in the root of the source
25615+ * tree. An additional intellectual property rights grant can be found
25616+ * in the file PATENTS. All contributing project authors may
25617+ * be found in the AUTHORS file in the root of the source tree.
25618 */
25619
25620
25621diff --git a/vpx_mem/memory_manager/include/hmm_intrnl.h b/vpx_mem/memory_manager/include/hmm_intrnl.h
25622index 6e2be08..1dddb8a 100644
25623--- a/vpx_mem/memory_manager/include/hmm_intrnl.h
25624+++ b/vpx_mem/memory_manager/include/hmm_intrnl.h
25625@@ -1,10 +1,11 @@
25626 /*
25627 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25628 *
25629- * Use of this source code is governed by a BSD-style license and patent
25630- * grant that can be found in the LICENSE file in the root of the source
25631- * tree. All contributing project authors may be found in the AUTHORS
25632- * file in the root of the source tree.
25633+ * Use of this source code is governed by a BSD-style license
25634+ * that can be found in the LICENSE file in the root of the source
25635+ * tree. An additional intellectual property rights grant can be found
25636+ * in the file PATENTS. All contributing project authors may
25637+ * be found in the AUTHORS file in the root of the source tree.
25638 */
25639
25640
25641diff --git a/vpx_mem/nds/vpx_mem_nds.c b/vpx_mem/nds/vpx_mem_nds.c
25642index f2a3043..88d474a 100644
25643--- a/vpx_mem/nds/vpx_mem_nds.c
25644+++ b/vpx_mem/nds/vpx_mem_nds.c
25645@@ -1,10 +1,11 @@
25646 /*
25647 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25648 *
25649- * Use of this source code is governed by a BSD-style license and patent
25650- * grant that can be found in the LICENSE file in the root of the source
25651- * tree. All contributing project authors may be found in the AUTHORS
25652- * file in the root of the source tree.
25653+ * Use of this source code is governed by a BSD-style license
25654+ * that can be found in the LICENSE file in the root of the source
25655+ * tree. An additional intellectual property rights grant can be found
25656+ * in the file PATENTS. All contributing project authors may
25657+ * be found in the AUTHORS file in the root of the source tree.
25658 */
25659
25660
25661diff --git a/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c b/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c
25662index 6501855..c2a1c28 100644
25663--- a/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c
25664+++ b/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c
25665@@ -1,10 +1,11 @@
25666 /*
25667 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25668 *
25669- * Use of this source code is governed by a BSD-style license and patent
25670- * grant that can be found in the LICENSE file in the root of the source
25671- * tree. All contributing project authors may be found in the AUTHORS
25672- * file in the root of the source tree.
25673+ * Use of this source code is governed by a BSD-style license
25674+ * that can be found in the LICENSE file in the root of the source
25675+ * tree. An additional intellectual property rights grant can be found
25676+ * in the file PATENTS. All contributing project authors may
25677+ * be found in the AUTHORS file in the root of the source tree.
25678 */
25679
25680
25681diff --git a/vpx_mem/vpx_mem.c b/vpx_mem/vpx_mem.c
25682index f6b1a35..ba92024 100644
25683--- a/vpx_mem/vpx_mem.c
25684+++ b/vpx_mem/vpx_mem.c
25685@@ -1,10 +1,11 @@
25686 /*
25687 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25688 *
25689- * Use of this source code is governed by a BSD-style license and patent
25690- * grant that can be found in the LICENSE file in the root of the source
25691- * tree. All contributing project authors may be found in the AUTHORS
25692- * file in the root of the source tree.
25693+ * Use of this source code is governed by a BSD-style license
25694+ * that can be found in the LICENSE file in the root of the source
25695+ * tree. An additional intellectual property rights grant can be found
25696+ * in the file PATENTS. All contributing project authors may
25697+ * be found in the AUTHORS file in the root of the source tree.
25698 */
25699
25700
25701diff --git a/vpx_mem/vpx_mem.h b/vpx_mem/vpx_mem.h
25702index 6ccb9be..a1239c1 100644
25703--- a/vpx_mem/vpx_mem.h
25704+++ b/vpx_mem/vpx_mem.h
25705@@ -1,10 +1,11 @@
25706 /*
25707 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25708 *
25709- * Use of this source code is governed by a BSD-style license and patent
25710- * grant that can be found in the LICENSE file in the root of the source
25711- * tree. All contributing project authors may be found in the AUTHORS
25712- * file in the root of the source tree.
25713+ * Use of this source code is governed by a BSD-style license
25714+ * that can be found in the LICENSE file in the root of the source
25715+ * tree. An additional intellectual property rights grant can be found
25716+ * in the file PATENTS. All contributing project authors may
25717+ * be found in the AUTHORS file in the root of the source tree.
25718 */
25719
25720
25721diff --git a/vpx_mem/vpx_mem_tracker.c b/vpx_mem/vpx_mem_tracker.c
25722index 4427e27..92152a6 100644
25723--- a/vpx_mem/vpx_mem_tracker.c
25724+++ b/vpx_mem/vpx_mem_tracker.c
25725@@ -1,10 +1,11 @@
25726 /*
25727 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25728 *
25729- * Use of this source code is governed by a BSD-style license and patent
25730- * grant that can be found in the LICENSE file in the root of the source
25731- * tree. All contributing project authors may be found in the AUTHORS
25732- * file in the root of the source tree.
25733+ * Use of this source code is governed by a BSD-style license
25734+ * that can be found in the LICENSE file in the root of the source
25735+ * tree. An additional intellectual property rights grant can be found
25736+ * in the file PATENTS. All contributing project authors may
25737+ * be found in the AUTHORS file in the root of the source tree.
25738 */
25739
25740
25741diff --git a/vpx_ports/config.h b/vpx_ports/config.h
25742index da38137..9d32393 100644
25743--- a/vpx_ports/config.h
25744+++ b/vpx_ports/config.h
25745@@ -1,19 +1,10 @@
25746 /*
25747 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25748 *
25749- * Use of this source code is governed by a BSD-style license and patent
25750- * grant that can be found in the LICENSE file in the root of the source
25751- * tree. All contributing project authors may be found in the AUTHORS
25752- * file in the root of the source tree.
25753+ * Use of this source code is governed by a BSD-style license
25754+ * that can be found in the LICENSE file in the root of the source
25755+ * tree. An additional intellectual property rights grant can be found
25756+ * in the file PATENTS. All contributing project authors may
25757+ * be found in the AUTHORS file in the root of the source tree.
25758 */
25759-
25760-
25761-/* This file uses some preprocessor magic to expand the value of HAVE_CONFIG_H,
25762- * as defined by the build system, so that different projects can use the file
25763- * name for config.h that suits them.
25764- */
25765-#define QUOTE_(x) #x
25766-#define QUOTE(x) QUOTE_(x)
25767-#include QUOTE(HAVE_CONFIG_H)
25768-#undef QUOTE
25769-#undef QUOTE_
25770+#include "vpx_config.h"
25771diff --git a/vpx_ports/emms.asm b/vpx_ports/emms.asm
25772index 03e3499..096176d 100644
25773--- a/vpx_ports/emms.asm
25774+++ b/vpx_ports/emms.asm
25775@@ -1,10 +1,11 @@
25776 ;
25777 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25778 ;
25779-; Use of this source code is governed by a BSD-style license and patent
25780-; grant that can be found in the LICENSE file in the root of the source
25781-; tree. All contributing project authors may be found in the AUTHORS
25782-; file in the root of the source tree.
25783+; Use of this source code is governed by a BSD-style license
25784+; that can be found in the LICENSE file in the root of the source
25785+; tree. An additional intellectual property rights grant can be found
25786+; in the file PATENTS. All contributing project authors may
25787+; be found in the AUTHORS file in the root of the source tree.
25788 ;
25789
25790
25791diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h
25792index 10942f1..ade2e30 100644
25793--- a/vpx_ports/mem.h
25794+++ b/vpx_ports/mem.h
25795@@ -1,17 +1,18 @@
25796 /*
25797 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25798 *
25799- * Use of this source code is governed by a BSD-style license and patent
25800- * grant that can be found in the LICENSE file in the root of the source
25801- * tree. All contributing project authors may be found in the AUTHORS
25802- * file in the root of the source tree.
25803+ * Use of this source code is governed by a BSD-style license
25804+ * that can be found in the LICENSE file in the root of the source
25805+ * tree. An additional intellectual property rights grant can be found
25806+ * in the file PATENTS. All contributing project authors may
25807+ * be found in the AUTHORS file in the root of the source tree.
25808 */
25809
25810
25811 #ifndef VPX_PORTS_MEM_H
25812 #define VPX_PORTS_MEM_H
25813 #include "vpx_config.h"
25814-#include "vpx_integer.h"
25815+#include "vpx/vpx_integer.h"
25816
25817 #if defined(__GNUC__) && __GNUC__
25818 #define DECLARE_ALIGNED(n,typ,val) typ val __attribute__ ((aligned (n)))
25819diff --git a/vpx_ports/mem_ops.h b/vpx_ports/mem_ops.h
25820index 869d583..109c270 100644
25821--- a/vpx_ports/mem_ops.h
25822+++ b/vpx_ports/mem_ops.h
25823@@ -1,10 +1,11 @@
25824 /*
25825 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25826 *
25827- * Use of this source code is governed by a BSD-style license and patent
25828- * grant that can be found in the LICENSE file in the root of the source
25829- * tree. All contributing project authors may be found in the AUTHORS
25830- * file in the root of the source tree.
25831+ * Use of this source code is governed by a BSD-style license
25832+ * that can be found in the LICENSE file in the root of the source
25833+ * tree. An additional intellectual property rights grant can be found
25834+ * in the file PATENTS. All contributing project authors may
25835+ * be found in the AUTHORS file in the root of the source tree.
25836 */
25837
25838
25839diff --git a/vpx_ports/mem_ops_aligned.h b/vpx_ports/mem_ops_aligned.h
25840index 1d0db2c..7c4d95e 100644
25841--- a/vpx_ports/mem_ops_aligned.h
25842+++ b/vpx_ports/mem_ops_aligned.h
25843@@ -1,10 +1,11 @@
25844 /*
25845 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25846 *
25847- * Use of this source code is governed by a BSD-style license and patent
25848- * grant that can be found in the LICENSE file in the root of the source
25849- * tree. All contributing project authors may be found in the AUTHORS
25850- * file in the root of the source tree.
25851+ * Use of this source code is governed by a BSD-style license
25852+ * that can be found in the LICENSE file in the root of the source
25853+ * tree. An additional intellectual property rights grant can be found
25854+ * in the file PATENTS. All contributing project authors may
25855+ * be found in the AUTHORS file in the root of the source tree.
25856 */
25857
25858
25859diff --git a/vpx_ports/vpx_integer.h b/vpx_ports/vpx_integer.h
25860deleted file mode 100644
25861index d3f7ddd..0000000
25862--- a/vpx_ports/vpx_integer.h
25863+++ /dev/null
25864@@ -1,52 +0,0 @@
25865-/*
25866- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25867- *
25868- * Use of this source code is governed by a BSD-style license and patent
25869- * grant that can be found in the LICENSE file in the root of the source
25870- * tree. All contributing project authors may be found in the AUTHORS
25871- * file in the root of the source tree.
25872- */
25873-
25874-
25875-#ifndef VPX_INTEGER_H
25876-#define VPX_INTEGER_H
25877-
25878-/* get ptrdiff_t, size_t, wchar_t, NULL */
25879-#include <stddef.h>
25880-
25881-#if defined(HAVE_STDINT_H) && HAVE_STDINT_H
25882-#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
25883-#define __STDC_FORMAT_MACROS
25884-#endif
25885-#include <stdint.h>
25886-#include <inttypes.h>
25887-#else
25888-typedef signed char int8_t;
25889-typedef signed short int16_t;
25890-typedef signed int int32_t;
25891-
25892-typedef unsigned char uint8_t;
25893-typedef unsigned short uint16_t;
25894-typedef unsigned int uint32_t;
25895-
25896-#if defined(_MSC_VER)
25897-typedef signed __int64 int64_t;
25898-typedef unsigned __int64 uint64_t;
25899-#define PRId64 "I64d"
25900-#endif
25901-
25902-#ifdef HAVE_ARMV6
25903-typedef unsigned int int_fast16_t;
25904-#else
25905-typedef signed short int_fast16_t;
25906-#endif
25907-typedef signed char int_fast8_t;
25908-typedef unsigned char uint_fast8_t;
25909-
25910-#ifndef _UINTPTR_T_DEFINED
25911-typedef unsigned int uintptr_t;
25912-#endif
25913-
25914-#endif
25915-
25916-#endif
25917diff --git a/vpx_ports/vpx_timer.h b/vpx_ports/vpx_timer.h
25918index 5c04538..11fee84 100644
25919--- a/vpx_ports/vpx_timer.h
25920+++ b/vpx_ports/vpx_timer.h
25921@@ -1,10 +1,11 @@
25922 /*
25923 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25924 *
25925- * Use of this source code is governed by a BSD-style license and patent
25926- * grant that can be found in the LICENSE file in the root of the source
25927- * tree. All contributing project authors may be found in the AUTHORS
25928- * file in the root of the source tree.
25929+ * Use of this source code is governed by a BSD-style license
25930+ * that can be found in the LICENSE file in the root of the source
25931+ * tree. An additional intellectual property rights grant can be found
25932+ * in the file PATENTS. All contributing project authors may
25933+ * be found in the AUTHORS file in the root of the source tree.
25934 */
25935
25936
25937diff --git a/vpx_ports/vpxtypes.h b/vpx_ports/vpxtypes.h
25938index 86525b7..b9c8b8c 100644
25939--- a/vpx_ports/vpxtypes.h
25940+++ b/vpx_ports/vpxtypes.h
25941@@ -1,19 +1,18 @@
25942 /*
25943 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25944 *
25945- * Use of this source code is governed by a BSD-style license and patent
25946- * grant that can be found in the LICENSE file in the root of the source
25947- * tree. All contributing project authors may be found in the AUTHORS
25948- * file in the root of the source tree.
25949+ * Use of this source code is governed by a BSD-style license
25950+ * that can be found in the LICENSE file in the root of the source
25951+ * tree. An additional intellectual property rights grant can be found
25952+ * in the file PATENTS. All contributing project authors may
25953+ * be found in the AUTHORS file in the root of the source tree.
25954 */
25955
25956
25957 #ifndef __VPXTYPES_H__
25958 #define __VPXTYPES_H__
25959
25960-#ifdef HAVE_CONFIG_H
25961-#include HAVE_CONFIG_H
25962-#endif
25963+#include "vpx_ports/config.h"
25964
25965 //#include <sys/types.h>
25966 #ifdef _MSC_VER
25967diff --git a/vpx_ports/x86.h b/vpx_ports/x86.h
25968index 935d037..8c23abd 100644
25969--- a/vpx_ports/x86.h
25970+++ b/vpx_ports/x86.h
25971@@ -1,10 +1,11 @@
25972 /*
25973 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25974 *
25975- * Use of this source code is governed by a BSD-style license and patent
25976- * grant that can be found in the LICENSE file in the root of the source
25977- * tree. All contributing project authors may be found in the AUTHORS
25978- * file in the root of the source tree.
25979+ * Use of this source code is governed by a BSD-style license
25980+ * that can be found in the LICENSE file in the root of the source
25981+ * tree. An additional intellectual property rights grant can be found
25982+ * in the file PATENTS. All contributing project authors may
25983+ * be found in the AUTHORS file in the root of the source tree.
25984 */
25985
25986
25987diff --git a/vpx_ports/x86_abi_support.asm b/vpx_ports/x86_abi_support.asm
25988index db8208f..a1622e6 100644
25989--- a/vpx_ports/x86_abi_support.asm
25990+++ b/vpx_ports/x86_abi_support.asm
25991@@ -1,10 +1,11 @@
25992 ;
25993 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
25994 ;
25995-; Use of this source code is governed by a BSD-style license and patent
25996-; grant that can be found in the LICENSE file in the root of the source
25997-; tree. All contributing project authors may be found in the AUTHORS
25998-; file in the root of the source tree.
25999+; Use of this source code is governed by a BSD-style license
26000+; that can be found in the LICENSE file in the root of the source
26001+; tree. An additional intellectual property rights grant can be found
26002+; in the file PATENTS. All contributing project authors may
26003+; be found in the AUTHORS file in the root of the source tree.
26004 ;
26005
26006
26007@@ -198,22 +199,38 @@
26008 push r9
26009 %endif
26010 %if %1 > 6
26011- mov rax,[rbp+16]
26012- push rax
26013- %endif
26014- %if %1 > 7
26015- mov rax,[rbp+24]
26016- push rax
26017- %endif
26018- %if %1 > 8
26019- mov rax,[rbp+32]
26020+ %assign i %1-6
26021+ %assign off 16
26022+ %rep i
26023+ mov rax,[rbp+off]
26024 push rax
26025+ %assign off off+8
26026+ %endrep
26027 %endif
26028 %endm
26029 %endif
26030 %define UNSHADOW_ARGS mov rsp, rbp
26031 %endif
26032
26033+; must keep XMM6:XMM15 (libvpx uses XMM6 and XMM7) on Win64 ABI
26034+; rsp register has to be aligned
26035+%ifidn __OUTPUT_FORMAT__,x64
26036+%macro SAVE_XMM 0
26037+ sub rsp, 32
26038+ movdqa XMMWORD PTR [rsp], xmm6
26039+ movdqa XMMWORD PTR [rsp+16], xmm7
26040+%endmacro
26041+%macro RESTORE_XMM 0
26042+ movdqa xmm6, XMMWORD PTR [rsp]
26043+ movdqa xmm7, XMMWORD PTR [rsp+16]
26044+ add rsp, 32
26045+%endmacro
26046+%else
26047+%macro SAVE_XMM 0
26048+%endmacro
26049+%macro RESTORE_XMM 0
26050+%endmacro
26051+%endif
26052
26053 ; Name of the rodata section
26054 ;
26055@@ -229,3 +246,14 @@ fake_got:
26056 %else
26057 %define SECTION_RODATA section .rodata
26058 %endif
26059+
26060+
26061+; Tell GNU ld that we don't require an executable stack.
26062+%ifidn __OUTPUT_FORMAT__,elf32
26063+section .note.GNU-stack noalloc noexec nowrite progbits
26064+section .text
26065+%elifidn __OUTPUT_FORMAT__,elf64
26066+section .note.GNU-stack noalloc noexec nowrite progbits
26067+section .text
26068+%endif
26069+
26070diff --git a/vpx_scale/arm/armv4/gen_scalers_armv4.asm b/vpx_scale/arm/armv4/gen_scalers_armv4.asm
26071index 1c904ed..e317fe9 100644
26072--- a/vpx_scale/arm/armv4/gen_scalers_armv4.asm
26073+++ b/vpx_scale/arm/armv4/gen_scalers_armv4.asm
26074@@ -1,10 +1,11 @@
26075 ;
26076 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26077 ;
26078-; Use of this source code is governed by a BSD-style license and patent
26079-; grant that can be found in the LICENSE file in the root of the source
26080-; tree. All contributing project authors may be found in the AUTHORS
26081-; file in the root of the source tree.
26082+; Use of this source code is governed by a BSD-style license
26083+; that can be found in the LICENSE file in the root of the source
26084+; tree. An additional intellectual property rights grant can be found
26085+; in the file PATENTS. All contributing project authors may
26086+; be found in the AUTHORS file in the root of the source tree.
26087 ;
26088
26089
26090diff --git a/vpx_scale/arm/nds/yv12extend.c b/vpx_scale/arm/nds/yv12extend.c
26091index 56959cb..9ec3466 100644
26092--- a/vpx_scale/arm/nds/yv12extend.c
26093+++ b/vpx_scale/arm/nds/yv12extend.c
26094@@ -1,10 +1,11 @@
26095 /*
26096 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26097 *
26098- * Use of this source code is governed by a BSD-style license and patent
26099- * grant that can be found in the LICENSE file in the root of the source
26100- * tree. All contributing project authors may be found in the AUTHORS
26101- * file in the root of the source tree.
26102+ * Use of this source code is governed by a BSD-style license
26103+ * that can be found in the LICENSE file in the root of the source
26104+ * tree. An additional intellectual property rights grant can be found
26105+ * in the file PATENTS. All contributing project authors may
26106+ * be found in the AUTHORS file in the root of the source tree.
26107 */
26108
26109
26110diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
26111index 26384c4..64e7bfe 100644
26112--- a/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
26113+++ b/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
26114@@ -1,10 +1,11 @@
26115 ;
26116 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26117 ;
26118-; Use of this source code is governed by a BSD-style license and patent
26119-; grant that can be found in the LICENSE file in the root of the source
26120-; tree. All contributing project authors may be found in the AUTHORS
26121-; file in the root of the source tree.
26122+; Use of this source code is governed by a BSD-style license
26123+; that can be found in the LICENSE file in the root of the source
26124+; tree. An additional intellectual property rights grant can be found
26125+; in the file PATENTS. All contributing project authors may
26126+; be found in the AUTHORS file in the root of the source tree.
26127 ;
26128
26129
26130diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
26131index a50ae60..f79de3c 100644
26132--- a/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
26133+++ b/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
26134@@ -1,10 +1,11 @@
26135 ;
26136 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26137 ;
26138-; Use of this source code is governed by a BSD-style license and patent
26139-; grant that can be found in the LICENSE file in the root of the source
26140-; tree. All contributing project authors may be found in the AUTHORS
26141-; file in the root of the source tree.
26142+; Use of this source code is governed by a BSD-style license
26143+; that can be found in the LICENSE file in the root of the source
26144+; tree. An additional intellectual property rights grant can be found
26145+; in the file PATENTS. All contributing project authors may
26146+; be found in the AUTHORS file in the root of the source tree.
26147 ;
26148
26149
26150diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
26151index c8923d5..2e24e24 100644
26152--- a/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
26153+++ b/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
26154@@ -1,10 +1,11 @@
26155 ;
26156 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26157 ;
26158-; Use of this source code is governed by a BSD-style license and patent
26159-; grant that can be found in the LICENSE file in the root of the source
26160-; tree. All contributing project authors may be found in the AUTHORS
26161-; file in the root of the source tree.
26162+; Use of this source code is governed by a BSD-style license
26163+; that can be found in the LICENSE file in the root of the source
26164+; tree. An additional intellectual property rights grant can be found
26165+; in the file PATENTS. All contributing project authors may
26166+; be found in the AUTHORS file in the root of the source tree.
26167 ;
26168
26169
26170diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
26171index 8c9ce19..418578f 100644
26172--- a/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
26173+++ b/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
26174@@ -1,10 +1,11 @@
26175 ;
26176 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26177 ;
26178-; Use of this source code is governed by a BSD-style license and patent
26179-; grant that can be found in the LICENSE file in the root of the source
26180-; tree. All contributing project authors may be found in the AUTHORS
26181-; file in the root of the source tree.
26182+; Use of this source code is governed by a BSD-style license
26183+; that can be found in the LICENSE file in the root of the source
26184+; tree. An additional intellectual property rights grant can be found
26185+; in the file PATENTS. All contributing project authors may
26186+; be found in the AUTHORS file in the root of the source tree.
26187 ;
26188
26189
26190diff --git a/vpx_scale/arm/scalesystemdependant.c b/vpx_scale/arm/scalesystemdependant.c
26191index 3c355be..67954b2 100644
26192--- a/vpx_scale/arm/scalesystemdependant.c
26193+++ b/vpx_scale/arm/scalesystemdependant.c
26194@@ -1,18 +1,17 @@
26195 /*
26196 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26197 *
26198- * Use of this source code is governed by a BSD-style license and patent
26199- * grant that can be found in the LICENSE file in the root of the source
26200- * tree. All contributing project authors may be found in the AUTHORS
26201- * file in the root of the source tree.
26202+ * Use of this source code is governed by a BSD-style license
26203+ * that can be found in the LICENSE file in the root of the source
26204+ * tree. An additional intellectual property rights grant can be found
26205+ * in the file PATENTS. All contributing project authors may
26206+ * be found in the AUTHORS file in the root of the source tree.
26207 */
26208
26209
26210+#include "vpx_ports/config.h"
26211 #include "vpx_scale/vpxscale.h"
26212
26213-#ifdef HAVE_CONFIG_H
26214-#include "vpx_config.h"
26215-#endif
26216
26217 void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf);
26218 extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf);
26219diff --git a/vpx_scale/arm/yv12extend_arm.c b/vpx_scale/arm/yv12extend_arm.c
26220index 7c3f7cd..5069030 100644
26221--- a/vpx_scale/arm/yv12extend_arm.c
26222+++ b/vpx_scale/arm/yv12extend_arm.c
26223@@ -1,10 +1,11 @@
26224 /*
26225 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26226 *
26227- * Use of this source code is governed by a BSD-style license and patent
26228- * grant that can be found in the LICENSE file in the root of the source
26229- * tree. All contributing project authors may be found in the AUTHORS
26230- * file in the root of the source tree.
26231+ * Use of this source code is governed by a BSD-style license
26232+ * that can be found in the LICENSE file in the root of the source
26233+ * tree. An additional intellectual property rights grant can be found
26234+ * in the file PATENTS. All contributing project authors may
26235+ * be found in the AUTHORS file in the root of the source tree.
26236 */
26237
26238
26239diff --git a/vpx_scale/blackfin/yv12config.c b/vpx_scale/blackfin/yv12config.c
26240index 7cb083f..950a5d2 100644
26241--- a/vpx_scale/blackfin/yv12config.c
26242+++ b/vpx_scale/blackfin/yv12config.c
26243@@ -1,10 +1,11 @@
26244 /*
26245 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26246 *
26247- * Use of this source code is governed by a BSD-style license and patent
26248- * grant that can be found in the LICENSE file in the root of the source
26249- * tree. All contributing project authors may be found in the AUTHORS
26250- * file in the root of the source tree.
26251+ * Use of this source code is governed by a BSD-style license
26252+ * that can be found in the LICENSE file in the root of the source
26253+ * tree. An additional intellectual property rights grant can be found
26254+ * in the file PATENTS. All contributing project authors may
26255+ * be found in the AUTHORS file in the root of the source tree.
26256 */
26257
26258
26259diff --git a/vpx_scale/blackfin/yv12extend.c b/vpx_scale/blackfin/yv12extend.c
26260index d5be495..80504ef 100644
26261--- a/vpx_scale/blackfin/yv12extend.c
26262+++ b/vpx_scale/blackfin/yv12extend.c
26263@@ -1,10 +1,11 @@
26264 /*
26265 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26266 *
26267- * Use of this source code is governed by a BSD-style license and patent
26268- * grant that can be found in the LICENSE file in the root of the source
26269- * tree. All contributing project authors may be found in the AUTHORS
26270- * file in the root of the source tree.
26271+ * Use of this source code is governed by a BSD-style license
26272+ * that can be found in the LICENSE file in the root of the source
26273+ * tree. An additional intellectual property rights grant can be found
26274+ * in the file PATENTS. All contributing project authors may
26275+ * be found in the AUTHORS file in the root of the source tree.
26276 */
26277
26278
26279diff --git a/vpx_scale/dm642/bicubic_scaler_c64.c b/vpx_scale/dm642/bicubic_scaler_c64.c
26280index 9bd3797..e026be5 100644
26281--- a/vpx_scale/dm642/bicubic_scaler_c64.c
26282+++ b/vpx_scale/dm642/bicubic_scaler_c64.c
26283@@ -1,10 +1,11 @@
26284 /*
26285 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26286 *
26287- * Use of this source code is governed by a BSD-style license and patent
26288- * grant that can be found in the LICENSE file in the root of the source
26289- * tree. All contributing project authors may be found in the AUTHORS
26290- * file in the root of the source tree.
26291+ * Use of this source code is governed by a BSD-style license
26292+ * that can be found in the LICENSE file in the root of the source
26293+ * tree. An additional intellectual property rights grant can be found
26294+ * in the file PATENTS. All contributing project authors may
26295+ * be found in the AUTHORS file in the root of the source tree.
26296 */
26297
26298
26299diff --git a/vpx_scale/dm642/gen_scalers_c64.c b/vpx_scale/dm642/gen_scalers_c64.c
26300index 2126a75..34f95f7 100644
26301--- a/vpx_scale/dm642/gen_scalers_c64.c
26302+++ b/vpx_scale/dm642/gen_scalers_c64.c
26303@@ -1,10 +1,11 @@
26304 /*
26305 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26306 *
26307- * Use of this source code is governed by a BSD-style license and patent
26308- * grant that can be found in the LICENSE file in the root of the source
26309- * tree. All contributing project authors may be found in the AUTHORS
26310- * file in the root of the source tree.
26311+ * Use of this source code is governed by a BSD-style license
26312+ * that can be found in the LICENSE file in the root of the source
26313+ * tree. An additional intellectual property rights grant can be found
26314+ * in the file PATENTS. All contributing project authors may
26315+ * be found in the AUTHORS file in the root of the source tree.
26316 */
26317
26318
26319diff --git a/vpx_scale/dm642/yv12extend.c b/vpx_scale/dm642/yv12extend.c
26320index ca25a5f..2557a3a 100644
26321--- a/vpx_scale/dm642/yv12extend.c
26322+++ b/vpx_scale/dm642/yv12extend.c
26323@@ -1,10 +1,11 @@
26324 /*
26325 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26326 *
26327- * Use of this source code is governed by a BSD-style license and patent
26328- * grant that can be found in the LICENSE file in the root of the source
26329- * tree. All contributing project authors may be found in the AUTHORS
26330- * file in the root of the source tree.
26331+ * Use of this source code is governed by a BSD-style license
26332+ * that can be found in the LICENSE file in the root of the source
26333+ * tree. An additional intellectual property rights grant can be found
26334+ * in the file PATENTS. All contributing project authors may
26335+ * be found in the AUTHORS file in the root of the source tree.
26336 */
26337
26338
26339diff --git a/vpx_scale/generic/bicubic_scaler.c b/vpx_scale/generic/bicubic_scaler.c
26340index e3c2b4a..48f9096 100644
26341--- a/vpx_scale/generic/bicubic_scaler.c
26342+++ b/vpx_scale/generic/bicubic_scaler.c
26343@@ -1,10 +1,11 @@
26344 /*
26345 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26346 *
26347- * Use of this source code is governed by a BSD-style license and patent
26348- * grant that can be found in the LICENSE file in the root of the source
26349- * tree. All contributing project authors may be found in the AUTHORS
26350- * file in the root of the source tree.
26351+ * Use of this source code is governed by a BSD-style license
26352+ * that can be found in the LICENSE file in the root of the source
26353+ * tree. An additional intellectual property rights grant can be found
26354+ * in the file PATENTS. All contributing project authors may
26355+ * be found in the AUTHORS file in the root of the source tree.
26356 */
26357
26358
26359diff --git a/vpx_scale/generic/gen_scalers.c b/vpx_scale/generic/gen_scalers.c
26360index a5e545f..ff841f3 100644
26361--- a/vpx_scale/generic/gen_scalers.c
26362+++ b/vpx_scale/generic/gen_scalers.c
26363@@ -1,10 +1,11 @@
26364 /*
26365 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26366 *
26367- * Use of this source code is governed by a BSD-style license and patent
26368- * grant that can be found in the LICENSE file in the root of the source
26369- * tree. All contributing project authors may be found in the AUTHORS
26370- * file in the root of the source tree.
26371+ * Use of this source code is governed by a BSD-style license
26372+ * that can be found in the LICENSE file in the root of the source
26373+ * tree. An additional intellectual property rights grant can be found
26374+ * in the file PATENTS. All contributing project authors may
26375+ * be found in the AUTHORS file in the root of the source tree.
26376 */
26377
26378
26379@@ -936,12 +937,13 @@ void vp8cx_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pit
26380
26381 void vp8cx_vertical_band_2_1_scale_i_c(unsigned char *source, unsigned int src_pitch, unsigned char *dest, unsigned int dest_pitch, unsigned int dest_width)
26382 {
26383- unsigned int i;
26384+ int i;
26385 int temp;
26386+ int width = dest_width;
26387
26388 (void) dest_pitch;
26389
26390- for (i = 0; i < dest_width; i++)
26391+ for (i = 0; i < width; i++)
26392 {
26393 temp = 8;
26394 temp += source[i-(int)src_pitch] * 3;
26395diff --git a/vpx_scale/generic/scalesystemdependant.c b/vpx_scale/generic/scalesystemdependant.c
26396index 28f5c72..7a24a26 100644
26397--- a/vpx_scale/generic/scalesystemdependant.c
26398+++ b/vpx_scale/generic/scalesystemdependant.c
26399@@ -1,18 +1,17 @@
26400 /*
26401 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26402 *
26403- * Use of this source code is governed by a BSD-style license and patent
26404- * grant that can be found in the LICENSE file in the root of the source
26405- * tree. All contributing project authors may be found in the AUTHORS
26406- * file in the root of the source tree.
26407+ * Use of this source code is governed by a BSD-style license
26408+ * that can be found in the LICENSE file in the root of the source
26409+ * tree. An additional intellectual property rights grant can be found
26410+ * in the file PATENTS. All contributing project authors may
26411+ * be found in the AUTHORS file in the root of the source tree.
26412 */
26413
26414
26415+#include "vpx_ports/config.h"
26416 #include "vpx_scale/vpxscale.h"
26417
26418-#ifdef HAVE_CONFIG_H
26419-#include "vpx_config.h"
26420-#endif
26421
26422 void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf);
26423 extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf);
26424diff --git a/vpx_scale/generic/vpxscale.c b/vpx_scale/generic/vpxscale.c
26425index 206cd55..8f8cfb5 100644
26426--- a/vpx_scale/generic/vpxscale.c
26427+++ b/vpx_scale/generic/vpxscale.c
26428@@ -1,10 +1,11 @@
26429 /*
26430 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26431 *
26432- * Use of this source code is governed by a BSD-style license and patent
26433- * grant that can be found in the LICENSE file in the root of the source
26434- * tree. All contributing project authors may be found in the AUTHORS
26435- * file in the root of the source tree.
26436+ * Use of this source code is governed by a BSD-style license
26437+ * that can be found in the LICENSE file in the root of the source
26438+ * tree. An additional intellectual property rights grant can be found
26439+ * in the file PATENTS. All contributing project authors may
26440+ * be found in the AUTHORS file in the root of the source tree.
26441 */
26442
26443
26444diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
26445index 04617be..008130b 100644
26446--- a/vpx_scale/generic/yv12config.c
26447+++ b/vpx_scale/generic/yv12config.c
26448@@ -1,10 +1,11 @@
26449 /*
26450 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26451 *
26452- * Use of this source code is governed by a BSD-style license and patent
26453- * grant that can be found in the LICENSE file in the root of the source
26454- * tree. All contributing project authors may be found in the AUTHORS
26455- * file in the root of the source tree.
26456+ * Use of this source code is governed by a BSD-style license
26457+ * that can be found in the LICENSE file in the root of the source
26458+ * tree. An additional intellectual property rights grant can be found
26459+ * in the file PATENTS. All contributing project authors may
26460+ * be found in the AUTHORS file in the root of the source tree.
26461 */
26462
26463
26464diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c
26465index 4906625..907fa68 100644
26466--- a/vpx_scale/generic/yv12extend.c
26467+++ b/vpx_scale/generic/yv12extend.c
26468@@ -1,10 +1,11 @@
26469 /*
26470 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26471 *
26472- * Use of this source code is governed by a BSD-style license and patent
26473- * grant that can be found in the LICENSE file in the root of the source
26474- * tree. All contributing project authors may be found in the AUTHORS
26475- * file in the root of the source tree.
26476+ * Use of this source code is governed by a BSD-style license
26477+ * that can be found in the LICENSE file in the root of the source
26478+ * tree. An additional intellectual property rights grant can be found
26479+ * in the file PATENTS. All contributing project authors may
26480+ * be found in the AUTHORS file in the root of the source tree.
26481 */
26482
26483
26484diff --git a/vpx_scale/include/arm/vpxscale_nofp.h b/vpx_scale/include/arm/vpxscale_nofp.h
26485index d6181d2..39e3742 100644
26486--- a/vpx_scale/include/arm/vpxscale_nofp.h
26487+++ b/vpx_scale/include/arm/vpxscale_nofp.h
26488@@ -1,10 +1,11 @@
26489 /*
26490 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26491 *
26492- * Use of this source code is governed by a BSD-style license and patent
26493- * grant that can be found in the LICENSE file in the root of the source
26494- * tree. All contributing project authors may be found in the AUTHORS
26495- * file in the root of the source tree.
26496+ * Use of this source code is governed by a BSD-style license
26497+ * that can be found in the LICENSE file in the root of the source
26498+ * tree. An additional intellectual property rights grant can be found
26499+ * in the file PATENTS. All contributing project authors may
26500+ * be found in the AUTHORS file in the root of the source tree.
26501 */
26502
26503
26504diff --git a/vpx_scale/include/generic/vpxscale_arbitrary.h b/vpx_scale/include/generic/vpxscale_arbitrary.h
26505index 2b50f24..68b8fc0 100644
26506--- a/vpx_scale/include/generic/vpxscale_arbitrary.h
26507+++ b/vpx_scale/include/generic/vpxscale_arbitrary.h
26508@@ -1,10 +1,11 @@
26509 /*
26510 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26511 *
26512- * Use of this source code is governed by a BSD-style license and patent
26513- * grant that can be found in the LICENSE file in the root of the source
26514- * tree. All contributing project authors may be found in the AUTHORS
26515- * file in the root of the source tree.
26516+ * Use of this source code is governed by a BSD-style license
26517+ * that can be found in the LICENSE file in the root of the source
26518+ * tree. An additional intellectual property rights grant can be found
26519+ * in the file PATENTS. All contributing project authors may
26520+ * be found in the AUTHORS file in the root of the source tree.
26521 */
26522
26523
26524diff --git a/vpx_scale/include/generic/vpxscale_depricated.h b/vpx_scale/include/generic/vpxscale_depricated.h
26525index 015eed0..dbe7786 100644
26526--- a/vpx_scale/include/generic/vpxscale_depricated.h
26527+++ b/vpx_scale/include/generic/vpxscale_depricated.h
26528@@ -1,10 +1,11 @@
26529 /*
26530 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26531 *
26532- * Use of this source code is governed by a BSD-style license and patent
26533- * grant that can be found in the LICENSE file in the root of the source
26534- * tree. All contributing project authors may be found in the AUTHORS
26535- * file in the root of the source tree.
26536+ * Use of this source code is governed by a BSD-style license
26537+ * that can be found in the LICENSE file in the root of the source
26538+ * tree. An additional intellectual property rights grant can be found
26539+ * in the file PATENTS. All contributing project authors may
26540+ * be found in the AUTHORS file in the root of the source tree.
26541 */
26542
26543
26544diff --git a/vpx_scale/include/generic/vpxscale_nofp.h b/vpx_scale/include/generic/vpxscale_nofp.h
26545index c4d5f4c..97ea60e 100644
26546--- a/vpx_scale/include/generic/vpxscale_nofp.h
26547+++ b/vpx_scale/include/generic/vpxscale_nofp.h
26548@@ -1,10 +1,11 @@
26549 /*
26550 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26551 *
26552- * Use of this source code is governed by a BSD-style license and patent
26553- * grant that can be found in the LICENSE file in the root of the source
26554- * tree. All contributing project authors may be found in the AUTHORS
26555- * file in the root of the source tree.
26556+ * Use of this source code is governed by a BSD-style license
26557+ * that can be found in the LICENSE file in the root of the source
26558+ * tree. An additional intellectual property rights grant can be found
26559+ * in the file PATENTS. All contributing project authors may
26560+ * be found in the AUTHORS file in the root of the source tree.
26561 */
26562
26563
26564diff --git a/vpx_scale/include/leapster/vpxscale.h b/vpx_scale/include/leapster/vpxscale.h
26565index f70029c..a40f2eb 100644
26566--- a/vpx_scale/include/leapster/vpxscale.h
26567+++ b/vpx_scale/include/leapster/vpxscale.h
26568@@ -1,10 +1,11 @@
26569 /*
26570 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26571 *
26572- * Use of this source code is governed by a BSD-style license and patent
26573- * grant that can be found in the LICENSE file in the root of the source
26574- * tree. All contributing project authors may be found in the AUTHORS
26575- * file in the root of the source tree.
26576+ * Use of this source code is governed by a BSD-style license
26577+ * that can be found in the LICENSE file in the root of the source
26578+ * tree. An additional intellectual property rights grant can be found
26579+ * in the file PATENTS. All contributing project authors may
26580+ * be found in the AUTHORS file in the root of the source tree.
26581 */
26582
26583
26584diff --git a/vpx_scale/include/symbian/vpxscale_nofp.h b/vpx_scale/include/symbian/vpxscale_nofp.h
26585index d6181d2..39e3742 100644
26586--- a/vpx_scale/include/symbian/vpxscale_nofp.h
26587+++ b/vpx_scale/include/symbian/vpxscale_nofp.h
26588@@ -1,10 +1,11 @@
26589 /*
26590 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26591 *
26592- * Use of this source code is governed by a BSD-style license and patent
26593- * grant that can be found in the LICENSE file in the root of the source
26594- * tree. All contributing project authors may be found in the AUTHORS
26595- * file in the root of the source tree.
26596+ * Use of this source code is governed by a BSD-style license
26597+ * that can be found in the LICENSE file in the root of the source
26598+ * tree. An additional intellectual property rights grant can be found
26599+ * in the file PATENTS. All contributing project authors may
26600+ * be found in the AUTHORS file in the root of the source tree.
26601 */
26602
26603
26604diff --git a/vpx_scale/include/vpxscale_nofp.h b/vpx_scale/include/vpxscale_nofp.h
26605index f6482f9..f39a1c6 100644
26606--- a/vpx_scale/include/vpxscale_nofp.h
26607+++ b/vpx_scale/include/vpxscale_nofp.h
26608@@ -1,10 +1,11 @@
26609 /*
26610 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26611 *
26612- * Use of this source code is governed by a BSD-style license and patent
26613- * grant that can be found in the LICENSE file in the root of the source
26614- * tree. All contributing project authors may be found in the AUTHORS
26615- * file in the root of the source tree.
26616+ * Use of this source code is governed by a BSD-style license
26617+ * that can be found in the LICENSE file in the root of the source
26618+ * tree. An additional intellectual property rights grant can be found
26619+ * in the file PATENTS. All contributing project authors may
26620+ * be found in the AUTHORS file in the root of the source tree.
26621 */
26622
26623
26624diff --git a/vpx_scale/intel_linux/scaleopt.c b/vpx_scale/intel_linux/scaleopt.c
26625index 6555600..1bdb488 100644
26626--- a/vpx_scale/intel_linux/scaleopt.c
26627+++ b/vpx_scale/intel_linux/scaleopt.c
26628@@ -1,10 +1,11 @@
26629 /*
26630 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26631 *
26632- * Use of this source code is governed by a BSD-style license and patent
26633- * grant that can be found in the LICENSE file in the root of the source
26634- * tree. All contributing project authors may be found in the AUTHORS
26635- * file in the root of the source tree.
26636+ * Use of this source code is governed by a BSD-style license
26637+ * that can be found in the LICENSE file in the root of the source
26638+ * tree. An additional intellectual property rights grant can be found
26639+ * in the file PATENTS. All contributing project authors may
26640+ * be found in the AUTHORS file in the root of the source tree.
26641 */
26642
26643
26644diff --git a/vpx_scale/intel_linux/scalesystemdependant.c b/vpx_scale/intel_linux/scalesystemdependant.c
26645index 9ed48bf..82b90c9 100644
26646--- a/vpx_scale/intel_linux/scalesystemdependant.c
26647+++ b/vpx_scale/intel_linux/scalesystemdependant.c
26648@@ -1,10 +1,11 @@
26649 /*
26650 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26651 *
26652- * Use of this source code is governed by a BSD-style license and patent
26653- * grant that can be found in the LICENSE file in the root of the source
26654- * tree. All contributing project authors may be found in the AUTHORS
26655- * file in the root of the source tree.
26656+ * Use of this source code is governed by a BSD-style license
26657+ * that can be found in the LICENSE file in the root of the source
26658+ * tree. An additional intellectual property rights grant can be found
26659+ * in the file PATENTS. All contributing project authors may
26660+ * be found in the AUTHORS file in the root of the source tree.
26661 */
26662
26663
26664diff --git a/vpx_scale/leapster/doptsystemdependant_lf.c b/vpx_scale/leapster/doptsystemdependant_lf.c
26665index ca13167..f4ccb16 100644
26666--- a/vpx_scale/leapster/doptsystemdependant_lf.c
26667+++ b/vpx_scale/leapster/doptsystemdependant_lf.c
26668@@ -1,10 +1,11 @@
26669 /*
26670 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26671 *
26672- * Use of this source code is governed by a BSD-style license and patent
26673- * grant that can be found in the LICENSE file in the root of the source
26674- * tree. All contributing project authors may be found in the AUTHORS
26675- * file in the root of the source tree.
26676+ * Use of this source code is governed by a BSD-style license
26677+ * that can be found in the LICENSE file in the root of the source
26678+ * tree. An additional intellectual property rights grant can be found
26679+ * in the file PATENTS. All contributing project authors may
26680+ * be found in the AUTHORS file in the root of the source tree.
26681 */
26682
26683
26684diff --git a/vpx_scale/leapster/gen_scalers_lf.c b/vpx_scale/leapster/gen_scalers_lf.c
26685index 1b9c7c7..f9a11fe 100644
26686--- a/vpx_scale/leapster/gen_scalers_lf.c
26687+++ b/vpx_scale/leapster/gen_scalers_lf.c
26688@@ -1,10 +1,11 @@
26689 /*
26690 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26691 *
26692- * Use of this source code is governed by a BSD-style license and patent
26693- * grant that can be found in the LICENSE file in the root of the source
26694- * tree. All contributing project authors may be found in the AUTHORS
26695- * file in the root of the source tree.
26696+ * Use of this source code is governed by a BSD-style license
26697+ * that can be found in the LICENSE file in the root of the source
26698+ * tree. An additional intellectual property rights grant can be found
26699+ * in the file PATENTS. All contributing project authors may
26700+ * be found in the AUTHORS file in the root of the source tree.
26701 */
26702
26703
26704diff --git a/vpx_scale/leapster/vpxscale_lf.c b/vpx_scale/leapster/vpxscale_lf.c
26705index 5f05e5d..deabd98 100644
26706--- a/vpx_scale/leapster/vpxscale_lf.c
26707+++ b/vpx_scale/leapster/vpxscale_lf.c
26708@@ -1,10 +1,11 @@
26709 /*
26710 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26711 *
26712- * Use of this source code is governed by a BSD-style license and patent
26713- * grant that can be found in the LICENSE file in the root of the source
26714- * tree. All contributing project authors may be found in the AUTHORS
26715- * file in the root of the source tree.
26716+ * Use of this source code is governed by a BSD-style license
26717+ * that can be found in the LICENSE file in the root of the source
26718+ * tree. An additional intellectual property rights grant can be found
26719+ * in the file PATENTS. All contributing project authors may
26720+ * be found in the AUTHORS file in the root of the source tree.
26721 */
26722
26723
26724diff --git a/vpx_scale/leapster/yv12extend.c b/vpx_scale/leapster/yv12extend.c
26725index 480d971..5a89c31 100644
26726--- a/vpx_scale/leapster/yv12extend.c
26727+++ b/vpx_scale/leapster/yv12extend.c
26728@@ -1,10 +1,11 @@
26729 /*
26730 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26731 *
26732- * Use of this source code is governed by a BSD-style license and patent
26733- * grant that can be found in the LICENSE file in the root of the source
26734- * tree. All contributing project authors may be found in the AUTHORS
26735- * file in the root of the source tree.
26736+ * Use of this source code is governed by a BSD-style license
26737+ * that can be found in the LICENSE file in the root of the source
26738+ * tree. An additional intellectual property rights grant can be found
26739+ * in the file PATENTS. All contributing project authors may
26740+ * be found in the AUTHORS file in the root of the source tree.
26741 */
26742
26743
26744diff --git a/vpx_scale/scale_mode.h b/vpx_scale/scale_mode.h
26745index 2a9ab76..41aefa2 100644
26746--- a/vpx_scale/scale_mode.h
26747+++ b/vpx_scale/scale_mode.h
26748@@ -1,10 +1,11 @@
26749 /*
26750 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26751 *
26752- * Use of this source code is governed by a BSD-style license and patent
26753- * grant that can be found in the LICENSE file in the root of the source
26754- * tree. All contributing project authors may be found in the AUTHORS
26755- * file in the root of the source tree.
26756+ * Use of this source code is governed by a BSD-style license
26757+ * that can be found in the LICENSE file in the root of the source
26758+ * tree. An additional intellectual property rights grant can be found
26759+ * in the file PATENTS. All contributing project authors may
26760+ * be found in the AUTHORS file in the root of the source tree.
26761 */
26762
26763
26764diff --git a/vpx_scale/symbian/gen_scalers_armv4.asm b/vpx_scale/symbian/gen_scalers_armv4.asm
26765index 1c904ed..e317fe9 100644
26766--- a/vpx_scale/symbian/gen_scalers_armv4.asm
26767+++ b/vpx_scale/symbian/gen_scalers_armv4.asm
26768@@ -1,10 +1,11 @@
26769 ;
26770 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26771 ;
26772-; Use of this source code is governed by a BSD-style license and patent
26773-; grant that can be found in the LICENSE file in the root of the source
26774-; tree. All contributing project authors may be found in the AUTHORS
26775-; file in the root of the source tree.
26776+; Use of this source code is governed by a BSD-style license
26777+; that can be found in the LICENSE file in the root of the source
26778+; tree. An additional intellectual property rights grant can be found
26779+; in the file PATENTS. All contributing project authors may
26780+; be found in the AUTHORS file in the root of the source tree.
26781 ;
26782
26783
26784diff --git a/vpx_scale/symbian/scalesystemdependant.c b/vpx_scale/symbian/scalesystemdependant.c
26785index a2acc3e..75ef26d 100644
26786--- a/vpx_scale/symbian/scalesystemdependant.c
26787+++ b/vpx_scale/symbian/scalesystemdependant.c
26788@@ -1,10 +1,11 @@
26789 /*
26790 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26791 *
26792- * Use of this source code is governed by a BSD-style license and patent
26793- * grant that can be found in the LICENSE file in the root of the source
26794- * tree. All contributing project authors may be found in the AUTHORS
26795- * file in the root of the source tree.
26796+ * Use of this source code is governed by a BSD-style license
26797+ * that can be found in the LICENSE file in the root of the source
26798+ * tree. An additional intellectual property rights grant can be found
26799+ * in the file PATENTS. All contributing project authors may
26800+ * be found in the AUTHORS file in the root of the source tree.
26801 */
26802
26803
26804diff --git a/vpx_scale/vpxscale.h b/vpx_scale/vpxscale.h
26805index 9a86b75..f3057fe 100644
26806--- a/vpx_scale/vpxscale.h
26807+++ b/vpx_scale/vpxscale.h
26808@@ -1,10 +1,11 @@
26809 /*
26810 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26811 *
26812- * Use of this source code is governed by a BSD-style license and patent
26813- * grant that can be found in the LICENSE file in the root of the source
26814- * tree. All contributing project authors may be found in the AUTHORS
26815- * file in the root of the source tree.
26816+ * Use of this source code is governed by a BSD-style license
26817+ * that can be found in the LICENSE file in the root of the source
26818+ * tree. An additional intellectual property rights grant can be found
26819+ * in the file PATENTS. All contributing project authors may
26820+ * be found in the AUTHORS file in the root of the source tree.
26821 */
26822
26823
26824diff --git a/vpx_scale/wce/gen_scalers_armv4.asm b/vpx_scale/wce/gen_scalers_armv4.asm
26825index 1c904ed..e317fe9 100644
26826--- a/vpx_scale/wce/gen_scalers_armv4.asm
26827+++ b/vpx_scale/wce/gen_scalers_armv4.asm
26828@@ -1,10 +1,11 @@
26829 ;
26830 ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26831 ;
26832-; Use of this source code is governed by a BSD-style license and patent
26833-; grant that can be found in the LICENSE file in the root of the source
26834-; tree. All contributing project authors may be found in the AUTHORS
26835-; file in the root of the source tree.
26836+; Use of this source code is governed by a BSD-style license
26837+; that can be found in the LICENSE file in the root of the source
26838+; tree. An additional intellectual property rights grant can be found
26839+; in the file PATENTS. All contributing project authors may
26840+; be found in the AUTHORS file in the root of the source tree.
26841 ;
26842
26843
26844diff --git a/vpx_scale/wce/scalesystemdependant.c b/vpx_scale/wce/scalesystemdependant.c
26845index a5a6a52..1d62eb5 100644
26846--- a/vpx_scale/wce/scalesystemdependant.c
26847+++ b/vpx_scale/wce/scalesystemdependant.c
26848@@ -1,10 +1,11 @@
26849 /*
26850 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26851 *
26852- * Use of this source code is governed by a BSD-style license and patent
26853- * grant that can be found in the LICENSE file in the root of the source
26854- * tree. All contributing project authors may be found in the AUTHORS
26855- * file in the root of the source tree.
26856+ * Use of this source code is governed by a BSD-style license
26857+ * that can be found in the LICENSE file in the root of the source
26858+ * tree. An additional intellectual property rights grant can be found
26859+ * in the file PATENTS. All contributing project authors may
26860+ * be found in the AUTHORS file in the root of the source tree.
26861 */
26862
26863
26864diff --git a/vpx_scale/win32/scaleopt.c b/vpx_scale/win32/scaleopt.c
26865index da0533e..59d49e6 100644
26866--- a/vpx_scale/win32/scaleopt.c
26867+++ b/vpx_scale/win32/scaleopt.c
26868@@ -1,10 +1,11 @@
26869 /*
26870 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26871 *
26872- * Use of this source code is governed by a BSD-style license and patent
26873- * grant that can be found in the LICENSE file in the root of the source
26874- * tree. All contributing project authors may be found in the AUTHORS
26875- * file in the root of the source tree.
26876+ * Use of this source code is governed by a BSD-style license
26877+ * that can be found in the LICENSE file in the root of the source
26878+ * tree. An additional intellectual property rights grant can be found
26879+ * in the file PATENTS. All contributing project authors may
26880+ * be found in the AUTHORS file in the root of the source tree.
26881 */
26882
26883
26884diff --git a/vpx_scale/win32/scalesystemdependant.c b/vpx_scale/win32/scalesystemdependant.c
26885index 9ed48bf..82b90c9 100644
26886--- a/vpx_scale/win32/scalesystemdependant.c
26887+++ b/vpx_scale/win32/scalesystemdependant.c
26888@@ -1,10 +1,11 @@
26889 /*
26890 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26891 *
26892- * Use of this source code is governed by a BSD-style license and patent
26893- * grant that can be found in the LICENSE file in the root of the source
26894- * tree. All contributing project authors may be found in the AUTHORS
26895- * file in the root of the source tree.
26896+ * Use of this source code is governed by a BSD-style license
26897+ * that can be found in the LICENSE file in the root of the source
26898+ * tree. An additional intellectual property rights grant can be found
26899+ * in the file PATENTS. All contributing project authors may
26900+ * be found in the AUTHORS file in the root of the source tree.
26901 */
26902
26903
26904diff --git a/vpx_scale/x86_64/scaleopt.c b/vpx_scale/x86_64/scaleopt.c
26905index 3d2d5f2..de4c478 100644
26906--- a/vpx_scale/x86_64/scaleopt.c
26907+++ b/vpx_scale/x86_64/scaleopt.c
26908@@ -1,10 +1,11 @@
26909 /*
26910 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26911 *
26912- * Use of this source code is governed by a BSD-style license and patent
26913- * grant that can be found in the LICENSE file in the root of the source
26914- * tree. All contributing project authors may be found in the AUTHORS
26915- * file in the root of the source tree.
26916+ * Use of this source code is governed by a BSD-style license
26917+ * that can be found in the LICENSE file in the root of the source
26918+ * tree. An additional intellectual property rights grant can be found
26919+ * in the file PATENTS. All contributing project authors may
26920+ * be found in the AUTHORS file in the root of the source tree.
26921 */
26922
26923
26924diff --git a/vpx_scale/x86_64/scalesystemdependant.c b/vpx_scale/x86_64/scalesystemdependant.c
26925index 43f05a6..0324449 100644
26926--- a/vpx_scale/x86_64/scalesystemdependant.c
26927+++ b/vpx_scale/x86_64/scalesystemdependant.c
26928@@ -1,10 +1,11 @@
26929 /*
26930 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26931 *
26932- * Use of this source code is governed by a BSD-style license and patent
26933- * grant that can be found in the LICENSE file in the root of the source
26934- * tree. All contributing project authors may be found in the AUTHORS
26935- * file in the root of the source tree.
26936+ * Use of this source code is governed by a BSD-style license
26937+ * that can be found in the LICENSE file in the root of the source
26938+ * tree. An additional intellectual property rights grant can be found
26939+ * in the file PATENTS. All contributing project authors may
26940+ * be found in the AUTHORS file in the root of the source tree.
26941 */
26942
26943
26944diff --git a/vpx_scale/yv12config.h b/vpx_scale/yv12config.h
26945index a8d0ce4..f01bd78 100644
26946--- a/vpx_scale/yv12config.h
26947+++ b/vpx_scale/yv12config.h
26948@@ -1,10 +1,11 @@
26949 /*
26950 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26951 *
26952- * Use of this source code is governed by a BSD-style license and patent
26953- * grant that can be found in the LICENSE file in the root of the source
26954- * tree. All contributing project authors may be found in the AUTHORS
26955- * file in the root of the source tree.
26956+ * Use of this source code is governed by a BSD-style license
26957+ * that can be found in the LICENSE file in the root of the source
26958+ * tree. An additional intellectual property rights grant can be found
26959+ * in the file PATENTS. All contributing project authors may
26960+ * be found in the AUTHORS file in the root of the source tree.
26961 */
26962
26963
26964diff --git a/vpx_scale/yv12extend.h b/vpx_scale/yv12extend.h
26965index 9968fea..b310ef5 100644
26966--- a/vpx_scale/yv12extend.h
26967+++ b/vpx_scale/yv12extend.h
26968@@ -1,10 +1,11 @@
26969 /*
26970 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26971 *
26972- * Use of this source code is governed by a BSD-style license and patent
26973- * grant that can be found in the LICENSE file in the root of the source
26974- * tree. All contributing project authors may be found in the AUTHORS
26975- * file in the root of the source tree.
26976+ * Use of this source code is governed by a BSD-style license
26977+ * that can be found in the LICENSE file in the root of the source
26978+ * tree. An additional intellectual property rights grant can be found
26979+ * in the file PATENTS. All contributing project authors may
26980+ * be found in the AUTHORS file in the root of the source tree.
26981 */
26982
26983
26984diff --git a/wince_wmain_adapter.cpp b/wince_wmain_adapter.cpp
26985index db2119c..48d3ab3 100644
26986--- a/wince_wmain_adapter.cpp
26987+++ b/wince_wmain_adapter.cpp
26988@@ -1,10 +1,11 @@
26989 /*
26990 * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
26991 *
26992- * Use of this source code is governed by a BSD-style license and patent
26993- * grant that can be found in the LICENSE file in the root of the source
26994- * tree. All contributing project authors may be found in the AUTHORS
26995- * file in the root of the source tree.
26996+ * Use of this source code is governed by a BSD-style license
26997+ * that can be found in the LICENSE file in the root of the source
26998+ * tree. An additional intellectual property rights grant can be found
26999+ * in the file PATENTS. All contributing project authors may
27000+ * be found in the AUTHORS file in the root of the source tree.
27001 */
27002
27003
27004diff --git a/y4minput.c b/y4minput.c
27005new file mode 100644
27006index 0000000..895226d
27007--- /dev/null
27008+++ b/y4minput.c
27009@@ -0,0 +1,881 @@
27010+/*
27011+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
27012+ *
27013+ * Use of this source code is governed by a BSD-style license
27014+ * that can be found in the LICENSE file in the root of the source
27015+ * tree. An additional intellectual property rights grant can be found
27016+ * in the file PATENTS. All contributing project authors may
27017+ * be found in the AUTHORS file in the root of the source tree.
27018+ *
27019+ * Based on code from the OggTheora software codec source code,
27020+ * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
27021+ */
27022+#include <stdlib.h>
27023+#include <string.h>
27024+#include "y4minput.h"
27025+
27026+static int y4m_parse_tags(y4m_input *_y4m,char *_tags){
27027+ int got_w;
27028+ int got_h;
27029+ int got_fps;
27030+ int got_interlace;
27031+ int got_par;
27032+ int got_chroma;
27033+ char *p;
27034+ char *q;
27035+ got_w=got_h=got_fps=got_interlace=got_par=got_chroma=0;
27036+ for(p=_tags;;p=q){
27037+ /*Skip any leading spaces.*/
27038+ while(*p==' ')p++;
27039+ /*If that's all we have, stop.*/
27040+ if(p[0]=='\0')break;
27041+ /*Find the end of this tag.*/
27042+ for(q=p+1;*q!='\0'&&*q!=' ';q++);
27043+ /*Process the tag.*/
27044+ switch(p[0]){
27045+ case 'W':{
27046+ if(sscanf(p+1,"%d",&_y4m->pic_w)!=1)return -1;
27047+ got_w=1;
27048+ }break;
27049+ case 'H':{
27050+ if(sscanf(p+1,"%d",&_y4m->pic_h)!=1)return -1;
27051+ got_h=1;
27052+ }break;
27053+ case 'F':{
27054+ if(sscanf(p+1,"%d:%d",&_y4m->fps_n,&_y4m->fps_d)!=2){
27055+ return -1;
27056+ }
27057+ got_fps=1;
27058+ }break;
27059+ case 'I':{
27060+ _y4m->interlace=p[1];
27061+ got_interlace=1;
27062+ }break;
27063+ case 'A':{
27064+ if(sscanf(p+1,"%d:%d",&_y4m->par_n,&_y4m->par_d)!=2){
27065+ return -1;
27066+ }
27067+ got_par=1;
27068+ }break;
27069+ case 'C':{
27070+ if(q-p>16)return -1;
27071+ memcpy(_y4m->chroma_type,p+1,q-p-1);
27072+ _y4m->chroma_type[q-p-1]='\0';
27073+ got_chroma=1;
27074+ }break;
27075+ /*Ignore unknown tags.*/
27076+ }
27077+ }
27078+ if(!got_w||!got_h||!got_fps)return -1;
27079+ if(!got_interlace)_y4m->interlace='?';
27080+ if(!got_par)_y4m->par_n=_y4m->par_d=0;
27081+ /*Chroma-type is not specified in older files, e.g., those generated by
27082+ mplayer.*/
27083+ if(!got_chroma)strcpy(_y4m->chroma_type,"420");
27084+ return 0;
27085+}
27086+
27087+
27088+
27089+/*All anti-aliasing filters in the following conversion functions are based on
27090+ one of two window functions:
27091+ The 6-tap Lanczos window (for down-sampling and shifts):
27092+ sinc(\pi*t)*sinc(\pi*t/3), |t|<3 (sinc(t)==sin(t)/t)
27093+ 0, |t|>=3
27094+ The 4-tap Mitchell window (for up-sampling):
27095+ 7|t|^3-12|t|^2+16/3, |t|<1
27096+ -(7/3)|x|^3+12|x|^2-20|x|+32/3, |t|<2
27097+ 0, |t|>=2
27098+ The number of taps is intentionally kept small to reduce computational
27099+ overhead and limit ringing.
27100+
27101+ The taps from these filters are scaled so that their sum is 1, and the result
27102+ is scaled by 128 and rounded to integers to create a filter whose
27103+ intermediate values fit inside 16 bits.
27104+ Coefficients are rounded in such a way as to ensure their sum is still 128,
27105+ which is usually equivalent to normal rounding.
27106+
27107+ Conversions which require both horizontal and vertical filtering could
27108+ have these steps pipelined, for less memory consumption and better cache
27109+ performance, but we do them separately for simplicity.*/
27110+
27111+#define OC_MINI(_a,_b) ((_a)>(_b)?(_b):(_a))
27112+#define OC_MAXI(_a,_b) ((_a)<(_b)?(_b):(_a))
27113+#define OC_CLAMPI(_a,_b,_c) (OC_MAXI(_a,OC_MINI(_b,_c)))
27114+
27115+/*420jpeg chroma samples are sited like:
27116+ Y-------Y-------Y-------Y-------
27117+ | | | |
27118+ | BR | | BR |
27119+ | | | |
27120+ Y-------Y-------Y-------Y-------
27121+ | | | |
27122+ | | | |
27123+ | | | |
27124+ Y-------Y-------Y-------Y-------
27125+ | | | |
27126+ | BR | | BR |
27127+ | | | |
27128+ Y-------Y-------Y-------Y-------
27129+ | | | |
27130+ | | | |
27131+ | | | |
27132+
27133+ 420mpeg2 chroma samples are sited like:
27134+ Y-------Y-------Y-------Y-------
27135+ | | | |
27136+ BR | BR |
27137+ | | | |
27138+ Y-------Y-------Y-------Y-------
27139+ | | | |
27140+ | | | |
27141+ | | | |
27142+ Y-------Y-------Y-------Y-------
27143+ | | | |
27144+ BR | BR |
27145+ | | | |
27146+ Y-------Y-------Y-------Y-------
27147+ | | | |
27148+ | | | |
27149+ | | | |
27150+
27151+ We use a resampling filter to shift the site locations one quarter pixel (at
27152+ the chroma plane's resolution) to the right.
27153+ The 4:2:2 modes look exactly the same, except there are twice as many chroma
27154+ lines, and they are vertically co-sited with the luma samples in both the
27155+ mpeg2 and jpeg cases (thus requiring no vertical resampling).*/
27156+static void y4m_42xmpeg2_42xjpeg_helper(unsigned char *_dst,
27157+ const unsigned char *_src,int _c_w,int _c_h){
27158+ int pli;
27159+ int y;
27160+ int x;
27161+ for(y=0;y<_c_h;y++){
27162+ /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos
27163+ window.*/
27164+ for(x=0;x<OC_MINI(_c_w,2);x++){
27165+ _dst[x]=(unsigned char)OC_CLAMPI(0,(4*_src[0]-17*_src[OC_MAXI(x-1,0)]+
27166+ 114*_src[x]+35*_src[OC_MINI(x+1,_c_w-1)]-9*_src[OC_MINI(x+2,_c_w-1)]+
27167+ _src[OC_MINI(x+3,_c_w-1)]+64)>>7,255);
27168+ }
27169+ for(;x<_c_w-3;x++){
27170+ _dst[x]=(unsigned char)OC_CLAMPI(0,(4*_src[x-2]-17*_src[x-1]+
27171+ 114*_src[x]+35*_src[x+1]-9*_src[x+2]+_src[x+3]+64)>>7,255);
27172+ }
27173+ for(;x<_c_w;x++){
27174+ _dst[x]=(unsigned char)OC_CLAMPI(0,(4*_src[x-2]-17*_src[x-1]+
27175+ 114*_src[x]+35*_src[OC_MINI(x+1,_c_w-1)]-9*_src[OC_MINI(x+2,_c_w-1)]+
27176+ _src[_c_w-1]+64)>>7,255);
27177+ }
27178+ _dst+=_c_w;
27179+ _src+=_c_w;
27180+ }
27181+}
27182+
27183+/*Handles both 422 and 420mpeg2 to 422jpeg and 420jpeg, respectively.*/
27184+static void y4m_convert_42xmpeg2_42xjpeg(y4m_input *_y4m,unsigned char *_dst,
27185+ unsigned char *_aux){
27186+ int c_w;
27187+ int c_h;
27188+ int c_sz;
27189+ int pli;
27190+ int y;
27191+ int x;
27192+ /*Skip past the luma data.*/
27193+ _dst+=_y4m->pic_w*_y4m->pic_h;
27194+ /*Compute the size of each chroma plane.*/
27195+ c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
27196+ c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
27197+ c_sz=c_w*c_h;
27198+ for(pli=1;pli<3;pli++){
27199+ y4m_42xmpeg2_42xjpeg_helper(_dst,_aux,c_w,c_h);
27200+ _dst+=c_sz;
27201+ _aux+=c_sz;
27202+ }
27203+}
27204+
27205+/*This format is only used for interlaced content, but is included for
27206+ completeness.
27207+
27208+ 420jpeg chroma samples are sited like:
27209+ Y-------Y-------Y-------Y-------
27210+ | | | |
27211+ | BR | | BR |
27212+ | | | |
27213+ Y-------Y-------Y-------Y-------
27214+ | | | |
27215+ | | | |
27216+ | | | |
27217+ Y-------Y-------Y-------Y-------
27218+ | | | |
27219+ | BR | | BR |
27220+ | | | |
27221+ Y-------Y-------Y-------Y-------
27222+ | | | |
27223+ | | | |
27224+ | | | |
27225+
27226+ 420paldv chroma samples are sited like:
27227+ YR------Y-------YR------Y-------
27228+ | | | |
27229+ | | | |
27230+ | | | |
27231+ YB------Y-------YB------Y-------
27232+ | | | |
27233+ | | | |
27234+ | | | |
27235+ YR------Y-------YR------Y-------
27236+ | | | |
27237+ | | | |
27238+ | | | |
27239+ YB------Y-------YB------Y-------
27240+ | | | |
27241+ | | | |
27242+ | | | |
27243+
27244+ We use a resampling filter to shift the site locations one quarter pixel (at
27245+ the chroma plane's resolution) to the right.
27246+ Then we use another filter to move the C_r location down one quarter pixel,
27247+ and the C_b location up one quarter pixel.*/
27248+static void y4m_convert_42xpaldv_42xjpeg(y4m_input *_y4m,unsigned char *_dst,
27249+ unsigned char *_aux){
27250+ unsigned char *tmp;
27251+ int c_w;
27252+ int c_h;
27253+ int c_sz;
27254+ int pli;
27255+ int y;
27256+ int x;
27257+ /*Skip past the luma data.*/
27258+ _dst+=_y4m->pic_w*_y4m->pic_h;
27259+ /*Compute the size of each chroma plane.*/
27260+ c_w=(_y4m->pic_w+1)/2;
27261+ c_h=(_y4m->pic_h+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
27262+ c_sz=c_w*c_h;
27263+ tmp=_aux+2*c_sz;
27264+ for(pli=1;pli<3;pli++){
27265+ /*First do the horizontal re-sampling.
27266+ This is the same as the mpeg2 case, except that after the horizontal
27267+ case, we need to apply a second vertical filter.*/
27268+ y4m_42xmpeg2_42xjpeg_helper(tmp,_aux,c_w,c_h);
27269+ _aux+=c_sz;
27270+ switch(pli){
27271+ case 1:{
27272+ /*Slide C_b up a quarter-pel.
27273+ This is the same filter used above, but in the other order.*/
27274+ for(x=0;x<c_w;x++){
27275+ for(y=0;y<OC_MINI(c_h,3);y++){
27276+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(tmp[0]
27277+ -9*tmp[OC_MAXI(y-2,0)*c_w]+35*tmp[OC_MAXI(y-1,0)*c_w]
27278+ +114*tmp[y*c_w]-17*tmp[OC_MINI(y+1,c_h-1)*c_w]
27279+ +4*tmp[OC_MINI(y+2,c_h-1)*c_w]+64)>>7,255);
27280+ }
27281+ for(;y<c_h-2;y++){
27282+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(tmp[(y-3)*c_w]
27283+ -9*tmp[(y-2)*c_w]+35*tmp[(y-1)*c_w]+114*tmp[y*c_w]
27284+ -17*tmp[(y+1)*c_w]+4*tmp[(y+2)*c_w]+64)>>7,255);
27285+ }
27286+ for(;y<c_h;y++){
27287+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(tmp[(y-3)*c_w]
27288+ -9*tmp[(y-2)*c_w]+35*tmp[(y-1)*c_w]+114*tmp[y*c_w]
27289+ -17*tmp[OC_MINI(y+1,c_h-1)*c_w]+4*tmp[(c_h-1)*c_w]+64)>>7,255);
27290+ }
27291+ _dst++;
27292+ tmp++;
27293+ }
27294+ _dst+=c_sz-c_w;
27295+ tmp-=c_w;
27296+ }break;
27297+ case 2:{
27298+ /*Slide C_r down a quarter-pel.
27299+ This is the same as the horizontal filter.*/
27300+ for(x=0;x<c_w;x++){
27301+ for(y=0;y<OC_MINI(c_h,2);y++){
27302+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(4*tmp[0]
27303+ -17*tmp[OC_MAXI(y-1,0)*c_w]+114*tmp[y*c_w]
27304+ +35*tmp[OC_MINI(y+1,c_h-1)*c_w]-9*tmp[OC_MINI(y+2,c_h-1)*c_w]
27305+ +tmp[OC_MINI(y+3,c_h-1)*c_w]+64)>>7,255);
27306+ }
27307+ for(;y<c_h-3;y++){
27308+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(4*tmp[(y-2)*c_w]
27309+ -17*tmp[(y-1)*c_w]+114*tmp[y*c_w]+35*tmp[(y+1)*c_w]
27310+ -9*tmp[(y+2)*c_w]+tmp[(y+3)*c_w]+64)>>7,255);
27311+ }
27312+ for(;y<c_h;y++){
27313+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(4*tmp[(y-2)*c_w]
27314+ -17*tmp[(y-1)*c_w]+114*tmp[y*c_w]+35*tmp[OC_MINI(y+1,c_h-1)*c_w]
27315+ -9*tmp[OC_MINI(y+2,c_h-1)*c_w]+tmp[(c_h-1)*c_w]+64)>>7,255);
27316+ }
27317+ _dst++;
27318+ tmp++;
27319+ }
27320+ }break;
27321+ }
27322+ /*For actual interlaced material, this would have to be done separately on
27323+ each field, and the shift amounts would be different.
27324+ C_r moves down 1/8, C_b up 3/8 in the top field, and C_r moves down 3/8,
27325+ C_b up 1/8 in the bottom field.
27326+ The corresponding filters would be:
27327+ Down 1/8 (reverse order for up): [3 -11 125 15 -4 0]/128
27328+ Down 3/8 (reverse order for up): [4 -19 98 56 -13 2]/128*/
27329+ }
27330+}
27331+
27332+/*Perform vertical filtering to reduce a single plane from 4:2:2 to 4:2:0.
27333+ This is used as a helper by several converation routines.*/
27334+static void y4m_422jpeg_420jpeg_helper(unsigned char *_dst,
27335+ const unsigned char *_src,int _c_w,int _c_h){
27336+ int y;
27337+ int x;
27338+ /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
27339+ for(x=0;x<_c_w;x++){
27340+ for(y=0;y<OC_MINI(_c_h,2);y+=2){
27341+ _dst[(y>>1)*_c_w]=OC_CLAMPI(0,(64*_src[0]
27342+ +78*_src[OC_MINI(1,_c_h-1)*_c_w]
27343+ -17*_src[OC_MINI(2,_c_h-1)*_c_w]
27344+ +3*_src[OC_MINI(3,_c_h-1)*_c_w]+64)>>7,255);
27345+ }
27346+ for(;y<_c_h-3;y+=2){
27347+ _dst[(y>>1)*_c_w]=OC_CLAMPI(0,(3*(_src[(y-2)*_c_w]+_src[(y+3)*_c_w])
27348+ -17*(_src[(y-1)*_c_w]+_src[(y+2)*_c_w])
27349+ +78*(_src[y*_c_w]+_src[(y+1)*_c_w])+64)>>7,255);
27350+ }
27351+ for(;y<_c_h;y+=2){
27352+ _dst[(y>>1)*_c_w]=OC_CLAMPI(0,(3*(_src[(y-2)*_c_w]
27353+ +_src[(_c_h-1)*_c_w])-17*(_src[(y-1)*_c_w]
27354+ +_src[OC_MINI(y+2,_c_h-1)*_c_w])
27355+ +78*(_src[y*_c_w]+_src[OC_MINI(y+1,_c_h-1)*_c_w])+64)>>7,255);
27356+ }
27357+ _src++;
27358+ _dst++;
27359+ }
27360+}
27361+
27362+/*420jpeg chroma samples are sited like:
27363+ Y-------Y-------Y-------Y-------
27364+ | | | |
27365+ | BR | | BR |
27366+ | | | |
27367+ Y-------Y-------Y-------Y-------
27368+ | | | |
27369+ | | | |
27370+ | | | |
27371+ Y-------Y-------Y-------Y-------
27372+ | | | |
27373+ | BR | | BR |
27374+ | | | |
27375+ Y-------Y-------Y-------Y-------
27376+ | | | |
27377+ | | | |
27378+ | | | |
27379+
27380+ 422jpeg chroma samples are sited like:
27381+ Y---BR--Y-------Y---BR--Y-------
27382+ | | | |
27383+ | | | |
27384+ | | | |
27385+ Y---BR--Y-------Y---BR--Y-------
27386+ | | | |
27387+ | | | |
27388+ | | | |
27389+ Y---BR--Y-------Y---BR--Y-------
27390+ | | | |
27391+ | | | |
27392+ | | | |
27393+ Y---BR--Y-------Y---BR--Y-------
27394+ | | | |
27395+ | | | |
27396+ | | | |
27397+
27398+ We use a resampling filter to decimate the chroma planes by two in the
27399+ vertical direction.*/
27400+static void y4m_convert_422jpeg_420jpeg(y4m_input *_y4m,unsigned char *_dst,
27401+ unsigned char *_aux){
27402+ int c_w;
27403+ int c_h;
27404+ int c_sz;
27405+ int dst_c_w;
27406+ int dst_c_h;
27407+ int dst_c_sz;
27408+ int tmp_sz;
27409+ int pic_sz;
27410+ int pli;
27411+ /*Skip past the luma data.*/
27412+ _dst+=_y4m->pic_w*_y4m->pic_h;
27413+ /*Compute the size of each chroma plane.*/
27414+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
27415+ c_h=_y4m->pic_h;
27416+ dst_c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
27417+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
27418+ c_sz=c_w*c_h;
27419+ dst_c_sz=dst_c_w*dst_c_h;
27420+ for(pli=1;pli<3;pli++){
27421+ y4m_422jpeg_420jpeg_helper(_dst,_aux,c_w,c_h);
27422+ _aux+=c_sz;
27423+ _dst+=dst_c_sz;
27424+ }
27425+}
27426+
27427+/*420jpeg chroma samples are sited like:
27428+ Y-------Y-------Y-------Y-------
27429+ | | | |
27430+ | BR | | BR |
27431+ | | | |
27432+ Y-------Y-------Y-------Y-------
27433+ | | | |
27434+ | | | |
27435+ | | | |
27436+ Y-------Y-------Y-------Y-------
27437+ | | | |
27438+ | BR | | BR |
27439+ | | | |
27440+ Y-------Y-------Y-------Y-------
27441+ | | | |
27442+ | | | |
27443+ | | | |
27444+
27445+ 422 chroma samples are sited like:
27446+ YBR-----Y-------YBR-----Y-------
27447+ | | | |
27448+ | | | |
27449+ | | | |
27450+ YBR-----Y-------YBR-----Y-------
27451+ | | | |
27452+ | | | |
27453+ | | | |
27454+ YBR-----Y-------YBR-----Y-------
27455+ | | | |
27456+ | | | |
27457+ | | | |
27458+ YBR-----Y-------YBR-----Y-------
27459+ | | | |
27460+ | | | |
27461+ | | | |
27462+
27463+ We use a resampling filter to shift the original site locations one quarter
27464+ pixel (at the original chroma resolution) to the right.
27465+ Then we use a second resampling filter to decimate the chroma planes by two
27466+ in the vertical direction.*/
27467+static void y4m_convert_422_420jpeg(y4m_input *_y4m,unsigned char *_dst,
27468+ unsigned char *_aux){
27469+ unsigned char *tmp;
27470+ int c_w;
27471+ int c_h;
27472+ int c_sz;
27473+ int dst_c_w;
27474+ int dst_c_h;
27475+ int dst_c_sz;
27476+ int pli;
27477+ int y;
27478+ int x;
27479+ /*Skip past the luma data.*/
27480+ _dst+=_y4m->pic_w*_y4m->pic_h;
27481+ /*Compute the size of each chroma plane.*/
27482+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
27483+ c_h=_y4m->pic_h;
27484+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
27485+ c_sz=c_w*c_h;
27486+ dst_c_sz=c_w*dst_c_h;
27487+ tmp=_aux+2*c_sz;
27488+ for(pli=1;pli<3;pli++){
27489+ /*In reality, the horizontal and vertical steps could be pipelined, for
27490+ less memory consumption and better cache performance, but we do them
27491+ separately for simplicity.*/
27492+ /*First do horizontal filtering (convert to 422jpeg)*/
27493+ y4m_42xmpeg2_42xjpeg_helper(tmp,_aux,c_w,c_h);
27494+ /*Now do the vertical filtering.*/
27495+ y4m_422jpeg_420jpeg_helper(_dst,tmp,c_w,c_h);
27496+ _aux+=c_sz;
27497+ _dst+=dst_c_sz;
27498+ }
27499+}
27500+
27501+/*420jpeg chroma samples are sited like:
27502+ Y-------Y-------Y-------Y-------
27503+ | | | |
27504+ | BR | | BR |
27505+ | | | |
27506+ Y-------Y-------Y-------Y-------
27507+ | | | |
27508+ | | | |
27509+ | | | |
27510+ Y-------Y-------Y-------Y-------
27511+ | | | |
27512+ | BR | | BR |
27513+ | | | |
27514+ Y-------Y-------Y-------Y-------
27515+ | | | |
27516+ | | | |
27517+ | | | |
27518+
27519+ 411 chroma samples are sited like:
27520+ YBR-----Y-------Y-------Y-------
27521+ | | | |
27522+ | | | |
27523+ | | | |
27524+ YBR-----Y-------Y-------Y-------
27525+ | | | |
27526+ | | | |
27527+ | | | |
27528+ YBR-----Y-------Y-------Y-------
27529+ | | | |
27530+ | | | |
27531+ | | | |
27532+ YBR-----Y-------Y-------Y-------
27533+ | | | |
27534+ | | | |
27535+ | | | |
27536+
27537+ We use a filter to resample at site locations one eighth pixel (at the source
27538+ chroma plane's horizontal resolution) and five eighths of a pixel to the
27539+ right.
27540+ Then we use another filter to decimate the planes by 2 in the vertical
27541+ direction.*/
27542+static void y4m_convert_411_420jpeg(y4m_input *_y4m,unsigned char *_dst,
27543+ unsigned char *_aux){
27544+ unsigned char *tmp;
27545+ int c_w;
27546+ int c_h;
27547+ int c_sz;
27548+ int dst_c_w;
27549+ int dst_c_h;
27550+ int dst_c_sz;
27551+ int tmp_sz;
27552+ int pli;
27553+ int y;
27554+ int x;
27555+ /*Skip past the luma data.*/
27556+ _dst+=_y4m->pic_w*_y4m->pic_h;
27557+ /*Compute the size of each chroma plane.*/
27558+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
27559+ c_h=_y4m->pic_h;
27560+ dst_c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
27561+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
27562+ c_sz=c_w*c_h;
27563+ dst_c_sz=dst_c_w*dst_c_h;
27564+ tmp_sz=dst_c_w*c_h;
27565+ tmp=_aux+2*c_sz;
27566+ for(pli=1;pli<3;pli++){
27567+ /*In reality, the horizontal and vertical steps could be pipelined, for
27568+ less memory consumption and better cache performance, but we do them
27569+ separately for simplicity.*/
27570+ /*First do horizontal filtering (convert to 422jpeg)*/
27571+ for(y=0;y<c_h;y++){
27572+ /*Filters: [1 110 18 -1]/128 and [-3 50 86 -5]/128, both derived from a
27573+ 4-tap Mitchell window.*/
27574+ for(x=0;x<OC_MINI(c_w,1);x++){
27575+ tmp[x<<1]=(unsigned char)OC_CLAMPI(0,(111*_aux[0]
27576+ +18*_aux[OC_MINI(1,c_w-1)]-_aux[OC_MINI(2,c_w-1)]+64)>>7,255);
27577+ tmp[x<<1|1]=(unsigned char)OC_CLAMPI(0,(47*_aux[0]
27578+ +86*_aux[OC_MINI(1,c_w-1)]-5*_aux[OC_MINI(2,c_w-1)]+64)>>7,255);
27579+ }
27580+ for(;x<c_w-2;x++){
27581+ tmp[x<<1]=(unsigned char)OC_CLAMPI(0,(_aux[x-1]+110*_aux[x]
27582+ +18*_aux[x+1]-_aux[x+2]+64)>>7,255);
27583+ tmp[x<<1|1]=(unsigned char)OC_CLAMPI(0,(-3*_aux[x-1]+50*_aux[x]
27584+ +86*_aux[x+1]-5*_aux[x+2]+64)>>7,255);
27585+ }
27586+ for(;x<c_w;x++){
27587+ tmp[x<<1]=(unsigned char)OC_CLAMPI(0,(_aux[x-1]+110*_aux[x]
27588+ +18*_aux[OC_MINI(x+1,c_w-1)]-_aux[c_w-1]+64)>>7,255);
27589+ if((x<<1|1)<dst_c_w){
27590+ tmp[x<<1|1]=(unsigned char)OC_CLAMPI(0,(-3*_aux[x-1]+50*_aux[x]
27591+ +86*_aux[OC_MINI(x+1,c_w-1)]-5*_aux[c_w-1]+64)>>7,255);
27592+ }
27593+ }
27594+ tmp+=dst_c_w;
27595+ _aux+=c_w;
27596+ }
27597+ tmp-=tmp_sz;
27598+ /*Now do the vertical filtering.*/
27599+ y4m_422jpeg_420jpeg_helper(_dst,tmp,dst_c_w,c_h);
27600+ _dst+=dst_c_sz;
27601+ }
27602+}
27603+
27604+/*Convert 444 to 420jpeg.*/
27605+static void y4m_convert_444_420jpeg(y4m_input *_y4m,unsigned char *_dst,
27606+ unsigned char *_aux){
27607+ unsigned char *tmp;
27608+ int c_w;
27609+ int c_h;
27610+ int c_sz;
27611+ int dst_c_w;
27612+ int dst_c_h;
27613+ int dst_c_sz;
27614+ int tmp_sz;
27615+ int pli;
27616+ int y;
27617+ int x;
27618+ /*Skip past the luma data.*/
27619+ _dst+=_y4m->pic_w*_y4m->pic_h;
27620+ /*Compute the size of each chroma plane.*/
27621+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
27622+ c_h=_y4m->pic_h;
27623+ dst_c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
27624+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
27625+ c_sz=c_w*c_h;
27626+ dst_c_sz=dst_c_w*dst_c_h;
27627+ tmp_sz=dst_c_w*c_h;
27628+ tmp=_aux+2*c_sz;
27629+ for(pli=1;pli<3;pli++){
27630+ /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
27631+ for(y=0;y<c_h;y++){
27632+ for(x=0;x<OC_MINI(c_w,2);x+=2){
27633+ tmp[x>>1]=OC_CLAMPI(0,(64*_aux[0]+78*_aux[OC_MINI(1,c_w-1)]
27634+ -17*_aux[OC_MINI(2,c_w-1)]
27635+ +3*_aux[OC_MINI(3,c_w-1)]+64)>>7,255);
27636+ }
27637+ for(;x<c_w-3;x+=2){
27638+ tmp[x>>1]=OC_CLAMPI(0,(3*(_aux[x-2]+_aux[x+3])
27639+ -17*(_aux[x-1]+_aux[x+2])+78*(_aux[x]+_aux[x+1])+64)>>7,255);
27640+ }
27641+ for(;x<c_w;x+=2){
27642+ tmp[x>>1]=OC_CLAMPI(0,(3*(_aux[x-2]+_aux[c_w-1])-
27643+ 17*(_aux[x-1]+_aux[OC_MINI(x+2,c_w-1)])+
27644+ 78*(_aux[x]+_aux[OC_MINI(x+1,c_w-1)])+64)>>7,255);
27645+ }
27646+ tmp+=dst_c_w;
27647+ _aux+=c_w;
27648+ }
27649+ tmp-=tmp_sz;
27650+ /*Now do the vertical filtering.*/
27651+ y4m_422jpeg_420jpeg_helper(_dst,tmp,dst_c_w,c_h);
27652+ _dst+=dst_c_sz;
27653+ }
27654+}
27655+
27656+/*The image is padded with empty chroma components at 4:2:0.*/
27657+static void y4m_convert_mono_420jpeg(y4m_input *_y4m,unsigned char *_dst,
27658+ unsigned char *_aux){
27659+ int c_sz;
27660+ _dst+=_y4m->pic_w*_y4m->pic_h;
27661+ c_sz=((_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h)*
27662+ ((_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v);
27663+ memset(_dst,128,c_sz*2);
27664+}
27665+
27666+/*No conversion function needed.*/
27667+static void y4m_convert_null(y4m_input *_y4m,unsigned char *_dst,
27668+ unsigned char *_aux){
27669+}
27670+
27671+int y4m_input_open(y4m_input *_y4m,FILE *_fin,char *_skip,int _nskip){
27672+ char buffer[80];
27673+ int ret;
27674+ int i;
27675+ /*Read until newline, or 80 cols, whichever happens first.*/
27676+ for(i=0;i<79;i++){
27677+ if(_nskip>0){
27678+ buffer[i]=*_skip++;
27679+ _nskip--;
27680+ }
27681+ else{
27682+ ret=fread(buffer+i,1,1,_fin);
27683+ if(ret<1)return -1;
27684+ }
27685+ if(buffer[i]=='\n')break;
27686+ }
27687+ /*We skipped too much header data.*/
27688+ if(_nskip>0)return -1;
27689+ if(i==79){
27690+ fprintf(stderr,"Error parsing header; not a YUV2MPEG2 file?\n");
27691+ return -1;
27692+ }
27693+ buffer[i]='\0';
27694+ if(memcmp(buffer,"YUV4MPEG",8)){
27695+ fprintf(stderr,"Incomplete magic for YUV4MPEG file.\n");
27696+ return -1;
27697+ }
27698+ if(buffer[8]!='2'){
27699+ fprintf(stderr,"Incorrect YUV input file version; YUV4MPEG2 required.\n");
27700+ }
27701+ ret=y4m_parse_tags(_y4m,buffer+5);
27702+ if(ret<0){
27703+ fprintf(stderr,"Error parsing YUV4MPEG2 header.\n");
27704+ return ret;
27705+ }
27706+ if(_y4m->interlace=='?'){
27707+ fprintf(stderr,"Warning: Input video interlacing format unknown; "
27708+ "assuming progressive scan.\n");
27709+ }
27710+ else if(_y4m->interlace!='p'){
27711+ fprintf(stderr,"Input video is interlaced; "
27712+ "Only progressive scan handled.\n");
27713+ return -1;
27714+ }
27715+ if(strcmp(_y4m->chroma_type,"420")==0||
27716+ strcmp(_y4m->chroma_type,"420jpeg")==0){
27717+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
27718+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h
27719+ +2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
27720+ /*Natively supported: no conversion required.*/
27721+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
27722+ _y4m->convert=y4m_convert_null;
27723+ }
27724+ else if(strcmp(_y4m->chroma_type,"420mpeg2")==0){
27725+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
27726+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27727+ /*Chroma filter required: read into the aux buf first.*/
27728+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=
27729+ 2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
27730+ _y4m->convert=y4m_convert_42xmpeg2_42xjpeg;
27731+ }
27732+ else if(strcmp(_y4m->chroma_type,"420paldv")==0){
27733+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
27734+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27735+ /*Chroma filter required: read into the aux buf first.
27736+ We need to make two filter passes, so we need some extra space in the
27737+ aux buffer.*/
27738+ _y4m->aux_buf_sz=3*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
27739+ _y4m->aux_buf_read_sz=2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
27740+ _y4m->convert=y4m_convert_42xpaldv_42xjpeg;
27741+ }
27742+ else if(strcmp(_y4m->chroma_type,"422jpeg")==0){
27743+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=2;
27744+ _y4m->src_c_dec_v=1;
27745+ _y4m->dst_c_dec_v=2;
27746+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27747+ /*Chroma filter required: read into the aux buf first.*/
27748+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=2*((_y4m->pic_w+1)/2)*_y4m->pic_h;
27749+ _y4m->convert=y4m_convert_422jpeg_420jpeg;
27750+ }
27751+ else if(strcmp(_y4m->chroma_type,"422")==0){
27752+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=2;
27753+ _y4m->src_c_dec_v=1;
27754+ _y4m->dst_c_dec_v=2;
27755+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27756+ /*Chroma filter required: read into the aux buf first.
27757+ We need to make two filter passes, so we need some extra space in the
27758+ aux buffer.*/
27759+ _y4m->aux_buf_read_sz=2*((_y4m->pic_w+1)/2)*_y4m->pic_h;
27760+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz+((_y4m->pic_w+1)/2)*_y4m->pic_h;
27761+ _y4m->convert=y4m_convert_422_420jpeg;
27762+ }
27763+ else if(strcmp(_y4m->chroma_type,"411")==0){
27764+ _y4m->src_c_dec_h=4;
27765+ _y4m->dst_c_dec_h=2;
27766+ _y4m->src_c_dec_v=1;
27767+ _y4m->dst_c_dec_v=2;
27768+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27769+ /*Chroma filter required: read into the aux buf first.
27770+ We need to make two filter passes, so we need some extra space in the
27771+ aux buffer.*/
27772+ _y4m->aux_buf_read_sz=2*((_y4m->pic_w+3)/4)*_y4m->pic_h;
27773+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz+((_y4m->pic_w+1)/2)*_y4m->pic_h;
27774+ _y4m->convert=y4m_convert_411_420jpeg;
27775+ }
27776+ else if(strcmp(_y4m->chroma_type,"444")==0){
27777+ _y4m->src_c_dec_h=1;
27778+ _y4m->dst_c_dec_h=2;
27779+ _y4m->src_c_dec_v=1;
27780+ _y4m->dst_c_dec_v=2;
27781+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27782+ /*Chroma filter required: read into the aux buf first.
27783+ We need to make two filter passes, so we need some extra space in the
27784+ aux buffer.*/
27785+ _y4m->aux_buf_read_sz=2*_y4m->pic_w*_y4m->pic_h;
27786+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz+((_y4m->pic_w+1)/2)*_y4m->pic_h;
27787+ _y4m->convert=y4m_convert_444_420jpeg;
27788+ }
27789+ else if(strcmp(_y4m->chroma_type,"444alpha")==0){
27790+ _y4m->src_c_dec_h=1;
27791+ _y4m->dst_c_dec_h=2;
27792+ _y4m->src_c_dec_v=1;
27793+ _y4m->dst_c_dec_v=2;
27794+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27795+ /*Chroma filter required: read into the aux buf first.
27796+ We need to make two filter passes, so we need some extra space in the
27797+ aux buffer.
27798+ The extra plane also gets read into the aux buf.
27799+ It will be discarded.*/
27800+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=3*_y4m->pic_w*_y4m->pic_h;
27801+ _y4m->convert=y4m_convert_444_420jpeg;
27802+ }
27803+ else if(strcmp(_y4m->chroma_type,"mono")==0){
27804+ _y4m->src_c_dec_h=_y4m->src_c_dec_v=0;
27805+ _y4m->dst_c_dec_h=_y4m->dst_c_dec_v=2;
27806+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
27807+ /*No extra space required, but we need to clear the chroma planes.*/
27808+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
27809+ _y4m->convert=y4m_convert_mono_420jpeg;
27810+ }
27811+ else{
27812+ fprintf(stderr,"Unknown chroma sampling type: %s\n",_y4m->chroma_type);
27813+ return -1;
27814+ }
27815+ /*The size of the final frame buffers is always computed from the
27816+ destination chroma decimation type.*/
27817+ _y4m->dst_buf_sz=_y4m->pic_w*_y4m->pic_h
27818+ +2*((_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h)*
27819+ ((_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v);
27820+ _y4m->dst_buf=(unsigned char *)malloc(_y4m->dst_buf_sz);
27821+ _y4m->aux_buf=(unsigned char *)malloc(_y4m->aux_buf_sz);
27822+ return 0;
27823+}
27824+
27825+void y4m_input_close(y4m_input *_y4m){
27826+ free(_y4m->dst_buf);
27827+ free(_y4m->aux_buf);
27828+}
27829+
27830+int y4m_input_fetch_frame(y4m_input *_y4m,FILE *_fin,vpx_image_t *_img){
27831+ char frame[6];
27832+ int pic_sz;
27833+ int frame_c_w;
27834+ int frame_c_h;
27835+ int c_w;
27836+ int c_h;
27837+ int c_sz;
27838+ int ret;
27839+ /*Read and skip the frame header.*/
27840+ ret=fread(frame,1,6,_fin);
27841+ if(ret<6)return 0;
27842+ if(memcmp(frame,"FRAME",5)){
27843+ fprintf(stderr,"Loss of framing in Y4M input data\n");
27844+ return -1;
27845+ }
27846+ if(frame[5]!='\n'){
27847+ char c;
27848+ int j;
27849+ for(j=0;j<79&&fread(&c,1,1,_fin)&&c!='\n';j++);
27850+ if(j==79){
27851+ fprintf(stderr,"Error parsing Y4M frame header\n");
27852+ return -1;
27853+ }
27854+ }
27855+ /*Read the frame data that needs no conversion.*/
27856+ if(fread(_y4m->dst_buf,1,_y4m->dst_buf_read_sz,_fin)!=_y4m->dst_buf_read_sz){
27857+ fprintf(stderr,"Error reading Y4M frame data.\n");
27858+ return -1;
27859+ }
27860+ /*Read the frame data that does need conversion.*/
27861+ if(fread(_y4m->aux_buf,1,_y4m->aux_buf_read_sz,_fin)!=_y4m->aux_buf_read_sz){
27862+ fprintf(stderr,"Error reading Y4M frame data.\n");
27863+ return -1;
27864+ }
27865+ /*Now convert the just read frame.*/
27866+ (*_y4m->convert)(_y4m,_y4m->dst_buf,_y4m->aux_buf);
27867+ /*Fill in the frame buffer pointers.
27868+ We don't use vpx_img_wrap() because it forces padding for odd picture
27869+ sizes, which would require a separate fread call for every row.*/
27870+ memset(_img,0,sizeof(*_img));
27871+ /*Y4M has the planes in Y'CbCr order, which libvpx calls Y, U, and V.*/
27872+ _img->fmt=IMG_FMT_I420;
27873+ _img->w=_img->d_w=_y4m->pic_w;
27874+ _img->h=_img->d_h=_y4m->pic_h;
27875+ /*This is hard-coded to 4:2:0 for now, as that's all VP8 supports.*/
27876+ _img->x_chroma_shift=1;
27877+ _img->y_chroma_shift=1;
27878+ _img->bps=12;
27879+ /*Set up the buffer pointers.*/
27880+ pic_sz=_y4m->pic_w*_y4m->pic_h;
27881+ c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
27882+ c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
27883+ c_sz=c_w*c_h;
27884+ _img->stride[PLANE_Y]=_y4m->pic_w;
27885+ _img->stride[PLANE_U]=_img->stride[PLANE_V]=c_w;
27886+ _img->planes[PLANE_Y]=_y4m->dst_buf;
27887+ _img->planes[PLANE_U]=_y4m->dst_buf+pic_sz;
27888+ _img->planes[PLANE_V]=_y4m->dst_buf+pic_sz+c_sz;
27889+ return 0;
27890+}
27891diff --git a/y4minput.h b/y4minput.h
27892new file mode 100644
27893index 0000000..e3f9304
27894--- /dev/null
27895+++ b/y4minput.h
27896@@ -0,0 +1,60 @@
27897+/*
27898+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
27899+ *
27900+ * Use of this source code is governed by a BSD-style license
27901+ * that can be found in the LICENSE file in the root of the source
27902+ * tree. An additional intellectual property rights grant can be found
27903+ * in the file PATENTS. All contributing project authors may
27904+ * be found in the AUTHORS file in the root of the source tree.
27905+ *
27906+ * Based on code from the OggTheora software codec source code,
27907+ * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
27908+ */
27909+#if !defined(_y4minput_H)
27910+# define _y4minput_H (1)
27911+# include <stdio.h>
27912+# include "vpx/vpx_image.h"
27913+
27914+
27915+
27916+typedef struct y4m_input y4m_input;
27917+
27918+
27919+
27920+/*The function used to perform chroma conversion.*/
27921+typedef void (*y4m_convert_func)(y4m_input *_y4m,
27922+ unsigned char *_dst,unsigned char *_src);
27923+
27924+
27925+
27926+struct y4m_input{
27927+ int pic_w;
27928+ int pic_h;
27929+ int fps_n;
27930+ int fps_d;
27931+ int par_n;
27932+ int par_d;
27933+ char interlace;
27934+ int src_c_dec_h;
27935+ int src_c_dec_v;
27936+ int dst_c_dec_h;
27937+ int dst_c_dec_v;
27938+ char chroma_type[16];
27939+ /*The size of each converted frame buffer.*/
27940+ size_t dst_buf_sz;
27941+ /*The amount to read directly into the converted frame buffer.*/
27942+ size_t dst_buf_read_sz;
27943+ /*The size of the auxilliary buffer.*/
27944+ size_t aux_buf_sz;
27945+ /*The amount to read into the auxilliary buffer.*/
27946+ size_t aux_buf_read_sz;
27947+ y4m_convert_func convert;
27948+ unsigned char *dst_buf;
27949+ unsigned char *aux_buf;
27950+};
27951+
27952+int y4m_input_open(y4m_input *_y4m,FILE *_fin,char *_skip,int _nskip);
27953+void y4m_input_close(y4m_input *_y4m);
27954+int y4m_input_fetch_frame(y4m_input *_y4m,FILE *_fin,vpx_image_t *img);
27955+
27956+#endif
diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index 471b3efb8c..955e28e42d 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -4,7 +4,7 @@ _flavor=grsec
4pkgname=linux-${_flavor} 4pkgname=linux-${_flavor}
5pkgver=2.6.32.15 5pkgver=2.6.32.15
6_kernver=2.6.32 6_kernver=2.6.32
7pkgrel=6 7pkgrel=7
8pkgdesc="Linux kernel with grsecurity" 8pkgdesc="Linux kernel with grsecurity"
9url=http://grsecurity.net 9url=http://grsecurity.net
10depends="mkinitfs linux-firmware" 10depends="mkinitfs linux-firmware"
@@ -169,4 +169,4 @@ ce4a74190febe13713bab1b886dd5bee r8169-fix-random-mdio_write-failures.patch
169b41ee19f13498fb25992fd60cd1126d4 r8169-fix-mdio_read-and-update-mdio_write-according-to-hw-specs.patch 169b41ee19f13498fb25992fd60cd1126d4 r8169-fix-mdio_read-and-update-mdio_write-according-to-hw-specs.patch
170a1bcf76870b63a4a4035a8948fb758e2 x86-setup-When-restoring-the-screen-update-boot_params-screen_info.patch 170a1bcf76870b63a4a4035a8948fb758e2 x86-setup-When-restoring-the-screen-update-boot_params-screen_info.patch
171bf14850a0036d14bc6177adbdec23a17 hv-grsec.patch 171bf14850a0036d14bc6177adbdec23a17 hv-grsec.patch
172442d7174a9755ed7bba22ebd4918bbe5 kernelconfig.x86" 172758c074dc6979167f3113cbf101922ee kernelconfig.x86"
diff --git a/main/linux-grsec/kernelconfig.x86 b/main/linux-grsec/kernelconfig.x86
index d70107d29b..5f4cb8c2b4 100644
--- a/main/linux-grsec/kernelconfig.x86
+++ b/main/linux-grsec/kernelconfig.x86
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32.14 3# Linux kernel version: 2.6.32.15
4# Wed Jun 2 07:39:39 2010 4# Wed Jun 16 07:30:34 2010
5# 5#
6# CONFIG_64BIT is not set 6# CONFIG_64BIT is not set
7CONFIG_X86_32=y 7CONFIG_X86_32=y
@@ -4237,8 +4237,24 @@ CONFIG_CIFS_EXPERIMENTAL=y
4237# 4237#
4238# Partition Types 4238# Partition Types
4239# 4239#
4240# CONFIG_PARTITION_ADVANCED is not set 4240CONFIG_PARTITION_ADVANCED=y
4241# CONFIG_ACORN_PARTITION is not set
4242# CONFIG_OSF_PARTITION is not set
4243# CONFIG_AMIGA_PARTITION is not set
4244# CONFIG_ATARI_PARTITION is not set
4245# CONFIG_MAC_PARTITION is not set
4241CONFIG_MSDOS_PARTITION=y 4246CONFIG_MSDOS_PARTITION=y
4247# CONFIG_BSD_DISKLABEL is not set
4248# CONFIG_MINIX_SUBPARTITION is not set
4249# CONFIG_SOLARIS_X86_PARTITION is not set
4250# CONFIG_UNIXWARE_DISKLABEL is not set
4251# CONFIG_LDM_PARTITION is not set
4252# CONFIG_SGI_PARTITION is not set
4253# CONFIG_ULTRIX_PARTITION is not set
4254# CONFIG_SUN_PARTITION is not set
4255# CONFIG_KARMA_PARTITION is not set
4256CONFIG_EFI_PARTITION=y
4257# CONFIG_SYSV68_PARTITION is not set
4242CONFIG_NLS=m 4258CONFIG_NLS=m
4243CONFIG_NLS_DEFAULT="iso8859-1" 4259CONFIG_NLS_DEFAULT="iso8859-1"
4244CONFIG_NLS_CODEPAGE_437=m 4260CONFIG_NLS_CODEPAGE_437=m
@@ -4626,7 +4642,7 @@ CONFIG_VIRTIO_BALLOON=m
4626# 4642#
4627# Library routines 4643# Library routines
4628# 4644#
4629CONFIG_BITREVERSE=m 4645CONFIG_BITREVERSE=y
4630CONFIG_GENERIC_FIND_FIRST_BIT=y 4646CONFIG_GENERIC_FIND_FIRST_BIT=y
4631CONFIG_GENERIC_FIND_NEXT_BIT=y 4647CONFIG_GENERIC_FIND_NEXT_BIT=y
4632CONFIG_GENERIC_FIND_LAST_BIT=y 4648CONFIG_GENERIC_FIND_LAST_BIT=y
@@ -4634,7 +4650,7 @@ CONFIG_CRC_CCITT=m
4634CONFIG_CRC16=m 4650CONFIG_CRC16=m
4635CONFIG_CRC_T10DIF=m 4651CONFIG_CRC_T10DIF=m
4636CONFIG_CRC_ITU_T=m 4652CONFIG_CRC_ITU_T=m
4637CONFIG_CRC32=m 4653CONFIG_CRC32=y
4638CONFIG_CRC7=m 4654CONFIG_CRC7=m
4639CONFIG_LIBCRC32C=m 4655CONFIG_LIBCRC32C=m
4640CONFIG_ZLIB_INFLATE=y 4656CONFIG_ZLIB_INFLATE=y
diff --git a/main/linux-vserver/APKBUILD b/main/linux-vserver/APKBUILD
index 39b1453de2..5aab872ef9 100644
--- a/main/linux-vserver/APKBUILD
+++ b/main/linux-vserver/APKBUILD
@@ -5,7 +5,7 @@ pkgname=linux-${_flavor}
5pkgver=2.6.32.15 5pkgver=2.6.32.15
6 6
7_kernver=2.6.32 7_kernver=2.6.32
8pkgrel=0 8pkgrel=1
9pkgdesc="Linux kernel with vserver" 9pkgdesc="Linux kernel with vserver"
10url="http://linux-vserver.org/" 10url="http://linux-vserver.org/"
11depends="mkinitfs linux-firmware" 11depends="mkinitfs linux-firmware"
@@ -120,4 +120,4 @@ dev() {
120md5sums="260551284ac224c3a43c4adac7df4879 linux-2.6.32.tar.bz2 120md5sums="260551284ac224c3a43c4adac7df4879 linux-2.6.32.tar.bz2
1215c9251844c2819eddee4dba1293bd46d patch-2.6.32.15.bz2 1215c9251844c2819eddee4dba1293bd46d patch-2.6.32.15.bz2
1228680ecd1342691a5974fb08d7d60beb2 patch-2.6.32.15-vs2.3.0.36.29.4.diff 1228680ecd1342691a5974fb08d7d60beb2 patch-2.6.32.15-vs2.3.0.36.29.4.diff
12342ce36a36e7c71ee54761e56d59d17ed kernelconfig.x86" 123884ba32b4edb6c51426e826c44063e98 kernelconfig.x86"
diff --git a/main/linux-vserver/kernelconfig.x86 b/main/linux-vserver/kernelconfig.x86
index 6fe9ef4d46..477d6620dd 100644
--- a/main/linux-vserver/kernelconfig.x86
+++ b/main/linux-vserver/kernelconfig.x86
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32.8-vs2.3.0.36.29 3# Linux kernel version: 2.6.32.15-vs2.3.0.36.29.4
4# Mon Feb 15 09:49:17 2010 4# Wed Jun 16 07:47:05 2010
5# 5#
6# CONFIG_64BIT is not set 6# CONFIG_64BIT is not set
7CONFIG_X86_32=y 7CONFIG_X86_32=y
@@ -149,7 +149,6 @@ CONFIG_HAVE_PERF_EVENTS=y
149# Kernel Performance Events And Counters 149# Kernel Performance Events And Counters
150# 150#
151CONFIG_PERF_EVENTS=y 151CONFIG_PERF_EVENTS=y
152# CONFIG_EVENT_PROFILE is not set
153CONFIG_PERF_COUNTERS=y 152CONFIG_PERF_COUNTERS=y
154CONFIG_VM_EVENT_COUNTERS=y 153CONFIG_VM_EVENT_COUNTERS=y
155CONFIG_PCI_QUIRKS=y 154CONFIG_PCI_QUIRKS=y
@@ -159,7 +158,6 @@ CONFIG_PCI_QUIRKS=y
159CONFIG_SLUB=y 158CONFIG_SLUB=y
160# CONFIG_SLOB is not set 159# CONFIG_SLOB is not set
161CONFIG_PROFILING=y 160CONFIG_PROFILING=y
162CONFIG_TRACEPOINTS=y
163CONFIG_OPROFILE=m 161CONFIG_OPROFILE=m
164# CONFIG_OPROFILE_IBS is not set 162# CONFIG_OPROFILE_IBS is not set
165# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set 163# CONFIG_OPROFILE_EVENT_MULTIPLEX is not set
@@ -322,6 +320,7 @@ CONFIG_HIGHMEM=y
322CONFIG_ARCH_FLATMEM_ENABLE=y 320CONFIG_ARCH_FLATMEM_ENABLE=y
323CONFIG_ARCH_SPARSEMEM_ENABLE=y 321CONFIG_ARCH_SPARSEMEM_ENABLE=y
324CONFIG_ARCH_SELECT_MEMORY_MODEL=y 322CONFIG_ARCH_SELECT_MEMORY_MODEL=y
323CONFIG_ILLEGAL_POINTER_VALUE=0
325CONFIG_SELECT_MEMORY_MODEL=y 324CONFIG_SELECT_MEMORY_MODEL=y
326CONFIG_FLATMEM_MANUAL=y 325CONFIG_FLATMEM_MANUAL=y
327# CONFIG_DISCONTIGMEM_MANUAL is not set 326# CONFIG_DISCONTIGMEM_MANUAL is not set
@@ -951,7 +950,6 @@ CONFIG_NET_SCH_FIFO=y
951# Network testing 950# Network testing
952# 951#
953CONFIG_NET_PKTGEN=m 952CONFIG_NET_PKTGEN=m
954# CONFIG_NET_DROP_MONITOR is not set
955# CONFIG_HAMRADIO is not set 953# CONFIG_HAMRADIO is not set
956CONFIG_CAN=m 954CONFIG_CAN=m
957CONFIG_CAN_RAW=m 955CONFIG_CAN_RAW=m
@@ -3132,7 +3130,7 @@ CONFIG_DVB_TUNER_DIB0070=m
3132CONFIG_DVB_LNBP21=m 3130CONFIG_DVB_LNBP21=m
3133CONFIG_DVB_ISL6405=m 3131CONFIG_DVB_ISL6405=m
3134CONFIG_DVB_ISL6421=m 3132CONFIG_DVB_ISL6421=m
3135CONFIG_DVB_LGS8GL5=m 3133CONFIG_DVB_LGS8GXX=m
3136CONFIG_DAB=y 3134CONFIG_DAB=y
3137CONFIG_USB_DABUSB=m 3135CONFIG_USB_DABUSB=m
3138 3136
@@ -4204,8 +4202,24 @@ CONFIG_CIFS_EXPERIMENTAL=y
4204# 4202#
4205# Partition Types 4203# Partition Types
4206# 4204#
4207# CONFIG_PARTITION_ADVANCED is not set 4205CONFIG_PARTITION_ADVANCED=y
4206# CONFIG_ACORN_PARTITION is not set
4207# CONFIG_OSF_PARTITION is not set
4208# CONFIG_AMIGA_PARTITION is not set
4209# CONFIG_ATARI_PARTITION is not set
4210# CONFIG_MAC_PARTITION is not set
4208CONFIG_MSDOS_PARTITION=y 4211CONFIG_MSDOS_PARTITION=y
4212# CONFIG_BSD_DISKLABEL is not set
4213# CONFIG_MINIX_SUBPARTITION is not set
4214# CONFIG_SOLARIS_X86_PARTITION is not set
4215# CONFIG_UNIXWARE_DISKLABEL is not set
4216# CONFIG_LDM_PARTITION is not set
4217# CONFIG_SGI_PARTITION is not set
4218# CONFIG_ULTRIX_PARTITION is not set
4219# CONFIG_SUN_PARTITION is not set
4220# CONFIG_KARMA_PARTITION is not set
4221CONFIG_EFI_PARTITION=y
4222# CONFIG_SYSV68_PARTITION is not set
4209CONFIG_NLS=m 4223CONFIG_NLS=m
4210CONFIG_NLS_DEFAULT="iso8859-1" 4224CONFIG_NLS_DEFAULT="iso8859-1"
4211CONFIG_NLS_CODEPAGE_437=m 4225CONFIG_NLS_CODEPAGE_437=m
@@ -4263,7 +4277,6 @@ CONFIG_FRAME_WARN=1024
4263CONFIG_DEBUG_FS=y 4277CONFIG_DEBUG_FS=y
4264# CONFIG_HEADERS_CHECK is not set 4278# CONFIG_HEADERS_CHECK is not set
4265# CONFIG_DEBUG_KERNEL is not set 4279# CONFIG_DEBUG_KERNEL is not set
4266CONFIG_STACKTRACE=y
4267# CONFIG_DEBUG_BUGVERBOSE is not set 4280# CONFIG_DEBUG_BUGVERBOSE is not set
4268# CONFIG_DEBUG_MEMORY_INIT is not set 4281# CONFIG_DEBUG_MEMORY_INIT is not set
4269CONFIG_ARCH_WANT_FRAME_POINTERS=y 4282CONFIG_ARCH_WANT_FRAME_POINTERS=y
@@ -4272,7 +4285,6 @@ CONFIG_FRAME_POINTER=y
4272# CONFIG_LATENCYTOP is not set 4285# CONFIG_LATENCYTOP is not set
4273CONFIG_SYSCTL_SYSCALL_CHECK=y 4286CONFIG_SYSCTL_SYSCALL_CHECK=y
4274CONFIG_USER_STACKTRACE_SUPPORT=y 4287CONFIG_USER_STACKTRACE_SUPPORT=y
4275CONFIG_NOP_TRACER=y
4276CONFIG_HAVE_FUNCTION_TRACER=y 4288CONFIG_HAVE_FUNCTION_TRACER=y
4277CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 4289CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
4278CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y 4290CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y
@@ -4281,10 +4293,7 @@ CONFIG_HAVE_DYNAMIC_FTRACE=y
4281CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 4293CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
4282CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 4294CONFIG_HAVE_SYSCALL_TRACEPOINTS=y
4283CONFIG_RING_BUFFER=y 4295CONFIG_RING_BUFFER=y
4284CONFIG_EVENT_TRACING=y
4285CONFIG_CONTEXT_SWITCH_TRACER=y
4286CONFIG_RING_BUFFER_ALLOW_SWAP=y 4296CONFIG_RING_BUFFER_ALLOW_SWAP=y
4287CONFIG_TRACING=y
4288CONFIG_TRACING_SUPPORT=y 4297CONFIG_TRACING_SUPPORT=y
4289# CONFIG_FTRACE is not set 4298# CONFIG_FTRACE is not set
4290# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set 4299# CONFIG_PROVIDE_OHCI1394_DMA_INIT is not set
@@ -4481,12 +4490,12 @@ CONFIG_VIRTIO=y
4481CONFIG_VIRTIO_RING=y 4490CONFIG_VIRTIO_RING=y
4482CONFIG_VIRTIO_PCI=m 4491CONFIG_VIRTIO_PCI=m
4483CONFIG_VIRTIO_BALLOON=m 4492CONFIG_VIRTIO_BALLOON=m
4484CONFIG_BINARY_PRINTF=y 4493# CONFIG_BINARY_PRINTF is not set
4485 4494
4486# 4495#
4487# Library routines 4496# Library routines
4488# 4497#
4489CONFIG_BITREVERSE=m 4498CONFIG_BITREVERSE=y
4490CONFIG_GENERIC_FIND_FIRST_BIT=y 4499CONFIG_GENERIC_FIND_FIRST_BIT=y
4491CONFIG_GENERIC_FIND_NEXT_BIT=y 4500CONFIG_GENERIC_FIND_NEXT_BIT=y
4492CONFIG_GENERIC_FIND_LAST_BIT=y 4501CONFIG_GENERIC_FIND_LAST_BIT=y
@@ -4494,7 +4503,7 @@ CONFIG_CRC_CCITT=m
4494CONFIG_CRC16=m 4503CONFIG_CRC16=m
4495CONFIG_CRC_T10DIF=m 4504CONFIG_CRC_T10DIF=m
4496CONFIG_CRC_ITU_T=m 4505CONFIG_CRC_ITU_T=m
4497CONFIG_CRC32=m 4506CONFIG_CRC32=y
4498CONFIG_CRC7=m 4507CONFIG_CRC7=m
4499CONFIG_LIBCRC32C=m 4508CONFIG_LIBCRC32C=m
4500CONFIG_ZLIB_INFLATE=y 4509CONFIG_ZLIB_INFLATE=y
diff --git a/main/lua/APKBUILD b/main/lua/APKBUILD
index 040ecc75d4..c5b63eb932 100644
--- a/main/lua/APKBUILD
+++ b/main/lua/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=lua 2pkgname=lua
3pkgver=5.1.4 3pkgver=5.1.4
4pkgrel=4 4pkgrel=5
5pkgdesc="A powerful light-weight programming language designed for extending applications." 5pkgdesc="A powerful light-weight programming language designed for extending applications."
6url="http://www.lua.org/" 6url="http://www.lua.org/"
7license="MIT" 7license="MIT"
@@ -34,7 +34,9 @@ build ()
34 LIB_LIBS="-lpthread -lm -ldl" \ 34 LIB_LIBS="-lpthread -lm -ldl" \
35 V=$pkgver \ 35 V=$pkgver \
36 gentoo_all || return 1 36 gentoo_all || return 1
37}
37 38
39package() {
38 cd "$srcdir/$pkgname-$pkgver" 40 cd "$srcdir/$pkgname-$pkgver"
39 make INSTALL_TOP="$pkgdir"/usr INSTALL_LIB="$pkgdir"/usr/lib \ 41 make INSTALL_TOP="$pkgdir"/usr INSTALL_LIB="$pkgdir"/usr/lib \
40 V=$pkgver gentoo_install || return 1 42 V=$pkgver gentoo_install || return 1
diff --git a/main/mkinitfs/APKBUILD b/main/mkinitfs/APKBUILD
index 797b803e9a..17fe29ee2a 100644
--- a/main/mkinitfs/APKBUILD
+++ b/main/mkinitfs/APKBUILD
@@ -1,6 +1,6 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=mkinitfs 2pkgname=mkinitfs
3pkgver=2.0_rc7 3pkgver=2.0_rc8
4pkgrel=0 4pkgrel=0
5pkgdesc="Tool to generate initramfs images for Alpine" 5pkgdesc="Tool to generate initramfs images for Alpine"
6url=http://git.alpinelinux.org/cgit/mkinitfs 6url=http://git.alpinelinux.org/cgit/mkinitfs
@@ -13,6 +13,10 @@ license="GPL-2"
13build() { 13build() {
14 cd "$srcdir"/$pkgname-$pkgver 14 cd "$srcdir"/$pkgname-$pkgver
15 make || return 1 15 make || return 1
16}
17
18package() {
19 cd "$srcdir"/$pkgname-$pkgver
16 make install DESTDIR="$pkgdir" || return 1 20 make install DESTDIR="$pkgdir" || return 1
17} 21}
18md5sums="1e4ec2bb620f080699fddb40e273e33c mkinitfs-2.0_rc7.tar.bz2" 22md5sums="ca9280a78f1e712283df2c2f4a0ca41b mkinitfs-2.0_rc8.tar.bz2"
diff --git a/main/ncurses/APKBUILD b/main/ncurses/APKBUILD
index ef763f442b..57176894ad 100644
--- a/main/ncurses/APKBUILD
+++ b/main/ncurses/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=ncurses 2pkgname=ncurses
3pkgver=5.7 3pkgver=5.7
4pkgrel=2 4pkgrel=3
5pkgdesc="Console display library" 5pkgdesc="Console display library"
6url="http://www.gnu.org/software/ncurses/" 6url="http://www.gnu.org/software/ncurses/"
7license=MIT 7license=MIT
@@ -20,6 +20,10 @@ build() {
20 --with-shared 20 --with-shared
21 21
22 make || return 1 22 make || return 1
23}
24
25package() {
26 cd "$srcdir/$pkgname-$pkgver"
23 make install DESTDIR="$pkgdir" 27 make install DESTDIR="$pkgdir"
24 28
25 # Install basic terms in /etc/terminfo 29 # Install basic terms in /etc/terminfo
diff --git a/testing/open-iscsi-grsec/APKBUILD b/main/open-iscsi-grsec/APKBUILD
index 1bda4a7f2e..1bda4a7f2e 100644
--- a/testing/open-iscsi-grsec/APKBUILD
+++ b/main/open-iscsi-grsec/APKBUILD
diff --git a/testing/open-iscsi-grsec/CVE-2009-1297.patch b/main/open-iscsi-grsec/CVE-2009-1297.patch
index d1728fff7e..d1728fff7e 100644
--- a/testing/open-iscsi-grsec/CVE-2009-1297.patch
+++ b/main/open-iscsi-grsec/CVE-2009-1297.patch
diff --git a/testing/open-iscsi-grsec/Makefile.kernel.patch b/main/open-iscsi-grsec/Makefile.kernel.patch
index 552e31b47f..552e31b47f 100644
--- a/testing/open-iscsi-grsec/Makefile.kernel.patch
+++ b/main/open-iscsi-grsec/Makefile.kernel.patch
diff --git a/testing/open-iscsi-grsec/open-iscsi-2.0.871-makefile-cleanup.patch b/main/open-iscsi-grsec/open-iscsi-2.0.871-makefile-cleanup.patch
index 6ca2a4eaba..6ca2a4eaba 100644
--- a/testing/open-iscsi-grsec/open-iscsi-2.0.871-makefile-cleanup.patch
+++ b/main/open-iscsi-grsec/open-iscsi-2.0.871-makefile-cleanup.patch
diff --git a/testing/open-iscsi/APKBUILD b/main/open-iscsi/APKBUILD
index 0f4076e21d..37d5f37409 100644
--- a/testing/open-iscsi/APKBUILD
+++ b/main/open-iscsi/APKBUILD
@@ -2,7 +2,7 @@
2pkgname=open-iscsi 2pkgname=open-iscsi
3pkgver=2.0.871 3pkgver=2.0.871
4_realver=2.0-871 4_realver=2.0-871
5pkgrel=2 5pkgrel=3
6pkgdesc="High performance, transport independent, multi-platform iSCSI initiator" 6pkgdesc="High performance, transport independent, multi-platform iSCSI initiator"
7url="http://www.open-iscsi.org" 7url="http://www.open-iscsi.org"
8license="GPL-2" 8license="GPL-2"
@@ -13,7 +13,8 @@ subpackages="$pkgname-doc"
13source="http://www.open-iscsi.org/bits/$pkgname-$_realver.tar.gz 13source="http://www.open-iscsi.org/bits/$pkgname-$_realver.tar.gz
14 CVE-2009-1297.patch 14 CVE-2009-1297.patch
15 open-iscsi-2.0.871-makefile-cleanup.patch 15 open-iscsi-2.0.871-makefile-cleanup.patch
16 iscsid.initd" 16 iscsid.initd
17 iscsid.confd"
17 18
18_builddir="$srcdir"/$pkgname-$_realver 19_builddir="$srcdir"/$pkgname-$_realver
19 20
@@ -38,9 +39,11 @@ package() {
38 mv $pkgdir/sbin/iscsiadm $pkgdir/usr/bin 39 mv $pkgdir/sbin/iscsiadm $pkgdir/usr/bin
39 mv $pkgdir/sbin/iscsid $pkgdir/usr/sbin 40 mv $pkgdir/sbin/iscsid $pkgdir/usr/sbin
40 install -Dm755 ../../iscsid.initd "$pkgdir"/etc/init.d/iscsid 41 install -Dm755 ../../iscsid.initd "$pkgdir"/etc/init.d/iscsid
42 install -Dm644 ../../iscsid.confd "$pkgdir"/etc/conf.d/iscsid
41} 43}
42 44
43md5sums="0c403e8c9ad41607571ba0e6e8ff196e open-iscsi-2.0-871.tar.gz 45md5sums="0c403e8c9ad41607571ba0e6e8ff196e open-iscsi-2.0-871.tar.gz
44d1584790b4e12f087e60089880b53d2b CVE-2009-1297.patch 46d1584790b4e12f087e60089880b53d2b CVE-2009-1297.patch
45734300d7b7590dc9ae9b2fb7f5b51bf0 open-iscsi-2.0.871-makefile-cleanup.patch 47734300d7b7590dc9ae9b2fb7f5b51bf0 open-iscsi-2.0.871-makefile-cleanup.patch
463e89cb86395756dafebc4f1490f0de10 iscsid.initd" 483e89cb86395756dafebc4f1490f0de10 iscsid.initd
49b762b687d4628791b4362df22cf22d34 iscsid.confd"
diff --git a/testing/open-iscsi/CVE-2009-1297.patch b/main/open-iscsi/CVE-2009-1297.patch
index d1728fff7e..d1728fff7e 100644
--- a/testing/open-iscsi/CVE-2009-1297.patch
+++ b/main/open-iscsi/CVE-2009-1297.patch
diff --git a/main/open-iscsi/iscsid.confd b/main/open-iscsi/iscsid.confd
new file mode 100644
index 0000000000..1c4cc40542
--- /dev/null
+++ b/main/open-iscsi/iscsid.confd
@@ -0,0 +1,13 @@
1# /etc/conf.d/iscsid
2
3# config file to use
4CONFIG_FILE=/etc/iscsi/iscsid.conf
5
6# you need to specify an initiatorname in the file
7INITIATORNAME_FILE=/etc/iscsi/initiatorname.iscsi
8
9# options to pass to iscsid
10OPTS="-i ${INITIATORNAME_FILE}"
11
12# Start automatic targets when iscsid is started
13AUTOSTARTTARGETS="yes"
diff --git a/testing/open-iscsi/iscsid.initd b/main/open-iscsi/iscsid.initd
index 572b0a6ae5..572b0a6ae5 100644
--- a/testing/open-iscsi/iscsid.initd
+++ b/main/open-iscsi/iscsid.initd
diff --git a/testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch b/main/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch
index 6ca2a4eaba..6ca2a4eaba 100644
--- a/testing/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch
+++ b/main/open-iscsi/open-iscsi-2.0.871-makefile-cleanup.patch
diff --git a/main/readline/APKBUILD b/main/readline/APKBUILD
index 7ebf94deb4..3fe0a4ca63 100644
--- a/main/readline/APKBUILD
+++ b/main/readline/APKBUILD
@@ -4,7 +4,7 @@ pkgver=6.1.002
4_myver=${pkgver%.*} 4_myver=${pkgver%.*}
5_patchver=${pkgver##*.} 5_patchver=${pkgver##*.}
6_suff=${_myver%.*}${_myver#*.} 6_suff=${_myver%.*}${_myver#*.}
7pkgrel=1 7pkgrel=2
8pkgdesc="GNU readline library" 8pkgdesc="GNU readline library"
9url="ftp://ftp.cwru.edu/pub/bash/" 9url="ftp://ftp.cwru.edu/pub/bash/"
10license="GPL" 10license="GPL"
diff --git a/main/wpa_supplicant/APKBUILD b/main/wpa_supplicant/APKBUILD
index 3474daa147..62695bf711 100644
--- a/main/wpa_supplicant/APKBUILD
+++ b/main/wpa_supplicant/APKBUILD
@@ -1,7 +1,7 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=wpa_supplicant 2pkgname=wpa_supplicant
3pkgver=0.7.1 3pkgver=0.7.2
4pkgrel=2 4pkgrel=1
5pkgdesc="A utility providing key negotiation for WPA wireless networks" 5pkgdesc="A utility providing key negotiation for WPA wireless networks"
6url="http://hostap.epitest.fi/wpa_supplicant" 6url="http://hostap.epitest.fi/wpa_supplicant"
7license="GPL" 7license="GPL"
@@ -9,6 +9,8 @@ subpackages="$pkgname-doc"
9depends= 9depends=
10makedepends="openssl-dev dbus-dev libnl-dev" 10makedepends="openssl-dev dbus-dev libnl-dev"
11source="http://hostap.epitest.fi/releases/$pkgname-$pkgver.tar.gz 11source="http://hostap.epitest.fi/releases/$pkgname-$pkgver.tar.gz
12 wpa_supplicant.initd
13 wpa_supplicant.confd
12 " 14 "
13 15
14_builddir="$srcdir"/$pkgname-$pkgver/$pkgname 16_builddir="$srcdir"/$pkgname-$pkgver/$pkgname
@@ -89,15 +91,17 @@ prepare() {
89build() { 91build() {
90 cd "$_builddir" 92 cd "$_builddir"
91 make LIBDIR=/lib BINDIR=/sbin || return 1 93 make LIBDIR=/lib BINDIR=/sbin || return 1
94 # comment out the network={ } stansas in config
95 sed -i -e '/^network=/,/}/s/^/#/' wpa_supplicant.conf
92} 96}
93 97
94package() { 98package() {
95 cd "$_builddir" 99 cd "$_builddir"
96 make DESTDIR="$pkgdir" LIBDIR=/lib BINDIR=/sbin install || return 1 100 make DESTDIR="$pkgdir" LIBDIR=/lib BINDIR=/sbin install || return 1
97 install -Dm644 wpa_supplicant.conf "$pkgdir"/etc/wpa_supplicant.conf 101 install -Dm644 wpa_supplicant.conf \
102 "$pkgdir"/etc/wpa_supplicant/wpa_supplicant.conf
98 install -Dm644 doc/docbook/wpa_supplicant.conf.5 \ 103 install -Dm644 doc/docbook/wpa_supplicant.conf.5 \
99 "$pkgdir"/usr/share/man/man5/wpa_supplicant.conf.5 || return 1 104 "$pkgdir"/usr/share/man/man5/wpa_supplicant.conf.5 || return 1
100
101 for i in wpa_background wpa_cli wpa_passphrase wpa_supplicant; do 105 for i in wpa_background wpa_cli wpa_passphrase wpa_supplicant; do
102 install -Dm644 doc/docbook/$i.8 \ 106 install -Dm644 doc/docbook/$i.8 \
103 "$pkgdir"/usr/share/man/man8/$i.8 || return 1 107 "$pkgdir"/usr/share/man/man8/$i.8 || return 1
@@ -112,5 +116,11 @@ package() {
112 install fi.epitest.hostap.WPASupplicant.service \ 116 install fi.epitest.hostap.WPASupplicant.service \
113 "$pkgdir"/usr/share/dbus-1/system-services || return 1 117 "$pkgdir"/usr/share/dbus-1/system-services || return 1
114 install -d "$pkgdir"/var/run/wpa_supplicant 118 install -d "$pkgdir"/var/run/wpa_supplicant
119 install -Dm755 "$srcdir"/wpa_supplicant.initd \
120 "$pkgdir"/etc/init.d/wpa_supplicant || return 1
121 install -Dm755 "$srcdir"/wpa_supplicant.confd \
122 "$pkgdir"/etc/conf.d/wpa_supplicant || return 1
115} 123}
116md5sums="02c475f949e5c131856915bbb87fa55d wpa_supplicant-0.7.1.tar.gz" 124md5sums="0e2cb7e4c35667351d8b7ec28c783e6a wpa_supplicant-0.7.2.tar.gz
12555f853354f51ba947e4dd6ee2bb0d64a wpa_supplicant.initd
126bc117427f2c538439f3f1481a028ee06 wpa_supplicant.confd"
diff --git a/main/wpa_supplicant/wpa_supplicant.confd b/main/wpa_supplicant/wpa_supplicant.confd
new file mode 100644
index 0000000000..104b9dc5d8
--- /dev/null
+++ b/main/wpa_supplicant/wpa_supplicant.confd
@@ -0,0 +1,6 @@
1# conf.d file for wpa_supplicant
2#
3# Please check man 8 wpa_supplicant for more information about the options
4# wpa_supplicant accepts.
5#
6wpa_supplicant_args=""
diff --git a/main/wpa_supplicant/wpa_supplicant.initd b/main/wpa_supplicant/wpa_supplicant.initd
new file mode 100644
index 0000000000..7a9949b8be
--- /dev/null
+++ b/main/wpa_supplicant/wpa_supplicant.initd
@@ -0,0 +1,70 @@
1#!/sbin/runscript
2# Copyright (c) 2009 Roy Marples <roy@marples.name>
3# All rights reserved. Released under the 2-clause BSD license.
4
5command=/sbin/wpa_supplicant
6: ${wpa_supplicant_conf:=/etc/wpa_supplicant/wpa_supplicant.conf}
7wpa_supplicant_if=${wpa_supplicant_if:+-i}$wpa_supplicant_if
8command_args="$wpa_supplicant_args -B -c$wpa_supplicant_conf $wpa_supplicant_if"
9name="WPA Supplicant Daemon"
10
11depend()
12{
13 need localmount
14 use logger
15 after bootmisc modules
16 before dns dhcpcd net
17 keyword -shutdown
18}
19
20find_wireless()
21{
22 local iface=
23
24 case "$RC_UNAME" in
25 Linux)
26 for iface in /sys/class/net/*; do
27 if [ -e "$iface"/wireless -o \
28 -e "$iface"/phy80211 ]
29 then
30 echo "${iface##*/}"
31 return 0
32 fi
33 done
34 ;;
35 *)
36 for iface in /dev/net/* $(ifconfig -l 2>/dev/null); do
37 if ifconfig "${iface##*/}" 2>/dev/null | \
38 grep -q "[ ]*ssid "
39 then
40 echo "${iface##*/}"
41 return 0
42 fi
43 done
44 ;;
45 esac
46
47 return 1
48}
49
50append_wireless()
51{
52 local iface= i=
53
54 iface=$(find_wireless)
55 if [ -n "$iface" ]; then
56 for i in $iface; do
57 command_args="$command_args -i$i"
58 done
59 else
60 eerror "Could not find a wireless interface"
61 fi
62}
63
64start_pre()
65{
66 case " $command_args" in
67 *" -i"*) ;;
68 *) append_wireless;;
69 esac
70}
diff --git a/main/wv/APKBUILD b/main/wv/APKBUILD
index ddaeaf07c1..1cbcf34531 100644
--- a/main/wv/APKBUILD
+++ b/main/wv/APKBUILD
@@ -1,14 +1,21 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=wv 2pkgname=wv
3pkgver=1.2.4 3pkgver=1.2.7
4pkgrel=2 4pkgrel=0
5pkgdesc="MSWord library can load and parse Word 2000, 97, 95 and 6 file formats" 5pkgdesc="MSWord library can load and parse Word 2000, 97, 95 and 6 file formats"
6url="http://sourceforge.net/projects/wvware" 6url="http://sourceforge.net/projects/wvware"
7license="GPL" 7license="GPL"
8subpackages="$pkgname-dev $pkgname-doc" 8subpackages="$pkgname-dev $pkgname-doc"
9depends= 9depends=
10makedepends="pkgconfig libgsf-dev libpng-dev bzip2-dev" 10makedepends="pkgconfig libgsf-dev libpng-dev bzip2-dev coreutils"
11source="http://downloads.sourceforge.net/sourceforge/wvware/$pkgname-$pkgver.tar.gz" 11source="http://www.abisource.com/downloads/wv/$pkgver/wv-$pkgver.tar.gz
12 fix-soname.patch
13 "
14
15prepare() {
16 cd "$srcdir"/$pkgname-$pkgver
17 patch -p1 -i "$srcdir"/fix-soname.patch
18}
12 19
13build () { 20build () {
14 cd "$srcdir"/$pkgname-$pkgver 21 cd "$srcdir"/$pkgname-$pkgver
@@ -21,4 +28,5 @@ package() {
21 cd "$srcdir"/$pkgname-$pkgver 28 cd "$srcdir"/$pkgname-$pkgver
22 make DESTDIR="$pkgdir" install || return 1 29 make DESTDIR="$pkgdir" install || return 1
23} 30}
24md5sums="c1861c560491f121e12917fa76970ac5 wv-1.2.4.tar.gz" 31md5sums="a6a3484745aa73897ff9c5a871482b4b wv-1.2.7.tar.gz
3210a6988f743346c2429e189cef4363bd fix-soname.patch"
diff --git a/main/wv/fix-soname.patch b/main/wv/fix-soname.patch
new file mode 100644
index 0000000000..81dff86e62
--- /dev/null
+++ b/main/wv/fix-soname.patch
@@ -0,0 +1,14 @@
1diff -ru wv-1.2.7.orig//configure wv-1.2.7//configure
2--- wv-1.2.7.orig//configure 2009-09-21 12:22:46.000000000 +0200
3+++ wv-1.2.7//configure 2010-06-08 12:00:27.948857203 +0200
4@@ -2082,8 +2082,8 @@
5 WV_MAJOR_VERSION=1
6 WV_MINOR_VERSION=2
7 WV_MICRO_VERSION=7
8-WV_INTERFACE_AGE=3
9-WV_BINARY_AGE=3
10+WV_INTERFACE_AGE=4
11+WV_BINARY_AGE=4
12 WV_VERSION=$WV_MAJOR_VERSION.$WV_MINOR_VERSION.$WV_MICRO_VERSION
13
14
diff --git a/testing/awstats/APKBUILD b/testing/awstats/APKBUILD
new file mode 100644
index 0000000000..4dddfdd1fe
--- /dev/null
+++ b/testing/awstats/APKBUILD
@@ -0,0 +1,58 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=awstats
3pkgver=6.95
4pkgrel=0
5pkgdesc="AWStats is short for Advanced Web Statistics."
6url="http://awstats.sourceforge.net/"
7license="GPL-2"
8depends="perl perl-uri"
9subpackages="$pkgname-doc"
10source="http://awstats.sourceforge.net/files/$pkgname-$pkgver.tar.gz"
11
12_builddir="$srcdir"/$pkgname-$pkgver
13prepare() {
14 local file
15 cd "$_builddir"
16 for file in tools/* wwwroot/cgi-bin/*; do
17 [ -f "${file}" ] || continue
18 sed -e "s:/usr/local/awstats/wwwroot:/usr/lib/awstats:g" \
19 -i "$file"
20 done
21}
22
23build() {
24 return 0
25}
26
27package() {
28 cd "$_builddir"
29# logpath="awstats_log"
30# sed -e "s|^\(LogFile=\).*$|\1\"/var/log/${logpath}\"|" \
31# -e "s|^\(SiteDomain=\).*$|\1\"localhost\"|"
32# -e "s|^\(DirIcons=\).*$|\1\"/awstats/icon\"|"
33# -e "s|^\(DirCgi=\).*$|\1\"/cgi-bin\"|"
34# -i "${S}"/wwwroot/cgi-bin/awstats.model.conf || die "sed failed"
35# if use ipv6; then
36# sed -e "s|^#\(LoadPlugin=\"ipv6\"\)$|\1|" -i "${S}"/wwwroot/cgi-bin/awstats.model.conf || die "sed failed"
37# fi
38
39 install -d "$pkgdir"/usr/share/doc/awstats \
40 "$pkgdir"/var/lib/awstats \
41 "$pkgdir"/usr/lib/awstats \
42 "$pkgdir"/usr/bin \
43 "$pkgdir"/etc/awstats
44 # docs
45 cp -a docs tools/xslt "$pkgdir"/usr/share/doc/awstats || return 1
46
47 # cgi-bin
48 cp -a wwwroot/* "$pkgdir"/usr/lib/awstats
49 mv "$pkgdir"/usr/lib/awstats/cgi-bin/awstats.model.conf \
50 "$pkgdir"/etc/awstats/
51 ln -s /etc/aswtats/awstats \
52 "$pkgdir"/usr/lib/awstats/cgi-bin/awstats.model.conf
53
54 # tools
55 cp tools/*.pl "$pkgdir"/usr/bin/ || return 1
56 ln -s /usr/lib/awstats/cgi-bin/awstats.pl "$pkgdir"/usr/bin/
57}
58md5sums="26a5b19fa9f395e9e7dafed37b795d7f awstats-6.95.tar.gz"
diff --git a/testing/btrfs-progs/APKBUILD b/testing/btrfs-progs/APKBUILD
new file mode 100644
index 0000000000..62b90460c1
--- /dev/null
+++ b/testing/btrfs-progs/APKBUILD
@@ -0,0 +1,33 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=btrfs-progs
3pkgver=0.19
4pkgrel=0
5pkgdesc="Tools for the btrfs"
6url="https://btrfs.wiki.kernel.org/"
7license="GPL"
8depends=
9makedepends="util-linux-ng-dev bash"
10install=
11subpackages="$pkgname-doc"
12source="http://www.kernel.org/pub/linux/kernel/people/mason/btrfs/btrfs-progs-$pkgver.tar.bz2"
13
14_builddir="$srcdir"/$pkgname-$pkgver
15prepare() {
16 cd "$_builddir"
17}
18
19build() {
20 cd "$_builddir"
21 make prefix=/usr || return 1
22}
23
24package() {
25 cd "$_builddir"
26 make prefix=/usr mandir=/usr/share/man DESTDIR="$pkgdir" install
27
28 # remove the 2 lines below (and this) if there is no init.d script
29 # install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
30 # install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
31}
32
33md5sums="5854728d080cc76f21a83bdc99b6ddaa btrfs-progs-0.19.tar.bz2"
diff --git a/testing/cairomm/APKBUILD b/testing/cairomm/APKBUILD
index ad8c64c4a6..9942749e0a 100644
--- a/testing/cairomm/APKBUILD
+++ b/testing/cairomm/APKBUILD
@@ -6,7 +6,7 @@ pkgdesc="C++ bindings to Cairo vector graphics library"
6url="http://www.cairographics.org" 6url="http://www.cairographics.org"
7license="LGPL MPL" 7license="LGPL MPL"
8depends="" 8depends=""
9makedepends="cairo-dev libsigc++-dev" 9makedepends="cairo-dev libsigc++-dev perl"
10depends_dev="$makedepends" 10depends_dev="$makedepends"
11subpackages="$pkgname-dev $pkgname-doc" 11subpackages="$pkgname-dev $pkgname-doc"
12source="http://www.cairographics.org/releases/cairomm-$pkgver.tar.gz" 12source="http://www.cairographics.org/releases/cairomm-$pkgver.tar.gz"
diff --git a/testing/cherokee/APKBUILD b/testing/cherokee/APKBUILD
index 7705d87ce4..f93cfcf588 100644
--- a/testing/cherokee/APKBUILD
+++ b/testing/cherokee/APKBUILD
@@ -2,7 +2,7 @@
2# Maintainer: Mika Havela <mika.havela@gmail.com> 2# Maintainer: Mika Havela <mika.havela@gmail.com>
3pkgname=cherokee 3pkgname=cherokee
4pkgver=0.99.41 4pkgver=0.99.41
5pkgrel=2 5pkgrel=3
6pkgdesc="A very fast, flexible and easy to configure Web Server" 6pkgdesc="A very fast, flexible and easy to configure Web Server"
7url="http://www.cherokee-project.com/" 7url="http://www.cherokee-project.com/"
8license="GPL2" 8license="GPL2"
diff --git a/testing/coova-chilli/APKBUILD b/testing/coova-chilli/APKBUILD
index ab84e37318..047c6fbf10 100644
--- a/testing/coova-chilli/APKBUILD
+++ b/testing/coova-chilli/APKBUILD
@@ -4,24 +4,28 @@
4# TODO: fix init.d script 4# TODO: fix init.d script
5 5
6pkgname=coova-chilli 6pkgname=coova-chilli
7pkgver=1.0.14 7pkgver=1.2.2
8pkgrel=2 8pkgrel=0
9pkgdesc="CoovaChilli is an open source access controller for wireless LAN" 9pkgdesc="CoovaChilli is an open source access controller for wireless LAN"
10url="http://www.coova.org/" 10url="http://www.coova.org/"
11license="GPL" 11license="GPL"
12depends= 12depends=
13makedepends="perl openssl-dev autoconf automake libtool" 13makedepends="perl openssl-dev autoconf automake libtool"
14install= #"coova-chilli.install" 14install=
15subpackages="$pkgname-doc $pkgname-dev" 15subpackages="$pkgname-doc $pkgname-dev"
16source="http://ap.coova.org/chilli/coova-chilli-$pkgver.tar.gz 16source="http://ap.coova.org/chilli/coova-chilli-$pkgver.tar.gz
17 coova-chilli-ssl.patch 17 coova-chilli-ssl.patch"
18 "
19 18
20build() { 19_builddir="$srcdir/$pkgname-$pkgver"
21 cd "$srcdir/$pkgname-$pkgver" 20
21prepare() {
22 cd $_builddir
22 patch -p1 -i ../coova-chilli-ssl.patch || return 1 23 patch -p1 -i ../coova-chilli-ssl.patch || return 1
23 aclocal && autoconf && automake && libtoolize || return 1 24 aclocal && autoconf && automake && libtoolize || return 1
25}
24 26
27build() {
28 cd $_builddir
25 ./configure --prefix=/usr \ 29 ./configure --prefix=/usr \
26 --sysconfdir=/etc \ 30 --sysconfdir=/etc \
27 --mandir=/usr/share/man \ 31 --mandir=/usr/share/man \
@@ -34,9 +38,9 @@ build() {
34} 38}
35 39
36package() { 40package() {
37 cd "$srcdir/$pkgname-$pkgver" 41 cd $_builddir
38 make DESTDIR="$pkgdir" install 42 make DESTDIR="$pkgdir" install
39} 43}
40 44
41md5sums="88774ec55f9943d174ea7dd26e85fd8a coova-chilli-1.0.14.tar.gz 45md5sums="44042e26c3b3c6e64a9a8769328b437d coova-chilli-1.2.2.tar.gz
42e4e94b06540c10caa750a590f3ec9ec6 coova-chilli-ssl.patch" 464135e6e19bafdad777b8ca7388ff4101 coova-chilli-ssl.patch"
diff --git a/testing/coova-chilli/coova-chilli-ssl.patch b/testing/coova-chilli/coova-chilli-ssl.patch
index 618b90a60a..1567c96cb3 100644
--- a/testing/coova-chilli/coova-chilli-ssl.patch
+++ b/testing/coova-chilli/coova-chilli-ssl.patch
@@ -1,17 +1,21 @@
1diff -ru a/src/Makefile.am b/src/Makefile.am 1--- a/src/Makefile.am
2--- a/src/Makefile.am 2009-10-15 09:15:00.000000000 +0000 2+++ b/src/Makefile.am
3+++ b/src/Makefile.am 2009-10-15 09:17:20.000000000 +0000 3@@ -13,7 +13,8 @@
4@@ -20,6 +20,7 @@ 4 chilli.h options.h util.c garden.c garden.h ssl.h ssl.c \
5 chilli.h options.h util.c garden.c garden.h \
6 dns.c dns.h session.c session.h limits.h pkt.h pkt.c \ 5 dns.c dns.h session.c session.h limits.h pkt.h pkt.c \
7 chksum.c net.h net.c ms_chap.c options.c 6 chksum.c net.h net.c ms_chap.c options.c statusfile.c \
7-conn.h conn.c
8+conn.h conn.c
8+libchilli_la_LIBADD = $(LIBOPENSSL) 9+libchilli_la_LIBADD = $(LIBOPENSSL)
9 10
10 # AM_LDFLAGS = -lchilli 11 AM_CFLAGS = -D_GNU_SOURCE -Wall -fno-builtin -fno-strict-aliasing \
11 12 -O2 -fomit-frame-pointer -funroll-loops -pipe \
12@@ -32,4 +33,4 @@ 13@@ -33,7 +34,7 @@
13 chilli_dog_SOURCES = main-dog.c
14 #test_radius_SOURCES = test-radius.c 14 #test_radius_SOURCES = test-radius.c
15 #test_dhcp_SOURCES = test-dhcp.c
15 16
16-LDADD = libchilli.la $(top_builddir)/bstring/libbstring.la 17-LDADD = libchilli.la $(top_builddir)/bstring/libbstring.la ${LIBRT}
17+LDADD = libchilli.la $(top_builddir)/bstring/libbstring.la $(LIBOPENSSL) 18+LDADD = libchilli.la $(top_builddir)/bstring/libbstring.la $(LIBOPENSSL)
19
20 if WITH_OPENSSL
21 LDADD += ${LIBSSL}
diff --git a/testing/kamailio/APKBUILD b/testing/kamailio/APKBUILD
index aee29ffc05..2f8007ee22 100644
--- a/testing/kamailio/APKBUILD
+++ b/testing/kamailio/APKBUILD
@@ -2,7 +2,7 @@
2# Maintainer: Natanael Copa <ncopa@alpinelinux.org> 2# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3pkgname=kamailio 3pkgname=kamailio
4pkgver=3.0.2 4pkgver=3.0.2
5pkgrel=0 5pkgrel=1
6pkgdesc="Open Source SIP Server" 6pkgdesc="Open Source SIP Server"
7url="http://www.kamailio.org/" 7url="http://www.kamailio.org/"
8pkgusers="kamailio" 8pkgusers="kamailio"
@@ -51,8 +51,8 @@ prepare() {
51 51
52build() { 52build() {
53 cd "$_builddir" 53 cd "$_builddir"
54 make prefix=/usr \ 54 make LOCALBASE=/usr \
55 cfg-dir=/etc/kamailio/ \ 55 cfg_target=/etc/kamailio/ \
56 MODS_MYSQL=yes \ 56 MODS_MYSQL=yes \
57 MODS_PCRE=yes \ 57 MODS_PCRE=yes \
58 MODS_PRESENCE=yes \ 58 MODS_PRESENCE=yes \
@@ -64,15 +64,17 @@ build() {
64 64
65package() { 65package() {
66 cd "$_builddir" 66 cd "$_builddir"
67 make prefix=/usr \ 67 make LOCALBASE=/usr \
68 cfg-dir=/etc/kamailio/ \ 68 cfg_target=/etc/kamailio/ \
69 MODS_MYSQL=yes \ 69 MODS_MYSQL=yes \
70 MODS_PCRE=yes \ 70 MODS_PCRE=yes \
71 MODS_PRESENCE=yes \ 71 MODS_PRESENCE=yes \
72 MODS_RADIUS= \ 72 MODS_RADIUS= \
73 TLS= \ 73 TLS= \
74 include_modules="$_modules" \ 74 include_modules="$_modules" \
75 basedir="$pkgdir" install || return 1 75 basedir="$pkgdir" \
76 cfg_prefix="$pkgdir" \
77 install || return 1
76 78
77 # move default config to -doc package and use our own default config 79 # move default config to -doc package and use our own default config
78 80
@@ -145,7 +147,7 @@ unixodbc() {
145} 147}
146 148
147md5sums="dd039e078a77032a423fb15f9685ad31 kamailio-3.0.2_src.tar.gz 149md5sums="dd039e078a77032a423fb15f9685ad31 kamailio-3.0.2_src.tar.gz
148eb665248ee39cf755a247286affc5cbb kamailio.cfg 150865979ca14a727e99e0de5ca2426603f kamailio.cfg
14981100c479890a2a8c2628db22fdd1a0c kamailio.initd 15181100c479890a2a8c2628db22fdd1a0c kamailio.initd
150c646af2dd31f5c4289a2f802c873d98f kamailio.pre-install 152c646af2dd31f5c4289a2f802c873d98f kamailio.pre-install
1513fbaf633ff1620d0d526fc4047c7bed9 kamailio.post-install 1533fbaf633ff1620d0d526fc4047c7bed9 kamailio.post-install
diff --git a/testing/kamailio/kamailio.cfg b/testing/kamailio/kamailio.cfg
index 9c101a871f..5a45cfdbbf 100644
--- a/testing/kamailio/kamailio.cfg
+++ b/testing/kamailio/kamailio.cfg
@@ -14,7 +14,7 @@ children = 4
14dns = no 14dns = no
15rev_dns = no 15rev_dns = no
16 16
17mpath = "/usr/lib/kamailio/modules/" 17mpath = "/usr/lib/kamailio/modules_k/:/usr/lib/kamailio/modules/"
18#-------------------------------------------------------- 18#--------------------------------------------------------
19# Section 2: Modules 19# Section 2: Modules
20#-------------------------------------------------------- 20#--------------------------------------------------------
diff --git a/testing/libsigc++/APKBUILD b/testing/libsigc++/APKBUILD
index bac91a5844..0329b63ae2 100644
--- a/testing/libsigc++/APKBUILD
+++ b/testing/libsigc++/APKBUILD
@@ -6,7 +6,7 @@ pkgdesc="type-safe Signal Framework for C++"
6url="http://libsigc.sourceforge.net/" 6url="http://libsigc.sourceforge.net/"
7license="LGPL" 7license="LGPL"
8depends= 8depends=
9makedepends="m4" 9makedepends="m4 perl"
10subpackages="$pkgname-dev $pkgname-doc" 10subpackages="$pkgname-dev $pkgname-doc"
11source="http://ftp.gnome.org/pub/GNOME/sources/$pkgname/2.2/$pkgname-$pkgver.tar.bz2" 11source="http://ftp.gnome.org/pub/GNOME/sources/$pkgname/2.2/$pkgname-$pkgver.tar.bz2"
12 12
diff --git a/testing/lua-lgob/APKBUILD b/testing/lua-lgob/APKBUILD
new file mode 100644
index 0000000000..17a38eaa3e
--- /dev/null
+++ b/testing/lua-lgob/APKBUILD
@@ -0,0 +1,34 @@
1# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
2pkgname=lua-lgob
3pkgver=10.05
4pkgrel=0
5pkgdesc="Set of Lua bindings that uses gobject-instrospection"
6url="http://oproj.tuxfamily.org"
7license="LGPL"
8depends="lua"
9makedepends="lua-dev cairo-dev gtk+-dev pango-dev vte-dev gtkspell-dev
10 webkit-dev atk-dev gstreamer-dev gst-plugins-base-dev poppler-gtk-dev
11 gtksourceview-dev"
12subpackages="$pkgname-dev"
13source="http://downloads.tuxfamily.org/oproj/lgob/lgob-$pkgver.tar.bz2"
14
15# 'codegen', 'common', 'gobject', 'loader', 'cairo', 'gdk', 'gtk',
16# 'pango', 'pangocairo', 'vte', 'webkit', 'atk', 'gstreamer', 'gtkspell',
17# 'gtksourceview', 'goocanvas', 'poppler', 'clutter', 'cluttergtk'
18_mods="codegen common gobject loader cairo gdk gtk pango pangocairo vte webkit
19 atk gstreamer gtkspell gtksourceview poppler"
20build() {
21 cd "$srcdir"/lgob-$pkgver
22}
23
24package() {
25 cd "$srcdir"/lgob-$pkgver
26 for i in $_mods; do
27 cd $i
28 make DESTDIR="$pkgdir"/usr \
29 && make DESTDIR="$pkgdir"/usr install|| return 1
30 cd ..
31 done
32}
33
34md5sums="ac3eb632d53c8c3d181b317482bacff7 lgob-10.05.tar.bz2"