summaryrefslogtreecommitdiff
path: root/raster/imageunpack.c
diff options
context:
space:
mode:
authorGlenn Kennard <glenn.kennard@gmail.com>2005-10-03 19:36:34 +0200
committerGlenn Kennard <glenn.kennard@gmail.com>2005-10-03 19:36:34 +0200
commit3d58249f61401dc2a2957531fe278a575384fd3c (patch)
tree2eb3e5b89a835fed8cdcf14e66e3994a50628399 /raster/imageunpack.c
parent2366ad7de028d397fbd6ed4d7a5d5d1b7915b6cf (diff)
downloadmupdf-3d58249f61401dc2a2957531fe278a575384fd3c.tar.xz
small optimizations
Optimize some common image code paths.
Diffstat (limited to 'raster/imageunpack.c')
-rw-r--r--raster/imageunpack.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/raster/imageunpack.c b/raster/imageunpack.c
index b650b0f2..a3642d3d 100644
--- a/raster/imageunpack.c
+++ b/raster/imageunpack.c
@@ -13,7 +13,7 @@ static void decodetile(fz_pixmap *pix, int skip, float *decode)
int min[FZ_MAXCOLORS];
int max[FZ_MAXCOLORS];
int sub[FZ_MAXCOLORS];
- int useless = 1;
+ int needed = 0;
byte *p = pix->samples;
int n = pix->n;
int wh = pix->w * pix->h;
@@ -28,11 +28,10 @@ static void decodetile(fz_pixmap *pix, int skip, float *decode)
min[i] = decode[(i - skip) * 2] * 255;
max[i] = decode[(i - skip) * 2 + 1] * 255;
sub[i] = max[i] - min[i];
- if (min[i] != 0 || max[i] != 255)
- useless = 0;
+ needed |= (min[i] != 0) | (max[i] != 255);
}
- if (useless)
+ if (!needed)
return;
while (wh--)
@@ -170,11 +169,11 @@ static void loadtile1(byte *src, int sw, byte *dst, int dw, int w, int h, int pa
} \
}
-static void loadtile2(byte *src, int sw, byte *dst, int dw, int w, int h, int pad)
+static void loadtile2(byte * restrict src, int sw, byte * restrict dst, int dw, int w, int h, int pad)
TILE(ttwo)
-static void loadtile4(byte *src, int sw, byte *dst, int dw, int w, int h, int pad)
+static void loadtile4(byte * restrict src, int sw, byte * restrict dst, int dw, int w, int h, int pad)
TILE(tnib)
-static void loadtile8(byte *src, int sw, byte *dst, int dw, int w, int h, int pad)
+static void loadtile8(byte * restrict src, int sw, byte * restrict dst, int dw, int w, int h, int pad)
TILE(toct)
void (*fz_decodetile)(fz_pixmap *pix, int skip, float *decode) = decodetile;