OLD | NEW |
1 /* | 1 /* |
2 * The copyright in this software is being made available under the 2-clauses | 2 * The copyright in this software is being made available under the 2-clauses |
3 * BSD License, included below. This software may be subject to other third | 3 * BSD License, included below. This software may be subject to other third |
4 * party and contributor rights, including patent rights, and no such rights | 4 * party and contributor rights, including patent rights, and no such rights |
5 * are granted under this license. | 5 * are granted under this license. |
6 * | 6 * |
7 * Copyright (c) 2005, Herve Drolon, FreeImage Team | 7 * Copyright (c) 2005, Herve Drolon, FreeImage Team |
8 * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR | 8 * Copyright (c) 2008, 2011-2012, Centre National d'Etudes Spatiales (CNES), FR |
9 * Copyright (c) 2012, CS Systemes d'Information, France | 9 * Copyright (c) 2012, CS Systemes d'Information, France |
10 * All rights reserved. | 10 * All rights reserved. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 /* Are restricted pointers available? (C99) */ | 111 /* Are restricted pointers available? (C99) */ |
112 #if (__STDC_VERSION__ != 199901L) | 112 #if (__STDC_VERSION__ != 199901L) |
113 /* Not a C99 compiler */ | 113 /* Not a C99 compiler */ |
114 #ifdef __GNUC__ | 114 #ifdef __GNUC__ |
115 #define restrict __restrict__ | 115 #define restrict __restrict__ |
116 #else | 116 #else |
117 #define restrict /* restrict */ | 117 #define restrict /* restrict */ |
118 #endif | 118 #endif |
119 #endif | 119 #endif |
120 | 120 |
| 121 |
| 122 |
121 /* MSVC before 2013 and Borland C do not have lrintf */ | 123 /* MSVC before 2013 and Borland C do not have lrintf */ |
122 #if defined(_MSC_VER) && (_MSC_VER < 1800) || defined(__BORLANDC__) | 124 #if defined(_MSC_VER) |
123 static INLINE long lrintf(float f){ | 125 #include <intrin.h> |
| 126 static INLINE long opj_lrintf(float f){ |
124 #ifdef _M_X64 | 127 #ifdef _M_X64 |
125 return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); | 128 » return _mm_cvt_ss2si(_mm_load_ss(&f)); |
126 #else | 129 |
| 130 » /* commented out line breaks many tests */ |
| 131 /* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */ |
| 132 #elif defined(_M_IX86) |
127 int i; | 133 int i; |
128 | 134 _asm{ |
129 _asm{ | |
130 fld f | 135 fld f |
131 fistp i | 136 fistp i |
132 }; | 137 }; |
133 | 138 |
134 return i; | 139 return i; |
| 140 #else |
| 141 return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f)); |
135 #endif | 142 #endif |
136 } | 143 } |
| 144 #elif defined(__BORLANDC__) |
| 145 static INLINE long opj_lrintf(float f) { |
| 146 #ifdef _M_X64 |
| 147 return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); |
| 148 #else |
| 149 int i; |
| 150 |
| 151 _asm { |
| 152 fld f |
| 153 fistp i |
| 154 }; |
| 155 |
| 156 return i; |
| 157 #endif |
| 158 } |
| 159 #else |
| 160 static INLINE long opj_lrintf(float f) { |
| 161 return lrintf(f); |
| 162 } |
137 #endif | 163 #endif |
138 | 164 |
139 #if defined(_MSC_VER) && (_MSC_VER < 1400) | 165 #if defined(_MSC_VER) && (_MSC_VER < 1400) |
140 #define vsnprintf _vsnprintf | 166 #define vsnprintf _vsnprintf |
141 #endif | 167 #endif |
142 | 168 |
| 169 /* MSVC x86 is really bad at doing int64 = int32 * int32 on its own. Use intrins
ic. */ |
| 170 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && def
ined(_M_IX86) |
| 171 # include <intrin.h> |
| 172 # pragma intrinsic(__emul) |
| 173 #endif |
| 174 |
143 #include "opj_inttypes.h" | 175 #include "opj_inttypes.h" |
144 #include "opj_clock.h" | 176 #include "opj_clock.h" |
145 #include "opj_malloc.h" | 177 #include "opj_malloc.h" |
| 178 #include "event.h" |
146 #include "function_list.h" | 179 #include "function_list.h" |
147 #include "event.h" | |
148 #include "bio.h" | 180 #include "bio.h" |
149 #include "cio.h" | 181 #include "cio.h" |
150 | 182 |
151 #include "image.h" | 183 #include "image.h" |
152 #include "invert.h" | 184 #include "invert.h" |
153 #include "j2k.h" | 185 #include "j2k.h" |
154 #include "jp2.h" | 186 #include "jp2.h" |
155 | 187 |
156 #include "mqc.h" | 188 #include "mqc.h" |
157 #include "raw.h" | 189 #include "raw.h" |
(...skipping 17 matching lines...) Expand all Loading... |
175 #ifdef USE_JPWL | 207 #ifdef USE_JPWL |
176 #include "openjpwl/jpwl.h" | 208 #include "openjpwl/jpwl.h" |
177 #endif /* USE_JPWL */ | 209 #endif /* USE_JPWL */ |
178 /* <<JPWL */ | 210 /* <<JPWL */ |
179 | 211 |
180 /* V2 */ | 212 /* V2 */ |
181 #include "opj_codec.h" | 213 #include "opj_codec.h" |
182 | 214 |
183 | 215 |
184 #endif /* OPJ_INCLUDES_H */ | 216 #endif /* OPJ_INCLUDES_H */ |
OLD | NEW |