]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Thu, 9 Jan 2014 13:18:24 +0000 (13:18 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Thu, 9 Jan 2014 13:18:24 +0000 (13:18 +0000)
MagickCore/compare.c

index 0e3ab7a97ba257559d94030a78e508a8caff8133..8aefd1433bc4fcc003960323a138bf7972c7dde6 100644 (file)
@@ -1108,14 +1108,9 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image,
     *image_moments,
     *reconstruct_moments;
 
-  double
-    difference,
-    sum;
-
   register ssize_t
     i;
 
-  *distortion=0.0;
   image_moments=GetImageMoments(image,exception);
   if (image_moments == (ChannelMoments *) NULL)
     return(MagickFalse);
@@ -1133,8 +1128,12 @@ static MagickBooleanType GetPerceptualHashDistortion(const Image *image,
 
     for (channel=0; channel < MaxPixelChannels; channel++)
     {
+      double
+        difference;
+
       difference=reconstruct_moments[channel].I[i]-image_moments[channel].I[i];
-      sum+=difference*difference;
+      distortion[channel]+=difference*difference;
+      distortion[CompositePixelChannel]+=difference*difference;
     }
   }
   *distortion=sum;