/src/imagemagick/MagickCore/cache-private.h
Line | Count | Source |
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/license/ |
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 | | |
109 | | RectangleInfo |
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 | | |
154 | | PixelChannelMap |
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 | | |
198 | | CacheMethods |
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 | | |
217 | | SemaphoreInfo |
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 | | static inline MagickBooleanType IsValidPixelOffset(const ssize_t x, |
239 | | const size_t extent) |
240 | 1.52G | { |
241 | 1.52G | if (extent == 0) |
242 | 0 | return(MagickTrue); |
243 | 1.52G | if ((x >= (ssize_t) (MAGICK_SSIZE_MAX/(ssize_t) extent)) || |
244 | 1.52G | (x <= (ssize_t) (MAGICK_SSIZE_MIN/(ssize_t) extent))) |
245 | 8.21k | return(MagickFalse); |
246 | 1.52G | return(MagickTrue); |
247 | 1.52G | } Unexecuted instantiation: annotate.c:IsValidPixelOffset Unexecuted instantiation: attribute.c:IsValidPixelOffset cache.c:IsValidPixelOffset Line | Count | Source | 240 | 1.52G | { | 241 | 1.52G | if (extent == 0) | 242 | 0 | return(MagickTrue); | 243 | 1.52G | if ((x >= (ssize_t) (MAGICK_SSIZE_MAX/(ssize_t) extent)) || | 244 | 1.52G | (x <= (ssize_t) (MAGICK_SSIZE_MIN/(ssize_t) extent))) | 245 | 8.21k | return(MagickFalse); | 246 | 1.52G | return(MagickTrue); | 247 | 1.52G | } |
Unexecuted instantiation: cache-view.c:IsValidPixelOffset Unexecuted instantiation: channel.c:IsValidPixelOffset Unexecuted instantiation: colorspace.c:IsValidPixelOffset Unexecuted instantiation: composite.c:IsValidPixelOffset Unexecuted instantiation: display.c:IsValidPixelOffset Unexecuted instantiation: distribute-cache.c:IsValidPixelOffset Unexecuted instantiation: draw.c:IsValidPixelOffset Unexecuted instantiation: enhance.c:IsValidPixelOffset Unexecuted instantiation: feature.c:IsValidPixelOffset Unexecuted instantiation: image.c:IsValidPixelOffset Unexecuted instantiation: magick.c:IsValidPixelOffset Unexecuted instantiation: opencl.c:IsValidPixelOffset Unexecuted instantiation: pixel.c:IsValidPixelOffset Unexecuted instantiation: policy.c:IsValidPixelOffset Unexecuted instantiation: property.c:IsValidPixelOffset Unexecuted instantiation: quantum.c:IsValidPixelOffset Unexecuted instantiation: shear.c:IsValidPixelOffset Unexecuted instantiation: statistic.c:IsValidPixelOffset Unexecuted instantiation: stream.c:IsValidPixelOffset Unexecuted instantiation: visual-effects.c:IsValidPixelOffset |
248 | | |
249 | | extern MagickPrivate Cache |
250 | | AcquirePixelCache(const size_t), |
251 | | ClonePixelCache(const Cache), |
252 | | DestroyPixelCache(Cache), |
253 | | ReferencePixelCache(Cache); |
254 | | |
255 | | extern MagickPrivate ClassType |
256 | | GetPixelCacheStorageClass(const Cache); |
257 | | |
258 | | extern MagickPrivate ColorspaceType |
259 | | GetPixelCacheColorspace(const Cache); |
260 | | |
261 | | extern 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 | | |
267 | | extern MagickPrivate const void |
268 | | *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *magick_restrict); |
269 | | |
270 | | extern MagickPrivate MagickBooleanType |
271 | | CacheComponentGenesis(void), |
272 | | SyncAuthenticPixelCacheNexus(Image *,NexusInfo *magick_restrict, |
273 | | ExceptionInfo *) magick_hot_spot, |
274 | | SyncImagePixelCache(Image *,ExceptionInfo *); |
275 | | |
276 | | extern MagickPrivate MagickSizeType |
277 | | GetPixelCacheNexusExtent(const Cache,NexusInfo *magick_restrict); |
278 | | |
279 | | extern MagickPrivate NexusInfo |
280 | | **AcquirePixelCacheNexus(const size_t), |
281 | | **DestroyPixelCacheNexus(NexusInfo **,const size_t); |
282 | | |
283 | | extern 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 | | |
290 | | extern MagickPrivate size_t |
291 | | GetPixelCacheChannels(const Cache); |
292 | | |
293 | | extern MagickPrivate VirtualPixelMethod |
294 | | GetPixelCacheVirtualMethod(const Image *), |
295 | | SetPixelCacheVirtualMethod(Image *,const VirtualPixelMethod,ExceptionInfo *); |
296 | | |
297 | | extern 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) |
307 | | extern MagickPrivate cl_mem |
308 | | GetAuthenticOpenCLBuffer(const Image *,MagickCLDevice,ExceptionInfo *); |
309 | | |
310 | | extern MagickPrivate void |
311 | | SyncAuthenticOpenCLBuffer(const Image *); |
312 | | #endif |
313 | | |
314 | | #if defined(__cplusplus) || defined(c_plusplus) |
315 | | } |
316 | | #endif |
317 | | |
318 | | #endif |