comparison postproc/yuv2rgb.c @ 13720:821f464b4d90

adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64
author aurel
date Thu, 21 Oct 2004 11:55:20 +0000
parents d2aef091743c
children 08cac43f1e38
comparison
equal deleted inserted replaced
13719:43ecd6a73ec0 13720:821f464b4d90
154 { 2, 172, 1, 144, 2, 165, 0, 137, }, 154 { 2, 172, 1, 144, 2, 165, 0, 137, },
155 { 77, 23, 60, 15, 72, 21, 56, 14, }, 155 { 77, 23, 60, 15, 72, 21, 56, 14, },
156 }; 156 };
157 #endif 157 #endif
158 158
159 #ifdef ARCH_X86 159 #if defined(ARCH_X86) || defined(ARCH_X86_64)
160 160
161 /* hope these constant values are cache line aligned */ 161 /* hope these constant values are cache line aligned */
162 uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL; 162 uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
163 uint64_t attribute_used __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8ULL; 163 uint64_t attribute_used __attribute__((aligned(8))) mmx_redmask = 0xf8f8f8f8f8f8f8f8ULL;
164 uint64_t attribute_used __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfcULL; 164 uint64_t attribute_used __attribute__((aligned(8))) mmx_grnmask = 0xfcfcfcfcfcfcfcfcULL;
181 uint64_t __attribute__((aligned(8))) dither8[2]={ 181 uint64_t __attribute__((aligned(8))) dither8[2]={
182 0x0602060206020602LL, 182 0x0602060206020602LL,
183 0x0004000400040004LL,}; 183 0x0004000400040004LL,};
184 184
185 #undef HAVE_MMX 185 #undef HAVE_MMX
186 #undef ARCH_X86
187 186
188 //MMX versions 187 //MMX versions
189 #undef RENAME 188 #undef RENAME
190 #define HAVE_MMX 189 #define HAVE_MMX
191 #undef HAVE_MMX2 190 #undef HAVE_MMX2
192 #undef HAVE_3DNOW 191 #undef HAVE_3DNOW
193 #define ARCH_X86
194 #define RENAME(a) a ## _MMX 192 #define RENAME(a) a ## _MMX
195 #include "yuv2rgb_template.c" 193 #include "yuv2rgb_template.c"
196 194
197 //MMX2 versions 195 //MMX2 versions
198 #undef RENAME 196 #undef RENAME
199 #define HAVE_MMX 197 #define HAVE_MMX
200 #define HAVE_MMX2 198 #define HAVE_MMX2
201 #undef HAVE_3DNOW 199 #undef HAVE_3DNOW
202 #define ARCH_X86
203 #define RENAME(a) a ## _MMX2 200 #define RENAME(a) a ## _MMX2
204 #include "yuv2rgb_template.c" 201 #include "yuv2rgb_template.c"
205 202
206 #endif // CAN_COMPILE_X86_ASM 203 #endif // CAN_COMPILE_X86_ASM
207 204
581 dst_2[0]= out_2; 578 dst_2[0]= out_2;
582 EPILOG(1) 579 EPILOG(1)
583 580
584 SwsFunc yuv2rgb_get_func_ptr (SwsContext *c) 581 SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
585 { 582 {
586 #ifdef ARCH_X86 583 #if defined(ARCH_X86) || defined(ARCH_X86_64)
587 if(c->flags & SWS_CPU_CAPS_MMX2){ 584 if(c->flags & SWS_CPU_CAPS_MMX2){
588 switch(c->dstFormat){ 585 switch(c->dstFormat){
589 case IMGFMT_BGR32: return yuv420_rgb32_MMX2; 586 case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
590 case IMGFMT_BGR24: return yuv420_rgb24_MMX2; 587 case IMGFMT_BGR24: return yuv420_rgb24_MMX2;
591 case IMGFMT_BGR16: return yuv420_rgb16_MMX2; 588 case IMGFMT_BGR16: return yuv420_rgb16_MMX2;