[MPlayer-dev-eng] [PATCH] display DVD subtitles
Arpi
arpi at thot.banki.hu
Tue Nov 20 19:56:38 CET 2001
Hi,
> > Nice, but imho it doesn't worth to apply NOW because it will be ugly hack
> > in libvo (btw, I haven't seen the patch yet :).
>
> The patch changes adds than 10 lines in libvo/sub.c
patch applied.
about alpha/colors:
alpah is a bit tricky in mplayer, as it's something precalculated for fast
rendering (it was desigend for constant font bitmap):
0 = fully transparent subpic
1 = (near) fully opaque subpic
...
255 = (near) fully transparent subpic
why? check the original C code:
for(x=0;x<w;x++){
if(srca[x]) dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x];
}
it was the fastest posisble way to render transparent bitmaps over the image
using plain C code.
also an important limitation: color+alpha must be less or equal to 255
(because there is no >255 range checking and clipping)
But.
As now we have some MMX code for sub rendering, what about making this
optional, or forget it all, and use the simplest way:
0 = opaque sub
...
255 = transparent sub
so the equation is simpler: dst=dst*alpha+color
it's easier to implement in MMX (now i know why wasn't mmx version faster...)
and for realtime generated fonts (dvd subpic) it's easier to use.
Michael, Nick, what do you think about it? would it help mmx code speed?
about the colors?
yes, it is in the ifo. and yes, libdvdread (from ogle authors of course :))
does read this info and we can access it. anyway it won't be simple, as dvd
ifo stuff is handled at stream layer, but we need this info at the other end
of mplayer pipeline: at libvo :(
needs some more mess with globals or dunno what.
and some future ideas:
- importing alphamap generation (for subfont) into font loader
so users could set alpha parameters (outline width, darkness) runtime?
- applying some antialiasing filter for DVD subtitles to improve quality
A'rpi / Astral & ESP-team
--
mailto:arpi at thot.banki.hu
http://esp-team.scene.hu
More information about the MPlayer-dev-eng
mailing list