Mercurial > mplayer.hg
annotate libvo/osd.c @ 2839:03ccbb72e2e9
Cloning 32 stuff to 24
author | nick |
---|---|
date | Sun, 11 Nov 2001 16:09:19 +0000 |
parents | 86fdf7897315 |
children | 5be2017077fb |
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) | |
3 | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
4 //#define FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
5 //#define FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
6 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
7 #include "config.h" |
622 | 8 #include "osd.h" |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
9 #include "../mmx_defs.h" |
2833 | 10 //#define ENABLE_PROFILE |
11 #include "../my_profile.h" | |
622 | 12 |
326 | 13 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
14 int y; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
15 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
16 w=w>>1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
17 #endif |
326 | 18 for(y=0;y<h;y++){ |
19 register int x; | |
20 for(x=0;x<w;x++){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
21 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
22 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
|
23 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
|
24 #else |
326 | 25 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
|
26 #endif |
326 | 27 } |
28 src+=srcstride; | |
29 srca+=srcstride; | |
30 dstbase+=dststride; | |
31 } | |
32 return; | |
33 } | |
34 | |
35 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
36 int y; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
37 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
38 w=w>>1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
39 #endif |
326 | 40 for(y=0;y<h;y++){ |
41 register int x; | |
42 for(x=0;x<w;x++){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
43 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
44 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
|
45 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
|
46 #else |
326 | 47 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
|
48 #endif |
326 | 49 } |
50 src+=srcstride; | |
51 srca+=srcstride; | |
52 dstbase+=dststride; | |
53 } | |
54 return; | |
55 } | |
56 | |
2839 | 57 #ifdef HAVE_MMX |
58 static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL; | |
59 static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; | |
60 #endif | |
326 | 61 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
62 int y; | |
63 for(y=0;y<h;y++){ | |
64 register unsigned char *dst = dstbase; | |
65 register int x; | |
2839 | 66 #ifdef ARCH_X86 |
67 #ifdef HAVE_MMX | |
68 asm volatile( | |
69 PREFETCHW" %0\n\t" | |
70 PREFETCH" %1\n\t" | |
71 PREFETCH" %2\n\t" | |
72 "pxor %%mm7, %%mm7\n\t" | |
73 "pcmpeqb %%mm6, %%mm6\n\t" // F..F | |
74 ::"m"(*dst),"m"(*srca),"m"(*src):"memory"); | |
75 for(x=0;x<w;x+=2){ | |
76 asm volatile( | |
77 PREFETCHW" 32%0\n\t" | |
78 PREFETCH" 32%1\n\t" | |
79 PREFETCH" 32%2\n\t" | |
80 "movq %0, %%mm0\n\t" // dstbase | |
81 "movq %%mm0, %%mm1\n\t" | |
82 "movq %%mm0, %%mm5\n\t" | |
83 "punpcklbw %%mm7, %%mm0\n\t" | |
84 "punpckhbw %%mm7, %%mm1\n\t" | |
85 "movd %1, %%mm2\n\t" // srca ABCD0000 | |
86 "paddb %%mm6, %%mm2\n\t" | |
87 "punpcklbw %%mm2, %%mm2\n\t" // srca AABBCCDD | |
88 "punpcklbw %%mm2, %%mm2\n\t" // srca AAAABBBB | |
89 "movq %%mm2, %%mm3\n\t" | |
90 "punpcklbw %%mm7, %%mm2\n\t" // srca 0A0A0A0A | |
91 "punpckhbw %%mm7, %%mm3\n\t" // srca 0B0B0B0B | |
92 "pmullw %%mm2, %%mm0\n\t" | |
93 "pmullw %%mm3, %%mm1\n\t" | |
94 "psrlw $8, %%mm0\n\t" | |
95 "psrlw $8, %%mm1\n\t" | |
96 "packuswb %%mm1, %%mm0\n\t" | |
97 "movd %2, %%mm2 \n\t" // src ABCD0000 | |
98 "punpcklbw %%mm2, %%mm2\n\t" // src AABBCCDD | |
99 "punpcklbw %%mm2, %%mm2\n\t" // src AAAABBBB | |
100 "paddb %%mm2, %%mm0\n\t" | |
101 "pand %4, %%mm5\n\t" | |
102 "pand %3, %%mm0\n\t" | |
103 "por %%mm0, %%mm5\n\t" | |
104 "movq %%mm5, %0\n\t" | |
105 :: "m" (dst[0]), "m" (srca[x]), "m" (src[x]), "m"(mask24hl), "m"(mask24lh)); | |
106 dst += 6; | |
107 } | |
108 #else /* HAVE_MMX */ | |
109 for(x=0;x<w;x++){ | |
110 if(srca[x]){ | |
111 asm volatile( | |
112 "movzbl (%0), %%ecx\n\t" | |
113 "movzbl 1(%0), %%eax\n\t" | |
114 "movzbl 2(%0), %%edx\n\t" | |
115 | |
116 "imull %1, %%ecx\n\t" | |
117 "imull %1, %%eax\n\t" | |
118 "imull %1, %%edx\n\t" | |
119 | |
120 "addl %2, %%ecx\n\t" | |
121 "addl %2, %%eax\n\t" | |
122 "addl %2, %%edx\n\t" | |
123 | |
124 "movb %%ch, (%0)\n\t" | |
125 "movb %%ah, 1(%0)\n\t" | |
126 "movb %%dh, 2(%0)\n\t" | |
127 | |
128 : | |
129 :"r" (dst), | |
130 "r" ((unsigned)srca[x]), | |
131 "r" (((unsigned)src[x])<<8) | |
132 :"%eax", "%ecx", "%edx" | |
133 ); | |
134 } | |
135 dst += 3; | |
136 } | |
137 #endif /* HAVE_MMX */ | |
138 #else /*non x86 arch*/ | |
326 | 139 for(x=0;x<w;x++){ |
140 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
141 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
142 dst[0]=dst[1]=dst[2]=src[x]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
143 #else |
326 | 144 dst[0]=((dst[0]*srca[x])>>8)+src[x]; |
145 dst[1]=((dst[1]*srca[x])>>8)+src[x]; | |
146 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
|
147 #endif |
326 | 148 } |
149 dst+=3; // 24bpp | |
150 } | |
2839 | 151 #endif /* arch_x86 */ |
326 | 152 src+=srcstride; |
153 srca+=srcstride; | |
154 dstbase+=dststride; | |
155 } | |
2839 | 156 #ifdef HAVE_MMX |
157 asm volatile(EMMS:::"memory"); | |
158 #endif | |
326 | 159 return; |
160 } | |
161 | |
162 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
163 int y; | |
2833 | 164 PROFILE_START(); |
326 | 165 for(y=0;y<h;y++){ |
166 register int x; | |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
167 #ifdef ARCH_X86 |
2833 | 168 #ifdef HAVE_MMX |
2835 | 169 asm volatile( |
170 PREFETCHW" %0\n\t" | |
171 PREFETCH" %1\n\t" | |
172 PREFETCH" %2\n\t" | |
173 "pxor %%mm7, %%mm7\n\t" | |
174 "pcmpeqb %%mm6, %%mm6\n\t" // F..F | |
2839 | 175 ::"m"(*dstbase),"m"(*srca),"m"(*src):"memory"); |
2835 | 176 for(x=0;x<w;x+=2){ |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
177 asm volatile( |
2835 | 178 PREFETCHW" 32%0\n\t" |
179 PREFETCH" 32%1\n\t" | |
180 PREFETCH" 32%2\n\t" | |
181 "movq %0, %%mm0\n\t" // dstbase | |
182 "movq %%mm0, %%mm1\n\t" | |
183 "punpcklbw %%mm7, %%mm0\n\t" | |
184 "punpckhbw %%mm7, %%mm1\n\t" | |
185 "movd %1, %%mm2\n\t" // srca ABCD0000 | |
186 "paddb %%mm6, %%mm2\n\t" | |
187 "punpcklbw %%mm2, %%mm2\n\t" // srca AABBCCDD | |
188 "punpcklbw %%mm2, %%mm2\n\t" // srca AAAABBBB | |
189 "movq %%mm2, %%mm3\n\t" | |
190 "punpcklbw %%mm7, %%mm2\n\t" // srca 0A0A0A0A | |
191 "punpckhbw %%mm7, %%mm3\n\t" // srca 0B0B0B0B | |
192 "pmullw %%mm2, %%mm0\n\t" | |
193 "pmullw %%mm3, %%mm1\n\t" | |
194 "psrlw $8, %%mm0\n\t" | |
195 "psrlw $8, %%mm1\n\t" | |
196 "packuswb %%mm1, %%mm0\n\t" | |
197 "movd %2, %%mm2 \n\t" // src ABCD0000 | |
198 "punpcklbw %%mm2, %%mm2\n\t" // src AABBCCDD | |
199 "punpcklbw %%mm2, %%mm2\n\t" // src AAAABBBB | |
200 "paddb %%mm2, %%mm0\n\t" | |
201 "movq %%mm0, %0\n\t" | |
202 :: "m" (dstbase[4*x]), "m" (srca[x]), "m" (src[x])); | |
203 } | |
2839 | 204 #else /* HAVE_MMX */ |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
205 for(x=0;x<w;x++){ |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
206 if(srca[x]){ |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
207 asm volatile( |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
208 "movzbl (%0), %%ecx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
209 "movzbl 1(%0), %%eax\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
210 "movzbl 2(%0), %%edx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
211 |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
212 "imull %1, %%ecx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
213 "imull %1, %%eax\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
214 "imull %1, %%edx\n\t" |
2578 | 215 |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
216 "addl %2, %%ecx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
217 "addl %2, %%eax\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
218 "addl %2, %%edx\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
219 |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
220 "movb %%ch, (%0)\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
221 "movb %%ah, 1(%0)\n\t" |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
222 "movb %%dh, 2(%0)\n\t" |
2578 | 223 |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
224 : |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
225 :"r" (&dstbase[4*x]), |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
226 "r" ((unsigned)srca[x]), |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
227 "r" (((unsigned)src[x])<<8) |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
228 :"%eax", "%ecx", "%edx" |
2578 | 229 ); |
2823
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
230 } |
004ee19ebfcf
Extract parallelism from OSD stuff + MMX2 optimization.
nick
parents:
2807
diff
changeset
|
231 } |
2839 | 232 #endif /* HAVE_MMX */ |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
233 #else /*non x86 arch*/ |
326 | 234 for(x=0;x<w;x++){ |
235 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
236 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
237 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
|
238 #else |
326 | 239 dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x]; |
240 dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x]; | |
241 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
|
242 #endif |
326 | 243 } |
244 } | |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
245 #endif /* arch_x86 */ |
326 | 246 src+=srcstride; |
247 srca+=srcstride; | |
248 dstbase+=dststride; | |
249 } | |
2833 | 250 #ifdef HAVE_MMX |
2798
ee2cd36a81a2
Code cleanup - emms is not required when MMX block is commented out.
nick
parents:
2578
diff
changeset
|
251 asm volatile(EMMS:::"memory"); |
2578 | 252 #endif |
2833 | 253 PROFILE_END("vo_draw_alpha_rgb32"); |
326 | 254 return; |
255 } | |
256 | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
257 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
258 static unsigned short fast_osd_15bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
259 static unsigned short fast_osd_16bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
260 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
261 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
262 void vo_draw_alpha_init(){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
263 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
264 int i; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
265 for(i=0;i<256;i++){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
266 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
|
267 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
|
268 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
269 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
270 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
271 |
326 | 272 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
273 int y; | |
274 for(y=0;y<h;y++){ | |
275 register unsigned short *dst = (unsigned short*) dstbase; | |
276 register int x; | |
277 for(x=0;x<w;x++){ | |
278 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
279 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
280 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
281 dst[x]=fast_osd_15bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
282 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
283 register unsigned int a=src[x]>>3; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
284 dst[x]=(a<<10)|(a<<5)|a; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
285 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
286 #else |
326 | 287 unsigned char r=dst[x]&0x1F; |
288 unsigned char g=(dst[x]>>5)&0x1F; | |
289 unsigned char b=(dst[x]>>10)&0x1F; | |
290 r=(((r*srca[x])>>5)+src[x])>>3; | |
291 g=(((g*srca[x])>>5)+src[x])>>3; | |
292 b=(((b*srca[x])>>5)+src[x])>>3; | |
293 dst[x]=(b<<10)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
294 #endif |
326 | 295 } |
296 } | |
297 src+=srcstride; | |
298 srca+=srcstride; | |
299 dstbase+=dststride; | |
300 } | |
301 return; | |
302 } | |
303 | |
304 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
305 int y; | |
306 for(y=0;y<h;y++){ | |
307 register unsigned short *dst = (unsigned short*) dstbase; | |
308 register int x; | |
309 for(x=0;x<w;x++){ | |
310 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
311 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
312 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
313 dst[x]=fast_osd_16bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
314 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
315 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
|
316 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
317 #else |
326 | 318 unsigned char r=dst[x]&0x1F; |
319 unsigned char g=(dst[x]>>5)&0x3F; | |
320 unsigned char b=(dst[x]>>11)&0x1F; | |
321 r=(((r*srca[x])>>5)+src[x])>>3; | |
322 g=(((g*srca[x])>>6)+src[x])>>2; | |
323 b=(((b*srca[x])>>5)+src[x])>>3; | |
324 dst[x]=(b<<11)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
325 #endif |
326 | 326 } |
327 } | |
328 src+=srcstride; | |
329 srca+=srcstride; | |
330 dstbase+=dststride; | |
331 } | |
332 return; | |
333 } | |
334 |