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