Mercurial > mplayer.hg
annotate postproc/rgb2rgb.c @ 18803:c56ae984dbc1
static-ized a couple of functions
author | nicodvb |
---|---|
date | Sat, 24 Jun 2006 09:27:07 +0000 |
parents | e1108996497c |
children |
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> |
16985 | 11 #include "config.h" |
2504 | 12 #include "rgb2rgb.h" |
9987 | 13 #include "swscale.h" |
16985 | 14 #include "cpudetect.h" |
15 #include "mangle.h" | |
16 #include "bswap.h" | |
17 #include "libvo/fastmemcpy.h" | |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
18 |
4622 | 19 #define FAST_BGR2YV12 // use 7 bit coeffs instead of 15bit |
20 | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
21 void (*rgb24to32)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
22 void (*rgb24to16)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
23 void (*rgb24to15)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
24 void (*rgb32to24)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
25 void (*rgb32to16)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
26 void (*rgb32to15)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
27 void (*rgb15to16)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
28 void (*rgb15to24)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
29 void (*rgb15to32)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
30 void (*rgb16to15)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
31 void (*rgb16to24)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
32 void (*rgb16to32)(const uint8_t *src,uint8_t *dst,long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
33 //void (*rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
34 void (*rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
35 void (*rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
36 void (*rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
37 void (*rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
38 //void (*rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
39 void (*rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long src_size); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
40 void (*rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long src_size); |
9987 | 41 |
42 void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
43 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
44 long lumStride, long chromStride, long dstStride); |
11068 | 45 void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
46 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
47 long lumStride, long chromStride, long dstStride); |
9987 | 48 void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
49 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
50 long lumStride, long chromStride, long dstStride); |
9987 | 51 void (*yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
52 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
53 long lumStride, long chromStride, long srcStride); |
9987 | 54 void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
55 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
56 long lumStride, long chromStride, long srcStride); |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
57 void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
58 long srcStride, long dstStride); |
9987 | 59 void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst, |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
60 long width, long height, long src1Stride, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
61 long src2Stride, long dstStride); |
9987 | 62 void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2, |
63 uint8_t *dst1, uint8_t *dst2, | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
64 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
65 long srcStride1, long srcStride2, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
66 long dstStride1, long dstStride2); |
9987 | 67 void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, |
68 uint8_t *dst, | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
69 long width, long height, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
70 long srcStride1, long srcStride2, |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
71 long srcStride3, long dstStride); |
9987 | 72 |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12301
diff
changeset
|
73 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
6492 | 74 static const uint64_t mmx_null __attribute__((aligned(8))) = 0x0000000000000000ULL; |
75 static const uint64_t mmx_one __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL; | |
12301
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
76 static const uint64_t mask32b attribute_used __attribute__((aligned(8))) = 0x000000FF000000FFULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
77 static const uint64_t mask32g attribute_used __attribute__((aligned(8))) = 0x0000FF000000FF00ULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
78 static const uint64_t mask32r attribute_used __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
|
79 static const uint64_t mask32 __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL; |
9454 | 80 static const uint64_t mask3216br __attribute__((aligned(8)))=0x00F800F800F800F8ULL; |
81 static const uint64_t mask3216g __attribute__((aligned(8)))=0x0000FC000000FC00ULL; | |
82 static const uint64_t mask3215g __attribute__((aligned(8)))=0x0000F8000000F800ULL; | |
83 static const uint64_t mul3216 __attribute__((aligned(8))) = 0x2000000420000004ULL; | |
84 static const uint64_t mul3215 __attribute__((aligned(8))) = 0x2000000820000008ULL; | |
12301
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
85 static const uint64_t mask24b attribute_used __attribute__((aligned(8))) = 0x00FF0000FF0000FFULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
86 static const uint64_t mask24g attribute_used __attribute__((aligned(8))) = 0xFF0000FF0000FF00ULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
87 static const uint64_t mask24r attribute_used __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
|
88 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
|
89 static const uint64_t mask24h __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL; |
2746
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
90 static const uint64_t mask24hh __attribute__((aligned(8))) = 0xffff000000000000ULL; |
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
91 static const uint64_t mask24hhh __attribute__((aligned(8))) = 0xffffffff00000000ULL; |
dece635a28e3
Minor speedup of rgb32to24. (performance is not successful)
nick
parents:
2741
diff
changeset
|
92 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
|
93 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
|
94 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
|
95 static const uint64_t mask15s __attribute__((aligned(8))) = 0xFFE0FFE0FFE0FFE0ULL; |
6492 | 96 static const uint64_t mask15g __attribute__((aligned(8))) = 0x03E003E003E003E0ULL; |
97 static const uint64_t mask15r __attribute__((aligned(8))) = 0x7C007C007C007C00ULL; | |
98 #define mask16b mask15b | |
99 static const uint64_t mask16g __attribute__((aligned(8))) = 0x07E007E007E007E0ULL; | |
100 static const uint64_t mask16r __attribute__((aligned(8))) = 0xF800F800F800F800ULL; | |
2741 | 101 static const uint64_t red_16mask __attribute__((aligned(8))) = 0x0000f8000000f800ULL; |
102 static const uint64_t green_16mask __attribute__((aligned(8)))= 0x000007e0000007e0ULL; | |
103 static const uint64_t blue_16mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; | |
104 static const uint64_t red_15mask __attribute__((aligned(8))) = 0x00007c000000f800ULL; | |
105 static const uint64_t green_15mask __attribute__((aligned(8)))= 0x000003e0000007e0ULL; | |
106 static const uint64_t blue_15mask __attribute__((aligned(8))) = 0x0000001f0000001fULL; | |
4622 | 107 |
108 #ifdef FAST_BGR2YV12 | |
12301
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
109 static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000000210041000DULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
110 static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
111 static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL; |
4622 | 112 #else |
12301
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
113 static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000020E540830C8BULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
114 static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
115 static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL; |
4622 | 116 #endif |
12301
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
117 static const uint64_t bgr2YOffset attribute_used __attribute__((aligned(8))) = 0x1010101010101010ULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
118 static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8)))= 0x8080808080808080ULL; |
b80f95e24c96
attribute_used patch by (matthieu castet <castet.matthieu at free dot fr>)
michael
parents:
11071
diff
changeset
|
119 static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0x0001000100010001ULL; |
4622 | 120 |
2755 | 121 #if 0 |
122 static volatile uint64_t __attribute__((aligned(8))) b5Dither; | |
123 static volatile uint64_t __attribute__((aligned(8))) g5Dither; | |
124 static volatile uint64_t __attribute__((aligned(8))) g6Dither; | |
125 static volatile uint64_t __attribute__((aligned(8))) r5Dither; | |
126 | |
127 static uint64_t __attribute__((aligned(8))) dither4[2]={ | |
128 0x0103010301030103LL, | |
129 0x0200020002000200LL,}; | |
130 | |
131 static uint64_t __attribute__((aligned(8))) dither8[2]={ | |
132 0x0602060206020602LL, | |
133 0x0004000400040004LL,}; | |
134 #endif | |
2535 | 135 #endif |
2513 | 136 |
3132 | 137 #define RGB2YUV_SHIFT 8 |
138 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) | |
139 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) | |
140 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) | |
141 #define GY ((int)( 0.504*(1<<RGB2YUV_SHIFT)+0.5)) | |
142 #define GV ((int)(-0.368*(1<<RGB2YUV_SHIFT)+0.5)) | |
143 #define GU ((int)(-0.291*(1<<RGB2YUV_SHIFT)+0.5)) | |
144 #define RY ((int)( 0.257*(1<<RGB2YUV_SHIFT)+0.5)) | |
145 #define RV ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) | |
146 #define RU ((int)(-0.148*(1<<RGB2YUV_SHIFT)+0.5)) | |
147 | |
148 //Note: we have C, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one | |
149 //Plain C versions | |
150 #undef HAVE_MMX | |
151 #undef HAVE_MMX2 | |
152 #undef HAVE_3DNOW | |
5338 | 153 #undef HAVE_SSE2 |
3132 | 154 #define RENAME(a) a ## _C |
155 #include "rgb2rgb_template.c" | |
156 | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12301
diff
changeset
|
157 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
3132 | 158 |
159 //MMX versions | |
160 #undef RENAME | |
161 #define HAVE_MMX | |
162 #undef HAVE_MMX2 | |
163 #undef HAVE_3DNOW | |
5338 | 164 #undef HAVE_SSE2 |
3132 | 165 #define RENAME(a) a ## _MMX |
166 #include "rgb2rgb_template.c" | |
167 | |
168 //MMX2 versions | |
169 #undef RENAME | |
170 #define HAVE_MMX | |
171 #define HAVE_MMX2 | |
172 #undef HAVE_3DNOW | |
5338 | 173 #undef HAVE_SSE2 |
3132 | 174 #define RENAME(a) a ## _MMX2 |
175 #include "rgb2rgb_template.c" | |
176 | |
177 //3DNOW versions | |
178 #undef RENAME | |
179 #define HAVE_MMX | |
180 #undef HAVE_MMX2 | |
181 #define HAVE_3DNOW | |
5338 | 182 #undef HAVE_SSE2 |
11071 | 183 #define RENAME(a) a ## _3DNOW |
3132 | 184 #include "rgb2rgb_template.c" |
185 | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12301
diff
changeset
|
186 #endif //ARCH_X86 || ARCH_X86_64 |
2506 | 187 |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
188 /* |
9987 | 189 rgb15->rgb16 Original by Strepto/Astral |
2538
71320898b333
Finish mmx2, 3dnow optimiz. 15to16 should be tested. Better fix of can't compile
nick
parents:
2535
diff
changeset
|
190 ported to gcc & bugfixed : A'rpi |
2564 | 191 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
|
192 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
|
193 */ |
9987 | 194 |
195 void sws_rgb2rgb_init(int flags){ | |
13720
821f464b4d90
adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
aurel
parents:
12301
diff
changeset
|
196 #if defined(ARCH_X86) || defined(ARCH_X86_64) |
9987 | 197 if(flags & SWS_CPU_CAPS_MMX2){ |
198 rgb15to16= rgb15to16_MMX2; | |
199 rgb15to24= rgb15to24_MMX2; | |
200 rgb15to32= rgb15to32_MMX2; | |
201 rgb16to24= rgb16to24_MMX2; | |
202 rgb16to32= rgb16to32_MMX2; | |
203 rgb16to15= rgb16to15_MMX2; | |
204 rgb24to16= rgb24to16_MMX2; | |
205 rgb24to15= rgb24to15_MMX2; | |
206 rgb24to32= rgb24to32_MMX2; | |
207 rgb32to16= rgb32to16_MMX2; | |
208 rgb32to15= rgb32to15_MMX2; | |
209 rgb32to24= rgb32to24_MMX2; | |
210 rgb24tobgr15= rgb24tobgr15_MMX2; | |
211 rgb24tobgr16= rgb24tobgr16_MMX2; | |
212 rgb24tobgr24= rgb24tobgr24_MMX2; | |
213 rgb32tobgr32= rgb32tobgr32_MMX2; | |
214 rgb32tobgr16= rgb32tobgr16_MMX2; | |
215 rgb32tobgr15= rgb32tobgr15_MMX2; | |
216 yv12toyuy2= yv12toyuy2_MMX2; | |
11068 | 217 yv12touyvy= yv12touyvy_MMX2; |
9987 | 218 yuv422ptoyuy2= yuv422ptoyuy2_MMX2; |
219 yuy2toyv12= yuy2toyv12_MMX2; | |
11071 | 220 // uyvytoyv12= uyvytoyv12_MMX2; |
221 // yvu9toyv12= yvu9toyv12_MMX2; | |
9987 | 222 planar2x= planar2x_MMX2; |
223 rgb24toyv12= rgb24toyv12_MMX2; | |
224 interleaveBytes= interleaveBytes_MMX2; | |
225 vu9_to_vu12= vu9_to_vu12_MMX2; | |
226 yvu9_to_yuy2= yvu9_to_yuy2_MMX2; | |
227 }else if(flags & SWS_CPU_CAPS_3DNOW){ | |
228 rgb15to16= rgb15to16_3DNOW; | |
229 rgb15to24= rgb15to24_3DNOW; | |
230 rgb15to32= rgb15to32_3DNOW; | |
231 rgb16to24= rgb16to24_3DNOW; | |
232 rgb16to32= rgb16to32_3DNOW; | |
233 rgb16to15= rgb16to15_3DNOW; | |
234 rgb24to16= rgb24to16_3DNOW; | |
235 rgb24to15= rgb24to15_3DNOW; | |
236 rgb24to32= rgb24to32_3DNOW; | |
237 rgb32to16= rgb32to16_3DNOW; | |
238 rgb32to15= rgb32to15_3DNOW; | |
239 rgb32to24= rgb32to24_3DNOW; | |
240 rgb24tobgr15= rgb24tobgr15_3DNOW; | |
241 rgb24tobgr16= rgb24tobgr16_3DNOW; | |
242 rgb24tobgr24= rgb24tobgr24_3DNOW; | |
243 rgb32tobgr32= rgb32tobgr32_3DNOW; | |
244 rgb32tobgr16= rgb32tobgr16_3DNOW; | |
245 rgb32tobgr15= rgb32tobgr15_3DNOW; | |
246 yv12toyuy2= yv12toyuy2_3DNOW; | |
11068 | 247 yv12touyvy= yv12touyvy_3DNOW; |
9987 | 248 yuv422ptoyuy2= yuv422ptoyuy2_3DNOW; |
249 yuy2toyv12= yuy2toyv12_3DNOW; | |
11071 | 250 // uyvytoyv12= uyvytoyv12_3DNOW; |
251 // yvu9toyv12= yvu9toyv12_3DNOW; | |
9987 | 252 planar2x= planar2x_3DNOW; |
253 rgb24toyv12= rgb24toyv12_3DNOW; | |
254 interleaveBytes= interleaveBytes_3DNOW; | |
255 vu9_to_vu12= vu9_to_vu12_3DNOW; | |
256 yvu9_to_yuy2= yvu9_to_yuy2_3DNOW; | |
257 }else if(flags & SWS_CPU_CAPS_MMX){ | |
258 rgb15to16= rgb15to16_MMX; | |
259 rgb15to24= rgb15to24_MMX; | |
260 rgb15to32= rgb15to32_MMX; | |
261 rgb16to24= rgb16to24_MMX; | |
262 rgb16to32= rgb16to32_MMX; | |
263 rgb16to15= rgb16to15_MMX; | |
264 rgb24to16= rgb24to16_MMX; | |
265 rgb24to15= rgb24to15_MMX; | |
266 rgb24to32= rgb24to32_MMX; | |
267 rgb32to16= rgb32to16_MMX; | |
268 rgb32to15= rgb32to15_MMX; | |
269 rgb32to24= rgb32to24_MMX; | |
270 rgb24tobgr15= rgb24tobgr15_MMX; | |
271 rgb24tobgr16= rgb24tobgr16_MMX; | |
272 rgb24tobgr24= rgb24tobgr24_MMX; | |
273 rgb32tobgr32= rgb32tobgr32_MMX; | |
274 rgb32tobgr16= rgb32tobgr16_MMX; | |
275 rgb32tobgr15= rgb32tobgr15_MMX; | |
276 yv12toyuy2= yv12toyuy2_MMX; | |
11068 | 277 yv12touyvy= yv12touyvy_MMX; |
9987 | 278 yuv422ptoyuy2= yuv422ptoyuy2_MMX; |
279 yuy2toyv12= yuy2toyv12_MMX; | |
11071 | 280 // uyvytoyv12= uyvytoyv12_MMX; |
281 // yvu9toyv12= yvu9toyv12_MMX; | |
9987 | 282 planar2x= planar2x_MMX; |
283 rgb24toyv12= rgb24toyv12_MMX; | |
284 interleaveBytes= interleaveBytes_MMX; | |
285 vu9_to_vu12= vu9_to_vu12_MMX; | |
286 yvu9_to_yuy2= yvu9_to_yuy2_MMX; | |
287 }else | |
6492 | 288 #endif |
9987 | 289 { |
290 rgb15to16= rgb15to16_C; | |
291 rgb15to24= rgb15to24_C; | |
292 rgb15to32= rgb15to32_C; | |
293 rgb16to24= rgb16to24_C; | |
294 rgb16to32= rgb16to32_C; | |
295 rgb16to15= rgb16to15_C; | |
296 rgb24to16= rgb24to16_C; | |
297 rgb24to15= rgb24to15_C; | |
298 rgb24to32= rgb24to32_C; | |
299 rgb32to16= rgb32to16_C; | |
300 rgb32to15= rgb32to15_C; | |
301 rgb32to24= rgb32to24_C; | |
302 rgb24tobgr15= rgb24tobgr15_C; | |
303 rgb24tobgr16= rgb24tobgr16_C; | |
304 rgb24tobgr24= rgb24tobgr24_C; | |
305 rgb32tobgr32= rgb32tobgr32_C; | |
306 rgb32tobgr16= rgb32tobgr16_C; | |
307 rgb32tobgr15= rgb32tobgr15_C; | |
308 yv12toyuy2= yv12toyuy2_C; | |
11068 | 309 yv12touyvy= yv12touyvy_C; |
9987 | 310 yuv422ptoyuy2= yuv422ptoyuy2_C; |
311 yuy2toyv12= yuy2toyv12_C; | |
312 // uyvytoyv12= uyvytoyv12_C; | |
313 // yvu9toyv12= yvu9toyv12_C; | |
314 planar2x= planar2x_C; | |
315 rgb24toyv12= rgb24toyv12_C; | |
316 interleaveBytes= interleaveBytes_C; | |
317 vu9_to_vu12= vu9_to_vu12_C; | |
318 yvu9_to_yuy2= yvu9_to_yuy2_C; | |
319 } | |
2506 | 320 } |
2694 | 321 |
322 /** | |
323 * Pallete is assumed to contain bgr32 | |
324 */ | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
325 void palette8torgb32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
2694 | 326 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
327 long i; |
7334 | 328 |
329 /* | |
2702 | 330 for(i=0; i<num_pixels; i++) |
2718 | 331 ((unsigned *)dst)[i] = ((unsigned *)palette)[ src[i] ]; |
7334 | 332 */ |
333 | |
334 for(i=0; i<num_pixels; i++) | |
335 { | |
15277
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
336 #ifdef WORDS_BIGENDIAN |
17587 | 337 dst[3]= palette[ src[i]*4+2 ]; |
338 dst[2]= palette[ src[i]*4+1 ]; | |
339 dst[1]= palette[ src[i]*4+0 ]; | |
15277
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
340 #else |
7334 | 341 //FIXME slow? |
17587 | 342 dst[0]= palette[ src[i]*4+2 ]; |
343 dst[1]= palette[ src[i]*4+1 ]; | |
344 dst[2]= palette[ src[i]*4+0 ]; | |
345 //dst[3]= 0; /* do we need this cleansing? */ | |
15277
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
346 #endif |
7334 | 347 dst+= 4; |
348 } | |
2694 | 349 } |
350 | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
351 void palette8tobgr32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
352 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
353 long i; |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
354 for(i=0; i<num_pixels; i++) |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
355 { |
15277
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
356 #ifdef WORDS_BIGENDIAN |
17587 | 357 dst[3]= palette[ src[i]*4+0 ]; |
358 dst[2]= palette[ src[i]*4+1 ]; | |
359 dst[1]= palette[ src[i]*4+2 ]; | |
15277
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
360 #else |
17587 | 361 //FIXME slow? |
362 dst[0]= palette[ src[i]*4+0 ]; | |
363 dst[1]= palette[ src[i]*4+1 ]; | |
364 dst[2]= palette[ src[i]*4+2 ]; | |
365 //dst[3]= 0; /* do we need this cleansing? */ | |
15277
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
366 #endif |
fed5d4ab5e5f
fix palette8tobgr32/palette8torgb32 on big endian
nplourde
parents:
13720
diff
changeset
|
367 |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
368 dst+= 4; |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
369 } |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
370 } |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
371 |
2697 | 372 /** |
373 * Pallete is assumed to contain bgr32 | |
374 */ | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
375 void palette8torgb24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
2697 | 376 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
377 long i; |
2697 | 378 /* |
379 writes 1 byte o much and might cause alignment issues on some architectures? | |
2702 | 380 for(i=0; i<num_pixels; i++) |
2718 | 381 ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; |
2697 | 382 */ |
2702 | 383 for(i=0; i<num_pixels; i++) |
2697 | 384 { |
385 //FIXME slow? | |
7334 | 386 dst[0]= palette[ src[i]*4+2 ]; |
2697 | 387 dst[1]= palette[ src[i]*4+1 ]; |
7334 | 388 dst[2]= palette[ src[i]*4+0 ]; |
2697 | 389 dst+= 3; |
390 } | |
391 } | |
392 | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
393 void palette8tobgr24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
394 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
395 long i; |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
396 /* |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
397 writes 1 byte o much and might cause alignment issues on some architectures? |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
398 for(i=0; i<num_pixels; i++) |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
399 ((unsigned *)(&dst[i*3])) = ((unsigned *)palette)[ src[i] ]; |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
400 */ |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
401 for(i=0; i<num_pixels; i++) |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
402 { |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
403 //FIXME slow? |
7334 | 404 dst[0]= palette[ src[i]*4+0 ]; |
405 dst[1]= palette[ src[i]*4+1 ]; | |
406 dst[2]= palette[ src[i]*4+2 ]; | |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
407 dst+= 3; |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
408 } |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
409 } |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
410 |
2694 | 411 /** |
412 * Palette is assumed to contain bgr16, see rgb32to16 to convert the palette | |
413 */ | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
414 void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
2694 | 415 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
416 long i; |
2702 | 417 for(i=0; i<num_pixels; i++) |
2694 | 418 ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; |
419 } | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
420 void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
421 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
422 long i; |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
423 for(i=0; i<num_pixels; i++) |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
424 ((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[ src[i] ]); |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
425 } |
2694 | 426 |
427 /** | |
428 * Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette | |
429 */ | |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
430 void palette8torgb15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
2694 | 431 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
432 long i; |
2702 | 433 for(i=0; i<num_pixels; i++) |
2694 | 434 ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; |
2697 | 435 } |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
436 void palette8tobgr15(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette) |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
437 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
438 long i; |
7159
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
439 for(i=0; i<num_pixels; i++) |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
440 ((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[ src[i] ]); |
1df24fd752d0
added missing palette8tobgr pairs (hope it's correct)
alex
parents:
6614
diff
changeset
|
441 } |
2755 | 442 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
443 void rgb32tobgr24(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
444 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
445 long i; |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
446 long num_pixels = src_size >> 2; |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
447 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
448 { |
17586 | 449 #ifdef WORDS_BIGENDIAN |
17587 | 450 /* RGB32 (= A,B,G,R) -> BGR24 (= B,G,R) */ |
451 dst[3*i + 0] = src[4*i + 1]; | |
452 dst[3*i + 1] = src[4*i + 2]; | |
453 dst[3*i + 2] = src[4*i + 3]; | |
17586 | 454 #else |
17587 | 455 dst[3*i + 0] = src[4*i + 2]; |
456 dst[3*i + 1] = src[4*i + 1]; | |
457 dst[3*i + 2] = src[4*i + 0]; | |
17586 | 458 #endif |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
459 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
460 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
461 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
462 void rgb24tobgr32(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
463 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
464 long i; |
6614 | 465 for(i=0; 3*i<src_size; i++) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
466 { |
17586 | 467 #ifdef WORDS_BIGENDIAN |
17587 | 468 /* RGB24 (= R,G,B) -> BGR32 (= A,R,G,B) */ |
469 dst[4*i + 0] = 0; | |
470 dst[4*i + 1] = src[3*i + 0]; | |
471 dst[4*i + 2] = src[3*i + 1]; | |
472 dst[4*i + 3] = src[3*i + 2]; | |
17586 | 473 #else |
17587 | 474 dst[4*i + 0] = src[3*i + 2]; |
475 dst[4*i + 1] = src[3*i + 1]; | |
476 dst[4*i + 2] = src[3*i + 0]; | |
477 dst[4*i + 3] = 0; | |
17586 | 478 #endif |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
479 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
480 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
481 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
482 void rgb16tobgr32(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
483 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
484 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
485 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
486 const uint16_t *s = (uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
487 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
488 while(s < end) |
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 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
491 bgr = *s++; |
17586 | 492 #ifdef WORDS_BIGENDIAN |
17587 | 493 *d++ = 0; |
494 *d++ = (bgr&0x1F)<<3; | |
495 *d++ = (bgr&0x7E0)>>3; | |
496 *d++ = (bgr&0xF800)>>8; | |
17586 | 497 #else |
17587 | 498 *d++ = (bgr&0xF800)>>8; |
499 *d++ = (bgr&0x7E0)>>3; | |
500 *d++ = (bgr&0x1F)<<3; | |
501 *d++ = 0; | |
17586 | 502 #endif |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
503 } |
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 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
506 void rgb16tobgr24(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
507 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
508 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
509 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
510 const uint16_t *s = (const uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
511 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
512 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
513 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
514 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
515 bgr = *s++; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
516 *d++ = (bgr&0xF800)>>8; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
517 *d++ = (bgr&0x7E0)>>3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
518 *d++ = (bgr&0x1F)<<3; |
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 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
521 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
522 void rgb16tobgr16(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
523 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
524 long i; |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
525 long num_pixels = src_size >> 1; |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
526 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
527 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
528 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
529 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
530 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
531 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
532 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
533 g = (rgb&0x7E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
534 b = (rgb&0xF800)>>11; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
535 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
|
536 } |
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 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
539 void rgb16tobgr15(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
540 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
541 long i; |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
542 long num_pixels = src_size >> 1; |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
543 |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
544 for(i=0; i<num_pixels; i++) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
545 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
546 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
547 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
548 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
549 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
550 g = (rgb&0x7E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
551 b = (rgb&0xF800)>>11; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
552 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
|
553 } |
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 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
556 void rgb15tobgr32(const uint8_t *src, uint8_t *dst, long src_size) |
6606
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 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
559 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
560 const uint16_t *s = (const uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
561 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
562 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
563 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
564 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
565 bgr = *s++; |
17586 | 566 #ifdef WORDS_BIGENDIAN |
17587 | 567 *d++ = 0; |
568 *d++ = (bgr&0x1F)<<3; | |
569 *d++ = (bgr&0x3E0)>>2; | |
570 *d++ = (bgr&0x7C00)>>7; | |
17586 | 571 #else |
17587 | 572 *d++ = (bgr&0x7C00)>>7; |
573 *d++ = (bgr&0x3E0)>>2; | |
574 *d++ = (bgr&0x1F)<<3; | |
575 *d++ = 0; | |
17586 | 576 #endif |
6606
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 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
579 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
580 void rgb15tobgr24(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
581 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
582 const uint16_t *end; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
583 uint8_t *d = (uint8_t *)dst; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
584 const uint16_t *s = (uint16_t *)src; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
585 end = s + src_size/2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
586 while(s < end) |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
587 { |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
588 register uint16_t bgr; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
589 bgr = *s++; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
590 *d++ = (bgr&0x7C00)>>7; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
591 *d++ = (bgr&0x3E0)>>2; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
592 *d++ = (bgr&0x1F)<<3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
593 } |
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 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
596 void rgb15tobgr16(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
597 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
598 long i; |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
599 long num_pixels = src_size >> 1; |
6606
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 for(i=0; i<num_pixels; i++) |
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 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
604 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
605 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
606 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
607 g = (rgb&0x3E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
608 b = (rgb&0x7C00)>>10; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
609 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
|
610 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
611 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
612 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
613 void rgb15tobgr15(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
614 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
615 long i; |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
616 long num_pixels = src_size >> 1; |
6606
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 for(i=0; i<num_pixels; i++) |
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 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
621 register uint16_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
622 rgb = src[2*i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
623 r = rgb&0x1F; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
624 g = (rgb&0x3E0)>>5; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
625 b = (rgb&0x7C00)>>10; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
626 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
|
627 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
628 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
629 |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
630 void rgb8tobgr8(const uint8_t *src, uint8_t *dst, long src_size) |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
631 { |
16739
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
632 long i; |
e91f944f6ed9
Change unsigned->signed and int->long, this fits the asm code better on 64
reimar
parents:
15277
diff
changeset
|
633 long num_pixels = src_size; |
6606
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
634 for(i=0; i<num_pixels; i++) |
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 unsigned b,g,r; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
637 register uint8_t rgb; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
638 rgb = src[i]; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
639 r = (rgb&0x07); |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
640 g = (rgb&0x38)>>3; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
641 b = (rgb&0xC0)>>6; |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
642 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
|
643 } |
50b5d8367318
merging changes from mplayerxp (rgb2rgb*.{c,h} only)
michael
parents:
6582
diff
changeset
|
644 } |