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