diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-06-07 01:42:02 +0400 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-06-07 01:42:02 +0400 |
commit | 86005184e3c49bf3bc1df0e4bcea9e171985da1b (patch) | |
tree | 68794e4244f0bfbe1768f32db6100a8e4e159867 /libavcodec/tiff.c | |
parent | 61d900fd0df6e29674fc453db0c0dcc9cb2ba6b9 (diff) |
tiff: simplify picking right pixel format
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r-- | libavcodec/tiff.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index 922aed063a..af49986c5c 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -617,7 +617,7 @@ static int init_image(TiffContext *s, AVFrame *frame) int i, ret; uint32_t *pal; - switch (s->bpp * 10 + s->bppcount) { + switch (s->planar * 1000 + s->bpp * 10 + s->bppcount) { case 11: if (!s->palette_is_set) { s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK; @@ -629,24 +629,34 @@ static int init_image(TiffContext *s, AVFrame *frame) s->avctx->pix_fmt = AV_PIX_FMT_PAL8; break; case 243: - s->avctx->pix_fmt = s->planar ? AV_PIX_FMT_GBRP : AV_PIX_FMT_RGB24; + s->avctx->pix_fmt = AV_PIX_FMT_RGB24; break; case 161: s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GRAY16LE : AV_PIX_FMT_GRAY16BE; break; case 162: - s->avctx->pix_fmt = s->planar ? AV_PIX_FMT_NONE : AV_PIX_FMT_GRAY8A; + s->avctx->pix_fmt = AV_PIX_FMT_GRAY8A; break; case 324: - s->avctx->pix_fmt = s->planar ? AV_PIX_FMT_GBRAP : AV_PIX_FMT_RGBA; + s->avctx->pix_fmt = AV_PIX_FMT_RGBA; break; case 483: - s->avctx->pix_fmt = s->planar ? (s->le ? AV_PIX_FMT_GBRP16LE : AV_PIX_FMT_GBRP16BE) : - (s->le ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB48BE); + s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGB48LE : AV_PIX_FMT_RGB48BE; break; case 644: - s->avctx->pix_fmt = s->planar ? (s->le ? AV_PIX_FMT_GBRAP16LE : AV_PIX_FMT_GBRAP16BE) : - (s->le ? AV_PIX_FMT_RGBA64LE : AV_PIX_FMT_RGBA64BE); + s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGBA64LE : AV_PIX_FMT_RGBA64BE; + break; + case 1243: + s->avctx->pix_fmt = AV_PIX_FMT_GBRP; + break; + case 1324: + s->avctx->pix_fmt = AV_PIX_FMT_GBRAP; + break; + case 1483: + s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRP16LE : AV_PIX_FMT_GBRP16BE; + break; + case 1644: + s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRAP16LE : AV_PIX_FMT_GBRAP16BE; break; default: av_log(s->avctx, AV_LOG_ERROR, |