From: nicolas Date: Mon, 10 Sep 2012 14:43:25 +0000 (+0000) Subject: InverseScaledSig: replace division by reciprocal multiplication X-Git-Tag: 7.0.1-0~4984 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f36a12a4290b0d669736a624e619fac8cf8f74f9;p=imagemagick InverseScaledSig: replace division by reciprocal multiplication --- diff --git a/ChangeLog b/ChangeLog index 669b0506b..c3c230d9b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2012-09-10 7.0.0-0 Nicolas Robidoux + * InverseScaledSig: replace division by reciprocal multiplication. + 2012-09-04 7.0.0-0 Nicolas Robidoux * Add tanh/atanh clone of legacy sigmoidal map (faster & more accurate). diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index 3a62d833f..75affa19d 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -3356,13 +3356,11 @@ MagickExport MagickBooleanType SigmoidalContrastImage(Image *image, Inverse of ScaledSig, used for +sigmoidal-contrast: */ #if defined(MAGICKCORE_HAVE_ATANH) -#define InverseScaledSig(a,b,x) ( (b) + \ - atanh( (Sig((a),(b),1.0)-Sig((a),(b),0.0))*(x)+Sig((a),(b),0.0) ) \ - / (0.5*(a)) ) +#define InverseScaledSig(a,b,x) ( (b) + (2.0/(a)) * \ + atanh( (Sig((a),(b),1.0)-Sig((a),(b),0.0))*(x)+Sig((a),(b),0.0) ) ) #else -#define InverseScaledSig(a,b,x) ( (b) - \ - log( 1.0/((Sig((a),(b),1.0)-Sig((a),(b),0.0))*(x)+Sig((a),(b),0.0))-1.0 ) \ - / (a) ) +#define InverseScaledSig(a,b,x) ( (b) + (-1.0/(a)) * \ + log( 1.0/((Sig((a),(b),1.0)-Sig((a),(b),0.0))*(x)+Sig((a),(b),0.0))-1.0 ) ) #endif /*