[jbig2-cvs] rev 420 - trunk

giles at ghostscript.com giles at ghostscript.com
Wed Jul 27 16:55:54 PDT 2005


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
===================================================================
--- 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 @@
 };
 
 int jbig2_parse_page_info (Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_data);
+int jbig2_parse_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const 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);
 
@@ -128,7 +129,8 @@
     JBIG2_COMPOSE_OR = 0,
     JBIG2_COMPOSE_AND = 1,
     JBIG2_COMPOSE_XOR = 2,
-    JBIG2_COMPOSE_XNOR = 3
+    JBIG2_COMPOSE_XNOR = 3,
+    JBIG2_COMPOSE_REPLACE = 4
 } Jbig2ComposeOp;
 
 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;
 
@@ -150,7 +153,9 @@
 /* 7.4 */
 int jbig2_immediate_generic_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
 			       const uint8_t *segment_data);
-                               
+int jbig2_refinement_region(Jbig2Ctx *ctx, Jbig2Segment *segment,
+                               const byte *segment_data);
+          
 /* 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
===================================================================
--- 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
===================================================================
--- 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 = jbig2_get_int32(segment_data + 8);
   info->y = jbig2_get_int32(segment_data + 12);
   info->flags = segment_data[16];
+  info->op = info->flags & 0x7;
 }
 
 /* dispatch code for extension segment parsing */

Modified: trunk/jbig2_text.c
===================================================================
--- 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 = flags & 0x0200;
     params.SBDSOFFSET = (flags & 0x7C00) >> 10;
     params.SBRTEMPLATE = flags & 0x8000;
-    
+
     if (params.SBHUFF)	/* Huffman coding */
       {
         /* 7.4.3.1.2 */
@@ -626,12 +626,11 @@
         segment->result = image;
     } else {
         /* otherwise composite onto the page */
-	Jbig2Image *page_image = ctx->pages[ctx->current_page].image;
         jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, 
             "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);
     }
     



More information about the jbig2-cvs mailing list