Commit 647cca0e authored by Sam Hocevar's avatar Sam Hocevar

    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 ?
parent cf0b7cf9
......@@ -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
===============================
......
......@@ -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 $@ $^
......
......@@ -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.
......
......@@ -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 ])
......
......@@ -47,6 +47,9 @@ Disable video output.
.B \-\-vout <module>
Specify a video output module: "gnome", "fb", "glide", for instance.
.TP
.B \-\-motion <module>
Specify a module for motion compensation: "motion", "motionmmx", for instance.
.TP
.B \-\-idct <module>
Specify a module for IDCT: "idct", "idctmmx", for instance.
.TP
......
......@@ -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 <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -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
*****************************************************************************/
......
......@@ -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"
......
......@@ -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;
......
......@@ -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 <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -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 );
......@@ -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 <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -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 */
......
......@@ -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 <jimmy@via.ecp.fr>
*
......@@ -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
......
......@@ -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 <jimmy@via.ecp.fr>
*
......@@ -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
......
......@@ -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 <aholtzma@ess.engr.uvic.ca>
* Michel Lespinasse <walken@zoy.org>
......@@ -153,7 +153,7 @@ static int idct_Probe( probedata_t *p_data )
}
else
{
return( 100 );
return( 150 );
}
}
else
......
/*****************************************************************************
* 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 <stdlib.h> /* 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 );
}
/*****************************************************************************
* 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 <stdlib.h> /* 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 );
}
}
/*****************************************************************************
* 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 <stdlib.h> /* 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 );
}