From bb4ba2586d4cfe9302278a427ee4cf7a89aef53b Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 8 Oct 2023 17:45:23 +0000 Subject: cleanup git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4736 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- converter/other/jbig/libjbig/jbig.c | 42 +++++++++++++++++++++++++++++++++- converter/other/jbig/libjbig/jbig_ar.c | 8 +++++++ 2 files changed, 49 insertions(+), 1 deletion(-) (limited to 'converter/other/jbig/libjbig') diff --git a/converter/other/jbig/libjbig/jbig.c b/converter/other/jbig/libjbig/jbig.c index 42932ca7..fcb39f5c 100644 --- a/converter/other/jbig/libjbig/jbig.c +++ b/converter/other/jbig/libjbig/jbig.c @@ -150,6 +150,7 @@ static void *checked_malloc(size_t nmemb, size_t size) } + static void *checked_realloc(void *ptr, size_t nmemb, size_t size) { void *p; @@ -176,6 +177,7 @@ static void *checked_realloc(void *ptr, size_t nmemb, size_t size) } + static void checked_free(void *ptr) { free(ptr); @@ -188,7 +190,6 @@ static void checked_free(void *ptr) - /* * Memory management for buffers which are used for temporarily * storing SDEs by the encoder. @@ -229,6 +230,7 @@ static struct jbg_buf *jbg_buf_init(struct jbg_buf **free_list) } + /* * Return an entire free_list to the memory management of stdlib. * This is only done by jbg_enc_free(). @@ -247,6 +249,7 @@ static void jbg_buf_free(struct jbg_buf **free_list) } + /* * Append a single byte to a single list that starts with the block * *(struct jbg_buf *) head. The type of *head is void here in order to @@ -272,6 +275,7 @@ static void jbg_buf_write(int b, void *head) } + /* * Remove any trailing zero bytes from the end of a linked jbg_buf list, * however make sure that no zero byte is removed which directly @@ -311,6 +315,7 @@ static void jbg_buf_remove_zeros(struct jbg_buf *head) } + /* * The jbg_buf list which starts with block *new_prefix is concatenated * with the list which starts with block **start and *start will then point @@ -327,6 +332,7 @@ static void jbg_buf_prefix(struct jbg_buf *new_prefix, struct jbg_buf **start) } + /* * Send the contents of a jbg_buf list that starts with block **head to * the call back function data_out and return the blocks of the jbg_buf @@ -352,6 +358,7 @@ static void jbg_buf_output(struct jbg_buf **head, } + /* * Calculate y = ceil(x/2) applied n times, which is equivalent to * y = ceil(x/(2^n)). This function is used to @@ -369,6 +376,7 @@ unsigned long jbg_ceil_half(unsigned long x, int n) } + /* * Set L0 (the number of lines in a stripe at lowest resolution) * to a default value, such that there are about 35 stripes, as @@ -384,6 +392,7 @@ static void jbg_set_default_l0(struct jbg_enc_state *s) } + /* * Calculate the number of stripes, as defined in clause 6.2.3 of T.82. */ @@ -396,6 +405,7 @@ static unsigned long jbg_stripes(unsigned long l0, unsigned long yd, } + /* * Resolution reduction table given by ITU-T T.82 Table 17 */ @@ -818,6 +828,7 @@ void jbg_enc_init(struct jbg_enc_state *s, unsigned long x, unsigned long y, } + /* * This function selects the number of differential layers based on * the maximum size requested for the lowest resolution layer. If @@ -843,6 +854,7 @@ int jbg_enc_lrlmax(struct jbg_enc_state *s, unsigned long x, } + /* * As an alternative to jbg_enc_lrlmax(), the following function allows the * user to specify the number of layers directly. The stripe height and layer @@ -860,6 +872,7 @@ void jbg_enc_layers(struct jbg_enc_state *s, int d) } + /* * Specify the highest and lowest resolution layers which will be * written to the output file. Call this function not before @@ -876,6 +889,7 @@ int jbg_enc_lrange(struct jbg_enc_state *s, int dl, int dh) } + /* * The following function allows the user to specify the bits describing the * options of the format as well as the maximum AT movement window and the @@ -894,6 +908,7 @@ void jbg_enc_options(struct jbg_enc_state *s, int order, int options, } + /* * This function actually does all the tricky work involved in producing * a SDE, which is stored in the appropriate s->sde[][][] element @@ -1507,6 +1522,7 @@ static void encode_sde(struct jbg_enc_state *s, } + /* * Create the next lower resolution version of an image */ @@ -1619,6 +1635,7 @@ static void resolution_reduction(struct jbg_enc_state *s, int plane, } + /* * This function is called inside the three loops of jbg_enc_out() in * order to write the next SDE. It has first to generate the required @@ -1697,6 +1714,7 @@ static void output_sde(struct jbg_enc_state *s, } + /* * Convert the table which controls the deterministic prediction * process from the internal format into the representation required @@ -1748,6 +1766,7 @@ void jbg_int2dppriv(unsigned char *dptable, const char *internal) } + /* * Convert the table which controls the deterministic prediction * process from the 1728 byte long DPTABLE format into the 6912 byte long @@ -1779,6 +1798,7 @@ void jbg_dppriv2int(char *internal, const unsigned char *dptable) } + /* * Encode one full BIE and pass the generated data to the specified * call-back function @@ -1973,6 +1993,7 @@ void jbg_enc_out(struct jbg_enc_state *s) } + void jbg_enc_free(struct jbg_enc_state *s) { unsigned long stripe; @@ -2023,6 +2044,7 @@ void jbg_enc_free(struct jbg_enc_state *s) } + /* * Convert the error codes used by jbg_dec_in() into an English ASCII string */ @@ -2036,6 +2058,7 @@ const char *jbg_strerror(int errnum) } + /* * The constructor for a decoder */ @@ -2055,6 +2078,7 @@ void jbg_dec_init(struct jbg_dec_state *s) } + /* * Specify a maximum image size for the decoder. If the JBIG file has * the order bit ILEAVE, but not the bit SEQ set, then the decoder @@ -2072,6 +2096,7 @@ void jbg_dec_maxsize(struct jbg_dec_state *s, unsigned long xmax, } + /* * Decode the new len PSDC bytes to which data points and add them to * the current stripe. Return the number of bytes which have actually @@ -2528,6 +2553,7 @@ static size_t decode_pscd(struct jbg_dec_state *s, unsigned char *data, } + /* * Provide to the decoder a new BIE fragment of len bytes starting at data. * @@ -2893,6 +2919,7 @@ int jbg_dec_in(struct jbg_dec_state *s, unsigned char *data, size_t len, } + /* * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call this * function in order to find out the width of the image. Returns 0 if @@ -2913,6 +2940,7 @@ unsigned long jbg_dec_getwidth(const struct jbg_dec_state *s) } + /* * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call this * function in order to find out the height of the image. Returns 0 if @@ -2933,6 +2961,7 @@ unsigned long jbg_dec_getheight(const struct jbg_dec_state *s) } + /* * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call this * function in order to get a pointer to the image. Returns NULL if @@ -2953,6 +2982,7 @@ unsigned char *jbg_dec_getimage(const struct jbg_dec_state *s, int plane) } + /* * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call * this function in order to find out the size in bytes of one @@ -2975,6 +3005,7 @@ unsigned long jbg_dec_getsize(const struct jbg_dec_state *s) } + /* * After jbg_dec_in() returned JBG_EOK or JBG_EOK_INTR, you can call * this function in order to find out the size of the image that you @@ -2998,6 +3029,7 @@ unsigned long jbg_dec_getsize_merged(const struct jbg_dec_state *s) } + /* * The destructor function which releases any resources obtained by the * other decoder functions. @@ -3036,6 +3068,7 @@ void jbg_dec_free(struct jbg_dec_state *s) } + /* * Split bigendian integer pixel field into separate bit planes. In the * src array, every pixel is represented by a ((has_planes + 7) / 8) byte @@ -3100,6 +3133,8 @@ void jbg_split_planes(unsigned long x, unsigned long y, int has_planes, return; } + + /* * Merge the separate bit planes decoded by the JBIG decoder into an * integer pixel field. This is essentially the counterpart to @@ -3163,6 +3198,7 @@ void jbg_dec_merge_planes(const struct jbg_dec_state *s, int use_graycode, } + /* * Given a pointer p to the first byte of either a marker segment or a * PSCD, as well as the length len of the remaining data, return @@ -3232,6 +3268,7 @@ static unsigned char *jbg_next_pscdms(unsigned char *p, size_t len) } + /* * Scan a complete BIE for a NEWLEN marker segment, then read the new * YD value found in it and use it to overwrite the one in the BIE @@ -3281,3 +3318,6 @@ int jbg_newlen(unsigned char *bie, size_t len) } return JBG_EINVAL | 0; } + + + diff --git a/converter/other/jbig/libjbig/jbig_ar.c b/converter/other/jbig/libjbig/jbig_ar.c index 194e13eb..aad293f2 100644 --- a/converter/other/jbig/libjbig/jbig_ar.c +++ b/converter/other/jbig/libjbig/jbig_ar.c @@ -119,6 +119,7 @@ void arith_encode_init(struct jbg_arenc_state *s, int reuse_st) } + void arith_encode_flush(struct jbg_arenc_state *s) { unsigned long temp; @@ -167,6 +168,7 @@ void arith_encode_flush(struct jbg_arenc_state *s) } + void arith_encode(struct jbg_arenc_state *s, int cx, int pix) { register unsigned lsz, ss; @@ -259,6 +261,7 @@ 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 i; @@ -273,6 +276,8 @@ void arith_decode_init(struct jbg_ardec_state *s, int reuse_st) return; } + + /* * Decode and return one symbol from the provided PSCD byte stream * that starts in s->pscd_ptr and ends in the byte before s->pscd_end. @@ -415,3 +420,6 @@ int arith_decode(struct jbg_ardec_state *s, int cx) return pix; } + + + -- cgit 1.4.1