diff options
| author | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2005-03-16 12:11:40 +0000 |
|---|---|---|
| committer | Francois-Olivier Devaux <fodevaux@users.noreply.github.com> | 2005-03-16 12:11:40 +0000 |
| commit | 1f96f0e92af71cecac662128d7674e45dccfb3d9 (patch) | |
| tree | fb18a179e699c29c49086fe98be87d5a67ad4829 | |
| parent | 34a6c13a2d2062fcc18bb5fb4c0b526baf296d7c (diff) | |
Modifications made to enable the decoding of a J2K file headers without decoding all packets using #NO_PACKETS_DECODING
Used with MJ2_to_metadata
| -rw-r--r-- | libopenjpeg/j2k.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 6092c5bb..cce350d0 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -73,7 +73,7 @@ jmp_buf j2k_error; static int j2k_state; static int j2k_curtileno; -static j2k_tcp_t j2k_default_tcp; +j2k_tcp_t j2k_default_tcp; static unsigned char *j2k_eot; static int j2k_sot_start; static int pos_correction; @@ -90,7 +90,9 @@ static info_image info_IM; void j2k_clean() { int tileno = 0; +#ifndef NO_PACKETS_DECODING tcd_free_encode(j2k_img, j2k_cp, j2k_curtileno); +#endif; if (info_IM.index_on) { for (tileno = 0; tileno < j2k_cp->tw * j2k_cp->th; tileno++) { @@ -900,6 +902,7 @@ void j2k_read_sod() unsigned char *data; len = int_min(j2k_eot - cio_getbp(), cio_numbytesleft() + 1); + if (len == cio_numbytesleft() + 1) truncate = 1; /* Case of a truncate codestream */ @@ -956,12 +959,16 @@ void j2k_write_eoc() void j2k_read_eoc() { int i, tileno; - + +#ifndef NO_PACKETS_DECODING tcd_init(j2k_img, j2k_cp); +#endif for (i = 0; i < j2k_cp->tileno_size; i++) { tileno = j2k_cp->tileno[i]; +#ifndef NO_PACKETS_DECODING tcd_decode_tile(j2k_tile_data[tileno], j2k_tile_len[tileno], tileno); +#endif free(j2k_tile_data[tileno]); } |
