OpenJPEG  2.0.0
opj_includes.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005, Herve Drolon, FreeImage Team
3  * Copyright (c) 2008;2011-2012, Centre National d'Etudes Spatiales (CNES), France
4  * Copyright (c) 2012, CS Systemes d'Information, France
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 #ifndef OPJ_INCLUDES_H
29 #define OPJ_INCLUDES_H
30 
31 /*
32  * This must be included before any system headers,
33  * since they can react to macro defined there
34  */
35 #include "opj_config_private.h"
36 
37 /*
38  ==========================================================
39  Standard includes used by the library
40  ==========================================================
41 */
42 #include <memory.h>
43 #include <stdlib.h>
44 #include <string.h>
45 #include <math.h>
46 #include <float.h>
47 #include <time.h>
48 #include <stdio.h>
49 #include <stdarg.h>
50 #include <ctype.h>
51 #include <assert.h>
52 
53 /*
54  Use fseeko() and ftello() if they are available since they use
55  'off_t' rather than 'long'. It is wrong to use fseeko() and
56  ftello() only on systems with special LFS support since some systems
57  (e.g. FreeBSD) support a 64-bit off_t by default.
58 */
59 #if defined(OPJ_HAVE_FSEEKO)
60 # define fseek fseeko
61 # define ftell ftello
62 #endif
63 
64 
65 #if defined(WIN32) && !defined(Windows95) && !defined(__BORLANDC__) && \
66  !(defined(_MSC_VER) && _MSC_VER < 1400) && \
67  !(defined(__MINGW32__) && __MSVCRT_VERSION__ < 0x800)
68  /*
69  Windows '95 and Borland C do not support _lseeki64
70  Visual Studio does not support _fseeki64 and _ftelli64 until the 2005 release.
71  Without these interfaces, files over 2GB in size are not supported for Windows.
72  */
73 # define OPJ_FSEEK(stream,offset,whence) _fseeki64(stream,/* __int64 */ offset,whence)
74 # define OPJ_FSTAT(fildes,stat_buff) _fstati64(fildes,/* struct _stati64 */ stat_buff)
75 # define OPJ_FTELL(stream) /* __int64 */ _ftelli64(stream)
76 # define OPJ_STAT_STRUCT_T struct _stati64
77 # define OPJ_STAT(path,stat_buff) _stati64(path,/* struct _stati64 */ stat_buff)
78 #else
79 # define OPJ_FSEEK(stream,offset,whence) fseek(stream,offset,whence)
80 # define OPJ_FSTAT(fildes,stat_buff) fstat(fildes,stat_buff)
81 # define OPJ_FTELL(stream) ftell(stream)
82 # define OPJ_STAT_STRUCT_T struct stat
83 # define OPJ_STAT(path,stat_buff) stat(path,stat_buff)
84 #endif
85 
86 
87 /*
88  ==========================================================
89  OpenJPEG interface
90  ==========================================================
91  */
92 #include "openjpeg.h"
93 
94 /*
95  ==========================================================
96  OpenJPEG modules
97  ==========================================================
98 */
99 
100 /* Ignore GCC attributes if this is not GCC */
101 #ifndef __GNUC__
102  #define __attribute__(x) /* __attribute__(x) */
103 #endif
104 
105 /*
106 The inline keyword is supported by C99 but not by C90.
107 Most compilers implement their own version of this keyword ...
108 */
109 #ifndef INLINE
110  #if defined(_MSC_VER)
111  #define INLINE __forceinline
112  #elif defined(__GNUC__)
113  #define INLINE __inline__
114  #elif defined(__MWERKS__)
115  #define INLINE inline
116  #else
117  /* add other compilers here ... */
118  #define INLINE
119  #endif /* defined(<Compiler>) */
120 #endif /* INLINE */
121 
122 /* Are restricted pointers available? (C99) */
123 #if (__STDC_VERSION__ != 199901L)
124  /* Not a C99 compiler */
125  #ifdef __GNUC__
126  #define restrict __restrict__
127  #else
128  #define restrict /* restrict */
129  #endif
130 #endif
131 
132 /* MSVC and Borland C do not have lrintf */
133 #if defined(_MSC_VER) || defined(__BORLANDC__)
134 static INLINE long lrintf(float f){
135 #ifdef _M_X64
136  return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f));
137 #else
138  int i;
139 
140  _asm{
141  fld f
142  fistp i
143  };
144 
145  return i;
146 #endif
147 }
148 #endif
149 
150 #include "opj_inttypes.h"
151 #include "opj_clock.h"
152 #include "opj_malloc.h"
153 #include "function_list.h"
154 #include "event.h"
155 #include "bio.h"
156 #include "cio.h"
157 
158 #include "image.h"
159 #include "invert.h"
160 #include "j2k.h"
161 #include "jp2.h"
162 
163 #include "mqc.h"
164 #include "raw.h"
165 #include "bio.h"
166 
167 #include "pi.h"
168 #include "tgt.h"
169 #include "tcd.h"
170 #include "t1.h"
171 #include "dwt.h"
172 #include "t2.h"
173 #include "mct.h"
174 #include "opj_intmath.h"
175 
176 #ifdef USE_JPIP
177 #include "cidx_manager.h"
178 #include "indexbox_manager.h"
179 #endif
180 
181 /* JPWL>> */
182 #ifdef USE_JPWL
183 #include "openjpwl/jpwl.h"
184 #endif /* USE_JPWL */
185 /* <<JPWL */
186 
187 /* V2 */
188 
189 
190 #endif /* OPJ_INCLUDES_H */