[FFmpeg-devel] [PATCH]ffplay 2/2: Fix subtitle rendering for special cases

Björn Axelsson gecko
Sat Feb 7 00:35:47 CET 2009


On Thu, 5 Feb 2009, Michael Niedermayer wrote:

[...]

> > blend_subrect_2.diff:
> > Fix blend_subrect for even-width subrects positioned on odd columns.
> >
> > When a subrect starts on an odd column, the first column is rendered
> > separately and the chroma pointers are increased by one as if two columns
> > were rendered. If the subrect had an even width to start width, the rest
> > of the subrect has now an odd width and the final column is rendered
> > separately, also increasing the chroma pointers as if two columns were
> > rendered. This results in the chroma part of the subtitle getting offset
> > one additional sample to the right for each row.
> > The effect can be seen in the first, the sixth and the seventh subtitles
> > of the sample[1].
>
> this change looks wrong

Here's a cleaner approach...

[...]

-- 
Bj?rn Axelsson
-------------- next part --------------
Index: ffplay.c
===================================================================
--- ffplay.c.orig	2009-02-07 00:28:30.000000000 +0100
+++ ffplay.c	2009-02-07 00:30:42.000000000 +0100
@@ -449,7 +449,7 @@
     cb = dst->data[1] + (dsty >> 1) * dst->linesize[1];
     cr = dst->data[2] + (dsty >> 1) * dst->linesize[2];
 
-    width2 = (dstw + 1) >> 1;
+    width2 = ((dstw + 1) >> 1) + (dstx & ~dstw & 1);
     skip2 = dstx >> 1;
     wrap = dst->linesize[0];
     wrap3 = rect->pict.linesize[0];



More information about the ffmpeg-devel mailing list