[MPlayer-dev-eng] [PATCH] OSD through EOSD

Nicolas George nicolas.george at normalesup.org
Fri Aug 13 15:32:32 CEST 2010


Le sextidi 26 thermidor, an CCXVIII, Reimar Döffinger a écrit :
> No, first you missed the srca != 0 check before that. 0 means full

I saw it, and it works with my code; I just omitted it from my message to
make it shorter.

> transparency, thus calling it transparency would not be any better
> than calling it alpha.

For this point, I was thinking about other places where "alpha" is used
wrongly, for example the color field of ASS_Image.

This hackish optimization, "0 means 256", is very confusing to read, but it
seems to be used consistently everywhere.

> Secondly, maybe it would be more correct if src would be alpha*value,
> but that is not the case in general, at least not for data from
> spudec.c. Unless of course I missed the pre-multiplications being done
> somewhere, in which case it is only the PGS subtitles that are wrong.

This time, I looked very carefully, and I found that both PGS and SPU are
wrong. Both do "color = FFMIN(color, alpha)", which means that with 50%
alpha, anything between 50% gray and 100% white will look exactly the same.

I have produced a sample vobsub showing the problem: a white text on gray
background with 50% alpha. VLC displays it fine. With mplayer, the text and
background have the same color.

The files are available there :
http://www.normalesup.org/~george/tmp/mplayer/
-rw-r--r-- 1 cigaes cigaes 3.4K Aug 13 12:56 do_you_see_me.png
-rw-r--r-- 1 cigaes cigaes  578 Aug 13 13:40 do_you_see_me.idx
-rw-r--r-- 1 cigaes cigaes 4.0K Aug 13 13:40 do_you_see_me.sub

The attached patche fixes it.

> It wouldn't be hard to fix, I just don't think there's much of a point,
> I'm in favour of making the OSD stuff fast and simple and leave the
> better accuracy for EOSD.

What if it could be both fast and accurate? The OSD renderers currently
implement a mostly correct transparency + premultiplied gray overlay. This
is the fastest a software overlay engine can get.

It is just necessary to ensure that the parts that produce OSD do it that
way. That is what my patch do. Since the changes is done for the palette
entries, the performance impact is invisible.

Anyway, what bugs me with OSD is neither the lack of accuracy nor the
performances, but the sheer amount of duplicated code. Just look at vo_x11
compared to vo_xv: you'll see almost the same switch statement, just with
different supported formats. That can't be right.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer-eosd-premult-20100813.diff
Type: text/x-diff
Size: 2829 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100813/e505bdd7/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20100813/e505bdd7/attachment.pgp>


More information about the MPlayer-dev-eng mailing list