jbig2dec
Ralph Giles <[email protected]> Thu, 04 Jul 2002 09:33:47 -0700
| Newsgroups | gmane.comp.printing.ghostscript.jbig2dec.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/jbig2dec/jbig2dec
In directory usw-pr-cvs1:/tmp/cvs-serv3258
Modified Files:
jbig2.c jbig2.h jbig2_page.c jbig2_segment.c jbig2dec.c
Log Message:
API renames. Main loop is now jbig_data_in(data); image=jbig2_page_out();
Index: jbig2.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- jbig2.c 4 Jul 2002 13:34:29 -0000 1.11
+++ jbig2.c 4 Jul 2002 16:33:44 -0000 1.12
@@ -66,7 +66,7 @@
}
int
-jbig2_error (Jbig2Ctx *ctx, Jbig2Severity severity, int seg_idx,
+jbig2_error (Jbig2Ctx *ctx, Jbig2Severity severity, int segment_number,
const char *fmt, ...)
{
char buf[1024];
@@ -79,7 +79,7 @@
va_end (ap);
if (n < 0 || n == sizeof(buf))
strcpy (buf, "jbig2_error: error in generating error string");
- code = ctx->error_callback (ctx->error_callback_data, buf, severity, seg_idx);
+ code = ctx->error_callback (ctx->error_callback_data, buf, severity, segment_number);
if (severity == JBIG2_SEVERITY_FATAL)
code = -1;
return code;
@@ -144,7 +144,7 @@
/**
- * jbig2_write: submit data for decoding
+ * jbig2_data_in: submit data for decoding
* @ctx: The jbig2dec decoder context
* @data: a pointer to the data buffer
* @size: the size of the data buffer in bytes
@@ -155,7 +155,7 @@
* Return code: 0 on success
**/
int
-jbig2_write (Jbig2Ctx *ctx, const unsigned char *data, size_t size)
+jbig2_data_in (Jbig2Ctx *ctx, const unsigned char *data, size_t size)
{
const size_t initial_buf_size = 1024;
@@ -274,7 +274,7 @@
segment = ctx->segments[ctx->segment_index];
if (segment->data_length > ctx->buf_wr_ix - ctx->buf_rd_ix)
return 0;
- code = jbig2_write_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix);
+ code = jbig2_parse_segment(ctx, segment, ctx->buf + ctx->buf_rd_ix);
ctx->buf_rd_ix += segment->data_length;
// jbig2_free_segment(ctx, segment);
// ctx->segments[ctx->segment_index] = NULL;
Index: jbig2.h
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- jbig2.h 3 Jul 2002 19:43:21 -0000 1.11
+++ jbig2.h 4 Jul 2002 16:33:44 -0000 1.12
@@ -81,12 +81,12 @@
void jbig2_global_ctx_free (Jbig2GlobalCtx *global_ctx);
/* submit data to the decoder */
-int jbig2_write (Jbig2Ctx *ctx, const unsigned char *data, size_t size);
+int jbig2_data_in (Jbig2Ctx *ctx, const unsigned char *data, size_t size);
/* get the next available decoded page image */
-Jbig2Image *jbig2_get_page(Jbig2Ctx *ctx);
+Jbig2Image *jbig2_page_out (Jbig2Ctx *ctx);
/* mark a returned page image as read */
-int jbig2_release_page(Jbig2Ctx *ctx, Jbig2Image *image);
+int jbig2_release_page (Jbig2Ctx *ctx, Jbig2Image *image);
/* segment header routines */
@@ -94,15 +94,15 @@
uint32_t number;
uint8_t flags;
uint32_t page_association;
- int data_length;
+ size_t data_length;
int referred_to_segment_count;
- int32_t *referred_to_segments;
+ uint32_t *referred_to_segments;
void *result;
};
Jbig2Segment *jbig2_parse_segment_header (Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size,
size_t *p_header_size);
-int jbig2_write_segment (Jbig2Ctx *ctx, Jbig2Segment *segment,
+int jbig2_parse_segment (Jbig2Ctx *ctx, Jbig2Segment *segment,
const uint8_t *segment_data);
void jbig2_free_segment (Jbig2Ctx *ctx, Jbig2Segment *segment);
Index: jbig2_page.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2_page.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- jbig2_page.c 4 Jul 2002 13:34:29 -0000 1.7
+++ jbig2_page.c 4 Jul 2002 16:33:44 -0000 1.8
@@ -190,7 +190,7 @@
* return an image structure pointer, even though the function
* name refers to a page; the page structure is private.
**/
-Jbig2Image *jbig2_get_page(Jbig2Ctx *ctx)
+Jbig2Image *jbig2_page_out(Jbig2Ctx *ctx)
{
int index;
Index: jbig2_segment.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2_segment.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- jbig2_segment.c 4 Jul 2002 13:34:29 -0000 1.10
+++ jbig2_segment.c 4 Jul 2002 16:33:44 -0000 1.11
@@ -127,7 +127,7 @@
info->flags = segment_data[16];
}
-int jbig2_write_segment (Jbig2Ctx *ctx, Jbig2Segment *segment,
+int jbig2_parse_segment (Jbig2Ctx *ctx, Jbig2Segment *segment,
const uint8_t *segment_data)
{
jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number,
Index: jbig2dec.c
===================================================================
RCS file: /cvsroot/jbig2dec/jbig2dec/jbig2dec.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- jbig2dec.c 22 Jun 2002 10:08:43 -0000 1.25
+++ jbig2dec.c 4 Jul 2002 16:33:44 -0000 1.26
@@ -228,7 +228,7 @@
int n_bytes = fread(buf, 1, sizeof(buf), f);
if (n_bytes <= 0)
break;
- jbig2_write(ctx, buf, n_bytes);
+ jbig2_data_in(ctx, buf, n_bytes);
}
fclose(f);
@@ -243,7 +243,7 @@
int n_bytes = fread(buf, 1, sizeof(buf), f_page);
if (n_bytes <= 0)
break;
- jbig2_write(ctx, buf, n_bytes);
+ jbig2_data_in(ctx, buf, n_bytes);
}
fclose(f_page);
jbig2_global_ctx_free(global_ctx);
@@ -253,7 +253,7 @@
{
Jbig2Image *image;
- while ((image = jbig2_get_page(ctx)) != NULL) {
+ while ((image = jbig2_page_out(ctx)) != NULL) {
write_page_image(¶ms, image);
jbig2_release_page(ctx, image);
}