From: cristy Date: Mon, 8 Sep 2014 11:48:28 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2036 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ac6aa903557af75f8149bad7c8aa512158fa445;p=imagemagick --- diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 1fd4a58d8..adfbb0809 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -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) { diff --git a/MagickCore/identify.c b/MagickCore/identify.c index 76ecb2bf8..a5ea189ce 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -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]); diff --git a/MagickCore/statistic.c b/MagickCore/statistic.c index bd3f9b904..776624cb3 100644 --- a/MagickCore/statistic.c +++ b/MagickCore/statistic.c @@ -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); diff --git a/MagickCore/statistic.h b/MagickCore/statistic.h index 5cfceb205..6017bf77a 100644 --- a/MagickCore/statistic.h +++ b/MagickCore/statistic.h @@ -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