* Fixed a few warnings with gcc 3.0.
authorSam Hocevar <sam@videolan.org>
Sun, 6 May 2001 04:32:03 +0000 (04:32 +0000)
committerSam Hocevar <sam@videolan.org>
Sun, 6 May 2001 04:32:03 +0000 (04:32 +0000)
  * aout and vout are now allocated in banks, making it possible to have
    several of them at the same time.
  * configure now checks for MMX and MMX EXT support in the assembler.
  * Removed all MMX code from the main program and moved it to the
    existing idct modules (Closes: Debian bug #96036).

    Don't forget to make distclean before building vlc again.

73 files changed:
AUTHORS
ChangeLog
Makefile.opts.in
configure
configure.in
debian/changelog
include/audio_output.h
include/beos_specific.h
include/config.h.in
include/darwin_specific.h
include/main.h
include/modules.h
include/netutils.h
include/video_decoder.h
include/video_fifo.h [new file with mode: 0644]
include/video_output.h
include/video_parser.h [new file with mode: 0644]
include/vpar_headers.h [new file with mode: 0644]
include/vpar_synchro.h [new file with mode: 0644]
plugins/alsa/aout_alsa.c
plugins/fb/vout_fb.c
plugins/idct/Makefile
plugins/idct/idct.c
plugins/idct/idct.h [deleted file]
plugins/idct/idct_common.c [deleted file]
plugins/idct/idctaltivec.c
plugins/idct/idctclassic.c
plugins/idct/idctmmx.c
plugins/idct/idctmmxext.c
plugins/idct/vdec_block.h [new file with mode: 0644]
plugins/idct/vdec_block_c.c [new file with mode: 0644]
plugins/idct/vdec_block_mmx.c [new file with mode: 0644]
plugins/idct/vdec_idct.c [new file with mode: 0644]
plugins/idct/vdec_idct.h [new file with mode: 0644]
plugins/qt/Makefile
plugins/text/intf_rc.c
src/ac3_decoder/ac3_bit_allocate.c
src/ac3_decoder/ac3_decoder.c
src/ac3_decoder/ac3_decoder_thread.c
src/ac3_decoder/ac3_downmix.c
src/ac3_decoder/ac3_downmix_c.c
src/ac3_decoder/ac3_imdct.c
src/ac3_decoder/ac3_imdct_c.c
src/ac3_decoder/ac3_mantissa.c
src/ac3_decoder/ac3_parse.c
src/ac3_decoder/ac3_rematrix.c
src/ac3_decoder/ac3_srfft.c
src/ac3_spdif/ac3_iec958.c
src/ac3_spdif/ac3_spdif.c
src/audio_output/aout_ext-dec.c
src/audio_output/aout_s16.c
src/audio_output/aout_spdif.c
src/audio_output/aout_u8.c
src/audio_output/audio_output.c
src/input/input_netlist.c
src/interface/interface.c
src/interface/main.c
src/misc/beos_specific.cpp
src/misc/darwin_specific.c
src/misc/modules.c
src/spu_decoder/spu_decoder.c
src/video_decoder/vdec_idct.h [deleted file]
src/video_decoder/video_decoder.c
src/video_decoder/video_fifo.h [deleted file]
src/video_decoder/video_parser.h [deleted file]
src/video_decoder/vpar_headers.h [deleted file]
src/video_decoder/vpar_synchro.h [deleted file]
src/video_output/video_output.c
src/video_parser/video_fifo.c
src/video_parser/video_parser.c
src/video_parser/vpar_blocks.c
src/video_parser/vpar_headers.c
src/video_parser/vpar_synchro.c

diff --git a/AUTHORS b/AUTHORS
index 61232f6..cf8ad9f 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -127,6 +127,7 @@ N: Andres Krapf
 E: dae@via.ecp.fr
 C: dae
 D: FreeBSD port and tests
+D: KDE interface
 
 N: Markus Kuespert
 E: ltlBeBoy@beosmail.com
index 5567bc8..19896d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,13 @@
 #===================#
 
 HEAD
+  * Fixed a few warnings with gcc 3.0.
+  * aout and vout are now allocated in banks, making it possible to have
+    several of them at the same time.
+  * configure now checks for MMX and MMX EXT support in the assembler.
+  * Removed all MMX code from the main program and moved it to the
+    existing idct modules (Closes: Debian bug #96036).
+  * KDE interface.
   * FreeBSD CSS decryption support.
   * Fixed a segfault in TS input (psi packets with adaptation field).
   * Corrected vlc-howto.sgml thanks to Arnaud Gomes-do-Vale
index eb4d17d..9eb59e1 100644 (file)
@@ -200,11 +200,6 @@ endif
 #end of optimisations
 endif
 
-# Optional MMX optimizations for x86
-ifneq (,$(findstring mmx,$(ARCH)))
-CFLAGS += -DHAVE_MMX
-endif
-
 #
 # C compiler flags: dependancies
 #
index 14df89c..8624e77 100755 (executable)
--- a/configure
+++ b/configure
@@ -2837,8 +2837,8 @@ fi
 rm -f conftest*
 
 CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
-echo $ac_n "checking if \$CC groks -rdynamic without complaining too much""... $ac_c" 1>&6
-echo "configure:2842: checking if \$CC groks -rdynamic without complaining too much" >&5
+echo $ac_n "checking if \$CC miserably fails with the -rdynamic flag""... $ac_c" 1>&6
+echo "configure:2842: checking if \$CC miserably fails with the -rdynamic flag" >&5
 cat > conftest.$ac_ext <<EOF
 #line 2844 "configure"
 #include "confdefs.h"
@@ -2850,12 +2850,12 @@ EOF
 if { (eval echo configure:2851: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   LCFLAGS="${LCFLAGS} -rdynamic"
- echo "$ac_t""yes" 1>&6
+ echo "$ac_t""no" 1>&6
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$ac_t""yes" 1>&6
 fi
 rm -f conftest*
 
@@ -3163,33 +3163,75 @@ fi
 ARCH=${host_cpu}
 
 BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion"
+
 case x$host_os in
-  xbeos|xnto-qnx)
-    ACCEL_PLUGINS="yuvmmx idctmmx motionmmx"
-    ;;
   xmingw32msvc)
-    ACCEL_PLUGINS="idctmmx idctmmxext motionmmx motionmmxext"
+    MMX_PLUGINS="idctmmx motionmmx"
     ;;
   *)
-    ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext"
+    MMX_PLUGINS="yuvmmx idctmmx motionmmx"
     ;;
 esac
 
+echo $ac_n "checking if \$CC groks MMX inline assembly""... $ac_c" 1>&6
+echo "configure:3178: checking if \$CC groks MMX inline assembly" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3180 "configure"
+#include "confdefs.h"
+void quux(){void *p;asm("packuswb %%mm1,%%mm2"::"r"(p));}
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3187: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}"
+  echo "$ac_t""yes" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
+echo $ac_n "checking if \$CC groks MMX EXT (SSE) inline assembly""... $ac_c" 1>&6
+echo "configure:3200: checking if \$CC groks MMX EXT (SSE) inline assembly" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3202 "configure"
+#include "confdefs.h"
+void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:3209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ACCEL_PLUGINS="${ACCEL_PLUGINS} idctmmxext motionmmxext"
+  echo "$ac_t""yes" 1>&6
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  echo "$ac_t""no" 1>&6
+fi
+rm -f conftest*
+
 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:3183: checking for $ac_hdr" >&5
+echo "configure:3225: 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 3188 "configure"
+#line 3230 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3193: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3235: \"$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*
@@ -3215,17 +3257,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3219: checking for $ac_hdr" >&5
+echo "configure:3261: 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 3224 "configure"
+#line 3266 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3271: \"$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*
@@ -3253,7 +3295,7 @@ done
 
   BSD_DVD_STRUCT=0
         cat > conftest.$ac_ext <<EOF
-#line 3257 "configure"
+#line 3299 "configure"
 #include "confdefs.h"
 #include <sys/dvdio.h>
 EOF
@@ -3271,7 +3313,7 @@ fi
 rm -f conftest*
 
         cat > conftest.$ac_ext <<EOF
-#line 3275 "configure"
+#line 3317 "configure"
 #include "confdefs.h"
 #include <sys/cdio.h>
 EOF
@@ -3295,7 +3337,7 @@ EOF
 
   fi
         cat > conftest.$ac_ext <<EOF
-#line 3299 "configure"
+#line 3341 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -3446,7 +3488,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:3450: checking for $ac_word" >&5
+echo "configure:3492: 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
@@ -3511,17 +3553,17 @@ else
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3515: checking for $ac_hdr" >&5
+echo "configure:3557: 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 3520 "configure"
+#line 3562 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3525: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3567: \"$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*
@@ -3592,17 +3634,17 @@ if test "${with_sdl+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:3596: checking for $ac_hdr" >&5
+echo "configure:3638: 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 3601 "configure"
+#line 3643 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3606: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3648: \"$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*
@@ -3640,17 +3682,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3644: checking for $ac_hdr" >&5
+echo "configure:3686: 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 3649 "configure"
+#line 3691 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3696: \"$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*
@@ -3750,7 +3792,7 @@ if test x$enable_gtk != xno; then
   # 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:3754: checking for $ac_word" >&5
+echo "configure:3796: 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
@@ -3810,17 +3852,17 @@ if test x$enable_x11 != xno; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3814: checking for $ac_hdr" >&5
+echo "configure:3856: 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 3819 "configure"
+#line 3861 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3866: \"$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*
@@ -3872,17 +3914,17 @@ if test x$enable_xvideo != xno; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3876: checking for $ac_hdr" >&5
+echo "configure:3918: 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 3881 "configure"
+#line 3923 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3886: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3928: \"$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*
@@ -3920,17 +3962,17 @@ if test "${enable_alsa+set}" = set; then
   enableval="$enable_alsa"
   if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
-echo "configure:3924: checking for sys/asoundlib.h" >&5
+echo "configure:3966: checking for sys/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 3929 "configure"
+#line 3971 "configure"
 #include "confdefs.h"
 #include <sys/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3976: \"$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*
@@ -3947,7 +3989,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:3951: checking for main in -lasound" >&5
+echo "configure:3993: 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
@@ -3955,14 +3997,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3959 "configure"
+#line 4001 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4008: \"$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
index 1c228c0..2c380c1 100644 (file)
@@ -105,10 +105,10 @@ void foo() { int meuh; ntohl(meuh); }],,
 
 dnl Check for -rdynamic flag
 CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
-AC_MSG_CHECKING([if \$CC groks -rdynamic without complaining too much])
+AC_MSG_CHECKING([if \$CC miserably fails with the -rdynamic flag])
 AC_TRY_COMPILE([],,
  LCFLAGS="${LCFLAGS} -rdynamic"
- AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
+ AC_MSG_RESULT(no), AC_MSG_RESULT(yes))
 
 dnl End of the bizarre compilation tests
 CFLAGS="${save_CFLAGS}"
@@ -136,18 +136,29 @@ dnl
 dnl  default modules
 dnl
 BUILTINS="${BUILTINS} es ps ts yuv idct idctclassic motion"
+
+dnl
+dnl  Accelerated modules
+dnl
 case x$host_os in
-  xbeos|xnto-qnx)
-    ACCEL_PLUGINS="yuvmmx idctmmx motionmmx"
-    ;;
   xmingw32msvc)
-    ACCEL_PLUGINS="idctmmx idctmmxext motionmmx motionmmxext"
+    MMX_PLUGINS="idctmmx motionmmx"
     ;;
   *)
-    ACCEL_PLUGINS="yuvmmx idctmmx idctmmxext motionmmx motionmmxext"
+    MMX_PLUGINS="yuvmmx idctmmx motionmmx"
     ;;
 esac
 
+AC_MSG_CHECKING([if \$CC groks MMX inline assembly])
+AC_TRY_COMPILE([void quux(){void *p;asm("packuswb %%mm1,%%mm2"::"r"(p));}],,
+  ACCEL_PLUGINS="${ACCEL_PLUGINS} ${MMX_PLUGINS}"
+  AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
+
+AC_MSG_CHECKING([if \$CC groks MMX EXT (SSE) inline assembly])
+AC_TRY_COMPILE([void quux(){void *p;asm("maskmovq %%mm1,%%mm2"::"r"(p));}],,
+  ACCEL_PLUGINS="${ACCEL_PLUGINS} idctmmxext motionmmxext"
+  AC_MSG_RESULT(yes), AC_MSG_RESULT(no))
+
 dnl
 dnl  DVD module: check for DVD ioctls
 dnl
index 461b4c2..e0a7e4e 100644 (file)
@@ -1,3 +1,9 @@
+vlc (0.2.73-2) unstable; urgency=low
+
+  * We now build without MMX in the main application (Closes: #96036).
+
+ -- Samuel Hocevar <sam@zoy.org>  Fri,  4 May 2001 07:13:04 +0200
+
 vlc (0.2.73-1) unstable; urgency=low
 
   * New upstream release.
index b7301c1..996114e 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.h : audio output thread interface
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: audio_output.h,v 1.33 2001/05/01 04:18:17 sam Exp $
+ * $Id: audio_output.h,v 1.34 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+/*****************************************************************************
+ * aout_bank_t, p_aout_bank (global variable)
+ *****************************************************************************
+ * This global variable is accessed by any function using the audio output.
+ *****************************************************************************/
+typedef struct
+{
+    /* Array to all the audio outputs */
+    struct aout_thread_s *pp_aout[ AOUT_MAX_THREADS ];
+
+    int                    i_count;
+    vlc_mutex_t            lock;  /* Global lock */
+
+} aout_bank_t;
+
+extern aout_bank_t *p_aout_bank;
+
 /*****************************************************************************
  * aout_increment_t
  *****************************************************************************
@@ -143,7 +160,8 @@ typedef struct aout_thread_s
     int                 i_fd;
 
     /* The current volume */
-    int                 i_vol;
+    int                 i_volume;
+    int                 i_savedvolume;
     /* Format of the audio output samples */
     int                 i_format;
     /* Number of channels */
@@ -180,6 +198,9 @@ typedef struct aout_thread_s
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
+void            aout_InitBank           ( void );
+void            aout_EndBank            ( void );
+
 aout_thread_t * aout_CreateThread       ( int *pi_status );
 void            aout_DestroyThread      ( aout_thread_t *, int * );
 
index bb2511e..19c9f36 100644 (file)
@@ -2,7 +2,7 @@
  * beos_specific.h: BeOS specific features 
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: beos_specific.h,v 1.5 2001/04/12 01:52:45 sam Exp $
+ * $Id: beos_specific.h,v 1.6 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *
@@ -29,8 +29,8 @@
 extern "C" {
 #endif
 
-void    system_Create ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
-void    system_Destroy( void );
+void    system_Init ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
+void    system_End  ( void );
 char  * system_GetProgramPath( void );
 
 #ifdef __cplusplus
index f61f7bd..f8ec608 100644 (file)
  * Audio configuration
  *****************************************************************************/
 
+/* Maximum number of audio output threads */
+#define AOUT_MAX_THREADS                10
+
 /* Environment variable containing the audio output method */
 #define AOUT_METHOD_VAR                 "vlc_aout"
 
  * Video configuration
  *****************************************************************************/
 
+/* Maximum number of video output threads */
+#define VOUT_MAX_THREADS                10
+
 /*
  * Default settings for video output threads
  */
index b63421d..cab810e 100644 (file)
@@ -2,7 +2,7 @@
  * darwin_specific.h: Darwin specific features 
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: darwin_specific.h,v 1.1 2001/04/12 01:52:45 sam Exp $
+ * $Id: darwin_specific.h,v 1.2 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -24,7 +24,7 @@
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-void    system_Create ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
-void    system_Destroy( void );
+void    system_Init ( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] );
+void    system_End  ( void );
 char  * system_GetProgramPath( void );
 
index bd868c2..f2416af 100644 (file)
@@ -3,7 +3,7 @@
  * Declaration and extern access to global program object.
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: main.h,v 1.17 2001/05/01 04:18:17 sam Exp $
+ * $Id: main.h,v 1.18 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -50,8 +50,6 @@ typedef struct
     boolean_t              b_channels;    /* is channel changing supported ? */
 
     /* Unique threads */
-    p_vout_thread_t        p_vout;                    /* video output thread */
-    p_aout_thread_t        p_aout;                    /* audio output thread */
     p_intf_thread_t        p_intf;                  /* main interface thread */
 
     /* Shared data - these structures are accessed directly from p_main by
index 3752aad..212af24 100644 (file)
@@ -2,7 +2,7 @@
  * modules.h : Module management functions.
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.h,v 1.22 2001/05/01 04:18:17 sam Exp $
+ * $Id: modules.h,v 1.23 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -26,7 +26,7 @@
 #endif
 
 /*****************************************************************************
- * bank_t, p_bank (global variable)
+ * module_bank_t, p_module_bank (global variable)
  *****************************************************************************
  * This global variable is accessed by any function using modules.
  *****************************************************************************/
@@ -36,9 +36,9 @@ typedef struct
 
     vlc_mutex_t         lock;  /* Global lock -- you can't imagine how awful it
                                   is to design thread-safe linked lists. */
-} bank_t;
+} module_bank_t;
 
-extern bank_t *p_bank;
+extern module_bank_t *p_module_bank;
 
 /*****************************************************************************
  * Module #defines.
@@ -168,12 +168,18 @@ typedef struct function_list_s
         /* IDCT plugin */
         struct
         {
-            void ( * pf_init )         ( struct vdec_thread_s * );
+            void ( * pf_idct_init )    ( struct vdec_thread_s * );
             void ( * pf_sparse_idct )  ( struct vdec_thread_s *,
                                          dctelem_t *, int );
             void ( * pf_idct )         ( struct vdec_thread_s *,
                                          dctelem_t *, int );
             void ( * pf_norm_scan )    ( u8 ppi_scan[2][64] );
+
+            void ( * pf_vdec_init )    ( struct vdec_thread_s * );
+            void ( * pf_decode_mb_c )  ( struct vdec_thread_s *,
+                                         struct macroblock_s * );
+            void ( * pf_decode_mb_bw ) ( struct vdec_thread_s *,
+                                         struct macroblock_s * );
         } idct;
 
         /* YUV transformation plugin */
index 96b93b2..c8643b7 100644 (file)
@@ -4,7 +4,7 @@
  * modules.
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: netutils.h,v 1.11 2001/04/27 18:07:56 henri Exp $
+ * $Id: netutils.h,v 1.12 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Henri Fallon <henri@videolan.org>
@@ -32,5 +32,5 @@
  *****************************************************************************/
 int network_BuildLocalAddr ( struct sockaddr_in *, int, char * ); 
 int network_BuildRemoteAddr( struct sockaddr_in *, char * );
-int network_ChannelJoin( int i_channel_id );
-int network_ChannelCreate( void );
+int network_ChannelJoin    ( int i_channel_id );
+int network_ChannelCreate  ( void );
index 6607b64..6a0c056 100644 (file)
@@ -2,7 +2,7 @@
  * video_decoder.h : video decoder thread
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_decoder.h,v 1.22 2001/01/13 12:57:19 sam Exp $
+ * $Id: video_decoder.h,v 1.23 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -54,14 +54,14 @@ typedef struct vdec_thread_s
     /* idct iformations */
     dctelem_t              p_pre_idct[64*64];
 
+    /* Macroblock copy functions */
+    void ( * pf_vdec_init )   ( struct vdec_thread_s * );
+    void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, struct macroblock_s * );
+    void ( * pf_decode_mb_bw )( struct vdec_thread_s *, struct macroblock_s * );
+
     /* Input properties */
     struct vpar_thread_s * p_vpar;                    /* video_parser thread */
 
-#ifndef HAVE_MMX
-    /* Lookup tables */
-    u8              pi_crop_buf[VDEC_CROPRANGE];
-    u8 *            pi_crop;
-#endif
 } vdec_thread_t;
 
 /*****************************************************************************
diff --git a/include/video_fifo.h b/include/video_fifo.h
new file mode 100644 (file)
index 0000000..de4c8c2
--- /dev/null
@@ -0,0 +1,269 @@
+/*****************************************************************************
+ * video_fifo.h : FIFO for the pool of video_decoders
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: video_fifo.h,v 1.18 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@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, USA.
+ *****************************************************************************/
+/*****************************************************************************
+ * Requires:
+ *  "config.h"
+ *  "common.h"
+ *  "threads.h"
+ *  "video_parser.h"
+ *  "undec_picture.h"
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Macros
+ *****************************************************************************/
+
+#ifdef VDEC_SMP
+/* FIXME: move to inline functions ??*/
+#define VIDEO_FIFO_ISEMPTY( fifo )    ( (fifo).i_start == (fifo).i_end )
+#define VIDEO_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start )\
+                                          & VFIFO_SIZE ) == 0 )
+#define VIDEO_FIFO_START( fifo )      ( (fifo).buffer[ (fifo).i_start ] )
+#define VIDEO_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1) \
+                                                           & VFIFO_SIZE )
+#define VIDEO_FIFO_END( fifo )        ( (fifo).buffer[ (fifo).i_end ] )
+#define VIDEO_FIFO_INCEND( fifo )     ( (fifo).i_end = ((fifo).i_end + 1) \
+                                                         & VFIFO_SIZE )
+#endif
+
+/*****************************************************************************
+ * vpar_GetMacroblock : return a macroblock to be decoded
+ *****************************************************************************/
+static __inline__ macroblock_t * vpar_GetMacroblock( video_fifo_t * p_fifo )
+{
+#ifdef VDEC_SMP
+    macroblock_t *      p_mb;
+
+    vlc_mutex_lock( &p_fifo->lock );
+    while( VIDEO_FIFO_ISEMPTY( *p_fifo ) )
+    {
+        vlc_cond_wait( &p_fifo->wait, &p_fifo->lock );
+        if( p_fifo->p_vpar->p_fifo->b_die )
+        {
+            vlc_mutex_unlock( &p_fifo->lock );
+            return( NULL );
+        }
+    }
+
+    p_mb = VIDEO_FIFO_START( *p_fifo );
+    VIDEO_FIFO_INCSTART( *p_fifo );
+
+    vlc_mutex_unlock( &p_fifo->lock );
+
+    return( p_mb );
+#else
+    /* Shouldn't normally be used without SMP. */
+    return NULL;
+#endif
+}
+
+/*****************************************************************************
+ * vpar_NewMacroblock : return a buffer for the parser
+ *****************************************************************************/
+static __inline__ macroblock_t * vpar_NewMacroblock( video_fifo_t * p_fifo )
+{
+#ifdef VDEC_SMP
+    macroblock_t *      p_mb;
+
+#define P_buffer p_fifo->p_vpar->vbuffer
+    vlc_mutex_lock( &P_buffer.lock );
+    while( P_buffer.i_index == -1 )
+    {
+        /* No more structures available. This should not happen ! */
+        intf_DbgMsg("vpar debug: macroblock list is empty, delaying");
+        vlc_mutex_unlock( &P_buffer.lock );
+        if( p_fifo->p_vpar->p_fifo->b_die )
+        {
+            return( NULL );
+        }
+        msleep(VPAR_OUTMEM_SLEEP);
+        vlc_mutex_lock( &P_buffer.lock );
+    }
+
+    p_mb = P_buffer.pp_mb_free[ P_buffer.i_index-- ];
+
+    vlc_mutex_unlock( &P_buffer.lock );
+#undef P_buffer
+    return( p_mb );
+#else
+    return( &p_fifo->buffer );
+#endif
+}
+
+/*****************************************************************************
+ * vpar_DecodeMacroblock : put a macroblock in the video fifo
+ *****************************************************************************/
+static __inline__ void vpar_DecodeMacroblock( video_fifo_t * p_fifo,
+                                              macroblock_t * p_mb )
+{
+#ifdef VDEC_SMP
+    /* Place picture in the video FIFO */
+    vlc_mutex_lock( &p_fifo->lock );
+
+    /* By construction, the video FIFO cannot be full */
+    VIDEO_FIFO_END( *p_fifo ) = p_mb;
+    VIDEO_FIFO_INCEND( *p_fifo );
+
+    vlc_mutex_unlock( &p_fifo->lock );
+#else
+    p_fifo->p_vpar->pf_decode_mb_c( p_fifo->p_vpar->pp_vdec[0], p_mb );
+#endif
+}
+
+/*****************************************************************************
+ * vpar_ReleaseMacroblock : release a macroblock and put the picture in the
+ *                          video output heap, if it is finished
+ *****************************************************************************/
+static __inline__ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo,
+                                               macroblock_t * p_mb )
+{
+#ifdef VDEC_SMP
+    boolean_t      b_finished;
+
+    /* Unlink picture buffer */
+    vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
+    p_mb->p_picture->i_deccount--;
+    b_finished = (p_mb->p_picture->i_deccount == 1);
+    vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
+//intf_DbgMsg( "%d ", p_mb->p_picture->i_deccount );
+    /* Test if it was the last block of the picture */
+    if( b_finished )
+    {
+//intf_DbgMsg( "Image decodee" );
+        /* Mark the picture to be displayed */
+        vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
+
+        /* Warn Synchro for its records. */
+        vpar_SynchroEnd( p_fifo->p_vpar, 0 );
+
+        /* Unlink referenced pictures */
+        if( p_mb->p_forward != NULL )
+        {
+            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
+        }
+        if( p_mb->p_backward != NULL )
+        {
+            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
+        }
+    }
+
+    /* Release the macroblock_t structure */
+#define P_buffer p_fifo->p_vpar->vbuffer
+    vlc_mutex_lock( &P_buffer.lock );
+    P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb;
+    vlc_mutex_unlock( &P_buffer.lock );
+#undef P_buffer
+
+#else
+    p_mb->p_picture->i_deccount--;
+    if( p_mb->p_picture->i_deccount == 1 )
+    {
+        /* Mark the picture to be displayed */
+        vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
+
+        /* Warn Synchro for its records. */
+        vpar_SynchroEnd( p_fifo->p_vpar, 0 );
+    }
+#endif
+}
+
+/*****************************************************************************
+ * vpar_DestroyMacroblock : destroy a macroblock in case of error
+ *****************************************************************************/
+static __inline__ void vpar_DestroyMacroblock( video_fifo_t * p_fifo,
+                                               macroblock_t * p_mb )
+{
+#ifdef VDEC_SMP
+    boolean_t       b_finished;
+
+    /* Unlink picture buffer */
+    vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
+    p_mb->p_picture->i_deccount--;
+    b_finished = (p_mb->p_picture->i_deccount == 1);
+    vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
+
+    /* Test if it was the last block of the picture */
+    if( b_finished )
+    {
+        intf_DbgMsg( "Image trashee" );
+        /* Mark the picture to be trashed */
+        vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
+
+        /* Warn Synchro for its records. */
+        vpar_SynchroEnd( p_fifo->p_vpar, 1 );
+
+        /* Unlink referenced pictures */
+        if( p_mb->p_forward != NULL )
+        {
+            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
+        }
+        if( p_mb->p_backward != NULL )
+        {
+            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
+        }
+    }
+
+    /* Release the macroblock_t structure */
+#define P_buffer p_fifo->p_vpar->vbuffer
+    vlc_mutex_lock( &P_buffer.lock );
+    P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb;
+    vlc_mutex_unlock( &P_buffer.lock );
+#undef P_buffer
+
+#else
+    p_mb->p_picture->i_deccount--;
+    if( p_mb->p_picture->i_deccount == 1 )
+    {
+        /* Mark the picture to be trashed */
+        vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
+
+        /* Warn Synchro for its records. */
+        vpar_SynchroEnd( p_fifo->p_vpar, 1 );
+    }
+#endif
+}
+
+/*****************************************************************************
+ * vpar_FreeMacroblock : destroy a macroblock in case of error, without
+ * updating the macroblock counters
+ *****************************************************************************/
+static __inline__ void vpar_FreeMacroblock( video_fifo_t * p_fifo,
+                                            macroblock_t * p_mb )
+{
+#ifdef VDEC_SMP
+    /* Release the macroblock_t structure */
+#define P_buffer p_fifo->p_vpar->vbuffer
+    vlc_mutex_lock( &P_buffer.lock );
+    P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb;
+    vlc_mutex_unlock( &P_buffer.lock );
+#undef P_buffer
+
+#else
+    ;
+#endif
+}
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+void vpar_InitFIFO( struct vpar_thread_s * p_vpar );
index 3923a27..f6fed87 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.58 2001/05/01 04:18:17 sam Exp $
+ * $Id: video_output.h,v 1.59 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
+/*****************************************************************************
+ * vout_bank_t, p_vout_bank (global variable)
+ *****************************************************************************
+ * This global variable is accessed by any function using the video output.
+ *****************************************************************************/
+typedef struct
+{
+    /* Array to all the video outputs */
+    struct vout_thread_s *pp_vout[ VOUT_MAX_THREADS ];
+
+    int                   i_count;
+    vlc_mutex_t           lock;                               /* Global lock */
+
+} vout_bank_t;
+
+extern vout_bank_t *p_vout_bank;
+
 /*****************************************************************************
  * vout_yuv_convert_t: YUV conversion function
  *****************************************************************************
@@ -256,6 +273,9 @@ typedef struct vout_thread_s
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
+void            vout_InitBank           ( void );
+void            vout_EndBank            ( void );
+
 vout_thread_t * vout_CreateThread   ( int *pi_status );
 void            vout_DestroyThread  ( vout_thread_t *p_vout, int *pi_status );
 
diff --git a/include/video_parser.h b/include/video_parser.h
new file mode 100644 (file)
index 0000000..78ffff7
--- /dev/null
@@ -0,0 +1,215 @@
+/*****************************************************************************
+ * video_parser.h : video parser thread
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: video_parser.h,v 1.34 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@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, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Requires:
+ *  "config.h"
+ *  "common.h"
+ *  "mtime.h"
+ *  "threads.h"
+ *  "input.h"
+ *  "video.h"
+ *  "video_output.h"
+ *  "decoder_fifo.h"
+ *  "video_fifo.h"
+ *  "vpar_headers.h"
+ *****************************************************************************/
+
+/*****************************************************************************
+ * video_fifo_t
+ *****************************************************************************
+ * This rotative FIFO contains undecoded macroblocks that are to be decoded
+ *****************************************************************************/
+struct vpar_thread_s;
+
+typedef struct video_fifo_s
+{
+#ifdef VDEC_SMP
+    vlc_mutex_t         lock;                              /* fifo data lock */
+    vlc_cond_t          wait;              /* fifo data conditional variable */
+
+    /* buffer is an array of undec_picture_t pointers */
+    macroblock_t *      buffer[VFIFO_SIZE + 1];
+    int                 i_start;
+    int                 i_end;
+#else
+    macroblock_t        buffer;
+#endif
+
+    struct vpar_thread_s *      p_vpar;
+} video_fifo_t;
+
+/*****************************************************************************
+ * video_buffer_t
+ *****************************************************************************
+ * This structure enables the parser to maintain a list of free
+ * macroblock_t structures
+ *****************************************************************************/
+#ifdef VDEC_SMP
+typedef struct video_buffer_s
+{
+    vlc_mutex_t         lock;                            /* buffer data lock */
+
+    macroblock_t        p_macroblocks[VFIFO_SIZE + 1];
+    macroblock_t *      pp_mb_free[VFIFO_SIZE+1];          /* this is a LIFO */
+    int                 i_index;
+} video_buffer_t;
+#endif
+
+/*****************************************************************************
+ * vpar_thread_t: video parser thread descriptor
+ *****************************************************************************
+ * XXX??
+ *****************************************************************************/
+typedef struct vpar_thread_s
+{
+    bit_stream_t        bit_stream;
+
+    /* Thread properties and locks */
+    vlc_thread_t        thread_id;                /* id for thread functions */
+
+    /* Thread configuration */
+    /* XXX?? */
+//    int *pi_status;
+
+
+    /* Input properties */
+    decoder_fifo_t *    p_fifo;                            /* PES input fifo */
+    vdec_config_t *     p_config;
+
+    /* Output properties */
+    vout_thread_t *     p_vout;                       /* video output thread */
+
+    /* Decoder properties */
+    struct vdec_thread_s *      pp_vdec[NB_VDEC];
+    video_fifo_t                vfifo;
+#ifdef VDEC_SMP
+    video_buffer_t              vbuffer;
+#endif
+
+    /* Parser properties */
+    sequence_t              sequence;
+    picture_parsing_t       picture;
+    macroblock_parsing_t    mb;
+    video_synchro_t         synchro;
+
+    /* Lookup tables */
+    lookup_t                pl_mb_addr_inc[2048];    /* for macroblock
+                                                        address increment */
+    /* tables for macroblock types 0=P 1=B */
+    lookup_t                ppl_mb_type[2][64];
+    /* table for coded_block_pattern */
+    lookup_t *              pl_coded_pattern;
+    /* variable length codes for the structure dct_dc_size for intra blocks */
+    lookup_t *              pppl_dct_dc_size[2][2];
+    /* Structure to store the tables B14 & B15 (ISO/IEC 13818-2 B.4) */
+    dct_lookup_t            ppl_dct_coef[2][16384];
+    /* Scan table */
+    u8                      ppi_scan[2][64];
+    /* Default quantization matrices */
+    u8                      pi_default_intra_quant[64];
+    u8                      pi_default_nonintra_quant[64];
+
+    /* Motion compensation plugin used and shortcuts */
+    struct module_s *       p_motion_module;
+    void ( * pppf_motion[4][2][4] )     ( struct macroblock_s * );
+    void ( * ppf_motion_skipped[4][4] ) ( struct macroblock_s * );
+
+    /* IDCT plugin used and shortcuts to access its capabilities */
+    struct module_s *           p_idct_module;
+    void ( * pf_idct_init )   ( struct vdec_thread_s * );
+    void ( * pf_sparse_idct ) ( struct vdec_thread_s *, dctelem_t*, int );
+    void ( * pf_idct )        ( struct vdec_thread_s *, dctelem_t*, int );
+    void ( * pf_norm_scan )   ( u8 ppi_scan[2][64] );
+    void ( * pf_vdec_init )   ( struct vdec_thread_s * );
+    void ( * pf_decode_mb_c ) ( struct vdec_thread_s *, struct macroblock_s * );
+    void ( * pf_decode_mb_bw )( struct vdec_thread_s *, struct macroblock_s * );
+
+#ifdef STATS
+    /* Statistics */
+    count_t         c_loops;                              /* number of loops */
+    count_t         c_sequences;                      /* number of sequences */
+    count_t         pc_pictures[4]; /* number of (coding_type) pictures read */
+    count_t         pc_decoded_pictures[4];       /* number of (coding_type)
+                                                   *        pictures decoded */
+    count_t         pc_malformed_pictures[4];  /* number of pictures trashed
+                                                * during parsing             */
+#endif
+} vpar_thread_t;
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+
+/* Thread management functions */
+vlc_thread_t vpar_CreateThread       ( vdec_config_t * );
+
+/*****************************************************************************
+ * NextStartCode : Find the next start code
+ *****************************************************************************/
+static __inline__ void NextStartCode( bit_stream_t * p_bit_stream )
+{
+    /* Re-align the buffer on an 8-bit boundary */
+    RealignBits( p_bit_stream );
+
+    while( ShowBits( p_bit_stream, 24 ) != 0x01L
+            && !p_bit_stream->p_decoder_fifo->b_die )
+    {
+        RemoveBits( p_bit_stream, 8 );
+    }
+}
+
+/*****************************************************************************
+ * LoadQuantizerScale
+ *****************************************************************************
+ * Quantizer scale factor (ISO/IEC 13818-2 7.4.2.2)
+ *****************************************************************************/
+static __inline__ void LoadQuantizerScale( struct vpar_thread_s * p_vpar )
+{
+    /* Quantization coefficient table */
+    static u8   ppi_quantizer_scale[3][32] =
+    {
+        /* MPEG-2 */
+        {
+            /* q_scale_type */
+            /* linear */
+            0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,
+            32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
+        },
+        {
+            /* non-linear */
+            0, 1, 2, 3, 4, 5, 6, 7, 8, 10,12,14,16,18,20, 22,
+            24,28,32,36,40,44,48,52,56,64,72,80,88,96,104,112
+        },
+        /* MPEG-1 */
+        {
+            0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
+            16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
+        }
+    };
+
+    p_vpar->mb.i_quantizer_scale = ppi_quantizer_scale
+           [(!p_vpar->sequence.b_mpeg2 << 1) | p_vpar->picture.b_q_scale_type]
+           [GetBits( &p_vpar->bit_stream, 5 )];
+}
+
diff --git a/include/vpar_headers.h b/include/vpar_headers.h
new file mode 100644 (file)
index 0000000..4b321b1
--- /dev/null
@@ -0,0 +1,189 @@
+/*****************************************************************************
+ * vpar_headers.h : video parser : headers parsing
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vpar_headers.h,v 1.26 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@via.ecp.fr>
+ *          Stéphane Borel <stef@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, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Requires:
+ *  "config.h"
+ *  "common.h"
+ *  "mtime.h"
+ *  "threads.h"
+ *  "input.h"
+ *  "video.h"
+ *  "video_output.h"
+ *  "decoder_fifo.h"
+ *  "video_fifo.h"
+ *****************************************************************************/
+
+/*****************************************************************************
+ * quant_matrix_t : Quantization Matrix
+ *****************************************************************************/
+typedef struct quant_matrix_s
+{
+    u8 *        pi_matrix;
+    boolean_t   b_allocated;
+                          /* Has the matrix been allocated by vpar_headers ? */
+} quant_matrix_t;
+
+/*****************************************************************************
+ * sequence_t : sequence descriptor
+ *****************************************************************************
+ * This structure should only be changed when reading the sequence header,
+ * or exceptionnally some extension structures (like quant_matrix).
+ *****************************************************************************/
+typedef struct sequence_s
+{
+    u32                 i_height, i_width;      /* height and width of the lum
+                                                 * comp of the picture       */
+    u32                 i_size;       /* total number of pel of the lum comp */
+    u32                 i_mb_height, i_mb_width, i_mb_size;
+                                            /* the same, in macroblock units */
+    unsigned int        i_aspect_ratio;        /* height/width display ratio */
+    unsigned int        i_matrix_coefficients;/* coeffs of the YUV transform */
+    int                 i_frame_rate;  /* theoritical frame rate in fps*1001 */
+    boolean_t           b_mpeg2;                                    /* guess */
+    boolean_t           b_progressive;              /* progressive (ie.
+                                                     * non-interlaced) frame */
+    unsigned int        i_scalable_mode; /* scalability ; unsupported, but
+                                          * modifies the syntax of the binary
+                                          * stream.                          */
+    quant_matrix_t      intra_quant, nonintra_quant;
+    quant_matrix_t      chroma_intra_quant, chroma_nonintra_quant;
+                                            /* current quantization matrices */
+
+    /* Chromatic information */
+    unsigned int        i_chroma_format;               /* see CHROMA_* below */
+    int                 i_chroma_nb_blocks;       /* number of chroma blocks */
+    u32                 i_chroma_width;/* width of a line of the chroma comp */
+    u32                 i_chroma_mb_width, i_chroma_mb_height;
+                                 /* size of a macroblock in the chroma buffer
+                                  * (eg. 8x8 or 8x16 or 16x16)               */
+
+    /* Parser context */
+    picture_t *         p_forward;        /* current forward reference frame */
+    picture_t *         p_backward;      /* current backward reference frame */
+    mtime_t             next_pts, next_dts;
+    int                 i_current_rate;
+    boolean_t           b_expect_discontinuity; /* reset the frame predictors
+                                                 * after the current frame   */
+
+    /* Copyright extension */
+    boolean_t           b_copyright_flag;     /* Whether the following
+                                                 information is significant
+                                                 or not. */
+    u8                  i_copyright_id;
+    boolean_t           b_original;
+    u64                 i_copyright_nb;
+} sequence_t;
+
+/*****************************************************************************
+ * picture_parsing_t : parser context descriptor
+ *****************************************************************************
+ * This structure should only be changed when reading the picture header.
+ *****************************************************************************/
+typedef struct picture_parsing_s
+{
+    /* ISO/CEI 11172-2 backward compatibility */
+    boolean_t           pb_full_pel_vector[2];
+    int                 i_forward_f_code, i_backward_f_code;
+
+    /* Values from the picture_coding_extension. Please refer to ISO/IEC
+     * 13818-2. */
+    int                 ppi_f_code[2][2];
+    int                 i_intra_dc_precision;
+    boolean_t           b_frame_pred_frame_dct, b_q_scale_type;
+    boolean_t           b_intra_vlc_format;
+    boolean_t           b_alternate_scan, b_progressive;
+    boolean_t           b_top_field_first, b_concealment_mv;
+    boolean_t           b_repeat_first_field;
+    /* Relative to the current field */
+    int                 i_coding_type, i_structure;
+    boolean_t           b_frame_structure; /* i_structure == FRAME_STRUCTURE */
+
+    picture_t *         p_picture;               /* picture buffer from vout */
+    int                 i_current_structure;   /* current parsed structure of
+                                                * p_picture (second field ?) */
+#ifdef VDEC_SMP
+    macroblock_t *      pp_mb[MAX_MB];         /* macroblock buffer to
+                                                * send to the vdec thread(s) */
+#endif
+    boolean_t           b_error;            /* parsing error, try to recover */
+
+    int                 i_l_stride, i_c_stride;
+                                    /* number of coeffs to jump when changing
+                                     * lines (different with field pictures) */
+} picture_parsing_t;
+
+/*****************************************************************************
+ * Standard codes
+ *****************************************************************************/
+#define PICTURE_START_CODE      0x100L
+#define SLICE_START_CODE_MIN    0x101L
+#define SLICE_START_CODE_MAX    0x1AFL
+#define USER_DATA_START_CODE    0x1B2L
+#define SEQUENCE_HEADER_CODE    0x1B3L
+#define SEQUENCE_ERROR_CODE     0x1B4L
+#define EXTENSION_START_CODE    0x1B5L
+#define SEQUENCE_END_CODE       0x1B7L
+#define GROUP_START_CODE        0x1B8L
+
+/* extension start code IDs */
+#define SEQUENCE_EXTENSION_ID                    1
+#define SEQUENCE_DISPLAY_EXTENSION_ID            2
+#define QUANT_MATRIX_EXTENSION_ID                3
+#define COPYRIGHT_EXTENSION_ID                   4
+#define SEQUENCE_SCALABLE_EXTENSION_ID           5
+#define PICTURE_DISPLAY_EXTENSION_ID             7
+#define PICTURE_CODING_EXTENSION_ID              8
+#define PICTURE_SPATIAL_SCALABLE_EXTENSION_ID    9
+#define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID  10
+
+/* scalable modes */
+#define SC_NONE     0
+#define SC_DP       1
+#define SC_SPAT     2
+#define SC_SNR      3
+#define SC_TEMP     4
+
+/* Chroma types */
+#define CHROMA_420 1
+#define CHROMA_422 2
+#define CHROMA_444 3
+
+/* Pictures types */
+#define I_CODING_TYPE           1
+#define P_CODING_TYPE           2
+#define B_CODING_TYPE           3
+#define D_CODING_TYPE           4 /* MPEG-1 ONLY */
+/* other values are reserved */
+
+/* Structures */
+#define TOP_FIELD               1
+#define BOTTOM_FIELD            2
+#define FRAME_STRUCTURE         3
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+int vpar_NextSequenceHeader( struct vpar_thread_s * p_vpar );
+int vpar_ParseHeader( struct vpar_thread_s * p_vpar );
diff --git a/include/vpar_synchro.h b/include/vpar_synchro.h
new file mode 100644 (file)
index 0000000..96bc9e8
--- /dev/null
@@ -0,0 +1,102 @@
+/*****************************************************************************
+ * vpar_synchro.h : video parser blocks management
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vpar_synchro.h,v 1.33 2001/05/06 04:32:02 sam Exp $
+ *
+ * Author: Christophe Massiot <massiot@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, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Requires:
+ *  "config.h"
+ *  "common.h"
+ *  "mtime.h"
+ *  "threads.h"
+ *  "input.h"
+ *  "video.h"
+ *  "video_output.h"
+ *  "decoder_fifo.h"
+ *  "video_fifo.h"
+ *****************************************************************************/
+
+/*****************************************************************************
+ * video_synchro_t and video_synchro_tab_s : timers for the video synchro
+ *****************************************************************************/
+#define MAX_DECODING_PIC        16
+#define MAX_PIC_AVERAGE         8
+
+/* Read the discussion on top of vpar_synchro.c for more information. */
+typedef struct video_synchro_s
+{
+    /* synchro algorithm */
+    int             i_type;
+
+    /* fifo containing decoding dates */
+    mtime_t         p_date_fifo[MAX_DECODING_PIC];
+    int             pi_coding_types[MAX_DECODING_PIC];
+    unsigned int    i_start, i_end;
+    vlc_mutex_t     fifo_lock;
+
+    /* stream properties */
+    unsigned int    i_n_p, i_n_b;
+
+    /* decoding values */
+    mtime_t         p_tau[4];                  /* average decoding durations */
+    unsigned int    pi_meaningful[4];            /* number of durations read */
+    /* and p_vout->render_time (read with p_vout->change_lock) */
+
+    /* stream context */
+    unsigned int    i_eta_p, i_eta_b;
+    boolean_t       b_dropped_last;            /* for special synchros below */
+    mtime_t         backward_pts, current_pts;
+    int             i_current_period;   /* period to add to the next picture */
+    int             i_backward_period;  /* period to add after the next
+                                         * reference picture
+                                         * (backward_period * period / 2) */
+
+#ifdef STATS
+    unsigned int    i_trashed_pic, i_not_chosen_pic, i_pic;
+#endif
+} video_synchro_t;
+
+#define FIFO_INCREMENT( i_counter )                                         \
+    p_vpar->synchro.i_counter =                                             \
+        (p_vpar->synchro.i_counter + 1) % MAX_DECODING_PIC;
+
+/* Synchro algorithms */
+#define VPAR_SYNCHRO_DEFAULT    0
+#define VPAR_SYNCHRO_I          1
+#define VPAR_SYNCHRO_Iplus      2
+#define VPAR_SYNCHRO_IP         3
+#define VPAR_SYNCHRO_IPplus     4
+#define VPAR_SYNCHRO_IPB        5
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+void vpar_SynchroInit           ( struct vpar_thread_s * p_vpar );
+boolean_t vpar_SynchroChoose    ( struct vpar_thread_s * p_vpar,
+                                  int i_coding_type, int i_structure );
+void vpar_SynchroTrash          ( struct vpar_thread_s * p_vpar,
+                                  int i_coding_type, int i_structure );
+void vpar_SynchroDecode         ( struct vpar_thread_s * p_vpar,
+                                  int i_coding_type, int i_structure );
+void vpar_SynchroEnd            ( struct vpar_thread_s * p_vpar, int i_garbage );
+mtime_t vpar_SynchroDate        ( struct vpar_thread_s * p_vpar );
+void vpar_SynchroNewPicture( struct vpar_thread_s * p_vpar, int i_coding_type,
+                             int i_repeat_field );
index beecdb0..d492469 100644 (file)
@@ -2,7 +2,7 @@
  * aout_alsa.c : Alsa functions library
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: aout_alsa.c,v 1.13 2001/04/06 09:15:47 sam Exp $
+ * $Id: aout_alsa.c,v 1.14 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  * 
@@ -36,7 +36,6 @@
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
 
 #include <sys/asoundlib.h>
-#include <linux/asound.h>
 
 #include "config.h"
 #include "common.h"                                     /* boolean_t, byte_t */
index ff782c6..3c6e1a8 100644 (file)
@@ -2,7 +2,7 @@
  * vout_fb.c: framebuffer video output display method
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000, 2001 VideoLAN
- * $Id: vout_fb.c,v 1.10 2001/03/21 13:42:33 sam Exp $
+ * $Id: vout_fb.c,v 1.11 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -608,26 +608,33 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
  *****************************************************************************/
 static void FBSwitchDisplay(int i_signal)
 {
-    if( p_main->p_vout != NULL )
+    vout_thread_t *p_vout;
+
+    vlc_mutex_lock( &p_vout_bank->lock );
+
+    /* XXX: only test the first video output */
+    if( p_vout_bank->i_count )
     {
+        p_vout = p_vout_bank->pp_vout[0];
+
         switch( i_signal )
         {
         case SIGUSR1:                                /* vt has been released */
-            p_main->p_vout->b_active = 0;
-            ioctl( ((vout_sys_t *)p_main->p_vout->p_sys)->i_tty_dev,
-                   VT_RELDISP, 1 );
+            p_vout->b_active = 0;
+            ioctl( p_vout->p_sys->i_tty_dev, VT_RELDISP, 1 );
             break;
         case SIGUSR2:                                /* vt has been acquired */
-            p_main->p_vout->b_active = 1;
-            ioctl( ((vout_sys_t *)p_main->p_vout->p_sys)->i_tty_dev,
-                   VT_RELDISP, VT_ACTIVATE );
+            p_vout->b_active = 1;
+            ioctl( p_vout->p_sys->i_tty_dev, VT_RELDISP, VT_ACTIVATE );
             /* handle blanking */
-            vlc_mutex_lock( &p_main->p_vout->change_lock );
-            p_main->p_vout->i_changes |= VOUT_SIZE_CHANGE;
-            vlc_mutex_unlock( &p_main->p_vout->change_lock );
+            vlc_mutex_lock( &p_vout->change_lock );
+            p_vout->i_changes |= VOUT_SIZE_CHANGE;
+            vlc_mutex_unlock( &p_vout->change_lock );
             break;
         }
     }
+
+    vlc_mutex_unlock( &p_vout_bank->lock );
 }
 
 /*****************************************************************************
index 25cd618..cf3a25d 100644 (file)
@@ -12,20 +12,27 @@ PLUGIN_IDCTCLASSIC = idctclassic.o
 PLUGIN_IDCTMMX = idctmmx.o
 PLUGIN_IDCTMMXEXT = idctmmxext.o
 PLUGIN_IDCTALTIVEC = idctaltivec.o
-PLUGIN_IDCTCOMMON = idct_common.o
+PLUGIN_IDCTCOMMON = vdec_idct.o
+PLUGIN_VDECBLOCK_C = vdec_block_c.o
+PLUGIN_VDECBLOCK_MMX = vdec_block_mmx.o
 
 BUILTIN_IDCT = $(PLUGIN_IDCT:%.o=BUILTIN_IDCT_%.o) \
-               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o)
+               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCT_%.o) \
+               $(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCT_%.o)
 BUILTIN_IDCTCLASSIC = $(PLUGIN_IDCTCLASSIC:%.o=BUILTIN_IDCTCLASSIC_%.o) \
-               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o)
+               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTCLASSIC_%.o) \
+               $(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTCLASSIC_%.o)
 BUILTIN_IDCTMMX = $(PLUGIN_IDCTMMX:%.o=BUILTIN_IDCTMMX_%.o) \
-               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o)
+               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMX_%.o) \
+               $(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMX_%.o)
 BUILTIN_IDCTMMXEXT = $(PLUGIN_IDCTMMXEXT:%.o=BUILTIN_IDCTMMXEXT_%.o) \
-               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o)
+               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTMMXEXT_%.o) \
+               $(PLUGIN_VDECBLOCK_MMX:%.o=BUILTIN_IDCTMMXEXT_%.o)
 BUILTIN_IDCTALTIVEC = $(PLUGIN_IDCTALTIVEC:%.o=BUILTIN_IDCTALTIVEC_%.o) \
-               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o)
+               $(PLUGIN_IDCTCOMMON:%.o=BUILTIN_IDCTALTIVEC_%.o) \
+               $(PLUGIN_VDECBLOCK_C:%.o=BUILTIN_IDCTALTIVEC_%.o)
 
-PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON)
+PLUGIN_C = $(PLUGIN_IDCT) $(PLUGIN_IDCTCLASSIC) $(PLUGIN_IDCTMMX) $(PLUGIN_IDCTMMXEXT) $(PLUGIN_IDCTCOMMON) $(PLUGIN_VDECBLOCK_C) $(PLUGIN_VDECBLOCK_MMX)
 ALL_OBJ = $(PLUGIN_C) $(PLUGIN_IDCTALTIVEC) $(BUILTIN_IDCT) $(BUILTIN_IDCTCLASSIC) $(BUILTIN_IDCTMMX) $(BUILTIN_IDCTMMXEXT) $(BUILTIN_IDCTALTIVEC)
 
 #
index dcfd77f..eb51703 100644 (file)
@@ -2,7 +2,7 @@
  * idct.c : IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idct.c,v 1.8 2001/04/15 04:19:57 sam Exp $
+ * $Id: idct.c,v 1.9 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -44,7 +44,8 @@
 
 #include "modules.h"
 
-#include "idct.h"
+#include "vdec_block.h"
+#include "vdec_idct.h"
 
 /*****************************************************************************
  * Local and extern prototypes.
@@ -128,10 +129,15 @@ MODULE_DEACTIVATE
 static void idct_getfunctions( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = idct_Probe;
-    p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
-    p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
-    p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
-    p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
+#define F p_function_list->functions.idct
+    F.pf_idct_init = _M( vdec_InitIDCT );
+    F.pf_sparse_idct = _M( vdec_SparseIDCT );
+    F.pf_idct = _M( vdec_IDCT );
+    F.pf_norm_scan = vdec_NormScan;
+    F.pf_vdec_init = _M( vdec_Init );
+    F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
+    F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
+#undef F
 }
 
 /*****************************************************************************
diff --git a/plugins/idct/idct.h b/plugins/idct/idct.h
deleted file mode 100644 (file)
index e9ff7fb..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*****************************************************************************
- * idct.h : macros for the inverse discrete cosine transform
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idct.h,v 1.3 2001/04/15 04:19:57 sam Exp $
- *
- * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
- *          Christophe Massiot <massiot@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, USA.
- *****************************************************************************/
-
-#define SPARSE_SCALE_FACTOR 8
-#define DCTSIZE 8 /* 8*8 DCT */
-
-/*****************************************************************************
- * Macros
- *****************************************************************************/
-
-/* We assume that right shift corresponds to signed division by 2 with
- * rounding towards minus infinity.  This is correct for typical "arithmetic
- * shift" instructions that shift in copies of the sign bit.  But some
- * C compilers implement >> with an unsigned shift.  For these machines you
- * must define RIGHT_SHIFT_IS_UNSIGNED.
- * RIGHT_SHIFT provides a proper signed right shift of an s32 quantity.
- * It is only applied with constant shift counts.  SHIFT_TEMPS must be
- * included in the variables of any routine using RIGHT_SHIFT.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define SHIFT_TEMPS s32 shift_temp;
-#define RIGHT_SHIFT(x,shft)  \
-    ((shift_temp = (x)) < 0 ? \
-     (shift_temp >> (shft)) | ((~((s32) 0)) << (32-(shft))) : \
-     (shift_temp >> (shft)))
-#else
-#define SHIFT_TEMPS
-#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-/*
- * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
- * on each column.  Direct algorithms are also available, but they are
- * much more complex and seem not to be any faster when reduced to code.
- *
- * The poop on this scaling stuff is as follows:
- *
- * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
- * larger than the true IDCT outputs.  The final outputs are therefore
- * a factor of N larger than desired; since N=8 this can be cured by
- * a simple right shift at the end of the algorithm.  The advantage of
- * this arrangement is that we save two multiplications per 1-D IDCT,
- * because the y0 and y4 inputs need not be divided by sqrt(N).
- *
- * We have to do addition and subtraction of the integer inputs, which
- * is no problem, and multiplication by fractional constants, which is
- * a problem to do in integer arithmetic.  We multiply all the constants
- * by CONST_SCALE and convert them to integer constants (thus retaining
- * CONST_BITS bits of precision in the constants).  After doing a
- * multiplication we have to divide the product by CONST_SCALE, with proper
- * rounding, to produce the correct output.  This division can be done
- * cheaply as a right shift of CONST_BITS bits.  We postpone shifting
- * as long as possible so that partial sums can be added together with
- * full fractional precision.
- *
- * The outputs of the first pass are scaled up by PASS1_BITS bits so that
- * they are represented to better-than-integral precision.  These outputs
- * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
- * with the recommended scaling.  (To scale up 12-bit sample data further, an
- * intermediate s32 array would be needed.)
- *
- * To avoid overflow of the 32-bit intermediate results in pass 2, we must
- * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
- * shows that the values given below are the most effective.
- */
-
-#define CONST_BITS 8                         /* Jimmy chose this constant :) */
-
-#ifdef EIGHT_BIT_SAMPLES
-#define PASS1_BITS  2
-#else
-#define PASS1_BITS  1           /* lose a little precision to avoid overflow */
-#endif
-
-#define ONE     ((s32) 1)
-
-#define CONST_SCALE (ONE << CONST_BITS)
-
-/* Convert a positive real constant to an integer scaled by CONST_SCALE.
- * IMPORTANT: if your compiler doesn't do this arithmetic at compile time,
- * you will pay a significant penalty in run time.  In that case, figure
- * the correct integer constant values and insert them by hand.
- */
-
-#define FIX(x)  ((s32) ((x) * CONST_SCALE + 0.5))
-
-/* When adding two opposite-signed fixes, the 0.5 cancels */
-#define FIX2(x) ((s32) ((x) * CONST_SCALE))
-
-/* Descale and correctly round an s32 value that's scaled by N bits.
- * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
- * the fudge factor is correct for either sign of X.
- */
-
-#define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
-
-/* Multiply an s32 variable by an s32 constant to yield an s32 result.
- * For 8-bit samples with the recommended scaling, all the variable
- * and constant values involved are no more than 16 bits wide, so a
- * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
- * this provides a useful speedup on many machines.
- * There is no way to specify a 16x16->32 multiply in portable C, but
- * some C compilers will do the right thing if you provide the correct
- * combination of casts.
- * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
- */
-
-#ifdef EIGHT_BIT_SAMPLES
-#ifdef SHORTxSHORT_32                        /* may work if 'int' is 32 bits */
-#define MULTIPLY(var,const)  (((INT16) (var)) * ((INT16) (const)))
-#endif
-#ifdef SHORTxLCONST_32                 /* known to work with Microsoft C 6.0 */
-#define MULTIPLY(var,const)  (((INT16) (var)) * ((s32) (const)))
-#endif
-#endif
-
-#ifndef MULTIPLY                                       /* default definition */
-#define MULTIPLY(var,const)  ((var) * (const))
-#endif
-
-/*****************************************************************************
- * Protoypes
- *****************************************************************************/
-void _M( vdec_SparseIDCT ) ( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                             int i_sparse_pos);
-void _M( vdec_InitIDCT )   ( vdec_thread_t * p_vdec );
-void _M( vdec_IDCT )       ( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                             int i_idontcare );
-
diff --git a/plugins/idct/idct_common.c b/plugins/idct/idct_common.c
deleted file mode 100644 (file)
index 7940c04..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*****************************************************************************
- * idct_common.c : common IDCT functions
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idct_common.c,v 1.5 2001/04/15 04:19:57 sam Exp $
- *
- * Authors: Gaël Hendryckx <jimmy@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, USA.
- *****************************************************************************/
-
-/* MODULE_NAME defined in Makefile together with -DBUILTIN */
-#ifdef BUILTIN
-#   include "modules_inner.h"
-#else
-#   define _M( foo ) foo
-#endif
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include "defs.h"
-
-#include <string.h>                                    /* memcpy(), memset() */
-
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-
-#include "video.h"
-#include "video_output.h"
-
-#include "video_decoder.h"
-
-#include "modules.h"
-
-#include "idct.h"
-
-/*****************************************************************************
- * vdec_InitIDCT : initialize datas for vdec_SparseIDCT
- *****************************************************************************/
-void _M( vdec_InitIDCT ) (vdec_thread_t * p_vdec)
-{
-    int i;
-
-    dctelem_t * p_pre = p_vdec->p_pre_idct;
-    memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
-
-    for( i=0 ; i < 64 ; i++ )
-    {
-        p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
-        _M( vdec_IDCT )( p_vdec, &p_pre[i*64], 0) ;
-    }
-    return;
-}
-
-/*****************************************************************************
- * vdec_SparseIDCT : IDCT function for sparse matrices
- *****************************************************************************/
-void _M( vdec_SparseIDCT ) ( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                             int i_sparse_pos)
-{
-    short int val;
-    int * dp;
-    int v;
-    short int * p_dest;
-    short int * p_source;
-    int coeff, rr;
-
-    /* If DC Coefficient. */
-    if ( i_sparse_pos == 0 )
-    {
-        dp=(int *)p_block;
-        val=RIGHT_SHIFT((*p_block + 4), 3);
-        /* Compute int to assign.  This speeds things up a bit */
-        v = ((val & 0xffff) | (val << 16));
-        dp[0] = v;     dp[1] = v;     dp[2] = v;     dp[3] = v;
-        dp[4] = v;     dp[5] = v;     dp[6] = v;     dp[7] = v;
-        dp[8] = v;     dp[9] = v;     dp[10] = v;    dp[11] = v;
-        dp[12] = v;    dp[13] = v;    dp[14] = v;    dp[15] = v;
-        dp[16] = v;    dp[17] = v;    dp[18] = v;    dp[19] = v;
-        dp[20] = v;    dp[21] = v;    dp[22] = v;    dp[23] = v;
-        dp[24] = v;    dp[25] = v;    dp[26] = v;    dp[27] = v;
-        dp[28] = v;    dp[29] = v;    dp[30] = v;    dp[31] = v;
-        return;
-    }
-    /* Some other coefficient. */
-    p_dest = (s16*)p_block;
-    p_source = (s16*)&p_vdec->p_pre_idct[i_sparse_pos];
-    coeff = (int)p_dest[i_sparse_pos];
-    for( rr=0 ; rr < 4 ; rr++ )
-    {
-        p_dest[0] = (p_source[0] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[1] = (p_source[1] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[2] = (p_source[2] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[3] = (p_source[3] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[4] = (p_source[4] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[5] = (p_source[5] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[6] = (p_source[6] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[7] = (p_source[7] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[8] = (p_source[8] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[9] = (p_source[9] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[10] = (p_source[10] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[11] = (p_source[11] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[12] = (p_source[12] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[13] = (p_source[13] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[14] = (p_source[14] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest[15] = (p_source[15] * coeff) >> SPARSE_SCALE_FACTOR;
-        p_dest += 16;
-        p_source += 16;
-    }
-    return;
-}
-
index b711f3d..d1b6f4e 100644 (file)
@@ -2,7 +2,7 @@
  * idctaltivec.c : Altivec IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctaltivec.c,v 1.4 2001/04/15 04:19:57 sam Exp $
+ * $Id: idctaltivec.c,v 1.5 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -44,7 +44,8 @@
 #include "modules.h"
 #include "modules_inner.h"
 
-#include "idct.h"
+#include "vdec_block.h"
+#include "vdec_idct.h"
 
 #include "idctaltivec.h"
 
@@ -129,10 +130,15 @@ MODULE_DEACTIVATE
 static void idct_getfunctions( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = idct_Probe;
-    p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
-    p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
-    p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
-    p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
+#define F p_function_list->functions.idct
+    F.pf_idct_init = _M( vdec_InitIDCT );
+    F.pf_sparse_idct = _M( vdec_SparseIDCT );
+    F.pf_idct = _M( vdec_IDCT );
+    F.pf_norm_scan = vdec_NormScan;
+    F.pf_vdec_init = _M( vdec_Init );
+    F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
+    F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
+#undef F
 }
 
 /*****************************************************************************
index 2209d53..a12ddbf 100644 (file)
@@ -2,7 +2,7 @@
  * idctclassic.c : Classic IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctclassic.c,v 1.8 2001/04/15 04:19:57 sam Exp $
+ * $Id: idctclassic.c,v 1.9 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
  *
@@ -44,7 +44,8 @@
 #include "modules.h"
 #include "modules_inner.h"
 
-#include "idct.h"
+#include "vdec_block.h"
+#include "vdec_idct.h"
 
 /*****************************************************************************
  * Local and extern prototypes.
@@ -128,10 +129,15 @@ MODULE_DEACTIVATE
 static void idct_getfunctions( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = idct_Probe;
-    p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
-    p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
-    p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
-    p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
+#define F p_function_list->functions.idct
+    F.pf_idct_init = _M( vdec_InitIDCT );
+    F.pf_sparse_idct = _M( vdec_SparseIDCT );
+    F.pf_idct = _M( vdec_IDCT );
+    F.pf_norm_scan = vdec_NormScan;
+    F.pf_vdec_init = _M( vdec_Init );
+    F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
+    F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
+#undef F
 }
 
 /*****************************************************************************
index eb1a176..c0b2252 100644 (file)
@@ -2,7 +2,7 @@
  * idctmmx.c : MMX IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctmmx.c,v 1.9 2001/04/15 04:19:57 sam Exp $
+ * $Id: idctmmx.c,v 1.10 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -48,7 +48,8 @@
 #include "modules.h"
 #include "modules_inner.h"
 
-#include "idct.h"
+#include "vdec_block.h"
+#include "vdec_idct.h"
 
 #include "attributes.h"
 #include "mmx.h"
@@ -134,10 +135,15 @@ MODULE_DEACTIVATE
 static void idct_getfunctions( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = idct_Probe;
-    p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
-    p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
-    p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
-    p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
+#define F p_function_list->functions.idct
+    F.pf_idct_init = _M( vdec_InitIDCT );
+    F.pf_sparse_idct = _M( vdec_SparseIDCT );
+    F.pf_idct = _M( vdec_IDCT );
+    F.pf_norm_scan = vdec_NormScan;
+    F.pf_vdec_init = _M( vdec_Init );
+    F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
+    F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
+#undef F
 }
 
 /*****************************************************************************
index d275f6d..f8a281d 100644 (file)
@@ -2,7 +2,7 @@
  * idctmmxext.c : MMX EXT IDCT module
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctmmxext.c,v 1.6 2001/04/15 04:19:57 sam Exp $
+ * $Id: idctmmxext.c,v 1.7 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
@@ -48,7 +48,8 @@
 #include "modules.h"
 #include "modules_inner.h"
 
-#include "idct.h"
+#include "vdec_block.h"
+#include "vdec_idct.h"
 
 #include "attributes.h"
 #include "mmx.h"
@@ -134,10 +135,15 @@ MODULE_DEACTIVATE
 static void idct_getfunctions( function_list_t * p_function_list )
 {
     p_function_list->pf_probe = idct_Probe;
-    p_function_list->functions.idct.pf_init = _M( vdec_InitIDCT );
-    p_function_list->functions.idct.pf_sparse_idct = _M( vdec_SparseIDCT );
-    p_function_list->functions.idct.pf_idct = _M( vdec_IDCT );
-    p_function_list->functions.idct.pf_norm_scan = vdec_NormScan;
+#define F p_function_list->functions.idct
+    F.pf_idct_init = _M( vdec_InitIDCT );
+    F.pf_sparse_idct = _M( vdec_SparseIDCT );
+    F.pf_idct = _M( vdec_IDCT );
+    F.pf_norm_scan = vdec_NormScan;
+    F.pf_vdec_init = _M( vdec_Init );
+    F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
+    F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
+#undef F
 }
 
 /*****************************************************************************
diff --git a/plugins/idct/vdec_block.h b/plugins/idct/vdec_block.h
new file mode 100644 (file)
index 0000000..9ae0be0
--- /dev/null
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * vdec_block_h: Macroblock copy functions
+ *****************************************************************************
+ * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * $Id: vdec_block.h,v 1.1 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@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, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Prototypes
+ *****************************************************************************/
+void _M( vdec_Init ) ( struct vdec_thread_s *p_vdec );
+void _M( vdec_DecodeMacroblockC )  ( struct vdec_thread_s *p_vdec,
+                                     struct macroblock_s * p_mb );
+void _M( vdec_DecodeMacroblockBW ) ( struct vdec_thread_s *p_vdec,
+                                     struct macroblock_s * p_mb );
+       
+/*****************************************************************************
+ * vdec_DecodeMacroblock : decode a macroblock of a picture
+ *****************************************************************************/
+#define DECODEBLOCKSC( OPBLOCK )                                        \
+{                                                                       \
+    int             i_b, i_mask;                                        \
+                                                                        \
+    i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
+                                                                        \
+    /* luminance */                                                     \
+    for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
+    {                                                                   \
+        if( p_mb->i_coded_block_pattern & i_mask )                      \
+        {                                                               \
+            /*                                                          \
+             * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
+             */                                                         \
+            (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
+                                  p_mb->pi_sparse_pos[i_b] );           \
+                                                                        \
+            /*                                                          \
+             * Adding prediction and coefficient data (ISO/IEC 13818-2  \
+             * section 7.6.8)                                           \
+             */                                                         \
+            OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
+                     p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
+        }                                                               \
+    }                                                                   \
+                                                                        \
+    /* chrominance */                                                   \
+    for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks;                   \
+         i_b++, i_mask >>= 1 )                                          \
+    {                                                                   \
+        if( p_mb->i_coded_block_pattern & i_mask )                      \
+        {                                                               \
+            /*                                                          \
+             * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
+             */                                                         \
+            (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
+                                  p_mb->pi_sparse_pos[i_b] );           \
+                                                                        \
+            /*                                                          \
+             * Adding prediction and coefficient data (ISO/IEC 13818-2  \
+             * section 7.6.8)                                           \
+             */                                                         \
+            OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
+                     p_mb->p_data[i_b], p_mb->i_addb_c_stride );        \
+        }                                                               \
+    }                                                                   \
+}
+
+#define DECODEBLOCKSBW( OPBLOCK )                                       \
+{                                                                       \
+    int             i_b, i_mask;                                        \
+                                                                        \
+    i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
+                                                                        \
+    /* luminance */                                                     \
+    for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
+    {                                                                   \
+        if( p_mb->i_coded_block_pattern & i_mask )                      \
+        {                                                               \
+            /*                                                          \
+             * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
+             */                                                         \
+            (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
+                                  p_mb->pi_sparse_pos[i_b] );           \
+                                                                        \
+            /*                                                          \
+             * Adding prediction and coefficient data (ISO/IEC 13818-2  \
+             * section 7.6.8)                                           \
+             */                                                         \
+            OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
+                     p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
+        }                                                               \
+    }                                                                   \
+}
+
diff --git a/plugins/idct/vdec_block_c.c b/plugins/idct/vdec_block_c.c
new file mode 100644 (file)
index 0000000..9bba8cf
--- /dev/null
@@ -0,0 +1,191 @@
+/*****************************************************************************
+ * vdec_block_c.c: Macroblock copy functions in C
+ *****************************************************************************
+ * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * $Id: vdec_block_c.c,v 1.1 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Christophe Massiot <massiot@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, USA.
+ *****************************************************************************/
+
+/* MODULE_NAME defined in Makefile together with -DBUILTIN */
+#ifdef BUILTIN
+#   include "modules_inner.h"
+#else
+#   define _M( foo ) foo
+#endif
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "intf_msg.h"
+
+#include "input_ext-dec.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "vdec_motion.h"
+#include "video_decoder.h"
+
+#include "vpar_blocks.h"
+
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
+#include "video_fifo.h"
+
+#include "vdec_block.h"
+
+/*****************************************************************************
+ * Static variables
+ *****************************************************************************
+ * We can keep them static since they will always contain the same values.
+ *****************************************************************************/
+static u8  pi_crop_buf[VDEC_CROPRANGE];
+static u8 *pi_crop;
+
+/*****************************************************************************
+ * vdec_Init: initialize video decoder thread
+ *****************************************************************************/
+void _M( vdec_Init ) ( vdec_thread_t *p_vdec )
+{
+    int i_dummy;
+
+    /* Init crop table */
+    pi_crop = pi_crop_buf + (VDEC_CROPRANGE >> 1);
+
+    for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ )
+    {
+        pi_crop[i_dummy] = 0;
+    }
+
+    for( ; i_dummy < 255; i_dummy ++ )
+    {
+        pi_crop[i_dummy] = i_dummy;
+    }
+
+    for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ )
+    {
+        pi_crop[i_dummy] = 255;
+    }
+}
+
+/*****************************************************************************
+ * AddBlock : add a block
+ *****************************************************************************/
+static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                                 yuv_data_t * p_data, int i_incr )
+{
+    int i_x, i_y;
+
+    for( i_y = 0; i_y < 8; i_y++ )
+    {
+        for( i_x = 0; i_x < 8; i_x++ )
+        {
+            *p_data = pi_crop[*p_data + *p_block++];
+            p_data++;
+        }
+        p_data += i_incr;
+    }
+}
+
+/*****************************************************************************
+ * CopyBlock : copy a block
+ *****************************************************************************/
+static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                                  yuv_data_t * p_data, int i_incr )
+{
+    int i_x, i_y;
+
+    for( i_y = 0; i_y < 8; i_y++ )
+    {
+        for( i_x = 0; i_x < 8; i_x++ )
+        {
+            *p_data++ = pi_crop[*p_block++];
+        }
+        p_data += i_incr;
+    }
+}
+
+void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec, macroblock_t * p_mb )
+{
+    if( !(p_mb->i_mb_type & MB_INTRA) )
+    {
+        /*
+         * Motion Compensation (ISO/IEC 13818-2 section 7.6)
+         */
+        if( p_mb->pf_motion == 0 )
+        {
+            intf_WarnMsg( 2, "pf_motion set to NULL" );
+        }
+        else
+        {
+            p_mb->pf_motion( p_mb );
+        }
+
+        DECODEBLOCKSC( AddBlock )
+    }
+    else
+    {
+        DECODEBLOCKSC( CopyBlock )
+    }
+
+    /*
+     * Decoding is finished, release the macroblock and free
+     * unneeded memory.
+     */
+    vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
+}
+
+void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec,
+                                     macroblock_t * p_mb )
+{
+    if( !(p_mb->i_mb_type & MB_INTRA) )
+    {
+        /*
+         * Motion Compensation (ISO/IEC 13818-2 section 7.6)
+         */
+        if( p_mb->pf_motion == 0 )
+        {
+            intf_WarnMsg( 2, "pf_motion set to NULL" );
+        }
+        else
+        {
+            p_mb->pf_motion( p_mb );
+        }
+
+        DECODEBLOCKSBW( AddBlock )
+    }
+    else
+    {
+        DECODEBLOCKSBW( CopyBlock )
+    }
+
+    /*
+     * Decoding is finished, release the macroblock and free
+     * unneeded memory.
+     */
+    vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
+}
+
diff --git a/plugins/idct/vdec_block_mmx.c b/plugins/idct/vdec_block_mmx.c
new file mode 100644 (file)
index 0000000..786ed20
--- /dev/null
@@ -0,0 +1,273 @@
+/*****************************************************************************
+ * vdec_block_mmx.c: Macroblock copy functions in MMX assembly
+ *****************************************************************************
+ * Copyright (C) 1999, 2000, 2001 VideoLAN
+ * $Id: vdec_block_mmx.c,v 1.1 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Gaël Hendryckx <jimmy@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, USA.
+ *****************************************************************************/
+
+/* MODULE_NAME defined in Makefile together with -DBUILTIN */
+#ifdef BUILTIN
+#   include "modules_inner.h"
+#else
+#   define _M( foo ) foo
+#endif
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "intf_msg.h"
+
+#include "input_ext-dec.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "vdec_motion.h"
+#include "video_decoder.h"
+
+#include "vpar_blocks.h"
+
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
+#include "video_fifo.h"
+
+#include "vdec_block.h"
+
+/*****************************************************************************
+ * vdec_Init: initialize video decoder thread
+ *****************************************************************************/
+void _M( vdec_Init ) ( vdec_thread_t *p_vdec )
+{
+    ;
+}
+
+/*****************************************************************************
+ * AddBlock : add a block
+ *****************************************************************************/
+static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                                 yuv_data_t * p_data, int i_incr )
+{
+    asm __volatile__ ( 
+            "pxor       %%mm7,%%mm7\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      (%2),%%mm2\n\t"
+            "paddw      8(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      16(%2),%%mm2\n\t"
+            "paddw      24(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      32(%2),%%mm2\n\t"
+            "paddw      40(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      48(%2),%%mm2\n\t"
+            "paddw      56(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      64(%2),%%mm2\n\t"
+            "paddw      72(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      80(%2),%%mm2\n\t"
+            "paddw      88(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      96(%2),%%mm2\n\t"
+            "paddw      104(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+            "addl       %3,%0\n\t"
+
+            "movq       (%0),%%mm1\n\t"
+            "movq       %%mm1,%%mm2\n\t"
+            "punpckhbw  %%mm7,%%mm1\n\t"
+            "punpcklbw  %%mm7,%%mm2\n\t"
+            "paddw      112(%2),%%mm2\n\t"
+            "paddw      120(%2),%%mm1\n\t"
+            "packuswb   %%mm1,%%mm2\n\t"
+            "movq       %%mm2,(%0)\n\t"
+
+            //"emms"
+            : "=r" (p_data)
+            : "0" (p_data), "r" (p_block), "r" (i_incr + 8) );
+}
+
+/*****************************************************************************
+ * CopyBlock : copy a block
+ *****************************************************************************/
+static  __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                                   yuv_data_t * p_data, int i_incr )
+{
+    asm __volatile__ (
+            "movq         (%2),%%mm0\n\t"
+            "packuswb   8(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        16(%2),%%mm0\n\t"
+            "packuswb   24(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        32(%2),%%mm0\n\t"
+            "packuswb   40(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        48(%2),%%mm0\n\t"
+            "packuswb   56(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        64(%2),%%mm0\n\t"
+            "packuswb   72(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        80(%2),%%mm0\n\t"
+            "packuswb   88(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        96(%2),%%mm0\n\t"
+            "packuswb   104(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+            "addl           %3,%0\n\t"
+
+            "movq        112(%2),%%mm0\n\t"
+            "packuswb   120(%2),%%mm0\n\t"
+            "movq        %%mm0,(%0)\n\t"
+
+            //"emms"
+            : "=r" (p_data)
+            : "0" (p_data), "r" (p_block), "r" (i_incr + 8) );
+}
+
+void _M( vdec_DecodeMacroblockC ) ( vdec_thread_t *p_vdec,
+                                    macroblock_t * p_mb )
+{
+    if( !(p_mb->i_mb_type & MB_INTRA) )
+    {
+        /*
+         * Motion Compensation (ISO/IEC 13818-2 section 7.6)
+         */
+        if( p_mb->pf_motion == 0 )
+        {
+            intf_WarnMsg( 2, "pf_motion set to NULL" );
+        }
+        else
+        {
+            p_mb->pf_motion( p_mb );
+        }
+
+        DECODEBLOCKSC( AddBlock )
+    }
+    else
+    {
+        DECODEBLOCKSC( CopyBlock )
+    }
+
+    /*
+     * Decoding is finished, release the macroblock and free
+     * unneeded memory.
+     */
+    vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
+}
+
+void _M( vdec_DecodeMacroblockBW ) ( vdec_thread_t *p_vdec,
+                                     macroblock_t * p_mb )
+{
+    if( !(p_mb->i_mb_type & MB_INTRA) )
+    {
+        /*
+         * Motion Compensation (ISO/IEC 13818-2 section 7.6)
+         */
+        if( p_mb->pf_motion == 0 )
+        {
+            intf_WarnMsg( 2, "pf_motion set to NULL" );
+        }
+        else
+        {
+            p_mb->pf_motion( p_mb );
+        }
+
+        DECODEBLOCKSBW( AddBlock )
+    }
+    else
+    {
+        DECODEBLOCKSBW( CopyBlock )
+    }
+
+    /*
+     * Decoding is finished, release the macroblock and free
+     * unneeded memory.
+     */
+    vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
+}
+
diff --git a/plugins/idct/vdec_idct.c b/plugins/idct/vdec_idct.c
new file mode 100644 (file)
index 0000000..9ee29ed
--- /dev/null
@@ -0,0 +1,127 @@
+/*****************************************************************************
+ * vdec_idct.c : common IDCT functions
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_idct.c,v 1.1 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Gaël Hendryckx <jimmy@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, USA.
+ *****************************************************************************/
+
+/* MODULE_NAME defined in Makefile together with -DBUILTIN */
+#ifdef BUILTIN
+#   include "modules_inner.h"
+#else
+#   define _M( foo ) foo
+#endif
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <string.h>                                    /* memcpy(), memset() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+
+#include "video.h"
+#include "video_output.h"
+
+#include "video_decoder.h"
+
+#include "modules.h"
+
+#include "vdec_idct.h"
+
+/*****************************************************************************
+ * vdec_InitIDCT : initialize datas for vdec_SparseIDCT
+ *****************************************************************************/
+void _M( vdec_InitIDCT ) (vdec_thread_t * p_vdec)
+{
+    int i;
+
+    dctelem_t * p_pre = p_vdec->p_pre_idct;
+    memset( p_pre, 0, 64*64*sizeof(dctelem_t) );
+
+    for( i=0 ; i < 64 ; i++ )
+    {
+        p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR;
+        _M( vdec_IDCT )( p_vdec, &p_pre[i*64], 0) ;
+    }
+    return;
+}
+
+/*****************************************************************************
+ * vdec_SparseIDCT : IDCT function for sparse matrices
+ *****************************************************************************/
+void _M( vdec_SparseIDCT ) ( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                             int i_sparse_pos)
+{
+    short int val;
+    int * dp;
+    int v;
+    short int * p_dest;
+    short int * p_source;
+    int coeff, rr;
+
+    /* If DC Coefficient. */
+    if ( i_sparse_pos == 0 )
+    {
+        dp=(int *)p_block;
+        val=RIGHT_SHIFT((*p_block + 4), 3);
+        /* Compute int to assign.  This speeds things up a bit */
+        v = ((val & 0xffff) | (val << 16));
+        dp[0] = v;     dp[1] = v;     dp[2] = v;     dp[3] = v;
+        dp[4] = v;     dp[5] = v;     dp[6] = v;     dp[7] = v;
+        dp[8] = v;     dp[9] = v;     dp[10] = v;    dp[11] = v;
+        dp[12] = v;    dp[13] = v;    dp[14] = v;    dp[15] = v;
+        dp[16] = v;    dp[17] = v;    dp[18] = v;    dp[19] = v;
+        dp[20] = v;    dp[21] = v;    dp[22] = v;    dp[23] = v;
+        dp[24] = v;    dp[25] = v;    dp[26] = v;    dp[27] = v;
+        dp[28] = v;    dp[29] = v;    dp[30] = v;    dp[31] = v;
+        return;
+    }
+    /* Some other coefficient. */
+    p_dest = (s16*)p_block;
+    p_source = (s16*)&p_vdec->p_pre_idct[i_sparse_pos];
+    coeff = (int)p_dest[i_sparse_pos];
+    for( rr=0 ; rr < 4 ; rr++ )
+    {
+        p_dest[0] = (p_source[0] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[1] = (p_source[1] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[2] = (p_source[2] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[3] = (p_source[3] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[4] = (p_source[4] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[5] = (p_source[5] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[6] = (p_source[6] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[7] = (p_source[7] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[8] = (p_source[8] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[9] = (p_source[9] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[10] = (p_source[10] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[11] = (p_source[11] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[12] = (p_source[12] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[13] = (p_source[13] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[14] = (p_source[14] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest[15] = (p_source[15] * coeff) >> SPARSE_SCALE_FACTOR;
+        p_dest += 16;
+        p_source += 16;
+    }
+    return;
+}
+
diff --git a/plugins/idct/vdec_idct.h b/plugins/idct/vdec_idct.h
new file mode 100644 (file)
index 0000000..61b15d7
--- /dev/null
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ * vdec_idct.h : macros for the inverse discrete cosine transform
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ * $Id: vdec_idct.h,v 1.1 2001/05/06 04:32:02 sam Exp $
+ *
+ * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
+ *          Christophe Massiot <massiot@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, USA.
+ *****************************************************************************/
+
+#define SPARSE_SCALE_FACTOR 8
+#define DCTSIZE 8 /* 8*8 DCT */
+
+/*****************************************************************************
+ * Macros
+ *****************************************************************************/
+
+/* We assume that right shift corresponds to signed division by 2 with
+ * rounding towards minus infinity.  This is correct for typical "arithmetic
+ * shift" instructions that shift in copies of the sign bit.  But some
+ * C compilers implement >> with an unsigned shift.  For these machines you
+ * must define RIGHT_SHIFT_IS_UNSIGNED.
+ * RIGHT_SHIFT provides a proper signed right shift of an s32 quantity.
+ * It is only applied with constant shift counts.  SHIFT_TEMPS must be
+ * included in the variables of any routine using RIGHT_SHIFT.
+ */
+
+#ifdef RIGHT_SHIFT_IS_UNSIGNED
+#define SHIFT_TEMPS s32 shift_temp;
+#define RIGHT_SHIFT(x,shft)  \
+    ((shift_temp = (x)) < 0 ? \
+     (shift_temp >> (shft)) | ((~((s32) 0)) << (32-(shft))) : \
+     (shift_temp >> (shft)))
+#else
+#define SHIFT_TEMPS
+#define RIGHT_SHIFT(x,shft) ((x) >> (shft))
+#endif
+
+/*
+ * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT
+ * on each column.  Direct algorithms are also available, but they are
+ * much more complex and seem not to be any faster when reduced to code.
+ *
+ * The poop on this scaling stuff is as follows:
+ *
+ * Each 1-D IDCT step produces outputs which are a factor of sqrt(N)
+ * larger than the true IDCT outputs.  The final outputs are therefore
+ * a factor of N larger than desired; since N=8 this can be cured by
+ * a simple right shift at the end of the algorithm.  The advantage of
+ * this arrangement is that we save two multiplications per 1-D IDCT,
+ * because the y0 and y4 inputs need not be divided by sqrt(N).
+ *
+ * We have to do addition and subtraction of the integer inputs, which
+ * is no problem, and multiplication by fractional constants, which is
+ * a problem to do in integer arithmetic.  We multiply all the constants
+ * by CONST_SCALE and convert them to integer constants (thus retaining
+ * CONST_BITS bits of precision in the constants).  After doing a
+ * multiplication we have to divide the product by CONST_SCALE, with proper
+ * rounding, to produce the correct output.  This division can be done
+ * cheaply as a right shift of CONST_BITS bits.  We postpone shifting
+ * as long as possible so that partial sums can be added together with
+ * full fractional precision.
+ *
+ * The outputs of the first pass are scaled up by PASS1_BITS bits so that
+ * they are represented to better-than-integral precision.  These outputs
+ * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word
+ * with the recommended scaling.  (To scale up 12-bit sample data further, an
+ * intermediate s32 array would be needed.)
+ *
+ * To avoid overflow of the 32-bit intermediate results in pass 2, we must
+ * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26.  Error analysis
+ * shows that the values given below are the most effective.
+ */
+
+#define CONST_BITS 8                         /* Jimmy chose this constant :) */
+
+#ifdef EIGHT_BIT_SAMPLES
+#define PASS1_BITS  2
+#else
+#define PASS1_BITS  1           /* lose a little precision to avoid overflow */
+#endif
+
+#define ONE     ((s32) 1)
+
+#define CONST_SCALE (ONE << CONST_BITS)
+
+/* Convert a positive real constant to an integer scaled by CONST_SCALE.
+ * IMPORTANT: if your compiler doesn't do this arithmetic at compile time,
+ * you will pay a significant penalty in run time.  In that case, figure
+ * the correct integer constant values and insert them by hand.
+ */
+
+#define FIX(x)  ((s32) ((x) * CONST_SCALE + 0.5))
+
+/* When adding two opposite-signed fixes, the 0.5 cancels */
+#define FIX2(x) ((s32) ((x) * CONST_SCALE))
+
+/* Descale and correctly round an s32 value that's scaled by N bits.
+ * We assume RIGHT_SHIFT rounds towards minus infinity, so adding
+ * the fudge factor is correct for either sign of X.
+ */
+
+#define DESCALE(x,n)  RIGHT_SHIFT((x) + (ONE << ((n)-1)), n)
+
+/* Multiply an s32 variable by an s32 constant to yield an s32 result.
+ * For 8-bit samples with the recommended scaling, all the variable
+ * and constant values involved are no more than 16 bits wide, so a
+ * 16x16->32 bit multiply can be used instead of a full 32x32 multiply;
+ * this provides a useful speedup on many machines.
+ * There is no way to specify a 16x16->32 multiply in portable C, but
+ * some C compilers will do the right thing if you provide the correct
+ * combination of casts.
+ * NB: for 12-bit samples, a full 32-bit multiplication will be needed.
+ */
+
+#ifdef EIGHT_BIT_SAMPLES
+#ifdef SHORTxSHORT_32                        /* may work if 'int' is 32 bits */
+#define MULTIPLY(var,const)  (((INT16) (var)) * ((INT16) (const)))
+#endif
+#ifdef SHORTxLCONST_32                 /* known to work with Microsoft C 6.0 */
+#define MULTIPLY(var,const)  (((INT16) (var)) * ((s32) (const)))
+#endif
+#endif
+
+#ifndef MULTIPLY                                       /* default definition */
+#define MULTIPLY(var,const)  ((var) * (const))
+#endif
+
+/*****************************************************************************
+ * Protoypes
+ *****************************************************************************/
+void _M( vdec_SparseIDCT ) ( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                             int i_sparse_pos);
+void _M( vdec_InitIDCT )   ( vdec_thread_t * p_vdec );
+void _M( vdec_IDCT )       ( vdec_thread_t * p_vdec, dctelem_t * p_block,
+                             int i_idontcare );
+
index 9d927f2..37cdd7b 100644 (file)
@@ -22,13 +22,13 @@ $(PLUGIN_QT): %.o: .dep/%.dpp
 $(PLUGIN_QT): %.o: %.moc
        $(CC) $(CFLAGS) $(PCFLAGS) -I/usr/include/qt -I${QTDIR}/include -c -o $@ $(<:%.moc=%.cpp)
 $(PLUGIN_QT:%.o=%.moc): %.moc: %.cpp
-       $(MOC) -i $< -o $@
+       grep -q Q_OBJECT $< && $(MOC) -i $< -o $@ || true
 
 $(BUILTIN_QT): BUILTIN_%.o: .dep/%.dpp
 $(BUILTIN_QT): %.o: %.moc
        $(CC) $(CFLAGS) -DBUILTIN -I/usr/include/qt -I${QTDIR}/include -c -o $@ $(<:BUILTIN_%.moc=%.cpp)
 $(BUILTIN_QT:%.o=%.moc): BUILTIN_%.moc: %.cpp
-       $(MOC) -i $< -o $@
+       grep -q Q_OBJECT $< && $(MOC) -i $< -o $@ || true
 
 #
 # Real targets
index 614622b..14b0816 100644 (file)
@@ -55,9 +55,6 @@
 #include "video.h"
 #include "video_output.h"
 
-#include "main.h"
-
-
 /*****************************************************************************
  * intf_sys_t: description and status of rc interface
  *****************************************************************************/
@@ -212,7 +209,14 @@ static void intf_Run( intf_thread_t *p_intf )
 
                 case 'f':
                 case 'F':
-                    p_main->p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
+                    vlc_mutex_lock( &p_vout_bank->lock );
+                    /* XXX: only fullscreen the first video output */
+                    if( p_vout_bank->i_count )
+                    {
+                        p_vout_bank->pp_vout[0]->i_changes
+                                          |= VOUT_FULLSCREEN_CHANGE;
+                    }
+                    vlc_mutex_unlock( &p_vout_bank->lock );
                     break;
 
                 case 'm':
index ebf474b..89da86d 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_bit_allocate.c: ac3 allocation tables
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: ac3_bit_allocate.c,v 1.19 2001/04/26 11:23:16 sam Exp $
+ * $Id: ac3_bit_allocate.c,v 1.20 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -24,6 +24,8 @@
  *****************************************************************************/
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"
index c3fd6d4..8659165 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_decoder.c: core ac3 decoder
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder.c,v 1.30 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_decoder.c,v 1.31 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Michel Lespinasse <walken@zoy.org>
@@ -25,6 +25,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"
 
 #include "stream_control.h"
 #include "input_ext-dec.h"
-#include "audio_output.h"
 
+#include "audio_output.h"
 
 #include "ac3_decoder.h"
 #include "ac3_decoder_thread.h"
-
 #include "ac3_internal.h"
 
 #include <stdio.h>
index 278942c..6cac361 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_decoder_thread.c: ac3 decoder thread
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_decoder_thread.c,v 1.31 2001/05/01 04:18:18 sam Exp $
+ * $Id: ac3_decoder_thread.c,v 1.32 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Lespinasse <walken@zoy.org>
  *
@@ -39,6 +39,7 @@
 
 #include <stdio.h>                                           /* "intf_msg.h" */
 #include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>                                              /* memset() */
 
 #include "config.h"
 #include "common.h"
index c78ec60..08ecbcc 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_downmix.c: ac3 downmix functions
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_downmix.c,v 1.21 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_downmix.c,v 1.22 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -24,6 +24,8 @@
  *****************************************************************************/
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"
@@ -33,6 +35,7 @@
 
 #include "stream_control.h"
 #include "input_ext-dec.h"
+
 #include "ac3_decoder.h"
 #include "ac3_internal.h"
 #include "ac3_downmix.h"
index 757c532..992ebe0 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_downmix_c.c: ac3 downmix functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: ac3_downmix_c.c,v 1.6 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_downmix_c.c,v 1.7 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -24,6 +24,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"
index 295843a..e632510 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct.c: ac3 DCT
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_imdct.c,v 1.17 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_imdct.c,v 1.18 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -25,6 +25,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include <math.h>
 #include <stdio.h>
 
index 11165cb..d9f7300 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_imdct_c.c: ac3 DCT
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_imdct_c.c,v 1.1 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_imdct_c.c,v 1.2 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -24,6 +24,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include <math.h>
 #include <stdio.h>
 
 #include "ac3_decoder.h"
 #include "ac3_internal.h"
 
+#ifndef M_PI
+#   define M_PI 3.14159265358979323846
+#endif
+
 void fft_64p_c (complex_t *x);
 void fft_128p_c (complex_t *x);
 void imdct_do_512_c (imdct_t * p_imdct, float data[], float delay[]);
index 7282456..31148db 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_mantissa.c: ac3 mantissa computation
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: ac3_mantissa.c,v 1.25 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_mantissa.c,v 1.26 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -25,6 +25,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"
index 13ca944..032d2de 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_parse.c: ac3 parsing procedures
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: ac3_parse.c,v 1.19 2001/04/26 00:12:19 reno Exp $
+ * $Id: ac3_parse.c,v 1.20 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -25,6 +25,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memset() */
+
 #include "config.h"
 #include "common.h"
 
index 452867c..9fc4b90 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_rematrix.c: ac3 audio rematrixing
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_rematrix.c,v 1.15 2001/04/30 21:04:20 reno Exp $
+ * $Id: ac3_rematrix.c,v 1.16 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -23,6 +23,8 @@
  *****************************************************************************/
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"
index 7eed98a..c23b7a6 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_srfft.c: ac3 FFT
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: ac3_srfft.c,v 1.2 2001/04/30 21:10:25 reno Exp $
+ * $Id: ac3_srfft.c,v 1.3 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Renaud Dartus <reno@videolan.org>
  *          Aaron Holtzman <aholtzma@engr.uvic.ca>
@@ -24,6 +24,8 @@
 
 #include "defs.h"
 
+#include <string.h>                                              /* memcpy() */
+
 #include <math.h>
 #include <stdio.h>
 
index c999449..adb54f2 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_iec958.c: ac3 to spdif converter
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ac3_iec958.c,v 1.2 2001/05/01 04:18:18 sam Exp $
+ * $Id: ac3_iec958.c,v 1.3 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
@@ -30,6 +30,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>                                              /* memset() */
 #include <fcntl.h>
 #include <unistd.h>
 
index 907564f..2666090 100644 (file)
@@ -2,7 +2,7 @@
  * ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: ac3_spdif.c,v 1.2 2001/05/01 04:18:18 sam Exp $
+ * $Id: ac3_spdif.c,v 1.3 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Stéphane Borel <stef@via.ecp.fr>
  *          Juha Yrjola <jyrjola@cc.hut.fi>
  * 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.
- ****************************************************************************/
+ *****************************************************************************/
 
-/****************************************************************************
+/*****************************************************************************
  * Preamble
- ****************************************************************************/
+ *****************************************************************************/
 #include "defs.h"
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>                                              /* memcpy() */
 #include <fcntl.h>
 #include <unistd.h>
 
index 337c6a5..0be3fad 100644 (file)
@@ -2,7 +2,7 @@
  * aout_ext-dec.c : exported fifo management functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: aout_ext-dec.c,v 1.1 2001/05/01 04:18:18 sam Exp $
+ * $Id: aout_ext-dec.c,v 1.2 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *
@@ -48,30 +48,44 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate,
                                long l_units, long l_frame_size,
                                void *p_buffer )
 {
-#define P_AOUT p_main->p_aout
+    aout_thread_t *p_aout;
     int i_fifo;
 
     /* Spawn an audio output if there is none */
-    if( P_AOUT == NULL )
+    vlc_mutex_lock( &p_aout_bank->lock );
+
+    if( p_aout_bank->i_count == 0 )
     {
-        P_AOUT = aout_CreateThread( NULL );
+        intf_Msg( "aout: no aout present, spawning one" );
+
+        p_aout = aout_CreateThread( NULL );
 
-        if( P_AOUT == NULL )
+        /* Everything failed */
+        if( p_aout == NULL )
         {
+            vlc_mutex_unlock( &p_aout_bank->lock );
             return NULL;
         }
+
+        p_aout_bank->pp_aout[ p_aout_bank->i_count ] = p_aout;
+        p_aout_bank->i_count++;
+    }
+    else
+    {
+        /* Take the first audio output FIXME: take the best one */
+        p_aout = p_aout_bank->pp_aout[ 0 ];
     }
 
     /* Take the fifos lock */
-    vlc_mutex_lock( &P_AOUT->fifos_lock );
+    vlc_mutex_lock( &p_aout->fifos_lock );
 
     /* Looking for a free fifo structure */
     for( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
     {
-        if( P_AOUT->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO )
+        if( p_aout->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO )
         {
             /* Not very clever, but at least we know which fifo it is */
-            P_AOUT->fifo[i_fifo].i_fifo = i_fifo;
+            p_aout->fifo[i_fifo].i_fifo = i_fifo;
             break;
         }
     }
@@ -79,97 +93,101 @@ aout_fifo_t * aout_CreateFifo( int i_type, int i_channels, long l_rate,
     if( i_fifo == AOUT_MAX_FIFOS )
     {
         intf_ErrMsg( "aout error: no fifo available" );
-        vlc_mutex_unlock( &P_AOUT->fifos_lock );
+        vlc_mutex_unlock( &p_aout->fifos_lock );
+        vlc_mutex_unlock( &p_aout_bank->lock );
         return( NULL );
     }
 
     /* Initialize the new fifo structure */
-    switch ( P_AOUT->fifo[i_fifo].i_type = i_type )
+    switch ( p_aout->fifo[i_fifo].i_type = i_type )
     {
         case AOUT_INTF_MONO_FIFO:
         case AOUT_INTF_STEREO_FIFO:
-            P_AOUT->fifo[i_fifo].b_die = 0;
+            p_aout->fifo[i_fifo].b_die = 0;
 
-            P_AOUT->fifo[i_fifo].i_channels = i_channels;
-            P_AOUT->fifo[i_fifo].b_stereo = ( i_channels == 2 );
-            P_AOUT->fifo[i_fifo].l_rate = l_rate;
+            p_aout->fifo[i_fifo].i_channels = i_channels;
+            p_aout->fifo[i_fifo].b_stereo = ( i_channels == 2 );
+            p_aout->fifo[i_fifo].l_rate = l_rate;
 
-            P_AOUT->fifo[i_fifo].buffer = p_buffer;
+            p_aout->fifo[i_fifo].buffer = p_buffer;
 
-            P_AOUT->fifo[i_fifo].l_unit = 0;
-            InitializeIncrement( &P_AOUT->fifo[i_fifo].unit_increment,
-                                 l_rate, P_AOUT->l_rate );
-            P_AOUT->fifo[i_fifo].l_units = l_units;
+            p_aout->fifo[i_fifo].l_unit = 0;
+            InitializeIncrement( &p_aout->fifo[i_fifo].unit_increment,
+                                 l_rate, p_aout->l_rate );
+            p_aout->fifo[i_fifo].l_units = l_units;
             break;
 
         case AOUT_ADEC_MONO_FIFO:
         case AOUT_ADEC_STEREO_FIFO:
-            P_AOUT->fifo[i_fifo].b_die = 0;
+            p_aout->fifo[i_fifo].b_die = 0;
 
-            P_AOUT->fifo[i_fifo].i_channels = i_channels;
-            P_AOUT->fifo[i_fifo].b_stereo = ( i_channels == 2 );
-            P_AOUT->fifo[i_fifo].l_rate = l_rate;
+            p_aout->fifo[i_fifo].i_channels = i_channels;
+            p_aout->fifo[i_fifo].b_stereo = ( i_channels == 2 );
+            p_aout->fifo[i_fifo].l_rate = l_rate;
 
-            P_AOUT->fifo[i_fifo].l_frame_size = l_frame_size;
+            p_aout->fifo[i_fifo].l_frame_size = l_frame_size;
             /* Allocate the memory needed to store the audio frames. As the
              * fifo is a rotative fifo, we must be able to find out whether
              * the fifo is full or empty, that's why we must in fact allocate
              * memory for (AOUT_FIFO_SIZE+1) audio frames. */
-            P_AOUT->fifo[i_fifo].buffer = malloc( sizeof(s16) *
+            p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16) *
                                    ( AOUT_FIFO_SIZE + 1 ) * l_frame_size );
-            if ( P_AOUT->fifo[i_fifo].buffer == NULL )
+            if ( p_aout->fifo[i_fifo].buffer == NULL )
             {
                 intf_ErrMsg( "aout error: cannot create frame buffer" );
-                P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-                vlc_mutex_unlock( &P_AOUT->fifos_lock );
+                p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
+                vlc_mutex_unlock( &p_aout->fifos_lock );
+                vlc_mutex_unlock( &p_aout_bank->lock );
                 return( NULL );
             }
 
             /* Allocate the memory needed to store the dates of the frames */
-            P_AOUT->fifo[i_fifo].date =
+            p_aout->fifo[i_fifo].date =
                            malloc( sizeof(mtime_t) * ( AOUT_FIFO_SIZE +  1) );
 
-            if ( P_AOUT->fifo[i_fifo].date == NULL )
+            if ( p_aout->fifo[i_fifo].date == NULL )
             {
                 intf_ErrMsg( "aout error: cannot create date buffer");
-                free( P_AOUT->fifo[i_fifo].buffer );
-                P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-                vlc_mutex_unlock( &P_AOUT->fifos_lock );
+                free( p_aout->fifo[i_fifo].buffer );
+                p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
+                vlc_mutex_unlock( &p_aout->fifos_lock );
+                vlc_mutex_unlock( &p_aout_bank->lock );
                 return( NULL );
             }
 
             /* Set the fifo's buffer as empty (the first frame that is to be
              * played is also the first frame that is not to be played) */
-            P_AOUT->fifo[i_fifo].l_start_frame = 0;
-            /* P_AOUT->fifo[i_fifo].l_next_frame = 0; */
-            P_AOUT->fifo[i_fifo].l_end_frame = 0;
+            p_aout->fifo[i_fifo].l_start_frame = 0;
+            /* p_aout->fifo[i_fifo].l_next_frame = 0; */
+            p_aout->fifo[i_fifo].l_end_frame = 0;
 
             /* Waiting for the audio decoder to compute enough frames to work
              * out the fifo's current rate (as soon as the decoder has decoded
              * enough frames, the members of the fifo structure that are not
              * initialized now will be calculated) */
-            P_AOUT->fifo[i_fifo].b_start_frame = 0;
-            P_AOUT->fifo[i_fifo].b_next_frame = 0;
+            p_aout->fifo[i_fifo].b_start_frame = 0;
+            p_aout->fifo[i_fifo].b_next_frame = 0;
             break;
 
         default:
             intf_ErrMsg( "aout error: unknown fifo type 0x%x",
-                         P_AOUT->fifo[i_fifo].i_type );
-            P_AOUT->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
-            vlc_mutex_unlock( &P_AOUT->fifos_lock );
+                         p_aout->fifo[i_fifo].i_type );
+            p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
+            vlc_mutex_unlock( &p_aout->fifos_lock );
+            vlc_mutex_unlock( &p_aout_bank->lock );
             return( NULL );
     }
 
     /* Release the fifos lock */
-    vlc_mutex_unlock( &P_AOUT->fifos_lock );
+    vlc_mutex_unlock( &p_aout->fifos_lock );
+    vlc_mutex_unlock( &p_aout_bank->lock );
 
     intf_WarnMsg( 2, "aout info: fifo #%i allocated, %i channels, rate %li",
-                  P_AOUT->fifo[i_fifo].i_fifo, P_AOUT->fifo[i_fifo].i_channels,
-                  P_AOUT->fifo[i_fifo].l_rate );
+                  p_aout->fifo[i_fifo].i_fifo, p_aout->fifo[i_fifo].i_channels,
+                  p_aout->fifo[i_fifo].l_rate );
 
     /* Return the pointer to the fifo structure */
-    return( &P_AOUT->fifo[i_fifo] );
-#undef P_AOUT
+    return( &p_aout->fifo[i_fifo] );
 }
 
 /*****************************************************************************
index a0a41a2..ce093eb 100644 (file)
@@ -82,7 +82,7 @@ void aout_S16StereoThread( aout_thread_t * p_aout )
         {
             ((s16 *)p_aout->buffer)[l_buffer] =
                      (s16)( ( p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS )
-                            * p_aout->i_vol / 256 ) ;
+                            * p_aout->i_volume / 256 ) ;
             p_aout->s32_buffer[l_buffer] = 0;
         }
 
index 85348bb..c370444 100644 (file)
@@ -2,7 +2,7 @@
  * aout_spdif: ac3 passthrough output
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: aout_spdif.c,v 1.1 2001/04/29 02:55:36 stef Exp $
+ * $Id: aout_spdif.c,v 1.2 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *          Stéphane Borel <stef@via.ecp.fr>
@@ -29,6 +29,7 @@
 
 #include <stdio.h>                                           /* "intf_msg.h" */
 #include <stdlib.h>                            /* calloc(), malloc(), free() */
+#include <string.h>                                              /* memset() */
 
 #include "config.h"
 #include "common.h"
index d23de0d..7037471 100644 (file)
@@ -2,7 +2,7 @@
  * aout_u8.c: 8 bit unsigned audio output functions
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: aout_u8.c,v 1.3 2001/05/01 04:18:18 sam Exp $
+ * $Id: aout_u8.c,v 1.4 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *
@@ -77,7 +77,7 @@ void aout_U8MonoThread( aout_thread_t * p_aout )
 
         for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
         {
-            ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->i_vol / 256 );
+            ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256 ) + 128 ) * p_aout->i_volume / 256 );
             p_aout->s32_buffer[l_buffer] = 0;
         }
 
@@ -131,7 +131,7 @@ void aout_U8StereoThread( aout_thread_t * p_aout )
 
         for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
         {
-            ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->i_vol / 256 );
+            ((u8 *)p_aout->buffer)[l_buffer] = (u8)( ( (p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS / 256) + 128 ) * p_aout->i_volume / 256 );
             p_aout->s32_buffer[l_buffer] = 0;
         }
         l_bytes = p_aout->pf_getbufinfo( p_aout, l_buffer_limit );
index 6ad459b..f7f47a7 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.c : audio output thread
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: audio_output.c,v 1.59 2001/05/01 04:18:18 sam Exp $
+ * $Id: audio_output.c,v 1.60 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Michel Kaempf <maxx@via.ecp.fr>
  *
  *****************************************************************************/
 static int aout_SpawnThread( aout_thread_t * p_aout );
 
+/*****************************************************************************
+ * aout_InitBank: initialize the audio output bank.
+ *****************************************************************************/
+void aout_InitBank ( void )
+{
+    p_aout_bank->i_count = 0;
+
+    vlc_mutex_init( &p_aout_bank->lock );
+}
+
+/*****************************************************************************
+ * aout_EndBank: empty the audio output bank.
+ *****************************************************************************
+ * This function ends all unused audio outputs and empties the bank in
+ * case of success.
+ *****************************************************************************/
+void aout_EndBank ( void )
+{
+    /* Ask all remaining audio outputs to die */
+    while( p_aout_bank->i_count )
+    {
+        aout_DestroyThread(
+                p_aout_bank->pp_aout[ --p_aout_bank->i_count ], NULL );
+    }
+
+    vlc_mutex_destroy( &p_aout_bank->lock );
+}
+
 /*****************************************************************************
  * aout_CreateThread: initialize audio thread
  *****************************************************************************/
@@ -138,7 +166,8 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     }
 
     /* Initialize the volume level */
-    p_aout->i_vol = VOLUME_DEFAULT;
+    p_aout->i_volume = VOLUME_DEFAULT;
+    p_aout->i_savedvolume = 0;
     
     /* FIXME: maybe it would be cleaner to change SpawnThread prototype
      * see vout to handle status correctly ?? however, it is not critical since
@@ -311,7 +340,6 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
  *****************************************************************************/
 void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
 {
-
     int i_fifo;
     
     /* FIXME: pi_status is not handled correctly: check vout how to do!?? */
index b5aafe0..930e121 100644 (file)
@@ -2,7 +2,7 @@
  * input_netlist.c: netlist management
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: input_netlist.c,v 1.35 2001/04/28 23:19:19 henri Exp $
+ * $Id: input_netlist.c,v 1.36 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Henri Fallon <henri@videolan.org>
  *
 #include <stdlib.h>
 #include <string.h>                                    /* memcpy(), memset() */
 #include <sys/types.h>
-#ifndef WIN32
-#include <sys/uio.h>                                         /* struct iovec */
-#endif
 #include <unistd.h>
 
+#ifndef WIN32 
+#   include <sys/uio.h>                                      /* struct iovec */
+#else
+    struct iovec
+    {
+        void *iov_base; /* Pointer to data.  */
+        size_t iov_len; /* Length of data.  */
+    };
+#endif
+
 #include "config.h"
 #include "common.h"
 #include "threads.h"                                                /* mutex */
 #include "input.h"
 #include "input_netlist.h"
 
-#ifdef WIN32 
-struct iovec
-  {
-    void *iov_base;     /* Pointer to data.  */
-    size_t iov_len;     /* Length of data.  */
-  };
-#endif
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-
 /*****************************************************************************
  * input_NetlistInit: allocates netlist buffers and init indexes
  *****************************************************************************/
@@ -253,7 +249,7 @@ void input_NetlistMviovec( void * p_method_data, size_t i_nb_iovec,
 
 
     /* Fills a table of pointers to packets associated with the io_vec's */
-while (i_loop < i_nb_iovec )
+    while (i_loop < i_nb_iovec )
     {
         if( i_current >= p_netlist->i_nb_data ) 
             i_current-=p_netlist->i_nb_data;
@@ -304,7 +300,7 @@ struct data_packet_s * input_NetlistNewPacket( void * p_method_data,
         return ( NULL );
     }
     
-    p_return = (p_netlist->pp_free_data[p_netlist->i_data_start]);
+    p_return = p_netlist->pp_free_data[p_netlist->i_data_start];
     p_netlist->i_data_start++;
     p_netlist->i_data_start &= ( p_netlist->i_nb_data - 1 );
 
@@ -387,7 +383,7 @@ void input_NetlistDeletePacket( void * p_method_data, data_packet_t * p_data )
     p_data->p_next = NULL;
  
     /* unlock */
-    vlc_mutex_unlock (&p_netlist->lock);
+    vlc_mutex_unlock( &p_netlist->lock );
 }
 
 /*****************************************************************************
@@ -432,7 +428,7 @@ void input_NetlistDeletePES( void * p_method_data, pes_packet_t * p_pes )
     p_netlist->pp_free_pes[p_netlist->i_pes_end] = p_pes;
     
     /* unlock */
-    vlc_mutex_unlock (&p_netlist->lock);
+    vlc_mutex_unlock( &p_netlist->lock );
 
 }
 
@@ -450,12 +446,13 @@ void input_NetlistEnd( input_thread_t * p_input)
     vlc_mutex_destroy (&p_netlist->lock);
     
     /* free the FIFO, the buffer, and the netlist structure */
-    free (p_netlist->pp_free_data);
-    free (p_netlist->pp_free_pes);
-    free (p_netlist->p_pes);
-    free (p_netlist->p_data);
-    free (p_netlist->p_buffers);
+    free( p_netlist->pp_free_data );
+    free( p_netlist->pp_free_pes );
+    free( p_netlist->p_pes );
+    free( p_netlist->p_data );
+    free( p_netlist->p_buffers );
 
     /* free the netlist */
-    free (p_netlist);
+    free( p_netlist );
 }
+
index b627e8c..f78e6f5 100644 (file)
@@ -4,7 +4,7 @@
  * interface, such as command line.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: interface.c,v 1.75 2001/05/01 04:18:18 sam Exp $
+ * $Id: interface.c,v 1.76 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -317,7 +317,7 @@ void intf_AssignNormalKeys( intf_thread_t *p_intf)
  *****************************************************************************/
 int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
 {
-    static int i_volbackup;
+    int i_index;
     keyparm k_reply;
     
     k_reply = intf_GetKey( p_intf, g_key); 
@@ -326,6 +326,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
     case INTF_KEY_QUIT:                                        /* quit order */
         p_intf->b_die = 1;
         break;
+
     case INTF_KEY_SET_CHANNEL:
         /* Change channel - return code is ignored since SelectChannel displays
          * its own error messages */
@@ -334,23 +335,62 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
 /* FIXME : keyboard event is for the time being half handled by the interface
  * half handled directly by the plugins. We should decide what to do. */        
         break;
+
     case INTF_KEY_INC_VOLUME:                                    /* volume + */
-        if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol < VOLUME_MAX) )
-            p_main->p_aout->i_vol += VOLUME_STEP;
+        vlc_mutex_lock( &p_aout_bank->lock );
+        for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
+        {
+            if( p_aout_bank->pp_aout[i_index]->i_volume
+                                                   < VOLUME_MAX - VOLUME_STEP )
+            {
+                p_aout_bank->pp_aout[i_index]->i_volume += VOLUME_STEP;
+            }
+            else
+            {
+                p_aout_bank->pp_aout[i_index]->i_volume = VOLUME_MAX;
+            }
+        }
+        vlc_mutex_unlock( &p_aout_bank->lock );
         break;
+
     case INTF_KEY_DEC_VOLUME:                                    /* volume - */
-        if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol > VOLUME_STEP) )
-            p_main->p_aout->i_vol -= VOLUME_STEP;
+        vlc_mutex_lock( &p_aout_bank->lock );
+        for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
+        {
+            if( p_aout_bank->pp_aout[i_index]->i_volume > VOLUME_STEP )
+            {
+                p_aout_bank->pp_aout[i_index]->i_volume -= VOLUME_STEP;
+            }
+            else
+            {
+                p_aout_bank->pp_aout[i_index]->i_volume = 0;
+            }
+        }
+        vlc_mutex_unlock( &p_aout_bank->lock );
         break;
+
     case INTF_KEY_TOGGLE_VOLUME:                              /* toggle mute */
-        if( (p_main->p_aout != NULL) && (p_main->p_aout->i_vol))
+        vlc_mutex_lock( &p_aout_bank->lock );
+        for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
         {
-            i_volbackup = p_main->p_aout->i_vol;
-            p_main->p_aout->i_vol = 0;
+            if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
+            {
+                p_aout_bank->pp_aout[i_index]->i_volume =
+                                p_aout_bank->pp_aout[i_index]->i_savedvolume;
+                p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
+            }
+            else
+            {
+                p_aout_bank->pp_aout[i_index]->i_savedvolume =
+                                p_aout_bank->pp_aout[i_index]->i_volume;
+                p_aout_bank->pp_aout[i_index]->i_volume = 0;
+            }
         }
-        else if( (p_main->p_aout != NULL) && (!p_main->p_aout->i_vol))
-            p_main->p_aout->i_vol = i_volbackup;
+        vlc_mutex_unlock( &p_aout_bank->lock );
         break;
+
+/* XXX: fix this later */
+#if 0
     case INTF_KEY_DEC_GAMMA:                                      /* gamma - */
         if( (p_main->p_vout != NULL) && (p_main->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
         {
@@ -367,6 +407,8 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
             p_main->p_vout->i_changes |= VOUT_GAMMA_CHANGE;
         }
         break;
+#endif
+
    case INTF_KEY_DUMP_STREAM:
         if( p_intf->p_input != NULL )
         {
@@ -375,9 +417,11 @@ int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
             vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
         }
         break;
-   default:                                                   /* unknown key */
+
+    default:                                                  /* unknown key */
         return( 1 );
     }
 
     return( 0 );
 }
+
index bfdc998..31fb705 100644 (file)
@@ -4,7 +4,7 @@
  * and spawn threads.
  *****************************************************************************
  * Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id: main.c,v 1.91 2001/05/01 04:18:18 sam Exp $
+ * $Id: main.c,v 1.92 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -185,8 +185,10 @@ static const char *psz_shortopts = "hHvgt:T:u:a:s:c:I:A:V:";
  * Global variable program_data - these are the only ones, see main.h and
  * modules.h
  *****************************************************************************/
-main_t *p_main;
-bank_t *p_bank;
+main_t        *p_main;
+module_bank_t *p_module_bank;
+aout_bank_t   *p_aout_bank;
+vout_bank_t   *p_vout_bank;
 
 /*****************************************************************************
  * Local prototypes
@@ -215,30 +217,21 @@ static int  CPUCapabilities         ( void );
  *****************************************************************************/
 int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
 {
-    main_t  main_data;                      /* root of all data - see main.h */
-    bank_t  module_bank;
+    main_t        main_data;                /* root of all data - see main.h */
+    module_bank_t module_bank;
+    aout_bank_t   aout_bank;
+    vout_bank_t   vout_bank;
 
-    p_main = &main_data;                      /* set up the global variables */
-    p_bank = &module_bank;
+    p_main        = &main_data;               /* set up the global variables */
+    p_module_bank = &module_bank;
+    p_aout_bank   = &aout_bank;
+    p_vout_bank   = &vout_bank;
 
     /*
-     * Initialize the main structure
+     * Test if our code is likely to run on this CPU 
      */
     p_main->i_cpu_capabilities = CPUCapabilities();
     
-    p_main->p_aout = NULL;
-    p_main->p_vout = NULL;
-
-    /*
-     * System specific initialization code
-     */
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
-    system_Create( &i_argc, ppsz_argv, ppsz_env );
-#endif
-
-    /*
-     * Test if our code is likely to run on this CPU 
-     */
 #if defined( __pentium__ ) || defined( __pentiumpro__ )
     if( ! TestCPU( CPU_CAPABILITY_586 ) )
     {
@@ -248,13 +241,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     }
 #endif
 
-#ifdef HAVE_MMX
-    if( ! TestCPU( CPU_CAPABILITY_MMX ) )
-    {
-        fprintf( stderr, "error: this program needs MMX extensions,\n"
-                         "please try a version without MMX support\n" );
-        return( 1 );
-    }
+    /*
+     * System specific initialization code
+     */
+#if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
+    system_Init( &i_argc, ppsz_argv, ppsz_env );
 #endif
 
     /*
@@ -297,9 +288,11 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     GetFilenames( i_argc, ppsz_argv );
 
     /*
-     * Initialize module bank
+     * Initialize module, aout and vout banks
      */
     module_InitBank();
+    aout_InitBank();
+    vout_InitBank();
 
     /*
      * Initialize shared resources and libraries
@@ -313,60 +306,44 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     }
 
     /*
-     * Run interface
+     * Try to run the interface
      */
     p_main->p_intf = intf_Create();
-    if( !p_main->p_intf )
+    if( p_main->p_intf == NULL )
     {
         intf_ErrMsg( "intf error: interface initialization failed" );
-        module_EndBank();
-        intf_PlaylistDestroy( p_main->p_playlist );
-        intf_MsgDestroy();
-        return( errno );
-    }
-
-    /*
-     * Set signal handling policy for all threads
-     */
-    InitSignalHandler();
-
-    /*
-     * This is the main loop
-     */
-    p_main->p_intf->pf_run( p_main->p_intf );
-
-    /*
-     * Finished, destroy the interface
-     */
-    intf_Destroy( p_main->p_intf );
-
-    /*
-     * Close all video devices
-     */
-    if( p_main->p_vout != NULL )
-    {
-        vout_DestroyThread( p_main->p_vout, NULL );
     }
-
-    /*
-     * Close all audio devices
-     */
-    if( p_main->p_aout != NULL )
-    {
-        aout_DestroyThread( p_main->p_aout, NULL );
-    }
-
-    /*
-     * Go back into channel 0 which is the network
-     */
-    if( p_main->b_channels )
+    else
     {
-        network_ChannelJoin( COMMON_CHANNEL );
+        /*
+         * Set signal handling policy for all threads
+         */
+        InitSignalHandler();
+
+        /*
+         * This is the main loop
+         */
+        p_main->p_intf->pf_run( p_main->p_intf );
+
+        /*
+         * Finished, destroy the interface
+         */
+        intf_Destroy( p_main->p_intf );
+
+        /*
+         * Go back into channel 0 which is the network
+         */
+        if( p_main->b_channels )
+        {
+            network_ChannelJoin( COMMON_CHANNEL );
+        }
     }
 
     /*
-     * Free module bank
+     * Free module, aout and vout banks
      */
+    vout_EndBank();
+    aout_EndBank();
     module_EndBank();
 
     /*
@@ -378,7 +355,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
      * System specific cleaning code
      */
 #if defined( SYS_BEOS ) || defined( SYS_DARWIN1_3 )
-    system_Destroy();
+    system_End();
 #endif
 
     /*
@@ -387,7 +364,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
     intf_Msg( "intf: program terminated" );
     intf_MsgDestroy();
 
-    return( 0 );
+    return 0;
 }
 
 /*****************************************************************************
index dfcdb1c..1ccb25c 100644 (file)
@@ -2,7 +2,7 @@
  * beos_init.cpp: Initialization for BeOS specific features 
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: beos_specific.cpp,v 1.10 2001/04/29 17:03:20 sam Exp $
+ * $Id: beos_specific.cpp,v 1.11 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *
@@ -69,9 +69,9 @@ extern "C"
 static void system_AppThread( void * args );
 
 /*****************************************************************************
- * system_Create: create a BApplication object and fill in program path.
+ * system_Init: create a BApplication object and fill in program path.
  *****************************************************************************/
-void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
+void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 {
     /* Prepare the lock/wait before launching the BApplication thread */
     vlc_mutex_init( &app_lock );
@@ -92,9 +92,9 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 }
 
 /*****************************************************************************
- * system_Destroy: destroy the BApplication object.
+ * system_End: destroy the BApplication object.
  *****************************************************************************/
-void system_Destroy( void )
+void system_End( void )
 {
     free( psz_program_path );
 
index 74b44f2..1bd802d 100644 (file)
@@ -2,7 +2,7 @@
  * darwin_specific.c: Darwin specific features 
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: darwin_specific.c,v 1.3 2001/04/14 07:41:20 sam Exp $
+ * $Id: darwin_specific.c,v 1.4 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -37,9 +37,9 @@
 static char * psz_program_path;
 
 /*****************************************************************************
- * system_Create: fill in program path.
+ * system_Init: fill in program path.
  *****************************************************************************/
-void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
+void system_Init( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 {
     char i_dummy;
     char *p_char, *p_oldchar = &i_dummy;
@@ -64,9 +64,9 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
 }
 
 /*****************************************************************************
- * system_Destroy: free the program path.
+ * system_End: free the program path.
  *****************************************************************************/
-void system_Destroy( void )
+void system_End( void )
 {
     free( psz_program_path );
 }
index 7ae18bc..6ef1ebc 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Built-in and plugin modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.28 2001/05/01 04:18:18 sam Exp $
+ * $Id: modules.c,v 1.29 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -85,7 +85,7 @@ static int CallSymbol   ( module_t *, char * );
  * This function creates a module bank structure and fills it with the
  * built-in modules, as well as all the plugin modules it can find.
  *****************************************************************************/
-void module_InitBank( )
+void module_InitBank( void )
 {
 #ifdef HAVE_DYNAMIC_PLUGINS
     static char * path[] = { ".", "lib", PLUGIN_PATH, NULL, NULL };
@@ -102,13 +102,19 @@ void module_InitBank( )
     struct dirent * file;
 #endif /* HAVE_DYNAMIC_PLUGINS */
 
-    p_bank->first = NULL;
-    vlc_mutex_init( &p_bank->lock );
+    p_module_bank->first = NULL;
+    vlc_mutex_init( &p_module_bank->lock );
 
+    /*
+     * Check all the built-in modules
+     */
     intf_WarnMsg( 2, "module: checking built-in modules" );
 
     ALLOCATE_ALL_BUILTINS();
 
+    /*
+     * Check all the plugin modules we can find
+     */
 #ifdef HAVE_DYNAMIC_PLUGINS
     intf_WarnMsg( 2, "module: checking plugin modules" );
 
@@ -187,32 +193,32 @@ void module_InitBank( )
 }
 
 /*****************************************************************************
- * module_EndBank: destroy the module bank.
+ * module_EndBank: empty the module bank.
  *****************************************************************************
- * This function unloads all unused plugin modules and removes the module
+ * This function unloads all unused plugin modules and empties the module
  * bank in case of success.
  *****************************************************************************/
-void module_EndBank( )
+void module_EndBank( void )
 {
     module_t * p_next;
 
-    while( p_bank->first != NULL )
+    while( p_module_bank->first != NULL )
     {
-        if( DeleteModule( p_bank->first ) )
+        if( DeleteModule( p_module_bank->first ) )
         {
             /* Module deletion failed */
             intf_ErrMsg( "module error: `%s' can't be removed. trying harder.",
-                         p_bank->first->psz_name );
+                         p_module_bank->first->psz_name );
 
             /* We just free the module by hand. Niahahahahaha. */
-            p_next = p_bank->first->next;
-            free(p_bank->first);
-            p_bank->first = p_next;
+            p_next = p_module_bank->first->next;
+            free(p_module_bank->first);
+            p_module_bank->first = p_next;
         }
     }
 
     /* Destroy the lock */
-    vlc_mutex_destroy( &p_bank->lock );
+    vlc_mutex_destroy( &p_module_bank->lock );
 
     return;
 }
@@ -223,7 +229,7 @@ void module_EndBank( )
  * This function resets the module bank by unloading all unused plugin
  * modules.
  *****************************************************************************/
-void module_ResetBank( )
+void module_ResetBank( void )
 {
     intf_ErrMsg( "FIXME: module_ResetBank unimplemented" );
     return;
@@ -235,16 +241,16 @@ void module_ResetBank( )
  * This function parses the module bank and hides modules that have been
  * unused for a while.
  *****************************************************************************/
-void module_ManageBank( )
+void module_ManageBank( void )
 {
 #ifdef HAVE_DYNAMIC_PLUGINS
     module_t * p_module;
 
     /* We take the global lock */
-    vlc_mutex_lock( &p_bank->lock );
+    vlc_mutex_lock( &p_module_bank->lock );
 
     /* Parse the module list to see if any modules need to be unloaded */
-    for( p_module = p_bank->first ;
+    for( p_module = p_module_bank->first ;
          p_module != NULL ;
          p_module = p_module->next )
     {
@@ -268,7 +274,7 @@ void module_ManageBank( )
     }
 
     /* We release the global lock */
-    vlc_mutex_unlock( &p_bank->lock );
+    vlc_mutex_unlock( &p_module_bank->lock );
 #endif /* HAVE_DYNAMIC_PLUGINS */
 
     return;
@@ -287,10 +293,10 @@ module_t * module_Need( int i_capabilities, void *p_data )
     int i_index;
 
     /* We take the global lock */
-    vlc_mutex_lock( &p_bank->lock );
+    vlc_mutex_lock( &p_module_bank->lock );
 
     /* Parse the module list for capabilities and probe each of them */
-    for( p_module = p_bank->first ;
+    for( p_module = p_module_bank->first ;
          p_module != NULL ;
          p_module = p_module->next )
     {
@@ -342,7 +348,7 @@ module_t * module_Need( int i_capabilities, void *p_data )
     }
 
     /* We can release the global lock, module refcount was incremented */
-    vlc_mutex_unlock( &p_bank->lock );
+    vlc_mutex_unlock( &p_module_bank->lock );
 
     if( p_bestmodule != NULL )
     {
@@ -363,7 +369,7 @@ module_t * module_Need( int i_capabilities, void *p_data )
 void module_Unneed( module_t * p_module )
 {
     /* We take the global lock */
-    vlc_mutex_lock( &p_bank->lock );
+    vlc_mutex_lock( &p_module_bank->lock );
 
     /* Just unlock the module - we can't do anything if it fails,
      * so there is no need to check the return value. */
@@ -372,7 +378,7 @@ void module_Unneed( module_t * p_module )
     intf_WarnMsg( 3, "module: unlocking module `%s'", p_module->psz_name );
 
     /* We release the global lock */
-    vlc_mutex_unlock( &p_bank->lock );
+    vlc_mutex_unlock( &p_module_bank->lock );
 
     return;
 }
@@ -435,7 +441,7 @@ static int AllocatePluginModule( char * psz_filename )
     }
 
     /* Check that we don't already have a module with this name */
-    for( p_othermodule = p_bank->first ;
+    for( p_othermodule = p_module_bank->first ;
          p_othermodule != NULL ;
          p_othermodule = p_othermodule->next )
     {
@@ -485,13 +491,13 @@ static int AllocatePluginModule( char * psz_filename )
     p_module->b_builtin = 0;
 
     /* Link module into the linked list */
-    if( p_bank->first != NULL )
+    if( p_module_bank->first != NULL )
     {
-        p_bank->first->prev = p_module;
+        p_module_bank->first->prev = p_module;
     }
-    p_module->next = p_bank->first;
+    p_module->next = p_module_bank->first;
     p_module->prev = NULL;
-    p_bank->first = p_module;
+    p_module_bank->first = p_module;
 
     /* Immediate message so that a slow module doesn't make the user wait */
     intf_WarnMsgImm( 2, "module: plugin module `%s', %s",
@@ -541,7 +547,7 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ),
     }
 
     /* Check that we don't already have a module with this name */
-    for( p_othermodule = p_bank->first ;
+    for( p_othermodule = p_module_bank->first ;
          p_othermodule != NULL ;
          p_othermodule = p_othermodule->next )
     {
@@ -587,13 +593,13 @@ static int AllocateBuiltinModule( int ( *pf_init ) ( module_t * ),
     p_module->is.builtin.pf_deactivate = pf_deactivate;
 
     /* Link module into the linked list */
-    if( p_bank->first != NULL )
+    if( p_module_bank->first != NULL )
     {
-        p_bank->first->prev = p_module;
+        p_module_bank->first->prev = p_module;
     }
-    p_module->next = p_bank->first;
+    p_module->next = p_module_bank->first;
     p_module->prev = NULL;
-    p_bank->first = p_module;
+    p_module_bank->first = p_module;
 
     /* Immediate message so that a slow module doesn't make the user wait */
     intf_WarnMsgImm( 2, "module: builtin module `%s', %s",
@@ -650,9 +656,9 @@ static int DeleteModule( module_t * p_module )
 #endif
 
     /* Unlink the module from the linked list. */
-    if( p_module == p_bank->first )
+    if( p_module == p_module_bank->first )
     {
-        p_bank->first = p_module->next;
+        p_module_bank->first = p_module->next;
     }
 
     if( p_module->prev != NULL )
index 0079117..95dbb00 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.c : spu decoder thread
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: spu_decoder.c,v 1.39 2001/05/01 12:22:18 sam Exp $
+ * $Id: spu_decoder.c,v 1.40 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -89,24 +89,44 @@ vlc_thread_t spudec_CreateThread( vdec_config_t * p_config )
     p_spudec->p_fifo = p_config->decoder_config.p_decoder_fifo;
 
     /* XXX: The vout request and fifo opening will eventually be here */
-    if( p_spudec->p_vout == NULL )
+
+    /* Spawn an audio output if there is none */
+    vlc_mutex_lock( &p_vout_bank->lock );
+
+    if( p_vout_bank->i_count == 0 )
     {
-        if( p_main->p_vout == NULL )
+        intf_Msg( "spudec: no vout present, spawning one" );
+
+        p_spudec->p_vout = vout_CreateThread( NULL );
+
+        /* Everything failed */
+        if( p_spudec->p_vout == NULL )
         {
-            intf_Msg( "vpar: no vout present, spawning one" );
-            p_main->p_vout = vout_CreateThread( NULL );
+            intf_Msg( "spudec: can't open vout, aborting" );
+            vlc_mutex_unlock( &p_vout_bank->lock );
+            free( p_spudec );
+
+            return 0;
         }
 
-        p_spudec->p_vout = p_main->p_vout;
+        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 ];
     }
 
+    vlc_mutex_unlock( &p_vout_bank->lock );
+
     /* Spawn the spu decoder thread */
     if ( vlc_thread_create(&p_spudec->thread_id, "spu decoder",
          (vlc_thread_func_t)RunThread, (void *)p_spudec) )
     {
         intf_ErrMsg( "spudec error: can't spawn spu decoder thread" );
         free( p_spudec );
-        return( 0 );
+        return 0;
     }
 
     return( p_spudec->thread_id );
diff --git a/src/video_decoder/vdec_idct.h b/src/video_decoder/vdec_idct.h
deleted file mode 100644 (file)
index 7127b6d..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*****************************************************************************
- * vdec_idct.h : types for the inverse discrete cosine transform
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vdec_idct.h,v 1.4 2001/01/17 18:17:30 massiot Exp $
- *
- * Authors: Gaël Hendryckx <jimmy@via.ecp.fr>
- *          Christophe Massiot <massiot@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, USA.
- *****************************************************************************/
-
-struct vdec_thread_s;
-
-typedef void ( *idct_init_t )   ( struct vdec_thread_s * );
-typedef void ( *f_idct_t )      ( struct vdec_thread_s *, dctelem_t*, int );
-typedef void ( *norm_scan_t )   ( u8 ppi_scan[2][64] );
index 34df5a8..22e418c 100644 (file)
@@ -2,7 +2,7 @@
  * video_decoder.c : video decoder thread
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_decoder.c,v 1.48 2001/04/06 09:15:48 sam Exp $
+ * $Id: video_decoder.c,v 1.49 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Gaël Hendryckx <jimmy@via.ecp.fr>
@@ -47,7 +47,6 @@
 #include "video_output.h"
 
 #include "vdec_motion.h"
-#include "vdec_idct.h"
 #include "video_decoder.h"
 
 #include "vpar_blocks.h"
@@ -152,28 +151,13 @@ static int vdec_InitThread( vdec_thread_t *p_vdec )
 int vdec_InitThread( vdec_thread_t *p_vdec )
 #endif
 {
-#ifndef HAVE_MMX
-    int i_dummy;
-#endif
-
     intf_DbgMsg("vdec debug: initializing video decoder thread %p", p_vdec);
 
-#ifndef HAVE_MMX
-    /* Init crop table */
-    p_vdec->pi_crop = p_vdec->pi_crop_buf + (VDEC_CROPRANGE >> 1);
-    for( i_dummy = -(VDEC_CROPRANGE >> 1); i_dummy < 0; i_dummy++ )
-    {
-        p_vdec->pi_crop[i_dummy] = 0;
-    }
-    for( ; i_dummy < 255; i_dummy ++ )
-    {
-        p_vdec->pi_crop[i_dummy] = i_dummy;
-    }
-    for( ; i_dummy < (VDEC_CROPRANGE >> 1) -1; i_dummy++ )
-    {
-        p_vdec->pi_crop[i_dummy] = 255;
-    }
-#endif
+    p_vdec->pf_vdec_init    = p_vdec->p_vpar->pf_vdec_init;
+    p_vdec->pf_decode_mb_c  = p_vdec->p_vpar->pf_decode_mb_c;
+    p_vdec->pf_decode_mb_bw = p_vdec->p_vpar->pf_decode_mb_bw;
+
+    p_vdec->pf_vdec_init( p_vdec );
 
 #ifdef VDEC_SMP
     /* Re-nice ourself */
@@ -219,327 +203,6 @@ static void EndThread( vdec_thread_t *p_vdec )
     intf_DbgMsg("vdec debug: EndThread(%p)", p_vdec);
 }
 
-/*****************************************************************************
- * AddBlock : add a block
- *****************************************************************************/
-#ifndef HAVE_MMX
-static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                                 yuv_data_t * p_data, int i_incr )
-{
-    int i_x, i_y;
-
-    for( i_y = 0; i_y < 8; i_y++ )
-    {
-        for( i_x = 0; i_x < 8; i_x++ )
-        {
-            *p_data = p_vdec->pi_crop[*p_data + *p_block++];
-            p_data++;
-        }
-        p_data += i_incr;
-    }
-}
-#else
-static __inline__ void AddBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                                 yuv_data_t * p_data, int i_incr )
-{
-    asm __volatile__ ( 
-            "pxor       %%mm7,%%mm7\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      (%2),%%mm2\n\t"
-            "paddw      8(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      16(%2),%%mm2\n\t"
-            "paddw      24(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      32(%2),%%mm2\n\t"
-            "paddw      40(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      48(%2),%%mm2\n\t"
-            "paddw      56(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      64(%2),%%mm2\n\t"
-            "paddw      72(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      80(%2),%%mm2\n\t"
-            "paddw      88(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      96(%2),%%mm2\n\t"
-            "paddw      104(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-            "addl       %3,%0\n\t"
-
-            "movq       (%0),%%mm1\n\t"
-            "movq       %%mm1,%%mm2\n\t"
-            "punpckhbw  %%mm7,%%mm1\n\t"
-            "punpcklbw  %%mm7,%%mm2\n\t"
-            "paddw      112(%2),%%mm2\n\t"
-            "paddw      120(%2),%%mm1\n\t"
-            "packuswb   %%mm1,%%mm2\n\t"
-            "movq       %%mm2,(%0)\n\t"
-
-            //"emms"
-            : "=r" (p_data)
-            : "0" (p_data), "r" (p_block), "r" (i_incr + 8) );
-}
-#endif
-
-
-/*****************************************************************************
- * CopyBlock : copy a block
- *****************************************************************************/
-#ifndef HAVE_MMX
-static __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                                  yuv_data_t * p_data, int i_incr )
-{
-    int i_x, i_y;
-
-    for( i_y = 0; i_y < 8; i_y++ )
-    {
-        for( i_x = 0; i_x < 8; i_x++ )
-        {
-            *p_data++ = p_vdec->pi_crop[*p_block++];
-        }
-        p_data += i_incr;
-    }
-}
-#else
-static  __inline__ void CopyBlock( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                                   yuv_data_t * p_data, int i_incr )
-{
-    asm __volatile__ (
-            "movq         (%2),%%mm0\n\t"
-            "packuswb   8(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        16(%2),%%mm0\n\t"
-            "packuswb   24(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        32(%2),%%mm0\n\t"
-            "packuswb   40(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        48(%2),%%mm0\n\t"
-            "packuswb   56(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        64(%2),%%mm0\n\t"
-            "packuswb   72(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        80(%2),%%mm0\n\t"
-            "packuswb   88(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        96(%2),%%mm0\n\t"
-            "packuswb   104(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-            "addl           %3,%0\n\t"
-
-            "movq        112(%2),%%mm0\n\t"
-            "packuswb   120(%2),%%mm0\n\t"
-            "movq        %%mm0,(%0)\n\t"
-
-            //"emms"
-            : "=r" (p_data)
-            : "0" (p_data), "r" (p_block), "r" (i_incr + 8) );
-}
-#endif
-
-
-/*****************************************************************************
- * vdec_DecodeMacroblock : decode a macroblock of a picture
- *****************************************************************************/
-#define DECODEBLOCKSC( OPBLOCK )                                        \
-{                                                                       \
-    int             i_b, i_mask;                                        \
-                                                                        \
-    i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
-                                                                        \
-    /* luminance */                                                     \
-    for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
-    {                                                                   \
-        if( p_mb->i_coded_block_pattern & i_mask )                      \
-        {                                                               \
-            /*                                                          \
-             * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
-             */                                                         \
-            (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
-                                  p_mb->pi_sparse_pos[i_b] );           \
-                                                                        \
-            /*                                                          \
-             * Adding prediction and coefficient data (ISO/IEC 13818-2  \
-             * section 7.6.8)                                           \
-             */                                                         \
-            OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
-                     p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
-        }                                                               \
-    }                                                                   \
-                                                                        \
-    /* chrominance */                                                   \
-    for( i_b = 4; i_b < 4 + p_mb->i_chroma_nb_blocks;                   \
-         i_b++, i_mask >>= 1 )                                          \
-    {                                                                   \
-        if( p_mb->i_coded_block_pattern & i_mask )                      \
-        {                                                               \
-            /*                                                          \
-             * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
-             */                                                         \
-            (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
-                                  p_mb->pi_sparse_pos[i_b] );           \
-                                                                        \
-            /*                                                          \
-             * Adding prediction and coefficient data (ISO/IEC 13818-2  \
-             * section 7.6.8)                                           \
-             */                                                         \
-            OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
-                     p_mb->p_data[i_b], p_mb->i_addb_c_stride );        \
-        }                                                               \
-    }                                                                   \
-}
-
-#define DECODEBLOCKSBW( OPBLOCK )                                       \
-{                                                                       \
-    int             i_b, i_mask;                                        \
-                                                                        \
-    i_mask = 1 << (3 + p_mb->i_chroma_nb_blocks);                       \
-                                                                        \
-    /* luminance */                                                     \
-    for( i_b = 0; i_b < 4; i_b++, i_mask >>= 1 )                        \
-    {                                                                   \
-        if( p_mb->i_coded_block_pattern & i_mask )                      \
-        {                                                               \
-            /*                                                          \
-             * Inverse DCT (ISO/IEC 13818-2 section Annex A)            \
-             */                                                         \
-            (p_mb->pf_idct[i_b])( p_vdec, p_mb->ppi_blocks[i_b],        \
-                                  p_mb->pi_sparse_pos[i_b] );           \
-                                                                        \
-            /*                                                          \
-             * Adding prediction and coefficient data (ISO/IEC 13818-2  \
-             * section 7.6.8)                                           \
-             */                                                         \
-            OPBLOCK( p_vdec, p_mb->ppi_blocks[i_b],                     \
-                     p_mb->p_data[i_b], p_mb->i_addb_l_stride );        \
-        }                                                               \
-    }                                                                   \
-}
-
-void vdec_DecodeMacroblockC ( vdec_thread_t *p_vdec, macroblock_t * p_mb )
-{
-    if( !(p_mb->i_mb_type & MB_INTRA) )
-    {
-        /*
-         * Motion Compensation (ISO/IEC 13818-2 section 7.6)
-         */
-        if( p_mb->pf_motion == 0 )
-        {
-            intf_WarnMsg( 2, "pf_motion set to NULL" );
-        }
-        else
-        {
-            p_mb->pf_motion( p_mb );
-        }
-
-        DECODEBLOCKSC( AddBlock )
-    }
-    else
-    {
-        DECODEBLOCKSC( CopyBlock )
-    }
-
-    /*
-     * Decoding is finished, release the macroblock and free
-     * unneeded memory.
-     */
-    vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
-}
-
-void vdec_DecodeMacroblockBW ( vdec_thread_t *p_vdec, macroblock_t * p_mb )
-{
-    if( !(p_mb->i_mb_type & MB_INTRA) )
-    {
-        /*
-         * Motion Compensation (ISO/IEC 13818-2 section 7.6)
-         */
-        if( p_mb->pf_motion == 0 )
-        {
-            intf_WarnMsg( 2, "pf_motion set to NULL" );
-        }
-        else
-        {
-            p_mb->pf_motion( p_mb );
-        }
-
-        DECODEBLOCKSBW( AddBlock )
-    }
-    else
-    {
-        DECODEBLOCKSBW( CopyBlock )
-    }
-
-    /*
-     * Decoding is finished, release the macroblock and free
-     * unneeded memory.
-     */
-    vpar_ReleaseMacroblock( &p_vdec->p_vpar->vfifo, p_mb );
-}
-
-
-
 /*****************************************************************************
  * RunThread: video decoder thread
  *****************************************************************************
@@ -571,7 +234,7 @@ static void RunThread( vdec_thread_t *p_vdec )
 
         if( (p_mb = vpar_GetMacroblock( &p_vdec->p_vpar->vfifo )) != NULL )
         {
-            vdec_DecodeMacroblockC ( p_vdec, p_mb );
+            p_vdec->pf_decode_mb_c( p_vdec, p_mb );
         }
     }
 
@@ -587,3 +250,4 @@ static void RunThread( vdec_thread_t *p_vdec )
     EndThread( p_vdec );
     p_vdec->b_run = 0;
 }
+
diff --git a/src/video_decoder/video_fifo.h b/src/video_decoder/video_fifo.h
deleted file mode 100644 (file)
index 3133bb4..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-/*****************************************************************************
- * video_fifo.h : FIFO for the pool of video_decoders
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_fifo.h,v 1.4 2001/02/23 14:07:25 massiot Exp $
- *
- * Authors: Christophe Massiot <massiot@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, USA.
- *****************************************************************************/
-/*****************************************************************************
- * Requires:
- *  "config.h"
- *  "common.h"
- *  "threads.h"
- *  "video_parser.h"
- *  "undec_picture.h"
- *****************************************************************************/
-
-/*****************************************************************************
- * Macros
- *****************************************************************************/
-
-#ifdef VDEC_SMP
-/* FIXME: move to inline functions ??*/
-#define VIDEO_FIFO_ISEMPTY( fifo )    ( (fifo).i_start == (fifo).i_end )
-#define VIDEO_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start )\
-                                          & VFIFO_SIZE ) == 0 )
-#define VIDEO_FIFO_START( fifo )      ( (fifo).buffer[ (fifo).i_start ] )
-#define VIDEO_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1) \
-                                                           & VFIFO_SIZE )
-#define VIDEO_FIFO_END( fifo )        ( (fifo).buffer[ (fifo).i_end ] )
-#define VIDEO_FIFO_INCEND( fifo )     ( (fifo).i_end = ((fifo).i_end + 1) \
-                                                         & VFIFO_SIZE )
-#endif
-
-/*****************************************************************************
- * vpar_GetMacroblock : return a macroblock to be decoded
- *****************************************************************************/
-static __inline__ macroblock_t * vpar_GetMacroblock( video_fifo_t * p_fifo )
-{
-#ifdef VDEC_SMP
-    macroblock_t *      p_mb;
-
-    vlc_mutex_lock( &p_fifo->lock );
-    while( VIDEO_FIFO_ISEMPTY( *p_fifo ) )
-    {
-        vlc_cond_wait( &p_fifo->wait, &p_fifo->lock );
-        if( p_fifo->p_vpar->p_fifo->b_die )
-        {
-            vlc_mutex_unlock( &p_fifo->lock );
-            return( NULL );
-        }
-    }
-
-    p_mb = VIDEO_FIFO_START( *p_fifo );
-    VIDEO_FIFO_INCSTART( *p_fifo );
-
-    vlc_mutex_unlock( &p_fifo->lock );
-
-    return( p_mb );
-#else
-    /* Shouldn't normally be used without SMP. */
-    return NULL;
-#endif
-}
-
-/*****************************************************************************
- * vpar_NewMacroblock : return a buffer for the parser
- *****************************************************************************/
-static __inline__ macroblock_t * vpar_NewMacroblock( video_fifo_t * p_fifo )
-{
-#ifdef VDEC_SMP
-    macroblock_t *      p_mb;
-
-#define P_buffer p_fifo->p_vpar->vbuffer
-    vlc_mutex_lock( &P_buffer.lock );
-    while( P_buffer.i_index == -1 )
-    {
-        /* No more structures available. This should not happen ! */
-        intf_DbgMsg("vpar debug: macroblock list is empty, delaying");
-        vlc_mutex_unlock( &P_buffer.lock );
-        if( p_fifo->p_vpar->p_fifo->b_die )
-        {
-            return( NULL );
-        }
-        msleep(VPAR_OUTMEM_SLEEP);
-        vlc_mutex_lock( &P_buffer.lock );
-    }
-
-    p_mb = P_buffer.pp_mb_free[ P_buffer.i_index-- ];
-
-    vlc_mutex_unlock( &P_buffer.lock );
-#undef P_buffer
-    return( p_mb );
-#else
-    return( &p_fifo->buffer );
-#endif
-}
-
-/*****************************************************************************
- * vpar_DecodeMacroblock : put a macroblock in the video fifo
- *****************************************************************************/
-static __inline__ void vpar_DecodeMacroblock( video_fifo_t * p_fifo,
-                                              macroblock_t * p_mb )
-{
-#ifdef VDEC_SMP
-    /* Place picture in the video FIFO */
-    vlc_mutex_lock( &p_fifo->lock );
-
-    /* By construction, the video FIFO cannot be full */
-    VIDEO_FIFO_END( *p_fifo ) = p_mb;
-    VIDEO_FIFO_INCEND( *p_fifo );
-
-    vlc_mutex_unlock( &p_fifo->lock );
-#else
-    vdec_DecodeMacroblockC( p_fifo->p_vpar->pp_vdec[0], p_mb );
-#endif
-}
-
-/*****************************************************************************
- * vpar_ReleaseMacroblock : release a macroblock and put the picture in the
- *                          video output heap, if it is finished
- *****************************************************************************/
-static __inline__ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo,
-                                               macroblock_t * p_mb )
-{
-#ifdef VDEC_SMP
-    boolean_t      b_finished;
-
-    /* Unlink picture buffer */
-    vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
-    p_mb->p_picture->i_deccount--;
-    b_finished = (p_mb->p_picture->i_deccount == 1);
-    vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
-//intf_DbgMsg( "%d ", p_mb->p_picture->i_deccount );
-    /* Test if it was the last block of the picture */
-    if( b_finished )
-    {
-//intf_DbgMsg( "Image decodee" );
-        /* Mark the picture to be displayed */
-        vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
-
-        /* Warn Synchro for its records. */
-        vpar_SynchroEnd( p_fifo->p_vpar, 0 );
-
-        /* Unlink referenced pictures */
-        if( p_mb->p_forward != NULL )
-        {
-            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
-        }
-        if( p_mb->p_backward != NULL )
-        {
-            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
-        }
-    }
-
-    /* Release the macroblock_t structure */
-#define P_buffer p_fifo->p_vpar->vbuffer
-    vlc_mutex_lock( &P_buffer.lock );
-    P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb;
-    vlc_mutex_unlock( &P_buffer.lock );
-#undef P_buffer
-
-#else
-    p_mb->p_picture->i_deccount--;
-    if( p_mb->p_picture->i_deccount == 1 )
-    {
-        /* Mark the picture to be displayed */
-        vout_DisplayPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
-
-        /* Warn Synchro for its records. */
-        vpar_SynchroEnd( p_fifo->p_vpar, 0 );
-    }
-#endif
-}
-
-/*****************************************************************************
- * vpar_DestroyMacroblock : destroy a macroblock in case of error
- *****************************************************************************/
-static __inline__ void vpar_DestroyMacroblock( video_fifo_t * p_fifo,
-                                               macroblock_t * p_mb )
-{
-#ifdef VDEC_SMP
-    boolean_t       b_finished;
-
-    /* Unlink picture buffer */
-    vlc_mutex_lock( &p_mb->p_picture->lock_deccount );
-    p_mb->p_picture->i_deccount--;
-    b_finished = (p_mb->p_picture->i_deccount == 1);
-    vlc_mutex_unlock( &p_mb->p_picture->lock_deccount );
-
-    /* Test if it was the last block of the picture */
-    if( b_finished )
-    {
-        intf_DbgMsg( "Image trashee" );
-        /* Mark the picture to be trashed */
-        vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
-
-        /* Warn Synchro for its records. */
-        vpar_SynchroEnd( p_fifo->p_vpar, 1 );
-
-        /* Unlink referenced pictures */
-        if( p_mb->p_forward != NULL )
-        {
-            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
-        }
-        if( p_mb->p_backward != NULL )
-        {
-            vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_backward );
-        }
-    }
-
-    /* Release the macroblock_t structure */
-#define P_buffer p_fifo->p_vpar->vbuffer
-    vlc_mutex_lock( &P_buffer.lock );
-    P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb;
-    vlc_mutex_unlock( &P_buffer.lock );
-#undef P_buffer
-
-#else
-    p_mb->p_picture->i_deccount--;
-    if( p_mb->p_picture->i_deccount == 1 )
-    {
-        /* Mark the picture to be trashed */
-        vout_DestroyPicture( p_fifo->p_vpar->p_vout, p_mb->p_picture );
-
-        /* Warn Synchro for its records. */
-        vpar_SynchroEnd( p_fifo->p_vpar, 1 );
-    }
-#endif
-}
-
-/*****************************************************************************
- * vpar_FreeMacroblock : destroy a macroblock in case of error, without
- * updating the macroblock counters
- *****************************************************************************/
-static __inline__ void vpar_FreeMacroblock( video_fifo_t * p_fifo,
-                                            macroblock_t * p_mb )
-{
-#ifdef VDEC_SMP
-    /* Release the macroblock_t structure */
-#define P_buffer p_fifo->p_vpar->vbuffer
-    vlc_mutex_lock( &P_buffer.lock );
-    P_buffer.pp_mb_free[ ++P_buffer.i_index ] = p_mb;
-    vlc_mutex_unlock( &P_buffer.lock );
-#undef P_buffer
-
-#else
-    ;
-#endif
-}
-/*****************************************************************************
- * Prototypes
- *****************************************************************************/
-void vpar_InitFIFO( struct vpar_thread_s * p_vpar );
diff --git a/src/video_decoder/video_parser.h b/src/video_decoder/video_parser.h
deleted file mode 100644 (file)
index f754f19..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-/*****************************************************************************
- * video_parser.h : video parser thread
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_parser.h,v 1.8 2001/01/24 19:05:55 massiot Exp $
- *
- * Authors: Christophe Massiot <massiot@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, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Requires:
- *  "config.h"
- *  "common.h"
- *  "mtime.h"
- *  "threads.h"
- *  "input.h"
- *  "video.h"
- *  "video_output.h"
- *  "decoder_fifo.h"
- *  "video_fifo.h"
- *  "vpar_headers.h"
- *****************************************************************************/
-
-/*****************************************************************************
- * video_fifo_t
- *****************************************************************************
- * This rotative FIFO contains undecoded macroblocks that are to be decoded
- *****************************************************************************/
-struct vpar_thread_s;
-
-typedef struct video_fifo_s
-{
-#ifdef VDEC_SMP
-    vlc_mutex_t         lock;                              /* fifo data lock */
-    vlc_cond_t          wait;              /* fifo data conditional variable */
-
-    /* buffer is an array of undec_picture_t pointers */
-    macroblock_t *      buffer[VFIFO_SIZE + 1];
-    int                 i_start;
-    int                 i_end;
-#else
-    macroblock_t        buffer;
-#endif
-
-    struct vpar_thread_s *      p_vpar;
-} video_fifo_t;
-
-/*****************************************************************************
- * video_buffer_t
- *****************************************************************************
- * This structure enables the parser to maintain a list of free
- * macroblock_t structures
- *****************************************************************************/
-#ifdef VDEC_SMP
-typedef struct video_buffer_s
-{
-    vlc_mutex_t         lock;                            /* buffer data lock */
-
-    macroblock_t        p_macroblocks[VFIFO_SIZE + 1];
-    macroblock_t *      pp_mb_free[VFIFO_SIZE+1];          /* this is a LIFO */
-    int                 i_index;
-} video_buffer_t;
-#endif
-
-/*****************************************************************************
- * vpar_thread_t: video parser thread descriptor
- *****************************************************************************
- * XXX??
- *****************************************************************************/
-typedef struct vpar_thread_s
-{
-    bit_stream_t        bit_stream;
-
-    /* Thread properties and locks */
-    vlc_thread_t        thread_id;                /* id for thread functions */
-
-    /* Thread configuration */
-    /* XXX?? */
-//    int *pi_status;
-
-
-    /* Input properties */
-    decoder_fifo_t *    p_fifo;                            /* PES input fifo */
-    vdec_config_t *     p_config;
-
-    /* Output properties */
-    vout_thread_t *     p_vout;                       /* video output thread */
-
-    /* Decoder properties */
-    struct vdec_thread_s *      pp_vdec[NB_VDEC];
-    video_fifo_t                vfifo;
-#ifdef VDEC_SMP
-    video_buffer_t              vbuffer;
-#endif
-
-    /* Parser properties */
-    sequence_t              sequence;
-    picture_parsing_t       picture;
-    macroblock_parsing_t    mb;
-    video_synchro_t         synchro;
-
-    /* Lookup tables */
-    lookup_t                pl_mb_addr_inc[2048];    /* for macroblock
-                                                        address increment */
-    /* tables for macroblock types 0=P 1=B */
-    lookup_t                ppl_mb_type[2][64];
-    /* table for coded_block_pattern */
-    lookup_t *              pl_coded_pattern;
-    /* variable length codes for the structure dct_dc_size for intra blocks */
-    lookup_t *              pppl_dct_dc_size[2][2];
-    /* Structure to store the tables B14 & B15 (ISO/IEC 13818-2 B.4) */
-    dct_lookup_t            ppl_dct_coef[2][16384];
-    /* Scan table */
-    u8                      ppi_scan[2][64];
-    /* Default quantization matrices */
-    u8                      pi_default_intra_quant[64];
-    u8                      pi_default_nonintra_quant[64];
-
-    /* Motion compensation plugin used and shortcuts */
-    struct module_s *       p_motion_module;
-    void ( * pppf_motion[4][2][4] )     ( struct macroblock_s * );
-    void ( * ppf_motion_skipped[4][4] ) ( struct macroblock_s * );
-
-    /* IDCT plugin used and shortcuts to access its capabilities */
-    struct module_s *       p_idct_module;
-    idct_init_t             pf_init;
-    f_idct_t                pf_sparse_idct;
-    f_idct_t                pf_idct;
-    norm_scan_t             pf_norm_scan;
-
-#ifdef STATS
-    /* Statistics */
-    count_t         c_loops;                              /* number of loops */
-    count_t         c_sequences;                      /* number of sequences */
-    count_t         pc_pictures[4]; /* number of (coding_type) pictures read */
-    count_t         pc_decoded_pictures[4];       /* number of (coding_type)
-                                                   *        pictures decoded */
-    count_t         pc_malformed_pictures[4];  /* number of pictures trashed
-                                                * during parsing             */
-#endif
-} vpar_thread_t;
-
-/*****************************************************************************
- * Prototypes
- *****************************************************************************/
-
-/* Thread management functions */
-vlc_thread_t vpar_CreateThread       ( vdec_config_t * );
-
-/*****************************************************************************
- * NextStartCode : Find the next start code
- *****************************************************************************/
-static __inline__ void NextStartCode( bit_stream_t * p_bit_stream )
-{
-    /* Re-align the buffer on an 8-bit boundary */
-    RealignBits( p_bit_stream );
-
-    while( ShowBits( p_bit_stream, 24 ) != 0x01L
-            && !p_bit_stream->p_decoder_fifo->b_die )
-    {
-        RemoveBits( p_bit_stream, 8 );
-    }
-}
-
-/*****************************************************************************
- * LoadQuantizerScale
- *****************************************************************************
- * Quantizer scale factor (ISO/IEC 13818-2 7.4.2.2)
- *****************************************************************************/
-static __inline__ void LoadQuantizerScale( struct vpar_thread_s * p_vpar )
-{
-    /* Quantization coefficient table */
-    static u8   ppi_quantizer_scale[3][32] =
-    {
-        /* MPEG-2 */
-        {
-            /* q_scale_type */
-            /* linear */
-            0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,
-            32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
-        },
-        {
-            /* non-linear */
-            0, 1, 2, 3, 4, 5, 6, 7, 8, 10,12,14,16,18,20, 22,
-            24,28,32,36,40,44,48,52,56,64,72,80,88,96,104,112
-        },
-        /* MPEG-1 */
-        {
-            0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-            16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
-        }
-    };
-
-    p_vpar->mb.i_quantizer_scale = ppi_quantizer_scale
-           [(!p_vpar->sequence.b_mpeg2 << 1) | p_vpar->picture.b_q_scale_type]
-           [GetBits( &p_vpar->bit_stream, 5 )];
-}
-
diff --git a/src/video_decoder/vpar_headers.h b/src/video_decoder/vpar_headers.h
deleted file mode 100644 (file)
index 458fb72..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-/*****************************************************************************
- * vpar_headers.h : video parser : headers parsing
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_headers.h,v 1.6 2001/02/13 13:01:14 massiot Exp $
- *
- * Authors: Christophe Massiot <massiot@via.ecp.fr>
- *          Stéphane Borel <stef@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, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Requires:
- *  "config.h"
- *  "common.h"
- *  "mtime.h"
- *  "threads.h"
- *  "input.h"
- *  "video.h"
- *  "video_output.h"
- *  "decoder_fifo.h"
- *  "video_fifo.h"
- *****************************************************************************/
-
-/*****************************************************************************
- * quant_matrix_t : Quantization Matrix
- *****************************************************************************/
-typedef struct quant_matrix_s
-{
-    u8 *        pi_matrix;
-    boolean_t   b_allocated;
-                          /* Has the matrix been allocated by vpar_headers ? */
-} quant_matrix_t;
-
-/*****************************************************************************
- * sequence_t : sequence descriptor
- *****************************************************************************
- * This structure should only be changed when reading the sequence header,
- * or exceptionnally some extension structures (like quant_matrix).
- *****************************************************************************/
-typedef struct sequence_s
-{
-    u32                 i_height, i_width;      /* height and width of the lum
-                                                 * comp of the picture       */
-    u32                 i_size;       /* total number of pel of the lum comp */
-    u32                 i_mb_height, i_mb_width, i_mb_size;
-                                            /* the same, in macroblock units */
-    unsigned int        i_aspect_ratio;        /* height/width display ratio */
-    unsigned int        i_matrix_coefficients;/* coeffs of the YUV transform */
-    int                 i_frame_rate;  /* theoritical frame rate in fps*1001 */
-    boolean_t           b_mpeg2;                                    /* guess */
-    boolean_t           b_progressive;              /* progressive (ie.
-                                                     * non-interlaced) frame */
-    unsigned int        i_scalable_mode; /* scalability ; unsupported, but
-                                          * modifies the syntax of the binary
-                                          * stream.                          */
-    quant_matrix_t      intra_quant, nonintra_quant;
-    quant_matrix_t      chroma_intra_quant, chroma_nonintra_quant;
-                                            /* current quantization matrices */
-
-    /* Chromatic information */
-    unsigned int        i_chroma_format;               /* see CHROMA_* below */
-    int                 i_chroma_nb_blocks;       /* number of chroma blocks */
-    u32                 i_chroma_width;/* width of a line of the chroma comp */
-    u32                 i_chroma_mb_width, i_chroma_mb_height;
-                                 /* size of a macroblock in the chroma buffer
-                                  * (eg. 8x8 or 8x16 or 16x16)               */
-
-    /* Parser context */
-    picture_t *         p_forward;        /* current forward reference frame */
-    picture_t *         p_backward;      /* current backward reference frame */
-    mtime_t             next_pts, next_dts;
-    int                 i_current_rate;
-    boolean_t           b_expect_discontinuity; /* reset the frame predictors
-                                                 * after the current frame   */
-
-    /* Copyright extension */
-    boolean_t           b_copyright_flag;     /* Whether the following
-                                                 information is significant
-                                                 or not. */
-    u8                  i_copyright_id;
-    boolean_t           b_original;
-    u64                 i_copyright_nb;
-} sequence_t;
-
-/*****************************************************************************
- * picture_parsing_t : parser context descriptor
- *****************************************************************************
- * This structure should only be changed when reading the picture header.
- *****************************************************************************/
-typedef struct picture_parsing_s
-{
-    /* ISO/CEI 11172-2 backward compatibility */
-    boolean_t           pb_full_pel_vector[2];
-    int                 i_forward_f_code, i_backward_f_code;
-
-    /* Values from the picture_coding_extension. Please refer to ISO/IEC
-     * 13818-2. */
-    int                 ppi_f_code[2][2];
-    int                 i_intra_dc_precision;
-    boolean_t           b_frame_pred_frame_dct, b_q_scale_type;
-    boolean_t           b_intra_vlc_format;
-    boolean_t           b_alternate_scan, b_progressive;
-    boolean_t           b_top_field_first, b_concealment_mv;
-    boolean_t           b_repeat_first_field;
-    /* Relative to the current field */
-    int                 i_coding_type, i_structure;
-    boolean_t           b_frame_structure; /* i_structure == FRAME_STRUCTURE */
-
-    picture_t *         p_picture;               /* picture buffer from vout */
-    int                 i_current_structure;   /* current parsed structure of
-                                                * p_picture (second field ?) */
-#ifdef VDEC_SMP
-    macroblock_t *      pp_mb[MAX_MB];         /* macroblock buffer to
-                                                * send to the vdec thread(s) */
-#endif
-    boolean_t           b_error;            /* parsing error, try to recover */
-
-    int                 i_l_stride, i_c_stride;
-                                    /* number of coeffs to jump when changing
-                                     * lines (different with field pictures) */
-} picture_parsing_t;
-
-/*****************************************************************************
- * Standard codes
- *****************************************************************************/
-#define PICTURE_START_CODE      0x100L
-#define SLICE_START_CODE_MIN    0x101L
-#define SLICE_START_CODE_MAX    0x1AFL
-#define USER_DATA_START_CODE    0x1B2L
-#define SEQUENCE_HEADER_CODE    0x1B3L
-#define SEQUENCE_ERROR_CODE     0x1B4L
-#define EXTENSION_START_CODE    0x1B5L
-#define SEQUENCE_END_CODE       0x1B7L
-#define GROUP_START_CODE        0x1B8L
-
-/* extension start code IDs */
-#define SEQUENCE_EXTENSION_ID                    1
-#define SEQUENCE_DISPLAY_EXTENSION_ID            2
-#define QUANT_MATRIX_EXTENSION_ID                3
-#define COPYRIGHT_EXTENSION_ID                   4
-#define SEQUENCE_SCALABLE_EXTENSION_ID           5
-#define PICTURE_DISPLAY_EXTENSION_ID             7
-#define PICTURE_CODING_EXTENSION_ID              8
-#define PICTURE_SPATIAL_SCALABLE_EXTENSION_ID    9
-#define PICTURE_TEMPORAL_SCALABLE_EXTENSION_ID  10
-
-/* scalable modes */
-#define SC_NONE     0
-#define SC_DP       1
-#define SC_SPAT     2
-#define SC_SNR      3
-#define SC_TEMP     4
-
-/* Chroma types */
-#define CHROMA_420 1
-#define CHROMA_422 2
-#define CHROMA_444 3
-
-/* Pictures types */
-#define I_CODING_TYPE           1
-#define P_CODING_TYPE           2
-#define B_CODING_TYPE           3
-#define D_CODING_TYPE           4 /* MPEG-1 ONLY */
-/* other values are reserved */
-
-/* Structures */
-#define TOP_FIELD               1
-#define BOTTOM_FIELD            2
-#define FRAME_STRUCTURE         3
-
-/*****************************************************************************
- * Prototypes
- *****************************************************************************/
-int vpar_NextSequenceHeader( struct vpar_thread_s * p_vpar );
-int vpar_ParseHeader( struct vpar_thread_s * p_vpar );
diff --git a/src/video_decoder/vpar_synchro.h b/src/video_decoder/vpar_synchro.h
deleted file mode 100644 (file)
index 263b62a..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*****************************************************************************
- * vpar_synchro.h : video parser blocks management
- *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_synchro.h,v 1.8 2001/03/06 15:16:42 massiot Exp $
- *
- * Author: Christophe Massiot <massiot@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, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Requires:
- *  "config.h"
- *  "common.h"
- *  "mtime.h"
- *  "threads.h"
- *  "input.h"
- *  "video.h"
- *  "video_output.h"
- *  "decoder_fifo.h"
- *  "video_fifo.h"
- *****************************************************************************/
-
-/*****************************************************************************
- * video_synchro_t and video_synchro_tab_s : timers for the video synchro
- *****************************************************************************/
-#define MAX_DECODING_PIC        16
-#define MAX_PIC_AVERAGE         8
-
-/* Read the discussion on top of vpar_synchro.c for more information. */
-typedef struct video_synchro_s
-{
-    /* synchro algorithm */
-    int             i_type;
-
-    /* fifo containing decoding dates */
-    mtime_t         p_date_fifo[MAX_DECODING_PIC];
-    int             pi_coding_types[MAX_DECODING_PIC];
-    unsigned int    i_start, i_end;
-    vlc_mutex_t     fifo_lock;
-
-    /* stream properties */
-    unsigned int    i_n_p, i_n_b;
-
-    /* decoding values */
-    mtime_t         p_tau[4];                  /* average decoding durations */
-    unsigned int    pi_meaningful[4];            /* number of durations read */
-    /* and p_vout->render_time (read with p_vout->change_lock) */
-
-    /* stream context */
-    unsigned int    i_eta_p, i_eta_b;
-    boolean_t       b_dropped_last;            /* for special synchros below */
-    mtime_t         backward_pts, current_pts;
-    int             i_current_period;   /* period to add to the next picture */
-    int             i_backward_period;  /* period to add after the next
-                                         * reference picture
-                                         * (backward_period * period / 2) */
-
-#ifdef STATS
-    unsigned int    i_trashed_pic, i_not_chosen_pic, i_pic;
-#endif
-} video_synchro_t;
-
-#define FIFO_INCREMENT( i_counter )                                         \
-    p_vpar->synchro.i_counter =                                             \
-        (p_vpar->synchro.i_counter + 1) % MAX_DECODING_PIC;
-
-/* Synchro algorithms */
-#define VPAR_SYNCHRO_DEFAULT    0
-#define VPAR_SYNCHRO_I          1
-#define VPAR_SYNCHRO_Iplus      2
-#define VPAR_SYNCHRO_IP         3
-#define VPAR_SYNCHRO_IPplus     4
-#define VPAR_SYNCHRO_IPB        5
-
-/*****************************************************************************
- * Prototypes
- *****************************************************************************/
-void vpar_SynchroInit           ( struct vpar_thread_s * p_vpar );
-boolean_t vpar_SynchroChoose    ( struct vpar_thread_s * p_vpar,
-                                  int i_coding_type, int i_structure );
-void vpar_SynchroTrash          ( struct vpar_thread_s * p_vpar,
-                                  int i_coding_type, int i_structure );
-void vpar_SynchroDecode         ( struct vpar_thread_s * p_vpar,
-                                  int i_coding_type, int i_structure );
-void vpar_SynchroEnd            ( struct vpar_thread_s * p_vpar, int i_garbage );
-mtime_t vpar_SynchroDate        ( struct vpar_thread_s * p_vpar );
-void vpar_SynchroNewPicture( struct vpar_thread_s * p_vpar, int i_coding_type,
-                             int i_repeat_field );
index fcae25b..9e2f42d 100644 (file)
@@ -5,7 +5,7 @@
  * thread, and destroy a previously oppened video output thread.
  *****************************************************************************
  * Copyright (C) 2000 VideoLAN
- * $Id: video_output.c,v 1.122 2001/05/01 04:18:18 sam Exp $
+ * $Id: video_output.c,v 1.123 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *
@@ -85,6 +85,34 @@ static int      Align             ( vout_thread_t *p_vout, int *pi_x,
 static void     SetPalette        ( p_vout_thread_t p_vout, u16 *red,
                                     u16 *green, u16 *blue, u16 *transp );
 
+/*****************************************************************************
+ * vout_InitBank: initialize the video output bank.
+ *****************************************************************************/
+void vout_InitBank ( void )
+{
+    p_vout_bank->i_count = 0;
+
+    vlc_mutex_init( &p_vout_bank->lock );
+}
+
+/*****************************************************************************
+ * vout_EndBank: empty the video output bank.
+ *****************************************************************************
+ * This function ends all unused video outputs and empties the bank in
+ * case of success.
+ *****************************************************************************/
+void vout_EndBank ( void )
+{
+    /* Ask all remaining video outputs to die */
+    while( p_vout_bank->i_count )
+    {
+        vout_DestroyThread(
+                p_vout_bank->pp_vout[ --p_vout_bank->i_count ], NULL );
+    }                       
+
+    vlc_mutex_destroy( &p_vout_bank->lock );
+}
+
 /*****************************************************************************
  * vout_CreateThread: creates a new video output thread
  *****************************************************************************
index aa7d818..d93c64a 100644 (file)
@@ -2,7 +2,7 @@
  * video_fifo.c : video FIFO management
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_fifo.c,v 1.30 2001/04/06 09:15:48 sam Exp $
+ * $Id: video_fifo.c,v 1.31 2001/05/06 04:32:02 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
 
 #include "video_decoder.h"
 #include "vdec_motion.h"
-#include "../video_decoder/vdec_idct.h"
 
 #include "vpar_blocks.h"
-#include "../video_decoder/vpar_headers.h"
-#include "../video_decoder/vpar_synchro.h"
-#include "../video_decoder/video_parser.h"
-#include "../video_decoder/video_fifo.h"
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
+#include "video_fifo.h"
 
 /*****************************************************************************
  * vpar_InitFIFO : initialize the video FIFO
index d478efa..ef35815 100644 (file)
@@ -2,7 +2,7 @@
  * video_parser.c : video parser thread
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_parser.c,v 1.84 2001/05/01 15:12:22 sam Exp $
+ * $Id: video_parser.c,v 1.85 2001/05/06 04:32:03 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
 
 #include "video_decoder.h"
 #include "vdec_motion.h"
-#include "../video_decoder/vdec_idct.h"
 
 #include "vpar_blocks.h"
-#include "../video_decoder/vpar_headers.h"
-#include "../video_decoder/vpar_synchro.h"
-#include "../video_decoder/video_parser.h"
-#include "../video_decoder/video_fifo.h"
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
+#include "video_fifo.h"
 
 /*
  * Local prototypes
@@ -175,10 +174,13 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config )
     }
 
 #define f p_vpar->p_idct_module->p_functions->idct.functions.idct
-    p_vpar->pf_init         = f.pf_init;
+    p_vpar->pf_idct_init    = f.pf_idct_init;
     p_vpar->pf_sparse_idct  = f.pf_sparse_idct;
     p_vpar->pf_idct         = f.pf_idct;
     p_vpar->pf_norm_scan    = f.pf_norm_scan;
+    p_vpar->pf_vdec_init    = f.pf_vdec_init;
+    p_vpar->pf_decode_mb_c  = f.pf_decode_mb_c;
+    p_vpar->pf_decode_mb_bw = f.pf_decode_mb_bw;
 #undef f
 
     /* Spawn the video parser thread */
@@ -264,15 +266,22 @@ static int InitThread( vpar_thread_t *p_vpar )
     }
 #else
     /* Fake a video_decoder thread */
-    if( (p_vpar->pp_vdec[0] = (vdec_thread_t *)malloc(sizeof( vdec_thread_t )))
-         == NULL || vdec_InitThread( p_vpar->pp_vdec[0] ) )
+    p_vpar->pp_vdec[0] = (vdec_thread_t *)malloc(sizeof( vdec_thread_t ));
+
+    if( p_vpar->pp_vdec[0] == NULL )
     {
         return( 1 );
     }
+
     p_vpar->pp_vdec[0]->b_die = 0;
     p_vpar->pp_vdec[0]->b_error = 0;
     p_vpar->pp_vdec[0]->p_vpar = p_vpar;
 
+    if( vdec_InitThread( p_vpar->pp_vdec[0] ) )
+    {
+        return( 1 );
+    }
+
 #   if !defined(SYS_BEOS) && !defined(WIN32)
 #       if VDEC_NICE
     /* Re-nice ourself */
index a6cb2b4..b4b85a2 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_blocks.c : blocks parsing
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_blocks.c,v 1.80 2001/04/28 03:36:25 sam Exp $
+ * $Id: vpar_blocks.c,v 1.81 2001/05/06 04:32:03 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Jean-Marc Dressler <polux@via.ecp.fr>
 
 #include "video_decoder.h"
 #include "vdec_motion.h"
-#include "../video_decoder/vdec_idct.h"
 
 #include "vpar_blocks.h"
-#include "../video_decoder/vpar_headers.h"
-#include "../video_decoder/vpar_synchro.h"
-#include "../video_decoder/video_parser.h"
-#include "../video_decoder/video_fifo.h"
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
+#include "video_fifo.h"
 
 /*
  * Welcome to vpar_blocks.c ! Here's where the heavy processor-critical parsing
index df71678..67d9ff7 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_headers.c : headers parsing
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_headers.c,v 1.85 2001/05/01 15:12:22 sam Exp $
+ * $Id: vpar_headers.c,v 1.86 2001/05/06 04:32:03 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Stéphane Borel <stef@via.ecp.fr>
 
 #include "video_decoder.h"
 #include "vdec_motion.h"
-#include "../video_decoder/vdec_idct.h"
 
 #include "vpar_blocks.h"
-#include "../video_decoder/vpar_headers.h"
-#include "../video_decoder/vpar_synchro.h"
-#include "../video_decoder/video_parser.h"
-#include "../video_decoder/video_fifo.h"
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
+#include "video_fifo.h"
 
 #include "main.h" /* XXX REMOVE THIS */
 
@@ -452,19 +451,36 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
     ExtensionAndUserData( p_vpar );
 
     /* XXX: The vout request and fifo opening will eventually be here */
-    if( p_vpar->p_vout == NULL )
+
+    /* Spawn an audio output if there is none */
+    vlc_mutex_lock( &p_vout_bank->lock );
+    
+    if( p_vout_bank->i_count == 0 )
     {
-        if( p_main->p_vout == NULL )
+        intf_Msg( "vpar: no vout present, spawning one" );
+
+        p_vpar->p_vout = vout_CreateThread( NULL );
+
+        /* Everything failed */
+        if( p_vpar->p_vout == NULL )
         {
-            intf_Msg( "vpar: no vout present, spawning one" );
-            p_main->p_vout = vout_CreateThread( NULL );
+            intf_Msg( "vpar: can't open vout, aborting" );
+            vlc_mutex_unlock( &p_vout_bank->lock );
 
-            /* Spawning another one for fun */
-            //vout_CreateThread( NULL );
+            /* XXX ! XXX ! XXX ! what to do here ? */
+            return;
         }
-
-        p_vpar->p_vout = p_main->p_vout;
+        
+        p_vout_bank->pp_vout[ p_vout_bank->i_count ] = p_vpar->p_vout;
+        p_vout_bank->i_count++;
     }
+    else
+    {
+        /* Take the first video output FIXME: take the best one */
+        p_vpar->p_vout = p_vout_bank->pp_vout[ 0 ];
+    }
+
+    vlc_mutex_unlock( &p_vout_bank->lock );
 }
 
 /*****************************************************************************
index caac6b1..e03dfc8 100644 (file)
@@ -2,7 +2,7 @@
  * vpar_synchro.c : frame dropping routines
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vpar_synchro.c,v 1.88 2001/04/27 19:29:11 massiot Exp $
+ * $Id: vpar_synchro.c,v 1.89 2001/05/06 04:32:03 sam Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *          Samuel Hocevar <sam@via.ecp.fr>
 
 #include "video_decoder.h"
 #include "vdec_motion.h"
-#include "../video_decoder/vdec_idct.h"
 
 #include "vpar_blocks.h"
-#include "../video_decoder/vpar_headers.h"
-#include "../video_decoder/vpar_synchro.h"
-#include "../video_decoder/video_parser.h"
+#include "vpar_headers.h"
+#include "vpar_synchro.h"
+#include "video_parser.h"
 
 #include "main.h"