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

Jindrich Makovicka makovick at kmlinux.fjfi.cvut.cz
Sat Nov 2 22:20:02 CET 2002


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.

>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 (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...

-- 
Jindrich Makovicka





More information about the MPlayer-dev-eng mailing list