summaryrefslogtreecommitdiff
path: root/libavcodec/tiff.c
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-03-09 11:05:36 +0100
committerCarl Eugen Hoyos <ceffmpeg@gmail.com>2019-03-20 17:04:55 +0100
commit6fcf7adc019b29926ce7b096640cfdf714074bcd (patch)
treea71dacf65b62de89c766981c5088cd5cfd4c950a /libavcodec/tiff.c
parent4b32f8b3ebfa011fcc5991bcaa97c3f5b61b49ad (diff)
lavc/tiff: Support decoding 16bit cmyk.
Diffstat (limited to 'libavcodec/tiff.c')
-rw-r--r--libavcodec/tiff.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 112f5b52f4..828ed9e2e9 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -1547,6 +1547,22 @@ again:
}
dst += p->linesize[plane];
}
+ } else if (s->photometric == TIFF_PHOTOMETRIC_SEPARATED &&
+ s->avctx->pix_fmt == AV_PIX_FMT_RGBA64BE) {
+ dst = p->data[plane];
+ for (i = 0; i < s->height; i++) {
+ for (j = 0; j < s->width; j++) {
+ uint64_t k = 65535 - AV_RB16(dst + 8 * j + 6);
+ uint64_t r = (65535 - AV_RB16(dst + 8 * j )) * k;
+ uint64_t g = (65535 - AV_RB16(dst + 8 * j + 2)) * k;
+ uint64_t b = (65535 - AV_RB16(dst + 8 * j + 4)) * k;
+ AV_WB16(dst + 8 * j , r * 65537 >> 32);
+ AV_WB16(dst + 8 * j + 2, g * 65537 >> 32);
+ AV_WB16(dst + 8 * j + 4, b * 65537 >> 32);
+ AV_WB16(dst + 8 * j + 6, 65535);
+ }
+ dst += p->linesize[plane];
+ }
}
}