@@ -576,6 +576,12 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
if (s->adobe_transform == 0 || s->component_id[0] == 'R' &&
s->component_id[1] == 'G' && s->component_id[2] == 'B') {
s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
+ if (!s->progressive) {
+ for (int i = 0; i < 2; i++) {
+ FFSWAP(int, s->upscale_h[i], s->upscale_h[(i + 2) % 3]);
+ FFSWAP(int, s->upscale_v[i], s->upscale_v[(i + 2) % 3]);
+ }
+ }
} else {
s->avctx->pix_fmt = s->cs_itu601 ? AV_PIX_FMT_YUV444P : AV_PIX_FMT_YUVJ444P;
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;