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