diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais
index ddc27b719..8f4a87ad9 100644
--- a/rtdata/languages/Francais
+++ b/rtdata/languages/Francais
@@ -917,9 +917,11 @@ TP_COLORAPP_CONTRAST_Q_TOOLTIP;Contraste dans CIECAM02 pour le curseur (Q); est
TP_COLORAPP_CONTRAST_TOOLTIP;Contraste dans CIECAM02 pour le curseur (J); est différent du contraste Lab et RVB
TP_COLORAPP_DEGREE_TOOLTIP;Niveau d'adaptation chromatique CIE CAT 2002\nSi vous sélectionnez " Automatic ", RT essaiera de trouver la meilleure valeur
TP_COLORAPP_EQUAL;Préservé
+TP_COLORAPP_TONECIE;Compression tonale avec brillance Q CIECAM
+TP_COLORAPP_TONECIE_TOOLTIP;Si vous choisissez cette option, tous les réglages "compression tonale" (si activé) seront utilisés par CIECAM
TP_COLORAPP_DATACIE;Montre les données de sortie CIECAM dans les courbes histogrammes
TP_COLORAPP_DATACIE_TOOLTIP;Quand activé, les courbes dans les histogrammes montrent des valeurs/amplitudes approximatives de J/Q, ou de C:s/M après les ajustements CIECAM.\n Cette sélection n'a aps d'incidence sur le panneau histogramme général.\n\n Quand désactivé, les histogrammes dans les courbes CIECAM affichent les valeurs Lab avant les ajustements CIECAM
-TP_COLORAPP_GAMUT;Contrôle du gamut (Lab & CIECAM)
+TP_COLORAPP_GAMUT;Contrôle du gamut (Lab)
TP_COLORAPP_GAMUT_TOOLTIP;Permet le controle du gamut en mode Lab
TP_COLORAPP_HUE;Teinte (h)
TP_COLORAPP_HUE_TOOLTIP;Teinte (h) - angle entre 0° et 360°
@@ -998,9 +1000,10 @@ TP_DISTORTION_AUTO;Correction auto de la distorsion
TP_DISTORTION_AUTO_TIP;(Experimental) Corrige la distorsion de l'objectif automatiquement pour certains APN (M4/3, quelques compacts, etc.)
TP_DISTORTION_LABEL;Distorsion
TP_EPD_EDGESTOPPING;Arrêt des bords
-TP_EPD_LABEL;Compression tonale
+TP_EPD_LABEL;Compression tonale [Lab] ou [CIECAM02]
TP_EPD_REWEIGHTINGITERATES;Itérations de la pondération
TP_EPD_SCALE;Échelle
+TP_EPD_TOOLTIP;Vous pouvez choisir entre le mode Lab (standard) ou le mode CIECAM02.\n En activant "Compression tonale avec brillance Q CIECAM" dans le menu "Brillance + Niveau de couleur CIECAM"
TP_EPD_STRENGTH;Force
TP_EQUALIZER_CONTRAST_MINUS;Contraste-
TP_EQUALIZER_CONTRAST_PLUS;Contraste+
diff --git a/rtdata/languages/default b/rtdata/languages/default
index ba056a9cc..4b0aa2920 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -398,7 +398,7 @@ HISTORY_MSG_170;Vibrance - Curve
HISTORY_MSG_171;'LC' curve
HISTORY_MSG_172;Restrict LC to red and skin tones
HISTORY_MSG_173;NR - Luminance Detail
-HISTORY_MSG_174;Color Appearance Modele 2002
+HISTORY_MSG_174;CIECAM02
HISTORY_MSG_175;CAM02 - Chrom. adaptation amount
HISTORY_MSG_176;CAM02 - Viewing's black surround
HISTORY_MSG_177;CAM02 - Scene's Lum. Adaptation
@@ -423,6 +423,8 @@ HISTORY_MSG_195;CAM02 - Tone curve
HISTORY_MSG_196;CAM02 - Tone curve 2
HISTORY_MSG_197;CAM02 - Color curve
HISTORY_MSG_198;CAM02 - Color curve
+HISTORY_MSG_199;CAM02 - Show CIECAM in histograms
+HISTORY_MSG_200;CAM02 - Tone mapping with Q
HISTORY_NEWSNAPSHOTAS;As...
HISTORY_NEWSNAPSHOT;Add
HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s
@@ -916,9 +918,11 @@ TP_COLORAPP_CONTRAST_Q_TOOLTIP;Contrast in CIECAM02 for the Q slider; is differe
TP_COLORAPP_CONTRAST_TOOLTIP;Contrast in CIECAM02 for the J slider; is different from Lab and RGB
TP_COLORAPP_DEGREE_TOOLTIP;Amount of CIE Chromatic Adaptation Transform 2002\nIf you check the " Automatic " box, RT will try to find the best value
TP_COLORAPP_EQUAL;Equal
+TP_COLORAPP_TONECIE;Tone-mapping with Q brightness CIECAM
+TP_COLORAPP_TONECIE_TOOLTIP;Additional tone mapping adjustments are controlled in Tone Mapping section and must be enabled for tone mapping to engage.\n With this option enabled CIECAM adjustments to Lightness (J), Chroma (C) and Saturation (S) will not be applied.
TP_COLORAPP_DATACIE;Show CIECAM output histograms in curves
TP_COLORAPP_DATACIE_TOOLTIP;When enabled, histograms in CIECAM curves show approximate values/ranges for J or Q, and C or s or M after the CIECAM adjustments.\n This selection does not impact the main histogram panel.\n\n When disabled, histograms in CIECAM curves show Lab values, that are before CIECAM adjustments
-TP_COLORAPP_GAMUT;Gamut control (Lab & CIECAM)
+TP_COLORAPP_GAMUT;Gamut control (Lab)
TP_COLORAPP_GAMUT_TOOLTIP;Allow gamut control in Lab mode
TP_COLORAPP_HUE;Hue (h)
TP_COLORAPP_HUE_TOOLTIP;Hue (h) - angle between 0° and 360°
@@ -997,9 +1001,10 @@ TP_DISTORTION_AUTO;Auto Distortion Correction
TP_DISTORTION_AUTO_TIP;(Exprimental) Correct lens distortion automatically for some cameras (Micro 4/3, some compact digital cameras, etc.)
TP_DISTORTION_LABEL;Distortion
TP_EPD_EDGESTOPPING;Edge Stopping
-TP_EPD_LABEL;Tone Mapping
+TP_EPD_LABEL;Tone Mapping [Lab] or [CIECAM02]
TP_EPD_REWEIGHTINGITERATES;Reweighting Iterates
TP_EPD_SCALE;Scale
+TP_EPD_TOOLTIP;Tone mapping is possible via Lab (standard) mode or CIECAM02 mode.\n\n To engage CIECAM02 Tone mapping mode enable the following settings: \n 1. CIECAM\n 2. Algorithm="Brightness + Colorfullness (QM)"\n 3. "Tone-mapping with Q brightness CIECAM"
TP_EPD_STRENGTH;Strength
TP_EXPOSCORR_LABEL;Raw White & Black Points
TP_EXPOSURE_AUTOLEVELS;Auto Levels
diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt
index a58894da7..c7f33db92 100644
--- a/rtengine/CMakeLists.txt
+++ b/rtengine/CMakeLists.txt
@@ -9,7 +9,7 @@ set (RTENGINESOURCEFILES safegtk.cc colortemp.cc curves.cc flatcurves.cc diagona
dfmanager.cc ffmanager.cc rawimage.cc image8.cc image16.cc imagefloat.cc imagedata.cc imageio.cc improcfun.cc init.cc dcrop.cc
loadinitial.cc procparams.cc rawimagesource.cc demosaic_algos.cc shmap.cc simpleprocess.cc refreshmap.cc
stdimagesource.cc myfile.cc iccjpeg.cc hlmultipliers.cc improccoordinator.cc
- processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc
+ processingjob.cc rtthumbnail.cc utils.cc labimage.cc slicer.cc cieimage.cc
iplab2rgb.cc ipsharpen.cc iptransform.cc ipresize.cc ipvibrance.cc
jpeg_memsrc.cc jdatasrc.cc
EdgePreserveLab.cc EdgePreservingDecomposition.cc cplx_wavelet_dec.cc FTblockDN.cc
diff --git a/rtengine/EdgePreservingDecomposition.cc b/rtengine/EdgePreservingDecomposition.cc
index 5a69daac1..ac518c568 100644
--- a/rtengine/EdgePreservingDecomposition.cc
+++ b/rtengine/EdgePreservingDecomposition.cc
@@ -448,13 +448,12 @@ float *EdgePreservingDecomposition::CompressDynamicRange(float *Source, float Sc
if(Compressed == NULL) Compressed = u;
//Apply compression, detail boost, unlogging. Compression is done on the logged data and detail boost on unlogged.
- for(i = 0; i != n; i++){
+ for(int i = 0; i != n; i++){
float ce = expf(Source[i] + u[i]*(CompressionExponent - 1.0f)) - eps;
float ue = expf(u[i]) - eps;
Source[i] = expf(Source[i]) - eps;
Compressed[i] = ce + DetailBoost*(Source[i] - ue);
}
-
if(Compressed != u) delete[] u;
return Compressed;
}
diff --git a/rtengine/cieimage.cc b/rtengine/cieimage.cc
new file mode 100644
index 000000000..ee6b91e53
--- /dev/null
+++ b/rtengine/cieimage.cc
@@ -0,0 +1,53 @@
+#include "cieimage.h"
+#include
+namespace rtengine {
+
+CieImage::CieImage (int w, int h) : fromImage(false), W(w), H(h) {
+ J_p = new float*[H];
+ Q_p = new float*[H];
+ M_p = new float*[H];
+ C_p = new float*[H];
+ // s_p = new float*[H];
+ h_p = new float*[H];
+
+ data = new float [W*H*5];
+ float * index = data;
+ for (int i=0; idata, W*H*5*sizeof(float));
+}
+
+}
diff --git a/rtengine/cieimage.h b/rtengine/cieimage.h
new file mode 100644
index 000000000..ee9534451
--- /dev/null
+++ b/rtengine/cieimage.h
@@ -0,0 +1,48 @@
+/*
+ * This file is part of RawTherapee.
+ *
+ * Copyright (c) 2004-2010 Gabor Horvath
+ *
+ * RawTherapee is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * RawTherapee is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with RawTherapee. If not, see .
+ */
+#ifndef _CIEIMAGE_H_
+#define _CIEIMAGE_H_
+
+#include "image16.h"
+
+namespace rtengine {
+
+class CieImage {
+private:
+ bool fromImage;
+
+public:
+ int W, H;
+ float * data;
+ float** J_p;
+ float** Q_p;
+ float** M_p;
+ float** C_p;
+ //float** s_p;
+ float** h_p;
+
+ CieImage (int w, int h);
+ ~CieImage ();
+
+ //Copies image data in Img into this instance.
+ void CopyFrom(CieImage *Img);
+};
+
+}
+#endif
diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc
index 510ba86ab..2bdf6816d 100644
--- a/rtengine/colortemp.cc
+++ b/rtengine/colortemp.cc
@@ -1652,7 +1652,7 @@ void ColorTemp::xyz2jchqms_ciecam02( double &J, double &C, double &h, double &Q,
double cz;
double myh, myj, myc, myq, mym, mys;
double pfl;
-
+ gamu=1;
xyz_to_cat02( r, g, b, x, y, z, gamu );
xyz_to_cat02( rw, gw, bw, xw, yw, zw, gamu );
@@ -1743,7 +1743,7 @@ void ColorTemp::jch2xyz_ciecam02( double &x, double &y, double &z, double J, dou
double aw;
double e, t;
double cz;
-
+ gamu=1;
ColorTemp::xyz_to_cat02( rw, gw, bw, xw, yw, zw, gamu );
if(doneinit2){
n = yb / yw;
diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h
index 5dc5b758e..3373dd0ae 100644
--- a/rtengine/colortemp.h
+++ b/rtengine/colortemp.h
@@ -83,7 +83,7 @@ class ColorTemp {
double rc, gc, bc;
double rp, gp, bp;
double rpa, gpa, bpa;
-
+ gamu=1;
xyz_to_cat02( r, g, b, x, y, z, gamu );
rc = r * (((y * d) / r) + (1.0 - d));
@@ -247,6 +247,7 @@ class ColorTemp {
};
inline void ColorTemp::xyz_to_cat02( double &r, double &g, double &b, double x, double y, double z, int gamu )
{
+gamu=1;
if(gamu==0){
r = ( 0.7328 * x) + (0.4296 * y) - (0.1624 * z);
g = (-0.7036 * x) + (1.6975 * y) + (0.0061 * z);
@@ -265,6 +266,7 @@ else if (gamu==1) {//gamut correction M.H.Brill S.Susstrunk
inline void ColorTemp::cat02_to_xyz( double &x, double &y, double &z, double r, double g, double b, int gamu )
{
+gamu=1;
if(gamu==0) {
x = ( 1.096124 * r) - (0.278869 * g) + (0.182745 * b);
y = ( 0.454369 * r) + (0.473533 * g) + (0.072098 * b);
@@ -293,7 +295,8 @@ inline void ColorTemp::hpe_to_xyz( double &x, double &y, double &z, double r, do
inline void ColorTemp::cat02_to_hpe( double &rh, double &gh, double &bh, double r, double g, double b, int gamu )
-{ if(gamu==0){
+{ gamu=1;
+ if(gamu==0){
rh = ( 0.7409792 * r) + (0.2180250 * g) + (0.0410058 * b);
gh = ( 0.2853532 * r) + (0.6242014 * g) + (0.0904454 * b);
bh = (-0.0096280 * r) - (0.0056980 * g) + (1.0153260 * b);
diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc
index cbb9abc74..73b5ea567 100644
--- a/rtengine/dcrop.cc
+++ b/rtengine/dcrop.cc
@@ -174,7 +174,6 @@ void Crop::update (int todo) {
if (todo & (M_LUMINANCE+M_COLOR)) {
//I made a little change here. Rather than have luminanceCurve (and others) use in/out lab images, we can do more if we copy right here.
labnCrop->CopyFrom(laboCrop);
-// parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay.
// parent->ipf.luminanceCurve (labnCrop, labnCrop, parent->lumacurve);
@@ -187,7 +186,13 @@ void Crop::update (int todo) {
LUTu dummy;
parent->ipf.chromiLuminanceCurve (1,labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->lumacurve, utili, autili, butili, ccutili,cclutili, dummy);
parent->ipf.vibrance (labnCrop);
- parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay.
+ // if(!params.colorappearance.tonecie) parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay.
+ // if(!params.colorappearance.tonecie) parent->ipf.EPDToneMap(labnCrop, 0, 1); //Go with much fewer than normal iterates for fast redisplay.
+ if(params.colorappearance.enabled && !params.colorappearance.tonecie)parent->ipf.EPDToneMap(labnCrop, 5, 1);
+
+ if(!params.colorappearance.enabled){parent->ipf.EPDToneMap(labnCrop, 5, 1);}
+
+ // parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay.
if (skip==1) {
parent->ipf.impulsedenoise (labnCrop);
@@ -198,8 +203,9 @@ void Crop::update (int todo) {
parent->ipf.sharpening (labnCrop, (float**)cbuffer);
parent->ipf.dirpyrequalizer (labnCrop);
}
+ int begh = 0, endh = labnCrop->H;
- parent->ipf.ciecam_02 (1,labnCrop, ¶ms,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy);
+ parent->ipf.ciecam_02 (cieCrop,begh, endh, 1,labnCrop, ¶ms,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy, 5, 1);
}
// switch back to rgb
parent->ipf.lab2monitorRgb (labnCrop, cropImg);
@@ -277,6 +283,7 @@ void Crop::freeAll () {
delete resizeCrop;
resizeCrop = NULL;
delete laboCrop;
+ delete cieCrop;
delete labnCrop;
delete cropImg;
delete cshmap;
@@ -363,6 +370,7 @@ if (settings->verbose) printf ("setcropsizes before lock\n");
laboCrop = new LabImage (cropw, croph);
labnCrop = new LabImage (cropw, croph);
cropImg = new Image8 (cropw, croph);
+ cieCrop = new CieImage (cropw, croph);
cshmap = new SHMap (cropw, croph, true);
diff --git a/rtengine/dcrop.h b/rtengine/dcrop.h
index 5647d91a2..f61c61b9f 100644
--- a/rtengine/dcrop.h
+++ b/rtengine/dcrop.h
@@ -40,7 +40,7 @@ class Crop : public DetailedCrop {
Imagefloat* *resizeCrop, *transCrop;
LabImage *laboCrop, *labnCrop;
Image8 *cropImg; // permanently allocated in RAM and only renewed on size changes
-
+ CieImage *cieCrop;
float** cbuffer;
float * cbuf_real;
SHMap* cshmap;
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index b2b07c3a4..07cf6c672 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -349,8 +349,16 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
ipf.chromiLuminanceCurve (pW,nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve,lhskcurve, lumacurve, utili, autili, butili, ccutili,cclutili, histCCurve);
ipf.vibrance(nprevl);
- ipf.EPDToneMap(nprevl,0,scale);
+ // if(!params.colorappearance.tonecie) ipf.EPDToneMap(nprevl,0,scale);
+/* if(params.colorappearance.enabled){
+ if(!params.colorappearance.tonecie) ipf.EPDToneMap(nprevl,5,1);
+ }
+ if(!params.colorappearance.enabled){ipf.EPDToneMap(nprevl,5,1);}
+ */
+ if(params.colorappearance.enabled && !params.colorappearance.tonecie) ipf.EPDToneMap(nprevl,5,1);
+ if(!params.colorappearance.enabled){ipf.EPDToneMap(nprevl,5,1);}
+
readyphase++;
if (scale==1) {
progress ("Denoising luminance impulse...",100*readyphase/numofphases);
@@ -414,8 +422,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
customColCurve2,
customColCurve3,
scale==1 ? 1 : 1);
-
- ipf.ciecam_02 (pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM);
+ int Iterates=0;
+ int begh=0;
+ int endh=pH;
+ ipf.ciecam_02 (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1);
}
// process crop, if needed
for (size_t i=0; idelImage (previmg);
}
@@ -514,6 +525,7 @@ if (settings->verbose) printf ("setscale before lock\n");
oprevi = orig_prev;
oprevl = new LabImage (pW, pH);
nprevl = new LabImage (pW, pH);
+ ncie = new CieImage (pW, pH);
previmg = new Image8 (pW, pH);
workimg = new Image8 (pW, pH);
shmap = new SHMap (pW, pH, true);
diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h
index af19c4d5b..f989f0a77 100644
--- a/rtengine/improccoordinator.h
+++ b/rtengine/improccoordinator.h
@@ -47,6 +47,7 @@ class ImProcCoordinator : public StagedImageProcessor {
LabImage *nprevl;
Image8 *previmg;
Image8 *workimg;
+ CieImage *ncie;
ImageSource* imgsrc;
diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc
index 767c02e35..4a72d1251 100644
--- a/rtengine/improcfun.cc
+++ b/rtengine/improcfun.cc
@@ -1,3 +1,4 @@
+/*
/*
* This file is part of RawTherapee.
*
@@ -38,7 +39,7 @@
#include "cplx_wavelet_dec.h"
#include "boxblur.h"
#include "rt_math.h"
-
+#include "EdgePreservingDecomposition.h"
#ifdef _OPENMP
#include
#endif
@@ -234,8 +235,7 @@ void ImProcFunctions::firstAnalysis (Imagefloat* original, const ProcParams* par
delete [] hist;
}
-
-void ImProcFunctions::ciecam_02 (int pW, LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2,const ColorAppearance & customColCurve3, LUTu & histLCAM, LUTu & histCCAM )
+void ImProcFunctions::ciecam_02 (CieImage* ncie, int begh, int endh, int pW, LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2,const ColorAppearance & customColCurve3, LUTu & histLCAM, LUTu & histCCAM, int Iterates, int scale )
{
if(params->colorappearance.enabled) {
@@ -267,6 +267,15 @@ if(params->colorappearance.enabled) {
}
int width = lab->W, height = lab->H;
+ int Np=width*height;
+ float minQ=10000.f;
+ float minM=10000.f;
+ float maxQ= -1000.f;
+ float maxM= -1000.f;
+ float w_h;
+ float a_w;
+ float c_;
+ float f_l;
double Yw;
Yw=1.0;
double Xw, Zw;
@@ -285,6 +294,7 @@ if(params->colorappearance.enabled) {
float koef=1.0f;//rough correspondence between L and J
hist16J.clear();hist16Q.clear();
for (int i=0; iL[i][j])/327.68f)>95.) koef=1.f;
else if(((lab->L[i][j])/327.68f)>85.) koef=0.97f;
@@ -302,7 +312,8 @@ if(params->colorappearance.enabled) {
sum+=koef*lab->L[i][j];//evaluate mean J to calcualte Yb
hist16Q[CLIP((int) (32768.f*sqrt((koef*(lab->L[i][j]))/32768.f)))]++; //for brightness Q : approximation for Q=wh*sqrt(J/100) J not equal L
}
- mean=(sum/(height*width))/327.68f;//for Yb for all image...if one day "pipette" we can adapt Yb for each zone
+ //mean=(sum/((endh-begh)*width))/327.68f;//for Yb for all image...if one day "pipette" we can adapt Yb for each zone
+ mean=(sum/((height)*width))/327.68f;//for Yb for all image...if one day "pipette" we can adapt Yb for each zone
if (mean<15.f) yb=3.0;
else if(mean<30.f) yb=5.0;
else if(mean<40.f) yb=10.0;
@@ -398,7 +409,7 @@ if(params->colorappearance.enabled) {
bool doneinit=true;
bool doneinit2=true;
#ifndef _DEBUG
-#pragma omp parallel default(shared) firstprivate(lab,xw1,xw2,yw1,yw2,zw1,zw2,pilot,jli,chr,yb,la,fl,nc,f,c, height,width,doneinit,doneinit2, nc2,f2,c2, alg, gamu, highlight, rstprotection, pW)
+#pragma omp parallel default(shared) firstprivate(lab,xw1,xw2,yw1,yw2,zw1,zw2,pilot,jli,chr,yb,la,yb2,la2,fl,nc,f,c, height,width,begh, endh, doneinit,doneinit2, nc2,f2,c2, alg, gamu, highlight, rstprotection, pW)
#endif
{
TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working);
@@ -412,6 +423,7 @@ if(params->colorappearance.enabled) {
#pragma omp for schedule(dynamic, 10)
#endif
for (int i=0; iL[i][j];
@@ -419,6 +431,7 @@ if(params->colorappearance.enabled) {
float b=lab->b[i][j];
float x1,y1,z1;
double x,y,z;
+ double epsil=0.0001;
//convert Lab => XYZ
Color::Lab2XYZ(L, a, b, x1, y1, z1);
double J, C, h, Q, M, s, aw, fl, wh;
@@ -448,6 +461,10 @@ if(params->colorappearance.enabled) {
Qpro=Q;
Mpro=M;
spro=s;
+ w_h=wh+epsil;
+ a_w=aw;
+ c_=c;
+ f_l=fl;
// we cannot have all algoritms with all chroma curves
if(alg==1) {
// Lightness saturation
@@ -633,6 +650,18 @@ if(params->colorappearance.enabled) {
M=Mpro;
h=hpro;
s=spro;
+
+ if(params->colorappearance.tonecie){
+ ncie->Q_p[i][j]=(float)Q+epsil;
+ ncie->M_p[i][j]=(float)M+epsil;
+ ncie->J_p[i][j]=(float)J+epsil;
+ ncie->h_p[i][j]=(float)h;
+ ncie->C_p[i][j]=(float)C+epsil;
+ // ciec->s_p[i][j]=(float)s;
+
+ if(ncie->Q_p[i][j]Q_p[i][j];
+ if(ncie->Q_p[i][j]>maxQ) maxQ=ncie->Q_p[i][j];
+ }
int posl, posc;
double brli=327.;
double chsacol=327.;
@@ -661,7 +690,7 @@ if(params->colorappearance.enabled) {
hist16_CCAM[posc]++;
}
}
-
+ if(!params->edgePreservingDecompositionUI.enabled || !params->colorappearance.tonecie){
double xx,yy,zz;
//process normal==> viewing
ColorTemp::jch2xyz_ciecam02( xx, yy, zz,
@@ -702,8 +731,11 @@ if(params->colorappearance.enabled) {
}
}
+ }
}
// End of parallelization
+if(!params->edgePreservingDecompositionUI.enabled || !params->colorappearance.tonecie){
+
if(ciedata) {
//update histogram J
if(pW!=1){//only with improccoordinator
@@ -727,7 +759,7 @@ if(params->colorappearance.enabled) {
}
}
}
-
+}
#ifdef _DEBUG
if (settings->verbose) {
t2e.set();
@@ -735,6 +767,78 @@ if(params->colorappearance.enabled) {
// printf("minc=%f maxc=%f minj=%f maxj=%f\n",minc,maxc,minj,maxj);
}
#endif
+//select here tonemapping with Q
+if(params->colorappearance.tonecie && params->edgePreservingDecompositionUI.enabled) {
+ //EPDToneMapCIE adated to CIECAM
+ ImProcFunctions::EPDToneMapCIE(ncie, a_w, c_, w_h, width, height, begh, endh, minQ, maxQ, Iterates, scale );
+
+#ifndef _DEBUG
+#pragma omp parallel default(shared) firstprivate(lab,xw2,yw2,zw2,chr,yb,la2,yb2, height,width,begh, endh,doneinit2, nc2,f2,c2, gamu, highlight)
+#endif
+{
+ TMatrix wiprofa = iccStore->workingSpaceInverseMatrix (params->icm.working);
+ double wipa[3][3] = {
+ {wiprofa[0][0],wiprofa[0][1],wiprofa[0][2]},
+ {wiprofa[1][0],wiprofa[1][1],wiprofa[1][2]},
+ {wiprofa[2][0],wiprofa[2][1],wiprofa[2][2]}
+ };
+
+
+#ifndef _DEBUG
+ #pragma omp for schedule(dynamic, 10)
+#endif
+ for (int i=0; iJ_p[i][j]=(100.0* ncie->Q_p[i][j]*ncie->Q_p[i][j]) /(w_h*w_h);
+ ncie->C_p[i][j] =(ncie->M_p[i][j])/co_e;
+
+ ColorTemp::jch2xyz_ciecam02( xx, yy, zz,
+ ncie->J_p[i][j], ncie->C_p[i][j], ncie->h_p[i][j],
+ xw2, yw2, zw2,
+ yb2, la2,
+ f2, c2, nc2, doneinit2, gamu);
+ x=(float)xx*655.35;
+ y=(float)yy*655.35;
+ z=(float)zz*655.35;
+ float Ll,aa,bb;
+ //convert xyz=>lab
+ Color::XYZ2Lab(x, y, z, Ll, aa, bb);
+ lab->L[i][j]=Ll;
+ lab->a[i][j]=aa;
+ lab->b[i][j]=bb;
+ if(gamu==1) {
+ float R,G,B;
+ float HH, Lprov1, Chprov1;
+ Lprov1=lab->L[i][j]/327.68f;
+ Chprov1=sqrt(SQR(lab->a[i][j]/327.68f) + SQR(lab->b[i][j]/327.68f));
+ HH=atan2(lab->b[i][j],lab->a[i][j]);
+
+#ifdef _DEBUG
+ bool neg=false;
+ bool more_rgb=false;
+ //gamut control : Lab values are in gamut
+ Color::gamutLchonly(HH,Lprov1,Chprov1, R, G, B, wipa, highlight, 0.15f, 0.96f, neg, more_rgb);
+#else
+ //gamut control : Lab values are in gamut
+ Color::gamutLchonly(HH,Lprov1,Chprov1, R, G, B, wipa, highlight, 0.15f, 0.96f);
+#endif
+
+ lab->L[i][j]=Lprov1*327.68f;
+ lab->a[i][j]=327.68f*Chprov1*cos(HH);
+ lab->b[i][j]=327.68f*Chprov1*sin(HH);
+ }
+ }
+
+
+ }
+ }
+
}
}
@@ -1724,9 +1828,85 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) {
}
}
+void ImProcFunctions::EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates, int skip){
+
+if(!params->edgePreservingDecompositionUI.enabled) return;
+ float stren=params->edgePreservingDecompositionUI.Strength;
+ float edgest=params->edgePreservingDecompositionUI.EdgeStopping;
+ float sca=params->edgePreservingDecompositionUI.Scale;
+ float rew=params->edgePreservingDecompositionUI.ReweightingIterates;
+ unsigned int i, N = Wid*Hei;
+ float Qpro= ( 4.0 / c_) * ( a_w + 4.0 ) ;//estimate Q max if J=100.0
+ float *Qpr=ncie->Q_p[0];
+ float eps=0.0001;
+ if (settings->verbose) printf("minQ=%f maxQ=%f Qpro=%f\n",minQ,maxQ, Qpro);
+ if(maxQ>Qpro) Qpro=maxQ;
+ for (int i=0; iQ_p[i][j];}
+
+ EdgePreservingDecomposition epd = EdgePreservingDecomposition(Wid, Hei);
+
+ for(i = 0; i != N; i++) Qpr[i] = (Qpr[i]+eps)/(Qpro);
+
+ float Compression = expf(-stren); //This modification turns numbers symmetric around 0 into exponents.
+ float DetailBoost = stren;
+ if(stren < 0.0f) DetailBoost = 0.0f; //Go with effect of exponent only if uncompressing.
+
+ //Auto select number of iterates. Note that p->EdgeStopping = 0 makes a Gaussian blur.
+ if(Iterates == 0) Iterates = (unsigned int)(edgest*15.0);
+ //Jacques Desmis : always Iterates=5 for compatibility images between preview and output
+
+ epd.CompressDynamicRange(Qpr, (float)sca/skip, (float)edgest, Compression, DetailBoost, Iterates, rew, Qpr);
+
+ //Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping.
+ float s = (1.0f + 38.7889f)*powf(Compression, 1.5856f)/(1.0f + 38.7889f*powf(Compression, 1.5856f));
+ for (int i=0; iQ_p[i][j]=(Qpr[i*Wid+j]+eps)*Qpro;
+ ncie->M_p[i][j]*=s;
+ }
+/*
+ float *Qpr2 = new float[Wid*((heir)+1)];
+
+ for (int i=heir; iQ_p[i][j];}
+ if(minQ>0.0) minQ=0.0;//normaly minQ always > 0...
+// EdgePreservingDecomposition epd = EdgePreservingDecomposition(Wid, Hei);
+//EdgePreservingDecomposition epd = EdgePreservingDecomposition(Wid, Hei/2);
+ for(i = N2; i != N; i++)
+// for(i = begh*Wid; i != N; i++)
+ //Qpr[i] = (Qpr[i]-minQ)/(maxQ+1.0);
+ Qpr2[i-N2] = (Qpr2[i-N2]-minQ)/(Qpro+1.0);
+
+ float Compression2 = expf(-stren); //This modification turns numbers symmetric around 0 into exponents.
+ float DetailBoost2 = stren;
+ if(stren < 0.0f) DetailBoost2 = 0.0f; //Go with effect of exponent only if uncompressing.
+
+ //Auto select number of iterates. Note that p->EdgeStopping = 0 makes a Gaussian blur.
+ if(Iterates == 0) Iterates = (unsigned int)(edgest*15.0);
+
+
+ epd.CompressDynamicRange(Qpr2, (float)sca/skip, (float)edgest, Compression2, DetailBoost2, Iterates, rew, Qpr2);
+
+ //Restore past range, also desaturate a bit per Mantiuk's Color correction for tone mapping.
+ float s2 = (1.0f + 38.7889f)*powf(Compression, 1.5856f)/(1.0f + 38.7889f*powf(Compression, 1.5856f));
+ for (int i=heir; iQ_p[i][j]=Qpr2[(i-heir)*Wid+j]*Qpro + minQ;
+ // Qpr[i*Wid+j]=Qpr[i*Wid+j]*maxQ + minQ;
+ // ncie->J_p[i][j]=(100.0* Qpr[i*Wid+j]*Qpr[i*Wid+j]) /(w_h*w_h);
+
+ ncie->M_p[i][j]*=s2;
+ }
+ delete [] Qpr2;
+
+*/
+}
+
//Map tones by way of edge preserving decomposition. Is this the right way to include source?
-#include "EdgePreservingDecomposition.cc"
+//#include "EdgePreservingDecomposition.cc"
void ImProcFunctions::EPDToneMap(LabImage *lab, unsigned int Iterates, int skip){
//Hasten access to the parameters.
// EPDParams *p = (EPDParams *)(¶ms->edgePreservingDecompositionUI);
diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h
index f2e5444c4..c3480288d 100644
--- a/rtengine/improcfun.h
+++ b/rtengine/improcfun.h
@@ -27,6 +27,7 @@
#include "coord2d.h"
#include "color.h"
#include "labimage.h"
+#include "cieimage.h"
#include "LUT.h"
#include "lcp.h"
#include "curves.h"
@@ -92,7 +93,7 @@ class ImProcFunctions {
SHMap* shmap, int sat, LUTf & rCurve, LUTf & gCurve, LUTf & bCurve, const ToneCurve & customToneCurve1, const ToneCurve & customToneCurve2,
double expcomp, int hlcompr, int hlcomprthresh);
void luminanceCurve (LabImage* lold, LabImage* lnew, LUTf &curve);
- void ciecam_02 (int pW, LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, LUTu &histLCAM, LUTu &histCCAM);
+ void ciecam_02 (CieImage* ncie, int begh, int endh, int pW, LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, LUTu &histLCAM, LUTu &histCCAM,int Iterates, int scale );
void chromiLuminanceCurve (int pW, LabImage* lold, LabImage* lnew, LUTf &acurve, LUTf &bcurve, LUTf & satcurve,LUTf & satclcurve, LUTf &curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, LUTu &histCCurve);
void vibrance (LabImage* lab);//Jacques' vibrance
void colorCurve (LabImage* lold, LabImage* lnew);
@@ -111,7 +112,8 @@ class ImProcFunctions {
void dirpyrequalizer (LabImage* lab);//Emil's equalizer
void EPDToneMap(LabImage *lab, unsigned int Iterates = 0, int skip = 1);
- // void CAT02 (Imagefloat* baseImg, const ProcParams* params);
+ void EPDToneMapCIE(CieImage *ncie, float a_w, float c_, float w_h, int Wid, int Hei, int begh, int endh, float minQ, float maxQ, unsigned int Iterates=0, int skip =1);
+ // void CAT02 (Imagefloat* baseImg, const ProcParams* params);
// pyramid denoise
procparams::DirPyrDenoiseParams dnparams;
@@ -152,6 +154,7 @@ class ImProcFunctions {
Image8* lab2rgb (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);
Image16* lab2rgb16b (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile, Glib::ustring profi, Glib::ustring gam, bool freegamma, double gampos, double slpos, double &ga0, double &ga1, double &ga2, double &ga3, double &ga4, double &ga5, double &ga6);// for gamma output
Image16* lab2rgb16 (LabImage* lab, int cx, int cy, int cw, int ch, Glib::ustring profile);//without gamma ==>default
+ // CieImage *ciec;
bool transCoord (int W, int H, int x, int y, int w, int h, int& xv, int& yv, int& wv, int& hv, double ascaleDef = -1, const LCPMapper *pLCPMap=NULL);
bool transCoord (int W, int H, const std::vector &src, std::vector &red, std::vector &green, std::vector &blue, double ascaleDef = -1, const LCPMapper *pLCPMap=NULL);
diff --git a/rtengine/procevents.h b/rtengine/procevents.h
index d1fa7122f..226cfa62b 100644
--- a/rtengine/procevents.h
+++ b/rtengine/procevents.h
@@ -221,8 +221,9 @@ enum ProcEvent {
EvCATCurve3=196,
EvCATCurveMode3=197,
EvCATdatacie=198,
+ EvCATtonecie=199,
- NUMOFEVENTS=199
+ NUMOFEVENTS=200
};
}
#endif
diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc
index e55b7f071..4abf1c21f 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -231,6 +231,7 @@ void ProcParams::setDefaults () {
colorappearance.surrsource = false;
colorappearance.gamut = true;
colorappearance.datacie = false;
+ colorappearance.tonecie = false;
colorappearance.curve.clear ();
colorappearance.curve.push_back(DCT_Linear);
colorappearance.curve2.clear ();
@@ -593,6 +594,7 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, ParamsEdited* p
if (!pedited || pedited->colorappearance.surrsource) keyFile.set_boolean ("Color appearance", "SurrSource", colorappearance.surrsource);
if (!pedited || pedited->colorappearance.gamut) keyFile.set_boolean ("Color appearance", "Gamut", colorappearance.gamut);
if (!pedited || pedited->colorappearance.datacie) keyFile.set_boolean ("Color appearance", "Datacie", colorappearance.datacie);
+ if (!pedited || pedited->colorappearance.tonecie) keyFile.set_boolean ("Color appearance", "Tonecie", colorappearance.tonecie);
if (!pedited || pedited->colorappearance.curveMode) {
Glib::ustring method;
switch (colorappearance.curveMode) {
@@ -1111,6 +1113,7 @@ if (keyFile.has_group ("Color appearance")) {
if (keyFile.has_key ("Color appearance", "SurrSource")) {colorappearance.surrsource = keyFile.get_boolean ("Color appearance", "SurrSource"); if (pedited) pedited->colorappearance.surrsource = true; }
if (keyFile.has_key ("Color appearance", "Gamut")) {colorappearance.gamut = keyFile.get_boolean ("Color appearance", "Gamut"); if (pedited) pedited->colorappearance.gamut = true; }
if (keyFile.has_key ("Color appearance", "Datacie")) {colorappearance.datacie = keyFile.get_boolean ("Color appearance", "Datacie"); if (pedited) pedited->colorappearance.datacie = true; }
+ if (keyFile.has_key ("Color appearance", "Tonecie")) {colorappearance.tonecie = keyFile.get_boolean ("Color appearance", "Tonecie"); if (pedited) pedited->colorappearance.tonecie = true; }
if (keyFile.has_key ("Color appearance", "CurveMode")) {
Glib::ustring sMode = keyFile.get_string ("Color appearance", "CurveMode");
if (sMode == "Lightness") colorappearance.curveMode = ColorAppearanceParams::TC_MODE_LIGHT;
diff --git a/rtengine/procparams.h b/rtengine/procparams.h
index 2299f47af..a7a7f0da9 100644
--- a/rtengine/procparams.h
+++ b/rtengine/procparams.h
@@ -389,6 +389,7 @@ class WBParams {
bool surrsource;
bool gamut;
bool datacie;
+ bool tonecie;
};
diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc
index ef1c86aab..f1882bcb8 100644
--- a/rtengine/refreshmap.cc
+++ b/rtengine/refreshmap.cc
@@ -218,7 +218,9 @@ LUMINANCECURVE, // EvCATcurvemode1
LUMINANCECURVE, // EvCATcurvemode2
LUMINANCECURVE, // EvCATcurve3
LUMINANCECURVE, // EvCATcurvemode3
-LUMINANCECURVE // EvCATdatacie
+LUMINANCECURVE, // EvCATdatacie
+LUMINANCECURVE // EvCATtonecie
+
};
diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc
index fffab7cb0..627d700b3 100644
--- a/rtengine/rtthumbnail.cc
+++ b/rtengine/rtthumbnail.cc
@@ -763,6 +763,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
CurveFactory::RGBCurve (params.rgbCurves.bcurve, bCurve, 16);
LabImage* labView = new LabImage (fw,fh);
+ CieImage* cieView = new CieImage (fw,fh);
ipf.rgbProc (baseImg, labView, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, customToneCurve1, customToneCurve2, expcomp, hlcompr, hlcomprthresh);
@@ -794,7 +795,11 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
ipf.chromiLuminanceCurve (1,labView, labView, curve1, curve2, satcurve,lhskcurve, curve, utili, autili, butili, ccutili,cclutili, dummy);
ipf.vibrance(labView);
- ipf.EPDToneMap(labView,0,6);
+ int begh = 0, endh = labView->H;
+
+ if(params.colorappearance.enabled && !params.colorappearance.tonecie) ipf.EPDToneMap(labView,5,6);
+
+ if(!params.colorappearance.enabled){ipf.EPDToneMap(labView,5,6);}
CurveFactory::curveLightBrightColor (
params.colorappearance.curveMode, params.colorappearance.curve,
@@ -807,7 +812,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
customColCurve3,
16);
- ipf.ciecam_02 (1, labView, ¶ms,customColCurve1,customColCurve2,customColCurve3, dummy, dummy);
+ ipf.ciecam_02 (cieView, begh, endh, 1, labView, ¶ms,customColCurve1,customColCurve2,customColCurve3, dummy, dummy, 5, 6);
// color processing
//ipf.colorCurve (labView, labView);
diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc
index 3a1f28617..097b79ee4 100644
--- a/rtengine/simpleprocess.cc
+++ b/rtengine/simpleprocess.cc
@@ -109,6 +109,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
// perform luma/chroma denoise
+// CieImage *cieView;
+
LabImage* labView = new LabImage (fw,fh);
if (params.dirpyrDenoise.enabled) {
ipf.RGB_denoise(baseImg, baseImg, imgsrc->isRAW(), params.dirpyrDenoise, params.defringe);
@@ -215,7 +217,9 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
1);
ipf.chromiLuminanceCurve (1,labView, labView, curve1, curve2, satcurve,lhskcurve,curve, utili, autili, butili, ccutili,cclutili,dummy);
- ipf.EPDToneMap(labView);
+ if(params.colorappearance.enabled && !params.colorappearance.tonecie)ipf.EPDToneMap(labView,5,1);
+
+ if(!params.colorappearance.enabled){ipf.EPDToneMap(labView,5,1);}
ipf.vibrance(labView);
@@ -242,6 +246,14 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
// directional pyramid equalizer
ipf.dirpyrequalizer (labView);//TODO: this is the luminance tonecurve, not the RGB one
+ //Colorappearance and tone-mapping associated
+
+ int f_w=1,f_h=1;
+ int begh = 0, endh = fh;
+ if(params.colorappearance.tonecie || params.colorappearance.enabled){f_w=fw;f_h=fh;}
+ CieImage *cieView = new CieImage (f_w,(f_h));
+ begh=0;
+ endh=fh;
CurveFactory::curveLightBrightColor (
params.colorappearance.curveMode, params.colorappearance.curve,
params.colorappearance.curveMode2, params.colorappearance.curve2,
@@ -253,7 +265,13 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
customColCurve3,
1);
- ipf.ciecam_02 (1, labView, ¶ms,customColCurve1,customColCurve2,customColCurve3, dummy, dummy);
+ ipf.ciecam_02 (cieView, begh, endh,1, labView, ¶ms,customColCurve1,customColCurve2,customColCurve3, dummy, dummy, 5, 1);
+
+ delete cieView;
+ cieView = NULL;
+
+
+
// end tile processing...???
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc
index 0c164a8b8..89274c791 100644
--- a/rtgui/colorappearance.cc
+++ b/rtgui/colorappearance.cc
@@ -170,12 +170,18 @@ ColorAppearance::ColorAppearance () : Gtk::VBox(), FoldableToolPanel(this) {
qcontrast->set_tooltip_markup (M("TP_COLORAPP_CONTRAST_Q_TOOLTIP"));
p2VBox->pack_start (*qcontrast);
+
colorh = Gtk::manage (new Adjuster (M("TP_COLORAPP_HUE"), -100.0, 100.0, 0.1, 0.));
if (colorh->delay < 1000) colorh->delay = 1000;
colorh->throwOnButtonRelease();
colorh->set_tooltip_markup (M("TP_COLORAPP_HUE_TOOLTIP"));
p2VBox->pack_start (*colorh);
+ tonecie = Gtk::manage (new Gtk::CheckButton (M("TP_COLORAPP_TONECIE")));
+ tonecie->set_tooltip_markup (M("TP_COLORAPP_TONECIE_TOOLTIP"));
+ tonecieconn = tonecie->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::tonecie_toggled) );
+ p2VBox->pack_start (*tonecie);
+
p2VBox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_EXPAND_WIDGET, 4);
toneCurveMode = Gtk::manage (new MyComboBoxText ());
@@ -331,8 +337,12 @@ ColorAppearance::ColorAppearance () : Gtk::VBox(), FoldableToolPanel(this) {
gamut->set_tooltip_markup (M("TP_COLORAPP_GAMUT_TOOLTIP"));
gamutconn = gamut->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::gamut_toggled) );
pack_start (*gamut, Gtk::PACK_SHRINK);
-
-
+/*
+ tonecie = Gtk::manage (new Gtk::CheckButton (M("TP_COLORAPP_TONECIE")));
+ tonecie->set_tooltip_markup (M("TP_COLORAPP_TONECIE_TOOLTIP"));
+ tonecieconn = tonecie->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::tonecie_toggled) );
+ pack_start (*tonecie, Gtk::PACK_SHRINK);
+*/
// ------------------------ Listening events
@@ -404,6 +414,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) {
surrsource->set_inconsistent (!pedited->colorappearance.surrsource);
gamut->set_inconsistent (!pedited->colorappearance.gamut);
datacie->set_inconsistent (!pedited->colorappearance.datacie);
+ tonecie->set_inconsistent (!pedited->colorappearance.tonecie);
degree->setAutoInconsistent (multiImage && !pedited->colorappearance.autodegree);
enabled->set_inconsistent (multiImage && !pedited->colorappearance.enabled);
@@ -477,10 +488,14 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) {
datacieconn.block (true);
datacie->set_active (pp->colorappearance.datacie);
datacieconn.block (false);
+ tonecieconn.block (true);
+ tonecie->set_active (pp->colorappearance.tonecie);
+ tonecieconn.block (false);
lastsurr=pp->colorappearance.surrsource;
lastgamut=pp->colorappearance.gamut;
lastdatacie=pp->colorappearance.datacie;
+ lasttonecie=pp->colorappearance.tonecie;
lastEnabled = pp->colorappearance.enabled;
lastAutoDegree = pp->colorappearance.autodegree;
@@ -531,6 +546,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) {
pp->colorappearance.surrsource = surrsource->get_active();
pp->colorappearance.gamut = gamut->get_active();
pp->colorappearance.datacie = datacie->get_active();
+ pp->colorappearance.tonecie = tonecie->get_active();
pp->colorappearance.curve = shape->getCurve ();
pp->colorappearance.curve2 = shape2->getCurve ();
pp->colorappearance.curve3 = shape3->getCurve ();
@@ -569,6 +585,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->colorappearance.surrsource = !surrsource->get_inconsistent();
pedited->colorappearance.gamut = !gamut->get_inconsistent();
pedited->colorappearance.datacie = !datacie->get_inconsistent();
+ pedited->colorappearance.tonecie = !tonecie->get_inconsistent();
pedited->colorappearance.curve = !shape->isUnChanged ();
pedited->colorappearance.curve2 = !shape2->isUnChanged ();
pedited->colorappearance.curve3 = !shape3->isUnChanged ();
@@ -683,13 +700,14 @@ void ColorAppearance::gamut_toggled () {
lastgamut = gamut->get_active ();
}
-
if (listener) {
if (gamut->get_active ())
listener->panelChanged (EvCATgamut, M("GENERAL_ENABLED"));
else
listener->panelChanged (EvCATgamut, M("GENERAL_DISABLED"));
}
+
+
}
void ColorAppearance::datacie_toggled () {
@@ -713,6 +731,28 @@ void ColorAppearance::datacie_toggled () {
listener->panelChanged (EvCATdatacie, M("GENERAL_DISABLED"));
}
}
+void ColorAppearance::tonecie_toggled () {
+
+ if (batchMode) {
+ if (tonecie->get_inconsistent()) {
+ tonecie->set_inconsistent (false);
+ tonecieconn.block (true);
+ tonecie->set_active (false);
+ tonecieconn.block (false);
+ }
+ else if (lasttonecie)
+ tonecie->set_inconsistent (true);
+
+ lasttonecie = tonecie->get_active ();
+ }
+ if (listener) {
+ if (tonecie->get_active ())
+ listener->panelChanged (EvCATtonecie, M("GENERAL_ENABLED"));
+ else
+ listener->panelChanged (EvCATtonecie, M("GENERAL_DISABLED"));
+ }
+
+}
void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {
@@ -888,6 +928,7 @@ void ColorAppearance::algoChanged () {
schroma->hide();
qbright->hide();
colorh->hide();
+ tonecie->hide();
curveEditorG->show();
curveEditorG2->show();
curveEditorG3->show();
@@ -902,6 +943,7 @@ void ColorAppearance::algoChanged () {
schroma->show();
qbright->hide();
colorh->hide();
+ tonecie->hide();
curveEditorG->show();
curveEditorG2->show();
curveEditorG3->show();
@@ -916,6 +958,7 @@ void ColorAppearance::algoChanged () {
schroma->hide();
qbright->show();
colorh->hide();
+ tonecie->show();
curveEditorG->show();
curveEditorG2->show();
curveEditorG3->show();
@@ -930,6 +973,7 @@ void ColorAppearance::algoChanged () {
schroma->show();
qbright->show();
colorh->show();
+ tonecie->show();
curveEditorG->show();
curveEditorG2->show();
curveEditorG3->show();
diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h
index ef310d480..abcc8354f 100644
--- a/rtgui/colorappearance.h
+++ b/rtgui/colorappearance.h
@@ -56,6 +56,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
Gtk::CheckButton* surrsource;
Gtk::CheckButton* gamut;
Gtk::CheckButton* datacie;
+ Gtk::CheckButton* tonecie;
Gtk::CheckButton* enabled;
MyComboBoxText* surround;
@@ -65,7 +66,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
MyComboBoxText* algo;
sigc::connection algoconn;
sigc::connection surrconn;
- sigc::connection gamutconn, datacieconn;
+ sigc::connection gamutconn, datacieconn, tonecieconn;
sigc::connection tcmodeconn, tcmode2conn, tcmode3conn;
CurveEditorGroup* curveEditorG;
CurveEditorGroup* curveEditorG2;
@@ -81,6 +82,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
bool lastsurr;
bool lastgamut;
bool lastdatacie;
+ bool lasttonecie;
bool bgTTipQuery(int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip);
bool srTTipQuery(int x, int y, bool keyboard_tooltip, const Glib::RefPtr& tooltip);
@@ -103,6 +105,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
void surrsource_toggled ();
void gamut_toggled ();
void datacie_toggled ();
+ void tonecie_toggled ();
void curveChanged (CurveEditor* ce);
void curveMode1Changed ();
diff --git a/rtgui/epd.cc b/rtgui/epd.cc
index cd8b8956d..78c25952e 100644
--- a/rtgui/epd.cc
+++ b/rtgui/epd.cc
@@ -29,6 +29,7 @@ EdgePreservingDecompositionUI::EdgePreservingDecompositionUI () : Gtk::VBox(), F
enabled = Gtk::manage (new Gtk::CheckButton (M("GENERAL_ENABLED")));
enabled->set_active (false);
+ enabled->set_tooltip_markup (M("TP_EPD_TOOLTIP"));
enabled->show ();
pack_start (*enabled);
diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc
index e906d327c..e03324c0a 100644
--- a/rtgui/paramsedited.cc
+++ b/rtgui/paramsedited.cc
@@ -113,6 +113,7 @@ void ParamsEdited::set (bool v) {
colorappearance.surrsource = v;
colorappearance.gamut = v;
colorappearance.datacie = v;
+ colorappearance.tonecie = v;
colorappearance.curve = v;
colorappearance.curve2 = v;
colorappearance.curve3 = v;
@@ -343,7 +344,8 @@ void ParamsEdited::initFrom (const std::vector
colorappearance.surrsource = colorappearance.surrsource && p.colorappearance.surrsource == other.colorappearance.surrsource;
colorappearance.gamut = colorappearance.gamut && p.colorappearance.gamut == other.colorappearance.gamut;
colorappearance.datacie = colorappearance.datacie && p.colorappearance.datacie == other.colorappearance.datacie;
- colorappearance.curve = colorappearance.curve && p.colorappearance.curve == other.colorappearance.curve;
+ colorappearance.tonecie = colorappearance.tonecie && p.colorappearance.tonecie == other.colorappearance.tonecie;
+ colorappearance.curve = colorappearance.curve && p.colorappearance.curve == other.colorappearance.curve;
colorappearance.curve3 = colorappearance.curve3 && p.colorappearance.curve3 == other.colorappearance.curve3;
colorappearance.curve2 = colorappearance.curve2 && p.colorappearance.curve2 == other.colorappearance.curve2;
colorappearance.curveMode = colorappearance.curveMode && p.colorappearance.curveMode == other.colorappearance.curveMode;
@@ -609,6 +611,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (colorappearance.surrsource) toEdit.colorappearance.surrsource = mods.colorappearance.surrsource;
if (colorappearance.gamut) toEdit.colorappearance.gamut = mods.colorappearance.gamut;
if (colorappearance.datacie) toEdit.colorappearance.datacie = mods.colorappearance.datacie;
+ if (colorappearance.tonecie) toEdit.colorappearance.tonecie = mods.colorappearance.tonecie;
if (impulseDenoise.enabled) toEdit.impulseDenoise.enabled = mods.impulseDenoise.enabled;
if (impulseDenoise.thresh) toEdit.impulseDenoise.thresh = mods.impulseDenoise.thresh;
diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h
index 0801a60a9..cf8f3902a 100644
--- a/rtgui/paramsedited.h
+++ b/rtgui/paramsedited.h
@@ -210,6 +210,7 @@ public:
bool surrsource;
bool gamut;
bool datacie;
+ bool tonecie;
};