]> git.sesse.net Git - vlc/blobdiff - plugins/motion/vdec_motion_common.c
* Grmbl. Forgot to update the libdvdcss changelog.
[vlc] / plugins / motion / vdec_motion_common.c
index 894aa98bd361151c1249c0955de0f7ebab6c83ce..102323af1701e842f4147c75546f4e3c7d26d4ba 100644 (file)
@@ -2,7 +2,7 @@
  * vdec_motion_common.c : common motion compensation routines common
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: vdec_motion_common.c,v 1.2 2001/02/13 06:31:05 sam Exp $
+ * $Id: vdec_motion_common.c,v 1.9 2001/07/17 09:48:07 massiot 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 "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"
 
-extern int motion_Probe( probedata_t *p_data );
+#include "modules.h"
+#include "modules_export.h"
+
+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 );
@@ -66,9 +74,9 @@ 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 )
+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 ) \
@@ -88,14 +96,14 @@ void motion_getfunctions( function_list_t * p_function_list )
 }
 
 #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 */
@@ -113,20 +121,20 @@ __MotionComponents (8,16)        /* 422 */
             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;                                                       \
             }                                                                \
         }                                                                    \
@@ -135,20 +143,20 @@ __MotionComponents (8,16)        /* 422 */
             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;                                                       \
             }                                                                \
         }                                                                    \
@@ -202,19 +210,15 @@ static __inline__ void Motion420(
     /* Temporary variables to avoid recalculating things twice */
     int     i_source_offset, i_dest_offset, i_c_height, i_c_select;
 
-    if( p_source == NULL )
-    {
-        return;
-    }
-
     i_source_offset = (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) * i_l_stride;
-    if( i_source_offset >= p_source->i_width * p_source->i_height )
+
+    if( i_source_offset >= p_source->i_size )
     {
-        intf_ErrMsg( "vdec error: bad motion vector (lum)" );
+        intf_WarnMsg( 2, "Bad motion vector (lum)" );
         return;
     }
 
@@ -239,9 +243,10 @@ static __inline__ void Motion420(
                            + 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_ErrMsg( "vdec error: bad motion vector (chroma)" );
+        intf_WarnMsg( 2, "Bad motion vector (chroma)" );
         return;
     }