ref: 9d9c7e26944b07cda1c81242b66aea7bbdfc1150
parent: dcb83f94c6dc0280a8edeb4dc303fc1451bcd881
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Wed Jul 27 19:55:54 EDT 2005
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. git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@420 ded80894-8fb9-0310-811b-c03f3676ab4d
--- a/jbig2_priv.h
+++ b/jbig2_priv.h
@@ -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
--- a/jbig2_refinement.c
+++ b/jbig2_refinement.c
@@ -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);
}
}
--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -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 */
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -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);
}