diff --git a/rtdata/languages/default b/rtdata/languages/default
index b73d5474c..d996bc148 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -393,6 +393,8 @@ HISTORY_MSG_167;B&W Toning
HISTORY_MSG_168;'Cc' curve
HISTORY_MSG_169;'Ch' curve
HISTORY_MSG_170;Vibrance - Curve
+HISTORY_MSG_171;'Lc' curve
+HISTORY_MSG_172;'Lc' curve - Red and skin tones
HISTORY_NEWSNAPSHOTAS;As...
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSSDIALOGLABEL;Label of the snapshot:
@@ -979,9 +981,12 @@ TP_IMPULSEDENOISE_LABEL;Impulse Noise Reduction
TP_IMPULSEDENOISE_THRESH;Impulse NR Threshold
TP_LABCURVE_AVOIDCOLORSHIFT;Avoid Color Shift
TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space\nand apply Munsell correction
+TP_LABCURVE_RSTPRO_TOOLTIP;Can be used with chromaticity and Cc curve.
+TP_LABCURVE_LCREDSK;LC Curve - Red and skin tones
+TP_LABCURVE_LCREDSK_TIP;If enabled 'LC curve' is limited to Red and skin tones\n if desabled all color are concerned
TP_LABCURVE_BRIGHTNESS;Brightness
TP_LABCURVE_BWTONING;B&W Toning
-TP_LABCURVE_BWTONING_TIP;With B&W Toning option enabled, the Lab Chromaticity, Cc and Ch curves are not in effect.\nToning can be achieved using the a and b curves
+TP_LABCURVE_BWTONING_TIP;With B&W Toning option enabled, the Lab Chromaticity, Cc Ch Lc curves are not in effect.\nToning can be achieved using the a and b curves
TP_LABCURVE_CHROMATICITY;Chromaticity
TP_LABCURVE_CONTRAST;Contrast
TP_LABCURVE_CURVEEDITOR;Luminance Curve
@@ -1001,6 +1006,8 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturated
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity according to the Chromaticity
TP_LABCURVE_CURVEEDITOR_CH;CH
TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticity according to the Hue
+TP_LABCURVE_CURVEEDITOR_CCL;LC
+TP_LABCURVE_CURVEEDITOR_CCL_TOOLTIP;Luminance according to Chromaticity - Hue skin and also Red - Yellow - Blue Green
TP_LABCURVE_LABEL;Lab Adjustments
TP_LABCURVE_RSTPROTECTION;Red and Skin Tones Protection
TP_LENSGEOM_AUTOCROP; Auto Crop
diff --git a/rtdata/profiles/BW-1.pp3 b/rtdata/profiles/BW-1.pp3
index b4830cd18..78808edfa 100644
--- a/rtdata/profiles/BW-1.pp3
+++ b/rtdata/profiles/BW-1.pp3
@@ -33,11 +33,13 @@ Chromaticity=0
BWtoning=true
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/BW-2.pp3 b/rtdata/profiles/BW-2.pp3
index bc7f34a7f..ac7ede6cb 100644
--- a/rtdata/profiles/BW-2.pp3
+++ b/rtdata/profiles/BW-2.pp3
@@ -33,11 +33,13 @@ Chromaticity=0
BWtoning=true
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=3;0;0;0.84892086330935235;0.69064748201438808;1;1;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/BW-3.pp3 b/rtdata/profiles/BW-3.pp3
index fbde7b35a..dd1d6a0e4 100644
--- a/rtdata/profiles/BW-3.pp3
+++ b/rtdata/profiles/BW-3.pp3
@@ -33,11 +33,13 @@ Chromaticity=0
BWtoning=true
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=2;0.25;0.5;0.75;50;12;-12;-50;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/BW-4.pp3 b/rtdata/profiles/BW-4.pp3
index b1f8785b5..fbbe3907b 100644
--- a/rtdata/profiles/BW-4.pp3
+++ b/rtdata/profiles/BW-4.pp3
@@ -33,11 +33,13 @@ Chromaticity=0
BWtoning=true
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=3;0;0;0.18623481781376497;0.028340080971659902;0.50607287449392713;0.50607287449392713;0.77732793522267185;0.97975708502024295;1;1;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Default-ISO-High.pp3 b/rtdata/profiles/Default-ISO-High.pp3
index 0aa28f95f..281997725 100644
--- a/rtdata/profiles/Default-ISO-High.pp3
+++ b/rtdata/profiles/Default-ISO-High.pp3
@@ -33,11 +33,13 @@ Chromaticity=5
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Default-ISO-Medium.pp3 b/rtdata/profiles/Default-ISO-Medium.pp3
index 07ecc0e93..80f8fba5d 100644
--- a/rtdata/profiles/Default-ISO-Medium.pp3
+++ b/rtdata/profiles/Default-ISO-Medium.pp3
@@ -33,11 +33,13 @@ Chromaticity=5
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Default.pp3 b/rtdata/profiles/Default.pp3
index 03a3d099f..e59589796 100644
--- a/rtdata/profiles/Default.pp3
+++ b/rtdata/profiles/Default.pp3
@@ -33,11 +33,13 @@ Chromaticity=5
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Highkey-1.pp3 b/rtdata/profiles/Highkey-1.pp3
index ffad5dae4..466a8e81c 100644
--- a/rtdata/profiles/Highkey-1.pp3
+++ b/rtdata/profiles/Highkey-1.pp3
@@ -33,11 +33,13 @@ Chromaticity=-10
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Natural-1.pp3 b/rtdata/profiles/Natural-1.pp3
index 94b353aff..3a9c7f554 100644
--- a/rtdata/profiles/Natural-1.pp3
+++ b/rtdata/profiles/Natural-1.pp3
@@ -33,11 +33,13 @@ Chromaticity=0
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Natural-2.pp3 b/rtdata/profiles/Natural-2.pp3
index 3ef8a8984..eb8726aad 100644
--- a/rtdata/profiles/Natural-2.pp3
+++ b/rtdata/profiles/Natural-2.pp3
@@ -33,11 +33,13 @@ Chromaticity=5
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=3;0;0;0.84892086330935235;0.69064748201438808;1;1;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Neutral.pp3 b/rtdata/profiles/Neutral.pp3
index 9b512ac42..9eade4815 100644
--- a/rtdata/profiles/Neutral.pp3
+++ b/rtdata/profiles/Neutral.pp3
@@ -33,11 +33,13 @@ Chromaticity=0
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Punchy-1.pp3 b/rtdata/profiles/Punchy-1.pp3
index d98ef925d..ac427cb3f 100644
--- a/rtdata/profiles/Punchy-1.pp3
+++ b/rtdata/profiles/Punchy-1.pp3
@@ -33,11 +33,13 @@ Chromaticity=5
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtdata/profiles/Punchy-2.pp3 b/rtdata/profiles/Punchy-2.pp3
index bffb76f12..35457b916 100644
--- a/rtdata/profiles/Punchy-2.pp3
+++ b/rtdata/profiles/Punchy-2.pp3
@@ -33,11 +33,13 @@ Chromaticity=5
BWtoning=false
AvoidColorShift=true
RedAndSkinTonesProtection=0
+LCredsk=true
LCurve=0;
aCurve=0;
bCurve=0;
ccCurve=0;
chCurve=0;
+LcCurve=0;
[Sharpening]
Enabled=false
diff --git a/rtengine/color.cc b/rtengine/color.cc
index 2e6a6be98..48721d6e6 100644
--- a/rtengine/color.cc
+++ b/rtengine/color.cc
@@ -17,13 +17,13 @@
* along with RawTherapee. If not, see .
*/
-#include "rt_math.h"
+#include "rt_math.h"
#include "color.h"
#include "iccmatrices.h"
#include "mytime.h"
-using namespace std;
-
+using namespace std;
+
namespace rtengine {
extern const Settings* settings;
@@ -151,73 +151,73 @@ namespace rtengine {
}
- void Color::rgb2hsv(float r, float g, float b, float &h, float &s, float &v) {
- double var_R = r / 65535.0;
- double var_G = g / 65535.0;
- double var_B = b / 65535.0;
-
- double var_Min = min(var_R,var_G,var_B);
- double var_Max = max(var_R,var_G,var_B);
- double del_Max = var_Max - var_Min;
- v = var_Max;
- if (del_Max<0.00001 && del_Max>-0.00001) { // no fabs, slow!
- h = 0;
- s = 0;
- }
- else {
- s = del_Max/var_Max;
-
- if ( var_R == var_Max ) h = (var_G - var_B)/del_Max;
- else if ( var_G == var_Max ) h = 2.0 + (var_B - var_R)/del_Max;
- else if ( var_B == var_Max ) h = 4.0 + (var_R - var_G)/del_Max;
- h /= 6.0;
-
- if ( h < 0 ) h += 1;
- if ( h > 1 ) h -= 1;
- }
+ void Color::rgb2hsv(float r, float g, float b, float &h, float &s, float &v) {
+ double var_R = r / 65535.0;
+ double var_G = g / 65535.0;
+ double var_B = b / 65535.0;
+
+ double var_Min = min(var_R,var_G,var_B);
+ double var_Max = max(var_R,var_G,var_B);
+ double del_Max = var_Max - var_Min;
+ v = var_Max;
+ if (del_Max<0.00001 && del_Max>-0.00001) { // no fabs, slow!
+ h = 0;
+ s = 0;
+ }
+ else {
+ s = del_Max/var_Max;
+
+ if ( var_R == var_Max ) h = (var_G - var_B)/del_Max;
+ else if ( var_G == var_Max ) h = 2.0 + (var_B - var_R)/del_Max;
+ else if ( var_B == var_Max ) h = 4.0 + (var_R - var_G)/del_Max;
+ h /= 6.0;
+
+ if ( h < 0 ) h += 1;
+ if ( h > 1 ) h -= 1;
+ }
}
- void Color::hsv2rgb (float h, float s, float v, float &r, float &g, float &b) {
-
- float h1 = h*6; // sector 0 to 5
- int i = (int)h1; // floor() is very slow, and h1 is always >0
- float f = h1 - i; // fractional part of h
-
- float p = v * ( 1 - s );
- float q = v * ( 1 - s * f );
- float t = v * ( 1 - s * ( 1 - f ) );
-
- float r1,g1,b1;
-
- if (i==1) {r1 = q; g1 = v; b1 = p;}
- else if (i==2) {r1 = p; g1 = v; b1 = t;}
- else if (i==3) {r1 = p; g1 = q; b1 = v;}
- else if (i==4) {r1 = t; g1 = p; b1 = v;}
- else if (i==5) {r1 = v; g1 = p; b1 = q;}
- else /*i==(0|6)*/ {r1 = v; g1 = t; b1 = p;}
-
- r = ((r1)*65535.0);
- g = ((g1)*65535.0);
- b = ((b1)*65535.0);
+ void Color::hsv2rgb (float h, float s, float v, float &r, float &g, float &b) {
+
+ float h1 = h*6; // sector 0 to 5
+ int i = (int)h1; // floor() is very slow, and h1 is always >0
+ float f = h1 - i; // fractional part of h
+
+ float p = v * ( 1 - s );
+ float q = v * ( 1 - s * f );
+ float t = v * ( 1 - s * ( 1 - f ) );
+
+ float r1,g1,b1;
+
+ if (i==1) {r1 = q; g1 = v; b1 = p;}
+ else if (i==2) {r1 = p; g1 = v; b1 = t;}
+ else if (i==3) {r1 = p; g1 = q; b1 = v;}
+ else if (i==4) {r1 = t; g1 = p; b1 = v;}
+ else if (i==5) {r1 = v; g1 = p; b1 = q;}
+ else /*i==(0|6)*/ {r1 = v; g1 = t; b1 = p;}
+
+ r = ((r1)*65535.0);
+ g = ((g1)*65535.0);
+ b = ((b1)*65535.0);
}
- // Function copied for speed concerns
- // Not exactly the same as above ; this one return a result in the [0.0 ; 1.0] range
- void Color::hsv2rgb01 (float h, float s, float v, float &r, float &g, float &b) {
- float h1 = h*6; // sector 0 to 5
- int i = int(h1);
- float f = h1 - i; // fractional part of h
-
- float p = v * ( 1 - s );
- float q = v * ( 1 - s * f );
- float t = v * ( 1 - s * ( 1 - f ) );
-
- if (i==1) {r = q; g = v; b = p;}
- else if (i==2) {r = p; g = v; b = t;}
- else if (i==3) {r = p; g = q; b = v;}
- else if (i==4) {r = t; g = p; b = v;}
- else if (i==5) {r = v; g = p; b = q;}
- else /*(i==0|6)*/ {r = v; g = t; b = p;}
+ // Function copied for speed concerns
+ // Not exactly the same as above ; this one return a result in the [0.0 ; 1.0] range
+ void Color::hsv2rgb01 (float h, float s, float v, float &r, float &g, float &b) {
+ float h1 = h*6; // sector 0 to 5
+ int i = int(h1);
+ float f = h1 - i; // fractional part of h
+
+ float p = v * ( 1 - s );
+ float q = v * ( 1 - s * f );
+ float t = v * ( 1 - s * ( 1 - f ) );
+
+ if (i==1) {r = q; g = v; b = p;}
+ else if (i==2) {r = p; g = v; b = t;}
+ else if (i==3) {r = p; g = q; b = v;}
+ else if (i==4) {r = t; g = p; b = v;}
+ else if (i==5) {r = v; g = p; b = q;}
+ else /*(i==0|6)*/ {r = v; g = t; b = p;}
}
void Color::hsv2rgb (float h, float s, float v, int &r, int &g, int &b) {
@@ -384,13 +384,13 @@ namespace rtengine {
b = (200.0 * (fy - fz) );
}
- double Color::f2xyz(double f) {
- const double epsilonExpInv3 = 6.0/29.0;
- const double kappaInv = 27.0/24389.0; // inverse of kappa
-
- return (f > epsilonExpInv3) ? f*f*f : (116 * f - 16) * kappaInv;
+ double Color::f2xyz(double f) {
+ const double epsilonExpInv3 = 6.0/29.0;
+ const double kappaInv = 27.0/24389.0; // inverse of kappa
+
+ return (f > epsilonExpInv3) ? f*f*f : (116 * f - 16) * kappaInv;
}
-
+
/*
* Gamut mapping algorithm
* Copyright (c) 2010-2011 Emil Martinec
@@ -410,42 +410,71 @@ namespace rtengine {
* The value of lam is the scale factor that takes the color to the gamut boundary
* columns of the matrix p=xyz_rgb are RGB tristimulus primaries in XYZ
* c is the color fixed on the boundary; and m=0 for c=0, m=1 for c=255
- */
- void Color::gamutmap(float &X, float &Y, float &Z, const double p[3][3])
- {
- float u = 4*X/(X+15*Y+3*Z)-u0;
- float v = 9*Y/(X+15*Y+3*Z)-v0;
-
- float lam[3][2];
- float lam_min = 1.0;
-
- for (int c=0; c<3; c++)
- for (int m=0; m<2; m++) {
-
- int c1=(c+1)%3;
- int c2=(c+2)%3;
-
- lam[c][m] = (-(p[0][c1]*p[1][c]*((-12 + 3*u0 + 20*v0)*Y + 4*m*65535*v0*p[2][c2])) +
- p[0][c]*p[1][c1]*((-12 + 3*u0 + 20*v0)*Y + 4*m*65535*v0*p[2][c2]) -
- 4*v0*p[0][c1]*(Y - m*65535*p[1][c2])*p[2][c] + 4*v0*p[0][c]*(Y - m*65535*p[1][c2])*p[2][c1] -
- (4*m*65535*v0*p[0][c2] - 9*u0*Y)*(p[1][c1]*p[2][c] - p[1][c]*p[2][c1]));
-
- lam[c][m] /= (3*u*Y*(p[0][c1]*p[1][c] - p[1][c1]*(p[0][c] + 3*p[2][c]) + 3*p[1][c]*p[2][c1]) +
- 4*v*(p[0][c1]*(5*Y*p[1][c] + m*65535*p[1][c]*p[2][c2] + Y*p[2][c] - m*65535*p[1][c2]*p[2][c]) -
- p[0][c]*(5*Y*p[1][c1] + m*65535*p[1][c1]*p[2][c2] + Y*p[2][c1] - m*65535*p[1][c2]*p[2][c1]) +
- m*65535*p[0][c2]*(p[1][c1]*p[2][c] - p[1][c]*p[2][c1])));
-
- if (lam[c][m]0) lam_min=lam[c][m];
-
- }
-
- u = u*lam_min + u0;
- v = v*lam_min + v0;
-
- X = (9*u*Y)/(4*v);
- Z = (12 - 3*u - 20*v)*Y/(4*v);
+ */
+ void Color::gamutmap(float &X, float &Y, float &Z, const double p[3][3])
+ {
+ float u = 4*X/(X+15*Y+3*Z)-u0;
+ float v = 9*Y/(X+15*Y+3*Z)-v0;
+
+ float lam[3][2];
+ float lam_min = 1.0;
+
+ for (int c=0; c<3; c++)
+ for (int m=0; m<2; m++) {
+
+ int c1=(c+1)%3;
+ int c2=(c+2)%3;
+
+ lam[c][m] = (-(p[0][c1]*p[1][c]*((-12 + 3*u0 + 20*v0)*Y + 4*m*65535*v0*p[2][c2])) +
+ p[0][c]*p[1][c1]*((-12 + 3*u0 + 20*v0)*Y + 4*m*65535*v0*p[2][c2]) -
+ 4*v0*p[0][c1]*(Y - m*65535*p[1][c2])*p[2][c] + 4*v0*p[0][c]*(Y - m*65535*p[1][c2])*p[2][c1] -
+ (4*m*65535*v0*p[0][c2] - 9*u0*Y)*(p[1][c1]*p[2][c] - p[1][c]*p[2][c1]));
+
+ lam[c][m] /= (3*u*Y*(p[0][c1]*p[1][c] - p[1][c1]*(p[0][c] + 3*p[2][c]) + 3*p[1][c]*p[2][c1]) +
+ 4*v*(p[0][c1]*(5*Y*p[1][c] + m*65535*p[1][c]*p[2][c2] + Y*p[2][c] - m*65535*p[1][c2]*p[2][c]) -
+ p[0][c]*(5*Y*p[1][c1] + m*65535*p[1][c1]*p[2][c2] + Y*p[2][c1] - m*65535*p[1][c2]*p[2][c1]) +
+ m*65535*p[0][c2]*(p[1][c1]*p[2][c] - p[1][c]*p[2][c1])));
+
+ if (lam[c][m]0) lam_min=lam[c][m];
+
+ }
+
+ u = u*lam_min + u0;
+ v = v*lam_min + v0;
+
+ X = (9*u*Y)/(4*v);
+ Z = (12 - 3*u - 20*v)*Y/(4*v);
}
+ void Color::scalered ( float rstprotection, float param, float limit, float HH, float deltaHH, float &scale,float &scaleext)
+ {
+ if(rstprotection<99.9999) {
+ if(param > limit)
+ scale = rstprotection/100.1f;
+ if((HH< (1.3f+deltaHH) && HH >=1.3f))
+ scaleext=HH*(1.0f-scale)/deltaHH + 1.0f - (1.3f+deltaHH)*(1.0f-scale)/deltaHH; //transition for Hue (red - yellow)
+ else if((HH< 0.15f && HH >(0.15f-deltaHH)))
+ scaleext=HH*(scale-1.0f)/deltaHH + 1.0f - (0.15f-deltaHH)*(scale-1.0f)/deltaHH; //transition for hue (red purple)
+ }
+ }
+
+ void Color::transitred (float HH, float Chprov1, float dred, float factorskin, float protect_red, float factorskinext, float deltaHH, float factorsat, float &factor)
+ {
+ if(HH>=0.15f && HH<1.3f) {
+ if (Chprov1(0.15f-deltaHH) || HH<(1.3f+deltaHH) ) {
+ if (Chprov1 < dred)
+ factor = factorskinext;// C=dred=55 => real max of skin tones
+ else if (Chprov1 < (dred+protect_red))// transition
+ factor = (factorsat-factorskinext)/protect_red*Chprov1+factorsat-(dred+protect_red)*(factorsat-factorskinext)/protect_red;
+ }
+ }
+
/*
* AllMunsellLch correction
* Copyright (c) 2012 Jacques Desmis
diff --git a/rtengine/color.h b/rtengine/color.h
index 08e547797..4fb4738db 100644
--- a/rtengine/color.h
+++ b/rtengine/color.h
@@ -156,6 +156,8 @@ public:
static void SkinSat (float lum, float hue, float chrom, float &satreduc, int chromx);//jacques Skin color
static void MunsellLch (float lum, float hue, float chrom, float memChprov, float &correction, int zone, float &lbe, bool &correctL);//jacques: Munsell correction
// end Munsell
+ static void scalered ( float rstprotection, float param, float limit, float HH, float deltaHH, float &scale, float &scaleext);
+ static void transitred (float HH, float Chprov1, float dred, float factorskin, float protect_red, float factorskinext, float deltaHH, float factorsat, float &factor);
//void gamutmap(LabImage* );
static void gamutmap(float &X, float &Y, float &Z, const double p[3][3]);
diff --git a/rtengine/curves.cc b/rtengine/curves.cc
index 62ac0e568..ca2cf158d 100644
--- a/rtengine/curves.cc
+++ b/rtengine/curves.cc
@@ -154,9 +154,9 @@ namespace rtengine {
}
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- void CurveFactory::complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, double saturation, double rstprotection,
+ void CurveFactory::complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, bool & cclutili, double saturation, double rstprotection,
const std::vector& acurvePoints, const std::vector& bcurvePoints,const std::vector& cccurvePoints,
- /*const std::vector& cbgcurvePoints,*/ LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve,/* LUTf & satbgCurve,*/ int skip) {
+ const std::vector& lccurvePoints, LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, LUTf & lhskCurve, int skip) {
//colormult = chroma_scale for Lab manipulations
@@ -273,18 +273,18 @@ namespace rtengine {
dCurve = NULL;
}
//----------------------------
- /*needed = false;
- if (!cbgcurvePoints.empty() && cbgcurvePoints[0]!=0) {
- dCurve = new DiagonalCurve (cbgcurvePoints, CURVES_MIN_POLY_POINTS/skip);
+ needed = false;
+ if (!lccurvePoints.empty() && lccurvePoints[0]!=0) {
+ dCurve = new DiagonalCurve (lccurvePoints, CURVES_MIN_POLY_POINTS/skip);
if (dCurve && !dCurve->isIdentity())
- {needed = true;cbgutili=true;}
+ {needed = true;cclutili=true;}
}
- fillCurveArray(dCurve, satbgCurve, skip, needed);
+ fillCurveArray(dCurve, lhskCurve, skip, needed);
if (dCurve) {
delete dCurve;
dCurve = NULL;
}
- */
+
}
diff --git a/rtengine/curves.h b/rtengine/curves.h
index c165e7288..91a8659b1 100644
--- a/rtengine/curves.h
+++ b/rtengine/curves.h
@@ -178,8 +178,8 @@ class CurveFactory {
static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr,
double gamma_, bool igamma_, const std::vector& curvePoints, LUTu & histogram, LUTu & histogramCropped,
LUTf & hlCurve, LUTf & shCurve,LUTf & outCurve, LUTu & outBeforeCCurveHistogram, int skip=1);
- static void complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, double saturation, double rstprotection, const std::vector& acurvePoints,
- const std::vector& bcurvePoints,const std::vector& cccurvePoints,/*const std::vector& cbgurvePoints,*/ LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, /*LUTf & satbgCurve,*/ int skip=1);
+ static void complexsgnCurve ( bool & autili, bool & butili, bool & ccutili, bool & cclutili, double saturation, double rstprotection, const std::vector& acurvePoints,
+ const std::vector& bcurvePoints,const std::vector& cccurvePoints,const std::vector& cclurvePoints, LUTf & aoutCurve, LUTf & boutCurve, LUTf & satCurve, LUTf & lhskCurve, int skip=1);
static void complexLCurve (double br, double contr, const std::vector& curvePoints, LUTu & histogram, LUTu & histogramCropped,
LUTf & outCurve, LUTu & outBeforeCCurveHistogram, int skip, bool & utili);
static void RGBCurve (const std::vector& curvePoints, LUTf & outCurve, int skip);
diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc
index f2eb649c3..b232ef6df 100644
--- a/rtengine/dcrop.cc
+++ b/rtengine/dcrop.cc
@@ -171,8 +171,8 @@ void Crop::update (int todo) {
bool autili=false;
bool butili=false;
bool ccutili=false;
-
- parent->ipf.chromiLuminanceCurve (labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve,/*parent->satbgcurve,*/ parent->lumacurve, utili, autili, butili, ccutili);
+ bool cclutili=false;
+ parent->ipf.chromiLuminanceCurve (labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve,parent->lhskcurve, parent->lumacurve, utili, autili, butili, ccutili,cclutili);
//parent->ipf.colorCurve (labnCrop, labnCrop);
parent->ipf.vibrance (labnCrop);
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index 5ad16a34f..d129eff1f 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -41,7 +41,7 @@ ImProcCoordinator::ImProcCoordinator ()
chroma_acurve(65536,0);
chroma_bcurve(65536,0);
satcurve(65536,0);
-// satbgcurve(65536,0);
+ lhskcurve(65536,0);
vhist16(65536);
lhist16(65536); lhist16Cropped(65536);
@@ -274,15 +274,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
bool autili=false;
bool butili=false;
bool ccutili=false;
-
+ bool cclutili=false;
if ((todo & M_LUMACURVE) || todo==CROP) {
CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, lhist16, lhist16Cropped,
lumacurve, histLCurve, scale==1 ? 1 : 16, utili);
}
if (todo & M_LUMACURVE) {
- CurveFactory::complexsgnCurve (autili, butili,ccutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
- params.labCurve.acurve, params.labCurve.bcurve,params.labCurve.cccurve/*,params.labCurve.cbgcurve*/, chroma_acurve, chroma_bcurve, satcurve,/*satbgcurve,*/ scale==1 ? 1 : 16);
+ CurveFactory::complexsgnCurve (autili, butili,ccutili,cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
+ params.labCurve.acurve, params.labCurve.bcurve,params.labCurve.cccurve,params.labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve,lhskcurve, scale==1 ? 1 : 16);
}
if (todo & (M_LUMINANCE+M_COLOR) ) {
@@ -296,7 +296,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
//readyphase++;
progress ("Applying Color Boost...",100*readyphase/numofphases);
- ipf.chromiLuminanceCurve (nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve/*,satbgcurve*/, lumacurve, utili, autili, butili, ccutili);
+ ipf.chromiLuminanceCurve (nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve,lhskcurve, lumacurve, utili, autili, butili, ccutili,cclutili);
//ipf.colorCurve (nprevl, nprevl);
ipf.vibrance(nprevl);
readyphase++;
diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h
index b04e58e90..e55fff7d1 100644
--- a/rtengine/improccoordinator.h
+++ b/rtengine/improccoordinator.h
@@ -74,7 +74,7 @@ class ImProcCoordinator : public StagedImageProcessor {
LUTf chroma_acurve;
LUTf chroma_bcurve;
LUTf satcurve;
- // LUTf satbgcurve;
+ LUTf lhskcurve;
LUTf rCurve;
LUTf gCurve;
diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc
index 283fca526..78438ea9d 100644
--- a/rtengine/improcfun.cc
+++ b/rtengine/improcfun.cc
@@ -442,10 +442,14 @@ void ImProcFunctions::luminanceCurve (LabImage* lold, LabImage* lnew, LUTf & cur
}
}
-void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve/*,LUTf & satbgcurve*/, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili) {
+
+
+void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve,LUTf & lhskcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili) {
int W = lold->W;
int H = lold->H;
+ // lhskcurve.dump("lh_curve");
+
//init Flatcurve for C=f(H)
FlatCurve* chCurve = NULL;
bool chutili = false;
@@ -497,6 +501,7 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
bool highlight = params->hlrecovery.enabled; //Get the value if "highlight reconstruction" is activated
int chromaticity = params->labCurve.chromaticity;
bool bwToning = params->labCurve.bwtoning;
+ bool LCredsk = params->labCurve.lcredsk;
double rstprotection = 100.-params->labCurve.rstprotection; // Red and Skin Tones Protection
// avoid color shift is disabled when bwToning is activated
bool avoidColorShift = params->labCurve.avoidcolorshift && !bwToning;
@@ -506,15 +511,15 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
// only if user activate Lab adjustements
if (avoidColorShift) {
- if(autili || butili || ccutili || chutili || utili || chromaticity)
+ if(autili || butili || ccutili || cclutili || chutili || utili || chromaticity)
Color::LabGamutMunsell(lold, Lold, Cold, /*corMunsell*/true, /*lumaMuns*/false, params->hlrecovery.enabled, /*gamut*/true, params->icm.working, multiThread);
}
#ifdef _DEBUG
-#pragma omp parallel default(shared) firstprivate(highlight, chromaticity, bwToning, rstprotection, avoidColorShift, protectRed, protectRedH, gamutLch, lold, lnew, MunsDebugInfo) if (multiThread)
+#pragma omp parallel default(shared) firstprivate(highlight, chromaticity, bwToning, rstprotection, avoidColorShift, LCredsk, protectRed, protectRedH, gamutLch, lold, lnew, MunsDebugInfo) if (multiThread)
#else
-#pragma omp parallel default(shared) firstprivate(highlight, chromaticity, bwToning, rstprotection, avoidColorShift, protectRed, protectRedH, gamutLch, lold, lnew) if (multiThread)
+#pragma omp parallel default(shared) firstprivate(highlight, chromaticity, bwToning, rstprotection, avoidColorShift, LCredsk, protectRed, protectRedH, gamutLch, lold, lnew) if (multiThread)
#endif
{
@@ -579,14 +584,20 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
}
atmp *= chromaChfactor;//apply C=f(H)
btmp *= chromaChfactor;
-// if (params->labCurve.chromaticity) {// if user use sliders
+ //simulate very approximative gamut f(L) : with pyramid transition
+ float dred=55.0f;//C red value limit
+ if (Lprov1<25.0f) dred = 40.0f;
+ else if(Lprov1<30.0f) dred = 3.0f*Lprov1 -35.0f;
+ else if(Lprov1<70.0f) dred = 55.0f;
+ else if(Lprov1<75.0f) dred = -3.0f*Lprov1 +265.0f;
+ else dred = 40.0f;
+ // end pyramid
if(chromaticity!=0 && !bwToning){
- // approximation in Lab mode to protect skin tones and avoid too big gamut clip for red
+ float factorskin, factorsat, factor, factorskinext, interm;
float scale = 100.0f/100.1f;//reduction in normal zone
float scaleext=1.0f;//reduction in transition zone
float protect_red,protect_redh;
float deltaHH;//HH value transition
- float dred=55.0f;//C red value limit
protect_red=float(protectRed);//default=60 chroma: one can put more or less if necessary...in 'option' 40...160
if(protect_red < 20.0f) protect_red=20.0; // avoid too low value
if(protect_red > 180.0f) protect_red=180.0; // avoid too high value
@@ -595,71 +606,99 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
if(protect_redh>1.0f) protect_redh=1.0f;//avoid too big values
deltaHH=protect_redh;//transition hue
-
- //simulate very approximative gamut f(L) : with pyramid transition
- if (Lprov1<25.0f) dred = 40.0f;
- else if(Lprov1<30.0f) dred = 3.0f*Lprov1 -35.0f;
- else if(Lprov1<70.0f) dred = 55.0f;
- else if(Lprov1<75.0f) dred = -3.0f*Lprov1 +265.0f;
- else dred = 40.0f;
-
- if(rstprotection<99.9999) {
- if(chromaticity>0)
- scale = rstprotection/100.1f;
- if((HH< (1.3f+deltaHH) && HH >=1.3f))
- scaleext=HH*(1.0f-scale)/deltaHH + 1.0f - (1.3f+deltaHH)*(1.0f-scale)/deltaHH; //transition for Hue (red - yellow)
- else if((HH< 0.15f && HH >(0.15f-deltaHH)))
- scaleext=HH*(scale-1.0f)/deltaHH + 1.0f - (0.15f-deltaHH)*(scale-1.0f)/deltaHH; //transition for hue (red purple)
- }
-
- //transition for red , near skin tones
- float factorskin, factorsat, factor, factorskinext;
- factorskin=1.0f+(chromaticity*scale)/100.0f;
- factorskinext=1.0f+(chromaticity*scaleext)/100.0f;
- factorsat=1.0f+(chromaticity)/100.0f;/*if(factorsat==1.0f) factorsat=1.1f;*/
-
+ float chromapro = (chromaticity + 100.0f)/100.0f;
+ if(chromapro>1.0) Color::scalered ( rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext);//1.0
+ else Color::scalered ( 100.0-rstprotection, chromapro, 0.0, HH, deltaHH, scale, scaleext);
+
+ if(chromapro>1.0) {interm=(chromapro-1.0f)*100.0f;
+ factorskin= 1.0f+(interm*scale)/100.0f;
+ factorskinext=1.0f+(interm*scaleext)/100.0f;}
+ else {
+ interm=(1.0f-chromapro)*100.0f;
+ factorskin= 1.0f-(interm*scale)/100.0f;
+ factorskinext=1.0f-(interm*scaleext)/100.0f;
+ }
+ factorsat=chromapro;
+ factor=factorsat;
+
factor = factorsat;
// Test if chroma is in the normal range first
- if(HH>=0.15f && HH<1.3f) {
- if (Chprov1(0.15f-deltaHH) || HH<(1.3f+deltaHH) ) {
- if (Chprov1 < dred)
- factor = factorskinext;// C=dred=55 => real max of skin tones
- else if (Chprov1 < (dred+protect_red))// transition
- factor = (factorsat-factorskinext)/protect_red*Chprov1+factorsat-(dred+protect_red)*(factorsat-factorskinext)/protect_red;
- }
-
+ Color::transitred ( HH, Chprov1, dred, factorskin, protect_red, factorskinext, deltaHH, factorsat, factor);
atmp *= factor;
btmp *= factor;
- // end approximation
}
// I have placed C=f(C) after all C treatments to assure maximum amplitude of "C"
if (!bwToning) {
+ float factorskin,factorsat,factor,factorskinext,interm;
float chroma = sqrt(SQR(atmp)+SQR(btmp)+0.001f);
float chromaCfactor = (satcurve[chroma*adjustr])/(chroma*adjustr);//apply C=f(C)
- atmp *= chromaCfactor;
- btmp *= chromaCfactor;
+ float curf=0.7f;//empirical coeff because curve is more progressive
+ float scale = 100.0f/100.1f;//reduction in normal zone for curve CC
+ float scaleext=1.0f;//reduction in transition zone for curve CC
+ float protect_redcur,protect_redhcur;//perhaps the same value than protect_red and protect_redh
+ float deltaHH;//HH value transition for CC curve
+ protect_redcur=curf*float(protectRed);//default=60 chroma: one can put more or less if necessary...in 'option' 40...160==> curf =because curve is more progressive
+ if(protect_redcur < 20.0f) protect_redcur=20.0; // avoid too low value
+ if(protect_redcur > 180.0f) protect_redcur=180.0; // avoid too high value
+ protect_redhcur=curf*float(protectRedH);//default=0.4 rad : one can put more or less if necessary...in 'option' 0.2 ..1.0 ==> curf =because curve is more progressive
+ if(protect_redhcur<0.1f) protect_redhcur=0.1f;//avoid divide by 0 and negatives values
+ if(protect_redhcur>1.0f) protect_redhcur=1.0f;//avoid too big values
+
+ deltaHH=protect_redhcur;//transition hue
+ if(chromaCfactor>1.0) Color::scalered ( rstprotection, chromaCfactor, 0.0, HH, deltaHH, scale, scaleext);//1.0
+ else Color::scalered ( 100.0-rstprotection, chromaCfactor, 0.0, HH, deltaHH, scale, scaleext);
+
+ if(chromaCfactor>1.0) {
+ interm=(chromaCfactor-1.0f)*100.0f; //else interm=(1.0f-chromaCfactor)*100.0f;
+ factorskin= 1.0f+(interm*scale)/100.0f;
+ factorskinext=1.0f+(interm*scaleext)/100.0f;
+ }
+ else {
+ interm=(1.0f-chromaCfactor)*100.0f;
+ factorskin= 1.0f-(interm*scale)/100.0f;
+ factorskinext=1.0f-(interm*scaleext)/100.0f;
+ }
+
+ factorsat=chromaCfactor;
+ factor=factorsat;
+ Color::transitred ( HH, Chprov1, dred, factorskin, protect_redcur, factorskinext, deltaHH, factorsat, factor);
+ atmp *=factor;
+ btmp *= factor;
}
// end chroma C=f(C)
+ if (!bwToning) { //apply curve L=f(C) for skin and rd...but also for extended color ==> near green and blue (see 'curf')
+
+ const float xx=0.25f;//soft : between 0.2 and 0.4
+ float protect_redhcur;
+ float curf=1.0f;
+ float deltaHH;
+ protect_redhcur=curf*float(protectRedH);//default=0.4 rad : one can put more or less if necessary...in 'option' 0.2 ..1
+ if(protect_redhcur<0.1f) protect_redhcur=0.1f;//avoid divide by 0 and negatives values:minimal protection for transition
+ if(protect_redhcur>3.5f) protect_redhcur=3.5f;//avoid too big values
+
+ deltaHH=protect_redhcur;//transition hue
+
+ float skbeg=-0.05f;//begin hue skin
+ float skend=1.60f;//end hue skin
+ const float chrmin=20.0f;//to avoid artefact, because L curve is not a real curve for luminance
+ float aa,bb;
+ float zz=0.0f;
+ float yy=0.0f;
+ if(Chprov1 < chrmin) yy=(Chprov1/chrmin)*(Chprov1/chrmin)*xx;else yy=xx;//avoid artefact for low C
+ if(!LCredsk) {skbeg=-3.1415; skend=3.14159; deltaHH=0.001f;}
+ if(HH>skbeg && HH < skend ) zz=yy;
+ else if(HH>skbeg-deltaHH && HH<=skbeg) {aa=yy/deltaHH;bb=-aa*(skbeg-deltaHH); zz=aa*HH+bb;}//transition
+ else if(HH>=skend && HH < skend+deltaHH) {aa=-yy/deltaHH;bb=-aa*(skend+deltaHH);zz=aa*HH+bb;}//transition
+
+ float chroma=sqrt(SQR(atmp)+SQR(btmp)+0.001f);
+ float Lc = (lhskcurve[chroma*adjustr])/(chroma*adjustr);//apply L=f(C)
+ Lc=(Lc-1.0f)*zz+1.0f;//reduct action
+ Lprov1*=Lc;//adjust luminance
+ }
Chprov1 = sqrt(SQR(atmp/327.68f)+SQR(btmp/327.68f));
-
-/*
- // modulation of a and b curves with saturation
- if (params->labCurve.chromaticity!=0 && !params->labCurve.bwtoning) {
- float chroma = sqrt(SQR(atmp)+SQR(btmp)+0.001);
- float satfactor = (satcurve[chroma+32768.0f]-32768.0f)/chroma;
- atmp *= satfactor;
- btmp *= satfactor;
- }
-*/
-
+
// labCurve.bwtoning option allows to decouple modulation of a & b curves by saturation
// with bwtoning enabled the net effect of a & b curves is visible
if (bwToning) {
@@ -696,7 +735,7 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
Color::Yuv2Lab(Y,u,v,lnew->L[i][j],lnew->a[i][j],lnew->b[i][j], wp);
}
- if (utili || autili || butili || ccutili || chutili || chromaticity) {
+ if (utili || autili || butili || ccutili || cclutili || chutili || chromaticity) {
float correctionHue=0.0f; // Munsell's correction
float correctlum=0.0f;
diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h
index ed902f4f4..d0e3bc8d1 100644
--- a/rtengine/improcfun.h
+++ b/rtengine/improcfun.h
@@ -87,7 +87,8 @@ class ImProcFunctions {
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve,
double expcomp, int hlcompr, int hlcomprthresh);
void luminanceCurve (LabImage* lold, LabImage* lnew, LUTf &curve);
- void chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve/*,LUTf & satbgcurve*/, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili);
+
+ void chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve,LUTf & satclcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili);
void vibrance (LabImage* lab);//Jacques' vibrance
void colorCurve (LabImage* lold, LabImage* lnew);
void sharpening (LabImage* lab, float** buffer);
diff --git a/rtengine/procevents.h b/rtengine/procevents.h
index 412d4b075..b2261f1d3 100644
--- a/rtengine/procevents.h
+++ b/rtengine/procevents.h
@@ -192,7 +192,10 @@ enum ProcEvent {
EvLCCCurve=167,
EvLCHCurve=168,
EvVibranceSkinTonesCurve=169,
- NUMOFEVENTS=170
+ EvLCLCurve=170,
+ EvLLCredsk=171,
+
+ NUMOFEVENTS=172
};
}
#endif
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index 3c89c0e7a..0c26c0076 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -143,6 +143,8 @@ void ProcParams::setDefaults () {
labCurve.contrast = 0;
labCurve.chromaticity = 0;
labCurve.avoidcolorshift = true;
+ labCurve.lcredsk = true;
+
labCurve.rstprotection = 0;
labCurve.bwtoning = false;
labCurve.lcurve.clear ();
@@ -155,8 +157,8 @@ void ProcParams::setDefaults () {
labCurve.cccurve.push_back(DCT_Linear);
labCurve.chcurve.clear ();
labCurve.chcurve.push_back(FCT_Linear);
- //labCurve.cbgcurve.clear ();
- //labCurve.cbgcurve.push_back(DCT_Linear);
+ labCurve.lccurve.clear ();
+ labCurve.lccurve.push_back(DCT_Linear);
rgbCurves.rcurve.clear ();
rgbCurves.rcurve.push_back(DCT_Linear);
@@ -413,6 +415,8 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, ParamsEdited* p
if (!pedited || pedited->labCurve.avoidcolorshift) keyFile.set_boolean ("Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift);
if (!pedited || pedited->labCurve.rstprotection) keyFile.set_double ("Luminance Curve", "SaturationLimit", labCurve.rstprotection);
if (!pedited || pedited->labCurve.bwtoning) keyFile.set_boolean ("Luminance Curve", "BWtoning", labCurve.bwtoning);
+ if (!pedited || pedited->labCurve.lcredsk) keyFile.set_boolean ("Luminance Curve", "LCredsk", labCurve.lcredsk);
+
if (!pedited || pedited->labCurve.lcurve) {
Glib::ArrayHandle lcurve = labCurve.lcurve;
keyFile.set_double_list("Luminance Curve", "LCurve", lcurve);
@@ -433,12 +437,12 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, ParamsEdited* p
Glib::ArrayHandle chcurve = labCurve.chcurve;
keyFile.set_double_list("Luminance Curve", "chCurve", chcurve);
}
-/*
- if (!pedited || pedited->labCurve.cbgcurve) {
- Glib::ArrayHandle cbgcurve = labCurve.cbgcurve;
- keyFile.set_double_list("Luminance Curve", "cbgCurve", cbgcurve);
+
+ if (!pedited || pedited->labCurve.lccurve) {
+ Glib::ArrayHandle lccurve = labCurve.lccurve;
+ keyFile.set_double_list("Luminance Curve", "LcCurve", lccurve);
}
-*/
+
// save sharpening
if (!pedited || pedited->sharpening.enabled) keyFile.set_boolean ("Sharpening", "Enabled", sharpening.enabled);
if (!pedited || pedited->sharpening.method) keyFile.set_string ("Sharpening", "Method", sharpening.method);
@@ -813,14 +817,16 @@ if (keyFile.has_group ("Luminance Curve")) {
if (keyFile.has_key ("Luminance Curve", "AvoidColorShift")) { labCurve.avoidcolorshift = keyFile.get_boolean ("Luminance Curve", "AvoidColorShift"); if (pedited) pedited->labCurve.avoidcolorshift = true; }
if (keyFile.has_key ("Luminance Curve", "RedAndSkinTonesProtection")) { labCurve.rstprotection = keyFile.get_double ("Luminance Curve", "RedAndSkinTonesProtection"); if (pedited) pedited->labCurve.rstprotection = true; }
}
-
+ if (keyFile.has_key ("Luminance Curve", "LCredsk")) { labCurve.lcredsk = keyFile.get_boolean ("Luminance Curve", "LCredsk"); if (pedited) pedited->labCurve.lcredsk = true; }
if (keyFile.has_key ("Luminance Curve", "BWtoning")) { labCurve.bwtoning = keyFile.get_boolean ("Luminance Curve", "BWtoning"); if (pedited) pedited->labCurve.bwtoning = true; }
if (keyFile.has_key ("Luminance Curve", "LCurve")) { labCurve.lcurve = keyFile.get_double_list ("Luminance Curve", "LCurve"); if (pedited) pedited->labCurve.lcurve = true; }
if (keyFile.has_key ("Luminance Curve", "aCurve")) { labCurve.acurve = keyFile.get_double_list ("Luminance Curve", "aCurve"); if (pedited) pedited->labCurve.acurve = true; }
if (keyFile.has_key ("Luminance Curve", "bCurve")) { labCurve.bcurve = keyFile.get_double_list ("Luminance Curve", "bCurve"); if (pedited) pedited->labCurve.bcurve = true; }
if (keyFile.has_key ("Luminance Curve", "ccCurve")) { labCurve.cccurve = keyFile.get_double_list ("Luminance Curve", "ccCurve"); if (pedited) pedited->labCurve.cccurve = true; }
if (keyFile.has_key ("Luminance Curve", "chCurve")) { labCurve.chcurve = keyFile.get_double_list ("Luminance Curve", "chCurve"); if (pedited) pedited->labCurve.chcurve = true; }
-}
+ if (keyFile.has_key ("Luminance Curve", "LcCurve")) { labCurve.lccurve = keyFile.get_double_list ("Luminance Curve", "LcCurve"); if (pedited) pedited->labCurve.lccurve = true; }
+
+ }
// load sharpening
if (keyFile.has_group ("Sharpening")) {
@@ -1231,13 +1237,14 @@ bool ProcParams::operator== (const ProcParams& other) {
&& labCurve.bcurve == other.labCurve.bcurve
&& labCurve.cccurve == other.labCurve.cccurve
&& labCurve.chcurve == other.labCurve.chcurve
-// && labCurve.cbgcurve == other.labCurve.cbgcurve
+ && labCurve.lccurve == other.labCurve.lccurve
&& labCurve.brightness == other.labCurve.brightness
&& labCurve.contrast == other.labCurve.contrast
&& labCurve.chromaticity == other.labCurve.chromaticity
&& labCurve.avoidcolorshift == other.labCurve.avoidcolorshift
&& labCurve.rstprotection == other.labCurve.rstprotection
&& labCurve.bwtoning == other.labCurve.bwtoning
+ && labCurve.lcredsk == other.labCurve.lcredsk
&& sharpenEdge.enabled == other.sharpenEdge.enabled
&& sharpenEdge.passes == other.sharpenEdge.passes
&& sharpenEdge.amount == other.sharpenEdge.amount
diff --git a/rtengine/procparams.h b/rtengine/procparams.h
index f8c16a9b3..ac2e553d4 100644
--- a/rtengine/procparams.h
+++ b/rtengine/procparams.h
@@ -204,13 +204,14 @@ class LCurveParams {
std::vector bcurve;
std::vector cccurve;
std::vector chcurve;
- //std::vector cbgcurve;
+ std::vector lccurve;
int brightness;
int contrast;
int chromaticity;
bool avoidcolorshift;
double rstprotection;
bool bwtoning;
+ bool lcredsk;
};
/**
diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc
index 22301a6c2..f4b74a64a 100644
--- a/rtengine/refreshmap.cc
+++ b/rtengine/refreshmap.cc
@@ -188,7 +188,9 @@ RGBCURVE, // EvRGBbCurve
RGBCURVE, // EvNeutralExp
LUMINANCECURVE, // EvLBWtoning
LUMINANCECURVE, // EvLCCurve
-LUMINANCECURVE, // EvLCHGurve
-RGBCURVE // EvCCCurve
+LUMINANCECURVE, // EvLCHurve
+RGBCURVE, //
+LUMINANCECURVE, // EvCLCCurve
+LUMINANCECURVE // EvCLLcredsk
};
diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc
index d16aca20f..02d4d5fac 100644
--- a/rtengine/rtthumbnail.cc
+++ b/rtengine/rtthumbnail.cc
@@ -731,7 +731,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
LUTf curve2 (65536);
LUTf curve (65536);
LUTf satcurve (65536);
- LUTf satbgcurve (65536);
+ LUTf lhskcurve (65536);
LUTf rCurve (65536);
LUTf gCurve (65536);
@@ -768,13 +768,13 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
bool autili=false;
bool butili=false;
bool ccutili=false;
-
+ bool cclutili=false;
CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve,
hist16, hist16, curve, dummy, 16, utili);
- CurveFactory::complexsgnCurve (autili, butili, ccutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
- params.labCurve.acurve, params.labCurve.bcurve,params.labCurve.cccurve/*,params.labCurve.cbgcurve*/, curve1, curve2, satcurve,/*satbgcurve,*/ 16);
+ CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
+ params.labCurve.acurve, params.labCurve.bcurve,params.labCurve.cccurve,params.labCurve.lccurve, curve1, curve2, satcurve,lhskcurve, 16);
//ipf.luminanceCurve (labView, labView, curve);
- ipf.chromiLuminanceCurve (labView, labView, curve1, curve2, satcurve,/*satbgcurve,*/ curve, utili, autili, butili, ccutili);
+ ipf.chromiLuminanceCurve (labView, labView, curve1, curve2, satcurve,lhskcurve, curve, utili, autili, butili, ccutili,cclutili);
ipf.vibrance(labView);
// color processing
diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc
index 693e7f046..85feb41b6 100644
--- a/rtengine/simpleprocess.cc
+++ b/rtengine/simpleprocess.cc
@@ -155,7 +155,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
LUTf curve2 (65536,0);
LUTf curve (65536,0);
LUTf satcurve (65536,0);
- //LUTf satbgcurve (65536,0);
+ LUTf lhskcurve (65536,0);
LUTf rCurve (65536,0);
LUTf gCurve (65536,0);
@@ -198,13 +198,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
bool autili=false;
bool butili=false;
bool ccutili=false;
-
+ bool cclutili=false;
CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, hist16, curve, dummy, 1, utili);
- CurveFactory::complexsgnCurve (autili, butili, ccutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
- params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve,/*params.labCurve.cbgcurve,*/curve1, curve2, satcurve,/*satbgcurve,*/ 1);
+ CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
+ params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve,params.labCurve.lccurve,curve1, curve2, satcurve,lhskcurve, 1);
//ipf.luminanceCurve (labView, labView, curve);
- ipf.chromiLuminanceCurve (labView, labView, curve1, curve2, satcurve,/*satbgcurve,*/curve, utili, autili, butili, ccutili);
+ ipf.chromiLuminanceCurve (labView, labView, curve1, curve2, satcurve,lhskcurve,curve, utili, autili, butili, ccutili,cclutili);
ipf.vibrance(labView);
ipf.impulsedenoise (labView);
diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc
index 68286bf2d..f1d725b1e 100644
--- a/rtgui/labcurve.cc
+++ b/rtgui/labcurve.cc
@@ -26,6 +26,13 @@ using namespace rtengine::procparams;
LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
std::vector bottomMilestones;
+ std::vector milestones;
+ float R, G, B;
+ // -0.1 rad < Hue < 1.6 rad
+ Color::hsv2rgb01(0.92f, 0.45f, 0.6f, R, G, B);
+ milestones.push_back( GradientMilestone(0.0, double(R), double(G), double(B)) );
+ Color::hsv2rgb01(0.14056f, 0.45f, 0.6f, R, G, B);
+ milestones.push_back( GradientMilestone(1.0, double(R), double(G), double(B)) );
brightness = Gtk::manage (new Adjuster (M("TP_LABCURVE_BRIGHTNESS"), -100., 100., 1., 0.));
contrast = Gtk::manage (new Adjuster (M("TP_LABCURVE_CONTRAST"), -100., 100., 1., 0.));
@@ -54,14 +61,22 @@ LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
avoidcolorshift = Gtk::manage (new Gtk::CheckButton (M("TP_LABCURVE_AVOIDCOLORSHIFT")));
avoidcolorshift->set_tooltip_text (M("TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP"));
pack_start (*avoidcolorshift, Gtk::PACK_SHRINK, 4);
+
+ lcredsk = Gtk::manage (new Gtk::CheckButton (M("TP_LABCURVE_LCREDSK")));
+ lcredsk->set_tooltip_markup (M("TP_LABCURVE_LCREDSK_TIP"));
+ pack_start (*lcredsk);
rstprotection = Gtk::manage ( new Adjuster (M("TP_LABCURVE_RSTPROTECTION"), 0., 100., 0.1, 0.) );
pack_start (*rstprotection);
rstprotection->show ();
rstprotection->setAdjusterListener (this);
+ rstprotection->set_tooltip_text (M("TP_LABCURVE_RSTPRO_TOOLTIP"));
+
bwtconn= bwtoning->signal_toggled().connect( sigc::mem_fun(*this, &LCurve::bwtoning_toggled) );
acconn = avoidcolorshift->signal_toggled().connect( sigc::mem_fun(*this, &LCurve::avoidcolorshift_toggled) );
+ lcconn = lcredsk->signal_toggled().connect( sigc::mem_fun(*this, &LCurve::lcredsk_toggled) );
+
//%%%%%%%%%%%%%%%%%%%
Gtk::HSeparator *hsep3 = Gtk::manage (new Gtk::HSeparator());
@@ -78,8 +93,7 @@ LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
M("TP_LABCURVE_CURVEEDITOR_CC_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE4")
);
ccshape->setRangeDefaultMilestones(0.05, 0.2, 0.58);
- //cbgshape = static_cast(curveEditorG->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CBG"));
- //cbgshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CBG_TOOLTIP"));
+
// -0.1 rad < Hue < 1.6 rad
for (int i=0; i<7; i++) {
float R, G, B;
@@ -91,7 +105,20 @@ LCurve::LCurve () : Gtk::VBox(), FoldableToolPanel(this) {
chshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP"));
chshape->setBottomBarBgGradient(bottomMilestones);
chshape->setCurveColorProvider(this);
-
+
+ lcshape = static_cast(curveEditorG->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CCL")));
+ lcshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CCL_TOOLTIP"));
+ //lcshape->setBottomBarBgGradient(milestones);
+ bottomMilestones.clear();
+ bottomMilestones.push_back( GradientMilestone(0., 0., 0., 0.) );
+ bottomMilestones.push_back( GradientMilestone(1., 1., 1., 1.) );
+
+ lcshape->setLeftBarBgGradient(bottomMilestones);
+ lcshape->setRangeLabels(
+ M("TP_LABCURVE_CURVEEDITOR_CC_RANGE1"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE2"),
+ M("TP_LABCURVE_CURVEEDITOR_CC_RANGE3"), M("TP_LABCURVE_CURVEEDITOR_CC_RANGE4")
+ );
+ lcshape->setRangeDefaultMilestones(0.15, 0.3, 0.6);
curveEditorG->newLine();
bottomMilestones.clear();
@@ -125,6 +152,8 @@ LCurve::~LCurve () {
void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
disableListener ();
+ // if(!pp->labCurve.cccurve.empty()) printf("plein"); else printf("vide");
+ // if(pp->labCurve.cccurve[0] !=0) printf(" pp %i\n,pp->labCurve.cccurve[0] ");
if (pedited) {
brightness->setEditedState (pedited->labCurve.brightness ? Edited : UnEdited);
@@ -135,6 +164,8 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
rstprotection->setEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited);
bwtoning->set_inconsistent (!pedited->labCurve.bwtoning);
avoidcolorshift->set_inconsistent (!pedited->labCurve.avoidcolorshift);
+ lcredsk->set_inconsistent (!pedited->labCurve.lcredsk);
+
//%%%%%%%%%%%%%%%%%%%%%%
lshape->setUnChanged (!pedited->labCurve.lcurve);
@@ -142,15 +173,17 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
bshape->setUnChanged (!pedited->labCurve.bcurve);
ccshape->setUnChanged (!pedited->labCurve.cccurve);
chshape->setUnChanged (!pedited->labCurve.chcurve);
- //cbgshape->setUnChanged (!pedited->labCurve.cbgcurve);
+ lcshape->setUnChanged (!pedited->labCurve.lccurve);
}
else {
//if bwtoning is enabled, chromaticity value, avoid color shift and rstprotection has no effect
//ccshape->set_sensitive(!(!pp->labCurve.bwtoning));
//chshape->set_sensitive(!(!pp->labCurve.bwtoning));
chromaticity->set_sensitive(!pp->labCurve.bwtoning);
- rstprotection->set_sensitive( !pp->labCurve.bwtoning && pp->labCurve.chromaticity!=0 );
+ rstprotection->set_sensitive( !pp->labCurve.bwtoning /*&& pp->labCurve.chromaticity!=0*/ );//no reason for grey rstprotection
avoidcolorshift->set_sensitive(!pp->labCurve.bwtoning);
+ lcredsk->set_sensitive(!pp->labCurve.bwtoning);
+
}
brightness->setValue (pp->labCurve.brightness);
@@ -162,13 +195,18 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
bwtconn.block (true);
acconn.block (true);
+ lcconn.block (true);
bwtoning->set_active (pp->labCurve.bwtoning);
avoidcolorshift->set_active (pp->labCurve.avoidcolorshift);
+ lcredsk->set_active (pp->labCurve.lcredsk);
+
bwtconn.block (false);
acconn.block (false);
-
+ lcconn.block (false);
+
lastBWTVal = pp->labCurve.bwtoning;
lastACVal = pp->labCurve.avoidcolorshift;
+ lastLCVal = pp->labCurve.lcredsk;
//%%%%%%%%%%%%%%%%%%%%%%
lshape->setCurve (pp->labCurve.lcurve);
@@ -176,7 +214,7 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
bshape->setCurve (pp->labCurve.bcurve);
ccshape->setCurve (pp->labCurve.cccurve);
chshape->setCurve (pp->labCurve.chcurve);
- //cbgshape->setCurve (pp->labCurve.cbgcurve);
+ lcshape->setCurve (pp->labCurve.lccurve);
// Open up the first curve if selected
bool active = lshape->openIfNonlinear();
@@ -184,6 +222,7 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) {
if (!active) bshape->openIfNonlinear();
if (!active) ccshape->openIfNonlinear();
if (!active) chshape->openIfNonlinear();
+ if (!active) lcshape->openIfNonlinear();
queue_draw();
@@ -199,6 +238,8 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) {
//%%%%%%%%%%%%%%%%%%%%%%
pp->labCurve.bwtoning = bwtoning->get_active ();
pp->labCurve.avoidcolorshift = avoidcolorshift->get_active ();
+ pp->labCurve.lcredsk = lcredsk->get_active ();
+
pp->labCurve.rstprotection = rstprotection->getValue ();
//%%%%%%%%%%%%%%%%%%%%%%
@@ -207,7 +248,7 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pp->labCurve.bcurve = bshape->getCurve ();
pp->labCurve.cccurve = ccshape->getCurve ();
pp->labCurve.chcurve = chshape->getCurve ();
- //pp->labCurve.cbgcurve = cbgshape->getCurve ();
+ pp->labCurve.lccurve = lcshape->getCurve ();
if (pedited) {
pedited->labCurve.brightness = brightness->getEditedState ();
@@ -217,6 +258,8 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) {
//%%%%%%%%%%%%%%%%%%%%%%
pedited->labCurve.bwtoning = !bwtoning->get_inconsistent();
pedited->labCurve.avoidcolorshift = !avoidcolorshift->get_inconsistent();
+ pedited->labCurve.lcredsk = !lcredsk->get_inconsistent();
+
pedited->labCurve.rstprotection = rstprotection->getEditedState ();
//%%%%%%%%%%%%%%%%%%%%%%
@@ -225,7 +268,7 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->labCurve.bcurve = !bshape->isUnChanged ();
pedited->labCurve.cccurve = !ccshape->isUnChanged ();
pedited->labCurve.chcurve = !chshape->isUnChanged ();
- //pedited->labCurve.cbgcurve = !bshape->isUnChanged ();
+ pedited->labCurve.lccurve = !bshape->isUnChanged ();
}
}
@@ -276,6 +319,30 @@ void LCurve::avoidcolorshift_toggled () {
}
}
+void LCurve::lcredsk_toggled () {
+
+ if (batchMode) {
+ if (lcredsk->get_inconsistent()) {
+ lcredsk->set_inconsistent (false);
+ lcconn.block (true);
+ lcredsk->set_active (false);
+ lcconn.block (false);
+ }
+ else if (lastLCVal)
+ lcredsk->set_inconsistent (true);
+
+ lastLCVal = lcredsk->get_active ();
+ }
+
+ if (listener) {
+ if (lcredsk->get_active ())
+ listener->panelChanged (EvLLCredsk, M("GENERAL_ENABLED"));
+ else
+ listener->panelChanged (EvLLCredsk, M("GENERAL_DISABLED"));
+ }
+}
+
+
//%%%%%%%%%%%%%%%%%%%%%%
//BW toning control changed
void LCurve::bwtoning_toggled () {
@@ -296,8 +363,10 @@ void LCurve::bwtoning_toggled () {
//ccshape->set_sensitive(!(!pp->labCurve.bwtoning));
//chshape->set_sensitive(!(!pp->labCurve.bwtoning));
chromaticity->set_sensitive( !(bwtoning->get_active ()) );
- rstprotection->set_sensitive( !(bwtoning->get_active ()) && chromaticity->getIntValue()!=0 );
+ rstprotection->set_sensitive( !(bwtoning->get_active ()) /*&& chromaticity->getIntValue()!=0*/);
avoidcolorshift->set_sensitive( !(bwtoning->get_active ()) );
+ lcredsk->set_sensitive( !(bwtoning->get_active ()) );
+
}
if (listener) {
@@ -326,11 +395,11 @@ void LCurve::curveChanged (CurveEditor* ce) {
if (ce == bshape)
listener->panelChanged (EvLbCurve, M("HISTORY_CUSTOMCURVE"));
if (ce == ccshape)
- listener->panelChanged (EvLCCCurve, M("HISTORY_CUSTOMCURVE"));
+ listener->panelChanged (EvLCCCurve, M("HISTORY_CUSTOMCURVE"));
if (ce == chshape)
listener->panelChanged (EvLCHCurve, M("HISTORY_CUSTOMCURVE"));
- //if (ce == cbgshape)
- // listener->panelChanged (EvLCBGCurve, M("HISTORY_CUSTOMCURVE"));
+ if (ce == lcshape)
+ listener->panelChanged (EvLCLCurve, M("HISTORY_CUSTOMCURVE"));
}
}
@@ -353,7 +422,7 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) {
listener->panelChanged (EvLContrast, costr);
else if (a==chromaticity) {
if (!batchMode) {
- rstprotection->set_sensitive( !(bwtoning->get_active ()) && chromaticity->getIntValue()!=0 );
+ rstprotection->set_sensitive( !(bwtoning->get_active ())/* && chromaticity->getIntValue()!=0*/ );
}
listener->panelChanged (EvLSaturation, costr);
}
diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h
index d82d7a1f0..bae147649 100644
--- a/rtgui/labcurve.h
+++ b/rtgui/labcurve.h
@@ -37,15 +37,18 @@ class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPan
DiagonalCurveEditor* ashape;
DiagonalCurveEditor* bshape;
DiagonalCurveEditor* ccshape;
- //DiagonalCurveEditor* cbgshape;
+ DiagonalCurveEditor* lcshape;
FlatCurveEditor* chshape;
//%%%%%%%%%%%%%%%%
Gtk::CheckButton* avoidcolorshift;
Gtk::CheckButton* bwtoning;
+ Gtk::CheckButton* lcredsk;
+
Adjuster* rstprotection;
- sigc::connection bwtconn, acconn;
- bool lastBWTVal, lastACVal;
+ sigc::connection bwtconn, acconn, lcconn;
+ bool lastBWTVal, lastACVal, lastLCVal;
+
//%%%%%%%%%%%%%%%%
public:
@@ -64,6 +67,8 @@ class LCurve : public Gtk::VBox, public AdjusterListener, public FoldableToolPan
void adjusterChanged (Adjuster* a, double newval);
void avoidcolorshift_toggled ();
void bwtoning_toggled();
+ void lcredsk_toggled();
+
void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma);
virtual void colorForValue (double valX, double valY);
diff --git a/rtgui/options.cc b/rtgui/options.cc
index 778674e2e..f72b6d360 100644
--- a/rtgui/options.cc
+++ b/rtgui/options.cc
@@ -427,7 +427,7 @@ void Options::setDefaults () {
rtSettings.gamutICC = true;
rtSettings.gamutLch = true;
rtSettings.protectred = 60;
- rtSettings.protectredh = 0.4;
+ rtSettings.protectredh = 0.3;
lastIccDir = rtSettings.iccDirectory;
lastDarkframeDir = rtSettings.darkFramesPath;
diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc
index da5a2dc77..18f6c3c4c 100644
--- a/rtgui/paramsedited.cc
+++ b/rtgui/paramsedited.cc
@@ -48,13 +48,14 @@ void ParamsEdited::set (bool v) {
labCurve.bcurve = v;
labCurve.cccurve = v;
labCurve.chcurve = v;
- //labCurve.cbgcurve = v;
+ labCurve.lccurve = v;
labCurve.brightness = v;
labCurve.contrast = v;
labCurve.chromaticity = v;
labCurve.avoidcolorshift = v;
labCurve.rstprotection = v;
labCurve.bwtoning = v;
+ labCurve.lcredsk = v;
rgbCurves.rcurve = v;
rgbCurves.gcurve = v;
rgbCurves.bcurve = v;
@@ -226,7 +227,7 @@ void ParamsEdited::initFrom (const std::vector
return;
const ProcParams& p = src[0];
- for (size_t i=1; i
labCurve.bcurve = labCurve.bcurve && p.labCurve.bcurve == other.labCurve.bcurve;
labCurve.cccurve = labCurve.cccurve && p.labCurve.cccurve == other.labCurve.cccurve;
labCurve.chcurve = labCurve.chcurve && p.labCurve.chcurve == other.labCurve.chcurve;
- //labCurve.cbgcurve = labCurve.cbgcurve && p.labCurve.cbgcurve == other.labCurve.cbgcurve;
+ labCurve.lccurve = labCurve.lccurve && p.labCurve.lccurve == other.labCurve.lccurve;
labCurve.brightness = labCurve.brightness && p.labCurve.brightness == other.labCurve.brightness;
labCurve.contrast = labCurve.contrast && p.labCurve.contrast == other.labCurve.contrast;
labCurve.chromaticity = labCurve.chromaticity && p.labCurve.chromaticity == other.labCurve.chromaticity;
labCurve.avoidcolorshift = labCurve.avoidcolorshift && p.labCurve.avoidcolorshift == other.labCurve.avoidcolorshift;
labCurve.rstprotection = labCurve.rstprotection && p.labCurve.rstprotection == other.labCurve.rstprotection;
labCurve.bwtoning = labCurve.bwtoning && p.labCurve.bwtoning == other.labCurve.bwtoning;
+ labCurve.lcredsk = labCurve.lcredsk && p.labCurve.lcredsk == other.labCurve.lcredsk;
rgbCurves.rcurve = rgbCurves.rcurve && p.rgbCurves.rcurve == other.rgbCurves.rcurve;
rgbCurves.gcurve = rgbCurves.gcurve && p.rgbCurves.gcurve == other.rgbCurves.gcurve;
rgbCurves.bcurve = rgbCurves.bcurve && p.rgbCurves.bcurve == other.rgbCurves.bcurve;
@@ -439,13 +441,14 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (labCurve.bcurve) toEdit.labCurve.bcurve = mods.labCurve.bcurve;
if (labCurve.cccurve) toEdit.labCurve.cccurve = mods.labCurve.cccurve;
if (labCurve.chcurve) toEdit.labCurve.chcurve = mods.labCurve.chcurve;
- //if (labCurve.cbgcurve) toEdit.labCurve.cbgcurve = mods.labCurve.cbgcurve;
+ if (labCurve.lccurve) toEdit.labCurve.lccurve = mods.labCurve.lccurve;
if (labCurve.brightness) toEdit.labCurve.brightness = dontforceSet && options.baBehav[ADDSET_LC_BRIGHTNESS] ? toEdit.labCurve.brightness + mods.labCurve.brightness : mods.labCurve.brightness;
if (labCurve.contrast) toEdit.labCurve.contrast = dontforceSet && options.baBehav[ADDSET_LC_CONTRAST] ? toEdit.labCurve.contrast + mods.labCurve.contrast : mods.labCurve.contrast;
if (labCurve.chromaticity) toEdit.labCurve.chromaticity = dontforceSet && options.baBehav[ADDSET_LC_CHROMATICITY] ? toEdit.labCurve.chromaticity + mods.labCurve.chromaticity : mods.labCurve.chromaticity;
if (labCurve.avoidcolorshift) toEdit.labCurve.avoidcolorshift = mods.labCurve.avoidcolorshift;
if (labCurve.rstprotection) toEdit.labCurve.rstprotection = mods.labCurve.rstprotection;
if (labCurve.bwtoning) toEdit.labCurve.bwtoning = mods.labCurve.bwtoning;
+ if (labCurve.lcredsk) toEdit.labCurve.lcredsk = mods.labCurve.lcredsk;
if (rgbCurves.rcurve) toEdit.rgbCurves.rcurve = mods.rgbCurves.rcurve;
if (rgbCurves.gcurve) toEdit.rgbCurves.gcurve = mods.rgbCurves.gcurve;
diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h
index a210507e2..32d4e6dd4 100644
--- a/rtgui/paramsedited.h
+++ b/rtgui/paramsedited.h
@@ -60,9 +60,10 @@ class LCurveParamsEdited {
bool acurve;
bool bcurve;
bool bwtoning;
+ bool lcredsk;
bool cccurve;
bool chcurve;
- //bool cbgcurve;
+ bool lccurve;
};
class RGBCurvesParamsEdited {