[FFmpeg-cvslog] yuv4mpeg: Correctly round chroma up for odd luma sizes
Ronald S. Bultje
git at videolan.org
Mon Jul 8 03:51:04 CEST 2013
ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Mon Jun 24 19:13:58 2013 -0400| [6c86a63bad7700848b1e46337038cf5bd06abbe6] | committer: Martin Storsjö
yuv4mpeg: Correctly round chroma up for odd luma sizes
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6c86a63bad7700848b1e46337038cf5bd06abbe6
---
libavformat/yuv4mpeg.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 699a63a..c38d641 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -132,8 +132,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
// Adjust for smaller Cb and Cr planes
av_pix_fmt_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift,
&v_chroma_shift);
- width >>= h_chroma_shift;
- height >>= v_chroma_shift;
+ // Shift right, rounding up
+ width = -(-width >> h_chroma_shift);
+ height = -(-height >> v_chroma_shift);
ptr1 = picture->data[1];
ptr2 = picture->data[2];
More information about the ffmpeg-cvslog
mailing list