#include "xineutils.h"
#define xine_fast_memcpy memcpy
+#define xine_fast_memmove memmove
/*
DeinterlaceFieldBob algorithm
static void deinterlace_bob_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef USE_MMX
int Line;
uint64_t *YVal1;
uint64_t *YVal2;
uint64_t qwEdgeDetect;
uint64_t qwThreshold;
- static mmx_t YMask = {ub:{0xff,0,0xff,0,0xff,0,0xff,0}};
- static mmx_t Mask = {ub:{0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
+ static mmx_t YMask = {.ub={0xff,0,0xff,0,0xff,0,0xff,0}};
+ static mmx_t Mask = {.ub={0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
qwEdgeDetect = EdgeDetect;
qwEdgeDetect += (qwEdgeDetect << 48) + (qwEdgeDetect << 32) + (qwEdgeDetect << 16);
static int deinterlace_weave_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef USE_MMX
int Line;
uint64_t *YVal1;
uint64_t qwTemporalTolerance;
uint64_t qwThreshold;
- static mmx_t YMask = {ub:{0xff,0,0xff,0,0xff,0,0xff,0}};
- static mmx_t Mask = {ub:{0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
+ static mmx_t YMask = {.ub={0xff,0,0xff,0,0xff,0,0xff,0}};
+ static mmx_t Mask = {.ub={0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
// Make sure we have all the data we need.
static int deinterlace_greedy_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef USE_MMX
int Line;
int LoopCtr;
uint64_t *L1; // ptr to Line1, of 3
uint8_t* pOddLines = psrc[0]+width;
uint8_t* pPrevLines;
- static mmx_t ShiftMask = {ub:{0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
+ static mmx_t ShiftMask = {.ub={0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
int LineLength = width;
int SourcePitch = width * 2;
static void deinterlace_onefield_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef USE_MMX
int Line;
uint64_t *YVal1;
uint64_t *YVal3;
int n;
- static mmx_t Mask = {ub:{0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
+ static mmx_t Mask = {.ub={0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe,0xfe}};
/*
* copy first even line no matter what, and the first odd line if we're
static void deinterlace_linearblend_yuv_mmx( uint8_t *pdst, uint8_t *psrc[],
int width, int height )
{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef USE_MMX
int Line;
uint64_t *YVal1;
uint64_t *YVal2;
int n;
/* Copy first line */
- xine_fast_memcpy(pdst, psrc[0], LineLength);
+ xine_fast_memmove(pdst, psrc[0], LineLength);
for (Line = 1; Line < height - 1; ++Line)
{
}
/* Copy last line */
- xine_fast_memcpy(pdst + Line * LineLength,
+ xine_fast_memmove(pdst + Line * LineLength,
psrc[0] + Line * LineLength, LineLength);
/* clear out the MMX registers ready for doing floating point
static int check_for_mmx(void)
{
-#if defined(ARCH_X86) || defined(ARCH_X86_64)
+#ifdef USE_MMX
static int config_flags = -1;
if ( config_flags == -1 )
if( check_for_mmx() )
deinterlace_bob_yuv_mmx(pdst,psrc,width,height);
else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
+ deinterlace_linearblend_yuv(pdst,psrc,width,height);
break;
case DEINTERLACE_WEAVE:
if( check_for_mmx() )
xine_fast_memcpy(pdst,psrc[0],width*height);
}
else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
+ deinterlace_linearblend_yuv(pdst,psrc,width,height);
break;
case DEINTERLACE_GREEDY:
if( check_for_mmx() )
xine_fast_memcpy(pdst,psrc[0],width*height);
}
else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
+ deinterlace_linearblend_yuv(pdst,psrc,width,height);
break;
case DEINTERLACE_ONEFIELD:
if( check_for_mmx() )
deinterlace_onefield_yuv_mmx(pdst,psrc,width,height);
else /* FIXME: provide an alternative? */
- xine_fast_memcpy(pdst,psrc[0],width*height);
+ deinterlace_linearblend_yuv(pdst,psrc,width,height);
break;
case DEINTERLACE_ONEFIELDXV:
lprintf("ONEFIELDXV must be handled by the video driver.\n");
deinterlace_linearblend_yuv(pdst,psrc,width,height);
break;
default:
- lprintf("unknow method %d.\n",method);
+ lprintf("unknown method %d.\n",method);
break;
}
}
return 0;
}
-char *deinterlace_methods[] = {
- "none",
+const char *deinterlace_methods[] = {
+ "none",
"bob",
"weave",
"greedy",