OpenJPEG  1.5.1
jp2.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) 2002-2003, Yannick Verschueren
5  * Copyright (c) 2005, Herve Drolon, FreeImage Team
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in the
15  * documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 #ifndef __JP2_H
30 #define __JP2_H
31 
39 
40 #define JPIP_JPIP 0x6a706970
41 
42 #define JP2_JP 0x6a502020
43 #define JP2_FTYP 0x66747970
44 #define JP2_JP2H 0x6a703268
45 #define JP2_IHDR 0x69686472
46 #define JP2_COLR 0x636f6c72
47 #define JP2_JP2C 0x6a703263
48 #define JP2_URL 0x75726c20
49 #define JP2_DTBL 0x6474626c
50 #define JP2_BPCC 0x62706363
51 #define JP2_JP2 0x6a703220
52 #define JP2_PCLR 0x70636c72
53 #define JP2_CMAP 0x636d6170
54 #define JP2_CDEF 0x63646566
56 /* ----------------------------------------------------------------------- */
57 
60 typedef struct opj_jp2_cdef_info
61 {
62  unsigned short cn, typ, asoc;
64 
68 typedef struct opj_jp2_cdef
69 {
71  unsigned short n;
73 
77 typedef struct opj_jp2_cmap_comp
78 {
79  unsigned short cmp;
80  unsigned char mtyp, pcol;
82 
86 typedef struct opj_jp2_pclr
87 {
88  unsigned int *entries;
89  unsigned char *channel_sign;
90  unsigned char *channel_size;
92  unsigned short nr_entries, nr_channels;
94 
98 typedef struct opj_jp2_color
99 {
100  unsigned char *icc_profile_buf;
102 
105  unsigned char jp2_has_colr;
107 
111 typedef struct opj_jp2_comps {
112  int depth;
113  int sgnd;
114  int bpcc;
116 
120 typedef struct opj_jp2 {
125  unsigned int w;
126  unsigned int h;
127  unsigned int numcomps;
128  unsigned int bpc;
129  unsigned int C;
130  unsigned int UnkC;
131  unsigned int IPR;
132  unsigned int meth;
133  unsigned int approx;
134  unsigned int enumcs;
135  unsigned int precedence;
136  unsigned int brand;
137  unsigned int minversion;
138  unsigned int numcl;
139  unsigned int *cl;
141  unsigned int j2k_codestream_offset;
142  unsigned int j2k_codestream_length;
145 } opj_jp2_t;
146 
150 typedef struct opj_jp2_box {
151  int length;
152  int type;
153  int init_pos;
154 } opj_jp2_box_t;
155 
158 /* ----------------------------------------------------------------------- */
164 void jp2_write_jp2h(opj_jp2_t *jp2, opj_cio_t *cio);
190 void jp2_setup_decoder(opj_jp2_t *jp2, opj_dparameters_t *parameters);
217 void jp2_setup_encoder(opj_jp2_t *jp2, opj_cparameters_t *parameters, opj_image_t *image);
227 
228 /* ----------------------------------------------------------------------- */
232 
233 #endif /* __JP2_H */
234