summaryrefslogtreecommitdiff
path: root/libswscale/swscale_template.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2011-05-24 12:43:29 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2011-05-24 14:50:15 -0400
commitaaca69c130edf219110c616d2e236a3a27caf706 (patch)
tree738461f9b053013da896462f949ab487a7bc2637 /libswscale/swscale_template.c
parentc4fd283a467031fdbde5bca0963b20d5911eca91 (diff)
swscale: remove swScale_{c,MMX,MMX2} duplication.
Diffstat (limited to 'libswscale/swscale_template.c')
-rw-r--r--libswscale/swscale_template.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c
index fe872561cb..0ff402806e 100644
--- a/libswscale/swscale_template.c
+++ b/libswscale/swscale_template.c
@@ -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;