diff options
author | 2004-05-31 15:13:35 +0000 | |
---|---|---|
committer | 2004-05-31 15:13:35 +0000 | |
commit | d2ad2147cc21cdc03587f51ca68eed73c5e10c88 (patch) | |
tree | cd7e67e8cffe470c8e10ddb6d2c78eda31ef9ba5 | |
parent | 4e8aa8f506f2a377c828c826585b389ea8760c49 (diff) |
draw alpha for uyvy
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12517 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libvo/osd.c | 38 | ||||
-rw-r--r-- | libvo/osd.h | 1 | ||||
-rw-r--r-- | libvo/osd_template.c | 24 |
3 files changed, 59 insertions, 4 deletions
diff --git a/libvo/osd.c b/libvo/osd.c index dadb77a7f1..742174e7c8 100644 --- a/libvo/osd.c +++ b/libvo/osd.c @@ -110,7 +110,7 @@ static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FF void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ #ifdef RUNTIME_CPUDETECT #ifdef CAN_COMPILE_X86_ASM - // ordered per speed fasterst first + // ordered by speed / fastest first if(gCpuCaps.hasMMX2) vo_draw_alpha_yv12_MMX2(w, h, src, srca, srcstride, dstbase, dststride); else if(gCpuCaps.has3DNow) @@ -140,7 +140,7 @@ void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, in void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ #ifdef RUNTIME_CPUDETECT #ifdef CAN_COMPILE_X86_ASM - // ordered per speed fasterst first + // ordered by speed / fastest first if(gCpuCaps.hasMMX2) vo_draw_alpha_yuy2_MMX2(w, h, src, srca, srcstride, dstbase, dststride); else if(gCpuCaps.has3DNow) @@ -167,10 +167,40 @@ void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, in #endif //!RUNTIME_CPUDETECT } +void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ +#ifdef RUNTIME_CPUDETECT +#ifdef CAN_COMPILE_X86_ASM + // 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 +#else //RUNTIME_CPUDETECT +#ifdef HAVE_MMX2 + vo_draw_alpha_uyvy_MMX2(w, h, src, srca, srcstride, dstbase, dststride); +#elif defined (HAVE_3DNOW) + vo_draw_alpha_uyvy_3DNow(w, h, src, srca, srcstride, dstbase, dststride); +#elif defined (HAVE_MMX) + vo_draw_alpha_uyvy_MMX(w, h, src, srca, srcstride, dstbase, dststride); +#elif defined (ARCH_X86) + 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 +#endif //!RUNTIME_CPUDETECT +} + void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ #ifdef RUNTIME_CPUDETECT #ifdef CAN_COMPILE_X86_ASM - // ordered per speed fasterst first + // ordered by speed / fastest first if(gCpuCaps.hasMMX2) vo_draw_alpha_rgb24_MMX2(w, h, src, srca, srcstride, dstbase, dststride); else if(gCpuCaps.has3DNow) @@ -200,7 +230,7 @@ void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, i void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ #ifdef RUNTIME_CPUDETECT #ifdef CAN_COMPILE_X86_ASM - // ordered per speed fasterst first + // ordered by speed / fastest first if(gCpuCaps.hasMMX2) vo_draw_alpha_rgb32_MMX2(w, h, src, srca, srcstride, dstbase, dststride); else if(gCpuCaps.has3DNow) diff --git a/libvo/osd.h b/libvo/osd.h index 12c35ff9c3..80bb457a74 100644 --- a/libvo/osd.h +++ b/libvo/osd.h @@ -9,6 +9,7 @@ extern void vo_draw_alpha_init(); // build tables extern void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); extern void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); +extern void vo_draw_alpha_uyvy(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); extern void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); extern void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); extern void vo_draw_alpha_rgb15(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride); diff --git a/libvo/osd_template.c b/libvo/osd_template.c index a4b2a59693..5c8c009ec7 100644 --- a/libvo/osd_template.c +++ b/libvo/osd_template.c @@ -160,6 +160,30 @@ static inline void RENAME(vo_draw_alpha_yuy2)(int w,int h, unsigned char* src, u return; } +static inline void RENAME(vo_draw_alpha_uyvy)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){ + int y; +#if defined(FAST_OSD) + w=w>>1; +#endif + for(y=0;y<h;y++){ + register int x; + for(x=0;x<w;x++){ +#ifdef FAST_OSD + if(srca[2*x+0]) dstbase[4*x+2]=src[2*x+0]; + if(srca[2*x+1]) dstbase[4*x+0]=src[2*x+1]; +#else + if(srca[x]) { + dstbase[2*x+1]=((dstbase[2*x+1]*srca[x])>>8)+src[x]; + dstbase[2*x]=((((signed)dstbase[2*x]-128)*srca[x])>>8)+128; + } +#endif + } + src+=srcstride; + srca+=srcstride; + dstbase+=dststride; + } +} + static inline void RENAME(vo_draw_alpha_rgb24)(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++){ |