avcodec/mjpegdec: Fix chroma width rounding
[ffmpeg.git] / libavcodec / mjpegdec.c
index 827c24de81e58e1cbb12d99be4788eb2229a4a55..4d17c5ff31ffb7660d93d9ef12606fb7bc5bc762 100644 (file)
@@ -2127,7 +2127,7 @@ the_end:
             if (!(s->upscale_v & (1<<p)))
                 continue;
             if (p==1 || p==2)
-                w >>= hshift;
+                w = FF_CEIL_RSHIFT(w, hshift);
             for (i = s->height - 1; i; i--) {
                 uint8_t *src1 = &((uint8_t *)s->picture_ptr->data[p])[i / 2 * s->linesize[p]];
                 uint8_t *src2 = &((uint8_t *)s->picture_ptr->data[p])[(i + 1) / 2 * s->linesize[p]];