[MPlayer-dev-eng] Draw Alpha

Arpi arpi at thot.banki.hu
Wed Nov 28 19:14:55 CET 2001


Hi,

> Few days ago i sow coments about drawing subtitles for
> DVD. I sow the equation that is used for computing, i
> sow that some changes are made. I didn't mind it, but
> later I realize that the formula is wrong. I couldn't
> find the fix and today i chaked the source. This is
> form osd_template.c:
>  
> if(srca[x])dstbase[x]=((dstbase[x]*srca[x])>>8)+src[x];
> or in float:
>   dst=src*alpha+osd;
> 
> The right formula is:
>   dst=src*alpha+osd*(1.0-alpha); 

not really.
in theory, the equeation is what you wrote above.
but in mplayer, osd/font pixel colors shouldn't be multiplied.
so, alpha value in mplayer means how decrease background (image)
brightness and when it's done, it overlay with font/osd pixels by
adding them. this is why osd pixel color + alpha pixel value <=255
limitation. and it also speeds up rendering a lot.

read my mail about this topic before telling here bad things.
we aren't in opengl world, we are in maximum-speed world now.
and here 0 means no osd/font rendering, 1 mean rendering over
black (full opacity) ... 255 means rendering over the image (full
transparency).

rename alpha to xyz or whatever you want if you don't like it.


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