* vdec_motion_common.c : common motion compensation routines common
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
- * $Id: vdec_motion_common.c,v 1.4 2001/02/19 19:08:59 massiot Exp $
+ * $Id: vdec_motion_common.c,v 1.11 2001/12/09 17:01:36 sam Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Jean-Marc Dressler <polux@via.ecp.fr>
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
+/* MODULE_NAME defined in Makefile together with -DBUILTIN */
+#ifdef BUILTIN
+# include "modules_inner.h"
+#else
+# define _M( foo ) foo
+#endif
+
/*****************************************************************************
* Preamble
*****************************************************************************/
#include "defs.h"
-#include "config.h"
#include "common.h"
#include "threads.h"
#include "mtime.h"
-#include "modules.h"
#include "intf_msg.h"
#include "video.h"
-#include "vdec_motion.h"
-#include "vpar_blocks.h"
+#include "vdec_ext-plugins.h"
+
+#include "modules.h"
+#include "modules_export.h"
-extern int motion_Probe( probedata_t *p_data );
+extern int _M( motion_Probe )( probedata_t *p_data );
static void vdec_MotionFieldField420 ( macroblock_t * p_mb );
static void vdec_MotionFieldField422 ( 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 )
+void _M( motion_getfunctions )( function_list_t * p_function_list )
{
- p_function_list->pf_probe = motion_Probe;
+ p_function_list->pf_probe = _M( motion_Probe );
#define list p_function_list->functions.motion
#define motion_functions( yuv ) \
}
#define __MotionComponents(width,height) \
-void MotionComponent_x_y_copy_##width##_##height (); \
-void MotionComponent_X_y_copy_##width##_##height (); \
-void MotionComponent_x_Y_copy_##width##_##height (); \
-void MotionComponent_X_Y_copy_##width##_##height (); \
-void MotionComponent_x_y_avg_##width##_##height (); \
-void MotionComponent_X_y_avg_##width##_##height (); \
-void MotionComponent_x_Y_avg_##width##_##height (); \
-void MotionComponent_X_Y_avg_##width##_##height ();
+void _M( MotionComponent_x_y_copy_##width##_##height )(); \
+void _M( MotionComponent_X_y_copy_##width##_##height )(); \
+void _M( MotionComponent_x_Y_copy_##width##_##height )(); \
+void _M( MotionComponent_X_Y_copy_##width##_##height )(); \
+void _M( MotionComponent_x_y_avg_##width##_##height )(); \
+void _M( MotionComponent_X_y_avg_##width##_##height )(); \
+void _M( MotionComponent_x_Y_avg_##width##_##height )(); \
+void _M( MotionComponent_X_Y_avg_##width##_##height )();
__MotionComponents (16,16) /* 444, 422, 420 */
__MotionComponents (16,8) /* 444, 422, 420 */
switch (i_select) \
{ \
case 0: \
- MotionComponent_x_y_copy_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_x_y_copy_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
case 1: \
- MotionComponent_X_y_copy_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_X_y_copy_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
case 2: \
- MotionComponent_x_Y_copy_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_x_Y_copy_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
case 3: \
- MotionComponent_X_Y_copy_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_X_Y_copy_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
} \
} \
switch (i_select) \
{ \
case 0: \
- MotionComponent_x_y_avg_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_x_y_avg_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
case 1: \
- MotionComponent_X_y_avg_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_X_y_avg_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
case 2: \
- MotionComponent_x_Y_avg_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_x_Y_avg_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
case 3: \
- MotionComponent_X_Y_avg_##width##_##height (p_src, p_dest, \
- i_stride); \
+ _M( MotionComponent_X_Y_avg_##width##_##height )(p_src, \
+ p_dest, i_stride); \
break; \
} \
} \
* vdec_MotionComponent : last stage of motion compensation
*****************************************************************************/
static __inline__ void MotionComponent(
- yuv_data_t * p_src, /* source block */
- yuv_data_t * p_dest, /* dest block */
+ pixel_data_t * p_src, /* source block */
+ pixel_data_t * p_dest, /* dest block */
int i_width, /* (explicit) width of block */
int i_height, /* (explicit) height of block */
int i_stride, /* number of coeffs to jump
+ b_source_field)
* p_mb->p_picture->i_width
+ (i_mv_y >> 1) * i_l_stride;
- if( i_source_offset >= p_source->i_width * p_source->i_height )
+
+ if( i_source_offset >= p_source->i_size )
{
intf_WarnMsg( 2, "Bad motion vector (lum)" );
return;
/* Luminance */
MotionComponent( /* source */
- p_source->p_y + i_source_offset,
+ p_source->planes[ Y_PLANE ].p_data
+ + i_source_offset,
/* destination */
- p_mb->p_picture->p_y
+ p_mb->p_picture->planes[ Y_PLANE ].p_data
+ (p_mb->i_l_x)
+ (p_mb->i_motion_l_y + b_dest_field + i_offset)
* p_mb->p_picture->i_width,
+ b_source_field)
* p_mb->p_picture->i_chroma_width
+ ((i_mv_y/2) >> 1) * i_c_stride;
- if( i_source_offset >= (p_source->i_width * p_source->i_height) / 4 )
+
+ if( i_source_offset >= p_source->i_chroma_size )
{
intf_WarnMsg( 2, "Bad motion vector (chroma)" );
return;
i_c_select = (((i_mv_y/2) & 1) << 1) | ((i_mv_x/2) & 1);
/* Chrominance Cr */
- MotionComponent( p_source->p_u
+ MotionComponent( p_source->planes[ U_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_u
+ p_mb->p_picture->planes[ U_PLANE ].p_data
+ i_dest_offset,
8, i_c_height, i_c_stride,
i_c_select, b_average );
/* Chrominance Cb */
- MotionComponent( p_source->p_v
+ MotionComponent( p_source->planes[ V_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_v
+ p_mb->p_picture->planes[ V_PLANE ].p_data
+ i_dest_offset,
8, i_c_height, i_c_stride,
i_c_select, b_average );
/* Luminance */
MotionComponent( /* source */
- p_source->p_y
+ p_source->planes[ Y_PLANE ].p_data
+ (p_mb->i_l_x + (i_mv_x >> 1))
+ (p_mb->i_motion_l_y + i_offset
+ b_source_field)
* p_mb->p_picture->i_width
+ (i_mv_y >> 1) * p_mb->i_l_stride,
/* destination */
- p_mb->p_picture->p_y
+ p_mb->p_picture->planes[ Y_PLANE ].p_data
+ (p_mb->i_l_x)
+ (p_mb->i_motion_l_y + b_dest_field)
* p_mb->p_picture->i_width,
i_c_select = ((i_mv_y & 1) << 1) | ((i_mv_x/2) & 1);
/* Chrominance Cr */
- MotionComponent( p_source->p_u
+ MotionComponent( p_source->planes[ U_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_u
+ p_mb->p_picture->planes[ U_PLANE ].p_data
+ i_dest_offset,
8, i_height, i_c_stride,
i_c_select, b_average );
/* Chrominance Cb */
- MotionComponent( p_source->p_v
+ MotionComponent( p_source->planes[ V_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_u
+ p_mb->p_picture->planes[ U_PLANE ].p_data
+ i_dest_offset,
8, i_height, i_c_stride,
i_c_select, b_average );
/* Luminance */
- MotionComponent( p_source->p_y
+ MotionComponent( p_source->planes[ Y_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_y
+ p_mb->p_picture->planes[ Y_PLANE ].p_data
+ i_dest_offset,
16, i_height, i_l_stride,
i_select, b_average );
/* Chrominance Cr */
- MotionComponent( p_source->p_u
+ MotionComponent( p_source->planes[ U_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_u
+ p_mb->p_picture->planes[ U_PLANE ].p_data
+ i_dest_offset,
16, i_height, i_l_stride,
i_select, b_average );
/* Chrominance Cb */
- MotionComponent( p_source->p_v
+ MotionComponent( p_source->planes[ V_PLANE ].p_data
+ i_source_offset,
- p_mb->p_picture->p_v
+ p_mb->p_picture->planes[ V_PLANE ].p_data
+ i_dest_offset,
16, i_height, i_l_stride,
i_select, b_average );