Mercurial > mplayer.hg
annotate sub/osd.c @ 36154:319cbb4d0967
Check return value to avoid segmentation fault.
author | ib |
---|---|
date | Wed, 08 May 2013 12:37:28 +0000 |
parents | a0ff4fde7a48 |
children |
rev | line source |
---|---|
32469 | 1 /* |
2 * generic alpha renderers for all YUV modes and RGB depths | |
3 * These are "reference implementations", should be optimized later (MMX, etc). | |
4 * templating code by Michael Niedermayer (michaelni@gmx.at) | |
5 * | |
6 * This file is part of MPlayer. | |
7 * | |
8 * MPlayer is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * MPlayer is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License along | |
19 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
21 */ | |
22 | |
23 //#define FAST_OSD | |
24 //#define FAST_OSD_TABLE | |
25 | |
26 #include "config.h" | |
27 #include "osd.h" | |
28 #include "mp_msg.h" | |
29 #include <inttypes.h> | |
35049
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
30 #include <stdlib.h> |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
31 #include "libmpcodecs/img_format.h" |
32469 | 32 #include "cpudetect.h" |
33 | |
34 #if ARCH_X86 | |
35 static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; | |
36 static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL; | |
37 static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL; | |
38 #endif | |
39 | |
40 //Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | |
41 //Plain C versions | |
42 #if !HAVE_MMX || CONFIG_RUNTIME_CPUDETECT | |
43 #define COMPILE_C | |
44 #endif | |
45 | |
46 #if ARCH_X86 | |
47 | |
48 #if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT | |
49 #define COMPILE_MMX | |
50 #endif | |
51 | |
52 #if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT | |
53 #define COMPILE_MMX2 | |
54 #endif | |
55 | |
56 #if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT | |
57 #define COMPILE_3DNOW | |
58 #endif | |
59 | |
60 #endif /* ARCH_X86 */ | |
61 | |
62 #undef HAVE_MMX | |
63 #undef HAVE_MMX2 | |
64 #undef HAVE_AMD3DNOW | |
65 #define HAVE_MMX 0 | |
66 #define HAVE_MMX2 0 | |
67 #define HAVE_AMD3DNOW 0 | |
68 | |
69 #if ! ARCH_X86 | |
70 | |
71 #ifdef COMPILE_C | |
72 #undef HAVE_MMX | |
73 #undef HAVE_MMX2 | |
74 #undef HAVE_AMD3DNOW | |
75 #define HAVE_MMX 0 | |
76 #define HAVE_MMX2 0 | |
77 #define HAVE_AMD3DNOW 0 | |
78 #define RENAME(a) a ## _C | |
79 #include "osd_template.c" | |
80 #endif | |
81 | |
82 #else | |
83 | |
84 //X86 noMMX versions | |
85 #ifdef COMPILE_C | |
86 #undef RENAME | |
87 #undef HAVE_MMX | |
88 #undef HAVE_MMX2 | |
89 #undef HAVE_AMD3DNOW | |
90 #define HAVE_MMX 0 | |
91 #define HAVE_MMX2 0 | |
92 #define HAVE_AMD3DNOW 0 | |
93 #define RENAME(a) a ## _X86 | |
94 #include "osd_template.c" | |
95 #endif | |
96 | |
97 //MMX versions | |
98 #ifdef COMPILE_MMX | |
99 #undef RENAME | |
100 #undef HAVE_MMX | |
101 #undef HAVE_MMX2 | |
102 #undef HAVE_AMD3DNOW | |
103 #define HAVE_MMX 1 | |
104 #define HAVE_MMX2 0 | |
105 #define HAVE_AMD3DNOW 0 | |
106 #define RENAME(a) a ## _MMX | |
107 #include "osd_template.c" | |
108 #endif | |
109 | |
110 //MMX2 versions | |
111 #ifdef COMPILE_MMX2 | |
112 #undef RENAME | |
113 #undef HAVE_MMX | |
114 #undef HAVE_MMX2 | |
115 #undef HAVE_AMD3DNOW | |
116 #define HAVE_MMX 1 | |
117 #define HAVE_MMX2 1 | |
118 #define HAVE_AMD3DNOW 0 | |
119 #define RENAME(a) a ## _MMX2 | |
120 #include "osd_template.c" | |
121 #endif | |
122 | |
123 //3DNOW versions | |
124 #ifdef COMPILE_3DNOW | |
125 #undef RENAME | |
126 #undef HAVE_MMX | |
127 #undef HAVE_MMX2 | |
128 #undef HAVE_AMD3DNOW | |
129 #define HAVE_MMX 1 | |
130 #define HAVE_MMX2 0 | |
131 #define HAVE_AMD3DNOW 1 | |
132 #define RENAME(a) a ## _3DNow | |
133 #include "osd_template.c" | |
134 #endif | |
135 | |
136 #endif /* ARCH_X86 */ | |
137 | |
138 void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
139 #if CONFIG_RUNTIME_CPUDETECT | |
140 #if ARCH_X86 | |
141 // ordered by speed / fastest first | |
142 if(gCpuCaps.hasMMX2) | |
143 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
144 else if(gCpuCaps.has3DNow) | |
145 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
146 else if(gCpuCaps.hasMMX) | |
147 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
148 else | |
149 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
150 #else | |
151 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); | |
152 #endif | |
153 #else //CONFIG_RUNTIME_CPUDETECT | |
154 #if HAVE_MMX2 | |
155 vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
156 #elif HAVE_AMD3DNOW | |
157 vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
158 #elif HAVE_MMX | |
159 vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
160 #elif ARCH_X86 | |
161 vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
162 #else | |
163 vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride); | |
164 #endif | |
165 #endif //!CONFIG_RUNTIME_CPUDETECT | |
166 } | |
167 | |
168 void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
169 #if CONFIG_RUNTIME_CPUDETECT | |
170 #if ARCH_X86 | |
171 // ordered by speed / fastest first | |
172 if(gCpuCaps.hasMMX2) | |
173 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
174 else if(gCpuCaps.has3DNow) | |
175 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
176 else if(gCpuCaps.hasMMX) | |
177 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
178 else | |
179 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
180 #else | |
181 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); | |
182 #endif | |
183 #else //CONFIG_RUNTIME_CPUDETECT | |
184 #if HAVE_MMX2 | |
185 vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
186 #elif HAVE_AMD3DNOW | |
187 vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
188 #elif HAVE_MMX | |
189 vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
190 #elif ARCH_X86 | |
191 vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
192 #else | |
193 vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride); | |
194 #endif | |
195 #endif //!CONFIG_RUNTIME_CPUDETECT | |
196 } | |
197 | |
198 void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
199 #if CONFIG_RUNTIME_CPUDETECT | |
200 #if ARCH_X86 | |
201 // ordered by speed / fastest first | |
202 if(gCpuCaps.hasMMX2) | |
203 vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
204 else if(gCpuCaps.has3DNow) | |
205 vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
206 else if(gCpuCaps.hasMMX) | |
207 vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
208 else | |
209 vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
210 #else | |
211 vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); | |
212 #endif | |
213 #else //CONFIG_RUNTIME_CPUDETECT | |
214 #if HAVE_MMX2 | |
215 vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
216 #elif HAVE_AMD3DNOW | |
217 vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
218 #elif HAVE_MMX | |
219 vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
220 #elif ARCH_X86 | |
221 vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
222 #else | |
223 vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride); | |
224 #endif | |
225 #endif //!CONFIG_RUNTIME_CPUDETECT | |
226 } | |
227 | |
228 void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
229 #if CONFIG_RUNTIME_CPUDETECT | |
230 #if ARCH_X86 | |
231 // ordered by speed / fastest first | |
232 if(gCpuCaps.hasMMX2) | |
233 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
234 else if(gCpuCaps.has3DNow) | |
235 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
236 else if(gCpuCaps.hasMMX) | |
237 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
238 else | |
239 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
240 #else | |
241 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); | |
242 #endif | |
243 #else //CONFIG_RUNTIME_CPUDETECT | |
244 #if HAVE_MMX2 | |
245 vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
246 #elif HAVE_AMD3DNOW | |
247 vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
248 #elif HAVE_MMX | |
249 vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
250 #elif ARCH_X86 | |
251 vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
252 #else | |
253 vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride); | |
254 #endif | |
255 #endif //!CONFIG_RUNTIME_CPUDETECT | |
256 } | |
257 | |
258 void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
259 #if CONFIG_RUNTIME_CPUDETECT | |
260 #if ARCH_X86 | |
261 // ordered by speed / fastest first | |
262 if(gCpuCaps.hasMMX2) | |
263 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
264 else if(gCpuCaps.has3DNow) | |
265 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
266 else if(gCpuCaps.hasMMX) | |
267 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
268 else | |
269 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
270 #else | |
271 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); | |
272 #endif | |
273 #else //CONFIG_RUNTIME_CPUDETECT | |
274 #if HAVE_MMX2 | |
275 vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); | |
276 #elif HAVE_AMD3DNOW | |
277 vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride); | |
278 #elif HAVE_MMX | |
279 vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride); | |
280 #elif ARCH_X86 | |
281 vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride); | |
282 #else | |
283 vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride); | |
284 #endif | |
285 #endif //!CONFIG_RUNTIME_CPUDETECT | |
286 } | |
287 | |
288 #ifdef FAST_OSD_TABLE | |
289 static unsigned short fast_osd_12bpp_table[256]; | |
290 static unsigned short fast_osd_15bpp_table[256]; | |
291 static unsigned short fast_osd_16bpp_table[256]; | |
292 #endif | |
293 | |
294 void vo_draw_alpha_init(void){ | |
295 #ifdef FAST_OSD_TABLE | |
296 int i; | |
297 for(i=0;i<256;i++){ | |
298 fast_osd_12bpp_table[i]=((i>>4)<< 8)|((i>>4)<<4)|(i>>4); | |
299 fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3); | |
300 fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3); | |
301 } | |
302 #endif | |
303 //FIXME the optimized stuff is a lie for 15/16bpp as they aren't optimized yet | |
304 if( mp_msg_test(MSGT_OSD,MSGL_V) ) | |
305 { | |
306 #if CONFIG_RUNTIME_CPUDETECT | |
307 #if ARCH_X86 | |
308 // ordered per speed fasterst first | |
309 if(gCpuCaps.hasMMX2) | |
310 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); | |
311 else if(gCpuCaps.has3DNow) | |
312 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); | |
313 else if(gCpuCaps.hasMMX) | |
314 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); | |
315 else | |
316 mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); | |
317 #else | |
318 mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); | |
319 #endif | |
320 #else //CONFIG_RUNTIME_CPUDETECT | |
321 #if HAVE_MMX2 | |
322 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n"); | |
323 #elif HAVE_AMD3DNOW | |
324 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n"); | |
325 #elif HAVE_MMX | |
326 mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n"); | |
327 #elif ARCH_X86 | |
328 mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n"); | |
329 #else | |
330 mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n"); | |
331 #endif | |
332 #endif //!CONFIG_RUNTIME_CPUDETECT | |
333 } | |
334 } | |
335 | |
336 void vo_draw_alpha_rgb12(int w, int h, unsigned char* src, unsigned char *srca, | |
337 int srcstride, unsigned char* dstbase, int dststride) { | |
338 int y; | |
339 for (y = 0; y < h; y++) { | |
340 register unsigned short *dst = (unsigned short*) dstbase; | |
341 register int x; | |
342 for (x = 0; x < w; x++) { | |
343 if(srca[x]){ | |
344 #ifdef FAST_OSD | |
345 #ifdef FAST_OSD_TABLE | |
346 dst[x] = fast_osd_12bpp_table[src[x]]; | |
347 #else | |
348 register unsigned int a = src[x] >> 4; | |
349 dst[x] = (a << 8) | (a << 4) | a; | |
350 #endif | |
351 #else | |
352 unsigned char r = dst[x] & 0x0F; | |
353 unsigned char g = (dst[x] >> 4) & 0x0F; | |
354 unsigned char b = (dst[x] >> 8) & 0x0F; | |
355 r = (((r*srca[x]) >> 4) + src[x]) >> 4; | |
356 g = (((g*srca[x]) >> 4) + src[x]) >> 4; | |
357 b = (((b*srca[x]) >> 4) + src[x]) >> 4; | |
358 dst[x] = (b << 8) | (g << 4) | r; | |
359 #endif | |
360 } | |
361 } | |
362 src += srcstride; | |
363 srca += srcstride; | |
364 dstbase += dststride; | |
365 } | |
366 return; | |
367 } | |
368 | |
369 void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
370 int y; | |
371 for(y=0;y<h;y++){ | |
372 register unsigned short *dst = (unsigned short*) dstbase; | |
373 register int x; | |
374 for(x=0;x<w;x++){ | |
375 if(srca[x]){ | |
376 #ifdef FAST_OSD | |
377 #ifdef FAST_OSD_TABLE | |
378 dst[x]=fast_osd_15bpp_table[src[x]]; | |
379 #else | |
380 register unsigned int a=src[x]>>3; | |
381 dst[x]=(a<<10)|(a<<5)|a; | |
382 #endif | |
383 #else | |
384 unsigned char r=dst[x]&0x1F; | |
385 unsigned char g=(dst[x]>>5)&0x1F; | |
386 unsigned char b=(dst[x]>>10)&0x1F; | |
387 r=(((r*srca[x])>>5)+src[x])>>3; | |
388 g=(((g*srca[x])>>5)+src[x])>>3; | |
389 b=(((b*srca[x])>>5)+src[x])>>3; | |
390 dst[x]=(b<<10)|(g<<5)|r; | |
391 #endif | |
392 } | |
393 } | |
394 src+=srcstride; | |
395 srca+=srcstride; | |
396 dstbase+=dststride; | |
397 } | |
398 return; | |
399 } | |
400 | |
401 void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ | |
402 int y; | |
403 for(y=0;y<h;y++){ | |
404 register unsigned short *dst = (unsigned short*) dstbase; | |
405 register int x; | |
406 for(x=0;x<w;x++){ | |
407 if(srca[x]){ | |
408 #ifdef FAST_OSD | |
409 #ifdef FAST_OSD_TABLE | |
410 dst[x]=fast_osd_16bpp_table[src[x]]; | |
411 #else | |
412 dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3); | |
413 #endif | |
414 #else | |
415 unsigned char r=dst[x]&0x1F; | |
416 unsigned char g=(dst[x]>>5)&0x3F; | |
417 unsigned char b=(dst[x]>>11)&0x1F; | |
418 r=(((r*srca[x])>>5)+src[x])>>3; | |
419 g=(((g*srca[x])>>6)+src[x])>>2; | |
420 b=(((b*srca[x])>>5)+src[x])>>3; | |
421 dst[x]=(b<<11)|(g<<5)|r; | |
422 #endif | |
423 } | |
424 } | |
425 src+=srcstride; | |
426 srca+=srcstride; | |
427 dstbase+=dststride; | |
428 } | |
429 return; | |
430 } | |
35049
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
431 |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
432 vo_draw_alpha_func vo_get_draw_alpha(unsigned fmt) { |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
433 if (IMGFMT_IS_RGB(fmt) || IMGFMT_IS_BGR(fmt)) { |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
434 switch (IMGFMT_RGB_DEPTH(fmt)) |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
435 { |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
436 case 12: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
437 return vo_draw_alpha_rgb12; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
438 case 15: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
439 return vo_draw_alpha_rgb15; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
440 case 16: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
441 return vo_draw_alpha_rgb16; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
442 case 24: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
443 return vo_draw_alpha_rgb24; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
444 case 32: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
445 return vo_draw_alpha_rgb32; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
446 } |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
447 return NULL; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
448 } |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
449 switch (fmt) { |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
450 case IMGFMT_YV12: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
451 case IMGFMT_I420: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
452 case IMGFMT_IYUV: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
453 return vo_draw_alpha_yv12; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
454 case IMGFMT_YUY2: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
455 case IMGFMT_YVYU: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
456 return vo_draw_alpha_yuy2; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
457 case IMGFMT_UYVY: |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
458 return vo_draw_alpha_uyvy; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
459 } |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
460 return NULL; |
a0ff4fde7a48
Add helper function to reduce code duplication for selecting
reimar
parents:
32469
diff
changeset
|
461 } |