From 2cc7345d8eb326a3dd3a714b9de64d36db2e8ab1 Mon Sep 17 00:00:00 2001 From: Cristy Date: Mon, 27 Feb 2017 20:41:33 -0500 Subject: [PATCH] ... --- MagickCore/compare.c | 11 ++++------- MagickCore/magick-type.h | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) 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; -- 2.40.0