]> git.sesse.net Git - vlc/blob - plugins/idct/idctaltivec.c
* Totally rewrote the video decoder (inspired by walken's mpeg2dec), implying :
[vlc] / plugins / idct / idctaltivec.c
1 /*****************************************************************************
2  * idctaltivec.c : Altivec IDCT module
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: idctaltivec.c,v 1.11 2001/08/22 17:21:45 massiot Exp $
6  *
7  * Authors: Christophe Massiot <massiot@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 #define MODULE_NAME idctaltivec
25 #include "modules_inner.h"
26
27 /*****************************************************************************
28  * Preamble
29  *****************************************************************************/
30 #include "defs.h"
31
32 #include <stdlib.h>
33
34 #include "config.h"
35 #include "common.h"
36 #include "threads.h"
37 #include "mtime.h"
38 #include "tests.h"                                              /* TestCPU() */
39
40 #include "vdec_idct.h"
41
42 #include "idctaltivec.h"
43
44 #include "modules.h"
45 #include "modules_export.h"
46
47 /*****************************************************************************
48  * Local prototypes.
49  *****************************************************************************/
50 static void idct_getfunctions( function_list_t * p_function_list );
51 static int  idct_Probe      ( probedata_t *p_data );
52 static void vdec_NormScan   ( u8 ppi_scan[2][64] );
53
54 /*****************************************************************************
55  * Build configuration tree.
56  *****************************************************************************/
57 MODULE_CONFIG_START
58 ADD_WINDOW( "Configuration for Altivec IDCT module" )
59     ADD_COMMENT( "Ha, ha -- nothing to configure yet" )
60 MODULE_CONFIG_STOP
61
62 MODULE_INIT_START
63     p_module->i_capabilities = MODULE_CAPABILITY_NULL
64                                 | MODULE_CAPABILITY_IDCT;
65     p_module->psz_longname = "Altivec IDCT module";
66 MODULE_INIT_STOP
67
68 MODULE_ACTIVATE_START
69     idct_getfunctions( &p_module->p_functions->idct );
70 MODULE_ACTIVATE_STOP
71
72 MODULE_DEACTIVATE_START
73 MODULE_DEACTIVATE_STOP
74
75 /* Following functions are local */
76
77 /*****************************************************************************
78  * Functions exported as capabilities.
79  *****************************************************************************/
80 static void idct_getfunctions( function_list_t * p_function_list )
81 {
82     p_function_list->pf_probe = idct_Probe;
83 #define F p_function_list->functions.idct
84     F.pf_idct_init = _M( vdec_InitIDCT );
85     F.pf_sparse_idct = _M( vdec_SparseIDCT );
86     F.pf_idct = _M( vdec_IDCT );
87     F.pf_norm_scan = vdec_NormScan;
88     F.pf_decode_init = _M( vdec_InitDecode );
89     F.pf_addblock = _M( vdec_AddBlock );
90     F.pf_copyblock = _M( vdec_CopyBlock );
91 #undef F
92 }
93
94 /*****************************************************************************
95  * idct_Probe: return a preference score
96  *****************************************************************************/
97 static int idct_Probe( probedata_t *p_data )
98 {
99     if( !TestCPU( CPU_CAPABILITY_ALTIVEC ) )
100     {
101         return( 0 );
102     }
103
104     if( TestMethod( IDCT_METHOD_VAR, "idctaltivec" )
105          || TestMethod( IDCT_METHOD_VAR, "altivec" ) )
106     {
107         return( 999 );
108     }
109
110     /* The Altivec iDCT is deactivated until it really works */
111     return( 0 /* 200 */ );
112 }
113
114 /*****************************************************************************
115  * vdec_NormScan : Soon, transpose
116  *****************************************************************************/
117 static void vdec_NormScan( u8 ppi_scan[2][64] )
118 {
119 }
120
121 /*****************************************************************************
122  * vdec_IDCT :
123  *****************************************************************************/
124 void _M( vdec_IDCT )( void * p_unused_data, dctelem_t * p_block,
125                       int i_idontcare )
126 {
127     IDCT( p_block, p_block );
128 }
129