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