Unification if sRGB gamma value

see issue 856
This commit is contained in:
Oliver Duis
2011-07-27 19:16:26 +02:00
parent 244caeff9a
commit 5aeb290622
6 changed files with 30 additions and 17 deletions

View File

@@ -126,6 +126,9 @@ class CurveFactory {
public:
const static double sRGBGamma; // standard average gamma
const static double sRGBGammaCurve; // 2.4 in the curve
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// accurately determine value from integer array with float as index
@@ -154,10 +157,10 @@ class CurveFactory {
// standard srgb gamma and its inverse
static inline double gamma2 (double x) {
return x <= 0.00304 ? x*12.92 : 1.055*exp(log(x)/2.4)-0.055;
return x <= 0.00304 ? x*12.92 : 1.055*exp(log(x)/sRGBGammaCurve)-0.055;
}
static inline double igamma2 (double x) {
return x <= 0.03928 ? x/12.92 : exp(log((x+0.055)/1.055)*2.4);
return x <= 0.03928 ? x/12.92 : exp(log((x+0.055)/1.055)*sRGBGammaCurve);
}
// gamma function with adjustable parameters
static inline double gamma (double x, double gamma, double start, double slope, double mul, double add){