2009-02-08 04:27:30 +01:00
|
|
|
/*
|
|
|
|
* generic alpha renderers for all YUV modes and RGB depths
|
|
|
|
* These are "reference implementations", should be optimized later (MMX, etc).
|
|
|
|
* templating code by Michael Niedermayer (michaelni@gmx.at)
|
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* MPlayer is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2001-04-10 04:29:38 +02:00
|
|
|
|
2001-06-02 18:02:38 +02:00
|
|
|
//#define FAST_OSD
|
|
|
|
//#define FAST_OSD_TABLE
|
|
|
|
|
|
|
|
#include "config.h"
|
2001-04-24 22:03:13 +02:00
|
|
|
#include "osd.h"
|
2002-05-02 12:49:55 +02:00
|
|
|
#include "mp_msg.h"
|
2001-11-11 23:14:13 +01:00
|
|
|
#include <inttypes.h>
|
2004-10-28 03:15:53 +02:00
|
|
|
#include "cpudetect.h"
|
2001-11-11 23:14:13 +01:00
|
|
|
|
2009-01-16 10:21:21 +01:00
|
|
|
#if ARCH_X86
|
2008-01-30 19:52:59 +01:00
|
|
|
static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
|
2001-11-26 22:12:15 +01:00
|
|
|
static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL;
|
|
|
|
static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL;
|
2001-11-11 23:14:13 +01:00
|
|
|
#endif
|
2001-04-24 22:03:13 +02:00
|
|
|
|
2001-11-26 22:12:15 +01:00
|
|
|
//Note: we have C, X86-nommx, MMX, MMX2, 3DNOW version therse no 3DNOW+MMX2 one
|
|
|
|
//Plain C versions
|
2009-04-08 22:21:21 +02:00
|
|
|
#if !HAVE_MMX || CONFIG_RUNTIME_CPUDETECT
|
2001-11-27 02:54:13 +01:00
|
|
|
#define COMPILE_C
|
|
|
|
#endif
|
|
|
|
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2001-11-27 02:54:13 +01:00
|
|
|
|
2009-04-08 22:21:21 +02:00
|
|
|
#if (HAVE_MMX && !HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
|
2001-11-27 02:54:13 +01:00
|
|
|
#define COMPILE_MMX
|
|
|
|
#endif
|
|
|
|
|
2009-04-08 22:21:21 +02:00
|
|
|
#if HAVE_MMX2 || CONFIG_RUNTIME_CPUDETECT
|
2001-11-27 02:54:13 +01:00
|
|
|
#define COMPILE_MMX2
|
|
|
|
#endif
|
|
|
|
|
2009-04-08 22:21:21 +02:00
|
|
|
#if (HAVE_AMD3DNOW && !HAVE_MMX2) || CONFIG_RUNTIME_CPUDETECT
|
2001-11-27 02:54:13 +01:00
|
|
|
#define COMPILE_3DNOW
|
|
|
|
#endif
|
2009-03-15 11:01:02 +01:00
|
|
|
|
|
|
|
#endif /* ARCH_X86 */
|
2001-11-27 02:54:13 +01:00
|
|
|
|
|
|
|
#undef HAVE_MMX
|
|
|
|
#undef HAVE_MMX2
|
2009-01-26 10:29:53 +01:00
|
|
|
#undef HAVE_AMD3DNOW
|
2009-01-16 10:21:21 +01:00
|
|
|
#define HAVE_MMX 0
|
|
|
|
#define HAVE_MMX2 0
|
2009-01-26 10:29:53 +01:00
|
|
|
#define HAVE_AMD3DNOW 0
|
2004-10-21 13:55:20 +02:00
|
|
|
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ! ARCH_X86
|
2001-11-27 02:54:13 +01:00
|
|
|
|
|
|
|
#ifdef COMPILE_C
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef HAVE_MMX
|
|
|
|
#undef HAVE_MMX2
|
2009-01-26 10:29:53 +01:00
|
|
|
#undef HAVE_AMD3DNOW
|
2009-01-16 10:21:21 +01:00
|
|
|
#define HAVE_MMX 0
|
|
|
|
#define HAVE_MMX2 0
|
2009-01-26 10:29:53 +01:00
|
|
|
#define HAVE_AMD3DNOW 0
|
2001-11-26 22:12:15 +01:00
|
|
|
#define RENAME(a) a ## _C
|
|
|
|
#include "osd_template.c"
|
2001-11-27 02:54:13 +01:00
|
|
|
#endif
|
2001-11-26 22:12:15 +01:00
|
|
|
|
2004-10-21 13:55:20 +02:00
|
|
|
#else
|
2001-11-26 22:12:15 +01:00
|
|
|
|
|
|
|
//X86 noMMX versions
|
2001-11-27 02:54:13 +01:00
|
|
|
#ifdef COMPILE_C
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef RENAME
|
|
|
|
#undef HAVE_MMX
|
|
|
|
#undef HAVE_MMX2
|
2009-01-26 10:29:53 +01:00
|
|
|
#undef HAVE_AMD3DNOW
|
2009-01-16 10:21:21 +01:00
|
|
|
#define HAVE_MMX 0
|
|
|
|
#define HAVE_MMX2 0
|
2009-01-26 10:29:53 +01:00
|
|
|
#define HAVE_AMD3DNOW 0
|
2001-11-26 22:12:15 +01:00
|
|
|
#define RENAME(a) a ## _X86
|
|
|
|
#include "osd_template.c"
|
2001-11-27 02:54:13 +01:00
|
|
|
#endif
|
2001-11-26 22:12:15 +01:00
|
|
|
|
|
|
|
//MMX versions
|
2001-11-27 02:54:13 +01:00
|
|
|
#ifdef COMPILE_MMX
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef RENAME
|
2009-01-16 10:21:21 +01:00
|
|
|
#undef HAVE_MMX
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef HAVE_MMX2
|
2009-01-26 10:29:53 +01:00
|
|
|
#undef HAVE_AMD3DNOW
|
2009-01-16 10:21:21 +01:00
|
|
|
#define HAVE_MMX 1
|
|
|
|
#define HAVE_MMX2 0
|
2009-01-26 10:29:53 +01:00
|
|
|
#define HAVE_AMD3DNOW 0
|
2001-11-26 22:12:15 +01:00
|
|
|
#define RENAME(a) a ## _MMX
|
|
|
|
#include "osd_template.c"
|
2001-11-27 02:54:13 +01:00
|
|
|
#endif
|
2001-11-26 22:12:15 +01:00
|
|
|
|
|
|
|
//MMX2 versions
|
2001-11-27 02:54:13 +01:00
|
|
|
#ifdef COMPILE_MMX2
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef RENAME
|
2009-01-16 10:21:21 +01:00
|
|
|
#undef HAVE_MMX
|
|
|
|
#undef HAVE_MMX2
|
2009-01-26 10:29:53 +01:00
|
|
|
#undef HAVE_AMD3DNOW
|
2009-01-16 10:21:21 +01:00
|
|
|
#define HAVE_MMX 1
|
|
|
|
#define HAVE_MMX2 1
|
2009-01-26 10:29:53 +01:00
|
|
|
#define HAVE_AMD3DNOW 0
|
2001-11-26 22:12:15 +01:00
|
|
|
#define RENAME(a) a ## _MMX2
|
|
|
|
#include "osd_template.c"
|
2001-11-27 02:54:13 +01:00
|
|
|
#endif
|
2001-11-26 22:12:15 +01:00
|
|
|
|
|
|
|
//3DNOW versions
|
2001-11-27 02:54:13 +01:00
|
|
|
#ifdef COMPILE_3DNOW
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef RENAME
|
2009-01-16 10:21:21 +01:00
|
|
|
#undef HAVE_MMX
|
2001-11-26 22:12:15 +01:00
|
|
|
#undef HAVE_MMX2
|
2009-01-26 10:29:53 +01:00
|
|
|
#undef HAVE_AMD3DNOW
|
2009-01-16 10:21:21 +01:00
|
|
|
#define HAVE_MMX 1
|
|
|
|
#define HAVE_MMX2 0
|
2009-01-26 10:29:53 +01:00
|
|
|
#define HAVE_AMD3DNOW 1
|
2001-11-26 22:12:15 +01:00
|
|
|
#define RENAME(a) a ## _3DNow
|
|
|
|
#include "osd_template.c"
|
2001-11-27 02:54:13 +01:00
|
|
|
#endif
|
2001-11-26 22:12:15 +01:00
|
|
|
|
2009-03-15 11:01:02 +01:00
|
|
|
#endif /* ARCH_X86 */
|
2001-11-26 22:12:15 +01:00
|
|
|
|
2001-04-10 04:29:38 +02:00
|
|
|
void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
2009-04-08 22:21:21 +02:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2004-05-31 17:13:35 +02:00
|
|
|
// ordered by speed / fastest first
|
2001-11-26 22:12:15 +01:00
|
|
|
if(gCpuCaps.hasMMX2)
|
|
|
|
vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.has3DNow)
|
|
|
|
vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.hasMMX)
|
|
|
|
vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else
|
|
|
|
vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-06-02 18:02:38 +02:00
|
|
|
#else
|
2001-11-26 22:12:15 +01:00
|
|
|
vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-11-11 23:14:13 +01:00
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#else //CONFIG_RUNTIME_CPUDETECT
|
2009-01-16 10:21:21 +01:00
|
|
|
#if HAVE_MMX2
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-26 10:29:53 +01:00
|
|
|
#elif HAVE_AMD3DNOW
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yv12_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif HAVE_MMX
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yv12_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif ARCH_X86
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yv12_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#else
|
|
|
|
vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#endif //!CONFIG_RUNTIME_CPUDETECT
|
2001-04-10 04:29:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
2009-04-08 22:21:21 +02:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2004-05-31 17:13:35 +02:00
|
|
|
// ordered by speed / fastest first
|
2001-11-26 22:12:15 +01:00
|
|
|
if(gCpuCaps.hasMMX2)
|
|
|
|
vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.has3DNow)
|
|
|
|
vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.hasMMX)
|
|
|
|
vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else
|
|
|
|
vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-11-11 23:14:13 +01:00
|
|
|
#else
|
2001-11-26 22:12:15 +01:00
|
|
|
vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-11-11 23:14:13 +01:00
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#else //CONFIG_RUNTIME_CPUDETECT
|
2009-01-16 10:21:21 +01:00
|
|
|
#if HAVE_MMX2
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-26 10:29:53 +01:00
|
|
|
#elif HAVE_AMD3DNOW
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yuy2_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif HAVE_MMX
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yuy2_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif ARCH_X86
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_yuy2_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#else
|
|
|
|
vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#endif //!CONFIG_RUNTIME_CPUDETECT
|
2001-04-10 04:29:38 +02:00
|
|
|
}
|
|
|
|
|
2004-05-31 17:13:35 +02:00
|
|
|
void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
2009-04-08 22:21:21 +02:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2004-05-31 17:13:35 +02:00
|
|
|
// ordered by speed / fastest first
|
|
|
|
if(gCpuCaps.hasMMX2)
|
|
|
|
vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.has3DNow)
|
|
|
|
vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.hasMMX)
|
|
|
|
vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else
|
|
|
|
vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#else
|
|
|
|
vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#else //CONFIG_RUNTIME_CPUDETECT
|
2009-01-16 10:21:21 +01:00
|
|
|
#if HAVE_MMX2
|
2004-05-31 17:13:35 +02:00
|
|
|
vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-26 10:29:53 +01:00
|
|
|
#elif HAVE_AMD3DNOW
|
2004-05-31 17:13:35 +02:00
|
|
|
vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif HAVE_MMX
|
2004-05-31 17:13:35 +02:00
|
|
|
vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif ARCH_X86
|
2004-05-31 17:13:35 +02:00
|
|
|
vo_draw_alpha_uyvy_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#else
|
|
|
|
vo_draw_alpha_uyvy_C(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#endif //!CONFIG_RUNTIME_CPUDETECT
|
2004-05-31 17:13:35 +02:00
|
|
|
}
|
|
|
|
|
2001-04-10 04:29:38 +02:00
|
|
|
void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
2009-04-08 22:21:21 +02:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2004-05-31 17:13:35 +02:00
|
|
|
// ordered by speed / fastest first
|
2001-11-26 22:12:15 +01:00
|
|
|
if(gCpuCaps.hasMMX2)
|
|
|
|
vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.has3DNow)
|
|
|
|
vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.hasMMX)
|
|
|
|
vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else
|
|
|
|
vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-06-02 18:02:38 +02:00
|
|
|
#else
|
2001-11-26 22:12:15 +01:00
|
|
|
vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-11-11 17:09:19 +01:00
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#else //CONFIG_RUNTIME_CPUDETECT
|
2009-01-16 10:21:21 +01:00
|
|
|
#if HAVE_MMX2
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-26 10:29:53 +01:00
|
|
|
#elif HAVE_AMD3DNOW
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb24_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif HAVE_MMX
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb24_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif ARCH_X86
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb24_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#else
|
|
|
|
vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#endif //!CONFIG_RUNTIME_CPUDETECT
|
2001-04-10 04:29:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
2009-04-08 22:21:21 +02:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2004-05-31 17:13:35 +02:00
|
|
|
// ordered by speed / fastest first
|
2001-11-26 22:12:15 +01:00
|
|
|
if(gCpuCaps.hasMMX2)
|
|
|
|
vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.has3DNow)
|
|
|
|
vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else if(gCpuCaps.hasMMX)
|
|
|
|
vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
else
|
|
|
|
vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-06-02 18:02:38 +02:00
|
|
|
#else
|
2001-11-26 22:12:15 +01:00
|
|
|
vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
|
2001-06-02 18:02:38 +02:00
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#else //CONFIG_RUNTIME_CPUDETECT
|
2009-01-16 10:21:21 +01:00
|
|
|
#if HAVE_MMX2
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-26 10:29:53 +01:00
|
|
|
#elif HAVE_AMD3DNOW
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb32_3DNow(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif HAVE_MMX
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb32_MMX(w, h, src, srca, srcstride, dstbase, dststride);
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif ARCH_X86
|
2001-11-27 02:54:13 +01:00
|
|
|
vo_draw_alpha_rgb32_X86(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#else
|
|
|
|
vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
|
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#endif //!CONFIG_RUNTIME_CPUDETECT
|
2001-04-10 04:29:38 +02:00
|
|
|
}
|
|
|
|
|
2001-06-02 18:02:38 +02:00
|
|
|
#ifdef FAST_OSD_TABLE
|
2010-05-26 02:47:22 +02:00
|
|
|
static unsigned short fast_osd_12bpp_table[256];
|
2001-06-02 18:02:38 +02:00
|
|
|
static unsigned short fast_osd_15bpp_table[256];
|
|
|
|
static unsigned short fast_osd_16bpp_table[256];
|
|
|
|
#endif
|
|
|
|
|
2006-02-09 15:08:03 +01:00
|
|
|
void vo_draw_alpha_init(void){
|
2001-06-02 18:02:38 +02:00
|
|
|
#ifdef FAST_OSD_TABLE
|
|
|
|
int i;
|
|
|
|
for(i=0;i<256;i++){
|
2010-05-26 02:47:22 +02:00
|
|
|
fast_osd_12bpp_table[i]=((i>>4)<< 8)|((i>>4)<<4)|(i>>4);
|
2001-06-02 18:02:38 +02:00
|
|
|
fast_osd_15bpp_table[i]=((i>>3)<<10)|((i>>3)<<5)|(i>>3);
|
|
|
|
fast_osd_16bpp_table[i]=((i>>3)<<11)|((i>>2)<<5)|(i>>3);
|
|
|
|
}
|
|
|
|
#endif
|
2003-10-04 19:29:08 +02:00
|
|
|
//FIXME the optimized stuff is a lie for 15/16bpp as they aren't optimized yet
|
2006-03-27 09:22:48 +02:00
|
|
|
if( mp_msg_test(MSGT_OSD,MSGL_V) )
|
2001-11-26 22:12:15 +01:00
|
|
|
{
|
2009-04-08 22:21:21 +02:00
|
|
|
#if CONFIG_RUNTIME_CPUDETECT
|
2009-03-15 11:01:02 +01:00
|
|
|
#if ARCH_X86
|
2001-11-26 22:12:15 +01:00
|
|
|
// ordered per speed fasterst first
|
|
|
|
if(gCpuCaps.hasMMX2)
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n");
|
2001-11-26 22:12:15 +01:00
|
|
|
else if(gCpuCaps.has3DNow)
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n");
|
2001-11-26 22:12:15 +01:00
|
|
|
else if(gCpuCaps.hasMMX)
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n");
|
2001-11-26 22:12:15 +01:00
|
|
|
else
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n");
|
2001-11-26 22:12:15 +01:00
|
|
|
#else
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n");
|
2001-11-26 22:12:15 +01:00
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#else //CONFIG_RUNTIME_CPUDETECT
|
2009-01-16 10:21:21 +01:00
|
|
|
#if HAVE_MMX2
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay\n");
|
2009-01-26 10:29:53 +01:00
|
|
|
#elif HAVE_AMD3DNOW
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX (with tiny bit 3DNow) Optimized OnScreenDisplay\n");
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif HAVE_MMX
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using MMX Optimized OnScreenDisplay\n");
|
2009-01-16 10:21:21 +01:00
|
|
|
#elif ARCH_X86
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using X86 Optimized OnScreenDisplay\n");
|
2001-11-27 02:54:13 +01:00
|
|
|
#else
|
2002-05-02 12:49:55 +02:00
|
|
|
mp_msg(MSGT_OSD,MSGL_INFO,"Using Unoptimized OnScreenDisplay\n");
|
2001-11-27 02:54:13 +01:00
|
|
|
#endif
|
2009-04-08 22:21:21 +02:00
|
|
|
#endif //!CONFIG_RUNTIME_CPUDETECT
|
2001-11-26 22:12:15 +01:00
|
|
|
}
|
2001-06-02 18:02:38 +02:00
|
|
|
}
|
|
|
|
|
2010-05-06 12:18:25 +02:00
|
|
|
void vo_draw_alpha_rgb12(int w, int h, unsigned char* src, unsigned char *srca,
|
|
|
|
int srcstride, unsigned char* dstbase, int dststride) {
|
|
|
|
int y;
|
|
|
|
for (y = 0; y < h; y++) {
|
|
|
|
register unsigned short *dst = (unsigned short*) dstbase;
|
|
|
|
register int x;
|
|
|
|
for (x = 0; x < w; x++) {
|
|
|
|
if(srca[x]){
|
|
|
|
#ifdef FAST_OSD
|
|
|
|
#ifdef FAST_OSD_TABLE
|
|
|
|
dst[x] = fast_osd_12bpp_table[src[x]];
|
|
|
|
#else
|
|
|
|
register unsigned int a = src[x] >> 4;
|
|
|
|
dst[x] = (a << 8) | (a << 4) | a;
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
unsigned char r = dst[x] & 0x0F;
|
|
|
|
unsigned char g = (dst[x] >> 4) & 0x0F;
|
|
|
|
unsigned char b = (dst[x] >> 8) & 0x0F;
|
|
|
|
r = (((r*srca[x]) >> 4) + src[x]) >> 4;
|
|
|
|
g = (((g*srca[x]) >> 4) + src[x]) >> 4;
|
|
|
|
b = (((b*srca[x]) >> 4) + src[x]) >> 4;
|
|
|
|
dst[x] = (b << 8) | (g << 4) | r;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
src += srcstride;
|
|
|
|
srca += srcstride;
|
|
|
|
dstbase += dststride;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-04-10 04:29:38 +02:00
|
|
|
void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
|
|
|
int y;
|
|
|
|
for(y=0;y<h;y++){
|
|
|
|
register unsigned short *dst = (unsigned short*) dstbase;
|
|
|
|
register int x;
|
|
|
|
for(x=0;x<w;x++){
|
|
|
|
if(srca[x]){
|
2001-06-02 18:02:38 +02:00
|
|
|
#ifdef FAST_OSD
|
|
|
|
#ifdef FAST_OSD_TABLE
|
|
|
|
dst[x]=fast_osd_15bpp_table[src[x]];
|
|
|
|
#else
|
|
|
|
register unsigned int a=src[x]>>3;
|
|
|
|
dst[x]=(a<<10)|(a<<5)|a;
|
|
|
|
#endif
|
|
|
|
#else
|
2001-04-10 04:29:38 +02:00
|
|
|
unsigned char r=dst[x]&0x1F;
|
|
|
|
unsigned char g=(dst[x]>>5)&0x1F;
|
|
|
|
unsigned char b=(dst[x]>>10)&0x1F;
|
|
|
|
r=(((r*srca[x])>>5)+src[x])>>3;
|
|
|
|
g=(((g*srca[x])>>5)+src[x])>>3;
|
|
|
|
b=(((b*srca[x])>>5)+src[x])>>3;
|
|
|
|
dst[x]=(b<<10)|(g<<5)|r;
|
2001-06-02 18:02:38 +02:00
|
|
|
#endif
|
2001-04-10 04:29:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
src+=srcstride;
|
|
|
|
srca+=srcstride;
|
|
|
|
dstbase+=dststride;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void vo_draw_alpha_rgb16(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
|
|
|
|
int y;
|
|
|
|
for(y=0;y<h;y++){
|
|
|
|
register unsigned short *dst = (unsigned short*) dstbase;
|
|
|
|
register int x;
|
|
|
|
for(x=0;x<w;x++){
|
|
|
|
if(srca[x]){
|
2001-06-02 18:02:38 +02:00
|
|
|
#ifdef FAST_OSD
|
|
|
|
#ifdef FAST_OSD_TABLE
|
|
|
|
dst[x]=fast_osd_16bpp_table[src[x]];
|
|
|
|
#else
|
|
|
|
dst[x]=((src[x]>>3)<<11)|((src[x]>>2)<<5)|(src[x]>>3);
|
|
|
|
#endif
|
|
|
|
#else
|
2001-04-10 04:29:38 +02:00
|
|
|
unsigned char r=dst[x]&0x1F;
|
|
|
|
unsigned char g=(dst[x]>>5)&0x3F;
|
|
|
|
unsigned char b=(dst[x]>>11)&0x1F;
|
|
|
|
r=(((r*srca[x])>>5)+src[x])>>3;
|
|
|
|
g=(((g*srca[x])>>6)+src[x])>>2;
|
|
|
|
b=(((b*srca[x])>>5)+src[x])>>3;
|
|
|
|
dst[x]=(b<<11)|(g<<5)|r;
|
2001-06-02 18:02:38 +02:00
|
|
|
#endif
|
2001-04-10 04:29:38 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
src+=srcstride;
|
|
|
|
srca+=srcstride;
|
|
|
|
dstbase+=dststride;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|