Bon, puisque �a semble commiter sous BeOS, je commite.
authorSam Hocevar <sam@videolan.org>
Tue, 4 Jul 2000 02:37:21 +0000 (02:37 +0000)
committerSam Hocevar <sam@videolan.org>
Tue, 4 Jul 2000 02:37:21 +0000 (02:37 +0000)
Voil� le changelog appoximatif :

 . fichier INSTALL plus clair
 . vir� quelques warnings
 . *PATH sont maintenant d�finis dans config.h
 . quelques fautes d'orthographe
 . l'option --enable-ppro n'est pas mise par d�faut car elle ne fonctionne
  pas sur un K6-2
 . nouvelle API des plugins
 . le client framebuffer ne d�truit plus la console quand on quitte
 . r�paration de la YUV 8 bits
 . mise des YUV en plugins
 . transfo YUV 32bits MMX chour�e dans la libmpeg2

90 files changed:
ChangeLog
INSTALL
Makefile.dep
Makefile.in
README
configure
configure.in
debian/changelog
include/ac3_decoder.h
include/ac3_decoder_thread.h
include/audio_decoder.h
include/audio_decoder_thread.h
include/audio_output.h
include/beos_specific.h
include/common.h
include/config.h.in
include/decoder_fifo.h
include/interface.h
include/main.h
include/playlist.h [new file with mode: 0644]
include/plugins.h
include/plugins_export.h [new file with mode: 0644]
include/spu_decoder.h
include/video_decoder.h
include/video_output.h
include/vpar_synchro.h
plugins/beos/beos.cpp [new file with mode: 0644]
plugins/dsp/dsp.c [new file with mode: 0644]
plugins/dummy/dummy.c [new file with mode: 0644]
plugins/dummy/vout_dummy.c
plugins/esd/esd.c [new file with mode: 0644]
plugins/fb/fb.c [new file with mode: 0644]
plugins/fb/intf_fb.c
plugins/fb/vout_fb.c
plugins/ggi/ggi.c [new file with mode: 0644]
plugins/ggi/intf_ggi.c
plugins/ggi/vout_ggi.c
plugins/glide/glide.c [new file with mode: 0644]
plugins/gnome/gnome.c [new file with mode: 0644]
plugins/gnome/vout_gnome.c
plugins/mga/mga.c [new file with mode: 0644]
plugins/mga/vout_mga.c
plugins/x11/vout_x11.c
plugins/x11/x11.c [new file with mode: 0644]
plugins/yuv/video_yuv.c [new file with mode: 0644]
plugins/yuv/video_yuv.h [new file with mode: 0644]
plugins/yuv/video_yuv15.c [new file with mode: 0644]
plugins/yuv/video_yuv16.c [new file with mode: 0644]
plugins/yuv/video_yuv24.c [new file with mode: 0644]
plugins/yuv/video_yuv32.c [new file with mode: 0644]
plugins/yuv/video_yuv8.c [new file with mode: 0644]
plugins/yuv/video_yuv_macros.h [new file with mode: 0644]
plugins/yuv/video_yuv_macros_8bpp.h [new file with mode: 0644]
plugins/yuv/yuv.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv.h [new file with mode: 0644]
plugins/yuvmmx/video_yuv15.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv16.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv24.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv32.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv8.c [new file with mode: 0644]
plugins/yuvmmx/video_yuv_asm.h [new file with mode: 0644]
plugins/yuvmmx/video_yuv_macros.h [new file with mode: 0644]
plugins/yuvmmx/yuvmmx.c [new file with mode: 0644]
src/ac3_decoder/ac3_decoder_thread.c
src/ac3_decoder/ac3_mantissa.c
src/audio_output/audio_output.c
src/input/input.c
src/input/input_ctrl.c
src/input/input_file.c
src/input/input_network.c
src/input/input_psi.c
src/input/input_vlan.c
src/interface/interface.c
src/interface/intf_cmd.c
src/interface/intf_ctrl.c
src/interface/main.c
src/misc/beos_specific.cpp
src/misc/playlist.c [new file with mode: 0644]
src/misc/plugins.c
src/spu_decoder/spu_decoder.c
src/video_decoder/vdec_motion.c
src/video_decoder/vdec_motion_inner.c
src/video_output/video_output.c
src/video_output/video_text.c
src/video_output/video_yuv.c
src/video_output/video_yuv.h
src/video_parser/video_parser.c
src/video_parser/vpar_synchro.c
vlc.spec

index bec708b..2cef831 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,30 @@
-Tue Jun 20 14:17:56 CEST 2000
+[insert date here]
 0.1.99d :
 
   * fixed RPM build
   * .deb is now more lintian-friendly
+  * fixed vlc.spec to install nicely
+  * PLUGIN_PATH and DATA_PATH now in include/*.h
+  * removed a few useless warning messages
+  * removed remaining header stuff related to the old non-free decoder
+  * fixed the MGA build (doesn't work yet, though)
+  * new plugin API
+  * updated the INSTALL document
+  * plugin auto-detection
+  * fixed a few misspellings in the code
+  * removed the default --enable-ppro option because it didn't work on K6-2
+  * the framebuffer client now leaves the console in a working state
+  * the dithered 8 bpp YUV transformation works again (blame bbp !)
+  * the YUV transformations are now plugins as well
+  * alternative symlinks like gvlc, fbvlc are now created at compile time
+  * borrowed libmpeg2's GPLed MMX YUV transformations (16 and 32 bits)
 
 Sun Jun 18 18:54:48 CEST 2000
 0.1.99c :
 
   * fixed Makefile.in for debug version
   * caught Delete Window event in Gnome and X11 modes
-  * fixed manpage
+  * fixed man page
   * GGI output now works
   * fixed a segfault on exit for the Gnome plugin
   * fixed compile problems for BeOS
@@ -24,3 +39,8 @@ Sat Jun 17 03:35:02 CEST 2000
   * new VLAN changing code
   * created the ChangeLog file :)
 
+Thu Jun 15 20:48:54 CEST 2000
+0.1.99a :
+
+  * first public release
+
diff --git a/INSTALL b/INSTALL
index ab1379a..678730e 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -6,7 +6,7 @@ Building VideoLAN
 
 A typical way to configure the vlc is :
 
-   ./configure --prefix=/usr --enable-ppro --enable-mmx --enable-gnome
+   ./configure --prefix=/usr --enable-mmx --enable-gnome
 
 See `./configure --help' for more information.
 
index dbe2c31..6677e2f 100644 (file)
@@ -14,8 +14,8 @@
 ################################################################################
 
 default:
-       @echo "This Makefile should not be called directly - see notes at end of"
-       @echo "main Makefile."
+       @echo "This Makefile should not be called directly,"
+       @echo "see notes at end of main Makefile."
 
 ################################################################################
 # Dependancies creation
@@ -30,6 +30,7 @@ $(dependancies): .dep/%.d: %.c
        @test -d .dep/$(dir $*) || mkdir -p .dep/$(dir $*)
        #@echo "generating dependancies for $*.c"
        @$(SHELL) -ec '$(CC) $(DCFLAGS) $(CFLAGS) $(DEFINE) $< \
-               | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
-               .dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
-               [ -s $@ ] || rm -f $@'
+       | sed '\''s/$(subst .,\.,$(notdir $*))\.o[ :]*/$(subst /,\/,$*).o \
+       .dep\/$(subst /,\/,$*).d : /g'\'' > $@; \
+       [ -s $@ ] || rm -f $@'
+
index 7e7ef54..ce80973 100644 (file)
@@ -41,8 +41,6 @@ PROGRAM_BUILD = `date` $(USER)
 # DEFINE will contain some of the constants definitions decided in Makefile, 
 # including SYS_xx. It will be passed to C compiler.
 DEFINE += -DSYS_$(shell echo $(SYS) | sed 's/-.*//' | tr a-z A-Z)
-DEFINE += -DPLUGIN_PATH="\"$(prefix)/lib/videolan/vlc\""
-DEFINE += -DDATA_PATH="\"$(prefix)/share/videolan/vlc\""
 
 ################################################################################
 # Tuning and other variables - do not change anything except if you know
@@ -211,6 +209,7 @@ video_decoder_obj =         video_decoder/video_decoder.o \
 misc_obj =                     misc/mtime.o \
                                                misc/rsc_files.o \
                                                misc/netutils.o \
+                                               misc/playlist.o \
                                                misc/plugins.o \
                                                misc/decoder_fifo.o
 
@@ -248,42 +247,68 @@ endif
 #
 PLUGINS := $(PLUGINS:%=lib/%.so)
 
-PLUGIN_BEOS   = plugins/beos/aout_beos.o \
+PLUGIN_BEOS   = plugins/beos/beos.o \
+               plugins/beos/aout_beos.o \
                plugins/beos/intf_beos.o \
                plugins/beos/vout_beos.o
 
-PLUGIN_DSP    = plugins/dsp/aout_dsp.o
+PLUGIN_DSP    = plugins/dsp/dsp.o \
+               plugins/dsp/aout_dsp.o \
 
-PLUGIN_DUMMY  = plugins/dummy/aout_dummy.o \
+PLUGIN_DUMMY  = plugins/dummy/dummy.o \
+               plugins/dummy/aout_dummy.o \
                plugins/dummy/intf_dummy.o \
                plugins/dummy/vout_dummy.o
 
-PLUGIN_ESD    = plugins/esd/aout_esd.o
+PLUGIN_ESD    = plugins/esd/esd.o \
+               plugins/esd/aout_esd.o
 
-PLUGIN_FB     = plugins/fb/intf_fb.o \
+PLUGIN_FB     = plugins/fb/fb.o \
+               plugins/fb/intf_fb.o \
                plugins/fb/vout_fb.o
 
-PLUGIN_GGI    = plugins/ggi/intf_ggi.o \
+PLUGIN_GGI    = plugins/ggi/ggi.o \
+               plugins/ggi/intf_ggi.o \
                plugins/ggi/vout_ggi.o
 
-PLUGIN_GLIDE  = plugins/glide/intf_glide.o \
+PLUGIN_GLIDE  = plugins/glide/glide.o \
+               plugins/glide/intf_glide.o \
                plugins/glide/vout_glide.o
 
-PLUGIN_GNOME  = plugins/gnome/intf_gnome.o \
+PLUGIN_GNOME  = plugins/gnome/gnome.o \
+               plugins/gnome/intf_gnome.o \
                plugins/gnome/intf_gnome_callbacks.o \
                plugins/gnome/intf_gnome_interface.o \
                plugins/gnome/intf_gnome_support.o \
                plugins/gnome/vout_gnome.o
 
-PLUGIN_MGA    = plugins/mga/intf_mga.o \
-               plugins/fb/vout_mga.o
+PLUGIN_MGA    = plugins/mga/mga.o \
+               plugins/mga/intf_mga.o \
+               plugins/mga/vout_mga.o
 
-PLUGIN_X11    = plugins/x11/intf_x11.o \
+PLUGIN_X11    = plugins/x11/x11.o \
+               plugins/x11/intf_x11.o \
                plugins/x11/vout_x11.o
 
+PLUGIN_YUV    = plugins/yuv/yuv.o \
+               plugins/yuv/video_yuv.o \
+               plugins/yuv/video_yuv8.o \
+               plugins/yuv/video_yuv15.o \
+               plugins/yuv/video_yuv16.o \
+               plugins/yuv/video_yuv24.o \
+               plugins/yuv/video_yuv32.o
+
+PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
+               plugins/yuvmmx/video_yuv.o \
+               plugins/yuvmmx/video_yuv8.o \
+               plugins/yuvmmx/video_yuv15.o \
+               plugins/yuvmmx/video_yuv16.o \
+               plugins/yuvmmx/video_yuv24.o \
+               plugins/yuvmmx/video_yuv32.o
+
 PLUGIN_OBJ = $(PLUGIN_BEOS) $(PLUGIN_DSP) $(PLUGIN_DUMMY) $(PLUGIN_ESD) \
                $(PLUGIN_FB) $(PLUGIN_GGI) $(PLUGIN_GLIDE) $(PLUGIN_GNOME) \
-               $(PLUGIN_MGA) $(PLUGIN_X11)
+               $(PLUGIN_MGA) $(PLUGIN_X11) $(PLUGIN_YUV) $(PLUGIN_YUVMMX)
 #
 # Other lists of files
 #
@@ -303,32 +328,32 @@ export
 #
 # Virtual targets
 #
-all: vlc plugins
+all: vlc @ALIASES@ plugins
 
 clean:
        rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(PLUGIN_OBJ)
+       rm -f vlc @ALIASES@ lib/*.so
 
 distclean: clean
-       rm -f src/*/*.o plugins/*/*.o lib/*.so **/*~ *.log
+       rm -f src/*/*.o plugins/*/*.o **/*~ *.log
        rm -f Makefile include/defs.h include/config.h
        rm -f config.status config.cache config.log
-       rm -f vlc gmon.out core build-stamp
+       rm -f gmon.out core build-stamp
        rm -rf .dep
 
 install:
        $(INSTALL) vlc $(prefix)/bin
        mkdir -p $(prefix)/lib/videolan/vlc
-       mkdir -p $(prefix)/share/videolan/vlc
+       mkdir -p $(prefix)/share/videolan
        $(INSTALL) -m 644 $(PLUGINS) $(prefix)/lib/videolan/vlc
-       $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan/vlc
-       $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan/vlc
+       $(INSTALL) -m 644 share/*.psf $(prefix)/share/videolan
+       $(INSTALL) -m 644 share/*.png $(prefix)/share/videolan
 
 show:
-       @echo "Command line for C objects:"
-       @echo $(CC) $(CCFLAGS) $(CFLAGS) -c -o "<dest.o>" "<src.c>"
-       @echo
-       @echo "Command line for assembler objects:"
-       @echo $(CC) $(CFLAGS) -c -o "<dest.o>" "<src.S>"
+       @echo CC: $(CC)
+       @echo CCFLAGS: $(CCFLAGS)
+       @echo DCFLAGS: $(DCFLAGS)
+       @echo LCFLAGS: $(CCFLAGS)
 
 # ugliest of all, but I have no time to do it -- sam
 snapshot:
@@ -359,6 +384,9 @@ else
        $(CC) $(CCFLAGS) $(LCFLAGS) $(CFLAGS) --export-dynamic -rdynamic -o $@ $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ)   
 endif
 
+gvlc xvlc fbvlc ggivlc glidevlc: vlc
+       rm -f $@ && ln -s vlc $@
+
 plugins: $(PLUGINS)
 
 #
@@ -382,11 +410,9 @@ $(ASM_OBJ): %.o: %.S
 #$(PLUGIN_OBJ): %.so: Makefile.dep
 #$(PLUGIN_OBJ): %.so: .dep/%.d
 
-#$(CC) $(LCFLAGS) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $< plugins/_APP_
-               
 lib/beos.so: $(PLUGIN_BEOS)
-       ld -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
-$(PLUGIN_BEOS): %.o: %.c
+       $(CC) $(CCFLAGS) $(CFLAGS) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_
+$(PLUGIN_BEOS): %.o: %.cpp
        $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
 
 lib/esd.so: $(PLUGIN_ESD)
@@ -398,6 +424,11 @@ endif
 $(PLUGIN_ESD): %.o: %.c
        $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
 
+lib/dsp.so: $(PLUGIN_DSP)
+       ld -shared -o $@ $^
+$(PLUGIN_DSP): %.o: %.c
+       $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
+
 lib/dummy.so: $(PLUGIN_DUMMY)
        ld -shared -o $@ $^
 $(PLUGIN_DUMMY): %.o: %.c
@@ -421,7 +452,7 @@ $(PLUGIN_MGA): %.o: %.c
 lib/gnome.so: $(PLUGIN_GNOME)
        ld -shared `gnome-config --libs gnomeui | sed 's,-rdynamic,,'` -o $@ $^
 $(PLUGIN_GNOME): %.o: %.c
-       $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui`-c -o $@ $<
+       $(CC) $(CCFLAGS) $(CFLAGS) `gnome-config --cflags gnomeui` -c -o $@ $<
 
 lib/glide.so: $(PLUGIN_GLIDE)
        ld -shared -lglide2x -o $@ $^
@@ -433,6 +464,16 @@ lib/ggi.so: $(PLUGIN_GGI)
 $(PLUGIN_GGI): %.o: %.c
        $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
 
+lib/yuv.so: $(PLUGIN_YUV)
+       ld -shared -o $@ $^
+$(PLUGIN_YUV): %.o: %.c
+       $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
+
+lib/yuvmmx.so: $(PLUGIN_YUVMMX)
+       ld -shared -o $@ $^
+$(PLUGIN_YUVMMX): %.o: %.c
+       $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
+
 ################################################################################
 # Note on generic rules and dependancies
 ################################################################################
diff --git a/README b/README
index f9803ea..290ce66 100644 (file)
--- a/README
+++ b/README
@@ -4,7 +4,9 @@ README for vlc, the VideoLAN Client
 Introduction
 ============
 
-[ nothing appropriate yet ]
+The vlc is part of the VideoLAN project, a full MPEG2 client/server
+solution. The VideoLAN Client can also be used as a standalone program
+to play MPEG2 streams from a hard disk or a DVD.
 
 
 Building, Installing and Running VideoLAN
@@ -38,7 +40,13 @@ distribution, what plugins you were trying, and so on).
 Resources
 =========
 
-[ nothing appropriate yet ]
+The VideoLAN web site at http://www.videolan.org/ is a good start for
+information about MPEG and DVD playing. Have a look at the documentation
+section, as well as the bookmarks.
+
+You can also try the OpenDVD site at http://www.opendvd.org/ or the
+the LiVid project at http://www.linuxvideo.org/. They have lots of
+information, too.
 
 
 The team
index 0ced839..bfebd61 100755 (executable)
--- a/configure
+++ b/configure
@@ -12,10 +12,14 @@ ac_help=
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
 ac_help="$ac_help
-  --enable-dsp            Linux /dev/dsp support (default enabled)"
+  --enable-ppro           Enable PentiumPro optimizations (default is no)"
+ac_help="$ac_help
+  --enable-mmx            Enable MMX optimizations (default is no)"
 ac_help="$ac_help
   --enable-dummy          dummy audio and video support (default enabled)"
 ac_help="$ac_help
+  --enable-dsp            Linux /dev/dsp support (default enabled)"
+ac_help="$ac_help
   --enable-esd            Esound library support (default disabled)"
 ac_help="$ac_help
   --enable-fb             Linux framebuffer support (default disabled)"
@@ -27,10 +31,6 @@ ac_help="$ac_help
   --enable-gnome          Gnome support (default disabled)"
 ac_help="$ac_help
   --enable-x11            X11 support (default enabled)"
-ac_help="$ac_help
-  --enable-ppro           Enable PentiumPro optimizations (default is no)"
-ac_help="$ac_help
-  --enable-mmx            Enable MMX optimizations (default is no)"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -3041,13 +3041,30 @@ EOF
 fi
 
 
-# Check whether --enable-dsp or --disable-dsp was given.
-if test "${enable_dsp+set}" = set; then
-  enableval="$enable_dsp"
-  :
+PLUGINS=${PLUGINS}"yuv ";
+
+ARCH=${host_cpu}
+# Check whether --enable-ppro or --disable-ppro was given.
+if test "${enable_ppro+set}" = set; then
+  enableval="$enable_ppro"
+   if test x$enableval = xyes; then ARCH=${ARCH}" pentiumpro"; fi 
 fi
 
-if test x$enable_dsp != xno; then PLUGINS=${PLUGINS}"dsp "; fi
+# Check whether --enable-mmx or --disable-mmx was given.
+if test "${enable_mmx+set}" = set; then
+  enableval="$enable_mmx"
+   if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx "; fi 
+fi
+
+
+SYS=${host_os}
+
+# special cases
+if test x$host_os = xbeos; then
+    PLUGINS=${PLUGINS}"dummy beos "
+
+else
+
 # Check whether --enable-dummy or --disable-dummy was given.
 if test "${enable_dummy+set}" = set; then
   enableval="$enable_dummy"
@@ -3055,6 +3072,13 @@ if test "${enable_dummy+set}" = set; then
 fi
 
 if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
+# Check whether --enable-dsp or --disable-dsp was given.
+if test "${enable_dsp+set}" = set; then
+  enableval="$enable_dsp"
+  :
+fi
+
+if test x$enable_dsp != xno; then PLUGINS=${PLUGINS}"dsp "; fi
 # Check whether --enable-esd or --disable-esd was given.
 if test "${enable_esd+set}" = set; then
   enableval="$enable_esd"
@@ -3064,25 +3088,25 @@ fi
 # Check whether --enable-fb or --disable-fb was given.
 if test "${enable_fb+set}" = set; then
   enableval="$enable_fb"
-  if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; fi
+  if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; ALIASES=${ALIASES}"fbvlc "; fi
 fi
 
 # Check whether --enable-ggi or --disable-ggi was given.
 if test "${enable_ggi+set}" = set; then
   enableval="$enable_ggi"
-  if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; fi
+  if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; ALIASES=${ALIASES}"ggivlc "; fi
 fi
 
 # Check whether --enable-glide or --disable-glide was given.
 if test "${enable_glide+set}" = set; then
   enableval="$enable_glide"
-  if test x$enable_glide = xyes; then PLUGINS=${PLUGINS}"glide "; fi
+  if test x$enable_glide = xyes; then PLUGINS=${PLUGINS}"glide "; ALIASES=${ALIASES}"glidevlc "; fi
 fi
 
 # Check whether --enable-gnome or --disable-gnome was given.
 if test "${enable_gnome+set}" = set; then
   enableval="$enable_gnome"
-  if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; fi
+  if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi
 fi
 
 # Check whether --enable-x11 or --disable-x11 was given.
@@ -3091,29 +3115,11 @@ if test "${enable_x11+set}" = set; then
   :
 fi
 
-if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
-
-ARCH=${host_cpu}
-# Check whether --enable-ppro or --disable-ppro was given.
-if test "${enable_ppro+set}" = set; then
-  enableval="$enable_ppro"
-   if test x$enableval = xyes; then ARCH=${ARCH}" pentiumpro"; fi 
-fi
+if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; ALIASES=${ALIASES}"xvlc "; fi
 
-# Check whether --enable-mmx or --disable-mmx was given.
-if test "${enable_mmx+set}" = set; then
-  enableval="$enable_mmx"
-   if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; fi 
 fi
 
 
-SYS=${host_os}
-
-# special cases
-if test x$host_os = xbeos; then
-    PLUGINS="dummy beos"
-fi
-
 
 
 
@@ -3268,6 +3274,7 @@ s%@LIBOBJS@%$LIBOBJS%g
 s%@SYS@%$SYS%g
 s%@ARCH@%$ARCH%g
 s%@PLUGINS@%$PLUGINS%g
+s%@ALIASES@%$ALIASES%g
 
 CEOF
 EOF
@@ -3495,4 +3502,5 @@ vlc version           : ${VLC_VERSION}
 system                : ${SYS}
 architecture          : ${ARCH}
 plugins               : ${PLUGINS}
+vlc aliases           : ${ALIASES}
 "
index 8089b09..25c2af3 100644 (file)
@@ -58,49 +58,57 @@ AC_C_CONST
 AC_TYPE_SIZE_T
 AC_HEADER_TIME
 
-AC_ARG_ENABLE(dsp,
-  [  --enable-dsp            Linux /dev/dsp support (default enabled)])
-if test x$enable_dsp != xno; then PLUGINS=${PLUGINS}"dsp "; fi
+dnl default plugins 
+PLUGINS=${PLUGINS}"yuv ";
+
+ARCH=${host_cpu}
+AC_ARG_ENABLE(ppro,
+[  --enable-ppro           Enable PentiumPro optimizations (default is no)],
+[ if test x$enableval = xyes; then ARCH=${ARCH}" pentiumpro"; fi ])
+AC_ARG_ENABLE(mmx,
+[  --enable-mmx            Enable MMX optimizations (default is no)],
+[ if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx "; fi ])
+
+SYS=${host_os}
+
+# special cases
+if test x$host_os = xbeos; then
+    PLUGINS=${PLUGINS}"dummy beos "
+
+dnl default case
+else
+
 AC_ARG_ENABLE(dummy,
   [  --enable-dummy          dummy audio and video support (default enabled)])
 if test x$enable_dummy != xno; then PLUGINS=${PLUGINS}"dummy "; fi
+AC_ARG_ENABLE(dsp,
+  [  --enable-dsp            Linux /dev/dsp support (default enabled)])
+if test x$enable_dsp != xno; then PLUGINS=${PLUGINS}"dsp "; fi
 AC_ARG_ENABLE(esd,
   [  --enable-esd            Esound library support (default disabled)],
   [if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"esd "; fi])
 AC_ARG_ENABLE(fb,
   [  --enable-fb             Linux framebuffer support (default disabled)],
-  [if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; fi])
+  [if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; ALIASES=${ALIASES}"fbvlc "; fi])
 AC_ARG_ENABLE(ggi,
   [  --enable-ggi            GGI support (default disabled)],
-  [if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; fi])
+  [if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; ALIASES=${ALIASES}"ggivlc "; fi])
 AC_ARG_ENABLE(glide,
   [  --enable-glide          Glide (3dfx) support (default disabled)],
-  [if test x$enable_glide = xyes; then PLUGINS=${PLUGINS}"glide "; fi])
+  [if test x$enable_glide = xyes; then PLUGINS=${PLUGINS}"glide "; ALIASES=${ALIASES}"glidevlc "; fi])
 AC_ARG_ENABLE(gnome,
   [  --enable-gnome          Gnome support (default disabled)],
-  [if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; fi])
+  [if test x$enable_gnome = xyes; then PLUGINS=${PLUGINS}"gnome "; ALIASES=${ALIASES}"gvlc "; fi])
 AC_ARG_ENABLE(x11,
   [  --enable-x11            X11 support (default enabled)])
-if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; fi
+if test x$enable_x11 != xno; then PLUGINS=${PLUGINS}"x11 "; ALIASES=${ALIASES}"xvlc "; fi
 
-ARCH=${host_cpu}
-AC_ARG_ENABLE(ppro,
-[  --enable-ppro           Enable PentiumPro optimizations (default is no)],
-[ if test x$enableval = xyes; then ARCH=${ARCH}" pentiumpro"; fi ])
-AC_ARG_ENABLE(mmx,
-[  --enable-mmx            Enable MMX optimizations (default is no)],
-[ if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; fi ])
-
-SYS=${host_os}
-
-# special cases
-if test x$host_os = xbeos; then
-    PLUGINS="dummy beos"
 fi
 
 AC_SUBST(SYS)
 AC_SUBST(ARCH)
 AC_SUBST(PLUGINS)
+AC_SUBST(ALIASES)
 
 AC_OUTPUT([Makefile include/config.h])
 
@@ -111,4 +119,5 @@ vlc version           : ${VLC_VERSION}
 system                : ${SYS}
 architecture          : ${ARCH}
 plugins               : ${PLUGINS}
+vlc aliases           : ${ALIASES}
 "
index 4972fd7..c3c980c 100644 (file)
@@ -2,7 +2,7 @@ vlc (0.1.99d) unstable; urgency=low
 
   * .deb is now more lintian-friendly
 
- -- Samuel Hocevar <sam@via.ecp.fr>  Tue, 20 Jun 2000 14:17:33 +0200
+ -- Samuel Hocevar <sam@via.ecp.fr>  [Insert date here]
 
 vlc (0.1.99c) unstable; urgency=low
 
index 2d46f36..7ba3061 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 1999, 2000 VideoLAN
  *
  * Authors:
+ * Michel Kaempf <maxx@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
index 5d299ce..675a3ea 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 1999, 2000 VideoLAN
  *
  * Authors:
+ * Michel Kaempf <maxx@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
index ad9b891..e9dac8a 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 1999, 2000 VideoLAN
  *
  * Authors:
+ * Michel Kaempf <maxx@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
index eb64c86..52d1313 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 1999, 2000 VideoLAN
  *
  * Authors:
+ * Michel Kaempf <maxx@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
index 64d730d..80d9091 100644 (file)
@@ -4,6 +4,7 @@
  * Copyright (C) 1999, 2000 VideoLAN
  *
  * Authors:
+ * Michel Kaempf <maxx@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
@@ -191,7 +192,6 @@ typedef struct aout_thread_s
     aout_fifo_t         fifo[ AOUT_MAX_FIFOS ];
 
     /* Plugins */
-    plugin_id_t                 aout_plugin;          /* video output plugin */
     aout_sys_open_t *           p_sys_open;
     aout_sys_reset_t *          p_sys_reset;
     aout_sys_setformat_t *      p_sys_setformat;
index c929162..f23b03e 100644 (file)
@@ -29,8 +29,8 @@
 extern "C" {
 #endif
 
-void       beos_Init( void );
-void       beos_Clean( void );
+void       beos_Create( void );
+void       beos_Destroy( void );
 char *     beos_GetProgramPath( void );
 
 #ifdef __cplusplus
index 813da80..ced9d4b 100644 (file)
@@ -47,6 +47,18 @@ typedef unsigned long       count_t;
  * Classes declaration
  *****************************************************************************/
 
+/* Plugins */
+struct plugin_bank_s;
+struct plugin_info_s;
+
+typedef struct plugin_bank_s *          p_plugin_bank_t;
+typedef struct plugin_info_s *          p_plugin_info_t;
+
+/* Playlist */
+struct playlist_s;
+
+typedef struct playlist_s *             p_playlist_t;
+
 /* Interface */
 struct intf_thread_s;
 struct intf_sys_s;
index fc7bba9..c5b1e7a 100644 (file)
@@ -27,8 +27,8 @@
  * - Symbols should begin with a prefix indicating in which module they are
  *   used, such as INTF_, VOUT_ or ADEC_.
  *
- * - Regarding environment variables, which are used as initialization parameters
- *   for threads :
+ * - Regarding environment variables, which are used as initialization
+ *  parameters for threads :
  *   + variable names should end with '_VAR'
  *   + environment variable default value should end with '_DEFAULT'
  *   + values having a special meaning with '_VAL'
@@ -41,7 +41,7 @@
 
 /* Program version and copyright message */
 #define VERSION_MESSAGE     "vlc @VLC_VERSION@ @VLC_CODENAME@ " \
-                            /* "(" PROGRAM_BUILD ") (" PROGRAM_OPTIONS ")\n" */ \
+                          /* "(" PROGRAM_BUILD ") (" PROGRAM_OPTIONS ")\n" */ \
                             "Copyright 1996-2000 VideoLAN\n"
 #define COPYRIGHT_MESSAGE   "VideoLAN Client - version @VLC_VERSION@" \
                             " @VLC_CODENAME@ - (c)1996-2000 VideoLAN"
 /* Size of the FIFO. FIFO_SIZE+1 must be a power of 2 */
 #define FIFO_SIZE                       1023
 
+/*
+ * Paths
+ */
+
+#define DATA_PATH                       "@prefix@/share/videolan"
+#define PLUGIN_PATH                     "@prefix@/lib/videolan/vlc"
+
+#define MAX_PLUGIN_COUNT                32
 
 /*****************************************************************************
  * Interface configuration
 #define VOUT_DISPLAY_VAR                "vlc_display"
 
 /* Default dimensions for display window - these dimensions are enough for the
- * standard width and height broadcasted MPEG-2 streams */
+ * standard width and height broadcasted MPEG-2 streams or DVDs */
 #define VOUT_WIDTH_VAR                  "vlc_width"
 #define VOUT_HEIGHT_VAR                 "vlc_height"
-#define VOUT_WIDTH_DEFAULT              720
-#define VOUT_HEIGHT_DEFAULT             576
+#define VOUT_WIDTH_DEFAULT              360
+#define VOUT_HEIGHT_DEFAULT             288
 
 /* Maximum width of a scaled source picture - this should be relatively high,
  * since higher stream values will result in no display at all. */
 
 /* Optimization level, from 0 to 2 - 1 is generally a good compromise. Remember
  * that raising this level dramatically lengthens the compilation time. */
-#define VPAR_OPTIM_LEVEL                1
+#define VPAR_OPTIM_LEVEL                2
 
 /* The following directives only apply if you define VDEC_SMP below. */
 
index 2c88779..236700a 100644 (file)
  *****************************************************************************/
 
 /* FIXME: move to inline functions ??*/
-#define DECODER_FIFO_ISEMPTY( fifo )    ( (fifo).i_start == (fifo).i_end )
-#define DECODER_FIFO_ISFULL( fifo )     ( ( ( (fifo).i_end + 1 - (fifo).i_start ) \
+#define DECODER_FIFO_ISEMPTY( fifo )  ( (fifo).i_start == (fifo).i_end )
+#define DECODER_FIFO_ISFULL( fifo )   ( ( ((fifo).i_end + 1 - (fifo).i_start)\
                                           & FIFO_SIZE ) == 0 )
-#define DECODER_FIFO_START( fifo )      ( (fifo).buffer[ (fifo).i_start ] )
-#define DECODER_FIFO_INCSTART( fifo )   ( (fifo).i_start = ((fifo).i_start + 1)\
-                                                           & FIFO_SIZE )
-#define DECODER_FIFO_END( fifo )        ( (fifo).buffer[ (fifo).i_end ] )
-#define DECODER_FIFO_INCEND( fifo )     ( (fifo).i_end = ((fifo).i_end + 1) \
+#define DECODER_FIFO_START( fifo )    ( (fifo).buffer[ (fifo).i_start ] )
+#define DECODER_FIFO_INCSTART( fifo ) ( (fifo).i_start = ((fifo).i_start + 1)\
                                                          & FIFO_SIZE )
+#define DECODER_FIFO_END( fifo )      ( (fifo).buffer[ (fifo).i_end ] )
+#define DECODER_FIFO_INCEND( fifo )   ( (fifo).i_end = ((fifo).i_end + 1) \
+                                                       & FIFO_SIZE )
 
 /*****************************************************************************
  * decoder_fifo_t
@@ -239,5 +239,6 @@ static __inline__ u32 GetBits32( bit_stream_t * p_bit_stream )
  *****************************************************************************/
 static __inline__ void RealignBits( bit_stream_t * p_bit_stream )
 {
-    DumpBits( p_bit_stream, p_bit_stream->fifo.i_available & 7 );
+    DumpBits( p_bit_stream, p_bit_stream->fifo.i_available & 0x7 );
 }
+
index 296806d..1b75eef 100644 (file)
@@ -57,16 +57,12 @@ typedef struct intf_thread_s
     p_intf_sys_t        p_sys;                           /* system interface */
 
     /* Plugin */
-    plugin_id_t             intf_plugin;                 /* interface plugin */
     intf_sys_create_t *     p_sys_create;         /* create interface thread */
     intf_sys_manage_t *     p_sys_manage;                       /* main loop */
     intf_sys_destroy_t *    p_sys_destroy;              /* destroy interface */
 
     /* XXX: Channels array - new API */
-    //p_intf_channel_t *  p_channel[INTF_MAX_CHANNELS];/* channel descriptions */
-    /* file list - quick hack */
-    char **p_playlist;
-    int i_list_index;
+  //p_intf_channel_t *  p_channel[INTF_MAX_CHANNELS];/* channel descriptions */
 
     /* Channels array - NULL if not used */
     p_intf_channel_t    p_channel;                /* description of channels */
index bfe5b51..b55bc74 100644 (file)
@@ -31,6 +31,7 @@
  * it when you can access the members you need in an other way. In fact, it
  * should only be used by interface thread.
  *****************************************************************************/
+
 typedef struct
 {
     /* Global properties */
@@ -49,6 +50,8 @@ typedef struct
 
     /* Shared data - these structures are accessed directly from p_main by
      * several modules */
+    p_plugin_bank_t        p_bank;                            /* plugin bank */
+    p_playlist_t           p_playlist;                        /* plugin bank */
     p_intf_msg_t           p_msg;                 /* messages interface data */
     p_input_vlan_t         p_vlan;                      /* vlan library data */
 } main_t;
@@ -63,3 +66,4 @@ int    main_GetIntVariable( char *psz_name, int i_default );
 char * main_GetPszVariable( char *psz_name, char *psz_default );
 void   main_PutIntVariable( char *psz_name, int i_value );
 void   main_PutPszVariable( char *psz_name, char *psz_value );
+
diff --git a/include/playlist.h b/include/playlist.h
new file mode 100644 (file)
index 0000000..9556fe1
--- /dev/null
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * playlist.h : Playlist functions
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+typedef struct playlist_s
+{
+    int               i_index;
+    char**            p_list;
+} playlist_t;
+
+playlist_t * playlist_Create   ( void );
+void         playlist_Init     ( playlist_t * p_playlist, int i_optind );
+void         playlist_Destroy  ( playlist_t * p_playlist );
+
index 31fa941..818e349 100644 (file)
 
 #ifdef SYS_BEOS
 typedef int plugin_id_t;
+#define GET_PLUGIN( p_func, plugin_id, psz_name ) \
+    get_image_symbol( plugin_id, psz_name, B_SYMBOL_TYPE_TEXT, &p_func );
 #else
-typedef void* plugin_id_t;
+typedef void *plugin_id_t;
+#define GET_PLUGIN( p_func, plugin_id, psz_name ) \
+    p_func = dlsym( plugin_id, psz_name );
 #endif
 
-int    RequestPlugin     ( plugin_id_t * p_plugin, char * psz_name );
-void   TrashPlugin       ( plugin_id_t p_plugin );
-void * GetPluginFunction ( plugin_id_t plugin, char *name );
+typedef struct plugin_info_s
+{
+    plugin_id_t plugin_id;
+
+    char *      psz_filename;
+    char *      psz_name;
+    char *      psz_version;
+    char *      psz_author;
+
+    void *      aout_GetPlugin;
+    void *      vout_GetPlugin;
+    void *      intf_GetPlugin;
+    void *      yuv_GetPlugin;
+} plugin_info_t;
+
+typedef struct plugin_bank_s
+{
+    int               i_plugin_count;
+    plugin_info_t *   p_info[ MAX_PLUGIN_COUNT ];
+} plugin_bank_t;
+
+plugin_bank_t *  bank_Create       ( void );
+void             bank_Init         ( plugin_bank_t * p_bank );
+void             bank_Destroy      ( plugin_bank_t * p_bank );
 
diff --git a/include/plugins_export.h b/include/plugins_export.h
new file mode 100644 (file)
index 0000000..04abe77
--- /dev/null
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * plugins_export.h : exporting plugins structure
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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
+ *****************************************************************************/
+
+/* audio output */
+int     aout_SysOpen         ( aout_thread_t *p_aout );
+int     aout_SysReset        ( aout_thread_t *p_aout );
+int     aout_SysSetFormat    ( aout_thread_t *p_aout );
+int     aout_SysSetChannels  ( aout_thread_t *p_aout );
+int     aout_SysSetRate      ( aout_thread_t *p_aout );
+long    aout_SysGetBufInfo   ( aout_thread_t *p_aout, long l_buffer_info );
+void    aout_SysPlaySamples  ( aout_thread_t *p_aout, byte_t *buffer,
+                               int i_size );
+void    aout_SysClose        ( aout_thread_t *p_aout );
+
+/* video output */
+int     vout_SysCreate       ( vout_thread_t *p_vout, char *psz_display,
+                               int i_root_window, void *p_data );
+int     vout_SysInit         ( p_vout_thread_t p_vout );
+void    vout_SysEnd          ( p_vout_thread_t p_vout );
+void    vout_SysDestroy      ( p_vout_thread_t p_vout );
+int     vout_SysManage       ( p_vout_thread_t p_vout );
+void    vout_SysDisplay      ( p_vout_thread_t p_vout );
+void    vout_SetPalette      ( p_vout_thread_t p_vout,
+                               u16 *red, u16 *green, u16 *blue, u16 *transp );
+
+/* interface */
+int     intf_SysCreate       ( p_intf_thread_t p_intf );
+void    intf_SysDestroy      ( p_intf_thread_t p_intf );
+void    intf_SysManage       ( p_intf_thread_t p_intf );
+
+/* YUV transformations */
+int     yuv_SysInit          ( p_vout_thread_t p_vout );
+int     yuv_SysReset         ( p_vout_thread_t p_vout );
+void    yuv_SysEnd           ( p_vout_thread_t p_vout );
+
index 6e6be23..25c6377 100644 (file)
@@ -51,6 +51,18 @@ typedef struct spudec_thread_s
 } spudec_thread_t;
 
 /*****************************************************************************
+ * SPU commands
+ *****************************************************************************/
+#define SPU_CMD_FORCE_DISPLAY       0x00
+#define SPU_CMD_START_DISPLAY       0x01
+#define SPU_CMD_STOP_DISPLAY        0x02
+#define SPU_CMD_SET_PALETTE         0x03
+#define SPU_CMD_SET_ALPHACHANNEL    0x04
+#define SPU_CMD_SET_COORDINATES     0x05
+#define SPU_CMD_SET_OFFSETS         0x06
+#define SPU_CMD_END                 0xff
+
+/*****************************************************************************
  * Prototypes
  *****************************************************************************/
 spudec_thread_t *       spudec_CreateThread( input_thread_t * p_input );
index 9fe26f5..7515e77 100644 (file)
@@ -50,17 +50,6 @@ typedef struct vdec_thread_s
     /* XXX?? */
 //    int *pi_status;
 
-#ifdef OLD_DECODER
-    /* Input properties */
-    decoder_fifo_t      fifo;                              /* PES input fifo */
-
-    /* The bit stream structure handles the PES stream at the bit level */
-    bit_stream_t        bit_stream;
-
-    /* Output properties */
-    vout_thread_t *     p_vout;                       /* video output thread */
-    int                 i_stream;                         /* video stream id */
-#else
     /* idct iformations */
     dctelem_t              p_pre_idct[64*64];
 
@@ -72,18 +61,11 @@ typedef struct vdec_thread_s
     u8              pi_crop_buf[VDEC_CROPRANGE];
     u8 *            pi_crop;
 //#endif
-#endif
 
 #ifdef STATS
     /* Statistics */
     count_t         c_loops;                              /* number of loops */
     count_t         c_idle_loops;                    /* number of idle loops */
-#ifdef OLD_DECODER
-    count_t         c_pictures;                   /* number of pictures read */
-    count_t         c_i_pictures;               /* number of I pictures read */
-    count_t         c_p_pictures;               /* number of P pictures read */
-    count_t         c_b_pictures;               /* number of B pictures read */
-#endif
     count_t         c_decoded_pictures;        /* number of pictures decoded */
     count_t         c_decoded_i_pictures;    /* number of I pictures decoded */
     count_t         c_decoded_p_pictures;    /* number of P pictures decoded */
@@ -94,21 +76,17 @@ typedef struct vdec_thread_s
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-#ifndef OLD_DECODER
 struct vpar_thread_s;
 struct macroblock_s;
-#endif
 
 /* Thread management functions */
-#ifdef OLD_DECODER
-p_vdec_thread_t  vdec_CreateThread       ( /* video_cfg_t *p_cfg, */ input_thread_t *p_input /*,
-                                          vout_thread_t *p_vout, int *pi_status */ );
-void             vdec_DestroyThread      ( vdec_thread_t *p_vdec /*, int *pi_status */ );
-#else
 #ifndef VDEC_SMP
 int             vdec_InitThread         ( struct vdec_thread_s *p_vdec );
-void            vdec_DecodeMacroblock   ( struct vdec_thread_s *p_vdec, struct macroblock_s *p_mb );
-#endif
-vdec_thread_t * vdec_CreateThread       ( struct vpar_thread_s *p_vpar /*, int *pi_status */ );
-void vdec_DestroyThread      ( vdec_thread_t *p_vdec /*, int *pi_status */ );
+void            vdec_DecodeMacroblock   ( struct vdec_thread_s *p_vdec,
+                                          struct macroblock_s *p_mb );
 #endif
+vdec_thread_t * vdec_CreateThread       ( struct vpar_thread_s *p_vpar /*,
+                                          int *pi_status */ );
+void            vdec_DestroyThread      ( vdec_thread_t *p_vdec /*,
+                                          int *pi_status */ );
+
index 80fb7f8..fac2829 100644 (file)
@@ -109,9 +109,14 @@ typedef void (vout_sys_end_t)       ( p_vout_thread_t p_vout );
 typedef void (vout_sys_destroy_t)   ( p_vout_thread_t p_vout );
 typedef int  (vout_sys_manage_t)    ( p_vout_thread_t p_vout );
 typedef void (vout_sys_display_t)   ( p_vout_thread_t p_vout );
+
 typedef void (vout_set_palette_t)   ( p_vout_thread_t p_vout, u16 *red,
                                       u16 *green, u16 *blue, u16 *transp );
 
+typedef int  (yuv_sys_init_t)       ( p_vout_thread_t p_vout );
+typedef int  (yuv_sys_reset_t)      ( p_vout_thread_t p_vout );
+typedef void (yuv_sys_end_t)        ( p_vout_thread_t p_vout );
+
 typedef struct vout_thread_s
 {
     /* Thread properties and lock */
@@ -152,14 +157,18 @@ typedef struct vout_thread_s
     u32                 i_blue_pixel;                                /* blue */
 
     /* Plugins */
-    plugin_id_t             vout_plugin;              /* video output plugin */
     vout_sys_create_t *     p_sys_create;          /* allocate output method */
     vout_sys_init_t *       p_sys_init;          /* initialize output method */
     vout_sys_end_t *        p_sys_end;            /* terminate output method */
     vout_sys_destroy_t *    p_sys_destroy;          /* destroy output method */
     vout_sys_manage_t *     p_sys_manage;                   /* handle events */
     vout_sys_display_t *    p_sys_display;         /* display rendered image */
-    vout_set_palette_t *    p_set_palette;              /* sets 8bpp palette */
+
+    vout_set_palette_t *    p_set_palette;               /* set 8bpp palette */
+
+    yuv_sys_init_t *        p_yuv_init;             /* initialize YUV tables */
+    yuv_sys_reset_t *       p_yuv_reset;                 /* reset YUV tables */
+    yuv_sys_end_t *         p_yuv_end;                    /* free YUV tables */
 
     /* Pictures and rendering properties */
     boolean_t           b_grayscale;           /* color or grayscale display */
index 3f163a7..6f7bdfc 100644 (file)
  *  "video_fifo.h"
  *****************************************************************************/
 
-#define POLUX_SYNCHRO
+#define SAM_SYNCHRO
+//#define POLUX_SYNCHRO
+//#define MEUUH_SYNCHRO
 
 /*****************************************************************************
  * video_synchro_t and video_synchro_tab_s : timers for the video synchro
  *****************************************************************************/
 #ifdef SAM_SYNCHRO
-typedef struct video_synchro_tab_s
-{
-    double mean;
-    double deviation;
-
-} video_synchro_tab_t;
-
-typedef struct video_synchro_fifo_s
-{
-    /* type of image to be decoded, and decoding date */
-    int i_image_type;
-    mtime_t i_decode_date;
-    mtime_t i_pts;
-
-} video_synchro_fifo_t;
-
 typedef struct video_synchro_s
 {
     /* fifo containing decoding dates */
-    video_synchro_fifo_t fifo[16];
-    unsigned int i_fifo_start;
-    unsigned int i_fifo_stop;
+    mtime_t      i_date_fifo[16];
+    unsigned int i_start;
+    unsigned int i_stop;
 
     /* mean decoding time */
-    mtime_t i_mean_decode_time;
-    /* dates */
-    mtime_t i_last_display_pts;           /* pts of the last displayed image */
-    mtime_t i_last_decode_pts;              /* pts of the last decoded image */
-    mtime_t i_last_i_pts;                         /* pts of the last I image */
-    mtime_t i_last_nondropped_i_pts;      /* pts of last non-dropped I image */
-    unsigned int i_images_since_pts;
+    mtime_t i_delay;
+    mtime_t i_theorical_delay;
 
-    /* il manquait un compteur */
-    unsigned int modulo;
+    /* dates */
+    mtime_t i_last_pts;                   /* pts of the last displayed image */
+    mtime_t i_last_seen_I_pts;              /* date of the last I we decoded */
+    mtime_t i_last_kept_I_pts;            /* pts of last non-dropped I image */
 
     /* P images since the last I */
-    unsigned int current_p_count;
-    unsigned int nondropped_p_count;
-    double p_count_predict;
+    unsigned int i_P_seen;
+    unsigned int i_P_kept;
     /* B images since the last I */
-    unsigned int current_b_count;
-    unsigned int nondropped_b_count;
-    double b_count_predict;
+    unsigned int i_B_seen;
+    unsigned int i_B_kept;
 
     /* can we display pictures ? */
-    unsigned int    can_display_i;
-    unsigned int    can_display_p;
-    double          displayable_p;
-    unsigned int    can_display_b;
-    double          displayable_b;
+    boolean_t     b_all_I;
+    boolean_t     b_all_P;
+    double        displayable_p;
+    boolean_t     b_all_B;
+    double        displayable_b;
 
-    /* 1 for linear count, 2 for binary count, 3 for ternary count */
-    video_synchro_tab_t tab_p[6];
-    video_synchro_tab_t tab_b[6];
+} video_synchro_t;
 
-    double theorical_fps;
-    double actual_fps;
+#define FIFO_INCREMENT( i_counter ) \
+    p_vpar->synchro.i_counter = (p_vpar->synchro.i_counter + 1) & 0xf;
 
-} video_synchro_t;
 #endif
 
 #ifdef MEUUH_SYNCHRO
@@ -140,15 +118,15 @@ typedef struct video_synchro_s
 /*****************************************************************************
  * Prototypes
  *****************************************************************************/
-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 );
-mtime_t vpar_SynchroDate( 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 );
+mtime_t vpar_SynchroDate        ( struct vpar_thread_s * p_vpar );
 
 #ifndef SAM_SYNCHRO
-void vpar_SynchroKludge( struct vpar_thread_s *, mtime_t );
+void vpar_SynchroKludge         ( struct vpar_thread_s *, mtime_t );
 #endif
diff --git a/plugins/beos/beos.cpp b/plugins/beos/beos.cpp
new file mode 100644 (file)
index 0000000..2ff6280
--- /dev/null
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * beos.cpp : BeOS plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+extern "C"
+{
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void aout_GetPlugin( p_aout_thread_t p_aout );
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "BeOS";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = aout_GetPlugin;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* the BeOS plugin always works under BeOS :) */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void aout_GetPlugin( p_aout_thread_t p_aout )
+{
+    p_aout->p_sys_open        = aout_SysOpen;
+    p_aout->p_sys_reset       = aout_SysReset;
+    p_aout->p_sys_setformat   = aout_SysSetFormat;
+    p_aout->p_sys_setchannels = aout_SysSetChannels;
+    p_aout->p_sys_setrate     = aout_SysSetRate;
+    p_aout->p_sys_getbufinfo  = aout_SysGetBufInfo;
+    p_aout->p_sys_playsamples = aout_SysPlaySamples;
+    p_aout->p_sys_close       = aout_SysClose;
+}
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
+} /* extern "C" */
diff --git a/plugins/dsp/dsp.c b/plugins/dsp/dsp.c
new file mode 100644 (file)
index 0000000..05376bb
--- /dev/null
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * dsp.c : OSS /dev/dsp plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void aout_GetPlugin( p_aout_thread_t p_aout );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "OSS /dev/dsp";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = aout_GetPlugin;
+    p_info->vout_GetPlugin = NULL;
+    p_info->intf_GetPlugin = NULL;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: check if suitable */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void aout_GetPlugin( p_aout_thread_t p_aout )
+{
+    p_aout->p_sys_open        = aout_SysOpen;
+    p_aout->p_sys_reset       = aout_SysReset;
+    p_aout->p_sys_setformat   = aout_SysSetFormat;
+    p_aout->p_sys_setchannels = aout_SysSetChannels;
+    p_aout->p_sys_setrate     = aout_SysSetRate;
+    p_aout->p_sys_getbufinfo  = aout_SysGetBufInfo;
+    p_aout->p_sys_playsamples = aout_SysPlaySamples;
+    p_aout->p_sys_close       = aout_SysClose;
+}
+
diff --git a/plugins/dummy/dummy.c b/plugins/dummy/dummy.c
new file mode 100644 (file)
index 0000000..28a091d
--- /dev/null
@@ -0,0 +1,110 @@
+/*****************************************************************************
+ * dummy.c : dummy plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void aout_GetPlugin( p_aout_thread_t p_aout );
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "Dummy";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = aout_GetPlugin;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* the dummy plugin always works */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void aout_GetPlugin( p_aout_thread_t p_aout )
+{
+    p_aout->p_sys_open        = aout_SysOpen;
+    p_aout->p_sys_reset       = aout_SysReset;
+    p_aout->p_sys_setformat   = aout_SysSetFormat;
+    p_aout->p_sys_setchannels = aout_SysSetChannels;
+    p_aout->p_sys_setrate     = aout_SysSetRate;
+    p_aout->p_sys_getbufinfo  = aout_SysGetBufInfo;
+    p_aout->p_sys_playsamples = aout_SysPlaySamples;
+    p_aout->p_sys_close       = aout_SysClose;
+}
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
index c0b77ed..fda4744 100644 (file)
@@ -40,8 +40,8 @@
 
 #include "intf_msg.h"
 
-#define WIDTH 128
-#define HEIGHT 64
+#define WIDTH 16
+#define HEIGHT 16
 #define BITS_PER_PLANE 16
 #define BYTES_PER_PIXEL 2
 
diff --git a/plugins/esd/esd.c b/plugins/esd/esd.c
new file mode 100644 (file)
index 0000000..afde060
--- /dev/null
@@ -0,0 +1,91 @@
+/*****************************************************************************
+ * esd.c : Esound plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void aout_GetPlugin( p_aout_thread_t p_aout );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "Esound";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = aout_GetPlugin;
+    p_info->vout_GetPlugin = NULL;
+    p_info->intf_GetPlugin = NULL;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: check if suitable */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void aout_GetPlugin( p_aout_thread_t p_aout )
+{
+    p_aout->p_sys_open        = aout_SysOpen;
+    p_aout->p_sys_reset       = aout_SysReset;
+    p_aout->p_sys_setformat   = aout_SysSetFormat;
+    p_aout->p_sys_setchannels = aout_SysSetChannels;
+    p_aout->p_sys_setrate     = aout_SysSetRate;
+    p_aout->p_sys_getbufinfo  = aout_SysGetBufInfo;
+    p_aout->p_sys_playsamples = aout_SysPlaySamples;
+    p_aout->p_sys_close       = aout_SysClose;
+}
+
diff --git a/plugins/fb/fb.c b/plugins/fb/fb.c
new file mode 100644 (file)
index 0000000..836d82a
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * fb.c : Linux framebuffer plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "Linux framebuffer";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: detect the framebuffer ioctl()s in the kernel */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+    
+    /* optional functions */
+    p_vout->p_set_palette = vout_SetPalette;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
index c60bac2..348b3cc 100644 (file)
@@ -104,9 +104,14 @@ int intf_SysCreate( intf_thread_t *p_intf )
 
     /* set keyboard settings */
     if (tcgetattr(0, &p_intf->p_sys->old_termios) == -1)
+    {
         intf_ErrMsg( "intf error: tcgetattr" );
+    }
+
     if (tcgetattr(0, &p_intf->p_sys->new_termios) == -1)
+    {
         intf_ErrMsg( "intf error: tcgetattr" );
+    }
 
     p_intf->p_sys->new_termios.c_lflag &= ~ (ICANON | ISIG);
     p_intf->p_sys->new_termios.c_lflag |= (ECHO | ECHOCTL);
@@ -115,7 +120,9 @@ int intf_SysCreate( intf_thread_t *p_intf )
     p_intf->p_sys->new_termios.c_cc[VTIME] = 0;
 
     if (tcsetattr(0, TCSAFLUSH, &p_intf->p_sys->new_termios) == -1)
+    {
         intf_ErrMsg( "intf error: tcsetattr" );
+    }
 
     ioctl(p_intf->p_sys->i_tty_dev, VT_RELDISP, VT_ACKACQ);
 
@@ -126,17 +133,22 @@ int intf_SysCreate( intf_thread_t *p_intf )
     if( sigaction( SIGUSR1, &sig_tty, &p_intf->p_sys->sig_usr1 ) ||
         sigaction( SIGUSR2, &sig_tty, &p_intf->p_sys->sig_usr2 ) )
     {
-        intf_ErrMsg("intf error: can't set up signal handler (%s)\n", strerror(errno) );
+        intf_ErrMsg( "intf error: can't set up signal handler (%s)\n",
+                     strerror(errno) );
+        tcsetattr(0, 0, &p_intf->p_sys->old_termios);
         FBTextMode( p_intf->p_sys->i_tty_dev );
         return( 1 );
     }
 
     /* Set-up tty according to new signal handler */
-    if( ioctl(p_intf->p_sys->i_tty_dev, VT_GETMODE, &p_intf->p_sys->vt_mode) == -1 )
+    if( ioctl(p_intf->p_sys->i_tty_dev, VT_GETMODE, &p_intf->p_sys->vt_mode)
+        == -1 )
     {
-        intf_ErrMsg("intf error: cant get terminal mode (%s)\n", strerror(errno) );
+        intf_ErrMsg( "intf error: cant get terminal mode (%s)\n",
+                     strerror(errno) );
         sigaction( SIGUSR1, &p_intf->p_sys->sig_usr1, NULL );
         sigaction( SIGUSR2, &p_intf->p_sys->sig_usr2, NULL );
+        tcsetattr(0, 0, &p_intf->p_sys->old_termios);
         FBTextMode( p_intf->p_sys->i_tty_dev );
         return( 1 );
     }
@@ -148,9 +160,11 @@ int intf_SysCreate( intf_thread_t *p_intf )
 
     if( ioctl(p_intf->p_sys->i_tty_dev, VT_SETMODE, &vt_mode) == -1 )
     {
-        intf_ErrMsg("intf error: can't set terminal mode (%s)\n", strerror(errno) );
+        intf_ErrMsg( "intf error: can't set terminal mode (%s)\n",
+                     strerror(errno) );
         sigaction( SIGUSR1, &p_intf->p_sys->sig_usr1, NULL );
         sigaction( SIGUSR2, &p_intf->p_sys->sig_usr2, NULL );
+        tcsetattr(0, 0, &p_intf->p_sys->old_termios);
         FBTextMode( p_intf->p_sys->i_tty_dev );
         return( 1 );
     }
@@ -160,14 +174,17 @@ int intf_SysCreate( intf_thread_t *p_intf )
     {
         p_intf->p_vout = vout_CreateThread( NULL, 0,
                                             p_intf->p_sys->i_width,
-                                            p_intf->p_sys->i_height, NULL, 0, NULL );
+                                            p_intf->p_sys->i_height,
+                                            NULL, 0, NULL );
         if( p_intf->p_vout == NULL )                          /* XXX?? error */
         {
             intf_ErrMsg("intf error: can't create output thread\n" );
-            ioctl(p_intf->p_sys->i_tty_dev, VT_SETMODE, &p_intf->p_sys->vt_mode);
+            ioctl( p_intf->p_sys->i_tty_dev, VT_SETMODE,
+                   &p_intf->p_sys->vt_mode );
             sigaction( SIGUSR1, &p_intf->p_sys->sig_usr1, NULL );
             sigaction( SIGUSR2, &p_intf->p_sys->sig_usr2, NULL );
             free( p_intf->p_sys );
+            tcsetattr(0, 0, &p_intf->p_sys->old_termios);
             FBTextMode( p_intf->p_sys->i_tty_dev );
             return( 1 );
         }
@@ -224,8 +241,8 @@ void intf_SysManage( intf_thread_t *p_intf )
 /*****************************************************************************
  * FBSwitchDisplay: VT change signal handler
  *****************************************************************************
- * This function activate or desactivate the output of the thread. It is called
- * by the VT driver, on terminal change.
+ * This function activates or deactivates the output of the thread. It is
+ * called by the VT driver, on terminal change.
  *****************************************************************************/
 static void FBSwitchDisplay(int i_signal)
 {
index 228ff35..15c1e77 100644 (file)
@@ -73,8 +73,6 @@ typedef struct vout_sys_s
  *****************************************************************************/
 static int     FBOpenDisplay   ( vout_thread_t *p_vout );
 static void    FBCloseDisplay  ( vout_thread_t *p_vout );
-static void    FBSetPalette    ( p_vout_thread_t p_vout,
-                                 u16 *red, u16 *green, u16 *blue, u16 *transp );
 
 /*****************************************************************************
  * vout_SysCreate: allocates FB video thread output method
@@ -108,7 +106,6 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
  *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
-    p_vout->p_set_palette       = FBSetPalette;
     return( 0 );
 }
 
@@ -186,6 +183,20 @@ void vout_SysDisplay( vout_thread_t *p_vout )
     ioctl( p_vout->p_sys->i_fb_dev, FBIOPAN_DISPLAY, &p_vout->p_sys->var_info );
 }
 
+/*****************************************************************************
+ * vout_SetPalette: sets an 8 bpp palette
+ *****************************************************************************
+ * This function sets the palette given as an argument. It does not return
+ * anything, but could later send information on which colors it was unable
+ * to set.
+ *****************************************************************************/
+void vout_SetPalette( p_vout_thread_t p_vout,
+                      u16 *red, u16 *green, u16 *blue, u16 *transp )
+{
+    struct fb_cmap cmap = { 0, 256, red, green, blue, transp };
+    ioctl( p_vout->p_sys->i_fb_dev, FBIOPUTCMAP, &cmap );
+}
+
 /* following functions are local */
 
 /*****************************************************************************
@@ -349,17 +360,4 @@ static void FBCloseDisplay( vout_thread_t *p_vout )
     close( p_vout->p_sys->i_fb_dev );
 }
 
-/*****************************************************************************
- * FBSetPalette: sets an 8 bpp palette
- *****************************************************************************
- * This function sets the palette given as an argument. It does not return
- * anything, but could later send information on which colors it was unable
- * to set.
- *****************************************************************************/
-static void    FBSetPalette   ( p_vout_thread_t p_vout,
-                                u16 *red, u16 *green, u16 *blue, u16 *transp )
-{
-    struct fb_cmap cmap = { 0, 256, red, green, blue, transp };
-    ioctl( p_vout->p_sys->i_fb_dev, FBIOPUTCMAP, &cmap );
-}
 
diff --git a/plugins/ggi/ggi.c b/plugins/ggi/ggi.c
new file mode 100644 (file)
index 0000000..2ff0e10
--- /dev/null
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * ggi.c : GGI plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "GGI";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: detect GGI_DISPLAY or whatever */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
index d1eac68..c22d507 100644 (file)
@@ -100,8 +100,6 @@ int intf_SysCreate( intf_thread_t *p_intf )
                                         NULL, 0,
                                         (void *)&p_intf->p_sys->p_display );
 
-    fprintf(stderr, "display is %i\n", p_intf->p_sys->p_display);
-    
     if( p_intf->p_vout == NULL )                                  /* error */
     {
         intf_ErrMsg("error: can't create video output thread\n" );
index 873f335..e3cdd9f 100644 (file)
@@ -203,7 +203,6 @@ static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat
     }
 
     /* give the data back to the interface */
-    fprintf(stderr, "display is %i\n", p_vout->p_sys->p_display);
     *(ggi_visual_t *)p_data = p_vout->p_sys->p_display;
 
     /* Find most appropriate mode */
@@ -237,7 +236,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat
     {
         /* Get buffer address */
         p_vout->p_sys->p_buffer[ i_index ] =
-            ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
+            (ggi_directbuffer *)ggiDBGetBuffer( p_vout->p_sys->p_display, i_index );
         if( p_vout->p_sys->p_buffer[ i_index ] == NULL )
         {
             intf_ErrMsg("error: double buffering is not possible\n");
diff --git a/plugins/glide/glide.c b/plugins/glide/glide.c
new file mode 100644 (file)
index 0000000..cf9ed83
--- /dev/null
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * glide.c : 3dfx Glide plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "3dfx Glide";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: detect a 3dfx card */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
diff --git a/plugins/gnome/gnome.c b/plugins/gnome/gnome.c
new file mode 100644 (file)
index 0000000..fe626e5
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * gnome.c : Gnome plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "Gnome";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: detect an X display or Gnome libs */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+
+    /* optional functions */
+    p_vout->p_set_palette = vout_SetPalette;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
index 3dcbbd9..eec5eda 100644 (file)
@@ -89,8 +89,6 @@ static int  X11CreateShmImage   ( vout_thread_t *p_vout, XImage **pp_ximage,
                                   XShmSegmentInfo *p_shm_info );
 static void X11DestroyShmImage  ( vout_thread_t *p_vout, XImage *p_ximage,
                                   XShmSegmentInfo *p_shm_info );
-static void X11SetPalette       ( p_vout_thread_t p_vout,
-                                  u16 *red, u16 *green, u16 *blue, u16 *transp );
 
 /*****************************************************************************
  * vout_SysCreate: allocate X11 video thread output method
@@ -134,9 +132,6 @@ int vout_SysInit( vout_thread_t *p_vout )
 {
     int i_err;
 
-    /* Initialize palette changing procedure */
-    p_vout->p_set_palette       = X11SetPalette;
-
     /* Create XImages using XShm extension - on failure, fall back to regular
      * way (and destroy the first image if it was created successfully) */
     if( p_vout->p_sys->b_shm )
@@ -157,7 +152,7 @@ int vout_SysInit( vout_thread_t *p_vout )
         }
         if( i_err )                                      /* an error occured */
         {
-            intf_Msg("XShm video sextension desactivated\n" );
+            intf_Msg("XShm video extension deactivated\n" );
             p_vout->p_sys->b_shm = 0;
         }
     }
@@ -303,6 +298,37 @@ void vout_SysDisplay( vout_thread_t *p_vout )
     }
 }
 
+/*****************************************************************************
+ * vout_SetPalette: sets an 8 bpp palette
+ *****************************************************************************
+ * This function sets the palette given as an argument. It does not return
+ * anything, but could later send information on which colors it was unable
+ * to set.
+ *****************************************************************************/
+void vout_SetPalette( p_vout_thread_t p_vout,
+                      u16 *red, u16 *green, u16 *blue, u16 *transp )
+{
+    int i;
+    XColor color[255];
+
+    intf_DbgMsg( "Palette change called\n" );
+
+    /* allocate palette */
+    for( i = 0; i < 255; i++ )
+    {
+        /* kludge: colors are indexed reversely because color 255 seems
+         * to be reserved for black even if we try to set it to white */
+        color[i].pixel = 255-i;
+        color[i].pad = 0;
+        color[i].flags = DoRed|DoGreen|DoBlue;
+        color[i].red = red[255-i];
+        color[i].blue = blue[255-i];
+        color[i].green = green[255-i];
+    }
+
+    XStoreColors( p_vout->p_sys->p_display, p_vout->p_sys->colormap, color, 256 );
+}
+
 /* following functions are local */
 
 /*****************************************************************************
@@ -659,34 +685,4 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
     }
 }
 
-/*****************************************************************************
- * X11SetPalette: sets an 8 bpp palette
- *****************************************************************************
- * This function sets the palette given as an argument. It does not return
- * anything, but could later send information on which colors it was unable
- * to set.
- *****************************************************************************/
-static void X11SetPalette       ( p_vout_thread_t p_vout,
-                                  u16 *red, u16 *green, u16 *blue, u16 *transp )
-{
-    int i;
-    XColor color[255];
-
-    intf_DbgMsg( "Palette change called\n" );
-
-    /* allocate palette */
-    for( i = 0; i < 255; i++ )
-    {
-        /* kludge: colors are indexed reversely because color 255 seems
-         * to be reserved for black even if we try to set it to white */
-        color[i].pixel = 255-i;
-        color[i].pad = 0;
-        color[i].flags = DoRed|DoGreen|DoBlue;
-        color[i].red = red[255-i];
-        color[i].blue = blue[255-i];
-        color[i].green = green[255-i];
-    }
-
-    XStoreColors( p_vout->p_sys->p_display, p_vout->p_sys->colormap, color, 256 );
-}
 
diff --git a/plugins/mga/mga.c b/plugins/mga/mga.c
new file mode 100644 (file)
index 0000000..10b4801
--- /dev/null
@@ -0,0 +1,97 @@
+/*****************************************************************************
+ * mga.c : Matrox Graphic Array plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "Matrox Acceleration";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: detect an MGA card ? */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
index dcf387a..a8a59d1 100644 (file)
@@ -112,7 +112,7 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display,
  *****************************************************************************/
 int vout_SysInit( vout_thread_t *p_vout )
 {
-    int i_err, i_dummy;
+    int i_err;
 
     /* create the MGA output */
     p_vout->p_sys->p_mga->src_width = p_vout->i_width;
@@ -180,7 +180,7 @@ int vout_SysInit( vout_thread_t *p_vout )
         }
         if( i_err )                                      /* an error occured */
         {
-            intf_Msg("XShm video sextension desactivated\n" );
+            intf_Msg("XShm video sextension deactivated\n" );
             p_vout->p_sys->b_shm = 0;
         }
     }
index 14be4a5..20031dd 100644 (file)
@@ -89,8 +89,6 @@ static int  X11CreateShmImage   ( vout_thread_t *p_vout, XImage **pp_ximage,
                                   XShmSegmentInfo *p_shm_info );
 static void X11DestroyShmImage  ( vout_thread_t *p_vout, XImage *p_ximage,
                                   XShmSegmentInfo *p_shm_info );
-static void X11SetPalette       ( p_vout_thread_t p_vout,
-                                  u16 *red, u16 *green, u16 *blue, u16 *transp );
 
 /*****************************************************************************
  * vout_SysCreate: allocate X11 video thread output method
@@ -134,9 +132,6 @@ int vout_SysInit( vout_thread_t *p_vout )
 {
     int i_err;
 
-    /* Initialize palette changing procedure */
-    p_vout->p_set_palette       = X11SetPalette;
-
     /* Create XImages using XShm extension - on failure, fall back to regular
      * way (and destroy the first image if it was created successfully) */
     if( p_vout->p_sys->b_shm )
@@ -157,7 +152,7 @@ int vout_SysInit( vout_thread_t *p_vout )
         }
         if( i_err )                                      /* an error occured */
         {
-            intf_Msg("XShm video sextension desactivated\n" );
+            intf_Msg("XShm video sextension deactivated\n" );
             p_vout->p_sys->b_shm = 0;
         }
     }
@@ -234,7 +229,8 @@ int vout_SysManage( vout_thread_t *p_vout )
     /*
      * Color/Grayscale or gamma change: in 8bpp, just change the colormap
      */
-    if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE) && (p_vout->i_screen_depth == 8) )
+    if( (p_vout->i_changes & VOUT_GRAYSCALE_CHANGE)
+        && (p_vout->i_screen_depth == 8) )
     {
         /* FIXME: clear flags ?? */
     }
@@ -262,7 +258,8 @@ int vout_SysManage( vout_thread_t *p_vout )
         }
 
         /* Tell the video output thread that it will need to rebuild YUV
-         * tables. This is needed since conversion buffer size may have changed */
+         * tables. This is needed since conversion buffer size may have
+        * changed */
         p_vout->i_changes |= VOUT_YUV_CHANGE;
         intf_Msg("Video display resized (%dx%d)\n", p_vout->i_width, p_vout->i_height);
     }
@@ -303,6 +300,37 @@ void vout_SysDisplay( vout_thread_t *p_vout )
     }
 }
 
+/*****************************************************************************
+ * vout_SetPalette: sets an 8 bpp palette
+ *****************************************************************************
+ * This function sets the palette given as an argument. It does not return
+ * anything, but could later send information on which colors it was unable
+ * to set.
+ *****************************************************************************/
+void vout_SetPalette( p_vout_thread_t p_vout,
+                      u16 *red, u16 *green, u16 *blue, u16 *transp )
+{
+    int i;
+    XColor color[255];
+
+    intf_DbgMsg( "Palette change called\n" );
+
+    /* allocate palette */
+    for( i = 0; i < 255; i++ )
+    {
+        /* kludge: colors are indexed reversely because color 255 seems
+         * to be reserved for black even if we try to set it to white */
+        color[i].pixel = 255-i;
+        color[i].pad = 0;
+        color[i].flags = DoRed|DoGreen|DoBlue;
+        color[i].red = red[255-i];
+        color[i].blue = blue[255-i];
+        color[i].green = green[255-i];
+    }
+
+    XStoreColors( p_vout->p_sys->p_display, p_vout->p_sys->colormap, color, 256 );
+}
+
 /* following functions are local */
 
 /*****************************************************************************
@@ -661,34 +689,4 @@ static void X11DestroyShmImage( vout_thread_t *p_vout, XImage *p_ximage,
     }
 }
 
-/*****************************************************************************
- * X11SetPalette: sets an 8 bpp palette
- *****************************************************************************
- * This function sets the palette given as an argument. It does not return
- * anything, but could later send information on which colors it was unable
- * to set.
- *****************************************************************************/
-static void X11SetPalette       ( p_vout_thread_t p_vout,
-                                  u16 *red, u16 *green, u16 *blue, u16 *transp )
-{
-    int i;
-    XColor color[255];
-
-    intf_DbgMsg( "Palette change called\n" );
-
-    /* allocate palette */
-    for( i = 0; i < 255; i++ )
-    {
-        /* kludge: colors are indexed reversely because color 255 seems
-         * to be reserved for black even if we try to set it to white */
-        color[i].pixel = 255-i;
-        color[i].pad = 0;
-        color[i].flags = DoRed|DoGreen|DoBlue;
-        color[i].red = red[255-i];
-        color[i].blue = blue[255-i];
-        color[i].green = green[255-i];
-    }
-
-    XStoreColors( p_vout->p_sys->p_display, p_vout->p_sys->colormap, color, 256 );
-}
 
diff --git a/plugins/x11/x11.c b/plugins/x11/x11.c
new file mode 100644 (file)
index 0000000..3a104d3
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * x11.c : X11 plugin for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void vout_GetPlugin( p_vout_thread_t p_vout );
+void intf_GetPlugin( p_intf_thread_t p_intf );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "X Window System";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = vout_GetPlugin;
+    p_info->intf_GetPlugin = intf_GetPlugin;
+    p_info->yuv_GetPlugin  = NULL;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    /* TODO: detect an X display */
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void vout_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_sys_create  = vout_SysCreate;
+    p_vout->p_sys_init    = vout_SysInit;
+    p_vout->p_sys_end     = vout_SysEnd;
+    p_vout->p_sys_destroy = vout_SysDestroy;
+    p_vout->p_sys_manage  = vout_SysManage;
+    p_vout->p_sys_display = vout_SysDisplay;
+
+    /* optional functions */
+    p_vout->p_set_palette = vout_SetPalette;
+}
+
+void intf_GetPlugin( p_intf_thread_t p_intf )
+{
+    p_intf->p_sys_create  = intf_SysCreate;
+    p_intf->p_sys_destroy = intf_SysDestroy;
+    p_intf->p_sys_manage  = intf_SysManage;
+}
+
diff --git a/plugins/yuv/video_yuv.c b/plugins/yuv/video_yuv.c
new file mode 100644 (file)
index 0000000..20a43e2
--- /dev/null
@@ -0,0 +1,526 @@
+/*****************************************************************************
+ * video_yuv.c: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * Constants
+ *****************************************************************************/
+
+int     yuv_SysInit     ( vout_thread_t *p_vout );
+int     yuv_SysReset    ( vout_thread_t *p_vout );
+void    yuv_SysEnd      ( vout_thread_t *p_vout );
+
+/*****************************************************************************
+ * vout_InitYUV: allocate and initialize translations tables
+ *****************************************************************************
+ * This function will allocate memory to store translation tables, depending
+ * of the screen depth.
+ *****************************************************************************/
+int yuv_SysInit( vout_thread_t *p_vout )
+{
+    size_t      tables_size;                        /* tables size, in bytes */
+
+    /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
+    switch( p_vout->i_bytes_per_pixel )
+    {
+    case 1:
+        tables_size = sizeof( u8 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
+        break;
+    case 2:
+        tables_size = sizeof( u16 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
+    case 3:
+    case 4:
+    default:
+        tables_size = sizeof( u32 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
+    }
+
+    /* Allocate memory */
+    p_vout->yuv.p_base = malloc( tables_size );
+    if( p_vout->yuv.p_base == NULL )
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
+        return( 1 );
+    }
+
+    /* Allocate memory for conversion buffer and offset array */
+    p_vout->yuv.p_buffer = malloc( VOUT_MAX_WIDTH * p_vout->i_bytes_per_pixel );
+    if( p_vout->yuv.p_buffer == NULL )
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
+        free( p_vout->yuv.p_base );
+        return( 1 );
+    }
+    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) );
+    if( p_vout->yuv.p_offset == NULL )
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
+        free( p_vout->yuv.p_base );
+        free( p_vout->yuv.p_buffer );
+        return( 1 );
+    }
+
+    /* Initialize tables */
+    SetYUV( p_vout );
+    return( 0 );
+}
+
+/*****************************************************************************
+ * yuv_SysReset: re-initialize translations tables
+ *****************************************************************************
+ * This function will initialize the tables allocated by vout_CreateTables and
+ * set functions pointers.
+ *****************************************************************************/
+int yuv_SysReset( vout_thread_t *p_vout )
+{
+    yuv_SysEnd( p_vout );
+    return( yuv_SysInit( p_vout ) );
+}
+
+/*****************************************************************************
+ * yuv_SysEnd: destroy translations tables
+ *****************************************************************************
+ * Free memory allocated by yuv_SysCreate.
+ *****************************************************************************/
+void yuv_SysEnd( vout_thread_t *p_vout )
+{
+    free( p_vout->yuv.p_base );
+    free( p_vout->yuv.p_buffer );
+    free( p_vout->yuv.p_offset );
+}
+
+/* following functions are local */
+
+/*****************************************************************************
+ * SetGammaTable: return intensity table transformed by gamma curve.
+ *****************************************************************************
+ * pi_table is a table of 256 entries from 0 to 255.
+ *****************************************************************************/
+void SetGammaTable( int *pi_table, double f_gamma )
+{
+    int         i_y;                                       /* base intensity */
+
+    /* Use exp(gamma) instead of gamma */
+    f_gamma = exp( f_gamma );
+
+    /* Build gamma table */
+    for( i_y = 0; i_y < 256; i_y++ )
+    {
+        pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
+    }
+ }
+
+/*****************************************************************************
+ * SetYUV: compute tables and set function pointers
++ *****************************************************************************/
+void SetYUV( vout_thread_t *p_vout )
+{
+    int         pi_gamma[256];                                /* gamma table */
+    int         i_index;                                  /* index in tables */
+
+    /* Build gamma table */
+    SetGammaTable( pi_gamma, p_vout->f_gamma );
+
+    /*
+     * Set pointers and build YUV tables
+     */
+    if( p_vout->b_grayscale )
+    {
+        /* Grayscale: build gray table */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            {
+                u16 bright[256], transp[256];
+
+                p_vout->yuv.yuv.p_gray8 =  (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
+                for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+                {
+                    p_vout->yuv.yuv.p_gray8[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                    p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+                }
+                for( i_index = 0; i_index < 256; i_index++)
+                {
+                    p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
+                    bright[ i_index ] = i_index << 8;
+                    transp[ i_index ] = 0;
+                }
+                /* the colors have been allocated, we can set the palette */
+                p_vout->p_set_palette( p_vout, bright, bright, bright, transp );
+                p_vout->i_white_pixel = 0xff;
+                p_vout->i_black_pixel = 0x00;
+                p_vout->i_gray_pixel = 0x44;
+                p_vout->i_blue_pixel = 0x3b;
+
+                break;
+            }
+        case 2:
+            p_vout->yuv.yuv.p_gray16 =  (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
+            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_gray16[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++)
+            {
+                p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+            }
+            break;
+        case 3:
+        case 4:
+            p_vout->yuv.yuv.p_gray32 =  (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
+            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_gray32[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++)
+            {
+                p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+            }
+            break;
+         }
+    }
+    else
+    {
+        /* Color: build red, green and blue tables */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            {
+                #define RGB_MIN 0
+                #define RGB_MAX 255
+                #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
+
+                int y,u,v;
+                int r,g,b;
+                int uvr, uvg, uvb;
+                int i = 0, j = 0;
+                u16 red[256], green[256], blue[256], transp[256];
+                unsigned char lookup[PALETTE_TABLE_SIZE];
+
+                p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
+
+                /* this loop calculates the intersection of an YUV box
+                 * and the RGB cube. */
+                for ( y = 0; y <= 256; y += 16 )
+                {
+                    for ( u = 0; u <= 256; u += 32 )
+                    for ( v = 0; v <= 256; v += 32 )
+                    {
+                        uvr = (V_RED_COEF*(v-128)) >> SHIFT;
+                        uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
+                        uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
+                        r = y + uvr;
+                        g = y + uvg;
+                        b = y + uvb;
+
+                        if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
+                                && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
+                        {
+                            /* this one should never happen unless someone fscked up my code */
+                            if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette\n" ); break; }
+
+                            /* clip the colors */
+                            red[j] = CLIP( r );
+                            green[j] = CLIP( g );
+                            blue[j] = CLIP( b );
+                            transp[j] = 0;
+
+                            /* allocate color */
+                            lookup[i] = 1;
+                            p_vout->yuv.yuv.p_rgb8[i++] = j;
+                            j++;
+                        }
+                        else
+                        {
+                            lookup[i] = 0;
+                            p_vout->yuv.yuv.p_rgb8[i++] = 0;
+                        }
+                    }
+                    i += 128-81;
+                }
+
+                /* the colors have been allocated, we can set the palette */
+                /* there will eventually be a way to know which colors
+                 * couldn't be allocated and try to find a replacement */
+                p_vout->p_set_palette( p_vout, red, green, blue, transp );
+
+                p_vout->i_white_pixel = 0xff;
+                p_vout->i_black_pixel = 0x00;
+                p_vout->i_gray_pixel = 0x44;
+                p_vout->i_blue_pixel = 0x3b;
+
+                i = 0;
+                /* this loop allocates colors that got outside
+                 * the RGB cube */
+                for ( y = 0; y <= 256; y += 16 )
+                {
+                    for ( u = 0; u <= 256; u += 32 )
+                    for ( v = 0; v <= 256; v += 32 )
+                    {
+                        int u2, v2;
+                        int dist, mindist = 100000000;
+
+                        if( lookup[i] || y==0)
+                        {
+                            i++;
+                            continue;
+                        }
+
+                        /* heavy. yeah. */
+                        for( u2 = 0; u2 <= 256; u2 += 32 )
+                        for( v2 = 0; v2 <= 256; v2 += 32 )
+                        {
+                            j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
+                            dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
+                            if( lookup[j] )
+                            /* find the nearest color */
+                            if( dist < mindist )
+                            {
+                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
+                                mindist = dist;
+                            }
+                            j -= 128;
+                            if( lookup[j] )
+                            /* find the nearest color */
+                            if( dist + 128 < mindist )
+                            {
+                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
+                                mindist = dist + 128;
+                            }
+                        }
+                        i++;
+                    }
+                    i += 128-81;
+                }
+
+                break;
+            }
+        case 2:
+            p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
+            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+            }
+            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+            }
+            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
+        case 3:
+        case 4:
+            p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
+            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+            }
+            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+            }
+            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
+        }
+    }
+
+    /*
+     * Set functions pointers
+     */
+    if( p_vout->b_grayscale )
+    {
+        /* Grayscale */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            break;
+        case 2:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            break;
+        case 3:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            break;
+        }
+    }
+    else
+    {
+        /* Color */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB8;
+            break;
+        case 2:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB16;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB16;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB16;
+            break;
+        case 3:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB24;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB24;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB32;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB32;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB32;
+            break;
+        }
+    }
+}
+
+/*****************************************************************************
+ * SetOffset: build offset array for conversion functions
+ *****************************************************************************
+ * This function will build an offset array used in later conversion functions.
+ * It will also set horizontal and vertical scaling indicators.
+ *****************************************************************************/
+void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
+                boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset )
+{
+    int i_x;                                    /* x position in destination */
+    int i_scale_count;                                     /* modulo counter */
+
+    /*
+     * Prepare horizontal offset array
+     */
+    if( i_pic_width - i_width > 0 )
+    {
+        /* Prepare scaling array for horizontal extension */
+        *pb_h_scaling =  1;
+        i_scale_count =         i_pic_width;
+        for( i_x = i_width; i_x--; )
+        {
+            while( (i_scale_count -= i_width) > 0 )
+            {
+                *p_offset++ = 0;
+            }
+            *p_offset++ = 1;
+            i_scale_count += i_pic_width;
+        }
+    }
+    else if( i_pic_width - i_width < 0 )
+    {
+        /* Prepare scaling array for horizontal reduction */
+        *pb_h_scaling =  1;
+        i_scale_count =         i_pic_width;
+        for( i_x = i_pic_width; i_x--; )
+        {
+            *p_offset = 1;
+            while( (i_scale_count -= i_pic_width) >= 0 )
+            {
+                *p_offset += 1;
+            }
+            p_offset++;
+            i_scale_count += i_width;
+        }
+    }
+    else
+    {
+        /* No horizontal scaling: YUV conversion is done directly to picture */
+        *pb_h_scaling = 0;
+    }
+
+    /*
+     * Set vertical scaling indicator
+     */
+    if( i_pic_height - i_height > 0 )
+    {
+        *pi_v_scaling = 1;
+    }
+    else if( i_pic_height - i_height < 0 )
+    {
+        *pi_v_scaling = -1;
+    }
+    else
+    {
+        *pi_v_scaling = 0;
+    }
+}
+
diff --git a/plugins/yuv/video_yuv.h b/plugins/yuv/video_yuv.h
new file mode 100644 (file)
index 0000000..3d7feff
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * video_yuv.h: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Constants
+ *****************************************************************************/
+
+/* Margins and offsets in conversion tables - Margins are used in case a RGB
+ * RGB conversion would give a value outside the 0-255 range. Offsets have been
+ * calculated to avoid using the same cache line for 2 tables. conversion tables
+ * are 2*MARGIN + 256 long and stores pixels.*/
+#define RED_MARGIN      178
+#define GREEN_MARGIN    135
+#define BLUE_MARGIN     224
+#define RED_OFFSET      1501                                 /* 1323 to 1935 */
+#define GREEN_OFFSET    135                                      /* 0 to 526 */
+#define BLUE_OFFSET     818                                   /* 594 to 1298 */
+#define RGB_TABLE_SIZE  1935                             /* total table size */
+
+#define GRAY_MARGIN     384
+#define GRAY_TABLE_SIZE 1024                             /* total table size */
+
+#define PALETTE_TABLE_SIZE 2176          /* YUV -> 8bpp palette lookup table */
+
+/* macros used for YUV pixel conversions */
+#define SHIFT 20
+#define U_GREEN_COEF    ((int)(-0.391 * (1<<SHIFT) / 1.164))
+#define U_BLUE_COEF     ((int)(2.018 * (1<<SHIFT) / 1.164))
+#define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
+#define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
+
+/* argument lists for YUV functions */
+#define YUV_ARGS_8BPP p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+#define YUV_ARGS_16BPP p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+#define YUV_ARGS_24BPP p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+#define YUV_ARGS_32BPP p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+void SetGammaTable        ( int *pi_table, double f_gamma );
+void SetYUV               ( vout_thread_t *p_vout );
+void SetOffset            ( int i_width, int i_height, int i_pic_width,
+                            int i_pic_height, boolean_t *pb_h_scaling,
+                            int *pi_v_scaling, int *p_offset );
+
+void ConvertY4Gray8       ( YUV_ARGS_8BPP );
+void ConvertYUV420RGB8    ( YUV_ARGS_8BPP );
+void ConvertYUV422RGB8    ( YUV_ARGS_8BPP );
+void ConvertYUV444RGB8    ( YUV_ARGS_8BPP );
+
+void ConvertY4Gray16      ( YUV_ARGS_16BPP );
+void ConvertYUV420RGB16   ( YUV_ARGS_16BPP );
+void ConvertYUV422RGB16   ( YUV_ARGS_16BPP );
+void ConvertYUV444RGB16   ( YUV_ARGS_16BPP );
+
+void ConvertY4Gray24      ( YUV_ARGS_24BPP );
+void ConvertYUV420RGB24   ( YUV_ARGS_24BPP );
+void ConvertYUV422RGB24   ( YUV_ARGS_24BPP );
+void ConvertYUV444RGB24   ( YUV_ARGS_24BPP );
+
+void ConvertY4Gray32      ( YUV_ARGS_32BPP );
+void ConvertYUV420RGB32   ( YUV_ARGS_32BPP );
+void ConvertYUV422RGB32   ( YUV_ARGS_32BPP );
+void ConvertYUV444RGB32   ( YUV_ARGS_32BPP );
+
diff --git a/plugins/yuv/video_yuv15.c b/plugins/yuv/video_yuv15.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/plugins/yuv/video_yuv16.c b/plugins/yuv/video_yuv16.c
new file mode 100644 (file)
index 0000000..7fec511
--- /dev/null
@@ -0,0 +1,291 @@
+/*****************************************************************************
+ * video_yuv16.c: YUV transformation functions for 16bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+#include "video_yuv_macros.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray16: grayscale YUV 4:x:x to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u16 *       p_gray;                             /* base conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(420, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_Y_PIXEL(2);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(422, 2);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_ybase;                     /* Y dependant conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+            CONVERT_YUV_PIXEL(2);  CONVERT_YUV_PIXEL(2);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(444, 2);
+    }
+}
+
diff --git a/plugins/yuv/video_yuv24.c b/plugins/yuv/video_yuv24.c
new file mode 100644 (file)
index 0000000..7a77686
--- /dev/null
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * video_yuv24.c: YUV transformation functions for 24 bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+#include "video_yuv_macros.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, grayscale, bpp = 24\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 420, bpp = 24\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 24\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 24\n" );
+}
+
diff --git a/plugins/yuv/video_yuv32.c b/plugins/yuv/video_yuv32.c
new file mode 100644 (file)
index 0000000..b63da92
--- /dev/null
@@ -0,0 +1,291 @@
+/*****************************************************************************
+ * video_yuv32.c: YUV transformation functions for 32 bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+#include "video_yuv_macros.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertY4Gray32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u32 *       p_gray;                             /* base conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 4);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_ybase;                     /* Y dependant conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(420, 4);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                              /* chroma width */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_ybase;                     /* Y dependant conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_Y_PIXEL(4);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(422, 4);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_uval, i_vval;                           /* U and V samples */
+    int         i_red, i_green, i_blue;          /* U and V modified samples */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_ybase;                     /* Y dependant conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+            CONVERT_YUV_PIXEL(4);  CONVERT_YUV_PIXEL(4);
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(444, 4);
+    }
+}
+
diff --git a/plugins/yuv/video_yuv8.c b/plugins/yuv/video_yuv8.c
new file mode 100644 (file)
index 0000000..15c6b8d
--- /dev/null
@@ -0,0 +1,176 @@
+/*****************************************************************************
+ * video_yuv8.c: YUV transformation functions for 8bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+#include "video_yuv_macros.h"
+#include "video_yuv_macros_8bpp.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
+ *****************************************************************************/
+void ConvertY4Gray8( YUV_ARGS_8BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                    /* chroma width, not used */
+    u8 *        p_gray;                             /* base conversion table */
+    u8 *        p_pic_start;       /* beginning of the current line for copy */
+    u8 *        p_buffer_start;                   /* conversion buffer start */
+    u8 *        p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    p_gray =            p_vout->yuv.yuv.p_gray8;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        /* Do YUV conversion to buffer - YUV picture is always formed of 16
+         * pixels wide blocks */
+        for( i_x = i_width / 16; i_x--;  )
+        {
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+            *p_buffer++ = p_gray[ *p_y++ ]; *p_buffer++ = p_gray[ *p_y++ ];
+        }
+
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH;
+        SCALE_HEIGHT(400, 1);
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV420RGB8( YUV_ARGS_8BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         b_jump_uv;                       /* should we jump u and v ? */
+    int         i_real_y;                                           /* y % 4 */
+    u8 *        p_lookup;                                    /* lookup table */
+    int         i_chroma_width;                              /* chroma width */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /* 
+     * The dither matrices
+     */
+    int dither10[4] = {  0x0,  0x8,  0x2,  0xa };
+    int dither11[4] = {  0xc,  0x4,  0xe,  0x6 };
+    int dither12[4] = {  0x3,  0xb,  0x1,  0x9 };
+    int dither13[4] = {  0xf,  0x7,  0xd,  0x5 };
+
+    int dither20[4] = {  0x0, 0x10,  0x4, 0x14 };
+    int dither21[4] = { 0x18,  0x8, 0x1c,  0xc };
+    int dither22[4] = {  0x6, 0x16,  0x2, 0x12 };
+    int dither23[4] = { 0x1e,  0xe, 0x1a,  0xa };
+
+    return;
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_offset_start =    p_vout->yuv.p_offset;
+    p_lookup =          p_vout->yuv.p_base;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    i_real_y = 0;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Do horizontal and vertical scaling */
+        SCALE_WIDTH_DITHER( 420 );
+        SCALE_HEIGHT_DITHER( 420 );
+    }
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV422RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 8\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV444RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 8\n" );
+}
+
diff --git a/plugins/yuv/video_yuv_macros.h b/plugins/yuv/video_yuv_macros.h
new file mode 100644 (file)
index 0000000..d054adb
--- /dev/null
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * video_yuv_macros_truecolor.h: YUV transformation macros for truecolor
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel conversion blocks
+ *****************************************************************************
+ * These conversion routines are used by YUV conversion functions.
+ * conversion are made from p_y, p_u, p_v, which are modified, to p_buffer,
+ * which is also modified.
+ *****************************************************************************/
+#define CONVERT_Y_PIXEL( BPP )                                                \
+    /* Only Y sample is present */                                            \
+    p_ybase = p_yuv + *p_y++;                                                 \
+    *p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] |     \
+        p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT)       \
+        + i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
+
+#define CONVERT_YUV_PIXEL( BPP )                                              \
+    /* Y, U and V samples are present */                                      \
+    i_uval =    *p_u++;                                                       \
+    i_vval =    *p_v++;                                                       \
+    i_red =     (V_RED_COEF * i_vval) >> SHIFT;                               \
+    i_green =   (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT;     \
+    i_blue =    (U_BLUE_COEF * i_uval) >> SHIFT;                              \
+    CONVERT_Y_PIXEL( BPP )                                                    \
+
+/*****************************************************************************
+ * SCALE_WIDTH: scale a line horizontally
+ *****************************************************************************
+ * This macro scales a line using rendering buffer and offset array. It works
+ * for 1, 2 and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_WIDTH                                                           \
+    if( b_horizontal_scaling )                                                \
+    {                                                                         \
+        /* Horizontal scaling, conversion has been done to buffer.            \
+         * Rewind buffer and offset, then copy and scale line */              \
+        p_buffer = p_buffer_start;                                            \
+        p_offset = p_offset_start;                                            \
+        for( i_x = i_pic_width / 16; i_x--; )                                 \
+        {                                                                     \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+        }                                                                     \
+        p_pic += i_pic_line_width;                                            \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        /* No scaling, conversion has been done directly in picture memory.   \
+         * Increment of picture pointer to end of line is still needed */     \
+        p_pic += i_pic_width + i_pic_line_width;                              \
+    }                                                                         \
+
+/*****************************************************************************
+ * SCALE_HEIGHT: handle vertical scaling
+ *****************************************************************************
+ * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
+ * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
+ * and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_HEIGHT( CHROMA, BPP )                                           \
+    /* If line is odd, rewind 4:2:0 U and V samples */                        \
+    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
+    {                                                                         \
+        p_u -= i_chroma_width;                                                \
+        p_v -= i_chroma_width;                                                \
+    }                                                                         \
+                                                                              \
+    /*                                                                        \
+     * Handle vertical scaling. The current line can be copied or next one    \
+     * can be ignored.                                                        \
+     */                                                                       \
+    switch( i_vertical_scaling )                                              \
+    {                                                                         \
+    case -1:                             /* vertical scaling factor is < 1 */ \
+        while( (i_scale_count -= i_pic_height) >= 0 )                         \
+        {                                                                     \
+            /* Height reduction: skip next source line */                     \
+            p_y += i_width;                                                   \
+            i_y++;                                                            \
+            if( (CHROMA == 420) || (CHROMA == 422) )                          \
+            {                                                                 \
+                if( i_y & 0x1 )                                               \
+                {                                                             \
+                    p_u += i_chroma_width;                                    \
+                    p_v += i_chroma_width;                                    \
+                }                                                             \
+            }                                                                 \
+            else if( CHROMA == 444 )                                          \
+            {                                                                 \
+                p_u += i_width;                                               \
+                p_v += i_width;                                               \
+            }                                                                 \
+        }                                                                     \
+        i_scale_count += i_height;                                            \
+        break;                                                                \
+    case 1:                              /* vertical scaling factor is > 1 */ \
+        while( (i_scale_count -= i_height) > 0 )                              \
+        {                                                                     \
+            /* Height increment: copy previous picture line */                \
+            for( i_x = i_pic_width / 16; i_x--; )                             \
+            {                                                                 \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                if( BPP > 1 )                               /* 2, 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 2 )                                  /* 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 3 )                                     /* 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+            }                                                                 \
+            p_pic +=        i_pic_line_width;                                 \
+            p_pic_start +=  i_pic_line_width;                                 \
+        }                                                                     \
+        i_scale_count += i_pic_height;                                        \
+        break;                                                                \
+    }                                                                         \
+
diff --git a/plugins/yuv/video_yuv_macros_8bpp.h b/plugins/yuv/video_yuv_macros_8bpp.h
new file mode 100644 (file)
index 0000000..116f7ae
--- /dev/null
@@ -0,0 +1,175 @@
+/*****************************************************************************
+ * video_yuv_macros_8bpp.h: YUV transformation macros for 8bpp
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * CONVERT_4YUV_PIXELS: dither 4 pixels in 8 bpp
+ *****************************************************************************
+ * These macros dither 4 pixels in 8 bpp
+ *****************************************************************************/
+#define CONVERT_4YUV_PIXELS( CHROMA )                                         \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither10[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u + dither20[i_real_y]) >> 5) * 9                                \
+      + ((*p_v + dither20[i_real_y]) >> 5) ];                                 \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither11[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u++ + dither21[i_real_y]) >> 5) * 9                              \
+      + ((*p_v++ + dither21[i_real_y]) >> 5) ];                               \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither12[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u + dither22[i_real_y]) >> 5) * 9                                \
+      + ((*p_v + dither22[i_real_y]) >> 5) ];                                 \
+    *p_pic++ = p_lookup[                                                      \
+        (((*p_y++ + dither13[i_real_y]) >> 4) << 7)                           \
+      + ((*p_u++ + dither23[i_real_y]) >> 5) * 9                              \
+      + ((*p_v++ + dither23[i_real_y]) >> 5) ];                               \
+
+/*****************************************************************************
+ * CONVERT_4YUV_PIXELS_SCALE: dither and scale 4 pixels in 8 bpp
+ *****************************************************************************
+ * These macros dither 4 pixels in 8 bpp, with horizontal scaling
+ *****************************************************************************/
+#define CONVERT_4YUV_PIXELS_SCALE( CHROMA )                                   \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither10[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither20[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither20[i_real_y]) >> 5) ];                               \
+    b_jump_uv += *p_offset;                                                   \
+    p_y += *p_offset;                                                         \
+    p_u += *p_offset   & b_jump_uv;                                           \
+    p_v += *p_offset++ & b_jump_uv;                                           \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither11[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither21[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither21[i_real_y]) >> 5) ];                               \
+    b_jump_uv += *p_offset;                                                   \
+    p_y += *p_offset;                                                         \
+    p_u += *p_offset   & b_jump_uv;                                           \
+    p_v += *p_offset++ & b_jump_uv;                                           \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither12[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither22[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither22[i_real_y]) >> 5) ];                               \
+    b_jump_uv += *p_offset;                                                   \
+    p_y += *p_offset;                                                         \
+    p_u += *p_offset   & b_jump_uv;                                           \
+    p_v += *p_offset++ & b_jump_uv;                                           \
+    *p_pic++ = p_lookup[                                                      \
+        ( ((*p_y + dither13[i_real_y]) >> 4) << 7)                            \
+        + ((*p_u + dither23[i_real_y]) >> 5) * 9                              \
+        + ((*p_v + dither23[i_real_y]) >> 5) ];                               \
+    b_jump_uv += *p_offset;                                                   \
+    p_y += *p_offset;                                                         \
+    p_u += *p_offset   & b_jump_uv;                                           \
+    p_v += *p_offset++ & b_jump_uv;                                           \
+
+/*****************************************************************************
+ * SCALE_WIDTH_DITHER: scale a line horizontally for dithered 8 bpp
+ *****************************************************************************
+ * This macro scales a line using an offset array.
+ *****************************************************************************/
+#define SCALE_WIDTH_DITHER( CHROMA )                                          \
+    if( b_horizontal_scaling )                                                \
+    {                                                                         \
+        /* Horizontal scaling, but we can't use a buffer due to dither */     \
+        p_offset = p_offset_start;                                            \
+        b_jump_uv = 0;                                                        \
+        for( i_x = i_pic_width / 16; i_x--; )                                 \
+        {                                                                     \
+            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
+            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
+            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
+            CONVERT_4YUV_PIXELS_SCALE( CHROMA )                               \
+        }                                                                     \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        for( i_x = i_width / 16; i_x--;  )                                    \
+        {                                                                     \
+            CONVERT_4YUV_PIXELS( CHROMA )                                     \
+            CONVERT_4YUV_PIXELS( CHROMA )                                     \
+            CONVERT_4YUV_PIXELS( CHROMA )                                     \
+            CONVERT_4YUV_PIXELS( CHROMA )                                     \
+        }                                                                     \
+    }                                                                         \
+    /* Increment of picture pointer to end of line is still needed */         \
+    p_pic += i_pic_line_width;                                                \
+    i_real_y = (i_real_y + 1) & 0x3;                                          \
+
+/*****************************************************************************
+ * SCALE_HEIGHT_DITHER: handle vertical scaling for dithered 8 bpp
+ *****************************************************************************
+ * This macro handles vertical scaling for a picture. CHROMA may be 420, 422 or
+ * 444 for RGB conversion, or 400 for gray conversion.
+ *****************************************************************************/
+#define SCALE_HEIGHT_DITHER( CHROMA )                                         \
+                                                                              \
+    /* If line is odd, rewind 4:2:0 U and V samples */                        \
+    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
+    {                                                                         \
+        p_u -= i_chroma_width;                                                \
+        p_v -= i_chroma_width;                                                \
+    }                                                                         \
+                                                                              \
+    /*                                                                        \
+     * Handle vertical scaling. The current line can be copied or next one    \
+     * can be ignored.                                                        \
+     */                                                                       \
+                                                                              \
+    switch( i_vertical_scaling )                                              \
+    {                                                                         \
+    case -1:                             /* vertical scaling factor is < 1 */ \
+        while( (i_scale_count -= i_pic_height) >= 0 )                         \
+        {                                                                     \
+            /* Height reduction: skip next source line */                     \
+            p_y += i_width;                                                   \
+            i_y++;                                                            \
+            if( (CHROMA == 420) || (CHROMA == 422) )                          \
+            {                                                                 \
+                if( i_y & 0x1 )                                               \
+                {                                                             \
+                    p_u += i_chroma_width;                                    \
+                    p_v += i_chroma_width;                                    \
+                }                                                             \
+            }                                                                 \
+            else if( CHROMA == 444 )                                          \
+            {                                                                 \
+                p_u += i_width;                                               \
+                p_v += i_width;                                               \
+            }                                                                 \
+        }                                                                     \
+        i_scale_count += i_height;                                            \
+        break;                                                                \
+    case 1:                              /* vertical scaling factor is > 1 */ \
+        while( (i_scale_count -= i_height) > 0 )                              \
+        {                                                                     \
+            SCALE_WIDTH_DITHER( CHROMA );                                     \
+            p_y -= i_width;                                                   \
+            p_u -= i_chroma_width;                                            \
+            p_v -= i_chroma_width;                                            \
+            p_pic +=        i_pic_line_width;                                 \
+        }                                                                     \
+        i_scale_count += i_pic_height;                                        \
+        break;                                                                \
+    }                                                                         \
+
diff --git a/plugins/yuv/yuv.c b/plugins/yuv/yuv.c
new file mode 100644 (file)
index 0000000..e5350bf
--- /dev/null
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * yuv.c : C YUV functions for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void yuv_GetPlugin( p_vout_thread_t p_vout );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "C YUV to RGB transformations";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = NULL;
+    p_info->intf_GetPlugin = NULL;
+    p_info->yuv_GetPlugin  = yuv_GetPlugin;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void yuv_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_yuv_init   = yuv_SysInit;
+    p_vout->p_yuv_reset  = yuv_SysReset;
+    p_vout->p_yuv_end    = yuv_SysEnd;
+}
+
diff --git a/plugins/yuvmmx/video_yuv.c b/plugins/yuvmmx/video_yuv.c
new file mode 100644 (file)
index 0000000..20a43e2
--- /dev/null
@@ -0,0 +1,526 @@
+/*****************************************************************************
+ * video_yuv.c: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * Constants
+ *****************************************************************************/
+
+int     yuv_SysInit     ( vout_thread_t *p_vout );
+int     yuv_SysReset    ( vout_thread_t *p_vout );
+void    yuv_SysEnd      ( vout_thread_t *p_vout );
+
+/*****************************************************************************
+ * vout_InitYUV: allocate and initialize translations tables
+ *****************************************************************************
+ * This function will allocate memory to store translation tables, depending
+ * of the screen depth.
+ *****************************************************************************/
+int yuv_SysInit( vout_thread_t *p_vout )
+{
+    size_t      tables_size;                        /* tables size, in bytes */
+
+    /* Computes tables size - 3 Bpp use 32 bits pixel entries in tables */
+    switch( p_vout->i_bytes_per_pixel )
+    {
+    case 1:
+        tables_size = sizeof( u8 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : PALETTE_TABLE_SIZE);
+        break;
+    case 2:
+        tables_size = sizeof( u16 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
+    case 3:
+    case 4:
+    default:
+        tables_size = sizeof( u32 )
+                * (p_vout->b_grayscale ? GRAY_TABLE_SIZE : RGB_TABLE_SIZE);
+        break;
+    }
+
+    /* Allocate memory */
+    p_vout->yuv.p_base = malloc( tables_size );
+    if( p_vout->yuv.p_base == NULL )
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
+        return( 1 );
+    }
+
+    /* Allocate memory for conversion buffer and offset array */
+    p_vout->yuv.p_buffer = malloc( VOUT_MAX_WIDTH * p_vout->i_bytes_per_pixel );
+    if( p_vout->yuv.p_buffer == NULL )
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
+        free( p_vout->yuv.p_base );
+        return( 1 );
+    }
+    p_vout->yuv.p_offset = malloc( p_vout->i_width * sizeof( int ) );
+    if( p_vout->yuv.p_offset == NULL )
+    {
+        intf_ErrMsg("error: %s\n", strerror(ENOMEM));
+        free( p_vout->yuv.p_base );
+        free( p_vout->yuv.p_buffer );
+        return( 1 );
+    }
+
+    /* Initialize tables */
+    SetYUV( p_vout );
+    return( 0 );
+}
+
+/*****************************************************************************
+ * yuv_SysReset: re-initialize translations tables
+ *****************************************************************************
+ * This function will initialize the tables allocated by vout_CreateTables and
+ * set functions pointers.
+ *****************************************************************************/
+int yuv_SysReset( vout_thread_t *p_vout )
+{
+    yuv_SysEnd( p_vout );
+    return( yuv_SysInit( p_vout ) );
+}
+
+/*****************************************************************************
+ * yuv_SysEnd: destroy translations tables
+ *****************************************************************************
+ * Free memory allocated by yuv_SysCreate.
+ *****************************************************************************/
+void yuv_SysEnd( vout_thread_t *p_vout )
+{
+    free( p_vout->yuv.p_base );
+    free( p_vout->yuv.p_buffer );
+    free( p_vout->yuv.p_offset );
+}
+
+/* following functions are local */
+
+/*****************************************************************************
+ * SetGammaTable: return intensity table transformed by gamma curve.
+ *****************************************************************************
+ * pi_table is a table of 256 entries from 0 to 255.
+ *****************************************************************************/
+void SetGammaTable( int *pi_table, double f_gamma )
+{
+    int         i_y;                                       /* base intensity */
+
+    /* Use exp(gamma) instead of gamma */
+    f_gamma = exp( f_gamma );
+
+    /* Build gamma table */
+    for( i_y = 0; i_y < 256; i_y++ )
+    {
+        pi_table[ i_y ] = pow( (double)i_y / 256, f_gamma ) * 256;
+    }
+ }
+
+/*****************************************************************************
+ * SetYUV: compute tables and set function pointers
++ *****************************************************************************/
+void SetYUV( vout_thread_t *p_vout )
+{
+    int         pi_gamma[256];                                /* gamma table */
+    int         i_index;                                  /* index in tables */
+
+    /* Build gamma table */
+    SetGammaTable( pi_gamma, p_vout->f_gamma );
+
+    /*
+     * Set pointers and build YUV tables
+     */
+    if( p_vout->b_grayscale )
+    {
+        /* Grayscale: build gray table */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            {
+                u16 bright[256], transp[256];
+
+                p_vout->yuv.yuv.p_gray8 =  (u8 *)p_vout->yuv.p_base + GRAY_MARGIN;
+                for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+                {
+                    p_vout->yuv.yuv.p_gray8[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                    p_vout->yuv.yuv.p_gray8[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+                }
+                for( i_index = 0; i_index < 256; i_index++)
+                {
+                    p_vout->yuv.yuv.p_gray8[ i_index ] = pi_gamma[ i_index ];
+                    bright[ i_index ] = i_index << 8;
+                    transp[ i_index ] = 0;
+                }
+                /* the colors have been allocated, we can set the palette */
+                p_vout->p_set_palette( p_vout, bright, bright, bright, transp );
+                p_vout->i_white_pixel = 0xff;
+                p_vout->i_black_pixel = 0x00;
+                p_vout->i_gray_pixel = 0x44;
+                p_vout->i_blue_pixel = 0x3b;
+
+                break;
+            }
+        case 2:
+            p_vout->yuv.yuv.p_gray16 =  (u16 *)p_vout->yuv.p_base + GRAY_MARGIN;
+            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_gray16[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                p_vout->yuv.yuv.p_gray16[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++)
+            {
+                p_vout->yuv.yuv.p_gray16[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+            }
+            break;
+        case 3:
+        case 4:
+            p_vout->yuv.yuv.p_gray32 =  (u32 *)p_vout->yuv.p_base + GRAY_MARGIN;
+            for( i_index = 0; i_index < GRAY_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_gray32[ -i_index ] =      RGB2PIXEL( p_vout, pi_gamma[0], pi_gamma[0], pi_gamma[0] );
+                p_vout->yuv.yuv.p_gray32[ 256 + i_index ] = RGB2PIXEL( p_vout, pi_gamma[255], pi_gamma[255], pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++)
+            {
+                p_vout->yuv.yuv.p_gray32[ i_index ] = RGB2PIXEL( p_vout, pi_gamma[i_index], pi_gamma[i_index], pi_gamma[i_index] );
+            }
+            break;
+         }
+    }
+    else
+    {
+        /* Color: build red, green and blue tables */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            {
+                #define RGB_MIN 0
+                #define RGB_MAX 255
+                #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
+
+                int y,u,v;
+                int r,g,b;
+                int uvr, uvg, uvb;
+                int i = 0, j = 0;
+                u16 red[256], green[256], blue[256], transp[256];
+                unsigned char lookup[PALETTE_TABLE_SIZE];
+
+                p_vout->yuv.yuv.p_rgb8 = (u8 *)p_vout->yuv.p_base;
+
+                /* this loop calculates the intersection of an YUV box
+                 * and the RGB cube. */
+                for ( y = 0; y <= 256; y += 16 )
+                {
+                    for ( u = 0; u <= 256; u += 32 )
+                    for ( v = 0; v <= 256; v += 32 )
+                    {
+                        uvr = (V_RED_COEF*(v-128)) >> SHIFT;
+                        uvg = (U_GREEN_COEF*(u-128) + V_GREEN_COEF*(v-128)) >> SHIFT;
+                        uvb = (U_BLUE_COEF*(u-128)) >> SHIFT;
+                        r = y + uvr;
+                        g = y + uvg;
+                        b = y + uvb;
+
+                        if( r >= RGB_MIN && g >= RGB_MIN && b >= RGB_MIN
+                                && r <= RGB_MAX && g <= RGB_MAX && b <= RGB_MAX )
+                        {
+                            /* this one should never happen unless someone fscked up my code */
+                            if(j == 256) { intf_ErrMsg( "vout error: no colors left to build palette\n" ); break; }
+
+                            /* clip the colors */
+                            red[j] = CLIP( r );
+                            green[j] = CLIP( g );
+                            blue[j] = CLIP( b );
+                            transp[j] = 0;
+
+                            /* allocate color */
+                            lookup[i] = 1;
+                            p_vout->yuv.yuv.p_rgb8[i++] = j;
+                            j++;
+                        }
+                        else
+                        {
+                            lookup[i] = 0;
+                            p_vout->yuv.yuv.p_rgb8[i++] = 0;
+                        }
+                    }
+                    i += 128-81;
+                }
+
+                /* the colors have been allocated, we can set the palette */
+                /* there will eventually be a way to know which colors
+                 * couldn't be allocated and try to find a replacement */
+                p_vout->p_set_palette( p_vout, red, green, blue, transp );
+
+                p_vout->i_white_pixel = 0xff;
+                p_vout->i_black_pixel = 0x00;
+                p_vout->i_gray_pixel = 0x44;
+                p_vout->i_blue_pixel = 0x3b;
+
+                i = 0;
+                /* this loop allocates colors that got outside
+                 * the RGB cube */
+                for ( y = 0; y <= 256; y += 16 )
+                {
+                    for ( u = 0; u <= 256; u += 32 )
+                    for ( v = 0; v <= 256; v += 32 )
+                    {
+                        int u2, v2;
+                        int dist, mindist = 100000000;
+
+                        if( lookup[i] || y==0)
+                        {
+                            i++;
+                            continue;
+                        }
+
+                        /* heavy. yeah. */
+                        for( u2 = 0; u2 <= 256; u2 += 32 )
+                        for( v2 = 0; v2 <= 256; v2 += 32 )
+                        {
+                            j = ((y>>4)<<7) + (u2>>5)*9 + (v2>>5);
+                            dist = (u-u2)*(u-u2) + (v-v2)*(v-v2);
+                            if( lookup[j] )
+                            /* find the nearest color */
+                            if( dist < mindist )
+                            {
+                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
+                                mindist = dist;
+                            }
+                            j -= 128;
+                            if( lookup[j] )
+                            /* find the nearest color */
+                            if( dist + 128 < mindist )
+                            {
+                                p_vout->yuv.yuv.p_rgb8[i] = p_vout->yuv.yuv.p_rgb8[j];
+                                mindist = dist + 128;
+                            }
+                        }
+                        i++;
+                    }
+                    i += 128-81;
+                }
+
+                break;
+            }
+        case 2:
+            p_vout->yuv.yuv.p_rgb16 = (u16 *)p_vout->yuv.p_base;
+            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+            }
+            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+            }
+            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+                p_vout->yuv.yuv.p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+                p_vout->yuv.yuv.p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
+        case 3:
+        case 4:
+            p_vout->yuv.yuv.p_rgb32 = (u32 *)p_vout->yuv.p_base;
+            for( i_index = 0; i_index < RED_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_vout, pi_gamma[0], 0, 0 );
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_vout, pi_gamma[255], 0, 0 );
+            }
+            for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[0], 0 );
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_vout, 0, pi_gamma[255], 0 );
+            }
+            for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[0] );
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_vout, 0, 0, pi_gamma[255] );
+            }
+            for( i_index = 0; i_index < 256; i_index++ )
+            {
+                p_vout->yuv.yuv.p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_vout, pi_gamma[ i_index ], 0, 0 );
+                p_vout->yuv.yuv.p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_vout, 0, pi_gamma[ i_index ], 0 );
+                p_vout->yuv.yuv.p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_vout, 0, 0, pi_gamma[ i_index ] );
+            }
+            break;
+        }
+    }
+
+    /*
+     * Set functions pointers
+     */
+    if( p_vout->b_grayscale )
+    {
+        /* Grayscale */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray8;
+            break;
+        case 2:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray16;
+            break;
+        case 3:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertY4Gray32;
+            break;
+        }
+    }
+    else
+    {
+        /* Color */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertYUV420RGB8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertYUV422RGB8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertYUV444RGB8;
+            break;
+        case 2:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB16;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB16;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB16;
+            break;
+        case 3:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB24;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB24;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertYUV420RGB32;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertYUV422RGB32;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertYUV444RGB32;
+            break;
+        }
+    }
+}
+
+/*****************************************************************************
+ * SetOffset: build offset array for conversion functions
+ *****************************************************************************
+ * This function will build an offset array used in later conversion functions.
+ * It will also set horizontal and vertical scaling indicators.
+ *****************************************************************************/
+void SetOffset( int i_width, int i_height, int i_pic_width, int i_pic_height,
+                boolean_t *pb_h_scaling, int *pi_v_scaling, int *p_offset )
+{
+    int i_x;                                    /* x position in destination */
+    int i_scale_count;                                     /* modulo counter */
+
+    /*
+     * Prepare horizontal offset array
+     */
+    if( i_pic_width - i_width > 0 )
+    {
+        /* Prepare scaling array for horizontal extension */
+        *pb_h_scaling =  1;
+        i_scale_count =         i_pic_width;
+        for( i_x = i_width; i_x--; )
+        {
+            while( (i_scale_count -= i_width) > 0 )
+            {
+                *p_offset++ = 0;
+            }
+            *p_offset++ = 1;
+            i_scale_count += i_pic_width;
+        }
+    }
+    else if( i_pic_width - i_width < 0 )
+    {
+        /* Prepare scaling array for horizontal reduction */
+        *pb_h_scaling =  1;
+        i_scale_count =         i_pic_width;
+        for( i_x = i_pic_width; i_x--; )
+        {
+            *p_offset = 1;
+            while( (i_scale_count -= i_pic_width) >= 0 )
+            {
+                *p_offset += 1;
+            }
+            p_offset++;
+            i_scale_count += i_width;
+        }
+    }
+    else
+    {
+        /* No horizontal scaling: YUV conversion is done directly to picture */
+        *pb_h_scaling = 0;
+    }
+
+    /*
+     * Set vertical scaling indicator
+     */
+    if( i_pic_height - i_height > 0 )
+    {
+        *pi_v_scaling = 1;
+    }
+    else if( i_pic_height - i_height < 0 )
+    {
+        *pi_v_scaling = -1;
+    }
+    else
+    {
+        *pi_v_scaling = 0;
+    }
+}
+
diff --git a/plugins/yuvmmx/video_yuv.h b/plugins/yuvmmx/video_yuv.h
new file mode 100644 (file)
index 0000000..3d7feff
--- /dev/null
@@ -0,0 +1,100 @@
+/*****************************************************************************
+ * video_yuv.h: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Constants
+ *****************************************************************************/
+
+/* Margins and offsets in conversion tables - Margins are used in case a RGB
+ * RGB conversion would give a value outside the 0-255 range. Offsets have been
+ * calculated to avoid using the same cache line for 2 tables. conversion tables
+ * are 2*MARGIN + 256 long and stores pixels.*/
+#define RED_MARGIN      178
+#define GREEN_MARGIN    135
+#define BLUE_MARGIN     224
+#define RED_OFFSET      1501                                 /* 1323 to 1935 */
+#define GREEN_OFFSET    135                                      /* 0 to 526 */
+#define BLUE_OFFSET     818                                   /* 594 to 1298 */
+#define RGB_TABLE_SIZE  1935                             /* total table size */
+
+#define GRAY_MARGIN     384
+#define GRAY_TABLE_SIZE 1024                             /* total table size */
+
+#define PALETTE_TABLE_SIZE 2176          /* YUV -> 8bpp palette lookup table */
+
+/* macros used for YUV pixel conversions */
+#define SHIFT 20
+#define U_GREEN_COEF    ((int)(-0.391 * (1<<SHIFT) / 1.164))
+#define U_BLUE_COEF     ((int)(2.018 * (1<<SHIFT) / 1.164))
+#define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
+#define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
+
+/* argument lists for YUV functions */
+#define YUV_ARGS_8BPP p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+#define YUV_ARGS_16BPP p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+#define YUV_ARGS_24BPP p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+#define YUV_ARGS_32BPP p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *p_y, \
+yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, int i_pic_width, \
+int i_pic_height, int i_pic_line_width, int i_matrix_coefficients
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+void SetGammaTable        ( int *pi_table, double f_gamma );
+void SetYUV               ( vout_thread_t *p_vout );
+void SetOffset            ( int i_width, int i_height, int i_pic_width,
+                            int i_pic_height, boolean_t *pb_h_scaling,
+                            int *pi_v_scaling, int *p_offset );
+
+void ConvertY4Gray8       ( YUV_ARGS_8BPP );
+void ConvertYUV420RGB8    ( YUV_ARGS_8BPP );
+void ConvertYUV422RGB8    ( YUV_ARGS_8BPP );
+void ConvertYUV444RGB8    ( YUV_ARGS_8BPP );
+
+void ConvertY4Gray16      ( YUV_ARGS_16BPP );
+void ConvertYUV420RGB16   ( YUV_ARGS_16BPP );
+void ConvertYUV422RGB16   ( YUV_ARGS_16BPP );
+void ConvertYUV444RGB16   ( YUV_ARGS_16BPP );
+
+void ConvertY4Gray24      ( YUV_ARGS_24BPP );
+void ConvertYUV420RGB24   ( YUV_ARGS_24BPP );
+void ConvertYUV422RGB24   ( YUV_ARGS_24BPP );
+void ConvertYUV444RGB24   ( YUV_ARGS_24BPP );
+
+void ConvertY4Gray32      ( YUV_ARGS_32BPP );
+void ConvertYUV420RGB32   ( YUV_ARGS_32BPP );
+void ConvertYUV422RGB32   ( YUV_ARGS_32BPP );
+void ConvertYUV444RGB32   ( YUV_ARGS_32BPP );
+
diff --git a/plugins/yuvmmx/video_yuv15.c b/plugins/yuvmmx/video_yuv15.c
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/plugins/yuvmmx/video_yuv16.c b/plugins/yuvmmx/video_yuv16.c
new file mode 100644 (file)
index 0000000..e23d2be
--- /dev/null
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * video_yuv16.c: YUV transformation functions for 16bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+#include "video_yuv_macros.h"
+#include "video_yuv_asm.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray16: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray16( YUV_ARGS_16BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 16\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB16: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB16( YUV_ARGS_16BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                              /* chroma width */
+    u16 *       p_yuv;                              /* base conversion table */
+    u16 *       p_pic_start;       /* beginning of the current line for copy */
+    u16 *       p_buffer_start;                   /* conversion buffer start */
+    u16 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb16;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        for ( i_x = i_width / 8; i_x--; )
+        {
+            __asm__( MMX_INIT_16
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            __asm__( ".align 8" MMX_YUV_MUL MMX_YUV_ADD MMX_UNPACK_16
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            p_y += 8;
+            p_u += 4;
+            p_v += 4;
+            p_buffer += 8;
+        }
+
+        SCALE_WIDTH;
+        SCALE_HEIGHT( 420, 2 );
+    }
+    __asm__( "emms" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB16: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB16( YUV_ARGS_16BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 16\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB16: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB16( YUV_ARGS_16BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 16\n" );
+}
+
diff --git a/plugins/yuvmmx/video_yuv24.c b/plugins/yuvmmx/video_yuv24.c
new file mode 100644 (file)
index 0000000..76c4572
--- /dev/null
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * video_yuv24.c: YUV transformation functions for 24 bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray24: grayscale YUV 4:x:x to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertY4Gray24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 24\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB24: color YUV 4:2:0 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 24\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB24: color YUV 4:2:2 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 24\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB24: color YUV 4:4:4 to RGB 2 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB24( YUV_ARGS_24BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 24\n" );
+}
+
diff --git a/plugins/yuvmmx/video_yuv32.c b/plugins/yuvmmx/video_yuv32.c
new file mode 100644 (file)
index 0000000..6f70892
--- /dev/null
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * video_yuv32.c: YUV transformation functions for 32 bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+#include "video_yuv_macros.h"
+#include "video_yuv_asm.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray32: grayscale YUV 4:x:x to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertY4Gray32( YUV_ARGS_32BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 32\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB32: color YUV 4:2:0 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV420RGB32( YUV_ARGS_32BPP )
+{
+    boolean_t   b_horizontal_scaling;             /* horizontal scaling type */
+    int         i_vertical_scaling;                 /* vertical scaling type */
+    int         i_x, i_y;                 /* horizontal and vertical indexes */
+    int         i_scale_count;                       /* scale modulo counter */
+    int         i_chroma_width;                              /* chroma width */
+    u32 *       p_yuv;                              /* base conversion table */
+    u32 *       p_pic_start;       /* beginning of the current line for copy */
+    u32 *       p_buffer_start;                   /* conversion buffer start */
+    u32 *       p_buffer;                       /* conversion buffer pointer */
+    int *       p_offset_start;                        /* offset array start */
+    int *       p_offset;                            /* offset array pointer */
+
+    /*
+     * Initialize some values  - i_pic_line_width will store the line skip
+     */
+    i_pic_line_width -= i_pic_width;
+    i_chroma_width =    i_width / 2;
+    p_yuv =             p_vout->yuv.yuv.p_rgb32;
+    p_buffer_start =    p_vout->yuv.p_buffer;
+    p_offset_start =    p_vout->yuv.p_offset;
+    SetOffset( i_width, i_height, i_pic_width, i_pic_height,
+               &b_horizontal_scaling, &i_vertical_scaling, p_offset_start );
+
+    /*
+     * Perform conversion
+     */
+    i_scale_count = i_pic_height;
+    for( i_y = 0; i_y < i_height; i_y++ )
+    {
+        /* Mark beginnning of line for possible later line copy, and initialize
+         * buffer */
+        p_pic_start =   p_pic;
+        p_buffer =      b_horizontal_scaling ? p_buffer_start : p_pic;
+
+        for ( i_x = i_width / 8; i_x--; )
+        {
+            __asm__( ".align 8" MMX_INIT_32
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            __asm__( ".align 8" MMX_YUV_ADD MMX_YUV_MUL MMX_UNPACK_32
+                     : : "r" (p_y), "r" (p_u), "r" (p_v), "r" (p_buffer) );
+
+            p_y += 8;
+            p_u += 4;
+            p_v += 4;
+            p_buffer += 8;
+        }
+
+        SCALE_WIDTH;
+        SCALE_HEIGHT( 420, 2 );
+    }
+    __asm__( "emms" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB32: color YUV 4:2:2 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV422RGB32( YUV_ARGS_32BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 422, bpp = 32\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB32: color YUV 4:4:4 to RGB 4 Bpp
+ *****************************************************************************/
+void ConvertYUV444RGB32( YUV_ARGS_32BPP )
+{
+    intf_ErrMsg( "yuv error: unhandled function, chroma = 444, bpp = 32\n" );
+}
+
diff --git a/plugins/yuvmmx/video_yuv8.c b/plugins/yuvmmx/video_yuv8.c
new file mode 100644 (file)
index 0000000..985b207
--- /dev/null
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * video_yuv8.c: YUV transformation functions for 8bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * ConvertY4Gray8: grayscale YUV 4:x:x to RGB 8 bpp
+ *****************************************************************************/
+void ConvertY4Gray8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, grayscale, bpp = 8\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV420RGB8: color YUV 4:2:0 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV420RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 420, bpp = 8\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV422RGB8: color YUV 4:2:2 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV422RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 422, bpp = 8\n" );
+}
+
+/*****************************************************************************
+ * ConvertYUV444RGB8: color YUV 4:4:4 to RGB 8 bpp
+ *****************************************************************************/
+void ConvertYUV444RGB8( YUV_ARGS_8BPP )
+{
+    intf_ErrMsg( "yuvmmx error: unhandled function, chroma = 444, bpp = 8\n" );
+}
+
diff --git a/plugins/yuvmmx/video_yuv_asm.h b/plugins/yuvmmx/video_yuv_asm.h
new file mode 100644 (file)
index 0000000..f2c61f0
--- /dev/null
@@ -0,0 +1,200 @@
+/*****************************************************************************
+ * video_yuv_asm.h: YUV transformation assembly
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ * Olie Lho <ollie@sis.com.tw>
+ *
+ * Adapted to VideoLAN by:
+ * Gaël Hendryckx <jimmy@via.ecp.fr>
+ * Samuel Hocevar <sam@via.ecp.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/* hope these constant values are cache line aligned */
+static unsigned long long mmx_80w     = 0x0080008000800080;
+static unsigned long long mmx_10w     = 0x1010101010101010;
+static unsigned long long mmx_00ffw   = 0x00ff00ff00ff00ff;
+static unsigned long long mmx_Y_coeff = 0x253f253f253f253f;
+
+static unsigned long long mmx_U_green = 0xf37df37df37df37d;
+static unsigned long long mmx_U_blue  = 0x4093409340934093;
+static unsigned long long mmx_V_red   = 0x3312331233123312;
+static unsigned long long mmx_V_green = 0xe5fce5fce5fce5fc;
+
+static unsigned long long mmx_redmask = 0xf8f8f8f8f8f8f8f8;
+static unsigned long long mmx_grnmask = 0xfcfcfcfcfcfcfcfc;
+static unsigned long long mmx_grnshift   = 0x03;
+static unsigned long long mmx_blueshift  = 0x03;
+
+#define MMX_INIT_16 "                                                       \n\
+                                                                            \n\
+movd      (%1), %%mm0       # Load 4 Cb       00 00 00 00 u3 u2 u1 u0       \n\
+movd      (%2), %%mm1       # Load 4 Cr       00 00 00 00 v3 v2 v1 v0       \n\
+pxor      %%mm4, %%mm4      # zero mm4                                      \n\
+movq      (%0), %%mm6       # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\
+#movl      $0, (%3)         # cache preload for image                       \n\
+"
+
+#define MMX_INIT_32 "                                                       \n\
+                                                                            \n\
+movd      (%1), %%mm0       # Load 4 Cb       00 00 00 00 u3 u2 u1 u0       \n\
+movl      $0, (%3)          # cache preload for image                       \n\
+movd      (%2), %%mm1       # Load 4 Cr       00 00 00 00 v3 v2 v1 v0       \n\
+pxor      %%mm4, %%mm4      # zero mm4                                      \n\
+movq      (%0), %%mm6       # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0       \n\
+"
+
+/*
+ * Do the multiply part of the conversion for even and odd pixels,
+ * register usage:
+ * mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
+ * mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd  pixels,
+ * mm6 -> Y even, mm7 -> Y odd
+ */
+
+#define MMX_YUV_MUL "                                                       \n\
+                                                                            \n\
+# convert the chroma part                                                   \n\
+punpcklbw %%mm4, %%mm0          # scatter 4 Cb    00 u3 00 u2 00 u1 00 u0   \n\
+punpcklbw %%mm4, %%mm1          # scatter 4 Cr    00 v3 00 v2 00 v1 00 v0   \n\
+psubsw    mmx_80w, %%mm0        # Cb -= 128                                 \n\
+psubsw    mmx_80w, %%mm1        # Cr -= 128                                 \n\
+psllw     $3, %%mm0             # Promote precision                         \n\
+psllw     $3, %%mm1             # Promote precision                         \n\
+movq      %%mm0, %%mm2          # Copy 4 Cb       00 u3 00 u2 00 u1 00 u0   \n\
+movq      %%mm1, %%mm3          # Copy 4 Cr       00 v3 00 v2 00 v1 00 v0   \n\
+pmulhw    mmx_U_green, %%mm2    # Mul Cb with green coeff -> Cb green       \n\
+pmulhw    mmx_V_green, %%mm3    # Mul Cr with green coeff -> Cr green       \n\
+pmulhw    mmx_U_blue, %%mm0     # Mul Cb -> Cblue 00 b3 00 b2 00 b1 00 b0   \n\
+pmulhw    mmx_V_red, %%mm1      # Mul Cr -> Cred  00 r3 00 r2 00 r1 00      \n\
+paddsw    %%mm3, %%mm2          # Cb green + Cr green -> Cgreen             \n\
+                                                                            \n\
+# convert the luma part                                                     \n\
+psubusb   mmx_10w, %%mm6        # Y -= 16                                   \n\
+movq      %%mm6, %%mm7          # Copy 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0   \n\
+pand      mmx_00ffw, %%mm6      # get Y even      00 Y6 00 Y4 00 Y2 00 Y0   \n\
+psrlw     $8, %%mm7             # get Y odd       00 Y7 00 Y5 00 Y3 00 Y1   \n\
+psllw     $3, %%mm6             # Promote precision                         \n\
+psllw     $3, %%mm7             # Promote precision                         \n\
+pmulhw    mmx_Y_coeff, %%mm6    # Mul 4 Y even    00 y6 00 y4 00 y2 00 y0   \n\
+pmulhw    mmx_Y_coeff, %%mm7    # Mul 4 Y odd     00 y7 00 y5 00 y3 00 y1   \n\
+"
+
+/*
+ * Do the addition part of the conversion for even and odd pixels,
+ * register usage:
+ * mm0 -> Cblue, mm1 -> Cred, mm2 -> Cgreen even pixels,
+ * mm3 -> Cblue, mm4 -> Cred, mm5 -> Cgreen odd  pixels,
+ * mm6 -> Y even, mm7 -> Y odd
+ */
+
+#define MMX_YUV_ADD "                                                       \n\
+                                                                            \n\
+# Do horizontal and vertical scaling                                        \n\
+movq      %%mm0, %%mm3          # Copy Cblue                                \n\
+movq      %%mm1, %%mm4          # Copy Cred                                 \n\
+movq      %%mm2, %%mm5          # Copy Cgreen                               \n\
+paddsw    %%mm6, %%mm0          # Y even + Cblue  00 B6 00 B4 00 B2 00 B0   \n\
+paddsw    %%mm7, %%mm3          # Y odd  + Cblue  00 B7 00 B5 00 B3 00 B1   \n\
+paddsw    %%mm6, %%mm1          # Y even + Cred   00 R6 00 R4 00 R2 00 R0   \n\
+paddsw    %%mm7, %%mm4          # Y odd  + Cred   00 R7 00 R5 00 R3 00 R1   \n\
+paddsw    %%mm6, %%mm2          # Y even + Cgreen 00 G6 00 G4 00 G2 00 G0   \n\
+paddsw    %%mm7, %%mm5          # Y odd  + Cgreen 00 G7 00 G5 00 G3 00 G1   \n\
+                                                                            \n\
+# Limit RGB even to 0..255                                                  \n\
+packuswb  %%mm0, %%mm0          # B6 B4 B2 B0 | B6 B4 B2 B0                 \n\
+packuswb  %%mm1, %%mm1          # R6 R4 R2 R0 | R6 R4 R2 R0                 \n\
+packuswb  %%mm2, %%mm2          # G6 G4 G2 G0 | G6 G4 G2 G0                 \n\
+                                                                            \n\
+# Limit RGB odd to 0..255                                                   \n\
+packuswb  %%mm3, %%mm3          # B7 B5 B3 B1 | B7 B5 B3 B1                 \n\
+packuswb  %%mm4, %%mm4          # R7 R5 R3 R1 | R7 R5 R3 R1                 \n\
+packuswb  %%mm5, %%mm5          # G7 G5 G3 G1 | G7 G5 G3 G1                 \n\
+                                                                            \n\
+# Interleave RGB even and odd                                               \n\
+punpcklbw %%mm3, %%mm0          #                 B7 B6 B5 B4 B3 B2 B1 B0   \n\
+punpcklbw %%mm4, %%mm1          #                 R7 R6 R5 R4 R3 R2 R1 R0   \n\
+punpcklbw %%mm5, %%mm2          #                 G7 G6 G5 G4 G3 G2 G1 G0   \n\
+"
+
+#define MMX_UNPACK_16 "                                                     \n\
+                                                                            \n\
+# mask unneeded bits off                                                    \n\
+pand      mmx_redmask, %%mm0    # b7b6b5b4 b3_0_0_0 b7b6b5b4 b3_0_0_0       \n\
+pand      mmx_grnmask, %%mm2    # g7g6g5g4 g3g2_0_0 g7g6g5g4 g3g2_0_0       \n\
+pand      mmx_redmask, %%mm1    # r7r6r5r4 r3_0_0_0 r7r6r5r4 r3_0_0_0       \n\
+psrlw     mmx_blueshift,%%mm0   # 0_0_0_b7 b6b5b4b3 0_0_0_b7 b6b5b4b3       \n\
+pxor      %%mm4, %%mm4          # zero mm4                                  \n\
+movq      %%mm0, %%mm5          # Copy B7-B0                                \n\
+movq      %%mm2, %%mm7          # Copy G7-G0                                \n\
+                                                                            \n\
+# convert rgb24 plane to rgb16 pack for pixel 0-3                           \n\
+punpcklbw %%mm4, %%mm2          #  0_0_0_0  0_0_0_0 g7g6g5g4 g3g2_0_0       \n\
+punpcklbw %%mm1, %%mm0          # r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3       \n\
+psllw     mmx_blueshift,%%mm2   #  0_0_0_0 0_g7g6g5 g4g3g2_0  0_0_0_0       \n\
+por       %%mm2, %%mm0          # r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3       \n\
+movq      8(%0), %%mm6          # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0   \n\
+movq      %%mm0, (%3)           # store pixel 0-3                           \n\
+                                                                            \n\
+# convert rgb24 plane to rgb16 pack for pixel 0-3                           \n\
+punpckhbw %%mm4, %%mm7          #  0_0_0_0  0_0_0_0 g7g6g5g4 g3g2_0_0       \n\
+punpckhbw %%mm1, %%mm5          # r7r6r5r4 r3_0_0_0 0_0_0_b7 b6b5b4b3       \n\
+psllw     mmx_blueshift,%%mm7   #  0_0_0_0 0_g7g6g5 g4g3g2_0  0_0_0_0       \n\
+movd      4(%1), %%mm0          # Load 4 Cb       00 00 00 00 u3 u2 u1 u0   \n\
+por       %%mm7, %%mm5          # r7r6r5r4 r3g7g6g5 g4g3g2b7 b6b5b4b3       \n\
+movd      4(%2), %%mm1          # Load 4 Cr       00 00 00 00 v3 v2 v1 v0   \n\
+movq      %%mm5, 8(%3)          # store pixel 4-7                           \n\
+"
+
+/*
+ * convert RGB plane to RGB packed format,
+ * mm0 -> B, mm1 -> R, mm2 -> G, mm3 -> 0,
+ * mm4 -> GB, mm5 -> AR pixel 4-7,
+ * mm6 -> GB, mm7 -> AR pixel 0-3
+ */
+
+#define MMX_UNPACK_32 "                                                     \n\
+                                                                            \n\
+pxor      %%mm3, %%mm3  # zero mm3                                          \n\
+movq      %%mm0, %%mm6  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
+movq      %%mm1, %%mm7  #                 R7 R6 R5 R4 R3 R2 R1 R0           \n\
+movq      %%mm0, %%mm4  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
+movq      %%mm1, %%mm5  #                 R7 R6 R5 R4 R3 R2 R1 R0           \n\
+punpcklbw %%mm2, %%mm6  #                 G3 B3 G2 B2 G1 B1 G0 B0           \n\
+punpcklbw %%mm3, %%mm7  #                 00 R3 00 R2 00 R1 00 R0           \n\
+punpcklwd %%mm7, %%mm6  #                 00 R1 B1 G1 00 R0 B0 G0           \n\
+movq      %%mm6, (%3)   # Store ARGB1 ARGB0                                 \n\
+movq      %%mm0, %%mm6  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
+punpcklbw %%mm2, %%mm6  #                 G3 B3 G2 B2 G1 B1 G0 B0           \n\
+punpckhwd %%mm7, %%mm6  #                 00 R3 G3 B3 00 R2 B3 G2           \n\
+movq      %%mm6, 8(%3)  # Store ARGB3 ARGB2                                 \n\
+punpckhbw %%mm2, %%mm4  #                 G7 B7 G6 B6 G5 B5 G4 B4           \n\
+punpckhbw %%mm3, %%mm5  #                 00 R7 00 R6 00 R5 00 R4           \n\
+punpcklwd %%mm5, %%mm4  #                 00 R5 B5 G5 00 R4 B4 G4           \n\
+movq      %%mm4, 16(%3) # Store ARGB5 ARGB4                                 \n\
+movq      %%mm0, %%mm4  #                 B7 B6 B5 B4 B3 B2 B1 B0           \n\
+punpckhbw %%mm2, %%mm4  #                 G7 B7 G6 B6 G5 B5 G4 B4           \n\
+punpckhwd %%mm5, %%mm4  #                 00 R7 G7 B7 00 R6 B6 G6           \n\
+movq      %%mm4, 24(%3) # Store ARGB7 ARGB6                                 \n\
+movd      4(%1), %%mm0  # Load 4 Cb       00 00 00 00 u3 u2 u1 u0           \n\
+movd      4(%2), %%mm1  # Load 4 Cr       00 00 00 00 v3 v2 v1 v0           \n\
+pxor      %%mm4, %%mm4  # zero mm4                                          \n\
+movq      8(%0), %%mm6  # Load 8 Y        Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0           \n\
+"
+
diff --git a/plugins/yuvmmx/video_yuv_macros.h b/plugins/yuvmmx/video_yuv_macros.h
new file mode 100644 (file)
index 0000000..4a6c349
--- /dev/null
@@ -0,0 +1,138 @@
+/*****************************************************************************
+ * video_yuv_macros.h: YUV transformation macros
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * SCALE_WIDTH: scale a line horizontally
+ *****************************************************************************
+ * This macro scales a line using rendering buffer and offset array. It works
+ * for 1, 2 and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_WIDTH                                                           \
+    if( b_horizontal_scaling )                                                \
+    {                                                                         \
+        /* Horizontal scaling, conversion has been done to buffer.            \
+         * Rewind buffer and offset, then copy and scale line */              \
+        p_buffer = p_buffer_start;                                            \
+        p_offset = p_offset_start;                                            \
+        for( i_x = i_pic_width / 16; i_x--; )                                 \
+        {                                                                     \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+        }                                                                     \
+        p_pic += i_pic_line_width;                                            \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        /* No scaling, conversion has been done directly in picture memory.   \
+         * Increment of picture pointer to end of line is still needed */     \
+        p_pic += i_pic_width + i_pic_line_width;                              \
+    }                                                                         \
+
+/*****************************************************************************
+ * SCALE_HEIGHT: handle vertical scaling
+ *****************************************************************************
+ * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
+ * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
+ * and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_HEIGHT( CHROMA, BPP )                                           \
+    /* If line is odd, rewind 4:2:0 U and V samples */                        \
+    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
+    {                                                                         \
+        p_u -= i_chroma_width;                                                \
+        p_v -= i_chroma_width;                                                \
+    }                                                                         \
+                                                                              \
+    /*                                                                        \
+     * Handle vertical scaling. The current line can be copied or next one    \
+     * can be ignored.                                                        \
+     */                                                                       \
+    switch( i_vertical_scaling )                                              \
+    {                                                                         \
+    case -1:                             /* vertical scaling factor is < 1 */ \
+        while( (i_scale_count -= i_pic_height) >= 0 )                         \
+        {                                                                     \
+            /* Height reduction: skip next source line */                     \
+            p_y += i_width;                                                   \
+            i_y++;                                                            \
+            if( (CHROMA == 420) || (CHROMA == 422) )                          \
+            {                                                                 \
+                if( i_y & 0x1 )                                               \
+                {                                                             \
+                    p_u += i_chroma_width;                                    \
+                    p_v += i_chroma_width;                                    \
+                }                                                             \
+            }                                                                 \
+            else if( CHROMA == 444 )                                          \
+            {                                                                 \
+                p_u += i_width;                                               \
+                p_v += i_width;                                               \
+            }                                                                 \
+        }                                                                     \
+        i_scale_count += i_height;                                            \
+        break;                                                                \
+    case 1:                              /* vertical scaling factor is > 1 */ \
+        while( (i_scale_count -= i_height) > 0 )                              \
+        {                                                                     \
+            /* Height increment: copy previous picture line */                \
+            for( i_x = i_pic_width / 16; i_x--; )                             \
+            {                                                                 \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                if( BPP > 1 )                               /* 2, 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 2 )                                  /* 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 3 )                                     /* 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+            }                                                                 \
+            p_pic +=        i_pic_line_width;                                 \
+            p_pic_start +=  i_pic_line_width;                                 \
+        }                                                                     \
+        i_scale_count += i_pic_height;                                        \
+        break;                                                                \
+    }                                                                         \
+
diff --git a/plugins/yuvmmx/yuvmmx.c b/plugins/yuvmmx/yuvmmx.c
new file mode 100644 (file)
index 0000000..19fbb21
--- /dev/null
@@ -0,0 +1,85 @@
+/*****************************************************************************
+ * yuvmmx.c : Accelerated MMX YUV functions for vlc
+ *****************************************************************************
+ * Copyright (C) 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * 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.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <stdlib.h>                                      /* malloc(), free() */
+
+#include "config.h"
+#include "common.h"                                     /* boolean_t, byte_t */
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+
+#include "interface.h"
+#include "audio_output.h"
+#include "video.h"
+#include "video_output.h"
+
+#include "plugins_export.h"
+
+/*****************************************************************************
+ * Exported prototypes
+ *****************************************************************************/
+void yuv_GetPlugin( p_vout_thread_t p_vout );
+
+/*****************************************************************************
+ * GetConfig: get the plugin structure and configuration
+ *****************************************************************************/
+plugin_info_t * GetConfig( void )
+{
+    plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
+
+    p_info->psz_name    = "Accelerated MMX YUV to RGB transformations";
+    p_info->psz_version = VERSION;
+    p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
+
+    p_info->aout_GetPlugin = NULL;
+    p_info->vout_GetPlugin = NULL;
+    p_info->intf_GetPlugin = NULL;
+    p_info->yuv_GetPlugin  = yuv_GetPlugin;
+
+    return( p_info );
+}
+
+/*****************************************************************************
+ * Test: tests if the plugin can be launched
+ *****************************************************************************/
+int Test( void )
+{
+    return( 1 );
+}
+
+/*****************************************************************************
+ * Following functions are only called through the p_info structure
+ *****************************************************************************/
+
+void yuv_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_yuv_init   = yuv_SysInit;
+    p_vout->p_yuv_reset  = yuv_SysReset;
+    p_vout->p_yuv_end    = yuv_SysEnd;
+}
+
index bfaba84..5d43aec 100644 (file)
@@ -76,11 +76,12 @@ ac3dec_thread_t * ac3dec_CreateThread (input_thread_t * p_input)
 {
     ac3dec_thread_t *   p_ac3dec;
 
-    intf_DbgMsg ("ac3dec debug: creating ac3 decoder thread\n");
+    intf_DbgMsg( "ac3dec debug: creating ac3 decoder thread\n" );
 
     /* Allocate the memory needed to store the thread's structure */
     if ((p_ac3dec = (ac3dec_thread_t *)malloc (sizeof(ac3dec_thread_t))) == NULL) {
-        intf_ErrMsg ("ac3dec error: not enough memory for ac3dec_CreateThread() to create the new thread\n");
+        intf_ErrMsg ( "ac3dec error: not enough memory "
+                      "for ac3dec_CreateThread() to create the new thread\n");
         return NULL;
     }
 
@@ -114,7 +115,7 @@ ac3dec_thread_t * ac3dec_CreateThread (input_thread_t * p_input)
 
     /* Spawn the ac3 decoder thread */
     if (vlc_thread_create(&p_ac3dec->thread_id, "ac3 decoder", (vlc_thread_func_t)RunThread, (void *)p_ac3dec)) {
-        intf_ErrMsg  ("ac3dec error: can't spawn ac3 decoder thread\n");
+        intf_ErrMsg( "ac3dec error: can't spawn ac3 decoder thread\n" );
         free (p_ac3dec);
         return NULL;
     }
@@ -168,9 +169,9 @@ static int InitThread (ac3dec_thread_t * p_ac3dec)
     p_ac3dec->p_ts = DECODER_FIFO_START (p_ac3dec->fifo)->p_first_ts;
     byte_stream = ac3_byte_stream (&p_ac3dec->ac3_decoder);
     byte_stream->p_byte =
-       p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_start;
+        p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_start;
     byte_stream->p_end =
-       p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_end;
+        p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_end;
     byte_stream->info = p_ac3dec;
     vlc_mutex_unlock (&p_ac3dec->fifo.data_lock);
 
@@ -211,64 +212,64 @@ static void RunThread (ac3dec_thread_t * p_ac3dec)
     /* ac3 decoder thread's main loop */
     /* FIXME : do we have enough room to store the decoded frames ?? */
     while ((!p_ac3dec->b_die) && (!p_ac3dec->b_error)) {
-       s16 * buffer;
-       ac3_sync_info_t sync_info;
+        s16 * buffer;
+        ac3_sync_info_t sync_info;
 
-       if (!sync) { /* have to find a synchro point */
-           int ptr;
-           ac3_byte_stream_t * p_byte_stream;
+        if (!sync) { /* have to find a synchro point */
+            int ptr;
+            ac3_byte_stream_t * p_byte_stream;
 
-           intf_Msg ("ac3dec: sync\n");
+            intf_Msg ("ac3dec: sync\n");
 
-           p_byte_stream = ac3_byte_stream (&p_ac3dec->ac3_decoder);
+            p_byte_stream = ac3_byte_stream (&p_ac3dec->ac3_decoder);
 
-           /* first read till next ac3 magic header */
-           do {
-               ac3_byte_stream_next (p_byte_stream);
-           } while ((!p_ac3dec->sync_ptr) &&
-                   (!p_ac3dec->b_die) &&
-                   (!p_ac3dec->b_error));
-           /* skip the specified number of bytes */
+            /* first read till next ac3 magic header */
+            do {
+                ac3_byte_stream_next (p_byte_stream);
+            } while ((!p_ac3dec->sync_ptr) &&
+                    (!p_ac3dec->b_die) &&
+                    (!p_ac3dec->b_error));
+            /* skip the specified number of bytes */
 
-           ptr = p_ac3dec->sync_ptr;
-           while (--ptr && (!p_ac3dec->b_die) && (!p_ac3dec->b_error)) {
-               if (p_byte_stream->p_byte >= p_byte_stream->p_end) {
-                   ac3_byte_stream_next (p_byte_stream);                   
-               }
-               p_byte_stream->p_byte++;
-           }
+            ptr = p_ac3dec->sync_ptr;
+            while (--ptr && (!p_ac3dec->b_die) && (!p_ac3dec->b_error)) {
+                if (p_byte_stream->p_byte >= p_byte_stream->p_end) {
+                    ac3_byte_stream_next (p_byte_stream);                    
+                }
+                p_byte_stream->p_byte++;
+            }
 
-           /* we are in sync now */
+            /* we are in sync now */
 
-           sync = 1;
-           p_ac3dec->sync_ptr = 0;
-       }
+            sync = 1;
+            p_ac3dec->sync_ptr = 0;
+        }
 
         if (DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts) {
-           p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_ac3dec->fifo)->i_pts;
-           DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts = 0;
+            p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_ac3dec->fifo)->i_pts;
+            DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts = 0;
         } else {
-           p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
+            p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
         }
 
         if (ac3_sync_frame (&p_ac3dec->ac3_decoder, &sync_info)) {
-           sync = 0;
-           goto bad_frame;
-       }
+            sync = 0;
+            goto bad_frame;
+        }
 
-       p_ac3dec->p_aout_fifo->l_rate = sync_info.sample_rate;
+        p_ac3dec->p_aout_fifo->l_rate = sync_info.sample_rate;
 
-       buffer = ((s16 *)p_ac3dec->p_aout_fifo->buffer) + (p_ac3dec->p_aout_fifo->l_end_frame * AC3DEC_FRAME_SIZE);
+        buffer = ((s16 *)p_ac3dec->p_aout_fifo->buffer) + (p_ac3dec->p_aout_fifo->l_end_frame * AC3DEC_FRAME_SIZE);
 
-       if (ac3_decode_frame (&p_ac3dec->ac3_decoder, buffer)) {
-           sync = 0;
-           goto bad_frame;
-       }
+        if (ac3_decode_frame (&p_ac3dec->ac3_decoder, buffer)) {
+            sync = 0;
+            goto bad_frame;
+        }
 
-       vlc_mutex_lock (&p_ac3dec->p_aout_fifo->data_lock);
-       p_ac3dec->p_aout_fifo->l_end_frame = (p_ac3dec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
-       vlc_cond_signal (&p_ac3dec->p_aout_fifo->data_wait);
-       vlc_mutex_unlock (&p_ac3dec->p_aout_fifo->data_lock);
+        vlc_mutex_lock (&p_ac3dec->p_aout_fifo->data_lock);
+        p_ac3dec->p_aout_fifo->l_end_frame = (p_ac3dec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
+        vlc_cond_signal (&p_ac3dec->p_aout_fifo->data_wait);
+        vlc_mutex_unlock (&p_ac3dec->p_aout_fifo->data_lock);
 
     bad_frame:
     }
@@ -337,62 +338,62 @@ void ac3_byte_stream_next (ac3_byte_stream_t * p_byte_stream)
     /* We are looking for the next TS packet that contains real data,
      * and not just a PES header */
     do {
-       /* We were reading the last TS packet of this PES packet... It's
-        * time to jump to the next PES packet */
-       if (p_ac3dec->p_ts->p_next_ts == NULL) {
-           int ptr;
-
-           /* We are going to read/write the start and end indexes of the 
-            * decoder fifo and to use the fifo's conditional variable, 
-            * that's why we need to take the lock before */ 
-           vlc_mutex_lock (&p_ac3dec->fifo.data_lock);
-           
-           /* Is the input thread dying ? */
-           if (p_ac3dec->p_input->b_die) {
-               vlc_mutex_unlock (&(p_ac3dec->fifo.data_lock));
-               return;
-           }
-
-           /* We should increase the start index of the decoder fifo, but
+        /* We were reading the last TS packet of this PES packet... It's
+         * time to jump to the next PES packet */
+        if (p_ac3dec->p_ts->p_next_ts == NULL) {
+            int ptr;
+
+            /* We are going to read/write the start and end indexes of the 
+             * decoder fifo and to use the fifo's conditional variable, 
+             * that's why we need to take the lock before */ 
+            vlc_mutex_lock (&p_ac3dec->fifo.data_lock);
+
+            /* Is the input thread dying ? */
+            if (p_ac3dec->p_input->b_die) {
+                vlc_mutex_unlock (&(p_ac3dec->fifo.data_lock));
+                return;
+            }
+
+            /* We should increase the start index of the decoder fifo, but
              * if we do this now, the input thread could overwrite the
              * pointer to the current PES packet, and we weren't able to
              * give it back to the netlist. That's why we free the PES
              * packet first. */
-           input_NetlistFreePES (p_ac3dec->p_input, DECODER_FIFO_START(p_ac3dec->fifo));
-
-           DECODER_FIFO_INCSTART (p_ac3dec->fifo);
-
-           while (DECODER_FIFO_ISEMPTY(p_ac3dec->fifo)) {
-               vlc_cond_wait (&p_ac3dec->fifo.data_wait, &p_ac3dec->fifo.data_lock);
-
-               if (p_ac3dec->p_input->b_die) {
-                   vlc_mutex_unlock (&(p_ac3dec->fifo.data_lock));
-                   return;
-               }
-           }
-
-           /* The next byte could be found in the next PES packet */
-           p_ac3dec->p_ts = DECODER_FIFO_START (p_ac3dec->fifo)->p_first_ts;
-
-           /* parse ac3 magic header */
-           ptr = p_ac3dec->p_ts->buffer [p_ac3dec->p_ts->i_payload_start+2];
-           ptr <<= 8;
-           ptr |= p_ac3dec->p_ts->buffer [p_ac3dec->p_ts->i_payload_start+3];
-           p_ac3dec->sync_ptr = ptr;
-           p_ac3dec->p_ts->i_payload_start += 4;
-
-           /* We can release the fifo's data lock */
-           vlc_mutex_unlock (&p_ac3dec->fifo.data_lock);
-       }
-
-       /* Perhaps the next TS packet of the current PES packet contains 
-        * real data (ie its payload's size is greater than 0) */
-       else {
-           p_ac3dec->p_ts = p_ac3dec->p_ts->p_next_ts;
-       }
+            input_NetlistFreePES (p_ac3dec->p_input, DECODER_FIFO_START(p_ac3dec->fifo));
+
+            DECODER_FIFO_INCSTART (p_ac3dec->fifo);
+
+            while (DECODER_FIFO_ISEMPTY(p_ac3dec->fifo)) {
+                vlc_cond_wait (&p_ac3dec->fifo.data_wait, &p_ac3dec->fifo.data_lock);
+
+                if (p_ac3dec->p_input->b_die) {
+                    vlc_mutex_unlock (&(p_ac3dec->fifo.data_lock));
+                    return;
+                }
+            }
+
+            /* The next byte could be found in the next PES packet */
+            p_ac3dec->p_ts = DECODER_FIFO_START (p_ac3dec->fifo)->p_first_ts;
+
+            /* parse ac3 magic header */
+            ptr = p_ac3dec->p_ts->buffer [p_ac3dec->p_ts->i_payload_start+2];
+            ptr <<= 8;
+            ptr |= p_ac3dec->p_ts->buffer [p_ac3dec->p_ts->i_payload_start+3];
+            p_ac3dec->sync_ptr = ptr;
+            p_ac3dec->p_ts->i_payload_start += 4;
+
+            /* We can release the fifo's data lock */
+            vlc_mutex_unlock (&p_ac3dec->fifo.data_lock);
+        }
+
+        /* Perhaps the next TS packet of the current PES packet contains 
+         * real data (ie its payload's size is greater than 0) */
+        else {
+            p_ac3dec->p_ts = p_ac3dec->p_ts->p_next_ts;
+        }
     } while (p_ac3dec->p_ts->i_payload_start == p_ac3dec->p_ts->i_payload_end);
     p_byte_stream->p_byte =
-       p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_start; 
+        p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_start; 
     p_byte_stream->p_end =
-       p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_end; 
+        p_ac3dec->p_ts->buffer + p_ac3dec->p_ts->i_payload_end; 
 }
index e3f6a0d..e31cda6 100644 (file)
 
 #include <stdio.h>                                           /* "intf_msg.h" */
 
-#include "int_types.h"
+#include "common.h"
+
 #include "ac3_decoder.h"
 #include "ac3_internal.h"
 #include "ac3_bit_stream.h"
 
+#include "intf_msg.h"
+
 #define Q0 ((-2 << 15) / 3.0)
 #define Q1 (0)
 #define Q2 ((2 << 15) / 3.0)
index 69813ca..7f08657 100644 (file)
@@ -80,7 +80,8 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
 aout_thread_t *aout_CreateThread( int *pi_status )
 {
     aout_thread_t * p_aout;                             /* thread descriptor */
-    char * psz_method;
+    typedef void    ( aout_getplugin_t ) ( aout_thread_t * p_aout );
+    int             i_index;
 #if 0
     int             i_status;                                 /* thread status */
 #endif
@@ -92,32 +93,27 @@ aout_thread_t *aout_CreateThread( int *pi_status )
         return( NULL );
     }
 
-    /* Request an interface plugin */
-    psz_method = main_GetPszVariable( AOUT_METHOD_VAR, AOUT_DEFAULT_METHOD );
-    
-    if( RequestPlugin( &p_aout->aout_plugin, psz_method ) )
+    /* Get a suitable audio plugin */
+    for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ )
     {
-        intf_ErrMsg( "error: could not open audio plugin %s.so\n", psz_method );
-        free( p_aout );
-        return( NULL );
+        /* If there's a plugin in p_info ... */
+        if( p_main->p_bank->p_info[ i_index ] != NULL )
+        {
+            /* ... and if this plugin provides the functions we want ... */
+            if( p_main->p_bank->p_info[ i_index ]->aout_GetPlugin != NULL )
+            {
+                /* ... then get these functions */
+                ( (aout_getplugin_t *)
+                  p_main->p_bank->p_info[ i_index ]->aout_GetPlugin )( p_aout );
+            }
+        }
     }
 
-    /* Get plugins */
-    p_aout->p_sys_open =         GetPluginFunction( p_aout->aout_plugin, "aout_SysOpen" );
-    p_aout->p_sys_reset =        GetPluginFunction( p_aout->aout_plugin, "aout_SysReset" );
-    p_aout->p_sys_setformat =    GetPluginFunction( p_aout->aout_plugin, "aout_SysSetFormat" );
-    p_aout->p_sys_setchannels =  GetPluginFunction( p_aout->aout_plugin, "aout_SysSetChannels" );
-    p_aout->p_sys_setrate =      GetPluginFunction( p_aout->aout_plugin, "aout_SysSetRate" );
-    p_aout->p_sys_getbufinfo =   GetPluginFunction( p_aout->aout_plugin, "aout_SysGetBufInfo" );
-    p_aout->p_sys_playsamples =  GetPluginFunction( p_aout->aout_plugin, "aout_SysPlaySamples" );
-    p_aout->p_sys_close =        GetPluginFunction( p_aout->aout_plugin, "aout_SysClose" );
-
     /*
      * Initialize audio device
      */
     if ( p_aout->p_sys_open( p_aout ) )
     {
-        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
@@ -128,28 +124,24 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     if ( p_aout->p_sys_reset( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
     if ( p_aout->p_sys_setformat( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
     if ( p_aout->p_sys_setchannels( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
     if ( p_aout->p_sys_setrate( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
@@ -163,7 +155,6 @@ aout_thread_t *aout_CreateThread( int *pi_status )
     if( aout_SpawnThread( p_aout ) )
     {
         p_aout->p_sys_close( p_aout );
-        TrashPlugin( p_aout->aout_plugin );
         free( p_aout );
         return( NULL );
     }
@@ -330,9 +321,6 @@ void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
     p_aout->p_sys_close( p_aout );
     intf_DbgMsg("aout debug: audio device (%s) closed\n", p_aout->psz_device);
 
-    /* Close plugin */
-    TrashPlugin( p_aout->aout_plugin );
-
     /* Free structure */
     free( p_aout );
 }
@@ -746,7 +734,7 @@ void aout_Thread_U8_Mono( aout_thread_t * p_aout )
                             }
                         }
 #define SOUND 1
-#define DEBUG 0
+#define ADEBUG 0
 #define COEFF 2
                         if ( p_aout->fifo[i_fifo].l_units > l_units )
                         {
@@ -771,7 +759,7 @@ l_buffer++;
 */
 #endif
 
-#if DEBUG 
+#if ADEBUG 
 //intf_DbgMsg( "p_aout->s32_buffer[l_buffer] 11 : %x (%d)",p_aout->s32_buffer[l_buffer-1],p_aout->s32_buffer[l_buffer-1] );
 intf_DbgMsg( "p_aout->fifo %ld\n",COEFF*p_aout->fifo[i_fifo].l_unit );
 intf_DbgMsg( "%d - p_aout->s32b %ld\n", l_buffer, (s32) ( ((s16 *)p_aout->fifo[i_fifo].buffer)[COEFF*p_aout->fifo[i_fifo].l_unit] ) );
@@ -822,7 +810,7 @@ if( COEFF*p_aout->fifo[i_fifo].l_unit < 60000 )
 */
 #endif
 
-#if DEBUG
+#if ADEBUG
 //intf_DbgMsg( "p_aout->s32_buffer[l_buffer] 21 : %x (%d)",p_aout->s32_buffer[l_buffer-1],p_aout->s32_buffer[l_buffer-1] );
 intf_DbgMsg( "p_aout->fifo %ld\n",COEFF*p_aout->fifo[i_fifo].l_unit );
 intf_DbgMsg( "%d - p_aout->s32b %ld\n", l_buffer, (s32) ( ((s16 *)p_aout->fifo[i_fifo].buffer)[COEFF*p_aout->fifo[i_fifo].l_unit] ) );
index e91d321..056a1bf 100644 (file)
@@ -433,11 +433,7 @@ static void EndThread( input_thread_t * p_input )
         {
         case MPEG1_VIDEO_ES:
         case MPEG2_VIDEO_ES:
-#ifdef OLD_DECODER
-            vdec_DestroyThread( (vdec_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
-#else
             vpar_DestroyThread( (vpar_thread_t*)(p_input->pp_selected_es[i_es_loop]->p_dec) /*, NULL */ );
-#endif
             break;
         case MPEG1_AUDIO_ES:
         case MPEG2_AUDIO_ES:
@@ -1212,11 +1208,7 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
         {
             case MPEG1_VIDEO_ES:
             case MPEG2_VIDEO_ES:
-#ifdef OLD_DECODER
-                p_fifo = &(((vdec_thread_t*)(p_es_descriptor->p_dec))->fifo);
-#else
                 p_fifo = &(((vpar_thread_t*)(p_es_descriptor->p_dec))->fifo);
-#endif
                 break;
 
             case MPEG1_AUDIO_ES:
@@ -1225,8 +1217,6 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
                 break;
 
             case AC3_AUDIO_ES:
-                /* we skip 4 bytes at the beginning of the AC3 payload */
-                //p_ts->i_payload_start += 4;
                 p_fifo = &(((ac3dec_thread_t *)(p_es_descriptor->p_dec))->fifo);
                 break;
 
@@ -1293,8 +1283,9 @@ static __inline__ void input_ParsePES( input_thread_t *p_input,
 /*****************************************************************************
  * input_DemuxPSI:
  *****************************************************************************
- * Notice that current ES state has been locked by input_SortPacket. (No more true,
- * changed by benny - FIXME: See if it's ok, and definitely change the code ?? )
+ * Notice that current ES state has been locked by input_SortPacket.
+ * (No more true, changed by benny - FIXME: See if it's ok, and definitely
+ * change the code ?? )
  *****************************************************************************/
 static __inline__ void input_DemuxPSI( input_thread_t *p_input,
                                        ts_packet_t *p_ts_packet,
@@ -1303,7 +1294,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
 {
     int i_data_offset;    /* Offset of the interesting data in the TS packet */
     u16 i_data_length;                               /* Length of those data */
-    //boolean_t b_first_section; /* Was there another section in the TS packet ? */
+  //boolean_t b_first_section;         /* another section in the TS packet ? */
 
     ASSERT(p_input);
     ASSERT(p_ts_packet);
@@ -1322,13 +1313,14 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
        It will be set to a correct value if the data are not corrupted */
     i_data_offset = TS_PACKET_SIZE;
 
-    /* Has the reassembly of a section already began in a previous packet ? */
+    /* Has the reassembly of a section already begun in a previous packet ? */
     if( p_psi->b_running_section )
     {
         /* Was data lost since the last TS packet ? */
         if( b_packet_lost )
         {
-            /* Discard the packet and wait for the begining of a new one to resynch */
+            /* Discard the packet and wait for the begining of a new one
+             * to resynch */
             p_psi->b_running_section = 0;
             p_psi->i_current_position = 0;
             intf_DbgMsg( "PSI section(s) discarded due to packet loss\n" );
@@ -1350,35 +1342,36 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
         if( b_unit_start )
         {
             /* Get the offset at which the data for that section can be found
-               The offset is stored in the pointer_field since we are interested in
-               the first section of the TS packet. Note that the +1 is to bypass
- &