From 70ed4ae9861cfb75b0ca8c65bac77dcaf6a2af16 Mon Sep 17 00:00:00 2001 From: Antonin Descampe Date: Fri, 16 Jul 2004 10:27:27 +0000 Subject: [PATCH] Previous version reloaded --- indexer_JPIP/index_create.c | 22 ++++++++++++---------- indexer_JPIP/j2k.h | 3 +-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/indexer_JPIP/index_create.c b/indexer_JPIP/index_create.c index 9aaa8fc4..e7161967 100644 --- a/indexer_JPIP/index_create.c +++ b/indexer_JPIP/index_create.c @@ -1087,16 +1087,16 @@ j2k_dec_mstabent_t j2k_dec_mstab[]={ }; j2k_dec_mstabent_t *j2k_dec_mstab_lookup(int id) { - j2k_dec_mstabent_t *e; - for (e = j2k_dec_mstab; e->id != 0; e++) { - if (e->id == id) { - break; - } + j2k_dec_mstabent_t *e; + for (e = j2k_dec_mstab; e->id != 0; e++) { + if (e->id == id) { + break; } - return e; + } + return e; } -int j2k_decode(unsigned char *src, int len, j2k_image_t *image, j2k_cp_t *cp) { +int j2k_decode(unsigned char *src, int len, j2k_image_t **image, j2k_cp_t **cp) { if (setjmp(j2k_error)) { if (j2k_state != J2K_STATE_MT) { fprintf(stderr, "WARNING: incomplete bitstream\n"); @@ -1104,8 +1104,10 @@ int j2k_decode(unsigned char *src, int len, j2k_image_t *image, j2k_cp_t *cp) { } return cio_numbytes(); } - j2k_img = image; - j2k_cp = cp; + j2k_img = (j2k_image_t*)calloc(1, sizeof(j2k_image_t)); + j2k_cp = (j2k_cp_t*)calloc(1, sizeof(j2k_cp_t)); + *image = j2k_img; + *cp = j2k_cp; j2k_state = J2K_STATE_MHSOC; cio_init(src, len); for (;;) { @@ -1193,7 +1195,7 @@ int main(int argc, char **argv) /* decode */ - if (!j2k_decode(j2kfile, totlen, imgg, cp)) { + if (!j2k_decode(j2kfile, totlen, &imgg, &cp)) { fprintf(stderr, "Index_creator: failed to decode image!\n"); return 1; } diff --git a/indexer_JPIP/j2k.h b/indexer_JPIP/j2k.h index a6a8fbdf..5ead3b45 100644 --- a/indexer_JPIP/j2k.h +++ b/indexer_JPIP/j2k.h @@ -72,6 +72,7 @@ typedef struct { int x0, y0; /* XOsiz, YOsiz */ int x1, y1; /* Xsiz, Ysiz */ int numcomps; /* number of components */ + int index_on; /* 0 = no index || 1 = index */ j2k_comp_t *comps; /* image-components */ } j2k_image_t; @@ -104,7 +105,6 @@ typedef struct { } j2k_poc_t; typedef struct { - //int first; int csty; /* coding style */ int prg; /* progression order */ int numlayers; /* number of layers */ @@ -127,7 +127,6 @@ typedef struct { int ppm; /* If ppm == 1 --> there was a PPM marker for the present tile */ int ppm_store; /* Use in case of multiple marker PPM (number of info already store) */ int ppm_previous; /* Use in case of multiple marker PPM (case on non-finished previous info) */ - int index_on; /* 0 = no index || 1 = index */ j2k_tcp_t *tcps; /* tile coding parameters */ } j2k_cp_t;