Previous version reloaded

This commit is contained in:
Antonin Descampe 2004-07-16 10:27:27 +00:00
parent 47dfe606bd
commit 70ed4ae986
2 changed files with 13 additions and 12 deletions

View File

@ -1096,7 +1096,7 @@ j2k_dec_mstabent_t *j2k_dec_mstab_lookup(int id) {
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;
}

View File

@ -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;