Mercurial > mplayer.hg
annotate postproc/rgb2rgb.c @ 6977:7242f1840f8d
kde3 dnd fix from Gregory Kovriga and file name handling fix in dnd callback
author | pontscho |
---|---|
date | Sun, 11 Aug 2002 19:12:09 +0000 |
parents | 49eac73d0e07 |
children | 1df24fd752d0 |
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 |
6492 | 23 static const uint64_t mmx_null __attribute__((aligned(8))) = 0x0000000000000000ULL; |
24 static const uint64_t mmx_one __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; | |
2755 | 25 static const uint64_t mask32b __attribute__((aligned(8))) = 0x000000FF000000FFULL; |
26 static const uint64_t mask32g __attribute__((aligned(8))) = 0x0000FF000000FF00ULL; | |
27 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
|
28 static const uint64_t mask32 __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL; |
5582 | 29 static const uint64_t mask24b __attribute__((aligned(8))) = 0x00FF0000FF0000FFULL; |
30 static const uint64_t mask24g __attribute__((aligned(8))) = 0xFF0000FF0000FF00ULL; | |
31 static const uint64_t mask24r __attribute__((aligned(8))) = 0x0000FF0000FF0000ULL; | |
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 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
|
33 static const uint64_t mask24h __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL; |
2746
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
34 static const uint64_t mask24hh __attribute__((aligned(8))) = 0xffff000000000000ULL; |
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
35 static const uint64_t mask24hhh __attribute__((aligned(8))) = 0xffffffff00000000ULL; |
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
36 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
|
37 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
|
38 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
|
39 static const uint64_t mask15s __attribute__((aligned(8))) = 0xFFE0FFE0FFE0FFE0ULL; |
6492 | 40 static const uint64_t mask15g __attribute__((aligned(8))) = 0x03E003E003E003E0ULL; |
41 static const uint64_t mask15r __attribute__((aligned(8))) = 0x7C007C007C007C00ULL; | |
42 #define mask16b mask15b | |
43 static const uint64_t mask16g __attribute__((aligned(8))) = 0x07E007E007E007E0ULL; | |
44 static const uint64_t mask16r __attribute__((aligned(8))) = 0xF800F800F800F800ULL; | |
2741 | 45 static const uint64_t red_16mask __attribute__((aligned(8))) = 0x0000f8000000f800ULL; |
46 static const uint64_t green_16mask __attribute__((aligned(8)))= 0x000007e0000007e0ULL; | |
47 static const uint64_t blue_16mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; | |
48 static const uint64_t red_15mask __attribute__((aligned(8))) = 0x00007c000000f800ULL; | |
49 static const uint64_t green_15mask __attribute__((aligned(8)))= 0x000003e0000007e0ULL; | |
50 static const uint64_t blue_15mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; | |
4622 | 51 |
52 #ifdef FAST_BGR2YV12 | |
53 static const uint64_t bgr2YCoeff __attribute__((aligned(8))) = 0x000000210041000DULL; | |
54 static const uint64_t bgr2UCoeff __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL; | |
55 static const uint64_t bgr2VCoeff __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL; | |
56 #else | |
57 static const uint64_t bgr2YCoeff __attribute__((aligned(8))) = 0x000020E540830C8BULL; | |
58 static const uint64_t bgr2UCoeff __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL; | |
59 static const uint64_t bgr2VCoeff __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL; | |
60 #endif | |
61 static const uint64_t bgr2YOffset __attribute__((aligned(8))) = 0x1010101010101010ULL; | |
62 static const uint64_t bgr2UVOffset __attribute__((aligned(8)))= 0x8080808080808080ULL; | |
63 static const uint64_t w1111 __attribute__((aligned(8))) = 0x0001000100010001ULL; | |
64 | |
2755 | 65 #if 0 |
66 static volatile uint64_t __attribute__((aligned(8))) b5Dither; | |
67 static volatile uint64_t __attribute__((aligned(8))) g5Dither; | |
68 static volatile uint64_t __attribute__((aligned(8))) g6Dither; | |
69 static volatile uint64_t __attribute__((aligned(8))) r5Dither; | |
70 | |
71 static uint64_t __attribute__((aligned(8))) dither4[2]={ | |
72 0x0103010301030103LL, | |
73 0x0200020002000200LL,}; | |
74 | |
75 static uint64_t __attribute__((aligned(8))) dither8[2]={ | |
76 0x0602060206020602LL, | |
77 0x0004000400040004LL,}; | |
78 #endif | |
2535 | 79 #endif |
2513 | 80 |
3132 | 81 #define RGB2YUV_SHIFT 8 |
82 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) | |
83 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) | |
84 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) | |
85 #define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5)) | |
86 #define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5)) | |
87 #define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5)) | |
88 #define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5)) | |
89 #define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) | |
90 #define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5)) | |
91 | |
92 //Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | |
93 //Plain C versions | |
94 #undef HAVE_MMX | |
95 #undef HAVE_MMX2 | |
96 #undef HAVE_3DNOW | |
97 #undef ARCH_X86 | |
5338 | 98 #undef HAVE_SSE2 |
3132 | 99 #define RENAME(a) a ## _C |
100 #include "rgb2rgb_template.c" | |
101 | |
102 #ifdef CAN_COMPILE_X86_ASM | |
103 | |
104 //MMX versions | |
105 #undef RENAME | |
106 #define HAVE_MMX | |
107 #undef HAVE_MMX2 | |
108 #undef HAVE_3DNOW | |
5338 | 109 #undef HAVE_SSE2 |
3132 | 110 #define ARCH_X86 |
111 #define RENAME(a) a ## _MMX | |
112 #include "rgb2rgb_template.c" | |
113 | |
114 //MMX2 versions | |
115 #undef RENAME | |
116 #define HAVE_MMX | |
117 #define HAVE_MMX2 | |
118 #undef HAVE_3DNOW | |
5338 | 119 #undef HAVE_SSE2 |
3132 | 120 #define ARCH_X86 |
121 #define RENAME(a) a ## _MMX2 | |
122 #include "rgb2rgb_template.c" | |
123 | |
124 //3DNOW versions | |
125 #undef RENAME | |
126 #define HAVE_MMX | |
127 #undef HAVE_MMX2 | |
128 #define HAVE_3DNOW | |
5338 | 129 #undef HAVE_SSE2 |
3132 | 130 #define ARCH_X86 |
131 #define RENAME(a) a ## _3DNow | |
132 #include "rgb2rgb_template.c" | |
133 | |
134 #endif //CAN_COMPILE_X86_ASM | |
135 | |
2718 | 136 void rgb24to32(const uint8_t *src,uint8_t *dst,unsigned src_size) |
2504 | 137 { |
3132 | 138 #ifdef CAN_COMPILE_X86_ASM |
139 // ordered per speed fasterst first | |
140 if(gCpuCaps.hasMMX2) | |
141 rgb24to32_MMX2(src, dst, src_size); | |
142 else if(gCpuCaps.has3DNow) | |
143 rgb24to32_3DNow(src, dst, src_size); | |
144 else if(gCpuCaps.hasMMX) | |
145 rgb24to32_MMX(src, dst, src_size); | |
146 else | |
6492 | 147 #endif |
3132 | 148 rgb24to32_C(src, dst, src_size); |
6492 | 149 } |
150 | |
151 void rgb15to24(const uint8_t *src,uint8_t *dst,unsigned src_size) | |
152 { | |
153 #ifdef CAN_COMPILE_X86_ASM | |
154 // ordered per speed fasterst first | |
155 if(gCpuCaps.hasMMX2) | |
156 rgb15to24_MMX2(src, dst, src_size); | |
157 else if(gCpuCaps.has3DNow) | |
158 rgb15to24_3DNow(src, dst, src_size); | |
159 else if(gCpuCaps.hasMMX) | |
160 rgb15to24_MMX(src, dst, src_size); | |
161 else | |
162 #endif | |
163 rgb15to24_C(src, dst, src_size); | |
164 } | |
165 | |
166 void rgb16to24(const uint8_t *src,uint8_t *dst,unsigned src_size) | |
167 { | |
168 #ifdef CAN_COMPILE_X86_ASM | |
169 // ordered per speed fasterst first | |
170 if(gCpuCaps.hasMMX2) | |
171 rgb16to24_MMX2(src, dst, src_size); | |
172 else if(gCpuCaps.has3DNow) | |
173 rgb16to24_3DNow(src, dst, src_size); | |
174 else if(gCpuCaps.hasMMX) | |
175 rgb16to24_MMX(src, dst, src_size); | |
176 else | |
2510 | 177 #endif |
6492 | 178 rgb16to24_C(src, dst, src_size); |
179 } | |
180 | |
181 void rgb15to32(const uint8_t *src,uint8_t *dst,unsigned src_size) | |
182 { | |
183 #ifdef CAN_COMPILE_X86_ASM | |
184 // ordered per speed fasterst first | |
185 if(gCpuCaps.hasMMX2) | |
186 rgb15to32_MMX2(src, dst, src_size); | |
187 else if(gCpuCaps.has3DNow) | |
188 rgb15to32_3DNow(src, dst, src_size); | |
189 else if(gCpuCaps.hasMMX) | |
190 rgb15to32_MMX(src, dst, src_size); | |
191 else | |
192 #endif | |
193 rgb15to32_C(src, dst, src_size); | |
194 } | |
195 | |
196 void rgb16to32(const uint8_t *src,uint8_t *dst,unsigned src_size) | |
197 { | |
198 #ifdef CAN_COMPILE_X86_ASM | |
199 // ordered per speed fasterst first | |
200 if(gCpuCaps.hasMMX2) | |
201 rgb16to32_MMX2(src, dst, src_size); | |
202 else if(gCpuCaps.has3DNow) | |
203 rgb16to32_3DNow(src, dst, src_size); | |
204 else if(gCpuCaps.hasMMX) | |
205 rgb16to32_MMX(src, dst, src_size); | |
206 else | |
207 #endif | |
208 rgb16to32_C(src, dst, src_size); | |
2504 | 209 } |
2505 | 210 |
2718 | 211 void rgb32to24(const uint8_t *src,uint8_t *dst,unsigned src_size) |
2505 | 212 { |
3132 | 213 #ifdef CAN_COMPILE_X86_ASM |
214 // ordered per speed fasterst first | |
215 if(gCpuCaps.hasMMX2) | |
216 rgb32to24_MMX2(src, dst, src_size); | |
217 else if(gCpuCaps.has3DNow) | |
218 rgb32to24_3DNow(src, dst, src_size); | |
219 else if(gCpuCaps.hasMMX) | |
220 rgb32to24_MMX(src, dst, src_size); | |
221 else | |
6492 | 222 #endif |
3132 | 223 rgb32to24_C(src, dst, src_size); |
2505 | 224 } |
2506 | 225 |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
226 /* |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
227 Original by Strepto/Astral |
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
228 ported to gcc & bugfixed : A'rpi |
2564 | 229 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
|
230 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
|
231 */ |
2718 | 232 void rgb15to16(const uint8_t *src,uint8_t *dst,unsigned src_size) |
2506 | 233 { |
3132 | 234 #ifdef CAN_COMPILE_X86_ASM |
235 // ordered per speed fasterst first | |
236 if(gCpuCaps.hasMMX2) | |
237 rgb15to16_MMX2(src, dst, src_size); | |
238 else if(gCpuCaps.has3DNow) | |
239 rgb15to16_3DNow(src, dst, src_size); | |
240 else if(gCpuCaps.hasMMX) | |
241 rgb15to16_MMX(src, dst, src_size); | |
242 else | |
6492 | 243 #endif |
3132 | 244 rgb15to16_C(src, dst, src_size); |
2506 | 245 } |
2694 | 246 |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
247 void rgb16to15(const uint8_t *src,uint8_t *dst,unsigned src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
248 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
249 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
250 // ordered per speed fasterst first |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
251 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
252 rgb16to15_MMX2(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
253 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
254 rgb16to15_3DNow(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
255 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
256 rgb16to15_MMX(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
257 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
258 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
259 rgb16to15_C(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
260 } |
2694 | 261 /** |
262 * Pallete is assumed to contain bgr32 | |
263 */ | |
2718 | 264 void palette8torgb32(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2694 | 265 { |
2718 | 266 unsigned i; |
2702 | 267 for(i=0; i<num_pixels; i++) |
2718 | 268 ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ]; |
2694 | 269 } |
270 | |
2697 | 271 /** |
272 * Pallete is assumed to contain bgr32 | |
273 */ | |
2718 | 274 void palette8torgb24(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2697 | 275 { |
2718 | 276 unsigned i; |
2697 | 277 /* |
278 writes 1 byte o much and might cause alignment issues on some architectures? | |
2702 | 279 for(i=0; i<num_pixels; i++) |
2718 | 280 ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; |
2697 | 281 */ |
2702 | 282 for(i=0; i<num_pixels; i++) |
2697 | 283 { |
284 //FIXME slow? | |
285 dst[0]= palette[ src[i]*4+0 ]; | |
286 dst[1]= palette[ src[i]*4+1 ]; | |
287 dst[2]= palette[ src[i]*4+2 ]; | |
288 dst+= 3; | |
289 } | |
290 } | |
291 | |
6484
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
292 void bgr24torgb24(const uint8_t *src, uint8_t *dst, unsigned src_size) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
293 { |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
294 #ifdef CAN_COMPILE_X86_ASM |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
295 // ordered per speed fasterst first |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
296 if(gCpuCaps.hasMMX2) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
297 bgr24torgb24_MMX2(src, dst, src_size); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
298 else if(gCpuCaps.has3DNow) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
299 bgr24torgb24_3DNow(src, dst, src_size); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
300 else if(gCpuCaps.hasMMX) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
301 bgr24torgb24_MMX(src, dst, src_size); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
302 else |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
303 bgr24torgb24_C(src, dst, src_size); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
304 #else |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
305 bgr24torgb24_C(src, dst, src_size); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
306 #endif |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
307 } |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
308 |
2718 | 309 void rgb32to16(const uint8_t *src, uint8_t *dst, unsigned src_size) |
2694 | 310 { |
3132 | 311 #ifdef CAN_COMPILE_X86_ASM |
312 // ordered per speed fasterst first | |
313 if(gCpuCaps.hasMMX2) | |
314 rgb32to16_MMX2(src, dst, src_size); | |
315 else if(gCpuCaps.has3DNow) | |
316 rgb32to16_3DNow(src, dst, src_size); | |
317 else if(gCpuCaps.hasMMX) | |
318 rgb32to16_MMX(src, dst, src_size); | |
319 else | |
6492 | 320 #endif |
3132 | 321 rgb32to16_C(src, dst, src_size); |
2694 | 322 } |
323 | |
2718 | 324 void rgb32to15(const uint8_t *src, uint8_t *dst, unsigned src_size) |
2694 | 325 { |
3132 | 326 #ifdef CAN_COMPILE_X86_ASM |
327 // ordered per speed fasterst first | |
328 if(gCpuCaps.hasMMX2) | |
329 rgb32to15_MMX2(src, dst, src_size); | |
330 else if(gCpuCaps.has3DNow) | |
331 rgb32to15_3DNow(src, dst, src_size); | |
332 else if(gCpuCaps.hasMMX) | |
333 rgb32to15_MMX(src, dst, src_size); | |
334 else | |
6492 | 335 #endif |
3132 | 336 rgb32to15_C(src, dst, src_size); |
2694 | 337 } |
338 | |
2718 | 339 void rgb24to16(const uint8_t *src, uint8_t *dst, unsigned src_size) |
340 { | |
3132 | 341 #ifdef CAN_COMPILE_X86_ASM |
342 // ordered per speed fasterst first | |
343 if(gCpuCaps.hasMMX2) | |
344 rgb24to16_MMX2(src, dst, src_size); | |
345 else if(gCpuCaps.has3DNow) | |
346 rgb24to16_3DNow(src, dst, src_size); | |
347 else if(gCpuCaps.hasMMX) | |
348 rgb24to16_MMX(src, dst, src_size); | |
349 else | |
6492 | 350 #endif |
3132 | 351 rgb24to16_C(src, dst, src_size); |
2718 | 352 } |
353 | |
354 void rgb24to15(const uint8_t *src, uint8_t *dst, unsigned src_size) | |
355 { | |
3132 | 356 #ifdef CAN_COMPILE_X86_ASM |
357 // ordered per speed fasterst first | |
358 if(gCpuCaps.hasMMX2) | |
359 rgb24to15_MMX2(src, dst, src_size); | |
360 else if(gCpuCaps.has3DNow) | |
361 rgb24to15_3DNow(src, dst, src_size); | |
362 else if(gCpuCaps.hasMMX) | |
363 rgb24to15_MMX(src, dst, src_size); | |
364 else | |
6492 | 365 #endif |
3132 | 366 rgb24to15_C(src, dst, src_size); |
2718 | 367 } |
2694 | 368 |
369 /** | |
370 * Palette is assumed to contain bgr16, see rgb32to16 to convert the palette | |
371 */ | |
2718 | 372 void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2694 | 373 { |
2718 | 374 unsigned i; |
2702 | 375 for(i=0; i<num_pixels; i++) |
2694 | 376 ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; |
377 } | |
378 | |
379 /** | |
380 * Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette | |
381 */ | |
2718 | 382 void palette8torgb15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) |
2694 | 383 { |
2718 | 384 unsigned i; |
2702 | 385 for(i=0; i<num_pixels; i++) |
2694 | 386 ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; |
2697 | 387 } |
2755 | 388 |
389 void rgb32tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) | |
390 { | |
3132 | 391 #ifdef CAN_COMPILE_X86_ASM |
392 // ordered per speed fasterst first | |
393 if(gCpuCaps.hasMMX2) | |
394 rgb32tobgr32_MMX2(src, dst, src_size); | |
395 else if(gCpuCaps.has3DNow) | |
396 rgb32tobgr32_3DNow(src, dst, src_size); | |
397 else if(gCpuCaps.hasMMX) | |
398 rgb32tobgr32_MMX(src, dst, src_size); | |
399 else | |
6492 | 400 #endif |
3132 | 401 rgb32tobgr32_C(src, dst, src_size); |
2755 | 402 } |
403 | |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
404 void rgb32tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
405 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
406 unsigned i; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
407 unsigned num_pixels = src_size >> 2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
408 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
409 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
410 dst[3*i + 0] = src[4*i + 2]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
411 dst[3*i + 1] = src[4*i + 1]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
412 dst[3*i + 2] = src[4*i + 0]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
413 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
414 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
415 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
416 void rgb32tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
417 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
418 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
419 // ordered per speed fasterst first |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
420 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
421 rgb32tobgr16_MMX2(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
422 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
423 rgb32tobgr16_3DNow(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
424 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
425 rgb32tobgr16_MMX(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
426 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
427 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
428 rgb32tobgr16_C(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
429 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
430 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
431 void rgb32tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
432 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
433 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
434 // ordered per speed fasterst first |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
435 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
436 rgb32tobgr15_MMX2(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
437 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
438 rgb32tobgr15_3DNow(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
439 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
440 rgb32tobgr15_MMX(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
441 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
442 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
443 rgb32tobgr15_C(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
444 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
445 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
446 void rgb24tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
447 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
448 unsigned i; |
6614 | 449 for(i=0; 3*i<src_size; i++) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
450 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
451 dst[4*i + 0] = src[3*i + 2]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
452 dst[4*i + 1] = src[3*i + 1]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
453 dst[4*i + 2] = src[3*i + 0]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
454 dst[4*i + 3] = 0; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
455 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
456 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
457 |
5582 | 458 void rgb24tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
459 { | |
460 #ifdef CAN_COMPILE_X86_ASM | |
461 // ordered per speed fasterst first | |
462 if(gCpuCaps.hasMMX2) | |
463 rgb24tobgr24_MMX2(src, dst, src_size); | |
464 else if(gCpuCaps.has3DNow) | |
465 rgb24tobgr24_3DNow(src, dst, src_size); | |
466 else if(gCpuCaps.hasMMX) | |
467 rgb24tobgr24_MMX(src, dst, src_size); | |
468 else | |
6492 | 469 #endif |
5582 | 470 rgb24tobgr24_C(src, dst, src_size); |
471 } | |
472 | |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
473 void rgb24tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
474 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
475 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
476 // ordered per speed fasterst first |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
477 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
478 rgb24tobgr16_MMX2(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
479 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
480 rgb24tobgr16_3DNow(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
481 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
482 rgb24tobgr16_MMX(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
483 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
484 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
485 rgb24tobgr16_C(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
486 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
487 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
488 void rgb24tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
489 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
490 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
491 // ordered per speed fasterst first |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
492 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
493 rgb24tobgr15_MMX2(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
494 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
495 rgb24tobgr15_3DNow(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
496 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
497 rgb24tobgr15_MMX(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
498 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
499 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
500 rgb24tobgr15_C(src, dst, src_size); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
501 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
502 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
503 void rgb16tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
504 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
505 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
506 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
507 const uint16_t *s = (uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
508 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
509 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
510 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
511 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
512 bgr = *s++; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
513 *d++ = (bgr&0xF800)>>8; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
514 *d++ = (bgr&0x7E0)>>3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
515 *d++ = (bgr&0x1F)<<3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
516 *d++ = 0; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
517 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
518 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
519 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
520 void rgb16tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
521 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
522 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
523 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
524 const uint16_t *s = (const uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
525 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
526 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
527 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
528 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
529 bgr = *s++; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
530 *d++ = (bgr&0xF800)>>8; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
531 *d++ = (bgr&0x7E0)>>3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
532 *d++ = (bgr&0x1F)<<3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
533 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
534 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
535 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
536 void rgb16tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
537 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
538 unsigned i; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
539 unsigned num_pixels = src_size >> 1; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
540 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
541 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
542 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
543 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
544 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
545 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
546 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
547 g = (rgb&0x7E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
548 b = (rgb&0xF800)>>11; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
549 dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
550 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
551 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
552 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
553 void rgb16tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
554 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
555 unsigned i; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
556 unsigned num_pixels = src_size >> 1; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
557 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
558 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
559 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
560 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
561 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
562 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
563 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
564 g = (rgb&0x7E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
565 b = (rgb&0xF800)>>11; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
566 dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
567 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
568 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
569 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
570 void rgb15tobgr32(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
571 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
572 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
573 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
574 const uint16_t *s = (const uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
575 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
576 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
577 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
578 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
579 bgr = *s++; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
580 *d++ = (bgr&0x7C00)>>7; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
581 *d++ = (bgr&0x3E0)>>2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
582 *d++ = (bgr&0x1F)<<3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
583 *d++ = 0; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
584 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
585 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
586 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
587 void rgb15tobgr24(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
588 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
589 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
590 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
591 const uint16_t *s = (uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
592 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
593 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
594 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
595 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
596 bgr = *s++; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
597 *d++ = (bgr&0x7C00)>>7; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
598 *d++ = (bgr&0x3E0)>>2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
599 *d++ = (bgr&0x1F)<<3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
600 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
601 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
602 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
603 void rgb15tobgr16(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
604 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
605 unsigned i; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
606 unsigned num_pixels = src_size >> 1; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
607 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
608 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
609 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
610 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
611 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
612 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
613 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
614 g = (rgb&0x3E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
615 b = (rgb&0x7C00)>>10; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
616 dst[2*i] = (b&0x1F) | ((g&0x3F)<<5) | ((r&0x1F)<<11); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
617 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
618 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
619 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
620 void rgb15tobgr15(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
621 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
622 unsigned i; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
623 unsigned num_pixels = src_size >> 1; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
624 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
625 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
626 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
627 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
628 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
629 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
630 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
631 g = (rgb&0x3E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
632 b = (rgb&0x7C00)>>10; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
633 dst[2*i] = (b&0x1F) | ((g&0x1F)<<5) | ((r&0x1F)<<10); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
634 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
635 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
636 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
637 void rgb8tobgr8(const uint8_t *src, uint8_t *dst, unsigned int src_size) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
638 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
639 unsigned i; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
640 unsigned num_pixels = src_size; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
641 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
642 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
643 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
644 register uint8_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
645 rgb = src[i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
646 r = (rgb&0x07); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
647 g = (rgb&0x38)>>3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
648 b = (rgb&0xC0)>>6; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
649 dst[i] = ((b<<1)&0x07) | ((g&0x07)<<3) | ((r&0x03)<<6); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
650 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
651 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
652 |
2702 | 653 /** |
654 * | |
2724 | 655 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a |
656 * problem for anyone then tell me, and ill fix it) | |
2702 | 657 */ |
2723 | 658 void yv12toyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
2725 | 659 unsigned int width, unsigned int height, |
660 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride) | |
2701 | 661 { |
3132 | 662 #ifdef CAN_COMPILE_X86_ASM |
663 // ordered per speed fasterst first | |
664 if(gCpuCaps.hasMMX2) | |
665 yv12toyuy2_MMX2(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
666 else if(gCpuCaps.has3DNow) | |
667 yv12toyuy2_3DNow(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
668 else if(gCpuCaps.hasMMX) | |
669 yv12toyuy2_MMX(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
670 else | |
6492 | 671 #endif |
3132 | 672 yv12toyuy2_C(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); |
2701 | 673 } |
674 | |
2724 | 675 /** |
676 * | |
5588 | 677 * width should be a multiple of 16 |
678 */ | |
679 void yuv422ptoyuy2(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | |
680 unsigned int width, unsigned int height, | |
681 unsigned int lumStride, unsigned int chromStride, unsigned int dstStride) | |
682 { | |
683 #ifdef CAN_COMPILE_X86_ASM | |
684 // ordered per speed fasterst first | |
685 if(gCpuCaps.hasMMX2) | |
686 yuv422ptoyuy2_MMX2(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
687 else if(gCpuCaps.has3DNow) | |
688 yuv422ptoyuy2_3DNow(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
689 else if(gCpuCaps.hasMMX) | |
690 yuv422ptoyuy2_MMX(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); | |
691 else | |
6492 | 692 #endif |
5588 | 693 yuv422ptoyuy2_C(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride); |
694 } | |
695 | |
696 /** | |
697 * | |
2724 | 698 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a |
699 * problem for anyone then tell me, and ill fix it) | |
700 */ | |
701 void yuy2toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
2725 | 702 unsigned int width, unsigned int height, |
703 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) | |
2701 | 704 { |
3132 | 705 #ifdef CAN_COMPILE_X86_ASM |
706 // ordered per speed fasterst first | |
707 if(gCpuCaps.hasMMX2) | |
708 yuy2toyv12_MMX2(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
709 else if(gCpuCaps.has3DNow) | |
710 yuy2toyv12_3DNow(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
711 else if(gCpuCaps.hasMMX) | |
712 yuy2toyv12_MMX(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
713 else | |
6492 | 714 #endif |
3132 | 715 yuy2toyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); |
2723 | 716 } |
2801 | 717 |
718 /** | |
719 * | |
720 * height should be a multiple of 2 and width should be a multiple of 16 (if this is a | |
721 * problem for anyone then tell me, and ill fix it) | |
3132 | 722 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version |
2801 | 723 */ |
724 void uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
725 unsigned int width, unsigned int height, | |
726 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) | |
727 { | |
3132 | 728 #ifdef CAN_COMPILE_X86_ASM |
729 // ordered per speed fasterst first | |
730 if(gCpuCaps.hasMMX2) | |
731 uyvytoyv12_MMX2(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
732 else if(gCpuCaps.has3DNow) | |
733 uyvytoyv12_3DNow(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
734 else if(gCpuCaps.hasMMX) | |
735 uyvytoyv12_MMX(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
736 else | |
737 uyvytoyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
2847 | 738 #else |
3132 | 739 uyvytoyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); |
2847 | 740 #endif |
2801 | 741 } |
742 | |
6484
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
743 void yvu9toyv12(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
744 uint8_t *ydst, uint8_t *udst, uint8_t *vdst, |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
745 unsigned int width, unsigned int height, |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
746 unsigned int lumStride, unsigned int chromStride) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
747 { |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
748 #ifdef CAN_COMPILE_X86_ASM |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
749 // ordered per speed fasterst first |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
750 if(gCpuCaps.hasMMX2) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
751 yvu9toyv12_MMX2(ysrc, usrc, vsrc, ydst, udst, vdst, width, height, lumStride, chromStride); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
752 else if(gCpuCaps.has3DNow) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
753 yvu9toyv12_3DNow(ysrc, usrc, vsrc, ydst, udst, vdst, width, height, lumStride, chromStride); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
754 else if(gCpuCaps.hasMMX) |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
755 yvu9toyv12_MMX(ysrc, usrc, vsrc, ydst, udst, vdst, width, height, lumStride, chromStride); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
756 else |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
757 yvu9toyv12_C(ysrc, usrc, vsrc, ydst, udst, vdst, width, height, lumStride, chromStride); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
758 #else |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
759 yvu9toyv12_C(ysrc, usrc, vsrc, ydst, udst, vdst, width, height, lumStride, chromStride); |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
760 #endif |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
761 } |
c5cf988c6d6f
pre-yvu9toyv12 converter, only grayscale Y-plane coping :)
alex
parents:
5588
diff
changeset
|
762 |
6582
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
763 void planar2x(const uint8_t *src, uint8_t *dst, int width, int height, int srcStride, int dstStride) |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
764 { |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
765 #ifdef CAN_COMPILE_X86_ASM |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
766 // ordered per speed fasterst first |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
767 if(gCpuCaps.hasMMX2) |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
768 planar2x_MMX2(src, dst, width, height, srcStride, dstStride); |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
769 else if(gCpuCaps.has3DNow) |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
770 planar2x_3DNow(src, dst, width, height, srcStride, dstStride); |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
771 else |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
772 #endif |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
773 planar2x_C(src, dst, width, height, srcStride, dstStride); |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
774 } |
f98313dcd428
yvu9 -> yv12 unscaled converter with linear chroma scaling
michael
parents:
6492
diff
changeset
|
775 |
3132 | 776 /** |
777 * | |
778 * height should be a multiple of 2 and width should be a multiple of 2 (if this is a | |
779 * problem for anyone then tell me, and ill fix it) | |
780 * chrominance data is only taken from every secound line others are ignored FIXME write HQ version | |
781 */ | |
782 void rgb24toyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | |
783 unsigned int width, unsigned int height, | |
784 unsigned int lumStride, unsigned int chromStride, unsigned int srcStride) | |
785 { | |
786 #ifdef CAN_COMPILE_X86_ASM | |
787 // ordered per speed fasterst first | |
788 if(gCpuCaps.hasMMX2) | |
789 rgb24toyv12_MMX2(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
790 else if(gCpuCaps.has3DNow) | |
791 rgb24toyv12_3DNow(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
792 else if(gCpuCaps.hasMMX) | |
793 rgb24toyv12_MMX(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); | |
794 else | |
6492 | 795 #endif |
3132 | 796 rgb24toyv12_C(src, ydst, udst, vdst, width, height, lumStride, chromStride, srcStride); |
797 } | |
5337 | 798 |
799 void interleaveBytes(uint8_t *src1, uint8_t *src2, uint8_t *dst, | |
6492 | 800 unsigned width, unsigned height, unsigned src1Stride, |
801 unsigned src2Stride, unsigned dstStride) | |
5337 | 802 { |
803 #ifdef CAN_COMPILE_X86_ASM | |
804 // ordered per speed fasterst first | |
805 if(gCpuCaps.hasMMX2) | |
806 interleaveBytes_MMX2(src1, src2, dst, width, height, src1Stride, src2Stride, dstStride); | |
807 else if(gCpuCaps.has3DNow) | |
808 interleaveBytes_3DNow(src1, src2, dst, width, height, src1Stride, src2Stride, dstStride); | |
809 else if(gCpuCaps.hasMMX) | |
810 interleaveBytes_MMX(src1, src2, dst, width, height, src1Stride, src2Stride, dstStride); | |
811 else | |
6492 | 812 #endif |
5337 | 813 interleaveBytes_C(src1, src2, dst, width, height, src1Stride, src2Stride, dstStride); |
814 } | |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
815 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
816 void vu9_to_vu12(const uint8_t *src1, const uint8_t *src2, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
817 uint8_t *dst1, uint8_t *dst2, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
818 unsigned width, unsigned height, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
819 unsigned srcStride1, unsigned srcStride2, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
820 unsigned dstStride1, unsigned dstStride2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
821 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
822 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
823 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
824 vu9_to_vu12_MMX2(src1, src2, dst1, dst2, width, height, srcStride1, srcStride2, dstStride1, dstStride2); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
825 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
826 vu9_to_vu12_3DNow(src1, src2, dst1, dst2, width, height, srcStride1, srcStride2, dstStride1, dstStride2); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
827 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
828 vu9_to_vu12_MMX(src1, src2, dst1, dst2, width, height, srcStride1, srcStride2, dstStride1, dstStride2); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
829 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
830 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
831 vu9_to_vu12_C(src1, src2, dst1, dst2, width, height, srcStride1, srcStride2, dstStride1, dstStride2); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
832 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
833 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
834 void yvu9_to_yuy2(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
835 uint8_t *dst, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
836 unsigned width, unsigned height, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
837 unsigned srcStride1, unsigned srcStride2, |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
838 unsigned srcStride3, unsigned dstStride) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
839 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
840 #ifdef CAN_COMPILE_X86_ASM |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
841 if(gCpuCaps.hasMMX2) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
842 yvu9_to_yuy2_MMX2(src1, src2, src3, dst, width, height, srcStride1, srcStride2, srcStride3, dstStride); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
843 else if(gCpuCaps.has3DNow) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
844 yvu9_to_yuy2_3DNow(src1, src2, src3, dst, width, height, srcStride1, srcStride2, srcStride3, dstStride); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
845 else if(gCpuCaps.hasMMX) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
846 yvu9_to_yuy2_MMX(src1, src2, src3, dst, width, height, srcStride1, srcStride2, srcStride3, dstStride); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
847 else |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
848 #endif |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
849 yvu9_to_yuy2_C(src1, src2, src3, dst, width, height, srcStride1, srcStride2, srcStride3, dstStride); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
850 } |