]> git.sesse.net Git - vlc/blobdiff - plugins/motion/motionmmx.c
* ALL: new module API. Makes a few things a lot simpler, and we gain
[vlc] / plugins / motion / motionmmx.c
index 54410832c0708183f7312a805746d113cc010fbc..3d5e51c1ca4b41e276e8f73135ae452a20f809bb 100644 (file)
@@ -2,7 +2,7 @@
  * motionmmx.c : MMX motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motionmmx.c,v 1.19 2002/06/02 23:29:29 sam Exp $
+ * $Id: motionmmx.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 "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( _("MMX motion compensation module") )
-    ADD_CAPABILITY( MOTION, 150 )
-    ADD_REQUIREMENT( MMX )
-    ADD_SHORTCUT( "mmx" )
-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 motion compensation module") );
+    set_capability( "motion compensation", 150 );
+    add_requirement( MMX );
+    add_shortcut( "mmx" );
+    set_callbacks( Open, NULL );
+vlc_module_end();
 
 /*****************************************************************************
  * Motion compensation in MMX
@@ -643,39 +634,27 @@ static void MC_put_y8_mmx (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_mmx, MC_put_x16_mmx, MC_put_y16_mmx, MC_put_xy16_mmx
-            },
-            {
-                /* Width == 8 */
-                MC_put_8_mmx,  MC_put_x8_mmx,  MC_put_y8_mmx, MC_put_xy8_mmx
-            }
-        },
-        {
-            /* Averaging functions */
-            {
-                /* Width == 16 */
-                MC_avg_16_mmx, MC_avg_x16_mmx, MC_avg_y16_mmx, MC_avg_xy16_mmx
-            },
-            {
-                /* Width == 8 */
-                MC_avg_8_mmx,  MC_avg_x8_mmx,  MC_avg_y8_mmx,  MC_avg_xy8_mmx
-            }
-        }
-    };
-
-#define list p_function_list->functions.motion
-    memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 );
-#undef list
-
-    return;
+        /* Width == 16 */
+        { MC_put_16_mmx, MC_put_x16_mmx, MC_put_y16_mmx, MC_put_xy16_mmx },
+        /* Width == 8 */        
+        { MC_put_8_mmx,  MC_put_x8_mmx,  MC_put_y8_mmx, MC_put_xy8_mmx }
+    },
+    /* Averaging functions */
+    {
+        /* Width == 16 */
+        { MC_avg_16_mmx, MC_avg_x16_mmx, MC_avg_y16_mmx, MC_avg_xy16_mmx },
+        /* Width == 8 */
+        { MC_avg_8_mmx,  MC_avg_x8_mmx,  MC_avg_y8_mmx,  MC_avg_xy8_mmx }
+    }
+};
+
+static int Open ( vlc_object_t *p_this )
+{
+    p_this->p_private = ppppf_motion;
+    return VLC_SUCCESS;
 }