]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Sat, 11 Feb 2017 20:43:46 +0000 (15:43 -0500)
committerCristy <urban-warrior@imagemagick.org>
Sat, 11 Feb 2017 20:43:46 +0000 (15:43 -0500)
PerlMagick/Magick.xs
PerlMagick/quantum/quantum.xs.in

index 7cabd5fb29a160dd8b97116365b5070d3754ba2a..f4e05cfb9c71515c57a8192b626b58d323feda61 100644 (file)
@@ -4201,20 +4201,24 @@ Features(ref,...)
     count=0;
     for ( ; image; image=image->next)
     {
+      register ssize_t
+        j;
+
       channel_features=GetImageFeatures(image,distance,exception);
       if (channel_features == (ChannelFeatures *) NULL)
         continue;
       count++;
-      EXTEND(sp,280*count);
-      for (i=0; i < 4; i++)
+      for (j=0; j < 4; j++)
       {
-        ChannelFeatures(RedChannel,i);
-        ChannelFeatures(GreenChannel,i);
-        ChannelFeatures(BlueChannel,i);
-        if (image->colorspace == CMYKColorspace)
-          ChannelFeatures(BlackChannel,i);
-        if (image->alpha_trait != UndefinedPixelTrait)
-          ChannelFeatures(AlphaChannel,i);
+        for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+        {
+          PixelChannel channel=GetPixelChannelChannel(image,i);
+          PixelTrait traits=GetPixelChannelTraits(image,channel);
+          if (traits == UndefinedPixelTrait)
+            continue;
+          EXTEND(sp,14*(i+1)*count);
+          ChannelFeatures(channel,j);
+        }
       }
       channel_features=(ChannelFeatures *)
         RelinquishMagickMemory(channel_features);
@@ -14301,16 +14305,16 @@ Statistics(ref,...)
     (double) channel_statistics[channel].depth); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].minima/scale); \
+    channel_statistics[channel].minima/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].maxima/scale); \
+    channel_statistics[channel].maxima/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].mean/scale); \
+    channel_statistics[channel].mean/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].standard_deviation/scale); \
+    channel_statistics[channel].standard_deviation/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_statistics[channel].kurtosis); \
@@ -14332,9 +14336,6 @@ Statistics(ref,...)
     ChannelStatistics
       *channel_statistics;
 
-    double
-      scale;
-
     ExceptionInfo
       *exception;
 
@@ -14386,9 +14387,9 @@ Statistics(ref,...)
       {
         PixelChannel channel=GetPixelChannelChannel(image,i);
         PixelTrait traits=GetPixelChannelTraits(image,channel);
-        if ((traits & UpdatePixelTrait) == 0)
+        if (traits == UndefinedPixelTrait)
           continue;
-        EXTEND(sp,8*i*count);
+        EXTEND(sp,8*(i+1)*count);
         ChannelStatistics(channel);
       }
       channel_statistics=(ChannelStatistics *)
index f3199d78473384682092dcbed68d4eccfa95ce5c..ba43bbc1de7a0dd3a67aa6051396b87da0737972 100644 (file)
@@ -4201,20 +4201,24 @@ Features(ref,...)
     count=0;
     for ( ; image; image=image->next)
     {
+      register ssize_t
+        j;
+
       channel_features=GetImageFeatures(image,distance,exception);
       if (channel_features == (ChannelFeatures *) NULL)
         continue;
       count++;
-      EXTEND(sp,280*count);
-      for (i=0; i < 4; i++)
+      for (j=0; j < 4; j++)
       {
-        ChannelFeatures(RedChannel,i);
-        ChannelFeatures(GreenChannel,i);
-        ChannelFeatures(BlueChannel,i);
-        if (image->colorspace == CMYKColorspace)
-          ChannelFeatures(BlackChannel,i);
-        if (image->alpha_trait != UndefinedPixelTrait)
-          ChannelFeatures(AlphaChannel,i);
+        for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
+        {
+          PixelChannel channel=GetPixelChannelChannel(image,i);
+          PixelTrait traits=GetPixelChannelTraits(image,channel);
+          if (traits == UndefinedPixelTrait)
+            continue;
+          EXTEND(sp,14*(i+1)*count);
+          ChannelFeatures(channel,j);
+        }
       }
       channel_features=(ChannelFeatures *)
         RelinquishMagickMemory(channel_features);
@@ -14301,16 +14305,16 @@ Statistics(ref,...)
     (double) channel_statistics[channel].depth); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].minima/scale); \
+    channel_statistics[channel].minima/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].maxima/scale); \
+    channel_statistics[channel].maxima/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].mean/scale); \
+    channel_statistics[channel].mean/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
-    channel_statistics[channel].standard_deviation/scale); \
+    channel_statistics[channel].standard_deviation/QuantumRange); \
   PUSHs(sv_2mortal(newSVpv(message,0))); \
   (void) FormatLocaleString(message,MagickPathExtent,"%.20g", \
     channel_statistics[channel].kurtosis); \
@@ -14332,9 +14336,6 @@ Statistics(ref,...)
     ChannelStatistics
       *channel_statistics;
 
-    double
-      scale;
-
     ExceptionInfo
       *exception;
 
@@ -14386,9 +14387,9 @@ Statistics(ref,...)
       {
         PixelChannel channel=GetPixelChannelChannel(image,i);
         PixelTrait traits=GetPixelChannelTraits(image,channel);
-        if ((traits & UpdatePixelTrait) == 0)
+        if (traits == UndefinedPixelTrait)
           continue;
-        EXTEND(sp,8*i*count);
+        EXTEND(sp,8*(i+1)*count);
         ChannelStatistics(channel);
       }
       channel_statistics=(ChannelStatistics *)