aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2013-06-24 19:13:58 -0400
committerMartin Storsjö <martin@martin.st>2013-07-07 13:30:22 +0300
commit6c86a63bad7700848b1e46337038cf5bd06abbe6 (patch)
treea8685b410d6c4a5215c8e56106e3bcec1a827974
parentd35b6cd3775456a23b63e73316e244b671caa02f (diff)
downloadffmpeg-6c86a63bad7700848b1e46337038cf5bd06abbe6.tar.gz
yuv4mpeg: Correctly round chroma up for odd luma sizes
Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/yuv4mpeg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index 699a63a681..c38d641e06 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];