[jbig2-cvs] rev 415 - trunk
giles at ghostscript.com
giles at ghostscript.com
Wed Jul 13 09:28:44 PDT 2005
Author: giles
Date: 2005-07-13 09:28:44 -0700 (Wed, 13 Jul 2005)
New Revision: 415
Modified:
trunk/jbig2_image.c
Log:
Move a repeated calculation out of a loop.
Modified: trunk/jbig2_image.c
===================================================================
--- trunk/jbig2_image.c 2005-06-20 11:09:19 UTC (rev 414)
+++ trunk/jbig2_image.c 2005-07-13 16:28:44 UTC (rev 415)
@@ -1,7 +1,7 @@
/*
jbig2dec
- Copyright (c) 2001-2003 artofcode LLC.
+ Copyright (c) 2001-2005 artofcode LLC.
This software is distributed under license and may not
be copied, modified or distributed except as expressly
@@ -51,7 +51,7 @@
jbig2_free(ctx->allocator, image);
return NULL;
}
-
+
image->width = width;
image->height = height;
image->stride = stride;
@@ -234,8 +234,9 @@
s = (ss += src->stride);
}
} else {
+ bool overlap = (((w + 7) >> 3) < ((x + w + 7) >> 3) - (x >> 3));
mask = 0x100 - (1 << shift);
- if (((w + 7) >> 3) < ((x + w + 7) >> 3) - (x >> 3))
+ if (overlap)
rightmask = (0x100 - (0x100 >> ((x + w) & 7))) >> (8 - shift);
else
rightmask = 0x100 - (0x100 >> (w & 7));
@@ -245,8 +246,8 @@
*d |= ((*s++ & ~mask) << (8 - shift));
*d++ |= ((*s & mask) >> shift);
}
- if (((w + 7) >> 3) < ((x + w + 7) >> 3) - (x >> 3))
- *d |= (s[0] & rightmask) << (8 - shift);
+ if (overlap)
+ *d |= (*s & rightmask) << (8 - shift);
else
*d |= ((s[0] & ~mask) << (8 - shift)) |
((s[1] & rightmask) >> shift);
More information about the jbig2-cvs
mailing list