! : changed
+ : added
+October 11, 2011
+* [mickael] WIP: correct mistake with JP2 files and manage correctly the text_GBR.jp2 filecase.
+
October 10, 2011
* [vincent] fix 'distcheck' rule
+ [vincent] add libopenjpeg-jpwl.pc.in
opj_image_t image;
opj_stream_t *cio = NULL; /* Stream */
opj_codec_t* dinfo = NULL; /* Handle to a decompressor */
- opj_bool bRes1, bRes2;
-
char indexfilename[OPJ_PATH_LEN]; /* index file name */
return EXIT_FAILURE;
}
-
/* Get the decoded image */
- bRes1 = opj_decode_v2(dinfo, cio, &image);
- bRes2 = opj_end_decompress(dinfo,cio);
-
- /*if ( !(opj_decode_v2(dinfo, cio, &image)) || !(opj_end_decompress(dinfo,cio)) ) {*/
- if ( !bRes1 || !bRes2) {
+ if ( !( opj_decode_v2(dinfo, cio, &image) && opj_end_decompress(dinfo,cio) ) ) {
fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n");
opj_destroy_codec(dinfo);
opj_stream_destroy(cio);
++p_header_data;
if (l_num_parts != 0) { /* Number of tile-part header is provided by this tile-part header */
+ /* Useful to manage the case of textGBR.jp2 file because two values of TNSot are allowed: the correct numbers of
+ * tile-parts for that tile and zero (A.4.2 of 15444-1 : 2002). */
+ if (l_tcp->m_nb_tile_parts) {
+ if (l_current_part >= l_tcp->m_nb_tile_parts){
+ opj_event_msg_v2(p_manager, EVT_ERROR, "In SOT marker, TPSot (%d) is not valid regards to the current "
+ "number of tile-part (%d), giving up\n", l_current_part, l_tcp->m_nb_tile_parts );
+ return OPJ_FALSE;
+ }
+ }
l_tcp->m_nb_tile_parts = l_num_parts;
}
/* Read the marker segment with the correct marker handler */
if (! (*(l_marker_handler->handler))(p_j2k,p_j2k->m_specific_param.m_decoder.m_header_data,l_marker_size,p_manager)) {
- opj_event_msg_v2(p_manager, EVT_ERROR, "Marker is not compliant with its position\n");
+ opj_event_msg_v2(p_manager, EVT_ERROR, "Fail to read the current marker segment (%#x)\n", l_current_marker);
return OPJ_FALSE;
}
struct opj_event_mgr * p_manager)
{
/* J2K decoding */
- if( j2k_decode_v2(jp2->j2k, cio, p_image, p_manager) ) {
- opj_event_msg_v2(p_manager, EVT_ERROR, "Failed to decode J2K image\n");
+ if( ! j2k_decode_v2(jp2->j2k, cio, p_image, p_manager) ) {
+ opj_event_msg_v2(p_manager, EVT_ERROR, "Failed to decode the codestream in the JP2 file\n");
return OPJ_FALSE;
}
if(jp2->color.icc_profile_buf) {
p_image->icc_profile_buf = jp2->color.icc_profile_buf;
p_image->icc_profile_len = jp2->color.icc_profile_len;
+ jp2->color.icc_profile_buf = NULL;
}
return OPJ_TRUE;
# image to base)\r
#\r
# Line begin with ! should failed (should be used for bad jpeg2000 file which should be \r
-# gracefully rejected)\r
+# gracefully rejected). Please add a short resume about why this file should be rejected.\r
#\r
# You can use @INPUT_NR_PATH@ and @TEMP_PATH@ cmake variable which refers to OPJ_DATA_ROOT \r
# repository. However you can use relative path or absolute path.\r
j2k_to_image -i @INPUT_NR_PATH@/orb-blue10-win-jp2.jp2 -o @TEMP_PATH@/orb-blue10-win-jp2.jp2.pgx\r
j2k_to_image -i @INPUT_NR_PATH@/relax.jp2 -o @TEMP_PATH@/relax.jp2.pgx\r
j2k_to_image -i @INPUT_NR_PATH@/test_lossless.j2k -o @TEMP_PATH@/test_lossless.j2k.pgx\r
-j2k_to_image -i @INPUT_NR_PATH@/text_GBR.jp2 -o @TEMP_PATH@/text_GBR.jp2.pgx\r
+# text_GBR.jp2 file exhibt a error about a tile part with a index > of the number of tile-part in this tile.\r
+!j2k_to_image -i @INPUT_NR_PATH@/text_GBR.jp2 -o @TEMP_PATH@/text_GBR.jp2.pgx\r