16 #include "jasper/jasper.h"
47 jas_image_t *image = NULL;
48 jas_stream_t *jpcstream;
49 jas_image_cmpt_t *pcmpt;
54 LOG((3,
"int_dec_jpeg2000 bufsize %ld out_is_g2int %d", bufsize, out_is_g2int));
63 jas_conf_set_multithread(
true);
64 if (jas_init_library())
66 if (jas_init_thread())
75 jpcstream = jas_stream_memopen(injpc, bufsize);
81 if (!(image = jas_image_decode(jpcstream, fmt, opts)))
84 pcmpt = image->cmpts_[0];
109 if (image->numcmpts_ != 1)
114 data = jas_matrix_create(jas_image_height(image), jas_image_width(image));
115 jas_image_readcmpt(image, 0, 0, 0, jas_image_width(image),
116 jas_image_height(image), data);
119 LOG((3,
"pcmpt->height_ %d pcmpt->width_ %d", pcmpt->height_, pcmpt->width_));
125 for (i = 0; i < pcmpt->height_; i++)
126 for (j = 0; j < pcmpt->width_; j++)
127 ((
g2int *)outfld)[k++] = data->rows_[i][j];
131 for (i = 0; i < pcmpt->height_; i++)
132 for (j = 0; j < pcmpt->width_; j++)
133 ((
int *)outfld)[k++] = data->rows_[i][j];
137 jas_matrix_destroy(data);
138 jas_stream_close(jpcstream);
139 jas_image_destroy(image);
143 jas_cleanup_thread();
144 jas_cleanup_library();
int g2c_dec_jpeg2000(char *injpc, size_t bufsize, int *outfld)
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i....
static int int_dec_jpeg2000(char *injpc, g2int bufsize, void *outfld, int out_is_g2int)
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i....
int dec_jpeg2000(char *injpc, g2int bufsize, g2int *outfld)
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i....
#define G2_JASPER_INIT
In enc_jpeg2000()/dec_jpeg2000() error initializing jasper library.
#define G2_JASPER_DECODE
In dec_jpeg2000() error decoding image with jasper.
#define G2C_JASPER_MAX_MEM
Maximum size for the Jasper memory buffer.
#define G2_JASPER_DECODE_COLOR
In dec_jpeg2000() decoded image had multiple color components.
int64_t g2int
Long integer type.
Header file with internal function prototypes NCEPLIBS-g2c library.
#define G2C_JASPER_JPEG_FORMAT_NAME
Name of JPEG codec in Jasper.
#define LOG(e)
Ignore logging to stdout.