diff --git a/Makefile.am b/Makefile.am
index 44ec7a852e..60746dbf06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,8 +26,12 @@ AM_LIBAPU_LDFLAGS := $(shell ./libs/apr-util/apu-1-config --ldflags)
AM_LIBAPU_LIBS := $(subst $(switch_builddir)/,,$(shell ./libs/apr-util/apu-1-config \--libs))
endif
+
AM_CFLAGS = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
-AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS) -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/sdp -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/su -I$(switch_builddir)/libs/sofia-sip/libsofia-sip-ua/su
+AM_CPPFLAGS =
+AM_CPPFLAGS += -I$(switch_srcdir)/libs/libvpx
+AM_CPPFLAGS += $(SWITCH_AM_CXXFLAGS) -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/sdp
+AM_CPPFLAGS += -I$(switch_srcdir)/libs/sofia-sip/libsofia-sip-ua/su -I$(switch_builddir)/libs/sofia-sip/libsofia-sip-ua/su
AM_LDFLAGS = $(SWITCH_AM_LDFLAGS) $(AM_LIBAPR_LDFLAGS) $(AM_LIBAPU_LDFLAGS)
DEFAULT_SOUNDS=en-us-callie-8000
@@ -115,12 +119,23 @@ CORE_CFLAGS = $(AM_LIBAPR_CFLAGS) $(AM_LIBAPR_CPPFLAGS)
CORE_CFLAGS += $(AM_LIBAPU_CPPFLAGS)
CORE_CFLAGS += -I$(switch_srcdir)/libs/libtpl-1.5/src
CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include
+if ENABLE_LIBYUV
+CORE_CFLAGS += -I$(switch_srcdir)/libs/libyuv/include
+CORE_CFLAGS += -DSWITCH_HAVE_YUV
+endif
CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
CORE_CFLAGS += -I$(switch_builddir)/libs/spandsp/src -I$(switch_srcdir)/libs/spandsp/src
CORE_CFLAGS += -I$(switch_builddir)/libs/tiff-4.0.2/libtiff -I$(switch_srcdir)/libs/tiff-4.0.2/libtiff
+if ENABLE_LIBVPX
+CORE_CFLAGS += -DSWITCH_HAVE_VPX
+endif
APR_LIBS = $(AM_LIBAPU_LIBS) $(AM_LIBAPR_LIBS)
CORE_LIBS=
+
+if ENABLE_LIBVPX
+CORE_LIBS += libs/libvpx/libvpx.a
+endif
if SYSTEM_APRUTIL
CORE_LIBS += $(AM_LIBAPU_LINKLIBTOOL)
else
@@ -149,14 +164,6 @@ if HAVE_PNG
CORE_CFLAGS += -DSWITCH_HAVE_PNG $(LIBPNG_CFLAGS)
endif
-if HAVE_VPX
-CORE_CFLAGS += -DSWITCH_HAVE_VPX $(VPX_CFLAGS)
-endif
-
-if HAVE_YUV
-CORE_CFLAGS += -DSWITCH_HAVE_YUV $(YUV_CFLAGS)
-endif
-
if HAVE_FREETYPE
CORE_CFLAGS += -DSWITCH_HAVE_FREETYPE $(LIBFREETYPE_CFLAGS)
endif
@@ -165,13 +172,52 @@ endif
## libfreeswitch
##
noinst_LTLIBRARIES = libfreeswitch_spandsp.la
+if ENABLE_LIBYUV
+noinst_LTLIBRARIES += libfreeswitch_libyuv.la
+endif
libfreeswitch_spandsp_la_SOURCES = libs/spandsp/src/plc.c libs/spandsp/src/alloc.c libs/spandsp/src/bit_operations.c
libfreeswitch_spandsp_la_CFLAGS = -Ilibs/spandsp/src $(CORE_CFLAGS) $(AM_CFLAGS)
CORE_LIBS+=libfreeswitch_spandsp.la
+
+if ENABLE_LIBYUV
+libfreeswitch_libyuv_la_SOURCES = \
+ libs/libyuv/source/compare.cc \
+ libs/libyuv/source/compare_common.cc \
+ libs/libyuv/source/compare_gcc.cc \
+ libs/libyuv/source/convert.cc \
+ libs/libyuv/source/convert_argb.cc \
+ libs/libyuv/source/convert_from.cc \
+ libs/libyuv/source/convert_from_argb.cc \
+ libs/libyuv/source/convert_to_argb.cc \
+ libs/libyuv/source/convert_to_i420.cc \
+ libs/libyuv/source/cpu_id.cc \
+ libs/libyuv/source/planar_functions.cc \
+ libs/libyuv/source/rotate.cc \
+ libs/libyuv/source/rotate_any.cc \
+ libs/libyuv/source/rotate_argb.cc \
+ libs/libyuv/source/rotate_common.cc \
+ libs/libyuv/source/rotate_gcc.cc \
+ libs/libyuv/source/rotate_mips.cc \
+ libs/libyuv/source/row_any.cc \
+ libs/libyuv/source/row_common.cc \
+ libs/libyuv/source/row_mips.cc \
+ libs/libyuv/source/row_gcc.cc \
+ libs/libyuv/source/scale.cc \
+ libs/libyuv/source/scale_any.cc \
+ libs/libyuv/source/scale_argb.cc \
+ libs/libyuv/source/scale_common.cc \
+ libs/libyuv/source/scale_gcc.cc \
+ libs/libyuv/source/scale_mips.cc \
+ libs/libyuv/source/video_common.cc
+
+libfreeswitch_libyuv_la_CPPFLAGS = -O2 -fomit-frame-pointer -Ilibs/libyuv/include
+CORE_LIBS+=libfreeswitch_libyuv.la
+endif
+
lib_LTLIBRARIES = libfreeswitch.la
-libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(VPX_CFLAGS) $(AM_CFLAGS)
+libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(SQLITE_CFLAGS) $(FREETYPE_CFLAGS) $(CURL_CFLAGS) $(PCRE_CFLAGS) $(SPEEX_CFLAGS) $(LIBEDIT_CFLAGS) $(openssl_CFLAGS) $(AM_CFLAGS)
libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_LDFLAGS) -no-undefined
-libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(VPX_LIBS) $(PLATFORM_CORE_LIBS)
+libfreeswitch_la_LIBADD = $(CORE_LIBS) $(APR_LIBS) $(SQLITE_LIBS) $(FREETYPE_LIBS) $(CURL_LIBS) $(PCRE_LIBS) $(SPEEX_LIBS) $(LIBEDIT_LIBS) $(openssl_LIBS) $(PLATFORM_CORE_LIBS)
libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
if HAVE_PNG
@@ -315,6 +361,7 @@ libfreeswitch_la_SOURCES = \
src/switch_curl.c \
src/switch_hashtable.c\
src/switch_utf8.c \
+ src/switch_vpx.c \
libs/libtpl-1.5/src/tpl.c \
libs/libteletone/src/libteletone_detect.c \
libs/libteletone/src/libteletone_generate.c \
@@ -485,6 +532,12 @@ libs/libedit/src/.libs/libedit.a:
libs/libzrtp/libzrtp.a:
cd libs/libzrtp && $(MAKE)
+libs/libvpx/Makefile:
+ cd libs/libvpx && sh ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --extra-cflags="-fvisibility=hidden"
+
+libs/libvpx/libvpx.a: libs/libvpx/Makefile
+ @cd libs/libvpx && $(MAKE)
+
libs/sofia-sip/Makefile:
cd libs/sofia-sip && sh ./configure.gnu $(MY_DEFAULT_ARGS)
diff --git a/build/modules.conf.in b/build/modules.conf.in
index f87353c193..9c1a6d4ac0 100644
--- a/build/modules.conf.in
+++ b/build/modules.conf.in
@@ -75,7 +75,6 @@ codecs/mod_opus
#codecs/mod_silk
#codecs/mod_siren
#codecs/mod_theora
-codecs/mod_vpx
dialplans/mod_dialplan_asterisk
#dialplans/mod_dialplan_directory
dialplans/mod_dialplan_xml
diff --git a/build/modules.conf.most b/build/modules.conf.most
index 408e9196a5..3becf53b28 100644
--- a/build/modules.conf.most
+++ b/build/modules.conf.most
@@ -74,7 +74,6 @@ codecs/mod_sangoma_codec
codecs/mod_silk
codecs/mod_siren
codecs/mod_theora
-codecs/mod_vpx
dialplans/mod_dialplan_asterisk
dialplans/mod_dialplan_directory
dialplans/mod_dialplan_xml
@@ -103,6 +102,7 @@ event_handlers/mod_event_multicast
event_handlers/mod_event_socket
event_handlers/mod_format_cdr
event_handlers/mod_json_cdr
+event_handlers/mod_kazoo
#event_handlers/mod_radius_cdr
event_handlers/mod_odbc_cdr
event_handlers/mod_rayo
diff --git a/conf/insideout/autoload_configs/modules.conf.xml b/conf/insideout/autoload_configs/modules.conf.xml
index 22f35c6cf3..3e2b09cdcb 100644
--- a/conf/insideout/autoload_configs/modules.conf.xml
+++ b/conf/insideout/autoload_configs/modules.conf.xml
@@ -63,7 +63,6 @@
-
diff --git a/conf/rayo/autoload_configs/modules.conf.xml b/conf/rayo/autoload_configs/modules.conf.xml
index 3a2ace10ad..f6c58680bc 100644
--- a/conf/rayo/autoload_configs/modules.conf.xml
+++ b/conf/rayo/autoload_configs/modules.conf.xml
@@ -30,7 +30,6 @@
-
diff --git a/conf/sbc/autoload_configs/modules.conf.xml b/conf/sbc/autoload_configs/modules.conf.xml
index 940c82b7a9..579b1d33be 100644
--- a/conf/sbc/autoload_configs/modules.conf.xml
+++ b/conf/sbc/autoload_configs/modules.conf.xml
@@ -42,7 +42,6 @@
-
diff --git a/conf/testing/autoload_configs/modules.conf.xml b/conf/testing/autoload_configs/modules.conf.xml
index f0e099661f..9849ce2d94 100644
--- a/conf/testing/autoload_configs/modules.conf.xml
+++ b/conf/testing/autoload_configs/modules.conf.xml
@@ -23,7 +23,6 @@
-
diff --git a/conf/vanilla/autoload_configs/abstraction.conf.xml b/conf/vanilla/autoload_configs/abstraction.conf.xml
index d4b1dfd274..7244681374 100644
--- a/conf/vanilla/autoload_configs/abstraction.conf.xml
+++ b/conf/vanilla/autoload_configs/abstraction.conf.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/conf/vanilla/autoload_configs/amqp.conf.xml b/conf/vanilla/autoload_configs/amqp.conf.xml
index d665d1104b..d6c24f4ff7 100644
--- a/conf/vanilla/autoload_configs/amqp.conf.xml
+++ b/conf/vanilla/autoload_configs/amqp.conf.xml
@@ -60,4 +60,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/conf/vanilla/autoload_configs/cidlookup.conf.xml b/conf/vanilla/autoload_configs/cidlookup.conf.xml
index a30f9f5c10..fd28f9b0c0 100644
--- a/conf/vanilla/autoload_configs/cidlookup.conf.xml
+++ b/conf/vanilla/autoload_configs/cidlookup.conf.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/conf/vanilla/autoload_configs/modules.conf.xml b/conf/vanilla/autoload_configs/modules.conf.xml
index 5437153660..c850d7365f 100644
--- a/conf/vanilla/autoload_configs/modules.conf.xml
+++ b/conf/vanilla/autoload_configs/modules.conf.xml
@@ -94,7 +94,6 @@
-
diff --git a/conf/vanilla/autoload_configs/timezones.conf.xml b/conf/vanilla/autoload_configs/timezones.conf.xml
index 757d16c19d..50bd7f3760 100644
--- a/conf/vanilla/autoload_configs/timezones.conf.xml
+++ b/conf/vanilla/autoload_configs/timezones.conf.xml
@@ -13,7 +13,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -76,7 +76,7 @@
-
+
@@ -89,11 +89,11 @@
-
+
-
+
@@ -112,12 +112,13 @@
+
-
+
@@ -159,12 +160,12 @@
-
+
-
+
@@ -194,7 +195,7 @@
-
+
@@ -220,13 +221,13 @@
-
+
-
+
@@ -251,7 +252,8 @@
-
+
+
@@ -266,8 +268,8 @@
-
-
+
+
@@ -275,39 +277,40 @@
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
+
@@ -317,14 +320,14 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -340,29 +343,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -383,8 +386,8 @@
-
-
+
+
@@ -394,39 +397,39 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -445,7 +448,7 @@
-
+
@@ -454,7 +457,7 @@
-
+
@@ -463,9 +466,9 @@
-
+
-
+
@@ -476,26 +479,24 @@
-
+
-
+
-
+
-
-
@@ -560,15 +561,16 @@
-
+
+
-
+
-
+
@@ -584,7 +586,7 @@
-
+
@@ -613,26 +615,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -649,14 +637,12 @@
-
+
-
-
@@ -670,7 +656,7 @@
-
+
@@ -711,7 +697,7 @@
-
+
@@ -732,7 +718,7 @@
-
+
@@ -745,11 +731,11 @@
-
+
-
+
@@ -768,12 +754,13 @@
+
-
+
@@ -815,12 +802,12 @@
-
+
-
+
@@ -850,7 +837,7 @@
-
+
@@ -875,13 +862,13 @@
-
+
-
+
@@ -904,7 +891,8 @@
-
+
+
@@ -919,8 +907,8 @@
-
-
+
+
@@ -928,39 +916,40 @@
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
+
@@ -970,14 +959,14 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -991,29 +980,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1029,43 +1018,43 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1083,7 +1072,7 @@
-
+
@@ -1092,7 +1081,7 @@
-
+
@@ -1101,9 +1090,9 @@
-
+
-
+
@@ -1114,24 +1103,23 @@
-
+
-
+
-
+
-
@@ -1170,15 +1158,16 @@
-
+
+
-
+
-
+
@@ -1194,7 +1183,7 @@
-
+
@@ -1217,23 +1206,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1247,7 +1223,7 @@
-
+
@@ -1266,7 +1242,7 @@
-
+
@@ -1307,7 +1283,7 @@
-
+
@@ -1328,7 +1304,7 @@
-
+
@@ -1341,11 +1317,11 @@
-
+
-
+
@@ -1364,12 +1340,13 @@
+
-
+
@@ -1411,12 +1388,12 @@
-
+
-
+
@@ -1446,7 +1423,7 @@
-
+
@@ -1471,13 +1448,13 @@
-
+
-
+
@@ -1500,7 +1477,8 @@
-
+
+
@@ -1515,8 +1493,8 @@
-
-
+
+
@@ -1524,39 +1502,40 @@
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
+
@@ -1566,14 +1545,14 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
@@ -1587,29 +1566,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1625,43 +1604,43 @@
-
-
+
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1679,7 +1658,7 @@
-
+
@@ -1688,7 +1667,7 @@
-
+
@@ -1697,9 +1676,9 @@
-
+
-
+
@@ -1710,24 +1689,23 @@
-
+
-
+
-
+
-
@@ -1766,15 +1744,16 @@
-
+
+
-
+
-
+
@@ -1790,7 +1769,7 @@
-
+
@@ -1813,23 +1792,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -1843,7 +1809,7 @@
-
+
diff --git a/configure.ac b/configure.ac
index 0c371b4899..b0366cbc34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -408,6 +408,7 @@ elif test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then
elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
APR_ADDTO(SWITCH_AM_CFLAGS, -fPIC)
APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
+ AC_SUBST([AM_MOD_AVMD_CXXFLAGS], [-std=gnu99]) # FS-8809, needed for MAP_POPULATE
if test "$ac_cv_gcc_supports_w_no_unused_result" = yes; then
APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
fi
@@ -542,6 +543,16 @@ if test "${enable_debug}" = "yes"; then
fi
+AC_ARG_ENABLE(libyuv,
+[AC_HELP_STRING([--disable-libyuv],[build without libyuv])],[enable_libyuv="$enableval"],[enable_libyuv="yes"])
+
+AM_CONDITIONAL([ENABLE_LIBYUV],[test "${enable_libyuv}" = "yes"])
+
+AC_ARG_ENABLE(libvpx,
+[AC_HELP_STRING([--disable-libvpx],[build without libvpx])],[enable_libvpx="$enableval"],[enable_libvpx="yes"])
+
+AM_CONDITIONAL([ENABLE_LIBVPX],[test "${enable_libvpx}" = "yes"])
+
AC_ARG_ENABLE(cpp,
[AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
@@ -784,12 +795,6 @@ if test "x$have_libz" = "xyes" ; then
APR_ADDTO([PLATFORM_CORE_LIBS], [-lz])
fi
-PKG_CHECK_MODULES([YUV], [libyuv >= 0.0.1280],
- [AC_MSG_RESULT([yes]);AM_CONDITIONAL([HAVE_YUV],[true])],
- [AC_MSG_RESULT([no]);AM_CONDITIONAL([HAVE_YUV],[false])])
-
-APR_ADDTO([PLATFORM_CORE_LIBS], [${YUV_LIBS}])
-
PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.20.1],[
AM_CONDITIONAL([HAVE_MPG123],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])])
@@ -900,8 +905,6 @@ CPPFLAGS="$save_CPPFLAGS"
AX_HAVE_CPU_SET
-AC_CHECK_LIB(vpx, vpx_img_alloc, [AC_DEFINE(HAVE_VPX, 1, [Define if you have vpx()])])
-
AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])])
AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
@@ -1273,16 +1276,6 @@ PKG_CHECK_MODULES([SNDFILE], [sndfile >= 1.0.20],[
AM_CONDITIONAL([HAVE_SNDFILE],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SNDFILE],[false])])
-PKG_CHECK_MODULES([VPX], [vpx2 >= 1.4.0],[
- AM_CONDITIONAL([HAVE_VPX],[true])],[
- PKG_CHECK_MODULES([VPX], [vpx >= 1.4.0],[
- AM_CONDITIONAL([HAVE_VPX],[true])],[
- AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_VPX],[false])])])
-
-SWITCH_AM_CFLAGS="$VPX_CFLAGS $SWITCH_AM_CFLAGS"
-SWITCH_AM_CXXFLAGS="$VPX_CFLAGS $SWITCH_AM_CXXFLAGS"
-SWITCH_AM_CPPFLAGS="$VPX_CFLAGS $SWITCH_AM_CPPFLAGS"
-
PKG_CHECK_MODULES([MPG123], [libmpg123 >= 1.20.1],[
AM_CONDITIONAL([HAVE_MPG123],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MPG123],[false])])
@@ -1291,9 +1284,13 @@ PKG_CHECK_MODULES([SHOUT], [shout >= 2.2.2],[
AM_CONDITIONAL([HAVE_SHOUT],[true])],[
AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_SHOUT],[false])])
-PKG_CHECK_MODULES([MP3LAME], [mp3lame],[
- AM_CONDITIONAL([HAVE_MP3LAME],[true])],[
- AC_MSG_RESULT([no]); AM_CONDITIONAL([HAVE_MP3LAME],[false])])
+mp3lame=false
+AC_CHECK_LIB([mp3lame], [lame_init],[
+ AC_CHECK_HEADER([lame/lame.h],[
+ mp3lame=true
+ AC_SUBST([MP3LAME_LIBS], [-lmp3lame])
+ AC_SUBST([MP3LAME_CFLAGS], [$CPPFLAGS])])])
+AM_CONDITIONAL([HAVE_MP3LAME],[$mp3lame])
PKG_CHECK_MODULES([AVCODEC], [libavcodec >= 53.35.0],[
AM_CONDITIONAL([HAVE_AVCODEC],[true])],[
@@ -1409,6 +1406,7 @@ AS_IF([test "x$enable_core_libedit_support" != "xno"],[
PKG_CHECK_MODULES([LIBEDIT], [libedit >= 2.11],,[
AC_MSG_RESULT([no])
AC_CHECK_LIB([edit], [el_line], [LIBEDIT_LIBS=-ledit])
+ AC_CHECK_LIB([edit], [el_cursor], [ac_cv_has_el_cursor=yes])
AC_CHECK_HEADER([histedit.h], [], [unset LIBEDIT_LIBS])
AS_IF([test "x$LIBEDIT_LIBS" = "x"], [
AC_MSG_ERROR([You need to either install libedit-dev (>= 2.11) or configure with --disable-core-libedit-support])
@@ -1446,6 +1444,9 @@ AS_IF([test "x$enable_core_libedit_support" != "xno"], [
# If making changes here, don't forget to run autoheader and
# update libs/esl/src/include/esl_config_auto.h.in manually.
AC_DEFINE([HAVE_LIBEDIT], [1], [Define to 1 if you have libedit is available])
+if test x$ac_cv_has_el_cursor = xyes; then
+ AC_DEFINE([HAVE_EL_CURSOR], [1], [Define to 1 if you have libedit el_cursor support])
+fi
save_LIBS="${LIBS}"
save_CPPFLAGS="${CPPFLAGS}"
LIBS="${LIBEDIT_LIBS}"
@@ -1756,7 +1757,6 @@ AC_CONFIG_FILES([Makefile
src/mod/codecs/mod_siren/Makefile
src/mod/codecs/mod_skel_codec/Makefile
src/mod/codecs/mod_theora/Makefile
- src/mod/codecs/mod_vpx/Makefile
src/mod/dialplans/mod_dialplan_asterisk/Makefile
src/mod/dialplans/mod_dialplan_directory/Makefile
src/mod/dialplans/mod_dialplan_xml/Makefile
diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh
index f9c599acdf..2c1a873ef7 100755
--- a/debian/bootstrap.sh
+++ b/debian/bootstrap.sh
@@ -336,7 +336,7 @@ Build-Depends:
libedit-dev (>= 2.11),
libsqlite3-dev,
wget, pkg-config,
- libyuv-dev, libvpx-dev (>= 1.4.0) | libvpx2-dev,
+ yasm,
# core codecs
libogg-dev, libspeex-dev, libspeexdsp-dev,
# configure options
@@ -370,7 +370,7 @@ Conflicts: $(list_freeswitch_all_replaces)
Depends: \${shlibs:Depends}, \${perl:Depends}, \${misc:Depends},
freeswitch-music-default (>= 1.0.8),
freeswitch-sounds-en-us-callie (>= 1.0.25) | freeswitch-sounds,
- libyuv, libvpx (>= 1.4.0) | libvpx2,
+ yasm,
$(debian_wrap "${mod_depends}")
Recommends:
$(debian_wrap "${mod_recommends}")
@@ -395,7 +395,7 @@ Description: Cross-Platform Scalable Multi-Protocol Soft Switch
Package: libfreeswitch1
Architecture: any
Depends: \${shlibs:Depends}, \${misc:Depends},
- libyuv, libvpx (>= 1.4.0) | libvpx2
+ yasm
Recommends:
Suggests: libfreeswitch1-dbg
Description: Cross-Platform Scalable Multi-Protocol Soft Switch
diff --git a/debian/control-modules b/debian/control-modules
index 66c040f5d2..28d6aea2d0 100644
--- a/debian/control-modules
+++ b/debian/control-modules
@@ -377,10 +377,6 @@ Module: codecs/mod_theora
Description: mod_theora
Adds mod_theora.
-Module: codecs/mod_vpx
-Description: VP8/VP9 video codec
- This module adds the VP8 video codec, also known as WebM.
-
Module: codecs/mod_yuv
Description: Adds mod_yuv
Adds mod_yuv.
diff --git a/debian/freeswitch-systemd.freeswitch.service b/debian/freeswitch-systemd.freeswitch.service
index 2a3a97089b..cc0cf1d582 100644
--- a/debian/freeswitch-systemd.freeswitch.service
+++ b/debian/freeswitch-systemd.freeswitch.service
@@ -19,7 +19,7 @@ Group=daemon
LimitCORE=infinity
LimitNOFILE=100000
LimitNPROC=60000
-;LimitSTACK=240
+LimitSTACK=240K
LimitRTPRIO=infinity
LimitRTTIME=7000000
IOSchedulingClass=realtime
diff --git a/debian/util.sh b/debian/util.sh
index 022daa2048..3c481a3aa3 100755
--- a/debian/util.sh
+++ b/debian/util.sh
@@ -276,7 +276,7 @@ build_debs () {
local OPTIND OPTARG debug_hook=false hookdir="" cow_build_opts=""
local keep_pbuilder_config=false keyring="" custom_keyring="/tmp/fs.asc"
local use_custom_sources=true
- local custom_sources_file="/tmp/fs.sources.list"
+ local custom_sources_file="/etc/apt/sources.list"
while getopts 'BbdK:kT:t' o "$@"; do
case "$o" in
B) cow_build_opts="--debbuildopts '-B'";;
@@ -445,7 +445,7 @@ build_all () {
[ -n "$distros" ] || distros="$(default_distros)"
! $depinst || aptitude install -y \
rsync git less cowbuilder ccache \
- devscripts equivs build-essential
+ devscripts equivs build-essential yasm
[ -n "$orig" ] || orig="$(create_orig $orig_opts HEAD | tail -n1)"
if [ -n "$modlist" ]; then
local modtmp="$(mktemp /tmp/modules-XXXXXXXXXX.conf)"
diff --git a/freeswitch.spec b/freeswitch.spec
index 42f15063e6..bf8ebfab5b 100644
--- a/freeswitch.spec
+++ b/freeswitch.spec
@@ -1462,7 +1462,7 @@ ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_comm
######################################################################################################################
CODECS_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_bv codecs/mod_codec2 codecs/mod_g723_1 \
codecs/mod_g729 codecs/mod_h26x codecs/mod_ilbc codecs/mod_isac codecs/mod_mp4v codecs/mod_opus codecs/mod_silk \
- codecs/mod_siren codecs/mod_theora codecs/mod_vpx"
+ codecs/mod_siren codecs/mod_theora"
#
%if %{build_sng_tc}
CODECS_MODULES+="codecs/mod_sangoma_codec"
@@ -1716,7 +1716,7 @@ cd ../..
%pre
%ifos linux
if ! /usr/bin/id freeswitch &>/dev/null; then
- /usr/sbin/useradd -r -g daemon -s /bin/false -c "The FreeSWITCH Open Source Voice Platform" -d %{prefix} freeswitch || \
+ /usr/sbin/useradd -r -g daemon -s /bin/false -c "The FreeSWITCH Open Source Voice Platform" -d %{LOCALSTATEDIR} freeswitch || \
%logmsg "Unexpected error adding user \"freeswitch\". Aborting installation."
fi
%endif
@@ -2174,9 +2174,6 @@ fi
%files codec-mp4v
%{MODINSTDIR}/mod_mp4v.so*
-%files codec-vpx
-%{MODINSTDIR}/mod_vpx.so*
-
%files codec-opus
%{MODINSTDIR}/mod_opus.so*
%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/opus.conf.xml
diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js
index 6025e08f7d..7bc2aa8613 100644
--- a/html5/verto/js/src/jquery.FSRTC.js
+++ b/html5/verto/js/src/jquery.FSRTC.js
@@ -342,8 +342,8 @@
if(typeof self.options.localVideoStream.stop == 'function') {
self.options.localVideoStream.stop();
} else {
- if (self.localVideoStream.active){
- var tracks = self.localVideoStream.getTracks();
+ if (self.options.localVideoStream.active){
+ var tracks = self.options.localVideoStream.getTracks();
console.error(tracks);
tracks.forEach(function(track, index){
console.log(track);
@@ -513,7 +513,7 @@
audio = false;
} else {
audio = {
- mandatory: obj.options.audioParams,
+ mandatory: {},
optional: []
};
@@ -521,6 +521,15 @@
audio.optional = [{sourceId: obj.options.useMic}]
}
+ if (obj.options.audioParams) {
+ for (var key in obj.options.audioParams) {
+ var con = {};
+ con[key] = obj.options.audioParams[key];
+ audio.optional.push(con);
+ }
+ }
+
+
}
if (obj.options.useVideo && obj.options.localVideo) {
diff --git a/html5/verto/verto_communicator/src/css/verto.css b/html5/verto/verto_communicator/src/css/verto.css
index aa9157436a..7b87ed070a 100644
--- a/html5/verto/verto_communicator/src/css/verto.css
+++ b/html5/verto/verto_communicator/src/css/verto.css
@@ -403,7 +403,6 @@ body .modal-body .btn-group .btn.active {
}
.call_direction {
- position: absolute;
margin-top: 6px;
}
@@ -452,7 +451,6 @@ body .modal-body .btn-group .btn.active {
overflow: hidden;
overflow-wrap: break-word;
margin-left: 26px !important;
- position: absolute;
}
#dialpad .dialpad-number {
diff --git a/html5/verto/verto_communicator/src/partials/modal_settings.html b/html5/verto/verto_communicator/src/partials/modal_settings.html
index c7c4470d4a..5df1573292 100644
--- a/html5/verto/verto_communicator/src/partials/modal_settings.html
+++ b/html5/verto/verto_communicator/src/partials/modal_settings.html
@@ -35,6 +35,7 @@
+ Preview Settings
Refresh device list
@@ -131,6 +132,7 @@
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js
index f030b5d611..d5e5484fa6 100644
--- a/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js
+++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/InCallController.js
@@ -105,7 +105,15 @@
verto.screenshareHangup();
return false;
}
- verto.screenshare(storage.data.called_number);
+ if (verto.data.conf) {
+ console.log('Screenshare inside conferece: ', verto.data.conf);
+ // Setting the destination of the screenshare call as the conference
+ // number we last joined
+ verto.screenshare(verto.data.conf.params.laData.laName);
+ }
+ else {
+ verto.screenshare(storage.data.called_number);
+ }
};
function buildCanvasesData() {
diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js
index c1665eacca..a99fefe058 100644
--- a/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js
+++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/ModalSettingsController.js
@@ -56,11 +56,23 @@
$scope.checkAutoBand = function(option) {
$scope.mydata.useDedenc = false;
+ var bestres = videoQuality[videoQuality.length-1];
+ $scope.mydata.vidQual = bestres.id;
+ storage.data.vidQual = bestres.id;
+ verto.data.instance.videoParams({
+ minWidth: bestres.width,
+ minHeight: bestres.height,
+ maxWidth: bestres.width,
+ maxHeight: bestres.height,
+ minFrameRate: 15,
+ vertoBestFrameRate: storage.data.bestFrameRate
+ });
+ storage.data.vidQual = bestres.id;
if (!option) {
$scope.mydata.outgoingBandwidth = 'default';
$scope.mydata.incomingBandwidth = 'default';
- $scope.mydata.vidQual = 'hd';
$scope.mydata.testSpeedJoin = false;
+
} else {
$scope.mydata.testSpeedJoin = true;
}
@@ -73,6 +85,22 @@
$scope.mydata.useDedenc = true;
}
};
+
+ $scope.checkVideoQuality = function(resolution) {
+ var w = videoResolution[resolution]['width'];
+ var h = videoResolution[resolution]['height'];
+ storage.data.vidQual = resolution;
+ verto.data.instance.videoParams({
+ minWidth: w,
+ minHeight: h,
+ maxWidth: w,
+ maxHeight: h,
+ minFrameRate: 15,
+ vertoBestFrameRate: storage.data.bestFrameRate
+ });
+
+ };
+
}
]);
diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js
index 930501cc48..824e5e9e91 100644
--- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js
+++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js
@@ -326,7 +326,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
if (!videoFlag) storage.data.selectedVideo = data.videoDevices[0].id;
if (!shareFlag) storage.data.selectedShare = data.shareDevices[0].id;
if (!audioFlag) storage.data.selectedAudio = data.audioDevices[0].id;
- if (!speakerFlag) storage.data.selectedSpeaker = data.speakerDevices[0].id;
+ if (!speakerFlag && data.speakerDevices.length > 0) storage.data.selectedSpeaker = data.speakerDevices[0].id;
// This means that we cannot use video!
if (data.videoDevices.length === 0) {
diff --git a/html5/verto/video_demo/images/speed.gif b/html5/verto/video_demo/images/speed.gif
new file mode 100644
index 0000000000..96998f041f
Binary files /dev/null and b/html5/verto/video_demo/images/speed.gif differ
diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js
index be202e2068..ce4dd194f3 100644
--- a/html5/verto/video_demo/js/verto-min.js
+++ b/html5/verto/video_demo/js/verto-min.js
@@ -33,7 +33,7 @@ $.FSRTC.prototype.stop=function(){var self=this;if(self.options.useVideo){self.o
if(self.localStream){if(typeof self.localStream.stop=='function'){self.localStream.stop();}else{if(self.localStream.active){var tracks=self.localStream.getTracks();console.error(tracks);tracks.forEach(function(track,index){console.log(track);track.stop();})}}
self.localStream=null;}
if(self.options.localVideo){self.options.localVideo.style.display='none';if(moz){self.options.localVideo['mozSrcObject']=null;}else{self.options.localVideo['src']='';}}
-if(self.options.localVideoStream){if(typeof self.options.localVideoStream.stop=='function'){self.options.localVideoStream.stop();}else{if(self.localVideoStream.active){var tracks=self.localVideoStream.getTracks();console.error(tracks);tracks.forEach(function(track,index){console.log(track);track.stop();})}}}
+if(self.options.localVideoStream){if(typeof self.options.localVideoStream.stop=='function'){self.options.localVideoStream.stop();}else{if(self.options.localVideoStream.active){var tracks=self.options.localVideoStream.getTracks();console.error(tracks);tracks.forEach(function(track,index){console.log(track);track.stop();})}}}
if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.getMute=function(){var self=this;return self.audioEnabled;}
$.FSRTC.prototype.setMute=function(what){var self=this;var audioTracks=self.localStream.getAudioTracks();for(var i=0,len=audioTracks.length;icursor != line->lastchar) {
- line->cursor++;
+#ifdef HAVE_EL_CURSOR
+ el_cursor(el, 1);
+#endif
el_deletestr(el, 1);
}
return CC_REDISPLAY;
@@ -1300,6 +1305,8 @@ static void read_config(const char *dft_cfile, const char *cfile) {
profiles[pcount-1].use_history_file = !esl_true(val);
} else if(!strcasecmp(var, "prompt-color")) {
esl_set_string(profiles[pcount-1].prompt_color, match_color(val));
+ } else if(!strcasecmp(var, "prompt-string")) {
+ esl_set_string(profiles[pcount-1].prompt_string, val);
} else if(!strcasecmp(var, "input-text-color")) {
esl_set_string(profiles[pcount-1].input_text_color, match_color(val));
} else if(!strcasecmp(var, "output-text-color")) {
@@ -1340,6 +1347,58 @@ static void clear_el_buffer(void) {
#endif
}
+static void expand_prompt(char *s, size_t len, cli_profile_t *profile)
+{
+ char tmp[512] = "";
+ char *p, *q = tmp;
+
+ for (p = s; p && *p; p++) {
+ if (*p == '%') {
+ p++;
+
+ switch(*p) {
+ case 's':
+ esl_copy_string(q, switchname, len - (q - &tmp[0]));
+ q += strlen(switchname);
+ break;
+ case 'h':
+ esl_copy_string(q, hostname, len - (q - &tmp[0]));
+ q += strlen(hostname);
+ break;
+ case 'H':
+ esl_copy_string(q, switch_hostname, len - (q - &tmp[0]));
+ q += strlen(switch_hostname);
+ break;
+ case 'p':
+ esl_copy_string(q, profile->name, len - (q - &tmp[0]));
+ q += strlen(profile->name);
+ break;
+ case 'o':
+ esl_copy_string(q, profile->host, len - (q - &tmp[0]));
+ q += strlen(profile->host);
+ break;
+ case 'P':
+ {
+ char ptmp[35] = "";
+ esl_snprintf(ptmp, sizeof(ptmp), "%d", profile->port);
+ esl_copy_string(q, ptmp, len - (q - &tmp[0]));
+ q += strlen(ptmp);
+ }
+ break;
+ case '%':
+ *q++ = '%';
+ break;
+ }
+ } else {
+ *q++ = *p;
+ }
+ }
+
+ esl_copy_string(s, tmp, len);
+
+}
+
+
int main(int argc, char *argv[])
{
esl_handle_t handle = {{0}};
@@ -1403,6 +1462,7 @@ int main(int argc, char *argv[])
int loops = 2, reconnect = 0;
char *ccheck;
+ gethostname(hostname, sizeof(hostname));
esl_mutex_create(&MUTEX);
@@ -1430,7 +1490,7 @@ int main(int argc, char *argv[])
strncpy(internal_profile.host, "127.0.0.1", sizeof(internal_profile.host));
strncpy(internal_profile.pass, "ClueCon", sizeof(internal_profile.pass));
- strncpy(internal_profile.name, "internal", sizeof(internal_profile.name));
+ strncpy(internal_profile.name, hostname, sizeof(internal_profile.name));
internal_profile.port = 8021;
set_fn_keys(&internal_profile);
esl_set_string(internal_profile.prompt_color, prompt_color);
@@ -1541,10 +1601,17 @@ int main(int argc, char *argv[])
}
if (!profile) {
if (get_profile("default", &profile)) {
- esl_log(ESL_LOG_DEBUG, "profile default does not exist using builtin profile\n");
- profile = &internal_profile;
+ if (!esl_strlen_zero(profiles[0].name)) {
+ profile = &profiles[0];
+ }
}
}
+
+ if (!profile) {
+ esl_log(ESL_LOG_DEBUG, "no profiles found, using builtin profile\n");
+ profile = &internal_profile;
+ }
+
if (temp_log < 0 ) {
esl_global_set_default_logger(profile->debug);
}
@@ -1582,25 +1649,7 @@ int main(int argc, char *argv[])
esl_set_string(prompt_color, profile->prompt_color);
esl_set_string(input_text_color, profile->input_text_color);
esl_set_string(output_text_color, profile->output_text_color);
- if (argv_host) {
- if (argv_port && profile->port != 8021) {
- snprintf(bare_prompt_str, sizeof(bare_prompt_str), "freeswitch@%s:%u@%s> ", profile->host, profile->port, profile->name);
- } else {
- snprintf(bare_prompt_str, sizeof(bare_prompt_str), "freeswitch@%s@%s> ", profile->host, profile->name);
- }
- } else {
- snprintf(bare_prompt_str, sizeof(bare_prompt_str), "freeswitch@%s> ", profile->name);
- }
- bare_prompt_str_len = (int)strlen(bare_prompt_str);
- if (feature_level) {
-#if HAVE_DECL_EL_PROMPT_ESC
- snprintf(prompt_str, sizeof(prompt_str), "\1%s\1%s\1%s\1", prompt_color, bare_prompt_str, input_text_color);
-#else
- snprintf(prompt_str, sizeof(prompt_str), "%s%s%s", prompt_color, bare_prompt_str, input_text_color);
-#endif
- } else {
- snprintf(prompt_str, sizeof(prompt_str), "%s", bare_prompt_str);
- }
+
connect:
connected = 0;
while (--loops > 0) {
@@ -1657,6 +1706,42 @@ int main(int argc, char *argv[])
return 0;
}
+ snprintf(cmd_str, sizeof(cmd_str), "api switchname\n\n");
+ esl_send_recv(global_handle, cmd_str);
+ if (global_handle->last_sr_event && global_handle->last_sr_event->body) {
+ esl_set_string(switchname, global_handle->last_sr_event->body);
+ } else {
+ esl_set_string(switchname, profile->name);
+ }
+
+
+ snprintf(cmd_str, sizeof(cmd_str), "api hostname\n\n");
+ esl_send_recv(global_handle, cmd_str);
+ if (global_handle->last_sr_event && global_handle->last_sr_event->body) {
+ esl_set_string(switch_hostname, global_handle->last_sr_event->body);
+ } else {
+ esl_set_string(switch_hostname, profile->name);
+ }
+
+ if (!esl_strlen_zero(profile->prompt_string)) {
+ expand_prompt(profile->prompt_string, sizeof(profile->prompt_string), profile);
+ snprintf(bare_prompt_str, sizeof(bare_prompt_str), "%s> ", profile->prompt_string);
+ } else {
+ snprintf(bare_prompt_str, sizeof(bare_prompt_str), "freeswitch@%s> ", switchname);
+ }
+
+ bare_prompt_str_len = (int)strlen(bare_prompt_str);
+ if (feature_level) {
+#if HAVE_DECL_EL_PROMPT_ESC
+ snprintf(prompt_str, sizeof(prompt_str), "\1%s\1%s\1%s\1", prompt_color, bare_prompt_str, input_text_color);
+#else
+ snprintf(prompt_str, sizeof(prompt_str), "%s%s%s", prompt_color, bare_prompt_str, input_text_color);
+#endif
+ } else {
+ snprintf(prompt_str, sizeof(prompt_str), "%s", bare_prompt_str);
+ }
+
+
#ifdef HAVE_LIBEDIT
el = el_init(__FILE__, stdin, stdout, stderr);
#if HAVE_DECL_EL_PROMPT_ESC
diff --git a/libs/libvpx/.gitignore b/libs/libvpx/.gitignore
new file mode 100644
index 0000000000..9fed8d5b67
--- /dev/null
+++ b/libs/libvpx/.gitignore
@@ -0,0 +1,14 @@
+*.d
+.bins
+.docs
+Makefile
+config.mk
+libs-*.mk
+vp8_rtcd.h
+vp9_rtcd.h
+vpx_config.asm
+vpx_config.c
+vpx_config.h
+vpx_dsp_rtcd.h
+vpx_scale_rtcd.h
+vpx_version.h
diff --git a/libs/libvpx/AUTHORS b/libs/libvpx/AUTHORS
new file mode 100644
index 0000000000..f89b6776a8
--- /dev/null
+++ b/libs/libvpx/AUTHORS
@@ -0,0 +1,134 @@
+# This file is automatically generated from the git commit history
+# by tools/gen_authors.sh.
+
+Aaron Watry
+Abo Talib Mahfoodh
+Adam Xu
+Adrian Grange
+Aâ„“ex Converse
+Ahmad Sharif
+Alexander Voronov
+Alexis Ballier
+Alok Ahuja
+Alpha Lam
+A.Mahfoodh
+Ami Fischman
+Andoni Morales Alastruey
+Andres Mejia
+Andrew Russell
+Angie Chiang
+Aron Rosenberg
+Attila Nagy
+Brion Vibber
+changjun.yang
+Charles 'Buck' Krasic
+chm
+Christian Duvivier
+Daniel Kang
+Deb Mukherjee
+Dim Temp
+Dmitry Kovalev
+Dragan Mrdjan
+Ed Baker
+Ehsan Akhgari
+Erik Niemeyer
+Fabio Pedretti
+Frank Galligan
+Fredrik Söderquist
+Fritz Koenig
+Gaute Strokkenes
+Geza Lore
+Ghislain MARY
+Giuseppe Scrivano
+Gordana Cmiljanovic
+Guillaume Martres
+Guillermo Ballester Valor
+Hangyu Kuang
+Hanno Böck
+Henrik Lundin
+Hui Su
+Ivan Maltz
+Jacek Caban
+Jacky Chen
+James Berry
+James Yu
+James Zern
+Jan Gerber
+Jan Kratochvil
+Janne Salonen
+Jeff Faust
+Jeff Muizelaar
+Jeff Petkau
+Jia Jia
+Jim Bankoski
+Jingning Han
+Joey Parrish
+Johann Koenig
+John Koleszar
+Johnny Klonaris
+John Stark
+Joshua Bleecher Snyder
+Joshua Litt
+Julia Robson
+Justin Clift
+Justin Lebar
+KO Myung-Hun
+Lawrence Velázquez
+Lou Quillio
+Luca Barbato
+Makoto Kato
+Mans Rullgard
+Marco Paniconi
+Mark Mentovai
+Martin Ettl
+Martin Storsjo
+Matthew Heaney
+Michael Kohler
+Mike Frysinger
+Mike Hommey
+Mikhal Shemer
+Minghai Shang
+Morton Jonuschat
+Nico Weber
+Parag Salasakar
+Pascal Massimino
+Patrik Westin
+Paul Wilkins
+Pavol Rusnak
+Paweł Hajdan
+Pengchong Jin
+Peter de Rivaz
+Philip Jägenstedt
+Priit Laes
+Rafael Ãvila de EspÃndola
+Rafaël Carré
+Ralph Giles
+Rob Bradford
+Ronald S. Bultje
+Rui Ueyama
+Sami Pietilä
+Scott Graham
+Scott LaVarnway
+Sean McGovern
+Sergey Ulanov
+Shimon Doodkin
+Shunyao Li
+Stefan Holmer
+Suman Sunkara
+Taekhyun Kim
+Takanori MATSUURA
+Tamar Levy
+Tao Bai
+Tero Rintaluoma
+Thijs Vermeir
+Tim Kopp
+Timothy B. Terriberry
+Tom Finegan
+Vignesh Venkatasubramanian
+Yaowu Xu
+Yongzhe Wang
+Yunqing Wang
+Zoe Liu
+Google Inc.
+The Mozilla Foundation
+The Xiph.Org Foundation
diff --git a/libs/libvpx/CHANGELOG b/libs/libvpx/CHANGELOG
new file mode 100644
index 0000000000..7746cc6c4f
--- /dev/null
+++ b/libs/libvpx/CHANGELOG
@@ -0,0 +1,624 @@
+2015-11-09 v1.5.0 "Javan Whistling Duck"
+ This release improves upon the VP9 encoder and speeds up the encoding and
+ decoding processes.
+
+ - Upgrading:
+ This release is ABI incompatible with 1.4.0. It drops deprecated VP8
+ controls and adds a variety of VP9 controls for testing.
+
+ The vpxenc utility now prefers VP9 by default.
+
+ - Enhancements:
+ Faster VP9 encoding and decoding
+ Smaller library size by combining functions used by VP8 and VP9
+
+ - Bug Fixes:
+ A variety of fuzzing issues
+
+2015-04-03 v1.4.0 "Indian Runner Duck"
+ This release includes significant improvements to the VP9 codec.
+
+ - Upgrading:
+ This release is ABI incompatible with 1.3.0. It drops the compatibility
+ layer, requiring VPX_IMG_FMT_* instead of IMG_FMT_*, and adds several codec
+ controls for VP9.
+
+ - Enhancements:
+ Faster VP9 encoding and decoding
+ Multithreaded VP9 decoding (tile and frame-based)
+ Multithreaded VP9 encoding - on by default
+ YUV 4:2:2 and 4:4:4 support in VP9
+ 10 and 12bit support in VP9
+ 64bit ARM support by replacing ARM assembly with intrinsics
+
+ - Bug Fixes:
+ Fixes a VP9 bitstream issue in Profile 1. This only affected non-YUV 4:2:0
+ files.
+
+ - Known Issues:
+ Frame Parallel decoding fails for segmented and non-420 files.
+
+2013-11-15 v1.3.0 "Forest"
+ This release introduces the VP9 codec in a backward-compatible way.
+ All existing users of VP8 can continue to use the library without
+ modification. However, some VP8 options do not map to VP9 in the same manner.
+
+ The VP9 encoder in this release is not feature complete. Users interested in
+ the encoder are advised to use the git master branch and discuss issues on
+ libvpx mailing lists.
+
+ - Upgrading:
+ This release is ABI and API compatible with Duclair (v1.0.0). Users
+ of older releases should refer to the Upgrading notes in this document
+ for that release.
+
+ - Enhancements:
+ Get rid of bashisms in the main build scripts
+ Added usage info on command line options
+ Add lossless compression mode
+ Dll build of libvpx
+ Add additional Mac OS X targets: 10.7, 10.8 and 10.9 (darwin11-13)
+ Add option to disable documentation
+ configure: add --enable-external-build support
+ make: support V=1 as short form of verbose=yes
+ configure: support mingw-w64
+ configure: support hardfloat armv7 CHOSTS
+ configure: add support for android x86
+ Add estimated completion time to vpxenc
+ Don't exit on decode errors in vpxenc
+ vpxenc: support scaling prior to encoding
+ vpxdec: support scaling output
+ vpxenc: improve progress indicators with --skip
+ msvs: Don't link to winmm.lib
+ Add a new script for producing vcxproj files
+ Produce Visual Studio 10 and 11 project files
+ Produce Windows Phone project files
+ msvs-build: use msbuild for vs >= 2005
+ configure: default configure log to config.log
+ Add encoding option --static-thresh
+
+ - Speed:
+ Miscellaneous speed optimizations for VP8 and VP9.
+
+ - Quality:
+ In general, quality is consistent with the Eider release.
+
+ - Bug Fixes:
+ This release represents approximately a year of engineering effort,
+ and contains multiple bug fixes. Please refer to git history for details.
+
+
+2012-12-21 v1.2.0
+ This release acts as a checkpoint for a large amount of internal refactoring
+ and testing. It also contains a number of small bugfixes, so all users are
+ encouraged to upgrade.
+
+ - Upgrading:
+ This release is ABI and API compatible with Duclair (v1.0.0). Users
+ of older releases should refer to the Upgrading notes in this
+ document for that release.
+
+ - Enhancements:
+ VP8 optimizations for MIPS dspr2
+ vpxenc: add -quiet option
+
+ - Speed:
+ Encoder and decoder speed is consistent with the Eider release.
+
+ - Quality:
+ In general, quality is consistent with the Eider release.
+
+ Minor tweaks to ARNR filtering
+ Minor improvements to real time encoding with multiple temporal layers
+
+ - Bug Fixes:
+ Fixes multithreaded encoder race condition in loopfilter
+ Fixes multi-resolution threaded encoding
+ Fix potential encoder dead-lock after picture resize
+
+
+2012-05-09 v1.1.0 "Eider"
+ This introduces a number of enhancements, mostly focused on real-time
+ encoding. In addition, it fixes a decoder bug (first introduced in
+ Duclair) so all users of that release are encouraged to upgrade.
+
+ - Upgrading:
+ This release is ABI and API compatible with Duclair (v1.0.0). Users
+ of older releases should refer to the Upgrading notes in this
+ document for that release.
+
+ This release introduces a new temporal denoiser, controlled by the
+ VP8E_SET_NOISE_SENSITIVITY control. The temporal denoiser does not
+ currently take a strength parameter, so the control is effectively
+ a boolean - zero (off) or non-zero (on). For compatibility with
+ existing applications, the values accepted are the same as those
+ for the spatial denoiser (0-6). The temporal denoiser is enabled
+ by default, and the older spatial denoiser may be restored by
+ configuring with --disable-temporal-denoising. The temporal denoiser
+ is more computationally intensive than the spatial one.
+
+ This release removes support for a legacy, decode only API that was
+ supported, but deprecated, at the initial release of libvpx
+ (v0.9.0). This is not expected to have any impact. If you are
+ impacted, you can apply a reversion to commit 2bf8fb58 locally.
+ Please update to the latest libvpx API if you are affected.
+
+ - Enhancements:
+ Adds a motion compensated temporal denoiser to the encoder, which
+ gives higher quality than the older spatial denoiser. (See above
+ for notes on upgrading).
+
+ In addition, support for new compilers and platforms were added,
+ including:
+ improved support for XCode
+ Android x86 NDK build
+ OS/2 support
+ SunCC support
+
+ Changing resolution with vpx_codec_enc_config_set() is now
+ supported. Previously, reinitializing the codec was required to
+ change the input resolution.
+
+ The vpxenc application has initial support for producing multiple
+ encodes from the same input in one call. Resizing is not yet
+ supported, but varying other codec parameters is. Use -- to
+ delineate output streams. Options persist from one stream to the
+ next.
+
+ Also, the vpxenc application will now use a keyframe interval of
+ 5 seconds by default. Use the --kf-max-dist option to override.
+
+ - Speed:
+ Decoder performance improved 2.5% versus Duclair. Encoder speed is
+ consistent with Duclair for most material. Two pass encoding of
+ slideshow-like material will see significant improvements.
+
+ Large realtime encoding speed gains at a small quality expense are
+ possible by configuring the on-the-fly bitpacking experiment with
+ --enable-onthefly-bitpacking. Realtime encoder can be up to 13%
+ faster (ARM) depending on the number of threads and bitrate
+ settings. This technique sees constant gain over the 5-16 speed
+ range. For VC style input the loss seen is up to 0.2dB. See commit
+ 52cf4dca for further details.
+
+ - Quality:
+ On the whole, quality is consistent with the Duclair release. Some
+ tweaks:
+
+ Reduced blockiness in easy sections by applying a penalty to
+ intra modes.
+
+ Improved quality of static sections (like slideshows) with
+ two pass encoding.
+
+ Improved keyframe sizing with multiple temporal layers
+
+ - Bug Fixes:
+ Corrected alt-ref contribution to frame rate for visible updates
+ to the alt-ref buffer. This affected applications making manual
+ usage of the frame reference flags, or temporal layers.
+
+ Additional constraints were added to disable multi-frame quality
+ enhancement (MFQE) in sections of the frame where there is motion.
+ (#392)
+
+ Fixed corruption issues when vpx_codec_enc_config_set() was called
+ with spatial resampling enabled.
+
+ Fixed a decoder error introduced in Duclair where the segmentation
+ map was not being reinitialized on keyframes (#378)
+
+
+2012-01-27 v1.0.0 "Duclair"
+ Our fourth named release, focused on performance and features related to
+ real-time encoding. It also fixes a decoder crash bug introduced in
+ v0.9.7, so all users of that release are encouraged to upgrade.
+
+ - Upgrading:
+ This release is ABI incompatible with prior releases of libvpx, so the
+ "major" version number has been bumped to 1. You must recompile your
+ applications against the latest version of the libvpx headers. The
+ API remains compatible, and this should not require code changes in most
+ applications.
+
+ - Enhancements:
+ This release introduces several substantial new features to the encoder,
+ of particular interest to real time streaming applications.
+
+ Temporal scalability allows the encoder to produce a stream that can
+ be decimated to different frame rates, with independent rate targetting
+ for each substream.
+
+ Multiframe quality enhancement postprocessing can make visual quality
+ more consistent in the presence of frames that are substantially
+ different quality than the surrounding frames, as in the temporal
+ scalability case and in some forced keyframe scenarios.
+
+ Multiple-resolution encoding support allows the encoding of the
+ same content at different resolutions faster than encoding them
+ separately.
+
+ - Speed:
+ Optimization targets for this release included the decoder and the real-
+ time modes of the encoder. Decoder speed on x86 has improved 10.5% with
+ this release. Encoder improvements followed a curve where speeds 1-3
+ improved 4.0%-1.5%, speeds 4-8 improved <1%, and speeds 9-16 improved
+ 1.5% to 10.5%, respectively. "Best" mode speed is consistent with the
+ Cayuga release.
+
+ - Quality:
+ Encoder quality in the single stream case is consistent with the Cayuga
+ release.
+
+ - Bug Fixes:
+ This release fixes an OOB read decoder crash bug present in v0.9.7
+ related to the clamping of motion vectors in SPLITMV blocks. This
+ behavior could be triggered by corrupt input or by starting
+ decoding from a P-frame.
+
+
+2011-08-15 v0.9.7-p1 "Cayuga" patch 1
+ This is an incremental bugfix release against Cayuga. All users of that
+ release are strongly encouraged to upgrade.
+
+ - Fix potential OOB reads (cdae03a)
+
+ An unbounded out of bounds read was discovered when the
+ decoder was requested to perform error concealment (new in
+ Cayuga) given a frame with corrupt partition sizes.
+
+ A bounded out of bounds read was discovered affecting all
+ versions of libvpx. Given an multipartition input frame that
+ is truncated between the mode/mv partition and the first
+ residiual paritition (in the block of partition offsets), up
+ to 3 extra bytes could have been read from the source buffer.
+ The code will not take any action regardless of the contents
+ of these undefined bytes, as the truncated buffer is detected
+ immediately following the read based on the calculated
+ starting position of the coefficient partition.
+
+ - Fix potential error concealment crash when the very first frame
+ is missing or corrupt (a609be5)
+
+ - Fix significant artifacts in error concealment (a4c2211, 99d870a)
+
+ - Revert 1-pass CBR rate control changes (e961317)
+ Further testing showed this change produced undesirable visual
+ artifacts, rolling back for now.
+
+
+2011-08-02 v0.9.7 "Cayuga"
+ Our third named release, focused on a faster, higher quality, encoder.
+
+ - Upgrading:
+ This release is backwards compatible with Aylesbury (v0.9.5) and
+ Bali (v0.9.6). Users of older releases should refer to the Upgrading
+ notes in this document for that release.
+
+ - Enhancements:
+ Stereo 3D format support for vpxenc
+ Runtime detection of available processor cores.
+ Allow specifying --end-usage by enum name
+ vpxdec: test for frame corruption
+ vpxenc: add quantizer histogram display
+ vpxenc: add rate histogram display
+ Set VPX_FRAME_IS_DROPPABLE
+ update configure for ios sdk 4.3
+ Avoid text relocations in ARM vp8 decoder
+ Generate a vpx.pc file for pkg-config.
+ New ways of passing encoded data between encoder and decoder.
+
+ - Speed:
+ This release includes across-the-board speed improvements to the
+ encoder. On x86, these measure at approximately 11.5% in Best mode,
+ 21.5% in Good mode (speed 0), and 22.5% in Realtime mode (speed 6).
+ On ARM Cortex A9 with Neon extensions, real-time encoding of video
+ telephony content is 35% faster than Bali on single core and 48%
+ faster on multi-core. On the NVidia Tegra2 platform, real time
+ encoding is 40% faster than Bali.
+
+ Decoder speed was not a priority for this release, but improved
+ approximately 8.4% on x86.
+
+ Reduce motion vector search on alt-ref frame.
+ Encoder loopfilter running in its own thread
+ Reworked loopfilter to precalculate more parameters
+ SSE2/SSSE3 optimizations for build_predictors_mbuv{,_s}().
+ Make hor UV predict ~2x faster (73 vs 132 cycles) using SSSE3.
+ Removed redundant checks
+ Reduced structure sizes
+ utilize preload in ARMv6 MC/LPF/Copy routines
+ ARM optimized quantization, dfct, variance, subtract
+ Increase chrow row alignment to 16 bytes.
+ disable trellis optimization for first pass
+ Write SSSE3 sub-pixel filter function
+ Improve SSE2 half-pixel filter funtions
+ Add vp8_sub_pixel_variance16x8_ssse3 function
+ Reduce unnecessary distortion computation
+ Use diamond search to replace full search
+ Preload reference area in sub-pixel motion search (real-time mode)
+
+ - Quality:
+ This release focused primarily on one-pass use cases, including
+ video conferencing. Low latency data rate control was significantly
+ improved, improving streamability over bandwidth constrained links.
+ Added support for error concealment, allowing frames to maintain
+ visual quality in the presence of substantial packet loss.
+
+ Add rc_max_intra_bitrate_pct control
+ Limit size of initial keyframe in one-pass.
+ Improve framerate adaptation
+ Improved 1-pass CBR rate control
+ Improved KF insertion after fades to still.
+ Improved key frame detection.
+ Improved activity masking (lower PSNR impact for same SSIM boost)
+ Improved interaction between GF and ARFs
+ Adding error-concealment to the decoder.
+ Adding support for independent partitions
+ Adjusted rate-distortion constants
+
+
+ - Bug Fixes:
+ Removed firstpass motion map
+ Fix parallel make install
+ Fix multithreaded encoding for 1 MB wide frame
+ Fixed iwalsh_neon build problems with RVDS4.1
+ Fix semaphore emulation, spin-wait intrinsics on Windows
+ Fix build with xcode4 and simplify GLOBAL.
+ Mark ARM asm objects as allowing a non-executable stack.
+ Fix vpxenc encoding incorrect webm file header on big endian
+
+
+2011-03-07 v0.9.6 "Bali"
+ Our second named release, focused on a faster, higher quality, encoder.
+
+ - Upgrading:
+ This release is backwards compatible with Aylesbury (v0.9.5). Users
+ of older releases should refer to the Upgrading notes in this
+ document for that release.
+
+ - Enhancements:
+ vpxenc --psnr shows a summary when encode completes
+ --tune=ssim option to enable activity masking
+ improved postproc visualizations for development
+ updated support for Apple iOS to SDK 4.2
+ query decoder to determine which reference frames were updated
+ implemented error tracking in the decoder
+ fix pipe support on windows
+
+ - Speed:
+ Primary focus was on good quality mode, speed 0. Average improvement
+ on x86 about 40%, up to 100% on user-generated content at that speed.
+ Best quality mode speed improved 35%, and realtime speed 10-20%. This
+ release also saw significant improvement in realtime encoding speed
+ on ARM platforms.
+
+ Improved encoder threading
+ Dont pick encoder filter level when loopfilter is disabled.
+ Avoid double copying of key frames into alt and golden buffer
+ FDCT optimizations.
+ x86 sse2 temporal filter
+ SSSE3 version of fast quantizer
+ vp8_rd_pick_best_mbsegmentation code restructure
+ Adjusted breakout RD for SPLITMV
+ Changed segmentation check order
+ Improved rd_pick_intra4x4block
+ Adds armv6 optimized variance calculation
+ ARMv6 optimized sad16x16
+ ARMv6 optimized half pixel variance calculations
+ Full search SAD function optimization in SSE4.1
+ Improve MV prediction accuracy to achieve performance gain
+ Improve MV prediction in vp8_pick_inter_mode() for speed>3
+
+ - Quality:
+ Best quality mode improved PSNR 6.3%, and SSIM 6.1%. This release
+ also includes support for "activity masking," which greatly improves
+ SSIM at the expense of PSNR. For now, this feature is available with
+ the --tune=ssim option. Further experimentation in this area
+ is ongoing. This release also introduces a new rate control mode
+ called "CQ," which changes the allocation of bits within a clip to
+ the sections where they will have the most visual impact.
+
+ Tuning for the more exact quantizer.
+ Relax rate control for last few frames
+ CQ Mode
+ Limit key frame quantizer for forced key frames.
+ KF/GF Pulsing
+ Add simple version of activity masking.
+ make rdmult adaptive for intra in quantizer RDO
+ cap the best quantizer for 2nd order DC
+ change the threshold of DC check for encode breakout
+
+ - Bug Fixes:
+ Fix crash on Sparc Solaris.
+ Fix counter of fixed keyframe distance
+ ARNR filter pointer update bug fix
+ Fixed use of motion percentage in KF/GF group calc
+ Changed condition for using RD in Intra Mode
+ Fix encoder real-time only configuration.
+ Fix ARM encoder crash with multiple token partitions
+ Fixed bug first cluster timecode of webm file is wrong.
+ Fixed various encoder bugs with odd-sized images
+ vp8e_get_preview fixed when spatial resampling enabled
+ quantizer: fix assertion in fast quantizer path
+ Allocate source buffers to be multiples of 16
+ Fix for manual Golden frame frequency
+ Fix drastic undershoot in long form content
+
+
+2010-10-28 v0.9.5 "Aylesbury"
+ Our first named release, focused on a faster decoder, and a better encoder.
+
+ - Upgrading:
+ This release incorporates backwards-incompatible changes to the
+ ivfenc and ivfdec tools. These tools are now called vpxenc and vpxdec.
+
+ vpxdec
+ * the -q (quiet) option has been removed, and replaced with
+ -v (verbose). the output is quiet by default. Use -v to see
+ the version number of the binary.
+
+ * The default behavior is now to write output to a single file
+ instead of individual frames. The -y option has been removed.
+ Y4M output is the default.
+
+ * For raw I420/YV12 output instead of Y4M, the --i420 or --yv12
+ options must be specified.
+
+ $ ivfdec -o OUTPUT INPUT
+ $ vpxdec --i420 -o OUTPUT INPUT
+
+ * If an output file is not specified, the default is to write
+ Y4M to stdout. This makes piping more natural.
+
+ $ ivfdec -y -o - INPUT | ...
+ $ vpxdec INPUT | ...
+
+ * The output file has additional flexibility for formatting the
+ filename. It supports escape characters for constructing a
+ filename from the width, height, and sequence number. This
+ replaces the -p option. To get the equivalent:
+
+ $ ivfdec -p frame INPUT
+ $ vpxdec --i420 -o frame-%wx%h-%4.i420 INPUT
+
+ vpxenc
+ * The output file must be specified with -o, rather than as the
+ last argument.
+
+ $ ivfenc INPUT OUTPUT
+ $ vpxenc -o OUTPUT INPUT
+
+ * The output defaults to webm. To get IVF output, use the --ivf
+ option.
+
+ $ ivfenc INPUT OUTPUT.ivf
+ $ vpxenc -o OUTPUT.ivf --ivf INPUT
+
+
+ - Enhancements:
+ ivfenc and ivfdec have been renamed to vpxenc, vpxdec.
+ vpxdec supports .webm input
+ vpxdec writes .y4m by default
+ vpxenc writes .webm output by default
+ vpxenc --psnr now shows the average/overall PSNR at the end
+ ARM platforms now support runtime cpu detection
+ vpxdec visualizations added for motion vectors, block modes, references
+ vpxdec now silent by default
+ vpxdec --progress shows frame-by-frame timing information
+ vpxenc supports the distinction between --fps and --timebase
+ NASM is now a supported assembler
+ configure: enable PIC for shared libs by default
+ configure: add --enable-small
+ configure: support for ppc32-linux-gcc
+ configure: support for sparc-solaris-gcc
+
+ - Bugs:
+ Improve handling of invalid frames
+ Fix valgrind errors in the NEON loop filters.
+ Fix loopfilter delta zero transitions
+ Fix valgrind errors in vp8_sixtap_predict8x4_armv6().
+ Build fixes for darwin-icc
+
+ - Speed:
+ 20-40% (average 28%) improvement in libvpx decoder speed,
+ including:
+ Rewrite vp8_short_walsh4x4_sse2()
+ Optimizations on the loopfilters.
+ Miscellaneous improvements for Atom
+ Add 4-tap version of 2nd-pass ARMv6 MC filter.
+ Improved multithread utilization
+ Better instruction choices on x86
+ reorder data to use wider instructions
+ Update NEON wide idcts
+ Make block access to frame buffer sequential
+ Improved subset block search
+ Bilinear subpixel optimizations for ssse3.
+ Decrease memory footprint
+
+ Encoder speed improvements (percentage gain not measured):
+ Skip unnecessary search of identical frames
+ Add SSE2 subtract functions
+ Improve bounds checking in vp8_diamond_search_sadx4()
+ Added vp8_fast_quantize_b_sse2
+
+ - Quality:
+ Over 7% overall PSNR improvement (6.3% SSIM) in "best" quality
+ encoding mode, and up to 60% improvement on very noisy, still
+ or slow moving source video
+
+ Motion compensated temporal filter for Alt-Ref Noise Reduction
+ Improved use of trellis quantization on 2nd order Y blocks
+ Tune effect of motion on KF/GF boost in two pass
+ Allow coefficient optimization for good quality speed 0.
+ Improved control of active min quantizer for two pass.
+ Enable ARFs for non-lagged compress
+
+2010-09-02 v0.9.2
+ - Enhancements:
+ Disable frame dropping by default
+ Improved multithreaded performance
+ Improved Force Key Frame Behaviour
+ Increased rate control buffer level precision
+ Fix bug in 1st pass motion compensation
+ ivfenc: correct fixed kf interval, --disable-kf
+ - Speed:
+ Changed above and left context data layout
+ Rework idct calling structure.
+ Removed unnecessary MB_MODE_INFO copies
+ x86: SSSE3 sixtap prediction
+ Reworked IDCT to include reconstruction (add) step
+ Swap alt/gold/new/last frame buffer ptrs instead of copying.
+ Improve SSE2 loopfilter functions
+ Change bitreader to use a larger window.
+ Avoid loopfilter reinitialization when possible
+ - Quality:
+ Normalize quantizer's zero bin and rounding factors
+ Add trellis quantization.
+ Make the quantizer exact.
+ Updates to ARNR filtering algorithm
+ Fix breakout thresh computation for golden & AltRef frames
+ Redo the forward 4x4 dct
+ Improve the accuracy of forward walsh-hadamard transform
+ Further adjustment of RD behaviour with Q and Zbin.
+ - Build System:
+ Allow linking of libs built with MinGW to MSVC
+ Fix target auto-detection on mingw32
+ Allow --cpu= to work for x86.
+ configure: pass original arguments through to make dist
+ Fix builds without runtime CPU detection
+ msvs: fix install of codec sources
+ msvs: Change devenv.com command line for better msys support
+ msvs: Add vs9 targets.
+ Add x86_64-linux-icc target
+ - Bugs:
+ Potential crashes on older MinGW builds
+ Fix two-pass framrate for Y4M input.
+ Fixed simple loop filter, other crashes on ARM v6
+ arm: fix missing dependency with --enable-shared
+ configure: support directories containing .o
+ Replace pinsrw (SSE) with MMX instructions
+ apple: include proper mach primatives
+ Fixed rate control bug with long key frame interval.
+ Fix DSO link errors on x86-64 when not using a version script
+ Fixed buffer selection for UV in AltRef filtering
+
+
+2010-06-17 v0.9.1
+ - Enhancements:
+ * ivfenc/ivfdec now support YUV4MPEG2 input and pipe I/O
+ * Speed optimizations
+ - Bugfixes:
+ * Rate control
+ * Prevent out-of-bounds accesses on invalid data
+ - Build system updates:
+ * Detect toolchain to be used automatically for native builds
+ * Support building shared libraries
+ * Better autotools emulation (--prefix, --libdir, DESTDIR)
+ - Updated LICENSE
+ * http://webmproject.blogspot.com/2010/06/changes-to-webm-open-source-license.html
+
+
+2010-05-18 v0.9.0
+ - Initial open source release. Welcome to WebM and VP8!
+
diff --git a/libs/libvpx/LICENSE b/libs/libvpx/LICENSE
new file mode 100644
index 0000000000..1ce44343c4
--- /dev/null
+++ b/libs/libvpx/LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 2010, The WebM Project authors. 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 of Google, nor the WebM Project, 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
+HOLDER 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.
+
diff --git a/libs/libvpx/PATENTS b/libs/libvpx/PATENTS
new file mode 100644
index 0000000000..caedf607e9
--- /dev/null
+++ b/libs/libvpx/PATENTS
@@ -0,0 +1,23 @@
+Additional IP Rights Grant (Patents)
+------------------------------------
+
+"These implementations" means the copyrightable works that implement the WebM
+codecs 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 these implementations of WebM, 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 these implementations of WebM. This grant does not include claims
+that would be infringed only as a consequence of further modification of these
+implementations. If you or your agent or exclusive licensee institute or order
+or agree to the institution of patent litigation or any other patent
+enforcement activity against any entity (including a cross-claim or
+counterclaim in a lawsuit) alleging that any of these implementations of WebM
+or any code incorporated within any of these implementations of WebM
+constitute direct or contributory patent infringement, or inducement of
+patent infringement, then any patent rights granted to you under this License
+for these implementations of WebM shall terminate as of the date such
+litigation is filed.
diff --git a/libs/libvpx/README b/libs/libvpx/README
new file mode 100644
index 0000000000..979440eb70
--- /dev/null
+++ b/libs/libvpx/README
@@ -0,0 +1,139 @@
+README - 23 March 2015
+
+Welcome to the WebM VP8/VP9 Codec SDK!
+
+COMPILING THE APPLICATIONS/LIBRARIES:
+ The build system used is similar to autotools. Building generally consists of
+ "configuring" with your desired build options, then using GNU make to build
+ the application.
+
+ 1. Prerequisites
+
+ * All x86 targets require the Yasm[1] assembler be installed.
+ * All Windows builds require that Cygwin[2] be installed.
+ * Building the documentation requires Doxygen[3]. If you do not
+ have this package, the install-docs option will be disabled.
+ * Downloading the data for the unit tests requires curl[4] and sha1sum.
+ sha1sum is provided via the GNU coreutils, installed by default on
+ many *nix platforms, as well as MinGW and Cygwin. If coreutils is not
+ available, a compatible version of sha1sum can be built from
+ source[5]. These requirements are optional if not running the unit
+ tests.
+
+ [1]: http://www.tortall.net/projects/yasm
+ [2]: http://www.cygwin.com
+ [3]: http://www.doxygen.org
+ [4]: http://curl.haxx.se
+ [5]: http://www.microbrew.org/tools/md5sha1sum/
+
+ 2. Out-of-tree builds
+ Out of tree builds are a supported method of building the application. For
+ an out of tree build, the source tree is kept separate from the object
+ files produced during compilation. For instance:
+
+ $ mkdir build
+ $ cd build
+ $ ../libvpx/configure
+ $ make
+
+ 3. Configuration options
+ The 'configure' script supports a number of options. The --help option can be
+ used to get a list of supported options:
+ $ ../libvpx/configure --help
+
+ 4. Cross development
+ For cross development, the most notable option is the --target option. The
+ most up-to-date list of supported targets can be found at the bottom of the
+ --help output of the configure script. As of this writing, the list of
+ available targets is:
+
+ armv6-darwin-gcc
+ armv6-linux-rvct
+ armv6-linux-gcc
+ armv6-none-rvct
+ arm64-darwin-gcc
+ armv7-android-gcc
+ armv7-darwin-gcc
+ armv7-linux-rvct
+ armv7-linux-gcc
+ armv7-none-rvct
+ armv7-win32-vs11
+ armv7-win32-vs12
+ armv7-win32-vs14
+ armv7s-darwin-gcc
+ mips32-linux-gcc
+ mips64-linux-gcc
+ sparc-solaris-gcc
+ x86-android-gcc
+ x86-darwin8-gcc
+ x86-darwin8-icc
+ x86-darwin9-gcc
+ x86-darwin9-icc
+ x86-darwin10-gcc
+ x86-darwin11-gcc
+ x86-darwin12-gcc
+ x86-darwin13-gcc
+ x86-darwin14-gcc
+ x86-iphonesimulator-gcc
+ x86-linux-gcc
+ x86-linux-icc
+ x86-os2-gcc
+ x86-solaris-gcc
+ x86-win32-gcc
+ x86-win32-vs7
+ x86-win32-vs8
+ x86-win32-vs9
+ x86-win32-vs10
+ x86-win32-vs11
+ x86-win32-vs12
+ x86-win32-vs14
+ x86_64-android-gcc
+ x86_64-darwin9-gcc
+ x86_64-darwin10-gcc
+ x86_64-darwin11-gcc
+ x86_64-darwin12-gcc
+ x86_64-darwin13-gcc
+ x86_64-darwin14-gcc
+ x86_64-iphonesimulator-gcc
+ x86_64-linux-gcc
+ x86_64-linux-icc
+ x86_64-solaris-gcc
+ x86_64-win64-gcc
+ x86_64-win64-vs8
+ x86_64-win64-vs9
+ x86_64-win64-vs10
+ x86_64-win64-vs11
+ x86_64-win64-vs12
+ x86_64-win64-vs14
+ generic-gnu
+
+ The generic-gnu target, in conjunction with the CROSS environment variable,
+ can be used to cross compile architectures that aren't explicitly listed, if
+ the toolchain is a cross GNU (gcc/binutils) toolchain. Other POSIX toolchains
+ will likely work as well. For instance, to build using the mipsel-linux-uclibc
+ toolchain, the following command could be used (note, POSIX SH syntax, adapt
+ to your shell as necessary):
+
+ $ CROSS=mipsel-linux-uclibc- ../libvpx/configure
+
+ In addition, the executables to be invoked can be overridden by specifying the
+ environment variables: CC, AR, LD, AS, STRIP, NM. Additional flags can be
+ passed to these executables with CFLAGS, LDFLAGS, and ASFLAGS.
+
+ 5. Configuration errors
+ If the configuration step fails, the first step is to look in the error log.
+ This defaults to config.log. This should give a good indication of what went
+ wrong. If not, contact us for support.
+
+VP8/VP9 TEST VECTORS:
+ The test vectors can be downloaded and verified using the build system after
+ running configure. To specify an alternate directory the
+ LIBVPX_TEST_DATA_PATH environment variable can be used.
+
+ $ ./configure --enable-unit-tests
+ $ LIBVPX_TEST_DATA_PATH=../libvpx-test-data make testdata
+
+SUPPORT
+ This library is an open source project supported by its community. Please
+ please email webm-discuss@webmproject.org for help.
+
diff --git a/libs/libvpx/args.c b/libs/libvpx/args.c
new file mode 100644
index 0000000000..14b031040a
--- /dev/null
+++ b/libs/libvpx/args.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2010 The WebM 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
+#include
+#include
+#include "args.h"
+
+#include "vpx_ports/msvc.h"
+
+#if defined(__GNUC__) && __GNUC__
+extern void die(const char *fmt, ...) __attribute__((noreturn));
+#else
+extern void die(const char *fmt, ...);
+#endif
+
+
+struct arg arg_init(char **argv) {
+ struct arg a;
+
+ a.argv = argv;
+ a.argv_step = 1;
+ a.name = NULL;
+ a.val = NULL;
+ a.def = NULL;
+ return a;
+}
+
+int arg_match(struct arg *arg_, const struct arg_def *def, char **argv) {
+ struct arg arg;
+
+ if (!argv[0] || argv[0][0] != '-')
+ return 0;
+
+ arg = arg_init(argv);
+
+ if (def->short_name
+ && strlen(arg.argv[0]) == strlen(def->short_name) + 1
+ && !strcmp(arg.argv[0] + 1, def->short_name)) {
+
+ arg.name = arg.argv[0] + 1;
+ arg.val = def->has_val ? arg.argv[1] : NULL;
+ arg.argv_step = def->has_val ? 2 : 1;
+ } else if (def->long_name) {
+ const size_t name_len = strlen(def->long_name);
+
+ if (strlen(arg.argv[0]) >= name_len + 2
+ && arg.argv[0][1] == '-'
+ && !strncmp(arg.argv[0] + 2, def->long_name, name_len)
+ && (arg.argv[0][name_len + 2] == '='
+ || arg.argv[0][name_len + 2] == '\0')) {
+
+ arg.name = arg.argv[0] + 2;
+ arg.val = arg.name[name_len] == '=' ? arg.name + name_len + 1 : NULL;
+ arg.argv_step = 1;
+ }
+ }
+
+ if (arg.name && !arg.val && def->has_val)
+ die("Error: option %s requires argument.\n", arg.name);
+
+ if (arg.name && arg.val && !def->has_val)
+ die("Error: option %s requires no argument.\n", arg.name);
+
+ if (arg.name
+ && (arg.val || !def->has_val)) {
+ arg.def = def;
+ *arg_ = arg;
+ return 1;
+ }
+
+ return 0;
+}
+
+
+const char *arg_next(struct arg *arg) {
+ if (arg->argv[0])
+ arg->argv += arg->argv_step;
+
+ return *arg->argv;
+}
+
+
+char **argv_dup(int argc, const char **argv) {
+ char **new_argv = malloc((argc + 1) * sizeof(*argv));
+
+ memcpy(new_argv, argv, argc * sizeof(*argv));
+ new_argv[argc] = NULL;
+ return new_argv;
+}
+
+
+void arg_show_usage(FILE *fp, const struct arg_def *const *defs) {
+ char option_text[40] = {0};
+
+ for (; *defs; defs++) {
+ const struct arg_def *def = *defs;
+ char *short_val = def->has_val ? " " : "";
+ char *long_val = def->has_val ? "=" : "";
+
+ if (def->short_name && def->long_name) {
+ char *comma = def->has_val ? "," : ", ";
+
+ snprintf(option_text, 37, "-%s%s%s --%s%6s",
+ def->short_name, short_val, comma,
+ def->long_name, long_val);
+ } else if (def->short_name)
+ snprintf(option_text, 37, "-%s%s",
+ def->short_name, short_val);
+ else if (def->long_name)
+ snprintf(option_text, 37, " --%s%s",
+ def->long_name, long_val);
+
+ fprintf(fp, " %-37s\t%s\n", option_text, def->desc);
+
+ if (def->enums) {
+ const struct arg_enum_list *listptr;
+
+ fprintf(fp, " %-37s\t ", "");
+
+ for (listptr = def->enums; listptr->name; listptr++)
+ fprintf(fp, "%s%s", listptr->name,
+ listptr[1].name ? ", " : "\n");
+ }
+ }
+}
+
+
+unsigned int arg_parse_uint(const struct arg *arg) {
+ long int rawval;
+ char *endptr;
+
+ rawval = strtol(arg->val, &endptr, 10);
+
+ if (arg->val[0] != '\0' && endptr[0] == '\0') {
+ if (rawval >= 0 && rawval <= UINT_MAX)
+ return rawval;
+
+ die("Option %s: Value %ld out of range for unsigned int\n",
+ arg->name, rawval);
+ }
+
+ die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
+ return 0;
+}
+
+
+int arg_parse_int(const struct arg *arg) {
+ long int rawval;
+ char *endptr;
+
+ rawval = strtol(arg->val, &endptr, 10);
+
+ if (arg->val[0] != '\0' && endptr[0] == '\0') {
+ if (rawval >= INT_MIN && rawval <= INT_MAX)
+ return rawval;
+
+ die("Option %s: Value %ld out of range for signed int\n",
+ arg->name, rawval);
+ }
+
+ die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
+ return 0;
+}
+
+
+struct vpx_rational {
+ int num; /**< fraction numerator */
+ int den; /**< fraction denominator */
+};
+struct vpx_rational arg_parse_rational(const struct arg *arg) {
+ long int rawval;
+ char *endptr;
+ struct vpx_rational rat;
+
+ /* parse numerator */
+ rawval = strtol(arg->val, &endptr, 10);
+
+ if (arg->val[0] != '\0' && endptr[0] == '/') {
+ if (rawval >= INT_MIN && rawval <= INT_MAX)
+ rat.num = rawval;
+ else die("Option %s: Value %ld out of range for signed int\n",
+ arg->name, rawval);
+ } else die("Option %s: Expected / at '%c'\n", arg->name, *endptr);
+
+ /* parse denominator */
+ rawval = strtol(endptr + 1, &endptr, 10);
+
+ if (arg->val[0] != '\0' && endptr[0] == '\0') {
+ if (rawval >= INT_MIN && rawval <= INT_MAX)
+ rat.den = rawval;
+ else die("Option %s: Value %ld out of range for signed int\n",
+ arg->name, rawval);
+ } else die("Option %s: Invalid character '%c'\n", arg->name, *endptr);
+
+ return rat;
+}
+
+
+int arg_parse_enum(const struct arg *arg) {
+ const struct arg_enum_list *listptr;
+ long int rawval;
+ char *endptr;
+
+ /* First see if the value can be parsed as a raw value */
+ rawval = strtol(arg->val, &endptr, 10);
+ if (arg->val[0] != '\0' && endptr[0] == '\0') {
+ /* Got a raw value, make sure it's valid */
+ for (listptr = arg->def->enums; listptr->name; listptr++)
+ if (listptr->val == rawval)
+ return rawval;
+ }
+
+ /* Next see if it can be parsed as a string */
+ for (listptr = arg->def->enums; listptr->name; listptr++)
+ if (!strcmp(arg->val, listptr->name))
+ return listptr->val;
+
+ die("Option %s: Invalid value '%s'\n", arg->name, arg->val);
+ return 0;
+}
+
+
+int arg_parse_enum_or_int(const struct arg *arg) {
+ if (arg->def->enums)
+ return arg_parse_enum(arg);
+ return arg_parse_int(arg);
+}
diff --git a/libs/libvpx/args.h b/libs/libvpx/args.h
new file mode 100644
index 0000000000..1f37151a02
--- /dev/null
+++ b/libs/libvpx/args.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010 The WebM 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 ARGS_H_
+#define ARGS_H_
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct arg {
+ char **argv;
+ const char *name;
+ const char *val;
+ unsigned int argv_step;
+ const struct arg_def *def;
+};
+
+struct arg_enum_list {
+ const char *name;
+ int val;
+};
+#define ARG_ENUM_LIST_END {0}
+
+typedef struct arg_def {
+ const char *short_name;
+ const char *long_name;
+ int has_val;
+ const char *desc;
+ const struct arg_enum_list *enums;
+} arg_def_t;
+#define ARG_DEF(s,l,v,d) {s,l,v,d, NULL}
+#define ARG_DEF_ENUM(s,l,v,d,e) {s,l,v,d,e}
+#define ARG_DEF_LIST_END {0}
+
+struct arg arg_init(char **argv);
+int arg_match(struct arg *arg_, const struct arg_def *def, char **argv);
+const char *arg_next(struct arg *arg);
+void arg_show_usage(FILE *fp, const struct arg_def *const *defs);
+char **argv_dup(int argc, const char **argv);
+
+unsigned int arg_parse_uint(const struct arg *arg);
+int arg_parse_int(const struct arg *arg);
+struct vpx_rational arg_parse_rational(const struct arg *arg);
+int arg_parse_enum(const struct arg *arg);
+int arg_parse_enum_or_int(const struct arg *arg);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif // ARGS_H_
diff --git a/libs/libvpx/build/.gitattributes b/libs/libvpx/build/.gitattributes
new file mode 100644
index 0000000000..03db79bc08
--- /dev/null
+++ b/libs/libvpx/build/.gitattributes
@@ -0,0 +1,2 @@
+*-vs8/*.rules -crlf
+*-msvs/*.rules -crlf
diff --git a/libs/libvpx/build/.gitignore b/libs/libvpx/build/.gitignore
new file mode 100644
index 0000000000..1350fcb5eb
--- /dev/null
+++ b/libs/libvpx/build/.gitignore
@@ -0,0 +1 @@
+x86*-win32-vs*
diff --git a/libs/libvpx/build/make/Android.mk b/libs/libvpx/build/make/Android.mk
new file mode 100644
index 0000000000..df01dece67
--- /dev/null
+++ b/libs/libvpx/build/make/Android.mk
@@ -0,0 +1,205 @@
+##
+## Copyright (c) 2012 The WebM 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 used for compiling libvpx for Android using the NDK.
+# In an Android project place a libvpx checkout in the jni directory.
+# Run the configure script from the jni directory. Base libvpx
+# encoder/decoder configuration will look similar to:
+# ./libvpx/configure --target=armv7-android-gcc --disable-examples \
+# --sdk-path=/opt/android-ndk-r6b/
+#
+# When targeting Android, realtime-only is enabled by default. This can
+# be overridden by adding the command line flag:
+# --disable-realtime-only
+#
+# This will create .mk files that contain variables that contain the
+# source files to compile.
+#
+# Place an Android.mk file in the jni directory that references the
+# Android.mk file in the libvpx directory:
+# LOCAL_PATH := $(call my-dir)
+# include $(CLEAR_VARS)
+# include jni/libvpx/build/make/Android.mk
+#
+# There are currently two TARGET_ARCH_ABI targets for ARM.
+# armeabi and armeabi-v7a. armeabi-v7a is selected by creating an
+# Application.mk in the jni directory that contains:
+# APP_ABI := armeabi-v7a
+#
+# By default libvpx will detect at runtime the existance of NEON extension.
+# For this we import the 'cpufeatures' module from the NDK sources.
+# libvpx can also be configured without this runtime detection method.
+# Configuring with --disable-runtime-cpu-detect will assume presence of NEON.
+# Configuring with --disable-runtime-cpu-detect --disable-neon \
+# --disable-neon-asm
+# will remove any NEON dependency.
+
+# To change to building armeabi, run ./libvpx/configure again, but with
+# --target=armv6-android-gcc and modify the Application.mk file to
+# set APP_ABI := armeabi
+#
+# Running ndk-build will build libvpx and include it in your project.
+#
+
+CONFIG_DIR := $(LOCAL_PATH)/
+LIBVPX_PATH := $(LOCAL_PATH)/libvpx
+ASM_CNV_PATH_LOCAL := $(TARGET_ARCH_ABI)/ads2gas
+ASM_CNV_PATH := $(LOCAL_PATH)/$(ASM_CNV_PATH_LOCAL)
+
+# Use the makefiles generated by upstream configure to determine which files to
+# build. Also set any architecture-specific flags.
+ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ include $(CONFIG_DIR)libs-armv7-android-gcc.mk
+ LOCAL_ARM_MODE := arm
+else ifeq ($(TARGET_ARCH_ABI),armeabi)
+ include $(CONFIG_DIR)libs-armv6-android-gcc.mk
+ LOCAL_ARM_MODE := arm
+else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
+ include $(CONFIG_DIR)libs-armv8-android-gcc.mk
+ LOCAL_ARM_MODE := arm
+else ifeq ($(TARGET_ARCH_ABI),x86)
+ include $(CONFIG_DIR)libs-x86-android-gcc.mk
+else ifeq ($(TARGET_ARCH_ABI),x86_64)
+ include $(CONFIG_DIR)libs-x86_64-android-gcc.mk
+else ifeq ($(TARGET_ARCH_ABI),mips)
+ include $(CONFIG_DIR)libs-mips-android-gcc.mk
+else
+ $(error Not a supported TARGET_ARCH_ABI: $(TARGET_ARCH_ABI))
+endif
+
+# Rule that is normally in Makefile created by libvpx
+# configure. Used to filter out source files based on configuration.
+enabled=$(filter-out $($(1)-no),$($(1)-yes))
+
+# Override the relative path that is defined by the libvpx
+# configure process
+SRC_PATH_BARE := $(LIBVPX_PATH)
+
+# Include the list of files to be built
+include $(LIBVPX_PATH)/libs.mk
+
+# Optimise the code. May want to revisit this setting in the future.
+LOCAL_CFLAGS := -O3
+
+# For x86, include the source code in the search path so it will find files
+# like x86inc.asm and x86_abi_support.asm
+LOCAL_ASMFLAGS := -I$(LIBVPX_PATH)
+
+.PRECIOUS: %.asm.s
+$(ASM_CNV_PATH)/libvpx/%.asm.s: $(LIBVPX_PATH)/%.asm
+ @mkdir -p $(dir $@)
+ @$(CONFIG_DIR)$(ASM_CONVERSION) <$< > $@
+
+# For building *_rtcd.h, which have rules in libs.mk
+TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN)))
+target := libs
+
+LOCAL_SRC_FILES += vpx_config.c
+
+# Remove duplicate entries
+CODEC_SRCS_UNIQUE = $(sort $(CODEC_SRCS))
+
+# Pull out C files. vpx_config.c is in the immediate directory and
+# so it does not need libvpx/ prefixed like the rest of the source files.
+# The neon files with intrinsics need to have .neon appended so the proper
+# flags are applied.
+CODEC_SRCS_C = $(filter %.c, $(CODEC_SRCS_UNIQUE))
+LOCAL_NEON_SRCS_C = $(filter %_neon.c, $(CODEC_SRCS_C))
+LOCAL_CODEC_SRCS_C = $(filter-out vpx_config.c %_neon.c, $(CODEC_SRCS_C))
+
+LOCAL_SRC_FILES += $(foreach file, $(LOCAL_CODEC_SRCS_C), libvpx/$(file))
+ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file).neon)
+else # If there are neon sources then we are building for arm64 and do not need to specify .neon
+ LOCAL_SRC_FILES += $(foreach file, $(LOCAL_NEON_SRCS_C), libvpx/$(file))
+endif
+
+# Pull out assembly files, splitting NEON from the rest. This is
+# done to specify that the NEON assembly files use NEON assembler flags.
+# x86 assembly matches %.asm, arm matches %.asm.s
+
+# x86:
+
+CODEC_SRCS_ASM_X86 = $(filter %.asm, $(CODEC_SRCS_UNIQUE))
+LOCAL_SRC_FILES += $(foreach file, $(CODEC_SRCS_ASM_X86), libvpx/$(file))
+
+# arm:
+CODEC_SRCS_ASM_ARM_ALL = $(filter %.asm.s, $(CODEC_SRCS_UNIQUE))
+CODEC_SRCS_ASM_ARM = $(foreach v, \
+ $(CODEC_SRCS_ASM_ARM_ALL), \
+ $(if $(findstring neon,$(v)),,$(v)))
+CODEC_SRCS_ASM_ADS2GAS = $(patsubst %.s, \
+ $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
+ $(CODEC_SRCS_ASM_ARM))
+LOCAL_SRC_FILES += $(CODEC_SRCS_ASM_ADS2GAS)
+
+ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ CODEC_SRCS_ASM_NEON = $(foreach v, \
+ $(CODEC_SRCS_ASM_ARM_ALL),\
+ $(if $(findstring neon,$(v)),$(v),))
+ CODEC_SRCS_ASM_NEON_ADS2GAS = $(patsubst %.s, \
+ $(ASM_CNV_PATH_LOCAL)/libvpx/%.s, \
+ $(CODEC_SRCS_ASM_NEON))
+ LOCAL_SRC_FILES += $(patsubst %.s, \
+ %.s.neon, \
+ $(CODEC_SRCS_ASM_NEON_ADS2GAS))
+endif
+
+LOCAL_CFLAGS += \
+ -DHAVE_CONFIG_H=vpx_config.h \
+ -I$(LIBVPX_PATH) \
+ -I$(ASM_CNV_PATH)
+
+LOCAL_MODULE := libvpx
+
+ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
+ LOCAL_STATIC_LIBRARIES := cpufeatures
+endif
+
+# Add a dependency to force generation of the RTCD files.
+define rtcd_dep_template
+rtcd_dep_template_SRCS := $(addprefix $(LOCAL_PATH)/, $(LOCAL_SRC_FILES))
+rtcd_dep_template_SRCS := $$(rtcd_dep_template_SRCS:.neon=)
+ifeq ($(CONFIG_VP8), yes)
+$$(rtcd_dep_template_SRCS): vp8_rtcd.h
+endif
+ifeq ($(CONFIG_VP9), yes)
+$$(rtcd_dep_template_SRCS): vp9_rtcd.h
+endif
+ifeq ($(CONFIG_VP10), yes)
+$$(rtcd_dep_template_SRCS): vp10_rtcd.h
+endif
+$$(rtcd_dep_template_SRCS): vpx_scale_rtcd.h
+$$(rtcd_dep_template_SRCS): vpx_dsp_rtcd.h
+
+ifneq ($(findstring $(TARGET_ARCH_ABI),x86 x86_64),)
+$$(rtcd_dep_template_SRCS): vpx_config.asm
+endif
+endef
+
+$(eval $(call rtcd_dep_template))
+
+.PHONY: clean
+clean:
+ @echo "Clean: ads2gas files [$(TARGET_ARCH_ABI)]"
+ @$(RM) $(CODEC_SRCS_ASM_ADS2GAS) $(CODEC_SRCS_ASM_NEON_ADS2GAS)
+ @$(RM) -r $(ASM_CNV_PATH)
+ @$(RM) $(CLEAN-OBJS)
+
+ifeq ($(ENABLE_SHARED),1)
+ include $(BUILD_SHARED_LIBRARY)
+else
+ include $(BUILD_STATIC_LIBRARY)
+endif
+
+ifeq ($(CONFIG_RUNTIME_CPU_DETECT),yes)
+$(call import-module,cpufeatures)
+endif
diff --git a/libs/libvpx/build/make/Makefile b/libs/libvpx/build/make/Makefile
new file mode 100644
index 0000000000..3081a92680
--- /dev/null
+++ b/libs/libvpx/build/make/Makefile
@@ -0,0 +1,455 @@
+##
+## Copyright (c) 2010 The WebM 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 config.mk
+quiet?=true
+ifeq ($(target),)
+# If a target wasn't specified, invoke for all enabled targets.
+.DEFAULT:
+ @for t in $(ALL_TARGETS); do \
+ $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
+ done
+all: .DEFAULT
+clean:: .DEFAULT
+exampletest: .DEFAULT
+install:: .DEFAULT
+test:: .DEFAULT
+test-no-data-check:: .DEFAULT
+testdata:: .DEFAULT
+utiltest: .DEFAULT
+exampletest-no-data-check utiltest-no-data-check: .DEFAULT
+
+
+# Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
+# installed on cygwin, so we need to autodetect here.
+md5sum := $(firstword $(wildcard \
+ $(foreach e,md5sum openssl,\
+ $(foreach p,$(subst :, ,$(PATH)),$(p)/$(e)*))\
+ ))
+md5sum := $(if $(filter %openssl,$(md5sum)),$(md5sum) dgst -md5,$(md5sum))
+
+TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
+dist:
+ @for t in $(ALL_TARGETS); do \
+ $(MAKE) --no-print-directory target=$$t $(MAKECMDGOALS) || exit $$?;\
+ done
+ # Run configure for the user with the current toolchain.
+ @if [ -d "$(DIST_DIR)/src" ]; then \
+ mkdir -p "$(DIST_DIR)/build"; \
+ cd "$(DIST_DIR)/build"; \
+ echo "Rerunning configure $(CONFIGURE_ARGS)"; \
+ ../src/configure $(CONFIGURE_ARGS); \
+ $(if $(filter vs%,$(TGT_CC)),make NO_LAUNCH_DEVENV=1;) \
+ fi
+ @if [ -d "$(DIST_DIR)" ]; then \
+ echo " [MD5SUM] $(DIST_DIR)"; \
+ cd $(DIST_DIR) && \
+ $(md5sum) `find . -name md5sums.txt -prune -o -type f -print` \
+ | sed -e 's/MD5(\(.*\))= \([0-9a-f]\{32\}\)/\2 \1/' \
+ > md5sums.txt;\
+ fi
+endif
+
+# Since we invoke make recursively for multiple targets we need to include the
+# .mk file for the correct target, but only when $(target) is non-empty.
+ifneq ($(target),)
+include $(target)-$(TOOLCHAIN).mk
+endif
+BUILD_ROOT?=.
+VPATH=$(SRC_PATH_BARE)
+CFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
+CXXFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT) -I$(SRC_PATH)
+ASFLAGS+=-I$(BUILD_PFX)$(BUILD_ROOT)/ -I$(SRC_PATH)/
+DIST_DIR?=dist
+HOSTCC?=gcc
+TGT_ISA:=$(word 1, $(subst -, ,$(TOOLCHAIN)))
+TGT_OS:=$(word 2, $(subst -, ,$(TOOLCHAIN)))
+TGT_CC:=$(word 3, $(subst -, ,$(TOOLCHAIN)))
+quiet:=$(if $(or $(verbose), $(V)),, yes)
+qexec=$(if $(quiet),@)
+
+# Cancel built-in implicit rules
+%: %.o
+%.asm:
+%.a:
+%: %.cc
+
+#
+# Common rules"
+#
+.PHONY: all
+all:
+
+.PHONY: clean
+clean::
+ rm -f $(OBJS-yes) $(OBJS-yes:.o=.d) $(OBJS-yes:.asm.s.o=.asm.s)
+ rm -f $(CLEAN-OBJS)
+
+.PHONY: clean
+distclean: clean
+ if [ -z "$(target)" ]; then \
+ rm -f Makefile; \
+ rm -f config.log config.mk; \
+ rm -f vpx_config.[hc] vpx_config.asm; \
+ else \
+ rm -f $(target)-$(TOOLCHAIN).mk; \
+ fi
+
+.PHONY: dist
+dist:
+.PHONY: exampletest
+exampletest:
+.PHONY: install
+install::
+.PHONY: test
+test::
+.PHONY: testdata
+testdata::
+.PHONY: utiltest
+utiltest:
+.PHONY: test-no-data-check exampletest-no-data-check utiltest-no-data-check
+test-no-data-check::
+exampletest-no-data-check utiltest-no-data-check:
+
+# Add compiler flags for intrinsic files
+ifeq ($(TOOLCHAIN), x86-os2-gcc)
+STACKREALIGN=-mstackrealign
+else
+STACKREALIGN=
+endif
+
+$(BUILD_PFX)%_mmx.c.d: CFLAGS += -mmmx
+$(BUILD_PFX)%_mmx.c.o: CFLAGS += -mmmx
+$(BUILD_PFX)%_sse2.c.d: CFLAGS += -msse2 $(STACKREALIGN)
+$(BUILD_PFX)%_sse2.c.o: CFLAGS += -msse2 $(STACKREALIGN)
+$(BUILD_PFX)%_sse3.c.d: CFLAGS += -msse3 $(STACKREALIGN)
+$(BUILD_PFX)%_sse3.c.o: CFLAGS += -msse3 $(STACKREALIGN)
+$(BUILD_PFX)%_ssse3.c.d: CFLAGS += -mssse3 $(STACKREALIGN)
+$(BUILD_PFX)%_ssse3.c.o: CFLAGS += -mssse3 $(STACKREALIGN)
+$(BUILD_PFX)%_sse4.c.d: CFLAGS += -msse4.1 $(STACKREALIGN)
+$(BUILD_PFX)%_sse4.c.o: CFLAGS += -msse4.1 $(STACKREALIGN)
+$(BUILD_PFX)%_avx.c.d: CFLAGS += -mavx $(STACKREALIGN)
+$(BUILD_PFX)%_avx.c.o: CFLAGS += -mavx $(STACKREALIGN)
+$(BUILD_PFX)%_avx2.c.d: CFLAGS += -mavx2 $(STACKREALIGN)
+$(BUILD_PFX)%_avx2.c.o: CFLAGS += -mavx2 $(STACKREALIGN)
+$(BUILD_PFX)%vp9_reconintra.c.d: CFLAGS += $(STACKREALIGN)
+$(BUILD_PFX)%vp9_reconintra.c.o: CFLAGS += $(STACKREALIGN)
+
+$(BUILD_PFX)%.c.d: %.c
+ $(if $(quiet),@echo " [DEP] $@")
+ $(qexec)mkdir -p $(dir $@)
+ $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -M $< | $(fmt_deps) > $@
+
+$(BUILD_PFX)%.c.o: %.c
+ $(if $(quiet),@echo " [CC] $@")
+ $(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
+ $(qexec)$(CC) $(INTERNAL_CFLAGS) $(CFLAGS) -c -o $@ $<
+
+$(BUILD_PFX)%.cc.d: %.cc
+ $(if $(quiet),@echo " [DEP] $@")
+ $(qexec)mkdir -p $(dir $@)
+ $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@
+
+$(BUILD_PFX)%.cc.o: %.cc
+ $(if $(quiet),@echo " [CXX] $@")
+ $(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
+ $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
+
+$(BUILD_PFX)%.cpp.d: %.cpp
+ $(if $(quiet),@echo " [DEP] $@")
+ $(qexec)mkdir -p $(dir $@)
+ $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -M $< | $(fmt_deps) > $@
+
+$(BUILD_PFX)%.cpp.o: %.cpp
+ $(if $(quiet),@echo " [CXX] $@")
+ $(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
+ $(qexec)$(CXX) $(INTERNAL_CFLAGS) $(CXXFLAGS) -c -o $@ $<
+
+$(BUILD_PFX)%.asm.d: %.asm
+ $(if $(quiet),@echo " [DEP] $@")
+ $(qexec)mkdir -p $(dir $@)
+ $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \
+ --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@
+
+$(BUILD_PFX)%.asm.o: %.asm
+ $(if $(quiet),@echo " [AS] $@")
+ $(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
+ $(qexec)$(AS) $(ASFLAGS) -o $@ $<
+
+$(BUILD_PFX)%.s.d: %.s
+ $(if $(quiet),@echo " [DEP] $@")
+ $(qexec)mkdir -p $(dir $@)
+ $(qexec)$(SRC_PATH_BARE)/build/make/gen_asm_deps.sh \
+ --build-pfx=$(BUILD_PFX) --depfile=$@ $(ASFLAGS) $< > $@
+
+$(BUILD_PFX)%.s.o: %.s
+ $(if $(quiet),@echo " [AS] $@")
+ $(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
+ $(qexec)$(AS) $(ASFLAGS) -o $@ $<
+
+.PRECIOUS: %.c.S
+%.c.S: CFLAGS += -DINLINE_ASM
+$(BUILD_PFX)%.c.S: %.c
+ $(if $(quiet),@echo " [GEN] $@")
+ $(qexec)$(if $(CONFIG_DEPENDENCY_TRACKING),,mkdir -p $(dir $@))
+ $(qexec)$(CC) -S $(CFLAGS) -o $@ $<
+
+.PRECIOUS: %.asm.s
+$(BUILD_PFX)%.asm.s: %.asm
+ $(if $(quiet),@echo " [ASM CONVERSION] $@")
+ $(qexec)mkdir -p $(dir $@)
+ $(qexec)$(ASM_CONVERSION) <$< >$@
+
+# If we're in debug mode, pretend we don't have GNU strip, to fall back to
+# the copy implementation
+HAVE_GNU_STRIP := $(if $(CONFIG_DEBUG),,$(HAVE_GNU_STRIP))
+ifeq ($(HAVE_GNU_STRIP),yes)
+# Older binutils strip global symbols not needed for relocation processing
+# when given --strip-unneeded. Using nm and awk to identify globals and
+# keep them caused command line length issues under mingw and segfaults in
+# test_libvpx were observed under OS/2: simply use --strip-debug.
+%.a: %_g.a
+ $(if $(quiet),@echo " [STRIP] $@ < $<")
+ $(qexec)$(STRIP) --strip-debug \
+ -o $@ $<
+else
+%.a: %_g.a
+ $(if $(quiet),@echo " [CP] $@ < $<")
+ $(qexec)cp $< $@
+endif
+
+#
+# Utility functions
+#
+pairmap=$(if $(strip $(2)),\
+ $(call $(1),$(word 1,$(2)),$(word 2,$(2)))\
+ $(call pairmap,$(1),$(wordlist 3,$(words $(2)),$(2)))\
+)
+
+enabled=$(filter-out $($(1)-no),$($(1)-yes))
+cond_enabled=$(if $(filter yes,$($(1))), $(call enabled,$(2)))
+
+find_file1=$(word 1,$(wildcard $(subst //,/,$(addsuffix /$(1),$(2)))))
+find_file=$(foreach f,$(1),$(call find_file1,$(strip $(f)),$(strip $(2))) )
+obj_pats=.c=.c.o $(AS_SFX)=$(AS_SFX).o .cc=.cc.o .cpp=.cpp.o
+objs=$(addprefix $(BUILD_PFX),$(foreach p,$(obj_pats),$(filter %.o,$(1:$(p))) ))
+
+install_map_templates=$(eval $(call install_map_template,$(1),$(2)))
+
+not=$(subst yes,no,$(1))
+
+ifeq ($(CONFIG_MSVS),yes)
+lib_file_name=$(1).lib
+else
+lib_file_name=lib$(1).a
+endif
+#
+# Rule Templates
+#
+define linker_template
+$(1): $(filter-out -%,$(2))
+$(1):
+ $(if $(quiet),@echo " [LD] $$@")
+ $(qexec)$$(LD) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
+endef
+define linkerxx_template
+$(1): $(filter-out -%,$(2))
+$(1):
+ $(if $(quiet),@echo " [LD] $$@")
+ $(qexec)$$(CXX) $$(strip $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -o $$@ $(2) $(3) $$(extralibs))
+endef
+# make-3.80 has a bug with expanding large input strings to the eval function,
+# which was triggered in some cases by the following component of
+# linker_template:
+# $(1): $$(call find_file, $(patsubst -l%,lib%.a,$(filter -l%,$(2))),\
+# $$(patsubst -L%,%,$$(filter -L%,$$(LDFLAGS) $(2))))
+# This may be useful to revisit in the future (it tries to locate libraries
+# in a search path and add them as prerequisites
+
+define install_map_template
+$(DIST_DIR)/$(1): $(2)
+ $(if $(quiet),@echo " [INSTALL] $$@")
+ $(qexec)mkdir -p $$(dir $$@)
+ $(qexec)cp -p $$< $$@
+endef
+
+define archive_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.
+$(1):
+ $(if $(quiet),@echo " [AR] $$@")
+ $(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,$$(EXPORTS_FILE) -o $$@ \
+ $$(filter %.o,$$^) $$(extralibs)
+endef
+
+define dl_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.
+$(1):
+ $(if $(quiet),@echo " [LD] $$@")
+ $(qexec)$$(LD) -dynamiclib $$(LDFLAGS) \
+ -exported_symbols_list $$(EXPORTS_FILE) \
+ -Wl,-headerpad_max_install_names,-compatibility_version,1.0,-current_version,$$(VERSION_MAJOR) \
+ -o $$@ \
+ $$(filter %.o,$$^) $$(extralibs)
+endef
+
+define dll_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.
+$(1):
+ $(if $(quiet),@echo " [LD] $$@")
+ $(qexec)$$(LD) -Zdll $$(LDFLAGS) \
+ -o $$@ \
+ $$(filter %.o,$$^) $$(extralibs) $$(EXPORTS_FILE)
+endef
+
+
+#
+# Get current configuration
+#
+ifneq ($(target),)
+include $(SRC_PATH_BARE)/$(target:-$(TOOLCHAIN)=).mk
+endif
+
+skip_deps := $(filter %clean,$(MAKECMDGOALS))
+skip_deps += $(findstring testdata,$(MAKECMDGOALS))
+ifeq ($(strip $(skip_deps)),)
+ ifeq ($(CONFIG_DEPENDENCY_TRACKING),yes)
+ # Older versions of make don't like -include directives with no arguments
+ ifneq ($(filter %.d,$(OBJS-yes:.o=.d)),)
+ -include $(filter %.d,$(OBJS-yes:.o=.d))
+ endif
+ endif
+endif
+
+#
+# Configuration dependent rules
+#
+$(call pairmap,install_map_templates,$(INSTALL_MAPS))
+
+DOCS=$(call cond_enabled,CONFIG_INSTALL_DOCS,DOCS)
+.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 $@
+
+clean::
+ rm -f .docs .install-docs $(DOCS)
+
+BINS=$(call enabled,BINS)
+.bins: $(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 $@
+
+clean::
+ rm -f .bins .install-bins $(BINS)
+
+LIBS=$(call enabled,LIBS)
+.libs: $(LIBS)
+ @touch $@
+$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
+$(foreach lib,$(filter %so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
+$(foreach lib,$(filter %$(SO_VERSION_MAJOR).dylib,$(LIBS)),$(eval $(call dl_template,$(lib))))
+$(foreach lib,$(filter %$(SO_VERSION_MAJOR).dll,$(LIBS)),$(eval $(call dll_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 $@
+
+clean::
+ rm -f .libs .install-libs $(LIBS)
+
+ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
+PROJECTS=$(call enabled,PROJECTS)
+.projects: $(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 $@
+
+clean::
+ rm -f .projects .install-projects $(PROJECTS)
+endif
+
+# If there are any source files to be distributed, then include the build
+# system too.
+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_MSVS) += build/make/gen_msvs_vcxproj.sh
+ DIST-SRCS-$(CONFIG_MSVS) += build/make/msvs_common.sh
+ DIST-SRCS-$(CONFIG_RVCT) += build/make/armlink_adapter.sh
+ DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas.pl
+ DIST-SRCS-$(ARCH_ARM) += build/make/ads2gas_apple.pl
+ DIST-SRCS-$(ARCH_ARM) += build/make/ads2armasm_ms.pl
+ DIST-SRCS-$(ARCH_ARM) += build/make/thumb.pm
+ 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 $@
+
+clean::
+ rm -f .install-srcs
+
+ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
+ BUILD_TARGETS += .projects
+ INSTALL_TARGETS += .install-projects
+endif
+BUILD_TARGETS += .docs .libs .bins
+INSTALL_TARGETS += .install-docs .install-srcs .install-libs .install-bins
+all: $(BUILD_TARGETS)
+install:: $(INSTALL_TARGETS)
+dist: $(INSTALL_TARGETS)
+test::
diff --git a/libs/libvpx/build/make/ads2armasm_ms.pl b/libs/libvpx/build/make/ads2armasm_ms.pl
new file mode 100755
index 0000000000..2a2c470ff8
--- /dev/null
+++ b/libs/libvpx/build/make/ads2armasm_ms.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/env perl
+##
+## Copyright (c) 2013 The WebM 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.
+##
+
+use FindBin;
+use lib $FindBin::Bin;
+use thumb;
+
+print "; This file was created from a .asm file\n";
+print "; using the ads2armasm_ms.pl script.\n";
+
+while ()
+{
+ undef $comment;
+ undef $line;
+
+ s/REQUIRE8//;
+ s/PRESERVE8//;
+ s/^\s*ARM\s*$//;
+ s/AREA\s+\|\|(.*)\|\|/AREA |$1|/;
+ s/qsubaddx/qsax/i;
+ s/qaddsubx/qasx/i;
+
+ thumb::FixThumbInstructions($_, 1);
+
+ s/ldrneb/ldrbne/i;
+ s/ldrneh/ldrhne/i;
+ s/^(\s*)ENDP.*/$&\n$1ALIGN 4/;
+
+ print;
+}
+
diff --git a/libs/libvpx/build/make/ads2gas.pl b/libs/libvpx/build/make/ads2gas.pl
new file mode 100755
index 0000000000..7272424af2
--- /dev/null
+++ b/libs/libvpx/build/make/ads2gas.pl
@@ -0,0 +1,236 @@
+#!/usr/bin/env perl
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+# ads2gas.pl
+# Author: Eric Fung (efung (at) acm.org)
+#
+# Convert ARM Developer Suite 1.0.1 syntax assembly source to GNU as format
+#
+# Usage: cat inputfile | perl ads2gas.pl > outputfile
+#
+
+use FindBin;
+use lib $FindBin::Bin;
+use thumb;
+
+my $thumb = 0;
+
+foreach my $arg (@ARGV) {
+ $thumb = 1 if ($arg eq "-thumb");
+}
+
+print "@ This file was created from a .asm file\n";
+print "@ using the ads2gas.pl script.\n";
+print "\t.equ DO1STROUNDING, 0\n";
+if ($thumb) {
+ print "\t.syntax unified\n";
+ print "\t.thumb\n";
+}
+
+# Stack of procedure names.
+@proc_stack = ();
+
+while ()
+{
+ undef $comment;
+ undef $line;
+ $comment_char = ";";
+ $comment_sub = "@";
+
+ # Handle comments.
+ if (/$comment_char/)
+ {
+ $comment = "";
+ ($line, $comment) = /(.*?)$comment_char(.*)/;
+ $_ = $line;
+ }
+
+ # Load and store alignment
+ s/@/,:/g;
+
+ # Hexadecimal constants prefaced by 0x
+ s/#&/#0x/g;
+
+ # Convert :OR: to |
+ s/:OR:/ | /g;
+
+ # Convert :AND: to &
+ s/:AND:/ & /g;
+
+ # Convert :NOT: to ~
+ s/:NOT:/ ~ /g;
+
+ # Convert :SHL: to <<
+ s/:SHL:/ << /g;
+
+ # Convert :SHR: to >>
+ s/:SHR:/ >> /g;
+
+ # Convert ELSE to .else
+ s/\bELSE\b/.else/g;
+
+ # Convert ENDIF to .endif
+ s/\bENDIF\b/.endif/g;
+
+ # Convert ELSEIF to .elseif
+ s/\bELSEIF\b/.elseif/g;
+
+ # Convert LTORG to .ltorg
+ s/\bLTORG\b/.ltorg/g;
+
+ # Convert endfunc to nothing.
+ s/\bendfunc\b//ig;
+
+ # Convert FUNCTION to nothing.
+ s/\bFUNCTION\b//g;
+ s/\bfunction\b//g;
+
+ s/\bENTRY\b//g;
+ s/\bMSARMASM\b/0/g;
+ s/^\s+end\s+$//g;
+
+ # Convert IF :DEF:to .if
+ # gcc doesn't have the ability to do a conditional
+ # if defined variable that is set by IF :DEF: on
+ # armasm, so convert it to a normal .if and then
+ # make sure to define a value elesewhere
+ if (s/\bIF :DEF:\b/.if /g)
+ {
+ s/=/==/g;
+ }
+
+ # Convert IF to .if
+ if (s/\bIF\b/.if/g)
+ {
+ s/=+/==/g;
+ }
+
+ # Convert INCLUDE to .INCLUDE "file"
+ s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/;
+
+ # Code directive (ARM vs Thumb)
+ s/CODE([0-9][0-9])/.code $1/;
+
+ # No AREA required
+ # But ALIGNs in AREA must be obeyed
+ s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/;
+ # If no ALIGN, strip the AREA and align to 4 bytes
+ s/^\s*AREA.*$/.text\n.p2align 2/;
+
+ # DCD to .word
+ # This one is for incoming symbols
+ s/DCD\s+\|(\w*)\|/.long $1/;
+
+ # DCW to .short
+ s/DCW\s+\|(\w*)\|/.short $1/;
+ s/DCW(.*)/.short $1/;
+
+ # Constants defined in scope
+ s/DCD(.*)/.long $1/;
+ s/DCB(.*)/.byte $1/;
+
+ # RN to .req
+ if (s/RN\s+([Rr]\d+|lr)/.req $1/)
+ {
+ print;
+ print "$comment_sub$comment\n" if defined $comment;
+ next;
+ }
+
+ # Make function visible to linker, and make additional symbol with
+ # prepended underscore
+ s/EXPORT\s+\|([\$\w]*)\|/.global $1 \n\t.type $1, function/;
+ s/IMPORT\s+\|([\$\w]*)\|/.global $1/;
+
+ s/EXPORT\s+([\$\w]*)/.global $1/;
+ s/export\s+([\$\w]*)/.global $1/;
+
+ # No vertical bars required; make additional symbol with prepended
+ # underscore
+ s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
+
+ # Labels need trailing colon
+# s/^(\w+)/$1:/ if !/EQU/;
+ # put the colon at the end of the line in the macro
+ s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
+
+ # ALIGN directive
+ s/\bALIGN\b/.balign/g;
+
+ if ($thumb) {
+ # ARM code - we force everything to thumb with the declaration in the header
+ s/\sARM//g;
+ } else {
+ # ARM code
+ s/\sARM/.arm/g;
+ }
+
+ # push/pop
+ s/(push\s+)(r\d+)/stmdb sp\!, \{$2\}/g;
+ s/(pop\s+)(r\d+)/ldmia sp\!, \{$2\}/g;
+
+ # NEON code
+ s/(vld1.\d+\s+)(q\d+)/$1\{$2\}/g;
+ s/(vtbl.\d+\s+[^,]+),([^,]+)/$1,\{$2\}/g;
+
+ if ($thumb) {
+ thumb::FixThumbInstructions($_, 0);
+ }
+
+ # eabi_attributes numerical equivalents can be found in the
+ # "ARM IHI 0045C" document.
+
+ # REQUIRE8 Stack is required to be 8-byte aligned
+ s/\sREQUIRE8/.eabi_attribute 24, 1 \@Tag_ABI_align_needed/g;
+
+ # PRESERVE8 Stack 8-byte align is preserved
+ s/\sPRESERVE8/.eabi_attribute 25, 1 \@Tag_ABI_align_preserved/g;
+
+ # Use PROC and ENDP to give the symbols a .size directive.
+ # This makes them show up properly in debugging tools like gdb and valgrind.
+ if (/\bPROC\b/)
+ {
+ my $proc;
+ /^_([\.0-9A-Z_a-z]\w+)\b/;
+ $proc = $1;
+ push(@proc_stack, $proc) if ($proc);
+ s/\bPROC\b/@ $&/;
+ }
+ if (/\bENDP\b/)
+ {
+ my $proc;
+ s/\bENDP\b/@ $&/;
+ $proc = pop(@proc_stack);
+ $_ = "\t.size $proc, .-$proc".$_ if ($proc);
+ }
+
+ # EQU directive
+ s/(\S+\s+)EQU(\s+\S+)/.equ $1, $2/;
+
+ # Begin macro definition
+ if (/\bMACRO\b/) {
+ $_ = ;
+ s/^/.macro/;
+ s/\$//g; # remove formal param reference
+ s/;/@/g; # change comment characters
+ }
+
+ # For macros, use \ to reference formal params
+ s/\$/\\/g; # End macro definition
+ s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
+ next if /^\s*END\s*$/;
+ print;
+ print "$comment_sub$comment\n" if defined $comment;
+}
+
+# Mark that this object doesn't need an executable stack.
+printf ("\t.section\t.note.GNU-stack,\"\",\%\%progbits\n");
diff --git a/libs/libvpx/build/make/ads2gas_apple.pl b/libs/libvpx/build/make/ads2gas_apple.pl
new file mode 100755
index 0000000000..a82f3eba8e
--- /dev/null
+++ b/libs/libvpx/build/make/ads2gas_apple.pl
@@ -0,0 +1,235 @@
+#!/usr/bin/env perl
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+# ads2gas_apple.pl
+# Author: Eric Fung (efung (at) acm.org)
+#
+# Convert ARM Developer Suite 1.0.1 syntax assembly source to GNU as format
+#
+# Usage: cat inputfile | perl ads2gas_apple.pl > outputfile
+#
+
+my $chromium = 0;
+
+foreach my $arg (@ARGV) {
+ $chromium = 1 if ($arg eq "-chromium");
+}
+
+print "@ This file was created from a .asm file\n";
+print "@ using the ads2gas_apple.pl script.\n\n";
+print "\t.set WIDE_REFERENCE, 0\n";
+print "\t.set ARCHITECTURE, 5\n";
+print "\t.set DO1STROUNDING, 0\n";
+
+my %register_aliases;
+my %macro_aliases;
+
+my @mapping_list = ("\$0", "\$1", "\$2", "\$3", "\$4", "\$5", "\$6", "\$7", "\$8", "\$9");
+
+my @incoming_array;
+
+my @imported_functions;
+
+# Perl trim function to remove whitespace from the start and end of the string
+sub trim($)
+{
+ my $string = shift;
+ $string =~ s/^\s+//;
+ $string =~ s/\s+$//;
+ return $string;
+}
+
+while ()
+{
+ # Load and store alignment
+ s/@/,:/g;
+
+ # Comment character
+ s/;/ @/g;
+
+ # Hexadecimal constants prefaced by 0x
+ s/#&/#0x/g;
+
+ # Convert :OR: to |
+ s/:OR:/ | /g;
+
+ # Convert :AND: to &
+ s/:AND:/ & /g;
+
+ # Convert :NOT: to ~
+ s/:NOT:/ ~ /g;
+
+ # Convert :SHL: to <<
+ s/:SHL:/ << /g;
+
+ # Convert :SHR: to >>
+ s/:SHR:/ >> /g;
+
+ # Convert ELSE to .else
+ s/\bELSE\b/.else/g;
+
+ # Convert ENDIF to .endif
+ s/\bENDIF\b/.endif/g;
+
+ # Convert ELSEIF to .elseif
+ s/\bELSEIF\b/.elseif/g;
+
+ # Convert LTORG to .ltorg
+ s/\bLTORG\b/.ltorg/g;
+
+ # Convert IF :DEF:to .if
+ # gcc doesn't have the ability to do a conditional
+ # if defined variable that is set by IF :DEF: on
+ # armasm, so convert it to a normal .if and then
+ # make sure to define a value elesewhere
+ if (s/\bIF :DEF:\b/.if /g)
+ {
+ s/=/==/g;
+ }
+
+ # Convert IF to .if
+ if (s/\bIF\b/.if/g)
+ {
+ s/=/==/g;
+ }
+
+ # Convert INCLUDE to .INCLUDE "file"
+ s/INCLUDE(\s*)(.*)$/.include $1\"$2\"/;
+
+ # Code directive (ARM vs Thumb)
+ s/CODE([0-9][0-9])/.code $1/;
+
+ # No AREA required
+ # But ALIGNs in AREA must be obeyed
+ s/^\s*AREA.*ALIGN=([0-9])$/.text\n.p2align $1/;
+ # If no ALIGN, strip the AREA and align to 4 bytes
+ s/^\s*AREA.*$/.text\n.p2align 2/;
+
+ # DCD to .word
+ # This one is for incoming symbols
+ s/DCD\s+\|(\w*)\|/.long $1/;
+
+ # DCW to .short
+ s/DCW\s+\|(\w*)\|/.short $1/;
+ s/DCW(.*)/.short $1/;
+
+ # Constants defined in scope
+ s/DCD(.*)/.long $1/;
+ s/DCB(.*)/.byte $1/;
+
+ # Build a hash of all the register - alias pairs.
+ if (s/(.*)RN(.*)/$1 .req $2/g)
+ {
+ $register_aliases{trim($1)} = trim($2);
+ next;
+ }
+
+ while (($key, $value) = each(%register_aliases))
+ {
+ s/\b$key\b/$value/g;
+ }
+
+ # Make function visible to linker, and make additional symbol with
+ # prepended underscore
+ s/EXPORT\s+\|([\$\w]*)\|/.globl _$1\n\t.globl $1/;
+
+ # Prepend imported functions with _
+ if (s/IMPORT\s+\|([\$\w]*)\|/.globl $1/)
+ {
+ $function = trim($1);
+ push(@imported_functions, $function);
+ }
+
+ foreach $function (@imported_functions)
+ {
+ s/$function/_$function/;
+ }
+
+ # No vertical bars required; make additional symbol with prepended
+ # underscore
+ s/^\|(\$?\w+)\|/_$1\n\t$1:/g;
+
+ # Labels need trailing colon
+# s/^(\w+)/$1:/ if !/EQU/;
+ # put the colon at the end of the line in the macro
+ s/^([a-zA-Z_0-9\$]+)/$1:/ if !/EQU/;
+
+ # ALIGN directive
+ s/\bALIGN\b/.balign/g;
+
+ # Strip ARM
+ s/\sARM/@ ARM/g;
+
+ # Strip REQUIRE8
+ #s/\sREQUIRE8/@ REQUIRE8/g;
+ s/\sREQUIRE8/@ /g;
+
+ # Strip PRESERVE8
+ s/\sPRESERVE8/@ PRESERVE8/g;
+
+ # Strip PROC and ENDPROC
+ s/\bPROC\b/@/g;
+ s/\bENDP\b/@/g;
+
+ # EQU directive
+ s/(.*)EQU(.*)/.set $1, $2/;
+
+ # Begin macro definition
+ if (/\bMACRO\b/)
+ {
+ # Process next line down, which will be the macro definition
+ $_ = ;
+
+ $trimmed = trim($_);
+
+ # remove commas that are separating list
+ $trimmed =~ s/,//g;
+
+ # string to array
+ @incoming_array = split(/\s+/, $trimmed);
+
+ print ".macro @incoming_array[0]\n";
+
+ # remove the first element, as that is the name of the macro
+ shift (@incoming_array);
+
+ @macro_aliases{@incoming_array} = @mapping_list;
+
+ next;
+ }
+
+ while (($key, $value) = each(%macro_aliases))
+ {
+ $key =~ s/\$/\\\$/;
+ s/$key\b/$value/g;
+ }
+
+ # For macros, use \ to reference formal params
+# s/\$/\\/g; # End macro definition
+ s/\bMEND\b/.endm/; # No need to tell it where to stop assembling
+ next if /^\s*END\s*$/;
+
+ # Clang used by Chromium differs slightly from clang in XCode in what it
+ # will accept in the assembly.
+ if ($chromium) {
+ s/qsubaddx/qsax/i;
+ s/qaddsubx/qasx/i;
+ s/ldrneb/ldrbne/i;
+ s/ldrneh/ldrhne/i;
+ s/(vqshrun\.s16 .*, \#)0$/${1}8/i;
+
+ # http://llvm.org/bugs/show_bug.cgi?id=16022
+ s/\.include/#include/;
+ }
+
+ print;
+}
diff --git a/libs/libvpx/build/make/armlink_adapter.sh b/libs/libvpx/build/make/armlink_adapter.sh
new file mode 100755
index 0000000000..75c342e97c
--- /dev/null
+++ b/libs/libvpx/build/make/armlink_adapter.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+verbose=0
+set -- $*
+for i; do
+ if [ "$i" = "-o" ]; then
+ on_of=1
+ elif [ "$i" = "-v" ]; then
+ verbose=1
+ elif [ "$i" = "-g" ]; then
+ args="${args} --debug"
+ elif [ "$on_of" = "1" ]; then
+ outfile=$i
+ on_of=0
+ elif [ -f "$i" ]; then
+ infiles="$infiles $i"
+ elif [ "${i#-l}" != "$i" ]; then
+ libs="$libs ${i#-l}"
+ elif [ "${i#-L}" != "$i" ]; then
+ libpaths="${libpaths} ${i#-L}"
+ else
+ args="${args} ${i}"
+ fi
+ shift
+done
+
+# Absolutize library file names
+for f in $libs; do
+ found=0
+ for d in $libpaths; do
+ [ -f "$d/$f" ] && infiles="$infiles $d/$f" && found=1 && break
+ [ -f "$d/lib${f}.so" ] && infiles="$infiles $d/lib${f}.so" && found=1 && break
+ [ -f "$d/lib${f}.a" ] && infiles="$infiles $d/lib${f}.a" && found=1 && break
+ done
+ [ $found -eq 0 ] && infiles="$infiles $f"
+done
+for d in $libpaths; do
+ [ -n "$libsearchpath" ] && libsearchpath="${libsearchpath},"
+ libsearchpath="${libsearchpath}$d"
+done
+
+cmd="armlink $args --userlibpath=$libsearchpath --output=$outfile $infiles"
+[ $verbose -eq 1 ] && echo $cmd
+$cmd
diff --git a/libs/libvpx/build/make/configure.sh b/libs/libvpx/build/make/configure.sh
new file mode 100644
index 0000000000..d888268dc8
--- /dev/null
+++ b/libs/libvpx/build/make/configure.sh
@@ -0,0 +1,1502 @@
+#!/bin/sh
+##
+## configure.sh
+##
+## 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.
+##
+
+
+#
+# Logging / Output Functions
+#
+die_unknown(){
+ echo "Unknown option \"$1\"."
+ echo "See $0 --help for available options."
+ clean_temp_files
+ exit 1
+}
+
+die() {
+ echo "$@"
+ echo
+ echo "Configuration failed. This could reflect a misconfiguration of your"
+ echo "toolchains, improper options selected, or another problem. If you"
+ echo "don't see any useful error messages above, the next step is to look"
+ echo "at the configure error log file ($logfile) to determine what"
+ echo "configure was trying to do when it died."
+ clean_temp_files
+ exit 1
+}
+
+log(){
+ echo "$@" >>$logfile
+}
+
+log_file(){
+ log BEGIN $1
+ cat -n $1 >>$logfile
+ log END $1
+}
+
+log_echo() {
+ echo "$@"
+ log "$@"
+}
+
+fwrite () {
+ outfile=$1
+ shift
+ echo "$@" >> ${outfile}
+}
+
+show_help_pre(){
+ for opt in ${CMDLINE_SELECT}; do
+ opt2=`echo $opt | sed -e 's;_;-;g'`
+ if enabled $opt; then
+ eval "toggle_${opt}=\"--disable-${opt2}\""
+ else
+ eval "toggle_${opt}=\"--enable-${opt2} \""
+ fi
+ done
+
+ cat <>${logfile} 2>&1
+}
+
+check_cc() {
+ log check_cc "$@"
+ cat >${TMP_C}
+ log_file ${TMP_C}
+ check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
+}
+
+check_cxx() {
+ log check_cxx "$@"
+ cat >${TMP_CC}
+ log_file ${TMP_CC}
+ check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC}
+}
+
+check_cpp() {
+ log check_cpp "$@"
+ cat > ${TMP_C}
+ log_file ${TMP_C}
+ check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C}
+}
+
+check_ld() {
+ log check_ld "$@"
+ check_cc $@ \
+ && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs}
+}
+
+check_header(){
+ log check_header "$@"
+ header=$1
+ shift
+ var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
+ disable_feature $var
+ check_cpp "$@" <${TMP_ASM} <${TMP_X}
+ log_file ${TMP_X}
+ if ! grep -q '\.rodata .* 16$' ${TMP_X}; then
+ die "${AS} ${ASFLAGS} does not support section alignment (nasm <=2.08?)"
+ fi
+}
+
+# tests for -m$1 toggling the feature given in $2. If $2 is empty $1 is used.
+check_gcc_machine_option() {
+ opt="$1"
+ feature="$2"
+ [ -n "$feature" ] || feature="$opt"
+
+ if enabled gcc && ! disabled "$feature" && ! check_cflags "-m$opt"; then
+ RTCD_OPTIONS="${RTCD_OPTIONS}--disable-$feature "
+ else
+ soft_enable "$feature"
+ fi
+}
+
+write_common_config_banner() {
+ print_webm_license config.mk "##" ""
+ echo '# This file automatically generated by configure. Do not edit!' >> config.mk
+ echo "TOOLCHAIN := ${toolchain}" >> config.mk
+
+ case ${toolchain} in
+ *-linux-rvct)
+ echo "ALT_LIBC := ${alt_libc}" >> config.mk
+ ;;
+ esac
+}
+
+write_common_config_targets() {
+ for t in ${all_targets}; do
+ if enabled ${t}; then
+ if enabled child; then
+ fwrite config.mk "ALL_TARGETS += ${t}-${toolchain}"
+ else
+ fwrite config.mk "ALL_TARGETS += ${t}"
+ fi
+ fi
+ true;
+ done
+ true
+}
+
+write_common_target_config_mk() {
+ saved_CC="${CC}"
+ saved_CXX="${CXX}"
+ enabled ccache && CC="ccache ${CC}"
+ enabled ccache && CXX="ccache ${CXX}"
+ print_webm_license $1 "##" ""
+
+ cat >> $1 << EOF
+# This file automatically generated by configure. Do not edit!
+SRC_PATH="$source_path"
+SRC_PATH_BARE=$source_path
+BUILD_PFX=${BUILD_PFX}
+TOOLCHAIN=${toolchain}
+ASM_CONVERSION=${asm_conversion_cmd:-${source_path}/build/make/ads2gas.pl}
+GEN_VCPROJ=${gen_vcproj_cmd}
+MSVS_ARCH_DIR=${msvs_arch_dir}
+
+CC=${CC}
+CXX=${CXX}
+AR=${AR}
+LD=${LD}
+AS=${AS}
+STRIP=${STRIP}
+NM=${NM}
+
+CFLAGS = ${CFLAGS}
+CXXFLAGS = ${CXXFLAGS}
+ARFLAGS = -crs\$(if \$(quiet),,v)
+LDFLAGS = ${LDFLAGS}
+ASFLAGS = ${ASFLAGS}
+extralibs = ${extralibs}
+AS_SFX = ${AS_SFX:-.asm}
+EXE_SFX = ${EXE_SFX}
+VCPROJ_SFX = ${VCPROJ_SFX}
+RTCD_OPTIONS = ${RTCD_OPTIONS}
+EOF
+
+ if enabled rvct; then cat >> $1 << EOF
+fmt_deps = sed -e 's;^__image.axf;\${@:.d=.o} \$@;' #hide
+EOF
+ else cat >> $1 << EOF
+fmt_deps = sed -e 's;^\([a-zA-Z0-9_]*\)\.o;\${@:.d=.o} \$@;'
+EOF
+ fi
+
+ print_config_mk ARCH "${1}" ${ARCH_LIST}
+ print_config_mk HAVE "${1}" ${HAVE_LIST}
+ print_config_mk CONFIG "${1}" ${CONFIG_LIST}
+ print_config_mk HAVE "${1}" gnu_strip
+
+ enabled msvs && echo "CONFIG_VS_VERSION=${vs_version}" >> "${1}"
+
+ CC="${saved_CC}"
+ CXX="${saved_CXX}"
+}
+
+write_common_target_config_h() {
+ print_webm_license ${TMP_H} "/*" " */"
+ cat >> ${TMP_H} << EOF
+/* This file automatically generated by configure. Do not edit! */
+#ifndef VPX_CONFIG_H
+#define VPX_CONFIG_H
+#define RESTRICT ${RESTRICT}
+#define INLINE ${INLINE}
+EOF
+ print_config_h ARCH "${TMP_H}" ${ARCH_LIST}
+ print_config_h HAVE "${TMP_H}" ${HAVE_LIST}
+ print_config_h CONFIG "${TMP_H}" ${CONFIG_LIST}
+ print_config_vars_h "${TMP_H}" ${VAR_LIST}
+ echo "#endif /* VPX_CONFIG_H */" >> ${TMP_H}
+ mkdir -p `dirname "$1"`
+ cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1"
+}
+
+process_common_cmdline() {
+ for opt in "$@"; do
+ optval="${opt#*=}"
+ case "$opt" in
+ --child)
+ enable_feature child
+ ;;
+ --log*)
+ logging="$optval"
+ if ! disabled logging ; then
+ enabled logging || logfile="$logging"
+ else
+ logfile=/dev/null
+ fi
+ ;;
+ --target=*)
+ toolchain="${toolchain:-${optval}}"
+ ;;
+ --force-target=*)
+ toolchain="${toolchain:-${optval}}"
+ enable_feature force_toolchain
+ ;;
+ --cpu=*)
+ tune_cpu="$optval"
+ ;;
+ --extra-cflags=*)
+ extra_cflags="${optval}"
+ ;;
+ --extra-cxxflags=*)
+ extra_cxxflags="${optval}"
+ ;;
+ --enable-?*|--disable-?*)
+ eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
+ if echo "${ARCH_EXT_LIST}" | grep "^ *$option\$" >/dev/null; then
+ [ $action = "disable" ] && RTCD_OPTIONS="${RTCD_OPTIONS}--disable-${option} "
+ elif [ $action = "disable" ] && ! disabled $option ; then
+ echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null ||
+ die_unknown $opt
+ log_echo " disabling $option"
+ elif [ $action = "enable" ] && ! enabled $option ; then
+ echo "${CMDLINE_SELECT}" | grep "^ *$option\$" >/dev/null ||
+ die_unknown $opt
+ log_echo " enabling $option"
+ fi
+ ${action}_feature $option
+ ;;
+ --require-?*)
+ eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
+ if echo "${ARCH_EXT_LIST}" none | grep "^ *$option\$" >/dev/null; then
+ RTCD_OPTIONS="${RTCD_OPTIONS}${opt} "
+ else
+ die_unknown $opt
+ fi
+ ;;
+ --force-enable-?*|--force-disable-?*)
+ eval `echo "$opt" | sed 's/--force-/action=/;s/-/ option=/;s/-/_/g'`
+ ${action}_feature $option
+ ;;
+ --libc=*)
+ [ -d "${optval}" ] || die "Not a directory: ${optval}"
+ disable_feature builtin_libc
+ alt_libc="${optval}"
+ ;;
+ --as=*)
+ [ "${optval}" = yasm ] || [ "${optval}" = nasm ] \
+ || [ "${optval}" = auto ] \
+ || die "Must be yasm, nasm or auto: ${optval}"
+ alt_as="${optval}"
+ ;;
+ --size-limit=*)
+ w="${optval%%x*}"
+ h="${optval##*x}"
+ VAR_LIST="DECODE_WIDTH_LIMIT ${w} DECODE_HEIGHT_LIMIT ${h}"
+ [ ${w} -gt 0 ] && [ ${h} -gt 0 ] || die "Invalid size-limit: too small."
+ [ ${w} -lt 65536 ] && [ ${h} -lt 65536 ] \
+ || die "Invalid size-limit: too big."
+ enable_feature size_limit
+ ;;
+ --prefix=*)
+ prefix="${optval}"
+ ;;
+ --libdir=*)
+ libdir="${optval}"
+ ;;
+ --sdk-path=*)
+ [ -d "${optval}" ] || die "Not a directory: ${optval}"
+ sdk_path="${optval}"
+ ;;
+ --libc|--as|--prefix|--libdir|--sdk-path)
+ die "Option ${opt} requires argument"
+ ;;
+ --help|-h)
+ show_help
+ ;;
+ *)
+ die_unknown $opt
+ ;;
+ esac
+ done
+}
+
+process_cmdline() {
+ for opt do
+ optval="${opt#*=}"
+ case "$opt" in
+ *)
+ process_common_cmdline $opt
+ ;;
+ esac
+ 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;
+}
+
+setup_gnu_toolchain() {
+ CC=${CC:-${CROSS}gcc}
+ CXX=${CXX:-${CROSS}g++}
+ AR=${AR:-${CROSS}ar}
+ LD=${LD:-${CROSS}${link_with_cc:-ld}}
+ AS=${AS:-${CROSS}as}
+ STRIP=${STRIP:-${CROSS}strip}
+ NM=${NM:-${CROSS}nm}
+ AS_SFX=.s
+ EXE_SFX=
+}
+
+# Reliably find the newest available Darwin SDKs. (Older versions of
+# xcrun don't support --show-sdk-path.)
+show_darwin_sdk_path() {
+ xcrun --sdk $1 --show-sdk-path 2>/dev/null ||
+ xcodebuild -sdk $1 -version Path 2>/dev/null
+}
+
+# Print the major version number of the Darwin SDK specified by $1.
+show_darwin_sdk_major_version() {
+ xcrun --sdk $1 --show-sdk-version 2>/dev/null | cut -d. -f1
+}
+
+process_common_toolchain() {
+ if [ -z "$toolchain" ]; then
+ gcctarget="${CHOST:-$(gcc -dumpmachine 2> /dev/null)}"
+
+ # detect tgt_isa
+ case "$gcctarget" in
+ armv6*)
+ tgt_isa=armv6
+ ;;
+ armv7*-hardfloat* | armv7*-gnueabihf | arm-*-gnueabihf)
+ tgt_isa=armv7
+ float_abi=hard
+ ;;
+ armv7*)
+ tgt_isa=armv7
+ float_abi=softfp
+ ;;
+ *x86_64*|*amd64*)
+ tgt_isa=x86_64
+ ;;
+ *i[3456]86*)
+ tgt_isa=x86
+ ;;
+ *sparc*)
+ tgt_isa=sparc
+ ;;
+ esac
+
+ # detect tgt_os
+ case "$gcctarget" in
+ *darwin10*)
+ tgt_isa=x86_64
+ tgt_os=darwin10
+ ;;
+ *darwin11*)
+ tgt_isa=x86_64
+ tgt_os=darwin11
+ ;;
+ *darwin12*)
+ tgt_isa=x86_64
+ tgt_os=darwin12
+ ;;
+ *darwin13*)
+ tgt_isa=x86_64
+ tgt_os=darwin13
+ ;;
+ *darwin14*)
+ tgt_isa=x86_64
+ tgt_os=darwin14
+ ;;
+ *darwin15*)
+ tgt_isa=x86_64
+ tgt_os=darwin15
+ ;;
+ x86_64*mingw32*)
+ tgt_os=win64
+ ;;
+ *mingw32*|*cygwin*)
+ [ -z "$tgt_isa" ] && tgt_isa=x86
+ tgt_os=win32
+ ;;
+ *linux*|*bsd*)
+ tgt_os=linux
+ ;;
+ *solaris2.10)
+ tgt_os=solaris
+ ;;
+ *os2*)
+ tgt_os=os2
+ ;;
+ 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 \
+ || die "Unrecognized toolchain '${toolchain}'"
+
+ enabled child || log_echo "Configuring for target '${toolchain}'"
+
+ #
+ # Set up toolchain variables
+ #
+ tgt_isa=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $1}')
+ tgt_os=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $2}')
+ tgt_cc=$(echo ${toolchain} | awk 'BEGIN{FS="-"}{print $3}')
+
+ # Mark the specific ISA requested as enabled
+ soft_enable ${tgt_isa}
+ enable_feature ${tgt_os}
+ enable_feature ${tgt_cc}
+
+ # Enable the architecture family
+ case ${tgt_isa} in
+ arm*)
+ enable_feature arm
+ ;;
+ mips*)
+ enable_feature mips
+ ;;
+ esac
+
+ # PIC is probably what we want when building shared libs
+ enabled shared && soft_enable pic
+
+ # Minimum iOS version for all target platforms (darwin and iphonesimulator).
+ IOS_VERSION_MIN="6.0"
+
+ # Handle darwin variants. Newer SDKs allow targeting older
+ # platforms, so use the newest one available.
+ case ${toolchain} in
+ arm*-darwin*)
+ add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
+ iphoneos_sdk_dir="$(show_darwin_sdk_path iphoneos)"
+ if [ -d "${iphoneos_sdk_dir}" ]; then
+ add_cflags "-isysroot ${iphoneos_sdk_dir}"
+ add_ldflags "-isysroot ${iphoneos_sdk_dir}"
+ fi
+ ;;
+ x86*-darwin*)
+ osx_sdk_dir="$(show_darwin_sdk_path macosx)"
+ if [ -d "${osx_sdk_dir}" ]; then
+ add_cflags "-isysroot ${osx_sdk_dir}"
+ add_ldflags "-isysroot ${osx_sdk_dir}"
+ fi
+ ;;
+ esac
+
+ case ${toolchain} in
+ *-darwin8-*)
+ add_cflags "-mmacosx-version-min=10.4"
+ add_ldflags "-mmacosx-version-min=10.4"
+ ;;
+ *-darwin9-*)
+ add_cflags "-mmacosx-version-min=10.5"
+ add_ldflags "-mmacosx-version-min=10.5"
+ ;;
+ *-darwin10-*)
+ add_cflags "-mmacosx-version-min=10.6"
+ add_ldflags "-mmacosx-version-min=10.6"
+ ;;
+ *-darwin11-*)
+ add_cflags "-mmacosx-version-min=10.7"
+ add_ldflags "-mmacosx-version-min=10.7"
+ ;;
+ *-darwin12-*)
+ add_cflags "-mmacosx-version-min=10.8"
+ add_ldflags "-mmacosx-version-min=10.8"
+ ;;
+ *-darwin13-*)
+ add_cflags "-mmacosx-version-min=10.9"
+ add_ldflags "-mmacosx-version-min=10.9"
+ ;;
+ *-darwin14-*)
+ add_cflags "-mmacosx-version-min=10.10"
+ add_ldflags "-mmacosx-version-min=10.10"
+ ;;
+ *-darwin15-*)
+ add_cflags "-mmacosx-version-min=10.11"
+ add_ldflags "-mmacosx-version-min=10.11"
+ ;;
+ *-iphonesimulator-*)
+ add_cflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
+ add_ldflags "-miphoneos-version-min=${IOS_VERSION_MIN}"
+ iossim_sdk_dir="$(show_darwin_sdk_path iphonesimulator)"
+ if [ -d "${iossim_sdk_dir}" ]; then
+ add_cflags "-isysroot ${iossim_sdk_dir}"
+ add_ldflags "-isysroot ${iossim_sdk_dir}"
+ fi
+ ;;
+ esac
+
+ # Handle Solaris variants. Solaris 10 needs -lposix4
+ case ${toolchain} in
+ sparc-solaris-*)
+ add_extralibs -lposix4
+ ;;
+ *-solaris-*)
+ add_extralibs -lposix4
+ ;;
+ esac
+
+ # Process ARM architecture variants
+ case ${toolchain} in
+ arm*)
+ # on arm, isa versions are supersets
+ case ${tgt_isa} in
+ arm64|armv8)
+ soft_enable neon
+ ;;
+ armv7|armv7s)
+ soft_enable neon
+ # Only enable neon_asm when neon is also enabled.
+ enabled neon && soft_enable neon_asm
+ # If someone tries to force it through, die.
+ if disabled neon && enabled neon_asm; then
+ die "Disabling neon while keeping neon-asm is not supported"
+ fi
+ case ${toolchain} in
+ # Apple iOS SDKs no longer support armv6 as of the version 9
+ # release (coincides with release of Xcode 7). Only enable media
+ # when using earlier SDK releases.
+ *-darwin*)
+ if [ "$(show_darwin_sdk_major_version iphoneos)" -lt 9 ]; then
+ soft_enable media
+ else
+ soft_disable media
+ RTCD_OPTIONS="${RTCD_OPTIONS}--disable-media "
+ fi
+ ;;
+ *)
+ soft_enable media
+ ;;
+ esac
+ ;;
+ armv6)
+ case ${toolchain} in
+ *-darwin*)
+ if [ "$(show_darwin_sdk_major_version iphoneos)" -lt 9 ]; then
+ soft_enable media
+ else
+ die "Your iOS SDK does not support armv6."
+ fi
+ ;;
+ *)
+ soft_enable media
+ ;;
+ esac
+ ;;
+ esac
+
+ asm_conversion_cmd="cat"
+
+ case ${tgt_cc} in
+ gcc)
+ link_with_cc=gcc
+ setup_gnu_toolchain
+ arch_int=${tgt_isa##armv}
+ arch_int=${arch_int%%te}
+ check_add_asflags --defsym ARCHITECTURE=${arch_int}
+ tune_cflags="-mtune="
+ if [ ${tgt_isa} = "armv7" ] || [ ${tgt_isa} = "armv7s" ]; then
+ if [ -z "${float_abi}" ]; then
+ check_cpp <&- || \
+ die "Couldn't find CodeSourcery GCC from PATH"
+
+ # Use armcc as a linker to enable translation of
+ # some gcc specific options such as -lm and -lpthread.
+ LD="armcc --translate_gcc"
+
+ # create configuration file (uses path to CodeSourcery GCC)
+ armcc --arm_linux_configure --arm_linux_config_file=arm_linux.cfg
+
+ add_cflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg
+ add_asflags --no_hide_all --apcs=/interwork
+ add_ldflags --arm_linux_paths --arm_linux_config_file=arm_linux.cfg
+ enabled pic && add_cflags --apcs=/fpic
+ enabled pic && add_asflags --apcs=/fpic
+ enabled shared && add_cflags --shared
+ fi
+ ;;
+ esac
+ ;;
+ mips*)
+ link_with_cc=gcc
+ setup_gnu_toolchain
+ tune_cflags="-mtune="
+ if enabled dspr2; then
+ check_add_cflags -mips32r2 -mdspr2
+ fi
+
+ if enabled runtime_cpu_detect; then
+ disable_feature runtime_cpu_detect
+ fi
+
+ if [ -n "${tune_cpu}" ]; then
+ case ${tune_cpu} in
+ p5600)
+ check_add_cflags -mips32r5 -funroll-loops -mload-store-pairs
+ check_add_cflags -msched-weight -mhard-float -mfp64
+ check_add_asflags -mips32r5 -mhard-float -mfp64
+ check_add_ldflags -mfp64
+ ;;
+ i6400)
+ check_add_cflags -mips64r6 -mabi=64 -funroll-loops -msched-weight
+ check_add_cflags -mload-store-pairs -mhard-float -mfp64
+ check_add_asflags -mips64r6 -mabi=64 -mhard-float -mfp64
+ check_add_ldflags -mips64r6 -mabi=64 -mfp64
+ ;;
+ esac
+
+ if enabled msa; then
+ add_cflags -mmsa
+ add_asflags -mmsa
+ add_ldflags -mmsa
+ fi
+ fi
+
+ check_add_cflags -march=${tgt_isa}
+ check_add_asflags -march=${tgt_isa}
+ check_add_asflags -KPIC
+ ;;
+ x86*)
+ case ${tgt_os} in
+ win*)
+ enabled gcc && add_cflags -fno-common
+ ;;
+ solaris*)
+ CC=${CC:-${CROSS}gcc}
+ CXX=${CXX:-${CROSS}g++}
+ LD=${LD:-${CROSS}gcc}
+ CROSS=${CROSS-g}
+ ;;
+ os2)
+ disable_feature pic
+ AS=${AS:-nasm}
+ add_ldflags -Zhigh-mem
+ ;;
+ esac
+
+ AS="${alt_as:-${AS:-auto}}"
+ case ${tgt_cc} in
+ icc*)
+ CC=${CC:-icc}
+ LD=${LD:-icc}
+ setup_gnu_toolchain
+ add_cflags -use-msasm # remove -use-msasm too?
+ # add -no-intel-extensions to suppress warning #10237
+ # refer to http://software.intel.com/en-us/forums/topic/280199
+ add_ldflags -i-static -no-intel-extensions
+ enabled x86_64 && add_cflags -ipo -static -O3 -no-prec-div
+ enabled x86_64 && AR=xiar
+ case ${tune_cpu} in
+ atom*)
+ tune_cflags="-x"
+ tune_cpu="SSE3_ATOM"
+ ;;
+ *)
+ tune_cflags="-march="
+ ;;
+ esac
+ ;;
+ gcc*)
+ link_with_cc=gcc
+ tune_cflags="-march="
+ setup_gnu_toolchain
+ #for 32 bit x86 builds, -O3 did not turn on this flag
+ enabled optimizations && disabled gprof && check_add_cflags -fomit-frame-pointer
+ ;;
+ vs*)
+ # When building with Microsoft Visual Studio the assembler is
+ # invoked directly. Checking at configure time is unnecessary.
+ # Skip the check by setting AS arbitrarily
+ AS=msvs
+ msvs_arch_dir=x86-msvs
+ vc_version=${tgt_cc##vs}
+ case $vc_version in
+ 7|8|9|10)
+ echo "${tgt_cc} does not support avx/avx2, disabling....."
+ RTCD_OPTIONS="${RTCD_OPTIONS}--disable-avx --disable-avx2 "
+ soft_disable avx
+ soft_disable avx2
+ ;;
+ esac
+ ;;
+ esac
+
+ bits=32
+ enabled x86_64 && bits=64
+ check_cpp < sse4
+ check_gcc_machine_option ${ext%_*} $ext
+ fi
+ done
+
+ if enabled external_build; then
+ log_echo " skipping assembler detection"
+ else
+ case "${AS}" in
+ auto|"")
+ which nasm >/dev/null 2>&1 && AS=nasm
+ which yasm >/dev/null 2>&1 && AS=yasm
+ if [ "${AS}" = nasm ] ; then
+ # Apple ships version 0.98 of nasm through at least Xcode 6. Revisit
+ # this check if they start shipping a compatible version.
+ apple=`nasm -v | grep "Apple"`
+ [ -n "${apple}" ] \
+ && echo "Unsupported version of nasm: ${apple}" \
+ && AS=""
+ fi
+ [ "${AS}" = auto ] || [ -z "${AS}" ] \
+ && die "Neither yasm nor nasm have been found." \
+ "See the prerequisites section in the README for more info."
+ ;;
+ esac
+ log_echo " using $AS"
+ fi
+ [ "${AS##*/}" = nasm ] && add_asflags -Ox
+ AS_SFX=.asm
+ case ${tgt_os} in
+ win32)
+ add_asflags -f win32
+ enabled debug && add_asflags -g cv8
+ EXE_SFX=.exe
+ ;;
+ win64)
+ add_asflags -f x64
+ enabled debug && add_asflags -g cv8
+ EXE_SFX=.exe
+ ;;
+ linux*|solaris*|android*)
+ add_asflags -f elf${bits}
+ enabled debug && [ "${AS}" = yasm ] && add_asflags -g dwarf2
+ enabled debug && [ "${AS}" = nasm ] && add_asflags -g
+ [ "${AS##*/}" = nasm ] && check_asm_align
+ ;;
+ darwin*)
+ add_asflags -f macho${bits}
+ enabled x86 && darwin_arch="-arch i386" || darwin_arch="-arch x86_64"
+ add_cflags ${darwin_arch}
+ add_ldflags ${darwin_arch}
+ # -mdynamic-no-pic is still a bit of voodoo -- it was required at
+ # one time, but does not seem to be now, and it breaks some of the
+ # code that still relies on inline assembly.
+ # enabled icc && ! enabled pic && add_cflags -fno-pic -mdynamic-no-pic
+ enabled icc && ! enabled pic && add_cflags -fno-pic
+ ;;
+ iphonesimulator)
+ add_asflags -f macho${bits}
+ enabled x86 && sim_arch="-arch i386" || sim_arch="-arch x86_64"
+ add_cflags ${sim_arch}
+ add_ldflags ${sim_arch}
+
+ if [ "$(show_darwin_sdk_major_version iphonesimulator)" -gt 8 ]; then
+ # yasm v1.3.0 doesn't know what -fembed-bitcode means, so turning it
+ # on is pointless (unless building a C-only lib). Warn the user, but
+ # do nothing here.
+ log "Warning: Bitcode embed disabled for simulator targets."
+ fi
+ ;;
+ os2)
+ add_asflags -f aout
+ enabled debug && add_asflags -g
+ EXE_SFX=.exe
+ ;;
+ *)
+ log "Warning: Unknown os $tgt_os while setting up $AS flags"
+ ;;
+ esac
+ ;;
+ *-gcc|generic-gnu)
+ link_with_cc=gcc
+ enable_feature gcc
+ setup_gnu_toolchain
+ ;;
+ esac
+
+ # Try to enable CPU specific tuning
+ if [ -n "${tune_cpu}" ]; then
+ if [ -n "${tune_cflags}" ]; then
+ check_add_cflags ${tune_cflags}${tune_cpu} || \
+ die "Requested CPU '${tune_cpu}' not supported by compiler"
+ fi
+ if [ -n "${tune_asflags}" ]; then
+ check_add_asflags ${tune_asflags}${tune_cpu} || \
+ die "Requested CPU '${tune_cpu}' not supported by assembler"
+ fi
+ if [ -z "${tune_cflags}${tune_asflags}" ]; then
+ log_echo "Warning: CPU tuning not supported by this toolchain"
+ fi
+ fi
+
+ if enabled debug; then
+ check_add_cflags -g && check_add_ldflags -g
+ else
+ check_add_cflags -DNDEBUG
+ fi
+
+ enabled gprof && check_add_cflags -pg && check_add_ldflags -pg
+ enabled gcov &&
+ check_add_cflags -fprofile-arcs -ftest-coverage &&
+ check_add_ldflags -fprofile-arcs -ftest-coverage
+
+ if enabled optimizations; then
+ if enabled rvct; then
+ enabled small && check_add_cflags -Ospace || check_add_cflags -Otime
+ else
+ enabled small && check_add_cflags -O2 || check_add_cflags -O3
+ fi
+ fi
+
+ if [ "${tgt_isa}" = "x86_64" ] || [ "${tgt_isa}" = "x86" ]; then
+ soft_enable use_x86inc
+ fi
+
+ # Position Independent Code (PIC) support, for building relocatable
+ # shared objects
+ enabled gcc && enabled pic && check_add_cflags -fPIC
+
+ # Work around longjmp interception on glibc >= 2.11, to improve binary
+ # compatibility. See http://code.google.com/p/webm/issues/detail?id=166
+ enabled linux && check_add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
+
+ # Check for strip utility variant
+ ${STRIP} -V 2>/dev/null | grep GNU >/dev/null && enable_feature gnu_strip
+
+ # Try to determine target endianness
+ check_cc </dev/null 2>&1 && enable_feature big_endian
+
+ # Try to find which inline keywords are supported
+ check_cc <> $makefile
+ fi
+ done
+ prefix="${saved_prefix}"
+}
+
+print_config_h() {
+ saved_prefix="${prefix}"
+ prefix=$1
+ header=$2
+ shift 2
+ for cfg; do
+ upname="`toupper $cfg`"
+ if enabled $cfg; then
+ echo "#define ${prefix}_${upname} 1" >> $header
+ else
+ echo "#define ${prefix}_${upname} 0" >> $header
+ fi
+ done
+ prefix="${saved_prefix}"
+}
+
+print_config_vars_h() {
+ header=$1
+ shift
+ while [ $# -gt 0 ]; do
+ upname="`toupper $1`"
+ echo "#define ${upname} $2" >> $header
+ shift 2
+ done
+}
+
+print_webm_license() {
+ saved_prefix="${prefix}"
+ destination=$1
+ prefix="$2"
+ suffix="$3"
+ shift 3
+ cat < ${destination}
+${prefix} Copyright (c) 2011 The WebM project authors. All Rights Reserved.${suffix}
+${prefix} ${suffix}
+${prefix} Use of this source code is governed by a BSD-style license${suffix}
+${prefix} that can be found in the LICENSE file in the root of the source${suffix}
+${prefix} tree. An additional intellectual property rights grant can be found${suffix}
+${prefix} in the file PATENTS. All contributing project authors may${suffix}
+${prefix} be found in the AUTHORS file in the root of the source tree.${suffix}
+EOF
+ prefix="${saved_prefix}"
+}
+
+process_targets() {
+ true;
+}
+
+process_detect() {
+ true;
+}
+
+enable_feature logging
+logfile="config.log"
+self=$0
+process() {
+ cmdline_args="$@"
+ process_cmdline "$@"
+ if enabled child; then
+ echo "# ${self} $@" >> ${logfile}
+ else
+ echo "# ${self} $@" > ${logfile}
+ fi
+ post_process_common_cmdline
+ post_process_cmdline
+ process_toolchain
+ process_detect
+ process_targets
+
+ OOT_INSTALLS="${OOT_INSTALLS}"
+ if enabled source_path_used; then
+ # Prepare the PWD for building.
+ for f in ${OOT_INSTALLS}; do
+ install -D "${source_path}/$f" "$f"
+ done
+ fi
+ cp "${source_path}/build/make/Makefile" .
+
+ clean_temp_files
+ true
+}
diff --git a/libs/libvpx/build/make/gen_asm_deps.sh b/libs/libvpx/build/make/gen_asm_deps.sh
new file mode 100755
index 0000000000..6a7bff9ebc
--- /dev/null
+++ b/libs/libvpx/build/make/gen_asm_deps.sh
@@ -0,0 +1,64 @@
+#!/bin/sh
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+self=$0
+show_help() {
+ echo "usage: $self [options] "
+ echo
+ echo "Generate Makefile dependency information from assembly code source"
+ echo
+ exit 1
+}
+die_unknown(){
+ echo "Unknown option \"$1\"."
+ echo "See $0 --help for available options."
+ exit 1
+}
+for opt do
+ optval="${opt#*=}"
+ case "$opt" in
+ --build-pfx=*) pfx="${optval}"
+ ;;
+ --depfile=*) out="${optval}"
+ ;;
+ -I*) raw_inc_paths="${raw_inc_paths} ${opt}"
+ inc_path="${inc_path} ${opt#-I}"
+ ;;
+ -h|--help) show_help
+ ;;
+ *) [ -f "$opt" ] && srcfile="$opt"
+ ;;
+ esac
+done
+
+[ -n "$srcfile" ] || show_help
+sfx=${sfx:-asm}
+includes=$(LC_ALL=C egrep -i "include +\"?[a-z0-9_/]+\.${sfx}" $srcfile |
+ perl -p -e "s;.*?([a-z0-9_/]+.${sfx}).*;\1;")
+#" restore editor state
+for inc in ${includes}; do
+ found_inc_path=
+ for idir in ${inc_path}; do
+ [ -f "${idir}/${inc}" ] && found_inc_path="${idir}" && break
+ done
+ if [ -f `dirname $srcfile`/$inc ]; then
+ # Handle include files in the same directory as the source
+ $self --build-pfx=$pfx --depfile=$out ${raw_inc_paths} `dirname $srcfile`/$inc
+ elif [ -n "${found_inc_path}" ]; then
+ # Handle include files on the include path
+ $self --build-pfx=$pfx --depfile=$out ${raw_inc_paths} "${found_inc_path}/$inc"
+ else
+ # Handle generated includes in the build root (which may not exist yet)
+ echo ${out} ${out%d}o: "${pfx}${inc}"
+ fi
+done
+echo ${out} ${out%d}o: $srcfile
diff --git a/libs/libvpx/build/make/gen_msvs_def.sh b/libs/libvpx/build/make/gen_msvs_def.sh
new file mode 100755
index 0000000000..4defcc2e7c
--- /dev/null
+++ b/libs/libvpx/build/make/gen_msvs_def.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+self=$0
+self_basename=${self##*/}
+EOL=$'\n'
+
+show_help() {
+ cat < symbol1 [symbol2, symbol3, ...]
+
+where is either 'text' or 'data'
+
+
+Options:
+ --help Print this message
+ --out=filename Write output to a file [stdout]
+ --name=project_name Name of the library (required)
+EOF
+ exit 1
+}
+
+die() {
+ echo "${self_basename}: $@"
+ exit 1
+}
+
+die_unknown(){
+ echo "Unknown option \"$1\"."
+ echo "See ${self_basename} --help for available options."
+ exit 1
+}
+
+text() {
+ for sym in "$@"; do
+ echo " $sym" >> ${outfile}
+ done
+}
+
+data() {
+ for sym in "$@"; do
+ printf " %-40s DATA\n" "$sym" >> ${outfile}
+ done
+}
+
+# Process command line
+for opt in "$@"; do
+ optval="${opt#*=}"
+ case "$opt" in
+ --help|-h) show_help
+ ;;
+ --out=*) outfile="$optval"
+ ;;
+ --name=*) name="${optval}"
+ ;;
+ -*) die_unknown $opt
+ ;;
+ *) file_list[${#file_list[@]}]="$opt"
+ esac
+done
+outfile=${outfile:-/dev/stdout}
+[ -n "$name" ] || die "Library name (--name) must be specified!"
+
+echo "LIBRARY ${name}" > ${outfile}
+echo "EXPORTS" >> ${outfile}
+for f in "${file_list[@]}"; do
+ . $f
+done
diff --git a/libs/libvpx/build/make/gen_msvs_proj.sh b/libs/libvpx/build/make/gen_msvs_proj.sh
new file mode 100755
index 0000000000..0cf335b3d2
--- /dev/null
+++ b/libs/libvpx/build/make/gen_msvs_proj.sh
@@ -0,0 +1,490 @@
+#!/bin/bash
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+self=$0
+self_basename=${self##*/}
+self_dirname=$(dirname "$0")
+
+. "$self_dirname/msvs_common.sh"|| exit 127
+
+show_help() {
+ cat <&2
+ IFS=*
+
+ open_tag Filter \
+ Name=$name \
+ Filter=$pats \
+ UniqueIdentifier=`generate_uuid` \
+
+ file_list_sz=${#file_list[@]}
+ for i in ${!file_list[@]}; do
+ f=${file_list[i]}
+ for pat in ${pats//;/$IFS}; do
+ if [ "${f##*.}" == "$pat" ]; then
+ unset file_list[i]
+
+ objf=$(echo ${f%.*}.obj \
+ | sed -e "s,$src_path_bare,," \
+ -e 's/^[\./]\+//g' -e 's,[:/ ],_,g')
+ open_tag File RelativePath="$f"
+
+ if [ "$pat" == "asm" ] && $asm_use_custom_step; then
+ # Avoid object file name collisions, i.e. vpx_config.c and
+ # vpx_config.asm produce the same object file without
+ # this additional suffix.
+ objf=${objf%.obj}_asm.obj
+ for plat in "${platforms[@]}"; do
+ for cfg in Debug Release; do
+ open_tag FileConfiguration \
+ Name="${cfg}|${plat}" \
+
+ tag Tool \
+ Name="VCCustomBuildTool" \
+ Description="Assembling \$(InputFileName)" \
+ CommandLine="$(eval echo \$asm_${cfg}_cmdline) -o \$(IntDir)\\$objf" \
+ Outputs="\$(IntDir)\\$objf" \
+
+ close_tag FileConfiguration
+ done
+ done
+ fi
+ if [ "$pat" == "c" ] || \
+ [ "$pat" == "cc" ] || [ "$pat" == "cpp" ]; then
+ for plat in "${platforms[@]}"; do
+ for cfg in Debug Release; do
+ open_tag FileConfiguration \
+ Name="${cfg}|${plat}" \
+
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ ObjectFile="\$(IntDir)\\$objf" \
+
+ close_tag FileConfiguration
+ done
+ done
+ fi
+ close_tag File
+
+ break
+ fi
+ done
+ done
+
+ close_tag Filter
+ IFS="$saveIFS"
+}
+
+# Process command line
+unset target
+for opt in "$@"; do
+ optval="${opt#*=}"
+ case "$opt" in
+ --help|-h) show_help
+ ;;
+ --target=*) target="${optval}"
+ ;;
+ --out=*) outfile="$optval"
+ ;;
+ --name=*) name="${optval}"
+ ;;
+ --proj-guid=*) guid="${optval}"
+ ;;
+ --module-def=*) link_opts="${link_opts} ModuleDefinitionFile=${optval}"
+ ;;
+ --exe) proj_kind="exe"
+ ;;
+ --dll) proj_kind="dll"
+ ;;
+ --lib) proj_kind="lib"
+ ;;
+ --src-path-bare=*)
+ src_path_bare=$(fix_path "$optval")
+ src_path_bare=${src_path_bare%/}
+ ;;
+ --static-crt) use_static_runtime=true
+ ;;
+ --ver=*)
+ vs_ver="$optval"
+ case "$optval" in
+ [789])
+ ;;
+ *) die Unrecognized Visual Studio Version in $opt
+ ;;
+ esac
+ ;;
+ -I*)
+ opt=${opt##-I}
+ opt=$(fix_path "$opt")
+ opt="${opt%/}"
+ incs="${incs}${incs:+;}"${opt}""
+ yasmincs="${yasmincs} -I"${opt}""
+ ;;
+ -D*) defines="${defines}${defines:+;}${opt##-D}"
+ ;;
+ -L*) # fudge . to $(OutDir)
+ if [ "${opt##-L}" == "." ]; then
+ libdirs="${libdirs}${libdirs:+;}"\$(OutDir)""
+ else
+ # Also try directories for this platform/configuration
+ opt=${opt##-L}
+ opt=$(fix_path "$opt")
+ libdirs="${libdirs}${libdirs:+;}"${opt}""
+ libdirs="${libdirs}${libdirs:+;}"${opt}/\$(PlatformName)/\$(ConfigurationName)""
+ libdirs="${libdirs}${libdirs:+;}"${opt}/\$(PlatformName)""
+ fi
+ ;;
+ -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
+ ;;
+ -*) die_unknown $opt
+ ;;
+ *)
+ # The paths in file_list are fixed outside of the loop.
+ file_list[${#file_list[@]}]="$opt"
+ case "$opt" in
+ *.asm) uses_asm=true
+ ;;
+ esac
+ ;;
+ esac
+done
+
+# Make one call to fix_path for file_list to improve performance.
+fix_file_list
+
+outfile=${outfile:-/dev/stdout}
+guid=${guid:-`generate_uuid`}
+asm_use_custom_step=false
+uses_asm=${uses_asm:-false}
+case "${vs_ver:-8}" in
+ 7) vs_ver_id="7.10"
+ asm_use_custom_step=$uses_asm
+ warn_64bit='Detect64BitPortabilityProblems=true'
+ ;;
+ 8) vs_ver_id="8.00"
+ asm_use_custom_step=$uses_asm
+ warn_64bit='Detect64BitPortabilityProblems=true'
+ ;;
+ 9) vs_ver_id="9.00"
+ asm_use_custom_step=$uses_asm
+ warn_64bit='Detect64BitPortabilityProblems=false'
+ ;;
+esac
+
+[ -n "$name" ] || die "Project name (--name) must be specified!"
+[ -n "$target" ] || die "Target (--target) must be specified!"
+
+if ${use_static_runtime:-false}; then
+ release_runtime=0
+ debug_runtime=1
+ lib_sfx=mt
+else
+ release_runtime=2
+ debug_runtime=3
+ lib_sfx=md
+fi
+
+# Calculate debug lib names: If a lib ends in ${lib_sfx}.lib, then rename
+# it to ${lib_sfx}d.lib. This precludes linking to release libs from a
+# debug exe, so this may need to be refactored later.
+for lib in ${libs}; do
+ if [ "$lib" != "${lib%${lib_sfx}.lib}" ]; then
+ lib=${lib%.lib}d.lib
+ fi
+ debug_libs="${debug_libs}${debug_libs:+ }${lib}"
+done
+
+
+# List Keyword for this target
+case "$target" in
+ x86*) keyword="ManagedCProj"
+ ;;
+ *) die "Unsupported target $target!"
+esac
+
+# List of all platforms supported for this target
+case "$target" in
+ x86_64*)
+ platforms[0]="x64"
+ asm_Debug_cmdline="yasm -Xvc -g cv8 -f win64 ${yasmincs} "\$(InputPath)""
+ asm_Release_cmdline="yasm -Xvc -f win64 ${yasmincs} "\$(InputPath)""
+ ;;
+ x86*)
+ platforms[0]="Win32"
+ asm_Debug_cmdline="yasm -Xvc -g cv8 -f win32 ${yasmincs} "\$(InputPath)""
+ asm_Release_cmdline="yasm -Xvc -f win32 ${yasmincs} "\$(InputPath)""
+ ;;
+ *) die "Unsupported target $target!"
+ ;;
+esac
+
+generate_vcproj() {
+ case "$proj_kind" in
+ exe) vs_ConfigurationType=1
+ ;;
+ dll) vs_ConfigurationType=2
+ ;;
+ *) vs_ConfigurationType=4
+ ;;
+ esac
+
+ echo ""
+ open_tag VisualStudioProject \
+ ProjectType="Visual C++" \
+ Version="${vs_ver_id}" \
+ Name="${name}" \
+ ProjectGUID="{${guid}}" \
+ RootNamespace="${name}" \
+ Keyword="${keyword}" \
+
+ open_tag Platforms
+ for plat in "${platforms[@]}"; do
+ tag Platform Name="$plat"
+ done
+ close_tag Platforms
+
+ open_tag Configurations
+ for plat in "${platforms[@]}"; do
+ plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
+ open_tag Configuration \
+ Name="Debug|$plat" \
+ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
+ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
+ ConfigurationType="$vs_ConfigurationType" \
+ CharacterSet="1" \
+
+ case "$target" in
+ x86*)
+ case "$name" in
+ vpx)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ Optimization="0" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$debug_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="2" \
+ $warn_64bit \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="true"
+ ;;
+ *)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ Optimization="0" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$debug_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="2" \
+ $warn_64bit \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs" Debug="true"
+ ;;
+ esac
+ ;;
+ esac
+
+ case "$proj_kind" in
+ exe)
+ case "$target" in
+ x86*)
+ case "$name" in
+ *)
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="$debug_libs \$(NoInherit)" \
+ AdditionalLibraryDirectories="$libdirs" \
+ GenerateDebugInformation="true" \
+ ProgramDatabaseFile="\$(OutDir)/${name}.pdb" \
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lib)
+ case "$target" in
+ x86*)
+ tag Tool \
+ Name="VCLibrarianTool" \
+ OutputFile="\$(OutDir)/${name}${lib_sfx}d.lib" \
+
+ ;;
+ esac
+ ;;
+ dll)
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="\$(NoInherit)" \
+ LinkIncremental="2" \
+ GenerateDebugInformation="true" \
+ AssemblyDebug="1" \
+ TargetMachine="1" \
+ $link_opts \
+
+ ;;
+ esac
+
+ close_tag Configuration
+
+ open_tag Configuration \
+ Name="Release|$plat" \
+ OutputDirectory="\$(SolutionDir)$plat_no_ws/\$(ConfigurationName)" \
+ IntermediateDirectory="$plat_no_ws/\$(ConfigurationName)/${name}" \
+ ConfigurationType="$vs_ConfigurationType" \
+ CharacterSet="1" \
+ WholeProgramOptimization="0" \
+
+ case "$target" in
+ x86*)
+ case "$name" in
+ vpx)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ Optimization="2" \
+ FavorSizeorSpeed="1" \
+ AdditionalIncludeDirectories="$incs" \
+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$release_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="0" \
+ $warn_64bit \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
+ ;;
+ *)
+ tag Tool \
+ Name="VCCLCompilerTool" \
+ AdditionalIncludeDirectories="$incs" \
+ Optimization="2" \
+ FavorSizeorSpeed="1" \
+ PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;$defines" \
+ RuntimeLibrary="$release_runtime" \
+ UsePrecompiledHeader="0" \
+ WarningLevel="3" \
+ DebugInformationFormat="0" \
+ $warn_64bit \
+
+ $uses_asm && tag Tool Name="YASM" IncludePaths="$incs"
+ ;;
+ esac
+ ;;
+ esac
+
+ case "$proj_kind" in
+ exe)
+ case "$target" in
+ x86*)
+ case "$name" in
+ *)
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="$libs \$(NoInherit)" \
+ AdditionalLibraryDirectories="$libdirs" \
+
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lib)
+ case "$target" in
+ x86*)
+ tag Tool \
+ Name="VCLibrarianTool" \
+ OutputFile="\$(OutDir)/${name}${lib_sfx}.lib" \
+
+ ;;
+ esac
+ ;;
+ dll) # note differences to debug version: LinkIncremental, AssemblyDebug
+ tag Tool \
+ Name="VCLinkerTool" \
+ AdditionalDependencies="\$(NoInherit)" \
+ LinkIncremental="1" \
+ GenerateDebugInformation="true" \
+ TargetMachine="1" \
+ $link_opts \
+
+ ;;
+ esac
+
+ close_tag Configuration
+ done
+ close_tag Configurations
+
+ open_tag Files
+ generate_filter srcs "Source Files" "c;cc;cpp;def;odl;idl;hpj;bat;asm;asmx"
+ generate_filter hdrs "Header Files" "h;hm;inl;inc;xsd"
+ generate_filter resrcs "Resource Files" "rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ generate_filter resrcs "Build Files" "mk"
+ close_tag Files
+
+ tag Globals
+ close_tag VisualStudioProject
+
+ # This must be done from within the {} subshell
+ echo "Ignored files list (${#file_list[@]} items) is:" >&2
+ for f in "${file_list[@]}"; do
+ echo " $f" >&2
+ done
+}
+
+generate_vcproj |
+ sed -e '/"/s;\([^ "]\)/;\1\\;g' > ${outfile}
+
+exit
+
diff --git a/libs/libvpx/build/make/gen_msvs_sln.sh b/libs/libvpx/build/make/gen_msvs_sln.sh
new file mode 100755
index 0000000000..664b404c91
--- /dev/null
+++ b/libs/libvpx/build/make/gen_msvs_sln.sh
@@ -0,0 +1,327 @@
+#!/bin/bash
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+self=$0
+self_basename=${self##*/}
+EOL=$'\n'
+EOLDOS=$'\r'
+
+show_help() {
+ cat <&2
+ [ -f "${outfile}" ] && rm -f ${outfile}{,.mk}
+ exit 1
+}
+
+die_unknown(){
+ echo "Unknown option \"$1\"." >&2
+ echo "See ${self_basename} --help for available options." >&2
+ [ -f "${outfile}" ] && rm -f ${outfile}{,.mk}
+ exit 1
+}
+
+indent1=$'\t'
+indent=""
+indent_push() {
+ indent="${indent}${indent1}"
+}
+indent_pop() {
+ indent="${indent%${indent1}}"
+}
+
+parse_project() {
+ local file=$1
+ if [ "$sfx" = "vcproj" ]; then
+ local name=`grep Name "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
+ local guid=`grep ProjectGUID "$file" | awk 'BEGIN {FS="\""}{if (NR==1) print $2}'`
+ else
+ local name=`grep RootNamespace "$file" | sed 's,.*<.*>\(.*\).*,\1,'`
+ local guid=`grep ProjectGuid "$file" | sed 's,.*<.*>\(.*\).*,\1,'`
+ fi
+
+ # save the project GUID to a varaible, normalizing to the basename of the
+ # vcproj file without the extension
+ local var
+ var=${file##*/}
+ var=${var%%.${sfx}}
+ eval "${var}_file=\"$1\""
+ eval "${var}_name=$name"
+ eval "${var}_guid=$guid"
+
+ if [ "$sfx" = "vcproj" ]; then
+ cur_config_list=`grep -A1 '/dev/null 2>&1 && echo yes)
+.nodevenv.once:
+${TAB}@echo " * \$(MSBUILD_TOOL) not found in path."
+${TAB}@echo " * "
+${TAB}@echo " * You will have to build all configurations manually using the"
+${TAB}@echo " * Visual Studio IDE. To allow make to build them automatically,"
+${TAB}@echo " * add the Common7/IDE directory of your Visual Studio"
+${TAB}@echo " * installation to your path, eg:"
+${TAB}@echo " * C:\Program Files\Microsoft Visual Studio 8\Common7\IDE"
+${TAB}@echo " * "
+${TAB}@touch \$@
+CLEAN-OBJS += \$(if \$(found_devenv),,.nodevenv.once)
+
+EOF
+
+ for sln_config in ${config_list}; do
+ local config=${sln_config%%|*}
+ local platform=${sln_config##*|}
+ local nows_sln_config=`echo $sln_config | sed -e 's/[^a-zA-Z0-9]/_/g'`
+ cat <${outfile} <>${outfile}
+done
+process_global >>${outfile}
+process_makefile >${mkoutfile}
diff --git a/libs/libvpx/build/make/gen_msvs_vcxproj.sh b/libs/libvpx/build/make/gen_msvs_vcxproj.sh
new file mode 100755
index 0000000000..182ea28fa7
--- /dev/null
+++ b/libs/libvpx/build/make/gen_msvs_vcxproj.sh
@@ -0,0 +1,490 @@
+#!/bin/bash
+##
+## Copyright (c) 2013 The WebM 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.
+##
+
+self=$0
+self_basename=${self##*/}
+self_dirname=$(dirname "$0")
+
+. "$self_dirname/msvs_common.sh"|| exit 127
+
+show_help() {
+ cat <${content}${tag}>"
+ indent_pop
+ else
+ echo "${indent}<${tag}>${content}${tag}>"
+ fi
+}
+
+generate_filter() {
+ local name=$1
+ local pats=$2
+ local file_list_sz
+ local i
+ local f
+ local saveIFS="$IFS"
+ local pack
+ echo "generating filter '$name' from ${#file_list[@]} files" >&2
+ IFS=*
+
+ file_list_sz=${#file_list[@]}
+ for i in ${!file_list[@]}; do
+ f=${file_list[i]}
+ for pat in ${pats//;/$IFS}; do
+ if [ "${f##*.}" == "$pat" ]; then
+ unset file_list[i]
+
+ objf=$(echo ${f%.*}.obj \
+ | sed -e "s,$src_path_bare,," \
+ -e 's/^[\./]\+//g' -e 's,[:/ ],_,g')
+
+ if ([ "$pat" == "asm" ] || [ "$pat" == "s" ]) && $asm_use_custom_step; then
+ # Avoid object file name collisions, i.e. vpx_config.c and
+ # vpx_config.asm produce the same object file without
+ # this additional suffix.
+ objf=${objf%.obj}_asm.obj
+ open_tag CustomBuild \
+ Include="$f"
+ for plat in "${platforms[@]}"; do
+ for cfg in Debug Release; do
+ tag_content Message "Assembling %(Filename)%(Extension)" \
+ Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
+ tag_content Command "$(eval echo \$asm_${cfg}_cmdline) -o \$(IntDir)$objf" \
+ Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
+ tag_content Outputs "\$(IntDir)$objf" \
+ Condition="'\$(Configuration)|\$(Platform)'=='$cfg|$plat'"
+ done
+ done
+ close_tag CustomBuild
+ elif [ "$pat" == "c" ] || \
+ [ "$pat" == "cc" ] || [ "$pat" == "cpp" ]; then
+ open_tag ClCompile \
+ Include="$f"
+ # Separate file names with Condition?
+ tag_content ObjectFileName "\$(IntDir)$objf"
+ # Check for AVX and turn it on to avoid warnings.
+ if [[ $f =~ avx.?\.c$ ]]; then
+ tag_content AdditionalOptions "/arch:AVX"
+ fi
+ close_tag ClCompile
+ elif [ "$pat" == "h" ] ; then
+ tag ClInclude \
+ Include="$f"
+ elif [ "$pat" == "vcxproj" ] ; then
+ open_tag ProjectReference \
+ Include="$f"
+ depguid=`grep ProjectGuid "$f" | sed 's,.*<.*>\(.*\).*,\1,'`
+ tag_content Project "$depguid"
+ tag_content ReferenceOutputAssembly false
+ close_tag ProjectReference
+ else
+ tag None \
+ Include="$f"
+ fi
+
+ break
+ fi
+ done
+ done
+
+ IFS="$saveIFS"
+}
+
+# Process command line
+unset target
+for opt in "$@"; do
+ optval="${opt#*=}"
+ case "$opt" in
+ --help|-h) show_help
+ ;;
+ --target=*) target="${optval}"
+ ;;
+ --out=*) outfile="$optval"
+ ;;
+ --name=*) name="${optval}"
+ ;;
+ --proj-guid=*) guid="${optval}"
+ ;;
+ --module-def=*) module_def="${optval}"
+ ;;
+ --exe) proj_kind="exe"
+ ;;
+ --dll) proj_kind="dll"
+ ;;
+ --lib) proj_kind="lib"
+ ;;
+ --src-path-bare=*)
+ src_path_bare=$(fix_path "$optval")
+ src_path_bare=${src_path_bare%/}
+ ;;
+ --static-crt) use_static_runtime=true
+ ;;
+ --enable-werror) werror=true
+ ;;
+ --ver=*)
+ vs_ver="$optval"
+ case "$optval" in
+ 10|11|12|14)
+ ;;
+ *) die Unrecognized Visual Studio Version in $opt
+ ;;
+ esac
+ ;;
+ -I*)
+ opt=${opt##-I}
+ opt=$(fix_path "$opt")
+ opt="${opt%/}"
+ incs="${incs}${incs:+;}"${opt}""
+ yasmincs="${yasmincs} -I"${opt}""
+ ;;
+ -D*) defines="${defines}${defines:+;}${opt##-D}"
+ ;;
+ -L*) # fudge . to $(OutDir)
+ if [ "${opt##-L}" == "." ]; then
+ libdirs="${libdirs}${libdirs:+;}"\$(OutDir)""
+ else
+ # Also try directories for this platform/configuration
+ opt=${opt##-L}
+ opt=$(fix_path "$opt")
+ libdirs="${libdirs}${libdirs:+;}"${opt}""
+ libdirs="${libdirs}${libdirs:+;}"${opt}/\$(PlatformName)/\$(Configuration)""
+ libdirs="${libdirs}${libdirs:+;}"${opt}/\$(PlatformName)""
+ fi
+ ;;
+ -l*) libs="${libs}${libs:+ }${opt##-l}.lib"
+ ;;
+ -*) die_unknown $opt
+ ;;
+ *)
+ # The paths in file_list are fixed outside of the loop.
+ file_list[${#file_list[@]}]="$opt"
+ case "$opt" in
+ *.asm|*.s) uses_asm=true
+ ;;
+ esac
+ ;;
+ esac
+done
+
+# Make one call to fix_path for file_list to improve performance.
+fix_file_list
+
+outfile=${outfile:-/dev/stdout}
+guid=${guid:-`generate_uuid`}
+asm_use_custom_step=false
+uses_asm=${uses_asm:-false}
+case "${vs_ver:-11}" in
+ 10|11|12|14)
+ asm_use_custom_step=$uses_asm
+ ;;
+esac
+
+[ -n "$name" ] || die "Project name (--name) must be specified!"
+[ -n "$target" ] || die "Target (--target) must be specified!"
+
+if ${use_static_runtime:-false}; then
+ release_runtime=MultiThreaded
+ debug_runtime=MultiThreadedDebug
+ lib_sfx=mt
+else
+ release_runtime=MultiThreadedDLL
+ debug_runtime=MultiThreadedDebugDLL
+ lib_sfx=md
+fi
+
+# Calculate debug lib names: If a lib ends in ${lib_sfx}.lib, then rename
+# it to ${lib_sfx}d.lib. This precludes linking to release libs from a
+# debug exe, so this may need to be refactored later.
+for lib in ${libs}; do
+ if [ "$lib" != "${lib%${lib_sfx}.lib}" ]; then
+ lib=${lib%.lib}d.lib
+ fi
+ debug_libs="${debug_libs}${debug_libs:+ }${lib}"
+done
+debug_libs=${debug_libs// /;}
+libs=${libs// /;}
+
+
+# List of all platforms supported for this target
+case "$target" in
+ x86_64*)
+ platforms[0]="x64"
+ asm_Debug_cmdline="yasm -Xvc -g cv8 -f win64 ${yasmincs} "%(FullPath)""
+ asm_Release_cmdline="yasm -Xvc -f win64 ${yasmincs} "%(FullPath)""
+ ;;
+ x86*)
+ platforms[0]="Win32"
+ asm_Debug_cmdline="yasm -Xvc -g cv8 -f win32 ${yasmincs} "%(FullPath)""
+ asm_Release_cmdline="yasm -Xvc -f win32 ${yasmincs} "%(FullPath)""
+ ;;
+ arm*)
+ platforms[0]="ARM"
+ asm_Debug_cmdline="armasm -nologo -oldit "%(FullPath)""
+ asm_Release_cmdline="armasm -nologo -oldit "%(FullPath)""
+ ;;
+ *) die "Unsupported target $target!"
+ ;;
+esac
+
+generate_vcxproj() {
+ echo ""
+ open_tag Project \
+ DefaultTargets="Build" \
+ ToolsVersion="4.0" \
+ xmlns="http://schemas.microsoft.com/developer/msbuild/2003" \
+
+ open_tag ItemGroup \
+ Label="ProjectConfigurations"
+ for plat in "${platforms[@]}"; do
+ for config in Debug Release; do
+ open_tag ProjectConfiguration \
+ Include="$config|$plat"
+ tag_content Configuration $config
+ tag_content Platform $plat
+ close_tag ProjectConfiguration
+ done
+ done
+ close_tag ItemGroup
+
+ open_tag PropertyGroup \
+ Label="Globals"
+ tag_content ProjectGuid "{${guid}}"
+ tag_content RootNamespace ${name}
+ tag_content Keyword ManagedCProj
+ if [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
+ tag_content AppContainerApplication true
+ # The application type can be one of "Windows Store",
+ # "Windows Phone" or "Windows Phone Silverlight". The
+ # actual value doesn't matter from the libvpx point of view,
+ # since a static library built for one works on the others.
+ # The PlatformToolset field needs to be set in sync with this;
+ # for Windows Store and Windows Phone Silverlight it should be
+ # v120 while it should be v120_wp81 if the type is Windows Phone.
+ tag_content ApplicationType "Windows Store"
+ tag_content ApplicationTypeRevision 8.1
+ fi
+ close_tag PropertyGroup
+
+ tag Import \
+ Project="\$(VCTargetsPath)\\Microsoft.Cpp.Default.props"
+
+ for plat in "${platforms[@]}"; do
+ for config in Release Debug; do
+ open_tag PropertyGroup \
+ Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'" \
+ Label="Configuration"
+ if [ "$proj_kind" = "exe" ]; then
+ tag_content ConfigurationType Application
+ elif [ "$proj_kind" = "dll" ]; then
+ tag_content ConfigurationType DynamicLibrary
+ else
+ tag_content ConfigurationType StaticLibrary
+ fi
+ if [ "$vs_ver" = "11" ]; then
+ if [ "$plat" = "ARM" ]; then
+ # Setting the wp80 toolchain automatically sets the
+ # WINAPI_FAMILY define, which is required for building
+ # code for arm with the windows headers. Alternatively,
+ # one could add AppContainerApplication=true in the Globals
+ # section and add PrecompiledHeader=NotUsing and
+ # CompileAsWinRT=false in ClCompile and SubSystem=Console
+ # in Link.
+ tag_content PlatformToolset v110_wp80
+ else
+ tag_content PlatformToolset v110
+ fi
+ fi
+ if [ "$vs_ver" = "12" ]; then
+ # Setting a PlatformToolset indicating windows phone isn't
+ # enough to build code for arm with MSVC 2013, one strictly
+ # has to enable AppContainerApplication as well.
+ tag_content PlatformToolset v120
+ fi
+ if [ "$vs_ver" = "14" ]; then
+ tag_content PlatformToolset v140
+ fi
+ tag_content CharacterSet Unicode
+ if [ "$config" = "Release" ]; then
+ tag_content WholeProgramOptimization true
+ fi
+ close_tag PropertyGroup
+ done
+ done
+
+ tag Import \
+ Project="\$(VCTargetsPath)\\Microsoft.Cpp.props"
+
+ open_tag ImportGroup \
+ Label="PropertySheets"
+ tag Import \
+ Project="\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props" \
+ Condition="exists('\$(UserRootDir)\\Microsoft.Cpp.\$(Platform).user.props')" \
+ Label="LocalAppDataPlatform"
+ close_tag ImportGroup
+
+ tag PropertyGroup \
+ Label="UserMacros"
+
+ for plat in "${platforms[@]}"; do
+ plat_no_ws=`echo $plat | sed 's/[^A-Za-z0-9_]/_/g'`
+ for config in Debug Release; do
+ open_tag PropertyGroup \
+ Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'"
+ tag_content OutDir "\$(SolutionDir)$plat_no_ws\\\$(Configuration)\\"
+ tag_content IntDir "$plat_no_ws\\\$(Configuration)\\${name}\\"
+ if [ "$proj_kind" == "lib" ]; then
+ if [ "$config" == "Debug" ]; then
+ config_suffix=d
+ else
+ config_suffix=""
+ fi
+ tag_content TargetName "${name}${lib_sfx}${config_suffix}"
+ fi
+ close_tag PropertyGroup
+ done
+ done
+
+ for plat in "${platforms[@]}"; do
+ for config in Debug Release; do
+ open_tag ItemDefinitionGroup \
+ Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'"
+ if [ "$name" == "vpx" ]; then
+ hostplat=$plat
+ if [ "$hostplat" == "ARM" ]; then
+ hostplat=Win32
+ fi
+ fi
+ open_tag ClCompile
+ if [ "$config" = "Debug" ]; then
+ opt=Disabled
+ runtime=$debug_runtime
+ curlibs=$debug_libs
+ debug=_DEBUG
+ else
+ opt=MaxSpeed
+ runtime=$release_runtime
+ curlibs=$libs
+ tag_content FavorSizeOrSpeed Speed
+ debug=NDEBUG
+ fi
+ extradefines=";$defines"
+ tag_content Optimization $opt
+ tag_content AdditionalIncludeDirectories "$incs;%(AdditionalIncludeDirectories)"
+ tag_content PreprocessorDefinitions "WIN32;$debug;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE$extradefines;%(PreprocessorDefinitions)"
+ tag_content RuntimeLibrary $runtime
+ tag_content WarningLevel Level3
+ if ${werror:-false}; then
+ tag_content TreatWarningAsError true
+ fi
+ if [ $vs_ver -ge 11 ]; then
+ # We need to override the defaults for these settings
+ # if AppContainerApplication is set.
+ tag_content CompileAsWinRT false
+ tag_content PrecompiledHeader NotUsing
+ tag_content SDLCheck false
+ fi
+ close_tag ClCompile
+ case "$proj_kind" in
+ exe)
+ open_tag Link
+ tag_content GenerateDebugInformation true
+ # Console is the default normally, but if
+ # AppContainerApplication is set, we need to override it.
+ tag_content SubSystem Console
+ close_tag Link
+ ;;
+ dll)
+ open_tag Link
+ tag_content GenerateDebugInformation true
+ tag_content ModuleDefinitionFile $module_def
+ close_tag Link
+ ;;
+ lib)
+ ;;
+ esac
+ close_tag ItemDefinitionGroup
+ done
+
+ done
+
+ open_tag ItemGroup
+ generate_filter "Source Files" "c;cc;cpp;def;odl;idl;hpj;bat;asm;asmx;s"
+ close_tag ItemGroup
+ open_tag ItemGroup
+ generate_filter "Header Files" "h;hm;inl;inc;xsd"
+ close_tag ItemGroup
+ open_tag ItemGroup
+ generate_filter "Build Files" "mk"
+ close_tag ItemGroup
+ open_tag ItemGroup
+ generate_filter "References" "vcxproj"
+ close_tag ItemGroup
+
+ tag Import \
+ Project="\$(VCTargetsPath)\\Microsoft.Cpp.targets"
+
+ open_tag ImportGroup \
+ Label="ExtensionTargets"
+ close_tag ImportGroup
+
+ close_tag Project
+
+ # This must be done from within the {} subshell
+ echo "Ignored files list (${#file_list[@]} items) is:" >&2
+ for f in "${file_list[@]}"; do
+ echo " $f" >&2
+ done
+}
+
+# This regexp doesn't catch most of the strings in the vcxproj format,
+# since they're like path instead of
+# as previously. It still seems to work ok despite this.
+generate_vcxproj |
+ sed -e '/"/s;\([^ "]\)/;\1\\;g' |
+ sed -e '/xmlns/s;\\;/;g' > ${outfile}
+
+exit
diff --git a/libs/libvpx/build/make/iosbuild.sh b/libs/libvpx/build/make/iosbuild.sh
new file mode 100755
index 0000000000..ae5ba182d5
--- /dev/null
+++ b/libs/libvpx/build/make/iosbuild.sh
@@ -0,0 +1,302 @@
+#!/bin/sh
+##
+## Copyright (c) 2014 The WebM 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 script generates 'VPX.framework'. An iOS app can encode and decode VPx
+## video by including 'VPX.framework'.
+##
+## Run iosbuild.sh to create 'VPX.framework' in the current directory.
+##
+set -e
+devnull='> /dev/null 2>&1'
+
+BUILD_ROOT="_iosbuild"
+CONFIGURE_ARGS="--disable-docs
+ --disable-examples
+ --disable-libyuv
+ --disable-unit-tests"
+DIST_DIR="_dist"
+FRAMEWORK_DIR="VPX.framework"
+HEADER_DIR="${FRAMEWORK_DIR}/Headers/vpx"
+SCRIPT_DIR=$(dirname "$0")
+LIBVPX_SOURCE_DIR=$(cd ${SCRIPT_DIR}/../..; pwd)
+LIPO=$(xcrun -sdk iphoneos${SDK} -find lipo)
+ORIG_PWD="$(pwd)"
+ARM_TARGETS="arm64-darwin-gcc
+ armv7-darwin-gcc
+ armv7s-darwin-gcc"
+SIM_TARGETS="x86-iphonesimulator-gcc
+ x86_64-iphonesimulator-gcc"
+OSX_TARGETS="x86-darwin15-gcc
+ x86_64-darwin15-gcc"
+TARGETS="${ARM_TARGETS} ${SIM_TARGETS}"
+
+# Configures for the target specified by $1, and invokes make with the dist
+# target using $DIST_DIR as the distribution output directory.
+build_target() {
+ local target="$1"
+ local old_pwd="$(pwd)"
+ local target_specific_flags=""
+
+ vlog "***Building target: ${target}***"
+
+ case "${target}" in
+ x86-*)
+ target_specific_flags="--enable-pic"
+ vlog "Enabled PIC for ${target}"
+ ;;
+ esac
+
+ mkdir "${target}"
+ cd "${target}"
+ eval "${LIBVPX_SOURCE_DIR}/configure" --target="${target}" \
+ ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS} ${target_specific_flags} \
+ ${devnull}
+ export DIST_DIR
+ eval make dist ${devnull}
+ cd "${old_pwd}"
+
+ vlog "***Done building target: ${target}***"
+}
+
+# Returns the preprocessor symbol for the target specified by $1.
+target_to_preproc_symbol() {
+ target="$1"
+ case "${target}" in
+ arm64-*)
+ echo "__aarch64__"
+ ;;
+ armv7-*)
+ echo "__ARM_ARCH_7A__"
+ ;;
+ armv7s-*)
+ echo "__ARM_ARCH_7S__"
+ ;;
+ x86-*)
+ echo "__i386__"
+ ;;
+ x86_64-*)
+ echo "__x86_64__"
+ ;;
+ *)
+ echo "#error ${target} unknown/unsupported"
+ return 1
+ ;;
+ esac
+}
+
+# Create a vpx_config.h shim that, based on preprocessor settings for the
+# current target CPU, includes the real vpx_config.h for the current target.
+# $1 is the list of targets.
+create_vpx_framework_config_shim() {
+ local targets="$1"
+ local config_file="${HEADER_DIR}/vpx_config.h"
+ local preproc_symbol=""
+ local target=""
+ local include_guard="VPX_FRAMEWORK_HEADERS_VPX_VPX_CONFIG_H_"
+
+ local file_header="/*
+ * Copyright (c) $(date +%Y) The WebM 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.
+ */
+
+/* GENERATED FILE: DO NOT EDIT! */
+
+#ifndef ${include_guard}
+#define ${include_guard}
+
+#if defined"
+
+ printf "%s" "${file_header}" > "${config_file}"
+ for target in ${targets}; do
+ preproc_symbol=$(target_to_preproc_symbol "${target}")
+ printf " ${preproc_symbol}\n" >> "${config_file}"
+ printf "#define VPX_FRAMEWORK_TARGET \"${target}\"\n" >> "${config_file}"
+ printf "#include \"VPX/vpx/${target}/vpx_config.h\"\n" >> "${config_file}"
+ printf "#elif defined" >> "${config_file}"
+ mkdir "${HEADER_DIR}/${target}"
+ cp -p "${BUILD_ROOT}/${target}/vpx_config.h" "${HEADER_DIR}/${target}"
+ done
+
+ # Consume the last line of output from the loop: We don't want it.
+ sed -i '' -e '$d' "${config_file}"
+
+ printf "#endif\n\n" >> "${config_file}"
+ printf "#endif // ${include_guard}" >> "${config_file}"
+}
+
+# Configures and builds each target specified by $1, and then builds
+# VPX.framework.
+build_framework() {
+ local lib_list=""
+ local targets="$1"
+ local target=""
+ local target_dist_dir=""
+
+ # Clean up from previous build(s).
+ rm -rf "${BUILD_ROOT}" "${FRAMEWORK_DIR}"
+
+ # Create output dirs.
+ mkdir -p "${BUILD_ROOT}"
+ mkdir -p "${HEADER_DIR}"
+
+ cd "${BUILD_ROOT}"
+
+ for target in ${targets}; do
+ build_target "${target}"
+ target_dist_dir="${BUILD_ROOT}/${target}/${DIST_DIR}"
+ lib_list="${lib_list} ${target_dist_dir}/lib/libvpx.a"
+ done
+
+ cd "${ORIG_PWD}"
+
+ # The basic libvpx API includes are all the same; just grab the most recent
+ # set.
+ cp -p "${target_dist_dir}"/include/vpx/* "${HEADER_DIR}"
+
+ # Build the fat library.
+ ${LIPO} -create ${lib_list} -output ${FRAMEWORK_DIR}/VPX
+
+ # Create the vpx_config.h shim that allows usage of vpx_config.h from
+ # within VPX.framework.
+ create_vpx_framework_config_shim "${targets}"
+
+ # Copy in vpx_version.h.
+ cp -p "${BUILD_ROOT}/${target}/vpx_version.h" "${HEADER_DIR}"
+
+ vlog "Created fat library ${FRAMEWORK_DIR}/VPX containing:"
+ for lib in ${lib_list}; do
+ vlog " $(echo ${lib} | awk -F / '{print $2, $NF}')"
+ done
+
+ # TODO(tomfinegan): Verify that expected targets are included within
+ # VPX.framework/VPX via lipo -info.
+}
+
+# Trap function. Cleans up the subtree used to build all targets contained in
+# $TARGETS.
+cleanup() {
+ local readonly res=$?
+ cd "${ORIG_PWD}"
+
+ if [ $res -ne 0 ]; then
+ elog "build exited with error ($res)"
+ fi
+
+ if [ "${PRESERVE_BUILD_OUTPUT}" != "yes" ]; then
+ rm -rf "${BUILD_ROOT}"
+ fi
+}
+
+print_list() {
+ local indent="$1"
+ shift
+ local list="$@"
+ for entry in ${list}; do
+ echo "${indent}${entry}"
+ done
+}
+
+iosbuild_usage() {
+cat << EOF
+ Usage: ${0##*/} [arguments]
+ --help: Display this message and exit.
+ --extra-configure-args : Extra args to pass when configuring libvpx.
+ --macosx: Uses darwin15 targets instead of iphonesimulator targets for x86
+ and x86_64. Allows linking to framework when builds target MacOSX
+ instead of iOS.
+ --preserve-build-output: Do not delete the build directory.
+ --show-build-output: Show output from each library build.
+ --targets : Override default target list. Defaults:
+$(print_list " " ${TARGETS})
+ --test-link: Confirms all targets can be linked. Functionally identical to
+ passing --enable-examples via --extra-configure-args.
+ --verbose: Output information about the environment and each stage of the
+ build.
+EOF
+}
+
+elog() {
+ echo "${0##*/} failed because: $@" 1>&2
+}
+
+vlog() {
+ if [ "${VERBOSE}" = "yes" ]; then
+ echo "$@"
+ fi
+}
+
+trap cleanup EXIT
+
+# Parse the command line.
+while [ -n "$1" ]; do
+ case "$1" in
+ --extra-configure-args)
+ EXTRA_CONFIGURE_ARGS="$2"
+ shift
+ ;;
+ --help)
+ iosbuild_usage
+ exit
+ ;;
+ --preserve-build-output)
+ PRESERVE_BUILD_OUTPUT=yes
+ ;;
+ --show-build-output)
+ devnull=
+ ;;
+ --test-link)
+ EXTRA_CONFIGURE_ARGS="${EXTRA_CONFIGURE_ARGS} --enable-examples"
+ ;;
+ --targets)
+ TARGETS="$2"
+ shift
+ ;;
+ --macosx)
+ TARGETS="${ARM_TARGETS} ${OSX_TARGETS}"
+ ;;
+ --verbose)
+ VERBOSE=yes
+ ;;
+ *)
+ iosbuild_usage
+ exit 1
+ ;;
+ esac
+ shift
+done
+
+if [ "${VERBOSE}" = "yes" ]; then
+cat << EOF
+ BUILD_ROOT=${BUILD_ROOT}
+ DIST_DIR=${DIST_DIR}
+ CONFIGURE_ARGS=${CONFIGURE_ARGS}
+ EXTRA_CONFIGURE_ARGS=${EXTRA_CONFIGURE_ARGS}
+ FRAMEWORK_DIR=${FRAMEWORK_DIR}
+ HEADER_DIR=${HEADER_DIR}
+ LIBVPX_SOURCE_DIR=${LIBVPX_SOURCE_DIR}
+ LIPO=${LIPO}
+ MAKEFLAGS=${MAKEFLAGS}
+ ORIG_PWD=${ORIG_PWD}
+ PRESERVE_BUILD_OUTPUT=${PRESERVE_BUILD_OUTPUT}
+ TARGETS="$(print_list "" ${TARGETS})"
+ OSX_TARGETS="${OSX_TARGETS}"
+ SIM_TARGETS="${SIM_TARGETS}"
+EOF
+fi
+
+build_framework "${TARGETS}"
+echo "Successfully built '${FRAMEWORK_DIR}' for:"
+print_list "" ${TARGETS}
diff --git a/libs/libvpx/build/make/msvs_common.sh b/libs/libvpx/build/make/msvs_common.sh
new file mode 100644
index 0000000000..90c14888c2
--- /dev/null
+++ b/libs/libvpx/build/make/msvs_common.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+##
+## Copyright (c) 2014 The WebM 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.
+##
+
+if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] \
+ && cygpath --help >/dev/null 2>&1; then
+ FIXPATH='cygpath -m'
+else
+ FIXPATH='echo_path'
+fi
+
+die() {
+ echo "${self_basename}: $@" >&2
+ exit 1
+}
+
+die_unknown(){
+ echo "Unknown option \"$1\"." >&2
+ echo "See ${self_basename} --help for available options." >&2
+ exit 1
+}
+
+echo_path() {
+ for path; do
+ echo "$path"
+ done
+}
+
+# Output one, possibly changed based on the system, path per line.
+fix_path() {
+ $FIXPATH "$@"
+}
+
+# Corrects the paths in file_list in one pass for efficiency.
+fix_file_list() {
+ # TODO(jzern): this could be more generic and take the array as a param.
+ files=$(fix_path "${file_list[@]}")
+ local IFS=$'\n'
+ file_list=($files)
+}
+
+generate_uuid() {
+ local hex="0123456789ABCDEF"
+ local i
+ local uuid=""
+ local j
+ #93995380-89BD-4b04-88EB-625FBE52EBFB
+ for ((i=0; i<32; i++)); do
+ (( j = $RANDOM % 16 ))
+ uuid="${uuid}${hex:$j:1}"
+ done
+ echo "${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12}"
+}
+
+indent1=" "
+indent=""
+indent_push() {
+ indent="${indent}${indent1}"
+}
+indent_pop() {
+ indent="${indent%${indent1}}"
+}
+
+tag_attributes() {
+ for opt in "$@"; do
+ optval="${opt#*=}"
+ [ -n "${optval}" ] ||
+ die "Missing attribute value in '$opt' while generating $tag tag"
+ echo "${indent}${opt%%=*}=\"${optval}\""
+ done
+}
+
+open_tag() {
+ local tag=$1
+ shift
+ if [ $# -ne 0 ]; then
+ echo "${indent}<${tag}"
+ indent_push
+ tag_attributes "$@"
+ echo "${indent}>"
+ else
+ echo "${indent}<${tag}>"
+ indent_push
+ fi
+}
+
+close_tag() {
+ local tag=$1
+ indent_pop
+ echo "${indent}${tag}>"
+}
+
+tag() {
+ local tag=$1
+ shift
+ if [ $# -ne 0 ]; then
+ echo "${indent}<${tag}"
+ indent_push
+ tag_attributes "$@"
+ indent_pop
+ echo "${indent}/>"
+ else
+ echo "${indent}<${tag}/>"
+ fi
+}
+
diff --git a/libs/libvpx/build/make/rtcd.pl b/libs/libvpx/build/make/rtcd.pl
new file mode 100755
index 0000000000..991b6abe7d
--- /dev/null
+++ b/libs/libvpx/build/make/rtcd.pl
@@ -0,0 +1,426 @@
+#!/usr/bin/env perl
+
+no strict 'refs';
+use warnings;
+use Getopt::Long;
+Getopt::Long::Configure("auto_help") if $Getopt::Long::VERSION > 2.32;
+
+my %ALL_FUNCS = ();
+my @ALL_ARCHS;
+my @ALL_FORWARD_DECLS;
+my @REQUIRES;
+
+my %opts = ();
+my %disabled = ();
+my %required = ();
+
+my @argv;
+foreach (@ARGV) {
+ $disabled{$1} = 1, next if /--disable-(.*)/;
+ $required{$1} = 1, next if /--require-(.*)/;
+ push @argv, $_;
+}
+
+# NB: use GetOptions() instead of GetOptionsFromArray() for compatibility.
+@ARGV = @argv;
+GetOptions(
+ \%opts,
+ 'arch=s',
+ 'sym=s',
+ 'config=s',
+);
+
+foreach my $opt (qw/arch config/) {
+ if (!defined($opts{$opt})) {
+ warn "--$opt is required!\n";
+ Getopt::Long::HelpMessage('-exit' => 1);
+ }
+}
+
+foreach my $defs_file (@ARGV) {
+ if (!-f $defs_file) {
+ warn "$defs_file: $!\n";
+ Getopt::Long::HelpMessage('-exit' => 1);
+ }
+}
+
+open CONFIG_FILE, $opts{config} or
+ die "Error opening config file '$opts{config}': $!\n";
+
+my %config = ();
+while () {
+ next if !/^(?:CONFIG_|HAVE_)/;
+ chomp;
+ my @pair = split /=/;
+ $config{$pair[0]} = $pair[1];
+}
+close CONFIG_FILE;
+
+#
+# Routines for the RTCD DSL to call
+#
+sub vpx_config($) {
+ return (defined $config{$_[0]}) ? $config{$_[0]} : "";
+}
+
+sub specialize {
+ my $fn=$_[0];
+ shift;
+ foreach my $opt (@_) {
+ eval "\$${fn}_${opt}=${fn}_${opt}";
+ }
+}
+
+sub add_proto {
+ my $fn = splice(@_, -2, 1);
+ $ALL_FUNCS{$fn} = \@_;
+ specialize $fn, "c";
+}
+
+sub require {
+ foreach my $fn (keys %ALL_FUNCS) {
+ foreach my $opt (@_) {
+ my $ofn = eval "\$${fn}_${opt}";
+ next if !$ofn;
+
+ # if we already have a default, then we can disable it, as we know
+ # we can do better.
+ my $best = eval "\$${fn}_default";
+ if ($best) {
+ my $best_ofn = eval "\$${best}";
+ if ($best_ofn && "$best_ofn" ne "$ofn") {
+ eval "\$${best}_link = 'false'";
+ }
+ }
+ eval "\$${fn}_default=${fn}_${opt}";
+ eval "\$${fn}_${opt}_link='true'";
+ }
+ }
+}
+
+sub forward_decls {
+ push @ALL_FORWARD_DECLS, @_;
+}
+
+#
+# Include the user's directives
+#
+foreach my $f (@ARGV) {
+ open FILE, "<", $f or die "cannot open $f: $!\n";
+ my $contents = join('', );
+ close FILE;
+ eval $contents or warn "eval failed: $@\n";
+}
+
+#
+# Process the directives according to the command line
+#
+sub process_forward_decls() {
+ foreach (@ALL_FORWARD_DECLS) {
+ $_->();
+ }
+}
+
+sub determine_indirection {
+ vpx_config("CONFIG_RUNTIME_CPU_DETECT") eq "yes" or &require(@ALL_ARCHS);
+ foreach my $fn (keys %ALL_FUNCS) {
+ my $n = "";
+ my @val = @{$ALL_FUNCS{$fn}};
+ my $args = pop @val;
+ my $rtyp = "@val";
+ my $dfn = eval "\$${fn}_default";
+ $dfn = eval "\$${dfn}";
+ foreach my $opt (@_) {
+ my $ofn = eval "\$${fn}_${opt}";
+ next if !$ofn;
+ my $link = eval "\$${fn}_${opt}_link";
+ next if $link && $link eq "false";
+ $n .= "x";
+ }
+ if ($n eq "x") {
+ eval "\$${fn}_indirect = 'false'";
+ } else {
+ eval "\$${fn}_indirect = 'true'";
+ }
+ }
+}
+
+sub declare_function_pointers {
+ foreach my $fn (sort keys %ALL_FUNCS) {
+ my @val = @{$ALL_FUNCS{$fn}};
+ my $args = pop @val;
+ my $rtyp = "@val";
+ my $dfn = eval "\$${fn}_default";
+ $dfn = eval "\$${dfn}";
+ foreach my $opt (@_) {
+ my $ofn = eval "\$${fn}_${opt}";
+ next if !$ofn;
+ print "$rtyp ${ofn}($args);\n";
+ }
+ if (eval "\$${fn}_indirect" eq "false") {
+ print "#define ${fn} ${dfn}\n";
+ } else {
+ print "RTCD_EXTERN $rtyp (*${fn})($args);\n";
+ }
+ print "\n";
+ }
+}
+
+sub set_function_pointers {
+ foreach my $fn (sort keys %ALL_FUNCS) {
+ my @val = @{$ALL_FUNCS{$fn}};
+ my $args = pop @val;
+ my $rtyp = "@val";
+ my $dfn = eval "\$${fn}_default";
+ $dfn = eval "\$${dfn}";
+ if (eval "\$${fn}_indirect" eq "true") {
+ print " $fn = $dfn;\n";
+ foreach my $opt (@_) {
+ my $ofn = eval "\$${fn}_${opt}";
+ next if !$ofn;
+ next if "$ofn" eq "$dfn";
+ my $link = eval "\$${fn}_${opt}_link";
+ next if $link && $link eq "false";
+ my $cond = eval "\$have_${opt}";
+ print " if (${cond}) $fn = $ofn;\n"
+ }
+ }
+ }
+}
+
+sub filter {
+ my @filtered;
+ foreach (@_) { push @filtered, $_ unless $disabled{$_}; }
+ return @filtered;
+}
+
+#
+# Helper functions for generating the arch specific RTCD files
+#
+sub common_top() {
+ my $include_guard = uc($opts{sym})."_H_";
+ print <) {
+ if (/HAVE_DSPR2=yes/) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/dspr2/);
+ last;
+ }
+ if (/HAVE_MSA=yes/) {
+ @ALL_ARCHS = filter("$opts{arch}", qw/msa/);
+ last;
+ }
+ }
+ close CONFIG_FILE;
+ mips;
+} elsif ($opts{arch} eq 'armv6') {
+ @ALL_ARCHS = filter(qw/media/);
+ arm;
+} elsif ($opts{arch} =~ /armv7\w?/) {
+ @ALL_ARCHS = filter(qw/media neon_asm neon/);
+ @REQUIRES = filter(keys %required ? keys %required : qw/media/);
+ &require(@REQUIRES);
+ arm;
+} elsif ($opts{arch} eq 'armv8' || $opts{arch} eq 'arm64' ) {
+ @ALL_ARCHS = filter(qw/neon/);
+ arm;
+} else {
+ unoptimized;
+}
+
+__END__
+
+=head1 NAME
+
+rtcd -
+
+=head1 SYNOPSIS
+
+Usage: rtcd.pl [options] FILE
+
+See 'perldoc rtcd.pl' for more details.
+
+=head1 DESCRIPTION
+
+Reads the Run Time CPU Detections definitions from FILE and generates a
+C header file on stdout.
+
+=head1 OPTIONS
+
+Options:
+ --arch=ARCH Architecture to generate defs for (required)
+ --disable-EXT Disable support for EXT extensions
+ --require-EXT Require support for EXT extensions
+ --sym=SYMBOL Unique symbol to use for RTCD initialization function
+ --config=FILE File with CONFIG_FOO=yes lines to parse
diff --git a/libs/libvpx/build/make/thumb.pm b/libs/libvpx/build/make/thumb.pm
new file mode 100644
index 0000000000..483c2539c6
--- /dev/null
+++ b/libs/libvpx/build/make/thumb.pm
@@ -0,0 +1,70 @@
+#!/usr/bin/env perl
+##
+## Copyright (c) 2013 The WebM 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.
+##
+
+package thumb;
+
+sub FixThumbInstructions($$)
+{
+ my $short_branches = $_[1];
+ my $branch_shift_offset = $short_branches ? 1 : 0;
+
+ # Write additions with shifts, such as "add r10, r11, lsl #8",
+ # in three operand form, "add r10, r10, r11, lsl #8".
+ s/(add\s+)(r\d+),\s*(r\d+),\s*(lsl #\d+)/$1$2, $2, $3, $4/g;
+
+ # Convert additions with a non-constant shift into a sequence
+ # with left shift, addition and a right shift (to restore the
+ # register to the original value). Currently the right shift
+ # isn't necessary in the code base since the values in these
+ # registers aren't used, but doing the shift for consistency.
+ # This converts instructions such as "add r12, r12, r5, lsl r4"
+ # into the sequence "lsl r5, r4", "add r12, r12, r5", "lsr r5, r4".
+ s/^(\s*)(add)(\s+)(r\d+),\s*(r\d+),\s*(r\d+),\s*lsl (r\d+)/$1lsl$3$6, $7\n$1$2$3$4, $5, $6\n$1lsr$3$6, $7/g;
+
+ # Convert loads with right shifts in the indexing into a
+ # sequence of an add, load and sub. This converts
+ # "ldrb r4, [r9, lr, asr #1]" into "add r9, r9, lr, asr #1",
+ # "ldrb r9, [r9]", "sub r9, r9, lr, asr #1".
+ s/^(\s*)(ldrb)(\s+)(r\d+),\s*\[(\w+),\s*(\w+),\s*(asr #\d+)\]/$1add $3$5, $5, $6, $7\n$1$2$3$4, [$5]\n$1sub $3$5, $5, $6, $7/g;
+
+ # Convert register indexing with writeback into a separate add
+ # instruction. This converts "ldrb r12, [r1, r2]!" into
+ # "ldrb r12, [r1, r2]", "add r1, r1, r2".
+ s/^(\s*)(ldrb)(\s+)(r\d+),\s*\[(\w+),\s*(\w+)\]!/$1$2$3$4, [$5, $6]\n$1add $3$5, $6/g;
+
+ # Convert negative register indexing into separate sub/add instructions.
+ # This converts "ldrne r4, [src, -pstep, lsl #1]" into
+ # "subne src, src, pstep, lsl #1", "ldrne r4, [src]",
+ # "addne src, src, pstep, lsl #1". In a couple of cases where
+ # this is used, it's used for two subsequent load instructions,
+ # where a hand-written version of it could merge two subsequent
+ # add and sub instructions.
+ s/^(\s*)((ldr|str|pld)(ne)?)(\s+)(r\d+,\s*)?\[(\w+), -([^\]]+)\]/$1sub$4$5$7, $7, $8\n$1$2$5$6\[$7\]\n$1add$4$5$7, $7, $8/g;
+
+ # Convert register post indexing to a separate add instruction.
+ # This converts "ldrneb r9, [r0], r2" into "ldrneb r9, [r0]",
+ # "addne r0, r0, r2".
+ s/^(\s*)((ldr|str)(ne)?[bhd]?)(\s+)(\w+),(\s*\w+,)?\s*\[(\w+)\],\s*(\w+)/$1$2$5$6,$7 [$8]\n$1add$4$5$8, $8, $9/g;
+
+ # Convert a conditional addition to the pc register into a series of
+ # instructions. This converts "addlt pc, pc, r3, lsl #2" into
+ # "itttt lt", "movlt.n r12, pc", "addlt.w r12, #12",
+ # "addlt.w r12, r12, r3, lsl #2", "movlt.n pc, r12".
+ # This assumes that r12 is free at this point.
+ s/^(\s*)addlt(\s+)pc,\s*pc,\s*(\w+),\s*lsl\s*#(\d+)/$1itttt$2lt\n$1movlt.n$2r12, pc\n$1addlt.w$2r12, #12\n$1addlt.w$2r12, r12, $3, lsl #($4-$branch_shift_offset)\n$1movlt.n$2pc, r12/g;
+
+ # Convert "mov pc, lr" into "bx lr", since the former only works
+ # for switching from arm to thumb (and only in armv7), but not
+ # from thumb to arm.
+ s/mov(\s*)pc\s*,\s*lr/bx$1lr/g;
+}
+
+1;
diff --git a/libs/libvpx/build/make/version.sh b/libs/libvpx/build/make/version.sh
new file mode 100755
index 0000000000..b340142c93
--- /dev/null
+++ b/libs/libvpx/build/make/version.sh
@@ -0,0 +1,76 @@
+#!/bin/sh
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+
+for opt in "$@"; do
+ optval="${opt#*=}"
+ case "$opt" in
+ --bare) bare=true ;;
+ *) break ;;
+ esac
+ shift
+done
+source_path=${1:-.}
+out_file=${2}
+id=${3:-VERSION_STRING}
+
+git_version_id=""
+if [ -d "${source_path}/.git" ]; then
+ # Source Path is a git working copy. Check for local modifications.
+ export GIT_DIR="${source_path}/.git"
+ git_version_id=`git describe --match=v[0-9]* 2>/dev/null`
+fi
+
+changelog_version=""
+for p in "${source_path}" "${source_path}/.."; do
+ if [ -z "$git_version_id" -a -f "${p}/CHANGELOG" ]; then
+ changelog_version=`head -n1 "${p}/CHANGELOG" | awk '{print $2}'`
+ changelog_version="${changelog_version}"
+ break
+ fi
+done
+version_str="${changelog_version}${git_version_id}"
+bare_version=${version_str#v}
+major_version=${bare_version%%.*}
+bare_version=${bare_version#*.}
+minor_version=${bare_version%%.*}
+bare_version=${bare_version#*.}
+patch_version=${bare_version%%-*}
+bare_version=${bare_version#${patch_version}}
+extra_version=${bare_version##-}
+
+#since they'll be used as integers below make sure they are or force to 0
+for v in major_version minor_version patch_version; do
+ if eval echo \$$v |grep -E -q '[^[:digit:]]'; then
+ eval $v=0
+ fi
+done
+
+if [ ${bare} ]; then
+ echo "${changelog_version}${git_version_id}" > $$.tmp
+else
+ cat<$$.tmp
+#define VERSION_MAJOR $major_version
+#define VERSION_MINOR $minor_version
+#define VERSION_PATCH $patch_version
+#define VERSION_EXTRA "$extra_version"
+#define VERSION_PACKED ((VERSION_MAJOR<<16)|(VERSION_MINOR<<8)|(VERSION_PATCH))
+#define ${id}_NOSP "${version_str}"
+#define ${id} " ${version_str}"
+EOF
+fi
+if [ -n "$out_file" ]; then
+diff $$.tmp ${out_file} >/dev/null 2>&1 || cat $$.tmp > ${out_file}
+else
+cat $$.tmp
+fi
+rm $$.tmp
diff --git a/libs/libvpx/codereview.settings b/libs/libvpx/codereview.settings
new file mode 100644
index 0000000000..d7c8d395cb
--- /dev/null
+++ b/libs/libvpx/codereview.settings
@@ -0,0 +1,4 @@
+# This file is used by gcl to get repository specific information.
+GERRIT_HOST: chromium-review.googlesource.com
+GERRIT_PORT: 29418
+CODE_REVIEW_SERVER: chromium-review.googlesource.com
diff --git a/libs/libvpx/configure b/libs/libvpx/configure
new file mode 100755
index 0000000000..095cddf2db
--- /dev/null
+++ b/libs/libvpx/configure
@@ -0,0 +1,749 @@
+#!/bin/sh
+##
+## configure
+##
+## 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%/*}
+. "${source_path}/build/make/configure.sh"
+
+show_help(){
+ show_help_pre
+ cat << EOF
+Advanced options:
+ ${toggle_libs} libraries
+ ${toggle_examples} examples
+ ${toggle_docs} documentation
+ ${toggle_unit_tests} unit tests
+ ${toggle_decode_perf_tests} build decoder perf tests with unit tests
+ ${toggle_encode_perf_tests} build encoder perf tests with unit tests
+ --cpu=CPU tune for the specified CPU (ARM: cortex-a8, X86: sse3)
+ --libc=PATH path to alternate libc
+ --size-limit=WxH max size to allow in the decoder
+ --as={yasm|nasm|auto} use specified assembler [auto, yasm preferred]
+ --sdk-path=PATH path to root of sdk (android builds only)
+ ${toggle_codec_srcs} in/exclude codec library source code
+ ${toggle_debug_libs} in/exclude debug version of libraries
+ ${toggle_static_msvcrt} use static MSVCRT (VS builds only)
+ ${toggle_vp9_highbitdepth} use VP9 high bit depth (10/12) profiles
+ ${toggle_better_hw_compatibility}
+ enable encoder to produce streams with better
+ hardware decoder compatibility
+ ${toggle_vp8} VP8 codec support
+ ${toggle_vp9} VP9 codec support
+ ${toggle_vp10} VP10 codec support
+ ${toggle_internal_stats} output of encoder internal stats for debug, if supported (encoders)
+ ${toggle_postproc} postprocessing
+ ${toggle_vp9_postproc} vp9 specific 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_onthefly_bitpacking} enable on-the-fly bitpacking in real-time encoding
+ ${toggle_error_concealment} enable this option to get a decoder which is able to conceal losses
+ ${toggle_coefficient_range_checking}
+ enable decoder to check if intermediate
+ transform coefficients are in valid range
+ ${toggle_runtime_cpu_detect} runtime cpu detection
+ ${toggle_shared} shared library support
+ ${toggle_static} static library support
+ ${toggle_small} favor smaller size over speed
+ ${toggle_postproc_visualizer} macro block / block level visualizers
+ ${toggle_multi_res_encoding} enable multiple-resolution encoding
+ ${toggle_temporal_denoising} enable temporal denoising and disable the spatial denoiser
+ ${toggle_vp9_temporal_denoising}
+ enable vp9 temporal denoising
+ ${toggle_webm_io} enable input from and output to WebM container
+ ${toggle_libyuv} enable libyuv
+
+Codecs:
+ Codecs can be selectively enabled or disabled individually, or by family:
+ --disable-
+ is equivalent to:
+ --disable--encoder
+ --disable--decoder
+
+ Codecs available in this distribution:
+EOF
+#restore editor state '
+
+ family="";
+ last_family="";
+ c="";
+ str="";
+ for c in ${CODECS}; do
+ family=${c%_*}
+ if [ "${family}" != "${last_family}" ]; then
+ [ -z "${str}" ] || echo "${str}"
+ str="$(printf ' %10s:' ${family})"
+ fi
+ str="${str} $(printf '%10s' ${c#*_})"
+ last_family=${family}
+ done
+ echo "${str}"
+ show_help_post
+}
+
+##
+## BEGIN APPLICATION SPECIFIC CONFIGURATION
+##
+
+# all_platforms is a list of all supported target platforms. Maintain
+# alphabetically by architecture, generic-gnu last.
+all_platforms="${all_platforms} armv6-darwin-gcc"
+all_platforms="${all_platforms} armv6-linux-rvct"
+all_platforms="${all_platforms} armv6-linux-gcc"
+all_platforms="${all_platforms} armv6-none-rvct"
+all_platforms="${all_platforms} arm64-darwin-gcc"
+all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
+all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
+all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
+all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
+all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
+all_platforms="${all_platforms} armv7-win32-vs11"
+all_platforms="${all_platforms} armv7-win32-vs12"
+all_platforms="${all_platforms} armv7-win32-vs14"
+all_platforms="${all_platforms} armv7s-darwin-gcc"
+all_platforms="${all_platforms} mips32-linux-gcc"
+all_platforms="${all_platforms} mips64-linux-gcc"
+all_platforms="${all_platforms} sparc-solaris-gcc"
+all_platforms="${all_platforms} x86-android-gcc"
+all_platforms="${all_platforms} x86-darwin8-gcc"
+all_platforms="${all_platforms} x86-darwin8-icc"
+all_platforms="${all_platforms} x86-darwin9-gcc"
+all_platforms="${all_platforms} x86-darwin9-icc"
+all_platforms="${all_platforms} x86-darwin10-gcc"
+all_platforms="${all_platforms} x86-darwin11-gcc"
+all_platforms="${all_platforms} x86-darwin12-gcc"
+all_platforms="${all_platforms} x86-darwin13-gcc"
+all_platforms="${all_platforms} x86-darwin14-gcc"
+all_platforms="${all_platforms} x86-darwin15-gcc"
+all_platforms="${all_platforms} x86-iphonesimulator-gcc"
+all_platforms="${all_platforms} x86-linux-gcc"
+all_platforms="${all_platforms} x86-linux-icc"
+all_platforms="${all_platforms} x86-os2-gcc"
+all_platforms="${all_platforms} x86-solaris-gcc"
+all_platforms="${all_platforms} x86-win32-gcc"
+all_platforms="${all_platforms} x86-win32-vs7"
+all_platforms="${all_platforms} x86-win32-vs8"
+all_platforms="${all_platforms} x86-win32-vs9"
+all_platforms="${all_platforms} x86-win32-vs10"
+all_platforms="${all_platforms} x86-win32-vs11"
+all_platforms="${all_platforms} x86-win32-vs12"
+all_platforms="${all_platforms} x86-win32-vs14"
+all_platforms="${all_platforms} x86_64-android-gcc"
+all_platforms="${all_platforms} x86_64-darwin9-gcc"
+all_platforms="${all_platforms} x86_64-darwin10-gcc"
+all_platforms="${all_platforms} x86_64-darwin11-gcc"
+all_platforms="${all_platforms} x86_64-darwin12-gcc"
+all_platforms="${all_platforms} x86_64-darwin13-gcc"
+all_platforms="${all_platforms} x86_64-darwin14-gcc"
+all_platforms="${all_platforms} x86_64-darwin15-gcc"
+all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
+all_platforms="${all_platforms} x86_64-linux-gcc"
+all_platforms="${all_platforms} x86_64-linux-icc"
+all_platforms="${all_platforms} x86_64-solaris-gcc"
+all_platforms="${all_platforms} x86_64-win64-gcc"
+all_platforms="${all_platforms} x86_64-win64-vs8"
+all_platforms="${all_platforms} x86_64-win64-vs9"
+all_platforms="${all_platforms} x86_64-win64-vs10"
+all_platforms="${all_platforms} x86_64-win64-vs11"
+all_platforms="${all_platforms} x86_64-win64-vs12"
+all_platforms="${all_platforms} x86_64-win64-vs14"
+all_platforms="${all_platforms} generic-gnu"
+
+# all_targets is a list of all targets that can be configured
+# note that these should be in dependency order for now.
+all_targets="libs examples docs"
+
+# all targets available are enabled, by default.
+for t in ${all_targets}; do
+ [ -f "${source_path}/${t}.mk" ] && enable_feature ${t}
+done
+
+if ! perl --version >/dev/null; then
+ die "Perl is required to build"
+fi
+
+
+if [ "`cd \"${source_path}\" && pwd`" != "`pwd`" ]; then
+ # test to see if source_path already configured
+ if [ -f "${source_path}/vpx_config.h" ]; then
+ die "source directory already configured; run 'make distclean' there first"
+ fi
+fi
+
+# check installed doxygen version
+doxy_version=$(doxygen --version 2>/dev/null)
+doxy_major=${doxy_version%%.*}
+if [ ${doxy_major:-0} -ge 1 ]; then
+ doxy_version=${doxy_version#*.}
+ doxy_minor=${doxy_version%%.*}
+ doxy_patch=${doxy_version##*.}
+
+ [ $doxy_major -gt 1 ] && enable_feature doxygen
+ [ $doxy_minor -gt 5 ] && enable_feature doxygen
+ [ $doxy_minor -eq 5 ] && [ $doxy_patch -ge 3 ] && enable_feature doxygen
+fi
+
+# disable codecs when their source directory does not exist
+[ -d "${source_path}/vp8" ] || disable_feature vp8
+[ -d "${source_path}/vp9" ] || disable_feature vp9
+[ -d "${source_path}/vp10" ] || disable_feature vp10
+
+# disable vp10 codec by default
+disable_feature vp10
+
+# 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 && enable_feature install_docs
+enable_feature install_bins
+enable_feature install_libs
+
+enable_feature static
+enable_feature optimizations
+enable_feature dependency_tracking
+enable_feature spatial_resampling
+enable_feature multithread
+enable_feature os_support
+enable_feature temporal_denoising
+
+CODECS="
+ vp8_encoder
+ vp8_decoder
+ vp9_encoder
+ vp9_decoder
+ vp10_encoder
+ vp10_decoder
+"
+CODEC_FAMILIES="
+ vp8
+ vp9
+ vp10
+"
+
+ARCH_LIST="
+ arm
+ mips
+ x86
+ x86_64
+"
+ARCH_EXT_LIST_X86="
+ mmx
+ sse
+ sse2
+ sse3
+ ssse3
+ sse4_1
+ avx
+ avx2
+"
+ARCH_EXT_LIST="
+ edsp
+ media
+ neon
+ neon_asm
+
+ mips32
+ dspr2
+ msa
+ mips64
+
+ ${ARCH_EXT_LIST_X86}
+"
+HAVE_LIST="
+ ${ARCH_EXT_LIST}
+ vpx_ports
+ pthread_h
+ unistd_h
+"
+EXPERIMENT_LIST="
+ spatial_svc
+ fp_mb_stats
+ emulate_hardware
+ misc_fixes
+"
+CONFIG_LIST="
+ dependency_tracking
+ external_build
+ install_docs
+ install_bins
+ install_libs
+ install_srcs
+ use_x86inc
+ debug
+ gprof
+ gcov
+ rvct
+ gcc
+ msvs
+ pic
+ big_endian
+
+ codec_srcs
+ debug_libs
+
+ dequant_tokens
+ dc_recon
+ runtime_cpu_detect
+ postproc
+ vp9_postproc
+ multithread
+ internal_stats
+ ${CODECS}
+ ${CODEC_FAMILIES}
+ encoders
+ decoders
+ static_msvcrt
+ spatial_resampling
+ realtime_only
+ onthefly_bitpacking
+ error_concealment
+ shared
+ static
+ small
+ postproc_visualizer
+ os_support
+ unit_tests
+ webm_io
+ libyuv
+ decode_perf_tests
+ encode_perf_tests
+ multi_res_encoding
+ temporal_denoising
+ vp9_temporal_denoising
+ coefficient_range_checking
+ vp9_highbitdepth
+ better_hw_compatibility
+ experimental
+ size_limit
+ ${EXPERIMENT_LIST}
+"
+CMDLINE_SELECT="
+ dependency_tracking
+ external_build
+ extra_warnings
+ werror
+ install_docs
+ install_bins
+ install_libs
+ install_srcs
+ debug
+ gprof
+ gcov
+ pic
+ use_x86inc
+ optimizations
+ ccache
+ runtime_cpu_detect
+ thumb
+
+ libs
+ examples
+ docs
+ libc
+ as
+ size_limit
+ codec_srcs
+ debug_libs
+
+ dequant_tokens
+ dc_recon
+ postproc
+ vp9_postproc
+ multithread
+ internal_stats
+ ${CODECS}
+ ${CODEC_FAMILIES}
+ static_msvcrt
+ spatial_resampling
+ realtime_only
+ onthefly_bitpacking
+ error_concealment
+ shared
+ static
+ small
+ postproc_visualizer
+ unit_tests
+ webm_io
+ libyuv
+ decode_perf_tests
+ encode_perf_tests
+ multi_res_encoding
+ temporal_denoising
+ vp9_temporal_denoising
+ coefficient_range_checking
+ better_hw_compatibility
+ vp9_highbitdepth
+ experimental
+"
+
+process_cmdline() {
+ for opt do
+ optval="${opt#*=}"
+ case "$opt" in
+ --disable-codecs) for c in ${CODECS}; do disable_feature $c; done ;;
+ --enable-?*|--disable-?*)
+ eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
+ if echo "${EXPERIMENT_LIST}" | grep "^ *$option\$" >/dev/null; then
+ if enabled experimental; then
+ ${action}_feature $option
+ else
+ log_echo "Ignoring $opt -- not in experimental mode."
+ fi
+ else
+ process_common_cmdline $opt
+ fi
+ ;;
+ *) process_common_cmdline "$opt"
+ ;;
+ esac
+ done
+}
+
+post_process_cmdline() {
+ c=""
+
+ # If the codec family is disabled, disable all components of that family.
+ # If the codec family is enabled, enable all components of that family.
+ log_echo "Configuring selected codecs"
+ for c in ${CODECS}; do
+ disabled ${c%%_*} && disable_feature ${c}
+ enabled ${c%%_*} && enable_feature ${c}
+ done
+
+ # Enable all detected codecs, if they haven't been disabled
+ for c in ${CODECS}; do soft_enable $c; done
+
+ # Enable the codec family if any component of that family is enabled
+ for c in ${CODECS}; do
+ enabled $c && enable_feature ${c%_*}
+ done
+
+ # Set the {en,de}coders variable if any algorithm in that class is enabled
+ for c in ${CODECS}; do
+ enabled ${c} && enable_feature ${c##*_}s
+ done
+}
+
+
+process_targets() {
+ enabled child || write_common_config_banner
+ write_common_target_config_h ${BUILD_PFX}vpx_config.h
+ write_common_config_targets
+
+ # Calculate the default distribution name, based on the enabled features
+ cf=""
+ DIST_DIR=vpx
+ for cf in $CODEC_FAMILIES; do
+ if enabled ${cf}_encoder && enabled ${cf}_decoder; then
+ DIST_DIR="${DIST_DIR}-${cf}"
+ elif enabled ${cf}_encoder; then
+ DIST_DIR="${DIST_DIR}-${cf}cx"
+ elif enabled ${cf}_decoder; then
+ DIST_DIR="${DIST_DIR}-${cf}dx"
+ fi
+ done
+ enabled debug_libs && DIST_DIR="${DIST_DIR}-debug"
+ enabled codec_srcs && DIST_DIR="${DIST_DIR}-src"
+ ! enabled postproc && ! enabled vp9_postproc && DIST_DIR="${DIST_DIR}-nopost"
+ ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
+ ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
+ DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
+ case "${tgt_os}" in
+ win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
+ DIST_DIR="${DIST_DIR}-${tgt_cc}"
+ ;;
+ esac
+ if [ -f "${source_path}/build/make/version.sh" ]; then
+ ver=`"$source_path/build/make/version.sh" --bare "$source_path"`
+ DIST_DIR="${DIST_DIR}-${ver}"
+ VERSION_STRING=${ver}
+ ver=${ver%%-*}
+ VERSION_PATCH=${ver##*.}
+ ver=${ver%.*}
+ VERSION_MINOR=${ver##*.}
+ ver=${ver#v}
+ VERSION_MAJOR=${ver%.*}
+ fi
+ enabled child || cat <> config.mk
+
+PREFIX=${prefix}
+ifeq (\$(MAKECMDGOALS),dist)
+DIST_DIR?=${DIST_DIR}
+else
+DIST_DIR?=\$(DESTDIR)${prefix}
+endif
+LIBSUBDIR=${libdir##${prefix}/}
+
+VERSION_STRING=${VERSION_STRING}
+
+VERSION_MAJOR=${VERSION_MAJOR}
+VERSION_MINOR=${VERSION_MINOR}
+VERSION_PATCH=${VERSION_PATCH}
+
+CONFIGURE_ARGS=${CONFIGURE_ARGS}
+EOF
+ enabled child || echo "CONFIGURE_ARGS?=${CONFIGURE_ARGS}" >> config.mk
+
+ #
+ # Write makefiles for all enabled targets
+ #
+ for tgt in libs examples docs solution; do
+ tgt_fn="$tgt-$toolchain.mk"
+
+ if enabled $tgt; then
+ echo "Creating makefiles for ${toolchain} ${tgt}"
+ write_common_target_config_mk $tgt_fn ${BUILD_PFX}vpx_config.h
+ #write_${tgt}_config
+ fi
+ done
+
+}
+
+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.
+ if ! enabled linux && ! enabled os2; then
+ if enabled gnu; then
+ echo "--enable-shared is only supported on ELF; assuming this is OK"
+ else
+ die "--enable-shared only supported on ELF and OS/2 for now"
+ fi
+ fi
+ fi
+ if [ -z "$CC" ] || enabled external_build; then
+ echo "Bypassing toolchain for environment detection."
+ enable_feature external_build
+ check_header() {
+ log fake_check_header "$@"
+ header=$1
+ shift
+ var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
+ disable_feature $var
+ # Headers common to all environments
+ case $header in
+ stdio.h)
+ true;
+ ;;
+ *)
+ result=false
+ for d in "$@"; do
+ [ -f "${d##-I}/$header" ] && result=true && break
+ done
+ ${result:-true}
+ esac && enable_feature $var
+
+ # Specialize windows and POSIX environments.
+ case $toolchain in
+ *-win*-*)
+ # Don't check for any headers in Windows builds.
+ false
+ ;;
+ *)
+ case $header in
+ pthread.h) true;;
+ unistd.h) true;;
+ *) false;;
+ esac && enable_feature $var
+ esac
+ enabled $var
+ }
+ check_ld() {
+ true
+ }
+ fi
+ check_header stdio.h || die "Unable to invoke compiler: ${CC} ${CFLAGS}"
+ check_ld <> ${BUILD_PFX}vpx_config.c
+#include "vpx/vpx_codec.h"
+static const char* const cfg = "$CONFIGURE_ARGS";
+const char *vpx_codec_build_config(void) {return cfg;}
+EOF
diff --git a/libs/libvpx/docs.mk b/libs/libvpx/docs.mk
new file mode 100644
index 0000000000..889d18251f
--- /dev/null
+++ b/libs/libvpx/docs.mk
@@ -0,0 +1,48 @@
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+
+INSTALL_MAPS += docs/% docs/%
+INSTALL_MAPS += src/% %
+INSTALL_MAPS += % %
+
+# Static documentation authored in doxygen
+CODEC_DOX := mainpage.dox \
+ keywords.dox \
+ usage.dox \
+ usage_cx.dox \
+ usage_dx.dox \
+
+# Other doxy files sourced in Markdown
+TXT_DOX = $(call enabled,TXT_DOX)
+
+EXAMPLE_PATH += $(SRC_PATH_BARE) #for CHANGELOG, README, etc
+EXAMPLE_PATH += $(SRC_PATH_BARE)/examples
+
+doxyfile: $(if $(findstring examples, $(ALL_TARGETS)),examples.doxy)
+doxyfile: libs.doxy_template libs.doxy
+ @echo " [CREATE] $@"
+ @cat $^ > $@
+ @echo "STRIP_FROM_PATH += $(SRC_PATH_BARE) $(BUILD_ROOT)" >> $@
+ @echo "INPUT += $(addprefix $(SRC_PATH_BARE)/,$(CODEC_DOX))" >> $@;
+ @echo "INPUT += $(TXT_DOX)" >> $@;
+ @echo "EXAMPLE_PATH += $(EXAMPLE_PATH)" >> $@
+
+CLEAN-OBJS += doxyfile $(wildcard docs/html/*)
+docs/html/index.html: doxyfile $(CODEC_DOX) $(TXT_DOX)
+ @echo " [DOXYGEN] $<"
+ @doxygen $<
+DOCS-yes += docs/html/index.html
+
+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/libs/libvpx/examples.mk b/libs/libvpx/examples.mk
new file mode 100644
index 0000000000..f10bec68c3
--- /dev/null
+++ b/libs/libvpx/examples.mk
@@ -0,0 +1,382 @@
+##
+## Copyright (c) 2010 The WebM 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.
+##
+
+LIBYUV_SRCS += third_party/libyuv/include/libyuv/basic_types.h \
+ third_party/libyuv/include/libyuv/convert.h \
+ third_party/libyuv/include/libyuv/convert_argb.h \
+ third_party/libyuv/include/libyuv/convert_from.h \
+ third_party/libyuv/include/libyuv/cpu_id.h \
+ third_party/libyuv/include/libyuv/planar_functions.h \
+ third_party/libyuv/include/libyuv/rotate.h \
+ third_party/libyuv/include/libyuv/row.h \
+ third_party/libyuv/include/libyuv/scale.h \
+ third_party/libyuv/include/libyuv/scale_row.h \
+ third_party/libyuv/source/cpu_id.cc \
+ third_party/libyuv/source/planar_functions.cc \
+ third_party/libyuv/source/row_any.cc \
+ third_party/libyuv/source/row_common.cc \
+ third_party/libyuv/source/row_gcc.cc \
+ third_party/libyuv/source/row_mips.cc \
+ third_party/libyuv/source/row_neon.cc \
+ third_party/libyuv/source/row_neon64.cc \
+ third_party/libyuv/source/row_win.cc \
+ third_party/libyuv/source/scale.cc \
+ third_party/libyuv/source/scale_any.cc \
+ third_party/libyuv/source/scale_common.cc \
+ third_party/libyuv/source/scale_gcc.cc \
+ third_party/libyuv/source/scale_mips.cc \
+ third_party/libyuv/source/scale_neon.cc \
+ third_party/libyuv/source/scale_neon64.cc \
+ third_party/libyuv/source/scale_win.cc \
+
+LIBWEBM_COMMON_SRCS += third_party/libwebm/webmids.hpp
+
+LIBWEBM_MUXER_SRCS += third_party/libwebm/mkvmuxer.cpp \
+ third_party/libwebm/mkvmuxerutil.cpp \
+ third_party/libwebm/mkvwriter.cpp \
+ third_party/libwebm/mkvmuxer.hpp \
+ third_party/libwebm/mkvmuxertypes.hpp \
+ third_party/libwebm/mkvmuxerutil.hpp \
+ third_party/libwebm/mkvparser.hpp \
+ third_party/libwebm/mkvwriter.hpp
+
+LIBWEBM_PARSER_SRCS = third_party/libwebm/mkvparser.cpp \
+ third_party/libwebm/mkvreader.cpp \
+ third_party/libwebm/mkvparser.hpp \
+ third_party/libwebm/mkvreader.hpp
+
+# List of examples to build. UTILS are tools meant for distribution
+# while EXAMPLES demonstrate specific portions of the API.
+UTILS-$(CONFIG_DECODERS) += vpxdec.c
+vpxdec.SRCS += md5_utils.c md5_utils.h
+vpxdec.SRCS += vpx_ports/mem_ops.h
+vpxdec.SRCS += vpx_ports/mem_ops_aligned.h
+vpxdec.SRCS += vpx_ports/msvc.h
+vpxdec.SRCS += vpx_ports/vpx_timer.h
+vpxdec.SRCS += vpx/vpx_integer.h
+vpxdec.SRCS += args.c args.h
+vpxdec.SRCS += ivfdec.c ivfdec.h
+vpxdec.SRCS += tools_common.c tools_common.h
+vpxdec.SRCS += y4menc.c y4menc.h
+ifeq ($(CONFIG_LIBYUV),yes)
+ vpxdec.SRCS += $(LIBYUV_SRCS)
+endif
+ifeq ($(CONFIG_WEBM_IO),yes)
+ vpxdec.SRCS += $(LIBWEBM_COMMON_SRCS)
+ vpxdec.SRCS += $(LIBWEBM_PARSER_SRCS)
+ vpxdec.SRCS += webmdec.cc webmdec.h
+endif
+vpxdec.GUID = BA5FE66F-38DD-E034-F542-B1578C5FB950
+vpxdec.DESCRIPTION = Full featured decoder
+UTILS-$(CONFIG_ENCODERS) += vpxenc.c
+vpxenc.SRCS += args.c args.h y4minput.c y4minput.h vpxenc.h
+vpxenc.SRCS += ivfdec.c ivfdec.h
+vpxenc.SRCS += ivfenc.c ivfenc.h
+vpxenc.SRCS += rate_hist.c rate_hist.h
+vpxenc.SRCS += tools_common.c tools_common.h
+vpxenc.SRCS += warnings.c warnings.h
+vpxenc.SRCS += vpx_ports/mem_ops.h
+vpxenc.SRCS += vpx_ports/mem_ops_aligned.h
+vpxenc.SRCS += vpx_ports/msvc.h
+vpxenc.SRCS += vpx_ports/vpx_timer.h
+vpxenc.SRCS += vpxstats.c vpxstats.h
+ifeq ($(CONFIG_LIBYUV),yes)
+ vpxenc.SRCS += $(LIBYUV_SRCS)
+endif
+ifeq ($(CONFIG_WEBM_IO),yes)
+ vpxenc.SRCS += $(LIBWEBM_COMMON_SRCS)
+ vpxenc.SRCS += $(LIBWEBM_MUXER_SRCS)
+ vpxenc.SRCS += webmenc.cc webmenc.h
+endif
+vpxenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
+vpxenc.DESCRIPTION = Full featured encoder
+ifeq ($(CONFIG_SPATIAL_SVC),yes)
+ EXAMPLES-$(CONFIG_VP9_ENCODER) += vp9_spatial_svc_encoder.c
+ vp9_spatial_svc_encoder.SRCS += args.c args.h
+ vp9_spatial_svc_encoder.SRCS += ivfenc.c ivfenc.h
+ vp9_spatial_svc_encoder.SRCS += tools_common.c tools_common.h
+ vp9_spatial_svc_encoder.SRCS += video_common.h
+ vp9_spatial_svc_encoder.SRCS += video_writer.h video_writer.c
+ vp9_spatial_svc_encoder.SRCS += vpx_ports/msvc.h
+ vp9_spatial_svc_encoder.SRCS += vpxstats.c vpxstats.h
+ vp9_spatial_svc_encoder.GUID = 4A38598D-627D-4505-9C7B-D4020C84100D
+ vp9_spatial_svc_encoder.DESCRIPTION = VP9 Spatial SVC Encoder
+endif
+
+ifneq ($(CONFIG_SHARED),yes)
+EXAMPLES-$(CONFIG_VP9_ENCODER) += resize_util.c
+endif
+
+EXAMPLES-$(CONFIG_ENCODERS) += vpx_temporal_svc_encoder.c
+vpx_temporal_svc_encoder.SRCS += ivfenc.c ivfenc.h
+vpx_temporal_svc_encoder.SRCS += tools_common.c tools_common.h
+vpx_temporal_svc_encoder.SRCS += video_common.h
+vpx_temporal_svc_encoder.SRCS += video_writer.h video_writer.c
+vpx_temporal_svc_encoder.SRCS += vpx_ports/msvc.h
+vpx_temporal_svc_encoder.GUID = B18C08F2-A439-4502-A78E-849BE3D60947
+vpx_temporal_svc_encoder.DESCRIPTION = Temporal SVC Encoder
+EXAMPLES-$(CONFIG_DECODERS) += simple_decoder.c
+simple_decoder.GUID = D3BBF1E9-2427-450D-BBFF-B2843C1D44CC
+simple_decoder.SRCS += ivfdec.h ivfdec.c
+simple_decoder.SRCS += tools_common.h tools_common.c
+simple_decoder.SRCS += video_common.h
+simple_decoder.SRCS += video_reader.h video_reader.c
+simple_decoder.SRCS += vpx_ports/mem_ops.h
+simple_decoder.SRCS += vpx_ports/mem_ops_aligned.h
+simple_decoder.SRCS += vpx_ports/msvc.h
+simple_decoder.DESCRIPTION = Simplified decoder loop
+EXAMPLES-$(CONFIG_DECODERS) += postproc.c
+postproc.SRCS += ivfdec.h ivfdec.c
+postproc.SRCS += tools_common.h tools_common.c
+postproc.SRCS += video_common.h
+postproc.SRCS += video_reader.h video_reader.c
+postproc.SRCS += vpx_ports/mem_ops.h
+postproc.SRCS += vpx_ports/mem_ops_aligned.h
+postproc.SRCS += vpx_ports/msvc.h
+postproc.GUID = 65E33355-F35E-4088-884D-3FD4905881D7
+postproc.DESCRIPTION = Decoder postprocessor control
+EXAMPLES-$(CONFIG_DECODERS) += decode_to_md5.c
+decode_to_md5.SRCS += md5_utils.h md5_utils.c
+decode_to_md5.SRCS += ivfdec.h ivfdec.c
+decode_to_md5.SRCS += tools_common.h tools_common.c
+decode_to_md5.SRCS += video_common.h
+decode_to_md5.SRCS += video_reader.h video_reader.c
+decode_to_md5.SRCS += vpx_ports/mem_ops.h
+decode_to_md5.SRCS += vpx_ports/mem_ops_aligned.h
+decode_to_md5.SRCS += vpx_ports/msvc.h
+decode_to_md5.GUID = 59120B9B-2735-4BFE-B022-146CA340FE42
+decode_to_md5.DESCRIPTION = Frame by frame MD5 checksum
+EXAMPLES-$(CONFIG_ENCODERS) += simple_encoder.c
+simple_encoder.SRCS += ivfenc.h ivfenc.c
+simple_encoder.SRCS += tools_common.h tools_common.c
+simple_encoder.SRCS += video_common.h
+simple_encoder.SRCS += video_writer.h video_writer.c
+simple_encoder.SRCS += vpx_ports/msvc.h
+simple_encoder.GUID = 4607D299-8A71-4D2C-9B1D-071899B6FBFD
+simple_encoder.DESCRIPTION = Simplified encoder loop
+EXAMPLES-$(CONFIG_VP9_ENCODER) += vp9_lossless_encoder.c
+vp9_lossless_encoder.SRCS += ivfenc.h ivfenc.c
+vp9_lossless_encoder.SRCS += tools_common.h tools_common.c
+vp9_lossless_encoder.SRCS += video_common.h
+vp9_lossless_encoder.SRCS += video_writer.h video_writer.c
+vp9_lossless_encoder.SRCS += vpx_ports/msvc.h
+vp9_lossless_encoder.GUID = B63C7C88-5348-46DC-A5A6-CC151EF93366
+vp9_lossless_encoder.DESCRIPTION = Simplified lossless VP9 encoder
+EXAMPLES-$(CONFIG_ENCODERS) += twopass_encoder.c
+twopass_encoder.SRCS += ivfenc.h ivfenc.c
+twopass_encoder.SRCS += tools_common.h tools_common.c
+twopass_encoder.SRCS += video_common.h
+twopass_encoder.SRCS += video_writer.h video_writer.c
+twopass_encoder.SRCS += vpx_ports/msvc.h
+twopass_encoder.GUID = 73494FA6-4AF9-4763-8FBB-265C92402FD8
+twopass_encoder.DESCRIPTION = Two-pass encoder loop
+EXAMPLES-$(CONFIG_DECODERS) += decode_with_drops.c
+decode_with_drops.SRCS += ivfdec.h ivfdec.c
+decode_with_drops.SRCS += tools_common.h tools_common.c
+decode_with_drops.SRCS += video_common.h
+decode_with_drops.SRCS += video_reader.h video_reader.c
+decode_with_drops.SRCS += vpx_ports/mem_ops.h
+decode_with_drops.SRCS += vpx_ports/mem_ops_aligned.h
+decode_with_drops.SRCS += vpx_ports/msvc.h
+decode_with_drops.GUID = CE5C53C4-8DDA-438A-86ED-0DDD3CDB8D26
+decode_with_drops.DESCRIPTION = Drops frames while decoding
+EXAMPLES-$(CONFIG_ENCODERS) += set_maps.c
+set_maps.SRCS += ivfenc.h ivfenc.c
+set_maps.SRCS += tools_common.h tools_common.c
+set_maps.SRCS += video_common.h
+set_maps.SRCS += video_writer.h video_writer.c
+set_maps.SRCS += vpx_ports/msvc.h
+set_maps.GUID = ECB2D24D-98B8-4015-A465-A4AF3DCC145F
+set_maps.DESCRIPTION = Set active and ROI maps
+EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8cx_set_ref.c
+vp8cx_set_ref.SRCS += ivfenc.h ivfenc.c
+vp8cx_set_ref.SRCS += tools_common.h tools_common.c
+vp8cx_set_ref.SRCS += video_common.h
+vp8cx_set_ref.SRCS += video_writer.h video_writer.c
+vp8cx_set_ref.SRCS += vpx_ports/msvc.h
+vp8cx_set_ref.GUID = C5E31F7F-96F6-48BD-BD3E-10EBF6E8057A
+vp8cx_set_ref.DESCRIPTION = VP8 set encoder reference frame
+
+
+ifeq ($(CONFIG_MULTI_RES_ENCODING),yes)
+ifeq ($(CONFIG_LIBYUV),yes)
+EXAMPLES-$(CONFIG_VP8_ENCODER) += vp8_multi_resolution_encoder.c
+vp8_multi_resolution_encoder.SRCS += ivfenc.h ivfenc.c
+vp8_multi_resolution_encoder.SRCS += tools_common.h tools_common.c
+vp8_multi_resolution_encoder.SRCS += video_writer.h video_writer.c
+vp8_multi_resolution_encoder.SRCS += vpx_ports/msvc.h
+vp8_multi_resolution_encoder.SRCS += $(LIBYUV_SRCS)
+vp8_multi_resolution_encoder.GUID = 04f8738e-63c8-423b-90fa-7c2703a374de
+vp8_multi_resolution_encoder.DESCRIPTION = VP8 Multiple-resolution Encoding
+endif
+endif
+
+# Handle extra library flags depending on codec configuration
+
+# We should not link to math library (libm) on RVCT
+# when building for bare-metal targets
+ifeq ($(CONFIG_OS_SUPPORT), yes)
+CODEC_EXTRA_LIBS-$(CONFIG_VP8) += m
+CODEC_EXTRA_LIBS-$(CONFIG_VP9) += m
+else
+ ifeq ($(CONFIG_GCC), yes)
+ CODEC_EXTRA_LIBS-$(CONFIG_VP8) += m
+ CODEC_EXTRA_LIBS-$(CONFIG_VP9) += m
+ endif
+endif
+#
+# End of specified files. The rest of the build rules should happen
+# automagically from here.
+#
+
+
+# Examples need different flags based on whether we're building
+# from an installed tree or a version controlled tree. Determine
+# the proper paths.
+ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
+ LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
+ INC_PATH-yes := $(SRC_PATH_BARE)/../include
+else
+ LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
+ INC_PATH-$(CONFIG_VP8_DECODER) += $(SRC_PATH_BARE)/vp8
+ INC_PATH-$(CONFIG_VP8_ENCODER) += $(SRC_PATH_BARE)/vp8
+ INC_PATH-$(CONFIG_VP9_DECODER) += $(SRC_PATH_BARE)/vp9
+ INC_PATH-$(CONFIG_VP9_ENCODER) += $(SRC_PATH_BARE)/vp9
+endif
+INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
+LIB_PATH := $(call enabled,LIB_PATH)
+INC_PATH := $(call enabled,INC_PATH)
+INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
+INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
+
+
+# Expand list of selected examples to build (as specified above)
+UTILS = $(call enabled,UTILS)
+EXAMPLES = $(addprefix examples/,$(call enabled,EXAMPLES))
+ALL_EXAMPLES = $(UTILS) $(EXAMPLES)
+UTIL_SRCS = $(foreach ex,$(UTILS),$($(ex:.c=).SRCS))
+ALL_SRCS = $(foreach ex,$(ALL_EXAMPLES),$($(notdir $(ex:.c=)).SRCS))
+CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
+
+
+# Expand all example sources into a variable containing all sources
+# for that example (not just them main one specified in UTILS/EXAMPLES)
+# and add this file to the list (for MSVS workspace generation)
+$(foreach ex,$(ALL_EXAMPLES),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) examples.mk))
+
+
+# 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)
+DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(ALL_EXAMPLES:.c=$(EXE_SFX)))
+INSTALL-BINS-$(NOT_MSVS) += $(addprefix bin/,$(UTILS:.c=$(EXE_SFX)))
+DIST-SRCS-yes += $(ALL_SRCS)
+INSTALL-SRCS-yes += $(UTIL_SRCS)
+OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
+BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(ALL_EXAMPLES:.c=$(EXE_SFX)))
+
+
+# Instantiate linker template for all examples.
+CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
+ifneq ($(filter darwin%,$(TGT_OS)),)
+SHARED_LIB_SUF=.dylib
+else
+ifneq ($(filter os2%,$(TGT_OS)),)
+SHARED_LIB_SUF=_dll.a
+else
+SHARED_LIB_SUF=.so
+endif
+endif
+CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
+$(foreach bin,$(BINS-yes),\
+ $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
+ $(eval $(call linker_template,$(bin),\
+ $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
+ -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
+ )))
+
+# The following pairs define a mapping of locations in the distribution
+# tree to locations in the source/build trees.
+INSTALL_MAPS += src/%.c %.c
+INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
+INSTALL_MAPS += bin/% %
+INSTALL_MAPS += % %
+
+
+# Set up additional MSVS environment
+ifeq ($(CONFIG_MSVS),yes)
+CODEC_LIB=$(if $(CONFIG_SHARED),vpx,$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd))
+# This variable uses deferred expansion intentionally, since the results of
+# $(wildcard) may change during the course of the Make.
+VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
+INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),bin/$(p)/% $(p)/Release/%)
+endif
+
+# Build Visual Studio Projects. We use a template here to instantiate
+# explicit rules rather than using an implicit rule because we want to
+# leverage make's VPATH searching rather than specifying the paths on
+# each file in ALL_EXAMPLES. This has the unfortunate side effect that
+# touching the source files trigger a rebuild of the project files
+# even though there is no real dependency there (the dependency is on
+# the makefiles). We may want to revisit this.
+define vcproj_template
+$(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
+ $(if $(quiet),@echo " [vcproj] $$@")
+ $(qexec)$$(GEN_VCPROJ)\
+ --exe\
+ --target=$$(TOOLCHAIN)\
+ --name=$$(@:.$(VCPROJ_SFX)=)\
+ --ver=$$(CONFIG_VS_VERSION)\
+ --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
+ --src-path-bare="$(SRC_PATH_BARE)" \
+ $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
+ --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
+ $$(INTERNAL_LDFLAGS) $$(LDFLAGS) -l$$(CODEC_LIB) $$^
+endef
+ALL_EXAMPLES_BASENAME := $(notdir $(ALL_EXAMPLES))
+PROJECTS-$(CONFIG_MSVS) += $(ALL_EXAMPLES_BASENAME:.c=.$(VCPROJ_SFX))
+INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
+ $(addprefix bin/$(p)/,$(ALL_EXAMPLES_BASENAME:.c=.exe)))
+$(foreach proj,$(call enabled,PROJECTS),\
+ $(eval $(call vcproj_template,$(proj))))
+
+#
+# Documentation Rules
+#
+%.dox: %.c
+ @echo " [DOXY] $@"
+ @mkdir -p $(dir $@)
+ @echo "/*!\page example_$(@F:.dox=) $(@F:.dox=)" > $@
+ @echo " \includelineno $(> $@
+ @echo "*/" >> $@
+
+samples.dox: examples.mk
+ @echo " [DOXY] $@"
+ @echo "/*!\page samples Sample Code" > $@
+ @echo " This SDK includes a number of sample applications."\
+ "Each sample documents a feature of the SDK in both prose"\
+ "and the associated C code."\
+ "The following samples are included: ">>$@
+ @$(foreach ex,$(sort $(notdir $(EXAMPLES:.c=))),\
+ echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
+ @echo >> $@
+ @echo " In addition, the SDK contains a number of utilities."\
+ "Since these utilities are built upon the concepts described"\
+ "in the sample code listed above, they are not documented in"\
+ "pieces like the samples are. Their source is included here"\
+ "for reference. The following utilities are included:" >> $@
+ @$(foreach ex,$(sort $(UTILS:.c=)),\
+ echo " - \subpage example_$(ex) $($(ex).DESCRIPTION)" >> $@;)
+ @echo "*/" >> $@
+
+CLEAN-OBJS += examples.doxy samples.dox $(ALL_EXAMPLES:.c=.dox)
+DOCS-yes += examples.doxy samples.dox
+examples.doxy: samples.dox $(ALL_EXAMPLES:.c=.dox)
+ @echo "INPUT += $^" > $@
diff --git a/libs/libvpx/examples/decode_to_md5.c b/libs/libvpx/examples/decode_to_md5.c
new file mode 100644
index 0000000000..1ae7a4b57f
--- /dev/null
+++ b/libs/libvpx/examples/decode_to_md5.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+// Frame-by-frame MD5 Checksum
+// ===========================
+//
+// This example builds upon the simple decoder loop to show how checksums
+// of the decoded output can be generated. These are used for validating
+// decoder implementations against the reference implementation, for example.
+//
+// MD5 algorithm
+// -------------
+// The Message-Digest 5 (MD5) is a well known hash function. We have provided
+// an implementation derived from the RSA Data Security, Inc. MD5 Message-Digest
+// Algorithm for your use. Our implmentation only changes the interface of this
+// reference code. You must include the `md5_utils.h` header for access to these
+// functions.
+//
+// Processing The Decoded Data
+// ---------------------------
+// Each row of the image is passed to the MD5 accumulator. First the Y plane
+// is processed, then U, then V. It is important to honor the image's `stride`
+// values.
+
+#include
+#include
+#include
+
+#include "vpx/vp8dx.h"
+#include "vpx/vpx_decoder.h"
+
+#include "../md5_utils.h"
+#include "../tools_common.h"
+#include "../video_reader.h"
+#include "./vpx_config.h"
+
+static void get_image_md5(const vpx_image_t *img, unsigned char digest[16]) {
+ int plane, y;
+ MD5Context md5;
+
+ MD5Init(&md5);
+
+ for (plane = 0; plane < 3; ++plane) {
+ const unsigned char *buf = img->planes[plane];
+ const int stride = img->stride[plane];
+ const int w = plane ? (img->d_w + 1) >> 1 : img->d_w;
+ const int h = plane ? (img->d_h + 1) >> 1 : img->d_h;
+
+ for (y = 0; y < h; ++y) {
+ MD5Update(&md5, buf, w);
+ buf += stride;
+ }
+ }
+
+ MD5Final(digest, &md5);
+}
+
+static void print_md5(FILE *stream, unsigned char digest[16]) {
+ int i;
+
+ for (i = 0; i < 16; ++i)
+ fprintf(stream, "%02x", digest[i]);
+}
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr, "Usage: %s \n", exec_name);
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, char **argv) {
+ int frame_cnt = 0;
+ FILE *outfile = NULL;
+ vpx_codec_ctx_t codec;
+ VpxVideoReader *reader = NULL;
+ const VpxVideoInfo *info = NULL;
+ const VpxInterface *decoder = NULL;
+
+ exec_name = argv[0];
+
+ if (argc != 3)
+ die("Invalid number of arguments.");
+
+ reader = vpx_video_reader_open(argv[1]);
+ if (!reader)
+ die("Failed to open %s for reading.", argv[1]);
+
+ if (!(outfile = fopen(argv[2], "wb")))
+ die("Failed to open %s for writing.", argv[2]);
+
+ info = vpx_video_reader_get_info(reader);
+
+ decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
+ if (!decoder)
+ die("Unknown input codec.");
+
+ printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
+
+ if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
+ die_codec(&codec, "Failed to initialize decoder");
+
+ while (vpx_video_reader_read_frame(reader)) {
+ vpx_codec_iter_t iter = NULL;
+ vpx_image_t *img = NULL;
+ size_t frame_size = 0;
+ const unsigned char *frame = vpx_video_reader_get_frame(reader,
+ &frame_size);
+ if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
+ die_codec(&codec, "Failed to decode frame");
+
+ while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
+ unsigned char digest[16];
+
+ get_image_md5(img, digest);
+ print_md5(outfile, digest);
+ fprintf(outfile, " img-%dx%d-%04d.i420\n",
+ img->d_w, img->d_h, ++frame_cnt);
+ }
+ }
+
+ printf("Processed %d frames.\n", frame_cnt);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec.");
+
+ vpx_video_reader_close(reader);
+
+ fclose(outfile);
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/decode_with_drops.c b/libs/libvpx/examples/decode_with_drops.c
new file mode 100644
index 0000000000..2233e473d3
--- /dev/null
+++ b/libs/libvpx/examples/decode_with_drops.c
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+// Decode With Drops Example
+// =========================
+//
+// This is an example utility which drops a series of frames, as specified
+// on the command line. This is useful for observing the error recovery
+// features of the codec.
+//
+// Usage
+// -----
+// This example adds a single argument to the `simple_decoder` example,
+// which specifies the range or pattern of frames to drop. The parameter is
+// parsed as follows:
+//
+// Dropping A Range Of Frames
+// --------------------------
+// To drop a range of frames, specify the starting frame and the ending
+// frame to drop, separated by a dash. The following command will drop
+// frames 5 through 10 (base 1).
+//
+// $ ./decode_with_drops in.ivf out.i420 5-10
+//
+//
+// Dropping A Pattern Of Frames
+// ----------------------------
+// To drop a pattern of frames, specify the number of frames to drop and
+// the number of frames after which to repeat the pattern, separated by
+// a forward-slash. The following command will drop 3 of 7 frames.
+// Specifically, it will decode 4 frames, then drop 3 frames, and then
+// repeat.
+//
+// $ ./decode_with_drops in.ivf out.i420 3/7
+//
+//
+// Extra Variables
+// ---------------
+// This example maintains the pattern passed on the command line in the
+// `n`, `m`, and `is_range` variables:
+//
+//
+// Making The Drop Decision
+// ------------------------
+// The example decides whether to drop the frame based on the current
+// frame number, immediately before decoding the frame.
+
+#include
+#include
+#include
+
+#include "vpx/vp8dx.h"
+#include "vpx/vpx_decoder.h"
+
+#include "../tools_common.h"
+#include "../video_reader.h"
+#include "./vpx_config.h"
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr, "Usage: %s \n", exec_name);
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, char **argv) {
+ int frame_cnt = 0;
+ FILE *outfile = NULL;
+ vpx_codec_ctx_t codec;
+ const VpxInterface *decoder = NULL;
+ VpxVideoReader *reader = NULL;
+ const VpxVideoInfo *info = NULL;
+ int n = 0;
+ int m = 0;
+ int is_range = 0;
+ char *nptr = NULL;
+
+ exec_name = argv[0];
+
+ if (argc != 4)
+ die("Invalid number of arguments.");
+
+ reader = vpx_video_reader_open(argv[1]);
+ if (!reader)
+ die("Failed to open %s for reading.", argv[1]);
+
+ if (!(outfile = fopen(argv[2], "wb")))
+ die("Failed to open %s for writing.", argv[2]);
+
+ n = strtol(argv[3], &nptr, 0);
+ m = strtol(nptr + 1, NULL, 0);
+ is_range = (*nptr == '-');
+ if (!n || !m || (*nptr != '-' && *nptr != '/'))
+ die("Couldn't parse pattern %s.\n", argv[3]);
+
+ info = vpx_video_reader_get_info(reader);
+
+ decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
+ if (!decoder)
+ die("Unknown input codec.");
+
+ printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
+
+ if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
+ die_codec(&codec, "Failed to initialize decoder.");
+
+ while (vpx_video_reader_read_frame(reader)) {
+ vpx_codec_iter_t iter = NULL;
+ vpx_image_t *img = NULL;
+ size_t frame_size = 0;
+ int skip;
+ const unsigned char *frame = vpx_video_reader_get_frame(reader,
+ &frame_size);
+ if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
+ die_codec(&codec, "Failed to decode frame.");
+
+ ++frame_cnt;
+
+ skip = (is_range && frame_cnt >= n && frame_cnt <= m) ||
+ (!is_range && m - (frame_cnt - 1) % m <= n);
+
+ if (!skip) {
+ putc('.', stdout);
+
+ while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL)
+ vpx_img_write(img, outfile);
+ } else {
+ putc('X', stdout);
+ }
+
+ fflush(stdout);
+ }
+
+ printf("Processed %d frames.\n", frame_cnt);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec.");
+
+ printf("Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
+ info->frame_width, info->frame_height, argv[2]);
+
+ vpx_video_reader_close(reader);
+ fclose(outfile);
+
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/postproc.c b/libs/libvpx/examples/postproc.c
new file mode 100644
index 0000000000..a8ac208d9b
--- /dev/null
+++ b/libs/libvpx/examples/postproc.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+// Postprocessing Decoder
+// ======================
+//
+// This example adds postprocessing to the simple decoder loop.
+//
+// Initializing Postprocessing
+// ---------------------------
+// You must inform the codec that you might request postprocessing at
+// initialization time. This is done by passing the VPX_CODEC_USE_POSTPROC
+// flag to `vpx_codec_dec_init`. If the codec does not support
+// postprocessing, this call will return VPX_CODEC_INCAPABLE. For
+// demonstration purposes, we also fall back to default initialization if
+// the codec does not provide support.
+//
+// Using Adaptive Postprocessing
+// -----------------------------
+// VP6 provides "adaptive postprocessing." It will automatically select the
+// best postprocessing filter on a frame by frame basis based on the amount
+// of time remaining before the user's specified deadline expires. The
+// special value 0 indicates that the codec should take as long as
+// necessary to provide the best quality frame. This example gives the
+// codec 15ms (15000us) to return a frame. Remember that this is a soft
+// deadline, and the codec may exceed it doing its regular processing. In
+// these cases, no additional postprocessing will be done.
+//
+// Codec Specific Postprocessing Controls
+// --------------------------------------
+// Some codecs provide fine grained controls over their built-in
+// postprocessors. VP8 is one example. The following sample code toggles
+// postprocessing on and off every 15 frames.
+
+#include
+#include
+#include
+
+#include "vpx/vp8dx.h"
+#include "vpx/vpx_decoder.h"
+
+#include "../tools_common.h"
+#include "../video_reader.h"
+#include "./vpx_config.h"
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr, "Usage: %s \n", exec_name);
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, char **argv) {
+ int frame_cnt = 0;
+ FILE *outfile = NULL;
+ vpx_codec_ctx_t codec;
+ vpx_codec_err_t res;
+ VpxVideoReader *reader = NULL;
+ const VpxInterface *decoder = NULL;
+ const VpxVideoInfo *info = NULL;
+
+ exec_name = argv[0];
+
+ if (argc != 3)
+ die("Invalid number of arguments.");
+
+ reader = vpx_video_reader_open(argv[1]);
+ if (!reader)
+ die("Failed to open %s for reading.", argv[1]);
+
+ if (!(outfile = fopen(argv[2], "wb")))
+ die("Failed to open %s for writing", argv[2]);
+
+ info = vpx_video_reader_get_info(reader);
+
+ decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
+ if (!decoder)
+ die("Unknown input codec.");
+
+ printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
+
+ res = vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL,
+ VPX_CODEC_USE_POSTPROC);
+ if (res == VPX_CODEC_INCAPABLE)
+ die_codec(&codec, "Postproc not supported by this decoder.");
+
+ if (res)
+ die_codec(&codec, "Failed to initialize decoder.");
+
+ while (vpx_video_reader_read_frame(reader)) {
+ vpx_codec_iter_t iter = NULL;
+ vpx_image_t *img = NULL;
+ size_t frame_size = 0;
+ const unsigned char *frame = vpx_video_reader_get_frame(reader,
+ &frame_size);
+
+ ++frame_cnt;
+
+ if (frame_cnt % 30 == 1) {
+ vp8_postproc_cfg_t pp = {0, 0, 0};
+
+ if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp))
+ die_codec(&codec, "Failed to turn off postproc.");
+ } else if (frame_cnt % 30 == 16) {
+ vp8_postproc_cfg_t pp = {VP8_DEBLOCK | VP8_DEMACROBLOCK | VP8_MFQE,
+ 4, 0};
+ if (vpx_codec_control(&codec, VP8_SET_POSTPROC, &pp))
+ die_codec(&codec, "Failed to turn on postproc.");
+ };
+
+ // Decode the frame with 15ms deadline
+ if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 15000))
+ die_codec(&codec, "Failed to decode frame");
+
+ while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
+ vpx_img_write(img, outfile);
+ }
+ }
+
+ printf("Processed %d frames.\n", frame_cnt);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec");
+
+ printf("Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
+ info->frame_width, info->frame_height, argv[2]);
+
+ vpx_video_reader_close(reader);
+
+ fclose(outfile);
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/resize_util.c b/libs/libvpx/examples/resize_util.c
new file mode 100644
index 0000000000..e6fdd5bb2a
--- /dev/null
+++ b/libs/libvpx/examples/resize_util.c
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014 The WebM 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
+#include
+#include
+#include
+#include
+#include
+
+#include "../tools_common.h"
+#include "../vp9/encoder/vp9_resize.h"
+
+static const char *exec_name = NULL;
+
+static void usage() {
+ printf("Usage:\n");
+ printf("%s x x ",
+ exec_name);
+ printf(" []\n");
+}
+
+void usage_exit(void) {
+ usage();
+ exit(EXIT_FAILURE);
+}
+
+static int parse_dim(char *v, int *width, int *height) {
+ char *x = strchr(v, 'x');
+ if (x == NULL)
+ x = strchr(v, 'X');
+ if (x == NULL)
+ return 0;
+ *width = atoi(v);
+ *height = atoi(&x[1]);
+ if (*width <= 0 || *height <= 0)
+ return 0;
+ else
+ return 1;
+}
+
+int main(int argc, char *argv[]) {
+ char *fin, *fout;
+ FILE *fpin, *fpout;
+ uint8_t *inbuf, *outbuf;
+ uint8_t *inbuf_u, *outbuf_u;
+ uint8_t *inbuf_v, *outbuf_v;
+ int f, frames;
+ int width, height, target_width, target_height;
+
+ exec_name = argv[0];
+
+ if (argc < 5) {
+ printf("Incorrect parameters:\n");
+ usage();
+ return 1;
+ }
+
+ fin = argv[1];
+ fout = argv[4];
+ if (!parse_dim(argv[2], &width, &height)) {
+ printf("Incorrect parameters: %s\n", argv[2]);
+ usage();
+ return 1;
+ }
+ if (!parse_dim(argv[3], &target_width, &target_height)) {
+ printf("Incorrect parameters: %s\n", argv[3]);
+ usage();
+ return 1;
+ }
+
+ fpin = fopen(fin, "rb");
+ if (fpin == NULL) {
+ printf("Can't open file %s to read\n", fin);
+ usage();
+ return 1;
+ }
+ fpout = fopen(fout, "wb");
+ if (fpout == NULL) {
+ printf("Can't open file %s to write\n", fout);
+ usage();
+ return 1;
+ }
+ if (argc >= 6)
+ frames = atoi(argv[5]);
+ else
+ frames = INT_MAX;
+
+ printf("Input size: %dx%d\n",
+ width, height);
+ printf("Target size: %dx%d, Frames: ",
+ target_width, target_height);
+ if (frames == INT_MAX)
+ printf("All\n");
+ else
+ printf("%d\n", frames);
+
+ inbuf = (uint8_t*)malloc(width * height * 3 / 2);
+ outbuf = (uint8_t*)malloc(target_width * target_height * 3 / 2);
+ inbuf_u = inbuf + width * height;
+ inbuf_v = inbuf_u + width * height / 4;
+ outbuf_u = outbuf + target_width * target_height;
+ outbuf_v = outbuf_u + target_width * target_height / 4;
+ f = 0;
+ while (f < frames) {
+ if (fread(inbuf, width * height * 3 / 2, 1, fpin) != 1)
+ break;
+ vp9_resize_frame420(inbuf, width, inbuf_u, inbuf_v, width / 2,
+ height, width,
+ outbuf, target_width, outbuf_u, outbuf_v,
+ target_width / 2,
+ target_height, target_width);
+ fwrite(outbuf, target_width * target_height * 3 / 2, 1, fpout);
+ f++;
+ }
+ printf("%d frames processed\n", f);
+ fclose(fpin);
+ fclose(fpout);
+
+ free(inbuf);
+ free(outbuf);
+ return 0;
+}
diff --git a/libs/libvpx/examples/set_maps.c b/libs/libvpx/examples/set_maps.c
new file mode 100644
index 0000000000..1dc3ac0c98
--- /dev/null
+++ b/libs/libvpx/examples/set_maps.c
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+
+// VP8 Set Active and ROI Maps
+// ===========================
+//
+// This is an example demonstrating how to control the VP8 encoder's
+// ROI and Active maps.
+//
+// ROI (Reigon of Interest) maps are a way for the application to assign
+// each macroblock in the image to a region, and then set quantizer and
+// filtering parameters on that image.
+//
+// Active maps are a way for the application to specify on a
+// macroblock-by-macroblock basis whether there is any activity in that
+// macroblock.
+//
+//
+// Configuration
+// -------------
+// An ROI map is set on frame 22. If the width of the image in macroblocks
+// is evenly divisble by 4, then the output will appear to have distinct
+// columns, where the quantizer, loopfilter, and static threshold differ
+// from column to column.
+//
+// An active map is set on frame 33. If the width of the image in macroblocks
+// is evenly divisble by 4, then the output will appear to have distinct
+// columns, where one column will have motion and the next will not.
+//
+// The active map is cleared on frame 44.
+//
+// Observing The Effects
+// ---------------------
+// Use the `simple_decoder` example to decode this sample, and observe
+// the change in the image at frames 22, 33, and 44.
+
+#include
+#include
+#include
+#include
+
+#include "vpx/vp8cx.h"
+#include "vpx/vpx_encoder.h"
+
+#include "../tools_common.h"
+#include "../video_writer.h"
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr, "Usage: %s \n",
+ exec_name);
+ exit(EXIT_FAILURE);
+}
+
+static void set_roi_map(const vpx_codec_enc_cfg_t *cfg,
+ vpx_codec_ctx_t *codec) {
+ unsigned int i;
+ vpx_roi_map_t roi;
+ memset(&roi, 0, sizeof(roi));
+
+ roi.rows = (cfg->g_h + 15) / 16;
+ roi.cols = (cfg->g_w + 15) / 16;
+
+ roi.delta_q[0] = 0;
+ roi.delta_q[1] = -2;
+ roi.delta_q[2] = -4;
+ roi.delta_q[3] = -6;
+
+ roi.delta_lf[0] = 0;
+ roi.delta_lf[1] = 1;
+ roi.delta_lf[2] = 2;
+ roi.delta_lf[3] = 3;
+
+ roi.static_threshold[0] = 1500;
+ roi.static_threshold[1] = 1000;
+ roi.static_threshold[2] = 500;
+ roi.static_threshold[3] = 0;
+
+ roi.roi_map = (uint8_t *)malloc(roi.rows * roi.cols);
+ for (i = 0; i < roi.rows * roi.cols; ++i)
+ roi.roi_map[i] = i % 4;
+
+ if (vpx_codec_control(codec, VP8E_SET_ROI_MAP, &roi))
+ die_codec(codec, "Failed to set ROI map");
+
+ free(roi.roi_map);
+}
+
+static void set_active_map(const vpx_codec_enc_cfg_t *cfg,
+ vpx_codec_ctx_t *codec) {
+ unsigned int i;
+ vpx_active_map_t map = {0, 0, 0};
+
+ map.rows = (cfg->g_h + 15) / 16;
+ map.cols = (cfg->g_w + 15) / 16;
+
+ map.active_map = (uint8_t *)malloc(map.rows * map.cols);
+ for (i = 0; i < map.rows * map.cols; ++i)
+ map.active_map[i] = i % 2;
+
+ if (vpx_codec_control(codec, VP8E_SET_ACTIVEMAP, &map))
+ die_codec(codec, "Failed to set active map");
+
+ free(map.active_map);
+}
+
+static void unset_active_map(const vpx_codec_enc_cfg_t *cfg,
+ vpx_codec_ctx_t *codec) {
+ vpx_active_map_t map = {0, 0, 0};
+
+ map.rows = (cfg->g_h + 15) / 16;
+ map.cols = (cfg->g_w + 15) / 16;
+ map.active_map = NULL;
+
+ if (vpx_codec_control(codec, VP8E_SET_ACTIVEMAP, &map))
+ die_codec(codec, "Failed to set active map");
+}
+
+static int encode_frame(vpx_codec_ctx_t *codec,
+ vpx_image_t *img,
+ int frame_index,
+ VpxVideoWriter *writer) {
+ int got_pkts = 0;
+ vpx_codec_iter_t iter = NULL;
+ const vpx_codec_cx_pkt_t *pkt = NULL;
+ const vpx_codec_err_t res = vpx_codec_encode(codec, img, frame_index, 1, 0,
+ VPX_DL_GOOD_QUALITY);
+ if (res != VPX_CODEC_OK)
+ die_codec(codec, "Failed to encode frame");
+
+ while ((pkt = vpx_codec_get_cx_data(codec, &iter)) != NULL) {
+ got_pkts = 1;
+
+ if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
+ const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
+ if (!vpx_video_writer_write_frame(writer,
+ pkt->data.frame.buf,
+ pkt->data.frame.sz,
+ pkt->data.frame.pts)) {
+ die_codec(codec, "Failed to write compressed frame");
+ }
+
+ printf(keyframe ? "K" : ".");
+ fflush(stdout);
+ }
+ }
+
+ return got_pkts;
+}
+
+int main(int argc, char **argv) {
+ FILE *infile = NULL;
+ vpx_codec_ctx_t codec;
+ vpx_codec_enc_cfg_t cfg;
+ int frame_count = 0;
+ vpx_image_t raw;
+ vpx_codec_err_t res;
+ VpxVideoInfo info;
+ VpxVideoWriter *writer = NULL;
+ const VpxInterface *encoder = NULL;
+ const int fps = 2; // TODO(dkovalev) add command line argument
+ const double bits_per_pixel_per_frame = 0.067;
+
+ exec_name = argv[0];
+ if (argc != 6)
+ die("Invalid number of arguments");
+
+ memset(&info, 0, sizeof(info));
+
+ encoder = get_vpx_encoder_by_name(argv[1]);
+ if (encoder == NULL) {
+ die("Unsupported codec.");
+ }
+ assert(encoder != NULL);
+ info.codec_fourcc = encoder->fourcc;
+ info.frame_width = strtol(argv[2], NULL, 0);
+ info.frame_height = strtol(argv[3], NULL, 0);
+ info.time_base.numerator = 1;
+ info.time_base.denominator = fps;
+
+ if (info.frame_width <= 0 ||
+ info.frame_height <= 0 ||
+ (info.frame_width % 2) != 0 ||
+ (info.frame_height % 2) != 0) {
+ die("Invalid frame size: %dx%d", info.frame_width, info.frame_height);
+ }
+
+ if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, info.frame_width,
+ info.frame_height, 1)) {
+ die("Failed to allocate image.");
+ }
+
+ printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
+
+ res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
+ if (res)
+ die_codec(&codec, "Failed to get default codec config.");
+
+ cfg.g_w = info.frame_width;
+ cfg.g_h = info.frame_height;
+ cfg.g_timebase.num = info.time_base.numerator;
+ cfg.g_timebase.den = info.time_base.denominator;
+ cfg.rc_target_bitrate = (unsigned int)(bits_per_pixel_per_frame * cfg.g_w *
+ cfg.g_h * fps / 1000);
+ cfg.g_lag_in_frames = 0;
+
+ writer = vpx_video_writer_open(argv[5], kContainerIVF, &info);
+ if (!writer)
+ die("Failed to open %s for writing.", argv[5]);
+
+ if (!(infile = fopen(argv[4], "rb")))
+ die("Failed to open %s for reading.", argv[4]);
+
+ if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
+ die_codec(&codec, "Failed to initialize encoder");
+
+ // Encode frames.
+ while (vpx_img_read(&raw, infile)) {
+ ++frame_count;
+
+ if (frame_count == 22 && encoder->fourcc == VP8_FOURCC) {
+ set_roi_map(&cfg, &codec);
+ } else if (frame_count == 33) {
+ set_active_map(&cfg, &codec);
+ } else if (frame_count == 44) {
+ unset_active_map(&cfg, &codec);
+ }
+
+ encode_frame(&codec, &raw, frame_count, writer);
+ }
+
+ // Flush encoder.
+ while (encode_frame(&codec, NULL, -1, writer)) {}
+
+ printf("\n");
+ fclose(infile);
+ printf("Processed %d frames.\n", frame_count);
+
+ vpx_img_free(&raw);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec.");
+
+ vpx_video_writer_close(writer);
+
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/simple_decoder.c b/libs/libvpx/examples/simple_decoder.c
new file mode 100644
index 0000000000..8ccc81035e
--- /dev/null
+++ b/libs/libvpx/examples/simple_decoder.c
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+
+// Simple Decoder
+// ==============
+//
+// This is an example of a simple decoder loop. It takes an input file
+// containing the compressed data (in IVF format), passes it through the
+// decoder, and writes the decompressed frames to disk. Other decoder
+// examples build upon this one.
+//
+// The details of the IVF format have been elided from this example for
+// simplicity of presentation, as IVF files will not generally be used by
+// your application. In general, an IVF file consists of a file header,
+// followed by a variable number of frames. Each frame consists of a frame
+// header followed by a variable length payload. The length of the payload
+// is specified in the first four bytes of the frame header. The payload is
+// the raw compressed data.
+//
+// Standard Includes
+// -----------------
+// For decoders, you only have to include `vpx_decoder.h` and then any
+// header files for the specific codecs you use. In this case, we're using
+// vp8.
+//
+// Initializing The Codec
+// ----------------------
+// The libvpx decoder is initialized by the call to vpx_codec_dec_init().
+// Determining the codec interface to use is handled by VpxVideoReader and the
+// functions prefixed with vpx_video_reader_. Discussion of those functions is
+// beyond the scope of this example, but the main gist is to open the input file
+// and parse just enough of it to determine if it's a VPx file and which VPx
+// codec is contained within the file.
+// Note the NULL pointer passed to vpx_codec_dec_init(). We do that in this
+// example because we want the algorithm to determine the stream configuration
+// (width/height) and allocate memory automatically.
+//
+// Decoding A Frame
+// ----------------
+// Once the frame has been read into memory, it is decoded using the
+// `vpx_codec_decode` function. The call takes a pointer to the data
+// (`frame`) and the length of the data (`frame_size`). No application data
+// is associated with the frame in this example, so the `user_priv`
+// parameter is NULL. The `deadline` parameter is left at zero for this
+// example. This parameter is generally only used when doing adaptive post
+// processing.
+//
+// Codecs may produce a variable number of output frames for every call to
+// `vpx_codec_decode`. These frames are retrieved by the
+// `vpx_codec_get_frame` iterator function. The iterator variable `iter` is
+// initialized to NULL each time `vpx_codec_decode` is called.
+// `vpx_codec_get_frame` is called in a loop, returning a pointer to a
+// decoded image or NULL to indicate the end of list.
+//
+// Processing The Decoded Data
+// ---------------------------
+// In this example, we simply write the encoded data to disk. It is
+// important to honor the image's `stride` values.
+//
+// Cleanup
+// -------
+// The `vpx_codec_destroy` call frees any memory allocated by the codec.
+//
+// Error Handling
+// --------------
+// This example does not special case any error return codes. If there was
+// an error, a descriptive message is printed and the program exits. With
+// few exceptions, vpx_codec functions return an enumerated error status,
+// with the value `0` indicating success.
+
+#include
+#include
+#include
+
+#include "vpx/vpx_decoder.h"
+
+#include "../tools_common.h"
+#include "../video_reader.h"
+#include "./vpx_config.h"
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr, "Usage: %s \n", exec_name);
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, char **argv) {
+ int frame_cnt = 0;
+ FILE *outfile = NULL;
+ vpx_codec_ctx_t codec;
+ VpxVideoReader *reader = NULL;
+ const VpxInterface *decoder = NULL;
+ const VpxVideoInfo *info = NULL;
+
+ exec_name = argv[0];
+
+ if (argc != 3)
+ die("Invalid number of arguments.");
+
+ reader = vpx_video_reader_open(argv[1]);
+ if (!reader)
+ die("Failed to open %s for reading.", argv[1]);
+
+ if (!(outfile = fopen(argv[2], "wb")))
+ die("Failed to open %s for writing.", argv[2]);
+
+ info = vpx_video_reader_get_info(reader);
+
+ decoder = get_vpx_decoder_by_fourcc(info->codec_fourcc);
+ if (!decoder)
+ die("Unknown input codec.");
+
+ printf("Using %s\n", vpx_codec_iface_name(decoder->codec_interface()));
+
+ if (vpx_codec_dec_init(&codec, decoder->codec_interface(), NULL, 0))
+ die_codec(&codec, "Failed to initialize decoder.");
+
+ while (vpx_video_reader_read_frame(reader)) {
+ vpx_codec_iter_t iter = NULL;
+ vpx_image_t *img = NULL;
+ size_t frame_size = 0;
+ const unsigned char *frame = vpx_video_reader_get_frame(reader,
+ &frame_size);
+ if (vpx_codec_decode(&codec, frame, (unsigned int)frame_size, NULL, 0))
+ die_codec(&codec, "Failed to decode frame.");
+
+ while ((img = vpx_codec_get_frame(&codec, &iter)) != NULL) {
+ vpx_img_write(img, outfile);
+ ++frame_cnt;
+ }
+ }
+
+ printf("Processed %d frames.\n", frame_cnt);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec");
+
+ printf("Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n",
+ info->frame_width, info->frame_height, argv[2]);
+
+ vpx_video_reader_close(reader);
+
+ fclose(outfile);
+
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/simple_encoder.c b/libs/libvpx/examples/simple_encoder.c
new file mode 100644
index 0000000000..a307729731
--- /dev/null
+++ b/libs/libvpx/examples/simple_encoder.c
@@ -0,0 +1,256 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+// Simple Encoder
+// ==============
+//
+// This is an example of a simple encoder loop. It takes an input file in
+// YV12 format, passes it through the encoder, and writes the compressed
+// frames to disk in IVF format. Other decoder examples build upon this
+// one.
+//
+// The details of the IVF format have been elided from this example for
+// simplicity of presentation, as IVF files will not generally be used by
+// your application. In general, an IVF file consists of a file header,
+// followed by a variable number of frames. Each frame consists of a frame
+// header followed by a variable length payload. The length of the payload
+// is specified in the first four bytes of the frame header. The payload is
+// the raw compressed data.
+//
+// Standard Includes
+// -----------------
+// For encoders, you only have to include `vpx_encoder.h` and then any
+// header files for the specific codecs you use. In this case, we're using
+// vp8.
+//
+// Getting The Default Configuration
+// ---------------------------------
+// Encoders have the notion of "usage profiles." For example, an encoder
+// may want to publish default configurations for both a video
+// conferencing application and a best quality offline encoder. These
+// obviously have very different default settings. Consult the
+// documentation for your codec to see if it provides any default
+// configurations. All codecs provide a default configuration, number 0,
+// which is valid for material in the vacinity of QCIF/QVGA.
+//
+// Updating The Configuration
+// ---------------------------------
+// Almost all applications will want to update the default configuration
+// with settings specific to their usage. Here we set the width and height
+// of the video file to that specified on the command line. We also scale
+// the default bitrate based on the ratio between the default resolution
+// and the resolution specified on the command line.
+//
+// Initializing The Codec
+// ----------------------
+// The encoder is initialized by the following code.
+//
+// Encoding A Frame
+// ----------------
+// The frame is read as a continuous block (size width * height * 3 / 2)
+// from the input file. If a frame was read (the input file has not hit
+// EOF) then the frame is passed to the encoder. Otherwise, a NULL
+// is passed, indicating the End-Of-Stream condition to the encoder. The
+// `frame_cnt` is reused as the presentation time stamp (PTS) and each
+// frame is shown for one frame-time in duration. The flags parameter is
+// unused in this example. The deadline is set to VPX_DL_REALTIME to
+// make the example run as quickly as possible.
+
+// Forced Keyframes
+// ----------------
+// Keyframes can be forced by setting the VPX_EFLAG_FORCE_KF bit of the
+// flags passed to `vpx_codec_control()`. In this example, we force a
+// keyframe every frames. Note, the output stream can
+// contain additional keyframes beyond those that have been forced using the
+// VPX_EFLAG_FORCE_KF flag because of automatic keyframe placement by the
+// encoder.
+//
+// Processing The Encoded Data
+// ---------------------------
+// Each packet of type `VPX_CODEC_CX_FRAME_PKT` contains the encoded data
+// for this frame. We write a IVF frame header, followed by the raw data.
+//
+// Cleanup
+// -------
+// The `vpx_codec_destroy` call frees any memory allocated by the codec.
+//
+// Error Handling
+// --------------
+// This example does not special case any error return codes. If there was
+// an error, a descriptive message is printed and the program exits. With
+// few exeptions, vpx_codec functions return an enumerated error status,
+// with the value `0` indicating success.
+//
+// Error Resiliency Features
+// -------------------------
+// Error resiliency is controlled by the g_error_resilient member of the
+// configuration structure. Use the `decode_with_drops` example to decode with
+// frames 5-10 dropped. Compare the output for a file encoded with this example
+// versus one encoded with the `simple_encoder` example.
+
+#include
+#include
+#include
+
+#include "vpx/vpx_encoder.h"
+
+#include "../tools_common.h"
+#include "../video_writer.h"
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr,
+ "Usage: %s "
+ " []\nSee comments in "
+ "simple_encoder.c for more information.\n",
+ exec_name);
+ exit(EXIT_FAILURE);
+}
+
+static int encode_frame(vpx_codec_ctx_t *codec,
+ vpx_image_t *img,
+ int frame_index,
+ int flags,
+ VpxVideoWriter *writer) {
+ int got_pkts = 0;
+ vpx_codec_iter_t iter = NULL;
+ const vpx_codec_cx_pkt_t *pkt = NULL;
+ const vpx_codec_err_t res = vpx_codec_encode(codec, img, frame_index, 1,
+ flags, VPX_DL_GOOD_QUALITY);
+ if (res != VPX_CODEC_OK)
+ die_codec(codec, "Failed to encode frame");
+
+ while ((pkt = vpx_codec_get_cx_data(codec, &iter)) != NULL) {
+ got_pkts = 1;
+
+ if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
+ const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
+ if (!vpx_video_writer_write_frame(writer,
+ pkt->data.frame.buf,
+ pkt->data.frame.sz,
+ pkt->data.frame.pts)) {
+ die_codec(codec, "Failed to write compressed frame");
+ }
+ printf(keyframe ? "K" : ".");
+ fflush(stdout);
+ }
+ }
+
+ return got_pkts;
+}
+
+int main(int argc, char **argv) {
+ FILE *infile = NULL;
+ vpx_codec_ctx_t codec;
+ vpx_codec_enc_cfg_t cfg;
+ int frame_count = 0;
+ vpx_image_t raw;
+ vpx_codec_err_t res;
+ VpxVideoInfo info = {0};
+ VpxVideoWriter *writer = NULL;
+ const VpxInterface *encoder = NULL;
+ const int fps = 30; // TODO(dkovalev) add command line argument
+ const int bitrate = 200; // kbit/s TODO(dkovalev) add command line argument
+ int keyframe_interval = 0;
+
+ // TODO(dkovalev): Add some simple command line parsing code to make the
+ // command line more flexible.
+ const char *codec_arg = NULL;
+ const char *width_arg = NULL;
+ const char *height_arg = NULL;
+ const char *infile_arg = NULL;
+ const char *outfile_arg = NULL;
+ const char *keyframe_interval_arg = NULL;
+
+ exec_name = argv[0];
+
+ if (argc < 7)
+ die("Invalid number of arguments");
+
+ codec_arg = argv[1];
+ width_arg = argv[2];
+ height_arg = argv[3];
+ infile_arg = argv[4];
+ outfile_arg = argv[5];
+ keyframe_interval_arg = argv[6];
+
+ encoder = get_vpx_encoder_by_name(codec_arg);
+ if (!encoder)
+ die("Unsupported codec.");
+
+ info.codec_fourcc = encoder->fourcc;
+ info.frame_width = strtol(width_arg, NULL, 0);
+ info.frame_height = strtol(height_arg, NULL, 0);
+ info.time_base.numerator = 1;
+ info.time_base.denominator = fps;
+
+ if (info.frame_width <= 0 ||
+ info.frame_height <= 0 ||
+ (info.frame_width % 2) != 0 ||
+ (info.frame_height % 2) != 0) {
+ die("Invalid frame size: %dx%d", info.frame_width, info.frame_height);
+ }
+
+ if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, info.frame_width,
+ info.frame_height, 1)) {
+ die("Failed to allocate image.");
+ }
+
+ keyframe_interval = strtol(keyframe_interval_arg, NULL, 0);
+ if (keyframe_interval < 0)
+ die("Invalid keyframe interval value.");
+
+ printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
+
+ res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
+ if (res)
+ die_codec(&codec, "Failed to get default codec config.");
+
+ cfg.g_w = info.frame_width;
+ cfg.g_h = info.frame_height;
+ cfg.g_timebase.num = info.time_base.numerator;
+ cfg.g_timebase.den = info.time_base.denominator;
+ cfg.rc_target_bitrate = bitrate;
+ cfg.g_error_resilient = argc > 7 ? strtol(argv[7], NULL, 0) : 0;
+
+ writer = vpx_video_writer_open(outfile_arg, kContainerIVF, &info);
+ if (!writer)
+ die("Failed to open %s for writing.", outfile_arg);
+
+ if (!(infile = fopen(infile_arg, "rb")))
+ die("Failed to open %s for reading.", infile_arg);
+
+ if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
+ die_codec(&codec, "Failed to initialize encoder");
+
+ // Encode frames.
+ while (vpx_img_read(&raw, infile)) {
+ int flags = 0;
+ if (keyframe_interval > 0 && frame_count % keyframe_interval == 0)
+ flags |= VPX_EFLAG_FORCE_KF;
+ encode_frame(&codec, &raw, frame_count++, flags, writer);
+ }
+
+ // Flush encoder.
+ while (encode_frame(&codec, NULL, -1, 0, writer)) {};
+
+ printf("\n");
+ fclose(infile);
+ printf("Processed %d frames.\n", frame_count);
+
+ vpx_img_free(&raw);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec.");
+
+ vpx_video_writer_close(writer);
+
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/twopass_encoder.c b/libs/libvpx/examples/twopass_encoder.c
new file mode 100644
index 0000000000..aecc11d3f4
--- /dev/null
+++ b/libs/libvpx/examples/twopass_encoder.c
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 2010 The WebM 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.
+ */
+
+// Two Pass Encoder
+// ================
+//
+// This is an example of a two pass encoder loop. It takes an input file in
+// YV12 format, passes it through the encoder twice, and writes the compressed
+// frames to disk in IVF format. It builds upon the simple_encoder example.
+//
+// Twopass Variables
+// -----------------
+// Twopass mode needs to track the current pass number and the buffer of
+// statistics packets.
+//
+// Updating The Configuration
+// ---------------------------------
+// In two pass mode, the configuration has to be updated on each pass. The
+// statistics buffer is passed on the last pass.
+//
+// Encoding A Frame
+// ----------------
+// Encoding a frame in two pass mode is identical to the simple encoder
+// example. To increase the quality while sacrificing encoding speed,
+// VPX_DL_BEST_QUALITY can be used in place of VPX_DL_GOOD_QUALITY.
+//
+// Processing Statistics Packets
+// -----------------------------
+// Each packet of type `VPX_CODEC_CX_FRAME_PKT` contains the encoded data
+// for this frame. We write a IVF frame header, followed by the raw data.
+//
+//
+// Pass Progress Reporting
+// -----------------------------
+// It's sometimes helpful to see when each pass completes.
+//
+//
+// Clean-up
+// -----------------------------
+// Destruction of the encoder instance must be done on each pass. The
+// raw image should be destroyed at the end as usual.
+
+#include
+#include
+#include
+
+#include "vpx/vpx_encoder.h"
+
+#include "../tools_common.h"
+#include "../video_writer.h"
+
+static const char *exec_name;
+
+void usage_exit(void) {
+ fprintf(stderr, "Usage: %s \n",
+ exec_name);
+ exit(EXIT_FAILURE);
+}
+
+static int get_frame_stats(vpx_codec_ctx_t *ctx,
+ const vpx_image_t *img,
+ vpx_codec_pts_t pts,
+ unsigned int duration,
+ vpx_enc_frame_flags_t flags,
+ unsigned int deadline,
+ vpx_fixed_buf_t *stats) {
+ int got_pkts = 0;
+ vpx_codec_iter_t iter = NULL;
+ const vpx_codec_cx_pkt_t *pkt = NULL;
+ const vpx_codec_err_t res = vpx_codec_encode(ctx, img, pts, duration, flags,
+ deadline);
+ if (res != VPX_CODEC_OK)
+ die_codec(ctx, "Failed to get frame stats.");
+
+ while ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL) {
+ got_pkts = 1;
+
+ if (pkt->kind == VPX_CODEC_STATS_PKT) {
+ const uint8_t *const pkt_buf = pkt->data.twopass_stats.buf;
+ const size_t pkt_size = pkt->data.twopass_stats.sz;
+ stats->buf = realloc(stats->buf, stats->sz + pkt_size);
+ memcpy((uint8_t *)stats->buf + stats->sz, pkt_buf, pkt_size);
+ stats->sz += pkt_size;
+ }
+ }
+
+ return got_pkts;
+}
+
+static int encode_frame(vpx_codec_ctx_t *ctx,
+ const vpx_image_t *img,
+ vpx_codec_pts_t pts,
+ unsigned int duration,
+ vpx_enc_frame_flags_t flags,
+ unsigned int deadline,
+ VpxVideoWriter *writer) {
+ int got_pkts = 0;
+ vpx_codec_iter_t iter = NULL;
+ const vpx_codec_cx_pkt_t *pkt = NULL;
+ const vpx_codec_err_t res = vpx_codec_encode(ctx, img, pts, duration, flags,
+ deadline);
+ if (res != VPX_CODEC_OK)
+ die_codec(ctx, "Failed to encode frame.");
+
+ while ((pkt = vpx_codec_get_cx_data(ctx, &iter)) != NULL) {
+ got_pkts = 1;
+ if (pkt->kind == VPX_CODEC_CX_FRAME_PKT) {
+ const int keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
+
+ if (!vpx_video_writer_write_frame(writer, pkt->data.frame.buf,
+ pkt->data.frame.sz,
+ pkt->data.frame.pts))
+ die_codec(ctx, "Failed to write compressed frame.");
+ printf(keyframe ? "K" : ".");
+ fflush(stdout);
+ }
+ }
+
+ return got_pkts;
+}
+
+static vpx_fixed_buf_t pass0(vpx_image_t *raw,
+ FILE *infile,
+ const VpxInterface *encoder,
+ const vpx_codec_enc_cfg_t *cfg) {
+ vpx_codec_ctx_t codec;
+ int frame_count = 0;
+ vpx_fixed_buf_t stats = {NULL, 0};
+
+ if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
+ die_codec(&codec, "Failed to initialize encoder");
+
+ // Calculate frame statistics.
+ while (vpx_img_read(raw, infile)) {
+ ++frame_count;
+ get_frame_stats(&codec, raw, frame_count, 1, 0, VPX_DL_GOOD_QUALITY,
+ &stats);
+ }
+
+ // Flush encoder.
+ while (get_frame_stats(&codec, NULL, frame_count, 1, 0,
+ VPX_DL_GOOD_QUALITY, &stats)) {}
+
+ printf("Pass 0 complete. Processed %d frames.\n", frame_count);
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec.");
+
+ return stats;
+}
+
+static void pass1(vpx_image_t *raw,
+ FILE *infile,
+ const char *outfile_name,
+ const VpxInterface *encoder,
+ const vpx_codec_enc_cfg_t *cfg) {
+ VpxVideoInfo info = {
+ encoder->fourcc,
+ cfg->g_w,
+ cfg->g_h,
+ {cfg->g_timebase.num, cfg->g_timebase.den}
+ };
+ VpxVideoWriter *writer = NULL;
+ vpx_codec_ctx_t codec;
+ int frame_count = 0;
+
+ writer = vpx_video_writer_open(outfile_name, kContainerIVF, &info);
+ if (!writer)
+ die("Failed to open %s for writing", outfile_name);
+
+ if (vpx_codec_enc_init(&codec, encoder->codec_interface(), cfg, 0))
+ die_codec(&codec, "Failed to initialize encoder");
+
+ // Encode frames.
+ while (vpx_img_read(raw, infile)) {
+ ++frame_count;
+ encode_frame(&codec, raw, frame_count, 1, 0, VPX_DL_GOOD_QUALITY, writer);
+ }
+
+ // Flush encoder.
+ while (encode_frame(&codec, NULL, -1, 1, 0, VPX_DL_GOOD_QUALITY, writer)) {}
+
+ printf("\n");
+
+ if (vpx_codec_destroy(&codec))
+ die_codec(&codec, "Failed to destroy codec.");
+
+ vpx_video_writer_close(writer);
+
+ printf("Pass 1 complete. Processed %d frames.\n", frame_count);
+}
+
+int main(int argc, char **argv) {
+ FILE *infile = NULL;
+ int w, h;
+ vpx_codec_ctx_t codec;
+ vpx_codec_enc_cfg_t cfg;
+ vpx_image_t raw;
+ vpx_codec_err_t res;
+ vpx_fixed_buf_t stats;
+
+ const VpxInterface *encoder = NULL;
+ const int fps = 30; // TODO(dkovalev) add command line argument
+ const int bitrate = 200; // kbit/s TODO(dkovalev) add command line argument
+ const char *const codec_arg = argv[1];
+ const char *const width_arg = argv[2];
+ const char *const height_arg = argv[3];
+ const char *const infile_arg = argv[4];
+ const char *const outfile_arg = argv[5];
+ exec_name = argv[0];
+
+ if (argc != 6)
+ die("Invalid number of arguments.");
+
+ encoder = get_vpx_encoder_by_name(codec_arg);
+ if (!encoder)
+ die("Unsupported codec.");
+
+ w = strtol(width_arg, NULL, 0);
+ h = strtol(height_arg, NULL, 0);
+
+ if (w <= 0 || h <= 0 || (w % 2) != 0 || (h % 2) != 0)
+ die("Invalid frame size: %dx%d", w, h);
+
+ if (!vpx_img_alloc(&raw, VPX_IMG_FMT_I420, w, h, 1))
+ die("Failed to allocate image", w, h);
+
+ printf("Using %s\n", vpx_codec_iface_name(encoder->codec_interface()));
+
+ // Configuration
+ res = vpx_codec_enc_config_default(encoder->codec_interface(), &cfg, 0);
+ if (res)
+ die_codec(&codec, "Failed to get default codec config.");
+
+ cfg.g_w = w;
+ cfg.g_h = h;
+ cfg.g_timebase.num = 1;
+ cfg.g_timebase.den = fps;
+ cfg.rc_target_bitrate = bitrate;
+
+ if (!(infile = fopen(infile_arg, "rb")))
+ die("Failed to open %s for reading", infile_arg);
+
+ // Pass 0
+ cfg.g_pass = VPX_RC_FIRST_PASS;
+ stats = pass0(&raw, infile, encoder, &cfg);
+
+ // Pass 1
+ rewind(infile);
+ cfg.g_pass = VPX_RC_LAST_PASS;
+ cfg.rc_twopass_stats_in = stats;
+ pass1(&raw, infile, outfile_arg, encoder, &cfg);
+ free(stats.buf);
+
+ vpx_img_free(&raw);
+ fclose(infile);
+
+ return EXIT_SUCCESS;
+}
diff --git a/libs/libvpx/examples/vp8_multi_resolution_encoder.c b/libs/libvpx/examples/vp8_multi_resolution_encoder.c
new file mode 100644
index 0000000000..0248edede0
--- /dev/null
+++ b/libs/libvpx/examples/vp8_multi_resolution_encoder.c
@@ -0,0 +1,729 @@
+/*
+ * Copyright (c) 2010 The WebM 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 is an example demonstrating multi-resolution encoding in VP8.
+ * High-resolution input video is down-sampled to lower-resolutions. The
+ * encoder then encodes the video and outputs multiple bitstreams with
+ * different resolutions.
+ *
+ * This test also allows for settings temporal layers for each spatial layer.
+ * Different number of temporal layers per spatial stream may be used.
+ * Currently up to 3 temporal layers per spatial stream (encoder) are supported
+ * in this test.
+ */
+
+#include "./vpx_config.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include "vpx_ports/vpx_timer.h"
+#include "vpx/vpx_encoder.h"
+#include "vpx/vp8cx.h"
+#include "vpx_ports/mem_ops.h"
+#include "../tools_common.h"
+#define interface (vpx_codec_vp8_cx())
+#define fourcc 0x30385056
+
+void usage_exit(void) {
+ exit(EXIT_FAILURE);
+}
+
+/*
+ * The input video frame is downsampled several times to generate a multi-level
+ * hierarchical structure. NUM_ENCODERS is defined as the number of encoding
+ * levels required. For example, if the size of input video is 1280x720,
+ * NUM_ENCODERS is 3, and down-sampling factor is 2, the encoder outputs 3
+ * bitstreams with resolution of 1280x720(level 0), 640x360(level 1), and
+ * 320x180(level 2) respectively.
+ */
+
+/* Number of encoders (spatial resolutions) used in this test. */
+#define NUM_ENCODERS 3
+
+/* Maximum number of temporal layers allowed for this test. */
+#define MAX_NUM_TEMPORAL_LAYERS 3
+
+/* This example uses the scaler function in libyuv. */
+#include "third_party/libyuv/include/libyuv/basic_types.h"
+#include "third_party/libyuv/include/libyuv/scale.h"
+#include "third_party/libyuv/include/libyuv/cpu_id.h"
+
+int (*read_frame_p)(FILE *f, vpx_image_t *img);
+
+static int read_frame(FILE *f, vpx_image_t *img) {
+ size_t nbytes, to_read;
+ int res = 1;
+
+ to_read = img->w*img->h*3/2;
+ nbytes = fread(img->planes[0], 1, to_read, f);
+ if(nbytes != to_read) {
+ res = 0;
+ if(nbytes > 0)
+ printf("Warning: Read partial frame. Check your width & height!\n");
+ }
+ return res;
+}
+
+static int read_frame_by_row(FILE *f, vpx_image_t *img) {
+ size_t nbytes, to_read;
+ int res = 1;
+ int plane;
+
+ for (plane = 0; plane < 3; 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++)
+ {
+ to_read = w;
+
+ nbytes = fread(ptr, 1, to_read, f);
+ if(nbytes != to_read) {
+ res = 0;
+ if(nbytes > 0)
+ printf("Warning: Read partial frame. Check your width & height!\n");
+ break;
+ }
+
+ ptr += img->stride[plane];
+ }
+ if (!res)
+ break;
+ }
+
+ return res;
+}
+
+static void write_ivf_file_header(FILE *outfile,
+ const vpx_codec_enc_cfg_t *cfg,
+ int frame_cnt) {
+ char header[32];
+
+ if(cfg->g_pass != VPX_RC_ONE_PASS && cfg->g_pass != VPX_RC_LAST_PASS)
+ return;
+ header[0] = 'D';
+ header[1] = 'K';
+ header[2] = 'I';
+ header[3] = 'F';
+ mem_put_le16(header+4, 0); /* version */
+ mem_put_le16(header+6, 32); /* headersize */
+ mem_put_le32(header+8, fourcc); /* headersize */
+ mem_put_le16(header+12, cfg->g_w); /* width */
+ mem_put_le16(header+14, cfg->g_h); /* height */
+ mem_put_le32(header+16, cfg->g_timebase.den); /* rate */
+ mem_put_le32(header+20, cfg->g_timebase.num); /* scale */
+ mem_put_le32(header+24, frame_cnt); /* length */
+ mem_put_le32(header+28, 0); /* unused */
+
+ (void) fwrite(header, 1, 32, outfile);
+}
+
+static void write_ivf_frame_header(FILE *outfile,
+ const vpx_codec_cx_pkt_t *pkt)
+{
+ char header[12];
+ vpx_codec_pts_t pts;
+
+ if(pkt->kind != VPX_CODEC_CX_FRAME_PKT)
+ return;
+
+ pts = pkt->data.frame.pts;
+ mem_put_le32(header, pkt->data.frame.sz);
+ mem_put_le32(header+4, pts&0xFFFFFFFF);
+ mem_put_le32(header+8, pts >> 32);
+
+ (void) fwrite(header, 1, 12, outfile);
+}
+
+/* Temporal scaling parameters */
+/* This sets all the temporal layer parameters given |num_temporal_layers|,
+ * including the target bit allocation across temporal layers. Bit allocation
+ * parameters will be passed in as user parameters in another version.
+ */
+static void set_temporal_layer_pattern(int num_temporal_layers,
+ vpx_codec_enc_cfg_t *cfg,
+ int bitrate,
+ int *layer_flags)
+{
+ assert(num_temporal_layers <= MAX_NUM_TEMPORAL_LAYERS);
+ switch (num_temporal_layers)
+ {
+ case 1:
+ {
+ /* 1-layer */
+ cfg->ts_number_layers = 1;
+ cfg->ts_periodicity = 1;
+ cfg->ts_rate_decimator[0] = 1;
+ cfg->ts_layer_id[0] = 0;
+ cfg->ts_target_bitrate[0] = bitrate;
+
+ // Update L only.
+ layer_flags[0] = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
+ break;
+ }
+
+ case 2:
+ {
+ /* 2-layers, with sync point at first frame of layer 1. */
+ cfg->ts_number_layers = 2;
+ cfg->ts_periodicity = 2;
+ cfg->ts_rate_decimator[0] = 2;
+ cfg->ts_rate_decimator[1] = 1;
+ cfg->ts_layer_id[0] = 0;
+ cfg->ts_layer_id[1] = 1;
+ // Use 60/40 bit allocation as example.
+ cfg->ts_target_bitrate[0] = 0.6f * bitrate;
+ cfg->ts_target_bitrate[1] = bitrate;
+
+ /* 0=L, 1=GF */
+ // ARF is used as predictor for all frames, and is only updated on
+ // key frame. Sync point every 8 frames.
+
+ // Layer 0: predict from L and ARF, update L and G.
+ layer_flags[0] = VP8_EFLAG_NO_REF_GF |
+ VP8_EFLAG_NO_UPD_ARF;
+
+ // Layer 1: sync point: predict from L and ARF, and update G.
+ layer_flags[1] = VP8_EFLAG_NO_REF_GF |
+ VP8_EFLAG_NO_UPD_LAST |
+ VP8_EFLAG_NO_UPD_ARF;
+
+ // Layer 0, predict from L and ARF, update L.
+ layer_flags[2] = VP8_EFLAG_NO_REF_GF |
+ VP8_EFLAG_NO_UPD_GF |
+ VP8_EFLAG_NO_UPD_ARF;
+
+ // Layer 1: predict from L, G and ARF, and update G.
+ layer_flags[3] = VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_UPD_LAST |
+ VP8_EFLAG_NO_UPD_ENTROPY;
+
+ // Layer 0
+ layer_flags[4] = layer_flags[2];
+
+ // Layer 1
+ layer_flags[5] = layer_flags[3];
+
+ // Layer 0
+ layer_flags[6] = layer_flags[4];
+
+ // Layer 1
+ layer_flags[7] = layer_flags[5];
+ break;
+ }
+
+ case 3:
+ default:
+ {
+ // 3-layers structure where ARF is used as predictor for all frames,
+ // and is only updated on key frame.
+ // Sync points for layer 1 and 2 every 8 frames.
+ cfg->ts_number_layers = 3;
+ cfg->ts_periodicity = 4;
+ cfg->ts_rate_decimator[0] = 4;
+ cfg->ts_rate_decimator[1] = 2;
+ cfg->ts_rate_decimator[2] = 1;
+ cfg->ts_layer_id[0] = 0;
+ cfg->ts_layer_id[1] = 2;
+ cfg->ts_layer_id[2] = 1;
+ cfg->ts_layer_id[3] = 2;
+ // Use 40/20/40 bit allocation as example.
+ cfg->ts_target_bitrate[0] = 0.4f * bitrate;
+ cfg->ts_target_bitrate[1] = 0.6f * bitrate;
+ cfg->ts_target_bitrate[2] = bitrate;
+
+ /* 0=L, 1=GF, 2=ARF */
+
+ // Layer 0: predict from L and ARF; update L and G.
+ layer_flags[0] = VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_REF_GF;
+
+ // Layer 2: sync point: predict from L and ARF; update none.
+ layer_flags[1] = VP8_EFLAG_NO_REF_GF |
+ VP8_EFLAG_NO_UPD_GF |
+ VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_UPD_LAST |
+ VP8_EFLAG_NO_UPD_ENTROPY;
+
+ // Layer 1: sync point: predict from L and ARF; update G.
+ layer_flags[2] = VP8_EFLAG_NO_REF_GF |
+ VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_UPD_LAST;
+
+ // Layer 2: predict from L, G, ARF; update none.
+ layer_flags[3] = VP8_EFLAG_NO_UPD_GF |
+ VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_UPD_LAST |
+ VP8_EFLAG_NO_UPD_ENTROPY;
+
+ // Layer 0: predict from L and ARF; update L.
+ layer_flags[4] = VP8_EFLAG_NO_UPD_GF |
+ VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_REF_GF;
+
+ // Layer 2: predict from L, G, ARF; update none.
+ layer_flags[5] = layer_flags[3];
+
+ // Layer 1: predict from L, G, ARF; update G.
+ layer_flags[6] = VP8_EFLAG_NO_UPD_ARF |
+ VP8_EFLAG_NO_UPD_LAST;
+
+ // Layer 2: predict from L, G, ARF; update none.
+ layer_flags[7] = layer_flags[3];
+ break;
+ }
+ }
+}
+
+/* The periodicity of the pattern given the number of temporal layers. */
+static int periodicity_to_num_layers[MAX_NUM_TEMPORAL_LAYERS] = {1, 8, 8};
+
+int main(int argc, char **argv)
+{
+ FILE *infile, *outfile[NUM_ENCODERS];
+ FILE *downsampled_input[NUM_ENCODERS - 1];
+ char filename[50];
+ vpx_codec_ctx_t codec[NUM_ENCODERS];
+ vpx_codec_enc_cfg_t cfg[NUM_ENCODERS];
+ int frame_cnt = 0;
+ vpx_image_t raw[NUM_ENCODERS];
+ vpx_codec_err_t res[NUM_ENCODERS];
+
+ int i;
+ long width;
+ long height;
+ int length_frame;
+ int frame_avail;
+ int got_data;
+ int flags = 0;
+ int layer_id = 0;
+
+ int layer_flags[VPX_TS_MAX_PERIODICITY * NUM_ENCODERS]
+ = {0};
+ int flag_periodicity;
+
+ /*Currently, only realtime mode is supported in multi-resolution encoding.*/
+ int arg_deadline = VPX_DL_REALTIME;
+
+ /* Set show_psnr to 1/0 to show/not show PSNR. Choose show_psnr=0 if you
+ don't need to know PSNR, which will skip PSNR calculation and save
+ encoding time. */
+ int show_psnr = 0;
+ int key_frame_insert = 0;
+ uint64_t psnr_sse_total[NUM_ENCODERS] = {0};
+ uint64_t psnr_samples_total[NUM_ENCODERS] = {0};
+ double psnr_totals[NUM_ENCODERS][4] = {{0,0}};
+ int psnr_count[NUM_ENCODERS] = {0};
+
+ double cx_time = 0;
+ struct timeval tv1, tv2, difftv;
+
+ /* Set the required target bitrates for each resolution level.
+ * If target bitrate for highest-resolution level is set to 0,
+ * (i.e. target_bitrate[0]=0), we skip encoding at that level.
+ */
+ unsigned int target_bitrate[NUM_ENCODERS]={1000, 500, 100};
+
+ /* Enter the frame rate of the input video */
+ int framerate = 30;
+
+ /* Set down-sampling factor for each resolution level.
+ dsf[0] controls down sampling from level 0 to level 1;
+ dsf[1] controls down sampling from level 1 to level 2;
+ dsf[2] is not used. */
+ vpx_rational_t dsf[NUM_ENCODERS] = {{2, 1}, {2, 1}, {1, 1}};
+
+ /* Set the number of temporal layers for each encoder/resolution level,
+ * starting from highest resoln down to lowest resoln. */
+ unsigned int num_temporal_layers[NUM_ENCODERS] = {3, 3, 3};
+
+ if(argc!= (7 + 3 * NUM_ENCODERS))
+ die("Usage: %s "
+ "