Improvement histogram curves CIECAM see issue1640

This commit is contained in:
jdc 2012-12-05 09:24:15 +01:00
parent 1960d09286
commit f2e950521f
17 changed files with 225 additions and 91 deletions

View File

@ -592,6 +592,7 @@ PARTIALPASTE_COLORDENOISE;Réduction du bruit chromatique
PARTIALPASTE_COLORGROUP;Réglages couleurs
PARTIALPASTE_COLORMIXER;Mixage couleur
PARTIALPASTE_COLORSHIFT;Décalage couleur
PARTIALPASTE_COLORAPP;CIE Modèle apparence de la couleur 2002
PARTIALPASTE_COMMONTRANSFORMPARAMS;Remplir
PARTIALPASTE_COMPOSITIONGROUP;Réglages de la composition
PARTIALPASTE_CROP;Recadrage
@ -916,6 +917,8 @@ 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 " <i>Automatic</i> ", RT essaiera de trouver la meilleure valeur
TP_COLORAPP_EQUAL;Préservé
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_TOOLTIP;Permet le controle du gamut en mode Lab
TP_COLORAPP_HUE;Teinte (h)
@ -951,9 +954,9 @@ TP_COLORAPP_TCMODE_LIGHTNESS;Luminosité
TP_COLORAPP_TCMODE_LABEL1;Courbe mode 1
TP_COLORAPP_TCMODE_LABEL2;Courbe mode 2
TP_COLORAPP_TCMODE_LABEL3;Courbe chroma mode
TP_COLORAPP_CURVEEDITOR1_TOOLTIP;Histogramme affiche L (lab) avant CIECAM.\n On peut voir le résultat dans la fenêtre histogramme
TP_COLORAPP_CURVEEDITOR1_TOOLTIP;Histogramme affiche L (lab) avant CIECAM.\n On peut voir le résultat dans la fenêtre histogramme.\n Histogramme de J/Q avant/après si la cas à cocher "Données CIECAM" est activée.\n (J,Q) ne sont pas affichés dans le panneau histogramme
TP_COLORAPP_CURVEEDITOR2_TOOLTIP;usage similaire aux courbes tonales exposition
TP_COLORAPP_CURVEEDITOR3_TOOLTIP;Vous pouvez choisir entre chroma -saturation- niveau couleurs.\n Histogramme affiche la chromaticité Lab.\n On peut voir le résultat dans la fenêtre histogramme
TP_COLORAPP_CURVEEDITOR3_TOOLTIP;Vous pouvez choisir entre chroma -saturation- niveau couleurs.\n Histogramme affiche la chromaticité Lab avant CIECAM.\n On peut voir le résultat final dans la fenêtre histogramme.\n Histogramme de C,s,M avant/après si la cas à cocher "Données CIECAM" est activée.\n (C,s,M) ne sont pas affichés dans le panneau histogramme
TP_CROP_FIXRATIO;Ratio fixe:
TP_CROP_GTDIAGONALS;Règle des diagonales
TP_CROP_GTEPASSPORT;Passeport biométrique
@ -1108,8 +1111,8 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE1;Neutre
TP_LABCURVE_CURVEEDITOR_CC_RANGE2;Terne
TP_LABCURVE_CURVEEDITOR_CC_RANGE3;Pastel
TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturé
TP_LABCURVE_CURVEEDITOR_LL_TOOLTIP;Luminance Lab L=f(L).\n Avant ajustements Lab.\n on peut voir le résultat dans la fenêtre Histogramme
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticité en fonction de la Chromaticité.\n C=f(C) On peut voir le résultat dans la fenêtre Histogramme
TP_LABCURVE_CURVEEDITOR_LL_TOOLTIP;Luminance Lab L=f(L).\n Avant ajustements courbe Lab.\n on peut voir le résultat dans la fenêtre Histogramme
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticité en fonction de la Chromaticité.\n Histogramme de la chromaticité avant la courbe chroma.\n On peut voir le résultat dans la fenêtre Histogramme
TP_LABCURVE_CURVEEDITOR_CH;CT
TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticité en fonction de la Teinte
TP_LABCURVE_CURVEEDITOR_LC;LC

View File

@ -594,6 +594,7 @@ PARTIALPASTE_COLORDENOISE;Color denoise
PARTIALPASTE_COLORGROUP;Color Related Settings
PARTIALPASTE_COLORMIXER;Color mixer
PARTIALPASTE_COLORSHIFT;Color shift
PARTIALPASTE_COLORAPP;CIE Color Appearance Model 2002
PARTIALPASTE_COMMONTRANSFORMPARAMS;Auto fill
PARTIALPASTE_COMPOSITIONGROUP;Composition Settings
PARTIALPASTE_CROP;Crop
@ -915,6 +916,8 @@ 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 " <i>Automatic</i> " box, RT will try to find the best value
TP_COLORAPP_EQUAL;Equal
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_TOOLTIP;Allow gamut control in Lab mode
TP_COLORAPP_HUE;Hue (h)
@ -950,9 +953,9 @@ TP_COLORAPP_TCMODE_LIGHTNESS;Lightness
TP_COLORAPP_TCMODE_LABEL1;Curve mode 1
TP_COLORAPP_TCMODE_LABEL2;Curve mode 2
TP_COLORAPP_TCMODE_LABEL3;Curve chroma mode
TP_COLORAPP_CURVEEDITOR1_TOOLTIP;Histogram of L (Lab) before CIECAM.\n For final output refer to the Histogram panel
TP_COLORAPP_CURVEEDITOR1_TOOLTIP;Histogram of L (Lab) before CIECAM.\n\n Histogram of J,Q after CIECAM, if checkbox Show CIECAM output is enabled.\n (J,Q) are not directly shown in histogram panel. \n\n For final output refer to the Histogram panel.
TP_COLORAPP_CURVEEDITOR2_TOOLTIP;Same usage as with the second exposure tone curve.
TP_COLORAPP_CURVEEDITOR3_TOOLTIP;Adjust either chroma, saturation or colorfullness.\n Histogram shows chromaticity (Lab) before CIECAM.\n For final output refer to the Histogram panel
TP_COLORAPP_CURVEEDITOR3_TOOLTIP;Adjust either chroma, saturation or colorfullness.\n Histogram shows chromaticity (Lab) before CIECAM.\n Histogram shows C,s,M after CIECAM if checkbox Show CIECAM output is enabled.\n (C,s,M) are not directly shown in histogram panel. \n For final output refer to the Histogram panel
TP_CROP_FIXRATIO;Fix ratio:
TP_CROP_GTDIAGONALS;Rule of Diagonals
TP_CROP_GTEPASSPORT;Biometric Passport
@ -1100,12 +1103,12 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE1;Neutral
TP_LABCURVE_CURVEEDITOR_CC_RANGE2;Dull
TP_LABCURVE_CURVEEDITOR_CC_RANGE3;Pastel
TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturated
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity C=f(C).\n Histogram of Chromaticity before Lab adjustements.\n For final output refer to the Histogram panel
TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity C=f(C).\n Histogram of Chromaticity before Curve adjustements.\n For final output refer to the Histogram panel
TP_LABCURVE_CURVEEDITOR_CH;CH
TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticity according to the hue
TP_LABCURVE_CURVEEDITOR_LC;LC
TP_LABCURVE_CURVEEDITOR_LC_TOOLTIP;Luminance according to the chromaticity
TP_LABCURVE_CURVEEDITOR_LL_TOOLTIP;Luminance Lab L=f(L).\n Histogram of L before Lab adjustements.\n For final output refer to the Histogram panel
TP_LABCURVE_CURVEEDITOR_LL_TOOLTIP;Luminance Lab L=f(L).\n Histogram of L before Curve Lab adjustements.\n For final output refer to the Histogram panel
TP_LABCURVE_LABEL;Lab Adjustments
TP_LABCURVE_RSTPROTECTION;Red and Skin Tones Protection
TP_LENSGEOM_AUTOCROP;Auto Crop

View File

@ -178,20 +178,14 @@ void Crop::update (int todo) {
// parent->ipf.luminanceCurve (labnCrop, labnCrop, parent->lumacurve);
bool utili=false;
bool autili=false;
bool butili=false;
bool ccutili=false;
bool cclutili=false;
LUTu dummy;
CurveFactory::complexsgnCurve (autili, butili,ccutili,cclutili, params.labCurve.chromaticity, params.labCurve.rstprotection,
params.labCurve.acurve, params.labCurve.bcurve,params.labCurve.cccurve,params.labCurve.lccurve, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve,parent->lhskcurve,
dummy, dummy, dummy,
1);
bool utili=true;
bool autili=true;
bool butili=true;
bool ccutili=true;
bool cclutili=true;
parent->ipf.chromiLuminanceCurve (labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->lumacurve, utili, autili, butili, ccutili,cclutili);
// parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay.
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.
@ -205,7 +199,7 @@ void Crop::update (int todo) {
parent->ipf.dirpyrequalizer (labnCrop);
}
parent->ipf.ciecam_02 (labnCrop, &params,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3);
parent->ipf.ciecam_02 (1,labnCrop, &params,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy);
}
// switch back to rgb
parent->ipf.lab2monitorRgb (labnCrop, cropImg);

View File

@ -101,6 +101,7 @@ DetailedCrop* ImProcCoordinator::createCrop () {
return new Crop (this);
}
// todo: bitmask containing desired actions, taken from changesSinceLast
// cropCall: calling crop, used to prevent self-updates
void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
@ -318,8 +319,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
for (int y=0; y<pW; y++) {
pos=CLIP((int)(oprevl->L[x][y]));
lhist16[pos]++;
poscc=CLIP((int)sqrt(oprevl->a[x][y]*oprevl->a[x][y] + oprevl->b[x][y]*oprevl->b[x][y]));
lhist16Clad[poscc]++;
if (y>=y1 && y<y2 && x>=x1 && x<x2) {lhist16Cropped[pos]++;lhist16CroppedClad[poscc]++;}
}
@ -338,29 +337,17 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
if (todo & M_LUMACURVE) {
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,
lhist16Clad, lhist16CroppedClad, histCCurve, scale==1 ? 1 : 16);
lhist16Clad,lhist16CroppedClad, histCCurve, scale==1 ? 1 : 16);
}
if (todo & (M_LUMINANCE+M_COLOR) ) {
nprevl->CopyFrom(oprevl);
// ipf.EPDToneMap(nprevl,0,scale);
progress ("Applying Color Boost...",100*readyphase/numofphases);
int poscc;
ipf.chromiLuminanceCurve (nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve,lhskcurve, lumacurve, utili, autili, butili, ccutili,cclutili);
if(!ccutili){
for (int x=0; x<pH; x++)
for (int y=0; y<pW; y++) {
poscc=CLIP((int)sqrt(nprevl->a[x][y]*nprevl->a[x][y] + nprevl->b[x][y]*nprevl->b[x][y]));
lhist16ClabAF[poscc]++;
}
CurveFactory::updatechroma (
params.labCurve.cccurve,
lhist16ClabAF, lhist16CroppedCCAM,histCCurve,
scale==1 ? 1 : 16);
}
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);
@ -412,11 +399,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
for (int y=0; y<pW; y++) {
pos=CLIP((int)(nprevl->L[x][y]));
posc=CLIP((int)sqrt(nprevl->a[x][y]*nprevl->a[x][y] + nprevl->b[x][y]*nprevl->b[x][y]));
lhist16CCAM[posc]++;
lhist16CAM[pos]++;
if(!params.colorappearance.datacie) lhist16CCAM[posc]++;
if(!params.colorappearance.datacie)lhist16CAM[pos]++;
if (y>=y1 && y<y2 && x>=x1 && x<x2) {lhist16CroppedCAM[pos]++;lhist16CroppedCCAM[posc]++;}
}
LUTu dummy;
CurveFactory::curveLightBrightColor (
params.colorappearance.curveMode, params.colorappearance.curve,
params.colorappearance.curveMode2, params.colorappearance.curve2,
@ -428,20 +415,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) {
customColCurve3,
scale==1 ? 1 : 1);
ipf.ciecam_02 (nprevl, &params, customColCurve1,customColCurve2,customColCurve3);
//update histogram chroma
/* if(!customColCurve3){
for (int x=0; x<pH; x++)
for (int y=0; y<pW; y++) {
posc=CLIP((int)sqrt(nprevl->a[x][y]*nprevl->a[x][y] + nprevl->b[x][y]*nprevl->b[x][y]));
lhist16CCAMAF[posc]++;
}
CurveFactory::updatechroma(
params.colorappearance.curve3,
lhist16CCAMAF, lhist16CroppedCCAM,histCCAM,
scale==1 ? 1 : 1);
//end update histogram chroma
} */
ipf.ciecam_02 (pW, nprevl, &params, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM);
}
// process crop, if needed
for (size_t i=0; i<crops.size(); i++)

View File

@ -42,6 +42,8 @@
#ifdef _OPENMP
#include <omp.h>
#endif
#undef CLIPD
#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f)
namespace rtengine {
@ -233,7 +235,7 @@ void ImProcFunctions::firstAnalysis (Imagefloat* original, const ProcParams* par
}
void ImProcFunctions::ciecam_02 (LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2,const ColorAppearance & customColCurve3 )
void ImProcFunctions::ciecam_02 (int pW, LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve2,const ColorAppearance & customColCurve3, LUTu & histLCAM, LUTu & histCCAM )
{
if(params->colorappearance.enabled) {
@ -241,6 +243,28 @@ if(params->colorappearance.enabled) {
MyTime t1e,t2e;
t1e.set();
#endif
LUTf dLcurve(65536,0);
LUTu hist16JCAM(65536);
bool jp=false;
float val;
if(pW!=1){//only with improccoordinator
for (int i=0; i<32768; i++) { //# 32768*1.414 approximation maxi for chroma
val = (double)i / 32767.0;
dLcurve[i] = CLIPD(val);
}
hist16JCAM.clear();
}
LUTf dCcurve(65536,0);
LUTu hist16_CCAM(65536);
bool chropC=false;
float valc;
if(pW!=1){//only with improccoordinator
for (int i=0; i<48000; i++) { //# 32768*1.414 approximation maxi for chroma
valc = (double)i / 47999.0;
dCcurve[i] = CLIPD(valc);
}
hist16_CCAM.clear();
}
int width = lab->W, height = lab->H;
double Yw;
@ -291,6 +315,7 @@ if(params->colorappearance.enabled) {
else if(mean<90.f) yb=80.0;
else yb=90.0;
bool ciedata=params->colorappearance.datacie;
ColorTemp::temp2mulxyz (params->wb.temperature, params->wb.green, params->wb.method, Xw, Zw); //compute white Xw Yw Zw : white current WB
//viewing condition for surround
@ -373,7 +398,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)
#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)
#endif
{
TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working);
@ -608,6 +633,35 @@ if(params->colorappearance.enabled) {
M=Mpro;
h=hpro;
s=spro;
int posl, posc;
double brli=327.;
double chsacol=327.;
int libr=0;
int colch=0;
if(curveMode==ColorAppearanceParams::TC_MODE_BRIGHT) {brli=70.0; libr=1;}
else if(curveMode==ColorAppearanceParams::TC_MODE_LIGHT) {brli=327.;libr=0;}
if (curveMode3==ColorAppearanceParams::TC_MODE_CHROMA) {chsacol=327.;colch=0;}
else if(curveMode3==ColorAppearanceParams::TC_MODE_SATUR) {chsacol=450.0;colch=1;}
else if(curveMode3==ColorAppearanceParams::TC_MODE_COLORF) {chsacol=327.0;colch=2;}
if(ciedata) {
// Data for J Q M s and C histograms
//update histogram
jp=true;
if(pW!=1){//only with improccoordinator
if(libr==1) posl=CLIP((int)(Q*brli));//40.0 to 100.0 approximative factor for Q - 327 for J
else if(libr==0) posl=CLIP((int)(J*brli));//327 for J
hist16JCAM[posl]++;
}
chropC=true;
if(pW!=1){//only with improccoordinator
if(colch==0) posc=CLIP((int)(C*chsacol));//450.0 approximative factor for s 320 for M
else if(colch==1) posc=CLIP((int)(s*chsacol));
else if(colch==2) posc=CLIP((int)(M*chsacol));
hist16_CCAM[posc]++;
}
}
double xx,yy,zz;
//process normal==> viewing
ColorTemp::jch2xyz_ciecam02( xx, yy, zz,
@ -650,6 +704,29 @@ if(params->colorappearance.enabled) {
}
}
// End of parallelization
if(ciedata) {
//update histogram J
if(pW!=1){//only with improccoordinator
for (int i=0; i<=32768; i++) {//
float val;
if (jp) {
float hval = dLcurve[i];
int hi = (int)(255.0*CLIPD(hval)); //
histLCAM[hi] += hist16JCAM[i] ;
}
}
}
if(pW!=1){//only with improccoordinator
for (int i=0; i<=48000; i++) {//
float valc;
if (chropC) {
float hvalc = dCcurve[i];
int hic = (int)(255.0*CLIPD(hvalc)); //
histCCAM[hic] += hist16_CCAM[i] ;
}
}
}
}
#ifdef _DEBUG
if (settings->verbose) {
@ -1175,12 +1252,11 @@ void ImProcFunctions::luminanceCurve (LabImage* lold, LabImage* lnew, LUTf & cur
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) {
void ImProcFunctions::chromiLuminanceCurve (int pW, LabImage* lold, LabImage* lnew, LUTf & acurve, LUTf & bcurve, LUTf & satcurve,LUTf & lhskcurve, LUTf & curve, bool utili, bool autili, bool butili, bool ccutili, bool cclutili, LUTu &histCCurve) {
int W = lold->W;
int H = lold->H;
// lhskcurve.dump("lh_curve");
//init Flatcurve for C=f(H)
FlatCurve* chCurve = NULL;
bool chutili = false;
@ -1190,6 +1266,17 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
chutili=true;
}//do not use "Munsell" if Chcurve not used
}
LUTf dCcurve(65536,0);
LUTu hist16Clad(65536);
bool chrop=false;
float val;
if(pW!=1){//only with improccoordinator
for (int i=0; i<48000; i++) { //# 32768*1.414 approximation maxi for chroma
val = (double)i / 47999.0;
dCcurve[i] = CLIPD(val);
}
hist16Clad.clear();
}
#ifdef _DEBUG
MyTime t1e,t2e, t3e, t4e;
t1e.set();
@ -1235,7 +1322,7 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
bool ccut = ccutili;
double rstprotection = 100.-params->labCurve.rstprotection; // Red and Skin Tones Protection
// avoid color shift is disabled when bwToning is activated and enabled if gamut is true in colorappearanace
bool avoidColorShift = (params->labCurve.avoidcolorshift || params->colorappearance.gamut) && !bwToning;
bool avoidColorShift = (params->labCurve.avoidcolorshift || params->colorappearance.gamut )&& !bwToning ;
int protectRed = settings->protectred;
double protectRedH = settings->protectredh;
bool gamutLch = settings->gamutLch;
@ -1247,9 +1334,9 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
#ifdef _DEBUG
#pragma omp parallel default(shared) firstprivate(highlight, ccut, chromaticity, bwToning, rstprotection, avoidColorShift, LCredsk, protectRed, protectRedH, gamutLch, lold, lnew, MunsDebugInfo) if (multiThread)
#pragma omp parallel default(shared) firstprivate(highlight, ccut, chromaticity, bwToning, rstprotection, avoidColorShift, LCredsk, protectRed, protectRedH, gamutLch, lold, lnew, MunsDebugInfo, pW) if (multiThread)
#else
#pragma omp parallel default(shared) firstprivate(highlight, ccut, chromaticity, bwToning, rstprotection, avoidColorShift, LCredsk, protectRed, protectRedH, gamutLch, lold, lnew) if (multiThread)
#pragma omp parallel default(shared) firstprivate(highlight, ccut, chromaticity, bwToning, rstprotection, avoidColorShift, LCredsk, protectRed, protectRedH, gamutLch, lold, lnew, pW) if (multiThread)
#endif
{
@ -1287,6 +1374,8 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
float chromaChfactor=1.0f;
float atmp = acurve[lold->a[i][j]+32768.0f]-32768.0f;// curves Lab a
float btmp = bcurve[lold->b[i][j]+32768.0f]-32768.0f;// curves Lab b
int poscc,posp;
// calculate C=f(H)
if (chutili) {
double hr;
@ -1317,7 +1406,7 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
else dred = 40.0f;
// end pyramid
if(chromaticity!=0 && !bwToning){
float chromahist;
float factorskin, factorsat, factor, factorskinext, interm;
float scale = 100.0f/100.1f;//reduction in normal zone
float scaleext=1.0f;//reduction in transition zone
@ -1351,7 +1440,14 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
Color::transitred ( HH, Chprov1, dred, factorskin, protect_red, factorskinext, deltaHH, factorsat, factor);
atmp *= factor;
btmp *= factor;
}
//update histogram C
chrop=true;
if(pW!=1){//only with improccoordinator
posp=CLIP((int)sqrt((atmp*atmp + btmp*btmp)));
hist16Clad[posp]++;
}
// I have placed C=f(C) after all C treatments to assure maximum amplitude of "C"
if (!bwToning && ccut) {
@ -1495,6 +1591,17 @@ void ImProcFunctions::chromiLuminanceCurve (LabImage* lold, LabImage* lnew, LUTf
}
}
} // end of parallelization
//update histogram C with data chromaticity and not with CC curve
if(pW!=1){//only with improccoordinator
for (int i=0; i<=48000; i++) {//32768*1.414 + ...
float val;
if (chrop) {
float hval = dCcurve[i];
int hi = (int)(255.0*CLIPD(hval)); //
histCCurve[hi] += hist16Clad[i] ;
}
}
}
#ifdef _DEBUG
if (settings->verbose) {

View File

@ -92,10 +92,8 @@ 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 (LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3);
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 ciecam_02 (int pW, LabImage* lab, const ProcParams* params , const ColorAppearance & customColCurve1, const ColorAppearance & customColCurve, const ColorAppearance & customColCurve3, LUTu &histLCAM, LUTu &histCCAM);
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);
void sharpening (LabImage* lab, float** buffer);

View File

@ -220,8 +220,9 @@ enum ProcEvent {
EvCATCurveMode2=195,
EvCATCurve3=196,
EvCATCurveMode3=197,
EvCATdatacie=198,
NUMOFEVENTS=198
NUMOFEVENTS=199
};
}
#endif

View File

@ -230,6 +230,7 @@ void ProcParams::setDefaults () {
colorappearance.colorh = 0.0;
colorappearance.surrsource = false;
colorappearance.gamut = true;
colorappearance.datacie = false;
colorappearance.curve.clear ();
colorappearance.curve.push_back(DCT_Linear);
colorappearance.curve2.clear ();
@ -591,6 +592,7 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, ParamsEdited* p
if (!pedited || pedited->colorappearance.adapscen) keyFile.set_double ("Color appearance", "AdaptScene", colorappearance.adapscen);
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.curveMode) {
Glib::ustring method;
switch (colorappearance.curveMode) {
@ -1108,6 +1110,7 @@ if (keyFile.has_group ("Color appearance")) {
if (keyFile.has_key ("Color appearance", "AdaptScene")) {colorappearance.adapscen = keyFile.get_double ("Color appearance", "AdaptScene"); if (pedited) pedited->colorappearance.adapscen = true; }
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", "CurveMode")) {
Glib::ustring sMode = keyFile.get_string ("Color appearance", "CurveMode");
if (sMode == "Lightness") colorappearance.curveMode = ColorAppearanceParams::TC_MODE_LIGHT;

View File

@ -388,6 +388,8 @@ class WBParams {
double rstprotection;
bool surrsource;
bool gamut;
bool datacie;
};
/**

View File

@ -217,7 +217,8 @@ LUMINANCECURVE, // EvCATcurve2
LUMINANCECURVE, // EvCATcurvemode1
LUMINANCECURVE, // EvCATcurvemode2
LUMINANCECURVE, // EvCATcurve3
LUMINANCECURVE // EvCATcurvemode3
LUMINANCECURVE, // EvCATcurvemode3
LUMINANCECURVE // EvCATdatacie
};

View File

@ -791,7 +791,8 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
hist16C, hist16C, dummy,
16);
//ipf.luminanceCurve (labView, labView, curve);
ipf.chromiLuminanceCurve (labView, labView, curve1, curve2, satcurve,lhskcurve, curve, utili, autili, butili, ccutili,cclutili);
ipf.chromiLuminanceCurve (1,labView, labView, curve1, curve2, satcurve,lhskcurve, curve, utili, autili, butili, ccutili,cclutili, dummy);
ipf.vibrance(labView);
ipf.EPDToneMap(labView,0,6);
@ -806,7 +807,7 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
customColCurve3,
16);
ipf.ciecam_02 (labView, &params,customColCurve1,customColCurve2,customColCurve3);
ipf.ciecam_02 (1, labView, &params,customColCurve1,customColCurve2,customColCurve3, dummy, dummy);
// color processing
//ipf.colorCurve (labView, labView);

View File

@ -201,15 +201,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
// start tile processing...???
// luminance histogram update
hist16.clear(); hist16C.clear();
for (int i=0; i<fh; i++)
for (int j=0; j<fw; j++){
hist16[CLIP((int)((labView->L[i][j])))]++;
hist16C=CLIP((int)sqrt(labView->a[i][j]*labView->a[i][j] + labView->b[i][j]*labView->b[i][j]));
}
// luminance processing
// ipf.EPDToneMap(labView);
bool utili=false;
bool autili=false;
bool butili=false;
@ -221,8 +213,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve,params.labCurve.lccurve,curve1, curve2, satcurve,lhskcurve,
hist16C, hist16C,dummy,
1);
//ipf.luminanceCurve (labView, labView, curve);
ipf.chromiLuminanceCurve (labView, labView, curve1, curve2, satcurve,lhskcurve,curve, utili, autili, butili, ccutili,cclutili);
ipf.chromiLuminanceCurve (1,labView, labView, curve1, curve2, satcurve,lhskcurve,curve, utili, autili, butili, ccutili,cclutili,dummy);
ipf.EPDToneMap(labView);
ipf.vibrance(labView);
@ -261,7 +253,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
customColCurve3,
1);
ipf.ciecam_02 (labView, &params,customColCurve1,customColCurve2,customColCurve3);
ipf.ciecam_02 (1, labView, &params,customColCurve1,customColCurve2,customColCurve3, dummy, dummy);
// end tile processing...???
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

View File

@ -263,9 +263,25 @@ ColorAppearance::ColorAppearance () : Gtk::VBox(), FoldableToolPanel(this) {
p2VBox->pack_start( *curveEditorG, Gtk::PACK_SHRINK, 2);
p2VBox->pack_start( *curveEditorG2, Gtk::PACK_SHRINK, 2);
p2VBox->pack_start( *curveEditorG3, Gtk::PACK_SHRINK, 2);
// ------------------------ Choice CIECAM data
datacie = Gtk::manage (new Gtk::CheckButton (M("TP_COLORAPP_DATACIE")));
datacie->set_tooltip_markup (M("TP_COLORAPP_DATACIE_TOOLTIP"));
datacieconn = datacie->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::datacie_toggled) );
p2VBox->pack_start (*datacie);
//-------------------------
p2Frame->add(*p2VBox);
pack_start (*p2Frame, Gtk::PACK_EXPAND_WIDGET, 4);
// ------------------------ Process #3: Converting back to Lab/RGB
@ -387,6 +403,7 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) {
colorh->setEditedState (pedited->colorappearance.colorh ? Edited : UnEdited);
surrsource->set_inconsistent (!pedited->colorappearance.surrsource);
gamut->set_inconsistent (!pedited->colorappearance.gamut);
datacie->set_inconsistent (!pedited->colorappearance.datacie);
degree->setAutoInconsistent (multiImage && !pedited->colorappearance.autodegree);
enabled->set_inconsistent (multiImage && !pedited->colorappearance.enabled);
@ -457,9 +474,13 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) {
gamutconn.block (true);
gamut->set_active (pp->colorappearance.gamut);
gamutconn.block (false);
datacieconn.block (true);
datacie->set_active (pp->colorappearance.datacie);
datacieconn.block (false);
lastsurr=pp->colorappearance.surrsource;
lastgamut=pp->colorappearance.gamut;
lastdatacie=pp->colorappearance.datacie;
lastEnabled = pp->colorappearance.enabled;
lastAutoDegree = pp->colorappearance.autodegree;
@ -509,6 +530,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) {
pp->colorappearance.rstprotection = rstprotection->getValue ();
pp->colorappearance.surrsource = surrsource->get_active();
pp->colorappearance.gamut = gamut->get_active();
pp->colorappearance.datacie = datacie->get_active();
pp->colorappearance.curve = shape->getCurve ();
pp->colorappearance.curve2 = shape2->getCurve ();
pp->colorappearance.curve3 = shape3->getCurve ();
@ -546,6 +568,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) {
pedited->colorappearance.algo = algo->get_active_text()!=M("GENERAL_UNCHANGED");
pedited->colorappearance.surrsource = !surrsource->get_inconsistent();
pedited->colorappearance.gamut = !gamut->get_inconsistent();
pedited->colorappearance.datacie = !datacie->get_inconsistent();
pedited->colorappearance.curve = !shape->isUnChanged ();
pedited->colorappearance.curve2 = !shape2->isUnChanged ();
pedited->colorappearance.curve3 = !shape3->isUnChanged ();
@ -668,6 +691,28 @@ void ColorAppearance::gamut_toggled () {
listener->panelChanged (EvCATgamut, M("GENERAL_DISABLED"));
}
}
void ColorAppearance::datacie_toggled () {
if (batchMode) {
if (datacie->get_inconsistent()) {
datacie->set_inconsistent (false);
datacieconn.block (true);
datacie->set_active (false);
datacieconn.block (false);
}
else if (lastdatacie)
datacie->set_inconsistent (true);
lastdatacie = datacie->get_active ();
}
if (listener) {
if (datacie->get_active ())
listener->panelChanged (EvCATdatacie, M("GENERAL_ENABLED"));
else
listener->panelChanged (EvCATdatacie, M("GENERAL_DISABLED"));
}
}
void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) {

View File

@ -55,6 +55,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
//Adjuster* edge;
Gtk::CheckButton* surrsource;
Gtk::CheckButton* gamut;
Gtk::CheckButton* datacie;
Gtk::CheckButton* enabled;
MyComboBoxText* surround;
@ -64,7 +65,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
MyComboBoxText* algo;
sigc::connection algoconn;
sigc::connection surrconn;
sigc::connection gamutconn;
sigc::connection gamutconn, datacieconn;
sigc::connection tcmodeconn, tcmode2conn, tcmode3conn;
CurveEditorGroup* curveEditorG;
CurveEditorGroup* curveEditorG2;
@ -79,6 +80,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
sigc::connection enaConn;
bool lastsurr;
bool lastgamut;
bool lastdatacie;
bool bgTTipQuery(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
bool srTTipQuery(int x, int y, bool keyboard_tooltip, const Glib::RefPtr<Gtk::Tooltip>& tooltip);
@ -100,6 +102,8 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab
void algoChanged ();
void surrsource_toggled ();
void gamut_toggled ();
void datacie_toggled ();
void curveChanged (CurveEditor* ce);
void curveMode1Changed ();
bool curveMode1Changed_ ();

View File

@ -103,7 +103,8 @@ HistogramPanel::HistogramPanel () {
showGreen->set_active (true);
showBlue->set_active (true);
showValue->set_active (true);
showChro->set_active (true);
showChro->set_active (false);//unactive by default
showRAW->set_active (false);
showFull->set_active (!options.histogramFullMode);
showBAR->set_active (options.histogramBar);
@ -311,8 +312,8 @@ void HistogramPanel::toggle_button_full () {
//
//
// HistogramRGBArea
HistogramRGBArea::HistogramRGBArea () :
frozen(false), valid(false), needRed(true), needGreen(true), needBlue(true), needLuma(true), rawMode(false), showMode(options.histogramBar), barDisplayed(options.histogramBar), needChroma(true){
HistogramRGBArea::HistogramRGBArea () ://needChroma unactive by default
frozen(false), valid(false), needRed(true), needGreen(true), needBlue(true), needLuma(true), rawMode(false), showMode(options.histogramBar), barDisplayed(options.histogramBar), needChroma(false){
harih = new HistogramRGBAreaIdleHelper;
harih->harea = this;
@ -546,8 +547,8 @@ void HistogramRGBArea::styleChanged (const Glib::RefPtr<Gtk::Style>& style) {
//
//
// HistogramArea
HistogramArea::HistogramArea (FullModeListener *fml) :
valid(false), fullMode(options.histogramFullMode), myFullModeListener(fml), oldwidth(-1), needLuma(true), needRed(true), needGreen(true), needBlue(true), rawMode(false), needChroma(true) {
HistogramArea::HistogramArea (FullModeListener *fml) : //needChroma unactive by default
valid(false), fullMode(options.histogramFullMode), myFullModeListener(fml), oldwidth(-1), needLuma(true), needRed(true), needGreen(true), needBlue(true), rawMode(false), needChroma(false) {
lhist(256);
rhist(256);
@ -697,9 +698,9 @@ void HistogramArea::renderHistogram () {
}
if (needChroma && !rawMode) {
drawCurve(cr, chist, realhistheight, winw, winh);
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->fill_preserve ();
cr->set_source_rgb (0.2, 0.2, 0.1);
cr->set_source_rgb (0.6, 0.6, 0.6);
// cr->fill_preserve ();
// cr->set_source_rgb (0.2, 0.2, 0.1);
cr->stroke ();
drawMarks(cr, lhist, realhistheight, winw, ui, oi);

View File

@ -112,6 +112,7 @@ void ParamsEdited::set (bool v) {
colorappearance.rstprotection = v;
colorappearance.surrsource = v;
colorappearance.gamut = v;
colorappearance.datacie = v;
colorappearance.curve = v;
colorappearance.curve2 = v;
colorappearance.curve3 = v;
@ -341,6 +342,7 @@ void ParamsEdited::initFrom (const std::vector<rtengine::procparams::ProcParams>
colorappearance.colorh = colorappearance.colorh && p.colorappearance.colorh == other.colorappearance.colorh;
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.curve3 = colorappearance.curve3 && p.colorappearance.curve3 == other.colorappearance.curve3;
colorappearance.curve2 = colorappearance.curve2 && p.colorappearance.curve2 == other.colorappearance.curve2;
@ -606,6 +608,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (colorappearance.rstprotection) toEdit.colorappearance.rstprotection= dontforceSet && options.baBehav[ADDSET_CAT_RSTPRO] ? toEdit.colorappearance.rstprotection + mods.colorappearance.rstprotection : mods.colorappearance.rstprotection;
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 (impulseDenoise.enabled) toEdit.impulseDenoise.enabled = mods.impulseDenoise.enabled;
if (impulseDenoise.thresh) toEdit.impulseDenoise.thresh = mods.impulseDenoise.thresh;

View File

@ -209,6 +209,8 @@ public:
bool rstprotection;
bool surrsource;
bool gamut;
bool datacie;
};