2 * Copyright (c) 2001-2003, David Janssens
3 * Copyright (c) 2002-2003, Yannick Verschueren
4 * Copyright (c) 2003-2005, Francois Devaux and Antonin Descampe
5 * Copyright (c) 2005, Hervé Drolon, FreeImage Team
6 * Copyright (c) 2002-2005, Communications and remote sensing Laboratory, Universite catholique de Louvain, Belgium
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
35 @brief Implementation of a packet iterator (PI)
37 The functions in PI.C have for goal to realize a packet iterator that permits to get the next
38 packet following the progression order and change of it. The functions in PI.C are used
39 by some function in T2.C.
42 /** @defgroup PI PI - Implementation of a packet iterator */
48 typedef struct opj_pi_resolution {
51 } opj_pi_resolution_t;
56 typedef struct opj_pi_comp {
58 /** number of resolution levels */
60 opj_pi_resolution_t *resolutions;
66 typedef struct opj_pi_iterator {
67 /** precise if the packet has been already used (usefull for progression order change) */
69 /** layer step used to localize the packet in the include vector */
71 /** resolution step used to localize the packet in the include vector */
73 /** component step used to localize the packet in the include vector */
75 /** precinct step used to localize the packet in the include vector */
77 /** component that identify the packet */
79 /** resolution that identify the packet */
81 /** precinct that identify the packet */
83 /** layer that identify the packet */
85 /** 0 if the first packet */
87 /** progression order change information */
93 int tx0, ty0, tx1, ty1;
97 /** @name Exported functions */
99 /* ----------------------------------------------------------------------- */
101 Create a packet iterator
102 @param image Raw image for which the packets will be listed
103 @param cp Coding parameters
104 @param tileno Number that identifies the tile for which to list the packets
105 @return Returns a packet iterator that points to the first packet of the tile
108 opj_pi_iterator_t *pi_create(opj_image_t * image, opj_cp_t * cp, int tileno);
111 Destroy a packet iterator
112 @param pi Previously created packet iterator
113 @param cp Coding parameters
114 @param tileno Number that identifies the tile for which the packets were listed
117 void pi_destroy(opj_pi_iterator_t *pi, opj_cp_t *cp, int tileno);
120 Modify the packet iterator to point to the next packet
121 @param pi Packet iterator to modify
122 @return Returns false if pi pointed to the last packet or else returns true
124 bool pi_next(opj_pi_iterator_t * pi);
125 /* ----------------------------------------------------------------------- */