562
|
1 /*
|
|
2 optimize: get a grip on the different optimizations
|
|
3
|
|
4 copyright 2006 by the mpg123 project - free software under the terms of the LGPL 2.1
|
|
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
|
|
6 initially written by Thomas Orgis, inspired by 3DNow stuff in mpg123.[hc]
|
|
7
|
|
8 Currently, this file contains the struct and function to choose an optimization variant and works only when OPT_MULTI is in effect.
|
|
9 */
|
|
10
|
|
11 #include "mpg123lib_intern.h" /* includes optimize.h */
|
|
12 #ifdef OPT_MULTI
|
|
13
|
|
14 #include "getcpuflags.h"
|
|
15 struct cpuflags cpu_flags;
|
|
16
|
|
17 /* same number of entries as full list, but empty at beginning */
|
|
18 static char *mpg123_supported_decoder_list[] =
|
|
19 {
|
|
20 #ifdef OPT_3DNOWEXT
|
|
21 NULL,
|
|
22 #endif
|
|
23 #ifdef OPT_SSE
|
|
24 NULL,
|
|
25 #endif
|
|
26 #ifdef OPT_3DNOW
|
|
27 NULL,
|
|
28 #endif
|
|
29 #ifdef OPT_MMX
|
|
30 NULL,
|
|
31 #endif
|
|
32 #ifdef OPT_I586
|
|
33 NULL,
|
|
34 #endif
|
|
35 #ifdef OPT_I586_DITHER
|
|
36 NULL,
|
|
37 #endif
|
|
38 #ifdef OPT_I486
|
|
39 NULL,
|
|
40 #endif
|
|
41 #ifdef OPT_I386
|
|
42 NULL,
|
|
43 #endif
|
|
44 #ifdef OPT_ALTIVEC
|
|
45 NULL,
|
|
46 #endif
|
|
47 NULL, /* generic */
|
|
48 NULL
|
|
49 };
|
|
50 #endif
|
|
51
|
|
52 static char *mpg123_decoder_list[] =
|
|
53 {
|
|
54 #ifdef OPT_3DNOWEXT
|
|
55 "3DNowExt",
|
|
56 #endif
|
|
57 #ifdef OPT_SSE
|
|
58 "SSE",
|
|
59 #endif
|
|
60 #ifdef OPT_3DNOW
|
|
61 "3DNow",
|
|
62 #endif
|
|
63 #ifdef OPT_MMX
|
|
64 "MMX",
|
|
65 #endif
|
|
66 #ifdef OPT_I586
|
|
67 "i586",
|
|
68 #endif
|
|
69 #ifdef OPT_I586_DITHER
|
|
70 "i586_dither",
|
|
71 #endif
|
|
72 #ifdef OPT_I486
|
|
73 "i486",
|
|
74 #endif
|
|
75 #ifdef OPT_I386
|
|
76 "i386",
|
|
77 #endif
|
|
78 #ifdef OPT_ALTIVEC
|
|
79 "AltiVec",
|
|
80 #endif
|
|
81 #ifdef OPT_GENERIC
|
|
82 "generic",
|
|
83 #endif
|
|
84 NULL
|
|
85 };
|
|
86
|
|
87 void check_decoders(void )
|
|
88 {
|
|
89 #ifndef OPT_MULTI
|
|
90 return;
|
|
91 #else
|
|
92 char **d = mpg123_supported_decoder_list;
|
|
93 #ifdef OPT_X86
|
|
94 getcpuflags(&cpu_flags);
|
|
95 if(cpu_i586(cpu_flags))
|
|
96 {
|
|
97 /* not yet: if(cpu_sse2(cpu_flags)) printf(" SSE2");
|
|
98 if(cpu_sse3(cpu_flags)) printf(" SSE3"); */
|
|
99 #ifdef OPT_3DNOWEXT
|
|
100 if(cpu_3dnowext(cpu_flags)) *(d++) = "3DNowExt";
|
|
101 #endif
|
|
102 #ifdef OPT_SSE
|
|
103 if(cpu_sse(cpu_flags)) *(d++) = "SSE";
|
|
104 #endif
|
|
105 #ifdef OPT_3DNOW
|
|
106 if(cpu_3dnow(cpu_flags)) *(d++) = "3DNow";
|
|
107 #endif
|
|
108 #ifdef OPT_MMX
|
|
109 if(cpu_mmx(cpu_flags)) *(d++) = "MMX";
|
|
110 #endif
|
|
111 #ifdef OPT_I586
|
|
112 *(d++) = "i586";
|
|
113 #endif
|
|
114 #ifdef OPT_I586_DITHER
|
|
115 *(d++) = "i586_dither";
|
|
116 #endif
|
|
117 }
|
|
118 #endif
|
|
119 /* just assume that the i486 built is run on a i486 cpu... */
|
|
120 #ifdef OPT_I486
|
|
121 *(d++) = "i486";
|
|
122 #endif
|
|
123 #ifdef OPT_ALTIVEC
|
|
124 *(d++) = "AltiVec";
|
|
125 #endif
|
|
126 /* every supported x86 can do i386, any cpu can do generic */
|
|
127 #ifdef OPT_I386
|
|
128 *(d++) = "i386";
|
|
129 #endif
|
|
130 #ifdef OPT_GENERIC
|
|
131 *(d++) = "generic";
|
|
132 #endif
|
|
133 #endif /* ndef OPT_MULTI */
|
|
134 }
|
|
135
|
|
136 char attribute_align_arg **mpg123_decoders(){ return mpg123_decoder_list; }
|
|
137 char attribute_align_arg **mpg123_supported_decoders()
|
|
138 {
|
|
139 #ifdef OPT_MULTI
|
|
140 return mpg123_supported_decoder_list;
|
|
141 #else
|
|
142 return mpg123_decoder_list;
|
|
143 #endif
|
|
144 }
|