jbig.h | jbig.h | |||
---|---|---|---|---|
/* | /* | |||
* Header file for the portable free JBIG compression library | * Header file for the portable free JBIG compression library | |||
* | * | |||
* Markus Kuhn -- http://www.cl.cam.ac.uk/~mgk25/ | * Markus Kuhn -- http://www.cl.cam.ac.uk/~mgk25/ | |||
* | * | |||
* $Id: jbig.h,v 1.14 2003-06-11 17:57:02+01 mgk25 Exp $ | * $Id: jbig.h,v 1.17 2004-06-11 15:18:21+01 mgk25 Exp $ | |||
*/ | */ | |||
#ifndef JBG_H | #ifndef JBG_H | |||
#define JBG_H | #define JBG_H | |||
#include <stddef.h> | #include <stddef.h> | |||
/* | /* | |||
* JBIG-KIT version number | * JBIG-KIT version number | |||
*/ | */ | |||
#define JBG_VERSION "1.5" | #define JBG_VERSION "1.6" | |||
/* | /* | |||
* Buffer block for SDEs which are temporarily stored by encoder | * Buffer block for SDEs which are temporarily stored by encoder | |||
*/ | */ | |||
#define JBG_BUFSIZE 4000 | #define JBG_BUFSIZE 4000 | |||
struct jbg_buf { | struct jbg_buf { | |||
unsigned char d[JBG_BUFSIZE]; /* one block of a buffer list */ | unsigned char d[JBG_BUFSIZE]; /* one block of a buffer list */ | |||
int len; /* length of the data in this block */ | int len; /* length of the data in this block */ | |||
skipping to change at line 106 | skipping to change at line 106 | |||
int ct; /* bit shift counter, determines when next byte will be written */ | int ct; /* bit shift counter, determines when next byte will be written */ | |||
int buffer; /* buffer for most recent output byte != 0xff */ | int buffer; /* buffer for most recent output byte != 0xff */ | |||
void (*byte_out)(int, void *); /* function which receives all PSCD bytes */ | void (*byte_out)(int, void *); /* function which receives all PSCD bytes */ | |||
void *file; /* parameter passed to byte_out */ | void *file; /* parameter passed to byte_out */ | |||
}; | }; | |||
/* | /* | |||
* Status description of an arithmetic decoder | * Status description of an arithmetic decoder | |||
*/ | */ | |||
enum jbg_ardec_result { | ||||
JBG_OK, /* symbol has been successfully decoded | ||||
*/ | ||||
JBG_READY, /* no more bytes of this PSCD required, marker | ||||
* | ||||
* encountered, probably more symbols available * | ||||
/ | ||||
JBG_MORE, /* more PSCD data bytes required to decode a symbol | ||||
*/ | ||||
JBG_MARKER /* more PSCD data bytes required, ignored final 0xff byte | ||||
*/ | ||||
}; | ||||
struct jbg_ardec_state { | struct jbg_ardec_state { | |||
unsigned char st[4096]; /* probability status for contexts, MSB = MPS */ | unsigned char st[4096]; /* probability status for contexts, MSB = MPS */ | |||
unsigned long c; /* C register, base of coding intervall, * | unsigned long c; /* C register, base of coding intervall, * | |||
* layout as in Table 25 */ | * layout as in Table 25 */ | |||
unsigned long a; /* A register, normalized size of coding intervall */ | unsigned long a; /* A register, normalized size of coding intervall */ | |||
int ct; /* bit shift counter, determines when next byte will be read */ | int ct; /* bit shift counter, determines when next byte will be read */ | |||
unsigned char *pscd_ptr; /* pointer to next PSCD data byte */ | unsigned char *pscd_ptr; /* pointer to next PSCD data byte */ | |||
unsigned char *pscd_end; /* pointer to byte after PSCD */ | unsigned char *pscd_end; /* pointer to byte after PSCD */ | |||
enum { | enum jbg_ardec_result result; /* result of previous decode call | |||
JBG_OK, /* symbol has been successfully decoded | */ | |||
*/ | ||||
JBG_READY, /* no more bytes of this PSCD required, marker | ||||
* | ||||
* encountered, probably more symbols available * | ||||
/ | ||||
JBG_MORE, /* more PSCD data bytes required to decode a symbol | ||||
*/ | ||||
JBG_MARKER /* more PSCD data bytes required, ignored final 0xff byte | ||||
*/ | ||||
} result; /* result of previous decode call | ||||
*/ | ||||
int startup; /* controls initial fill of s->c */ | int startup; /* controls initial fill of s->c */ | |||
}; | }; | |||
#ifdef TEST_CODEC | #ifdef TEST_CODEC | |||
void arith_encode_init(struct jbg_arenc_state *s, int reuse_st); | void arith_encode_init(struct jbg_arenc_state *s, int reuse_st); | |||
void arith_encode_flush(struct jbg_arenc_state *s); | void arith_encode_flush(struct jbg_arenc_state *s); | |||
void arith_encode(struct jbg_arenc_state *s, int cx, int pix); | void arith_encode(struct jbg_arenc_state *s, int cx, int pix); | |||
void arith_decode_init(struct jbg_ardec_state *s, int reuse_st); | void arith_decode_init(struct jbg_ardec_state *s, int reuse_st); | |||
int arith_decode(struct jbg_ardec_state *s, int cx); | int arith_decode(struct jbg_ardec_state *s, int cx); | |||
#endif | #endif | |||
skipping to change at line 235 | skipping to change at line 237 | |||
void jbg_enc_init(struct jbg_enc_state *s, unsigned long x, unsigned long y , | void jbg_enc_init(struct jbg_enc_state *s, unsigned long x, unsigned long y , | |||
int planes, unsigned char **p, | int planes, unsigned char **p, | |||
void (*data_out)(unsigned char *start, size_t len, | void (*data_out)(unsigned char *start, size_t len, | |||
void *file), | void *file), | |||
void *file); | void *file); | |||
int jbg_enc_lrlmax(struct jbg_enc_state *s, unsigned long mwidth, | int jbg_enc_lrlmax(struct jbg_enc_state *s, unsigned long mwidth, | |||
unsigned long mheight); | unsigned long mheight); | |||
void jbg_enc_layers(struct jbg_enc_state *s, int d); | void jbg_enc_layers(struct jbg_enc_state *s, int d); | |||
int jbg_enc_lrange(struct jbg_enc_state *s, int dl, int dh); | int jbg_enc_lrange(struct jbg_enc_state *s, int dl, int dh); | |||
void jbg_enc_options(struct jbg_enc_state *s, int order, int options, | void jbg_enc_options(struct jbg_enc_state *s, int order, int options, | |||
long l0, int mx, int my); | unsigned long l0, int mx, int my); | |||
void jbg_enc_out(struct jbg_enc_state *s); | void jbg_enc_out(struct jbg_enc_state *s); | |||
void jbg_enc_free(struct jbg_enc_state *s); | void jbg_enc_free(struct jbg_enc_state *s); | |||
void jbg_dec_init(struct jbg_dec_state *s); | void jbg_dec_init(struct jbg_dec_state *s); | |||
void jbg_dec_maxsize(struct jbg_dec_state *s, unsigned long xmax, | void jbg_dec_maxsize(struct jbg_dec_state *s, unsigned long xmax, | |||
unsigned long ymax); | unsigned long ymax); | |||
int jbg_dec_in(struct jbg_dec_state *s, unsigned char *data, size_t len, | int jbg_dec_in(struct jbg_dec_state *s, unsigned char *data, size_t len, | |||
size_t *cnt); | size_t *cnt); | |||
long jbg_dec_getwidth(const struct jbg_dec_state *s); | long jbg_dec_getwidth(const struct jbg_dec_state *s); | |||
long jbg_dec_getheight(const struct jbg_dec_state *s); | long jbg_dec_getheight(const struct jbg_dec_state *s); | |||
End of changes. 5 change blocks. | ||||
16 lines changed or deleted | 18 lines changed or added | |||