jbig2dec
Raph Levien <[email protected]> Thu, 06 Feb 2003 21:06:49 -0800
| Newsgroups | gmane.comp.printing.ghostscript.jbig2dec.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jbig2dec/jbig2dec
In directory sc8-pr-cvs1:/tmp/cvs-serv23278
Modified Files:
jbig2_image.c jbig2_text.c
Log Message:
Fixes: make find_segment search globals, and also fix off-by-one.
Disable memcpy optimization in jbig2_image_compose, because it's not
always valid.
Index: jbig2_image.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2_image.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- jbig2_image.c 15 Aug 2002 14:54:45 -0000 1.20
+++ jbig2_image.c 7 Feb 2003 05:06:46 -0000 1.21
@@ -93,11 +93,15 @@
w, h, x, y);
#endif
+#if 0
/* special case complete/strip replacement */
+ /* disabled because it's only safe to do when the destination
+ buffer is all-blank. */
if ((x == 0) && (w == src->width)) {
memcpy(dst->data + y*dst->stride, src->data, h*src->stride);
return 0;
}
+#endif
leftbyte = x >> 3;
rightbyte = (x + w - 1) >> 3;
Index: jbig2_text.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2_text.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- jbig2_text.c 15 Aug 2002 14:54:45 -0000 1.20
+++ jbig2_text.c 7 Feb 2003 05:06:46 -0000 1.21
@@ -278,13 +278,19 @@
static Jbig2Segment *
find_segment(Jbig2Ctx *ctx, uint32_t number)
{
- int index, index_max = ctx->segment_index;
-
+ int index, index_max = ctx->segment_index - 1;
+ const Jbig2Ctx *global_ctx = ctx->global_ctx;
+
/* FIXME: binary search would be better? */
for (index = index_max; index >= 0; index--)
if (ctx->segments[index]->number == number)
return (ctx->segments[index]);
+ if (global_ctx)
+ for (index = global_ctx->segment_index - 1; index >= 0; index--)
+ if (global_ctx->segments[index]->number == number)
+ return (global_ctx->segments[index]);
+
/* didn't find a match */
return NULL;
}