Mercurial > mplayer.hg
annotate postproc/rgb2rgb.c @ 5029:ef8a43b74075
Add IJPG decoder.
author | pontscho |
---|---|
date | Sun, 10 Mar 2002 22:49:18 +0000 |
parents | 3cc0f4938be1 |
children | 0bd1c35aa42c |
rev | line source |
---|---|
2694 | 1 /* |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
2 * |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
3 * rgb2rgb.c, Software RGB to RGB convertor |
2732 | 4 * pluralize by Software PAL8 to RGB convertor |
5 * Software YUV to YUV convertor | |
6 * Software YUV to RGB convertor | |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
7 * Written by Nick Kurshev. |
3132 | 8 * palette & yuv & runtime cpu stuff by Michael (michaelni@gmx.at) (under GPL) |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
9 */ |
2504 | 10 #include <inttypes.h> |
11 #include "../config.h" | |
12 #include "rgb2rgb.h" | |
3132 | 13 #include "../cpudetect.h" |
4923 | 14 #include "../mangle.h" |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
15 |
3132 | 16 #ifdef ARCH_X86 |
17 #define CAN_COMPILE_X86_ASM | |
18 #endif | |
19 | |
4622 | 20 #define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit |
21 | |
3132 | 22 #ifdef CAN_COMPILE_X86_ASM |
2755 | 23 static const uint64_t mask32b __attribute__((aligned(8))) = 0x000000FF000000FFULL; |
24 static const uint64_t mask32g __attribute__((aligned(8))) = 0x0000FF000000FF00ULL; | |
25 static const uint64_t mask32r __attribute__((aligned(8))) = 0x00FF000000FF0000ULL; | |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
26 static const uint64_t mask32 __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL; |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
27 static const uint64_t mask24l __attribute__((aligned(8))) = 0x0000000000FFFFFFULL; |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
28 static const uint64_t mask24h __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL; |
2746
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
29 static const uint64_t mask24hh __attribute__((aligned(8))) = 0xffff000000000000ULL; |
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
30 static const uint64_t mask24hhh __attribute__((aligned(8))) = 0xffffffff00000000ULL; |
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
31 static const uint64_t mask24hhhh __attribute__((aligned(8))) = 0xffffffffffff0000ULL; |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
32 static const uint64_t mask15b __attribute__((aligned(8))) = 0x001F001F001F001FULL; /* 00000000 00011111 xxB */ |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
33 static const uint64_t mask15rg __attribute__((aligned(8))) = 0x7FE07FE07FE07FE0ULL; /* 01111111 11100000 RGx */ |
2698
22652c028692
faster 15to16 bit rgb (the mmx routine is limited by memory speed so there is no difference ): but the c routine is faster
michael
parents:
2697
diff
changeset
|
34 static const uint64_t mask15s __attribute__((aligned(8))) = 0xFFE0FFE0FFE0FFE0ULL; |
2741 | 35 static const uint64_t red_16mask __attribute__((aligned(8))) = 0x0000f8000000f800ULL; |
36 static const uint64_t green_16mask __attribute__((aligned(8)))= 0x000007e0000007e0ULL; | |
37 static const uint64_t blue_16mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; | |
38 static const uint64_t red_15mask __attribute__((aligned(8))) = 0x00007c000000f800ULL; | |
39 static const uint64_t green_15mask __attribute__((aligned(8)))= 0x000003e0000007e0ULL; | |
40 static const uint64_t blue_15mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; | |
4622 | 41 |
42 #ifdef FAST_BGR2YV12 | |
43 static const uint64_t bgr2YCoeff __attribute__((aligned(8))) = 0x000000210041000DULL; | |
44 static const uint64_t bgr2UCoeff __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL; | |
45 static const uint64_t bgr2VCoeff __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL; | |
46 #else | |
47 static const uint64_t bgr2YCoeff __attribute__((aligned(8))) = 0x000020E540830C8BULL; | |
48 static const uint64_t bgr2UCoeff __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL; | |
49 static const uint64_t bgr2VCoeff __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL; | |
50 #endif | |
51 static const uint64_t bgr2YOffset __attribute__((aligned(8))) = 0x1010101010101010ULL; | |
52 static const uint64_t bgr2UVOffset __attribute__((aligned(8)))= 0x8080808080808080ULL; | |
53 static const uint64_t w1111 __attribute__((aligned(8))) = 0x0001000100010001ULL; | |
54 | |
2755 | 55 #if 0 |
56 static volatile uint64_t __attribute__((aligned(8))) b5Dither; | |
57 static volatile uint64_t __attribute__((aligned(8))) g5Dither; | |
58 static volatile uint64_t __attribute__((aligned(8))) g6Dither; | |
59 static volatile uint64_t __attribute__((aligned(8))) r5Dither; | |
60 | |
61 static uint64_t __attribute__((aligned(8))) dither4[2]={ | |
62 0x0103010301030103LL, | |
63 0x0200020002000200LL,}; | |
64 | |
65 static uint64_t __attribute__((aligned(8))) dither8[2]={ | |
66 0x0602060206020602LL, | |
67 0x0004000400040004LL,}; | |
68 #endif | |
2535 | 69 #endif |
2513 | 70 |
3132 | 71 #define RGB2YUV_SHIFT 8 |
72 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) | |
73 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) | |
74 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) | |
75 #define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5)) | |
76 #define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5)) | |
77 #define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5)) | |
78 #define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5)) | |
79 #define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) | |
80 #define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5)) | |
81 | |
82 //Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | |
83 //Plain C versions | |
84 #undef HAVE_MMX | |
85 #undef HAVE_MMX2 | |
86 #undef HAVE_3DNOW | |
87 #undef ARCH_X86 | |
88 #define RENAME(a) a ## _C | |
89 #include "rgb2rgb_template.c" | |
90 | |
91 #ifdef CAN_COMPILE_X86_ASM | |
92 | |
93 //MMX versions | |
94 #undef RENAME | |
95 #define HAVE_MMX | |
96 #undef HAVE_MMX2 | |
97 #undef HAVE_3DNOW | |
98 #define ARCH_X86 | |
99 #define RENAME(a) a ## _MMX | |
100 #include "rgb2rgb_template.c" | |
101 | |
102 //MMX2 versions | |
103 #undef RENAME | |
104 #define HAVE_MMX | |
105 #define HAVE_MMX2 | |
106 #undef HAVE_3DNOW | |
107 #define ARCH_X86 | |
108 #define RENAME(a) a ## _MMX2 | |
109 #include "rgb2rgb_template.c" | |
110 | |
111 //3DNOW versions | |
112 #undef RENAME | |
113 #define HAVE_MMX | |
114 #undef HAVE_MMX2 | |
115 #define HAVE_3DNOW | |
116 #define ARCH_X86 | |
117 #define RENAME(a) a ## _3DNow | |
118 #include "rgb2rgb_template.c" | |
119 | |
120 #endif //CAN_COMPILE_X86_ASM | |
121 | |
2718 | 122 void rgb24to32(const uint8_t *src,uint8_t *dst,unsigned src_size) |
2504 | 123 { |
3132 | 124 #ifdef CAN_COMPILE_X86_ASM |
125 // ordered per speed fasterst first | |
126 if(gCpuCaps.hasMMX2) | |
127 rgb24to32_MMX2(src, dst, src_size); | |
128 else if(gCpuCaps.has3DNow) | |
129 rgb24to32_3DNow(src, dst, src_size); | |
130 else if(gCpuCaps.hasMMX) | |
131 rgb24to32_MMX(src, dst, src_size); | |
132 else | |
133 rgb24to32_C(src, dst, src_size); | |
134 #else | |
135 rgb24to32_C(src, dst, src_size); | |
2510 | 136 #endif |
2504 | 137 } |
2505 | 138 |
2718 | 139 void rgb32to24(const uint8_t *src,uint8_t *dst,unsigned src_size) |
2505 | 140 { |
3132 | 141 #ifdef CAN_COMPILE_X86_ASM |
142 // ordered per speed fasterst first | |
143 if(gCpuCaps.hasMMX2) | |
144 rgb32to24_MMX2(src, dst, src_size); | |
145 else if(gCpuCaps.has3DNow) | |
146 rgb32to24_3DNow(src, dst, src_size); | |
147 else if(gCpuCaps.hasMMX) | |
148 rgb32to24_MMX(src, dst, src_size); | |
149 else | |
150 rgb32to24_C(src, dst, src_size); | |
151 #else | |
152 rgb32to24_C(src, dst, src_size); | |
2517 | 153 #endif |
2505 | 154 } |
2506 | 155 |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
156 /* |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
157 Original by Strepto/Astral |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
158 ported to gcc & bugfixed : A'rpi |
2564 | 159 MMX2, 3DNOW optimization by Nick Kurshev |
2698
22652c028692
faster 15to16 bit rgb (the mmx routine is limited by memory speed so there is no difference ): but the c routine is faster
michael
parents:
2697
diff
changeset
|
160 32bit c version, and and&add trick by Michael Niedermayer |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
161 */ |
2718 | 162 void rgb15to16(const uint8_t *src,uint8_t *dst,unsigned src_size) |
2506 | 163 { |
3132 | 164 #ifdef CAN_COMPILE_X86_ASM |
165 // ordered per speed fasterst first | |
166 if(gCpuCaps.hasMMX2) | |
167 rgb15to16_MMX2(src, dst, src_size); | |
168 else if(gCpuCaps.has3DNow) | |
169 rgb15to16_3DNow(src, dst, src_size); | |
170 else if(gCpuCaps.hasMMX) | |
171 rgb15to16_MMX(src, dst, src_size); | |
172 else | |
173 rgb15to16_C(src, dst, src_size); | |
2506 | 174 #else |
3132 | 175 rgb15to16_C(src, dst, src_size); |
2506 | 176 #endif |
177 } | |
2694 | 178 |
179 /** | |
180 * Pallete is assumed to contain bgr32 | |
181 */ | |
2718 | 182 void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2694 | 183 { |
2718 | 184 unsigned i; |
2702 | 185 for(i=0; i<num_pixels; i++) |
2718 | 186 ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ]; |
2694 | 187 } |
188 | |
2697 | 189 /** |
190 * Pallete is assumed to contain bgr32 | |
191 */ | |
2718 | 192 void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2697 | 193 { |
2718 | 194 unsigned i; |
2697 | 195 /* |
196 writes 1 byte o much and might cause alignment issues on some architectures? | |
2702 | 197 for(i=0; i<num_pixels; i++) |
2718 | 198 ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; |
2697 | 199 */ |
2702 | 200 for(i=0; i<num_pixels; i++) |
2697 | 201 { |
202 //FIXME slow? | |
203 dst[0]= palette[ src[i]*4+0 ]; | |
204 dst[1]= palette[ src[i]*4+1 ]; | |
205 dst[2]= palette[ src[i]*4+2 ]; | |
206 dst+= 3; | |
207 } | |
208 } | |
209 | |
2718 | 210 void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size) |
2694 | 211 { |
3132 | 212 #ifdef CAN_COMPILE_X86_ASM |
213 // ordered per speed fasterst first | |
214 if(gCpuCaps.hasMMX2) | |
215 rgb32to16_MMX2(src, dst, src_size); | |
216 else if(gCpuCaps.has3DNow) | |
217 rgb32to16_3DNow(src, dst, src_size); | |
218 else if(gCpuCaps.hasMMX) | |
219 rgb32to16_MMX(src, dst, src_size); | |
220 else | |
221 rgb32to16_C(src, dst, src_size); | |
2741 | 222 #else |
3132 | 223 rgb32to16_C(src, dst, src_size); |
2741 | 224 #endif |
2694 | 225 } |
226 | |
2718 | 227 void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size) |
2694 | 228 { |
3132 | 229 #ifdef CAN_COMPILE_X86_ASM |
230 // ordered per speed fasterst first | |
231 if(gCpuCaps.hasMMX2) | |
232 rgb32to15_MMX2(src, dst, src_size); | |
233 else if(gCpuCaps.has3DNow) | |
234 rgb32to15_3DNow(src, dst, src_size); | |
235 else if(gCpuCaps.hasMMX) | |
236 rgb32to15_MMX(src, dst, src_size); | |
237 else | |
238 rgb32to15_C(src, dst, src_size); | |
2741 | 239 #else |
3132 | 240 rgb32to15_C(src, dst, src_size); |
2741 | 241 #endif |
2694 | 242 } |
243 | |
2718 | 244 void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size) |
245 { | |
3132 | 246 #ifdef CAN_COMPILE_X86_ASM |
247 // ordered per speed fasterst first | |
248 if(gCpuCaps.hasMMX2) | |
249 rgb24to16_MMX2(src, dst, src_size); | |
250 else if(gCpuCaps.has3DNow) | |
251 rgb24to16_3DNow(src, dst, src_size); | |
252 else if(gCpuCaps.hasMMX) | |
253 rgb24to16_MMX(src, dst, src_size); | |
254 else | |
255 rgb24to16_C(src, dst, src_size); | |
2740 | 256 #else |
3132 | 257 rgb24to16_C(src, dst, src_size); |
2740 | 258 #endif |
2718 | 259 } |
260 | |
261 void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size) | |
262 { | |
3132 | 263 #ifdef CAN_COMPILE_X86_ASM |
264 // ordered per speed fasterst first | |
265 if(gCpuCaps.hasMMX2) | |
266 rgb24to15_MMX2(src, dst, src_size); | |
267 else if(gCpuCaps.has3DNow) | |
268 rgb24to15_3DNow(src, dst, src_size); | |
269 else if(gCpuCaps.hasMMX) | |
270 rgb24to15_MMX(src, dst, src_size); | |
271 else | |
272 rgb24to15_C(src, dst, src_size); | |
2741 | 273 #else |
3132 | 274 rgb24to15_C(src, dst, src_size); |
2741 | 275 #endif |
2718 | 276 } |
2694 | 277 |
278 /** | |
279 * Palette is assumed to contain bgr16, see rgb32to16 to convert the palette | |
280 */ | |
2718 | 281 void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2694 | 282 { |
2718 | 283 unsigned i; |
2702 | 284 for(i=0; i<num_pixels; i++) |
2694 | 285 ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; |
286 } | |
287 | |
288 /** | |
289 * Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette | |
290 */ | |
2718 | 291 void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2694 | 292 { |
2718 | 293 unsigned i; |
2702 | 294 for(i=0; i<num_pixels; i++) |
2694 | 295 ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; |
2697 | 296 } |
2755 | 297 |
298 void rgb32tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) | |
299 { | |
3132 | 300 #ifdef CAN_COMPILE_X86_ASM |
301 // ordered per speed fasterst first | |
302 if(gCpuCaps.hasMMX2) | |
303 rgb32tobgr32_MMX2(src, dst, src_size); | |
304 else if(gCpuCaps.has3DNow) | |
305 rgb32tobgr32_3DNow(src, dst, src_size); | |
306 else if(gCpuCaps.hasMMX) | |
307 rgb32tobgr32_MMX(src, dst, src_size); | |
308 else | |
309 rgb32tobgr32_C(src, dst, src_size); | |
2755 | 310 #else |
3132 | 311 rgb32tobgr32_C(src, dst, src_size); |
2755 | 312 #endif |
313 } | |
314 | |
2702 | 315 /** |
316 * | |
2724 | 317 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a |
318 * problem for anyone then tell me, and ill fix it) | |
2702 | 319 */ |
2723 | 320 void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
2725 | 321 unsigned int width, unsigned int height, |
322 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride) | |
2701 | 323 { |
3132 | 324 #ifdef CAN_COMPILE_X86_ASM |
325 // ordered per speed fasterst first | |
326 if(gCpuCaps.hasMMX2) | |
327 yv12toyuy2_MMX2(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
328 else if(gCpuCaps.has3DNow) | |
329 yv12toyuy2_3DNow(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
330 else if(gCpuCaps.hasMMX) | |
331 yv12toyuy2_MMX(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
332 else | |
333 yv12toyuy2_C(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
2702 | 334 #else |
3132 | 335 yv12toyuy2_C(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); |
2702 | 336 #endif |
2701 | 337 } |
338 | |
2724 | 339 /** |
340 * | |
341 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |
342 * problem for anyone then tell me, and ill fix it) | |
343 */ | |
344 void yuy2toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
2725 | 345 unsigned int width, unsigned int height, |
346 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) | |
2701 | 347 { |
3132 | 348 #ifdef CAN_COMPILE_X86_ASM |
349 // ordered per speed fasterst first | |
350 if(gCpuCaps.hasMMX2) | |
351 yuy2toyv12_MMX2(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
352 else if(gCpuCaps.has3DNow) | |
353 yuy2toyv12_3DNow(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
354 else if(gCpuCaps.hasMMX) | |
355 yuy2toyv12_MMX(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
356 else | |
357 yuy2toyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
2704 | 358 #else |
3132 | 359 yuy2toyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); |
2704 | 360 #endif |
2723 | 361 } |
2801 | 362 |
363 /** | |
364 * | |
365 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |
366 * problem for anyone then tell me, and ill fix it) | |
3132 | 367 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version |
2801 | 368 */ |
369 void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
370 unsigned int width, unsigned int height, | |
371 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) | |
372 { | |
3132 | 373 #ifdef CAN_COMPILE_X86_ASM |
374 // ordered per speed fasterst first | |
375 if(gCpuCaps.hasMMX2) | |
376 uyvytoyv12_MMX2(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
377 else if(gCpuCaps.has3DNow) | |
378 uyvytoyv12_3DNow(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
379 else if(gCpuCaps.hasMMX) | |
380 uyvytoyv12_MMX(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
381 else | |
382 uyvytoyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
2847 | 383 #else |
3132 | 384 uyvytoyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); |
2847 | 385 #endif |
2801 | 386 } |
387 | |
3132 | 388 /** |
389 * | |
390 * height should be a multiple of 2 and width should be a multiple of 2 (if this is a | |
391 * problem for anyone then tell me, and ill fix it) | |
392 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version | |
393 */ | |
394 void rgb24toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
395 unsigned int width, unsigned int height, | |
396 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) | |
397 { | |
398 #ifdef CAN_COMPILE_X86_ASM | |
399 // ordered per speed fasterst first | |
400 if(gCpuCaps.hasMMX2) | |
401 rgb24toyv12_MMX2(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
402 else if(gCpuCaps.has3DNow) | |
403 rgb24toyv12_3DNow(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
404 else if(gCpuCaps.hasMMX) | |
405 rgb24toyv12_MMX(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
406 else | |
407 rgb24toyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
408 #else | |
409 rgb24toyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
410 #endif | |
411 } |