rev 415 - trunk
[email protected] Wed, 13 Jul 2005 09:28:44 -0700 (PDT)
| Newsgroups | gmane.comp.printing.ghostscript.jbig2dec.cvs |
|---|---|
| Message-ID | <[email protected]> |
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
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- 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
=20
- Copyright (c) 2001-2003 artofcode LLC.
+ Copyright (c) 2001-2005 artofcode LLC.
=20
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;
}
-=09
+
image->width =3D width;
image->height =3D height;
image->stride =3D stride;
@@ -234,8 +234,9 @@
s =3D (ss +=3D src->stride);
}
} else {
+ bool overlap =3D (((w + 7) >> 3) < ((x + w + 7) >> 3) - (x >> 3));
mask =3D 0x100 - (1 << shift);
- if (((w + 7) >> 3) < ((x + w + 7) >> 3) - (x >> 3))
+ if (overlap)
rightmask =3D (0x100 - (0x100 >> ((x + w) & 7))) >> (8 - shift);
else
rightmask =3D 0x100 - (0x100 >> (w & 7));
@@ -245,8 +246,8 @@
*d |=3D ((*s++ & ~mask) << (8 - shift));
*d++ |=3D ((*s & mask) >> shift);
}
- if (((w + 7) >> 3) < ((x + w + 7) >> 3) - (x >> 3))
- *d |=3D (s[0] & rightmask) << (8 - shift);
+ if (overlap)
+ *d |=3D (*s & rightmask) << (8 - shift);
else
*d |=3D ((s[0] & ~mask) << (8 - shift)) |
((s[1] & rightmask) >> shift);