[trunk] managed nicely the case where TPSot value is incorrect (thanks winfried). Update the test suite to check this case. Updates issue 202. Updates issue 206. Update issue 208
This commit is contained in:
parent
ecb93d97a5
commit
07ae149955
|
@ -7034,6 +7034,12 @@ OPJ_BOOL opj_j2k_read_tile_header( opj_j2k_t * p_j2k,
|
||||||
/* Try to read until the Start Of Data is detected */
|
/* Try to read until the Start Of Data is detected */
|
||||||
while (l_current_marker != J2K_MS_SOD) {
|
while (l_current_marker != J2K_MS_SOD) {
|
||||||
|
|
||||||
|
if(opj_stream_get_number_byte_left(p_stream) == 0)
|
||||||
|
{
|
||||||
|
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
|
/* Try to read 2 bytes (the marker size) from stream and copy them into the buffer */
|
||||||
if (opj_stream_read_data(p_stream,p_j2k->m_specific_param.m_decoder.m_header_data,2,p_manager) != 2) {
|
if (opj_stream_read_data(p_stream,p_j2k->m_specific_param.m_decoder.m_header_data,2,p_manager) != 2) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
|
opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
|
||||||
|
@ -7127,6 +7133,9 @@ OPJ_BOOL opj_j2k_read_tile_header( opj_j2k_t * p_j2k,
|
||||||
opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,&l_current_marker,2);
|
opj_read_bytes(p_j2k->m_specific_param.m_decoder.m_header_data,&l_current_marker,2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(opj_stream_get_number_byte_left(p_stream) == 0
|
||||||
|
&& p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC)
|
||||||
|
break;
|
||||||
|
|
||||||
/* If we didn't skip data before, we need to read the SOD marker*/
|
/* If we didn't skip data before, we need to read the SOD marker*/
|
||||||
if (! p_j2k->m_specific_param.m_decoder.m_skip_data) {
|
if (! p_j2k->m_specific_param.m_decoder.m_skip_data) {
|
||||||
|
@ -7260,6 +7269,11 @@ OPJ_BOOL opj_j2k_decode_tile ( opj_j2k_t * p_j2k,
|
||||||
p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
|
p_j2k->m_specific_param.m_decoder.m_can_decode = 0;
|
||||||
p_j2k->m_specific_param.m_decoder.m_state &= (~ (0x0080));/* FIXME J2K_DEC_STATE_DATA);*/
|
p_j2k->m_specific_param.m_decoder.m_state &= (~ (0x0080));/* FIXME J2K_DEC_STATE_DATA);*/
|
||||||
|
|
||||||
|
if(opj_stream_get_number_byte_left(p_stream) == 0
|
||||||
|
&& p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC){
|
||||||
|
return OPJ_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_j2k->m_specific_param.m_decoder.m_state != 0x0100){ /*FIXME J2K_DEC_STATE_EOC)*/
|
if (p_j2k->m_specific_param.m_decoder.m_state != 0x0100){ /*FIXME J2K_DEC_STATE_EOC)*/
|
||||||
if (opj_stream_read_data(p_stream,l_data,2,p_manager) != 2) {
|
if (opj_stream_read_data(p_stream,l_data,2,p_manager) != 2) {
|
||||||
opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
|
opj_event_msg(p_manager, EVT_ERROR, "Stream too short\n");
|
||||||
|
@ -7275,6 +7289,11 @@ OPJ_BOOL opj_j2k_decode_tile ( opj_j2k_t * p_j2k,
|
||||||
else if (l_current_marker != J2K_MS_SOT)
|
else if (l_current_marker != J2K_MS_SOT)
|
||||||
{
|
{
|
||||||
opj_event_msg(p_manager, EVT_ERROR, "Stream too short, expected SOT\n");
|
opj_event_msg(p_manager, EVT_ERROR, "Stream too short, expected SOT\n");
|
||||||
|
|
||||||
|
if(opj_stream_get_number_byte_left(p_stream) == 0) {
|
||||||
|
p_j2k->m_specific_param.m_decoder.m_state = J2K_STATE_NEOC;
|
||||||
|
return OPJ_TRUE;
|
||||||
|
}
|
||||||
return OPJ_FALSE;
|
return OPJ_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8691,6 +8710,7 @@ OPJ_BOOL opj_j2k_decode_tiles ( opj_j2k_t *p_j2k,
|
||||||
OPJ_INT32 l_tile_x0,l_tile_y0,l_tile_x1,l_tile_y1;
|
OPJ_INT32 l_tile_x0,l_tile_y0,l_tile_x1,l_tile_y1;
|
||||||
OPJ_UINT32 l_nb_comps;
|
OPJ_UINT32 l_nb_comps;
|
||||||
OPJ_BYTE * l_current_data;
|
OPJ_BYTE * l_current_data;
|
||||||
|
OPJ_UINT32 nr_tiles = 0;
|
||||||
|
|
||||||
l_current_data = (OPJ_BYTE*)opj_malloc(1000);
|
l_current_data = (OPJ_BYTE*)opj_malloc(1000);
|
||||||
if (! l_current_data) {
|
if (! l_current_data) {
|
||||||
|
@ -8740,6 +8760,11 @@ OPJ_BOOL opj_j2k_decode_tiles ( opj_j2k_t *p_j2k,
|
||||||
}
|
}
|
||||||
opj_event_msg(p_manager, EVT_INFO, "Image data has been updated with tile %d.\n\n", l_current_tile_no + 1);
|
opj_event_msg(p_manager, EVT_INFO, "Image data has been updated with tile %d.\n\n", l_current_tile_no + 1);
|
||||||
|
|
||||||
|
if(opj_stream_get_number_byte_left(p_stream) == 0
|
||||||
|
&& p_j2k->m_specific_param.m_decoder.m_state == J2K_STATE_NEOC)
|
||||||
|
break;
|
||||||
|
if(++nr_tiles == p_j2k->m_cp.th * p_j2k->m_cp.tw)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
opj_free(l_current_data);
|
opj_free(l_current_data);
|
||||||
|
|
|
@ -66,8 +66,8 @@ opj_decompress -i @INPUT_NR_PATH@/orb-blue10-win-j2k.j2k -o @TEMP_PATH@/orb-blu
|
||||||
opj_decompress -i @INPUT_NR_PATH@/orb-blue10-win-jp2.jp2 -o @TEMP_PATH@/orb-blue10-win-jp2.jp2.pgx
|
opj_decompress -i @INPUT_NR_PATH@/orb-blue10-win-jp2.jp2 -o @TEMP_PATH@/orb-blue10-win-jp2.jp2.pgx
|
||||||
opj_decompress -i @INPUT_NR_PATH@/relax.jp2 -o @TEMP_PATH@/relax.jp2.pgx
|
opj_decompress -i @INPUT_NR_PATH@/relax.jp2 -o @TEMP_PATH@/relax.jp2.pgx
|
||||||
opj_decompress -i @INPUT_NR_PATH@/test_lossless.j2k -o @TEMP_PATH@/test_lossless.j2k.pgx
|
opj_decompress -i @INPUT_NR_PATH@/test_lossless.j2k -o @TEMP_PATH@/test_lossless.j2k.pgx
|
||||||
# text_GBR.jp2 file exhibt a error about a tile part with a index > of the number of tile-part in this tile.
|
# text_GBR.jp2 file exhibt a error about a tile part with a index > of the number of tile-part in this tile (related to issue 202, 206, 208)
|
||||||
!opj_decompress -i @INPUT_NR_PATH@/text_GBR.jp2 -o @TEMP_PATH@/text_GBR.jp2.pgx
|
opj_decompress -i @INPUT_NR_PATH@/text_GBR.jp2 -o @TEMP_PATH@/text_GBR.jp2.pgx
|
||||||
# pacs.ge file should throw an error but finally it seems work with v2
|
# pacs.ge file should throw an error but finally it seems work with v2
|
||||||
opj_decompress -i @INPUT_NR_PATH@/pacs.ge.j2k -o @TEMP_PATH@/pacs.ge.j2k.pgx
|
opj_decompress -i @INPUT_NR_PATH@/pacs.ge.j2k -o @TEMP_PATH@/pacs.ge.j2k.pgx
|
||||||
# related to issue 135
|
# related to issue 135
|
||||||
|
@ -77,7 +77,7 @@ opj_decompress -i @INPUT_NR_PATH@/kodak_2layers_lrcp.j2c -o @TEMP_PATH@/kodak_2
|
||||||
opj_decompress -i @INPUT_NR_PATH@/issue104_jpxstream.jp2 -o @TEMP_PATH@/issue104_jpxstream.jp2.pgx
|
opj_decompress -i @INPUT_NR_PATH@/issue104_jpxstream.jp2 -o @TEMP_PATH@/issue104_jpxstream.jp2.pgx
|
||||||
# File not supported by kakadu (Malformed PCLR box) and not supoprter by openjpeg (problem with value of TPSot)
|
# File not supported by kakadu (Malformed PCLR box) and not supoprter by openjpeg (problem with value of TPSot)
|
||||||
opj_decompress -i @INPUT_NR_PATH@/mem-b2ace68c-1381.jp2 -o @TEMP_PATH@/mem-b2ace68c-1381.jp2.pgx
|
opj_decompress -i @INPUT_NR_PATH@/mem-b2ace68c-1381.jp2 -o @TEMP_PATH@/mem-b2ace68c-1381.jp2.pgx
|
||||||
# File which produced weird output with kakadu and not supoprter by openjpeg (problem with value of TPSot)
|
# File which produced weird output with kakadu and not supoprter by openjpeg (problem with value of TPSot, issue 202, 206, 208)
|
||||||
opj_decompress -i @INPUT_NR_PATH@/mem-b2b86b74-2753.jp2 -o @TEMP_PATH@/mem-b2b86b74-2753.jp2.pgx
|
opj_decompress -i @INPUT_NR_PATH@/mem-b2b86b74-2753.jp2 -o @TEMP_PATH@/mem-b2b86b74-2753.jp2.pgx
|
||||||
# issue 191 raised by the gdal fuzzer test (should properly failed)
|
# issue 191 raised by the gdal fuzzer test (should properly failed)
|
||||||
!opj_decompress -i @INPUT_NR_PATH@/gdal_fuzzer_unchecked_numresolutions.jp2 -o @TEMP_PATH@/gdal_fuzzer_unchecked_numresolutions.pgx
|
!opj_decompress -i @INPUT_NR_PATH@/gdal_fuzzer_unchecked_numresolutions.jp2 -o @TEMP_PATH@/gdal_fuzzer_unchecked_numresolutions.pgx
|
||||||
|
@ -91,6 +91,8 @@ opj_decompress -i @INPUT_NR_PATH@/mem-b2b86b74-2753.jp2 -o @TEMP_PATH@/mem-b2b8
|
||||||
opj_decompress -i @INPUT_NR_PATH@/file409752.jp2 -o @TEMP_PATH@/file409752.png
|
opj_decompress -i @INPUT_NR_PATH@/file409752.jp2 -o @TEMP_PATH@/file409752.png
|
||||||
# issue 188
|
# issue 188
|
||||||
opj_decompress -i @INPUT_NR_PATH@/issue188_beach_64bitsbox.jp2 -o @TEMP_PATH@/issue188_beach_64bitsbox.jp2.tif
|
opj_decompress -i @INPUT_NR_PATH@/issue188_beach_64bitsbox.jp2 -o @TEMP_PATH@/issue188_beach_64bitsbox.jp2.tif
|
||||||
|
# issue 206
|
||||||
|
opj_decompress -i @INPUT_NR_PATH@/issue206_image-000.jp2 -o @TEMP_PATH@/issue206_image-000.jp2.png
|
||||||
|
|
||||||
# decode with specific area
|
# decode with specific area
|
||||||
# prec=12; nb_c=1
|
# prec=12; nb_c=1
|
||||||
|
|
Loading…
Reference in New Issue