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 );
}
else
{
return( 200 );
}
}
else
{
return( 0 );
}
}
/*****************************************************************************
* 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 <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -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 )
}
......@@ -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 <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -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, \
......
......@@ -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 <massiot@via.ecp.fr>, largerly inspired by the
* work done by the livid project <http://www.linuxvideo.org/>
......@@ -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"
......
/*****************************************************************************
* 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 <massiot@via.ecp.fr>, largerly inspired by the
* work done by the livid project <http://www.linuxvideo.org/>
......@@ -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"
......
......@@ -82,7 +82,7 @@ static int yuv_Probe( probedata_t *p_data )
}
/* This module always works */
return( 100 );
return( 50 );
}
/*****************************************************************************
......
......@@ -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
......
......@@ -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
......
......@@ -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++;
......
......@@ -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 <w>, --height <h> \tdisplay dimensions"
"\n -g, --grayscale \tgrayscale output"
"\n --color \tcolor output"
"\n --motion <module> \tmotion compensation method"
"\n --idct <module> \tIDCT method"
"\n --yuv <module> \tYUV method"
"\n --synchro <type> \tforce synchro algorithm"
......@@ -714,6 +720,7 @@ static void Usage( int i_fashion )
"\n " VOUT_HEIGHT_VAR "=<height> \tdislay height"
"\n " VOUT_FB_DEV_VAR "=<filename> \tframebuffer device path"
"\n " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output"
"\n " MOTION_METHOD_VAR "=<method name> \tmotion compensation method"
"\n " IDCT_METHOD_VAR "=<method name> \tIDCT method"
"\n " YUV_METHOD_VAR "=<method name> \tYUV method"
"\n " VPAR_SYNCHRO_VAR "={I|I+|IP|IP+|IPB} \tsynchro algorithm" );
......
......@@ -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 );
}
......
......@@ -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 <massiot@via.ecp.fr>
* Gal Hendryckx <jimmy@via.ecp.fr>
......@@ -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"
......
......@@ -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 <massiot@via.ecp.fr>
*
......@@ -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;
......
......@@ -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 <massiot@via.ecp.fr>
*
......@@ -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"
......
......@@ -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 <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -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 );
......
......@@ -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 <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
......@@ -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 )
{
......
......@@ -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 <massiot@via.ecp.fr>
* Stphane Borel <stef@via.ecp.fr>
......@@ -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"
......
......@@ -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 <massiot@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
......@@ -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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment