[FFmpeg-devel] [PATCH] av_picture_copy misses pixels on packed planar AVPictures with odd width or height

Art Clarke aclarke
Tue Oct 28 19:52:46 CET 2008

To reproduce:
1) Create a AVPicture with an odd width and height (e.g. 503w x 251h)
in a packed pixel format (e.g. YUV_420P).
2) Use the av_picture_copy method
3) Check if all bytes are the same in the copied AVPicture: you'll be
missing one U and V values at the end of each line, and all the U and
V values for last line.

A rounding error computing the width and height to copy.  A picture
503w x 251h pixels should have U and V plane widths of 252, and 126
total rows of u and v data but due to the rounding error the
av_picture_copy only copes over 251 bytes for each row's width, and
calculates 125 total rows of data.  ff_fill_* methods do the correct

1) Make sure we compute plane width and height by rounding up with
adjusting for chroma_shifts (as in the ff_fill_linesinze methods)
2) remove an unused "width" calculation that was never used.

- Art
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: diff.txt
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081028/51285111/attachment.txt>

More information about the ffmpeg-devel mailing list