mirror of https://git.ffmpeg.org/ffmpeg.git
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>
This commit is contained in:
parent
8c0cadd17e
commit
7c25523cc8
|
@ -228,6 +228,16 @@ fail:
|
||||||
return AVERROR_INVALIDDATA;
|
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,
|
static int decode_plane(UtvideoContext *c, int plane_no,
|
||||||
uint8_t *dst, int step, ptrdiff_t stride,
|
uint8_t *dst, int step, ptrdiff_t stride,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
|
@ -238,7 +248,7 @@ static int decode_plane(UtvideoContext *c, int plane_no,
|
||||||
VLC vlc;
|
VLC vlc;
|
||||||
BitstreamContext bc;
|
BitstreamContext bc;
|
||||||
int prev, fsym;
|
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)) {
|
if (build_huff(src, &vlc, &fsym)) {
|
||||||
av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
|
av_log(c->avctx, AV_LOG_ERROR, "Cannot build Huffman codes\n");
|
||||||
|
|
Loading…
Reference in New Issue