]> granicus.if.org Git - imagemagick/commitdiff
Pixel cache optimization
authorCristy <mikayla-grace@urban-warrior.org>
Sun, 31 Mar 2019 16:04:45 +0000 (12:04 -0400)
committerCristy <mikayla-grace@urban-warrior.org>
Sun, 31 Mar 2019 16:04:45 +0000 (12:04 -0400)
ChangeLog
MagickCore/cache-private.h
MagickCore/cache.c
coders/msl.c
coders/svg.c
configure
configure.ac

index 61149b05f897e5a574fb72c89e793dd5db0ed8b0..dc0b791848fb8e1bd25052733472394aafa0367e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
-2019-03-30  7.0.8-36 Cristy  <quetzlzacatenango@image...>
-  * Release ImageMagick version 7.0.8-36, GIT revision 15457:ee5b9c56b:20190330
+2019-03-31  7.0.8-36 Cristy  <quetzlzacatenango@image...>
+  * Release ImageMagick version 7.0.8-36, GIT revision 15459:7e69ae7e4:20190331
 
 2019-03-27  7.0.8-36 Cristy  <quetzlzacatenango@image...>
   * Fixed a number of issues (reference
index 9c821516055809f67a1b9d8acb489780092e6987..d82dee7a004c0bfd0f6596a6722417b18f7cbc0b 100644 (file)
@@ -124,6 +124,9 @@ typedef struct _NexusInfo
 
   size_t
     signature;
+
+  struct _NexusInfo
+    *pixel_nexus;
 } NexusInfo;
 
 typedef struct _CacheInfo
index 366ea0ccf04c446e0d55edab538965eb75ad9b99..858f0227bbd6ad96858ec2703ae6092ccf23ac73 100644 (file)
@@ -264,17 +264,18 @@ MagickPrivate NexusInfo **AcquirePixelCacheNexus(const size_t number_threads)
     i;
 
   nexus_info=(NexusInfo **) MagickAssumeAligned(AcquireAlignedMemory(
-    number_threads,sizeof(*nexus_info)));
+    number_threads+1,sizeof(*nexus_info)));
   if (nexus_info == (NexusInfo **) NULL)
     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
-  nexus_info[0]=(NexusInfo *) AcquireQuantumMemory(number_threads,
+  nexus_info[0]=(NexusInfo *) AcquireQuantumMemory(number_threads+1,
     sizeof(**nexus_info));
   if (nexus_info[0] == (NexusInfo *) NULL)
     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
-  (void) memset(nexus_info[0],0,number_threads*sizeof(**nexus_info));
-  for (i=0; i < (ssize_t) number_threads; i++)
+  (void) memset(nexus_info[0],0,(number_threads+1)*sizeof(**nexus_info));
+  for (i=0; i <= (ssize_t) number_threads; i++)
   {
     nexus_info[i]=(&nexus_info[0][i]);
+    nexus_info[i]->pixel_nexus=(&nexus_info[0][number_threads]);
     nexus_info[i]->signature=MagickCoreSignature;
   }
   return(nexus_info);
@@ -417,9 +418,6 @@ static MagickBooleanType ClipPixelCacheNexus(Image *image,
   MagickSizeType
     number_pixels;
 
-  NexusInfo
-    **magick_restrict image_nexus;
-
   register Quantum
     *magick_restrict p,
     *magick_restrict q;
@@ -437,10 +435,9 @@ static MagickBooleanType ClipPixelCacheNexus(Image *image,
   cache_info=(CacheInfo *) image->cache;
   if (cache_info == (Cache) NULL)
     return(MagickFalse);
-  image_nexus=AcquirePixelCacheNexus(1);
   p=GetAuthenticPixelCacheNexus(image,nexus_info->region.x,nexus_info->region.y,
-    nexus_info->region.width,nexus_info->region.height,image_nexus[0],
-    exception);
+    nexus_info->region.width,nexus_info->region.height,
+    nexus_info->pixel_nexus,exception);
   q=nexus_info->pixels;
   number_pixels=(MagickSizeType) nexus_info->region.width*
     nexus_info->region.height;
@@ -472,7 +469,6 @@ static MagickBooleanType ClipPixelCacheNexus(Image *image,
     p+=GetPixelChannels(image);
     q+=GetPixelChannels(image);
   }
-  image_nexus=DestroyPixelCacheNexus(image_nexus,1);
   if (n < (ssize_t) number_pixels)
     return(MagickFalse);
   return(MagickTrue);
@@ -1107,7 +1103,7 @@ MagickPrivate NexusInfo **DestroyPixelCacheNexus(NexusInfo **nexus_info,
     i;
 
   assert(nexus_info != (NexusInfo **) NULL);
-  for (i=0; i < (ssize_t) number_threads; i++)
+  for (i=0; i <= (ssize_t) number_threads; i++)
   {
     if (nexus_info[i]->cache != (Quantum *) NULL)
       RelinquishCacheNexusPixels(nexus_info[i]);
@@ -2714,9 +2710,6 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
     length,
     number_pixels;
 
-  NexusInfo
-    **magick_restrict virtual_nexus;
-
   Quantum
     *magick_restrict pixels,
     virtual_pixel[MaxPixelChannels];
@@ -2795,7 +2788,6 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
     Pixel request is outside cache extents.
   */
   s=(unsigned char *) nexus_info->metacontent;
-  virtual_nexus=AcquirePixelCacheNexus(1);
   (void) memset(virtual_pixel,0,cache_info->number_channels*
     sizeof(*virtual_pixel));
   virtual_metacontent=(void *) NULL;
@@ -2821,7 +2813,6 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
             cache_info->metacontent_extent);
           if (virtual_metacontent == (void *) NULL)
             {
-              virtual_nexus=DestroyPixelCacheNexus(virtual_nexus,1);
               (void) ThrowMagickException(exception,GetMagickModule(),
                 CacheError,"UnableToGetCacheNexus","`%s'",image->filename);
               return((const Quantum *) NULL);
@@ -2915,9 +2906,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
             {
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
                 EdgeX(x_offset,cache_info->columns),
-                EdgeY(y_offset,cache_info->rows),1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                EdgeY(y_offset,cache_info->rows),1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case RandomVirtualPixelMethod:
@@ -2927,17 +2919,19 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
                 RandomX(cache_info->random_info,cache_info->columns),
                 RandomY(cache_info->random_info,cache_info->rows),1UL,1UL,
-                *virtual_nexus,exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case DitherVirtualPixelMethod:
             {
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
                 DitherX(x_offset,cache_info->columns),
-                DitherY(y_offset,cache_info->rows),1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                DitherY(y_offset,cache_info->rows),1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case TileVirtualPixelMethod:
@@ -2945,9 +2939,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
               x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
               y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
-                x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                x_modulo.remainder,y_modulo.remainder,1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case MirrorVirtualPixelMethod:
@@ -2961,9 +2956,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
                 y_modulo.remainder=(ssize_t) cache_info->rows-
                   y_modulo.remainder-1L;
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
-                x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                x_modulo.remainder,y_modulo.remainder,1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case HorizontalTileEdgeVirtualPixelMethod:
@@ -2971,8 +2967,9 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
               x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
                 x_modulo.remainder,EdgeY(y_offset,cache_info->rows),1UL,1UL,
-                *virtual_nexus,exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case VerticalTileEdgeVirtualPixelMethod:
@@ -2980,8 +2977,9 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
               y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
                 EdgeX(x_offset,cache_info->columns),y_modulo.remainder,1UL,1UL,
-                *virtual_nexus,exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case BackgroundVirtualPixelMethod:
@@ -3006,9 +3004,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
                   break;
                 }
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
-                x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                x_modulo.remainder,y_modulo.remainder,1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case HorizontalTileVirtualPixelMethod:
@@ -3022,9 +3021,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
               x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
               y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
-                x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                x_modulo.remainder,y_modulo.remainder,1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
             case VerticalTileVirtualPixelMethod:
@@ -3038,9 +3038,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
               x_modulo=VirtualPixelModulo(x_offset,cache_info->columns);
               y_modulo=VirtualPixelModulo(y_offset,cache_info->rows);
               p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,
-                x_modulo.remainder,y_modulo.remainder,1UL,1UL,*virtual_nexus,
-                exception);
-              r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+                x_modulo.remainder,y_modulo.remainder,1UL,1UL,
+                nexus_info->pixel_nexus,exception);
+              r=GetVirtualMetacontentFromNexus(cache_info,
+                nexus_info->pixel_nexus);
               break;
             }
           }
@@ -3060,10 +3061,10 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
         Transfer a run of pixels.
       */
       p=GetVirtualPixelCacheNexus(image,virtual_pixel_method,x_offset,y_offset,
-        (size_t) length,1UL,*virtual_nexus,exception);
+        (size_t) length,1UL,nexus_info->pixel_nexus,exception);
       if (p == (const Quantum *) NULL)
         break;
-      r=GetVirtualMetacontentFromNexus(cache_info,*virtual_nexus);
+      r=GetVirtualMetacontentFromNexus(cache_info,nexus_info->pixel_nexus);
       (void) memcpy(q,p,(size_t) (cache_info->number_channels*length*
         sizeof(*p)));
       q+=cache_info->number_channels*length;
@@ -3081,7 +3082,6 @@ MagickPrivate const Quantum *GetVirtualPixelCacheNexus(const Image *image,
   */
   if (virtual_metacontent != (void *) NULL)
     virtual_metacontent=(void *) RelinquishMagickMemory(virtual_metacontent);
-  virtual_nexus=DestroyPixelCacheNexus(virtual_nexus,1);
   if (v < (ssize_t) rows)
     return((const Quantum *) NULL);
   return(pixels);
@@ -3396,9 +3396,6 @@ static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
   MagickSizeType
     number_pixels;
 
-  NexusInfo
-    **magick_restrict image_nexus;
-
   register Quantum
     *magick_restrict p,
     *magick_restrict q;
@@ -3416,10 +3413,9 @@ static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
   cache_info=(CacheInfo *) image->cache;
   if (cache_info == (Cache) NULL)
     return(MagickFalse);
-  image_nexus=AcquirePixelCacheNexus(1);
   p=GetAuthenticPixelCacheNexus(image,nexus_info->region.x,nexus_info->region.y,
-    nexus_info->region.width,nexus_info->region.height,image_nexus[0],
-    exception);
+    nexus_info->region.width,nexus_info->region.height,
+    nexus_info->pixel_nexus,exception);
   q=nexus_info->pixels;
   number_pixels=(MagickSizeType) nexus_info->region.width*
     nexus_info->region.height;
@@ -3446,7 +3442,6 @@ static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
     p+=GetPixelChannels(image);
     q+=GetPixelChannels(image);
   }
-  image_nexus=DestroyPixelCacheNexus(image_nexus,1);
   if (n < (ssize_t) number_pixels)
     return(MagickFalse);
   return(MagickTrue);
index 28ab8f313b80d330a6d4dc6ebd0050ece950ba70..f2e35d56e4e32b7f902a5c4dd13949224224eb01 100644 (file)
@@ -7862,6 +7862,7 @@ static MagickBooleanType ProcessMSLScript(const ImageInfo *image_info,
   *msl_info.image=msl_image;
   if (*image != (Image *) NULL)
     MSLPushImage(&msl_info,*image);
+  xmlInitParser();
   (void) xmlSubstituteEntitiesDefault(1);
   (void) memset(&sax_modules,0,sizeof(sax_modules));
   sax_modules.internalSubset=MSLInternalSubset;
@@ -7987,9 +7988,6 @@ ModuleExport size_t RegisterMSLImage(void)
   MagickInfo
     *entry;
 
-#if defined(MAGICKCORE_XML_DELEGATE)
-  xmlInitParser();
-#endif
   entry=AcquireMagickInfo("MSL","MSL","Magick Scripting Language");
 #if defined(MAGICKCORE_XML_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadMSLImage;
index 05f5d228bc37426b566ea3d5ca1b2c3531d61bea..aa84088740b5a28d0919b7cd9f241dd13c423b38 100644 (file)
@@ -3551,6 +3551,7 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
     (void) CloneString(&svg_info->size,image_info->size);
   if (image->debug != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),"begin SAX");
+  xmlInitParser();
   (void) xmlSubstituteEntitiesDefault(1);
   (void) memset(&sax_modules,0,sizeof(sax_modules));
   sax_modules.internalSubset=SVGInternalSubset;
@@ -3737,9 +3738,6 @@ ModuleExport size_t RegisterSVGImage(void)
 #if defined(MAGICKCORE_RSVG_DELEGATE)
 #if !GLIB_CHECK_VERSION(2,35,0)
   g_type_init();
-#endif
-#if defined(MAGICKCORE_XML_DELEGATE)
-  xmlInitParser();
 #endif
   (void) FormatLocaleString(version,MagickPathExtent,"RSVG %d.%d.%d",
     LIBRSVG_MAJOR_VERSION,LIBRSVG_MINOR_VERSION,LIBRSVG_MICRO_VERSION);
index a509086ae47621d00d3d7658b9f091b17a300d7f..38b86bfe08d3d91550191af81740f8b9361ee4bc 100755 (executable)
--- a/configure
+++ b/configure
@@ -4570,7 +4570,7 @@ MAGICK_PATCHLEVEL_VERSION=36
 
 MAGICK_VERSION=7.0.8-36
 
-MAGICK_GIT_REVISION=15442:d94a5714f:20190325
+MAGICK_GIT_REVISION=15459:7e69ae7e4:20190331
 
 
 # Substitute library versioning
@@ -26860,7 +26860,7 @@ $as_echo "#define HAVE_SOCKET 1" >>confdefs.h
 fi
 
 
-for ac_func in acosh _aligned_malloc asinh atanh atoll atexit cabs carg cimag creal clock clock_getres clock_gettime ctime_r directio erf _exit execvp fchmod floor fork ftime ftruncate getc_unlocked getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r isnan j0 j1 lltostr localtime_r lstat memmove memset mkstemp munmap nanosleep newlocale _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_spawnp pow pread pwrite qsort_r raise rand_r readlink realpath select seekdir sendfile setlocale socket sqrt setvbuf stat strchr strrchr strcspn strdup strpbrk strspn strstr strtod strtod_l strtol strtoul symlink sysconf sigemptyset sigaction spawnvp strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times ulltostr uselocale usleep utime vfprintf vfprintf_l vsprintf vsnprintf vsnprintf_l waitpid _wfopen _wstat
+for ac_func in acosh _aligned_malloc asinh atanh atoll atexit cabs carg cimag creal clock clock_getres clock_gettime ctime_r directio erf _exit execvp fchmod floor fork ftime ftruncate getc_unlocked getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r isnan j0 j1 lltostr localtime_r lstat memmove memset mkstemp munmap nanosleep newlocale _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_memalign posix_spawnp pow pread pwrite qsort_r raise rand_r readlink realpath select seekdir sendfile setlocale socket sqrt setvbuf stat strchr strrchr strcspn strdup strpbrk strspn strstr strtod strtod_l strtol strtoul symlink sysconf sigemptyset sigaction spawnvp strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times ulltostr uselocale usleep utime vfprintf vfprintf_l vsprintf vsnprintf vsnprintf_l waitpid _wfopen _wstat
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
index 854da8dd699f06fe4e7df8a2730a3c7922e51386..ef2ea207a01644b667aa1a5704ae46e8fb32f6e5 100644 (file)
@@ -1220,7 +1220,7 @@ AC_SEARCH_LIBS(socket, socket,
   MAGICK_FEATURES="DPC $MAGICK_FEATURES"
 ])
 
-AC_CHECK_FUNCS([acosh _aligned_malloc asinh atanh atoll atexit cabs carg cimag creal clock clock_getres clock_gettime ctime_r directio erf _exit execvp fchmod floor fork ftime ftruncate getc_unlocked getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r isnan j0 j1 lltostr localtime_r lstat memmove memset mkstemp munmap nanosleep newlocale _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_spawnp pow pread pwrite qsort_r raise rand_r readlink realpath select seekdir sendfile setlocale socket sqrt setvbuf stat strchr strrchr strcspn strdup strpbrk strspn strstr strtod strtod_l strtol strtoul symlink sysconf sigemptyset sigaction spawnvp strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times ulltostr uselocale usleep utime vfprintf vfprintf_l vsprintf vsnprintf vsnprintf_l waitpid _wfopen _wstat])
+AC_CHECK_FUNCS([acosh _aligned_malloc asinh atanh atoll atexit cabs carg cimag creal clock clock_getres clock_gettime ctime_r directio erf _exit execvp fchmod floor fork ftime ftruncate getc_unlocked getcwd getpid getexecname getdtablesize getpagesize getrlimit getrusage gettimeofday gmtime_r isnan j0 j1 lltostr localtime_r lstat memmove memset mkstemp munmap nanosleep newlocale _NSGetExecutablePath pclose _pclose poll popen _popen posix_fadvise posix_fallocate posix_madvise posix_memalign posix_spawnp pow pread pwrite qsort_r raise rand_r readlink realpath select seekdir sendfile setlocale socket sqrt setvbuf stat strchr strrchr strcspn strdup strpbrk strspn strstr strtod strtod_l strtol strtoul symlink sysconf sigemptyset sigaction spawnvp strerror strlcat strlcpy strcasecmp strncasecmp telldir tempnam times ulltostr uselocale usleep utime vfprintf vfprintf_l vsprintf vsnprintf vsnprintf_l waitpid _wfopen _wstat])
 
 #
 # Check for clock_gettime().