]> git.sesse.net Git - vlc/blobdiff - plugins/idct/idctmmx.c
Some heavy changes today:
[vlc] / plugins / idct / idctmmx.c
index acc3702347eb203a7a0c16ef69025321afbf178b..a32e8beaed959b6cb161669eae78561a4e868896 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * idctmmx.c : MMX IDCT module
  *****************************************************************************
- * Copyright (C) 1999, 2000 VideoLAN
- * $Id: idctmmx.c,v 1.11 2001/05/15 16:19:42 sam Exp $
+ * Copyright (C) 1999-2001 VideoLAN
+ * $Id: idctmmx.c,v 1.22 2001/12/30 07:09:55 sam Exp $
  *
  * Authors: Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  *          Michel Lespinasse <walken@zoy.org>
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  *****************************************************************************/
 
-#define MODULE_NAME idctmmx
-
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include "defs.h"
-
 #include <stdlib.h>
+#include <string.h>
 
-#include "config.h"
-#include "common.h"
-#include "threads.h"
-#include "mtime.h"
-#include "tests.h"                                              /* TestCPU() */
-
-#include "video.h"
-#include "video_output.h"
-
-#include "video_decoder.h"
-
-#include "modules.h"
-#include "modules_inner.h"
-
-#include "vdec_block.h"
-#include "vdec_idct.h"
+#include <videolan/vlc.h>
 
-#include "attributes.h"
 #include "mmx.h"
 
+#include "idct.h"
+#include "block_mmx.h"
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
 static void idct_getfunctions( function_list_t * p_function_list );
-static int  idct_Probe      ( probedata_t *p_data );
-static void vdec_NormScan   ( u8 ppi_scan[2][64] );
-
 
 /*****************************************************************************
  * Build configuration tree.
  *****************************************************************************/
 MODULE_CONFIG_START
-ADD_WINDOW( "Configuration for MMX IDCT module" )
-    ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
-MODULE_CONFIG_END
+MODULE_CONFIG_STOP
 
-/*****************************************************************************
- * InitModule: get the module structure and configuration.
- *****************************************************************************
- * We have to fill psz_name, psz_longname and psz_version. These variables
- * will be strdup()ed later by the main application because the module can
- * be unloaded later to save memory, and we want to be able to access this
- * data even after the module has been unloaded.
- *****************************************************************************/
-MODULE_INIT
-{
-    p_module->psz_name = MODULE_STRING;
-    p_module->psz_longname = "MMX IDCT module";
-    p_module->psz_version = VERSION;
-
-    p_module->i_capabilities = MODULE_CAPABILITY_NULL
-                                | MODULE_CAPABILITY_IDCT;
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * ActivateModule: set the module to an usable state.
- *****************************************************************************
- * This function fills the capability functions and the configuration
- * structure. Once ActivateModule() has been called, the i_usage can
- * be set to 0 and calls to NeedModule() be made to increment it. To unload
- * the module, one has to wait until i_usage == 0 and call DeactivateModule().
- *****************************************************************************/
-MODULE_ACTIVATE
-{
-    p_module->p_functions = malloc( sizeof( module_functions_t ) );
-    if( p_module->p_functions == NULL )
-    {
-        return( -1 );
-    }
+MODULE_INIT_START
+    SET_DESCRIPTION( "MMX IDCT module" )
+    ADD_CAPABILITY( IDCT, 150 )
+    ADD_REQUIREMENT( MMX )
+    ADD_SHORTCUT( "mmx" )
+    ADD_SHORTCUT( "imdctmmx" )
+MODULE_INIT_STOP
 
+MODULE_ACTIVATE_START
     idct_getfunctions( &p_module->p_functions->idct );
+MODULE_ACTIVATE_STOP
 
-    p_module->p_config = p_config;
-
-    return( 0 );
-}
-
-/*****************************************************************************
- * DeactivateModule: make sure the module can be unloaded.
- *****************************************************************************
- * This function must only be called when i_usage == 0. If it successfully
- * returns, i_usage can be set to -1 and the module unloaded. Be careful to
- * lock usage_lock during the whole process.
- *****************************************************************************/
-MODULE_DEACTIVATE
-{
-    free( p_module->p_functions );
-
-    return( 0 );
-}
+MODULE_DEACTIVATE_START
+MODULE_DEACTIVATE_STOP
 
 /* Following functions are local */
 
-/*****************************************************************************
- * Functions exported as capabilities.
- *****************************************************************************/
-static void idct_getfunctions( function_list_t * p_function_list )
-{
-    p_function_list->pf_probe = idct_Probe;
-#define F p_function_list->functions.idct
-    F.pf_idct_init = _M( vdec_InitIDCT );
-    F.pf_sparse_idct = _M( vdec_SparseIDCT );
-    F.pf_idct = _M( vdec_IDCT );
-    F.pf_norm_scan = vdec_NormScan;
-    F.pf_vdec_init = _M( vdec_Init );
-    F.pf_decode_mb_c = _M( vdec_DecodeMacroblockC );
-    F.pf_decode_mb_bw = _M( vdec_DecodeMacroblockBW );
-#undef F
-}
-
 /*****************************************************************************
  * idct_Probe: return a preference score
  *****************************************************************************/
 static int idct_Probe( probedata_t *p_data )
 {
-    if( !TestCPU( CPU_CAPABILITY_MMX ) )
-    {
-        return( 0 );
-    }
-
-    if( TestMethod( IDCT_METHOD_VAR, "idctmmx" ) )
-    {
-        return( 999 );
-    }
-
     return( 150 );
 }
 
 /*****************************************************************************
- * vdec_NormScan : This IDCT uses reordered coeffs, so we patch the scan table
+ * NormScan : This IDCT uses reordered coeffs, so we patch the scan table
  *****************************************************************************/
-static void vdec_NormScan( u8 ppi_scan[2][64] )
+static void NormScan( u8 ppi_scan[2][64] )
 {
     int     i, j;
 
@@ -182,7 +92,7 @@ static void vdec_NormScan( u8 ppi_scan[2][64] )
 }
 
 /*****************************************************************************
- * vdec_IDCT :
+ * IDCT :
  *****************************************************************************/
 #define ROW_SHIFT 11
 #define COL_SHIFT 6
@@ -476,8 +386,7 @@ static s32 rounder3[] ATTR_ALIGN(8) =
 static s32 rounder5[] ATTR_ALIGN(8) =
     rounder (-0.441341716183);  // C3*(-C5/C4+C5-C3)/2
 
-void _M( vdec_IDCT )( vdec_thread_t * p_vdec, dctelem_t * p_block,
-                      int i_idontcare )
+static void IDCT( dctelem_t * p_block )
 {
     static dctelem_t table04[] ATTR_ALIGN(16) =
         table (22725, 21407, 19266, 16384, 12873,  8867, 4520);
@@ -510,3 +419,5 @@ void _M( vdec_IDCT )( vdec_thread_t * p_vdec, dctelem_t * p_block,
     Col( p_block, 4 );
 }
 
+#include "idct_sparse.h"
+#include "idct_decl.h"