[trunk] modify image_to_j2k and the lib to support functionalities given by the v2...
[openjpeg.git] / tests / j2k_random_tile_access.c
index ab08760af9d1e2a15b8f0e9fa4063049a69b3ebf..f6daef1806023dbcb42825c64ff10e270db38a06 100644 (file)
@@ -164,6 +164,12 @@ int main(int argc, char **argv)
        opj_codec_t* dinfo = NULL;                              /* Handle to a decompressor */
        opj_codestream_info_v2_t* cstr_info = NULL;
 
+       /* Index of corner tiles */
+       OPJ_UINT32 tile_ul = 0;
+       OPJ_UINT32 tile_ur = 0;
+       OPJ_UINT32 tile_lr = 0;
+       OPJ_UINT32 tile_ll = 0;
+
        if (argc != 2) {
                fprintf(stderr, "Usage: %s <input_file>\n", argv[0]);
                return EXIT_FAILURE;
@@ -249,17 +255,17 @@ int main(int argc, char **argv)
 
        fprintf(stdout, "The file contains %dx%d tiles\n", cstr_info->tw, cstr_info->th);
 
-       OPJ_UINT32 tile_ul = 0;
-       OPJ_UINT32 tile_ur = cstr_info->tw - 1;
-       OPJ_UINT32 tile_lr = cstr_info->tw * cstr_info->th - 1;
-       OPJ_UINT32 tile_ll = tile_lr - cstr_info->tw;
+       tile_ul = 0;
+       tile_ur = cstr_info->tw - 1;
+       tile_lr = cstr_info->tw * cstr_info->th - 1;
+       tile_ll = tile_lr - cstr_info->tw;
 
 #define TEST_TILE( tile_index ) \
        fprintf(stdout, "Decoding tile %d ...\n", tile_index); \
        if(!opj_get_decoded_tile(dinfo, cio, image, tile_index )){ \
                fprintf(stderr, "ERROR -> j2k_to_image: failed to decode tile %d\n", tile_index); \
                opj_stream_destroy(cio); \
-               opj_destroy_cstr_info_v2(cstr_info); \
+               opj_destroy_cstr_info_v2(&cstr_info); \
                opj_destroy_codec(dinfo); \
                opj_image_destroy(image); \
                fclose(fsrc); \
@@ -278,7 +284,7 @@ int main(int argc, char **argv)
        opj_stream_destroy(cio);
 
        /* Destroy code stream info */
-       opj_destroy_cstr_info_v2(cstr_info);
+       opj_destroy_cstr_info_v2(&cstr_info);
 
        /* Free remaining structures */
        opj_destroy_codec(dinfo);