diff options
| author | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-11-30 17:31:47 +0000 |
|---|---|---|
| committer | Mickael Savinaud <savmickael@users.noreply.github.com> | 2011-11-30 17:31:47 +0000 |
| commit | 8c2d8bc85f1e7b7717434d56e355cf1ef3890131 (patch) | |
| tree | 62da441207d9b5c382543c8f7be15c0d12dd54be | |
| parent | 563b56e09c1b3545894c8210bbf295a1ff5aad1e (diff) | |
[trunk] fix bug during random access to tile (tile already decoded)
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | libopenjpeg/j2k.c | 28 |
2 files changed, 25 insertions, 4 deletions
@@ -14,6 +14,7 @@ November 30, 2011 - change types related to size of stream to OPJ_UINT64_T - change calls to fseek/ftell to LFS-capable OPJ_SEEK/OPJ_TELL * [mickael] fix error about the way to detect the additional test suite +* [mickael] fix bug during random access to tile (tile already decoded) November 29, 2011 * [mickael] fix error with new way to detect kdu_expand diff --git a/libopenjpeg/j2k.c b/libopenjpeg/j2k.c index 19b4d2b4..a3c14c3b 100644 --- a/libopenjpeg/j2k.c +++ b/libopenjpeg/j2k.c @@ -125,6 +125,12 @@ static const struct opj_dec_memory_marker_handler * j2k_get_marker_handler (OPJ_ */ static void j2k_tcp_destroy (opj_tcp_v2_t *p_tcp); +/** + * Destroys the data inside a tile coding parameter structure. + * + * @param p_tcp the tile coding parameter which contain data to destroy. + */ +static void j2k_tcp_data_destroy (opj_tcp_v2_t *p_tcp); /** * Destroys a coding parameter structure. @@ -6488,13 +6494,24 @@ void j2k_tcp_destroy (opj_tcp_v2_t *p_tcp) p_tcp->mct_norms = 00; } + j2k_tcp_data_destroy(p_tcp); + +} + +/** + * Destroys the data inside a tile coding parameter structure. + * + * @param p_tcp the tile coding parameter which contain data to destroy. + */ +void j2k_tcp_data_destroy (opj_tcp_v2_t *p_tcp) +{ if (p_tcp->m_data) { opj_free(p_tcp->m_data); - p_tcp->m_data = 00; + p_tcp->m_data = NULL; + p_tcp->m_data_size = 0; } } - /** * Destroys a coding parameter structure. * @@ -6803,8 +6820,11 @@ opj_bool j2k_decode_tile ( opj_j2k_v2_t * p_j2k, return OPJ_FALSE; } - j2k_tcp_destroy(l_tcp); - p_j2k->m_tcd->tcp = 0; + /* To avoid to destroy the tcp which can be useful when we try to decode a tile decoded before (cf j2k_random_tile_access) + * we destroy just the data which will be re-read in read_tile_header*/ + /*j2k_tcp_destroy(l_tcp); + p_j2k->m_tcd->tcp = 0;*/ + j2k_tcp_data_destroy(l_tcp); 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); |
