Speedups for denoise, fixes #3418

This commit is contained in:
heckflosse
2016-09-07 16:44:16 +02:00
parent dc4bbe906b
commit 0f21a0de6c
7 changed files with 174 additions and 52 deletions

View File

@@ -1104,6 +1104,15 @@ public:
{
return (x <= start ? x*slope : exp(log(x) / gamma) * mul - add);
}
static inline float gammaf (float x, float gamma, float start, float slope)
{
return x <= start ? x*slope : xexpf(xlogf(x) / gamma);
}
//fills a LUT of size 65536 using gamma with slope...
static void gammaf2lut (LUTf &gammacurve, float gamma, float start, float slope, float divisor, float factor);
static inline double igamma (double x, double gamma, double start, double slope, double mul, double add)
{
return (x <= start * slope ? x / slope : exp(log((x + add) / mul) * gamma) );
@@ -1118,7 +1127,7 @@ public:
*/
static inline double gamman (double x, double gamma) //standard gamma without slope...
{
return (x = exp(log(x) / gamma));
return exp(log(x) / gamma);
}
/**
@@ -1129,9 +1138,10 @@ public:
*/
static inline float gammanf (float x, float gamma) //standard gamma without slope...
{
return (x = xexpf(xlogf(x) / gamma));
return xexpf(xlogf(x) / gamma);
}
//fills a LUT of size 65536 using gamma without slope...
static void gammanf2lut (LUTf &gammacurve, float gamma, float divisor, float factor);
/**
* @brief Very simply inverse gamma
@@ -1141,7 +1151,7 @@ public:
*/
static inline double igamman (double x, double gamma) //standard inverse gamma without slope...
{
return (x = exp(log(x) * gamma) );
return exp(log(x) * gamma);
}