Revision 33674
tags/tmp_build/libraries/libjni-readecw-linux/.cdtproject | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse-cdt version="2.0"?> |
|
3 |
|
|
4 |
<cdtproject id="org.eclipse.cdt.make.core.make"> |
|
5 |
<extension point="org.eclipse.cdt.core.BinaryParser" id="org.eclipse.cdt.core.ELF"/> |
|
6 |
<data> |
|
7 |
<item id="org.eclipse.cdt.core.pathentry"> |
|
8 |
<pathentry kind="src" path=""/> |
|
9 |
<pathentry kind="out" path=""/> |
|
10 |
<pathentry kind="con" path="org.eclipse.cdt.make.core.DISCOVERED_SCANNER_INFO"/> |
|
11 |
</item> |
|
12 |
<item id="cdt_indexer"> |
|
13 |
<indexEnabled indexValue="true"/> |
|
14 |
<indexerProblemsEnabled indexProblemsValue="0"/> |
|
15 |
</item> |
|
16 |
<item id="org.eclipse.cdt.make.core.buildtargets"> |
|
17 |
<buildTargets> |
|
18 |
<target name="all" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path=""> |
|
19 |
<buildCommand>nmake</buildCommand> |
|
20 |
<buildArguments>-f makefile.w32</buildArguments> |
|
21 |
<buildTarget>default</buildTarget> |
|
22 |
<stopOnError>false</stopOnError> |
|
23 |
<useDefaultCommand>false</useDefaultCommand> |
|
24 |
</target> |
|
25 |
<target name="jar" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path=""> |
|
26 |
<buildCommand>nmake</buildCommand> |
|
27 |
<buildArguments>-f makefile.w32</buildArguments> |
|
28 |
<buildTarget>jar</buildTarget> |
|
29 |
<stopOnError>false</stopOnError> |
|
30 |
<useDefaultCommand>false</useDefaultCommand> |
|
31 |
</target> |
|
32 |
<target name="clean" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path=""> |
|
33 |
<buildCommand>nmake</buildCommand> |
|
34 |
<buildArguments>-f makefile.w32</buildArguments> |
|
35 |
<buildTarget>clean</buildTarget> |
|
36 |
<stopOnError>false</stopOnError> |
|
37 |
<useDefaultCommand>false</useDefaultCommand> |
|
38 |
</target> |
|
39 |
<target name="header" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path=""> |
|
40 |
<buildCommand>nmake</buildCommand> |
|
41 |
<buildArguments>-f makefile.w32</buildArguments> |
|
42 |
<buildTarget>header</buildTarget> |
|
43 |
<stopOnError>false</stopOnError> |
|
44 |
<useDefaultCommand>false</useDefaultCommand> |
|
45 |
</target> |
|
46 |
<target name="doc" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path=""> |
|
47 |
<buildCommand>nmake</buildCommand> |
|
48 |
<buildArguments>-f makefile.w32</buildArguments> |
|
49 |
<buildTarget>doc</buildTarget> |
|
50 |
<stopOnError>false</stopOnError> |
|
51 |
<useDefaultCommand>false</useDefaultCommand> |
|
52 |
</target> |
|
53 |
<target name="install" targetID="org.eclipse.cdt.make.MakeTargetBuilder" path=""> |
|
54 |
<buildCommand>nmake</buildCommand> |
|
55 |
<buildArguments>-f makefile.w32</buildArguments> |
|
56 |
<buildTarget>install</buildTarget> |
|
57 |
<stopOnError>false</stopOnError> |
|
58 |
<useDefaultCommand>false</useDefaultCommand> |
|
59 |
</target> |
|
60 |
</buildTargets> |
|
61 |
</item> |
|
62 |
</data> |
|
63 |
</cdtproject> |
|
0 | 64 |
tags/tmp_build/libraries/libjni-readecw-linux/ant.xml | ||
---|---|---|
1 |
<project name="Ecw" default="dist" basedir="."> |
|
2 |
<description> |
|
3 |
Genera distribuciones de lector de ecw |
|
4 |
</description> |
|
5 |
|
|
6 |
<property name="src" location="src"/> |
|
7 |
<property name="src-test" location="src-test"/> |
|
8 |
<property name="build" location="bin"/> |
|
9 |
<property name="dist" location="dist"/> |
|
10 |
<property name="include" location="include"/> |
|
11 |
<property name="doc" location="doc"/> |
|
12 |
<property name="lib" location="lib"/> |
|
13 |
<property name="bin" location="bin"/> |
|
14 |
<property name="jar" value="cms"/> |
|
15 |
<property name="app" value="jecw"/> |
|
16 |
<property name="version" value="0.0.0"/> |
|
17 |
|
|
18 |
<target name="init"> |
|
19 |
<tstamp/> |
|
20 |
</target> |
|
21 |
|
|
22 |
<target name="dist" depends="init" |
|
23 |
description="Crea distribuciĆ³n de binarios" > |
|
24 |
<mkdir dir="${dist}/${app}-${version}"/> |
|
25 |
<mkdir dir="${dist}/${app}-${version}/bin"/> |
|
26 |
<mkdir dir="${dist}/${app}-${version}/doc"/> |
|
27 |
<copy todir="./dist/${app}-${version}/doc/"> |
|
28 |
<fileset dir="${doc}"/> |
|
29 |
</copy> |
|
30 |
<mkdir dir="${dist}/${app}-${version}/dist"/> |
|
31 |
<copy todir="./dist/${app}-${version}/dist/"> |
|
32 |
<fileset dir="${dist}" includes="jecw.dll"/> |
|
33 |
<fileset dir="${dist}" includes="jecw.jar"/> |
|
34 |
<fileset dir="${dist}" includes="libjecw.so.*"/> |
|
35 |
</copy> |
|
36 |
<mkdir dir="${dist}/${app}-${version}/lib"/> |
|
37 |
<copy todir="./dist/${app}-${version}/lib/"> |
|
38 |
<fileset dir="${lib}"/> |
|
39 |
</copy> |
|
40 |
<mkdir dir="${dist}/${app}-${version}/src-test"/> |
|
41 |
<copy todir="./dist/${app}-${version}/src-test/"> |
|
42 |
<fileset dir="${bin}" includes="*.class"/> |
|
43 |
</copy> |
|
44 |
<copy todir="./dist/${app}-${version}/"> |
|
45 |
<fileset dir="" includes="README"/> |
|
46 |
</copy> |
|
47 |
<!-- |
|
48 |
<tar tarfile="./${app}-${version}.tar" |
|
49 |
basedir="./dist/" |
|
50 |
includes="${app}-${version}/*" /> |
|
51 |
--> |
|
52 |
</target> |
|
53 |
|
|
54 |
<target name="src" depends="dist" |
|
55 |
description="Crea distribuciĆ³n de fuentes" > |
|
56 |
<mkdir dir="${dist}/${app}-src-${version}"/> |
|
57 |
<mkdir dir="${dist}/${app}-src-${version}/src"/> |
|
58 |
<copy todir="./dist/${app}-src-${version}/src/"> |
|
59 |
<fileset dir="${src}"/> |
|
60 |
</copy> |
|
61 |
<mkdir dir="${dist}/${app}-src-${version}/src-test"/> |
|
62 |
<copy todir="./dist/${app}-src-${version}/src-test/"> |
|
63 |
<fileset dir="${src-test}" includes="*.java"/> |
|
64 |
</copy> |
|
65 |
<mkdir dir="${dist}/${app}-src-${version}/include"/> |
|
66 |
<copy todir="./dist/${app}-src-${version}/include/"> |
|
67 |
<fileset dir="${include}"/> |
|
68 |
</copy> |
|
69 |
<mkdir dir="${dist}/${app}-src-${version}/bin"/> |
|
70 |
<mkdir dir="${dist}/${app}-src-${version}/dist"/> |
|
71 |
<mkdir dir="${dist}/${app}-src-${version}/doc"/> |
|
72 |
<copy todir="./dist/${app}-src-${version}/doc/"> |
|
73 |
<fileset dir="${doc}"/> |
|
74 |
</copy> |
|
75 |
<mkdir dir="${dist}/${app}-src-${version}/lib"/> |
|
76 |
<copy todir="./dist/${app}-src-${version}/lib/"> |
|
77 |
<fileset dir="${lib}"/> |
|
78 |
</copy> |
|
79 |
<copy todir="./dist/${app}-src-${version}/"> |
|
80 |
<fileset dir="" includes="Makefile"/> |
|
81 |
<fileset dir="" includes="makefile.w32"/> |
|
82 |
<fileset dir="" includes="README"/> |
|
83 |
<fileset dir="" includes="submake.bat"/> |
|
84 |
</copy> |
|
85 |
<!-- |
|
86 |
<tar tarfile="./${app}-src-${version}.tar" |
|
87 |
basedir="./dist/" |
|
88 |
includes="${app}-src-${version}/*" /> |
|
89 |
--> |
|
90 |
</target> |
|
91 |
|
|
92 |
<target name="clean" |
|
93 |
description="clean up" > |
|
94 |
<delete dir="${dist}/${app}-${version}"/> |
|
95 |
<delete dir="${dist}/${app}-src-${version}"/> |
|
96 |
</target> |
|
97 |
</project> |
|
98 |
|
|
0 | 99 |
tags/tmp_build/libraries/libjni-readecw-linux/include/NCSTypes.h | ||
---|---|---|
1 |
/******************************************************** |
|
2 |
** Copyright 1999 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: NCSTypes.h |
|
15 |
** CREATED: Thu Feb 25 09:19:00 WST 1999 |
|
16 |
** AUTHOR: Simon Cope |
|
17 |
** PURPOSE: General NCS typedefs |
|
18 |
** EDITS: |
|
19 |
** [01] sjc 30Apr00 Merged Mac SDK port |
|
20 |
** [02] ny 03Nov00 Mac port changes |
|
21 |
** [03] tfl 02Jul04 Moved NCSEcwCellType enum declaration from NCSEcwClient to here |
|
22 |
*******************************************************/ |
|
23 |
|
|
24 |
#ifndef NCSTYPES_H |
|
25 |
#define NCSTYPES_H |
|
26 |
|
|
27 |
#define LINUX |
|
28 |
#define POSIX |
|
29 |
|
|
30 |
/* Platform determination stuff. |
|
31 |
Should be moved to a better "central" location. |
|
32 |
*/ |
|
33 |
#ifdef macintosh |
|
34 |
//#define MACINTOSH |
|
35 |
//#include "SimpleWinTypes.h" // include mac types |
|
36 |
#ifndef MACINTOSH |
|
37 |
# undef WIN32 |
|
38 |
# define MACINTOSH |
|
39 |
# define _MAC |
|
40 |
# undef _DEBUG_NEVER |
|
41 |
# define uint2 unsigned short |
|
42 |
# define uint unsigned long |
|
43 |
#endif |
|
44 |
|
|
45 |
#elif defined __PALMOS_TRAP__ |
|
46 |
|
|
47 |
#define PALM |
|
48 |
|
|
49 |
#elif defined sun |
|
50 |
|
|
51 |
#ifndef SOLARIS |
|
52 |
#define SOLARIS |
|
53 |
#endif // SOLARIS |
|
54 |
|
|
55 |
#endif |
|
56 |
|
|
57 |
#ifdef __cplusplus |
|
58 |
extern "C" { |
|
59 |
#endif |
|
60 |
|
|
61 |
#ifndef ERSTYPES_H |
|
62 |
|
|
63 |
/* |
|
64 |
** Includes |
|
65 |
*/ |
|
66 |
#ifdef MACINTOSH |
|
67 |
#include <Types.h> |
|
68 |
#elif !defined(_WIN32_WCE) //Pocket PC 2002 |
|
69 |
#include <sys/types.h> |
|
70 |
#endif |
|
71 |
|
|
72 |
#if (defined(WIN32) || defined(_WIN32_WCE)) //Pocket PC 2002 |
|
73 |
#include <windows.h> |
|
74 |
#include <stdarg.h> |
|
75 |
#include <windef.h> |
|
76 |
#include <winbase.h> |
|
77 |
|
|
78 |
#if (_WIN32_WCE > 300) //Pocket PC 2002 |
|
79 |
#include <stddef.h> |
|
80 |
#endif |
|
81 |
|
|
82 |
#elif defined(MACINTOSH) |
|
83 |
#include <MacWindows.h> |
|
84 |
#include <stdarg.h> |
|
85 |
#include <stddef.h> |
|
86 |
#include <MacTypes.h> |
|
87 |
#include <Math64.h> |
|
88 |
#include <time.h> |
|
89 |
#elif defined POSIX |
|
90 |
#include <stdarg.h> |
|
91 |
#endif /* WIN32 */ |
|
92 |
|
|
93 |
#ifdef HPUX |
|
94 |
//#include <sys/types.h> |
|
95 |
#endif |
|
96 |
|
|
97 |
/* |
|
98 |
* #defines |
|
99 |
*/ |
|
100 |
#ifdef WIN32 |
|
101 |
#elif defined MACINTOSH |
|
102 |
|
|
103 |
#ifndef FALSE |
|
104 |
#define FALSE 0 |
|
105 |
#endif |
|
106 |
#ifndef TRUE |
|
107 |
#define TRUE 1 |
|
108 |
#endif |
|
109 |
|
|
110 |
#elif defined PALM |
|
111 |
#endif |
|
112 |
/* |
|
113 |
** Typedefs |
|
114 |
*/ |
|
115 |
|
|
116 |
/* |
|
117 |
** General data sizes |
|
118 |
*/ |
|
119 |
#if (defined(WIN32) || defined(_WIN32_WCE)) //pocket pc 2002 |
|
120 |
typedef signed char INT8; /* 8 bit signed integer */ |
|
121 |
typedef unsigned char UINT8; /* 8 bit unsigned integer */ |
|
122 |
typedef signed short INT16; /* 16 bit signed integer */ |
|
123 |
typedef unsigned short UINT16; /* 16 bit unsigned integer */ |
|
124 |
#ifndef _BASETSD_H_ |
|
125 |
typedef signed int INT32; /* 32 bit signed integer */ |
|
126 |
typedef unsigned int UINT32; /* 32 bit unsigned integer */ |
|
127 |
typedef LONGLONG INT64; /* 64 bit signed integer */ |
|
128 |
typedef DWORDLONG UINT64; /* 64 bit unsigned integer */ |
|
129 |
typedef UINT8 BOOLEAN; /* for use as a True/False or On/Off type */ |
|
130 |
#endif |
|
131 |
|
|
132 |
#else /* WIN32 */ |
|
133 |
|
|
134 |
#ifdef MACINTOSH |
|
135 |
|
|
136 |
#if TARGET_API_MAC_CARBON |
|
137 |
#define MAC_PREEMPTIVE |
|
138 |
#endif // TARGET_API_MAC_CARBON |
|
139 |
|
|
140 |
// Define Data Types for the Macintosh |
|
141 |
typedef signed char INT8; /* 8 bit signed integer */ |
|
142 |
typedef unsigned char UINT8; /* 8 bit unsigned integer */ |
|
143 |
typedef signed short INT16; /* 16 bit signed integer */ |
|
144 |
typedef unsigned short UINT16; /* 16 bit unsigned integer */ |
|
145 |
typedef signed long INT32; /* 32 bit signed integer */ |
|
146 |
typedef unsigned long UINT32; /* 32 bit unsigned integer */ |
|
147 |
typedef long long INT64; /* 64 bit signed integer */ |
|
148 |
typedef unsigned long long UINT64; /* 64 bit unsigned integer */ |
|
149 |
typedef int BOOLEAN; /* boolean */ |
|
150 |
|
|
151 |
typedef void *HANDLE; |
|
152 |
#define DWORD UINT32 |
|
153 |
#define BYTE UINT8 |
|
154 |
|
|
155 |
#else /* MACINTOSH */ |
|
156 |
|
|
157 |
#ifdef POSIX |
|
158 |
|
|
159 |
typedef signed char INT8; /* 8 bit signed integer */ |
|
160 |
typedef unsigned char UINT8; /* 8 bit unsigned integer */ |
|
161 |
typedef signed short INT16; /* 16 bit signed integer */ |
|
162 |
typedef unsigned short UINT16; /* 16 bit unsigned integer */ |
|
163 |
#ifndef _BASETSD_H_ |
|
164 |
typedef signed int INT32; /* 32 bit signed integer */ |
|
165 |
typedef unsigned int UINT32; /* 32 bit unsigned integer */ |
|
166 |
#endif |
|
167 |
|
|
168 |
#if defined(SOLARIS) |
|
169 |
typedef longlong_t INT64; /* 64 bit signed integer */ |
|
170 |
typedef u_longlong_t UINT64; /* 64 bit unsigned integer */ |
|
171 |
#elif defined(LINUX) |
|
172 |
|
|
173 |
typedef int64_t INT64; |
|
174 |
typedef u_int64_t UINT64; |
|
175 |
|
|
176 |
#elif defined(MACOSX) |
|
177 |
|
|
178 |
typedef unsigned long long UINT64; |
|
179 |
typedef signed long long INT64; |
|
180 |
typedef char BOOLEAN; |
|
181 |
//typedef int boolean; |
|
182 |
#define DWORD UINT32 |
|
183 |
#define BYTE UINT8 |
|
184 |
#ifndef NULL |
|
185 |
# define NULL 0 |
|
186 |
#endif |
|
187 |
|
|
188 |
#elif defined(HPUX) |
|
189 |
|
|
190 |
#if !defined(_BASETSD_H_) |
|
191 |
//&& !defined(_DLFCN_H) |
|
192 |
typedef int64_t INT64; |
|
193 |
//typedef uint64_t UINT64; |
|
194 |
#include <dlfcn.h> // include this globally to get the correct definition of UINT64 |
|
195 |
#endif |
|
196 |
|
|
197 |
#endif |
|
198 |
|
|
199 |
#if !(defined(_BASETSD_H_)||defined(_UTILITY_H)) && !(defined(MACOSX)) |
|
200 |
typedef int BOOLEAN; /* for use as a True/False or On/Off type */ |
|
201 |
#endif |
|
202 |
|
|
203 |
#else /* SOLARIS */ |
|
204 |
#ifdef IRIX |
|
205 |
|
|
206 |
typedef signed char INT8; /* 8 bit signed integer */ |
|
207 |
typedef unsigned char UINT8; /* 8 bit unsigned integer */ |
|
208 |
typedef signed short INT16; /* 16 bit signed integer */ |
|
209 |
typedef unsigned short UINT16; /* 16 bit unsigned integer */ |
|
210 |
#ifndef _BASETSD_H_ |
|
211 |
typedef signed int INT32; /* 32 bit signed integer */ |
|
212 |
typedef unsigned int UINT32; /* 32 bit unsigned integer */ |
|
213 |
#endif |
|
214 |
typedef __int64_t INT64; /* 64 bit signed integer */ |
|
215 |
typedef __uint64_t UINT64; /* 64 bit unsigned integer */ |
|
216 |
#ifndef _BASETSD_H_ |
|
217 |
typedef UINT8 BOOLEAN; /* for use as a True/False or On/Off type */ |
|
218 |
#endif |
|
219 |
|
|
220 |
|
|
221 |
#else /* IRIX */ |
|
222 |
|
|
223 |
#error unknown machine type will require custom 64 bit variables |
|
224 |
|
|
225 |
#endif /* IRIX */ |
|
226 |
#endif /* SOLARIS */ |
|
227 |
#endif /* MACINTOSH */ |
|
228 |
#endif /* WIN32 */ |
|
229 |
|
|
230 |
typedef float IEEE4; /* 4 byte IEEE floating point */ |
|
231 |
typedef double IEEE8; /* 8 byte IEEE floating point */ |
|
232 |
typedef time_t DATETIME; /* Datestamp */ |
|
233 |
|
|
234 |
#endif /* #ifndef ERSTYPES_H */ |
|
235 |
|
|
236 |
/* |
|
237 |
** NCS Specific typedefs |
|
238 |
*/ |
|
239 |
typedef UINT32 NCSBlockId; /* Unique (per file) Block ID */ |
|
240 |
typedef UINT64 NCSClientUID; /* Unique client ID (per server) */ |
|
241 |
typedef UINT64 NCSSequenceNr; /* Packet sequence number */ |
|
242 |
typedef INT64 NCSTimeStampMs; /* msec timestamp - wraps every 2^64 ms (10^6 years) */ |
|
243 |
typedef INT64 NCSTimeStampUs; /* usec timestamp - wraps every 2^64 us (10^3 years) */ |
|
244 |
|
|
245 |
/* |
|
246 |
** NCS Color typedefs : Note that these are compatible with win32 api calls for COLORREF |
|
247 |
*/ |
|
248 |
typedef UINT32 NCSColor; |
|
249 |
|
|
250 |
#define NCSColorRGB(r,g,b) ((NCSColor)(((UINT8)(r)|((UINT16)((UINT8)(g))<<8))|(((UINT32)(UINT8)(b))<<16))) |
|
251 |
#define NCSColorRGBA(r,g,b,a) ((NCSColor)(((UINT8)(r)|((UINT16)((UINT8)(g))<<8))|(((UINT32)(UINT8)(b))<<16))|(((UINT32)(UINT8)(a))<<24)) |
|
252 |
#define NCSColorGetRValue(nColor) ((UINT8)(nColor)) |
|
253 |
#define NCSColorGetGValue(nColor) ((UINT8)(((UINT16)(nColor)) >> 8)) |
|
254 |
#define NCSColorGetBValue(nColor) ((UINT8)((nColor)>>16)) |
|
255 |
#define NCSColorGetAValue(nColor) ((UINT8)((nColor)>>24)) |
|
256 |
|
|
257 |
/* |
|
258 |
** Enum type for different kinds of cell sample [03] |
|
259 |
*/ |
|
260 |
typedef enum { |
|
261 |
NCSCT_UINT8 = 0, |
|
262 |
NCSCT_UINT16 = 1, |
|
263 |
NCSCT_UINT32 = 2, |
|
264 |
NCSCT_UINT64 = 3, |
|
265 |
NCSCT_INT8 = 4, |
|
266 |
NCSCT_INT16 = 5, |
|
267 |
NCSCT_INT32 = 6, |
|
268 |
NCSCT_INT64 = 7, |
|
269 |
NCSCT_IEEE4 = 8, |
|
270 |
NCSCT_IEEE8 = 9 |
|
271 |
} NCSEcwCellType; |
|
272 |
|
|
273 |
/* * * * * * * * * * * * * * * * * * * */ |
|
274 |
|
|
275 |
#ifdef __cplusplus |
|
276 |
} |
|
277 |
#endif |
|
278 |
|
|
279 |
#endif /* #ifndef NCSTYPES_H */ |
|
0 | 280 |
tags/tmp_build/libraries/libjni-readecw-linux/include/NCSJPCSOTMarker.h | ||
---|---|---|
1 |
/******************************************************** |
|
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/NCSJPCSOTMarker.h $ |
|
15 |
** CREATED: 11/12/2002 3:27:34 PM |
|
16 |
** AUTHOR: Simon Cope |
|
17 |
** PURPOSE: CNCSJPCSOTMarker class header |
|
18 |
** EDITS: [xx] ddMmmyy NAME COMMENTS |
|
19 |
*******************************************************/ |
|
20 |
|
|
21 |
#ifndef NCSJPCSOTMARKER_H |
|
22 |
#define NCSJPCSOTMARKER_H |
|
23 |
|
|
24 |
#include "NCSJPCMarker.h" |
|
25 |
|
|
26 |
/** |
|
27 |
* CNCSJPCSOTMarker class - the JPC SOT marker. |
|
28 |
* |
|
29 |
* @author Simon Cope |
|
30 |
* @version $Revision$ $Author$ $Date$ |
|
31 |
*/ |
|
32 |
class NCSJPC_EXPORT_ALL CNCSJPCSOTMarker: public CNCSJPCMarker { |
|
33 |
public: |
|
34 |
|
|
35 |
/** Tile Index, >= 0 */ |
|
36 |
UINT16 m_nIsot; |
|
37 |
/** Length of SOT + tile part bitstream */ |
|
38 |
UINT32 m_nPsot; |
|
39 |
/** Tile part index, first = 0 */ |
|
40 |
UINT8 m_nTPsot; |
|
41 |
/** Number of tile-parts of a tile in the codestream, 0 == not defined in this tile part */ |
|
42 |
UINT8 m_nTNsot; |
|
43 |
|
|
44 |
/** Default constructor, initialises members */ |
|
45 |
CNCSJPCSOTMarker(); |
|
46 |
/** Virtual destructor */ |
|
47 |
virtual ~CNCSJPCSOTMarker(); |
|
48 |
|
|
49 |
/** |
|
50 |
* Parse the marker from the JPC codestream. |
|
51 |
* @param JPC CNCSJPC to use to parse file. |
|
52 |
* @param Stream IOStream to use to parse file. |
|
53 |
* @return CNCSError NCS_SUCCESS, or Error code on failure. |
|
54 |
*/ |
|
55 |
virtual CNCSError Parse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream); |
|
56 |
/** |
|
57 |
* UnParse the marker to the JPC codestream. |
|
58 |
* @param Stream IOStream to use to parse file. |
|
59 |
* @param JPC CNCSJPC to use to parse file. |
|
60 |
* @return CNCSError NCS_SUCCESS, or Error code on failure. |
|
61 |
*/ |
|
62 |
virtual CNCSError UnParse(class CNCSJPC &JPC, CNCSJPCIOStream &Stream); |
|
63 |
}; |
|
64 |
|
|
65 |
|
|
66 |
#endif // !NCSJPCSOTMARKER_H |
|
0 | 67 |
tags/tmp_build/libraries/libjni-readecw-linux/include/NCSJPCBuffer.h | ||
---|---|---|
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/NCSJPCBuffer.h $ |
|
15 |
** CREATED: 14/03/2003 3:27:34 PM |
|
16 |
** AUTHOR: Simon Cope |
|
17 |
** PURPOSE: CNCSJPCBuffer class header |
|
18 |
** EDITS: [xx] ddMmmyy NAME COMMENTS |
|
19 |
*******************************************************/ |
|
20 |
|
|
21 |
#ifndef NCSJPCBUFFER_H |
|
22 |
#define NCSJPCBUFFER_H |
|
23 |
|
|
24 |
#ifndef NCSJPCRECT_H |
|
25 |
#include "NCSJPCRect.h" |
|
26 |
#endif // NCSJPCRECT_H |
|
27 |
|
|
28 |
#ifndef NCSMISC_H |
|
29 |
#include "NCSMisc.h" |
|
30 |
#endif |
|
31 |
#ifndef NCSECWCLIENT_H |
|
32 |
#include "NCSECWClient.h" |
|
33 |
#endif |
|
34 |
#ifndef NCSMEMPOOL_H |
|
35 |
#include "NCSMemPool.h" |
|
36 |
#endif // NCSMEMPOOL_H |
|
37 |
|
|
38 |
#include <vector> |
|
39 |
|
|
40 |
/** |
|
41 |
* CNCSJPCBuffer class - the base JPC scanline buffer. |
|
42 |
* |
|
43 |
* @author Simon Cope |
|
44 |
* @version $Revision$ $Author$ $Date$ |
|
45 |
*/ |
|
46 |
class NCSJPC_EXPORT_ALL CNCSJPCBuffer: public CNCSJPCRect { |
|
47 |
public: |
|
48 |
/** Maximum UINT8 value */ |
|
49 |
static const UINT32 MAXUINT8; |
|
50 |
/** Maximum UINT16 value */ |
|
51 |
static const UINT32 MAXUINT16; |
|
52 |
/** Maximum UINT32 value */ |
|
53 |
static const UINT32 MAXUINT32; |
|
54 |
/** Minimum UINT8 value */ |
|
55 |
static const UINT32 MINUINT8; |
|
56 |
/** Minimum UINT16 value */ |
|
57 |
static const UINT32 MINUINT16; |
|
58 |
/** Minimum UINT32 value */ |
|
59 |
static const UINT32 MINUINT32; |
|
60 |
|
|
61 |
/** Maximum INT8 value */ |
|
62 |
static const UINT32 MAXINT8; |
|
63 |
/** Maximum INT16 value */ |
|
64 |
static const UINT32 MAXINT16; |
|
65 |
/** Maximum INT32 value */ |
|
66 |
static const UINT32 MAXINT32; |
|
67 |
/** Minimum INT8 value */ |
|
68 |
static const INT32 MININT8; |
|
69 |
/** Minimum INT16 value */ |
|
70 |
static const INT32 MININT16; |
|
71 |
/** Minimum INT32 value */ |
|
72 |
static const INT32 MININT32; |
|
73 |
|
|
74 |
/** |
|
75 |
* SystemInfo class - Some basic system capabilities we care about. |
|
76 |
* |
|
77 |
* @author Simon Cope |
|
78 |
* @version $Revision$ $Author$ $Date$ |
|
79 |
*/ |
|
80 |
class NCSJPC_EXPORT_ALL SystemInfo { |
|
81 |
public: |
|
82 |
/** MMX Is present */ |
|
83 |
bool m_bMMXPresent; |
|
84 |
/** SSE is present */ |
|
85 |
bool m_bSSEPresent; |
|
86 |
/** SSE2 is present */ |
|
87 |
bool m_bSSE2Present; |
|
88 |
/** 3DNow is present */ |
|
89 |
bool m_b3DNowPresent; |
|
90 |
/** Bytes of physical memory on system */ |
|
91 |
UINT64 m_nPhysicalMemBytes; |
|
92 |
/** Default constructor */ |
|
93 |
SystemInfo(); |
|
94 |
/** Current timestamp in US */ |
|
95 |
static NCSTimeStampUs GetTime(); |
|
96 |
#ifdef WIN32 |
|
97 |
private: |
|
98 |
/** high-resolution Timer frequency */ |
|
99 |
static LARGE_INTEGER sm_iFrequency; |
|
100 |
#endif |
|
101 |
}; |
|
102 |
/** SystemInfo instance */ |
|
103 |
static SystemInfo sm_SystemInfo; |
|
104 |
/** Buffer copy US */ |
|
105 |
static NCSTimeStampUs sm_usCopy; |
|
106 |
/** buffer copy bytes */ |
|
107 |
static UINT64 sm_nCopyBytes; |
|
108 |
/** buffer clear US */ |
|
109 |
static NCSTimeStampUs sm_usClear; |
|
110 |
/** buffer clear bytes */ |
|
111 |
static UINT64 sm_nClearBytes; |
|
112 |
/** buffer Alloc US */ |
|
113 |
static NCSTimeStampUs sm_usAlloc; |
|
114 |
/** Current buffer alloc bytes */ |
|
115 |
static UINT64 sm_nAllocBytes; |
|
116 |
/** buffer free US */ |
|
117 |
static NCSTimeStampUs sm_usFree; |
|
118 |
|
|
119 |
typedef enum { |
|
120 |
/** s16 integer buffer type */ |
|
121 |
BT_INT16 = NCSCT_INT16, |
|
122 |
/** s32 integer buffer type */ |
|
123 |
BT_INT32 = NCSCT_INT32, |
|
124 |
/** IEEE4 single precision float buffer type */ |
|
125 |
BT_IEEE4 = NCSCT_IEEE4 |
|
126 |
} Type; |
|
127 |
|
|
128 |
/** FLAG: This buffer owns resources */ |
|
129 |
static const UINT32 AT_OWNER; |
|
130 |
/** FLAG: A child node returned the buffer and will free it later */ |
|
131 |
static const UINT32 AT_CHILD; |
|
132 |
/** Buffer is locked and can't be assigned to. */ |
|
133 |
static const UINT32 AT_LOCKED; |
|
134 |
|
|
135 |
/** |
|
136 |
* CNCSJPCBufferPool class - a rotating pool of buffers |
|
137 |
* |
|
138 |
* @author Simon Cope |
|
139 |
* @version $Revision$ $Author$ $Date$ |
|
140 |
*/ |
|
141 |
class CNCSJPCBufferPool { |
|
142 |
public: |
|
143 |
/** NCS memory pool */ |
|
144 |
NCSPool *m_pPool; |
|
145 |
/** Size */ |
|
146 |
UINT32 m_nSize; |
|
147 |
|
|
148 |
/** Constructor */ |
|
149 |
CNCSJPCBufferPool(); |
|
150 |
/** Destructor */ |
|
151 |
~CNCSJPCBufferPool(); |
|
152 |
/** Set the CodeBlock size */ |
|
153 |
void SetCBSize(Type eType, UINT32 nWidth, UINT32 nHeight); |
|
154 |
/** Alloc a buffer from the pool */ |
|
155 |
void *Alloc(); |
|
156 |
/** Return a buffer to the pool */ |
|
157 |
void Free(void *p); |
|
158 |
}; |
|
159 |
|
|
160 |
/** Buffer type */ |
|
161 |
Type m_eType; |
|
162 |
/** buffer flags */ |
|
163 |
UINT32 m_Flags; |
|
164 |
|
|
165 |
/** Actual buffer pointer */ |
|
166 |
void *m_pBuffer; |
|
167 |
/** Pool - optional */ |
|
168 |
CNCSJPCBufferPool *m_pPool; |
|
169 |
|
|
170 |
/** Buffer step size to next line */ |
|
171 |
int m_nStep; |
|
172 |
|
|
173 |
/** Default constructor, initialises members */ |
|
174 |
CNCSJPCBuffer(); |
|
175 |
/** Copy constructor */ |
|
176 |
CNCSJPCBuffer::CNCSJPCBuffer( const class CNCSJPCBuffer& src ); |
|
177 |
/** constructor, specify rect values */ |
|
178 |
CNCSJPCBuffer(UINT32 nWidth, Type eType); |
|
179 |
/** constructor, specify rect values */ |
|
180 |
CNCSJPCBuffer(UINT32 nWidth, UINT32 nHeight, Type eType); |
|
181 |
/** constructor, specify rect values */ |
|
182 |
CNCSJPCBuffer(INT32 nX0, INT32 nY0, INT32 nX1, INT32 nY1, Type eType); |
|
183 |
/** constructor, specify rect values */ |
|
184 |
CNCSJPCBuffer(INT32 nX0, INT32 nY0, UINT32 nWidth, UINT32 nHeight, Type eType); |
|
185 |
/** Virtual destructor */ |
|
186 |
virtual ~CNCSJPCBuffer(); |
|
187 |
|
|
188 |
/** Assignment operator */ |
|
189 |
class CNCSJPCBuffer& CNCSJPCBuffer::operator=( const class CNCSJPCBuffer& src ); |
|
190 |
|
|
191 |
/** Alloc a buffer the specified width and type */ |
|
192 |
bool Alloc(UINT32 nWidth, Type eType); |
|
193 |
/** Alloc a buffer the specified width, height and type */ |
|
194 |
bool Alloc(UINT32 nWidth, UINT32 nHeight, Type eType); |
|
195 |
/** Alloc a buffer with the specified TL, BR and type */ |
|
196 |
bool Alloc(INT32 nX0, INT32 nY0, INT32 nX1, INT32 nY1, Type eType); |
|
197 |
/** Alloc a buffer with the specified TL, width, height and type */ |
|
198 |
bool Alloc(INT32 nX0, INT32 nY0, UINT32 nWidth, UINT32 nHeight, Type eType); |
|
199 |
/** Free the buffer */ |
|
200 |
void Free(); |
|
201 |
|
|
202 |
/** Assign a buffer to this buffer */ |
|
203 |
bool Assign(Type eType, void *pPtr, INT32 nStep = 0, bool bFree = true); |
|
204 |
/** Assign a buffer to this buffer */ |
|
205 |
bool Assign(UINT32 nWidth, Type eType, void *pPtr, INT32 nStep = 0, bool bFree = true); |
|
206 |
/** Assign a buffer to this buffer */ |
|
207 |
bool Assign(UINT32 nWidth, UINT32 nHeight, Type eType, void *pPtr, INT32 nStep = 0, bool bFree = true); |
|
208 |
/** Assign a buffer to this buffer */ |
|
209 |
bool Assign(INT32 nX0, INT32 nY0, INT32 nX1, INT32 nY1, Type eType, void *pPtr, INT32 nStep = 0, bool bFree = true); |
|
210 |
/** Assign a buffer to this buffer */ |
|
211 |
bool Assign(INT32 nX0, INT32 nY0, UINT32 nWidth, UINT32 nHeight, Type eType, void *pPtr, INT32 nStep = 0, bool bFree = true); |
|
212 |
/** Release this buffer */ |
|
213 |
void Release(); |
|
214 |
|
|
215 |
/** Set flags */ |
|
216 |
void SetFlag(UINT32 Flag) { m_Flags |= Flag; }; |
|
217 |
/** Unset flags */ |
|
218 |
void UnSetFlags(UINT32 Flags) { m_Flags &= ~Flags; }; |
|
219 |
/** Get flags */ |
|
220 |
UINT32 GetFlags() { return(m_Flags); }; |
|
221 |
/** test flags */ |
|
222 |
bool TestFlags(UINT32 Flag) { return((m_Flags & Flag) ? true : false); }; |
|
223 |
|
|
224 |
/** |
|
225 |
* Return the size of a buffer in bytes (default 1 cell). |
|
226 |
* @param eType Type of buffer |
|
227 |
* @param nWidth Number of pixels in buffer. |
|
228 |
* @return UINT32 calculated buffer size in bytes. |
|
229 |
*/ |
|
230 |
static NCS_INLINE UINT32 Size(Type eType, UINT32 nWidth = 1, UINT32 nHeight = 1) { |
|
231 |
UINT32 nLineSize = 0; |
|
232 |
switch(eType) { |
|
233 |
case BT_INT16: |
|
234 |
nLineSize = sizeof(INT16) * nWidth; |
|
235 |
break; |
|
236 |
case BT_INT32: |
|
237 |
nLineSize = sizeof(INT32) * nWidth; |
|
238 |
break; |
|
239 |
case BT_IEEE4: |
|
240 |
nLineSize = sizeof(IEEE4) * nWidth; |
|
241 |
break; |
|
242 |
} |
|
243 |
|
|
244 |
if(nHeight != 1 && nLineSize % 32) { |
|
245 |
// Pad scanlines to 32 byte multiples for performance |
|
246 |
// when the buffer is > 1 line high |
|
247 |
nLineSize = (1 + nLineSize / 32) * 32; |
|
248 |
} |
|
249 |
return(nLineSize * nHeight); |
|
250 |
} |
|
251 |
/** Get buffer step in cells */ |
|
252 |
NCS_INLINE UINT32 GetStep() { return(m_nStep); }; |
|
253 |
/** Get buffer step in bytes */ |
|
254 |
NCS_INLINE UINT32 GetStepBytes() { return(m_nStep * Size(m_eType)); }; |
|
255 |
/** get buffer type */ |
|
256 |
NCS_INLINE Type GetType() { return(m_eType); }; |
|
257 |
/** get pointer to start of buffer (0,0) */ |
|
258 |
NCS_INLINE void *GetPtr() { return(m_pBuffer); }; |
|
259 |
/** get pointer to buffer at (x,y) */ |
|
260 |
NCS_INLINE void *GetPtr(INT32 x, INT32 y) { return((UINT8*)m_pBuffer + (y - GetY0()) * (INT32)GetStepBytes() + (x - GetX0()) * (INT32)Size(GetType())); }; |
|
261 |
|
|
262 |
/** |
|
263 |
* Return the size of the Wavelet Tranform border for the specified pipeline type. |
|
264 |
* @param eType Type of buffer |
|
265 |
* @return UINT32 Width/Height of border in CELLS. |
|
266 |
*/ |
|
267 |
static NCS_INLINE UINT32 Border(Type eType) { |
|
268 |
switch(eType) { |
|
269 |
case BT_INT16: |
|
270 |
case BT_INT32: |
|
271 |
return(1); |
|
272 |
break; |
|
273 |
case BT_IEEE4: |
|
274 |
return(2); |
|
275 |
break; |
|
276 |
} |
|
277 |
return(0); |
|
278 |
} |
|
279 |
|
|
280 |
/** Clear buffer to 0 */ |
|
281 |
void Clear(); |
|
282 |
/** |
|
283 |
* Convert a line to a line of type T. |
|
284 |
* @param pDst Pointer to Destination buffer |
|
285 |
* @return bool true on succes, else false. |
|
286 |
*/ |
|
287 |
template <class T> bool Convert(T *pDst, UINT8 nStep = 1) { |
|
288 |
if(m_pBuffer && pDst) { |
|
289 |
UINT32 x = 0; |
|
290 |
UINT32 nWidth = GetWidth(); |
|
291 |
|
|
292 |
if(nStep == 1) { |
|
293 |
// Single band |
|
294 |
switch(GetType()) { |
|
295 |
case CNCSJPCBuffer::BT_INT16: |
|
296 |
for(x = 0; x < nWidth; x++) { |
|
297 |
pDst[x] = (T)((INT16*)m_pBuffer)[x]; |
|
298 |
} |
|
299 |
break; |
|
300 |
case CNCSJPCBuffer::BT_INT32: |
|
301 |
for(x = 0; x < nWidth; x++) { |
|
302 |
pDst[x] = (T)((INT32*)m_pBuffer)[x]; |
|
303 |
} |
|
304 |
break; |
|
305 |
case CNCSJPCBuffer::BT_IEEE4: |
|
306 |
FLT_TO_INT_INIT(); |
|
307 |
for(x = 0; x < nWidth; x++) { |
|
308 |
pDst[x] = (T)NCSfloatToInt32_RM(((IEEE4*)m_pBuffer)[x]); |
|
309 |
// pDst[x] = (T)NCSFloor(((IEEE4*)m_pBuffer)[x]); |
|
310 |
} |
|
311 |
FLT_TO_INT_FINI(); |
|
312 |
break; |
|
313 |
} |
|
314 |
} else if(nStep == 3) { |
|
315 |
// 3 band - eg RGB |
|
316 |
switch(GetType()) { |
|
317 |
case CNCSJPCBuffer::BT_INT16: |
|
318 |
for(x = 0; x < nWidth; x++) { |
|
319 |
pDst[x * 3] = (T)((INT16*)m_pBuffer)[x]; |
|
320 |
} |
|
321 |
break; |
|
322 |
case CNCSJPCBuffer::BT_INT32: |
|
323 |
for(x = 0; x < nWidth; x++) { |
|
324 |
pDst[x * 3] = (T)((INT32*)m_pBuffer)[x]; |
|
325 |
} |
|
326 |
break; |
|
327 |
case CNCSJPCBuffer::BT_IEEE4: |
|
328 |
FLT_TO_INT_INIT(); |
|
329 |
for(x = 0; x < nWidth; x++) { |
|
330 |
pDst[x*3] = (T)NCSfloatToInt32_RM(((IEEE4*)m_pBuffer)[x]); |
|
331 |
} |
|
332 |
FLT_TO_INT_FINI(); |
|
333 |
break; |
|
334 |
} |
|
335 |
} else if(nStep == 4) { |
|
336 |
// 4 band, eg RGBA |
|
337 |
switch(GetType()) { |
|
338 |
case CNCSJPCBuffer::BT_INT16: |
|
339 |
for(x = 0; x < nWidth; x++) { |
|
340 |
pDst[x * 4] = (T)((INT16*)m_pBuffer)[x]; |
|
341 |
} |
|
342 |
break; |
|
343 |
case CNCSJPCBuffer::BT_INT32: |
|
344 |
for(x = 0; x < nWidth; x++) { |
|
345 |
pDst[x * 4] = (T)((INT32*)m_pBuffer)[x]; |
|
346 |
} |
|
347 |
break; |
|
348 |
case CNCSJPCBuffer::BT_IEEE4: |
|
349 |
FLT_TO_INT_INIT(); |
|
350 |
for(x = 0; x < nWidth; x++) { |
|
351 |
pDst[x*4] = (T)NCSfloatToInt32_RM(((IEEE4*)m_pBuffer)[x]); |
|
352 |
} |
|
353 |
FLT_TO_INT_FINI(); |
|
354 |
} |
|
355 |
} else { |
|
356 |
switch(GetType()) { |
|
357 |
case CNCSJPCBuffer::BT_INT16: |
|
358 |
for(x = 0; x < nWidth; x++) { |
|
359 |
pDst[x * nStep] = (T)((INT16*)m_pBuffer)[x]; |
|
360 |
} |
|
361 |
break; |
|
362 |
case CNCSJPCBuffer::BT_INT32: |
|
363 |
for(x = 0; x < nWidth; x++) { |
|
364 |
pDst[x * nStep] = (T)((INT32*)m_pBuffer)[x]; |
|
365 |
} |
|
366 |
break; |
|
367 |
case CNCSJPCBuffer::BT_IEEE4: |
|
368 |
FLT_TO_INT_INIT(); |
|
369 |
for(x = 0; x < nWidth; x++) { |
|
370 |
pDst[x*nStep] = (T)NCSfloatToInt32_RM(((IEEE4*)m_pBuffer)[x]); |
|
371 |
} |
|
372 |
FLT_TO_INT_FINI(); |
|
373 |
break; |
|
374 |
} |
|
375 |
} |
|
376 |
return(true); |
|
377 |
} |
|
378 |
return(false); |
|
379 |
} |
|
380 |
/** |
|
381 |
* Convert a line to a line of type T. |
|
382 |
* @param pDst Pointer to Destination buffer |
|
383 |
* @return bool true on succes, else false. |
|
384 |
*/ |
|
385 |
template <class T> bool ConvertFLT(T *pDst, UINT8 nStep = 1) { |
|
386 |
if(m_pBuffer && pDst) { |
|
387 |
UINT32 x = 0; |
|
388 |
UINT32 nWidth = GetWidth(); |
|
389 |
|
|
390 |
if(nStep == 1) { |
|
391 |
// Single band |
|
392 |
switch(GetType()) { |
|
393 |
case CNCSJPCBuffer::BT_INT16: |
|
394 |
for(x = 0; x < nWidth; x++) { |
|
395 |
pDst[x] = (T)((INT16*)m_pBuffer)[x]; |
|
396 |
} |
|
397 |
break; |
|
398 |
case CNCSJPCBuffer::BT_INT32: |
|
399 |
for(x = 0; x < nWidth; x++) { |
|
400 |
pDst[x] = (T)((INT32*)m_pBuffer)[x]; |
|
401 |
} |
|
402 |
break; |
|
403 |
case CNCSJPCBuffer::BT_IEEE4: |
|
404 |
for(x = 0; x < nWidth; x++) { |
|
405 |
pDst[x] = (T)((IEEE4*)m_pBuffer)[x]; |
|
406 |
} |
|
407 |
break; |
|
408 |
} |
|
409 |
} else if(nStep == 3) { |
|
410 |
// 3 band - eg RGB |
|
411 |
switch(GetType()) { |
|
412 |
case CNCSJPCBuffer::BT_INT16: |
|
413 |
for(x = 0; x < nWidth; x++) { |
|
414 |
pDst[x * 3] = (T)((INT16*)m_pBuffer)[x]; |
|
415 |
} |
|
416 |
break; |
|
417 |
case CNCSJPCBuffer::BT_INT32: |
|
418 |
for(x = 0; x < nWidth; x++) { |
|
419 |
pDst[x * 3] = (T)((INT32*)m_pBuffer)[x]; |
|
420 |
} |
|
421 |
break; |
|
422 |
case CNCSJPCBuffer::BT_IEEE4: |
|
423 |
for(x = 0; x < nWidth; x++) { |
|
424 |
pDst[x * 3] = (T)((IEEE4*)m_pBuffer)[x]; |
|
425 |
} |
|
426 |
break; |
|
427 |
} |
|
428 |
} else if(nStep == 4) { |
|
429 |
// 4 band, eg RGBA |
|
430 |
switch(GetType()) { |
|
431 |
case CNCSJPCBuffer::BT_INT16: |
|
432 |
for(x = 0; x < nWidth; x++) { |
|
433 |
pDst[x * 4] = (T)((INT16*)m_pBuffer)[x]; |
|
434 |
} |
|
435 |
break; |
|
436 |
case CNCSJPCBuffer::BT_INT32: |
|
437 |
for(x = 0; x < nWidth; x++) { |
|
438 |
pDst[x * 4] = (T)((INT32*)m_pBuffer)[x]; |
|
439 |
} |
|
440 |
break; |
|
441 |
case CNCSJPCBuffer::BT_IEEE4: |
|
442 |
for(x = 0; x < nWidth; x++) { |
|
443 |
pDst[x * 4] = (T)((IEEE4*)m_pBuffer)[x]; |
|
444 |
} |
|
445 |
break; |
|
446 |
} |
|
447 |
} else { |
|
448 |
switch(GetType()) { |
|
449 |
case CNCSJPCBuffer::BT_INT16: |
|
450 |
for(x = 0; x < nWidth; x++) { |
|
451 |
pDst[x * nStep] = (T)((INT16*)m_pBuffer)[x]; |
|
452 |
} |
|
453 |
break; |
|
454 |
case CNCSJPCBuffer::BT_INT32: |
|
455 |
for(x = 0; x < nWidth; x++) { |
|
456 |
pDst[x * nStep] = (T)((INT32*)m_pBuffer)[x]; |
|
457 |
} |
|
458 |
break; |
|
459 |
case CNCSJPCBuffer::BT_IEEE4: |
|
460 |
for(x = 0; x < nWidth; x++) { |
|
461 |
pDst[x * nStep] = (T)((IEEE4*)m_pBuffer)[x]; |
|
462 |
} |
|
463 |
break; |
|
464 |
} |
|
465 |
} |
|
466 |
return(true); |
|
467 |
} |
|
468 |
return(false); |
|
469 |
} |
|
470 |
/** |
|
471 |
* Read buffer to a type T. |
|
472 |
* @param pDst Pointer to Destination buffer |
|
473 |
* @return bool true on succes, else false. |
|
474 |
*/ |
|
475 |
template <class T> bool Read(T *pDst, UINT8 nStep = 1) { |
|
476 |
for(UINT32 y = 0; y < GetHeight(); y++) { |
|
477 |
Convert(pDst, nStep); |
|
478 |
} |
|
479 |
return(true); |
|
480 |
} |
|
481 |
/** |
|
482 |
* Read buffer to a (IEEE4/IEEE8) type T. |
|
483 |
* @param pDst Pointer to Destination buffer |
|
484 |
* @return bool true on succes, else false. |
|
485 |
*/ |
|
486 |
template <class T> bool ReadFLT(T *pDst, UINT8 nStep = 1) { |
|
487 |
for(UINT32 y = 0; y < GetHeight(); y++) { |
|
488 |
ConvertFLT(pDst, nStep); |
|
489 |
} |
|
490 |
return(true); |
|
491 |
} |
|
492 |
|
|
493 |
/** Read value(s) from the buffer at the specified position, size */ |
|
494 |
NCS_INLINE bool Read(void *pValue, INT32 nX, INT32 nY = 0, UINT32 nWidth = 1, UINT32 nHeight = 1, UINT32 nStep = 1) { |
|
495 |
UINT32 x, y; |
|
496 |
switch(m_eType) { |
|
497 |
case BT_INT16: |
|
498 |
for(y = 0; y < nHeight; y++) { |
|
499 |
for(x = 0; x < nWidth; x++) { |
|
500 |
*((INT16*)pValue + nStep * y + x) = *((INT16*)m_pBuffer + m_nStep * ((nY - m_Y0) + y) + (nX - m_X0) + x); |
|
501 |
} |
|
502 |
} |
|
503 |
break; |
|
504 |
case BT_INT32: |
|
505 |
for(y = 0; y < nHeight; y++) { |
|
506 |
for(x = 0; x < nWidth; x++) { |
|
507 |
*((INT32*)pValue + nStep * y + x) = *((INT32*)m_pBuffer + m_nStep * ((nY - m_Y0) + y) + (nX - m_X0) + x); |
|
508 |
} |
|
509 |
} |
|
510 |
break; |
|
511 |
case BT_IEEE4: |
|
512 |
for(y = 0; y < nHeight; y++) { |
|
513 |
for(x = 0; x < nWidth; x++) { |
|
514 |
*((IEEE4*)pValue + nStep * y + x) = *((IEEE4*)m_pBuffer + m_nStep * ((nY - m_Y0) + y) + (nX - m_X0) + x); |
|
515 |
} |
|
516 |
} |
|
517 |
break; |
|
518 |
} |
|
519 |
return(true); |
|
520 |
} |
|
521 |
/** Read from the buffer to the destination buffer, copying only the intersecting area */ |
|
522 |
NCS_INLINE bool Read(CNCSJPCBuffer *pDst) { |
|
523 |
CNCSJPCRect r(NCSMax(GetX0(), pDst->GetX0()), |
|
524 |
NCSMax(GetY0(), pDst->GetY0()), |
|
525 |
NCSMin(GetX1(), pDst->GetX1()), |
|
526 |
NCSMin(GetY1(), pDst->GetY1())); |
|
527 |
if(pDst->GetType() == GetType()) { |
|
528 |
return(Copy(r.GetWidth(), r.GetHeight(), |
|
529 |
(UINT8*)pDst->GetPtr() + (r.GetY0() - pDst->GetY0()) * pDst->GetStepBytes() + Size(m_eType, r.GetX0() - pDst->GetX0()), |
|
530 |
pDst->GetStepBytes(), |
|
531 |
(UINT8*)GetPtr() + (r.GetY0() - GetY0()) * GetStepBytes() + Size(m_eType, r.GetX0() - GetX0()), |
|
532 |
GetStepBytes(), |
|
533 |
m_eType)); |
|
534 |
} else { |
|
535 |
for(UINT32 y = 0; y < r.GetHeight(); y++) { |
|
536 |
CNCSJPCBuffer tmp; |
|
537 |
tmp.Assign(r.GetX0(), r.GetY0(), r.GetWidth(), r.GetHeight(), GetType(), (UINT8*)GetPtr() + (y + r.GetY0() - GetY0()) * GetStepBytes() + Size(m_eType, r.GetX0() - GetX0())); |
|
538 |
switch(pDst->GetType()) { |
|
539 |
case BT_INT16: |
|
540 |
tmp.Convert((INT16*)((UINT8*)pDst->GetPtr() + (y + r.GetY0() - pDst->GetY0()) * pDst->GetStepBytes() + Size(m_eType, r.GetX0() - pDst->GetX0()))); |
|
541 |
break; |
|
542 |
case BT_INT32: |
|
543 |
tmp.Convert((INT32*)((UINT8*)pDst->GetPtr() + (y + r.GetY0() - pDst->GetY0()) * pDst->GetStepBytes() + Size(m_eType, r.GetX0() - pDst->GetX0()))); |
|
544 |
break; |
|
545 |
case BT_IEEE4: |
|
546 |
tmp.ConvertFLT((IEEE4*)((UINT8*)pDst->GetPtr() + (y + r.GetY0() - pDst->GetY0()) * pDst->GetStepBytes() + Size(m_eType, r.GetX0() - pDst->GetX0()))); |
|
547 |
break; |
|
548 |
} |
|
549 |
tmp.Release(); |
|
550 |
} |
|
551 |
} |
|
552 |
return(true); |
|
553 |
} |
|
554 |
|
|
555 |
/** |
|
556 |
* Clip valus in the buffer to the specified range. |
|
557 |
* @param nMin Min value |
|
558 |
* @param nMax Max value |
|
559 |
* @return bool true on success, else false & error set. |
|
560 |
*/ |
|
561 |
bool Clip(INT32 nMin, INT32 nMax); |
|
562 |
/** |
|
563 |
* Clip valus in a buffer to the specified range. |
|
564 |
* @param fMin Min value |
|
565 |
* @param fMax Max value |
|
566 |
* @return bool true on success, else false & error set. |
|
567 |
*/ |
|
568 |
bool Clip(IEEE4 fMin, IEEE4 fMax); |
|
569 |
/** |
|
570 |
* Add a constant value to the buffer. |
|
571 |
* @param nValue Constant value to add |
|
572 |
* @param nScale Scale factor, *= NCS2Pow(-nScale) |
|
573 |
* @return bool true on succes, else false. |
|
574 |
*/ |
|
575 |
bool Add(const INT32 nValue, INT16 nScale = 0); |
|
576 |
/** |
|
577 |
* Add a constant value to the line. |
|
578 |
* @param fValue Constant value to add |
|
579 |
* @param nScale Scale factor, *= fScale |
|
580 |
* @return bool true on succes, else false. |
|
581 |
*/ |
|
582 |
bool Add(const IEEE4 fValue, INT16 nScale = 0); |
|
583 |
/** |
|
584 |
* Change bit depth (data range) of a buffer |
|
585 |
* @param nCurrentBits Current bit depth |
|
586 |
* @param nNewBits New bit depth |
|
587 |
* @return bool true on succes, else false. |
|
588 |
*/ |
|
589 |
bool OffsetShift(const INT32 nValue, UINT8 nCurrentBits, UINT8 nNewBits); |
|
590 |
/** |
|
591 |
* Copy from one pointer to another (may overlap). |
|
592 |
* @param nWidth Width in pixels. |
|
593 |
* @param nHeight Height in pixels. |
|
594 |
* @param pDst Dest buffer |
|
595 |
* @param nDstStep Dest buffer step size |
|
596 |
* @param pSrc Src buffer |
|
597 |
* @param nSrcStep Src buffer step size |
|
598 |
* @param eType Buffer Type |
|
599 |
* @return bool true on success, else false & error set. |
|
600 |
*/ |
|
601 |
static bool Copy(UINT32 nWidth, UINT32 nHeight, void *pDst, INT32 nDstStep, const void *pSrc, INT32 nSrcStep, Type eType); |
|
602 |
|
|
603 |
protected: |
|
604 |
|
|
605 |
private: |
|
606 |
static CNCSJPCBufferPool sm_Pool; |
|
607 |
|
|
608 |
bool Alloc(); |
|
609 |
}; |
|
610 |
|
|
611 |
typedef std::vector<CNCSJPCBuffer> CNCSJPCBufferVector; |
|
612 |
|
|
613 |
class NCSJPC_EXPORT_ALL CNCSJPCBufferCache { |
|
614 |
public: |
|
615 |
virtual ~CNCSJPCBufferCache() {}; |
|
616 |
virtual void SetBuffers(UINT32 nBuffers); |
|
617 |
virtual CNCSJPCBuffer *GetBuffer(UINT32 nBuffer); |
|
618 |
virtual CNCSJPCBuffer *FindBuffer(UINT32 &nBuffer, CNCSJPCRect &r, bool &bFound, CNCSJPCBuffer::Type eType); |
|
619 |
private: |
|
620 |
CNCSJPCBufferVector m_Buffers; |
|
621 |
}; |
|
622 |
|
|
623 |
#endif // !NCSJPCBUFFER_H |
|
0 | 624 |
tags/tmp_build/libraries/libjni-readecw-linux/include/NCSFileIO.h | ||
---|---|---|
1 |
/******************************************************** |
|
2 |
** Copyright 1999 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: include\NCSFileIO.h |
|
15 |
** CREATED: Tue 09/14/1999 |
|
16 |
** AUTHOR: Simon Cope |
|
17 |
** PURPOSE: 64bit file IO wrapper function header |
|
18 |
** EDITS: |
|
19 |
** [01] sjc 24Feb00 Added NCSGetFileVersion() call to return file version |
|
20 |
** [02] sjc 30Apr00 Merged Mac SDK port |
|
21 |
** [03] ny 30Oct00 Merged WinCE/Palm SDK port |
|
22 |
*******************************************************/ |
|
23 |
|
|
24 |
#ifndef NCSFILEIO_H |
|
25 |
#define NCSFILEIO_H |
|
26 |
|
|
27 |
#ifdef __cplusplus |
|
28 |
extern "C" { |
|
29 |
#endif |
|
30 |
|
|
31 |
#ifndef NCSTYPES_H |
|
32 |
#include "NCSTypes.h" |
|
33 |
#endif |
|
34 |
#ifndef NCSMALLOC_H |
|
35 |
#include "NCSMalloc.h" |
|
36 |
#endif |
|
37 |
|
|
38 |
#ifndef NCSERRORS_H |
|
39 |
#include "NCSErrors.h" |
|
40 |
#endif |
|
41 |
|
|
42 |
#ifdef LINUX |
|
43 |
#define __USE_FILE_OFFSET64 |
|
44 |
//#define __USE_LARGEFILE64 |
|
45 |
#endif |
|
46 |
|
|
47 |
#ifdef WIN32 |
|
48 |
|
|
49 |
#if !defined(_WIN32_WCE) //Pocket PC 2002 |
|
50 |
#include <io.h> |
|
51 |
#include <fcntl.h> |
|
52 |
#endif |
|
53 |
|
|
54 |
#elif defined PALM |
|
55 |
|
|
56 |
#include <FileStream.h> |
|
57 |
|
|
58 |
#elif defined _WIN32_WCE |
|
59 |
|
|
60 |
#include <stdlib.h> |
|
61 |
|
|
62 |
#elif defined MACINTOSH |
|
63 |
|
|
64 |
#include <stdlib.h> |
|
65 |
#include <fcntl.h> |
|
66 |
|
|
67 |
#elif defined SOLARIS || defined HPUX || defined LINUX |
|
68 |
|
|
69 |
#include <sys/types.h> |
|
70 |
#include <unistd.h> |
|
71 |
#include <strings.h> |
|
72 |
|
|
73 |
#endif |
|
74 |
|
|
75 |
|
|
76 |
#ifdef WIN32 |
|
77 |
#ifndef _WIN32_WCE |
|
78 |
|
|
79 |
#include <sys/types.h> |
|
80 |
#include <sys/stat.h> |
|
81 |
|
|
82 |
#else /* _WIN32_WCE */ |
|
83 |
|
|
84 |
//#if (_WIN32_WCE < 300) //< Pocket PC 2002 |
|
85 |
#define NO_STDIO |
|
86 |
//#endif |
|
87 |
|
|
88 |
#endif /* _WIN32_WCE */ |
|
89 |
|
|
90 |
#define NCS_FILE_SEP "\\" |
|
91 |
|
|
92 |
#elif defined MACINTOSH |
|
93 |
|
|
94 |
#include <types.h> |
|
95 |
#include <stat.h> |
|
96 |
|
|
97 |
#define NCS_FILE_SEP "/" |
|
98 |
|
|
99 |
#elif defined PALM |
|
100 |
|
|
101 |
#include <PalmTypes.h> |
|
102 |
#define NO_STDIO |
|
103 |
|
|
104 |
#define NCS_FILE_SEP "/" |
|
105 |
|
|
106 |
#elif defined SOLARIS || defined HPUX || defined LINUX |
|
107 |
|
|
108 |
#include <sys/types.h> |
|
109 |
#include <sys/stat.h> |
|
110 |
#include <fcntl.h> |
|
111 |
#include <stdlib.h> |
|
112 |
|
|
113 |
#define NCS_FILE_SEP "/" |
|
114 |
|
|
115 |
#elif defined MACOSX |
|
116 |
#include <sys/types.h> |
|
117 |
#include <sys/stat.h> |
|
118 |
#include <fcntl.h> |
|
119 |
#include <stdlib.h> |
|
120 |
|
|
121 |
#define NCS_FILE_SEP "/" |
|
122 |
|
|
123 |
#else /* WIN32 */ |
|
124 |
|
|
125 |
#error - need to include types.h and stat.h for this platform |
|
126 |
|
|
127 |
#endif /* WIN32 */ |
|
128 |
|
|
129 |
|
|
130 |
#ifndef PALM |
|
131 |
#include <stdio.h> |
|
132 |
#endif /* PALM */ |
|
133 |
|
|
134 |
#define NCS_FILE_READ (1 << 0) |
|
135 |
#define NCS_FILE_READ_WRITE (1 << 1) |
|
136 |
#define NCS_FILE_CREATE (1 << 2) |
|
137 |
#define NCS_FILE_CREATE_UNIQUE (1 << 3) |
|
138 |
#define NCS_FILE_APPEND (1 << 4) |
|
139 |
#define NCS_FILE_TEMPORARY (1 << 5) |
|
140 |
#define NCS_FILE_ASYNCIO (1 << 6) |
|
141 |
|
|
142 |
#ifdef WIN32 |
|
143 |
|
|
144 |
typedef HANDLE NCS_FILE_HANDLE; |
|
145 |
#define NCS_NULL_FILE_HANDLE NULL |
|
146 |
typedef DWORD NCS_FILE_ORIGIN; |
|
147 |
#define NCS_FILE_SEEK_START FILE_BEGIN |
|
148 |
#define NCS_FILE_SEEK_CURRENT FILE_CURRENT |
|
149 |
#define NCS_FILE_SEEK_END FILE_END |
|
150 |
|
|
151 |
#elif defined MACINTOSH |
|
152 |
|
|
153 |
typedef INT16 NCS_FILE_HANDLE; |
|
154 |
#define NCS_NULL_FILE_HANDLE NULL |
|
155 |
|
|
156 |
typedef enum { |
|
157 |
NCS_FILE_SEEK_START = 0, |
|
158 |
NCS_FILE_SEEK_CURRENT = 1, |
|
159 |
NCS_FILE_SEEK_END = 2 |
|
160 |
} NCS_FILE_ORIGIN; |
|
161 |
|
|
162 |
#elif defined PALM |
|
163 |
|
|
164 |
typedef HANDLE NCS_FILE_HANDLE; |
|
165 |
typedef DWORD NCS_FILE_ORIGIN; |
|
166 |
#define NCS_FILE_SEEK_START FILE_BEGIN |
|
167 |
#define NCS_FILE_SEEK_CURRENT FILE_CURRENT |
|
168 |
#define NCS_FILE_SEEK_END FILE_END |
|
169 |
|
|
170 |
typedef struct NCS_FILE_HANDLE_STRUCT { |
|
171 |
LocalID dbID; // Local DB ID |
|
172 |
DmOpenRef dbRef; // DB Ref handle |
|
173 |
UINT16 nRecordSize;// Size of records |
|
174 |
UINT16 nRecords; // Nr of Records |
|
175 |
UINT32 nDBSize; // Total DB Data size |
|
176 |
UINT32 iOffset; // Current offset |
|
177 |
|
|
178 |
// Cached current record |
|
179 |
UINT16 iRecord; // Index of current record |
|
180 |
MemHandle hRecord; // Handle of current record |
|
181 |
MemPtr pData; // Data in current record |
|
182 |
} *NCS_FILE_HANDLE; |
|
183 |
|
|
184 |
typedef enum { |
|
185 |
NCS_FILE_SEEK_START = 0, |
|
186 |
NCS_FILE_SEEK_CURRENT = 1, |
|
187 |
NCS_FILE_SEEK_END = 2 |
|
188 |
} NCS_FILE_ORIGIN; |
|
189 |
|
|
190 |
#else /* PALM */ |
|
191 |
|
|
192 |
/* STDIO */ |
|
193 |
typedef int NCS_FILE_HANDLE; |
|
194 |
#define NCS_NULL_FILE_HANDLE -1 |
|
195 |
typedef int NCS_FILE_ORIGIN; |
|
196 |
#define NCS_FILE_SEEK_START SEEK_SET |
|
197 |
#define NCS_FILE_SEEK_CURRENT SEEK_CUR |
|
198 |
#define NCS_FILE_SEEK_END SEEK_END |
|
199 |
|
|
200 |
#endif /* WIN32 */ |
|
201 |
|
|
202 |
INT64 NCSFileSeekNative(NCS_FILE_HANDLE handle, INT64 offset, NCS_FILE_ORIGIN origin); |
|
203 |
INT64 NCSFileTellNative(NCS_FILE_HANDLE handle); |
|
204 |
|
|
205 |
#if defined(NO_STDIO)||defined(SOLARIS)||defined(IRIX)||defined(HPUX)||defined(LINUX) |
|
206 |
#define NCSFileSeek NCSFileSeekNative |
|
207 |
#define NCSFileTell NCSFileTellNative |
|
208 |
#else /* NO_STDIO||SOLARIS||IRIX */ |
|
209 |
INT64 NCSFileSeek(int handle, INT64 offset, int origin); |
|
210 |
INT64 NCSFileTell(int handle); |
|
211 |
#endif /* NO_STDIO||SOLARIS||IRIX */ |
|
212 |
|
|
213 |
NCSError NCSFileOpen(const char *szFilename, int iFlags, NCS_FILE_HANDLE *phFile); |
|
214 |
NCSError NCSFileClose(NCS_FILE_HANDLE handle); |
|
215 |
NCSError NCSFileRead(NCS_FILE_HANDLE handle, void* buffer, UINT32 count, UINT32* pRead); |
|
216 |
NCSError NCSFileWrite(NCS_FILE_HANDLE handle, void* buffer, UINT32 count, UINT32* pWrote); |
|
217 |
NCSError NCSFileTouch(NCS_FILE_HANDLE hFile); |
|
218 |
NCSError NCSFileFlush(NCS_FILE_HANDLE hFile); |
|
219 |
// |
|
220 |
// These routines read/write the specified type from/to a file. The type in the file is the byte order |
|
221 |
// specifiec by the routine name. The value will be swapped to/from the native CPU byte order as |
|
222 |
// appropriate. |
Also available in: Unified diff