summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/en/options.rst24
-rw-r--r--Makefile1
-rw-r--r--cfg-mplayer.h3
-rw-r--r--libvo/osd.c224
-rw-r--r--libvo/osd.h34
-rw-r--r--libvo/osd_template.c383
-rw-r--r--libvo/vo_corevideo.m1
-rw-r--r--libvo/vo_lavc.c1
-rw-r--r--libvo/vo_opengl.c1
-rw-r--r--libvo/vo_opengl_old.c1
-rw-r--r--libvo/vo_x11.c1
-rw-r--r--libvo/vo_xv.c1
-rw-r--r--sub/img_convert.c198
-rw-r--r--sub/img_convert.h3
-rw-r--r--sub/spudec.c772
-rw-r--r--sub/spudec.h18
-rw-r--r--sub/sub.c52
-rw-r--r--sub/sub.h24
18 files changed, 1 insertions, 1741 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index ca245f6d32..3be707bfad 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -1781,30 +1781,6 @@
--speed=<0.01-100>
Slow down or speed up playback by the factor given as parameter.
---spuaa=<mode>
- Antialiasing/scaling mode for DVD/VOBsub. A value of 16 may be added to
- <mode> in order to force scaling even when original and scaled frame size
- already match. This can be employed to e.g. smooth subtitles with gaussian
- blur. Available modes are:
-
- :0: none (fastest, very ugly)
- :1: approximate (broken?)
- :2: full (slow)
- :3: bilinear (default, fast and not too bad)
- :4: uses swscaler gaussian blur (looks very good)
-
---spualign=<-1-2>
- Specify how SPU (DVD/VOBsub) subtitles should be aligned.
-
- :-1: Original position
- :0: Align at top (original behavior, default).
- :1: Align at center.
- :2: Align at bottom.
-
---spugauss=<0.0-3.0>
- Variance parameter of gaussian used by ``--spuaa=4``. Higher means more
- blur (default: 1.0).
-
--srate=<Hz>
Select the output sample rate to be used (of course sound cards have
limits on this). If the sample frequency selected is different from that
diff --git a/Makefile b/Makefile
index ecd33359c2..dd476d2a28 100644
--- a/Makefile
+++ b/Makefile
@@ -198,7 +198,6 @@ SRCS_COMMON = asxparser.c \
libmpdemux/mf.c \
libmpdemux/mp_taglists.c \
libmpdemux/video.c \
- libvo/osd.c \
libvo/bitmap_packer.c \
osdep/numcores.c \
osdep/io.c \
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index 581f363148..975c11b9ff 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -532,9 +532,6 @@ const m_option_t common_opts[] = {
{"ffactor", &font_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 10.0, NULL},
{"sub-pos", &sub_pos, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL},
{"subwidth", &sub_width_p, CONF_TYPE_INT, CONF_RANGE, 10, 100, NULL},
- {"spualign", &spu_alignment, CONF_TYPE_INT, CONF_RANGE, -1, 2, NULL},
- {"spuaa", &spu_aamode, CONF_TYPE_INT, CONF_RANGE, 0, 31, NULL},
- {"spugauss", &spu_gaussvar, CONF_TYPE_FLOAT, CONF_RANGE, 0.0, 3.0, NULL},
{"subfont-encoding", &subtitle_font_encoding, CONF_TYPE_STRING, 0, 0, 0, NULL},
{"subfont-text-scale", &text_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
{"subfont-osd-scale", &osd_font_scale_factor, CONF_TYPE_FLOAT, CONF_RANGE, 0, 100, NULL},
diff --git a/libvo/osd.c b/libvo/osd.c
deleted file mode 100644
index 2fd294a13a..0000000000
--- a/libvo/osd.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.
- */
-
-#include "config.h"
-#include "osd.h"
-#include "mp_msg.h"
-#include <inttypes.h>
-#include <sys/types.h>
-#include "cpudetect.h"
-
-#if ARCH_X86
-static const uint64_t bFF __attribute__((aligned(8))) = 0xFFFFFFFFFFFFFFFFULL;
-static const unsigned long long mask24lh __attribute__((aligned(8))) = 0xFFFF000000000000ULL;
-static const unsigned long long mask24hl __attribute__((aligned(8))) = 0x0000FFFFFFFFFFFFULL;
-#endif
-
-//Note: we have C, X86-nommx, MMX, MMX2
-//Plain C versions
-#define COMPILE_C
-
-#if ARCH_X86
-
-#define COMPILE_MMX
-#define COMPILE_MMX2
-
-#endif /* ARCH_X86 */
-
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 0
-#define HAVE_MMX2 0
-
-#if ! ARCH_X86
-
-#ifdef COMPILE_C
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 0
-#define HAVE_MMX2 0
-#define RENAME(a) a ## _C
-#include "osd_template.c"
-#endif
-
-#else
-
-//X86 noMMX versions
-#ifdef COMPILE_C
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 0
-#define HAVE_MMX2 0
-#define RENAME(a) a ## _X86
-#include "osd_template.c"
-#endif
-
-//MMX versions
-#ifdef COMPILE_MMX
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 1
-#define HAVE_MMX2 0
-#define RENAME(a) a ## _MMX
-#include "osd_template.c"
-#endif
-
-//MMX2 versions
-#ifdef COMPILE_MMX2
-#undef RENAME
-#undef HAVE_MMX
-#undef HAVE_MMX2
-#define HAVE_MMX 1
-#define HAVE_MMX2 1
-#define RENAME(a) a ## _MMX2
-#include "osd_template.c"
-#endif
-
-#endif /* ARCH_X86 */
-
-void vo_draw_alpha_yv12(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
-#if ARCH_X86
- // ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
- vo_draw_alpha_yv12_MMX2(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);
-#else
- vo_draw_alpha_yv12_C(w, h, src, srca, srcstride, dstbase, dststride);
-#endif
-}
-
-void vo_draw_alpha_yuy2(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
-#if ARCH_X86
- // ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
- vo_draw_alpha_yuy2_MMX2(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);
-#else
- vo_draw_alpha_yuy2_C(w, h, src, srca, srcstride, dstbase, dststride);
-#endif
-}
-
-void vo_draw_alpha_rgb24(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
-#if ARCH_X86
- // ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
- vo_draw_alpha_rgb24_MMX2(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);
-#else
- vo_draw_alpha_rgb24_C(w, h, src, srca, srcstride, dstbase, dststride);
-#endif
-}
-
-void vo_draw_alpha_rgb32(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
-#if ARCH_X86
- // ordered by speed / fastest first
- if(gCpuCaps.hasMMX2)
- vo_draw_alpha_rgb32_MMX2(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);
-#else
- vo_draw_alpha_rgb32_C(w, h, src, srca, srcstride, dstbase, dststride);
-#endif
-}
-
-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]){
- 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;
- }
- }
- src += srcstride;
- srca += srcstride;
- dstbase += dststride;
- }
- return;
-}
-
-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]){
- 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;
- }
- }
- 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]){
- 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;
- }
- }
- src+=srcstride;
- srca+=srcstride;
- dstbase+=dststride;
- }
- return;
-}
diff --git a/libvo/osd.h b/libvo/osd.h
deleted file mode 100644
index 4e8064a93f..0000000000
--- a/libvo/osd.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * generic alpha renderers for all YUV modes and RGB depths
- * These are "reference implementations", should be optimized later (MMX, etc).
- *
- * 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.
- */
-
-#ifndef MPLAYER_OSD_H
-#define MPLAYER_OSD_H
-
-void vo_draw_alpha_yv12(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
-void vo_draw_alpha_yuy2(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
-void vo_draw_alpha_rgb24(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
-void vo_draw_alpha_rgb32(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
-void vo_draw_alpha_rgb12(int w, int h, unsigned char* src, unsigned char *srca,
- int srcstride, unsigned char* dstbase, int dststride);
-void vo_draw_alpha_rgb15(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
-void vo_draw_alpha_rgb16(int w, int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase, int dststride);
-
-#endif /* MPLAYER_OSD_H */
diff --git a/libvo/osd_template.c b/libvo/osd_template.c
deleted file mode 100644
index 40a335e30e..0000000000
--- a/libvo/osd_template.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * generic alpha renderers for all YUV modes and RGB depths
- * Optimized by Nick and Michael.
- *
- * 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.
- */
-
-#undef PREFETCH
-#undef EMMS
-#undef PREFETCHW
-#undef PAVGB
-
-#if HAVE_MMX2
-#define PREFETCH "prefetchnta"
-#define PREFETCHW "prefetcht0"
-#define PAVGB "pavgb"
-#else
-#define PREFETCH " # nop"
-#define PREFETCHW " # nop"
-#endif
-
-#define EMMS "emms"
-
-static inline void RENAME(vo_draw_alpha_yv12)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
- int y;
-#if HAVE_MMX
- __asm__ volatile(
- "pcmpeqb %%mm5, %%mm5\n\t" // F..F
- "movq %%mm5, %%mm4\n\t"
- "movq %%mm5, %%mm7\n\t"
- "psllw $8, %%mm5\n\t" //FF00FF00FF00
- "psrlw $8, %%mm4\n\t" //00FF00FF00FF
- ::);
-#endif
- for(y=0;y<h;y++){
- register int x;
-#if HAVE_MMX
- __asm__ volatile(
- PREFETCHW" %0\n\t"
- PREFETCH" %1\n\t"
- PREFETCH" %2\n\t"
- ::"m"(*dstbase),"m"(*srca),"m"(*src):"memory");
- for(x=0;x<w;x+=8){
- __asm__ volatile(
- "movl %1, %%eax\n\t"
- "orl 4%1, %%eax\n\t"
- " jz 1f\n\t"
- PREFETCHW" 32%0\n\t"
- PREFETCH" 32%1\n\t"
- PREFETCH" 32%2\n\t"
- "movq %0, %%mm0\n\t" // dstbase
- "movq %%mm0, %%mm1\n\t"
- "pand %%mm4, %%mm0\n\t" //0Y0Y0Y0Y
- "psrlw $8, %%mm1\n\t" //0Y0Y0Y0Y
- "movq %1, %%mm2\n\t" //srca HGFEDCBA
- "paddb %%mm7, %%mm2\n\t"
- "movq %%mm2, %%mm3\n\t"
- "pand %%mm4, %%mm2\n\t" //0G0E0C0A
- "psrlw $8, %%mm3\n\t" //0H0F0D0B
- "pmullw %%mm2, %%mm0\n\t"
- "pmullw %%mm3, %%mm1\n\t"
- "psrlw $8, %%mm0\n\t"
- "pand %%mm5, %%mm1\n\t"
- "por %%mm1, %%mm0\n\t"
- "paddb %2, %%mm0\n\t"
- "movq %%mm0, %0\n\t"
- "1:\n\t"
- :: "m" (dstbase[x]), "m" (srca[x]), "m" (src[x])
- : "%eax");
- }
-#else
- for(x=0;x<w;x++){
- if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x];
- }
-#endif
- src+=srcstride;
- srca+=srcstride;
- dstbase+=dststride;
- }
-#if HAVE_MMX
- __asm__ volatile(EMMS:::"memory");
-#endif
- return;
-}
-
-static inline void RENAME(vo_draw_alpha_yuy2)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
- int y;
-#if HAVE_MMX
- __asm__ volatile(
- "pxor %%mm7, %%mm7\n\t"
- "pcmpeqb %%mm5, %%mm5\n\t" // F..F
- "movq %%mm5, %%mm6\n\t"
- "movq %%mm5, %%mm4\n\t"
- "psllw $8, %%mm5\n\t" //FF00FF00FF00
- "psrlw $8, %%mm4\n\t" //00FF00FF00FF
- ::);
-#endif
- for(y=0;y<h;y++){
- register int x;
-#if HAVE_MMX
- __asm__ volatile(
- PREFETCHW" %0\n\t"
- PREFETCH" %1\n\t"
- PREFETCH" %2\n\t"
- ::"m"(*dstbase),"m"(*srca),"m"(*src));
- for(x=0;x<w;x+=4){
- __asm__ volatile(
- "movl %1, %%eax\n\t"
- "orl %%eax, %%eax\n\t"
- " jz 1f\n\t"
- PREFETCHW" 32%0\n\t"
- PREFETCH" 32%1\n\t"
- PREFETCH" 32%2\n\t"
- "movq %0, %%mm0\n\t" // dstbase
- "movq %%mm0, %%mm1\n\t"
- "pand %%mm4, %%mm0\n\t" //0Y0Y0Y0Y
- "movd %%eax, %%mm2\n\t" //srca 0000DCBA
- "paddb %%mm6, %%mm2\n\t"
- "punpcklbw %%mm7, %%mm2\n\t" //srca 0D0C0B0A
- "pmullw %%mm2, %%mm0\n\t"
- "psrlw $8, %%mm0\n\t"
- "pand %%mm5, %%mm1\n\t" //U0V0U0V0
- "movd %2, %%mm2\n\t" //src 0000DCBA
- "punpcklbw %%mm7, %%mm2\n\t" //srca 0D0C0B0A
- "por %%mm1, %%mm0\n\t"
- "paddb %%mm2, %%mm0\n\t"
- "movq %%mm0, %0\n\t"
- "1:\n\t"
- :: "m" (dstbase[x*2]), "m" (srca[x]), "m" (src[x])
- : "%eax");
- }
-#else
- for(x=0;x<w;x++){
- if(srca[x]) {
- dstbase[2*x]=((dstbase[2*x]*srca[x])>>8)+src[x];
- dstbase[2*x+1]=((((signed)dstbase[2*x+1]-128)*srca[x])>>8)+128;
- }
- }
-#endif
- src+=srcstride;
- srca+=srcstride;
- dstbase+=dststride;
- }
-#if HAVE_MMX
- __asm__ volatile(EMMS:::"memory");
-#endif
- return;
-}
-
-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;
-#if HAVE_MMX
- __asm__ volatile(
- "pxor %%mm7, %%mm7\n\t"
- "pcmpeqb %%mm6, %%mm6\n\t" // F..F
- ::);
-#endif
- for(y=0;y<h;y++){
- register unsigned char *dst = dstbase;
- register int x;
-#if ARCH_X86 && (!ARCH_X86_64 || HAVE_MMX)
-#if HAVE_MMX
- __asm__ volatile(
- PREFETCHW" %0\n\t"
- PREFETCH" %1\n\t"
- PREFETCH" %2\n\t"
- ::"m"(*dst),"m"(*srca),"m"(*src):"memory");
- for(x=0;x<w;x+=2){
- if(srca[x] || srca[x+1])
- __asm__ volatile(
- PREFETCHW" 32%0\n\t"
- PREFETCH" 32%1\n\t"
- PREFETCH" 32%2\n\t"
- "movq %0, %%mm0\n\t" // dstbase
- "movq %%mm0, %%mm1\n\t"
- "movq %%mm0, %%mm5\n\t"
- "punpcklbw %%mm7, %%mm0\n\t"
- "punpckhbw %%mm7, %%mm1\n\t"
- "movd %1, %%mm2\n\t" // srca ABCD0000
- "paddb %%mm6, %%mm2\n\t"
- "punpcklbw %%mm2, %%mm2\n\t" // srca AABBCCDD
- "punpcklbw %%mm2, %%mm2\n\t" // srca AAAABBBB
- "psrlq $8, %%mm2\n\t" // srca AAABBBB0
- "movq %%mm2, %%mm3\n\t"
- "punpcklbw %%mm7, %%mm2\n\t" // srca 0A0A0A0B
- "punpckhbw %%mm7, %%mm3\n\t" // srca 0B0B0B00
- "pmullw %%mm2, %%mm0\n\t"
- "pmullw %%mm3, %%mm1\n\t"
- "psrlw $8, %%mm0\n\t"
- "psrlw $8, %%mm1\n\t"
- "packuswb %%mm1, %%mm0\n\t"
- "movd %2, %%mm2 \n\t" // src ABCD0000
- "punpcklbw %%mm2, %%mm2\n\t" // src AABBCCDD
- "punpcklbw %%mm2, %%mm2\n\t" // src AAAABBBB
- "psrlq $8, %%mm2\n\t" // src AAABBBB0
- "paddb %%mm2, %%mm0\n\t"
- "pand %4, %%mm5\n\t"
- "pand %3, %%mm0\n\t"
- "por %%mm0, %%mm5\n\t"
- "movq %%mm5, %0\n\t"
- :: "m" (dst[0]), "m" (srca[x]), "m" (src[x]), "m"(mask24hl), "m"(mask24lh));
- dst += 6;
- }
-#else /* HAVE_MMX */
- for(x=0;x<w;x++){
- if(srca[x]){
- __asm__ volatile(
- "movzbl (%0), %%ecx\n\t"
- "movzbl 1(%0), %%eax\n\t"
-
- "imull %1, %%ecx\n\t"
- "imull %1, %%eax\n\t"
-
- "addl %2, %%ecx\n\t"
- "addl %2, %%eax\n\t"
-
- "movb %%ch, (%0)\n\t"
- "movb %%ah, 1(%0)\n\t"
-
- "movzbl 2(%0), %%eax\n\t"
- "imull %1, %%eax\n\t"
- "addl %2, %%eax\n\t"
- "movb %%ah, 2(%0)\n\t"
- :
- :"D" (dst),
- "r" ((unsigned)srca[x]),
- "r" (((unsigned)src[x])<<8)
- :"%eax", "%ecx"
- );
- }
- dst += 3;
- }
-#endif /* !HAVE_MMX */
-#else /*non x86 arch or x86_64 with MMX disabled */
- for(x=0;x<w;x++){
- if(srca[x]){
- dst[0]=((dst[0]*srca[x])>>8)+src[x];
- dst[1]=((dst[1]*srca[x])>>8)+src[x];
- dst[2]=((dst[2]*srca[x])>>8)+src[x];
- }
- dst+=3; // 24bpp
- }
-#endif /* arch_x86 */
- src+=srcstride;
- srca+=srcstride;
- dstbase+=dststride;
- }
-#if HAVE_MMX
- __asm__ volatile(EMMS:::"memory");
-#endif
- return;
-}
-
-static inline void RENAME(vo_draw_alpha_rgb32)(int w,int h, unsigned char* src, unsigned char *srca, int srcstride, unsigned char* dstbase,int dststride){
- int y;
-#if BYTE_ORDER == BIG_ENDIAN
- dstbase++;
-#endif
-#if HAVE_MMX
- __asm__ volatile(
- "pxor %%mm7, %%mm7\n\t"
- "pcmpeqb %%mm5, %%mm5\n\t" // F..F
- "movq %%mm5, %%mm4\n\t"
- "psllw $8, %%mm5\n\t" //FF00FF00FF00
- "psrlw $8, %%mm4\n\t" //00FF00FF00FF
- ::);
-#endif /* HAVE_MMX */
- for(y=0;y<h;y++){
- register int x;
-#if ARCH_X86 && (!ARCH_X86_64 || HAVE_MMX)
-#if HAVE_MMX
- __asm__ volatile(
- PREFETCHW" %0\n\t"
- PREFETCH" %1\n\t"
- PREFETCH" %2\n\t"
- ::"m"(*dstbase),"m"(*srca),"m"(*src):"memory");
- for(x=0;x<w;x+=4){
- __asm__ volatile(
- "movl %1, %%eax\n\t"
- "orl %%eax, %%eax\n\t"
- " jz 1f\n\t"
- PREFETCHW" 32%0\n\t"
- PREFETCH" 32%1\n\t"
- PREFETCH" 32%2\n\t"
- "movq %0, %%mm0\n\t" // dstbase
- "movq %%mm0, %%mm1\n\t"
- "pand %%mm4, %%mm0\n\t" //0R0B0R0B
- "psrlw $8, %%mm1\n\t" //0?0G0?0G
- "movd %%eax, %%mm2\n\t" //srca 0000DCBA
- "paddb %3, %%mm2\n\t"
- "punpcklbw %%mm2, %%mm2\n\t" //srca DDCCBBAA
- "movq %%mm2, %%mm3\n\t"
- "punpcklbw %%mm7, %%mm2\n\t" //srca 0B0B0A0A
- "pmullw %%mm2, %%mm0\n\t"
- "pmullw %%mm2, %%mm1\n\t"
- "psrlw $8, %%mm0\n\t"
- "pand %%mm5, %%mm1\n\t"
- "por %%mm1, %%mm0\n\t"
- "movd %2, %%mm2 \n\t" //src 0000DCBA
- "punpcklbw %%mm2, %%mm2\n\t" //src DDCCBBAA
- "movq %%mm2, %%mm6\n\t"
- "punpcklbw %%mm2, %%mm2\n\t" //src BBBBAAAA
- "paddb %%mm2, %%mm0\n\t"
- "movq %%mm0, %0\n\t"
-
- "movq 8%0, %%mm0\n\t" // dstbase
- "movq %%mm0, %%mm1\n\t"
- "pand %%mm4, %%mm0\n\t" //0R0B0R0B
- "psrlw $8, %%mm1\n\t" //0?0G0?0G
- "punpckhbw %%mm7, %%mm3\n\t" //srca 0D0D0C0C
- "pmullw %%mm3, %%mm0\n\t"
- "pmullw %%mm3, %%mm1\n\t"
- "psrlw $8, %%mm0\n\t"
- "pand %%mm5, %%mm1\n\t"
- "por %%mm1, %%mm0\n\t"
- "punpckhbw %%mm6, %%mm6\n\t" //src DDDDCCCC
- "paddb %%mm6, %%mm0\n\t"
- "movq %%mm0, 8%0\n\t"
- "1:\n\t"
- :: "m" (dstbase[4*x]), "m" (srca[x]), "m" (src[x]), "m" (bFF)
- : "%eax");
- }
-#else /* HAVE_MMX */
- for(x=0;x<w;x++){
- if(srca[x]){
- __asm__ volatile(
- "movzbl (%0), %%ecx\n\t"
- "movzbl 1(%0), %%eax\n\t"
- "movzbl 2(%0), %%edx\n\t"
-
- "imull %1, %%ecx\n\t"
- "imull %1, %%eax\n\t"
- "imull %1, %%edx\n\t"
-
- "addl %2, %%ecx\n\t"
- "addl %2, %%eax\n\t"
- "addl %2, %%edx\n\t"
-
- "movb %%ch, (%0)\n\t"
- "movb %%ah, 1(%0)\n\t"
- "movb %%dh, 2(%0)\n\t"
-
- :
- :"r" (&dstbase[4*x]),
- "r" ((unsigned)srca[x]),
- "r" (((unsigned)src[x])<<8)
- :"%eax", "%ecx", "%edx"
- );
- }
- }
-#endif /* HAVE_MMX */
-#else /*non x86 arch or x86_64 with MMX disabled */
- for(x=0;x<w;x++){
- if(srca[x]){
- dstbase[4*x+0]=((dstbase[4*x+0]*srca[x])>>8)+src[x];
- dstbase[4*x+1]=((dstbase[4*x+1]*srca[x])>>8)+src[x];
- dstbase[4*x+2]=((dstbase[4*x+2]*srca[x])>>8)+src[x];
- }
- }
-#endif /* arch_x86 */
- src+=srcstride;
- srca+=srcstride;
- dstbase+=dststride;
- }
-#if HAVE_MMX
- __asm__ volatile(EMMS:::"memory");
-#endif
- return;
-}
diff --git a/libvo/vo_corevideo.m b/libvo/vo_corevideo.m
index 6775762787..c3d832d589 100644
--- a/libvo/vo_corevideo.m
+++ b/libvo/vo_corevideo.m
@@ -32,7 +32,6 @@
#import "csputils.h"
#import "libmpcodecs/vfcap.h"
#import "libmpcodecs/mp_image.h"
-#import "osd.h"
#import "gl_common.h"
#import "gl_osd.h"
diff --git a/libvo/vo_lavc.c b/libvo/vo_lavc.c
index 4cf4003031..5ba548926e 100644
--- a/libvo/vo_lavc.c
+++ b/libvo/vo_lavc.c
@@ -35,7 +35,6 @@
#include "sub/sub.h"
#include "sub/draw_bmp.h"
-#include "libvo/osd.h"
struct priv {
uint8_t *buffer;
diff --git a/libvo/vo_opengl.c b/libvo/vo_opengl.c
index cbf1b46f8b..413ca78710 100644
--- a/libvo/vo_opengl.c
+++ b/libvo/vo_opengl.c
@@ -45,7 +45,6 @@
#include "libmpcodecs/vfcap.h"
#include "libmpcodecs/mp_image.h"
#include "geometry.h"
-#include "osd.h"
#include "sub/sub.h"
#include "bitmap_packer.h"
diff --git a/libvo/vo_opengl_old.c b/libvo/vo_opengl_old.c
index 6dfe90c17d..98a111b454 100644
--- a/libvo/vo_opengl_old.c
+++ b/libvo/vo_opengl_old.c
@@ -35,7 +35,6 @@
#include "libmpcodecs/vfcap.h"
#include "libmpcodecs/mp_image.h"
#include "geometry.h"
-#include "osd.h"
#include "sub/sub.h"
#include "gl_common.h"
diff --git a/libvo/vo_x11.c b/libvo/vo_x11.c
index c23dd47fd2..8725279bb8 100644
--- a/libvo/vo_x11.c
+++ b/libvo/vo_x11.c
@@ -25,7 +25,6 @@
#include "video_out.h"
#include "aspect.h"
#include "csputils.h"
-#include "osd.h"
#include "libmpcodecs/mp_image.h"
#include "libmpcodecs/vfcap.h"
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index e12f8cbaf8..b62eaf18d7 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -47,7 +47,6 @@
#include "video_out.h"
#include "libmpcodecs/vfcap.h"
#include "libmpcodecs/mp_image.h"
-#include "osd.h"
#include "x11_common.h"
#include "fastmemcpy.h"
#include "sub/sub.h"
diff --git a/sub/img_convert.c b/sub/img_convert.c
index 9437226c64..aa5c89401a 100644
--- a/sub/img_convert.c
+++ b/sub/img_convert.c
@@ -33,140 +33,11 @@
struct osd_conv_cache {
struct sub_bitmap part;
struct sub_bitmap *parts;
- // for osd_conv_cache_alloc_old_p() (SUBBITMAP_PLANAR)
- int allocated, stride;
- struct old_osd_planar bmp;
- // for osd_conv_idx_to_old_p(), a spudec.c handle
- void *spudec;
};
-static int osd_conv_cache_destroy(void *p)
-{
- struct osd_conv_cache *c = p;
- av_free(c->bmp.bitmap);
- av_free(c->bmp.alpha);
- if (c->spudec)
- spudec_free(c->spudec);
- return 0;
-}
-
struct osd_conv_cache *osd_conv_cache_new(void)
{
- struct osd_conv_cache *c = talloc_zero(NULL, struct osd_conv_cache);
- talloc_set_destructor(c, &osd_conv_cache_destroy);
- return c;
-}
-
-// allocates/enlarges the alpha/bitmap buffer
-static void osd_conv_cache_alloc_old_p(struct osd_conv_cache *c, int w, int h)
-{
- assert(w > 0 && h > 0);
- c->stride = (w + 7) & (~7);
- int len = c->stride * h;
- if (c->allocated < len) {
- av_free(c->bmp.bitmap);
- av_free(c->bmp.alpha);
- c->allocated = len;
- c->bmp.bitmap = av_malloc(len);
- c->bmp.alpha = av_malloc(len);
- }
- memset(c->bmp.bitmap, sub_bg_color, len);
- memset(c->bmp.alpha, sub_bg_alpha, len);
- c->part = (struct sub_bitmap) {
- .bitmap = &c->bmp,
- .stride = c->stride,
- .w = w, .h = h,
- .dw = w, .dh = h,
- };
-}
-
-static void draw_alpha_ass_to_old(unsigned char *src, int src_w, int src_h,
- int src_stride, unsigned char *dst_a,
- unsigned char *dst_i, size_t dst_stride,
- int dst_x, int dst_y, uint32_t color)
-{
- const unsigned int r = (color >> 24) & 0xff;
- const unsigned int g = (color >> 16) & 0xff;
- const unsigned int b = (color >> 8) & 0xff;
- const unsigned int a = 0xff - (color & 0xff);
-
- int gray = (r + g + b) / 3; // not correct
-
- dst_a += dst_y * dst_stride + dst_x;
- dst_i += dst_y * dst_stride + dst_x;
-
- int src_skip = src_stride - src_w;
- int dst_skip = dst_stride - src_w;
-
- for (int y = 0; y < src_h; y++) {
- for (int x = 0; x < src_w; x++) {
- unsigned char as = (*src * a) >> 8;
- unsigned char bs = (gray * as) >> 8;
- // to mplayer scale
- as = -as;
-
- unsigned char *a = dst_a;
- unsigned char *b = dst_i;
-
- // NOTE: many special cases, because alpha=0 means transparency,
- // while alpha=1..255 is opaque..transparent
- if (as) {
- *b = ((*b * as) >> 8) + bs;
- if (*a) {
- *a = (*a * as) >> 8;
- if (*a < 1)
- *a = 1;
- } else {
- *a = as;
- }
- }
-
- dst_a++;
- dst_i++;
- src++;
- }
- dst_a += dst_skip;
- dst_i += dst_skip;
- src += src_skip;
- }
-}
-
-static void render_ass_to_old(unsigned char *a, unsigned char *i,
- size_t stride, int x, int y,
- struct sub_bitmaps *imgs)
-{
- for (int n = 0; n < imgs->num_parts; n++) {
- struct sub_bitmap *p = &imgs->parts[n];
- draw_alpha_ass_to_old(p->bitmap, p->w, p->h, p->stride, a, i, stride,
- x + p->x, y + p->y, p->libass.color);
- }
-}
-
-// SUBBITMAP_LIBASS -> SUBBITMAP_OLD_PLANAR
-bool osd_conv_ass_to_old_p(struct osd_conv_cache *c, struct sub_bitmaps *imgs)
-{
- struct sub_bitmaps src = *imgs;
- if (src.format != SUBBITMAP_LIBASS || src.scaled)
- return false;
-
- imgs->format = SUBBITMAP_OLD_PLANAR;
- imgs->num_parts = 0;
- imgs->parts = NULL;
-
- int x1, y1, x2, y2;
- if (!sub_bitmaps_bb(&src, &x1, &y1, &x2, &y2))
- return true;
-
- osd_conv_cache_alloc_old_p(c, x2 - x1, y2 - y1);
-
- render_ass_to_old(c->bmp.alpha, c->bmp.bitmap, c->stride, -x1, -y1, &src);
-
- c->part.x = x1;
- c->part.y = y1;
-
- imgs->parts = &c->part;
- imgs->num_parts = 1;
- return true;
+ return talloc_zero(NULL, struct osd_conv_cache);
}
static void rgba_to_premultiplied_rgba(uint32_t *colors, size_t count)
@@ -216,70 +87,3 @@ bool osd_conv_idx_to_rgba(struct osd_conv_cache *c, struct sub_bitmaps *imgs)
}
return true;
}
-
-bool osd_conv_idx_to_old_p(struct osd_conv_cache *c, struct sub_bitmaps *imgs,
- int screen_w, int screen_h)
-{
- struct sub_bitmaps src = *imgs;
- if (src.format != SUBBITMAP_INDEXED)
- return false;
-
- imgs->format = SUBBITMAP_OLD_PLANAR;
- imgs->num_parts = 0;
- imgs->parts = NULL;
- if (src.num_parts == 0)
- return true;
-
- // assume they are all evenly scaled (and size 0 is not possible)
- // could put more effort into it to reduce roundin