diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-09-17 15:11:20 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2007-09-17 15:11:20 +0000 |
| commit | 55c4c14352519b84ad79abcb2f8527e1c25b9e54 (patch) | |
| tree | eb3efc84b540eccc43ca1ef19d8ca11ef0370942 /codec/j2k_to_image.c | |
| parent | 569bbb00776f08211f7184ea4ea94571b652adae (diff) | |
OpenJPEG library interface modified to retain compatibility with version 1.2. Sorry if some of you already adapted their code to the previous interface, but we want to avoid a ABI break....
Diffstat (limited to 'codec/j2k_to_image.c')
| -rw-r--r-- | codec/j2k_to_image.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/codec/j2k_to_image.c b/codec/j2k_to_image.c index 98eae955..f265894e 100644 --- a/codec/j2k_to_image.c +++ b/codec/j2k_to_image.c @@ -834,8 +834,6 @@ int main(int argc, char **argv) { fread(src, 1, file_length, fsrc); fclose(fsrc); - - /* decode the code-stream */ /* ---------------------- */ @@ -857,7 +855,10 @@ int main(int argc, char **argv) { cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio, &cstr_info); + if (*indexfilename) // If need to extract codestream information + image = opj_decode_with_info(dinfo, cio, &cstr_info); + else + image = opj_decode(dinfo, cio); if(!image) { fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); opj_destroy_decompress(dinfo); @@ -896,7 +897,10 @@ int main(int argc, char **argv) { cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio, &cstr_info); + if (*indexfilename) // If need to extract codestream information + image = opj_decode_with_info(dinfo, cio, &cstr_info); + else + image = opj_decode(dinfo, cio); if(!image) { fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); opj_destroy_decompress(dinfo); @@ -935,7 +939,10 @@ int main(int argc, char **argv) { cio = opj_cio_open((opj_common_ptr)dinfo, src, file_length); /* decode the stream and fill the image structure */ - image = opj_decode(dinfo, cio, &cstr_info); + if (*indexfilename) // If need to extract codestream information + image = opj_decode_with_info(dinfo, cio, &cstr_info); + else + image = opj_decode(dinfo, cio); if(!image) { fprintf(stderr, "ERROR -> j2k_to_image: failed to decode image!\n"); opj_destroy_decompress(dinfo); @@ -1029,7 +1036,8 @@ int main(int argc, char **argv) { opj_destroy_decompress(dinfo); } /* free codestream information structure */ - opj_destroy_cstr_info(&cstr_info); + if (*indexfilename) + opj_destroy_cstr_info(&cstr_info); /* free image data structure */ opj_image_destroy(image); |
