yuv4mpeg: correctly handle chroma for odd luma sizes.
authorRonald S. Bultje <rsbultje@gmail.com>
Mon, 24 Jun 2013 23:13:58 +0000 (19:13 -0400)
committerDerek Buitenhuis <derek.buitenhuis@gmail.com>
Mon, 24 Jun 2013 23:13:58 +0000 (19:13 -0400)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
libavformat/yuv4mpeg.c

index bf48230bb3f0a11ce7c6bbf3b74a67e20a13f282..a6d83469ef223894844168cf9c9bf11941b81198 100644 (file)
@@ -217,8 +217,8 @@ 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;
+        width  = FF_CEIL_RSHIFT(width,  h_chroma_shift);
+        height = FF_CEIL_RSHIFT(height, v_chroma_shift);
 
         ptr1 = picture->data[1];
         ptr2 = picture->data[2];