MagickCore  7.1.0
Convert, Edit, Or Compose Bitmap Images
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)
30 extern "C" {
31 #endif
32 
33 typedef void
34  *Cache;
35 
36 typedef 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 
43 typedef 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 
48 typedef const void
49  *(*GetVirtualMetacontentFromHandler)(const Image *);
50 
51 typedef Quantum
52  *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
53  const size_t,const size_t,ExceptionInfo *);
54 
55 typedef Quantum
56  *(*GetAuthenticPixelsFromHandler)(const Image *);
57 
58 typedef Quantum
59  *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t,
60  const size_t,const size_t,ExceptionInfo *);
61 
62 typedef void
63  (*DestroyPixelHandler)(Image *);
64 
65 typedef void
66  *(*GetAuthenticMetacontentFromHandler)(const Image *);
67 
68 typedef 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;
102 } CacheMethods;
103 
104 typedef 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 
132 typedef 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 
176  PixelInfo
177  virtual_pixel_color;
178 
179  size_t
180  number_threads;
181 
182  NexusInfo
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 
201  RandomInfo
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 
238 extern MagickPrivate Cache
239  AcquirePixelCache(const size_t),
240  ClonePixelCache(const Cache),
241  DestroyPixelCache(Cache),
242  ReferencePixelCache(Cache);
243 
244 extern MagickPrivate ClassType
245  GetPixelCacheStorageClass(const Cache);
246 
247 extern MagickPrivate ColorspaceType
248  GetPixelCacheColorspace(const Cache);
249 
250 extern MagickPrivate const Quantum
251  *GetVirtualPixelCacheNexus(const Image *,const VirtualPixelMethod,
252  const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *,
253  ExceptionInfo *) magick_hot_spot,
254  *GetVirtualPixelsNexus(const Cache,NexusInfo *magick_restrict);
255 
256 extern MagickPrivate const void
257  *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *magick_restrict);
258 
259 extern MagickPrivate MagickBooleanType
260  CacheComponentGenesis(void),
261  SyncAuthenticPixelCacheNexus(Image *,NexusInfo *magick_restrict,
262  ExceptionInfo *) magick_hot_spot,
263  SyncImagePixelCache(Image *,ExceptionInfo *);
264 
265 extern MagickPrivate MagickSizeType
266  GetPixelCacheNexusExtent(const Cache,NexusInfo *magick_restrict);
267 
268 extern MagickPrivate NexusInfo
269  **AcquirePixelCacheNexus(const size_t),
270  **DestroyPixelCacheNexus(NexusInfo **,const size_t);
271 
272 extern MagickPrivate Quantum
273  *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
274  const size_t,const size_t,NexusInfo *,ExceptionInfo *) magick_hot_spot,
275  *QueueAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t,
276  const size_t,const size_t,const MagickBooleanType,NexusInfo *,
277  ExceptionInfo *) magick_hot_spot;
278 
279 extern MagickPrivate size_t
280  GetPixelCacheChannels(const Cache);
281 
282 extern MagickPrivate VirtualPixelMethod
283  GetPixelCacheVirtualMethod(const Image *),
284  SetPixelCacheVirtualMethod(Image *,const VirtualPixelMethod,ExceptionInfo *);
285 
286 extern MagickPrivate void
287  CacheComponentTerminus(void),
288  ClonePixelCacheMethods(Cache,const Cache),
289  GetPixelCacheTileSize(const Image *,size_t *,size_t *),
290  GetPixelCacheMethods(CacheMethods *),
291  ResetCacheAnonymousMemory(void),
292  ResetPixelCacheEpoch(void),
293  ResetPixelCacheChannels(Image *),
294  SetPixelCacheMethods(Cache,CacheMethods *);
295 
296 #if defined(MAGICKCORE_OPENCL_SUPPORT)
297 extern MagickPrivate cl_mem
298  GetAuthenticOpenCLBuffer(const Image *,MagickCLDevice,ExceptionInfo *);
299 
300 extern MagickPrivate void
301  SyncAuthenticOpenCLBuffer(const Image *);
302 #endif
303 
304 #if defined(__cplusplus) || defined(c_plusplus)
305 }
306 #endif
307 
308 #endif
Definition: image.h:152