annotate postproc/rgb2rgb.c @ 15597:aa7224b06f8c

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