@@ -1291,12 +1291,11 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
}
if ((s1->mpeg_enc_ctx_allocated == 0) ||
- avctx->coded_width != s->width ||
- avctx->coded_height != s->height ||
+ avctx->coded_width != FFALIGN(s->width, 16) ||
+ avctx->coded_height != FFALIGN(s->height, s->progressive_sequence ? 16 : 32) ||
s1->save_width != s->width ||
s1->save_height != s->height ||
av_cmp_q(s1->save_aspect, s->avctx->sample_aspect_ratio) ||
- (s1->save_progressive_seq != s->progressive_sequence && FFALIGN(s->height, 16) != FFALIGN(s->height, 32)) ||
0) {
if (s1->mpeg_enc_ctx_allocated) {
ParseContext pc = s->parse_context;
@@ -1310,6 +1309,9 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
if (ret < 0)
return ret;
+ avctx->coded_width = FFALIGN(avctx->coded_width, 16);
+ avctx->coded_height = FFALIGN(avctx->coded_height, s->progressive_sequence ? 16: 32);
+
if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO && s->bit_rate) {
avctx->rc_max_rate = s->bit_rate;
} else if (avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && s->bit_rate &&