fixed lt_version in configure.ac
[openjpeg.git] / libjp3dvm / openjpeg3d.h
1 /*\r
2  * Copyright (c) 2001-2003, David Janssens\r
3  * Copyright (c) 2002-2003, Yannick Verschueren\r
4  * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe\r
5  * Copyright (c) 2005, Herve Drolon, FreeImage Team\r
6  * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium\r
7  * Copyright (c) 2006, M�nica D�ez Garc�a, Image Processing Laboratory, University of Valladolid, Spain\r
8  * All rights reserved.\r
9  *\r
10  * Redistribution and use in source and binary forms, with or without\r
11  * modification, are permitted provided that the following conditions\r
12  * are met:\r
13  * 1. Redistributions of source code must retain the above copyright\r
14  *    notice, this list of conditions and the following disclaimer.\r
15  * 2. Redistributions in binary form must reproduce the above copyright\r
16  *    notice, this list of conditions and the following disclaimer in the\r
17  *    documentation and/or other materials provided with the distribution.\r
18  *\r
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'\r
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r
23  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
29  * POSSIBILITY OF SUCH DAMAGE.\r
30  */\r
31 #ifndef OPENJPEG_H\r
32 #define OPENJPEG_H\r
33 \r
34 /* \r
35 ==========================================================\r
36    Compiler directives\r
37 ==========================================================\r
38 */\r
39 \r
40 #if defined(OPJ_STATIC) || !defined(_WIN32)\r
41 #define OPJ_API\r
42 #define OPJ_CALLCONV\r
43 #else\r
44 #define OPJ_CALLCONV __stdcall\r
45 /*\r
46 The following ifdef block is the standard way of creating macros which make exporting \r
47 from a DLL simpler. All files within this DLL are compiled with the OPJ_EXPORTS\r
48 symbol defined on the command line. this symbol should not be defined on any project\r
49 that uses this DLL. This way any other project whose source files include this file see \r
50 OPJ_API functions as being imported from a DLL, wheras this DLL sees symbols\r
51 defined with this macro as being exported.\r
52 */\r
53 #if defined(OPJ_EXPORTS) || defined(DLL_EXPORT)\r
54 #define OPJ_API __declspec(dllexport)\r
55 #else\r
56 #define OPJ_API __declspec(dllimport)\r
57 #endif /* OPJ_EXPORTS */\r
58 #endif /* !OPJ_STATIC || !WIN32 */\r
59 \r
60 #ifndef __cplusplus\r
61 #if defined(HAVE_STDBOOL_H)\r
62 /*\r
63 The C language implementation does correctly provide the standard header\r
64 file "stdbool.h".\r
65  */\r
66 #include <stdbool.h>\r
67 #else\r
68 /*\r
69 The C language implementation does not provide the standard header file\r
70 "stdbool.h" as required by ISO/IEC 9899:1999.  Try to compensate for this\r
71 braindamage below.\r
72 */\r
73 #if !defined(bool)\r
74 #define bool    int\r
75 #endif\r
76 #if !defined(true)\r
77 #define true    1\r
78 #endif\r
79 #if !defined(false)\r
80 #define false   0\r
81 #endif\r
82 #endif\r
83 #endif /* __cplusplus */\r
84 \r
85 /* \r
86 ==========================================================\r
87    Useful constant definitions\r
88 ==========================================================\r
89 */\r
90 #ifndef MAX_SLICES\r
91 #define MAX_SLICES 300  /**< Maximum allowed size for slices */\r
92 #endif /* MAX_PATH */\r
93 \r
94 #ifndef MAX_PATH\r
95 #define MAX_PATH 260    /**< Maximum allowed size for filenames */\r
96 #endif /* MAX_PATH */\r
97 \r
98 #define J3D_MAXRLVLS 32                                 /**< Number of maximum resolution level authorized */\r
99 #define J3D_MAXBANDS (7*J3D_MAXRLVLS + 1)       /**< Number of maximum sub-band linked to number of resolution level */\r
100 \r
101 #define TINY 1.0E-20\r
102 /* \r
103 ==========================================================\r
104    enum definitions\r
105 ==========================================================\r
106 */\r
107 \r
108 #define J2K_CFMT 0\r
109 #define J3D_CFMT 1\r
110 #define LSE_CFMT 2\r
111 \r
112 #define BIN_DFMT 0\r
113 #define PGX_DFMT 1\r
114 #define IMG_DFMT 2\r
115 /* ----------------------------------------------------------------------- */\r
116 \r
117 /** Progression order */\r
118 typedef enum PROG_ORDER {\r
119 /**< place-holder */    \r
120         PROG_UNKNOWN = -1,      \r
121 /**< layer-resolution-component-precinct order */       \r
122         LRCP = 0,               \r
123 /**< resolution-layer-component-precinct order */       \r
124         RLCP = 1,               \r
125 /**< resolution-precinct-component-layer order */       \r
126         RPCL = 2,               \r
127 /**< precinct-component-resolution-layer order */       \r
128         PCRL = 3,               \r
129 /**< component-precinct-resolution-layer order */       \r
130         CPRL = 4                \r
131 } OPJ_PROG_ORDER;\r
132 \r
133 /**\r
134 Supported volume color spaces\r
135 */\r
136 typedef enum COLOR_SPACE {\r
137 /**< place-holder */    \r
138         CLRSPC_UNKNOWN = -1,    \r
139 /**< sRGB */    \r
140         CLRSPC_SRGB = 1,                \r
141 /**< grayscale */       \r
142         CLRSPC_GRAY = 2,                \r
143 /**< YUV */     \r
144         CLRSPC_SYCC = 3                 \r
145 } OPJ_COLOR_SPACE;\r
146 \r
147 /**\r
148 Supported codec\r
149 */\r
150 typedef enum CODEC_FORMAT {\r
151         /**< place-holder */\r
152         CODEC_UNKNOWN = -1,\r
153 /**< JPEG-2000 codestream : read/write */\r
154         CODEC_J2K = 0,          \r
155 /**< JPEG-2000 Part 10 file format : read/write */\r
156         CODEC_J3D = 1           \r
157 } OPJ_CODEC_FORMAT;\r
158 \r
159 /**\r
160 Supported entropy coding algorithms\r
161 */\r
162 typedef enum ENTROPY_CODING {\r
163 /**< place-holder */\r
164         ENCOD_UNKNOWN = -1,\r
165 /**< 2D EBCOT encoding */\r
166         ENCOD_2EB = 0,          \r
167 /**< 3D EBCOT encoding */\r
168         ENCOD_3EB = 1,          \r
169 /**< Golomb-Rice coding with 2D context */\r
170         ENCOD_2GR = 2,          \r
171 /**< Golomb-Rice coding with 3D context  */\r
172         ENCOD_3GR = 3           \r
173 } OPJ_ENTROPY_CODING;\r
174 \r
175 /**\r
176 Supported transforms\r
177 */\r
178 typedef enum TRANSFORM {\r
179 /**< place-holder */\r
180         TRF_UNKNOWN = -1,       \r
181 /**< 2D DWT, no transform in axial dim */\r
182         TRF_2D_DWT = 0,         \r
183 /**< 3D DWT */\r
184         TRF_3D_DWT = 1,         \r
185 /**< 3D prediction*/\r
186         TRF_3D_RLS = 2,         \r
187         TRF_3D_LSE = 3\r
188 } OPJ_TRANSFORM;\r
189 /* \r
190 ==========================================================\r
191    event manager typedef definitions\r
192 ==========================================================\r
193 */\r
194 \r
195 /**\r
196 Callback function prototype for events\r
197 @param msg Event message\r
198 @param client_data \r
199 */\r
200 typedef void (*opj_msg_callback) (const char *msg, void *client_data);\r
201 \r
202 /**\r
203 Message handler object\r
204 used for \r
205 <ul>\r
206 <li>Error messages\r
207 <li>Warning messages\r
208 <li>Debugging messages\r
209 </ul>\r
210 */\r
211 typedef struct opj_event_mgr {\r
212         /** Error message callback if available, NULL otherwise */\r
213         opj_msg_callback error_handler;\r
214         /** Warning message callback if available, NULL otherwise */\r
215         opj_msg_callback warning_handler;\r
216         /** Debug message callback if available, NULL otherwise */\r
217         opj_msg_callback info_handler;\r
218 } opj_event_mgr_t;\r
219 \r
220 \r
221 /* \r
222 ==========================================================\r
223    codec typedef definitions\r
224 ==========================================================\r
225 */\r
226 \r
227 /**\r
228 Progression order changes\r
229 */\r
230 typedef struct opj_poc {\r
231   int resno0, compno0;\r
232   int layno1, resno1, compno1;\r
233   OPJ_PROG_ORDER prg;\r
234   int tile;\r
235   char progorder[4];\r
236 } opj_poc_t;\r
237 \r
238 \r
239 /**\r
240 Compression parameters\r
241 */\r
242 typedef struct opj_cparameters {\r
243 /** size of tile: tile_size_on = false (not in argument) or = true (in argument) */\r
244         bool tile_size_on;      \r
245 /** XTOsiz */\r
246         int cp_tx0;\r
247 /** YTOsiz */\r
248         int cp_ty0;     \r
249 /** ZTOsiz */\r
250         int cp_tz0;             \r
251 \r
252 /** XTsiz */\r
253         int cp_tdx;     \r
254 /** YTsiz */\r
255         int cp_tdy;     \r
256 /** ZTsiz */\r
257         int cp_tdz;             \r
258                                                         \r
259 /** allocation by rate/distortion */\r
260         int cp_disto_alloc;             \r
261 /** allocation by fixed layer */                \r
262         int cp_fixed_alloc;             \r
263 /** add fixed_quality */        \r
264         int cp_fixed_quality;   \r
265 /** fixed layer */\r
266         int *cp_matrice;\r
267 /** number of layers */\r
268         int tcp_numlayers;\r
269 /** rates for successive layers */\r
270         float tcp_rates[100];\r
271 /** psnr's for successive layers */\r
272         float tcp_distoratio[100];      \r
273 /** comment for coding */\r
274         char *cp_comment;\r
275 /** csty : coding style */\r
276         int csty;                                       \r
277 /** DC offset (DCO) */\r
278         int dcoffset;\r
279 /** progression order (default LRCP) */\r
280         OPJ_PROG_ORDER prog_order;      \r
281 /** progression order changes */\r
282         opj_poc_t POC[J3D_MAXRLVLS-1];  \r
283 /** number of progression order changes (POC), default to 0 */\r
284         int numpocs;                            \r
285 \r
286 /** number of resolutions */\r
287         int numresolution[3];           \r
288 /** initial code block width, height and depth, default to 64 */\r
289         int cblock_init[3];                     \r
290 /** mode switch (1=BYPASS(LAZY) 2=RESET 4=RESTART(TERMALL) 8=VSC 16=ERTERM(SEGTERM) 32=SEGMARK(SEGSYM)) */\r
291         int mode;                                       \r
292 \r
293 /** 1 : use the irreversible DWT 9-7, 0 : use lossless compression (default) */\r
294         int irreversible;                       \r
295 /** WT from ATK, default to 0 (false), no of atk used */\r
296         int atk_wt[3];\r
297 /** region of interest: affected component in [0..3], -1 means no ROI */\r
298         int roi_compno;                         \r
299 /** region of interest: upshift value */\r
300         int roi_shift;                          \r
301 \r
302 /* number of precinct size specifications */\r
303         int res_spec;                           \r
304 /** initial precinct width */\r
305         int prct_init[3][J3D_MAXRLVLS]; \r
306 \r
307 /** transform format 0: 0: 2DWT, 1: 2D1P, 2: 3DWT, 3: 3RLS */\r
308         OPJ_TRANSFORM transform_format; \r
309 /** output file format 0: 2EB, 1: 3EB, 2: 2GR, 3: 3GR, 4: GRI */\r
310         OPJ_ENTROPY_CODING encoding_format;     \r
311 \r
312         /**@name command line encoder parameters (not used inside the library) */\r
313         /*@{*/\r
314         char infile[MAX_PATH];          /** input file name */\r
315         char outfile[MAX_PATH];         /** output file name */\r
316         char imgfile[MAX_PATH];         /** IMG file name for BIN volumes*/\r
317         int index_on;                           /** creation of an index file, default to 0 (false) */\r
318         char index[MAX_PATH];           /** index file name */\r
319         \r
320         int volume_offset_x0;           /** subvolume encoding: origin volume offset in x, y and z direction */\r
321         int volume_offset_y0;\r
322         int volume_offset_z0;\r
323         \r
324         int subsampling_dx;                     /** subsampling value for dx */\r
325         int subsampling_dy;\r
326         int subsampling_dz;\r
327         \r
328         int decod_format;                       /** input file format 0: BIN, 1: PGX */\r
329         int cod_format;                         /** output file format 0: JP3D */\r
330         /*@}*/\r
331 } opj_cparameters_t;\r
332 \r
333 /**\r
334 Decompression parameters\r
335 */\r
336 typedef struct opj_dparameters {\r
337 /** Set the number of highest resolution levels to be discarded. if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, volume is decoded to the full resolution */\r
338         int cp_reduce[3];               \r
339 /** Set the maximum number of quality layers to decode. if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded        */\r
340         int cp_layer;   \r
341         int bigendian;\r
342         \r
343         /**@name command line encoder parameters (not used inside the library) */\r
344         /*@{*/\r
345 /** input file name */\r
346         char infile[MAX_PATH];  \r
347 /** output file name */\r
348         char outfile[MAX_PATH]; \r
349 /** IMG file name for BIN volumes*/\r
350         char imgfile[MAX_PATH];\r
351 /** Original file name for PSNR measures*/\r
352         char original[MAX_PATH];\r
353 /** input file format 0: J2K, 1: JP3D */\r
354         int decod_format;               \r
355 /** input file format 0: BIN, 1: PGM */\r
356         int cod_format;\r
357 /** original file format 0: BIN, 1: PGM */\r
358         int orig_format;        \r
359         /*@}*/\r
360 } opj_dparameters_t;\r
361 \r
362 /** Common fields between JPEG-2000 compression and decompression master structs. */\r
363 #define opj_common_fields \\r
364         opj_event_mgr_t *event_mgr;     /**< pointer to the event manager */\\r
365         void * client_data;                     /**< Available for use by application */\\r
366         bool is_decompressor;           /**< So common code can tell which is which */\\r
367         OPJ_CODEC_FORMAT codec_format;          /**< selected codec */\\r
368         OPJ_ENTROPY_CODING encoding_format;     /**< selected entropy coding */\\r
369         OPJ_TRANSFORM transform_format;         /**< selected transform */\\r
370         void *j3d_handle                        /**< pointer to the J3D codec */\r
371         \r
372 /* Routines that are to be used by both halves of the library are declared\r
373  * to receive a pointer to this structure.  There are no actual instances of\r
374  * opj_common_struct_t, only of opj_cinfo_t and opj_dinfo_t.\r
375  */\r
376 typedef struct opj_common_struct {\r
377   opj_common_fields;            /* Fields common to both master struct types */\r
378   /* Additional fields follow in an actual opj_cinfo_t or\r
379    * opj_dinfo_t.  All three structs must agree on these\r
380    * initial fields!  (This would be a lot cleaner in C++.)\r
381    */\r
382 } opj_common_struct_t;\r
383 \r
384 typedef opj_common_struct_t * opj_common_ptr;\r
385 \r
386 /**\r
387 Compression context info\r
388 */\r
389 typedef struct opj_cinfo {\r
390         /** Fields shared with opj_dinfo_t */\r
391         opj_common_fields;      \r
392         /* other specific fields go here */\r
393 } opj_cinfo_t;\r
394 \r
395 /**\r
396 Decompression context info\r
397 */\r
398 typedef struct opj_dinfo {\r
399         /** Fields shared with opj_cinfo_t */\r
400         opj_common_fields;      \r
401         /* other specific fields go here */\r
402 } opj_dinfo_t;\r
403 \r
404 /* \r
405 ==========================================================\r
406    I/O stream typedef definitions\r
407 ==========================================================\r
408 */\r
409 \r
410 /*\r
411  * Stream open flags.\r
412  */\r
413 /** The stream was opened for reading. */\r
414 #define OPJ_STREAM_READ 0x0001\r
415 /** The stream was opened for writing. */\r
416 #define OPJ_STREAM_WRITE 0x0002\r
417 \r
418 /**\r
419 Byte input-output stream (CIO)\r
420 */\r
421 typedef struct opj_cio {\r
422 /** codec context */\r
423         opj_common_ptr cinfo;   \r
424 /** open mode (read/write) either OPJ_STREAM_READ or OPJ_STREAM_WRITE */\r
425         int openmode;                   \r
426 /** pointer to the start of the buffer */\r
427         unsigned char *buffer;  \r
428 /** buffer size in bytes */\r
429         int length;                             \r
430 /** pointer to the start of the stream */\r
431         unsigned char *start;           \r
432 /** pointer to the end of the stream */\r
433         unsigned char *end;                     \r
434 /** pointer to the current position */\r
435         unsigned char *bp;                      \r
436 } opj_cio_t;\r
437 \r
438 /* \r
439 ==========================================================\r
440    volume typedef definitions\r
441 ==========================================================\r
442 */\r
443 \r
444 /**\r
445 Defines a single volume component\r
446 */\r
447 typedef struct opj_volume_comp {\r
448 /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */\r
449         int dx; \r
450 /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */\r
451         int dy; \r
452 /** ZRsiz: vertical separation of a sample of ith component with respect to the reference grid */\r
453         int dz;\r
454 /** data width */\r
455         int w;  \r
456         /** data height */\r
457         int h;  \r
458         /** data length : no of slices */\r
459         int l;  \r
460         /** x component offset compared to the whole volume */\r
461         int x0; \r
462         /** y component offset compared to the whole volume */\r
463         int y0; \r
464         /** z component offset compared to the whole volume */\r
465         int z0; \r
466         /** precision */\r
467         int prec;       \r
468         /** volume depth in bits */\r
469         int bpp;        \r
470         /** DC offset (15444-2) */\r
471         int dcoffset;\r
472         /** signed (1) / unsigned (0) */\r
473         int sgnd;               \r
474         /** BE byte order (1) / LE byte order  (0) */\r
475         int bigendian;\r
476         /** number of decoded resolution */\r
477         int resno_decoded[3];   \r
478         /** number of division by 2 of the out volume compared to the original size of volume */\r
479         int factor[3];  \r
480         /** volume component data */\r
481         int *data;                              \r
482 } opj_volume_comp_t;\r
483 \r
484 /** \r
485 Defines volume data and characteristics\r
486 */\r
487 typedef struct opj_volume {\r
488 /** XOsiz: horizontal offset from the origin of the reference grid to the left side of the volume area */\r
489         int x0; \r
490 /** YOsiz: vertical offset from the origin of the reference grid to the top side of the volume area */\r
491         int y0; \r
492 /** ZOsiz: vertical offset from the origin of the reference grid to the top side of the volume area */\r
493         int z0; \r
494 /** Xsiz: width of the reference grid */\r
495         int x1; \r
496 /** Ysiz: height of the reference grid */\r
497         int y1; \r
498 /** Zsiz: length of the reference grid */\r
499         int z1; \r
500 /** number of components in the volume */\r
501         int numcomps;   \r
502 /** number of slices in the volume */\r
503         int numslices;  \r
504 /** color space: sRGB, Greyscale or YUV */\r
505         OPJ_COLOR_SPACE color_space;\r
506 /** volume components */\r
507         opj_volume_comp_t *comps;       \r
508 } opj_volume_t;\r
509 \r
510 /**\r
511 Component parameters structure used by the opj_volume_create function\r
512 */\r
513 typedef struct opj_volume_comptparm {\r
514         /** XRsiz: horizontal separation of a sample of ith component with respect to the reference grid */\r
515         int dx; \r
516         /** YRsiz: vertical separation of a sample of ith component with respect to the reference grid */\r
517         int dy; \r
518         /** ZRsiz: axial separation of a sample of ith component with respect to the reference grid */\r
519         int dz; \r
520         /** data width */\r
521         int w;  \r
522         /** data height */\r
523         int h;  \r
524         /** data length */\r
525         int l;  \r
526         /** x component offset compared to the whole volume */\r
527         int x0; \r
528         /** y component offset compared to the whole volume */\r
529         int y0;\r
530         /** z component offset compared to the whole volume */\r
531         int z0; \r
532         /** precision */\r
533         int prec;\r
534         /** volume depth in bits */\r
535         int bpp;        \r
536         /** signed (1) / unsigned (0) */\r
537         int sgnd;\r
538         /** DC offset*/\r
539         int dcoffset;\r
540         /** BE byte order (1) / LE byte order  (0) */\r
541         int bigendian;\r
542 } opj_volume_cmptparm_t;\r
543 \r
544 #ifdef __cplusplus\r
545 extern "C" {\r
546 #endif\r
547 \r
548 \r
549 /* \r
550 ==========================================================\r
551    openjpeg version\r
552 ==========================================================\r
553 */\r
554 \r
555 OPJ_API const char * OPJ_CALLCONV opj_version();\r
556 \r
557 /* \r
558 ==========================================================\r
559    volume functions definitions\r
560 ==========================================================\r
561 */\r
562 \r
563 /**\r
564 Create an volume\r
565 @param numcmpts number of components\r
566 @param cmptparms components parameters\r
567 @param clrspc volume color space\r
568 @return returns a new volume structure if successful, returns NULL otherwise\r
569 */\r
570 OPJ_API opj_volume_t* OPJ_CALLCONV opj_volume_create(int numcmpts, opj_volume_cmptparm_t *cmptparms, OPJ_COLOR_SPACE clrspc);\r
571 \r
572 /**\r
573 Deallocate any resources associated with an volume\r
574 @param volume volume to be destroyed\r
575 */\r
576 OPJ_API void OPJ_CALLCONV opj_volume_destroy(opj_volume_t *volume);\r
577 \r
578 /* \r
579 ==========================================================\r
580    stream functions definitions\r
581 ==========================================================\r
582 */\r
583 \r
584 /**\r
585 Open and allocate a memory stream for read / write. \r
586 On reading, the user must provide a buffer containing encoded data. The buffer will be \r
587 wrapped by the returned CIO handle. \r
588 On writing, buffer parameters must be set to 0: a buffer will be allocated by the library \r
589 to contain encoded data. \r
590 @param cinfo Codec context info\r
591 @param buffer Reading: buffer address. Writing: NULL\r
592 @param length Reading: buffer length. Writing: 0\r
593 @return Returns a CIO handle if successful, returns NULL otherwise\r
594 */\r
595 OPJ_API opj_cio_t* OPJ_CALLCONV opj_cio_open(opj_common_ptr cinfo, unsigned char *buffer, int length);\r
596 \r
597 /**\r
598 Close and free a CIO handle\r
599 @param cio CIO handle to free\r
600 */\r
601 OPJ_API void OPJ_CALLCONV opj_cio_close(opj_cio_t *cio);\r
602 \r
603 /**\r
604 Get position in byte stream\r
605 @param cio CIO handle\r
606 @return Returns the position in bytes\r
607 */\r
608 OPJ_API int OPJ_CALLCONV cio_tell(opj_cio_t *cio);\r
609 /**\r
610 Set position in byte stream\r
611 @param cio CIO handle\r
612 @param pos Position, in number of bytes, from the beginning of the stream\r
613 */\r
614 OPJ_API void OPJ_CALLCONV cio_seek(opj_cio_t *cio, int pos);\r
615 \r
616 /* \r
617 ==========================================================\r
618    event manager functions definitions\r
619 ==========================================================\r
620 */\r
621 \r
622 OPJ_API opj_event_mgr_t* OPJ_CALLCONV opj_set_event_mgr(opj_common_ptr cinfo, opj_event_mgr_t *event_mgr, void *context);\r
623 \r
624 /* \r
625 ==========================================================\r
626    codec functions definitions\r
627 ==========================================================\r
628 */\r
629 /**\r
630 Creates a J3D decompression structure\r
631 @param format Decoder to select\r
632 @return Returns a handle to a decompressor if successful, returns NULL otherwise\r
633 */\r
634 OPJ_API opj_dinfo_t* OPJ_CALLCONV opj_create_decompress(OPJ_CODEC_FORMAT format);\r
635 /**\r
636 Destroy a decompressor handle\r
637 @param dinfo decompressor handle to destroy\r
638 */\r
639 OPJ_API void OPJ_CALLCONV opj_destroy_decompress(opj_dinfo_t *dinfo);\r
640 /**\r
641 Set decoding parameters to default values\r
642 @param parameters Decompression parameters\r
643 */\r
644 OPJ_API void OPJ_CALLCONV opj_set_default_decoder_parameters(opj_dparameters_t *parameters);\r
645 /**\r
646 Setup the decoder decoding parameters using user parameters.\r
647 Decoding parameters are returned in j3d->cp. \r
648 @param dinfo decompressor handle\r
649 @param parameters decompression parameters\r
650 */\r
651 OPJ_API void OPJ_CALLCONV opj_setup_decoder(opj_dinfo_t *dinfo, opj_dparameters_t *parameters);\r
652 /**\r
653 Decode an volume from a JPEG-2000 codestream\r
654 @param dinfo decompressor handle\r
655 @param cio Input buffer stream\r
656 @return Returns a decoded volume if successful, returns NULL otherwise\r
657 */\r
658 OPJ_API opj_volume_t* OPJ_CALLCONV opj_decode(opj_dinfo_t *dinfo, opj_cio_t *cio);\r
659 /**\r
660 Creates a J3D/JP2 compression structure\r
661 @param format Coder to select\r
662 @return Returns a handle to a compressor if successful, returns NULL otherwise\r
663 */\r
664 OPJ_API opj_cinfo_t* OPJ_CALLCONV opj_create_compress(OPJ_CODEC_FORMAT format);\r
665 /**\r
666 Destroy a compressor handle\r
667 @param cinfo compressor handle to destroy\r
668 */\r
669 OPJ_API void OPJ_CALLCONV opj_destroy_compress(opj_cinfo_t *cinfo);\r
670 /**\r
671 Set encoding parameters to default values, that means : \r
672 <ul>\r
673 <li>Lossless\r
674 <li>1 tile\r
675 <li>Size of precinct : 2^15 x 2^15 (means 1 precinct)\r
676 <li>Size of code-block : 64 x 64\r
677 <li>Number of resolutions: 6\r
678 <li>No SOP marker in the codestream\r
679 <li>No EPH marker in the codestream\r
680 <li>No sub-sampling in x or y direction\r
681 <li>No mode switch activated\r
682 <li>Progression order: LRCP\r
683 <li>No index file\r
684 <li>No ROI upshifted\r
685 <li>No offset of the origin of the volume\r
686 <li>No offset of the origin of the tiles\r
687 <li>Reversible DWT 5-3\r
688 </ul>\r
689 @param parameters Compression parameters\r
690 */\r
691 OPJ_API void OPJ_CALLCONV opj_set_default_encoder_parameters(opj_cparameters_t *parameters);\r
692 /**\r
693 Setup the encoder parameters using the current volume and using user parameters. \r
694 @param cinfo compressor handle\r
695 @param parameters compression parameters\r
696 @param volume input filled volume\r
697 */\r
698 OPJ_API void OPJ_CALLCONV opj_setup_encoder(opj_cinfo_t *cinfo, opj_cparameters_t *parameters, opj_volume_t *volume);\r
699 /**\r
700 Encode an volume into a JPEG-2000 codestream\r
701 @param cinfo compressor handle\r
702 @param cio Output buffer stream\r
703 @param volume Volume to encode\r
704 @param index Name of the index file if required, NULL otherwise\r
705 @return Returns true if successful, returns false otherwise\r
706 */\r
707 OPJ_API bool OPJ_CALLCONV opj_encode(opj_cinfo_t *cinfo, opj_cio_t *cio, opj_volume_t *volume, char *index);\r
708 \r
709 #ifdef __cplusplus\r
710 }\r
711 #endif\r
712 \r
713 #endif /* OPENJPEG_H */\r