Activate tile decoding system to reproduce issues

This commit is contained in:
Mathieu Malaterre 2012-05-21 08:03:58 +00:00
parent 38fd7a84c7
commit 0447ea94c1
2 changed files with 37 additions and 14 deletions

View File

@ -43,12 +43,20 @@ ADD_EXECUTABLE(test_tile_encoder test_tile_encoder.c)
TARGET_LINK_LIBRARIES(test_tile_encoder ${OPENJPEG_LIBRARY_NAME}) TARGET_LINK_LIBRARIES(test_tile_encoder ${OPENJPEG_LIBRARY_NAME})
# Let's try a couple of possibilities: # Let's try a couple of possibilities:
ADD_TEST(tte0 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder)
ADD_TEST(tte1 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder 3 2048 2048 1024 1024 8 tte1.j2k) ADD_TEST(tte1 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder 3 2048 2048 1024 1024 8 tte1.j2k)
ADD_TEST(tte2 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder 3 2048 2048 1024 1024 8 tte1.jp2) ADD_TEST(tte2 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder 3 2048 2048 1024 1024 8 tte1.jp2)
ADD_EXECUTABLE(test_tile_decoder test_tile_decoder.c) ADD_EXECUTABLE(test_tile_decoder test_tile_decoder.c)
TARGET_LINK_LIBRARIES(test_tile_decoder ${OPENJPEG_LIBRARY_NAME}) TARGET_LINK_LIBRARIES(test_tile_decoder ${OPENJPEG_LIBRARY_NAME})
ADD_TEST(ttd0 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder)
set_property(TEST ttd0 APPEND PROPERTY DEPENDS tte0)
ADD_TEST(ttd1 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder 0 0 1024 1024 tte1.j2k)
set_property(TEST ttd1 APPEND PROPERTY DEPENDS tte1)
ADD_TEST(ttd2 ${EXECUTABLE_OUTPUT_PATH}/test_tile_encoder 0 0 1024 1024 tte1.jp2)
set_property(TEST ttd2 APPEND PROPERTY DEPENDS tte2)
# No image send to the dashboard if lib PNG is not available. # No image send to the dashboard if lib PNG is not available.
IF(NOT HAVE_LIBPNG) IF(NOT HAVE_LIBPNG)
MESSAGE(WARNING "Lib PNG seems to be not available: if you want run the non-regression tests with images reported to the dashboard, you need it (try BUILD_THIRDPARTY)") MESSAGE(WARNING "Lib PNG seems to be not available: if you want run the non-regression tests with images reported to the dashboard, you need it (try BUILD_THIRDPARTY)")

View File

@ -43,12 +43,6 @@
#include "openjpeg.h" #include "openjpeg.h"
#include "stdlib.h" #include "stdlib.h"
#define DA_X0 0
#define DA_Y0 0
#define DA_X1 1000
#define DA_Y1 1000
#define INPUT_FILE "test.j2k"
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/** /**
@ -89,7 +83,7 @@ void info_callback(const char *msg, void *client_data) {
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
int main () int main (int argc, char *argv[])
{ {
opj_dparameters_t l_param; opj_dparameters_t l_param;
opj_codec_t * l_codec; opj_codec_t * l_codec;
@ -105,8 +99,29 @@ int main ()
OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y,l_nb_comps; OPJ_UINT32 l_tile_width,l_tile_height,l_nb_tiles_x,l_nb_tiles_y,l_nb_comps;
OPJ_INT32 l_current_tile_x0,l_current_tile_y0,l_current_tile_x1,l_current_tile_y1; OPJ_INT32 l_current_tile_x0,l_current_tile_y0,l_current_tile_x1,l_current_tile_y1;
//PROFINIT(); int da_x0=0;
int da_y0=0;
int da_x1=1000;
int da_y1=1000;
char input_file[64];
/* should be test_tile_decoder 0 0 1000 1000 tte1.j2k */
if( argc == 6 )
{
da_x0=atoi(argv[1]);
da_y0=atoi(argv[2]);
da_x1=atoi(argv[3]);
da_y1=atoi(argv[4]);
strcpy(input_file,argv[5]);
}
else
{
da_x0=0;
da_y0=0;
da_x1=1000;
da_y1=1000;
strcpy(input_file,"test.j2k");
}
if if
(! l_data) (! l_data)
@ -146,7 +161,7 @@ int main ()
return 1; return 1;
} }
l_file = fopen(INPUT_FILE,"rb"); l_file = fopen(input_file,"rb");
if if
(! l_file) (! l_file)
{ {
@ -167,14 +182,15 @@ int main ()
opj_destroy_codec(l_codec); opj_destroy_codec(l_codec);
return 1; return 1;
} }
printf("Setting decoding area to %d,%d,%d,%d\n", DA_X0, DA_Y0, DA_X1, DA_Y1); printf("Setting decoding area to %d,%d,%d,%d\n", da_x0, da_y0, da_x1, da_y1);
opj_set_decode_area(l_codec, l_image, DA_X0, DA_Y0, DA_X1, DA_Y1); opj_set_decode_area(l_codec, l_image, da_x0, da_y0, da_x1, da_y1);
while while
(l_go_on) (l_go_on)
{ {
if if
(! opj_read_tile_header( (! opj_read_tile_header(
l_codec, l_codec,
l_stream,
&l_tile_index, &l_tile_index,
&l_data_size, &l_data_size,
&l_current_tile_x0, &l_current_tile_x0,
@ -182,8 +198,7 @@ int main ()
&l_current_tile_x1, &l_current_tile_x1,
&l_current_tile_y1, &l_current_tile_y1,
&l_nb_comps, &l_nb_comps,
&l_go_on, &l_go_on))
l_stream))
{ {
free(l_data); free(l_data);
opj_stream_destroy(l_stream); opj_stream_destroy(l_stream);