svn-gvsig-desktop / tags / v2_0_Build_1212 / libraries / libjni-readecw-linux / include / NCSJPCPrecinct.h @ 41849
History | View | Annotate | Download (7.62 KB)
1 |
/********************************************************
|
---|---|
2 |
** Copyright 2003 Earth Resource Mapping Ltd.
|
3 |
** This document contains proprietary source code of
|
4 |
** Earth Resource Mapping Ltd, and can only be used under
|
5 |
** one of the three licenses as described in the
|
6 |
** license.txt file supplied with this distribution.
|
7 |
** See separate license.txt file for license details
|
8 |
** and conditions.
|
9 |
**
|
10 |
** This software is covered by US patent #6,442,298,
|
11 |
** #6,102,897 and #6,633,688. Rights to use these patents
|
12 |
** is included in the license agreements.
|
13 |
**
|
14 |
** FILE: $Archive: /NCS/Source/include/NCSJPCPrecinct.h $
|
15 |
** CREATED: 11/02/2003 3:27:34 PM
|
16 |
** AUTHOR: Simon Cope
|
17 |
** PURPOSE: CNCSJPCPrecinct class header
|
18 |
** EDITS: [xx] ddMmmyy NAME COMMENTS
|
19 |
*******************************************************/
|
20 |
|
21 |
#ifndef NCSJPCPRECINCT_H
|
22 |
#define NCSJPCPRECINCT_H
|
23 |
|
24 |
#ifndef NCSJPCSUBBAND_H
|
25 |
#include "NCSJPCSubBand.h" |
26 |
#endif // NCSJPCSUBBAND_H |
27 |
#ifndef NCSJPCNODE_H
|
28 |
#include "NCSJPCNode.h" |
29 |
#endif // NCSJPCNODE_H |
30 |
#include "NCSJPCProgression.h" |
31 |
|
32 |
/**
|
33 |
* CNCSJPCPrecinct class - the JPC codestream Precinct.
|
34 |
*
|
35 |
* @author Simon Cope
|
36 |
* @version $Revision: 1458 $ $Author: igbrotru $ $Date: 2005-02-15 08:52:16 +0100 (Tue, 15 Feb 2005) $
|
37 |
*/
|
38 |
class NCSJPC_EXPORT_ALL CNCSJPCPrecinct: public CNCSJPCNode { |
39 |
public:
|
40 |
/** Resolution level for this precinct */
|
41 |
class CNCSJPCResolution *m_pResolution; |
42 |
/** Precinct number within this resolution */
|
43 |
UINT32 m_nPrecinct; |
44 |
|
45 |
/** SubBands in this precinct */
|
46 |
CNCSJPCSubBand *m_SubBands[4];
|
47 |
|
48 |
/** Packet number for each layer in this precinct */
|
49 |
std::vector<UINT32> m_Packets; |
50 |
|
51 |
UINT16 m_nProgressionLayer; |
52 |
/** Precinct has zero width or height */
|
53 |
bool m_bZeroSize;
|
54 |
/**
|
55 |
* Constructor
|
56 |
* @param pResolution Parent resolution level
|
57 |
* @param nPrecinct Precinct number within resolution level
|
58 |
*/
|
59 |
CNCSJPCPrecinct(class CNCSJPCResolution *pResolution, UINT32 nPrecinct, bool bCreateSubBands = false); |
60 |
/** Virtual destructor */
|
61 |
virtual ~CNCSJPCPrecinct(); |
62 |
|
63 |
/**
|
64 |
* Get X0 of specified precinct.
|
65 |
* @param pResolution Parent resolution level
|
66 |
* @param nPrecinct Precinct number within resolution level
|
67 |
* @return INT32 Coordinate value.
|
68 |
*/
|
69 |
static INT32 GetX0(CNCSJPCResolution *pResolution, INT32 nPrecinct);
|
70 |
/**
|
71 |
* Get X0 of specified precinct.
|
72 |
* @param pResolution Parent resolution level
|
73 |
* @param nPrecinctX Precinct X within resolution level
|
74 |
* @param nPrecinctY Precinct Y within resolution level
|
75 |
* @return INT32 Coordinate value.
|
76 |
*/
|
77 |
static INT32 GetX0(CNCSJPCResolution *pResolution, INT32 nPrecinctX, INT32 nPrecinctY);
|
78 |
|
79 |
/**
|
80 |
* Get X0 of this node.
|
81 |
* @return INT32 Coordinate value.
|
82 |
*/
|
83 |
virtual INT32 GetX0(); |
84 |
|
85 |
/**
|
86 |
* Get Y0 of specified precinct.
|
87 |
* @param pResolution Parent resolution level
|
88 |
* @param nPrecinct Precinct number within resolution level
|
89 |
* @return INT32 Coordinate value.
|
90 |
*/
|
91 |
static INT32 GetY0(CNCSJPCResolution *pResolution, INT32 nPrecinct);
|
92 |
/**
|
93 |
* Get Y0 of specified precinct.
|
94 |
* @param pResolution Parent resolution level
|
95 |
* @param nPrecinctX Precinct X within resolution level
|
96 |
* @param nPrecinctY Precinct Y within resolution level
|
97 |
* @return INT32 Coordinate value.
|
98 |
*/
|
99 |
static INT32 GetY0(CNCSJPCResolution *pResolution, INT32 nPrecinctX, INT32 nPrecinctY);
|
100 |
|
101 |
/**
|
102 |
* Get Y0 of this node.
|
103 |
* @return INT32 Coordinate value.
|
104 |
*/
|
105 |
virtual INT32 GetY0(); |
106 |
|
107 |
/**
|
108 |
* Get X1 of specified precinct.
|
109 |
* @param pResolution Parent resolution level
|
110 |
* @param nPrecinct Precinct number within resolution level
|
111 |
* @return INT32 Coordinate value.
|
112 |
*/
|
113 |
static INT32 GetX1(CNCSJPCResolution *pResolution, INT32 nPrecinct);
|
114 |
/**
|
115 |
* Get X1 of specified precinct.
|
116 |
* @param pResolution Parent resolution level
|
117 |
* @param nPrecinctX Precinct X within resolution level
|
118 |
* @param nPrecinctY Precinct Y within resolution level
|
119 |
* @return INT32 Coordinate value.
|
120 |
*/
|
121 |
static INT32 GetX1(CNCSJPCResolution *pResolution, INT32 nPrecinctX, INT32 nPrecinctY);
|
122 |
/**
|
123 |
* Get X1 of this node.
|
124 |
* @return INT32 Coordinate value.
|
125 |
*/
|
126 |
virtual INT32 GetX1(); |
127 |
/**
|
128 |
* Get Y1 of specified precinct.
|
129 |
* @param pResolution Parent resolution level
|
130 |
* @param nPrecinct Precinct number within resolution level
|
131 |
* @return INT32 Coordinate value.
|
132 |
*/
|
133 |
static INT32 GetY1(CNCSJPCResolution *pResolution, INT32 nPrecinct);
|
134 |
/**
|
135 |
* Get Y1 of specified precinct.
|
136 |
* @param pResolution Parent resolution level
|
137 |
* @param nPrecinctX Precinct X within resolution level
|
138 |
* @param nPrecinctY Precinct Y within resolution level
|
139 |
* @return INT32 Coordinate value.
|
140 |
*/
|
141 |
static INT32 GetY1(CNCSJPCResolution *pResolution, INT32 nPrecinctX, INT32 nPrecinctY);
|
142 |
|
143 |
/**
|
144 |
* Get Y1 of this node.
|
145 |
* @return INT32 Coordinate value.
|
146 |
*/
|
147 |
virtual INT32 GetY1(); |
148 |
/**
|
149 |
* Get Width of specified precinct.
|
150 |
* @param pResolution Parent resolution level
|
151 |
* @param nPrecinct Precinct number within resolution level
|
152 |
* @return INT32 Width.
|
153 |
*/
|
154 |
// static INT32 GetWidth(CNCSJPCResolution *pResolution, INT32 nPrecinct);
|
155 |
/**
|
156 |
* Get Height of specified precinct.
|
157 |
* @param pResolution Parent resolution level
|
158 |
* @param nPrecinct Precinct number within resolution level
|
159 |
* @return INT32 Coordinate value.
|
160 |
*/
|
161 |
// static INT32 GetHeight(CNCSJPCResolution *pResolution, INT32 nPrecinct);
|
162 |
|
163 |
/**
|
164 |
* Read a BufferType line from the input.
|
165 |
* @param nCtx read context
|
166 |
* @param pDst Destination buffer.
|
167 |
* @param iComponent Output Component
|
168 |
* @return bool true on succes, else false.
|
169 |
*/
|
170 |
virtual bool ReadLine(ContextID nCtx, CNCSJPCBuffer *pDst, UINT16 iComponent);
|
171 |
|
172 |
void AddRef();
|
173 |
void UnRef();
|
174 |
UINT32 NrRefs(); |
175 |
static bool HaveZeroRefs(); |
176 |
/**
|
177 |
* Create the subbands
|
178 |
*/
|
179 |
virtual bool CreateSubBands(bool bRead); |
180 |
/**
|
181 |
* Destroy the subbands
|
182 |
*/
|
183 |
virtual bool DestroySubBands();
|
184 |
protected:
|
185 |
static CNCSJPCNodeTracker sm_Tracker;
|
186 |
static UINT32 sm_nZeroRefs;
|
187 |
|
188 |
/** Packet Read error is stored here */
|
189 |
CNCSError m_Error; |
190 |
/** Reference count */
|
191 |
UINT32 m_nRefs; |
192 |
/**
|
193 |
* Read the packets for this precinct
|
194 |
*/
|
195 |
virtual bool ReadPackets();
|
196 |
|
197 |
|
198 |
}; |
199 |
|
200 |
class NCSJPC_EXPORT_ALL CNCSJPCPrecinctMap { |
201 |
public:
|
202 |
/* const CNCSJPCPrecinct *&operator[](const UINT& _Key) {
|
203 |
std::map<UINT32, CNCSJPCPrecinct*>::iterator it = find(_Key);
|
204 |
if(it == end()) {
|
205 |
static CNCSJPCPrecinct *NP = NULL;
|
206 |
return(NP);
|
207 |
} else {
|
208 |
return(it->second);
|
209 |
}
|
210 |
}*/
|
211 |
CNCSJPCPrecinctMap(); |
212 |
virtual ~CNCSJPCPrecinctMap(); |
213 |
void Init(class CNCSJPCResolution *pResolution);
|
214 |
void ResetProgressionLayer(void); |
215 |
CNCSJPCPrecinct *find(UINT32 nPrecinct); |
216 |
CNCSJPCPrecinct *find(UINT32 x, UINT32 y); |
217 |
CNCSJPCPrecinct *findPacketPrecinct(UINT32 nPacket); |
218 |
bool empty(UINT32 nY);
|
219 |
__inline UINT32 size(void) {
|
220 |
return(m_nWidth * m_nHeight);
|
221 |
} |
222 |
void remove(UINT32 nPrecinct);
|
223 |
void remove(UINT32 x, UINT32 y);
|
224 |
void remove(CNCSJPCPrecinct *p);
|
225 |
void insert(UINT32 nPrecinct, CNCSJPCPrecinct *p);
|
226 |
void insert(UINT32 x, UINT32 y, CNCSJPCPrecinct *p);
|
227 |
/**
|
228 |
* UnLink all precincts.
|
229 |
* @param nCtx Read context
|
230 |
* @return bool true on success, else false on error.
|
231 |
*/
|
232 |
virtual bool UnLink(CNCSJPCNode::ContextID nCtx, UINT16 nInputs = 0); |
233 |
|
234 |
private:
|
235 |
class NCSJPC_EXPORT_ALL CNCSJPCPrecinctMapRow { |
236 |
public:
|
237 |
typedef std::map<UINT32, CNCSJPCPrecinct*>::iterator CNCSJPCPrecinctMapColumnIterator;
|
238 |
|
239 |
std::map<UINT32, CNCSJPCPrecinct*> m_Columns; |
240 |
|
241 |
CNCSJPCPrecinctMapRow(); |
242 |
virtual ~CNCSJPCPrecinctMapRow(); |
243 |
}; |
244 |
typedef std::vector<CNCSJPCPrecinctMapRow>::iterator CNCSJPCPrecinctMapRowIterator;
|
245 |
UINT32 m_nWidth; |
246 |
UINT32 m_nHeight; |
247 |
class CNCSJPCResolution *m_pResolution; |
248 |
|
249 |
std::vector<CNCSJPCPrecinctMapRow> m_Rows; |
250 |
}; |
251 |
|
252 |
#endif // !NCSJPCPRECINCT_H |