[FFmpeg-devel] [PATCH] swscale: Only copy dstW/chrDstW of the last line in the plane in planar copy

Martin Storsjö martin
Fri Jul 16 19:20:56 CEST 2010


On Fri, 16 Jul 2010, Loren Merritt wrote:

> On Fri, 16 Jul 2010, Martin Storsj? wrote:
> 
> > The attached patch makes planarCopyWrapper all lines but the last in one
> > block, then copies only dstW/chrDstW of the last line.
> > 
> > If the destination planes are offset within their buffer, copying the
> > whole plane in one memcpy may write outside of the destination buffer.
> > 
> > A concrete example: The source data is 144x144, stored in the upper left
> > corner of a 176x144 buffer. If this is "scaled" into 144x144 into another
> > 176x144 buffer, but centered into this buffer, the approach wich memcpying
> > the whole plane writes outside of the destination buffer.
> 
> You could still do one block, and just omit the trailing piece of a stride.

Good idea, updated patch attached.

// Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-planarCopyWrapper-Only-copy-length-not-stride-of-the.patch
Type: text/x-diff
Size: 1462 bytes
Desc: 
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100716/beaed214/attachment.patch>



More information about the ffmpeg-devel mailing list