]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 8 Sep 2014 11:48:28 +0000 (11:48 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 8 Sep 2014 11:48:28 +0000 (11:48 +0000)
MagickCore/compare.c
MagickCore/identify.c
MagickCore/statistic.c
MagickCore/statistic.h

index 1fd4a58d868673160403546fe6e1435785fc52fa..adfbb0809176adaa26db90ee95a7d10caa7bbb2c 100644 (file)
@@ -1154,7 +1154,7 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image,
       i;
 
     difference=0.0;
-    for (i=0; i < 7; i++)
+    for (i=0; i < MaximumNumberOfImageMoments; i++)
     {
       double
         alpha,
@@ -1185,7 +1185,7 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image,
       i;
 
     difference=0.0;
-    for (i=0; i < 7; i++)
+    for (i=0; i < MaximumNumberOfImageMoments; i++)
     {
       double
         alpha,
@@ -1210,8 +1210,6 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image,
   return(MagickTrue);
 }
 
-
-
 static MagickBooleanType GetRootMeanSquaredDistortion(const Image *image,
   const Image *reconstruct_image,double *distortion,ExceptionInfo *exception)
 {
index 76ecb2bf89c87d2dc3f3008fa2e1292e6e881999..a5ea189ce5243aeb89bf61ce16f84fb8aca0c331 100644 (file)
@@ -375,7 +375,7 @@ static ssize_t PrintChannelMoments(FILE *file,const PixelChannel channel,
     GetMagickPrecision(),pow(scale,powers[0])*
     channel_moments[channel].ellipse_intensity,GetMagickPrecision(),
     channel_moments[channel].ellipse_intensity);
-  for (i=0; i < 8; i++)
+  for (i=0; i < MaximumNumberOfImageMoments; i++)
     n+=FormatLocaleFile(file,"      I%.20g: %.*g (%.*g)\n",i+1.0,
       GetMagickPrecision(),channel_moments[channel].I[i]/pow(scale,powers[i]),
       GetMagickPrecision(),channel_moments[channel].I[i]);
@@ -392,7 +392,7 @@ static ssize_t PrintChannelPerceptualHash(FILE *file,const PixelChannel channel,
     n;
 
   n=FormatLocaleFile(file,"    %s:\n",name);
-  for (i=0; i < 7; i++)
+  for (i=0; i < MaximumNumberOfImageMoments; i++)
     n+=FormatLocaleFile(file,"      PH%.20g: %.*g, %.*g\n",i+1.0,
       GetMagickPrecision(),channel_phash[channel].srgb_hu_phash[i],
       GetMagickPrecision(),channel_phash[channel].hclp_hu_phash[i]);
index bd3f9b9049497deab8796b025f14babf9f61bcef..776624cb3eaf88517d4a50d4e2e1dcd222d54989 100644 (file)
@@ -1748,7 +1748,7 @@ MagickExport ChannelPerceptualHash *GetImagePerceptualHash(
   if (perceptual_hash == (ChannelPerceptualHash *) NULL)
     return((ChannelPerceptualHash *) NULL);
   for (channel=0; channel <= MaxPixelChannels; channel++)
-    for (i=0; i < 7; i++)
+    for (i=0; i < MaximumNumberOfImageMoments; i++)
       perceptual_hash[channel].srgb_hu_phash[i]=
         (-MagickLog10(moments[channel].I[i]));
   moments=(ChannelMoments *) RelinquishMagickMemory(moments);
@@ -1779,7 +1779,7 @@ MagickExport ChannelPerceptualHash *GetImagePerceptualHash(
       return((ChannelPerceptualHash *) NULL);
     }
   for (channel=0; channel <= MaxPixelChannels; channel++)
-    for (i=0; i < 7; i++)
+    for (i=0; i < MaximumNumberOfImageMoments; i++)
       perceptual_hash[channel].hclp_hu_phash[i]=
         (-MagickLog10(moments[channel].I[i]));
   moments=(ChannelMoments *) RelinquishMagickMemory(moments);
index 5cfceb20572e7bc7da44117337b847501f35aaab..6017bf77ac0362b6dab994ddb47640e1ae0f11df 100644 (file)
@@ -22,6 +22,8 @@
 extern "C" {
 #endif
 
+#define MaximumNumberOfImageMoments  8
+
 typedef struct _ChannelStatistics
 {
   size_t
@@ -45,7 +47,7 @@ typedef struct _ChannelStatistics
 typedef struct _ChannelMoments
 {
   double
-    I[32];
+    I[MaximumNumberOfImageMoments+1];
 
   PointInfo
     centroid,
@@ -60,8 +62,8 @@ typedef struct _ChannelMoments
 typedef struct _ChannelPerceptualHash
 {
   double
-    srgb_hu_phash[32],
-    hclp_hu_phash[32];
+    srgb_hu_phash[MaximumNumberOfImageMoments+1],
+    hclp_hu_phash[MaximumNumberOfImageMoments+1];
 } ChannelPerceptualHash;
 
 typedef enum