OpenJPEG  1.5.0
j2k.h
Go to the documentation of this file.
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 
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
61 #define J2K_MS_SOT 0xff90
62 #define J2K_MS_SOD 0xff93
63 #define J2K_MS_EOC 0xffd9
64 #define J2K_MS_SIZ 0xff51
65 #define J2K_MS_COD 0xff52
66 #define J2K_MS_COC 0xff53
67 #define J2K_MS_RGN 0xff5e
68 #define J2K_MS_QCD 0xff5c
69 #define J2K_MS_QCC 0xff5d
70 #define J2K_MS_POC 0xff5f
71 #define J2K_MS_TLM 0xff55
72 #define J2K_MS_PLM 0xff57
73 #define J2K_MS_PLT 0xff58
74 #define J2K_MS_PPM 0xff60
75 #define J2K_MS_PPT 0xff61
76 #define J2K_MS_SOP 0xff91
77 #define J2K_MS_EPH 0xff92
78 #define J2K_MS_CRG 0xff63
79 #define J2K_MS_COM 0xff64
80 /* UniPG>> */
81 #ifdef USE_JPWL
82 #define J2K_MS_EPC 0xff68
83 #define J2K_MS_EPB 0xff66
84 #define J2K_MS_ESD 0xff67
85 #define J2K_MS_RED 0xff69
86 #endif /* USE_JPWL */
87 #ifdef USE_JPSEC
88 #define J2K_MS_SEC 0xff65
89 #define J2K_MS_INSEC 0xff94
90 #endif /* USE_JPSEC */
91 /* <<UniPG */
92 
93 
94 /* ----------------------------------------------------------------------- */
95 
100 typedef enum J2K_STATUS {
101  J2K_STATE_MHSOC = 0x0001,
102  J2K_STATE_MHSIZ = 0x0002,
103  J2K_STATE_MH = 0x0004,
104  J2K_STATE_TPHSOT = 0x0008,
105  J2K_STATE_TPH = 0x0010,
106  J2K_STATE_MT = 0x0020,
107  J2K_STATE_NEOC = 0x0040,
108  J2K_STATE_ERR = 0x0080
109 } J2K_STATUS;
110 
111 /* ----------------------------------------------------------------------- */
112 
116 typedef enum T2_MODE {
119 }J2K_T2_MODE;
120 
124 typedef struct opj_stepsize {
126  int expn;
128  int mant;
130 
134 typedef struct opj_tccp {
136  int csty;
140  int cblkw;
142  int cblkh;
144  int cblksty;
146  int qmfbid;
148  int qntsty;
152  int numgbits;
154  int roishift;
159 } opj_tccp_t;
160 
166 typedef struct opj_tcp {
168  int first;
170  int csty;
176  int mct;
178  float rates[100];
180  int numpocs;
182  int POC;
186  unsigned char *ppt_data;
188  unsigned char *ppt_data_first;
190  int ppt;
194  int ppt_len;
196  float distoratio[100];
199 } opj_tcp_t;
200 
204 typedef struct opj_cp {
210  int img_size;
214  char tp_on;
216  char tp_flag;
218  int tp_pos;
226  int reduce;
228  int layer;
232  int tx0;
234  int ty0;
236  int tdx;
238  int tdy;
240  char *comment;
242  int tw;
244  int th;
246  int *tileno;
250  unsigned char *ppm_data;
252  unsigned char *ppm_data_first;
254  int ppm;
260  int ppm_len;
264  int *matrice;
265 /* UniPG>> */
266 #ifdef USE_JPWL
267 
278  int hprot_MH;
296  int sens_MH;
307 #endif /* USE_JPWL */
308 /* <<UniPG */
309 } opj_cp_t;
310 
314 typedef struct opj_j2k {
317 
319  int state;
323  int tp_num;
335  int totnum_tp;
340  unsigned char *eot;
353  unsigned char **tile_data;
355  int *tile_len;
369 } opj_j2k_t;
370 
373 /* ----------------------------------------------------------------------- */
391 void j2k_setup_decoder(opj_j2k_t *j2k, opj_dparameters_t *parameters);
426 void j2k_setup_encoder(opj_j2k_t *j2k, opj_cparameters_t *parameters, opj_image_t *image);
440 
441 /* ----------------------------------------------------------------------- */
445 
446 #endif /* __J2K_H */