summaryrefslogtreecommitdiff
path: root/source/fitz/filter-predict.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-05-23 15:13:39 +0200
committerTor Andersson <tor.andersson@artifex.com>2014-05-23 15:13:39 +0200
commit5aa2e01f585075cea6854897503f72fcb6f6a8a0 (patch)
tree99dade4845a7f141464d3103e3e55792ead86d22 /source/fitz/filter-predict.c
parent30dcebf32f5ac4df97ef477c6a5b4a8c8d247527 (diff)
downloadmupdf-5aa2e01f585075cea6854897503f72fcb6f6a8a0.tar.xz
Fix 695041: add special fast case for 8bpp TIFF predictor.
Diffstat (limited to 'source/fitz/filter-predict.c')
-rw-r--r--source/fitz/filter-predict.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/source/fitz/filter-predict.c b/source/fitz/filter-predict.c
index 6862f8c9..3aaa6ee9 100644
--- a/source/fitz/filter-predict.c
+++ b/source/fitz/filter-predict.c
@@ -67,7 +67,19 @@ fz_predict_tiff(fz_predict *state, unsigned char *out, unsigned char *in, int le
for (k = 0; k < state->colors; k++)
left[k] = 0;
- memset(out, 0, state->stride);
+
+ /* special fast case */
+ if (state->bpc == 8)
+ {
+ for (i = 0; i < state->columns; i++)
+ for (k = 0; k < state->colors; k++)
+ *out++ = left[k] = (*in++ + left[k]) & 0xFF;
+ return;
+ }
+
+ /* putcomponent assumes zeroed memory for bpc < 8 */
+ if (state->bpc < 8)
+ memset(out, 0, state->stride);
for (i = 0; i < state->columns; i++)
{