]> git.sesse.net Git - vlc/commitdiff
* Filter plugins. Not very polished (please don't look at how the dates are
authorSam Hocevar <sam@videolan.org>
Sun, 16 Dec 2001 16:18:36 +0000 (16:18 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 16 Dec 2001 16:18:36 +0000 (16:18 +0000)
    calculated!), but worth a try. Use the following flags:
     "--filter invert" for inverse video
     "--filter bob" for BOB deinterlacing
  * Fixed a potential segfault if the subtitle stream was encountered
    before the video stream.
  * Misc vout4 fixes.

28 files changed:
Makefile
Makefile.opts.in
configure
configure.in
include/common.h
include/config.h.in
include/modules_export.h
include/video.h
include/video_output.h
plugins/ac3_adec/ac3_adec.c
plugins/chroma/Makefile
plugins/chroma/chroma_common.h [new file with mode: 0644]
plugins/chroma/common.c [new file with mode: 0644]
plugins/chroma/transforms.h [new file with mode: 0644]
plugins/chroma/yv12_rgb8.c [new file with mode: 0644]
plugins/dummy/vout_dummy.c
plugins/filter/.cvsignore [new file with mode: 0644]
plugins/filter/Makefile [new file with mode: 0644]
plugins/filter/bob.c [new file with mode: 0644]
plugins/filter/invert.c [new file with mode: 0644]
plugins/mpeg_vdec/vpar_headers.c
plugins/sdl/vout_sdl.c
plugins/spudec/spu_decoder.c
plugins/x11/vout_common.c
plugins/x11/vout_xvideo.c
src/interface/main.c
src/video_output/video_output.c
src/video_output/vout_pictures.c

index b71c45d8e552b909ab0438491ddade156b14cac8..3b0c362100b1f395c7cc6f9bba5efc13d9088099 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ PLUGINS_DIR :=        ac3_adec \
                dvdread \
                esd \
                fb \
+               filter \
                ggi \
                glide \
                gtk \
@@ -54,7 +55,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
                alsa/alsa \
                arts/arts \
                beos/beos \
-               chroma/yuv2rgb8 \
+               chroma/chroma_yv12_rgb8 \
                directx/directx \
                dsp/dsp \
                dummy/dummy \
@@ -63,6 +64,8 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
                dvdread/dvdread \
                esd/esd \
                fb/fb \
+               filter/filter_bob \
+               filter/filter_invert \
                ggi/ggi \
                glide/glide \
                gtk/gnome \
@@ -320,7 +323,6 @@ snapshot-common:
                -type d -name CVS -o -name '.*' -o -name '*.[o]' | \
                        while read i ; do rm -Rf $$i ; done
        # Copy gettext stuff
-       mkdir tmp/vlc/po
        cp po/*.po tmp/vlc/po
        for i in Makefile.in.in POTFILES.in ; do cp po/$$i tmp/vlc/po ; done
        # Copy misc files
index 9739af0fe73eec67460d62319b0332c8b63a521f..3828cac49ff4e62a14b13e1b04cdf40315b5a49f 100644 (file)
@@ -95,7 +95,6 @@ LIB_RC = @LIB_RC@
 LIB_SDL = @LIB_SDL@
 LIB_X11 = @LIB_X11@
 LIB_XVIDEO = @LIB_XVIDEO@
-LIB_YUV = @LIB_YUV@
 
 #
 # CFLAGS for special cases
index 0f20d7a60fbedecbe3c984535f3c573f2fe00f5e..066b59669c24098556e40ef8e025babc3bd75d7b 100755 (executable)
--- a/configure
+++ b/configure
@@ -4467,7 +4467,6 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  LIB_YUV="${LIB_YUV} -lm"
   LIB_IMDCT="${LIB_IMDCT} -lm"
   LIB_IMDCT3DN="${LIB_IMDCT3DN} -lm"
   LIB_IMDCTSSE="${LIB_IMDCTSSE} -lm"
@@ -4480,7 +4479,7 @@ fi
 THREAD_LIB=error
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6
-echo "configure:4484: checking for pthread_attr_init in -lpthread" >&5
+echo "configure:4483: checking for pthread_attr_init in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_attr_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4488,7 +4487,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4492 "configure"
+#line 4491 "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
@@ -4499,7 +4498,7 @@ int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:4503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4502: \"$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
@@ -4522,7 +4521,7 @@ fi
 fi
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init in -lpthreads""... $ac_c" 1>&6
-echo "configure:4526: checking for pthread_attr_init in -lpthreads" >&5
+echo "configure:4525: checking for pthread_attr_init in -lpthreads" >&5
 ac_lib_var=`echo pthreads'_'pthread_attr_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4530,7 +4529,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4534 "configure"
+#line 4533 "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
@@ -4541,7 +4540,7 @@ int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:4545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4544: \"$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
@@ -4564,7 +4563,7 @@ fi
 fi
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init in -lc_r""... $ac_c" 1>&6
-echo "configure:4568: checking for pthread_attr_init in -lc_r" >&5
+echo "configure:4567: checking for pthread_attr_init in -lc_r" >&5
 ac_lib_var=`echo c_r'_'pthread_attr_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4572,7 +4571,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lc_r  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4576 "configure"
+#line 4575 "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
@@ -4583,7 +4582,7 @@ int main() {
 pthread_attr_init()
 ; return 0; }
 EOF
-if { (eval echo configure:4587: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4586: \"$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
@@ -4606,12 +4605,12 @@ fi
 fi
 if test "x${THREAD_LIB}" = xerror; then
   echo $ac_n "checking for pthread_attr_init""... $ac_c" 1>&6
-echo "configure:4610: checking for pthread_attr_init" >&5
+echo "configure:4609: checking for pthread_attr_init" >&5
 if eval "test \"`echo '$''{'ac_cv_func_pthread_attr_init'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4615 "configure"
+#line 4614 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pthread_attr_init(); below.  */
@@ -4634,7 +4633,7 @@ pthread_attr_init();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4638: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_pthread_attr_init=yes"
 else
@@ -4657,7 +4656,7 @@ fi
 fi
 
 echo $ac_n "checking for cthread_fork in -lthreads""... $ac_c" 1>&6
-echo "configure:4661: checking for cthread_fork in -lthreads" >&5
+echo "configure:4660: checking for cthread_fork in -lthreads" >&5
 ac_lib_var=`echo threads'_'cthread_fork | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4665,7 +4664,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4669 "configure"
+#line 4668 "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
@@ -4676,7 +4675,7 @@ int main() {
 cthread_fork()
 ; return 0; }
 EOF
-if { (eval echo configure:4680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4679: \"$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
@@ -4698,7 +4697,7 @@ fi
 
 
 cat > conftest.$ac_ext <<EOF
-#line 4702 "configure"
+#line 4701 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 EOF
@@ -4714,7 +4713,7 @@ fi
 rm -f conftest*
 
 cat > conftest.$ac_ext <<EOF
-#line 4718 "configure"
+#line 4717 "configure"
 #include "confdefs.h"
 #include <strings.h>
 EOF
@@ -4734,17 +4733,17 @@ for ac_hdr in stddef.h getopt.h strings.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4738: checking for $ac_hdr" >&5
+echo "configure:4737: 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 4743 "configure"
+#line 4742 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4748: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4747: \"$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*
@@ -4774,17 +4773,17 @@ for ac_hdr in sys/sockio.h fcntl.h sys/time.h sys/times.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4778: checking for $ac_hdr" >&5
+echo "configure:4777: 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 4783 "configure"
+#line 4782 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4787: \"$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*
@@ -4814,17 +4813,17 @@ for ac_hdr in sys/soundcard.h machine/soundcard.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4818: checking for $ac_hdr" >&5
+echo "configure:4817: 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 4823 "configure"
+#line 4822 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4827: \"$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*
@@ -4854,17 +4853,17 @@ for ac_hdr in dlfcn.h image.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4858: checking for $ac_hdr" >&5
+echo "configure:4857: 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 4863 "configure"
+#line 4862 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4867: \"$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*
@@ -4894,17 +4893,17 @@ for ac_hdr in arpa/inet.h net/if.h netinet/in.h sys/socket.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4898: checking for $ac_hdr" >&5
+echo "configure:4897: 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 4903 "configure"
+#line 4902 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4908: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4907: \"$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*
@@ -4934,17 +4933,17 @@ for ac_hdr in machine/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4938: checking for $ac_hdr" >&5
+echo "configure:4937: 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 4943 "configure"
+#line 4942 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4948: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4947: \"$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*
@@ -4975,17 +4974,17 @@ for ac_hdr in cthreads.h pthread.h kernel/scheduler.h kernel/OS.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4979: checking for $ac_hdr" >&5
+echo "configure:4978: 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 4984 "configure"
+#line 4983 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4988: \"$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*
@@ -5013,20 +5012,20 @@ done
 
 
 echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6
-echo "configure:5017: checking for ntohl in sys/param.h" >&5
+echo "configure:5016: checking for ntohl in sys/param.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_ntohl_sys_param_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -Wall -Werror"
      cat > conftest.$ac_ext <<EOF
-#line 5023 "configure"
+#line 5022 "configure"
 #include "confdefs.h"
 #include <sys/param.h>
 int main() {
 void foo() { int meuh; ntohl(meuh); }
 ; return 0; }
 EOF
-if { (eval echo configure:5030: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_ntohl_sys_param_h=yes
 else
@@ -5047,20 +5046,20 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC accepts -finline-limit""... $ac_c" 1>&6
-echo "configure:5051: checking if \$CC accepts -finline-limit" >&5
+echo "configure:5050: checking if \$CC accepts -finline-limit" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline_limit'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -finline-limit-30000"
      cat > conftest.$ac_ext <<EOF
-#line 5057 "configure"
+#line 5056 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5064: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5063: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline_limit=yes
 else
@@ -5078,20 +5077,20 @@ if test x"$ac_cv_c_inline_limit" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC accepts -bundle -undefined error""... $ac_c" 1>&6
-echo "configure:5082: checking if \$CC accepts -bundle -undefined error" >&5
+echo "configure:5081: checking if \$CC accepts -bundle -undefined error" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_darwin'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -bundle -undefined error"
      cat > conftest.$ac_ext <<EOF
-#line 5088 "configure"
+#line 5087 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5095: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5094: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_ld_darwin=yes
 else
@@ -5109,20 +5108,20 @@ if test x"$ac_cv_ld_darwin" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC accepts -shared""... $ac_c" 1>&6
-echo "configure:5113: checking if \$CC accepts -shared" >&5
+echo "configure:5112: checking if \$CC accepts -shared" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_plugins'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   CFLAGS="${save_CFLAGS} -shared"
      cat > conftest.$ac_ext <<EOF
-#line 5119 "configure"
+#line 5118 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5126: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5125: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_ld_plugins=yes
 else
@@ -5141,7 +5140,7 @@ fi
         
 if test x"${SOFLAGS}" = x; then
     echo $ac_n "checking for soname setting""... $ac_c" 1>&6
-echo "configure:5145: checking for soname setting" >&5
+echo "configure:5144: checking for soname setting" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_soname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5150,14 +5149,14 @@ else
         try_SOFLAGS="-Wl,-soname -Wl,"
         LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0"
         cat > conftest.$ac_ext <<EOF
-#line 5154 "configure"
+#line 5153 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5160: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_soname="${try_SOFLAGS}"
 else
@@ -5169,14 +5168,14 @@ else
             try_SOFLAGS="-Wl,-h -Wl,"
             LDFLAGS="${save_LDFLAGS} ${try_SOFLAGS}foo.so.0"
             cat > conftest.$ac_ext <<EOF
-#line 5173 "configure"
+#line 5172 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_soname="${try_SOFLAGS}"
 else
@@ -5205,7 +5204,7 @@ have problems using libdvdcss.
 fi
 
 echo $ac_n "checking __attribute__ ((aligned ())) support""... $ac_c" 1>&6
-echo "configure:5209: checking __attribute__ ((aligned ())) support" >&5
+echo "configure:5208: checking __attribute__ ((aligned ())) support" >&5
 if eval "test \"`echo '$''{'ac_cv_c_attribute_aligned'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5213,14 +5212,14 @@ else
        CFLAGS="${save_CFLAGS} -Werror"
     for ac_cv_c_attr_align_try in 2 4 8 16 32 64; do
         cat > conftest.$ac_ext <<EOF
-#line 5217 "configure"
+#line 5216 "configure"
 #include "confdefs.h"
 
 int main() {
 static char c __attribute__ ((aligned($ac_cv_c_attr_align_try))) = 0; return c;
 ; return 0; }
 EOF
-if { (eval echo configure:5224: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5223: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_attribute_aligned=$ac_cv_c_attr_align_try
 else
@@ -5243,19 +5242,19 @@ CFLAGS="${save_CFLAGS}"
 LDFLAGS="${save_LDFLAGS}"
 
 echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5247: checking for boolean_t in sys/types.h" >&5
+echo "configure:5246: checking for boolean_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_sys_types_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5252 "configure"
+#line 5251 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 int main() {
 boolean_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:5259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5258: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_boolean_t_sys_types_h=yes
 else
@@ -5276,19 +5275,19 @@ EOF
 fi
 
 echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6
-echo "configure:5280: checking for boolean_t in pthread.h" >&5
+echo "configure:5279: checking for boolean_t in pthread.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_pthread_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5285 "configure"
+#line 5284 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 int main() {
 boolean_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:5292: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_boolean_t_pthread_h=yes
 else
@@ -5309,19 +5308,19 @@ EOF
 fi
 
 echo $ac_n "checking for boolean_t in cthreads.h""... $ac_c" 1>&6
-echo "configure:5313: checking for boolean_t in cthreads.h" >&5
+echo "configure:5312: checking for boolean_t in cthreads.h" >&5
 if eval "test \"`echo '$''{'ac_cv_c_boolean_t_cthreads_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5318 "configure"
+#line 5317 "configure"
 #include "confdefs.h"
 #include <cthreads.h>
 int main() {
 boolean_t foo;
 ; return 0; }
 EOF
-if { (eval echo configure:5325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5324: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_boolean_t_cthreads_h=yes
 else
@@ -5342,12 +5341,12 @@ EOF
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5346: checking for working const" >&5
+echo "configure:5345: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5351 "configure"
+#line 5350 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -5396,7 +5395,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:5400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5399: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -5417,12 +5416,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:5421: checking for size_t" >&5
+echo "configure:5420: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5426 "configure"
+#line 5425 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5450,12 +5449,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:5454: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:5453: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5459 "configure"
+#line 5458 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -5464,7 +5463,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:5468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5467: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -5488,9 +5487,8 @@ fi
 
 ARCH=${target_cpu}
 
-#BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy yuv2rgb8 idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
 BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
-PLUGINS="${PLUGINS} ac3_spdif spudec"
+PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert"
 
 MMX_MODULES="memcpymmx idctmmx motionmmx"
 MMXEXT_MODULES="memcpymmxext idctmmxext motionmmxext"
@@ -5499,19 +5497,19 @@ SSE_MODULES="imdctsse downmixsse"
 ALTIVEC_MODULES="idctaltivec motionaltivec"
 
 echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6
-echo "configure:5503: checking if \$CC groks MMX inline assembly" >&5
+echo "configure:5501: checking if \$CC groks MMX inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_mmx_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5508 "configure"
+#line 5506 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("packuswb %%mm1,%%mm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:5515: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5513: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mmx_inline=yes
 else
@@ -5529,19 +5527,19 @@ if test x"$ac_cv_mmx_inline" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC groks MMX EXT inline assembly""... $ac_c" 1>&6
-echo "configure:5533: checking if \$CC groks MMX EXT inline assembly" >&5
+echo "configure:5531: checking if \$CC groks MMX EXT inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_mmxext_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5538 "configure"
+#line 5536 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("maskmovq %%mm1,%%mm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:5545: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_mmxext_inline=yes
 else
@@ -5559,19 +5557,19 @@ if test x"$ac_cv_mmxext_inline" != x"no"; then
 fi
 
 echo $ac_n "checking if \$CC groks 3D Now! inline assembly""... $ac_c" 1>&6
-echo "configure:5563: checking if \$CC groks 3D Now! inline assembly" >&5
+echo "configure:5561: checking if \$CC groks 3D Now! inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_3dnow_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5568 "configure"
+#line 5566 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("pfadd %%mm1,%%mm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:5575: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5573: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_3dnow_inline=yes
 else
@@ -5593,19 +5591,19 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC groks SSE inline assembly""... $ac_c" 1>&6
-echo "configure:5597: checking if \$CC groks SSE inline assembly" >&5
+echo "configure:5595: checking if \$CC groks SSE inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_sse_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5602 "configure"
+#line 5600 "configure"
 #include "confdefs.h"
 
 int main() {
 void *p;asm volatile("xorps %%xmm1,%%xmm2"::"r"(p));
 ; return 0; }
 EOF
-if { (eval echo configure:5609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_sse_inline=yes
 else
@@ -5627,19 +5625,19 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC groks Altivec inline assembly""... $ac_c" 1>&6
-echo "configure:5631: checking if \$CC groks Altivec inline assembly" >&5
+echo "configure:5629: checking if \$CC groks Altivec inline assembly" >&5
 if eval "test \"`echo '$''{'ac_cv_altivec_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5636 "configure"
+#line 5634 "configure"
 #include "confdefs.h"
 
 int main() {
 asm volatile("vperm 0,1,2,3");
 ; return 0; }
 EOF
-if { (eval echo configure:5643: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5641: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_altivec_inline=yes
 else
@@ -5649,14 +5647,14 @@ else
   save_CFLAGS=$CFLAGS
           CFLAGS="$CFLAGS -Wa,-m7400"
           cat > conftest.$ac_ext <<EOF
-#line 5653 "configure"
+#line 5651 "configure"
 #include "confdefs.h"
 
 int main() {
 asm volatile("vperm 0,1,2,3");
 ; return 0; }
 EOF
-if { (eval echo configure:5660: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_altivec_inline="-Wa,-m7400"
 else
@@ -5685,7 +5683,7 @@ EOF
 fi
 
 echo $ac_n "checking if \$CC groks Altivec C extensions""... $ac_c" 1>&6
-echo "configure:5689: checking if \$CC groks Altivec C extensions" >&5
+echo "configure:5687: checking if \$CC groks Altivec C extensions" >&5
 if eval "test \"`echo '$''{'ac_cv_c_altivec'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5693,14 +5691,14 @@ else
      CFLAGS="$CFLAGS -faltivec"
      # Darwin test
      cat > conftest.$ac_ext <<EOF
-#line 5697 "configure"
+#line 5695 "configure"
 #include "confdefs.h"
 
 int main() {
 vec_mtvscr((vector unsigned int)(0));
 ; return 0; }
 EOF
-if { (eval echo configure:5704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5702: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_altivec=-faltivec
 else
@@ -5711,14 +5709,14 @@ else
         # Linux/PPC test
         CFLAGS="$save_CFLAGS $CFLAGS_ALTIVEC -fvec"
         cat > conftest.$ac_ext <<EOF
-#line 5715 "configure"
+#line 5713 "configure"
 #include "confdefs.h"
 
 int main() {
 vec_mtvscr((vector unsigned int)(0));
 ; return 0; }
 EOF
-if { (eval echo configure:5722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5720: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_altivec="-fvec"
 else
@@ -5746,21 +5744,21 @@ EOF
 fi
 
 echo $ac_n "checking if linker needs -framework vecLib""... $ac_c" 1>&6
-echo "configure:5750: checking if linker needs -framework vecLib" >&5
+echo "configure:5748: checking if linker needs -framework vecLib" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_altivec'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   save_LDFLAGS=$LDFLAGS
      LDFLAGS="$LDFLAGS -framework vecLib"
      cat > conftest.$ac_ext <<EOF
-#line 5757 "configure"
+#line 5755 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:5764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_altivec=yes
 else
@@ -5806,7 +5804,7 @@ if test $SYS = mingw32; then
 # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args.
 set dummy ${ac_tool_prefix}windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5810: checking for $ac_word" >&5
+echo "configure:5808: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5838,7 +5836,7 @@ if test -n "$ac_tool_prefix"; then
   # Extract the first word of "windres", so it can be a program name with args.
 set dummy windres; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5842: checking for $ac_word" >&5
+echo "configure:5840: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_WINDRES'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5881,17 +5879,17 @@ for ac_hdr in winioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5885: checking for $ac_hdr" >&5
+echo "configure:5883: 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 5890 "configure"
+#line 5888 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5893: \"$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*
@@ -5924,17 +5922,17 @@ for ac_hdr in sys/ioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5928: checking for $ac_hdr" >&5
+echo "configure:5926: 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 5933 "configure"
+#line 5931 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5936: \"$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*
@@ -5960,17 +5958,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5964: checking for $ac_hdr" >&5
+echo "configure:5962: 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 5969 "configure"
+#line 5967 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5974: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5972: \"$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*
@@ -6000,7 +5998,7 @@ done
   LINUX_DVD_STRUCT=0
   OPENBSD_DVD_STRUCT=0
         cat > conftest.$ac_ext <<EOF
-#line 6004 "configure"
+#line 6002 "configure"
 #include "confdefs.h"
 #include <sys/cdio.h>
 EOF
@@ -6013,7 +6011,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 EOF
 
     cat > conftest.$ac_ext <<EOF
-#line 6017 "configure"
+#line 6015 "configure"
 #include "confdefs.h"
 #include <sys/cdio.h>
 EOF
@@ -6033,7 +6031,7 @@ fi
 rm -f conftest*
 
         cat > conftest.$ac_ext <<EOF
-#line 6037 "configure"
+#line 6035 "configure"
 #include "confdefs.h"
 #include <sys/dvdio.h>
 EOF
@@ -6046,7 +6044,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
 EOF
 
     cat > conftest.$ac_ext <<EOF
-#line 6050 "configure"
+#line 6048 "configure"
 #include "confdefs.h"
 #include <sys/dvdio.h>
 EOF
@@ -6066,7 +6064,7 @@ fi
 rm -f conftest*
 
         cat > conftest.$ac_ext <<EOF
-#line 6070 "configure"
+#line 6068 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -6085,7 +6083,7 @@ rm -f conftest*
 
         NEED_BSDI_LIBDVD=0
   cat > conftest.$ac_ext <<EOF
-#line 6089 "configure"
+#line 6087 "configure"
 #include "confdefs.h"
 #include <dvd.h>
 EOF
@@ -6107,17 +6105,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6111: checking for $ac_hdr" >&5
+echo "configure:6109: 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 6116 "configure"
+#line 6114 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6119: \"$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*
@@ -6157,17 +6155,17 @@ rm -f conftest*
 
         ac_safe=`echo "sys/scsi/scsi_types.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/scsi/scsi_types.h""... $ac_c" 1>&6
-echo "configure:6161: checking for sys/scsi/scsi_types.h" >&5
+echo "configure:6159: checking for sys/scsi/scsi_types.h" >&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 6166 "configure"
+#line 6164 "configure"
 #include "confdefs.h"
 #include <sys/scsi/scsi_types.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6171: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6169: \"$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*
@@ -6186,17 +6184,17 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   
     ac_safe=`echo "sys/scsi/impl/uscsi.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/scsi/impl/uscsi.h""... $ac_c" 1>&6
-echo "configure:6190: checking for sys/scsi/impl/uscsi.h" >&5
+echo "configure:6188: checking for sys/scsi/impl/uscsi.h" >&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 6195 "configure"
+#line 6193 "configure"
 #include "confdefs.h"
 #include <sys/scsi/impl/uscsi.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6200: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6198: \"$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*
@@ -6229,17 +6227,17 @@ fi
 
         ac_safe=`echo "sys/scsi.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/scsi.h""... $ac_c" 1>&6
-echo "configure:6233: checking for sys/scsi.h" >&5
+echo "configure:6231: checking for sys/scsi.h" >&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 6238 "configure"
+#line 6236 "configure"
 #include "confdefs.h"
 #include <sys/scsi.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6241: \"$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*
@@ -6257,7 +6255,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   
     cat > conftest.$ac_ext <<EOF
-#line 6261 "configure"
+#line 6259 "configure"
 #include "confdefs.h"
 #include <sys/scsi.h>
 EOF
@@ -6403,7 +6401,7 @@ if test "${enable_pth+set}" = set; then
   enableval="$enable_pth"
    if test x$enableval = xyes; then
     echo $ac_n "checking for pth_init in -lpth""... $ac_c" 1>&6
-echo "configure:6407: checking for pth_init in -lpth" >&5
+echo "configure:6405: checking for pth_init in -lpth" >&5
 ac_lib_var=`echo pth'_'pth_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6411,7 +6409,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpth  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6415 "configure"
+#line 6413 "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
@@ -6422,7 +6420,7 @@ int main() {
 pth_init()
 ; return 0; }
 EOF
-if { (eval echo configure:6426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6424: \"$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
@@ -6450,7 +6448,7 @@ else
 fi
 
     cat > conftest.$ac_ext <<EOF
-#line 6454 "configure"
+#line 6452 "configure"
 #include "confdefs.h"
 #include <pth.h>
 EOF
@@ -6571,7 +6569,7 @@ fi
 if test x$enable_vcd != xno
 then
   cat > conftest.$ac_ext <<EOF
-#line 6575 "configure"
+#line 6573 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -6645,17 +6643,17 @@ if test "${with_mad+set}" = set; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6649: checking for $ac_hdr" >&5
+echo "configure:6647: 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 6654 "configure"
+#line 6652 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6657: \"$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*
@@ -6685,7 +6683,7 @@ fi
 done
 
       echo $ac_n "checking for mad_bit_init in -lmad""... $ac_c" 1>&6
-echo "configure:6689: checking for mad_bit_init in -lmad" >&5
+echo "configure:6687: checking for mad_bit_init in -lmad" >&5
 ac_lib_var=`echo mad'_'mad_bit_init | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6693,7 +6691,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lmad  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6697 "configure"
+#line 6695 "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
@@ -6704,7 +6702,7 @@ int main() {
 mad_bit_init()
 ; return 0; }
 EOF
-if { (eval echo configure:6708: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6706: \"$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
@@ -6774,7 +6772,7 @@ if test "${enable_esd+set}" = set; then
      # Extract the first word of "esd-config", so it can be a program name with args.
 set dummy esd-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6778: checking for $ac_word" >&5
+echo "configure:6776: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ESD_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6825,7 +6823,7 @@ if test "${enable_arts+set}" = set; then
      # Extract the first word of "artsc-config", so it can be a program name with args.
 set dummy artsc-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:6829: checking for $ac_word" >&5
+echo "configure:6827: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_ARTS_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6882,17 +6880,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6886: checking for $ac_hdr" >&5
+echo "configure:6884: 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 6891 "configure"
+#line 6889 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6894: \"$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*
@@ -6936,17 +6934,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6940: checking for $ac_hdr" >&5
+echo "configure:6938: 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 6945 "configure"
+#line 6943 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6950: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6948: \"$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*
@@ -7024,7 +7022,7 @@ fi
   # Extract the first word of "sdl12-config", so it can be a program name with args.
 set dummy sdl12-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7028: checking for $ac_word" >&5
+echo "configure:7026: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL12_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7064,7 +7062,7 @@ fi
     # Extract the first word of "sdl11-config", so it can be a program name with args.
 set dummy sdl11-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7068: checking for $ac_word" >&5
+echo "configure:7066: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL11_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7105,7 +7103,7 @@ fi
     # Extract the first word of "sdl-config", so it can be a program name with args.
 set dummy sdl-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7109: checking for $ac_word" >&5
+echo "configure:7107: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SDL_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7151,17 +7149,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7155: checking for $ac_hdr" >&5
+echo "configure:7153: 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 7160 "configure"
+#line 7158 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7163: \"$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*
@@ -7231,17 +7229,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7235: checking for $ac_hdr" >&5
+echo "configure:7233: 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 7240 "configure"
+#line 7238 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7243: \"$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*
@@ -7270,7 +7268,7 @@ done
 
     else
       echo $ac_n "checking for directX headers in ${withval}""... $ac_c" 1>&6
-echo "configure:7274: checking for directX headers in ${withval}" >&5
+echo "configure:7272: checking for directX headers in ${withval}" >&5
       if test -f ${withval}/include/directx.h
       then
         PLUGINS="${PLUGINS} directx"
@@ -7353,7 +7351,7 @@ if test "${enable_gnome+set}" = set; then
     # Extract the first word of "gnome-config", so it can be a program name with args.
 set dummy gnome-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7357: checking for $ac_word" >&5
+echo "configure:7355: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GNOME_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7398,17 +7396,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7402: checking for $ac_hdr" >&5
+echo "configure:7400: 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 7407 "configure"
+#line 7405 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7412: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7410: \"$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*
@@ -7468,7 +7466,7 @@ fi
   # Extract the first word of "gtk-config", so it can be a program name with args.
 set dummy gtk-config; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:7472: checking for $ac_word" >&5
+echo "configure:7470: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GTK_CONFIG'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -7514,17 +7512,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7518: checking for $ac_hdr" >&5
+echo "configure:7516: 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 7523 "configure"
+#line 7521 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7526: \"$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*
@@ -7580,17 +7578,17 @@ if test x$enable_x11 != xno &&
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7584: checking for $ac_hdr" >&5
+echo "configure:7582: 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 7589 "configure"
+#line 7587 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7594: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7592: \"$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*
@@ -7643,17 +7641,17 @@ if test x$enable_xvideo != xno &&
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7647: checking for $ac_hdr" >&5
+echo "configure:7645: 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 7652 "configure"
+#line 7650 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7657: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7655: \"$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*
@@ -7693,17 +7691,17 @@ if test "${enable_alsa+set}" = set; then
    then
      ac_safe=`echo "alsa/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for alsa/asoundlib.h""... $ac_c" 1>&6
-echo "configure:7697: checking for alsa/asoundlib.h" >&5
+echo "configure:7695: checking for alsa/asoundlib.h" >&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 7702 "configure"
+#line 7700 "configure"
 #include "confdefs.h"
 #include <alsa/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7705: \"$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*
@@ -7720,7 +7718,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
-echo "configure:7724: checking for main in -lasound" >&5
+echo "configure:7722: checking for main in -lasound" >&5
 ac_lib_var=`echo asound'_'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
@@ -7728,14 +7726,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 7732 "configure"
+#line 7730 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:7739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:7737: \"$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
@@ -7857,7 +7855,6 @@ fi
 
 
 
-
 
 
 trap '' 1 2 15
@@ -8101,7 +8098,6 @@ s%@LIB_RC@%$LIB_RC%g
 s%@LIB_SDL@%$LIB_SDL%g
 s%@LIB_X11@%$LIB_X11%g
 s%@LIB_XVIDEO@%$LIB_XVIDEO%g
-s%@LIB_YUV@%$LIB_YUV%g
 s%@CFLAGS_VLC@%$CFLAGS_VLC%g
 s%@CFLAGS_ALTIVEC@%$CFLAGS_ALTIVEC%g
 s%@CFLAGS_DVD@%$CFLAGS_DVD%g
@@ -8410,7 +8406,7 @@ which modules get compiled as plugins.
 "
 if test x${HAVE_VLC} = x1
 then
-  echo "To build vlc and its plugins, type \`make vlc'."
+  echo "To build vlc and its plugins, type \`make vlc plugins'."
 fi
 if test x${HAVE_LIBDVDCSS} = x1
 then
index 33b4b13e8da5d934b399f6cefc04327fd1996f21..c9bc9d3b66fbc8d88123ce80286bee579902eb5d 100644 (file)
@@ -146,7 +146,6 @@ AC_TYPE_SIGNAL
 AC_CHECK_LIB(dl,dlopen,LIB="${LIB} -ldl")
 AC_CHECK_LIB(m,cos,LIB_IMDCT="${LIB_IMDCT} -lm")
 AC_CHECK_LIB(m,pow,
-  LIB_YUV="${LIB_YUV} -lm"
   LIB_IMDCT="${LIB_IMDCT} -lm"
   LIB_IMDCT3DN="${LIB_IMDCT3DN} -lm"
   LIB_IMDCTSSE="${LIB_IMDCTSSE} -lm"
@@ -310,9 +309,8 @@ ARCH=${target_cpu}
 dnl
 dnl  default modules
 dnl
-#BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy yuv2rgb8 idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
 BUILTINS="${BUILTINS} mpeg_es mpeg_ps mpeg_ts memcpy idct idctclassic motion imdct downmix mpeg_adec lpcm_adec ac3_adec mpeg_vdec"
-PLUGINS="${PLUGINS} ac3_spdif spudec"
+PLUGINS="${PLUGINS} ac3_spdif spudec chroma_yv12_rgb8 filter_bob filter_invert"
 
 dnl
 dnl  Accelerated modules
@@ -1280,7 +1278,6 @@ AC_SUBST(LIB_RC)
 AC_SUBST(LIB_SDL)
 AC_SUBST(LIB_X11)
 AC_SUBST(LIB_XVIDEO)
-AC_SUBST(LIB_YUV)
 
 AC_SUBST(CFLAGS_VLC)
 AC_SUBST(CFLAGS_ALTIVEC)
@@ -1345,7 +1342,7 @@ which modules get compiled as plugins.
 "
 if test x${HAVE_VLC} = x1
 then
-  echo "To build vlc and its plugins, type \`make vlc'."
+  echo "To build vlc and its plugins, type \`make vlc plugins'."
 fi
 if test x${HAVE_LIBDVDCSS} = x1
 then
index f4a9e0b661fc780a9e0fd33559f7549d70ef91b5..6d18b245383f7e6da0fcd837bd01a2a0b233812f 100644 (file)
@@ -3,7 +3,7 @@
  * Collection of useful common types and macros definitions
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: common.h,v 1.58 2001/12/13 12:47:17 sam Exp $
+ * $Id: common.h,v 1.59 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@via.ecp.fr>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -542,26 +542,30 @@ typedef struct module_symbols_s
     void ( * aout_DestroyFifo )     ( struct aout_fifo_s * );
 
     struct vout_thread_s * (* vout_CreateThread) ( int *, int, int, int, int );
-    struct subpicture_s * (* vout_CreateSubPicture) ( struct vout_thread_s *, 
-                                                      int, int );
-    struct picture_s * ( * vout_CreatePicture ) ( struct vout_thread_s * ); 
+    void  ( * vout_DestroyThread )  ( struct vout_thread_s *, int * );
 
-    void  ( * vout_DestroySubPicture )  ( struct vout_thread_s *, 
-                                          struct subpicture_s * );
-    void  ( * vout_DisplaySubPicture )  ( struct vout_thread_s *, 
-                                          struct subpicture_s * );
+    struct picture_s * ( * vout_CreatePicture )
+                                    ( struct vout_thread_s *,
+                                      boolean_t, boolean_t, boolean_t ); 
     void  ( * vout_DisplayPicture ) ( struct vout_thread_s *, 
                                       struct picture_s * );
     void  ( * vout_DestroyPicture ) ( struct vout_thread_s *,
                                       struct picture_s * );
     void  ( * vout_LinkPicture )    ( struct vout_thread_s *,
                                       struct picture_s * );
-    void  ( * vout_UnlinkPicture )    ( struct vout_thread_s *,
+    void  ( * vout_UnlinkPicture )  ( struct vout_thread_s *,
                                       struct picture_s * );
-    void  ( * vout_DatePicture )    ( struct vout_thread_s *p_vout
-                                      struct picture_s *p_pic, mtime_t );
+    void  ( * vout_DatePicture )    ( struct vout_thread_s *, 
+                                      struct picture_s *, mtime_t );
     void  ( * vout_PlacePicture )   ( struct vout_thread_s *, int, int,
                                       int *, int *, int *, int * );
+
+    struct subpicture_s * (* vout_CreateSubPicture)
+                                        ( struct vout_thread_s *, int, int );
+    void  ( * vout_DestroySubPicture )  ( struct vout_thread_s *, 
+                                          struct subpicture_s * );
+    void  ( * vout_DisplaySubPicture )  ( struct vout_thread_s *, 
+                                          struct subpicture_s * );
     
     u32  ( * UnalignedShowBits )    ( struct bit_stream_s *, unsigned int );
     void ( * UnalignedRemoveBits )  ( struct bit_stream_s * );
index f39baf855185c83c25b4bf792857cd86b91425a3..133c1cabab983221105fc344b5b12c323d4ea219 100644 (file)
 #define VOUT_METHOD_VAR                 "vlc_vout"
 #define VOUT_METHOD_DEFAULT             "x11"
 
+/* Environment variable containing the display method */
+#define VOUT_FILTER_VAR                 "vlc_filter"
+#define VOUT_FILTER_DEFAULT             "x11"
+
 /* Environment variable containing the motion compensation method */
 #define MOTION_METHOD_VAR               "vlc_motion"
 
 #define VOUT_DEPTH_VAR                  "vlc_depth"
 #define VOUT_DEPTH_DEFAULT              15
 
+/* Multiplier value for aspect ratio calculation */
+#define VOUT_ASPECT_FACTOR              (2*2*2*2*2*2*2*3*3*3*5*5*5)
+
 /* Maximum width of a scaled source picture - this should be relatively high,
  * since higher stream values will result in no display at all. */
 #define VOUT_MAX_WIDTH                  4096
 /* Better be in advance when awakening than late... */
 #define VOUT_MWAIT_TOLERANCE            ((int)(0.020*CLOCK_FREQ))
 
+/* Time to sleep when waiting for a buffer (from vout or the video fifo).
+ * It should be approximately the time needed to perform a complete picture
+ * loop. Since it only happens when the video heap is full, it does not need
+ * to be too low, even if it blocks the decoder. */
+#define VOUT_OUTMEM_SLEEP               ((int)(0.020*CLOCK_FREQ))
+
 /* The default video output window title */
 #define VOUT_TITLE                      "VideoLAN Client @VLC_VERSION@"
 
 
 #define VPAR_IDLE_SLEEP                 ((int)(0.010*CLOCK_FREQ))
 
-/* Time to sleep when waiting for a buffer (from vout or the video fifo).
- * It should be approximately the time needed to perform a complete picture
- * loop. Since it only happens when the video heap is full, it does not need
- * to be too low, even if it blocks the decoder. */
-#define VPAR_OUTMEM_SLEEP               ((int)(0.020*CLOCK_FREQ))
-
 /* Optimization level, from 0 to 2 - 1 is generally a good compromise. Remember
  * that raising this level dramatically lengthens the compilation time. */
 #ifdef RELEASE
index 24c773c1e49207cf6bd5e4128b869c87f4ebde3e..eaa68c512d1c4f4f8df2423ca0a6585238284010 100644 (file)
@@ -87,6 +87,7 @@
     (p_symbols)->aout_CreateFifo = aout_CreateFifo; \
     (p_symbols)->aout_DestroyFifo = aout_DestroyFifo; \
     (p_symbols)->vout_CreateThread = vout_CreateThread; \
+    (p_symbols)->vout_DestroyThread = vout_DestroyThread; \
     (p_symbols)->vout_CreateSubPicture = vout_CreateSubPicture; \
     (p_symbols)->vout_DestroySubPicture = vout_DestroySubPicture; \
     (p_symbols)->vout_DisplaySubPicture = vout_DisplaySubPicture; \
 #   define aout_DestroyFifo p_symbols->aout_DestroyFifo
 
 #   define vout_CreateThread p_symbols->vout_CreateThread
+#   define vout_DestroyThread p_symbols->vout_DestroyThread
 #   define vout_CreateSubPicture p_symbols->vout_CreateSubPicture
 #   define vout_DestroySubPicture p_symbols->vout_DestroySubPicture
 #   define vout_DisplaySubPicture p_symbols->vout_DisplaySubPicture
index f2f50a54cb10330f7df51e2ff6bb9fbf5b7cc6bf..ef4dbc6a91da4563e9292a6e1ecf024599b0b6be 100644 (file)
@@ -4,7 +4,7 @@
  * includes all common video types and constants.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video.h,v 1.34 2001/12/13 12:47:17 sam Exp $
+ * $Id: video.h,v 1.35 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -39,6 +39,7 @@ typedef struct plane_s
 {
     pixel_data_t *p_data;
     int           i_bytes;
+    int           i_line_bytes;
 } plane_t;
 
 /*****************************************************************************
@@ -82,7 +83,7 @@ typedef struct picture_s
 
     /* Picture dynamic properties - those properties can be changed by the
      * decoder */
-    boolean_t       b_progressive_frame;      /* is it a progressive frame ? */
+    boolean_t       b_progressive;            /* is it a progressive frame ? */
     boolean_t       b_repeat_first_field;                         /* RFF bit */
     boolean_t       b_top_field_first;               /* which field is first */
 
index d6aa8f1bfe56e8a182e1e7ca145d2f5fc48929ce..7e0827ae4e96041724e6513dfa94aa9443ff5f0f 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppenned video output thread.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_output.h,v 1.65 2001/12/13 12:47:17 sam Exp $
+ * $Id: video_output.h,v 1.66 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -193,7 +193,8 @@ vout_fifo_t *   vout_CreateFifo     ( void );
 void            vout_DestroyFifo    ( vout_fifo_t * );
 void            vout_FreeFifo       ( vout_fifo_t * );
 
-picture_t *     vout_CreatePicture  ( vout_thread_t * );
+picture_t *     vout_CreatePicture  ( vout_thread_t *,
+                                      boolean_t, boolean_t, boolean_t );
 void            vout_DestroyPicture ( vout_thread_t *, picture_t * );
 void            vout_DisplayPicture ( vout_thread_t *, picture_t * );
 void            vout_DatePicture    ( vout_thread_t *, picture_t *, mtime_t );
index 0346b2109867d3fd85dd0e650d7557ab72ab8a04..5692e35ee4745538b2a2ec5f44433c1058569e60 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_adec.c: ac3 decoder module main file
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ac3_adec.c,v 1.7 2001/12/10 04:53:10 sam Exp $
+ * $Id: ac3_adec.c,v 1.8 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *
@@ -81,13 +81,13 @@ void _M( adec_getfunctions )( function_list_t * p_function_list )
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for ac3 decoder module" )
+ADD_WINDOW( "Configuration for AC3 decoder module" )
     ADD_COMMENT( "Nothing to configure" )
 MODULE_CONFIG_STOP
 
 MODULE_INIT_START
     p_module->i_capabilities = MODULE_CAPABILITY_DEC;
-    p_module->psz_longname = "Ac3 sofware decoder";
+    p_module->psz_longname = "AC3 sofware decoder";
 MODULE_INIT_STOP
 
 MODULE_ACTIVATE_START
index 2c3c51192653e94141ae18efb8d831f2193f23cb..3af86e6de7c3382859e178f5f15017f2bc89762f 100644 (file)
@@ -7,12 +7,12 @@
 # Objects
 #
 
-PLUGIN_YUV2RGB8 = yuv2rgb8.o #common.o
+PLUGIN_YV12_RGB8 = yv12_rgb8.o
 
-BUILTIN_YUV2RGB8 = $(PLUGIN_YUV2RGB8:%.o=BUILTIN_%.o)
+BUILTIN_YV12_RGB8 = $(PLUGIN_YV12_RGB8:%.o=BUILTIN_%.o)
 
-PLUGIN_C = $(PLUGIN_YUV2RGB8)
-BUILTIN_C = $(BUILTIN_YUV2RGB8)
+PLUGIN_C = $(PLUGIN_YV12_RGB8)
+BUILTIN_C = $(BUILTIN_YV12_RGB8)
 ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
 
 #
@@ -25,10 +25,10 @@ include ../../Makefile.modules
 # Real targets
 #
 
-../yuv2rgb8.so: $(PLUGIN_YUV2RGB8)
+../chroma_yv12_rgb8.so: $(PLUGIN_YV12_RGB8)
        $(CC) -o $@ $^ $(PLCFLAGS) 
 
-../yuv2rgb8.a: $(BUILTIN_YUV2RGB8)
+../chroma_yv12_rgb8.a: $(BUILTIN_YV12_RGB8)
        ar r $@ $^
        $(RANLIB) $@
 
diff --git a/plugins/chroma/chroma_common.h b/plugins/chroma/chroma_common.h
new file mode 100644 (file)
index 0000000..90aafc5
--- /dev/null
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * chroma_common.h: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: chroma_common.h,v 1.1 2001/12/16 16:18:36 sam Exp $
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Constants
+ *****************************************************************************/
+
+/* Margins and offsets in conversion tables - Margins are used in case a RGB
+ * RGB conversion would give a value outside the 0-255 range. Offsets have been
+ * calculated to avoid using the same cache line for 2 tables. conversion tables
+ * are 2*MARGIN + 256 long and stores pixels.*/
+#define RED_MARGIN      178
+#define GREEN_MARGIN    135
+#define BLUE_MARGIN     224
+#define RED_OFFSET      1501                                 /* 1323 to 1935 */
+#define GREEN_OFFSET    135                                      /* 0 to 526 */
+#define BLUE_OFFSET     818                                   /* 594 to 1298 */
+#define RGB_TABLE_SIZE  1935                             /* total table size */
+
+#define GRAY_MARGIN     384
+#define GRAY_TABLE_SIZE 1024                             /* total table size */
+
+#define PALETTE_TABLE_SIZE 2176          /* YUV -> 8bpp palette lookup table */
+
+/* macros used for YUV pixel conversions */
+#define SHIFT 20
+#define U_GREEN_COEF    ((int)(-0.391 * (1<<SHIFT) / 1.164))
+#define U_BLUE_COEF     ((int)(2.018 * (1<<SHIFT) / 1.164))
+#define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
+#define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
+
+/*****************************************************************************
+ * Extern prototypes
+ *****************************************************************************/
+
+void _M( SetOffset )( int i_width, int i_height, int i_pic_width,
+                      int i_pic_height, boolean_t *pb_h_scaling,
+                      int *pi_v_scaling, int *p_offset, boolean_t b_double );
+
diff --git a/plugins/chroma/common.c b/plugins/chroma/common.c
new file mode 100644 (file)
index 0000000..833791e
--- /dev/null
@@ -0,0 +1,640 @@
+/*****************************************************************************
+ * common.c: Chroma transformation functions
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: common.c,v 1.1 2001/12/16 16:18:36 sam Exp $
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME yuv
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "video_common.h"
+
+#include "intf_msg.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+static int     yuv_Probe      ( probedata_t *p_data );
+static int     yuv_Init       ( vout_thread_t *p_vout );
+static int     yuv_Reset      ( vout_thread_t *p_vout );
+static void    yuv_End        ( vout_thread_t *p_vout );
+
+static void    SetGammaTable  ( int *pi_table, double f_gamma );
+static void    SetYUV         ( vout_thread_t *p_vout );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void _M( yuv_getfunctions )( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = yuv_Probe;
+    p_function_list->functions.yuv.pf_init = yuv_Init;
+    p_function_list->functions.yuv.pf_reset = yuv_Reset;
+    p_function_list->functions.yuv.pf_end = yuv_End;
+}
+
+/*****************************************************************************
+ * yuv_Probe: tests probe the audio device and return a score
+ *****************************************************************************
+ * This function tries to open the DSP and returns a score to the plugin
+ * manager so that it can choose the most appropriate one.
+ *****************************************************************************/
+static int yuv_Probe( probedata_t *p_data )
+{
+    if( TestMethod( YUV_METHOD_VAR, "yuv" ) )
+    {
+        return( 999 );
+    }
+
+    /* This module always works */
+    return( 50 );
+}
+
+/*****************************************************************************
+ * yuv_Init: allocate and initialize translations tables
+ *****************************************************************************
+ * This function will allocate memory to store translation tables, depending
+ * of the screen depth.
+ *****************************************************************************/
+static int yuv_Init( vout_thread_t *p_vout )
+{
+    size_t      tables_size;                        /* tables size, in bytes */
+
+    /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
+    switch( p_vout->i_bytes_per_pixel )
+    {
+    case 1:
+        tables_size = sizeof( u8 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
+        break;
+    case 2:
+        tables_size = sizeof( u16 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
+    case 3:
+    case 4:
+    default:
+        tables_size = sizeof( u32 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
+    }
+
+    /* Allocate memory */
+    p_vout->yuv.p_base = malloc( tables_size );
+    if( p_vout->yuv.p_base == NULL )
+    {
+        intf_ErrMsg("error: %s", strerror(ENOMEM));
+        return( 1 );
+    }
+
+    /* Allocate memory for conversion buffer and offset array */
+    p_vout->yuv.p_buffer = malloc( VOUT_MAX_WIDTH * p_vout->i_bytes_per_pixel );
+    if( p_vout->yuv.p_buffer == NULL )
+    {
+        intf_ErrMsg("error: %s", strerror(ENOMEM));
+        free( p_vout->yuv.p_base );
+        return( 1 );
+    }
+
+    /* In 8bpp we have a twice as big offset table because we also
+     * need the offsets for U and V (not only Y) */
+    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) *
+                             ( ( p_vout->i_bytes_per_pixel == 1 ) ? 2 : 1 ) );
+    if( p_vout->yuv.p_offset == NULL )
+    {
+        intf_ErrMsg("error: %s", strerror(ENOMEM));
+        free( p_vout->yuv.p_base );
+        free( p_vout->yuv.p_buffer );
+        return( 1 );
+    }
+
+    /* Initialize tables */
+    SetYUV( p_vout );
+    return( 0 );
+}
+
+/*****************************************************************************
+ * yuv_End: destroy translations tables
+ *****************************************************************************
+ * Free memory allocated by yuv_CCreate.
+ *****************************************************************************/
+static void yuv_End( vout_thread_t *p_vout )
+{
+    free( p_vout->yuv.p_base );
+    free( p_vout->yuv.p_buffer );
+    free( p_vout->yuv.p_offset );
+}
+
+/*****************************************************************************
+ * yuv_Reset: re-initialize translations tables
+ *****************************************************************************
+ * This function will initialize the tables allocated by vout_CreateTables and
+ * set functions pointers.
+ *****************************************************************************/
+static int yuv_Reset( vout_thread_t *p_vout )
+{
+    yuv_End( p_vout );
+    return( yuv_Init( p_vout ) );
+}
+
+/*****************************************************************************
+ * SetGammaTable: return intensity table transformed by gamma curve.
+ *****************************************************************************
+ * pi_table is a table of 256 entries from 0 to 255.
+ *****************************************************************************/
+static void SetGammaTable( int *pi_table, double f_gamma )
+{
+    int         i_y;                                       /* base intensity */
+
+    /* Use exp(gamma) instead of gamma */
+    f_gamma = exp( f_gamma );
+
+    /* Build gamma table */
+    for( i_y = 0; i_y < 256; i_y++ )
+    {
+        pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
+    }
+ }
+
+/*****************************************************************************
+ * SetYUV: compute tables and set function pointers
+ *****************************************************************************/
+static void SetYUV( vout_thread_t *p_vout )
+{
+    int         pi_gamma[256];                                /* gamma table */
+    int         i_index;                                  /* index in tables */
+
+    /* Build gamma table */
+    SetGammaTable( pi_gamma, p_vout->f_gamma );
+
+    /*
+     * Set pointers and build YUV tables
+     */
+    if( p_vout->b_grayscale )
+    {
+        /* Grayscale: build gray table */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            {
+                u16 bright[256], transp[256];
+
+                p_vout->yuv.yuv.p_gray8 =  (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
+                for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+                {
+                    p_vout->yuv.yuv.p_gray8[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                    p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+                }
+                for( i_index = 0; i_index < 256; i_index++)
+                {
+                    p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
+                    bright[ i_index ] = i_index << 8;
+                    transp[ i_index ] = 0;
+                }
+                /* the colors have been allocated, we can set the palette */
+                p_vout->pf_setpalette( p_vout, bright, bright, bright, transp );
+                p_vout->i_white_pixel = 0xff;
+                p_vout->i_black_pixel = 0x00;
+                p_vout->i_gray_pixel = 0x44;
+                p_vout->i_blue_pixel = 0x3b;
+
+                break;
+            }
+        case 2:
+            p_vout->yuv.yuv.p_gray16 =  (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
+            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_gray16[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++)
+            {
+                p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+            }
+            break;
+        case 3:
+        case 4:
+            p_vout->yuv.yuv.p_gray32 =  (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
+            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_gray32[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++)
+            {
+                p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+            }
+            break;
+         }
+    }
+    else
+    {
+        /* Color: build red, green and blue tables */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            {
+                #define RGB_MIN 0
+                #define RGB_MAX 255
+                #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
+
+                int y,u,v;
+                int r,g,b;
+                int uvr, uvg, uvb;
+                int i = 0, j = 0;
+                u16 red[256], green[256], blue[256], transp[256];
+                unsigned char lookup[PALETTE_TABLE_SIZE];
+
+                p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
+
+                /* this loop calculates the intersection of an YUV box
+                 * and the RGB cube. */
+                for ( y = 0; y <= 256; y += 16 )
+                {
+                    for ( u = 0; u <= 256; u += 32 )
+                    for ( v = 0; v <= 256; v += 32 )
+                    {
+                        uvr = (V_RED_COEF*(v-128)) >> SHIFT;
+                        uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
+                        uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
+                        r = y + uvr;
+                        g = y + uvg;
+                        b = y + uvb;
+
+                        if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
+                                && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
+                        {
+                            /* this one should never happen unless someone fscked up my code */
+                            if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette" ); break; }
+
+                            /* clip the colors */
+                            red[j] = CLIP( r );
+                            green[j] = CLIP( g );
+                            blue[j] = CLIP( b );
+                            transp[j] = 0;
+
+                            /* allocate color */
+                            lookup[i] = 1;
+                            p_vout->yuv.yuv.p_rgb8[i++] = j;
+                            j++;
+                        }
+                        else
+                        {
+                            lookup[i] = 0;
+                            p_vout->yuv.yuv.p_rgb8[i++] = 0;
+                        }
+                    }
+                    i += 128-81;
+                }
+
+                /* the colors have been allocated, we can set the palette */
+                /* there will eventually be a way to know which colors
+                 * couldn't be allocated and try to find a replacement */
+                p_vout->pf_setpalette( p_vout, red, green, blue, transp );
+
+                p_vout->i_white_pixel = 0xff;
+                p_vout->i_black_pixel = 0x00;
+                p_vout->i_gray_pixel = 0x44;
+                p_vout->i_blue_pixel = 0x3b;
+
+                i = 0;
+                /* this loop allocates colors that got outside
+                 * the RGB cube */
+                for ( y = 0; y <= 256; y += 16 )
+                {
+                    for ( u = 0; u <= 256; u += 32 )
+                    for ( v = 0; v <= 256; v += 32 )
+                    {
+                        int u2, v2;
+                        int dist, mindist = 100000000;
+
+                        if( lookup[i] || y==0)
+                        {
+                            i++;
+                            continue;
+                        }
+
+                        /* heavy. yeah. */
+                        for( u2 = 0; u2 <= 256; u2 += 32 )
+                        for( v2 = 0; v2 <= 256; v2 += 32 )
+                        {
+                            j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
+                            dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
+                            if( lookup[j] )
+                            /* find the nearest color */
+                            if( dist < mindist )
+                            {
+                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
+                                mindist = dist;
+                            }
+                            j -= 128;
+                            if( lookup[j] )
+                            /* find the nearest color */
+                            if( dist + 128 < mindist )
+                            {
+                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
+                                mindist = dist + 128;
+                            }
+                        }
+                        i++;
+                    }
+                    i += 128-81;
+                }
+
+                break;
+            }
+        case 2:
+            p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
+            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+            }
+            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+            }
+            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
+        case 3:
+        case 4:
+            p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
+            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+            }
+            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+            }
+            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
+        }
+    }
+
+    /*
+     * Set functions pointers
+     */
+    if( p_vout->b_YCbr)
+    {
+        switch( p_vout->i_bytes_per_pixel)
+        {
+#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
+        case 1:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr8 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr8 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr8 );
+            break;
+        
+        case 2:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr16 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr16 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr16 );
+           break;
+        
+        case 3:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr24 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr24 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr24 );
+             break;
+        
+        case 4:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420YCbr32 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422YCbr32 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444YCbr32 );
+            break;
+        }
+#undef _X
+    }    
+    else if( p_vout->b_grayscale )
+    {
+        /* Grayscale */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
+        case 1:
+            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray8 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray8 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray8 );
+            break;
+        case 2:
+            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray16 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray16 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray16 );
+            break;
+        case 3:
+            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray24 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray24 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray24 );
+            break;
+        case 4:
+            p_vout->yuv.pf_yuv420 = _X( ConvertY4Gray32 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertY4Gray32 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertY4Gray32 );
+            break;
+#undef _X
+        }
+    }
+    else
+    {
+        /* Color */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+#define _X( foo ) (vout_yuv_convert_t *) _M( foo )
+        case 1:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB8 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB8 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB8 );
+            break;
+        case 2:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB16 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB16 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB16 );
+            break;
+        case 3:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB24 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB24 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB24 );
+            break;
+        case 4:
+            p_vout->yuv.pf_yuv420 = _X( ConvertYUV420RGB32 );
+            p_vout->yuv.pf_yuv422 = _X( ConvertYUV422RGB32 );
+            p_vout->yuv.pf_yuv444 = _X( ConvertYUV444RGB32 );
+            break;
+#undef _X
+      }
+    }
+}
+
+/*****************************************************************************
+ * SetOffset: build offset array for conversion functions
+ *****************************************************************************
+ * This function will build an offset array used in later conversion functions.
+ * It will also set horizontal and vertical scaling indicators. If b_double
+ * is set, the p_offset structure has interleaved Y and U/V offsets.
+ *****************************************************************************/
+void _M( SetOffset )( int i_width, int i_height, int i_pic_width,
+                      int i_pic_height, boolean_t *pb_h_scaling,
+                      int *pi_v_scaling, int *p_offset, boolean_t b_double )
+{
+    int i_x;                                    /* x position in destination */
+    int i_scale_count;                                     /* modulo counter */
+
+    /*
+     * Prepare horizontal offset array
+     */
+    if( i_pic_width - i_width == 0 )
+    {
+        /* No horizontal scaling: YUV conversion is done directly to picture */
+        *pb_h_scaling = 0;
+    }
+    else if( i_pic_width - i_width > 0 )
+    {
+        /* Prepare scaling array for horizontal extension */
+        *pb_h_scaling = 1;
+        i_scale_count = i_pic_width;
+        if( !b_double )
+        {
+            for( i_x = i_width; i_x--; )
+            {
+                while( (i_scale_count -= i_width) > 0 )
+                {
+                    *p_offset++ = 0;
+                }
+                *p_offset++ = 1;
+                i_scale_count += i_pic_width;
+            }
+        }
+        else
+        {
+            int i_dummy = 0;
+            for( i_x = i_width; i_x--; )
+            {
+                while( (i_scale_count -= i_width) > 0 )
+                {
+                    *p_offset++ = 0;
+                    *p_offset++ = 0;
+                }
+                *p_offset++ = 1;
+                *p_offset++ = i_dummy;
+                i_dummy = 1 - i_dummy;
+                i_scale_count += i_pic_width;
+            }
+        }
+    }
+    else /* if( i_pic_width - i_width < 0 ) */
+    {
+        /* Prepare scaling array for horizontal reduction */
+        *pb_h_scaling = 1;
+        i_scale_count = i_width;
+        if( !b_double )
+        {
+           for( i_x = i_pic_width; i_x--; )
+            {
+                *p_offset = 1;
+                while( (i_scale_count -= i_pic_width) > 0 )
+                {
+                    *p_offset += 1;
+                }
+                p_offset++;
+                i_scale_count += i_width;
+            }
+        }
+        else
+        {
+            int i_remainder = 0;
+            int i_jump;
+            for( i_x = i_pic_width; i_x--; )
+            {
+                i_jump = 1;
+                while( (i_scale_count -= i_pic_width) > 0 )
+                {
+                    i_jump += 1;
+                }
+                *p_offset++ = i_jump;
+                *p_offset++ = ( i_jump += i_remainder ) >> 1;
+                i_remainder = i_jump & 1;
+                i_scale_count += i_width;
+            }
+        }
+     }
+
+    /*
+     * Set vertical scaling indicator
+     */
+    if( i_pic_height - i_height == 0 )
+    {
+        *pi_v_scaling = 0;
+    }
+    else if( i_pic_height - i_height > 0 )
+    {
+        *pi_v_scaling = 1;
+    }
+    else /* if( i_pic_height - i_height < 0 ) */
+    {
+        *pi_v_scaling = -1;
+    }
+}
+
diff --git a/plugins/chroma/transforms.h b/plugins/chroma/transforms.h
new file mode 100644 (file)
index 0000000..43e577d
--- /dev/null
@@ -0,0 +1,302 @@
+/*****************************************************************************
+ * transforms_common.h: Chroma transformation macros
+ *****************************************************************************
+ * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * $Id: transforms.h,v 1.1 2001/12/16 16:18:36 sam Exp $
+ *
+ * Authors: Vincent Seguin <seguin@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * CONVERT_*_PIXEL: pixel conversion macros
+ *****************************************************************************
+ * These conversion routines are used by YUV conversion functions.
+ * conversion are made from p_y, p_u, p_v, which are modified, to p_buffer,
+ * which is also modified. CONVERT_4YUV_PIXEL is used for 8bpp dithering,
+ * CONVERT_4YUV_PIXEL_SCALE does the same but also scales the output.
+ *****************************************************************************/
+#define CONVERT_Y_PIXEL( BPP )                                                \
+    /* Only Y sample is present */                                            \
+    p_ybase = p_yuv + *p_y++;                                                 \
+    *p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] |     \
+        p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT)       \
+        + i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
+
+#define CONVERT_YUV_PIXEL( BPP )                                              \
+    /* Y, U and V samples are present */                                      \
+    i_uval =    *p_u++;                                                       \
+    i_vval =    *p_v++;                                                       \
+    i_red =     (V_RED_COEF * i_vval) >> SHIFT;                               \
+    i_green =   (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT;     \
+    i_blue =    (U_BLUE_COEF * i_uval) >> SHIFT;                              \
+    CONVERT_Y_PIXEL( BPP )                                                    \
+
+#define CONVERT_4YUV_PIXEL( CHROMA )                                         \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither10[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u + dither20[i_real_y]) >> 5) * 9                                \
+      + ((*p_v + dither20[i_real_y]) >> 5) ];                                 \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither11[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u++ + dither21[i_real_y]) >> 5) * 9                              \
+      + ((*p_v++ + dither21[i_real_y]) >> 5) ];                               \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither12[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u + dither22[i_real_y]) >> 5) * 9                                \
+      + ((*p_v + dither22[i_real_y]) >> 5) ];                                 \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither13[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u++ + dither23[i_real_y]) >> 5) * 9                              \
+      + ((*p_v++ + dither23[i_real_y]) >> 5) ];                               \
+
+#define CONVERT_4YUV_PIXEL_SCALE( CHROMA )                                   \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither10[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither20[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither20[i_real_y]) >> 5) ];                               \
+    p_y += *p_offset++;                                                       \
+    p_u += *p_offset;                                                         \
+    p_v += *p_offset++;                                                       \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither11[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither21[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither21[i_real_y]) >> 5) ];                               \
+    p_y += *p_offset++;                                                       \
+    p_u += *p_offset;                                                         \
+    p_v += *p_offset++;                                                       \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither12[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither22[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither22[i_real_y]) >> 5) ];                               \
+    p_y += *p_offset++;                                                       \
+    p_u += *p_offset;                                                         \
+    p_v += *p_offset++;                                                       \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither13[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither23[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither23[i_real_y]) >> 5) ];                               \
+    p_y += *p_offset++;                                                       \
+    p_u += *p_offset;                                                         \
+    p_v += *p_offset++;                                                       \
+
+/*****************************************************************************
+ * SCALE_WIDTH: scale a line horizontally
+ *****************************************************************************
+ * This macro scales a line using rendering buffer and offset array. It works
+ * for 1, 2 and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_WIDTH                                                           \
+    if( b_horizontal_scaling )                                                \
+    {                                                                         \
+        /* Horizontal scaling, conversion has been done to buffer.            \
+         * Rewind buffer and offset, then copy and scale line */              \
+        p_buffer = p_buffer_start;                                            \
+        p_offset = p_offset_start;                                            \
+        for( i_x = i_pic_width / 16; i_x--; )                                 \
+        {                                                                     \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+        }                                                                     \
+        p_pic += i_pic_line_width;                                            \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        /* No scaling, conversion has been done directly in picture memory.   \
+         * Increment of picture pointer to end of line is still needed */     \
+        p_pic += i_pic_width + i_pic_line_width;                              \
+    }                                                                         \
+
+/*****************************************************************************
+ * SCALE_WIDTH_DITHER: scale a line horizontally for dithered 8 bpp
+ *****************************************************************************
+ * This macro scales a line using an offset array.
+ *****************************************************************************/
+#define SCALE_WIDTH_DITHER( CHROMA )                                          \
+    if( b_horizontal_scaling )                                                \
+    {                                                                         \
+        /* Horizontal scaling - we can't use a buffer due to dithering */     \
+        p_offset = p_offset_start;                                            \
+        for( i_x = i_pic_width / 16; i_x--; )                                 \
+        {                                                                     \
+            CONVERT_4YUV_PIXEL_SCALE( CHROMA )                               \
+            CONVERT_4YUV_PIXEL_SCALE( CHROMA )                               \
+            CONVERT_4YUV_PIXEL_SCALE( CHROMA )                               \
+            CONVERT_4YUV_PIXEL_SCALE( CHROMA )                               \
+        }                                                                     \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        for( i_x = i_width / 16; i_x--;  )                                    \
+        {                                                                     \
+            CONVERT_4YUV_PIXEL( CHROMA )                                     \
+            CONVERT_4YUV_PIXEL( CHROMA )                                     \
+            CONVERT_4YUV_PIXEL( CHROMA )                                     \
+            CONVERT_4YUV_PIXEL( CHROMA )                                     \
+        }                                                                     \
+    }                                                                         \
+    /* Increment of picture pointer to end of line is still needed */         \
+    p_pic += i_pic_line_width;                                                \
+                                                                              \
+    /* Increment the Y coordinate in the matrix, modulo 4 */                  \
+    i_real_y = (i_real_y + 1) & 0x3;                                          \
+
+/*****************************************************************************
+ * SCALE_HEIGHT: handle vertical scaling
+ *****************************************************************************
+ * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
+ * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
+ * and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_HEIGHT( CHROMA, BPP )                                           \
+    /* If line is odd, rewind 4:2:0 U and V samples */                        \
+    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
+    {                                                                         \
+        p_u -= i_chroma_width;                                                \
+        p_v -= i_chroma_width;                                                \
+    }                                                                         \
+                                                                              \
+    /*                                                                        \
+     * Handle vertical scaling. The current line can be copied or next one    \
+     * can be ignored.                                                        \
+     */                                                                       \
+    switch( i_vertical_scaling )                                              \
+    {                                                                         \
+    case -1:                             /* vertical scaling factor is < 1 */ \
+        while( (i_scale_count -= i_pic_height) > 0 )                          \
+        {                                                                     \
+            /* Height reduction: skip next source line */                     \
+            p_y += i_width;                                                   \
+            i_y++;                                                            \
+            if( (CHROMA == 420) || (CHROMA == 422) )                          \
+            {                                                                 \
+                if( i_y & 0x1 )                                               \
+                {                                                             \
+                    p_u += i_chroma_width;                                    \
+                    p_v += i_chroma_width;                                    \
+                }                                                             \
+            }                                                                 \
+            else if( CHROMA == 444 )                                          \
+            {                                                                 \
+                p_u += i_width;                                               \
+                p_v += i_width;                                               \
+            }                                                                 \
+        }                                                                     \
+        i_scale_count += i_height;                                            \
+        break;                                                                \
+    case 1:                              /* vertical scaling factor is > 1 */ \
+        while( (i_scale_count -= i_height) > 0 )                              \
+        {                                                                     \
+            /* Height increment: copy previous picture line */                \
+            for( i_x = i_pic_width / 16; i_x--; )                             \
+            {                                                                 \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                if( BPP > 1 )                               /* 2, 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 2 )                                  /* 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 3 )                                     /* 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+            }                                                                 \
+            p_pic +=        i_pic_line_width;                                 \
+            p_pic_start +=  i_pic_line_width;                                 \
+        }                                                                     \
+        i_scale_count += i_pic_height;                                        \
+        break;                                                                \
+    }                                                                         \
+
+/*****************************************************************************
+ * SCALE_HEIGHT_DITHER: handle vertical scaling for dithered 8 bpp
+ *****************************************************************************
+ * This macro handles vertical scaling for a picture. CHROMA may be 420,
+ * 422 or 444 for RGB conversion, or 400 for gray conversion.
+ *****************************************************************************/
+#define SCALE_HEIGHT_DITHER( CHROMA )                                         \
+                                                                              \
+    /* If line is odd, rewind 4:2:0 U and V samples */                        \
+    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
+    {                                                                         \
+        p_u -= i_chroma_width;                                                \
+        p_v -= i_chroma_width;                                                \
+    }                                                                         \
+                                                                              \
+    /*                                                                        \
+     * Handle vertical scaling. The current line can be copied or next one    \
+     * can be ignored.                                                        \
+     */                                                                       \
+                                                                              \
+    switch( i_vertical_scaling )                                              \
+    {                                                                         \
+    case -1:                             /* vertical scaling factor is < 1 */ \
+        while( (i_scale_count -= i_pic_height) > 0 )                          \
+        {                                                                     \
+            /* Height reduction: skip next source line */                     \
+            p_y += i_width;                                                   \
+            i_y++;                                                            \
+            if( (CHROMA == 420) || (CHROMA == 422) )                          \
+            {                                                                 \
+                if( i_y & 0x1 )                                               \
+                {                                                             \
+                    p_u += i_chroma_width;                                    \
+                    p_v += i_chroma_width;                                    \
+                }                                                             \
+            }                                                                 \
+            else if( CHROMA == 444 )                                          \
+            {                                                                 \
+                p_u += i_width;                                               \
+                p_v += i_width;                                               \
+            }                                                                 \
+        }                                                                     \
+        i_scale_count += i_height;                                            \
+        break;                                                                \
+    case 1:                              /* vertical scaling factor is > 1 */ \
+        while( (i_scale_count -= i_height) > 0 )                              \
+        {                                                                     \
+            p_y -= i_width;                                                   \
+            p_u -= i_chroma_width;                                            \
+            p_v -= i_chroma_width;                                            \
+            SCALE_WIDTH_DITHER( CHROMA );                                     \
+        }                                                                     \
+        i_scale_count += i_pic_height;                                        \
+        break;                                                                \
+    }                                                                         \
+
diff --git a/plugins/chroma/yv12_rgb8.c b/plugins/chroma/yv12_rgb8.c
new file mode 100644 (file)
index 0000000..dad8c1a
--- /dev/null
@@ -0,0 +1,316 @@
+/*****************************************************************************
+ * yv12_rgb8.c : YUV to paletted RGB8 conversion module for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ * $Id: yv12_rgb8.c,v 1.1 2001/12/16 16:18:36 sam Exp $
+ *
+ * Authors: Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME yv12_rgb8.c
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <string.h>                                            /* strerror() */
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "chroma_common.h"
+#include "transforms.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+/*****************************************************************************
+ * chroma_sys_t: chroma method descriptor
+ *****************************************************************************
+ * This structure is part of the chroma transformation descriptor, it
+ * describes the yuv2rgb8 specific properties.
+ *****************************************************************************/
+typedef struct chroma_sys_s
+{
+    u8 *p_tables;
+    u8 *p_buffer;
+    u8 *p_offset;
+} chroma_sys_t;
+
+/*****************************************************************************
+ * Local and extern prototypes.
+ *****************************************************************************/
+static void chroma_getfunctions ( function_list_t * p_function_list );
+
+static int  chroma_Probe        ( probedata_t *p_data );
+static int  chroma_Init         ( vout_thread_t *p_vout, probedata_t *p_data );
+static int  chroma_End          ( vout_thread_t *p_vout );
+
+static void ConvertY4Gray8      ( vout_thread_t *, picture_t *, picture_t * );
+static void ConvertYUV420RGB8   ( vout_thread_t *, picture_t *, picture_t * );
+
+/*****************************************************************************
+ * Build configuration tree.
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for YV12 to RGB8 module" )
+    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
+MODULE_CONFIG_STOP
+
+MODULE_INIT_START
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL
+                                | MODULE_CAPABILITY_CHROMA;
+    p_module->psz_longname = "YV12 to paletted RGB8 conversion module";
+MODULE_INIT_STOP
+
+MODULE_ACTIVATE_START
+    _M( chroma_getfunctions )( &p_module->p_functions->chroma );
+MODULE_ACTIVATE_STOP
+
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
+
+/*****************************************************************************
+ * Local prototypes.
+ *****************************************************************************/
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+void _M( chroma_getfunctions )( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = chroma_Probe;
+    p_function_list->functions.chroma.pf_init = chroma_Init;
+    p_function_list->functions.chroma.pf_end  = chroma_End;
+}
+
+/*****************************************************************************
+ * chroma_Probe: return a score
+ *****************************************************************************
+ * This function checks that we can handle the required data
+ *****************************************************************************/
+static int chroma_Probe( probedata_t *p_data )
+{
+    if( p_data->chroma.source.i_chroma != YUV_420_PICTURE
+         || p_data->chroma.dest.i_chroma != RGB_8BPP_PICTURE )
+    {
+        return 0;
+    }
+
+    return( 100 );
+}
+
+/*****************************************************************************
+ * chroma_Init: allocate a chroma function
+ *****************************************************************************
+ * This function allocates and initializes a chroma function
+ *****************************************************************************/
+static int chroma_Init( vout_thread_t *p_vout, probedata_t *p_data )
+{
+    if( p_data->chroma.source.i_chroma != YUV_420_PICTURE
+         || p_data->chroma.dest.i_chroma != RGB_8BPP_PICTURE )
+    {
+        return 0;
+    }
+
+    p_vout->chroma.p_sys = malloc( sizeof( chroma_sys_t ) );
+    if( p_vout->chroma.p_sys == NULL )
+    {
+        return 0;
+    }
+
+    p_vout->chroma.p_sys->p_tables = malloc( sizeof( u8 ) *
+                (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE) );
+    if( p_vout->chroma.p_sys->p_tables == NULL )
+    {
+        free( p_vout->chroma.p_sys );
+        return 0;
+    }
+
+    p_vout->chroma.p_sys->p_buffer = malloc( sizeof( u8 ) * VOUT_MAX_WIDTH );
+    if( p_vout->chroma.p_sys->p_buffer == NULL )
+    {
+        free( p_vout->chroma.p_sys->p_tables );
+        free( p_vout->chroma.p_sys );
+        return 0;
+    }
+
+    p_vout->chroma.p_sys->p_offset = malloc( sizeof( int ) *
+                                           2 * p_data->chroma.dest.i_width );
+    if( p_vout->chroma.p_sys->p_buffer == NULL )
+    {
+        free( p_vout->chroma.p_sys->p_offset );
+        free( p_vout->chroma.p_sys->p_tables );
+        free( p_vout->chroma.p_sys );
+        return 0;
+    }
+
+    //SetYUV( p_vout );
+
+    return 0; 
+}
+
+/*****************************************************************************
+ * chroma_End: free the chroma function
+ *****************************************************************************
+ * This function frees the previously allocated chroma function
+ *****************************************************************************/
+static int chroma_End( vout_thread_t *p_vout )
+{
+    return 0; 
+}
+
+/* Following functions are local */
+
+#if 0
+/*****************************************************************************
+ * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
+ *****************************************************************************/
+static void ConvertY4Gray8( vout_thread_t *p_vout, picture_t *p_source,
+                                                   picture_t *p_dest )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u8 *        p_gray;                             /* base conversion table */
+    u8 *        p_pic_start;       /* beginning of the current line for copy */
+    u8 *        p_buffer_start;                   /* conversion buffer start */
+    u8 *        p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+//    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->chroma.p_sys->p_gray8;
+    p_buffer_start =    p_vout->chroma.p_sys->p_buffer;
+    p_offset_start =    p_vout->chroma.p_sys->p_offset;
+    _M( SetOffset )( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start, 0 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? i_pic_height : i_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 1);
+    }
+}
+#endif
+
+/*****************************************************************************
+ * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
+ *****************************************************************************/
+static void ConvertYUV420RGB8( vout_thread_t *p_vout, picture_t *p_source,
+                                                      picture_t *p_dest )
+{
+    printf( "Colorspace transformation, YV12 to RGB8\n");
+#if 0
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_real_y;                                           /* y % 4 */
+    u8 *        p_lookup;                                    /* lookup table */
+    int         i_chroma_width;                              /* chroma width */
+    u8 *        p_offset_start;                        /* offset array start */
+    u8 *        p_offset;                            /* offset array pointer */
+
+    int i_pic_line_width = p_source->i_width; /* XXX not sure */
+    int i_width = p_source->i_width;
+    int i_height = p_source->i_height;
+    int i_pic_width = p_dest->i_width;
+    int i_pic_height = p_dest->i_height;
+    u8* p_y = p_source->planes[ Y_PLANE ].p_data;
+    u8* p_u = p_source->planes[ U_PLANE ].p_data;
+    u8* p_v = p_source->planes[ V_PLANE ].p_data;
+    u8* p_pic = p_dest->planes[ RGB_PLANE ].p_data;
+
+    /* 
+     * The dithering matrices
+     */
+    static int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
+    static int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
+    static int dither12[4] = {  0x3,  0xb,  0x1,  0x9 };
+    static int dither13[4] = {  0xf,  0x7,  0xd,  0x5 };
+
+    static int dither20[4] = {  0x0, 0x10,  0x4, 0x14 };
+    static int dither21[4] = { 0x18,  0x8, 0x1c,  0xc };
+    static int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
+    static int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= p_dest->i_width; /*i_pic_width*/
+    i_chroma_width =    p_source->i_width / 2;
+    p_offset_start =    p_vout->chroma.p_sys->p_offset;
+    p_lookup =          p_vout->chroma.p_sys->p_tables;
+    _M( SetOffset )( p_source->i_width, p_source->i_height,
+                     p_dest->i_width, p_dest->i_height,
+                     &b_horizontal_scaling, &i_vertical_scaling,
+                     p_offset_start, 1 );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = ( i_vertical_scaling == 1 ) ? p_dest->i_height : p_source->i_height;
+    i_real_y = 0;
+    for( i_y = 0; i_y < p_source->i_height; i_y++ )
+    {
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH_DITHER( 420 );
+        SCALE_HEIGHT_DITHER( 420 );
+    }
+#endif
+}
+
index aacff2dbacecac35672ea0cfe4457268ae7732e8..2cf5b4c7257a30f188735d96fef005e7b685b0f3 100644 (file)
@@ -2,7 +2,7 @@
  * vout_dummy.c: Dummy video output display method for testing purposes
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_dummy.c,v 1.11 2001/12/13 12:47:17 sam Exp $
+ * $Id: vout_dummy.c,v 1.12 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -255,7 +255,7 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
         /* Precalculate some values */
         p_pic->i_size         = i_width * i_height;
         p_pic->i_chroma_width = i_width / 2;
-        p_pic->i_chroma_size  = i_width * i_height / 2;
+        p_pic->i_chroma_size  = i_width * ( i_height / 2 );
 
         /* Allocate the memory buffer */
         i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
@@ -264,14 +264,17 @@ static int DummyNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
         /* Y buffer */
         p_pic->planes[ Y_PLANE ].p_data = malloc( i_luma_bytes + 2 * i_chroma_bytes );
         p_pic->planes[ Y_PLANE ].i_bytes = i_luma_bytes;
+        p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof(pixel_data_t);
 
         /* U buffer */
         p_pic->planes[ U_PLANE ].p_data = p_pic->planes[ Y_PLANE ].p_data + i_height * i_width;
-        p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes;
+        p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes / 2;
+        p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
 
         /* V buffer */
         p_pic->planes[ V_PLANE ].p_data = p_pic->planes[ U_PLANE ].p_data + i_height * p_pic->i_chroma_width;
-        p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes;
+        p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes / 2;
+        p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
 
         /* We allocated 3 planes */
         p_pic->i_planes = 3;
diff --git a/plugins/filter/.cvsignore b/plugins/filter/.cvsignore
new file mode 100644 (file)
index 0000000..63e7180
--- /dev/null
@@ -0,0 +1 @@
+.dep
diff --git a/plugins/filter/Makefile b/plugins/filter/Makefile
new file mode 100644 (file)
index 0000000..5c8cae5
--- /dev/null
@@ -0,0 +1,43 @@
+###############################################################################
+# vlc (VideoLAN Client) image filter modules makefile
+# (c)2001 VideoLAN
+###############################################################################
+
+#
+# Objects
+#
+
+PLUGIN_BOB = bob.o
+PLUGIN_INVERT = invert.o
+
+BUILTIN_BOB = $(PLUGIN_BOB:%.o=BUILTIN_%.o)
+BUILTIN_INVERT = $(PLUGIN_INVERT:%.o=BUILTIN_%.o)
+
+PLUGIN_C = $(PLUGIN_BOB) $(PLUGIN_INVERT)
+BUILTIN_C = $(BUILTIN_BOB) $(BUILTIN_INVERT)
+ALL_OBJ = $(PLUGIN_C) $(BUILTIN_C)
+
+#
+# Virtual targets
+#
+
+include ../../Makefile.modules
+
+#
+# Real targets
+#
+
+../filter_bob.so: $(PLUGIN_BOB)
+       $(CC) -o $@ $^ $(PLCFLAGS) 
+
+../filter_bob.a: $(BUILTIN_BOB)
+       ar r $@ $^
+       $(RANLIB) $@
+
+../filter_invert.so: $(PLUGIN_INVERT)
+       $(CC) -o $@ $^ $(PLCFLAGS) 
+
+../filter_invert.a: $(BUILTIN_INVERT)
+       ar r $@ $^
+       $(RANLIB) $@
+
diff --git a/plugins/filter/bob.c b/plugins/filter/bob.c
new file mode 100644 (file)
index 0000000..9021a15
--- /dev/null
@@ -0,0 +1,382 @@
+/*****************************************************************************
+ * bob.c : BOB deinterlacer plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000, 2001 VideoLAN
+ * $Id: bob.c,v 1.1 2001/12/16 16:18:36 sam Exp $
+ *
+ * Authors: Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME filter_bob
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <errno.h>
+#include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>
+
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+#define BOB_MAX_DIRECTBUFFERS 8
+
+/*****************************************************************************
+ * Capabilities defined in the other files.
+ *****************************************************************************/
+static void vout_getfunctions( function_list_t * p_function_list );
+
+/*****************************************************************************
+ * Build configuration tree.
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for BOB module" )
+    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
+MODULE_CONFIG_STOP
+
+MODULE_INIT_START
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL
+                                | MODULE_CAPABILITY_VOUT;
+    p_module->psz_longname = "BOB deinterlacing module";
+MODULE_INIT_STOP
+
+MODULE_ACTIVATE_START
+    vout_getfunctions( &p_module->p_functions->vout );
+MODULE_ACTIVATE_STOP
+
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
+
+/*****************************************************************************
+ * vout_sys_t: BOB video output method descriptor
+ *****************************************************************************
+ * This structure is part of the video output thread descriptor.
+ * It describes the BOB specific properties of an output thread.
+ *****************************************************************************/
+typedef struct vout_sys_s
+{
+    struct vout_thread_s *p_vout;
+
+} vout_sys_t;
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static int  vout_Probe     ( probedata_t *p_data );
+static int  vout_Create    ( struct vout_thread_s * );
+static int  vout_Init      ( struct vout_thread_s * );
+static void vout_End       ( struct vout_thread_s * );
+static void vout_Destroy   ( struct vout_thread_s * );
+static int  vout_Manage    ( struct vout_thread_s * );
+static void vout_Display   ( struct vout_thread_s *, struct picture_s * );
+
+static int  BobNewPicture( struct vout_thread_s *, struct picture_s * );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+static void vout_getfunctions( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = vout_Probe;
+    p_function_list->functions.vout.pf_create     = vout_Create;
+    p_function_list->functions.vout.pf_init       = vout_Init;
+    p_function_list->functions.vout.pf_end        = vout_End;
+    p_function_list->functions.vout.pf_destroy    = vout_Destroy;
+    p_function_list->functions.vout.pf_manage     = vout_Manage;
+    p_function_list->functions.vout.pf_display    = vout_Display;
+    p_function_list->functions.vout.pf_setpalette = NULL;
+}
+
+/*****************************************************************************
+ * intf_Probe: return a score
+ *****************************************************************************/
+static int vout_Probe( probedata_t *p_data )
+{
+    if( TestMethod( VOUT_FILTER_VAR, "bob" ) )
+    {
+        return( 999 );
+    }
+
+    /* If we weren't asked to filter, don't filter. */
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Create: allocates BOB video thread output method
+ *****************************************************************************
+ * This function allocates and initializes a BOB vout method.
+ *****************************************************************************/
+static int vout_Create( vout_thread_t *p_vout )
+{
+    /* Allocate structure */
+    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
+    if( p_vout->p_sys == NULL )
+    {
+        intf_ErrMsg("error: %s", strerror(ENOMEM) );
+        return( 1 );
+    }
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Init: initialize BOB video thread output method
+ *****************************************************************************/
+static int vout_Init( vout_thread_t *p_vout )
+{
+    int i_index;
+    char *psz_filter;
+    picture_t *p_pic;
+    
+    I_OUTPUTPICTURES = 0;
+
+    /* Initialize the output structure, full of directbuffers since we want
+     * the decoder to output directly to our structures. */
+    switch( p_vout->render.i_chroma )
+    {
+        case YUV_420_PICTURE:
+            p_vout->output.i_chroma = p_vout->render.i_chroma;
+            p_vout->output.i_width  = p_vout->render.i_width;
+            p_vout->output.i_height = p_vout->render.i_height;
+            p_vout->output.i_aspect = p_vout->render.i_aspect;
+            break;
+
+        default:
+            return( 0 ); /* unknown chroma */
+            break;
+    }
+
+    /* Try to open the real video output, with half the height our images */
+    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+
+    intf_WarnMsg( 1, "filter: spawning the real video output" );
+        
+    p_vout->p_sys->p_vout =
+        vout_CreateThread( NULL,
+                           p_vout->output.i_width, p_vout->output.i_height / 2,
+                           p_vout->output.i_chroma, p_vout->output.i_aspect );
+
+    /* Everything failed */
+    if( p_vout->p_sys->p_vout == NULL )
+    {
+        intf_ErrMsg( "filter error: can't open vout, aborting" );
+
+        return( 0 );
+    }
+    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+
+    /* Try to initialize BOB_MAX_DIRECTBUFFERS direct buffers */
+    while( I_OUTPUTPICTURES < BOB_MAX_DIRECTBUFFERS )
+    {
+        p_pic = NULL;
+
+        /* Find an empty picture slot */
+        for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
+        {
+            if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
+            {
+                p_pic = p_vout->p_picture + i_index;
+                break;
+            }
+        }
+
+        /* Allocate the picture */
+        if( BobNewPicture( p_vout, p_pic ) )
+        {
+            break;
+        }
+
+        p_pic->i_status        = DESTROYED_PICTURE;
+        p_pic->i_type          = DIRECT_PICTURE;
+
+        p_pic->i_left_margin   =
+        p_pic->i_right_margin  =
+        p_pic->i_top_margin    =
+        p_pic->i_bottom_margin = 0;
+
+        PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
+
+        I_OUTPUTPICTURES++;
+    }
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_End: terminate BOB video thread output method
+ *****************************************************************************/
+static void vout_End( vout_thread_t *p_vout )
+{
+    int i_index;
+
+    /* Free the fake output buffers we allocated */
+    for( i_index = I_OUTPUTPICTURES ; i_index ; )
+    {
+        i_index--;
+        free( PP_OUTPUTPICTURE[ i_index ]->planes[ 0 ].p_data );
+    }
+}
+
+/*****************************************************************************
+ * vout_Destroy: destroy BOB video thread output method
+ *****************************************************************************
+ * Terminate an output method created by BOBCreateOutputMethod
+ *****************************************************************************/
+static void vout_Destroy( vout_thread_t *p_vout )
+{
+    vout_DestroyThread( p_vout->p_sys->p_vout, NULL );
+
+    free( p_vout->p_sys );
+}
+
+/*****************************************************************************
+ * vout_Manage: handle BOB events
+ *****************************************************************************
+ * This function should be called regularly by video output thread. It manages
+ * console events. It returns a non null value on error.
+ *****************************************************************************/
+static int vout_Manage( vout_thread_t *p_vout )
+{
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Display: displays previously rendered output
+ *****************************************************************************
+ * This function send the currently rendered image to BOB image, waits until
+ * it is displayed and switch the two rendering buffers, preparing next frame.
+ *****************************************************************************/
+static void vout_Display( vout_thread_t *p_vout, picture_t *p_inpic )
+{
+    picture_t *p_outpic;
+    int i_index, i_field;
+
+    for( i_field = 0 ; i_field < 2 ; i_field++ )
+    {
+        /* Get a structure from the video_output. */
+        while( ( p_outpic = vout_CreatePicture( p_vout->p_sys->p_vout,
+                                                0, 0, 0 ) )
+                  == NULL )
+        {
+            if( p_vout->b_die || p_vout->b_error )
+            {
+                return;
+            }
+            msleep( VOUT_OUTMEM_SLEEP );
+        }   
+
+        /* XXX: completely arbitrary values ! */
+        vout_DatePicture( p_vout->p_sys->p_vout, p_outpic,
+                          mdate() + (mtime_t)(50000 + i_field * 20000) );
+
+        /* Copy image and skip lines */
+        for( i_index = 0 ; i_index < p_inpic->i_planes ; i_index++ )
+        {
+            pixel_data_t *p_in, *p_end, *p_out;
+
+            p_in = p_inpic->planes[ i_index ].p_data
+                       + i_field * p_inpic->planes[ i_index ].i_line_bytes;
+
+            p_out = p_outpic->planes[ i_index ].p_data;
+            p_end = p_out + p_outpic->planes[ i_index ].i_bytes;
+
+            for( ; p_out < p_end ; )
+            {
+                p_main->fast_memcpy( p_out, p_in,
+                                     p_inpic->planes[ i_index ].i_line_bytes );
+
+                p_out += p_inpic->planes[ i_index ].i_line_bytes;
+                p_in += 2 * p_inpic->planes[ i_index ].i_line_bytes;
+            }
+        }
+
+        vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
+    }
+}
+
+
+/*****************************************************************************
+ * BobNewPicture: allocate a picture
+ *****************************************************************************
+ * Returns 0 on success, -1 otherwise
+ *****************************************************************************/
+static int BobNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
+{
+    int i_luma_bytes, i_chroma_bytes;
+
+    int i_width  = p_vout->output.i_width;
+    int i_height = p_vout->output.i_height;
+
+    switch( p_vout->output.i_chroma )
+    {
+    /* We know this chroma, allocate a buffer which will be used
+     * directly by the decoder */
+    case YUV_420_PICTURE:
+
+        /* Precalculate some values */
+        p_pic->i_size         = i_width * i_height;
+        p_pic->i_chroma_width = i_width / 2;
+        p_pic->i_chroma_size  = i_height * ( i_width / 2 );
+
+        /* Allocate the memory buffer */
+        i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
+        i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t);
+
+        /* Y buffer */
+        p_pic->planes[ Y_PLANE ].p_data = malloc( i_luma_bytes + 2 * i_chroma_bytes );
+        p_pic->planes[ Y_PLANE ].i_bytes = i_luma_bytes;
+        p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof(pixel_data_t);
+
+        /* U buffer */
+        p_pic->planes[ U_PLANE ].p_data = p_pic->planes[ Y_PLANE ].p_data + i_height * i_width;
+        p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes / 2;
+        p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
+
+        /* V buffer */
+        p_pic->planes[ V_PLANE ].p_data = p_pic->planes[ U_PLANE ].p_data + i_height * p_pic->i_chroma_width;
+        p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes / 2;
+        p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
+
+        /* We allocated 3 planes */
+        p_pic->i_planes = 3;
+
+        return( 0 );
+        break;
+
+    /* Unknown chroma, do nothing */
+    default:
+
+        return( 0 );
+        break;
+    }
+}
+
diff --git a/plugins/filter/invert.c b/plugins/filter/invert.c
new file mode 100644 (file)
index 0000000..6e030c8
--- /dev/null
@@ -0,0 +1,371 @@
+/*****************************************************************************
+ * invert.c : Invert video plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000, 2001 VideoLAN
+ * $Id: invert.c,v 1.1 2001/12/16 16:18:36 sam Exp $
+ *
+ * Authors: Samuel Hocevar <sam@zoy.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ *****************************************************************************/
+
+#define MODULE_NAME filter_invert
+#include "modules_inner.h"
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <errno.h>
+#include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>
+
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "intf_msg.h"
+#include "threads.h"
+#include "mtime.h"
+#include "tests.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "modules.h"
+#include "modules_export.h"
+
+#define INVERT_MAX_DIRECTBUFFERS 8
+
+/*****************************************************************************
+ * Capabilities defined in the other files.
+ *****************************************************************************/
+static void vout_getfunctions( function_list_t * p_function_list );
+
+/*****************************************************************************
+ * Build configuration tree.
+ *****************************************************************************/
+MODULE_CONFIG_START
+ADD_WINDOW( "Configuration for Invert module" )
+    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
+MODULE_CONFIG_STOP
+
+MODULE_INIT_START
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL
+                                | MODULE_CAPABILITY_VOUT;
+    p_module->psz_longname = "invert video module";
+MODULE_INIT_STOP
+
+MODULE_ACTIVATE_START
+    vout_getfunctions( &p_module->p_functions->vout );
+MODULE_ACTIVATE_STOP
+
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
+
+/*****************************************************************************
+ * vout_sys_t: Invert video output method descriptor
+ *****************************************************************************
+ * This structure is part of the video output thread descriptor.
+ * It describes the Invert specific properties of an output thread.
+ *****************************************************************************/
+typedef struct vout_sys_s
+{
+    struct vout_thread_s *p_vout;
+
+} vout_sys_t;
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static int  vout_Probe     ( probedata_t *p_data );
+static int  vout_Create    ( struct vout_thread_s * );
+static int  vout_Init      ( struct vout_thread_s * );
+static void vout_End       ( struct vout_thread_s * );
+static void vout_Destroy   ( struct vout_thread_s * );
+static int  vout_Manage    ( struct vout_thread_s * );
+static void vout_Display   ( struct vout_thread_s *, struct picture_s * );
+
+static int  InvertNewPicture( struct vout_thread_s *, struct picture_s * );
+
+/*****************************************************************************
+ * Functions exported as capabilities. They are declared as static so that
+ * we don't pollute the namespace too much.
+ *****************************************************************************/
+static void vout_getfunctions( function_list_t * p_function_list )
+{
+    p_function_list->pf_probe = vout_Probe;
+    p_function_list->functions.vout.pf_create     = vout_Create;
+    p_function_list->functions.vout.pf_init       = vout_Init;
+    p_function_list->functions.vout.pf_end        = vout_End;
+    p_function_list->functions.vout.pf_destroy    = vout_Destroy;
+    p_function_list->functions.vout.pf_manage     = vout_Manage;
+    p_function_list->functions.vout.pf_display    = vout_Display;
+    p_function_list->functions.vout.pf_setpalette = NULL;
+}
+
+/*****************************************************************************
+ * intf_Probe: return a score
+ *****************************************************************************/
+static int vout_Probe( probedata_t *p_data )
+{
+    if( TestMethod( VOUT_FILTER_VAR, "invert" ) )
+    {
+        return( 999 );
+    }
+
+    /* If we weren't asked to filter, don't filter. */
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Create: allocates Invert video thread output method
+ *****************************************************************************
+ * This function allocates and initializes a Invert vout method.
+ *****************************************************************************/
+static int vout_Create( vout_thread_t *p_vout )
+{
+    /* Allocate structure */
+    p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
+    if( p_vout->p_sys == NULL )
+    {
+        intf_ErrMsg("error: %s", strerror(ENOMEM) );
+        return( 1 );
+    }
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Init: initialize Invert video thread output method
+ *****************************************************************************/
+static int vout_Init( vout_thread_t *p_vout )
+{
+    int i_index;
+    char *psz_filter;
+    picture_t *p_pic;
+    
+    I_OUTPUTPICTURES = 0;
+
+    /* Try to open the real video output */
+    psz_filter = main_GetPszVariable( VOUT_FILTER_VAR, "" );
+    main_PutPszVariable( VOUT_FILTER_VAR, "" );
+
+    intf_WarnMsg( 1, "filter: spawning the real video output" );
+        
+    p_vout->p_sys->p_vout =
+        vout_CreateThread( NULL,
+                           p_vout->render.i_width, p_vout->render.i_height,
+                           p_vout->render.i_chroma, p_vout->render.i_aspect );
+
+    /* Everything failed */
+    if( p_vout->p_sys->p_vout == NULL )
+    {
+        intf_ErrMsg( "filter error: can't open vout, aborting" );
+
+        return( 0 );
+    }
+    main_PutPszVariable( VOUT_FILTER_VAR, psz_filter );
+
+    /* Initialize the output structure */
+    switch( p_vout->render.i_chroma )
+    {
+        case YUV_420_PICTURE:
+            p_vout->output.i_chroma = p_vout->render.i_chroma;
+            p_vout->output.i_width  = p_vout->render.i_width;
+            p_vout->output.i_height = p_vout->render.i_height;
+            p_vout->output.i_aspect = p_vout->render.i_aspect;
+            break;
+
+        default:
+            p_vout->output.i_chroma = EMPTY_PICTURE; /* unknown chroma */
+            break;
+    }
+
+    /* Try to initialize INVERT_MAX_DIRECTBUFFERS direct buffers */
+    while( I_OUTPUTPICTURES < INVERT_MAX_DIRECTBUFFERS )
+    {
+        p_pic = NULL;
+
+        /* Find an empty picture slot */
+        for( i_index = 0 ; i_index < VOUT_MAX_PICTURES ; i_index++ )
+        {
+            if( p_vout->p_picture[ i_index ].i_status == FREE_PICTURE )
+            {
+                p_pic = p_vout->p_picture + i_index;
+                break;
+            }
+        }
+
+        /* Allocate the picture */
+        if( InvertNewPicture( p_vout, p_pic ) )
+        {
+            break;
+        }
+
+        p_pic->i_status        = DESTROYED_PICTURE;
+        p_pic->i_type          = DIRECT_PICTURE;
+
+        p_pic->i_left_margin   =
+        p_pic->i_right_margin  =
+        p_pic->i_top_margin    =
+        p_pic->i_bottom_margin = 0;
+
+        PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
+
+        I_OUTPUTPICTURES++;
+    }
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_End: terminate Invert video thread output method
+ *****************************************************************************/
+static void vout_End( vout_thread_t *p_vout )
+{
+    int i_index;
+
+    /* Free the fake output buffers we allocated */
+    for( i_index = I_OUTPUTPICTURES ; i_index ; )
+    {
+        i_index--;
+        free( PP_OUTPUTPICTURE[ i_index ]->planes[ 0 ].p_data );
+    }
+}
+
+/*****************************************************************************
+ * vout_Destroy: destroy Invert video thread output method
+ *****************************************************************************
+ * Terminate an output method created by InvertCreateOutputMethod
+ *****************************************************************************/
+static void vout_Destroy( vout_thread_t *p_vout )
+{
+    vout_DestroyThread( p_vout->p_sys->p_vout, NULL );
+
+    free( p_vout->p_sys );
+}
+
+/*****************************************************************************
+ * vout_Manage: handle Invert events
+ *****************************************************************************
+ * This function should be called regularly by video output thread. It manages
+ * console events. It returns a non null value on error.
+ *****************************************************************************/
+static int vout_Manage( vout_thread_t *p_vout )
+{
+    return( 0 );
+}
+
+/*****************************************************************************
+ * vout_Display: displays previously rendered output
+ *****************************************************************************
+ * This function send the currently rendered image to Invert image, waits
+ * until it is displayed and switch the two rendering buffers, preparing next
+ * frame.
+ *****************************************************************************/
+static void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
+{
+    picture_t *p_outpic;
+    int i_index;
+
+    /* This is a new frame. Get a structure from the video_output. */
+    while( ( p_outpic = vout_CreatePicture( p_vout->p_sys->p_vout, 0, 0, 0 ) )
+              == NULL )
+    {
+        if( p_vout->b_die || p_vout->b_error )
+        {
+            return;
+        }
+        msleep( VOUT_OUTMEM_SLEEP );
+    }   
+
+    vout_DatePicture( p_vout->p_sys->p_vout, p_outpic, mdate() + 50000 );
+    vout_LinkPicture( p_vout->p_sys->p_vout, p_outpic );
+
+    for( i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
+    {
+        pixel_data_t *p_in = p_pic->planes[ i_index ].p_data;
+        pixel_data_t *p_end = p_in + p_pic->planes[ i_index ].i_bytes;
+
+        pixel_data_t *p_out = p_outpic->planes[ i_index ].p_data;
+
+        for( ; p_in < p_end ; )
+        {
+            *p_out++ = ~( *p_in++ );
+        }
+    }
+
+    vout_UnlinkPicture( p_vout->p_sys->p_vout, p_outpic );
+
+    vout_DisplayPicture( p_vout->p_sys->p_vout, p_outpic );
+}
+
+
+/*****************************************************************************
+ * InvertNewPicture: allocate a picture
+ *****************************************************************************
+ * Returns 0 on success, -1 otherwise
+ *****************************************************************************/
+static int InvertNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
+{
+    int i_luma_bytes, i_chroma_bytes;
+
+    int i_width  = p_vout->output.i_width;
+    int i_height = p_vout->output.i_height;
+
+    switch( p_vout->output.i_chroma )
+    {
+    /* We know this chroma, allocate a buffer which will be used
+     * directly by the decoder */
+    case YUV_420_PICTURE:
+
+        /* Precalculate some values */
+        p_pic->i_size         = i_width * i_height;
+        p_pic->i_chroma_width = i_width / 2;
+        p_pic->i_chroma_size  = i_height * ( i_width / 2 );
+
+        /* Allocate the memory buffer */
+        i_luma_bytes = p_pic->i_size * sizeof(pixel_data_t);
+        i_chroma_bytes = p_pic->i_chroma_size * sizeof(pixel_data_t);
+
+        /* Y buffer */
+        p_pic->planes[ Y_PLANE ].p_data = malloc( i_luma_bytes + 2 * i_chroma_bytes );
+        p_pic->planes[ Y_PLANE ].i_bytes = i_luma_bytes;
+        p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof(pixel_data_t);
+
+        /* U buffer */
+        p_pic->planes[ U_PLANE ].p_data = p_pic->planes[ Y_PLANE ].p_data + i_height * i_width;
+        p_pic->planes[ U_PLANE ].i_bytes = i_chroma_bytes / 2;
+        p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
+
+        /* V buffer */
+        p_pic->planes[ V_PLANE ].p_data = p_pic->planes[ U_PLANE ].p_data + i_height * p_pic->i_chroma_width;
+        p_pic->planes[ V_PLANE ].i_bytes = i_chroma_bytes / 2;
+        p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof(pixel_data_t);
+
+        /* We allocated 3 planes */
+        p_pic->i_planes = 3;
+
+        return( 0 );
+        break;
+
+    /* Unknown chroma, do nothing */
+    default:
+
+        return( 0 );
+        break;
+    }
+}
+
index febc6433d109ee727d959bcfc1124d31d7f4353a..cb29ce221d4467123beb863d5a7095f7fff34d24 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_headers.c : headers parsing
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: vpar_headers.c,v 1.6 2001/12/13 12:47:17 sam Exp $
+ * $Id: vpar_headers.c,v 1.7 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -303,14 +303,14 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
     };
 #undef RESERVED
 
-    int i_height_save, i_width_save;
+    int i_height_save, i_width_save, i_aspect;
 
     i_height_save = p_vpar->sequence.i_height;
     i_width_save = p_vpar->sequence.i_width;
 
     p_vpar->sequence.i_width = GetBits( &p_vpar->bit_stream, 12 );
     p_vpar->sequence.i_height = GetBits( &p_vpar->bit_stream, 12 );
-    p_vpar->sequence.i_aspect = GetBits( &p_vpar->bit_stream, 4 );
+    i_aspect = GetBits( &p_vpar->bit_stream, 4 );
     p_vpar->sequence.i_frame_rate =
             i_frame_rate_table[ GetBits( &p_vpar->bit_stream, 4 ) ];
 
@@ -383,39 +383,25 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
         /* It's an MPEG-1 stream. Put adequate parameters. */
         int i_xyratio;
         static int pi_mpeg1ratio[15] = {
-            10000,
-            10000,
-             6735,
-             7031,
-             7615,
-             8055,
-             8437,
-             8935,
-             9157,
-             9815,
-            10255,
-            10695,
-            10950,
-            11575,
-            12015
+            10000, 10000,  6735,  7031,  7615,  8055,  8437, 8935,
+             9157,  9815, 10255, 10695, 10950, 11575, 12015
         };
 
-        if( p_vpar->sequence.i_aspect > 1 )
+        if( i_aspect > 1 )
         {
                 i_xyratio = p_vpar->sequence.i_height *
-                        pi_mpeg1ratio[p_vpar->sequence.i_aspect] /
-                        p_vpar->sequence.i_width;
+                        pi_mpeg1ratio[i_aspect] / p_vpar->sequence.i_width;
                 if( 7450 < i_xyratio && i_xyratio < 7550 )
                 {
-                        p_vpar->sequence.i_aspect = 2;
+                        i_aspect = 2;
                 }
                 else if( 5575 < i_xyratio && i_xyratio < 5675 )
                 {
-                        p_vpar->sequence.i_aspect = 3;
+                        i_aspect = 3;
                 }
                 else if( 4475 < i_xyratio && i_xyratio < 4575 )
                 {
-                        p_vpar->sequence.i_aspect = 4;
+                        i_aspect = 4;
                 }
         }
 
@@ -424,6 +410,28 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
         p_vpar->sequence.i_chroma_format = CHROMA_420;
     }
 
+    /* Store calculated aspect ratio */
+    switch( i_aspect )
+    {
+        case AR_3_4_PICTURE:
+            p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR * 4 / 3;
+            break;
+
+        case AR_16_9_PICTURE:
+            p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR * 16 / 9;
+            break;
+
+        case AR_221_1_PICTURE:
+            p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR * 221 / 100;
+            break;
+
+        case AR_SQUARE_PICTURE:
+        default:
+            p_vpar->sequence.i_aspect = VOUT_ASPECT_FACTOR
+                    * p_vpar->sequence.i_width / p_vpar->sequence.i_height;
+            break;
+    }
+
     /* Update sizes */
     p_vpar->sequence.i_mb_width = (p_vpar->sequence.i_width + 15) / 16;
     p_vpar->sequence.i_mb_height = (p_vpar->sequence.b_progressive) ?
@@ -774,14 +782,18 @@ static void PictureHeader( vpar_thread_t * p_vpar )
     if( !p_vpar->picture.i_current_structure )
     {
         /* This is a new frame. Get a structure from the video_output. */
-        while( ( P_picture = vout_CreatePicture( p_vpar->p_vout ) ) == NULL )
+        while( ( P_picture = vout_CreatePicture( p_vpar->p_vout,
+                                 p_vpar->picture.b_progressive,
+                                 p_vpar->picture.b_top_field_first,
+                                 p_vpar->picture.b_repeat_first_field ) )
+                 == NULL )
         {
             intf_DbgMsg("vpar debug: vout_CreatePicture failed, delaying");
             if( p_vpar->p_fifo->b_die || p_vpar->p_fifo->b_error )
             {
                 return;
             }
-            msleep( VPAR_OUTMEM_SLEEP );
+            msleep( VOUT_OUTMEM_SLEEP );
         }
 
         /* Initialize values. */
index 60d75fa61bbc49b60ea03fa3ff98fbb994494e1e..0b9f33e2d56e46934c11d2bb553c5def2c061f50 100644 (file)
@@ -2,7 +2,7 @@
  * vout_sdl.c: SDL video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_sdl.c,v 1.69 2001/12/13 12:47:17 sam Exp $
+ * $Id: vout_sdl.c,v 1.70 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Pierre Baillet <oct@zoy.org>
@@ -176,8 +176,25 @@ static int vout_Create( vout_thread_t *p_vout )
     p_vout->p_sys->b_cursor_autohidden = 0;
     p_vout->p_sys->i_lastmoved = mdate();
 
-    p_vout->p_sys->i_width = p_vout->render.i_width;
-    p_vout->p_sys->i_height = p_vout->render.i_height;
+    if( p_vout->render.i_height * p_vout->render.i_aspect
+         >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
+    {
+        p_vout->p_sys->i_width = p_vout->render.i_height
+            * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
+        p_vout->p_sys->i_height = p_vout->render.i_height;
+    }
+    else
+    {
+        p_vout->p_sys->i_width = p_vout->render.i_width;
+        p_vout->p_sys->i_height = p_vout->render.i_width
+            * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
+    }
+
+    if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 300 )
+    {
+        p_vout->p_sys->i_width *= 2;
+        p_vout->p_sys->i_height *= 2;
+    }
 
     if( SDLOpenDisplay( p_vout ) )
     {
@@ -549,12 +566,17 @@ static int SDLNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             p_pic->i_chroma_size  = i_height * ( i_width / 2 );
 
             /* FIXME: try to get the right i_bytes value from p_overlay */
-            p_pic->planes[ Y_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[0];
+            p_pic->planes[ Y_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[ 0 ];
             p_pic->planes[ Y_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 );
-            p_pic->planes[ U_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[2];
+            p_pic->planes[ Y_PLANE ].i_line_bytes = i_width * sizeof( u8 );
+
+            p_pic->planes[ U_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[ 2 ];
             p_pic->planes[ U_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 ) / 4;
-            p_pic->planes[ V_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[1];
+            p_pic->planes[ U_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof( u8 );
+
+            p_pic->planes[ V_PLANE ].p_data = p_pic->p_sys->p_overlay->pixels[ 1 ];
             p_pic->planes[ V_PLANE ].i_bytes = p_pic->i_size * sizeof( u8 ) / 4;
+            p_pic->planes[ V_PLANE ].i_line_bytes = p_pic->i_chroma_width * sizeof( u8 );
 
             p_pic->i_planes = 3;
 
index 50e0b86c937db3d48b7687ad210bc44be06429f3..ee2339a60929287651f02eed025e7f34d9f6929e 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.c : spu decoder thread
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: spu_decoder.c,v 1.2 2001/12/10 04:53:11 sam Exp $
+ * $Id: spu_decoder.c,v 1.3 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -187,34 +187,29 @@ static int spudec_Run( decoder_config_t * p_config )
  *****************************************************************************/
 static int spudec_Init( spudec_thread_t *p_spudec )
 {
+    int i_retry = 0;
+
     /* Spawn a video output if there is none */
     vlc_mutex_lock( &p_vout_bank->lock );
 
-    if( p_vout_bank->i_count == 0 )
+    while( p_vout_bank->i_count == 0 )
     {
-        intf_WarnMsg( 1, "spudec: no vout present, spawning one" );
-
-        p_spudec->p_vout = vout_CreateThread( NULL, 0, 0, 0, 0 );
+        vlc_mutex_unlock( &p_vout_bank->lock );
 
-        /* Everything failed */
-        if( p_spudec->p_vout == NULL )
+        if( i_retry++ > 10 )
         {
-            intf_Msg( "spudec: can't open vout, aborting" );
-            vlc_mutex_unlock( &p_vout_bank->lock );
+            intf_WarnMsg( 1, "spudec: waited too long for vout, aborting" );
             free( p_spudec );
 
             return( -1 );
         }
 
-        p_vout_bank->pp_vout[ p_vout_bank->i_count ] = p_spudec->p_vout;
-        p_vout_bank->i_count++;
-    }
-    else
-    {
-        /* Take the first video output FIXME: take the best one */
-        p_spudec->p_vout = p_vout_bank->pp_vout[ 0 ];
+        msleep( VOUT_OUTMEM_SLEEP );
+        vlc_mutex_lock( &p_vout_bank->lock );
     }
 
+    /* Take the first video output FIXME: take the best one */
+    p_spudec->p_vout = p_vout_bank->pp_vout[ 0 ];
     vlc_mutex_unlock( &p_vout_bank->lock );
     p_spudec->p_config->pf_init_bit_stream(
             &p_spudec->bit_stream,
index ae62d2fa7d3d853b003c49f7c5a76b74cbeded5d..44679f76be90c48e374a2fb2dd338335d372f0ec 100644 (file)
@@ -2,7 +2,7 @@
  * vout_common.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_common.c,v 1.3 2001/12/13 12:47:17 sam Exp $
+ * $Id: vout_common.c,v 1.4 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -456,8 +456,25 @@ int _M( XCommonCreateWindow ) ( vout_thread_t *p_vout )
     else
     {
         /* Set main window's size */
-        p_vout->p_sys->i_width = p_vout->render.i_width;
-        p_vout->p_sys->i_height = p_vout->render.i_height;
+        if( p_vout->render.i_height * p_vout->render.i_aspect
+             >= p_vout->render.i_width * VOUT_ASPECT_FACTOR )
+        {
+            p_vout->p_sys->i_width = p_vout->render.i_height
+                * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
+            p_vout->p_sys->i_height = p_vout->render.i_height;
+        }
+        else
+        {
+            p_vout->p_sys->i_width = p_vout->render.i_width;
+            p_vout->p_sys->i_height = p_vout->render.i_width
+                * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
+        }
+
+        if( p_vout->p_sys->i_width <= 400 && p_vout->p_sys->i_height <= 300 )
+        {
+            p_vout->p_sys->i_width *= 2;
+            p_vout->p_sys->i_height *= 2;
+        }
     }
 
     /* Prepare window manager hints and properties */
index af3484987f34e882bf76b9d218b1f6e810137e27..cda741edecb4c084c7ea53d9279b54d52dbc65ef 100644 (file)
@@ -2,7 +2,7 @@
  * vout_xvideo.c: Xvideo video output display method
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: vout_xvideo.c,v 1.38 2001/12/13 12:47:17 sam Exp $
+ * $Id: vout_xvideo.c,v 1.39 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Shane Harper <shanegh@optusnet.com.au>
  *          Vincent Seguin <seguin@via.ecp.fr>
@@ -463,12 +463,20 @@ static int XVideoNewPicture( vout_thread_t *p_vout, picture_t *p_pic )
             /* FIXME: try to get the right i_bytes value from p_xvimage */
             p_pic->planes[Y_PLANE].p_data  = p_pic->p_sys->p_xvimage->data;
             p_pic->planes[Y_PLANE].i_bytes = p_pic->i_size * sizeof(u8);
+            p_pic->planes[Y_PLANE].i_line_bytes = i_width * sizeof(u8);
+
             p_pic->planes[U_PLANE].p_data  = (u8*)p_pic->p_sys->p_xvimage->data
                                                + p_pic->i_size * 5 / 4;
             p_pic->planes[U_PLANE].i_bytes = p_pic->i_size * sizeof(u8) / 4;
+            p_pic->planes[U_PLANE].i_line_bytes = p_pic->i_chroma_width
+                                                   * sizeof(u8);
+
             p_pic->planes[V_PLANE].p_data  = (u8*)p_pic->p_sys->p_xvimage->data
                                                + p_pic->i_size;
             p_pic->planes[V_PLANE].i_bytes = p_pic->i_size * sizeof(u8) / 4;
+            p_pic->planes[V_PLANE].i_line_bytes = p_pic->i_chroma_width
+                                                   * sizeof(u8);
+
             p_pic->i_planes = 3;
 
             return 0;
index 6402da81831afc853b794c3c6a1c21d131a678b0..6ede2858f24b2a7bd64819c28f53e0548ec83c3e 100644 (file)
@@ -4,7 +4,7 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: main.c,v 1.137 2001/12/12 15:20:16 sam Exp $
+ * $Id: main.c,v 1.138 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 #define OPT_OVERLAY             166
 #define OPT_XVADAPTOR           167
 #define OPT_SMP                 168
+#define OPT_FILTER              169
 
 #define OPT_CHANNELS            170
 #define OPT_SERVER              171
@@ -206,6 +207,7 @@ static const struct option longopts[] =
     {   "overlay",          0,          0,      OPT_OVERLAY },
     {   "xvadaptor",        1,          0,      OPT_XVADAPTOR },
     {   "smp",              1,          0,      OPT_SMP },
+    {   "filter",           1,          0,      OPT_FILTER },
 
     /* DVD options */
     {   "dvdtitle",         1,          0,      't' },
@@ -805,6 +807,9 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
         case OPT_SMP:                                               /* --smp */
             main_PutIntVariable( VDEC_SMP_VAR, atoi(optarg) );
             break;
+        case OPT_FILTER:                                         /* --filter */
+            main_PutPszVariable( VOUT_FILTER_VAR, optarg );
+            break;
 
         /* DVD options */
         case 't':                                              /* --dvdtitle */
@@ -960,6 +965,7 @@ static void Usage( int i_fashion )
           "\n      --yuv <module>             \tYUV method"
           "\n      --synchro <type>           \tforce synchro algorithm"
           "\n      --smp <number of threads>  \tuse several processors"
+          "\n      --filter <module>          \tvideo filter module"
           "\n"
           "\n  -t, --dvdtitle <num>           \tchoose DVD title"
           "\n  -T, --dvdchapter <num>         \tchoose DVD chapter"
@@ -1026,7 +1032,8 @@ static void Usage( int i_fashion )
         "\n  " IDCT_METHOD_VAR "=<method name>        \tIDCT method"
         "\n  " YUV_METHOD_VAR "=<method name>         \tYUV method"
         "\n  " VPAR_SYNCHRO_VAR "={I|I+|IP|IP+|IPB}   \tsynchro algorithm"
-        "\n  " VDEC_SMP_VAR "=<number of threads>     \tuse several processors" );
+        "\n  " VDEC_SMP_VAR "=<number of threads>     \tuse several processors"
+        "\n  " VOUT_FILTER_VAR "=<method name>        \tvideo filter method" );
 
     /* DVD parameters */
     intf_MsgImm( "\nDVD parameters:"
index 33686e02b92d72c57f6f57d883b35bc193736316..c31e67f7a640c84405458fd668b53787b8961e94 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: video_output.c,v 1.147 2001/12/13 12:47:17 sam Exp $
+ * $Id: video_output.c,v 1.148 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -264,6 +264,7 @@ static int InitThread( vout_thread_t *p_vout )
     {
         intf_ErrMsg( "vout error: plugin was unable to allocate at least "
                      "one direct buffer" );
+        p_vout->pf_end( p_vout );
         vlc_mutex_unlock( &p_vout->change_lock );
         return( 1 );
     }
@@ -291,12 +292,17 @@ static int InitThread( vout_thread_t *p_vout )
 
     for( ; i_index < VOUT_MAX_PICTURES; i_index++ )
     {
-        PP_RENDERPICTURE[ I_RENDERPICTURES ]
-            = &p_vout->p_picture[ i_index ];
+        PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i_index ];
         I_RENDERPICTURES++;
     }
 
     intf_WarnMsg( 1, "vout info: got %i direct buffer(s)", I_OUTPUTPICTURES );
+    intf_WarnMsg( 1, "vout info: picture in %ix%i chroma %i aspect ratio %i",
+                  p_vout->render.i_width, p_vout->render.i_height,
+                  p_vout->render.i_chroma, p_vout->render.i_aspect );
+    intf_WarnMsg( 1, "vout info: picture out %ix%i chroma %i aspect ratio %i",
+                  p_vout->output.i_width, p_vout->output.i_height,
+                  p_vout->output.i_chroma, p_vout->output.i_aspect );
 
     /* Mark thread as running and return */
     p_vout->b_active = 1;
index 30c1e2c6145315439721fa2e14d405d09679e9b9..de99ead698fad7bb1905bccda0433306c32a0a4e 100644 (file)
@@ -2,7 +2,7 @@
  * vout_pictures.c : picture management functions
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: vout_pictures.c,v 1.3 2001/12/13 20:47:46 sam Exp $
+ * $Id: vout_pictures.c,v 1.4 2001/12/16 16:18:36 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -121,7 +121,10 @@ void vout_DatePicture( vout_thread_t *p_vout,
  * already allocated zone of memory in the picture data fields. It needs locking
  * since several pictures can be created by several producers threads.
  *****************************************************************************/
-picture_t *vout_CreatePicture( vout_thread_t *p_vout )
+picture_t *vout_CreatePicture( vout_thread_t *p_vout,
+                               boolean_t b_progressive,
+                               boolean_t b_top_field_first,
+                               boolean_t b_repeat_first_field )
 {
     int         i_picture;                                  /* picture index */
     picture_t * p_picture;
@@ -131,7 +134,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
     vlc_mutex_lock( &p_vout->picture_lock );
 
     /*
-     * Look for an empty place. XXX: we start at 1 because the first
+     * Look for an empty place. We start at 1 because the first
      * directbuffer is reserved for memcpy()ed pictures.
      */
     for( i_picture = 0;
@@ -156,6 +159,12 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
                  * immediately - this is the best possible case, since no
                  * memory allocation needs to be done */
                 p_picture->i_status = RESERVED_PICTURE;
+                p_picture->i_refcount = 0;
+
+                p_picture->b_progressive = b_progressive;
+                p_picture->b_repeat_first_field = b_repeat_first_field;
+                p_picture->b_top_field_first = b_top_field_first;
+
                 p_vout->i_heap_size++;
 
                 vlc_mutex_unlock( &p_vout->picture_lock );
@@ -182,8 +191,14 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout )
         {
             /* Copy picture information, set some default values */
             p_free_picture->i_status = RESERVED_PICTURE;
-            p_free_picture->i_matrix_coefficients = 1;
             p_free_picture->i_refcount = 0;
+
+            p_free_picture->b_progressive = b_progressive;
+            p_free_picture->b_repeat_first_field = b_repeat_first_field;
+            p_free_picture->b_top_field_first = b_top_field_first;
+
+            p_free_picture->i_matrix_coefficients = 1;
+
             p_vout->i_heap_size++;
         }
         else
@@ -319,6 +334,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
              * displaying it if there are subtitles. */
             if( p_subpic != NULL )
             {
+                    //printf("memcpy (refcount != 0)\n");
                 /* We have subtitles. First copy the picture to
                  * the spare direct buffer, then render the
                  * subtitles. */
@@ -338,12 +354,14 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
             /* No subtitles, picture is in a directbuffer so
              * we can display it directly even if it is still
              * in use. */
+                    //printf("direct (refcount == 0)\n");
             return p_picture;
         }
 
         /* Picture is in a direct buffer but isn't used by the
          * decoder. We can safely render subtitles on it and
          * display it. */
+                    //printf("direct (refcount == 0)\n");
         vout_RenderSubPictures( p_vout, p_picture, p_subpic );
 
         return p_picture;
@@ -356,6 +374,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
         /* Picture is not in a direct buffer, but is exactly the
          * same size as the direct buffers. A memcpy() is enough,
          * then render the subtitles. */
+                    //printf("memcpy (not a direct buffer)\n");
         for( i_index = 0; i_index < p_picture->i_planes; i_index++ )
         {
             p_main->fast_memcpy( PP_OUTPUTPICTURE[0]->planes[ i_index ].p_data,
@@ -375,6 +394,7 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
     /* This usually means software YUV, or hardware YUV with a
      * different chroma. */
 
+                    //printf("render (not a direct buffer)\n");
     /* XXX: render to direct buffer */
 
     vout_RenderSubPictures( p_vout, p_picture, p_subpic );
@@ -391,8 +411,6 @@ picture_t * vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_picture,
 void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height,
                         int *pi_x, int *pi_y, int *pi_width, int *pi_height )
 {
-    int i_ratio;
-
     if( p_vout->b_scale )
     {
         *pi_width = i_width;
@@ -404,46 +422,25 @@ void vout_PlacePicture( vout_thread_t *p_vout, int i_width, int i_height,
         *pi_height = MIN( i_height, p_vout->render.i_height );
     }
 
-    switch( p_vout->render.i_aspect )
-    {
-        case AR_3_4_PICTURE:
-            i_ratio = 900 * 4 / 3;
-            break;
-
-        case AR_16_9_PICTURE:
-            i_ratio = 900 * 16 / 9;
-            break;
-
-        case AR_221_1_PICTURE:
-            i_ratio = 900 * 221 / 100;
-            break;
-
-        case AR_SQUARE_PICTURE:
-        default:
-            i_ratio = 900 * p_vout->render.i_width
-                          / p_vout->render.i_height;
-            break;
-    }
-
-    if( 900 * *pi_width / *pi_height < i_ratio )
+    if( VOUT_ASPECT_FACTOR * *pi_width / *pi_height < p_vout->render.i_aspect )
     {
-        *pi_width = *pi_height * i_ratio / 900;
+        *pi_width = *pi_height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
     }
     else
     {
-        *pi_height = *pi_width * 900 / i_ratio;
+        *pi_height = *pi_width * VOUT_ASPECT_FACTOR / p_vout->render.i_aspect;
     }
 
     if( *pi_width > i_width )
     {
         *pi_width = i_width;
-        *pi_height = 900 * *pi_width / i_ratio;
+        *pi_height = VOUT_ASPECT_FACTOR * *pi_width / p_vout->render.i_aspect;
     }
 
     if( *pi_height > i_height )
     {
         *pi_height = i_height;
-        *pi_width = *pi_height * i_ratio / 900;
+        *pi_width = *pi_height * p_vout->render.i_aspect / VOUT_ASPECT_FACTOR;
     }
 
     *pi_x = ( i_width - *pi_width ) / 2;
@@ -505,16 +502,22 @@ static void NewPicture( vout_thread_t *p_vout, picture_t *p_picture )
             /* The Y plane */
             p_picture->planes[ Y_PLANE ].i_bytes =
                  p_picture->i_size * sizeof(pixel_data_t);
+            p_picture->planes[ Y_PLANE ].i_line_bytes =
+                 p_vout->render.i_width * sizeof(pixel_data_t);
             p_picture->planes[ Y_PLANE ].p_data =
                  memalign( 16, i_data_size * sizeof(pixel_data_t) * 4 );
             /* The U plane */
             p_picture->planes[ U_PLANE ].i_bytes =
                  p_picture->i_chroma_size * sizeof(pixel_data_t);
+            p_picture->planes[ U_PLANE ].i_line_bytes =
+                 p_picture->i_chroma_width * sizeof(pixel_data_t);
             p_picture->planes[ U_PLANE ].p_data =
                  p_picture->planes[ Y_PLANE ].p_data + p_picture->i_size;
             /* The V plane */
             p_picture->planes[ V_PLANE ].i_bytes =
                  p_picture->i_chroma_size * sizeof(pixel_data_t);
+            p_picture->planes[ V_PLANE ].i_line_bytes =
+                 p_picture->i_chroma_width * sizeof(pixel_data_t);
             p_picture->planes[ V_PLANE ].p_data =
                  p_picture->planes[ U_PLANE ].p_data + p_picture->i_chroma_size;