MagickCore 7.1.1
Convert, Edit, Or Compose Bitmap Images
Loading...
Searching...
No Matches
cache-private.h
1/*
2 Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License. You may
6 obtain a copy of the License at
7
8 https://imagemagick.org/script/license.php
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 MagickCore cache private methods.
17*/
18#ifndef MAGICKCORE_CACHE_PRIVATE_H
19#define MAGICKCORE_CACHE_PRIVATE_H
20
21#include "MagickCore/cache.h"
22#include "MagickCore/distribute-cache.h"
23#include "MagickCore/opencl-private.h"
24#include "MagickCore/pixel.h"
25#include "MagickCore/random_.h"
26#include "MagickCore/thread-private.h"
27#include "MagickCore/semaphore.h"
28
29#if defined(__cplusplus) || defined(c_plusplus)
30extern "C" {
31#endif
32
33typedef void
34 *Cache;
35
36typedef MagickBooleanType
37 (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t,
38 Quantum *,ExceptionInfo *),
39 (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod,
40 const ssize_t,const ssize_t,Quantum *,ExceptionInfo *),
41 (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *);
42
43typedef const Quantum
44 *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod,
45 const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *),
46 *(*GetVirtualPixelsHandler)(const Image *);
47
48typedef const void
49 *(*GetVirtualMetacontentFromHandler)(const Image *);
50
51typedef Quantum
52 *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
53 const size_t,const size_t,ExceptionInfo *);
54
55typedef Quantum
56 *(*GetAuthenticPixelsFromHandler)(const Image *);
57
58typedef Quantum
59 *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
60 const size_t,const size_t,ExceptionInfo *);
61
62typedef void
63 (*DestroyPixelHandler)(Image *);
64
65typedef void
66 *(*GetAuthenticMetacontentFromHandler)(const Image *);
67
68typedef struct _CacheMethods
69{
70 GetVirtualPixelHandler
71 get_virtual_pixel_handler;
72
73 GetVirtualPixelsHandler
74 get_virtual_pixels_handler;
75
76 GetVirtualMetacontentFromHandler
77 get_virtual_metacontent_from_handler;
78
79 GetOneVirtualPixelFromHandler
80 get_one_virtual_pixel_from_handler;
81
82 GetAuthenticPixelsHandler
83 get_authentic_pixels_handler;
84
85 GetAuthenticMetacontentFromHandler
86 get_authentic_metacontent_from_handler;
87
88 GetOneAuthenticPixelFromHandler
89 get_one_authentic_pixel_from_handler;
90
91 GetAuthenticPixelsFromHandler
92 get_authentic_pixels_from_handler;
93
94 QueueAuthenticPixelsHandler
95 queue_authentic_pixels_handler;
96
97 SyncAuthenticPixelsHandler
98 sync_authentic_pixels_handler;
99
100 DestroyPixelHandler
101 destroy_pixel_handler;
103
104typedef struct _NexusInfo
105{
106 MagickBooleanType
107 mapped;
108
110 region;
111
112 MagickSizeType
113 length;
114
115 Quantum
116 *cache,
117 *pixels;
118
119 MagickBooleanType
120 authentic_pixel_cache;
121
122 void
123 *metacontent;
124
125 size_t
126 signature;
127
128 struct _NexusInfo
129 *virtual_nexus;
130} NexusInfo;
131
132typedef struct _CacheInfo
133{
134 ClassType
135 storage_class;
136
137 ColorspaceType
138 colorspace;
139
140 PixelTrait
141 alpha_trait;
142
143 ChannelType
144 channels;
145
146 size_t
147 columns,
148 rows;
149
150 size_t
151 metacontent_extent,
152 number_channels;
153
155 channel_map[MaxPixelChannels];
156
157 CacheType
158 type;
159
160 MapMode
161 mode,
162 disk_mode;
163
164 MagickBooleanType
165 mapped;
166
167 MagickOffsetType
168 offset;
169
170 MagickSizeType
171 length;
172
173 VirtualPixelMethod
174 virtual_pixel_method;
175
177 virtual_pixel_color;
178
179 size_t
180 number_threads;
181
183 **nexus_info;
184
185 Quantum
186 *pixels;
187
188 void
189 *metacontent;
190
191 int
192 file;
193
194 char
195 filename[MagickPathExtent],
196 cache_filename[MagickPathExtent];
197
199 methods;
200
202 *random_info;
203
204 void
205 *server_info;
206
207 MagickBooleanType
208 synchronize,
209 debug;
210
211 MagickThreadType
212 id;
213
214 ssize_t
215 reference_count;
216
218 *semaphore,
219 *file_semaphore;
220
221 time_t
222 timestamp;
223
224 size_t
225 signature;
226
227 MagickCLCacheInfo
228 opencl;
229
230 MagickBooleanType
231 composite_mask;
232
233 MagickSizeType
234 width_limit,
235 height_limit;
236} CacheInfo;
237
238static inline MagickBooleanType IsValidPixelOffset(const ssize_t x,
239 const size_t extent)
240{
241 if (extent == 0)
242 return(MagickTrue);
243 if ((x >= (MAGICK_SSIZE_MAX/(ssize_t) extent)) ||
244 (x <= (MAGICK_SSIZE_MIN/(ssize_t) extent)))
245 return(MagickFalse);
246 return(MagickTrue);
247}
248
249extern MagickPrivate Cache
250 AcquirePixelCache(const size_t),
251 ClonePixelCache(const Cache),
252 DestroyPixelCache(Cache),
253 ReferencePixelCache(Cache);
254
255extern MagickPrivate ClassType
256 GetPixelCacheStorageClass(const Cache);
257
258extern MagickPrivate ColorspaceType
259 GetPixelCacheColorspace(const Cache);
260
261extern MagickPrivate const Quantum
262 *GetVirtualPixelCacheNexus(const Image *,const VirtualPixelMethod,
263 const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *,
264 ExceptionInfo *) magick_hot_spot,
265 *GetVirtualPixelsNexus(const Cache,NexusInfo *magick_restrict);
266
267extern MagickPrivate const void
268 *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *magick_restrict);
269
270extern MagickPrivate MagickBooleanType
271 CacheComponentGenesis(void),
272 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *magick_restrict,
273 ExceptionInfo *) magick_hot_spot,
274 SyncImagePixelCache(Image *,ExceptionInfo *);
275
276extern MagickPrivate MagickSizeType
277 GetPixelCacheNexusExtent(const Cache,NexusInfo *magick_restrict);
278
279extern MagickPrivate NexusInfo
280 **AcquirePixelCacheNexus(const size_t),
281 **DestroyPixelCacheNexus(NexusInfo **,const size_t);
282
283extern MagickPrivate Quantum
284 *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
285 const size_t,const size_t,NexusInfo *,ExceptionInfo *) magick_hot_spot,
286 *QueueAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
287 const size_t,const size_t,const MagickBooleanType,NexusInfo *,
288 ExceptionInfo *) magick_hot_spot;
289
290extern MagickPrivate size_t
291 GetPixelCacheChannels(const Cache);
292
293extern MagickPrivate VirtualPixelMethod
294 GetPixelCacheVirtualMethod(const Image *),
295 SetPixelCacheVirtualMethod(Image *,const VirtualPixelMethod,ExceptionInfo *);
296
297extern MagickPrivate void
298 CacheComponentTerminus(void),
299 ClonePixelCacheMethods(Cache,const Cache),
300 GetPixelCacheTileSize(const Image *,size_t *,size_t *),
301 GetPixelCacheMethods(CacheMethods *),
302 ResetCacheAnonymousMemory(void),
303 ResetPixelCacheChannels(Image *),
304 SetPixelCacheMethods(Cache,CacheMethods *);
305
306#if defined(MAGICKCORE_OPENCL_SUPPORT)
307extern MagickPrivate cl_mem
308 GetAuthenticOpenCLBuffer(const Image *,MagickCLDevice,ExceptionInfo *);
309
310extern MagickPrivate void
311 SyncAuthenticOpenCLBuffer(const Image *);
312#endif
313
314#if defined(__cplusplus) || defined(c_plusplus)
315}
316#endif
317
318#endif