1 /* 2 Copyright 1999-2016 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. 6 obtain a copy of the License at 7 8 http://www.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 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 } NexusInfo; 128 129 typedef struct _CacheInfo 130 { 131 ClassType 132 storage_class; 133 134 ColorspaceType 135 colorspace; 136 137 PixelTrait 138 alpha_trait; 139 140 MagickBooleanType 141 read_mask, 142 write_mask; 143 144 size_t 145 columns, 146 rows; 147 148 size_t 149 metacontent_extent, 150 number_channels; 151 152 PixelChannelMap 153 channel_map[MaxPixelChannels]; 154 155 CacheType 156 type; 157 158 MapMode 159 mode; 160 161 MagickBooleanType 162 mapped; 163 164 MagickOffsetType 165 offset; 166 167 MagickSizeType 168 length; 169 170 VirtualPixelMethod 171 virtual_pixel_method; 172 173 PixelInfo 174 virtual_pixel_color; 175 176 size_t 177 number_threads; 178 179 NexusInfo 180 **nexus_info; 181 182 Quantum 183 *pixels; 184 185 void 186 *metacontent; 187 188 int 189 file; 190 191 char 192 filename[MagickPathExtent], 193 cache_filename[MagickPathExtent]; 194 195 CacheMethods 196 methods; 197 198 RandomInfo 199 *random_info; 200 201 void 202 *server_info; 203 204 MagickBooleanType 205 synchronize, 206 debug; 207 208 MagickThreadType 209 id; 210 211 ssize_t 212 reference_count; 213 214 SemaphoreInfo 215 *semaphore, 216 *file_semaphore; 217 218 time_t 219 timestamp; 220 221 size_t 222 signature; 223 224 MagickCLCacheInfo 225 opencl; 226 } CacheInfo; 227 228 extern MagickPrivate Cache 229 AcquirePixelCache(const size_t), 230 ClonePixelCache(const Cache), 231 DestroyPixelCache(Cache), 232 ReferencePixelCache(Cache); 233 234 extern MagickPrivate ClassType 235 GetPixelCacheStorageClass(const Cache); 236 237 extern MagickPrivate ColorspaceType 238 GetPixelCacheColorspace(const Cache); 239 240 extern MagickPrivate const Quantum 241 *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod, 242 const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *, 243 ExceptionInfo *) magick_hot_spot, 244 *GetVirtualPixelsNexus(const Cache,NexusInfo *magick_restrict); 245 246 extern MagickPrivate const void 247 *AcquirePixelCachePixels(const Image *,MagickSizeType *,ExceptionInfo *), 248 *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *magick_restrict); 249 250 extern MagickPrivate MagickBooleanType 251 CacheComponentGenesis(void), 252 SyncAuthenticPixelCacheNexus(Image *,NexusInfo *magick_restrict, 253 ExceptionInfo *) magick_hot_spot, 254 SyncImagePixelCache(Image *,ExceptionInfo *); 255 256 extern MagickPrivate MagickSizeType 257 GetPixelCacheNexusExtent(const Cache,NexusInfo *magick_restrict); 258 259 extern MagickPrivate NexusInfo 260 **AcquirePixelCacheNexus(const size_t), 261 **DestroyPixelCacheNexus(NexusInfo **,const size_t); 262 263 extern MagickPrivate Quantum 264 *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t, 265 const size_t,const size_t,NexusInfo *,ExceptionInfo *) magick_hot_spot, 266 *QueueAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t, 267 const size_t,const size_t,const MagickBooleanType,NexusInfo *, 268 ExceptionInfo *) magick_hot_spot; 269 270 extern MagickPrivate size_t 271 GetPixelCacheChannels(const Cache); 272 273 extern MagickPrivate VirtualPixelMethod 274 GetPixelCacheVirtualMethod(const Image *), 275 SetPixelCacheVirtualMethod(Image *,const VirtualPixelMethod,ExceptionInfo *); 276 277 extern MagickPrivate void 278 CacheComponentTerminus(void), 279 ClonePixelCacheMethods(Cache,const Cache), 280 *GetPixelCachePixels(Image *,MagickSizeType *,ExceptionInfo *), 281 GetPixelCacheTileSize(const Image *,size_t *,size_t *), 282 GetPixelCacheMethods(CacheMethods *), 283 ResetPixelCacheEpoch(void), 284 SetPixelCacheMethods(Cache,CacheMethods *); 285 286 #if defined(MAGICKCORE_OPENCL_SUPPORT) 287 extern MagickPrivate cl_mem 288 GetAuthenticOpenCLBuffer(const Image *,MagickCLDevice,ExceptionInfo *); 289 290 extern MagickPrivate void 291 SyncAuthenticOpenCLBuffer(const Image *); 292 #endif 293 294 #if defined(__cplusplus) || defined(c_plusplus) 295 } 296 #endif 297 298 #endif 299