comparison libswscale/rgb2rgb.c @ 28276:877336d3c598

Change semantic of CONFIG_*, HAVE_* and ARCH_*. They are now always defined to either 0 or 1.
author aurel
date Wed, 14 Jan 2009 00:13:56 +0000
parents 58f150fd75c7
children 99c49467ebbc
comparison
equal deleted inserted replaced
28275:0f61883f9047 28276:877336d3c598
86 uint8_t *dst, 86 uint8_t *dst,
87 long width, long height, 87 long width, long height,
88 long srcStride1, long srcStride2, 88 long srcStride1, long srcStride2,
89 long srcStride3, long dstStride); 89 long srcStride3, long dstStride);
90 90
91 #if defined(ARCH_X86) && defined(CONFIG_GPL) 91 #if ARCH_X86 && CONFIG_GPL
92 DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; 92 DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
93 DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL; 93 DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
94 DECLARE_ASM_CONST(8, uint64_t, mask32b) = 0x000000FF000000FFULL; 94 DECLARE_ASM_CONST(8, uint64_t, mask32b) = 0x000000FF000000FFULL;
95 DECLARE_ASM_CONST(8, uint64_t, mask32g) = 0x0000FF000000FF00ULL; 95 DECLARE_ASM_CONST(8, uint64_t, mask32g) = 0x0000FF000000FF00ULL;
96 DECLARE_ASM_CONST(8, uint64_t, mask32r) = 0x00FF000000FF0000ULL; 96 DECLARE_ASM_CONST(8, uint64_t, mask32r) = 0x00FF000000FF0000ULL;
120 DECLARE_ASM_CONST(8, uint64_t, green_16mask) = 0x000007e0000007e0ULL; 120 DECLARE_ASM_CONST(8, uint64_t, green_16mask) = 0x000007e0000007e0ULL;
121 DECLARE_ASM_CONST(8, uint64_t, blue_16mask) = 0x0000001f0000001fULL; 121 DECLARE_ASM_CONST(8, uint64_t, blue_16mask) = 0x0000001f0000001fULL;
122 DECLARE_ASM_CONST(8, uint64_t, red_15mask) = 0x00007c0000007c00ULL; 122 DECLARE_ASM_CONST(8, uint64_t, red_15mask) = 0x00007c0000007c00ULL;
123 DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL; 123 DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
124 DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; 124 DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
125 #endif /* defined(ARCH_X86) */ 125 #endif /* ARCH_X86 */
126 126
127 #define RGB2YUV_SHIFT 8 127 #define RGB2YUV_SHIFT 8
128 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) 128 #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
129 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5)) 129 #define BV ((int)(-0.071*(1<<RGB2YUV_SHIFT)+0.5))
130 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5)) 130 #define BU ((int)( 0.439*(1<<RGB2YUV_SHIFT)+0.5))
139 //plain C versions 139 //plain C versions
140 #undef HAVE_MMX 140 #undef HAVE_MMX
141 #undef HAVE_MMX2 141 #undef HAVE_MMX2
142 #undef HAVE_3DNOW 142 #undef HAVE_3DNOW
143 #undef HAVE_SSE2 143 #undef HAVE_SSE2
144 #define HAVE_MMX 0
145 #define HAVE_MMX2 0
146 #define HAVE_3DNOW 0
147 #define HAVE_SSE2 0
144 #define RENAME(a) a ## _C 148 #define RENAME(a) a ## _C
145 #include "rgb2rgb_template.c" 149 #include "rgb2rgb_template.c"
146 150
147 #if defined(ARCH_X86) && defined(CONFIG_GPL) 151 #if ARCH_X86 && CONFIG_GPL
148 152
149 //MMX versions 153 //MMX versions
150 #undef RENAME 154 #undef RENAME
151 #define HAVE_MMX 155 #undef HAVE_MMX
156 #define HAVE_MMX 1
157 #define RENAME(a) a ## _MMX
158 #include "rgb2rgb_template.c"
159
160 //MMX2 versions
161 #undef RENAME
162 #undef HAVE_MMX2
163 #define HAVE_MMX2 1
164 #define RENAME(a) a ## _MMX2
165 #include "rgb2rgb_template.c"
166
167 //3DNOW versions
168 #undef RENAME
152 #undef HAVE_MMX2 169 #undef HAVE_MMX2
153 #undef HAVE_3DNOW 170 #undef HAVE_3DNOW
154 #undef HAVE_SSE2 171 #define HAVE_MMX2 0
155 #define RENAME(a) a ## _MMX 172 #define HAVE_3DNOW 1
156 #include "rgb2rgb_template.c"
157
158 //MMX2 versions
159 #undef RENAME
160 #define HAVE_MMX
161 #define HAVE_MMX2
162 #undef HAVE_3DNOW
163 #undef HAVE_SSE2
164 #define RENAME(a) a ## _MMX2
165 #include "rgb2rgb_template.c"
166
167 //3DNOW versions
168 #undef RENAME
169 #define HAVE_MMX
170 #undef HAVE_MMX2
171 #define HAVE_3DNOW
172 #undef HAVE_SSE2
173 #define RENAME(a) a ## _3DNOW 173 #define RENAME(a) a ## _3DNOW
174 #include "rgb2rgb_template.c" 174 #include "rgb2rgb_template.c"
175 175
176 #endif //ARCH_X86 || ARCH_X86_64 176 #endif //ARCH_X86 || ARCH_X86_64
177 177
181 MMX2, 3DNOW optimization by Nick Kurshev 181 MMX2, 3DNOW optimization by Nick Kurshev
182 32-bit C version, and and&add trick by Michael Niedermayer 182 32-bit C version, and and&add trick by Michael Niedermayer
183 */ 183 */
184 184
185 void sws_rgb2rgb_init(int flags){ 185 void sws_rgb2rgb_init(int flags){
186 #if (defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX)) && defined(CONFIG_GPL) 186 #if (HAVE_MMX2 || HAVE_3DNOW || HAVE_MMX) && CONFIG_GPL
187 if (flags & SWS_CPU_CAPS_MMX2) 187 if (flags & SWS_CPU_CAPS_MMX2)
188 rgb2rgb_init_MMX2(); 188 rgb2rgb_init_MMX2();
189 else if (flags & SWS_CPU_CAPS_3DNOW) 189 else if (flags & SWS_CPU_CAPS_3DNOW)
190 rgb2rgb_init_3DNOW(); 190 rgb2rgb_init_3DNOW();
191 else if (flags & SWS_CPU_CAPS_MMX) 191 else if (flags & SWS_CPU_CAPS_MMX)
192 rgb2rgb_init_MMX(); 192 rgb2rgb_init_MMX();
193 else 193 else
194 #endif /* defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX) */ 194 #endif /* HAVE_MMX2 || HAVE_3DNOW || HAVE_MMX */
195 rgb2rgb_init_C(); 195 rgb2rgb_init_C();
196 } 196 }
197 197
198 /** 198 /**
199 * Convert the palette to the same packet 32-bit format as the palette 199 * Convert the palette to the same packet 32-bit format as the palette