Commit b63f641e authored by Aurelien Jacobs's avatar Aurelien Jacobs

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
parent b250f9c6
......@@ -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 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_one) = 0xFFFFFFFFFFFFFFFFULL;
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, green_15mask) = 0x000003e0000003e0ULL;
DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
#endif /* defined(ARCH_X86) */
#endif /* ARCH_X86 */
#define RGB2YUV_SHIFT 8
#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_3DNOW
#undef HAVE_SSE2
#define HAVE_MMX 0
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define HAVE_SSE2 0
#define RENAME(a) a ## _C
#include "rgb2rgb_template.c"
#if defined(ARCH_X86) && defined(CONFIG_GPL)
#if ARCH_X86 && CONFIG_GPL
//MMX versions
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
#undef HAVE_MMX
#define HAVE_MMX 1
#define RENAME(a) a ## _MMX
#include "rgb2rgb_template.c"
//MMX2 versions
#undef RENAME
#define HAVE_MMX
#define HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
#undef HAVE_MMX2
#define HAVE_MMX2 1
#define RENAME(a) a ## _MMX2
#include "rgb2rgb_template.c"
//3DNOW versions
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2
#define HAVE_3DNOW
#undef HAVE_SSE2
#undef HAVE_3DNOW
#define HAVE_MMX2 0
#define HAVE_3DNOW 1
#define RENAME(a) a ## _3DNOW
#include "rgb2rgb_template.c"
......@@ -183,7 +183,7 @@ DECLARE_ASM_CONST(8, uint64_t, blue_15mask) = 0x0000001f0000001fULL;
*/
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)
rgb2rgb_init_MMX2();
else if (flags & SWS_CPU_CAPS_3DNOW)
......@@ -191,7 +191,7 @@ void sws_rgb2rgb_init(int flags){
else if (flags & SWS_CPU_CAPS_MMX)
rgb2rgb_init_MMX();
else
#endif /* defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX) */
#endif /* HAVE_MMX2 || HAVE_3DNOW || HAVE_MMX */
rgb2rgb_init_C();
}
......
This diff is collapsed.
......@@ -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(outContext, dst, dstStride, 0, dstH, out, refStride);
#if defined(ARCH_X86)
#if ARCH_X86
__asm__ volatile ("emms\n\t");
#endif
......@@ -208,7 +208,7 @@ int main(int argc, char **argv){
}
sws_scale(sws, rgb_src, rgb_stride, 0, H, src, stride);
#if defined(ARCH_X86)
#if ARCH_X86
__asm__ volatile ("emms\n\t");
#endif
......
......@@ -62,7 +62,7 @@ untested special converters
#include <unistd.h>
#include "config.h"
#include <assert.h>
#ifdef HAVE_SYS_MMAN_H
#if HAVE_SYS_MMAN_H
#include <sys/mman.h>
#if defined(MAP_ANON) && !defined(MAP_ANONYMOUS)
#define MAP_ANONYMOUS MAP_ANON
......@@ -202,7 +202,7 @@ add BGR4 output support
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, bFC)= 0xFCFCFCFCFCFCFCFCLL;
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;
#endif /* defined(ARCH_X86) */
#endif /* ARCH_X86 */
// clipping helper table for C implementations:
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
//Plain C versions
#if !defined (HAVE_MMX) || defined (RUNTIME_CPUDETECT) || !defined(CONFIG_GPL)
#if !HAVE_MMX || defined (RUNTIME_CPUDETECT) || !CONFIG_GPL
#define COMPILE_C
#endif
#ifdef ARCH_PPC
#if (defined (HAVE_ALTIVEC) || defined (RUNTIME_CPUDETECT)) && defined (CONFIG_GPL)
#if ARCH_PPC
#if (HAVE_ALTIVEC || defined (RUNTIME_CPUDETECT)) && CONFIG_GPL
#define COMPILE_ALTIVEC
#endif //HAVE_ALTIVEC
#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
#endif
#if (defined (HAVE_MMX2) || defined (RUNTIME_CPUDETECT)) && defined (CONFIG_GPL)
#if (HAVE_MMX2 || defined (RUNTIME_CPUDETECT)) && CONFIG_GPL
#define COMPILE_MMX2
#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
#endif
#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_MMX2
#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
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_ALTIVEC
#define RENAME(a) a ## _C
#include "swscale_template.c"
#endif
#ifdef COMPILE_ALTIVEC
#undef RENAME
#define HAVE_ALTIVEC
#undef HAVE_ALTIVEC
#define HAVE_ALTIVEC 1
#define RENAME(a) a ## _altivec
#include "swscale_template.c"
#endif
#if defined(ARCH_X86)
#if ARCH_X86
//X86 versions
/*
......@@ -1007,9 +1009,12 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//MMX versions
#ifdef COMPILE_MMX
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#define HAVE_MMX 1
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define RENAME(a) a ## _MMX
#include "swscale_template.c"
#endif
......@@ -1017,9 +1022,12 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//MMX2 versions
#ifdef COMPILE_MMX2
#undef RENAME
#define HAVE_MMX
#define HAVE_MMX2
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#define HAVE_MMX 1
#define HAVE_MMX2 1
#define HAVE_3DNOW 0
#define RENAME(a) a ## _MMX2
#include "swscale_template.c"
#endif
......@@ -1027,9 +1035,12 @@ static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t *
//3DNOW versions
#ifdef COMPILE_3DNOW
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX
#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
#include "swscale_template.c"
#endif
......@@ -1061,7 +1072,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
int64_t *filter2=NULL;
const int64_t fone= 1LL<<54;
int ret= -1;
#if defined(ARCH_X86)
#if ARCH_X86
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)
#endif
......@@ -1617,8 +1628,8 @@ static void globalInit(void){
static SwsFunc getSwsFunc(int flags){
#if defined(RUNTIME_CPUDETECT) && defined (CONFIG_GPL)
#if defined(ARCH_X86)
#if defined(RUNTIME_CPUDETECT) && CONFIG_GPL
#if ARCH_X86
// ordered per speed fastest first
if (flags & SWS_CPU_CAPS_MMX2)
return swScale_MMX2;
......@@ -1630,22 +1641,22 @@ static SwsFunc getSwsFunc(int flags){
return swScale_C;
#else
#ifdef ARCH_PPC
#if ARCH_PPC
if (flags & SWS_CPU_CAPS_ALTIVEC)
return swScale_altivec;
else
return swScale_C;
#endif
return swScale_C;
#endif /* defined(ARCH_X86) */
#endif /* ARCH_X86 */
#else //RUNTIME_CPUDETECT
#ifdef HAVE_MMX2
#if HAVE_MMX2
return swScale_MMX2;
#elif defined (HAVE_3DNOW)
#elif HAVE_3DNOW
return swScale_3DNow;
#elif defined (HAVE_MMX)
#elif HAVE_MMX
return swScale_MMX;
#elif defined (HAVE_ALTIVEC)
#elif HAVE_ALTIVEC
return swScale_altivec;
#else
return swScale_C;
......@@ -2169,22 +2180,22 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
int unscaled, needsDither;
int srcRange, dstRange;
SwsFilter dummyFilter= {NULL, NULL, NULL, NULL};
#if defined(ARCH_X86)
#if ARCH_X86
if (flags & SWS_CPU_CAPS_MMX)
__asm__ volatile("emms\n\t"::: "memory");
#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);
#ifdef HAVE_MMX2
#if HAVE_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;
#elif defined (HAVE_MMX)
#elif HAVE_MMX
flags |= SWS_CPU_CAPS_MMX;
#elif defined (HAVE_ALTIVEC)
#elif HAVE_ALTIVEC
flags |= SWS_CPU_CAPS_ALTIVEC;
#elif defined (ARCH_BFIN)
#elif ARCH_BFIN
flags |= SWS_CPU_CAPS_BFIN;
#endif
#endif /* RUNTIME_CPUDETECT */
......@@ -2311,7 +2322,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
{
c->swScale= PlanarToNV12Wrapper;
}
#ifdef CONFIG_GPL
#if CONFIG_GPL
/* yuv2bgr */
if ((srcFormat==PIX_FMT_YUV420P || srcFormat==PIX_FMT_YUV422P) && (isBGR(dstFormat) || isRGB(dstFormat))
&& !(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;
}
#ifdef ARCH_BFIN
#if ARCH_BFIN
if (flags & SWS_CPU_CAPS_BFIN)
ff_bfin_get_unscaled_swscale (c);
#endif
......@@ -2518,7 +2529,7 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
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->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
{
#if defined(ARCH_X86)
#if ARCH_X86
av_log(c, AV_LOG_VERBOSE, "using X86-Asm scaler for horizontal scaling\n");
#else
if (flags & SWS_FAST_BILINEAR)
......@@ -3115,7 +3126,7 @@ void sws_freeContext(SwsContext *c){
av_freep(&c->vChrFilter);
av_freep(&c->hLumFilter);
av_freep(&c->hChrFilter);
#ifdef HAVE_ALTIVEC
#if HAVE_ALTIVEC
av_freep(&c->vYCoeffsBank);
av_freep(&c->vCCoeffsBank);
#endif
......@@ -3125,7 +3136,7 @@ void sws_freeContext(SwsContext *c){
av_freep(&c->hLumFilterPos);
av_freep(&c->hChrFilterPos);
#if defined(ARCH_X86) && defined(CONFIG_GPL)
#if ARCH_X86 && CONFIG_GPL
#ifdef MAP_ANONYMOUS
if (c->funnyYCode) munmap(c->funnyYCode, MAX_FUNNY_CODE_SIZE);
if (c->funnyUVCode) munmap(c->funnyUVCode, MAX_FUNNY_CODE_SIZE);
......@@ -3135,7 +3146,7 @@ void sws_freeContext(SwsContext *c){
#endif
c->funnyYCode=NULL;
c->funnyUVCode=NULL;
#endif /* defined(ARCH_X86) */
#endif /* ARCH_X86 */
av_freep(&c->lumMmx2Filter);
av_freep(&c->chrMmx2Filter);
......
......@@ -23,7 +23,7 @@
#include "config.h"
#ifdef HAVE_ALTIVEC_H
#if HAVE_ALTIVEC_H
#include <altivec.h>
#endif
......@@ -42,7 +42,7 @@
#define ALT32_CORR 1
#endif
#ifdef ARCH_X86_64
#if ARCH_X86_64
# define APCK_PTR2 8
# define APCK_COEF 16
# define APCK_SIZE 24
......@@ -175,7 +175,7 @@ typedef struct SwsContext{
uint64_t u_temp __attribute__((aligned(8)));
uint64_t v_temp __attribute__((aligned(8)));
#ifdef HAVE_ALTIVEC
#if HAVE_ALTIVEC
vector signed short CY;
vector signed short CRV;
......@@ -189,7 +189,7 @@ typedef struct SwsContext{
#endif
#ifdef ARCH_BFIN
#if ARCH_BFIN
uint32_t oy __attribute__((aligned(4)));
uint32_t oc __attribute__((aligned(4)));
uint32_t zero __attribute__((aligned(4)));
......@@ -203,7 +203,7 @@ typedef struct SwsContext{
uint32_t gmask __attribute__((aligned(4)));
#endif
#ifdef HAVE_VIS
#if HAVE_VIS
uint64_t sparc_coeffs[10] __attribute__((aligned(8)));
#endif
......
This diff is collapsed.
......@@ -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_220[8][8];
#ifdef HAVE_MMX
#if HAVE_MMX
/* hope these constant values are cache line aligned */
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_grnmask) = 0xfcfcfcfcfcfcfcfcULL;
#undef HAVE_MMX
//MMX versions
#undef RENAME
#define HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
#define HAVE_MMX2 0
#define HAVE_3DNOW 0
#define RENAME(a) a ## _MMX
#include "yuv2rgb_template.c"
//MMX2 versions
#undef RENAME
#define HAVE_MMX
#define HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_MMX2
#define HAVE_MMX2 1
#define RENAME(a) a ## _MMX2
#include "yuv2rgb_template.c"
......@@ -485,7 +483,7 @@ EPILOG(1)
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){
switch(c->dstFormat){
case PIX_FMT_RGB32: return yuv420_rgb32_MMX2;
......@@ -503,19 +501,19 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
}
}
#endif
#ifdef HAVE_VIS
#if HAVE_VIS
{
SwsFunc t= yuv2rgb_init_vis(c);
if (t) return t;
}
#endif
#ifdef CONFIG_MLIB
#if CONFIG_MLIB
{
SwsFunc t= yuv2rgb_init_mlib(c);
if (t) return t;
}
#endif
#ifdef HAVE_ALTIVEC
#if HAVE_ALTIVEC
if (c->flags & SWS_CPU_CAPS_ALTIVEC)
{
SwsFunc t = yuv2rgb_init_altivec(c);
......@@ -523,7 +521,7 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
}
#endif
#ifdef ARCH_BFIN
#if ARCH_BFIN
if (c->flags & SWS_CPU_CAPS_BFIN)
{
SwsFunc t = ff_bfin_yuv2rgb_get_func_ptr (c);
......
......@@ -30,14 +30,14 @@
#undef EMMS
#undef SFENCE
#ifdef HAVE_3DNOW
#if HAVE_3DNOW
/* On K6 femms is faster than emms. On K7 femms is directly mapped to emms. */
#define EMMS "femms"
#else
#define EMMS "emms"
#endif
#ifdef HAVE_MMX2
#if HAVE_MMX2
#define MOVNTQ "movntq"
#define SFENCE "sfence"
#else
......@@ -335,7 +335,7 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr
"1: \n\t"
YUV2RGB
/* mm0=B, %%mm2=G, %%mm1=R */
#ifdef HAVE_MMX2
#if HAVE_MMX2
"movq "MANGLE(ff_M24A)", %%mm4 \n\t"
"movq "MANGLE(ff_M24C)", %%mm7 \n\t"
"pshufw $0x50, %%mm0, %%mm5 \n\t" /* B3 B2 B3 B2 B1 B0 B1 B0 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment