|
1 /* |
|
2 * Copyright (c) 2003, 2004 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CJ2kImageInfo class used to collect image related |
|
15 * information such as Main Header, SIZ marker and |
|
16 * list of tiles. |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef __JP2KIMAGEINFO_INL__ |
|
22 #define __JP2KIMAGEINFO_INL__ |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CJ2kImageInfo::NumOfHorizTiles |
|
28 // Get total number of tiles in horizontal position |
|
29 // (other items were commented in a header). |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 inline TUint16 CJ2kImageInfo::NumOfHorizTiles() const |
|
33 { |
|
34 return (TUint16)( TJ2kUtils::Ceil( iSizMarker.iXsiz - iSizMarker.iXTOsiz, |
|
35 iSizMarker.iXTsiz ) ); |
|
36 } |
|
37 |
|
38 // ----------------------------------------------------------------------------- |
|
39 // CJ2kImageInfo::NumOfVertTiles |
|
40 // Get total number of tiles in vertical position |
|
41 // (other items were commented in a header). |
|
42 // ----------------------------------------------------------------------------- |
|
43 // |
|
44 inline TUint16 CJ2kImageInfo::NumOfVertTiles() const |
|
45 { |
|
46 return (TUint16)( TJ2kUtils::Ceil( iSizMarker.iYsiz - iSizMarker.iYTOsiz, |
|
47 iSizMarker.iYTsiz ) ); |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // CJ2kImageInfo::NumOfComponents |
|
52 // Get total number of components |
|
53 // (other items were commented in a header). |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 inline TUint16 CJ2kImageInfo::NumOfComponents() const |
|
57 { |
|
58 return iSizMarker.iCsiz; |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // CJ2kImageInfo::DepthOfComponent |
|
63 // Get the bit depth of a component |
|
64 // (other items were commented in a header). |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 inline TUint8 CJ2kImageInfo::DepthOfComponent( TUint16 aIndex ) const |
|
68 { |
|
69 return ( aIndex < iSizMarker.iCsiz ) ? |
|
70 (TUint8)( ( iSizMarker.iSsiz[aIndex] & 0x7f ) + 1 ) : |
|
71 (TUint8)0; |
|
72 } |
|
73 |
|
74 // ----------------------------------------------------------------------------- |
|
75 // CJ2kImageInfo::SignOfComponent |
|
76 // Get the sign bit of a component |
|
77 // (other items were commented in a header). |
|
78 // ----------------------------------------------------------------------------- |
|
79 // |
|
80 inline TUint8 CJ2kImageInfo::SignOfComponent( TUint16 aIndex ) const |
|
81 { |
|
82 return ( aIndex < iSizMarker.iCsiz ) ? |
|
83 (TUint8)( iSizMarker.iSsiz[aIndex] & 0x80 ) : |
|
84 (TUint8)0; |
|
85 } |
|
86 |
|
87 // ----------------------------------------------------------------------------- |
|
88 // CJ2kImageInfo::SizMarker |
|
89 // Get the SIZ marker |
|
90 // (other items were commented in a header). |
|
91 // ----------------------------------------------------------------------------- |
|
92 // |
|
93 inline const TSizMarker& CJ2kImageInfo::SizMarker() const |
|
94 { |
|
95 return iSizMarker; |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // CJ2kImageInfo::MainMarker |
|
100 // Get the Main Header marker |
|
101 // (other items were commented in a header). |
|
102 // ----------------------------------------------------------------------------- |
|
103 // |
|
104 inline const TMainMarker& CJ2kImageInfo::MainMarker() const |
|
105 { |
|
106 return iMainMarker; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CJ2kImageInfo::MaxBlockSize |
|
111 // Get the maximum block size |
|
112 // (other items were commented in a header). |
|
113 // ----------------------------------------------------------------------------- |
|
114 // |
|
115 inline const TSize& CJ2kImageInfo::MaxBlockSize() const |
|
116 { |
|
117 return iMaxBlockSize; |
|
118 } |
|
119 |
|
120 // ----------------------------------------------------------------------------- |
|
121 // CJ2kImageInfo::CropArea |
|
122 // Get the cropped area |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 inline const TRect& CJ2kImageInfo::CropArea() const |
|
127 { |
|
128 return iCropArea; |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CJ2kImageInfo::TileCount |
|
133 // Get the total number of tiles in the tile list |
|
134 // (other items were commented in a header). |
|
135 // ----------------------------------------------------------------------------- |
|
136 // |
|
137 inline TUint16 CJ2kImageInfo::TileCount() const |
|
138 { |
|
139 return (TUint16)( iTile ? 1 : 0 ); |
|
140 } |
|
141 |
|
142 // ----------------------------------------------------------------------------- |
|
143 // CJ2kImageInfo::TileAt |
|
144 // Get the tile at specific location |
|
145 // (other items were commented in a header). |
|
146 // ----------------------------------------------------------------------------- |
|
147 // |
|
148 inline const CJ2kTileInfo& CJ2kImageInfo::TileAt( TUint16 /*aIndex*/ ) const |
|
149 { |
|
150 return *iTile; |
|
151 } |
|
152 |
|
153 // ----------------------------------------------------------------------------- |
|
154 // CJ2kImageInfo::Append |
|
155 // Append tile into the tile list |
|
156 // (other items were commented in a header). |
|
157 // ----------------------------------------------------------------------------- |
|
158 // |
|
159 inline void CJ2kImageInfo::Append( CJ2kTileInfo *aTile ) |
|
160 { |
|
161 iTile = aTile; |
|
162 iTileMask = 0; |
|
163 } |
|
164 |
|
165 // ----------------------------------------------------------------------------- |
|
166 // CJ2kImageInfo::Remove |
|
167 // Remove a tile at specific location |
|
168 // (other items were commented in a header). |
|
169 // ----------------------------------------------------------------------------- |
|
170 // |
|
171 inline void CJ2kImageInfo::Remove( TUint16 /*aIndex*/ ) |
|
172 { |
|
173 delete iTile; |
|
174 iTile = 0; |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // CJ2kImageInfo::TileMaskAt |
|
179 // Get the mask of a tile at specific location |
|
180 // (other items were commented in a header). |
|
181 // ----------------------------------------------------------------------------- |
|
182 // |
|
183 inline TUint8 CJ2kImageInfo::TileMaskAt( TUint16 /*aIndex*/ ) const |
|
184 { |
|
185 return iTileMask; |
|
186 } |
|
187 |
|
188 // ----------------------------------------------------------------------------- |
|
189 // CJ2kImageInfo::SetTileMask |
|
190 // Set the mask of a tile at specific location |
|
191 // (other items were commented in a header). |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 inline void CJ2kImageInfo::SetTileMask( TUint16 /*aIndex*/, TUint8 aTileMask ) |
|
195 { |
|
196 iTileMask = aTileMask; |
|
197 } |
|
198 |
|
199 // ----------------------------------------------------------------------------- |
|
200 // CJ2kImageInfo::SetLevelDrop |
|
201 // Set the resolution level to drop |
|
202 // (other items were commented in a header). |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 inline void CJ2kImageInfo::SetLevelDrop( TUint8 aDrop ) |
|
206 { |
|
207 iLevelDrop = aDrop; |
|
208 } |
|
209 |
|
210 // ----------------------------------------------------------------------------- |
|
211 // CJ2kImageInfo::SetExtraLevelDrop |
|
212 // Set the extra resolution level to drop |
|
213 // (other items were commented in a header). |
|
214 // ----------------------------------------------------------------------------- |
|
215 // |
|
216 inline void CJ2kImageInfo::SetExtraLevelDrop( TUint8 aDrop ) |
|
217 { |
|
218 iExtraLevelDrop = aDrop; |
|
219 } |
|
220 |
|
221 // ----------------------------------------------------------------------------- |
|
222 // CJ2kImageInfo::ComponentDrop |
|
223 // Get the component to drop |
|
224 // (other items were commented in a header). |
|
225 // ----------------------------------------------------------------------------- |
|
226 // |
|
227 inline TUint8 CJ2kImageInfo::ComponentDrop() const |
|
228 { |
|
229 return iComponentDrop; |
|
230 } |
|
231 |
|
232 // ----------------------------------------------------------------------------- |
|
233 // CJ2kImageInfo::LevelDrop |
|
234 // Get the resolution level to drop |
|
235 // (other items were commented in a header). |
|
236 // ----------------------------------------------------------------------------- |
|
237 // |
|
238 inline TUint8 CJ2kImageInfo::LevelDrop() const |
|
239 { |
|
240 return iLevelDrop; |
|
241 } |
|
242 |
|
243 // ----------------------------------------------------------------------------- |
|
244 // CJ2kImageInfo::ExtraLevelDrop |
|
245 // Get the extra resolution level to drop |
|
246 // (other items were commented in a header). |
|
247 // ----------------------------------------------------------------------------- |
|
248 // |
|
249 inline TUint8 CJ2kImageInfo::ExtraLevelDrop() const |
|
250 { |
|
251 return iExtraLevelDrop; |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------------- |
|
255 // CJ2kImageInfo::Crop |
|
256 // Get the crop |
|
257 // (other items were commented in a header). |
|
258 // ----------------------------------------------------------------------------- |
|
259 // |
|
260 inline TUint8 CJ2kImageInfo::Crop() const |
|
261 { |
|
262 return iCrop; |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CJ2kImageInfo::SetLastTilePartProcessed |
|
267 // Set the last tile part processed |
|
268 // (other items were commented in a header). |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 inline void CJ2kImageInfo::SetLastTilePartProcessed( TUint16 aLastTilePart ) |
|
272 { |
|
273 iLastTilePartProcessed = aLastTilePart; |
|
274 } |
|
275 |
|
276 // ----------------------------------------------------------------------------- |
|
277 // CJ2kImageInfo::IncrementLastTilePartProcessed |
|
278 // Increment the counter for tracking the last tile part processed |
|
279 // (other items were commented in a header). |
|
280 // ----------------------------------------------------------------------------- |
|
281 // |
|
282 inline void CJ2kImageInfo::IncrementLastTilePartProcessed() |
|
283 { |
|
284 ++iLastTilePartProcessed; |
|
285 } |
|
286 |
|
287 // ----------------------------------------------------------------------------- |
|
288 // CJ2kImageInfo::ResetPPM |
|
289 // Reset packet header pointer to the end of the PPM marker |
|
290 // (other items were commented in a header). |
|
291 // ----------------------------------------------------------------------------- |
|
292 // |
|
293 inline void CJ2kImageInfo::ResetPPM() |
|
294 { |
|
295 if ( iPpm ) |
|
296 { |
|
297 iPpm->iPtr = iPpm->iPtrEnd; |
|
298 } |
|
299 } |
|
300 |
|
301 #endif // __JP2KIMAGEINFO_INL__ |