]> git.sesse.net Git - vlc/blobdiff - plugins/motion/motion3dnow.c
* ALL: new module API. Makes a few things a lot simpler, and we gain
[vlc] / plugins / motion / motion3dnow.c
index 0ff1b07e5ae28c106b04eeee03711b19ac2028b9..a94ebcd19c1a8380e604095920851459902ef7eb 100644 (file)
@@ -2,7 +2,7 @@
  * motion3dnow.c : 3D Now! motion compensation module for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: motion3dnow.c,v 1.9 2002/04/21 10:32:20 sam Exp $
+ * $Id: motion3dnow.c,v 1.12 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( _("3D Now! motion compensation module") )
-    ADD_CAPABILITY( MOTION, 150 )
-    ADD_REQUIREMENT( 3DNOW )
-    ADD_SHORTCUT( "3dn" )
-    ADD_SHORTCUT( "3dnow" )
-    ADD_SHORTCUT( "motion3dn" )
-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( _("3D Now! motion compensation module") );
+    set_capability( "motion compensation", 150 );
+    add_requirement( 3DNOW );
+    add_shortcut( "3dn" );
+    add_shortcut( "3dnow" );
+    set_callbacks( Open, NULL );
+vlc_module_end();
 
 /*****************************************************************************
  * Motion compensation in 3D Now! (OK I know this does MMXEXT too and it's ugly)
@@ -89,7 +79,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 {
@@ -100,7 +90,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 {
@@ -113,7 +103,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 {
@@ -125,7 +115,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 {
@@ -140,7 +130,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 {
@@ -152,7 +142,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 {
@@ -167,7 +157,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 {
@@ -180,7 +170,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 {
@@ -199,7 +189,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);
@@ -238,7 +228,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 {
@@ -284,7 +274,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 {
@@ -313,7 +303,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 {
@@ -560,39 +550,27 @@ static void MC_put_xy8_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_3dnow, MC_put_x16_3dnow, MC_put_y16_3dnow, MC_put_xy16_3dnow
-            },
-            {
-                /* Width == 8 */
-                MC_put_8_3dnow,  MC_put_x8_3dnow,  MC_put_y8_3dnow, MC_put_xy8_3dnow
-            }
-        },
-        {
-            /* Averaging functions */
-            {
-                /* Width == 16 */
-                MC_avg_16_3dnow, MC_avg_x16_3dnow, MC_avg_y16_3dnow, MC_avg_xy16_3dnow
-            },
-            {
-                /* Width == 8 */
-                MC_avg_8_3dnow,  MC_avg_x8_3dnow,  MC_avg_y8_3dnow,  MC_avg_xy8_3dnow
-            }
-        }
-    };
-
-#define list p_function_list->functions.motion
-    memcpy( list.ppppf_motion, ppppf_motion, sizeof( void * ) * 16 );
-#undef list
-
-    return;
+        /* Width == 16 */
+        { MC_put_16_3dnow, MC_put_x16_3dnow, MC_put_y16_3dnow, MC_put_xy16_3dnow },
+        /* Width == 8 */
+        { MC_put_8_3dnow,  MC_put_x8_3dnow,  MC_put_y8_3dnow, MC_put_xy8_3dnow }
+    },
+    /* Averaging functions */
+    {
+        /* Width == 16 */
+        { MC_avg_16_3dnow, MC_avg_x16_3dnow, MC_avg_y16_3dnow, MC_avg_xy16_3dnow },
+        /* Width == 8 */
+        { MC_avg_8_3dnow,  MC_avg_x8_3dnow,  MC_avg_y8_3dnow,  MC_avg_xy8_3dnow }
+    }
+};
+
+static int Open ( vlc_object_t *p_this )
+{
+    p_this->p_private = ppppf_motion;
+    return VLC_SUCCESS;
 }