shithub: jbig2

Download patch

ref: 154b1f71742acab16d9106796cede9c3f12a65c8
parent: 3b182de2e206756ddcdd715d8f561273f75a62c2
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Tue Jul 2 20:30:20 EDT 2002

Oops. Previous stride calculation was correct.
Also remove obsolete png test code.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@98 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-# $Id: Makefile.am,v 1.5 2002/07/01 19:34:30 raph Exp $
+# $Id: Makefile.am,v 1.6 2002/07/03 00:30:20 giles Exp $
 ## process this file with automake to generate Makefile.in
 
 lib_LIBRARIES = libjbig2dec.a
@@ -11,7 +11,7 @@
 	jbig2_image.c jbig2_image_pbm.c
 
 bin_PROGRAMS = jbig2dec
-#noinst_PROGRAMS = test_huffman test_arith test_png
+#noinst_PROGRAMS = test_huffman test_arith
 
 jbig2dec_SOURCES = jbig2dec.c
 jbig2dec_LDADD = libjbig2dec.a @LIBOBJS@
--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image.c,v 1.8 2002/07/03 00:10:07 giles Exp $
+    $Id: jbig2_image.c,v 1.9 2002/07/03 00:30:20 giles Exp $
 */
 
 #include <stdio.h>
@@ -33,7 +33,7 @@
 		return NULL;
 	}
 	
-	stride = ((width - 1) >> 5) + 1;	/* generate a word-aligned stride */
+	stride = (((width - 1) >> 5) + 1) << 2;	/* generate a word-aligned stride */
 	image->data = (uint32_t *)jbig2_alloc(ctx->allocator, stride*height);
 	if (image->data == NULL) {
                 jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1,
--- a/jbig2_image_png.c
+++ b/jbig2_image_png.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image_png.c,v 1.2 2002/06/15 16:02:54 giles Exp $
+    $Id: jbig2_image_png.c,v 1.3 2002/07/03 00:30:20 giles Exp $
 */
 
 #include <stdio.h>
@@ -92,31 +92,3 @@
 		
 	return 0;
 }
-
-
-#ifdef TEST
-int main(int argc, char *argv[])
-{
-	int	i,j;
-	Jbig2Image	*image;
-	uint32		*data;
-	char		*filename = "test.png";
-	
-	image = jbig2_image_new(400,400);
-	if (image == NULL) {
-		fprintf(stderr, "failed to create jbig2 image structure!\n");
-		exit(1);
-	}
-	
-	fprintf(stderr, "creating checkerboard test image '%s'\n", filename);
-	data = image->data;
-	for (j = 0; j < image->height; j++) {
-		for (i = 0; i < image->stride >> 2; i++) {
-			*data++ = ((j & 16) >> 4) ? 0x0000FFFF: 0xFFFF0000;
-		}
-	}
-	
-	return jbig2_image_write_png(image, filename);
-}
-
-#endif /* TEST */