diff --git a/rtdata/languages/default b/rtdata/languages/default index f29e8cc57..57de48285 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -439,6 +439,8 @@ HISTORY_MSG_201;NR - Delta Chrominance red HISTORY_MSG_202;NR - Delta Chrominance blue HISTORY_MSG_203;NR - Method HISTORY_MSG_204;LMMSE Enhancement Steps +HISTORY_MSG_205;CAM02 hot/bad pixels +HISTORY_MSG_206;CAT02 - Adapt scene auto HISTORY_NEWSNAPSHOTAS;As... HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s @@ -925,8 +927,9 @@ TP_COARSETRAF_TOOLTIP_HFLIP;Flip horizontally TP_COARSETRAF_TOOLTIP_ROTLEFT;Rotate left.\nShortcut: [\n\nShortcut in Single Editor Tab: Alt-[ TP_COARSETRAF_TOOLTIP_ROTRIGHT;Rotate right.\nShortcut: ]\n\nShortcut in Single Editor Tab: Alt-] TP_COARSETRAF_TOOLTIP_VFLIP;Flip vertically -TP_COLORAPP_ADAPTSCENE;Adaptation scene luminosity (cd/m²) -TP_COLORAPP_ADAPTSCENE_TOOLTIP;Absolute luminance of the scene environnement\n(usually 2000cd/m²) +TP_COLORAPP_ADAP_AUTO_TOOLTIP;If the checkbox is checked (recommended) RT calculates an optimum value from Exif data.\nTo set the value manually, uncheck the checkbox first +TP_COLORAPP_ADAPTSCENE;Adaptation scene luminosity +TP_COLORAPP_ADAPTSCENE_TOOLTIP;Absolute luminance of the scene environement(cd/m²).\n 1)Calculated from the Exif data:\nShutter speed - ISO speed - F number - Camera exposure correction.\n 2)Calculated also from Raw White point and RT Exposure compensation TP_COLORAPP_ADAPTVIEWING;Adaptation viewing luminosity (cd/m²) TP_COLORAPP_ADAPTVIEWING_TOOLTIP;Absolute luminance of the viewing environnement\n(usually 16cd/m²) TP_COLORAPP_ALGO;Algorithm @@ -935,6 +938,8 @@ TP_COLORAPP_ALGO_JC;Lightness + Chroma (JC) TP_COLORAPP_ALGO_JS;Lightness + Saturation (JS) TP_COLORAPP_ALGO_QM;Brightness + Colorfulness (QM) TP_COLORAPP_ALGO_TOOLTIP;Lets you choose between parameter subsets or all parameters +TP_COLORAPP_BADPIXSL;Hot/bad pixel filter +TP_COLORAPP_BADPIXSL_TOOLTIP;Suppression of hot/bad (brightly colored) pixels.\n 0=no effect 1=median 2=gaussian.\n\nThese artifacts are due to limitations of CIECAM02. Alternatively, adjust the image to avoid very dark shadows. TP_COLORAPP_BRIGHT;Brightness (Q) TP_COLORAPP_BRIGHT_TOOLTIP;Brightness in CIECAM02 takes into account the white's luminosity and differs from Lab and RGB brightness TP_COLORAPP_CHROMA;Chroma (C) @@ -1126,7 +1131,7 @@ TP_ICM_SAVEREFERENCE;Save Reference Image for Profiling TP_ICM_TONECURVE;Use DCP's tone curve TP_ICM_TONECURVE_TOOLTIP;Enable to use tone curves that may be contained in DCP profiles. TP_ICM_WORKINGPROFILE;Working Profile -TP_IMPULSEDENOISE_LABEL;Impulse Noise Reduction +TP_IMPULSEDENOISE_LABEL;Impulse Noise Reduction (Lab/CIECAM02) TP_IMPULSEDENOISE_THRESH;Threshold TP_LABCURVE_AVOIDCOLORSHIFT;Avoid color shift TP_LABCURVE_AVOIDCOLORSHIFT_TOOLTIP;Fit colors into gamut of the working color space and apply Munsell correction @@ -1178,6 +1183,7 @@ TP_PERSPECTIVE_LABEL;Perspective TP_PERSPECTIVE_VERTICAL;Vertical TP_PREPROCESS_GREENEQUIL;Green Equilibration TP_PREPROCESS_HOTDEADPIXFILT;Hot/Dead pixel filter +TP_PREPROCESS_HOTDEADPIXFILT_TOOLTIP;Try to suppress hot and dead pixels TP_PREPROCESS_LABEL;Preprocessing TP_PREPROCESS_LINEDENOISE;Line Noise Filter TP_PREPROCESS_NO_FOUND;None found diff --git a/rtengine/PF_correct_RT.cc b/rtengine/PF_correct_RT.cc index c361ffb59..59902ed81 100644 --- a/rtengine/PF_correct_RT.cc +++ b/rtengine/PF_correct_RT.cc @@ -27,16 +27,31 @@ #include "gauss.h" #include "improcfun.h" +#include "sleef.c" +#include "mytime.h" #ifdef _OPENMP #include #endif #include "rt_math.h" +#define PIX_SORT(a,b) { if ((a)>(b)) {temp=(a);(a)=(b);(b)=temp;} } + + +#define med3(a0,a1,a2,a3,a4,a5,a6,a7,a8,median) { \ +pp[0]=a0; pp[1]=a1; pp[2]=a2; pp[3]=a3; pp[4]=a4; pp[5]=a5; pp[6]=a6; pp[7]=a7; pp[8]=a8; \ +PIX_SORT(pp[1],pp[2]); PIX_SORT(pp[4],pp[5]); PIX_SORT(pp[7],pp[8]); \ +PIX_SORT(pp[0],pp[1]); PIX_SORT(pp[3],pp[4]); PIX_SORT(pp[6],pp[7]); \ +PIX_SORT(pp[1],pp[2]); PIX_SORT(pp[4],pp[5]); PIX_SORT(pp[7],pp[8]); \ +PIX_SORT(pp[0],pp[3]); PIX_SORT(pp[5],pp[8]); PIX_SORT(pp[4],pp[7]); \ +PIX_SORT(pp[3],pp[6]); PIX_SORT(pp[1],pp[4]); PIX_SORT(pp[2],pp[5]); \ +PIX_SORT(pp[4],pp[7]); PIX_SORT(pp[4],pp[2]); PIX_SORT(pp[6],pp[4]); \ +PIX_SORT(pp[4],pp[2]); median=pp[4];} //pp4 = median using namespace std; namespace rtengine { +extern const Settings* settings; void ImProcFunctions::PF_correct_RT(LabImage * src, LabImage * dst, double radius, int thresh) { int halfwin = ceil(2*radius)+1; @@ -78,15 +93,15 @@ float chromave=0; fringe[i*width+j]=chroma; } } - chromave /= (height*width); + chromave /= (height*width); float threshfactor = (thresh*chromave)/33.f; // Calculated once to eliminate mult inside the next loop -// printf("Chro %f \n",chromave); - -// Issue 1674: -// often, CA isn't evenly distributed, e.g. a lot in contrasty regions and none in the sky. -// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work -// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better -// choice for the chunk_size than 16 +// printf("Chro %f \n",chromave); + +// Issue 1674: +// often, CA isn't evenly distributed, e.g. a lot in contrasty regions and none in the sky. +// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work +// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better +// choice for the chunk_size than 16 #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -139,6 +154,7 @@ void ImProcFunctions::PF_correct_RTcam(CieImage * src, CieImage * dst, double ra // local variables int width=src->W, height=src->H; float piid=3.14159265f/180.f; + static float eps2=0.01f; //temporary array to store chromaticity int (*fringe); fringe = (int (*)) calloc ((height)*(width), sizeof *fringe); @@ -147,7 +163,7 @@ void ImProcFunctions::PF_correct_RTcam(CieImage * src, CieImage * dst, double ra sraa = new float*[height]; for (int i=0; iC_p[i][j]*cos(piid*src->h_p[i][j]); } + */ float** tmaa; tmaa = new float*[height]; for (int i=0; iC_p[i][j]*sin(piid*src->h_p[i][j]); + float2 sincosval = xsincosf(piid*src->h_p[i][j]); + sraa[i][j]=src->C_p[i][j]*sincosval.y; + srbb[i][j]=src->C_p[i][j]*sincosval.x; } float** tmbb; tmbb = new float*[height]; @@ -208,15 +228,15 @@ float chromave=0; fringe[i*width+j]=chroma; } } - chromave /= (height*width); + chromave /= (height*width); float threshfactor = (thresh*chromave)/33.f; // Calculated once to eliminate mult inside the next loop // printf("Chromave CAM %f \n",chromave); -// Issue 1674: -// often, CA isn't evenly distributed, e.g. a lot in contrasty regions and none in the sky. -// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work -// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better -// choice for the chunk_size than 16 +// Issue 1674: +// often, CA isn't evenly distributed, e.g. a lot in contrasty regions and none in the sky. +// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work +// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better +// choice for the chunk_size than 16 #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif @@ -236,13 +256,15 @@ float chromave=0; for (int i1=max(0,i-halfwin+1); i1 0.f){ + tmaa[i][j] = (atot/norm); + tmbb[i][j] = (btot/norm); + } }//end of ab channel averaging } } @@ -256,7 +278,7 @@ float chromave=0; dst->sh_p[i][j] = src->sh_p[i][j]; float intera = tmaa[i][j]; float interb = tmbb[i][j]; - dst->h_p[i][j]=(atan2(interb,intera))/piid; + dst->h_p[i][j]=(xatan2f(interb,intera))/piid; dst->C_p[i][j]=sqrt(SQR(interb)+SQR(intera)); } } @@ -278,7 +300,229 @@ float chromave=0; */ free(fringe); } +void ImProcFunctions::Badpixelscam(CieImage * src, CieImage * dst, double radius, int thresh, int mode) { + #include "rt_math.h" + int halfwin = ceil(2*radius)+1; + MyTime t1,t2; + t1.set(); + //bool algogauss = settings->ciebadpixgauss; + int width=src->W, height=src->H; + float piid=3.14159265f/180.f; + float shfabs, shmed; + int i1, j1, tot; + static float eps = 1.0f; + static float eps2 =0.01f; + float shsum, dirsh, norm, sum; + float** sraa; + sraa = new float*[height]; + for (int i=0; ih_p[i][j]); + sraa[i][j]=src->C_p[i][j]*sincosval.y; + srbb[i][j]=src->C_p[i][j]*sincosval.x; + } + float** tmbb; + tmbb = new float*[height]; + for (int i=0; i buffer(max(src->W,src->H)); + //chroma a and b + if(mode==2) {//choice of gaussian blur + gaussHorizontal (sraa, tmaa, buffer, src->W, src->H, radius); + gaussHorizontal (srbb, tmbb, buffer, src->W, src->H, radius); + gaussVertical (tmaa, tmaa, buffer, src->W, src->H, radius); + gaussVertical (tmbb, tmbb, buffer, src->W, src->H, radius); + } + //luma sh_p + gaussHorizontal (src->sh_p, tmL, buffer, src->W, src->H, 2.0);//low value to avoid artifacts + gaussVertical (tmL, tmL, buffer, src->W, src->H, 2.0); + + } +if(mode==1){ //choice of median +#pragma omp parallel + { +#pragma omp for + for (int i=0; iheight-3) {in=i-2;} else {in=i+2;} + for (int j=0; jwidth-3) {jn=j-2;} else {jn=j+2;} + med3(sraa[ip][jp],sraa[ip][j],sraa[ip][jn],sraa[i][jp],sraa[i][j],sraa[i][jn],sraa[in][jp],sraa[in][j],sraa[in][jn],tmaa[i][j]); + } + } +#pragma omp for + for (int i=0; iheight-3) {in=i-2;} else {in=i+2;} + for (int j=0; jwidth-3) {jn=j-2;} else {jn=j+2;} + med3(srbb[ip][jp],srbb[ip][j],srbb[ip][jn],srbb[i][jp],srbb[i][j],srbb[i][jn],srbb[in][jp],srbb[in][j],srbb[in][jn],tmbb[i][j]); + } + } + } +} + +//luma badpixels +float sh_thr = 4.5f;//low value for luma sh_p to avoid artifacts +float shthr = sh_thr / 24.0f; + +#ifdef _OPENMP + #pragma omp parallel for private(shfabs, shmed,i1,j1) +#endif + for (int i=0; i < height; i++) + for (int j=0; j < width; j++) { + shfabs = fabs(src->sh_p[i][j]-tmL[i][j]); + for (i1=max(0,i-2), shmed=0; i1<=min(i+2,height-1); i1++ ) + for (j1=max(0,j-2); j1<=min(j+2,width-1); j1++ ) { + shmed += fabs(src->sh_p[i1][j1]-tmL[i1][j1]); + } + badpix[i][j] = (shfabs>((shmed-shfabs)*shthr)); + } +#ifdef _OPENMP + #pragma omp parallel for private(shsum,norm,dirsh,sum,i1,j1) schedule(dynamic,16) +#endif + for (int i=0; i < height; i++) + for (int j=0; j < width; j++) { + if (!badpix[i][j]) continue; + norm=0.0f; + shsum=0.0f; + sum=0.0f; + tot=0; + for (i1=max(0,i-2), shmed=0; i1<=min(i+2,height-1); i1++ ) + for (j1=max(0,j-2); j1<=min(j+2,width-1); j1++ ) { + if (i1==i && j1==j) continue; + if (badpix[i1][j1]) continue; + sum += src->sh_p[i1][j1]; tot++; + dirsh = 1.f/(SQR(src->sh_p[i1][j1]-src->sh_p[i][j])+eps); + shsum += dirsh*src->sh_p[i1][j1]; + norm += dirsh; + } + if (norm > 0.f) { + src->sh_p[i][j]=shsum/norm; + } + else { + if(tot > 0) src->sh_p[i][j]=sum / tot; + } + } +// end luma badpixels + +// begin chroma badpixels +float chrommed=0.f; +#ifdef _OPENMP +#pragma omp parallel for reduction(+:chrommed) +#endif + for(int i = 0; i < height; i++ ) { + for(int j = 0; j < width; j++) { + float chroma =SQR(sraa[i][j]-tmaa[i][j])+SQR(srbb[i][j]-tmbb[i][j]); + chrommed += chroma; + badpix[i][j]=chroma; + } + } + chrommed /= (height*width); + float threshfactor = (thresh*chrommed)/33.f; + +#ifdef _OPENMP +#pragma omp parallel for schedule(dynamic,16) +#endif + for(int i = 0; i < height; i++ ) { + for(int j = 0; j < width; j++) { + tmaa[i][j] = sraa[i][j]; + tmbb[i][j] = srbb[i][j]; + + if (badpix[i][j]>threshfactor) { + float atot=0.f; + float btot=0.f; + float norm=0.f; + float wt; + for (int i1=max(0,i-halfwin+1); i1 0.f){ + tmaa[i][j] = (atot/norm); + tmbb[i][j] = (btot/norm); + } + } + } + } + +#ifdef _OPENMP +#pragma omp parallel for +#endif + for(int i = 0; i < height; i++ ) { + for(int j = 0; j < width; j++) { + dst->sh_p[i][j] = src->sh_p[i][j]; + float intera = tmaa[i][j]; + float interb = tmbb[i][j]; + dst->h_p[i][j]=(xatan2f(interb,intera))/piid; + dst->C_p[i][j]=sqrt(SQR(interb)+SQR(intera)); + } + } + for (int i=0; iverbose ) + printf("Ciecam badpixels:- %d usec\n", t2.etime(t1)); + + } +} +#undef PIX_SORT +#undef med3 diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 2f8e7cc8e..d96713c71 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -191,7 +191,8 @@ void Crop::update (int todo) { // parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay. // for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled if (skip==1) { - parent->ipf.impulsedenoise (labnCrop); + if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + parent->ipf.impulsedenoise (labnCrop);} if((params.colorappearance.enabled && !settings->autocielab) ||(!params.colorappearance.enabled) ) {parent->ipf.defringe (labnCrop);} parent->ipf.MLsharpen (labnCrop); if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 13a290659..6a7f8c955 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -327,9 +327,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { // for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled readyphase++; if (scale==1) { + if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)){ progress ("Denoising luminance impulse...",100*readyphase/numofphases); ipf.impulsedenoise (nprevl); readyphase++; + } if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)){ progress ("Defringing...",100*readyphase/numofphases); ipf.defringe (nprevl); @@ -385,6 +387,23 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { if (y>=y1 && y=x1 && xgetMetaData()->getFNumber ();// F number + float fiso = imgsrc->getMetaData()->getISOSpeed () ;// ISO + float fspeed = imgsrc->getMetaData()->getShutterSpeed () ;//speed + float fcomp = imgsrc->getMetaData()->getExpComp ();//compensation + - + float adap; + if(fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) adap=2000.f;//if no exif data or wrong + else { + float E_V = fcomp + log2 ((fnum*fnum) / fspeed / (fiso/100.f)); + float expo2= params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV + E_V += expo2; + float expo1;//exposure raw white point + expo1=log2(params.raw.expos);//log2 ==>linear to EV + E_V += expo1; + adap = powf(2.f, E_V-3.f);//cd / m2 + //end calculation adaptation scene luminosity + } CurveFactory::curveLightBrightColor ( params.colorappearance.curveMode, params.colorappearance.curve, params.colorappearance.curveMode2, params.colorappearance.curve2, @@ -407,9 +426,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) { if(scale==1) execsharp=true; if(settings->ciecamfloat){ipf.ciecam_02float (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1, (float**)buffer, execsharp, d); if(params.colorappearance.autodegree && acListener && params.colorappearance.enabled) acListener->autoCamChanged(100.*(double)d); + if(params.colorappearance.autoadapscen && acListener && params.colorappearance.enabled) acListener->adapCamChanged(adap);//real value of adapt scene luminosity } else {ipf.ciecam_02 (ncie, begh, endh, pW, nprevl, ¶ms, customColCurve1,customColCurve2,customColCurve3, histLCAM, histCCAM, 5, 1, (float**)buffer, execsharp, dd); - if(params.colorappearance.autodegree && acListener && params.colorappearance.enabled) acListener->autoCamChanged(100.*dd); + if(params.colorappearance.autodegree && acListener && params.colorappearance.enabled) acListener->autoCamChanged(100.*dd); + if(params.colorappearance.autoadapscen && acListener && params.colorappearance.enabled) acListener->adapCamChanged(adap); + } for (int i=0; iautocielab) { //if(params->colorappearance.sharpcie) { //all this treatments reduce artifacts, but can lead to slightly different results -if(params->defringe.enabled) if(execsharp) ImProcFunctions::defringecam (ncie);//defringe adapted to CIECAM +if(params->defringe.enabled) if(execsharp) ImProcFunctions::defringecam (ncie);// + +if(params->colorappearance.badpixsl > 0) { int mode=params->colorappearance.badpixsl; + ImProcFunctions::badpixcam (ncie, 3.4, 5, mode);//for bad pixels + } + if (params->sharpenMicro.enabled)if(execsharp) ImProcFunctions::MLmicrocontrastcam(ncie); @@ -903,7 +908,8 @@ if(params->dirpyrequalizer.enabled) if(execsharp) dirpyr_equalizercam(ncie, ncie } if((params->colorappearance.tonecie || (params->colorappearance.tonecie && params->edgePreservingDecompositionUI.enabled)) || (params->sharpening.enabled && settings->autocielab) - || (params->dirpyrequalizer.enabled && settings->autocielab) ||(params->defringe.enabled && settings->autocielab) || (params->sharpenMicro.enabled && settings->autocielab)) { + || (params->dirpyrequalizer.enabled && settings->autocielab) ||(params->defringe.enabled && settings->autocielab) || (params->sharpenMicro.enabled && settings->autocielab) + || (params->colorappearance.badpixsl > 0 && settings->autocielab)) { if(params->edgePreservingDecompositionUI.enabled && params->colorappearance.tonecie && algepd) ImProcFunctions::EPDToneMapCIE(ncie, a_w, c_, w_h, width, height, begh, endh, minQ, maxQ, Iterates, scale ); //EPDToneMapCIE adapted to CIECAM @@ -1651,9 +1657,18 @@ if(!params->colorappearance.tonecie || !settings->autocielab){//normal if(settings->autocielab) { + + //all this treatments reduce artefacts, but can leed to slighty different results + if(params->defringe.enabled) if(execsharp) ImProcFunctions::defringecam (ncie);//defringe adapted to CIECAM +if(params->colorappearance.badpixsl > 0) { int mode=params->colorappearance.badpixsl; + ImProcFunctions::badpixcam (ncie, 3.0, 10, mode);//for bad pixels + } + +if(params->impulseDenoise.enabled) if(execsharp) ImProcFunctions::impulsedenoisecam (ncie);//impulse adapted to CIECAM + if (params->sharpenMicro.enabled)if(execsharp) ImProcFunctions::MLmicrocontrastcam(ncie); if(params->sharpening.enabled) if(execsharp) {ImProcFunctions::sharpeningcam (ncie, (float**)buffer);} //sharpening adapted to CIECAM @@ -1680,7 +1695,8 @@ if(params->dirpyrequalizer.enabled) if(execsharp) dirpyr_equalizercam(ncie, ncie } } if((params->colorappearance.tonecie && (params->edgePreservingDecompositionUI.enabled)) || (params->sharpening.enabled && settings->autocielab) - || (params->dirpyrequalizer.enabled && settings->autocielab) ||(params->defringe.enabled && settings->autocielab) || (params->sharpenMicro.enabled && settings->autocielab)) { + || (params->dirpyrequalizer.enabled && settings->autocielab) ||(params->defringe.enabled && settings->autocielab) || (params->sharpenMicro.enabled && settings->autocielab) + || (params->impulseDenoise.enabled && settings->autocielab) || (params->colorappearance.badpixsl >0 && settings->autocielab)){ if(params->edgePreservingDecompositionUI.enabled && params->colorappearance.tonecie && algepd) ImProcFunctions::EPDToneMapCIE(ncie, a_w, c_, w_h, width, height, begh, endh, minQ, maxQ, Iterates, scale ); //EPDToneMapCIE adated to CIECAM @@ -2868,6 +2884,13 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) { impulse_nr (lab, (float)params->impulseDenoise.thresh/20.0 ); } + void ImProcFunctions::impulsedenoisecam (CieImage* ncie) { + + if (params->impulseDenoise.enabled && ncie->W>=8 && ncie->H>=8) + + impulse_nrcam (ncie, (float)params->impulseDenoise.thresh/20.0 ); + } + void ImProcFunctions::defringe (LabImage* lab) { if (params->defringe.enabled && lab->W>=8 && lab->H>=8) @@ -2876,10 +2899,12 @@ void ImProcFunctions::colorCurve (LabImage* lold, LabImage* lnew) { } void ImProcFunctions::defringecam (CieImage* ncie) { - - if (params->defringe.enabled && ncie->W>=8 && ncie->H>=8) - - PF_correct_RTcam(ncie, ncie, params->defringe.radius, params->defringe.threshold); + if (params->defringe.enabled && ncie->W>=8 && ncie->H>=8) PF_correct_RTcam(ncie, ncie, params->defringe.radius, params->defringe.threshold); + + } + + void ImProcFunctions::badpixcam(CieImage* ncie, double rad, int thr, int mode){ + if(ncie->W>=8 && ncie->H>=8) Badpixelscam(ncie, ncie, rad, thr, mode); } void ImProcFunctions::dirpyrequalizer (LabImage* lab) { @@ -2991,16 +3016,16 @@ float rew=params->edgePreservingDecompositionUI.ReweightingIterates; EdgePreservingDecomposition epd = EdgePreservingDecomposition(lab->W, lab->H); - //Due to the taking of logarithms, L must be nonnegative. Further, scale to 0 to 1 using nominal range of L, 0 to 15 bit. - float minL = FLT_MAX; -#pragma omp parallel -{ - float lminL = FLT_MAX; + //Due to the taking of logarithms, L must be nonnegative. Further, scale to 0 to 1 using nominal range of L, 0 to 15 bit. + float minL = FLT_MAX; +#pragma omp parallel +{ + float lminL = FLT_MAX; #pragma omp for for(i = 0; i < N; i++) - if(L[i] < lminL) lminL = L[i]; -#pragma omp critical - if(lminL < minL) minL = lminL; + if(L[i] < lminL) lminL = L[i]; +#pragma omp critical + if(lminL < minL) minL = lminL; } if(minL > 0.0f) minL = 0.0f; //Disable the shift if there are no negative numbers. I wish there were just no negative numbers to begin with. #pragma omp parallel for @@ -3032,7 +3057,7 @@ fclose(f);*/ for(int ii = 0; ii < N; ii++) a[ii] *= s, b[ii] *= s, - L[ii] = L[ii]*32767.0f + minL; + L[ii] = L[ii]*32767.0f + minL; } diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index d8da28a25..cd986069c 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -117,7 +117,10 @@ class ImProcFunctions { void MLmicrocontrastcam(CieImage* ncie ); //Manuel's microcontrast void impulsedenoise (LabImage* lab);//Emil's impulse denoise + void impulsedenoisecam (CieImage* ncie); void impulse_nr (LabImage* lab, double thresh); + void impulse_nrcam (CieImage* ncie, double thresh); + void dirpyrdenoise (LabImage* src);//Emil's pyramid denoise void dirpyrequalizer (LabImage* lab);//Emil's equalizer @@ -166,10 +169,13 @@ class ImProcFunctions { void dirpyr_channel (float ** data_fine, float ** data_coarse, int width, int height, LUTf & rangefn, int level, int scale, const double * mult ); void idirpyr_eq_channel (float ** data_coarse, float ** data_fine, float ** buffer, int width, int height, int level, const double * mult ); - void defringe (LabImage* lab); - void defringecam (CieImage* ncie); + void defringe (LabImage* lab); + void defringecam (CieImage* ncie); + void badpixcam (CieImage* ncie, double rad, int thr, int mode); + void PF_correct_RT (LabImage * src, LabImage * dst, double radius, int thresh); void PF_correct_RTcam (CieImage * src, CieImage * dst, double radius, int thresh); + void Badpixelscam(CieImage * src, CieImage * dst, double radius, int thresh, int mode); 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 diff --git a/rtengine/impulse_denoise.h b/rtengine/impulse_denoise.h index 4d911201c..5bb95c8a5 100644 --- a/rtengine/impulse_denoise.h +++ b/rtengine/impulse_denoise.h @@ -23,6 +23,8 @@ #include "rt_math.h" #include "labimage.h" #include "improcfun.h" +#include "cieimage.h" +#include "sleef.c" using namespace std; @@ -75,10 +77,10 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) { //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% float impthr = max(1.0,5.5-thresh); - float impthrDiv24 = impthr / 24.0f; //Issue 1671: moved the Division outside the loop, impthr can be optimized out too, but I let in the code at the moment - -#ifdef _OPENMP - #pragma omp parallel for private(hpfabs, hfnbrave,i1,j1) + float impthrDiv24 = impthr / 24.0f; //Issue 1671: moved the Division outside the loop, impthr can be optimized out too, but I let in the code at the moment + +#ifdef _OPENMP + #pragma omp parallel for private(hpfabs, hfnbrave,i1,j1) #endif for (int i=0; i < height; i++) for (int j=0; j < width; j++) { @@ -92,15 +94,15 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) { impish[i][j] = (hpfabs>((hfnbrave-hpfabs)*impthrDiv24)); }//now impulsive values have been identified - -// Issue 1671: -// often, noise isn't evenly distributed, e.g. only a few noisy pixels in the bright sky, but many in the dark foreground, -// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work -// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better -// choice for the chunk_size than 16 -// race conditions are avoided by the array impish -#ifdef _OPENMP - #pragma omp parallel for private(wtdsum,norm,dirwt,i1,j1) schedule(dynamic,16) + +// Issue 1671: +// often, noise isn't evenly distributed, e.g. only a few noisy pixels in the bright sky, but many in the dark foreground, +// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work +// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better +// choice for the chunk_size than 16 +// race conditions are avoided by the array impish +#ifdef _OPENMP + #pragma omp parallel for private(wtdsum,norm,dirwt,i1,j1) schedule(dynamic,16) #endif for (int i=0; i < height; i++) for (int j=0; j < width; j++) { @@ -135,6 +137,147 @@ void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) { } +void ImProcFunctions::impulse_nrcam (CieImage* ncie, double thresh) { + + + // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // impulse noise removal + // local variables + + int width = ncie->W; + int height = ncie->H; + + float hpfabs, hfnbrave; + float piid=3.14159265f/180.f; + // buffer for the lowpass image + float ** lpf = new float *[height]; + // buffer for the highpass image + float ** impish = new float *[height]; + for (int i=0; ih_p[i][j]); + sraa[i][j]=ncie->C_p[i][j]*sincosval.y; + srbb[i][j]=ncie->C_p[i][j]*sincosval.x; + } + //The cleaning algorithm starts here + + + + //rangeblur (lab->L, lpf, impish /*used as buffer here*/, width, height, thresh, false); +#ifdef _OPENMP + #pragma omp parallel +#endif + { + AlignedBufferMP buffer(max(width,height)); + gaussHorizontal (ncie->sh_p, lpf, buffer, width, height, max(2.0,thresh-1.0)); + gaussVertical (lpf, lpf, buffer, width, height, max(2.0,thresh-1.0)); + } + + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + float impthr = max(1.0f,5.0f-(float)thresh); + float impthrDiv24 = impthr / 24.0f; //Issue 1671: moved the Division outside the loop, impthr can be optimized out too, but I let in the code at the moment + +#ifdef _OPENMP + #pragma omp parallel for private(hpfabs, hfnbrave,i1,j1) +#endif + for (int i=0; i < height; i++) + for (int j=0; j < width; j++) { + + hpfabs = fabs(ncie->sh_p[i][j]-lpf[i][j]); + //block average of high pass data + for (i1=max(0,i-2), hfnbrave=0; i1<=min(i+2,height-1); i1++ ) + for (j1=max(0,j-2); j1<=min(j+2,width-1); j1++ ) { + hfnbrave += fabs(ncie->sh_p[i1][j1]-lpf[i1][j1]); + } + impish[i][j] = (hpfabs>((hfnbrave-hpfabs)*impthrDiv24)); + + }//now impulsive values have been identified + + +// Issue 1671: +// often, noise isn't evenly distributed, e.g. only a few noisy pixels in the bright sky, but many in the dark foreground, +// so it's better to schedule dynamic and let every thread only process 16 rows, to avoid running big threads out of work +// Measured it and in fact gives better performance than without schedule(dynamic,16). Of course, there could be a better +// choice for the chunk_size than 16 +// race conditions are avoided by the array impish +#ifdef _OPENMP + #pragma omp parallel for private(wtdsum,norm,dirwt,i1,j1) schedule(dynamic,16) +#endif + for (int i=0; i < height; i++) + for (int j=0; j < width; j++) { + if (!impish[i][j]) continue; + norm=0.0f; + wtdsum[0]=wtdsum[1]=wtdsum[2]=0.0f; + for (i1=max(0,i-2), hfnbrave=0; i1<=min(i+2,height-1); i1++ ) + for (j1=max(0,j-2); j1<=min(j+2,width-1); j1++ ) { + if (i1==i && j1==j) continue; + if (impish[i1][j1]) continue; + dirwt = 1.f/(SQR(ncie->sh_p[i1][j1]-ncie->sh_p[i][j])+eps);//use more sophisticated rangefn??? + wtdsum[0] += dirwt*ncie->sh_p[i1][j1]; + wtdsum[1] += dirwt*sraa[i1][j1]; + wtdsum[2] += dirwt*srbb[i1][j1]; + norm += dirwt; + } + //wtdsum /= norm; + if (norm) { + ncie->sh_p[i][j]=wtdsum[0]/norm;//low pass filter + sraa[i][j]=wtdsum[1]/norm;//low pass filter + srbb[i][j]=wtdsum[2]/norm;//low pass filter + } + + }//now impulsive values have been corrected + + for(int i = 0; i < height; i++ ) { + for(int j = 0; j < width; j++) { + float intera = sraa[i][j]; + float interb = srbb[i][j]; + ncie->h_p[i][j]=(xatan2f(interb,intera))/piid; + ncie->C_p[i][j]=sqrt(SQR(interb)+SQR(intera)); + } + } + + for (int i=0; icolorappearance.surround) keyFile.set_string ("Color appearance", "Surround", colorappearance.surround); // if (!pedited || pedited->colorappearance.backgrd) keyFile.set_integer ("Color appearance", "Background", colorappearance.backgrd); if (!pedited || pedited->colorappearance.adaplum) keyFile.set_double ("Color appearance", "AdaptLum", colorappearance.adaplum); + if (!pedited || pedited->colorappearance.badpixsl) keyFile.set_integer ("Color appearance", "Badpixsl", colorappearance.badpixsl); if (!pedited || pedited->colorappearance.wbmodel) keyFile.set_string ("Color appearance", "Model", colorappearance.wbmodel); if (!pedited || pedited->colorappearance.algo) keyFile.set_string ("Color appearance", "Algorithm", colorappearance.algo); @@ -599,8 +603,10 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, ParamsEdited* p if (!pedited || pedited->colorappearance.rstprotection) keyFile.set_double ("Color appearance", "RSTProtection", colorappearance.rstprotection); if (!pedited || pedited->colorappearance.adapscen) keyFile.set_double ("Color appearance", "AdaptScene", colorappearance.adapscen); + if (!pedited || pedited->colorappearance.autoadapscen) keyFile.set_boolean ("Color appearance", "AutoAdapscen", colorappearance.autoadapscen); 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.badpix) keyFile.set_boolean ("Color appearance", "Badpix", colorappearance.badpix); 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.sharpcie) keyFile.set_boolean ("Color appearance", "Sharpcie", colorappearance.sharpcie); @@ -1121,6 +1127,7 @@ if (keyFile.has_group ("Color appearance")) { if (keyFile.has_key ("Color appearance", "Surround")) {colorappearance.surround = keyFile.get_string ("Color appearance", "Surround"); if (pedited) pedited->colorappearance.surround = true; } // if (keyFile.has_key ("Color appearance", "Background")) {colorappearance.backgrd = keyFile.get_integer ("Color appearance", "Background"); if (pedited) pedited->colorappearance.backgrd = true; } if (keyFile.has_key ("Color appearance", "AdaptLum")) {colorappearance.adaplum = keyFile.get_double ("Color appearance", "AdaptLum"); if (pedited) pedited->colorappearance.adaplum = true; } + if (keyFile.has_key ("Color appearance", "Badpixsl")) {colorappearance.badpixsl = keyFile.get_integer ("Color appearance", "Badpixsl"); if (pedited) pedited->colorappearance.badpixsl = true; } if (keyFile.has_key ("Color appearance", "Model")) {colorappearance.wbmodel = keyFile.get_string ("Color appearance", "Model"); if (pedited) pedited->colorappearance.wbmodel = true; } if (keyFile.has_key ("Color appearance", "Algorithm")) {colorappearance.algo = keyFile.get_string ("Color appearance", "Algorithm"); if (pedited) pedited->colorappearance.algo = true; } if (keyFile.has_key ("Color appearance", "J-Light")) {colorappearance.jlight = keyFile.get_double ("Color appearance", "J-Light"); if (pedited) pedited->colorappearance.jlight = true; } @@ -1133,8 +1140,10 @@ if (keyFile.has_group ("Color appearance")) { if (keyFile.has_key ("Color appearance", "Q-Contrast")) {colorappearance.qcontrast = keyFile.get_double ("Color appearance", "Q-Contrast"); if (pedited) pedited->colorappearance.qcontrast = true; } if (keyFile.has_key ("Color appearance", "H-Hue")) {colorappearance.colorh = keyFile.get_double ("Color appearance", "H-Hue"); if (pedited) pedited->colorappearance.colorh = true; } 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", "AutoAdapscen")) {colorappearance.autoadapscen = keyFile.get_boolean ("Color appearance", "AutoAdapscen"); if (pedited) pedited->colorappearance.autoadapscen = 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", "Badpix")) {colorappearance.badpix = keyFile.get_boolean ("Color appearance", "Badpix"); if (pedited) pedited->colorappearance.badpix = 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", "Sharpcie")) {colorappearance.sharpcie = keyFile.get_boolean ("Color appearance", "Sharpcie"); if (pedited) pedited->colorappearance.sharpcie = true; } @@ -1539,7 +1548,9 @@ bool ProcParams::operator== (const ProcParams& other) { && colorappearance.autodegree == other.colorappearance.autodegree && colorappearance.surround == other.colorappearance.surround && colorappearance.adapscen == other.colorappearance.adapscen + && colorappearance.autoadapscen == other.colorappearance.autoadapscen && colorappearance.adaplum == other.colorappearance.adaplum + && colorappearance.badpixsl == other.colorappearance.badpixsl && colorappearance.wbmodel == other.colorappearance.wbmodel && colorappearance.algo == other.colorappearance.algo && colorappearance.curveMode == other.colorappearance.curveMode diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 5d5f9ec37..5a3e9a484 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -375,7 +375,10 @@ class WBParams { Glib::ustring surround; double adapscen; + bool autoadapscen; + double adaplum; + int badpixsl; Glib::ustring wbmodel; Glib::ustring algo; double contrast; @@ -389,6 +392,7 @@ class WBParams { double rstprotection; bool surrsource; bool gamut; + // bool badpix; bool datacie; bool tonecie; // bool sharpcie; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 46bd349b1..2ba94b635 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -223,7 +223,9 @@ LUMINANCECURVE, // EvCATtonecie ALLNORAW, // EvDPDNbluechro ALLNORAW, // EvDPDNperform ALLNORAW, //EvDPDNmet -DEMOSAIC // EvDemosaicLMMSEIter +DEMOSAIC, // EvDemosaicLMMSEIter +LUMINANCECURVE, // EvCATbadpix +LUMINANCECURVE // EvCATAutoadap //LUMINANCECURVE // EvCATsharpcie diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 884d9e97e..13d09a8c5 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -252,6 +252,8 @@ namespace rtengine { class AutoCamListener { public : virtual void autoCamChanged (double ccam) {} + virtual void adapCamChanged (double cadap) {} + }; /** This class represents a detailed part of the image (looking through a kind of window). * It can be created and destroyed with the appropriate members of StagedImageProcessor. diff --git a/rtengine/settings.h b/rtengine/settings.h index 963687a9b..0993dc94e 100644 --- a/rtengine/settings.h +++ b/rtengine/settings.h @@ -52,6 +52,7 @@ namespace rtengine { bool ciecamfloat; int protectred; double protectredh; + bool ciebadpixgauss; int CRI_color; // N° for display Lab value ; 0 disabled /** Creates a new instance of Settings. diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 981c6149c..ca708e410 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -28,6 +28,8 @@ #include #include "rawimagesource.h" #include "../rtgui/ppversion.h" +//#include "mytime.h" + #undef THREAD_PRIORITY_NORMAL #ifdef _OPENMP #include @@ -90,6 +92,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p params.crop.h = fh-params.crop.y; } } +// MyTime t1,t2; +// t1.set(); ImProcFunctions ipf (¶ms, true); @@ -244,7 +248,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ipf.vibrance(labView); - ipf.impulsedenoise (labView); + if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) ipf.impulsedenoise (labView); // for all treatments Defringe, Sharpening, Contrast detail ,Microcontrast they are activated if "CIECAM" function are disabled if((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) ipf.defringe (labView); @@ -616,6 +620,9 @@ else ipf.ciecam_02 (cieView, begh, endh,1, labView, ¶ms,customColCurve1,cust readyImg->setOutputProfile (NULL,0); } } +// t2.set(); +// if( settings->verbose ) +// printf("Total:- %d usec\n", t2.etime(t1)); if (!job->initialImage) ii->decreaseRef (); diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 118b74980..aca5edbd9 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -64,7 +64,9 @@ #define ADDSET_CAT_CHROMA_S 56 #define ADDSET_CAT_CHROMA_M 57 #define ADDSET_CAT_HUE 58 +#define ADDSET_CAT_BADPIX 59 + // When adding items, make sure to update ADDSET_PARAM_NUM -#define ADDSET_PARAM_NUM 59 // THIS IS USED AS A DELIMITER!! +#define ADDSET_PARAM_NUM 60 // THIS IS USED AS A DELIMITER!! #endif diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 55ac21a68..9db0c7861 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -128,7 +128,7 @@ void BatchToolPanelCoordinator::initSession () { whitebalance->setAdjusterBehavior (false, false); vibrance->setAdjusterBehavior (false, false, false); vignetting->setAdjusterBehavior (false, false, false, false); - colorappearance->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false); + colorappearance->setAdjusterBehavior (false, false, false, false, false, false, false, false, false, false, false, false, false); rotate->setAdjusterBehavior (false); distortion->setAdjusterBehavior (false); perspective->setAdjusterBehavior (false); @@ -155,7 +155,7 @@ void BatchToolPanelCoordinator::initSession () { lcurve->setAdjusterBehavior (options.baBehav[ADDSET_LC_BRIGHTNESS], options.baBehav[ADDSET_LC_CONTRAST], options.baBehav[ADDSET_LC_CHROMATICITY]); whitebalance->setAdjusterBehavior (options.baBehav[ADDSET_WB_TEMPERATURE], options.baBehav[ADDSET_WB_GREEN]); vignetting->setAdjusterBehavior (options.baBehav[ADDSET_VIGN_AMOUNT], options.baBehav[ADDSET_VIGN_RADIUS], options.baBehav[ADDSET_VIGN_STRENGTH], options.baBehav[ADDSET_VIGN_CENTER]); - colorappearance->setAdjusterBehavior (options.baBehav[ADDSET_CAT_DEGREE], options.baBehav[ADDSET_CAT_ADAPTSCENE], options.baBehav[ADDSET_CAT_ADAPTVIEWING], options.baBehav[ADDSET_CAT_LIGHT], options.baBehav[ADDSET_CAT_CHROMA],options.baBehav[ADDSET_CAT_CONTRAST],options.baBehav[ADDSET_CAT_RSTPRO],options.baBehav[ADDSET_CAT_BRIGHT],options.baBehav[ADDSET_CAT_CONTRAST_Q],options.baBehav[ADDSET_CAT_CHROMA_S],options.baBehav[ADDSET_CAT_CHROMA_M],options.baBehav[ADDSET_CAT_HUE]); + colorappearance->setAdjusterBehavior (options.baBehav[ADDSET_CAT_DEGREE], options.baBehav[ADDSET_CAT_ADAPTSCENE], options.baBehav[ADDSET_CAT_ADAPTVIEWING],options.baBehav[ADDSET_CAT_BADPIX], options.baBehav[ADDSET_CAT_LIGHT], options.baBehav[ADDSET_CAT_CHROMA],options.baBehav[ADDSET_CAT_CONTRAST],options.baBehav[ADDSET_CAT_RSTPRO],options.baBehav[ADDSET_CAT_BRIGHT],options.baBehav[ADDSET_CAT_CONTRAST_Q],options.baBehav[ADDSET_CAT_CHROMA_S],options.baBehav[ADDSET_CAT_CHROMA_M],options.baBehav[ADDSET_CAT_HUE]); rotate->setAdjusterBehavior (options.baBehav[ADDSET_ROTATE_DEGREE]); distortion->setAdjusterBehavior (options.baBehav[ADDSET_DIST_AMOUNT]); perspective->setAdjusterBehavior (options.baBehav[ADDSET_PERSPECTIVE]); @@ -207,6 +207,7 @@ void BatchToolPanelCoordinator::initSession () { if (options.baBehav[ADDSET_CAT_DEGREE]) pparams.colorappearance.degree = 0; if (options.baBehav[ADDSET_CAT_ADAPTSCENE]) pparams.colorappearance.adapscen = 0; if (options.baBehav[ADDSET_CAT_ADAPTVIEWING]) pparams.colorappearance.adaplum = 0; + if (options.baBehav[ADDSET_CAT_BADPIX]) pparams.colorappearance.badpixsl = 0; if (options.baBehav[ADDSET_CAT_LIGHT]) pparams.colorappearance.jlight = 0; if (options.baBehav[ADDSET_CAT_BRIGHT]) pparams.colorappearance.qbright = 0; if (options.baBehav[ADDSET_CAT_CHROMA]) pparams.colorappearance.chroma = 0; diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 4cd1b1b4a..1e05a4150 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -78,9 +78,10 @@ ColorAppearance::ColorAppearance () : Gtk::VBox(), FoldableToolPanel(this) { wbmHBox->pack_start (*wbmodel); p1VBox->pack_start (*wbmHBox); - adapscen = Gtk::manage (new Adjuster (M("TP_COLORAPP_ADAPTSCENE"), 0.1, 4000., 0.1, 2000.)); + adapscen = Gtk::manage (new Adjuster (M("TP_COLORAPP_ADAPTSCENE"), 0.001, 16384., 0.001, 2000.));// EV -7 ==> EV 17 if (adapscen->delay < 1000) adapscen->delay = 1000; adapscen->throwOnButtonRelease(); + adapscen->addAutoButton(M("TP_COLORAPP_ADAP_AUTO_TOOLTIP")); adapscen->set_tooltip_markup (M("TP_COLORAPP_ADAPTSCENE_TOOLTIP")); p1VBox->pack_start (*adapscen); @@ -342,6 +343,21 @@ 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); + + // ------------------------ Bad pixel control + +/* + badpix = Gtk::manage (new Gtk::CheckButton (M("TP_COLORAPP_BADPIX"))); + badpix->set_tooltip_markup (M("TP_COLORAPP_BADPIX_TOOLTIP")); + badpixconn = badpix->signal_toggled().connect( sigc::mem_fun(*this, &ColorAppearance::badpix_toggled) ); + pack_start (*badpix, Gtk::PACK_SHRINK); +*/ + badpixsl = Gtk::manage (new Adjuster (M("TP_COLORAPP_BADPIXSL"), 0, 2, 1, 0)); + if (badpixsl->delay < 1000) badpixsl->delay = 1000; + badpixsl->throwOnButtonRelease(); + badpixsl->set_tooltip_markup (M("TP_COLORAPP_BADPIXSL_TOOLTIP")); + pack_start (*badpixsl, Gtk::PACK_SHRINK); + // ------------------------ Listening events @@ -354,6 +370,7 @@ ColorAppearance::ColorAppearance () : Gtk::VBox(), FoldableToolPanel(this) { degree->setAdjusterListener (this); adapscen->setAdjusterListener (this); adaplum->setAdjusterListener (this); + badpixsl->setAdjusterListener (this); jlight->setAdjusterListener (this); qbright->setAdjusterListener (this); colorh->setAdjusterListener (this); @@ -396,11 +413,11 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) { toneCurveMode2->set_active(pp->colorappearance.curveMode2); toneCurveMode3->set_active(pp->colorappearance.curveMode3); curveMode3Changed(); // This will set the correct sensitive state of depending Adjusters - if (pedited) { degree->setEditedState (pedited->colorappearance.degree ? Edited : UnEdited); adapscen->setEditedState (pedited->colorappearance.adapscen ? Edited : UnEdited); adaplum->setEditedState (pedited->colorappearance.adaplum ? Edited : UnEdited); + badpixsl->setEditedState (pedited->colorappearance.badpixsl ? Edited : UnEdited); jlight->setEditedState (pedited->colorappearance.jlight ? Edited : UnEdited); qbright->setEditedState (pedited->colorappearance.qbright ? Edited : UnEdited); chroma->setEditedState (pedited->colorappearance.chroma ? Edited : UnEdited); @@ -412,11 +429,14 @@ 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); + // badpix->set_inconsistent (!pedited->colorappearance.badpix); datacie->set_inconsistent (!pedited->colorappearance.datacie); tonecie->set_inconsistent (!pedited->colorappearance.tonecie); // sharpcie->set_inconsistent (!pedited->colorappearance.sharpcie); degree->setAutoInconsistent (multiImage && !pedited->colorappearance.autodegree); + adapscen->setAutoInconsistent (multiImage && !pedited->colorappearance.autoadapscen); + enabled->set_inconsistent (multiImage && !pedited->colorappearance.enabled); shape->setUnChanged (!pedited->colorappearance.curve); shape2->setUnChanged (!pedited->colorappearance.curve2); @@ -485,6 +505,9 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) { gamutconn.block (true); gamut->set_active (pp->colorappearance.gamut); gamutconn.block (false); +// badpixconn.block (true); +// badpix->set_active (pp->colorappearance.badpix); +// badpixconn.block (false); datacieconn.block (true); datacie->set_active (pp->colorappearance.datacie); datacieconn.block (false); @@ -497,17 +520,22 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) { lastsurr=pp->colorappearance.surrsource; lastgamut=pp->colorappearance.gamut; +// lastbadpix=pp->colorappearance.badpix; lastdatacie=pp->colorappearance.datacie; lasttonecie=pp->colorappearance.tonecie; // lastsharpcie=pp->colorappearance.sharpcie; lastEnabled = pp->colorappearance.enabled; lastAutoDegree = pp->colorappearance.autodegree; + lastAutoAdapscen = pp->colorappearance.autoadapscen; degree->setValue (pp->colorappearance.degree); degree->setAutoValue(pp->colorappearance.autodegree); adapscen->setValue (pp->colorappearance.adapscen); + adapscen->setAutoValue (pp->colorappearance.autoadapscen); + adaplum->setValue (pp->colorappearance.adaplum); + badpixsl->setValue (pp->colorappearance.badpixsl); jlight->setValue (pp->colorappearance.jlight); qbright->setValue (pp->colorappearance.qbright); chroma->setValue (pp->colorappearance.chroma); @@ -537,7 +565,9 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) { pp->colorappearance.autodegree = degree->getAutoValue (); pp->colorappearance.enabled = enabled->get_active(); pp->colorappearance.adapscen = adapscen->getValue (); + pp->colorappearance.autoadapscen = adapscen->getAutoValue (); pp->colorappearance.adaplum = adaplum->getValue (); + pp->colorappearance.badpixsl = badpixsl->getValue (); pp->colorappearance.jlight = jlight->getValue (); pp->colorappearance.qbright = qbright->getValue (); pp->colorappearance.chroma = chroma->getValue (); @@ -549,6 +579,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.badpix = badpix->get_active(); pp->colorappearance.datacie = datacie->get_active(); pp->colorappearance.tonecie = tonecie->get_active(); // pp->colorappearance.sharpcie = sharpcie->get_active(); @@ -573,6 +604,7 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) { pedited->colorappearance.degree = degree->getEditedState (); pedited->colorappearance.adapscen = adapscen->getEditedState (); pedited->colorappearance.adaplum = adaplum->getEditedState (); + pedited->colorappearance.badpixsl = badpixsl->getEditedState (); pedited->colorappearance.jlight = jlight->getEditedState (); pedited->colorappearance.qbright = qbright->getEditedState (); pedited->colorappearance.chroma = chroma->getEditedState (); @@ -583,12 +615,14 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) { pedited->colorappearance.colorh = colorh->getEditedState (); pedited->colorappearance.rstprotection = rstprotection->getEditedState (); pedited->colorappearance.autodegree = !degree->getAutoInconsistent(); + pedited->colorappearance.autoadapscen = !adapscen->getAutoInconsistent(); pedited->colorappearance.enabled = !enabled->get_inconsistent(); pedited->colorappearance.surround = surround->get_active_text()!=M("GENERAL_UNCHANGED"); pedited->colorappearance.wbmodel = wbmodel->get_active_text()!=M("GENERAL_UNCHANGED"); pedited->colorappearance.algo = algo->get_active_text()!=M("GENERAL_UNCHANGED"); pedited->colorappearance.surrsource = !surrsource->get_inconsistent(); pedited->colorappearance.gamut = !gamut->get_inconsistent(); + // pedited->colorappearance.badpix = !badpix->get_inconsistent(); pedited->colorappearance.datacie = !datacie->get_inconsistent(); pedited->colorappearance.tonecie = !tonecie->get_inconsistent(); // pedited->colorappearance.sharpcie = !sharpcie->get_inconsistent(); @@ -715,6 +749,31 @@ void ColorAppearance::gamut_toggled () { } +/* +void ColorAppearance::badpix_toggled () { + + if (batchMode) { + if (badpix->get_inconsistent()) { + badpix->set_inconsistent (false); + badpixconn.block (true); + badpix->set_active (false); + badpixconn.block (false); + } + else if (lastbadpix) + badpix->set_inconsistent (true); + + lastbadpix = badpix->get_active (); + } + if (listener) { + if (badpix->get_active ()) + listener->panelChanged (EvCATbadpix, M("GENERAL_ENABLED")); + else + listener->panelChanged (EvCATbadpix, M("GENERAL_DISABLED")); + } + + +} +*/ void ColorAppearance::datacie_toggled () { if (batchMode) { @@ -789,6 +848,7 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit degree->setDefault (defParams->colorappearance.degree); adapscen->setDefault (defParams->colorappearance.adapscen); adaplum->setDefault (defParams->colorappearance.adaplum); + badpixsl->setDefault (defParams->colorappearance.badpixsl); jlight->setDefault (defParams->colorappearance.jlight); qbright->setDefault (defParams->colorappearance.qbright); chroma->setDefault (defParams->colorappearance.chroma); @@ -803,6 +863,7 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit degree->setDefaultEditedState (pedited->colorappearance.degree ? Edited : UnEdited); adapscen->setDefaultEditedState (pedited->colorappearance.adapscen ? Edited : UnEdited); adaplum->setDefaultEditedState (pedited->colorappearance.adaplum ? Edited : UnEdited); + badpixsl->setDefaultEditedState (pedited->colorappearance.badpixsl ? Edited : UnEdited); jlight->setDefaultEditedState (pedited->colorappearance.jlight ? Edited : UnEdited); qbright->setDefaultEditedState (pedited->colorappearance.qbright ? Edited : UnEdited); chroma->setDefaultEditedState (pedited->colorappearance.chroma ? Edited : UnEdited); @@ -818,6 +879,7 @@ void ColorAppearance::setDefaults (const ProcParams* defParams, const ParamsEdit degree->setDefaultEditedState (Irrelevant); adapscen->setDefaultEditedState (Irrelevant); adaplum->setDefaultEditedState (Irrelevant); + badpixsl->setDefaultEditedState (Irrelevant); jlight->setDefaultEditedState (Irrelevant); qbright->setDefaultEditedState (Irrelevant); chroma->setDefaultEditedState (Irrelevant); @@ -850,6 +912,26 @@ bool ColorAppearance::autoCamComputed_ () { return false; } +int adapCamChangedUI (void* data) { + (static_cast(data))->adapCamComputed_ (); + return 0; +} +void ColorAppearance::adapCamChanged (double cadap) +{ + nextCadap = cadap; + g_idle_add (adapCamChangedUI, this); + // Glib::signal_idle().connect (sigc::mem_fun(*this, &ColorAppearance::autoCamComputed_)); +} + +bool ColorAppearance::adapCamComputed_ () { + + disableListener (); +// degree->setEnabled (true); + adapscen->setValue (nextCadap); + enableListener (); + + return false; +} void ColorAppearance::colorForValue (double valX, double valY, int callerId, ColorCaller *caller) { @@ -876,6 +958,8 @@ void ColorAppearance::adjusterChanged (Adjuster* a, double newval) { listener->panelChanged (EvCATAdapscen, a->getTextValue()); else if(a==adaplum) listener->panelChanged (EvCATAdapLum, a->getTextValue()); + else if(a==badpixsl) + listener->panelChanged (EvCATbadpix, a->getTextValue()); else if(a==jlight) listener->panelChanged (EvCATJLight, a->getTextValue()); else if(a==qbright) @@ -909,6 +993,16 @@ void ColorAppearance::adjusterAutoToggled (Adjuster* a, bool newval) { degree->setAutoInconsistent(true); lastAutoDegree = degree->getAutoValue(); + + if (adapscen->getAutoInconsistent()) { + adapscen->setAutoInconsistent(false); + adapscen->setAutoValue(false); + } + else if (lastAutoAdapscen) + adapscen->setAutoInconsistent(true); + + lastAutoAdapscen = adapscen->getAutoValue(); + } if (listener && (multiImage||enabled->get_active()) ) { @@ -921,9 +1015,18 @@ void ColorAppearance::adjusterAutoToggled (Adjuster* a, bool newval) { else listener->panelChanged (EvCATAutoDegree, M("GENERAL_DISABLED")); } + if(a==adapscen) { + if (adapscen->getAutoInconsistent()) + listener->panelChanged (EvCATAutoAdap, M("GENERAL_UNCHANGED")); + else if (adapscen->getAutoValue()) + listener->panelChanged (EvCATAutoAdap, M("GENERAL_ENABLED")); + else + listener->panelChanged (EvCATAutoAdap, M("GENERAL_DISABLED")); + } + + } } - void ColorAppearance::enabledChanged () { if (multiImage) { @@ -1049,6 +1152,7 @@ void ColorAppearance::setBatchMode (bool batchMode) { degree->showEditedCB (); adapscen->showEditedCB (); adaplum->showEditedCB (); + badpixsl->showEditedCB (); jlight->showEditedCB (); qbright->showEditedCB (); chroma->showEditedCB (); @@ -1080,11 +1184,12 @@ void ColorAppearance::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu -void ColorAppearance::setAdjusterBehavior (bool degreeadd, bool adapscenadd, bool adaplumadd, bool jlightadd, bool chromaadd, bool contrastadd, bool rstprotectionadd, bool qbrightadd, bool qcontrastadd, bool schromaadd, bool mchromaadd, bool colorhadd) { +void ColorAppearance::setAdjusterBehavior (bool degreeadd, bool adapscenadd, bool adaplumadd, bool badpixsladd, bool jlightadd, bool chromaadd, bool contrastadd, bool rstprotectionadd, bool qbrightadd, bool qcontrastadd, bool schromaadd, bool mchromaadd, bool colorhadd) { degree->setAddMode(degreeadd); adapscen->setAddMode(adapscenadd); adaplum->setAddMode(adaplumadd); + badpixsl->setAddMode(badpixsladd); jlight->setAddMode(jlightadd); qbright->setAddMode(qbrightadd); chroma->setAddMode(chromaadd); @@ -1101,6 +1206,7 @@ void ColorAppearance::trimValues (rtengine::procparams::ProcParams* pp) { degree->trimValue(pp->colorappearance.degree); adapscen->trimValue(pp->colorappearance.adapscen); adaplum->trimValue(pp->colorappearance.adaplum); + badpixsl->trimValue(pp->colorappearance.badpixsl); jlight->trimValue(pp->colorappearance.jlight); qbright->trimValue(pp->colorappearance.qbright); chroma->trimValue(pp->colorappearance.chroma); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index 8767f2853..915ffbbdd 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -39,6 +39,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab Adjuster* degree; Adjuster* adapscen; Adjuster* adaplum; + Adjuster* badpixsl; Adjuster* jlight; Adjuster* qbright; Adjuster* chroma; @@ -55,6 +56,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab //Adjuster* edge; Gtk::CheckButton* surrsource; Gtk::CheckButton* gamut; + // Gtk::CheckButton* badpix; Gtk::CheckButton* datacie; Gtk::CheckButton* tonecie; // Gtk::CheckButton* sharpcie; @@ -67,7 +69,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab MyComboBoxText* algo; sigc::connection algoconn; sigc::connection surrconn; - sigc::connection gamutconn, datacieconn, tonecieconn /*, sharpcieconn*/; + sigc::connection gamutconn, datacieconn, tonecieconn /*,badpixconn , sharpcieconn*/; sigc::connection tcmodeconn, tcmode2conn, tcmode3conn; CurveEditorGroup* curveEditorG; CurveEditorGroup* curveEditorG2; @@ -76,12 +78,14 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab DiagonalCurveEditor* shape; DiagonalCurveEditor* shape2; DiagonalCurveEditor* shape3; - double nextCcam; + double nextCcam, nextCadap; bool lastEnabled; bool lastAutoDegree; + bool lastAutoAdapscen; sigc::connection enaConn; bool lastsurr; bool lastgamut; +// bool lastbadpix; bool lastdatacie; bool lasttonecie; // bool lastsharpcie; @@ -97,20 +101,23 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited=NULL); void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited=NULL); void setBatchMode (bool batchMode); - void adjusterChanged (Adjuster* a, double newval); void adjusterAutoToggled (Adjuster* a, bool newval); +// void adjusterAdapToggled (Adjuster* a, bool newval); void enabledChanged (); void surroundChanged (); void wbmodelChanged (); void algoChanged (); void surrsource_toggled (); void gamut_toggled (); + // void badpix_toggled (); void datacie_toggled (); void tonecie_toggled (); // void sharpcie_toggled (); void autoCamChanged (double ccam); bool autoCamComputed_ (); + void adapCamChanged (double cadap); + bool adapCamComputed_ (); void curveChanged (CurveEditor* ce); void curveMode1Changed (); @@ -124,7 +131,7 @@ class ColorAppearance : public Gtk::VBox, public AdjusterListener, public Foldab bool isCurveExpanded (); void autoOpenCurve (); - void setAdjusterBehavior (bool degreeadd, bool adapscenadd, bool adaplumadd, bool jlightadd, bool chromaadd, bool contrastadd, bool rstprotectionadd, bool qbrightadd, bool qcontrastadd, bool schromaadd, bool mchromaadd, bool colorhadd); + void setAdjusterBehavior (bool degreeadd, bool adapscenadd, bool adaplumadd, bool badpixsladd, bool jlightadd, bool chromaadd, bool contrastadd, bool rstprotectionadd, bool qbrightadd, bool qcontrastadd, bool schromaadd, bool mchromaadd, bool colorhadd); void trimValues (rtengine::procparams::ProcParams* pp); void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); virtual void colorForValue (double valX, double valY, int callerId, ColorCaller *caller); diff --git a/rtgui/options.cc b/rtgui/options.cc index c6cf653fa..c9a108700 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -415,6 +415,7 @@ void Options::setDefaults () { 0, // ADDSET_CAT_DEGREE 0, // ADDSET_CAT_ADAPSCEN 0, // ADDSET_CAT_ADAPLUM + 0, // ADDSET_CAT_BADPIX 0, // ADDSET_CAT_JLIGHT 0, // ADDSET_CAT_CHROMA 0, // ADDSET_CAT_CONTRAST @@ -458,6 +459,7 @@ void Options::setDefaults () { rtSettings.protectredh = 0.3; rtSettings.CRI_color =0; rtSettings.autocielab=true; +// rtSettings.ciebadpixgauss=false; rtSettings.rgbcurveslumamode_gamut=true; lastIccDir = rtSettings.iccDirectory; lastDarkframeDir = rtSettings.darkFramesPath; @@ -693,6 +695,8 @@ if (keyFile.has_group ("Color Management")) { if( keyFile.has_key ("Color Management", "GamutLch")) rtSettings.gamutLch = keyFile.get_boolean("Color Management", "GamutLch"); if( keyFile.has_key ("Color Management", "ProtectRed")) rtSettings.protectred = keyFile.get_integer("Color Management", "ProtectRed"); if( keyFile.has_key ("Color Management", "ProtectRedH")) rtSettings.protectredh = keyFile.get_double("Color Management", "ProtectRedH"); +// if( keyFile.has_key ("Color Management", "Ciebadpixgauss")) rtSettings.ciebadpixgauss = keyFile.get_boolean("Color Management", "Ciebadpixgauss"); + } if (keyFile.has_group ("Batch Processing")) { @@ -946,6 +950,7 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_integer ("Color Management", "ProtectRed", rtSettings.protectred); keyFile.set_double ("Color Management", "ProtectRedH", rtSettings.protectredh); keyFile.set_integer ("Color Management", "CRI", rtSettings.CRI_color); +// keyFile.set_boolean ("Color Management", "Ciebadpixgauss", rtSettings.ciebadpixgauss); Glib::ArrayHandle bab = baBehav; keyFile.set_integer_list ("Batch Processing", "AdjusterBehavior", bab); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 52eeb36df..fe8729e69 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -98,7 +98,9 @@ void ParamsEdited::set (bool v) { colorappearance.autodegree = v; colorappearance.surround = v; colorappearance.adapscen = v; + colorappearance.autoadapscen = v; colorappearance.adaplum = v; + colorappearance.badpixsl = v; colorappearance.wbmodel = v; colorappearance.algo = v; @@ -113,6 +115,7 @@ void ParamsEdited::set (bool v) { colorappearance.rstprotection = v; colorappearance.surrsource = v; colorappearance.gamut = v; +// colorappearance.badpix = v; colorappearance.datacie = v; colorappearance.tonecie = v; // colorappearance.sharpcie = v; @@ -338,7 +341,9 @@ void ParamsEdited::initFrom (const std::vector colorappearance.autodegree = colorappearance.autodegree && p.colorappearance.autodegree == other.colorappearance.autodegree; colorappearance.surround = colorappearance.surround && p.colorappearance.surround == other.colorappearance.surround; colorappearance.adapscen = colorappearance.adapscen && p.colorappearance.adapscen == other.colorappearance.adapscen; + colorappearance.autoadapscen = colorappearance.autoadapscen && p.colorappearance.autoadapscen == other.colorappearance.autoadapscen; colorappearance.adaplum = colorappearance.adaplum && p.colorappearance.adaplum == other.colorappearance.adaplum; + colorappearance.badpixsl = colorappearance.badpixsl && p.colorappearance.badpixsl == other.colorappearance.badpixsl; colorappearance.wbmodel = colorappearance.wbmodel && p.colorappearance.wbmodel == other.colorappearance.wbmodel; colorappearance.algo = colorappearance.algo && p.colorappearance.algo == other.colorappearance.algo; colorappearance.jlight = colorappearance.jlight && p.colorappearance.jlight == other.colorappearance.jlight; @@ -352,6 +357,7 @@ void ParamsEdited::initFrom (const std::vector 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.badpix = colorappearance.badpix && p.colorappearance.badpix == other.colorappearance.badpix; colorappearance.datacie = colorappearance.datacie && p.colorappearance.datacie == other.colorappearance.datacie; colorappearance.tonecie = colorappearance.tonecie && p.colorappearance.tonecie == other.colorappearance.tonecie; // colorappearance.sharpcie = colorappearance.sharpcie && p.colorappearance.sharpcie == other.colorappearance.sharpcie; @@ -610,8 +616,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (colorappearance.degree) toEdit.colorappearance.degree = dontforceSet && options.baBehav[ADDSET_CAT_DEGREE] ? toEdit.colorappearance.degree + mods.colorappearance.degree : mods.colorappearance.degree; if (colorappearance.autodegree) toEdit.colorappearance.autodegree = mods.colorappearance.autodegree; if (colorappearance.surround) toEdit.colorappearance.surround = mods.colorappearance.surround; + if (colorappearance.autoadapscen) toEdit.colorappearance.autoadapscen = mods.colorappearance.autoadapscen; if (colorappearance.adapscen) toEdit.colorappearance.adapscen = mods.colorappearance.adapscen; if (colorappearance.adaplum) toEdit.colorappearance.adaplum = dontforceSet && options.baBehav[ADDSET_CAT_ADAPTVIEWING] ? toEdit.colorappearance.adaplum + mods.colorappearance.adaplum : mods.colorappearance.adaplum; + if (colorappearance.badpixsl) toEdit.colorappearance.badpixsl = dontforceSet && options.baBehav[ADDSET_CAT_BADPIX] ? toEdit.colorappearance.badpixsl + mods.colorappearance.badpixsl : mods.colorappearance.badpixsl; if (colorappearance.wbmodel) toEdit.colorappearance.wbmodel = mods.colorappearance.wbmodel; if (colorappearance.algo) toEdit.colorappearance.algo = mods.colorappearance.algo; @@ -626,6 +634,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.badpix) toEdit.colorappearance.badpix = mods.colorappearance.badpix; if (colorappearance.datacie) toEdit.colorappearance.datacie = mods.colorappearance.datacie; if (colorappearance.tonecie) toEdit.colorappearance.tonecie = mods.colorappearance.tonecie; // if (colorappearance.sharpcie) toEdit.colorappearance.sharpcie = mods.colorappearance.sharpcie; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 5c1572c17..7232f97f7 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -194,9 +194,11 @@ public: bool enabled; bool degree; bool autodegree; + bool autoadapscen; bool surround; bool adapscen; bool adaplum; + bool badpixsl; bool wbmodel; bool algo; bool jlight; @@ -210,6 +212,7 @@ public: bool rstprotection; bool surrsource; bool gamut; +// bool badpix; bool datacie; bool tonecie; // bool sharpcie; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index b5bfe6ea7..e75a15823 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -216,6 +216,7 @@ Gtk::Widget* Preferences::getBatchProcPanel () { appendBehavList (mi, M("TP_COLORAPP_CHROMA_M"),ADDSET_CAT_CHROMA_M, true); appendBehavList (mi, M("TP_COLORAPP_HUE"),ADDSET_CAT_HUE, true); appendBehavList (mi, M("TP_COLORAPP_ADAPTVIEWING"),ADDSET_CAT_ADAPTVIEWING, true); + appendBehavList (mi, M("TP_COLORAPP_BADPIXSL"),ADDSET_CAT_BADPIX, true); mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_VIBRANCE_LABEL")); diff --git a/rtgui/preprocess.cc b/rtgui/preprocess.cc index 46cb6ad83..002a3d623 100644 --- a/rtgui/preprocess.cc +++ b/rtgui/preprocess.cc @@ -29,6 +29,7 @@ PreProcess::PreProcess () : Gtk::VBox(), FoldableToolPanel(this) set_border_width(4); hotDeadPixel = Gtk::manage(new Gtk::CheckButton((M("TP_PREPROCESS_HOTDEADPIXFILT")))); + hotDeadPixel->set_tooltip_markup (M("TP_PREPROCESS_HOTDEADPIXFILT_TOOLTIP")); lineDenoise = Gtk::manage(new Adjuster (M("TP_PREPROCESS_LINEDENOISE"),0,1000,1,0)); lineDenoise->setAdjusterListener (this);