Mercurial > mplayer.hg
annotate libvo/osd.c @ 16089:c6dbeb57bc71
new file, synced with 1.4
author | gabrov |
---|---|
date | Mon, 25 Jul 2005 14:52:24 +0000 |
parents | e047e70a9767 |
children | f580a7755ac5 |
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) | |
3142 | 3 // Templating Code from Michael Niedermayer (michaelni@gmx.at) is under GPL |
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" |
5935 | 10 #include "mp_msg.h" |
2846 | 11 #include <inttypes.h> |
13787
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13720
diff
changeset
|
12 #include "cpudetect.h" |
e047e70a9767
Handle "xxx.h" vs "../xxx.h" include paths in a consistent way.
diego
parents:
13720
diff
changeset
|
13 #include "mangle.h" |
2846 | 14 |
3142 | 15 extern int verbose; // defined in mplayer.c |
16 | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
17 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3142 | 18 #define CAN_COMPILE_X86_ASM |
2846 | 19 #endif |
622 | 20 |
3142 | 21 #ifdef CAN_COMPILE_X86_ASM |
12292 | 22 static const uint64_t bFF attribute_used __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; |
2839 | 23 static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL; |
24 static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; | |
25 #endif | |
3142 | 26 |
27 //Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | |
28 //Plain C versions | |
3153 | 29 #if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT) |
30 #define COMPILE_C | |
31 #endif | |
32 | |
33 #ifdef CAN_COMPILE_X86_ASM | |
34 | |
35 #if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) | |
36 #define COMPILE_MMX | |
37 #endif | |
38 | |
39 #if defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT) | |
40 #define COMPILE_MMX2 | |
41 #endif | |
42 | |
43 #if (defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) | |
44 #define COMPILE_3DNOW | |
45 #endif | |
46 #endif //CAN_COMPILE_X86_ASM | |
47 | |
48 #undef HAVE_MMX | |
49 #undef HAVE_MMX2 | |
50 #undef HAVE_3DNOW | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
51 |
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
52 #ifndef CAN_COMPILE_X86_ASM |
3153 | 53 |
54 #ifdef COMPILE_C | |
3142 | 55 #undef HAVE_MMX |
56 #undef HAVE_MMX2 | |
57 #undef HAVE_3DNOW | |
58 #define RENAME(a) a ## _C | |
59 #include "osd_template.c" | |
3153 | 60 #endif |
3142 | 61 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
62 #else |
3142 | 63 |
64 //X86 noMMX versions | |
3153 | 65 #ifdef COMPILE_C |
3142 | 66 #undef RENAME |
67 #undef HAVE_MMX | |
68 #undef HAVE_MMX2 | |
69 #undef HAVE_3DNOW | |
70 #define RENAME(a) a ## _X86 | |
71 #include "osd_template.c" | |
3153 | 72 #endif |
3142 | 73 |
74 //MMX versions | |
3153 | 75 #ifdef COMPILE_MMX |
3142 | 76 #undef RENAME |
77 #define HAVE_MMX | |
78 #undef HAVE_MMX2 | |
79 #undef HAVE_3DNOW | |
80 #define RENAME(a) a ## _MMX | |
81 #include "osd_template.c" | |
3153 | 82 #endif |
3142 | 83 |
84 //MMX2 versions | |
3153 | 85 #ifdef COMPILE_MMX2 |
3142 | 86 #undef RENAME |
87 #define HAVE_MMX | |
88 #define HAVE_MMX2 | |
89 #undef HAVE_3DNOW | |
90 #define RENAME(a) a ## _MMX2 | |
91 #include "osd_template.c" | |
3153 | 92 #endif |
3142 | 93 |
94 //3DNOW versions | |
3153 | 95 #ifdef COMPILE_3DNOW |
3142 | 96 #undef RENAME |
97 #define HAVE_MMX | |
98 #undef HAVE_MMX2 | |
99 #define HAVE_3DNOW | |
100 #define RENAME(a) a ## _3DNow | |
101 #include "osd_template.c" | |
3153 | 102 #endif |
3142 | 103 |
104 #endif //CAN_COMPILE_X86_ASM | |
105 | |
106 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
3153 | 107 #ifdef RUNTIME_CPUDETECT |
3142 | 108 #ifdef CAN_COMPILE_X86_ASM |
12516 | 109 // ordered by speed / fastest first |
3142 | 110 if(gCpuCaps.hasMMX2) |
111 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
112 else if(gCpuCaps.has3DNow) | |
113 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
114 else if(gCpuCaps.hasMMX) | |
115 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
116 else | |
117 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
118 #else | |
119 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); | |
120 #endif | |
3153 | 121 #else //RUNTIME_CPUDETECT |
122 #ifdef HAVE_MMX2 | |
123 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
124 #elif defined (HAVE_3DNOW) | |
125 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
126 #elif defined (HAVE_MMX) | |
127 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
128 #elif defined(ARCH_X86) || defined(ARCH_X86_64) |
3153 | 129 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); |
130 #else | |
131 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); | |
132 #endif | |
133 #endif //!RUNTIME_CPUDETECT | |
3142 | 134 } |
135 | |
136 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
3153 | 137 #ifdef RUNTIME_CPUDETECT |
3142 | 138 #ifdef CAN_COMPILE_X86_ASM |
12516 | 139 // ordered by speed / fastest first |
3142 | 140 if(gCpuCaps.hasMMX2) |
141 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
142 else if(gCpuCaps.has3DNow) | |
143 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
144 else if(gCpuCaps.hasMMX) | |
145 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
146 else | |
147 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
148 #else | |
149 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); | |
150 #endif | |
3153 | 151 #else //RUNTIME_CPUDETECT |
152 #ifdef HAVE_MMX2 | |
153 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
154 #elif defined (HAVE_3DNOW) | |
155 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
156 #elif defined (HAVE_MMX) | |
157 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
158 #elif defined(ARCH_X86) || defined(ARCH_X86_64) |
3153 | 159 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); |
160 #else | |
161 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); | |
162 #endif | |
163 #endif //!RUNTIME_CPUDETECT | |
3142 | 164 } |
165 | |
12516 | 166 void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
167 #ifdef RUNTIME_CPUDETECT | |
168 #ifdef CAN_COMPILE_X86_ASM | |
169 // ordered by speed / fastest first | |
170 if(gCpuCaps.hasMMX2) | |
171 vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
172 else if(gCpuCaps.has3DNow) | |
173 vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
174 else if(gCpuCaps.hasMMX) | |
175 vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
176 else | |
177 vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
178 #else | |
179 vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); | |
180 #endif | |
181 #else //RUNTIME_CPUDETECT | |
182 #ifdef HAVE_MMX2 | |
183 vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
184 #elif defined (HAVE_3DNOW) | |
185 vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
186 #elif defined (HAVE_MMX) | |
187 vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
188 #elif defined(ARCH_X86) || defined(ARCH_X86_64) |
12516 | 189 vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); |
190 #else | |
191 vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); | |
192 #endif | |
193 #endif //!RUNTIME_CPUDETECT | |
194 } | |
195 | |
326 | 196 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
3153 | 197 #ifdef RUNTIME_CPUDETECT |
3142 | 198 #ifdef CAN_COMPILE_X86_ASM |
12516 | 199 // ordered by speed / fastest first |
3142 | 200 if(gCpuCaps.hasMMX2) |
201 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
202 else if(gCpuCaps.has3DNow) | |
203 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
204 else if(gCpuCaps.hasMMX) | |
205 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
206 else | |
207 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
|
208 #else |
3142 | 209 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
|
210 #endif |
3153 | 211 #else //RUNTIME_CPUDETECT |
212 #ifdef HAVE_MMX2 | |
213 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
214 #elif defined (HAVE_3DNOW) | |
215 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
216 #elif defined (HAVE_MMX) | |
217 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
218 #elif defined(ARCH_X86) || defined(ARCH_X86_64) |
3153 | 219 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); |
220 #else | |
221 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); | |
222 #endif | |
223 #endif //!RUNTIME_CPUDETECT | |
326 | 224 } |
225 | |
226 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
3153 | 227 #ifdef RUNTIME_CPUDETECT |
3142 | 228 #ifdef CAN_COMPILE_X86_ASM |
12516 | 229 // ordered by speed / fastest first |
3142 | 230 if(gCpuCaps.hasMMX2) |
231 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
232 else if(gCpuCaps.has3DNow) | |
233 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
234 else if(gCpuCaps.hasMMX) | |
235 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
236 else | |
237 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
238 #else | |
239 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); | |
2846 | 240 #endif |
3153 | 241 #else //RUNTIME_CPUDETECT |
242 #ifdef HAVE_MMX2 | |
243 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
244 #elif defined (HAVE_3DNOW) | |
245 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
246 #elif defined (HAVE_MMX) | |
247 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
248 #elif defined(ARCH_X86) || defined(ARCH_X86_64) |
3153 | 249 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); |
250 #else | |
251 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); | |
252 #endif | |
253 #endif //!RUNTIME_CPUDETECT | |
326 | 254 } |
255 | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
256 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
257 static unsigned short fast_osd_15bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
258 static unsigned short fast_osd_16bpp_table[256]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
259 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
260 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
261 void vo_draw_alpha_init(){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
262 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
263 int i; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
264 for(i=0;i<256;i++){ |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
265 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
|
266 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
|
267 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
268 #endif |
11000 | 269 //FIXME the optimized stuff is a lie for 15/16bpp as they aren't optimized yet |
3142 | 270 if(verbose) |
271 { | |
3153 | 272 #ifdef RUNTIME_CPUDETECT |
3142 | 273 #ifdef CAN_COMPILE_X86_ASM |
274 // ordered per speed fasterst first | |
275 if(gCpuCaps.hasMMX2) | |
5935 | 276 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); |
3142 | 277 else if(gCpuCaps.has3DNow) |
5935 | 278 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); |
3142 | 279 else if(gCpuCaps.hasMMX) |
5935 | 280 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); |
3142 | 281 else |
5935 | 282 mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); |
3142 | 283 #else |
5935 | 284 mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); |
3142 | 285 #endif |
3153 | 286 #else //RUNTIME_CPUDETECT |
287 #ifdef HAVE_MMX2 | |
5935 | 288 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); |
3153 | 289 #elif defined (HAVE_3DNOW) |
5935 | 290 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); |
3153 | 291 #elif defined (HAVE_MMX) |
5935 | 292 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12516
diff
changeset
|
293 #elif defined(ARCH_X86) || defined(ARCH_X86_64) |
5935 | 294 mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); |
3153 | 295 #else |
5935 | 296 mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); |
3153 | 297 #endif |
298 #endif //!RUNTIME_CPUDETECT | |
3142 | 299 } |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
300 } |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
301 |
326 | 302 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ |
303 int y; | |
304 for(y=0;y<h;y++){ | |
305 register unsigned short *dst = (unsigned short*) dstbase; | |
306 register int x; | |
307 for(x=0;x<w;x++){ | |
308 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
309 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
310 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
311 dst[x]=fast_osd_15bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
312 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
313 register unsigned int a=src[x]>>3; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
314 dst[x]=(a<<10)|(a<<5)|a; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
315 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
316 #else |
326 | 317 unsigned char r=dst[x]&0x1F; |
318 unsigned char g=(dst[x]>>5)&0x1F; | |
319 unsigned char b=(dst[x]>>10)&0x1F; | |
320 r=(((r*srca[x])>>5)+src[x])>>3; | |
321 g=(((g*srca[x])>>5)+src[x])>>3; | |
322 b=(((b*srca[x])>>5)+src[x])>>3; | |
323 dst[x]=(b<<10)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
324 #endif |
326 | 325 } |
326 } | |
327 src+=srcstride; | |
328 srca+=srcstride; | |
329 dstbase+=dststride; | |
330 } | |
331 return; | |
332 } | |
333 | |
334 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
335 int y; | |
336 for(y=0;y<h;y++){ | |
337 register unsigned short *dst = (unsigned short*) dstbase; | |
338 register int x; | |
339 for(x=0;x<w;x++){ | |
340 if(srca[x]){ | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
341 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
342 #ifdef FAST_OSD_TABLE |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
343 dst[x]=fast_osd_16bpp_table[src[x]]; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
344 #else |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
345 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
|
346 #endif |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
347 #else |
326 | 348 unsigned char r=dst[x]&0x1F; |
349 unsigned char g=(dst[x]>>5)&0x3F; | |
350 unsigned char b=(dst[x]>>11)&0x1F; | |
351 r=(((r*srca[x])>>5)+src[x])>>3; | |
352 g=(((g*srca[x])>>6)+src[x])>>2; | |
353 b=(((b*srca[x])>>5)+src[x])>>3; | |
354 dst[x]=(b<<11)|(g<<5)|r; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
622
diff
changeset
|
355 #endif |
326 | 356 } |
357 } | |
358 src+=srcstride; | |
359 srca+=srcstride; | |
360 dstbase+=dststride; | |
361 } | |
362 return; | |
363 } | |
364 |