Mercurial > mplayer.hg
annotate libvo/osd.c @ 2908:220e6c728747
gcc version messages updated. let's flame us again...
author | arpi |
---|---|
date | Wed, 14 Nov 2001 22:18:16 +0000 |
parents | 2f1e40539fe2 |
children | 0f6cce3a8059 |
rev | line source |
---|---|
326 | 1 // Generic alpha renderers for all YUV modes and RGB depths. |
2 // These are "reference implementations", should be optimized later (MMX, etc) | |
2846 | 3 // Optimized by Nick and Michael |
326 | 4 |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
5 //#define FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
6 //#define FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
7 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
8 #include "config.h" |
622 | 9 #include "osd.h" |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
10 #include "../mmx_defs.h" |
2833 | 11 //#define ENABLE_PROFILE |
12 #include "../my_profile.h" | |
2846 | 13 #include <inttypes.h> |
14 | |
2850 | 15 #ifdef HAVE_MMX |
2846 | 16 static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; |
17 #endif | |
622 | 18 |
326 | 19 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
20 int y; | |
2846 | 21 #if defined(FAST_OSD) && !defined(HAVE_MMX) |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
22 w=w>>1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
23 #endif |
2846 | 24 PROFILE_START(); |
326 | 25 for(y=0;y<h;y++){ |
26 register int x; | |
2846 | 27 #ifdef HAVE_MMX |
28 asm volatile( | |
29 PREFETCHW" %0\n\t" | |
30 PREFETCH" %1\n\t" | |
31 PREFETCH" %2\n\t" | |
32 // "pxor %%mm7, %%mm7\n\t" | |
33 "pcmpeqb %%mm5, %%mm5\n\t" // F..F | |
34 "movq %%mm5, %%mm4\n\t" | |
35 "psllw $8, %%mm5\n\t" //FF00FF00FF00 | |
36 "psrlw $8, %%mm4\n\t" //00FF00FF00FF | |
37 ::"m"(*dstbase),"m"(*srca),"m"(*src):"memory"); | |
38 for(x=0;x<w;x+=8){ | |
39 asm volatile( | |
40 "movl %1, %%eax\n\t" | |
41 "orl 4%1, %%eax\n\t" | |
42 " jz 1f\n\t" | |
43 PREFETCHW" 32%0\n\t" | |
44 PREFETCH" 32%1\n\t" | |
45 PREFETCH" 32%2\n\t" | |
46 "movq %0, %%mm0\n\t" // dstbase | |
47 "movq %%mm0, %%mm1\n\t" | |
48 "pand %%mm4, %%mm0\n\t" //0Y0Y0Y0Y | |
49 "psrlw $8, %%mm1\n\t" //0Y0Y0Y0Y | |
50 "movq %1, %%mm2\n\t" //srca HGFEDCBA | |
51 "paddb bFF, %%mm2\n\t" | |
52 "movq %%mm2, %%mm3\n\t" | |
53 "pand %%mm4, %%mm2\n\t" //0G0E0C0A | |
54 "psrlw $8, %%mm3\n\t" //0H0F0D0B | |
55 "pmullw %%mm2, %%mm0\n\t" | |
56 "pmullw %%mm3, %%mm1\n\t" | |
57 "psrlw $8, %%mm0\n\t" | |
58 "pand %%mm5, %%mm1\n\t" | |
59 "por %%mm1, %%mm0\n\t" | |
60 "paddb %2, %%mm0\n\t" | |
61 "movq %%mm0, %0\n\t" | |
62 "1:\n\t" | |
63 :: "m" (dstbase[x]), "m" (srca[x]), "m" (src[x]) | |
64 : "%eax"); | |
65 } | |
66 #else | |
326 | 67 for(x=0;x<w;x++){ |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
68 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
69 if(srca[2*x+0]) dstbase[2*x+0]=src[2*x+0]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
70 if(srca[2*x+1]) dstbase[2*x+1]=src[2*x+1]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
71 #else |
326 | 72 if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x]; |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
73 #endif |
326 | 74 } |
2846 | 75 #endif |
326 | 76 src+=srcstride; |
77 srca+=srcstride; | |
78 dstbase+=dststride; | |
79 } | |
2846 | 80 #ifdef HAVE_MMX |
81 asm volatile(EMMS:::"memory"); | |
82 #endif | |
83 PROFILE_END("vo_draw_alpha_yv12"); | |
326 | 84 return; |
85 } | |
86 | |
87 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
88 int y; | |
2846 | 89 #if defined(FAST_OSD) && !defined(HAVE_MMX) |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
90 w=w>>1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
91 #endif |
2846 | 92 PROFILE_START(); |
326 | 93 for(y=0;y<h;y++){ |
94 register int x; | |
2846 | 95 #ifdef HAVE_MMX |
96 asm volatile( | |
97 PREFETCHW" %0\n\t" | |
98 PREFETCH" %1\n\t" | |
99 PREFETCH" %2\n\t" | |
100 "pxor %%mm7, %%mm7\n\t" | |
101 "pcmpeqb %%mm5, %%mm5\n\t" // F..F | |
102 "movq %%mm5, %%mm4\n\t" | |
103 "psllw $8, %%mm5\n\t" //FF00FF00FF00 | |
104 "psrlw $8, %%mm4\n\t" //00FF00FF00FF | |
105 ::"m"(*dstbase),"m"(*srca),"m"(*src)); | |
106 for(x=0;x<w;x+=4){ | |
107 asm volatile( | |
108 "movl %1, %%eax\n\t" | |
109 "orl %%eax, %%eax\n\t" | |
110 " jz 1f\n\t" | |
111 PREFETCHW" 32%0\n\t" | |
112 PREFETCH" 32%1\n\t" | |
113 PREFETCH" 32%2\n\t" | |
114 "movq %0, %%mm0\n\t" // dstbase | |
115 "movq %%mm0, %%mm1\n\t" | |
116 "pand %%mm4, %%mm0\n\t" //0Y0Y0Y0Y | |
117 "movd %%eax, %%mm2\n\t" //srca 0000DCBA | |
118 "paddb bFF, %%mm2\n\t" | |
119 "punpcklbw %%mm7, %%mm2\n\t" //srca 0D0C0B0A | |
120 "pmullw %%mm2, %%mm0\n\t" | |
121 "psrlw $8, %%mm0\n\t" | |
122 "pand %%mm5, %%mm1\n\t" //U0V0U0V0 | |
123 "movd %2, %%mm2\n\t" //src 0000DCBA | |
124 "punpcklbw %%mm7, %%mm2\n\t" //srca 0D0C0B0A | |
125 "por %%mm1, %%mm0\n\t" | |
126 "paddb %%mm2, %%mm0\n\t" | |
127 "movq %%mm0, %0\n\t" | |
128 "1:\n\t" | |
129 :: "m" (dstbase[x*2]), "m" (srca[x]), "m" (src[x]) | |
130 : "%eax"); | |
131 } | |
132 #else | |
326 | 133 for(x=0;x<w;x++){ |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
134 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
135 if(srca[2*x+0]) dstbase[4*x+0]=src[2*x+0]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
136 if(srca[2*x+1]) dstbase[4*x+2]=src[2*x+1]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
137 #else |
326 | 138 if(srca[x]) dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x]; |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
139 #endif |
326 | 140 } |
2846 | 141 #endif |
142 src+=srcstride; | |
326 | 143 srca+=srcstride; |
144 dstbase+=dststride; | |
145 } | |
2846 | 146 #ifdef HAVE_MMX |
147 asm volatile(EMMS:::"memory"); | |
148 #endif | |
149 PROFILE_END("vo_draw_alpha_yuy2"); | |
326 | 150 return; |
151 } | |
152 | |
2839 | 153 #ifdef HAVE_MMX |
154 static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL; | |
155 static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; | |
156 #endif | |
326 | 157 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
158 int y; | |
159 for(y=0;y<h;y++){ | |
160 register unsigned char *dst = dstbase; | |
161 register int x; | |
2839 | 162 #ifdef ARCH_X86 |
163 #ifdef HAVE_MMX | |
164 asm volatile( | |
165 PREFETCHW" %0\n\t" | |
166 PREFETCH" %1\n\t" | |
167 PREFETCH" %2\n\t" | |
168 "pxor %%mm7, %%mm7\n\t" | |
169 "pcmpeqb %%mm6, %%mm6\n\t" // F..F | |
170 ::"m"(*dst),"m"(*srca),"m"(*src):"memory"); | |
171 for(x=0;x<w;x+=2){ | |
2843 | 172 if(srca[x] || srca[x+1]) |
2839 | 173 asm volatile( |
174 PREFETCHW" 32%0\n\t" | |
175 PREFETCH" 32%1\n\t" | |
176 PREFETCH" 32%2\n\t" | |
177 "movq %0, %%mm0\n\t" // dstbase | |
178 "movq %%mm0, %%mm1\n\t" | |
179 "movq %%mm0, %%mm5\n\t" | |
180 "punpcklbw %%mm7, %%mm0\n\t" | |
181 "punpckhbw %%mm7, %%mm1\n\t" | |
182 "movd %1, %%mm2\n\t" // srca ABCD0000 | |
183 "paddb %%mm6, %%mm2\n\t" | |
184 "punpcklbw %%mm2, %%mm2\n\t" // srca AABBCCDD | |
185 "punpcklbw %%mm2, %%mm2\n\t" // srca AAAABBBB | |
186 "movq %%mm2, %%mm3\n\t" | |
187 "punpcklbw %%mm7, %%mm2\n\t" // srca 0A0A0A0A | |
188 "punpckhbw %%mm7, %%mm3\n\t" // srca 0B0B0B0B | |
189 "pmullw %%mm2, %%mm0\n\t" | |
190 "pmullw %%mm3, %%mm1\n\t" | |
191 "psrlw $8, %%mm0\n\t" | |
192 "psrlw $8, %%mm1\n\t" | |
193 "packuswb %%mm1, %%mm0\n\t" | |
194 "movd %2, %%mm2 \n\t" // src ABCD0000 | |
195 "punpcklbw %%mm2, %%mm2\n\t" // src AABBCCDD | |
196 "punpcklbw %%mm2, %%mm2\n\t" // src AAAABBBB | |
197 "paddb %%mm2, %%mm0\n\t" | |
198 "pand %4, %%mm5\n\t" | |
199 "pand %3, %%mm0\n\t" | |
200 "por %%mm0, %%mm5\n\t" | |
201 "movq %%mm5, %0\n\t" | |
202 :: "m" (dst[0]), "m" (srca[x]), "m" (src[x]), "m"(mask24hl), "m"(mask24lh)); | |
203 dst += 6; | |
204 } | |
205 #else /* HAVE_MMX */ | |
206 for(x=0;x<w;x++){ | |
207 if(srca[x]){ | |
208 asm volatile( | |
209 "movzbl (%0), %%ecx\n\t" | |
210 "movzbl 1(%0), %%eax\n\t" | |
211 "movzbl 2(%0), %%edx\n\t" | |
212 | |
213 "imull %1, %%ecx\n\t" | |
214 "imull %1, %%eax\n\t" | |
215 "imull %1, %%edx\n\t" | |
216 | |
217 "addl %2, %%ecx\n\t" | |
218 "addl %2, %%eax\n\t" | |
219 "addl %2, %%edx\n\t" | |
220 | |
221 "movb %%ch, (%0)\n\t" | |
222 "movb %%ah, 1(%0)\n\t" | |
223 "movb %%dh, 2(%0)\n\t" | |
224 | |
225 : | |
226 :"r" (dst), | |
227 "r" ((unsigned)srca[x]), | |
228 "r" (((unsigned)src[x])<<8) | |
229 :"%eax", "%ecx", "%edx" | |
230 ); | |
231 } | |
232 dst += 3; | |
233 } | |
234 #endif /* HAVE_MMX */ | |
235 #else /*non x86 arch*/ | |
326 | 236 for(x=0;x<w;x++){ |
237 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
238 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
239 dst[0]=dst[1]=dst[2]=src[x]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
240 #else |
326 | 241 dst[0]=((dst[0]*srca[x])>>8)+src[x]; |
242 dst[1]=((dst[1]*srca[x])>>8)+src[x]; | |
243 dst[2]=((dst[2]*srca[x])>>8)+src[x]; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
244 #endif |
326 | 245 } |
246 dst+=3; // 24bpp | |
247 } | |
2839 | 248 #endif /* arch_x86 */ |
326 | 249 src+=srcstride; |
250 srca+=srcstride; | |
251 dstbase+=dststride; | |
252 } | |
2839 | 253 #ifdef HAVE_MMX |
254 asm volatile(EMMS:::"memory"); | |
255 #endif | |
326 | 256 return; |
257 } | |
258 | |
259 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
260 int y; | |
2833 | 261 PROFILE_START(); |
326 | 262 for(y=0;y<h;y++){ |
263 register int x; | |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
264 #ifdef ARCH_X86 |
2833 | 265 #ifdef HAVE_MMX |
2846 | 266 #ifdef HAVE_3DNOW |
2835 | 267 asm volatile( |
268 PREFETCHW" %0\n\t" | |
269 PREFETCH" %1\n\t" | |
270 PREFETCH" %2\n\t" | |
271 "pxor %%mm7, %%mm7\n\t" | |
272 "pcmpeqb %%mm6, %%mm6\n\t" // F..F | |
2839 | 273 ::"m"(*dstbase),"m"(*srca),"m"(*src):"memory"); |
2835 | 274 for(x=0;x<w;x+=2){ |
2843 | 275 if(srca[x] || srca[x+1]) |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
276 asm volatile( |
2835 | 277 PREFETCHW" 32%0\n\t" |
278 PREFETCH" 32%1\n\t" | |
279 PREFETCH" 32%2\n\t" | |
280 "movq %0, %%mm0\n\t" // dstbase | |
281 "movq %%mm0, %%mm1\n\t" | |
282 "punpcklbw %%mm7, %%mm0\n\t" | |
283 "punpckhbw %%mm7, %%mm1\n\t" | |
284 "movd %1, %%mm2\n\t" // srca ABCD0000 | |
285 "paddb %%mm6, %%mm2\n\t" | |
286 "punpcklbw %%mm2, %%mm2\n\t" // srca AABBCCDD | |
287 "punpcklbw %%mm2, %%mm2\n\t" // srca AAAABBBB | |
288 "movq %%mm2, %%mm3\n\t" | |
289 "punpcklbw %%mm7, %%mm2\n\t" // srca 0A0A0A0A | |
290 "punpckhbw %%mm7, %%mm3\n\t" // srca 0B0B0B0B | |
291 "pmullw %%mm2, %%mm0\n\t" | |
292 "pmullw %%mm3, %%mm1\n\t" | |
293 "psrlw $8, %%mm0\n\t" | |
294 "psrlw $8, %%mm1\n\t" | |
295 "packuswb %%mm1, %%mm0\n\t" | |
296 "movd %2, %%mm2 \n\t" // src ABCD0000 | |
297 "punpcklbw %%mm2, %%mm2\n\t" // src AABBCCDD | |
298 "punpcklbw %%mm2, %%mm2\n\t" // src AAAABBBB | |
299 "paddb %%mm2, %%mm0\n\t" | |
300 "movq %%mm0, %0\n\t" | |
301 :: "m" (dstbase[4*x]), "m" (srca[x]), "m" (src[x])); | |
302 } | |
2846 | 303 #else //this is faster for intels crap |
304 asm volatile( | |
305 PREFETCHW" %0\n\t" | |
306 PREFETCH" %1\n\t" | |
307 PREFETCH" %2\n\t" | |
308 "pxor %%mm7, %%mm7\n\t" | |
309 "pcmpeqb %%mm5, %%mm5\n\t" // F..F | |
310 "movq %%mm5, %%mm4\n\t" | |
311 "psllw $8, %%mm5\n\t" //FF00FF00FF00 | |
312 "psrlw $8, %%mm4\n\t" //00FF00FF00FF | |
313 ::"m"(*dstbase),"m"(*srca),"m"(*src):"memory"); | |
314 for(x=0;x<w;x+=4){ | |
315 asm volatile( | |
316 "movl %1, %%eax\n\t" | |
317 "orl %%eax, %%eax\n\t" | |
318 " jz 1f\n\t" | |
319 PREFETCHW" 32%0\n\t" | |
320 PREFETCH" 32%1\n\t" | |
321 PREFETCH" 32%2\n\t" | |
322 "movq %0, %%mm0\n\t" // dstbase | |
323 "movq %%mm0, %%mm1\n\t" | |
324 "pand %%mm4, %%mm0\n\t" //0R0B0R0B | |
325 "psrlw $8, %%mm1\n\t" //0?0G0?0G | |
326 "movd %%eax, %%mm2\n\t" //srca 0000DCBA | |
327 "paddb bFF, %%mm2\n\t" | |
328 "punpcklbw %%mm2, %%mm2\n\t" //srca DDCCBBAA | |
329 "movq %%mm2, %%mm3\n\t" | |
330 "punpcklbw %%mm7, %%mm2\n\t" //srca 0B0B0A0A | |
331 "pmullw %%mm2, %%mm0\n\t" | |
332 "pmullw %%mm2, %%mm1\n\t" | |
333 "psrlw $8, %%mm0\n\t" | |
334 "pand %%mm5, %%mm1\n\t" | |
335 "por %%mm1, %%mm0\n\t" | |
336 "movd %2, %%mm2 \n\t" //src 0000DCBA | |
337 "punpcklbw %%mm2, %%mm2\n\t" //src DDCCBBAA | |
338 "movq %%mm2, %%mm6\n\t" | |
339 "punpcklbw %%mm2, %%mm2\n\t" //src BBBBAAAA | |
340 "paddb %%mm2, %%mm0\n\t" | |
341 "movq %%mm0, %0\n\t" | |
342 | |
343 "movq 8%0, %%mm0\n\t" // dstbase | |
344 "movq %%mm0, %%mm1\n\t" | |
345 "pand %%mm4, %%mm0\n\t" //0R0B0R0B | |
346 "psrlw $8, %%mm1\n\t" //0?0G0?0G | |
347 "punpckhbw %%mm7, %%mm3\n\t" //srca 0D0D0C0C | |
348 "pmullw %%mm3, %%mm0\n\t" | |
349 "pmullw %%mm3, %%mm1\n\t" | |
350 "psrlw $8, %%mm0\n\t" | |
351 "pand %%mm5, %%mm1\n\t" | |
352 "por %%mm1, %%mm0\n\t" | |
353 "punpckhbw %%mm6, %%mm6\n\t" //src DDDDCCCC | |
354 "paddb %%mm6, %%mm0\n\t" | |
355 "movq %%mm0, 8%0\n\t" | |
356 "1:\n\t" | |
357 :: "m" (dstbase[4*x]), "m" (srca[x]), "m" (src[x]) | |
358 : "%eax"); | |
359 } | |
360 #endif | |
2839 | 361 #else /* HAVE_MMX */ |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
362 for(x=0;x<w;x++){ |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
363 if(srca[x]){ |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
364 asm volatile( |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
365 "movzbl (%0), %%ecx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
366 "movzbl 1(%0), %%eax\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
367 "movzbl 2(%0), %%edx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
368 |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
369 "imull %1, %%ecx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
370 "imull %1, %%eax\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
371 "imull %1, %%edx\n\t" |
2578 | 372 |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
373 "addl %2, %%ecx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
374 "addl %2, %%eax\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
375 "addl %2, %%edx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
376 |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
377 "movb %%ch, (%0)\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
378 "movb %%ah, 1(%0)\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
379 "movb %%dh, 2(%0)\n\t" |
2578 | 380 |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
381 : |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
382 :"r" (&dstbase[4*x]), |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
383 "r" ((unsigned)srca[x]), |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
384 "r" (((unsigned)src[x])<<8) |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
385 :"%eax", "%ecx", "%edx" |
2578 | 386 ); |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
387 } |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
388 } |
2839 | 389 #endif /* HAVE_MMX */ |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
390 #else /*non x86 arch*/ |
326 | 391 for(x=0;x<w;x++){ |
392 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
393 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
394 dstbase[4*x+0]=dstbase[4*x+1]=dstbase[4*x+2]=src[x]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
395 #else |
326 | 396 dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x]; |
397 dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x]; | |
398 dstbase[4*x+2]=((dstbase[4*x+2]*srca[x])>>8)+src[x]; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
399 #endif |
326 | 400 } |
401 } | |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
402 #endif /* arch_x86 */ |
326 | 403 src+=srcstride; |
404 srca+=srcstride; | |
405 dstbase+=dststride; | |
406 } | |
2833 | 407 #ifdef HAVE_MMX |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
408 asm volatile(EMMS:::"memory"); |
2578 | 409 #endif |
2833 | 410 PROFILE_END("vo_draw_alpha_rgb32"); |
326 | 411 return; |
412 } | |
413 | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
414 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
415 static unsigned short fast_osd_15bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
416 static unsigned short fast_osd_16bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
417 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
418 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
419 void vo_draw_alpha_init(){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
420 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
421 int i; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
422 for(i=0;i<256;i++){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
423 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
|
424 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
|
425 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
426 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
427 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
428 |
326 | 429 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
430 int y; | |
431 for(y=0;y<h;y++){ | |
432 register unsigned short *dst = (unsigned short*) dstbase; | |
433 register int x; | |
434 for(x=0;x<w;x++){ | |
435 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
436 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
437 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
438 dst[x]=fast_osd_15bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
439 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
440 register unsigned int a=src[x]>>3; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
441 dst[x]=(a<<10)|(a<<5)|a; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
442 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
443 #else |
326 | 444 unsigned char r=dst[x]&0x1F; |
445 unsigned char g=(dst[x]>>5)&0x1F; | |
446 unsigned char b=(dst[x]>>10)&0x1F; | |
447 r=(((r*srca[x])>>5)+src[x])>>3; | |
448 g=(((g*srca[x])>>5)+src[x])>>3; | |
449 b=(((b*srca[x])>>5)+src[x])>>3; | |
450 dst[x]=(b<<10)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
451 #endif |
326 | 452 } |
453 } | |
454 src+=srcstride; | |
455 srca+=srcstride; | |
456 dstbase+=dststride; | |
457 } | |
458 return; | |
459 } | |
460 | |
461 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
462 int y; | |
463 for(y=0;y<h;y++){ | |
464 register unsigned short *dst = (unsigned short*) dstbase; | |
465 register int x; | |
466 for(x=0;x<w;x++){ | |
467 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
468 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
469 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
470 dst[x]=fast_osd_16bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
471 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
472 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
|
473 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
474 #else |
326 | 475 unsigned char r=dst[x]&0x1F; |
476 unsigned char g=(dst[x]>>5)&0x3F; | |
477 unsigned char b=(dst[x]>>11)&0x1F; | |
478 r=(((r*srca[x])>>5)+src[x])>>3; | |
479 g=(((g*srca[x])>>6)+src[x])>>2; | |
480 b=(((b*srca[x])>>5)+src[x])>>3; | |
481 dst[x]=(b<<11)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
482 #endif |
326 | 483 } |
484 } | |
485 src+=srcstride; | |
486 srca+=srcstride; | |
487 dstbase+=dststride; | |
488 } | |
489 return; | |
490 } | |
491 |