From 647cca0ebb2e897a570018ba80483bb81a7d90c6 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 18 Jan 2001 05:13:23 +0000 Subject: [PATCH] The motion compensation routines are now modules as well ; choose your implementation with `--motion motion', `--motion motionmmx' or `--motion motionmmxext'. Of course, the best implementation is chosen if you don't ask for any. There doesn't seem to be any performance hit due to the move to shared libs, which is a good thing. Please test actively if you have time, though. Updated --help result, manpage, INSTALL document, and a few files. I moved vdec_motion.h and vpar_blocks.h back to /include because they will be needed to build motion compensation modules, but perhaps we don't need to export everything which is in these files. /src/video_decoder/ now has only one .c file, perhaps it could now be merged with video_parser ? --- INSTALL | 7 + Makefile.in | 57 +++++--- configure | 6 +- configure.in | 6 +- debian/vlc.1 | 3 + include/common.h | 5 +- include/config.h.in | 3 + include/modules.h | 29 +++- {src/video_decoder => include}/vdec_motion.h | 23 +-- {src/video_decoder => include}/vpar_blocks.h | 5 +- plugins/idct/idct.c | 4 +- plugins/idct/idctclassic.c | 4 +- plugins/idct/idctmmx.c | 4 +- plugins/motion/motion.c | 126 ++++++++++++++++ plugins/motion/motionmmx.c | 134 ++++++++++++++++++ plugins/motion/motionmmxext.c | 134 ++++++++++++++++++ .../motion/vdec_motion_common.c | 106 +++++++++----- .../motion}/vdec_motion_inner.c | 19 +-- .../motion}/vdec_motion_inner_mmx.c | 19 +-- .../motion}/vdec_motion_inner_mmxext.c | 23 +-- plugins/yuv/video_yuv.c | 2 +- plugins/yuv/yuv.c | 2 +- plugins/yuv/yuvmmx.c | 2 +- src/input/input_programs.c | 7 +- src/interface/main.c | 11 +- src/misc/modules.c | 5 +- src/video_decoder/video_decoder.c | 4 +- src/video_decoder/video_parser.h | 9 +- src/video_parser/video_fifo.c | 6 +- src/video_parser/video_parser.c | 101 +++++++++++-- src/video_parser/vpar_blocks.c | 48 ++----- src/video_parser/vpar_headers.c | 6 +- src/video_parser/vpar_synchro.c | 6 +- 33 files changed, 700 insertions(+), 226 deletions(-) rename {src/video_decoder => include}/vdec_motion.h (56%) rename {src/video_decoder => include}/vpar_blocks.h (97%) create mode 100644 plugins/motion/motion.c create mode 100644 plugins/motion/motionmmx.c create mode 100644 plugins/motion/motionmmxext.c rename src/video_decoder/vdec_motion.c => plugins/motion/vdec_motion_common.c (90%) rename {src/video_decoder => plugins/motion}/vdec_motion_inner.c (97%) rename {src/video_decoder => plugins/motion}/vdec_motion_inner_mmx.c (98%) rename {src/video_decoder => plugins/motion}/vdec_motion_inner_mmxext.c (98%) diff --git a/INSTALL b/INSTALL index 0b4232896e..accc3d1bfc 100644 --- a/INSTALL +++ b/INSTALL @@ -28,6 +28,13 @@ To build RedHat packages, use : rpm -ba vlc.spec +Here's a shortcut to copy-paste to do a clean build : + + make distclean 2>/dev/null ; ./configure --prefix=/usr --enable-gnome \ + --enable-fb --with-glide --with-ggi --with-sdl --enable-esd \ + --enable-alsa && make + + Installing and running VideoLAN =============================== diff --git a/Makefile.in b/Makefile.in index dc20060c6c..6925139d08 100644 --- a/Makefile.in +++ b/Makefile.in @@ -225,22 +225,13 @@ SPU_DECODER = src/spu_decoder/spu_decoder.o #GEN_DECODER = src/generic_decoder/generic_decoder.o - VIDEO_PARSER = src/video_parser/video_parser.o \ src/video_parser/vpar_headers.o \ src/video_parser/vpar_blocks.o \ src/video_parser/vpar_synchro.o \ src/video_parser/video_fifo.o -ifneq (,$(findstring mmx,$(ARCH))) - vdec_motion_inner = src/video_decoder/vdec_motion_inner_mmx.o -else - vdec_motion_inner = src/video_decoder/vdec_motion_inner.o -endif - -VIDEO_DECODER = src/video_decoder/video_decoder.o \ - src/video_decoder/vdec_motion.o \ - $(vdec_motion_inner) +VIDEO_DECODER = src/video_decoder/video_decoder.o MISC = src/misc/mtime.o \ src/misc/tests.o \ @@ -344,6 +335,18 @@ PLUGIN_YUVMMX = plugins/yuv/yuvmmx.o \ plugins/yuv/video_yuvmmx.o \ plugins/yuv/transforms_yuvmmx.o +PLUGIN_MOTION = plugins/motion/motion.o \ + plugins/motion/vdec_motion_common.o \ + plugins/motion/vdec_motion_inner.o + +PLUGIN_MOTIONMMX = plugins/motion/motionmmx.o \ + plugins/motion/vdec_motion_common.o \ + plugins/motion/vdec_motion_inner_mmx.o + +PLUGIN_MOTIONMMXEXT = plugins/motion/motionmmxext.o \ + plugins/motion/vdec_motion_common.o \ + plugins/motion/vdec_motion_inner_mmxext.o + PLUGIN_IDCT = plugins/idct/idct.o \ plugins/idct/idct_common.o @@ -369,6 +372,9 @@ STD_PLUGIN_OBJ =$(PLUGIN_BEOS) \ $(PLUGIN_X11) \ $(PLUGIN_YUV) \ $(PLUGIN_YUVMMX) \ + $(PLUGIN_MOTION) \ + $(PLUGIN_MOTIONMMX) \ + $(PLUGIN_MOTIONMMXEXT) \ $(PLUGIN_IDCT) \ $(PLUGIN_IDCTCLASSIC) \ $(PLUGIN_IDCTMMX) \ @@ -378,7 +384,8 @@ STD_PLUGIN_OBJ =$(PLUGIN_BEOS) \ $(PLUGIN_NULL) # list duplicates -STD_PLUGIN_COMMON = plugins/idct/idct_common.o +STD_PLUGIN_COMMON = plugins/idct/idct_common.o \ + plugins/motion/vdec_motion_common.o # filter out duplicates from the plugin object lists STD_PLUGIN_OBJ := $(filter-out $(STD_PLUGIN_COMMON) $(STD_PLUGIN_ASM), \ @@ -404,8 +411,8 @@ all: vlc @ALIASES@ plugins clean: rm -f $(C_OBJ) $(CPP_OBJ) $(ASM_OBJ) $(STD_PLUGIN_OBJ) - rm -f plugins/*/*.o src/*/*.o - rm -f vlc @ALIASES@ lib/*.so + rm -f plugins/*/*.o src/*/*.o lib/*.so + rm -f vlc @ALIASES@ distclean: clean rm -f src/*/*.o plugins/*/*.o **/*~ *.log @@ -558,15 +565,24 @@ lib/null.so: $(PLUGIN_NULL) lib/dummy.so: $(PLUGIN_DUMMY) $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ -lib/idct.so: $(PLUGIN_IDCT) - $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ - lib/yuv.so: $(PLUGIN_YUV) $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ lib/yuvmmx.so: $(PLUGIN_YUVMMX) $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ +lib/motion.so: $(PLUGIN_MOTION) + $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ + +lib/motionmmx.so: $(PLUGIN_MOTIONMMX) + $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ + +lib/motionmmxext.so: $(PLUGIN_MOTIONMMXEXT) + $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ + +lib/idct.so: $(PLUGIN_IDCT) + $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ + lib/idctclassic.so: $(PLUGIN_IDCTCLASSIC) $(CC) -nostart -Xlinker -soname=$@ -o $@ $^ plugins/_APP_ @@ -588,6 +604,15 @@ lib/yuv.so: $(PLUGIN_YUV) lib/yuvmmx.so: $(PLUGIN_YUVMMX) $(CC) $(PCFLAGS) -shared -o $@ $^ +lib/motion.so: $(PLUGIN_MOTION) + $(CC) $(PCFLAGS) -shared -o $@ $^ + +lib/motionmmx.so: $(PLUGIN_MOTIONMMX) + $(CC) $(PCFLAGS) -shared -o $@ $^ + +lib/motionmmxext.so: $(PLUGIN_MOTIONMMXEXT) + $(CC) $(PCFLAGS) -shared -o $@ $^ + lib/idct.so: $(PLUGIN_IDCT) $(CC) $(PCFLAGS) -shared -o $@ $^ diff --git a/configure b/configure index 776c2450d4..42db13a400 100755 --- a/configure +++ b/configure @@ -3296,7 +3296,7 @@ EOF fi -PLUGINS=${PLUGINS}"yuv idct idctclassic "; +PLUGINS=${PLUGINS}"yuv idct idctclassic motion "; ARCH=${host_cpu} # Check whether --enable-ppro or --disable-ppro was given. @@ -3310,9 +3310,9 @@ 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 idctmmx idctmmxext "; fi + if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx motionmmx motionmmxext idctmmx idctmmxext "; fi else - if test x${host_cpu} = xi686 -o x${host_cpu} = xi586; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx idctmmx idctmmxext "; fi + if test x${host_cpu} = xi686 -o x${host_cpu} = xi586; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx motionmmx motionmmxext idctmmx idctmmxext "; fi fi # Check whether --enable-debug or --disable-debug was given. diff --git a/configure.in b/configure.in index 88931fa399..96d71114cf 100644 --- a/configure.in +++ b/configure.in @@ -108,7 +108,7 @@ AC_TYPE_SIZE_T AC_HEADER_TIME dnl default plugins -PLUGINS=${PLUGINS}"yuv idct idctclassic "; +PLUGINS=${PLUGINS}"yuv idct idctclassic motion "; ARCH=${host_cpu} AC_ARG_ENABLE(ppro, @@ -117,8 +117,8 @@ AC_ARG_ENABLE(ppro, [ if test x${host_cpu} = xi686; then ARCH=${ARCH}" ppro"; fi ]) AC_ARG_ENABLE(mmx, [ --disable-mmx Disable MMX optimizations (default enabled for x86)], -[ if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx idctmmx idctmmxext "; fi ], -[ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx idctmmx idctmmxext "; fi ]) +[ if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx motionmmx motionmmxext idctmmx idctmmxext "; fi ], +[ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}"yuvmmx motionmmx motionmmxext idctmmx idctmmxext "; fi ]) AC_ARG_ENABLE(debug, [ --enable-debug Enable debug mode (default disabled)], [ if test x$enableval = xyes; then DEBUG=1; fi ]) diff --git a/debian/vlc.1 b/debian/vlc.1 index b1aa912041..f3207d63d4 100644 --- a/debian/vlc.1 +++ b/debian/vlc.1 @@ -47,6 +47,9 @@ Disable video output. .B \-\-vout Specify a video output module: "gnome", "fb", "glide", for instance. .TP +.B \-\-motion +Specify a module for motion compensation: "motion", "motionmmx", for instance. +.TP .B \-\-idct Specify a module for IDCT: "idct", "idctmmx", for instance. .TP diff --git a/include/common.h b/include/common.h index 8f5446a2e7..92f6b8aa72 100644 --- a/include/common.h +++ b/include/common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: common.h,v 1.24 2001/01/13 12:57:19 sam Exp $ + * $Id: common.h,v 1.25 2001/01/18 05:13:22 sam Exp $ * * Authors: Samuel Hocevar * Vincent Seguin @@ -128,6 +128,9 @@ typedef struct vdec_thread_s * p_vdec_thread_t; typedef struct vpar_thread_s * p_vpar_thread_t; typedef struct video_parser_s * p_video_parser_t; +/* Misc */ +struct macroblock_s; + /***************************************************************************** * Macros and inline functions *****************************************************************************/ diff --git a/include/config.h.in b/include/config.h.in index 07e2c5bec0..34dd6c02cf 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -278,6 +278,9 @@ /* Environment variable containing the display method */ #define VOUT_METHOD_VAR "vlc_vout" +/* Environment variable containing the motion compensation method */ +#define MOTION_METHOD_VAR "vlc_motion" + /* Environment variable containing the IDCT method */ #define IDCT_METHOD_VAR "vlc_idct" diff --git a/include/modules.h b/include/modules.h index 57cf042ad9..09b4b78320 100644 --- a/include/modules.h +++ b/include/modules.h @@ -40,12 +40,13 @@ typedef void * module_handle_t; #define MODULE_CAPABILITY_DECAPS 1 << 2 /* Decaps */ #define MODULE_CAPABILITY_ADEC 1 << 3 /* Audio decoder */ #define MODULE_CAPABILITY_VDEC 1 << 4 /* Video decoder */ -#define MODULE_CAPABILITY_IDCT 1 << 5 /* IDCT transformation */ -#define MODULE_CAPABILITY_AOUT 1 << 6 /* Audio output */ -#define MODULE_CAPABILITY_VOUT 1 << 7 /* Video output */ -#define MODULE_CAPABILITY_YUV 1 << 8 /* YUV colorspace conversion */ -#define MODULE_CAPABILITY_AFX 1 << 9 /* Audio effects */ -#define MODULE_CAPABILITY_VFX 1 << 10 /* Video effects */ +#define MODULE_CAPABILITY_MOTION 1 << 5 /* Video decoder */ +#define MODULE_CAPABILITY_IDCT 1 << 6 /* IDCT transformation */ +#define MODULE_CAPABILITY_AOUT 1 << 7 /* Audio output */ +#define MODULE_CAPABILITY_VOUT 1 << 8 /* Video output */ +#define MODULE_CAPABILITY_YUV 1 << 9 /* YUV colorspace conversion */ +#define MODULE_CAPABILITY_AFX 1 << 10 /* Audio effects */ +#define MODULE_CAPABILITY_VFX 1 << 11 /* Video effects */ /* FIXME: not yet used */ typedef struct probedata_s @@ -74,6 +75,21 @@ typedef struct function_list_s void ( * pf_close ) ( struct aout_thread_s * p_aout ); } aout; + struct + { +#define motion_functions( yuv ) \ + void ( * pf_field_field_##yuv ) ( struct macroblock_s * ); \ + void ( * pf_field_16x8_##yuv ) ( struct macroblock_s * ); \ + void ( * pf_field_dmv_##yuv ) ( struct macroblock_s * ); \ + void ( * pf_frame_field_##yuv ) ( struct macroblock_s * ); \ + void ( * pf_frame_frame_##yuv ) ( struct macroblock_s * ); \ + void ( * pf_frame_dmv_##yuv ) ( struct macroblock_s * ); + motion_functions( 420 ) + motion_functions( 422 ) + motion_functions( 444 ) +#undef motion_functions + } motion; + struct { void ( * pf_init ) ( struct vdec_thread_s * p_vdec ); @@ -105,6 +121,7 @@ typedef struct module_functions_s function_list_t decaps; function_list_t adec; function_list_t vdec; + function_list_t motion; function_list_t idct; function_list_t aout; function_list_t vout; diff --git a/src/video_decoder/vdec_motion.h b/include/vdec_motion.h similarity index 56% rename from src/video_decoder/vdec_motion.h rename to include/vdec_motion.h index e2934511c7..1bbf3a9368 100644 --- a/src/video_decoder/vdec_motion.h +++ b/include/vdec_motion.h @@ -2,7 +2,7 @@ * vdec_motion.h : types for the motion compensation algorithm ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vdec_motion.h,v 1.1 2000/12/21 17:19:52 massiot Exp $ + * $Id: vdec_motion.h,v 1.14 2001/01/18 05:13:22 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -40,24 +40,3 @@ struct motion_arg_s; typedef void (*f_motion_t)( struct macroblock_s* ); -/***************************************************************************** - * Prototypes - *****************************************************************************/ -void vdec_MotionFieldField420( struct macroblock_s * p_mb ); -void vdec_MotionField16x8420( struct macroblock_s * p_mb ); -void vdec_MotionFieldDMV420( struct macroblock_s * p_mb ); -void vdec_MotionFrameFrame420( struct macroblock_s * p_mb ); -void vdec_MotionFrameField420( struct macroblock_s * p_mb ); -void vdec_MotionFrameDMV420( struct macroblock_s * p_mb ); -void vdec_MotionFieldField422( struct macroblock_s * p_mb ); -void vdec_MotionField16x8422( struct macroblock_s * p_mb ); -void vdec_MotionFieldDMV422( struct macroblock_s * p_mb ); -void vdec_MotionFrameFrame422( struct macroblock_s * p_mb ); -void vdec_MotionFrameField422( struct macroblock_s * p_mb ); -void vdec_MotionFrameDMV422( struct macroblock_s * p_mb ); -void vdec_MotionFieldField444( struct macroblock_s * p_mb ); -void vdec_MotionField16x8444( struct macroblock_s * p_mb ); -void vdec_MotionFieldDMV444( struct macroblock_s * p_mb ); -void vdec_MotionFrameFrame444( struct macroblock_s * p_mb ); -void vdec_MotionFrameField444( struct macroblock_s * p_mb ); -void vdec_MotionFrameDMV444( struct macroblock_s * p_mb ); diff --git a/src/video_decoder/vpar_blocks.h b/include/vpar_blocks.h similarity index 97% rename from src/video_decoder/vpar_blocks.h rename to include/vpar_blocks.h index 907e8eb46a..a3efa11d89 100644 --- a/src/video_decoder/vpar_blocks.h +++ b/include/vpar_blocks.h @@ -2,7 +2,7 @@ * vpar_blocks.h : video parser blocks management ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_blocks.h,v 1.2 2001/01/17 18:17:30 massiot Exp $ + * $Id: vpar_blocks.h,v 1.32 2001/01/18 05:13:22 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -52,7 +52,8 @@ typedef struct macroblock_s /* IDCT information */ dctelem_t ppi_blocks[12][64]; /* blocks */ - f_idct_t pf_idct[12]; /* sparse IDCT or not ? */ + void ( * pf_idct[12] ) ( struct vdec_thread_s *, + dctelem_t*, int ); /* sparse IDCT or not ? */ int pi_sparse_pos[12]; /* position of the * non-NULL coeff */ diff --git a/plugins/idct/idct.c b/plugins/idct/idct.c index 7b9738df4f..6cda95f83b 100644 --- a/plugins/idct/idct.c +++ b/plugins/idct/idct.c @@ -2,7 +2,7 @@ * idct.c : IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idct.c,v 1.5 2001/01/17 18:17:30 massiot Exp $ + * $Id: idct.c,v 1.6 2001/01/18 05:13:22 sam Exp $ * * Authors: Gaël Hendryckx * @@ -73,7 +73,7 @@ MODULE_CONFIG_END int InitModule( module_t * p_module ) { p_module->psz_name = MODULE_STRING; - p_module->psz_longname = "C IDCT module"; + p_module->psz_longname = "IDCT module"; p_module->psz_version = VERSION; p_module->i_capabilities = MODULE_CAPABILITY_NULL diff --git a/plugins/idct/idctclassic.c b/plugins/idct/idctclassic.c index d823d37829..4d09620077 100644 --- a/plugins/idct/idctclassic.c +++ b/plugins/idct/idctclassic.c @@ -2,7 +2,7 @@ * idctclassic.c : Classic IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctclassic.c,v 1.5 2001/01/17 18:17:30 massiot Exp $ + * $Id: idctclassic.c,v 1.6 2001/01/18 05:13:22 sam Exp $ * * Authors: Gaël Hendryckx * @@ -73,7 +73,7 @@ MODULE_CONFIG_END int InitModule( module_t * p_module ) { p_module->psz_name = MODULE_STRING; - p_module->psz_longname = "classic C IDCT module"; + p_module->psz_longname = "classic IDCT module"; p_module->psz_version = VERSION; p_module->i_capabilities = MODULE_CAPABILITY_NULL diff --git a/plugins/idct/idctmmx.c b/plugins/idct/idctmmx.c index 39416be8bd..5606819d89 100644 --- a/plugins/idct/idctmmx.c +++ b/plugins/idct/idctmmx.c @@ -2,7 +2,7 @@ * idctmmx.c : MMX IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctmmx.c,v 1.6 2001/01/17 18:17:30 massiot Exp $ + * $Id: idctmmx.c,v 1.7 2001/01/18 05:13:22 sam Exp $ * * Authors: Aaron Holtzman * Michel Lespinasse @@ -153,7 +153,7 @@ static int idct_Probe( probedata_t *p_data ) } else { - return( 100 ); + return( 150 ); } } else diff --git a/plugins/motion/motion.c b/plugins/motion/motion.c new file mode 100644 index 0000000000..c922bb7fbc --- /dev/null +++ b/plugins/motion/motion.c @@ -0,0 +1,126 @@ +/***************************************************************************** + * motion.c : C motion compensation module 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. + *****************************************************************************/ + +#define MODULE_NAME motion + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include /* malloc(), free() */ + +#include "config.h" +#include "common.h" /* boolean_t, byte_t */ +#include "threads.h" +#include "mtime.h" +#include "tests.h" + +#include "video.h" + +#include "modules.h" +#include "modules_inner.h" + +/***************************************************************************** + * Local and extern prototypes. + *****************************************************************************/ +extern void motion_getfunctions( function_list_t * p_function_list ); + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +ADD_WINDOW( "Configuration for motion compensation module" ) + ADD_COMMENT( "Ha, ha -- nothing to configure yet" ) +MODULE_CONFIG_END + +/***************************************************************************** + * InitModule: get the module structure and configuration. + ***************************************************************************** + * We have to fill psz_name, psz_longname and psz_version. These variables + * will be strdup()ed later by the main application because the module can + * be unloaded later to save memory, and we want to be able to access this + * data even after the module has been unloaded. + *****************************************************************************/ +int InitModule( module_t * p_module ) +{ + p_module->psz_name = MODULE_STRING; + p_module->psz_longname = "motion compensation module"; + p_module->psz_version = VERSION; + + p_module->i_capabilities = MODULE_CAPABILITY_NULL + | MODULE_CAPABILITY_MOTION; + + return( 0 ); +} + +/***************************************************************************** + * ActivateModule: set the module to an usable state. + ***************************************************************************** + * This function fills the capability functions and the configuration + * structure. Once ActivateModule() has been called, the i_usage can + * be set to 0 and calls to NeedModule() be made to increment it. To unload + * the module, one has to wait until i_usage == 0 and call DeactivateModule(). + *****************************************************************************/ +int ActivateModule( module_t * p_module ) +{ + p_module->p_functions = malloc( sizeof( module_functions_t ) ); + if( p_module->p_functions == NULL ) + { + return( -1 ); + } + + motion_getfunctions( &p_module->p_functions->motion ); + + p_module->p_config = p_config; + + return( 0 ); +} + +/***************************************************************************** + * DeactivateModule: make sure the module can be unloaded. + ***************************************************************************** + * This function must only be called when i_usage == 0. If it successfully + * returns, i_usage can be set to -1 and the module unloaded. Be careful to + * lock usage_lock during the whole process. + *****************************************************************************/ +int DeactivateModule( module_t * p_module ) +{ + free( p_module->p_functions ); + + return( 0 ); +} + +/***************************************************************************** + * motion_Probe: tests probe the CPU and return a score + *****************************************************************************/ +int motion_Probe( probedata_t *p_data ) +{ + if( TestMethod( MOTION_METHOD_VAR, "motion" ) ) + { + return( 999 ); + } + + /* This module always works */ + return( 50 ); +} + diff --git a/plugins/motion/motionmmx.c b/plugins/motion/motionmmx.c new file mode 100644 index 0000000000..f50151ff13 --- /dev/null +++ b/plugins/motion/motionmmx.c @@ -0,0 +1,134 @@ +/***************************************************************************** + * motionmmx.c : MMX motion compensation module 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. + *****************************************************************************/ + +#define MODULE_NAME motionmmx + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include /* malloc(), free() */ + +#include "config.h" +#include "common.h" /* boolean_t, byte_t */ +#include "threads.h" +#include "mtime.h" +#include "tests.h" + +#include "video.h" + +#include "modules.h" +#include "modules_inner.h" + +/***************************************************************************** + * Local and extern prototypes. + *****************************************************************************/ +extern void motion_getfunctions( function_list_t * p_function_list ); + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +ADD_WINDOW( "Configuration for MMX motion compensation module" ) + ADD_COMMENT( "Ha, ha -- nothing to configure yet" ) +MODULE_CONFIG_END + +/***************************************************************************** + * InitModule: get the module structure and configuration. + ***************************************************************************** + * We have to fill psz_name, psz_longname and psz_version. These variables + * will be strdup()ed later by the main application because the module can + * be unloaded later to save memory, and we want to be able to access this + * data even after the module has been unloaded. + *****************************************************************************/ +int InitModule( module_t * p_module ) +{ + p_module->psz_name = MODULE_STRING; + p_module->psz_longname = "MMX motion compensation module"; + p_module->psz_version = VERSION; + + p_module->i_capabilities = MODULE_CAPABILITY_NULL + | MODULE_CAPABILITY_MOTION; + + return( 0 ); +} + +/***************************************************************************** + * ActivateModule: set the module to an usable state. + ***************************************************************************** + * This function fills the capability functions and the configuration + * structure. Once ActivateModule() has been called, the i_usage can + * be set to 0 and calls to NeedModule() be made to increment it. To unload + * the module, one has to wait until i_usage == 0 and call DeactivateModule(). + *****************************************************************************/ +int ActivateModule( module_t * p_module ) +{ + p_module->p_functions = malloc( sizeof( module_functions_t ) ); + if( p_module->p_functions == NULL ) + { + return( -1 ); + } + + motion_getfunctions( &p_module->p_functions->motion ); + + p_module->p_config = p_config; + + return( 0 ); +} + +/***************************************************************************** + * DeactivateModule: make sure the module can be unloaded. + ***************************************************************************** + * This function must only be called when i_usage == 0. If it successfully + * returns, i_usage can be set to -1 and the module unloaded. Be careful to + * lock usage_lock during the whole process. + *****************************************************************************/ +int DeactivateModule( module_t * p_module ) +{ + free( p_module->p_functions ); + + return( 0 ); +} + +/***************************************************************************** + * motion_Probe: tests probe the CPU and return a score + *****************************************************************************/ +int motion_Probe( probedata_t *p_data ) +{ + if( TestCPU( CPU_CAPABILITY_MMX ) ) + { + if( TestMethod( MOTION_METHOD_VAR, "motionmmx" ) ) + { + return( 999 ); + } + else + { + return( 150 ); + } + } + else + { + return( 0 ); + } +} + diff --git a/plugins/motion/motionmmxext.c b/plugins/motion/motionmmxext.c new file mode 100644 index 0000000000..583b7aa8c3 --- /dev/null +++ b/plugins/motion/motionmmxext.c @@ -0,0 +1,134 @@ +/***************************************************************************** + * motionmmxext.c : MMX EXT motion compensation module 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. + *****************************************************************************/ + +#define MODULE_NAME motionmmxext + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include "defs.h" + +#include /* malloc(), free() */ + +#include "config.h" +#include "common.h" /* boolean_t, byte_t */ +#include "threads.h" +#include "mtime.h" +#include "tests.h" + +#include "video.h" + +#include "modules.h" +#include "modules_inner.h" + +/***************************************************************************** + * Local and extern prototypes. + *****************************************************************************/ +extern void motion_getfunctions( function_list_t * p_function_list ); + +/***************************************************************************** + * Build configuration tree. + *****************************************************************************/ +MODULE_CONFIG_START +ADD_WINDOW( "Configuration for motion compensation module" ) + ADD_COMMENT( "Ha, ha -- nothing to configure yet" ) +MODULE_CONFIG_END + +/***************************************************************************** + * InitModule: get the module structure and configuration. + ***************************************************************************** + * We have to fill psz_name, psz_longname and psz_version. These variables + * will be strdup()ed later by the main application because the module can + * be unloaded later to save memory, and we want to be able to access this + * data even after the module has been unloaded. + *****************************************************************************/ +int InitModule( module_t * p_module ) +{ + p_module->psz_name = MODULE_STRING; + p_module->psz_longname = "MMX EXT motion compensation module"; + p_module->psz_version = VERSION; + + p_module->i_capabilities = MODULE_CAPABILITY_NULL + | MODULE_CAPABILITY_MOTION; + + return( 0 ); +} + +/***************************************************************************** + * ActivateModule: set the module to an usable state. + ***************************************************************************** + * This function fills the capability functions and the configuration + * structure. Once ActivateModule() has been called, the i_usage can + * be set to 0 and calls to NeedModule() be made to increment it. To unload + * the module, one has to wait until i_usage == 0 and call DeactivateModule(). + *****************************************************************************/ +int ActivateModule( module_t * p_module ) +{ + p_module->p_functions = malloc( sizeof( module_functions_t ) ); + if( p_module->p_functions == NULL ) + { + return( -1 ); + } + + motion_getfunctions( &p_module->p_functions->motion ); + + p_module->p_config = p_config; + + return( 0 ); +} + +/***************************************************************************** + * DeactivateModule: make sure the module can be unloaded. + ***************************************************************************** + * This function must only be called when i_usage == 0. If it successfully + * returns, i_usage can be set to -1 and the module unloaded. Be careful to + * lock usage_lock during the whole process. + *****************************************************************************/ +int DeactivateModule( module_t * p_module ) +{ + free( p_module->p_functions ); + + return( 0 ); +} + +/***************************************************************************** + * motion_Probe: tests probe the CPU and return a score + *****************************************************************************/ +int motion_Probe( probedata_t *p_data ) +{ + if( TestCPU( CPU_CAPABILITY_MMXEXT ) ) + { + if( TestMethod( MOTION_METHOD_VAR, "motionmmxext" ) ) + { + return( 999 ); + } + else + { + return( 200 ); + } + } + else + { + return( 0 ); + } +} + diff --git a/src/video_decoder/vdec_motion.c b/plugins/motion/vdec_motion_common.c similarity index 90% rename from src/video_decoder/vdec_motion.c rename to plugins/motion/vdec_motion_common.c index 686381d2a5..c622eaca8c 100644 --- a/src/video_decoder/vdec_motion.c +++ b/plugins/motion/vdec_motion_common.c @@ -1,8 +1,8 @@ /***************************************************************************** - * vdec_motion.c : motion compensation routines + * vdec_motion_common.c : common motion compensation routines common ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vdec_motion.c,v 1.35 2001/01/05 18:46:44 massiot Exp $ + * $Id: vdec_motion_common.c,v 1.1 2001/01/18 05:13:22 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -32,25 +32,60 @@ #include "common.h" #include "threads.h" #include "mtime.h" -#include "plugins.h" +#include "modules.h" #include "intf_msg.h" -#include "stream_control.h" -#include "input_ext-dec.h" - #include "video.h" -#include "video_output.h" -#include "vdec_idct.h" -#include "video_decoder.h" #include "vdec_motion.h" - #include "vpar_blocks.h" -#include "vpar_headers.h" -#include "vpar_synchro.h" -#include "video_parser.h" -#include "video_fifo.h" + +extern int motion_Probe( probedata_t *p_data ); + +static void vdec_MotionFieldField420 ( macroblock_t * p_mb ); +static void vdec_MotionFieldField422 ( macroblock_t * p_mb ); +static void vdec_MotionFieldField444 ( macroblock_t * p_mb ); +static void vdec_MotionField16x8420 ( macroblock_t * p_mb ); +static void vdec_MotionField16x8422 ( macroblock_t * p_mb ); +static void vdec_MotionField16x8444 ( macroblock_t * p_mb ); +static void vdec_MotionFieldDMV420 ( macroblock_t * p_mb ); +static void vdec_MotionFieldDMV422 ( macroblock_t * p_mb ); +static void vdec_MotionFieldDMV444 ( macroblock_t * p_mb ); +static void vdec_MotionFrameFrame420 ( macroblock_t * p_mb ); +static void vdec_MotionFrameFrame422 ( macroblock_t * p_mb ); +static void vdec_MotionFrameFrame444 ( macroblock_t * p_mb ); +static void vdec_MotionFrameField420 ( macroblock_t * p_mb ); +static void vdec_MotionFrameField422 ( macroblock_t * p_mb ); +static void vdec_MotionFrameField444 ( macroblock_t * p_mb ); +static void vdec_MotionFrameDMV420 ( macroblock_t * p_mb ); +static void vdec_MotionFrameDMV422 ( macroblock_t * p_mb ); +static void vdec_MotionFrameDMV444 ( macroblock_t * p_mb ); + +/***************************************************************************** + * Functions exported as capabilities. They are declared as static so that + * we don't pollute the namespace too much. + *****************************************************************************/ +void motion_getfunctions( function_list_t * p_function_list ) +{ + p_function_list->pf_probe = motion_Probe; + +#define list p_function_list->functions.motion +#define motion_functions( yuv ) \ + list.pf_field_field_##yuv = vdec_MotionFieldField##yuv; \ + list.pf_field_16x8_##yuv = vdec_MotionField16x8##yuv; \ + list.pf_field_dmv_##yuv = vdec_MotionFieldDMV##yuv; \ + list.pf_frame_field_##yuv = vdec_MotionFrameField##yuv; \ + list.pf_frame_frame_##yuv = vdec_MotionFrameFrame##yuv; \ + list.pf_frame_dmv_##yuv = vdec_MotionFrameDMV##yuv; + motion_functions( 420 ) + motion_functions( 422 ) + motion_functions( 444 ) +#undef motion_functions +#undef list + + return; +} #define __MotionComponents(width,height) \ void MotionComponent_x_y_copy_##width##_##height (); \ @@ -62,10 +97,10 @@ void MotionComponent_X_y_avg_##width##_##height (); \ void MotionComponent_x_Y_avg_##width##_##height (); \ void MotionComponent_X_Y_avg_##width##_##height (); -__MotionComponents (16,16) /* 444, 422, 420 */ +__MotionComponents (16,16) /* 444, 422, 420 */ __MotionComponents (16,8) /* 444, 422, 420 */ -__MotionComponents (8,8) /* 422, 420 */ -__MotionComponents (8,4) /* 420 */ +__MotionComponents (8,8) /* 422, 420 */ +__MotionComponents (8,4) /* 420 */ #if 0 __MotionComponents (8,16) /* 422 */ #endif @@ -407,17 +442,17 @@ static __inline__ void Motion444( } \ } -void vdec_MotionFieldField420( macroblock_t * p_mb ) +static void vdec_MotionFieldField420( macroblock_t * p_mb ) { FIELDFIELD( Motion420 ) } -void vdec_MotionFieldField422( macroblock_t * p_mb ) +static void vdec_MotionFieldField422( macroblock_t * p_mb ) { //FIELDFIELD( Motion422 ) } -void vdec_MotionFieldField444( macroblock_t * p_mb ) +static void vdec_MotionFieldField444( macroblock_t * p_mb ) { //FIELDFIELD( Motion444 ) } @@ -489,17 +524,17 @@ void vdec_MotionFieldField444( macroblock_t * p_mb ) } \ } -void vdec_MotionField16x8420( macroblock_t * p_mb ) +static void vdec_MotionField16x8420( macroblock_t * p_mb ) { FIELD16X8( Motion420 ) } -void vdec_MotionField16x8422( macroblock_t * p_mb ) +static void vdec_MotionField16x8422( macroblock_t * p_mb ) { //FIELD16X8( Motion422 ) } -void vdec_MotionField16x8444( macroblock_t * p_mb ) +static void vdec_MotionField16x8444( macroblock_t * p_mb ) { //FIELD16X8( Motion444 ) } @@ -531,17 +566,17 @@ void vdec_MotionField16x8444( macroblock_t * p_mb ) p_mb->i_l_stride, p_mb->i_c_stride, 16, 0, 1 ); \ } /* FIELDDMV */ -void vdec_MotionFieldDMV420( macroblock_t * p_mb ) +static void vdec_MotionFieldDMV420( macroblock_t * p_mb ) { FIELDDMV( Motion420 ) } -void vdec_MotionFieldDMV422( macroblock_t * p_mb ) +static void vdec_MotionFieldDMV422( macroblock_t * p_mb ) { //FIELDDMV( Motion422 ) } -void vdec_MotionFieldDMV444( macroblock_t * p_mb ) +static void vdec_MotionFieldDMV444( macroblock_t * p_mb ) { //FIELDDMV( Motion444 ) } @@ -576,17 +611,17 @@ void vdec_MotionFieldDMV444( macroblock_t * p_mb ) } \ } /* FRAMEFRAME */ -void vdec_MotionFrameFrame420( macroblock_t * p_mb ) +static void vdec_MotionFrameFrame420( macroblock_t * p_mb ) { FRAMEFRAME( Motion420 ) } -void vdec_MotionFrameFrame422( macroblock_t * p_mb ) +static void vdec_MotionFrameFrame422( macroblock_t * p_mb ) { //FRAMEFRAME( Motion422 ) } -void vdec_MotionFrameFrame444( macroblock_t * p_mb ) +static void vdec_MotionFrameFrame444( macroblock_t * p_mb ) { //FRAMEFRAME( Motion444 ) } @@ -641,17 +676,17 @@ void vdec_MotionFrameFrame444( macroblock_t * p_mb ) } \ } /* FRAMEFIELD */ -void vdec_MotionFrameField420( macroblock_t * p_mb ) +static void vdec_MotionFrameField420( macroblock_t * p_mb ) { FRAMEFIELD( Motion420 ) } -void vdec_MotionFrameField422( macroblock_t * p_mb ) +static void vdec_MotionFrameField422( macroblock_t * p_mb ) { //FRAMEFIELD( Motion422 ) } -void vdec_MotionFrameField444( macroblock_t * p_mb ) +static void vdec_MotionFrameField444( macroblock_t * p_mb ) { //FRAMEFIELD( Motion444 ) } @@ -689,17 +724,18 @@ void vdec_MotionFrameField444( macroblock_t * p_mb ) p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 1 ); \ } /* FRAMEDMV */ -void vdec_MotionFrameDMV420( macroblock_t * p_mb ) +static void vdec_MotionFrameDMV420( macroblock_t * p_mb ) { FRAMEDMV( Motion420 ) } -void vdec_MotionFrameDMV422( macroblock_t * p_mb ) +static void vdec_MotionFrameDMV422( macroblock_t * p_mb ) { //FRAMEDMV( Motion422 ) } -void vdec_MotionFrameDMV444( macroblock_t * p_mb ) +static void vdec_MotionFrameDMV444( macroblock_t * p_mb ) { //FRAMEDMV( Motion444 ) } + diff --git a/src/video_decoder/vdec_motion_inner.c b/plugins/motion/vdec_motion_inner.c similarity index 97% rename from src/video_decoder/vdec_motion_inner.c rename to plugins/motion/vdec_motion_inner.c index 34105c7ce0..33021eb0a7 100644 --- a/src/video_decoder/vdec_motion_inner.c +++ b/plugins/motion/vdec_motion_inner.c @@ -2,7 +2,7 @@ * vdec_motion_inner.c : motion compensation inner routines ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vdec_motion_inner.c,v 1.12 2001/01/05 18:46:44 massiot Exp $ + * $Id: vdec_motion_inner.c,v 1.1 2001/01/18 05:13:22 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -32,25 +32,8 @@ #include "common.h" #include "threads.h" #include "mtime.h" -#include "plugins.h" - -#include "intf_msg.h" - -#include "stream_control.h" -#include "input_ext-dec.h" #include "video.h" -#include "video_output.h" - -#include "vdec_idct.h" -#include "video_decoder.h" -#include "vdec_motion.h" - -#include "vpar_blocks.h" -#include "vpar_headers.h" -#include "vpar_synchro.h" -#include "video_parser.h" -#include "video_fifo.h" #define __MotionComponent_x_y_copy(width,height) \ void MotionComponent_x_y_copy_##width##_##height(yuv_data_t * p_src, \ diff --git a/src/video_decoder/vdec_motion_inner_mmx.c b/plugins/motion/vdec_motion_inner_mmx.c similarity index 98% rename from src/video_decoder/vdec_motion_inner_mmx.c rename to plugins/motion/vdec_motion_inner_mmx.c index 4d2f735ed5..a6bb13b9ec 100644 --- a/src/video_decoder/vdec_motion_inner_mmx.c +++ b/plugins/motion/vdec_motion_inner_mmx.c @@ -3,7 +3,7 @@ * MMX ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vdec_motion_inner_mmx.c,v 1.8 2001/01/16 17:59:23 massiot Exp $ + * $Id: vdec_motion_inner_mmx.c,v 1.1 2001/01/18 05:13:22 sam Exp $ * * Authors: Christophe Massiot , largerly inspired by the * work done by the livid project @@ -32,25 +32,8 @@ #include "common.h" #include "threads.h" #include "mtime.h" -#include "plugins.h" - -#include "intf_msg.h" - -#include "stream_control.h" -#include "input_ext-dec.h" #include "video.h" -#include "video_output.h" - -#include "vdec_idct.h" -#include "video_decoder.h" -#include "vdec_motion.h" - -#include "vpar_blocks.h" -#include "vpar_headers.h" -#include "vpar_synchro.h" -#include "video_parser.h" -#include "video_fifo.h" #include "attributes.h" #include "mmx.h" diff --git a/src/video_decoder/vdec_motion_inner_mmxext.c b/plugins/motion/vdec_motion_inner_mmxext.c similarity index 98% rename from src/video_decoder/vdec_motion_inner_mmxext.c rename to plugins/motion/vdec_motion_inner_mmxext.c index d54e39e9cc..6165f3f469 100644 --- a/src/video_decoder/vdec_motion_inner_mmxext.c +++ b/plugins/motion/vdec_motion_inner_mmxext.c @@ -1,9 +1,9 @@ /***************************************************************************** - * vdec_motion_inner_mmx.c : motion compensation inner routines optimized in - * MMX + * vdec_motion_inner_mmxext.c : motion compensation inner routines optimized + * in MMX EXT ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vdec_motion_inner_mmxext.c,v 1.1 2001/01/16 17:59:23 massiot Exp $ + * $Id: vdec_motion_inner_mmxext.c,v 1.1 2001/01/18 05:13:22 sam Exp $ * * Authors: Christophe Massiot , largerly inspired by the * work done by the livid project @@ -32,25 +32,8 @@ #include "common.h" #include "threads.h" #include "mtime.h" -#include "plugins.h" - -#include "intf_msg.h" - -#include "stream_control.h" -#include "input_ext-dec.h" #include "video.h" -#include "video_output.h" - -#include "vdec_idct.h" -#include "video_decoder.h" -#include "vdec_motion.h" - -#include "vpar_blocks.h" -#include "vpar_headers.h" -#include "vpar_synchro.h" -#include "video_parser.h" -#include "video_fifo.h" #include "attributes.h" #include "mmx.h" diff --git a/plugins/yuv/video_yuv.c b/plugins/yuv/video_yuv.c index 64e2f3718e..37e7d12072 100644 --- a/plugins/yuv/video_yuv.c +++ b/plugins/yuv/video_yuv.c @@ -82,7 +82,7 @@ static int yuv_Probe( probedata_t *p_data ) } /* This module always works */ - return( 100 ); + return( 50 ); } /***************************************************************************** diff --git a/plugins/yuv/yuv.c b/plugins/yuv/yuv.c index a90d23e70f..772665ea44 100644 --- a/plugins/yuv/yuv.c +++ b/plugins/yuv/yuv.c @@ -64,7 +64,7 @@ MODULE_CONFIG_END int InitModule( module_t * p_module ) { p_module->psz_name = MODULE_STRING; - p_module->psz_longname = "C YUV module"; + p_module->psz_longname = "YUV transformations module"; p_module->psz_version = VERSION; p_module->i_capabilities = MODULE_CAPABILITY_NULL diff --git a/plugins/yuv/yuvmmx.c b/plugins/yuv/yuvmmx.c index 6a8bc3daa3..b042e1987f 100644 --- a/plugins/yuv/yuvmmx.c +++ b/plugins/yuv/yuvmmx.c @@ -64,7 +64,7 @@ MODULE_CONFIG_END int InitModule( module_t * p_module ) { p_module->psz_name = MODULE_STRING; - p_module->psz_longname = "MMX YUV module"; + p_module->psz_longname = "MMX YUV transformations module"; p_module->psz_version = VERSION; p_module->i_capabilities = MODULE_CAPABILITY_NULL diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 50f8c6bbf8..ddff455292 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -2,7 +2,7 @@ * input_programs.c: es_descriptor_t, pgrm_descriptor_t management ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_programs.c,v 1.25 2001/01/12 17:33:18 massiot Exp $ + * $Id: input_programs.c,v 1.26 2001/01/18 05:13:22 sam Exp $ * * Authors: * @@ -579,6 +579,11 @@ int input_SelectES( input_thread_t * p_input, es_descriptor_t * p_es ) break; } + if( p_es->thread_id == 0 ) + { + return( -1 ); + } + if( p_es->p_decoder_fifo != NULL ) { p_input->stream.i_selected_es_number++; diff --git a/src/interface/main.c b/src/interface/main.c index 1e4df4711d..7449f1561d 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -79,8 +79,9 @@ #define OPT_WIDTH 163 #define OPT_HEIGHT 164 #define OPT_COLOR 165 -#define OPT_IDCT 166 -#define OPT_YUV 167 +#define OPT_MOTION 167 +#define OPT_IDCT 168 +#define OPT_YUV 169 #define OPT_VLANS 170 #define OPT_SERVER 171 @@ -122,6 +123,7 @@ static const struct option longopts[] = { "height", 1, 0, OPT_HEIGHT }, { "grayscale", 0, 0, 'g' }, { "color", 0, 0, OPT_COLOR }, + { "motion", 1, 0, OPT_MOTION }, { "idct", 1, 0, OPT_IDCT }, { "yuv", 1, 0, OPT_YUV }, @@ -569,6 +571,9 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) case OPT_COLOR: /* --color */ main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 ); break; + case OPT_MOTION: /* --motion */ + main_PutPszVariable( MOTION_METHOD_VAR, optarg ); + break; case OPT_IDCT: /* --idct */ main_PutPszVariable( IDCT_METHOD_VAR, optarg ); break; @@ -670,6 +675,7 @@ static void Usage( int i_fashion ) "\n --width , --height \tdisplay dimensions" "\n -g, --grayscale \tgrayscale output" "\n --color \tcolor output" + "\n --motion \tmotion compensation method" "\n --idct \tIDCT method" "\n --yuv \tYUV method" "\n --synchro \tforce synchro algorithm" @@ -714,6 +720,7 @@ static void Usage( int i_fashion ) "\n " VOUT_HEIGHT_VAR "= \tdislay height" "\n " VOUT_FB_DEV_VAR "= \tframebuffer device path" "\n " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output" + "\n " MOTION_METHOD_VAR "= \tmotion compensation method" "\n " IDCT_METHOD_VAR "= \tIDCT method" "\n " YUV_METHOD_VAR "= \tYUV method" "\n " VPAR_SYNCHRO_VAR "={I|I+|IP|IP+|IPB} \tsynchro algorithm" ); diff --git a/src/misc/modules.c b/src/misc/modules.c index 2bf9b94fcf..0b15ff8414 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -451,8 +451,9 @@ static int AllocateDynModule( module_bank_t * p_bank, char * psz_filename ) p_module->prev = NULL; p_bank->first = p_module; - intf_Msg( "module: dynamic module `%s', %s", - p_module->psz_name, p_module->psz_longname ); + /* Immediate message so that a slow module doesn't make the user wait */ + intf_MsgImm( "module: dynamic module `%s', %s", + p_module->psz_name, p_module->psz_longname ); return( 0 ); } diff --git a/src/video_decoder/video_decoder.c b/src/video_decoder/video_decoder.c index 2813d2aaeb..e14c23f2c6 100644 --- a/src/video_decoder/video_decoder.c +++ b/src/video_decoder/video_decoder.c @@ -2,7 +2,7 @@ * video_decoder.c : video decoder thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_decoder.c,v 1.44 2001/01/05 18:46:44 massiot Exp $ + * $Id: video_decoder.c,v 1.45 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * Gaël Hendryckx @@ -45,9 +45,9 @@ #include "video.h" #include "video_output.h" +#include "vdec_motion.h" #include "vdec_idct.h" #include "video_decoder.h" -#include "vdec_motion.h" #include "vpar_blocks.h" #include "vpar_headers.h" diff --git a/src/video_decoder/video_parser.h b/src/video_decoder/video_parser.h index 4dd14b261e..5650f64429 100644 --- a/src/video_decoder/video_parser.h +++ b/src/video_decoder/video_parser.h @@ -2,7 +2,7 @@ * video_parser.h : video parser thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_parser.h,v 1.5 2001/01/17 18:17:30 massiot Exp $ + * $Id: video_parser.h,v 1.6 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * @@ -133,8 +133,13 @@ typedef struct vpar_thread_s u8 pi_default_intra_quant[64]; u8 pi_default_nonintra_quant[64]; + /* Motion compensation plugin used and shortcuts */ + struct module_s * p_motion_module; + void ( * pppf_motion[4][2][4] ) ( struct macroblock_s * ); + void ( * ppf_motion_skipped[4][4] ) ( struct macroblock_s * ); + /* IDCT plugin used and shortcuts to access its capabilities */ - struct module_s * p_module; + struct module_s * p_idct_module; idct_init_t pf_init; f_idct_t pf_sparse_idct; f_idct_t pf_idct; diff --git a/src/video_parser/video_fifo.c b/src/video_parser/video_fifo.c index 0b5fc72a0b..c42aa1647b 100644 --- a/src/video_parser/video_fifo.c +++ b/src/video_parser/video_fifo.c @@ -2,7 +2,7 @@ * video_fifo.c : video FIFO management ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_fifo.c,v 1.27 2001/01/13 12:57:21 sam Exp $ + * $Id: video_fifo.c,v 1.28 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * @@ -41,10 +41,10 @@ #include "video_output.h" #include "video_decoder.h" +#include "vdec_motion.h" #include "../video_decoder/vdec_idct.h" -#include "../video_decoder/vdec_motion.h" -#include "../video_decoder/vpar_blocks.h" +#include "vpar_blocks.h" #include "../video_decoder/vpar_headers.h" #include "../video_decoder/vpar_synchro.h" #include "../video_decoder/video_parser.h" diff --git a/src/video_parser/video_parser.c b/src/video_parser/video_parser.c index 7add0ba9fa..ccc0c28685 100644 --- a/src/video_parser/video_parser.c +++ b/src/video_parser/video_parser.c @@ -2,7 +2,7 @@ * video_parser.c : video parser thread ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: video_parser.c,v 1.68 2001/01/17 18:17:31 massiot Exp $ + * $Id: video_parser.c,v 1.69 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -52,10 +52,10 @@ #include "video_output.h" #include "video_decoder.h" -#include "../video_decoder/vdec_motion.h" +#include "vdec_motion.h" #include "../video_decoder/vdec_idct.h" -#include "../video_decoder/vpar_blocks.h" +#include "vpar_blocks.h" #include "../video_decoder/vpar_headers.h" #include "../video_decoder/vpar_synchro.h" #include "../video_decoder/video_parser.h" @@ -101,30 +101,100 @@ vlc_thread_t vpar_CreateThread( vdec_config_t * p_config ) p_vpar->p_vout = p_config->p_vout; - /* Choose the best IDCT module */ - p_vpar->p_module = module_Need( p_main->p_module_bank, - MODULE_CAPABILITY_IDCT, NULL ); + /* + * Choose the best motion compensation module + */ + p_vpar->p_motion_module = module_Need( p_main->p_module_bank, + MODULE_CAPABILITY_MOTION, NULL ); + + if( p_vpar->p_motion_module == NULL ) + { + intf_ErrMsg( "vpar error: no suitable motion compensation module" ); + free( p_vpar ); + return( 0 ); + } - if( p_vpar->p_module == NULL ) +#define m ( p_vpar->pppf_motion ) +#define s ( p_vpar->ppf_motion_skipped ) +#define f ( p_vpar->p_motion_module->p_functions->motion.functions.motion ) + m[0][0][0] = m[0][0][1] = m[0][0][2] = m[0][0][3] = NULL; + m[0][1][0] = m[0][1][1] = m[0][1][2] = m[0][1][3] = NULL; + m[1][0][0] = NULL; + m[1][1][0] = NULL; + m[2][0][0] = NULL; + m[2][1][0] = NULL; + m[3][0][0] = NULL; + m[3][1][0] = NULL; + + m[1][0][1] = f.pf_field_field_420; + m[1][1][1] = f.pf_frame_field_420; + m[2][0][1] = f.pf_field_field_422; + m[2][1][1] = f.pf_frame_field_422; + m[3][0][1] = f.pf_field_field_444; + m[3][1][1] = f.pf_frame_field_444; + + m[1][0][2] = f.pf_field_16x8_420; + m[1][1][2] = f.pf_frame_frame_420; + m[2][0][2] = f.pf_field_16x8_422; + m[2][1][2] = f.pf_frame_frame_422; + m[3][0][2] = f.pf_field_16x8_444; + m[3][1][2] = f.pf_frame_frame_444; + + m[1][0][3] = f.pf_field_dmv_420; + m[1][1][3] = f.pf_frame_dmv_420; + m[2][0][3] = f.pf_field_dmv_422; + m[2][1][3] = f.pf_frame_dmv_422; + m[3][0][3] = f.pf_field_dmv_444; + m[3][1][3] = f.pf_frame_dmv_444; + + s[0][0] = s[0][1] = s[0][2] = s[0][3] = NULL; + s[1][0] = NULL; + s[2][0] = NULL; + s[3][0] = NULL; + + s[1][1] = f.pf_field_field_420; + s[2][1] = f.pf_field_field_422; + s[3][1] = f.pf_field_field_444; + + s[1][2] = f.pf_field_field_420; + s[2][2] = f.pf_field_field_422; + s[3][2] = f.pf_field_field_444; + + s[1][3] = f.pf_frame_frame_420; + s[2][3] = f.pf_frame_frame_422; + s[3][3] = f.pf_frame_frame_444; +#undef f +#undef s +#undef m + + /* + * Choose the best IDCT module + */ + p_vpar->p_idct_module = module_Need( p_main->p_module_bank, + MODULE_CAPABILITY_IDCT, NULL ); + + if( p_vpar->p_idct_module == NULL ) { intf_ErrMsg( "vpar error: no suitable IDCT module" ); + module_Unneed( p_main->p_module_bank, p_vpar->p_motion_module ); free( p_vpar ); return( 0 ); } -#define idct_functions p_vpar->p_module->p_functions->idct.functions.idct - p_vpar->pf_init = idct_functions.pf_init; - p_vpar->pf_sparse_idct = idct_functions.pf_sparse_idct; - p_vpar->pf_idct = idct_functions.pf_idct; - p_vpar->pf_norm_scan = idct_functions.pf_norm_scan; -#undef idct_functions +#define f p_vpar->p_idct_module->p_functions->idct.functions.idct + p_vpar->pf_init = f.pf_init; + p_vpar->pf_sparse_idct = f.pf_sparse_idct; + p_vpar->pf_idct = f.pf_idct; + p_vpar->pf_norm_scan = f.pf_norm_scan; +#undef f /* Spawn the video parser thread */ if ( vlc_thread_create( &p_vpar->thread_id, "video parser", (vlc_thread_func_t)RunThread, (void *)p_vpar ) ) { intf_ErrMsg("vpar error: can't spawn video parser thread"); - module_Unneed( p_main->p_module_bank, p_vpar->p_module ); + module_Unneed( p_main->p_module_bank, p_vpar->p_idct_module ); + module_Unneed( p_main->p_module_bank, p_vpar->p_motion_module ); free( p_vpar ); return( 0 ); } @@ -434,7 +504,8 @@ static void EndThread( vpar_thread_t *p_vpar ) vlc_mutex_destroy( &(p_vpar->synchro.fifo_lock) ); - module_Unneed( p_main->p_module_bank, p_vpar->p_module ); + module_Unneed( p_main->p_module_bank, p_vpar->p_idct_module ); + module_Unneed( p_main->p_module_bank, p_vpar->p_motion_module ); free( p_vpar ); diff --git a/src/video_parser/vpar_blocks.c b/src/video_parser/vpar_blocks.c index 132f9a5007..12d0bbf956 100644 --- a/src/video_parser/vpar_blocks.c +++ b/src/video_parser/vpar_blocks.c @@ -2,7 +2,7 @@ * vpar_blocks.c : blocks parsing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_blocks.c,v 1.71 2001/01/17 18:17:31 massiot Exp $ + * $Id: vpar_blocks.c,v 1.72 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * Jean-Marc Dressler @@ -45,10 +45,10 @@ #include "video_output.h" #include "video_decoder.h" +#include "vdec_motion.h" #include "../video_decoder/vdec_idct.h" -#include "../video_decoder/vdec_motion.h" -#include "../video_decoder/vpar_blocks.h" +#include "vpar_blocks.h" #include "../video_decoder/vpar_headers.h" #include "../video_decoder/vpar_synchro.h" #include "../video_decoder/video_parser.h" @@ -1585,17 +1585,6 @@ static __inline__ void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb, { macroblock_t * p_mb; - static f_motion_t pf_motion_skipped[4][4] = - { - {NULL, NULL, NULL, NULL}, - {NULL, vdec_MotionFieldField420, vdec_MotionFieldField420, - vdec_MotionFrameFrame420}, - {NULL, vdec_MotionFieldField422, vdec_MotionFieldField422, - vdec_MotionFrameFrame422}, - {NULL, vdec_MotionFieldField444, vdec_MotionFieldField444, - vdec_MotionFrameFrame444}, - }; - if( i_coding_type == I_CODING_TYPE ) { intf_DbgMsg("vpar error: skipped macroblock in I-picture"); @@ -1616,8 +1605,8 @@ static __inline__ void SkippedMacroblock( vpar_thread_t * p_vpar, int i_mb, i_structure, b_second_field ); /* Motion type is picture structure. */ - p_mb->pf_motion = pf_motion_skipped[i_chroma_format] - [i_structure]; + p_mb->pf_motion = p_vpar->ppf_motion_skipped[i_chroma_format] + [i_structure]; p_mb->i_coded_block_pattern = 0; /* Motion direction and motion vectors depend on the coding type. */ @@ -1820,27 +1809,6 @@ static __inline__ void ParseMacroblock( boolean_t b_second_field ) /* second field of a * field picture */ { - static f_motion_t pppf_motion[4][2][4] = - { - { {NULL, NULL, NULL, NULL}, - {NULL, NULL, NULL, NULL} - }, - { {NULL, vdec_MotionFieldField420, vdec_MotionField16x8420, - vdec_MotionFieldDMV420}, - {NULL, vdec_MotionFrameField420, vdec_MotionFrameFrame420, - vdec_MotionFrameDMV420} - }, - { {NULL, vdec_MotionFieldField422, vdec_MotionField16x8422, - vdec_MotionFieldDMV422}, - {NULL, vdec_MotionFrameField422, vdec_MotionFrameFrame422, - vdec_MotionFrameDMV422} - }, - { {NULL, vdec_MotionFieldField444, vdec_MotionField16x8444, - vdec_MotionFieldDMV444}, - {NULL, vdec_MotionFrameField444, vdec_MotionFrameFrame444, - vdec_MotionFrameDMV444} - } - }; static int pi_x[12] = {0,8,0,8,0,0,0,0,8,8,8,8}; static int pi_y[2][12] = { {0,0,8,8,0,0,8,8,0,0,8,8}, {0,0,1,1,0,0,1,1,0,0,1,1} }; @@ -1943,9 +1911,9 @@ static __inline__ void ParseMacroblock( = 1 << (7 + p_vpar->picture.i_intra_dc_precision); /* Motion function pointer. */ - p_mb->pf_motion = pppf_motion[i_chroma_format] - [i_structure == FRAME_STRUCTURE] - [p_vpar->mb.i_motion_type]; + p_mb->pf_motion = p_vpar->pppf_motion[i_chroma_format] + [i_structure == FRAME_STRUCTURE] + [p_vpar->mb.i_motion_type]; if( p_mb->i_mb_type & MB_PATTERN ) { diff --git a/src/video_parser/vpar_headers.c b/src/video_parser/vpar_headers.c index 47e03ed58e..c2589f5f96 100644 --- a/src/video_parser/vpar_headers.c +++ b/src/video_parser/vpar_headers.c @@ -2,7 +2,7 @@ * vpar_headers.c : headers parsing ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_headers.c,v 1.73 2001/01/17 18:17:31 massiot Exp $ + * $Id: vpar_headers.c,v 1.74 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * Stéphane Borel @@ -44,10 +44,10 @@ #include "video_output.h" #include "video_decoder.h" +#include "vdec_motion.h" #include "../video_decoder/vdec_idct.h" -#include "../video_decoder/vdec_motion.h" -#include "../video_decoder/vpar_blocks.h" +#include "vpar_blocks.h" #include "../video_decoder/vpar_headers.h" #include "../video_decoder/vpar_synchro.h" #include "../video_decoder/video_parser.h" diff --git a/src/video_parser/vpar_synchro.c b/src/video_parser/vpar_synchro.c index 0e9cd3cf8a..d96433e64d 100644 --- a/src/video_parser/vpar_synchro.c +++ b/src/video_parser/vpar_synchro.c @@ -2,7 +2,7 @@ * vpar_synchro.c : frame dropping routines ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: vpar_synchro.c,v 1.77 2001/01/16 18:06:01 massiot Exp $ + * $Id: vpar_synchro.c,v 1.78 2001/01/18 05:13:23 sam Exp $ * * Authors: Christophe Massiot * Samuel Hocevar @@ -113,10 +113,10 @@ #include "video_output.h" #include "video_decoder.h" +#include "vdec_motion.h" #include "../video_decoder/vdec_idct.h" -#include "../video_decoder/vdec_motion.h" -#include "../video_decoder/vpar_blocks.h" +#include "vpar_blocks.h" #include "../video_decoder/vpar_headers.h" #include "../video_decoder/vpar_synchro.h" #include "../video_decoder/video_parser.h" -- 2.39.2