comparison libpostproc/postprocess.c @ 2293:15cfba1b97b5 libavcodec

adapting existing mmx/mmx2/sse/3dnow optimizations so they work on x86_64 patch by (Aurelien Jacobs <aurel at gnuage dot org>)
author michael
date Mon, 11 Oct 2004 02:19:29 +0000
parents 226d0a39347d
children cb521eadf9ae
comparison
equal deleted inserted replaced
2292:8556f080fcc2 2293:15cfba1b97b5
117 #else 117 #else
118 # define attribute_used 118 # define attribute_used
119 # define always_inline inline 119 # define always_inline inline
120 #endif 120 #endif
121 121
122 #ifdef ARCH_X86 122 #if defined(ARCH_X86) || defined(ARCH_X86_64)
123 static uint64_t __attribute__((aligned(8))) attribute_used w05= 0x0005000500050005LL; 123 static uint64_t __attribute__((aligned(8))) attribute_used w05= 0x0005000500050005LL;
124 static uint64_t __attribute__((aligned(8))) attribute_used w04= 0x0004000400040004LL; 124 static uint64_t __attribute__((aligned(8))) attribute_used w04= 0x0004000400040004LL;
125 static uint64_t __attribute__((aligned(8))) attribute_used w20= 0x0020002000200020LL; 125 static uint64_t __attribute__((aligned(8))) attribute_used w20= 0x0020002000200020LL;
126 static uint64_t __attribute__((aligned(8))) attribute_used b00= 0x0000000000000000LL; 126 static uint64_t __attribute__((aligned(8))) attribute_used b00= 0x0000000000000000LL;
127 static uint64_t __attribute__((aligned(8))) attribute_used b01= 0x0101010101010101LL; 127 static uint64_t __attribute__((aligned(8))) attribute_used b01= 0x0101010101010101LL;
170 "ac", "ha:a:128:7,va:a,dering:a", 170 "ac", "ha:a:128:7,va:a,dering:a",
171 NULL //End Marker 171 NULL //End Marker
172 }; 172 };
173 173
174 174
175 #ifdef ARCH_X86 175 #if defined(ARCH_X86) || defined(ARCH_X86_64)
176 static inline void prefetchnta(void *p) 176 static inline void prefetchnta(void *p)
177 { 177 {
178 asm volatile( "prefetchnta (%0)\n\t" 178 asm volatile( "prefetchnta (%0)\n\t"
179 : : "r" (p) 179 : : "r" (p)
180 ); 180 );
595 #ifdef HAVE_ALTIVEC 595 #ifdef HAVE_ALTIVEC
596 #define COMPILE_ALTIVEC 596 #define COMPILE_ALTIVEC
597 #endif //HAVE_ALTIVEC 597 #endif //HAVE_ALTIVEC
598 #endif //ARCH_POWERPC 598 #endif //ARCH_POWERPC
599 599
600 #ifdef ARCH_X86 600 #if defined(ARCH_X86) || defined(ARCH_X86_64)
601 601
602 #if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT) 602 #if (defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)
603 #define COMPILE_MMX 603 #define COMPILE_MMX
604 #endif 604 #endif
605 605
614 614
615 #undef HAVE_MMX 615 #undef HAVE_MMX
616 #undef HAVE_MMX2 616 #undef HAVE_MMX2
617 #undef HAVE_3DNOW 617 #undef HAVE_3DNOW
618 #undef HAVE_ALTIVEC 618 #undef HAVE_ALTIVEC
619 #undef ARCH_X86
620 619
621 #ifdef COMPILE_C 620 #ifdef COMPILE_C
622 #undef HAVE_MMX 621 #undef HAVE_MMX
623 #undef HAVE_MMX2 622 #undef HAVE_MMX2
624 #undef HAVE_3DNOW 623 #undef HAVE_3DNOW
625 #undef ARCH_X86
626 #define RENAME(a) a ## _C 624 #define RENAME(a) a ## _C
627 #include "postprocess_template.c" 625 #include "postprocess_template.c"
628 #endif 626 #endif
629 627
630 #ifdef ARCH_POWERPC 628 #ifdef ARCH_POWERPC
641 #ifdef COMPILE_MMX 639 #ifdef COMPILE_MMX
642 #undef RENAME 640 #undef RENAME
643 #define HAVE_MMX 641 #define HAVE_MMX
644 #undef HAVE_MMX2 642 #undef HAVE_MMX2
645 #undef HAVE_3DNOW 643 #undef HAVE_3DNOW
646 #define ARCH_X86
647 #define RENAME(a) a ## _MMX 644 #define RENAME(a) a ## _MMX
648 #include "postprocess_template.c" 645 #include "postprocess_template.c"
649 #endif 646 #endif
650 647
651 //MMX2 versions 648 //MMX2 versions
652 #ifdef COMPILE_MMX2 649 #ifdef COMPILE_MMX2
653 #undef RENAME 650 #undef RENAME
654 #define HAVE_MMX 651 #define HAVE_MMX
655 #define HAVE_MMX2 652 #define HAVE_MMX2
656 #undef HAVE_3DNOW 653 #undef HAVE_3DNOW
657 #define ARCH_X86
658 #define RENAME(a) a ## _MMX2 654 #define RENAME(a) a ## _MMX2
659 #include "postprocess_template.c" 655 #include "postprocess_template.c"
660 #endif 656 #endif
661 657
662 //3DNOW versions 658 //3DNOW versions
663 #ifdef COMPILE_3DNOW 659 #ifdef COMPILE_3DNOW
664 #undef RENAME 660 #undef RENAME
665 #define HAVE_MMX 661 #define HAVE_MMX
666 #undef HAVE_MMX2 662 #undef HAVE_MMX2
667 #define HAVE_3DNOW 663 #define HAVE_3DNOW
668 #define ARCH_X86
669 #define RENAME(a) a ## _3DNow 664 #define RENAME(a) a ## _3DNow
670 #include "postprocess_template.c" 665 #include "postprocess_template.c"
671 #endif 666 #endif
672 667
673 // minor note: the HAVE_xyz is messed up after that line so dont use it 668 // minor note: the HAVE_xyz is messed up after that line so dont use it
681 676
682 // useing ifs here as they are faster than function pointers allthough the 677 // useing ifs here as they are faster than function pointers allthough the
683 // difference wouldnt be messureable here but its much better because 678 // difference wouldnt be messureable here but its much better because
684 // someone might exchange the cpu whithout restarting mplayer ;) 679 // someone might exchange the cpu whithout restarting mplayer ;)
685 #ifdef RUNTIME_CPUDETECT 680 #ifdef RUNTIME_CPUDETECT
686 #ifdef ARCH_X86 681 #if defined(ARCH_X86) || defined(ARCH_X86_64)
687 // ordered per speed fasterst first 682 // ordered per speed fasterst first
688 if(c->cpuCaps & PP_CPU_CAPS_MMX2) 683 if(c->cpuCaps & PP_CPU_CAPS_MMX2)
689 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); 684 postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
690 else if(c->cpuCaps & PP_CPU_CAPS_3DNOW) 685 else if(c->cpuCaps & PP_CPU_CAPS_3DNOW)
691 postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); 686 postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);