Grok
7.6.0
build
libgrokj2k-CKORTy
libgrokj2k-7.6.0
src
lib
jp2
grok_includes.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016-2020 Grok Image Compression Inc.
3
*
4
* This source code is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Affero General Public License, version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This source code is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Affero General Public License for more details.
12
*
13
* You should have received a copy of the GNU Affero General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
*
17
* This source code incorporates work covered by the BSD 2-clause license.
18
* Please see the LICENSE file in the root directory for details.
19
*
20
*/
21
22
#pragma once
23
24
25
/*
26
* This must be included before any system headers,
27
* since they can react to macro defined there
28
*/
29
#include "grk_config_private.h"
30
31
/*
32
==========================================================
33
Standard includes used by the library
34
==========================================================
35
*/
36
#include <memory.h>
37
#include <stdlib.h>
38
#include <string>
39
#ifdef _MSC_VER
40
#define _USE_MATH_DEFINES // for C++
41
#endif
42
#include <cmath>
43
#include <float.h>
44
#include <time.h>
45
#include <stdio.h>
46
#include <stdarg.h>
47
#include <ctype.h>
48
#include <assert.h>
49
#include <inttypes.h>
50
#include <climits>
51
#include <algorithm>
52
#include <sstream>
53
#include <iostream>
54
#include <vector>
55
56
/* Avoid compile-time warning because parameter is not used */
57
#define ARG_NOT_USED(x) (void)(x)
58
59
/*
60
Use fseeko() and ftello() if they are available since they use
61
'off_t' rather than 'long'. It is wrong to use fseeko() and
62
ftello() only on systems with special LFS support since some systems
63
(e.g. FreeBSD) support a 64-bit off_t by default.
64
*/
65
#if defined(GROK_HAVE_FSEEKO) && !defined(fseek)
66
# define fseek fseeko
67
# define ftell ftello
68
#endif
69
70
#if defined(_WIN32)
71
# define GROK_FSEEK(stream,offset,whence) _fseeki64(stream,
/* __int64 */
offset,whence)
72
# define GROK_FSTAT(fildes,stat_buff) _fstati64(fildes,
/* struct _stati64 */
stat_buff)
73
# define GROK_FTELL(stream)
/* __int64 */
_ftelli64(stream)
74
# define GROK_STAT_STRUCT_T struct _stati64
75
# define GROK_STAT(path,stat_buff) _stati64(path,
/* struct _stati64 */
stat_buff)
76
#else
77
# define GROK_FSEEK(stream,offset,whence) fseek(stream,offset,whence)
78
# define GROK_FSTAT(fildes,stat_buff) fstat(fildes,stat_buff)
79
# define GROK_FTELL(stream) ftell(stream)
80
# define GROK_STAT_STRUCT_T struct stat
81
# define GROK_STAT(path,stat_buff) stat(path,stat_buff)
82
#endif
83
84
/*
85
==========================================================
86
Grok interface
87
==========================================================
88
*/
89
90
#include "
minpf_plugin_manager.h
"
91
#include "
plugin_interface.h
"
92
93
/*
94
==========================================================
95
Grok modules
96
==========================================================
97
*/
98
99
#if defined(__GNUC__)
100
#define GRK_RESTRICT __restrict__
101
#else
102
#define GRK_RESTRICT
/* GRK_RESTRICT */
103
#endif
104
105
106
#ifdef __has_attribute
107
#if __has_attribute(no_sanitize)
108
#define GROK_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
109
#endif
110
#endif
111
#ifndef GROK_NOSANITIZE
112
#define GROK_NOSANITIZE(kind)
113
#endif
114
115
#include "
simd.h
"
116
117
/* MSVC before 2013 and Borland C do not have lrintf */
118
#if defined(_MSC_VER)
119
#include <intrin.h>
120
static
inline
long
grok_lrintf
(
float
f)
121
{
122
#ifdef _M_X64
123
return
_mm_cvt_ss2si(_mm_load_ss(&f));
124
125
/* commented out line breaks many tests */
126
/* return (long)((f>0.0f) ? (f + 0.5f):(f -0.5f)); */
127
#elif defined(_M_IX86)
128
int
i;
129
_asm{
130
fld f
131
fistp i
132
};
133
134
return
i;
135
#else
136
return
(
long
)((f>0.0f) ? (f + 0.5f) : (f - 0.5f));
137
#endif
138
}
139
#else
140
static
inline
long
grok_lrintf
(
float
f) {
141
return
lrintf(f);
142
}
143
#endif
144
145
#if defined(_MSC_VER) && (_MSC_VER < 1400)
146
#define vsnprintf _vsnprintf
147
#endif
148
149
/* MSVC x86 is really bad at doing int64 = int32 * int32 on its own. Use intrinsic. */
150
#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__INTEL_COMPILER) && defined(_M_IX86)
151
# include <intrin.h>
152
# pragma intrinsic(__emul)
153
#endif
154
155
#define GRK_UNUSED(x) (void)x
156
157
#include "ThreadPool.hpp"
158
#include "
mem_stream.h
"
159
#include "
MemManager.h
"
160
#include "
logger.h
"
161
#include "
util.h
"
162
#include "
grok_exceptions.h
"
163
#include "
ChunkBuffer.h
"
164
#include "
BitIO.h
"
165
#include "
BufferedStream.h
"
166
#include "
image.h
"
167
#include "
invert.h
"
168
#include "
Quantizer.h
"
169
#include <
Profile.h
>
170
#include "
LengthMarkers.h
"
171
#include "
SIZMarker.h
"
172
#include "
PPMMarker.h
"
173
#include "
SOTMarker.h
"
174
#include "
CodeStream.h
"
175
#include "
markers.h
"
176
#include <
Dump.h
>
177
#include "
FileFormat.h
"
178
#include "
BitIO.h
"
179
#include "
TileComponentBuffer.h
"
180
#include "
PacketIter.h
"
181
#include "
TagTree.h
"
182
#include "
sparse_array.h
"
183
#include "
TileComponent.h
"
184
#include "
TileProcessor.h
"
185
#include "
Wavelet.h
"
186
#include "
t1_common.h
"
187
#include "
dwt_utils.h
"
188
#include "
dwt.h
"
189
#include "
sparse_array.h
"
190
#include "
T2Encode.h
"
191
#include "
T2Decode.h
"
192
#include "
mct.h
"
193
#include "
grok_intmath.h
"
194
#include "
plugin_bridge.h
"
195
#include "
RateControl.h
"
196
#include "
RateInfo.h
"
RateControl.h
SIZMarker.h
BitIO.h
RateInfo.h
grok_exceptions.h
TileComponentBuffer.h
t1_common.h
logger.h
dwt.h
FileFormat.h
TagTree.h
markers.h
CodeStream.h
simd.h
Dump.h
LengthMarkers.h
dwt_utils.h
plugin_bridge.h
mem_stream.h
mct.h
Implementation of a multi-component transforms (MCT)
minpf_plugin_manager.h
BufferedStream.h
T2Encode.h
ChunkBuffer.h
Profile.h
image.h
Implementation of operations on images (IMAGE)
TileComponent.h
sparse_array.h
Sparse array management.
grok_intmath.h
SOTMarker.h
PacketIter.h
Implementation of a packet iterator (PI)
T2Decode.h
Wavelet.h
MemManager.h
grok_lrintf
static long grok_lrintf(float f)
Definition:
grok_includes.h:140
invert.h
Implementation of the matrix inversion.
PPMMarker.h
TileProcessor.h
Quantizer.h
util.h
plugin_interface.h
Generated by
1.8.18