From f77317208e3cbe250f464a93901f157c438e0993 Mon Sep 17 00:00:00 2001 From: Glenn Kennard Date: Mon, 17 Mar 2008 18:57:18 +0100 Subject: Small speedup of decodetile --- raster/imageunpack.c | 29 +++++++++++++++++++++++------ 1 file 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; + } } } -- cgit v1.2.3