]> git.sesse.net Git - vlc/blobdiff - plugins/motion/motionmmxext.c
* ALL: new module API. Makes a few things a lot simpler, and we gain
[vlc] / plugins / motion / motionmmxext.c
index fde439825b9b7a3942ba48e39a9feb06bf0ffba1..5bc3115bd6f56c93805904e5fee0165ef80b6f39 100644 (file)
@@ -2,7 +2,7 @@
  * motionmmxext.c : MMX EXT motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motionmmxext.c,v 1.16 2002/02/15 13:32:53 sam Exp $
+ * $Id: motionmmxext.c,v 1.20 2002/07/31 20:56:52 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
 #include <stdlib.h>                                      /* malloc(), free() */
 #include <string.h>
 
-#include <videolan/vlc.h>
+#include <vlc/vlc.h>
 
 #include "mmx.h"
 
 /*****************************************************************************
- * Local and extern prototypes.
+ * Local prototype.
  *****************************************************************************/
-static void motion_getfunctions( function_list_t * p_function_list );
+static int Open ( vlc_object_t * );
 
 /*****************************************************************************
- * Build configuration tree.
+ * Module descriptor
  *****************************************************************************/
-MODULE_CONFIG_START
-MODULE_CONFIG_STOP
-
-MODULE_INIT_START
-    SET_DESCRIPTION( "MMXEXT motion compensation module" )
-    ADD_CAPABILITY( MOTION, 200 )
-    ADD_REQUIREMENT( MMXEXT )
-    ADD_SHORTCUT( "mmxext" )
-    ADD_SHORTCUT( "motionmmxext" )
-MODULE_INIT_STOP
-
-MODULE_ACTIVATE_START
-    motion_getfunctions( &p_module->p_functions->motion );
-MODULE_ACTIVATE_STOP
-
-MODULE_DEACTIVATE_START
-MODULE_DEACTIVATE_STOP
+vlc_module_begin();
+    set_description( _("MMX EXT motion compensation module") );
+    set_capability( "motion compensation", 200 );
+    add_requirement( MMXEXT );
+    add_shortcut( "mmxext" );
+    set_callbacks( Open, NULL );
+vlc_module_end();
 
 /*****************************************************************************
  * Motion compensation in MMXEXT (OK I know this does 3DNow too and it's ugly)
@@ -88,7 +78,7 @@ do {                                                                        \
 //CPU_MMXEXT code
 
 
-static __inline__ void MC_put1_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_put1_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
                               int stride)
 {
     do {
@@ -99,7 +89,7 @@ static __inline__ void MC_put1_8 (int height, yuv_data_t * dest, yuv_data_t * re
     } while (--height);
 }
 
-static __inline__ void MC_put1_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_put1_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
                                int stride)
 {
     do {
@@ -112,7 +102,7 @@ static __inline__ void MC_put1_16 (int height, yuv_data_t * dest, yuv_data_t * r
     } while (--height);
 }
 
-static __inline__ void MC_avg1_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_avg1_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
                               int stride, int cpu)
 {
     do {
@@ -124,7 +114,7 @@ static __inline__ void MC_avg1_8 (int height, yuv_data_t * dest, yuv_data_t * re
     } while (--height);
 }
 
-static __inline__ void MC_avg1_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_avg1_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
                                int stride, int cpu)
 {
     do {
@@ -139,7 +129,7 @@ static __inline__ void MC_avg1_16 (int height, yuv_data_t * dest, yuv_data_t * r
     } while (--height);
 }
 
-static __inline__ void MC_put2_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_put2_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
                               int stride, int offset, int cpu)
 {
     do {
@@ -151,7 +141,7 @@ static __inline__ void MC_put2_8 (int height, yuv_data_t * dest, yuv_data_t * re
     } while (--height);
 }
 
-static __inline__ void MC_put2_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_put2_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
                                int stride, int offset, int cpu)
 {
     do {
@@ -166,7 +156,7 @@ static __inline__ void MC_put2_16 (int height, yuv_data_t * dest, yuv_data_t * r
     } while (--height);
 }
 
-static __inline__ void MC_avg2_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_avg2_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
                               int stride, int offset, int cpu)
 {
     do {
@@ -179,7 +169,7 @@ static __inline__ void MC_avg2_8 (int height, yuv_data_t * dest, yuv_data_t * re
     } while (--height);
 }
 
-static __inline__ void MC_avg2_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_avg2_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
                                int stride, int offset, int cpu)
 {
     do {
@@ -198,7 +188,7 @@ static __inline__ void MC_avg2_16 (int height, yuv_data_t * dest, yuv_data_t * r
 
 static mmx_t mask_one = {0x0101010101010101LL};
 
-static __inline__ void MC_put4_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_put4_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
                               int stride, int cpu)
 {
     movq_m2r (*ref, mm0);
@@ -237,7 +227,7 @@ static __inline__ void MC_put4_8 (int height, yuv_data_t * dest, yuv_data_t * re
     } while (--height);
 }
 
-static __inline__ void MC_put4_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_put4_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
                                int stride, int cpu)
 {
     do {
@@ -283,7 +273,7 @@ static __inline__ void MC_put4_16 (int height, yuv_data_t * dest, yuv_data_t * r
     } while (--height);
 }
 
-static __inline__ void MC_avg4_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_avg4_8 (int height, yuv_data_t * dest, yuv_data_t * ref,
                               int stride, int cpu)
 {
     do {
@@ -312,7 +302,7 @@ static __inline__ void MC_avg4_8 (int height, yuv_data_t * dest, yuv_data_t * re
     } while (--height);
 }
 
-static __inline__ void MC_avg4_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
+static inline void MC_avg4_16 (int height, yuv_data_t * dest, yuv_data_t * ref,
                                int stride, int cpu)
 {
     do {
@@ -535,39 +525,27 @@ static void MC_put_y8_3dnow (yuv_data_t * dest, yuv_data_t * ref,
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
  *****************************************************************************/
-static void motion_getfunctions( function_list_t * p_function_list )
+static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *, int, int ) =
 {
-    static void (* ppppf_motion[2][2][4])( yuv_data_t *, yuv_data_t *,
-                                           int, int ) =
+    /* Copying functions */
     {
-        {
-            /* Copying functions */
-            {
-                /* Width == 16 */
-                MC_put_16_mmxext, MC_put_x16_mmxext, MC_put_y16_mmxext, MC_put_xy16_mmxext
-            },
-            {
-                /* Width == 8 */
-                MC_put_8_mmxext,  MC_put_x8_mmxext,  MC_put_y8_mmxext, MC_put_xy8_mmxext
-            }
-        },
-        {
-            /* Averaging functions */
-            {
-                /* Width == 16 */
-                MC_avg_16_mmxext, MC_avg_x16_mmxext, MC_avg_y16_mmxext, MC_avg_xy16_mmxext
-            },
-            {
-                /* Width == 8 */
-                MC_avg_8_mmxext,  MC_avg_x8_mmxext,  MC_avg_y8_mmxext,  MC_avg_xy8_mmxext
-            }
-        }
-    };
-
-#define list p_function_list->functions.motion
-    memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 );
-#undef list
-
-    return;
+        /* Width == 16 */
+        { MC_put_16_mmxext, MC_put_x16_mmxext, MC_put_y16_mmxext, MC_put_xy16_mmxext },
+        /* Width == 8 */
+        { MC_put_8_mmxext,  MC_put_x8_mmxext,  MC_put_y8_mmxext, MC_put_xy8_mmxext }
+    },
+    /* Averaging functions */
+    {
+        /* Width == 16 */  
+        { MC_avg_16_mmxext, MC_avg_x16_mmxext, MC_avg_y16_mmxext, MC_avg_xy16_mmxext },
+        /* Width == 8 */
+        { MC_avg_8_mmxext,  MC_avg_x8_mmxext,  MC_avg_y8_mmxext,  MC_avg_xy8_mmxext }
+    }
+};
+
+static int Open ( vlc_object_t *p_this )
+{
+    p_this->p_private = ppppf_motion;
+    return VLC_SUCCESS;
 }