1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Change semantic of CONFIG_*, HAVE_* and ARCH_*.

They are now always defined to either 0 or 1.

Originally committed as revision 28311 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
Aurelien Jacobs 2009-01-14 00:13:56 +00:00
parent b250f9c66d
commit b63f641e9b
8 changed files with 195 additions and 186 deletions

View File

@ -88,7 +88,7 @@ void (*yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2, const uint8_t *sr
long srcStride1, long srcStride2, long srcStride1, long srcStride2,
long srcStride3, long dstStride); long srcStride3, long dstStride);
#if defined(ARCH_X86) && defined(CONFIG_GPL) #if ARCH_X86 && CONFIG_GPL
DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL; DECLARE_ASM_CONST(8, uint64_t, mmx_null) = 0x0000000000000000ULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL; DECLARE_ASM_CONST(8, uint64_t, mmx_one) = 0xFFFFFFFFFFFFFFFFULL;
DECLARE_ASM_CONST(8, uint64_t, mask32b) = 0x000000FF000000FFULL; DECLARE_ASM_CONST(8, uint64_t, mask32b) = 0x000000FF000000FFULL;
@ -122,7 +122,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_16mask) = 0x0000001f0000001fULL;
DECLARE_ASM_CONST(8, uint64_t, red_15mask) = 0x00007c0000007c00ULL; DECLARE_ASM_CONST(8, uint64_t, red_15mask) = 0x00007c0000007c00ULL;
DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL; DECLARE_ASM_CONST(8, uint64_t, green_15mask) = 0x000003e0000003e0ULL;
DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL; DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
#endif /* defined(ARCH_X86) */ #endif /* ARCH_X86 */
#define RGB2YUV_SHIFT 8 #define RGB2YUV_SHIFT 8
#define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5)) #define BY ((int)( 0.098*(1<<RGB2YUV_SHIFT)+0.5))
@ -141,35 +141,35 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
#undef HAVE_MMX2 #undef HAVE_MMX2
#undef HAVE_3DNOW #undef HAVE_3DNOW
#undef HAVE_SSE2 #undef HAVE_SSE2
#define HAVE_MMX 0
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define HAVE_SSE2 0
#define RENAME(a) a ## _C #define RENAME(a) a ## _C
#include "rgb2rgb_template.c" #include "rgb2rgb_template.c"
#if defined(ARCH_X86) && defined(CONFIG_GPL) #if ARCH_X86 && CONFIG_GPL
//MMX versions //MMX versions
#undef RENAME #undef RENAME
#define HAVE_MMX #undef HAVE_MMX
#undef HAVE_MMX2 #define HAVE_MMX 1
#undef HAVE_3DNOW
#undef HAVE_SSE2
#define RENAME(a) a ## _MMX #define RENAME(a) a ## _MMX
#include "rgb2rgb_template.c" #include "rgb2rgb_template.c"
//MMX2 versions //MMX2 versions
#undef RENAME #undef RENAME
#define HAVE_MMX #undef HAVE_MMX2
#define HAVE_MMX2 #define HAVE_MMX2 1
#undef HAVE_3DNOW
#undef HAVE_SSE2
#define RENAME(a) a ## _MMX2 #define RENAME(a) a ## _MMX2
#include "rgb2rgb_template.c" #include "rgb2rgb_template.c"
//3DNOW versions //3DNOW versions
#undef RENAME #undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2 #undef HAVE_MMX2
#define HAVE_3DNOW #undef HAVE_3DNOW
#undef HAVE_SSE2 #define HAVE_MMX2 0
#define HAVE_3DNOW 1
#define RENAME(a) a ## _3DNOW #define RENAME(a) a ## _3DNOW
#include "rgb2rgb_template.c" #include "rgb2rgb_template.c"
@ -183,7 +183,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
*/ */
void sws_rgb2rgb_init(int flags){ void sws_rgb2rgb_init(int flags){
#if (defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX)) && defined(CONFIG_GPL) #if (HAVE_MMX2 || HAVE_3DNOW || HAVE_MMX) && CONFIG_GPL
if (flags & SWS_CPU_CAPS_MMX2) if (flags & SWS_CPU_CAPS_MMX2)
rgb2rgb_init_MMX2(); rgb2rgb_init_MMX2();
else if (flags & SWS_CPU_CAPS_3DNOW) else if (flags & SWS_CPU_CAPS_3DNOW)
@ -191,7 +191,7 @@ void sws_rgb2rgb_init(int flags){
else if (flags & SWS_CPU_CAPS_MMX) else if (flags & SWS_CPU_CAPS_MMX)
rgb2rgb_init_MMX(); rgb2rgb_init_MMX();
else else
#endif /* defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX) */ #endif /* HAVE_MMX2 || HAVE_3DNOW || HAVE_MMX */
rgb2rgb_init_C(); rgb2rgb_init_C();
} }

View File

@ -37,17 +37,17 @@
#undef PREFETCHW #undef PREFETCHW
#undef PAVGB #undef PAVGB
#ifdef HAVE_SSE2 #if HAVE_SSE2
#define MMREG_SIZE 16 #define MMREG_SIZE 16
#else #else
#define MMREG_SIZE 8 #define MMREG_SIZE 8
#endif #endif
#ifdef HAVE_3DNOW #if HAVE_3DNOW
#define PREFETCH "prefetch" #define PREFETCH "prefetch"
#define PREFETCHW "prefetchw" #define PREFETCHW "prefetchw"
#define PAVGB "pavgusb" #define PAVGB "pavgusb"
#elif defined (HAVE_MMX2) #elif HAVE_MMX2
#define PREFETCH "prefetchnta" #define PREFETCH "prefetchnta"
#define PREFETCHW "prefetcht0" #define PREFETCHW "prefetcht0"
#define PAVGB "pavgb" #define PAVGB "pavgb"
@ -56,14 +56,14 @@
#define PREFETCHW " # nop" #define PREFETCHW " # nop"
#endif #endif
#ifdef HAVE_3DNOW #if HAVE_3DNOW
/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
#define EMMS "femms" #define EMMS "femms"
#else #else
#define EMMS "emms" #define EMMS "emms"
#endif #endif
#ifdef HAVE_MMX2 #if HAVE_MMX2
#define MOVNTQ "movntq" #define MOVNTQ "movntq"
#define SFENCE "sfence" #define SFENCE "sfence"
#else #else
@ -76,11 +76,11 @@ static inline void RENAME(rgb24tobgr32)(const uint8_t *src, uint8_t *dst, long s
uint8_t *dest = dst; uint8_t *dest = dst;
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
mm_end = end - 23; mm_end = end - 23;
__asm__ volatile("movq %0, %%mm7"::"m"(mask32):"memory"); __asm__ volatile("movq %0, %%mm7"::"m"(mask32):"memory");
@ -136,11 +136,11 @@ static inline void RENAME(rgb32tobgr24)(const uint8_t *src, uint8_t *dst, long s
uint8_t *dest = dst; uint8_t *dest = dst;
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
mm_end = end - 31; mm_end = end - 31;
while (s < mm_end) while (s < mm_end)
@ -230,7 +230,7 @@ static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_
register const uint8_t *end; register const uint8_t *end;
const uint8_t *mm_end; const uint8_t *mm_end;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s)); __asm__ volatile(PREFETCH" %0"::"m"(*s));
__asm__ volatile("movq %0, %%mm4"::"m"(mask15s)); __asm__ volatile("movq %0, %%mm4"::"m"(mask15s));
mm_end = end - 15; mm_end = end - 15;
@ -279,7 +279,7 @@ static inline void RENAME(rgb16to15)(const uint8_t *src, uint8_t *dst, long src_
register const uint8_t *end; register const uint8_t *end;
const uint8_t *mm_end; const uint8_t *mm_end;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s)); __asm__ volatile(PREFETCH" %0"::"m"(*s));
__asm__ volatile("movq %0, %%mm7"::"m"(mask15rg)); __asm__ volatile("movq %0, %%mm7"::"m"(mask15rg));
__asm__ volatile("movq %0, %%mm6"::"m"(mask15b)); __asm__ volatile("movq %0, %%mm6"::"m"(mask15b));
@ -332,12 +332,12 @@ static inline void RENAME(rgb32to16)(const uint8_t *src, uint8_t *dst, long src_
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
mm_end = end - 15; mm_end = end - 15;
#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster) #if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
__asm__ volatile( __asm__ volatile(
@ -430,12 +430,12 @@ static inline void RENAME(rgb32tobgr16)(const uint8_t *src, uint8_t *dst, long s
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile( __asm__ volatile(
"movq %0, %%mm7 \n\t" "movq %0, %%mm7 \n\t"
@ -491,12 +491,12 @@ static inline void RENAME(rgb32to15)(const uint8_t *src, uint8_t *dst, long src_
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
mm_end = end - 15; mm_end = end - 15;
#if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster) #if 1 //is faster only if multiplies are reasonably fast (FIXME figure out on which CPUs this is faster, on Athlon it is slightly faster)
__asm__ volatile( __asm__ volatile(
@ -589,12 +589,12 @@ static inline void RENAME(rgb32tobgr15)(const uint8_t *src, uint8_t *dst, long s
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile( __asm__ volatile(
"movq %0, %%mm7 \n\t" "movq %0, %%mm7 \n\t"
@ -650,12 +650,12 @@ static inline void RENAME(rgb24tobgr16)(const uint8_t *src, uint8_t *dst, long s
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile( __asm__ volatile(
"movq %0, %%mm7 \n\t" "movq %0, %%mm7 \n\t"
@ -713,12 +713,12 @@ static inline void RENAME(rgb24to16)(const uint8_t *src, uint8_t *dst, long src_
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile( __asm__ volatile(
"movq %0, %%mm7 \n\t" "movq %0, %%mm7 \n\t"
@ -776,12 +776,12 @@ static inline void RENAME(rgb24tobgr15)(const uint8_t *src, uint8_t *dst, long s
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile( __asm__ volatile(
"movq %0, %%mm7 \n\t" "movq %0, %%mm7 \n\t"
@ -839,12 +839,12 @@ static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_
{ {
const uint8_t *s = src; const uint8_t *s = src;
const uint8_t *end; const uint8_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint8_t *mm_end; const uint8_t *mm_end;
#endif #endif
uint16_t *d = (uint16_t *)dst; uint16_t *d = (uint16_t *)dst;
end = s + src_size; end = s + src_size;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*src):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*src):"memory");
__asm__ volatile( __asm__ volatile(
"movq %0, %%mm7 \n\t" "movq %0, %%mm7 \n\t"
@ -922,13 +922,13 @@ static inline void RENAME(rgb24to15)(const uint8_t *src, uint8_t *dst, long src_
static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
{ {
const uint16_t *end; const uint16_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint16_t *mm_end; const uint16_t *mm_end;
#endif #endif
uint8_t *d = dst; uint8_t *d = dst;
const uint16_t *s = (const uint16_t*)src; const uint16_t *s = (const uint16_t*)src;
end = s + src_size/2; end = s + src_size/2;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
mm_end = end - 7; mm_end = end - 7;
while (s < mm_end) while (s < mm_end)
@ -1064,13 +1064,13 @@ static inline void RENAME(rgb15tobgr24)(const uint8_t *src, uint8_t *dst, long s
static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
{ {
const uint16_t *end; const uint16_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint16_t *mm_end; const uint16_t *mm_end;
#endif #endif
uint8_t *d = (uint8_t *)dst; uint8_t *d = (uint8_t *)dst;
const uint16_t *s = (const uint16_t *)src; const uint16_t *s = (const uint16_t *)src;
end = s + src_size/2; end = s + src_size/2;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
mm_end = end - 7; mm_end = end - 7;
while (s < mm_end) while (s < mm_end)
@ -1205,13 +1205,13 @@ static inline void RENAME(rgb16tobgr24)(const uint8_t *src, uint8_t *dst, long s
static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size) static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_size)
{ {
const uint16_t *end; const uint16_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint16_t *mm_end; const uint16_t *mm_end;
#endif #endif
uint8_t *d = dst; uint8_t *d = dst;
const uint16_t *s = (const uint16_t *)src; const uint16_t *s = (const uint16_t *)src;
end = s + src_size/2; end = s + src_size/2;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
__asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory"); __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory");
mm_end = end - 3; mm_end = end - 3;
@ -1283,13 +1283,13 @@ static inline void RENAME(rgb15to32)(const uint8_t *src, uint8_t *dst, long src_
static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size) static inline void RENAME(rgb16to32)(const uint8_t *src, uint8_t *dst, long src_size)
{ {
const uint16_t *end; const uint16_t *end;
#ifdef HAVE_MMX #if HAVE_MMX
const uint16_t *mm_end; const uint16_t *mm_end;
#endif #endif
uint8_t *d = dst; uint8_t *d = dst;
const uint16_t *s = (const uint16_t*)src; const uint16_t *s = (const uint16_t*)src;
end = s + src_size/2; end = s + src_size/2;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(PREFETCH" %0"::"m"(*s):"memory"); __asm__ volatile(PREFETCH" %0"::"m"(*s):"memory");
__asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory"); __asm__ volatile("pxor %%mm7,%%mm7 \n\t":::"memory");
mm_end = end - 3; mm_end = end - 3;
@ -1357,7 +1357,7 @@ static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long s
long idx = 15 - src_size; long idx = 15 - src_size;
const uint8_t *s = src-idx; const uint8_t *s = src-idx;
uint8_t *d = dst-idx; uint8_t *d = dst-idx;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"test %0, %0 \n\t" "test %0, %0 \n\t"
"jns 2f \n\t" "jns 2f \n\t"
@ -1371,7 +1371,7 @@ static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long s
PREFETCH" 32(%1, %0) \n\t" PREFETCH" 32(%1, %0) \n\t"
"movq (%1, %0), %%mm0 \n\t" "movq (%1, %0), %%mm0 \n\t"
"movq 8(%1, %0), %%mm1 \n\t" "movq 8(%1, %0), %%mm1 \n\t"
# ifdef HAVE_MMX2 # if HAVE_MMX2
"pshufw $177, %%mm0, %%mm3 \n\t" "pshufw $177, %%mm0, %%mm3 \n\t"
"pshufw $177, %%mm1, %%mm5 \n\t" "pshufw $177, %%mm1, %%mm5 \n\t"
"pand %%mm7, %%mm0 \n\t" "pand %%mm7, %%mm0 \n\t"
@ -1419,7 +1419,7 @@ static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long s
static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size) static inline void RENAME(rgb24tobgr24)(const uint8_t *src, uint8_t *dst, long src_size)
{ {
unsigned i; unsigned i;
#ifdef HAVE_MMX #if HAVE_MMX
long mmx_size= 23 - src_size; long mmx_size= 23 - src_size;
__asm__ volatile ( __asm__ volatile (
"test %%"REG_a", %%"REG_a" \n\t" "test %%"REG_a", %%"REG_a" \n\t"
@ -1494,7 +1494,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u
const long chromWidth= width>>1; const long chromWidth= width>>1;
for (y=0; y<height; y++) for (y=0; y<height; y++)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
__asm__ volatile( __asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_a", %%"REG_a" \n\t"
@ -1531,7 +1531,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u
); );
#else #else
#if defined ARCH_ALPHA && defined HAVE_MVI #if ARCH_ALPHA && HAVE_MVI
#define pl2yuy2(n) \ #define pl2yuy2(n) \
y1 = yc[n]; \ y1 = yc[n]; \
y2 = yc2[n]; \ y2 = yc2[n]; \
@ -1619,7 +1619,7 @@ static inline void RENAME(yuvPlanartoyuy2)(const uint8_t *ysrc, const uint8_t *u
ysrc += lumStride; ysrc += lumStride;
dst += dstStride; dst += dstStride;
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__( EMMS" \n\t" __asm__( EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
:::"memory"); :::"memory");
@ -1646,7 +1646,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
const long chromWidth= width>>1; const long chromWidth= width>>1;
for (y=0; y<height; y++) for (y=0; y<height; y++)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway) //FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
__asm__ volatile( __asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_a", %%"REG_a" \n\t"
@ -1725,7 +1725,7 @@ static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *u
ysrc += lumStride; ysrc += lumStride;
dst += dstStride; dst += dstStride;
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__( EMMS" \n\t" __asm__( EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
:::"memory"); :::"memory");
@ -1776,7 +1776,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
const long chromWidth= width>>1; const long chromWidth= width>>1;
for (y=0; y<height; y+=2) for (y=0; y<height; y+=2)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_a", %%"REG_a" \n\t"
"pcmpeqw %%mm7, %%mm7 \n\t" "pcmpeqw %%mm7, %%mm7 \n\t"
@ -1881,7 +1881,7 @@ static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
ydst += lumStride; ydst += lumStride;
src += srcStride; src += srcStride;
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( EMMS" \n\t" __asm__ volatile( EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
:::"memory"); :::"memory");
@ -1914,7 +1914,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi
dst+= dstStride; dst+= dstStride;
for (y=1; y<srcHeight; y++){ for (y=1; y<srcHeight; y++){
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) #if HAVE_MMX2 || HAVE_3DNOW
const long mmxSize= srcWidth&~15; const long mmxSize= srcWidth&~15;
__asm__ volatile( __asm__ volatile(
"mov %4, %%"REG_a" \n\t" "mov %4, %%"REG_a" \n\t"
@ -1993,7 +1993,7 @@ static inline void RENAME(planar2x)(const uint8_t *src, uint8_t *dst, long srcWi
} }
#endif #endif
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( EMMS" \n\t" __asm__ volatile( EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
:::"memory"); :::"memory");
@ -2014,7 +2014,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
const long chromWidth= width>>1; const long chromWidth= width>>1;
for (y=0; y<height; y+=2) for (y=0; y<height; y+=2)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_a", %%"REG_a" \n\t"
"pcmpeqw %%mm7, %%mm7 \n\t" "pcmpeqw %%mm7, %%mm7 \n\t"
@ -2119,7 +2119,7 @@ static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t
ydst += lumStride; ydst += lumStride;
src += srcStride; src += srcStride;
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( EMMS" \n\t" __asm__ volatile( EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
:::"memory"); :::"memory");
@ -2139,7 +2139,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
{ {
long y; long y;
const long chromWidth= width>>1; const long chromWidth= width>>1;
#ifdef HAVE_MMX #if HAVE_MMX
for (y=0; y<height-2; y+=2) for (y=0; y<height-2; y+=2)
{ {
long i; long i;
@ -2229,7 +2229,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
"1: \n\t" "1: \n\t"
PREFETCH" 64(%0, %%"REG_d") \n\t" PREFETCH" 64(%0, %%"REG_d") \n\t"
PREFETCH" 64(%1, %%"REG_d") \n\t" PREFETCH" 64(%1, %%"REG_d") \n\t"
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) #if HAVE_MMX2 || HAVE_3DNOW
"movq (%0, %%"REG_d"), %%mm0 \n\t" "movq (%0, %%"REG_d"), %%mm0 \n\t"
"movq (%1, %%"REG_d"), %%mm1 \n\t" "movq (%1, %%"REG_d"), %%mm1 \n\t"
"movq 6(%0, %%"REG_d"), %%mm2 \n\t" "movq 6(%0, %%"REG_d"), %%mm2 \n\t"
@ -2290,7 +2290,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
"packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0 "packssdw %%mm1, %%mm0 \n\t" // V1 V0 U1 U0
"psraw $7, %%mm0 \n\t" "psraw $7, %%mm0 \n\t"
#if defined (HAVE_MMX2) || defined (HAVE_3DNOW) #if HAVE_MMX2 || HAVE_3DNOW
"movq 12(%0, %%"REG_d"), %%mm4 \n\t" "movq 12(%0, %%"REG_d"), %%mm4 \n\t"
"movq 12(%1, %%"REG_d"), %%mm1 \n\t" "movq 12(%1, %%"REG_d"), %%mm1 \n\t"
"movq 18(%0, %%"REG_d"), %%mm2 \n\t" "movq 18(%0, %%"REG_d"), %%mm2 \n\t"
@ -2438,8 +2438,8 @@ static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
{ {
long w; long w;
#ifdef HAVE_MMX #if HAVE_MMX
#ifdef HAVE_SSE2 #if HAVE_SSE2
__asm__( __asm__(
"xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_a", %%"REG_a" \n\t"
"1: \n\t" "1: \n\t"
@ -2501,7 +2501,7 @@ static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
src1 += src1Stride; src1 += src1Stride;
src2 += src2Stride; src2 += src2Stride;
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__( __asm__(
EMMS" \n\t" EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
@ -2518,7 +2518,7 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
{ {
long y,x,w,h; long y,x,w,h;
w=width/2; h=height/2; w=width/2; h=height/2;
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
PREFETCH" %0 \n\t" PREFETCH" %0 \n\t"
PREFETCH" %1 \n\t" PREFETCH" %1 \n\t"
@ -2528,7 +2528,7 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
const uint8_t* s1=src1+srcStride1*(y>>1); const uint8_t* s1=src1+srcStride1*(y>>1);
uint8_t* d=dst1+dstStride1*y; uint8_t* d=dst1+dstStride1*y;
x=0; x=0;
#ifdef HAVE_MMX #if HAVE_MMX
for (;x<w-31;x+=32) for (;x<w-31;x+=32)
{ {
__asm__ volatile( __asm__ volatile(
@ -2568,7 +2568,7 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
const uint8_t* s2=src2+srcStride2*(y>>1); const uint8_t* s2=src2+srcStride2*(y>>1);
uint8_t* d=dst2+dstStride2*y; uint8_t* d=dst2+dstStride2*y;
x=0; x=0;
#ifdef HAVE_MMX #if HAVE_MMX
for (;x<w-31;x+=32) for (;x<w-31;x+=32)
{ {
__asm__ volatile( __asm__ volatile(
@ -2604,7 +2604,7 @@ static inline void RENAME(vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
#endif #endif
for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x]; for (;x<w;x++) d[2*x]=d[2*x+1]=s2[x];
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__( __asm__(
EMMS" \n\t" EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"
@ -2627,7 +2627,7 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2
const uint8_t* vp=src3+srcStride3*(y>>2); const uint8_t* vp=src3+srcStride3*(y>>2);
uint8_t* d=dst+dstStride*y; uint8_t* d=dst+dstStride*y;
x=0; x=0;
#ifdef HAVE_MMX #if HAVE_MMX
for (;x<w-7;x+=8) for (;x<w-7;x+=8)
{ {
__asm__ volatile( __asm__ volatile(
@ -2695,7 +2695,7 @@ static inline void RENAME(yvu9_to_yuy2)(const uint8_t *src1, const uint8_t *src2
d[8*x+7] = vp[x]; d[8*x+7] = vp[x];
} }
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__( __asm__(
EMMS" \n\t" EMMS" \n\t"
SFENCE" \n\t" SFENCE" \n\t"

View File

@ -118,7 +118,7 @@ static int doTest(uint8_t *ref[3], int refStride[3], int w, int h, int srcFormat
sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride); sws_scale(dstContext, src, srcStride, 0, srcH, dst, dstStride);
sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride); sws_scale(outContext, dst, dstStride, 0, dstH, out, refStride);
#if defined(ARCH_X86) #if ARCH_X86
__asm__ volatile ("emms\n\t"); __asm__ volatile ("emms\n\t");
#endif #endif
@ -208,7 +208,7 @@ int main(int argc, char **argv){
} }
sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride); sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);
#if defined(ARCH_X86) #if ARCH_X86
__asm__ volatile ("emms\n\t"); __asm__ volatile ("emms\n\t");
#endif #endif

View File

@ -62,7 +62,7 @@ untested special converters
#include <unistd.h> #include <unistd.h>
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
#ifdef HAVE_SYS_MMAN_H #if HAVE_SYS_MMAN_H
#include <sys/mman.h> #include <sys/mman.h>
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS) #if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON #define MAP_ANONYMOUS MAP_ANON
@ -202,7 +202,7 @@ add BGR4 output support
write special BGR->BGR scaler write special BGR->BGR scaler
*/ */
#if defined(ARCH_X86) && defined (CONFIG_GPL) #if ARCH_X86 && CONFIG_GPL
DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL; DECLARE_ASM_CONST(8, uint64_t, bF8)= 0xF8F8F8F8F8F8F8F8LL;
DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL; DECLARE_ASM_CONST(8, uint64_t, bFC)= 0xFCFCFCFCFCFCFCFCLL;
DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL; DECLARE_ASM_CONST(8, uint64_t, w10)= 0x0010001000100010LL;
@ -257,7 +257,7 @@ DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUV[2][4]) = {
DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL; DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL;
#endif /* defined(ARCH_X86) */ #endif /* ARCH_X86 */
// clipping helper table for C implementations: // clipping helper table for C implementations:
static unsigned char clip_table[768]; static unsigned char clip_table[768];
@ -947,27 +947,27 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one //Note: we have C, X86, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
//Plain C versions //Plain C versions
#if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT) || !defined(CONFIG_GPL) #if !HAVE_MMX || defined (RUNTIME_CPUDETECT) || !CONFIG_GPL
#define COMPILE_C #define COMPILE_C
#endif #endif
#ifdef ARCH_PPC #if ARCH_PPC
#if (defined (HAVE_ALTIVEC) || defined (RUNTIME_CPUDETECT)) && defined (CONFIG_GPL) #if (HAVE_ALTIVEC || defined (RUNTIME_CPUDETECT)) && CONFIG_GPL
#define COMPILE_ALTIVEC #define COMPILE_ALTIVEC
#endif //HAVE_ALTIVEC #endif //HAVE_ALTIVEC
#endif //ARCH_PPC #endif //ARCH_PPC
#if defined(ARCH_X86) #if ARCH_X86
#if ((defined (HAVE_MMX) && !defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)) && defined (CONFIG_GPL) #if ((HAVE_MMX && !HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)) && CONFIG_GPL
#define COMPILE_MMX #define COMPILE_MMX
#endif #endif
#if (defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT)) && defined (CONFIG_GPL) #if (HAVE_MMX2 || defined (RUNTIME_CPUDETECT)) && CONFIG_GPL
#define COMPILE_MMX2 #define COMPILE_MMX2
#endif #endif
#if ((defined (HAVE_3DNOW) && !defined (HAVE_MMX2)) || defined (RUNTIME_CPUDETECT)) && defined (CONFIG_GPL) #if ((HAVE_3DNOW && !HAVE_MMX2) || defined (RUNTIME_CPUDETECT)) && CONFIG_GPL
#define COMPILE_3DNOW #define COMPILE_3DNOW
#endif #endif
#endif //ARCH_X86 || ARCH_X86_64 #endif //ARCH_X86 || ARCH_X86_64
@ -975,24 +975,26 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
#undef HAVE_MMX #undef HAVE_MMX
#undef HAVE_MMX2 #undef HAVE_MMX2
#undef HAVE_3DNOW #undef HAVE_3DNOW
#undef HAVE_ALTIVEC
#define HAVE_MMX 0
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define HAVE_ALTIVEC 0
#ifdef COMPILE_C #ifdef COMPILE_C
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_ALTIVEC
#define RENAME(a) a ## _C #define RENAME(a) a ## _C
#include "swscale_template.c" #include "swscale_template.c"
#endif #endif
#ifdef COMPILE_ALTIVEC #ifdef COMPILE_ALTIVEC
#undef RENAME #undef RENAME
#define HAVE_ALTIVEC #undef HAVE_ALTIVEC
#define HAVE_ALTIVEC 1
#define RENAME(a) a ## _altivec #define RENAME(a) a ## _altivec
#include "swscale_template.c" #include "swscale_template.c"
#endif #endif
#if defined(ARCH_X86) #if ARCH_X86
//X86 versions //X86 versions
/* /*
@ -1007,9 +1009,12 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//MMX versions //MMX versions
#ifdef COMPILE_MMX #ifdef COMPILE_MMX
#undef RENAME #undef RENAME
#define HAVE_MMX #undef HAVE_MMX
#undef HAVE_MMX2 #undef HAVE_MMX2
#undef HAVE_3DNOW #undef HAVE_3DNOW
#define HAVE_MMX 1
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define RENAME(a) a ## _MMX #define RENAME(a) a ## _MMX
#include "swscale_template.c" #include "swscale_template.c"
#endif #endif
@ -1017,9 +1022,12 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//MMX2 versions //MMX2 versions
#ifdef COMPILE_MMX2 #ifdef COMPILE_MMX2
#undef RENAME #undef RENAME
#define HAVE_MMX #undef HAVE_MMX
#define HAVE_MMX2 #undef HAVE_MMX2
#undef HAVE_3DNOW #undef HAVE_3DNOW
#define HAVE_MMX 1
#define HAVE_MMX2 1
#define HAVE_3DNOW 0
#define RENAME(a) a ## _MMX2 #define RENAME(a) a ## _MMX2
#include "swscale_template.c" #include "swscale_template.c"
#endif #endif
@ -1027,9 +1035,12 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//3DNOW versions //3DNOW versions
#ifdef COMPILE_3DNOW #ifdef COMPILE_3DNOW
#undef RENAME #undef RENAME
#define HAVE_MMX #undef HAVE_MMX
#undef HAVE_MMX2 #undef HAVE_MMX2
#define HAVE_3DNOW #undef HAVE_3DNOW
#define HAVE_MMX 1
#define HAVE_MMX2 0
#define HAVE_3DNOW 1
#define RENAME(a) a ## _3DNow #define RENAME(a) a ## _3DNow
#include "swscale_template.c" #include "swscale_template.c"
#endif #endif
@ -1061,7 +1072,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
int64_t *filter2=NULL; int64_t *filter2=NULL;
const int64_t fone= 1LL<<54; const int64_t fone= 1LL<<54;
int ret= -1; int ret= -1;
#if defined(ARCH_X86) #if ARCH_X86
if (flags & SWS_CPU_CAPS_MMX) if (flags & SWS_CPU_CAPS_MMX)
__asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions) __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions)
#endif #endif
@ -1617,8 +1628,8 @@ static void globalInit(void){
static SwsFunc getSwsFunc(int flags){ static SwsFunc getSwsFunc(int flags){
#if defined(RUNTIME_CPUDETECT) && defined (CONFIG_GPL) #if defined(RUNTIME_CPUDETECT) && CONFIG_GPL
#if defined(ARCH_X86) #if ARCH_X86
// ordered per speed fastest first // ordered per speed fastest first
if (flags & SWS_CPU_CAPS_MMX2) if (flags & SWS_CPU_CAPS_MMX2)
return swScale_MMX2; return swScale_MMX2;
@ -1630,22 +1641,22 @@ static SwsFunc getSwsFunc(int flags){
return swScale_C; return swScale_C;
#else #else
#ifdef ARCH_PPC #if ARCH_PPC
if (flags & SWS_CPU_CAPS_ALTIVEC) if (flags & SWS_CPU_CAPS_ALTIVEC)
return swScale_altivec; return swScale_altivec;
else else
return swScale_C; return swScale_C;
#endif #endif
return swScale_C; return swScale_C;
#endif /* defined(ARCH_X86) */ #endif /* ARCH_X86 */
#else //RUNTIME_CPUDETECT #else //RUNTIME_CPUDETECT
#ifdef HAVE_MMX2 #if HAVE_MMX2
return swScale_MMX2; return swScale_MMX2;
#elif defined (HAVE_3DNOW) #elif HAVE_3DNOW
return swScale_3DNow; return swScale_3DNow;
#elif defined (HAVE_MMX) #elif HAVE_MMX
return swScale_MMX; return swScale_MMX;
#elif defined (HAVE_ALTIVEC) #elif HAVE_ALTIVEC
return swScale_altivec; return swScale_altivec;
#else #else
return swScale_C; return swScale_C;
@ -2169,22 +2180,22 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
int unscaled, needsDither; int unscaled, needsDither;
int srcRange, dstRange; int srcRange, dstRange;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL}; SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if defined(ARCH_X86) #if ARCH_X86
if (flags & SWS_CPU_CAPS_MMX) if (flags & SWS_CPU_CAPS_MMX)
__asm__ volatile("emms\n\t"::: "memory"); __asm__ volatile("emms\n\t"::: "memory");
#endif #endif
#if !defined(RUNTIME_CPUDETECT) || !defined (CONFIG_GPL) //ensure that the flags match the compiled variant if cpudetect is off #if !defined(RUNTIME_CPUDETECT) || !CONFIG_GPL //ensure that the flags match the compiled variant if cpudetect is off
flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN); flags &= ~(SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2|SWS_CPU_CAPS_3DNOW|SWS_CPU_CAPS_ALTIVEC|SWS_CPU_CAPS_BFIN);
#ifdef HAVE_MMX2 #if HAVE_MMX2
flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2; flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_MMX2;
#elif defined (HAVE_3DNOW) #elif HAVE_3DNOW
flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW; flags |= SWS_CPU_CAPS_MMX|SWS_CPU_CAPS_3DNOW;
#elif defined (HAVE_MMX) #elif HAVE_MMX
flags |= SWS_CPU_CAPS_MMX; flags |= SWS_CPU_CAPS_MMX;
#elif defined (HAVE_ALTIVEC) #elif HAVE_ALTIVEC
flags |= SWS_CPU_CAPS_ALTIVEC; flags |= SWS_CPU_CAPS_ALTIVEC;
#elif defined (ARCH_BFIN) #elif ARCH_BFIN
flags |= SWS_CPU_CAPS_BFIN; flags |= SWS_CPU_CAPS_BFIN;
#endif #endif
#endif /* RUNTIME_CPUDETECT */ #endif /* RUNTIME_CPUDETECT */
@ -2311,7 +2322,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
{ {
c->swScale= PlanarToNV12Wrapper; c->swScale= PlanarToNV12Wrapper;
} }
#ifdef CONFIG_GPL #if CONFIG_GPL
/* yuv2bgr */ /* yuv2bgr */
if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat)) if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat))
&& !(flags & SWS_ACCURATE_RND) && !(dstH&1)) && !(flags & SWS_ACCURATE_RND) && !(dstH&1))
@ -2410,7 +2421,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
c->swScale= gray16swap; c->swScale= gray16swap;
} }
#ifdef ARCH_BFIN #if ARCH_BFIN
if (flags & SWS_CPU_CAPS_BFIN) if (flags & SWS_CPU_CAPS_BFIN)
ff_bfin_get_unscaled_swscale (c); ff_bfin_get_unscaled_swscale (c);
#endif #endif
@ -2518,7 +2529,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags, (flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
srcFilter->chrV, dstFilter->chrV, c->param); srcFilter->chrV, dstFilter->chrV, c->param);
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
c->vYCoeffsBank = av_malloc(sizeof (vector signed short)*c->vLumFilterSize*c->dstH); c->vYCoeffsBank = av_malloc(sizeof (vector signed short)*c->vLumFilterSize*c->dstH);
c->vCCoeffsBank = av_malloc(sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH); c->vCCoeffsBank = av_malloc(sizeof (vector signed short)*c->vChrFilterSize*c->chrDstH);
@ -2648,7 +2659,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
} }
else else
{ {
#if defined(ARCH_X86) #if ARCH_X86
av_log(c, AV_LOG_VERBOSE, "using X86-Asm scaler for horizontal scaling\n"); av_log(c, AV_LOG_VERBOSE, "using X86-Asm scaler for horizontal scaling\n");
#else #else
if (flags & SWS_FAST_BILINEAR) if (flags & SWS_FAST_BILINEAR)
@ -3115,7 +3126,7 @@ void sws_freeContext(SwsContext *c){
av_freep(&c->vChrFilter); av_freep(&c->vChrFilter);
av_freep(&c->hLumFilter); av_freep(&c->hLumFilter);
av_freep(&c->hChrFilter); av_freep(&c->hChrFilter);
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
av_freep(&c->vYCoeffsBank); av_freep(&c->vYCoeffsBank);
av_freep(&c->vCCoeffsBank); av_freep(&c->vCCoeffsBank);
#endif #endif
@ -3125,7 +3136,7 @@ void sws_freeContext(SwsContext *c){
av_freep(&c->hLumFilterPos); av_freep(&c->hLumFilterPos);
av_freep(&c->hChrFilterPos); av_freep(&c->hChrFilterPos);
#if defined(ARCH_X86) && defined(CONFIG_GPL) #if ARCH_X86 && CONFIG_GPL
#ifdef MAP_ANONYMOUS #ifdef MAP_ANONYMOUS
if (c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE); if (c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE);
if (c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE); if (c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE);
@ -3135,7 +3146,7 @@ void sws_freeContext(SwsContext *c){
#endif #endif
c->funnyYCode=NULL; c->funnyYCode=NULL;
c->funnyUVCode=NULL; c->funnyUVCode=NULL;
#endif /* defined(ARCH_X86) */ #endif /* ARCH_X86 */
av_freep(&c->lumMmx2Filter); av_freep(&c->lumMmx2Filter);
av_freep(&c->chrMmx2Filter); av_freep(&c->chrMmx2Filter);

View File

@ -23,7 +23,7 @@
#include "config.h" #include "config.h"
#ifdef HAVE_ALTIVEC_H #if HAVE_ALTIVEC_H
#include <altivec.h> #include <altivec.h>
#endif #endif
@ -42,7 +42,7 @@
#define ALT32_CORR 1 #define ALT32_CORR 1
#endif #endif
#ifdef ARCH_X86_64 #if ARCH_X86_64
# define APCK_PTR2 8 # define APCK_PTR2 8
# define APCK_COEF 16 # define APCK_COEF 16
# define APCK_SIZE 24 # define APCK_SIZE 24
@ -175,7 +175,7 @@ typedef struct SwsContext{
uint64_t u_temp __attribute__((aligned(8))); uint64_t u_temp __attribute__((aligned(8)));
uint64_t v_temp __attribute__((aligned(8))); uint64_t v_temp __attribute__((aligned(8)));
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
vector signed short CY; vector signed short CY;
vector signed short CRV; vector signed short CRV;
@ -189,7 +189,7 @@ typedef struct SwsContext{
#endif #endif
#ifdef ARCH_BFIN #if ARCH_BFIN
uint32_t oy __attribute__((aligned(4))); uint32_t oy __attribute__((aligned(4)));
uint32_t oc __attribute__((aligned(4))); uint32_t oc __attribute__((aligned(4)));
uint32_t zero __attribute__((aligned(4))); uint32_t zero __attribute__((aligned(4)));
@ -203,7 +203,7 @@ typedef struct SwsContext{
uint32_t gmask __attribute__((aligned(4))); uint32_t gmask __attribute__((aligned(4)));
#endif #endif
#ifdef HAVE_VIS #if HAVE_VIS
uint64_t sparc_coeffs[10] __attribute__((aligned(8))); uint64_t sparc_coeffs[10] __attribute__((aligned(8)));
#endif #endif

View File

@ -29,17 +29,17 @@
#undef EMMS #undef EMMS
#undef SFENCE #undef SFENCE
#ifdef HAVE_3DNOW #if HAVE_3DNOW
/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
#define EMMS "femms" #define EMMS "femms"
#else #else
#define EMMS "emms" #define EMMS "emms"
#endif #endif
#ifdef HAVE_3DNOW #if HAVE_3DNOW
#define PREFETCH "prefetch" #define PREFETCH "prefetch"
#define PREFETCHW "prefetchw" #define PREFETCHW "prefetchw"
#elif defined (HAVE_MMX2) #elif HAVE_MMX2
#define PREFETCH "prefetchnta" #define PREFETCH "prefetchnta"
#define PREFETCHW "prefetcht0" #define PREFETCHW "prefetcht0"
#else #else
@ -47,26 +47,26 @@
#define PREFETCHW " # nop" #define PREFETCHW " # nop"
#endif #endif
#ifdef HAVE_MMX2 #if HAVE_MMX2
#define SFENCE "sfence" #define SFENCE "sfence"
#else #else
#define SFENCE " # nop" #define SFENCE " # nop"
#endif #endif
#ifdef HAVE_MMX2 #if HAVE_MMX2
#define PAVGB(a,b) "pavgb " #a ", " #b " \n\t" #define PAVGB(a,b) "pavgb " #a ", " #b " \n\t"
#elif defined (HAVE_3DNOW) #elif HAVE_3DNOW
#define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t" #define PAVGB(a,b) "pavgusb " #a ", " #b " \n\t"
#endif #endif
#ifdef HAVE_MMX2 #if HAVE_MMX2
#define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t" #define REAL_MOVNTQ(a,b) "movntq " #a ", " #b " \n\t"
#else #else
#define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t" #define REAL_MOVNTQ(a,b) "movq " #a ", " #b " \n\t"
#endif #endif
#define MOVNTQ(a,b) REAL_MOVNTQ(a,b) #define MOVNTQ(a,b) REAL_MOVNTQ(a,b)
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
#include "swscale_altivec_template.c" #include "swscale_altivec_template.c"
#endif #endif
@ -865,7 +865,7 @@
"cmp "#dstw", "#index" \n\t"\ "cmp "#dstw", "#index" \n\t"\
" jb 1b \n\t" " jb 1b \n\t"
#ifdef HAVE_MMX2 #if HAVE_MMX2
#undef WRITEBGR24 #undef WRITEBGR24
#define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX2(dst, dstw, index) #define WRITEBGR24(dst, dstw, index) WRITEBGR24MMX2(dst, dstw, index)
#else #else
@ -895,7 +895,7 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t *
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
if(!(c->flags & SWS_BITEXACT)){ if(!(c->flags & SWS_BITEXACT)){
if (c->flags & SWS_ACCURATE_RND){ if (c->flags & SWS_ACCURATE_RND){
if (uDest){ if (uDest){
@ -915,7 +915,7 @@ static inline void RENAME(yuv2yuvX)(SwsContext *c, int16_t *lumFilter, int16_t *
return; return;
} }
#endif #endif
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize, yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize,
chrFilter, chrSrc, chrFilterSize, chrFilter, chrSrc, chrFilterSize,
dest, uDest, vDest, dstW, chrDstW); dest, uDest, vDest, dstW, chrDstW);
@ -939,7 +939,7 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, int16_t *lumSrc, int16_t *chr
uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW) uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
{ {
int i; int i;
#ifdef HAVE_MMX #if HAVE_MMX
if(!(c->flags & SWS_BITEXACT)){ if(!(c->flags & SWS_BITEXACT)){
long p= uDest ? 3 : 1; long p= uDest ? 3 : 1;
uint8_t *src[3]= {lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW}; uint8_t *src[3]= {lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
@ -1006,7 +1006,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize,
uint8_t *dest, long dstW, long dstY) uint8_t *dest, long dstW, long dstY)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
long dummy=0; long dummy=0;
if(!(c->flags & SWS_BITEXACT)){ if(!(c->flags & SWS_BITEXACT)){
if (c->flags & SWS_ACCURATE_RND){ if (c->flags & SWS_ACCURATE_RND){
@ -1133,7 +1133,7 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
} }
} }
#endif /* HAVE_MMX */ #endif /* HAVE_MMX */
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
/* The following list of supported dstFormat values should /* The following list of supported dstFormat values should
match what's found in the body of altivec_yuv2packedX() */ match what's found in the body of altivec_yuv2packedX() */
if (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA || if (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA ||
@ -1159,7 +1159,7 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, uint16_t *buf0, uint16_t *
int uvalpha1=4095-uvalpha; int uvalpha1=4095-uvalpha;
int i; int i;
#ifdef HAVE_MMX #if HAVE_MMX
if(!(c->flags & SWS_BITEXACT)){ if(!(c->flags & SWS_BITEXACT)){
switch(c->dstFormat) switch(c->dstFormat)
{ {
@ -1270,7 +1270,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
return; return;
} }
#ifdef HAVE_MMX #if HAVE_MMX
if(!(flags & SWS_BITEXACT)){ if(!(flags & SWS_BITEXACT)){
if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
{ {
@ -1464,7 +1464,7 @@ static inline void RENAME(yuv2packed1)(SwsContext *c, uint16_t *buf0, uint16_t *
static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"movq "MANGLE(bm01010101)", %%mm2 \n\t" "movq "MANGLE(bm01010101)", %%mm2 \n\t"
"mov %0, %%"REG_a" \n\t" "mov %0, %%"REG_a" \n\t"
@ -1489,7 +1489,7 @@ static inline void RENAME(yuy2ToY)(uint8_t *dst, uint8_t *src, long width, uint3
static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"movq "MANGLE(bm01010101)", %%mm4 \n\t" "movq "MANGLE(bm01010101)", %%mm4 \n\t"
"mov %0, %%"REG_a" \n\t" "mov %0, %%"REG_a" \n\t"
@ -1526,7 +1526,7 @@ static inline void RENAME(yuy2ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1,
* yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */ * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */
static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"mov %0, %%"REG_a" \n\t" "mov %0, %%"REG_a" \n\t"
"1: \n\t" "1: \n\t"
@ -1550,7 +1550,7 @@ static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width, uint3
static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) static inline void RENAME(uyvyToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile( __asm__ volatile(
"movq "MANGLE(bm01010101)", %%mm4 \n\t" "movq "MANGLE(bm01010101)", %%mm4 \n\t"
"mov %0, %%"REG_a" \n\t" "mov %0, %%"REG_a" \n\t"
@ -1643,7 +1643,7 @@ BGR2UV(uint16_t, bgr15ToUV, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RU<<10, GU<<5, BU
BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RU , GU<<5, BU<<11, RV , GV<<5, BV<<11, RGB2YUV_SHIFT+8) BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RU , GU<<5, BU<<11, RV , GV<<5, BV<<11, RGB2YUV_SHIFT+8)
BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU , GU<<5, BU<<10, RV , GV<<5, BV<<10, RGB2YUV_SHIFT+7) BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU , GU<<5, BU<<10, RV , GV<<5, BV<<10, RGB2YUV_SHIFT+7)
#ifdef HAVE_MMX #if HAVE_MMX
static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, int srcFormat) static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, int srcFormat)
{ {
@ -1758,7 +1758,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, uint8_t *
static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24);
#else #else
int i; int i;
@ -1775,7 +1775,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width, uint
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24);
#else #else
int i; int i;
@ -1809,7 +1809,7 @@ static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, uint8_t
static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24); RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_RGB24);
#else #else
int i; int i;
@ -1826,7 +1826,7 @@ static inline void RENAME(rgb24ToY)(uint8_t *dst, uint8_t *src, long width, uint
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
assert(src1==src2); assert(src1==src2);
RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24); RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);
#else #else
@ -1908,7 +1908,7 @@ static inline void RENAME(monoblack2Y)(uint8_t *dst, uint8_t *src, long width, u
static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc, static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW, int xInc,
int16_t *filter, int16_t *filterPos, long filterSize) int16_t *filter, int16_t *filterPos, long filterSize)
{ {
#ifdef HAVE_MMX #if HAVE_MMX
assert(filterSize % 4 == 0 && filterSize>0); assert(filterSize % 4 == 0 && filterSize>0);
if (filterSize==4) // Always true for upscaling, sometimes for down, too. if (filterSize==4) // Always true for upscaling, sometimes for down, too.
{ {
@ -2064,7 +2064,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW
); );
} }
#else #else
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize); hScale_altivec_real(dst, dstW, src, srcW, xInc, filter, filterPos, filterSize);
#else #else
int i; int i;
@ -2169,7 +2169,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src= formatConvBuffer; src= formatConvBuffer;
} }
#ifdef HAVE_MMX #if HAVE_MMX
// Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
#else #else
@ -2180,8 +2180,8 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
} }
else // fast bilinear upscale / crap downscale else // fast bilinear upscale / crap downscale
{ {
#if defined(ARCH_X86) #if ARCH_X86
#ifdef HAVE_MMX2 #if HAVE_MMX2
int i; int i;
#if defined(PIC) #if defined(PIC)
uint64_t ebxsave __attribute__((aligned(8))); uint64_t ebxsave __attribute__((aligned(8)));
@ -2202,7 +2202,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t"
#ifdef ARCH_X86_64 #if ARCH_X86_64
#define FUNNY_Y_CODE \ #define FUNNY_Y_CODE \
"movl (%%"REG_b"), %%esi \n\t"\ "movl (%%"REG_b"), %%esi \n\t"\
@ -2292,7 +2292,7 @@ FUNNY_Y_CODE
:: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask) :: "r" (src), "m" (dst), "m" (dstWidth), "m" (xInc_shr16), "m" (xInc_mask)
: "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
); );
#ifdef HAVE_MMX2 #if HAVE_MMX2
} //if MMX2 can't be used } //if MMX2 can't be used
#endif #endif
#else #else
@ -2305,7 +2305,7 @@ FUNNY_Y_CODE
dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha; dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
xpos+=xInc; xpos+=xInc;
} }
#endif /* defined(ARCH_X86) */ #endif /* ARCH_X86 */
} }
if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){
@ -2441,7 +2441,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src2= formatConvBuffer+VOFW; src2= formatConvBuffer+VOFW;
} }
#ifdef HAVE_MMX #if HAVE_MMX
// Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one). // Use the new MMX scaler if the MMX2 one can't be used (it is faster than the x86 ASM one).
if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
#else #else
@ -2453,8 +2453,8 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
} }
else // fast bilinear upscale / crap downscale else // fast bilinear upscale / crap downscale
{ {
#if defined(ARCH_X86) #if ARCH_X86
#ifdef HAVE_MMX2 #if HAVE_MMX2
int i; int i;
#if defined(PIC) #if defined(PIC)
uint64_t ebxsave __attribute__((aligned(8))); uint64_t ebxsave __attribute__((aligned(8)));
@ -2475,7 +2475,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t"
#ifdef ARCH_X86_64 #if ARCH_X86_64
#define FUNNY_UV_CODE \ #define FUNNY_UV_CODE \
"movl (%%"REG_b"), %%esi \n\t"\ "movl (%%"REG_b"), %%esi \n\t"\
@ -2573,7 +2573,7 @@ FUNNY_UV_CODE
/* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here, /* GCC 3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
which is needed to support GCC 4.0. */ which is needed to support GCC 4.0. */
#if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) #if ARCH_X86_64 && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
:: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
#else #else
:: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
@ -2581,7 +2581,7 @@ FUNNY_UV_CODE
"r" (src2) "r" (src2)
: "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi"
); );
#ifdef HAVE_MMX2 #if HAVE_MMX2
} //if MMX2 can't be used } //if MMX2 can't be used
#endif #endif
#else #else
@ -2599,7 +2599,7 @@ FUNNY_UV_CODE
*/ */
xpos+=xInc; xpos+=xInc;
} }
#endif /* defined(ARCH_X86) */ #endif /* ARCH_X86 */
} }
if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){
int i; int i;
@ -2821,7 +2821,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
break; //we can't output a dstY line so let's try with the next slice break; //we can't output a dstY line so let's try with the next slice
} }
#ifdef HAVE_MMX #if HAVE_MMX
c->blueDither= ff_dither8[dstY&1]; c->blueDither= ff_dither8[dstY&1];
if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555) if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
c->greenDither= ff_dither8[dstY&1]; c->greenDither= ff_dither8[dstY&1];
@ -2833,7 +2833,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
{ {
int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
#ifdef HAVE_MMX #if HAVE_MMX
int i; int i;
if (flags & SWS_ACCURATE_RND){ if (flags & SWS_ACCURATE_RND){
int s= APCK_SIZE / 8; int s= APCK_SIZE / 8;
@ -2987,7 +2987,7 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s
} }
} }
#ifdef HAVE_MMX #if HAVE_MMX
__asm__ volatile(SFENCE:::"memory"); __asm__ volatile(SFENCE:::"memory");
__asm__ volatile(EMMS:::"memory"); __asm__ volatile(EMMS:::"memory");
#endif #endif

View File

@ -45,28 +45,26 @@ extern const uint8_t dither_8x8_32[8][8];
extern const uint8_t dither_8x8_73[8][8]; extern const uint8_t dither_8x8_73[8][8];
extern const uint8_t dither_8x8_220[8][8]; extern const uint8_t dither_8x8_220[8][8];
#ifdef HAVE_MMX #if HAVE_MMX
/* hope these constant values are cache line aligned */ /* hope these constant values are cache line aligned */
DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL; DECLARE_ASM_CONST(8, uint64_t, mmx_00ffw) = 0x00ff00ff00ff00ffULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL; DECLARE_ASM_CONST(8, uint64_t, mmx_redmask) = 0xf8f8f8f8f8f8f8f8ULL;
DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL; DECLARE_ASM_CONST(8, uint64_t, mmx_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
#undef HAVE_MMX
//MMX versions //MMX versions
#undef RENAME #undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2 #undef HAVE_MMX2
#undef HAVE_3DNOW #undef HAVE_3DNOW
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define RENAME(a) a ## _MMX #define RENAME(a) a ## _MMX
#include "yuv2rgb_template.c" #include "yuv2rgb_template.c"
//MMX2 versions //MMX2 versions
#undef RENAME #undef RENAME
#define HAVE_MMX #undef HAVE_MMX2
#define HAVE_MMX2 #define HAVE_MMX2 1
#undef HAVE_3DNOW
#define RENAME(a) a ## _MMX2 #define RENAME(a) a ## _MMX2
#include "yuv2rgb_template.c" #include "yuv2rgb_template.c"
@ -485,7 +483,7 @@ EPILOG(1)
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c) SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
{ {
#if defined(HAVE_MMX2) || defined(HAVE_MMX) #if HAVE_MMX2 || HAVE_MMX
if (c->flags & SWS_CPU_CAPS_MMX2){ if (c->flags & SWS_CPU_CAPS_MMX2){
switch(c->dstFormat){ switch(c->dstFormat){
case PIX_FMT_RGB32: return yuv420_rgb32_MMX2; case PIX_FMT_RGB32: return yuv420_rgb32_MMX2;
@ -503,19 +501,19 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
} }
} }
#endif #endif
#ifdef HAVE_VIS #if HAVE_VIS
{ {
SwsFunc t= yuv2rgb_init_vis(c); SwsFunc t= yuv2rgb_init_vis(c);
if (t) return t; if (t) return t;
} }
#endif #endif
#ifdef CONFIG_MLIB #if CONFIG_MLIB
{ {
SwsFunc t= yuv2rgb_init_mlib(c); SwsFunc t= yuv2rgb_init_mlib(c);
if (t) return t; if (t) return t;
} }
#endif #endif
#ifdef HAVE_ALTIVEC #if HAVE_ALTIVEC
if (c->flags & SWS_CPU_CAPS_ALTIVEC) if (c->flags & SWS_CPU_CAPS_ALTIVEC)
{ {
SwsFunc t = yuv2rgb_init_altivec(c); SwsFunc t = yuv2rgb_init_altivec(c);
@ -523,7 +521,7 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
} }
#endif #endif
#ifdef ARCH_BFIN #if ARCH_BFIN
if (c->flags & SWS_CPU_CAPS_BFIN) if (c->flags & SWS_CPU_CAPS_BFIN)
{ {
SwsFunc t = ff_bfin_yuv2rgb_get_func_ptr (c); SwsFunc t = ff_bfin_yuv2rgb_get_func_ptr (c);

View File

@ -30,14 +30,14 @@
#undef EMMS #undef EMMS
#undef SFENCE #undef SFENCE
#ifdef HAVE_3DNOW #if HAVE_3DNOW
/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */ /* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
#define EMMS "femms" #define EMMS "femms"
#else #else
#define EMMS "emms" #define EMMS "emms"
#endif #endif
#ifdef HAVE_MMX2 #if HAVE_MMX2
#define MOVNTQ "movntq" #define MOVNTQ "movntq"
#define SFENCE "sfence" #define SFENCE "sfence"
#else #else
@ -335,7 +335,7 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr
"1: \n\t" "1: \n\t"
YUV2RGB YUV2RGB
/* mm0=B, %%mm2=G, %%mm1=R */ /* mm0=B, %%mm2=G, %%mm1=R */
#ifdef HAVE_MMX2 #if HAVE_MMX2
"movq "MANGLE(ff_M24A)", %%mm4 \n\t" "movq "MANGLE(ff_M24A)", %%mm4 \n\t"
"movq "MANGLE(ff_M24C)", %%mm7 \n\t" "movq "MANGLE(ff_M24C)", %%mm7 \n\t"
"pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */ "pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */