Modifications made to enable the decoding of a J2K file headers without decoding all packets using #NO_PACKETS_DECODING

Used with MJ2_to_metadata
This commit is contained in:
Francois-Olivier Devaux 2005-03-16 12:11:40 +00:00
parent 34a6c13a2d
commit 1f96f0e92a
1 changed files with 9 additions and 2 deletions

View File

@ -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]);
}