diff options
author | Paul B Mahol <onemda@gmail.com> | 2017-04-21 12:27:17 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2017-04-25 00:38:07 +0200 |
commit | 7c25523cc8e618e77dc84d960e41e9644eaf8c33 (patch) | |
tree | 5538bf9bb750c4f4621b08a699f6dc60c40dac19 /libavcodec | |
parent | 8c0cadd17e98547d84e82111550caca4fb40ff8d (diff) | |
download | ffmpeg-7c25523cc8e618e77dc84d960e41e9644eaf8c33.tar.gz |
utvideodec: Fix decoding odd sizes with interlaced video with some formats
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utvideodec.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 910d64b57e..0f58c83979 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -228,6 +228,16 @@ fail: return AVERROR_INVALIDDATA; } +static int compute_cmask(int plane_no, int interlaced, int pix_fmt) +{ + const int is_luma = (pix_fmt == AV_PIX_FMT_YUV420P) && !plane_no; + + if (interlaced) + return ~(1 + 2 * is_luma); + + return ~is_luma; +} + static int decode_plane(UtvideoContext *c, int plane_no, uint8_t *dst, int step, ptrdiff_t stride, int width, int height, @@ -238,7 +248,7 @@ static int decode_plane(UtvideoContext *c, int plane_no, VLC vlc; BitstreamContext bc; int prev, fsym; - const int cmask = ~(!plane_no && c->avctx->pix_fmt == AV_PIX_FMT_YUV420P); + const int cmask = compute_cmask(plane_no, c->interlaced, c->avctx->pix_fmt); if (build_huff(src, &vlc, &fsym)) { av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n"); |