Commit d09321b6 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpeg12dec: Fix chroma location

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent ebb08f3f
...@@ -1141,10 +1141,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) ...@@ -1141,10 +1141,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
s->repeat_field = 0; s->repeat_field = 0;
s->mpeg_enc_ctx.codec_id = avctx->codec->id; s->mpeg_enc_ctx.codec_id = avctx->codec->id;
avctx->color_range = AVCOL_RANGE_MPEG; avctx->color_range = AVCOL_RANGE_MPEG;
if (avctx->codec->id == AV_CODEC_ID_MPEG1VIDEO)
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
else
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
return 0; return 0;
} }
...@@ -1366,6 +1362,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) ...@@ -1366,6 +1362,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
// MPEG-1 fps // MPEG-1 fps
avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index];
avctx->ticks_per_frame = 1; avctx->ticks_per_frame = 1;
avctx->chroma_sample_location = AVCHROMA_LOC_CENTER;
} else { // MPEG-2 } else { // MPEG-2
// MPEG-2 fps // MPEG-2 fps
av_reduce(&s->avctx->framerate.num, av_reduce(&s->avctx->framerate.num,
...@@ -1374,6 +1372,12 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) ...@@ -1374,6 +1372,12 @@ static int mpeg_decode_postinit(AVCodecContext *avctx)
ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den, ff_mpeg12_frame_rate_tab[s->frame_rate_index].den * s1->frame_rate_ext.den,
1 << 30); 1 << 30);
avctx->ticks_per_frame = 2; avctx->ticks_per_frame = 2;
switch (s->chroma_format) {
case 1: avctx->chroma_sample_location = AVCHROMA_LOC_LEFT; break;
case 2:
case 3: avctx->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break;
}
} // MPEG-2 } // MPEG-2
avctx->pix_fmt = mpeg_get_pixelformat(avctx); avctx->pix_fmt = mpeg_get_pixelformat(avctx);
......
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