aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-09-14 13:58:21 +0200
committerPaul B Mahol <onemda@gmail.com>2022-09-25 18:34:48 +0200
commitbaf9099cf380fad2be4ae17379f6cb5762bb2c92 (patch)
tree6b60d0c28006f20bf27cac9078b75743cf1d7a6b
parent7bb0afc245d093b065b849461a5e0361050df512 (diff)
downloadffmpeg-baf9099cf380fad2be4ae17379f6cb5762bb2c92.tar.gz
avcodec/tiff: add packed/planar 32bit float support
-rw-r--r--libavcodec/tiff.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 4da77a3a31..750c42ca51 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1026,14 +1026,14 @@ static int init_image(TiffContext *s, AVFrame *frame)
int create_gray_palette = 0;
// make sure there is no aliasing in the following switch
- if (s->bpp >= 100 || s->bppcount >= 10) {
+ if (s->bpp > 128 || s->bppcount >= 10) {
av_log(s->avctx, AV_LOG_ERROR,
"Unsupported image parameters: bpp=%d, bppcount=%d\n",
s->bpp, s->bppcount);
return AVERROR_INVALIDDATA;
}
- switch (s->planar * 1000 + s->bpp * 10 + s->bppcount + s->is_bayer * 10000) {
+ switch (s->planar * 10000 + s->bpp * 10 + s->bppcount + s->is_bayer * 100000) {
case 11:
if (!s->palette_is_set) {
s->avctx->pix_fmt = AV_PIX_FMT_MONOBLACK;
@@ -1052,7 +1052,7 @@ static int init_image(TiffContext *s, AVFrame *frame)
case 121:
s->avctx->pix_fmt = AV_PIX_FMT_GRAY12;
break;
- case 10081:
+ case 100081:
switch (AV_RL32(s->pattern)) {
case 0x02010100:
s->avctx->pix_fmt = AV_PIX_FMT_BAYER_RGGB8;
@@ -1072,10 +1072,10 @@ static int init_image(TiffContext *s, AVFrame *frame)
return AVERROR_PATCHWELCOME;
}
break;
- case 10101:
- case 10121:
- case 10141:
- case 10161:
+ case 100101:
+ case 100121:
+ case 100141:
+ case 100161:
switch (AV_RL32(s->pattern)) {
case 0x02010100:
s->avctx->pix_fmt = AV_PIX_FMT_BAYER_RGGB16;
@@ -1143,18 +1143,30 @@ static int init_image(TiffContext *s, AVFrame *frame)
case 644:
s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGBA64LE : AV_PIX_FMT_RGBA64BE;
break;
- case 1243:
+ case 10243:
s->avctx->pix_fmt = AV_PIX_FMT_GBRP;
break;
- case 1324:
+ case 10324:
s->avctx->pix_fmt = AV_PIX_FMT_GBRAP;
break;
- case 1483:
+ case 10483:
s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRP16LE : AV_PIX_FMT_GBRP16BE;
break;
- case 1644:
+ case 10644:
s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRAP16LE : AV_PIX_FMT_GBRAP16BE;
break;
+ case 963:
+ s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGBF32LE : AV_PIX_FMT_RGBF32BE;
+ break;
+ case 1284:
+ s->avctx->pix_fmt = s->le ? AV_PIX_FMT_RGBAF32LE : AV_PIX_FMT_RGBAF32BE;
+ break;
+ case 10963:
+ s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRPF32LE : AV_PIX_FMT_GBRPF32BE;
+ break;
+ case 11284:
+ s->avctx->pix_fmt = s->le ? AV_PIX_FMT_GBRAPF32LE : AV_PIX_FMT_GBRAPF32BE;
+ break;
default:
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, bppcount=%d)\n",
@@ -1732,7 +1744,7 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
}
}
end:
- if (s->bpp > 64U) {
+ if (s->bpp > 128U) {
av_log(s->avctx, AV_LOG_ERROR,
"This format is not supported (bpp=%d, %d components)\n",
s->bpp, count);