


Linear RGB clearly loses, but it's not as if the difference between sigmoidized Ginseng and Lanczos 3 directly with sRGB jumps at you.
Code: Select all
/*
Sigmoidal with inflexion point moved to b and "slope constant" set to a.
*/
#if 0
#define Sigmoidal(a,b,x) ( 1.0/(1.0+exp((a)*((b)-(x)))) )
#else
#define Sigmoidal(a,b,x) ( \
log( ((a)*((x)-(b))) + sqrt( ((a)*((x)-(b)))*((a)*((x)-(b))) + 1.0 ) ) )
#endif
/*
Scaled sigmoidal formula: (1/(1+exp(a*(b-x))) - 1/(1+exp(a*b)))
/
(1/(1+exp(a*(b-1))) - 1/(1+exp(a*b))).
See http://osdir.com/ml/video.image-magick.devel/2005-04/msg00006.html and
http://www.cs.dartmouth.edu/farid/downloads/tutorials/fip.pdf.
*/
#define ScaledSigmoidal(a,b,x) ( \
(Sigmoidal((a),(b),(x))-Sigmoidal((a),(b),0.0)) / \
(Sigmoidal((a),(b),1.0)-Sigmoidal((a),(b),0.0)) )
#if 0
#define InverseScaledSigmoidal(a,b,x) ( \
(b) - log( -1.0+1.0/((Sigmoidal((a),(b),1.0)-Sigmoidal((a),(b),0.0))*(x)+ \
Sigmoidal((a),(b),0.0)) ) / (a) )
/*
The limit of ScaledSigmoidal as a->0 is the identity, but a=0 gives a
division by zero. This is fixed below by hardwiring the identity when a is
small. This would appear to be safe because the series expansion of the
sigmoidal function around x=b is 1/2-a*(b-x)/4+... so that s(1)-s(0) is
about a/4.
*/
#else
#define InverseScaledSigmoidal(a,b,x) ( \
(b) + sinh( ((Sigmoidal((a),(b),1.0)-Sigmoidal((a),(b),0.0))*(x)+ \
Sigmoidal((a),(b),0.0)) ) / (a) )
#endif
Yes, I know. I wanted something slightly more different. But maybe I'll give tahn and arctanh a try and see if it makes a difference.fmw42 wrote:You may already know this, but the scaled tanh and arctanh produce results similar to the sigmoidal functions, if not identical, due to the similarity in the use of exponentials.
NicolasRobidoux wrote: There is a collection of "common sigmoidal functions" here: http://en.wikipedia.org/wiki/File:Gjl-t%28x%29.svg