From 43c7d5b7d7ddac59c04ef893765ec4420b077111 Mon Sep 17 00:00:00 2001 From: jdc Date: Mon, 21 Jan 2013 07:27:35 +0100 Subject: [PATCH] Increase speed CIECAM02 - see issue1682 --- rtdata/languages/Francais | 7 +- rtdata/languages/default | 3 +- rtengine/colortemp.cc | 149 ++++++++++++++++++---------------- rtengine/colortemp.h | 20 ++++- rtengine/dcrop.cc | 4 +- rtengine/improccoordinator.cc | 4 +- rtengine/improcfun.cc | 55 +++++++++---- rtgui/adjuster.cc | 4 +- rtgui/adjuster.h | 2 +- rtgui/colorappearance.cc | 2 +- 10 files changed, 144 insertions(+), 106 deletions(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 683810a50..f9166afd5 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -921,14 +921,15 @@ TP_COLORAPP_CONTRAST_Q;Contraste (Q) TP_COLORAPP_CONTRAST_Q_TOOLTIP;Contraste dans CIECAM02 pour le curseur (Q); est différent du contraste Lab et RVB TP_COLORAPP_CONTRAST_TOOLTIP;Contraste dans CIECAM02 pour le curseur (J); est différent du contraste Lab et RVB TP_COLORAPP_CURVEEDITOR1;Courbe tonale 1 -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_CURVEEDITOR1_TOOLTIP;Histogramme affiche L (lab) avant CIECAM02.\nOn 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;Courbe tonale 2 TP_COLORAPP_CURVEEDITOR2_TOOLTIP;usage similaire aux courbes tonales exposition TP_COLORAPP_CURVEEDITOR3;Courbes chroma 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_COLORAPP_DATACIE;Histogrammes post CIECAM -TP_COLORAPP_DATACIE_TOOLTIP;Quand activé, les histogrammes de fond des courbes CIECAM montrent des valeurs/amplitudes approximatives de J/Q, ou de C:s/M après les ajustements CIECAM.\nCette sélection n'a pas d'incidence sur l'histogramme général.\n\nQuand désactivé, les histogrammes de fond des courbes CIECAM affichent les valeurs Lab avant les ajustements CIECAM -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_DATACIE_TOOLTIP;Quand activé, les histogrammes de fond des courbes CIECAM02 montrent des valeurs/amplitudes approximatives de J/Q, ou de C:s/M après les ajustements CIECAM.\nCette sélection n'a pas d'incidence sur l'histogramme général.\n\nQuand désactivé, les histogrammes de fond des courbes CIECAM affichent les valeurs Lab avant les ajustements CIECAM +TP_COLORAPP_DEGREE_TOOLTIP;Niveau d'adaptation chromatique CIE CAT 2002 +TP_COLORAPP_DEGREE_AUTO_TOOLTIP;Si la case est cochée (recommandé), RT calcule une valeur optimale, qui est utilisé par CAT02, mais aussi pour l'ensemble de CIECAM02.\nVous pouvez décocher la case et changer la valeur du curseur; (les valeurs supérieures à 65 sont recommandées) TP_COLORAPP_EQUAL;Préservé TP_COLORAPP_GAMUT;Contrôle du gamut (Lab) TP_COLORAPP_GAMUT_TOOLTIP;Permet le controle du gamut en mode Lab diff --git a/rtdata/languages/default b/rtdata/languages/default index 91dcba1fb..71aab7e5c 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -928,7 +928,8 @@ TP_COLORAPP_CURVEEDITOR3;Color curve TP_COLORAPP_CURVEEDITOR3_TOOLTIP;Adjust either chroma, saturation or colorfulness.\n\nShows the histogram of chromaticity (Lab) before CIECAM02.\nIf the "Show CIECAM02 output histograms in curves" checkbox is enabled, shows the histogram of C, s or M after CIECAM02.\n\nC, s and M are not shown in the main histogram panel.\nFor final output refer to the main histogram panel TP_COLORAPP_DATACIE;Show CIECAM02 output histograms in curves TP_COLORAPP_DATACIE_TOOLTIP;When enabled, histograms in CIECAM02 curves show approximate values/ranges for J or Q, and C, s or M after the CIECAM02 adjustments.\nThis selection does not impact the main histogram panel.\n\nWhen disabled, histograms in CIECAM02 curves show Lab values before CIECAM02 adjustments -TP_COLORAPP_DEGREE_TOOLTIP;Amount of CIE Chromatic Adaptation Transform 2002\nIf you check the "Automatic" box (to the right), RT will try to find the best value +TP_COLORAPP_DEGREE_TOOLTIP;Amount of CIE Chromatic Adaptation Transform 2002 +TP_COLORAPP_DEGREE_AUTO_TOOLTIP;If the check-box is checked (recommended), RT calculates an optimum value, which is then used by CAT02, and also for the entire CIECAM02.\nTo set the value manually, uncheck the check-box first (values above 65 are recommended) TP_COLORAPP_EQUAL;Equal TP_COLORAPP_GAMUT;Gamut control (Lab) TP_COLORAPP_GAMUT_TOOLTIP;Allow gamut control in Lab mode diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index db0b35925..0433d4ced 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -1905,28 +1905,9 @@ void ColorTemp::calculate_abfloat( float &aa, float &bb, float h, float e, floa } - -void ColorTemp::xyz2jchqms_ciecam02( double &J, double &C, double &h, double &Q, double &M, double &s,double &aw, double &fl, double &wh, - double x, double y, double z, double xw, double yw, double zw, - double yb, double la, double f, double c, double nc, double pilotd, bool doneinit, int gamu) -{ - double r, g, b; - double rw, gw, bw; - double rc, gc, bc; - double rp, gp, bp; - double rpa, gpa, bpa; - double a, ca, cb; - double d; - double n, nbb, ncb; - double e, t; - 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 ); - - if(doneinit){//if one day, we have a pipette... +void ColorTemp::initcam1(double gamu, double yb, double pilotd, double f, double la, double xw, double yw, double zw, double &n, double &d, double &nbb, double &ncb, + double &cz, double &aw, double &wh, double &pfl, double &fl, double &c) +{ n = yb / yw; if(pilotd==2.0) d = d_factor( f, la );else d=pilotd; fl = calculate_fl_from_la_ciecam02( la ); @@ -1935,9 +1916,74 @@ void ColorTemp::xyz2jchqms_ciecam02( double &J, double &C, double &h, double &Q, aw = achromatic_response_to_white( xw, yw, zw, d, fl, nbb, gamu ); wh =( 4.0 / c ) * ( aw + 4.0 ) * pow( fl, 0.25 ); pfl = pow( fl, 0.25 ); - doneinit=false; - } +#ifdef _DEBUG + if (settings->verbose) printf("Source double d=%f aw=%f fl=%f wh=%f\n",d,aw,fl,wh); +#endif +} +void ColorTemp::initcam1float(float gamu, float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb, + float &cz, float &aw, float &wh, float &pfl, float &fl, float &c) +{ + n = yb / yw; + if(pilotd==2.0) d = d_factorfloat( f, la );else d=pilotd; + fl = calculate_fl_from_la_ciecam02float( la ); + nbb = ncb = 0.725f * pow_F( 1.0f / n, 0.2f ); + cz = 1.48f + sqrt( n ); + aw = achromatic_response_to_whitefloat( xw, yw, zw, d, fl, nbb, gamu ); + wh =( 4.0f / c ) * ( aw + 4.0f ) * pow_F( fl, 0.25f ); + pfl = pow_F( fl, 0.25f ); +#ifdef _DEBUG + if (settings->verbose) printf("Source float d=%f aw=%f fl=%f wh=%f\n",d,aw,fl,wh); +#endif + +} + +void ColorTemp::initcam2(double gamu, double yb, double f, double la, double xw, double yw, double zw, double &n, double &d, double &nbb, double &ncb, + double &cz, double &aw, double &fl) +{ + n = yb / yw; + d = d_factor( f, la ); + fl = calculate_fl_from_la_ciecam02( la ); + nbb = ncb = 0.725 * pow( 1.0 / n, 0.2 ); + cz = 1.48 + sqrt( n ); + aw = achromatic_response_to_white( xw, yw, zw, d, fl, nbb, gamu ); +#ifdef _DEBUG + if (settings->verbose) printf("Viewing double d=%f aw=%f fl=%f n=%f\n",d,aw,fl,n); +#endif +} + +void ColorTemp::initcam2float(float gamu, float yb, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb, + float &cz, float &aw, float &fl) +{ + n = yb / yw; + d = d_factorfloat( f, la ); + fl = calculate_fl_from_la_ciecam02float( la ); + nbb = ncb = 0.725f * pow_F( 1.0f / n, 0.2f ); + cz = 1.48f + sqrt( n ); + aw = achromatic_response_to_whitefloat( xw, yw, zw, d, fl, nbb, gamu ); +#ifdef _DEBUG + if (settings->verbose) printf("Viewing float d=%f aw=%f fl=%f n=%f\n",d,aw,fl,n); +#endif + +} + + + +void ColorTemp::xyz2jchqms_ciecam02( double &J, double &C, double &h, double &Q, double &M, double &s,double &aw, double &fl, double &wh, + double x, double y, double z, double xw, double yw, double zw, + double yb, double la, double f, double c, double nc, double pilotd, int gamu , double n, double nbb, double ncb, double pfl, double cz, double d) +{ + double r, g, b; + double rw, gw, bw; + double rc, gc, bc; + double rp, gp, bp; + double rpa, gpa, bpa; + double a, ca, cb; + double e, t; + double myh, myj, myc, myq, mym, mys; + gamu=1; + xyz_to_cat02( r, g, b, x, y, z, gamu ); + xyz_to_cat02( rw, gw, bw, xw, yw, zw, gamu ); rc = r * (((yw * d) / rw) + (1.0 - d)); gc = g * (((yw * d) / gw) + (1.0 - d)); bc = b * (((yw * d) / bw) + (1.0 - d)); @@ -1997,38 +2043,23 @@ void ColorTemp::xyz2jchqms_ciecam02( double &J, double &C, double &h, double &Q, } + void ColorTemp::xyz2jchqms_ciecam02float( float &J, float &C, float &h, float &Q, float &M, float &s,float &aw, float &fl, float &wh, float x, float y, float z, float xw, float yw, float zw, - float yb, float la, float f, float c, float nc, float pilotd, bool doneinit, int gamu) -{ + float yb, float la, float f, float c, float nc, float pilotd, int gamu, float n, float nbb, float ncb, float pfl, float cz, float d) + + { float r, g, b; float rw, gw, bw; float rc, gc, bc; float rp, gp, bp; float rpa, gpa, bpa; float a, ca, cb; - float d; - float n, nbb, ncb; float e, t; - float cz; float myh, myj, myc, myq, mym, mys; - float pfl; gamu=1; xyz_to_cat02float( r, g, b, x, y, z, gamu ); xyz_to_cat02float( rw, gw, bw, xw, yw, zw, gamu ); - - if(doneinit){//if one day, we have a pipette... - n = yb / yw; - if(pilotd==2.0) d = d_factorfloat( f, la );else d=pilotd; - fl = calculate_fl_from_la_ciecam02float( la ); - nbb = ncb = 0.725f * pow_F( 1.0f / n, 0.2f ); - cz = 1.48f + sqrt( n ); - aw = achromatic_response_to_whitefloat( xw, yw, zw, d, fl, nbb, gamu ); - wh =( 4.0f / c ) * ( aw + 4.0f ) * pow_F( fl, 0.25f ); - pfl = pow_F( fl, 0.25f ); - doneinit=false; - } - rc = r * (((yw * d) / rw) + (1.0 - d)); gc = g * (((yw * d) / gw) + (1.0 - d)); bc = b * (((yw * d) / bw) + (1.0 - d)); @@ -2089,33 +2120,19 @@ void ColorTemp::xyz2jchqms_ciecam02float( float &J, float &C, float &h, float &Q } - void ColorTemp::jch2xyz_ciecam02( double &x, double &y, double &z, double J, double C, double h, double xw, double yw, double zw, double yb, double la, - double f, double c, double nc , bool doneinit2, int gamu) + double f, double c, double nc , int gamu, double n, double nbb, double ncb, double fl, double cz, double d, double aw ) { double r, g, b; double rc, gc, bc; double rp, gp, bp; double rpa, gpa, bpa; double rw, gw, bw; - double fl, d; - double n, nbb, ncb; double a, ca, cb; - 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; - d = d_factor( f, la ); - fl = calculate_fl_from_la_ciecam02( la ); - nbb = ncb = 0.725 * pow( 1.0 / n, 0.2 ); - cz = 1.48 + sqrt( n ); - aw = achromatic_response_to_white( xw, yw, zw, d, fl, nbb, gamu ); - doneinit2=false; - } e = ((12500.0 / 13.0) * nc * ncb) * (cos( ((h * M_PI) / 180.0) + 2.0 ) + 3.8); a = pow( J / 100.0, 1.0 / (c * cz) ) * aw; t = pow( C / (sqrt( J / 100) * pow( 1.64 - pow( 0.29, n ), 0.73 )), 10.0 / 9.0 ); @@ -2139,30 +2156,18 @@ void ColorTemp::jch2xyz_ciecam02( double &x, double &y, double &z, double J, dou void ColorTemp::jch2xyz_ciecam02float( float &x, float &y, float &z, float J, float C, float h, float xw, float yw, float zw, float yb, float la, - float f, float c, float nc , bool doneinit2, int gamu) + float f, float c, float nc , int gamu, float n, float nbb, float ncb, float fl, float cz, float d, float aw) + { float r, g, b; float rc, gc, bc; float rp, gp, bp; float rpa, gpa, bpa; float rw, gw, bw; - float fl, d; - float n, nbb, ncb; float a, ca, cb; - float aw; float e, t; - float cz; gamu=1; ColorTemp::xyz_to_cat02float( rw, gw, bw, xw, yw, zw, gamu ); - if(doneinit2){ - n = yb / yw; - d = d_factorfloat( f, la ); - fl = calculate_fl_from_la_ciecam02float( la ); - nbb = ncb = 0.725f * pow_F( 1.0f / n, 0.2f ); - cz = 1.48f + sqrt( n ); - aw = achromatic_response_to_whitefloat( xw, yw, zw, d, fl, nbb, gamu ); - doneinit2=false; - } e = ((12500.0f / 13.0f) * nc * ncb) * (cos( ((h * M_PI) / 180.0f) + 2.0f ) + 3.8f); a = pow_F( J / 100.0f, 1.0f / (c * cz) ) * aw; t = pow_F( C / (sqrt( J / 100.f) * pow_F( 1.64f - pow_F( 0.29f, n ), 0.73f )), 10.0f / 9.0f ); diff --git a/rtengine/colortemp.h b/rtengine/colortemp.h index 2e20acff3..cfa05fbe8 100644 --- a/rtengine/colortemp.h +++ b/rtengine/colortemp.h @@ -299,30 +299,42 @@ class ColorTemp { double J, double C, double h, double xw, double yw, double zw, double yb, double la, - double f, double c, double nc, bool doneinit2, int gamu ); + double f, double c, double nc, int gamu, double n, double nbb, double ncb, double fl, double cz, double d, double aw); static void jch2xyz_ciecam02float( float &x, float &y, float &z, float J, float C, float h, float xw, float yw, float zw, float yb, float la, - float f, float c, float nc, bool doneinit2, int gamu ); + float f, float c, float nc,int gamu,float n, float nbb, float ncb, float fl, float cz, float d, float aw ); /** * Forward transform from XYZ to CIECAM02 JCh. */ + static void initcam1(double gamu, double yb, double pilotd, double f, double la, double xw, double yw, double zw, double &n, double &d, double &nbb, double &ncb, + double &cz, double &aw, double &wh, double &pfl, double &fl, double &c); + + static void initcam2(double gamu, double yb, double f, double la, double xw, double yw, double zw, double &n, double &d, double &nbb, double &ncb, + double &cz, double &aw, double &fl); + + static void initcam1float(float gamu, float yb, float pilotd, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb, + float &cz, float &aw, float &wh, float &pfl, float &fl, float &c); + + static void initcam2float(float gamu, float yb, float f, float la, float xw, float yw, float zw, float &n, float &d, float &nbb, float &ncb, + float &cz, float &aw, float &fl); + static void xyz2jchqms_ciecam02( double &J, double &C, double &h, double &Q, double &M, double &s,double &aw, double &fl, double &wh, double x, double y, double z, double xw, double yw, double zw, double yb, double la, - double f, double c, double nc, double pilotd, bool doneinit1, int gamu ); + double f, double c, double nc, double pilotd,int gamu , double n, double nbb, double ncb, double pfl, double cz, double d ); static void xyz2jchqms_ciecam02float( float &J, float &C, float &h, float &Q, float &M, float &s,float &aw, float &fl, float &wh, float x, float y, float z, float xw, float yw, float zw, float yb, float la, - float f, float c, float nc, float pilotd, bool doneinit1, int gamu ); + float f, float c, float nc, float pilotd, int gamu, float n, float nbb, float ncb, float pfl, float cz, float d ); }; diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index e894eecbe..64f03034e 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -203,8 +203,8 @@ void Crop::update (int todo) { int begh = 0, endh = labnCrop->H; bool execsharp=false; if(skip==1) execsharp=true; - if(settings->ciecamfloat) parent->ipf.ciecam_02float (cieCrop,begh, endh, 1,labnCrop, ¶ms,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy, 5, 1,(float**)cbuffer, execsharp); - else parent->ipf.ciecam_02 (cieCrop,begh, endh, 1,labnCrop, ¶ms,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy, 5, 1,(float**)cbuffer, execsharp); + if(settings->ciecamfloat) {parent->ipf.ciecam_02float (cieCrop,begh, endh, 1,labnCrop, ¶ms,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy, 5, 1,(float**)cbuffer, execsharp);} + else {parent->ipf.ciecam_02 (cieCrop,begh, endh, 1,labnCrop, ¶ms,parent->customColCurve1,parent->customColCurve2,parent->customColCurve3, dummy, dummy, 5, 1,(float**)cbuffer, execsharp);} } // switch back to rgb parent->ipf.lab2monitorRgb (labnCrop, cropImg); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index c6b56c65d..f0305b78d 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -428,8 +428,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { float **buffer = new float*[pH]; for (int i=0; iciecamfloat) ipf.ciecam_02float (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1, (float**)buffer, true); - else ipf.ciecam_02 (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1, (float**)buffer, true); + if(settings->ciecamfloat){ipf.ciecam_02float (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1, (float**)buffer, true);} + else {ipf.ciecam_02 (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1, (float**)buffer, true);} for (int i=0; icolorappearance.enabled) { // settings of WB: scene and viewing if(params->colorappearance.wbmodel=="RawT") {xw1=96.46;yw1=100.0;zw1=82.445;xw2=xwd;yw2=ywd;zw2=zwd;} //use RT WB; CAT 02 is used for output device (see prefreneces) else if(params->colorappearance.wbmodel=="RawTCAT02") {xw1=xw;yw1=yw;zw1=zw;xw2=xwd;yw2=ywd;zw2=zwd;} // Settings RT WB are used for CAT02 => mix , CAT02 is use for output device (screen: D50 D65, projector: lamp, LED) see preferences - bool doneinit=true; - bool doneinit2=true; + double cz,wh, pfl; + ColorTemp::initcam1(gamu, yb, pilot, f, la,xw, yw, zw, n, d, nbb, ncb,cz, aw, wh, pfl, fl, c); + double nj,dj,nbbj,ncbj,czj,awj,flj; + ColorTemp::initcam2(gamu,yb2, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj,czj, awj, flj); + + + + #ifndef _DEBUG -#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) +#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,nc2,f2,c2, alg, gamu, highlight, rstprotection, pW) #endif { //matrix for current working space TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working); @@ -437,7 +443,9 @@ if(params->colorappearance.enabled) { 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; + // double J, C, h, Q, M, s, aw, fl, wh; + double J, C, h, Q, M, s; + double Jp,Cpr; double Jpro,Cpro, hpro, Qpro, Mpro, spro; bool t1L=false; @@ -447,7 +455,7 @@ if(params->colorappearance.enabled) { int c1C=0; int c1s=0; int c1co=0; - + //double n,nbb,ncb,pfl,cz,d; x=(double)x1/655.35; y=(double)y1/655.35; z=(double)z1/655.35; @@ -457,7 +465,7 @@ if(params->colorappearance.enabled) { x, y, z, xw1, yw1, zw1, yb, la, - f, c, nc, pilot, doneinit, gamu ); + f, c, nc, pilot, gamu , n, nbb, ncb, pfl, cz, d ); Jpro=J; Cpro=C; hpro=h; @@ -698,12 +706,13 @@ if(params->colorappearance.enabled) { } } double xx,yy,zz; + //double nj, nbbj, ncbj, flj, czj, dj, awj; //process normal==> viewing ColorTemp::jch2xyz_ciecam02( xx, yy, zz, J, C, h, xw2, yw2, zw2, yb2, la2, - f2, c2, nc2, doneinit2, gamu); + f2, c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); x=(float)xx*655.35; y=(float)yy*655.35; z=(float)zz*655.35; @@ -814,7 +823,7 @@ if((params->colorappearance.tonecie || params->colorappearance.tonecie && (param #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,pW) +#pragma omp parallel default(shared) firstprivate(lab,xw2,yw2,zw2,chr,yb,la2,yb2, height,width,begh, endh, nc2,f2,c2, gamu, highlight,pW) #endif { TMatrix wiprofa = iccStore->workingSpaceInverseMatrix (params->icm.working); @@ -867,11 +876,12 @@ if((params->colorappearance.tonecie || params->colorappearance.tonecie && (param } } //end histograms + // double nd, nbbd, ncbd, fld, czd, dd, awd; 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); + f2, c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); x=(float)xx*655.35; y=(float)yy*655.35; z=(float)zz*655.35; @@ -1114,10 +1124,14 @@ if(params->colorappearance.enabled) { // settings of WB: scene and viewing if(params->colorappearance.wbmodel=="RawT") {xw1=96.46;yw1=100.0;zw1=82.445;xw2=xwd;yw2=ywd;zw2=zwd;} //use RT WB; CAT 02 is used for output device (see prefreneces) else if(params->colorappearance.wbmodel=="RawTCAT02") {xw1=xw;yw1=yw;zw1=zw;xw2=xwd;yw2=ywd;zw2=zwd;} // Settings RT WB are used for CAT02 => mix , CAT02 is use for output device (screen: D50 D65, projector: lamp, LED) see preferences - bool doneinit=true; - bool doneinit2=true; + float cz,wh, pfl; + ColorTemp::initcam1float(gamu, yb, pilot, f, la,xw, yw, zw, n, d, nbb, ncb,cz, aw, wh, pfl, fl, c); + float nj,dj,nbbj,ncbj,czj,awj,flj; + ColorTemp::initcam2float(gamu,yb2, f2, la2, xw2, yw2, zw2, nj, dj, nbbj, ncbj,czj, awj, flj); + + #ifndef _DEBUG -#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) +#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,nc2,f2,c2, alg, gamu, highlight, rstprotection, pW,nj, nbbj, ncbj, flj, czj, dj, awj, n, nbb, ncb, pfl, cz, d) #endif { //matrix for current working space TMatrix wiprof = iccStore->workingSpaceInverseMatrix (params->icm.working); @@ -1142,7 +1156,8 @@ if(params->colorappearance.enabled) { float epsil=0.0001; //convert Lab => XYZ Color::Lab2XYZ(L, a, b, x1, y1, z1); - float J, C, h, Q, M, s, aw, fl, wh; + // float J, C, h, Q, M, s, aw, fl, wh; + float J, C, h, Q, M, s; float Jp,Cpr; float Jpro,Cpro, hpro, Qpro, Mpro, spro; bool t1L=false; @@ -1152,7 +1167,8 @@ if(params->colorappearance.enabled) { int c1C=0; int c1s=0; int c1co=0; - + // float n,nbb,ncb,pfl,cz,d; + x=(float)x1/655.35f; y=(float)y1/655.35f; z=(float)z1/655.35f; @@ -1162,7 +1178,7 @@ if(params->colorappearance.enabled) { x, y, z, xw1, yw1, zw1, yb, la, - f, c, nc, pilot, doneinit, gamu ); + f, c, nc, pilot, gamu, n, nbb, ncb, pfl, cz, d); Jpro=J; Cpro=C; hpro=h; @@ -1404,11 +1420,13 @@ if(params->colorappearance.enabled) { } float xx,yy,zz; //process normal==> viewing + //float nj, nbbj, ncbj, flj, czj, dj, awj; + ColorTemp::jch2xyz_ciecam02float( xx, yy, zz, J, C, h, xw2, yw2, zw2, yb2, la2, - f2, c2, nc2, doneinit2, gamu); + f2, c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); x=(float)xx*655.35f; y=(float)yy*655.35f; z=(float)zz*655.35f; @@ -1521,7 +1539,7 @@ if((params->colorappearance.tonecie && (params->edgePreservingDecompositionUI.en #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,pW) +#pragma omp parallel default(shared) firstprivate(lab,xw2,yw2,zw2,chr,yb,la2,yb2, height,width,begh, endh, nc2,f2,c2, gamu, highlight,pW,nj, nbbj, ncbj, flj, czj, dj, awj) #endif { TMatrix wiprofa = iccStore->workingSpaceInverseMatrix (params->icm.working); @@ -1574,11 +1592,12 @@ if((params->colorappearance.tonecie && (params->edgePreservingDecompositionUI.en } } //end histograms + ColorTemp::jch2xyz_ciecam02float( 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); + f2, c2, nc2, gamu, nj, nbbj, ncbj, flj, czj, dj, awj); x=(float)xx*655.35f; y=(float)yy*655.35f; z=(float)zz*655.35f; diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 9db6e279a..97c928008 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -185,12 +185,12 @@ Adjuster::~Adjuster () { if (automatic) delete automatic; } -void Adjuster::addAutoButton () { +void Adjuster::addAutoButton (Glib::ustring tooltip) { if (!automatic) { automatic = new Gtk::CheckButton (); //automatic->add (*Gtk::manage (new RTImage ("processing.png"))); automatic->set_border_width (0); - automatic->set_tooltip_text (M("GENERAL_AUTO")); + automatic->set_tooltip_markup(tooltip.length() ? Glib::ustring::compose("%1\n\n%2", M("GENERAL_AUTO"), tooltip) : M("GENERAL_AUTO")); autoChange = automatic->signal_toggled().connect( sigc::mem_fun(*this, &Adjuster::autoToggled) ); hbox->pack_end (*automatic, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index 2390d6764..2f1c77e76 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -80,7 +80,7 @@ class Adjuster : public Gtk::VBox { virtual ~Adjuster (); // Add an "Automatic" checkbox next to the reset button. - void addAutoButton(); + void addAutoButton(Glib::ustring tooltip=""); // Remove the "Automatic" checkbox next to the reset button. void delAutoButton(); // Send back the value of og the Auto checkbox diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 58fd51a67..d666143d0 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -57,7 +57,7 @@ ColorAppearance::ColorAppearance () : Gtk::VBox(), FoldableToolPanel(this) { degree = Gtk::manage (new Adjuster (M("TP_COLORAPP_CIECAT_DEGREE"), 0., 100., 1., 100.)); if (degree->delay < 1000) degree->delay = 1000; degree->throwOnButtonRelease(); - degree->addAutoButton(); + degree->addAutoButton(M("TP_COLORAPP_DEGREE_AUTO_TOOLTIP")); degree->set_tooltip_markup (M("TP_COLORAPP_DEGREE_TOOLTIP")); p1VBox->pack_start (*degree);