summaryrefslogtreecommitdiff
path: root/source/fitz/load-tiff.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-09-24 16:47:59 +0800
committerSebastian Rasmussen <sebras@gmail.com>2016-09-26 18:47:26 +0800
commitb70ce7de2b8ed37f7bd4fa01bb95b45a79c502e7 (patch)
treedfb8465476c14d0b4538425b6b49429d52913394 /source/fitz/load-tiff.c
parent81b4cd572a176ad56c2f9c3d12121f61a52e5a35 (diff)
downloadmupdf-b70ce7de2b8ed37f7bd4fa01bb95b45a79c502e7.tar.xz
tiff: Add support for thunder decoding.
Diffstat (limited to 'source/fitz/load-tiff.c')
-rw-r--r--source/fitz/load-tiff.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index b57497a2..87e350f0 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -171,6 +171,14 @@ fz_decode_tiff_sgilog24(fz_context *ctx, struct tiff *tiff, fz_stream *chain, un
}
static void
+fz_decode_tiff_thunder(fz_context *ctx, struct tiff *tiff, fz_stream *chain, unsigned char *wp, int wlen, int w)
+{
+ fz_stream *stm = fz_open_thunder(ctx, chain, w);
+ fz_read(ctx, stm, wp, wlen);
+ fz_drop_stream(ctx, stm);
+}
+
+static void
fz_decode_tiff_sgilog32(fz_context *ctx, struct tiff *tiff, fz_stream *chain, unsigned char *wp, int wlen, int w)
{
fz_stream *stm = fz_open_sgilog32(ctx, chain, w);
@@ -518,6 +526,11 @@ fz_decode_tiff_strips(fz_context *ctx, struct tiff *tiff)
case 34677:
fz_decode_tiff_sgilog24(ctx, tiff, stm, wp, wlen, tiff->imagewidth);
break;
+ case 32809:
+ if (tiff->bitspersample != 4)
+ fz_throw(ctx, FZ_ERROR_GENERIC, "invalid bits per pixel in thunder encoding");
+ fz_decode_tiff_thunder(ctx, tiff, stm, wp, wlen, tiff->imagewidth);
+ break;
default:
fz_throw(ctx, FZ_ERROR_GENERIC, "unknown TIFF compression: %d", tiff->compression);
}