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

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Aug 12 18:26:04 CEST 2010


On Thu, Aug 12, 2010 at 12:10:56AM +0200, Nicolas George wrote:
> Anyway, this shows that EOSD and OSD can be unified with a reasonable amount
> of work.
> 
> Would small patches towards that goal be accepted, even tough they may add
> code in the beginning before we are able to actually simplify things?

Uh, the problem with using EOSD only is hardware-based overlays like
XvMC that I am quite convinced can't support EOSD.
Not to mention the reason for why the alpha is the way it is
and why chroma is not touched (performance).
As such, a full replacement does not seem the right goal, except
if you mean optionally.
Working on displaying the SPU part only rather all of the OSD might
be better, since that needs to be modified anyway.
But as long as you keep my two point above in mind, do as you think
is best.

> @@ -511,6 +512,7 @@
>                libmpdemux/yuv4mpeg_ratio.c \
>                libvo/osd.c \
>                libvo/sub.c \
> +	      eosd.c \

Tab slipped in.

> +    int x, y;
> +    unsigned a, v;
> +    ASS_Image *im = malloc(sizeof(ASS_Image));
> +    unsigned char *dm = im->bitmap = malloc(w * h);
> +    ASS_Image *iv = malloc(sizeof(ASS_Image));
> +    unsigned char *dv = iv->bitmap = malloc(w * h);
> +    im->w = iv->w = w;
> +    im->h = iv->h = h;
> +    im->stride = iv->stride = w;
> +    im->dst_x = iv->dst_x = x0;
> +    im->dst_y = iv->dst_y = y0;
> +    im->color = 0x40004000; /* dark purple */
> +    iv->color = 0xFF808000; /* pink */
> +    for(y = 0; y < h; y++) {
> +        for(x = 0; x < w; x++) {
> +            a = srca[x + y * stride];
> +            a = (256 - a) & 0xFF; /* URK */
> +            v = src[x + y * stride];
> +            dm[x + y * w] = v == 255 ? 0 : 255 * (a - v) / (255 - v);
> +            dv[x + y * w] = v;

Not sure what exactly this does, but keep in mind:
1) uint8_t a = -srca[...] is a "simpler" way to convert alpha
2) The osd actually does source * alpha + color, I don't think
   this can be 100% reproduced with EOSD (not that it may be a good
   idea, however I suspect that calculation is more complicated
   than necessary).


More information about the MPlayer-dev-eng mailing list