summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Kennard <glenn.kennard@gmail.com>2008-03-17 18:57:18 +0100
committerGlenn Kennard <glenn.kennard@gmail.com>2008-03-17 18:57:18 +0100
commitf77317208e3cbe250f464a93901f157c438e0993 (patch)
tree0e3d8240cdebba2125f52e432873a0dc9d6b487d
parent5352905adfc06e9e019f9acec2c973f0ef60d419 (diff)
downloadmupdf-f77317208e3cbe250f464a93901f157c438e0993.tar.xz
Small speedup of decodetile
-rw-r--r--raster/imageunpack.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/raster/imageunpack.c b/raster/imageunpack.c
index 591c4b60..f66f2aeb 100644
--- a/raster/imageunpack.c
+++ b/raster/imageunpack.c
@@ -33,12 +33,29 @@ static void decodetile(fz_pixmap *pix, int skip, float *decode)
if (!needed)
return;
-
- while (wh--)
- {
- for (i = 0; i < n; i++)
- p[i] = min[i] + fz_mul255(sub[i], p[i]);
- p += n;
+ switch (n) {
+ case 1:
+ while (wh--)
+ {
+ p[0] = min[0] + fz_mul255(sub[0], p[0]);
+ p ++;
+ }
+ break;
+ case 2:
+ while (wh--)
+ {
+ p[0] = min[0] + fz_mul255(sub[0], p[0]);
+ p[1] = min[1] + fz_mul255(sub[1], p[1]);
+ p += 2;
+ }
+ break;
+ default:
+ while (wh--)
+ {
+ for (i = 0; i < n; i++)
+ p[i] = min[i] + fz_mul255(sub[i], p[i]);
+ p += n;
+ }
}
}