Allow black slider to take negative values, allows shadow lifting.
This commit is contained in:
@@ -27,6 +27,8 @@
|
||||
|
||||
#define CURVES_MIN_POLY_POINTS 1000
|
||||
|
||||
#define SQR(x) ((x)*(x))
|
||||
|
||||
namespace rtengine {
|
||||
|
||||
class CurveFactory {
|
||||
@@ -82,17 +84,35 @@ class CurveFactory {
|
||||
if (x<x1) return x*m;
|
||||
return 1.0 - hr + hr*baseu((x-x1)/hr, m, 0.3*hr);
|
||||
}
|
||||
static inline double clower2 (double x, double m, double sr) {
|
||||
float x1 = sr/1.5 + 0.00001;
|
||||
float y1 = 1-(1-x1)*m;
|
||||
if (x>x1 || sr<0.001)
|
||||
return 1-(1-x)*m;
|
||||
else
|
||||
return y1+m*(x-x1)-(1-m)*SQR(SQR(1-x/x1));
|
||||
}
|
||||
// tone curve base. a: slope (from exp.comp.), b: black, D: max. x value (can be>1), hr,sr: highlight,shadow recovery
|
||||
static inline double basecurve (double x, double a, double b, double D, double hr, double sr) {
|
||||
double m = a>1 ? b+0.25*(1-b)/a : b+(1-b)/4;
|
||||
double y = a>1 ? 0.25 : 0.25*a;
|
||||
double slope = a/(1-b);
|
||||
if (x<=m)
|
||||
return b==0 ? x*a : clower (x/m, slope*m/y, sr) * y;
|
||||
else if (a>1)
|
||||
return y+(1.0-y)*cupper2((x-m)/(1-m), slope*(1-m)/(1.0-y), hr);
|
||||
else
|
||||
return y+(x-m)*slope;
|
||||
if (b<0) {
|
||||
double m = 0.5;
|
||||
double slope = 1+b;
|
||||
double y = -b+m*slope;
|
||||
if (x>m)
|
||||
return y + (x - m)*slope;
|
||||
else
|
||||
return y*clower2(x/m, slope*m/y, 2.0-sr);
|
||||
} else {
|
||||
double m = a>1 ? b+0.25*(1-b)/a : b+(1-b)/4;
|
||||
double y = a>1 ? 0.25 : 0.25*a;
|
||||
double slope = a/(1-b);
|
||||
if (x<=m)
|
||||
return b==0 ? x*a : clower (x/m, slope*m/y, sr) * y;
|
||||
else if (a>1)
|
||||
return y+(1.0-y)*cupper2((x-m)/(1-m), slope*(1-m)/(1.0-y), hr);
|
||||
else
|
||||
return y+(x-m)*slope;
|
||||
}
|
||||
}
|
||||
// brightness curve at point x, only positive amount it supported
|
||||
static inline double brightnessbase (double x, double amount) {
|
||||
|
@@ -346,9 +346,9 @@ void ImProcFunctions::rgbProc (Image16* working, LabImage* lab, int* hltonecurve
|
||||
b *= tonefactor;
|
||||
|
||||
//brightness/contrast and user tone curve
|
||||
r = tonecurve[r];
|
||||
g = tonecurve[g];
|
||||
b = tonecurve[b];
|
||||
r = tonecurve[CLIP(r)];
|
||||
g = tonecurve[CLIP(g)];
|
||||
b = tonecurve[CLIP(b)];
|
||||
|
||||
if (abs(sat)>0.5) {
|
||||
float h, s, v;
|
||||
|
@@ -55,7 +55,7 @@ ToneCurve::ToneCurve () : ToolPanel(), expAdd(false), blackAdd(false), brAdd(fal
|
||||
pack_start (*hlcompr);
|
||||
|
||||
//----------- Black Level ----------------------------------
|
||||
black = Gtk::manage (new Adjuster (M("TP_EXPOSURE_BLACKLEVEL"), 0, 32768, 1, 0));
|
||||
black = Gtk::manage (new Adjuster (M("TP_EXPOSURE_BLACKLEVEL"), -16384, 32768, 1, 0));
|
||||
pack_start (*black);
|
||||
shcompr = Gtk::manage (new Adjuster (M("TP_EXPOSURE_COMPRSHADOWS"), 0, 100, 1, 50));
|
||||
pack_start (*shcompr);
|
||||
|
Reference in New Issue
Block a user