rev 422 - trunk

[email protected] Thu, 4 Aug 2005 00:03:05 -0700 (PDT)
Newsgroups gmane.comp.printing.ghostscript.jbig2dec.cvs
Message-ID <[email protected]>
Author: giles
Date: 2005-08-04 00:03:05 -0700 (Thu, 04 Aug 2005)
New Revision: 422

Modified:
   trunk/jbig2_arith.h
   trunk/jbig2_generic.c
   trunk/jbig2_generic.h
   trunk/jbig2_text.c
Log:
bstract the GB_stats size calculation into a function.
Also some comment cleanup.


Modified: trunk/jbig2_arith.h
=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_arith.h	2005-07-28 00:59:59 UTC (rev 421)
+++ trunk/jbig2_arith.h	2005-08-04 07:03:05 UTC (rev 422)
@@ -13,7 +13,7 @@
     Artifex Software, Inc.,  101 Lucas Valley Road #110,
     San Rafael, CA  94903, U.S.A., +1(415)492-9861.
=20
-    $Id: jbig2_arith.h,v 1.4 2002/02/16 07:25:36 raph Exp $
+    $Id$
 */
=20
 typedef struct _Jbig2ArithState Jbig2ArithState;
@@ -23,8 +23,12 @@
    MPS in the top bit. */
 typedef unsigned char Jbig2ArithCx;
=20
+/* allocate and initialize a new arithmetic coding state */
 Jbig2ArithState *
 jbig2_arith_new (Jbig2Ctx *ctx, Jbig2WordStream *ws);
=20
+/* decode a bit */
 bool
 jbig2_arith_decode (Jbig2ArithState *as, Jbig2ArithCx *pcx);
+
+

Modified: trunk/jbig2_generic.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_generic.c	2005-07-28 00:59:59 UTC (rev 421)
+++ trunk/jbig2_generic.c	2005-08-04 07:03:05 UTC (rev 422)
@@ -41,6 +41,16 @@
 #include "jbig2_generic.h"
 #include "jbig2_mmr.h"
=20
+/* return the appropriate context size for the given template */
+int
+jbig2_generic_stats_size(Jbig2Ctx *ctx, int template)
+{
+  int stats_size =3D template =3D=3D 0 ? 1 << 16 :
+        template =3D=3D 1 ? 1 << 1 << 13 : 1 << 10;
+  return stats_size;
+}
+
+
 static int
 jbig2_decode_generic_template0(Jbig2Ctx *ctx,
 			       Jbig2Segment *segment,
@@ -600,8 +610,7 @@
     }
   else
     {
-      int stats_size =3D params.GBTEMPLATE =3D=3D 0 ? 65536 :
-	params.GBTEMPLATE =3D=3D 1 ? 8192 : 1024;
+      int stats_size =3D jbig2_generic_stats_size(ctx, params.GBTEMPLATE=
);
       GB_stats =3D jbig2_alloc(ctx->allocator, stats_size);
       memset(GB_stats, 0, stats_size);
=20

Modified: trunk/jbig2_generic.h
=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_generic.h	2005-07-28 00:59:59 UTC (rev 421)
+++ trunk/jbig2_generic.h	2005-08-04 07:03:05 UTC (rev 422)
@@ -32,7 +32,11 @@
   int8_t gbat[8];
 } Jbig2GenericRegionParams;
=20
+/* return the appropriate context size for the given template */
 int
+jbig2_generic_stats_size(Jbig2Ctx *ctx, int template);
+
+int
 jbig2_decode_generic_region(Jbig2Ctx *ctx,
 			    Jbig2Segment *segment,
 			    const Jbig2GenericRegionParams *params,

Modified: trunk/jbig2_text.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_text.c	2005-07-28 00:59:59 UTC (rev 421)
+++ trunk/jbig2_text.c	2005-08-04 07:03:05 UTC (rev 422)
@@ -341,7 +341,7 @@
 }
=20
 /**
- * jbig2_read_text_info: read a text region segment header
+ * jbig2_parse_text_region: read a text region segment header
  **/
 int
 jbig2_parse_text_region(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte=
 *segment_data)