X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=plugins%2Fidct%2Fidctmmx.c;h=be625d3d4f9ed8df02bf7be3a29a9e8a6761fff6;hb=583c6553f6761421260d86bbc21b5b3169c04319;hp=6552e33f591e8d5a001c5e3a3c556c1aa68f7056;hpb=c0211e9a50e55b2783ae2fe1fd2e8b22541cd2d1;p=vlc diff --git a/plugins/idct/idctmmx.c b/plugins/idct/idctmmx.c index 6552e33f59..be625d3d4f 100644 --- a/plugins/idct/idctmmx.c +++ b/plugins/idct/idctmmx.c @@ -2,9 +2,13 @@ * idctmmx.c : MMX IDCT module ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: idctmmx.c,v 1.2 2001/01/15 06:18:23 sam Exp $ + * $Id: idctmmx.c,v 1.8 2001/02/20 07:49:13 sam Exp $ * - * Authors: Gaƫl Hendryckx + * Authors: Aaron Holtzman + * Michel Lespinasse + * Peter Gubanov + * (from the LiViD project) + * Christophe Massiot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,6 +38,7 @@ #include "common.h" #include "threads.h" #include "mtime.h" +#include "tests.h" /* TestCPU() */ #include "video.h" #include "video_output.h" @@ -45,17 +50,15 @@ #include "idct.h" +#include "attributes.h" +#include "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_InitIDCT ( vdec_thread_t * p_vdec); - void vdec_SparseIDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block, - int i_sparse_pos); - void vdec_IDCT ( vdec_thread_t * p_vdec, dctelem_t * p_block, - int i_idontcare ); +static void vdec_NormScan ( u8 ppi_scan[2][64] ); /***************************************************************************** @@ -74,7 +77,7 @@ MODULE_CONFIG_END * be unloaded later to save memory, and we want to be able to access this * data even after the module has been unloaded. *****************************************************************************/ -int InitModule( module_t * p_module ) +MODULE_INIT { p_module->psz_name = MODULE_STRING; p_module->psz_longname = "MMX IDCT module"; @@ -94,7 +97,7 @@ int InitModule( module_t * p_module ) * 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(). *****************************************************************************/ -int ActivateModule( module_t * p_module ) +MODULE_ACTIVATE { p_module->p_functions = malloc( sizeof( module_functions_t ) ); if( p_module->p_functions == NULL ) @@ -116,7 +119,7 @@ int ActivateModule( module_t * p_module ) * returns, i_usage can be set to -1 and the module unloaded. Be careful to * lock usage_lock during the whole process. *****************************************************************************/ -int DeactivateModule( module_t * p_module ) +MODULE_DEACTIVATE { free( p_module->p_functions ); @@ -126,8 +129,7 @@ int DeactivateModule( module_t * p_module ) /* Following functions are local */ /***************************************************************************** - * Functions exported as capabilities. They are declared as static so that - * we don't pollute the namespace too much. + * Functions exported as capabilities. *****************************************************************************/ static void idct_getfunctions( function_list_t * p_function_list ) { @@ -135,6 +137,7 @@ static void idct_getfunctions( function_list_t * p_function_list ) p_function_list->functions.idct.pf_init = vdec_InitIDCT; p_function_list->functions.idct.pf_sparse_idct = vdec_SparseIDCT; p_function_list->functions.idct.pf_idct = vdec_IDCT; + p_function_list->functions.idct.pf_norm_scan = vdec_NormScan; } /***************************************************************************** @@ -142,25 +145,366 @@ static void idct_getfunctions( function_list_t * p_function_list ) *****************************************************************************/ static int idct_Probe( probedata_t *p_data ) { - /* This plugin always works */ - return( 100 ); + if( TestCPU( CPU_CAPABILITY_MMX ) ) + { + if( TestMethod( IDCT_METHOD_VAR, "idctmmx" ) ) + { + return( 999 ); + } + else + { + return( 150 ); + } + } + else + { + return( 0 ); + } } /***************************************************************************** - * vdec_InitIDCT : initialize datas for vdec_SparceIDCT + * vdec_NormScan : This IDCT uses reordered coeffs, so we patch the scan table *****************************************************************************/ -static void vdec_InitIDCT (vdec_thread_t * p_vdec) +static void vdec_NormScan( u8 ppi_scan[2][64] ) { - int i; + int i, j; - dctelem_t * p_pre = p_vdec->p_pre_idct; - memset( p_pre, 0, 64*64*sizeof(dctelem_t) ); - - for( i=0 ; i < 64 ; i++ ) + for( i = 0; i < 64; i++ ) { - p_pre[i*64+i] = 1 << SPARSE_SCALE_FACTOR; - vdec_IDCT( p_vdec, &p_pre[i*64], 0) ; + j = ppi_scan[0][i]; + ppi_scan[0][i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2); + + j = ppi_scan[1][i]; + ppi_scan[1][i] = (j & 0x38) | ((j & 6) >> 1) | ((j & 1) << 2); } - return; +} + +/***************************************************************************** + * vdec_IDCT : + *****************************************************************************/ +#define ROW_SHIFT 11 +#define COL_SHIFT 6 + +#define round(bias) ((int)(((bias)+0.5) * (1<