1libopenjpeg(3) Oct 2010 libopenjpeg(3)
2
3
4
6 libopenjpeg - a library for reading and writing JPEG2000 image files.
7
8
10 #include <openjpeg.h>
11
12 CONVERSION FORMATS
13 PGX: imagetopgx() / pgxtoimage()
14
15 PXM: imagetopnm() / pnmtoimage()
16
17 BMP: imagetobmp() / bmptoimage()
18
19 TIF: imagetotif() / tiftoimage()
20
21 RAW: imagetoraw() / rawtoimage()
22
23 TGA: imagetotga() / tgatoimage()
24
25 PNG: imagetopng() / pngtoimage()
26
27 YUV: imagetoyuv() / yuvtoimage() (MJ2)
28
29 READ
30 opj_set_default_decoder_parameters(opj_dparameters_t *params);
31
32 opj_dinfo_t *opj_create_decompress(OPJ_CODEC_FORMAT format);
33
34 opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr info, opj_event_mgr_t
35 *event_mgr, void *context);
36
37 void opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t * params);
38
39 opj_cio_t *opj_cio_open(opj_common_ptr info, unsigned char *buf, int
40 buf_len);
41
42 opj_image_t *opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio);
43
44 void opj_cio_close(opj_cio_t *cio);
45
46 void opj_destroy_decompress(opj_dinfo_t *dinfo);
47
48 void opj_image_destroy(opj_image_t *image);
49
50 WRITE
51 void opj_set_default_encoder_parameters(opj_cparameters_t *params);
52
53 /* opj_image_t *FORMATtoimage(const char *fname, opj_cparameters_t
54 *params);
55
56 */
57 opj_cinfo_t* opj_create_compress(OPJ_CODEC_FORMAT format);
58
59 opj_event_mgr_t *opj_set_event_mgr(opj_common_ptr info, opj_event_mgr_t
60 *event_mgr, void *context);
61
62 void opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *params,
63 opj_image_t *image);
64
65 opj_cio_t *opj_cio_open(opj_common_ptr cinfo, NULL, 0);
66
67 bool opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_image_t *image,
68 char *index);
69
70 void opj_cio_close(opj_cio_t *cio);
71
72 void opj_destroy_compress(opj_cinfo_t *cinfo);
73
74 void opj_image_destroy(opj_image_t *image);
75
76 GENERAL
77 void opj_image_create(int numcmpts, opj_image_cmptparm_t *cmptparms,
78 OPJ_COLOR_SPACE clrspc);
79
80 int cio_tell(opj_cio_t *cio);
81
82 void cio_seek(opj_cio_t *cio, int pos);
83
84 opj_image_t *opj_decode_with_info(opj_dinfo_t *dinfo, opj_cio_t *cio,
85 opj_codestream_info_t *cstr_info);
86
87 bool opj_encode_with_info(opj_cinfo_t *cinfo, opj_cio_t *cio,
88 opj_image_t *image, opj_codestream_info_t *cstr_info);
89
90 void opj_destroy_cstr_info(opj_codestream_info_t *cstr_info);
91
92 const char *opj_version(void);
93
95 CODEC_J2K or CODEC_JPT or CODEC_JP2
96
98 CLRSPC_UNKNOWN or CLRSPC_UNSPECIFIED or CLRSPC_SRGB or CLRSPC_GRAY or
99 CLRSPC_SYCC
100
102 typedef struct opj_dparameters
103 {
104 /*
105 Set the number of highest resolution levels to be discarded.
106 The image resolution is effectively divided by 2 to the power
107 of the number of discarded levels.
108 The reduce factor is limited by the smallest total number of
109 decomposition levels among tiles.
110 if != 0, then original dimension divided by 2^(reduce);
111 if == 0 or not used, image is decoded to the full resolution
112 */
113 int cp_reduce;
114 /*
115 Set the maximum number of quality layers to decode.
116 If there are less quality layers than the specified number,
117 all the quality layers are decoded.
118 if != 0, then only the first "layer" layers are decoded;
119 if == 0 or not used, all the quality layers are decoded
120 */
121 int cp_layer;
122
123 /*command line encoder parameters (not used inside the library) */
124 /* input file name */
125 char infile[OPJ_PATH_LEN];
126 /* output file name */
127 char outfile[OPJ_PATH_LEN];
128 /* input file format: see OPJ_CODEC_FORMAT */
129 int decod_format;
130 /* output file format */
131 int cod_format;
132
133 /*JPWL decoding parameters */
134 /* activates the JPWL correction capabilities */
135 bool jpwl_correct;
136 /* expected number of components */
137 int jpwl_exp_comps;
138 /* maximum number of tiles */
139 int jpwl_max_tiles;
140
141 /*
142 Specify whether the decoding should be done on the entire
143 codestream, or be limited to the main header
144 Limiting the decoding to the main header makes it possible
145 to extract the characteristics of the codestream
146 if == NO_LIMITATION, the entire codestream is decoded;
147 if == LIMIT_TO_MAIN_HEADER, only the main header is decoded;
148 */
149 OPJ_LIMIT_DECODING cp_limit_decoding;
150 } opj_dparameters_t;
151
152
154 typedef struct opj_cparameters
155 {
156 /* size of tile: tile_size_on = false (not in argument)
157 or tile_size_on = true (in argument) */
158 bool tile_size_on;
159 /* XTOsiz */
160 int cp_tx0;
161 /* YTOsiz */
162 int cp_ty0;
163 /* XTsiz */
164 int cp_tdx;
165 /* YTsiz */
166 int cp_tdy;
167 /* allocation by rate/distortion */
168 int cp_disto_alloc;
169 /* allocation by fixed layer */
170 int cp_fixed_alloc;
171 /* add fixed_quality */
172 int cp_fixed_quality;
173 /* fixed layer */
174 int *cp_matrice;
175 /* comment for coding */
176 char *cp_comment;
177 /* coding style */
178 int csty;
179 /* progression order:
180 PROG_UNKNOWN, LRCP(default), RLCP, RPCL, PCRL, CPRL */
181 OPJ_PROG_ORDER prog_order;
182 /* progression order changes */
183 opj_poc_t POC[32];
184 /* number of progression order changes (POC), default: 0 */
185 int numpocs;
186 /* number of layers */
187 int tcp_numlayers;
188 /* rates of layers */
189 float tcp_rates[100];
190 /* different psnr for successive layers */
191 float tcp_distoratio[100];
192 /* number of resolutions */
193 int numresolution;
194 /* initial code block width, default: 64 */
195 int cblockw_init;
196 /* initial code block height, default: 64 */
197 int cblockh_init;
198 /* mode switch (cblk_style) */
199 /* 1 : use the irreversible DWT 9-7,
200 0 : use lossless compression (default) */
201 int irreversible;
202 /* region of interest: affected component in [0..3],
203 -1 means no ROI */
204 int roi_compno;
205 /* region of interest: upshift value */
206 int roi_shift;
207 /* number of precinct size specifications */
208 int res_spec;
209 /* initial precinct width */
210 int prcw_init[J2K_MAXRLVLS];
211 /* initial precinct height */
212 int prch_init[J2K_MAXRLVLS];
213
214 /*command line encoder parameters (not used inside the library) */
215 /* input file name */
216 char infile[OPJ_PATH_LEN];
217 /* output file name */
218 char outfile[OPJ_PATH_LEN];
219 /* DEPRECATED. Index generation is now handeld with the
220 opj_encode_with_info() function. Set to NULL */
221 int index_on;
222 /* DEPRECATED. Index generation is now handeld with the
223 opj_encode_with_info() function. Set to NULL */
224 char index[OPJ_PATH_LEN];
225 /* subimage encoding: origin image offset in x direction */
226 int image_offset_x0;
227 /* subimage encoding: origin image offset in y direction */
228 int image_offset_y0;
229 /* subsampling value for dx */
230 int subsampling_dx;
231 /* subsampling value for dy */
232 int subsampling_dy;
233 /* input file format */
234 int decod_format;
235 /* output file format: see OPJ_CODEC_FORMAT */
236 int cod_format;
237
238 /*JPWL encoding parameters */
239 /* enables writing of EPC in MH, thus activating JPWL */
240 bool jpwl_epc_on;
241 /* error protection method for MH (0,1,16,32,37-128) */
242 int jpwl_hprot_MH;
243 /* tile number of header protection specification (>=0) */
244 int jpwl_hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS];
245 /* error protection methods for TPHs (0,1,16,32,37-128) */
246 int jpwl_hprot_TPH[JPWL_MAX_NO_TILESPECS];
247 /* tile number of packet protection specification (>=0) */
248 int jpwl_pprot_tileno[JPWL_MAX_NO_PACKSPECS];
249 /* packet number of packet protection specification (>=0) */
250 int jpwl_pprot_packno[JPWL_MAX_NO_PACKSPECS];
251 /* error protection methods for packets (0,1,16,32,37-128) */
252 int jpwl_pprot[JPWL_MAX_NO_PACKSPECS];
253 /* enables writing of ESD, (0=no/1/2 bytes) */
254 int jpwl_sens_size;
255 /* sensitivity addressing size (0=auto/2/4 bytes) */
256 int jpwl_sens_addr;
257 /* sensitivity range (0-3) */
258 int jpwl_sens_range;
259 /* sensitivity method for MH (-1=no,0-7) */
260 int jpwl_sens_MH;
261 /* tile number of sensitivity specification (>=0) */
262 int jpwl_sens_TPH_tileno[JPWL_MAX_NO_TILESPECS];
263 /* sensitivity methods for TPHs (-1=no,0-7) */
264 int jpwl_sens_TPH[JPWL_MAX_NO_TILESPECS];
265
266 /* Digital Cinema compliance: OFF-not compliant,
267 CINEMA2K_24, CINEMA2K_48, CINEMA4K_24 */
268 OPJ_CINEMA_MODE cp_cinema;
269 /* Maximum rate for each component.
270 If == 0, component size limitation is not considered */
271 int max_comp_size;
272 /* Profile name*/
273 OPJ_RSIZ_CAPABILITIES cp_rsiz;
274 /* Tile part generation*/
275 char tp_on;
276 /* Flag for Tile part generation*/
277 char tp_flag;
278 /* MCT (multiple component transform) */
279 char tcp_mct;
280 } opj_cparameters_t;
281
282
283
285 Copyright (c) 2002-2007, Communications and Remote Sensing Laboratory,
286 Universite catholique de Louvain (UCL), Belgium
287
288 Copyright (c) 2002-2007, Professor Benoit Macq
289
290 Copyright (c) 2001-2003, David Janssens
291
292 Copyright (c) 2002-2003, Yannick Verschueren
293
294 Copyright (c) 2003-2007, Francois-Olivier Devaux and Antonin Descampe
295
296 Copyright (c) 2005, Herve Drolon, FreeImage Team
297
298 Copyright (c) 2006-2007, Parvatha Elangovan
299
300
302 image_to_j2k(1) j2k_to_image(1) j2k_dump(1)
303
304 JPWL_image_to_j2k(1) JPWL_j2k_to_image(1)
305
306 extract_j2k_from_mj2(1) wrap_j2k_in_mj2(1) frames_to_mj2(1)
307 mj2_to_frames(1)
308
309
310
311Version 1.4.0 Oct 2010 libopenjpeg(3)