[prev in list] [next in list] [prev in thread] [next in thread] 

List:       graphicsmagick-commit
Subject:    [GM-commit] GraphicsMagick: Lessen use of IsNexusInCore(). Eliminate GetNex...
From:       GraphicsMagick Commits <graphicsmagick-commit () lists ! sourceforge ! net>
Date:       2013-04-28 23:06:57
Message-ID: hg.fb3c68c61b7b.1367190417.-1602079902 () blade ! simplesystems ! org
[Download RAW message or body]

changeset fb3c68c61b7b in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=fb3c68c61b7b
                
summary: Lessen use of IsNexusInCore().  Eliminate GetNexusIndexes() and \
GetNexusPixels().

diffstat:

 ChangeLog                              |   11 ++
 VisualMagick/installer/inc/version.isx |    4 +-
 design/pixel-cache-struct.dot          |    2 +-
 design/pixel-cache.dot                 |   17 +-
 magick/pixel_cache.c                   |  178 +++++++++-----------------------
 magick/version.h                       |    4 +-
 www/Changelog.html                     |   11 ++
 7 files changed, 90 insertions(+), 137 deletions(-)

diffs (truncated from 536 to 300 lines):

diff -r 2cafec9ca79f -r fb3c68c61b7b ChangeLog
--- a/ChangeLog	Sat Apr 20 20:15:00 2013 -0500
+++ b/ChangeLog	Sun Apr 28 18:06:52 2013 -0500
@@ -1,3 +1,14 @@
+2013-04-28  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+
+	* design/pixel-cache-struct.dot: Update structure relationships
+	diagram.
+
+	* design/pixel-cache.dot: Update call flow diagram.
+
+	* magick/pixel_cache.c: Eliminate use of internal functions
+	GetNexusIndexes(), GetNexusPixels().  Reduce usage of internal
+	function IsNexusInCore().
+
 2013-04-20  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
 
 	* configure.ac: MAGICK_SSIZE_T should always be a signed type.
diff -r 2cafec9ca79f -r fb3c68c61b7b VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sat Apr 20 20:15:00 2013 -0500
+++ b/VisualMagick/installer/inc/version.isx	Sun Apr 28 18:06:52 2013 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020130420"
-#define public MagickPackageReleaseDate "snapshot-20130420"
+#define public MagickPackageVersionAddendum ".020130428"
+#define public MagickPackageReleaseDate "snapshot-20130428"
diff -r 2cafec9ca79f -r fb3c68c61b7b design/pixel-cache-struct.dot
--- a/design/pixel-cache-struct.dot	Sat Apr 20 20:15:00 2013 -0500
+++ b/design/pixel-cache-struct.dot	Sun Apr 28 18:06:52 2013 -0500
@@ -66,7 +66,7 @@
 
   "NexusInfo" [
      shape=record,
-     label="<Struct> \N|{<pixels> pixels[]|<indexes> \
indexes[]|staging|length|<region> region|signature}" +     label="<Struct> \
\N|{<pixels> pixels[]|<indexes> indexes[]|staging|length|<region> \
region|in_core|signature}"  ];
 
   "CacheInfo" [
diff -r 2cafec9ca79f -r fb3c68c61b7b design/pixel-cache.dot
--- a/design/pixel-cache.dot	Sat Apr 20 20:15:00 2013 -0500
+++ b/design/pixel-cache.dot	Sun Apr 28 18:06:52 2013 -0500
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2008 GraphicsMagick Group
+  Copyright (C) 2008, 2013 GraphicsMagick Group
 
   This program is covered by multiple licenses, which are described in
   Copyright.txt. You should have received a copy of Copyright.txt with
@@ -36,6 +36,10 @@
                 GetImagePixelsEx GetIndexes GetOnePixel GetPixels SetImagePixels \
                 SetImagePixelsEx SyncImagePixels SyncImagePixelsEx };
 
+  {rank=same; WriteCacheIndexes WriteCachePixels ReadCachePixels ReadCacheIndexes };
+
+  {rank=same; ClonePixelCache OpenCache FilePositionRead FilePositionWrite };
+
   AccessCacheViewPixels [color="chartreuse"];
   AccessMutableIndexes [color="chartreuse"];
   AccessMutablePixels [color="chartreuse"];
@@ -70,7 +74,6 @@
 
 /*   DestroyCacheInfo [color="salmon"]; */
   DestroyCacheNexus [color="salmon"];
-/*   DestroyPixelStream [color="salmon"]; */
   AllocateCacheNexus [color="salmon"];
   ModifyCache [color="salmon"];
   /* PersistCache [color="salmon"]; */
@@ -81,7 +84,6 @@
   AcquireCacheNexus -> DestroyCacheNexus;
   AcquireCacheNexus -> AllocateCacheNexus;
   AcquireCacheNexus -> GetNexusIndexes;
-  AcquireCacheNexus -> IsNexusInCore;
   AcquireCacheNexus -> ReadCacheIndexes;
   AcquireCacheNexus -> ReadCachePixels;
   AcquireCacheNexus -> SetNexus;
@@ -102,7 +104,6 @@
 /*   DestroyPixelStream -> LockSemaphoreInfo; */
 /*   DestroyPixelStream -> UnlockSemaphoreInfo; */
 /*   GetCacheInfo -> AllocateSemaphoreInfo; */
-  GetCacheNexus -> IsNexusInCore;
   GetCacheNexus -> ReadCacheIndexes;
   GetCacheNexus -> ReadCachePixels;
   GetCacheNexus -> SetCacheNexus;
@@ -138,13 +139,15 @@
   SetImagePixels -> SetCacheViewPixels;
   SetImagePixelsEx -> SetCacheViewPixels;
   SyncCacheNexus -> ClipCacheNexus;
-  SyncCacheNexus -> IsNexusInCore;
   SyncCacheNexus -> WriteCachePixels;
   SyncCacheNexus -> WriteCacheIndexes;
   SyncCacheViewPixels -> SyncCacheNexus;
   SyncImagePixels -> SyncCacheViewPixels;
   SyncImagePixelsEx -> SyncCacheViewPixels;
-  WriteCacheIndexes -> IsNexusInCore;
-  WriteCachePixels -> IsNexusInCore;
+  SetNexus -> IsNexusInCore;
 
+  ReadCacheIndexes -> FilePositionRead;
+  ReadCachePixels -> FilePositionRead;
+  WriteCacheIndexes -> FilePositionWrite;
+  WriteCachePixels -> FilePositionWrite;
 }
diff -r 2cafec9ca79f -r fb3c68c61b7b magick/pixel_cache.c
--- a/magick/pixel_cache.c	Sat Apr 20 20:15:00 2013 -0500
+++ b/magick/pixel_cache.c	Sun Apr 28 18:06:52 2013 -0500
@@ -1,5 +1,5 @@
 /*
-% Copyright (C) 2003 - 2012 GraphicsMagick Group
+% Copyright (C) 2003 - 2013 GraphicsMagick Group
 % Copyright (C) 2002 ImageMagick Studio
 %
 % This program is covered by multiple licenses, which are described in
@@ -216,6 +216,10 @@
   /* Selected region (width, height, x, y) */
   RectangleInfo region;
 
+  /* Nexus pixels are non-strided and in core */
+  MagickBool in_core;
+
+#if 0
   /* FIXME, use: Region starting offset in pixels */
   /* offset=nexus_info->region.y*(magick_off_t) \
cache_info->columns+nexus_info->region.x */  magick_off_t region_offset;
@@ -226,9 +230,7 @@
 
   /* FIXME, use: Pixels are accessed linearly (rather than as a rectangle) */
   MagickBool direct_flag;
-
-  /* FIXME, use: Nexus is in core (does not require sync) */
-  MagickBool in_core_flag;
+#endif
 
   /* Unique number for structure validation */
   unsigned long signature;
@@ -267,12 +269,6 @@
     const unsigned long columns,const unsigned long rows,NexusInfo *nexus_info,
     ExceptionInfo *exception);
 
-static IndexPacket
-  *GetNexusIndexes(const NexusInfo *nexus_info);
-
-static PixelPacket
-  *GetNexusPixels(const NexusInfo *nexus_info);
-
 static MagickPassFail
   OpenCache(Image *image,const MapMode mode,ExceptionInfo *exception),
   SyncCacheNexus(Image *image,const NexusInfo *nexus_info,ExceptionInfo *exception);
@@ -318,7 +314,7 @@
   signals.
 
 */
-static inline ssize_t
+static ssize_t
 FilePositionRead(int file, void *buffer, size_t length,magick_off_t offset)
 {
   register ssize_t
@@ -368,7 +364,7 @@
   by signals.
 
 */
-static inline ssize_t
+static ssize_t
 FilePositionWrite(int file, const void *buffer,size_t length,magick_off_t offset)
 {
   register ssize_t
@@ -526,7 +522,8 @@
 %
 %  The format of the IsNexusInCore() method is:
 %
-%      MagickPassFail IsNexusInCore(const Cache cache,const NexusInfo *nexus_info)
+%      MagickPassFail IsNexusInCore(const Cache cache,
+%                                   const NexusInfo *nexus_info)
 %
 %  A description of each parameter follows:
 %
@@ -540,31 +537,30 @@
 %
 */
 static inline MagickPassFail
-IsNexusInCore(const Cache cache,const NexusInfo *nexus_info)
+IsNexusInCore(const CacheInfo *cache_info,const NexusInfo *nexus_info)
 {
   MagickPassFail
     status=MagickFail;
 
-  const CacheInfo
-    * restrict cache_info=(const CacheInfo *) cache;
-
-  if (cache_info && (cache_info->storage_class != UndefinedClass))
+  if (cache_info->type == PingCache)
     {
-      if (cache_info->type == PingCache)
-        {
-          status=MagickPass;
-        }
-      else
-        {
-	  magick_off_t
-	    offset;
-
-          offset=nexus_info->region.y*
-            (magick_off_t) cache_info->columns+nexus_info->region.x;
-          if (nexus_info->pixels == (cache_info->pixels+offset))
-            status=MagickPass;
-        }
+      /*
+        Some coders *do* read the pixels in 'ping' mode.  Skip sync on
+        such pixels.
+      */
+      status=MagickPass;
     }
+  else
+    {
+      magick_off_t
+        offset;
+
+      offset=nexus_info->region.y*
+        (magick_off_t) cache_info->columns+nexus_info->region.x;
+      if (nexus_info->pixels == (cache_info->pixels+offset))
+        status=MagickPass;
+    }
+
   return(status);
 }
 
@@ -599,11 +595,11 @@
 AccessCacheViewPixels(const ViewInfo *view)
 {
   const View
-    *view_info = (const View *) view;
+    * restrict view_info = (const View *) view;
 
   assert(view_info != (View *) NULL);
   assert(view_info->signature == MagickSignature);
-  return GetNexusPixels(view_info->nexus_info);
+  return view_info->nexus_info->pixels;
 }
 
 /*
@@ -770,7 +766,7 @@
                   NexusInfo *nexus_info,ExceptionInfo *exception)
 {
   CacheInfo
-    *cache_info;
+    * restrict cache_info;
 
   magick_uint64_t
     number_pixels;
@@ -779,11 +775,11 @@
     offset;
 
   IndexPacket
-    *indexes,
-    *nexus_indexes;
+    * restrict indexes,
+    * restrict nexus_indexes;
 
   PixelPacket
-    *pixels,
+    * restrict pixels,
     virtual_pixel;
 
   RectangleInfo
@@ -803,7 +799,7 @@
     length;
 
   NexusInfo
-    *image_nexus;
+    * restrict image_nexus;
 
   /*
     Acquire pixels.
@@ -835,7 +831,7 @@
         /*
           Pixel request is inside cache extents.
         */
-        if (!IsNexusInCore(cache_info,nexus_info))
+        if (!nexus_info->in_core)
           {
             MagickPassFail
               status;
@@ -855,7 +851,7 @@
   /*
     Pixel request is outside cache extents.
   */
-  indexes=GetNexusIndexes(nexus_info);
+  indexes=nexus_info->indexes;
   image_nexus=AllocateCacheNexus();
   if (image_nexus == (NexusInfo *) NULL)
     {
@@ -912,7 +908,7 @@
               *q++=(*p);
               if (indexes == (IndexPacket *) NULL)
                 continue;
-              nexus_indexes=GetNexusIndexes(image_nexus);
+              nexus_indexes=image_nexus->indexes;
               if (nexus_indexes == (IndexPacket *) NULL)

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Graphicsmagick-commit mailing list
Graphicsmagick-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/graphicsmagick-commit


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic