Mercurial > mplayer.hg
annotate libvo/osd.c @ 31349:92d75e703bc0
Rename configure.log file to the more standard name config.log.
author | diego |
---|---|
date | Mon, 14 Jun 2010 15:17:48 +0000 |
parents | 4ab80ac9c2d1 |
children |
rev | line source |
---|---|
28446
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
1 /* |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
2 * generic alpha renderers for all YUV modes and RGB depths |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
3 * These are "reference implementations", should be optimized later (MMX, etc). |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
4 * templating code by Michael Niedermayer (michaelni@gmx.at) |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
5 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
6 * This file is part of MPlayer. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
7 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
8 * MPlayer is free software; you can redistribute it and/or modify |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
9 * it under the terms of the GNU General Public License as published by |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
10 * the Free Software Foundation; either version 2 of the License, or |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
11 * (at your option) any later version. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
12 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
13 * MPlayer is distributed in the hope that it will be useful, |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
16 * GNU General Public License for more details. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
17 * |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
7681eab10aea
Add standard license headers, unify header formatting.
diego
parents:
28335
diff
changeset
|
21 */ |
326 | 22 |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
23 //#define FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
24 //#define FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
25 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
26 #include "config.h" |
622 | 27 #include "osd.h" |
5935 | 28 #include "mp_msg.h" |
2846 | 29 #include <inttypes.h> |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13720
diff
changeset
|
30 #include "cpudetect.h" |
2846 | 31 |
28290 | 32 #if ARCH_X86 |
25903
7a1397677cb3
Avoid a MANGLE, there is no register pressure and the generated code
reimar
parents:
20577
diff
changeset
|
33 static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; |
2839 | 34 static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL; |
35 static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; | |
36 #endif | |
3142 | 37 |
38 //Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | |
39 //Plain C versions | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
40 #if !HAVE_MMX || CONFIG_RUNTIME_CPUDETECT |
3153 | 41 #define COMPILE_C |
42 #endif | |
43 | |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
44 #if ARCH_X86 |
3153 | 45 |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
46 #if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT |
3153 | 47 #define COMPILE_MMX |
48 #endif | |
49 | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
50 #if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT |
3153 | 51 #define COMPILE_MMX2 |
52 #endif | |
53 | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
54 #if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT |
3153 | 55 #define COMPILE_3DNOW |
56 #endif | |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
57 |
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
58 #endif /* ARCH_X86 */ |
3153 | 59 |
60 #undef HAVE_MMX | |
61 #undef HAVE_MMX2 | |
28335 | 62 #undef HAVE_AMD3DNOW |
28290 | 63 #define HAVE_MMX 0 |
64 #define HAVE_MMX2 0 | |
28335 | 65 #define HAVE_AMD3DNOW 0 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
66 |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
67 #if ! ARCH_X86 |
3153 | 68 |
69 #ifdef COMPILE_C | |
3142 | 70 #undef HAVE_MMX |
71 #undef HAVE_MMX2 | |
28335 | 72 #undef HAVE_AMD3DNOW |
28290 | 73 #define HAVE_MMX 0 |
74 #define HAVE_MMX2 0 | |
28335 | 75 #define HAVE_AMD3DNOW 0 |
3142 | 76 #define RENAME(a) a ## _C |
77 #include "osd_template.c" | |
3153 | 78 #endif |
3142 | 79 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
80 #else |
3142 | 81 |
82 //X86 noMMX versions | |
3153 | 83 #ifdef COMPILE_C |
3142 | 84 #undef RENAME |
85 #undef HAVE_MMX | |
86 #undef HAVE_MMX2 | |
28335 | 87 #undef HAVE_AMD3DNOW |
28290 | 88 #define HAVE_MMX 0 |
89 #define HAVE_MMX2 0 | |
28335 | 90 #define HAVE_AMD3DNOW 0 |
3142 | 91 #define RENAME(a) a ## _X86 |
92 #include "osd_template.c" | |
3153 | 93 #endif |
3142 | 94 |
95 //MMX versions | |
3153 | 96 #ifdef COMPILE_MMX |
3142 | 97 #undef RENAME |
28290 | 98 #undef HAVE_MMX |
3142 | 99 #undef HAVE_MMX2 |
28335 | 100 #undef HAVE_AMD3DNOW |
28290 | 101 #define HAVE_MMX 1 |
102 #define HAVE_MMX2 0 | |
28335 | 103 #define HAVE_AMD3DNOW 0 |
3142 | 104 #define RENAME(a) a ## _MMX |
105 #include "osd_template.c" | |
3153 | 106 #endif |
3142 | 107 |
108 //MMX2 versions | |
3153 | 109 #ifdef COMPILE_MMX2 |
3142 | 110 #undef RENAME |
28290 | 111 #undef HAVE_MMX |
112 #undef HAVE_MMX2 | |
28335 | 113 #undef HAVE_AMD3DNOW |
28290 | 114 #define HAVE_MMX 1 |
115 #define HAVE_MMX2 1 | |
28335 | 116 #define HAVE_AMD3DNOW 0 |
3142 | 117 #define RENAME(a) a ## _MMX2 |
118 #include "osd_template.c" | |
3153 | 119 #endif |
3142 | 120 |
121 //3DNOW versions | |
3153 | 122 #ifdef COMPILE_3DNOW |
3142 | 123 #undef RENAME |
28290 | 124 #undef HAVE_MMX |
3142 | 125 #undef HAVE_MMX2 |
28335 | 126 #undef HAVE_AMD3DNOW |
28290 | 127 #define HAVE_MMX 1 |
128 #define HAVE_MMX2 0 | |
28335 | 129 #define HAVE_AMD3DNOW 1 |
3142 | 130 #define RENAME(a) a ## _3DNow |
131 #include "osd_template.c" | |
3153 | 132 #endif |
3142 | 133 |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
134 #endif /* ARCH_X86 */ |
3142 | 135 |
136 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
137 #if CONFIG_RUNTIME_CPUDETECT |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
138 #if ARCH_X86 |
12516 | 139 // ordered by speed / fastest first |
3142 | 140 if(gCpuCaps.hasMMX2) |
141 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
142 else if(gCpuCaps.has3DNow) | |
143 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
144 else if(gCpuCaps.hasMMX) | |
145 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
146 else | |
147 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
148 #else | |
149 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); | |
150 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
151 #else //CONFIG_RUNTIME_CPUDETECT |
28290 | 152 #if HAVE_MMX2 |
3153 | 153 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); |
28335 | 154 #elif HAVE_AMD3DNOW |
3153 | 155 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 156 #elif HAVE_MMX |
3153 | 157 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 158 #elif ARCH_X86 |
3153 | 159 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); |
160 #else | |
161 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); | |
162 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
163 #endif //!CONFIG_RUNTIME_CPUDETECT |
3142 | 164 } |
165 | |
166 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
167 #if CONFIG_RUNTIME_CPUDETECT |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
168 #if ARCH_X86 |
12516 | 169 // ordered by speed / fastest first |
3142 | 170 if(gCpuCaps.hasMMX2) |
171 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
172 else if(gCpuCaps.has3DNow) | |
173 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
174 else if(gCpuCaps.hasMMX) | |
175 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
176 else | |
177 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
178 #else | |
179 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); | |
180 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
181 #else //CONFIG_RUNTIME_CPUDETECT |
28290 | 182 #if HAVE_MMX2 |
3153 | 183 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); |
28335 | 184 #elif HAVE_AMD3DNOW |
3153 | 185 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 186 #elif HAVE_MMX |
3153 | 187 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 188 #elif ARCH_X86 |
3153 | 189 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); |
190 #else | |
191 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); | |
192 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
193 #endif //!CONFIG_RUNTIME_CPUDETECT |
3142 | 194 } |
195 | |
12516 | 196 void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
197 #if CONFIG_RUNTIME_CPUDETECT |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
198 #if ARCH_X86 |
12516 | 199 // ordered by speed / fastest first |
200 if(gCpuCaps.hasMMX2) | |
201 vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
202 else if(gCpuCaps.has3DNow) | |
203 vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
204 else if(gCpuCaps.hasMMX) | |
205 vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
206 else | |
207 vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
208 #else | |
209 vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); | |
210 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
211 #else //CONFIG_RUNTIME_CPUDETECT |
28290 | 212 #if HAVE_MMX2 |
12516 | 213 vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); |
28335 | 214 #elif HAVE_AMD3DNOW |
12516 | 215 vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 216 #elif HAVE_MMX |
12516 | 217 vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 218 #elif ARCH_X86 |
12516 | 219 vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); |
220 #else | |
221 vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); | |
222 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
223 #endif //!CONFIG_RUNTIME_CPUDETECT |
12516 | 224 } |
225 | |
326 | 226 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
227 #if CONFIG_RUNTIME_CPUDETECT |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
228 #if ARCH_X86 |
12516 | 229 // ordered by speed / fastest first |
3142 | 230 if(gCpuCaps.hasMMX2) |
231 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
232 else if(gCpuCaps.has3DNow) | |
233 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
234 else if(gCpuCaps.hasMMX) | |
235 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
236 else | |
237 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
238 #else |
3142 | 239 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
240 #endif |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
241 #else //CONFIG_RUNTIME_CPUDETECT |
28290 | 242 #if HAVE_MMX2 |
3153 | 243 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); |
28335 | 244 #elif HAVE_AMD3DNOW |
3153 | 245 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 246 #elif HAVE_MMX |
3153 | 247 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 248 #elif ARCH_X86 |
3153 | 249 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); |
250 #else | |
251 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); | |
252 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
253 #endif //!CONFIG_RUNTIME_CPUDETECT |
326 | 254 } |
255 | |
256 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
257 #if CONFIG_RUNTIME_CPUDETECT |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
258 #if ARCH_X86 |
12516 | 259 // ordered by speed / fastest first |
3142 | 260 if(gCpuCaps.hasMMX2) |
261 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
262 else if(gCpuCaps.has3DNow) | |
263 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
264 else if(gCpuCaps.hasMMX) | |
265 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
266 else | |
267 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
268 #else | |
269 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); | |
2846 | 270 #endif |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
271 #else //CONFIG_RUNTIME_CPUDETECT |
28290 | 272 #if HAVE_MMX2 |
3153 | 273 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); |
28335 | 274 #elif HAVE_AMD3DNOW |
3153 | 275 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 276 #elif HAVE_MMX |
3153 | 277 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); |
28290 | 278 #elif ARCH_X86 |
3153 | 279 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); |
280 #else | |
281 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); | |
282 #endif | |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
283 #endif //!CONFIG_RUNTIME_CPUDETECT |
326 | 284 } |
285 | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
286 #ifdef FAST_OSD_TABLE |
31164 | 287 static unsigned short fast_osd_12bpp_table[256]; |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
288 static unsigned short fast_osd_15bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
289 static unsigned short fast_osd_16bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
290 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
291 |
17566
f580a7755ac5
Patch by Stefan Huehner / stefan % huehner ! org \
rathann
parents:
13787
diff
changeset
|
292 void vo_draw_alpha_init(void){ |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
293 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
294 int i; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
295 for(i=0;i<256;i++){ |
31164 | 296 fast_osd_12bpp_table[i]=((i>>4)<< 8)|((i>>4)<<4)|(i>>4); |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
297 fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3); |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
298 fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3); |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
299 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
300 #endif |
11000 | 301 //FIXME the optimized stuff is a lie for 15/16bpp as they aren't optimized yet |
17969
843e0427b5b9
Change 'if(verbose)' to the more appropriate mp_msg_test.
diego
parents:
17566
diff
changeset
|
302 if( mp_msg_test(MSGT_OSD,MSGL_V) ) |
3142 | 303 { |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
304 #if CONFIG_RUNTIME_CPUDETECT |
28921
62f0032e736a
Get rid of pointless preprocessor condition indirection and use ARCH_X86
diego
parents:
28446
diff
changeset
|
305 #if ARCH_X86 |
3142 | 306 // ordered per speed fasterst first |
307 if(gCpuCaps.hasMMX2) | |
5935 | 308 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); |
3142 | 309 else if(gCpuCaps.has3DNow) |
5935 | 310 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); |
3142 | 311 else if(gCpuCaps.hasMMX) |
5935 | 312 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); |
3142 | 313 else |
5935 | 314 mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); |
3142 | 315 #else |
5935 | 316 mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); |
3142 | 317 #endif |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
318 #else //CONFIG_RUNTIME_CPUDETECT |
28290 | 319 #if HAVE_MMX2 |
5935 | 320 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); |
28335 | 321 #elif HAVE_AMD3DNOW |
5935 | 322 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); |
28290 | 323 #elif HAVE_MMX |
5935 | 324 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); |
28290 | 325 #elif ARCH_X86 |
5935 | 326 mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); |
3153 | 327 #else |
5935 | 328 mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); |
3153 | 329 #endif |
29114
06540eb5ef6a
Rename RUNTIME_CPUDETECT to CONFIG_RUNTIME_CPUDETECT and always define it.
ramiro
parents:
28921
diff
changeset
|
330 #endif //!CONFIG_RUNTIME_CPUDETECT |
3142 | 331 } |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
332 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
333 |
31082
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
334 void vo_draw_alpha_rgb12(int w, int h, unsigned char* src, unsigned char *srca, |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
335 int srcstride, unsigned char* dstbase, int dststride) { |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
336 int y; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
337 for (y = 0; y < h; y++) { |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
338 register unsigned short *dst = (unsigned short*) dstbase; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
339 register int x; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
340 for (x = 0; x < w; x++) { |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
341 if(srca[x]){ |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
342 #ifdef FAST_OSD |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
343 #ifdef FAST_OSD_TABLE |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
344 dst[x] = fast_osd_12bpp_table[src[x]]; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
345 #else |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
346 register unsigned int a = src[x] >> 4; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
347 dst[x] = (a << 8) | (a << 4) | a; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
348 #endif |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
349 #else |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
350 unsigned char r = dst[x] & 0x0F; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
351 unsigned char g = (dst[x] >> 4) & 0x0F; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
352 unsigned char b = (dst[x] >> 8) & 0x0F; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
353 r = (((r*srca[x]) >> 4) + src[x]) >> 4; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
354 g = (((g*srca[x]) >> 4) + src[x]) >> 4; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
355 b = (((b*srca[x]) >> 4) + src[x]) >> 4; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
356 dst[x] = (b << 8) | (g << 4) | r; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
357 #endif |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
358 } |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
359 } |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
360 src += srcstride; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
361 srca += srcstride; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
362 dstbase += dststride; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
363 } |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
364 return; |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
365 } |
92f88bb315c5
Add support for 12-bit color mode on framebuffer devices.
cehoyos
parents:
30633
diff
changeset
|
366 |
326 | 367 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
368 int y; | |
369 for(y=0;y<h;y++){ | |
370 register unsigned short *dst = (unsigned short*) dstbase; | |
371 register int x; | |
372 for(x=0;x<w;x++){ | |
373 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
374 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
375 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
376 dst[x]=fast_osd_15bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
377 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
378 register unsigned int a=src[x]>>3; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
379 dst[x]=(a<<10)|(a<<5)|a; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
380 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
381 #else |
326 | 382 unsigned char r=dst[x]&0x1F; |
383 unsigned char g=(dst[x]>>5)&0x1F; | |
384 unsigned char b=(dst[x]>>10)&0x1F; | |
385 r=(((r*srca[x])>>5)+src[x])>>3; | |
386 g=(((g*srca[x])>>5)+src[x])>>3; | |
387 b=(((b*srca[x])>>5)+src[x])>>3; | |
388 dst[x]=(b<<10)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
389 #endif |
326 | 390 } |
391 } | |
392 src+=srcstride; | |
393 srca+=srcstride; | |
394 dstbase+=dststride; | |
395 } | |
396 return; | |
397 } | |
398 | |
399 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
400 int y; | |
401 for(y=0;y<h;y++){ | |
402 register unsigned short *dst = (unsigned short*) dstbase; | |
403 register int x; | |
404 for(x=0;x<w;x++){ | |
405 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
406 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
407 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
408 dst[x]=fast_osd_16bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
409 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
410 dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3); |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
411 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
412 #else |
326 | 413 unsigned char r=dst[x]&0x1F; |
414 unsigned char g=(dst[x]>>5)&0x3F; | |
415 unsigned char b=(dst[x]>>11)&0x1F; | |
416 r=(((r*srca[x])>>5)+src[x])>>3; | |
417 g=(((g*srca[x])>>6)+src[x])>>2; | |
418 b=(((b*srca[x])>>5)+src[x])>>3; | |
419 dst[x]=(b<<11)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
420 #endif |
326 | 421 } |
422 } | |
423 src+=srcstride; | |
424 srca+=srcstride; | |
425 dstbase+=dststride; | |
426 } | |
427 return; | |
428 } |