From: Cristy Date: Tue, 28 Feb 2017 01:41:33 +0000 (-0500) Subject: ... X-Git-Tag: 7.0.5-1~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2cc7345d8eb326a3dd3a714b9de64d36db2e8ab1;p=imagemagick ... --- diff --git a/MagickCore/compare.c b/MagickCore/compare.c index 5cdbd89e7..1b7c32e8e 100644 --- a/MagickCore/compare.c +++ b/MagickCore/compare.c @@ -1212,13 +1212,10 @@ static MagickBooleanType GetPeakSignalToNoiseRatio(const Image *image, status=GetMeanSquaredDistortion(image,reconstruct_image,distortion,exception); for (i=0; i <= MaxPixelChannels; i++) - { - double - gamma; - - gamma=PerceptibleReciprocal(sqrt(distortion[i])); - distortion[i]=20.0*MagickLog10(gamma); - } + if (fabs(distortion[i]) < MagickEpsilon) + distortion[i]=INFINITY; + else + distortion[i]=20.0*MagickLog10(1.0/sqrt(distortion[i])); return(status); } diff --git a/MagickCore/magick-type.h b/MagickCore/magick-type.h index a7b76d297..059206775 100644 --- a/MagickCore/magick-type.h +++ b/MagickCore/magick-type.h @@ -167,6 +167,9 @@ typedef enum #else # define IsNaN(a) (a != a) #endif +#if !defined(INFINITY) +# define INFINITY (log(0)) +#endif typedef struct _BlobInfo BlobInfo;