2 * Copyright (c) 1999-2000 Image Power, Inc. and the University of
4 * Copyright (c) 2001-2002 Michael David Adams.
8 /* __START_OF_JASPER_LICENSE__
10 * JasPer License Version 2.0
12 * Copyright (c) 1999-2000 Image Power, Inc.
13 * Copyright (c) 1999-2000 The University of British Columbia
14 * Copyright (c) 2001-2003 Michael David Adams
16 * All rights reserved.
18 * Permission is hereby granted, free of charge, to any person (the
19 * "User") obtaining a copy of this software and associated documentation
20 * files (the "Software"), to deal in the Software without restriction,
21 * including without limitation the rights to use, copy, modify, merge,
22 * publish, distribute, and/or sell copies of the Software, and to permit
23 * persons to whom the Software is furnished to do so, subject to the
24 * following conditions:
26 * 1. The above copyright notices and this permission notice (which
27 * includes the disclaimer below) shall be included in all copies or
28 * substantial portions of the Software.
30 * 2. The name of a copyright holder shall not be used to endorse or
31 * promote products derived from the Software without specific prior
34 * THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS
35 * LICENSE. NO USE OF THE SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER
36 * THIS DISCLAIMER. THE SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS
37 * "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
38 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
39 * PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO
40 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
41 * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
42 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
43 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
44 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. NO ASSURANCES ARE
45 * PROVIDED BY THE COPYRIGHT HOLDERS THAT THE SOFTWARE DOES NOT INFRINGE
46 * THE PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OF ANY OTHER ENTITY.
47 * EACH COPYRIGHT HOLDER DISCLAIMS ANY LIABILITY TO THE USER FOR CLAIMS
48 * BROUGHT BY ANY OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL
49 * PROPERTY RIGHTS OR OTHERWISE. AS A CONDITION TO EXERCISING THE RIGHTS
50 * GRANTED HEREUNDER, EACH USER HEREBY ASSUMES SOLE RESPONSIBILITY TO SECURE
51 * ANY OTHER INTELLECTUAL PROPERTY RIGHTS NEEDED, IF ANY. THE SOFTWARE
52 * IS NOT FAULT-TOLERANT AND IS NOT INTENDED FOR USE IN MISSION-CRITICAL
53 * SYSTEMS, SUCH AS THOSE USED IN THE OPERATION OF NUCLEAR FACILITIES,
54 * AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL
55 * SYSTEMS, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH
56 * THE FAILURE OF THE SOFTWARE OR SYSTEM COULD LEAD DIRECTLY TO DEATH,
57 * PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH
58 * RISK ACTIVITIES"). THE COPYRIGHT HOLDERS SPECIFICALLY DISCLAIM ANY
59 * EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES.
61 * __END_OF_JASPER_LICENSE__
65 * Tier-2 Coding Library
67 * $Id: jpc_t2cod.h,v 1.1 2005/05/22 18:33:05 malaterre Exp $
73 /******************************************************************************\
75 \******************************************************************************/
79 /******************************************************************************\
81 \******************************************************************************/
83 /* Progression change list. */
87 /* The number of progression changes. */
90 /* The maximum number of progression changes that can be accomodated
91 without growing the progression change array. */
94 /* The progression changes. */
99 /* Packet iterator per-resolution-level information. */
103 /* The number of precincts. */
106 /* The last layer processed for each precinct. */
109 /* The precinct width exponent. */
112 /* The precinct height exponent. */
115 /* The number of precincts spanning the resolution level in the horizontal
121 /* Packet iterator per-component information. */
125 /* The number of resolution levels. */
128 /* The per-resolution-level information. */
129 jpc_pirlvl_t *pirlvls;
131 /* The horizontal sampling period. */
134 /* The vertical sampling period. */
139 /* Packet iterator class. */
143 /* The number of layers. */
146 /* The number of resolution levels. */
149 /* The number of components. */
152 /* The per-component information. */
153 jpc_picomp_t *picomps;
155 /* The current component. */
156 jpc_picomp_t *picomp;
158 /* The current resolution level. */
159 jpc_pirlvl_t *pirlvl;
161 /* The number of the current component. */
164 /* The number of the current resolution level. */
167 /* The number of the current precinct. */
170 /* The number of the current layer. */
173 /* The x-coordinate of the current position. */
176 /* The y-coordinate of the current position. */
179 /* The horizontal step size. */
182 /* The vertical step size. */
185 /* The x-coordinate of the top-left corner of the tile on the reference
189 /* The y-coordinate of the top-left corner of the tile on the reference
193 /* The x-coordinate of the bottom-right corner of the tile on the
194 reference grid (plus one). */
197 /* The y-coordinate of the bottom-right corner of the tile on the
198 reference grid (plus one). */
201 /* The current progression change. */
204 /* The progression change list. */
205 jpc_pchglist_t *pchglist;
207 /* The progression to use in the absense of explicit specification. */
208 jpc_pchg_t defaultpchg;
210 /* The current progression change number. */
213 /* Is this the first time in the current progression volume? */
216 /* Is the current iterator value valid? */
219 /* The current packet number. */
224 /******************************************************************************\
225 * Functions/macros for packet iterators.
226 \******************************************************************************/
228 /* Create a packet iterator. */
229 jpc_pi_t *jpc_pi_create0(void);
231 /* Destroy a packet iterator. */
232 void jpc_pi_destroy(jpc_pi_t *pi);
234 /* Add a progression change to a packet iterator. */
235 int jpc_pi_addpchg(jpc_pi_t *pi, jpc_pocpchg_t *pchg);
237 /* Prepare a packet iterator for iteration. */
238 int jpc_pi_init(jpc_pi_t *pi);
240 /* Set the iterator to the first packet. */
241 int jpc_pi_begin(jpc_pi_t *pi);
243 /* Proceed to the next packet in sequence. */
244 int jpc_pi_next(jpc_pi_t *pi);
246 /* Get the index of the current packet. */
247 #define jpc_pi_getind(pi) ((pi)->pktno)
249 /* Get the component number of the current packet. */
250 #define jpc_pi_cmptno(pi) (assert(pi->valid), (pi)->compno)
252 /* Get the resolution level of the current packet. */
253 #define jpc_pi_rlvlno(pi) (assert(pi->valid), (pi)->rlvlno)
255 /* Get the layer number of the current packet. */
256 #define jpc_pi_lyrno(pi) (assert(pi->valid), (pi)->lyrno)
258 /* Get the precinct number of the current packet. */
259 #define jpc_pi_prcno(pi) (assert(pi->valid), (pi)->prcno)
261 /* Get the progression order for the current packet. */
262 #define jpc_pi_prg(pi) (assert(pi->valid), (pi)->pchg->prgord)
264 /******************************************************************************\
265 * Functions/macros for progression change lists.
266 \******************************************************************************/
268 /* Create a progression change list. */
269 jpc_pchglist_t *jpc_pchglist_create(void);
271 /* Destroy a progression change list. */
272 void jpc_pchglist_destroy(jpc_pchglist_t *pchglist);
274 /* Insert a new element into a progression change list. */
275 int jpc_pchglist_insert(jpc_pchglist_t *pchglist, int pchgno, jpc_pchg_t *pchg);
277 /* Remove an element from a progression change list. */
278 jpc_pchg_t *jpc_pchglist_remove(jpc_pchglist_t *pchglist, int pchgno);
280 /* Get an element from a progression change list. */
281 jpc_pchg_t *jpc_pchglist_get(jpc_pchglist_t *pchglist, int pchgno);
283 /* Copy a progression change list. */
284 jpc_pchglist_t *jpc_pchglist_copy(jpc_pchglist_t *pchglist);
286 /* Get the number of elements in a progression change list. */
287 int jpc_pchglist_numpchgs(jpc_pchglist_t *pchglist);
289 /******************************************************************************\
290 * Functions/macros for progression changes.
291 \******************************************************************************/
293 /* Destroy a progression change. */
294 void jpc_pchg_destroy(jpc_pchg_t *pchg);
296 /* Copy a progression change. */
297 jpc_pchg_t *jpc_pchg_copy(jpc_pchg_t *pchg);