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