MagickCore  7.0.3
cache.c File Reference
Include dependency graph for cache.c:

Go to the source code of this file.

Data Structures

struct  _MagickModulo
 

Macros

#define CacheTick(offset, extent)   QuantumTick((MagickOffsetType) offset,extent)
 
#define IsFileDescriptorLimitExceeded()
 
#define MaxCacheThreads   2
 
#define cache_threads(source, destination)
 

Typedefs

typedef struct _MagickModulo MagickModulo
 

Functions

static Cache GetImagePixelCache (Image *, const MagickBooleanType, ExceptionInfo *)
 
MagickPrivate NexusInfo ** AcquirePixelCacheNexus (const size_t number_threads)
 
MagickPrivate const void * AcquirePixelCachePixels (const Image *image, MagickSizeType *length, ExceptionInfo *exception)
 
MagickPrivate MagickBooleanType CacheComponentGenesis (void)
 
MagickPrivate void CacheComponentTerminus (void)
 
MagickPrivate Cache ClonePixelCache (const Cache cache)
 
MagickPrivate void ClonePixelCacheMethods (Cache clone, const Cache cache)
 
static MagickBooleanType ClonePixelCacheOnDisk (CacheInfo *magick_restrict cache_info, CacheInfo *magick_restrict clone_info)
 
static MagickBooleanType ClonePixelCacheRepository (CacheInfo *magick_restrict clone_info, CacheInfo *magick_restrict cache_info, ExceptionInfo *exception)
 
static void DestroyImagePixelCache (Image *image)
 
MagickExport void DestroyImagePixels (Image *image)
 
static MagickBooleanType ClosePixelCacheOnDisk (CacheInfo *cache_info)
 
static void RelinquishPixelCachePixels (CacheInfo *cache_info)
 
MagickPrivate Cache DestroyPixelCache (Cache cache)
 
static void RelinquishCacheNexusPixels (NexusInfo *nexus_info)
 
MagickPrivate NexusInfo ** DestroyPixelCacheNexus (NexusInfo **nexus_info, const size_t number_threads)
 
MagickExport void * GetAuthenticMetacontent (const Image *image)
 
static void * GetAuthenticMetacontentFromCache (const Image *image)
 
MagickPrivate QuantumGetAuthenticPixelCacheNexus (Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, NexusInfo *nexus_info, ExceptionInfo *exception)
 
static QuantumGetAuthenticPixelsFromCache (const Image *image)
 
MagickExport QuantumGetAuthenticPixelQueue (const Image *image)
 
MagickExport QuantumGetAuthenticPixels (Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
 
static QuantumGetAuthenticPixelsCache (Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
 
MagickExport MagickSizeType GetImageExtent (const Image *image)
 
static MagickBooleanType ValidatePixelCacheMorphology (const Image *magick_restrict image)
 
MagickExport CacheType GetImagePixelCacheType (const Image *image)
 
static MagickBooleanType CopyPixel (const Image *image, const Quantum *source, Quantum *destination)
 
MagickExport MagickBooleanType GetOneAuthenticPixel (Image *image, const ssize_t x, const ssize_t y, Quantum *pixel, ExceptionInfo *exception)
 
static MagickBooleanType GetOneAuthenticPixelFromCache (Image *image, const ssize_t x, const ssize_t y, Quantum *pixel, ExceptionInfo *exception)
 
MagickExport MagickBooleanType GetOneVirtualPixel (const Image *image, const ssize_t x, const ssize_t y, Quantum *pixel, ExceptionInfo *exception)
 
static MagickBooleanType GetOneVirtualPixelFromCache (const Image *image, const VirtualPixelMethod virtual_pixel_method, const ssize_t x, const ssize_t y, Quantum *pixel, ExceptionInfo *exception)
 
MagickExport MagickBooleanType GetOneVirtualPixelInfo (const Image *image, const VirtualPixelMethod virtual_pixel_method, const ssize_t x, const ssize_t y, PixelInfo *pixel, ExceptionInfo *exception)
 
MagickPrivate ColorspaceType GetPixelCacheColorspace (const Cache cache)
 
MagickPrivate void GetPixelCacheMethods (CacheMethods *cache_methods)
 
MagickPrivate MagickSizeType GetPixelCacheNexusExtent (const Cache cache, NexusInfo *magick_restrict nexus_info)
 
MagickPrivate void * GetPixelCachePixels (Image *image, MagickSizeType *length, ExceptionInfo *exception)
 
MagickPrivate ClassType GetPixelCacheStorageClass (const Cache cache)
 
MagickPrivate void GetPixelCacheTileSize (const Image *image, size_t *width, size_t *height)
 
MagickPrivate VirtualPixelMethod GetPixelCacheVirtualMethod (const Image *image)
 
static const void * GetVirtualMetacontentFromCache (const Image *image)
 
MagickPrivate const void * GetVirtualMetacontentFromNexus (const Cache cache, NexusInfo *magick_restrict nexus_info)
 
MagickExport const void * GetVirtualMetacontent (const Image *image)
 
static ssize_t DitherX (const ssize_t x, const size_t columns)
 
static ssize_t DitherY (const ssize_t y, const size_t rows)
 
static ssize_t EdgeX (const ssize_t x, const size_t columns)
 
static ssize_t EdgeY (const ssize_t y, const size_t rows)
 
static ssize_t RandomX (RandomInfo *random_info, const size_t columns)
 
static ssize_t RandomY (RandomInfo *random_info, const size_t rows)
 
static MagickModulo VirtualPixelModulo (const ssize_t offset, const size_t extent)
 
MagickPrivate const QuantumGetVirtualPixelsFromNexus (const Image *image, const VirtualPixelMethod virtual_pixel_method, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, NexusInfo *nexus_info, ExceptionInfo *exception)
 
static const QuantumGetVirtualPixelCache (const Image *image, const VirtualPixelMethod virtual_pixel_method, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
 
MagickExport const QuantumGetVirtualPixelQueue (const Image *image)
 
MagickExport const QuantumGetVirtualPixels (const Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
 
static const QuantumGetVirtualPixelsCache (const Image *image)
 
MagickPrivate const QuantumGetVirtualPixelsNexus (const Cache cache, NexusInfo *magick_restrict nexus_info)
 
static MagickBooleanType OpenPixelCacheOnDisk (CacheInfo *cache_info, const MapMode mode)
 
static MagickOffsetType WritePixelCacheRegion (const CacheInfo *magick_restrict cache_info, const MagickOffsetType offset, const MagickSizeType length, const unsigned char *magick_restrict buffer)
 
static MagickBooleanType SetPixelCacheExtent (Image *image, MagickSizeType length)
 
static MagickBooleanType OpenPixelCache (Image *image, const MapMode mode, ExceptionInfo *exception)
 
MagickExport MagickBooleanType PersistPixelCache (Image *image, const char *filename, const MagickBooleanType attach, MagickOffsetType *offset, ExceptionInfo *exception)
 
MagickPrivate QuantumQueueAuthenticPixelCacheNexus (Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, const MagickBooleanType clone, NexusInfo *nexus_info, ExceptionInfo *exception)
 
static QuantumQueueAuthenticPixelsCache (Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
 
MagickExport QuantumQueueAuthenticPixels (Image *image, const ssize_t x, const ssize_t y, const size_t columns, const size_t rows, ExceptionInfo *exception)
 
static MagickOffsetType ReadPixelCacheRegion (const CacheInfo *magick_restrict cache_info, const MagickOffsetType offset, const MagickSizeType length, unsigned char *magick_restrict buffer)
 
static MagickBooleanType ReadPixelCacheMetacontent (CacheInfo *magick_restrict cache_info, NexusInfo *magick_restrict nexus_info, ExceptionInfo *exception)
 
static MagickBooleanType ReadPixelCachePixels (CacheInfo *magick_restrict cache_info, NexusInfo *magick_restrict nexus_info, ExceptionInfo *exception)
 
MagickPrivate Cache ReferencePixelCache (Cache cache)
 
MagickPrivate void ResetPixelCacheEpoch (void)
 
MagickPrivate void SetPixelCacheMethods (Cache cache, CacheMethods *cache_methods)
 
static MagickBooleanType AcquireCacheNexusPixels (const CacheInfo *magick_restrict cache_info, NexusInfo *nexus_info, ExceptionInfo *exception)
 
static MagickBooleanType IsPixelCacheAuthentic (const CacheInfo *magick_restrict cache_info, const NexusInfo *magick_restrict nexus_info)
 
static void PrefetchPixelCacheNexusPixels (const NexusInfo *nexus_info, const MapMode mode)
 
static QuantumSetPixelCacheNexusPixels (const CacheInfo *cache_info, const MapMode mode, const RectangleInfo *region, NexusInfo *nexus_info, ExceptionInfo *exception)
 
static MagickBooleanType SetCacheAlphaChannel (Image *image, const Quantum alpha, ExceptionInfo *exception)
 
MagickPrivate VirtualPixelMethod SetPixelCacheVirtualMethod (Image *image, const VirtualPixelMethod virtual_pixel_method, ExceptionInfo *exception)
 
MagickPrivate MagickBooleanType SyncAuthenticPixelCacheNexus (Image *image, NexusInfo *magick_restrict nexus_info, ExceptionInfo *exception)
 
static MagickBooleanType SyncAuthenticPixelsCache (Image *image, ExceptionInfo *exception)
 
MagickExport MagickBooleanType SyncAuthenticPixels (Image *image, ExceptionInfo *exception)
 
MagickPrivate MagickBooleanType SyncImagePixelCache (Image *image, ExceptionInfo *exception)
 
static MagickBooleanType WritePixelCacheMetacontent (CacheInfo *cache_info, NexusInfo *magick_restrict nexus_info, ExceptionInfo *exception)
 
static MagickBooleanType WritePixelCachePixels (CacheInfo *magick_restrict cache_info, NexusInfo *magick_restrict nexus_info, ExceptionInfo *exception)
 

Variables

static ssize_t DitherMatrix [64]
 

Macro Definition Documentation

#define cache_threads (   source,
  destination 
)
Value:
num_threads(((source)->type == DiskCache) || \
((destination)->type == DiskCache) || (((source)->rows) < \
#define MaxCacheThreads
MagickExport MagickSizeType GetMagickResourceLimit(const ResourceType type)
Definition: resource.c:682
#define CacheTick (   offset,
  extent 
)    QuantumTick((MagickOffsetType) offset,extent)
#define IsFileDescriptorLimitExceeded ( )
Value:
MagickExport MagickSizeType GetMagickResourceLimit(const ResourceType type)
Definition: resource.c:682
MagickExport MagickSizeType GetMagickResource(const ResourceType type)
Definition: resource.c:594

Definition at line 84 of file cache.c.

Referenced by ReadPixelCacheMetacontent(), ReadPixelCachePixels(), WritePixelCacheMetacontent(), and WritePixelCachePixels().

#define MaxCacheThreads   2

Typedef Documentation

typedef struct _MagickModulo MagickModulo

Function Documentation

static MagickBooleanType AcquireCacheNexusPixels ( const CacheInfo *magick_restrict  cache_info,
NexusInfo nexus_info,
ExceptionInfo exception 
)
inlinestatic
MagickPrivate const void* AcquirePixelCachePixels ( const Image image,
MagickSizeType length,
ExceptionInfo exception 
)
MagickPrivate MagickBooleanType CacheComponentGenesis ( void  )

Definition at line 338 of file cache.c.

References AcquireSemaphoreInfo(), and MagickTrue.

MagickPrivate void CacheComponentTerminus ( void  )
MagickPrivate void ClonePixelCacheMethods ( Cache  clone,
const Cache  cache 
)
static void DestroyImagePixelCache ( Image image)
static
static ssize_t DitherX ( const ssize_t  x,
const size_t  columns 
)
inlinestatic

Definition at line 2494 of file cache.c.

References DitherMatrix.

Referenced by GetVirtualPixelsFromNexus().

static ssize_t DitherY ( const ssize_t  y,
const size_t  rows 
)
inlinestatic

Definition at line 2507 of file cache.c.

References DitherMatrix.

Referenced by GetVirtualPixelsFromNexus().

static ssize_t EdgeX ( const ssize_t  x,
const size_t  columns 
)
inlinestatic

Definition at line 2520 of file cache.c.

Referenced by GetVirtualPixelsFromNexus().

static ssize_t EdgeY ( const ssize_t  y,
const size_t  rows 
)
inlinestatic

Definition at line 2529 of file cache.c.

Referenced by GetVirtualPixelsFromNexus().

MagickExport void* GetAuthenticMetacontent ( const Image image)
static void* GetAuthenticMetacontentFromCache ( const Image image)
static
MagickPrivate Quantum* GetAuthenticPixelCacheNexus ( Image image,
const ssize_t  x,
const ssize_t  y,
const size_t  columns,
const size_t  rows,
NexusInfo nexus_info,
ExceptionInfo exception 
)
MagickExport Quantum* GetAuthenticPixelQueue ( const Image image)
static Quantum* GetAuthenticPixelsCache ( Image image,
const ssize_t  x,
const ssize_t  y,
const size_t  columns,
const size_t  rows,
ExceptionInfo exception 
)
static
static Quantum* GetAuthenticPixelsFromCache ( const Image image)
static
static Cache GetImagePixelCache ( Image image,
const MagickBooleanType  clone,
ExceptionInfo exception 
)
static
MagickExport CacheType GetImagePixelCacheType ( const Image image)

Definition at line 1692 of file cache.c.

References _Image::cache, magick_restrict, MagickCoreSignature, and _Image::signature.

Referenced by GetPixelCacheTileSize().

MagickExport MagickBooleanType GetOneAuthenticPixel ( Image image,
const ssize_t  x,
const ssize_t  y,
Quantum pixel,
ExceptionInfo exception 
)
static MagickBooleanType GetOneAuthenticPixelFromCache ( Image image,
const ssize_t  x,
const ssize_t  y,
Quantum pixel,
ExceptionInfo exception 
)
static
MagickExport MagickBooleanType GetOneVirtualPixel ( const Image image,
const ssize_t  x,
const ssize_t  y,
Quantum pixel,
ExceptionInfo exception 
)
static MagickBooleanType GetOneVirtualPixelFromCache ( const Image image,
const VirtualPixelMethod  virtual_pixel_method,
const ssize_t  x,
const ssize_t  y,
Quantum pixel,
ExceptionInfo exception 
)
static
MagickExport MagickBooleanType GetOneVirtualPixelInfo ( const Image image,
const VirtualPixelMethod  virtual_pixel_method,
const ssize_t  x,
const ssize_t  y,
PixelInfo pixel,
ExceptionInfo exception 
)
MagickPrivate ColorspaceType GetPixelCacheColorspace ( const Cache  cache)
MagickPrivate MagickSizeType GetPixelCacheNexusExtent ( const Cache  cache,
NexusInfo *magick_restrict  nexus_info 
)

Definition at line 2124 of file cache.c.

References magick_restrict, and MagickCoreSignature.

Referenced by GetImageExtent().

MagickPrivate void* GetPixelCachePixels ( Image image,
MagickSizeType length,
ExceptionInfo exception 
)
MagickPrivate ClassType GetPixelCacheStorageClass ( const Cache  cache)
MagickPrivate void GetPixelCacheTileSize ( const Image image,
size_t *  width,
size_t *  height 
)
MagickPrivate VirtualPixelMethod GetPixelCacheVirtualMethod ( const Image image)

Definition at line 2297 of file cache.c.

References _Image::cache, magick_restrict, MagickCoreSignature, and _Image::signature.

Referenced by GetOneVirtualPixel(), and GetVirtualPixels().

MagickExport const void* GetVirtualMetacontent ( const Image image)
static const void* GetVirtualMetacontentFromCache ( const Image image)
static
MagickPrivate const void* GetVirtualMetacontentFromNexus ( const Cache  cache,
NexusInfo *magick_restrict  nexus_info 
)
static const Quantum* GetVirtualPixelCache ( const Image image,
const VirtualPixelMethod  virtual_pixel_method,
const ssize_t  x,
const ssize_t  y,
const size_t  columns,
const size_t  rows,
ExceptionInfo exception 
)
static
MagickExport const Quantum* GetVirtualPixelQueue ( const Image image)
static const Quantum* GetVirtualPixelsCache ( const Image image)
static
MagickPrivate const Quantum* GetVirtualPixelsFromNexus ( const Image image,
const VirtualPixelMethod  virtual_pixel_method,
const ssize_t  x,
const ssize_t  y,
const size_t  columns,
const size_t  rows,
NexusInfo nexus_info,
ExceptionInfo exception 
)

Definition at line 2568 of file cache.c.

References AcquirePixelCacheNexus(), AcquireQuantumMemory(), AcquireRandomInfo(), _PixelInfo::alpha, _NexusInfo::authentic_pixel_cache, _Image::background_color, BackgroundVirtualPixelMethod, _PixelInfo::black, BlackVirtualPixelMethod, _PixelInfo::blue, _Image::cache, CacheError, CheckerTileVirtualPixelMethod, ClampToQuantum(), DestroyPixelCacheNexus(), DitherVirtualPixelMethod, DitherX(), DitherY(), EdgeVirtualPixelMethod, EdgeX(), EdgeY(), _Image::filename, GetMagickModule, GetVirtualMetacontentFromNexus(), GrayVirtualPixelMethod, _PixelInfo::green, _RectangleInfo::height, HorizontalTileEdgeVirtualPixelMethod, HorizontalTileVirtualPixelMethod, magick_restrict, MagickCoreSignature, MagickFalse, MagickMin, MaskVirtualPixelMethod, MaxPixelChannels, _NexusInfo::metacontent, MirrorVirtualPixelMethod, OpaqueAlpha, QuantumRange, _MagickModulo::quotient, RandomVirtualPixelMethod, RandomX(), RandomY(), ReadMode, ReadPixelCacheMetacontent(), ReadPixelCachePixels(), _PixelInfo::red, _NexusInfo::region, RelinquishMagickMemory(), _MagickModulo::remainder, ResetMagickMemory(), SetPixelAlpha(), SetPixelBlack(), SetPixelBlue(), SetPixelCacheNexusPixels(), SetPixelChannel(), SetPixelGreen(), SetPixelRed(), _Image::signature, ThrowMagickException(), TileVirtualPixelMethod, TransparentAlpha, TransparentVirtualPixelMethod, UndefinedCache, UndefinedVirtualPixelMethod, VerticalTileEdgeVirtualPixelMethod, VerticalTileVirtualPixelMethod, VirtualPixelModulo(), WhiteVirtualPixelMethod, _RectangleInfo::width, _RectangleInfo::x, and _RectangleInfo::y.

Referenced by GetOneVirtualPixel(), GetOneVirtualPixelFromCache(), GetOneVirtualPixelInfo(), GetVirtualPixelCache(), and GetVirtualPixels().

MagickPrivate const Quantum* GetVirtualPixelsNexus ( const Cache  cache,
NexusInfo *magick_restrict  nexus_info 
)
static MagickBooleanType IsPixelCacheAuthentic ( const CacheInfo *magick_restrict  cache_info,
const NexusInfo *magick_restrict  nexus_info 
)
inlinestatic

Definition at line 4652 of file cache.c.

References MagickFalse, MagickTrue, and PingCache.

Referenced by SetPixelCacheNexusPixels().

static MagickBooleanType OpenPixelCache ( Image image,
const MapMode  mode,
ExceptionInfo exception 
)
static
static void PrefetchPixelCacheNexusPixels ( const NexusInfo nexus_info,
const MapMode  mode 
)
inlinestatic

Definition at line 4674 of file cache.c.

References MagickCachePrefetch, _NexusInfo::pixels, and ReadMode.

Referenced by SetPixelCacheNexusPixels().

MagickExport Quantum* QueueAuthenticPixels ( Image image,
const ssize_t  x,
const ssize_t  y,
const size_t  columns,
const size_t  rows,
ExceptionInfo exception 
)
static Quantum* QueueAuthenticPixelsCache ( Image image,
const ssize_t  x,
const ssize_t  y,
const size_t  columns,
const size_t  rows,
ExceptionInfo exception 
)
static
static ssize_t RandomX ( RandomInfo random_info,
const size_t  columns 
)
inlinestatic

Definition at line 2538 of file cache.c.

References GetPseudoRandomValue().

Referenced by GetVirtualPixelsFromNexus().

static ssize_t RandomY ( RandomInfo random_info,
const size_t  rows 
)
inlinestatic

Definition at line 2543 of file cache.c.

References GetPseudoRandomValue().

Referenced by GetVirtualPixelsFromNexus().

static MagickOffsetType ReadPixelCacheRegion ( const CacheInfo *magick_restrict  cache_info,
const MagickOffsetType  offset,
const MagickSizeType  length,
unsigned char *magick_restrict  buffer 
)
inlinestatic

Definition at line 4092 of file cache.c.

References MagickMin.

Referenced by ReadPixelCacheMetacontent(), and ReadPixelCachePixels().

MagickPrivate Cache ReferencePixelCache ( Cache  cache)
static void RelinquishCacheNexusPixels ( NexusInfo nexus_info)
inlinestatic
MagickPrivate void ResetPixelCacheEpoch ( void  )

Definition at line 4498 of file cache.c.

static MagickBooleanType SyncAuthenticPixelsCache ( Image image,
ExceptionInfo exception 
)
static
static MagickModulo VirtualPixelModulo ( const ssize_t  offset,
const size_t  extent 
)
inlinestatic

Definition at line 2548 of file cache.c.

References _MagickModulo::quotient, and _MagickModulo::remainder.

Referenced by GetVirtualPixelsFromNexus().

static MagickOffsetType WritePixelCacheRegion ( const CacheInfo *magick_restrict  cache_info,
const MagickOffsetType  offset,
const MagickSizeType  length,
const unsigned char *magick_restrict  buffer 
)
inlinestatic

Definition at line 3317 of file cache.c.

References MagickMin.

Referenced by SetPixelCacheExtent(), WritePixelCacheMetacontent(), and WritePixelCachePixels().

Variable Documentation

ssize_t DitherMatrix[64]
static
Initial value:
=
{
0, 48, 12, 60, 3, 51, 15, 63,
32, 16, 44, 28, 35, 19, 47, 31,
8, 56, 4, 52, 11, 59, 7, 55,
40, 24, 36, 20, 43, 27, 39, 23,
2, 50, 14, 62, 1, 49, 13, 61,
34, 18, 46, 30, 33, 17, 45, 29,
10, 58, 6, 54, 9, 57, 5, 53,
42, 26, 38, 22, 41, 25, 37, 21
}

Definition at line 2482 of file cache.c.

Referenced by DitherX(), and DitherY().