[MPlayer-dev-eng] [PATCH] vobsub custom colors rgb->yuv fix.

Ulion ulion2002 at gmail.com
Sat Dec 8 15:32:05 CET 2007


2007/12/8, Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de>:
> Hello,
> On Sat, Dec 08, 2007 at 08:37:51PM +0800, Ulion wrote:
> [...]
> > +unsigned int vobsub_rgb_to_yuv(unsigned int rgb)
> > +{
> > +    int r, g, b, y, u, v;
> > +    r = rgb >> 16 & 0xff;
> > +    g = rgb >> 8 & 0xff;
> > +    b = rgb & 0xff;
> > +    y = round(( 0.299   * r + 0.587   * g + 0.114   * b) * 219 / 255 + 16);
> > +    u = round((-0.16874 * r - 0.33126 * g + 0.5     * b) * 224 / 255 + 128);
> > +    v = round(( 0.5     * r - 0.41869 * g - 0.08131 * b) * 224 / 255 + 128);
> > +    return y << 16 | u << 8 | v;
> > +}
>
> The *219/255 etc. is a really bad idea IMO, since it means the subtitles
> can at best become a muddy gray and never truly white.
> This may be acceptable or even good for videos, but not for subtitles.

I don't think so. Value 235 of Y is truly white, values above 235 is
lighter than white.
Or value 255 of Y is truly white? Anyone make it clear?

> Also my man pages say round is C99 only, if you really think it is worth
> the bother just add + 0.5 as the last step (though I admit it is not
> equivalent for u and v).

OK, remove round, change to add 0.5.


-- 
Ulion
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: vobsub_cuspal_fix5.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20071208/04c508c6/attachment.txt>


More information about the MPlayer-dev-eng mailing list