jbig.h   jbig.h 
/* /*
* Header file for the portable free JBIG compression library * Header file for the portable JBIG compression library
* *
* Markus Kuhn -- http://www.cl.cam.ac.uk/~mgk25/ * Copyright 1995-2008 -- Markus Kuhn -- http://www.cl.cam.ac.uk/~mgk25/
* *
* $Id: jbig.h,v 1.17 2004-06-11 15:18:21+01 mgk25 Exp $ * $Id: jbig.h 1303 2008-08-30 20:16:20Z mgk25 $
*/ */
#ifndef JBG_H #ifndef JBG_H
#define JBG_H #define JBG_H
#include <stddef.h> #include <stddef.h>
#include "jbig_ar.h"
/* /*
* JBIG-KIT version number * JBIG-KIT version number
*/ */
#define JBG_VERSION "1.6" #define JBG_VERSION "2.0"
/*
* JBIG-KIT licence agreement reference code:
* If you use JBIG-KIT under a commercial licence, please replace
* below the letters GPL with the reference code that you received
* with your licence agreement. (This code is typically a letter "A"
* followed by four decimal digits, e.g. "A1234".)
*/
#define JBG_LICENCE "GPL"
/* /*
* 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 59 skipping to change at line 70
#define JBG_SMID 0x01 #define JBG_SMID 0x01
#define JBG_LRLTWO 0x40 #define JBG_LRLTWO 0x40
#define JBG_VLENGTH 0x20 #define JBG_VLENGTH 0x20
#define JBG_TPDON 0x10 #define JBG_TPDON 0x10
#define JBG_TPBON 0x08 #define JBG_TPBON 0x08
#define JBG_DPON 0x04 #define JBG_DPON 0x04
#define JBG_DPPRIV 0x02 #define JBG_DPPRIV 0x02
#define JBG_DPLAST 0x01 #define JBG_DPLAST 0x01
#define JBG_DELAY_AT 0x100 /* delay ATMOVE until the first line of the n /* encoding options that will not be indicated in the header */
ext
* stripe. Option available for compatibility
* with conformance test example in clause 7.2
.*/
/*
* Possible error code return values
*/
#define JBG_EOK 0 #define JBG_DELAY_AT 0x100 /* Delay ATMOVE until the first line of the n
#define JBG_EOK_INTR 1 ext
#define JBG_EAGAIN 2 * stripe. Option available for compatibility
#define JBG_ENOMEM 3 * with conformance test example in clause 7.2
#define JBG_EABORT 4 . */
#define JBG_EMARKER 5
#define JBG_ENOCONT 6
#define JBG_EINVAL 7
#define JBG_EIMPL 8
/*
* Language code for error message strings (based on ISO 639 2-letter
* standard language name abbreviations).
*/
#define JBG_EN 0 /* English */
#define JBG_DE_8859_1 1 /* German in ISO Latin 1 character set */
#define JBG_DE_UTF_8 2 /* German in Unicode UTF-8 encoding */
/*
* Status description of an arithmetic encoder
*/
struct jbg_arenc_state { #define JBG_SDRST 0x200 /* Use SDRST instead of SDNORM. This option i
unsigned char st[4096]; /* probability status for contexts, MSB = MPS s
*/ * there for anyone who needs to generate
unsigned long c; /* C register, base of coding intervall, * test data that covers the SDRST cases. */
*
* layout as in Table 23
*/
unsigned long a; /* A register, normalized size of coding intervall
*/
long sc; /* counter for buffered 0xff values which might overflow
*/
int ct; /* bit shift counter, determines when next byte will be written
*/
int buffer; /* buffer for most recent output byte != 0xff
*/
void (*byte_out)(int, void *); /* function which receives all PSCD bytes
*/
void *file; /* parameter passed to byte_out
*/
};
/* /*
* Status description of an arithmetic decoder * Possible error code return values
*/ */
enum jbg_ardec_result { #define JBG_EOK (0 << 4)
JBG_OK, /* symbol has been successfully decoded #define JBG_EOK_INTR (1 << 4)
*/ #define JBG_EAGAIN (2 << 4)
JBG_READY, /* no more bytes of this PSCD required, marker #define JBG_ENOMEM (3 << 4)
* #define JBG_EABORT (4 << 4)
* encountered, probably more symbols available * #define JBG_EMARKER (5 << 4)
/ #define JBG_EINVAL (6 << 4)
JBG_MORE, /* more PSCD data bytes required to decode a symbol #define JBG_EIMPL (7 << 4)
*/ #define JBG_ENOCONT (8 << 4)
JBG_MARKER /* more PSCD data bytes required, ignored final 0xff byte
*/
};
struct jbg_ardec_state {
unsigned char st[4096]; /* probability status for contexts, MSB = MPS
*/
unsigned long c; /* C register, base of coding intervall,
*
* layout as in Table 25
*/
unsigned long a; /* A register, normalized size of coding intervall
*/
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_end; /* pointer to byte after PSCD
*/
enum jbg_ardec_result result; /* result of previous decode call
*/
int startup; /* controls initial fill of s->c
*/
};
#ifdef TEST_CODEC
void arith_encode_init(struct jbg_arenc_state *s, int reuse_st);
void arith_encode_flush(struct jbg_arenc_state *s);
void arith_encode(struct jbg_arenc_state *s, int cx, int pix);
void arith_decode_init(struct jbg_ardec_state *s, int reuse_st);
int arith_decode(struct jbg_ardec_state *s, int cx);
#endif
/* /*
* Status of a JBIG encoder * Status of a JBIG encoder
*/ */
struct jbg_enc_state { struct jbg_enc_state {
int d; /* resolution layer of the input image */ int d; /* resolution layer of the input image */
unsigned long xd, yd; /* size of the input image (resolution layer d) */ unsigned long xd, yd; /* size of the input image (resolution layer d) */
unsigned long yd1; /* BIH announced height of image, use yd1 != yd to unsigned long yd1; /* BIH announced height of image, use yd1 != yd to
emulate T.85-style NEWLEN height updates for tests */ emulate T.85-style NEWLEN height updates for tests */
skipping to change at line 165 skipping to change at line 125
char *dppriv; /* optional private deterministic prediction table */ char *dppriv; /* optional private deterministic prediction table */
char *res_tab; /* table for the resolution reduction algorithm */ char *res_tab; /* table for the resolution reduction algorithm */
struct jbg_buf ****sde; /* array [stripe][layer][plane] pointers to * struct jbg_buf ****sde; /* array [stripe][layer][plane] pointers to *
* buffers for stored SDEs * / * buffers for stored SDEs * /
struct jbg_arenc_state *s; /* array [planes] for arithm. encoder status */ struct jbg_arenc_state *s; /* array [planes] for arithm. encoder status */
struct jbg_buf *free_list; /* list of currently unused SDE block buffers */ struct jbg_buf *free_list; /* list of currently unused SDE block buffers */
void (*data_out)(unsigned char *start, size_t len, void *file); void (*data_out)(unsigned char *start, size_t len, void *file);
/* data write callback */ /* data write callback */
void *file; /* parameter passed to data_out() */ void *file; /* parameter passed to data_out() */
char *tp; /* buffer for temp. values used by diff. typical prediction */ char *tp; /* buffer for temp. values used by diff. typical prediction */
unsigned char *comment; /* content of comment marker segment to be added
at next opportunity (will be reset to NULL
as soon as comment has been written)
*/
unsigned long comment_len; /* length of data pointed to by comment
*/
}; };
/* /*
* Status of a JBIG decoder * Status of a JBIG decoder
*/ */
struct jbg_dec_state { struct jbg_dec_state {
/* data from BIH */ /* data from BIH */
int d; /* resolution layer of the full image */ int d; /* resolution layer of the full image */
int dl; /* first resolution layer in this BIE */ int dl; /* first resolution layer in this BIE */
skipping to change at line 246 skipping to change at line 210
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,
unsigned 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); unsigned long jbg_dec_getwidth(const struct jbg_dec_state *s);
long jbg_dec_getheight(const struct jbg_dec_state *s); unsigned long jbg_dec_getheight(const struct jbg_dec_state *s);
unsigned char *jbg_dec_getimage(const struct jbg_dec_state *s, int plane); unsigned char *jbg_dec_getimage(const struct jbg_dec_state *s, int plane);
long jbg_dec_getsize(const struct jbg_dec_state *s); unsigned long jbg_dec_getsize(const struct jbg_dec_state *s);
void jbg_dec_merge_planes(const struct jbg_dec_state *s, int use_graycode, void jbg_dec_merge_planes(const struct jbg_dec_state *s, int use_graycode,
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);
long jbg_dec_getsize_merged(const struct jbg_dec_state *s); unsigned long jbg_dec_getsize_merged(const struct jbg_dec_state *s);
void jbg_dec_free(struct jbg_dec_state *s); void jbg_dec_free(struct jbg_dec_state *s);
const char *jbg_strerror(int errnum, int language); const char *jbg_strerror(int errnum);
void jbg_int2dppriv(unsigned char *dptable, const char *internal); void jbg_int2dppriv(unsigned char *dptable, const char *internal);
void jbg_dppriv2int(char *internal, const unsigned char *dptable); void jbg_dppriv2int(char *internal, const unsigned char *dptable);
unsigned long jbg_ceil_half(unsigned long x, int n); unsigned long jbg_ceil_half(unsigned long x, int n);
void jbg_split_planes(unsigned long x, unsigned long y, int has_planes, void jbg_split_planes(unsigned long x, unsigned long y, int has_planes,
int encode_planes, int encode_planes,
const unsigned char *src, unsigned char **dest, const unsigned char *src, unsigned char **dest,
int use_graycode); int use_graycode);
int jbg_newlen(unsigned char *bie, size_t len); int jbg_newlen(unsigned char *bie, size_t len);
#endif /* JBG_H */ #endif /* JBG_H */
 End of changes. 15 change blocks. 
102 lines changed or deleted 46 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/