[MPlayer-dev-eng] Re: [MPlayer-users] color of subtitles

Michael Niedermayer michaelni at gmx.at
Sat Nov 2 23:03:36 CET 2002


Hi

On Saturday 02 November 2002 22:20, Jindrich Makovicka wrote:
> Michael Niedermayer wrote:
> >hmm, i dont understand why the palete based method requires less rewrites,
> >imho it needs more (all the MMX code for example, and i wont do that) for
> > the true-color variant the rendering code is the same so the MMX code
> > could be reused IMHO
>
> no, just forget it :) i'll try to rewrite it to truecolor.
:)))
if u need any help, just ask

>
> >hmm, perhaps just restricting the position to x y %2==0 might be
> > acceptable
> >
> >btw
> > if (srcp[0]) { pal_idx = srcp[0]; cnt++; }
> > if (srcp[1]) { pal_idx = srcp[1]; cnt++; }
> > if (srcp[srcstride]) { pal_idx = srcp[srcstride]; cnt++; }
> > if (srcp[srcstride+1]) { pal_idx = srcp[srcstride+1]; cnt++; }
> >
> > s = pal[pal_idx];
> > d = *dst;
> >
> > d -= 128;
> > s -= 128;
> >
> > d = (d*(4-cnt)+s*cnt)/4;
> >
> > *dst = d+128;
> >
> >appears very broken to me
> > pal_idx= (srcp[0] + srcp[1] + srcp[srcstride] + srcp[srcstride+1] +
> > 2)>>2; *dst += pal[pal_idx];
> >might be better, if i understand the intended meaning of the code
> > correctly but it might require some change to pal[]
>
> it counts the pixels with palette index != 0 (0=don't change chroma) and
> makes a weighted average with the chroma in dst. they can't be averaged
> directly as they're palette indices
ok, i thought they are brightness of the font and that is than converted to 
the correct color by pal[] obviously thats not possible & i was wrong, i 
should do more RTFS

> (and the code is obviously *totally*
> pessimized). it'll be really better to use truecolor.
>
> btw, what about alpha for u & v channels? i hope that taking every even
> pixel from the full-res alpha should be allright...
i guess so, or the average of 2 (for YUY2) or 4 (for YV12)

Michael



More information about the MPlayer-dev-eng mailing list