diff --git a/libavcodec/mjpeg.c b/libavcodec/mjpeg.c index 2a10934978ac7a84c494692dcb8fcb66bc77bd48..2487f613757981795a06cc7444e7b0b206a714a1 100644 --- a/libavcodec/mjpeg.c +++ b/libavcodec/mjpeg.c @@ -1144,7 +1144,6 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) s->width = width; s->height = height; - avcodec_set_dimensions(s->avctx, width, height); /* test interlaced mode */ if (s->first_picture && @@ -1153,9 +1152,11 @@ static int mjpeg_decode_sof(MJpegDecodeContext *s) s->interlaced = 1; // s->bottom_field = (s->interlace_polarity) ? 1 : 0; s->bottom_field = 0; - s->avctx->height *= 2; + height *= 2; } + avcodec_set_dimensions(s->avctx, width, height); + s->qscale_table= av_mallocz((s->width+15)/16); s->first_picture = 0;