svn-gvsig-desktop / trunk / libraries / libjni-readecw-linux / include / NCSJPCTypes.h @ 1458
History | View | Annotate | Download (4.47 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/NCSJPCTypes.h $
|
||
15 | ** CREATED: 05/12/2002 3:27:34 PM
|
||
16 | ** AUTHOR: Simon Cope
|
||
17 | ** PURPOSE: NCSJPC additional Types header
|
||
18 | ** EDITS: [xx] ddMmmyy NAME COMMENTS
|
||
19 | *******************************************************/
|
||
20 | |||
21 | #ifndef NCSJPCTYPES_H
|
||
22 | #define NCSJPCTYPES_H
|
||
23 | |||
24 | #ifndef NCSJPCDEFS_H
|
||
25 | #include "NCSJPCDefs.h" |
||
26 | #endif // NCSJPCDEFS_H |
||
27 | |||
28 | #ifndef NCSMALLOC_H
|
||
29 | #include "NCSMalloc.h" |
||
30 | #endif // NCSMALLOC_H |
||
31 | #ifndef NCSERROR_H
|
||
32 | #include "NCSError.h" |
||
33 | #endif // NCSERROR_H |
||
34 | |||
35 | // MMI headers
|
||
36 | #ifdef NCSJPC_X86_MMI
|
||
37 | |||
38 | #include <xmmintrin.h> |
||
39 | #include <emmintrin.h> |
||
40 | |||
41 | #ifdef NCSJPC_X86_MMI_MMX
|
||
42 | |||
43 | // Temporarily disable waning C4799 to keep VC happy
|
||
44 | #pragma warning( disable : 4799 ) |
||
45 | |||
46 | __forceinline __m128 _mm_cvtpi16_ps__INLINE(__m64 a) |
||
47 | { |
||
48 | __m128 tmp; |
||
49 | __m64 ext_val = _mm_cmpgt_pi16(_mm_setzero_si64(), a); |
||
50 | |||
51 | tmp = _mm_cvtpi32_ps(_mm_setzero_ps(), _mm_unpackhi_pi16(a, ext_val)); |
||
52 | return(_mm_cvtpi32_ps(_mm_movelh_ps(tmp, tmp),
|
||
53 | _mm_unpacklo_pi16(a, ext_val))); |
||
54 | } |
||
55 | __forceinline __m64 _mm_cvtps_pi16__INLINE(__m128 a) |
||
56 | { |
||
57 | return _mm_packs_pi32(_mm_cvtps_pi32(a),
|
||
58 | _mm_cvtps_pi32(_mm_movehl_ps(a, a))); |
||
59 | } |
||
60 | |||
61 | #pragma warning( default : 4799 ) |
||
62 | |||
63 | #endif //NCSJPC_X86_MMI_MMX |
||
64 | #endif //NCSJPC_X86_MMI |
||
65 | |||
66 | // STL headers we need
|
||
67 | #include <vector> |
||
68 | #include <map> |
||
69 | #include <list> |
||
70 | #include <memory> |
||
71 | |||
72 | // stdarg header.
|
||
73 | #include <stdarg.h> |
||
74 | |||
75 | #ifdef SOLARIS
|
||
76 | #include <sys/varargs.h> |
||
77 | #endif // POSIX |
||
78 | |||
79 | // TCHAR support for UNICODE
|
||
80 | #ifdef WIN32
|
||
81 | #include "TCHAR.h" |
||
82 | #endif
|
||
83 | |||
84 | /** packet ID type */
|
||
85 | typedef NCSBlockId NCSJPCPacketId;
|
||
86 | |||
87 | /** SubBand enumerated type */
|
||
88 | typedef enum { |
||
89 | /** LowLow subband */
|
||
90 | NCSJPC_LL = 0,
|
||
91 | /** HighLow - horizontally high-pass subband */
|
||
92 | NCSJPC_HL = 1,
|
||
93 | /** LowHigh - vertically high-pass subband */
|
||
94 | NCSJPC_LH = 2,
|
||
95 | /** HighHigh */
|
||
96 | NCSJPC_HH = 3
|
||
97 | } NCSJPCSubBandType; |
||
98 | |||
99 | /**
|
||
100 | * Cached value template.
|
||
101 | *
|
||
102 | * @author Simon Cope
|
||
103 | * @version $Revision$ $Author$ $Date$
|
||
104 | */
|
||
105 | template <class T> class NCSJPC_EXPORT TNCSCachedValue { |
||
106 | public:
|
||
107 | bool m_bCached;
|
||
108 | T m_Value; |
||
109 | |||
110 | TNCSCachedValue() { Invalidate(); }; |
||
111 | TNCSCachedValue(const TNCSCachedValue<T> &s) { *this = s; };
|
||
112 | |||
113 | NCS_INLINE void Invalidate() { m_bCached = false; }; |
||
114 | NCS_INLINE bool Cached() { return(m_bCached); }; |
||
115 | |||
116 | NCS_INLINE T& operator=(const T& s) {
|
||
117 | m_bCached = true;
|
||
118 | m_Value = s; |
||
119 | return(m_Value);
|
||
120 | }; |
||
121 | NCS_INLINE operator T() { |
||
122 | return(m_Value);
|
||
123 | }; |
||
124 | /**
|
||
125 | * EQ operator.
|
||
126 | * @return bool TF is equal.
|
||
127 | */
|
||
128 | NCS_INLINE bool operator==(const TNCSCachedValue<T> &s) { |
||
129 | return(m_Value == s.m_Value);
|
||
130 | } |
||
131 | /**
|
||
132 | * NEQ operator.
|
||
133 | * @return bool TF is NOT equal.
|
||
134 | */
|
||
135 | NCS_INLINE bool operator!=(const TNCSCachedValue<T> &s) { |
||
136 | return(m_Value != s.m_Value);
|
||
137 | } |
||
138 | /**
|
||
139 | * LT operator.
|
||
140 | * @return bool TF is LT.
|
||
141 | */
|
||
142 | NCS_INLINE bool operator<(const TNCSCachedValue<T> &s) { |
||
143 | return(m_Value < s.m_Value);
|
||
144 | } |
||
145 | }; |
||
146 | |||
147 | /**
|
||
148 | * NCSUUID - UUID class.
|
||
149 | *
|
||
150 | * @author Simon Cope
|
||
151 | * @version $Revision$ $Author$ $Date$
|
||
152 | */
|
||
153 | class NCSJPC_EXPORT NCSUUID { |
||
154 | public:
|
||
155 | UINT8 m_UUID[16];
|
||
156 | |||
157 | NCSUUID() { |
||
158 | memset(m_UUID, 0, sizeof(m_UUID)); |
||
159 | }; |
||
160 | NCSUUID(const UINT8 Src[16]) { |
||
161 | memcpy(m_UUID, Src, sizeof(m_UUID));
|
||
162 | }; |
||
163 | NCSUUID(const NCSUUID &Src) {
|
||
164 | memcpy(m_UUID, Src.m_UUID, sizeof(m_UUID));
|
||
165 | }; |
||
166 | virtual ~NCSUUID() {}; |
||
167 | |||
168 | NCS_INLINE bool operator==(const NCSUUID &s) { |
||
169 | return(memcmp(m_UUID, s.m_UUID, sizeof(m_UUID)) == 0); |
||
170 | } |
||
171 | NCS_INLINE bool operator!=(const NCSUUID &s) { |
||
172 | return(memcmp(m_UUID, s.m_UUID, sizeof(m_UUID)) != 0); |
||
173 | } |
||
174 | }; |
||
175 | |||
176 | /**
|
||
177 | * CNCSJPCGlobalLock - A global lock (mutex) class.
|
||
178 | *
|
||
179 | * @author Simon Cope
|
||
180 | * @version $Revision$ $Author$ $Date$
|
||
181 | */
|
||
182 | class CNCSJPCGlobalLock { |
||
183 | public:
|
||
184 | CNCSJPCGlobalLock(); |
||
185 | virtual ~CNCSJPCGlobalLock(); |
||
186 | void Lock(void); |
||
187 | void UnLock(void); |
||
188 | }; |
||
189 | |||
190 | /**
|
||
191 | * CNCSJPCNodeVector - vector of CNCSJPCNodes.
|
||
192 | *
|
||
193 | * @author Simon Cope
|
||
194 | * @version $Revision$ $Author$ $Date$
|
||
195 | */
|
||
196 | typedef std::vector<class CNCSJPCNode*> CNCSJPCNodeVector;
|
||
197 | |||
198 | #endif // NCSJPCTYPES_H |