Commit 6c86a63b authored by Ronald S. Bultje's avatar Ronald S. Bultje Committed by Martin Storsjö
Browse files

yuv4mpeg: Correctly round chroma up for odd luma sizes

Signed-off-by: default avatarMartin Storsjö <>
parent d35b6cd3
...@@ -132,8 +132,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -132,8 +132,9 @@ static int yuv4_write_packet(AVFormatContext *s, AVPacket *pkt)
// Adjust for smaller Cb and Cr planes // Adjust for smaller Cb and Cr planes
av_pix_fmt_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift, av_pix_fmt_get_chroma_sub_sample(st->codec->pix_fmt, &h_chroma_shift,
&v_chroma_shift); &v_chroma_shift);
width >>= h_chroma_shift; // Shift right, rounding up
height >>= v_chroma_shift; width = -(-width >> h_chroma_shift);
height = -(-height >> v_chroma_shift);
ptr1 = picture->data[1]; ptr1 = picture->data[1];
ptr2 = picture->data[2]; ptr2 = picture->data[2];
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment