11 #include "jasper/jasper.h"
22 #define SUB_NAME ENC_JPEG2000
23 #elif defined LINUXF90
24 #define SUB_NAME ENC_JPEG2000
25 #elif defined LINUXG95
26 #define SUB_NAME enc_jpeg2000__
27 #elif defined HP || defined AIX
28 #define SUB_NAME enc_jpeg2000
29 #elif defined SGI || defined LINUX || defined VPP5000 || defined APPLE
30 #define SUB_NAME enc_jpeg2000_
76 jas_stream_t *jpcstream,*istream;
77 jas_image_cmpt_t cmpt,*pcmpt;
82 #define MAXOPTSSIZE 1024
85 g2int width,height,nbits;
104 snprintf(opts,
MAXOPTSSIZE,
"mode=real\nrate=%f",1.0/(
float)*ratio);
107 strcat(opts,
"\nnumgbits=4");
118 image.brx_=(uint_fast32_t)width;
119 image.bry_=(uint_fast32_t)height;
122 image.brx_=(jas_image_coord_t)width;
123 image.bry_=(jas_image_coord_t)height;
131 image.colormodel_=JAS_IMAGE_CM_GRAY;
137 image.clrspc_=JAS_CLRSPC_SGRAY;
147 cmpt.width_=(uint_fast32_t)width;
148 cmpt.height_=(uint_fast32_t)height;
151 cmpt.width_=(jas_image_coord_t)width;
152 cmpt.height_=(jas_image_coord_t)height;
153 cmpt.type_=JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y);
157 cmpt.cps_=(nbits+7)/8;
165 istream=jas_stream_memopen((
char *)cin,height*width*cmpt.cps_);
166 cmpt.stream_=istream;
172 jpcstream=jas_stream_memopen(outjpc,(
int)(*jpclen));
177 ier=jpc_encode(&image,jpcstream,opts);
179 printf(
" jpc_encode return = %d \n",ier);
185 rwcnt=jpcstream->rwcnt_;
186 ier=jas_stream_close(istream);
187 ier=jas_stream_close(jpcstream);