shithub: jbig2

Download patch

ref: b78900486172244c39187e89a085b12f2b6abdb1
parent: 6a99885954277048b0d73840941dc47ede4c103a
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Thu Sep 1 00:13:36 EDT 2005

Some minor corrections and bug fixes.


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

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -74,7 +74,10 @@
     jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number,
         "dumping symbol dict as %d individual png files\n", dict->n_symbols);
     for (index = 0; index < dict->n_symbols; index++) {
-        snprintf(filename, sizeof(filename), "symbol_%04d.png", index);
+        snprintf(filename, sizeof(filename), "symbol_%02d-%04d.png", 
+		segment->number, index);
+	jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
+	  "dumping symbol %d/%d as '%s'", index, dict->n_symbols, filename);
 #ifdef HAVE_LIBPNG
         jbig2_image_write_png_file(dict->glyphs[index], filename);
 #else
@@ -497,9 +500,9 @@
 	}
 
 	jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
-	  "reading %dx%d collective bitmap for %d symbols (%d bytes)",
+	  "reading %dx%d collective bitmap for %d symbols (%d bytes%s)",
 	  image->width, image->height, NSYMSDECODED - HCFIRSTSYM,
-	  BMSIZE);
+	  BMSIZE, BMSIZE ? "" : " uncompressed");
 
 	if (BMSIZE == 0) {
 	  /* if BMSIZE == 0 bitmap is uncompressed */
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -275,7 +275,7 @@
     while (NINSTANCES < params->SBNUMINSTANCES) {
         /* (3b) */
         if (params->SBHUFF) {
-            /* todo */
+            DT = jbig2_huffman_get(hs, params->SBHUFFDT, &code);
         } else {
             code = jbig2_arith_int_decode(IADT, as, &DT);
         }
@@ -535,7 +535,7 @@
     
     if (params.SBHUFF) {
         /* 7.4.3.1.5 - Symbol ID Huffman table */
-	/* todo: write the bloody thing */	
+	/* ...this is handled in the segment body decoder */	
 
         /* 7.4.3.1.6 - Other Huffman table selection */
 	switch (huffman_flags & 0x0003) {