aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2017-03-20 08:53:10 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2017-03-20 09:23:00 +0000
commitabe37391e71bf078c4c860ae58f132c727a8faa5 (patch)
tree8f32de0c183aed9fc36ec5c3a19fdff78a3a377d /main
parentf42344f9442e40532dbd9aff24834f731464766d (diff)
downloadaports-abe37391e71bf078c4c860ae58f132c727a8faa5.tar.bz2
aports-abe37391e71bf078c4c860ae58f132c727a8faa5.tar.xz
main/libvpx: remove unused patch
Diffstat (limited to 'main')
-rw-r--r--main/libvpx/git100617.patch27956
1 files changed, 0 insertions, 27956 deletions
diff --git a/main/libvpx/git100617.patch b/main/libvpx/git100617.patch
deleted file mode 100644
index 3c5eece135..0000000000
--- a/main/libvpx/git100617.patch
+++ /dev/null
@@ -1,27956 +0,0 @@
-diff --git a/AUTHORS b/AUTHORS
-index 9686ac1..4ab6881 100644
---- a/AUTHORS
-+++ b/AUTHORS
-@@ -2,3 +2,6 @@
- # Name or Organization <email address>
-
- Google Inc.
-+The Mozilla Foundation
-+Timothy B. Terriberry <tterriberry@mozilla.com>
-+The Xiph.Org Foundation
-diff --git a/LICENSE b/LICENSE
-index 6b0e867..7a6f995 100644
---- a/LICENSE
-+++ b/LICENSE
-@@ -1,22 +1,20 @@
--Copyright (c) 2010, Google, Inc.
--
--All rights reserved.
-+Copyright (c) 2010, Google Inc. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions
--are met:
-+modification, are permitted provided that the following conditions are
-+met:
-
--- Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-+ * Redistributions of source code must retain the above copyright
-+ notice, this list of conditions and the following disclaimer.
-
--- Redistributions in binary form must reproduce the above
-- copyright notice, this list of conditions and the following
-- disclaimer in the documentation and/or other materials provided
-- with the distribution.
-+ * Redistributions in binary form must reproduce the above copyright
-+ notice, this list of conditions and the following disclaimer in
-+ the documentation and/or other materials provided with the
-+ distribution.
-
--- Neither the name of Google nor the names of its contributors may
-- be used to endorse or promote products derived from this software
-- without specific prior written permission.
-+ * Neither the name of Google nor the names of its contributors may
-+ be used to endorse or promote products derived from this software
-+ without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-@@ -30,19 +28,3 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
--Subject to the terms and conditions of the above License, Google
--hereby grants to You a perpetual, worldwide, non-exclusive,
--no-charge, royalty-free, irrevocable (except as stated in this
--section) patent license to make, have made, use, offer to sell, sell,
--import, and otherwise transfer this implementation of VP8, where such
--license applies only to those patent claims, both currently owned by
--Google and acquired in the future, licensable by Google that are
--necessarily infringed by this implementation of VP8. If You or your
--agent or exclusive licensee institute or order or agree to the
--institution of patent litigation against any entity (including a
--cross-claim or counterclaim in a lawsuit) alleging that this
--implementation of VP8 or any code incorporated within this
--implementation of VP8 constitutes direct or contributory patent
--infringement, or inducement of patent infringement, then any rights
--granted to You under this License for this implementation of VP8
--shall terminate as of the date such litigation is filed.
-diff --git a/PATENTS b/PATENTS
-new file mode 100644
-index 0000000..4414d83
---- /dev/null
-+++ b/PATENTS
-@@ -0,0 +1,22 @@
-+Additional IP Rights Grant (Patents)
-+
-+"This implementation" means the copyrightable works distributed by
-+Google as part of the WebM Project.
-+
-+Google hereby grants to you a perpetual, worldwide, non-exclusive,
-+no-charge, royalty-free, irrevocable (except as stated in this section)
-+patent license to make, have made, use, offer to sell, sell, import,
-+transfer, and otherwise run, modify and propagate the contents of this
-+implementation of VP8, where such license applies only to those patent
-+claims, both currently owned by Google and acquired in the future,
-+licensable by Google that are necessarily infringed by this
-+implementation of VP8. This grant does not include claims that would be
-+infringed only as a consequence of further modification of this
-+implementation. If you or your agent or exclusive licensee institute or
-+order or agree to the institution of patent litigation against any
-+entity (including a cross-claim or counterclaim in a lawsuit) alleging
-+that this implementation of VP8 or any code incorporated within this
-+implementation of VP8 constitutes direct or contributory patent
-+infringement, or inducement of patent infringement, then any patent
-+rights granted to you under this License for this implementation of VP8
-+shall terminate as of the date such litigation is filed.
-diff --git a/args.c b/args.c
-index f2ad697..5fd0466 100644
---- a/args.c
-+++ b/args.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/args.h b/args.h
-index c063f53..f1ec6c0 100644
---- a/args.h
-+++ b/args.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/build/.gitattributes b/build/.gitattributes
-new file mode 100644
-index 0000000..03db79b
---- /dev/null
-+++ b/build/.gitattributes
-@@ -0,0 +1,2 @@
-+*-vs8/*.rules -crlf
-+*-msvs/*.rules -crlf
-diff --git a/build/arm-wince-vs8/.gitattributes b/build/arm-wince-vs8/.gitattributes
-deleted file mode 100644
-index be1eeb9..0000000
---- a/build/arm-wince-vs8/.gitattributes
-+++ /dev/null
-@@ -1 +0,0 @@
--*.rules -crlf
-diff --git a/build/arm-wince-vs8/obj_int_extract.bat b/build/arm-wince-vs8/obj_int_extract.bat
-index e58bdd6..3069160 100644
---- a/build/arm-wince-vs8/obj_int_extract.bat
-+++ b/build/arm-wince-vs8/obj_int_extract.bat
-@@ -1,12 +1,13 @@
- @echo off
- REM Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- REM
--REM Use of this source code is governed by a BSD-style license and patent
--REM grant that can be found in the LICENSE file in the root of the source
--REM tree. All contributing project authors may be found in the AUTHORS
--REM file in the root of the source tree.
-+REM Use of this source code is governed by a BSD-style license
-+REM that can be found in the LICENSE file in the root of the source
-+REM tree. An additional intellectual property rights grant can be found
-+REM in the file PATENTS. All contributing project authors may
-+REM be found in the AUTHORS file in the root of the source tree.
- echo on
-
-
--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
-+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
- obj_int_extract.exe rvds "Pocket_PC_2003__ARMV4_\%1/dec_asm_offsets_arm.obj"
-diff --git a/build/make/Makefile b/build/make/Makefile
-index 412629e..4f7df43 100755
---- a/build/make/Makefile
-+++ b/build/make/Makefile
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
--##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+##
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-@@ -18,6 +19,7 @@ ifeq ($(target),)
- done
- all: .DEFAULT
- clean:: .DEFAULT
-+install:: .DEFAULT
-
-
- # Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
-@@ -29,7 +31,7 @@ md5sum := $(firstword $(wildcard \
- md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum))
-
- TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
--install:
-+dist:
- @for t in $(ALL_TARGETS); do \
- $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
- done
-@@ -37,7 +39,7 @@ install:
- @if [ -d "$(DIST_DIR)/src" ]; then \
- mkdir -p "$(DIST_DIR)/build"; \
- cd "$(DIST_DIR)/build"; \
-- if [ $(TGT_CC) = "rvct" ] ; then \
-+ if [ "$(TGT_CC)" = "rvct" ] ; then \
- echo "../src/configure --target=$(TOOLCHAIN) --libc=$(ALT_LIBC)"; \
- ../src/configure --target=$(TOOLCHAIN) --libc=$(ALT_LIBC); \
- else \
-@@ -94,10 +96,10 @@ clean::
- rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s)
- rm -f $(CLEAN-OBJS)
-
-+.PHONY: dist
-+dist:
- .PHONY: install
--install:
--.PHONY: install-helper
--install-helper:
-+install::
-
- $(BUILD_PFX)%.c.d: %.c
- $(if $(quiet),@echo " [DEP] $@")
-@@ -218,6 +220,20 @@ $(1):
- $(qexec)$$(AR) $$(ARFLAGS) $$@ $$?
- endef
-
-+define so_template
-+# Not using a pattern rule here because we don't want to generate empty
-+# archives when they are listed as a dependency in files not responsible
-+# for creating them.
-+#
-+# This needs further abstraction for dealing with non-GNU linkers.
-+$(1):
-+ $(if $(quiet),@echo " [LD] $$@")
-+ $(qexec)$$(LD) -shared $$(LDFLAGS) \
-+ -Wl,--no-undefined -Wl,-soname,$$(SONAME) \
-+ -Wl,--version-script,$$(SO_VERSION_SCRIPT) -o $$@ \
-+ $$(filter %.o,$$?) $$(extralibs)
-+endef
-+
- define lipo_lib_template
- $(1): $(addsuffix /$(1),$(FAT_ARCHS))
- $(if $(quiet),@echo " [LIPO] $$@")
-@@ -254,6 +270,9 @@ DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS)
- @touch $@
-
- INSTALL-DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,INSTALL-DOCS)
-+ifeq ($(MAKECMDGOALS),dist)
-+INSTALL-DOCS+=$(call cond_enabled,CONFIG_INSTALL_DOCS,DIST-DOCS)
-+endif
- .install-docs: .docs $(addprefix $(DIST_DIR)/,$(INSTALL-DOCS))
- @touch $@
-
-@@ -265,6 +284,9 @@ BINS=$(call enabled,BINS)
- @touch $@
-
- INSTALL-BINS=$(call cond_enabled,CONFIG_INSTALL_BINS,INSTALL-BINS)
-+ifeq ($(MAKECMDGOALS),dist)
-+INSTALL-BINS+=$(call cond_enabled,CONFIG_INSTALL_BINS,DIST-BINS)
-+endif
- .install-bins: .bins $(addprefix $(DIST_DIR)/,$(INSTALL-BINS))
- @touch $@
-
-@@ -275,8 +297,12 @@ LIBS=$(call enabled,LIBS)
- .libs: $(LIBS)
- @touch $@
- $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
-+$(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
-
- INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS)
-+ifeq ($(MAKECMDGOALS),dist)
-+INSTALL-LIBS+=$(call cond_enabled,CONFIG_INSTALL_LIBS,DIST-LIBS)
-+endif
- .install-libs: .libs $(addprefix $(DIST_DIR)/,$(INSTALL-LIBS))
- @touch $@
-
-@@ -289,6 +315,9 @@ PROJECTS=$(call enabled,PROJECTS)
- @touch $@
-
- INSTALL-PROJECTS=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,INSTALL-PROJECTS)
-+ifeq ($(MAKECMDGOALS),dist)
-+INSTALL-PROJECTS+=$(call cond_enabled,CONFIG_INSTALL_PROJECTS,DIST-PROJECTS)
-+endif
- .install-projects: .projects $(addprefix $(DIST_DIR)/,$(INSTALL-PROJECTS))
- @touch $@
-
-@@ -296,26 +325,29 @@ clean::
- rm -f .projects .install-projects $(PROJECTS)
- endif
-
--# If there are any source files to be installed, then include the build
-+# If there are any source files to be distributed, then include the build
- # system too.
--ifneq ($(call enabled,INSTALL-SRCS),)
-- INSTALL-SRCS-yes += configure
-- INSTALL-SRCS-yes += build/make/configure.sh
-- INSTALL-SRCS-yes += build/make/gen_asm_deps.sh
-- INSTALL-SRCS-yes += build/make/Makefile
-- INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
-- INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
-- INSTALL-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
-- INSTALL-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
-+ifneq ($(call enabled,DIST-SRCS),)
-+ DIST-SRCS-yes += configure
-+ DIST-SRCS-yes += build/make/configure.sh
-+ DIST-SRCS-yes += build/make/gen_asm_deps.sh
-+ DIST-SRCS-yes += build/make/Makefile
-+ DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_def.sh
-+ DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_proj.sh
-+ DIST-SRCS-$(CONFIG_MSVS) += build/make/gen_msvs_sln.sh
-+ DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
- #
- # This isn't really ARCH_ARM dependent, it's dependant on whether we're
- # using assembly code or not (CONFIG_OPTIMIZATIONS maybe). Just use
- # this for now.
-- INSTALL-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c
-- INSTALL-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
-- INSTALL-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
-+ DIST-SRCS-$(ARCH_ARM) += build/make/obj_int_extract.c
-+ DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
-+ DIST-SRCS-yes += $(target:-$(TOOLCHAIN)=).mk
- endif
- INSTALL-SRCS := $(call cond_enabled,CONFIG_INSTALL_SRCS,INSTALL-SRCS)
-+ifeq ($(MAKECMDGOALS),dist)
-+INSTALL-SRCS += $(call cond_enabled,CONFIG_INSTALL_SRCS,DIST-SRCS)
-+endif
- .install-srcs: $(addprefix $(DIST_DIR)/src/,$(INSTALL-SRCS))
- @touch $@
-
-@@ -329,7 +361,8 @@ endif
- BUILD_TARGETS += .docs .libs .bins
- INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
- all-$(target): $(BUILD_TARGETS)
--install: $(INSTALL_TARGETS)
-+install:: $(INSTALL_TARGETS)
-+dist: $(INSTALL_TARGETS)
-
- #
- # Development helper targets
-diff --git a/build/make/ads2gas.pl b/build/make/ads2gas.pl
-index 6fcba84..bd5e772 100755
---- a/build/make/ads2gas.pl
-+++ b/build/make/ads2gas.pl
-@@ -1,11 +1,12 @@
- #!/usr/bin/perl
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
--##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+##
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/make/ads2gas_apple.pl b/build/make/ads2gas_apple.pl
-index 569c3e7..7a32445 100755
---- a/build/make/ads2gas_apple.pl
-+++ b/build/make/ads2gas_apple.pl
-@@ -1,11 +1,12 @@
- #!/usr/bin/env perl
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
--##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+##
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/make/armlink_adapter.sh b/build/make/armlink_adapter.sh
-index dcaa82c..25fb627 100755
---- a/build/make/armlink_adapter.sh
-+++ b/build/make/armlink_adapter.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/make/configure.sh b/build/make/configure.sh
-index ed3a34f..05e550f 100755
---- a/build/make/configure.sh
-+++ b/build/make/configure.sh
-@@ -1,13 +1,13 @@
- #!/bin/bash
- ##
--## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+## configure.sh
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## This script is sourced by the main configure script and contains
-+## utility functions and other common bits that aren't strictly libvpx
-+## related.
-+##
-+## This build system is based in part on the FFmpeg configure script.
- ##
--
-
-
- #
-@@ -120,8 +120,8 @@ EOF
-
- show_targets() {
- while [ -n "$*" ]; do
-- if [ "${1%%-*}" == "${2%%-*}" ]; then
-- if [ "${2%%-*}" == "${3%%-*}" ]; then
-+ if [ "${1%%-*}" = "${2%%-*}" ]; then
-+ if [ "${2%%-*}" = "${3%%-*}" ]; then
- printf " %-24s %-24s %-24s\n" "$1" "$2" "$3"
- shift; shift; shift
- else
-@@ -348,7 +348,6 @@ true
- }
-
- write_common_target_config_mk() {
-- [ -n "$2" ] && local have_config_h="-DHAVE_CONFIG_H=\"${2##*/}\""
- local CC=${CC}
- enabled ccache && CC="ccache ${CC}"
-
-@@ -367,7 +366,7 @@ AS=${AS}
- STRIP=${STRIP}
- NM=${NM}
-
--CFLAGS = ${CFLAGS} ${have_config_h}
-+CFLAGS = ${CFLAGS}
- ARFLAGS = -rus\$(if \$(quiet),c,v)
- LDFLAGS = ${LDFLAGS}
- ASFLAGS = ${ASFLAGS}
-@@ -443,7 +442,13 @@ process_common_cmdline() {
- disable builtin_libc
- alt_libc="${optval}"
- ;;
-- --libc)
-+ --prefix=*)
-+ prefix="${optval}"
-+ ;;
-+ --libdir=*)
-+ libdir="${optval}"
-+ ;;
-+ --libc|--prefix|--libdir)
- die "Option ${opt} requires argument"
- ;;
- --help|-h) show_help
-@@ -464,6 +469,18 @@ process_cmdline() {
- done
- }
-
-+
-+post_process_common_cmdline() {
-+ prefix="${prefix:-/usr/local}"
-+ prefix="${prefix%/}"
-+ libdir="${libdir:-${prefix}/lib}"
-+ libdir="${libdir%/}"
-+ if [ "${libdir#${prefix}}" = "${libdir}" ]; then
-+ die "Libdir ${libdir} must be a subdirectory of ${prefix}"
-+ fi
-+}
-+
-+
- post_process_cmdline() {
- true;
- }
-@@ -479,6 +496,42 @@ setup_gnu_toolchain() {
- }
-
- process_common_toolchain() {
-+ if [ -z "$toolchain" ]; then
-+ gcctarget="$(gcc -dumpmachine 2> /dev/null)"
-+
-+ # detect tgt_isa
-+ case "$gcctarget" in
-+ *x86_64*|*amd64*)
-+ tgt_isa=x86_64
-+ ;;
-+ *i[3456]86*)
-+ tgt_isa=x86
-+ ;;
-+ esac
-+
-+ # detect tgt_os
-+ case "$gcctarget" in
-+ *darwin8*)
-+ tgt_isa=universal
-+ tgt_os=darwin8
-+ ;;
-+ *darwin9*)
-+ tgt_isa=universal
-+ tgt_os=darwin9
-+ ;;
-+ *mingw32*|*cygwin*)
-+ tgt_os=win32
-+ ;;
-+ *linux*|*bsd*)
-+ tgt_os=linux
-+ ;;
-+ esac
-+
-+ if [ -n "$tgt_isa" ] && [ -n "$tgt_os" ]; then
-+ toolchain=${tgt_isa}-${tgt_os}-gcc
-+ fi
-+ fi
-+
- toolchain=${toolchain:-generic-gnu}
-
- is_in ${toolchain} ${all_platforms} || enabled force_toolchain \
-@@ -781,6 +834,7 @@ process_common_toolchain() {
- ;;
- universal*|*-gcc|generic-gnu)
- link_with_cc=gcc
-+ enable gcc
- setup_gnu_toolchain
- ;;
- esac
-@@ -844,8 +898,8 @@ process_toolchain() {
- }
-
- print_config_mk() {
-- prefix=$1
-- makefile=$2
-+ local prefix=$1
-+ local makefile=$2
- shift 2
- for cfg; do
- upname="`toupper $cfg`"
-@@ -856,8 +910,8 @@ print_config_mk() {
- }
-
- print_config_h() {
-- prefix=$1
-- header=$2
-+ local prefix=$1
-+ local header=$2
- shift 2
- for cfg; do
- upname="`toupper $cfg`"
-@@ -888,6 +942,7 @@ process() {
- else
- echo "# ${self} $@" > ${logfile}
- fi
-+ post_process_common_cmdline
- post_process_cmdline
- process_toolchain
- process_detect
-diff --git a/build/make/gen_asm_deps.sh b/build/make/gen_asm_deps.sh
-index c1118e1..2c972e5 100755
---- a/build/make/gen_asm_deps.sh
-+++ b/build/make/gen_asm_deps.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/make/gen_msvs_def.sh b/build/make/gen_msvs_def.sh
-index 68b2406..b5c54fd 100755
---- a/build/make/gen_msvs_def.sh
-+++ b/build/make/gen_msvs_def.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/make/gen_msvs_proj.sh b/build/make/gen_msvs_proj.sh
-index eb482a4..d94ae4d 100755
---- a/build/make/gen_msvs_proj.sh
-+++ b/build/make/gen_msvs_proj.sh
-@@ -2,15 +2,17 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
- self=$0
- self_basename=${self##*/}
-+self_dirname=$(dirname "$0")
- EOL=$'\n'
-
- show_help() {
-@@ -291,8 +293,8 @@ case "$target" in
- x86*)
- platforms[0]="Win32"
- # these are only used by vs7
-- asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} \$(InputPath)"
-- asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} \$(InputPath)"
-+ asm_Debug_cmdline="yasm -Xvc -g cv8 -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
-+ asm_Release_cmdline="yasm -Xvc -f \$(PlatformName) ${yasmincs} &quot;\$(InputPath)&quot;"
- ;;
- arm*|iwmmx*)
- case "${name}" in
-@@ -342,19 +344,19 @@ generate_vcproj() {
-
- open_tag ToolFiles
- case "$target" in
-- x86*) $uses_asm && tag DefaultToolFile FileName="yasm.rules"
-+ x86*) $uses_asm && tag ToolFile RelativePath="$self_dirname/../x86-msvs/yasm.rules"
- ;;
- arm*|iwmmx*)
- if [ "$name" == "vpx_decoder" ];then
- case "$target" in
- armv5*)
-- tag DefaultToolFile FileName="armasmv5.rules"
-+ tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmv5.rules"
- ;;
- armv6*)
-- tag DefaultToolFile FileName="armasmv6.rules"
-+ tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmv6.rules"
- ;;
- iwmmxt*)
-- tag DefaultToolFile FileName="armasmxscale.rules"
-+ tag ToolFile RelativePath="$self_dirname/../arm-wince-vs8/armasmxscale.rules"
- ;;
- esac
- fi
-@@ -385,7 +387,7 @@ generate_vcproj() {
- ExecutionBucket="7" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
-- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
-+ PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- MinimalRebuild="true" \
- RuntimeLibrary="1" \
- BufferSecurityCheck="false" \
-@@ -404,7 +406,7 @@ generate_vcproj() {
- ExecutionBucket="7" \
- Optimization="0" \
- AdditionalIncludeDirectories="$incs" \
-- PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
-+ PreprocessorDefinitions="_DEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;DEBUG;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- MinimalRebuild="true" \
- RuntimeLibrary="1" \
- BufferSecurityCheck="false" \
-@@ -544,7 +546,7 @@ generate_vcproj() {
- Optimization="2" \
- FavorSizeOrSpeed="1" \
- AdditionalIncludeDirectories="$incs" \
-- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
-+ PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_LIB;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- RuntimeLibrary="0" \
- BufferSecurityCheck="false" \
- UsePrecompiledHeader="0" \
-@@ -563,7 +565,7 @@ generate_vcproj() {
- Optimization="2" \
- FavorSizeOrSpeed="1" \
- AdditionalIncludeDirectories="$incs" \
-- PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;HAVE_CONFIG_H" \
-+ PreprocessorDefinitions="NDEBUG;_WIN32_WCE=\$(CEVER);UNDER_CE;\$(PLATFORMDEFINES);WINCE;_CONSOLE;\$(ARCHFAM);\$(_ARCHFAM_);_UNICODE;UNICODE;" \
- RuntimeLibrary="0" \
- BufferSecurityCheck="false" \
- UsePrecompiledHeader="0" \
-diff --git a/build/make/gen_msvs_sln.sh b/build/make/gen_msvs_sln.sh
-index b670ec5..ef425f5 100755
---- a/build/make/gen_msvs_sln.sh
-+++ b/build/make/gen_msvs_sln.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/make/obj_int_extract.c b/build/make/obj_int_extract.c
-index cef14e7..0f64e89 100644
---- a/build/make/obj_int_extract.c
-+++ b/build/make/obj_int_extract.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -16,7 +17,7 @@
- #if defined(_MSC_VER)
- #include <io.h>
- #include <share.h>
--#include "vpx_ports/vpx_integer.h"
-+#include "vpx/vpx_integer.h"
- #else
- #include <stdint.h>
- #include <unistd.h>
-diff --git a/build/make/version.sh b/build/make/version.sh
-index 2bda701..81682d6 100755
---- a/build/make/version.sh
-+++ b/build/make/version.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/build/x86-msvs/yasm.rules b/build/x86-msvs/yasm.rules
-new file mode 100644
-index 0000000..ee1fefb
---- /dev/null
-+++ b/build/x86-msvs/yasm.rules
-@@ -0,0 +1,115 @@
-+<?xml version="1.0" encoding="utf-8"?>
-+<VisualStudioToolFile
-+ Name="Yasm"
-+ Version="8.00"
-+ >
-+ <Rules>
-+ <CustomBuildRule
-+ Name="YASM"
-+ DisplayName="Yasm Assembler"
-+ CommandLine="yasm -Xvc -f $(PlatformName) [AllOptions] [AdditionalOptions] [Inputs]"
-+ Outputs="[$ObjectFileName]"
-+ FileExtensions="*.asm"
-+ ExecutionDescription="Assembling $(InputFileName)"
-+ ShowOnlyRuleProperties="false"
-+ >
-+ <Properties>
-+ <StringProperty
-+ Name="Defines"
-+ DisplayName="Definitions"
-+ Category="Pre-Defined Symbols"
-+ Description="Specify pre-defined symbols (&apos;symbol&apos; or &apos;symbol = value&apos;) "
-+ Switch="-D [value]"
-+ Delimited="true"
-+ Inheritable="true"
-+ />
-+ <StringProperty
-+ Name="IncludePaths"
-+ DisplayName="Include Paths"
-+ Category="Configuration"
-+ Description="Set the paths for any additional include files"
-+ Switch="-I [value]"
-+ Delimited="true"
-+ Inheritable="true"
-+ />
-+ <StringProperty
-+ Name="UnDefines"
-+ DisplayName="Remove Definitions"
-+ Category="Pre-Defined Symbols"
-+ Description="Remove pre-defined symbols "
-+ Switch="-U [value]"
-+ Delimited="true"
-+ Inheritable="true"
-+ />
-+ <StringProperty
-+ Name="ObjectFileName"
-+ DisplayName="Object File Name"
-+ Category="Output"
-+ Description="Select the output file name"
-+ Switch="-o [value]"
-+ DefaultValue="$(IntDir)\$(InputName).obj"
-+ />
-+ <StringProperty
-+ Name="ListFileName"
-+ DisplayName="List File Name"
-+ Category="Output"
-+ Description="Select an output listing by setting its file name"
-+ Switch="-l [value]"
-+ />
-+ <StringProperty
-+ Name="PreIncludeFile"
-+ DisplayName="Pre Include File"
-+ Category="Configuration"
-+ Description="Select a pre-included file by setting its name"
-+ Switch="-P [value]"
-+ />
-+ <BooleanProperty
-+ Name="Debug"
-+ DisplayName="Debug Information"
-+ Category="Output"
-+ Description="Generate debugging information"
-+ Switch="-g cv8"
-+ />
-+ <EnumProperty
-+ Name="PreProc"
-+ DisplayName="Pre-Processor"
-+ Category="Configuration"
-+ Description="Select the pre-processor (&apos;nasm&apos; or &apos;raw&apos;)"
-+ >
-+ <Values>
-+ <EnumValue
-+ Value="0"
-+ Switch="-rnasm"
-+ DisplayName="Nasm "
-+ />
-+ <EnumValue
-+ Value="1"
-+ Switch="-rraw"
-+ DisplayName="Raw"
-+ />
-+ </Values>
-+ </EnumProperty>
-+ <EnumProperty
-+ Name="Parser"
-+ DisplayName="Parser"
-+ Category="Configuration"
-+ Description="Select the parser for Intel (&apos;nasm&apos;) or AT&amp;T ( &apos;gas&apos;) syntax"
-+ >
-+ <Values>
-+ <EnumValue
-+ Value="0"
-+ Switch="-pnasm"
-+ DisplayName="Nasm"
-+ />
-+ <EnumValue
-+ Value="1"
-+ Switch="-pgas"
-+ DisplayName="Gas"
-+ />
-+ </Values>
-+ </EnumProperty>
-+ </Properties>
-+ </CustomBuildRule>
-+ </Rules>
-+</VisualStudioToolFile>
-+
-diff --git a/configure b/configure
-index 3083343..9a3269a 100755
---- a/configure
-+++ b/configure
-@@ -1,13 +1,16 @@
- #!/bin/bash
- ##
--## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+## configure
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## This script is the front-end to the build system. It provides a similar
-+## interface to standard configure scripts with some extra bits for dealing
-+## with toolchains that differ from the standard POSIX interface and
-+## for extracting subsets of the source tree. In theory, reusable parts
-+## of this script were intended to live in build/make/configure.sh,
-+## but in practice, the line is pretty blurry.
-+##
-+## This build system is based in part on the FFmpeg configure script.
- ##
--
-
- #source_path="`dirname \"$0\"`"
- source_path=${0%/*}
-@@ -24,18 +27,17 @@ Advanced options:
- supported by hardware [auto]
- ${toggle_codec_srcs} in/exclude codec library source code
- ${toggle_debug_libs} in/exclude debug version of libraries
-- ${toggle_eval_limit} enable limited evaluation build
- ${toggle_md5} support for output of checksum data
- ${toggle_static_msvcrt} use static MSVCRT (VS builds only)
- ${toggle_vp8} VP8 codec support
- ${toggle_psnr} output of PSNR data, if supported (encoders)
- ${toggle_mem_tracker} track memory usage
-- ${toggle_eval_limit} decoder limitted to 500 frames
- ${toggle_postproc} postprocessing
- ${toggle_multithread} multithreaded encoding and decoding.
- ${toggle_spatial_resampling} spatial sampling (scaling) support
- ${toggle_realtime_only} enable this option while building for real-time encoding
- ${toggle_runtime_cpu_detect} runtime cpu detection
-+ ${toggle_shared} shared library support
-
- Codecs:
- Codecs can be selectively enabled or disabled individually, or by family:
-@@ -135,11 +137,12 @@ if [ ${doxy_major:-0} -ge 1 ]; then
- [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable doxygen
- fi
-
--# install everything, by default
-+# install everything except the sources, by default. sources will have
-+# to be enabled when doing dist builds, since that's no longer a common
-+# case.
- enabled doxygen && php -v >/dev/null 2>&1 && enable install_docs
- enable install_bins
- enable install_libs
--enable install_srcs
-
- enable optimizations
- enable fast_unaligned #allow unaligned accesses, if supported by hw
-@@ -157,8 +160,8 @@ if ! enabled alt_tree_layout; then
- [ -d ${source_path}/vp8 ] && CODECS="${CODECS} vp8_encoder vp8_decoder"
- else
- # customer environment
--[ -f ${source_path}/../include/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
--[ -f ${source_path}/../include/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
-+[ -f ${source_path}/../include/vpx/vp8cx.h ] && CODECS="${CODECS} vp8_encoder"
-+[ -f ${source_path}/../include/vpx/vp8dx.h ] && CODECS="${CODECS} vp8_decoder"
-
- [ -f ${source_path}/../lib/*/*mt.lib ] && soft_enable static_msvcrt
- fi
-@@ -225,7 +228,6 @@ CONFIG_LIST="
- dequant_tokens
- dc_recon
- new_tokens
-- eval_limit
- runtime_cpu_detect
- postproc
- postproc_generic
-@@ -238,6 +240,7 @@ CONFIG_LIST="
- static_msvcrt
- spatial_resampling
- realtime_only
-+ shared
- "
- CMDLINE_SELECT="
- extra_warnings
-@@ -265,7 +268,6 @@ CMDLINE_SELECT="
- dequant_tokens
- dc_recon
- new_tokens
-- eval_limit
- postproc
- postproc_generic
- multithread
-@@ -276,6 +278,7 @@ CMDLINE_SELECT="
- mem_tracker
- spatial_resampling
- realtime_only
-+ shared
- "
-
- process_cmdline() {
-@@ -354,7 +357,6 @@ process_targets() {
- enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
- ! enabled postproc && DIST_DIR="${DIST_DIR}-nopost"
- ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
-- enabled eval_limit && DIST_DIR="${DIST_DIR}-eval"
- ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
- DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
- case "${tgt_os}" in
-@@ -365,8 +367,26 @@ process_targets() {
- if [ -f "${source_path}/build/make/version.sh" ]; then
- local ver=`"$source_path/build/make/version.sh" --bare $source_path`
- DIST_DIR="${DIST_DIR}-${ver}"
-+ ver=${ver%%-*}
-+ VERSION_PATCH=${ver##*.}
-+ ver=${ver%.*}
-+ VERSION_MINOR=${ver##*.}
-+ ver=${ver#v}
-+ VERSION_MAJOR=${ver%.*}
- fi
-- enabled child || echo "DIST_DIR?=${DIST_DIR}" >> config.mk
-+ enabled child || cat <<EOF >> config.mk
-+ifeq (\$(MAKECMDGOALS),dist)
-+DIST_DIR?=${DIST_DIR}
-+else
-+DIST_DIR?=\$(DESTDIR)${prefix}
-+endif
-+LIBSUBDIR=${libdir##${prefix}/}
-+
-+VERSION_MAJOR=${VERSION_MAJOR}
-+VERSION_MINOR=${VERSION_MINOR}
-+VERSION_PATCH=${VERSION_PATCH}
-+
-+EOF
- enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
-
- #
-@@ -385,6 +405,12 @@ process_targets() {
- }
-
- process_detect() {
-+ if enabled shared; then
-+ # Can only build shared libs on a subset of platforms. Doing this check
-+ # here rather than at option parse time because the target auto-detect
-+ # magic happens after the command line has been parsed.
-+ enabled linux || die "--enable-shared only supported on ELF for now"
-+ fi
- if [ -z "$CC" ]; then
- echo "Bypassing toolchain for environment detection."
- enable external_build
-@@ -419,7 +445,7 @@ EOF
- check_header pthread.h
- check_header sys/mman.h
-
-- check_header vpx_ports/vpx_integer.h -I${source_path} && enable vpx_ports
-+ check_header vpx/vpx_integer.h -I${source_path} && enable vpx_ports
- }
-
- process_toolchain() {
-diff --git a/docs.mk b/docs.mk
-index 3e7b5cd..f60a482 100644
---- a/docs.mk
-+++ b/docs.mk
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-@@ -47,8 +48,8 @@ docs/html/index.html: doxyfile $(CODEC_DOX) $(TXT_DOX)
- @doxygen $<
- DOCS-yes += docs/html/index.html
-
--INSTALL-DOCS-yes = $(wildcard docs/html/*)
--INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX))
--INSTALL-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template
--INSTALL-DOCS-yes += CHANGELOG
--INSTALL-DOCS-yes += README
-+DIST-DOCS-yes = $(wildcard docs/html/*)
-+DIST-DOCS-$(CONFIG_CODEC_SRCS) += $(addprefix src/,$(CODEC_DOX))
-+DIST-DOCS-$(CONFIG_CODEC_SRCS) += src/libs.doxy_template
-+DIST-DOCS-yes += CHANGELOG
-+DIST-DOCS-yes += README
-diff --git a/example_xma.c b/example_xma.c
-index cc4e591..e5eca7a 100644
---- a/example_xma.c
-+++ b/example_xma.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -15,10 +16,10 @@
- #include <string.h>
- #define VPX_CODEC_DISABLE_COMPAT 1
- #include "vpx_config.h"
--#include "vpx_decoder.h"
--#include "vpx_integer.h"
-+#include "vpx/vpx_decoder.h"
-+#include "vpx/vpx_integer.h"
- #if CONFIG_VP8_DECODER
--#include "vp8dx.h"
-+#include "vpx/vp8dx.h"
- #endif
-
- static char *exec_name;
-diff --git a/examples.mk b/examples.mk
-index 036a423..bca0d9c 100644
---- a/examples.mk
-+++ b/examples.mk
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-@@ -14,18 +15,21 @@
- UTILS-$(CONFIG_DECODERS) += ivfdec.c
- ivfdec.SRCS += md5_utils.c md5_utils.h
- ivfdec.SRCS += vpx_ports/vpx_timer.h
--ivfdec.SRCS += vpx_ports/vpx_integer.h
-+ivfdec.SRCS += vpx/vpx_integer.h
- ivfdec.SRCS += args.c args.h vpx_ports/config.h
- ivfdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
- ivfdec.DESCRIPTION = Full featured decoder
- UTILS-$(CONFIG_ENCODERS) += ivfenc.c
--ivfenc.SRCS += args.c args.h vpx_ports/config.h
--ivfenc.SRCS += vpx_ports/mem_ops.h vpx_ports/mem_ops_aligned.h
-+ivfenc.SRCS += args.c args.h y4minput.c y4minput.h
-+ivfenc.SRCS += vpx_ports/config.h vpx_ports/mem_ops.h
-+ivfenc.SRCS += vpx_ports/mem_ops_aligned.h
- ivfenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
- ivfenc.DESCRIPTION = Full featured encoder
--UTILS-$(CONFIG_DECODERS) += example_xma.c
--example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022
--example_xma.DESCRIPTION = External Memory Allocation mode usage
-+
-+# XMA example disabled for now, not used in VP8
-+#UTILS-$(CONFIG_DECODERS) += example_xma.c
-+#example_xma.GUID = A955FC4A-73F1-44F7-135E-30D84D32F022
-+#example_xma.DESCRIPTION = External Memory Allocation mode usage
-
- GEN_EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
- simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
-@@ -84,8 +88,6 @@ ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
- INC_PATH := $(SRC_PATH_BARE)/../include
- else
- LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
-- INC_PATH-yes += $(SRC_PATH_BARE)/vpx_codec
-- INC_PATH-yes += $(SRC_PATH_BARE)/vpx_ports
- INC_PATH-$(CONFIG_VP8_DECODER) += $(SRC_PATH_BARE)/vp8
- INC_PATH-$(CONFIG_VP8_ENCODER) += $(SRC_PATH_BARE)/vp8
- LIB_PATH := $(call enabled,LIB_PATH)
-@@ -99,6 +101,7 @@ LDFLAGS += $(addprefix -L,$(LIB_PATH))
- UTILS = $(call enabled,UTILS)
- GEN_EXAMPLES = $(call enabled,GEN_EXAMPLES)
- ALL_EXAMPLES = $(UTILS) $(GEN_EXAMPLES)
-+UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
- ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(ex:.c=).SRCS))
- CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
-
-@@ -120,8 +123,10 @@ $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_OBJS,BUILD_OBJS):=yes)
- # Create build/install dependencies for all examples. The common case
- # is handled here. The MSVS case is handled below.
- NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
--INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
--INSTALL-SRCS-yes += $(ALL_SRCS)
-+DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=))
-+INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=))
-+DIST-SRCS-yes += $(ALL_SRCS)
-+INSTALL-SRCS-yes += $(UTIL_SRCS)
- OBJS-$(NOT_MSVS) += $(if $(BUILD_OBJS),$(call objs,$(ALL_SRCS)))
- BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=))
-
-diff --git a/examples/decode_to_md5.txt b/examples/decode_to_md5.txt
-index 0599b13..b3dd568 100644
---- a/examples/decode_to_md5.txt
-+++ b/examples/decode_to_md5.txt
-@@ -26,21 +26,21 @@ is processed, then U, then V. It is important to honor the image's `stride`
- values.
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ PROCESS_DX
- unsigned char md5_sum[16];
--md5_ctx_t md5;
-+MD5Context md5;
- int i;
-
--md5_init(&md5);
-+MD5Init(&md5);
-
- for(plane=0; plane < 3; plane++) {
- unsigned char *buf =img->planes[plane];
-
- for(y=0; y<img->d_h >> (plane?1:0); y++) {
-- md5_update(&md5, buf, img->d_w >> (plane?1:0));
-+ MD5Update(&md5, buf, img->d_w >> (plane?1:0));
- buf += img->stride[plane];
- }
- }
-
--md5_finalize(&md5, md5_sum);
-+MD5Final(md5_sum, &md5);
- for(i=0; i<16; i++)
- fprintf(outfile, "%02x",md5_sum[i]);
- fprintf(outfile, " img-%dx%d-%04d.i420\n", img->d_w, img->d_h,
-diff --git a/examples/decoder_tmpl.c b/examples/decoder_tmpl.c
-index deea449..826ad20 100644
---- a/examples/decoder_tmpl.c
-+++ b/examples/decoder_tmpl.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -16,11 +17,9 @@
- #include <stdarg.h>
- #include <string.h>
- #define VPX_CODEC_DISABLE_COMPAT 1
--#include "vpx_decoder.h"
--#if CONFIG_VP8_DECODER && !defined(interface)
--#include "vp8dx.h"
-+#include "vpx/vpx_decoder.h"
-+#include "vpx/vp8dx.h"
- #define interface (&vpx_codec_vp8_dx_algo)
--#endif
- @EXTRA_INCLUDES
-
-
-diff --git a/examples/decoder_tmpl.txt b/examples/decoder_tmpl.txt
-index 3287d50..6da38c2 100644
---- a/examples/decoder_tmpl.txt
-+++ b/examples/decoder_tmpl.txt
-@@ -1,7 +1,7 @@
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INCLUDES
- #define VPX_CODEC_DISABLE_COMPAT 1
--#include "vpx_decoder.h"
--#include "vp8dx.h"
-+#include "vpx/vpx_decoder.h"
-+#include "vpx/vp8dx.h"
- #define interface (&vpx_codec_vp8_dx_algo)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DEC_INCLUDES
-
-diff --git a/examples/encoder_tmpl.c b/examples/encoder_tmpl.c
-index 2df893a..9e262e9 100644
---- a/examples/encoder_tmpl.c
-+++ b/examples/encoder_tmpl.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -16,12 +17,10 @@
- #include <stdarg.h>
- #include <string.h>
- #define VPX_CODEC_DISABLE_COMPAT 1
--#include "vpx_encoder.h"
--#if CONFIG_VP8_ENCODER && !defined(interface)
--#include "vp8cx.h"
-+#include "vpx/vpx_encoder.h"
-+#include "vpx/vp8cx.h"
- #define interface (&vpx_codec_vp8_cx_algo)
- #define fourcc 0x30385056
--#endif
- @EXTRA_INCLUDES
-
- #define IVF_FILE_HDR_SZ (32)
-@@ -129,7 +128,7 @@ int main(int argc, char **argv) {
- height = strtol(argv[2], NULL, 0);
- if(width < 16 || width%2 || height <16 || height%2)
- die("Invalid resolution: %ldx%ld", width, height);
-- if(!vpx_img_alloc(&raw, IMG_FMT_YV12, width, height, 1))
-+ if(!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, width, height, 1))
- die("Faile to allocate image", width, height);
- if(!(outfile = fopen(argv[4], "wb")))
- die("Failed to open %s for writing", argv[4]);
-diff --git a/examples/encoder_tmpl.txt b/examples/encoder_tmpl.txt
-index db1ea77..87055ca 100644
---- a/examples/encoder_tmpl.txt
-+++ b/examples/encoder_tmpl.txt
-@@ -1,7 +1,7 @@
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INCLUDES
- #define VPX_CODEC_DISABLE_COMPAT 1
--#include "vpx_encoder.h"
--#include "vp8cx.h"
-+#include "vpx/vpx_encoder.h"
-+#include "vpx/vp8cx.h"
- #define interface (&vpx_codec_vp8_cx_algo)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ENC_INCLUDES
-
-diff --git a/examples/gen_example_code.sh b/examples/gen_example_code.sh
-index f2e45c5..dc7ad72 100755
---- a/examples/gen_example_code.sh
-+++ b/examples/gen_example_code.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/examples/gen_example_doxy.php b/examples/gen_example_doxy.php
-index 08beade..ba2617f 100755
---- a/examples/gen_example_doxy.php
-+++ b/examples/gen_example_doxy.php
-@@ -2,10 +2,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/examples/gen_example_text.sh b/examples/gen_example_text.sh
-index 0e1f796..fcc73d8 100755
---- a/examples/gen_example_text.sh
-+++ b/examples/gen_example_text.sh
-@@ -2,10 +2,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --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
-deleted file mode 100644
-index b0ed7c9..0000000
---- a/examples/includes/PHP-Markdown-Extra-1.2.3/markdown.php.orig
-+++ /dev/null
-@@ -1,2909 +0,0 @@
--<?php
--#
--# Markdown Extra - A text-to-HTML conversion tool for web writers
--#
--# PHP Markdown & Extra
--# Copyright (c) 2004-2008 Michel Fortin
--# <http://www.michelf.com/projects/php-markdown/>
--#
--# Original Markdown
--# Copyright (c) 2004-2006 John Gruber
--# <http://daringfireball.net/projects/markdown/>
--#
--
--
--define( 'MARKDOWN_VERSION', "1.0.1m" ); # Sat 21 Jun 2008
--define( 'MARKDOWNEXTRA_VERSION', "1.2.3" ); # Wed 31 Dec 2008
--
--
--#
--# Global default settings:
--#
--
--# Change to ">" for HTML output
--@define( 'MARKDOWN_EMPTY_ELEMENT_SUFFIX', " />");
--
--# Define the width of a tab for code blocks.
--@define( 'MARKDOWN_TAB_WIDTH', 4 );
--
--# Optional title attribute for footnote links and backlinks.
--@define( 'MARKDOWN_FN_LINK_TITLE', "" );
--@define( 'MARKDOWN_FN_BACKLINK_TITLE', "" );
--
--# Optional class attribute for footnote links and backlinks.
--@define( 'MARKDOWN_FN_LINK_CLASS', "" );
--@define( 'MARKDOWN_FN_BACKLINK_CLASS', "" );
--
--
--#
--# WordPress settings:
--#
--
--# Change to false to remove Markdown from posts and/or comments.
--@define( 'MARKDOWN_WP_POSTS', true );
--@define( 'MARKDOWN_WP_COMMENTS', true );
--
--
--
--### Standard Function Interface ###
--
--@define( 'MARKDOWN_PARSER_CLASS', 'MarkdownExtra_Parser' );
--
--function Markdown($text) {
--#
--# Initialize the parser and return the result of its transform method.
--#
-- # Setup static parser variable.
-- static $parser;
-- if (!isset($parser)) {
-- $parser_class = MARKDOWN_PARSER_CLASS;
-- $parser = new $parser_class;
-- }
--
-- # Transform text using parser.
-- return $parser->transform($text);
--}
--
--
--### WordPress Plugin Interface ###
--
--/*
--Plugin Name: Markdown Extra
--Plugin URI: http://www.michelf.com/projects/php-markdown/
--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>
--Version: 1.2.2
--Author: Michel Fortin
--Author URI: http://www.michelf.com/
--*/
--
--if (isset($wp_version)) {
-- # More details about how it works here:
-- # <http://www.michelf.com/weblog/2005/wordpress-text-flow-vs-markdown/>
--
-- # Post content and excerpts
-- # - Remove WordPress paragraph generator.
-- # - Run Markdown on excerpt, then remove all tags.
-- # - Add paragraph tag around the excerpt, but remove it for the excerpt rss.
-- if (MARKDOWN_WP_POSTS) {
-- remove_filter('the_content', 'wpautop');
-- remove_filter('the_content_rss', 'wpautop');
-- remove_filter('the_excerpt', 'wpautop');
-- add_filter('the_content', 'mdwp_MarkdownPost', 6);
-- add_filter('the_content_rss', 'mdwp_MarkdownPost', 6);
-- add_filter('get_the_excerpt', 'mdwp_MarkdownPost', 6);
-- add_filter('get_the_excerpt', 'trim', 7);
-- add_filter('the_excerpt', 'mdwp_add_p');
-- add_filter('the_excerpt_rss', 'mdwp_strip_p');
--
-- remove_filter('content_save_pre', 'balanceTags', 50);
-- remove_filter('excerpt_save_pre', 'balanceTags', 50);
-- add_filter('the_content', 'balanceTags', 50);
-- add_filter('get_the_excerpt', 'balanceTags', 9);
-- }
--
-- # Add a footnote id prefix to posts when inside a loop.
-- function mdwp_MarkdownPost($text) {
-- static $parser;
-- if (!$parser) {
-- $parser_class = MARKDOWN_PARSER_CLASS;
-- $parser = new $parser_class;
-- }
-- if (is_single() || is_page() || is_feed()) {
-- $parser->fn_id_prefix = "";
-- } else {
-- $parser->fn_id_prefix = get_the_ID() . ".";
-- }
-- return $parser->transform($text);
-- }
--
-- # Comments
-- # - Remove WordPress paragraph generator.
-- # - Remove WordPress auto-link generator.
-- # - Scramble important tags before passing them to the kses filter.
-- # - Run Markdown on excerpt then remove paragraph tags.
-- if (MARKDOWN_WP_COMMENTS) {
-- remove_filter('comment_text', 'wpautop', 30);
-- remove_filter('comment_text', 'make_clickable');
-- add_filter('pre_comment_content', 'Markdown', 6);
-- add_filter('pre_comment_content', 'mdwp_hide_tags', 8);
-- add_filter('pre_comment_content', 'mdwp_show_tags', 12);
-- add_filter('get_comment_text', 'Markdown', 6);
-- add_filter('get_comment_excerpt', 'Markdown', 6);
-- add_filter('get_comment_excerpt', 'mdwp_strip_p', 7);
--
-- global $mdwp_hidden_tags, $mdwp_placeholders;
-- $mdwp_hidden_tags = explode(' ',
-- '<p> </p> <pre> </pre> <ol> </ol> <ul> </ul> <li> </li>');
-- $mdwp_placeholders = explode(' ', str_rot13(
-- 'pEj07ZbbBZ U1kqgh4w4p pre2zmeN6K QTi31t9pre ol0MP1jzJR '.
-- 'ML5IjmbRol ulANi1NsGY J7zRLJqPul liA8ctl16T K9nhooUHli'));
-- }
--
-- function mdwp_add_p($text) {
-- if (!preg_match('{^$|^<(p|ul|ol|dl|pre|blockquote)>}i', $text)) {
-- $text = '<p>'.$text.'</p>';
-- $text = preg_replace('{\n{2,}}', "</p>\n\n<p>", $text);
-- }
-- return $text;
-- }
--
-- function mdwp_strip_p($t) { return preg_replace('{</?p>}i', '', $t); }
--
-- function mdwp_hide_tags($text) {
-- global $mdwp_hidden_tags, $mdwp_placeholders;
-- return str_replace($mdwp_hidden_tags, $mdwp_placeholders, $text);
-- }
-- function mdwp_show_tags($text) {
-- global $mdwp_hidden_tags, $mdwp_placeholders;
-- return str_replace($mdwp_placeholders, $mdwp_hidden_tags, $text);
-- }
--}
--
--
--### bBlog Plugin Info ###
--
--function identify_modifier_markdown() {
-- return array(
-- 'name' => 'markdown',
-- 'type' => 'modifier',
-- 'nicename' => 'PHP Markdown Extra',
-- 'description' => 'A text-to-HTML conversion tool for web writers',
-- 'authors' => 'Michel Fortin and John Gruber',
-- 'licence' => 'GPL',
-- 'version' => MARKDOWNEXTRA_VERSION,
-- '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>',
-- );
--}
--
--
--### Smarty Modifier Interface ###
--
--function smarty_modifier_markdown($text) {
-- return Markdown($text);
--}
--
--
--### Textile Compatibility Mode ###
--
--# Rename this file to "classTextile.php" and it can replace Textile everywhere.
--
--if (strcasecmp(substr(__FILE__, -16), "classTextile.php") == 0) {
-- # Try to include PHP SmartyPants. Should be in the same directory.
-- @include_once 'smartypants.php';
-- # Fake Textile class. It calls Markdown instead.
-- class Textile {
-- function TextileThis($text, $lite='', $encode='') {
-- if ($lite == '' && $encode == '') $text = Markdown($text);
-- if (function_exists('SmartyPants')) $text = SmartyPants($text);
-- return $text;
-- }
-- # Fake restricted version: restrictions are not supported for now.
-- function TextileRestricted($text, $lite='', $noimage='') {
-- return $this->TextileThis($text, $lite);
-- }
-- # Workaround to ensure compatibility with TextPattern 4.0.3.
-- function blockLite($text) { return $text; }
-- }
--}
--
--
--
--#
--# Markdown Parser Class
--#
--
--class Markdown_Parser {
--
-- # Regex to match balanced [brackets].
-- # Needed to insert a maximum bracked depth while converting to PHP.
-- var $nested_brackets_depth = 6;
-- var $nested_brackets_re;
--
-- var $nested_url_parenthesis_depth = 4;
-- var $nested_url_parenthesis_re;
--
-- # Table of hash values for escaped characters:
-- var $escape_chars = '\`*_{}[]()>#+-.!';
-- var $escape_chars_re;
--
-- # Change to ">" for HTML output.
-- var $empty_element_suffix = MARKDOWN_EMPTY_ELEMENT_SUFFIX;
-- var $tab_width = MARKDOWN_TAB_WIDTH;
--
-- # Change to `true` to disallow markup or entities.
-- var $no_markup = false;
-- var $no_entities = true;
--
-- # Predefined urls and titles for reference links and images.
-- var $predef_urls = array();
-- var $predef_titles = array();
--
--
-- function Markdown_Parser() {
-- #
-- # Constructor function. Initialize appropriate member variables.
-- #
-- $this->_initDetab();
-- $this->prepareItalicsAndBold();
--
-- $this->nested_brackets_re =
-- str_repeat('(?>[^\[\]]+|\[', $this->nested_brackets_depth).
-- str_repeat('\])*', $this->nested_brackets_depth);
--
-- $this->nested_url_parenthesis_re =
-- str_repeat('(?>[^()\s]+|\(', $this->nested_url_parenthesis_depth).
-- str_repeat('(?>\)))*', $this->nested_url_parenthesis_depth);
--
-- $this->escape_chars_re = '['.preg_quote($this->escape_chars).']';
--
-- # Sort document, block, and span gamut in ascendent priority order.
-- asort($this->document_gamut);
-- asort($this->block_gamut);
-- asort($this->span_gamut);
-- }
--
--
-- # Internal hashes used during transformation.
-- var $urls = array();
-- var $titles = array();
-- var $html_hashes = array();
--
-- # Status flag to avoid invalid nesting.
-- var $in_anchor = false;
--
--
-- function setup() {
-- #
-- # Called before the transformation process starts to setup parser
-- # states.
-- #
-- # Clear global hashes.
-- $this->urls = $this->predef_urls;
-- $this->titles = $this->predef_titles;
-- $this->html_hashes = array();
--
-- $in_anchor = false;
-- }
--
-- function teardown() {
-- #
-- # Called after the transformation process to clear any variable
-- # which may be taking up memory unnecessarly.
-- #
-- $this->urls = array();
-- $this->titles = array();
-- $this->html_hashes = array();
-- }
--
--
-- function transform($text) {
-- #
-- # Main function. Performs some preprocessing on the input text
-- # and pass it through the document gamut.
-- #
-- $this->setup();
--
-- # Remove UTF-8 BOM and marker character in input, if present.
-- $text = preg_replace('{^\xEF\xBB\xBF|\x1A}', '', $text);
--
-- # Standardize line endings:
-- # DOS to Unix and Mac to Unix
-- $text = preg_replace('{\r\n?}', "\n", $text);
--
-- # Make sure $text ends with a couple of newlines:
-- $text .= "\n\n";
--
-- # Convert all tabs to spaces.
-- $text = $this->detab($text);
--
-- # Turn block-level HTML blocks into hash entries
-- $text = $this->hashHTMLBlocks($text);
--
-- # Strip any lines consisting only of spaces and tabs.
-- # This makes subsequent regexen easier to write, because we can
-- # match consecutive blank lines with /\n+/ instead of something
-- # contorted like /[ ]*\n+/ .
-- $text = preg_replace('/^[ ]+$/m', '', $text);
--
-- # Run document gamut methods.
-- foreach ($this->document_gamut as $method => $priority) {
-- $text = $this->$method($text);
-- }
--
-- $this->teardown();
--
-- return $text . "\n";
-- }
--
-- var $document_gamut = array(
-- # Strip link definitions, store in hashes.
-- "stripLinkDefinitions" => 20,
--
-- "runBasicBlockGamut" => 30,
-- );
--
--
-- function stripLinkDefinitions($text) {
-- #
-- # Strips link definitions from text, stores the URLs and titles in
-- # hash references.
-- #
-- $less_than_tab = $this->tab_width - 1;
--
-- # Link defs are in the form: ^[id]: url "optional title"
-- $text = preg_replace_callback('{
-- ^[ ]{0,'.$less_than_tab.'}\[(.+)\][ ]?: # id = $1
-- [ ]*
-- \n? # maybe *one* newline
-- [ ]*
-- <?(\S+?)>? # url = $2
-- [ ]*
-- \n? # maybe one newline
-- [ ]*
-- (?:
-- (?<=\s) # lookbehind for whitespace
-- ["(]
-- (.*?) # title = $3
-- [")]
-- [ ]*
-- )? # title is optional
-- (?:\n+|\Z)
-- }xm',
-- array(&$this, '_stripLinkDefinitions_callback'),
-- $text);
-- return $text;
-- }
-- function _stripLinkDefinitions_callback($matches) {
-- $link_id = strtolower($matches[1]);
-- $this->urls[$link_id] = $matches[2];
-- $this->titles[$link_id] =& $matches[3];
-- return ''; # String that will replace the block
-- }
--
--
-- function hashHTMLBlocks($text) {
-- if ($this->no_markup) return $text;
--
-- $less_than_tab = $this->tab_width - 1;
--
-- # Hashify HTML blocks:
-- # We only want to do this for block-level HTML tags, such as headers,
-- # lists, and tables. That's because we still want to wrap <p>s around
-- # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
-- # phrase emphasis, and spans. The list of tags we're looking for is
-- # hard-coded:
-- #
-- # * List "a" is made of tags which can be both inline or block-level.
-- # These will be treated block-level when the start tag is alone on
-- # its line, otherwise they're not matched here and will be taken as
-- # inline later.
-- # * List "b" is made of tags which are always block-level;
-- #
-- $block_tags_a_re = 'ins|del';
-- $block_tags_b_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|'.
-- 'script|noscript|form|fieldset|iframe|math';
--
-- # Regular expression for the content of a block tag.
-- $nested_tags_level = 4;
-- $attr = '
-- (?> # optional tag attributes
-- \s # starts with whitespace
-- (?>
-- [^>"/]+ # text outside quotes
-- |
-- /+(?!>) # slash not followed by ">"
-- |
-- "[^"]*" # text inside double quotes (tolerate ">")
-- |
-- \'[^\']*\' # text inside single quotes (tolerate ">")
-- )*
-- )?
-- ';
-- $content =
-- str_repeat('
-- (?>
-- [^<]+ # content without tag
-- |
-- <\2 # nested opening tag
-- '.$attr.' # attributes
-- (?>
-- />
-- |
-- >', $nested_tags_level). # end of opening tag
-- '.*?'. # last level nested tag content
-- str_repeat('
-- </\2\s*> # closing nested tag
-- )
-- |
-- <(?!/\2\s*> # other tags with a different name
-- )
-- )*',
-- $nested_tags_level);
-- $content2 = str_replace('\2', '\3', $content);
--
-- # First, look for nested blocks, e.g.:
-- # <div>
-- # <div>
-- # tags for inner block must be indented.
-- # </div>
-- # </div>
-- #
-- # The outermost tags must start at the left margin for this to match, and
-- # the inner nested divs must be indented.
-- # We need to do this before the next, more liberal match, because the next
-- # match will start at the first `<div>` and stop at the first `</div>`.
-- $text = preg_replace_callback('{(?>
-- (?>
-- (?<=\n\n) # Starting after a blank line
-- | # or
-- \A\n? # the beginning of the doc
-- )
-- ( # save in $1
--
-- # Match from `\n<tag>` to `</tag>\n`, handling nested tags
-- # in between.
--
-- [ ]{0,'.$less_than_tab.'}
-- <('.$block_tags_b_re.')# start tag = $2
-- '.$attr.'> # attributes followed by > and \n
-- '.$content.' # content, support nesting
-- </\2> # the matching end tag
-- [ ]* # trailing spaces/tabs
-- (?=\n+|\Z) # followed by a newline or end of document
--
-- | # Special version for tags of group a.
--
-- [ ]{0,'.$less_than_tab.'}
-- <('.$block_tags_a_re.')# start tag = $3
-- '.$attr.'>[ ]*\n # attributes followed by >
-- '.$content2.' # content, support nesting
-- </\3> # the matching end tag
-- [ ]* # trailing spaces/tabs
-- (?=\n+|\Z) # followed by a newline or end of document
--
-- | # Special case just for <hr />. It was easier to make a special
-- # case than to make the other regex more complicated.
--
-- [ ]{0,'.$less_than_tab.'}
-- <(hr) # start tag = $2
-- '.$attr.' # attributes
-- /?> # the matching end tag
-- [ ]*
-- (?=\n{2,}|\Z) # followed by a blank line or end of document
--
-- | # Special case for standalone HTML comments:
--
-- [ ]{0,'.$less_than_tab.'}
-- (?s:
-- <!-- .*? -->
-- )
-- [ ]*
-- (?=\n{2,}|\Z) # followed by a blank line or end of document
--
-- | # PHP and ASP-style processor instructions (<? and <%)
--
-- [ ]{0,'.$less_than_tab.'}
-- (?s:
-- <([?%]) # $2
-- .*?
-- \2>
-- )
-- [ ]*
-- (?=\n{2,}|\Z) # followed by a blank line or end of document
--
-- )
-- )}Sxmi',
-- array(&$this, '_hashHTMLBlocks_callback'),
-- $text);
--
-- return $text;
-- }
-- function _hashHTMLBlocks_callback($matches) {
-- $text = $matches[1];
-- $key = $this->hashBlock($text);
-- return "\n\n$key\n\n";
-- }
--
--
-- function hashPart($text, $boundary = 'X') {
-- #
-- # Called whenever a tag must be hashed when a function insert an atomic
-- # element in the text stream. Passing $text to through this function gives
-- # a unique text-token which will be reverted back when calling unhash.
-- #
-- # The $boundary argument specify what character should be used to surround
-- # the token. By convension, "B" is used for block elements that needs not
-- # to be wrapped into paragraph tags at the end, ":" is used for elements
-- # that are word separators and "X" is used in the general case.
-- #
-- # Swap back any tag hash found in $text so we do not have to `unhash`
-- # multiple times at the end.
-- $text = $this->unhash($text);
--
-- # Then hash the block.
-- static $i = 0;
-- $key = "$boundary\x1A" . ++$i . $boundary;
-- $this->html_hashes[$key] = $text;
-- return $key; # String that will replace the tag.
-- }
--
--
-- function hashBlock($text) {
-- #
-- # Shortcut function for hashPart with block-level boundaries.
-- #
-- return $this->hashPart($text, 'B');
-- }
--
--
-- var $block_gamut = array(
-- #
-- # These are all the transformations that form block-level
-- # tags like paragraphs, headers, and list items.
-- #
-- "doHeaders" => 10,
-- "doHorizontalRules" => 20,
--
-- "doLists" => 40,
-- "doCodeBlocks" => 50,
-- "doBlockQuotes" => 60,
-- );
--
-- function runBlockGamut($text) {
-- #
-- # Run block gamut tranformations.
-- #
-- # We need to escape raw HTML in Markdown source before doing anything
-- # else. This need to be done for each block, and not only at the
-- # begining in the Markdown function since hashed blocks can be part of
-- # list items and could have been indented. Indented blocks would have
-- # been seen as a code block in a previous pass of hashHTMLBlocks.
-- $text = $this->hashHTMLBlocks($text);
--
-- return $this->runBasicBlockGamut($text);
-- }
--
-- function runBasicBlockGamut($text) {
-- #
-- # Run block gamut tranformations, without hashing HTML blocks. This is
-- # useful when HTML blocks are known to be already hashed, like in the first
-- # whole-document pass.
-- #
-- foreach ($this->block_gamut as $method => $priority) {
-- $text = $this->$method($text);
-- }
--
-- # Finally form paragraph and restore hashed blocks.
-- $text = $this->formParagraphs($text);
--
-- return $text;
-- }
--
--
-- function doHorizontalRules($text) {
-- # Do Horizontal Rules:
-- return preg_replace(
-- '{
-- ^[ ]{0,3} # Leading space
-- ([-*_]) # $1: First marker
-- (?> # Repeated marker group
-- [ ]{0,2} # Zero, one, or two spaces.
-- \1 # Marker character
-- ){2,} # Group repeated at least twice
-- [ ]* # Tailing spaces
-- $ # End of line.
-- }mx',
-- "\n".$this->hashBlock("<hr$this->empty_element_suffix")."\n",
-- $text);
-- }
--
--
-- var $span_gamut = array(
-- #
-- # These are all the transformations that occur *within* block-level
-- # tags like paragraphs, headers, and list items.
-- #
-- # Process character escapes, code spans, and inline HTML
-- # in one shot.
-- "parseSpan" => -30,
--
-- # Process anchor and image tags. Images must come first,
-- # because ![foo][f] looks like an anchor.
-- "doImages" => 10,
-- "doAnchors" => 20,
--
-- # Make links out of things like `<http://example.com/>`
-- # Must come after doAnchors, because you can use < and >
-- # delimiters in inline links like [this](<url>).
-- "doAutoLinks" => 30,
-- "encodeAmpsAndAngles" => 40,
--
-- "doItalicsAndBold" => 50,
-- "doHardBreaks" => 60,
-- );
--
-- function runSpanGamut($text) {
-- #
-- # Run span gamut tranformations.
-- #
-- foreach ($this->span_gamut as $method => $priority) {
-- $text = $this->$method($text);
-- }
--
-- return $text;
-- }
--
--
-- function doHardBreaks($text) {
-- # Do hard breaks:
-- return preg_replace_callback('/ {2,}\n/',
-- array(&$this, '_doHardBreaks_callback'), $text);
-- }
-- function _doHardBreaks_callback($matches) {
-- return $this->hashPart("<br$this->empty_element_suffix\n");
-- }
--
--
-- function doAnchors($text) {
-- #
-- # Turn Markdown link shortcuts into XHTML <a> tags.
-- #
-- if ($this->in_anchor) return $text;
-- $this->in_anchor = true;
--
-- #
-- # First, handle reference-style links: [link text] [id]
-- #
-- $text = preg_replace_callback('{
-- ( # wrap whole match in $1
-- \[
-- ('.$this->nested_brackets_re.') # link text = $2
-- \]
--
-- [ ]? # one optional space
-- (?:\n[ ]*)? # one optional newline followed by spaces
--
-- \[
-- (.*?) # id = $3
-- \]
-- )
-- }xs',
-- array(&$this, '_doAnchors_reference_callback'), $text);
--
-- #
-- # Next, inline-style links: [link text](url "optional title")
-- #
-- $text = preg_replace_callback('{
-- ( # wrap whole match in $1
-- \[
-- ('.$this->nested_brackets_re.') # link text = $2
-- \]
-- \( # literal paren
-- [ ]*
-- (?:
-- <(\S*)> # href = $3
-- |
-- ('.$this->nested_url_parenthesis_re.') # href = $4
-- )
-- [ ]*
-- ( # $5
-- ([\'"]) # quote char = $6
-- (.*?) # Title = $7
-- \6 # matching quote
-- [ ]* # ignore any spaces/tabs between closing quote and )
-- )? # title is optional
-- \)
-- )
-- }xs',
-- array(&$this, '_DoAnchors_inline_callback'), $text);
--
-- #
-- # Last, handle reference-style shortcuts: [link text]
-- # These must come last in case you've also got [link test][1]
-- # or [link test](/foo)
-- #
--// $text = preg_replace_callback('{
--// ( # wrap whole match in $1
--// \[
--// ([^\[\]]+) # link text = $2; can\'t contain [ or ]
--// \]
--// )
--// }xs',
--// array(&$this, '_doAnchors_reference_callback'), $text);
--
-- $this->in_anchor = false;
-- return $text;
-- }
-- function _doAnchors_reference_callback($matches) {
-- $whole_match = $matches[1];
-- $link_text = $matches[2];
-- $link_id =& $matches[3];
--
-- if ($link_id == "") {
-- # for shortcut links like [this][] or [this].
-- $link_id = $link_text;
-- }
--
-- # lower-case and turn embedded newlines into spaces
-- $link_id = strtolower($link_id);
-- $link_id = preg_replace('{[ ]?\n}', ' ', $link_id);
--
-- if (isset($this->urls[$link_id])) {
-- $url = $this->urls[$link_id];
-- $url = $this->encodeAttribute($url);
--
-- $result = "<a href=\"$url\"";
-- if ( isset( $this->titles[$link_id] ) ) {
-- $title = $this->titles[$link_id];
-- $title = $this->encodeAttribute($title);
-- $result .= " title=\"$title\"";
-- }
--
-- $link_text = $this->runSpanGamut($link_text);
-- $result .= ">$link_text</a>";
-- $result = $this->hashPart($result);
-- }
-- else {
-- $result = $whole_match;
-- }
-- return $result;
-- }
-- function _doAnchors_inline_callback($matches) {
-- $whole_match = $matches[1];
-- $link_text = $this->runSpanGamut($matches[2]);
-- $url = $matches[3] == '' ? $matches[4] : $matches[3];
-- $title =& $matches[7];
--
-- $url = $this->encodeAttribute($url);
--
-- $result = "<a href=\"$url\"";
-- if (isset($title)) {
-- $title = $this->encodeAttribute($title);
-- $result .= " title=\"$title\"";
-- }
--
-- $link_text = $this->runSpanGamut($link_text);
-- $result .= ">$link_text</a>";
--
-- return $this->hashPart($result);
-- }
--
--
-- function doImages($text) {
-- #
-- # Turn Markdown image shortcuts into <img> tags.
-- #
-- #
-- # First, handle reference-style labeled images: ![alt text][id]
-- #
-- $text = preg_replace_callback('{
-- ( # wrap whole match in $1
-- !\[
-- ('.$this->nested_brackets_re.') # alt text = $2
-- \]
--
-- [ ]? # one optional space
-- (?:\n[ ]*)? # one optional newline followed by spaces
--
-- \[
-- (.*?) # id = $3
-- \]
--
-- )
-- }xs',
-- array(&$this, '_doImages_reference_callback'), $text);
--
-- #
-- # Next, handle inline images: ![alt text](url "optional title")
-- # Don't forget: encode * and _
-- #
-- $text = preg_replace_callback('{
-- ( # wrap whole match in $1
-- !\[
-- ('.$this->nested_brackets_re.') # alt text = $2
-- \]
-- \s? # One optional whitespace character
-- \( # literal paren
-- [ ]*
-- (?:
-- <(\S*)> # src url = $3
-- |
-- ('.$this->nested_url_parenthesis_re.') # src url = $4
-- )
-- [ ]*
-- ( # $5
-- ([\'"]) # quote char = $6
-- (.*?) # title = $7
-- \6 # matching quote
-- [ ]*
-- )? # title is optional
-- \)
-- )
-- }xs',
-- array(&$this, '_doImages_inline_callback'), $text);
--
-- return $text;
-- }
-- function _doImages_reference_callback($matches) {
-- $whole_match = $matches[1];
-- $alt_text = $matches[2];
-- $link_id = strtolower($matches[3]);
--
-- if ($link_id == "") {
-- $link_id = strtolower($alt_text); # for shortcut links like ![this][].
-- }
--
-- $alt_text = $this->encodeAttribute($alt_text);
-- if (isset($this->urls[$link_id])) {
-- $url = $this->encodeAttribute($this->urls[$link_id]);
-- $result = "<img src=\"$url\" alt=\"$alt_text\"";
-- if (isset($this->titles[$link_id])) {
-- $title = $this->titles[$link_id];
-- $title = $this->encodeAttribute($title);
-- $result .= " title=\"$title\"";
-- }
-- $result .= $this->empty_element_suffix;
-- $result = $this->hashPart($result);
-- }
-- else {
-- # If there's no such link ID, leave intact:
-- $result = $whole_match;
-- }
--
-- return $result;
-- }
-- function _doImages_inline_callback($matches) {
-- $whole_match = $matches[1];
-- $alt_text = $matches[2];
-- $url = $matches[3] == '' ? $matches[4] : $matches[3];
-- $title =& $matches[7];
--
-- $alt_text = $this->encodeAttribute($alt_text);
-- $url = $this->encodeAttribute($url);
-- $result = "<img src=\"$url\" alt=\"$alt_text\"";
-- if (isset($title)) {
-- $title = $this->encodeAttribute($title);
-- $result .= " title=\"$title\""; # $title already quoted
-- }
-- $result .= $this->empty_element_suffix;
--
-- return $this->hashPart($result);
-- }
--
--
-- function doHeaders($text) {
-- # Setext-style headers:
-- # Header 1
-- # ========
-- #
-- # Header 2
-- # --------
-- #
-- $text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx',
-- array(&$this, '_doHeaders_callback_setext'), $text);
--
-- # atx-style headers:
-- # # Header 1
-- # ## Header 2
-- # ## Header 2 with closing hashes ##
-- # ...
-- # ###### Header 6
-- #
-- $text = preg_replace_callback('{
-- ^(\#{1,6}) # $1 = string of #\'s
-- [ ]*
-- (.+?) # $2 = Header text
-- [ ]*
-- \#* # optional closing #\'s (not counted)
-- \n+
-- }xm',
-- array(&$this, '_doHeaders_callback_atx'), $text);
--
-- return $text;
-- }
-- function _doHeaders_callback_setext($matches) {
-- # Terrible hack to check we haven't found an empty list item.
-- if ($matches[2] == '-' && preg_match('{^-(?: |$)}', $matches[1]))
-- return $matches[0];
--
-- $level = $matches[2]{0} == '=' ? 1 : 2;
-- $block = "<h$level>".$this->runSpanGamut($matches[1])."</h$level>";
-- return "\n" . $this->hashBlock($block) . "\n\n";
-- }
-- function _doHeaders_callback_atx($matches) {
-- $level = strlen($matches[1]);
-- $block = "<h$level>".$this->runSpanGamut($matches[2])."</h$level>";
-- return "\n" . $this->hashBlock($block) . "\n\n";
-- }
--
--
-- function doLists($text) {
-- #
-- # Form HTML ordered (numbered) and unordered (bulleted) lists.
-- #
-- $less_than_tab = $this->tab_width - 1;
--
-- # Re-usable patterns to match list item bullets and number markers:
-- $marker_ul_re = '[*+-]';
-- $marker_ol_re = '\d+[.]';
-- $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
--
-- $markers_relist = array($marker_ul_re, $marker_ol_re);
--
-- foreach ($markers_relist as $marker_re) {
-- # Re-usable pattern to match any entirel ul or ol list:
-- $whole_list_re = '
-- ( # $1 = whole list
-- ( # $2
-- [ ]{0,'.$less_than_tab.'}
-- ('.$marker_re.') # $3 = first list item marker
-- [ ]+
-- )
-- (?s:.+?)
-- ( # $4
-- \z
-- |
-- \n{2,}
-- (?=\S)
-- (?! # Negative lookahead for another list item marker
-- [ ]*
-- '.$marker_re.'[ ]+
-- )
-- )
-- )
-- '; // mx
--
-- # We use a different prefix before nested lists than top-level lists.
-- # See extended comment in _ProcessListItems().
--
-- if ($this->list_level) {
-- $text = preg_replace_callback('{
-- ^
-- '.$whole_list_re.'
-- }mx',
-- array(&$this, '_doLists_callback'), $text);
-- }
-- else {
-- $text = preg_replace_callback('{
-- (?:(?<=\n)\n|\A\n?) # Must eat the newline
-- '.$whole_list_re.'
-- }mx',
-- array(&$this, '_doLists_callback'), $text);
-- }
-- }
--
-- return $text;
-- }
-- function _doLists_callback($matches) {
-- # Re-usable patterns to match list item bullets and number markers:
-- $marker_ul_re = '[*+-]';
-- $marker_ol_re = '\d+[.]';
-- $marker_any_re = "(?:$marker_ul_re|$marker_ol_re)";
--
-- $list = $matches[1];
-- $list_type = preg_match("/$marker_ul_re/", $matches[3]) ? "ul" : "ol";
--
-- $marker_any_re = ( $list_type == "ul" ? $marker_ul_re : $marker_ol_re );
--
-- $list .= "\n";
-- $result = $this->processListItems($list, $marker_any_re);
--
-- $result = $this->hashBlock("<$list_type>\n" . $result . "</$list_type>");
-- return "\n". $result ."\n\n";
-- }
--
-- var $list_level = 0;
--
-- function processListItems($list_str, $marker_any_re) {
-- #
-- # Process the contents of a single ordered or unordered list, splitting it
-- # into individual list items.
-- #
-- # The $this->list_level global keeps track of when we're inside a list.
-- # Each time we enter a list, we increment it; when we leave a list,
-- # we decrement. If it's zero, we're not in a list anymore.
-- #
-- # We do this because when we're not inside a list, we want to treat
-- # something like this:
-- #
-- # I recommend upgrading to version
-- # 8. Oops, now this line is treated
-- # as a sub-list.
-- #
-- # As a single paragraph, despite the fact that the second line starts
-- # with a digit-period-space sequence.
-- #
-- # Whereas when we're inside a list (or sub-list), that line will be
-- # treated as the start of a sub-list. What a kludge, huh? This is
-- # an aspect of Markdown's syntax that's hard to parse perfectly
-- # without resorting to mind-reading. Perhaps the solution is to
-- # change the syntax rules such that sub-lists must start with a
-- # starting cardinal number; e.g. "1." or "a.".
--
-- $this->list_level++;
--
-- # trim trailing blank lines:
-- $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
--
-- $list_str = preg_replace_callback('{
-- (\n)? # leading line = $1
-- (^[ ]*) # leading whitespace = $2
-- ('.$marker_any_re.' # list marker and space = $3
-- (?:[ ]+|(?=\n)) # space only required if item is not empty
-- )
-- ((?s:.*?)) # list item text = $4
-- (?:(\n+(?=\n))|\n) # tailing blank line = $5
-- (?= \n* (\z | \2 ('.$marker_any_re.') (?:[ ]+|(?=\n))))
-- }xm',
-- array(&$this, '_processListItems_callback'), $list_str);
--
-- $this->list_level--;
-- return $list_str;
-- }
-- function _processListItems_callback($matches) {
-- $item = $matches[4];
-- $leading_line =& $matches[1];
-- $leading_space =& $matches[2];
-- $marker_space = $matches[3];
-- $tailing_blank_line =& $matches[5];
--
-- if ($leading_line || $tailing_blank_line ||
-- preg_match('/\n{2,}/', $item))
-- {
-- # Replace marker with the appropriate whitespace indentation
-- $item = $leading_space . str_repeat(' ', strlen($marker_space)) . $item;
-- $item = $this->runBlockGamut($this->outdent($item)."\n");
-- }
-- else {
-- # Recursion for sub-lists:
-- $item = $this->doLists($this->outdent($item));
-- $item = preg_replace('/\n+$/', '', $item);
-- $item = $this->runSpanGamut($item);
-- }
--
-- return "<li>" . $item . "</li>\n";
-- }
--
--
-- function doCodeBlocks($text) {
-- #
-- # Process Markdown `<pre><code>` blocks.
-- #
-- $text = preg_replace_callback('{
-- (?:\n\n|\A\n?)
-- ( # $1 = the code block -- one or more lines, starting with a space/tab
-- (?>
-- [ ]{'.$this->tab_width.'} # Lines must start with a tab or a tab-width of spaces
-- .*\n+
-- )+
-- )
-- ((?=^[ ]{0,'.$this->tab_width.'}\S)|\Z) # Lookahead for non-space at line-start, or end of doc
-- }xm',
-- array(&$this, '_doCodeBlocks_callback'), $text);
--
-- return $text;
-- }
-- function _doCodeBlocks_callback($matches) {
-- $codeblock = $matches[1];
--
-- $codeblock = $this->outdent($codeblock);
-- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
--
-- # trim leading newlines and trailing newlines
-- $codeblock = preg_replace('/\A\n+|\n+\z/', '', $codeblock);
--
-- $codeblock = "<pre><code>$codeblock\n</code></pre>";
-- return "\n\n".$this->hashBlock($codeblock)."\n\n";
-- }
--
--
-- function makeCodeSpan($code) {
-- #
-- # Create a code span markup for $code. Called from handleSpanToken.
-- #
-- $code = htmlspecialchars(trim($code), ENT_NOQUOTES);
-- return $this->hashPart("<code>$code</code>");
-- }
--
--
-- var $em_relist = array(
-- '' => '(?:(?<!\*)\*(?!\*)|(?<!_)_(?!_))(?=\S)(?![.,:;]\s)',
-- '*' => '(?<=\S)(?<!\*)\*(?!\*)',
-- '_' => '(?<=\S)(?<!_)_(?!_)',
-- );
-- var $strong_relist = array(
-- '' => '(?:(?<!\*)\*\*(?!\*)|(?<!_)__(?!_))(?=\S)(?![.,:;]\s)',
-- '**' => '(?<=\S)(?<!\*)\*\*(?!\*)',
-- '__' => '(?<=\S)(?<!_)__(?!_)',
-- );
-- var $em_strong_relist = array(
-- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<!_)___(?!_))(?=\S)(?![.,:;]\s)',
-- '***' => '(?<=\S)(?<!\*)\*\*\*(?!\*)',
-- '___' => '(?<=\S)(?<!_)___(?!_)',
-- );
-- var $em_strong_prepared_relist;
--
-- function prepareItalicsAndBold() {
-- #
-- # Prepare regular expressions for seraching emphasis tokens in any
-- # context.
-- #
-- foreach ($this->em_relist as $em => $em_re) {
-- foreach ($this->strong_relist as $strong => $strong_re) {
-- # Construct list of allowed token expressions.
-- $token_relist = array();
-- if (isset($this->em_strong_relist["$em$strong"])) {
-- $token_relist[] = $this->em_strong_relist["$em$strong"];
-- }
-- $token_relist[] = $em_re;
-- $token_relist[] = $strong_re;
--
-- # Construct master expression from list.
-- $token_re = '{('. implode('|', $token_relist) .')}';
-- $this->em_strong_prepared_relist["$em$strong"] = $token_re;
-- }
-- }
-- }
--
-- function doItalicsAndBold($text) {
-- $token_stack = array('');
-- $text_stack = array('');
-- $em = '';
-- $strong = '';
-- $tree_char_em = false;
--
-- while (1) {
-- #
-- # Get prepared regular expression for seraching emphasis tokens
-- # in current context.
-- #
-- $token_re = $this->em_strong_prepared_relist["$em$strong"];
--
-- #
-- # Each loop iteration seach for the next emphasis token.
-- # Each token is then passed to handleSpanToken.
-- #
-- $parts = preg_split($token_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
-- $text_stack[0] .= $parts[0];
-- $token =& $parts[1];
-- $text =& $parts[2];
--
-- if (empty($token)) {
-- # Reached end of text span: empty stack without emitting.
-- # any more emphasis.
-- while ($token_stack[0]) {
-- $text_stack[1] .= array_shift($token_stack);
-- $text_stack[0] .= array_shift($text_stack);
-- }
-- break;
-- }
--
-- $token_len = strlen($token);
-- if ($tree_char_em) {
-- # Reached closing marker while inside a three-char emphasis.
-- if ($token_len == 3) {
-- # Three-char closing marker, close em and strong.
-- array_shift($token_stack);
-- $span = array_shift($text_stack);
-- $span = $this->runSpanGamut($span);
-- $span = "<strong><em>$span</em></strong>";
-- $text_stack[0] .= $this->hashPart($span);
-- $em = '';
-- $strong = '';
-- } else {
-- # Other closing marker: close one em or strong and
-- # change current token state to match the other
-- $token_stack[0] = str_repeat($token{0}, 3-$token_len);
-- $tag = $token_len == 2 ? "strong" : "em";
-- $span = $text_stack[0];
-- $span = $this->runSpanGamut($span);
-- $span = "<$tag>$span</$tag>";
-- $text_stack[0] = $this->hashPart($span);
-- $$tag = ''; # $$tag stands for $em or $strong
-- }
-- $tree_char_em = false;
-- } else if ($token_len == 3) {
-- if ($em) {
-- # Reached closing marker for both em and strong.
-- # Closing strong marker:
-- for ($i = 0; $i < 2; ++$i) {
-- $shifted_token = array_shift($token_stack);
-- $tag = strlen($shifted_token) == 2 ? "strong" : "em";
-- $span = array_shift($text_stack);
-- $span = $this->runSpanGamut($span);
-- $span = "<$tag>$span</$tag>";
-- $text_stack[0] .= $this->hashPart($span);
-- $$tag = ''; # $$tag stands for $em or $strong
-- }
-- } else {
-- # Reached opening three-char emphasis marker. Push on token
-- # stack; will be handled by the special condition above.
-- $em = $token{0};
-- $strong = "$em$em";
-- array_unshift($token_stack, $token);
-- array_unshift($text_stack, '');
-- $tree_char_em = true;
-- }
-- } else if ($token_len == 2) {
-- if ($strong) {
-- # Unwind any dangling emphasis marker:
-- if (strlen($token_stack[0]) == 1) {
-- $text_stack[1] .= array_shift($token_stack);
-- $text_stack[0] .= array_shift($text_stack);
-- }
-- # Closing strong marker:
-- array_shift($token_stack);
-- $span = array_shift($text_stack);
-- $span = $this->runSpanGamut($span);
-- $span = "<strong>$span</strong>";
-- $text_stack[0] .= $this->hashPart($span);
-- $strong = '';
-- } else {
-- array_unshift($token_stack, $token);
-- array_unshift($text_stack, '');
-- $strong = $token;
-- }
-- } else {
-- # Here $token_len == 1
-- if ($em) {
-- if (strlen($token_stack[0]) == 1) {
-- # Closing emphasis marker:
-- array_shift($token_stack);
-- $span = array_shift($text_stack);
-- $span = $this->runSpanGamut($span);
-- $span = "<em>$span</em>";
-- $text_stack[0] .= $this->hashPart($span);
-- $em = '';
-- } else {
-- $text_stack[0] .= $token;
-- }
-- } else {
-- array_unshift($token_stack, $token);
-- array_unshift($text_stack, '');
-- $em = $token;
-- }
-- }
-- }
-- return $text_stack[0];
-- }
--
--
-- function doBlockQuotes($text) {
-- $text = preg_replace_callback('/
-- ( # Wrap whole match in $1
-- (?>
-- ^[ ]*>[ ]? # ">" at the start of a line
-- .+\n # rest of the first line
-- (.+\n)* # subsequent consecutive lines
-- \n* # blanks
-- )+
-- )
-- /xm',
-- array(&$this, '_doBlockQuotes_callback'), $text);
--
-- return $text;
-- }
-- function _doBlockQuotes_callback($matches) {
-- $bq = $matches[1];
-- # trim one level of quoting - trim whitespace-only lines
-- $bq = preg_replace('/^[ ]*>[ ]?|^[ ]+$/m', '', $bq);
-- $bq = $this->runBlockGamut($bq); # recurse
--
-- $bq = preg_replace('/^/m', " ", $bq);
-- # These leading spaces cause problem with <pre> content,
-- # so we need to fix that:
-- $bq = preg_replace_callback('{(\s*<pre>.+?</pre>)}sx',
-- array(&$this, '_DoBlockQuotes_callback2'), $bq);
--
-- return "\n". $this->hashBlock("<blockquote>\n$bq\n</blockquote>")."\n\n";
-- }
-- function _doBlockQuotes_callback2($matches) {
-- $pre = $matches[1];
-- $pre = preg_replace('/^ /m', '', $pre);
-- return $pre;
-- }
--
--
-- function formParagraphs($text) {
-- #
-- # Params:
-- # $text - string to process with html <p> tags
-- #
-- # Strip leading and trailing lines:
-- $text = preg_replace('/\A\n+|\n+\z/', '', $text);
--
-- $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
--
-- #
-- # Wrap <p> tags and unhashify HTML blocks
-- #
-- foreach ($grafs as $key => $value) {
-- if (!preg_match('/^B\x1A[0-9]+B$/', $value)) {
-- # Is a paragraph.
-- $value = $this->runSpanGamut($value);
-- $value = preg_replace('/^([ ]*)/', "<p>", $value);
-- $value .= "</p>";
-- $grafs[$key] = $this->unhash($value);
-- }
-- else {
-- # Is a block.
-- # Modify elements of @grafs in-place...
-- $graf = $value;
-- $block = $this->html_hashes[$graf];
-- $graf = $block;
--// if (preg_match('{
--// \A
--// ( # $1 = <div> tag
--// <div \s+
--// [^>]*
--// \b
--// markdown\s*=\s* ([\'"]) # $2 = attr quote char
--// 1
--// \2
--// [^>]*
--// >
--// )
--// ( # $3 = contents
--// .*
--// )
--// (</div>) # $4 = closing tag
--// \z
--// }xs', $block, $matches))
--// {
--// list(, $div_open, , $div_content, $div_close) = $matches;
--//
--// # We can't call Markdown(), because that resets the hash;
--// # that initialization code should be pulled into its own sub, though.
--// $div_content = $this->hashHTMLBlocks($div_content);
--//
--// # Run document gamut methods on the content.
--// foreach ($this->document_gamut as $method => $priority) {
--// $div_content = $this->$method($div_content);
--// }
--//
--// $div_open = preg_replace(
--// '{\smarkdown\s*=\s*([\'"]).+?\1}', '', $div_open);
--//
--// $graf = $div_open . "\n" . $div_content . "\n" . $div_close;
--// }
-- $grafs[$key] = $graf;
-- }
-- }
--
-- return implode("\n\n", $grafs);
-- }
--
--
-- function encodeAttribute($text) {
-- #
-- # Encode text for a double-quoted HTML attribute. This function
-- # is *not* suitable for attributes enclosed in single quotes.
-- #
-- $text = $this->encodeAmpsAndAngles($text);
-- $text = str_replace('"', '&quot;', $text);
-- return $text;
-- }
--
--
-- function encodeAmpsAndAngles($text) {
-- #
-- # Smart processing for ampersands and angle brackets that need to
-- # be encoded. Valid character entities are left alone unless the
-- # no-entities mode is set.
-- #
-- if ($this->no_entities) {
-- $text = str_replace('&', '&amp;', $text);
-- } else {
-- # Ampersand-encoding based entirely on Nat Irons's Amputator
-- # MT plugin: <http://bumppo.net/projects/amputator/>
-- $text = preg_replace('/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/',
-- '&amp;', $text);;
-- }
-- # Encode remaining <'s
-- $text = str_replace('<', '&lt;', $text);
--
-- return $text;
-- }
--
--
-- function doAutoLinks($text) {
-- $text = preg_replace_callback('{<((https?|ftp|dict):[^\'">\s]+)>}i',
-- array(&$this, '_doAutoLinks_url_callback'), $text);
--
-- # Email addresses: <address@domain.foo>
-- $text = preg_replace_callback('{
-- <
-- (?:mailto:)?
-- (
-- [-.\w\x80-\xFF]+
-- \@
-- [-a-z0-9\x80-\xFF]+(\.[-a-z0-9\x80-\xFF]+)*\.[a-z]+
-- )
-- >
-- }xi',
-- array(&$this, '_doAutoLinks_email_callback'), $text);
--
-- return $text;
-- }
-- function _doAutoLinks_url_callback($matches) {
-- $url = $this->encodeAttribute($matches[1]);
-- $link = "<a href=\"$url\">$url</a>";
-- return $this->hashPart($link);
-- }
-- function _doAutoLinks_email_callback($matches) {
-- $address = $matches[1];
-- $link = $this->encodeEmailAddress($address);
-- return $this->hashPart($link);
-- }
--
--
-- function encodeEmailAddress($addr) {
-- #
-- # Input: an email address, e.g. "foo@example.com"
-- #
-- # Output: the email address as a mailto link, with each character
-- # of the address encoded as either a decimal or hex entity, in
-- # the hopes of foiling most address harvesting spam bots. E.g.:
-- #
-- # <p><a href="&#109;&#x61;&#105;&#x6c;&#116;&#x6f;&#58;&#x66;o&#111;
-- # &#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;&#101;&#46;&#x63;&#111;
-- # &#x6d;">&#x66;o&#111;&#x40;&#101;&#x78;&#97;&#x6d;&#112;&#x6c;
-- # &#101;&#46;&#x63;&#111;&#x6d;</a></p>
-- #
-- # Based by a filter by Matthew Wickline, posted to BBEdit-Talk.
-- # With some optimizations by Milian Wolff.
-- #
-- $addr = "mailto:" . $addr;
-- $chars = preg_split('/(?<!^)(?!$)/', $addr);
-- $seed = (int)abs(crc32($addr) / strlen($addr)); # Deterministic seed.
--
-- foreach ($chars as $key => $char) {
-- $ord = ord($char);
-- # Ignore non-ascii chars.
-- if ($ord < 128) {
-- $r = ($seed * (1 + $key)) % 100; # Pseudo-random function.
-- # roughly 10% raw, 45% hex, 45% dec
-- # '@' *must* be encoded. I insist.
-- if ($r > 90 && $char != '@') /* do nothing */;
-- else if ($r < 45) $chars[$key] = '&#x'.dechex($ord).';';
-- else $chars[$key] = '&#'.$ord.';';
-- }
-- }
--
-- $addr = implode('', $chars);
-- $text = implode('', array_slice($chars, 7)); # text without `mailto:`
-- $addr = "<a href=\"$addr\">$text</a>";
--
-- return $addr;
-- }
--
--
-- function parseSpan($str) {
-- #
-- # Take the string $str and parse it into tokens, hashing embeded HTML,
-- # escaped characters and handling code spans.
-- #
-- $output = '';
--
-- $span_re = '{
-- (
-- \\\\'.$this->escape_chars_re.'
-- |
-- (?<![`\\\\])
-- `+ # code span marker
-- '.( $this->no_markup ? '' : '
-- |
-- <!-- .*? --> # comment
-- |
-- <\?.*?\?> | <%.*?%> # processing instruction
-- |
-- <[/!$]?[-a-zA-Z0-9:]+ # regular tags
-- (?>
-- \s
-- (?>[^"\'>]+|"[^"]*"|\'[^\']*\')*
-- )?
-- >
-- ').'
-- )
-- }xs';
--
-- while (1) {
-- #
-- # Each loop iteration seach for either the next tag, the next
-- # openning code span marker, or the next escaped character.
-- # Each token is then passed to handleSpanToken.
-- #
-- $parts = preg_split($span_re, $str, 2, PREG_SPLIT_DELIM_CAPTURE);
--
-- # Create token from text preceding tag.
-- if ($parts[0] != "") {
-- $output .= $parts[0];
-- }
--
-- # Check if we reach the end.
-- if (isset($parts[1])) {
-- $output .= $this->handleSpanToken($parts[1], $parts[2]);
-- $str = $parts[2];
-- }
-- else {
-- break;
-- }
-- }
--
-- return $output;
-- }
--
--
-- function handleSpanToken($token, &$str) {
-- #
-- # Handle $token provided by parseSpan by determining its nature and
-- # returning the corresponding value that should replace it.
-- #
-- switch ($token{0}) {
-- case "\\":
-- return $this->hashPart("&#". ord($token{1}). ";");
-- case "`":
-- # Search for end marker in remaining text.
-- if (preg_match('/^(.*?[^`])'.preg_quote($token).'(?!`)(.*)$/sm',
-- $str, $matches))
-- {
-- $str = $matches[2];
-- $codespan = $this->makeCodeSpan($matches[1]);
-- return $this->hashPart($codespan);
-- }
-- return $token; // return as text since no ending marker found.
-- default:
-- return $this->hashPart($token);
-- }
-- }
--
--
-- function outdent($text) {
-- #
-- # Remove one level of line-leading tabs or spaces
-- #
-- return preg_replace('/^(\t|[ ]{1,'.$this->tab_width.'})/m', '', $text);
-- }
--
--
-- # String length function for detab. `_initDetab` will create a function to
-- # hanlde UTF-8 if the default function does not exist.
-- var $utf8_strlen = 'mb_strlen';
--
-- function detab($text) {
-- #
-- # Replace tabs with the appropriate amount of space.
-- #
-- # For each line we separate the line in blocks delemited by
-- # tab characters. Then we reconstruct every line by adding the
-- # appropriate number of space between each blocks.
--
-- $text = preg_replace_callback('/^.*\t.*$/m',
-- array(&$this, '_detab_callback'), $text);
--
-- return $text;
-- }
-- function _detab_callback($matches) {
-- $line = $matches[0];
-- $strlen = $this->utf8_strlen; # strlen function for UTF-8.
--
-- # Split in blocks.
-- $blocks = explode("\t", $line);
-- # Add each blocks to the line.
-- $line = $blocks[0];
-- unset($blocks[0]); # Do not add first block twice.
-- foreach ($blocks as $block) {
-- # Calculate amount of space, insert spaces, insert block.
-- $amount = $this->tab_width -
-- $strlen($line, 'UTF-8') % $this->tab_width;
-- $line .= str_repeat(" ", $amount) . $block;
-- }
-- return $line;
-- }
-- function _initDetab() {
-- #
-- # Check for the availability of the function in the `utf8_strlen` property
-- # (initially `mb_strlen`). If the function is not available, create a
-- # function that will loosely count the number of UTF-8 characters with a
-- # regular expression.
-- #
-- if (function_exists($this->utf8_strlen)) return;
-- $this->utf8_strlen = create_function('$text', 'return preg_match_all(
-- "/[\\\\x00-\\\\xBF]|[\\\\xC0-\\\\xFF][\\\\x80-\\\\xBF]*/",
-- $text, $m);');
-- }
--
--
-- function unhash($text) {
-- #
-- # Swap back in all the tags hashed by _HashHTMLBlocks.
-- #
-- return preg_replace_callback('/(.)\x1A[0-9]+\1/',
-- array(&$this, '_unhash_callback'), $text);
-- }
-- function _unhash_callback($matches) {
-- return $this->html_hashes[$matches[0]];
-- }
--
--}
--
--
--#
--# Markdown Extra Parser Class
--#
--
--class MarkdownExtra_Parser extends Markdown_Parser {
--
-- # Prefix for footnote ids.
-- var $fn_id_prefix = "";
--
-- # Optional title attribute for footnote links and backlinks.
-- var $fn_link_title = MARKDOWN_FN_LINK_TITLE;
-- var $fn_backlink_title = MARKDOWN_FN_BACKLINK_TITLE;
--
-- # Optional class attribute for footnote links and backlinks.
-- var $fn_link_class = MARKDOWN_FN_LINK_CLASS;
-- var $fn_backlink_class = MARKDOWN_FN_BACKLINK_CLASS;
--
-- # Predefined abbreviations.
-- var $predef_abbr = array();
--
--
-- function MarkdownExtra_Parser() {
-- #
-- # Constructor function. Initialize the parser object.
-- #
-- # Add extra escapable characters before parent constructor
-- # initialize the table.
-- $this->escape_chars .= ':|';
--
-- # Insert extra document, block, and span transformations.
-- # Parent constructor will do the sorting.
-- $this->document_gamut += array(
-- "doFencedCodeBlocks" => 5,
-- "stripFootnotes" => 15,
-- "stripAbbreviations" => 25,
-- "appendFootnotes" => 50,
-- );
-- $this->block_gamut += array(
-- "doFencedCodeBlocks" => 5,
-- "doTables" => 15,
-- "doDefLists" => 45,
-- );
-- $this->span_gamut += array(
-- "doFootnotes" => 5,
-- "doAbbreviations" => 70,
-- );
--
-- parent::Markdown_Parser();
-- }
--
--
-- # Extra variables used during extra transformations.
-- var $footnotes = array();
-- var $footnotes_ordered = array();
-- var $abbr_desciptions = array();
-- var $abbr_word_re = '';
--
-- # Give the current footnote number.
-- var $footnote_counter = 1;
--
--
-- function setup() {
-- #
-- # Setting up Extra-specific variables.
-- #
-- parent::setup();
--
-- $this->footnotes = array();
-- $this->footnotes_ordered = array();
-- $this->abbr_desciptions = array();
-- $this->abbr_word_re = '';
-- $this->footnote_counter = 1;
--
-- foreach ($this->predef_abbr as $abbr_word => $abbr_desc) {
-- if ($this->abbr_word_re)
-- $this->abbr_word_re .= '|';
-- $this->abbr_word_re .= preg_quote($abbr_word);
-- $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
-- }
-- }
--
-- function teardown() {
-- #
-- # Clearing Extra-specific variables.
-- #
-- $this->footnotes = array();
-- $this->footnotes_ordered = array();
-- $this->abbr_desciptions = array();
-- $this->abbr_word_re = '';
--
-- parent::teardown();
-- }
--
--
-- ### HTML Block Parser ###
--
-- # Tags that are always treated as block tags:
-- var $block_tags_re = 'p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend';
--
-- # Tags treated as block tags only if the opening tag is alone on it's line:
-- var $context_block_tags_re = 'script|noscript|math|ins|del';
--
-- # Tags where markdown="1" default to span mode:
-- var $contain_span_tags_re = 'p|h[1-6]|li|dd|dt|td|th|legend|address';
--
-- # Tags which must not have their contents modified, no matter where
-- # they appear:
-- var $clean_tags_re = 'script|math';
--
-- # Tags that do not need to be closed.
-- var $auto_close_tags_re = 'hr|img';
--
--
-- function hashHTMLBlocks($text) {
-- #
-- # Hashify HTML Blocks and "clean tags".
-- #
-- # We only want to do this for block-level HTML tags, such as headers,
-- # lists, and tables. That's because we still want to wrap <p>s around
-- # "paragraphs" that are wrapped in non-block-level tags, such as anchors,
-- # phrase emphasis, and spans. The list of tags we're looking for is
-- # hard-coded.
-- #
-- # This works by calling _HashHTMLBlocks_InMarkdown, which then calls
-- # _HashHTMLBlocks_InHTML when it encounter block tags. When the markdown="1"
-- # attribute is found whitin a tag, _HashHTMLBlocks_InHTML calls back
-- # _HashHTMLBlocks_InMarkdown to handle the Markdown syntax within the tag.
-- # These two functions are calling each other. It's recursive!
-- #
-- #
-- # Call the HTML-in-Markdown hasher.
-- #
-- list($text, ) = $this->_hashHTMLBlocks_inMarkdown($text);
--
-- return $text;
-- }
-- function _hashHTMLBlocks_inMarkdown($text, $indent = 0,
-- $enclosing_tag_re = '', $span = false)
-- {
-- #
-- # Parse markdown text, calling _HashHTMLBlocks_InHTML for block tags.
-- #
-- # * $indent is the number of space to be ignored when checking for code
-- # blocks. This is important because if we don't take the indent into
-- # account, something like this (which looks right) won't work as expected:
-- #
-- # <div>
-- # <div markdown="1">
-- # Hello World. <-- Is this a Markdown code block or text?
-- # </div> <-- Is this a Markdown code block or a real tag?
-- # <div>
-- #
-- # If you don't like this, just don't indent the tag on which
-- # you apply the markdown="1" attribute.
-- #
-- # * If $enclosing_tag_re is not empty, stops at the first unmatched closing
-- # tag with that name. Nested tags supported.
-- #
-- # * If $span is true, text inside must treated as span. So any double
-- # newline will be replaced by a single newline so that it does not create
-- # paragraphs.
-- #
-- # Returns an array of that form: ( processed text , remaining text )
-- #
-- if ($text === '') return array('', '');
--
-- # Regex to check for the presense of newlines around a block tag.
-- $newline_before_re = '/(?:^\n?|\n\n)*$/';
-- $newline_after_re =
-- '{
-- ^ # Start of text following the tag.
-- (?>[ ]*<!--.*?-->)? # Optional comment.
-- [ ]*\n # Must be followed by newline.
-- }xs';
--
-- # Regex to match any tag.
-- $block_tag_re =
-- '{
-- ( # $2: Capture hole tag.
-- </? # Any opening or closing tag.
-- (?> # Tag name.
-- '.$this->block_tags_re.' |
-- '.$this->context_block_tags_re.' |
-- '.$this->clean_tags_re.' |
-- (?!\s)'.$enclosing_tag_re.'
-- )
-- (?:
-- (?=[\s"\'/a-zA-Z0-9]) # Allowed characters after tag name.
-- (?>
-- ".*?" | # Double quotes (can contain `>`)
-- \'.*?\' | # Single quotes (can contain `>`)
-- .+? # Anything but quotes and `>`.
-- )*?
-- )?
-- > # End of tag.
-- |
-- <!-- .*? --> # HTML Comment
-- |
-- <\?.*?\?> | <%.*?%> # Processing instruction
-- |
-- <!\[CDATA\[.*?\]\]> # CData Block
-- |
-- # Code span marker
-- `+
-- '. ( !$span ? ' # If not in span.
-- |
-- # Indented code block
-- (?> ^[ ]*\n? | \n[ ]*\n )
-- [ ]{'.($indent+4).'}[^\n]* \n
-- (?>
-- (?: [ ]{'.($indent+4).'}[^\n]* | [ ]* ) \n
-- )*
-- |
-- # Fenced code block marker
-- (?> ^ | \n )
-- [ ]{'.($indent).'}~~~+[ ]*\n
-- ' : '' ). ' # End (if not is span).
-- )
-- }xs';
--
--
-- $depth = 0; # Current depth inside the tag tree.
-- $parsed = ""; # Parsed text that will be returned.
--
-- #
-- # Loop through every tag until we find the closing tag of the parent
-- # or loop until reaching the end of text if no parent tag specified.
-- #
-- do {
-- #
-- # Split the text using the first $tag_match pattern found.
-- # Text before pattern will be first in the array, text after
-- # pattern will be at the end, and between will be any catches made
-- # by the pattern.
-- #
-- $parts = preg_split($block_tag_re, $text, 2,
-- PREG_SPLIT_DELIM_CAPTURE);
--
-- # If in Markdown span mode, add a empty-string span-level hash
-- # after each newline to prevent triggering any block element.
-- if ($span) {
-- $void = $this->hashPart("", ':');
-- $newline = "$void\n";
-- $parts[0] = $void . str_replace("\n", $newline, $parts[0]) . $void;
-- }
--
-- $parsed .= $parts[0]; # Text before current tag.
--
-- # If end of $text has been reached. Stop loop.
-- if (count($parts) < 3) {
-- $text = "";
-- break;
-- }
--
-- $tag = $parts[1]; # Tag to handle.
-- $text = $parts[2]; # Remaining text after current tag.
-- $tag_re = preg_quote($tag); # For use in a regular expression.
--
-- #
-- # Check for: Code span marker
-- #
-- if ($tag{0} == "`") {
-- # Find corresponding end marker.
-- $tag_re = preg_quote($tag);
-- if (preg_match('{^(?>.+?|\n(?!\n))*?(?<!`)'.$tag_re.'(?!`)}',
-- $text, $matches))
-- {
-- # End marker found: pass text unchanged until marker.
-- $parsed .= $tag . $matches[0];
-- $text = substr($text, strlen($matches[0]));
-- }
-- else {
-- # Unmatched marker: just skip it.
-- $parsed .= $tag;
-- }
-- }
-- #
-- # Check for: Indented code block or fenced code block marker.
-- #
-- else if ($tag{0} == "\n" || $tag{0} == "~") {
-- if ($tag{1} == "\n" || $tag{1} == " ") {
-- # Indented code block: pass it unchanged, will be handled
-- # later.
-- $parsed .= $tag;
-- }
-- else {
-- # Fenced code block marker: find matching end marker.
-- $tag_re = preg_quote(trim($tag));
-- if (preg_match('{^(?>.*\n)+?'.$tag_re.' *\n}', $text,
-- $matches))
-- {
-- # End marker found: pass text unchanged until marker.
-- $parsed .= $tag . $matches[0];
-- $text = substr($text, strlen($matches[0]));
-- }
-- else {
-- # No end marker: just skip it.
-- $parsed .= $tag;
-- }
-- }
-- }
-- #
-- # Check for: Opening Block level tag or
-- # Opening Context Block tag (like ins and del)
-- # used as a block tag (tag is alone on it's line).
-- #
-- else if (preg_match('{^<(?:'.$this->block_tags_re.')\b}', $tag) ||
-- ( preg_match('{^<(?:'.$this->context_block_tags_re.')\b}', $tag) &&
-- preg_match($newline_before_re, $parsed) &&
-- preg_match($newline_after_re, $text) )
-- )
-- {
-- # Need to parse tag and following text using the HTML parser.
-- list($block_text, $text) =
-- $this->_hashHTMLBlocks_inHTML($tag . $text, "hashBlock", true);
--
-- # Make sure it stays outside of any paragraph by adding newlines.
-- $parsed .= "\n\n$block_text\n\n";
-- }
-- #
-- # Check for: Clean tag (like script, math)
-- # HTML Comments, processing instructions.
-- #
-- else if (preg_match('{^<(?:'.$this->clean_tags_re.')\b}', $tag) ||
-- $tag{1} == '!' || $tag{1} == '?')
-- {
-- # Need to parse tag and following text using the HTML parser.
-- # (don't check for markdown attribute)
-- list($block_text, $text) =
-- $this->_hashHTMLBlocks_inHTML($tag . $text, "hashClean", false);
--
-- $parsed .= $block_text;
-- }
-- #
-- # Check for: Tag with same name as enclosing tag.
-- #
-- else if ($enclosing_tag_re !== '' &&
-- # Same name as enclosing tag.
-- preg_match('{^</?(?:'.$enclosing_tag_re.')\b}', $tag))
-- {
-- #
-- # Increase/decrease nested tag count.
-- #
-- if ($tag{1} == '/') $depth--;
-- else if ($tag{strlen($tag)-2} != '/') $depth++;
--
-- if ($depth < 0) {
-- #
-- # Going out of parent element. Clean up and break so we
-- # return to the calling function.
-- #
-- $text = $tag . $text;
-- break;
-- }
--
-- $parsed .= $tag;
-- }
-- else {
-- $parsed .= $tag;
-- }
-- } while ($depth >= 0);
--
-- return array($parsed, $text);
-- }
-- function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) {
-- #
-- # Parse HTML, calling _HashHTMLBlocks_InMarkdown for block tags.
-- #
-- # * Calls $hash_method to convert any blocks.
-- # * Stops when the first opening tag closes.
-- # * $md_attr indicate if the use of the `markdown="1"` attribute is allowed.
-- # (it is not inside clean tags)
-- #
-- # Returns an array of that form: ( processed text , remaining text )
-- #
-- if ($text === '') return array('', '');
--
-- # Regex to match `markdown` attribute inside of a tag.
-- $markdown_attr_re = '
-- {
-- \s* # Eat whitespace before the `markdown` attribute
-- markdown
-- \s*=\s*
-- (?>
-- (["\']) # $1: quote delimiter
-- (.*?) # $2: attribute value
-- \1 # matching delimiter
-- |
-- ([^\s>]*) # $3: unquoted attribute value
-- )
-- () # $4: make $3 always defined (avoid warnings)
-- }xs';
--
-- # Regex to match any tag.
-- $tag_re = '{
-- ( # $2: Capture hole tag.
-- </? # Any opening or closing tag.
-- [\w:$]+ # Tag name.
-- (?:
-- (?=[\s"\'/a-zA-Z0-9]) # Allowed characters after tag name.
-- (?>
-- ".*?" | # Double quotes (can contain `>`)
-- \'.*?\' | # Single quotes (can contain `>`)
-- .+? # Anything but quotes and `>`.
-- )*?
-- )?
-- > # End of tag.
-- |
-- <!-- .*? --> # HTML Comment
-- |
-- <\?.*?\?> | <%.*?%> # Processing instruction
-- |
-- <!\[CDATA\[.*?\]\]> # CData Block
-- )
-- }xs';
--
-- $original_text = $text; # Save original text in case of faliure.
--
-- $depth = 0; # Current depth inside the tag tree.
-- $block_text = ""; # Temporary text holder for current text.
-- $parsed = ""; # Parsed text that will be returned.
--
-- #
-- # Get the name of the starting tag.
-- # (This pattern makes $base_tag_name_re safe without quoting.)
-- #
-- if (preg_match('/^<([\w:$]*)\b/', $text, $matches))
-- $base_tag_name_re = $matches[1];
--
-- #
-- # Loop through every tag until we find the corresponding closing tag.
-- #
-- do {
-- #
-- # Split the text using the first $tag_match pattern found.
-- # Text before pattern will be first in the array, text after
-- # pattern will be at the end, and between will be any catches made
-- # by the pattern.
-- #
-- $parts = preg_split($tag_re, $text, 2, PREG_SPLIT_DELIM_CAPTURE);
--
-- if (count($parts) < 3) {
-- #
-- # End of $text reached with unbalenced tag(s).
-- # In that case, we return original text unchanged and pass the
-- # first character as filtered to prevent an infinite loop in the
-- # parent function.
-- #
-- return array($original_text{0}, substr($original_text, 1));
-- }
--
-- $block_text .= $parts[0]; # Text before current tag.
-- $tag = $parts[1]; # Tag to handle.
-- $text = $parts[2]; # Remaining text after current tag.
--
-- #
-- # Check for: Auto-close tag (like <hr/>)
-- # Comments and Processing Instructions.
-- #
-- if (preg_match('{^</?(?:'.$this->auto_close_tags_re.')\b}', $tag) ||
-- $tag{1} == '!' || $tag{1} == '?')
-- {
-- # Just add the tag to the block as if it was text.
-- $block_text .= $tag;
-- }
-- else {
-- #
-- # Increase/decrease nested tag count. Only do so if
-- # the tag's name match base tag's.
-- #
-- if (preg_match('{^</?'.$base_tag_name_re.'\b}', $tag)) {
-- if ($tag{1} == '/') $depth--;
-- else if ($tag{strlen($tag)-2} != '/') $depth++;
-- }
--
-- #
-- # Check for `markdown="1"` attribute and handle it.
-- #
-- if ($md_attr &&
-- preg_match($markdown_attr_re, $tag, $attr_m) &&
-- preg_match('/^1|block|span$/', $attr_m[2] . $attr_m[3]))
-- {
-- # Remove `markdown` attribute from opening tag.
-- $tag = preg_replace($markdown_attr_re, '', $tag);
--
-- # Check if text inside this tag must be parsed in span mode.
-- $this->mode = $attr_m[2] . $attr_m[3];
-- $span_mode = $this->mode == 'span' || $this->mode != 'block' &&
-- preg_match('{^<(?:'.$this->contain_span_tags_re.')\b}', $tag);
--
-- # Calculate indent before tag.
-- if (preg_match('/(?:^|\n)( *?)(?! ).*?$/', $block_text, $matches)) {
-- $strlen = $this->utf8_strlen;
-- $indent = $strlen($matches[1], 'UTF-8');
-- } else {
-- $indent = 0;
-- }
--
-- # End preceding block with this tag.
-- $block_text .= $tag;
-- $parsed .= $this->$hash_method($block_text);
--
-- # Get enclosing tag name for the ParseMarkdown function.
-- # (This pattern makes $tag_name_re safe without quoting.)
-- preg_match('/^<([\w:$]*)\b/', $tag, $matches);
-- $tag_name_re = $matches[1];
--
-- # Parse the content using the HTML-in-Markdown parser.
-- list ($block_text, $text)
-- = $this->_hashHTMLBlocks_inMarkdown($text, $indent,
-- $tag_name_re, $span_mode);
--
-- # Outdent markdown text.
-- if ($indent > 0) {
-- $block_text = preg_replace("/^[ ]{1,$indent}/m", "",
-- $block_text);
-- }
--
-- # Append tag content to parsed text.
-- if (!$span_mode) $parsed .= "\n\n$block_text\n\n";
-- else $parsed .= "$block_text";
--
-- # Start over a new block.
-- $block_text = "";
-- }
-- else $block_text .= $tag;
-- }
--
-- } while ($depth > 0);
--
-- #
-- # Hash last block text that wasn't processed inside the loop.
-- #
-- $parsed .= $this->$hash_method($block_text);
--
-- return array($parsed, $text);
-- }
--
--
-- function hashClean($text) {
-- #
-- # Called whenever a tag must be hashed when a function insert a "clean" tag
-- # in $text, it pass through this function and is automaticaly escaped,
-- # blocking invalid nested overlap.
-- #
-- return $this->hashPart($text, 'C');
-- }
--
--
-- function doHeaders($text) {
-- #
-- # Redefined to add id attribute support.
-- #
-- # Setext-style headers:
-- # Header 1 {#header1}
-- # ========
-- #
-- # Header 2 {#header2}
-- # --------
-- #
-- $text = preg_replace_callback(
-- '{
-- (^.+?) # $1: Header text
-- (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? # $2: Id attribute
-- [ ]*\n(=+|-+)[ ]*\n+ # $3: Header footer
-- }mx',
-- array(&$this, '_doHeaders_callback_setext'), $text);
--
-- # atx-style headers:
-- # # Header 1 {#header1}
-- # ## Header 2 {#header2}
-- # ## Header 2 with closing hashes ## {#header3}
-- # ...
-- # ###### Header 6 {#header2}
-- #
-- $text = preg_replace_callback('{
-- ^(\#{1,6}) # $1 = string of #\'s
-- [ ]*
-- (.+?) # $2 = Header text
-- [ ]*
-- \#* # optional closing #\'s (not counted)
-- (?:[ ]+\{\#([-_:a-zA-Z0-9]+)\})? # id attribute
-- [ ]*
-- \n+
-- }xm',
-- array(&$this, '_doHeaders_callback_atx'), $text);
--
-- return $text;
-- }
-- function _doHeaders_attr($attr) {
-- if (empty($attr)) return "";
-- return " id=\"$attr\"";
-- }
-- function _doHeaders_callback_setext($matches) {
-- if ($matches[3] == '-' && preg_match('{^- }', $matches[1]))
-- return $matches[0];
-- $level = $matches[3]{0} == '=' ? 1 : 2;
-- $attr = $this->_doHeaders_attr($id =& $matches[2]);
-- $block = "<h$level$attr>".$this->runSpanGamut($matches[1])."</h$level>";
-- return "\n" . $this->hashBlock($block) . "\n\n";
-- }
-- function _doHeaders_callback_atx($matches) {
-- $level = strlen($matches[1]);
-- $attr = $this->_doHeaders_attr($id =& $matches[3]);
-- $block = "<h$level$attr>".$this->runSpanGamut($matches[2])."</h$level>";
-- return "\n" . $this->hashBlock($block) . "\n\n";
-- }
--
--
-- function doTables($text) {
-- #
-- # Form HTML tables.
-- #
-- $less_than_tab = $this->tab_width - 1;
-- #
-- # Find tables with leading pipe.
-- #
-- # | Header 1 | Header 2
-- # | -------- | --------
-- # | Cell 1 | Cell 2
-- # | Cell 3 | Cell 4
-- #
-- $text = preg_replace_callback('
-- {
-- ^ # Start of a line
-- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
-- [|] # Optional leading pipe (present)
-- (.+) \n # $1: Header row (at least one pipe)
--
-- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
-- [|] ([ ]*[-:]+[-| :]*) \n # $2: Header underline
--
-- ( # $3: Cells
-- (?>
-- [ ]* # Allowed whitespace.
-- [|] .* \n # Row content.
-- )*
-- )
-- (?=\n|\Z) # Stop at final double newline.
-- }xm',
-- array(&$this, '_doTable_leadingPipe_callback'), $text);
--
-- #
-- # Find tables without leading pipe.
-- #
-- # Header 1 | Header 2
-- # -------- | --------
-- # Cell 1 | Cell 2
-- # Cell 3 | Cell 4
-- #
-- $text = preg_replace_callback('
-- {
-- ^ # Start of a line
-- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
-- (\S.*[|].*) \n # $1: Header row (at least one pipe)
--
-- [ ]{0,'.$less_than_tab.'} # Allowed whitespace.
-- ([-:]+[ ]*[|][-| :]*) \n # $2: Header underline
--
-- ( # $3: Cells
-- (?>
-- .* [|] .* \n # Row content
-- )*
-- )
-- (?=\n|\Z) # Stop at final double newline.
-- }xm',
-- array(&$this, '_DoTable_callback'), $text);
--
-- return $text;
-- }
-- function _doTable_leadingPipe_callback($matches) {
-- $head = $matches[1];
-- $underline = $matches[2];
-- $content = $matches[3];
--
-- # Remove leading pipe for each row.
-- $content = preg_replace('/^ *[|]/m', '', $content);
--
-- return $this->_doTable_callback(array($matches[0], $head, $underline, $content));
-- }
-- function _doTable_callback($matches) {
-- $head = $matches[1];
-- $underline = $matches[2];
-- $content = $matches[3];
--
-- # Remove any tailing pipes for each line.
-- $head = preg_replace('/[|] *$/m', '', $head);
-- $underline = preg_replace('/[|] *$/m', '', $underline);
-- $content = preg_replace('/[|] *$/m', '', $content);
--
-- # Reading alignement from header underline.
-- $separators = preg_split('/ *[|] */', $underline);
-- foreach ($separators as $n => $s) {
-- if (preg_match('/^ *-+: *$/', $s)) $attr[$n] = ' align="right"';
-- else if (preg_match('/^ *:-+: *$/', $s))$attr[$n] = ' align="center"';
-- else if (preg_match('/^ *:-+ *$/', $s)) $attr[$n] = ' align="left"';
-- else $attr[$n] = '';
-- }
--
-- # Parsing span elements, including code spans, character escapes,
-- # and inline HTML tags, so that pipes inside those gets ignored.
-- $head = $this->parseSpan($head);
-- $headers = preg_split('/ *[|] */', $head);
-- $col_count = count($headers);
--
-- # Write column headers.
-- $text = "<table>\n";
-- $text .= "<thead>\n";
-- $text .= "<tr>\n";
-- foreach ($headers as $n => $header)
-- $text .= " <th$attr[$n]>".$this->runSpanGamut(trim($header))."</th>\n";
-- $text .= "</tr>\n";
-- $text .= "</thead>\n";
--
-- # Split content by row.
-- $rows = explode("\n", trim($content, "\n"));
--
-- $text .= "<tbody>\n";
-- foreach ($rows as $row) {
-- # Parsing span elements, including code spans, character escapes,
-- # and inline HTML tags, so that pipes inside those gets ignored.
-- $row = $this->parseSpan($row);
--
-- # Split row by cell.
-- $row_cells = preg_split('/ *[|] */', $row, $col_count);
-- $row_cells = array_pad($row_cells, $col_count, '');
--
-- $text .= "<tr>\n";
-- foreach ($row_cells as $n => $cell)
-- $text .= " <td$attr[$n]>".$this->runSpanGamut(trim($cell))."</td>\n";
-- $text .= "</tr>\n";
-- }
-- $text .= "</tbody>\n";
-- $text .= "</table>";
--
-- return $this->hashBlock($text) . "\n";
-- }
--
--
-- function doDefLists($text) {
-- #
-- # Form HTML definition lists.
-- #
-- $less_than_tab = $this->tab_width - 1;
--
-- # Re-usable pattern to match any entire dl list:
-- $whole_list_re = '(?>
-- ( # $1 = whole list
-- ( # $2
-- [ ]{0,'.$less_than_tab.'}
-- ((?>.*\S.*\n)+) # $3 = defined term
-- \n?
-- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
-- )
-- (?s:.+?)
-- ( # $4
-- \z
-- |
-- \n{2,}
-- (?=\S)
-- (?! # Negative lookahead for another term
-- [ ]{0,'.$less_than_tab.'}
-- (?: \S.*\n )+? # defined term
-- \n?
-- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
-- )
-- (?! # Negative lookahead for another definition
-- [ ]{0,'.$less_than_tab.'}:[ ]+ # colon starting definition
-- )
-- )
-- )
-- )'; // mx
--
-- $text = preg_replace_callback('{
-- (?>\A\n?|(?<=\n\n))
-- '.$whole_list_re.'
-- }mx',
-- array(&$this, '_doDefLists_callback'), $text);
--
-- return $text;
-- }
-- function _doDefLists_callback($matches) {
-- # Re-usable patterns to match list item bullets and number markers:
-- $list = $matches[1];
--
-- # Turn double returns into triple returns, so that we can make a
-- # paragraph for the last item in a list, if necessary:
-- $result = trim($this->processDefListItems($list));
-- $result = "<dl>\n" . $result . "\n</dl>";
-- return $this->hashBlock($result) . "\n\n";
-- }
--
--
-- function processDefListItems($list_str) {
-- #
-- # Process the contents of a single definition list, splitting it
-- # into individual term and definition list items.
-- #
-- $less_than_tab = $this->tab_width - 1;
--
-- # trim trailing blank lines:
-- $list_str = preg_replace("/\n{2,}\\z/", "\n", $list_str);
--
-- # Process definition terms.
-- $list_str = preg_replace_callback('{
-- (?>\A\n?|\n\n+) # leading line
-- ( # definition terms = $1
-- [ ]{0,'.$less_than_tab.'} # leading whitespace
-- (?![:][ ]|[ ]) # negative lookahead for a definition
-- # mark (colon) or more whitespace.
-- (?> \S.* \n)+? # actual term (not whitespace).
-- )
-- (?=\n?[ ]{0,3}:[ ]) # lookahead for following line feed
-- # with a definition mark.
-- }xm',
-- array(&$this, '_processDefListItems_callback_dt'), $list_str);
--
-- # Process actual definitions.
-- $list_str = preg_replace_callback('{
-- \n(\n+)? # leading line = $1
-- ( # marker space = $2
-- [ ]{0,'.$less_than_tab.'} # whitespace before colon
-- [:][ ]+ # definition mark (colon)
-- )
-- ((?s:.+?)) # definition text = $3
-- (?= \n+ # stop at next definition mark,
-- (?: # next term or end of text
-- [ ]{0,'.$less_than_tab.'} [:][ ] |
-- <dt> | \z
-- )
-- )
-- }xm',
-- array(&$this, '_processDefListItems_callback_dd'), $list_str);
--
-- return $list_str;
-- }
-- function _processDefListItems_callback_dt($matches) {
-- $terms = explode("\n", trim($matches[1]));
-- $text = '';
-- foreach ($terms as $term) {
-- $term = $this->runSpanGamut(trim($term));
-- $text .= "\n<dt>" . $term . "</dt>";
-- }
-- return $text . "\n";
-- }
-- function _processDefListItems_callback_dd($matches) {
-- $leading_line = $matches[1];
-- $marker_space = $matches[2];
-- $def = $matches[3];
--
-- if ($leading_line || preg_match('/\n{2,}/', $def)) {
-- # Replace marker with the appropriate whitespace indentation
-- $def = str_repeat(' ', strlen($marker_space)) . $def;
-- $def = $this->runBlockGamut($this->outdent($def . "\n\n"));
-- $def = "\n". $def ."\n";
-- }
-- else {
-- $def = rtrim($def);
-- $def = $this->runSpanGamut($this->outdent($def));
-- }
--
-- return "\n<dd>" . $def . "</dd>\n";
-- }
--
--
-- function doFencedCodeBlocks($text) {
-- #
-- # Adding the fenced code block syntax to regular Markdown:
-- #
-- # ~~~
-- # Code block
-- # ~~~
-- #
-- $less_than_tab = $this->tab_width;
--
-- $text = preg_replace_callback('{
-- (?:\n|\A)
-- # 1: Opening marker
-- (
-- ~{3,} # Marker: three tilde or more.
-- )
-- [ ]* \n # Whitespace and newline following marker.
--
-- # 2: Content
-- (
-- (?>
-- (?!\1 [ ]* \n) # Not a closing marker.
-- .*\n+
-- )+
-- )
--
-- # Closing marker.
-- \1 [ ]* \n
-- }xm',
-- array(&$this, '_doFencedCodeBlocks_callback'), $text);
--
-- return $text;
-- }
-- function _doFencedCodeBlocks_callback($matches) {
-- $codeblock = $matches[2];
-- $codeblock = htmlspecialchars($codeblock, ENT_NOQUOTES);
-- $codeblock = preg_replace_callback('/^\n+/',
-- array(&$this, '_doFencedCodeBlocks_newlines'), $codeblock);
-- $codeblock = "<pre><code>$codeblock</code></pre>";
-- return "\n\n".$this->hashBlock($codeblock)."\n\n";
-- }
-- function _doFencedCodeBlocks_newlines($matches) {
-- return str_repeat("<br$this->empty_element_suffix",
-- strlen($matches[0]));
-- }
--
--
-- #
-- # Redefining emphasis markers so that emphasis by underscore does not
-- # work in the middle of a word.
-- #
-- var $em_relist = array(
-- '' => '(?:(?<!\*)\*(?!\*)|(?<![a-zA-Z0-9_])_(?!_))(?=\S)(?![.,:;]\s)',
-- '*' => '(?<=\S)(?<!\*)\*(?!\*)',
-- '_' => '(?<=\S)(?<!_)_(?![a-zA-Z0-9_])',
-- );
-- var $strong_relist = array(
-- '' => '(?:(?<!\*)\*\*(?!\*)|(?<![a-zA-Z0-9_])__(?!_))(?=\S)(?![.,:;]\s)',
-- '**' => '(?<=\S)(?<!\*)\*\*(?!\*)',
-- '__' => '(?<=\S)(?<!_)__(?![a-zA-Z0-9_])',
-- );
-- var $em_strong_relist = array(
-- '' => '(?:(?<!\*)\*\*\*(?!\*)|(?<![a-zA-Z0-9_])___(?!_))(?=\S)(?![.,:;]\s)',
-- '***' => '(?<=\S)(?<!\*)\*\*\*(?!\*)',
-- '___' => '(?<=\S)(?<!_)___(?![a-zA-Z0-9_])',
-- );
--
--
-- function formParagraphs($text) {
-- #
-- # Params:
-- # $text - string to process with html <p> tags
-- #
-- # Strip leading and trailing lines:
-- $text = preg_replace('/\A\n+|\n+\z/', '', $text);
--
-- $grafs = preg_split('/\n{2,}/', $text, -1, PREG_SPLIT_NO_EMPTY);
--
-- #
-- # Wrap <p> tags and unhashify HTML blocks
-- #
-- foreach ($grafs as $key => $value) {
-- $value = trim($this->runSpanGamut($value));
--
-- # Check if this should be enclosed in a paragraph.
-- # Clean tag hashes & block tag hashes are left alone.
-- $is_p = !preg_match('/^B\x1A[0-9]+B|^C\x1A[0-9]+C$/', $value);
--
-- if ($is_p) {
-- $value = "<p>$value</p>";
-- }
-- $grafs[$key] = $value;
-- }
--
-- # Join grafs in one text, then unhash HTML tags.
-- $text = implode("\n\n", $grafs);
--
-- # Finish by removing any tag hashes still present in $text.
-- $text = $this->unhash($text);
--
-- return $text;
-- }
--
--
-- ### Footnotes
--
-- function stripFootnotes($text) {
-- #
-- # Strips link definitions from text, stores the URLs and titles in
-- # hash references.
-- #
-- $less_than_tab = $this->tab_width - 1;
--
-- # Link defs are in the form: [^id]: url "optional title"
-- $text = preg_replace_callback('{
-- ^[ ]{0,'.$less_than_tab.'}\[\^(.+?)\][ ]?: # note_id = $1
-- [ ]*
-- \n? # maybe *one* newline
-- ( # text = $2 (no blank lines allowed)
-- (?:
-- .+ # actual text
-- |
-- \n # newlines but
-- (?!\[\^.+?\]:\s)# negative lookahead for footnote marker.
-- (?!\n+[ ]{0,3}\S)# ensure line is not blank and followed
-- # by non-indented content
-- )*
-- )
-- }xm',
-- array(&$this, '_stripFootnotes_callback'),
-- $text);
-- return $text;
-- }
-- function _stripFootnotes_callback($matches) {
-- $note_id = $this->fn_id_prefix . $matches[1];
-- $this->footnotes[$note_id] = $this->outdent($matches[2]);
-- return ''; # String that will replace the block
-- }
--
--
-- function doFootnotes($text) {
-- #
-- # Replace footnote references in $text [^id] with a special text-token
-- # which will be replaced by the actual footnote marker in appendFootnotes.
-- #
-- if (!$this->in_anchor) {
-- $text = preg_replace('{\[\^(.+?)\]}', "F\x1Afn:\\1\x1A:", $text);
-- }
-- return $text;
-- }
--
--
-- function appendFootnotes($text) {
-- #
-- # Append footnote list to text.
-- #
-- $text = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
-- array(&$this, '_appendFootnotes_callback'), $text);
--
-- if (!empty($this->footnotes_ordered)) {
-- $text .= "\n\n";
-- $text .= "<div class=\"footnotes\">\n";
-- $text .= "<hr". MARKDOWN_EMPTY_ELEMENT_SUFFIX ."\n";
-- $text .= "<ol>\n\n";
--
-- $attr = " rev=\"footnote\"";
-- if ($this->fn_backlink_class != "") {
-- $class = $this->fn_backlink_class;
-- $class = $this->encodeAttribute($class);
-- $attr .= " class=\"$class\"";
-- }
-- if ($this->fn_backlink_title != "") {
-- $title = $this->fn_backlink_title;
-- $title = $this->encodeAttribute($title);
-- $attr .= " title=\"$title\"";
-- }
-- $num = 0;
--
-- while (!empty($this->footnotes_ordered)) {
-- $footnote = reset($this->footnotes_ordered);
-- $note_id = key($this->footnotes_ordered);
-- unset($this->footnotes_ordered[$note_id]);
--
-- $footnote .= "\n"; # Need to append newline before parsing.
-- $footnote = $this->runBlockGamut("$footnote\n");
-- $footnote = preg_replace_callback('{F\x1Afn:(.*?)\x1A:}',
-- array(&$this, '_appendFootnotes_callback'), $footnote);
--
-- $attr = str_replace("%%", ++$num, $attr);
-- $note_id = $this->encodeAttribute($note_id);
--
-- # Add backlink to last paragraph; create new paragraph if needed.
-- $backlink = "<a href=\"#fnref:$note_id\"$attr>&#8617;</a>";
-- if (preg_match('{</p>$}', $footnote)) {
-- $footnote = substr($footnote, 0, -4) . "&#160;$backlink</p>";
-- } else {
-- $footnote .= "\n\n<p>$backlink</p>";
-- }
--
-- $text .= "<li id=\"fn:$note_id\">\n";
-- $text .= $footnote . "\n";
-- $text .= "</li>\n\n";
-- }
--
-- $text .= "</ol>\n";
-- $text .= "</div>";
-- }
-- return $text;
-- }
-- function _appendFootnotes_callback($matches) {
-- $node_id = $this->fn_id_prefix . $matches[1];
--
-- # Create footnote marker only if it has a corresponding footnote *and*
-- # the footnote hasn't been used by another marker.
-- if (isset($this->footnotes[$node_id])) {
-- # Transfert footnote content to the ordered list.
-- $this->footnotes_ordered[$node_id] = $this->footnotes[$node_id];
-- unset($this->footnotes[$node_id]);
--
-- $num = $this->footnote_counter++;
-- $attr = " rel=\"footnote\"";
-- if ($this->fn_link_class != "") {
-- $class = $this->fn_link_class;
-- $class = $this->encodeAttribute($class);
-- $attr .= " class=\"$class\"";
-- }
-- if ($this->fn_link_title != "") {
-- $title = $this->fn_link_title;
-- $title = $this->encodeAttribute($title);
-- $attr .= " title=\"$title\"";
-- }
--
-- $attr = str_replace("%%", $num, $attr);
-- $node_id = $this->encodeAttribute($node_id);
--
-- return
-- "<sup id=\"fnref:$node_id\">".
-- "<a href=\"#fn:$node_id\"$attr>$num</a>".
-- "</sup>";
-- }
--
-- return "[^".$matches[1]."]";
-- }
--
--
-- ### Abbreviations ###
--
-- function stripAbbreviations($text) {
-- #
-- # Strips abbreviations from text, stores titles in hash references.
-- #
-- $less_than_tab = $this->tab_width - 1;
--
-- # Link defs are in the form: [id]*: url "optional title"
-- $text = preg_replace_callback('{
-- ^[ ]{0,'.$less_than_tab.'}\*\[(.+?)\][ ]?: # abbr_id = $1
-- (.*) # text = $2 (no blank lines allowed)
-- }xm',
-- array(&$this, '_stripAbbreviations_callback'),
-- $text);
-- return $text;
-- }
-- function _stripAbbreviations_callback($matches) {
-- $abbr_word = $matches[1];
-- $abbr_desc = $matches[2];
-- if ($this->abbr_word_re)
-- $this->abbr_word_re .= '|';
-- $this->abbr_word_re .= preg_quote($abbr_word);
-- $this->abbr_desciptions[$abbr_word] = trim($abbr_desc);
-- return ''; # String that will replace the block
-- }
--
--
-- function doAbbreviations($text) {
-- #
-- # Find defined abbreviations in text and wrap them in <abbr> elements.
-- #
-- if ($this->abbr_word_re) {
-- // cannot use the /x modifier because abbr_word_re may
-- // contain significant spaces:
-- $text = preg_replace_callback('{'.
-- '(?<![\w\x1A])'.
-- '(?:'.$this->abbr_word_re.')'.
-- '(?![\w\x1A])'.
-- '}',
-- array(&$this, '_doAbbreviations_callback'), $text);
-- }
-- return $text;
-- }
-- function _doAbbreviations_callback($matches) {
-- $abbr = $matches[0];
-- if (isset($this->abbr_desciptions[$abbr])) {
-- $desc = $this->abbr_desciptions[$abbr];
-- if (empty($desc)) {
-- return $this->hashPart("<abbr>$abbr</abbr>");
-- } else {
-- $desc = $this->encodeAttribute($desc);
-- return $this->hashPart("<abbr title=\"$desc\">$abbr</abbr>");
-- }
-- } else {
-- return $matches[0];
-- }
-- }
--
--}
--
--
--/*
--
--PHP Markdown Extra
--==================
--
--Description
-------------
--
--This is a PHP port of the original Markdown formatter written in Perl
--by John Gruber. This special "Extra" version of PHP Markdown features
--further enhancements to the syntax for making additional constructs
--such as tables and definition list.
--
--Markdown is a text-to-HTML filter; it translates an easy-to-read /
--easy-to-write structured text format into HTML. Markdown's text format
--is most similar to that of plain text email, and supports features such
--as headers, *emphasis*, code blocks, blockquotes, and links.
--
--Markdown's syntax is designed not as a generic markup language, but
--specifically to serve as a front-end to (X)HTML. You can use span-level
--HTML tags anywhere in a Markdown document, and you can use block level
--HTML tags (like <div> and <table> as well).
--
--For more information about Markdown's syntax, see:
--
--<http://daringfireball.net/projects/markdown/>
--
--
--Bugs
------
--
--To file bug reports please send email to:
--
--<michel.fortin@michelf.com>
--
--Please include with your report: (1) the example input; (2) the output you
--expected; (3) the output Markdown actually produced.
--
--
--Version History
-----------------
--
--See the readme file for detailed release notes for this version.
--
--
--Copyright and License
-----------------------
--
--PHP Markdown & Extra
--Copyright (c) 2004-2008 Michel Fortin
--<http://www.michelf.com/>
--All rights reserved.
--
--Based on Markdown
--Copyright (c) 2003-2006 John Gruber
--<http://daringfireball.net/>
--All rights reserved.
--
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are
--met:
--
--* Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
--* Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
--* Neither the name "Markdown" nor the names of its contributors may
-- be used to endorse or promote products derived from this software
-- without specific prior written permission.
--
--This software is provided by the copyright holders and contributors "as
--is" and any express or implied warranties, including, but not limited
--to, the implied warranties of merchantability and fitness for a
--particular purpose are disclaimed. In no event shall the copyright owner
--or contributors be liable for any direct, indirect, incidental, special,
--exemplary, or consequential damages (including, but not limited to,
--procurement of substitute goods or services; loss of use, data, or
--profits; or business interruption) however caused and on any theory of
--liability, whether in contract, strict liability, or tort (including
--negligence or otherwise) arising in any way out of the use of this
--software, even if advised of the possibility of such damage.
--
--*/
--?>
-\ No newline at end of file
-diff --git a/ivfdec.c b/ivfdec.c
-index e4c9981..2b26d55 100644
---- a/ivfdec.c
-+++ b/ivfdec.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -17,10 +18,10 @@
- #include <string.h>
- #define VPX_CODEC_DISABLE_COMPAT 1
- #include "vpx_config.h"
--#include "vpx_decoder.h"
-+#include "vpx/vpx_decoder.h"
- #include "vpx_ports/vpx_timer.h"
- #if CONFIG_VP8_DECODER
--#include "vp8dx.h"
-+#include "vpx/vp8dx.h"
- #endif
- #if CONFIG_MD5
- #include "md5_utils.h"
-@@ -62,8 +63,10 @@ static const arg_def_t postprocarg = ARG_DEF(NULL, "postproc", 0,
- "Postprocess decoded frames");
- static const arg_def_t summaryarg = ARG_DEF(NULL, "summary", 0,
- "Show timing summary");
--static const arg_def_t outputfile = ARG_DEF("o", "output-raw-file", 1,
-+static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
- "Output raw yv12 file instead of images");
-+static const arg_def_t usey4marg = ARG_DEF("y", "y4m", 0,
-+ "Output file is YUV4MPEG2");
- static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1,
- "Max threads to use");
- static const arg_def_t quietarg = ARG_DEF("q", "quiet", 0,
-@@ -77,7 +80,7 @@ static const arg_def_t *all_args[] =
- {
- &codecarg, &prefixarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg,
- &progressarg, &limitarg, &postprocarg, &summaryarg, &outputfile,
-- &threadsarg, &quietarg,
-+ &usey4marg, &threadsarg, &quietarg,
- #if CONFIG_MD5
- &md5arg,
- #endif
-@@ -232,9 +235,9 @@ void *out_open(const char *out_fn, int do_md5)
- if (do_md5)
- {
- #if CONFIG_MD5
-- md5_ctx_t *md5_ctx = out = malloc(sizeof(md5_ctx_t));
-+ MD5Context *md5_ctx = out = malloc(sizeof(MD5Context));
- (void)out_fn;
-- md5_init(md5_ctx);
-+ MD5Init(md5_ctx);
- #endif
- }
- else
-@@ -256,7 +259,7 @@ void out_put(void *out, const uint8_t *buf, unsigned int len, int do_md5)
- if (do_md5)
- {
- #if CONFIG_MD5
-- md5_update(out, buf, len);
-+ MD5Update(out, buf, len);
- #endif
- }
- else
-@@ -273,7 +276,7 @@ void out_close(void *out, const char *out_fn, int do_md5)
- uint8_t md5[16];
- int i;
-
-- md5_finalize(out, md5);
-+ MD5Final(md5, out);
- free(out);
-
- for (i = 0; i < 16; i++)
-@@ -288,7 +291,12 @@ void out_close(void *out, const char *out_fn, int do_md5)
- }
- }
-
--unsigned int file_is_ivf(FILE *infile, unsigned int *fourcc)
-+unsigned int file_is_ivf(FILE *infile,
-+ unsigned int *fourcc,
-+ unsigned int *width,
-+ unsigned int *height,
-+ unsigned int *timebase_num,
-+ unsigned int *timebase_den)
- {
- char raw_hdr[32];
- int is_ivf = 0;
-@@ -305,6 +313,10 @@ unsigned int file_is_ivf(FILE *infile, unsigned int *fourcc)
- " decode properly.");
-
- *fourcc = mem_get_le32(raw_hdr + 8);
-+ *width = mem_get_le16(raw_hdr + 12);
-+ *height = mem_get_le16(raw_hdr + 14);
-+ *timebase_den = mem_get_le32(raw_hdr + 16);
-+ *timebase_num = mem_get_le32(raw_hdr + 20);
- }
- }
-
-@@ -330,6 +342,11 @@ int main(int argc, const char **argv_)
- struct arg arg;
- char **argv, **argi, **argj;
- const char *fn2 = 0;
-+ int use_y4m = 0;
-+ unsigned int width;
-+ unsigned int height;
-+ unsigned int timebase_num;
-+ unsigned int timebase_den;
- void *out = NULL;
- vpx_codec_dec_cfg_t cfg = {0};
- #if CONFIG_VP8_DECODER
-@@ -361,6 +378,8 @@ int main(int argc, const char **argv_)
- }
- else if (arg_match(&arg, &outputfile, argi))
- fn2 = arg.val;
-+ else if (arg_match(&arg, &usey4marg, argi))
-+ use_y4m = 1;
- else if (arg_match(&arg, &prefixarg, argi))
- prefix = strdup(arg.val);
- else if (arg_match(&arg, &use_yv12, argi))
-@@ -446,10 +465,31 @@ int main(int argc, const char **argv_)
- if (fn2)
- out = out_open(fn2, do_md5);
-
-- is_ivf = file_is_ivf(infile, &fourcc);
-+ is_ivf = file_is_ivf(infile, &fourcc, &width, &height,
-+ &timebase_num, &timebase_den);
-
- if (is_ivf)
- {
-+ if (use_y4m)
-+ {
-+ char buffer[128];
-+ if (!fn2)
-+ {
-+ fprintf(stderr, "YUV4MPEG2 output only supported with -o.\n");
-+ return EXIT_FAILURE;
-+ }
-+ /*Correct for the factor of 2 applied to the timebase in the
-+ encoder.*/
-+ if(timebase_den&1)timebase_num<<=1;
-+ else timebase_den>>=1;
-+ /*Note: We can't output an aspect ratio here because IVF doesn't
-+ store one, and neither does VP8.
-+ That will have to wait until these tools support WebM natively.*/
-+ sprintf(buffer, "YUV4MPEG2 C%s W%u H%u F%u:%u I%c\n",
-+ "420jpeg", width, height, timebase_den, timebase_num, 'p');
-+ out_put(out, (unsigned char *)buffer, strlen(buffer), do_md5);
-+ }
-+
- /* Try to determine the codec from the fourcc. */
- for (i = 0; i < sizeof(ifaces) / sizeof(ifaces[0]); i++)
- if ((fourcc & ifaces[i].fourcc_mask) == ifaces[i].fourcc)
-@@ -465,6 +505,11 @@ int main(int argc, const char **argv_)
- break;
- }
- }
-+ else if(use_y4m)
-+ {
-+ fprintf(stderr, "YUV4MPEG2 output only supported from IVF input.\n");
-+ return EXIT_FAILURE;
-+ }
-
- if (vpx_codec_dec_init(&decoder, iface ? iface : ifaces[0].iface, &cfg,
- postproc ? VPX_CODEC_USE_POSTPROC : 0))
-@@ -533,29 +578,31 @@ int main(int argc, const char **argv_)
- prefix, img->d_w, img->d_h, frame_in, sfx);
- out = out_open(out_fn, do_md5);
- }
-+ else if(use_y4m)
-+ out_put(out, (unsigned char *)"FRAME\n", 6, do_md5);
-
-- buf = img->planes[PLANE_Y];
-+ buf = img->planes[VPX_PLANE_Y];
-
- for (y = 0; y < img->d_h; y++)
- {
- out_put(out, buf, img->d_w, do_md5);
-- buf += img->stride[PLANE_Y];
-+ buf += img->stride[VPX_PLANE_Y];
- }
-
-- buf = img->planes[flipuv?PLANE_V:PLANE_U];
-+ buf = img->planes[flipuv?VPX_PLANE_V:VPX_PLANE_U];
-
- for (y = 0; y < (1 + img->d_h) / 2; y++)
- {
- out_put(out, buf, (1 + img->d_w) / 2, do_md5);
-- buf += img->stride[PLANE_U];
-+ buf += img->stride[VPX_PLANE_U];
- }
-
-- buf = img->planes[flipuv?PLANE_U:PLANE_V];
-+ buf = img->planes[flipuv?VPX_PLANE_U:VPX_PLANE_V];
-
- for (y = 0; y < (1 + img->d_h) / 2; y++)
- {
- out_put(out, buf, (1 + img->d_w) / 2, do_md5);
-- buf += img->stride[PLANE_V];
-+ buf += img->stride[VPX_PLANE_V];
- }
-
- if (!fn2)
-diff --git a/ivfenc.c b/ivfenc.c
-index bef3d58..11f2a8f 100644
---- a/ivfenc.c
-+++ b/ivfenc.c
-@@ -1,23 +1,28 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
- /* This is a simple program that encodes YV12 files and generates ivf
- * files using the new interface.
- */
--#define USE_POSIX_MMAP HAVE_SYS_MMAN_H
-+#if defined(_WIN32)
-+#define USE_POSIX_MMAP 0
-+#else
-+#define USE_POSIX_MMAP 1
-+#endif
-
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdarg.h>
- #include <string.h>
--#include "vpx_encoder.h"
-+#include "vpx/vpx_encoder.h"
- #if USE_POSIX_MMAP
- #include <sys/types.h>
- #include <sys/stat.h>
-@@ -25,11 +30,10 @@
- #include <fcntl.h>
- #include <unistd.h>
- #endif
--#if CONFIG_VP8_ENCODER
--#include "vp8cx.h"
--#endif
-+#include "vpx/vp8cx.h"
- #include "vpx_ports/mem_ops.h"
- #include "vpx_ports/vpx_timer.h"
-+#include "y4minput.h"
-
- static const char *exec_name;
-
-@@ -51,8 +55,8 @@ void die(const char *fmt, ...)
- {
- va_list ap;
- va_start(ap, fmt);
-- vprintf(fmt, ap);
-- printf("\n");
-+ vfprintf(stderr, fmt, ap);
-+ fprintf(stderr, "\n");
- usage_exit();
- }
-
-@@ -62,10 +66,10 @@ static void ctx_exit_on_error(vpx_codec_ctx_t *ctx, const char *s)
- {
- const char *detail = vpx_codec_error_detail(ctx);
-
-- printf("%s: %s\n", s, vpx_codec_error(ctx));
-+ fprintf(stderr, "%s: %s\n", s, vpx_codec_error(ctx));
-
- if (detail)
-- printf(" %s\n", detail);
-+ fprintf(stderr, " %s\n", detail);
-
- exit(EXIT_FAILURE);
- }
-@@ -215,49 +219,79 @@ vpx_fixed_buf_t stats_get(stats_io_t *stats)
- return stats->buf;
- }
-
-+enum video_file_type
-+{
-+ FILE_TYPE_RAW,
-+ FILE_TYPE_IVF,
-+ FILE_TYPE_Y4M
-+};
-+
-+struct detect_buffer {
-+ char buf[4];
-+ int valid;
-+};
-+
-+
- #define IVF_FRAME_HDR_SZ (4+8) /* 4 byte size + 8 byte timestamp */
--static int read_frame(FILE *f, vpx_image_t *img, unsigned int is_ivf)
-+static int read_frame(FILE *f, vpx_image_t *img, unsigned int file_type,
-+ y4m_input *y4m, struct detect_buffer *detect)
- {
- int plane = 0;
-
-- if (is_ivf)
-+ if (file_type == FILE_TYPE_Y4M)
- {
-- char junk[IVF_FRAME_HDR_SZ];
--
-- /* Skip the frame header. We know how big the frame should be. See
-- * write_ivf_frame_header() for documentation on the frame header
-- * layout.
-- */
-- fread(junk, 1, IVF_FRAME_HDR_SZ, f);
-+ if (y4m_input_fetch_frame(y4m, f, img) < 0)
-+ return 0;
- }
--
-- for (plane = 0; plane < 3; plane++)
-+ else
- {
-- unsigned char *ptr;
-- int w = (plane ? (1 + img->d_w) / 2 : img->d_w);
-- int h = (plane ? (1 + img->d_h) / 2 : img->d_h);
-- int r;
--
-- /* Determine the correct plane based on the image format. The for-loop
-- * always counts in Y,U,V order, but this may not match the order of
-- * the data on disk.
-- */
-- switch (plane)
-+ if (file_type == FILE_TYPE_IVF)
- {
-- case 1:
-- ptr = img->planes[img->fmt==IMG_FMT_YV12? PLANE_V : PLANE_U];
-- break;
-- case 2:
-- ptr = img->planes[img->fmt==IMG_FMT_YV12?PLANE_U : PLANE_V];
-- break;
-- default:
-- ptr = img->planes[plane];
-+ char junk[IVF_FRAME_HDR_SZ];
-+
-+ /* Skip the frame header. We know how big the frame should be. See
-+ * write_ivf_frame_header() for documentation on the frame header
-+ * layout.
-+ */
-+ fread(junk, 1, IVF_FRAME_HDR_SZ, f);
- }
-
-- for (r = 0; r < h; r++)
-+ for (plane = 0; plane < 3; plane++)
- {
-- fread(ptr, 1, w, f);
-- ptr += img->stride[plane];
-+ unsigned char *ptr;
-+ int w = (plane ? (1 + img->d_w) / 2 : img->d_w);
-+ int h = (plane ? (1 + img->d_h) / 2 : img->d_h);
-+ int r;
-+
-+ /* Determine the correct plane based on the image format. The for-loop
-+ * always counts in Y,U,V order, but this may not match the order of
-+ * the data on disk.
-+ */
-+ switch (plane)
-+ {
-+ case 1:
-+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12? VPX_PLANE_V : VPX_PLANE_U];
-+ break;
-+ case 2:
-+ ptr = img->planes[img->fmt==VPX_IMG_FMT_YV12?VPX_PLANE_U : VPX_PLANE_V];
-+ break;
-+ default:
-+ ptr = img->planes[plane];
-+ }
-+
-+ for (r = 0; r < h; r++)
-+ {
-+ if (detect->valid)
-+ {
-+ memcpy(ptr, detect->buf, 4);
-+ fread(ptr+4, 1, w-4, f);
-+ detect->valid = 0;
-+ }
-+ else
-+ fread(ptr, 1, w, f);
-+
-+ ptr += img->stride[plane];
-+ }
- }
- }
-
-@@ -265,22 +299,36 @@ static int read_frame(FILE *f, vpx_image_t *img, unsigned int is_ivf)
- }
-
-
-+unsigned int file_is_y4m(FILE *infile,
-+ y4m_input *y4m,
-+ char detect[4])
-+{
-+ if(memcmp(detect, "YUV4", 4) == 0)
-+ {
-+ return 1;
-+ }
-+ return 0;
-+}
-+
- #define IVF_FILE_HDR_SZ (32)
- unsigned int file_is_ivf(FILE *infile,
- unsigned int *fourcc,
- unsigned int *width,
-- unsigned int *height)
-+ unsigned int *height,
-+ char detect[4])
- {
- char raw_hdr[IVF_FILE_HDR_SZ];
- int is_ivf = 0;
-
-+ if(memcmp(detect, "DKIF", 4) != 0)
-+ return 0;
-+
- /* See write_ivf_file_header() for more documentation on the file header
- * layout.
- */
-- if (fread(raw_hdr, 1, IVF_FILE_HDR_SZ, infile) == IVF_FILE_HDR_SZ)
-+ if (fread(raw_hdr + 4, 1, IVF_FILE_HDR_SZ - 4, infile)
-+ == IVF_FILE_HDR_SZ - 4)
- {
-- if (raw_hdr[0] == 'D' && raw_hdr[1] == 'K'
-- && raw_hdr[2] == 'I' && raw_hdr[3] == 'F')
- {
- is_ivf = 1;
-
-@@ -297,8 +345,6 @@ unsigned int file_is_ivf(FILE *infile,
- *width = mem_get_le16(raw_hdr + 12);
- *height = mem_get_le16(raw_hdr + 14);
- }
-- else
-- rewind(infile);
-
- return is_ivf;
- }
-@@ -512,28 +558,28 @@ static void usage_exit()
- {
- int i;
-
-- printf("Usage: %s <options> src_filename dst_filename\n", exec_name);
-+ fprintf(stderr, "Usage: %s <options> src_filename dst_filename\n", exec_name);
-
-- printf("\n_options:\n");
-+ fprintf(stderr, "\n_options:\n");
- arg_show_usage(stdout, main_args);
-- printf("\n_encoder Global Options:\n");
-+ fprintf(stderr, "\n_encoder Global Options:\n");
- arg_show_usage(stdout, global_args);
-- printf("\n_rate Control Options:\n");
-+ fprintf(stderr, "\n_rate Control Options:\n");
- arg_show_usage(stdout, rc_args);
-- printf("\n_twopass Rate Control Options:\n");
-+ fprintf(stderr, "\n_twopass Rate Control Options:\n");
- arg_show_usage(stdout, rc_twopass_args);
-- printf("\n_keyframe Placement Options:\n");
-+ fprintf(stderr, "\n_keyframe Placement Options:\n");
- arg_show_usage(stdout, kf_args);
- #if CONFIG_VP8_ENCODER
-- printf("\n_vp8 Specific Options:\n");
-+ fprintf(stderr, "\n_vp8 Specific Options:\n");
- arg_show_usage(stdout, vp8_args);
- #endif
-- printf("\n"
-+ fprintf(stderr, "\n"
- "Included encoders:\n"
- "\n");
-
- for (i = 0; i < sizeof(codecs) / sizeof(codecs[0]); i++)
-- printf(" %-6s - %s\n",
-+ fprintf(stderr, " %-6s - %s\n",
- codecs[i].name,
- vpx_codec_iface_name(codecs[i].iface));
-
-@@ -566,8 +612,10 @@ int main(int argc, const char **argv_)
- static const int *ctrl_args_map = NULL;
- int verbose = 0, show_psnr = 0;
- int arg_use_i420 = 1;
-+ int arg_have_timebase = 0;
- unsigned long cx_time = 0;
-- unsigned int is_ivf, fourcc;
-+ unsigned int file_type, fourcc;
-+ y4m_input y4m;
-
- exec_name = argv_[0];
-
-@@ -651,7 +699,7 @@ int main(int argc, const char **argv_)
- /* DWIM: Assume the user meant passes=2 if pass=2 is specified */
- if (one_pass_only > arg_passes)
- {
-- printf("Warning: Assuming --pass=%d implies --passes=%d\n",
-+ fprintf(stderr, "Warning: Assuming --pass=%d implies --passes=%d\n",
- one_pass_only, one_pass_only);
- arg_passes = one_pass_only;
- }
-@@ -665,7 +713,8 @@ int main(int argc, const char **argv_)
-
- if (res)
- {
-- printf("Failed to get config: %s\n", vpx_codec_err_to_string(res));
-+ fprintf(stderr, "Failed to get config: %s\n",
-+ vpx_codec_err_to_string(res));
- return EXIT_FAILURE;
- }
-
-@@ -684,7 +733,10 @@ int main(int argc, const char **argv_)
- else if (arg_match(&arg, &height, argi))
- cfg.g_h = arg_parse_uint(&arg);
- else if (arg_match(&arg, &timebase, argi))
-+ {
- cfg.g_timebase = arg_parse_rational(&arg);
-+ arg_have_timebase = 1;
-+ }
- else if (arg_match(&arg, &error_resilient, argi))
- cfg.g_error_resilient = arg_parse_uint(&arg);
- else if (arg_match(&arg, &lag_in_frames, argi))
-@@ -722,24 +774,27 @@ int main(int argc, const char **argv_)
- cfg.rc_2pass_vbr_bias_pct = arg_parse_uint(&arg);
-
- if (arg_passes < 2)
-- printf("Warning: option %s ignored in one-pass mode.\n",
-- arg.name);
-+ fprintf(stderr,
-+ "Warning: option %s ignored in one-pass mode.\n",
-+ arg.name);
- }
- else if (arg_match(&arg, &minsection_pct, argi))
- {
- cfg.rc_2pass_vbr_minsection_pct = arg_parse_uint(&arg);
-
- if (arg_passes < 2)
-- printf("Warning: option %s ignored in one-pass mode.\n",
-- arg.name);
-+ fprintf(stderr,
-+ "Warning: option %s ignored in one-pass mode.\n",
-+ arg.name);
- }
- else if (arg_match(&arg, &maxsection_pct, argi))
- {
- cfg.rc_2pass_vbr_maxsection_pct = arg_parse_uint(&arg);
-
- if (arg_passes < 2)
-- printf("Warning: option %s ignored in one-pass mode.\n",
-- arg.name);
-+ fprintf(stderr,
-+ "Warning: option %s ignored in one-pass mode.\n",
-+ arg.name);
- }
- else if (arg_match(&arg, &kf_min_dist, argi))
- cfg.kf_min_dist = arg_parse_uint(&arg);
-@@ -787,7 +842,7 @@ int main(int argc, const char **argv_)
-
- /* Check for unrecognized options */
- for (argi = argv; *argi; argi++)
-- if (argi[0][0] == '-')
-+ if (argi[0][0] == '-' && argi[0][1])
- die("Error: Unrecognized option %s\n", *argi);
-
- /* Handle non-option arguments */
-@@ -797,106 +852,134 @@ int main(int argc, const char **argv_)
- if (!in_fn || !out_fn)
- usage_exit();
-
-- /* Parse certain options from the input file, if possible */
-- infile = fopen(in_fn, "rb");
--
-- if (!infile)
-- {
-- printf("Failed to open input file");
-- return EXIT_FAILURE;
-- }
--
-- is_ivf = file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h);
--
-- if (is_ivf)
-- {
-- switch (fourcc)
-- {
-- case 0x32315659:
-- arg_use_i420 = 0;
-- break;
-- case 0x30323449:
-- arg_use_i420 = 1;
-- break;
-- default:
-- printf("Unsupported fourcc (%08x) in IVF\n", fourcc);
-- return EXIT_FAILURE;
-- }
-- }
--
-- fclose(infile);
--
--
--#define SHOW(field) printf(" %-28s = %d\n", #field, cfg.field)
--
-- if (verbose)
-- {
-- printf("Codec: %s\n", vpx_codec_iface_name(codec->iface));
-- printf("Source file: %s Format: %s\n", in_fn, arg_use_i420 ? "I420" : "YV12");
-- printf("Destination file: %s\n", out_fn);
-- printf("Encoder parameters:\n");
--
-- SHOW(g_usage);
-- SHOW(g_threads);
-- SHOW(g_profile);
-- SHOW(g_w);
-- SHOW(g_h);
-- SHOW(g_timebase.num);
-- SHOW(g_timebase.den);
-- SHOW(g_error_resilient);
-- SHOW(g_pass);
-- SHOW(g_lag_in_frames);
-- SHOW(rc_dropframe_thresh);
-- SHOW(rc_resize_allowed);
-- SHOW(rc_resize_up_thresh);
-- SHOW(rc_resize_down_thresh);
-- SHOW(rc_end_usage);
-- SHOW(rc_target_bitrate);
-- SHOW(rc_min_quantizer);
-- SHOW(rc_max_quantizer);
-- SHOW(rc_undershoot_pct);
-- SHOW(rc_overshoot_pct);
-- SHOW(rc_buf_sz);
-- SHOW(rc_buf_initial_sz);
-- SHOW(rc_buf_optimal_sz);
-- SHOW(rc_2pass_vbr_bias_pct);
-- SHOW(rc_2pass_vbr_minsection_pct);
-- SHOW(rc_2pass_vbr_maxsection_pct);
-- SHOW(kf_mode);
-- SHOW(kf_min_dist);
-- SHOW(kf_max_dist);
-- }
--
-- vpx_img_alloc(&raw, arg_use_i420 ? IMG_FMT_I420 : IMG_FMT_YV12,
-- cfg.g_w, cfg.g_h, 1);
--
-- // This was added so that ivfenc will create monotically increasing
-- // timestamps. Since we create new timestamps for alt-reference frames
-- // we need to make room in the series of timestamps. Since there can
-- // only be 1 alt-ref frame ( current bitstream) multiplying by 2
-- // gives us enough room.
-- cfg.g_timebase.den *= 2;
--
- memset(&stats, 0, sizeof(stats));
-
- for (pass = one_pass_only ? one_pass_only - 1 : 0; pass < arg_passes; pass++)
- {
- int frames_in = 0, frames_out = 0;
- unsigned long nbytes = 0;
-+ struct detect_buffer detect;
-
-- infile = fopen(in_fn, "rb");
-+ /* Parse certain options from the input file, if possible */
-+ infile = strcmp(in_fn, "-") ? fopen(in_fn, "rb") : stdin;
-
- if (!infile)
- {
-- printf("Failed to open input file");
-+ fprintf(stderr, "Failed to open input file\n");
- return EXIT_FAILURE;
- }
-
-- outfile = fopen(out_fn, "wb");
-+ fread(detect.buf, 1, 4, infile);
-+ detect.valid = 0;
-+
-+ if (file_is_y4m(infile, &y4m, detect.buf))
-+ {
-+ if (y4m_input_open(&y4m, infile, detect.buf, 4) >= 0)
-+ {
-+ file_type = FILE_TYPE_Y4M;
-+ cfg.g_w = y4m.pic_w;
-+ cfg.g_h = y4m.pic_h;
-+ /* Use the frame rate from the file only if none was specified
-+ * on the command-line.
-+ */
-+ if (!arg_have_timebase)
-+ {
-+ cfg.g_timebase.num = y4m.fps_d;
-+ cfg.g_timebase.den = y4m.fps_n;
-+ }
-+ arg_use_i420 = 0;
-+ }
-+ else
-+ {
-+ fprintf(stderr, "Unsupported Y4M stream.\n");
-+ return EXIT_FAILURE;
-+ }
-+ }
-+ else if (file_is_ivf(infile, &fourcc, &cfg.g_w, &cfg.g_h, detect.buf))
-+ {
-+ file_type = FILE_TYPE_IVF;
-+ switch (fourcc)
-+ {
-+ case 0x32315659:
-+ arg_use_i420 = 0;
-+ break;
-+ case 0x30323449:
-+ arg_use_i420 = 1;
-+ break;
-+ default:
-+ fprintf(stderr, "Unsupported fourcc (%08x) in IVF\n", fourcc);
-+ return EXIT_FAILURE;
-+ }
-+ }
-+ else
-+ {
-+ file_type = FILE_TYPE_RAW;
-+ detect.valid = 1;
-+ }
-+#define SHOW(field) fprintf(stderr, " %-28s = %d\n", #field, cfg.field)
-+
-+ if (verbose && pass == 0)
-+ {
-+ fprintf(stderr, "Codec: %s\n", vpx_codec_iface_name(codec->iface));
-+ fprintf(stderr, "Source file: %s Format: %s\n", in_fn,
-+ arg_use_i420 ? "I420" : "YV12");
-+ fprintf(stderr, "Destination file: %s\n", out_fn);
-+ fprintf(stderr, "Encoder parameters:\n");
-+
-+ SHOW(g_usage);
-+ SHOW(g_threads);
-+ SHOW(g_profile);
-+ SHOW(g_w);
-+ SHOW(g_h);
-+ SHOW(g_timebase.num);
-+ SHOW(g_timebase.den);
-+ SHOW(g_error_resilient);
-+ SHOW(g_pass);
-+ SHOW(g_lag_in_frames);
-+ SHOW(rc_dropframe_thresh);
-+ SHOW(rc_resize_allowed);
-+ SHOW(rc_resize_up_thresh);
-+ SHOW(rc_resize_down_thresh);
-+ SHOW(rc_end_usage);
-+ SHOW(rc_target_bitrate);
-+ SHOW(rc_min_quantizer);
-+ SHOW(rc_max_quantizer);
-+ SHOW(rc_undershoot_pct);
-+ SHOW(rc_overshoot_pct);
-+ SHOW(rc_buf_sz);
-+ SHOW(rc_buf_initial_sz);
-+ SHOW(rc_buf_optimal_sz);
-+ SHOW(rc_2pass_vbr_bias_pct);
-+ SHOW(rc_2pass_vbr_minsection_pct);
-+ SHOW(rc_2pass_vbr_maxsection_pct);
-+ SHOW(kf_mode);
-+ SHOW(kf_min_dist);
-+ SHOW(kf_max_dist);
-+ }
-+
-+ if(pass == (one_pass_only ? one_pass_only - 1 : 0)) {
-+ if (file_type == FILE_TYPE_Y4M)
-+ /*The Y4M reader does its own allocation.
-+ Just initialize this here to avoid problems if we never read any
-+ frames.*/
-+ memset(&raw, 0, sizeof(raw));
-+ else
-+ vpx_img_alloc(&raw, arg_use_i420 ? VPX_IMG_FMT_I420 : VPX_IMG_FMT_YV12,
-+ cfg.g_w, cfg.g_h, 1);
-+
-+ // This was added so that ivfenc will create monotically increasing
-+ // timestamps. Since we create new timestamps for alt-reference frames
-+ // we need to make room in the series of timestamps. Since there can
-+ // only be 1 alt-ref frame ( current bitstream) multiplying by 2
-+ // gives us enough room.
-+ cfg.g_timebase.den *= 2;
-+ }
-+
-+ outfile = strcmp(out_fn, "-") ? fopen(out_fn, "wb") : stdout;
-
- if (!outfile)
- {
-- printf("Failed to open output file");
-+ fprintf(stderr, "Failed to open output file\n");
- return EXIT_FAILURE;
- }
-
-@@ -904,7 +987,7 @@ int main(int argc, const char **argv_)
- {
- if (!stats_open_file(&stats, stats_fn, pass))
- {
-- printf("Failed to open statistics store\n");
-+ fprintf(stderr, "Failed to open statistics store\n");
- return EXIT_FAILURE;
- }
- }
-@@ -912,7 +995,7 @@ int main(int argc, const char **argv_)
- {
- if (!stats_open_mem(&stats, pass))
- {
-- printf("Failed to open statistics store\n");
-+ fprintf(stderr, "Failed to open statistics store\n");
- return EXIT_FAILURE;
- }
- }
-@@ -947,8 +1030,8 @@ int main(int argc, const char **argv_)
- for (i = 0; i < arg_ctrl_cnt; i++)
- {
- if (vpx_codec_control_(&encoder, arg_ctrls[i][0], arg_ctrls[i][1]))
-- printf("Error: Tried to set control %d = %d\n",
-- arg_ctrls[i][0], arg_ctrls[i][1]);
-+ fprintf(stderr, "Error: Tried to set control %d = %d\n",
-+ arg_ctrls[i][0], arg_ctrls[i][1]);
-
- ctx_exit_on_error(&encoder, "Failed to control codec");
- }
-@@ -964,13 +1047,15 @@ int main(int argc, const char **argv_)
-
- if (!arg_limit || frames_in < arg_limit)
- {
-- frame_avail = read_frame(infile, &raw, is_ivf);
-+ frame_avail = read_frame(infile, &raw, file_type, &y4m,
-+ &detect);
-
- if (frame_avail)
- frames_in++;
-
-- printf("\rPass %d/%d frame %4d/%-4d %7ldB \033[K", pass + 1,
-- arg_passes, frames_in, frames_out, nbytes);
-+ fprintf(stderr,
-+ "\rPass %d/%d frame %4d/%-4d %7ldB \033[K", pass + 1,
-+ arg_passes, frames_in, frames_out, nbytes);
- }
- else
- frame_avail = 0;
-@@ -989,24 +1074,25 @@ int main(int argc, const char **argv_)
- while ((pkt = vpx_codec_get_cx_data(&encoder, &iter)))
- {
- got_data = 1;
-- nbytes += pkt->data.raw.sz;
-
- switch (pkt->kind)
- {
- case VPX_CODEC_CX_FRAME_PKT:
- frames_out++;
-- printf(" %6luF",
-- (unsigned long)pkt->data.frame.sz);
-+ fprintf(stderr, " %6luF",
-+ (unsigned long)pkt->data.frame.sz);
- write_ivf_frame_header(outfile, pkt);
- fwrite(pkt->data.frame.buf, 1, pkt->data.frame.sz, outfile);
-+ nbytes += pkt->data.raw.sz;
- break;
- case VPX_CODEC_STATS_PKT:
- frames_out++;
-- printf(" %6luS",
-+ fprintf(stderr, " %6luS",
- (unsigned long)pkt->data.twopass_stats.sz);
- stats_write(&stats,
- pkt->data.twopass_stats.buf,
- pkt->data.twopass_stats.sz);
-+ nbytes += pkt->data.raw.sz;
- break;
- case VPX_CODEC_PSNR_PKT:
-
-@@ -1015,7 +1101,7 @@ int main(int argc, const char **argv_)
- int i;
-
- for (i = 0; i < 4; i++)
-- printf("%.3lf ", pkt->data.psnr.psnr[i]);
-+ fprintf(stderr, "%.3lf ", pkt->data.psnr.psnr[i]);
- }
-
- break;
-@@ -1030,10 +1116,11 @@ int main(int argc, const char **argv_)
- /* this bitrate calc is simplified and relies on the fact that this
- * application uses 1/timebase for framerate.
- */
-- printf("\rPass %d/%d frame %4d/%-4d %7ldB %7ldb/f %7"PRId64"b/s"
-+ fprintf(stderr,
-+ "\rPass %d/%d frame %4d/%-4d %7ldB %7ldb/f %7"PRId64"b/s"
- " %7lu %s (%.2f fps)\033[K", pass + 1,
- arg_passes, frames_in, frames_out, nbytes, nbytes * 8 / frames_in,
-- nbytes * 8 *(int64_t)cfg.g_timebase.den / cfg.g_timebase.num / frames_in,
-+ nbytes * 8 *(int64_t)cfg.g_timebase.den/2/ cfg.g_timebase.num / frames_in,
- cx_time > 9999999 ? cx_time / 1000 : cx_time,
- cx_time > 9999999 ? "ms" : "us",
- (float)frames_in * 1000000.0 / (float)cx_time);
-@@ -1047,7 +1134,7 @@ int main(int argc, const char **argv_)
-
- fclose(outfile);
- stats_close(&stats);
-- printf("\n");
-+ fprintf(stderr, "\n");
-
- if (one_pass_only)
- break;
-diff --git a/libs.doxy_template b/libs.doxy_template
-index eb37dfc..ce8fde6 100644
---- a/libs.doxy_template
-+++ b/libs.doxy_template
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
--##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+##
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/libs.mk b/libs.mk
-index f741dba..115ceb5 100644
---- a/libs.mk
-+++ b/libs.mk
-@@ -1,17 +1,18 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
- ASM:=$(if $(filter yes,$(CONFIG_GCC)),.asm.s,.asm)
-
--include $(SRC_PATH_BARE)/vpx_codec/vpx_codec.mk
--CODEC_SRCS-yes += $(addprefix vpx_codec/,$(call enabled,API_SRCS))
-+include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
-+CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
-
- include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
- CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
-@@ -19,18 +20,16 @@ CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
- include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
- CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
-
--# Add vpx_codec/ to the include path to allow vp_n[cd]x.h to reference
--# vpx_codec_impl_*.h without extra ifdeffery
--CFLAGS += -I$(SRC_PATH_BARE)/vpx_codec
-
- ifeq ($(CONFIG_VP8_ENCODER),yes)
- VP8_PREFIX=vp8/
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
- CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
- CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
-- CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk
-- INSTALL_MAPS += include/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
-- CODEC_DOC_SRCS += vp8/vp8.h vp8/vp8cx.h
-+ CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h vpx/vp8e.h
-+ INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8e.h include/vpx/vp8cx.h
-+ INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
-+ CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
- CODEC_DOC_SECTIONS += vp8 vp8_encoder
- endif
-
-@@ -39,9 +38,10 @@ ifeq ($(CONFIG_VP8_DECODER),yes)
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
- CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
- CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
-- CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk
-- INSTALL_MAPS += include/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
-- CODEC_DOC_SRCS += vp8/vp8.h vp8/vp8dx.h
-+ CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
-+ INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
-+ INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
-+ CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
- CODEC_DOC_SECTIONS += vp8 vp8_decoder
- endif
-
-@@ -64,13 +64,13 @@ endif
-
- # The following pairs define a mapping of locations in the distribution
- # tree to locations in the source/build trees.
--INSTALL_MAPS += include/% $(SRC_PATH_BARE)/vpx_codec/%
--INSTALL_MAPS += include/% $(SRC_PATH_BARE)/vpx_ports/%
--INSTALL_MAPS += lib/% %
-+INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
-+INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
-+INSTALL_MAPS += $(LIBSUBDIR)/% %
- INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
- ifeq ($(CONFIG_MSVS),yes)
--INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Release/%)
--INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),lib/$(p)/% $(p)/Debug/%)
-+INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
-+INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
- endif
-
- # If this is a universal (fat) binary, then all the subarchitectures have
-@@ -81,7 +81,7 @@ endif
- $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
-
- CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
--CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_integer.h
-+CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
- CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
- CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
- CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
-@@ -92,26 +92,28 @@ CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
- CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
- endif
- CODEC_SRCS-$(ARCH_ARM) += $(BUILD_PFX)vpx_config.asm
--CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx_codec/exports
--
--INSTALL-LIBS-yes += include/vpx_codec.h
--INSTALL-LIBS-yes += include/vpx_image.h
--INSTALL-LIBS-yes += include/vpx_integer.h
--INSTALL-LIBS-yes += include/vpx_codec_impl_top.h
--INSTALL-LIBS-yes += include/vpx_codec_impl_bottom.h
--INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx_decoder.h
--INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx_decoder_compat.h
--INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx_encoder.h
-+CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
-+CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
-+CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
-+
-+INSTALL-LIBS-yes += include/vpx/vpx_codec.h
-+INSTALL-LIBS-yes += include/vpx/vpx_image.h
-+INSTALL-LIBS-yes += include/vpx/vpx_integer.h
-+INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
-+INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
-+INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
-+INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
-+INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
- ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
- ifeq ($(CONFIG_MSVS),yes)
--INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB).lib)
--INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/$(CODEC_LIB)d.lib)
--INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.dll)
--INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),lib/$(p)/vpx.exp)
-+INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
-+INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
-+INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
-+INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
- endif
- else
--INSTALL-LIBS-yes += lib/libvpx.a
--INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += lib/libvpx_g.a
-+INSTALL-LIBS-yes += $(LIBSUBDIR)/libvpx.a
-+INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
- endif
-
- CODEC_SRCS=$(call enabled,CODEC_SRCS)
-@@ -130,7 +132,6 @@ ARM_ARCH=v6
- endif
- obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
- @cp $(SRC_PATH_BARE)/build/arm-wince-vs8/obj_int_extract.bat .
-- @cp $(SRC_PATH_BARE)/build/arm-wince-vs8/armasm$(ARM_ARCH).rules .
- @echo " [CREATE] $@"
- $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\
- --exe\
-@@ -175,6 +176,31 @@ LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
- OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
- LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
- $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
-+
-+BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
-+LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
-+LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)
-+$(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) libvpx.ver
-+$(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm -pthread
-+$(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
-+$(BUILD_PFX)$(LIBVPX_SO): SO_VERSION_SCRIPT = libvpx.ver
-+LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
-+ libvpx.so libvpx.so.$(VERSION_MAJOR) \
-+ libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
-+
-+libvpx.ver: $(call enabled,CODEC_EXPORTS)
-+ @echo " [CREATE] $@"
-+ $(qexec)echo "{ global:" > $@
-+ $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
-+ $(qexec)echo "local: *; };" >> $@
-+CLEAN-OBJS += libvpx.ver
-+
-+$(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)):
-+ @echo " [LN] $@"
-+ $(qexec)ln -sf $(LIBVPX_SO) $@
-+
-+INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
-+INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
- endif
-
- LIBS-$(LIPO_LIBVPX) += libvpx.a
-@@ -209,10 +235,10 @@ $(filter %.asm.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
- $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
- CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
-
--CODEC_DOC_SRCS += vpx_codec/vpx_codec.h \
-- vpx_codec/vpx_decoder.h \
-- vpx_codec/vpx_encoder.h \
-- vpx_codec/vpx_image.h
-+CODEC_DOC_SRCS += vpx/vpx_codec.h \
-+ vpx/vpx_decoder.h \
-+ vpx/vpx_encoder.h \
-+ vpx/vpx_image.h
-
- CLEAN-OBJS += libs.doxy
- DOCS-yes += libs.doxy
-diff --git a/md5_utils.c b/md5_utils.c
-index 16c6f7e..455d9cd 100644
---- a/md5_utils.c
-+++ b/md5_utils.c
-@@ -1,298 +1,253 @@
- /*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ * This code implements the MD5 message-digest algorithm.
-+ * The algorithm is due to Ron Rivest. This code was
-+ * written by Colin Plumb in 1993, no copyright is claimed.
-+ * This code is in the public domain; do with it what you wish.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Equivalent code is available from RSA Data Security, Inc.
-+ * This code has been tested against that, and is equivalent,
-+ * except that you don't need to include two pages of legalese
-+ * with every copy.
-+ *
-+ * To compute the message digest of a chunk of bytes, declare an
-+ * MD5Context structure, pass it to MD5Init, call MD5Update as
-+ * needed on buffers full of bytes, and then call MD5Final, which
-+ * will fill a supplied 16-byte array with the digest.
-+ *
-+ * Changed so as no longer to depend on Colin Plumb's `usual.h' header
-+ * definitions
-+ * - Ian Jackson <ian@chiark.greenend.org.uk>.
-+ * Still in the public domain.
- */
-
-+#include <sys/types.h> /* for stupid systems */
-
--/*
--Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
--rights reserved.
--
--License to copy and use this software is granted provided that it
--is identified as the "RSA Data Security, Inc. MD5 Message-Digest
--Algorithm" in all material mentioning or referencing this software
--or this function.
--
--License is also granted to make and use derivative works provided
--that such works are identified as "derived from the RSA Data
--Security, Inc. MD5 Message-Digest Algorithm" in all material
--mentioning or referencing the derived work.
--
--RSA Data Security, Inc. makes no representations concerning either
--the merchantability of this software or the suitability of this
--software for any particular purpose. It is provided "as is"
--without express or implied warranty of any kind.
--
--These notices must be retained in any copies of any part of this
--documentation and/or software.
--*/
-+#include <string.h> /* for memcpy() */
-
- #include "md5_utils.h"
--#include <string.h>
-
--/* Constants for md5_transform routine.
-- */
--#define S11 7
--#define S12 12
--#define S13 17
--#define S14 22
--#define S21 5
--#define S22 9
--#define S23 14
--#define S24 20
--#define S31 4
--#define S32 11
--#define S33 16
--#define S34 23
--#define S41 6
--#define S42 10
--#define S43 15
--#define S44 21
--
--static void md5_transform(uint32_t state[4], const uint8_t block[64]);
--static void Encode(uint8_t *output, const uint32_t *input, unsigned int len);
--static void Decode(uint32_t *output, const uint8_t *input, unsigned int len);
--#define md5_memset memset
--#define md5_memcpy memcpy
--
--static unsigned char PADDING[64] =
-+void
-+byteSwap(UWORD32 *buf, unsigned words)
- {
-- 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
--};
-+ md5byte *p;
-
--/* F, G, H and I are basic MD5 functions.
-- */
--#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
--#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
--#define H(x, y, z) ((x) ^ (y) ^ (z))
--#define I(x, y, z) ((y) ^ ((x) | (~z)))
-+ /* Only swap bytes for big endian machines */
-+ int i = 1;
-
--/* ROTATE_LEFT rotates x left n bits.
-- */
--#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
-+ if (*(char *)&i == 1)
-+ return;
-
--/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
--Rotation is separate from addition to prevent recomputation.
-- */
--#define FF(a, b, c, d, x, s, ac) { \
-- (a) += F ((b), (c), (d)) + (x) + (uint32_t)(ac); \
-- (a) = ROTATE_LEFT ((a), (s)); \
-- (a) += (b); \
-- }
--#define GG(a, b, c, d, x, s, ac) { \
-- (a) += G ((b), (c), (d)) + (x) + (uint32_t)(ac); \
-- (a) = ROTATE_LEFT ((a), (s)); \
-- (a) += (b); \
-- }
--#define HH(a, b, c, d, x, s, ac) { \
-- (a) += H ((b), (c), (d)) + (x) + (uint32_t)(ac); \
-- (a) = ROTATE_LEFT ((a), (s)); \
-- (a) += (b); \
-- }
--#define II(a, b, c, d, x, s, ac) { \
-- (a) += I ((b), (c), (d)) + (x) + (uint32_t)(ac); \
-- (a) = ROTATE_LEFT ((a), (s)); \
-- (a) += (b); \
-+ p = (md5byte *)buf;
-+
-+ do
-+ {
-+ *buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
-+ ((unsigned)p[1] << 8 | p[0]);
-+ p += 4;
- }
-+ while (--words);
-+}
-
--/* MD5 initialization. Begins an MD5 operation, writing a new context.
-+/*
-+ * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
-+ * initialization constants.
- */
--void md5_init(md5_ctx_t *context)
-+void
-+MD5Init(struct MD5Context *ctx)
- {
-- context->count[0] = context->count[1] = 0;
-- /* Load magic initialization constants.
-- */
-- context->state[0] = 0x67452301;
-- context->state[1] = 0xefcdab89;
-- context->state[2] = 0x98badcfe;
-- context->state[3] = 0x10325476;
-+ ctx->buf[0] = 0x67452301;
-+ ctx->buf[1] = 0xefcdab89;
-+ ctx->buf[2] = 0x98badcfe;
-+ ctx->buf[3] = 0x10325476;
-+
-+ ctx->bytes[0] = 0;
-+ ctx->bytes[1] = 0;
- }
-
--/* MD5 block update operation. Continues an MD5 message-digest
-- operation, processing another message block, and updating the
-- context.
-+/*
-+ * Update context to reflect the concatenation of another buffer full
-+ * of bytes.
- */
--void md5_update(md5_ctx_t *context, const uint8_t *input, unsigned int input_len)
-+void
-+MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
- {
-- unsigned int i, index, part_len;
-+ UWORD32 t;
-
-- /* Compute number of bytes mod 64 */
-- index = (unsigned int)((context->count[0] >> 3) & 0x3F);
-+ /* Update byte count */
-
-- /* Update number of bits */
-- if ((context->count[0] += ((uint32_t)input_len << 3))
-- < ((uint32_t)input_len << 3))
-- context->count[1]++;
-+ t = ctx->bytes[0];
-
-- context->count[1] += ((uint32_t)input_len >> 29);
-+ if ((ctx->bytes[0] = t + len) < t)
-+ ctx->bytes[1]++; /* Carry from low to high */
-
-- part_len = 64 - index;
-+ t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
-
-- /* Transform as many times as possible. */
-- if (input_len >= part_len)
-+ if (t > len)
- {
-- memcpy(&context->buffer[index], input, part_len);
-- md5_transform(context->state, context->buffer);
-+ memcpy((md5byte *)ctx->in + 64 - t, buf, len);
-+ return;
-+ }
-
-- for (i = part_len; i + 63 < input_len; i += 64)
-- md5_transform(context->state, &input[i]);
-+ /* First chunk is an odd size */
-+ memcpy((md5byte *)ctx->in + 64 - t, buf, t);
-+ byteSwap(ctx->in, 16);
-+ MD5Transform(ctx->buf, ctx->in);
-+ buf += t;
-+ len -= t;
-
-- index = 0;
-+ /* Process data in 64-byte chunks */
-+ while (len >= 64)
-+ {
-+ memcpy(ctx->in, buf, 64);
-+ byteSwap(ctx->in, 16);
-+ MD5Transform(ctx->buf, ctx->in);
-+ buf += 64;
-+ len -= 64;
- }
-- else
-- i = 0;
-
-- /* Buffer remaining input */
-- memcpy(&context->buffer[index], &input[i], input_len - i);
-+ /* Handle any remaining bytes of data. */
-+ memcpy(ctx->in, buf, len);
- }
-
--/* MD5 finalization. Ends an MD5 message-digest operation, writing the
-- the message digest and zeroizing the context.
-+/*
-+ * Final wrapup - pad to 64-byte boundary with the bit pattern
-+ * 1 0* (64-bit count of bits processed, MSB-first)
- */
--void md5_finalize(md5_ctx_t *context, uint8_t digest[16])
-+void
-+MD5Final(md5byte digest[16], struct MD5Context *ctx)
- {
-- unsigned char bits[8];
-- unsigned int index, pad_len;
--
-- /* Save number of bits */
-- Encode(bits, context->count, 8);
--
-- /* Pad out to 56 mod 64.
-- */
-- index = (unsigned int)((context->count[0] >> 3) & 0x3f);
-- pad_len = (index < 56) ? (56 - index) : (120 - index);
-- md5_update(context, PADDING, pad_len);
--
-- /* Append length (before padding) */
-- md5_update(context, bits, 8);
-- /* Store state in digest */
-- Encode(digest, context->state, 16);
--
-- /* Zeroize sensitive information.
-- */
-- memset(context, 0, sizeof(*context));
--}
-+ int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
-+ md5byte *p = (md5byte *)ctx->in + count;
-
--/* MD5 basic transformation. Transforms state based on block.
-- */
--static void md5_transform(uint32_t state[4], const uint8_t block[64])
--{
-- uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16];
--
-- Decode(x, block, 64);
--
-- /* Round 1 */
-- FF(a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-- FF(d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-- FF(c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-- FF(b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-- FF(a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-- FF(d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-- FF(c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-- FF(b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-- FF(a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-- FF(d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-- FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-- FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-- FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-- FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-- FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-- FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
--
-- /* Round 2 */
-- GG(a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-- GG(d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-- GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-- GG(b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-- GG(a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-- GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
-- GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-- GG(b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-- GG(a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-- GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-- GG(c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-- GG(b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-- GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-- GG(d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-- GG(c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-- GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
--
-- /* Round 3 */
-- HH(a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-- HH(d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-- HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-- HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-- HH(a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-- HH(d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-- HH(c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-- HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-- HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-- HH(d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-- HH(c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-- HH(b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */
-- HH(a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-- HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-- HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-- HH(b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
--
-- /* Round 4 */
-- II(a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-- II(d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-- II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-- II(b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-- II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-- II(d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-- II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-- II(b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-- II(a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-- II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-- II(c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-- II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-- II(a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-- II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-- II(c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-- II(b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
--
-- state[0] += a;
-- state[1] += b;
-- state[2] += c;
-- state[3] += d;
--
-- /* Zeroize sensitive information.
-- */
-- memset(x, 0, sizeof(x));
--}
-+ /* Set the first char of padding to 0x80. There is always room. */
-+ *p++ = 0x80;
-
--/* Encodes input (uint32_t) into output (unsigned char). Assumes len is
-- a multiple of 4.
-- */
--static void Encode(uint8_t *output, const uint32_t *input, unsigned int len)
--{
-- unsigned int i, j;
-+ /* Bytes of padding needed to make 56 bytes (-8..55) */
-+ count = 56 - 1 - count;
-
-- for (i = 0, j = 0; j < len; i++, j += 4)
-+ if (count < 0) /* Padding forces an extra block */
- {
-- output[j] = (unsigned char)(input[i] & 0xff);
-- output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
-- output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
-- output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
-+ memset(p, 0, count + 8);
-+ byteSwap(ctx->in, 16);
-+ MD5Transform(ctx->buf, ctx->in);
-+ p = (md5byte *)ctx->in;
-+ count = 56;
- }
-+
-+ memset(p, 0, count);
-+ byteSwap(ctx->in, 14);
-+
-+ /* Append length in bits and transform */
-+ ctx->in[14] = ctx->bytes[0] << 3;
-+ ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
-+ MD5Transform(ctx->buf, ctx->in);
-+
-+ byteSwap(ctx->buf, 4);
-+ memcpy(digest, ctx->buf, 16);
-+ memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
- }
-
--/* Decodes input (unsigned char) into output (uint32_t). Assumes len is
-- a multiple of 4.
-+#ifndef ASM_MD5
-+
-+/* The four core functions - F1 is optimized somewhat */
-+
-+/* #define F1(x, y, z) (x & y | ~x & z) */
-+#define F1(x, y, z) (z ^ (x & (y ^ z)))
-+#define F2(x, y, z) F1(z, x, y)
-+#define F3(x, y, z) (x ^ y ^ z)
-+#define F4(x, y, z) (y ^ (x | ~z))
-+
-+/* This is the central step in the MD5 algorithm. */
-+#define MD5STEP(f,w,x,y,z,in,s) \
-+ (w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
-+
-+/*
-+ * The core of the MD5 algorithm, this alters an existing MD5 hash to
-+ * reflect the addition of 16 longwords of new data. MD5Update blocks
-+ * the data and converts bytes into longwords for this routine.
- */
--static void Decode(uint32_t *output, const uint8_t *input, unsigned int len)
-+void
-+MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
- {
-- unsigned int i, j;
--
-- for (i = 0, j = 0; j < len; i++, j += 4)
-- output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) |
-- (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24);
-+ register UWORD32 a, b, c, d;
-+
-+ a = buf[0];
-+ b = buf[1];
-+ c = buf[2];
-+ d = buf[3];
-+
-+ MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
-+ MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
-+ MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
-+ MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
-+ MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
-+ MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
-+ MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
-+ MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
-+ MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
-+ MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
-+ MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
-+ MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
-+ MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
-+ MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
-+ MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
-+ MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
-+
-+ MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
-+ MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
-+ MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
-+ MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
-+ MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
-+ MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
-+ MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
-+ MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
-+ MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
-+ MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
-+ MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
-+ MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
-+ MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
-+ MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
-+ MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
-+ MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
-+
-+ MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
-+ MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
-+ MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
-+ MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
-+ MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
-+ MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
-+ MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
-+ MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
-+ MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
-+ MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
-+ MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
-+ MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
-+ MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
-+ MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
-+ MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
-+ MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
-+
-+ MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
-+ MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
-+ MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
-+ MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
-+ MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
-+ MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
-+ MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
-+ MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
-+ MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
-+ MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
-+ MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
-+ MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
-+ MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
-+ MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
-+ MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
-+ MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
-+
-+ buf[0] += a;
-+ buf[1] += b;
-+ buf[2] += c;
-+ buf[3] += d;
- }
-+
-+#endif
-diff --git a/md5_utils.h b/md5_utils.h
-index 8dda8d1..5ca1b5f 100644
---- a/md5_utils.h
-+++ b/md5_utils.h
-@@ -1,51 +1,42 @@
- /*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ * This is the header file for the MD5 message-digest algorithm.
-+ * The algorithm is due to Ron Rivest. This code was
-+ * written by Colin Plumb in 1993, no copyright is claimed.
-+ * This code is in the public domain; do with it what you wish.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Equivalent code is available from RSA Data Security, Inc.
-+ * This code has been tested against that, and is equivalent,
-+ * except that you don't need to include two pages of legalese
-+ * with every copy.
-+ *
-+ * To compute the message digest of a chunk of bytes, declare an
-+ * MD5Context structure, pass it to MD5Init, call MD5Update as
-+ * needed on buffers full of bytes, and then call MD5Final, which
-+ * will fill a supplied 16-byte array with the digest.
-+ *
-+ * Changed so as no longer to depend on Colin Plumb's `usual.h'
-+ * header definitions
-+ * - Ian Jackson <ian@chiark.greenend.org.uk>.
-+ * Still in the public domain.
- */
-
--/*
--Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
--rights reserved.
--
--License to copy and use this software is granted provided that it
--is identified as the "RSA Data Security, Inc. MD5 Message-Digest
--Algorithm" in all material mentioning or referencing this software
--or this function.
-+#ifndef MD5_H
-+#define MD5_H
-
--License is also granted to make and use derivative works provided
--that such works are identified as "derived from the RSA Data
--Security, Inc. MD5 Message-Digest Algorithm" in all material
--mentioning or referencing the derived work.
-+#define md5byte unsigned char
-+#define UWORD32 unsigned int
-
--RSA Data Security, Inc. makes no representations concerning either
--the merchantability of this software or the suitability of this
--software for any particular purpose. It is provided "as is"
--without express or implied warranty of any kind.
--
--These notices must be retained in any copies of any part of this
--documentation and/or software.
--*/
--#ifndef HAVE_VPX_PORTS
--#define HAVE_VPX_PORTS 0
--#endif
--#if HAVE_VPX_PORTS
--#include "vpx_ports/vpx_integer.h"
--#else
--#include "vpx_integer.h"
--#endif
--
--/* MD5 context. */
--typedef struct
-+typedef struct MD5Context MD5Context;
-+struct MD5Context
- {
-- uint32_t state[4]; /* state (ABCD) */
-- uint32_t count[2]; /* number of bits, modulo 2^64 (lsb first) */
-- uint8_t buffer[64]; /* input buffer */
--} md5_ctx_t;
-+ UWORD32 buf[4];
-+ UWORD32 bytes[2];
-+ UWORD32 in[16];
-+};
-+
-+void MD5Init(struct MD5Context *context);
-+void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
-+void MD5Final(unsigned char digest[16], struct MD5Context *context);
-+void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
-
--void md5_init(md5_ctx_t *ctx);
--void md5_update(md5_ctx_t *ctx, const uint8_t *buf, unsigned int len);
--void md5_finalize(md5_ctx_t *ctx, uint8_t md5[16]);
-+#endif /* !MD5_H */
-diff --git a/release.sh b/release.sh
-index 3b77dad..880ad0f 100755
---- a/release.sh
-+++ b/release.sh
-@@ -1,11 +1,12 @@
--#!/bin/bash
-+#!/bin/sh
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-@@ -20,7 +21,7 @@ for opt; do
- esac
- done
-
--TAB=$'\t'
-+TAB="$(printf '\t')"
- cat > release.mk << EOF
- %\$(BUILD_SFX).tar.bz2: %/.done
- ${TAB}@echo "\$(subst .tar.bz2,,\$@): tarball"
-@@ -185,7 +186,7 @@ for cfg in $CONFIGS; do
- esac
- opts="$opts --enable-postproc"
-
-- [ "x${clean}" == "xyes" ] \
-+ [ "x${clean}" = "xyes" ] \
- && rm -rf ${full_cfg}${BUILD_SFX}${TAR_SFX} \
- && rm -rf logs/${full_cfg}${BUILD_SFX}.log.bz2
-
-diff --git a/solution.mk b/solution.mk
-index 783c6f8..21bf065 100644
---- a/solution.mk
-+++ b/solution.mk
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/tools/gen_authors.sh b/tools/gen_authors.sh
-new file mode 100755
-index 0000000..e1246f0
---- /dev/null
-+++ b/tools/gen_authors.sh
-@@ -0,0 +1,13 @@
-+#!/bin/bash
-+
-+# Add organization names manually.
-+
-+cat <<EOF
-+# This file is automatically generated from the git commit history
-+# by tools/gen_authors.sh.
-+
-+$(git log --pretty=format:"%aN <%aE>" | sort | uniq)
-+Google Inc.
-+The Mozilla Foundation
-+The Xiph.Org Foundation
-+EOF
-diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c
-index ac110f7..9f6397e 100644
---- a/vp8/common/alloccommon.c
-+++ b/vp8/common/alloccommon.c
-@@ -1,13 +1,15 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-+#include "vpx_ports/config.h"
- #include "blockd.h"
- #include "vpx_mem/vpx_mem.h"
- #include "onyxc_int.h"
-@@ -16,9 +18,6 @@
- #include "systemdependent.h"
- #include "vpxerrors.h"
-
--#ifdef HAVE_CONFIG_H
--#include "vpx_config.h"
--#endif
-
- extern void vp8_init_scan_order_mask();
-
-diff --git a/vp8/common/alloccommon.h b/vp8/common/alloccommon.h
-index 73c7383..b877412 100644
---- a/vp8/common/alloccommon.h
-+++ b/vp8/common/alloccommon.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/armv6/bilinearfilter_v6.asm b/vp8/common/arm/armv6/bilinearfilter_v6.asm
-index 4428cf8..ac0d333 100644
---- a/vp8/common/arm/armv6/bilinearfilter_v6.asm
-+++ b/vp8/common/arm/armv6/bilinearfilter_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/copymem16x16_v6.asm b/vp8/common/arm/armv6/copymem16x16_v6.asm
-index 00e9739..344c453 100644
---- a/vp8/common/arm/armv6/copymem16x16_v6.asm
-+++ b/vp8/common/arm/armv6/copymem16x16_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/copymem8x4_v6.asm b/vp8/common/arm/armv6/copymem8x4_v6.asm
-index 94473ca..3556b3a 100644
---- a/vp8/common/arm/armv6/copymem8x4_v6.asm
-+++ b/vp8/common/arm/armv6/copymem8x4_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/copymem8x8_v6.asm b/vp8/common/arm/armv6/copymem8x8_v6.asm
-index 7cfa533..1da0ff5 100644
---- a/vp8/common/arm/armv6/copymem8x8_v6.asm
-+++ b/vp8/common/arm/armv6/copymem8x8_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/filter_v6.asm b/vp8/common/arm/armv6/filter_v6.asm
-index a7863fc..cdc74ba 100644
---- a/vp8/common/arm/armv6/filter_v6.asm
-+++ b/vp8/common/arm/armv6/filter_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/idct_v6.asm b/vp8/common/arm/armv6/idct_v6.asm
-index 25c5165..9e932fa 100644
---- a/vp8/common/arm/armv6/idct_v6.asm
-+++ b/vp8/common/arm/armv6/idct_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/iwalsh_v6.asm b/vp8/common/arm/armv6/iwalsh_v6.asm
-index 8747568..4606783 100644
---- a/vp8/common/arm/armv6/iwalsh_v6.asm
-+++ b/vp8/common/arm/armv6/iwalsh_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
- EXPORT |vp8_short_inv_walsh4x4_armv6|
-diff --git a/vp8/common/arm/armv6/loopfilter_v6.asm b/vp8/common/arm/armv6/loopfilter_v6.asm
-index c2b02dc..eeeacd3 100644
---- a/vp8/common/arm/armv6/loopfilter_v6.asm
-+++ b/vp8/common/arm/armv6/loopfilter_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/recon_v6.asm b/vp8/common/arm/armv6/recon_v6.asm
-index 085ff80..6f3ccbe 100644
---- a/vp8/common/arm/armv6/recon_v6.asm
-+++ b/vp8/common/arm/armv6/recon_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/simpleloopfilter_v6.asm b/vp8/common/arm/armv6/simpleloopfilter_v6.asm
-index 15c6c7d..b820ced 100644
---- a/vp8/common/arm/armv6/simpleloopfilter_v6.asm
-+++ b/vp8/common/arm/armv6/simpleloopfilter_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
-index 551d863..6415463 100644
---- a/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
-+++ b/vp8/common/arm/armv6/sixtappredict8x4_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/bilinearfilter_arm.c b/vp8/common/arm/bilinearfilter_arm.c
-index bf972a3..b93539c 100644
---- a/vp8/common/arm/bilinearfilter_arm.c
-+++ b/vp8/common/arm/bilinearfilter_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/filter_arm.c b/vp8/common/arm/filter_arm.c
-index 2a4640c..233be24 100644
---- a/vp8/common/arm/filter_arm.c
-+++ b/vp8/common/arm/filter_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/idct_arm.h b/vp8/common/arm/idct_arm.h
-index f9ed21e..cfd9d76 100644
---- a/vp8/common/arm/idct_arm.h
-+++ b/vp8/common/arm/idct_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/loopfilter_arm.c b/vp8/common/arm/loopfilter_arm.c
-index fa7c626..d98c908 100644
---- a/vp8/common/arm/loopfilter_arm.c
-+++ b/vp8/common/arm/loopfilter_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/loopfilter_arm.h b/vp8/common/arm/loopfilter_arm.h
-index 4bb4945..b59e2b5 100644
---- a/vp8/common/arm/loopfilter_arm.h
-+++ b/vp8/common/arm/loopfilter_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
-index a2fea2b..076a3d3 100644
---- a/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
-+++ b/vp8/common/arm/neon/bilinearpredict16x16_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
-index 74d2db5..f199ba3 100644
---- a/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
-+++ b/vp8/common/arm/neon/bilinearpredict4x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
-index 46ebb0e..9a3a039 100644
---- a/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
-+++ b/vp8/common/arm/neon/bilinearpredict8x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
-index 80728d4..10a6366 100644
---- a/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
-+++ b/vp8/common/arm/neon/bilinearpredict8x8_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm b/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
-index f42ac63..7cd9d75 100644
---- a/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
-+++ b/vp8/common/arm/neon/buildintrapredictorsmby_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/copymem16x16_neon.asm b/vp8/common/arm/neon/copymem16x16_neon.asm
-index 89d5e10..b25bfdc 100644
---- a/vp8/common/arm/neon/copymem16x16_neon.asm
-+++ b/vp8/common/arm/neon/copymem16x16_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/copymem8x4_neon.asm b/vp8/common/arm/neon/copymem8x4_neon.asm
-index 302f734..0c62ee2 100644
---- a/vp8/common/arm/neon/copymem8x4_neon.asm
-+++ b/vp8/common/arm/neon/copymem8x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/copymem8x8_neon.asm b/vp8/common/arm/neon/copymem8x8_neon.asm
-index 50d39ef..84e0afd 100644
---- a/vp8/common/arm/neon/copymem8x8_neon.asm
-+++ b/vp8/common/arm/neon/copymem8x8_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/iwalsh_neon.asm b/vp8/common/arm/neon/iwalsh_neon.asm
-index 4fc744c..b8199ce 100644
---- a/vp8/common/arm/neon/iwalsh_neon.asm
-+++ b/vp8/common/arm/neon/iwalsh_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
- EXPORT |vp8_short_inv_walsh4x4_neon|
- EXPORT |vp8_short_inv_walsh4x4_1_neon|
-diff --git a/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm b/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm
-index e3e8e8a..5d25e3d 100644
---- a/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm
-+++ b/vp8/common/arm/neon/loopfilterhorizontaledge_uv_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm b/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm
-index f11055d..ebe52fc 100644
---- a/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm
-+++ b/vp8/common/arm/neon/loopfilterhorizontaledge_y_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
-index 6d74fab..dbbdd74 100644
---- a/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
-+++ b/vp8/common/arm/neon/loopfiltersimplehorizontaledge_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
-index 2bb6222..480e318 100644
---- a/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
-+++ b/vp8/common/arm/neon/loopfiltersimpleverticaledge_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm b/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm
-index d79cc68..a402282 100644
---- a/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm
-+++ b/vp8/common/arm/neon/loopfilterverticaledge_uv_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm b/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm
-index 3a230a9..18eba9f 100644
---- a/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm
-+++ b/vp8/common/arm/neon/loopfilterverticaledge_y_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm b/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm
-index 86eddaa..21b85da 100644
---- a/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm
-+++ b/vp8/common/arm/neon/mbloopfilterhorizontaledge_uv_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm b/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm
-index 2ab0fc2..64d98c6 100644
---- a/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm
-+++ b/vp8/common/arm/neon/mbloopfilterhorizontaledge_y_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm b/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm
-index ad5afba..0e72e80 100644
---- a/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm
-+++ b/vp8/common/arm/neon/mbloopfilterverticaledge_uv_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm b/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm
-index 60e5175..91396a1 100644
---- a/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm
-+++ b/vp8/common/arm/neon/mbloopfilterverticaledge_y_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/recon16x16mb_neon.asm b/vp8/common/arm/neon/recon16x16mb_neon.asm
-index b9ba1cb..7c06c03 100644
---- a/vp8/common/arm/neon/recon16x16mb_neon.asm
-+++ b/vp8/common/arm/neon/recon16x16mb_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/recon2b_neon.asm b/vp8/common/arm/neon/recon2b_neon.asm
-index 25aaf8c..3d87e2d 100644
---- a/vp8/common/arm/neon/recon2b_neon.asm
-+++ b/vp8/common/arm/neon/recon2b_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/recon4b_neon.asm b/vp8/common/arm/neon/recon4b_neon.asm
-index a4f5b80..63cd987 100644
---- a/vp8/common/arm/neon/recon4b_neon.asm
-+++ b/vp8/common/arm/neon/recon4b_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/reconb_neon.asm b/vp8/common/arm/neon/reconb_neon.asm
-index 16d85a0..0ecdc14 100644
---- a/vp8/common/arm/neon/reconb_neon.asm
-+++ b/vp8/common/arm/neon/reconb_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/save_neon_reg.asm b/vp8/common/arm/neon/save_neon_reg.asm
-index 4873e44..f5db2a8 100644
---- a/vp8/common/arm/neon/save_neon_reg.asm
-+++ b/vp8/common/arm/neon/save_neon_reg.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm b/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm
-index 7d06ff9..24e5fed 100644
---- a/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm
-+++ b/vp8/common/arm/neon/shortidct4x4llm_1_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/shortidct4x4llm_neon.asm b/vp8/common/arm/neon/shortidct4x4llm_neon.asm
-index ffecfbf..c566c67 100644
---- a/vp8/common/arm/neon/shortidct4x4llm_neon.asm
-+++ b/vp8/common/arm/neon/shortidct4x4llm_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/sixtappredict16x16_neon.asm b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
-index 9f5f0d2..6f3716d 100644
---- a/vp8/common/arm/neon/sixtappredict16x16_neon.asm
-+++ b/vp8/common/arm/neon/sixtappredict16x16_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/sixtappredict4x4_neon.asm b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
-index c23a9db..6fe9ead 100644
---- a/vp8/common/arm/neon/sixtappredict4x4_neon.asm
-+++ b/vp8/common/arm/neon/sixtappredict4x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/sixtappredict8x4_neon.asm b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
-index 18e19f9..a6ff4f7 100644
---- a/vp8/common/arm/neon/sixtappredict8x4_neon.asm
-+++ b/vp8/common/arm/neon/sixtappredict8x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/neon/sixtappredict8x8_neon.asm b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
-index d27485e..bb35ae4 100644
---- a/vp8/common/arm/neon/sixtappredict8x8_neon.asm
-+++ b/vp8/common/arm/neon/sixtappredict8x8_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/arm/recon_arm.c b/vp8/common/arm/recon_arm.c
-index 130059e..2cc9ee7 100644
---- a/vp8/common/arm/recon_arm.c
-+++ b/vp8/common/arm/recon_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/recon_arm.h b/vp8/common/arm/recon_arm.h
-index fd9f85e..392297b 100644
---- a/vp8/common/arm/recon_arm.h
-+++ b/vp8/common/arm/recon_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/reconintra4x4_arm.c b/vp8/common/arm/reconintra4x4_arm.c
-index 334d352..65fb1f0 100644
---- a/vp8/common/arm/reconintra4x4_arm.c
-+++ b/vp8/common/arm/reconintra4x4_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/reconintra_arm.c b/vp8/common/arm/reconintra_arm.c
-index d7ee1dd..29f4a2c 100644
---- a/vp8/common/arm/reconintra_arm.c
-+++ b/vp8/common/arm/reconintra_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/subpixel_arm.h b/vp8/common/arm/subpixel_arm.h
-index 56aec55..0eb2c58 100644
---- a/vp8/common/arm/subpixel_arm.h
-+++ b/vp8/common/arm/subpixel_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/systemdependent.c b/vp8/common/arm/systemdependent.c
-index ecc6929..27d3dee 100644
---- a/vp8/common/arm/systemdependent.c
-+++ b/vp8/common/arm/systemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/arm/vpx_asm_offsets.c b/vp8/common/arm/vpx_asm_offsets.c
-index 68634bf..ff4d752 100644
---- a/vp8/common/arm/vpx_asm_offsets.c
-+++ b/vp8/common/arm/vpx_asm_offsets.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/bigend.h b/vp8/common/bigend.h
-index 6a91ba1..cd6b988 100644
---- a/vp8/common/bigend.h
-+++ b/vp8/common/bigend.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/blockd.c b/vp8/common/blockd.c
-index 53f5e72..e0ed561 100644
---- a/vp8/common/blockd.c
-+++ b/vp8/common/blockd.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/blockd.h b/vp8/common/blockd.h
-index 84ed53a..2b25f62 100644
---- a/vp8/common/blockd.h
-+++ b/vp8/common/blockd.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -173,9 +174,8 @@ typedef struct
- int dc_diff;
- unsigned char segment_id; // Which set of segmentation parameters should be used for this MB
- int force_no_skip;
--
-+ int need_to_clamp_mvs;
- B_MODE_INFO partition_bmi[16];
--
- } MB_MODE_INFO;
-
-
-diff --git a/vp8/common/boolcoder.h b/vp8/common/boolcoder.h
-index 0659d48..66f67c2 100644
---- a/vp8/common/boolcoder.h
-+++ b/vp8/common/boolcoder.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/codec_common_interface.h b/vp8/common/codec_common_interface.h
-index 7881b0a..d836564 100644
---- a/vp8/common/codec_common_interface.h
-+++ b/vp8/common/codec_common_interface.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
- #ifndef CODEC_COMMON_INTERFACE_H
-diff --git a/vp8/common/coefupdateprobs.h b/vp8/common/coefupdateprobs.h
-index 99affd6..6131d12 100644
---- a/vp8/common/coefupdateprobs.h
-+++ b/vp8/common/coefupdateprobs.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/common.h b/vp8/common/common.h
-index 29f6d37..bfa8a9c 100644
---- a/vp8/common/common.h
-+++ b/vp8/common/common.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/common_types.h b/vp8/common/common_types.h
-index deb5ed8..a307ed6 100644
---- a/vp8/common/common_types.h
-+++ b/vp8/common/common_types.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/context.c b/vp8/common/context.c
-index 17ee8c3..f0cb838 100644
---- a/vp8/common/context.c
-+++ b/vp8/common/context.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/debugmodes.c b/vp8/common/debugmodes.c
-index e2d2d2c..e669814 100644
---- a/vp8/common/debugmodes.c
-+++ b/vp8/common/debugmodes.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/defaultcoefcounts.h b/vp8/common/defaultcoefcounts.h
-index ccdf326..f9247d2 100644
---- a/vp8/common/defaultcoefcounts.h
-+++ b/vp8/common/defaultcoefcounts.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/dma_desc.h b/vp8/common/dma_desc.h
-index 5e6fa0c..765405d 100644
---- a/vp8/common/dma_desc.h
-+++ b/vp8/common/dma_desc.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/duck_io.h b/vp8/common/duck_io.h
-index f63a5cd..02f6895 100644
---- a/vp8/common/duck_io.h
-+++ b/vp8/common/duck_io.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c
-index e524c2a..8d01bf8 100644
---- a/vp8/common/entropy.c
-+++ b/vp8/common/entropy.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h
-index 1415832..29be82c 100644
---- a/vp8/common/entropy.h
-+++ b/vp8/common/entropy.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/entropymode.c b/vp8/common/entropymode.c
-index 7dc1acd..72cbd64 100644
---- a/vp8/common/entropymode.c
-+++ b/vp8/common/entropymode.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/entropymode.h b/vp8/common/entropymode.h
-index ff630a4..bd44b83 100644
---- a/vp8/common/entropymode.h
-+++ b/vp8/common/entropymode.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/entropymv.c b/vp8/common/entropymv.c
-index 2b00c17..176fecd 100644
---- a/vp8/common/entropymv.c
-+++ b/vp8/common/entropymv.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/entropymv.h b/vp8/common/entropymv.h
-index d940c59..395984c 100644
---- a/vp8/common/entropymv.h
-+++ b/vp8/common/entropymv.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/extend.c b/vp8/common/extend.c
-index 7407952..43d7aed 100644
---- a/vp8/common/extend.c
-+++ b/vp8/common/extend.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/extend.h b/vp8/common/extend.h
-index 6809ae7..bb8a016 100644
---- a/vp8/common/extend.h
-+++ b/vp8/common/extend.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/filter_c.c b/vp8/common/filter_c.c
-index 38991cb..f24f8a2 100644
---- a/vp8/common/filter_c.c
-+++ b/vp8/common/filter_c.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/findnearmv.c b/vp8/common/findnearmv.c
-index fcb1f20..550681e 100644
---- a/vp8/common/findnearmv.c
-+++ b/vp8/common/findnearmv.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/findnearmv.h b/vp8/common/findnearmv.h
-index 2c02033..3e0718a 100644
---- a/vp8/common/findnearmv.h
-+++ b/vp8/common/findnearmv.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/fourcc.hpp b/vp8/common/fourcc.hpp
-index 5f1faed..9823b56 100644
---- a/vp8/common/fourcc.hpp
-+++ b/vp8/common/fourcc.hpp
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/g_common.h b/vp8/common/g_common.h
-index e68c53e..3f43401 100644
---- a/vp8/common/g_common.h
-+++ b/vp8/common/g_common.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/generic/systemdependent.c b/vp8/common/generic/systemdependent.c
-index 0011ae0..6e64885 100644
---- a/vp8/common/generic/systemdependent.c
-+++ b/vp8/common/generic/systemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/header.h b/vp8/common/header.h
-index 8b2b009..b8b9059 100644
---- a/vp8/common/header.h
-+++ b/vp8/common/header.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/idct.h b/vp8/common/idct.h
-index 47b5f05..2185bd3 100644
---- a/vp8/common/idct.h
-+++ b/vp8/common/idct.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/idctllm.c b/vp8/common/idctllm.c
-index 57cf858..4261d24 100644
---- a/vp8/common/idctllm.c
-+++ b/vp8/common/idctllm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/invtrans.c b/vp8/common/invtrans.c
-index 1ff596e..00502c6 100644
---- a/vp8/common/invtrans.c
-+++ b/vp8/common/invtrans.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/invtrans.h b/vp8/common/invtrans.h
-index 93a40f9..be30ca0 100644
---- a/vp8/common/invtrans.h
-+++ b/vp8/common/invtrans.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/littlend.h b/vp8/common/littlend.h
-index 08c525c..0961163 100644
---- a/vp8/common/littlend.h
-+++ b/vp8/common/littlend.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/loopfilter.c b/vp8/common/loopfilter.c
-index 79e6177..4937195 100644
---- a/vp8/common/loopfilter.c
-+++ b/vp8/common/loopfilter.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/loopfilter.h b/vp8/common/loopfilter.h
-index c6ce508..a9a976e 100644
---- a/vp8/common/loopfilter.h
-+++ b/vp8/common/loopfilter.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/loopfilter_filters.c b/vp8/common/loopfilter_filters.c
-index 7d16e48..eaf7327 100644
---- a/vp8/common/loopfilter_filters.c
-+++ b/vp8/common/loopfilter_filters.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/mac_specs.h b/vp8/common/mac_specs.h
-index 97bffc7..a12b8d5 100644
---- a/vp8/common/mac_specs.h
-+++ b/vp8/common/mac_specs.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/mbpitch.c b/vp8/common/mbpitch.c
-index a7e0ce9..b183b8e 100644
---- a/vp8/common/mbpitch.c
-+++ b/vp8/common/mbpitch.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/modecont.c b/vp8/common/modecont.c
-index 9301a25..c008eef 100644
---- a/vp8/common/modecont.c
-+++ b/vp8/common/modecont.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/modecont.h b/vp8/common/modecont.h
-index 0c57651..4b79722 100644
---- a/vp8/common/modecont.h
-+++ b/vp8/common/modecont.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/modecontext.c b/vp8/common/modecontext.c
-index ceee74c..a4b2f76 100644
---- a/vp8/common/modecontext.c
-+++ b/vp8/common/modecontext.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/mv.h b/vp8/common/mv.h
-index 3d84181..c3db5f0 100644
---- a/vp8/common/mv.h
-+++ b/vp8/common/mv.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h
-index b66c400..3ed6f2d 100644
---- a/vp8/common/onyx.h
-+++ b/vp8/common/onyx.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -16,7 +17,7 @@ extern "C"
- {
- #endif
-
--#include "vpx_codec/internal/vpx_codec_internal.h"
-+#include "vpx/internal/vpx_codec_internal.h"
- #include "vpx_scale/yv12config.h"
- #include "type_aliases.h"
- #include "ppflags.h"
-diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h
-index a40ffb9..d1cb766 100644
---- a/vp8/common/onyxc_int.h
-+++ b/vp8/common/onyxc_int.h
-@@ -1,18 +1,19 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
- #ifndef __INC_VP8C_INT_H
- #define __INC_VP8C_INT_H
-
--#include "vpx_ports/config.h"
--#include "vpx_codec/internal/vpx_codec_internal.h"
-+#include "vpx_config.h"
-+#include "vpx/internal/vpx_codec_internal.h"
- #include "loopfilter.h"
- #include "entropymv.h"
- #include "entropy.h"
-diff --git a/vp8/common/onyxd.h b/vp8/common/onyxd.h
-index 644c0ec..ea04c14 100644
---- a/vp8/common/onyxd.h
-+++ b/vp8/common/onyxd.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/partialgfupdate.h b/vp8/common/partialgfupdate.h
-index 32a55ee..355aa79 100644
---- a/vp8/common/partialgfupdate.h
-+++ b/vp8/common/partialgfupdate.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/postproc.c b/vp8/common/postproc.c
-index f019925..1f36d4e 100644
---- a/vp8/common/postproc.c
-+++ b/vp8/common/postproc.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -274,7 +275,7 @@ static void vp8_deblock_and_de_macro_block(YV12_BUFFER_CONFIG *source,
-
- }
-
--extern void vp8_deblock(YV12_BUFFER_CONFIG *source,
-+void vp8_deblock(YV12_BUFFER_CONFIG *source,
- YV12_BUFFER_CONFIG *post,
- int q,
- int low_var_thresh,
-diff --git a/vp8/common/postproc.h b/vp8/common/postproc.h
-index c45fe92..e148f2a 100644
---- a/vp8/common/postproc.h
-+++ b/vp8/common/postproc.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -87,4 +88,11 @@ void vp8_de_noise(YV12_BUFFER_CONFIG *source,
- int low_var_thresh,
- int flag,
- vp8_postproc_rtcd_vtable_t *rtcd);
-+
-+void vp8_deblock(YV12_BUFFER_CONFIG *source,
-+ YV12_BUFFER_CONFIG *post,
-+ int q,
-+ int low_var_thresh,
-+ int flag,
-+ vp8_postproc_rtcd_vtable_t *rtcd);
- #endif
-diff --git a/vp8/common/ppc/copy_altivec.asm b/vp8/common/ppc/copy_altivec.asm
-index e87eb21..5ca2d17 100644
---- a/vp8/common/ppc/copy_altivec.asm
-+++ b/vp8/common/ppc/copy_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/filter_altivec.asm b/vp8/common/ppc/filter_altivec.asm
-index 2a35507..1a7ebf7 100644
---- a/vp8/common/ppc/filter_altivec.asm
-+++ b/vp8/common/ppc/filter_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/filter_bilinear_altivec.asm b/vp8/common/ppc/filter_bilinear_altivec.asm
-index 27e02a8..73e758e 100644
---- a/vp8/common/ppc/filter_bilinear_altivec.asm
-+++ b/vp8/common/ppc/filter_bilinear_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/idctllm_altivec.asm b/vp8/common/ppc/idctllm_altivec.asm
-index e88af8d..9ebe6af 100644
---- a/vp8/common/ppc/idctllm_altivec.asm
-+++ b/vp8/common/ppc/idctllm_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/loopfilter_altivec.c b/vp8/common/ppc/loopfilter_altivec.c
-index 586eed4..8bf5e57 100644
---- a/vp8/common/ppc/loopfilter_altivec.c
-+++ b/vp8/common/ppc/loopfilter_altivec.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/ppc/loopfilter_filters_altivec.asm b/vp8/common/ppc/loopfilter_filters_altivec.asm
-index 78a5cf9..26c51a6 100644
---- a/vp8/common/ppc/loopfilter_filters_altivec.asm
-+++ b/vp8/common/ppc/loopfilter_filters_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/platform_altivec.asm b/vp8/common/ppc/platform_altivec.asm
-index 227ef2a..23680c9 100644
---- a/vp8/common/ppc/platform_altivec.asm
-+++ b/vp8/common/ppc/platform_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/recon_altivec.asm b/vp8/common/ppc/recon_altivec.asm
-index f478b95..212664d 100644
---- a/vp8/common/ppc/recon_altivec.asm
-+++ b/vp8/common/ppc/recon_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/ppc/systemdependent.c b/vp8/common/ppc/systemdependent.c
-index 2847310..4ccf690 100644
---- a/vp8/common/ppc/systemdependent.c
-+++ b/vp8/common/ppc/systemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/ppflags.h b/vp8/common/ppflags.h
-index c663976..57aeb1d 100644
---- a/vp8/common/ppflags.h
-+++ b/vp8/common/ppflags.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/pragmas.h b/vp8/common/pragmas.h
-index 25a4b77..523c8b7 100644
---- a/vp8/common/pragmas.h
-+++ b/vp8/common/pragmas.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/predictdc.c b/vp8/common/predictdc.c
-index df4c96e..18d7da8 100644
---- a/vp8/common/predictdc.c
-+++ b/vp8/common/predictdc.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/predictdc.h b/vp8/common/predictdc.h
-index b8871e4..69036ee 100644
---- a/vp8/common/predictdc.h
-+++ b/vp8/common/predictdc.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/preproc.h b/vp8/common/preproc.h
-index 00ec9a8..a02745c 100644
---- a/vp8/common/preproc.h
-+++ b/vp8/common/preproc.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/preprocif.h b/vp8/common/preprocif.h
-index 986c45b..f700f76 100644
---- a/vp8/common/preprocif.h
-+++ b/vp8/common/preprocif.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/proposed.h b/vp8/common/proposed.h
-index 1171ede..65b7834 100644
---- a/vp8/common/proposed.h
-+++ b/vp8/common/proposed.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/quant_common.c b/vp8/common/quant_common.c
-index 09fe31f..6fd3bc0 100644
---- a/vp8/common/quant_common.c
-+++ b/vp8/common/quant_common.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/quant_common.h b/vp8/common/quant_common.h
-index 0c92ce8..49d11bc 100644
---- a/vp8/common/quant_common.h
-+++ b/vp8/common/quant_common.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/recon.c b/vp8/common/recon.c
-index d1268ea..b09ef37 100644
---- a/vp8/common/recon.c
-+++ b/vp8/common/recon.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/recon.h b/vp8/common/recon.h
-index f65a90f..607895c 100644
---- a/vp8/common/recon.h
-+++ b/vp8/common/recon.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/reconinter.c b/vp8/common/reconinter.c
-index c48886d..91ec76b 100644
---- a/vp8/common/reconinter.c
-+++ b/vp8/common/reconinter.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/reconinter.h b/vp8/common/reconinter.h
-index b2d1ae9..9df4806 100644
---- a/vp8/common/reconinter.h
-+++ b/vp8/common/reconinter.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/reconintra.c b/vp8/common/reconintra.c
-index e33bce3..23d87ee 100644
---- a/vp8/common/reconintra.c
-+++ b/vp8/common/reconintra.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/reconintra.h b/vp8/common/reconintra.h
-index d63aa15..b7c4d1d 100644
---- a/vp8/common/reconintra.h
-+++ b/vp8/common/reconintra.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/reconintra4x4.c b/vp8/common/reconintra4x4.c
-index d92d5c9..3b22423 100644
---- a/vp8/common/reconintra4x4.c
-+++ b/vp8/common/reconintra4x4.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/reconintra4x4.h b/vp8/common/reconintra4x4.h
-index 788c8c4..881d091 100644
---- a/vp8/common/reconintra4x4.h
-+++ b/vp8/common/reconintra4x4.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/segmentation_common.c b/vp8/common/segmentation_common.c
-index 72b8c87..2568c7c 100644
---- a/vp8/common/segmentation_common.c
-+++ b/vp8/common/segmentation_common.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/segmentation_common.h b/vp8/common/segmentation_common.h
-index bb93533..7b36b49 100644
---- a/vp8/common/segmentation_common.h
-+++ b/vp8/common/segmentation_common.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/setupintrarecon.c b/vp8/common/setupintrarecon.c
-index dcaafe6..e796d42 100644
---- a/vp8/common/setupintrarecon.c
-+++ b/vp8/common/setupintrarecon.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -16,21 +17,15 @@ void vp8_setup_intra_recon(YV12_BUFFER_CONFIG *ybf)
- int i;
-
- // set up frame new frame for intra coded blocks
-- vpx_memset(ybf->y_buffer - 1 - 2 * ybf->y_stride, 127, ybf->y_width + 5);
- vpx_memset(ybf->y_buffer - 1 - ybf->y_stride, 127, ybf->y_width + 5);
--
- for (i = 0; i < ybf->y_height; i++)
- ybf->y_buffer[ybf->y_stride *i - 1] = (unsigned char) 129;
-
-- vpx_memset(ybf->u_buffer - 1 - 2 * ybf->uv_stride, 127, ybf->uv_width + 5);
- vpx_memset(ybf->u_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
--
- for (i = 0; i < ybf->uv_height; i++)
- ybf->u_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
-
-- vpx_memset(ybf->v_buffer - 1 - 2 * ybf->uv_stride, 127, ybf->uv_width + 5);
- vpx_memset(ybf->v_buffer - 1 - ybf->uv_stride, 127, ybf->uv_width + 5);
--
- for (i = 0; i < ybf->uv_height; i++)
- ybf->v_buffer[ybf->uv_stride *i - 1] = (unsigned char) 129;
-
-diff --git a/vp8/common/setupintrarecon.h b/vp8/common/setupintrarecon.h
-index 6ec79b2..ea4e342 100644
---- a/vp8/common/setupintrarecon.h
-+++ b/vp8/common/setupintrarecon.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/subpixel.h b/vp8/common/subpixel.h
-index fbd5f4d..446697c 100644
---- a/vp8/common/subpixel.h
-+++ b/vp8/common/subpixel.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/swapyv12buffer.c b/vp8/common/swapyv12buffer.c
-index afe6a88..5bdf431 100644
---- a/vp8/common/swapyv12buffer.c
-+++ b/vp8/common/swapyv12buffer.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/swapyv12buffer.h b/vp8/common/swapyv12buffer.h
-index caf9499..f2c3b74 100644
---- a/vp8/common/swapyv12buffer.h
-+++ b/vp8/common/swapyv12buffer.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/systemdependent.h b/vp8/common/systemdependent.h
-index 1829b64..56218e6 100644
---- a/vp8/common/systemdependent.h
-+++ b/vp8/common/systemdependent.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/textblit.c b/vp8/common/textblit.c
-index a45937b..5d117f1 100644
---- a/vp8/common/textblit.c
-+++ b/vp8/common/textblit.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/threading.h b/vp8/common/threading.h
-index a02cb24..7c94645 100644
---- a/vp8/common/threading.h
-+++ b/vp8/common/threading.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/treecoder.c b/vp8/common/treecoder.c
-index 4ad018d..0ccd64d 100644
---- a/vp8/common/treecoder.c
-+++ b/vp8/common/treecoder.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/treecoder.h b/vp8/common/treecoder.h
-index 0356d2b..908dbcb 100644
---- a/vp8/common/treecoder.h
-+++ b/vp8/common/treecoder.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/type_aliases.h b/vp8/common/type_aliases.h
-index addd264..a0d8717 100644
---- a/vp8/common/type_aliases.h
-+++ b/vp8/common/type_aliases.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/vfwsetting.hpp b/vp8/common/vfwsetting.hpp
-index e352e7a..c01a0dd 100644
---- a/vp8/common/vfwsetting.hpp
-+++ b/vp8/common/vfwsetting.hpp
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/vpx_ref_build_prefix.h b/vp8/common/vpx_ref_build_prefix.h
-index 40608c6..cded66c 100644
---- a/vp8/common/vpx_ref_build_prefix.h
-+++ b/vp8/common/vpx_ref_build_prefix.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/vpxblit.h b/vp8/common/vpxblit.h
-index d03e0bd..2c7f673 100644
---- a/vp8/common/vpxblit.h
-+++ b/vp8/common/vpxblit.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/vpxblit_c64.h b/vp8/common/vpxblit_c64.h
-index a8e28f5..7659b5c 100644
---- a/vp8/common/vpxblit_c64.h
-+++ b/vp8/common/vpxblit_c64.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/vpxerrors.h b/vp8/common/vpxerrors.h
-index e4c9f3e..f0ec707 100644
---- a/vp8/common/vpxerrors.h
-+++ b/vp8/common/vpxerrors.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/boolcoder.cxx b/vp8/common/x86/boolcoder.cxx
-index 06faca6..cd9c495 100644
---- a/vp8/common/x86/boolcoder.cxx
-+++ b/vp8/common/x86/boolcoder.cxx
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/idct_x86.h b/vp8/common/x86/idct_x86.h
-index 5dfb212..1f2cb63 100644
---- a/vp8/common/x86/idct_x86.h
-+++ b/vp8/common/x86/idct_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/idctllm_mmx.asm b/vp8/common/x86/idctllm_mmx.asm
-index 2751c69..5ec01e9 100644
---- a/vp8/common/x86/idctllm_mmx.asm
-+++ b/vp8/common/x86/idctllm_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/x86/iwalsh_mmx.asm b/vp8/common/x86/iwalsh_mmx.asm
-index 562e590..6cb8979 100644
---- a/vp8/common/x86/iwalsh_mmx.asm
-+++ b/vp8/common/x86/iwalsh_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/x86/iwalsh_sse2.asm b/vp8/common/x86/iwalsh_sse2.asm
-index 96943df..bb0d1d7 100644
---- a/vp8/common/x86/iwalsh_sse2.asm
-+++ b/vp8/common/x86/iwalsh_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-@@ -16,6 +17,7 @@ sym(vp8_short_inv_walsh4x4_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 2
-+ SAVE_XMM
- push rsi
- push rdi
- ; end prolog
-@@ -100,6 +102,7 @@ sym(vp8_short_inv_walsh4x4_sse2):
- ; begin epilog
- pop rdi
- pop rsi
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-diff --git a/vp8/common/x86/loopfilter_mmx.asm b/vp8/common/x86/loopfilter_mmx.asm
-index 6e4d2b6..6e6efab 100644
---- a/vp8/common/x86/loopfilter_mmx.asm
-+++ b/vp8/common/x86/loopfilter_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/x86/loopfilter_sse2.asm b/vp8/common/x86/loopfilter_sse2.asm
-index 5275dfa..d160dd6 100644
---- a/vp8/common/x86/loopfilter_sse2.asm
-+++ b/vp8/common/x86/loopfilter_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-@@ -25,6 +26,7 @@ sym(vp8_loop_filter_horizontal_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -211,6 +213,7 @@ sym(vp8_loop_filter_horizontal_edge_sse2):
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -230,6 +233,7 @@ sym(vp8_loop_filter_vertical_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -651,6 +655,7 @@ sym(vp8_loop_filter_vertical_edge_sse2):
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -670,6 +675,7 @@ sym(vp8_mbloop_filter_horizontal_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -1001,6 +1007,7 @@ sym(vp8_mbloop_filter_horizontal_edge_sse2):
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -1020,6 +1027,7 @@ sym(vp8_mbloop_filter_vertical_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -1563,6 +1571,7 @@ sym(vp8_mbloop_filter_vertical_edge_sse2):
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -1582,6 +1591,7 @@ sym(vp8_loop_filter_simple_horizontal_edge_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -1678,6 +1688,7 @@ sym(vp8_loop_filter_simple_horizontal_edge_sse2):
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -1697,6 +1708,7 @@ sym(vp8_loop_filter_simple_vertical_edge_sse2):
- push rbp ; save old base pointer value.
- mov rbp, rsp ; set new base pointer value.
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx ; save callee-saved reg
- push rsi
- push rdi
-@@ -1941,6 +1953,7 @@ sym(vp8_loop_filter_simple_vertical_edge_sse2):
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-diff --git a/vp8/common/x86/loopfilter_x86.c b/vp8/common/x86/loopfilter_x86.c
-index 143ee74..f5af7cf 100644
---- a/vp8/common/x86/loopfilter_x86.c
-+++ b/vp8/common/x86/loopfilter_x86.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/loopfilter_x86.h b/vp8/common/x86/loopfilter_x86.h
-index c87f38a..503bf5b 100644
---- a/vp8/common/x86/loopfilter_x86.h
-+++ b/vp8/common/x86/loopfilter_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/postproc_mmx.asm b/vp8/common/x86/postproc_mmx.asm
-index 721c8d6..0707651 100644
---- a/vp8/common/x86/postproc_mmx.asm
-+++ b/vp8/common/x86/postproc_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/x86/postproc_mmx.c b/vp8/common/x86/postproc_mmx.c
-index 095797b..f3b2923 100644
---- a/vp8/common/x86/postproc_mmx.c
-+++ b/vp8/common/x86/postproc_mmx.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/postproc_sse2.asm b/vp8/common/x86/postproc_sse2.asm
-index bfa36fa..9e56429 100644
---- a/vp8/common/x86/postproc_sse2.asm
-+++ b/vp8/common/x86/postproc_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-@@ -25,6 +26,7 @@ sym(vp8_post_proc_down_and_across_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -239,6 +241,7 @@ acrossnextcol:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -253,6 +256,7 @@ sym(vp8_mbpost_proc_down_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -438,6 +442,7 @@ loop_row:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -451,6 +456,7 @@ sym(vp8_mbpost_proc_across_ip_xmm):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 5
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -611,6 +617,7 @@ nextcol4:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-diff --git a/vp8/common/x86/postproc_x86.h b/vp8/common/x86/postproc_x86.h
-index 49a1907..f939427 100644
---- a/vp8/common/x86/postproc_x86.h
-+++ b/vp8/common/x86/postproc_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/recon_mmx.asm b/vp8/common/x86/recon_mmx.asm
-index ba60c5d..95c308d 100644
---- a/vp8/common/x86/recon_mmx.asm
-+++ b/vp8/common/x86/recon_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/x86/recon_sse2.asm b/vp8/common/x86/recon_sse2.asm
-index f2685a7..cfdbfad 100644
---- a/vp8/common/x86/recon_sse2.asm
-+++ b/vp8/common/x86/recon_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-@@ -66,6 +67,7 @@ sym(vp8_recon4b_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 4
-+ SAVE_XMM
- push rsi
- push rdi
- ; end prolog
-@@ -118,6 +120,7 @@ sym(vp8_recon4b_sse2):
- ; begin epilog
- pop rdi
- pop rsi
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-diff --git a/vp8/common/x86/recon_x86.h b/vp8/common/x86/recon_x86.h
-index c469778..fcd429c 100644
---- a/vp8/common/x86/recon_x86.h
-+++ b/vp8/common/x86/recon_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/subpixel_mmx.asm b/vp8/common/x86/subpixel_mmx.asm
-index c502118..b3e4ad5 100644
---- a/vp8/common/x86/subpixel_mmx.asm
-+++ b/vp8/common/x86/subpixel_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/common/x86/subpixel_sse2.asm b/vp8/common/x86/subpixel_sse2.asm
-index dee04f2..ee383ad 100644
---- a/vp8/common/x86/subpixel_sse2.asm
-+++ b/vp8/common/x86/subpixel_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-@@ -36,6 +37,7 @@ sym(vp8_filter_block1d8_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -128,6 +130,7 @@ filter_block1d8_h6_rowloop:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -154,6 +157,7 @@ sym(vp8_filter_block1d16_h6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 7
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -303,6 +307,7 @@ filter_block1d16_h6_sse2_rowloop:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -328,6 +333,7 @@ sym(vp8_filter_block1d8_v6_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 8
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -396,221 +402,553 @@ vp8_filter_block1d8_v6_sse2_loop:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
--;void vp8_unpack_block1d16_h6_sse2
-+;void vp8_filter_block1d16_v6_sse2
-+;(
-+; unsigned short *src_ptr,
-+; unsigned char *output_ptr,
-+; int dst_ptich,
-+; unsigned int pixels_per_line,
-+; unsigned int pixel_step,
-+; unsigned int output_height,
-+; unsigned int output_width,
-+; const short *vp8_filter
-+;)
-+;/************************************************************************************
-+; Notes: filter_block1d16_v6 applies a 6 tap filter vertically to the input pixels. The
-+; input pixel array has output_height rows.
-+;*************************************************************************************/
-+global sym(vp8_filter_block1d16_v6_sse2)
-+sym(vp8_filter_block1d16_v6_sse2):
-+ push rbp
-+ mov rbp, rsp
-+ SHADOW_ARGS_TO_STACK 8
-+ SAVE_XMM
-+ GET_GOT rbx
-+ push rsi
-+ push rdi
-+ ; end prolog
-+
-+ mov rax, arg(7) ;vp8_filter
-+ movsxd rdx, dword ptr arg(3) ;pixels_per_line
-+
-+ mov rdi, arg(1) ;output_ptr
-+ mov rsi, arg(0) ;src_ptr
-+
-+ sub rsi, rdx
-+ sub rsi, rdx
-+
-+ movsxd rcx, DWORD PTR arg(5) ;[output_height]
-+%if ABI_IS_32BIT=0
-+ movsxd r8, dword ptr arg(2) ; dst_ptich
-+%endif
-+
-+vp8_filter_block1d16_v6_sse2_loop:
-+; The order for adding 6-tap is 2 5 3 1 4 6. Read in data in that order.
-+ movdqa xmm1, XMMWORD PTR [rsi + rdx] ; line 2
-+ movdqa xmm2, XMMWORD PTR [rsi + rdx + 16]
-+ pmullw xmm1, [rax + 16]
-+ pmullw xmm2, [rax + 16]
-+
-+ movdqa xmm3, XMMWORD PTR [rsi + rdx * 4] ; line 5
-+ movdqa xmm4, XMMWORD PTR [rsi + rdx * 4 + 16]
-+ pmullw xmm3, [rax + 64]
-+ pmullw xmm4, [rax + 64]
-+
-+ movdqa xmm5, XMMWORD PTR [rsi + rdx * 2] ; line 3
-+ movdqa xmm6, XMMWORD PTR [rsi + rdx * 2 + 16]
-+ pmullw xmm5, [rax + 32]
-+ pmullw xmm6, [rax + 32]
-+
-+ movdqa xmm7, XMMWORD PTR [rsi] ; line 1
-+ movdqa xmm0, XMMWORD PTR [rsi + 16]
-+ pmullw xmm7, [rax]
-+ pmullw xmm0, [rax]
-+
-+ paddsw xmm1, xmm3
-+ paddsw xmm2, xmm4
-+ paddsw xmm1, xmm5
-+ paddsw xmm2, xmm6
-+ paddsw xmm1, xmm7
-+ paddsw xmm2, xmm0
-+
-+ add rsi, rdx
-+
-+ movdqa xmm3, XMMWORD PTR [rsi + rdx * 2] ; line 4
-+ movdqa xmm4, XMMWORD PTR [rsi + rdx * 2 + 16]
-+ pmullw xmm3, [rax + 48]
-+ pmullw xmm4, [rax + 48]
-+
-+ movdqa xmm5, XMMWORD PTR [rsi + rdx * 4] ; line 6
-+ movdqa xmm6, XMMWORD PTR [rsi + rdx * 4 + 16]
-+ pmullw xmm5, [rax + 80]
-+ pmullw xmm6, [rax + 80]
-+
-+ movdqa xmm7, XMMWORD PTR [rd GLOBAL]
-+ pxor xmm0, xmm0 ; clear xmm0
-+
-+ paddsw xmm1, xmm3
-+ paddsw xmm2, xmm4
-+ paddsw xmm1, xmm5
-+ paddsw xmm2, xmm6
-+
-+ paddsw xmm1, xmm7
-+ paddsw xmm2, xmm7
-+
-+ psraw xmm1, 7
-+ psraw xmm2, 7
-+
-+ packuswb xmm1, xmm2 ; pack and saturate
-+ movdqa XMMWORD PTR [rdi], xmm1 ; store the results in the destination
-+%if ABI_IS_32BIT
-+ add rdi, DWORD PTR arg(2) ;[dst_ptich]
-+%else
-+ add rdi, r8
-+%endif
-+ dec rcx ; decrement count
-+ jnz vp8_filter_block1d16_v6_sse2_loop ; next row
-+
-+ ; begin epilog
-+ pop rdi
-+ pop rsi
-+ RESTORE_GOT
-+ RESTORE_XMM
-+ UNSHADOW_ARGS
-+ pop rbp
-+ ret
-+
-+
-+;void vp8_filter_block1d8_h6_only_sse2
- ;(
- ; unsigned char *src_ptr,
--; unsigned short *output_ptr,
- ; unsigned int src_pixels_per_line,
-+; unsigned char *output_ptr,
-+; int dst_ptich,
- ; unsigned int output_height,
--; unsigned int output_width
-+; const short *vp8_filter
- ;)
--global sym(vp8_unpack_block1d16_h6_sse2)
--sym(vp8_unpack_block1d16_h6_sse2):
-+; First-pass filter only when yoffset==0
-+global sym(vp8_filter_block1d8_h6_only_sse2)
-+sym(vp8_filter_block1d8_h6_only_sse2):
- push rbp
- mov rbp, rsp
-- SHADOW_ARGS_TO_STACK 5
-+ SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-+ mov rdx, arg(5) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
-- mov rdi, arg(1) ;output_ptr
-
-- movsxd rcx, dword ptr arg(3) ;output_height
-- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
-+ mov rdi, arg(2) ;output_ptr
-
-- pxor xmm0, xmm0 ; clear xmm0 for unpack
-+ movsxd rcx, dword ptr arg(4) ;output_height
-+ movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
- %if ABI_IS_32BIT=0
-- movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
-+ movsxd r8, dword ptr arg(3) ;dst_ptich
- %endif
-+ pxor xmm0, xmm0 ; clear xmm0 for unpack
-
--unpack_block1d16_h6_sse2_rowloop:
-- movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
-- movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
-+filter_block1d8_h6_only_rowloop:
-+ movq xmm3, MMWORD PTR [rsi - 2]
-+ movq xmm1, MMWORD PTR [rsi + 6]
-+
-+ prefetcht2 [rsi+rax-2]
-+
-+ pslldq xmm1, 8
-+ por xmm1, xmm3
-+
-+ movdqa xmm4, xmm1
-+ movdqa xmm5, xmm1
-+
-+ movdqa xmm6, xmm1
-+ movdqa xmm7, xmm1
-
- punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
-- punpcklbw xmm1, xmm0
-+ psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-+
-+ pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
-+ punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-+
-+ psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
-+ pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-+
-+
-+ punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
-+ psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-+
-+ pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-+
-+ punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
-+ psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-+
-+ pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-+
-+ punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
-+ psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-+
-+
-+ pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-+
-+ punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
-+ pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-
-- movdqa XMMWORD Ptr [rdi], xmm1
-- movdqa XMMWORD Ptr [rdi + 16], xmm3
-
-+ paddsw xmm4, xmm7
-+ paddsw xmm4, xmm5
-+
-+ paddsw xmm4, xmm3
-+ paddsw xmm4, xmm6
-+
-+ paddsw xmm4, xmm1
-+ paddsw xmm4, [rd GLOBAL]
-+
-+ psraw xmm4, 7
-+
-+ packuswb xmm4, xmm0
-+
-+ movq QWORD PTR [rdi], xmm4 ; store the results in the destination
- lea rsi, [rsi + rax]
-+
- %if ABI_IS_32BIT
-- add rdi, DWORD Ptr arg(4) ;[output_width]
-+ add rdi, DWORD Ptr arg(3) ;dst_ptich
- %else
- add rdi, r8
- %endif
- dec rcx
-- jnz unpack_block1d16_h6_sse2_rowloop ; next row
-+
-+ jnz filter_block1d8_h6_only_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
--;void vp8_unpack_block1d8_h6_sse2
-+;void vp8_filter_block1d16_h6_only_sse2
- ;(
- ; unsigned char *src_ptr,
--; unsigned short *output_ptr,
- ; unsigned int src_pixels_per_line,
-+; unsigned char *output_ptr,
-+; int dst_ptich,
- ; unsigned int output_height,
--; unsigned int output_width
-+; const short *vp8_filter
- ;)
--global sym(vp8_unpack_block1d8_h6_sse2)
--sym(vp8_unpack_block1d8_h6_sse2):
-+; First-pass filter only when yoffset==0
-+global sym(vp8_filter_block1d16_h6_only_sse2)
-+sym(vp8_filter_block1d16_h6_only_sse2):
- push rbp
- mov rbp, rsp
-- SHADOW_ARGS_TO_STACK 5
-+ SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-+ mov rdx, arg(5) ;vp8_filter
- mov rsi, arg(0) ;src_ptr
-- mov rdi, arg(1) ;output_ptr
-
-- movsxd rcx, dword ptr arg(3) ;output_height
-- movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
-+ mov rdi, arg(2) ;output_ptr
-
-- pxor xmm0, xmm0 ; clear xmm0 for unpack
-+ movsxd rcx, dword ptr arg(4) ;output_height
-+ movsxd rax, dword ptr arg(1) ;src_pixels_per_line ; Pitch for Source
- %if ABI_IS_32BIT=0
-- movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
-+ movsxd r8, dword ptr arg(3) ;dst_ptich
- %endif
-
--unpack_block1d8_h6_sse2_rowloop:
-- movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
-- lea rsi, [rsi + rax]
-+ pxor xmm0, xmm0 ; clear xmm0 for unpack
-
-- punpcklbw xmm1, xmm0
-- movdqa XMMWORD Ptr [rdi], xmm1
-+filter_block1d16_h6_only_sse2_rowloop:
-+ movq xmm3, MMWORD PTR [rsi - 2]
-+ movq xmm1, MMWORD PTR [rsi + 6]
-+
-+ movq xmm2, MMWORD PTR [rsi +14]
-+ pslldq xmm2, 8
-+
-+ por xmm2, xmm1
-+ prefetcht2 [rsi+rax-2]
-+
-+ pslldq xmm1, 8
-+ por xmm1, xmm3
-
-+ movdqa xmm4, xmm1
-+ movdqa xmm5, xmm1
-+
-+ movdqa xmm6, xmm1
-+ movdqa xmm7, xmm1
-+
-+ punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
-+ psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-+
-+ pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
-+ punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-+
-+ psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
-+ pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-+
-+ punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
-+ psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-+
-+ pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-+
-+ punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
-+ psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-+
-+ pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-+
-+ punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
-+ psrldq xmm1, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-+
-+ pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-+
-+ punpcklbw xmm1, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
-+ pmullw xmm1, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-+
-+ paddsw xmm4, xmm7
-+ paddsw xmm4, xmm5
-+
-+ paddsw xmm4, xmm3
-+ paddsw xmm4, xmm6
-+
-+ paddsw xmm4, xmm1
-+ paddsw xmm4, [rd GLOBAL]
-+
-+ psraw xmm4, 7
-+
-+ packuswb xmm4, xmm0 ; lower 8 bytes
-+
-+ movq QWORD Ptr [rdi], xmm4 ; store the results in the destination
-+
-+ movdqa xmm3, xmm2
-+ movdqa xmm4, xmm2
-+
-+ movdqa xmm5, xmm2
-+ movdqa xmm6, xmm2
-+
-+ movdqa xmm7, xmm2
-+
-+ punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
-+ psrldq xmm4, 1 ; xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1
-+
-+ pmullw xmm3, XMMWORD PTR [rdx] ; x[-2] * H[-2]; Tap 1
-+ punpcklbw xmm4, xmm0 ; xx06 xx05 xx04 xx03 xx02 xx01 xx00 xx-1
-+
-+ psrldq xmm5, 2 ; xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00
-+ pmullw xmm4, XMMWORD PTR [rdx+16] ; x[-1] * H[-1]; Tap 2
-+
-+ punpcklbw xmm5, xmm0 ; xx07 xx06 xx05 xx04 xx03 xx02 xx01 xx00
-+ psrldq xmm6, 3 ; xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01
-+
-+ pmullw xmm5, [rdx+32] ; x[ 0] * H[ 0]; Tap 3
-+
-+ punpcklbw xmm6, xmm0 ; xx08 xx07 xx06 xx05 xx04 xx03 xx02 xx01
-+ psrldq xmm7, 4 ; xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03 02
-+
-+ pmullw xmm6, [rdx+48] ; x[ 1] * h[ 1] ; Tap 4
-+
-+ punpcklbw xmm7, xmm0 ; xx09 xx08 xx07 xx06 xx05 xx04 xx03 xx02
-+ psrldq xmm2, 5 ; xx xx xx xx xx 0d 0c 0b 0a 09 08 07 06 05 04 03
-+
-+ pmullw xmm7, [rdx+64] ; x[ 2] * h[ 2] ; Tap 5
-+
-+ punpcklbw xmm2, xmm0 ; xx0a xx09 xx08 xx07 xx06 xx05 xx04 xx03
-+ pmullw xmm2, [rdx+80] ; x[ 3] * h[ 3] ; Tap 6
-+
-+ paddsw xmm4, xmm7
-+ paddsw xmm4, xmm5
-+
-+ paddsw xmm4, xmm3
-+ paddsw xmm4, xmm6
-+
-+ paddsw xmm4, xmm2
-+ paddsw xmm4, [rd GLOBAL]
-+
-+ psraw xmm4, 7
-+
-+ packuswb xmm4, xmm0 ; higher 8 bytes
-+
-+ movq QWORD Ptr [rdi+8], xmm4 ; store the results in the destination
-+
-+ lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
-- add rdi, DWORD Ptr arg(4) ;[output_width]
-+ add rdi, DWORD Ptr arg(3) ;dst_ptich
- %else
- add rdi, r8
- %endif
-+
- dec rcx
-- jnz unpack_block1d8_h6_sse2_rowloop ; next row
-+ jnz filter_block1d16_h6_only_sse2_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
--;void vp8_pack_block1d8_v6_sse2
-+;void vp8_filter_block1d8_v6_only_sse2
- ;(
--; short *src_ptr,
-+; unsigned char *src_ptr,
-+; unsigned int src_pixels_per_line,
- ; unsigned char *output_ptr,
- ; int dst_ptich,
--; unsigned int pixels_per_line,
- ; unsigned int output_height,
--; unsigned int output_width
-+; const short *vp8_filter
- ;)
--global sym(vp8_pack_block1d8_v6_sse2)
--sym(vp8_pack_block1d8_v6_sse2):
-+; Second-pass filter only when xoffset==0
-+global sym(vp8_filter_block1d8_v6_only_sse2)
-+sym(vp8_filter_block1d8_v6_only_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-- movsxd rdx, dword ptr arg(3) ;pixels_per_line
-- mov rdi, arg(1) ;output_ptr
--
- mov rsi, arg(0) ;src_ptr
-- movsxd rcx, DWORD PTR arg(4) ;[output_height]
-+ mov rdi, arg(2) ;output_ptr
-+
-+ movsxd rcx, dword ptr arg(4) ;output_height
-+ movsxd rdx, dword ptr arg(1) ;src_pixels_per_line
-+
-+ mov rax, arg(5) ;vp8_filter
-+
-+ pxor xmm0, xmm0 ; clear xmm0
-+
-+ movdqa xmm7, XMMWORD PTR [rd GLOBAL]
- %if ABI_IS_32BIT=0
-- movsxd r8, dword ptr arg(5) ;output_width ; Pitch for Source
-+ movsxd r8, dword ptr arg(3) ; dst_ptich
- %endif
-
--pack_block1d8_v6_sse2_loop:
-- movdqa xmm0, XMMWORD PTR [rsi]
-- packuswb xmm0, xmm0
-+vp8_filter_block1d8_v6_only_sse2_loop:
-+ movq xmm1, MMWORD PTR [rsi]
-+ movq xmm2, MMWORD PTR [rsi + rdx]
-+ movq xmm3, MMWORD PTR [rsi + rdx * 2]
-+ movq xmm5, MMWORD PTR [rsi + rdx * 4]
-+ add rsi, rdx
-+ movq xmm4, MMWORD PTR [rsi + rdx * 2]
-+ movq xmm6, MMWORD PTR [rsi + rdx * 4]
-+
-+ punpcklbw xmm1, xmm0
-+ pmullw xmm1, [rax]
-+
-+ punpcklbw xmm2, xmm0
-+ pmullw xmm2, [rax + 16]
-+
-+ punpcklbw xmm3, xmm0
-+ pmullw xmm3, [rax + 32]
-+
-+ punpcklbw xmm5, xmm0
-+ pmullw xmm5, [rax + 64]
-+
-+ punpcklbw xmm4, xmm0
-+ pmullw xmm4, [rax + 48]
-+
-+ punpcklbw xmm6, xmm0
-+ pmullw xmm6, [rax + 80]
-+
-+ paddsw xmm2, xmm5
-+ paddsw xmm2, xmm3
-+
-+ paddsw xmm2, xmm1
-+ paddsw xmm2, xmm4
-+
-+ paddsw xmm2, xmm6
-+ paddsw xmm2, xmm7
-
-- movq QWORD PTR [rdi], xmm0 ; store the results in the destination
-- lea rsi, [rsi+rdx]
-+ psraw xmm2, 7
-+ packuswb xmm2, xmm0 ; pack and saturate
-
-+ movq QWORD PTR [rdi], xmm2 ; store the results in the destination
- %if ABI_IS_32BIT
-- add rdi, DWORD Ptr arg(5) ;[output_width]
-+ add rdi, DWORD PTR arg(3) ;[dst_ptich]
- %else
- add rdi, r8
- %endif
- dec rcx ; decrement count
-- jnz pack_block1d8_v6_sse2_loop ; next row
-+ jnz vp8_filter_block1d8_v6_only_sse2_loop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-
-
--;void vp8_pack_block1d16_v6_sse2
-+;void vp8_unpack_block1d16_h6_sse2
- ;(
--; short *src_ptr,
--; unsigned char *output_ptr,
--; int dst_ptich,
--; unsigned int pixels_per_line,
--; unsigned int output_height,
--; unsigned int output_width
-+; unsigned char *src_ptr,
-+; unsigned short *output_ptr,
-+; unsigned int src_pixels_per_line,
-+; unsigned int output_height,
-+; unsigned int output_width
- ;)
--global sym(vp8_pack_block1d16_v6_sse2)
--sym(vp8_pack_block1d16_v6_sse2):
-+global sym(vp8_unpack_block1d16_h6_sse2)
-+sym(vp8_unpack_block1d16_h6_sse2):
- push rbp
- mov rbp, rsp
-- SHADOW_ARGS_TO_STACK 6
-+ SHADOW_ARGS_TO_STACK 5
-+ ;SAVE_XMM ;xmm6, xmm7 are not used here.
- GET_GOT rbx
- push rsi
- push rdi
- ; end prolog
-
-- movsxd rdx, dword ptr arg(3) ;pixels_per_line
-+ mov rsi, arg(0) ;src_ptr
- mov rdi, arg(1) ;output_ptr
-
-- mov rsi, arg(0) ;src_ptr
-- movsxd rcx, DWORD PTR arg(4) ;[output_height]
-+ movsxd rcx, dword ptr arg(3) ;output_height
-+ movsxd rax, dword ptr arg(2) ;src_pixels_per_line ; Pitch for Source
-+
-+ pxor xmm0, xmm0 ; clear xmm0 for unpack
- %if ABI_IS_32BIT=0
-- movsxd r8, dword ptr arg(2) ;dst_pitch
-+ movsxd r8, dword ptr arg(4) ;output_width ; Pitch for Source
- %endif
-
--pack_block1d16_v6_sse2_loop:
-- movdqa xmm0, XMMWORD PTR [rsi]
-- movdqa xmm1, XMMWORD PTR [rsi+16]
-+unpack_block1d16_h6_sse2_rowloop:
-+ movq xmm1, MMWORD PTR [rsi] ; 0d 0c 0b 0a 09 08 07 06 05 04 03 02 01 00 -1 -2
-+ movq xmm3, MMWORD PTR [rsi+8] ; make copy of xmm1
-+
-+ punpcklbw xmm3, xmm0 ; xx05 xx04 xx03 xx02 xx01 xx01 xx-1 xx-2
-+ punpcklbw xmm1, xmm0
-
-- packuswb xmm0, xmm1
-- movdqa XMMWORD PTR [rdi], xmm0 ; store the results in the destination
-+ movdqa XMMWORD Ptr [rdi], xmm1
-+ movdqa XMMWORD Ptr [rdi + 16], xmm3
-
-- add rsi, rdx
-+ lea rsi, [rsi + rax]
- %if ABI_IS_32BIT
-- add rdi, DWORD Ptr arg(2) ;dst_pitch
-+ add rdi, DWORD Ptr arg(4) ;[output_width]
- %else
- add rdi, r8
- %endif
-- dec rcx ; decrement count
-- jnz pack_block1d16_v6_sse2_loop ; next row
-+ dec rcx
-+ jnz unpack_block1d16_h6_sse2_rowloop ; next row
-
- ; begin epilog
- pop rdi
- pop rsi
- RESTORE_GOT
-+ ;RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -631,6 +969,7 @@ sym(vp8_bilinear_predict16x16_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -878,6 +1217,7 @@ done:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-@@ -898,6 +1238,7 @@ sym(vp8_bilinear_predict8x8_sse2):
- push rbp
- mov rbp, rsp
- SHADOW_ARGS_TO_STACK 6
-+ SAVE_XMM
- GET_GOT rbx
- push rsi
- push rdi
-@@ -1021,6 +1362,7 @@ next_row8x8:
- pop rdi
- pop rsi
- RESTORE_GOT
-+ RESTORE_XMM
- UNSHADOW_ARGS
- pop rbp
- ret
-diff --git a/vp8/common/x86/subpixel_x86.h b/vp8/common/x86/subpixel_x86.h
-index efa7b2e..bd6859c 100644
---- a/vp8/common/x86/subpixel_x86.h
-+++ b/vp8/common/x86/subpixel_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/common/x86/vp8_asm_stubs.c b/vp8/common/x86/vp8_asm_stubs.c
-index 68454f7..163ec5b 100644
---- a/vp8/common/x86/vp8_asm_stubs.c
-+++ b/vp8/common/x86/vp8_asm_stubs.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -67,6 +68,17 @@ extern void vp8_filter_block1d8_v6_sse2
- unsigned int output_width,
- const short *vp8_filter
- );
-+extern void vp8_filter_block1d16_v6_sse2
-+(
-+ unsigned short *src_ptr,
-+ unsigned char *output_ptr,
-+ int dst_ptich,
-+ unsigned int pixels_per_line,
-+ unsigned int pixel_step,
-+ unsigned int output_height,
-+ unsigned int output_width,
-+ const short *vp8_filter
-+);
- extern void vp8_unpack_block1d16_h6_sse2
- (
- unsigned char *src_ptr,
-@@ -75,31 +87,32 @@ extern void vp8_unpack_block1d16_h6_sse2
- unsigned int output_height,
- unsigned int output_width
- );
--extern void vp8_unpack_block1d8_h6_sse2
-+extern void vp8_filter_block1d8_h6_only_sse2
- (
- unsigned char *src_ptr,
-- unsigned short *output_ptr,
- unsigned int src_pixels_per_line,
-+ unsigned char *output_ptr,
-+ int dst_ptich,
- unsigned int output_height,
-- unsigned int output_width
-+ const short *vp8_filter
- );
--extern void vp8_pack_block1d8_v6_sse2
-+extern void vp8_filter_block1d16_h6_only_sse2
- (
-- unsigned short *src_ptr,
-- unsigned char *output_ptr,
-+ unsigned char *src_ptr,
-+ unsigned int src_pixels_per_line,
-+ unsigned char *output_ptr,
- int dst_ptich,
-- unsigned int pixels_per_line,
-- unsigned int output_height,
-- unsigned int output_width
-+ unsigned int output_height,
-+ const short *vp8_filter
- );
--extern void vp8_pack_block1d16_v6_sse2
-+extern void vp8_filter_block1d8_v6_only_sse2
- (
-- unsigned short *src_ptr,
-+ unsigned char *src_ptr,
-+ unsigned int src_pixels_per_line,
- unsigned char *output_ptr,
- int dst_ptich,
-- unsigned int pixels_per_line,
-- unsigned int output_height,
-- unsigned int output_width
-+ unsigned int output_height,
-+ const short *vp8_filter
- );
- extern prototype_subpixel_predict(vp8_bilinear_predict8x8_mmx);
-
-@@ -246,23 +259,26 @@ void vp8_sixtap_predict16x16_sse2
-
- if (xoffset)
- {
-- HFilter = vp8_six_tap_mmx[xoffset];
-- vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
-+ if (yoffset)
-+ {
-+ HFilter = vp8_six_tap_mmx[xoffset];
-+ vp8_filter_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 21, 32, HFilter);
-+ VFilter = vp8_six_tap_mmx[yoffset];
-+ vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
-+ }
-+ else
-+ {
-+ // First-pass only
-+ HFilter = vp8_six_tap_mmx[xoffset];
-+ vp8_filter_block1d16_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 16, HFilter);
-+ }
- }
- else
- {
-- vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
-- }
--
-- if (yoffset)
-- {
-+ // Second-pass only
- VFilter = vp8_six_tap_mmx[yoffset];
-- vp8_filter_block1d8_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, 16, VFilter);
-- vp8_filter_block1d8_v6_sse2(FData2 + 40, dst_ptr + 8, dst_pitch, 32, 16 , 16, 16, VFilter);
-- }
-- else
-- {
-- vp8_pack_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16, 16);
-+ vp8_unpack_block1d16_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 21, 32);
-+ vp8_filter_block1d16_v6_sse2(FData2 + 32, dst_ptr, dst_pitch, 32, 16 , 16, dst_pitch, VFilter);
- }
- }
-
-@@ -282,25 +298,26 @@ void vp8_sixtap_predict8x8_sse2
-
- if (xoffset)
- {
-- HFilter = vp8_six_tap_mmx[xoffset];
-- vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
-+ if (yoffset)
-+ {
-+ HFilter = vp8_six_tap_mmx[xoffset];
-+ vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 13, 16, HFilter);
-+ VFilter = vp8_six_tap_mmx[yoffset];
-+ vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, dst_pitch, VFilter);
-+ }
-+ else
-+ {
-+ // First-pass only
-+ HFilter = vp8_six_tap_mmx[xoffset];
-+ vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 8, HFilter);
-+ }
- }
- else
- {
-- vp8_unpack_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 13, 16);
-- }
--
-- if (yoffset)
-- {
-+ // Second-pass only
- VFilter = vp8_six_tap_mmx[yoffset];
-- vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 8, dst_pitch, VFilter);
-- }
-- else
-- {
-- vp8_pack_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8, dst_pitch);
-+ vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 8, VFilter);
- }
--
--
- }
-
-
-@@ -319,24 +336,26 @@ void vp8_sixtap_predict8x4_sse2
-
- if (xoffset)
- {
-- HFilter = vp8_six_tap_mmx[xoffset];
-- vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
-+ if (yoffset)
-+ {
-+ HFilter = vp8_six_tap_mmx[xoffset];
-+ vp8_filter_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 1, 9, 16, HFilter);
-+ VFilter = vp8_six_tap_mmx[yoffset];
-+ vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, dst_pitch, VFilter);
-+ }
-+ else
-+ {
-+ // First-pass only
-+ HFilter = vp8_six_tap_mmx[xoffset];
-+ vp8_filter_block1d8_h6_only_sse2(src_ptr, src_pixels_per_line, dst_ptr, dst_pitch, 4, HFilter);
-+ }
- }
- else
- {
-- vp8_unpack_block1d8_h6_sse2(src_ptr - (2 * src_pixels_per_line), FData2, src_pixels_per_line, 9, 16);
-- }
--
-- if (yoffset)
-- {
-+ // Second-pass only
- VFilter = vp8_six_tap_mmx[yoffset];
-- vp8_filter_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 8 , 4, dst_pitch, VFilter);
-+ vp8_filter_block1d8_v6_only_sse2(src_ptr - (2 * src_pixels_per_line), src_pixels_per_line, dst_ptr, dst_pitch, 4, VFilter);
- }
-- else
-- {
-- vp8_pack_block1d8_v6_sse2(FData2 + 16, dst_ptr, dst_pitch, 16, 4, dst_pitch);
-- }
--
--
- }
-+
- #endif
-diff --git a/vp8/common/x86/x86_systemdependent.c b/vp8/common/x86/x86_systemdependent.c
-index 5312e06..09ff3c5 100644
---- a/vp8/common/x86/x86_systemdependent.c
-+++ b/vp8/common/x86/x86_systemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/arm/armv5/dequantize_v5.asm b/vp8/decoder/arm/armv5/dequantize_v5.asm
-index eb3f030..80b2e0c 100644
---- a/vp8/decoder/arm/armv5/dequantize_v5.asm
-+++ b/vp8/decoder/arm/armv5/dequantize_v5.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/armv6/dboolhuff_v6.asm b/vp8/decoder/arm/armv6/dboolhuff_v6.asm
-index 143e33e..eca8eeb 100644
---- a/vp8/decoder/arm/armv6/dboolhuff_v6.asm
-+++ b/vp8/decoder/arm/armv6/dboolhuff_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/armv6/dequantdcidct_v6.asm b/vp8/decoder/arm/armv6/dequantdcidct_v6.asm
-index 3daa9b3..c5b0b7b 100644
---- a/vp8/decoder/arm/armv6/dequantdcidct_v6.asm
-+++ b/vp8/decoder/arm/armv6/dequantdcidct_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/armv6/dequantidct_v6.asm b/vp8/decoder/arm/armv6/dequantidct_v6.asm
-index 61bb48d..0d1c6b4 100644
---- a/vp8/decoder/arm/armv6/dequantidct_v6.asm
-+++ b/vp8/decoder/arm/armv6/dequantidct_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/armv6/dequantize_v6.asm b/vp8/decoder/arm/armv6/dequantize_v6.asm
-index 95e3859..c35e7c6 100644
---- a/vp8/decoder/arm/armv6/dequantize_v6.asm
-+++ b/vp8/decoder/arm/armv6/dequantize_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/dequantize_arm.c b/vp8/decoder/arm/dequantize_arm.c
-index 54006a9..913267d 100644
---- a/vp8/decoder/arm/dequantize_arm.c
-+++ b/vp8/decoder/arm/dequantize_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/arm/dequantize_arm.h b/vp8/decoder/arm/dequantize_arm.h
-index c8a61a4..ae7cf8e 100644
---- a/vp8/decoder/arm/dequantize_arm.h
-+++ b/vp8/decoder/arm/dequantize_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/arm/detokenizearm_sjl.c b/vp8/decoder/arm/detokenizearm_sjl.c
-index c714452..a126a05 100644
---- a/vp8/decoder/arm/detokenizearm_sjl.c
-+++ b/vp8/decoder/arm/detokenizearm_sjl.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/arm/detokenizearm_v6.asm b/vp8/decoder/arm/detokenizearm_v6.asm
-index 4d87ee5..439c9ab 100644
---- a/vp8/decoder/arm/detokenizearm_v6.asm
-+++ b/vp8/decoder/arm/detokenizearm_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/dsystemdependent.c b/vp8/decoder/arm/dsystemdependent.c
-index 455c83a..f146d60 100644
---- a/vp8/decoder/arm/dsystemdependent.c
-+++ b/vp8/decoder/arm/dsystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/arm/neon/dboolhuff_neon.asm b/vp8/decoder/arm/neon/dboolhuff_neon.asm
-index 7ec62a3..01315a4 100644
---- a/vp8/decoder/arm/neon/dboolhuff_neon.asm
-+++ b/vp8/decoder/arm/neon/dboolhuff_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/neon/dequantdcidct_neon.asm b/vp8/decoder/arm/neon/dequantdcidct_neon.asm
-index 3392f2c..482f02d 100644
---- a/vp8/decoder/arm/neon/dequantdcidct_neon.asm
-+++ b/vp8/decoder/arm/neon/dequantdcidct_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/neon/dequantidct_neon.asm b/vp8/decoder/arm/neon/dequantidct_neon.asm
-index bba4d5d..3d00dbf 100644
---- a/vp8/decoder/arm/neon/dequantidct_neon.asm
-+++ b/vp8/decoder/arm/neon/dequantidct_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/arm/neon/dequantizeb_neon.asm b/vp8/decoder/arm/neon/dequantizeb_neon.asm
-index 1bde946..14698f8 100644
---- a/vp8/decoder/arm/neon/dequantizeb_neon.asm
-+++ b/vp8/decoder/arm/neon/dequantizeb_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/dboolhuff.c b/vp8/decoder/dboolhuff.c
-index 442054e..7027c0f 100644
---- a/vp8/decoder/dboolhuff.c
-+++ b/vp8/decoder/dboolhuff.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
-index f5c9822..c6d69e7 100644
---- a/vp8/decoder/dboolhuff.h
-+++ b/vp8/decoder/dboolhuff.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -12,7 +13,7 @@
- #define DBOOLHUFF_H
- #include "vpx_ports/config.h"
- #include "vpx_ports/mem.h"
--#include "vpx_ports/vpx_integer.h"
-+#include "vpx/vpx_integer.h"
-
- /* Size of the bool decoder backing storage
- *
-diff --git a/vp8/decoder/decodemv.c b/vp8/decoder/decodemv.c
-index 6035f3e..7e00423 100644
---- a/vp8/decoder/decodemv.c
-+++ b/vp8/decoder/decodemv.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -170,6 +171,7 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
- VP8_COMMON *const pc = &pbi->common;
- MACROBLOCKD *xd = &pbi->mb;
-
-+ mbmi->need_to_clamp_mvs = 0;
- vp8dx_bool_decoder_fill(bc);
-
- // Distance of Mb to the various image edges.
-@@ -268,6 +270,17 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
- break;
- }
-
-+ if (mv->col < xd->mb_to_left_edge
-+ - LEFT_TOP_MARGIN
-+ || mv->col > xd->mb_to_right_edge
-+ + RIGHT_BOTTOM_MARGIN
-+ || mv->row < xd->mb_to_top_edge
-+ - LEFT_TOP_MARGIN
-+ || mv->row > xd->mb_to_bottom_edge
-+ + RIGHT_BOTTOM_MARGIN
-+ )
-+ mbmi->need_to_clamp_mvs = 1;
-+
- /* Fill (uniform) modes, mvs of jth subset.
- Must do it here because ensuing subsets can
- refer back to us via "left" or "above". */
-@@ -324,27 +337,18 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
- read_mv(bc, mv, (const MV_CONTEXT *) mvc);
- mv->row += best_mv.row;
- mv->col += best_mv.col;
-- /* Encoder should not produce invalid motion vectors, but since
-- * arbitrary length MVs can be parsed from the bitstream, we
-- * need to clamp them here in case we're reading bad data to
-- * avoid a crash.
-- */
--#if CONFIG_DEBUG
-- assert(mv->col >= (xd->mb_to_left_edge - LEFT_TOP_MARGIN));
-- assert(mv->col <= (xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN));
-- assert(mv->row >= (xd->mb_to_top_edge - LEFT_TOP_MARGIN));
-- assert(mv->row <= (xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN));
--#endif
-
-- if (mv->col < (xd->mb_to_left_edge - LEFT_TOP_MARGIN))
-- mv->col = xd->mb_to_left_edge - LEFT_TOP_MARGIN;
-- else if (mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN)
-- mv->col = xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN;
--
-- if (mv->row < (xd->mb_to_top_edge - LEFT_TOP_MARGIN))
-- mv->row = xd->mb_to_top_edge - LEFT_TOP_MARGIN;
-- else if (mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN)
-- mv->row = xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN;
-+ /* Don't need to check this on NEARMV and NEARESTMV modes
-+ * since those modes clamp the MV. The NEWMV mode does not,
-+ * so signal to the prediction stage whether special
-+ * handling may be required.
-+ */
-+ if (mv->col < xd->mb_to_left_edge - LEFT_TOP_MARGIN
-+ || mv->col > xd->mb_to_right_edge + RIGHT_BOTTOM_MARGIN
-+ || mv->row < xd->mb_to_top_edge - LEFT_TOP_MARGIN
-+ || mv->row > xd->mb_to_bottom_edge + RIGHT_BOTTOM_MARGIN
-+ )
-+ mbmi->need_to_clamp_mvs = 1;
-
- propagate_mv: /* same MV throughout */
- {
-@@ -380,7 +384,6 @@ void vp8_decode_mode_mvs(VP8D_COMP *pbi)
- assert(0);
- #endif
- }
--
- }
- else
- {
-diff --git a/vp8/decoder/decodemv.h b/vp8/decoder/decodemv.h
-index 4030071..8b7fb68 100644
---- a/vp8/decoder/decodemv.h
-+++ b/vp8/decoder/decodemv.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/decoderthreading.h b/vp8/decoder/decoderthreading.h
-index ebc5c27..6c0363b 100644
---- a/vp8/decoder/decoderthreading.h
-+++ b/vp8/decoder/decoderthreading.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c
-index 4edf4f6..0f1b879 100644
---- a/vp8/decoder/decodframe.c
-+++ b/vp8/decoder/decodframe.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -125,6 +126,62 @@ static void skip_recon_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
- }
- }
-
-+
-+static void clamp_mv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
-+{
-+ /* If the MV points so far into the UMV border that no visible pixels
-+ * are used for reconstruction, the subpel part of the MV can be
-+ * discarded and the MV limited to 16 pixels with equivalent results.
-+ *
-+ * This limit kicks in at 19 pixels for the top and left edges, for
-+ * the 16 pixels plus 3 taps right of the central pixel when subpel
-+ * filtering. The bottom and right edges use 16 pixels plus 2 pixels
-+ * left of the central pixel when filtering.
-+ */
-+ if (mv->col < (xd->mb_to_left_edge - (19 << 3)))
-+ mv->col = xd->mb_to_left_edge - (16 << 3);
-+ else if (mv->col > xd->mb_to_right_edge + (18 << 3))
-+ mv->col = xd->mb_to_right_edge + (16 << 3);
-+
-+ if (mv->row < (xd->mb_to_top_edge - (19 << 3)))
-+ mv->row = xd->mb_to_top_edge - (16 << 3);
-+ else if (mv->row > xd->mb_to_bottom_edge + (18 << 3))
-+ mv->row = xd->mb_to_bottom_edge + (16 << 3);
-+}
-+
-+/* A version of the above function for chroma block MVs.*/
-+static void clamp_uvmv_to_umv_border(MV *mv, const MACROBLOCKD *xd)
-+{
-+ if (2*mv->col < (xd->mb_to_left_edge - (19 << 3)))
-+ mv->col = (xd->mb_to_left_edge - (16 << 3)) >> 1;
-+ else if (2*mv->col > xd->mb_to_right_edge + (18 << 3))
-+ mv->col = (xd->mb_to_right_edge + (16 << 3)) >> 1;
-+
-+ if (2*mv->row < (xd->mb_to_top_edge - (19 << 3)))
-+ mv->row = (xd->mb_to_top_edge - (16 << 3)) >> 1;
-+ else if (2*mv->row > xd->mb_to_bottom_edge + (18 << 3))
-+ mv->row = (xd->mb_to_bottom_edge + (16 << 3)) >> 1;
-+}
-+
-+static void clamp_mvs(MACROBLOCKD *xd)
-+{
-+ if (xd->mbmi.mode == SPLITMV)
-+ {
-+ int i;
-+
-+ for (i=0; i<16; i++)
-+ clamp_mv_to_umv_border(&xd->block[i].bmi.mv.as_mv, xd);
-+ for (i=16; i<24; i++)
-+ clamp_uvmv_to_umv_border(&xd->block[i].bmi.mv.as_mv, xd);
-+ }
-+ else
-+ {
-+ clamp_mv_to_umv_border(&xd->mbmi.mv.as_mv, xd);
-+ clamp_uvmv_to_umv_border(&xd->block[16].bmi.mv.as_mv, xd);
-+ }
-+
-+}
-+
- static void reconstruct_mb(VP8D_COMP *pbi, MACROBLOCKD *xd)
- {
- if (xd->frame_type == KEY_FRAME || xd->mbmi.ref_frame == INTRA_FRAME)
-@@ -232,6 +289,8 @@ static void de_quantand_idct(VP8D_COMP *pbi, MACROBLOCKD *xd)
- void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
- {
- int eobtotal = 0;
-+ MV orig_mvs[24];
-+ int i, do_clamp = xd->mbmi.need_to_clamp_mvs;
-
- if (xd->mbmi.mb_skip_coeff)
- {
-@@ -242,20 +301,49 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
- eobtotal = vp8_decode_mb_tokens(pbi, xd);
- }
-
-+ /* Perform temporary clamping of the MV to be used for prediction */
-+ if (do_clamp)
-+ {
-+ if (xd->mbmi.mode == SPLITMV)
-+ for (i=0; i<24; i++)
-+ orig_mvs[i] = xd->block[i].bmi.mv.as_mv;
-+ else
-+ {
-+ orig_mvs[0] = xd->mbmi.mv.as_mv;
-+ orig_mvs[1] = xd->block[16].bmi.mv.as_mv;
-+ }
-+ clamp_mvs(xd);
-+ }
-+
- xd->mode_info_context->mbmi.dc_diff = 1;
-
- if (xd->mbmi.mode != B_PRED && xd->mbmi.mode != SPLITMV && eobtotal == 0)
- {
- xd->mode_info_context->mbmi.dc_diff = 0;
- skip_recon_mb(pbi, xd);
-- return;
- }
-+ else
-+ {
-+ if (xd->segmentation_enabled)
-+ mb_init_dequantizer(pbi, xd);
-
-- if (xd->segmentation_enabled)
-- mb_init_dequantizer(pbi, xd);
-+ de_quantand_idct(pbi, xd);
-+ reconstruct_mb(pbi, xd);
-+ }
-
-- de_quantand_idct(pbi, xd);
-- reconstruct_mb(pbi, xd);
-+
-+ /* Restore the original MV so as not to affect the entropy context. */
-+ if (do_clamp)
-+ {
-+ if (xd->mbmi.mode == SPLITMV)
-+ for (i=0; i<24; i++)
-+ xd->block[i].bmi.mv.as_mv = orig_mvs[i];
-+ else
-+ {
-+ xd->mbmi.mv.as_mv = orig_mvs[0];
-+ xd->block[16].bmi.mv.as_mv = orig_mvs[1];
-+ }
-+ }
- }
-
- static int get_delta_q(vp8_reader *bc, int prev, int *q_update)
-@@ -313,7 +401,9 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
- for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
- {
- // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
-- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi, 32); //sizeof(MB_MODE_INFO) );
-+ // the partition_bmi array is unused in the decoder, so don't copy it.
-+ vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
-+ sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
-
- if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
- {
-@@ -360,7 +450,7 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
- vp8_build_uvmvs(xd, pc->full_pixel);
-
- /*
-- if(pbi->common.current_video_frame==0 &&mb_col==1 && mb_row==0)
-+ if(pc->current_video_frame==0 &&mb_col==1 && mb_row==0)
- pbi->debugoutput =1;
- else
- pbi->debugoutput =0;
-@@ -609,7 +699,7 @@ int vp8_decode_frame(VP8D_COMP *pbi)
- "Invalid frame height");
- }
-
-- if (vp8_alloc_frame_buffers(&pbi->common, pc->Width, pc->Height))
-+ if (vp8_alloc_frame_buffers(pc, pc->Width, pc->Height))
- vpx_internal_error(&pc->error, VPX_CODEC_MEM_ERROR,
- "Failed to allocate frame buffers");
- }
-@@ -846,17 +936,17 @@ int vp8_decode_frame(VP8D_COMP *pbi)
- vpx_memcpy(&xd->block[0].bmi, &xd->mode_info_context->bmi[0], sizeof(B_MODE_INFO));
-
-
-- if (pbi->b_multithreaded_lf && pbi->common.filter_level != 0)
-+ if (pbi->b_multithreaded_lf && pc->filter_level != 0)
- vp8_start_lfthread(pbi);
-
-- if (pbi->b_multithreaded_rd && pbi->common.multi_token_partition != ONE_PARTITION)
-+ if (pbi->b_multithreaded_rd && pc->multi_token_partition != ONE_PARTITION)
- {
- vp8_mtdecode_mb_rows(pbi, xd);
- }
- else
- {
- int ibc = 0;
-- int num_part = 1 << pbi->common.multi_token_partition;
-+ int num_part = 1 << pc->multi_token_partition;
-
- // Decode the individual macro block
- for (mb_row = 0; mb_row < pc->mb_rows; mb_row++)
-@@ -885,8 +975,11 @@ int vp8_decode_frame(VP8D_COMP *pbi)
- // vpx_log("Decoder: Frame Decoded, Size Roughly:%d bytes \n",bc->pos+pbi->bc2.pos);
-
- // If this was a kf or Gf note the Q used
-- if ((pc->frame_type == KEY_FRAME) || (pc->refresh_golden_frame) || pbi->common.refresh_alt_ref_frame)
-+ if ((pc->frame_type == KEY_FRAME) ||
-+ pc->refresh_golden_frame || pc->refresh_alt_ref_frame)
-+ {
- pc->last_kf_gf_q = pc->base_qindex;
-+ }
-
- if (pc->refresh_entropy_probs == 0)
- {
-diff --git a/vp8/decoder/demode.c b/vp8/decoder/demode.c
-index fd05e6d..881b49e 100644
---- a/vp8/decoder/demode.c
-+++ b/vp8/decoder/demode.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/demode.h b/vp8/decoder/demode.h
-index 51bbc5e..8d2fbee 100644
---- a/vp8/decoder/demode.h
-+++ b/vp8/decoder/demode.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c
-index 14798d9..2c286ec 100644
---- a/vp8/decoder/dequantize.c
-+++ b/vp8/decoder/dequantize.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/dequantize.h b/vp8/decoder/dequantize.h
-index d16b02e..7fd7cbb 100644
---- a/vp8/decoder/dequantize.h
-+++ b/vp8/decoder/dequantize.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c
-index a42f18d..d6f5ca2 100644
---- a/vp8/decoder/detokenize.c
-+++ b/vp8/decoder/detokenize.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -65,25 +66,43 @@ void vp8_reset_mb_tokens_context(MACROBLOCKD *x)
-
- ENTROPY_CONTEXT *a;
- ENTROPY_CONTEXT *l;
-- int i;
--
-- for (i = 0; i < 24; i++)
-- {
--
-- a = A[ vp8_block2context[i] ] + vp8_block2above[i];
-- l = L[ vp8_block2context[i] ] + vp8_block2left[i];
--
-- *a = *l = 0;
-- }
-
-+ /* Clear entropy contexts for Y blocks */
-+ a = A[Y1CONTEXT];
-+ l = L[Y1CONTEXT];
-+ *a = 0;
-+ *(a+1) = 0;
-+ *(a+2) = 0;
-+ *(a+3) = 0;
-+ *l = 0;
-+ *(l+1) = 0;
-+ *(l+2) = 0;
-+ *(l+3) = 0;
-+
-+ /* Clear entropy contexts for U blocks */
-+ a = A[UCONTEXT];
-+ l = L[UCONTEXT];
-+ *a = 0;
-+ *(a+1) = 0;
-+ *l = 0;
-+ *(l+1) = 0;
-+
-+ /* Clear entropy contexts for V blocks */
-+ a = A[VCONTEXT];
-+ l = L[VCONTEXT];
-+ *a = 0;
-+ *(a+1) = 0;
-+ *l = 0;
-+ *(l+1) = 0;
-+
-+ /* Clear entropy contexts for Y2 blocks */
- if (x->mbmi.mode != B_PRED && x->mbmi.mode != SPLITMV)
- {
-- a = A[Y2CONTEXT] + vp8_block2above[24];
-- l = L[Y2CONTEXT] + vp8_block2left[24];
-- *a = *l = 0;
-+ a = A[Y2CONTEXT];
-+ l = L[Y2CONTEXT];
-+ *a = 0;
-+ *l = 0;
- }
--
--
- }
- DECLARE_ALIGNED(16, extern const unsigned int, vp8dx_bitreader_norm[256]);
- #define NORMALIZE \
-diff --git a/vp8/decoder/detokenize.h b/vp8/decoder/detokenize.h
-index 6a9a476..6cfb66b 100644
---- a/vp8/decoder/detokenize.h
-+++ b/vp8/decoder/detokenize.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/generic/dsystemdependent.c b/vp8/decoder/generic/dsystemdependent.c
-index 302b64b..ad64a38 100644
---- a/vp8/decoder/generic/dsystemdependent.c
-+++ b/vp8/decoder/generic/dsystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
-index 6875585..76387f5 100644
---- a/vp8/decoder/onyxd_if.c
-+++ b/vp8/decoder/onyxd_if.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/onyxd_if_sjl.c b/vp8/decoder/onyxd_if_sjl.c
-index 363ad5d..12d28a5 100644
---- a/vp8/decoder/onyxd_if_sjl.c
-+++ b/vp8/decoder/onyxd_if_sjl.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h
-index fa4fa48..2eea614 100644
---- a/vp8/decoder/onyxd_int.h
-+++ b/vp8/decoder/onyxd_int.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/threading.c b/vp8/decoder/threading.c
-index e35d175..87bba20 100644
---- a/vp8/decoder/threading.c
-+++ b/vp8/decoder/threading.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -153,7 +154,9 @@ THREAD_FUNCTION vp8_thread_decoding_proc(void *p_data)
- }
-
- // Take a copy of the mode and Mv information for this macroblock into the xd->mbmi
-- vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi, 32); //sizeof(MB_MODE_INFO) );
-+ // the partition_bmi array is unused in the decoder, so don't copy it.
-+ vpx_memcpy(&xd->mbmi, &xd->mode_info_context->mbmi,
-+ sizeof(MB_MODE_INFO) - sizeof(xd->mbmi.partition_bmi));
-
- if (xd->mbmi.mode == SPLITMV || xd->mbmi.mode == B_PRED)
- {
-diff --git a/vp8/decoder/treereader.h b/vp8/decoder/treereader.h
-index eb10e24..f1893df 100644
---- a/vp8/decoder/treereader.h
-+++ b/vp8/decoder/treereader.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/x86/dequantize_mmx.asm b/vp8/decoder/x86/dequantize_mmx.asm
-index 02be487..1611e03 100644
---- a/vp8/decoder/x86/dequantize_mmx.asm
-+++ b/vp8/decoder/x86/dequantize_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/decoder/x86/dequantize_x86.h b/vp8/decoder/x86/dequantize_x86.h
-index 5def406..4c91633 100644
---- a/vp8/decoder/x86/dequantize_x86.h
-+++ b/vp8/decoder/x86/dequantize_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/x86/onyxdxv.c b/vp8/decoder/x86/onyxdxv.c
-index 75a676a..22d0548 100644
---- a/vp8/decoder/x86/onyxdxv.c
-+++ b/vp8/decoder/x86/onyxdxv.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/x86/x86_dsystemdependent.c b/vp8/decoder/x86/x86_dsystemdependent.c
-index 6d7cc36..2dfb469 100644
---- a/vp8/decoder/x86/x86_dsystemdependent.c
-+++ b/vp8/decoder/x86/x86_dsystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/xprintf.c b/vp8/decoder/xprintf.c
-index cb2221c..7465010 100644
---- a/vp8/decoder/xprintf.c
-+++ b/vp8/decoder/xprintf.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/decoder/xprintf.h b/vp8/decoder/xprintf.h
-index 2f175e9..7656075 100644
---- a/vp8/decoder/xprintf.h
-+++ b/vp8/decoder/xprintf.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/armv6/walsh_v6.asm b/vp8/encoder/arm/armv6/walsh_v6.asm
-index 608c9ae..461e492 100644
---- a/vp8/encoder/arm/armv6/walsh_v6.asm
-+++ b/vp8/encoder/arm/armv6/walsh_v6.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
- EXPORT |vp8_short_walsh4x4_armv6|
-diff --git a/vp8/encoder/arm/boolhuff_arm.c b/vp8/encoder/arm/boolhuff_arm.c
-index e70b3ad..8c0faff 100644
---- a/vp8/encoder/arm/boolhuff_arm.c
-+++ b/vp8/encoder/arm/boolhuff_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/csystemdependent.c b/vp8/encoder/arm/csystemdependent.c
-index 0039796..7fba995 100644
---- a/vp8/encoder/arm/csystemdependent.c
-+++ b/vp8/encoder/arm/csystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/dct_arm.h b/vp8/encoder/arm/dct_arm.h
-index a671862..bb60c9d 100644
---- a/vp8/encoder/arm/dct_arm.h
-+++ b/vp8/encoder/arm/dct_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/encodemb_arm.c b/vp8/encoder/arm/encodemb_arm.c
-index 3f1d053..7d58f94 100644
---- a/vp8/encoder/arm/encodemb_arm.c
-+++ b/vp8/encoder/arm/encodemb_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/encodemb_arm.h b/vp8/encoder/arm/encodemb_arm.h
-index 28f9e5c..525135a 100644
---- a/vp8/encoder/arm/encodemb_arm.h
-+++ b/vp8/encoder/arm/encodemb_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/mcomp_arm.c b/vp8/encoder/arm/mcomp_arm.c
-index 07f2186..9418a60 100644
---- a/vp8/encoder/arm/mcomp_arm.c
-+++ b/vp8/encoder/arm/mcomp_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/neon/boolhuff_armv7.asm b/vp8/encoder/arm/neon/boolhuff_armv7.asm
-index 9a5f366..674eea9 100644
---- a/vp8/encoder/arm/neon/boolhuff_armv7.asm
-+++ b/vp8/encoder/arm/neon/boolhuff_armv7.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/fastfdct4x4_neon.asm b/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
-index d5dec44..44e6dfc 100644
---- a/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
-+++ b/vp8/encoder/arm/neon/fastfdct4x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/fastfdct8x4_neon.asm b/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
-index de1c254..6a286f6 100644
---- a/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
-+++ b/vp8/encoder/arm/neon/fastfdct8x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/fastquantizeb_neon.asm b/vp8/encoder/arm/neon/fastquantizeb_neon.asm
-index 1107037..e3a94a6 100644
---- a/vp8/encoder/arm/neon/fastquantizeb_neon.asm
-+++ b/vp8/encoder/arm/neon/fastquantizeb_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/sad16_neon.asm b/vp8/encoder/arm/neon/sad16_neon.asm
-index 6169f10..7e2ab13 100644
---- a/vp8/encoder/arm/neon/sad16_neon.asm
-+++ b/vp8/encoder/arm/neon/sad16_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/sad8_neon.asm b/vp8/encoder/arm/neon/sad8_neon.asm
-index 28604dd..fc8c4e1 100644
---- a/vp8/encoder/arm/neon/sad8_neon.asm
-+++ b/vp8/encoder/arm/neon/sad8_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/shortfdct_neon.asm b/vp8/encoder/arm/neon/shortfdct_neon.asm
-index 26bc0d0..4399c97 100644
---- a/vp8/encoder/arm/neon/shortfdct_neon.asm
-+++ b/vp8/encoder/arm/neon/shortfdct_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/subtract_neon.asm b/vp8/encoder/arm/neon/subtract_neon.asm
-index 8781ca0..d4803ff 100644
---- a/vp8/encoder/arm/neon/subtract_neon.asm
-+++ b/vp8/encoder/arm/neon/subtract_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/variance_neon.asm b/vp8/encoder/arm/neon/variance_neon.asm
-index 64b83ca..b901693 100644
---- a/vp8/encoder/arm/neon/variance_neon.asm
-+++ b/vp8/encoder/arm/neon/variance_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_memcpy_neon.asm b/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
-index f26b4d7..0a372c3 100644
---- a/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
-+++ b/vp8/encoder/arm/neon/vp8_memcpy_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm b/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
-index f535967..087ea17 100644
---- a/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
-+++ b/vp8/encoder/arm/neon/vp8_mse16x16_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm b/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm
-index 9c52c52..bfa97d7 100644
---- a/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm
-+++ b/vp8/encoder/arm/neon/vp8_packtokens_armv7.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm b/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm
-index 92b0989..334c88f 100644
---- a/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm
-+++ b/vp8/encoder/arm/neon/vp8_packtokens_mbrow_armv7.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm b/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm
-index 6d5f882..267e216 100644
---- a/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm
-+++ b/vp8/encoder/arm/neon/vp8_packtokens_partitions_armv7.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm b/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
-index 5269c0a..ebd5dc1 100644
---- a/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
-+++ b/vp8/encoder/arm/neon/vp8_shortwalsh4x4_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-index aec716e..185277f 100644
---- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-index 3d02d7c..611b1e4 100644
---- a/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance16x16s_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-index bd56761..614d48f 100644
---- a/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-+++ b/vp8/encoder/arm/neon/vp8_subpixelvariance8x8_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/arm/picklpf_arm.c b/vp8/encoder/arm/picklpf_arm.c
-index 0586e55..fb0b3bd 100644
---- a/vp8/encoder/arm/picklpf_arm.c
-+++ b/vp8/encoder/arm/picklpf_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/quantize_arm.c b/vp8/encoder/arm/quantize_arm.c
-index 46906d3..e8bd44b 100644
---- a/vp8/encoder/arm/quantize_arm.c
-+++ b/vp8/encoder/arm/quantize_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/quantize_arm.h b/vp8/encoder/arm/quantize_arm.h
-index e93f0fe..14bc923 100644
---- a/vp8/encoder/arm/quantize_arm.h
-+++ b/vp8/encoder/arm/quantize_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/variance_arm.h b/vp8/encoder/arm/variance_arm.h
-index d9fc9b3..1c16020 100644
---- a/vp8/encoder/arm/variance_arm.h
-+++ b/vp8/encoder/arm/variance_arm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c b/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c
-index 8cdf079..28aac70 100644
---- a/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c
-+++ b/vp8/encoder/arm/vpx_vp8_enc_asm_offsets.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/bitstream.c b/vp8/encoder/bitstream.c
-index 31ad56a..ce9d2fd 100644
---- a/vp8/encoder/bitstream.c
-+++ b/vp8/encoder/bitstream.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -1385,8 +1386,6 @@ void vp8_pack_bitstream(VP8_COMP *cpi, unsigned char *dest, unsigned long *size)
- // every keyframe send startcode, width, height, scale factor, clamp and color type
- if (oh.type == KEY_FRAME)
- {
-- int w, h, hs, vs;
--
- // Start / synch code
- cx_data[0] = 0x9D;
- cx_data[1] = 0x01;
-diff --git a/vp8/encoder/bitstream.h b/vp8/encoder/bitstream.h
-index ee69f66..de4b94d 100644
---- a/vp8/encoder/bitstream.h
-+++ b/vp8/encoder/bitstream.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/block.h b/vp8/encoder/block.h
-index cc4cbe0..2e866dd 100644
---- a/vp8/encoder/block.h
-+++ b/vp8/encoder/block.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -101,11 +102,9 @@ typedef struct
- void (*vp8_short_fdct8x4)(short *input, short *output, int pitch);
- void (*short_fdct4x4rd)(short *input, short *output, int pitch);
- void (*short_fdct8x4rd)(short *input, short *output, int pitch);
-- void (*vp8_short_fdct4x4_ptr)(short *input, short *output, int pitch);
- void (*short_walsh4x4)(short *input, short *output, int pitch);
-
- void (*quantize_b)(BLOCK *b, BLOCKD *d);
-- void (*quantize_brd)(BLOCK *b, BLOCKD *d);
-
-
-
-diff --git a/vp8/encoder/boolhuff.c b/vp8/encoder/boolhuff.c
-index c101384..2e95c75 100644
---- a/vp8/encoder/boolhuff.c
-+++ b/vp8/encoder/boolhuff.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/boolhuff.h b/vp8/encoder/boolhuff.h
-index 0d929f0..95635e3 100644
---- a/vp8/encoder/boolhuff.h
-+++ b/vp8/encoder/boolhuff.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/dct.c b/vp8/encoder/dct.c
-index 5207e39..4f5f9f0 100644
---- a/vp8/encoder/dct.c
-+++ b/vp8/encoder/dct.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/dct.h b/vp8/encoder/dct.h
-index fb307cf..2aaf731 100644
---- a/vp8/encoder/dct.h
-+++ b/vp8/encoder/dct.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/encodeframe.c b/vp8/encoder/encodeframe.c
-index a4e3772..46b697e 100644
---- a/vp8/encoder/encodeframe.c
-+++ b/vp8/encoder/encodeframe.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/encodeintra.c b/vp8/encoder/encodeintra.c
-index 403d020..d632bd8 100644
---- a/vp8/encoder/encodeintra.c
-+++ b/vp8/encoder/encodeintra.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -67,7 +68,7 @@ void vp8_encode_intra4x4block_rd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x, BL
-
- x->short_fdct4x4rd(be->src_diff, be->coeff, 32);
-
-- x->quantize_brd(be, b);
-+ x->quantize_b(be, b);
-
- x->e_mbd.mbmi.mb_skip_coeff &= (!b->eob);
-
-@@ -159,8 +160,7 @@ void vp8_encode_intra16x16mbyrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
-
- x->e_mbd.mbmi.mb_skip_coeff = 1;
-
-- vp8_quantize_mbyrd(x);
--
-+ vp8_quantize_mby(x);
-
- vp8_inverse_transform_mby(IF_RTCD(&rtcd->common->idct), &x->e_mbd);
-
-@@ -226,9 +226,7 @@ void vp8_encode_intra16x16mbuvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
-
- vp8_transform_mbuvrd(x);
-
-- vp8_quantize_mbuvrd(x);
--
--
-+ vp8_quantize_mbuv(x);
-
- vp8_inverse_transform_mbuv(IF_RTCD(&rtcd->common->idct), &x->e_mbd);
-
-diff --git a/vp8/encoder/encodeintra.h b/vp8/encoder/encodeintra.h
-index 4a43ab2..49b3257 100644
---- a/vp8/encoder/encodeintra.h
-+++ b/vp8/encoder/encodeintra.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/encodemb.c b/vp8/encoder/encodemb.c
-index d825133..a66b90c 100644
---- a/vp8/encoder/encodemb.c
-+++ b/vp8/encoder/encodemb.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -493,140 +494,6 @@ void vp8_optimize_b(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROPY_
- return;
- }
-
--void vp8_optimize_bplus(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, const VP8_ENCODER_RTCD *rtcd)
--{
-- BLOCK *b = &x->block[i];
-- BLOCKD *bd = &x->e_mbd.block[i];
-- short *dequant_ptr = &bd->dequant[0][0];
-- int nzpos[16] = {0};
-- short saved_qcoefs[16];
-- short saved_dqcoefs[16];
-- int baserate, baseerror, baserd;
-- int rate, error, thisrd;
-- int k;
-- int nzcoefcount = 0;
-- int nc, bestnc = 0;
-- int besteob;
--
-- // count potential coefficient to be optimized
-- for (k = !type; k < 16; k++)
-- {
-- int qcoef = abs(bd->qcoeff[k]);
-- int coef = abs(b->coeff[k]);
-- int dq = dequant_ptr[k];
--
-- if (qcoef && (qcoef * dq < coef) && (coef < (qcoef * dq + dq)))
-- {
-- nzpos[nzcoefcount] = k;
-- nzcoefcount++;
-- }
-- }
--
-- // if nothing here, do nothing for this block.
-- if (!nzcoefcount)
-- {
-- //do not update context, we need do the other half.
-- //*a = *l = (bd->eob != !type);
-- return;
-- }
--
-- // save a copy of quantized coefficients
-- vpx_memcpy(saved_qcoefs, bd->qcoeff, 32);
-- vpx_memcpy(saved_dqcoefs, bd->dqcoeff, 32);
--
-- besteob = bd->eob;
-- baserate = cost_coeffs(x, bd, type, a, l);
-- baseerror = ENCODEMB_INVOKE(&rtcd->encodemb, berr)(b->coeff, bd->dqcoeff) >> 2;
-- baserd = RDFUNC(x->rdmult, x->rddiv, baserate, baseerror, 100);
--
-- for (nc = 1; nc < (1 << nzcoefcount); nc++)
-- {
-- //reset coefficients
-- vpx_memcpy(bd->qcoeff, saved_qcoefs, 32);
-- vpx_memcpy(bd->dqcoeff, saved_dqcoefs, 32);
--
-- for (k = 0; k < nzcoefcount; k++)
-- {
-- int pos = nzpos[k];
--
-- if ((nc & (1 << k)))
-- {
-- int cur_qcoef = bd->qcoeff[pos];
--
-- if (cur_qcoef < 0)
-- {
-- bd->qcoeff[pos]--;
-- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
-- }
-- else
-- {
-- bd->qcoeff[pos]++;
-- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
-- }
-- }
-- }
--
-- {
-- int eob = -1;
-- int rc;
-- int m;
--
-- for (m = 0; m < 16; m++)
-- {
-- rc = vp8_default_zig_zag1d[m];
--
-- if (bd->qcoeff[rc])
-- eob = m;
-- }
--
-- bd->eob = eob + 1;
-- }
--
-- rate = cost_coeffs(x, bd, type, a, l);
-- error = ENCODEMB_INVOKE(&rtcd->encodemb, berr)(b->coeff, bd->dqcoeff) >> 2;
-- thisrd = RDFUNC(x->rdmult, x->rddiv, rate, error, 100);
--
-- if (thisrd < baserd)
-- {
-- baserd = thisrd;
-- bestnc = nc;
-- besteob = bd->eob;
-- }
-- }
--
-- //reset coefficients
-- vpx_memcpy(bd->qcoeff, saved_qcoefs, 32);
-- vpx_memcpy(bd->dqcoeff, saved_dqcoefs, 32);
--
-- if (bestnc)
-- {
-- for (k = 0; k < nzcoefcount; k++)
-- {
-- int pos = nzpos[k];
--
-- if (bestnc & (1 << k))
-- {
-- int cur_qcoef = bd->qcoeff[pos];
--
-- if (cur_qcoef < 0)
-- {
-- bd->qcoeff[pos]++;
-- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
-- }
-- else
-- {
-- bd->qcoeff[pos]--;
-- bd->dqcoeff[pos] = bd->qcoeff[pos] * dequant_ptr[pos];
-- }
-- }
-- }
-- }
--
-- bd->eob = besteob;
-- //do not update context, we need do the other half.
-- //*a = *l = (bd->eob != !type);
-- return;
--}
-
- void vp8_optimize_y2b(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, const VP8_ENCODER_RTCD *rtcd)
- {
-@@ -718,7 +585,6 @@ void vp8_optimize_y2b(MACROBLOCK *x, int i, int type, ENTROPY_CONTEXT *a, ENTROP
-
- void vp8_optimize_mb(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
- {
-- int cost = 0;
- int b;
- TEMP_CONTEXT t, t2;
- int type = 0;
-@@ -752,181 +618,6 @@ void vp8_optimize_mb(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
-
-
-
--void vp8_super_slow_yquant_optimization(MACROBLOCK *x, int type, const VP8_ENCODER_RTCD *rtcd)
--{
-- BLOCK *b = &x->block[0];
-- BLOCKD *bd = &x->e_mbd.block[0];
-- short *dequant_ptr = &bd->dequant[0][0];
-- struct
-- {
-- int block;
-- int pos;
-- } nzpos[256];
-- short saved_qcoefs[256];
-- short saved_dqcoefs[256];
-- short *coef_ptr = x->coeff;
-- short *qcoef_ptr = x->e_mbd.qcoeff;
-- short *dqcoef_ptr = x->e_mbd.dqcoeff;
--
-- int baserate, baseerror, baserd;
-- int rate, error, thisrd;
-- int i, k;
-- int nzcoefcount = 0;
-- int nc, bestnc = 0;
-- int besteob;
--
-- //this code has assumption in macroblock coeff buffer layout
-- for (i = 0; i < 16; i++)
-- {
-- // count potential coefficient to be optimized
-- for (k = !type; k < 16; k++)
-- {
-- int qcoef = abs(qcoef_ptr[i*16 + k]);
-- int coef = abs(coef_ptr[i*16 + k]);
-- int dq = dequant_ptr[k];
--
-- if (qcoef && (qcoef * dq > coef) && (qcoef * dq < coef + dq))
-- {
-- nzpos[nzcoefcount].block = i;
-- nzpos[nzcoefcount].pos = k;
-- nzcoefcount++;
-- }
-- }
-- }
--
-- // if nothing here, do nothing for this macro_block.
-- if (!nzcoefcount || nzcoefcount > 15)
-- {
-- return;
-- }
--
-- /******************************************************************************
-- looking from each coeffient's perspective, each identifed coefficent above could
-- have 2 values:roundeddown(x) and roundedup(x). Therefore the total number of
-- different states is less than 2**nzcoefcount.
-- ******************************************************************************/
-- // save the qunatized coefficents and dequantized coefficicents
-- vpx_memcpy(saved_qcoefs, x->e_mbd.qcoeff, 256);
-- vpx_memcpy(saved_dqcoefs, x->e_mbd.dqcoeff, 256);
--
-- baserate = mbycost_coeffs(x);
-- baseerror = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(x, !type);
-- baserd = RDFUNC(x->rdmult, x->rddiv, baserate, baseerror, 100);
--
-- for (nc = 1; nc < (1 << nzcoefcount); nc++)
-- {
-- //reset coefficients
-- vpx_memcpy(x->e_mbd.qcoeff, saved_qcoefs, 256);
-- vpx_memcpy(x->e_mbd.dqcoeff, saved_dqcoefs, 256);
--
-- for (k = 0; k < nzcoefcount; k++)
-- {
-- int bk = nzpos[k].block;
-- int pos = nzpos[k].pos;
-- int mbkpos = bk * 16 + pos;
--
-- if ((nc & (1 << k)))
-- {
-- int cur_qcoef = x->e_mbd.qcoeff[mbkpos];
--
-- if (cur_qcoef < 0)
-- {
-- x->e_mbd.qcoeff[mbkpos]++;
-- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
-- }
-- else
-- {
-- x->e_mbd.qcoeff[mbkpos]--;
-- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
-- }
-- }
-- }
--
-- for (i = 0; i < 16; i++)
-- {
-- BLOCKD *bd = &x->e_mbd.block[i];
-- {
-- int eob = -1;
-- int rc;
-- int l;
--
-- for (l = 0; l < 16; l++)
-- {
-- rc = vp8_default_zig_zag1d[l];
--
-- if (bd->qcoeff[rc])
-- eob = l;
-- }
--
-- bd->eob = eob + 1;
-- }
-- }
--
-- rate = mbycost_coeffs(x);
-- error = ENCODEMB_INVOKE(&rtcd->encodemb, mberr)(x, !type);;
-- thisrd = RDFUNC(x->rdmult, x->rddiv, rate, error, 100);
--
-- if (thisrd < baserd)
-- {
-- baserd = thisrd;
-- bestnc = nc;
-- besteob = bd->eob;
-- }
-- }
--
-- //reset coefficients
-- vpx_memcpy(x->e_mbd.qcoeff, saved_qcoefs, 256);
-- vpx_memcpy(x->e_mbd.dqcoeff, saved_dqcoefs, 256);
--
-- if (bestnc)
-- {
-- for (k = 0; k < nzcoefcount; k++)
-- {
-- int bk = nzpos[k].block;
-- int pos = nzpos[k].pos;
-- int mbkpos = bk * 16 + pos;
--
-- if ((nc & (1 << k)))
-- {
-- int cur_qcoef = x->e_mbd.qcoeff[mbkpos];
--
-- if (cur_qcoef < 0)
-- {
-- x->e_mbd.qcoeff[mbkpos]++;
-- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
-- }
-- else
-- {
-- x->e_mbd.qcoeff[mbkpos]--;
-- x->e_mbd.dqcoeff[mbkpos] = x->e_mbd.qcoeff[mbkpos] * dequant_ptr[pos];
-- }
-- }
-- }
-- }
--
-- for (i = 0; i < 16; i++)
-- {
-- BLOCKD *bd = &x->e_mbd.block[i];
-- {
-- int eob = -1;
-- int rc;
-- int l;
--
-- for (l = 0; l < 16; l++)
-- {
-- rc = vp8_default_zig_zag1d[l];
--
-- if (bd->qcoeff[rc])
-- eob = l;
-- }
--
-- bd->eob = eob + 1;
-- }
-- }
--
-- return;
--}
--
- static void vp8_find_mb_skip_coef(MACROBLOCK *x)
- {
- int i;
-@@ -955,46 +646,8 @@ static void vp8_find_mb_skip_coef(MACROBLOCK *x)
- }
-
-
--void vp8_optimize_mb_slow(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
--{
-- int cost = 0;
-- int b;
-- TEMP_CONTEXT t, t2;
-- int type = 0;
--
--
-- vp8_setup_temp_context(&t, x->e_mbd.above_context[Y1CONTEXT], x->e_mbd.left_context[Y1CONTEXT], 4);
--
-- if (x->e_mbd.mbmi.mode == SPLITMV || x->e_mbd.mbmi.mode == B_PRED)
-- type = 3;
--
-- vp8_super_slow_yquant_optimization(x, type, rtcd);
-- /*
-- for(b=0;b<16;b++)
-- {
-- vp8_optimize_b(x, b, type, t.a + vp8_block2above[b], t.l + vp8_block2left[b]);
-- }
-- */
--
-- vp8_setup_temp_context(&t, x->e_mbd.above_context[UCONTEXT], x->e_mbd.left_context[UCONTEXT], 2);
--
-- for (b = 16; b < 20; b++)
-- {
-- vp8_optimize_b(x, b, vp8_block2type[b], t.a + vp8_block2above[b], t.l + vp8_block2left[b], rtcd);
-- }
--
-- vp8_setup_temp_context(&t2, x->e_mbd.above_context[VCONTEXT], x->e_mbd.left_context[VCONTEXT], 2);
--
-- for (b = 20; b < 24; b++)
-- {
-- vp8_optimize_b(x, b, vp8_block2type[b], t2.a + vp8_block2above[b], t2.l + vp8_block2left[b], rtcd);
-- }
--}
--
--
- void vp8_optimize_mby(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
- {
-- int cost = 0;
- int b;
- TEMP_CONTEXT t;
- int type = 0;
-@@ -1019,10 +672,8 @@ void vp8_optimize_mby(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
-
- void vp8_optimize_mbuv(MACROBLOCK *x, const VP8_ENCODER_RTCD *rtcd)
- {
-- int cost = 0;
- int b;
- TEMP_CONTEXT t, t2;
-- int type = 0;
-
- if (!x->e_mbd.above_context[UCONTEXT])
- return;
-@@ -1124,6 +775,6 @@ void vp8_encode_inter16x16uvrd(const VP8_ENCODER_RTCD *rtcd, MACROBLOCK *x)
-
- vp8_transform_mbuvrd(x);
-
-- vp8_quantize_mbuvrd(x);
-+ vp8_quantize_mbuv(x);
-
- }
-diff --git a/vp8/encoder/encodemb.h b/vp8/encoder/encodemb.h
-index 91ca8f5..5285a38 100644
---- a/vp8/encoder/encodemb.h
-+++ b/vp8/encoder/encodemb.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/encodemv.c b/vp8/encoder/encodemv.c
-index f287edc..3b58a80 100644
---- a/vp8/encoder/encodemv.c
-+++ b/vp8/encoder/encodemv.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -282,8 +283,6 @@ static void write_component_probs(
-
- //j=0
- {
-- int j = 0;
--
- const int c = events [mv_max];
-
- is_short_ct [0] += c; // Short vector
-diff --git a/vp8/encoder/encodemv.h b/vp8/encoder/encodemv.h
-index 1c1f450..bf6d7af 100644
---- a/vp8/encoder/encodemv.h
-+++ b/vp8/encoder/encodemv.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/ethreading.c b/vp8/encoder/ethreading.c
-index a0b50d2..11b1936 100644
---- a/vp8/encoder/ethreading.c
-+++ b/vp8/encoder/ethreading.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -259,10 +260,8 @@ static void setup_mbby_copy(MACROBLOCK *mbdst, MACROBLOCK *mbsrc)
- z->short_fdct4x4rd = x->short_fdct4x4rd;
- z->short_fdct8x4rd = x->short_fdct8x4rd;
- z->short_fdct8x4rd = x->short_fdct8x4rd;
-- z->vp8_short_fdct4x4_ptr = x->vp8_short_fdct4x4_ptr;
- z->short_walsh4x4 = x->short_walsh4x4;
- z->quantize_b = x->quantize_b;
-- z->quantize_brd = x->quantize_brd;
-
- /*
- z->mvc = x->mvc;
-diff --git a/vp8/encoder/firstpass.c b/vp8/encoder/firstpass.c
-index c519080..ced2d7c 100644
---- a/vp8/encoder/firstpass.c
-+++ b/vp8/encoder/firstpass.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -175,7 +176,6 @@ static double calculate_modified_err(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
- double vp8_simple_weight(YV12_BUFFER_CONFIG *source)
- {
- int i, j;
-- int Total = 0;
-
- unsigned char *src = source->y_buffer;
- unsigned char value;
-@@ -779,7 +779,6 @@ void vp8_first_pass(VP8_COMP *cpi)
- vp8_clear_system_state(); //__asm emms;
- {
- double weight = 0.0;
-- double weigth2 = 0.0;
-
- FIRSTPASS_STATS fps;
-
-@@ -1193,7 +1192,6 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
- FIRSTPASS_STATS next_frame;
- FIRSTPASS_STATS *start_pos;
- int i;
-- int count = 0;
- int image_size = cpi->common.last_frame.y_width * cpi->common.last_frame.y_height;
- double boost_score = 0.0;
- double old_boost_score = 0.0;
-@@ -1234,6 +1232,8 @@ static void define_gf_group(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
-
- start_pos = cpi->stats_in;
-
-+ vpx_memset(&next_frame, 0, sizeof(next_frame)); // assure clean
-+
- // Preload the stats for the next frame.
- mod_frame_err = calculate_modified_err(cpi, this_frame);
-
-@@ -1871,6 +1871,18 @@ void vp8_second_pass(VP8_COMP *cpi)
- }
- }
-
-+ // Keep a globally available copy of this and the next frame's iiratio.
-+ cpi->this_iiratio = this_frame_intra_error /
-+ DOUBLE_DIVIDE_CHECK(this_frame_coded_error);
-+ {
-+ FIRSTPASS_STATS next_frame;
-+ if ( lookup_next_frame_stats(cpi, &next_frame) != EOF )
-+ {
-+ cpi->next_iiratio = next_frame.intra_error /
-+ DOUBLE_DIVIDE_CHECK(next_frame.coded_error);
-+ }
-+ }
-+
- // Set nominal per second bandwidth for this frame
- cpi->target_bandwidth = cpi->per_frame_bandwidth * cpi->output_frame_rate;
- if (cpi->target_bandwidth < 0)
-@@ -2028,6 +2040,8 @@ void vp8_find_next_key_frame(VP8_COMP *cpi, FIRSTPASS_STATS *this_frame)
- double kf_group_coded_err = 0.0;
- double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
-
-+ vpx_memset(&next_frame, 0, sizeof(next_frame)); // assure clean
-+
- vp8_clear_system_state(); //__asm emms;
- start_position = cpi->stats_in;
-
-diff --git a/vp8/encoder/firstpass.h b/vp8/encoder/firstpass.h
-index d7b52f3..48257ce 100644
---- a/vp8/encoder/firstpass.h
-+++ b/vp8/encoder/firstpass.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/generic/csystemdependent.c b/vp8/encoder/generic/csystemdependent.c
-index 52aab66..96028b3 100644
---- a/vp8/encoder/generic/csystemdependent.c
-+++ b/vp8/encoder/generic/csystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/mcomp.c b/vp8/encoder/mcomp.c
-index d80059d..3c1507f 100644
---- a/vp8/encoder/mcomp.c
-+++ b/vp8/encoder/mcomp.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -1137,7 +1138,6 @@ int vp8_diamond_search_sadx4
- }
-
-
--#if !(CONFIG_REALTIME_ONLY)
- 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])
- {
- unsigned char *what = (*(b->base_src) + b->src);
-@@ -1350,7 +1350,6 @@ int vp8_full_search_sadx3(MACROBLOCK *x, BLOCK *b, BLOCKD *d, MV *ref_mv, int er
- else
- return INT_MAX;
- }
--#endif
-
- #ifdef ENTROPY_STATS
- void print_mode_context(void)
-diff --git a/vp8/encoder/mcomp.h b/vp8/encoder/mcomp.h
-index 921206f..40cbb07 100644
---- a/vp8/encoder/mcomp.h
-+++ b/vp8/encoder/mcomp.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/modecosts.c b/vp8/encoder/modecosts.c
-index 73170cf..6632a36 100644
---- a/vp8/encoder/modecosts.c
-+++ b/vp8/encoder/modecosts.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/modecosts.h b/vp8/encoder/modecosts.h
-index 5ade265..0c46acd 100644
---- a/vp8/encoder/modecosts.h
-+++ b/vp8/encoder/modecosts.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
-index 7662720..98827f9 100644
---- a/vp8/encoder/onyx_if.c
-+++ b/vp8/encoder/onyx_if.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -281,7 +282,6 @@ static void segmentation_test_function(VP8_PTR ptr)
-
- unsigned char *seg_map;
- signed char feature_data[MB_LVL_MAX][MAX_MB_SEGMENTS];
-- int i, j;
-
- // Create a temporary map for segmentation data.
- CHECK_MEM_ERROR(seg_map, vpx_calloc(cpi->common.mb_rows * cpi->common.mb_cols, 1));
-@@ -811,7 +811,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
- sf->full_freq[1] = 31;
- sf->search_method = NSTEP;
-
-- if (!cpi->ref_frame_flags & VP8_LAST_FLAG)
-+ if (!(cpi->ref_frame_flags & VP8_LAST_FLAG))
- {
- sf->thresh_mult[THR_NEWMV ] = INT_MAX;
- sf->thresh_mult[THR_NEARESTMV] = INT_MAX;
-@@ -820,7 +820,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
- sf->thresh_mult[THR_SPLITMV ] = INT_MAX;
- }
-
-- if (!cpi->ref_frame_flags & VP8_GOLD_FLAG)
-+ if (!(cpi->ref_frame_flags & VP8_GOLD_FLAG))
- {
- sf->thresh_mult[THR_NEARESTG ] = INT_MAX;
- sf->thresh_mult[THR_ZEROG ] = INT_MAX;
-@@ -829,7 +829,7 @@ void vp8_set_speed_features(VP8_COMP *cpi)
- sf->thresh_mult[THR_SPLITG ] = INT_MAX;
- }
-
-- if (!cpi->ref_frame_flags & VP8_ALT_FLAG)
-+ if (!(cpi->ref_frame_flags & VP8_ALT_FLAG))
- {
- sf->thresh_mult[THR_NEARESTA ] = INT_MAX;
- sf->thresh_mult[THR_ZEROA ] = INT_MAX;
-@@ -1144,18 +1144,15 @@ void vp8_set_speed_features(VP8_COMP *cpi)
- cpi->mb.short_fdct4x4rd = FDCT_INVOKE(&cpi->rtcd.fdct, fast4x4);
- }
-
-- cpi->mb.vp8_short_fdct4x4_ptr = FDCT_INVOKE(&cpi->rtcd.fdct, short4x4);
- cpi->mb.short_walsh4x4 = FDCT_INVOKE(&cpi->rtcd.fdct, walsh_short4x4);
-
- if (cpi->sf.improved_quant)
- {
- cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, quantb);
-- cpi->mb.quantize_brd = QUANTIZE_INVOKE(&cpi->rtcd.quantize, quantb);
- }
- else
- {
- cpi->mb.quantize_b = QUANTIZE_INVOKE(&cpi->rtcd.quantize, fastquantb);
-- cpi->mb.quantize_brd = QUANTIZE_INVOKE(&cpi->rtcd.quantize, fastquantb);
- }
-
- #if CONFIG_RUNTIME_CPU_DETECT
-@@ -2252,7 +2249,7 @@ void vp8_remove_compressor(VP8_PTR *ptr)
- double total_psnr2 = vp8_mse2psnr(samples, 255.0, cpi->total_sq_error2);
- double total_ssim = 100 * pow(cpi->summed_quality / cpi->summed_weights, 8.0);
-
-- fprintf(f, "Bitrate\AVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\tVPXSSIM\t Time(us)\n");
-+ fprintf(f, "Bitrate\tAVGPsnr\tGLBPsnr\tAVPsnrP\tGLPsnrP\tVPXSSIM\t Time(us)\n");
- fprintf(f, "%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f\t%7.3f %8.0f\n",
- dr, cpi->total / cpi->count, total_psnr, cpi->totalp / cpi->count, total_psnr2, total_ssim,
- total_encode_time);
-@@ -4739,7 +4736,6 @@ void vp8_check_gf_quality(VP8_COMP *cpi)
- #if !(CONFIG_REALTIME_ONLY)
- static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest, unsigned int *frame_flags)
- {
-- double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth * cpi->oxcf.two_pass_vbrmin_section / 100);
-
- if (!cpi->common.refresh_alt_ref_frame)
- vp8_second_pass(cpi);
-@@ -4748,7 +4744,11 @@ static void Pass2Encode(VP8_COMP *cpi, unsigned long *size, unsigned char *dest,
- cpi->bits_left -= 8 * *size;
-
- if (!cpi->common.refresh_alt_ref_frame)
-+ {
-+ double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth
-+ *cpi->oxcf.two_pass_vbrmin_section / 100);
- cpi->bits_left += (long long)(two_pass_min_rate / cpi->oxcf.frame_rate);
-+ }
- }
- #endif
-
-@@ -5402,7 +5402,7 @@ int vp8_calc_low_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest, co
- {
- for (j = 0; j < source->y_width; j += 16)
- {
-- unsigned int sse, sse2, sum2;
-+ unsigned int sse;
- VARIANCE_INVOKE(rtcd, mse16x16)(src + j, source->y_stride, dst + j, dest->y_stride, &sse);
-
- if (sse < 8096)
-diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
-index 29b120e..889bf73 100644
---- a/vp8/encoder/onyx_int.h
-+++ b/vp8/encoder/onyx_int.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -25,7 +26,7 @@
- #include "entropy.h"
- #include "threading.h"
- #include "vpx_ports/mem.h"
--#include "vpx_codec/internal/vpx_codec_internal.h"
-+#include "vpx/internal/vpx_codec_internal.h"
- #include "mcomp.h"
-
- #define INTRARDOPT
-@@ -522,8 +523,8 @@ typedef struct
- int motion_lvl;
- int motion_speed;
- int motion_var;
-- int next_iiratio;
-- int this_iiratio;
-+ unsigned int next_iiratio;
-+ unsigned int this_iiratio;
- int this_frame_modified_error;
-
- double norm_intra_err_per_mb;
-diff --git a/vp8/encoder/parms.cpp b/vp8/encoder/parms.cpp
-index 66fdafb..d7d30a8 100644
---- a/vp8/encoder/parms.cpp
-+++ b/vp8/encoder/parms.cpp
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/pickinter.c b/vp8/encoder/pickinter.c
-index d61e2ce..a50f99b 100644
---- a/vp8/encoder/pickinter.c
-+++ b/vp8/encoder/pickinter.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -453,6 +454,7 @@ int vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int rec
- vpx_memset(mode_mv, 0, sizeof(mode_mv));
- vpx_memset(nearest_mv, 0, sizeof(nearest_mv));
- vpx_memset(near_mv, 0, sizeof(near_mv));
-+ vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
-
-
- // set up all the refframe dependent pointers.
-diff --git a/vp8/encoder/pickinter.h b/vp8/encoder/pickinter.h
-index fb28837..76fdb99 100644
---- a/vp8/encoder/pickinter.h
-+++ b/vp8/encoder/pickinter.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/picklpf.c b/vp8/encoder/picklpf.c
-index bbd7840..0527b80 100644
---- a/vp8/encoder/picklpf.c
-+++ b/vp8/encoder/picklpf.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/ppc/csystemdependent.c b/vp8/encoder/ppc/csystemdependent.c
-index f99277f..66fca8f 100644
---- a/vp8/encoder/ppc/csystemdependent.c
-+++ b/vp8/encoder/ppc/csystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/ppc/encodemb_altivec.asm b/vp8/encoder/ppc/encodemb_altivec.asm
-index e0e976d..14a36a1 100644
---- a/vp8/encoder/ppc/encodemb_altivec.asm
-+++ b/vp8/encoder/ppc/encodemb_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/ppc/fdct_altivec.asm b/vp8/encoder/ppc/fdct_altivec.asm
-index eaab14c..01f3364 100644
---- a/vp8/encoder/ppc/fdct_altivec.asm
-+++ b/vp8/encoder/ppc/fdct_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/ppc/rdopt_altivec.asm b/vp8/encoder/ppc/rdopt_altivec.asm
-index 917bfe0..4f9b050 100644
---- a/vp8/encoder/ppc/rdopt_altivec.asm
-+++ b/vp8/encoder/ppc/rdopt_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/ppc/sad_altivec.asm b/vp8/encoder/ppc/sad_altivec.asm
-index 1102ccf..6d92728 100644
---- a/vp8/encoder/ppc/sad_altivec.asm
-+++ b/vp8/encoder/ppc/sad_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/ppc/variance_altivec.asm b/vp8/encoder/ppc/variance_altivec.asm
-index 952bf72..4e3fd59 100644
---- a/vp8/encoder/ppc/variance_altivec.asm
-+++ b/vp8/encoder/ppc/variance_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/ppc/variance_subpixel_altivec.asm b/vp8/encoder/ppc/variance_subpixel_altivec.asm
-index 148a8d2..4dcf7e4 100644
---- a/vp8/encoder/ppc/variance_subpixel_altivec.asm
-+++ b/vp8/encoder/ppc/variance_subpixel_altivec.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/preproc.c b/vp8/encoder/preproc.c
-index d2a13dc..e9cc075 100644
---- a/vp8/encoder/preproc.c
-+++ b/vp8/encoder/preproc.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/psnr.c b/vp8/encoder/psnr.c
-index 0e34cec..c5e9dad 100644
---- a/vp8/encoder/psnr.c
-+++ b/vp8/encoder/psnr.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/psnr.h b/vp8/encoder/psnr.h
-index 9f6ca0b..dd0b4e5 100644
---- a/vp8/encoder/psnr.h
-+++ b/vp8/encoder/psnr.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c
-index 6028ebf..73e80e3 100644
---- a/vp8/encoder/quantize.c
-+++ b/vp8/encoder/quantize.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -55,9 +56,7 @@ void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
- }
- }
- }
--
- d->eob = eob + 1;
--
- }
-
- void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d)
-@@ -111,61 +110,40 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d)
-
- d->eob = eob + 1;
- }
-+
- void vp8_quantize_mby(MACROBLOCK *x)
- {
- int i;
-+ int has_2nd_order = (x->e_mbd.mbmi.mode != B_PRED
-+ && x->e_mbd.mbmi.mode != SPLITMV);
-
-- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
-+ for (i = 0; i < 16; i++)
- {
-- for (i = 0; i < 16; i++)
-- {
-- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
-- }
-+ x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-+ x->e_mbd.mbmi.mb_skip_coeff &=
-+ (x->e_mbd.block[i].eob <= has_2nd_order);
-+ }
-
-+ if(has_2nd_order)
-+ {
- x->quantize_b(&x->block[24], &x->e_mbd.block[24]);
- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob);
--
-- }
-- else
-- {
-- for (i = 0; i < 16; i++)
-- {
-- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
- }
- }
-
- void vp8_quantize_mb(MACROBLOCK *x)
- {
- int i;
-+ int has_2nd_order=(x->e_mbd.mbmi.mode != B_PRED
-+ && x->e_mbd.mbmi.mode != SPLITMV);
-
- x->e_mbd.mbmi.mb_skip_coeff = 1;
--
-- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
-+ for (i = 0; i < 24+has_2nd_order; i++)
- {
-- for (i = 0; i < 16; i++)
-- {
-- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
-- }
--
-- for (i = 16; i < 25; i++)
-- {
-- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
-- }
-- else
-- {
-- for (i = 0; i < 24; i++)
-- {
-- x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
-+ x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
-+ x->e_mbd.mbmi.mb_skip_coeff &=
-+ (x->e_mbd.block[i].eob <= (has_2nd_order && i<16));
- }
--
- }
-
-
-@@ -179,71 +157,3 @@ void vp8_quantize_mbuv(MACROBLOCK *x)
- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
- }
- }
--
--// This function is not currently called
--void vp8_quantize_mbrd(MACROBLOCK *x)
--{
-- int i;
--
-- x->e_mbd.mbmi.mb_skip_coeff = 1;
--
-- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
-- {
-- for (i = 0; i < 16; i++)
-- {
-- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
-- }
--
-- for (i = 16; i < 25; i++)
-- {
-- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
-- }
-- else
-- {
-- for (i = 0; i < 24; i++)
-- {
-- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
-- }
--}
--
--void vp8_quantize_mbuvrd(MACROBLOCK *x)
--{
-- int i;
--
-- for (i = 16; i < 24; i++)
-- {
-- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
--}
--
--void vp8_quantize_mbyrd(MACROBLOCK *x)
--{
-- int i;
--
-- if (x->e_mbd.mbmi.mode != B_PRED && x->e_mbd.mbmi.mode != SPLITMV)
-- {
-- for (i = 0; i < 16; i++)
-- {
-- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (x->e_mbd.block[i].eob < 2);
-- }
--
-- x->quantize_brd(&x->block[24], &x->e_mbd.block[24]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[24].eob);
--
-- }
-- else
-- {
-- for (i = 0; i < 16; i++)
-- {
-- x->quantize_brd(&x->block[i], &x->e_mbd.block[i]);
-- x->e_mbd.mbmi.mb_skip_coeff &= (!x->e_mbd.block[i].eob);
-- }
-- }
--}
-diff --git a/vp8/encoder/quantize.h b/vp8/encoder/quantize.h
-index 868e8e3..ca073ef 100644
---- a/vp8/encoder/quantize.h
-+++ b/vp8/encoder/quantize.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -16,6 +17,10 @@
- #define prototype_quantize_block(sym) \
- void (sym)(BLOCK *b,BLOCKD *d)
-
-+#if ARCH_X86 || ARCH_X86_64
-+#include "x86/quantize_x86.h"
-+#endif
-+
- #if ARCH_ARM
- #include "arm/quantize_arm.h"
- #endif
-@@ -45,8 +50,5 @@ typedef struct
- extern void vp8_quantize_mb(MACROBLOCK *x);
- extern void vp8_quantize_mbuv(MACROBLOCK *x);
- extern void vp8_quantize_mby(MACROBLOCK *x);
--extern void vp8_quantize_mbyrd(MACROBLOCK *x);
--extern void vp8_quantize_mbuvrd(MACROBLOCK *x);
--extern void vp8_quantize_mbrd(MACROBLOCK *x);
-
- #endif
-diff --git a/vp8/encoder/ratectrl.c b/vp8/encoder/ratectrl.c
-index 05040d3..944a2e8 100644
---- a/vp8/encoder/ratectrl.c
-+++ b/vp8/encoder/ratectrl.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -1063,7 +1064,6 @@ void vp8_calc_pframe_target_size(VP8_COMP *cpi)
-
- if (cpi->common.refresh_golden_frame == TRUE)
- {
-- int isize_adjustment = 0;
- #if 0
-
- if (0) // p_gw
-@@ -1119,8 +1119,9 @@ void vp8_calc_pframe_target_size(VP8_COMP *cpi)
- cpi->this_frame_target = (baseline_bits_at_q(1, Q, cpi->common.MBs) * cpi->last_boost) / 100;
-
- }
-- // If there is an active ARF at this location use the minimum bits on this frame
-- else
-+ // If there is an active ARF at this location use the minimum
-+ // bits on this frame unless it was a contructed arf.
-+ else if (cpi->oxcf.arnr_max_frames == 0)
- {
- cpi->this_frame_target = 0; // Minimial spend on gf that is replacing an arf
- }
-@@ -1171,7 +1172,8 @@ void vp8_update_rate_correction_factors(VP8_COMP *cpi, int damp_var)
- while (Z > 0)
- {
- Z --;
-- projected_size_based_on_q *= (int)Factor;
-+ projected_size_based_on_q =
-+ (int)(Factor * projected_size_based_on_q);
- Factor += factor_adjustment;
-
- if (Factor >= 0.999)
-@@ -1362,7 +1364,8 @@ int vp8_regulate_q(VP8_COMP *cpi, int target_bits_per_frame)
- if (cpi->zbin_over_quant > zbin_oqmax)
- cpi->zbin_over_quant = zbin_oqmax;
-
-- bits_per_mb_at_this_q *= (int)Factor; // Each over-ruin step is assumed to equate to approximately 3% reduction in bitrate
-+ // Adjust bits_per_mb_at_this_q estimate
-+ bits_per_mb_at_this_q = (int)(Factor * bits_per_mb_at_this_q);
- Factor += factor_adjustment;
-
- if (Factor >= 0.999)
-diff --git a/vp8/encoder/ratectrl.h b/vp8/encoder/ratectrl.h
-index 588c7a8..ff5778f 100644
---- a/vp8/encoder/ratectrl.h
-+++ b/vp8/encoder/ratectrl.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/rdopt.c b/vp8/encoder/rdopt.c
-index 0846996..9a772a7 100644
---- a/vp8/encoder/rdopt.c
-+++ b/vp8/encoder/rdopt.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -170,15 +171,13 @@ static void fill_token_costs(
-
- }
-
--static int rd_iifactor [ 32 ] = { 16, 16, 16, 12, 8, 4, 2, 0,
-+static int rd_iifactor [ 32 ] = { 4, 4, 3, 2, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0,
- };
-
-
--
--
- // The values in this table should be reviewed
- static int sad_per_bit16lut[128] =
- {
-@@ -237,36 +236,32 @@ void vp8_initialize_rd_consts(VP8_COMP *cpi, int Qvalue)
-
- vp8_clear_system_state(); //__asm emms;
-
-- cpi->RDMULT = (int)((0.00007 * (capped_q * capped_q * capped_q * capped_q)) - (0.0125 * (capped_q * capped_q * capped_q)) +
-- (2.25 * (capped_q * capped_q)) - (12.5 * capped_q) + 25.0);
-+ cpi->RDMULT = (int)( (0.0001 * (capped_q * capped_q * capped_q * capped_q))
-+ -(0.015 * (capped_q * capped_q * capped_q))
-+ +(3.25 * (capped_q * capped_q))
-+ -(17.5 * capped_q) + 125.0);
-
-- if (cpi->RDMULT < 25)
-- cpi->RDMULT = 25;
-+ if (cpi->RDMULT < 125)
-+ cpi->RDMULT = 125;
-
-- if (cpi->pass == 2)
-+ if (cpi->pass == 2 && (cpi->common.frame_type != KEY_FRAME))
- {
-- if (cpi->common.frame_type == KEY_FRAME)
-- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[0]) / 16;
-- else if (cpi->next_iiratio > 31)
-- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) / 16;
-+ if (cpi->next_iiratio > 31)
-+ cpi->RDMULT += (cpi->RDMULT * rd_iifactor[31]) >> 4;
- else
-- cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->next_iiratio]) / 16;
-+ cpi->RDMULT += (cpi->RDMULT * rd_iifactor[cpi->next_iiratio]) >> 4;
- }
-
-
- // Extend rate multiplier along side quantizer zbin increases
- if (cpi->zbin_over_quant > 0)
- {
-- // Extend rate multiplier along side quantizer zbin increases
-- if (cpi->zbin_over_quant > 0)
-- {
-- double oq_factor = pow(1.006, cpi->zbin_over_quant);
-+ double oq_factor = pow(1.006, cpi->zbin_over_quant);
-
-- if (oq_factor > (1.0 + ((double)cpi->zbin_over_quant / 64.0)))
-- oq_factor = (1.0 + (double)cpi->zbin_over_quant / 64.0);
-+ if (oq_factor > (1.0 + ((double)cpi->zbin_over_quant / 64.0)))
-+ oq_factor = (1.0 + (double)cpi->zbin_over_quant / 64.0);
-
-- cpi->RDMULT *= (int)oq_factor;
-- }
-+ cpi->RDMULT = (int)(oq_factor * cpi->RDMULT);
- }
-
- cpi->mb.errorperbit = (cpi->RDMULT / 100);
-@@ -1037,7 +1032,7 @@ static unsigned int vp8_encode_inter_mb_segment(MACROBLOCK *x, int const *labels
-
- // set to 0 no way to account for 2nd order DC so discount
- //be->coeff[0] = 0;
-- x->quantize_brd(be, bd);
-+ x->quantize_b(be, bd);
-
- distortion += ENCODEMB_INVOKE(rtcd, berr)(be->coeff, bd->dqcoeff);
- }
-@@ -1075,7 +1070,7 @@ static void macro_block_yrd(MACROBLOCK *mb, int *Rate, int *Distortion, const vp
- // Quantization
- for (b = 0; b < 16; b++)
- {
-- mb->quantize_brd(&mb->block[b], &mb->e_mbd.block[b]);
-+ mb->quantize_b(&mb->block[b], &mb->e_mbd.block[b]);
- }
-
- // DC predication and Quantization of 2nd Order block
-@@ -1083,7 +1078,7 @@ static void macro_block_yrd(MACROBLOCK *mb, int *Rate, int *Distortion, const vp
- {
-
- {
-- mb->quantize_brd(mb_y2, x_y2);
-+ mb->quantize_b(mb_y2, x_y2);
- }
- }
-
-@@ -1130,6 +1125,9 @@ static int vp8_rd_pick_best_mbsegmentation(VP8_COMP *cpi, MACROBLOCK *x, MV *bes
- MV bmvs[16];
- int beobs[16];
-
-+ vpx_memset(beobs, 0, sizeof(beobs));
-+
-+
- for (segmentation = 0; segmentation < VP8_NUMMBSPLITS; segmentation++)
- {
- int label_count;
-@@ -1464,6 +1462,8 @@ int vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset, int
-
- *returnintra = INT_MAX;
-
-+ vpx_memset(&best_mbmode, 0, sizeof(best_mbmode)); // clean
-+
- cpi->mbs_tested_so_far++; // Count of the number of MBs tested so far this frame
-
- x->skip = 0;
-diff --git a/vp8/encoder/rdopt.h b/vp8/encoder/rdopt.h
-index c6eae4b..617241d 100644
---- a/vp8/encoder/rdopt.h
-+++ b/vp8/encoder/rdopt.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/sad_c.c b/vp8/encoder/sad_c.c
-index 74c6bd7..1914c60 100644
---- a/vp8/encoder/sad_c.c
-+++ b/vp8/encoder/sad_c.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/ssim.c b/vp8/encoder/ssim.c
-index df214a8..35dd10c 100644
---- a/vp8/encoder/ssim.c
-+++ b/vp8/encoder/ssim.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/tokenize.c b/vp8/encoder/tokenize.c
-index 33ddd64..819f6a5 100644
---- a/vp8/encoder/tokenize.c
-+++ b/vp8/encoder/tokenize.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/tokenize.h b/vp8/encoder/tokenize.h
-index 02aacc2..51f912b 100644
---- a/vp8/encoder/tokenize.h
-+++ b/vp8/encoder/tokenize.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/treewriter.c b/vp8/encoder/treewriter.c
-index e398044..942442b 100644
---- a/vp8/encoder/treewriter.c
-+++ b/vp8/encoder/treewriter.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/treewriter.h b/vp8/encoder/treewriter.h
-index 05ac74c..075df50 100644
---- a/vp8/encoder/treewriter.h
-+++ b/vp8/encoder/treewriter.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/variance.h b/vp8/encoder/variance.h
-index b3b55c3..6610e7d 100644
---- a/vp8/encoder/variance.h
-+++ b/vp8/encoder/variance.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/variance_c.c b/vp8/encoder/variance_c.c
-index 85269b9..efcf2b7 100644
---- a/vp8/encoder/variance_c.c
-+++ b/vp8/encoder/variance_c.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/csystemdependent.c b/vp8/encoder/x86/csystemdependent.c
-index 186ee68..8bc6877 100644
---- a/vp8/encoder/x86/csystemdependent.c
-+++ b/vp8/encoder/x86/csystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/dct_mmx.asm b/vp8/encoder/x86/dct_mmx.asm
-index e134237..3dfc47b 100644
---- a/vp8/encoder/x86/dct_mmx.asm
-+++ b/vp8/encoder/x86/dct_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/dct_sse2.asm b/vp8/encoder/x86/dct_sse2.asm
-index 3e5e9a7..8ddc5d7 100644
---- a/vp8/encoder/x86/dct_sse2.asm
-+++ b/vp8/encoder/x86/dct_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/dct_x86.h b/vp8/encoder/x86/dct_x86.h
-index bc80e64..fec1a2e 100644
---- a/vp8/encoder/x86/dct_x86.h
-+++ b/vp8/encoder/x86/dct_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/encodemb_x86.h b/vp8/encoder/x86/encodemb_x86.h
-index 9397a6c..d1ba7d9 100644
---- a/vp8/encoder/x86/encodemb_x86.h
-+++ b/vp8/encoder/x86/encodemb_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/encodeopt.asm b/vp8/encoder/x86/encodeopt.asm
-index 1940471..cdc17a5 100644
---- a/vp8/encoder/x86/encodeopt.asm
-+++ b/vp8/encoder/x86/encodeopt.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/fwalsh_sse2.asm b/vp8/encoder/x86/fwalsh_sse2.asm
-index 7d86201..1966697 100644
---- a/vp8/encoder/x86/fwalsh_sse2.asm
-+++ b/vp8/encoder/x86/fwalsh_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/mcomp_x86.h b/vp8/encoder/x86/mcomp_x86.h
-index 5661491..c2b4b36 100644
---- a/vp8/encoder/x86/mcomp_x86.h
-+++ b/vp8/encoder/x86/mcomp_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/preproc_mmx.c b/vp8/encoder/x86/preproc_mmx.c
-index 69617ca..8b23bb5 100644
---- a/vp8/encoder/x86/preproc_mmx.c
-+++ b/vp8/encoder/x86/preproc_mmx.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/quantize_mmx.asm b/vp8/encoder/x86/quantize_mmx.asm
-index 847fc6e..25adca0 100644
---- a/vp8/encoder/x86/quantize_mmx.asm
-+++ b/vp8/encoder/x86/quantize_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/quantize_sse2.asm b/vp8/encoder/x86/quantize_sse2.asm
-new file mode 100644
-index 0000000..c64a8ba
---- /dev/null
-+++ b/vp8/encoder/x86/quantize_sse2.asm
-@@ -0,0 +1,254 @@
-+;
-+; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+;
-+; Use of this source code is governed by a BSD-style license and patent
-+; grant that can be found in the LICENSE file in the root of the source
-+; tree. All contributing project authors may be found in the AUTHORS
-+; file in the root of the source tree.
-+;
-+
-+
-+%include "vpx_ports/x86_abi_support.asm"
-+
-+
-+;int vp8_regular_quantize_b_impl_sse2(short *coeff_ptr, short *zbin_ptr,
-+; short *qcoeff_ptr,short *dequant_ptr,
-+; const int *default_zig_zag, short *round_ptr,
-+; short *quant_ptr, short *dqcoeff_ptr,
-+; unsigned short zbin_oq_value,
-+; short *zbin_boost_ptr);
-+;
-+global sym(vp8_regular_quantize_b_impl_sse2)
-+sym(vp8_regular_quantize_b_impl_sse2):
-+ push rbp
-+ mov rbp, rsp
-+ SHADOW_ARGS_TO_STACK 10
-+ push rsi
-+ push rdi
-+ push rbx
-+ ; end prolog
-+
-+ ALIGN_STACK 16, rax
-+
-+ %define abs_minus_zbin_lo 0
-+ %define abs_minus_zbin_hi 16
-+ %define temp_qcoeff_lo 32
-+ %define temp_qcoeff_hi 48
-+ %define save_xmm6 64
-+ %define save_xmm7 80
-+ %define eob 96
-+
-+ %define vp8_regularquantizeb_stack_size eob + 16
-+
-+ sub rsp, vp8_regularquantizeb_stack_size
-+
-+ movdqa DQWORD PTR[rsp + save_xmm6], xmm6
-+ movdqa DQWORD PTR[rsp + save_xmm7], xmm7
-+
-+ mov rdx, arg(0) ;coeff_ptr
-+ mov eax, arg(8) ;zbin_oq_value
-+
-+ mov rcx, arg(1) ;zbin_ptr
-+ movd xmm7, eax
-+
-+ movdqa xmm0, DQWORD PTR[rdx]
-+ movdqa xmm4, DQWORD PTR[rdx + 16]
-+
-+ movdqa xmm1, xmm0
-+ movdqa xmm5, xmm4
-+
-+ psraw xmm0, 15 ;sign of z (aka sz)
-+ psraw xmm4, 15 ;sign of z (aka sz)
-+
-+ pxor xmm1, xmm0
-+ pxor xmm5, xmm4
-+
-+ movdqa xmm2, DQWORD PTR[rcx] ;load zbin_ptr
-+ movdqa xmm3, DQWORD PTR[rcx + 16] ;load zbin_ptr
-+
-+ pshuflw xmm7, xmm7, 0
-+ psubw xmm1, xmm0 ;x = abs(z)
-+
-+ punpcklwd xmm7, xmm7 ;duplicated zbin_oq_value
-+ psubw xmm5, xmm4 ;x = abs(z)
-+
-+ paddw xmm2, xmm7
-+ paddw xmm3, xmm7
-+
-+ psubw xmm1, xmm2 ;sub (zbin_ptr + zbin_oq_value)
-+ psubw xmm5, xmm3 ;sub (zbin_ptr + zbin_oq_value)
-+
-+ mov rdi, arg(5) ;round_ptr
-+ mov rsi, arg(6) ;quant_ptr
-+
-+ movdqa DQWORD PTR[rsp + abs_minus_zbin_lo], xmm1
-+ movdqa DQWORD PTR[rsp + abs_minus_zbin_hi], xmm5
-+
-+ paddw xmm1, xmm2 ;add (zbin_ptr + zbin_oq_value) back
-+ paddw xmm5, xmm3 ;add (zbin_ptr + zbin_oq_value) back
-+
-+ movdqa xmm2, DQWORD PTR[rdi]
-+ movdqa xmm3, DQWORD PTR[rsi]
-+
-+ movdqa xmm6, DQWORD PTR[rdi + 16]
-+ movdqa xmm7, DQWORD PTR[rsi + 16]
-+
-+ paddw xmm1, xmm2
-+ paddw xmm5, xmm6
-+
-+ pmulhw xmm1, xmm3
-+ pmulhw xmm5, xmm7
-+
-+ mov rsi, arg(2) ;qcoeff_ptr
-+ pxor xmm6, xmm6
-+
-+ pxor xmm1, xmm0
-+ pxor xmm5, xmm4
-+
-+ psubw xmm1, xmm0
-+ psubw xmm5, xmm4
-+
-+ movdqa DQWORD PTR[rsp + temp_qcoeff_lo], xmm1
-+ movdqa DQWORD PTR[rsp + temp_qcoeff_hi], xmm5
-+
-+ movdqa DQWORD PTR[rsi], xmm6 ;zero qcoeff
-+ movdqa DQWORD PTR[rsi + 16], xmm6 ;zero qcoeff
-+
-+ xor rax, rax
-+ mov rcx, -1
-+
-+ mov [rsp + eob], rcx
-+ mov rsi, arg(9) ;zbin_boost_ptr
-+
-+ mov rbx, arg(4) ;default_zig_zag
-+
-+rq_zigzag_loop:
-+ movsxd rcx, DWORD PTR[rbx + rax*4] ;now we have rc
-+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
-+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
-+
-+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
-+
-+ sub edx, edi ;x - zbin
-+ jl rq_zigzag_1
-+
-+ mov rdi, arg(2) ;qcoeff_ptr
-+
-+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
-+
-+ cmp edx, 0
-+ je rq_zigzag_1
-+
-+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
-+
-+ mov rsi, arg(9) ;zbin_boost_ptr
-+ mov [rsp + eob], rax ;eob = i
-+
-+rq_zigzag_1:
-+ movsxd rcx, DWORD PTR[rbx + rax*4 + 4]
-+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
-+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
-+
-+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
-+ lea rax, [rax + 1]
-+
-+ sub edx, edi ;x - zbin
-+ jl rq_zigzag_1a
-+
-+ mov rdi, arg(2) ;qcoeff_ptr
-+
-+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
-+
-+ cmp edx, 0
-+ je rq_zigzag_1a
-+
-+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
-+
-+ mov rsi, arg(9) ;zbin_boost_ptr
-+ mov [rsp + eob], rax ;eob = i
-+
-+rq_zigzag_1a:
-+ movsxd rcx, DWORD PTR[rbx + rax*4 + 4]
-+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
-+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
-+
-+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
-+ lea rax, [rax + 1]
-+
-+ sub edx, edi ;x - zbin
-+ jl rq_zigzag_1b
-+
-+ mov rdi, arg(2) ;qcoeff_ptr
-+
-+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
-+
-+ cmp edx, 0
-+ je rq_zigzag_1b
-+
-+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
-+
-+ mov rsi, arg(9) ;zbin_boost_ptr
-+ mov [rsp + eob], rax ;eob = i
-+
-+rq_zigzag_1b:
-+ movsxd rcx, DWORD PTR[rbx + rax*4 + 4]
-+ movsx edi, WORD PTR [rsi] ;*zbin_boost_ptr aka zbin
-+ lea rsi, [rsi + 2] ;zbin_boost_ptr++
-+
-+ movsx edx, WORD PTR[rsp + abs_minus_zbin_lo + rcx *2]
-+ lea rax, [rax + 1]
-+
-+ sub edx, edi ;x - zbin
-+ jl rq_zigzag_1c
-+
-+ mov rdi, arg(2) ;qcoeff_ptr
-+
-+ movsx edx, WORD PTR[rsp + temp_qcoeff_lo + rcx *2]
-+
-+ cmp edx, 0
-+ je rq_zigzag_1c
-+
-+ mov WORD PTR[rdi + rcx * 2], dx ;qcoeff_ptr[rc] = temp_qcoeff[rc]
-+
-+ mov rsi, arg(9) ;zbin_boost_ptr
-+ mov [rsp + eob], rax ;eob = i
-+
-+rq_zigzag_1c:
-+ lea rax, [rax + 1]
-+
-+ cmp rax, 16
-+ jl rq_zigzag_loop
-+
-+ mov rdi, arg(2) ;qcoeff_ptr
-+ mov rcx, arg(3) ;dequant_ptr
-+ mov rsi, arg(7) ;dqcoeff_ptr
-+
-+ movdqa xmm2, DQWORD PTR[rdi]
-+ movdqa xmm3, DQWORD PTR[rdi + 16]
-+
-+ movdqa xmm0, DQWORD PTR[rcx]
-+ movdqa xmm1, DQWORD PTR[rcx + 16]
-+
-+ pmullw xmm0, xmm2
-+ pmullw xmm1, xmm3
-+
-+ movdqa DQWORD PTR[rsi], xmm0 ;store dqcoeff
-+ movdqa DQWORD PTR[rsi + 16], xmm1 ;store dqcoeff
-+
-+ mov rax, [rsp + eob]
-+
-+ movdqa xmm6, DQWORD PTR[rsp + save_xmm6]
-+ movdqa xmm7, DQWORD PTR[rsp + save_xmm7]
-+
-+ add rax, 1
-+
-+ add rsp, vp8_regularquantizeb_stack_size
-+ pop rsp
-+
-+ ; begin epilog
-+ pop rbx
-+ pop rdi
-+ pop rsi
-+ UNSHADOW_ARGS
-+ pop rbp
-+ ret
-diff --git a/vp8/encoder/x86/quantize_x86.h b/vp8/encoder/x86/quantize_x86.h
-new file mode 100644
-index 0000000..37d69a8
---- /dev/null
-+++ b/vp8/encoder/x86/quantize_x86.h
-@@ -0,0 +1,38 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license and patent
-+ * grant that can be found in the LICENSE file in the root of the source
-+ * tree. All contributing project authors may be found in the AUTHORS
-+ * file in the root of the source tree.
-+ */
-+
-+#ifndef QUANTIZE_X86_H
-+#define QUANTIZE_X86_H
-+
-+
-+/* Note:
-+ *
-+ * This platform is commonly built for runtime CPU detection. If you modify
-+ * any of the function mappings present in this file, be sure to also update
-+ * them in the function pointer initialization code
-+ */
-+#if HAVE_MMX
-+
-+#endif
-+
-+
-+#if HAVE_SSE2
-+extern prototype_quantize_block(vp8_regular_quantize_b_sse2);
-+
-+#if !CONFIG_RUNTIME_CPU_DETECT
-+
-+#undef vp8_quantize_quantb
-+#define vp8_quantize_quantb vp8_regular_quantize_b_sse2
-+
-+#endif
-+
-+#endif
-+
-+
-+#endif
-diff --git a/vp8/encoder/x86/sad_mmx.asm b/vp8/encoder/x86/sad_mmx.asm
-index a825698..4b35749 100644
---- a/vp8/encoder/x86/sad_mmx.asm
-+++ b/vp8/encoder/x86/sad_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/sad_sse2.asm b/vp8/encoder/x86/sad_sse2.asm
-index 53240bb..f4ef551 100644
---- a/vp8/encoder/x86/sad_sse2.asm
-+++ b/vp8/encoder/x86/sad_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/sad_sse3.asm b/vp8/encoder/x86/sad_sse3.asm
-index 38cc029..edfe82f 100644
---- a/vp8/encoder/x86/sad_sse3.asm
-+++ b/vp8/encoder/x86/sad_sse3.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/sad_ssse3.asm b/vp8/encoder/x86/sad_ssse3.asm
-index 1bb9561..79c4b44 100644
---- a/vp8/encoder/x86/sad_ssse3.asm
-+++ b/vp8/encoder/x86/sad_ssse3.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/subtract_mmx.asm b/vp8/encoder/x86/subtract_mmx.asm
-index ce3e610..d9babd3 100644
---- a/vp8/encoder/x86/subtract_mmx.asm
-+++ b/vp8/encoder/x86/subtract_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/variance_impl_mmx.asm b/vp8/encoder/x86/variance_impl_mmx.asm
-index d0da82a..31f66ec 100644
---- a/vp8/encoder/x86/variance_impl_mmx.asm
-+++ b/vp8/encoder/x86/variance_impl_mmx.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/variance_impl_sse2.asm b/vp8/encoder/x86/variance_impl_sse2.asm
-index 7e5ee28..1ccc6c5 100644
---- a/vp8/encoder/x86/variance_impl_sse2.asm
-+++ b/vp8/encoder/x86/variance_impl_sse2.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vp8/encoder/x86/variance_mmx.c b/vp8/encoder/x86/variance_mmx.c
-index 4a5b25b..788b833 100644
---- a/vp8/encoder/x86/variance_mmx.c
-+++ b/vp8/encoder/x86/variance_mmx.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/variance_sse2.c b/vp8/encoder/x86/variance_sse2.c
-index ea80753..78ecd7b 100644
---- a/vp8/encoder/x86/variance_sse2.c
-+++ b/vp8/encoder/x86/variance_sse2.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vp8/encoder/x86/variance_x86.h b/vp8/encoder/x86/variance_x86.h
-index 35fc90c..9cdd662 100644
---- a/vp8/encoder/x86/variance_x86.h
-+++ b/vp8/encoder/x86/variance_x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -240,7 +241,7 @@ extern prototype_sad_multi_dif_address(vp8_sad4x4x4d_sse3);
- #define vp8_variance_sad4x4x3 vp8_sad4x4x3_sse3
-
- #undef vp8_variance_sad16x16x4d
--#define vp8_variance_sad16x16x4 vp8_sad16x16x4d_sse3
-+#define vp8_variance_sad16x16x4d vp8_sad16x16x4d_sse3
-
- #undef vp8_variance_sad16x8x4d
- #define vp8_variance_sad16x8x4d vp8_sad16x8x4d_sse3
-diff --git a/vp8/encoder/x86/x86_csystemdependent.c b/vp8/encoder/x86/x86_csystemdependent.c
-index f1391ba..f6123a8 100644
---- a/vp8/encoder/x86/x86_csystemdependent.c
-+++ b/vp8/encoder/x86/x86_csystemdependent.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -120,6 +121,40 @@ void vp8_fast_quantize_b_sse(BLOCK *b, BLOCKD *d)
- );
- }
-
-+int vp8_regular_quantize_b_impl_sse2(short *coeff_ptr, short *zbin_ptr,
-+ short *qcoeff_ptr,short *dequant_ptr,
-+ const int *default_zig_zag, short *round_ptr,
-+ short *quant_ptr, short *dqcoeff_ptr,
-+ unsigned short zbin_oq_value,
-+ short *zbin_boost_ptr);
-+
-+void vp8_regular_quantize_b_sse2(BLOCK *b,BLOCKD *d)
-+{
-+ short *zbin_boost_ptr = &b->zrun_zbin_boost[0];
-+ short *coeff_ptr = &b->coeff[0];
-+ short *zbin_ptr = &b->zbin[0][0];
-+ short *round_ptr = &b->round[0][0];
-+ short *quant_ptr = &b->quant[0][0];
-+ short *qcoeff_ptr = d->qcoeff;
-+ short *dqcoeff_ptr = d->dqcoeff;
-+ short *dequant_ptr = &d->dequant[0][0];
-+ short zbin_oq_value = b->zbin_extra;
-+
-+ d->eob = vp8_regular_quantize_b_impl_sse2(
-+ coeff_ptr,
-+ zbin_ptr,
-+ qcoeff_ptr,
-+ dequant_ptr,
-+ vp8_default_zig_zag1d,
-+
-+ round_ptr,
-+ quant_ptr,
-+ dqcoeff_ptr,
-+ zbin_oq_value,
-+ zbin_boost_ptr
-+ );
-+}
-+
- int vp8_mbblock_error_xmm_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
- int vp8_mbblock_error_xmm(MACROBLOCK *mb, int dc)
- {
-@@ -250,6 +285,7 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
- /* cpi->rtcd.encodemb.sub* not implemented for wmt */
-
- cpi->rtcd.quantize.fastquantb = vp8_fast_quantize_b_sse;
-+ cpi->rtcd.quantize.quantb = vp8_regular_quantize_b_sse2;
- }
-
- #endif
-diff --git a/vp8/exports_dec b/vp8/exports_dec
-new file mode 100644
-index 0000000..f9b985c
---- /dev/null
-+++ b/vp8/exports_dec
-@@ -0,0 +1 @@
-+data vpx_codec_vp8_dx_algo
-diff --git a/vp8/exports_enc b/vp8/exports_enc
-new file mode 100644
-index 0000000..9967011
---- /dev/null
-+++ b/vp8/exports_enc
-@@ -0,0 +1 @@
-+data vpx_codec_vp8_cx_algo
-diff --git a/vp8/vp8.h b/vp8/vp8.h
-deleted file mode 100644
-index 87ca217..0000000
---- a/vp8/vp8.h
-+++ /dev/null
-@@ -1,116 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\defgroup vp8 VP8
-- * \ingroup codecs
-- * VP8 is vpx's newest video compression algorithm that uses motion
-- * compensated prediction, Discrete Cosine Transform (DCT) coding of the
-- * prediction error signal and context dependent entropy coding techniques
-- * based on arithmatic principles. It features:
-- * - YUV 4:2:0 image format
-- * - Macro-block based coding (16x16 luma plus two 8x8 chroma)
-- * - 1/4 (1/8) pixel accuracy motion compensated prediction
-- * - 4x4 DCT transform
-- * - 128 level linear quantizer
-- * - In loop deblocking filter
-- * - Context-based entropy coding
-- *
-- * @{
-- */
--/*!\file vp8.h
-- * \brief Provides controls common to both the VP8 encoder and decoder.
-- */
--#ifndef VP8_H
--#define VP8_H
--#include "vpx_codec_impl_top.h"
--
--/*!\brief Control functions
-- *
-- * The set of macros define the control functions of VP8 interface
-- */
--enum vp8_dec_control_id
--{
-- VP8_SET_REFERENCE = 1, /**< pass in an external frame into decoder to be used as reference frame */
-- VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
-- VP8_SET_POSTPROC = 3, /**< set decoder's the post processing settings */
-- VP8_COMMON_CTRL_ID_MAX
--};
--
--/*!\brief post process flags
-- *
-- * The set of macros define VP8 decoder post processing flags
-- */
--enum vp8_postproc_level
--{
-- VP8_NOFILTERING = 0,
-- VP8_DEBLOCK = 1,
-- VP8_DEMACROBLOCK = 2,
-- VP8_ADDNOISE = 4,
--};
--
--/*!\brief post process flags
-- *
-- * This define a structure that describe the post processing settings. For
-- * the best objective measure (using thet PSNR metric) set post_proc_flag
-- * to VP8_DEBLOCK and deblocking_level to 1.
-- */
--
--typedef struct vp8_postproc_cfg
--{
-- int post_proc_flag; /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
-- int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
-- int noise_level; /**< the strength of additive noise, valid range [0, 16] */
--} vp8_postproc_cfg_t;
--
--/*!\brief reference frame type
-- *
-- * The set of macros define the type of VP8 reference frames
-- */
--typedef enum vpx_ref_frame_type
--{
-- VP8_LAST_FRAME = 1,
-- VP8_GOLD_FRAME = 2,
-- VP8_ALTR_FRAME = 4
--} vpx_ref_frame_type_t;
--
--/*!\brief reference frame data struct
-- *
-- * define the data struct to access vp8 reference frames
-- */
--
--typedef struct vpx_ref_frame
--{
-- vpx_ref_frame_type_t frame_type; /**< which reference frame */
-- vpx_image_t img; /**< reference frame data in image format */
--} vpx_ref_frame_t;
--
--
--/*!\brief vp8 decoder control funciton parameter type
-- *
-- * defines the data type for each of VP8 decoder control funciton requires
-- */
--
--VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *)
--VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
--VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
--
--
--/*! @} - end defgroup vp8 */
--
--#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
--/* The following definitions are provided for backward compatibility with
-- * the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
-- */
--
--DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
--#endif
--
--#include "vpx_codec_impl_bottom.h"
--#endif
-diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk
-index ec467c5..5ed53ba 100644
---- a/vp8/vp8_common.mk
-+++ b/vp8/vp8_common.mk
-@@ -1,19 +1,17 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
- #add this file to the installed sources list
- VP8_COMMON_SRCS-yes += vp8_common.mk
-
--#common interface
--VP8_COMMON_SRCS-yes += vp8.h
--
- CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)common
- VP8_COMMON_SRCS-yes += common/type_aliases.h
- VP8_COMMON_SRCS-yes += common/pragmas.h
-diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
-index e129ec9..d63c039 100644
---- a/vp8/vp8_cx_iface.c
-+++ b/vp8/vp8_cx_iface.c
-@@ -1,18 +1,19 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
--#include "vpx_codec/vpx_codec.h"
--#include "vpx_codec/internal/vpx_codec_internal.h"
-+#include "vpx/vpx_codec.h"
-+#include "vpx/internal/vpx_codec_internal.h"
- #include "vpx_version.h"
- #include "onyx_int.h"
--#include "vp8e.h"
-+#include "vpx/vp8e.h"
- #include "onyx.h"
- #include <stdlib.h>
- #include <string.h>
-@@ -52,15 +53,15 @@ static const struct extraconfig_map extracfg_map[] =
- NULL,
- #if !(CONFIG_REALTIME_ONLY)
- VP8_BEST_QUALITY_ENCODING, /* Encoding Mode */
-- -4, /* cpu_used */
-+ 0, /* cpu_used */
- #else
- VP8_REAL_TIME_ENCODING, /* Encoding Mode */
-- -8, /* cpu_used */
-+ 4, /* cpu_used */
- #endif
- 0, /* enable_auto_alt_ref */
- 0, /* noise_sensitivity */
- 0, /* Sharpness */
-- 800, /* static_thresh */
-+ 0, /* static_thresh */
- VP8_ONE_TOKENPARTITION, /* token_partitions */
- 0, /* arnr_max_frames */
- 0, /* arnr_strength */
-@@ -81,7 +82,7 @@ struct vpx_codec_alg_priv
- vpx_image_t preview_img;
- unsigned int next_frame_flag;
- vp8_postproc_cfg_t preview_ppcfg;
-- vpx_codec_pkt_list_decl(26) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
-+ vpx_codec_pkt_list_decl(64) pkt_list; // changed to accomendate the maximum number of lagged frames allowed
- int deprecated_mode;
- unsigned int fixed_kf_cntr;
- };
-@@ -108,7 +109,7 @@ update_error_state(vpx_codec_alg_priv_t *ctx,
- } while(0)
-
- #define RANGE_CHECK(p,memb,lo,hi) do {\
-- if(!((p)->memb >= (lo) && (p)->memb <= hi)) \
-+ if(!(((p)->memb == lo || (p)->memb > (lo)) && (p)->memb <= hi)) \
- ERROR(#memb " out of range ["#lo".."#hi"]");\
- } while(0)
-
-@@ -211,10 +212,10 @@ static vpx_codec_err_t validate_img(vpx_codec_alg_priv_t *ctx,
- {
- switch (img->fmt)
- {
-- case IMG_FMT_YV12:
-- case IMG_FMT_I420:
-- case IMG_FMT_VPXI420:
-- case IMG_FMT_VPXYV12:
-+ case VPX_IMG_FMT_YV12:
-+ case VPX_IMG_FMT_I420:
-+ case VPX_IMG_FMT_VPXI420:
-+ case VPX_IMG_FMT_VPXYV12:
- break;
- default:
- ERROR("Invalid image format. Only YV12 and I420 images are supported");
-@@ -536,20 +537,20 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
- YV12_BUFFER_CONFIG *yv12)
- {
- vpx_codec_err_t res = VPX_CODEC_OK;
-- yv12->y_buffer = img->planes[PLANE_Y];
-- yv12->u_buffer = img->planes[PLANE_U];
-- yv12->v_buffer = img->planes[PLANE_V];
-+ yv12->y_buffer = img->planes[VPX_PLANE_Y];
-+ yv12->u_buffer = img->planes[VPX_PLANE_U];
-+ yv12->v_buffer = img->planes[VPX_PLANE_V];
-
- yv12->y_width = img->d_w;
- yv12->y_height = img->d_h;
- yv12->uv_width = (1 + yv12->y_width) / 2;
- yv12->uv_height = (1 + yv12->y_height) / 2;
-
-- yv12->y_stride = img->stride[PLANE_Y];
-- yv12->uv_stride = img->stride[PLANE_U];
-+ yv12->y_stride = img->stride[VPX_PLANE_Y];
-+ yv12->uv_stride = img->stride[VPX_PLANE_U];
-
-- yv12->border = (img->stride[PLANE_Y] - img->w) / 2;
-- yv12->clrtype = (img->fmt == IMG_FMT_VPXI420 || img->fmt == IMG_FMT_VPXYV12); //REG_YUV = 0
-+ yv12->border = (img->stride[VPX_PLANE_Y] - img->w) / 2;
-+ yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12); //REG_YUV = 0
- return res;
- }
-
-@@ -846,7 +847,7 @@ static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
- {
-
- /*
-- vpx_img_wrap(&ctx->preview_img, IMG_FMT_YV12,
-+ vpx_img_wrap(&ctx->preview_img, VPX_IMG_FMT_YV12,
- sd.y_width + 2*VP8BORDERINPIXELS,
- sd.y_height + 2*VP8BORDERINPIXELS,
- 1,
-@@ -857,23 +858,23 @@ static vpx_image_t *vp8e_get_preview(vpx_codec_alg_priv_t *ctx)
- */
-
- ctx->preview_img.bps = 12;
-- ctx->preview_img.planes[PLANE_Y] = sd.y_buffer;
-- ctx->preview_img.planes[PLANE_U] = sd.u_buffer;
-- ctx->preview_img.planes[PLANE_V] = sd.v_buffer;
-+ ctx->preview_img.planes[VPX_PLANE_Y] = sd.y_buffer;
-+ ctx->preview_img.planes[VPX_PLANE_U] = sd.u_buffer;
-+ ctx->preview_img.planes[VPX_PLANE_V] = sd.v_buffer;
-
- if (sd.clrtype == REG_YUV)
-- ctx->preview_img.fmt = IMG_FMT_I420;
-+ ctx->preview_img.fmt = VPX_IMG_FMT_I420;
- else
-- ctx->preview_img.fmt = IMG_FMT_VPXI420;
-+ ctx->preview_img.fmt = VPX_IMG_FMT_VPXI420;
-
- ctx->preview_img.x_chroma_shift = 1;
- ctx->preview_img.y_chroma_shift = 1;
-
- ctx->preview_img.d_w = ctx->cfg.g_w;
- ctx->preview_img.d_h = ctx->cfg.g_h;
-- ctx->preview_img.stride[PLANE_Y] = sd.y_stride;
-- ctx->preview_img.stride[PLANE_U] = sd.uv_stride;
-- ctx->preview_img.stride[PLANE_V] = sd.uv_stride;
-+ ctx->preview_img.stride[VPX_PLANE_Y] = sd.y_stride;
-+ ctx->preview_img.stride[VPX_PLANE_U] = sd.uv_stride;
-+ ctx->preview_img.stride[VPX_PLANE_V] = sd.uv_stride;
- ctx->preview_img.w = sd.y_width;
- ctx->preview_img.h = sd.y_height;
-
-@@ -1067,7 +1068,7 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] =
- #endif
- vpx_codec_iface_t vpx_codec_vp8_cx_algo =
- {
-- "vpx Technologies VP8 Encoder" VERSION_STRING,
-+ "WebM Project VP8 Encoder" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR,
- /* vpx_codec_caps_t caps; */
-@@ -1156,7 +1157,7 @@ static vpx_codec_err_t api1_encode(vpx_codec_alg_priv_t *ctx,
-
- vpx_codec_iface_t vpx_enc_vp8_algo =
- {
-- "vpx Technologies VP8 Encoder (Deprecated API)" VERSION_STRING,
-+ "WebM Project VP8 Encoder (Deprecated API)" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_ENCODER,
- /* vpx_codec_caps_t caps; */
-diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
-index 3e6cdf4..a99364d 100644
---- a/vp8/vp8_dx_iface.c
-+++ b/vp8/vp8_dx_iface.c
-@@ -1,18 +1,19 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
- #include <stdlib.h>
- #include <string.h>
--#include "vpx_codec/vpx_decoder.h"
--#include "vp8dx.h"
--#include "vpx_codec/internal/vpx_codec_internal.h"
-+#include "vpx/vpx_decoder.h"
-+#include "vpx/vp8dx.h"
-+#include "vpx/internal/vpx_codec_internal.h"
- #include "vpx_version.h"
- #include "onyxd.h"
- #include "onyxd_int.h"
-@@ -257,12 +258,12 @@ static vpx_codec_err_t vp8_peek_si(const uint8_t *data,
-
- vpx_codec_err_t res = VPX_CODEC_OK;
- {
-- /*Parse from VP8 compressed data, the implies knowledge of the
-- *VP8 bitsteam.
-- * First 3 byte header including version, frame type and an offset
-- * Next 3 bytes are image sizewith 12 bit each for width and height
-+ /* Parse uncompresssed part of key frame header.
-+ * 3 bytes:- including version, frame type and an offset
-+ * 3 bytes:- sync code (0x9d, 0x01, 0x2a)
-+ * 4 bytes:- including image width and height in the lowest 14 bits
-+ * of each 2-byte value.
- */
--
- si->is_kf = 0;
-
- if (data_sz >= 10 && !(data[0] & 0x01)) /* I-Frame */
-@@ -434,7 +435,7 @@ static vpx_codec_err_t vp8_decode(vpx_codec_alg_priv_t *ctx,
- unsigned int a_w = (sd.y_width + 15) & ~15;
- unsigned int a_h = (sd.y_height + 15) & ~15;
-
-- vpx_img_wrap(&ctx->img, IMG_FMT_I420,
-+ vpx_img_wrap(&ctx->img, VPX_IMG_FMT_I420,
- a_w + 2 * VP8BORDERINPIXELS,
- a_h + 2 * VP8BORDERINPIXELS,
- 1,
-@@ -557,20 +558,20 @@ static vpx_codec_err_t image2yuvconfig(const vpx_image_t *img,
- YV12_BUFFER_CONFIG *yv12)
- {
- vpx_codec_err_t res = VPX_CODEC_OK;
-- yv12->y_buffer = img->planes[PLANE_Y];
-- yv12->u_buffer = img->planes[PLANE_U];
-- yv12->v_buffer = img->planes[PLANE_V];
-+ yv12->y_buffer = img->planes[VPX_PLANE_Y];
-+ yv12->u_buffer = img->planes[VPX_PLANE_U];
-+ yv12->v_buffer = img->planes[VPX_PLANE_V];
-
- yv12->y_width = img->d_w;
- yv12->y_height = img->d_h;
- yv12->uv_width = yv12->y_width / 2;
- yv12->uv_height = yv12->y_height / 2;
-
-- yv12->y_stride = img->stride[PLANE_Y];
-- yv12->uv_stride = img->stride[PLANE_U];
-+ yv12->y_stride = img->stride[VPX_PLANE_Y];
-+ yv12->uv_stride = img->stride[VPX_PLANE_U];
-
-- yv12->border = (img->stride[PLANE_Y] - img->d_w) / 2;
-- yv12->clrtype = (img->fmt == IMG_FMT_VPXI420 || img->fmt == IMG_FMT_VPXYV12);
-+ yv12->border = (img->stride[VPX_PLANE_Y] - img->d_w) / 2;
-+ yv12->clrtype = (img->fmt == VPX_IMG_FMT_VPXI420 || img->fmt == VPX_IMG_FMT_VPXYV12);
-
- return res;
- }
-@@ -656,7 +657,7 @@ vpx_codec_ctrl_fn_map_t vp8_ctf_maps[] =
- #endif
- vpx_codec_iface_t vpx_codec_vp8_dx_algo =
- {
-- "vpx Technologies VP8 Decoder" VERSION_STRING,
-+ "WebM Project VP8 Decoder" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
- /* vpx_codec_caps_t caps; */
-@@ -679,7 +680,7 @@ vpx_codec_iface_t vpx_codec_vp8_dx_algo =
- */
- vpx_codec_iface_t vpx_codec_vp8_algo =
- {
-- "vpx Technologies VP8 Decoder (Deprecated API)" VERSION_STRING,
-+ "WebM Project VP8 Decoder (Deprecated API)" VERSION_STRING,
- VPX_CODEC_INTERNAL_ABI_VERSION,
- VPX_CODEC_CAP_DECODER | VP8_CAP_POSTPROC,
- /* vpx_codec_caps_t caps; */
-diff --git a/vp8/vp8cx.h b/vp8/vp8cx.h
-deleted file mode 100644
-index dd48c07..0000000
---- a/vp8/vp8cx.h
-+++ /dev/null
-@@ -1,261 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\defgroup vp8_encoder WebM VP8 Encoder
-- * \ingroup vp8
-- *
-- * @{
-- */
--#include "vp8.h"
--
--/*!\file vp8cx.h
-- * \brief Provides definitions for using the VP8 encoder algorithm within the
-- * vpx Codec Interface.
-- */
--#ifndef VP8CX_H
--#define VP8CX_H
--#include "vpx_codec_impl_top.h"
--
--/*!\brief Algorithm interface for VP8
-- *
-- * This interface provides the capability to encode raw VP8 streams, as would
-- * be found in AVI files.
-- */
--extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
--
--
--/*
-- * Algorithm Flags
-- */
--
--/*!\brief Don't reference the last frame
-- *
-- * When this flag is set, the encoder will not use the last frame as a
-- * predictor. When not set, the encoder will choose whether to use the
-- * last frame or not automatically.
-- */
--#define VP8_EFLAG_NO_REF_LAST (1<<16)
--
--
--/*!\brief Don't reference the golden frame
-- *
-- * When this flag is set, the encoder will not use the golden frame as a
-- * predictor. When not set, the encoder will choose whether to use the
-- * golden frame or not automatically.
-- */
--#define VP8_EFLAG_NO_REF_GF (1<<17)
--
--
--/*!\brief Don't reference the alternate reference frame
-- *
-- * When this flag is set, the encoder will not use the alt ref frame as a
-- * predictor. When not set, the encoder will choose whether to use the
-- * alt ref frame or not automatically.
-- */
--#define VP8_EFLAG_NO_REF_ARF (1<<21)
--
--
--/*!\brief Don't update the last frame
-- *
-- * When this flag is set, the encoder will not update the last frame with
-- * the contents of the current frame.
-- */
--#define VP8_EFLAG_NO_UPD_LAST (1<<18)
--
--
--/*!\brief Don't update the golden frame
-- *
-- * When this flag is set, the encoder will not update the golden frame with
-- * the contents of the current frame.
-- */
--#define VP8_EFLAG_NO_UPD_GF (1<<22)
--
--
--/*!\brief Don't update the alternate reference frame
-- *
-- * When this flag is set, the encoder will not update the alt ref frame with
-- * the contents of the current frame.
-- */
--#define VP8_EFLAG_NO_UPD_ARF (1<<23)
--
--
--/*!\brief Force golden frame update
-- *
-- * When this flag is set, the encoder copy the contents of the current frame
-- * to the golden frame buffer.
-- */
--#define VP8_EFLAG_FORCE_GF (1<<19)
--
--
--/*!\brief Force alternate reference frame update
-- *
-- * When this flag is set, the encoder copy the contents of the current frame
-- * to the alternate reference frame buffer.
-- */
--#define VP8_EFLAG_FORCE_ARF (1<<24)
--
--
--/*!\brief Disable entropy update
-- *
-- * When this flag is set, the encoder will not update its internal entropy
-- * model based on the entropy of this frame.
-- */
--#define VP8_EFLAG_NO_UPD_ENTROPY (1<<20)
--
--
--/*!\brief VP8 encoder control functions
-- *
-- * The set of macros define the control functions of VP8 encoder interface
-- */
--enum vp8e_enc_control_id
--{
-- VP8E_UPD_ENTROPY = 5, /**< control function to set mode of entropy update in encoder */
-- VP8E_UPD_REFERENCE, /**< control function to set reference update mode in encoder */
-- VP8E_USE_REFERENCE, /**< control function to set which reference frame encoder can use */
-- VP8E_SET_ROI_MAP, /**< control function to pass an ROI map to encoder */
-- VP8E_SET_ACTIVEMAP, /**< control function to pass an Active map to encoder */
-- VP8E_SET_SCALEMODE = 11, /**< control function to set encoder scaling mode */
-- VP8E_SET_CPUUSED = 13, /**< control function to set vp8 encoder cpuused */
-- VP8E_SET_ENABLEAUTOALTREF, /**< control function to enable vp8 to automatic set and use altref frame */
-- VP8E_SET_NOISE_SENSITIVITY, /**< control function to set noise sensitivity */
-- VP8E_SET_SHARPNESS, /**< control function to set sharpness */
-- VP8E_SET_STATIC_THRESHOLD, /**< control function to set the threshold for macroblocks treated static */
-- VP8E_SET_TOKEN_PARTITIONS, /**< control function to set the number of token partitions */
-- VP8E_GET_LAST_QUANTIZER, /**< return the quantizer chosen by the
-- encoder for the last frame using the internal
-- scale */
-- VP8E_GET_LAST_QUANTIZER_64, /**< return the quantizer chosen by the
-- encoder for the last frame, using the 0..63
-- scale as used by the rc_*_quantizer config
-- parameters */
-- VP8E_SET_ARNR_MAXFRAMES, /**< control function to set the max number of frames blurred creating arf*/
-- VP8E_SET_ARNR_STRENGTH , /**< control function to set the filter strength for the arf */
-- VP8E_SET_ARNR_TYPE , /**< control function to set the type of filter to use for the arf*/
--} ;
--
--/*!\brief vpx 1-D scaling mode
-- *
-- * This set of constants define 1-D vpx scaling modes
-- */
--typedef enum vpx_scaling_mode_1d
--{
-- VP8E_NORMAL = 0,
-- VP8E_FOURFIVE = 1,
-- VP8E_THREEFIVE = 2,
-- VP8E_ONETWO = 3
--} VPX_SCALING_MODE;
--
--
--/*!\brief vpx region of interest map
-- *
-- * These defines the data structures for the region of interest map
-- *
-- */
--
--typedef struct vpx_roi_map
--{
-- unsigned char *roi_map; /**< specify an id between 0 and 3 for each 16x16 region within a frame */
-- unsigned int rows; /**< number of rows */
-- unsigned int cols; /**< number of cols */
-- int delta_q[4]; /**< quantizer delta [-64, 64] off baseline for regions with id between 0 and 3*/
-- int delta_lf[4]; /**< loop filter strength delta [-32, 32] for regions with id between 0 and 3 */
-- unsigned int static_threshold[4];/**< threshold for region to be treated as static */
--} vpx_roi_map_t;
--
--/*!\brief vpx active region map
-- *
-- * These defines the data structures for active region map
-- *
-- */
--
--
--typedef struct vpx_active_map
--{
-- unsigned char *active_map; /**< specify an on (1) or off (0) each 16x16 region within a frame */
-- unsigned int rows; /**< number of rows */
-- unsigned int cols; /**< number of cols */
--} vpx_active_map_t;
--
--/*!\brief vpx image scaling mode
-- *
-- * This defines the data structure for image scaling mode
-- *
-- */
--typedef struct vpx_scaling_mode
--{
-- VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
-- VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
--} vpx_scaling_mode_t;
--
--/*!\brief VP8 encoding mode
-- *
-- * This defines VP8 encoding mode
-- *
-- */
--typedef enum
--{
-- VP8_BEST_QUALITY_ENCODING,
-- VP8_GOOD_QUALITY_ENCODING,
-- VP8_REAL_TIME_ENCODING
--} vp8e_encoding_mode;
--
--/*!\brief VP8 token partition mode
-- *
-- * This defines VP8 partitioning mode for compressed data, i.e., the number of
-- * sub-streams in the bitstream. Used for parallelized decoding.
-- *
-- */
--
--typedef enum
--{
-- VP8_ONE_TOKENPARTITION = 0,
-- VP8_TWO_TOKENPARTITION = 1,
-- VP8_FOUR_TOKENPARTITION = 2,
-- VP8_EIGHT_TOKENPARTITION = 3,
--} vp8e_token_partitions;
--
--
--/*!\brief VP8 encoder control function parameter type
-- *
-- * Defines the data types that VP8E control functions take. Note that
-- * additional common controls are defined in vp8.h
-- *
-- */
--
--
--/* These controls have been deprecated in favor of the flags parameter to
-- * vpx_codec_encode(). See the definition of VP8_EFLAG_* above.
-- */
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
--
--VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
--VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
--VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
--
--VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
--VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
--VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
--VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
--VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
--VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, vp8e_token_partitions)
--
--VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
--VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH , unsigned int)
--VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_TYPE , unsigned int)
--
--
--VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
--VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
--
--/*! @} - end defgroup vp8_encoder */
--#include "vpx_codec_impl_bottom.h"
--#endif
-diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk
-index e7e7663..971a175 100644
---- a/vp8/vp8cx.mk
-+++ b/vp8/vp8cx.mk
-@@ -1,14 +1,18 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
-+
-+VP8_CX_EXPORTS += exports_enc
-+
- VP8_CX_SRCS-yes += $(VP8_COMMON_SRCS-yes)
- VP8_CX_SRCS-no += $(VP8_COMMON_SRCS-no)
- VP8_CX_SRCS_REMOVE-yes += $(VP8_COMMON_SRCS_REMOVE-yes)
-@@ -18,7 +22,7 @@ ifeq ($(ARCH_ARM),yes)
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx_arm.mk
- endif
-
--VP8_CX_SRCS-yes += vp8cx.h vp8e.h vp8_cx_iface.c
-+VP8_CX_SRCS-yes += vp8_cx_iface.c
-
- # encoder
- #INCLUDES += algo/vpx_common/vpx_mem/include
-@@ -70,7 +74,7 @@ VP8_CX_SRCS-yes += encoder/quantize.c
- VP8_CX_SRCS-yes += encoder/ratectrl.c
- VP8_CX_SRCS-yes += encoder/rdopt.c
- VP8_CX_SRCS-yes += encoder/sad_c.c
--VP8_CX_SRCS-yes += encoder/ssim.c
-+VP8_CX_SRCS-$(CONFIG_PSNR) += encoder/ssim.c
- VP8_CX_SRCS-yes += encoder/tokenize.c
- VP8_CX_SRCS-yes += encoder/treewriter.c
- VP8_CX_SRCS-yes += encoder/variance_c.c
-@@ -94,11 +98,10 @@ VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/variance_impl_sse2.asm
- VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/sad_sse2.asm
- VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/dct_sse2.asm
- VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/fwalsh_sse2.asm
-+VP8_CX_SRCS-$(HAVE_SSE2) += encoder/x86/quantize_sse2.asm
- VP8_CX_SRCS-$(HAVE_SSE3) += encoder/x86/sad_sse3.asm
- VP8_CX_SRCS-$(HAVE_SSSE3) += encoder/x86/sad_ssse3.asm
- VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/quantize_mmx.asm
- VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += encoder/x86/encodeopt.asm
-
- VP8_CX_SRCS-yes := $(filter-out $(VP8_CX_SRCS_REMOVE-yes),$(VP8_CX_SRCS-yes))
--
--INSTALL-LIBS-yes += include/vp8.h include/vp8e.h include/vp8cx.h
-diff --git a/vp8/vp8cx_arm.mk b/vp8/vp8cx_arm.mk
-index f0753d9..16009f9 100644
---- a/vp8/vp8cx_arm.mk
-+++ b/vp8/vp8cx_arm.mk
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/vp8/vp8dx.h b/vp8/vp8dx.h
-deleted file mode 100644
-index 7310b3b..0000000
---- a/vp8/vp8dx.h
-+++ /dev/null
-@@ -1,41 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--#include "vp8.h"
--
--/*!\defgroup vp8_decoder WebM VP8 Decoder
-- * \ingroup vp8
-- *
-- * @{
-- */
--/*!\file vp8dx.h
-- * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder
-- * interface.
-- */
--#ifndef VP8DX_H
--#define VP8DX_H
--#include "vpx_codec_impl_top.h"
--
--/*!\brief Algorithm interface for VP8
-- *
-- * This interface provides the capability to decode raw VP8 streams, as would
-- * be found in AVI files and other non-Flash uses.
-- */
--extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
--
--/* Include controls common to both the encoder and decoder */
--#include "vp8.h"
--
--
--/*! @} - end defgroup vp8_decoder */
--
--
--#include "vpx_codec_impl_bottom.h"
--#endif
-diff --git a/vp8/vp8dx.mk b/vp8/vp8dx.mk
-index e6af543..24f18b7 100644
---- a/vp8/vp8dx.mk
-+++ b/vp8/vp8dx.mk
-@@ -1,14 +1,18 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
-+
-+VP8_DX_EXPORTS += exports_dec
-+
- VP8_DX_SRCS-yes += $(VP8_COMMON_SRCS-yes)
- VP8_DX_SRCS-no += $(VP8_COMMON_SRCS-no)
- VP8_DX_SRCS_REMOVE-yes += $(VP8_COMMON_SRCS_REMOVE-yes)
-@@ -18,7 +22,7 @@ ifeq ($(ARCH_ARM),yes)
- include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx_arm.mk
- endif
-
--VP8_DX_SRCS-yes += vp8dx.h vp8_dx_iface.c
-+VP8_DX_SRCS-yes += vp8_dx_iface.c
-
- CFLAGS+=-I$(SRC_PATH_BARE)/$(VP8_PREFIX)decoder
-
-@@ -69,8 +73,6 @@ VP8_DX_SRCS-yes += decoder/threading.c
-
- VP8_DX_SRCS-yes := $(filter-out $(VP8_DX_SRCS_REMOVE-yes),$(VP8_DX_SRCS-yes))
-
--INSTALL-LIBS-yes += include/vp8.h include/vp8dx.h
--
- VP8_DX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += decoder/x86/dequantize_x86.h
- VP8_DX_SRCS-$(ARCH_X86)$(ARCH_X86_64) += decoder/x86/x86_dsystemdependent.c
- VP8_DX_SRCS-$(HAVE_MMX) += decoder/x86/dequantize_mmx.asm
-diff --git a/vp8/vp8dx_arm.mk b/vp8/vp8dx_arm.mk
-index 1b4a7ec..58ccac5 100644
---- a/vp8/vp8dx_arm.mk
-+++ b/vp8/vp8dx_arm.mk
-@@ -1,10 +1,11 @@
- ##
- ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
- ##
-
-
-diff --git a/vp8/vp8e.h b/vp8/vp8e.h
-deleted file mode 100644
-index a90aa2a..0000000
---- a/vp8/vp8e.h
-+++ /dev/null
-@@ -1,62 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/* This file contains backwards compatibility stubs for applications using
-- * the VP8 version 1.0 API.
-- */
--#ifndef VP8E_H
--#define VP8E_H
--#include "vpx_codec_impl_top.h"
--
--#if defined(VPX_CODEC_DISABLE_COMPAT) && VPX_CODEC_DISABLE_COMPAT
--#error "Backwards compatibility disabled: don't include vp8e.h"
--#endif
--
--#include "vp8cx.h"
--DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_enc_vp8_algo DEPRECATED;
--
--
--enum
--{
-- VP8E_SET_REFERENCE = VP8_SET_REFERENCE,
-- VP8E_COPY_REFERENCE = VP8_COPY_REFERENCE,
-- VP8E_SET_PREVIEWPP = VP8_SET_POSTPROC,
-- VP8E_SET_FLUSHFLAG = 4,
-- VP8E_SET_FRAMETYPE = 10,
-- VP8E_SET_ENCODING_MODE = 12
--};
--
--#define NORMAL_FRAME (0)
--#define KEY_FRAME (1)
--
--/* Change VP8E to VP8 to get the undeprecated version of these (defined in
-- * vp8.h)
-- */
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_REFERENCE, vpx_ref_frame_t *)
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_COPY_REFERENCE, vpx_ref_frame_t *)
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_PREVIEWPP, vp8_postproc_cfg_t *)
--
--
--/* Flush is done by calling vpx_codec_encode with a NULL input image. */
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FLUSHFLAG, int)
--
--
--/* Frame type is set with a flag to vpx_codec_control. See VPX_EFLAG_FORCE_KF
-- */
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FRAMETYPE, int)
--
--
--/* This control has been deprecated in favor of the duration parameter to
-- * vpx_codec_encode(). Use the #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
-- * #VPX_DL_BEST_QUALITY constants to that parameter instead.
-- */
--VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ENCODING_MODE, vp8e_encoding_mode)
--#include "vpx_codec_impl_bottom.h"
--#endif
-diff --git a/vpx/exports_com b/vpx/exports_com
-new file mode 100644
-index 0000000..2ab0509
---- /dev/null
-+++ b/vpx/exports_com
-@@ -0,0 +1,16 @@
-+text vpx_codec_build_config
-+text vpx_codec_control_
-+text vpx_codec_destroy
-+text vpx_codec_err_to_string
-+text vpx_codec_error
-+text vpx_codec_error_detail
-+text vpx_codec_get_caps
-+text vpx_codec_iface_name
-+text vpx_codec_version
-+text vpx_codec_version_extra_str
-+text vpx_codec_version_str
-+text vpx_img_alloc
-+text vpx_img_flip
-+text vpx_img_free
-+text vpx_img_set_rect
-+text vpx_img_wrap
-diff --git a/vpx/exports_dec b/vpx/exports_dec
-new file mode 100644
-index 0000000..ed121f7
---- /dev/null
-+++ b/vpx/exports_dec
-@@ -0,0 +1,9 @@
-+text vpx_codec_dec_init_ver
-+text vpx_codec_decode
-+text vpx_codec_get_frame
-+text vpx_codec_get_mem_map
-+text vpx_codec_get_stream_info
-+text vpx_codec_peek_stream_info
-+text vpx_codec_register_put_frame_cb
-+text vpx_codec_register_put_slice_cb
-+text vpx_codec_set_mem_map
-diff --git a/vpx/exports_enc b/vpx/exports_enc
-new file mode 100644
-index 0000000..3d56749
---- /dev/null
-+++ b/vpx/exports_enc
-@@ -0,0 +1,8 @@
-+text vpx_codec_enc_config_default
-+text vpx_codec_enc_config_set
-+text vpx_codec_enc_init_ver
-+text vpx_codec_encode
-+text vpx_codec_get_cx_data
-+text vpx_codec_get_global_headers
-+text vpx_codec_get_preview_frame
-+text vpx_codec_set_cx_data_buf
-diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
-new file mode 100644
-index 0000000..c653cc5
---- /dev/null
-+++ b/vpx/internal/vpx_codec_internal.h
-@@ -0,0 +1,457 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\file decoder_impl.h
-+ * \brief Describes the decoder algorithm interface for algorithm
-+ * implementations.
-+ *
-+ * This file defines the private structures and data types that are only
-+ * relevant to implementing an algorithm, as opposed to using it.
-+ *
-+ * To create a decoder algorithm class, an interface structure is put
-+ * into the global namespace:
-+ * <pre>
-+ * my_codec.c:
-+ * vpx_codec_iface_t my_codec = {
-+ * "My Codec v1.0",
-+ * VPX_CODEC_ALG_ABI_VERSION,
-+ * ...
-+ * };
-+ * </pre>
-+ *
-+ * An application instantiates a specific decoder instance by using
-+ * vpx_codec_init() and a pointer to the algorithm's interface structure:
-+ * <pre>
-+ * my_app.c:
-+ * extern vpx_codec_iface_t my_codec;
-+ * {
-+ * vpx_codec_ctx_t algo;
-+ * res = vpx_codec_init(&algo, &my_codec);
-+ * }
-+ * </pre>
-+ *
-+ * Once initialized, the instance is manged using other functions from
-+ * the vpx_codec_* family.
-+ */
-+#ifndef VPX_CODEC_INTERNAL_H
-+#define VPX_CODEC_INTERNAL_H
-+#include "../vpx_decoder.h"
-+#include "../vpx_encoder.h"
-+#include <stdarg.h>
-+
-+
-+/*!\brief Current ABI version number
-+ *
-+ * \internal
-+ * If this file is altered in any way that changes the ABI, this value
-+ * must be bumped. Examples include, but are not limited to, changing
-+ * types, removing or reassigning enums, adding/removing/rearranging
-+ * fields to structures
-+ */
-+#define VPX_CODEC_INTERNAL_ABI_VERSION (3) /**<\hideinitializer*/
-+
-+typedef struct vpx_codec_alg_priv vpx_codec_alg_priv_t;
-+
-+/*!\brief init function pointer prototype
-+ *
-+ * Performs algorithm-specific initialization of the decoder context. This
-+ * function is called by the generic vpx_codec_init() wrapper function, so
-+ * plugins implementing this interface may trust the input parameters to be
-+ * properly initialized.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \retval #VPX_CODEC_OK
-+ * The input stream was recognized and decoder initialized.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Memory operation failed.
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_init_fn_t)(vpx_codec_ctx_t *ctx);
-+
-+/*!\brief destroy function pointer prototype
-+ *
-+ * Performs algorithm-specific destruction of the decoder context. This
-+ * function is called by the generic vpx_codec_destroy() wrapper function,
-+ * so plugins implementing this interface may trust the input parameters
-+ * to be properly initialized.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \retval #VPX_CODEC_OK
-+ * The input stream was recognized and decoder initialized.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Memory operation failed.
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);
-+
-+/*!\brief parse stream info function pointer prototype
-+ *
-+ * Performs high level parsing of the bitstream. This function is called by
-+ * the generic vpx_codec_parse_stream() wrapper function, so plugins implementing
-+ * this interface may trust the input parameters to be properly initialized.
-+ *
-+ * \param[in] data Pointer to a block of data to parse
-+ * \param[in] data_sz Size of the data buffer
-+ * \param[in,out] si Pointer to stream info to update. The size member
-+ * \ref MUST be properly initialized, but \ref MAY be
-+ * clobbered by the algorithm. This parameter \ref MAY
-+ * be NULL.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * Bitstream is parsable and stream information updated
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t *data,
-+ unsigned int data_sz,
-+ vpx_codec_stream_info_t *si);
-+
-+/*!\brief Return information about the current stream.
-+ *
-+ * Returns information about the stream that has been parsed during decoding.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in,out] si Pointer to stream info to update. The size member
-+ * \ref MUST be properly initialized, but \ref MAY be
-+ * clobbered by the algorithm. This parameter \ref MAY
-+ * be NULL.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * Bitstream is parsable and stream information updated
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ vpx_codec_stream_info_t *si);
-+
-+/*!\brief control function pointer prototype
-+ *
-+ * This function is used to exchange algorithm specific data with the decoder
-+ * instance. This can be used to implement features specific to a particular
-+ * algorithm.
-+ *
-+ * This function is called by the generic vpx_codec_control() wrapper
-+ * function, so plugins implementing this interface may trust the input
-+ * parameters to be properly initialized. However, this interface does not
-+ * provide type safety for the exchanged data or assign meanings to the
-+ * control codes. Those details should be specified in the algorithm's
-+ * header file. In particular, the ctrl_id parameter is guaranteed to exist
-+ * in the algorithm's control mapping table, and the data paramter may be NULL.
-+ *
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] ctrl_id Algorithm specific control identifier
-+ * \param[in,out] data Data to exchange with algorithm instance.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The internal state data was deserialized.
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ int ctrl_id,
-+ va_list ap);
-+
-+/*!\brief control function pointer mapping
-+ *
-+ * This structure stores the mapping between control identifiers and
-+ * implementing functions. Each algorithm provides a list of these
-+ * mappings. This list is searched by the vpx_codec_control() wrapper
-+ * function to determine which function to invoke. The special
-+ * value {0, NULL} is used to indicate end-of-list, and must be
-+ * present. The special value {0, <non-null>} can be used as a catch-all
-+ * mapping. This implies that ctrl_id values chosen by the algorithm
-+ * \ref MUST be non-zero.
-+ */
-+typedef const struct
-+{
-+ int ctrl_id;
-+ vpx_codec_control_fn_t fn;
-+} vpx_codec_ctrl_fn_map_t;
-+
-+/*!\brief decode data function pointer prototype
-+ *
-+ * Processes a buffer of coded data. If the processing results in a new
-+ * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
-+ * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
-+ * function is called by the generic vpx_codec_decode() wrapper function,
-+ * so plugins implementing this interface may trust the input parameters
-+ * to be properly initialized.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] data Pointer to this block of new coded data. If
-+ * NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
-+ * for the previously decoded frame.
-+ * \param[in] data_sz Size of the coded data, in bytes.
-+ *
-+ * \return Returns #VPX_CODEC_OK if the coded data was processed completely
-+ * and future pictures can be decoded without error. Otherwise,
-+ * see the descriptions of the other error codes in ::vpx_codec_err_t
-+ * for recoverability capabilities.
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ void *user_priv,
-+ long deadline);
-+
-+/*!\brief Decoded frames iterator
-+ *
-+ * Iterates over a list of the frames available for display. The iterator
-+ * storage should be initialized to NULL to start the iteration. Iteration is
-+ * complete when this function returns NULL.
-+ *
-+ * The list of available frames becomes valid upon completion of the
-+ * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in out] iter Iterator storage, initialized to NULL
-+ *
-+ * \return Returns a pointer to an image, if one is ready for display. Frames
-+ * produced will always be in PTS (presentation time stamp) order.
-+ */
-+typedef vpx_image_t*(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ vpx_codec_iter_t *iter);
-+
-+
-+/*\brief e_xternal Memory Allocation memory map get iterator
-+ *
-+ * Iterates over a list of the memory maps requested by the decoder. The
-+ * iterator storage should be initialized to NULL to start the iteration.
-+ * Iteration is complete when this function returns NULL.
-+ *
-+ * \param[in out] iter Iterator storage, initialized to NULL
-+ *
-+ * \return Returns a pointer to an memory segment descriptor, or NULL to
-+ * indicate end-of-list.
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *ctx,
-+ vpx_codec_mmap_t *mmap,
-+ vpx_codec_iter_t *iter);
-+
-+
-+/*\brief e_xternal Memory Allocation memory map set iterator
-+ *
-+ * Sets a memory descriptor inside the decoder instance.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] mmap Memory map to store.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The memory map was accepted and stored.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * The memory map was rejected.
-+ */
-+typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
-+ const vpx_codec_mmap_t *mmap);
-+
-+
-+typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ const vpx_image_t *img,
-+ vpx_codec_pts_t pts,
-+ unsigned long duration,
-+ vpx_enc_frame_flags_t flags,
-+ unsigned long deadline);
-+typedef const vpx_codec_cx_pkt_t*(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ vpx_codec_iter_t *iter);
-+
-+typedef vpx_codec_err_t
-+(*vpx_codec_enc_config_set_fn_t)(vpx_codec_alg_priv_t *ctx,
-+ const vpx_codec_enc_cfg_t *cfg);
-+typedef vpx_fixed_buf_t *
-+(*vpx_codec_get_global_headers_fn_t)(vpx_codec_alg_priv_t *ctx);
-+
-+typedef vpx_image_t *
-+(*vpx_codec_get_preview_frame_fn_t)(vpx_codec_alg_priv_t *ctx);
-+
-+/*!\brief usage configuration mapping
-+ *
-+ * This structure stores the mapping between usage identifiers and
-+ * configuration structures. Each algorithm provides a list of these
-+ * mappings. This list is searched by the vpx_codec_enc_config_default()
-+ * wrapper function to determine which config to return. The special value
-+ * {-1, {0}} is used to indicate end-of-list, and must be present. At least
-+ * one mapping must be present, in addition to the end-of-list.
-+ *
-+ */
-+typedef const struct
-+{
-+ int usage;
-+ vpx_codec_enc_cfg_t cfg;
-+} vpx_codec_enc_cfg_map_t;
-+
-+#define NOT_IMPLEMENTED 0
-+
-+/*!\brief Decoder algorithm interface interface
-+ *
-+ * All decoders \ref MUST expose a variable of this type.
-+ */
-+struct vpx_codec_iface
-+{
-+ const char *name; /**< Identification String */
-+ int abi_version; /**< Implemented ABI version */
-+ vpx_codec_caps_t caps; /**< Decoder capabilities */
-+ vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
-+ vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
-+ vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
-+ vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
-+ vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
-+ struct
-+ {
-+ vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
-+ vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
-+ vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */
-+ vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_fn_t */
-+ } dec;
-+ struct
-+ {
-+ vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_enc_cfg_map_t */
-+ vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */
-+ vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
-+ vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
-+ vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
-+ vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
-+ } enc;
-+};
-+
-+/*!\brief Callback function pointer / user data pair storage */
-+typedef struct vpx_codec_priv_cb_pair
-+{
-+ union
-+ {
-+ vpx_codec_put_frame_cb_fn_t put_frame;
-+ vpx_codec_put_slice_cb_fn_t put_slice;
-+ };
-+ void *user_priv;
-+} vpx_codec_priv_cb_pair_t;
-+
-+
-+/*!\brief Instance private storage
-+ *
-+ * This structure is allocated by the algorithm's init function. It can be
-+ * extended in one of two ways. First, a second, algorithm specific structure
-+ * can be allocated and the priv member pointed to it. Alternatively, this
-+ * structure can be made the first member of the algorithm specific structure,
-+ * and the pointer casted to the proper type.
-+ */
-+struct vpx_codec_priv
-+{
-+ unsigned int sz;
-+ vpx_codec_iface_t *iface;
-+ struct vpx_codec_alg_priv *alg_priv;
-+ const char *err_detail;
-+ vpx_codec_flags_t init_flags;
-+ struct
-+ {
-+ vpx_codec_priv_cb_pair_t put_frame_cb;
-+ vpx_codec_priv_cb_pair_t put_slice_cb;
-+ } dec;
-+ struct
-+ {
-+ int tbd;
-+ struct vpx_fixed_buf cx_data_dst_buf;
-+ unsigned int cx_data_pad_before;
-+ unsigned int cx_data_pad_after;
-+ vpx_codec_cx_pkt_t cx_data_pkt;
-+ } enc;
-+};
-+
-+#undef VPX_CTRL_USE_TYPE
-+#define VPX_CTRL_USE_TYPE(id, typ) \
-+ static typ id##__value(va_list args) {return va_arg(args, typ);} \
-+ static typ id##__convert(void *x)\
-+ {\
-+ union\
-+ {\
-+ void *x;\
-+ typ d;\
-+ } u;\
-+ u.x = x;\
-+ return u.d;\
-+ }
-+
-+
-+#undef VPX_CTRL_USE_TYPE_DEPRECATED
-+#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
-+ static typ id##__value(va_list args) {return va_arg(args, typ);} \
-+ static typ id##__convert(void *x)\
-+ {\
-+ union\
-+ {\
-+ void *x;\
-+ typ d;\
-+ } u;\
-+ u.x = x;\
-+ return u.d;\
-+ }
-+
-+#define CAST(id, arg) id##__value(arg)
-+#define RECAST(id, x) id##__convert(x)
-+
-+
-+/* Internal Utility Functions
-+ *
-+ * The following functions are indended to be used inside algorithms as
-+ * utilities for manipulating vpx_codec_* data structures.
-+ */
-+struct vpx_codec_pkt_list
-+{
-+ unsigned int cnt;
-+ unsigned int max;
-+ struct vpx_codec_cx_pkt pkts[1];
-+};
-+
-+#define vpx_codec_pkt_list_decl(n)\
-+ union {struct vpx_codec_pkt_list head;\
-+ struct {struct vpx_codec_pkt_list head;\
-+ struct vpx_codec_cx_pkt pkts[n];} alloc;}
-+
-+#define vpx_codec_pkt_list_init(m)\
-+ (m)->alloc.head.cnt = 0,\
-+ (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
-+
-+int
-+vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
-+ const struct vpx_codec_cx_pkt *);
-+
-+const vpx_codec_cx_pkt_t*
-+vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
-+ vpx_codec_iter_t *iter);
-+
-+
-+#include <stdio.h>
-+#include <setjmp.h>
-+struct vpx_internal_error_info
-+{
-+ vpx_codec_err_t error_code;
-+ int has_detail;
-+ char detail[80];
-+ int setjmp;
-+ jmp_buf jmp;
-+};
-+
-+static void vpx_internal_error(struct vpx_internal_error_info *info,
-+ vpx_codec_err_t error,
-+ const char *fmt,
-+ ...)
-+{
-+ va_list ap;
-+
-+ info->error_code = error;
-+ info->has_detail = 0;
-+
-+ if (fmt)
-+ {
-+ size_t sz = sizeof(info->detail);
-+
-+ info->has_detail = 1;
-+ va_start(ap, fmt);
-+ vsnprintf(info->detail, sz - 1, fmt, ap);
-+ va_end(ap);
-+ info->detail[sz-1] = '\0';
-+ }
-+
-+ if (info->setjmp)
-+ longjmp(info->jmp, info->error_code);
-+}
-+#endif
-diff --git a/vpx/src/vpx_codec.c b/vpx/src/vpx_codec.c
-new file mode 100644
-index 0000000..0ef3a7b
---- /dev/null
-+++ b/vpx/src/vpx_codec.c
-@@ -0,0 +1,150 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\file vpx_decoder.c
-+ * \brief Provides the high level interface to wrap decoder algorithms.
-+ *
-+ */
-+#include <stdarg.h>
-+#include "vpx/vpx_integer.h"
-+#include "vpx/internal/vpx_codec_internal.h"
-+#include "vpx_version.h"
-+
-+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-+
-+int vpx_codec_version(void)
-+{
-+ return VERSION_PACKED;
-+}
-+
-+
-+const char *vpx_codec_version_str(void)
-+{
-+ return VERSION_STRING_NOSP;
-+}
-+
-+
-+const char *vpx_codec_version_extra_str(void)
-+{
-+ return VERSION_EXTRA;
-+}
-+
-+
-+const char *vpx_codec_iface_name(vpx_codec_iface_t *iface)
-+{
-+ return iface ? iface->name : "<invalid interface>";
-+}
-+
-+const char *vpx_codec_err_to_string(vpx_codec_err_t err)
-+{
-+ switch (err)
-+ {
-+ case VPX_CODEC_OK:
-+ return "Success";
-+ case VPX_CODEC_ERROR:
-+ return "Unspecified internal error";
-+ case VPX_CODEC_MEM_ERROR:
-+ return "Memory allocation error";
-+ case VPX_CODEC_ABI_MISMATCH:
-+ return "ABI version mismatch";
-+ case VPX_CODEC_INCAPABLE:
-+ return "Codec does not implement requested capability";
-+ case VPX_CODEC_UNSUP_BITSTREAM:
-+ return "Bitstream not supported by this decoder";
-+ case VPX_CODEC_UNSUP_FEATURE:
-+ return "Bitstream required feature not supported by this decoder";
-+ case VPX_CODEC_CORRUPT_FRAME:
-+ return "Corrupt frame detected";
-+ case VPX_CODEC_INVALID_PARAM:
-+ return "Invalid parameter";
-+ case VPX_CODEC_LIST_END:
-+ return "End of iterated list";
-+ }
-+
-+ return "Unrecognized error code";
-+}
-+
-+const char *vpx_codec_error(vpx_codec_ctx_t *ctx)
-+{
-+ return (ctx) ? vpx_codec_err_to_string(ctx->err)
-+ : vpx_codec_err_to_string(VPX_CODEC_INVALID_PARAM);
-+}
-+
-+const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
-+{
-+ if (ctx && ctx->err)
-+ return ctx->priv ? ctx->priv->err_detail : ctx->err_detail;
-+
-+ return NULL;
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv)
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ if (ctx->priv->alg_priv)
-+ ctx->iface->destroy(ctx->priv->alg_priv);
-+
-+ ctx->iface = NULL;
-+ ctx->name = NULL;
-+ ctx->priv = NULL;
-+ res = VPX_CODEC_OK;
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
-+{
-+ return (iface) ? iface->caps : 0;
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
-+ int ctrl_id,
-+ ...)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || !ctrl_id)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv || !ctx->iface->ctrl_maps)
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ vpx_codec_ctrl_fn_map_t *entry;
-+
-+ res = VPX_CODEC_ERROR;
-+
-+ for (entry = ctx->iface->ctrl_maps; entry && entry->fn; entry++)
-+ {
-+ if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
-+ {
-+ va_list ap;
-+
-+ va_start(ap, ctrl_id);
-+ res = entry->fn(ctx->priv->alg_priv, ctrl_id, ap);
-+ va_end(ap);
-+ break;
-+ }
-+ }
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-diff --git a/vpx/src/vpx_decoder.c b/vpx/src/vpx_decoder.c
-new file mode 100644
-index 0000000..cbf5259
---- /dev/null
-+++ b/vpx/src/vpx_decoder.c
-@@ -0,0 +1,237 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\file vpx_decoder.c
-+ * \brief Provides the high level interface to wrap decoder algorithms.
-+ *
-+ */
-+#include <string.h>
-+#include "vpx/internal/vpx_codec_internal.h"
-+
-+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-+
-+vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iface_t *iface,
-+ vpx_codec_dec_cfg_t *cfg,
-+ vpx_codec_flags_t flags,
-+ int ver)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (ver != VPX_DECODER_ABI_VERSION)
-+ res = VPX_CODEC_ABI_MISMATCH;
-+ else if (!ctx || !iface)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
-+ res = VPX_CODEC_ABI_MISMATCH;
-+ else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
-+ res = VPX_CODEC_INCAPABLE;
-+ else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
-+ res = VPX_CODEC_INCAPABLE;
-+ else
-+ {
-+ memset(ctx, 0, sizeof(*ctx));
-+ ctx->iface = iface;
-+ ctx->name = iface->name;
-+ ctx->priv = NULL;
-+ ctx->init_flags = flags;
-+ ctx->config.dec = cfg;
-+ res = VPX_CODEC_OK;
-+
-+ if (!(flags & VPX_CODEC_USE_XMA))
-+ {
-+ res = ctx->iface->init(ctx);
-+
-+ if (res)
-+ {
-+ ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
-+ vpx_codec_destroy(ctx);
-+ }
-+
-+ if (ctx->priv)
-+ ctx->priv->iface = ctx->iface;
-+ }
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ vpx_codec_stream_info_t *si)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!iface || !data || !data_sz || !si
-+ || si->sz < sizeof(vpx_codec_stream_info_t))
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else
-+ {
-+ /* Set default/unknown values */
-+ si->w = 0;
-+ si->h = 0;
-+
-+ res = iface->dec.peek_si(data, data_sz, si);
-+ }
-+
-+ return res;
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
-+ vpx_codec_stream_info_t *si)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || !si || si->sz < sizeof(vpx_codec_stream_info_t))
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv)
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ /* Set default/unknown values */
-+ si->w = 0;
-+ si->h = 0;
-+
-+ res = ctx->iface->dec.get_si(ctx->priv->alg_priv, si);
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ void *user_priv,
-+ long deadline)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || !data || !data_sz)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv)
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ res = ctx->iface->dec.decode(ctx->priv->alg_priv, data, data_sz,
-+ user_priv, deadline);
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iter_t *iter)
-+{
-+ vpx_image_t *img;
-+
-+ if (!ctx || !iter || !ctx->iface || !ctx->priv)
-+ img = NULL;
-+ else
-+ img = ctx->iface->dec.get_frame(ctx->priv->alg_priv, iter);
-+
-+ return img;
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
-+ vpx_codec_put_frame_cb_fn_t cb,
-+ void *user_priv)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || !cb)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv
-+ || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ ctx->priv->dec.put_frame_cb.put_frame = cb;
-+ ctx->priv->dec.put_frame_cb.user_priv = user_priv;
-+ res = VPX_CODEC_OK;
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
-+ vpx_codec_put_slice_cb_fn_t cb,
-+ void *user_priv)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || !cb)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv
-+ || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ ctx->priv->dec.put_slice_cb.put_slice = cb;
-+ ctx->priv->dec.put_slice_cb.user_priv = user_priv;
-+ res = VPX_CODEC_OK;
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
-+ vpx_codec_mmap_t *mmap,
-+ vpx_codec_iter_t *iter)
-+{
-+ vpx_codec_err_t res = VPX_CODEC_OK;
-+
-+ if (!ctx || !mmap || !iter || !ctx->iface)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
-+ res = VPX_CODEC_ERROR;
-+ else
-+ res = ctx->iface->get_mmap(ctx, mmap, iter);
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
-+ vpx_codec_mmap_t *mmap,
-+ unsigned int num_maps)
-+{
-+ vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
-+
-+ if (!ctx || !mmap || !ctx->iface)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
-+ res = VPX_CODEC_ERROR;
-+ else
-+ {
-+ unsigned int i;
-+
-+ for (i = 0; i < num_maps; i++, mmap++)
-+ {
-+ if (!mmap->base)
-+ break;
-+
-+ /* Everything look ok, set the mmap in the decoder */
-+ res = ctx->iface->set_mmap(ctx, mmap);
-+
-+ if (res)
-+ break;
-+ }
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-diff --git a/vpx/src/vpx_decoder_compat.c b/vpx/src/vpx_decoder_compat.c
-new file mode 100644
-index 0000000..d5cc16e
---- /dev/null
-+++ b/vpx/src/vpx_decoder_compat.c
-@@ -0,0 +1,201 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\file vpx_decoder.c
-+ * \brief Provides the high level interface to wrap decoder algorithms.
-+ *
-+ */
-+#include <stdlib.h>
-+#include <string.h>
-+#include "vpx/vpx_decoder.h"
-+#include "vpx/internal/vpx_codec_internal.h"
-+
-+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-+
-+const char *vpx_dec_iface_name(vpx_dec_iface_t *iface)
-+{
-+ return vpx_codec_iface_name((vpx_codec_iface_t *)iface);
-+}
-+
-+const char *vpx_dec_err_to_string(vpx_dec_err_t err)
-+{
-+ return vpx_codec_err_to_string(err);
-+}
-+
-+const char *vpx_dec_error(vpx_dec_ctx_t *ctx)
-+{
-+ return vpx_codec_error((vpx_codec_ctx_t *)ctx);
-+}
-+
-+const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx)
-+{
-+ return vpx_codec_error_detail((vpx_codec_ctx_t *)ctx);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
-+ vpx_dec_iface_t *iface,
-+ int ver)
-+{
-+ return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
-+ (vpx_codec_iface_t *)iface,
-+ NULL,
-+ 0,
-+ ver);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx)
-+{
-+ return vpx_codec_destroy((vpx_codec_ctx_t *)ctx);
-+}
-+
-+
-+vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface)
-+{
-+ return vpx_codec_get_caps((vpx_codec_iface_t *)iface);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ vpx_dec_stream_info_t *si)
-+{
-+ return vpx_codec_peek_stream_info((vpx_codec_iface_t *)iface, data, data_sz,
-+ (vpx_codec_stream_info_t *)si);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
-+ vpx_dec_stream_info_t *si)
-+{
-+ return vpx_codec_get_stream_info((vpx_codec_ctx_t *)ctx,
-+ (vpx_codec_stream_info_t *)si);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
-+ int ctrl_id,
-+ void *data)
-+{
-+ return vpx_codec_control_((vpx_codec_ctx_t *)ctx, ctrl_id, data);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
-+ uint8_t *data,
-+ unsigned int data_sz,
-+ void *user_priv,
-+ int rel_pts)
-+{
-+ (void)rel_pts;
-+ return vpx_codec_decode((vpx_codec_ctx_t *)ctx, data, data_sz, user_priv,
-+ 0);
-+}
-+
-+vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
-+ vpx_dec_iter_t *iter)
-+{
-+ return vpx_codec_get_frame((vpx_codec_ctx_t *)ctx, iter);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
-+ vpx_dec_put_frame_cb_fn_t cb,
-+ void *user_priv)
-+{
-+ return vpx_codec_register_put_frame_cb((vpx_codec_ctx_t *)ctx, cb,
-+ user_priv);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
-+ vpx_dec_put_slice_cb_fn_t cb,
-+ void *user_priv)
-+{
-+ return vpx_codec_register_put_slice_cb((vpx_codec_ctx_t *)ctx, cb,
-+ user_priv);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
-+ vpx_dec_iface_t *iface,
-+ int ver)
-+{
-+ return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
-+ (vpx_codec_iface_t *)iface,
-+ NULL,
-+ VPX_CODEC_USE_XMA,
-+ ver);
-+}
-+
-+vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx_,
-+ vpx_dec_mmap_t *mmap,
-+ const vpx_dec_stream_info_t *si,
-+ vpx_dec_iter_t *iter)
-+{
-+ vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
-+ vpx_dec_err_t res = VPX_DEC_OK;
-+
-+ if (!ctx || !mmap || !si || !iter || !ctx->iface)
-+ res = VPX_DEC_INVALID_PARAM;
-+ else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
-+ res = VPX_DEC_ERROR;
-+ else
-+ {
-+ if (!ctx->config.dec)
-+ {
-+ ctx->config.dec = malloc(sizeof(vpx_codec_dec_cfg_t));
-+ ctx->config.dec->w = si->w;
-+ ctx->config.dec->h = si->h;
-+ }
-+
-+ res = ctx->iface->get_mmap(ctx, mmap, iter);
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx_,
-+ vpx_dec_mmap_t *mmap,
-+ unsigned int num_maps)
-+{
-+ vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
-+ vpx_dec_err_t res = VPX_DEC_MEM_ERROR;
-+
-+ if (!ctx || !mmap || !ctx->iface)
-+ res = VPX_DEC_INVALID_PARAM;
-+ else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
-+ res = VPX_DEC_ERROR;
-+ else
-+ {
-+ void *save = (ctx->priv) ? NULL : ctx->config.dec;
-+ unsigned int i;
-+
-+ for (i = 0; i < num_maps; i++, mmap++)
-+ {
-+ if (!mmap->base)
-+ break;
-+
-+ /* Everything look ok, set the mmap in the decoder */
-+ res = ctx->iface->set_mmap(ctx, mmap);
-+
-+ if (res)
-+ break;
-+ }
-+
-+ if (save) free(save);
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-diff --git a/vpx/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
-new file mode 100644
-index 0000000..f43328f
---- /dev/null
-+++ b/vpx/src/vpx_encoder.c
-@@ -0,0 +1,312 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\file vpx_encoder.c
-+ * \brief Provides the high level interface to wrap encoder algorithms.
-+ *
-+ */
-+#include <limits.h>
-+#include <string.h>
-+#include "vpx/internal/vpx_codec_internal.h"
-+
-+#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
-+
-+vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iface_t *iface,
-+ vpx_codec_enc_cfg_t *cfg,
-+ vpx_codec_flags_t flags,
-+ int ver)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (ver != VPX_ENCODER_ABI_VERSION)
-+ res = VPX_CODEC_ABI_MISMATCH;
-+ else if (!ctx || !iface || !cfg)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
-+ res = VPX_CODEC_ABI_MISMATCH;
-+ else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
-+ res = VPX_CODEC_INCAPABLE;
-+ else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
-+ res = VPX_CODEC_INCAPABLE;
-+ else if ((flags & VPX_CODEC_USE_PSNR)
-+ && !(iface->caps & VPX_CODEC_CAP_PSNR))
-+ res = VPX_CODEC_INCAPABLE;
-+ else
-+ {
-+ ctx->iface = iface;
-+ ctx->name = iface->name;
-+ ctx->priv = NULL;
-+ ctx->init_flags = flags;
-+ ctx->config.enc = cfg;
-+ res = ctx->iface->init(ctx);
-+
-+ if (res)
-+ {
-+ ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
-+ vpx_codec_destroy(ctx);
-+ }
-+
-+ if (ctx->priv)
-+ ctx->priv->iface = ctx->iface;
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+
-+vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
-+ vpx_codec_enc_cfg_t *cfg,
-+ unsigned int usage)
-+{
-+ vpx_codec_err_t res;
-+ vpx_codec_enc_cfg_map_t *map;
-+
-+ if (!iface || !cfg || usage > INT_MAX)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
-+ res = VPX_CODEC_INCAPABLE;
-+ else
-+ {
-+ res = VPX_CODEC_INVALID_PARAM;
-+
-+ for (map = iface->enc.cfg_maps; map->usage >= 0; map++)
-+ {
-+ if (map->usage == (int)usage)
-+ {
-+ *cfg = map->cfg;
-+ cfg->g_usage = usage;
-+ res = VPX_CODEC_OK;
-+ break;
-+ }
-+ }
-+ }
-+
-+ return res;
-+}
-+
-+
-+#if ARCH_X86 || ARCH_X86_64
-+/* On X86, disable the x87 unit's internal 80 bit precision for better
-+ * consistency with the SSE unit's 64 bit precision.
-+ */
-+#include "vpx_ports/x86.h"
-+#define FLOATING_POINT_INIT() do {\
-+ unsigned short x87_orig_mode = x87_set_double_precision();
-+#define FLOATING_POINT_RESTORE() \
-+ x87_set_control_word(x87_orig_mode); }while(0)
-+
-+
-+#else
-+static void FLOATING_POINT_INIT() {}
-+static void FLOATING_POINT_RESTORE() {}
-+#endif
-+
-+
-+vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
-+ const vpx_image_t *img,
-+ vpx_codec_pts_t pts,
-+ unsigned long duration,
-+ vpx_enc_frame_flags_t flags,
-+ unsigned long deadline)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || (img && !duration))
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv)
-+ res = VPX_CODEC_ERROR;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-+ res = VPX_CODEC_INCAPABLE;
-+ else
-+ {
-+ /* Execute in a normalized floating point environment, if the platform
-+ * requires it.
-+ */
-+ FLOATING_POINT_INIT();
-+ res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
-+ duration, flags, deadline);
-+ FLOATING_POINT_RESTORE();
-+ }
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iter_t *iter)
-+{
-+ const vpx_codec_cx_pkt_t *pkt = NULL;
-+
-+ if (ctx)
-+ {
-+ if (!iter)
-+ ctx->err = VPX_CODEC_INVALID_PARAM;
-+ else if (!ctx->iface || !ctx->priv)
-+ ctx->err = VPX_CODEC_ERROR;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-+ ctx->err = VPX_CODEC_INCAPABLE;
-+ else
-+ pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
-+ }
-+
-+ if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT)
-+ {
-+ /* If the application has specified a destination area for the
-+ * compressed data, and the codec has not placed the data there,
-+ * and it fits, copy it.
-+ */
-+ char *dst_buf = ctx->priv->enc.cx_data_dst_buf.buf;
-+
-+ if (dst_buf
-+ && pkt->data.raw.buf != dst_buf
-+ && pkt->data.raw.sz
-+ + ctx->priv->enc.cx_data_pad_before
-+ + ctx->priv->enc.cx_data_pad_after
-+ <= ctx->priv->enc.cx_data_dst_buf.sz)
-+ {
-+ vpx_codec_cx_pkt_t *modified_pkt = &ctx->priv->enc.cx_data_pkt;
-+
-+ memcpy(dst_buf + ctx->priv->enc.cx_data_pad_before,
-+ pkt->data.raw.buf, pkt->data.raw.sz);
-+ *modified_pkt = *pkt;
-+ modified_pkt->data.raw.buf = dst_buf;
-+ modified_pkt->data.raw.sz += ctx->priv->enc.cx_data_pad_before
-+ + ctx->priv->enc.cx_data_pad_after;
-+ pkt = modified_pkt;
-+ }
-+
-+ if (dst_buf == pkt->data.raw.buf)
-+ {
-+ ctx->priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz;
-+ ctx->priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz;
-+ }
-+ }
-+
-+ return pkt;
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
-+ const vpx_fixed_buf_t *buf,
-+ unsigned int pad_before,
-+ unsigned int pad_after)
-+{
-+ if (!ctx || !ctx->priv)
-+ return VPX_CODEC_INVALID_PARAM;
-+
-+ if (buf)
-+ {
-+ ctx->priv->enc.cx_data_dst_buf = *buf;
-+ ctx->priv->enc.cx_data_pad_before = pad_before;
-+ ctx->priv->enc.cx_data_pad_after = pad_after;
-+ }
-+ else
-+ {
-+ ctx->priv->enc.cx_data_dst_buf.buf = NULL;
-+ ctx->priv->enc.cx_data_dst_buf.sz = 0;
-+ ctx->priv->enc.cx_data_pad_before = 0;
-+ ctx->priv->enc.cx_data_pad_after = 0;
-+ }
-+
-+ return VPX_CODEC_OK;
-+}
-+
-+
-+const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx)
-+{
-+ vpx_image_t *img = NULL;
-+
-+ if (ctx)
-+ {
-+ if (!ctx->iface || !ctx->priv)
-+ ctx->err = VPX_CODEC_ERROR;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-+ ctx->err = VPX_CODEC_INCAPABLE;
-+ else if (!ctx->iface->enc.get_preview)
-+ ctx->err = VPX_CODEC_INCAPABLE;
-+ else
-+ img = ctx->iface->enc.get_preview(ctx->priv->alg_priv);
-+ }
-+
-+ return img;
-+}
-+
-+
-+vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx)
-+{
-+ vpx_fixed_buf_t *buf = NULL;
-+
-+ if (ctx)
-+ {
-+ if (!ctx->iface || !ctx->priv)
-+ ctx->err = VPX_CODEC_ERROR;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-+ ctx->err = VPX_CODEC_INCAPABLE;
-+ else if (!ctx->iface->enc.get_glob_hdrs)
-+ ctx->err = VPX_CODEC_INCAPABLE;
-+ else
-+ buf = ctx->iface->enc.get_glob_hdrs(ctx->priv->alg_priv);
-+ }
-+
-+ return buf;
-+}
-+
-+
-+vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
-+ const vpx_codec_enc_cfg_t *cfg)
-+{
-+ vpx_codec_err_t res;
-+
-+ if (!ctx || !ctx->iface || !ctx->priv || !cfg)
-+ res = VPX_CODEC_INVALID_PARAM;
-+ else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-+ res = VPX_CODEC_INCAPABLE;
-+ else
-+ res = ctx->iface->enc.cfg_set(ctx->priv->alg_priv, cfg);
-+
-+ return SAVE_STATUS(ctx, res);
-+}
-+
-+
-+int vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *list,
-+ const struct vpx_codec_cx_pkt *pkt)
-+{
-+ if (list->cnt < list->max)
-+ {
-+ list->pkts[list->cnt++] = *pkt;
-+ return 0;
-+ }
-+
-+ return 1;
-+}
-+
-+
-+const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
-+ vpx_codec_iter_t *iter)
-+{
-+ const vpx_codec_cx_pkt_t *pkt;
-+
-+ if (!(*iter))
-+ {
-+ *iter = list->pkts;
-+ }
-+
-+ pkt = (const void *) * iter;
-+
-+ if (pkt - list->pkts < list->cnt)
-+ *iter = pkt + 1;
-+ else
-+ pkt = NULL;
-+
-+ return pkt;
-+}
-diff --git a/vpx/src/vpx_image.c b/vpx/src/vpx_image.c
-new file mode 100644
-index 0000000..e8a2959
---- /dev/null
-+++ b/vpx/src/vpx_image.c
-@@ -0,0 +1,262 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+#include <stdlib.h>
-+#include <string.h>
-+#include "vpx/vpx_image.h"
-+
-+static vpx_image_t *img_alloc_helper(vpx_image_t *img,
-+ vpx_img_fmt_t fmt,
-+ unsigned int d_w,
-+ unsigned int d_h,
-+ unsigned int stride_align,
-+ unsigned char *img_data)
-+{
-+
-+ unsigned int h, w, s, xcs, ycs, bps;
-+ int align;
-+
-+ /* Treat align==0 like align==1 */
-+ if (!stride_align)
-+ stride_align = 1;
-+
-+ /* Validate alignment (must be power of 2) */
-+ if (stride_align & (stride_align - 1))
-+ goto fail;
-+
-+ /* Get sample size for this format */
-+ switch (fmt)
-+ {
-+ case VPX_IMG_FMT_RGB32:
-+ case VPX_IMG_FMT_RGB32_LE:
-+ case VPX_IMG_FMT_ARGB:
-+ case VPX_IMG_FMT_ARGB_LE:
-+ bps = 32;
-+ break;
-+ case VPX_IMG_FMT_RGB24:
-+ case VPX_IMG_FMT_BGR24:
-+ bps = 24;
-+ break;
-+ case VPX_IMG_FMT_RGB565:
-+ case VPX_IMG_FMT_RGB565_LE:
-+ case VPX_IMG_FMT_RGB555:
-+ case VPX_IMG_FMT_RGB555_LE:
-+ case VPX_IMG_FMT_UYVY:
-+ case VPX_IMG_FMT_YUY2:
-+ case VPX_IMG_FMT_YVYU:
-+ bps = 16;
-+ break;
-+ case VPX_IMG_FMT_I420:
-+ case VPX_IMG_FMT_YV12:
-+ case VPX_IMG_FMT_VPXI420:
-+ case VPX_IMG_FMT_VPXYV12:
-+ bps = 12;
-+ break;
-+ default:
-+ bps = 16;
-+ break;
-+ }
-+
-+ /* Get chroma shift values for this format */
-+ switch (fmt)
-+ {
-+ case VPX_IMG_FMT_I420:
-+ case VPX_IMG_FMT_YV12:
-+ case VPX_IMG_FMT_VPXI420:
-+ case VPX_IMG_FMT_VPXYV12:
-+ xcs = 1;
-+ break;
-+ default:
-+ xcs = 0;
-+ break;
-+ }
-+
-+ switch (fmt)
-+ {
-+ case VPX_IMG_FMT_I420:
-+ case VPX_IMG_FMT_YV12:
-+ case VPX_IMG_FMT_VPXI420:
-+ case VPX_IMG_FMT_VPXYV12:
-+ ycs = 1;
-+ break;
-+ default:
-+ ycs = 0;
-+ break;
-+ }
-+
-+ /* Calculate storage sizes given the chroma subsampling */
-+ align = (1 << xcs) - 1;
-+ w = (d_w + align) & ~align;
-+ align = (1 << ycs) - 1;
-+ h = (d_h + align) & ~align;
-+ s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
-+ s = (s + stride_align - 1) & ~(stride_align - 1);
-+
-+ /* Allocate the new image */
-+ if (!img)
-+ {
-+ img = (vpx_image_t *)calloc(1, sizeof(vpx_image_t));
-+
-+ if (!img)
-+ goto fail;
-+
-+ img->self_allocd = 1;
-+ }
-+ else
-+ {
-+ memset(img, 0, sizeof(vpx_image_t));
-+ }
-+
-+ img->img_data = img_data;
-+
-+ if (!img_data)
-+ {
-+ img->img_data = malloc((fmt & VPX_IMG_FMT_PLANAR) ? h * w * bps / 8 : h * s);
-+ img->img_data_owner = 1;
-+ }
-+
-+ if (!img->img_data)
-+ goto fail;
-+
-+ img->fmt = fmt;
-+ img->w = w;
-+ img->h = h;
-+ img->x_chroma_shift = xcs;
-+ img->y_chroma_shift = ycs;
-+ img->bps = bps;
-+
-+ /* Calculate strides */
-+ img->stride[VPX_PLANE_Y] = img->stride[VPX_PLANE_ALPHA] = s;
-+ img->stride[VPX_PLANE_U] = img->stride[VPX_PLANE_V] = s >> xcs;
-+
-+ /* Default viewport to entire image */
-+ if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
-+ return img;
-+
-+fail:
-+ vpx_img_free(img);
-+ return NULL;
-+}
-+
-+vpx_image_t *vpx_img_alloc(vpx_image_t *img,
-+ vpx_img_fmt_t fmt,
-+ unsigned int d_w,
-+ unsigned int d_h,
-+ unsigned int stride_align)
-+{
-+ return img_alloc_helper(img, fmt, d_w, d_h, stride_align, NULL);
-+}
-+
-+vpx_image_t *vpx_img_wrap(vpx_image_t *img,
-+ vpx_img_fmt_t fmt,
-+ unsigned int d_w,
-+ unsigned int d_h,
-+ unsigned int stride_align,
-+ unsigned char *img_data)
-+{
-+ return img_alloc_helper(img, fmt, d_w, d_h, stride_align, img_data);
-+}
-+
-+int vpx_img_set_rect(vpx_image_t *img,
-+ unsigned int x,
-+ unsigned int y,
-+ unsigned int w,
-+ unsigned int h)
-+{
-+ unsigned char *data;
-+
-+ if (x + w <= img->w && y + h <= img->h)
-+ {
-+ img->d_w = w;
-+ img->d_h = h;
-+
-+ /* Calculate plane pointers */
-+ if (!(img->fmt & VPX_IMG_FMT_PLANAR))
-+ {
-+ img->planes[VPX_PLANE_PACKED] =
-+ img->img_data + x * img->bps / 8 + y * img->stride[VPX_PLANE_PACKED];
-+ }
-+ else
-+ {
-+ data = img->img_data;
-+
-+ if (img->fmt & VPX_IMG_FMT_HAS_ALPHA)
-+ {
-+ img->planes[VPX_PLANE_ALPHA] =
-+ data + x + y * img->stride[VPX_PLANE_ALPHA];
-+ data += img->h * img->stride[VPX_PLANE_ALPHA];
-+ }
-+
-+ img->planes[VPX_PLANE_Y] = data + x + y * img->stride[VPX_PLANE_Y];
-+ data += img->h * img->stride[VPX_PLANE_Y];
-+
-+ if (!(img->fmt & VPX_IMG_FMT_UV_FLIP))
-+ {
-+ img->planes[VPX_PLANE_U] = data
-+ + (x >> img->x_chroma_shift)
-+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
-+ data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
-+ img->planes[VPX_PLANE_V] = data
-+ + (x >> img->x_chroma_shift)
-+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
-+ }
-+ else
-+ {
-+ img->planes[VPX_PLANE_V] = data
-+ + (x >> img->x_chroma_shift)
-+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
-+ data += (img->h >> img->y_chroma_shift) * img->stride[VPX_PLANE_V];
-+ img->planes[VPX_PLANE_U] = data
-+ + (x >> img->x_chroma_shift)
-+ + (y >> img->y_chroma_shift) * img->stride[VPX_PLANE_U];
-+ }
-+ }
-+
-+ return 0;
-+ }
-+
-+ return -1;
-+}
-+
-+void vpx_img_flip(vpx_image_t *img)
-+{
-+ /* Note: In the calculation pointer adjustment calculation, we want the
-+ * rhs to be promoted to a signed type. Section 6.3.1.8 of the ISO C99
-+ * standard indicates that if the adjustment parameter is unsigned, the
-+ * stride parameter will be promoted to unsigned, causing errors when
-+ * the lhs is a larger type than the rhs.
-+ */
-+ img->planes[VPX_PLANE_Y] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_Y];
-+ img->stride[VPX_PLANE_Y] = -img->stride[VPX_PLANE_Y];
-+
-+ img->planes[VPX_PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
-+ * img->stride[VPX_PLANE_U];
-+ img->stride[VPX_PLANE_U] = -img->stride[VPX_PLANE_U];
-+
-+ img->planes[VPX_PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
-+ * img->stride[VPX_PLANE_V];
-+ img->stride[VPX_PLANE_V] = -img->stride[VPX_PLANE_V];
-+
-+ img->planes[VPX_PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[VPX_PLANE_ALPHA];
-+ img->stride[VPX_PLANE_ALPHA] = -img->stride[VPX_PLANE_ALPHA];
-+}
-+
-+void vpx_img_free(vpx_image_t *img)
-+{
-+ if (img)
-+ {
-+ if (img->img_data && img->img_data_owner)
-+ free(img->img_data);
-+
-+ if (img->self_allocd)
-+ free(img);
-+ }
-+}
-diff --git a/vpx/vp8.h b/vpx/vp8.h
-new file mode 100644
-index 0000000..a493ef6
---- /dev/null
-+++ b/vpx/vp8.h
-@@ -0,0 +1,117 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\defgroup vp8 VP8
-+ * \ingroup codecs
-+ * VP8 is vpx's newest video compression algorithm that uses motion
-+ * compensated prediction, Discrete Cosine Transform (DCT) coding of the
-+ * prediction error signal and context dependent entropy coding techniques
-+ * based on arithmatic principles. It features:
-+ * - YUV 4:2:0 image format
-+ * - Macro-block based coding (16x16 luma plus two 8x8 chroma)
-+ * - 1/4 (1/8) pixel accuracy motion compensated prediction
-+ * - 4x4 DCT transform
-+ * - 128 level linear quantizer
-+ * - In loop deblocking filter
-+ * - Context-based entropy coding
-+ *
-+ * @{
-+ */
-+/*!\file vp8.h
-+ * \brief Provides controls common to both the VP8 encoder and decoder.
-+ */
-+#ifndef VP8_H
-+#define VP8_H
-+#include "vpx/vpx_codec_impl_top.h"
-+
-+/*!\brief Control functions
-+ *
-+ * The set of macros define the control functions of VP8 interface
-+ */
-+enum vp8_dec_control_id
-+{
-+ VP8_SET_REFERENCE = 1, /**< pass in an external frame into decoder to be used as reference frame */
-+ VP8_COPY_REFERENCE = 2, /**< get a copy of reference frame from the decoder */
-+ VP8_SET_POSTPROC = 3, /**< set decoder's the post processing settings */
-+ VP8_COMMON_CTRL_ID_MAX
-+};
-+
-+/*!\brief post process flags
-+ *
-+ * The set of macros define VP8 decoder post processing flags
-+ */
-+enum vp8_postproc_level
-+{
-+ VP8_NOFILTERING = 0,
-+ VP8_DEBLOCK = 1,
-+ VP8_DEMACROBLOCK = 2,
-+ VP8_ADDNOISE = 4,
-+};
-+
-+/*!\brief post process flags
-+ *
-+ * This define a structure that describe the post processing settings. For
-+ * the best objective measure (using thet PSNR metric) set post_proc_flag
-+ * to VP8_DEBLOCK and deblocking_level to 1.
-+ */
-+
-+typedef struct vp8_postproc_cfg
-+{
-+ int post_proc_flag; /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
-+ int deblocking_level; /**< the strength of deblocking, valid range [0, 16] */
-+ int noise_level; /**< the strength of additive noise, valid range [0, 16] */
-+} vp8_postproc_cfg_t;
-+
-+/*!\brief reference frame type
-+ *
-+ * The set of macros define the type of VP8 reference frames
-+ */
-+typedef enum vpx_ref_frame_type
-+{
-+ VP8_LAST_FRAME = 1,
-+ VP8_GOLD_FRAME = 2,
-+ VP8_ALTR_FRAME = 4
-+} vpx_ref_frame_type_t;
-+
-+/*!\brief reference frame data struct
-+ *
-+ * define the data struct to access vp8 reference frames
-+ */
-+
-+typedef struct vpx_ref_frame
-+{
-+ vpx_ref_frame_type_t frame_type; /**< which reference frame */
-+ vpx_image_t img; /**< reference frame data in image format */
-+} vpx_ref_frame_t;
-+
-+
-+/*!\brief vp8 decoder control funciton parameter type
-+ *
-+ * defines the data type for each of VP8 decoder control funciton requires
-+ */
-+
-+VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE, vpx_ref_frame_t *)
-+VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE, vpx_ref_frame_t *)
-+VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC, vp8_postproc_cfg_t *)
-+
-+
-+/*! @} - end defgroup vp8 */
-+
-+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
-+/* The following definitions are provided for backward compatibility with
-+ * the VP8 1.0.x SDK. USE IN PRODUCTION CODE IS NOT RECOMMENDED.
-+ */
-+
-+DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
-+#endif
-+
-+#include "vpx/vpx_codec_impl_bottom.h"
-+#endif
-diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
-new file mode 100644
-index 0000000..1104064
---- /dev/null
-+++ b/vpx/vp8cx.h
-@@ -0,0 +1,262 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\defgroup vp8_encoder WebM VP8 Encoder
-+ * \ingroup vp8
-+ *
-+ * @{
-+ */
-+#include "vp8.h"
-+
-+/*!\file vp8cx.h
-+ * \brief Provides definitions for using the VP8 encoder algorithm within the
-+ * vpx Codec Interface.
-+ */
-+#ifndef VP8CX_H
-+#define VP8CX_H
-+#include "vpx/vpx_codec_impl_top.h"
-+
-+/*!\brief Algorithm interface for VP8
-+ *
-+ * This interface provides the capability to encode raw VP8 streams, as would
-+ * be found in AVI files.
-+ */
-+extern vpx_codec_iface_t vpx_codec_vp8_cx_algo;
-+
-+
-+/*
-+ * Algorithm Flags
-+ */
-+
-+/*!\brief Don't reference the last frame
-+ *
-+ * When this flag is set, the encoder will not use the last frame as a
-+ * predictor. When not set, the encoder will choose whether to use the
-+ * last frame or not automatically.
-+ */
-+#define VP8_EFLAG_NO_REF_LAST (1<<16)
-+
-+
-+/*!\brief Don't reference the golden frame
-+ *
-+ * When this flag is set, the encoder will not use the golden frame as a
-+ * predictor. When not set, the encoder will choose whether to use the
-+ * golden frame or not automatically.
-+ */
-+#define VP8_EFLAG_NO_REF_GF (1<<17)
-+
-+
-+/*!\brief Don't reference the alternate reference frame
-+ *
-+ * When this flag is set, the encoder will not use the alt ref frame as a
-+ * predictor. When not set, the encoder will choose whether to use the
-+ * alt ref frame or not automatically.
-+ */
-+#define VP8_EFLAG_NO_REF_ARF (1<<21)
-+
-+
-+/*!\brief Don't update the last frame
-+ *
-+ * When this flag is set, the encoder will not update the last frame with
-+ * the contents of the current frame.
-+ */
-+#define VP8_EFLAG_NO_UPD_LAST (1<<18)
-+
-+
-+/*!\brief Don't update the golden frame
-+ *
-+ * When this flag is set, the encoder will not update the golden frame with
-+ * the contents of the current frame.
-+ */
-+#define VP8_EFLAG_NO_UPD_GF (1<<22)
-+
-+
-+/*!\brief Don't update the alternate reference frame
-+ *
-+ * When this flag is set, the encoder will not update the alt ref frame with
-+ * the contents of the current frame.
-+ */
-+#define VP8_EFLAG_NO_UPD_ARF (1<<23)
-+
-+
-+/*!\brief Force golden frame update
-+ *
-+ * When this flag is set, the encoder copy the contents of the current frame
-+ * to the golden frame buffer.
-+ */
-+#define VP8_EFLAG_FORCE_GF (1<<19)
-+
-+
-+/*!\brief Force alternate reference frame update
-+ *
-+ * When this flag is set, the encoder copy the contents of the current frame
-+ * to the alternate reference frame buffer.
-+ */
-+#define VP8_EFLAG_FORCE_ARF (1<<24)
-+
-+
-+/*!\brief Disable entropy update
-+ *
-+ * When this flag is set, the encoder will not update its internal entropy
-+ * model based on the entropy of this frame.
-+ */
-+#define VP8_EFLAG_NO_UPD_ENTROPY (1<<20)
-+
-+
-+/*!\brief VP8 encoder control functions
-+ *
-+ * The set of macros define the control functions of VP8 encoder interface
-+ */
-+enum vp8e_enc_control_id
-+{
-+ VP8E_UPD_ENTROPY = 5, /**< control function to set mode of entropy update in encoder */
-+ VP8E_UPD_REFERENCE, /**< control function to set reference update mode in encoder */
-+ VP8E_USE_REFERENCE, /**< control function to set which reference frame encoder can use */
-+ VP8E_SET_ROI_MAP, /**< control function to pass an ROI map to encoder */
-+ VP8E_SET_ACTIVEMAP, /**< control function to pass an Active map to encoder */
-+ VP8E_SET_SCALEMODE = 11, /**< control function to set encoder scaling mode */
-+ VP8E_SET_CPUUSED = 13, /**< control function to set vp8 encoder cpuused */
-+ VP8E_SET_ENABLEAUTOALTREF, /**< control function to enable vp8 to automatic set and use altref frame */
-+ VP8E_SET_NOISE_SENSITIVITY, /**< control function to set noise sensitivity */
-+ VP8E_SET_SHARPNESS, /**< control function to set sharpness */
-+ VP8E_SET_STATIC_THRESHOLD, /**< control function to set the threshold for macroblocks treated static */
-+ VP8E_SET_TOKEN_PARTITIONS, /**< control function to set the number of token partitions */
-+ VP8E_GET_LAST_QUANTIZER, /**< return the quantizer chosen by the
-+ encoder for the last frame using the internal
-+ scale */
-+ VP8E_GET_LAST_QUANTIZER_64, /**< return the quantizer chosen by the
-+ encoder for the last frame, using the 0..63
-+ scale as used by the rc_*_quantizer config
-+ parameters */
-+ VP8E_SET_ARNR_MAXFRAMES, /**< control function to set the max number of frames blurred creating arf*/
-+ VP8E_SET_ARNR_STRENGTH , /**< control function to set the filter strength for the arf */
-+ VP8E_SET_ARNR_TYPE , /**< control function to set the type of filter to use for the arf*/
-+} ;
-+
-+/*!\brief vpx 1-D scaling mode
-+ *
-+ * This set of constants define 1-D vpx scaling modes
-+ */
-+typedef enum vpx_scaling_mode_1d
-+{
-+ VP8E_NORMAL = 0,
-+ VP8E_FOURFIVE = 1,
-+ VP8E_THREEFIVE = 2,
-+ VP8E_ONETWO = 3
-+} VPX_SCALING_MODE;
-+
-+
-+/*!\brief vpx region of interest map
-+ *
-+ * These defines the data structures for the region of interest map
-+ *
-+ */
-+
-+typedef struct vpx_roi_map
-+{
-+ unsigned char *roi_map; /**< specify an id between 0 and 3 for each 16x16 region within a frame */
-+ unsigned int rows; /**< number of rows */
-+ unsigned int cols; /**< number of cols */
-+ int delta_q[4]; /**< quantizer delta [-64, 64] off baseline for regions with id between 0 and 3*/
-+ int delta_lf[4]; /**< loop filter strength delta [-32, 32] for regions with id between 0 and 3 */
-+ unsigned int static_threshold[4];/**< threshold for region to be treated as static */
-+} vpx_roi_map_t;
-+
-+/*!\brief vpx active region map
-+ *
-+ * These defines the data structures for active region map
-+ *
-+ */
-+
-+
-+typedef struct vpx_active_map
-+{
-+ unsigned char *active_map; /**< specify an on (1) or off (0) each 16x16 region within a frame */
-+ unsigned int rows; /**< number of rows */
-+ unsigned int cols; /**< number of cols */
-+} vpx_active_map_t;
-+
-+/*!\brief vpx image scaling mode
-+ *
-+ * This defines the data structure for image scaling mode
-+ *
-+ */
-+typedef struct vpx_scaling_mode
-+{
-+ VPX_SCALING_MODE h_scaling_mode; /**< horizontal scaling mode */
-+ VPX_SCALING_MODE v_scaling_mode; /**< vertical scaling mode */
-+} vpx_scaling_mode_t;
-+
-+/*!\brief VP8 encoding mode
-+ *
-+ * This defines VP8 encoding mode
-+ *
-+ */
-+typedef enum
-+{
-+ VP8_BEST_QUALITY_ENCODING,
-+ VP8_GOOD_QUALITY_ENCODING,
-+ VP8_REAL_TIME_ENCODING
-+} vp8e_encoding_mode;
-+
-+/*!\brief VP8 token partition mode
-+ *
-+ * This defines VP8 partitioning mode for compressed data, i.e., the number of
-+ * sub-streams in the bitstream. Used for parallelized decoding.
-+ *
-+ */
-+
-+typedef enum
-+{
-+ VP8_ONE_TOKENPARTITION = 0,
-+ VP8_TWO_TOKENPARTITION = 1,
-+ VP8_FOUR_TOKENPARTITION = 2,
-+ VP8_EIGHT_TOKENPARTITION = 3,
-+} vp8e_token_partitions;
-+
-+
-+/*!\brief VP8 encoder control function parameter type
-+ *
-+ * Defines the data types that VP8E control functions take. Note that
-+ * additional common controls are defined in vp8.h
-+ *
-+ */
-+
-+
-+/* These controls have been deprecated in favor of the flags parameter to
-+ * vpx_codec_encode(). See the definition of VP8_EFLAG_* above.
-+ */
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int)
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int)
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int)
-+
-+VPX_CTRL_USE_TYPE(VP8E_SET_ROI_MAP, vpx_roi_map_t *)
-+VPX_CTRL_USE_TYPE(VP8E_SET_ACTIVEMAP, vpx_active_map_t *)
-+VPX_CTRL_USE_TYPE(VP8E_SET_SCALEMODE, vpx_scaling_mode_t *)
-+
-+VPX_CTRL_USE_TYPE(VP8E_SET_CPUUSED, int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_ENABLEAUTOALTREF, unsigned int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_NOISE_SENSITIVITY, unsigned int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_SHARPNESS, unsigned int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_STATIC_THRESHOLD, unsigned int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_TOKEN_PARTITIONS, vp8e_token_partitions)
-+
-+VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_MAXFRAMES, unsigned int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_STRENGTH , unsigned int)
-+VPX_CTRL_USE_TYPE(VP8E_SET_ARNR_TYPE , unsigned int)
-+
-+
-+VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER, int *)
-+VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64, int *)
-+
-+/*! @} - end defgroup vp8_encoder */
-+#include "vpx/vpx_codec_impl_bottom.h"
-+#endif
-diff --git a/vpx/vp8dx.h b/vpx/vp8dx.h
-new file mode 100644
-index 0000000..d602e80
---- /dev/null
-+++ b/vpx/vp8dx.h
-@@ -0,0 +1,42 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+#include "vp8.h"
-+
-+/*!\defgroup vp8_decoder WebM VP8 Decoder
-+ * \ingroup vp8
-+ *
-+ * @{
-+ */
-+/*!\file vp8dx.h
-+ * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder
-+ * interface.
-+ */
-+#ifndef VP8DX_H
-+#define VP8DX_H
-+#include "vpx/vpx_codec_impl_top.h"
-+
-+/*!\brief Algorithm interface for VP8
-+ *
-+ * This interface provides the capability to decode raw VP8 streams, as would
-+ * be found in AVI files and other non-Flash uses.
-+ */
-+extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
-+
-+/* Include controls common to both the encoder and decoder */
-+#include "vp8.h"
-+
-+
-+/*! @} - end defgroup vp8_decoder */
-+
-+
-+#include "vpx/vpx_codec_impl_bottom.h"
-+#endif
-diff --git a/vpx/vp8e.h b/vpx/vp8e.h
-new file mode 100644
-index 0000000..f72fd24
---- /dev/null
-+++ b/vpx/vp8e.h
-@@ -0,0 +1,63 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/* This file contains backwards compatibility stubs for applications using
-+ * the VP8 version 1.0 API.
-+ */
-+#ifndef VP8E_H
-+#define VP8E_H
-+#include "vpx/vpx_codec_impl_top.h"
-+
-+#if defined(VPX_CODEC_DISABLE_COMPAT) && VPX_CODEC_DISABLE_COMPAT
-+#error "Backwards compatibility disabled: don't include vp8e.h"
-+#endif
-+
-+#include "vp8cx.h"
-+DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_enc_vp8_algo DEPRECATED;
-+
-+
-+enum
-+{
-+ VP8E_SET_REFERENCE = VP8_SET_REFERENCE,
-+ VP8E_COPY_REFERENCE = VP8_COPY_REFERENCE,
-+ VP8E_SET_PREVIEWPP = VP8_SET_POSTPROC,
-+ VP8E_SET_FLUSHFLAG = 4,
-+ VP8E_SET_FRAMETYPE = 10,
-+ VP8E_SET_ENCODING_MODE = 12
-+};
-+
-+#define NORMAL_FRAME (0)
-+#define KEY_FRAME (1)
-+
-+/* Change VP8E to VP8 to get the undeprecated version of these (defined in
-+ * vp8.h)
-+ */
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_REFERENCE, vpx_ref_frame_t *)
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_COPY_REFERENCE, vpx_ref_frame_t *)
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_PREVIEWPP, vp8_postproc_cfg_t *)
-+
-+
-+/* Flush is done by calling vpx_codec_encode with a NULL input image. */
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FLUSHFLAG, int)
-+
-+
-+/* Frame type is set with a flag to vpx_codec_control. See VPX_EFLAG_FORCE_KF
-+ */
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_FRAMETYPE, int)
-+
-+
-+/* This control has been deprecated in favor of the duration parameter to
-+ * vpx_codec_encode(). Use the #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
-+ * #VPX_DL_BEST_QUALITY constants to that parameter instead.
-+ */
-+VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_SET_ENCODING_MODE, vp8e_encoding_mode)
-+#include "vpx/vpx_codec_impl_bottom.h"
-+#endif
-diff --git a/vpx/vpx_codec.h b/vpx/vpx_codec.h
-new file mode 100644
-index 0000000..f821559
---- /dev/null
-+++ b/vpx/vpx_codec.h
-@@ -0,0 +1,554 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\defgroup codec Common Algorithm Interface
-+ * This abstraction allows applications to easily support multiple video
-+ * formats with minimal code duplication. This section describes the interface
-+ * common to all codecs (both encoders and decoders).
-+ * @{
-+ */
-+
-+/*!\file vpx_codec.h
-+ * \brief Describes the codec algorithm interface to applications.
-+ *
-+ * This file describes the interface between an application and a
-+ * video codec algorithm.
-+ *
-+ * An application instantiates a specific codec instance by using
-+ * vpx_codec_init() and a pointer to the algorithm's interface structure:
-+ * <pre>
-+ * my_app.c:
-+ * extern vpx_codec_iface_t my_codec;
-+ * {
-+ * vpx_codec_ctx_t algo;
-+ * res = vpx_codec_init(&algo, &my_codec);
-+ * }
-+ * </pre>
-+ *
-+ * Once initialized, the instance is manged using other functions from
-+ * the vpx_codec_* family.
-+ */
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#ifndef VPX_CODEC_H
-+#define VPX_CODEC_H
-+#include "vpx_integer.h"
-+#include "vpx_image.h"
-+
-+ /*!\brief Decorator indicating a function is deprecated */
-+#ifndef DEPRECATED
-+#if defined(__GNUC__) && __GNUC__
-+#define DEPRECATED __attribute__ ((deprecated))
-+#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
-+#elif defined(_MSC_VER)
-+#define DEPRECATED
-+#define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
-+#else
-+#define DEPRECATED
-+#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
-+#endif
-+#endif
-+
-+ /*!\brief Decorator indicating a function is potentially unused */
-+#ifdef UNUSED
-+#elif __GNUC__
-+#define UNUSED __attribute__ ((unused));
-+#else
-+#define UNUSED
-+#endif
-+
-+ /*!\brief Current ABI version number
-+ *
-+ * \internal
-+ * If this file is altered in any way that changes the ABI, this value
-+ * must be bumped. Examples include, but are not limited to, changing
-+ * types, removing or reassigning enums, adding/removing/rearranging
-+ * fields to structures
-+ */
-+#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
-+
-+ /*!\brief Algorithm return codes */
-+ typedef enum {
-+ /*!\brief Operation completed without error */
-+ VPX_CODEC_OK,
-+
-+ /*!\brief Unspecified error */
-+ VPX_CODEC_ERROR,
-+
-+ /*!\brief Memory operation failed */
-+ VPX_CODEC_MEM_ERROR,
-+
-+ /*!\brief ABI version mismatch */
-+ VPX_CODEC_ABI_MISMATCH,
-+
-+ /*!\brief Algorithm does not have required capability */
-+ VPX_CODEC_INCAPABLE,
-+
-+ /*!\brief The given bitstream is not supported.
-+ *
-+ * The bitstream was unable to be parsed at the highest level. The decoder
-+ * is unable to proceed. This error \ref SHOULD be treated as fatal to the
-+ * stream. */
-+ VPX_CODEC_UNSUP_BITSTREAM,
-+
-+ /*!\brief Encoded bitstream uses an unsupported feature
-+ *
-+ * The decoder does not implement a feature required by the encoder. This
-+ * return code should only be used for features that prevent future
-+ * pictures from being properly decoded. This error \ref MAY be treated as
-+ * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
-+ */
-+ VPX_CODEC_UNSUP_FEATURE,
-+
-+ /*!\brief The coded data for this stream is corrupt or incomplete
-+ *
-+ * There was a problem decoding the current frame. This return code
-+ * should only be used for failures that prevent future pictures from
-+ * being properly decoded. This error \ref MAY be treated as fatal to the
-+ * stream or \ref MAY be treated as fatal to the current GOP. If decoding
-+ * is continued for the current GOP, artifacts may be present.
-+ */
-+ VPX_CODEC_CORRUPT_FRAME,
-+
-+ /*!\brief An application-supplied parameter is not valid.
-+ *
-+ */
-+ VPX_CODEC_INVALID_PARAM,
-+
-+ /*!\brief An iterator reached the end of list.
-+ *
-+ */
-+ VPX_CODEC_LIST_END,
-+
-+ }
-+ vpx_codec_err_t;
-+
-+
-+ /*! \brief Codec capabilities bitfield
-+ *
-+ * Each codec advertises the capabilities it supports as part of its
-+ * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
-+ * or functionality, and are not required to be supported.
-+ *
-+ * The available flags are specified by VPX_CODEC_CAP_* defines.
-+ */
-+ typedef long vpx_codec_caps_t;
-+#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
-+#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
-+#define VPX_CODEC_CAP_XMA 0x4 /**< Supports e_xternal Memory Allocation */
-+
-+
-+ /*! \brief Initialization-time Feature Enabling
-+ *
-+ * Certain codec features must be known at initialization time, to allow for
-+ * proper memory allocation.
-+ *
-+ * The available flags are specified by VPX_CODEC_USE_* defines.
-+ */
-+ typedef long vpx_codec_flags_t;
-+#define VPX_CODEC_USE_XMA 0x00000001 /**< Use e_xternal Memory Allocation mode */
-+
-+
-+ /*!\brief Codec interface structure.
-+ *
-+ * Contains function pointers and other data private to the codec
-+ * implementation. This structure is opaque to the application.
-+ */
-+ typedef const struct vpx_codec_iface vpx_codec_iface_t;
-+
-+
-+ /*!\brief Codec private data structure.
-+ *
-+ * Contains data private to the codec implementation. This structure is opaque
-+ * to the application.
-+ */
-+ typedef struct vpx_codec_priv vpx_codec_priv_t;
-+
-+
-+ /*!\brief Iterator
-+ *
-+ * Opaque storage used for iterating over lists.
-+ */
-+ typedef const void *vpx_codec_iter_t;
-+
-+
-+ /*!\brief Codec context structure
-+ *
-+ * All codecs \ref MUST support this context structure fully. In general,
-+ * this data should be considered private to the codec algorithm, and
-+ * not be manipulated or examined by the calling application. Applications
-+ * may reference the 'name' member to get a printable description of the
-+ * algorithm.
-+ */
-+ typedef struct vpx_codec_ctx
-+ {
-+ const char *name; /**< Printable interface name */
-+ vpx_codec_iface_t *iface; /**< Interface pointers */
-+ vpx_codec_err_t err; /**< Last returned error */
-+ const char *err_detail; /**< Detailed info, if available */
-+ vpx_codec_flags_t init_flags; /**< Flags passed at init time */
-+ union
-+ {
-+ struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */
-+ struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */
-+ void *raw;
-+ } config; /**< Configuration pointer aliasing union */
-+ vpx_codec_priv_t *priv; /**< Algorithm private storage */
-+ } vpx_codec_ctx_t;
-+
-+
-+ /*
-+ * Library Version Number Interface
-+ *
-+ * For example, see the following sample return values:
-+ * vpx_codec_version() (1<<16 | 2<<8 | 3)
-+ * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
-+ * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
-+ */
-+
-+ /*!\brief Return the version information (as an integer)
-+ *
-+ * Returns a packed encoding of the library version number. This will only include
-+ * the major.minor.patch component of the version number. Note that this encoded
-+ * value should be accessed through the macros provided, as the encoding may change
-+ * in the future.
-+ *
-+ */
-+ int vpx_codec_version(void);
-+#define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
-+#define VPX_VERSION_MINOR(v) ((v>>8)&0xff) /**< extract minor from packed version */
-+#define VPX_VERSION_PATCH(v) ((v>>0)&0xff) /**< extract patch from packed version */
-+
-+ /*!\brief Return the version major number */
-+#define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
-+
-+ /*!\brief Return the version minr number */
-+#define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
-+
-+ /*!\brief Return the version patch number */
-+#define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
-+
-+
-+ /*!\brief Return the version information (as a string)
-+ *
-+ * Returns a printable string containing the full library version number. This may
-+ * contain additional text following the three digit version number, as to indicate
-+ * release candidates, prerelease versions, etc.
-+ *
-+ */
-+ const char *vpx_codec_version_str(void);
-+
-+
-+ /*!\brief Return the version information (as a string)
-+ *
-+ * Returns a printable "extra string". This is the component of the string returned
-+ * by vpx_codec_version_str() following the three digit version number.
-+ *
-+ */
-+ const char *vpx_codec_version_extra_str(void);
-+
-+
-+ /*!\brief Return the build configuration
-+ *
-+ * Returns a printable string containing an encoded version of the build
-+ * configuration. This may be useful to vpx support.
-+ *
-+ */
-+ const char *vpx_codec_build_config(void);
-+
-+
-+ /*!\brief Return the name for a given interface
-+ *
-+ * Returns a human readable string for name of the given codec interface.
-+ *
-+ * \param[in] iface Interface pointer
-+ *
-+ */
-+ const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
-+
-+
-+ /*!\brief Convert error number to printable string
-+ *
-+ * Returns a human readable string for the last error returned by the
-+ * algorithm. The returned error will be one line and will not contain
-+ * any newline characters.
-+ *
-+ *
-+ * \param[in] err Error number.
-+ *
-+ */
-+ const char *vpx_codec_err_to_string(vpx_codec_err_t err);
-+
-+
-+ /*!\brief Retrieve error synopsis for codec context
-+ *
-+ * Returns a human readable string for the last error returned by the
-+ * algorithm. The returned error will be one line and will not contain
-+ * any newline characters.
-+ *
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ *
-+ */
-+ const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
-+
-+
-+ /*!\brief Retrieve detailed error information for codec context
-+ *
-+ * Returns a human readable string providing detailed information about
-+ * the last error.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ *
-+ * \retval NULL
-+ * No detailed information is available.
-+ */
-+ const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
-+
-+
-+ /* REQUIRED FUNCTIONS
-+ *
-+ * The following functions are required to be implemented for all codecs.
-+ * They represent the base case functionality expected of all codecs.
-+ */
-+
-+ /*!\brief Destroy a codec instance
-+ *
-+ * Destroys a codec context, freeing any associated memory buffers.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The codec algorithm initialized.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Memory allocation failed.
-+ */
-+ vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
-+
-+
-+ /*!\brief Get the capabilities of an algorithm.
-+ *
-+ * Retrieves the capabliities bitfield from the algorithm's interface.
-+ *
-+ * \param[in] iface Pointer to the alogrithm interface
-+ *
-+ */
-+ vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
-+
-+
-+ /*!\brief Control algorithm
-+ *
-+ * This function is used to exchange algorithm specific data with the codec
-+ * instance. This can be used to implement features specific to a particular
-+ * algorithm.
-+ *
-+ * This wrapper function dispatches the request to the helper function
-+ * associated with the given ctrl_id. It tries to call this function
-+ * transparantly, but will return #VPX_CODEC_ERROR if the request could not
-+ * be dispatched.
-+ *
-+ * Note that this function should not be used directly. Call the
-+ * #vpx_codec_control wrapper macro instead.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] ctrl_id Algorithm specific control identifier
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The control request was processed.
-+ * \retval #VPX_CODEC_ERROR
-+ * The control request was not processed.
-+ * \retval #VPX_CODEC_INVALID_PARAM
-+ * The data was not valid.
-+ */
-+ vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
-+ int ctrl_id,
-+ ...);
-+#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
-+# define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
-+# define VPX_CTRL_USE_TYPE(id, typ)
-+# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
-+# define VPX_CTRL_VOID(id, typ)
-+
-+#else
-+ /*!\brief vpx_codec_control wrapper macro
-+ *
-+ * This macro allows for type safe conversions across the variadic parameter
-+ * to vpx_codec_control_().
-+ *
-+ * \internal
-+ * It works by dispatching the call to the control function through a wrapper
-+ * function named with the id parameter.
-+ */
-+# define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
-+ /**<\hideinitializer*/
-+
-+
-+ /*!\brief vpx_codec_control type definition macro
-+ *
-+ * This macro allows for type safe conversions across the variadic parameter
-+ * to vpx_codec_control_(). It defines the type of the argument for a given
-+ * control identifier.
-+ *
-+ * \internal
-+ * It defines a static function with
-+ * the correctly typed arguments as a wrapper to the type-unsafe internal
-+ * function.
-+ */
-+# define VPX_CTRL_USE_TYPE(id, typ) \
-+ static vpx_codec_err_t \
-+ vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
-+ \
-+ static vpx_codec_err_t \
-+ vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
-+ return vpx_codec_control_(ctx, ctrl_id, data);\
-+ } /**<\hideinitializer*/
-+
-+
-+ /*!\brief vpx_codec_control deprecated type definition macro
-+ *
-+ * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
-+ * deprecated and should not be used. Consult the documentation for your
-+ * codec for more information.
-+ *
-+ * \internal
-+ * It defines a static function with the correctly typed arguments as a
-+ * wrapper to the type-unsafe internal function.
-+ */
-+# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
-+ DECLSPEC_DEPRECATED static vpx_codec_err_t \
-+ vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
-+ \
-+ DECLSPEC_DEPRECATED static vpx_codec_err_t \
-+ vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
-+ return vpx_codec_control_(ctx, ctrl_id, data);\
-+ } /**<\hideinitializer*/
-+
-+
-+ /*!\brief vpx_codec_control void type definition macro
-+ *
-+ * This macro allows for type safe conversions across the variadic parameter
-+ * to vpx_codec_control_(). It indicates that a given control identifier takes
-+ * no argument.
-+ *
-+ * \internal
-+ * It defines a static function without a data argument as a wrapper to the
-+ * type-unsafe internal function.
-+ */
-+# define VPX_CTRL_VOID(id) \
-+ static vpx_codec_err_t \
-+ vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
-+ \
-+ static vpx_codec_err_t \
-+ vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
-+ return vpx_codec_control_(ctx, ctrl_id);\
-+ } /**<\hideinitializer*/
-+
-+
-+#endif
-+
-+
-+ /*!\defgroup cap_xma External Memory Allocation Functions
-+ *
-+ * The following functions are required to be implemented for all codecs
-+ * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions
-+ * for codecs that don't advertise this capability will result in an error
-+ * code being returned, usually VPX_CODEC_INCAPABLE
-+ * @{
-+ */
-+
-+
-+ /*!\brief Memory Map Entry
-+ *
-+ * This structure is used to contain the properties of a memory segment. It
-+ * is populated by the codec in the request phase, and by the calling
-+ * application once the requested allocation has been performed.
-+ */
-+ typedef struct vpx_codec_mmap
-+ {
-+ /*
-+ * The following members are set by the codec when requesting a segment
-+ */
-+ unsigned int id; /**< identifier for the segment's contents */
-+ unsigned long sz; /**< size of the segment, in bytes */
-+ unsigned int align; /**< required alignment of the segment, in bytes */
-+ unsigned int flags; /**< bitfield containing segment properties */
-+#define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
-+#define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
-+#define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
-+
-+ /* The following members are to be filled in by the allocation function */
-+ void *base; /**< pointer to the allocated segment */
-+ void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */
-+ void *priv; /**< allocator private storage */
-+ } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */
-+
-+
-+ /*!\brief Iterate over the list of segments to allocate.
-+ *
-+ * Iterates over a list of the segments to allocate. The iterator storage
-+ * should be initialized to NULL to start the iteration. Iteration is complete
-+ * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to
-+ * allocate is dependant upon the size of the encoded stream. In cases where the
-+ * stream is not available at allocation time, a fixed size must be requested.
-+ * The codec will not be able to operate on streams larger than the size used at
-+ * allocation time.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[out] mmap Pointer to the memory map entry to populate.
-+ * \param[in,out] iter Iterator storage, initialized to NULL
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The memory map entry was populated.
-+ * \retval #VPX_CODEC_ERROR
-+ * Codec does not support XMA mode.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Unable to determine segment size from stream info.
-+ */
-+ vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
-+ vpx_codec_mmap_t *mmap,
-+ vpx_codec_iter_t *iter);
-+
-+
-+ /*!\brief Identify allocated segments to codec instance
-+ *
-+ * Stores a list of allocated segments in the codec. Segments \ref MUST be
-+ * passed in the order they are read from vpx_codec_get_mem_map(), but may be
-+ * passed in groups of any size. Segments \ref MUST be set only once. The
-+ * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member
-+ * is non-NULL. If the segment requires cleanup handling (eg, calling free()
-+ * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[in] mmaps Pointer to the first memory map entry in the list.
-+ * \param[in] num_maps Number of entries being set at this time
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The segment was stored in the codec context.
-+ * \retval #VPX_CODEC_INCAPABLE
-+ * Codec does not support XMA mode.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Segment base address was not set, or segment was already stored.
-+
-+ */
-+ vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
-+ vpx_codec_mmap_t *mmaps,
-+ unsigned int num_maps);
-+
-+ /*!@} - end defgroup cap_xma*/
-+ /*!@} - end defgroup codec*/
-+
-+
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/vpx/vpx_codec.mk b/vpx/vpx_codec.mk
-new file mode 100644
-index 0000000..4e09b5f
---- /dev/null
-+++ b/vpx/vpx_codec.mk
-@@ -0,0 +1,27 @@
-+##
-+## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+##
-+## Use of this source code is governed by a BSD-style license
-+## that can be found in the LICENSE file in the root of the source
-+## tree. An additional intellectual property rights grant can be found
-+## in the file PATENTS. All contributing project authors may
-+## be found in the AUTHORS file in the root of the source tree.
-+##
-+
-+
-+API_EXPORTS += exports
-+
-+API_SRCS-$(CONFIG_DECODERS) += src/vpx_decoder.c
-+API_SRCS-$(CONFIG_DECODERS) += src/vpx_decoder_compat.c
-+API_SRCS-$(CONFIG_DECODERS) += vpx_decoder.h
-+API_SRCS-$(CONFIG_DECODERS) += vpx_decoder_compat.h
-+API_SRCS-$(CONFIG_ENCODERS) += src/vpx_encoder.c
-+API_SRCS-$(CONFIG_ENCODERS) += vpx_encoder.h
-+API_SRCS-yes += internal/vpx_codec_internal.h
-+API_SRCS-yes += src/vpx_codec.c
-+API_SRCS-yes += src/vpx_image.c
-+API_SRCS-yes += vpx_codec.h
-+API_SRCS-yes += vpx_codec.mk
-+API_SRCS-yes += vpx_codec_impl_bottom.h
-+API_SRCS-yes += vpx_codec_impl_top.h
-+API_SRCS-yes += vpx_image.h
-diff --git a/vpx/vpx_codec_impl_bottom.h b/vpx/vpx_codec_impl_bottom.h
-new file mode 100644
-index 0000000..02bf8b3
---- /dev/null
-+++ b/vpx/vpx_codec_impl_bottom.h
-@@ -0,0 +1,19 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*
-+ * This file is to be included at the bottom of the header files defining the
-+ * interface to individual codecs and contains matching blocks to those defined
-+ * in vpx_codec_impl_top.h
-+ */
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/vpx/vpx_codec_impl_top.h b/vpx/vpx_codec_impl_top.h
-new file mode 100644
-index 0000000..fce14c1
---- /dev/null
-+++ b/vpx/vpx_codec_impl_top.h
-@@ -0,0 +1,19 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*
-+ * This file is to be included at the top of the header files defining the
-+ * interface to individual codecs and contains various workarounds common
-+ * to all codec implementations.
-+ */
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-diff --git a/vpx/vpx_decoder.h b/vpx/vpx_decoder.h
-new file mode 100644
-index 0000000..865f5df
---- /dev/null
-+++ b/vpx/vpx_decoder.h
-@@ -0,0 +1,317 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\defgroup decoder Decoder Algorithm Interface
-+ * \ingroup codec
-+ * This abstraction allows applications using this decoder to easily support
-+ * multiple video formats with minimal code duplication. This section describes
-+ * the interface common to all decoders.
-+ * @{
-+ */
-+
-+/*!\file vpx_decoder.h
-+ * \brief Describes the decoder algorithm interface to applications.
-+ *
-+ * This file describes the interface between an application and a
-+ * video decoder algorithm.
-+ *
-+ */
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#ifndef VPX_DECODER_H
-+#define VPX_DECODER_H
-+#include "vpx_codec.h"
-+
-+ /*!\brief Current ABI version number
-+ *
-+ * \internal
-+ * If this file is altered in any way that changes the ABI, this value
-+ * must be bumped. Examples include, but are not limited to, changing
-+ * types, removing or reassigning enums, adding/removing/rearranging
-+ * fields to structures
-+ */
-+#define VPX_DECODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
-+
-+ /*! \brief Decoder capabilities bitfield
-+ *
-+ * Each decoder advertises the capabilities it supports as part of its
-+ * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
-+ * or functionality, and are not required to be supported by a decoder.
-+ *
-+ * The available flags are specifiedby VPX_CODEC_CAP_* defines.
-+ */
-+#define VPX_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
-+#define VPX_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
-+#define VPX_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
-+
-+ /*! \brief Initialization-time Feature Enabling
-+ *
-+ * Certain codec features must be known at initialization time, to allow for
-+ * proper memory allocation.
-+ *
-+ * The available flags are specified by VPX_CODEC_USE_* defines.
-+ */
-+#define VPX_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
-+
-+ /*!\brief Stream properties
-+ *
-+ * This structure is used to query or set properties of the decoded
-+ * stream. Algorithms may extend this structure with data specific
-+ * to their bitstream by setting the sz member appropriately.
-+ */
-+ typedef struct vpx_codec_stream_info
-+ {
-+ unsigned int sz; /**< Size of this structure */
-+ unsigned int w; /**< Width (or 0 for unknown/default) */
-+ unsigned int h; /**< Height (or 0 for unknown/default) */
-+ unsigned int is_kf; /**< Current frame is a keyframe */
-+ } vpx_codec_stream_info_t;
-+
-+ /* REQUIRED FUNCTIONS
-+ *
-+ * The following functions are required to be implemented for all decoders.
-+ * They represent the base case functionality expected of all decoders.
-+ */
-+
-+
-+ /*!\brief Initialization Configurations
-+ *
-+ * This structure is used to pass init time configuration options to the
-+ * decoder.
-+ */
-+ typedef struct vpx_codec_dec_cfg
-+ {
-+ unsigned int threads; /**< Maximum number of threads to use, default 1 */
-+ unsigned int w; /**< Width */
-+ unsigned int h; /**< Height */
-+ } vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */
-+
-+
-+ /*!\brief Initialize a decoder instance
-+ *
-+ * Initializes a decoder context using the given interface. Applications
-+ * should call the vpx_codec_dec_init convenience macro instead of this
-+ * function directly, to ensure that the ABI version number parameter
-+ * is properly initialized.
-+ *
-+ * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
-+ * parameter), the storage pointed to by the cfg parameter must be
-+ * kept readable and stable until all memory maps have been set.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[in] iface Pointer to the alogrithm interface to use.
-+ * \param[in] cfg Configuration to use, if known. May be NULL.
-+ * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
-+ * \param[in] ver ABI version number. Must be set to
-+ * VPX_DECODER_ABI_VERSION
-+ * \retval #VPX_CODEC_OK
-+ * The decoder algorithm initialized.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Memory allocation failed.
-+ */
-+ vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iface_t *iface,
-+ vpx_codec_dec_cfg_t *cfg,
-+ vpx_codec_flags_t flags,
-+ int ver);
-+
-+ /*!\brief Convenience macro for vpx_codec_dec_init_ver()
-+ *
-+ * Ensures the ABI version parameter is properly set.
-+ */
-+#define vpx_codec_dec_init(ctx, iface, cfg, flags) \
-+ vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
-+
-+
-+ /*!\brief Parse stream info from a buffer
-+ *
-+ * Performs high level parsing of the bitstream. Construction of a decoder
-+ * context is not necessary. Can be used to determine if the bitstream is
-+ * of the proper format, and to extract information from the stream.
-+ *
-+ * \param[in] iface Pointer to the alogrithm interface
-+ * \param[in] data Pointer to a block of data to parse
-+ * \param[in] data_sz Size of the data buffer
-+ * \param[in,out] si Pointer to stream info to update. The size member
-+ * \ref MUST be properly initialized, but \ref MAY be
-+ * clobbered by the algorithm. This parameter \ref MAY
-+ * be NULL.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * Bitstream is parsable and stream information updated
-+ */
-+ vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ vpx_codec_stream_info_t *si);
-+
-+
-+ /*!\brief Return information about the current stream.
-+ *
-+ * Returns information about the stream that has been parsed during decoding.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in,out] si Pointer to stream info to update. The size member
-+ * \ref MUST be properly initialized, but \ref MAY be
-+ * clobbered by the algorithm. This parameter \ref MAY
-+ * be NULL.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * Bitstream is parsable and stream information updated
-+ */
-+ vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
-+ vpx_codec_stream_info_t *si);
-+
-+
-+ /*!\brief Decode data
-+ *
-+ * Processes a buffer of coded data. If the processing results in a new
-+ * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
-+ * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
-+ * time stamp) order. Frames produced will always be in PTS (presentation
-+ * time stamp) order.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] data Pointer to this block of new coded data. If
-+ * NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
-+ * for the previously decoded frame.
-+ * \param[in] data_sz Size of the coded data, in bytes.
-+ * \param[in] user_priv Application specific data to associate with
-+ * this frame.
-+ * \param[in] deadline Soft deadline the decoder should attempt to meet,
-+ * in us. Set to zero for unlimited.
-+ *
-+ * \return Returns #VPX_CODEC_OK if the coded data was processed completely
-+ * and future pictures can be decoded without error. Otherwise,
-+ * see the descriptions of the other error codes in ::vpx_codec_err_t
-+ * for recoverability capabilities.
-+ */
-+ vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ void *user_priv,
-+ long deadline);
-+
-+
-+ /*!\brief Decoded frames iterator
-+ *
-+ * Iterates over a list of the frames available for display. The iterator
-+ * storage should be initialized to NULL to start the iteration. Iteration is
-+ * complete when this function returns NULL.
-+ *
-+ * The list of available frames becomes valid upon completion of the
-+ * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in,out] iter Iterator storage, initialized to NULL
-+ *
-+ * \return Returns a pointer to an image, if one is ready for display. Frames
-+ * produced will always be in PTS (presentation time stamp) order.
-+ */
-+ vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iter_t *iter);
-+
-+
-+ /*!\defgroup cap_put_frame Frame-Based Decoding Functions
-+ *
-+ * The following functions are required to be implemented for all decoders
-+ * that advertise the VPX_CODEC_CAP_PUT_FRAME capability. Calling these functions
-+ * for codecs that don't advertise this capability will result in an error
-+ * code being returned, usually VPX_CODEC_ERROR
-+ * @{
-+ */
-+
-+ /*!\brief put frame callback prototype
-+ *
-+ * This callback is invoked by the decoder to notify the application of
-+ * the availability of decoded image data.
-+ */
-+ typedef void (*vpx_codec_put_frame_cb_fn_t)(void *user_priv,
-+ const vpx_image_t *img);
-+
-+
-+ /*!\brief Register for notification of frame completion.
-+ *
-+ * Registers a given function to be called when a decoded frame is
-+ * available.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] cb Pointer to the callback function
-+ * \param[in] user_priv User's private data
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * Callback successfully registered.
-+ * \retval #VPX_CODEC_ERROR
-+ * Decoder context not initialized, or algorithm not capable of
-+ * posting slice completion.
-+ */
-+ vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
-+ vpx_codec_put_frame_cb_fn_t cb,
-+ void *user_priv);
-+
-+
-+ /*!@} - end defgroup cap_put_frame */
-+
-+ /*!\defgroup cap_put_slice Slice-Based Decoding Functions
-+ *
-+ * The following functions are required to be implemented for all decoders
-+ * that advertise the VPX_CODEC_CAP_PUT_SLICE capability. Calling these functions
-+ * for codecs that don't advertise this capability will result in an error
-+ * code being returned, usually VPX_CODEC_ERROR
-+ * @{
-+ */
-+
-+ /*!\brief put slice callback prototype
-+ *
-+ * This callback is invoked by the decoder to notify the application of
-+ * the availability of partially decoded image data. The
-+ */
-+ typedef void (*vpx_codec_put_slice_cb_fn_t)(void *user_priv,
-+ const vpx_image_t *img,
-+ const vpx_image_rect_t *valid,
-+ const vpx_image_rect_t *update);
-+
-+
-+ /*!\brief Register for notification of slice completion.
-+ *
-+ * Registers a given function to be called when a decoded slice is
-+ * available.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] cb Pointer to the callback function
-+ * \param[in] user_priv User's private data
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * Callback successfully registered.
-+ * \retval #VPX_CODEC_ERROR
-+ * Decoder context not initialized, or algorithm not capable of
-+ * posting slice completion.
-+ */
-+ vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
-+ vpx_codec_put_slice_cb_fn_t cb,
-+ void *user_priv);
-+
-+
-+ /*!@} - end defgroup cap_put_slice*/
-+
-+ /*!@} - end defgroup decoder*/
-+
-+#endif
-+
-+#ifdef __cplusplus
-+}
-+#endif
-+
-+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
-+#include "vpx_decoder_compat.h"
-+#endif
-diff --git a/vpx/vpx_decoder_compat.h b/vpx/vpx_decoder_compat.h
-new file mode 100644
-index 0000000..e66a096
---- /dev/null
-+++ b/vpx/vpx_decoder_compat.h
-@@ -0,0 +1,587 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\defgroup decoder Common Decoder Algorithm Interface
-+ * This abstraction allows applications using this decoder to easily support
-+ * multiple video formats with minimal code duplication. This section describes
-+ * the interface common to all codecs.
-+ * @{
-+ */
-+
-+/*!\file vpx_decoder_compat.h
-+ * \brief Provides a compatibility layer between version 1 and 2 of this API.
-+ *
-+ * This interface has been deprecated. Only existing code should make use
-+ * of this interface, and therefore, it is only thinly documented. Existing
-+ * code should be ported to the vpx_codec_* API.
-+ */
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#ifndef VPX_DECODER_COMPAT_H
-+#define VPX_DECODER_COMPAT_H
-+
-+ /*!\brief Decoder algorithm return codes */
-+ typedef enum {
-+ /*!\brief Operation completed without error */
-+ VPX_DEC_OK = VPX_CODEC_OK,
-+
-+ /*!\brief Unspecified error */
-+ VPX_DEC_ERROR = VPX_CODEC_ERROR,
-+
-+ /*!\brief Memory operation failed */
-+ VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR,
-+
-+ /*!\brief ABI version mismatch */
-+ VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
-+
-+ /*!\brief The given bitstream is not supported.
-+ *
-+ * The bitstream was unable to be parsed at the highest level. The decoder
-+ * is unable to proceed. This error \ref SHOULD be treated as fatal to the
-+ * stream. */
-+ VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM,
-+
-+ /*!\brief Encoded bitstream uses an unsupported feature
-+ *
-+ * The decoder does not implement a feature required by the encoder. This
-+ * return code should only be used for features that prevent future
-+ * pictures from being properly decoded. This error \ref MAY be treated as
-+ * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
-+ */
-+ VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE,
-+
-+ /*!\brief The coded data for this stream is corrupt or incomplete
-+ *
-+ * There was a problem decoding the current frame. This return code
-+ * should only be used for failures that prevent future pictures from
-+ * being properly decoded. This error \ref MAY be treated as fatal to the
-+ * stream or \ref MAY be treated as fatal to the current GOP. If decoding
-+ * is continued for the current GOP, artifacts may be present.
-+ */
-+ VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME,
-+
-+ /*!\brief An application-supplied parameter is not valid.
-+ *
-+ */
-+ VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
-+
-+ /*!\brief An iterator reached the end of list.
-+ *
-+ */
-+ VPX_DEC_LIST_END = VPX_CODEC_LIST_END,
-+
-+ }
-+ vpx_dec_err_t;
-+
-+ /*! \brief Decoder capabilities bitfield
-+ *
-+ * Each decoder advertises the capabilities it supports as part of its
-+ * ::vpx_dec_iface_t interface structure. Capabilities are extra interfaces
-+ * or functionality, and are not required to be supported by a decoder.
-+ *
-+ * The available flags are specifiedby VPX_DEC_CAP_* defines.
-+ */
-+ typedef int vpx_dec_caps_t;
-+#define VPX_DEC_CAP_PUT_SLICE 0x0001 /**< Will issue put_slice callbacks */
-+#define VPX_DEC_CAP_PUT_FRAME 0x0002 /**< Will issue put_frame callbacks */
-+#define VPX_DEC_CAP_XMA 0x0004 /**< Supports e_xternal Memory Allocation */
-+
-+ /*!\brief Stream properties
-+ *
-+ * This structure is used to query or set properties of the decoded
-+ * stream. Algorithms may extend this structure with data specific
-+ * to their bitstream by setting the sz member appropriately.
-+ */
-+#if 1
-+ typedef vpx_codec_stream_info_t vpx_dec_stream_info_t;
-+#else
-+ typedef struct
-+ {
-+ unsigned int sz; /**< Size of this structure */
-+ unsigned int w; /**< Width (or 0 for unknown/default) */
-+ unsigned int h; /**< Height (or 0 for unknown/default) */
-+ unsigned int is_kf; /**< Current frame is a keyframe */
-+ } vpx_dec_stream_info_t;
-+#endif
-+
-+
-+ /*!\brief Decoder interface structure.
-+ *
-+ * Contains function pointers and other data private to the decoder
-+ * implementation. This structure is opaque to the application.
-+ */
-+ typedef const struct vpx_codec_iface vpx_dec_iface_t;
-+ typedef struct vpx_codec_priv vpx_dec_priv_t;
-+
-+ /*!\brief Iterator
-+ *
-+ * Opaque storage used for iterating over lists.
-+ */
-+ typedef vpx_codec_iter_t vpx_dec_iter_t;
-+
-+ /*!\brief Decoder context structure
-+ *
-+ * All decoders \ref MUST support this context structure fully. In general,
-+ * this data should be considered private to the decoder algorithm, and
-+ * not be manipulated or examined by the calling application. Applications
-+ * may reference the 'name' member to get a printable description of the
-+ * algorithm.
-+ */
-+#if 1
-+ typedef vpx_codec_ctx_t vpx_dec_ctx_t;
-+#else
-+ typedef struct
-+ {
-+ const char *name; /**< Printable interface name */
-+ vpx_dec_iface_t *iface; /**< Interface pointers */
-+ vpx_dec_err_t err; /**< Last returned error */
-+ vpx_dec_priv_t *priv; /**< Algorithm private storage */
-+ } vpx_dec_ctx_t;
-+#endif
-+
-+
-+ /*!\brief Return the build configuration
-+ *
-+ * Returns a printable string containing an encoded version of the build
-+ * configuration. This may be useful to vpx support.
-+ *
-+ */
-+ const char *vpx_dec_build_config(void) DEPRECATED;
-+
-+ /*!\brief Return the name for a given interface
-+ *
-+ * Returns a human readable string for name of the given decoder interface.
-+ *
-+ * \param[in] iface Interface pointer
-+ *
-+ */
-+ const char *vpx_dec_iface_name(vpx_dec_iface_t *iface) DEPRECATED;
-+
-+
-+ /*!\brief Convert error number to printable string
-+ *
-+ * Returns a human readable string for the last error returned by the
-+ * algorithm. The returned error will be one line and will not contain
-+ * any newline characters.
-+ *
-+ *
-+ * \param[in] err Error number.
-+ *
-+ */
-+ const char *vpx_dec_err_to_string(vpx_dec_err_t err) DEPRECATED;
-+
-+
-+ /*!\brief Retrieve error synopsis for decoder context
-+ *
-+ * Returns a human readable string for the last error returned by the
-+ * algorithm. The returned error will be one line and will not contain
-+ * any newline characters.
-+ *
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ *
-+ */
-+ const char *vpx_dec_error(vpx_dec_ctx_t *ctx) DEPRECATED;
-+
-+
-+ /*!\brief Retrieve detailed error information for decoder context
-+ *
-+ * Returns a human readable string providing detailed information about
-+ * the last error.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ *
-+ * \retval NULL
-+ * No detailed information is available.
-+ */
-+ const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx) DEPRECATED;
-+
-+
-+ /* REQUIRED FUNCTIONS
-+ *
-+ * The following functions are required to be implemented for all decoders.
-+ * They represent the base case functionality expected of all decoders.
-+ */
-+
-+
-+ /*!\brief Initialize a decoder instance
-+ *
-+ * Initializes a decoder context using the given interface. Applications
-+ * should call the vpx_dec_init convenience macro instead of this
-+ * function directly, to ensure that the ABI version number parameter
-+ * is properly initialized.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[in] iface Pointer to the alogrithm interface to use.
-+ * \param[in] ver ABI version number. Must be set to
-+ * VPX_DECODER_ABI_VERSION
-+ * \retval #VPX_DEC_OK
-+ * The decoder algorithm initialized.
-+ * \retval #VPX_DEC_MEM_ERROR
-+ * Memory allocation failed.
-+ */
-+ vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
-+ vpx_dec_iface_t *iface,
-+ int ver) DEPRECATED;
-+#define vpx_dec_init(ctx, iface) \
-+ vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
-+
-+
-+ /*!\brief Destroy a decoder instance
-+ *
-+ * Destroys a decoder context, freeing any associated memory buffers.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ *
-+ * \retval #VPX_DEC_OK
-+ * The decoder algorithm initialized.
-+ * \retval #VPX_DEC_MEM_ERROR
-+ * Memory allocation failed.
-+ */
-+ vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx) DEPRECATED;
-+
-+
-+ /*!\brief Get the capabilities of an algorithm.
-+ *
-+ * Retrieves the capabliities bitfield from the algorithm's interface.
-+ *
-+ * \param[in] iface Pointer to the alogrithm interface
-+ *
-+ */
-+ vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface) DEPRECATED;
-+
-+
-+ /*!\brief Parse stream info from a buffer
-+ *
-+ * Performs high level parsing of the bitstream. Construction of a decoder
-+ * context is not necessary. Can be used to determine if the bitstream is
-+ * of the proper format, and to extract information from the stream.
-+ *
-+ * \param[in] iface Pointer to the alogrithm interface
-+ * \param[in] data Pointer to a block of data to parse
-+ * \param[in] data_sz Size of the data buffer
-+ * \param[in,out] si Pointer to stream info to update. The size member
-+ * \ref MUST be properly initialized, but \ref MAY be
-+ * clobbered by the algorithm. This parameter \ref MAY
-+ * be NULL.
-+ *
-+ * \retval #VPX_DEC_OK
-+ * Bitstream is parsable and stream information updated
-+ */
-+ vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
-+ const uint8_t *data,
-+ unsigned int data_sz,
-+ vpx_dec_stream_info_t *si) DEPRECATED;
-+
-+
-+ /*!\brief Return information about the current stream.
-+ *
-+ * Returns information about the stream that has been parsed during decoding.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in,out] si Pointer to stream info to update. The size member
-+ * \ref MUST be properly initialized, but \ref MAY be
-+ * clobbered by the algorithm. This parameter \ref MAY
-+ * be NULL.
-+ *
-+ * \retval #VPX_DEC_OK
-+ * Bitstream is parsable and stream information updated
-+ */
-+ vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
-+ vpx_dec_stream_info_t *si) DEPRECATED;
-+
-+
-+ /*!\brief Control algorithm
-+ *
-+ * This function is used to exchange algorithm specific data with the decoder
-+ * instance. This can be used to implement features specific to a particular
-+ * algorithm.
-+ *
-+ * This wrapper function dispatches the request to the helper function
-+ * associated with the given ctrl_id. It tries to call this function
-+ * transparantly, but will return #VPX_DEC_ERROR if the request could not
-+ * be dispatched.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] ctrl_id Algorithm specific control identifier
-+ * \param[in,out] data Data to exchange with algorithm instance.
-+ *
-+ * \retval #VPX_DEC_OK
-+ * The control request was processed.
-+ * \retval #VPX_DEC_ERROR
-+ * The control request was not processed.
-+ * \retval #VPX_DEC_INVALID_PARAM
-+ * The data was not valid.
-+ */
-+ vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
-+ int ctrl_id,
-+ void *data) DEPRECATED;
-+
-+ /*!\brief Decode data
-+ *
-+ * Processes a buffer of coded data. If the processing results in a new
-+ * decoded frame becoming available, #VPX_DEC_CB_PUT_SLICE and
-+ * #VPX_DEC_CB_PUT_FRAME events may be generated, as appropriate. Encoded data
-+ * \ref MUST be passed in DTS (decode time stamp) order. Frames produced will
-+ * always be in PTS (presentation time stamp) order.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] data Pointer to this block of new coded data. If
-+ * NULL, a VPX_DEC_CB_PUT_FRAME event is posted
-+ * for the previously decoded frame.
-+ * \param[in] data_sz Size of the coded data, in bytes.
-+ * \param[in] user_priv Application specific data to associate with
-+ * this frame.
-+ * \param[in] rel_pts PTS relative to the previous frame, in us. If
-+ * unknown or unavailable, set to zero.
-+ *
-+ * \return Returns #VPX_DEC_OK if the coded data was processed completely
-+ * and future pictures can be decoded without error. Otherwise,
-+ * see the descriptions of the other error codes in ::vpx_dec_err_t
-+ * for recoverability capabilities.
-+ */
-+ vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
-+ uint8_t *data,
-+ unsigned int data_sz,
-+ void *user_priv,
-+ int rel_pts) DEPRECATED;
-+
-+
-+ /*!\brief Decoded frames iterator
-+ *
-+ * Iterates over a list of the frames available for display. The iterator
-+ * storage should be initialized to NULL to start the iteration. Iteration is
-+ * complete when this function returns NULL.
-+ *
-+ * The list of available frames becomes valid upon completion of the
-+ * vpx_dec_decode call, and remains valid until the next call to vpx_dec_decode.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in out] iter Iterator storage, initialized to NULL
-+ *
-+ * \return Returns a pointer to an image, if one is ready for display. Frames
-+ * produced will always be in PTS (presentation time stamp) order.
-+ */
-+ vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
-+ vpx_dec_iter_t *iter) DEPRECATED;
-+
-+
-+ /*!\defgroup cap_put_frame Frame-Based Decoding Functions
-+ *
-+ * The following functions are required to be implemented for all decoders
-+ * that advertise the VPX_DEC_CAP_PUT_FRAME capability. Calling these functions
-+ * for codecs that don't advertise this capability will result in an error
-+ * code being returned, usually VPX_DEC_ERROR
-+ * @{
-+ */
-+
-+ /*!\brief put frame callback prototype
-+ *
-+ * This callback is invoked by the decoder to notify the application of
-+ * the availability of decoded image data.
-+ */
-+ typedef void (*vpx_dec_put_frame_cb_fn_t)(void *user_priv,
-+ const vpx_image_t *img);
-+
-+
-+ /*!\brief Register for notification of frame completion.
-+ *
-+ * Registers a given function to be called when a decoded frame is
-+ * available.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] cb Pointer to the callback function
-+ * \param[in] user_priv User's private data
-+ *
-+ * \retval #VPX_DEC_OK
-+ * Callback successfully registered.
-+ * \retval #VPX_DEC_ERROR
-+ * Decoder context not initialized, or algorithm not capable of
-+ * posting slice completion.
-+ */
-+ vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
-+ vpx_dec_put_frame_cb_fn_t cb,
-+ void *user_priv) DEPRECATED;
-+
-+
-+ /*!@} - end defgroup cap_put_frame */
-+
-+ /*!\defgroup cap_put_slice Slice-Based Decoding Functions
-+ *
-+ * The following functions are required to be implemented for all decoders
-+ * that advertise the VPX_DEC_CAP_PUT_SLICE capability. Calling these functions
-+ * for codecs that don't advertise this capability will result in an error
-+ * code being returned, usually VPX_DEC_ERROR
-+ * @{
-+ */
-+
-+ /*!\brief put slice callback prototype
-+ *
-+ * This callback is invoked by the decoder to notify the application of
-+ * the availability of partially decoded image data. The
-+ */
-+ typedef void (*vpx_dec_put_slice_cb_fn_t)(void *user_priv,
-+ const vpx_image_t *img,
-+ const vpx_image_rect_t *valid,
-+ const vpx_image_rect_t *update);
-+
-+
-+ /*!\brief Register for notification of slice completion.
-+ *
-+ * Registers a given function to be called when a decoded slice is
-+ * available.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] cb Pointer to the callback function
-+ * \param[in] user_priv User's private data
-+ *
-+ * \retval #VPX_DEC_OK
-+ * Callback successfully registered.
-+ * \retval #VPX_DEC_ERROR
-+ * Decoder context not initialized, or algorithm not capable of
-+ * posting slice completion.
-+ */
-+ vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
-+ vpx_dec_put_slice_cb_fn_t cb,
-+ void *user_priv) DEPRECATED;
-+
-+
-+ /*!@} - end defgroup cap_put_slice*/
-+
-+ /*!\defgroup cap_xma External Memory Allocation Functions
-+ *
-+ * The following functions are required to be implemented for all decoders
-+ * that advertise the VPX_DEC_CAP_XMA capability. Calling these functions
-+ * for codecs that don't advertise this capability will result in an error
-+ * code being returned, usually VPX_DEC_ERROR
-+ * @{
-+ */
-+
-+ /*!\brief Memory Map Entry
-+ *
-+ * This structure is used to contain the properties of a memory segment. It
-+ * is populated by the decoder in the request phase, and by the calling
-+ * application once the requested allocation has been performed.
-+ */
-+#if 1
-+#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
-+#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
-+#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
-+ typedef struct vpx_codec_mmap vpx_dec_mmap_t;
-+#else
-+ typedef struct vpx_dec_mmap
-+ {
-+ /*
-+ * The following members are set by the codec when requesting a segment
-+ */
-+ unsigned int id; /**< identifier for the segment's contents */
-+ unsigned long sz; /**< size of the segment, in bytes */
-+ unsigned int align; /**< required alignment of the segment, in bytes */
-+ unsigned int flags; /**< bitfield containing segment properties */
-+#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
-+#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
-+#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
-+
-+ /* The following members are to be filled in by the allocation function */
-+ void *base; /**< pointer to the allocated segment */
-+ void (*dtor)(struct vpx_dec_mmap *map); /**< destructor to call */
-+ void *priv; /**< allocator private storage */
-+ } vpx_dec_mmap_t;
-+#endif
-+
-+ /*!\brief Initialize a decoder instance in external allocation mode
-+ *
-+ * Initializes a decoder context using the given interface. Applications
-+ * should call the vpx_dec_xma_init convenience macro instead of this
-+ * function directly, to ensure that the ABI version number parameter
-+ * is properly initialized.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[in] iface Pointer to the alogrithm interface to use.
-+ * \param[in] ver ABI version number. Must be set to
-+ * VPX_DECODER_ABI_VERSION
-+ * \retval #VPX_DEC_OK
-+ * The decoder algorithm initialized.
-+ * \retval #VPX_DEC_ERROR
-+ * Decoder does not support XMA mode.
-+ */
-+ vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
-+ vpx_dec_iface_t *iface,
-+ int ver) DEPRECATED;
-+#define vpx_dec_xma_init(ctx, iface) \
-+ vpx_dec_xma_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
-+
-+
-+ /*!\brief Iterate over the list of segments to allocate.
-+ *
-+ * Iterates over a list of the segments to allocate. The iterator storage
-+ * should be initialized to NULL to start the iteration. Iteration is complete
-+ * when this function returns VPX_DEC_LIST_END. The amount of memory needed to
-+ * allocate is dependant upon the size of the encoded stream. This means that
-+ * the stream info structure must be known at allocation time. It can be
-+ * populated with the vpx_dec_peek_stream_info() function. In cases where the
-+ * stream to be decoded is not available at allocation time, a fixed size must
-+ * be requested. The decoder will not be able to decode streams larger than
-+ * the size used at allocation time.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[out] mmap Pointer to the memory map entry to populate.
-+ * \param[in] si Pointer to the stream info.
-+ * \param[in out] iter Iterator storage, initialized to NULL
-+ *
-+ * \retval #VPX_DEC_OK
-+ * The memory map entry was populated.
-+ * \retval #VPX_DEC_ERROR
-+ * Decoder does not support XMA mode.
-+ * \retval #VPX_DEC_MEM_ERROR
-+ * Unable to determine segment size from stream info.
-+ */
-+ vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx,
-+ vpx_dec_mmap_t *mmap,
-+ const vpx_dec_stream_info_t *si,
-+ vpx_dec_iter_t *iter) DEPRECATED;
-+
-+
-+ /*!\brief Identify allocated segments to decoder instance
-+ *
-+ * Stores a list of allocated segments in the decoder. Segments \ref MUST be
-+ * passed in the order they are read from vpx_dec_get_mem_map(), but may be
-+ * passed in groups of any size. Segments \ref MUST be set only once. The
-+ * allocation function \ref MUST ensure that the vpx_dec_mmap_t::base member
-+ * is non-NULL. If the segment requires cleanup handling (eg, calling free()
-+ * or close()) then the vpx_dec_mmap_t::dtor member \ref MUST be populated.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[in] mmaps Pointer to the first memory map entry in the list.
-+ * \param[in] num_maps Number of entries being set at this time
-+ *
-+ * \retval #VPX_DEC_OK
-+ * The segment was stored in the decoder context.
-+ * \retval #VPX_DEC_ERROR
-+ * Decoder does not support XMA mode.
-+ * \retval #VPX_DEC_MEM_ERROR
-+ * Segment base address was not set, or segment was already stored.
-+
-+ */
-+ vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx,
-+ vpx_dec_mmap_t *mmaps,
-+ unsigned int num_maps) DEPRECATED;
-+
-+ /*!@} - end defgroup cap_xma*/
-+ /*!@} - end defgroup decoder*/
-+
-+
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/vpx/vpx_encoder.h b/vpx/vpx_encoder.h
-new file mode 100644
-index 0000000..8ad7055
---- /dev/null
-+++ b/vpx/vpx_encoder.h
-@@ -0,0 +1,793 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\defgroup encoder Encoder Algorithm Interface
-+ * \ingroup codec
-+ * This abstraction allows applications using this encoder to easily support
-+ * multiple video formats with minimal code duplication. This section describes
-+ * the interface common to all encoders.
-+ * @{
-+ */
-+
-+/*!\file vpx_encoder.h
-+ * \brief Describes the encoder algorithm interface to applications.
-+ *
-+ * This file describes the interface between an application and a
-+ * video encoder algorithm.
-+ *
-+ */
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#ifndef VPX_ENCODER_H
-+#define VPX_ENCODER_H
-+#include "vpx_codec.h"
-+
-+
-+ /*!\brief Current ABI version number
-+ *
-+ * \internal
-+ * If this file is altered in any way that changes the ABI, this value
-+ * must be bumped. Examples include, but are not limited to, changing
-+ * types, removing or reassigning enums, adding/removing/rearranging
-+ * fields to structures
-+ */
-+#define VPX_ENCODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
-+
-+
-+ /*! \brief Encoder capabilities bitfield
-+ *
-+ * Each encoder advertises the capabilities it supports as part of its
-+ * ::vpx_codec_iface_t interface structure. Capabilities are extra
-+ * interfaces or functionality, and are not required to be supported
-+ * by an encoder.
-+ *
-+ * The available flags are specifiedby VPX_CODEC_CAP_* defines.
-+ */
-+#define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */
-+
-+
-+ /*! \brief Initialization-time Feature Enabling
-+ *
-+ * Certain codec features must be known at initialization time, to allow
-+ * for proper memory allocation.
-+ *
-+ * The available flags are specified by VPX_CODEC_USE_* defines.
-+ */
-+#define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */
-+
-+
-+ /*!\brief Generic fixed size buffer structure
-+ *
-+ * This structure is able to hold a reference to any fixed size buffer.
-+ */
-+ typedef struct vpx_fixed_buf
-+ {
-+ void *buf; /**< Pointer to the data */
-+ size_t sz; /**< Length of the buffer, in chars */
-+ } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */
-+
-+
-+ /*!\brief Time Stamp Type
-+ *
-+ * An integer, which when multiplied by the stream's time base, provides
-+ * the absolute time of a sample.
-+ */
-+ typedef int64_t vpx_codec_pts_t;
-+
-+
-+ /*!\brief Compressed Frame Flags
-+ *
-+ * This type represents a bitfield containing information about a compressed
-+ * frame that may be useful to an application. The most significant 16 bits
-+ * can be used by an algorithm to provide additional detail, for example to
-+ * support frame types that are codec specific (MPEG-1 D-frames for example)
-+ */
-+ typedef uint32_t vpx_codec_frame_flags_t;
-+#define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */
-+#define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting
-+ the stream (no future frame depends on
-+ this one) */
-+#define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
-+ be shown */
-+
-+
-+ /*!\brief Encoder output packet variants
-+ *
-+ * This enumeration lists the different kinds of data packets that can be
-+ * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY
-+ * extend this list to provide additional functionality.
-+ */
-+ enum vpx_codec_cx_pkt_kind
-+ {
-+ VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */
-+ VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */
-+ VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */
-+ VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */
-+ };
-+
-+
-+ /*!\brief Encoder output packet
-+ *
-+ * This structure contains the different kinds of output data the encoder
-+ * may produce while compressing a frame.
-+ */
-+ typedef struct vpx_codec_cx_pkt
-+ {
-+ enum vpx_codec_cx_pkt_kind kind; /**< packet variant */
-+ union
-+ {
-+ struct
-+ {
-+ void *buf; /**< compressed data buffer */
-+ size_t sz; /**< length of compressed data */
-+ vpx_codec_pts_t pts; /**< time stamp to show frame
-+ (in timebase units) */
-+ unsigned long duration; /**< duration to show frame
-+ (in timebase units) */
-+ vpx_codec_frame_flags_t flags; /**< flags for this frame */
-+ } frame; /**< data for compressed frame packet */
-+ struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */
-+ struct vpx_psnr_pkt
-+ {
-+ unsigned int samples[4]; /**< Number of samples, total/y/u/v */
-+ uint64_t sse[4]; /**< sum squared error, total/y/u/v */
-+ double psnr[4]; /**< PSNR, total/y/u/v */
-+ } psnr; /**< data for PSNR packet */
-+ struct vpx_fixed_buf raw; /**< data for arbitrary packets */
-+
-+ /* This packet size is fixed to allow codecs to extend this
-+ * interface without having to manage storage for raw packets,
-+ * ie if it's smaller than 128 bytes, you can store in the
-+ * packet list directly.
-+ */
-+ char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */
-+ } data; /**< packet data */
-+ } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */
-+
-+
-+ /*!\brief Rational Number
-+ *
-+ * This structure holds a fractional value.
-+ */
-+ typedef struct vpx_rational
-+ {
-+ int num; /**< fraction numerator */
-+ int den; /**< fraction denominator */
-+ } vpx_rational_t; /**< alias for struct vpx_rational */
-+
-+
-+ /*!\brief Multi-pass Encoding Pass */
-+ enum vpx_enc_pass
-+ {
-+ VPX_RC_ONE_PASS, /**< Single pass mode */
-+ VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */
-+ VPX_RC_LAST_PASS, /**< Final pass of multi-pass mode */
-+ };
-+
-+
-+ /*!\brief Rate control mode */
-+ enum vpx_rc_mode
-+ {
-+ VPX_VBR, /**< Variable Bit Rate (VBR) mode */
-+ VPX_CBR /**< Constant Bit Rate (CBR) mode */
-+ };
-+
-+
-+ /*!\brief Keyframe placement mode.
-+ *
-+ * This enumeration determines whether keyframes are placed automatically by
-+ * the encoder or whether this behavior is disabled. Older releases of this
-+ * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
-+ * This name is confusing for this behavior, so the new symbols to be used
-+ * are VPX_KF_AUTO and VPX_KF_DISABLED.
-+ */
-+ enum vpx_kf_mode
-+ {
-+ VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */
-+ VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */
-+ VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
-+ };
-+
-+
-+ /*!\brief Encoded Frame Flags
-+ *
-+ * This type indicates a bitfield to be passed to vpx_codec_encode(), defining
-+ * per-frame boolean values. By convention, bits common to all codecs will be
-+ * named VPX_EFLAG_*, and bits specific to an algorithm will be named
-+ * /algo/_eflag_*. The lower order 16 bits are reserved for common use.
-+ */
-+ typedef long vpx_enc_frame_flags_t;
-+#define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */
-+
-+
-+ /*!\brief Encoder configuration structure
-+ *
-+ * This structure contains the encoder settings that have common representations
-+ * across all codecs. This doesn't imply that all codecs support all features,
-+ * however.
-+ */
-+ typedef struct vpx_codec_enc_cfg
-+ {
-+ /*
-+ * generic settings (g)
-+ */
-+
-+ /*!\brief Algorithm specific "usage" value
-+ *
-+ * Algorithms may define multiple values for usage, which may convey the
-+ * intent of how the application intends to use the stream. If this value
-+ * is non-zero, consult the documentation for the codec to determine its
-+ * meaning.
-+ */
-+ unsigned int g_usage;
-+
-+
-+ /*!\brief Maximum number of threads to use
-+ *
-+ * For multi-threaded implementations, use no more than this number of
-+ * threads. The codec may use fewer threads than allowed. The value
-+ * 0 is equivalent to the value 1.
-+ */
-+ unsigned int g_threads;
-+
-+
-+ /*!\brief Bitstream profile to use
-+ *
-+ * Some codecs support a notion of multiple bitstream profiles. Typically
-+ * this maps to a set of features that are turned on or off. Often the
-+ * profile to use is determined by the features of the intended decoder.
-+ * Consult the documentation for the codec to determine the valid values
-+ * for this parameter, or set to zero for a sane default.
-+ */
-+ unsigned int g_profile; /**< profile of bitstream to use */
-+
-+
-+
-+ /*!\brief Width of the frame
-+ *
-+ * This value identifies the presentation resolution of the frame,
-+ * in pixels. Note that the frames passed as input to the encoder must
-+ * have this resolution. Frames will be presented by the decoder in this
-+ * resolution, independent of any spatial resampling the encoder may do.
-+ */
-+ unsigned int g_w;
-+
-+
-+ /*!\brief Height of the frame
-+ *
-+ * This value identifies the presentation resolution of the frame,
-+ * in pixels. Note that the frames passed as input to the encoder must
-+ * have this resolution. Frames will be presented by the decoder in this
-+ * resolution, independent of any spatial resampling the encoder may do.
-+ */
-+ unsigned int g_h;
-+
-+
-+ /*!\brief Stream timebase units
-+ *
-+ * Indicates the smallest interval of time, in seconds, used by the stream.
-+ * For fixed frame rate material, or variable frame rate material where
-+ * frames are timed at a multiple of a given clock (ex: video capture),
-+ * the \ref RECOMMENDED method is to set the timebase to the reciprocal
-+ * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
-+ * pts to correspond to the frame number, which can be handy. For
-+ * re-encoding video from containers with absolute time timestamps, the
-+ * \ref RECOMMENDED method is to set the timebase to that of the parent
-+ * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
-+ */
-+ struct vpx_rational g_timebase;
-+
-+
-+ /*!\brief Enable error resilient mode.
-+ *
-+ * Error resilient mode indicates to the encoder that it should take
-+ * measures appropriate for streaming over lossy or noisy links, if
-+ * possible. Set to 1 to enable this feature, 0 to disable it.
-+ */
-+ unsigned int g_error_resilient;
-+
-+
-+ /*!\brief Multi-pass Encoding Mode
-+ *
-+ * This value should be set to the current phase for multi-pass encoding.
-+ * For single pass, set to #VPX_RC_ONE_PASS.
-+ */
-+ enum vpx_enc_pass g_pass;
-+
-+
-+ /*!\brief Allow lagged encoding
-+ *
-+ * If set, this value allows the encoder to consume a number of input
-+ * frames before producing output frames. This allows the encoder to
-+ * base decisions for the current frame on future frames. This does
-+ * increase the latency of the encoding pipeline, so it is not appropriate
-+ * in all situations (ex: realtime encoding).
-+ *
-+ * Note that this is a maximum value -- the encoder may produce frames
-+ * sooner than the given limit. Set this value to 0 to disable this
-+ * feature.
-+ */
-+ unsigned int g_lag_in_frames;
-+
-+
-+ /*
-+ * rate control settings (rc)
-+ */
-+
-+ /*!\brief Temporal resampling configuration, if supported by the codec.
-+ *
-+ * Temporal resampling allows the codec to "drop" frames as a strategy to
-+ * meet its target data rate. This can cause temporal discontinuities in
-+ * the encoded video, which may appear as stuttering during playback. This
-+ * trade-off is often acceptable, but for many applications is not. It can
-+ * be disabled in these cases.
-+ *
-+ * Note that not all codecs support this feature. All vpx VPx codecs do.
-+ * For other codecs, consult the documentation for that algorithm.
-+ *
-+ * This threshold is described as a percentage of the target data buffer.
-+ * When the data buffer falls below this percentage of fullness, a
-+ * dropped frame is indicated. Set the threshold to zero (0) to disable
-+ * this feature.
-+ */
-+ unsigned int rc_dropframe_thresh;
-+
-+
-+ /*!\brief Enable/disable spatial resampling, if supported by the codec.
-+ *
-+ * Spatial resampling allows the codec to compress a lower resolution
-+ * version of the frame, which is then upscaled by the encoder to the
-+ * correct presentation resolution. This increases visual quality at
-+ * low data rates, at the expense of CPU time on the encoder/decoder.
-+ */
-+ unsigned int rc_resize_allowed;
-+
-+
-+ /*!\brief Spatial resampling up watermark.
-+ *
-+ * This threshold is described as a percentage of the target data buffer.
-+ * When the data buffer rises above this percentage of fullness, the
-+ * encoder will step up to a higher resolution version of the frame.
-+ */
-+ unsigned int rc_resize_up_thresh;
-+
-+
-+ /*!\brief Spatial resampling down watermark.
-+ *
-+ * This threshold is described as a percentage of the target data buffer.
-+ * When the data buffer falls below this percentage of fullness, the
-+ * encoder will step down to a lower resolution version of the frame.
-+ */
-+ unsigned int rc_resize_down_thresh;
-+
-+
-+ /*!\brief Rate control algorithm to use.
-+ *
-+ * Indicates whether the end usage of this stream is to be streamed over
-+ * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
-+ * mode should be used, or whether it will be played back on a high
-+ * bandwidth link, as from a local disk, where higher variations in
-+ * bitrate are acceptable.
-+ */
-+ enum vpx_rc_mode rc_end_usage;
-+
-+
-+ /*!\brief Two-pass stats buffer.
-+ *
-+ * A buffer containing all of the stats packets produced in the first
-+ * pass, concatenated.
-+ */
-+ struct vpx_fixed_buf rc_twopass_stats_in;
-+
-+
-+ /*!\brief Target data rate
-+ *
-+ * Target bandwidth to use for this stream, in kilobits per second.
-+ */
-+ unsigned int rc_target_bitrate;
-+
-+
-+ /*
-+ * quantizer settings
-+ */
-+
-+
-+ /*!\brief Minimum (Best Quality) Quantizer
-+ *
-+ * The quantizer is the most direct control over the quality of the
-+ * encoded image. The range of valid values for the quantizer is codec
-+ * specific. Consult the documentation for the codec to determine the
-+ * values to use. To determine the range programmatically, call
-+ * vpx_codec_enc_config_default() with a usage value of 0.
-+ */
-+ unsigned int rc_min_quantizer;
-+
-+
-+ /*!\brief Maximum (Worst Quality) Quantizer
-+ *
-+ * The quantizer is the most direct control over the quality of the
-+ * encoded image. The range of valid values for the quantizer is codec
-+ * specific. Consult the documentation for the codec to determine the
-+ * values to use. To determine the range programmatically, call
-+ * vpx_codec_enc_config_default() with a usage value of 0.
-+ */
-+ unsigned int rc_max_quantizer;
-+
-+
-+ /*
-+ * bitrate tolerance
-+ */
-+
-+
-+ /*!\brief Rate control undershoot tolerance
-+ *
-+ * This value, expressed as a percentage of the target bitrate, describes
-+ * the target bitrate for easier frames, allowing bits to be saved for
-+ * harder frames. Set to zero to use the codec default.
-+ */
-+ unsigned int rc_undershoot_pct;
-+
-+
-+ /*!\brief Rate control overshoot tolerance
-+ *
-+ * This value, expressed as a percentage of the target bitrate, describes
-+ * the maximum allowed bitrate for a given frame. Set to zero to use the
-+ * codec default.
-+ */
-+ unsigned int rc_overshoot_pct;
-+
-+
-+ /*
-+ * decoder buffer model parameters
-+ */
-+
-+
-+ /*!\brief Decoder Buffer Size
-+ *
-+ * This value indicates the amount of data that may be buffered by the
-+ * decoding application. Note that this value is expressed in units of
-+ * time (milliseconds). For example, a value of 5000 indicates that the
-+ * client will buffer (at least) 5000ms worth of encoded data. Use the
-+ * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
-+ * necessary.
-+ */
-+ unsigned int rc_buf_sz;
-+
-+
-+ /*!\brief Decoder Buffer Initial Size
-+ *
-+ * This value indicates the amount of data that will be buffered by the
-+ * decoding application prior to beginning playback. This value is
-+ * expressed in units of time (milliseconds). Use the target bitrate
-+ * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
-+ */
-+ unsigned int rc_buf_initial_sz;
-+
-+
-+ /*!\brief Decoder Buffer Optimal Size
-+ *
-+ * This value indicates the amount of data that the encoder should try
-+ * to maintain in the decoder's buffer. This value is expressed in units
-+ * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
-+ * to convert to bits/bytes, if necessary.
-+ */
-+ unsigned int rc_buf_optimal_sz;
-+
-+
-+ /*
-+ * 2 pass rate control parameters
-+ */
-+
-+
-+ /*!\brief Two-pass mode CBR/VBR bias
-+ *
-+ * Bias, expressed on a scale of 0 to 100, for determining target size
-+ * for the current frame. The value 0 indicates the optimal CBR mode
-+ * value should be used. The value 100 indicates the optimal VBR mode
-+ * value should be used. Values in between indicate which way the
-+ * encoder should "lean."
-+ */
-+ unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias between CBR and VBR(0-100: 0->CBR, 100->VBR) */
-+
-+
-+ /*!\brief Two-pass mode per-GOP minimum bitrate
-+ *
-+ * This value, expressed as a percentage of the target bitrate, indicates
-+ * the minimum bitrate to be used for a single GOP (aka "section")
-+ */
-+ unsigned int rc_2pass_vbr_minsection_pct;
-+
-+
-+ /*!\brief Two-pass mode per-GOP maximum bitrate
-+ *
-+ * This value, expressed as a percentage of the target bitrate, indicates
-+ * the maximum bitrate to be used for a single GOP (aka "section")
-+ */
-+ unsigned int rc_2pass_vbr_maxsection_pct;
-+
-+
-+ /*
-+ * keyframing settings (kf)
-+ */
-+
-+ /*!\brief Keyframe placement mode
-+ *
-+ * This value indicates whether the encoder should place keyframes at a
-+ * fixed interval, or determine the optimal placement automatically
-+ * (as governed by the #kf_min_dist and #kf_max_dist parameters)
-+ */
-+ enum vpx_kf_mode kf_mode;
-+
-+
-+ /*!\brief Keyframe minimum interval
-+ *
-+ * This value, expressed as a number of frames, prevents the encoder from
-+ * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
-+ * least kf_min_dist frames non-keyframes will be coded before the next
-+ * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
-+ */
-+ unsigned int kf_min_dist;
-+
-+
-+ /*!\brief Keyframe maximum interval
-+ *
-+ * This value, expressed as a number of frames, forces the encoder to code
-+ * a keyframe if one has not been coded in the last kf_max_dist frames.
-+ * A value of 0 implies all frames will be keyframes. Set kf_min_dist
-+ * equal to kf_max_dist for a fixed interval.
-+ */
-+ unsigned int kf_max_dist;
-+
-+ } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */
-+
-+
-+ /*!\brief Initialize an encoder instance
-+ *
-+ * Initializes a encoder context using the given interface. Applications
-+ * should call the vpx_codec_enc_init convenience macro instead of this
-+ * function directly, to ensure that the ABI version number parameter
-+ * is properly initialized.
-+ *
-+ * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
-+ * parameter), the storage pointed to by the cfg parameter must be
-+ * kept readable and stable until all memory maps have been set.
-+ *
-+ * \param[in] ctx Pointer to this instance's context.
-+ * \param[in] iface Pointer to the algorithm interface to use.
-+ * \param[in] cfg Configuration to use, if known. May be NULL.
-+ * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
-+ * \param[in] ver ABI version number. Must be set to
-+ * VPX_ENCODER_ABI_VERSION
-+ * \retval #VPX_CODEC_OK
-+ * The decoder algorithm initialized.
-+ * \retval #VPX_CODEC_MEM_ERROR
-+ * Memory allocation failed.
-+ */
-+ vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iface_t *iface,
-+ vpx_codec_enc_cfg_t *cfg,
-+ vpx_codec_flags_t flags,
-+ int ver);
-+
-+
-+ /*!\brief Convenience macro for vpx_codec_enc_init_ver()
-+ *
-+ * Ensures the ABI version parameter is properly set.
-+ */
-+#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
-+ vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
-+
-+
-+ /*!\brief Get a default configuration
-+ *
-+ * Initializes a encoder configuration structure with default values. Supports
-+ * the notion of "usages" so that an algorithm may offer different default
-+ * settings depending on the user's intended goal. This function \ref SHOULD
-+ * be called by all applications to initialize the configuration structure
-+ * before specializing the configuration with application specific values.
-+ *
-+ * \param[in] iface Pointer to the algorithm interface to use.
-+ * \param[out] cfg Configuration buffer to populate
-+ * \param[in] usage End usage. Set to 0 or use codec specific values.
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The configuration was populated.
-+ * \retval #VPX_CODEC_INCAPABLE
-+ * Interface is not an encoder interface.
-+ * \retval #VPX_CODEC_INVALID_PARAM
-+ * A parameter was NULL, or the usage value was not recognized.
-+ */
-+ vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
-+ vpx_codec_enc_cfg_t *cfg,
-+ unsigned int usage);
-+
-+
-+ /*!\brief Set or change configuration
-+ *
-+ * Reconfigures an encoder instance according to the given configuration.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] cfg Configuration buffer to use
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The configuration was populated.
-+ * \retval #VPX_CODEC_INCAPABLE
-+ * Interface is not an encoder interface.
-+ * \retval #VPX_CODEC_INVALID_PARAM
-+ * A parameter was NULL, or the usage value was not recognized.
-+ */
-+ vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
-+ const vpx_codec_enc_cfg_t *cfg);
-+
-+
-+ /*!\brief Get global stream headers
-+ *
-+ * Retrieves a stream level global header packet, if supported by the codec.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ *
-+ * \retval NULL
-+ * Encoder does not support global header
-+ * \retval Non-NULL
-+ * Pointer to buffer containing global header packet
-+ */
-+ vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx);
-+
-+
-+#define VPX_DL_REALTIME (1) /**< deadline parameter analogous to
-+ * VPx REALTIME mode. */
-+#define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to
-+ * VPx GOOD QUALITY mode. */
-+#define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to
-+ * VPx BEST QUALITY mode. */
-+ /*!\brief Encode a frame
-+ *
-+ * Encodes a video frame at the given "presentation time." The presentation
-+ * time stamp (PTS) \ref MUST be strictly increasing.
-+ *
-+ * The encoder supports the notion of a soft real-time deadline. Given a
-+ * non-zero value to the deadline parameter, the encoder will make a "best
-+ * effort" guarantee to return before the given time slice expires. It is
-+ * implicit that limiting the available time to encode will degrade the
-+ * output quality. The encoder can be given an unlimited time to produce the
-+ * best possible frame by specifying a deadline of '0'. This deadline
-+ * supercedes the VPx notion of "best quality, good quality, realtime".
-+ * Applications that wish to map these former settings to the new deadline
-+ * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
-+ * and #VPX_DL_BEST_QUALITY.
-+ *
-+ * When the last frame has been passed to the encoder, this function should
-+ * continue to be called, with the img parameter set to NULL. This will
-+ * signal the end-of-stream condition to the encoder and allow it to encode
-+ * any held buffers. Encoding is complete when vpx_codec_encode() is called
-+ * and vpx_codec_get_cx_data() returns no data.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] img Image data to encode, NULL to flush.
-+ * \param[in] pts Presentation time stamp, in timebase units.
-+ * \param[in] duration Duration to show frame, in timebase units.
-+ * \param[in] flags Flags to use for encoding this frame.
-+ * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The configuration was populated.
-+ * \retval #VPX_CODEC_INCAPABLE
-+ * Interface is not an encoder interface.
-+ * \retval #VPX_CODEC_INVALID_PARAM
-+ * A parameter was NULL, the image format is unsupported, etc.
-+ */
-+ vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
-+ const vpx_image_t *img,
-+ vpx_codec_pts_t pts,
-+ unsigned long duration,
-+ vpx_enc_frame_flags_t flags,
-+ unsigned long deadline);
-+
-+
-+ /*!\brief Set compressed data output buffer
-+ *
-+ * Sets the buffer that the codec should output the compressed data
-+ * into. This call effectively sets the buffer pointer returned in the
-+ * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be
-+ * appended into this buffer. The buffer is preserved across frames,
-+ * so applications must periodically call this function after flushing
-+ * the accumulated compressed data to disk or to the network to reset
-+ * the pointer to the buffer's head.
-+ *
-+ * `pad_before` bytes will be skipped before writing the compressed
-+ * data, and `pad_after` bytes will be appended to the packet. The size
-+ * of the packet will be the sum of the size of the actual compressed
-+ * data, pad_before, and pad_after. The padding bytes will be preserved
-+ * (not overwritten).
-+ *
-+ * Note that calling this function does not guarantee that the returned
-+ * compressed data will be placed into the specified buffer. In the
-+ * event that the encoded data will not fit into the buffer provided,
-+ * the returned packet \ref MAY point to an internal buffer, as it would
-+ * if this call were never used. In this event, the output packet will
-+ * NOT have any padding, and the application must free space and copy it
-+ * to the proper place. This is of particular note in configurations
-+ * that may output multiple packets for a single encoded frame (e.g., lagged
-+ * encoding) or if the application does not reset the buffer periodically.
-+ *
-+ * Applications may restore the default behavior of the codec providing
-+ * the compressed data buffer by calling this function with a NULL
-+ * buffer.
-+ *
-+ * Applications \ref MUSTNOT call this function during iteration of
-+ * vpx_codec_get_cx_data().
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in] buf Buffer to store compressed data into
-+ * \param[in] pad_before Bytes to skip before writing compressed data
-+ * \param[in] pad_after Bytes to skip after writing compressed data
-+ *
-+ * \retval #VPX_CODEC_OK
-+ * The buffer was set successfully.
-+ * \retval #VPX_CODEC_INVALID_PARAM
-+ * A parameter was NULL, the image format is unsupported, etc.
-+ */
-+ vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
-+ const vpx_fixed_buf_t *buf,
-+ unsigned int pad_before,
-+ unsigned int pad_after);
-+
-+
-+ /*!\brief Encoded data iterator
-+ *
-+ * Iterates over a list of data packets to be passed from the encoder to the
-+ * application. The different kinds of packets available are enumerated in
-+ * #vpx_codec_cx_pkt_kind.
-+ *
-+ * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's
-+ * muxer. Multiple compressed frames may be in the list.
-+ * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer.
-+ *
-+ * The application \ref MUST silently ignore any packet kinds that it does
-+ * not recognize or support.
-+ *
-+ * The data buffers returned from this function are only guaranteed to be
-+ * valid until the application makes another call to any vpx_codec_* function.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ * \param[in,out] iter Iterator storage, initialized to NULL
-+ *
-+ * \return Returns a pointer to an output data packet (compressed frame data,
-+ * two-pass statistics, etc.) or NULL to signal end-of-list.
-+ *
-+ */
-+ const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
-+ vpx_codec_iter_t *iter);
-+
-+
-+ /*!\brief Get Preview Frame
-+ *
-+ * Returns an image that can be used as a preview. Shows the image as it would
-+ * exist at the decompressor. The application \ref MUST NOT write into this
-+ * image buffer.
-+ *
-+ * \param[in] ctx Pointer to this instance's context
-+ *
-+ * \return Returns a pointer to a preview image, or NULL if no image is
-+ * available.
-+ *
-+ */
-+ const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx);
-+
-+
-+ /*!@} - end defgroup encoder*/
-+
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/vpx/vpx_image.h b/vpx/vpx_image.h
-new file mode 100644
-index 0000000..7e4a03a
---- /dev/null
-+++ b/vpx/vpx_image.h
-@@ -0,0 +1,242 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+/*!\file vpx_image.h
-+ * \brief Describes the vpx image descriptor and associated operations
-+ *
-+ */
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-+
-+#ifndef VPX_IMAGE_H
-+#define VPX_IMAGE_H
-+
-+ /*!\brief Current ABI version number
-+ *
-+ * \internal
-+ * If this file is altered in any way that changes the ABI, this value
-+ * must be bumped. Examples include, but are not limited to, changing
-+ * types, removing or reassigning enums, adding/removing/rearranging
-+ * fields to structures
-+ */
-+#define VPX_IMAGE_ABI_VERSION (1) /**<\hideinitializer*/
-+
-+
-+#define VPX_IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
-+#define VPX_IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
-+#define VPX_IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel componnent */
-+
-+
-+ /*!\brief List of supported image formats */
-+ typedef enum vpx_img_fmt {
-+ VPX_IMG_FMT_NONE,
-+ VPX_IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
-+ VPX_IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
-+ VPX_IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
-+ VPX_IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
-+ VPX_IMG_FMT_UYVY, /**< UYVY packed YUV */
-+ VPX_IMG_FMT_YUY2, /**< YUYV packed YUV */
-+ VPX_IMG_FMT_YVYU, /**< YVYU packed YUV */
-+ VPX_IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
-+ VPX_IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
-+ VPX_IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
-+ VPX_IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
-+ VPX_IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
-+ VPX_IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
-+ VPX_IMG_FMT_YV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 1, /**< planar YVU */
-+ VPX_IMG_FMT_I420 = VPX_IMG_FMT_PLANAR | 2,
-+ VPX_IMG_FMT_VPXYV12 = VPX_IMG_FMT_PLANAR | VPX_IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
-+ VPX_IMG_FMT_VPXI420 = VPX_IMG_FMT_PLANAR | 4, /** < planar 4:2:0 format with vpx color space */
-+ }
-+ vpx_img_fmt_t; /**< alias for enum vpx_img_fmt */
-+
-+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
-+#define IMG_FMT_PLANAR VPX_IMG_FMT_PLANAR /**< \deprecated Use #VPX_IMG_FMT_PLANAR */
-+#define IMG_FMT_UV_FLIP VPX_IMG_FMT_UV_FLIP /**< \deprecated Use #VPX_IMG_FMT_UV_FLIP */
-+#define IMG_FMT_HAS_ALPHA VPX_IMG_FMT_HAS_ALPHA /**< \deprecated Use #VPX_IMG_FMT_HAS_ALPHA */
-+
-+ /*!\brief Deprecated list of supported image formats
-+ * \deprecated New code should use #vpx_img_fmt
-+ */
-+#define img_fmt vpx_img_fmt
-+ /*!\brief alias for enum img_fmt.
-+ * \deprecated New code should use #vpx_img_fmt_t
-+ */
-+#define img_fmt_t vpx_img_fmt_t
-+
-+#define IMG_FMT_NONE VPX_IMG_FMT_NONE /**< \deprecated Use #VPX_IMG_FMT_NONE */
-+#define IMG_FMT_RGB24 VPX_IMG_FMT_RGB24 /**< \deprecated Use #VPX_IMG_FMT_RGB24 */
-+#define IMG_FMT_RGB32 VPX_IMG_FMT_RGB32 /**< \deprecated Use #VPX_IMG_FMT_RGB32 */
-+#define IMG_FMT_RGB565 VPX_IMG_FMT_RGB565 /**< \deprecated Use #VPX_IMG_FMT_RGB565 */
-+#define IMG_FMT_RGB555 VPX_IMG_FMT_RGB555 /**< \deprecated Use #VPX_IMG_FMT_RGB555 */
-+#define IMG_FMT_UYVY VPX_IMG_FMT_UYVY /**< \deprecated Use #VPX_IMG_FMT_UYVY */
-+#define IMG_FMT_YUY2 VPX_IMG_FMT_YUY2 /**< \deprecated Use #VPX_IMG_FMT_YUY2 */
-+#define IMG_FMT_YVYU VPX_IMG_FMT_YVYU /**< \deprecated Use #VPX_IMG_FMT_YVYU */
-+#define IMG_FMT_BGR24 VPX_IMG_FMT_BGR24 /**< \deprecated Use #VPX_IMG_FMT_BGR24 */
-+#define IMG_FMT_RGB32_LE VPX_IMG_FMT_RGB32_LE /**< \deprecated Use #VPX_IMG_FMT_RGB32_LE */
-+#define IMG_FMT_ARGB VPX_IMG_FMT_ARGB /**< \deprecated Use #VPX_IMG_FMT_ARGB */
-+#define IMG_FMT_ARGB_LE VPX_IMG_FMT_ARGB_LE /**< \deprecated Use #VPX_IMG_FMT_ARGB_LE */
-+#define IMG_FMT_RGB565_LE VPX_IMG_FMT_RGB565_LE /**< \deprecated Use #VPX_IMG_FMT_RGB565_LE */
-+#define IMG_FMT_RGB555_LE VPX_IMG_FMT_RGB555_LE /**< \deprecated Use #VPX_IMG_FMT_RGB555_LE */
-+#define IMG_FMT_YV12 VPX_IMG_FMT_YV12 /**< \deprecated Use #VPX_IMG_FMT_YV12 */
-+#define IMG_FMT_I420 VPX_IMG_FMT_I420 /**< \deprecated Use #VPX_IMG_FMT_I420 */
-+#define IMG_FMT_VPXYV12 VPX_IMG_FMT_VPXYV12 /**< \deprecated Use #VPX_IMG_FMT_VPXYV12 */
-+#define IMG_FMT_VPXI420 VPX_IMG_FMT_VPXI420 /**< \deprecated Use #VPX_IMG_FMT_VPXI420 */
-+#endif /* VPX_CODEC_DISABLE_COMPAT */
-+
-+ /**\brief Image Descriptor */
-+ typedef struct vpx_image
-+ {
-+ vpx_img_fmt_t fmt; /**< Image Format */
-+
-+ /* Image storage dimensions */
-+ unsigned int w; /**< Stored image width */
-+ unsigned int h; /**< Stored image height */
-+
-+ /* Image display dimensions */
-+ unsigned int d_w; /**< Displayed image width */
-+ unsigned int d_h; /**< Displayed image height */
-+
-+ /* Chroma subsampling info */
-+ unsigned int x_chroma_shift; /**< subsampling order, X */
-+ unsigned int y_chroma_shift; /**< subsampling order, Y */
-+
-+ /* Image data pointers. */
-+#define VPX_PLANE_PACKED 0 /**< To be used for all packed formats */
-+#define VPX_PLANE_Y 0 /**< Y (Luminance) plane */
-+#define VPX_PLANE_U 1 /**< U (Chroma) plane */
-+#define VPX_PLANE_V 2 /**< V (Chroma) plane */
-+#define VPX_PLANE_ALPHA 3 /**< A (Transparancy) plane */
-+#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
-+#define PLANE_PACKED VPX_PLANE_PACKED
-+#define PLANE_Y VPX_PLANE_Y
-+#define PLANE_U VPX_PLANE_U
-+#define PLANE_V VPX_PLANE_V
-+#define PLANE_ALPHA VPX_PLANE_ALPHA
-+#endif
-+ unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
-+ int stride[4]; /**< stride between rows for each plane */
-+
-+ int bps; /**< bits per sample (for packed formats) */
-+
-+ /* The following member may be set by the application to associate data
-+ * with this image.
-+ */
-+ void *user_priv; /**< may be set by the application to associate data
-+ * with this image. */
-+
-+ /* The following members should be treated as private. */
-+ unsigned char *img_data; /**< private */
-+ int img_data_owner; /**< private */
-+ int self_allocd; /**< private */
-+ } vpx_image_t; /**< alias for struct vpx_image */
-+
-+ /**\brief Representation of a rectangle on a surface */
-+ typedef struct vpx_image_rect
-+ {
-+ unsigned int x; /**< leftmost column */
-+ unsigned int y; /**< topmost row */
-+ unsigned int w; /**< width */
-+ unsigned int h; /**< height */
-+ } vpx_image_rect_t; /**< alias for struct vpx_image_rect */
-+
-+ /*!\brief Open a descriptor, allocating storage for the underlying image
-+ *
-+ * Returns a descriptor for storing an image of the given format. The
-+ * storage for the descriptor is allocated on the heap.
-+ *
-+ * \param[in] img Pointer to storage for descriptor. If this parameter
-+ * is NULL, the storage for the descriptor will be
-+ * allocated on the heap.
-+ * \param[in] fmt Format for the image
-+ * \param[in] d_w Width of the image
-+ * \param[in] d_h Height of the image
-+ * \param[in] align Alignment, in bytes, of each row in the image.
-+ *
-+ * \return Returns a pointer to the initialized image descriptor. If the img
-+ * parameter is non-null, the value of the img parameter will be
-+ * returned.
-+ */
-+ vpx_image_t *vpx_img_alloc(vpx_image_t *img,
-+ vpx_img_fmt_t fmt,
-+ unsigned int d_w,
-+ unsigned int d_h,
-+ unsigned int align);
-+
-+ /*!\brief Open a descriptor, using existing storage for the underlying image
-+ *
-+ * Returns a descriptor for storing an image of the given format. The
-+ * storage for descriptor has been allocated elsewhere, and a descriptor is
-+ * desired to "wrap" that storage.
-+ *
-+ * \param[in] img Pointer to storage for descriptor. If this parameter
-+ * is NULL, the storage for the descriptor will be
-+ * allocated on the heap.
-+ * \param[in] fmt Format for the image
-+ * \param[in] d_w Width of the image
-+ * \param[in] d_h Height of the image
-+ * \param[in] align Alignment, in bytes, of each row in the image.
-+ * \param[in] img_data Storage to use for the image
-+ *
-+ * \return Returns a pointer to the initialized image descriptor. If the img
-+ * parameter is non-null, the value of the img parameter will be
-+ * returned.
-+ */
-+ vpx_image_t *vpx_img_wrap(vpx_image_t *img,
-+ vpx_img_fmt_t fmt,
-+ unsigned int d_w,
-+ unsigned int d_h,
-+ unsigned int align,
-+ unsigned char *img_data);
-+
-+
-+ /*!\brief Set the rectangle identifying the displayed portion of the image
-+ *
-+ * Updates the displayed rectangle (aka viewport) on the image surface to
-+ * match the specified coordinates and size.
-+ *
-+ * \param[in] img Image descriptor
-+ * \param[in] x leftmost column
-+ * \param[in] y topmost row
-+ * \param[in] w width
-+ * \param[in] h height
-+ *
-+ * \return 0 if the requested rectangle is valid, nonzero otherwise.
-+ */
-+ int vpx_img_set_rect(vpx_image_t *img,
-+ unsigned int x,
-+ unsigned int y,
-+ unsigned int w,
-+ unsigned int h);
-+
-+
-+ /*!\brief Flip the image vertically (top for bottom)
-+ *
-+ * Adjusts the image descriptor's pointers and strides to make the image
-+ * be referenced upside-down.
-+ *
-+ * \param[in] img Image descriptor
-+ */
-+ void vpx_img_flip(vpx_image_t *img);
-+
-+ /*!\brief Close an image descriptor
-+ *
-+ * Frees all allocated storage associated with an image descriptor.
-+ *
-+ * \param[in] img Image descriptor
-+ */
-+ void vpx_img_free(vpx_image_t *img);
-+
-+#endif
-+#ifdef __cplusplus
-+}
-+#endif
-diff --git a/vpx/vpx_integer.h b/vpx/vpx_integer.h
-new file mode 100644
-index 0000000..f06c641
---- /dev/null
-+++ b/vpx/vpx_integer.h
-@@ -0,0 +1,57 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ */
-+
-+
-+#ifndef VPX_INTEGER_H
-+#define VPX_INTEGER_H
-+
-+/* get ptrdiff_t, size_t, wchar_t, NULL */
-+#include <stddef.h>
-+
-+#if defined(_MSC_VER) || defined(VPX_EMULATE_INTTYPES)
-+typedef signed char int8_t;
-+typedef signed short int16_t;
-+typedef signed int int32_t;
-+
-+typedef unsigned char uint8_t;
-+typedef unsigned short uint16_t;
-+typedef unsigned int uint32_t;
-+
-+#if defined(_MSC_VER)
-+typedef signed __int64 int64_t;
-+typedef unsigned __int64 uint64_t;
-+#define PRId64 "I64d"
-+#endif
-+
-+#ifdef HAVE_ARMV6
-+typedef unsigned int int_fast16_t;
-+#else
-+typedef signed short int_fast16_t;
-+#endif
-+typedef signed char int_fast8_t;
-+typedef unsigned char uint_fast8_t;
-+
-+#ifndef _UINTPTR_T_DEFINED
-+typedef unsigned int uintptr_t;
-+#endif
-+
-+#else
-+
-+/* Most platforms have the C99 standard integer types. */
-+
-+#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
-+#define __STDC_FORMAT_MACROS
-+#endif
-+#include <stdint.h>
-+#include <inttypes.h>
-+
-+#endif
-+
-+#endif
-diff --git a/vpx_codec/exports b/vpx_codec/exports
-deleted file mode 100644
-index f5e7473..0000000
---- a/vpx_codec/exports
-+++ /dev/null
-@@ -1,17 +0,0 @@
--text vpx_dec_control
--text vpx_dec_decode
--text vpx_dec_destroy
--text vpx_dec_err_to_string
--text vpx_dec_error
--text vpx_dec_error_detail
--text vpx_dec_get_caps
--text vpx_dec_get_frame
--text vpx_dec_get_mem_map
--text vpx_dec_get_stream_info
--text vpx_dec_iface_name
--text vpx_dec_init_ver
--text vpx_dec_peek_stream_info
--text vpx_dec_register_put_frame_cb
--text vpx_dec_register_put_slice_cb
--text vpx_dec_set_mem_map
--text vpx_dec_xma_init_ver
-diff --git a/vpx_codec/internal/vpx_codec_internal.h b/vpx_codec/internal/vpx_codec_internal.h
-deleted file mode 100644
-index 0867552..0000000
---- a/vpx_codec/internal/vpx_codec_internal.h
-+++ /dev/null
-@@ -1,457 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\file decoder_impl.h
-- * \brief Describes the decoder algorithm interface for algorithm
-- * implementations.
-- *
-- * This file defines the private structures and data types that are only
-- * relevant to implementing an algorithm, as opposed to using it.
-- *
-- * To create a decoder algorithm class, an interface structure is put
-- * into the global namespace:
-- * <pre>
-- * my_codec.c:
-- * vpx_codec_iface_t my_codec = {
-- * "My Codec v1.0",
-- * VPX_CODEC_ALG_ABI_VERSION,
-- * ...
-- * };
-- * </pre>
-- *
-- * An application instantiates a specific decoder instance by using
-- * vpx_codec_init() and a pointer to the algorithm's interface structure:
-- * <pre>
-- * my_app.c:
-- * extern vpx_codec_iface_t my_codec;
-- * {
-- * vpx_codec_ctx_t algo;
-- * res = vpx_codec_init(&algo, &my_codec);
-- * }
-- * </pre>
-- *
-- * Once initialized, the instance is manged using other functions from
-- * the vpx_codec_* family.
-- */
--#ifndef VPX_CODEC_INTERNAL_H
--#define VPX_CODEC_INTERNAL_H
--#include "../vpx_decoder.h"
--#include "../vpx_encoder.h"
--#include <stdarg.h>
--
--
--/*!\brief Current ABI version number
-- *
-- * \internal
-- * If this file is altered in any way that changes the ABI, this value
-- * must be bumped. Examples include, but are not limited to, changing
-- * types, removing or reassigning enums, adding/removing/rearranging
-- * fields to structures
-- */
--#define VPX_CODEC_INTERNAL_ABI_VERSION (2) /**<\hideinitializer*/
--
--typedef struct vpx_codec_alg_priv vpx_codec_alg_priv_t;
--
--/*!\brief init function pointer prototype
-- *
-- * Performs algorithm-specific initialization of the decoder context. This
-- * function is called by the generic vpx_codec_init() wrapper function, so
-- * plugins implementing this interface may trust the input parameters to be
-- * properly initialized.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \retval #VPX_CODEC_OK
-- * The input stream was recognized and decoder initialized.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Memory operation failed.
-- */
--typedef vpx_codec_err_t (*vpx_codec_init_fn_t)(vpx_codec_ctx_t *ctx);
--
--/*!\brief destroy function pointer prototype
-- *
-- * Performs algorithm-specific destruction of the decoder context. This
-- * function is called by the generic vpx_codec_destroy() wrapper function,
-- * so plugins implementing this interface may trust the input parameters
-- * to be properly initialized.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \retval #VPX_CODEC_OK
-- * The input stream was recognized and decoder initialized.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Memory operation failed.
-- */
--typedef vpx_codec_err_t (*vpx_codec_destroy_fn_t)(vpx_codec_alg_priv_t *ctx);
--
--/*!\brief parse stream info function pointer prototype
-- *
-- * Performs high level parsing of the bitstream. This function is called by
-- * the generic vpx_codec_parse_stream() wrapper function, so plugins implementing
-- * this interface may trust the input parameters to be properly initialized.
-- *
-- * \param[in] data Pointer to a block of data to parse
-- * \param[in] data_sz Size of the data buffer
-- * \param[in,out] si Pointer to stream info to update. The size member
-- * \ref MUST be properly initialized, but \ref MAY be
-- * clobbered by the algorithm. This parameter \ref MAY
-- * be NULL.
-- *
-- * \retval #VPX_CODEC_OK
-- * Bitstream is parsable and stream information updated
-- */
--typedef vpx_codec_err_t (*vpx_codec_peek_si_fn_t)(const uint8_t *data,
-- unsigned int data_sz,
-- vpx_codec_stream_info_t *si);
--
--/*!\brief Return information about the current stream.
-- *
-- * Returns information about the stream that has been parsed during decoding.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in,out] si Pointer to stream info to update. The size member
-- * \ref MUST be properly initialized, but \ref MAY be
-- * clobbered by the algorithm. This parameter \ref MAY
-- * be NULL.
-- *
-- * \retval #VPX_CODEC_OK
-- * Bitstream is parsable and stream information updated
-- */
--typedef vpx_codec_err_t (*vpx_codec_get_si_fn_t)(vpx_codec_alg_priv_t *ctx,
-- vpx_codec_stream_info_t *si);
--
--/*!\brief control function pointer prototype
-- *
-- * This function is used to exchange algorithm specific data with the decoder
-- * instance. This can be used to implement features specific to a particular
-- * algorithm.
-- *
-- * This function is called by the generic vpx_codec_control() wrapper
-- * function, so plugins implementing this interface may trust the input
-- * parameters to be properly initialized. However, this interface does not
-- * provide type safety for the exchanged data or assign meanings to the
-- * control codes. Those details should be specified in the algorithm's
-- * header file. In particular, the ctrl_id parameter is guaranteed to exist
-- * in the algorithm's control mapping table, and the data paramter may be NULL.
-- *
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] ctrl_id Algorithm specific control identifier
-- * \param[in,out] data Data to exchange with algorithm instance.
-- *
-- * \retval #VPX_CODEC_OK
-- * The internal state data was deserialized.
-- */
--typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t *ctx,
-- int ctrl_id,
-- va_list ap);
--
--/*!\brief control function pointer mapping
-- *
-- * This structure stores the mapping between control identifiers and
-- * implementing functions. Each algorithm provides a list of these
-- * mappings. This list is searched by the vpx_codec_control() wrapper
-- * function to determine which function to invoke. The special
-- * value {0, NULL} is used to indicate end-of-list, and must be
-- * present. The special value {0, <non-null>} can be used as a catch-all
-- * mapping. This implies that ctrl_id values chosen by the algorithm
-- * \ref MUST be non-zero.
-- */
--typedef const struct
--{
-- int ctrl_id;
-- vpx_codec_control_fn_t fn;
--} vpx_codec_ctrl_fn_map_t;
--
--/*!\brief decode data function pointer prototype
-- *
-- * Processes a buffer of coded data. If the processing results in a new
-- * decoded frame becoming available, #VPX_CODEC_CB_PUT_SLICE and
-- * #VPX_CODEC_CB_PUT_FRAME events are generated as appropriate. This
-- * function is called by the generic vpx_codec_decode() wrapper function,
-- * so plugins implementing this interface may trust the input parameters
-- * to be properly initialized.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] data Pointer to this block of new coded data. If
-- * NULL, a #VPX_CODEC_CB_PUT_FRAME event is posted
-- * for the previously decoded frame.
-- * \param[in] data_sz Size of the coded data, in bytes.
-- *
-- * \return Returns #VPX_CODEC_OK if the coded data was processed completely
-- * and future pictures can be decoded without error. Otherwise,
-- * see the descriptions of the other error codes in ::vpx_codec_err_t
-- * for recoverability capabilities.
-- */
--typedef vpx_codec_err_t (*vpx_codec_decode_fn_t)(vpx_codec_alg_priv_t *ctx,
-- const uint8_t *data,
-- unsigned int data_sz,
-- void *user_priv,
-- long deadline);
--
--/*!\brief Decoded frames iterator
-- *
-- * Iterates over a list of the frames available for display. The iterator
-- * storage should be initialized to NULL to start the iteration. Iteration is
-- * complete when this function returns NULL.
-- *
-- * The list of available frames becomes valid upon completion of the
-- * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in out] iter Iterator storage, initialized to NULL
-- *
-- * \return Returns a pointer to an image, if one is ready for display. Frames
-- * produced will always be in PTS (presentation time stamp) order.
-- */
--typedef vpx_image_t*(*vpx_codec_get_frame_fn_t)(vpx_codec_alg_priv_t *ctx,
-- vpx_codec_iter_t *iter);
--
--
--/*\brief e_xternal Memory Allocation memory map get iterator
-- *
-- * Iterates over a list of the memory maps requested by the decoder. The
-- * iterator storage should be initialized to NULL to start the iteration.
-- * Iteration is complete when this function returns NULL.
-- *
-- * \param[in out] iter Iterator storage, initialized to NULL
-- *
-- * \return Returns a pointer to an memory segment descriptor, or NULL to
-- * indicate end-of-list.
-- */
--typedef vpx_codec_err_t (*vpx_codec_get_mmap_fn_t)(const vpx_codec_ctx_t *ctx,
-- vpx_codec_mmap_t *mmap,
-- vpx_codec_iter_t *iter);
--
--
--/*\brief e_xternal Memory Allocation memory map set iterator
-- *
-- * Sets a memory descriptor inside the decoder instance.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] mmap Memory map to store.
-- *
-- * \retval #VPX_CODEC_OK
-- * The memory map was accepted and stored.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * The memory map was rejected.
-- */
--typedef vpx_codec_err_t (*vpx_codec_set_mmap_fn_t)(vpx_codec_ctx_t *ctx,
-- const vpx_codec_mmap_t *mmap);
--
--
--typedef vpx_codec_err_t (*vpx_codec_encode_fn_t)(vpx_codec_alg_priv_t *ctx,
-- const vpx_image_t *img,
-- vpx_codec_pts_t pts,
-- unsigned long duration,
-- vpx_enc_frame_flags_t flags,
-- unsigned long deadline);
--typedef const vpx_codec_cx_pkt_t*(*vpx_codec_get_cx_data_fn_t)(vpx_codec_alg_priv_t *ctx,
-- vpx_codec_iter_t *iter);
--
--typedef vpx_codec_err_t
--(*vpx_codec_enc_config_set_fn_t)(vpx_codec_alg_priv_t *ctx,
-- const vpx_codec_enc_cfg_t *cfg);
--typedef vpx_fixed_buf_t *
--(*vpx_codec_get_global_headers_fn_t)(vpx_codec_alg_priv_t *ctx);
--
--typedef vpx_image_t *
--(*vpx_codec_get_preview_frame_fn_t)(vpx_codec_alg_priv_t *ctx);
--
--/*!\brief usage configuration mapping
-- *
-- * This structure stores the mapping between usage identifiers and
-- * configuration structures. Each algorithm provides a list of these
-- * mappings. This list is searched by the vpx_codec_enc_config_default()
-- * wrapper function to determine which config to return. The special value
-- * {-1, {0}} is used to indicate end-of-list, and must be present. At least
-- * one mapping must be present, in addition to the end-of-list.
-- *
-- */
--typedef const struct
--{
-- int usage;
-- vpx_codec_enc_cfg_t cfg;
--} vpx_codec_enc_cfg_map_t;
--
--#define NOT_IMPLEMENTED 0
--
--/*!\brief Decoder algorithm interface interface
-- *
-- * All decoders \ref MUST expose a variable of this type.
-- */
--struct vpx_codec_iface
--{
-- const char *name; /**< Identification String */
-- int abi_version; /**< Implemented ABI version */
-- vpx_codec_caps_t caps; /**< Decoder capabilities */
-- vpx_codec_init_fn_t init; /**< \copydoc ::vpx_codec_init_fn_t */
-- vpx_codec_destroy_fn_t destroy; /**< \copydoc ::vpx_codec_destroy_fn_t */
-- vpx_codec_ctrl_fn_map_t *ctrl_maps; /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
-- vpx_codec_get_mmap_fn_t get_mmap; /**< \copydoc ::vpx_codec_get_mmap_fn_t */
-- vpx_codec_set_mmap_fn_t set_mmap; /**< \copydoc ::vpx_codec_set_mmap_fn_t */
-- struct
-- {
-- vpx_codec_peek_si_fn_t peek_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
-- vpx_codec_get_si_fn_t get_si; /**< \copydoc ::vpx_codec_peek_si_fn_t */
-- vpx_codec_decode_fn_t decode; /**< \copydoc ::vpx_codec_decode_fn_t */
-- vpx_codec_get_frame_fn_t get_frame; /**< \copydoc ::vpx_codec_get_frame_fn_t */
-- } dec;
-- struct
-- {
-- vpx_codec_enc_cfg_map_t *cfg_maps; /**< \copydoc ::vpx_codec_enc_cfg_map_t */
-- vpx_codec_encode_fn_t encode; /**< \copydoc ::vpx_codec_encode_fn_t */
-- vpx_codec_get_cx_data_fn_t get_cx_data; /**< \copydoc ::vpx_codec_get_cx_data_fn_t */
-- vpx_codec_enc_config_set_fn_t cfg_set; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
-- vpx_codec_get_global_headers_fn_t get_glob_hdrs; /**< \copydoc ::vpx_codec_enc_config_set_fn_t */
-- vpx_codec_get_preview_frame_fn_t get_preview; /**< \copydoc ::vpx_codec_get_preview_frame_fn_t */
-- } enc;
--};
--
--/*!\brief Callback function pointer / user data pair storage */
--typedef struct
--{
-- union
-- {
-- vpx_codec_put_frame_cb_fn_t put_frame;
-- vpx_codec_put_slice_cb_fn_t put_slice;
-- };
-- void *user_priv;
--} vpx_codec_priv_cb_pair_t;
--
--
--/*!\brief Instance private storage
-- *
-- * This structure is allocated by the algorithm's init function. It can be
-- * extended in one of two ways. First, a second, algorithm specific structure
-- * can be allocated and the priv member pointed to it. Alternatively, this
-- * structure can be made the first member of the algorithm specific structure,
-- * and the pointer casted to the proper type.
-- */
--struct vpx_codec_priv
--{
-- unsigned int sz;
-- vpx_codec_iface_t *iface;
-- struct vpx_codec_alg_priv *alg_priv;
-- const char *err_detail;
-- unsigned int eval_counter;
-- vpx_codec_flags_t init_flags;
-- struct
-- {
-- vpx_codec_priv_cb_pair_t put_frame_cb;
-- vpx_codec_priv_cb_pair_t put_slice_cb;
-- } dec;
-- struct
-- {
-- int tbd;
-- struct vpx_fixed_buf cx_data_dst_buf;
-- unsigned int cx_data_pad_before;
-- unsigned int cx_data_pad_after;
-- vpx_codec_cx_pkt_t cx_data_pkt;
-- } enc;
--};
--
--#undef VPX_CTRL_USE_TYPE
--#define VPX_CTRL_USE_TYPE(id, typ) \
-- static typ id##__value(va_list args) {return va_arg(args, typ);} \
-- static typ id##__convert(void *x)\
-- {\
-- union\
-- {\
-- void *x;\
-- typ d;\
-- } u;\
-- u.x = x;\
-- return u.d;\
-- }
--
--
--#undef VPX_CTRL_USE_TYPE_DEPRECATED
--#define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
-- static typ id##__value(va_list args) {return va_arg(args, typ);} \
-- static typ id##__convert(void *x)\
-- {\
-- union\
-- {\
-- void *x;\
-- typ d;\
-- } u;\
-- u.x = x;\
-- return u.d;\
-- }
--
--#define CAST(id, arg) id##__value(arg)
--#define RECAST(id, x) id##__convert(x)
--
--
--/* Internal Utility Functions
-- *
-- * The following functions are indended to be used inside algorithms as
-- * utilities for manipulating vpx_codec_* data structures.
-- */
--struct vpx_codec_pkt_list
--{
-- unsigned int cnt;
-- unsigned int max;
-- struct vpx_codec_cx_pkt pkts[1];
--};
--
--#define vpx_codec_pkt_list_decl(n)\
-- union {struct vpx_codec_pkt_list head;\
-- struct {struct vpx_codec_pkt_list head;\
-- struct vpx_codec_cx_pkt pkts[n];} alloc;}
--
--#define vpx_codec_pkt_list_init(m)\
-- (m)->alloc.head.cnt = 0,\
-- (m)->alloc.head.max = sizeof((m)->alloc.pkts) / sizeof((m)->alloc.pkts[0])
--
--int
--vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *,
-- const struct vpx_codec_cx_pkt *);
--
--const vpx_codec_cx_pkt_t*
--vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
-- vpx_codec_iter_t *iter);
--
--
--#include <stdio.h>
--#include <setjmp.h>
--struct vpx_internal_error_info
--{
-- vpx_codec_err_t error_code;
-- int has_detail;
-- char detail[80];
-- int setjmp;
-- jmp_buf jmp;
--};
--
--static void vpx_internal_error(struct vpx_internal_error_info *info,
-- vpx_codec_err_t error,
-- const char *fmt,
-- ...)
--{
-- va_list ap;
--
-- info->error_code = error;
-- info->has_detail = 0;
--
-- if (fmt)
-- {
-- size_t sz = sizeof(info->detail);
--
-- info->has_detail = 1;
-- va_start(ap, fmt);
-- vsnprintf(info->detail, sz - 1, fmt, ap);
-- va_end(ap);
-- info->detail[sz-1] = '\0';
-- }
--
-- if (info->setjmp)
-- longjmp(info->jmp, info->error_code);
--}
--#endif
-diff --git a/vpx_codec/src/vpx_codec.c b/vpx_codec/src/vpx_codec.c
-deleted file mode 100644
-index 6366416..0000000
---- a/vpx_codec/src/vpx_codec.c
-+++ /dev/null
-@@ -1,196 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\file vpx_decoder.c
-- * \brief Provides the high level interface to wrap decoder algorithms.
-- *
-- */
--#include <stdlib.h>
--#include <string.h>
--#include "vpx_codec/internal/vpx_codec_internal.h"
--#include "vpx_version.h"
--
--#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
--
--int vpx_codec_version(void)
--{
-- return VERSION_PACKED;
--}
--
--
--const char *vpx_codec_version_str(void)
--{
-- return VERSION_STRING_NOSP;
--}
--
--
--const char *vpx_codec_version_extra_str(void)
--{
-- return VERSION_EXTRA;
--}
--
--
--const char *vpx_codec_iface_name(vpx_codec_iface_t *iface)
--{
-- return iface ? iface->name : "<invalid interface>";
--}
--
--const char *vpx_codec_err_to_string(vpx_codec_err_t err)
--{
-- switch (err)
-- {
-- case VPX_CODEC_OK:
-- return "Success";
-- case VPX_CODEC_ERROR:
-- return "Unspecified internal error";
-- case VPX_CODEC_MEM_ERROR:
-- return "Memory allocation error";
-- case VPX_CODEC_ABI_MISMATCH:
-- return "ABI version mismatch";
-- case VPX_CODEC_INCAPABLE:
-- return "Codec does not implement requested capability";
-- case VPX_CODEC_UNSUP_BITSTREAM:
-- return "Bitstream not supported by this decoder";
-- case VPX_CODEC_UNSUP_FEATURE:
-- return "Bitstream required feature not supported by this decoder";
-- case VPX_CODEC_CORRUPT_FRAME:
-- return "Corrupt frame detected";
-- case VPX_CODEC_INVALID_PARAM:
-- return "Invalid parameter";
-- case VPX_CODEC_LIST_END:
-- return "End of iterated list";
-- }
--
-- return "Unrecognized error code";
--}
--
--const char *vpx_codec_error(vpx_codec_ctx_t *ctx)
--{
-- return (ctx) ? vpx_codec_err_to_string(ctx->err)
-- : vpx_codec_err_to_string(VPX_CODEC_INVALID_PARAM);
--}
--
--const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx)
--{
-- if (ctx && ctx->err)
-- return ctx->priv ? ctx->priv->err_detail : ctx->err_detail;
--
-- return NULL;
--}
--
--
--vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
-- vpx_codec_iface_t *iface,
-- vpx_codec_dec_cfg_t *cfg,
-- vpx_codec_flags_t flags,
-- int ver)
--{
-- vpx_codec_err_t res;
--
-- if (ver != VPX_DECODER_ABI_VERSION)
-- res = VPX_CODEC_ABI_MISMATCH;
-- else if (!ctx || !iface)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
-- res = VPX_CODEC_ABI_MISMATCH;
-- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
-- res = VPX_CODEC_INCAPABLE;
-- else if ((flags & VPX_CODEC_USE_POSTPROC) && !(iface->caps & VPX_CODEC_CAP_POSTPROC))
-- res = VPX_CODEC_INCAPABLE;
-- else
-- {
-- memset(ctx, 0, sizeof(*ctx));
-- ctx->iface = iface;
-- ctx->name = iface->name;
-- ctx->priv = NULL;
-- ctx->init_flags = flags;
-- ctx->config.dec = cfg;
-- res = VPX_CODEC_OK;
--
-- if (!(flags & VPX_CODEC_USE_XMA))
-- {
-- res = ctx->iface->init(ctx);
--
-- if (res)
-- {
-- ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
-- vpx_codec_destroy(ctx);
-- }
--
-- if (ctx->priv)
-- ctx->priv->iface = ctx->iface;
-- }
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv)
-- res = VPX_CODEC_ERROR;
-- else
-- {
-- if (ctx->priv->alg_priv)
-- ctx->iface->destroy(ctx->priv->alg_priv);
--
-- ctx->iface = NULL;
-- ctx->name = NULL;
-- ctx->priv = NULL;
-- res = VPX_CODEC_OK;
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface)
--{
-- return (iface) ? iface->caps : 0;
--}
--
--
--vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
-- int ctrl_id,
-- ...)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || !ctrl_id)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv || !ctx->iface->ctrl_maps)
-- res = VPX_CODEC_ERROR;
-- else
-- {
-- vpx_codec_ctrl_fn_map_t *entry;
--
-- res = VPX_CODEC_ERROR;
--
-- for (entry = ctx->iface->ctrl_maps; entry && entry->fn; entry++)
-- {
-- if (!entry->ctrl_id || entry->ctrl_id == ctrl_id)
-- {
-- va_list ap;
--
-- va_start(ap, ctrl_id);
-- res = entry->fn(ctx->priv->alg_priv, ctrl_id, ap);
-- va_end(ap);
-- break;
-- }
-- }
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
-diff --git a/vpx_codec/src/vpx_decoder.c b/vpx_codec/src/vpx_decoder.c
-deleted file mode 100644
-index 7e8575f..0000000
---- a/vpx_codec/src/vpx_decoder.c
-+++ /dev/null
-@@ -1,201 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\file vpx_decoder.c
-- * \brief Provides the high level interface to wrap decoder algorithms.
-- *
-- */
--#include <stdlib.h>
--#include "vpx_codec/internal/vpx_codec_internal.h"
--
--#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
--
--vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
-- const uint8_t *data,
-- unsigned int data_sz,
-- vpx_codec_stream_info_t *si)
--{
-- vpx_codec_err_t res;
--
-- if (!iface || !data || !data_sz || !si
-- || si->sz < sizeof(vpx_codec_stream_info_t))
-- res = VPX_CODEC_INVALID_PARAM;
-- else
-- {
-- /* Set default/unknown values */
-- si->w = 0;
-- si->h = 0;
--
-- res = iface->dec.peek_si(data, data_sz, si);
-- }
--
-- return res;
--}
--
--
--vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
-- vpx_codec_stream_info_t *si)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || !si || si->sz < sizeof(vpx_codec_stream_info_t))
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv)
-- res = VPX_CODEC_ERROR;
-- else
-- {
-- /* Set default/unknown values */
-- si->w = 0;
-- si->h = 0;
--
-- res = ctx->iface->dec.get_si(ctx->priv->alg_priv, si);
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
-- const uint8_t *data,
-- unsigned int data_sz,
-- void *user_priv,
-- long deadline)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || !data || !data_sz)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv)
-- res = VPX_CODEC_ERROR;
--
--#if CONFIG_EVAL_LIMIT
-- else if (ctx->priv->eval_counter >= 500)
-- {
-- ctx->priv->err_detail = "Evaluation limit exceeded.";
-- res = VPX_CODEC_ERROR;
-- }
--
--#endif
-- else
-- {
-- res = ctx->iface->dec.decode(ctx->priv->alg_priv, data, data_sz,
-- user_priv, deadline);
--#if CONFIG_EVAL_LIMIT
-- ctx->priv->eval_counter++;
--#endif
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
-- vpx_codec_iter_t *iter)
--{
-- vpx_image_t *img;
--
-- if (!ctx || !iter || !ctx->iface || !ctx->priv)
-- img = NULL;
-- else
-- img = ctx->iface->dec.get_frame(ctx->priv->alg_priv, iter);
--
-- return img;
--}
--
--
--vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
-- vpx_codec_put_frame_cb_fn_t cb,
-- void *user_priv)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || !cb)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv
-- || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
-- res = VPX_CODEC_ERROR;
-- else
-- {
-- ctx->priv->dec.put_frame_cb.put_frame = cb;
-- ctx->priv->dec.put_frame_cb.user_priv = user_priv;
-- res = VPX_CODEC_OK;
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
-- vpx_codec_put_slice_cb_fn_t cb,
-- void *user_priv)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || !cb)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv
-- || !(ctx->iface->caps & VPX_CODEC_CAP_PUT_FRAME))
-- res = VPX_CODEC_ERROR;
-- else
-- {
-- ctx->priv->dec.put_slice_cb.put_slice = cb;
-- ctx->priv->dec.put_slice_cb.user_priv = user_priv;
-- res = VPX_CODEC_OK;
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
-- vpx_codec_mmap_t *mmap,
-- vpx_codec_iter_t *iter)
--{
-- vpx_codec_err_t res = VPX_CODEC_OK;
--
-- if (!ctx || !mmap || !iter || !ctx->iface)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
-- res = VPX_CODEC_ERROR;
-- else
-- res = ctx->iface->get_mmap(ctx, mmap, iter);
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
-- vpx_codec_mmap_t *mmap,
-- unsigned int num_maps)
--{
-- vpx_codec_err_t res = VPX_CODEC_MEM_ERROR;
--
-- if (!ctx || !mmap || !ctx->iface)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_XMA))
-- res = VPX_CODEC_ERROR;
-- else
-- {
-- unsigned int i;
--
-- for (i = 0; i < num_maps; i++, mmap++)
-- {
-- if (!mmap->base)
-- break;
--
-- /* Everything look ok, set the mmap in the decoder */
-- res = ctx->iface->set_mmap(ctx, mmap);
--
-- if (res)
-- break;
-- }
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
-diff --git a/vpx_codec/src/vpx_decoder_compat.c b/vpx_codec/src/vpx_decoder_compat.c
-deleted file mode 100644
-index d5b04ae..0000000
---- a/vpx_codec/src/vpx_decoder_compat.c
-+++ /dev/null
-@@ -1,200 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\file vpx_decoder.c
-- * \brief Provides the high level interface to wrap decoder algorithms.
-- *
-- */
--#include <stdlib.h>
--#include <string.h>
--#include "vpx_codec/vpx_decoder.h"
--#include "vpx_codec/internal/vpx_codec_internal.h"
--
--#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
--
--const char *vpx_dec_iface_name(vpx_dec_iface_t *iface)
--{
-- return vpx_codec_iface_name((vpx_codec_iface_t *)iface);
--}
--
--const char *vpx_dec_err_to_string(vpx_dec_err_t err)
--{
-- return vpx_codec_err_to_string(err);
--}
--
--const char *vpx_dec_error(vpx_dec_ctx_t *ctx)
--{
-- return vpx_codec_error((vpx_codec_ctx_t *)ctx);
--}
--
--const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx)
--{
-- return vpx_codec_error_detail((vpx_codec_ctx_t *)ctx);
--}
--
--
--vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
-- vpx_dec_iface_t *iface,
-- int ver)
--{
-- return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
-- (vpx_codec_iface_t *)iface,
-- NULL,
-- 0,
-- ver);
--}
--
--
--vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx)
--{
-- return vpx_codec_destroy((vpx_codec_ctx_t *)ctx);
--}
--
--
--vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface)
--{
-- return vpx_codec_get_caps((vpx_codec_iface_t *)iface);
--}
--
--
--vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
-- const uint8_t *data,
-- unsigned int data_sz,
-- vpx_dec_stream_info_t *si)
--{
-- return vpx_codec_peek_stream_info((vpx_codec_iface_t *)iface, data, data_sz,
-- (vpx_codec_stream_info_t *)si);
--}
--
--
--vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
-- vpx_dec_stream_info_t *si)
--{
-- return vpx_codec_get_stream_info((vpx_codec_ctx_t *)ctx,
-- (vpx_codec_stream_info_t *)si);
--}
--
--
--vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
-- int ctrl_id,
-- void *data)
--{
-- return vpx_codec_control_((vpx_codec_ctx_t *)ctx, ctrl_id, data);
--}
--
--
--vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
-- uint8_t *data,
-- unsigned int data_sz,
-- void *user_priv,
-- int rel_pts)
--{
-- (void)rel_pts;
-- return vpx_codec_decode((vpx_codec_ctx_t *)ctx, data, data_sz, user_priv,
-- 0);
--}
--
--vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
-- vpx_dec_iter_t *iter)
--{
-- return vpx_codec_get_frame((vpx_codec_ctx_t *)ctx, iter);
--}
--
--
--vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
-- vpx_dec_put_frame_cb_fn_t cb,
-- void *user_priv)
--{
-- return vpx_codec_register_put_frame_cb((vpx_codec_ctx_t *)ctx, cb,
-- user_priv);
--}
--
--
--vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
-- vpx_dec_put_slice_cb_fn_t cb,
-- void *user_priv)
--{
-- return vpx_codec_register_put_slice_cb((vpx_codec_ctx_t *)ctx, cb,
-- user_priv);
--}
--
--
--vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
-- vpx_dec_iface_t *iface,
-- int ver)
--{
-- return vpx_codec_dec_init_ver((vpx_codec_ctx_t *)ctx,
-- (vpx_codec_iface_t *)iface,
-- NULL,
-- VPX_CODEC_USE_XMA,
-- ver);
--}
--
--vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx_,
-- vpx_dec_mmap_t *mmap,
-- const vpx_dec_stream_info_t *si,
-- vpx_dec_iter_t *iter)
--{
-- vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
-- vpx_dec_err_t res = VPX_DEC_OK;
--
-- if (!ctx || !mmap || !si || !iter || !ctx->iface)
-- res = VPX_DEC_INVALID_PARAM;
-- else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
-- res = VPX_DEC_ERROR;
-- else
-- {
-- if (!ctx->config.dec)
-- {
-- ctx->config.dec = malloc(sizeof(vpx_codec_dec_cfg_t));
-- ctx->config.dec->w = si->w;
-- ctx->config.dec->h = si->h;
-- }
--
-- res = ctx->iface->get_mmap(ctx, mmap, iter);
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx_,
-- vpx_dec_mmap_t *mmap,
-- unsigned int num_maps)
--{
-- vpx_codec_ctx_t *ctx = (vpx_codec_ctx_t *)ctx_;
-- vpx_dec_err_t res = VPX_DEC_MEM_ERROR;
--
-- if (!ctx || !mmap || !ctx->iface)
-- res = VPX_DEC_INVALID_PARAM;
-- else if (!(ctx->iface->caps & VPX_DEC_CAP_XMA))
-- res = VPX_DEC_ERROR;
-- else
-- {
-- void *save = (ctx->priv) ? NULL : ctx->config.dec;
-- unsigned int i;
--
-- for (i = 0; i < num_maps; i++, mmap++)
-- {
-- if (!mmap->base)
-- break;
--
-- /* Everything look ok, set the mmap in the decoder */
-- res = ctx->iface->set_mmap(ctx, mmap);
--
-- if (res)
-- break;
-- }
--
-- if (save) free(save);
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
-diff --git a/vpx_codec/src/vpx_encoder.c b/vpx_codec/src/vpx_encoder.c
-deleted file mode 100644
-index 98ad8ba..0000000
---- a/vpx_codec/src/vpx_encoder.c
-+++ /dev/null
-@@ -1,324 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\file vpx_encoder.c
-- * \brief Provides the high level interface to wrap encoder algorithms.
-- *
-- */
--#include <limits.h>
--#include <string.h>
--#include "vpx_codec/internal/vpx_codec_internal.h"
--
--#define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
--
--vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
-- vpx_codec_iface_t *iface,
-- vpx_codec_enc_cfg_t *cfg,
-- vpx_codec_flags_t flags,
-- int ver)
--{
-- vpx_codec_err_t res;
--
-- if (ver != VPX_ENCODER_ABI_VERSION)
-- res = VPX_CODEC_ABI_MISMATCH;
-- else if (!ctx || !iface || !cfg)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (iface->abi_version != VPX_CODEC_INTERNAL_ABI_VERSION)
-- res = VPX_CODEC_ABI_MISMATCH;
-- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
-- res = VPX_CODEC_INCAPABLE;
-- else if ((flags & VPX_CODEC_USE_XMA) && !(iface->caps & VPX_CODEC_CAP_XMA))
-- res = VPX_CODEC_INCAPABLE;
-- else if ((flags & VPX_CODEC_USE_PSNR)
-- && !(iface->caps & VPX_CODEC_CAP_PSNR))
-- res = VPX_CODEC_INCAPABLE;
-- else
-- {
-- ctx->iface = iface;
-- ctx->name = iface->name;
-- ctx->priv = NULL;
-- ctx->init_flags = flags;
-- ctx->config.enc = cfg;
-- res = ctx->iface->init(ctx);
--
-- if (res)
-- {
-- ctx->err_detail = ctx->priv ? ctx->priv->err_detail : NULL;
-- vpx_codec_destroy(ctx);
-- }
--
-- if (ctx->priv)
-- ctx->priv->iface = ctx->iface;
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--
--vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
-- vpx_codec_enc_cfg_t *cfg,
-- unsigned int usage)
--{
-- vpx_codec_err_t res;
-- vpx_codec_enc_cfg_map_t *map;
--
-- if (!iface || !cfg || usage > INT_MAX)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!(iface->caps & VPX_CODEC_CAP_ENCODER))
-- res = VPX_CODEC_INCAPABLE;
-- else
-- {
-- res = VPX_CODEC_INVALID_PARAM;
--
-- for (map = iface->enc.cfg_maps; map->usage >= 0; map++)
-- {
-- if (map->usage == (int)usage)
-- {
-- *cfg = map->cfg;
-- cfg->g_usage = usage;
-- res = VPX_CODEC_OK;
-- break;
-- }
-- }
-- }
--
-- return res;
--}
--
--
--#if ARCH_X86 || ARCH_X86_64
--/* On X86, disable the x87 unit's internal 80 bit precision for better
-- * consistency with the SSE unit's 64 bit precision.
-- */
--#include "vpx_ports/x86.h"
--#define FLOATING_POINT_INIT() do {\
-- unsigned short x87_orig_mode = x87_set_double_precision();
--#define FLOATING_POINT_RESTORE() \
-- x87_set_control_word(x87_orig_mode); }while(0)
--
--
--#else
--static void FLOATING_POINT_INIT() {}
--static void FLOATING_POINT_RESTORE() {}
--#endif
--
--
--vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
-- const vpx_image_t *img,
-- vpx_codec_pts_t pts,
-- unsigned long duration,
-- vpx_enc_frame_flags_t flags,
-- unsigned long deadline)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || (img && !duration))
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv)
-- res = VPX_CODEC_ERROR;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-- res = VPX_CODEC_INCAPABLE;
--
--#if CONFIG_EVAL_LIMIT
-- else if (ctx->priv->eval_counter >= 500)
-- {
-- ctx->priv->err_detail = "Evaluation limit exceeded.";
-- res = VPX_CODEC_ERROR;
-- }
--
--#endif
-- else
-- {
-- /* Execute in a normalized floating point environment, if the platform
-- * requires it.
-- */
-- FLOATING_POINT_INIT();
-- res = ctx->iface->enc.encode(ctx->priv->alg_priv, img, pts,
-- duration, flags, deadline);
-- FLOATING_POINT_RESTORE();
--
--#if CONFIG_EVAL_LIMIT
-- ctx->priv->eval_counter++;
--#endif
-- }
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
-- vpx_codec_iter_t *iter)
--{
-- const vpx_codec_cx_pkt_t *pkt = NULL;
--
-- if (ctx)
-- {
-- if (!iter)
-- ctx->err = VPX_CODEC_INVALID_PARAM;
-- else if (!ctx->iface || !ctx->priv)
-- ctx->err = VPX_CODEC_ERROR;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-- ctx->err = VPX_CODEC_INCAPABLE;
-- else
-- pkt = ctx->iface->enc.get_cx_data(ctx->priv->alg_priv, iter);
-- }
--
-- if (pkt && pkt->kind == VPX_CODEC_CX_FRAME_PKT)
-- {
-- /* If the application has specified a destination area for the
-- * compressed data, and the codec has not placed the data there,
-- * and it fits, copy it.
-- */
-- char *dst_buf = ctx->priv->enc.cx_data_dst_buf.buf;
--
-- if (dst_buf
-- && pkt->data.raw.buf != dst_buf
-- && pkt->data.raw.sz
-- + ctx->priv->enc.cx_data_pad_before
-- + ctx->priv->enc.cx_data_pad_after
-- <= ctx->priv->enc.cx_data_dst_buf.sz)
-- {
-- vpx_codec_cx_pkt_t *modified_pkt = &ctx->priv->enc.cx_data_pkt;
--
-- memcpy(dst_buf + ctx->priv->enc.cx_data_pad_before,
-- pkt->data.raw.buf, pkt->data.raw.sz);
-- *modified_pkt = *pkt;
-- modified_pkt->data.raw.buf = dst_buf;
-- modified_pkt->data.raw.sz += ctx->priv->enc.cx_data_pad_before
-- + ctx->priv->enc.cx_data_pad_after;
-- pkt = modified_pkt;
-- }
--
-- if (dst_buf == pkt->data.raw.buf)
-- {
-- ctx->priv->enc.cx_data_dst_buf.buf = dst_buf + pkt->data.raw.sz;
-- ctx->priv->enc.cx_data_dst_buf.sz -= pkt->data.raw.sz;
-- }
-- }
--
-- return pkt;
--}
--
--
--vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
-- const vpx_fixed_buf_t *buf,
-- unsigned int pad_before,
-- unsigned int pad_after)
--{
-- if (!ctx || !ctx->priv)
-- return VPX_CODEC_INVALID_PARAM;
--
-- if (buf)
-- {
-- ctx->priv->enc.cx_data_dst_buf = *buf;
-- ctx->priv->enc.cx_data_pad_before = pad_before;
-- ctx->priv->enc.cx_data_pad_after = pad_after;
-- }
-- else
-- {
-- ctx->priv->enc.cx_data_dst_buf.buf = NULL;
-- ctx->priv->enc.cx_data_dst_buf.sz = 0;
-- ctx->priv->enc.cx_data_pad_before = 0;
-- ctx->priv->enc.cx_data_pad_after = 0;
-- }
--
-- return VPX_CODEC_OK;
--}
--
--
--const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx)
--{
-- vpx_image_t *img = NULL;
--
-- if (ctx)
-- {
-- if (!ctx->iface || !ctx->priv)
-- ctx->err = VPX_CODEC_ERROR;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-- ctx->err = VPX_CODEC_INCAPABLE;
-- else if (!ctx->iface->enc.get_preview)
-- ctx->err = VPX_CODEC_INCAPABLE;
-- else
-- img = ctx->iface->enc.get_preview(ctx->priv->alg_priv);
-- }
--
-- return img;
--}
--
--
--vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx)
--{
-- vpx_fixed_buf_t *buf = NULL;
--
-- if (ctx)
-- {
-- if (!ctx->iface || !ctx->priv)
-- ctx->err = VPX_CODEC_ERROR;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-- ctx->err = VPX_CODEC_INCAPABLE;
-- else if (!ctx->iface->enc.get_glob_hdrs)
-- ctx->err = VPX_CODEC_INCAPABLE;
-- else
-- buf = ctx->iface->enc.get_glob_hdrs(ctx->priv->alg_priv);
-- }
--
-- return buf;
--}
--
--
--vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
-- const vpx_codec_enc_cfg_t *cfg)
--{
-- vpx_codec_err_t res;
--
-- if (!ctx || !ctx->iface || !ctx->priv || !cfg)
-- res = VPX_CODEC_INVALID_PARAM;
-- else if (!(ctx->iface->caps & VPX_CODEC_CAP_ENCODER))
-- res = VPX_CODEC_INCAPABLE;
-- else
-- res = ctx->iface->enc.cfg_set(ctx->priv->alg_priv, cfg);
--
-- return SAVE_STATUS(ctx, res);
--}
--
--
--int vpx_codec_pkt_list_add(struct vpx_codec_pkt_list *list,
-- const struct vpx_codec_cx_pkt *pkt)
--{
-- if (list->cnt < list->max)
-- {
-- list->pkts[list->cnt++] = *pkt;
-- return 0;
-- }
--
-- return 1;
--}
--
--
--const vpx_codec_cx_pkt_t *vpx_codec_pkt_list_get(struct vpx_codec_pkt_list *list,
-- vpx_codec_iter_t *iter)
--{
-- const vpx_codec_cx_pkt_t *pkt;
--
-- if (!(*iter))
-- {
-- *iter = list->pkts;
-- }
--
-- pkt = (const void *) * iter;
--
-- if (pkt - list->pkts < list->cnt)
-- *iter = pkt + 1;
-- else
-- pkt = NULL;
--
-- return pkt;
--}
-diff --git a/vpx_codec/src/vpx_image.c b/vpx_codec/src/vpx_image.c
-deleted file mode 100644
-index 8a16e58..0000000
---- a/vpx_codec/src/vpx_image.c
-+++ /dev/null
-@@ -1,261 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--#include <stdlib.h>
--#include <string.h>
--#include "vpx_codec/vpx_image.h"
--
--static vpx_image_t *img_alloc_helper(vpx_image_t *img,
-- img_fmt_t fmt,
-- unsigned int d_w,
-- unsigned int d_h,
-- unsigned int stride_align,
-- unsigned char *img_data)
--{
--
-- unsigned int h, w, s, xcs, ycs, bps;
-- int align;
--
-- /* Treat align==0 like align==1 */
-- if (!stride_align)
-- stride_align = 1;
--
-- /* Validate alignment (must be power of 2) */
-- if (stride_align & (stride_align - 1))
-- goto fail;
--
-- /* Get sample size for this format */
-- switch (fmt)
-- {
-- case IMG_FMT_RGB32:
-- case IMG_FMT_RGB32_LE:
-- case IMG_FMT_ARGB:
-- case IMG_FMT_ARGB_LE:
-- bps = 32;
-- break;
-- case IMG_FMT_RGB24:
-- case IMG_FMT_BGR24:
-- bps = 24;
-- break;
-- case IMG_FMT_RGB565:
-- case IMG_FMT_RGB565_LE:
-- case IMG_FMT_RGB555:
-- case IMG_FMT_RGB555_LE:
-- case IMG_FMT_UYVY:
-- case IMG_FMT_YUY2:
-- case IMG_FMT_YVYU:
-- bps = 16;
-- break;
-- case IMG_FMT_I420:
-- case IMG_FMT_YV12:
-- case IMG_FMT_VPXI420:
-- case IMG_FMT_VPXYV12:
-- bps = 12;
-- break;
-- default:
-- bps = 16;
-- break;
-- }
--
-- /* Get chroma shift values for this format */
-- switch (fmt)
-- {
-- case IMG_FMT_I420:
-- case IMG_FMT_YV12:
-- case IMG_FMT_VPXI420:
-- case IMG_FMT_VPXYV12:
-- xcs = 1;
-- break;
-- default:
-- xcs = 0;
-- break;
-- }
--
-- switch (fmt)
-- {
-- case IMG_FMT_I420:
-- case IMG_FMT_YV12:
-- case IMG_FMT_VPXI420:
-- case IMG_FMT_VPXYV12:
-- ycs = 1;
-- break;
-- default:
-- ycs = 0;
-- break;
-- }
--
-- /* Calculate storage sizes given the chroma subsampling */
-- align = (1 << xcs) - 1;
-- w = (d_w + align) & ~align;
-- align = (1 << ycs) - 1;
-- h = (d_h + align) & ~align;
-- s = (fmt & IMG_FMT_PLANAR) ? w : bps * w / 8;
-- s = (s + stride_align - 1) & ~(stride_align - 1);
--
-- /* Allocate the new image */
-- if (!img)
-- {
-- img = (vpx_image_t *)calloc(1, sizeof(vpx_image_t));
--
-- if (!img)
-- goto fail;
--
-- img->self_allocd = 1;
-- }
-- else
-- {
-- memset(img, 0, sizeof(vpx_image_t));
-- }
--
-- img->img_data = img_data;
--
-- if (!img_data)
-- {
-- img->img_data = malloc((fmt & IMG_FMT_PLANAR) ? h * w * bps / 8 : h * s);
-- img->img_data_owner = 1;
-- }
--
-- if (!img->img_data)
-- goto fail;
--
-- img->fmt = fmt;
-- img->w = w;
-- img->h = h;
-- img->x_chroma_shift = xcs;
-- img->y_chroma_shift = ycs;
-- img->bps = bps;
--
-- /* Calculate strides */
-- img->stride[PLANE_Y] = img->stride[PLANE_ALPHA] = s;
-- img->stride[PLANE_U] = img->stride[PLANE_V] = s >> xcs;
--
-- /* Default viewport to entire image */
-- if (!vpx_img_set_rect(img, 0, 0, d_w, d_h))
-- return img;
--
--fail:
-- vpx_img_free(img);
-- return NULL;
--}
--
--vpx_image_t *vpx_img_alloc(vpx_image_t *img,
-- img_fmt_t fmt,
-- unsigned int d_w,
-- unsigned int d_h,
-- unsigned int stride_align)
--{
-- return img_alloc_helper(img, fmt, d_w, d_h, stride_align, NULL);
--}
--
--vpx_image_t *vpx_img_wrap(vpx_image_t *img,
-- img_fmt_t fmt,
-- unsigned int d_w,
-- unsigned int d_h,
-- unsigned int stride_align,
-- unsigned char *img_data)
--{
-- return img_alloc_helper(img, fmt, d_w, d_h, stride_align, img_data);
--}
--
--int vpx_img_set_rect(vpx_image_t *img,
-- unsigned int x,
-- unsigned int y,
-- unsigned int w,
-- unsigned int h)
--{
-- unsigned char *data;
--
-- if (x + w <= img->w && y + h <= img->h)
-- {
-- img->d_w = w;
-- img->d_h = h;
--
-- /* Calculate plane pointers */
-- if (!(img->fmt & IMG_FMT_PLANAR))
-- {
-- img->planes[PLANE_PACKED] =
-- img->img_data + x * img->bps / 8 + y * img->stride[PLANE_PACKED];
-- }
-- else
-- {
-- data = img->img_data;
--
-- if (img->fmt & IMG_FMT_HAS_ALPHA)
-- {
-- img->planes[PLANE_ALPHA] =
-- data + x + y * img->stride[PLANE_ALPHA];
-- data += img->h * img->stride[PLANE_ALPHA];
-- }
--
-- img->planes[PLANE_Y] = data + x + y * img->stride[PLANE_Y];
-- data += img->h * img->stride[PLANE_Y];
--
-- if (!(img->fmt & IMG_FMT_UV_FLIP))
-- {
-- img->planes[PLANE_U] = data
-- + (x >> img->x_chroma_shift)
-- + (y >> img->y_chroma_shift) * img->stride[PLANE_U];
-- data += (img->h >> img->y_chroma_shift) * img->stride[PLANE_U];
-- img->planes[PLANE_V] = data
-- + (x >> img->x_chroma_shift)
-- + (y >> img->y_chroma_shift) * img->stride[PLANE_V];
-- }
-- else
-- {
-- img->planes[PLANE_V] = data
-- + (x >> img->x_chroma_shift)
-- + (y >> img->y_chroma_shift) * img->stride[PLANE_V];
-- data += (img->h >> img->y_chroma_shift) * img->stride[PLANE_V];
-- img->planes[PLANE_U] = data
-- + (x >> img->x_chroma_shift)
-- + (y >> img->y_chroma_shift) * img->stride[PLANE_U];
-- }
-- }
--
-- return 0;
-- }
--
-- return -1;
--}
--
--void vpx_img_flip(vpx_image_t *img)
--{
-- /* Note: In the calculation pointer adjustment calculation, we want the
-- * rhs to be promoted to a signed type. Section 6.3.1.8 of the ISO C99
-- * standard indicates that if the adjustment parameter is unsigned, the
-- * stride parameter will be promoted to unsigned, causing errors when
-- * the lhs is a larger type than the rhs.
-- */
-- img->planes[PLANE_Y] += (signed)(img->d_h - 1) * img->stride[PLANE_Y];
-- img->stride[PLANE_Y] = -img->stride[PLANE_Y];
--
-- img->planes[PLANE_U] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
-- * img->stride[PLANE_U];
-- img->stride[PLANE_U] = -img->stride[PLANE_U];
--
-- img->planes[PLANE_V] += (signed)((img->d_h >> img->y_chroma_shift) - 1)
-- * img->stride[PLANE_V];
-- img->stride[PLANE_V] = -img->stride[PLANE_V];
--
-- img->planes[PLANE_ALPHA] += (signed)(img->d_h - 1) * img->stride[PLANE_ALPHA];
-- img->stride[PLANE_ALPHA] = -img->stride[PLANE_ALPHA];
--}
--
--void vpx_img_free(vpx_image_t *img)
--{
-- if (img)
-- {
-- if (img->img_data && img->img_data_owner)
-- free(img->img_data);
--
-- if (img->self_allocd)
-- free(img);
-- }
--}
-diff --git a/vpx_codec/vpx_codec.h b/vpx_codec/vpx_codec.h
-deleted file mode 100644
-index e2a79f9..0000000
---- a/vpx_codec/vpx_codec.h
-+++ /dev/null
-@@ -1,560 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\defgroup codec Common Algorithm Interface
-- * This abstraction allows applications to easily support multiple video
-- * formats with minimal code duplication. This section describes the interface
-- * common to all codecs (both encoders and decoders).
-- * @{
-- */
--
--/*!\file vpx_codec.h
-- * \brief Describes the codec algorithm interface to applications.
-- *
-- * This file describes the interface between an application and a
-- * video codec algorithm.
-- *
-- * An application instantiates a specific codec instance by using
-- * vpx_codec_init() and a pointer to the algorithm's interface structure:
-- * <pre>
-- * my_app.c:
-- * extern vpx_codec_iface_t my_codec;
-- * {
-- * vpx_codec_ctx_t algo;
-- * res = vpx_codec_init(&algo, &my_codec);
-- * }
-- * </pre>
-- *
-- * Once initialized, the instance is manged using other functions from
-- * the vpx_codec_* family.
-- */
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifndef VPX_CODEC_H
--#define VPX_CODEC_H
--#ifdef HAVE_CONFIG_H
--# include "vpx_config.h"
--#endif
--#if defined(HAVE_VPX_PORTS) && HAVE_VPX_PORTS
--# include "vpx_ports/vpx_integer.h"
--#else
--# include "vpx_integer.h"
--#endif
--#include "vpx_image.h"
--
-- /*!\brief Decorator indicating a function is deprecated */
--#ifndef DEPRECATED
--#if defined(__GNUC__) && __GNUC__
--#define DEPRECATED __attribute__ ((deprecated))
--#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
--#elif defined(_MSC_VER)
--#define DEPRECATED
--#define DECLSPEC_DEPRECATED __declspec(deprecated) /**< \copydoc #DEPRECATED */
--#else
--#define DEPRECATED
--#define DECLSPEC_DEPRECATED /**< \copydoc #DEPRECATED */
--#endif
--#endif
--
-- /*!\brief Decorator indicating a function is potentially unused */
--#ifdef UNUSED
--#elif __GNUC__
--#define UNUSED __attribute__ ((unused));
--#else
--#define UNUSED
--#endif
--
-- /*!\brief Current ABI version number
-- *
-- * \internal
-- * If this file is altered in any way that changes the ABI, this value
-- * must be bumped. Examples include, but are not limited to, changing
-- * types, removing or reassigning enums, adding/removing/rearranging
-- * fields to structures
-- */
--#define VPX_CODEC_ABI_VERSION (2 + VPX_IMAGE_ABI_VERSION) /**<\hideinitializer*/
--
-- /*!\brief Algorithm return codes */
-- typedef enum {
-- /*!\brief Operation completed without error */
-- VPX_CODEC_OK,
--
-- /*!\brief Unspecified error */
-- VPX_CODEC_ERROR,
--
-- /*!\brief Memory operation failed */
-- VPX_CODEC_MEM_ERROR,
--
-- /*!\brief ABI version mismatch */
-- VPX_CODEC_ABI_MISMATCH,
--
-- /*!\brief Algorithm does not have required capability */
-- VPX_CODEC_INCAPABLE,
--
-- /*!\brief The given bitstream is not supported.
-- *
-- * The bitstream was unable to be parsed at the highest level. The decoder
-- * is unable to proceed. This error \ref SHOULD be treated as fatal to the
-- * stream. */
-- VPX_CODEC_UNSUP_BITSTREAM,
--
-- /*!\brief Encoded bitstream uses an unsupported feature
-- *
-- * The decoder does not implement a feature required by the encoder. This
-- * return code should only be used for features that prevent future
-- * pictures from being properly decoded. This error \ref MAY be treated as
-- * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
-- */
-- VPX_CODEC_UNSUP_FEATURE,
--
-- /*!\brief The coded data for this stream is corrupt or incomplete
-- *
-- * There was a problem decoding the current frame. This return code
-- * should only be used for failures that prevent future pictures from
-- * being properly decoded. This error \ref MAY be treated as fatal to the
-- * stream or \ref MAY be treated as fatal to the current GOP. If decoding
-- * is continued for the current GOP, artifacts may be present.
-- */
-- VPX_CODEC_CORRUPT_FRAME,
--
-- /*!\brief An application-supplied parameter is not valid.
-- *
-- */
-- VPX_CODEC_INVALID_PARAM,
--
-- /*!\brief An iterator reached the end of list.
-- *
-- */
-- VPX_CODEC_LIST_END,
--
-- }
-- vpx_codec_err_t;
--
--
-- /*! \brief Codec capabilities bitfield
-- *
-- * Each codec advertises the capabilities it supports as part of its
-- * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
-- * or functionality, and are not required to be supported.
-- *
-- * The available flags are specified by VPX_CODEC_CAP_* defines.
-- */
-- typedef long vpx_codec_caps_t;
--#define VPX_CODEC_CAP_DECODER 0x1 /**< Is a decoder */
--#define VPX_CODEC_CAP_ENCODER 0x2 /**< Is an encoder */
--#define VPX_CODEC_CAP_XMA 0x4 /**< Supports e_xternal Memory Allocation */
--
--
-- /*! \brief Initialization-time Feature Enabling
-- *
-- * Certain codec features must be known at initialization time, to allow for
-- * proper memory allocation.
-- *
-- * The available flags are specified by VPX_CODEC_USE_* defines.
-- */
-- typedef long vpx_codec_flags_t;
--#define VPX_CODEC_USE_XMA 0x00000001 /**< Use e_xternal Memory Allocation mode */
--
--
-- /*!\brief Codec interface structure.
-- *
-- * Contains function pointers and other data private to the codec
-- * implementation. This structure is opaque to the application.
-- */
-- typedef const struct vpx_codec_iface vpx_codec_iface_t;
--
--
-- /*!\brief Codec private data structure.
-- *
-- * Contains data private to the codec implementation. This structure is opaque
-- * to the application.
-- */
-- typedef struct vpx_codec_priv vpx_codec_priv_t;
--
--
-- /*!\brief Iterator
-- *
-- * Opaque storage used for iterating over lists.
-- */
-- typedef const void *vpx_codec_iter_t;
--
--
-- /*!\brief Codec context structure
-- *
-- * All codecs \ref MUST support this context structure fully. In general,
-- * this data should be considered private to the codec algorithm, and
-- * not be manipulated or examined by the calling application. Applications
-- * may reference the 'name' member to get a printable description of the
-- * algorithm.
-- */
-- typedef struct
-- {
-- const char *name; /**< Printable interface name */
-- vpx_codec_iface_t *iface; /**< Interface pointers */
-- vpx_codec_err_t err; /**< Last returned error */
-- const char *err_detail; /**< Detailed info, if available */
-- vpx_codec_flags_t init_flags; /**< Flags passed at init time */
-- union
-- {
-- struct vpx_codec_dec_cfg *dec; /**< Decoder Configuration Pointer */
-- struct vpx_codec_enc_cfg *enc; /**< Encoder Configuration Pointer */
-- void *raw;
-- } config; /**< Configuration pointer aliasing union */
-- vpx_codec_priv_t *priv; /**< Algorithm private storage */
-- } vpx_codec_ctx_t;
--
--
-- /*
-- * Library Version Number Interface
-- *
-- * For example, see the following sample return values:
-- * vpx_codec_version() (1<<16 | 2<<8 | 3)
-- * vpx_codec_version_str() "v1.2.3-rc1-16-gec6a1ba"
-- * vpx_codec_version_extra_str() "rc1-16-gec6a1ba"
-- */
--
-- /*!\brief Return the version information (as an integer)
-- *
-- * Returns a packed encoding of the library version number. This will only include
-- * the major.minor.patch component of the version number. Note that this encoded
-- * value should be accessed through the macros provided, as the encoding may change
-- * in the future.
-- *
-- */
-- int vpx_codec_version(void);
--#define VPX_VERSION_MAJOR(v) ((v>>16)&0xff) /**< extract major from packed version */
--#define VPX_VERSION_MINOR(v) ((v>>8)&0xff) /**< extract minor from packed version */
--#define VPX_VERSION_PATCH(v) ((v>>0)&0xff) /**< extract patch from packed version */
--
-- /*!\brief Return the version major number */
--#define vpx_codec_version_major() ((vpx_codec_version()>>16)&0xff)
--
-- /*!\brief Return the version minr number */
--#define vpx_codec_version_minor() ((vpx_codec_version()>>8)&0xff)
--
-- /*!\brief Return the version patch number */
--#define vpx_codec_version_patch() ((vpx_codec_version()>>0)&0xff)
--
--
-- /*!\brief Return the version information (as a string)
-- *
-- * Returns a printable string containing the full library version number. This may
-- * contain additional text following the three digit version number, as to indicate
-- * release candidates, prerelease versions, etc.
-- *
-- */
-- const char *vpx_codec_version_str(void);
--
--
-- /*!\brief Return the version information (as a string)
-- *
-- * Returns a printable "extra string". This is the component of the string returned
-- * by vpx_codec_version_str() following the three digit version number.
-- *
-- */
-- const char *vpx_codec_version_extra_str(void);
--
--
-- /*!\brief Return the build configuration
-- *
-- * Returns a printable string containing an encoded version of the build
-- * configuration. This may be useful to vpx support.
-- *
-- */
-- const char *vpx_codec_build_config(void);
--
--
-- /*!\brief Return the name for a given interface
-- *
-- * Returns a human readable string for name of the given codec interface.
-- *
-- * \param[in] iface Interface pointer
-- *
-- */
-- const char *vpx_codec_iface_name(vpx_codec_iface_t *iface);
--
--
-- /*!\brief Convert error number to printable string
-- *
-- * Returns a human readable string for the last error returned by the
-- * algorithm. The returned error will be one line and will not contain
-- * any newline characters.
-- *
-- *
-- * \param[in] err Error number.
-- *
-- */
-- const char *vpx_codec_err_to_string(vpx_codec_err_t err);
--
--
-- /*!\brief Retrieve error synopsis for codec context
-- *
-- * Returns a human readable string for the last error returned by the
-- * algorithm. The returned error will be one line and will not contain
-- * any newline characters.
-- *
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- *
-- */
-- const char *vpx_codec_error(vpx_codec_ctx_t *ctx);
--
--
-- /*!\brief Retrieve detailed error information for codec context
-- *
-- * Returns a human readable string providing detailed information about
-- * the last error.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- *
-- * \retval NULL
-- * No detailed information is available.
-- */
-- const char *vpx_codec_error_detail(vpx_codec_ctx_t *ctx);
--
--
-- /* REQUIRED FUNCTIONS
-- *
-- * The following functions are required to be implemented for all codecs.
-- * They represent the base case functionality expected of all codecs.
-- */
--
-- /*!\brief Destroy a codec instance
-- *
-- * Destroys a codec context, freeing any associated memory buffers.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- *
-- * \retval #VPX_CODEC_OK
-- * The codec algorithm initialized.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Memory allocation failed.
-- */
-- vpx_codec_err_t vpx_codec_destroy(vpx_codec_ctx_t *ctx);
--
--
-- /*!\brief Get the capabilities of an algorithm.
-- *
-- * Retrieves the capabliities bitfield from the algorithm's interface.
-- *
-- * \param[in] iface Pointer to the alogrithm interface
-- *
-- */
-- vpx_codec_caps_t vpx_codec_get_caps(vpx_codec_iface_t *iface);
--
--
-- /*!\brief Control algorithm
-- *
-- * This function is used to exchange algorithm specific data with the codec
-- * instance. This can be used to implement features specific to a particular
-- * algorithm.
-- *
-- * This wrapper function dispatches the request to the helper function
-- * associated with the given ctrl_id. It tries to call this function
-- * transparantly, but will return #VPX_CODEC_ERROR if the request could not
-- * be dispatched.
-- *
-- * Note that this function should not be used directly. Call the
-- * #vpx_codec_control wrapper macro instead.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] ctrl_id Algorithm specific control identifier
-- *
-- * \retval #VPX_CODEC_OK
-- * The control request was processed.
-- * \retval #VPX_CODEC_ERROR
-- * The control request was not processed.
-- * \retval #VPX_CODEC_INVALID_PARAM
-- * The data was not valid.
-- */
-- vpx_codec_err_t vpx_codec_control_(vpx_codec_ctx_t *ctx,
-- int ctrl_id,
-- ...);
--#if defined(VPX_DISABLE_CTRL_TYPECHECKS) && VPX_DISABLE_CTRL_TYPECHECKS
--# define vpx_codec_control(ctx,id,data) vpx_codec_control_(ctx,id,data)
--# define VPX_CTRL_USE_TYPE(id, typ)
--# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ)
--# define VPX_CTRL_VOID(id, typ)
--
--#else
-- /*!\brief vpx_codec_control wrapper macro
-- *
-- * This macro allows for type safe conversions across the variadic parameter
-- * to vpx_codec_control_().
-- *
-- * \internal
-- * It works by dispatching the call to the control function through a wrapper
-- * function named with the id parameter.
-- */
--# define vpx_codec_control(ctx,id,data) vpx_codec_control_##id(ctx,id,data)\
-- /**<\hideinitializer*/
--
--
-- /*!\brief vpx_codec_control type definition macro
-- *
-- * This macro allows for type safe conversions across the variadic parameter
-- * to vpx_codec_control_(). It defines the type of the argument for a given
-- * control identifier.
-- *
-- * \internal
-- * It defines a static function with
-- * the correctly typed arguments as a wrapper to the type-unsafe internal
-- * function.
-- */
--# define VPX_CTRL_USE_TYPE(id, typ) \
-- static vpx_codec_err_t \
-- vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) UNUSED;\
-- \
-- static vpx_codec_err_t \
-- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
-- return vpx_codec_control_(ctx, ctrl_id, data);\
-- } /**<\hideinitializer*/
--
--
-- /*!\brief vpx_codec_control deprecated type definition macro
-- *
-- * Like #VPX_CTRL_USE_TYPE, but indicates that the specified control is
-- * deprecated and should not be used. Consult the documentation for your
-- * codec for more information.
-- *
-- * \internal
-- * It defines a static function with the correctly typed arguments as a
-- * wrapper to the type-unsafe internal function.
-- */
--# define VPX_CTRL_USE_TYPE_DEPRECATED(id, typ) \
-- DECLSPEC_DEPRECATED static vpx_codec_err_t \
-- vpx_codec_control_##id(vpx_codec_ctx_t*, int, typ) DEPRECATED UNUSED;\
-- \
-- DECLSPEC_DEPRECATED static vpx_codec_err_t \
-- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id, typ data) {\
-- return vpx_codec_control_(ctx, ctrl_id, data);\
-- } /**<\hideinitializer*/
--
--
-- /*!\brief vpx_codec_control void type definition macro
-- *
-- * This macro allows for type safe conversions across the variadic parameter
-- * to vpx_codec_control_(). It indicates that a given control identifier takes
-- * no argument.
-- *
-- * \internal
-- * It defines a static function without a data argument as a wrapper to the
-- * type-unsafe internal function.
-- */
--# define VPX_CTRL_VOID(id) \
-- static vpx_codec_err_t \
-- vpx_codec_control_##id(vpx_codec_ctx_t*, int) UNUSED;\
-- \
-- static vpx_codec_err_t \
-- vpx_codec_control_##id(vpx_codec_ctx_t *ctx, int ctrl_id) {\
-- return vpx_codec_control_(ctx, ctrl_id);\
-- } /**<\hideinitializer*/
--
--
--#endif
--
--
-- /*!\defgroup cap_xma External Memory Allocation Functions
-- *
-- * The following functions are required to be implemented for all codecs
-- * that advertise the VPX_CODEC_CAP_XMA capability. Calling these functions
-- * for codecs that don't advertise this capability will result in an error
-- * code being returned, usually VPX_CODEC_INCAPABLE
-- * @{
-- */
--
--
-- /*!\brief Memory Map Entry
-- *
-- * This structure is used to contain the properties of a memory segment. It
-- * is populated by the codec in the request phase, and by the calling
-- * application once the requested allocation has been performed.
-- */
-- typedef struct vpx_codec_mmap
-- {
-- /*
-- * The following members are set by the codec when requesting a segment
-- */
-- unsigned int id; /**< identifier for the segment's contents */
-- unsigned long sz; /**< size of the segment, in bytes */
-- unsigned int align; /**< required alignment of the segment, in bytes */
-- unsigned int flags; /**< bitfield containing segment properties */
--#define VPX_CODEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
--#define VPX_CODEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
--#define VPX_CODEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
--
-- /* The following members are to be filled in by the allocation function */
-- void *base; /**< pointer to the allocated segment */
-- void (*dtor)(struct vpx_codec_mmap *map); /**< destructor to call */
-- void *priv; /**< allocator private storage */
-- } vpx_codec_mmap_t; /**< alias for struct vpx_codec_mmap */
--
--
-- /*!\brief Iterate over the list of segments to allocate.
-- *
-- * Iterates over a list of the segments to allocate. The iterator storage
-- * should be initialized to NULL to start the iteration. Iteration is complete
-- * when this function returns VPX_CODEC_LIST_END. The amount of memory needed to
-- * allocate is dependant upon the size of the encoded stream. In cases where the
-- * stream is not available at allocation time, a fixed size must be requested.
-- * The codec will not be able to operate on streams larger than the size used at
-- * allocation time.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[out] mmap Pointer to the memory map entry to populate.
-- * \param[in,out] iter Iterator storage, initialized to NULL
-- *
-- * \retval #VPX_CODEC_OK
-- * The memory map entry was populated.
-- * \retval #VPX_CODEC_ERROR
-- * Codec does not support XMA mode.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Unable to determine segment size from stream info.
-- */
-- vpx_codec_err_t vpx_codec_get_mem_map(vpx_codec_ctx_t *ctx,
-- vpx_codec_mmap_t *mmap,
-- vpx_codec_iter_t *iter);
--
--
-- /*!\brief Identify allocated segments to codec instance
-- *
-- * Stores a list of allocated segments in the codec. Segments \ref MUST be
-- * passed in the order they are read from vpx_codec_get_mem_map(), but may be
-- * passed in groups of any size. Segments \ref MUST be set only once. The
-- * allocation function \ref MUST ensure that the vpx_codec_mmap_t::base member
-- * is non-NULL. If the segment requires cleanup handling (eg, calling free()
-- * or close()) then the vpx_codec_mmap_t::dtor member \ref MUST be populated.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[in] mmaps Pointer to the first memory map entry in the list.
-- * \param[in] num_maps Number of entries being set at this time
-- *
-- * \retval #VPX_CODEC_OK
-- * The segment was stored in the codec context.
-- * \retval #VPX_CODEC_INCAPABLE
-- * Codec does not support XMA mode.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Segment base address was not set, or segment was already stored.
--
-- */
-- vpx_codec_err_t vpx_codec_set_mem_map(vpx_codec_ctx_t *ctx,
-- vpx_codec_mmap_t *mmaps,
-- unsigned int num_maps);
--
-- /*!@} - end defgroup cap_xma*/
-- /*!@} - end defgroup codec*/
--
--
--#endif
--#ifdef __cplusplus
--}
--#endif
-diff --git a/vpx_codec/vpx_codec.mk b/vpx_codec/vpx_codec.mk
-deleted file mode 100644
-index 75fbeea..0000000
---- a/vpx_codec/vpx_codec.mk
-+++ /dev/null
-@@ -1,26 +0,0 @@
--##
--## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
--##
--## Use of this source code is governed by a BSD-style license and patent
--## grant that can be found in the LICENSE file in the root of the source
--## tree. All contributing project authors may be found in the AUTHORS
--## file in the root of the source tree.
--##
--
--
--API_EXPORTS += exports
--
--API_SRCS-yes += internal/vpx_codec_internal.h
--API_SRCS-yes += vpx_codec.h
--API_SRCS-yes += vpx_codec.mk
--API_SRCS-yes += vpx_codec_impl_top.h
--API_SRCS-yes += vpx_codec_impl_bottom.h
--API_SRCS-yes += vpx_decoder.h
--API_SRCS-yes += vpx_decoder_compat.h
--API_SRCS-yes += vpx_encoder.h
--API_SRCS-yes += vpx_image.h
--API_SRCS-yes += src/vpx_codec.c
--API_SRCS-yes += src/vpx_decoder.c
--API_SRCS-yes += src/vpx_decoder_compat.c
--API_SRCS-yes += src/vpx_image.c
--API_SRCS-yes += src/vpx_encoder.c
-diff --git a/vpx_codec/vpx_codec_impl_bottom.h b/vpx_codec/vpx_codec_impl_bottom.h
-deleted file mode 100644
-index c52654c..0000000
---- a/vpx_codec/vpx_codec_impl_bottom.h
-+++ /dev/null
-@@ -1,18 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*
-- * This file is to be included at the bottom of the header files defining the
-- * interface to individual codecs and contains matching blocks to those defined
-- * in vpx_codec_impl_top.h
-- */
--#ifdef __cplusplus
--}
--#endif
-diff --git a/vpx_codec/vpx_codec_impl_top.h b/vpx_codec/vpx_codec_impl_top.h
-deleted file mode 100644
-index f73809a..0000000
---- a/vpx_codec/vpx_codec_impl_top.h
-+++ /dev/null
-@@ -1,18 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*
-- * This file is to be included at the top of the header files defining the
-- * interface to individual codecs and contains various workarounds common
-- * to all codec implementations.
-- */
--#ifdef __cplusplus
--extern "C" {
--#endif
-diff --git a/vpx_codec/vpx_decoder.h b/vpx_codec/vpx_decoder.h
-deleted file mode 100644
-index 5e4968d..0000000
---- a/vpx_codec/vpx_decoder.h
-+++ /dev/null
-@@ -1,316 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\defgroup decoder Decoder Algorithm Interface
-- * \ingroup codec
-- * This abstraction allows applications using this decoder to easily support
-- * multiple video formats with minimal code duplication. This section describes
-- * the interface common to all decoders.
-- * @{
-- */
--
--/*!\file vpx_decoder.h
-- * \brief Describes the decoder algorithm interface to applications.
-- *
-- * This file describes the interface between an application and a
-- * video decoder algorithm.
-- *
-- */
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifndef VPX_DECODER_H
--#define VPX_DECODER_H
--#include "vpx_codec.h"
--
-- /*!\brief Current ABI version number
-- *
-- * \internal
-- * If this file is altered in any way that changes the ABI, this value
-- * must be bumped. Examples include, but are not limited to, changing
-- * types, removing or reassigning enums, adding/removing/rearranging
-- * fields to structures
-- */
--#define VPX_DECODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
--
-- /*! \brief Decoder capabilities bitfield
-- *
-- * Each decoder advertises the capabilities it supports as part of its
-- * ::vpx_codec_iface_t interface structure. Capabilities are extra interfaces
-- * or functionality, and are not required to be supported by a decoder.
-- *
-- * The available flags are specifiedby VPX_CODEC_CAP_* defines.
-- */
--#define VPX_CODEC_CAP_PUT_SLICE 0x10000 /**< Will issue put_slice callbacks */
--#define VPX_CODEC_CAP_PUT_FRAME 0x20000 /**< Will issue put_frame callbacks */
--#define VPX_CODEC_CAP_POSTPROC 0x40000 /**< Can postprocess decoded frame */
--
-- /*! \brief Initialization-time Feature Enabling
-- *
-- * Certain codec features must be known at initialization time, to allow for
-- * proper memory allocation.
-- *
-- * The available flags are specified by VPX_CODEC_USE_* defines.
-- */
--#define VPX_CODEC_USE_POSTPROC 0x10000 /**< Postprocess decoded frame */
--
-- /*!\brief Stream properties
-- *
-- * This structure is used to query or set properties of the decoded
-- * stream. Algorithms may extend this structure with data specific
-- * to their bitstream by setting the sz member appropriately.
-- */
-- typedef struct
-- {
-- unsigned int sz; /**< Size of this structure */
-- unsigned int w; /**< Width (or 0 for unknown/default) */
-- unsigned int h; /**< Height (or 0 for unknown/default) */
-- unsigned int is_kf; /**< Current frame is a keyframe */
-- } vpx_codec_stream_info_t;
--
-- /* REQUIRED FUNCTIONS
-- *
-- * The following functions are required to be implemented for all decoders.
-- * They represent the base case functionality expected of all decoders.
-- */
--
--
-- /*!\brief Initialization Configurations
-- *
-- * This structure is used to pass init time configuration options to the
-- * decoder.
-- */
-- typedef struct vpx_codec_dec_cfg
-- {
-- unsigned int threads; /**< Maximum number of threads to use, default 1 */
-- unsigned int w; /**< Width */
-- unsigned int h; /**< Height */
-- } vpx_codec_dec_cfg_t; /**< alias for struct vpx_codec_dec_cfg */
--
--
-- /*!\brief Initialize a decoder instance
-- *
-- * Initializes a decoder context using the given interface. Applications
-- * should call the vpx_codec_dec_init convenience macro instead of this
-- * function directly, to ensure that the ABI version number parameter
-- * is properly initialized.
-- *
-- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
-- * parameter), the storage pointed to by the cfg parameter must be
-- * kept readable and stable until all memory maps have been set.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[in] iface Pointer to the alogrithm interface to use.
-- * \param[in] cfg Configuration to use, if known. May be NULL.
-- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
-- * \param[in] ver ABI version number. Must be set to
-- * VPX_DECODER_ABI_VERSION
-- * \retval #VPX_CODEC_OK
-- * The decoder algorithm initialized.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Memory allocation failed.
-- */
-- vpx_codec_err_t vpx_codec_dec_init_ver(vpx_codec_ctx_t *ctx,
-- vpx_codec_iface_t *iface,
-- vpx_codec_dec_cfg_t *cfg,
-- vpx_codec_flags_t flags,
-- int ver);
--
-- /*!\brief Convenience macro for vpx_codec_dec_init_ver()
-- *
-- * Ensures the ABI version parameter is properly set.
-- */
--#define vpx_codec_dec_init(ctx, iface, cfg, flags) \
-- vpx_codec_dec_init_ver(ctx, iface, cfg, flags, VPX_DECODER_ABI_VERSION)
--
--
-- /*!\brief Parse stream info from a buffer
-- *
-- * Performs high level parsing of the bitstream. Construction of a decoder
-- * context is not necessary. Can be used to determine if the bitstream is
-- * of the proper format, and to extract information from the stream.
-- *
-- * \param[in] iface Pointer to the alogrithm interface
-- * \param[in] data Pointer to a block of data to parse
-- * \param[in] data_sz Size of the data buffer
-- * \param[in,out] si Pointer to stream info to update. The size member
-- * \ref MUST be properly initialized, but \ref MAY be
-- * clobbered by the algorithm. This parameter \ref MAY
-- * be NULL.
-- *
-- * \retval #VPX_CODEC_OK
-- * Bitstream is parsable and stream information updated
-- */
-- vpx_codec_err_t vpx_codec_peek_stream_info(vpx_codec_iface_t *iface,
-- const uint8_t *data,
-- unsigned int data_sz,
-- vpx_codec_stream_info_t *si);
--
--
-- /*!\brief Return information about the current stream.
-- *
-- * Returns information about the stream that has been parsed during decoding.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in,out] si Pointer to stream info to update. The size member
-- * \ref MUST be properly initialized, but \ref MAY be
-- * clobbered by the algorithm. This parameter \ref MAY
-- * be NULL.
-- *
-- * \retval #VPX_CODEC_OK
-- * Bitstream is parsable and stream information updated
-- */
-- vpx_codec_err_t vpx_codec_get_stream_info(vpx_codec_ctx_t *ctx,
-- vpx_codec_stream_info_t *si);
--
--
-- /*!\brief Decode data
-- *
-- * Processes a buffer of coded data. If the processing results in a new
-- * decoded frame becoming available, PUT_SLICE and PUT_FRAME events may be
-- * generated, as appropriate. Encoded data \ref MUST be passed in DTS (decode
-- * time stamp) order. Frames produced will always be in PTS (presentation
-- * time stamp) order.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] data Pointer to this block of new coded data. If
-- * NULL, a VPX_CODEC_CB_PUT_FRAME event is posted
-- * for the previously decoded frame.
-- * \param[in] data_sz Size of the coded data, in bytes.
-- * \param[in] user_priv Application specific data to associate with
-- * this frame.
-- * \param[in] deadline Soft deadline the decoder should attempt to meet,
-- * in us. Set to zero for unlimited.
-- *
-- * \return Returns #VPX_CODEC_OK if the coded data was processed completely
-- * and future pictures can be decoded without error. Otherwise,
-- * see the descriptions of the other error codes in ::vpx_codec_err_t
-- * for recoverability capabilities.
-- */
-- vpx_codec_err_t vpx_codec_decode(vpx_codec_ctx_t *ctx,
-- const uint8_t *data,
-- unsigned int data_sz,
-- void *user_priv,
-- long deadline);
--
--
-- /*!\brief Decoded frames iterator
-- *
-- * Iterates over a list of the frames available for display. The iterator
-- * storage should be initialized to NULL to start the iteration. Iteration is
-- * complete when this function returns NULL.
-- *
-- * The list of available frames becomes valid upon completion of the
-- * vpx_codec_decode call, and remains valid until the next call to vpx_codec_decode.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in,out] iter Iterator storage, initialized to NULL
-- *
-- * \return Returns a pointer to an image, if one is ready for display. Frames
-- * produced will always be in PTS (presentation time stamp) order.
-- */
-- vpx_image_t *vpx_codec_get_frame(vpx_codec_ctx_t *ctx,
-- vpx_codec_iter_t *iter);
--
--
-- /*!\defgroup cap_put_frame Frame-Based Decoding Functions
-- *
-- * The following functions are required to be implemented for all decoders
-- * that advertise the VPX_CODEC_CAP_PUT_FRAME capability. Calling these functions
-- * for codecs that don't advertise this capability will result in an error
-- * code being returned, usually VPX_CODEC_ERROR
-- * @{
-- */
--
-- /*!\brief put frame callback prototype
-- *
-- * This callback is invoked by the decoder to notify the application of
-- * the availability of decoded image data.
-- */
-- typedef void (*vpx_codec_put_frame_cb_fn_t)(void *user_priv,
-- const vpx_image_t *img);
--
--
-- /*!\brief Register for notification of frame completion.
-- *
-- * Registers a given function to be called when a decoded frame is
-- * available.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] cb Pointer to the callback function
-- * \param[in] user_priv User's private data
-- *
-- * \retval #VPX_CODEC_OK
-- * Callback successfully registered.
-- * \retval #VPX_CODEC_ERROR
-- * Decoder context not initialized, or algorithm not capable of
-- * posting slice completion.
-- */
-- vpx_codec_err_t vpx_codec_register_put_frame_cb(vpx_codec_ctx_t *ctx,
-- vpx_codec_put_frame_cb_fn_t cb,
-- void *user_priv);
--
--
-- /*!@} - end defgroup cap_put_frame */
--
-- /*!\defgroup cap_put_slice Slice-Based Decoding Functions
-- *
-- * The following functions are required to be implemented for all decoders
-- * that advertise the VPX_CODEC_CAP_PUT_SLICE capability. Calling these functions
-- * for codecs that don't advertise this capability will result in an error
-- * code being returned, usually VPX_CODEC_ERROR
-- * @{
-- */
--
-- /*!\brief put slice callback prototype
-- *
-- * This callback is invoked by the decoder to notify the application of
-- * the availability of partially decoded image data. The
-- */
-- typedef void (*vpx_codec_put_slice_cb_fn_t)(void *user_priv,
-- const vpx_image_t *img,
-- const vpx_image_rect_t *valid,
-- const vpx_image_rect_t *update);
--
--
-- /*!\brief Register for notification of slice completion.
-- *
-- * Registers a given function to be called when a decoded slice is
-- * available.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] cb Pointer to the callback function
-- * \param[in] user_priv User's private data
-- *
-- * \retval #VPX_CODEC_OK
-- * Callback successfully registered.
-- * \retval #VPX_CODEC_ERROR
-- * Decoder context not initialized, or algorithm not capable of
-- * posting slice completion.
-- */
-- vpx_codec_err_t vpx_codec_register_put_slice_cb(vpx_codec_ctx_t *ctx,
-- vpx_codec_put_slice_cb_fn_t cb,
-- void *user_priv);
--
--
-- /*!@} - end defgroup cap_put_slice*/
--
-- /*!@} - end defgroup decoder*/
--
--#endif
--
--#ifdef __cplusplus
--}
--#endif
--
--#if !defined(VPX_CODEC_DISABLE_COMPAT) || !VPX_CODEC_DISABLE_COMPAT
--#include "vpx_decoder_compat.h"
--#endif
-diff --git a/vpx_codec/vpx_decoder_compat.h b/vpx_codec/vpx_decoder_compat.h
-deleted file mode 100644
-index 25bb5eb..0000000
---- a/vpx_codec/vpx_decoder_compat.h
-+++ /dev/null
-@@ -1,586 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\defgroup decoder Common Decoder Algorithm Interface
-- * This abstraction allows applications using this decoder to easily support
-- * multiple video formats with minimal code duplication. This section describes
-- * the interface common to all codecs.
-- * @{
-- */
--
--/*!\file vpx_decoder_compat.h
-- * \brief Provides a compatibility layer between version 1 and 2 of this API.
-- *
-- * This interface has been deprecated. Only existing code should make use
-- * of this interface, and therefore, it is only thinly documented. Existing
-- * code should be ported to the vpx_codec_* API.
-- */
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifndef VPX_DECODER_COMPAT_H
--#define VPX_DECODER_COMPAT_H
--
-- /*!\brief Decoder algorithm return codes */
-- typedef enum {
-- /*!\brief Operation completed without error */
-- VPX_DEC_OK = VPX_CODEC_OK,
--
-- /*!\brief Unspecified error */
-- VPX_DEC_ERROR = VPX_CODEC_ERROR,
--
-- /*!\brief Memory operation failed */
-- VPX_DEC_MEM_ERROR = VPX_CODEC_MEM_ERROR,
--
-- /*!\brief ABI version mismatch */
-- VPX_DEC_ABI_MISMATCH = VPX_CODEC_ABI_MISMATCH,
--
-- /*!\brief The given bitstream is not supported.
-- *
-- * The bitstream was unable to be parsed at the highest level. The decoder
-- * is unable to proceed. This error \ref SHOULD be treated as fatal to the
-- * stream. */
-- VPX_DEC_UNSUP_BITSTREAM = VPX_CODEC_UNSUP_BITSTREAM,
--
-- /*!\brief Encoded bitstream uses an unsupported feature
-- *
-- * The decoder does not implement a feature required by the encoder. This
-- * return code should only be used for features that prevent future
-- * pictures from being properly decoded. This error \ref MAY be treated as
-- * fatal to the stream or \ref MAY be treated as fatal to the current GOP.
-- */
-- VPX_DEC_UNSUP_FEATURE = VPX_CODEC_UNSUP_FEATURE,
--
-- /*!\brief The coded data for this stream is corrupt or incomplete
-- *
-- * There was a problem decoding the current frame. This return code
-- * should only be used for failures that prevent future pictures from
-- * being properly decoded. This error \ref MAY be treated as fatal to the
-- * stream or \ref MAY be treated as fatal to the current GOP. If decoding
-- * is continued for the current GOP, artifacts may be present.
-- */
-- VPX_DEC_CORRUPT_FRAME = VPX_CODEC_CORRUPT_FRAME,
--
-- /*!\brief An application-supplied parameter is not valid.
-- *
-- */
-- VPX_DEC_INVALID_PARAM = VPX_CODEC_INVALID_PARAM,
--
-- /*!\brief An iterator reached the end of list.
-- *
-- */
-- VPX_DEC_LIST_END = VPX_CODEC_LIST_END,
--
-- }
-- vpx_dec_err_t;
--
-- /*! \brief Decoder capabilities bitfield
-- *
-- * Each decoder advertises the capabilities it supports as part of its
-- * ::vpx_dec_iface_t interface structure. Capabilities are extra interfaces
-- * or functionality, and are not required to be supported by a decoder.
-- *
-- * The available flags are specifiedby VPX_DEC_CAP_* defines.
-- */
-- typedef int vpx_dec_caps_t;
--#define VPX_DEC_CAP_PUT_SLICE 0x0001 /**< Will issue put_slice callbacks */
--#define VPX_DEC_CAP_PUT_FRAME 0x0002 /**< Will issue put_frame callbacks */
--#define VPX_DEC_CAP_XMA 0x0004 /**< Supports e_xternal Memory Allocation */
--
-- /*!\brief Stream properties
-- *
-- * This structure is used to query or set properties of the decoded
-- * stream. Algorithms may extend this structure with data specific
-- * to their bitstream by setting the sz member appropriately.
-- */
--#if 1
-- typedef vpx_codec_stream_info_t vpx_dec_stream_info_t;
--#else
-- typedef struct
-- {
-- unsigned int sz; /**< Size of this structure */
-- unsigned int w; /**< Width (or 0 for unknown/default) */
-- unsigned int h; /**< Height (or 0 for unknown/default) */
-- unsigned int is_kf; /**< Current frame is a keyframe */
-- } vpx_dec_stream_info_t;
--#endif
--
--
-- /*!\brief Decoder interface structure.
-- *
-- * Contains function pointers and other data private to the decoder
-- * implementation. This structure is opaque to the application.
-- */
-- typedef const struct vpx_codec_iface vpx_dec_iface_t;
-- typedef struct vpx_codec_priv vpx_dec_priv_t;
--
-- /*!\brief Iterator
-- *
-- * Opaque storage used for iterating over lists.
-- */
-- typedef vpx_codec_iter_t vpx_dec_iter_t;
--
-- /*!\brief Decoder context structure
-- *
-- * All decoders \ref MUST support this context structure fully. In general,
-- * this data should be considered private to the decoder algorithm, and
-- * not be manipulated or examined by the calling application. Applications
-- * may reference the 'name' member to get a printable description of the
-- * algorithm.
-- */
--#if 1
-- typedef vpx_codec_ctx_t vpx_dec_ctx_t;
--#else
-- typedef struct
-- {
-- const char *name; /**< Printable interface name */
-- vpx_dec_iface_t *iface; /**< Interface pointers */
-- vpx_dec_err_t err; /**< Last returned error */
-- vpx_dec_priv_t *priv; /**< Algorithm private storage */
-- } vpx_dec_ctx_t;
--#endif
--
--
-- /*!\brief Return the build configuration
-- *
-- * Returns a printable string containing an encoded version of the build
-- * configuration. This may be useful to vpx support.
-- *
-- */
-- const char *vpx_dec_build_config(void) DEPRECATED;
--
-- /*!\brief Return the name for a given interface
-- *
-- * Returns a human readable string for name of the given decoder interface.
-- *
-- * \param[in] iface Interface pointer
-- *
-- */
-- const char *vpx_dec_iface_name(vpx_dec_iface_t *iface) DEPRECATED;
--
--
-- /*!\brief Convert error number to printable string
-- *
-- * Returns a human readable string for the last error returned by the
-- * algorithm. The returned error will be one line and will not contain
-- * any newline characters.
-- *
-- *
-- * \param[in] err Error number.
-- *
-- */
-- const char *vpx_dec_err_to_string(vpx_dec_err_t err) DEPRECATED;
--
--
-- /*!\brief Retrieve error synopsis for decoder context
-- *
-- * Returns a human readable string for the last error returned by the
-- * algorithm. The returned error will be one line and will not contain
-- * any newline characters.
-- *
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- *
-- */
-- const char *vpx_dec_error(vpx_dec_ctx_t *ctx) DEPRECATED;
--
--
-- /*!\brief Retrieve detailed error information for decoder context
-- *
-- * Returns a human readable string providing detailed information about
-- * the last error.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- *
-- * \retval NULL
-- * No detailed information is available.
-- */
-- const char *vpx_dec_error_detail(vpx_dec_ctx_t *ctx) DEPRECATED;
--
--
-- /* REQUIRED FUNCTIONS
-- *
-- * The following functions are required to be implemented for all decoders.
-- * They represent the base case functionality expected of all decoders.
-- */
--
--
-- /*!\brief Initialize a decoder instance
-- *
-- * Initializes a decoder context using the given interface. Applications
-- * should call the vpx_dec_init convenience macro instead of this
-- * function directly, to ensure that the ABI version number parameter
-- * is properly initialized.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[in] iface Pointer to the alogrithm interface to use.
-- * \param[in] ver ABI version number. Must be set to
-- * VPX_DECODER_ABI_VERSION
-- * \retval #VPX_DEC_OK
-- * The decoder algorithm initialized.
-- * \retval #VPX_DEC_MEM_ERROR
-- * Memory allocation failed.
-- */
-- vpx_dec_err_t vpx_dec_init_ver(vpx_dec_ctx_t *ctx,
-- vpx_dec_iface_t *iface,
-- int ver) DEPRECATED;
--#define vpx_dec_init(ctx, iface) \
-- vpx_dec_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
--
--
-- /*!\brief Destroy a decoder instance
-- *
-- * Destroys a decoder context, freeing any associated memory buffers.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- *
-- * \retval #VPX_DEC_OK
-- * The decoder algorithm initialized.
-- * \retval #VPX_DEC_MEM_ERROR
-- * Memory allocation failed.
-- */
-- vpx_dec_err_t vpx_dec_destroy(vpx_dec_ctx_t *ctx) DEPRECATED;
--
--
-- /*!\brief Get the capabilities of an algorithm.
-- *
-- * Retrieves the capabliities bitfield from the algorithm's interface.
-- *
-- * \param[in] iface Pointer to the alogrithm interface
-- *
-- */
-- vpx_dec_caps_t vpx_dec_get_caps(vpx_dec_iface_t *iface) DEPRECATED;
--
--
-- /*!\brief Parse stream info from a buffer
-- *
-- * Performs high level parsing of the bitstream. Construction of a decoder
-- * context is not necessary. Can be used to determine if the bitstream is
-- * of the proper format, and to extract information from the stream.
-- *
-- * \param[in] iface Pointer to the alogrithm interface
-- * \param[in] data Pointer to a block of data to parse
-- * \param[in] data_sz Size of the data buffer
-- * \param[in,out] si Pointer to stream info to update. The size member
-- * \ref MUST be properly initialized, but \ref MAY be
-- * clobbered by the algorithm. This parameter \ref MAY
-- * be NULL.
-- *
-- * \retval #VPX_DEC_OK
-- * Bitstream is parsable and stream information updated
-- */
-- vpx_dec_err_t vpx_dec_peek_stream_info(vpx_dec_iface_t *iface,
-- const uint8_t *data,
-- unsigned int data_sz,
-- vpx_dec_stream_info_t *si) DEPRECATED;
--
--
-- /*!\brief Return information about the current stream.
-- *
-- * Returns information about the stream that has been parsed during decoding.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in,out] si Pointer to stream info to update. The size member
-- * \ref MUST be properly initialized, but \ref MAY be
-- * clobbered by the algorithm. This parameter \ref MAY
-- * be NULL.
-- *
-- * \retval #VPX_DEC_OK
-- * Bitstream is parsable and stream information updated
-- */
-- vpx_dec_err_t vpx_dec_get_stream_info(vpx_dec_ctx_t *ctx,
-- vpx_dec_stream_info_t *si) DEPRECATED;
--
--
-- /*!\brief Control algorithm
-- *
-- * This function is used to exchange algorithm specific data with the decoder
-- * instance. This can be used to implement features specific to a particular
-- * algorithm.
-- *
-- * This wrapper function dispatches the request to the helper function
-- * associated with the given ctrl_id. It tries to call this function
-- * transparantly, but will return #VPX_DEC_ERROR if the request could not
-- * be dispatched.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] ctrl_id Algorithm specific control identifier
-- * \param[in,out] data Data to exchange with algorithm instance.
-- *
-- * \retval #VPX_DEC_OK
-- * The control request was processed.
-- * \retval #VPX_DEC_ERROR
-- * The control request was not processed.
-- * \retval #VPX_DEC_INVALID_PARAM
-- * The data was not valid.
-- */
-- vpx_dec_err_t vpx_dec_control(vpx_dec_ctx_t *ctx,
-- int ctrl_id,
-- void *data) DEPRECATED;
--
-- /*!\brief Decode data
-- *
-- * Processes a buffer of coded data. If the processing results in a new
-- * decoded frame becoming available, #VPX_DEC_CB_PUT_SLICE and
-- * #VPX_DEC_CB_PUT_FRAME events may be generated, as appropriate. Encoded data
-- * \ref MUST be passed in DTS (decode time stamp) order. Frames produced will
-- * always be in PTS (presentation time stamp) order.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] data Pointer to this block of new coded data. If
-- * NULL, a VPX_DEC_CB_PUT_FRAME event is posted
-- * for the previously decoded frame.
-- * \param[in] data_sz Size of the coded data, in bytes.
-- * \param[in] user_priv Application specific data to associate with
-- * this frame.
-- * \param[in] rel_pts PTS relative to the previous frame, in us. If
-- * unknown or unavailable, set to zero.
-- *
-- * \return Returns #VPX_DEC_OK if the coded data was processed completely
-- * and future pictures can be decoded without error. Otherwise,
-- * see the descriptions of the other error codes in ::vpx_dec_err_t
-- * for recoverability capabilities.
-- */
-- vpx_dec_err_t vpx_dec_decode(vpx_dec_ctx_t *ctx,
-- uint8_t *data,
-- unsigned int data_sz,
-- void *user_priv,
-- int rel_pts) DEPRECATED;
--
--
-- /*!\brief Decoded frames iterator
-- *
-- * Iterates over a list of the frames available for display. The iterator
-- * storage should be initialized to NULL to start the iteration. Iteration is
-- * complete when this function returns NULL.
-- *
-- * The list of available frames becomes valid upon completion of the
-- * vpx_dec_decode call, and remains valid until the next call to vpx_dec_decode.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in out] iter Iterator storage, initialized to NULL
-- *
-- * \return Returns a pointer to an image, if one is ready for display. Frames
-- * produced will always be in PTS (presentation time stamp) order.
-- */
-- vpx_image_t *vpx_dec_get_frame(vpx_dec_ctx_t *ctx,
-- vpx_dec_iter_t *iter) DEPRECATED;
--
--
-- /*!\defgroup cap_put_frame Frame-Based Decoding Functions
-- *
-- * The following functions are required to be implemented for all decoders
-- * that advertise the VPX_DEC_CAP_PUT_FRAME capability. Calling these functions
-- * for codecs that don't advertise this capability will result in an error
-- * code being returned, usually VPX_DEC_ERROR
-- * @{
-- */
--
-- /*!\brief put frame callback prototype
-- *
-- * This callback is invoked by the decoder to notify the application of
-- * the availability of decoded image data.
-- */
-- typedef void (*vpx_dec_put_frame_cb_fn_t)(void *user_priv,
-- const vpx_image_t *img);
--
--
-- /*!\brief Register for notification of frame completion.
-- *
-- * Registers a given function to be called when a decoded frame is
-- * available.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] cb Pointer to the callback function
-- * \param[in] user_priv User's private data
-- *
-- * \retval #VPX_DEC_OK
-- * Callback successfully registered.
-- * \retval #VPX_DEC_ERROR
-- * Decoder context not initialized, or algorithm not capable of
-- * posting slice completion.
-- */
-- vpx_dec_err_t vpx_dec_register_put_frame_cb(vpx_dec_ctx_t *ctx,
-- vpx_dec_put_frame_cb_fn_t cb,
-- void *user_priv) DEPRECATED;
--
--
-- /*!@} - end defgroup cap_put_frame */
--
-- /*!\defgroup cap_put_slice Slice-Based Decoding Functions
-- *
-- * The following functions are required to be implemented for all decoders
-- * that advertise the VPX_DEC_CAP_PUT_SLICE capability. Calling these functions
-- * for codecs that don't advertise this capability will result in an error
-- * code being returned, usually VPX_DEC_ERROR
-- * @{
-- */
--
-- /*!\brief put slice callback prototype
-- *
-- * This callback is invoked by the decoder to notify the application of
-- * the availability of partially decoded image data. The
-- */
-- typedef void (*vpx_dec_put_slice_cb_fn_t)(void *user_priv,
-- const vpx_image_t *img,
-- const vpx_image_rect_t *valid,
-- const vpx_image_rect_t *update);
--
--
-- /*!\brief Register for notification of slice completion.
-- *
-- * Registers a given function to be called when a decoded slice is
-- * available.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] cb Pointer to the callback function
-- * \param[in] user_priv User's private data
-- *
-- * \retval #VPX_DEC_OK
-- * Callback successfully registered.
-- * \retval #VPX_DEC_ERROR
-- * Decoder context not initialized, or algorithm not capable of
-- * posting slice completion.
-- */
-- vpx_dec_err_t vpx_dec_register_put_slice_cb(vpx_dec_ctx_t *ctx,
-- vpx_dec_put_slice_cb_fn_t cb,
-- void *user_priv) DEPRECATED;
--
--
-- /*!@} - end defgroup cap_put_slice*/
--
-- /*!\defgroup cap_xma External Memory Allocation Functions
-- *
-- * The following functions are required to be implemented for all decoders
-- * that advertise the VPX_DEC_CAP_XMA capability. Calling these functions
-- * for codecs that don't advertise this capability will result in an error
-- * code being returned, usually VPX_DEC_ERROR
-- * @{
-- */
--
-- /*!\brief Memory Map Entry
-- *
-- * This structure is used to contain the properties of a memory segment. It
-- * is populated by the decoder in the request phase, and by the calling
-- * application once the requested allocation has been performed.
-- */
--#if 1
--#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
--#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
--#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
-- typedef struct vpx_codec_mmap vpx_dec_mmap_t;
--#else
-- typedef struct vpx_dec_mmap
-- {
-- /*
-- * The following members are set by the codec when requesting a segment
-- */
-- unsigned int id; /**< identifier for the segment's contents */
-- unsigned long sz; /**< size of the segment, in bytes */
-- unsigned int align; /**< required alignment of the segment, in bytes */
-- unsigned int flags; /**< bitfield containing segment properties */
--#define VPX_DEC_MEM_ZERO 0x1 /**< Segment must be zeroed by allocation */
--#define VPX_DEC_MEM_WRONLY 0x2 /**< Segment need not be readable */
--#define VPX_DEC_MEM_FAST 0x4 /**< Place in fast memory, if available */
--
-- /* The following members are to be filled in by the allocation function */
-- void *base; /**< pointer to the allocated segment */
-- void (*dtor)(struct vpx_dec_mmap *map); /**< destructor to call */
-- void *priv; /**< allocator private storage */
-- } vpx_dec_mmap_t;
--#endif
--
-- /*!\brief Initialize a decoder instance in external allocation mode
-- *
-- * Initializes a decoder context using the given interface. Applications
-- * should call the vpx_dec_xma_init convenience macro instead of this
-- * function directly, to ensure that the ABI version number parameter
-- * is properly initialized.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[in] iface Pointer to the alogrithm interface to use.
-- * \param[in] ver ABI version number. Must be set to
-- * VPX_DECODER_ABI_VERSION
-- * \retval #VPX_DEC_OK
-- * The decoder algorithm initialized.
-- * \retval #VPX_DEC_ERROR
-- * Decoder does not support XMA mode.
-- */
-- vpx_dec_err_t vpx_dec_xma_init_ver(vpx_dec_ctx_t *ctx,
-- vpx_dec_iface_t *iface,
-- int ver) DEPRECATED;
--#define vpx_dec_xma_init(ctx, iface) \
-- vpx_dec_xma_init_ver(ctx, iface, VPX_DECODER_ABI_VERSION)
--
--
-- /*!\brief Iterate over the list of segments to allocate.
-- *
-- * Iterates over a list of the segments to allocate. The iterator storage
-- * should be initialized to NULL to start the iteration. Iteration is complete
-- * when this function returns VPX_DEC_LIST_END. The amount of memory needed to
-- * allocate is dependant upon the size of the encoded stream. This means that
-- * the stream info structure must be known at allocation time. It can be
-- * populated with the vpx_dec_peek_stream_info() function. In cases where the
-- * stream to be decoded is not available at allocation time, a fixed size must
-- * be requested. The decoder will not be able to decode streams larger than
-- * the size used at allocation time.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[out] mmap Pointer to the memory map entry to populate.
-- * \param[in] si Pointer to the stream info.
-- * \param[in out] iter Iterator storage, initialized to NULL
-- *
-- * \retval #VPX_DEC_OK
-- * The memory map entry was populated.
-- * \retval #VPX_DEC_ERROR
-- * Decoder does not support XMA mode.
-- * \retval #VPX_DEC_MEM_ERROR
-- * Unable to determine segment size from stream info.
-- */
-- vpx_dec_err_t vpx_dec_get_mem_map(vpx_dec_ctx_t *ctx,
-- vpx_dec_mmap_t *mmap,
-- const vpx_dec_stream_info_t *si,
-- vpx_dec_iter_t *iter) DEPRECATED;
--
--
-- /*!\brief Identify allocated segments to decoder instance
-- *
-- * Stores a list of allocated segments in the decoder. Segments \ref MUST be
-- * passed in the order they are read from vpx_dec_get_mem_map(), but may be
-- * passed in groups of any size. Segments \ref MUST be set only once. The
-- * allocation function \ref MUST ensure that the vpx_dec_mmap_t::base member
-- * is non-NULL. If the segment requires cleanup handling (eg, calling free()
-- * or close()) then the vpx_dec_mmap_t::dtor member \ref MUST be populated.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[in] mmaps Pointer to the first memory map entry in the list.
-- * \param[in] num_maps Number of entries being set at this time
-- *
-- * \retval #VPX_DEC_OK
-- * The segment was stored in the decoder context.
-- * \retval #VPX_DEC_ERROR
-- * Decoder does not support XMA mode.
-- * \retval #VPX_DEC_MEM_ERROR
-- * Segment base address was not set, or segment was already stored.
--
-- */
-- vpx_dec_err_t vpx_dec_set_mem_map(vpx_dec_ctx_t *ctx,
-- vpx_dec_mmap_t *mmaps,
-- unsigned int num_maps) DEPRECATED;
--
-- /*!@} - end defgroup cap_xma*/
-- /*!@} - end defgroup decoder*/
--
--
--#endif
--#ifdef __cplusplus
--}
--#endif
-diff --git a/vpx_codec/vpx_encoder.h b/vpx_codec/vpx_encoder.h
-deleted file mode 100644
-index 67393be..0000000
---- a/vpx_codec/vpx_encoder.h
-+++ /dev/null
-@@ -1,792 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\defgroup encoder Encoder Algorithm Interface
-- * \ingroup codec
-- * This abstraction allows applications using this encoder to easily support
-- * multiple video formats with minimal code duplication. This section describes
-- * the interface common to all encoders.
-- * @{
-- */
--
--/*!\file vpx_encoder.h
-- * \brief Describes the encoder algorithm interface to applications.
-- *
-- * This file describes the interface between an application and a
-- * video encoder algorithm.
-- *
-- */
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifndef VPX_ENCODER_H
--#define VPX_ENCODER_H
--#include "vpx_codec.h"
--
--
-- /*!\brief Current ABI version number
-- *
-- * \internal
-- * If this file is altered in any way that changes the ABI, this value
-- * must be bumped. Examples include, but are not limited to, changing
-- * types, removing or reassigning enums, adding/removing/rearranging
-- * fields to structures
-- */
--#define VPX_ENCODER_ABI_VERSION (2 + VPX_CODEC_ABI_VERSION) /**<\hideinitializer*/
--
--
-- /*! \brief Encoder capabilities bitfield
-- *
-- * Each encoder advertises the capabilities it supports as part of its
-- * ::vpx_codec_iface_t interface structure. Capabilities are extra
-- * interfaces or functionality, and are not required to be supported
-- * by an encoder.
-- *
-- * The available flags are specifiedby VPX_CODEC_CAP_* defines.
-- */
--#define VPX_CODEC_CAP_PSNR 0x10000 /**< Can issue PSNR packets */
--
--
-- /*! \brief Initialization-time Feature Enabling
-- *
-- * Certain codec features must be known at initialization time, to allow
-- * for proper memory allocation.
-- *
-- * The available flags are specified by VPX_CODEC_USE_* defines.
-- */
--#define VPX_CODEC_USE_PSNR 0x10000 /**< Calculate PSNR on each frame */
--
--
-- /*!\brief Generic fixed size buffer structure
-- *
-- * This structure is able to hold a reference to any fixed size buffer.
-- */
-- typedef struct vpx_fixed_buf
-- {
-- void *buf; /**< Pointer to the data */
-- size_t sz; /**< Length of the buffer, in chars */
-- } vpx_fixed_buf_t; /**< alias for struct vpx_fixed_buf */
--
--
-- /*!\brief Time Stamp Type
-- *
-- * An integer, which when multiplied by the stream's time base, provides
-- * the absolute time of a sample.
-- */
-- typedef int64_t vpx_codec_pts_t;
--
--
-- /*!\brief Compressed Frame Flags
-- *
-- * This type represents a bitfield containing information about a compressed
-- * frame that may be useful to an application. The most significant 16 bits
-- * can be used by an algorithm to provide additional detail, for example to
-- * support frame types that are codec specific (MPEG-1 D-frames for example)
-- */
-- typedef uint32_t vpx_codec_frame_flags_t;
--#define VPX_FRAME_IS_KEY 0x1 /**< frame is the start of a GOP */
--#define VPX_FRAME_IS_DROPPABLE 0x2 /**< frame can be dropped without affecting
-- the stream (no future frame depends on
-- this one) */
--#define VPX_FRAME_IS_INVISIBLE 0x4 /**< frame should be decoded but will not
-- be shown */
--
--
-- /*!\brief Encoder output packet variants
-- *
-- * This enumeration lists the different kinds of data packets that can be
-- * returned by calls to vpx_codec_get_cx_data(). Algorithms \ref MAY
-- * extend this list to provide additional functionality.
-- */
-- enum vpx_codec_cx_pkt_kind
-- {
-- VPX_CODEC_CX_FRAME_PKT, /**< Compressed video frame */
-- VPX_CODEC_STATS_PKT, /**< Two-pass statistics for this frame */
-- VPX_CODEC_PSNR_PKT, /**< PSNR statistics for this frame */
-- VPX_CODEC_CUSTOM_PKT = 256 /**< Algorithm extensions */
-- };
--
--
-- /*!\brief Encoder output packet
-- *
-- * This structure contains the different kinds of output data the encoder
-- * may produce while compressing a frame.
-- */
-- typedef struct vpx_codec_cx_pkt
-- {
-- enum vpx_codec_cx_pkt_kind kind; /**< packet variant */
-- union
-- {
-- struct
-- {
-- void *buf; /**< compressed data buffer */
-- size_t sz; /**< length of compressed data */
-- vpx_codec_pts_t pts; /**< time stamp to show frame
-- (in timebase units) */
-- unsigned long duration; /**< duration to show frame
-- (in timebase units) */
-- vpx_codec_frame_flags_t flags; /**< flags for this frame */
-- } frame; /**< data for compressed frame packet */
-- struct vpx_fixed_buf twopass_stats; /**< data for two-pass packet */
-- struct vpx_psnr_pkt
-- {
-- unsigned int samples[4]; /**< Number of samples, total/y/u/v */
-- uint64_t sse[4]; /**< sum squared error, total/y/u/v */
-- double psnr[4]; /**< PSNR, total/y/u/v */
-- } psnr; /**< data for PSNR packet */
-- struct vpx_fixed_buf raw; /**< data for arbitrary packets */
--
-- /* This packet size is fixed to allow codecs to extend this
-- * interface without having to manage storage for raw packets,
-- * ie if it's smaller than 128 bytes, you can store in the
-- * packet list directly.
-- */
-- char pad[128 - sizeof(enum vpx_codec_cx_pkt_kind)]; /**< fixed sz */
-- } data; /**< packet data */
-- } vpx_codec_cx_pkt_t; /**< alias for struct vpx_codec_cx_pkt */
--
--
-- /*!\brief Rational Number
-- *
-- * This structure holds a fractional value.
-- */
-- typedef struct vpx_rational
-- {
-- int num; /**< fraction numerator */
-- int den; /**< fraction denominator */
-- } vpx_rational_t; /**< alias for struct vpx_rational */
--
--
-- /*!\brief Multi-pass Encoding Pass */
-- enum vpx_enc_pass
-- {
-- VPX_RC_ONE_PASS, /**< Single pass mode */
-- VPX_RC_FIRST_PASS, /**< First pass of multi-pass mode */
-- VPX_RC_LAST_PASS, /**< Final pass of multi-pass mode */
-- };
--
--
-- /*!\brief Rate control mode */
-- enum vpx_rc_mode
-- {
-- VPX_VBR, /**< Variable Bit Rate (VBR) mode */
-- VPX_CBR /**< Constant Bit Rate (CBR) mode */
-- };
--
--
-- /*!\brief Keyframe placement mode.
-- *
-- * This enumeration determines whether keyframes are placed automatically by
-- * the encoder or whether this behavior is disabled. Older releases of this
-- * SDK were implemented such that VPX_KF_FIXED meant keyframes were disabled.
-- * This name is confusing for this behavior, so the new symbols to be used
-- * are VPX_KF_AUTO and VPX_KF_DISABLED.
-- */
-- enum vpx_kf_mode
-- {
-- VPX_KF_FIXED, /**< deprecated, implies VPX_KF_DISABLED */
-- VPX_KF_AUTO, /**< Encoder determines optimal placement automatically */
-- VPX_KF_DISABLED = 0 /**< Encoder does not place keyframes. */
-- };
--
--
-- /*!\brief Encoded Frame Flags
-- *
-- * This type indicates a bitfield to be passed to vpx_codec_encode(), defining
-- * per-frame boolean values. By convention, bits common to all codecs will be
-- * named VPX_EFLAG_*, and bits specific to an algorithm will be named
-- * /algo/_eflag_*. The lower order 16 bits are reserved for common use.
-- */
-- typedef long vpx_enc_frame_flags_t;
--#define VPX_EFLAG_FORCE_KF (1<<0) /**< Force this frame to be a keyframe */
--
--
-- /*!\brief Encoder configuration structure
-- *
-- * This structure contains the encoder settings that have common representations
-- * across all codecs. This doesn't imply that all codecs support all features,
-- * however.
-- */
-- typedef struct vpx_codec_enc_cfg
-- {
-- /*
-- * generic settings (g)
-- */
--
-- /*!\brief Algorithm specific "usage" value
-- *
-- * Algorithms may define multiple values for usage, which may convey the
-- * intent of how the application intends to use the stream. If this value
-- * is non-zero, consult the documentation for the codec to determine its
-- * meaning.
-- */
-- unsigned int g_usage;
--
--
-- /*!\brief Maximum number of threads to use
-- *
-- * For multi-threaded implementations, use no more than this number of
-- * threads. The codec may use fewer threads than allowed. The value
-- * 0 is equivalent to the value 1.
-- */
-- unsigned int g_threads;
--
--
-- /*!\brief Bitstream profile to use
-- *
-- * Some codecs support a notion of multiple bitstream profiles. Typically
-- * this maps to a set of features that are turned on or off. Often the
-- * profile to use is determined by the features of the intended decoder.
-- * Consult the documentation for the codec to determine the valid values
-- * for this parameter, or set to zero for a sane default.
-- */
-- unsigned int g_profile; /**< profile of bitstream to use */
--
--
--
-- /*!\brief Width of the frame
-- *
-- * This value identifies the presentation resolution of the frame,
-- * in pixels. Note that the frames passed as input to the encoder must
-- * have this resolution. Frames will be presented by the decoder in this
-- * resolution, independent of any spatial resampling the encoder may do.
-- */
-- unsigned int g_w;
--
--
-- /*!\brief Height of the frame
-- *
-- * This value identifies the presentation resolution of the frame,
-- * in pixels. Note that the frames passed as input to the encoder must
-- * have this resolution. Frames will be presented by the decoder in this
-- * resolution, independent of any spatial resampling the encoder may do.
-- */
-- unsigned int g_h;
--
--
-- /*!\brief Stream timebase units
-- *
-- * Indicates the smallest interval of time, in seconds, used by the stream.
-- * For fixed frame rate material, or variable frame rate material where
-- * frames are timed at a multiple of a given clock (ex: video capture),
-- * the \ref RECOMMENDED method is to set the timebase to the reciprocal
-- * of the frame rate (ex: 1001/30000 for 29.970 Hz NTSC). This allows the
-- * pts to correspond to the frame number, which can be handy. For
-- * re-encoding video from containers with absolute time timestamps, the
-- * \ref RECOMMENDED method is to set the timebase to that of the parent
-- * container or multimedia framework (ex: 1/1000 for ms, as in FLV).
-- */
-- struct vpx_rational g_timebase;
--
--
-- /*!\brief Enable error resilient mode.
-- *
-- * Error resilient mode indicates to the encoder that it should take
-- * measures appropriate for streaming over lossy or noisy links, if
-- * possible. Set to 1 to enable this feature, 0 to disable it.
-- */
-- unsigned int g_error_resilient;
--
--
-- /*!\brief Multi-pass Encoding Mode
-- *
-- * This value should be set to the current phase for multi-pass encoding.
-- * For single pass, set to #VPX_RC_ONE_PASS.
-- */
-- enum vpx_enc_pass g_pass;
--
--
-- /*!\brief Allow lagged encoding
-- *
-- * If set, this value allows the encoder to consume a number of input
-- * frames before producing output frames. This allows the encoder to
-- * base decisions for the current frame on future frames. This does
-- * increase the latency of the encoding pipeline, so it is not appropriate
-- * in all situations (ex: realtime encoding).
-- *
-- * Note that this is a maximum value -- the encoder may produce frames
-- * sooner than the given limit. Set this value to 0 to disable this
-- * feature.
-- */
-- unsigned int g_lag_in_frames;
--
--
-- /*
-- * rate control settings (rc)
-- */
--
-- /*!\brief Temporal resampling configuration, if supported by the codec.
-- *
-- * Temporal resampling allows the codec to "drop" frames as a strategy to
-- * meet its target data rate. This can cause temporal discontinuities in
-- * the encoded video, which may appear as stuttering during playback. This
-- * trade-off is often acceptable, but for many applications is not. It can
-- * be disabled in these cases.
-- *
-- * Note that not all codecs support this feature. All vpx VPx codecs do.
-- * For other codecs, consult the documentation for that algorithm.
-- *
-- * This threshold is described as a percentage of the target data buffer.
-- * When the data buffer falls below this percentage of fullness, a
-- * dropped frame is indicated. Set the threshold to zero (0) to disable
-- * this feature.
-- */
-- unsigned int rc_dropframe_thresh;
--
--
-- /*!\brief Enable/disable spatial resampling, if supported by the codec.
-- *
-- * Spatial resampling allows the codec to compress a lower resolution
-- * version of the frame, which is then upscaled by the encoder to the
-- * correct presentation resolution. This increases visual quality at
-- * low data rates, at the expense of CPU time on the encoder/decoder.
-- */
-- unsigned int rc_resize_allowed;
--
--
-- /*!\brief Spatial resampling up watermark.
-- *
-- * This threshold is described as a percentage of the target data buffer.
-- * When the data buffer rises above this percentage of fullness, the
-- * encoder will step up to a higher resolution version of the frame.
-- */
-- unsigned int rc_resize_up_thresh;
--
--
-- /*!\brief Spatial resampling down watermark.
-- *
-- * This threshold is described as a percentage of the target data buffer.
-- * When the data buffer falls below this percentage of fullness, the
-- * encoder will step down to a lower resolution version of the frame.
-- */
-- unsigned int rc_resize_down_thresh;
--
--
-- /*!\brief Rate control algorithm to use.
-- *
-- * Indicates whether the end usage of this stream is to be streamed over
-- * a bandwidth constrained link, indicating that Constant Bit Rate (CBR)
-- * mode should be used, or whether it will be played back on a high
-- * bandwidth link, as from a local disk, where higher variations in
-- * bitrate are acceptable.
-- */
-- enum vpx_rc_mode rc_end_usage;
--
--
-- /*!\brief Two-pass stats buffer.
-- *
-- * A buffer containing all of the stats packets produced in the first
-- * pass, concatenated.
-- */
-- struct vpx_fixed_buf rc_twopass_stats_in;
--
--
-- /*!\brief Target data rate
-- *
-- * Target bandwidth to use for this stream, in kilobits per second.
-- */
-- unsigned int rc_target_bitrate;
--
--
-- /*
-- * quantizer settings
-- */
--
--
-- /*!\brief Minimum (Best Quality) Quantizer
-- *
-- * The quantizer is the most direct control over the quality of the
-- * encoded image. The range of valid values for the quantizer is codec
-- * specific. Consult the documentation for the codec to determine the
-- * values to use. To determine the range programmatically, call
-- * vpx_codec_enc_config_default() with a usage value of 0.
-- */
-- unsigned int rc_min_quantizer;
--
--
-- /*!\brief Maximum (Worst Quality) Quantizer
-- *
-- * The quantizer is the most direct control over the quality of the
-- * encoded image. The range of valid values for the quantizer is codec
-- * specific. Consult the documentation for the codec to determine the
-- * values to use. To determine the range programmatically, call
-- * vpx_codec_enc_config_default() with a usage value of 0.
-- */
-- unsigned int rc_max_quantizer;
--
--
-- /*
-- * bitrate tolerance
-- */
--
--
-- /*!\brief Rate control undershoot tolerance
-- *
-- * This value, expressed as a percentage of the target bitrate, describes
-- * the target bitrate for easier frames, allowing bits to be saved for
-- * harder frames. Set to zero to use the codec default.
-- */
-- unsigned int rc_undershoot_pct;
--
--
-- /*!\brief Rate control overshoot tolerance
-- *
-- * This value, expressed as a percentage of the target bitrate, describes
-- * the maximum allowed bitrate for a given frame. Set to zero to use the
-- * codec default.
-- */
-- unsigned int rc_overshoot_pct;
--
--
-- /*
-- * decoder buffer model parameters
-- */
--
--
-- /*!\brief Decoder Buffer Size
-- *
-- * This value indicates the amount of data that may be buffered by the
-- * decoding application. Note that this value is expressed in units of
-- * time (milliseconds). For example, a value of 5000 indicates that the
-- * client will buffer (at least) 5000ms worth of encoded data. Use the
-- * target bitrate (#rc_target_bitrate) to convert to bits/bytes, if
-- * necessary.
-- */
-- unsigned int rc_buf_sz;
--
--
-- /*!\brief Decoder Buffer Initial Size
-- *
-- * This value indicates the amount of data that will be buffered by the
-- * decoding application prior to beginning playback. This value is
-- * expressed in units of time (milliseconds). Use the target bitrate
-- * (#rc_target_bitrate) to convert to bits/bytes, if necessary.
-- */
-- unsigned int rc_buf_initial_sz;
--
--
-- /*!\brief Decoder Buffer Optimal Size
-- *
-- * This value indicates the amount of data that the encoder should try
-- * to maintain in the decoder's buffer. This value is expressed in units
-- * of time (milliseconds). Use the target bitrate (#rc_target_bitrate)
-- * to convert to bits/bytes, if necessary.
-- */
-- unsigned int rc_buf_optimal_sz;
--
--
-- /*
-- * 2 pass rate control parameters
-- */
--
--
-- /*!\brief Two-pass mode CBR/VBR bias
-- *
-- * Bias, expressed on a scale of 0 to 100, for determining target size
-- * for the current frame. The value 0 indicates the optimal CBR mode
-- * value should be used. The value 100 indicates the optimal VBR mode
-- * value should be used. Values in between indicate which way the
-- * encoder should "lean."
-- */
-- unsigned int rc_2pass_vbr_bias_pct; /**< RC mode bias between CBR and VBR(0-100: 0->CBR, 100->VBR) */
--
--
-- /*!\brief Two-pass mode per-GOP minimum bitrate
-- *
-- * This value, expressed as a percentage of the target bitrate, indicates
-- * the minimum bitrate to be used for a single GOP (aka "section")
-- */
-- unsigned int rc_2pass_vbr_minsection_pct;
--
--
-- /*!\brief Two-pass mode per-GOP maximum bitrate
-- *
-- * This value, expressed as a percentage of the target bitrate, indicates
-- * the maximum bitrate to be used for a single GOP (aka "section")
-- */
-- unsigned int rc_2pass_vbr_maxsection_pct;
--
--
-- /*
-- * keyframing settings (kf)
-- */
--
-- /*!\brief Keyframe placement mode
-- *
-- * This value indicates whether the encoder should place keyframes at a
-- * fixed interval, or determine the optimal placement automatically
-- * (as governed by the #kf_min_dist and #kf_max_dist parameters)
-- */
-- enum vpx_kf_mode kf_mode;
--
--
-- /*!\brief Keyframe minimum interval
-- *
-- * This value, expressed as a number of frames, prevents the encoder from
-- * placing a keyframe nearer than kf_min_dist to the previous keyframe. At
-- * least kf_min_dist frames non-keyframes will be coded before the next
-- * keyframe. Set kf_min_dist equal to kf_max_dist for a fixed interval.
-- */
-- unsigned int kf_min_dist;
--
--
-- /*!\brief Keyframe maximum interval
-- *
-- * This value, expressed as a number of frames, forces the encoder to code
-- * a keyframe if one has not been coded in the last kf_max_dist frames.
-- * A value of 0 implies all frames will be keyframes. Set kf_min_dist
-- * equal to kf_max_dist for a fixed interval.
-- */
-- unsigned int kf_max_dist;
--
-- } vpx_codec_enc_cfg_t; /**< alias for struct vpx_codec_enc_cfg */
--
--
-- /*!\brief Initialize an encoder instance
-- *
-- * Initializes a encoder context using the given interface. Applications
-- * should call the vpx_codec_enc_init convenience macro instead of this
-- * function directly, to ensure that the ABI version number parameter
-- * is properly initialized.
-- *
-- * In XMA mode (activated by setting VPX_CODEC_USE_XMA in the flags
-- * parameter), the storage pointed to by the cfg parameter must be
-- * kept readable and stable until all memory maps have been set.
-- *
-- * \param[in] ctx Pointer to this instance's context.
-- * \param[in] iface Pointer to the algorithm interface to use.
-- * \param[in] cfg Configuration to use, if known. May be NULL.
-- * \param[in] flags Bitfield of VPX_CODEC_USE_* flags
-- * \param[in] ver ABI version number. Must be set to
-- * VPX_ENCODER_ABI_VERSION
-- * \retval #VPX_CODEC_OK
-- * The decoder algorithm initialized.
-- * \retval #VPX_CODEC_MEM_ERROR
-- * Memory allocation failed.
-- */
-- vpx_codec_err_t vpx_codec_enc_init_ver(vpx_codec_ctx_t *ctx,
-- vpx_codec_iface_t *iface,
-- vpx_codec_enc_cfg_t *cfg,
-- vpx_codec_flags_t flags,
-- int ver);
--
--
-- /*!\brief Convenience macro for vpx_codec_enc_init_ver()
-- *
-- * Ensures the ABI version parameter is properly set.
-- */
--#define vpx_codec_enc_init(ctx, iface, cfg, flags) \
-- vpx_codec_enc_init_ver(ctx, iface, cfg, flags, VPX_ENCODER_ABI_VERSION)
--
--
-- /*!\brief Get a default configuration
-- *
-- * Initializes a encoder configuration structure with default values. Supports
-- * the notion of "usages" so that an algorithm may offer different default
-- * settings depending on the user's intended goal. This function \ref SHOULD
-- * be called by all applications to initialize the configuration structure
-- * before specializing the configuration with application specific values.
-- *
-- * \param[in] iface Pointer to the algorithm interface to use.
-- * \param[out] cfg Configuration buffer to populate
-- * \param[in] usage End usage. Set to 0 or use codec specific values.
-- *
-- * \retval #VPX_CODEC_OK
-- * The configuration was populated.
-- * \retval #VPX_CODEC_INCAPABLE
-- * Interface is not an encoder interface.
-- * \retval #VPX_CODEC_INVALID_PARAM
-- * A parameter was NULL, or the usage value was not recognized.
-- */
-- vpx_codec_err_t vpx_codec_enc_config_default(vpx_codec_iface_t *iface,
-- vpx_codec_enc_cfg_t *cfg,
-- unsigned int usage);
--
--
-- /*!\brief Set or change configuration
-- *
-- * Reconfigures an encoder instance according to the given configuration.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] cfg Configuration buffer to use
-- *
-- * \retval #VPX_CODEC_OK
-- * The configuration was populated.
-- * \retval #VPX_CODEC_INCAPABLE
-- * Interface is not an encoder interface.
-- * \retval #VPX_CODEC_INVALID_PARAM
-- * A parameter was NULL, or the usage value was not recognized.
-- */
-- vpx_codec_err_t vpx_codec_enc_config_set(vpx_codec_ctx_t *ctx,
-- const vpx_codec_enc_cfg_t *cfg);
--
--
-- /*!\brief Get global stream headers
-- *
-- * Retrieves a stream level global header packet, if supported by the codec.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- *
-- * \retval NULL
-- * Encoder does not support global header
-- * \retval Non-NULL
-- * Pointer to buffer containing global header packet
-- */
-- vpx_fixed_buf_t *vpx_codec_get_global_headers(vpx_codec_ctx_t *ctx);
--
--
--#define VPX_DL_REALTIME (1) /**< deadline parameter analogous to
-- * VPx REALTIME mode. */
--#define VPX_DL_GOOD_QUALITY (1000000) /**< deadline parameter analogous to
-- * VPx GOOD QUALITY mode. */
--#define VPX_DL_BEST_QUALITY (0) /**< deadline parameter analogous to
-- * VPx BEST QUALITY mode. */
-- /*!\brief Encode a frame
-- *
-- * Encodes a video frame at the given "presentation time." The presentation
-- * time stamp (PTS) \ref MUST be strictly increasing.
-- *
-- * The encoder supports the notion of a soft real-time deadline. Given a
-- * non-zero value to the deadline parameter, the encoder will make a "best
-- * effort" guarantee to return before the given time slice expires. It is
-- * implicit that limiting the available time to encode will degrade the
-- * output quality. The encoder can be given an unlimited time to produce the
-- * best possible frame by specifying a deadline of '0'. This deadline
-- * supercedes the VPx notion of "best quality, good quality, realtime".
-- * Applications that wish to map these former settings to the new deadline
-- * based system can use the symbols #VPX_DL_REALTIME, #VPX_DL_GOOD_QUALITY,
-- * and #VPX_DL_BEST_QUALITY.
-- *
-- * When the last frame has been passed to the encoder, this function should
-- * continue to be called, with the img parameter set to NULL. This will
-- * signal the end-of-stream condition to the encoder and allow it to encode
-- * any held buffers. Encoding is complete when vpx_codec_encode() is called
-- * and vpx_codec_get_cx_data() returns no data.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] img Image data to encode, NULL to flush.
-- * \param[in] pts Presentation time stamp, in timebase units.
-- * \param[in] duration Duration to show frame, in timebase units.
-- * \param[in] flags Flags to use for encoding this frame.
-- * \param[in] deadline Time to spend encoding, in microseconds. (0=infinite)
-- *
-- * \retval #VPX_CODEC_OK
-- * The configuration was populated.
-- * \retval #VPX_CODEC_INCAPABLE
-- * Interface is not an encoder interface.
-- * \retval #VPX_CODEC_INVALID_PARAM
-- * A parameter was NULL, the image format is unsupported, etc.
-- */
-- vpx_codec_err_t vpx_codec_encode(vpx_codec_ctx_t *ctx,
-- const vpx_image_t *img,
-- vpx_codec_pts_t pts,
-- unsigned long duration,
-- vpx_enc_frame_flags_t flags,
-- unsigned long deadline);
--
--
-- /*!\brief Set compressed data output buffer
-- *
-- * Sets the buffer that the codec should output the compressed data
-- * into. This call effectively sets the buffer pointer returned in the
-- * next VPX_CODEC_CX_FRAME_PKT packet. Subsequent packets will be
-- * appended into this buffer. The buffer is preserved across frames,
-- * so applications must periodically call this function after flushing
-- * the accumulated compressed data to disk or to the network to reset
-- * the pointer to the buffer's head.
-- *
-- * `pad_before` bytes will be skipped before writing the compressed
-- * data, and `pad_after` bytes will be appended to the packet. The size
-- * of the packet will be the sum of the size of the actual compressed
-- * data, pad_before, and pad_after. The padding bytes will be preserved
-- * (not overwritten).
-- *
-- * Note that calling this function does not guarantee that the returned
-- * compressed data will be placed into the specified buffer. In the
-- * event that the encoded data will not fit into the buffer provided,
-- * the returned packet \ref MAY point to an internal buffer, as it would
-- * if this call were never used. In this event, the output packet will
-- * NOT have any padding, and the application must free space and copy it
-- * to the proper place. This is of particular note in configurations
-- * that may output multiple packets for a single encoded frame (e.g., lagged
-- * encoding) or if the application does not reset the buffer periodically.
-- *
-- * Applications may restore the default behavior of the codec providing
-- * the compressed data buffer by calling this function with a NULL
-- * buffer.
-- *
-- * Applications \ref MUSTNOT call this function during iteration of
-- * vpx_codec_get_cx_data().
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in] buf Buffer to store compressed data into
-- * \param[in] pad_before Bytes to skip before writing compressed data
-- * \param[in] pad_after Bytes to skip after writing compressed data
-- *
-- * \retval #VPX_CODEC_OK
-- * The buffer was set successfully.
-- * \retval #VPX_CODEC_INVALID_PARAM
-- * A parameter was NULL, the image format is unsupported, etc.
-- */
-- vpx_codec_err_t vpx_codec_set_cx_data_buf(vpx_codec_ctx_t *ctx,
-- const vpx_fixed_buf_t *buf,
-- unsigned int pad_before,
-- unsigned int pad_after);
--
--
-- /*!\brief Encoded data iterator
-- *
-- * Iterates over a list of data packets to be passed from the encoder to the
-- * application. The different kinds of packets available are enumerated in
-- * #vpx_codec_cx_pkt_kind.
-- *
-- * #VPX_CODEC_CX_FRAME_PKT packets should be passed to the application's
-- * muxer. Multiple compressed frames may be in the list.
-- * #VPX_CODEC_STATS_PKT packets should be appended to a global buffer.
-- *
-- * The application \ref MUST silently ignore any packet kinds that it does
-- * not recognize or support.
-- *
-- * The data buffers returned from this function are only guaranteed to be
-- * valid until the application makes another call to any vpx_codec_* function.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- * \param[in,out] iter Iterator storage, initialized to NULL
-- *
-- * \return Returns a pointer to an output data packet (compressed frame data,
-- * two-pass statistics, etc.) or NULL to signal end-of-list.
-- *
-- */
-- const vpx_codec_cx_pkt_t *vpx_codec_get_cx_data(vpx_codec_ctx_t *ctx,
-- vpx_codec_iter_t *iter);
--
--
-- /*!\brief Get Preview Frame
-- *
-- * Returns an image that can be used as a preview. Shows the image as it would
-- * exist at the decompressor. The application \ref MUST NOT write into this
-- * image buffer.
-- *
-- * \param[in] ctx Pointer to this instance's context
-- *
-- * \return Returns a pointer to a preview image, or NULL if no image is
-- * available.
-- *
-- */
-- const vpx_image_t *vpx_codec_get_preview_frame(vpx_codec_ctx_t *ctx);
--
--
-- /*!@} - end defgroup encoder*/
--
--#endif
--#ifdef __cplusplus
--}
--#endif
-diff --git a/vpx_codec/vpx_image.h b/vpx_codec/vpx_image.h
-deleted file mode 100644
-index a8a9416..0000000
---- a/vpx_codec/vpx_image.h
-+++ /dev/null
-@@ -1,201 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--/*!\file vpx_image.h
-- * \brief Describes the vpx image descriptor and associated operations
-- *
-- */
--#ifdef __cplusplus
--extern "C" {
--#endif
--
--#ifndef VPX_IMAGE_H
--#define VPX_IMAGE_H
--
-- /*!\brief Current ABI version number
-- *
-- * \internal
-- * If this file is altered in any way that changes the ABI, this value
-- * must be bumped. Examples include, but are not limited to, changing
-- * types, removing or reassigning enums, adding/removing/rearranging
-- * fields to structures
-- */
--#define VPX_IMAGE_ABI_VERSION (1) /**<\hideinitializer*/
--
--
--#define IMG_FMT_PLANAR 0x100 /**< Image is a planar format */
--#define IMG_FMT_UV_FLIP 0x200 /**< V plane precedes U plane in memory */
--#define IMG_FMT_HAS_ALPHA 0x400 /**< Image has an alpha channel componnent */
--
--
-- /*!\brief List of supported image formats */
-- typedef enum img_fmt {
-- IMG_FMT_NONE,
-- IMG_FMT_RGB24, /**< 24 bit per pixel packed RGB */
-- IMG_FMT_RGB32, /**< 32 bit per pixel packed 0RGB */
-- IMG_FMT_RGB565, /**< 16 bit per pixel, 565 */
-- IMG_FMT_RGB555, /**< 16 bit per pixel, 555 */
-- IMG_FMT_UYVY, /**< UYVY packed YUV */
-- IMG_FMT_YUY2, /**< YUYV packed YUV */
-- IMG_FMT_YVYU, /**< YVYU packed YUV */
-- IMG_FMT_BGR24, /**< 24 bit per pixel packed BGR */
-- IMG_FMT_RGB32_LE, /**< 32 bit packed BGR0 */
-- IMG_FMT_ARGB, /**< 32 bit packed ARGB, alpha=255 */
-- IMG_FMT_ARGB_LE, /**< 32 bit packed BGRA, alpha=255 */
-- IMG_FMT_RGB565_LE, /**< 16 bit per pixel, gggbbbbb rrrrrggg */
-- IMG_FMT_RGB555_LE, /**< 16 bit per pixel, gggbbbbb 0rrrrrgg */
-- IMG_FMT_YV12 = IMG_FMT_PLANAR | IMG_FMT_UV_FLIP | 1, /**< planar YVU */
-- IMG_FMT_I420 = IMG_FMT_PLANAR | 2,
-- IMG_FMT_VPXYV12 = IMG_FMT_PLANAR | IMG_FMT_UV_FLIP | 3, /** < planar 4:2:0 format with vpx color space */
-- IMG_FMT_VPXI420 = IMG_FMT_PLANAR | 4, /** < planar 4:2:0 format with vpx color space */
-- }
-- img_fmt_t; /**< alias for enum img_fmt */
--
--
-- /**\brief Image Descriptor */
-- typedef struct
-- {
-- img_fmt_t fmt; /**< Image Format */
--
-- /* Image storage dimensions */
-- unsigned int w; /**< Stored image width */
-- unsigned int h; /**< Stored image height */
--
-- /* Image display dimensions */
-- unsigned int d_w; /**< Displayed image width */
-- unsigned int d_h; /**< Displayed image height */
--
-- /* Chroma subsampling info */
-- unsigned int x_chroma_shift; /**< subsampling order, X */
-- unsigned int y_chroma_shift; /**< subsampling order, Y */
--
-- /* Image data pointers. */
--#define PLANE_PACKED 0 /**< To be used for all packed formats */
--#define PLANE_Y 0 /**< Y (Luminance) plane */
--#define PLANE_U 1 /**< U (Chroma) plane */
--#define PLANE_V 2 /**< V (Chroma) plane */
--#define PLANE_ALPHA 3 /**< A (Transparancy) plane */
-- unsigned char *planes[4]; /**< pointer to the top left pixel for each plane */
-- int stride[4]; /**< stride between rows for each plane */
--
-- int bps; /**< bits per sample (for packed formats) */
--
-- /* The following member may be set by the application to associate data
-- * with this image.
-- */
-- void *user_priv; /**< may be set by the application to associate data
-- * with this image. */
--
-- /* The following members should be treated as private. */
-- unsigned char *img_data; /**< private */
-- int img_data_owner; /**< private */
-- int self_allocd; /**< private */
-- } vpx_image_t; /**< alias for struct vpx_image */
--
-- /**\brief Representation of a rectangle on a surface */
-- typedef struct vpx_image_rect
-- {
-- unsigned int x; /**< leftmost column */
-- unsigned int y; /**< topmost row */
-- unsigned int w; /**< width */
-- unsigned int h; /**< height */
-- } vpx_image_rect_t; /**< alias for struct vpx_image_rect */
--
-- /*!\brief Open a descriptor, allocating storage for the underlying image
-- *
-- * Returns a descriptor for storing an image of the given format. The
-- * storage for the descriptor is allocated on the heap.
-- *
-- * \param[in] img Pointer to storage for descriptor. If this parameter
-- * is NULL, the storage for the descriptor will be
-- * allocated on the heap.
-- * \param[in] fmt Format for the image
-- * \param[in] d_w Width of the image
-- * \param[in] d_h Height of the image
-- * \param[in] align Alignment, in bytes, of each row in the image.
-- *
-- * \return Returns a pointer to the initialized image descriptor. If the img
-- * parameter is non-null, the value of the img parameter will be
-- * returned.
-- */
-- vpx_image_t *vpx_img_alloc(vpx_image_t *img,
-- img_fmt_t fmt,
-- unsigned int d_w,
-- unsigned int d_h,
-- unsigned int align);
--
-- /*!\brief Open a descriptor, using existing storage for the underlying image
-- *
-- * Returns a descriptor for storing an image of the given format. The
-- * storage for descriptor has been allocated elsewhere, and a descriptor is
-- * desired to "wrap" that storage.
-- *
-- * \param[in] img Pointer to storage for descriptor. If this parameter
-- * is NULL, the storage for the descriptor will be
-- * allocated on the heap.
-- * \param[in] fmt Format for the image
-- * \param[in] d_w Width of the image
-- * \param[in] d_h Height of the image
-- * \param[in] align Alignment, in bytes, of each row in the image.
-- * \param[in] img_data Storage to use for the image
-- *
-- * \return Returns a pointer to the initialized image descriptor. If the img
-- * parameter is non-null, the value of the img parameter will be
-- * returned.
-- */
-- vpx_image_t *vpx_img_wrap(vpx_image_t *img,
-- img_fmt_t fmt,
-- unsigned int d_w,
-- unsigned int d_h,
-- unsigned int align,
-- unsigned char *img_data);
--
--
-- /*!\brief Set the rectangle identifying the displayed portion of the image
-- *
-- * Updates the displayed rectangle (aka viewport) on the image surface to
-- * match the specified coordinates and size.
-- *
-- * \param[in] img Image descriptor
-- * \param[in] x leftmost column
-- * \param[in] y topmost row
-- * \param[in] w width
-- * \param[in] h height
-- *
-- * \return 0 if the requested rectangle is valid, nonzero otherwise.
-- */
-- int vpx_img_set_rect(vpx_image_t *img,
-- unsigned int x,
-- unsigned int y,
-- unsigned int w,
-- unsigned int h);
--
--
-- /*!\brief Flip the image vertically (top for bottom)
-- *
-- * Adjusts the image descriptor's pointers and strides to make the image
-- * be referenced upside-down.
-- *
-- * \param[in] img Image descriptor
-- */
-- void vpx_img_flip(vpx_image_t *img);
--
-- /*!\brief Close an image descriptor
-- *
-- * Frees all allocated storage associated with an image descriptor.
-- *
-- * \param[in] img Image descriptor
-- */
-- void vpx_img_free(vpx_image_t *img);
--
--#endif
--#ifdef __cplusplus
--}
--#endif
-diff --git a/vpx_mem/include/nds/vpx_mem_nds.h b/vpx_mem/include/nds/vpx_mem_nds.h
-index c332403..361c29b 100644
---- a/vpx_mem/include/nds/vpx_mem_nds.h
-+++ b/vpx_mem/include/nds/vpx_mem_nds.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/include/vpx_mem_intrnl.h b/vpx_mem/include/vpx_mem_intrnl.h
-index 3b68d86..4605b34 100644
---- a/vpx_mem/include/vpx_mem_intrnl.h
-+++ b/vpx_mem/include/vpx_mem_intrnl.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/include/vpx_mem_tracker.h b/vpx_mem/include/vpx_mem_tracker.h
-index ab85d19..49f783e 100644
---- a/vpx_mem/include/vpx_mem_tracker.h
-+++ b/vpx_mem/include/vpx_mem_tracker.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/intel_linux/vpx_mem.c b/vpx_mem/intel_linux/vpx_mem.c
-index 002e407..7bce794 100644
---- a/vpx_mem/intel_linux/vpx_mem.c
-+++ b/vpx_mem/intel_linux/vpx_mem.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/intel_linux/vpx_mem_tracker.c b/vpx_mem/intel_linux/vpx_mem_tracker.c
-index fa023e3..fcbebc9 100644
---- a/vpx_mem/intel_linux/vpx_mem_tracker.c
-+++ b/vpx_mem/intel_linux/vpx_mem_tracker.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_alloc.c b/vpx_mem/memory_manager/hmm_alloc.c
-index 9abd81e..3f10097 100644
---- a/vpx_mem/memory_manager/hmm_alloc.c
-+++ b/vpx_mem/memory_manager/hmm_alloc.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_base.c b/vpx_mem/memory_manager/hmm_base.c
-index 0cacc3f..fbc36de 100644
---- a/vpx_mem/memory_manager/hmm_base.c
-+++ b/vpx_mem/memory_manager/hmm_base.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_dflt_abort.c b/vpx_mem/memory_manager/hmm_dflt_abort.c
-index dc59f55..71b41d9 100644
---- a/vpx_mem/memory_manager/hmm_dflt_abort.c
-+++ b/vpx_mem/memory_manager/hmm_dflt_abort.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_grow.c b/vpx_mem/memory_manager/hmm_grow.c
-index 79d75a7..a979c7a 100644
---- a/vpx_mem/memory_manager/hmm_grow.c
-+++ b/vpx_mem/memory_manager/hmm_grow.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_largest.c b/vpx_mem/memory_manager/hmm_largest.c
-index 5ebe398..82a6a36 100644
---- a/vpx_mem/memory_manager/hmm_largest.c
-+++ b/vpx_mem/memory_manager/hmm_largest.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_resize.c b/vpx_mem/memory_manager/hmm_resize.c
-index 6e3f2f0..cb93bb1 100644
---- a/vpx_mem/memory_manager/hmm_resize.c
-+++ b/vpx_mem/memory_manager/hmm_resize.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_shrink.c b/vpx_mem/memory_manager/hmm_shrink.c
-index 5ef9b23..d845136 100644
---- a/vpx_mem/memory_manager/hmm_shrink.c
-+++ b/vpx_mem/memory_manager/hmm_shrink.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/hmm_true.c b/vpx_mem/memory_manager/hmm_true.c
-index 41103c8..586fc22 100644
---- a/vpx_mem/memory_manager/hmm_true.c
-+++ b/vpx_mem/memory_manager/hmm_true.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/include/cavl_if.h b/vpx_mem/memory_manager/include/cavl_if.h
-index e2733ef..da1b148 100644
---- a/vpx_mem/memory_manager/include/cavl_if.h
-+++ b/vpx_mem/memory_manager/include/cavl_if.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/include/cavl_impl.h b/vpx_mem/memory_manager/include/cavl_impl.h
-index 267bc73..e67cc8a 100644
---- a/vpx_mem/memory_manager/include/cavl_impl.h
-+++ b/vpx_mem/memory_manager/include/cavl_impl.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/include/heapmm.h b/vpx_mem/memory_manager/include/heapmm.h
-index 933e30d..4e46c41 100644
---- a/vpx_mem/memory_manager/include/heapmm.h
-+++ b/vpx_mem/memory_manager/include/heapmm.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/include/hmm_cnfg.h b/vpx_mem/memory_manager/include/hmm_cnfg.h
-index 86e4e9f..715163c 100644
---- a/vpx_mem/memory_manager/include/hmm_cnfg.h
-+++ b/vpx_mem/memory_manager/include/hmm_cnfg.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/memory_manager/include/hmm_intrnl.h b/vpx_mem/memory_manager/include/hmm_intrnl.h
-index 6e2be08..1dddb8a 100644
---- a/vpx_mem/memory_manager/include/hmm_intrnl.h
-+++ b/vpx_mem/memory_manager/include/hmm_intrnl.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/nds/vpx_mem_nds.c b/vpx_mem/nds/vpx_mem_nds.c
-index f2a3043..88d474a 100644
---- a/vpx_mem/nds/vpx_mem_nds.c
-+++ b/vpx_mem/nds/vpx_mem_nds.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c b/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c
-index 6501855..c2a1c28 100644
---- a/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c
-+++ b/vpx_mem/ti_c6x/vpx_mem_ti_6cx.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/vpx_mem.c b/vpx_mem/vpx_mem.c
-index f6b1a35..ba92024 100644
---- a/vpx_mem/vpx_mem.c
-+++ b/vpx_mem/vpx_mem.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/vpx_mem.h b/vpx_mem/vpx_mem.h
-index 6ccb9be..a1239c1 100644
---- a/vpx_mem/vpx_mem.h
-+++ b/vpx_mem/vpx_mem.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_mem/vpx_mem_tracker.c b/vpx_mem/vpx_mem_tracker.c
-index 4427e27..92152a6 100644
---- a/vpx_mem/vpx_mem_tracker.c
-+++ b/vpx_mem/vpx_mem_tracker.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_ports/config.h b/vpx_ports/config.h
-index da38137..9d32393 100644
---- a/vpx_ports/config.h
-+++ b/vpx_ports/config.h
-@@ -1,19 +1,10 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
--
--
--/* This file uses some preprocessor magic to expand the value of HAVE_CONFIG_H,
-- * as defined by the build system, so that different projects can use the file
-- * name for config.h that suits them.
-- */
--#define QUOTE_(x) #x
--#define QUOTE(x) QUOTE_(x)
--#include QUOTE(HAVE_CONFIG_H)
--#undef QUOTE
--#undef QUOTE_
-+#include "vpx_config.h"
-diff --git a/vpx_ports/emms.asm b/vpx_ports/emms.asm
-index 03e3499..096176d 100644
---- a/vpx_ports/emms.asm
-+++ b/vpx_ports/emms.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h
-index 10942f1..ade2e30 100644
---- a/vpx_ports/mem.h
-+++ b/vpx_ports/mem.h
-@@ -1,17 +1,18 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
- #ifndef VPX_PORTS_MEM_H
- #define VPX_PORTS_MEM_H
- #include "vpx_config.h"
--#include "vpx_integer.h"
-+#include "vpx/vpx_integer.h"
-
- #if defined(__GNUC__) && __GNUC__
- #define DECLARE_ALIGNED(n,typ,val) typ val __attribute__ ((aligned (n)))
-diff --git a/vpx_ports/mem_ops.h b/vpx_ports/mem_ops.h
-index 869d583..109c270 100644
---- a/vpx_ports/mem_ops.h
-+++ b/vpx_ports/mem_ops.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_ports/mem_ops_aligned.h b/vpx_ports/mem_ops_aligned.h
-index 1d0db2c..7c4d95e 100644
---- a/vpx_ports/mem_ops_aligned.h
-+++ b/vpx_ports/mem_ops_aligned.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_ports/vpx_integer.h b/vpx_ports/vpx_integer.h
-deleted file mode 100644
-index d3f7ddd..0000000
---- a/vpx_ports/vpx_integer.h
-+++ /dev/null
-@@ -1,52 +0,0 @@
--/*
-- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-- */
--
--
--#ifndef VPX_INTEGER_H
--#define VPX_INTEGER_H
--
--/* get ptrdiff_t, size_t, wchar_t, NULL */
--#include <stddef.h>
--
--#if defined(HAVE_STDINT_H) && HAVE_STDINT_H
--#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS)
--#define __STDC_FORMAT_MACROS
--#endif
--#include <stdint.h>
--#include <inttypes.h>
--#else
--typedef signed char int8_t;
--typedef signed short int16_t;
--typedef signed int int32_t;
--
--typedef unsigned char uint8_t;
--typedef unsigned short uint16_t;
--typedef unsigned int uint32_t;
--
--#if defined(_MSC_VER)
--typedef signed __int64 int64_t;
--typedef unsigned __int64 uint64_t;
--#define PRId64 "I64d"
--#endif
--
--#ifdef HAVE_ARMV6
--typedef unsigned int int_fast16_t;
--#else
--typedef signed short int_fast16_t;
--#endif
--typedef signed char int_fast8_t;
--typedef unsigned char uint_fast8_t;
--
--#ifndef _UINTPTR_T_DEFINED
--typedef unsigned int uintptr_t;
--#endif
--
--#endif
--
--#endif
-diff --git a/vpx_ports/vpx_timer.h b/vpx_ports/vpx_timer.h
-index 5c04538..11fee84 100644
---- a/vpx_ports/vpx_timer.h
-+++ b/vpx_ports/vpx_timer.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_ports/vpxtypes.h b/vpx_ports/vpxtypes.h
-index 86525b7..b9c8b8c 100644
---- a/vpx_ports/vpxtypes.h
-+++ b/vpx_ports/vpxtypes.h
-@@ -1,19 +1,18 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
- #ifndef __VPXTYPES_H__
- #define __VPXTYPES_H__
-
--#ifdef HAVE_CONFIG_H
--#include HAVE_CONFIG_H
--#endif
-+#include "vpx_ports/config.h"
-
- //#include <sys/types.h>
- #ifdef _MSC_VER
-diff --git a/vpx_ports/x86.h b/vpx_ports/x86.h
-index 935d037..8c23abd 100644
---- a/vpx_ports/x86.h
-+++ b/vpx_ports/x86.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_ports/x86_abi_support.asm b/vpx_ports/x86_abi_support.asm
-index db8208f..a1622e6 100644
---- a/vpx_ports/x86_abi_support.asm
-+++ b/vpx_ports/x86_abi_support.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-@@ -198,22 +199,38 @@
- push r9
- %endif
- %if %1 > 6
-- mov rax,[rbp+16]
-- push rax
-- %endif
-- %if %1 > 7
-- mov rax,[rbp+24]
-- push rax
-- %endif
-- %if %1 > 8
-- mov rax,[rbp+32]
-+ %assign i %1-6
-+ %assign off 16
-+ %rep i
-+ mov rax,[rbp+off]
- push rax
-+ %assign off off+8
-+ %endrep
- %endif
- %endm
- %endif
- %define UNSHADOW_ARGS mov rsp, rbp
- %endif
-
-+; must keep XMM6:XMM15 (libvpx uses XMM6 and XMM7) on Win64 ABI
-+; rsp register has to be aligned
-+%ifidn __OUTPUT_FORMAT__,x64
-+%macro SAVE_XMM 0
-+ sub rsp, 32
-+ movdqa XMMWORD PTR [rsp], xmm6
-+ movdqa XMMWORD PTR [rsp+16], xmm7
-+%endmacro
-+%macro RESTORE_XMM 0
-+ movdqa xmm6, XMMWORD PTR [rsp]
-+ movdqa xmm7, XMMWORD PTR [rsp+16]
-+ add rsp, 32
-+%endmacro
-+%else
-+%macro SAVE_XMM 0
-+%endmacro
-+%macro RESTORE_XMM 0
-+%endmacro
-+%endif
-
- ; Name of the rodata section
- ;
-@@ -229,3 +246,14 @@ fake_got:
- %else
- %define SECTION_RODATA section .rodata
- %endif
-+
-+
-+; Tell GNU ld that we don't require an executable stack.
-+%ifidn __OUTPUT_FORMAT__,elf32
-+section .note.GNU-stack noalloc noexec nowrite progbits
-+section .text
-+%elifidn __OUTPUT_FORMAT__,elf64
-+section .note.GNU-stack noalloc noexec nowrite progbits
-+section .text
-+%endif
-+
-diff --git a/vpx_scale/arm/armv4/gen_scalers_armv4.asm b/vpx_scale/arm/armv4/gen_scalers_armv4.asm
-index 1c904ed..e317fe9 100644
---- a/vpx_scale/arm/armv4/gen_scalers_armv4.asm
-+++ b/vpx_scale/arm/armv4/gen_scalers_armv4.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/arm/nds/yv12extend.c b/vpx_scale/arm/nds/yv12extend.c
-index 56959cb..9ec3466 100644
---- a/vpx_scale/arm/nds/yv12extend.c
-+++ b/vpx_scale/arm/nds/yv12extend.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
-index 26384c4..64e7bfe 100644
---- a/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
-+++ b/vpx_scale/arm/neon/vp8_vpxyv12_copyframe_func_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
-index a50ae60..f79de3c 100644
---- a/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
-+++ b/vpx_scale/arm/neon/vp8_vpxyv12_copyframeyonly_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
-index c8923d5..2e24e24 100644
---- a/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
-+++ b/vpx_scale/arm/neon/vp8_vpxyv12_copysrcframe_func_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm b/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
-index 8c9ce19..418578f 100644
---- a/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
-+++ b/vpx_scale/arm/neon/vp8_vpxyv12_extendframeborders_neon.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/arm/scalesystemdependant.c b/vpx_scale/arm/scalesystemdependant.c
-index 3c355be..67954b2 100644
---- a/vpx_scale/arm/scalesystemdependant.c
-+++ b/vpx_scale/arm/scalesystemdependant.c
-@@ -1,18 +1,17 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-+#include "vpx_ports/config.h"
- #include "vpx_scale/vpxscale.h"
-
--#ifdef HAVE_CONFIG_H
--#include "vpx_config.h"
--#endif
-
- void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf);
- extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf);
-diff --git a/vpx_scale/arm/yv12extend_arm.c b/vpx_scale/arm/yv12extend_arm.c
-index 7c3f7cd..5069030 100644
---- a/vpx_scale/arm/yv12extend_arm.c
-+++ b/vpx_scale/arm/yv12extend_arm.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/blackfin/yv12config.c b/vpx_scale/blackfin/yv12config.c
-index 7cb083f..950a5d2 100644
---- a/vpx_scale/blackfin/yv12config.c
-+++ b/vpx_scale/blackfin/yv12config.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/blackfin/yv12extend.c b/vpx_scale/blackfin/yv12extend.c
-index d5be495..80504ef 100644
---- a/vpx_scale/blackfin/yv12extend.c
-+++ b/vpx_scale/blackfin/yv12extend.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/dm642/bicubic_scaler_c64.c b/vpx_scale/dm642/bicubic_scaler_c64.c
-index 9bd3797..e026be5 100644
---- a/vpx_scale/dm642/bicubic_scaler_c64.c
-+++ b/vpx_scale/dm642/bicubic_scaler_c64.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/dm642/gen_scalers_c64.c b/vpx_scale/dm642/gen_scalers_c64.c
-index 2126a75..34f95f7 100644
---- a/vpx_scale/dm642/gen_scalers_c64.c
-+++ b/vpx_scale/dm642/gen_scalers_c64.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/dm642/yv12extend.c b/vpx_scale/dm642/yv12extend.c
-index ca25a5f..2557a3a 100644
---- a/vpx_scale/dm642/yv12extend.c
-+++ b/vpx_scale/dm642/yv12extend.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/generic/bicubic_scaler.c b/vpx_scale/generic/bicubic_scaler.c
-index e3c2b4a..48f9096 100644
---- a/vpx_scale/generic/bicubic_scaler.c
-+++ b/vpx_scale/generic/bicubic_scaler.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/generic/gen_scalers.c b/vpx_scale/generic/gen_scalers.c
-index a5e545f..ff841f3 100644
---- a/vpx_scale/generic/gen_scalers.c
-+++ b/vpx_scale/generic/gen_scalers.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-@@ -936,12 +937,13 @@ void vp8cx_vertical_band_2_1_scale_c(unsigned char *source, unsigned int src_pit
-
- 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)
- {
-- unsigned int i;
-+ int i;
- int temp;
-+ int width = dest_width;
-
- (void) dest_pitch;
-
-- for (i = 0; i < dest_width; i++)
-+ for (i = 0; i < width; i++)
- {
- temp = 8;
- temp += source[i-(int)src_pitch] * 3;
-diff --git a/vpx_scale/generic/scalesystemdependant.c b/vpx_scale/generic/scalesystemdependant.c
-index 28f5c72..7a24a26 100644
---- a/vpx_scale/generic/scalesystemdependant.c
-+++ b/vpx_scale/generic/scalesystemdependant.c
-@@ -1,18 +1,17 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-+#include "vpx_ports/config.h"
- #include "vpx_scale/vpxscale.h"
-
--#ifdef HAVE_CONFIG_H
--#include "vpx_config.h"
--#endif
-
- void (*vp8_yv12_extend_frame_borders_ptr)(YV12_BUFFER_CONFIG *ybf);
- extern void vp8_yv12_extend_frame_borders(YV12_BUFFER_CONFIG *ybf);
-diff --git a/vpx_scale/generic/vpxscale.c b/vpx_scale/generic/vpxscale.c
-index 206cd55..8f8cfb5 100644
---- a/vpx_scale/generic/vpxscale.c
-+++ b/vpx_scale/generic/vpxscale.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c
-index 04617be..008130b 100644
---- a/vpx_scale/generic/yv12config.c
-+++ b/vpx_scale/generic/yv12config.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/generic/yv12extend.c b/vpx_scale/generic/yv12extend.c
-index 4906625..907fa68 100644
---- a/vpx_scale/generic/yv12extend.c
-+++ b/vpx_scale/generic/yv12extend.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/arm/vpxscale_nofp.h b/vpx_scale/include/arm/vpxscale_nofp.h
-index d6181d2..39e3742 100644
---- a/vpx_scale/include/arm/vpxscale_nofp.h
-+++ b/vpx_scale/include/arm/vpxscale_nofp.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/generic/vpxscale_arbitrary.h b/vpx_scale/include/generic/vpxscale_arbitrary.h
-index 2b50f24..68b8fc0 100644
---- a/vpx_scale/include/generic/vpxscale_arbitrary.h
-+++ b/vpx_scale/include/generic/vpxscale_arbitrary.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/generic/vpxscale_depricated.h b/vpx_scale/include/generic/vpxscale_depricated.h
-index 015eed0..dbe7786 100644
---- a/vpx_scale/include/generic/vpxscale_depricated.h
-+++ b/vpx_scale/include/generic/vpxscale_depricated.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/generic/vpxscale_nofp.h b/vpx_scale/include/generic/vpxscale_nofp.h
-index c4d5f4c..97ea60e 100644
---- a/vpx_scale/include/generic/vpxscale_nofp.h
-+++ b/vpx_scale/include/generic/vpxscale_nofp.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/leapster/vpxscale.h b/vpx_scale/include/leapster/vpxscale.h
-index f70029c..a40f2eb 100644
---- a/vpx_scale/include/leapster/vpxscale.h
-+++ b/vpx_scale/include/leapster/vpxscale.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/symbian/vpxscale_nofp.h b/vpx_scale/include/symbian/vpxscale_nofp.h
-index d6181d2..39e3742 100644
---- a/vpx_scale/include/symbian/vpxscale_nofp.h
-+++ b/vpx_scale/include/symbian/vpxscale_nofp.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/include/vpxscale_nofp.h b/vpx_scale/include/vpxscale_nofp.h
-index f6482f9..f39a1c6 100644
---- a/vpx_scale/include/vpxscale_nofp.h
-+++ b/vpx_scale/include/vpxscale_nofp.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/intel_linux/scaleopt.c b/vpx_scale/intel_linux/scaleopt.c
-index 6555600..1bdb488 100644
---- a/vpx_scale/intel_linux/scaleopt.c
-+++ b/vpx_scale/intel_linux/scaleopt.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/intel_linux/scalesystemdependant.c b/vpx_scale/intel_linux/scalesystemdependant.c
-index 9ed48bf..82b90c9 100644
---- a/vpx_scale/intel_linux/scalesystemdependant.c
-+++ b/vpx_scale/intel_linux/scalesystemdependant.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/leapster/doptsystemdependant_lf.c b/vpx_scale/leapster/doptsystemdependant_lf.c
-index ca13167..f4ccb16 100644
---- a/vpx_scale/leapster/doptsystemdependant_lf.c
-+++ b/vpx_scale/leapster/doptsystemdependant_lf.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/leapster/gen_scalers_lf.c b/vpx_scale/leapster/gen_scalers_lf.c
-index 1b9c7c7..f9a11fe 100644
---- a/vpx_scale/leapster/gen_scalers_lf.c
-+++ b/vpx_scale/leapster/gen_scalers_lf.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/leapster/vpxscale_lf.c b/vpx_scale/leapster/vpxscale_lf.c
-index 5f05e5d..deabd98 100644
---- a/vpx_scale/leapster/vpxscale_lf.c
-+++ b/vpx_scale/leapster/vpxscale_lf.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/leapster/yv12extend.c b/vpx_scale/leapster/yv12extend.c
-index 480d971..5a89c31 100644
---- a/vpx_scale/leapster/yv12extend.c
-+++ b/vpx_scale/leapster/yv12extend.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/scale_mode.h b/vpx_scale/scale_mode.h
-index 2a9ab76..41aefa2 100644
---- a/vpx_scale/scale_mode.h
-+++ b/vpx_scale/scale_mode.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/symbian/gen_scalers_armv4.asm b/vpx_scale/symbian/gen_scalers_armv4.asm
-index 1c904ed..e317fe9 100644
---- a/vpx_scale/symbian/gen_scalers_armv4.asm
-+++ b/vpx_scale/symbian/gen_scalers_armv4.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/symbian/scalesystemdependant.c b/vpx_scale/symbian/scalesystemdependant.c
-index a2acc3e..75ef26d 100644
---- a/vpx_scale/symbian/scalesystemdependant.c
-+++ b/vpx_scale/symbian/scalesystemdependant.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/vpxscale.h b/vpx_scale/vpxscale.h
-index 9a86b75..f3057fe 100644
---- a/vpx_scale/vpxscale.h
-+++ b/vpx_scale/vpxscale.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/wce/gen_scalers_armv4.asm b/vpx_scale/wce/gen_scalers_armv4.asm
-index 1c904ed..e317fe9 100644
---- a/vpx_scale/wce/gen_scalers_armv4.asm
-+++ b/vpx_scale/wce/gen_scalers_armv4.asm
-@@ -1,10 +1,11 @@
- ;
- ; Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- ;
--; Use of this source code is governed by a BSD-style license and patent
--; grant that can be found in the LICENSE file in the root of the source
--; tree. All contributing project authors may be found in the AUTHORS
--; file in the root of the source tree.
-+; Use of this source code is governed by a BSD-style license
-+; that can be found in the LICENSE file in the root of the source
-+; tree. An additional intellectual property rights grant can be found
-+; in the file PATENTS. All contributing project authors may
-+; be found in the AUTHORS file in the root of the source tree.
- ;
-
-
-diff --git a/vpx_scale/wce/scalesystemdependant.c b/vpx_scale/wce/scalesystemdependant.c
-index a5a6a52..1d62eb5 100644
---- a/vpx_scale/wce/scalesystemdependant.c
-+++ b/vpx_scale/wce/scalesystemdependant.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/win32/scaleopt.c b/vpx_scale/win32/scaleopt.c
-index da0533e..59d49e6 100644
---- a/vpx_scale/win32/scaleopt.c
-+++ b/vpx_scale/win32/scaleopt.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/win32/scalesystemdependant.c b/vpx_scale/win32/scalesystemdependant.c
-index 9ed48bf..82b90c9 100644
---- a/vpx_scale/win32/scalesystemdependant.c
-+++ b/vpx_scale/win32/scalesystemdependant.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/x86_64/scaleopt.c b/vpx_scale/x86_64/scaleopt.c
-index 3d2d5f2..de4c478 100644
---- a/vpx_scale/x86_64/scaleopt.c
-+++ b/vpx_scale/x86_64/scaleopt.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/x86_64/scalesystemdependant.c b/vpx_scale/x86_64/scalesystemdependant.c
-index 43f05a6..0324449 100644
---- a/vpx_scale/x86_64/scalesystemdependant.c
-+++ b/vpx_scale/x86_64/scalesystemdependant.c
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/yv12config.h b/vpx_scale/yv12config.h
-index a8d0ce4..f01bd78 100644
---- a/vpx_scale/yv12config.h
-+++ b/vpx_scale/yv12config.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/vpx_scale/yv12extend.h b/vpx_scale/yv12extend.h
-index 9968fea..b310ef5 100644
---- a/vpx_scale/yv12extend.h
-+++ b/vpx_scale/yv12extend.h
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/wince_wmain_adapter.cpp b/wince_wmain_adapter.cpp
-index db2119c..48d3ab3 100644
---- a/wince_wmain_adapter.cpp
-+++ b/wince_wmain_adapter.cpp
-@@ -1,10 +1,11 @@
- /*
- * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
- *
-- * Use of this source code is governed by a BSD-style license and patent
-- * grant that can be found in the LICENSE file in the root of the source
-- * tree. All contributing project authors may be found in the AUTHORS
-- * file in the root of the source tree.
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
- */
-
-
-diff --git a/y4minput.c b/y4minput.c
-new file mode 100644
-index 0000000..895226d
---- /dev/null
-+++ b/y4minput.c
-@@ -0,0 +1,881 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ *
-+ * Based on code from the OggTheora software codec source code,
-+ * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
-+ */
-+#include <stdlib.h>
-+#include <string.h>
-+#include "y4minput.h"
-+
-+static int y4m_parse_tags(y4m_input *_y4m,char *_tags){
-+ int got_w;
-+ int got_h;
-+ int got_fps;
-+ int got_interlace;
-+ int got_par;
-+ int got_chroma;
-+ char *p;
-+ char *q;
-+ got_w=got_h=got_fps=got_interlace=got_par=got_chroma=0;
-+ for(p=_tags;;p=q){
-+ /*Skip any leading spaces.*/
-+ while(*p==' ')p++;
-+ /*If that's all we have, stop.*/
-+ if(p[0]=='\0')break;
-+ /*Find the end of this tag.*/
-+ for(q=p+1;*q!='\0'&&*q!=' ';q++);
-+ /*Process the tag.*/
-+ switch(p[0]){
-+ case 'W':{
-+ if(sscanf(p+1,"%d",&_y4m->pic_w)!=1)return -1;
-+ got_w=1;
-+ }break;
-+ case 'H':{
-+ if(sscanf(p+1,"%d",&_y4m->pic_h)!=1)return -1;
-+ got_h=1;
-+ }break;
-+ case 'F':{
-+ if(sscanf(p+1,"%d:%d",&_y4m->fps_n,&_y4m->fps_d)!=2){
-+ return -1;
-+ }
-+ got_fps=1;
-+ }break;
-+ case 'I':{
-+ _y4m->interlace=p[1];
-+ got_interlace=1;
-+ }break;
-+ case 'A':{
-+ if(sscanf(p+1,"%d:%d",&_y4m->par_n,&_y4m->par_d)!=2){
-+ return -1;
-+ }
-+ got_par=1;
-+ }break;
-+ case 'C':{
-+ if(q-p>16)return -1;
-+ memcpy(_y4m->chroma_type,p+1,q-p-1);
-+ _y4m->chroma_type[q-p-1]='\0';
-+ got_chroma=1;
-+ }break;
-+ /*Ignore unknown tags.*/
-+ }
-+ }
-+ if(!got_w||!got_h||!got_fps)return -1;
-+ if(!got_interlace)_y4m->interlace='?';
-+ if(!got_par)_y4m->par_n=_y4m->par_d=0;
-+ /*Chroma-type is not specified in older files, e.g., those generated by
-+ mplayer.*/
-+ if(!got_chroma)strcpy(_y4m->chroma_type,"420");
-+ return 0;
-+}
-+
-+
-+
-+/*All anti-aliasing filters in the following conversion functions are based on
-+ one of two window functions:
-+ The 6-tap Lanczos window (for down-sampling and shifts):
-+ sinc(\pi*t)*sinc(\pi*t/3), |t|<3 (sinc(t)==sin(t)/t)
-+ 0, |t|>=3
-+ The 4-tap Mitchell window (for up-sampling):
-+ 7|t|^3-12|t|^2+16/3, |t|<1
-+ -(7/3)|x|^3+12|x|^2-20|x|+32/3, |t|<2
-+ 0, |t|>=2
-+ The number of taps is intentionally kept small to reduce computational
-+ overhead and limit ringing.
-+
-+ The taps from these filters are scaled so that their sum is 1, and the result
-+ is scaled by 128 and rounded to integers to create a filter whose
-+ intermediate values fit inside 16 bits.
-+ Coefficients are rounded in such a way as to ensure their sum is still 128,
-+ which is usually equivalent to normal rounding.
-+
-+ Conversions which require both horizontal and vertical filtering could
-+ have these steps pipelined, for less memory consumption and better cache
-+ performance, but we do them separately for simplicity.*/
-+
-+#define OC_MINI(_a,_b) ((_a)>(_b)?(_b):(_a))
-+#define OC_MAXI(_a,_b) ((_a)<(_b)?(_b):(_a))
-+#define OC_CLAMPI(_a,_b,_c) (OC_MAXI(_a,OC_MINI(_b,_c)))
-+
-+/*420jpeg chroma samples are sited like:
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ 420mpeg2 chroma samples are sited like:
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ BR | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ BR | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ We use a resampling filter to shift the site locations one quarter pixel (at
-+ the chroma plane's resolution) to the right.
-+ The 4:2:2 modes look exactly the same, except there are twice as many chroma
-+ lines, and they are vertically co-sited with the luma samples in both the
-+ mpeg2 and jpeg cases (thus requiring no vertical resampling).*/
-+static void y4m_42xmpeg2_42xjpeg_helper(unsigned char *_dst,
-+ const unsigned char *_src,int _c_w,int _c_h){
-+ int pli;
-+ int y;
-+ int x;
-+ for(y=0;y<_c_h;y++){
-+ /*Filter: [4 -17 114 35 -9 1]/128, derived from a 6-tap Lanczos
-+ window.*/
-+ for(x=0;x<OC_MINI(_c_w,2);x++){
-+ _dst[x]=(unsigned char)OC_CLAMPI(0,(4*_src[0]-17*_src[OC_MAXI(x-1,0)]+
-+ 114*_src[x]+35*_src[OC_MINI(x+1,_c_w-1)]-9*_src[OC_MINI(x+2,_c_w-1)]+
-+ _src[OC_MINI(x+3,_c_w-1)]+64)>>7,255);
-+ }
-+ for(;x<_c_w-3;x++){
-+ _dst[x]=(unsigned char)OC_CLAMPI(0,(4*_src[x-2]-17*_src[x-1]+
-+ 114*_src[x]+35*_src[x+1]-9*_src[x+2]+_src[x+3]+64)>>7,255);
-+ }
-+ for(;x<_c_w;x++){
-+ _dst[x]=(unsigned char)OC_CLAMPI(0,(4*_src[x-2]-17*_src[x-1]+
-+ 114*_src[x]+35*_src[OC_MINI(x+1,_c_w-1)]-9*_src[OC_MINI(x+2,_c_w-1)]+
-+ _src[_c_w-1]+64)>>7,255);
-+ }
-+ _dst+=_c_w;
-+ _src+=_c_w;
-+ }
-+}
-+
-+/*Handles both 422 and 420mpeg2 to 422jpeg and 420jpeg, respectively.*/
-+static void y4m_convert_42xmpeg2_42xjpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int pli;
-+ int y;
-+ int x;
-+ /*Skip past the luma data.*/
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ /*Compute the size of each chroma plane.*/
-+ c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
-+ c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
-+ c_sz=c_w*c_h;
-+ for(pli=1;pli<3;pli++){
-+ y4m_42xmpeg2_42xjpeg_helper(_dst,_aux,c_w,c_h);
-+ _dst+=c_sz;
-+ _aux+=c_sz;
-+ }
-+}
-+
-+/*This format is only used for interlaced content, but is included for
-+ completeness.
-+
-+ 420jpeg chroma samples are sited like:
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ 420paldv chroma samples are sited like:
-+ YR------Y-------YR------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YB------Y-------YB------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YR------Y-------YR------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YB------Y-------YB------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ We use a resampling filter to shift the site locations one quarter pixel (at
-+ the chroma plane's resolution) to the right.
-+ Then we use another filter to move the C_r location down one quarter pixel,
-+ and the C_b location up one quarter pixel.*/
-+static void y4m_convert_42xpaldv_42xjpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ unsigned char *tmp;
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int pli;
-+ int y;
-+ int x;
-+ /*Skip past the luma data.*/
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ /*Compute the size of each chroma plane.*/
-+ c_w=(_y4m->pic_w+1)/2;
-+ c_h=(_y4m->pic_h+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
-+ c_sz=c_w*c_h;
-+ tmp=_aux+2*c_sz;
-+ for(pli=1;pli<3;pli++){
-+ /*First do the horizontal re-sampling.
-+ This is the same as the mpeg2 case, except that after the horizontal
-+ case, we need to apply a second vertical filter.*/
-+ y4m_42xmpeg2_42xjpeg_helper(tmp,_aux,c_w,c_h);
-+ _aux+=c_sz;
-+ switch(pli){
-+ case 1:{
-+ /*Slide C_b up a quarter-pel.
-+ This is the same filter used above, but in the other order.*/
-+ for(x=0;x<c_w;x++){
-+ for(y=0;y<OC_MINI(c_h,3);y++){
-+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(tmp[0]
-+ -9*tmp[OC_MAXI(y-2,0)*c_w]+35*tmp[OC_MAXI(y-1,0)*c_w]
-+ +114*tmp[y*c_w]-17*tmp[OC_MINI(y+1,c_h-1)*c_w]
-+ +4*tmp[OC_MINI(y+2,c_h-1)*c_w]+64)>>7,255);
-+ }
-+ for(;y<c_h-2;y++){
-+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(tmp[(y-3)*c_w]
-+ -9*tmp[(y-2)*c_w]+35*tmp[(y-1)*c_w]+114*tmp[y*c_w]
-+ -17*tmp[(y+1)*c_w]+4*tmp[(y+2)*c_w]+64)>>7,255);
-+ }
-+ for(;y<c_h;y++){
-+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(tmp[(y-3)*c_w]
-+ -9*tmp[(y-2)*c_w]+35*tmp[(y-1)*c_w]+114*tmp[y*c_w]
-+ -17*tmp[OC_MINI(y+1,c_h-1)*c_w]+4*tmp[(c_h-1)*c_w]+64)>>7,255);
-+ }
-+ _dst++;
-+ tmp++;
-+ }
-+ _dst+=c_sz-c_w;
-+ tmp-=c_w;
-+ }break;
-+ case 2:{
-+ /*Slide C_r down a quarter-pel.
-+ This is the same as the horizontal filter.*/
-+ for(x=0;x<c_w;x++){
-+ for(y=0;y<OC_MINI(c_h,2);y++){
-+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(4*tmp[0]
-+ -17*tmp[OC_MAXI(y-1,0)*c_w]+114*tmp[y*c_w]
-+ +35*tmp[OC_MINI(y+1,c_h-1)*c_w]-9*tmp[OC_MINI(y+2,c_h-1)*c_w]
-+ +tmp[OC_MINI(y+3,c_h-1)*c_w]+64)>>7,255);
-+ }
-+ for(;y<c_h-3;y++){
-+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(4*tmp[(y-2)*c_w]
-+ -17*tmp[(y-1)*c_w]+114*tmp[y*c_w]+35*tmp[(y+1)*c_w]
-+ -9*tmp[(y+2)*c_w]+tmp[(y+3)*c_w]+64)>>7,255);
-+ }
-+ for(;y<c_h;y++){
-+ _dst[y*c_w]=(unsigned char)OC_CLAMPI(0,(4*tmp[(y-2)*c_w]
-+ -17*tmp[(y-1)*c_w]+114*tmp[y*c_w]+35*tmp[OC_MINI(y+1,c_h-1)*c_w]
-+ -9*tmp[OC_MINI(y+2,c_h-1)*c_w]+tmp[(c_h-1)*c_w]+64)>>7,255);
-+ }
-+ _dst++;
-+ tmp++;
-+ }
-+ }break;
-+ }
-+ /*For actual interlaced material, this would have to be done separately on
-+ each field, and the shift amounts would be different.
-+ C_r moves down 1/8, C_b up 3/8 in the top field, and C_r moves down 3/8,
-+ C_b up 1/8 in the bottom field.
-+ The corresponding filters would be:
-+ Down 1/8 (reverse order for up): [3 -11 125 15 -4 0]/128
-+ Down 3/8 (reverse order for up): [4 -19 98 56 -13 2]/128*/
-+ }
-+}
-+
-+/*Perform vertical filtering to reduce a single plane from 4:2:2 to 4:2:0.
-+ This is used as a helper by several converation routines.*/
-+static void y4m_422jpeg_420jpeg_helper(unsigned char *_dst,
-+ const unsigned char *_src,int _c_w,int _c_h){
-+ int y;
-+ int x;
-+ /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
-+ for(x=0;x<_c_w;x++){
-+ for(y=0;y<OC_MINI(_c_h,2);y+=2){
-+ _dst[(y>>1)*_c_w]=OC_CLAMPI(0,(64*_src[0]
-+ +78*_src[OC_MINI(1,_c_h-1)*_c_w]
-+ -17*_src[OC_MINI(2,_c_h-1)*_c_w]
-+ +3*_src[OC_MINI(3,_c_h-1)*_c_w]+64)>>7,255);
-+ }
-+ for(;y<_c_h-3;y+=2){
-+ _dst[(y>>1)*_c_w]=OC_CLAMPI(0,(3*(_src[(y-2)*_c_w]+_src[(y+3)*_c_w])
-+ -17*(_src[(y-1)*_c_w]+_src[(y+2)*_c_w])
-+ +78*(_src[y*_c_w]+_src[(y+1)*_c_w])+64)>>7,255);
-+ }
-+ for(;y<_c_h;y+=2){
-+ _dst[(y>>1)*_c_w]=OC_CLAMPI(0,(3*(_src[(y-2)*_c_w]
-+ +_src[(_c_h-1)*_c_w])-17*(_src[(y-1)*_c_w]
-+ +_src[OC_MINI(y+2,_c_h-1)*_c_w])
-+ +78*(_src[y*_c_w]+_src[OC_MINI(y+1,_c_h-1)*_c_w])+64)>>7,255);
-+ }
-+ _src++;
-+ _dst++;
-+ }
-+}
-+
-+/*420jpeg chroma samples are sited like:
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ 422jpeg chroma samples are sited like:
-+ Y---BR--Y-------Y---BR--Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y---BR--Y-------Y---BR--Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y---BR--Y-------Y---BR--Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y---BR--Y-------Y---BR--Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ We use a resampling filter to decimate the chroma planes by two in the
-+ vertical direction.*/
-+static void y4m_convert_422jpeg_420jpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int dst_c_w;
-+ int dst_c_h;
-+ int dst_c_sz;
-+ int tmp_sz;
-+ int pic_sz;
-+ int pli;
-+ /*Skip past the luma data.*/
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ /*Compute the size of each chroma plane.*/
-+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
-+ c_h=_y4m->pic_h;
-+ dst_c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
-+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
-+ c_sz=c_w*c_h;
-+ dst_c_sz=dst_c_w*dst_c_h;
-+ for(pli=1;pli<3;pli++){
-+ y4m_422jpeg_420jpeg_helper(_dst,_aux,c_w,c_h);
-+ _aux+=c_sz;
-+ _dst+=dst_c_sz;
-+ }
-+}
-+
-+/*420jpeg chroma samples are sited like:
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ 422 chroma samples are sited like:
-+ YBR-----Y-------YBR-----Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YBR-----Y-------YBR-----Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YBR-----Y-------YBR-----Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YBR-----Y-------YBR-----Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ We use a resampling filter to shift the original site locations one quarter
-+ pixel (at the original chroma resolution) to the right.
-+ Then we use a second resampling filter to decimate the chroma planes by two
-+ in the vertical direction.*/
-+static void y4m_convert_422_420jpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ unsigned char *tmp;
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int dst_c_w;
-+ int dst_c_h;
-+ int dst_c_sz;
-+ int pli;
-+ int y;
-+ int x;
-+ /*Skip past the luma data.*/
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ /*Compute the size of each chroma plane.*/
-+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
-+ c_h=_y4m->pic_h;
-+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
-+ c_sz=c_w*c_h;
-+ dst_c_sz=c_w*dst_c_h;
-+ tmp=_aux+2*c_sz;
-+ for(pli=1;pli<3;pli++){
-+ /*In reality, the horizontal and vertical steps could be pipelined, for
-+ less memory consumption and better cache performance, but we do them
-+ separately for simplicity.*/
-+ /*First do horizontal filtering (convert to 422jpeg)*/
-+ y4m_42xmpeg2_42xjpeg_helper(tmp,_aux,c_w,c_h);
-+ /*Now do the vertical filtering.*/
-+ y4m_422jpeg_420jpeg_helper(_dst,tmp,c_w,c_h);
-+ _aux+=c_sz;
-+ _dst+=dst_c_sz;
-+ }
-+}
-+
-+/*420jpeg chroma samples are sited like:
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | BR | | BR |
-+ | | | |
-+ Y-------Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ 411 chroma samples are sited like:
-+ YBR-----Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YBR-----Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YBR-----Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+ YBR-----Y-------Y-------Y-------
-+ | | | |
-+ | | | |
-+ | | | |
-+
-+ We use a filter to resample at site locations one eighth pixel (at the source
-+ chroma plane's horizontal resolution) and five eighths of a pixel to the
-+ right.
-+ Then we use another filter to decimate the planes by 2 in the vertical
-+ direction.*/
-+static void y4m_convert_411_420jpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ unsigned char *tmp;
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int dst_c_w;
-+ int dst_c_h;
-+ int dst_c_sz;
-+ int tmp_sz;
-+ int pli;
-+ int y;
-+ int x;
-+ /*Skip past the luma data.*/
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ /*Compute the size of each chroma plane.*/
-+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
-+ c_h=_y4m->pic_h;
-+ dst_c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
-+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
-+ c_sz=c_w*c_h;
-+ dst_c_sz=dst_c_w*dst_c_h;
-+ tmp_sz=dst_c_w*c_h;
-+ tmp=_aux+2*c_sz;
-+ for(pli=1;pli<3;pli++){
-+ /*In reality, the horizontal and vertical steps could be pipelined, for
-+ less memory consumption and better cache performance, but we do them
-+ separately for simplicity.*/
-+ /*First do horizontal filtering (convert to 422jpeg)*/
-+ for(y=0;y<c_h;y++){
-+ /*Filters: [1 110 18 -1]/128 and [-3 50 86 -5]/128, both derived from a
-+ 4-tap Mitchell window.*/
-+ for(x=0;x<OC_MINI(c_w,1);x++){
-+ tmp[x<<1]=(unsigned char)OC_CLAMPI(0,(111*_aux[0]
-+ +18*_aux[OC_MINI(1,c_w-1)]-_aux[OC_MINI(2,c_w-1)]+64)>>7,255);
-+ tmp[x<<1|1]=(unsigned char)OC_CLAMPI(0,(47*_aux[0]
-+ +86*_aux[OC_MINI(1,c_w-1)]-5*_aux[OC_MINI(2,c_w-1)]+64)>>7,255);
-+ }
-+ for(;x<c_w-2;x++){
-+ tmp[x<<1]=(unsigned char)OC_CLAMPI(0,(_aux[x-1]+110*_aux[x]
-+ +18*_aux[x+1]-_aux[x+2]+64)>>7,255);
-+ tmp[x<<1|1]=(unsigned char)OC_CLAMPI(0,(-3*_aux[x-1]+50*_aux[x]
-+ +86*_aux[x+1]-5*_aux[x+2]+64)>>7,255);
-+ }
-+ for(;x<c_w;x++){
-+ tmp[x<<1]=(unsigned char)OC_CLAMPI(0,(_aux[x-1]+110*_aux[x]
-+ +18*_aux[OC_MINI(x+1,c_w-1)]-_aux[c_w-1]+64)>>7,255);
-+ if((x<<1|1)<dst_c_w){
-+ tmp[x<<1|1]=(unsigned char)OC_CLAMPI(0,(-3*_aux[x-1]+50*_aux[x]
-+ +86*_aux[OC_MINI(x+1,c_w-1)]-5*_aux[c_w-1]+64)>>7,255);
-+ }
-+ }
-+ tmp+=dst_c_w;
-+ _aux+=c_w;
-+ }
-+ tmp-=tmp_sz;
-+ /*Now do the vertical filtering.*/
-+ y4m_422jpeg_420jpeg_helper(_dst,tmp,dst_c_w,c_h);
-+ _dst+=dst_c_sz;
-+ }
-+}
-+
-+/*Convert 444 to 420jpeg.*/
-+static void y4m_convert_444_420jpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ unsigned char *tmp;
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int dst_c_w;
-+ int dst_c_h;
-+ int dst_c_sz;
-+ int tmp_sz;
-+ int pli;
-+ int y;
-+ int x;
-+ /*Skip past the luma data.*/
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ /*Compute the size of each chroma plane.*/
-+ c_w=(_y4m->pic_w+_y4m->src_c_dec_h-1)/_y4m->src_c_dec_h;
-+ c_h=_y4m->pic_h;
-+ dst_c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
-+ dst_c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
-+ c_sz=c_w*c_h;
-+ dst_c_sz=dst_c_w*dst_c_h;
-+ tmp_sz=dst_c_w*c_h;
-+ tmp=_aux+2*c_sz;
-+ for(pli=1;pli<3;pli++){
-+ /*Filter: [3 -17 78 78 -17 3]/128, derived from a 6-tap Lanczos window.*/
-+ for(y=0;y<c_h;y++){
-+ for(x=0;x<OC_MINI(c_w,2);x+=2){
-+ tmp[x>>1]=OC_CLAMPI(0,(64*_aux[0]+78*_aux[OC_MINI(1,c_w-1)]
-+ -17*_aux[OC_MINI(2,c_w-1)]
-+ +3*_aux[OC_MINI(3,c_w-1)]+64)>>7,255);
-+ }
-+ for(;x<c_w-3;x+=2){
-+ tmp[x>>1]=OC_CLAMPI(0,(3*(_aux[x-2]+_aux[x+3])
-+ -17*(_aux[x-1]+_aux[x+2])+78*(_aux[x]+_aux[x+1])+64)>>7,255);
-+ }
-+ for(;x<c_w;x+=2){
-+ tmp[x>>1]=OC_CLAMPI(0,(3*(_aux[x-2]+_aux[c_w-1])-
-+ 17*(_aux[x-1]+_aux[OC_MINI(x+2,c_w-1)])+
-+ 78*(_aux[x]+_aux[OC_MINI(x+1,c_w-1)])+64)>>7,255);
-+ }
-+ tmp+=dst_c_w;
-+ _aux+=c_w;
-+ }
-+ tmp-=tmp_sz;
-+ /*Now do the vertical filtering.*/
-+ y4m_422jpeg_420jpeg_helper(_dst,tmp,dst_c_w,c_h);
-+ _dst+=dst_c_sz;
-+ }
-+}
-+
-+/*The image is padded with empty chroma components at 4:2:0.*/
-+static void y4m_convert_mono_420jpeg(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+ int c_sz;
-+ _dst+=_y4m->pic_w*_y4m->pic_h;
-+ c_sz=((_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h)*
-+ ((_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v);
-+ memset(_dst,128,c_sz*2);
-+}
-+
-+/*No conversion function needed.*/
-+static void y4m_convert_null(y4m_input *_y4m,unsigned char *_dst,
-+ unsigned char *_aux){
-+}
-+
-+int y4m_input_open(y4m_input *_y4m,FILE *_fin,char *_skip,int _nskip){
-+ char buffer[80];
-+ int ret;
-+ int i;
-+ /*Read until newline, or 80 cols, whichever happens first.*/
-+ for(i=0;i<79;i++){
-+ if(_nskip>0){
-+ buffer[i]=*_skip++;
-+ _nskip--;
-+ }
-+ else{
-+ ret=fread(buffer+i,1,1,_fin);
-+ if(ret<1)return -1;
-+ }
-+ if(buffer[i]=='\n')break;
-+ }
-+ /*We skipped too much header data.*/
-+ if(_nskip>0)return -1;
-+ if(i==79){
-+ fprintf(stderr,"Error parsing header; not a YUV2MPEG2 file?\n");
-+ return -1;
-+ }
-+ buffer[i]='\0';
-+ if(memcmp(buffer,"YUV4MPEG",8)){
-+ fprintf(stderr,"Incomplete magic for YUV4MPEG file.\n");
-+ return -1;
-+ }
-+ if(buffer[8]!='2'){
-+ fprintf(stderr,"Incorrect YUV input file version; YUV4MPEG2 required.\n");
-+ }
-+ ret=y4m_parse_tags(_y4m,buffer+5);
-+ if(ret<0){
-+ fprintf(stderr,"Error parsing YUV4MPEG2 header.\n");
-+ return ret;
-+ }
-+ if(_y4m->interlace=='?'){
-+ fprintf(stderr,"Warning: Input video interlacing format unknown; "
-+ "assuming progressive scan.\n");
-+ }
-+ else if(_y4m->interlace!='p'){
-+ fprintf(stderr,"Input video is interlaced; "
-+ "Only progressive scan handled.\n");
-+ return -1;
-+ }
-+ if(strcmp(_y4m->chroma_type,"420")==0||
-+ strcmp(_y4m->chroma_type,"420jpeg")==0){
-+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h
-+ +2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
-+ /*Natively supported: no conversion required.*/
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
-+ _y4m->convert=y4m_convert_null;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"420mpeg2")==0){
-+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.*/
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=
-+ 2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
-+ _y4m->convert=y4m_convert_42xmpeg2_42xjpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"420paldv")==0){
-+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=_y4m->src_c_dec_v=_y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.
-+ We need to make two filter passes, so we need some extra space in the
-+ aux buffer.*/
-+ _y4m->aux_buf_sz=3*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
-+ _y4m->aux_buf_read_sz=2*((_y4m->pic_w+1)/2)*((_y4m->pic_h+1)/2);
-+ _y4m->convert=y4m_convert_42xpaldv_42xjpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"422jpeg")==0){
-+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=2;
-+ _y4m->src_c_dec_v=1;
-+ _y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.*/
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=2*((_y4m->pic_w+1)/2)*_y4m->pic_h;
-+ _y4m->convert=y4m_convert_422jpeg_420jpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"422")==0){
-+ _y4m->src_c_dec_h=_y4m->dst_c_dec_h=2;
-+ _y4m->src_c_dec_v=1;
-+ _y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.
-+ We need to make two filter passes, so we need some extra space in the
-+ aux buffer.*/
-+ _y4m->aux_buf_read_sz=2*((_y4m->pic_w+1)/2)*_y4m->pic_h;
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz+((_y4m->pic_w+1)/2)*_y4m->pic_h;
-+ _y4m->convert=y4m_convert_422_420jpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"411")==0){
-+ _y4m->src_c_dec_h=4;
-+ _y4m->dst_c_dec_h=2;
-+ _y4m->src_c_dec_v=1;
-+ _y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.
-+ We need to make two filter passes, so we need some extra space in the
-+ aux buffer.*/
-+ _y4m->aux_buf_read_sz=2*((_y4m->pic_w+3)/4)*_y4m->pic_h;
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz+((_y4m->pic_w+1)/2)*_y4m->pic_h;
-+ _y4m->convert=y4m_convert_411_420jpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"444")==0){
-+ _y4m->src_c_dec_h=1;
-+ _y4m->dst_c_dec_h=2;
-+ _y4m->src_c_dec_v=1;
-+ _y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.
-+ We need to make two filter passes, so we need some extra space in the
-+ aux buffer.*/
-+ _y4m->aux_buf_read_sz=2*_y4m->pic_w*_y4m->pic_h;
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz+((_y4m->pic_w+1)/2)*_y4m->pic_h;
-+ _y4m->convert=y4m_convert_444_420jpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"444alpha")==0){
-+ _y4m->src_c_dec_h=1;
-+ _y4m->dst_c_dec_h=2;
-+ _y4m->src_c_dec_v=1;
-+ _y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*Chroma filter required: read into the aux buf first.
-+ We need to make two filter passes, so we need some extra space in the
-+ aux buffer.
-+ The extra plane also gets read into the aux buf.
-+ It will be discarded.*/
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=3*_y4m->pic_w*_y4m->pic_h;
-+ _y4m->convert=y4m_convert_444_420jpeg;
-+ }
-+ else if(strcmp(_y4m->chroma_type,"mono")==0){
-+ _y4m->src_c_dec_h=_y4m->src_c_dec_v=0;
-+ _y4m->dst_c_dec_h=_y4m->dst_c_dec_v=2;
-+ _y4m->dst_buf_read_sz=_y4m->pic_w*_y4m->pic_h;
-+ /*No extra space required, but we need to clear the chroma planes.*/
-+ _y4m->aux_buf_sz=_y4m->aux_buf_read_sz=0;
-+ _y4m->convert=y4m_convert_mono_420jpeg;
-+ }
-+ else{
-+ fprintf(stderr,"Unknown chroma sampling type: %s\n",_y4m->chroma_type);
-+ return -1;
-+ }
-+ /*The size of the final frame buffers is always computed from the
-+ destination chroma decimation type.*/
-+ _y4m->dst_buf_sz=_y4m->pic_w*_y4m->pic_h
-+ +2*((_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h)*
-+ ((_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v);
-+ _y4m->dst_buf=(unsigned char *)malloc(_y4m->dst_buf_sz);
-+ _y4m->aux_buf=(unsigned char *)malloc(_y4m->aux_buf_sz);
-+ return 0;
-+}
-+
-+void y4m_input_close(y4m_input *_y4m){
-+ free(_y4m->dst_buf);
-+ free(_y4m->aux_buf);
-+}
-+
-+int y4m_input_fetch_frame(y4m_input *_y4m,FILE *_fin,vpx_image_t *_img){
-+ char frame[6];
-+ int pic_sz;
-+ int frame_c_w;
-+ int frame_c_h;
-+ int c_w;
-+ int c_h;
-+ int c_sz;
-+ int ret;
-+ /*Read and skip the frame header.*/
-+ ret=fread(frame,1,6,_fin);
-+ if(ret<6)return 0;
-+ if(memcmp(frame,"FRAME",5)){
-+ fprintf(stderr,"Loss of framing in Y4M input data\n");
-+ return -1;
-+ }
-+ if(frame[5]!='\n'){
-+ char c;
-+ int j;
-+ for(j=0;j<79&&fread(&c,1,1,_fin)&&c!='\n';j++);
-+ if(j==79){
-+ fprintf(stderr,"Error parsing Y4M frame header\n");
-+ return -1;
-+ }
-+ }
-+ /*Read the frame data that needs no conversion.*/
-+ if(fread(_y4m->dst_buf,1,_y4m->dst_buf_read_sz,_fin)!=_y4m->dst_buf_read_sz){
-+ fprintf(stderr,"Error reading Y4M frame data.\n");
-+ return -1;
-+ }
-+ /*Read the frame data that does need conversion.*/
-+ if(fread(_y4m->aux_buf,1,_y4m->aux_buf_read_sz,_fin)!=_y4m->aux_buf_read_sz){
-+ fprintf(stderr,"Error reading Y4M frame data.\n");
-+ return -1;
-+ }
-+ /*Now convert the just read frame.*/
-+ (*_y4m->convert)(_y4m,_y4m->dst_buf,_y4m->aux_buf);
-+ /*Fill in the frame buffer pointers.
-+ We don't use vpx_img_wrap() because it forces padding for odd picture
-+ sizes, which would require a separate fread call for every row.*/
-+ memset(_img,0,sizeof(*_img));
-+ /*Y4M has the planes in Y'CbCr order, which libvpx calls Y, U, and V.*/
-+ _img->fmt=IMG_FMT_I420;
-+ _img->w=_img->d_w=_y4m->pic_w;
-+ _img->h=_img->d_h=_y4m->pic_h;
-+ /*This is hard-coded to 4:2:0 for now, as that's all VP8 supports.*/
-+ _img->x_chroma_shift=1;
-+ _img->y_chroma_shift=1;
-+ _img->bps=12;
-+ /*Set up the buffer pointers.*/
-+ pic_sz=_y4m->pic_w*_y4m->pic_h;
-+ c_w=(_y4m->pic_w+_y4m->dst_c_dec_h-1)/_y4m->dst_c_dec_h;
-+ c_h=(_y4m->pic_h+_y4m->dst_c_dec_v-1)/_y4m->dst_c_dec_v;
-+ c_sz=c_w*c_h;
-+ _img->stride[PLANE_Y]=_y4m->pic_w;
-+ _img->stride[PLANE_U]=_img->stride[PLANE_V]=c_w;
-+ _img->planes[PLANE_Y]=_y4m->dst_buf;
-+ _img->planes[PLANE_U]=_y4m->dst_buf+pic_sz;
-+ _img->planes[PLANE_V]=_y4m->dst_buf+pic_sz+c_sz;
-+ return 0;
-+}
-diff --git a/y4minput.h b/y4minput.h
-new file mode 100644
-index 0000000..e3f9304
---- /dev/null
-+++ b/y4minput.h
-@@ -0,0 +1,60 @@
-+/*
-+ * Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
-+ *
-+ * Use of this source code is governed by a BSD-style license
-+ * that can be found in the LICENSE file in the root of the source
-+ * tree. An additional intellectual property rights grant can be found
-+ * in the file PATENTS. All contributing project authors may
-+ * be found in the AUTHORS file in the root of the source tree.
-+ *
-+ * Based on code from the OggTheora software codec source code,
-+ * Copyright (C) 2002-2010 The Xiph.Org Foundation and contributors.
-+ */
-+#if !defined(_y4minput_H)
-+# define _y4minput_H (1)
-+# include <stdio.h>
-+# include "vpx/vpx_image.h"
-+
-+
-+
-+typedef struct y4m_input y4m_input;
-+
-+
-+
-+/*The function used to perform chroma conversion.*/
-+typedef void (*y4m_convert_func)(y4m_input *_y4m,
-+ unsigned char *_dst,unsigned char *_src);
-+
-+
-+
-+struct y4m_input{
-+ int pic_w;
-+ int pic_h;
-+ int fps_n;
-+ int fps_d;
-+ int par_n;
-+ int par_d;
-+ char interlace;
-+ int src_c_dec_h;
-+ int src_c_dec_v;
-+ int dst_c_dec_h;
-+ int dst_c_dec_v;
-+ char chroma_type[16];
-+ /*The size of each converted frame buffer.*/
-+ size_t dst_buf_sz;
-+ /*The amount to read directly into the converted frame buffer.*/
-+ size_t dst_buf_read_sz;
-+ /*The size of the auxilliary buffer.*/
-+ size_t aux_buf_sz;
-+ /*The amount to read into the auxilliary buffer.*/
-+ size_t aux_buf_read_sz;
-+ y4m_convert_func convert;
-+ unsigned char *dst_buf;
-+ unsigned char *aux_buf;
-+};
-+
-+int y4m_input_open(y4m_input *_y4m,FILE *_fin,char *_skip,int _nskip);
-+void y4m_input_close(y4m_input *_y4m);
-+int y4m_input_fetch_frame(y4m_input *_y4m,FILE *_fin,vpx_image_t *img);
-+
-+#endif