Grok  9.7.5
grk_includes.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2022 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 #pragma once
22 
23 //#define GRK_FORCE_SIGNED_COMPRESS
24 
25 /*
26  * This must be included before any system headers,
27  * since they are affected by macros defined therein
28  */
29 #include "grk_config_private.h"
30 #include <memory.h>
31 #include <cstdlib>
32 #include <string>
33 #ifdef _MSC_VER
34 #define _USE_MATH_DEFINES // for C++
35 #endif
36 #include <cmath>
37 #include <cfloat>
38 #include <time.h>
39 #include <cstdio>
40 #include <cstdarg>
41 #include <ctype.h>
42 #include <cassert>
43 #include <cinttypes>
44 #include <climits>
45 #include <algorithm>
46 #include <sstream>
47 #include <iostream>
48 #include <vector>
49 #include <algorithm>
50 #include <numeric>
51 /*
52  Use fseeko() and ftello() if they are available since they use
53  'int64_t' rather than 'long'. It is wrong to use fseeko() and
54  ftello() only on systems with special LFS support since some systems
55  (e.g. FreeBSD) support a 64-bit int64_t by default.
56  */
57 #if defined(GROK_HAVE_FSEEKO) && !defined(fseek)
58 #define fseek fseeko
59 #define ftell ftello
60 #endif
61 #if defined(_WIN32)
62 #define GRK_FSEEK(stream, offset, whence) _fseeki64(stream, /* __int64 */ offset, whence)
63 #define GRK_FSTAT(fildes, stat_buff) _fstati64(fildes, /* struct _stati64 */ stat_buff)
64 #define GRK_FTELL(stream) /* __int64 */ _ftelli64(stream)
65 #define GRK_STAT_STRUCT struct _stati64
66 #define GRK_STAT(path, stat_buff) _stati64(path, /* struct _stati64 */ stat_buff)
67 #else
68 #define GRK_FSEEK(stream, offset, whence) fseek(stream, offset, whence)
69 #define GRK_FSTAT(fildes, stat_buff) fstat(fildes, stat_buff)
70 #define GRK_FTELL(stream) ftell(stream)
71 #define GRK_STAT_STRUCT struct stat
72 #define GRK_STAT(path, stat_buff) stat(path, stat_buff)
73 #endif
74 #if defined(__GNUC__)
75 #define GRK_RESTRICT __restrict__
76 #else
77 #define GRK_RESTRICT /* GRK_RESTRICT */
78 #endif
79 #ifdef __has_attribute
80 #if __has_attribute(no_sanitize)
81 #define GROK_NOSANITIZE(kind) __attribute__((no_sanitize(kind)))
82 #endif
83 #endif
84 #ifndef GROK_NOSANITIZE
85 #define GROK_NOSANITIZE(kind)
86 #endif
87 #define GRK_UNUSED(x) (void)x
88 
89 #include "simd.h"
90 #include "ThreadPool.hpp"
91 #include "packer.h"
92 #include "MinHeap.h"
93 #include "SequentialCache.h"
94 #include "SparseCache.h"
95 #include "CodeStreamLimits.h"
96 #include "util.h"
97 #include "MemManager.h"
98 #include "minpf_plugin_manager.h"
99 #include "plugin_interface.h"
100 #include "ICacheable.h"
101 #include "GrkObjectWrapper.h"
102 #include "logger.h"
103 #include "testing.h"
104 #include "MemStream.h"
105 #include "GrkMappedFile.h"
106 #include "GrkMatrix.h"
107 #include "GrkImage.h"
108 #include "StripPool.h"
109 #include "grk_exceptions.h"
110 #include "SparseBuffer.h"
111 #include "BitIO.h"
112 #include "BufferedStream.h"
113 #include "Profile.h"
114 #include "LengthCache.h"
115 #include "PLMarkerMgr.h"
116 #include "PLCache.h"
117 #include "SIZMarker.h"
118 #include "PPMMarker.h"
119 #include "SOTMarker.h"
120 #include "CodeStream.h"
121 #include "CodeStreamCompress.h"
122 #include "CodeStreamDecompress.h"
123 #include "FileFormat.h"
124 #include "FileFormatCompress.h"
125 #include "FileFormatDecompress.h"
126 #include "BitIO.h"
127 #include "TagTree.h"
128 #include "t1_common.h"
129 #include "T1Interface.h"
130 #include "Codeblock.h"
131 #include "Precinct.h"
132 #include "Subband.h"
133 #include "Resolution.h"
134 #include "BlockExec.h"
135 #include "ImageComponentFlow.h"
136 #include "Scheduler.h"
137 #include "SparseCanvas.h"
139 #include "WaveletReverse.h"
140 #include "PacketIter.h"
141 #include "PacketManager.h"
142 #include "ImageComponentFlow.h"
143 #include "TileComponent.h"
144 #include "TileProcessor.h"
145 #include "TileCache.h"
146 #include "WaveletFwd.h"
147 #include "T2Compress.h"
148 #include "T2Decompress.h"
149 #include "mct.h"
150 #include "grk_intmath.h"
151 #include "plugin_bridge.h"
152 #include "RateControl.h"
153 #include "RateInfo.h"
154 #include "T1Factory.h"
155 #include "DecompressScheduler.h"
156 #include "CompressScheduler.h"
The JPEG 2000 file format Reader/Writer (JP2)
Implementation of a packet iterator (PI)