diff --git a/libavformat/jpeg.c b/libavformat/jpeg.c index 38a955b31d..0aec8f34a2 100644 --- a/libavformat/jpeg.c +++ b/libavformat/jpeg.c @@ -125,11 +125,11 @@ static int jpeg_read(ByteIOContext *f, switch(c->pix_fmt) { default: case PIX_FMT_YUV420P: - w >>= 1; - h >>= 1; + w = (w + 1) >> 1; + h = (h + 1) >> 1; break; case PIX_FMT_YUV422P: - w >>= 1; + w = (w + 1) >> 1; break; case PIX_FMT_YUV444P: break;