Reworked color functions 2
see issue 1052
This commit is contained in:
@@ -695,29 +695,5 @@ 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:
|
||||
|
||||
// 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
|
||||
static double solve_upper (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);
|
||||
|
||||
// standard srgb gamma and its inverse
|
||||
@@ -171,18 +162,7 @@ class CurveFactory {
|
||||
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) );
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (comp>0.0) {
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include "dcp.h"
|
||||
#include "improcfun.h"
|
||||
#include "improccoordinator.h"
|
||||
#include "curves.h"
|
||||
#include "dfmanager.h"
|
||||
#include "ffmanager.h"
|
||||
#include "rtthumbnail.h"
|
||||
@@ -44,7 +43,6 @@ int init (const Settings* s, Glib::ustring baseDir) {
|
||||
|
||||
profileStore.init ();
|
||||
ProcParams::init ();
|
||||
CurveFactory::init ();
|
||||
Color::init ();
|
||||
ImProcFunctions::initMunsell();
|
||||
ImProcFunctions::initCache ();
|
||||
|
@@ -154,7 +154,7 @@ class RawImageSource : public ImageSource {
|
||||
ColorTemp getWB () { return wb; }
|
||||
ColorTemp getAutoWB ();
|
||||
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; }
|
||||
|
||||
|
Reference in New Issue
Block a user