Commit aaca69c1 authored by Ronald S. Bultje's avatar Ronald S. Bultje

swscale: remove swScale_{c,MMX,MMX2} duplication.

parent c4fd283a
......@@ -1214,18 +1214,13 @@ SwsFunc ff_getSwsFunc(SwsContext *c)
sws_init_swScale_c(c);
#if HAVE_MMX2
// ordered per speed fastest first
if (cpu_flags & AV_CPU_FLAG_MMX2) {
sws_init_swScale_MMX2(c);
return swScale_MMX2;
} else
#endif
#if HAVE_MMX
if (cpu_flags & AV_CPU_FLAG_MMX) {
if (cpu_flags & AV_CPU_FLAG_MMX)
sws_init_swScale_MMX(c);
return swScale_MMX;
} else
#endif
#if HAVE_MMX2
if (cpu_flags & AV_CPU_FLAG_MMX2)
sws_init_swScale_MMX2(c);
#endif
#if HAVE_ALTIVEC
if (cpu_flags & AV_CPU_FLAG_ALTIVEC)
......
......@@ -485,6 +485,11 @@ inline static void hcscale_c(SwsContext *c, uint16_t *dst, long dstWidth,
#define DEBUG_SWSCALE_BUFFERS 0
#define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
#if HAVE_MMX
static void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
int lastInLumBuf, int lastInChrBuf);
#endif
static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[],
int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[])
{
......@@ -656,6 +661,7 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[],
if (!enough_lines)
break; //we can't output a dstY line so let's try with the next slice
if (HAVE_MMX) updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex, lastInLumBuf, lastInChrBuf);
if (dstY < dstH-2) {
const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
......@@ -780,6 +786,10 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[],
if ((dstFormat == PIX_FMT_YUVA420P) && !alpPixBuf)
fillPlane(dst[3], dstStride[3], dstW, dstY-lastDstY, lastDstY, 255);
if (HAVE_MMX2 && av_get_cpu_flags() & AV_CPU_FLAG_MMX2)
__asm__ volatile("sfence":::"memory");
emms_c();
/* store changed local vars back in the context */
c->dstY= dstY;
c->lumBufIndex= lumBufIndex;
......
This diff is collapsed.
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