[Sumover-dev] [svn commit] r3892 - in vic/branches/mpeg4: ffmpeg/postproc render

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Thu Oct 12 10:49:54 BST 2006


Author: barz
Date: Thu Oct 12 10:48:22 2006
New Revision: 3892

Added:
   vic/branches/mpeg4/ffmpeg/postproc/cpudetect.c
   vic/branches/mpeg4/ffmpeg/postproc/cputable.h
Modified:
   vic/branches/mpeg4/Makefile.in
   vic/branches/mpeg4/configure
   vic/branches/mpeg4/configure.in
   vic/branches/mpeg4/ffmpeg/postproc/Makefile
   vic/branches/mpeg4/ffmpeg/postproc/config.h
   vic/branches/mpeg4/ffmpeg/postproc/cpudetect.h
   vic/branches/mpeg4/ffmpeg/postproc/deinterlace.cpp
   vic/branches/mpeg4/ffmpeg/postproc/deinterlace.h
   vic/branches/mpeg4/ffmpeg/postproc/mp_msg.c
   vic/branches/mpeg4/ffmpeg/postproc/swscale.c
   vic/branches/mpeg4/ffmpeg/postproc/swscale.h
   vic/branches/mpeg4/main.cpp
   vic/branches/mpeg4/render/color-x11.cpp
   vic/branches/mpeg4/render/xvideo.cpp
   vic/branches/mpeg4/render/xvideo.h

Log:
CPU runtime capability variable 'gCpuCaps' for swscale, deinterlace

Modified: vic/branches/mpeg4/Makefile.in
==============================================================================
--- vic/branches/mpeg4/Makefile.in	(original)
+++ vic/branches/mpeg4/Makefile.in	Thu Oct 12 10:48:22 2006
@@ -92,7 +92,7 @@
 VIDEO_LIB = ffmpeg/postproc/libswscale.a
 
 LIB = $(LIB_GRABBER) @V_LIB_TK@ @V_LIB_TCL@ @V_LIB_X11@ @V_LIB@ $(CODEC_LIB) $(VIDEO_LIB) \
-	../common/src/libuclmmbase.a -lm -lz -lcrypto -lpthread -lXv
+	../common/src/libuclmmbase.a -lm -lz -lcrypto -lpthread 
 
 
 INCLUDE = $(INCLUDE_MISC) $(INCLUDE_GRABBER) $(INCLUDE_TK) $(INCLUDE_TCL) \
@@ -138,7 +138,7 @@
 	net/mbus_handler.o net/mbus_engine.o net/group-ipc.o net/confbus.o \
 	rtp/session.o rtp/source.o rtp/transmitter.o rtp/pktbuf-rtp.o \
 	video/device.o video/grabber.o video/grabber-still.o \
-    video/deinterlace.o \
+    	video/deinterlace.o \
 	codec/encoder-h261.o codec/encoder-jpeg.o codec/encoder-raw.o \
 	codec/encoder-h263.o codec/encoder-h263v2.o codec/encoder-nv.o \
 	codec/encoder-cellb.o codec/encoder-pvh.o codec/compositor.o \
@@ -155,7 +155,7 @@
 	render/color-pseudo.o render/color-dither.o \
 	render/color-ed.o render/color-quant.o \
 	render/color-gray.o render/color-mono.o render/color-hist.o \
-	render/rgb-converter.o render/vw.o render/ppm.o render/xvideo.o @V_OBJ@
+	render/rgb-converter.o render/vw.o render/ppm.o @V_OBJ@
         #render/color-true.o render/color-hi.o
 
 

Modified: vic/branches/mpeg4/configure
==============================================================================
--- vic/branches/mpeg4/configure	(original)
+++ vic/branches/mpeg4/configure	Thu Oct 12 10:48:22 2006
@@ -34,6 +34,8 @@
 ac_help="$ac_help
 --enable-dvdecode       Enable or disable dv decoding"
 ac_help="$ac_help
+--enable-xvideo		Enable or disable Xvideo rendering"
+ac_help="$ac_help
 --enable-v4l2old    Enable or disable old Video4Linux2 grabber"
 ac_help="$ac_help
 --enable-XvGrabber    Enable or disable old XvGrabber"
@@ -603,7 +605,7 @@
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:607: checking host system type" >&5
+echo "configure:609: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
@@ -624,7 +626,7 @@
 echo "$ac_t""$host" 1>&6
 
 echo $ac_n "checking target system type""... $ac_c" 1>&6
-echo "configure:628: checking target system type" >&5
+echo "configure:630: checking target system type" >&5
 
 target_alias=$target
 case "$target_alias" in
@@ -642,7 +644,7 @@
 echo "$ac_t""$target" 1>&6
 
 echo $ac_n "checking build system type""... $ac_c" 1>&6
-echo "configure:646: checking build system type" >&5
+echo "configure:648: checking build system type" >&5
 
 build_alias=$build
 case "$build_alias" in
@@ -668,7 +670,7 @@
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:672: checking for $ac_word" >&5
+echo "configure:674: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -698,7 +700,7 @@
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:702: checking for $ac_word" >&5
+echo "configure:704: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -749,7 +751,7 @@
       # Extract the first word of "cl", so it can be a program name with args.
 set dummy cl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:753: checking for $ac_word" >&5
+echo "configure:755: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -781,7 +783,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:787: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -792,12 +794,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 796 "configure"
+#line 798 "configure"
 #include "confdefs.h"
 
 main(){return(0);}
 EOF
-if { (eval echo configure:801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -823,12 +825,12 @@
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:827: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:829: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:832: checking whether we are using GNU C" >&5
+echo "configure:834: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -837,7 +839,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:841: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -856,7 +858,7 @@
 ac_save_CFLAGS="$CFLAGS"
 CFLAGS=
 echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:860: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:862: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -892,7 +894,7 @@
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:896: checking for $ac_word" >&5
+echo "configure:898: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -924,7 +926,7 @@
 
 
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:928: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
+echo "configure:930: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
 
 ac_ext=C
 # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -935,12 +937,12 @@
 
 cat > conftest.$ac_ext << EOF
 
-#line 939 "configure"
+#line 941 "configure"
 #include "confdefs.h"
 
 int main(){return(0);}
 EOF
-if { (eval echo configure:944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cxx_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -966,12 +968,12 @@
   { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:970: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:972: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
 cross_compiling=$ac_cv_prog_cxx_cross
 
 echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:975: checking whether we are using GNU C++" >&5
+echo "configure:977: checking whether we are using GNU C++" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -980,7 +982,7 @@
   yes;
 #endif
 EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:986: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gxx=yes
 else
   ac_cv_prog_gxx=no
@@ -999,7 +1001,7 @@
 ac_save_CXXFLAGS="$CXXFLAGS"
 CXXFLAGS=
 echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:1003: checking whether ${CXX-g++} accepts -g" >&5
+echo "configure:1005: checking whether ${CXX-g++} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1031,7 +1033,7 @@
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1035: checking how to run the C preprocessor" >&5
+echo "configure:1037: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1046,13 +1048,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1050 "configure"
+#line 1052 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1056: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1063,13 +1065,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1067 "configure"
+#line 1069 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1080,13 +1082,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -nologo -E"
   cat > conftest.$ac_ext <<EOF
-#line 1084 "configure"
+#line 1086 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
@@ -1111,12 +1113,12 @@
 echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1115: checking for ANSI C header files" >&5
+echo "configure:1117: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1120 "configure"
+#line 1122 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1124,7 +1126,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1130: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1141,7 +1143,7 @@
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1145 "configure"
+#line 1147 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1159,7 +1161,7 @@
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1163 "configure"
+#line 1165 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1180,7 +1182,7 @@
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1184 "configure"
+#line 1186 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1191,7 +1193,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:1195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1218,17 +1220,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1222: checking for $ac_hdr" >&5
+echo "configure:1224: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1227 "configure"
+#line 1229 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1232: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1234: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1266,7 +1268,7 @@
 V_SIGRET="void"
 
 echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:1270: checking for main in -lXbsd" >&5
+echo "configure:1272: checking for main in -lXbsd" >&5
 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1274,14 +1276,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXbsd  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1278 "configure"
+#line 1280 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1302,7 +1304,7 @@
 fi
 
 echo $ac_n "checking for poll in -lsocket""... $ac_c" 1>&6
-echo "configure:1306: checking for poll in -lsocket" >&5
+echo "configure:1308: checking for poll in -lsocket" >&5
 ac_lib_var=`echo socket'_'poll | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1310,7 +1312,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1314 "configure"
+#line 1316 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1321,7 +1323,7 @@
 poll()
 ; return 0; }
 EOF
-if { (eval echo configure:1325: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1345,7 +1347,7 @@
 # nsl lib seems to cause problems on IRIX
 if test `echo "$target_os" | sed 's/\..*//'` != irix6 ; then
 	echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1349: checking for gethostbyname in -lnsl" >&5
+echo "configure:1351: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1353,7 +1355,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1357 "configure"
+#line 1359 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1364,7 +1366,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:1368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1486,12 +1488,12 @@
 echo "checking for X11 header files"
 if test "$x_includes" = NONE ; then
 	cat > conftest.$ac_ext <<EOF
-#line 1490 "configure"
+#line 1492 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1495: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1497: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1525,7 +1527,7 @@
 echo "checking for X11 library archive"
 if test "$x_libraries" = NONE ; then
 	echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:1529: checking for XOpenDisplay in -lX11" >&5
+echo "configure:1531: checking for XOpenDisplay in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1533,7 +1535,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lX11  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1537 "configure"
+#line 1539 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1544,7 +1546,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:1548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1550: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1584,7 +1586,7 @@
 if test -n "$V_SHM" ; then
 	if test -z "$x_libraries" ; then
 		echo $ac_n "checking for XShmAttach in -lXext""... $ac_c" 1>&6
-echo "configure:1588: checking for XShmAttach in -lXext" >&5
+echo "configure:1590: checking for XShmAttach in -lXext" >&5
 ac_lib_var=`echo Xext'_'XShmAttach | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1592,7 +1594,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1596 "configure"
+#line 1598 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -1603,7 +1605,7 @@
 XShmAttach()
 ; return 0; }
 EOF
-if { (eval echo configure:1607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1730,12 +1732,12 @@
 else
 	echo "Not using UCL tcl - You're on your own!"
 	cat > conftest.$ac_ext <<EOF
-#line 1734 "configure"
+#line 1736 "configure"
 #include "confdefs.h"
 #include <tcl.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1739: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1741: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1774,7 +1776,7 @@
 		fi
 	fi
 	echo $ac_n "checking for main in -ltcl8.0""... $ac_c" 1>&6
-echo "configure:1778: checking for main in -ltcl8.0" >&5
+echo "configure:1780: checking for main in -ltcl8.0" >&5
 ac_lib_var=`echo tcl8.0'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1782,14 +1784,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltcl8.0  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1786 "configure"
+#line 1788 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -1955,12 +1957,12 @@
 else
 	echo "Not using UCL tk - You're on your own!"
 	cat > conftest.$ac_ext <<EOF
-#line 1959 "configure"
+#line 1961 "configure"
 #include "confdefs.h"
 #include <tk.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2001,7 +2003,7 @@
 		fi
 	fi
 	echo $ac_n "checking for main in -ltk8.0""... $ac_c" 1>&6
-echo "configure:2005: checking for main in -ltk8.0" >&5
+echo "configure:2007: checking for main in -ltk8.0" >&5
 ac_lib_var=`echo tk8.0'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2009,14 +2011,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ltk8.0  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2013 "configure"
+#line 2015 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2173,7 +2175,7 @@
 
 if test "$dvdecode" = "yes"; then
    echo $ac_n "checking for main in -ldv""... $ac_c" 1>&6
-echo "configure:2177: checking for main in -ldv" >&5
+echo "configure:2179: checking for main in -ldv" >&5
 ac_lib_var=`echo dv'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2181,14 +2183,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2185 "configure"
+#line 2187 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2223,17 +2225,17 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2227: checking for $ac_hdr" >&5
+echo "configure:2229: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2232 "configure"
+#line 2234 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2237: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2267,6 +2269,160 @@
    V_LIB="$V_LIB -ldv"
 fi
 
+V_XV=""
+# Check whether --enable-xvideo or --disable-xvideo was given.
+if test "${enable_xvideo+set}" = set; then
+  enableval="$enable_xvideo"
+  xvideo=no
+else
+  xvideo=yes
+fi
+
+if test "$xvideo" = "yes"; then
+
+      echo $ac_n "checking for XvQueryExtension in -lXv_pic""... $ac_c" 1>&6
+echo "configure:2285: checking for XvQueryExtension in -lXv_pic" >&5
+ac_lib_var=`echo Xv_pic'_'XvQueryExtension | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lXv_pic -lXext $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2293 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char XvQueryExtension();
+
+int main() {
+XvQueryExtension()
+; return 0; }
+EOF
+if { (eval echo configure:2304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  HAVE_XVIDEO="yes"
+else
+  echo "$ac_t""no" 1>&6
+HAVE_XVIDEO="no"
+fi
+
+   if test $HAVE_XVIDEO = "yes"; then
+	V_LIB="$V_LIB -lXv_pic"
+        V_XV="-DHAVE_XVIDEO"
+        V_OBJ="$V_OBJ render/xvideo.o"
+   else
+   
+   	echo $ac_n "checking for XvQueryExtension in -lXv""... $ac_c" 1>&6
+echo "configure:2332: checking for XvQueryExtension in -lXv" >&5
+ac_lib_var=`echo Xv'_'XvQueryExtension | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lXv -lXext $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2340 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char XvQueryExtension();
+
+int main() {
+XvQueryExtension()
+; return 0; }
+EOF
+if { (eval echo configure:2351: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  HAVE_XVIDEO="yes"
+else
+  echo "$ac_t""no" 1>&6
+HAVE_XVIDEO="no"
+fi
+
+
+   	if test $HAVE_XVIDEO = "yes"; then
+       	    V_XV="-DHAVE_XVIDEO"
+       	    V_LIB="$V_LIB -lXv"
+            V_OBJ="$V_OBJ render/xvideo.o"
+   	fi
+   fi
+
+   if test $HAVE_XVIDEO = "yes"; then
+   	for ac_hdr in X11/extensions/Xvlib.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:2385: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2390 "configure"
+#include "confdefs.h"
+#include <$ac_hdr>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:2395: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
+EOF
+ 
+else
+  echo "$ac_t""no" 1>&6
+echo "Error! \"X11/extensions/Xvlib.h\" not found. Please install \"libxv-dev\" package."
+      		exit 1
+      	
+fi
+done
+
+   fi
+fi
+
 # lots of hairy special cases for detecting which frame capture
 # support to compile in
 
@@ -2605,7 +2761,7 @@
 
 
 
-V_DEFINE="$V_DEFINE $V_SHM $V_H261AS $V_DV"
+V_DEFINE="$V_DEFINE $V_SHM $V_H261AS $V_DV $V_XV"
 
 
 # tcl7.5 needs a dynamic loading library (unless built with the
@@ -2625,7 +2781,7 @@
 		;;
 	*-*-linux*)
 		echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2629: checking for dlopen in -ldl" >&5
+echo "configure:2785: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2633,7 +2789,7 @@
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2637 "configure"
+#line 2793 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2644,7 +2800,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2648: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2672,7 +2828,7 @@
 	esac
 	if test ! -z "$V_LIB_DL" ; then
 		echo $ac_n "checking for main in -l$V_LIB_DL""... $ac_c" 1>&6
-echo "configure:2676: checking for main in -l$V_LIB_DL" >&5
+echo "configure:2832: checking for main in -l$V_LIB_DL" >&5
 ac_lib_var=`echo $V_LIB_DL'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2680,14 +2836,14 @@
   ac_save_LIBS="$LIBS"
 LIBS="-l$V_LIB_DL $V_STATIC $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2684 "configure"
+#line 2840 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else

Modified: vic/branches/mpeg4/configure.in
==============================================================================
--- vic/branches/mpeg4/configure.in	(original)
+++ vic/branches/mpeg4/configure.in	Thu Oct 12 10:48:22 2006
@@ -58,6 +58,41 @@
    V_LIB="$V_LIB -ldv"
 fi
 
+dnl xvideo rendering support
+V_XV=""
+AC_ARG_ENABLE(xvideo, --enable-xvideo		Enable or disable Xvideo rendering, xvideo=no, xvideo=yes)
+if test "$xvideo" = "yes"; then
+
+   dnl Look for the PIC library first, Debian requires it.
+   AC_CHECK_LIB(Xv_pic, XvQueryExtension,
+                 HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
+                 -lXext)
+   if test $HAVE_XVIDEO = "yes"; then
+	V_LIB="$V_LIB -lXv_pic"
+        V_XV="-DHAVE_XVIDEO"
+        V_OBJ="$V_OBJ render/xvideo.o"
+   else
+   dnl try again using something else if we didn't find it first
+
+   	AC_CHECK_LIB(Xv, XvQueryExtension,
+                HAVE_XVIDEO="yes", HAVE_XVIDEO="no",
+                -lXext)
+
+   	if test $HAVE_XVIDEO = "yes"; then
+       	    V_XV="-DHAVE_XVIDEO"
+       	    V_LIB="$V_LIB -lXv"
+            V_OBJ="$V_OBJ render/xvideo.o"
+   	fi
+   fi
+
+   if test $HAVE_XVIDEO = "yes"; then
+   	AC_CHECK_HEADERS([X11/extensions/Xvlib.h], [], [
+      	echo "Error! \"X11/extensions/Xvlib.h\" not found. Please install \"libxv-dev\" package."
+      		exit 1
+      	])
+   fi
+fi
+
 # lots of hairy special cases for detecting which frame capture
 # support to compile in
 
@@ -383,6 +418,6 @@
 AC_SUBST(V_OBJ)
 AC_SUBST(V_LIB)
 
-V_DEFINE="$V_DEFINE $V_SHM $V_H261AS $V_DV"
+V_DEFINE="$V_DEFINE $V_SHM $V_H261AS $V_DV $V_XV"
 
 builtin(include, configure.in.tail)

Modified: vic/branches/mpeg4/ffmpeg/postproc/Makefile
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/Makefile	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/Makefile	Thu Oct 12 10:48:22 2006
@@ -3,7 +3,7 @@
 
 SWSLIB = libswscale.a
 
-SWSSRCS=swscale.c rgb2rgb.c yuv2rgb.c mp_msg.c aclib.c img_format.c
+SWSSRCS=swscale.c rgb2rgb.c yuv2rgb.c mp_msg.c aclib.c img_format.c cpudetect.c
 
 SWSOBJS=$(SWSSRCS:.c=.o)
 
@@ -11,10 +11,10 @@
 SWSOBJS +=  yuv2rgb_altivec.o
 endif
 
-CC=cc
+CC=gcc
 AR=ar
 RANLIB = true
-OPTFLAGS = -fno-PIC -O4 -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+OPTFLAGS = -g -fno-PIC -O2 -pipe -ffast-math -fomit-frame-pointer -D_REENTRANT -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
 CFLAGS  = $(OPTFLAGS) -I. 
 
 .SUFFIXES: .c .o

Modified: vic/branches/mpeg4/ffmpeg/postproc/config.h
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/config.h	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/config.h	Thu Oct 12 10:48:22 2006
@@ -8,7 +8,22 @@
 #include "../config.h"
 
 /* Runtime CPU detection */
-#undef RUNTIME_CPUDETECT
+#define RUNTIME_CPUDETECT
+
+/* Only use during compliation */
+#if defined(RUNTIME_CPUDETECT) 
+#undef  HAVE_MMX
+#define HAVE_MMX
+#define HAVE_MMX2
+#define HAVE_SSE
+#define HAVE_SSE2
+#define HAVE_3DNOW
+#define HAVE_3DNOWEX
+#endif 
+
+/* Use 3dnow/mmxext/sse/mmx optimized fast memcpy() [maybe buggy... signal 4]*/
+#define USE_FASTMEMCPY 1
+#define HAVE_XVIDEO
 
 /* attribute(used) as needed by some compilers */
 #if (__GNUC__ * 100 + __GNUC_MINOR__ >= 300)
@@ -16,12 +31,4 @@
 #else
 # define attribute_used
 #endif
-
-
-/* Define this if you have shm support */
-#define HAVE_SHM 1
-/* Use 3dnow/mmxext/sse/mmx optimized fast memcpy() [maybe buggy... signal 4]*/
-#define USE_FASTMEMCPY 1
-#define HAVE_XVIDEO
-
 #endif

Added: vic/branches/mpeg4/ffmpeg/postproc/cpudetect.c
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/ffmpeg/postproc/cpudetect.c	Thu Oct 12 10:48:22 2006
@@ -0,0 +1,625 @@
+#include "config.h"
+#include "cpudetect.h"
+#include "mp_msg.h"
+
+CpuCaps gCpuCaps;
+
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#include <stdlib.h>
+
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
+
+#include <stdio.h>
+#include <string.h>
+
+#if defined (__NetBSD__) || defined(__OpenBSD__)
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#include <machine/cpu.h>
+#endif
+
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#include <sys/types.h>
+#include <sys/sysctl.h>
+#endif
+
+#ifdef __linux__
+#include <signal.h>
+#endif
+
+#ifdef WIN32
+#include <windows.h>
+#endif
+
+#ifdef __AMIGAOS4__
+#include <proto/exec.h>
+#endif
+
+//#define X86_FXSR_MAGIC
+/* Thanks to the FreeBSD project for some of this cpuid code, and 
+ * help understanding how to use it.  Thanks to the Mesa 
+ * team for SSE support detection and more cpu detect code.
+ */
+
+/* I believe this code works.  However, it has only been used on a PII and PIII */
+
+static void check_os_katmai_support( void );
+
+#if 1
+// return TRUE if cpuid supported
+static int has_cpuid(void)
+{
+	long a, c;
+
+// code from libavcodec:
+    __asm__ __volatile__ (
+                          /* See if CPUID instruction is supported ... */
+                          /* ... Get copies of EFLAGS into eax and ecx */
+                          "pushf\n\t"
+                          "pop %0\n\t"
+                          "mov %0, %1\n\t"
+                          
+                          /* ... Toggle the ID bit in one copy and store */
+                          /*     to the EFLAGS reg */
+                          "xor $0x200000, %0\n\t"
+                          "push %0\n\t"
+                          "popf\n\t"
+                          
+                          /* ... Get the (hopefully modified) EFLAGS */
+                          "pushf\n\t"
+                          "pop %0\n\t"
+                          : "=a" (a), "=c" (c)
+                          :
+                          : "cc" 
+                          );
+
+	return (a!=c);
+}
+#endif
+
+static void
+do_cpuid(unsigned int ax, unsigned int *p)
+{
+#if 0
+	__asm __volatile(
+	"cpuid;"
+	: "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3])
+	:  "0" (ax)
+	);
+#else
+// code from libavcodec:
+    __asm __volatile
+	("mov %%"REG_b", %%"REG_S"\n\t"
+         "cpuid\n\t"
+         "xchg %%"REG_b", %%"REG_S
+         : "=a" (p[0]), "=S" (p[1]), 
+           "=c" (p[2]), "=d" (p[3])
+         : "0" (ax));
+#endif
+
+}
+
+void GetCpuCaps( CpuCaps *caps)
+{
+	unsigned int regs[4];
+	unsigned int regs2[4];
+
+	memset(caps, 0, sizeof(*caps));
+	caps->isX86=1;
+	caps->cl_size=32; /* default */
+	if (!has_cpuid()) {
+	    mp_msg(MSGT_CPUDETECT,MSGL_WARN,"CPUID not supported!??? (maybe an old 486?)\n");
+	    return;
+	}
+	do_cpuid(0x00000000, regs); // get _max_ cpuid level and vendor name
+	mp_msg(MSGT_CPUDETECT,MSGL_V,"CPU vendor name: %.4s%.4s%.4s  max cpuid level: %d\n",
+			(char*) (regs+1),(char*) (regs+3),(char*) (regs+2), regs[0]);
+	if (regs[0]>=0x00000001)
+	{
+		char *tmpstr, *ptmpstr;
+		unsigned cl_size;
+
+		do_cpuid(0x00000001, regs2);
+
+		caps->cpuType=(regs2[0] >> 8)&0xf;
+		caps->cpuModel=(regs2[0] >> 4)&0xf;
+
+// see AMD64 Architecture Programmer's Manual, Volume 3: General-purpose and
+// System Instructions, Table 3-2: Effective family computation, page 120.
+		if(caps->cpuType==0xf){
+		    // use extended family (P4, IA64, K8)
+		    caps->cpuType=0xf+((regs2[0]>>20)&255);
+		}
+		if(caps->cpuType==0xf || caps->cpuType==6)
+		    caps->cpuModel |= ((regs2[0]>>16)&0xf) << 4;
+
+		caps->cpuStepping=regs2[0] & 0xf;
+
+		// general feature flags:
+		caps->hasTSC  = (regs2[3] & (1 << 8  )) >>  8; // 0x0000010
+		caps->hasMMX  = (regs2[3] & (1 << 23 )) >> 23; // 0x0800000
+		caps->hasSSE  = (regs2[3] & (1 << 25 )) >> 25; // 0x2000000
+		caps->hasSSE2 = (regs2[3] & (1 << 26 )) >> 26; // 0x4000000
+		caps->hasMMX2 = caps->hasSSE; // SSE cpus supports mmxext too
+		cl_size = ((regs2[1] >> 8) & 0xFF)*8;
+		if(cl_size) caps->cl_size = cl_size;
+
+		ptmpstr=tmpstr=GetCpuFriendlyName(regs, regs2);
+		while(*ptmpstr == ' ')        // strip leading spaces
+		    ptmpstr++;
+
+		strcpy(caps->cpuname, ptmpstr);
+		mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: %s ", ptmpstr);
+		free(tmpstr);
+		mp_msg(MSGT_CPUDETECT,MSGL_INFO,"(Family: %d, Model: %d, Stepping: %d)\n",
+		    caps->cpuType, caps->cpuModel, caps->cpuStepping);
+
+	}
+	do_cpuid(0x80000000, regs);
+	if (regs[0]>=0x80000001) {
+		mp_msg(MSGT_CPUDETECT,MSGL_V,"extended cpuid-level: %d\n",regs[0]&0x7FFFFFFF);
+		do_cpuid(0x80000001, regs2);
+		caps->hasMMX  |= (regs2[3] & (1 << 23 )) >> 23; // 0x0800000
+		caps->hasMMX2 |= (regs2[3] & (1 << 22 )) >> 22; // 0x400000
+		caps->has3DNow    = (regs2[3] & (1 << 31 )) >> 31; //0x80000000
+		caps->has3DNowExt = (regs2[3] & (1 << 30 )) >> 30;
+	}
+	if(regs[0]>=0x80000006)
+	{
+		do_cpuid(0x80000006, regs2);
+		mp_msg(MSGT_CPUDETECT,MSGL_V,"extended cache-info: %d\n",regs2[2]&0x7FFFFFFF);
+		caps->cl_size  = regs2[2] & 0xFF;
+	}
+	mp_msg(MSGT_CPUDETECT,MSGL_V,"Detected cache-line size is %u bytes\n",caps->cl_size);
+#if 0
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"cpudetect: MMX=%d MMX2=%d SSE=%d SSE2=%d 3DNow=%d 3DNowExt=%d\n",
+		gCpuCaps.hasMMX,
+		gCpuCaps.hasMMX2,
+		gCpuCaps.hasSSE,
+		gCpuCaps.hasSSE2,
+		gCpuCaps.has3DNow,
+		gCpuCaps.has3DNowExt );
+#endif
+
+		/* FIXME: Does SSE2 need more OS support, too? */
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+		if (caps->hasSSE)
+			check_os_katmai_support();
+		if (!caps->hasSSE)
+			caps->hasSSE2 = 0;
+#else
+		caps->hasSSE=0;
+		caps->hasSSE2 = 0;
+#endif
+//		caps->has3DNow=1;
+//		caps->hasMMX2 = 0;
+//		caps->hasMMX = 0;
+
+#ifndef HAVE_MMX
+	if(caps->hasMMX) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"MMX supported but disabled\n");
+	caps->hasMMX=0;
+#endif
+#ifndef HAVE_MMX2
+	if(caps->hasMMX2) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"MMX2 supported but disabled\n");
+	caps->hasMMX2=0;
+#endif
+#ifndef HAVE_SSE
+	if(caps->hasSSE) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"SSE supported but disabled\n");
+	caps->hasSSE=0;
+#endif
+#ifndef HAVE_SSE2
+	if(caps->hasSSE2) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"SSE2 supported but disabled\n");
+	caps->hasSSE2=0;
+#endif
+#ifndef HAVE_3DNOW
+	if(caps->has3DNow) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"3DNow supported but disabled\n");
+	caps->has3DNow=0;
+#endif
+#ifndef HAVE_3DNOWEX
+	if(caps->has3DNowExt) mp_msg(MSGT_CPUDETECT,MSGL_WARN,"3DNowExt supported but disabled\n");
+	caps->has3DNowExt=0;
+#endif
+}
+
+
+#define CPUID_EXTFAMILY	((regs2[0] >> 20)&0xFF) /* 27..20 */
+#define CPUID_EXTMODEL	((regs2[0] >> 16)&0x0F) /* 19..16 */
+#define CPUID_TYPE		((regs2[0] >> 12)&0x04) /* 13..12 */
+#define CPUID_FAMILY	((regs2[0] >>  8)&0x0F) /* 11..08 */
+#define CPUID_MODEL		((regs2[0] >>  4)&0x0F) /* 07..04 */
+#define CPUID_STEPPING	((regs2[0] >>  0)&0x0F) /* 03..00 */
+
+char *GetCpuFriendlyName(unsigned int regs[], unsigned int regs2[]){
+#include "cputable.h" /* get cpuname and cpuvendors */
+	char vendor[13];
+	char *retname;
+	int i;
+
+	if (NULL==(retname=malloc(256))) {
+		mp_msg(MSGT_CPUDETECT,MSGL_FATAL,"Error: GetCpuFriendlyName() not enough memory\n");
+		exit(1);
+	}
+
+	sprintf(vendor,"%.4s%.4s%.4s",(char*)(regs+1),(char*)(regs+3),(char*)(regs+2));
+
+	do_cpuid(0x80000000,regs);
+	if (regs[0] >= 0x80000004)
+	{
+		// CPU has built-in namestring
+		retname[0] = '\0';
+		for (i = 0x80000002; i <= 0x80000004; i++)
+		{
+			do_cpuid(i, regs);
+			strncat(retname, (char*)regs, 16);
+		}
+		return retname;
+	}
+
+	for(i=0; i<MAX_VENDORS; i++){
+		if(!strcmp(cpuvendors[i].string,vendor)){
+			if(cpuname[i][CPUID_FAMILY][CPUID_MODEL]){
+				snprintf(retname,255,"%s %s",cpuvendors[i].name,cpuname[i][CPUID_FAMILY][CPUID_MODEL]);
+			} else {
+				snprintf(retname,255,"unknown %s %d. Generation CPU",cpuvendors[i].name,CPUID_FAMILY); 
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"unknown %s CPU:\n",cpuvendors[i].name);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Vendor:   %s\n",cpuvendors[i].string);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Type:     %d\n",CPUID_TYPE);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Family:   %d (ext: %d)\n",CPUID_FAMILY,CPUID_EXTFAMILY);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Model:    %d (ext: %d)\n",CPUID_MODEL,CPUID_EXTMODEL);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Stepping: %d\n",CPUID_STEPPING);
+				mp_msg(MSGT_CPUDETECT,MSGL_WARN,"Please send the above info along with the exact CPU name"
+				       "to the MPlayer-Developers, so we can add it to the list!\n");
+			}
+		}
+	}
+	retname[255] = 0;
+
+	//printf("Detected CPU: %s\n", retname);
+	return retname;
+}
+
+#undef CPUID_EXTFAMILY
+#undef CPUID_EXTMODEL
+#undef CPUID_TYPE
+#undef CPUID_FAMILY
+#undef CPUID_MODEL
+#undef CPUID_STEPPING
+
+
+#if defined(__linux__) && defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)
+static void sigill_handler_sse( int signal, struct sigcontext sc )
+{
+   mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " );
+
+   /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1"
+    * instructions are 3 bytes long.  We must increment the instruction
+    * pointer manually to avoid repeated execution of the offending
+    * instruction.
+    *
+    * If the SIGILL is caused by a divide-by-zero when unmasked
+    * exceptions aren't supported, the SIMD FPU status and control
+    * word will be restored at the end of the test, so we don't need
+    * to worry about doing it here.  Besides, we may not be able to...
+    */
+   sc.eip += 3;
+
+   gCpuCaps.hasSSE=0;
+}
+
+static void sigfpe_handler_sse( int signal, struct sigcontext sc )
+{
+   mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGFPE, " );
+
+   if ( sc.fpstate->magic != 0xffff ) {
+      /* Our signal context has the extended FPU state, so reset the
+       * divide-by-zero exception mask and clear the divide-by-zero
+       * exception bit.
+       */
+      sc.fpstate->mxcsr |= 0x00000200;
+      sc.fpstate->mxcsr &= 0xfffffffb;
+   } else {
+      /* If we ever get here, we're completely hosed.
+       */
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "\n\n" );
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "SSE enabling test failed badly!" );
+   }
+}
+#endif /* __linux__ && _POSIX_SOURCE && X86_FXSR_MAGIC */
+
+#ifdef WIN32
+LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep)
+{
+   if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "SIGILL, " );
+      ep->ContextRecord->Eip +=3;
+      gCpuCaps.hasSSE=0;       
+	  return EXCEPTION_CONTINUE_EXECUTION;
+   }
+   return EXCEPTION_CONTINUE_SEARCH;
+}
+#endif /* WIN32 */
+
+/* If we're running on a processor that can do SSE, let's see if we
+ * are allowed to or not.  This will catch 2.4.0 or later kernels that
+ * haven't been configured for a Pentium III but are running on one,
+ * and RedHat patched 2.2 kernels that have broken exception handling
+ * support for user space apps that do SSE.
+ */
+ 
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+#define SSE_SYSCTL_NAME "hw.instruction_sse"
+#elif defined(__APPLE__)
+#define SSE_SYSCTL_NAME "hw.optional.sse"
+#endif
+
+static void check_os_katmai_support( void )
+{
+#ifdef ARCH_X86_64
+   gCpuCaps.hasSSE=1;
+   gCpuCaps.hasSSE2=1;
+#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__)
+   int has_sse=0, ret;
+   size_t len=sizeof(has_sse);
+
+   ret = sysctlbyname(SSE_SYSCTL_NAME, &has_sse, &len, NULL, 0);
+   if (ret || !has_sse)
+      gCpuCaps.hasSSE=0;
+
+#elif defined(__NetBSD__) || defined (__OpenBSD__)
+#if __NetBSD_Version__ >= 105250000 || (defined __OpenBSD__)
+   int has_sse, has_sse2, ret, mib[2];
+   size_t varlen;
+
+   mib[0] = CTL_MACHDEP;
+   mib[1] = CPU_SSE;
+   varlen = sizeof(has_sse);
+
+   mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+   ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0);
+   if (ret < 0 || !has_sse) {
+      gCpuCaps.hasSSE=0;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+   } else {
+      gCpuCaps.hasSSE=1;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "yes!\n" );
+   }
+
+   mib[1] = CPU_SSE2;
+   varlen = sizeof(has_sse2);
+   mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE2... " );
+   ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0);
+   if (ret < 0 || !has_sse2) {
+      gCpuCaps.hasSSE2=0;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+   } else {
+      gCpuCaps.hasSSE2=1;
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "yes!\n" );
+   }
+#else
+   gCpuCaps.hasSSE = 0;
+   mp_msg(MSGT_CPUDETECT,MSGL_WARN, "No OS support for SSE, disabling to be safe.\n" );
+#endif
+#elif defined(WIN32)
+   LPTOP_LEVEL_EXCEPTION_FILTER exc_fil;
+   if ( gCpuCaps.hasSSE ) {
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+      exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse);
+      __asm __volatile ("xorps %xmm0, %xmm0");
+      SetUnhandledExceptionFilter(exc_fil);
+      if ( gCpuCaps.hasSSE ) mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
+      else mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+   }
+#elif defined(__linux__)
+#if defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)
+   struct sigaction saved_sigill;
+   struct sigaction saved_sigfpe;
+
+   /* Save the original signal handlers.
+    */
+   sigaction( SIGILL, NULL, &saved_sigill );
+   sigaction( SIGFPE, NULL, &saved_sigfpe );
+
+   signal( SIGILL, (void (*)(int))sigill_handler_sse );
+   signal( SIGFPE, (void (*)(int))sigfpe_handler_sse );
+
+   /* Emulate test for OSFXSR in CR4.  The OS will set this bit if it
+    * supports the extended FPU save and restore required for SSE.  If
+    * we execute an SSE instruction on a PIII and get a SIGILL, the OS
+    * doesn't support Streaming SIMD Exceptions, even if the processor
+    * does.
+    */
+   if ( gCpuCaps.hasSSE ) {
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE... " );
+
+//      __asm __volatile ("xorps %%xmm0, %%xmm0");
+      __asm __volatile ("xorps %xmm0, %xmm0");
+
+      if ( gCpuCaps.hasSSE ) {
+	 mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
+      } else {
+	 mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+      }
+   }
+
+   /* Emulate test for OSXMMEXCPT in CR4.  The OS will set this bit if
+    * it supports unmasked SIMD FPU exceptions.  If we unmask the
+    * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS
+    * doesn't support unmasked SIMD FPU exceptions.  If we get a SIGFPE
+    * as expected, we're okay but we need to clean up after it.
+    *
+    * Are we being too stringent in our requirement that the OS support
+    * unmasked exceptions?  Certain RedHat 2.2 kernels enable SSE by
+    * setting CR4.OSFXSR but don't support unmasked exceptions.  Win98
+    * doesn't even support them.  We at least know the user-space SSE
+    * support is good in kernels that do support unmasked exceptions,
+    * and therefore to be safe I'm going to leave this test in here.
+    */
+   if ( gCpuCaps.hasSSE ) {
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "Testing OS support for SSE unmasked exceptions... " );
+
+//      test_os_katmai_exception_support();
+
+      if ( gCpuCaps.hasSSE ) {
+	 mp_msg(MSGT_CPUDETECT,MSGL_V, "yes.\n" );
+      } else {
+	 mp_msg(MSGT_CPUDETECT,MSGL_V, "no!\n" );
+      }
+   }
+
+   /* Restore the original signal handlers.
+    */
+   sigaction( SIGILL, &saved_sigill, NULL );
+   sigaction( SIGFPE, &saved_sigfpe, NULL );
+
+   /* If we've gotten to here and the XMM CPUID bit is still set, we're
+    * safe to go ahead and hook out the SSE code throughout Mesa.
+    */
+   if ( gCpuCaps.hasSSE ) {
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE passed.\n" );
+   } else {
+      mp_msg(MSGT_CPUDETECT,MSGL_V, "Tests of OS support for SSE failed!\n" );
+   }
+#else
+   /* We can't use POSIX signal handling to test the availability of
+    * SSE, so we disable it by default.
+    */
+   mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, disabling to be safe.\n" );
+   gCpuCaps.hasSSE=0;
+#endif /* _POSIX_SOURCE && X86_FXSR_MAGIC */
+#else
+   /* Do nothing on other platforms for now.
+    */
+   mp_msg(MSGT_CPUDETECT,MSGL_WARN, "Cannot test OS support for SSE, leaving disabled.\n" );
+   gCpuCaps.hasSSE=0;
+#endif /* __linux__ */
+}
+#else /* ARCH_X86 || ARCH_X86_64 */
+
+#ifdef SYS_DARWIN
+#include <sys/sysctl.h>
+#else
+#ifndef __AMIGAOS4__
+#include <signal.h>
+#include <setjmp.h>
+
+static sigjmp_buf jmpbuf;
+static volatile sig_atomic_t canjump = 0;
+
+static void sigill_handler (int sig)
+{
+    if (!canjump) {
+        signal (sig, SIG_DFL);
+        raise (sig);
+    }
+    
+    canjump = 0;
+    siglongjmp (jmpbuf, 1);
+}
+#endif //__AMIGAOS4__
+#endif
+
+void GetCpuCaps( CpuCaps *caps)
+{
+	caps->cpuType=0;
+	caps->cpuModel=0;
+	caps->cpuStepping=0;
+	caps->hasMMX=0;
+	caps->hasMMX2=0;
+	caps->has3DNow=0;
+	caps->has3DNowExt=0;
+	caps->hasSSE=0;
+	caps->hasSSE2=0;
+	caps->isX86=0;
+	caps->hasAltiVec = 0;
+#ifdef HAVE_ALTIVEC   
+#ifdef SYS_DARWIN   
+/*
+  rip-off from ffmpeg altivec detection code.
+  this code also appears on Apple's AltiVec pages.
+ */
+        {
+                int sels[2] = {CTL_HW, HW_VECTORUNIT};
+                int has_vu = 0;
+                size_t len = sizeof(has_vu);
+                int err;
+
+                err = sysctl(sels, 2, &has_vu, &len, NULL, 0);   
+
+                if (err == 0)
+                        if (has_vu != 0)
+                                caps->hasAltiVec = 1;
+        }
+#else /* SYS_DARWIN */
+#ifdef __AMIGAOS4__
+        ULONG result = 0;
+
+        GetCPUInfoTags(GCIT_VectorUnit, &result, TAG_DONE);
+        if (result == VECTORTYPE_ALTIVEC)
+        	caps->hasAltiVec = 1;
+#else
+/* no Darwin, do it the brute-force way */
+/* this is borrowed from the libmpeg2 library */
+        {
+          signal (SIGILL, sigill_handler);
+          if (sigsetjmp (jmpbuf, 1)) {
+            signal (SIGILL, SIG_DFL);
+          } else {
+            canjump = 1;
+            
+            asm volatile ("mtspr 256, %0\n\t"
+                          "vand %%v0, %%v0, %%v0"
+                          :
+                          : "r" (-1));
+            
+            signal (SIGILL, SIG_DFL);
+            caps->hasAltiVec = 1;
+          }
+        }
+#endif //__AMIGAOS4__
+#endif /* SYS_DARWIN */
+        mp_msg(MSGT_CPUDETECT,MSGL_INFO,"AltiVec %sfound\n", (caps->hasAltiVec ? "" : "not "));
+#endif /* HAVE_ALTIVEC */
+
+#ifdef ARCH_IA64
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Intel Itanium\n");
+#endif
+
+#ifdef ARCH_SPARC
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Sun Sparc\n");
+#endif
+
+#ifdef ARCH_ARMV4L
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: ARM\n");
+#endif
+
+#ifdef ARCH_POWERPC
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: PowerPC\n");
+#endif
+
+#ifdef ARCH_ALPHA
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Digital Alpha\n");
+#endif
+
+#ifdef ARCH_SGI_MIPS
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: SGI MIPS\n");
+#endif
+
+#ifdef ARCH_PA_RISC
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: Hewlett-Packard PA-RISC\n");
+#endif
+
+#ifdef ARCH_S390
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: IBM S/390\n");
+#endif
+
+#ifdef ARCH_S390X
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO,"CPU: IBM S/390X\n");
+#endif
+
+#ifdef ARCH_VAX
+	mp_msg(MSGT_CPUDETECT,MSGL_INFO, "CPU: Digital VAX\n" );
+#endif
+}
+#endif /* !ARCH_X86 */

Modified: vic/branches/mpeg4/ffmpeg/postproc/cpudetect.h
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/cpudetect.h	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/cpudetect.h	Thu Oct 12 10:48:22 2006
@@ -1,6 +1,8 @@
 #ifndef CPUDETECT_H
 #define CPUDETECT_H
 
+#include "config.h"
+
 #define CPUTYPE_I386	3
 #define CPUTYPE_I486	4
 #define CPUTYPE_I586	5
@@ -48,6 +50,7 @@
 	unsigned cl_size; /* size of cache line */
         int hasAltiVec;
 	int hasTSC;
+	char cpuname[50];
 } CpuCaps;
 
 extern CpuCaps gCpuCaps;

Added: vic/branches/mpeg4/ffmpeg/postproc/cputable.h
==============================================================================
--- (empty file)
+++ vic/branches/mpeg4/ffmpeg/postproc/cputable.h	Thu Oct 12 10:48:22 2006
@@ -0,0 +1,528 @@
+/* cputable.h - Maps CPUID to real CPU name.
+ * Copyleft 2001 by Felix Buenemann <atmosfear at users dot sourceforge dot net>
+ * This file comes under the GNU GPL, see www.fsf.org for more info!
+ * Family F codenames owe much thanks to Neil Phillips, author of x86test.
+ */
+
+#define MAX_VENDORS 8 /* Number of CPU Vendors */
+
+//#define N_UNKNOWN "unknown"
+//#define N_UNKNOWNEXT "unknown extended model"
+#define N_UNKNOWN "" 
+#define N_UNKNOWNEXT ""
+
+#define F_UNKNOWN { \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN, \
+N_UNKNOWN \
+}
+
+static const char *cpuname
+		/* Vendor */ [MAX_VENDORS]
+			/* Family */ [16]
+				/* Model  */ [16]
+	={
+		/* Intel Corporation, "GenuineIntel" */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 i386 */ F_UNKNOWN, /* XXX new 386 chips may support CPUID! */
+			/* 4 i486 */ {
+				/* 0 */ "i486DX-25/33", /*  only few of these */
+				/* 1 */ "i486DX-50",    /* support CPUID!     */
+				/* 2 */ "i486SX",
+				/* 3 */ "i486DX2", /* CPUID only on new chips! */
+				/* 4 */ "i486SL",
+				/* 5 */ "i486SX2",
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ "i486DX2/write-back", /* returns 3 in write-through mode */
+				/* 8 */ "i486DX4",
+				/* 9 */ "i486DX4/write-back",
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWNEXT 
+			},
+			/* 5 i586 */ {
+				/* 0 */ "Pentium P5 A-step",
+				/* 1 */ "Pentium P5",
+				/* 2 */ "Pentium P54C",
+				/* 3 */ "Pentium OverDrive P24T",
+				/* 4 */ "Pentium MMX P55C",
+				/* 5 */ N_UNKNOWN, /* XXX DX4 OverDrive? */ 
+				/* 6 */ N_UNKNOWN, /* XXX P5 OverDrive? */
+				/* 7 */ "Pentium P54C (new)",
+				/* 8 */ "Pentium MMX P55C (new)",
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWNEXT 
+			},
+			/* 6 i686 */ {
+				/* 0 */ "PentiumPro A-step",
+				/* 1 */ "PentiumPro",
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ "Pentium II Klamath/Pentium II OverDrive",
+				/* 4 */ N_UNKNOWN, /* XXX P55CT - OverDrive for P54? */ 
+				/* 5 */ "Celeron Covington/Pentium II Deschutes,Tonga/Pentium II Xeon",
+				/* 6 */ "Celeron A Mendocino/Pentium II Dixon",
+				/* 7 */ "Pentium III Katmai/Pentium III Xeon Tanner",
+				/* 8 */ "Celeron 2/Pentium III Coppermine,Geyserville",
+				/* 9 */ "Pentium M Banias", /* XXX check */
+				/* A */ "Pentium III Xeon Cascades",
+				/* B */ "Celeron 2/Pentium III Tualatin",
+				/* C */ N_UNKNOWN, 
+				/* D */ "Pentium M Dothan", 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWNEXT 
+			},
+			/* 7 Itanium */ { /* XXX check */
+				/* 0 */ "Itanium Merced", 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWNEXT 
+			},
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F extended family (P4/new IA-64)*/ {
+				/* 0 */ "Pentium 4 Willamette; Xeon Foster",
+				/* 1 */ "Pentium 4 Willamette; Xeon Foster",
+				/* 2 */ "Pentium 4/Celeron 4 Northwood; Pentium 4 EE/Xeon Prestonia,Gallatin",
+				/* 3 */ "Pentium 4/Celeron D Prescott; Xeon Nocona",
+				/* 4 */ "Pentium 4/Celeron D Prescott; Pentium D/XE Smithfield; Xeon Nocona,Irwindale",
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWNEXT 
+			}
+			#if 0 /* out of table index boundaries */
+			/* 1F Itanium 2 */ { /* XXX check */
+				/* 0 */ "Itanium 2 McKinley", 
+				/* 1 */ "Itanium 2 Madison", /* I coded on that :-) */
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWNEXT 
+			},
+			#endif
+		},
+		/* United Microelectronics Corporation, "UMC UMC UMC " */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 486 (U5) */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ "486DX U5D",
+				/* 2 */ "486SX U5S",
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 5 */ F_UNKNOWN, 
+			/* 6 */ F_UNKNOWN, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F */ F_UNKNOWN 
+		},
+		/* Advanced Micro Devices, "AuthenticAMD" (very rare: "AMD ISBETTER") */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 486/5x86 */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ "486DX2",
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ "486DX2/write-back",
+				/* 8 */ "486DX4/5x86",
+				/* 9 */ "486DX4/write-back",
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* E */ "5x86",
+				/* F */ "5x86/write-back"
+			}, 
+			/* 5 K5/K6 */ {
+				/* 0 */ "K5 SSA5 (PR75,PR90,PR100)",
+				/* 1 */ "K5 5k86 (PR120,PR133)",
+				/* 2 */ "K5 5k86 (PR166)",
+				/* 3 */ "K5 5k86 (PR200)",
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ "K6",
+				/* 7 */ "K6 Little Foot",
+				/* 8 */ "K6-2",
+				/* 9 */ "K6-III Chomper",
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ "K6-2+/K6-III+ Sharptooth",
+				/* E */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 6 K7 */ {
+				/* 0 */ N_UNKNOWN, /* Argon? */
+				/* 1 */ "Athlon K7",
+				/* 2 */ "Athlon K75 Pluto,Orion",
+				/* 3 */ "Duron Spitfire",
+				/* 4 */ "Athlon Thunderbird",
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ "Duron/Athlon 4/MP/XP Palomino",
+				/* 7 */ "Duron Morgan,Camaro",
+				/* 8 */ "Sempron/Athlon MP/XP Thoroughbred; Duron Applebred", 
+				/* 9 */ N_UNKNOWN,
+				/* A */ "Sempron/Athlon MP/XP/XP-M Barton,Thorton", 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F K8 */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ "Opteron Egypt,Italy,Denmark", 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ "Athlon 64 X2 Manchester,Toledo", 
+				/* 4 */ "Athlon 64 Clawhammer; Athlon 64 X2 Toledo; Turion Newark,Lancaster", 
+				/* 5 */ "Athlon 64 FX/Opteron Sledgehammer,Athens,Troy,Venus", 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ "Athlon 64/FX Sledgehammer,San Diego,Venice", 
+				/* 8 */ "Mobile Athlon 64 Newcastle; Mobile Sempron Dublin", 
+				/* 9 */ N_UNKNOWN,
+				/* A */ N_UNKNOWN, 
+				/* B */ "Athlon 64 Newcastle; Athlon 64 X2 Manchester", 
+				/* E */ N_UNKNOWN, 
+				/* C */ "Athlon 64 Newcastle,Odesssa,Oakville,Venice; Sempron Palermo,Paris,Dublin", 
+				/* D */ N_UNKNOWN, 
+				/* F */ "Athlon 64 Newcastle,Winchester,San Diego,Venice; Sempron Palermo" 
+			}
+				
+		},
+		/* Cyrix Corp./VIA Inc., "CyrixInstead" */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 5x86 */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ "MediaGX", 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ "5x86", /* CPUID maybe only on newer chips */
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 5 M1 */ {
+				/* 0 */ "M1 test-sample", /*?*/ 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ "6x86 M1", 
+				/* 3 */ "6x86L M1", 
+				/* 4 */ "GXm", 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 6 M2 */ {
+				/* 0 */ "6x86MX M2/M-II", 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ "Cyrix III Joshua (M2 core)", 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F */ F_UNKNOWN 
+		},
+		/* NexGen Inc., "NexGenDriven" */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 */ F_UNKNOWN, 
+			/* 5 Nx586 */ {
+				/* 0 */ "Nx586/Nx586FPU", /* only newer ones support CPUID! */ 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 6 */ F_UNKNOWN, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F */ F_UNKNOWN 
+		},
+		/* IDT/Centaur/VIA, "CentaurHauls" */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 */ F_UNKNOWN, 
+			/* 5 IDT C6 WinChip */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ "WinChip C6", 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ "Samuel", 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ "WinChip 2 C6+,W2,W2A,W2B", 
+				/* 9 */ "WinChip 3 W3", 
+				/* A */ "WinChip 4 W4A",  /* XXX check */
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 6 VIA C3 */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ "Cyrix III Samuel (WinChip C5A core)", 
+				/* 7 */ "C3 Samuel 2 (WinChip C5B core)/C3 Ezra", 
+				/* 8 */ "C3 Ezra-T",
+				/* 9 */ "C3 Nehemiah", 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F */ F_UNKNOWN 
+		},
+		/* Rise, "RiseRiseRise" */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 */ F_UNKNOWN, 
+			/* 5 mP6 */ {
+				/* 0 */ "mP6 iDragon 6401,6441 Kirin", 
+				/* 1 */ "mP6 iDragon 6510 Lynx", 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ N_UNKNOWN, 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ "mP6 iDragon II", 
+				/* 9 */ "mP6 iDragon II (new)", 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 6 */ F_UNKNOWN, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F */ F_UNKNOWN 
+		},
+		/* Transmeta, "GenuineTMx86" */ {
+			/* 0 */ F_UNKNOWN, 
+			/* 1 */ F_UNKNOWN, 
+			/* 2 */ F_UNKNOWN, 
+			/* 3 */ F_UNKNOWN, 
+			/* 4 */ F_UNKNOWN, 
+			/* 5 Crusoe */ {
+				/* 0 */ N_UNKNOWN, 
+				/* 1 */ N_UNKNOWN, 
+				/* 2 */ N_UNKNOWN, 
+				/* 3 */ N_UNKNOWN, 
+				/* 4 */ "Crusoe TM3x00,TM5x00", 
+				/* 5 */ N_UNKNOWN, 
+				/* 6 */ N_UNKNOWN, 
+				/* 7 */ N_UNKNOWN, 
+				/* 8 */ N_UNKNOWN, 
+				/* 9 */ N_UNKNOWN, 
+				/* A */ N_UNKNOWN, 
+				/* B */ N_UNKNOWN, 
+				/* E */ N_UNKNOWN, 
+				/* C */ N_UNKNOWN, 
+				/* D */ N_UNKNOWN, 
+				/* F */ N_UNKNOWN 
+			}, 
+			/* 6 */ F_UNKNOWN, 
+			/* 7 */ F_UNKNOWN, 
+			/* 8 */ F_UNKNOWN, 
+			/* 9 */ F_UNKNOWN, 
+			/* A */ F_UNKNOWN, 
+			/* B */ F_UNKNOWN, 
+			/* C */ F_UNKNOWN, 
+			/* D */ F_UNKNOWN, 
+			/* E */ F_UNKNOWN, 
+			/* F */ F_UNKNOWN 
+		}
+};
+
+#undef N_UNKNOWNEXT
+#undef N_UNKNOWN
+#undef F_UNKNOWN
+
+static const struct {
+	char string[13];
+	char name[48];
+} cpuvendors[MAX_VENDORS] ={
+	{"GenuineIntel","Intel"},
+	{"UMC UMC UMC ","United Microelectronics Corporation"},
+	{"AuthenticAMD","Advanced Micro Devices"},
+	{"CyrixInstead","Cyrix/VIA"},
+	{"NexGenDriven","NexGen"},
+	{"CentaurHauls","IDT/Centaur/VIA"},
+	{"RiseRiseRise","Rise"},
+	{"GenuineTMx86","Transmeta"}
+};	
+

Modified: vic/branches/mpeg4/ffmpeg/postproc/deinterlace.cpp
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/deinterlace.cpp	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/deinterlace.cpp	Thu Oct 12 10:48:22 2006
@@ -5,16 +5,16 @@
  * Local protypes
  *****************************************************************************/
 static void MergeGeneric ( void *, const void *, const void *, size_t );
-#if defined(CAN_COMPILE_C_ALTIVEC)
+#if defined(HAVE_ALTIVEC)
 static void MergeAltivec ( void *, const void *, const void *, size_t );
 #endif
-#if defined(CAN_COMPILE_MMX)
+#if defined(HAVE_MMX)
 static void MergeMMX     ( void *, const void *, const void *, size_t );
 #endif
-#if defined(CAN_COMPILE_SSE)
+#if defined(HAVE_SSE2)
 static void MergeSSE2    ( void *, const void *, const void *, size_t );
 #endif
-#if defined(CAN_COMPILE_MMX) || defined(CAN_COMPILE_SSE)
+#if defined(HAVE_MMX) || defined(HAVE_SSE2)
 static void EndMMX       ( void );
 #endif
 
@@ -25,46 +25,21 @@
 static int cpu_info;   
  
 Deinterlace::Deinterlace(){
-  cpu_check();
-  init();
-}
-
-void Deinterlace::cpu_check() { 
-  cpu_info =  CPU_CAPABILITY_SSE2 ; 
-}
-
-void Deinterlace::init(){
-
-#if defined(CAN_COMPILE_C_ALTIVEC)
-    if( cpu_info & CPU_CAPABILITY_ALTIVEC )
-    {
-        Merge = MergeAltivec;
-        EndMerge = NULL;
-    }
-#endif
-#if defined(CAN_COMPILE_SSE)
-    if( cpu_info & CPU_CAPABILITY_SSE2 )
-    {
+    if( gCpuCaps.hasSSE2 ){
         Merge = MergeSSE2;
         EndMerge = EndMMX;
-    }
-    else
-#endif
-#if defined(CAN_COMPILE_MMX)
-    if( cpu_info & CPU_CAPABILITY_MMX )
-    {
+    }else if( gCpuCaps.hasMMX ){
         Merge = MergeMMX;
         EndMerge = EndMMX;
-    }
-    else
-#endif
-    {
+    }else if( gCpuCaps.hasAltivec ){
+        Merge = MergeAltivec;
+	EndMerge = NULL;
+    }else{
         Merge = MergeGeneric;
         EndMerge = NULL;
     }	
 }
 
-
 static void MergeGeneric( void *_p_dest, const void *_p_s1,
                           const void *_p_s2, size_t i_bytes )
 {
@@ -93,7 +68,7 @@
     }
 }
 
-#if defined(CAN_COMPILE_MMX)
+#if defined(HAVE_MMX)
 static void MergeMMX( void *_p_dest, const void *_p_s1, const void *_p_s2,
                       size_t i_bytes )
 {
@@ -122,7 +97,7 @@
 }
 #endif
 
-#if defined(CAN_COMPILE_SSE)
+#if defined(HAVE_SSE2)
 static void MergeSSE2( void *_p_dest, const void *_p_s1, const void *_p_s2,
                        size_t i_bytes )
 {
@@ -155,14 +130,14 @@
 }
 #endif
 
-#if defined(CAN_COMPILE_MMX) || defined(CAN_COMPILE_SSE)
+#if defined(HAVE_MMX) || defined(HAVE_SSE2)
 static void EndMMX( void )
 {
     __asm__ __volatile__( "emms" );
 }
 #endif
 
-#ifdef CAN_COMPILE_C_ALTIVEC
+#ifdef HAVE_ALTIVEC
 static void MergeAltivec( void *_p_dest, const void *_p_s1,
                           const void *_p_s2, size_t i_bytes )
 {

Modified: vic/branches/mpeg4/ffmpeg/postproc/deinterlace.h
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/deinterlace.h	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/deinterlace.h	Thu Oct 12 10:48:22 2006
@@ -2,6 +2,7 @@
 #define deinterlace_h
 
 #include <string.h>
+#include "config.h"
 
 /*****************************************************************************
  * CPU capabilities
@@ -27,11 +28,7 @@
 #define DEINTERLACE_BLEND   3
 #define DEINTERLACE_BOB     4
 #define DEINTERLACE_LINEAR  5
-
-#ifndef WINDOWS
-#define CAN_COMPILE_SSE
-#define CAN_COMPILE_MMX
-#endif
+
 //****************************************************************************
 
 
@@ -41,8 +38,6 @@
     static void Render(uint8_t  *source, int w, int h);
    
   protected:
-    void init();
-    void cpu_check();
     static void RenderBlend( uint8_t  *target, uint8_t  *source, int w, int h);  
     
 }deinterlace;  // for gobal initialization

Modified: vic/branches/mpeg4/ffmpeg/postproc/mp_msg.c
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/mp_msg.c	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/mp_msg.c	Thu Oct 12 10:48:22 2006
@@ -66,7 +66,7 @@
     va_list va;
     char tmp[MSGSIZE_MAX];
     
-    if (!mp_msg_test(mod, lev)) return; // do not display
+    //if (!mp_msg_test(mod, lev)) return; // do not display
     va_start(va, format);
     vsnprintf(tmp, MSGSIZE_MAX, format, va);
     va_end(va);

Modified: vic/branches/mpeg4/ffmpeg/postproc/swscale.c
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/swscale.c	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/swscale.c	Thu Oct 12 10:48:22 2006
@@ -54,7 +54,6 @@
 #include <math.h>
 #include <stdio.h>
 #include <unistd.h>
-#include "config.h"
 #include "mangle.h"
 #include <assert.h>
 #ifdef HAVE_MALLOC_H
@@ -1389,34 +1388,48 @@
 #ifdef RUNTIME_CPUDETECT
 #if defined(ARCH_X86) || defined(ARCH_X86_64)
 	// ordered per speed fasterst first
-	if(flags & SWS_CPU_CAPS_MMX2)
+	if(flags & SWS_CPU_CAPS_MMX2){
+		printf("SWSCALE: MMX2\n");
 		return swScale_MMX2;
-	else if(flags & SWS_CPU_CAPS_3DNOW)
+	}else if(flags & SWS_CPU_CAPS_MMX){
+		printf("SWSCALE: 3DNow\n");
 		return swScale_3DNow;
-	else if(flags & SWS_CPU_CAPS_MMX)
+	}else if(flags & SWS_CPU_CAPS_3DNOW){
+		printf("SWSCALE: MMX\n");	
 		return swScale_MMX;
-	else
+	}else{
+		printf("SWSCALE: C\n");		
 		return swScale_C;
+	}
 
 #else
 #ifdef ARCH_POWERPC
-	if(flags & SWS_CPU_CAPS_ALTIVEC)
+	if(flags & SWS_CPU_CAPS_ALTIVEC){
+ 	  printf("SWSCALE: Altivec\n");	
 	  return swScale_altivec;
-	else
+	}else{		
+	  printf("SWSCALE: C\n");	
 	  return swScale_C;
+	}
 #endif
+	printf("SWSCALE: C\n");
 	return swScale_C;
 #endif
 #else //RUNTIME_CPUDETECT
 #ifdef HAVE_MMX2
+	printf("SWSCALE: MMX2\n");
 	return swScale_MMX2;
 #elif defined (HAVE_3DNOW)
+	printf("SWSCALE: 3DNow\n");
 	return swScale_3DNow;
 #elif defined (HAVE_MMX)
+	printf("SWSCALE: MMX\n");
 	return swScale_MMX;
 #elif defined (HAVE_ALTIVEC)
+	printf("SWSCALE: Altivec\n");
 	return swScale_altivec;
 #else
+	printf("SWSCALE: C\n");
 	return swScale_C;
 #endif
 #endif //!RUNTIME_CPUDETECT
@@ -1847,6 +1860,7 @@
 	flags |= SWS_CPU_CAPS_ALTIVEC;
 #endif
 #endif
+
 	if(clip_table[512] != 255) globalInit();
 	if(rgb15to16 == NULL) sws_rgb2rgb_init(flags);
 

Modified: vic/branches/mpeg4/ffmpeg/postproc/swscale.h
==============================================================================
--- vic/branches/mpeg4/ffmpeg/postproc/swscale.h	(original)
+++ vic/branches/mpeg4/ffmpeg/postproc/swscale.h	Thu Oct 12 10:48:22 2006
@@ -28,7 +28,8 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
+	
+#include "config.h"
 #include "img_format.h"
 /* values for the flags, the stuff on the command line is different */
 #define SWS_FAST_BILINEAR 1

Modified: vic/branches/mpeg4/main.cpp
==============================================================================
--- vic/branches/mpeg4/main.cpp	(original)
+++ vic/branches/mpeg4/main.cpp	Thu Oct 12 10:48:22 2006
@@ -13,7 +13,7 @@
  * 3. All advertising materials mentioning features or use of this software
  *    must display the following acknowledgement:
  *	This product includes software developed by the University of
- *	California, Berkeley and the Network Research Group at
+ 	California, Berkeley and the Network Research Group at
  *	Lawrence Berkeley Laboratory.
  * 4. Neither the name of the University nor of the Laboratory may be used
  *    to endorse or promote products derived from this software without
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  */
 static const char rcsid[] =
-    "@(#) $Header$ (LBL)";
+"@(#) $Header$ (LBL)";
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -70,6 +70,7 @@
 #include <X11/Xutil.h>
 
 extern "C" {
+#include "postproc/cpudetect.h"
 #include <tk.h>
 #ifdef USE_SHM
 #ifdef sgi
@@ -77,17 +78,17 @@
 #endif
 #include <X11/extensions/XShm.h>
 #ifdef _AIX
-extern Bool XShmQueryExtension (Display *dpy);
+	extern Bool XShmQueryExtension (Display *dpy);
 #endif
 #ifdef sgi
 #undef XShmAttach
-int XShmAttach(Display*, XShmSegmentInfo*);
+	int XShmAttach(Display*, XShmSegmentInfo*);
 #endif
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #if defined(sun) && !defined(__svr4__)
-int shmget(key_t, int, int);
-int shmctl(int shmid, int cmd, struct shmid_ds *);
+	int shmget(key_t, int, int);
+	int shmctl(int shmid, int cmd, struct shmid_ds *);
 #endif
 #endif
 }
@@ -110,61 +111,61 @@
 #include <sys/utsname.h>
 #define gethostname(name, len) { \
 	struct utsname _uts_; \
-\
+	\
 	if (uname(&_uts_) < 0) { \
 		perror("uname"); \
 		exit(1); \
 	}\
-\
+	\
 	strcpy((name), _uts_.nodename); \
 }
 #endif
- 
-static void
+
+	static void
 usage(char *szOffending)
 {
-char win_usage[] = "\
-VIC is a multicast (or unicast) video tool. It is best to start it\n\
-using a multicast directory tool, like sdr or multikit. If desired VIC\n\
-can be launched from the command line using:\n\n\
-vic <address>/<port>\n\n\
-where <address> is machine name, or a multicast IP address, and <port> is\n\
-the connection identifier (an even number between 1024-65536).\n\n\
-For more details see:\n\n\
-http://www-mice.cs.ucl.ac.uk/multimedia/software/vic/faq.html\n\
+	char win_usage[] = "\
+			    VIC is a multicast (or unicast) video tool. It is best to start it\n\
+			    using a multicast directory tool, like sdr or multikit. If desired VIC\n\
+			    can be launched from the command line using:\n\n\
+			    vic <address>/<port>\n\n\
+			    where <address> is machine name, or a multicast IP address, and <port> is\n\
+			    the connection identifier (an even number between 1024-65536).\n\n\
+			    For more details see:\n\n\
+			    http://www-mice.cs.ucl.ac.uk/multimedia/software/vic/faq.html\n\
 Options: vic [-HPs] [-A nv|ivs|rtp] [-B maxbps] [-C conf]\n\
-\t[-c ed|gray|od|quantize] [-D device] [-d display]\n\
-\t[-f bvc|cellb|h261|jpeg|nv|mpeg4|h264] [-F maxfps] [-i ifAddr ] [-I channel]\n\
-\t[-K key ] [-L flowLabel (ip6 only)] [-l (creates log file)]\n\
-\t[-M colormap] [-m mtu] [-N session] [-n atm|ip|ip6|rtip]\n\
-\t[-o clipfile] [-t ttl] [-U interval] [-u script] [-v version] [-V visual]\n\
-\t[-x ifIndex (ip6 only)] [-X resource=value] [-j numlayers] dest/port[/fmt/ttl]\n";
+	 \t[-c ed|gray|od|quantize] [-D device] [-d display]\n\
+	 \t[-f bvc|cellb|h261|jpeg|nv|mpeg4|h264] [-F maxfps] [-i ifAddr ] [-I channel]\n\
+	 \t[-K key ] [-L flowLabel (ip6 only)] [-l (creates log file)]\n\
+	 \t[-M colormap] [-m mtu] [-N session] [-n atm|ip|ip6|rtip]\n\
+	 \t[-o clipfile] [-t ttl] [-U interval] [-u script] [-v version] [-V visual]\n\
+	 \t[-x ifIndex (ip6 only)] [-X resource=value] [-j numlayers] dest/port[/fmt/ttl]\n";
 
-if (szOffending == NULL) {
-        szOffending = win_usage;
-}
+	if (szOffending == NULL) {
+		szOffending = win_usage;
+	}
 
 #ifdef WIN32
-MessageBox(NULL, szOffending, "VIC Usage", MB_ICONINFORMATION | MB_OK);
+	MessageBox(NULL, szOffending, "VIC Usage", MB_ICONINFORMATION | MB_OK);
 #else
-printf(win_usage);
-if (szOffending) {
-        printf(szOffending);
-}
+	printf(win_usage);
+	if (szOffending) {
+		printf(szOffending);
+	}
 #endif
 	exit(1);
 }
 
 static class UsageCommand : public TclObject {
-public:
-	UsageCommand() : TclObject("usage") {}
-	int command(int argc, const char*const* argv) {
-		UNUSED(argc);
-		UNUSED(argv);
-		usage(NULL);
-		/*NOTREACHED*/
-		return (0);
-	}
+	public:
+		UsageCommand() : TclObject("usage") {}
+		int command(int argc, const char*const* argv) {
+			UNUSED(argc);
+			UNUSED(argv);
+			usage(NULL);
+			/*NOTREACHED*/
+			return (0);
+		}
 } cmd_usage;
 
 #ifndef SIGARGS
@@ -177,66 +178,66 @@
 
 extern void adios();
 
-static SIGRET
+	static SIGRET
 ciao(SIGARGS)
 {
 	adios();
 }
 
 static class AdiosCommand : public TclObject {
-public:
-	AdiosCommand() : TclObject("adios_rtcp") {}
-	int command(int argc, const char*const* argv) {
-		UNUSED(argc);
-		UNUSED(argv);
-		adios();
-		/*NOTREACHED*/
-		return (0);
-	}
+	public:
+		AdiosCommand() : TclObject("adios_rtcp") {}
+		int command(int argc, const char*const* argv) {
+			UNUSED(argc);
+			UNUSED(argv);
+			adios();
+			/*NOTREACHED*/
+			return (0);
+		}
 } cmd_adios;
 
 static class HaveFontCommand : public TclObject {
-public:
-	HaveFontCommand() : TclObject("havefont") {}
-	int command(int argc, const char*const* argv) {
-		Tcl& t = Tcl::instance();
-		if (argc != 2)
-			t.result("0");
-		else {
-			Tk_Window tk = t.tkmain();
-			Tk_Uid uid = Tk_GetUid((char*)argv[1]);
-			Tk_Font p = Tk_GetFont(t.interp(), tk, uid);
-			t.result(p != 0 ? "1" : "0");
+	public:
+		HaveFontCommand() : TclObject("havefont") {}
+		int command(int argc, const char*const* argv) {
+			Tcl& t = Tcl::instance();
+			if (argc != 2)
+				t.result("0");
+			else {
+				Tk_Window tk = t.tkmain();
+				Tk_Uid uid = Tk_GetUid((char*)argv[1]);
+				Tk_Font p = Tk_GetFont(t.interp(), tk, uid);
+				t.result(p != 0 ? "1" : "0");
+			}
+			return (TCL_OK);
 		}
-		return (TCL_OK);
-	}
 } cmd_havefont;
 
 static class GetHostNameCommand : public TclObject {
-public:
-	GetHostNameCommand() : TclObject("gethostname") {}
-	int command(int argc, const char*const* argv) {
-		UNUSED(argc);
-		UNUSED(argv);
-		Tcl& tcl = Tcl::instance();
-		char* bp = tcl.buffer();
-		tcl.result(bp);
-		gethostname(bp, MAXHOSTNAMELEN);
-		return (TCL_OK);
-	}
+	public:
+		GetHostNameCommand() : TclObject("gethostname") {}
+		int command(int argc, const char*const* argv) {
+			UNUSED(argc);
+			UNUSED(argv);
+			Tcl& tcl = Tcl::instance();
+			char* bp = tcl.buffer();
+			tcl.result(bp);
+			gethostname(bp, MAXHOSTNAMELEN);
+			return (TCL_OK);
+		}
 } cmd_gethostname;
 
 extern "C" char version[];
 
 static class VersionCommand : public TclObject {
-public:
-	VersionCommand() : TclObject("version") {}
-	int command(int argc, const char*const* argv) {
-		UNUSED(argc);
-		UNUSED(argv);
-		Tcl::instance().result(version);
-		return (TCL_OK);
-	}
+	public:
+		VersionCommand() : TclObject("version") {}
+		int command(int argc, const char*const* argv) {
+			UNUSED(argc);
+			UNUSED(argv);
+			Tcl::instance().result(version);
+			return (TCL_OK);
+		}
 } cmd_version;
 
 #ifndef USE_SHM
@@ -253,7 +254,7 @@
 }
 #endif
 
-static int
+	static int
 noXShm(ClientData, XErrorEvent*)
 {
 	/*
@@ -273,29 +274,29 @@
  * if the X server says we can, and we're on the same
  * host as the X server, then we are golden.
  */
-static void
+	static void
 checkXShm(Tk_Window tk, const char*)
 {
 	Display* dpy = Tk_Display(tk);
 
 	if (XShmQueryExtension(dpy) == 0) {
 		fprintf(stderr,
-		        "vic: warning: server doesn't support shared memory\n");
+				"vic: warning: server doesn't support shared memory\n");
 		use_shm = 0;
 		return;
 	}
 	XShmSegmentInfo si;
-  	if ((si.shmid = shmget(IPC_PRIVATE, 512, IPC_CREAT|0777)) < 0) {
+	if ((si.shmid = shmget(IPC_PRIVATE, 512, IPC_CREAT|0777)) < 0) {
 		if (use_shm)
 			fprintf(stderr,
-				"vic: warning: no shared memory available\n");
+					"vic: warning: no shared memory available\n");
 		use_shm = 0;
 		return;
 	}
 	si.readOnly = 1;
 	XSync(dpy, 0);
 	Tk_ErrorHandler handler = Tk_CreateErrorHandler(dpy, -1, -1, -1,
-							noXShm, 0);
+			noXShm, 0);
 	XShmAttach(dpy, &si);
 	XSync(dpy, 0);
 	XShmDetach(dpy, &si);
@@ -311,7 +312,7 @@
 extern "C" int opterr;
 #endif
 
-char*
+	char*
 parse_assignment(char* cp)
 {
 	cp = strchr(cp, '=');
@@ -344,7 +345,7 @@
 		memcpy(&(addru.s_addr), hostp->h_addr_list[0], 4);
 		id = addru.s_addr;
 	}
-  
+
 	return id;
 }
 #endif
@@ -352,7 +353,7 @@
 #ifdef __svr4__
 #include <sys/systeminfo.h>
 #define gethostid xgethostid
-u_int32_t
+	u_int32_t
 gethostid()
 {
 	char wrk[32];
@@ -365,7 +366,7 @@
 /*
  * From the RTP spec.
  */
-u_int32_t
+	u_int32_t
 heuristic_random()
 {
 	struct {
@@ -415,26 +416,26 @@
 #endif
 
 extern "C" {
-int
-TkPlatformInit(Tcl_Interp *interp)
-{
-	Tcl_SetVar(interp, "tk_library", ".", TCL_GLOBAL_ONLY);
+	int
+		TkPlatformInit(Tcl_Interp *interp)
+		{
+			Tcl_SetVar(interp, "tk_library", ".", TCL_GLOBAL_ONLY);
 #ifndef WIN32
-	extern void TkCreateXEventSource(void);
-	TkCreateXEventSource();
+			extern void TkCreateXEventSource(void);
+			TkCreateXEventSource();
 #endif
-	return (TCL_OK);
-}
+			return (TCL_OK);
+		}
 
-void *TkSetPlatformInit(int (*func)(Tcl_Interp *));
+	void *TkSetPlatformInit(int (*func)(Tcl_Interp *));
 
 }
 
-int
+	int
 main(int argc, const char** argv)
 {
 #ifdef __FreeBSD__
-        srandomdev(); //SV-XXX: FreeBSD
+	srandomdev(); //SV-XXX: FreeBSD
 #else
 	srandom(heuristic_random());
 #endif
@@ -480,6 +481,14 @@
 			usage(NULL);
 	}
 
+	/* CPU capabilities detection */
+	GetCpuCaps(&gCpuCaps);
+	printf("cpudetect: %s\n", gCpuCaps.cpuname);
+	printf("cpudetect: MMX=%d MMX2=%d SSE=%d SSE2=%d 3DNow=%d 3DNowExt=%d\n",  \
+	        gCpuCaps.hasMMX, gCpuCaps.hasMMX2, gCpuCaps.hasSSE, gCpuCaps.hasSSE2, \
+	       	gCpuCaps.has3DNow, gCpuCaps.has3DNowExt );
+
+	
 	Tcl::init("vic");
 	Tcl& tcl = Tcl::instance();
 

Modified: vic/branches/mpeg4/render/color-x11.cpp
==============================================================================
--- vic/branches/mpeg4/render/color-x11.cpp	(original)
+++ vic/branches/mpeg4/render/color-x11.cpp	Thu Oct 12 10:48:22 2006
@@ -44,6 +44,7 @@
 #include "vw.h"
 #include "renderer.h"
 #include "postproc/swscale.h"
+#include "postproc/cpudetect.h"
 
 class X11WindowRenderer : public WindowDitherer {
 public:
@@ -79,12 +80,31 @@
 				
 	  if(enable_xv){
 	    memcpy(pixbuf_, frm, framesize_*3/2);	  
-	  }else{ 	
+	  }else{ 
+	    if(!outw_ || !outh_	|| !width_ || !height_)
+	        return;
+
 	    if(resized()){
-	      if(sws_context)
+	      if(sws_context){
 	        sws_freeContext(sws_context);	
+		sws_context = NULL;
+	      }
+	      int flags = SWS_FAST_BILINEAR;
+	      flags |= (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0);
+	      flags |= (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0);
+	      flags |= (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0);
+	      flags |= (gCpuCaps.hasAltiVec ? SWS_CPU_CAPS_ALTIVEC : 0);
+	      
 	      sws_context = sws_getContext(width_, height_, IMGFMT_I420,
-	                 outw_, outh_, out_format, SWS_FAST_BILINEAR, NULL, NULL, NULL); 	   
+	                 outw_, outh_, out_format, flags, NULL, NULL, NULL); 	   
+	      printf("X11WindowRenderer: %dx%d ==> %dx%d\n", width_, height_, outw_, outh_);
+	      
+	      if(sws_context == NULL){
+		printf("X11WindowRenderer: error! cannot allocate memory for swscontext!\n");
+		return;
+	      }
+		      
+			    
 	      sws_src_stride[0] = width_;
 	      sws_src_stride[1] = sws_src_stride[2] = width_/2;
 	    

Modified: vic/branches/mpeg4/render/xvideo.cpp
==============================================================================
--- vic/branches/mpeg4/render/xvideo.cpp	(original)
+++ vic/branches/mpeg4/render/xvideo.cpp	Thu Oct 12 10:48:22 2006
@@ -1,9 +1,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "../config_arch.h"
+#include "postproc/config.h"
 
-#ifdef HAVE_SHM
+#ifdef USE_SHM
 #include <sys/ipc.h>
 #include <sys/shm.h>
 #endif
@@ -17,7 +17,7 @@
 }
 
 IMAGE_TYPE *CreateImage    ( Display *, EXTRA_ARGS, int, int );
-#ifdef HAVE_SHM
+#ifdef USE_SHM
 IMAGE_TYPE *CreateShmImage ( Display *, EXTRA_ARGS_SHM, int, int );
 #endif
 
@@ -315,7 +315,7 @@
 
 
 
-#ifdef HAVE_SHM
+#ifdef USE_SHM
 /*****************************************************************************
  * CreateShmImage: create an XImage or XvImage using shared memory extension
  *****************************************************************************
@@ -464,7 +464,7 @@
 {
 
 
-#ifdef HAVE_SHM
+#ifdef USE_SHM
     if( shared_memory )
     {
         /* Display rendered image using shared memory extension */
@@ -486,7 +486,7 @@
 #   endif
     }
     else
-#endif /* HAVE_SHM */
+#endif /* USE_SHM */
     {
         /* Use standard XPutImage -- this is gonna be slow ! */
 #ifdef HAVE_XVIDEO
@@ -534,7 +534,7 @@
   bytes_per_rgb = _bytes_per_rgb;
   
   
-#ifdef HAVE_SHM 
+#ifdef USE_SHM 
   if (XShmQueryExtension(display)){
     enable_shm = true;  	
     // printf("==> using shared memory.\n");
@@ -568,7 +568,7 @@
   
   if(yuv_image) IMAGE_FREE(yuv_image);
   
-#ifdef HAVE_SHM    
+#ifdef USE_SHM    
   if(enable_shm){
     yuv_image = CreateShmImage(display, 
     #ifdef HAVE_XVIDEO   
@@ -578,7 +578,7 @@
     #endif
       i_width, i_height );  
   }else
-#endif  // HAVE_SHM
+#endif  // USE_SHM
   {
     yuv_image = CreateImage(display,
     #ifdef HAVE_XVIDEO  
@@ -605,7 +605,7 @@
     XVideoReleasePort(display, xv_port);
   #endif  
   
-  #ifdef HAVE_SHM
+  #ifdef USE_SHM
   if(enable_shm){
     XShmDetach(display, &yuv_shminfo);
     if(shmdt( yuv_shminfo.shmaddr) <0 )

Modified: vic/branches/mpeg4/render/xvideo.h
==============================================================================
--- vic/branches/mpeg4/render/xvideo.h	(original)
+++ vic/branches/mpeg4/render/xvideo.h	Thu Oct 12 10:48:22 2006
@@ -1,7 +1,7 @@
 #ifndef _XVIDEO_H_
 #define _XVIDEO_H_
 
-#include "../config_arch.h"
+#include "postproc/config.h"
 
 #include "vic_tcl.h"
 extern "C"{
@@ -11,7 +11,7 @@
 }
 
 // XShm.h should be included before Xvlib.h
-#ifdef HAVE_SHM
+#ifdef USE_SHM
 #   include <X11/extensions/XShm.h>
 #endif
 
@@ -61,7 +61,7 @@
     vlc_fourcc_t o_chroma;
     
     // for shared memory
-    #ifdef HAVE_SHM
+    #ifdef USE_SHM
     XShmSegmentInfo  yuv_shminfo;
     #endif 
 



More information about the Sumover-dev mailing list