41 jas_image_t *image = NULL;
42 jas_stream_t *jpcstream;
43 jas_image_cmpt_t *pcmpt;
48 LOG((3,
"int_dec_jpeg2000 bufsize %ld out_is_g2int %d", bufsize, out_is_g2int));
57 jas_conf_set_multithread(
true);
58 if (jas_init_library())
60 if (jas_init_thread())
69 jpcstream = jas_stream_memopen(injpc, bufsize);
75 if (!(image = jas_image_decode(jpcstream, fmt, opts)))
78 pcmpt = image->cmpts_[0];
103 if (image->numcmpts_ != 1)
108 data = jas_matrix_create(jas_image_height(image), jas_image_width(image));
109 jas_image_readcmpt(image, 0, 0, 0, jas_image_width(image),
110 jas_image_height(image), data);
113 LOG((3,
"pcmpt->height_ %d pcmpt->width_ %d", pcmpt->height_, pcmpt->width_));
119 for (i = 0; i < pcmpt->height_; i++)
120 for (j = 0; j < pcmpt->width_; j++)
121 ((
g2int *)outfld)[k++] = data->rows_[i][j];
125 for (i = 0; i < pcmpt->height_; i++)
126 for (j = 0; j < pcmpt->width_; j++)
127 ((
int *)outfld)[k++] = data->rows_[i][j];
131 jas_matrix_destroy(data);
132 jas_stream_close(jpcstream);
133 jas_image_destroy(image);
137 jas_cleanup_thread();
138 jas_cleanup_library();
int g2c_dec_jpeg2000(char *injpc, size_t bufsize, int *outfld)
Decode a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using...
static int int_dec_jpeg2000(char *injpc, g2int bufsize, void *outfld, int out_is_g2int)
Decode a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using...
int dec_jpeg2000(char *injpc, g2int bufsize, g2int *outfld)
Decode a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using...