summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1dec.c
diff options
context:
space:
mode:
authorJérôme Martinez <jerome@mediaarea.net>2016-06-13 19:18:22 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-06-13 22:07:35 +0200
commit878c3a36451eaf1ae3ec3d8eab0af11dab0a7695 (patch)
treef58b0aaea96fb6cd338befd1c26065b998c1036f /libavcodec/ffv1dec.c
parent836f3555a8def29001d7c917d1574a7938d2357b (diff)
avcodec/ffv1dec: fix some unsupported pix_fmt
When checking pix_fmt mapping, some bitstreams are mapped to an incorrect pix_fmt instead of being rejected (ENOSYS). Actually, such bitstreams are not supported (FFmpeg encoder does not produce such bitstream, such bitstream may come only from another encoder for the moment). - JPEG 2000 RCT 11/13/15/16 bit depths are mapped to a 8-bit FFmpeg pix_fmt (e.g. bgr0), which is not expected. - JPEG 2000 RCT 9/10/12/14 bit depths with alpha are mapped to a FFmpeg pix_fmt without alpha (e.g. AV_PIX_FMT_GBRP9 for 9-bit with alpha), which is not expected. The order for choosing the pix_fmt is changed to the one used by YCbCr selection (<=8 bit first). " && !f->transparency" is added to the other lines. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1dec.c')
-rw-r--r--libavcodec/ffv1dec.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index d2bf3a89fd..6a932b2934 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -768,17 +768,18 @@ static int read_header(FFV1Context *f)
"chroma subsampling not supported in this colorspace\n");
return AVERROR(ENOSYS);
}
- if ( f->avctx->bits_per_raw_sample == 9)
+ if ( f->avctx->bits_per_raw_sample <= 8 && !f->transparency)
+ f->avctx->pix_fmt = AV_PIX_FMT_0RGB32;
+ else if (f->avctx->bits_per_raw_sample <= 8 && f->transparency)
+ f->avctx->pix_fmt = AV_PIX_FMT_RGB32;
+ else if (f->avctx->bits_per_raw_sample == 9 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP9;
- else if (f->avctx->bits_per_raw_sample == 10)
+ else if (f->avctx->bits_per_raw_sample == 10 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP10;
- else if (f->avctx->bits_per_raw_sample == 12)
+ else if (f->avctx->bits_per_raw_sample == 12 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP12;
- else if (f->avctx->bits_per_raw_sample == 14)
+ else if (f->avctx->bits_per_raw_sample == 14 && !f->transparency)
f->avctx->pix_fmt = AV_PIX_FMT_GBRP14;
- else
- if (f->transparency) f->avctx->pix_fmt = AV_PIX_FMT_RGB32;
- else f->avctx->pix_fmt = AV_PIX_FMT_0RGB32;
} else {
av_log(f->avctx, AV_LOG_ERROR, "colorspace not supported\n");
return AVERROR(ENOSYS);