#include "../config.h"
#include "rgb2rgb.h"
#include "swscale.h"
+#include "../cpudetect.h"
#include "../mangle.h"
#include "../bswap.h"
#include "../libvo/fastmemcpy.h"
void (*yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int dstStride);
+void (*yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
+ unsigned int width, unsigned int height,
+ int lumStride, int chromStride, int dstStride);
void (*yuv422ptoyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
unsigned int width, unsigned int height,
int lumStride, int chromStride, int dstStride);
int srcStride1, int srcStride2,
int srcStride3, int dstStride);
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
static const uint64_t mmx_null __attribute__((aligned(8))) = 0x0000000000000000ULL;
static const uint64_t mmx_one __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
-static const uint64_t mask32b __attribute__((aligned(8))) = 0x000000FF000000FFULL;
-static const uint64_t mask32g __attribute__((aligned(8))) = 0x0000FF000000FF00ULL;
-static const uint64_t mask32r __attribute__((aligned(8))) = 0x00FF000000FF0000ULL;
+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 mask32r attribute_used __attribute__((aligned(8))) = 0x00FF000000FF0000ULL;
static const uint64_t mask32 __attribute__((aligned(8))) = 0x00FFFFFF00FFFFFFULL;
static const uint64_t mask3216br __attribute__((aligned(8)))=0x00F800F800F800F8ULL;
static const uint64_t mask3216g __attribute__((aligned(8)))=0x0000FC000000FC00ULL;
static const uint64_t mask3215g __attribute__((aligned(8)))=0x0000F8000000F800ULL;
static const uint64_t mul3216 __attribute__((aligned(8))) = 0x2000000420000004ULL;
static const uint64_t mul3215 __attribute__((aligned(8))) = 0x2000000820000008ULL;
-static const uint64_t mask24b __attribute__((aligned(8))) = 0x00FF0000FF0000FFULL;
-static const uint64_t mask24g __attribute__((aligned(8))) = 0xFF0000FF0000FF00ULL;
-static const uint64_t mask24r __attribute__((aligned(8))) = 0x0000FF0000FF0000ULL;
+static const uint64_t mask24b attribute_used __attribute__((aligned(8))) = 0x00FF0000FF0000FFULL;
+static const uint64_t mask24g attribute_used __attribute__((aligned(8))) = 0xFF0000FF0000FF00ULL;
+static const uint64_t mask24r attribute_used __attribute__((aligned(8))) = 0x0000FF0000FF0000ULL;
static const uint64_t mask24l __attribute__((aligned(8))) = 0x0000000000FFFFFFULL;
static const uint64_t mask24h __attribute__((aligned(8))) = 0x0000FFFFFF000000ULL;
static const uint64_t mask24hh __attribute__((aligned(8))) = 0xffff000000000000ULL;
static const uint64_t blue_15mask __attribute__((aligned(8))) = 0x0000001f0000001fULL;
#ifdef FAST_BGR2YV12
-static const uint64_t bgr2YCoeff __attribute__((aligned(8))) = 0x000000210041000DULL;
-static const uint64_t bgr2UCoeff __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL;
-static const uint64_t bgr2VCoeff __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL;
+static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000000210041000DULL;
+static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0x0000FFEEFFDC0038ULL;
+static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00000038FFD2FFF8ULL;
#else
-static const uint64_t bgr2YCoeff __attribute__((aligned(8))) = 0x000020E540830C8BULL;
-static const uint64_t bgr2UCoeff __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL;
-static const uint64_t bgr2VCoeff __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL;
+static const uint64_t bgr2YCoeff attribute_used __attribute__((aligned(8))) = 0x000020E540830C8BULL;
+static const uint64_t bgr2UCoeff attribute_used __attribute__((aligned(8))) = 0x0000ED0FDAC23831ULL;
+static const uint64_t bgr2VCoeff attribute_used __attribute__((aligned(8))) = 0x00003831D0E6F6EAULL;
#endif
-static const uint64_t bgr2YOffset __attribute__((aligned(8))) = 0x1010101010101010ULL;
-static const uint64_t bgr2UVOffset __attribute__((aligned(8)))= 0x8080808080808080ULL;
-static const uint64_t w1111 __attribute__((aligned(8))) = 0x0001000100010001ULL;
+static const uint64_t bgr2YOffset attribute_used __attribute__((aligned(8))) = 0x1010101010101010ULL;
+static const uint64_t bgr2UVOffset attribute_used __attribute__((aligned(8)))= 0x8080808080808080ULL;
+static const uint64_t w1111 attribute_used __attribute__((aligned(8))) = 0x0001000100010001ULL;
#if 0
static volatile uint64_t __attribute__((aligned(8))) b5Dither;
#undef HAVE_MMX
#undef HAVE_MMX2
#undef HAVE_3DNOW
-#undef ARCH_X86
#undef HAVE_SSE2
#define RENAME(a) a ## _C
#include "rgb2rgb_template.c"
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
//MMX versions
#undef RENAME
#undef HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
-#define ARCH_X86
#define RENAME(a) a ## _MMX
#include "rgb2rgb_template.c"
#define HAVE_MMX2
#undef HAVE_3DNOW
#undef HAVE_SSE2
-#define ARCH_X86
#define RENAME(a) a ## _MMX2
#include "rgb2rgb_template.c"
#undef HAVE_MMX2
#define HAVE_3DNOW
#undef HAVE_SSE2
-#define ARCH_X86
-#define RENAME(a) a ## _3DNow
+#define RENAME(a) a ## _3DNOW
#include "rgb2rgb_template.c"
-#endif //ARCH_X86
+#endif //ARCH_X86 || ARCH_X86_64
/*
rgb15->rgb16 Original by Strepto/Astral
*/
void sws_rgb2rgb_init(int flags){
-#ifdef ARCH_X86
+#if defined(ARCH_X86) || defined(ARCH_X86_64)
if(flags & SWS_CPU_CAPS_MMX2){
rgb15to16= rgb15to16_MMX2;
rgb15to24= rgb15to24_MMX2;
rgb32tobgr16= rgb32tobgr16_MMX2;
rgb32tobgr15= rgb32tobgr15_MMX2;
yv12toyuy2= yv12toyuy2_MMX2;
+ yv12touyvy= yv12touyvy_MMX2;
yuv422ptoyuy2= yuv422ptoyuy2_MMX2;
yuy2toyv12= yuy2toyv12_MMX2;
- uyvytoyv12= uyvytoyv12_MMX2;
- yvu9toyv12= yvu9toyv12_MMX2;
+// uyvytoyv12= uyvytoyv12_MMX2;
+// yvu9toyv12= yvu9toyv12_MMX2;
planar2x= planar2x_MMX2;
rgb24toyv12= rgb24toyv12_MMX2;
interleaveBytes= interleaveBytes_MMX2;
rgb32tobgr16= rgb32tobgr16_3DNOW;
rgb32tobgr15= rgb32tobgr15_3DNOW;
yv12toyuy2= yv12toyuy2_3DNOW;
+ yv12touyvy= yv12touyvy_3DNOW;
yuv422ptoyuy2= yuv422ptoyuy2_3DNOW;
yuy2toyv12= yuy2toyv12_3DNOW;
- uyvytoyv12= uyvytoyv12_3DNOW;
- yvu9toyv12= yvu9toyv12_3DNOW;
+// uyvytoyv12= uyvytoyv12_3DNOW;
+// yvu9toyv12= yvu9toyv12_3DNOW;
planar2x= planar2x_3DNOW;
rgb24toyv12= rgb24toyv12_3DNOW;
interleaveBytes= interleaveBytes_3DNOW;
rgb32tobgr16= rgb32tobgr16_MMX;
rgb32tobgr15= rgb32tobgr15_MMX;
yv12toyuy2= yv12toyuy2_MMX;
+ yv12touyvy= yv12touyvy_MMX;
yuv422ptoyuy2= yuv422ptoyuy2_MMX;
yuy2toyv12= yuy2toyv12_MMX;
- uyvytoyv12= uyvytoyv12_MMX;
- yvu9toyv12= yvu9toyv12_MMX;
+// uyvytoyv12= uyvytoyv12_MMX;
+// yvu9toyv12= yvu9toyv12_MMX;
planar2x= planar2x_MMX;
rgb24toyv12= rgb24toyv12_MMX;
interleaveBytes= interleaveBytes_MMX;
rgb32tobgr16= rgb32tobgr16_C;
rgb32tobgr15= rgb32tobgr15_C;
yv12toyuy2= yv12toyuy2_C;
+ yv12touyvy= yv12touyvy_C;
yuv422ptoyuy2= yuv422ptoyuy2_C;
yuy2toyv12= yuy2toyv12_C;
// uyvytoyv12= uyvytoyv12_C;
for(i=0; i<num_pixels; i++)
{
+ #ifdef WORDS_BIGENDIAN
+ dst[3]= palette[ src[i]*4+2 ];
+ dst[2]= palette[ src[i]*4+1 ];
+ dst[1]= palette[ src[i]*4+0 ];
+ #else
//FIXME slow?
dst[0]= palette[ src[i]*4+2 ];
dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+0 ];
// dst[3]= 0; /* do we need this cleansing? */
+ #endif
dst+= 4;
}
}
unsigned i;
for(i=0; i<num_pixels; i++)
{
+ #ifdef WORDS_BIGENDIAN
+ dst[3]= palette[ src[i]*4+0 ];
+ dst[2]= palette[ src[i]*4+1 ];
+ dst[1]= palette[ src[i]*4+2 ];
+ #else
//FIXME slow?
dst[0]= palette[ src[i]*4+0 ];
dst[1]= palette[ src[i]*4+1 ];
dst[2]= palette[ src[i]*4+2 ];
// dst[3]= 0; /* do we need this cleansing? */
+ #endif
+
dst+= 4;
}
}