Merge "configure: support --enable-pic for generic-gnu"
diff --git a/build/make/Makefile b/build/make/Makefile
index 93db44d..5ea1f22 100755
--- a/build/make/Makefile
+++ b/build/make/Makefile
@@ -18,6 +18,7 @@
         done
 all: .DEFAULT
 clean:: .DEFAULT
+install:: .DEFAULT
 
 
 # Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
@@ -29,7 +30,7 @@
 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
@@ -94,10 +95,10 @@
 	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] $@")
@@ -254,6 +255,9 @@
 	@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 +269,9 @@
 	@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 $@
 
@@ -277,6 +284,9 @@
 $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_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 +299,9 @@
 	@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 +309,29 @@
 	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 +345,8 @@
 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/obj_int_extract.c b/build/make/obj_int_extract.c
index cef14e7..d9afb9d 100644
--- a/build/make/obj_int_extract.c
+++ b/build/make/obj_int_extract.c
@@ -16,7 +16,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/configure b/configure
index 3083343..314f406 100755
--- a/configure
+++ b/configure
@@ -135,11 +135,12 @@
     [ $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 +158,8 @@
 [ -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
@@ -366,7 +367,14 @@
         local ver=`"$source_path/build/make/version.sh" --bare $source_path`
         DIST_DIR="${DIST_DIR}-${ver}"
     fi
-    enabled child || echo "DIST_DIR?=${DIST_DIR}" >> config.mk
+    enabled child || cat <<EOF >> config.mk
+ifeq (\$(MAKECMDGOALS),dist)
+DESTDIR?=${DIST_DIR}
+else
+DESTDIR?=/usr/local
+endif
+DIST_DIR?=\$(DESTDIR)
+EOF
     enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
 
     #
@@ -419,7 +427,7 @@
     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..868bcb9 100644
--- a/docs.mk
+++ b/docs.mk
@@ -47,8 +47,8 @@
 	@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..753ca3c 100644
--- a/example_xma.c
+++ b/example_xma.c
@@ -15,10 +15,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..f05fd81 100644
--- a/examples.mk
+++ b/examples.mk
@@ -14,7 +14,7 @@
 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
@@ -23,9 +23,11 @@
 ivfenc.SRCS                 += vpx_ports/mem_ops.h 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 +86,6 @@
     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 +99,7 @@
 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 +121,10 @@
 # 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/decoder_tmpl.c b/examples/decoder_tmpl.c
index 91916bf..59f0c11 100644
--- a/examples/decoder_tmpl.c
+++ b/examples/decoder_tmpl.c
@@ -16,8 +16,8 @@
 #include <stdarg.h>
 #include <string.h>
 #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)
 @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 c301767..65473d1 100644
--- a/examples/encoder_tmpl.c
+++ b/examples/encoder_tmpl.c
@@ -16,8 +16,8 @@
 #include <stdarg.h>
 #include <string.h>
 #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)
 #define fourcc    0x30385056
 @EXTRA_INCLUDES
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/ivfdec.c b/ivfdec.c
index e4c9981..94045f2 100644
--- a/ivfdec.c
+++ b/ivfdec.c
@@ -17,10 +17,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"
diff --git a/ivfenc.c b/ivfenc.c
index 7922358..1f62199 100644
--- a/ivfenc.c
+++ b/ivfenc.c
@@ -21,7 +21,7 @@
 #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>
@@ -29,7 +29,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #endif
-#include "vp8cx.h"
+#include "vpx/vp8cx.h"
 #include "vpx_ports/mem_ops.h"
 #include "vpx_ports/vpx_timer.h"
 
diff --git a/libs.mk b/libs.mk
index 16b4763..310e722 100644
--- a/libs.mk
+++ b/libs.mk
@@ -10,8 +10,8 @@
 
 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,20 +19,16 @@
 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. vpx_ports to pick up
-# vpx_integer.h
-CFLAGS += -I$(SRC_PATH_BARE)/vpx_codec
-CFLAGS += -I$(SRC_PATH_BARE)/vpx_ports
 
 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
 
@@ -41,9 +37,10 @@
   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
 
@@ -66,8 +63,8 @@
 
 # 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 += include/vpx/% $(SRC_PATH_BARE)/vpx/%
+INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
 INSTALL_MAPS += lib/%     %
 INSTALL_MAPS += src/%     $(SRC_PATH_BARE)/%
 ifeq ($(CONFIG_MSVS),yes)
@@ -83,7 +80,7 @@
 $(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
@@ -94,16 +91,16 @@
 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
+CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/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
+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)
@@ -211,10 +208,10 @@
 $(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.h b/md5_utils.h
index 8dda8d1..6c0e93e 100644
--- a/md5_utils.h
+++ b/md5_utils.h
@@ -29,14 +29,7 @@
 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
+#include "vpx/vpx_integer.h"
 
 /* MD5 context. */
 typedef struct
diff --git a/vp8/common/onyx.h b/vp8/common/onyx.h
index b66c400..4287219 100644
--- a/vp8/common/onyx.h
+++ b/vp8/common/onyx.h
@@ -16,7 +16,7 @@
 {
 #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..39eab24 100644
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -11,8 +11,8 @@
 #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/decoder/dboolhuff.h b/vp8/decoder/dboolhuff.h
index f5c9822..772dbdb 100644
--- a/vp8/decoder/dboolhuff.h
+++ b/vp8/decoder/dboolhuff.h
@@ -12,7 +12,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/encoder/mcomp.c b/vp8/encoder/mcomp.c
index d80059d..2a2de3d 100644
--- a/vp8/encoder/mcomp.c
+++ b/vp8/encoder/mcomp.c
@@ -1137,7 +1137,6 @@
 }
 
 
-#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 +1349,6 @@
     else
         return INT_MAX;
 }
-#endif
 
 #ifdef ENTROPY_STATS
 void print_mode_context(void)
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index bc3550a..fbdda2c 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -4738,7 +4738,6 @@
 #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);
@@ -4747,7 +4746,11 @@
     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
 
diff --git a/vp8/encoder/onyx_int.h b/vp8/encoder/onyx_int.h
index 29b120e..55076b0 100644
--- a/vp8/encoder/onyx_int.h
+++ b/vp8/encoder/onyx_int.h
@@ -25,7 +25,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
diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c
index 737e627..b45b212 100644
--- a/vp8/vp8_cx_iface.c
+++ b/vp8/vp8_cx_iface.c
@@ -8,11 +8,11 @@
  */
 
 
-#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>
diff --git a/vp8/vp8_dx_iface.c b/vp8/vp8_dx_iface.c
index 8aaa52c..9108bc2 100644
--- a/vp8/vp8_dx_iface.c
+++ b/vp8/vp8_dx_iface.c
@@ -10,9 +10,9 @@
 
 #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"
diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk
index e7e7663..651ee77 100644
--- a/vp8/vp8cx.mk
+++ b/vp8/vp8cx.mk
@@ -18,7 +18,7 @@
   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
@@ -100,5 +100,3 @@
 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/vp8dx.mk b/vp8/vp8dx.mk
index e6af543..76368eb 100644
--- a/vp8/vp8dx.mk
+++ b/vp8/vp8dx.mk
@@ -18,7 +18,7 @@
   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 +69,6 @@
 
 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/vpx_codec/exports b/vpx/exports
similarity index 100%
rename from vpx_codec/exports
rename to vpx/exports
diff --git a/vpx_codec/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
similarity index 100%
rename from vpx_codec/internal/vpx_codec_internal.h
rename to vpx/internal/vpx_codec_internal.h
diff --git a/vpx_codec/src/vpx_codec.c b/vpx/src/vpx_codec.c
similarity index 97%
rename from vpx_codec/src/vpx_codec.c
rename to vpx/src/vpx_codec.c
index ace4494..45dfce0 100644
--- a/vpx_codec/src/vpx_codec.c
+++ b/vpx/src/vpx_codec.c
@@ -14,8 +14,8 @@
  */
 #include <stdlib.h>
 #include <string.h>
-#include "vpx_ports/vpx_integer.h"
-#include "vpx_codec/internal/vpx_codec_internal.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)
diff --git a/vpx_codec/src/vpx_decoder.c b/vpx/src/vpx_decoder.c
similarity index 98%
rename from vpx_codec/src/vpx_decoder.c
rename to vpx/src/vpx_decoder.c
index 7e8575f..8257f89 100644
--- a/vpx_codec/src/vpx_decoder.c
+++ b/vpx/src/vpx_decoder.c
@@ -13,7 +13,7 @@
  *
  */
 #include <stdlib.h>
-#include "vpx_codec/internal/vpx_codec_internal.h"
+#include "vpx/internal/vpx_codec_internal.h"
 
 #define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
 
diff --git a/vpx_codec/src/vpx_decoder_compat.c b/vpx/src/vpx_decoder_compat.c
similarity index 98%
rename from vpx_codec/src/vpx_decoder_compat.c
rename to vpx/src/vpx_decoder_compat.c
index d5b04ae..96594fe 100644
--- a/vpx_codec/src/vpx_decoder_compat.c
+++ b/vpx/src/vpx_decoder_compat.c
@@ -14,8 +14,8 @@
  */
 #include <stdlib.h>
 #include <string.h>
-#include "vpx_codec/vpx_decoder.h"
-#include "vpx_codec/internal/vpx_codec_internal.h"
+#include "vpx/vpx_decoder.h"
+#include "vpx/internal/vpx_codec_internal.h"
 
 #define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
 
diff --git a/vpx_codec/src/vpx_encoder.c b/vpx/src/vpx_encoder.c
similarity index 99%
rename from vpx_codec/src/vpx_encoder.c
rename to vpx/src/vpx_encoder.c
index 98ad8ba..a9a40de 100644
--- a/vpx_codec/src/vpx_encoder.c
+++ b/vpx/src/vpx_encoder.c
@@ -14,7 +14,7 @@
  */
 #include <limits.h>
 #include <string.h>
-#include "vpx_codec/internal/vpx_codec_internal.h"
+#include "vpx/internal/vpx_codec_internal.h"
 
 #define SAVE_STATUS(ctx,var) (ctx?(ctx->err = var):var)
 
diff --git a/vpx_codec/src/vpx_image.c b/vpx/src/vpx_image.c
similarity index 99%
rename from vpx_codec/src/vpx_image.c
rename to vpx/src/vpx_image.c
index b104024..881ab1a 100644
--- a/vpx_codec/src/vpx_image.c
+++ b/vpx/src/vpx_image.c
@@ -10,7 +10,7 @@
 
 #include <stdlib.h>
 #include <string.h>
-#include "vpx_codec/vpx_image.h"
+#include "vpx/vpx_image.h"
 
 static vpx_image_t *img_alloc_helper(vpx_image_t  *img,
                                      vpx_img_fmt_t fmt,
diff --git a/vp8/vp8.h b/vpx/vp8.h
similarity index 97%
rename from vp8/vp8.h
rename to vpx/vp8.h
index 87ca217..6778b7e 100644
--- a/vp8/vp8.h
+++ b/vpx/vp8.h
@@ -29,7 +29,7 @@
  */
 #ifndef VP8_H
 #define VP8_H
-#include "vpx_codec_impl_top.h"
+#include "vpx/vpx_codec_impl_top.h"
 
 /*!\brief Control functions
  *
@@ -112,5 +112,5 @@
 DECLSPEC_DEPRECATED extern vpx_codec_iface_t vpx_codec_vp8_algo DEPRECATED;
 #endif
 
-#include "vpx_codec_impl_bottom.h"
+#include "vpx/vpx_codec_impl_bottom.h"
 #endif
diff --git a/vp8/vp8cx.h b/vpx/vp8cx.h
similarity index 98%
rename from vp8/vp8cx.h
rename to vpx/vp8cx.h
index dd48c07..0773edc 100644
--- a/vp8/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -21,7 +21,7 @@
  */
 #ifndef VP8CX_H
 #define VP8CX_H
-#include "vpx_codec_impl_top.h"
+#include "vpx/vpx_codec_impl_top.h"
 
 /*!\brief Algorithm interface for VP8
  *
@@ -257,5 +257,5 @@
 VPX_CTRL_USE_TYPE(VP8E_GET_LAST_QUANTIZER_64,  int *)
 
 /*! @} - end defgroup vp8_encoder */
-#include "vpx_codec_impl_bottom.h"
+#include "vpx/vpx_codec_impl_bottom.h"
 #endif
diff --git a/vp8/vp8dx.h b/vpx/vp8dx.h
similarity index 92%
rename from vp8/vp8dx.h
rename to vpx/vp8dx.h
index 7310b3b..8203557 100644
--- a/vp8/vp8dx.h
+++ b/vpx/vp8dx.h
@@ -21,7 +21,7 @@
  */
 #ifndef VP8DX_H
 #define VP8DX_H
-#include "vpx_codec_impl_top.h"
+#include "vpx/vpx_codec_impl_top.h"
 
 /*!\brief Algorithm interface for VP8
  *
@@ -37,5 +37,5 @@
 /*! @} - end defgroup vp8_decoder */
 
 
-#include "vpx_codec_impl_bottom.h"
+#include "vpx/vpx_codec_impl_bottom.h"
 #endif
diff --git a/vp8/vp8e.h b/vpx/vp8e.h
similarity index 95%
rename from vp8/vp8e.h
rename to vpx/vp8e.h
index a90aa2a..85ca39f 100644
--- a/vp8/vp8e.h
+++ b/vpx/vp8e.h
@@ -13,7 +13,7 @@
  */
 #ifndef VP8E_H
 #define VP8E_H
-#include "vpx_codec_impl_top.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"
@@ -58,5 +58,5 @@
  * #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"
+#include "vpx/vpx_codec_impl_bottom.h"
 #endif
diff --git a/vpx_codec/vpx_codec.h b/vpx/vpx_codec.h
similarity index 100%
rename from vpx_codec/vpx_codec.h
rename to vpx/vpx_codec.h
diff --git a/vpx_codec/vpx_codec.mk b/vpx/vpx_codec.mk
similarity index 100%
rename from vpx_codec/vpx_codec.mk
rename to vpx/vpx_codec.mk
diff --git a/vpx_codec/vpx_codec_impl_bottom.h b/vpx/vpx_codec_impl_bottom.h
similarity index 100%
rename from vpx_codec/vpx_codec_impl_bottom.h
rename to vpx/vpx_codec_impl_bottom.h
diff --git a/vpx_codec/vpx_codec_impl_top.h b/vpx/vpx_codec_impl_top.h
similarity index 100%
rename from vpx_codec/vpx_codec_impl_top.h
rename to vpx/vpx_codec_impl_top.h
diff --git a/vpx_codec/vpx_decoder.h b/vpx/vpx_decoder.h
similarity index 100%
rename from vpx_codec/vpx_decoder.h
rename to vpx/vpx_decoder.h
diff --git a/vpx_codec/vpx_decoder_compat.h b/vpx/vpx_decoder_compat.h
similarity index 100%
rename from vpx_codec/vpx_decoder_compat.h
rename to vpx/vpx_decoder_compat.h
diff --git a/vpx_codec/vpx_encoder.h b/vpx/vpx_encoder.h
similarity index 100%
rename from vpx_codec/vpx_encoder.h
rename to vpx/vpx_encoder.h
diff --git a/vpx_codec/vpx_image.h b/vpx/vpx_image.h
similarity index 77%
rename from vpx_codec/vpx_image.h
rename to vpx/vpx_image.h
index a25999c..1d86152 100644
--- a/vpx_codec/vpx_image.h
+++ b/vpx/vpx_image.h
@@ -58,6 +58,39 @@
     }
     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
diff --git a/vpx_ports/vpx_integer.h b/vpx/vpx_integer.h
similarity index 100%
rename from vpx_ports/vpx_integer.h
rename to vpx/vpx_integer.h
diff --git a/vpx_ports/mem.h b/vpx_ports/mem.h
index 10942f1..1078169 100644
--- a/vpx_ports/mem.h
+++ b/vpx_ports/mem.h
@@ -11,7 +11,7 @@
 #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)))