00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef OPJ_INCLUDES_H
00034 #define OPJ_INCLUDES_H
00035
00036
00037
00038
00039
00040 #include "opj_config_private.h"
00041
00042
00043
00044
00045
00046
00047 #include <memory.h>
00048 #include <stdlib.h>
00049 #include <string.h>
00050 #include <math.h>
00051 #include <float.h>
00052 #include <time.h>
00053 #include <stdio.h>
00054 #include <stdarg.h>
00055 #include <ctype.h>
00056 #include <assert.h>
00057 #include <limits.h>
00058
00059
00060
00061
00062
00063
00064
00065 #if defined(OPJ_HAVE_FSEEKO) && !defined(fseek)
00066 # define fseek fseeko
00067 # define ftell ftello
00068 #endif
00069
00070
00071 #if defined(WIN32) && !defined(Windows95) && !defined(__BORLANDC__) && \
00072 !(defined(_MSC_VER) && _MSC_VER < 1400) && \
00073 !(defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x800)
00074
00075
00076
00077
00078
00079 # define OPJ_FSEEK(stream,offset,whence) _fseeki64(stream, offset,whence)
00080 # define OPJ_FSTAT(fildes,stat_buff) _fstati64(fildes, stat_buff)
00081 # define OPJ_FTELL(stream) _ftelli64(stream)
00082 # define OPJ_STAT_STRUCT_T struct _stati64
00083 # define OPJ_STAT(path,stat_buff) _stati64(path, stat_buff)
00084 #else
00085 # define OPJ_FSEEK(stream,offset,whence) fseek(stream,offset,whence)
00086 # define OPJ_FSTAT(fildes,stat_buff) fstat(fildes,stat_buff)
00087 # define OPJ_FTELL(stream) ftell(stream)
00088 # define OPJ_STAT_STRUCT_T struct stat
00089 # define OPJ_STAT(path,stat_buff) stat(path,stat_buff)
00090 #endif
00091
00092
00093
00094
00095
00096
00097
00098 #include "openjpeg.h"
00099
00100
00101
00102
00103
00104
00105
00106
00107 #if (__STDC_VERSION__ >= 199901L)
00108 #define OPJ_RESTRICT restrict
00109 #else
00110
00111 #if defined(__GNUC__)
00112 #define OPJ_RESTRICT __restrict__
00113
00114
00115
00116
00117
00118
00119
00120 #else
00121 #define OPJ_RESTRICT
00122 #endif
00123 #endif
00124
00125 #ifdef __has_attribute
00126 #if __has_attribute(no_sanitize)
00127 #define OPJ_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
00128 #endif
00129 #endif
00130 #ifndef OPJ_NOSANITIZE
00131 #define OPJ_NOSANITIZE(kind)
00132 #endif
00133
00134
00135
00136 #if defined(_MSC_VER)
00137 #include <intrin.h>
00138 static INLINE long opj_lrintf(float f)
00139 {
00140 #ifdef _M_X64
00141 return _mm_cvt_ss2si(_mm_load_ss(&f));
00142
00143
00144
00145 #elif defined(_M_IX86)
00146 int i;
00147 _asm{
00148 fld f
00149 fistp i
00150 };
00151
00152 return i;
00153 #else
00154 return (long)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
00155 #endif
00156 }
00157 #elif defined(__BORLANDC__)
00158 static INLINE long opj_lrintf(float f)
00159 {
00160 #ifdef _M_X64
00161 return (long)((f > 0.0f) ? (f + 0.5f) : (f - 0.5f));
00162 #else
00163 int i;
00164
00165 _asm {
00166 fld f
00167 fistp i
00168 };
00169
00170 return i;
00171 #endif
00172 }
00173 #else
00174 static INLINE long opj_lrintf(float f)
00175 {
00176 return lrintf(f);
00177 }
00178 #endif
00179
00180 #if defined(_MSC_VER) && (_MSC_VER < 1400)
00181 #define vsnprintf _vsnprintf
00182 #endif
00183
00184
00185 #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
00186 # include <intrin.h>
00187 # pragma intrinsic(__emul)
00188 #endif
00189
00190
00191 #if defined(_M_X64)
00192
00193 # ifndef __SSE__
00194 # define __SSE__ 1
00195 # endif
00196 # ifndef __SSE2__
00197 # define __SSE2__ 1
00198 # endif
00199 #endif
00200
00201
00202
00203 #if defined(_M_IX86_FP)
00204 # if _M_IX86_FP >= 1
00205 # ifndef __SSE__
00206 # define __SSE__ 1
00207 # endif
00208 # endif
00209 # if _M_IX86_FP >= 2
00210 # ifndef __SSE2__
00211 # define __SSE2__ 1
00212 # endif
00213 # endif
00214 #endif
00215
00216
00217 typedef unsigned int OPJ_BITFIELD;
00218
00219 #define OPJ_UNUSED(x) (void)x
00220
00221 #include "opj_inttypes.h"
00222 #include "opj_clock.h"
00223 #include "opj_malloc.h"
00224 #include "event.h"
00225 #include "function_list.h"
00226 #include "bio.h"
00227 #include "cio.h"
00228
00229 #include "thread.h"
00230 #include "tls_keys.h"
00231
00232 #include "image.h"
00233 #include "invert.h"
00234 #include "j2k.h"
00235 #include "jp2.h"
00236
00237 #include "mqc.h"
00238 #include "bio.h"
00239
00240 #include "pi.h"
00241 #include "tgt.h"
00242 #include "tcd.h"
00243 #include "t1.h"
00244 #include "dwt.h"
00245 #include "t2.h"
00246 #include "mct.h"
00247 #include "opj_intmath.h"
00248 #include "sparse_array.h"
00249
00250 #ifdef USE_JPIP
00251 #include "cidx_manager.h"
00252 #include "indexbox_manager.h"
00253 #endif
00254
00255
00256 #ifdef USE_JPWL
00257 #include "openjpwl/jpwl.h"
00258 #endif
00259
00260
00261
00262 #include "opj_codec.h"
00263
00264
00265 #endif