]> git.sesse.net Git - vlc/blob - modules/misc/memcpy/memcpy.c
669d60a2bbd0515072c557e47752faa7a2c7a8a4
[vlc] / modules / misc / memcpy / memcpy.c
1 /*****************************************************************************
2  * memcpy.c : classic memcpy module
3  *****************************************************************************
4  * Copyright (C) 2001 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27
28 #include <vlc/vlc.h>
29
30 #undef HAVE_MMX
31 #undef HAVE_MMX2
32 #undef HAVE_SSE
33 #undef HAVE_SSE2
34 #undef HAVE_3DNOW
35 #undef HAVE_ALTIVEC
36
37 #if defined( MODULE_NAME_IS_memcpy3dn )
38 #   define PRIORITY 100
39 #   define HAVE_3DNOW
40 #elif defined( MODULE_NAME_IS_memcpymmx )
41 #   define PRIORITY 100
42 #   define HAVE_MMX
43 #elif defined( MODULE_NAME_IS_memcpymmxext )
44 #   define PRIORITY 200
45 #   define HAVE_MMX2
46 #else
47 #   define PRIORITY 50
48 #endif
49
50 /*****************************************************************************
51  * Extern prototype
52  *****************************************************************************/
53 #ifndef MODULE_NAME_IS_memcpy
54 #   define fast_memcpy E_(fast_memcpy)
55 #   include "fastmemcpy.h"
56 #endif
57
58 /*****************************************************************************
59  * Module initializer
60  *****************************************************************************/
61 static int Activate ( vlc_object_t *p_this )
62 {
63 #ifdef MODULE_NAME_IS_memcpy
64     p_this->p_libvlc->pf_memcpy = memcpy;
65     p_this->p_libvlc->pf_memset = memset;
66 #else
67     p_this->p_libvlc->pf_memcpy = fast_memcpy;
68     p_this->p_libvlc->pf_memset = NULL;
69 #endif
70
71     return VLC_SUCCESS;
72 }
73
74 /*****************************************************************************
75  * Module descriptor
76  *****************************************************************************/
77 vlc_module_begin();
78     set_category( CAT_ADVANCED );
79     set_subcategory( SUBCAT_ADVANCED_MISC );
80 #ifdef MODULE_NAME_IS_memcpy
81     set_description( _("libc memcpy") );
82     add_shortcut( "c" );
83     add_shortcut( "libc" );
84 #elif defined( MODULE_NAME_IS_memcpy3dn )
85     set_description( _("3D Now! memcpy") );
86     add_requirement( 3DNOW );
87     add_shortcut( "3dn" );
88     add_shortcut( "3dnow" );
89     add_shortcut( "memcpy3dn" );
90     add_shortcut( "memcpy3dnow" );
91 #elif defined( MODULE_NAME_IS_memcpymmx )
92     set_description( _("MMX memcpy") );
93     add_requirement( MMX );
94     add_shortcut( "mmx" );
95     add_shortcut( "memcpymmx" );
96 #elif defined( MODULE_NAME_IS_memcpymmxext )
97     set_description( _("MMX EXT memcpy") );
98     add_requirement( MMXEXT );
99     add_shortcut( "mmxext" );
100     add_shortcut( "memcpymmxext" );
101 #endif
102     set_capability( "memcpy", PRIORITY );
103     set_callbacks( Activate, NULL );
104 vlc_module_end();
105