annotate postproc/rgb2rgb.c @ 7165:379852905f31

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