svn-gvsig-desktop / tags / v1_10_0_Build_1259 / libraries / libjni-readecw-linux / include / NCSJPCTilePartHeader.h @ 43233
History | View | Annotate | Download (7.63 KB)
1 | 1448 | igbrotru | /********************************************************
|
---|---|---|---|
2 | ** Copyright 2002 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/NCSJPCTilePartHeader.h $
|
||
15 | ** CREATED: 13/12/2002 3:27:34 PM
|
||
16 | ** AUTHOR: Simon Cope
|
||
17 | ** PURPOSE: CNCSJPCTilePartHeader class header
|
||
18 | ** EDITS: [xx] ddMmmyy NAME COMMENTS
|
||
19 | *******************************************************/
|
||
20 | |||
21 | #ifndef NCSJPCTILEPARTHEADER_H
|
||
22 | #define NCSJPCTILEPARTHEADER_H
|
||
23 | |||
24 | #include "NCSJPCMarker.h" |
||
25 | #include "NCSJPCSOTMarker.h" |
||
26 | #include "NCSJPCCODMarker.h" |
||
27 | #include "NCSJPCCOCMarker.h" |
||
28 | #include "NCSJPCQCDMarker.h" |
||
29 | #include "NCSJPCQCCMarker.h" |
||
30 | #include "NCSJPCRGNMarker.h" |
||
31 | #include "NCSJPCPOCMarker.h" |
||
32 | #include "NCSJPCSODMarker.h" |
||
33 | #include "NCSJPCPLTMarker.h" |
||
34 | #include "NCSJPCPPTMarker.h" |
||
35 | #include "NCSJPCCOMMarker.h" |
||
36 | #include "NCSJPCComponent.h" |
||
37 | #include "NCSJPCProgression.h" |
||
38 | #include "NCSJPCTypes.h" |
||
39 | #include "NCSJPC.h" |
||
40 | |||
41 | /**
|
||
42 | * CNCSJPCTilePartHeader class - the JPC codestream Tile-Part Header.
|
||
43 | *
|
||
44 | * @author Simon Cope
|
||
45 | * @version $Revision$ $Author$ $Date$
|
||
46 | */
|
||
47 | class NCSJPC_EXPORT_ALL CNCSJPCTilePartHeader: public CNCSJPCNode, public CNCSJPCProgression { |
||
48 | public:
|
||
49 | // Tile-Part absolute index within codestream
|
||
50 | UINT32 m_nZtp; |
||
51 | /** pointer to main JPC */
|
||
52 | CNCSJPC *m_pJPC; |
||
53 | |||
54 | /** Tile-part header is valid */
|
||
55 | bool m_bValid;
|
||
56 | |||
57 | /** SOC start of codestream Marker - required */
|
||
58 | CNCSJPCSOTMarker m_SOT; |
||
59 | /** COD coding style default Marker - optional */
|
||
60 | CNCSJPCCODMarker m_COD; |
||
61 | /** QCD quantization default Marker - optional */
|
||
62 | CNCSJPCQCDMarker m_QCD; |
||
63 | /** RGN markers */
|
||
64 | std::vector<CNCSJPCRGNMarker> m_Regions; |
||
65 | |||
66 | /** POC progression order change marker - optional
|
||
67 | * NOTE: Over-rides any main-header POC and any COD Marker
|
||
68 | */
|
||
69 | CNCSJPCPOCMarker m_POC; |
||
70 | |||
71 | /** SOD start of data */
|
||
72 | CNCSJPCSODMarker m_SOD; |
||
73 | |||
74 | /** Packet length(s) for this tile-part */
|
||
75 | std::vector<CNCSJPCPLTMarker> m_PLTs; |
||
76 | /** Hashed index to PLTs, in mod 32768 */
|
||
77 | std::vector<UINT32> m_PLTIndex; |
||
78 | |||
79 | /** Packet header(s) for this tile-part */
|
||
80 | std::vector<CNCSJPCPPTMarker> m_PPTs; |
||
81 | /** Are the PPT's from the file or dynamically created? */
|
||
82 | bool m_bFilePPTs;
|
||
83 | |||
84 | /** Tile Components */
|
||
85 | std::vector<CNCSJPCComponent*> m_Components; |
||
86 | |||
87 | /** Encoder PLT Stream */
|
||
88 | // CNCSJPCIOStream *m_pEncoderPLTFile;
|
||
89 | |||
90 | /** Default constructor, initialises members */
|
||
91 | CNCSJPCTilePartHeader(CNCSJPC *pJPC); |
||
92 | /** Virtual destructor */
|
||
93 | virtual ~CNCSJPCTilePartHeader(); |
||
94 | |||
95 | /**
|
||
96 | * Recalc the structure sizes required based on the current decoding info.
|
||
97 | * @return CNCSError NCS_SUCCESS, or Error code on failure.
|
||
98 | */
|
||
99 | virtual CNCSError RecalcSizes(); |
||
100 | |||
101 | /**
|
||
102 | * Parse the marker from the JPC codestream.
|
||
103 | * @param JPC CNCSJPC to use to parse file.
|
||
104 | * @param Stream IOStream to use to parse file.
|
||
105 | * @return CNCSError NCS_SUCCESS, or Error code on failure.
|
||
106 | */
|
||
107 | virtual CNCSError Parse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream); |
||
108 | /**
|
||
109 | * UnParse the marker to the JPC codestream.
|
||
110 | * @param Stream IOStream to use to parse file.
|
||
111 | * @param JPC CNCSJPC to use to parse file.
|
||
112 | * @return CNCSError NCS_SUCCESS, or Error code on failure.
|
||
113 | */
|
||
114 | virtual CNCSError UnParse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream); |
||
115 | |||
116 | /**
|
||
117 | * Get the Tile Index
|
||
118 | * @return INT32 Index of the tile, >= 0
|
||
119 | */
|
||
120 | INT32 GetIndex(); |
||
121 | /**
|
||
122 | * Get the Tile P index
|
||
123 | * @return INT32 P index of the tile, >= 0
|
||
124 | */
|
||
125 | INT32 GetP(); |
||
126 | /**
|
||
127 | * Get the Tile Q index
|
||
128 | * @return INT32 Q of the tile, >= 0
|
||
129 | */
|
||
130 | INT32 GetQ(); |
||
131 | |||
132 | /**
|
||
133 | * Get the Tile TX0 coordinate in reference grid
|
||
134 | * @return INT32 X of the tile, >= 0
|
||
135 | */
|
||
136 | INT32 GetX0(); |
||
137 | /**
|
||
138 | * Get the Tile TY0 coordinate in reference grid
|
||
139 | * @return INT32 Y of the tile, >= 0
|
||
140 | */
|
||
141 | INT32 GetY0(); |
||
142 | /**
|
||
143 | * Get the Tile TX1 coordinate in reference grid
|
||
144 | * @return INT32 X of the tile, >= 0
|
||
145 | */
|
||
146 | INT32 GetX1(); |
||
147 | /**
|
||
148 | * Get the Tile TY1 coordinate in reference grid
|
||
149 | * @return INT32 Y of the tile, >= 0
|
||
150 | */
|
||
151 | INT32 GetY1(); |
||
152 | |||
153 | /**
|
||
154 | * Get the PPx from the component resolution
|
||
155 | * @param INT32 Component Index
|
||
156 | * @param INT32 Resolution Level
|
||
157 | * @return INT32 PPx
|
||
158 | */
|
||
159 | UINT32 GetPPx(UINT16 iComponent, UINT8 nResolution); |
||
160 | /**
|
||
161 | * Get the PPy from the component resolution
|
||
162 | * @param INT32 Component Index
|
||
163 | * @param INT32 Resolution Level
|
||
164 | * @return INT32 PPy
|
||
165 | */
|
||
166 | UINT32 GetPPy(UINT16 iComponent, UINT8 nResolution); |
||
167 | |||
168 | /**
|
||
169 | * Get the xcb' from the resolution
|
||
170 | * @param INT32 Component Index
|
||
171 | * @param INT32 Resolution Level
|
||
172 | * @return INT32 xcb'
|
||
173 | */
|
||
174 | UINT32 GetXCBPrime(UINT16 iComponent, UINT8 nResolution); |
||
175 | /**
|
||
176 | * Get the ycb' from the resolution
|
||
177 | * @param INT32 Component Index
|
||
178 | * @param INT32 Resolution Level
|
||
179 | * @return INT32 ycb'
|
||
180 | */
|
||
181 | UINT32 GetYCBPrime(UINT16 iComponent, UINT8 nResolution); |
||
182 | /**
|
||
183 | * Get the CB Width from the resolution
|
||
184 | * @param INT32 Component Index
|
||
185 | * @param INT32 Resolution Level
|
||
186 | * @return INT32 xcb'
|
||
187 | */
|
||
188 | UINT32 GetCBWidth(UINT16 iComponent, UINT8 nResolution); |
||
189 | /**
|
||
190 | * Get the CB Height from the resolution
|
||
191 | * @param INT32 Component Index
|
||
192 | * @param INT32 Resolution Level
|
||
193 | * @return INT32 ycb'
|
||
194 | */
|
||
195 | UINT32 GetCBHeight(UINT16 iComponent, UINT8 nResolution); |
||
196 | |||
197 | /**
|
||
198 | * Increment the progression order from the current location, parsing packet headers in the process.
|
||
199 | * @param pData Data for Step function
|
||
200 | * @param bComplete Progression order is complete.
|
||
201 | * @return CNCSError NCS_SUCCESS, or Error code on failure.
|
||
202 | */
|
||
203 | virtual CNCSError Iterate(CNCSJPCTilePartHeader *pMainTP, void *pData, bool &bComplete); |
||
204 | /**
|
||
205 | * Perform the "Step" for this progression.
|
||
206 | * @return bool true, or false on error & Error is set to actual error code.
|
||
207 | */
|
||
208 | virtual bool Step(CNCSJPCComponent *pComponent,
|
||
209 | CNCSJPCResolution *pResolution, |
||
210 | CNCSJPCPrecinct *pPrecinct); |
||
211 | |||
212 | virtual bool StepRow(class CNCSJPCComponent *pComponent,
|
||
213 | class CNCSJPCResolution *pResolution); |
||
214 | |||
215 | /**
|
||
216 | * Get the Packet Header for the specified packet number
|
||
217 | * @param nPacket Packet number
|
||
218 | * @return CNCSJPCPacket Packet Header struct (may be unparsed)
|
||
219 | */
|
||
220 | CNCSJPCPacket *GetPacketHeader(UINT32 nPacket); |
||
221 | /**
|
||
222 | * Get the first packet number for this tile
|
||
223 | * @return UINT32 First packet number
|
||
224 | */
|
||
225 | UINT32 GetFirstPacketNr(); |
||
226 | /**
|
||
227 | * Get the number of packets for this tile
|
||
228 | * @return UINT32 Packet count
|
||
229 | */
|
||
230 | UINT32 GetNrPackets(); |
||
231 | |||
232 | /**
|
||
233 | * Write a BufferType line to the output.
|
||
234 | * @param nCtx Context
|
||
235 | * @param pSrc Source buffer.
|
||
236 | * @param iComponent Output Component
|
||
237 | * @return bool true on succes, else false.
|
||
238 | */
|
||
239 | virtual bool WriteLine(ContextID nCtx, CNCSJPCBuffer *pSrc, UINT16 iComponent);
|
||
240 | |||
241 | // bool OpenEncoderPLTFile(bool bWrite);
|
||
242 | // bool CloseEncoderPLTFile(bool bDelete);
|
||
243 | |||
244 | bool SimpleStructure() {
|
||
245 | return(m_bSimpleStructure);
|
||
246 | } |
||
247 | |||
248 | protected:
|
||
249 | static CNCSJPCNodeTracker sm_Tracker;
|
||
250 | |||
251 | TNCSCachedValue<UINT32> m_FirstPacketNr; |
||
252 | TNCSCachedValue<UINT32> m_NrPackets; |
||
253 | |||
254 | // Dynamic precincts in progression Step()
|
||
255 | bool m_bDynPrecinct;
|
||
256 | // Stream is seekable
|
||
257 | bool m_bSeekable;
|
||
258 | // Parsing Dynamic precincts in progression Step()
|
||
259 | bool m_bParsingHeaders;
|
||
260 | // Simple structure, R/P/L equal in all C and no POC
|
||
261 | bool m_bSimpleStructure;
|
||
262 | }; |
||
263 | |||
264 | |||
265 | |||
266 | #endif // !NCSJPCTILEPARTHEADER_H |