Reworked color functions 2
see issue 1052
This commit is contained in:
@@ -696,28 +696,4 @@ namespace rtengine {
|
|||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LUTf CurveFactory::gammatab;
|
|
||||||
LUTf CurveFactory::igammatab_srgb;
|
|
||||||
LUTf CurveFactory::gammatab_srgb;
|
|
||||||
|
|
||||||
void CurveFactory::init () {
|
|
||||||
|
|
||||||
gammatab(65536,0);
|
|
||||||
igammatab_srgb(65536,0);
|
|
||||||
gammatab_srgb(65536,0);
|
|
||||||
|
|
||||||
for (int i=0; i<65536; i++)
|
|
||||||
gammatab_srgb[i] = (65535.0 * gamma2 (i/65535.0));
|
|
||||||
for (int i=0; i<65536; i++)
|
|
||||||
igammatab_srgb[i] = (65535.0 * igamma2 (i/65535.0));
|
|
||||||
for (int i=0; i<65536; i++)
|
|
||||||
gammatab[i] = (65535.0 * pow (i/65535.0, 0.454545));
|
|
||||||
|
|
||||||
/* FILE* f = fopen ("c.txt", "wt");
|
|
||||||
for (int i=0; i<256; i++)
|
|
||||||
fprintf (f, "%g %g\n", i/255.0, clower (i/255.0, 2.0, 1.0));
|
|
||||||
fclose (f);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -46,12 +46,6 @@ class CurveFactory {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// look-up tables for the standard srgb gamma and its inverse (filled by init())
|
|
||||||
static LUTf igammatab_srgb;
|
|
||||||
static LUTf gammatab_srgb;
|
|
||||||
// look-up tables for the simple exponential gamma
|
|
||||||
static LUTf gammatab;
|
|
||||||
|
|
||||||
// functions calculating the parameters of the contrast curve based on the desired slope at the center
|
// functions calculating the parameters of the contrast curve based on the desired slope at the center
|
||||||
static double solve_upper (double m, double c, double deriv);
|
static double solve_upper (double m, double c, double deriv);
|
||||||
static double solve_lower (double m, double c, double deriv);
|
static double solve_lower (double m, double c, double deriv);
|
||||||
@@ -152,9 +146,6 @@ class CurveFactory {
|
|||||||
}
|
}
|
||||||
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
|
|
||||||
static void init ();
|
|
||||||
static void cleanup ();
|
|
||||||
|
|
||||||
static inline double centercontrast (double x, double b, double m);
|
static inline double centercontrast (double x, double b, double m);
|
||||||
|
|
||||||
// standard srgb gamma and its inverse
|
// standard srgb gamma and its inverse
|
||||||
@@ -172,17 +163,6 @@ class CurveFactory {
|
|||||||
return (x <= start*slope ? x/slope : exp(log((x+add)/mul)*gamma) );
|
return (x <= start*slope ? x/slope : exp(log((x+add)/mul)*gamma) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// gamma functions on [0,65535] based on look-up tables
|
|
||||||
static inline float gamma_srgb (int x) { return gammatab_srgb[x]; }
|
|
||||||
static inline float gamma (int x) { return gammatab[x]; }
|
|
||||||
static inline float igamma_srgb (int x) { return igammatab_srgb[x]; }
|
|
||||||
static inline float gamma_srgb (float x) { return gammatab_srgb[x]; }
|
|
||||||
static inline float gamma (float x) { return gammatab[x]; }
|
|
||||||
static inline float igamma_srgb (float x) { return igammatab_srgb[x]; }
|
|
||||||
//static inline float gamma_srgb (double x) { return gammatab_srgb[x]; }
|
|
||||||
//static inline float gamma (double x) { return gammatab[x]; }
|
|
||||||
//static inline float igamma_srgb (double x) { return igammatab_srgb[x]; }
|
|
||||||
|
|
||||||
static inline float hlcurve (const float exp_scale, const float comp, const float hlrange, float level)
|
static inline float hlcurve (const float exp_scale, const float comp, const float hlrange, float level)
|
||||||
{
|
{
|
||||||
if (comp>0.0) {
|
if (comp>0.0) {
|
||||||
|
@@ -22,7 +22,6 @@
|
|||||||
#include "dcp.h"
|
#include "dcp.h"
|
||||||
#include "improcfun.h"
|
#include "improcfun.h"
|
||||||
#include "improccoordinator.h"
|
#include "improccoordinator.h"
|
||||||
#include "curves.h"
|
|
||||||
#include "dfmanager.h"
|
#include "dfmanager.h"
|
||||||
#include "ffmanager.h"
|
#include "ffmanager.h"
|
||||||
#include "rtthumbnail.h"
|
#include "rtthumbnail.h"
|
||||||
@@ -44,7 +43,6 @@ int init (const Settings* s, Glib::ustring baseDir) {
|
|||||||
|
|
||||||
profileStore.init ();
|
profileStore.init ();
|
||||||
ProcParams::init ();
|
ProcParams::init ();
|
||||||
CurveFactory::init ();
|
|
||||||
Color::init ();
|
Color::init ();
|
||||||
ImProcFunctions::initMunsell();
|
ImProcFunctions::initMunsell();
|
||||||
ImProcFunctions::initCache ();
|
ImProcFunctions::initCache ();
|
||||||
|
@@ -154,7 +154,7 @@ class RawImageSource : public ImageSource {
|
|||||||
ColorTemp getWB () { return wb; }
|
ColorTemp getWB () { return wb; }
|
||||||
ColorTemp getAutoWB ();
|
ColorTemp getAutoWB ();
|
||||||
ColorTemp getSpotWB (std::vector<Coord2D> red, std::vector<Coord2D> green, std::vector<Coord2D>& blue, int tran);
|
ColorTemp getSpotWB (std::vector<Coord2D> red, std::vector<Coord2D> green, std::vector<Coord2D>& blue, int tran);
|
||||||
bool isWBProviderReady () { return rawData != NULL; };//TODO this generates compiler warning: converting to non-pointer type 'long long int' from NULL [-Wconversion-null]
|
bool isWBProviderReady () { return rawData; }
|
||||||
|
|
||||||
double getDefGain () { return defGain; }
|
double getDefGain () { return defGain; }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user