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