rev 420 - trunk

[email protected] Wed, 27 Jul 2005 16:55:54 -0700 (PDT)
Newsgroups gmane.comp.printing.ghostscript.jbig2dec.cvs
Message-ID <[email protected]>
Author: giles
Date: 2005-07-27 16:55:54 -0700 (Wed, 27 Jul 2005)
New Revision: 420

Modified:
   trunk/jbig2_priv.h
   trunk/jbig2_refinement.c
   trunk/jbig2_segment.c
   trunk/jbig2_text.c
Log:
Some code cleanup. Remember the external combination op for region
segments and use it. Also add the missing REPLACE operator to the
enum (but not yet implemented in the compositor). Only some routines
can use this one. Also add some missing prototypes.


Modified: trunk/jbig2_priv.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_priv.h	2005-07-27 23:49:03 UTC (rev 419)
+++ trunk/jbig2_priv.h	2005-07-27 23:55:54 UTC (rev 420)
@@ -121,6 +121,7 @@
 };
=20
 int jbig2_parse_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const u=
int8_t *segment_data);
+int jbig2_parse_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, cons=
t uint8_t *segment_data);
 int jbig2_parse_end_of_page(Jbig2Ctx *ctx, Jbig2Segment *segment, const =
uint8_t *segment_data);
 int jbig2_parse_extension_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, =
const uint8_t *segment_data);
=20
@@ -128,7 +129,8 @@
     JBIG2_COMPOSE_OR =3D 0,
     JBIG2_COMPOSE_AND =3D 1,
     JBIG2_COMPOSE_XOR =3D 2,
-    JBIG2_COMPOSE_XNOR =3D 3
+    JBIG2_COMPOSE_XNOR =3D 3,
+    JBIG2_COMPOSE_REPLACE =3D 4
 } Jbig2ComposeOp;
=20
 int jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src,=
 int x, int y, Jbig2ComposeOp op);
@@ -141,6 +143,7 @@
   int32_t height;
   int32_t x;
   int32_t y;
+  Jbig2ComposeOp op;
   uint8_t flags;
 } Jbig2RegionSegmentInfo;
=20
@@ -150,7 +153,9 @@
 /* 7.4 */
 int jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
 			       const uint8_t *segment_data);
-                              =20
+int jbig2_refinement_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
+                               const byte *segment_data);
+         =20
 /* The word stream design is a compromise between simplicity and
    trying to amortize the number of method calls. Each ::get_next_word
    invocation pulls 4 bytes from the stream, packed big-endian into a

Modified: trunk/jbig2_refinement.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_refinement.c	2005-07-27 23:49:03 UTC (rev 419)
+++ trunk/jbig2_refinement.c	2005-07-27 23:55:54 UTC (rev 420)
@@ -436,7 +436,7 @@
             "composing %dx%d decoded refinement region onto page at (%d,=
 %d)",
             rsi.width, rsi.height, rsi.x, rsi.y);
 	jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page],
-          image, rsi.x, rsi.y, JBIG2_COMPOSE_OR);
+          image, rsi.x, rsi.y, rsi.op);
         jbig2_image_release(ctx, image);
     }
   }

Modified: trunk/jbig2_segment.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_segment.c	2005-07-27 23:49:03 UTC (rev 419)
+++ trunk/jbig2_segment.c	2005-07-27 23:55:54 UTC (rev 420)
@@ -186,6 +186,7 @@
   info->x =3D jbig2_get_int32(segment_data + 8);
   info->y =3D jbig2_get_int32(segment_data + 12);
   info->flags =3D segment_data[16];
+  info->op =3D info->flags & 0x7;
 }
=20
 /* dispatch code for extension segment parsing */

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-27 23:49:03 UTC (rev 419)
+++ trunk/jbig2_text.c	2005-07-27 23:55:54 UTC (rev 420)
@@ -376,7 +376,7 @@
     params.SBDEFPIXEL =3D flags & 0x0200;
     params.SBDSOFFSET =3D (flags & 0x7C00) >> 10;
     params.SBRTEMPLATE =3D flags & 0x8000;
-   =20
+
     if (params.SBHUFF)	/* Huffman coding */
       {
         /* 7.4.3.1.2 */
@@ -626,12 +626,11 @@
         segment->result =3D image;
     } else {
         /* otherwise composite onto the page */
-	Jbig2Image *page_image =3D ctx->pages[ctx->current_page].image;
         jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,=20
             "composing %dx%d decoded text region onto page at (%d, %d)",
             region_info.width, region_info.height, region_info.x, region=
_info.y);
 	jbig2_page_add_result(ctx, &ctx->pages[ctx->current_page], image,
-			      region_info.x, region_info.y, JBIG2_COMPOSE_OR);
+			      region_info.x, region_info.y, region_info.op);
         jbig2_image_release(ctx, image);
     }
    =20