Reworked color functions 2

see issue 1052
This commit is contained in:
Oliver Duis
2012-07-11 22:51:02 +02:00
parent f99fd3f063
commit 00a0d49a99
4 changed files with 2 additions and 48 deletions

View File

@@ -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);*/
}
}

View File

@@ -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) {

View File

@@ -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 ();

View File

@@ -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; }