| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
| cristy | b56bb24 | 2014-11-25 17:12:48 +0000 | [diff] [blame] | 2 | Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | dedicated to making software imaging solutions freely available. |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 4 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5 | You may not use this file except in compliance with the License. |
| 6 | obtain a copy of the License at |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 7 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8 | http://www.imagemagick.org/script/license.php |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 9 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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 | |
| cristy | 4ee2b0c | 2012-05-15 00:30:35 +0000 | [diff] [blame] | 21 | #include "MagickCore/cache.h" |
| cristy | e80f9cb | 2013-01-09 01:09:31 +0000 | [diff] [blame] | 22 | #include "MagickCore/distribute-cache.h" |
| cristy | 8a46d82 | 2012-08-28 23:32:39 +0000 | [diff] [blame] | 23 | #include "MagickCore/pixel.h" |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 24 | #include "MagickCore/random_.h" |
| 25 | #include "MagickCore/thread-private.h" |
| 26 | #include "MagickCore/semaphore.h" |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 27 | |
| cristy | 6398ec7 | 2013-11-28 02:00:27 +0000 | [diff] [blame] | 28 | #if defined(__cplusplus) || defined(c_plusplus) |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
| cristy | cd01fae | 2011-08-06 23:52:42 +0000 | [diff] [blame] | 32 | typedef void |
| 33 | *Cache; |
| 34 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 35 | typedef MagickBooleanType |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 36 | (*GetOneAuthenticPixelFromHandler)(Image *,const ssize_t,const ssize_t, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 37 | Quantum *,ExceptionInfo *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 38 | (*GetOneVirtualPixelFromHandler)(const Image *,const VirtualPixelMethod, |
| cristy | 2ed42f6 | 2011-10-02 19:49:57 +0000 | [diff] [blame] | 39 | const ssize_t,const ssize_t,Quantum *,ExceptionInfo *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 40 | (*SyncAuthenticPixelsHandler)(Image *,ExceptionInfo *); |
| 41 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 42 | typedef const Quantum |
| cristy | 5ed838e | 2010-05-31 00:05:35 +0000 | [diff] [blame] | 43 | *(*GetVirtualPixelHandler)(const Image *,const VirtualPixelMethod, |
| 44 | const ssize_t,const ssize_t,const size_t,const size_t,ExceptionInfo *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 45 | *(*GetVirtualPixelsHandler)(const Image *); |
| 46 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 47 | typedef const void |
| 48 | *(*GetVirtualMetacontentFromHandler)(const Image *); |
| 49 | |
| 50 | typedef Quantum |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 51 | *(*GetAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t, |
| 52 | const size_t,const size_t,ExceptionInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 53 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 54 | typedef Quantum |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 55 | *(*GetAuthenticPixelsFromHandler)(const Image *); |
| 56 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 57 | typedef Quantum |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 58 | *(*QueueAuthenticPixelsHandler)(Image *,const ssize_t,const ssize_t, |
| 59 | const size_t,const size_t,ExceptionInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 60 | |
| 61 | typedef void |
| 62 | (*DestroyPixelHandler)(Image *); |
| 63 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 64 | typedef void |
| 65 | *(*GetAuthenticMetacontentFromHandler)(const Image *); |
| 66 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 67 | typedef struct _CacheMethods |
| 68 | { |
| 69 | GetVirtualPixelHandler |
| 70 | get_virtual_pixel_handler; |
| 71 | |
| 72 | GetVirtualPixelsHandler |
| 73 | get_virtual_pixels_handler; |
| 74 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 75 | GetVirtualMetacontentFromHandler |
| 76 | get_virtual_metacontent_from_handler; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 77 | |
| 78 | GetOneVirtualPixelFromHandler |
| 79 | get_one_virtual_pixel_from_handler; |
| 80 | |
| 81 | GetAuthenticPixelsHandler |
| 82 | get_authentic_pixels_handler; |
| 83 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 84 | GetAuthenticMetacontentFromHandler |
| 85 | get_authentic_metacontent_from_handler; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 86 | |
| 87 | GetOneAuthenticPixelFromHandler |
| 88 | get_one_authentic_pixel_from_handler; |
| 89 | |
| 90 | GetAuthenticPixelsFromHandler |
| 91 | get_authentic_pixels_from_handler; |
| 92 | |
| 93 | QueueAuthenticPixelsHandler |
| 94 | queue_authentic_pixels_handler; |
| 95 | |
| 96 | SyncAuthenticPixelsHandler |
| 97 | sync_authentic_pixels_handler; |
| 98 | |
| 99 | DestroyPixelHandler |
| 100 | destroy_pixel_handler; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 101 | } CacheMethods; |
| 102 | |
| 103 | typedef struct _NexusInfo |
| cristy | ffaf87e | 2013-04-30 17:09:30 +0000 | [diff] [blame] | 104 | { |
| 105 | MagickBooleanType |
| 106 | mapped; |
| 107 | |
| 108 | RectangleInfo |
| 109 | region; |
| 110 | |
| 111 | MagickSizeType |
| 112 | length; |
| 113 | |
| 114 | Quantum |
| 115 | *cache, |
| 116 | *pixels; |
| 117 | |
| cristy | d7d7128 | 2013-04-30 17:24:26 +0000 | [diff] [blame] | 118 | MagickBooleanType |
| cristy | 73f359e | 2013-04-30 22:22:32 +0000 | [diff] [blame] | 119 | authentic_pixel_cache; |
| cristy | d7d7128 | 2013-04-30 17:24:26 +0000 | [diff] [blame] | 120 | |
| cristy | ffaf87e | 2013-04-30 17:09:30 +0000 | [diff] [blame] | 121 | void |
| 122 | *metacontent; |
| 123 | |
| 124 | size_t |
| 125 | signature; |
| 126 | } NexusInfo; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 127 | |
| 128 | typedef struct _CacheInfo |
| 129 | { |
| 130 | ClassType |
| 131 | storage_class; |
| 132 | |
| 133 | ColorspaceType |
| 134 | colorspace; |
| 135 | |
| cristy | 8a46d82 | 2012-08-28 23:32:39 +0000 | [diff] [blame] | 136 | PixelTrait |
| 137 | alpha_trait; |
| 138 | |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 139 | MagickBooleanType |
| cristy | 883fde1 | 2013-04-08 00:50:13 +0000 | [diff] [blame] | 140 | read_mask, |
| 141 | write_mask; |
| cristy | 222b19c | 2011-08-04 01:35:11 +0000 | [diff] [blame] | 142 | |
| 143 | size_t |
| 144 | columns, |
| 145 | rows; |
| 146 | |
| cristy | bcc1fdc | 2011-04-29 13:06:35 +0000 | [diff] [blame] | 147 | size_t |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 148 | metacontent_extent, |
| cristy | ed23157 | 2011-07-14 02:18:59 +0000 | [diff] [blame] | 149 | number_channels; |
| cristy | 0d26717 | 2011-04-25 20:13:48 +0000 | [diff] [blame] | 150 | |
| cristy | 3dfccb2 | 2011-12-28 21:47:20 +0000 | [diff] [blame] | 151 | PixelChannelMap |
| 152 | channel_map[MaxPixelChannels]; |
| 153 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 154 | CacheType |
| 155 | type; |
| 156 | |
| cristy | 87528ea | 2009-09-10 14:53:56 +0000 | [diff] [blame] | 157 | MapMode |
| 158 | mode; |
| 159 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 160 | MagickBooleanType |
| 161 | mapped; |
| 162 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 163 | MagickOffsetType |
| 164 | offset; |
| 165 | |
| 166 | MagickSizeType |
| 167 | length; |
| 168 | |
| 169 | VirtualPixelMethod |
| 170 | virtual_pixel_method; |
| 171 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 172 | PixelInfo |
| cristy | c3ec0d4 | 2010-04-07 01:18:08 +0000 | [diff] [blame] | 173 | virtual_pixel_color; |
| 174 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 175 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 176 | number_threads; |
| 177 | |
| 178 | NexusInfo |
| 179 | **nexus_info; |
| 180 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 181 | Quantum |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 182 | *pixels; |
| 183 | |
| cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 184 | void |
| 185 | *metacontent; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 186 | |
| 187 | int |
| 188 | file; |
| 189 | |
| 190 | char |
| cristy | 151b66d | 2015-04-15 10:50:31 +0000 | [diff] [blame] | 191 | filename[MagickPathExtent], |
| 192 | cache_filename[MagickPathExtent]; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 193 | |
| 194 | CacheMethods |
| 195 | methods; |
| 196 | |
| 197 | RandomInfo |
| 198 | *random_info; |
| 199 | |
| cristy | bb31fcd | 2013-01-15 20:06:37 +0000 | [diff] [blame] | 200 | void |
| cristy | 0c68241 | 2013-01-18 14:14:13 +0000 | [diff] [blame] | 201 | *server_info; |
| cristy | 286dea0 | 2013-01-08 21:34:16 +0000 | [diff] [blame] | 202 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 203 | MagickBooleanType |
| cristy | fa0ea94 | 2012-12-21 02:42:29 +0000 | [diff] [blame] | 204 | synchronize, |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 205 | debug; |
| 206 | |
| 207 | MagickThreadType |
| 208 | id; |
| 209 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 210 | ssize_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 211 | reference_count; |
| 212 | |
| 213 | SemaphoreInfo |
| 214 | *semaphore, |
| cristy | 245d4c5 | 2012-11-15 21:13:56 +0000 | [diff] [blame] | 215 | *file_semaphore; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 216 | |
| cristy | ff1889f | 2012-05-08 18:38:44 +0000 | [diff] [blame] | 217 | time_t |
| 218 | timestamp; |
| 219 | |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 220 | size_t |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 221 | signature; |
| 222 | } CacheInfo; |
| 223 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 224 | extern MagickPrivate Cache |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 225 | AcquirePixelCache(const size_t), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 226 | ClonePixelCache(const Cache), |
| 227 | DestroyPixelCache(Cache), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 228 | ReferencePixelCache(Cache); |
| 229 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 230 | extern MagickPrivate ClassType |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 231 | GetPixelCacheStorageClass(const Cache); |
| 232 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 233 | extern MagickPrivate ColorspaceType |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 234 | GetPixelCacheColorspace(const Cache); |
| 235 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 236 | extern MagickPrivate const Quantum |
| cristy | 5ed838e | 2010-05-31 00:05:35 +0000 | [diff] [blame] | 237 | *GetVirtualPixelsFromNexus(const Image *,const VirtualPixelMethod, |
| 238 | const ssize_t,const ssize_t,const size_t,const size_t,NexusInfo *, |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 239 | ExceptionInfo *) magick_hot_spot, |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 240 | *GetVirtualPixelsNexus(const Cache,NexusInfo *magick_restrict); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 241 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 242 | extern MagickPrivate const void |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 243 | *AcquirePixelCachePixels(const Image *,MagickSizeType *,ExceptionInfo *), |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 244 | *GetVirtualMetacontentFromNexus(const Cache,NexusInfo *magick_restrict); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 245 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 246 | extern MagickPrivate MagickBooleanType |
| cristy | 5ff4eaf | 2011-09-03 01:38:02 +0000 | [diff] [blame] | 247 | CacheComponentGenesis(void), |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 248 | SyncAuthenticPixelCacheNexus(Image *,NexusInfo *magick_restrict, |
| 249 | ExceptionInfo *) magick_hot_spot, |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 250 | SyncImagePixelCache(Image *,ExceptionInfo *); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 251 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 252 | extern MagickPrivate MagickSizeType |
| dirk | 05d2ff7 | 2015-11-18 23:13:43 +0100 | [diff] [blame^] | 253 | GetPixelCacheNexusExtent(const Cache,NexusInfo *magick_restrict); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 254 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 255 | extern MagickPrivate NexusInfo |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 256 | **AcquirePixelCacheNexus(const size_t), |
| 257 | **DestroyPixelCacheNexus(NexusInfo **,const size_t); |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 258 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 259 | extern MagickPrivate Quantum |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 260 | *GetAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t, |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 261 | const size_t,const size_t,NexusInfo *,ExceptionInfo *) magick_hot_spot, |
| cristy | c11dace | 2012-01-24 16:39:46 +0000 | [diff] [blame] | 262 | *QueueAuthenticPixelCacheNexus(Image *,const ssize_t,const ssize_t, |
| 263 | const size_t,const size_t,const MagickBooleanType,NexusInfo *, |
| cristy | 19596d6 | 2012-02-19 00:24:59 +0000 | [diff] [blame] | 264 | ExceptionInfo *) magick_hot_spot; |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 265 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 266 | extern MagickPrivate size_t |
| cristy | 0d26717 | 2011-04-25 20:13:48 +0000 | [diff] [blame] | 267 | GetPixelCacheChannels(const Cache); |
| 268 | |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 269 | extern MagickPrivate VirtualPixelMethod |
| 270 | GetPixelCacheVirtualMethod(const Image *), |
| cristy | 387430f | 2012-02-07 13:09:46 +0000 | [diff] [blame] | 271 | SetPixelCacheVirtualMethod(Image *,const VirtualPixelMethod,ExceptionInfo *); |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 272 | |
| cristy | 9c7a879 | 2011-09-02 19:54:50 +0000 | [diff] [blame] | 273 | extern MagickPrivate void |
| cristy | 5ff4eaf | 2011-09-03 01:38:02 +0000 | [diff] [blame] | 274 | CacheComponentTerminus(void), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 275 | ClonePixelCacheMethods(Cache,const Cache), |
| cristy | d1dd6e4 | 2011-09-04 01:46:08 +0000 | [diff] [blame] | 276 | *GetPixelCachePixels(Image *,MagickSizeType *,ExceptionInfo *), |
| cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 277 | GetPixelCacheTileSize(const Image *,size_t *,size_t *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 278 | GetPixelCacheMethods(CacheMethods *), |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 279 | SetPixelCacheMethods(Cache,CacheMethods *); |
| 280 | |
| cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 281 | #if defined(__cplusplus) || defined(c_plusplus) |
| 282 | } |
| 283 | #endif |
| 284 | |
| 285 | #endif |