diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-22 15:08:58 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-22 15:30:31 +0200 |
commit | d09321b68e8373435aa98801929c0a5714efd104 (patch) | |
tree | 60d9c6b8fb34f24ff08b1ecd6affc43542d5b45f | |
parent | ebb08f3fe4166ec95b6f79fe613bb1c890978e66 (diff) | |
download | ffmpeg-d09321b68e8373435aa98801929c0a5714efd104.tar.gz |
avcodec/mpeg12dec: Fix chroma location
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/mpeg12dec.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index ea7386cdf0..1ca6c9db45 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1141,10 +1141,6 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx) s->repeat_field = 0; s->mpeg_enc_ctx.codec_id = avctx->codec->id; 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; } @@ -1366,6 +1362,8 @@ static int mpeg_decode_postinit(AVCodecContext *avctx) // MPEG-1 fps avctx->framerate = ff_mpeg12_frame_rate_tab[s->frame_rate_index]; avctx->ticks_per_frame = 1; + + avctx->chroma_sample_location = AVCHROMA_LOC_CENTER; } else { // MPEG-2 // MPEG-2 fps av_reduce(&s->avctx->framerate.num, @@ -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, 1 << 30); 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 avctx->pix_fmt = mpeg_get_pixelformat(avctx); |