summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jbig2dec/jbig2.c1
-rw-r--r--jbig2dec/jbig2_generic.c3
-rw-r--r--jbig2dec/jbig2_halftone.c2
-rw-r--r--jbig2dec/jbig2_huffman.c2
-rw-r--r--jbig2dec/jbig2_image.c9
-rw-r--r--jbig2dec/jbig2_page.c5
-rw-r--r--jbig2dec/jbig2_refinement.c10
-rw-r--r--jbig2dec/jbig2_segment.c4
-rw-r--r--jbig2dec/jbig2_symbol_dict.c6
-rw-r--r--jbig2dec/jbig2_text.c1
-rw-r--r--jbig2dec/jbig2dec.c3
11 files changed, 10 insertions, 36 deletions
diff --git a/jbig2dec/jbig2.c b/jbig2dec/jbig2.c
index 518caca44..d58ad27eb 100644
--- a/jbig2dec/jbig2.c
+++ b/jbig2dec/jbig2.c
@@ -283,7 +283,6 @@ jbig2_data_in(Jbig2Ctx *ctx, const unsigned char *data, size_t size)
283 } else { 283 } else {
284 ctx->state = JBIG2_FILE_RANDOM_HEADERS; 284 ctx->state = JBIG2_FILE_RANDOM_HEADERS;
285 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "file header indicates random-access organization"); 285 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "file header indicates random-access organization");
286
287 } 286 }
288 break; 287 break;
289 case JBIG2_FILE_SEQUENTIAL_HEADER: 288 case JBIG2_FILE_SEQUENTIAL_HEADER:
diff --git a/jbig2dec/jbig2_generic.c b/jbig2dec/jbig2_generic.c
index 714dc5658..d3959b224 100644
--- a/jbig2dec/jbig2_generic.c
+++ b/jbig2dec/jbig2_generic.c
@@ -61,9 +61,6 @@ jbig2_decode_generic_template0(Jbig2Ctx *ctx,
61 int x, y; 61 int x, y;
62 byte *gbreg_line = (byte *) image->data; 62 byte *gbreg_line = (byte *) image->data;
63 63
64 /* todo: currently we only handle the nominal gbat location */
65 /* when resolved make sure to call jbig2_check_adaptive_pixel_in_field() */
66
67#ifdef OUTPUT_PBM 64#ifdef OUTPUT_PBM
68 printf("P4\n%d %d\n", GBW, GBH); 65 printf("P4\n%d %d\n", GBW, GBH);
69#endif 66#endif
diff --git a/jbig2dec/jbig2_halftone.c b/jbig2dec/jbig2_halftone.c
index c14853078..32857b01a 100644
--- a/jbig2dec/jbig2_halftone.c
+++ b/jbig2dec/jbig2_halftone.c
@@ -65,7 +65,6 @@ jbig2_hd_new(Jbig2Ctx *ctx, const Jbig2PatternDictParams *params, Jbig2Image *im
65 for (i = 0; i < N; i++) { 65 for (i = 0; i < N; i++) {
66 new->patterns[i] = jbig2_image_new(ctx, HPW, HPH); 66 new->patterns[i] = jbig2_image_new(ctx, HPW, HPH);
67 if (new->patterns[i] == NULL) { 67 if (new->patterns[i] == NULL) {
68
69 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to allocate pattern element image"); 68 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to allocate pattern element image");
70 for (j = 0; j < i; j++) 69 for (j = 0; j < i; j++)
71 jbig2_free(ctx->allocator, new->patterns[j]); 70 jbig2_free(ctx->allocator, new->patterns[j]);
@@ -324,7 +323,6 @@ jbig2_decode_gray_scale_image(Jbig2Ctx *ctx, Jbig2Segment *segment,
324 } 323 }
325 324
326 code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[GSBPP - 1], GB_stats); 325 code = jbig2_decode_generic_region(ctx, segment, &rparams, as, GSPLANES[GSBPP - 1], GB_stats);
327
328 } 326 }
329 if (code != 0) { 327 if (code != 0) {
330 jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding GSPLANES for halftone image"); 328 jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "error decoding GSPLANES for halftone image");
diff --git a/jbig2dec/jbig2_huffman.c b/jbig2dec/jbig2_huffman.c
index 8734f0bbb..ea9192edc 100644
--- a/jbig2dec/jbig2_huffman.c
+++ b/jbig2dec/jbig2_huffman.c
@@ -278,7 +278,7 @@ jbig2_huffman_get(Jbig2HuffmanState *hs, const Jbig2HuffmanTable *table, bool *o
278 entry = &table->entries[log_table_size > 0 ? this_word >> (32 - log_table_size) : 0]; 278 entry = &table->entries[log_table_size > 0 ? this_word >> (32 - log_table_size) : 0];
279 flags = entry->flags; 279 flags = entry->flags;
280 PREFLEN = entry->PREFLEN; 280 PREFLEN = entry->PREFLEN;
281 if ((flags == (byte) - 1) && (PREFLEN == (byte) - 1) && (entry->u.RANGELOW == -1)) { 281 if (flags == (byte) -1 && PREFLEN == (byte) -1 && entry->u.RANGELOW == -1) {
282 if (oob) 282 if (oob)
283 *oob = -1; 283 *oob = -1;
284 return -1; 284 return -1;
diff --git a/jbig2dec/jbig2_image.c b/jbig2dec/jbig2_image.c
index c749c4524..2a1185048 100644
--- a/jbig2dec/jbig2_image.c
+++ b/jbig2dec/jbig2_image.c
@@ -266,15 +266,6 @@ jbig2_image_compose(Jbig2Ctx *ctx, Jbig2Image *dst, Jbig2Image *src, int x, int
266#endif 266#endif
267 return 0; 267 return 0;
268 } 268 }
269#if 0
270 /* special case complete/strip replacement */
271 /* disabled because it's only safe to do when the destination
272 buffer is all-blank. */
273 if ((x == 0) && (w == src->width)) {
274 memcpy(dst->data + y * dst->stride, src->data, h * src->stride);
275 return 0;
276 }
277#endif
278 269
279 leftbyte = (uint32_t) x >> 3; 270 leftbyte = (uint32_t) x >> 3;
280 rightbyte = ((uint32_t) x + w - 1) >> 3; 271 rightbyte = ((uint32_t) x + w - 1) >> 3;
diff --git a/jbig2dec/jbig2_page.c b/jbig2dec/jbig2_page.c
index 1c66921d9..dbe25fdd4 100644
--- a/jbig2dec/jbig2_page.c
+++ b/jbig2dec/jbig2_page.c
@@ -86,7 +86,6 @@ jbig2_page_info(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment_dat
86 ctx->pages[j].state = JBIG2_PAGE_FREE; 86 ctx->pages[j].state = JBIG2_PAGE_FREE;
87 ctx->pages[j].number = 0; 87 ctx->pages[j].number = 0;
88 ctx->pages[j].image = NULL; 88 ctx->pages[j].image = NULL;
89
90 } 89 }
91 } 90 }
92 } 91 }
@@ -166,7 +165,7 @@ jbig2_end_of_stripe(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_t *segment
166 end_row = jbig2_get_uint32(segment_data); 165 end_row = jbig2_get_uint32(segment_data);
167 if (end_row < page.end_row) { 166 if (end_row < page.end_row) {
168 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, 167 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number,
169 "end of stripe segment with non-positive end row advance" " (new end row %d vs current end row %d)", end_row, page.end_row); 168 "end of stripe segment with non-positive end row advance (new end row %d vs current end row %d)", end_row, page.end_row);
170 } else { 169 } else {
171 jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "end of stripe: advancing end row to %d", end_row); 170 jbig2_error(ctx, JBIG2_SEVERITY_INFO, segment->number, "end of stripe: advancing end row to %d", end_row);
172 } 171 }
@@ -269,7 +268,7 @@ jbig2_page_add_result(Jbig2Ctx *ctx, Jbig2Page *page, Jbig2Image *image, int x,
269 if (page->image->height < new_height) { 268 if (page->image->height < new_height) {
270 Jbig2Image *resized_image = NULL; 269 Jbig2Image *resized_image = NULL;
271 270
272 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "growing page buffer to %d rows " "to accommodate new stripe", new_height); 271 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, -1, "growing page buffer to %d rows to accommodate new stripe", new_height);
273 resized_image = jbig2_image_resize(ctx, page->image, page->image->width, new_height); 272 resized_image = jbig2_image_resize(ctx, page->image, page->image->width, new_height);
274 if (resized_image == NULL) { 273 if (resized_image == NULL) {
275 return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "unable to resize image to accommodate new stripe"); 274 return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "unable to resize image to accommodate new stripe");
diff --git a/jbig2dec/jbig2_refinement.c b/jbig2dec/jbig2_refinement.c
index 8e874b337..f0ae13bed 100644
--- a/jbig2dec/jbig2_refinement.c
+++ b/jbig2dec/jbig2_refinement.c
@@ -37,16 +37,6 @@
37#include "jbig2_generic.h" 37#include "jbig2_generic.h"
38#include "jbig2_image.h" 38#include "jbig2_image.h"
39 39
40#if 0 /* currently not used */
41static int
42jbig2_decode_refinement_template0(Jbig2Ctx *ctx,
43 Jbig2Segment *segment,
44 const Jbig2RefinementRegionParams *params, Jbig2ArithState *as, Jbig2Image *image, Jbig2ArithCx *GR_stats)
45{
46 return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "refinement region template 0 NYI");
47}
48#endif
49
50static int 40static int
51jbig2_decode_refinement_template0_unopt(Jbig2Ctx *ctx, 41jbig2_decode_refinement_template0_unopt(Jbig2Ctx *ctx,
52 Jbig2Segment *segment, 42 Jbig2Segment *segment,
diff --git a/jbig2dec/jbig2_segment.c b/jbig2dec/jbig2_segment.c
index a92eb3aca..1d34b46b5 100644
--- a/jbig2dec/jbig2_segment.c
+++ b/jbig2dec/jbig2_segment.c
@@ -87,7 +87,7 @@ jbig2_parse_segment_header(Jbig2Ctx *ctx, uint8_t *buf, size_t buf_size, size_t
87 87
88 referred_to_segments = jbig2_new(ctx, uint32_t, referred_to_segment_count * referred_to_segment_size); 88 referred_to_segments = jbig2_new(ctx, uint32_t, referred_to_segment_count * referred_to_segment_size);
89 if (referred_to_segments == NULL) { 89 if (referred_to_segments == NULL) {
90 jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "could not allocate referred_to_segments " "in jbig2_parse_segment_header"); 90 jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "could not allocate referred_to_segments in jbig2_parse_segment_header");
91 return NULL; 91 return NULL;
92 } 92 }
93 93
@@ -212,7 +212,7 @@ jbig2_parse_extension_segment(Jbig2Ctx *ctx, Jbig2Segment *segment, const uint8_
212 necessary = type & 0x80000000; 212 necessary = type & 0x80000000;
213 213
214 if (necessary && !reserved) { 214 if (necessary && !reserved) {
215 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "extension segment is marked 'necessary' but " "not 'reserved' contrary to spec"); 215 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "extension segment is marked 'necessary' but not 'reserved' contrary to spec");
216 } 216 }
217 217
218 switch (type) { 218 switch (type) {
diff --git a/jbig2dec/jbig2_symbol_dict.c b/jbig2dec/jbig2_symbol_dict.c
index d076d9f82..5e8753dc7 100644
--- a/jbig2dec/jbig2_symbol_dict.c
+++ b/jbig2dec/jbig2_symbol_dict.c
@@ -418,7 +418,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
418 if (params->SDHUFF) { 418 if (params->SDHUFF) {
419 REFAGGNINST = jbig2_huffman_get(hs, params->SDHUFFAGGINST, &code); 419 REFAGGNINST = jbig2_huffman_get(hs, params->SDHUFFAGGINST, &code);
420 } else { 420 } else {
421 code = jbig2_arith_int_decode(ctx, IAAI, as, (int32_t *) & REFAGGNINST); 421 code = jbig2_arith_int_decode(ctx, IAAI, as, (int32_t *) &REFAGGNINST);
422 } 422 }
423 if (code || (int32_t) REFAGGNINST <= 0) { 423 if (code || (int32_t) REFAGGNINST <= 0) {
424 code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid number of symbols or OOB in aggregate glyph"); 424 code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "invalid number of symbols or OOB in aggregate glyph");
@@ -558,7 +558,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
558 } 558 }
559 559
560 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, 560 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
561 "symbol is a refinement of id %d with the " "refinement applied at (%d,%d)", ID, RDX, RDY); 561 "symbol is a refinement of id %d with the refinement applied at (%d,%d)", ID, RDX, RDY);
562 562
563 image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT); 563 image = jbig2_image_new(ctx, SYMWIDTH, HCHEIGHT);
564 if (image == NULL) { 564 if (image == NULL) {
@@ -663,7 +663,7 @@ jbig2_decode_symbol_dict(Jbig2Ctx *ctx,
663 663
664 BMSIZE = image->height * stride; 664 BMSIZE = image->height * stride;
665 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, 665 jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
666 "reading %dx%d uncompressed bitmap" " for %d symbols (%d bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, BMSIZE); 666 "reading %dx%d uncompressed bitmap for %d symbols (%d bytes)", image->width, image->height, NSYMSDECODED - HCFIRSTSYM, BMSIZE);
667 667
668 for (j = 0; j < image->height; j++) { 668 for (j = 0; j < image->height; j++) {
669 memcpy(dst, src, stride); 669 memcpy(dst, src, stride);
diff --git a/jbig2dec/jbig2_text.c b/jbig2dec/jbig2_text.c
index f66b2cc7a..33447b1c5 100644
--- a/jbig2dec/jbig2_text.c
+++ b/jbig2dec/jbig2_text.c
@@ -398,7 +398,6 @@ cleanup1:
398 if (params->SBHUFF) { 398 if (params->SBHUFF) {
399 jbig2_huffman_advance(hs, BMSIZE); 399 jbig2_huffman_advance(hs, BMSIZE);
400 } 400 }
401
402 } 401 }
403 402
404 /* (3c.vi) */ 403 /* (3c.vi) */
diff --git a/jbig2dec/jbig2dec.c b/jbig2dec/jbig2dec.c
index 524a276b9..b231f3d6c 100644
--- a/jbig2dec/jbig2dec.c
+++ b/jbig2dec/jbig2dec.c
@@ -225,7 +225,8 @@ print_usage(void)
225 " --hash print a hash of the decoded document\n" 225 " --hash print a hash of the decoded document\n"
226 " -o <file> send decoded output to <file>\n" 226 " -o <file> send decoded output to <file>\n"
227 " Defaults to the the input with a different\n" 227 " Defaults to the the input with a different\n"
228 " extension. Pass '-' for stdout.\n" " -t <type> force a particular output file format\n" 228 " extension. Pass '-' for stdout.\n"
229 " -t <type> force a particular output file format\n"
229#ifdef HAVE_LIBPNG 230#ifdef HAVE_LIBPNG
230 " supported options are 'png' and 'pbm'\n" 231 " supported options are 'png' and 'pbm'\n"
231#else 232#else