summaryrefslogtreecommitdiff
path: root/libopenjpeg
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-04-23 19:26:19 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-04-23 19:26:19 +0000
commit39ac7c479ff2a1294842121d5a72cd77cd2d4f92 (patch)
tree5dc2fe4afcd5feaefde62bc883aff053ee521fea /libopenjpeg
parent401e9cbb5c4cb3a0984966c822903667e587616e (diff)
[1.5] Revert r1642, as explained on https://groups.google.com/group/openjpeg/msg/77a67fef94a0309b
Diffstat (limited to 'libopenjpeg')
-rw-r--r--libopenjpeg/j2k.c44
1 files changed, 6 insertions, 38 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c
index c98d823c..d34c75fa 100644
--- a/libopenjpeg/j2k.c
+++ b/libopenjpeg/j2k.c
@@ -1477,26 +1477,6 @@ static void j2k_read_sod(opj_j2k_t *j2k) {
truncate = 1; /* Case of a truncate codestream */
}
- {
- unsigned char *s, *e;
- int skipped = 0;
-
- s = cio_getbp(cio);
- e = s + len;
-
- if((unsigned int)(e - s) > 8) s = e - 8;
-
- if(e[-2] == 0x00 && e[-1] == 0x00)
- {
- while(e > s)
- {
- if(e[-2] == 0xff && e[-1] == 0xd9) break;
- --len; --e; ++skipped;
- }
- if(skipped) truncate = 1;
- }
- }
-
data = j2k->tile_data[curtileno];
data = (unsigned char*) opj_realloc(data, (j2k->tile_len[curtileno] + len) * sizeof(unsigned char));
@@ -1876,15 +1856,9 @@ opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestream_info_t *c
#endif /* USE_JPWL */
if (id >> 8 != 0xff) {
- if(cio_numbytesleft(cio) != 0) /* not end of file reached and no EOC */
- {
- opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
- opj_image_destroy(image);
- return 0;
- }
- opj_event_msg(cinfo, EVT_WARNING, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
- j2k->state = J2K_STATE_NEOC;
- break;
+ opj_image_destroy(image);
+ opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
+ return 0;
}
e = j2k_dec_mstab_lookup(id);
/* Check if the marker is known*/
@@ -1975,15 +1949,9 @@ opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio, opj_codestre
id = cio_read(cio, 2);
if (id >> 8 != 0xff) {
- if(cio_numbytesleft(cio) != 0) /* no end of file reached and no EOC */
- {
- opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
- opj_image_destroy(image);
- return 0;
- }
- opj_event_msg(cinfo, EVT_WARNING, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
- j2k->state = J2K_STATE_NEOC;
- break;
+ opj_image_destroy(image);
+ opj_event_msg(cinfo, EVT_ERROR, "%.8x: expected a marker instead of %x\n", cio_tell(cio) - 2, id);
+ return 0;
}
e = j2k_dec_mstab_lookup(id);
if (!(j2k->state & e->states)) {