diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/openjpeg-libsl/libopenjpeg/j2k.h | 525 |
1 files changed, 525 insertions, 0 deletions
diff --git a/libraries/openjpeg-libsl/libopenjpeg/j2k.h b/libraries/openjpeg-libsl/libopenjpeg/j2k.h new file mode 100644 index 0000000..c18f4cd --- /dev/null +++ b/libraries/openjpeg-libsl/libopenjpeg/j2k.h | |||
@@ -0,0 +1,525 @@ | |||
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 __J2K_H | ||
33 | #define __J2K_H | ||
34 | /** | ||
35 | @file j2k.h | ||
36 | @brief The JPEG-2000 Codestream Reader/Writer (J2K) | ||
37 | |||
38 | The functions in J2K.C have for goal to read/write the several parts of the codestream: markers and data. | ||
39 | */ | ||
40 | |||
41 | /** @defgroup J2K J2K - JPEG-2000 codestream reader/writer */ | ||
42 | /*@{*/ | ||
43 | |||
44 | #define J2K_CP_CSTY_PRT 0x01 | ||
45 | #define J2K_CP_CSTY_SOP 0x02 | ||
46 | #define J2K_CP_CSTY_EPH 0x04 | ||
47 | #define J2K_CCP_CSTY_PRT 0x01 | ||
48 | #define J2K_CCP_CBLKSTY_LAZY 0x01 | ||
49 | #define J2K_CCP_CBLKSTY_RESET 0x02 | ||
50 | #define J2K_CCP_CBLKSTY_TERMALL 0x04 | ||
51 | #define J2K_CCP_CBLKSTY_VSC 0x08 | ||
52 | #define J2K_CCP_CBLKSTY_PTERM 0x10 | ||
53 | #define J2K_CCP_CBLKSTY_SEGSYM 0x20 | ||
54 | #define J2K_CCP_QNTSTY_NOQNT 0 | ||
55 | #define J2K_CCP_QNTSTY_SIQNT 1 | ||
56 | #define J2K_CCP_QNTSTY_SEQNT 2 | ||
57 | |||
58 | /* ----------------------------------------------------------------------- */ | ||
59 | |||
60 | #define J2K_MS_SOC 0xff4f /**< SOC marker value */ | ||
61 | #define J2K_MS_SOT 0xff90 /**< SOT marker value */ | ||
62 | #define J2K_MS_SOD 0xff93 /**< SOD marker value */ | ||
63 | #define J2K_MS_EOC 0xffd9 /**< EOC marker value */ | ||
64 | #define J2K_MS_SIZ 0xff51 /**< SIZ marker value */ | ||
65 | #define J2K_MS_COD 0xff52 /**< COD marker value */ | ||
66 | #define J2K_MS_COC 0xff53 /**< COC marker value */ | ||
67 | #define J2K_MS_RGN 0xff5e /**< RGN marker value */ | ||
68 | #define J2K_MS_QCD 0xff5c /**< QCD marker value */ | ||
69 | #define J2K_MS_QCC 0xff5d /**< QCC marker value */ | ||
70 | #define J2K_MS_POC 0xff5f /**< POC marker value */ | ||
71 | #define J2K_MS_TLM 0xff55 /**< TLM marker value */ | ||
72 | #define J2K_MS_PLM 0xff57 /**< PLM marker value */ | ||
73 | #define J2K_MS_PLT 0xff58 /**< PLT marker value */ | ||
74 | #define J2K_MS_PPM 0xff60 /**< PPM marker value */ | ||
75 | #define J2K_MS_PPT 0xff61 /**< PPT marker value */ | ||
76 | #define J2K_MS_SOP 0xff91 /**< SOP marker value */ | ||
77 | #define J2K_MS_EPH 0xff92 /**< EPH marker value */ | ||
78 | #define J2K_MS_CRG 0xff63 /**< CRG marker value */ | ||
79 | #define J2K_MS_COM 0xff64 /**< COM marker value */ | ||
80 | /* UniPG>> */ | ||
81 | #ifdef USE_JPWL | ||
82 | #define J2K_MS_EPC 0xff68 /**< EPC marker value (Part11) */ | ||
83 | #define J2K_MS_EPB 0xff66 /**< EPB marker value (Part11) */ | ||
84 | #define J2K_MS_ESD 0xff67 /**< ESD marker value (Part11) */ | ||
85 | #define J2K_MS_RED 0xff69 /**< RED marker value (Part11) */ | ||
86 | #endif /* USE_JPWL */ | ||
87 | /* <<UniPG */ | ||
88 | |||
89 | /* ----------------------------------------------------------------------- */ | ||
90 | |||
91 | /** | ||
92 | Values that specify the status of the decoding process when decoding the main header. | ||
93 | These values may be combined with a | operator. | ||
94 | */ | ||
95 | typedef enum J2K_STATUS { | ||
96 | J2K_STATE_MHSOC = 0x0001, /**< a SOC marker is expected */ | ||
97 | J2K_STATE_MHSIZ = 0x0002, /**< a SIZ marker is expected */ | ||
98 | J2K_STATE_MH = 0x0004, /**< the decoding process is in the main header */ | ||
99 | J2K_STATE_TPHSOT = 0x0008, /**< the decoding process is in a tile part header and expects a SOT marker */ | ||
100 | J2K_STATE_TPH = 0x0010, /**< the decoding process is in a tile part header */ | ||
101 | J2K_STATE_MT = 0x0020, /**< the EOC marker has just been read */ | ||
102 | J2K_STATE_NEOC = 0x0040 /**< the decoding process must not expect a EOC marker because the codestream is truncated */ | ||
103 | } J2K_STATUS; | ||
104 | |||
105 | /* ----------------------------------------------------------------------- */ | ||
106 | |||
107 | /** | ||
108 | T2 encoding mode | ||
109 | */ | ||
110 | typedef enum T2_MODE { | ||
111 | THRESH_CALC = 0, /** Function called in Rate allocation process*/ | ||
112 | FINAL_PASS = 1 /** Function called in Tier 2 process*/ | ||
113 | }J2K_T2_MODE; | ||
114 | |||
115 | /** | ||
116 | Quantization stepsize | ||
117 | */ | ||
118 | typedef struct opj_stepsize { | ||
119 | /** exponent */ | ||
120 | int expn; | ||
121 | /** mantissa */ | ||
122 | int mant; | ||
123 | } opj_stepsize_t; | ||
124 | |||
125 | /** | ||
126 | Tile-component coding parameters | ||
127 | */ | ||
128 | typedef struct opj_tccp { | ||
129 | /** coding style */ | ||
130 | int csty; | ||
131 | /** number of resolutions */ | ||
132 | int numresolutions; | ||
133 | /** code-blocks width */ | ||
134 | int cblkw; | ||
135 | /** code-blocks height */ | ||
136 | int cblkh; | ||
137 | /** code-block coding style */ | ||
138 | int cblksty; | ||
139 | /** discrete wavelet transform identifier */ | ||
140 | int qmfbid; | ||
141 | /** quantisation style */ | ||
142 | int qntsty; | ||
143 | /** stepsizes used for quantization */ | ||
144 | opj_stepsize_t stepsizes[J2K_MAXBANDS]; | ||
145 | /** number of guard bits */ | ||
146 | int numgbits; | ||
147 | /** Region Of Interest shift */ | ||
148 | int roishift; | ||
149 | /** precinct width */ | ||
150 | int prcw[J2K_MAXRLVLS]; | ||
151 | /** precinct height */ | ||
152 | int prch[J2K_MAXRLVLS]; | ||
153 | } opj_tccp_t; | ||
154 | |||
155 | /** | ||
156 | Tile coding parameters : | ||
157 | this structure is used to store coding/decoding parameters common to all | ||
158 | tiles (information like COD, COC in main header) | ||
159 | */ | ||
160 | typedef struct opj_tcp { | ||
161 | /** 1 : first part-tile of a tile */ | ||
162 | int first; | ||
163 | /** coding style */ | ||
164 | int csty; | ||
165 | /** progression order */ | ||
166 | OPJ_PROG_ORDER prg; | ||
167 | /** number of layers */ | ||
168 | int numlayers; | ||
169 | /** multi-component transform identifier */ | ||
170 | int mct; | ||
171 | /** rates of layers */ | ||
172 | float rates[100]; | ||
173 | /** number of progression order changes */ | ||
174 | int numpocs; | ||
175 | /** indicates if a POC marker has been used O:NO, 1:YES */ | ||
176 | int POC; | ||
177 | /** progression order changes */ | ||
178 | opj_poc_t pocs[32]; | ||
179 | /** packet header store there for futur use in t2_decode_packet */ | ||
180 | unsigned char *ppt_data; | ||
181 | /** pointer remaining on the first byte of the first header if ppt is used */ | ||
182 | unsigned char *ppt_data_first; | ||
183 | /** If ppt == 1 --> there was a PPT marker for the present tile */ | ||
184 | int ppt; | ||
185 | /** used in case of multiple marker PPT (number of info already stored) */ | ||
186 | int ppt_store; | ||
187 | /** ppmbug1 */ | ||
188 | int ppt_len; | ||
189 | /** add fixed_quality */ | ||
190 | float distoratio[100]; | ||
191 | /** tile-component coding parameters */ | ||
192 | opj_tccp_t *tccps; | ||
193 | } opj_tcp_t; | ||
194 | |||
195 | /** | ||
196 | Coding parameters | ||
197 | */ | ||
198 | typedef struct opj_cp { | ||
199 | /** Digital cinema profile*/ | ||
200 | OPJ_CINEMA_MODE cinema; | ||
201 | /** Maximum rate for each component. If == 0, component size limitation is not considered */ | ||
202 | int max_comp_size; | ||
203 | /** Size of the image in bits*/ | ||
204 | int img_size; | ||
205 | /** Rsiz*/ | ||
206 | OPJ_RSIZ_CAPABILITIES rsiz; | ||
207 | /** Enabling Tile part generation*/ | ||
208 | char tp_on; | ||
209 | /** Flag determining tile part generation*/ | ||
210 | char tp_flag; | ||
211 | /** Position of tile part flag in progression order*/ | ||
212 | int tp_pos; | ||
213 | /** allocation by rate/distortion */ | ||
214 | int disto_alloc; | ||
215 | /** allocation by fixed layer */ | ||
216 | int fixed_alloc; | ||
217 | /** add fixed_quality */ | ||
218 | int fixed_quality; | ||
219 | /** if != 0, then original dimension divided by 2^(reduce); if == 0 or not used, image is decoded to the full resolution */ | ||
220 | int reduce; | ||
221 | /** if != 0, then only the first "layer" layers are decoded; if == 0 or not used, all the quality layers are decoded */ | ||
222 | int layer; | ||
223 | /** if == NO_LIMITATION, decode entire codestream; if == LIMIT_TO_MAIN_HEADER then only decode the main header */ | ||
224 | OPJ_LIMIT_DECODING limit_decoding; | ||
225 | /** 0 = no index || 1 = index */ | ||
226 | int index_on; | ||
227 | /** XTOsiz */ | ||
228 | int tx0; | ||
229 | /** YTOsiz */ | ||
230 | int ty0; | ||
231 | /** XTsiz */ | ||
232 | int tdx; | ||
233 | /** YTsiz */ | ||
234 | int tdy; | ||
235 | /** comment for coding */ | ||
236 | char *comment; | ||
237 | /** number of tiles in width */ | ||
238 | int tw; | ||
239 | /** number of tiles in heigth */ | ||
240 | int th; | ||
241 | /** ID number of the tiles present in the codestream */ | ||
242 | int *tileno; | ||
243 | /** size of the vector tileno */ | ||
244 | int tileno_size; | ||
245 | /** packet header store there for futur use in t2_decode_packet */ | ||
246 | unsigned char *ppm_data; | ||
247 | /** pointer remaining on the first byte of the first header if ppm is used */ | ||
248 | unsigned char *ppm_data_first; | ||
249 | /** if ppm == 1 --> there was a PPM marker for the present tile */ | ||
250 | int ppm; | ||
251 | /** use in case of multiple marker PPM (number of info already store) */ | ||
252 | int ppm_store; | ||
253 | /** use in case of multiple marker PPM (case on non-finished previous info) */ | ||
254 | int ppm_previous; | ||
255 | /** ppmbug1 */ | ||
256 | int ppm_len; | ||
257 | /** tile coding parameters */ | ||
258 | opj_tcp_t *tcps; | ||
259 | /** fixed layer */ | ||
260 | int *matrice; | ||
261 | /* UniPG>> */ | ||
262 | #ifdef USE_JPWL | ||
263 | /** enables writing of EPC in MH, thus activating JPWL */ | ||
264 | bool epc_on; | ||
265 | /** enables writing of EPB, in case of activated JPWL */ | ||
266 | bool epb_on; | ||
267 | /** enables writing of ESD, in case of activated JPWL */ | ||
268 | bool esd_on; | ||
269 | /** enables writing of informative techniques of ESD, in case of activated JPWL */ | ||
270 | bool info_on; | ||
271 | /** enables writing of RED, in case of activated JPWL */ | ||
272 | bool red_on; | ||
273 | /** error protection method for MH (0,1,16,32,37-128) */ | ||
274 | int hprot_MH; | ||
275 | /** tile number of header protection specification (>=0) */ | ||
276 | int hprot_TPH_tileno[JPWL_MAX_NO_TILESPECS]; | ||
277 | /** error protection methods for TPHs (0,1,16,32,37-128) */ | ||
278 | int hprot_TPH[JPWL_MAX_NO_TILESPECS]; | ||
279 | /** tile number of packet protection specification (>=0) */ | ||
280 | int pprot_tileno[JPWL_MAX_NO_PACKSPECS]; | ||
281 | /** packet number of packet protection specification (>=0) */ | ||
282 | int pprot_packno[JPWL_MAX_NO_PACKSPECS]; | ||
283 | /** error protection methods for packets (0,1,16,32,37-128) */ | ||
284 | int pprot[JPWL_MAX_NO_PACKSPECS]; | ||
285 | /** enables writing of ESD, (0/2/4 bytes) */ | ||
286 | int sens_size; | ||
287 | /** sensitivity addressing size (0=auto/2/4 bytes) */ | ||
288 | int sens_addr; | ||
289 | /** sensitivity range (0-3) */ | ||
290 | int sens_range; | ||
291 | /** sensitivity method for MH (-1,0-7) */ | ||
292 | int sens_MH; | ||
293 | /** tile number of sensitivity specification (>=0) */ | ||
294 | int sens_TPH_tileno[JPWL_MAX_NO_TILESPECS]; | ||
295 | /** sensitivity methods for TPHs (-1,0-7) */ | ||
296 | int sens_TPH[JPWL_MAX_NO_TILESPECS]; | ||
297 | /** enables JPWL correction at the decoder */ | ||
298 | bool correct; | ||
299 | /** expected number of components at the decoder */ | ||
300 | int exp_comps; | ||
301 | /** maximum number of tiles at the decoder */ | ||
302 | int max_tiles; | ||
303 | #endif /* USE_JPWL */ | ||
304 | /* <<UniPG */ | ||
305 | } opj_cp_t; | ||
306 | |||
307 | /** | ||
308 | Information concerning a packet inside tile | ||
309 | */ | ||
310 | typedef struct opj_packet_info { | ||
311 | /** start position */ | ||
312 | int start_pos; | ||
313 | /** end position */ | ||
314 | int end_pos; | ||
315 | /** ADD for Marcela */ | ||
316 | double disto; | ||
317 | } opj_packet_info_t; | ||
318 | |||
319 | /** | ||
320 | Index structure : information regarding tiles inside image | ||
321 | */ | ||
322 | typedef struct opj_tile_info { | ||
323 | /** value of thresh for each layer by tile cfr. Marcela */ | ||
324 | double *thresh; | ||
325 | /** number of tile */ | ||
326 | int num_tile; | ||
327 | /** start position */ | ||
328 | int start_pos; | ||
329 | /** end position of the header */ | ||
330 | int end_header; | ||
331 | /** end position */ | ||
332 | int end_pos; | ||
333 | /** precinct number for each resolution level (width) */ | ||
334 | int pw[33]; | ||
335 | /** precinct number for each resolution level (height) */ | ||
336 | int ph[33]; | ||
337 | /** precinct size (in power of 2), in X for each resolution level */ | ||
338 | int pdx[33]; | ||
339 | /** precinct size (in power of 2), in Y for each resolution level */ | ||
340 | int pdy[33]; | ||
341 | /** information concerning packets inside tile */ | ||
342 | opj_packet_info_t *packet; | ||
343 | /** add fixed_quality */ | ||
344 | int nbpix; | ||
345 | /** add fixed_quality */ | ||
346 | double distotile; | ||
347 | } opj_tile_info_t; | ||
348 | |||
349 | /** | ||
350 | Index structure | ||
351 | */ | ||
352 | typedef struct opj_image_info { | ||
353 | /** 0 = no index || 1 = index */ | ||
354 | int index_on; | ||
355 | /** maximum distortion reduction on the whole image (add for Marcela) */ | ||
356 | double D_max; | ||
357 | /** packet number */ | ||
358 | int num; | ||
359 | /** writing the packet in the index with t2_encode_packets */ | ||
360 | int index_write; | ||
361 | /** image width */ | ||
362 | int image_w; | ||
363 | /** image height */ | ||
364 | int image_h; | ||
365 | /** progression order */ | ||
366 | OPJ_PROG_ORDER prog; | ||
367 | /** tile size in x */ | ||
368 | int tile_x; | ||
369 | /** tile size in y */ | ||
370 | int tile_y; | ||
371 | /** */ | ||
372 | int tile_Ox; | ||
373 | /** */ | ||
374 | int tile_Oy; | ||
375 | /** number of tiles in X */ | ||
376 | int tw; | ||
377 | /** number of tiles in Y */ | ||
378 | int th; | ||
379 | /** component numbers */ | ||
380 | int comp; | ||
381 | /** number of layer */ | ||
382 | int layer; | ||
383 | /** number of decomposition */ | ||
384 | int decomposition; | ||
385 | /** main header position */ | ||
386 | int main_head_end; | ||
387 | /** codestream's size */ | ||
388 | int codestream_size; | ||
389 | /** information regarding tiles inside image */ | ||
390 | opj_tile_info_t *tile; | ||
391 | } opj_image_info_t; | ||
392 | |||
393 | /** | ||
394 | JPEG-2000 codestream reader/writer | ||
395 | */ | ||
396 | typedef struct opj_j2k { | ||
397 | /** codec context */ | ||
398 | opj_common_ptr cinfo; | ||
399 | |||
400 | /** locate in which part of the codestream the decoder is (main header, tile header, end) */ | ||
401 | int state; | ||
402 | /** number of the tile curently concern by coding/decoding */ | ||
403 | int curtileno; | ||
404 | /** Tile part number*/ | ||
405 | int tp_num; | ||
406 | /** Tilepart number currently coding*/ | ||
407 | int cur_tp_num; | ||
408 | /** Total number of tileparts of the current tile*/ | ||
409 | int *cur_totnum_tp; | ||
410 | /** | ||
411 | locate the start position of the TLM marker | ||
412 | after encoding the tilepart, a jump (in j2k_write_sod) is done to the TLM marker to store the value of its length. | ||
413 | */ | ||
414 | int tlm_start; | ||
415 | /** Total num of tile parts in whole image = num tiles* num tileparts in each tile*/ | ||
416 | /** used in TLMmarker*/ | ||
417 | int totnum_tp; | ||
418 | /** | ||
419 | locate the position of the end of the tile in the codestream, | ||
420 | used to detect a truncated codestream (in j2k_read_sod) | ||
421 | */ | ||
422 | unsigned char *eot; | ||
423 | /** | ||
424 | locate the start position of the SOT marker of the current coded tile: | ||
425 | after encoding the tile, a jump (in j2k_write_sod) is done to the SOT marker to store the value of its length. | ||
426 | */ | ||
427 | int sot_start; | ||
428 | int sod_start; | ||
429 | /** | ||
430 | as the J2K-file is written in several parts during encoding, | ||
431 | it enables to make the right correction in position return by cio_tell | ||
432 | */ | ||
433 | int pos_correction; | ||
434 | /** array used to store the data of each tile */ | ||
435 | unsigned char **tile_data; | ||
436 | /** array used to store the length of each tile */ | ||
437 | int *tile_len; | ||
438 | /** | ||
439 | decompression only : | ||
440 | store decoding parameters common to all tiles (information like COD, COC in main header) | ||
441 | */ | ||
442 | opj_tcp_t *default_tcp; | ||
443 | /** pointer to the encoded / decoded image */ | ||
444 | opj_image_t *image; | ||
445 | /** pointer to the coding parameters */ | ||
446 | opj_cp_t *cp; | ||
447 | /** helper used to write the index file */ | ||
448 | opj_image_info_t *image_info; | ||
449 | /** pointer to the byte i/o stream */ | ||
450 | opj_cio_t *cio; | ||
451 | } opj_j2k_t; | ||
452 | |||
453 | /** @name Exported functions */ | ||
454 | /*@{*/ | ||
455 | /* ----------------------------------------------------------------------- */ | ||
456 | /** | ||
457 | Creates a J2K decompression structure | ||
458 | @param cinfo Codec context info | ||
459 | @return Returns a handle to a J2K decompressor if successful, returns NULL otherwise | ||
460 | */ | ||
461 | opj_j2k_t* j2k_create_decompress(opj_common_ptr cinfo); | ||
462 | /** | ||
463 | Destroy a J2K decompressor handle | ||
464 | @param j2k J2K decompressor handle to destroy | ||
465 | */ | ||
466 | void j2k_destroy_decompress(opj_j2k_t *j2k); | ||
467 | /** | ||
468 | Setup the decoder decoding parameters using user parameters. | ||
469 | Decoding parameters are returned in j2k->cp. | ||
470 | @param j2k J2K decompressor handle | ||
471 | @param parameters decompression parameters | ||
472 | */ | ||
473 | void j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters); | ||
474 | /** | ||
475 | Decode an image from a JPEG-2000 codestream | ||
476 | @param j2k J2K decompressor handle | ||
477 | @param cio Input buffer stream | ||
478 | @return Returns a decoded image if successful, returns NULL otherwise | ||
479 | */ | ||
480 | opj_image_t* j2k_decode(opj_j2k_t *j2k, opj_cio_t *cio); | ||
481 | /** | ||
482 | Decode an image form a JPT-stream (JPEG 2000, JPIP) | ||
483 | @param j2k J2K decompressor handle | ||
484 | @param cio Input buffer stream | ||
485 | @return Returns a decoded image if successful, returns NULL otherwise | ||
486 | */ | ||
487 | opj_image_t* j2k_decode_jpt_stream(opj_j2k_t *j2k, opj_cio_t *cio); | ||
488 | /** | ||
489 | Creates a J2K compression structure | ||
490 | @param cinfo Codec context info | ||
491 | @return Returns a handle to a J2K compressor if successful, returns NULL otherwise | ||
492 | */ | ||
493 | opj_j2k_t* j2k_create_compress(opj_common_ptr cinfo); | ||
494 | /** | ||
495 | Destroy a J2K compressor handle | ||
496 | @param j2k J2K compressor handle to destroy | ||
497 | */ | ||
498 | void j2k_destroy_compress(opj_j2k_t *j2k); | ||
499 | /** | ||
500 | Setup the encoder parameters using the current image and using user parameters. | ||
501 | Coding parameters are returned in j2k->cp. | ||
502 | @param j2k J2K compressor handle | ||
503 | @param parameters compression parameters | ||
504 | @param image input filled image | ||
505 | */ | ||
506 | void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image); | ||
507 | /** | ||
508 | Converts an enum type progression order to string type | ||
509 | */ | ||
510 | char *j2k_convert_progression_order(OPJ_PROG_ORDER prg_order); | ||
511 | /** | ||
512 | Encode an image into a JPEG-2000 codestream | ||
513 | @param j2k J2K compressor handle | ||
514 | @param cio Output buffer stream | ||
515 | @param image Image to encode | ||
516 | @param index Name of the index file if required, NULL otherwise | ||
517 | @return Returns true if successful, returns false otherwise | ||
518 | */ | ||
519 | bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio, opj_image_t *image, char *index); | ||
520 | /* ----------------------------------------------------------------------- */ | ||
521 | /*@}*/ | ||
522 | |||
523 | /*@}*/ | ||
524 | |||
525 | #endif /* __J2K_H */ | ||