Rename "funny" code to "mmx2 filter" code.

Originally committed as revision 29507 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
This commit is contained in:
Ramiro Polla 2009-08-13 18:28:17 +00:00
parent 475f361308
commit bcdedf675f
3 changed files with 50 additions and 50 deletions

View File

@ -1753,7 +1753,7 @@ error:
}
#ifdef COMPILE_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 *filterCode, int16_t *filter, int32_t *filterPos, int numSplits)
{
uint8_t *fragmentA;
x86_reg imm8OfPShufW1A;
@ -1876,11 +1876,11 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil
filter[i+3] = (((xpos+xInc*3) & 0xFFFF) ^ 0xFFFF)>>9;
filterPos[i/2]= xx;
memcpy(funnyCode + fragmentPos, fragment, fragmentLength);
memcpy(filterCode + fragmentPos, fragment, fragmentLength);
funnyCode[fragmentPos + imm8OfPShufW1]=
filterCode[fragmentPos + imm8OfPShufW1]=
(a+inc) | ((b+inc)<<2) | ((c+inc)<<4) | ((d+inc)<<6);
funnyCode[fragmentPos + imm8OfPShufW2]=
filterCode[fragmentPos + imm8OfPShufW2]=
a | (b<<2) | (c<<4) | (d<<6);
if (i+4-inc>=dstW) shift=maxShift; //avoid overread
@ -1888,14 +1888,14 @@ static void initMMX2HScaler(int dstW, int xInc, uint8_t *funnyCode, int16_t *fil
if (shift && i>=shift)
{
funnyCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
funnyCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
filterCode[fragmentPos + imm8OfPShufW1]+= 0x55*shift;
filterCode[fragmentPos + imm8OfPShufW2]+= 0x55*shift;
filterPos[i/2]-=shift;
}
fragmentPos+= fragmentLength;
funnyCode[fragmentPos]= RET;
filterCode[fragmentPos]= RET;
}
xpos+=xInc;
}
@ -2808,20 +2808,20 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
(flags&SWS_BICUBLIN) ? (flags|SWS_BILINEAR) : flags,
srcFilter->chrH, dstFilter->chrH, c->param);
#define MAX_FUNNY_CODE_SIZE 10000
#define MAX_MMX2_FILTER_CODE_SIZE 10000
#if defined(COMPILE_MMX2)
// can't downscale !!!
if (c->canMMX2BeUsed && (flags & SWS_FAST_BILINEAR))
{
#ifdef MAP_ANONYMOUS
c->funnyYCode = mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
c->funnyUVCode = mmap(NULL, MAX_FUNNY_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
c->lumMmx2FilterCode = mmap(NULL, MAX_MMX2_FILTER_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
c->chrMmx2FilterCode = mmap(NULL, MAX_MMX2_FILTER_CODE_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
#elif HAVE_VIRTUALALLOC
c->funnyYCode = VirtualAlloc(NULL, MAX_FUNNY_CODE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->funnyUVCode = VirtualAlloc(NULL, MAX_FUNNY_CODE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->lumMmx2FilterCode = VirtualAlloc(NULL, MAX_MMX2_FILTER_CODE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
c->chrMmx2FilterCode = VirtualAlloc(NULL, MAX_MMX2_FILTER_CODE_SIZE, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
c->funnyYCode = av_malloc(MAX_FUNNY_CODE_SIZE);
c->funnyUVCode = av_malloc(MAX_FUNNY_CODE_SIZE);
c->lumMmx2FilterCode = av_malloc(MAX_MMX2_FILTER_CODE_SIZE);
c->chrMmx2FilterCode = av_malloc(MAX_MMX2_FILTER_CODE_SIZE);
#endif
c->lumMmx2Filter = av_malloc((dstW /8+8)*sizeof(int16_t));
@ -2829,8 +2829,8 @@ SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat, int d
c->lumMmx2FilterPos= av_malloc((dstW /2/8+8)*sizeof(int32_t));
c->chrMmx2FilterPos= av_malloc((c->chrDstW/2/4+8)*sizeof(int32_t));
initMMX2HScaler( dstW, c->lumXInc, c->funnyYCode , c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
initMMX2HScaler(c->chrDstW, c->chrXInc, c->funnyUVCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
initMMX2HScaler( dstW, c->lumXInc, c->lumMmx2FilterCode, c->lumMmx2Filter, c->lumMmx2FilterPos, 8);
initMMX2HScaler(c->chrDstW, c->chrXInc, c->chrMmx2FilterCode, c->chrMmx2Filter, c->chrMmx2FilterPos, 4);
}
#endif /* defined(COMPILE_MMX2) */
} // initialize horizontal stuff
@ -3499,17 +3499,17 @@ void sws_freeContext(SwsContext *c){
#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);
if (c->lumMmx2FilterCode) munmap(c->lumMmx2FilterCode, MAX_MMX2_FILTER_CODE_SIZE);
if (c->chrMmx2FilterCode) munmap(c->chrMmx2FilterCode, MAX_MMX2_FILTER_CODE_SIZE);
#elif HAVE_VIRTUALALLOC
if (c->funnyYCode ) VirtualFree(c->funnyYCode , MAX_FUNNY_CODE_SIZE, MEM_RELEASE);
if (c->funnyUVCode) VirtualFree(c->funnyUVCode, MAX_FUNNY_CODE_SIZE, MEM_RELEASE);
if (c->lumMmx2FilterCode) VirtualFree(c->lumMmx2FilterCode, MAX_MMX2_FILTER_CODE_SIZE, MEM_RELEASE);
if (c->chrMmx2FilterCode) VirtualFree(c->chrMmx2FilterCode, MAX_MMX2_FILTER_CODE_SIZE, MEM_RELEASE);
#else
av_free(c->funnyYCode );
av_free(c->funnyUVCode);
av_free(c->lumMmx2FilterCode);
av_free(c->chrMmx2FilterCode);
#endif
c->funnyYCode=NULL;
c->funnyUVCode=NULL;
c->lumMmx2FilterCode=NULL;
c->chrMmx2FilterCode=NULL;
#endif /* ARCH_X86 && CONFIG_GPL */
av_freep(&c->lumMmx2Filter);

View File

@ -111,8 +111,8 @@ typedef struct SwsContext{
int vLumBufSize;
int vChrBufSize;
uint8_t *funnyYCode;
uint8_t *funnyUVCode;
uint8_t *lumMmx2FilterCode;
uint8_t *chrMmx2FilterCode;
int32_t *lumMmx2FilterPos;
int32_t *chrMmx2FilterPos;
int16_t *lumMmx2Filter;

View File

@ -2232,7 +2232,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
int32_t av_unused *mmx2FilterPos = c->lumMmx2FilterPos;
int16_t av_unused *mmx2Filter = c->lumMmx2Filter;
int av_unused canMMX2BeUsed = c->canMMX2BeUsed;
void av_unused *funnyYCode = c->funnyYCode;
void av_unused *mmx2FilterCode= c->lumMmx2FilterCode;
void (*internal_func)(uint8_t *, const uint8_t *, long, uint32_t *) = isAlpha ? c->hascale_internal : c->hyscale_internal;
if (isAlpha) {
@ -2286,7 +2286,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
#if ARCH_X86_64
#define FUNNY_Y_CODE \
#define CALL_MMX2_FILTER_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
@ -2296,7 +2296,7 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
#else
#define FUNNY_Y_CODE \
#define CALL_MMX2_FILTER_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
@ -2305,20 +2305,20 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
#endif /* ARCH_X86_64 */
FUNNY_Y_CODE
FUNNY_Y_CODE
FUNNY_Y_CODE
FUNNY_Y_CODE
FUNNY_Y_CODE
FUNNY_Y_CODE
FUNNY_Y_CODE
FUNNY_Y_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
#if defined(PIC)
"mov %5, %%"REG_b" \n\t"
#endif
:: "m" (src), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos),
"m" (funnyYCode)
"m" (mmx2FilterCode)
#if defined(PIC)
,"m" (ebxsave)
#endif
@ -2415,7 +2415,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
int32_t av_unused *mmx2FilterPos = c->chrMmx2FilterPos;
int16_t av_unused *mmx2Filter = c->chrMmx2Filter;
int av_unused canMMX2BeUsed = c->canMMX2BeUsed;
void av_unused *funnyUVCode = c->funnyUVCode;
void av_unused *mmx2FilterCode= c->chrMmx2FilterCode;
if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE)
return;
@ -2472,7 +2472,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
#if ARCH_X86_64
#define FUNNY_UV_CODE \
#define CALL_MMX2_FILTER_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\
@ -2482,7 +2482,7 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
#else
#define FUNNY_UV_CODE \
#define CALL_MMX2_FILTER_CODE \
"movl (%%"REG_b"), %%esi \n\t"\
"call *%4 \n\t"\
"addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\
@ -2491,10 +2491,10 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
#endif /* ARCH_X86_64 */
FUNNY_UV_CODE
FUNNY_UV_CODE
FUNNY_UV_CODE
FUNNY_UV_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
"xor %%"REG_a", %%"REG_a" \n\t" // i
"mov %5, %%"REG_c" \n\t" // src
"mov %1, %%"REG_D" \n\t" // buf1
@ -2503,16 +2503,16 @@ FUNNY_UV_CODE
PREFETCH" 32(%%"REG_c") \n\t"
PREFETCH" 64(%%"REG_c") \n\t"
FUNNY_UV_CODE
FUNNY_UV_CODE
FUNNY_UV_CODE
FUNNY_UV_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
CALL_MMX2_FILTER_CODE
#if defined(PIC)
"mov %6, %%"REG_b" \n\t"
#endif
:: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos),
"m" (funnyUVCode), "m" (src2)
"m" (mmx2FilterCode), "m" (src2)
#if defined(PIC)
,"m" (ebxsave)
#endif