mirror of https://git.ffmpeg.org/ffmpeg.git
Do not assemble MMX, MMX2 or 3DNOW code unconditionally on X86 and X86_64.
Originally committed as revision 19339 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
parent
9bd0d79fcb
commit
dbdae6ec54
|
@ -72,9 +72,11 @@ 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(ARCH_X86_64)
|
#if defined(HAVE_MMX)
|
||||||
static const uint64_t mmx_null __attribute__((aligned(8))) = 0x0000000000000000ULL;
|
static const uint64_t mmx_null __attribute__((aligned(8))) = 0x0000000000000000ULL;
|
||||||
static const uint64_t mmx_one __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
|
static const uint64_t mmx_one __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
|
||||||
|
#endif
|
||||||
|
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
||||||
static const uint64_t mask32b attribute_used __attribute__((aligned(8))) = 0x000000FF000000FFULL;
|
static const uint64_t mask32b attribute_used __attribute__((aligned(8))) = 0x000000FF000000FFULL;
|
||||||
static const uint64_t mask32g attribute_used __attribute__((aligned(8))) = 0x0000FF000000FF00ULL;
|
static const uint64_t mask32g attribute_used __attribute__((aligned(8))) = 0x0000FF000000FF00ULL;
|
||||||
static const uint64_t mask32r attribute_used __attribute__((aligned(8))) = 0x00FF000000FF0000ULL;
|
static const uint64_t mask32r attribute_used __attribute__((aligned(8))) = 0x00FF000000FF0000ULL;
|
||||||
|
@ -195,7 +197,7 @@ static uint64_t __attribute__((aligned(8))) dither8[2]={
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void sws_rgb2rgb_init(int flags){
|
void sws_rgb2rgb_init(int flags){
|
||||||
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
#if defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX)
|
||||||
if(flags & SWS_CPU_CAPS_MMX2){
|
if(flags & SWS_CPU_CAPS_MMX2){
|
||||||
rgb15to16= rgb15to16_MMX2;
|
rgb15to16= rgb15to16_MMX2;
|
||||||
rgb15to24= rgb15to24_MMX2;
|
rgb15to24= rgb15to24_MMX2;
|
||||||
|
@ -287,7 +289,7 @@ void sws_rgb2rgb_init(int flags){
|
||||||
vu9_to_vu12= vu9_to_vu12_MMX;
|
vu9_to_vu12= vu9_to_vu12_MMX;
|
||||||
yvu9_to_yuy2= yvu9_to_yuy2_MMX;
|
yvu9_to_yuy2= yvu9_to_yuy2_MMX;
|
||||||
}else
|
}else
|
||||||
#endif /* defined(ARCH_X86) || defined(ARCH_X86_64) */
|
#endif /* defined(HAVE_MMX2) || defined(HAVE_3DNOW) || defined(HAVE_MMX) */
|
||||||
{
|
{
|
||||||
rgb15to16= rgb15to16_C;
|
rgb15to16= rgb15to16_C;
|
||||||
rgb15to24= rgb15to24_C;
|
rgb15to24= rgb15to24_C;
|
||||||
|
|
|
@ -1240,7 +1240,7 @@ static inline int initFilter(int16_t **outFilter, int16_t **filterPos, int *outF
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
#ifdef HAVE_MMX2
|
||||||
static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *filter, int32_t *filterPos, int numSplits)
|
static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *filter, int32_t *filterPos, int numSplits)
|
||||||
{
|
{
|
||||||
uint8_t *fragmentA;
|
uint8_t *fragmentA;
|
||||||
|
@ -1411,7 +1411,7 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil
|
||||||
}
|
}
|
||||||
filterPos[i/2]= xpos>>16; // needed to jump to the next part
|
filterPos[i/2]= xpos>>16; // needed to jump to the next part
|
||||||
}
|
}
|
||||||
#endif // ARCH_X86 || ARCH_X86_64
|
#endif /* HAVE_MMX2 */
|
||||||
|
|
||||||
static void globalInit(void){
|
static void globalInit(void){
|
||||||
// generating tables:
|
// generating tables:
|
||||||
|
@ -2114,11 +2114,11 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
|
||||||
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
|
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
|
||||||
srcFilter->chrH, dstFilter->chrH, c->param);
|
srcFilter->chrH, dstFilter->chrH, c->param);
|
||||||
|
|
||||||
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
#define MAX_FUNNY_CODE_SIZE 10000
|
||||||
|
#if defined(HAVE_MMX2)
|
||||||
// can't downscale !!!
|
// can't downscale !!!
|
||||||
if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))
|
if(c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))
|
||||||
{
|
{
|
||||||
#define MAX_FUNNY_CODE_SIZE 10000
|
|
||||||
#ifdef MAP_ANONYMOUS
|
#ifdef MAP_ANONYMOUS
|
||||||
c->funnyYCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
c->funnyYCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
||||||
c->funnyUVCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
c->funnyUVCode = (uint8_t*)mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
|
||||||
|
@ -2135,7 +2135,7 @@ SwsContext *sws_getContext(int srcW, int srcH, int origSrcFormat, int dstW, int
|
||||||
initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode , c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
|
initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode , c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
|
||||||
initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
|
initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
|
||||||
}
|
}
|
||||||
#endif /* defined(ARCH_X86) || defined(ARCH_X86_64) */
|
#endif /* defined(HAVE_MMX2) */
|
||||||
} // Init Horizontal stuff
|
} // Init Horizontal stuff
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ const uint8_t __attribute__((aligned(8))) dither_8x8_220[8][8]={
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
#ifdef HAVE_MMX
|
||||||
|
|
||||||
/* hope these constant values are cache line aligned */
|
/* hope these constant values are cache line aligned */
|
||||||
uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
|
uint64_t attribute_used __attribute__((aligned(8))) mmx_00ffw = 0x00ff00ff00ff00ffULL;
|
||||||
|
@ -578,7 +578,7 @@ EPILOG(1)
|
||||||
|
|
||||||
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
|
SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
|
||||||
{
|
{
|
||||||
#if defined(ARCH_X86) || defined(ARCH_X86_64)
|
#if defined(HAVE_MMX2) || defined(HAVE_MMX)
|
||||||
if(c->flags & SWS_CPU_CAPS_MMX2){
|
if(c->flags & SWS_CPU_CAPS_MMX2){
|
||||||
switch(c->dstFormat){
|
switch(c->dstFormat){
|
||||||
case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
|
case IMGFMT_BGR32: return yuv420_rgb32_MMX2;
|
||||||
|
|
Loading…
Reference in New Issue