From 86b0bb5420de940dd28b970d4615d6c2b8f795dc Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 17 Aug 2015 18:49:02 +0200 Subject: [PATCH 01/71] Initial commit for DeHaze branch --- rtdata/languages/default | 18 +++ rtengine/CMakeLists.txt | 2 +- rtengine/dcrop.cc | 2 + rtengine/improccoordinator.cc | 1 + rtengine/improcfun.h | 3 + rtengine/ipdehaz.cc | 281 ++++++++++++++++++++++++++++++++++ rtengine/procevents.h | 7 + rtengine/procparams.cc | 75 +++++++++ rtengine/procparams.h | 7 + rtengine/refreshmap.cc | 8 +- rtengine/simpleprocess.cc | 1 + rtgui/labcurve.cc | 165 +++++++++++++++++++- rtgui/labcurve.h | 17 +- rtgui/paramsedited.cc | 33 +++- rtgui/paramsedited.h | 7 + 15 files changed, 622 insertions(+), 5 deletions(-) create mode 100644 rtengine/ipdehaz.cc diff --git a/rtdata/languages/default b/rtdata/languages/default index ad2c8ae28..c3b29f8f1 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -636,6 +636,12 @@ HISTORY_MSG_403;W - ES - Edge sensitivity HISTORY_MSG_404;W - ES - Base amplification HISTORY_MSG_405;W - Denoise - Level 4 HISTORY_MSG_406;W - ES - Neighboring pixels +HISTORY_MSG_407;Dehaze met +HISTORY_MSG_408;Dehaze neighboring +HISTORY_MSG_409;Dehaze gain +HISTORY_MSG_410;Dehaze offset +HISTORY_MSG_411;Dehaze strength +HISTORY_MSG_412;Dehaze scales HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1536,6 +1542,18 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. +TP_LABCURVE_STR;Strength +TP_LABCURVE_SCAL;Scales +TP_LABCURVE_NEIGH;Neighboring pixels +TP_LABCURVE_GAIN;Gain +TP_LABCURVE_OFFS;Offset +TP_DEHAZE_LAB;Dehaze +TP_DEHAZE_LAB_TOOLTIP;Use Retinex algorithm (Lab) to improve dehaze..defog... +TP_DEHAZE_MET;Dehaze method +TP_DEHAZ_NONE;None +TP_DEHAZ_UNI;Uniform +TP_DEHAZ_LOW;Low +TP_DEHAZ_HIGH;High TP_LENSGEOM_AUTOCROP;Auto-Crop TP_LENSGEOM_FILL;Auto-fill TP_LENSGEOM_LABEL;Lens / Geometry diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 0cda358e0..25d7717e1 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -18,7 +18,7 @@ set (RTENGINESOURCEFILES safegtk.cc colortemp.cc curves.cc flatcurves.cc diagona EdgePreservingDecomposition.cc cplx_wavelet_dec.cc FTblockDN.cc PF_correct_RT.cc previewimage.cc ipwavelet.cc dirpyr_equalizer.cc - calc_distort.cc lcp.cc dcp.cc + calc_distort.cc lcp.cc dcp.cc ipdehaz.cc cJSON.c camconst.cc klt/convolve.cc klt/error.cc klt/klt.cc klt/klt_util.cc klt/pnmio.cc klt/pyramid.cc klt/selectGoodFeatures.cc klt/storeFeatures.cc klt/trackFeatures.cc klt/writeFeatures.cc diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 138a03594..bfee6c61d 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -807,6 +807,8 @@ void Crop::update (int todo) bool wavcontlutili = parent->wavcontlutili; LUTu dummy; + parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); + parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); parent->ipf.vibrance (labnCrop); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index fa1fae502..6c9451874 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -576,6 +576,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) nprevl->CopyFrom(oprevl); progress ("Applying Color Boost...", 100 * readyphase / numofphases); + ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); ipf.chromiLuminanceCurve (NULL, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histCLurve, histLLCurve, histLCurve); ipf.vibrance(nprevl); diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 8857677a8..fb7269fe5 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -305,6 +305,9 @@ public: //void RGB_InputTransf(Imagefloat * src, LabImage * dst, const procparams::DirPyrDenoiseParams & dnparams, const procparams::DefringeParams & defringe); //void RGB_OutputTransf(LabImage * src, Imagefloat * dst, const procparams::DirPyrDenoiseParams & dnparams); //void output_tile_row (float *Lbloxrow, float ** Lhipassdn, float ** tilemask, int height, int width, int top, int blkrad ); + + void MSR(LabImage* lab, int width, int height, int skip); + void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip); void ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, bool wavcontlutili, int skip); diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc new file mode 100644 index 000000000..a385d92eb --- /dev/null +++ b/rtengine/ipdehaz.cc @@ -0,0 +1,281 @@ + /* + * This file is part of RawTherapee. + * + * Copyright (c) 2004-2010 Gabor Horvath + * + * RawTherapee is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * RawTherapee is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with RawTherapee. If not, see . + + * D. J. Jobson, Z. Rahman, and G. A. Woodell. A multi-scale + * Retinex for bridging the gap between color images and the + * human observation of scenes. IEEE Transactions on Image Processing, + * 1997, 6(7): 965-976 + * inspired from 2003 Fabien Pelisson + + */ + + + # include + # include + # include + # include + # include + #include "rtengine.h" + + #include "improcfun.h" + # define MAX_DEHAZE_SCALES 8 + # define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) + + namespace rtengine +{ + +extern const Settings* settings; + + static float DehazeScales[MAX_DEHAZE_SCALES]; + + typedef struct + { + int N; + float sigma; + double B; + double b[4]; + } gauss3; + +void dehaze_scales( float* scales, int nscales, int mode, int s) + { + if ( nscales == 1 ) + { + scales[0] = (float)s / 2.f; + } + else if (nscales == 2) + { + scales[0] = (float) s / 2.f; + scales[1] = (float) s; + } + else + { + float size_step = (float) s / (float) nscales; + + if(mode==0) { + for (int i = 0; i < nscales; ++i ) + scales[i] = 2.0f + (float)i * size_step; + } + else if (mode==1) { + size_step = (float)log(s - 2.0f) / (float) nscales; + for (int i = 0; i < nscales; ++i ) + scales[i] = 2.0f + (float)pow (10.f, (i * size_step) / log (10.f)); + } + else if(mode==2){ + size_step = (float) log(s - 2.0f) / (float) nscales; + for ( int i = 0; i < nscales; ++i ) + scales[i] = s - (float)pow (10.f, (i * size_step) / log (10.f)); + } + } +} + +void mean_stddv( float *dst, float &mean, float &stddv, int W_L, int H_L ) + { + float vsquared; + int i, j; + + vsquared = 0.0f; + mean = 0.0f; + for (int i=0; i= 2.5f ) + { + q = 0.98711f * sigma - 0.96330f; + } + else if ( (sigma >= 0.5f) && (sigma < 2.5f) ) + { + q = 3.97156f - 4.14554f * (float) sqrt ((double) 1 - 0.26891 * sigma); + } + else + { + q = 0.1147705018520355224609375f; + } + + q2 = q * q; + q3 = q * q2; + c->b[0] = (1.57825f+(2.44413f*q)+(1.4281f *q2)+(0.422205f*q3)); + c->b[1] = ( (2.44413f*q)+(2.85619f*q2)+(1.26661f *q3)); + c->b[2] = ( -((1.4281f*q2)+(1.26661f *q3))); + c->b[3] = ( (0.422205f*q3)); + c->B = 1.0f-((c->b[1]+c->b[2]+c->b[3])/c->b[0]); + c->sigma = sigma; + c->N = 3; + } + + +void gausssmooth( float *in, float *out, int size, int rowstride, gauss3 *c ) + { + int i,n, bufsize; + float *w1,*w2; + + bufsize = size+3; + size -= 1; + w1 = new float [bufsize]; + w2 = new float [bufsize]; + w1[0] = in[0]; + w1[1] = in[0]; + w1[2] = in[0]; + for ( i = 0 , n=3; i <= size ; i++, n++) + { + w1[n] = (float)(c->B*in[i*rowstride] + + ((c->b[1]*w1[n-1] + + c->b[2]*w1[n-2] + + c->b[3]*w1[n-3] ) / c->b[0])); + } + + w2[size+1]= w1[size+3]; + w2[size+2]= w1[size+3]; + w2[size+3]= w1[size+3]; + for ( i = size, n = i; i >= 0; i--, n-- ) + { + w2[n]= out[i * rowstride] = (float)(c->B*w1[n] + + ((c->b[1]*w2[n+1] + + c->b[2]*w2[n+2] + + c->b[3]*w2[n+3] ) / c->b[0])); + } + delete [] w1; + delete [] w2; + } + +void ImProcFunctions::MSR(LabImage* lab, int width, int height, int skip) + + { + int Is; + float weight; + gauss3 coef; + float mean, stddv; + float mini, delta, maxi; + float eps = 5.f; + float gain = (float) params->labCurve.gain;//def =1 not use + float offset = (float) params->labCurve.offs;//def = 0 not use + float strength = (float) params->labCurve.str; + int scal = params->labCurve.scal;//def=3 + int nei = (int) 2.5f*params->labCurve.neigh;//def = 200 + int modedehaz; + if(params->labCurve.dehazmet=="none") modedehaz=-1;//enabled disabled + if(params->labCurve.dehazmet=="uni") modedehaz=0; + if(params->labCurve.dehazmet=="low") modedehaz=1; + if(params->labCurve.dehazmet=="high") modedehaz=2; + if (modedehaz !=-1) {//enabled + int H_L=height; + int W_L=width; + float *src = new float[H_L*W_L]; + memset( src, 0, H_L*W_L * sizeof (float) ); + + float *dst = new float[H_L*W_L]; + memset( dst, 0, H_L*W_L * sizeof (float) ); + + float *out = new float[H_L*W_L]; + memset( out, 0, H_L*W_L * sizeof (float) ); + + float *in = new float[H_L*W_L]; + memset( in, 0, H_L*W_L * sizeof (float) ); + + for (int i=0; i< H_L; i++) { + for (int j=0; jL[i][j] + eps; + } + } + Is = width * height ; + dehaze_scales( DehazeScales, scal, modedehaz, nei ); + + weight = 1.0f / (float) scal; + + int posw = 0; + for (int i = 0; i < Is ; i++ ) + { + in[i] = (float)(src[i] + eps); //avoid log(0) + } + for ( int scale = 0; scale < scal; scale++ ) + { + compute_coefs3( &coef, DehazeScales[scale] ); + for (int row = 0; row < height; row++ ) + { + posw = row * width; + gausssmooth( in + posw, out + posw, width, 1, &coef); + } + memcpy( in, out, Is * sizeof(float) ); + memset( out, 0 , Is * sizeof(float) ); + + for (int col = 0; col < width; col++ ) + { + posw = col; + gausssmooth( in + posw, out + posw, height, width, &coef ); + } + + for ( int i = 0; i < Is; i++ ) + { + dst[i] += weight * (float)( log(src[i] + eps) - log(out[i]) ); + } + } + delete [] in; + delete [] out; + + + // Ci(x,y)=log[a Ii(x,y)]-log[ Ei=1-s Ii(x,y)] + + float beta = 16384.0f; + for ( int i = 0; i < Is; i ++ ) + { + float logsrc = (float)log( (float) src[i] + eps ); + dst[i] = gain * ((float)(log(beta * (src[i] + eps)) - logsrc) * dst[i]) + offset; + } + + mean=0.f;stddv=0.f; + mean_stddv( dst, mean, stddv, W_L, H_L); + float dd=1.25f; + + mini = mean - dd*stddv; + maxi = mean + dd*stddv; + delta = maxi - mini; + printf("maxi=%f mini=%f mean=%f std=%f delta=%f\n", maxi, mini, mean, stddv, delta); + + if ( !delta ) delta = 1.0f; + for(int i=0;iL[ii][jj]=((100.f - strength)* lab->L[ii][jj] + strength * src[i])/100.f; + } + + delete [] dst; + delete [] src; + + } + } + +} \ No newline at end of file diff --git a/rtengine/procevents.h b/rtengine/procevents.h index cb2868dd6..d33c1f8a1 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -432,6 +432,13 @@ enum ProcEvent { EvWavedgeampli = 403, EvWavlev3nois = 404, EvWavNPmet = 405, + Evdehazmet = 406, + EvLneigh = 407, + EvLgain = 408, + EvLoffs = 409, + EvLstr = 410, + EvLscal = 411, + NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 66cb76b3b..006b1ad2d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -882,6 +882,11 @@ void ProcParams::setDefaults () labCurve.brightness = 0; labCurve.contrast = 0; labCurve.chromaticity = 0; + labCurve.str = 70; + labCurve.scal = 3; + labCurve.neigh = 80; + labCurve.gain = 1; + labCurve.offs = 0; labCurve.avoidcolorshift = false; labCurve.lcredsk = true; labCurve.rstprotection = 0; @@ -899,6 +904,7 @@ void ProcParams::setDefaults () labCurve.lhcurve.push_back(FCT_Linear); labCurve.hhcurve.clear (); labCurve.hhcurve.push_back(FCT_Linear); + labCurve.dehazmet = "none"; labCurve.lccurve.clear (); labCurve.lccurve.push_back(DCT_Linear); @@ -1537,6 +1543,22 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol if (!pedited || pedited->labCurve.chromaticity) { keyFile.set_integer ("Luminance Curve", "Chromaticity", labCurve.chromaticity); } + if (!pedited || pedited->labCurve.str) { + keyFile.set_integer ("Luminance Curve", "Str", labCurve.str); + } + if (!pedited || pedited->labCurve.scal) { + keyFile.set_integer ("Luminance Curve", "Scal", labCurve.scal); + } + + if (!pedited || pedited->labCurve.neigh) { + keyFile.set_integer ("Luminance Curve", "Neigh", labCurve.neigh); + } + if (!pedited || pedited->labCurve.gain) { + keyFile.set_integer ("Luminance Curve", "Gain", labCurve.gain); + } + if (!pedited || pedited->labCurve.offs) { + keyFile.set_integer ("Luminance Curve","Offs", labCurve.offs); + } if (!pedited || pedited->labCurve.avoidcolorshift) { keyFile.set_boolean ("Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift); @@ -1589,6 +1611,9 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol Glib::ArrayHandle lccurve = labCurve.lccurve; keyFile.set_double_list("Luminance Curve", "LcCurve", lccurve); } + if (!pedited || pedited->labCurve.dehazmet) { + keyFile.set_string ("Luminance Curve", "Dehazmet",labCurve.dehazmet); + } if (!pedited || pedited->labCurve.clcurve) { Glib::ArrayHandle clcurve = labCurve.clcurve; @@ -3653,6 +3678,42 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.contrast = true; } } + if (keyFile.has_key ("Luminance Curve", "Neigh")) { + labCurve.neigh = keyFile.get_integer ("Luminance Curve", "Neigh"); + + if (pedited) { + pedited->labCurve.neigh = true; + } + } + if (keyFile.has_key ("Luminance Curve", "Str")) { + labCurve.str = keyFile.get_integer ("Luminance Curve", "Str"); + + if (pedited) { + pedited->labCurve.str = true; + } + } + if (keyFile.has_key ("Luminance Curve", "Scal")) { + labCurve.scal = keyFile.get_integer ("Luminance Curve", "Scal"); + + if (pedited) { + pedited->labCurve.scal = true; + } + } + + if (keyFile.has_key ("Luminance Curve", "Gain")) { + labCurve.gain = keyFile.get_integer ("Luminance Curve", "Gain"); + + if (pedited) { + pedited->labCurve.gain = true; + } + } + if (keyFile.has_key ("Luminance Curve", "Offs")) { + labCurve.offs = keyFile.get_integer ("Luminance Curve", "Offs"); + + if (pedited) { + pedited->labCurve.offs = true; + } + } if (ppVersion < 303) { // transform Saturation into Chromaticity @@ -3768,6 +3829,13 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.lhcurve = true; } } + if (keyFile.has_key ("Luminance Curve", "Dehazmet")) { + labCurve.dehazmet = keyFile.get_string ("Luminance Curve", "Dehazmet"); + + if (pedited) { + pedited->labCurve.dehazmet = true; + } + } if (keyFile.has_key ("Luminance Curve", "hhCurve")) { labCurve.hhcurve = keyFile.get_double_list ("Luminance Curve", "hhCurve"); @@ -7004,6 +7072,13 @@ bool ProcParams::operator== (const ProcParams& other) && labCurve.hhcurve == other.labCurve.hhcurve && labCurve.lccurve == other.labCurve.lccurve && labCurve.clcurve == other.labCurve.clcurve + && labCurve.str == other.labCurve.str + && labCurve.scal == other.labCurve.scal + && labCurve.neigh == other.labCurve.neigh + && labCurve.gain == other.labCurve.gain + && labCurve.offs == other.labCurve.offs + && labCurve.dehazmet == other.labCurve.dehazmet + && labCurve.brightness == other.labCurve.brightness && labCurve.contrast == other.labCurve.contrast && labCurve.chromaticity == other.labCurve.chromaticity diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 47dccb47f..4e31a477d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -283,6 +283,13 @@ public: bool avoidcolorshift; double rstprotection; bool lcredsk; + int str; + int scal; + int neigh; + int gain; + int offs; + Glib::ustring dehazmet; + }; /** diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index c22cf25fa..600d5e902 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -427,7 +427,13 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavedgesensi DIRPYREQUALIZER, // EvWavedgeampli DIRPYREQUALIZER, //EvWavlev3nois - DIRPYREQUALIZER //EvWavNPmet + DIRPYREQUALIZER, //EvWavNPmet + LUMINANCECURVE, // Evdehazmet + LUMINANCECURVE, // EvLneigh + LUMINANCECURVE, // EvLgain + LUMINANCECURVE, // EvLoffs + LUMINANCECURVE, // EvLstr + LUMINANCECURVE // EvLscal }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 048fca0c2..bffef9f14 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -901,6 +901,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, hist16C, hist16C, dummy, dummy, 1); + ipf.MSR(labView, labView->W, labView->H, 1); ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index f5b11f0e9..bf0e892e6 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -206,6 +206,61 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) curveEditorG->curveListComplete(); pack_start (*curveEditorG, Gtk::PACK_SHRINK, 4); + Gtk::HSeparator *hsepdh = Gtk::manage (new Gtk::HSeparator()); + hsepdh->show (); + pack_start (*hsepdh, Gtk::PACK_EXPAND_WIDGET, 4); + + Gtk::Frame* dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZE_LAB")) ); + dehazFrame->set_tooltip_text(M("TP_DEHAZE_LAB_TOOLTIP")); + dehazFrame->set_border_width(0); + dehazFrame->set_label_align(0.025, 0.5); + + Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox()); + dehazVBox->set_border_width(4); + dehazVBox->set_spacing(2); + + dhbox = Gtk::manage (new Gtk::HBox ()); + labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":")); + dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); + + dehazmet = Gtk::manage (new MyComboBoxText ()); + dehazmet->append_text (M("TP_DEHAZ_NONE")); + dehazmet->append_text (M("TP_DEHAZ_UNI")); + dehazmet->append_text (M("TP_DEHAZ_LOW")); + dehazmet->append_text (M("TP_DEHAZ_HIGH")); + dehazmet->set_active(0); + dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &LCurve::dehazmetChanged) ); + // dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); + dhbox->pack_start(*dehazmet); + dehazVBox->pack_start(*dhbox); + + str = Gtk::manage (new Adjuster (M("TP_LABCURVE_STR"), 0, 100., 1., 70.)); + scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 8., 1., 3.)); + neigh = Gtk::manage (new Adjuster (M("TP_LABCURVE_NEIGH"), 6, 100., 1., 80.)); + gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 0.9, 1.1, 0.01, 1.)); + offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), -50, 50, 1, 0)); + dehazVBox->pack_start (*str); + str->show (); + + dehazVBox->pack_start (*scal); + scal->show (); + + dehazVBox->pack_start (*neigh); + neigh->show (); + + // dehazVBox->pack_start (*gain); + // gain->show (); + + // dehazVBox->pack_start (*offs); + // offs->show (); + + str->setAdjusterListener (this); + scal->setAdjusterListener (this); + neigh->setAdjusterListener (this); + gain->setAdjusterListener (this); + offs->setAdjusterListener (this); + dehazFrame->add(*dehazVBox); + pack_start (*dehazFrame); } @@ -218,16 +273,26 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); + dehazmetConn.block(true); if (pedited) { brightness->setEditedState (pedited->labCurve.brightness ? Edited : UnEdited); contrast->setEditedState (pedited->labCurve.contrast ? Edited : UnEdited); - chromaticity->setEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); + chromaticity->setEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); //%%%%%%%%%%%%%%%%%%%%%% rstprotection->setEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited); avoidcolorshift->set_inconsistent (!pedited->labCurve.avoidcolorshift); lcredsk->set_inconsistent (!pedited->labCurve.lcredsk); + str->setEditedState (pedited->labCurve.str ? Edited : UnEdited); + scal->setEditedState (pedited->labCurve.scal ? Edited : UnEdited); + neigh->setEditedState (pedited->labCurve.neigh ? Edited : UnEdited); + gain->setEditedState (pedited->labCurve.gain ? Edited : UnEdited); + offs->setEditedState (pedited->labCurve.offs ? Edited : UnEdited); + + if (!pedited->labCurve.dehazmet) { + dehazmet->set_active (3); + } //%%%%%%%%%%%%%%%%%%%%%% @@ -246,6 +311,23 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) contrast->setValue (pp->labCurve.contrast); chromaticity->setValue (pp->labCurve.chromaticity); adjusterChanged(chromaticity, pp->labCurve.chromaticity); // To update the GUI sensitiveness + neigh->setValue (pp->labCurve.neigh); + gain->setValue (pp->labCurve.gain); + offs->setValue (pp->labCurve.offs); + str->setValue (pp->labCurve.str); + scal->setValue (pp->labCurve.scal); + + dehazmet->set_active (0); + if (pp->labCurve.dehazmet == "none") { + dehazmet->set_active (0); + } else if (pp->labCurve.dehazmet == "uni") { + dehazmet->set_active (1); + } else if (pp->labCurve.dehazmet == "low") { + dehazmet->set_active (2); + } else if (pp->labCurve.dehazmet == "high") { + dehazmet->set_active (3); + } + dehazmetChanged (); //%%%%%%%%%%%%%%%%%%%%%% rstprotection->setValue (pp->labCurve.rstprotection); @@ -275,6 +357,7 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) clshape->setCurve (pp->labCurve.clcurve); queue_draw(); + dehazmetConn.block(false); enableListener (); } @@ -338,6 +421,11 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pp->labCurve.brightness = brightness->getValue (); pp->labCurve.contrast = (int)contrast->getValue (); pp->labCurve.chromaticity = (int)chromaticity->getValue (); + pp->labCurve.str = str->getValue (); + pp->labCurve.scal = (int)scal->getValue (); + pp->labCurve.neigh = neigh->getValue (); + pp->labCurve.gain = (int)gain->getValue (); + pp->labCurve.offs = (int)offs->getValue (); //%%%%%%%%%%%%%%%%%%%%%% pp->labCurve.avoidcolorshift = avoidcolorshift->get_active (); @@ -366,7 +454,15 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.lcredsk = !lcredsk->get_inconsistent(); pedited->labCurve.rstprotection = rstprotection->getEditedState (); + pedited->labCurve.dehazmet = dehazmet->get_active_row_number() != 3; + //%%%%%%%%%%%%%%%%%%%%%% + pedited->labCurve.str = str->getEditedState (); + pedited->labCurve.scal = scal->getEditedState (); + pedited->labCurve.neigh = neigh->getEditedState (); + pedited->labCurve.gain = gain->getEditedState (); + pedited->labCurve.offs = offs->getEditedState (); + pedited->labCurve.lcurve = !lshape->isUnChanged (); pedited->labCurve.acurve = !ashape->isUnChanged (); @@ -377,9 +473,28 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.hhcurve = !hhshape->isUnChanged (); pedited->labCurve.lccurve = !lcshape->isUnChanged (); pedited->labCurve.clcurve = !clshape->isUnChanged (); + if (dehazmet->get_active_row_number() == 0) { + pp->labCurve.dehazmet = "none"; + } else if (dehazmet->get_active_row_number() == 1) { + pp->labCurve.dehazmet = "uni"; + } else if (dehazmet->get_active_row_number() == 2) { + pp->labCurve.dehazmet = "low"; + } else if (dehazmet->get_active_row_number() == 3) { + pp->labCurve.dehazmet = "high"; + } + + } } +void LCurve::dehazmetChanged() +{ + if (listener) { + listener->panelChanged (Evdehazmet, dehazmet->get_active_text ()); + } + } + + void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { @@ -387,18 +502,33 @@ void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedit contrast->setDefault (defParams->labCurve.contrast); chromaticity->setDefault (defParams->labCurve.chromaticity); rstprotection->setDefault (defParams->labCurve.rstprotection); + neigh->setDefault (defParams->labCurve.neigh); + gain->setDefault (defParams->labCurve.gain); + offs->setDefault (defParams->labCurve.offs); + str->setDefault (defParams->labCurve.str); + scal->setDefault (defParams->labCurve.scal); if (pedited) { brightness->setDefaultEditedState (pedited->labCurve.brightness ? Edited : UnEdited); contrast->setDefaultEditedState (pedited->labCurve.contrast ? Edited : UnEdited); chromaticity->setDefaultEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); rstprotection->setDefaultEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited); + neigh->setDefaultEditedState (pedited->labCurve.neigh ? Edited : UnEdited); + gain->setDefaultEditedState (pedited->labCurve.gain ? Edited : UnEdited); + offs->setDefaultEditedState (pedited->labCurve.offs ? Edited : UnEdited); + str->setDefaultEditedState (pedited->labCurve.str ? Edited : UnEdited); + scal->setDefaultEditedState (pedited->labCurve.scal ? Edited : UnEdited); } else { brightness->setDefaultEditedState (Irrelevant); contrast->setDefaultEditedState (Irrelevant); chromaticity->setDefaultEditedState (Irrelevant); rstprotection->setDefaultEditedState (Irrelevant); + neigh->setDefaultEditedState (Irrelevant); + gain->setDefaultEditedState (Irrelevant); + offs->setDefaultEditedState (Irrelevant); + str->setDefaultEditedState (Irrelevant); + scal->setDefaultEditedState (Irrelevant); } } @@ -531,6 +661,28 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) if (listener) { listener->panelChanged (EvLRSTProtection, costr); } + } else if (a == neigh) { + if (listener) { + listener->panelChanged (EvLneigh, costr); + } + } else if (a == str) { + if (listener) { + listener->panelChanged (EvLstr, costr); + } + } else if (a == scal) { + if (listener) { + listener->panelChanged (EvLscal, costr); + } + + } else if (a == gain) { + if (listener) { + listener->panelChanged (EvLgain, costr); + } + } else if (a == offs) { + if (listener) { + listener->panelChanged (EvLoffs, costr); + } + } else if (a == chromaticity) { if (multiImage) { //if chromaticity==-100 (lowest value), we enter the B&W mode and avoid color shift and rstprotection has no effect @@ -616,6 +768,12 @@ void LCurve::setBatchMode (bool batchMode) contrast->showEditedCB (); chromaticity->showEditedCB (); rstprotection->showEditedCB (); + dehazmet->append_text (M("GENERAL_UNCHANGED")); + neigh->showEditedCB (); + gain->showEditedCB (); + offs->showEditedCB (); + str->showEditedCB (); + scal->showEditedCB (); curveEditorG->setBatchMode (batchMode); lcshape->setBottomBarColorProvider(NULL, -1); @@ -647,4 +805,9 @@ void LCurve::trimValues (rtengine::procparams::ProcParams* pp) brightness->trimValue(pp->labCurve.brightness); contrast->trimValue(pp->labCurve.contrast); chromaticity->trimValue(pp->labCurve.chromaticity); + str->trimValue(pp->labCurve.str); + scal->trimValue(pp->labCurve.scal); + neigh->trimValue(pp->labCurve.neigh); + gain->trimValue(pp->labCurve.gain); + offs->trimValue(pp->labCurve.offs); } diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index f679fc020..9546005a1 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -34,6 +34,12 @@ protected: Adjuster* brightness; Adjuster* contrast; Adjuster* chromaticity; + Adjuster* str; + Adjuster* scal; + Adjuster* neigh; + Adjuster* gain; + Adjuster* offs; + DiagonalCurveEditor* lshape; DiagonalCurveEditor* ashape; DiagonalCurveEditor* bshape; @@ -42,6 +48,9 @@ protected: FlatCurveEditor* chshape; FlatCurveEditor* lhshape; FlatCurveEditor* hhshape; + Gtk::Label* labmdh; + Gtk::HBox* dhbox; + MyComboBoxText* dehazmet; DiagonalCurveEditor* clshape; @@ -50,7 +59,7 @@ protected: Gtk::CheckButton* lcredsk; Adjuster* rstprotection; - sigc::connection bwtconn, acconn, lcconn; + sigc::connection bwtconn, acconn, lcconn, dehazmetConn; bool lastACVal, lastLCVal; //%%%%%%%%%%%%%%%% @@ -77,6 +86,12 @@ public: void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); + + private: + void dehazmetChanged(); + + + }; #endif diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index a597662b7..c699766f1 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -58,6 +58,12 @@ void ParamsEdited::set (bool v) labCurve.hhcurve = v; labCurve.lccurve = v; labCurve.clcurve = v; + labCurve.dehazmet = v; + labCurve.str = v; + labCurve.scal = v; + labCurve.neigh = v; + labCurve.gain = v; + labCurve.offs = v; labCurve.brightness = v; labCurve.contrast = v; labCurve.chromaticity = v; @@ -513,6 +519,12 @@ void ParamsEdited::initFrom (const std::vector labCurve.hhcurve = labCurve.hhcurve && p.labCurve.hhcurve == other.labCurve.hhcurve; labCurve.lccurve = labCurve.lccurve && p.labCurve.lccurve == other.labCurve.lccurve; labCurve.clcurve = labCurve.clcurve && p.labCurve.clcurve == other.labCurve.clcurve; + labCurve.dehazmet = labCurve.dehazmet && p.labCurve.dehazmet == other.labCurve.dehazmet; + labCurve.str = labCurve.str && p.labCurve.str == other.labCurve.str; + labCurve.scal = labCurve.scal && p.labCurve.scal == other.labCurve.scal; + labCurve.neigh = labCurve.neigh && p.labCurve.neigh == other.labCurve.neigh; + labCurve.gain = labCurve.gain && p.labCurve.gain == other.labCurve.gain; + labCurve.offs = labCurve.offs && p.labCurve.offs == other.labCurve.offs; labCurve.brightness = labCurve.brightness && p.labCurve.brightness == other.labCurve.brightness; labCurve.contrast = labCurve.contrast && p.labCurve.contrast == other.labCurve.contrast; labCurve.chromaticity = labCurve.chromaticity && p.labCurve.chromaticity == other.labCurve.chromaticity; @@ -1026,7 +1038,9 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.lccurve) { toEdit.labCurve.lccurve = mods.labCurve.lccurve; } - + if (labCurve.dehazmet) { + toEdit.labCurve.dehazmet = mods.labCurve.dehazmet; + } if (labCurve.clcurve) { toEdit.labCurve.clcurve = mods.labCurve.clcurve; } @@ -1042,6 +1056,23 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.chromaticity) { toEdit.labCurve.chromaticity = dontforceSet && options.baBehav[ADDSET_LC_CHROMATICITY] ? toEdit.labCurve.chromaticity + mods.labCurve.chromaticity : mods.labCurve.chromaticity; } + if (labCurve.str) { + toEdit.labCurve.str = mods.labCurve.str; + } + + if (labCurve.scal) { + toEdit.labCurve.scal = mods.labCurve.scal; + } + + if (labCurve.neigh) { + toEdit.labCurve.neigh = mods.labCurve.neigh; + } + if (labCurve.gain) { + toEdit.labCurve.gain = mods.labCurve.gain; + } + if (labCurve.offs) { + toEdit.labCurve.offs = mods.labCurve.offs; + } if (labCurve.avoidcolorshift) { toEdit.labCurve.avoidcolorshift = mods.labCurve.avoidcolorshift; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d1f5124b1..c5516317c 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -61,6 +61,13 @@ public: bool brightness; bool contrast; bool chromaticity; + bool str; + bool scal; + bool neigh; + bool gain; + bool offs; + bool dehazmet; + bool avoidcolorshift; bool rstprotection; bool lcurve; From b941188ac82217876742c704ab31fe983403e59a Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 20 Aug 2015 13:54:18 +0200 Subject: [PATCH 02/71] Dehaze Improvement --- rtengine/dcrop.cc | 2 +- rtengine/ipdehaz.cc | 391 +++++++++++++++++++---------------------- rtengine/procevents.h | 1 + rtengine/procparams.cc | 12 ++ rtengine/procparams.h | 1 + rtengine/refreshmap.cc | 4 +- rtgui/labcurve.cc | 47 +++-- rtgui/labcurve.h | 1 + rtgui/paramsedited.cc | 5 + rtgui/paramsedited.h | 1 + 10 files changed, 238 insertions(+), 227 deletions(-) diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index bfee6c61d..4399b84cd 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -807,8 +807,8 @@ void Crop::update (int todo) bool wavcontlutili = parent->wavcontlutili; LUTu dummy; + int modedehaz; parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); - parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); parent->ipf.vibrance (labnCrop); diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index a385d92eb..16d9a3afd 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -20,169 +20,100 @@ * Retinex for bridging the gap between color images and the * human observation of scenes. IEEE Transactions on Image Processing, * 1997, 6(7): 965-976 - * inspired from 2003 Fabien Pelisson + * inspired from 2003 Fabien Pelisson */ - - - # include - # include - # include - # include - # include - #include "rtengine.h" - - #include "improcfun.h" - # define MAX_DEHAZE_SCALES 8 - # define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) + + + + + +#include +#include +#include +#include +#include +#include "rtengine.h" +#include "gauss.h" + +#include "improcfun.h" +#define MAX_DEHAZE_SCALES 6 +#define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) namespace rtengine { extern const Settings* settings; - - static float DehazeScales[MAX_DEHAZE_SCALES]; - - typedef struct - { - int N; - float sigma; - double B; - double b[4]; - } gauss3; - + +static float DehazeScales[MAX_DEHAZE_SCALES]; + void dehaze_scales( float* scales, int nscales, int mode, int s) - { - if ( nscales == 1 ) - { - scales[0] = (float)s / 2.f; - } + { + if ( nscales == 1 ) + { + scales[0] = (float)s / 2.f; + } else if (nscales == 2) - { - scales[0] = (float) s / 2.f; - scales[1] = (float) s; - } - else - { - float size_step = (float) s / (float) nscales; - - if(mode==0) { - for (int i = 0; i < nscales; ++i ) + { + scales[0] = (float) s / 2.f; + scales[1] = (float) s; + } + else + { + float size_step = (float) s / (float) nscales; + + if(mode==0) { + for (int i = 0; i < nscales; ++i ) scales[i] = 2.0f + (float)i * size_step; - } - else if (mode==1) { - size_step = (float)log(s - 2.0f) / (float) nscales; - for (int i = 0; i < nscales; ++i ) - scales[i] = 2.0f + (float)pow (10.f, (i * size_step) / log (10.f)); } - else if(mode==2){ - size_step = (float) log(s - 2.0f) / (float) nscales; - for ( int i = 0; i < nscales; ++i ) - scales[i] = s - (float)pow (10.f, (i * size_step) / log (10.f)); - } - } + else if (mode==1) { + size_step = (float)log(s - 2.0f) / (float) nscales; + for (int i = 0; i < nscales; ++i ) + scales[i] = 2.0f + (float)pow (10.f, (i * size_step) / log (10.f)); + } + else if(mode==2){ + size_step = (float) log(s - 2.0f) / (float) nscales; + for ( int i = 0; i < nscales; ++i ) + scales[i] = s - (float)pow (10.f, (i * size_step) / log (10.f)); + } + } } -void mean_stddv( float *dst, float &mean, float &stddv, int W_L, int H_L ) - { - float vsquared; - int i, j; - - vsquared = 0.0f; - mean = 0.0f; - for (int i=0; i= 2.5f ) - { - q = 0.98711f * sigma - 0.96330f; - } - else if ( (sigma >= 0.5f) && (sigma < 2.5f) ) - { - q = 3.97156f - 4.14554f * (float) sqrt ((double) 1 - 0.26891 * sigma); - } - else - { - q = 0.1147705018520355224609375f; - } - - q2 = q * q; - q3 = q * q2; - c->b[0] = (1.57825f+(2.44413f*q)+(1.4281f *q2)+(0.422205f*q3)); - c->b[1] = ( (2.44413f*q)+(2.85619f*q2)+(1.26661f *q3)); - c->b[2] = ( -((1.4281f*q2)+(1.26661f *q3))); - c->b[3] = ( (0.422205f*q3)); - c->B = 1.0f-((c->b[1]+c->b[2]+c->b[3])/c->b[0]); - c->sigma = sigma; - c->N = 3; - } + vsquared = 0.0f; + mean = 0.0f; + for (int i = 0; i B*in[i*rowstride] + - ((c->b[1]*w1[n-1] + - c->b[2]*w1[n-2] + - c->b[3]*w1[n-3] ) / c->b[0])); - } - - w2[size+1]= w1[size+3]; - w2[size+2]= w1[size+3]; - w2[size+3]= w1[size+3]; - for ( i = size, n = i; i >= 0; i--, n-- ) - { - w2[n]= out[i * rowstride] = (float)(c->B*w1[n] + - ((c->b[1]*w2[n+1] + - c->b[2]*w2[n+2] + - c->b[3]*w2[n+3] ) / c->b[0])); - } - delete [] w1; - delete [] w2; - } void ImProcFunctions::MSR(LabImage* lab, int width, int height, int skip) { - int Is; - float weight; - gauss3 coef; - float mean, stddv; - float mini, delta, maxi; - float eps = 5.f; + float pond; + float mean, stddv; + float mini, delta, maxi; + float eps = 2.f; float gain = (float) params->labCurve.gain;//def =1 not use - float offset = (float) params->labCurve.offs;//def = 0 not use + float offset = 1.f; + float neg=(float) params->labCurve.offs;//def = 0 not use float strength = (float) params->labCurve.str; int scal = params->labCurve.scal;//def=3 int nei = (int) 2.5f*params->labCurve.neigh;//def = 200 + int vart= params->labCurve.vart; int modedehaz; if(params->labCurve.dehazmet=="none") modedehaz=-1;//enabled disabled if(params->labCurve.dehazmet=="uni") modedehaz=0; @@ -191,91 +122,125 @@ void ImProcFunctions::MSR(LabImage* lab, int width, int height, int skip) if (modedehaz !=-1) {//enabled int H_L=height; int W_L=width; - float *src = new float[H_L*W_L]; - memset( src, 0, H_L*W_L * sizeof (float) ); - - float *dst = new float[H_L*W_L]; - memset( dst, 0, H_L*W_L * sizeof (float) ); - - float *out = new float[H_L*W_L]; - memset( out, 0, H_L*W_L * sizeof (float) ); - - float *in = new float[H_L*W_L]; - memset( in, 0, H_L*W_L * sizeof (float) ); - + float** src; + src = new float*[H_L]; + for (int i = 0; i < H_L; i++) { + src[i] = new float[W_L]; + memset( src[i], 0, W_L * sizeof (float) ); + } + float** dst; + dst = new float*[H_L]; + for (int i = 0; i < H_L; i++) { + dst[i] = new float[W_L]; + memset( dst[i], 0, W_L * sizeof (float) ); + } + float** in; + in = new float*[H_L]; + for (int i = 0; i < H_L; i++) { + in[i] = new float[W_L]; + memset( in[i], 0, W_L * sizeof (float) ); + } + float** out; + out = new float*[H_L]; + for (int i = 0; i < H_L; i++) { + out[i] = new float[W_L]; + memset( out[i], 0, W_L * sizeof (float) ); + } + for (int i=0; i< H_L; i++) { for (int j=0; jL[i][j] + eps; + src[i][j]=lab->L[i][j] + eps; } - } - Is = width * height ; - dehaze_scales( DehazeScales, scal, modedehaz, nei ); + } + dehaze_scales( DehazeScales, scal, modedehaz, nei ); - weight = 1.0f / (float) scal; - - int posw = 0; - for (int i = 0; i < Is ; i++ ) - { - in[i] = (float)(src[i] + eps); //avoid log(0) - } - for ( int scale = 0; scale < scal; scale++ ) - { - compute_coefs3( &coef, DehazeScales[scale] ); - for (int row = 0; row < height; row++ ) - { - posw = row * width; - gausssmooth( in + posw, out + posw, width, 1, &coef); - } - memcpy( in, out, Is * sizeof(float) ); - memset( out, 0 , Is * sizeof(float) ); - - for (int col = 0; col < width; col++ ) - { - posw = col; - gausssmooth( in + posw, out + posw, height, width, &coef ); - } - - for ( int i = 0; i < Is; i++ ) - { - dst[i] += weight * (float)( log(src[i] + eps) - log(out[i]) ); - } - } - delete [] in; - delete [] out; - - - // Ci(x,y)=log[a Ii(x,y)]-log[ Ei=1-s Ii(x,y)] - - float beta = 16384.0f; - for ( int i = 0; i < Is; i ++ ) - { - float logsrc = (float)log( (float) src[i] + eps ); - dst[i] = gain * ((float)(log(beta * (src[i] + eps)) - logsrc) * dst[i]) + offset; - } + pond = 1.0f / (float) scal; + +#ifdef _OPENMP +#pragma omp for +#endif + for (int i = 0; i < H_L ; i++ ) + for (int j=0; j buffer(max(W_L,H_L)); + gaussHorizontal (in, out, buffer, W_L, H_L, DehazeScales[scale]); + gaussVertical (out, out, buffer,W_L, H_L, DehazeScales[scale]); + } + for ( int i=0; i < H_L; i++) + for (int j=0; j < W_L; j++) + { + dst[i][j] += pond * (float)( log(src[i][j] + eps) - log(out[i][j]) ); + } + } + + for (int i = 0; i < H_L; i++) { + delete [] in[i]; + } + delete [] in; + for (int i = 0; i < H_L; i++) { + delete [] out[i]; + } + delete [] out; + + + + + +float beta=16384.0f; + + +#ifdef _OPENMP +#pragma omp for +#endif + for (int i=0; i< H_L; i++ ) + for (int j=0; jL[ii][jj]=((100.f - strength)* lab->L[ii][jj] + strength * src[i])/100.f; + if ( !delta ) delta = 1.0f; +#ifdef _OPENMP +#pragma omp for +#endif + for ( int i=0; i < H_L; i ++ ) + for (int j=0; j< W_L; j++) { + float cd = vart*32768.f * ( dst[i][j] - mini ) / delta; + src[i][j] = clipdehaz( cd, 0.f, 32768.f ); + lab->L[i][j]=((100.f - strength)* lab->L[i][j] + strength * src[i][j])/100.f; } - + + for (int i = 0; i < H_L; i++) { + delete [] dst[i]; + } delete [] dst; - delete [] src; - + for (int i = 0; i < H_L; i++) { + delete [] src[i]; + } + delete [] src; } } -} \ No newline at end of file +} + + \ No newline at end of file diff --git a/rtengine/procevents.h b/rtengine/procevents.h index d33c1f8a1..1d61b9966 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -438,6 +438,7 @@ enum ProcEvent { EvLoffs = 409, EvLstr = 410, EvLscal = 411, + EvLvart = 412, NUMOFEVENTS }; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 006b1ad2d..f4d53d671 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -887,6 +887,7 @@ void ProcParams::setDefaults () labCurve.neigh = 80; labCurve.gain = 1; labCurve.offs = 0; + labCurve.vart = 1; labCurve.avoidcolorshift = false; labCurve.lcredsk = true; labCurve.rstprotection = 0; @@ -1559,6 +1560,9 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol if (!pedited || pedited->labCurve.offs) { keyFile.set_integer ("Luminance Curve","Offs", labCurve.offs); } + if (!pedited || pedited->labCurve.vart) { + keyFile.set_integer ("Luminance Curve","Vart", labCurve.vart); + } if (!pedited || pedited->labCurve.avoidcolorshift) { keyFile.set_boolean ("Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift); @@ -3714,6 +3718,13 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.offs = true; } } + if (keyFile.has_key ("Luminance Curve", "Vart")) { + labCurve.vart = keyFile.get_integer ("Luminance Curve", "Vart"); + + if (pedited) { + pedited->labCurve.vart = true; + } + } if (ppVersion < 303) { // transform Saturation into Chromaticity @@ -7078,6 +7089,7 @@ bool ProcParams::operator== (const ProcParams& other) && labCurve.gain == other.labCurve.gain && labCurve.offs == other.labCurve.offs && labCurve.dehazmet == other.labCurve.dehazmet + && labCurve.vart == other.labCurve.vart && labCurve.brightness == other.labCurve.brightness && labCurve.contrast == other.labCurve.contrast diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 4e31a477d..91439cf2c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -289,6 +289,7 @@ public: int gain; int offs; Glib::ustring dehazmet; + int vart; }; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 600d5e902..2bd73a3c4 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -433,7 +433,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // EvLgain LUMINANCECURVE, // EvLoffs LUMINANCECURVE, // EvLstr - LUMINANCECURVE // EvLscal + LUMINANCECURVE, // EvLscal + LUMINANCECURVE // EvLvart + }; diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index bf0e892e6..c1e045407 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -235,10 +235,11 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) dehazVBox->pack_start(*dhbox); str = Gtk::manage (new Adjuster (M("TP_LABCURVE_STR"), 0, 100., 1., 70.)); - scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 8., 1., 3.)); + scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 6., 1., 3.)); neigh = Gtk::manage (new Adjuster (M("TP_LABCURVE_NEIGH"), 6, 100., 1., 80.)); - gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 0.9, 1.1, 0.01, 1.)); - offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), -50, 50, 1, 0)); + gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 0.8, 1.4, 0.01, 1.)); + offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), -10, 5, 0.1, 0)); + vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 0.5, 15., 0.01, 1)); dehazVBox->pack_start (*str); str->show (); @@ -248,17 +249,20 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) dehazVBox->pack_start (*neigh); neigh->show (); - // dehazVBox->pack_start (*gain); - // gain->show (); +// dehazVBox->pack_start (*gain); +// gain->show (); - // dehazVBox->pack_start (*offs); +// dehazVBox->pack_start (*offs); // offs->show (); +// dehazVBox->pack_start (*vart); + // vart->show (); str->setAdjusterListener (this); scal->setAdjusterListener (this); neigh->setAdjusterListener (this); gain->setAdjusterListener (this); offs->setAdjusterListener (this); + vart->setAdjusterListener (this); dehazFrame->add(*dehazVBox); pack_start (*dehazFrame); @@ -289,9 +293,13 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) neigh->setEditedState (pedited->labCurve.neigh ? Edited : UnEdited); gain->setEditedState (pedited->labCurve.gain ? Edited : UnEdited); offs->setEditedState (pedited->labCurve.offs ? Edited : UnEdited); + vart->setEditedState (pedited->labCurve.vart ? Edited : UnEdited); + // if (!pedited->labCurve.dehazmet) { + // dehazmet->set_active (3); + // } if (!pedited->labCurve.dehazmet) { - dehazmet->set_active (3); + dehazmet->set_active_text(M("GENERAL_UNCHANGED")); } //%%%%%%%%%%%%%%%%%%%%%% @@ -316,8 +324,9 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) offs->setValue (pp->labCurve.offs); str->setValue (pp->labCurve.str); scal->setValue (pp->labCurve.scal); + vart->setValue (pp->labCurve.vart); - dehazmet->set_active (0); +// dehazmet->set_active (0); if (pp->labCurve.dehazmet == "none") { dehazmet->set_active (0); } else if (pp->labCurve.dehazmet == "uni") { @@ -426,6 +435,7 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pp->labCurve.neigh = neigh->getValue (); pp->labCurve.gain = (int)gain->getValue (); pp->labCurve.offs = (int)offs->getValue (); + pp->labCurve.vart = (int)vart->getValue (); //%%%%%%%%%%%%%%%%%%%%%% pp->labCurve.avoidcolorshift = avoidcolorshift->get_active (); @@ -454,7 +464,8 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.lcredsk = !lcredsk->get_inconsistent(); pedited->labCurve.rstprotection = rstprotection->getEditedState (); - pedited->labCurve.dehazmet = dehazmet->get_active_row_number() != 3; + // pedited->labCurve.dehazmet = dehazmet->get_active_row_number() != 3; + pedited->labCurve.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); //%%%%%%%%%%%%%%%%%%%%%% pedited->labCurve.str = str->getEditedState (); @@ -462,6 +473,7 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.neigh = neigh->getEditedState (); pedited->labCurve.gain = gain->getEditedState (); pedited->labCurve.offs = offs->getEditedState (); + pedited->labCurve.vart = vart->getEditedState (); pedited->labCurve.lcurve = !lshape->isUnChanged (); @@ -473,6 +485,9 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.hhcurve = !hhshape->isUnChanged (); pedited->labCurve.lccurve = !lcshape->isUnChanged (); pedited->labCurve.clcurve = !clshape->isUnChanged (); + + + } if (dehazmet->get_active_row_number() == 0) { pp->labCurve.dehazmet = "none"; } else if (dehazmet->get_active_row_number() == 1) { @@ -482,9 +497,8 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) } else if (dehazmet->get_active_row_number() == 3) { pp->labCurve.dehazmet = "high"; } - - - } + + } void LCurve::dehazmetChanged() @@ -507,6 +521,7 @@ void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedit offs->setDefault (defParams->labCurve.offs); str->setDefault (defParams->labCurve.str); scal->setDefault (defParams->labCurve.scal); + vart->setDefault (defParams->labCurve.vart); if (pedited) { brightness->setDefaultEditedState (pedited->labCurve.brightness ? Edited : UnEdited); @@ -518,6 +533,7 @@ void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedit offs->setDefaultEditedState (pedited->labCurve.offs ? Edited : UnEdited); str->setDefaultEditedState (pedited->labCurve.str ? Edited : UnEdited); scal->setDefaultEditedState (pedited->labCurve.scal ? Edited : UnEdited); + vart->setDefaultEditedState (pedited->labCurve.vart ? Edited : UnEdited); } else { brightness->setDefaultEditedState (Irrelevant); @@ -527,6 +543,7 @@ void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedit neigh->setDefaultEditedState (Irrelevant); gain->setDefaultEditedState (Irrelevant); offs->setDefaultEditedState (Irrelevant); + vart->setDefaultEditedState (Irrelevant); str->setDefaultEditedState (Irrelevant); scal->setDefaultEditedState (Irrelevant); } @@ -682,6 +699,10 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) if (listener) { listener->panelChanged (EvLoffs, costr); } + } else if (a == vart) { + if (listener) { + listener->panelChanged (EvLvart, costr); + } } else if (a == chromaticity) { if (multiImage) { @@ -774,6 +795,7 @@ void LCurve::setBatchMode (bool batchMode) offs->showEditedCB (); str->showEditedCB (); scal->showEditedCB (); + vart->showEditedCB (); curveEditorG->setBatchMode (batchMode); lcshape->setBottomBarColorProvider(NULL, -1); @@ -810,4 +832,5 @@ void LCurve::trimValues (rtengine::procparams::ProcParams* pp) neigh->trimValue(pp->labCurve.neigh); gain->trimValue(pp->labCurve.gain); offs->trimValue(pp->labCurve.offs); + vart->trimValue(pp->labCurve.vart); } diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index 9546005a1..6fd5cd031 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -39,6 +39,7 @@ protected: Adjuster* neigh; Adjuster* gain; Adjuster* offs; + Adjuster* vart; DiagonalCurveEditor* lshape; DiagonalCurveEditor* ashape; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index c699766f1..ad4e17bcd 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -64,6 +64,7 @@ void ParamsEdited::set (bool v) labCurve.neigh = v; labCurve.gain = v; labCurve.offs = v; + labCurve.vart = v; labCurve.brightness = v; labCurve.contrast = v; labCurve.chromaticity = v; @@ -525,6 +526,7 @@ void ParamsEdited::initFrom (const std::vector labCurve.neigh = labCurve.neigh && p.labCurve.neigh == other.labCurve.neigh; labCurve.gain = labCurve.gain && p.labCurve.gain == other.labCurve.gain; labCurve.offs = labCurve.offs && p.labCurve.offs == other.labCurve.offs; + labCurve.vart = labCurve.vart && p.labCurve.vart == other.labCurve.vart; labCurve.brightness = labCurve.brightness && p.labCurve.brightness == other.labCurve.brightness; labCurve.contrast = labCurve.contrast && p.labCurve.contrast == other.labCurve.contrast; labCurve.chromaticity = labCurve.chromaticity && p.labCurve.chromaticity == other.labCurve.chromaticity; @@ -1073,6 +1075,9 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.offs) { toEdit.labCurve.offs = mods.labCurve.offs; } + if (labCurve.vart) { + toEdit.labCurve.vart = mods.labCurve.vart; + } if (labCurve.avoidcolorshift) { toEdit.labCurve.avoidcolorshift = mods.labCurve.avoidcolorshift; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index c5516317c..7820aadc9 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -67,6 +67,7 @@ public: bool gain; bool offs; bool dehazmet; + bool vart; bool avoidcolorshift; bool rstprotection; From 3bddbc8d6fc6e032fb4798f1cfe00b0f6c1d3572 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 23 Aug 2015 16:41:51 +0200 Subject: [PATCH 03/71] Dehaze with Rawprocess --- rtdata/languages/default | 6 +++ rtengine/curves.cc | 34 ++++++++++++++ rtengine/curves.h | 1 + rtengine/dcrop.cc | 2 +- rtengine/imagesource.h | 3 ++ rtengine/improccoordinator.cc | 25 ++++++++--- rtengine/improccoordinator.h | 1 + rtengine/improcfun.h | 2 +- rtengine/ipdehaz.cc | 46 +++++++++---------- rtengine/previewimage.cc | 4 ++ rtengine/procevents.h | 2 +- rtengine/procparams.cc | 22 ++++++++-- rtengine/procparams.h | 1 + rtengine/rawimagesource.cc | 83 +++++++++++++++++++++++++++++++++-- rtengine/rawimagesource.h | 3 ++ rtengine/refreshmap.cc | 15 ++++--- rtengine/simpleprocess.cc | 20 +++++++-- rtgui/labcurve.cc | 54 ++++++++++++++++++----- rtgui/labcurve.h | 2 + rtgui/paramsedited.cc | 5 +++ rtgui/paramsedited.h | 1 + 21 files changed, 272 insertions(+), 60 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index c3b29f8f1..b3df9c5c8 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -642,6 +642,8 @@ HISTORY_MSG_409;Dehaze gain HISTORY_MSG_410;Dehaze offset HISTORY_MSG_411;Dehaze strength HISTORY_MSG_412;Dehaze scales +HISTORY_MSG_413;Dehaze var +HISTORY_MSG_414;Dehaze histogram HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1511,6 +1513,7 @@ TP_LABCURVE_BRIGHTNESS;Lightness TP_LABCURVE_CHROMATICITY;Chromaticity TP_LABCURVE_CHROMA_TOOLTIP;To apply B&W toning, set Chromaticity to -100. TP_LABCURVE_CONTRAST;Contrast +TP_LABCURVE_CONTEDIT;Histogram equalizer TP_LABCURVE_CURVEEDITOR;Luminance Curve TP_LABCURVE_CURVEEDITOR_A_RANGE1;Green Saturated TP_LABCURVE_CURVEEDITOR_A_RANGE2;Green Pastel @@ -1526,6 +1529,8 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE2;Dull TP_LABCURVE_CURVEEDITOR_CC_RANGE3;Pastel TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturated TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity according to chromaticity C=f(C) +TP_LABCURVE_CURVEEDITOR_CD;CL +TP_LABCURVE_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L) TP_LABCURVE_CURVEEDITOR_CH;CH TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticity according to hue C=f(H) TP_LABCURVE_CURVEEDITOR_CL;CL @@ -1549,6 +1554,7 @@ TP_LABCURVE_GAIN;Gain TP_LABCURVE_OFFS;Offset TP_DEHAZE_LAB;Dehaze TP_DEHAZE_LAB_TOOLTIP;Use Retinex algorithm (Lab) to improve dehaze..defog... +TP_LABCURVE_VART;Variance TP_DEHAZE_MET;Dehaze method TP_DEHAZ_NONE;None TP_DEHAZ_UNI;Uniform diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 4e94be1b8..9997b38d8 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -502,6 +502,40 @@ void CurveFactory::curveCL ( bool & clcutili, const std::vector& clcurve dCurve = NULL; } } + +void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip) +{ + bool needed; + DiagonalCurve* dCurve = NULL; + + bool histNeededCL = false; + + needed = false; + + if (!dehaclcurvePoints.empty() && dehaclcurvePoints[0] != 0) { + dCurve = new DiagonalCurve (dehaclcurvePoints, CURVES_MIN_POLY_POINTS / skip); + + if (dCurve && !dCurve->isIdentity()) { + needed = true; + dehacontlutili = true; + } + } + + for (int i = 0; i < 32768; i++) { //32768*1.414 + ... + int hi = (int)(255.0 * CLIPD((float)i / 32767.0)); // + } + + + fillCurveArray(dCurve, dehaclCurve, skip, needed); + + if (dCurve) { + delete dCurve; + dCurve = NULL; + } +} + + + // add curve Lab wavelet : Cont=f(L) void CurveFactory::curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve, /*LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip) { diff --git a/rtengine/curves.h b/rtengine/curves.h index f43542dba..22f0d77fa 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -282,6 +282,7 @@ public: static void curveCL ( bool & clcutili, const std::vector& clcurvePoints, LUTf & clCurve, LUTu & histogramcl, LUTu & outBeforeCLurveHistogram, int skip); static void curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve,/* LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip); + static void curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip); static void curveToningCL ( bool & clctoningutili, const std::vector& clcurvePoints, LUTf & clToningCurve, int skip); static void curveToningLL ( bool & llctoningutili, const std::vector& llcurvePoints, LUTf & llToningCurve, int skip); diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 4399b84cd..be7f76302 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -808,7 +808,7 @@ void Crop::update (int todo) LUTu dummy; int modedehaz; - parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); + // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); parent->ipf.vibrance (labnCrop); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 557f9a0b8..277794a54 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,12 +69,15 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; + virtual void dehaz (RAWParams raw, ColorManagementParams cmp, LCurveParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; + virtual void MSR(LabImage* lab, int width, int height, int skip, LCurveParams lcur) {}; virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified + // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* virtual void getImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, ToneCurveParams hlp, ColorManagementParams cmp, RAWParams raw) {} diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 6c9451874..00e973e37 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -46,6 +46,7 @@ ImProcCoordinator::ImProcCoordinator () satcurve(65536, 0), lhskcurve(65536, 0), clcurve(65536, 0), + cdcurve(65536, 0), wavclCurve(65536, 0), clToningcurve(65536, 0), cl2Toningcurve(65536, 0), @@ -163,7 +164,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } RAWParams rp = params.raw; - + ColorManagementParams cmp = params.icm; + LCurveParams lcur = params.labCurve; if( !highDetailNeeded ) { // if below 100% magnification, take a fast path if(rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none] && rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono]) { @@ -219,7 +221,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - imgsrc->demosaic( rp ); + imgsrc->demosaic( rp);//enabled demosaic + if (highDetailNeeded) { highDetailRawComputed = true; @@ -231,7 +234,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) highDetailRawComputed = false; } } - + bool dehacontlutili=false; + CurveFactory::curveDehaContL (dehacontlutili, params.labCurve.cdcurve, cdcurve, 1); + + if (todo & M_INIT || params.labCurve.dehazmet!="none"){ + if(params.labCurve.dehazmet!="none") + imgsrc->dehaz( params.raw, params.icm, params.labCurve, cdcurve, dehacontlutili);//enabled Dehaze + + } // Updating toneCurve.hrenabled if necessary // It has to be done there, because the next 'if' statement will use the value computed here if (todo & M_AUTOEXP) { @@ -248,8 +258,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (todo & (M_INIT | M_LINDENOISE)) { MyMutex::MyLock initLock(minit); // Also used in crop window - - imgsrc->HLRecovery_Global( params.toneCurve ); // this handles Color HLRecovery + + imgsrc->HLRecovery_Global( params.toneCurve); // this handles Color HLRecovery + if (settings->verbose) { printf ("Applying white balance, color correction & sRBG conversion...\n"); @@ -294,7 +305,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) imgsrc->getImage (currWB, tr, orig_prev, pp, params.toneCurve, params.icm, params.raw); //ColorTemp::CAT02 (orig_prev, ¶ms) ; - + // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); /* Issue 2785, disabled some 1:1 tools if (todo & M_LINDENOISE) { DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; @@ -576,7 +587,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) nprevl->CopyFrom(oprevl); progress ("Applying Color Boost...", 100 * readyphase / numofphases); - ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); + // ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); ipf.chromiLuminanceCurve (NULL, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histCLurve, histLLCurve, histLCurve); ipf.vibrance(nprevl); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index e0588d5df..cce71995e 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -94,6 +94,7 @@ protected: LUTf satcurve; LUTf lhskcurve; LUTf clcurve; + LUTf cdcurve; LUTf wavclCurve; LUTf clToningcurve; LUTf cl2Toningcurve; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index fb7269fe5..b9aa4838b 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -306,7 +306,7 @@ public: //void RGB_OutputTransf(LabImage * src, Imagefloat * dst, const procparams::DirPyrDenoiseParams & dnparams); //void output_tile_row (float *Lbloxrow, float ** Lhipassdn, float ** tilemask, int height, int width, int top, int blkrad ); - void MSR(LabImage* lab, int width, int height, int skip); +// void MSR(LabImage* lab, int width, int height, int skip); void Tile_calc (int tilesize, int overlap, int kall, int imwidth, int imheight, int &numtiles_W, int &numtiles_H, int &tilewidth, int &tileheight, int &tileWskip, int &tileHskip); void ip_wavelet(LabImage * lab, LabImage * dst, int kall, const procparams::WaveletParams & waparams, const WavCurve & wavCLVCcurve, const WavOpacityCurveRG & waOpacityCurveRG, const WavOpacityCurveBY & waOpacityCurveBY, const WavOpacityCurveW & waOpacityCurveW, const WavOpacityCurveWL & waOpacityCurveWL, LUTf &wavclCurve, bool wavcontlutili, int skip); diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 16d9a3afd..e405456ea 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -35,7 +35,7 @@ #include #include "rtengine.h" #include "gauss.h" - +#include "rawimagesource.h" #include "improcfun.h" #define MAX_DEHAZE_SCALES 6 #define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) @@ -100,25 +100,29 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L ) -void ImProcFunctions::MSR(LabImage* lab, int width, int height, int skip) +void RawImageSource::MSR(LabImage* lab, int width, int height, int skip, LCurveParams lcur) { float pond; float mean, stddv; float mini, delta, maxi; float eps = 2.f; - float gain = (float) params->labCurve.gain;//def =1 not use - float offset = 1.f; - float neg=(float) params->labCurve.offs;//def = 0 not use - float strength = (float) params->labCurve.str; - int scal = params->labCurve.scal;//def=3 - int nei = (int) 2.5f*params->labCurve.neigh;//def = 200 - int vart= params->labCurve.vart; + float gain = (float) lcur.gain;//def =1 not use + gain=1.f; + float gain2 = (float) lcur.gain;//def =1 not use + gain2/=100.f; + float offset =(float) lcur.offs;//def = 0 not use + offset = 0.f; + float strength = (float) lcur.str; + int scal = lcur.scal;//def=3 + int nei = (int) 2.5f*lcur.neigh;//def = 200 + float vart = (float)lcur.vart;//variance + vart /=100.f; int modedehaz; - if(params->labCurve.dehazmet=="none") modedehaz=-1;//enabled disabled - if(params->labCurve.dehazmet=="uni") modedehaz=0; - if(params->labCurve.dehazmet=="low") modedehaz=1; - if(params->labCurve.dehazmet=="high") modedehaz=2; + if(lcur.dehazmet=="none") modedehaz=-1;//enabled disabled + if(lcur.dehazmet=="uni") modedehaz=0; + if(lcur.dehazmet=="low") modedehaz=1; + if(lcur.dehazmet=="high") modedehaz=2; if (modedehaz !=-1) {//enabled int H_L=height; int W_L=width; @@ -171,9 +175,10 @@ void ImProcFunctions::MSR(LabImage* lab, int width, int height, int skip) #pragma omp parallel #endif { - AlignedBufferMP buffer(max(W_L,H_L)); - gaussHorizontal (in, out, buffer, W_L, H_L, DehazeScales[scale]); - gaussVertical (out, out, buffer,W_L, H_L, DehazeScales[scale]); + AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); + gaussHorizontal (in, out, *pBuffer, W_L, H_L, DehazeScales[scale]); + gaussVertical (out, out, *pBuffer,W_L, H_L, DehazeScales[scale]); + delete pBuffer; } for ( int i=0; i < H_L; i++) for (int j=0; j < W_L; j++) @@ -210,13 +215,10 @@ float beta=16384.0f; mean=0.f;stddv=0.f; mean_stddv( dst, mean, stddv, W_L, H_L); - float nstdv=1.25f; - mini = mean - 1.2f*stddv; - maxi = mean + 1.2f*stddv; - // mini = neg; + mini = mean - vart*stddv; + maxi = mean + vart*stddv; delta = maxi - mini; - // delta = vart; printf("maxi=%f mini=%f mean=%f std=%f delta=%f\n", maxi, mini, mean, stddv, delta); if ( !delta ) delta = 1.0f; @@ -225,7 +227,7 @@ float beta=16384.0f; #endif for ( int i=0; i < H_L; i ++ ) for (int j=0; j< W_L; j++) { - float cd = vart*32768.f * ( dst[i][j] - mini ) / delta; + float cd = gain2*32768.f * ( dst[i][j] - mini ) / delta; src[i][j] = clipdehaz( cd, 0.f, 32768.f ); lab->L[i][j]=((100.f - strength)* lab->L[i][j] + strength * src[i][j])/100.f; } diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index 0c2509e7d..1e0f15593 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -121,6 +121,9 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext rtengine::Image8 *output = NULL; const unsigned char *data = NULL; int fw, fh; + LUTf cdcurve; + bool dehacontlutili=false; + procparams::ProcParams params; /*rtengine::RAWParams raw; rtengine::LensProfParams lensProf; @@ -137,6 +140,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; rawImage.preprocess(params.raw, params.lensProf, params.coarse); rawImage.demosaic(params.raw); + // rawImage.dehaz(params.raw, params.icm, params.labCurve, cdcurve, dehacontlutili); Imagefloat* image = new rtengine::Imagefloat (fw, fh); rawImage.getImage (wb, TR_NONE, image, pp, params.toneCurve, params.icm, params.raw); output = new Image8(fw, fh); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 1d61b9966..8d9693d28 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -439,7 +439,7 @@ enum ProcEvent { EvLstr = 410, EvLscal = 411, EvLvart = 412, - + EvLCDCurve = 413, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index f4d53d671..cf8d34b15 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -882,12 +882,12 @@ void ProcParams::setDefaults () labCurve.brightness = 0; labCurve.contrast = 0; labCurve.chromaticity = 0; - labCurve.str = 70; + labCurve.str = 60; labCurve.scal = 3; labCurve.neigh = 80; - labCurve.gain = 1; + labCurve.gain = 100; labCurve.offs = 0; - labCurve.vart = 1; + labCurve.vart = 125; labCurve.avoidcolorshift = false; labCurve.lcredsk = true; labCurve.rstprotection = 0; @@ -911,6 +911,8 @@ void ProcParams::setDefaults () labCurve.lccurve.push_back(DCT_Linear); labCurve.clcurve.clear (); labCurve.clcurve.push_back(DCT_Linear); + labCurve.cdcurve.clear (); + labCurve.cdcurve.push_back(DCT_Linear); rgbCurves.lumamode = false; rgbCurves.rcurve.clear (); @@ -1624,6 +1626,11 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_double_list("Luminance Curve", "ClCurve", clcurve); } + if (!pedited || pedited->labCurve.cdcurve) { + Glib::ArrayHandle cdcurve = labCurve.cdcurve; + keyFile.set_double_list("Luminance Curve", "CDCurve", cdcurve); + } + // save sharpening if (!pedited || pedited->sharpening.enabled) { keyFile.set_boolean ("Sharpening", "Enabled", sharpening.enabled); @@ -3872,6 +3879,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Luminance Curve", "CDCurve")) { + labCurve.cdcurve = keyFile.get_double_list ("Luminance Curve", "CDCurve"); + + if (pedited) { + pedited->labCurve.cdcurve = true; + } + } + } // load sharpening @@ -7083,6 +7098,7 @@ bool ProcParams::operator== (const ProcParams& other) && labCurve.hhcurve == other.labCurve.hhcurve && labCurve.lccurve == other.labCurve.lccurve && labCurve.clcurve == other.labCurve.clcurve + && labCurve.cdcurve == other.labCurve.cdcurve && labCurve.str == other.labCurve.str && labCurve.scal == other.labCurve.scal && labCurve.neigh == other.labCurve.neigh diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 91439cf2c..f6d92a0fb 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -277,6 +277,7 @@ public: std::vector hhcurve; std::vector lccurve; std::vector clcurve; + std::vector cdcurve; int brightness; int contrast; int chromaticity; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b425a9f88..dbd7e9c9a 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1734,7 +1734,6 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le return; } - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% void RawImageSource::demosaic(const RAWParams &raw) @@ -1787,8 +1786,10 @@ void RawImageSource::demosaic(const RAWParams &raw) } t2.set(); + rgbSourceModified = false; + if( settings->verbose ) { if (getSensorType() == ST_BAYER) { @@ -1797,9 +1798,83 @@ void RawImageSource::demosaic(const RAWParams &raw) printf("Demosaicing X-Trans data: %s - %d usec\n", raw.xtranssensor.method.c_str(), t2.etime(t1)); } } - } +void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, LCurveParams lcur, LUTf & cdcurve, bool dehacontlutili) +{ + + MyTime t4, t5; + t4.set(); + if(!rgbSourceModified) { + if (settings->verbose) { + printf ("Applying DeHaze\n"); + } + + TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); + TMatrix wiprof = iccStore->workingSpaceInverseMatrix (cmp.working); + + double wip[3][3] = { + {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, + {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, + {wiprof[2][0], wiprof[2][1], wiprof[2][2]} + }; + + double wp[3][3] = { + {wprof[0][0], wprof[0][1], wprof[0][2]}, + {wprof[1][0], wprof[1][1], wprof[1][2]}, + {wprof[2][0], wprof[2][1], wprof[2][2]} + }; + LabImage * labdeha = new LabImage(W, H); + + #pragma omp parallel for + for (int i = 0; i lab + Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); + //convert Lab + Color::XYZ2Lab(X, Y, Z, L, aa, bb); + labdeha->L[i][j]=L; + // if(lcur.dehazmet !="none") { + if(dehacontlutili) labdeha->L[i][j]=cdcurve[L];//apply curve to equalize histogram + // } + labdeha->a[i][j]=aa; + labdeha->b[i][j]=bb; + + } + + MSR(labdeha, W, H, 1, lcur); + + #pragma omp parallel for + for (int i = 0; i L[i][j]; + a2=labdeha->a[i][j]; + b2=labdeha->b[i][j]; + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wip); + red[i][j]=R; + green[i][j]=G; + blue[i][j]=B; + } + + delete labdeha; + + t5.set(); + + + + if( settings->verbose ) { + printf("Dehaz=%d usec\n", t5.etime(t4)); + + } + rgbSourceModified = true; + } +} + + void RawImageSource::flushRawData() { if(cache) { @@ -1827,18 +1902,18 @@ void RawImageSource::flushRGB() } } -void RawImageSource::HLRecovery_Global(ToneCurveParams hrp ) +void RawImageSource::HLRecovery_Global(ToneCurveParams hrp) { if (hrp.hrenabled && hrp.method == "Color") { if(!rgbSourceModified) { if (settings->verbose) { printf ("Applying Highlight Recovery: Color propagation...\n"); } - HLRecovery_inpaint (red, green, blue); rgbSourceModified = true; } } + } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index d4ebf9928..3ce1f1089 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -151,6 +151,7 @@ public: int load (Glib::ustring fname, bool batch = false); void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); + void dehaz (RAWParams raw, ColorManagementParams cmp, LCurveParams lcur, LUTf & cdcurve, bool dehacontlutili); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); @@ -226,6 +227,7 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); + void MSR(LabImage* lab, int width, int height, int skip, LCurveParams lcur); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], // multi_array2D & hfsize, multi_array2D & hilite, int box ); @@ -271,6 +273,7 @@ protected: void jdl_interpolate_omp(); void igv_interpolate(int winw, int winh); void lmmse_interpolate_omp(int winw, int winh, int iterations); + // void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); void amaze_demosaic_RT(int winx, int winy, int winw, int winh);//Emil's code for AMaZE void fast_demosaic(int winx, int winy, int winw, int winh );//Emil's code for fast demosaicing diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 2bd73a3c4..32cc0b6b8 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -428,13 +428,14 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavedgeampli DIRPYREQUALIZER, //EvWavlev3nois DIRPYREQUALIZER, //EvWavNPmet - LUMINANCECURVE, // Evdehazmet - LUMINANCECURVE, // EvLneigh - LUMINANCECURVE, // EvLgain - LUMINANCECURVE, // EvLoffs - LUMINANCECURVE, // EvLstr - LUMINANCECURVE, // EvLscal - LUMINANCECURVE // EvLvart + ALLNORAW, // Evdehazmet + ALLNORAW, // EvLneigh + ALLNORAW, // EvLgain + ALLNORAW, // EvLoffs + ALLNORAW, // EvLstr + ALLNORAW, // EvLscal + ALLNORAW, // EvLvart + ALLNORAW // EvLCDCurve }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index bffef9f14..3c30b0bb4 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -115,13 +115,25 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (pl) { pl->setProgress (0.30); } + LUTf cdcurve (65536, 0); + + bool dehacontlutili=false; + CurveFactory::curveDehaContL (dehacontlutili, params.labCurve.cdcurve, cdcurve, 1); + + if(params.labCurve.dehazmet!="none") + imgsrc->dehaz( params.raw, params.icm, params.labCurve, cdcurve, dehacontlutili );//enabled Dehaze - imgsrc->HLRecovery_Global( params.toneCurve ); if (pl) { pl->setProgress (0.40); } + imgsrc->HLRecovery_Global( params.toneCurve ); + + if (pl) { + pl->setProgress (0.45); + } + // set the color temperature ColorTemp currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); @@ -610,7 +622,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw); if (pl) { - pl->setProgress (0.45); + pl->setProgress (0.50); } // LUTf Noisecurve (65536,0); @@ -847,7 +859,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p shmap = NULL; if (pl) { - pl->setProgress (0.5); + pl->setProgress (0.55); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -901,7 +913,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, hist16C, hist16C, dummy, dummy, 1); - ipf.MSR(labView, labView->W, labView->H, 1); + // ipf.MSR(labView, labView->W, labView->H, 1); ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index c1e045407..2261c6f4d 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -233,29 +233,46 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) // dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); dhbox->pack_start(*dehazmet); dehazVBox->pack_start(*dhbox); + + curveEditorGD = new CurveEditorGroup (options.lastLabCurvesDir, M("TP_LABCURVE_CONTEDIT")); + curveEditorGD->setCurveListener (this); + cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CD"))); + cdshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CD_TOOLTIP")); + std::vector milestones22; - str = Gtk::manage (new Adjuster (M("TP_LABCURVE_STR"), 0, 100., 1., 70.)); + milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshape->setBottomBarBgGradient(milestones22); + cdshape->setLeftBarBgGradient(milestones22); + + curveEditorGD->curveListComplete(); + + str = Gtk::manage (new Adjuster (M("TP_LABCURVE_STR"), 0, 100., 1., 60.)); scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 6., 1., 3.)); neigh = Gtk::manage (new Adjuster (M("TP_LABCURVE_NEIGH"), 6, 100., 1., 80.)); - gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 0.8, 1.4, 0.01, 1.)); - offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), -10, 5, 0.1, 0)); - vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 0.5, 15., 0.01, 1)); + gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 70, 130, 1, 100)); + offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), 0, 40, 0.1, 0)); + vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 100, 160, 1, 125)); dehazVBox->pack_start (*str); str->show (); - + + dehazVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); + curveEditorGD->show(); + dehazVBox->pack_start (*scal); scal->show (); dehazVBox->pack_start (*neigh); neigh->show (); -// dehazVBox->pack_start (*gain); -// gain->show (); + dehazVBox->pack_start (*gain); + gain->show (); // dehazVBox->pack_start (*offs); - // offs->show (); -// dehazVBox->pack_start (*vart); - // vart->show (); +// offs->show (); + + dehazVBox->pack_start (*vart); + vart->show (); str->setAdjusterListener (this); scal->setAdjusterListener (this); @@ -271,6 +288,8 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) LCurve::~LCurve () { delete curveEditorG; + delete curveEditorGD; + } void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) @@ -313,6 +332,7 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) hhshape->setUnChanged (!pedited->labCurve.hhcurve); lcshape->setUnChanged (!pedited->labCurve.lccurve); clshape->setUnChanged (!pedited->labCurve.clcurve); + cdshape->setUnChanged (!pedited->labCurve.cdcurve); } brightness->setValue (pp->labCurve.brightness); @@ -364,6 +384,7 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) hhshape->setCurve (pp->labCurve.hhcurve); lcshape->setCurve (pp->labCurve.lccurve); clshape->setCurve (pp->labCurve.clcurve); + cdshape->setCurve (pp->labCurve.cdcurve); queue_draw(); dehazmetConn.block(false); @@ -407,6 +428,10 @@ void LCurve::autoOpenCurve () if (!active) { clshape->openIfNonlinear(); } + + if (!active) { + cdshape->openIfNonlinear(); + } } void LCurve::setEditProvider (EditDataProvider *provider) @@ -415,6 +440,7 @@ void LCurve::setEditProvider (EditDataProvider *provider) ccshape->setEditProvider(provider); lcshape->setEditProvider(provider); clshape->setEditProvider(provider); + cdshape->setEditProvider(provider); lhshape->setEditProvider(provider); chshape->setEditProvider(provider); hhshape->setEditProvider(provider); @@ -453,6 +479,7 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pp->labCurve.hhcurve = hhshape->getCurve (); pp->labCurve.lccurve = lcshape->getCurve (); pp->labCurve.clcurve = clshape->getCurve (); + pp->labCurve.cdcurve = cdshape->getCurve (); if (pedited) { pedited->labCurve.brightness = brightness->getEditedState (); @@ -485,6 +512,7 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.hhcurve = !hhshape->isUnChanged (); pedited->labCurve.lccurve = !lcshape->isUnChanged (); pedited->labCurve.clcurve = !clshape->isUnChanged (); + pedited->labCurve.cdcurve = !cdshape->isUnChanged (); } @@ -650,6 +678,11 @@ void LCurve::curveChanged (CurveEditor* ce) if (ce == clshape) { listener->panelChanged (EvLCLCurve, M("HISTORY_CUSTOMCURVE")); } + + if (ce == cdshape) { + listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); + } + } } @@ -796,6 +829,7 @@ void LCurve::setBatchMode (bool batchMode) str->showEditedCB (); scal->showEditedCB (); vart->showEditedCB (); + curveEditorGD->setBatchMode (batchMode); curveEditorG->setBatchMode (batchMode); lcshape->setBottomBarColorProvider(NULL, -1); diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index 6fd5cd031..ae671a2f5 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -31,6 +31,7 @@ class LCurve : public ToolParamBlock, public AdjusterListener, public FoldableTo protected: CurveEditorGroup* curveEditorG; + CurveEditorGroup* curveEditorGD; Adjuster* brightness; Adjuster* contrast; Adjuster* chromaticity; @@ -54,6 +55,7 @@ protected: MyComboBoxText* dehazmet; DiagonalCurveEditor* clshape; + DiagonalCurveEditor* cdshape; //%%%%%%%%%%%%%%%% Gtk::CheckButton* avoidcolorshift; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index ad4e17bcd..30e1ad38a 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -58,6 +58,7 @@ void ParamsEdited::set (bool v) labCurve.hhcurve = v; labCurve.lccurve = v; labCurve.clcurve = v; + labCurve.cdcurve = v; labCurve.dehazmet = v; labCurve.str = v; labCurve.scal = v; @@ -520,6 +521,7 @@ void ParamsEdited::initFrom (const std::vector labCurve.hhcurve = labCurve.hhcurve && p.labCurve.hhcurve == other.labCurve.hhcurve; labCurve.lccurve = labCurve.lccurve && p.labCurve.lccurve == other.labCurve.lccurve; labCurve.clcurve = labCurve.clcurve && p.labCurve.clcurve == other.labCurve.clcurve; + labCurve.cdcurve = labCurve.cdcurve && p.labCurve.cdcurve == other.labCurve.cdcurve; labCurve.dehazmet = labCurve.dehazmet && p.labCurve.dehazmet == other.labCurve.dehazmet; labCurve.str = labCurve.str && p.labCurve.str == other.labCurve.str; labCurve.scal = labCurve.scal && p.labCurve.scal == other.labCurve.scal; @@ -1046,6 +1048,9 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.clcurve) { toEdit.labCurve.clcurve = mods.labCurve.clcurve; } + if (labCurve.cdcurve) { + toEdit.labCurve.cdcurve = mods.labCurve.cdcurve; + } if (labCurve.brightness) { toEdit.labCurve.brightness = dontforceSet && options.baBehav[ADDSET_LC_BRIGHTNESS] ? toEdit.labCurve.brightness + mods.labCurve.brightness : mods.labCurve.brightness; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 7820aadc9..021b45c86 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -81,6 +81,7 @@ public: bool hhcurve; bool lccurve; bool clcurve; + bool cdcurve; bool enabled; bool method; From 751298915715c0e608f51885cb6a54a106d0e120 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sun, 23 Aug 2015 18:51:44 +0200 Subject: [PATCH 04/71] Dehaze improvrmrnt offset --- rtengine/ipdehaz.cc | 10 +++++----- rtgui/labcurve.cc | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index e405456ea..f659a21eb 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -107,12 +107,12 @@ void RawImageSource::MSR(LabImage* lab, int width, int height, int skip, LCurveP float mean, stddv; float mini, delta, maxi; float eps = 2.f; - float gain = (float) lcur.gain;//def =1 not use - gain=1.f; + //float gain = (float) lcur.gain;//def =1 not use + float gain=1.f; float gain2 = (float) lcur.gain;//def =1 not use gain2/=100.f; - float offset =(float) lcur.offs;//def = 0 not use - offset = 0.f; + float offse =(float) lcur.offs;// + float offset = 0.f; float strength = (float) lcur.str; int scal = lcur.scal;//def=3 int nei = (int) 2.5f*lcur.neigh;//def = 200 @@ -227,7 +227,7 @@ float beta=16384.0f; #endif for ( int i=0; i < H_L; i ++ ) for (int j=0; j< W_L; j++) { - float cd = gain2*32768.f * ( dst[i][j] - mini ) / delta; + float cd = gain2*32768.f * (( dst[i][j] - mini ) / delta) + offse; src[i][j] = clipdehaz( cd, 0.f, 32768.f ); lab->L[i][j]=((100.f - strength)* lab->L[i][j] + strength * src[i][j])/100.f; } diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 2261c6f4d..16ed93c8f 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -251,7 +251,7 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 6., 1., 3.)); neigh = Gtk::manage (new Adjuster (M("TP_LABCURVE_NEIGH"), 6, 100., 1., 80.)); gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 70, 130, 1, 100)); - offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), 0, 40, 0.1, 0)); + offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), 0, 500, 1, 0)); vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 100, 160, 1, 125)); dehazVBox->pack_start (*str); str->show (); @@ -268,8 +268,8 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) dehazVBox->pack_start (*gain); gain->show (); -// dehazVBox->pack_start (*offs); -// offs->show (); + dehazVBox->pack_start (*offs); + offs->show (); dehazVBox->pack_start (*vart); vart->show (); From 2d4fe00aa3bb669d7d71ab59f2e8f386d2320d45 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 23 Aug 2015 21:45:34 +0200 Subject: [PATCH 05/71] Speedup for DeHaze (Function MSR) --- rtengine/ipdehaz.cc | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index f659a21eb..802528780 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -37,6 +37,7 @@ #include "gauss.h" #include "rawimagesource.h" #include "improcfun.h" +#include "StopWatch.h" #define MAX_DEHAZE_SCALES 6 #define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) @@ -86,6 +87,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L ) vsquared = 0.0f; mean = 0.0f; +// #pragma omp parallel for reduction(+:mean,vsquared) // will enable this later, because naturally it leads to differences for (int i = 0; i (out, out, *pBuffer,W_L, H_L, DehazeScales[scale]); delete pBuffer; } +#ifdef _OPENMP +#pragma omp parallel for +#endif for ( int i=0; i < H_L; i++) for (int j=0; j < W_L; j++) { - dst[i][j] += pond * (float)( log(src[i][j] + eps) - log(out[i][j]) ); + dst[i][j] += pond * ( xlogf((in[i][j])/out[i][j]) ); } } @@ -196,21 +199,16 @@ void RawImageSource::MSR(LabImage* lab, int width, int height, int skip, LCurveP } delete [] out; - - - - float beta=16384.0f; - +float logBeta = xlogf(beta); #ifdef _OPENMP -#pragma omp for +#pragma omp parallel for #endif for (int i=0; i< H_L; i++ ) for (int j=0; jL[i][j]=((100.f - strength)* lab->L[i][j] + strength * src[i][j])/100.f; + lab->L[i][j]=((100.f - strength)* lab->L[i][j] + strength * clipdehaz( cd, 0.f, 32768.f ))/100.f; } for (int i = 0; i < H_L; i++) { From 0bceb1e6df93418c0a1dadd7fde211bf97f61328 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 24 Aug 2015 13:13:48 +0200 Subject: [PATCH 06/71] Speedup 2 for DeHaze --- rtengine/ipdehaz.cc | 90 +++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 40 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 802528780..5a5b5c112 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -37,6 +37,7 @@ #include "gauss.h" #include "rawimagesource.h" #include "improcfun.h" +#include "opthelper.h" #include "StopWatch.h" #define MAX_DEHAZE_SCALES 6 #define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) @@ -83,11 +84,10 @@ void dehaze_scales( float* scales, int nscales, int mode, int s) void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L ) { float vsquared; - int i, j; vsquared = 0.0f; mean = 0.0f; -// #pragma omp parallel for reduction(+:mean,vsquared) // will enable this later, because naturally it leads to differences +#pragma omp parallel for reduction(+:mean,vsquared) // this leads to differences, but parallel summation is more accurate for (int i = 0; i L[i][j] + eps; } } + dehaze_scales( DehazeScales, scal, modedehaz, nei ); pond = 1.0f / (float) scal; - -#ifdef _OPENMP -#pragma omp parallel for -#endif - for (int i = 0; i < H_L ; i++ ) - for (int j=0; j* pBuffer = new AlignedBufferMP (max(W_L, H_L)); - gaussHorizontal (in, out, *pBuffer, W_L, H_L, DehazeScales[scale]); + gaussHorizontal (src, out, *pBuffer, W_L, H_L, DehazeScales[scale]); gaussVertical (out, out, *pBuffer,W_L, H_L, DehazeScales[scale]); delete pBuffer; } +#ifdef __SSE2__ +#ifdef _OPENMP +#pragma omp parallel +{ + vfloat pondv = F2V(pond); +#pragma omp for +#endif + for ( int i=0; i < H_L; i++) { + int j; + for (j=0; j < W_L-3; j+=4) + { + _mm_storeu_ps(&dst[i][j], LVFU(dst[i][j]) + pondv * ( xlogf(LVFU(src[i][j])/LVFU(out[i][j])) )); + } + for (;j < W_L; j++) + { + dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); + } + } +} +#else #ifdef _OPENMP #pragma omp parallel for #endif for ( int i=0; i < H_L; i++) for (int j=0; j < W_L; j++) { - dst[i][j] += pond * ( xlogf((in[i][j])/out[i][j]) ); + dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); } +#endif } - for (int i = 0; i < H_L; i++) { - delete [] in[i]; - } - delete [] in; for (int i = 0; i < H_L; i++) { delete [] out[i]; } delete [] out; + for (int i = 0; i < H_L; i++) { + delete [] src[i]; + } + delete [] src; float beta=16384.0f; -float logBeta = xlogf(beta); +float logBetaGain = xlogf(beta) * gain; #ifdef _OPENMP #pragma omp parallel for @@ -208,9 +223,8 @@ float logBeta = xlogf(beta); for (int i=0; i< H_L; i++ ) for (int j=0; jL[i][j]=((100.f - strength)* lab->L[i][j] + strength * clipdehaz( cd, 0.f, 32768.f ))/100.f; + float cd = cdfactor * ( dst[i][j] - mini ) + offse; + lab->L[i][j]=((1.f - strength)* lab->L[i][j] + strength * clipdehaz( cd, 0.f, 32768.f )); } for (int i = 0; i < H_L; i++) { delete [] dst[i]; } delete [] dst; - for (int i = 0; i < H_L; i++) { - delete [] src[i]; - } - delete [] src; } } } - - \ No newline at end of file From 4b29b2cf549e54d9678a976ae6533d1d716dff7d Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 24 Aug 2015 15:45:56 +0200 Subject: [PATCH 07/71] Fix compilation error --- rtengine/ipdehaz.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 5a5b5c112..4b5cc0996 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -83,18 +83,16 @@ void dehaze_scales( float* scales, int nscales, int mode, int s) void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L ) { - float vsquared; - - vsquared = 0.0f; - mean = 0.0f; -#pragma omp parallel for reduction(+:mean,vsquared) // this leads to differences, but parallel summation is more accurate + float vsquared = 0.f; + float sum = 0.f; +#pragma omp parallel for reduction(+:sum,vsquared) // this leads to differences, but parallel summation is more accurate for (int i = 0; i Date: Mon, 24 Aug 2015 16:34:29 +0200 Subject: [PATCH 08/71] Dehaze range settings --- rtengine/ipdehaz.cc | 8 ++++++++ rtgui/labcurve.cc | 6 +++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 4b5cc0996..10f2a0e4a 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -226,6 +226,14 @@ float logBetaGain = xlogf(beta) * gain; mean=0.f;stddv=0.f; mean_stddv( dst, mean, stddv, W_L, H_L); +/* for (int i=0; i< H_L; i++ ) + for (int j=0; j (mean + 1.5f * stddv)) dst[i][j] = mean + 1.5f * stddv; + if(dst[i][j] < (mean - 1.5f * stddv)) dst[i][j] = mean - 1.5f * stddv; + + } +*/ mini = mean - vart*stddv; maxi = mean + vart*stddv; delta = maxi - mini; diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 16ed93c8f..08c9ac0c2 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -250,9 +250,9 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) str = Gtk::manage (new Adjuster (M("TP_LABCURVE_STR"), 0, 100., 1., 60.)); scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 6., 1., 3.)); neigh = Gtk::manage (new Adjuster (M("TP_LABCURVE_NEIGH"), 6, 100., 1., 80.)); - gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 70, 130, 1, 100)); - offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), 0, 500, 1, 0)); - vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 100, 160, 1, 125)); + gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 50, 150, 1, 100)); + offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), 0, 3000, 1, 0)); + vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 80, 300, 1, 125)); dehazVBox->pack_start (*str); str->show (); From f22c11c27e8e65e6cf7e131791037c6814183951 Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 27 Aug 2015 17:10:31 +0200 Subject: [PATCH 09/71] Dehaze suggestions --- rtdata/languages/default | 28 ++- rtengine/imagesource.h | 4 +- rtengine/improccoordinator.cc | 17 +- rtengine/ipdehaz.cc | 6 +- rtengine/previewimage.cc | 2 +- rtengine/procevents.h | 6 +- rtengine/procparams.cc | 304 +++++++++++++++--------- rtengine/procparams.h | 36 ++- rtengine/rawimagesource.cc | 2 +- rtengine/rawimagesource.h | 4 +- rtengine/refreshmap.cc | 5 +- rtengine/simpleprocess.cc | 6 +- rtgui/CMakeLists.txt | 2 +- rtgui/dehaz.cc | 420 ++++++++++++++++++++++++++++++++++ rtgui/dehaz.h | 63 +++++ rtgui/labcurve.cc | 218 +----------------- rtgui/labcurve.h | 15 +- rtgui/options.cc | 7 + rtgui/options.h | 1 + rtgui/paramsedited.cc | 112 +++++---- rtgui/paramsedited.h | 24 +- rtgui/toolpanelcoord.cc | 3 + rtgui/toolpanelcoord.h | 2 + 23 files changed, 869 insertions(+), 418 deletions(-) create mode 100644 rtgui/dehaz.cc create mode 100644 rtgui/dehaz.h diff --git a/rtdata/languages/default b/rtdata/languages/default index b3df9c5c8..9ee60ab9b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -644,6 +644,8 @@ HISTORY_MSG_411;Dehaze strength HISTORY_MSG_412;Dehaze scales HISTORY_MSG_413;Dehaze var HISTORY_MSG_414;Dehaze histogram +HISTORY_MSG_415;Dehaze enabled +HISTORY_MSG_416;Dehaze transmission HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1547,15 +1549,29 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. -TP_LABCURVE_STR;Strength -TP_LABCURVE_SCAL;Scales -TP_LABCURVE_NEIGH;Neighboring pixels -TP_LABCURVE_GAIN;Gain -TP_LABCURVE_OFFS;Offset +TP_DEHAZ_STR;Strength +TP_DEHAZ_STR_TOOLTIP;Mixture in proportion to the original image and that obtained by Retinex algoritm +TP_DEHAZ_RETIN;Complete Retinex algoritm +TP_DEHAZ_LAB;Retinex +TP_DEHAZ_LAB_TOOLTIP;Use all component of Retinex algorihm, to improve results +TP_DEHAZ_LABEL;Dehaze +TP_DEHAZ_SCAL;Scales +TP_DEHAZ_SCAL_TOOLTIP;Low scales increase contrast but give relief effect\nHigh scales can increase noise, but give more natural images +TP_DEHAZ_NEIGH;Neighboring pixels +TP_DEHAZ_NEIGH_TOOLTIP;Take into account, neighboring pixels, by Gauss function +TP_DEHAZ_GAIN;Gain +TP_DEHAZ_OFFS;Offset +TP_DEHAZ_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings\nUsed for black or white pixels, and for better balance the histogram TP_DEHAZE_LAB;Dehaze +TP_DEHAZ_CONTEDIT;Histogram equalizer +TP_DEHAZ_CURVEEDITOR_CD;L=f(L) +TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP;Correct Raw data, to reduce halos and artifacts +TP_DEHAZ_TRANSMISSION;Transmission map TP_DEHAZE_LAB_TOOLTIP;Use Retinex algorithm (Lab) to improve dehaze..defog... -TP_LABCURVE_VART;Variance +TP_DEHAZ_VART;Variance +TP_DEHAZ_VART_TOOLTIP;Low variance increase local contrast and saturation, but can leeds to artifacts TP_DEHAZE_MET;Dehaze method +TP_DEHAZ_MET_TOOLTIP;Low :reinforce low light\nUniform :expect to equalize action\nHigh : reinforce high light TP_DEHAZ_NONE;None TP_DEHAZ_UNI;Uniform TP_DEHAZ_LOW;Low diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 277794a54..0d7c32b52 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,12 +69,12 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; - virtual void dehaz (RAWParams raw, ColorManagementParams cmp, LCurveParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; + virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; - virtual void MSR(LabImage* lab, int width, int height, int skip, LCurveParams lcur) {}; + virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) {}; virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 00e973e37..fdcb8bf27 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -208,6 +208,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) OR HLR gets disabled when Color method was selected */ // If high detail (=100%) is newly selected, do a demosaic update, since the last was just with FAST + + //I forced dehazmet with toneCurve.hrenabled=true==> probably another way ?? + + bool hrdehaz=false; + if(!params.toneCurve.hrenabled) if(params.dehaz.enabled) {hrdehaz=true; params.toneCurve.hrenabled=true;} + if ( (todo & M_RAW) || (!highDetailRawComputed && highDetailNeeded) || ( params.toneCurve.hrenabled && params.toneCurve.method != "Color" && imgsrc->IsrgbSourceModified()) @@ -235,13 +241,16 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } bool dehacontlutili=false; - CurveFactory::curveDehaContL (dehacontlutili, params.labCurve.cdcurve, cdcurve, 1); + CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - if (todo & M_INIT || params.labCurve.dehazmet!="none"){ - if(params.labCurve.dehazmet!="none") - imgsrc->dehaz( params.raw, params.icm, params.labCurve, cdcurve, dehacontlutili);//enabled Dehaze + if (todo & M_INIT || params.dehaz.enabled){ + if(params.dehaz.enabled) + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili);//enabled Dehaze } + if(hrdehaz==true) params.toneCurve.hrenabled=false; + + // Updating toneCurve.hrenabled if necessary // It has to be done there, because the next 'if' statement will use the value computed here if (todo & M_AUTOEXP) { diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 10f2a0e4a..230d51bf7 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -100,7 +100,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L ) -void RawImageSource::MSR(LabImage* lab, int width, int height, int skip, LCurveParams lcur) +void RawImageSource::MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) { StopWatch Stop1("MSR"); @@ -120,11 +120,11 @@ StopWatch Stop1("MSR"); float vart = (float)lcur.vart;//variance vart /=100.f; int modedehaz; - if(lcur.dehazmet=="none") modedehaz=-1;//enabled disabled if(lcur.dehazmet=="uni") modedehaz=0; if(lcur.dehazmet=="low") modedehaz=1; if(lcur.dehazmet=="high") modedehaz=2; - if (modedehaz !=-1) {//enabled + // if (modedehaz !=-1) {//enabled + if (lcur.enabled) {//enabled int H_L=height; int W_L=width; diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index 1e0f15593..d68ce3229 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -140,7 +140,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; rawImage.preprocess(params.raw, params.lensProf, params.coarse); rawImage.demosaic(params.raw); - // rawImage.dehaz(params.raw, params.icm, params.labCurve, cdcurve, dehacontlutili); + rawImage.dehaz(params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili); Imagefloat* image = new rtengine::Imagefloat (fw, fh); rawImage.getImage (wb, TR_NONE, image, pp, params.toneCurve, params.icm, params.raw); output = new Image8(fw, fh); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 8d9693d28..0c890d11d 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -439,7 +439,11 @@ enum ProcEvent { EvLstr = 410, EvLscal = 411, EvLvart = 412, - EvLCDCurve = 413, + EvLCDCurve = 413, + EvDehaztransmission = 414, + EvDehazEnabled = 415, + EvDehazretinex = 416, + NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index cf8d34b15..58668db0d 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -116,6 +116,65 @@ void CropParams::mapToResized(int resizedWidth, int resizedHeight, int scale, in } } +DehazParams::DehazParams () +{ + setDefaults (); +} + +void DehazParams::getDefaulttransmissionCurve(std::vector &curve) +{ + double v[16] = { 0.00, 0.3, 0.35, 0.00, + 0.25, 0.5, 0.35, 0.35, + 0.70, 0.5, 0.35, 0.35, + 1.00, 0.7, 0.00, 0.00 + }; + curve.resize(17); + curve.at(0 ) = double(FCT_MinMaxCPoints); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at(i) = v[i - 1]; + } +} + +void DehazParams::getDefaultCDCurve(std::vector &curve) +{ + double v[12] = { 0.00, 0.00, + 0.185, 0., + 0.235, 0.25, + 0.5, 0.5, + 0.8, 0.8, + 1.0, 1.0, + }; + + curve.resize(13); + curve.at(0) = double(DCT_NURBS); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at(i) = v[i - 1]; + } +} + +void DehazParams::setDefaults() +{ + enabled = false; + str = 60; + scal = 3; + neigh = 80; + gain = 100; + offs = 0; + vart = 125; + getDefaulttransmissionCurve(transmissionCurve); + getDefaultCDCurve(cdcurve); + dehazmet = "uni"; + retinex = false; +} + +//void DehazParams::getCurves(transmissionCurve &transmissionCurveLUT) const +//{ + // opacityCurveLUT.Set(this->opacityCurve); +//} + + ColorToningParams::ColorToningParams () : hlColSat(60, 80, false), shadowsColSat(80, 208, false) { setDefaults(); @@ -882,12 +941,6 @@ void ProcParams::setDefaults () labCurve.brightness = 0; labCurve.contrast = 0; labCurve.chromaticity = 0; - labCurve.str = 60; - labCurve.scal = 3; - labCurve.neigh = 80; - labCurve.gain = 100; - labCurve.offs = 0; - labCurve.vart = 125; labCurve.avoidcolorshift = false; labCurve.lcredsk = true; labCurve.rstprotection = 0; @@ -905,14 +958,11 @@ void ProcParams::setDefaults () labCurve.lhcurve.push_back(FCT_Linear); labCurve.hhcurve.clear (); labCurve.hhcurve.push_back(FCT_Linear); - labCurve.dehazmet = "none"; labCurve.lccurve.clear (); labCurve.lccurve.push_back(DCT_Linear); labCurve.clcurve.clear (); labCurve.clcurve.push_back(DCT_Linear); - labCurve.cdcurve.clear (); - labCurve.cdcurve.push_back(DCT_Linear); rgbCurves.lumamode = false; rgbCurves.rcurve.clear (); @@ -1387,6 +1437,49 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_double_list("Exposure", "Curve2", tcurve); } + //save dehaz + + if (!pedited || pedited->dehaz.str) { + keyFile.set_integer ("Dehaz", "Str", dehaz.str); + } + if (!pedited || pedited->dehaz.scal) { + keyFile.set_integer ("Dehaz", "Scal", dehaz.scal); + } + if (!pedited || pedited->dehaz.enabled) { + keyFile.set_boolean ("Dehaz", "Enabled", dehaz.enabled); + } + + if (!pedited || pedited->dehaz.retinex) { + keyFile.set_boolean ("Dehaz", "Retinex", dehaz.retinex); + } + + if (!pedited || pedited->dehaz.neigh) { + keyFile.set_integer ("Dehaz", "Neigh", dehaz.neigh); + } + if (!pedited || pedited->dehaz.gain) { + keyFile.set_integer ("Dehaz", "Gain", dehaz.gain); + } + if (!pedited || pedited->dehaz.offs) { + keyFile.set_integer ("Dehaz","Offs", dehaz.offs); + } + if (!pedited || pedited->dehaz.vart) { + keyFile.set_integer ("Dehaz","Vart", dehaz.vart); + } + + if (!pedited || pedited->dehaz.dehazmet) { + keyFile.set_string ("Dehaz", "Dehazmet",dehaz.dehazmet); + } + + if (!pedited || pedited->dehaz.cdcurve) { + Glib::ArrayHandle cdcurve = dehaz.cdcurve; + keyFile.set_double_list("Dehaz", "CDCurve", cdcurve); + } + + if (!pedited || pedited->dehaz.transmissionCurve) { + Glib::ArrayHandle transmissionCurve = dehaz.transmissionCurve; + keyFile.set_double_list("Dehaz", "TransmissionCurve", transmissionCurve); + } + // save channel mixer if (!pedited || pedited->chmixer.red[0] || pedited->chmixer.red[1] || pedited->chmixer.red[2]) { Glib::ArrayHandle rmix (chmixer.red, 3, Glib::OWNERSHIP_NONE); @@ -1546,25 +1639,6 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol if (!pedited || pedited->labCurve.chromaticity) { keyFile.set_integer ("Luminance Curve", "Chromaticity", labCurve.chromaticity); } - if (!pedited || pedited->labCurve.str) { - keyFile.set_integer ("Luminance Curve", "Str", labCurve.str); - } - if (!pedited || pedited->labCurve.scal) { - keyFile.set_integer ("Luminance Curve", "Scal", labCurve.scal); - } - - if (!pedited || pedited->labCurve.neigh) { - keyFile.set_integer ("Luminance Curve", "Neigh", labCurve.neigh); - } - if (!pedited || pedited->labCurve.gain) { - keyFile.set_integer ("Luminance Curve", "Gain", labCurve.gain); - } - if (!pedited || pedited->labCurve.offs) { - keyFile.set_integer ("Luminance Curve","Offs", labCurve.offs); - } - if (!pedited || pedited->labCurve.vart) { - keyFile.set_integer ("Luminance Curve","Vart", labCurve.vart); - } if (!pedited || pedited->labCurve.avoidcolorshift) { keyFile.set_boolean ("Luminance Curve", "AvoidColorShift", labCurve.avoidcolorshift); @@ -1617,20 +1691,11 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol Glib::ArrayHandle lccurve = labCurve.lccurve; keyFile.set_double_list("Luminance Curve", "LcCurve", lccurve); } - if (!pedited || pedited->labCurve.dehazmet) { - keyFile.set_string ("Luminance Curve", "Dehazmet",labCurve.dehazmet); - } - if (!pedited || pedited->labCurve.clcurve) { Glib::ArrayHandle clcurve = labCurve.clcurve; keyFile.set_double_list("Luminance Curve", "ClCurve", clcurve); } - if (!pedited || pedited->labCurve.cdcurve) { - Glib::ArrayHandle cdcurve = labCurve.cdcurve; - keyFile.set_double_list("Luminance Curve", "CDCurve", cdcurve); - } - // save sharpening if (!pedited || pedited->sharpening.enabled) { keyFile.set_boolean ("Sharpening", "Enabled", sharpening.enabled); @@ -3671,7 +3736,92 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } } + //load dehaz + if (keyFile.has_group ("Dehaz")) { + + if (keyFile.has_key ("Dehaz", "Retinex")) { + dehaz.retinex = keyFile.get_boolean ("Dehaz", "Retinex"); + if (pedited) { + pedited->dehaz.retinex = true; + } + } + + if (keyFile.has_key ("Dehaz", "Dehazmet")) { + dehaz.dehazmet = keyFile.get_string ("Dehaz", "Dehazmet"); + + if (pedited) { + pedited->dehaz.dehazmet = true; + } + } + if (keyFile.has_key ("Dehaz", "Enabled")) { + dehaz.enabled = keyFile.get_boolean ("Dehaz", "Enabled"); + if (pedited) { + pedited->dehaz.enabled = true; + } + } + + if (keyFile.has_key ("Dehaz", "Neigh")) { + dehaz.neigh = keyFile.get_integer ("Dehaz", "Neigh"); + + if (pedited) { + pedited->dehaz.neigh = true; + } + } + if (keyFile.has_key ("Dehaz", "Str")) { + dehaz.str = keyFile.get_integer ("Dehaz", "Str"); + + if (pedited) { + pedited->dehaz.str = true; + } + } + if (keyFile.has_key ("Dehaz", "Scal")) { + dehaz.scal = keyFile.get_integer ("Dehaz", "Scal"); + + if (pedited) { + pedited->dehaz.scal = true; + } + } + + if (keyFile.has_key ("Dehaz", "Gain")) { + dehaz.gain = keyFile.get_integer ("Dehaz", "Gain"); + + if (pedited) { + pedited->dehaz.gain = true; + } + } + if (keyFile.has_key ("Dehaz", "Offs")) { + dehaz.offs = keyFile.get_integer ("Dehaz", "Offs"); + + if (pedited) { + pedited->dehaz.offs = true; + } + } + if (keyFile.has_key ("Dehaz", "Vart")) { + dehaz.vart = keyFile.get_integer ("Dehaz", "Vart"); + + if (pedited) { + pedited->dehaz.vart = true; + } + } + + if (keyFile.has_key ("Dehaz", "CDCurve")) { + dehaz.cdcurve = keyFile.get_double_list ("Dehaz", "CDCurve"); + + if (pedited) { + pedited->dehaz.cdcurve = true; + } + } + if (keyFile.has_key ("Dehaz", "TransmissionCurve")) { + dehaz.transmissionCurve = keyFile.get_double_list ("Dehaz", "TransmissionCurve"); + + if (pedited) { + pedited->dehaz.transmissionCurve = true; + } + } + } + + // load luma curve if (keyFile.has_group ("Luminance Curve")) { if (keyFile.has_key ("Luminance Curve", "Brightness")) { @@ -3689,50 +3839,6 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.contrast = true; } } - if (keyFile.has_key ("Luminance Curve", "Neigh")) { - labCurve.neigh = keyFile.get_integer ("Luminance Curve", "Neigh"); - - if (pedited) { - pedited->labCurve.neigh = true; - } - } - if (keyFile.has_key ("Luminance Curve", "Str")) { - labCurve.str = keyFile.get_integer ("Luminance Curve", "Str"); - - if (pedited) { - pedited->labCurve.str = true; - } - } - if (keyFile.has_key ("Luminance Curve", "Scal")) { - labCurve.scal = keyFile.get_integer ("Luminance Curve", "Scal"); - - if (pedited) { - pedited->labCurve.scal = true; - } - } - - if (keyFile.has_key ("Luminance Curve", "Gain")) { - labCurve.gain = keyFile.get_integer ("Luminance Curve", "Gain"); - - if (pedited) { - pedited->labCurve.gain = true; - } - } - if (keyFile.has_key ("Luminance Curve", "Offs")) { - labCurve.offs = keyFile.get_integer ("Luminance Curve", "Offs"); - - if (pedited) { - pedited->labCurve.offs = true; - } - } - if (keyFile.has_key ("Luminance Curve", "Vart")) { - labCurve.vart = keyFile.get_integer ("Luminance Curve", "Vart"); - - if (pedited) { - pedited->labCurve.vart = true; - } - } - if (ppVersion < 303) { // transform Saturation into Chromaticity // if Saturation == 0, should we set BWToning on? @@ -3847,14 +3953,6 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.lhcurve = true; } } - if (keyFile.has_key ("Luminance Curve", "Dehazmet")) { - labCurve.dehazmet = keyFile.get_string ("Luminance Curve", "Dehazmet"); - - if (pedited) { - pedited->labCurve.dehazmet = true; - } - } - if (keyFile.has_key ("Luminance Curve", "hhCurve")) { labCurve.hhcurve = keyFile.get_double_list ("Luminance Curve", "hhCurve"); @@ -3879,14 +3977,6 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Luminance Curve", "CDCurve")) { - labCurve.cdcurve = keyFile.get_double_list ("Luminance Curve", "CDCurve"); - - if (pedited) { - pedited->labCurve.cdcurve = true; - } - } - } // load sharpening @@ -7089,6 +7179,17 @@ bool ProcParams::operator== (const ProcParams& other) && toneCurve.curveMode2 == other.toneCurve.curveMode2 && toneCurve.hrenabled == other.toneCurve.hrenabled && toneCurve.method == other.toneCurve.method + && dehaz.cdcurve == other.dehaz.cdcurve + && dehaz.transmissionCurve == other.dehaz.transmissionCurve + && dehaz.str == other.dehaz.str + && dehaz.scal == other.dehaz.scal + && dehaz.neigh == other.dehaz.neigh + && dehaz.gain == other.dehaz.gain + && dehaz.offs == other.dehaz.offs + && dehaz.dehazmet == other.dehaz.dehazmet + && dehaz.vart == other.dehaz.vart + && dehaz.enabled == other.dehaz.enabled + && dehaz.retinex == other.dehaz.retinex && labCurve.lcurve == other.labCurve.lcurve && labCurve.acurve == other.labCurve.acurve && labCurve.bcurve == other.labCurve.bcurve @@ -7098,15 +7199,6 @@ bool ProcParams::operator== (const ProcParams& other) && labCurve.hhcurve == other.labCurve.hhcurve && labCurve.lccurve == other.labCurve.lccurve && labCurve.clcurve == other.labCurve.clcurve - && labCurve.cdcurve == other.labCurve.cdcurve - && labCurve.str == other.labCurve.str - && labCurve.scal == other.labCurve.scal - && labCurve.neigh == other.labCurve.neigh - && labCurve.gain == other.labCurve.gain - && labCurve.offs == other.labCurve.offs - && labCurve.dehazmet == other.labCurve.dehazmet - && labCurve.vart == other.labCurve.vart - && labCurve.brightness == other.labCurve.brightness && labCurve.contrast == other.labCurve.contrast && labCurve.chromaticity == other.labCurve.chromaticity diff --git a/rtengine/procparams.h b/rtengine/procparams.h index f6d92a0fb..82fb2fc4d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -259,6 +259,32 @@ public: void setDefaults(); static bool HLReconstructionNecessary(LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw); }; +/** + * Parameters of Dehaz + */ +class DehazParams +{ + +public: + bool enabled; + std::vector cdcurve; + std::vector transmissionCurve; + int str; + int scal; + int neigh; + int gain; + int offs; + Glib::ustring dehazmet; + int vart; + bool retinex; + DehazParams (); + void setDefaults(); + // void getCurves(transmissionCurve &transmissionCurveLUT) const; + + static void getDefaulttransmissionCurve(std::vector &curve); + static void getDefaultCDCurve(std::vector &curve); + +}; /** @@ -277,21 +303,12 @@ public: std::vector hhcurve; std::vector lccurve; std::vector clcurve; - std::vector cdcurve; int brightness; int contrast; int chromaticity; bool avoidcolorshift; double rstprotection; bool lcredsk; - int str; - int scal; - int neigh; - int gain; - int offs; - Glib::ustring dehazmet; - int vart; - }; /** @@ -1196,6 +1213,7 @@ class ProcParams public: ToneCurveParams toneCurve; ///< Tone curve parameters LCurveParams labCurve; ///< CIELAB luminance curve parameters + DehazParams dehaz; ///< Dehaz parameters RGBCurvesParams rgbCurves; ///< RGB curves parameters ColorToningParams colorToning; ///< Color Toning parameters SharpeningParams sharpening; ///< Sharpening parameters diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index dbd7e9c9a..a5d223aa0 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1800,7 +1800,7 @@ void RawImageSource::demosaic(const RAWParams &raw) } } -void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, LCurveParams lcur, LUTf & cdcurve, bool dehacontlutili) +void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) { MyTime t4, t5; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 3ce1f1089..5a58d935e 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -151,7 +151,7 @@ public: int load (Glib::ustring fname, bool batch = false); void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); - void dehaz (RAWParams raw, ColorManagementParams cmp, LCurveParams lcur, LUTf & cdcurve, bool dehacontlutili); + void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); @@ -227,7 +227,7 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(LabImage* lab, int width, int height, int skip, LCurveParams lcur); + void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], // multi_array2D & hfsize, multi_array2D & hilite, int box ); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 32cc0b6b8..aa1cad0f7 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -435,7 +435,10 @@ int refreshmap[rtengine::NUMOFEVENTS] = { ALLNORAW, // EvLstr ALLNORAW, // EvLscal ALLNORAW, // EvLvart - ALLNORAW // EvLCDCurve + ALLNORAW, // EvLCDCurve + ALLNORAW, // EvDehazOpacity + ALLNORAW, // EvDehazEnabled + ALLNORAW // EvDehazretinex }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 3c30b0bb4..628c86dd8 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -118,10 +118,10 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p LUTf cdcurve (65536, 0); bool dehacontlutili=false; - CurveFactory::curveDehaContL (dehacontlutili, params.labCurve.cdcurve, cdcurve, 1); + CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - if(params.labCurve.dehazmet!="none") - imgsrc->dehaz( params.raw, params.icm, params.labCurve, cdcurve, dehacontlutili );//enabled Dehaze + if(params.dehaz.dehazmet!="none") + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili );//enabled Dehaze if (pl) { diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index c21dd6c55..d49b2dbe6 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -17,7 +17,7 @@ set (BASESOURCEFILES previewloader.cc rtimage.cc inspector.cc histogrampanel.cc history.cc imagearea.cc imageareapanel.cc iptcpanel.cc labcurve.cc main.cc - multilangmgr.cc mycurve.cc myflatcurve.cc mydiagonalcurve.cc options.cc + multilangmgr.cc mycurve.cc myflatcurve.cc mydiagonalcurve.cc options.cc dehaz.cc preferences.cc profilepanel.cc saveasdlg.cc saveformatpanel.cc soundman.cc splash.cc thumbnail.cc tonecurve.cc toolbar.cc diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc new file mode 100644 index 000000000..8323a6a9e --- /dev/null +++ b/rtgui/dehaz.cc @@ -0,0 +1,420 @@ +/* + * This file is part of RawTherapee. + */ +#include "dehaz.h" +#include "mycurve.h" + +using namespace rtengine; +using namespace rtengine::procparams; + +Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, true) +{ + CurveListener::setMulti(true); + std::vector milestones; + + dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) ); + dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP")); + dehazFrame->set_border_width(0); + dehazFrame->set_label_align(0.025, 0.5); + + Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox()); + dehazVBox->set_border_width(4); + dehazVBox->set_spacing(2); + + Gtk::VBox * RetiVBox = Gtk::manage ( new Gtk::VBox()); + RetiVBox->set_border_width(4); + RetiVBox->set_spacing(2); + + dhbox = Gtk::manage (new Gtk::HBox ()); + labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":")); + dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); + + dehazmet = Gtk::manage (new MyComboBoxText ()); + dehazmet->append_text (M("TP_DEHAZ_LOW")); + dehazmet->append_text (M("TP_DEHAZ_UNI")); + dehazmet->append_text (M("TP_DEHAZ_HIGH")); + dehazmet->set_active(0); + dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) ); + dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); + dhbox->pack_start(*dehazmet); + dehazVBox->pack_start(*dhbox); + std::vector defaultCurve; + + curveEditorGD = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDIT")); + curveEditorGD->setCurveListener (this); + rtengine::DehazParams::getDefaultCDCurve(defaultCurve); + cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD"))); + cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cdshape->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP")); + std::vector milestones22; + + milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshape->setBottomBarBgGradient(milestones22); + cdshape->setLeftBarBgGradient(milestones22); + + curveEditorGD->curveListComplete(); + + transmissionCurveEditorG = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_TRANSMISSION")); + transmissionCurveEditorG->setCurveListener (this); + + rtengine::DehazParams::getDefaulttransmissionCurve(defaultCurve); + transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false)); + transmissionShape->setIdentityValue(0.); + transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + transmissionShape->setBottomBarBgGradient(milestones); + transmissionCurveEditorG->set_tooltip_markup (M("TP_DEHAZ_TRANS_TOOLTIP")); + + transmissionCurveEditorG->curveListComplete(); + + + + str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 60.)); + str->set_tooltip_markup (M("TP_DEHAZ_STR_TOOLTIP")); + neigh = Gtk::manage (new Adjuster (M("TP_DEHAZ_NEIGH"), 6, 100., 1., 80.)); + + retinex = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_RETIN"))); + retinex->set_active (true); + retinexConn = retinex->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::retinexChanged) ); + + dehazVBox->pack_start (*str); + str->show (); + + dehazVBox->pack_start (*neigh); + neigh->show (); + neigh->set_tooltip_markup (M("TP_DEHAZ_NEIGH_TOOLTIP")); + + dehazVBox->pack_start (*retinex); + retinex->show (); + + scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 6., 1., 3.)); + gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 50, 150, 1, 100)); + offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -3000, 3000, 1, 0)); + vart = Gtk::manage (new Adjuster (M("TP_DEHAZ_VART"), 80, 250, 1, 125)); + gain->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP")); + scal->set_tooltip_markup (M("TP_DEHAZ_SCAL_TOOLTIP")); + vart->set_tooltip_markup (M("TP_DEHAZ_VART_TOOLTIP")); + + RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); + curveEditorGD->show(); + + RetiVBox->pack_start (*scal); + scal->show (); + + + RetiVBox->pack_start (*gain); + gain->show (); + + RetiVBox->pack_start (*offs); + offs->show (); + + RetiVBox->pack_start (*vart); + vart->show (); + + RetiVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); + transmissionCurveEditorG->show(); + + + str->setAdjusterListener (this); + scal->setAdjusterListener (this); + neigh->setAdjusterListener (this); + gain->setAdjusterListener (this); + offs->setAdjusterListener (this); + vart->setAdjusterListener (this); + pack_start (*dehazVBox); + dehazFrame->add(*RetiVBox); + pack_start (*dehazFrame); + dehazFrame->hide(); + + disableListener(); + retinexChanged(); + enableListener(); + +} + +Dehaz::~Dehaz() +{ + delete curveEditorGD; + delete transmissionCurveEditorG; + +} + + +void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) +{ + disableListener (); + dehazmetConn.block(true); + + + if (pedited) { + scal->setEditedState (pedited->dehaz.scal ? Edited : UnEdited); + neigh->setEditedState (pedited->dehaz.neigh ? Edited : UnEdited); + gain->setEditedState (pedited->dehaz.gain ? Edited : UnEdited); + offs->setEditedState (pedited->dehaz.offs ? Edited : UnEdited); + vart->setEditedState (pedited->dehaz.vart ? Edited : UnEdited); + set_inconsistent (multiImage && !pedited->dehaz.enabled); + retinex->set_inconsistent (!pedited->dehaz.retinex); + + + if (!pedited->dehaz.dehazmet) { + dehazmet->set_active_text(M("GENERAL_UNCHANGED")); + } + cdshape->setUnChanged (!pedited->dehaz.cdcurve); + transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve); + + } + + neigh->setValue (pp->dehaz.neigh); + gain->setValue (pp->dehaz.gain); + offs->setValue (pp->dehaz.offs); + str->setValue (pp->dehaz.str); + scal->setValue (pp->dehaz.scal); + vart->setValue (pp->dehaz.vart); + + setEnabled (pp->dehaz.enabled); + + retinexConn.block (true); + retinex->set_active (pp->dehaz.retinex); + retinexConn.block (false); + lastretinex = pp->dehaz.retinex; + + + if (pp->dehaz.dehazmet == "low") { + dehazmet->set_active (0); + } else if (pp->dehaz.dehazmet == "uni") { + dehazmet->set_active (1); + } else if (pp->dehaz.dehazmet == "high") { + dehazmet->set_active (2); + } + dehazmetChanged (); + retinexConn.block(false); + retinexChanged (); + retinexConn.block(false); + + cdshape->setCurve (pp->dehaz.cdcurve); + dehazmetConn.block(false); + transmissionShape->setCurve (pp->dehaz.transmissionCurve); + + + enableListener (); +} +void Dehaz::retinexUpdateUI () +{ + if (!batchMode) { + if (retinex->get_active ()) { + scal->show(); + gain->show(); + offs->show(); + vart->show(); + transmissionCurveEditorG->show(); + curveEditorGD->show(); + dehazFrame->show(); + } else { + scal->hide(); + gain->hide(); + offs->hide(); + vart->hide(); + transmissionCurveEditorG->hide(); + curveEditorGD->hide(); + dehazFrame->hide(); + } + } +} + + + +void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) +{ + + pp->dehaz.str = str->getValue (); + pp->dehaz.scal = (int)scal->getValue (); + pp->dehaz.neigh = neigh->getValue (); + pp->dehaz.gain = (int)gain->getValue (); + pp->dehaz.offs = (int)offs->getValue (); + pp->dehaz.vart = (int)vart->getValue (); + pp->dehaz.cdcurve = cdshape->getCurve (); + pp->dehaz.transmissionCurve = transmissionShape->getCurve (); + pp->dehaz.enabled = getEnabled(); + pp->dehaz.retinex = retinex->get_active(); + + if (pedited) { + pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); + + //%%%%%%%%%%%%%%%%%%%%%% + pedited->dehaz.str = str->getEditedState (); + pedited->dehaz.scal = scal->getEditedState (); + pedited->dehaz.neigh = neigh->getEditedState (); + pedited->dehaz.gain = gain->getEditedState (); + pedited->dehaz.offs = offs->getEditedState (); + pedited->dehaz.vart = vart->getEditedState (); + pedited->dehaz.cdcurve = !cdshape->isUnChanged (); + pedited->dehaz.transmissionCurve = !transmissionShape->isUnChanged (); + pedited->dehaz.enabled = !get_inconsistent(); + pedited->dehaz.retinex = !retinex->get_inconsistent(); + + } + if (dehazmet->get_active_row_number() == 0) { + pp->dehaz.dehazmet = "low"; + } else if (dehazmet->get_active_row_number() == 1) { + pp->dehaz.dehazmet = "uni"; + } else if (dehazmet->get_active_row_number() == 2) { + pp->dehaz.dehazmet = "high"; + } +} + +void Dehaz::dehazmetChanged() +{ + if (listener) { + listener->panelChanged (Evdehazmet, dehazmet->get_active_text ()); + } + } + +void Dehaz::retinexChanged () +{ + if (batchMode) { + if (retinex->get_inconsistent()) { + retinex->set_inconsistent (false); + retinexConn.block (true); + retinex->set_active (false); + retinexConn.block (false); + } else if (lastretinex) { + retinex->set_inconsistent (true); + } + + lastretinex = retinex->get_active (); + } + retinexUpdateUI(); + + if (listener) { + if (retinex->get_active()) { + if (getEnabled()) { + listener->panelChanged (EvDehazretinex, M("GENERAL_ENABLED")); + } + } else { + if (getEnabled()) { + listener->panelChanged (EvDehazretinex, M("GENERAL_DISABLED")); + } + } + + } +} + + + +void Dehaz::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) +{ + + neigh->setDefault (defParams->dehaz.neigh); + gain->setDefault (defParams->dehaz.gain); + offs->setDefault (defParams->dehaz.offs); + str->setDefault (defParams->dehaz.str); + scal->setDefault (defParams->dehaz.scal); + vart->setDefault (defParams->dehaz.vart); + + if (pedited) { + neigh->setDefaultEditedState (pedited->dehaz.neigh ? Edited : UnEdited); + gain->setDefaultEditedState (pedited->dehaz.gain ? Edited : UnEdited); + offs->setDefaultEditedState (pedited->dehaz.offs ? Edited : UnEdited); + str->setDefaultEditedState (pedited->dehaz.str ? Edited : UnEdited); + scal->setDefaultEditedState (pedited->dehaz.scal ? Edited : UnEdited); + vart->setDefaultEditedState (pedited->dehaz.vart ? Edited : UnEdited); + + } else { + neigh->setDefaultEditedState (Irrelevant); + gain->setDefaultEditedState (Irrelevant); + offs->setDefaultEditedState (Irrelevant); + vart->setDefaultEditedState (Irrelevant); + str->setDefaultEditedState (Irrelevant); + scal->setDefaultEditedState (Irrelevant); + } +} +/* +void Dehaz::setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd) +{ + +} +*/ + +void Dehaz::adjusterChanged (Adjuster* a, double newval) +{ + + if (!listener || !getEnabled()) { + return; + } + + if (a == neigh) { + listener->panelChanged (EvLneigh, neigh->getTextValue()); + } else if (a == str) { + listener->panelChanged (EvLstr, str->getTextValue()); + } else if (a == scal) { + listener->panelChanged (EvLscal, scal->getTextValue()); + } else if (a == gain) { + listener->panelChanged (EvLgain, gain->getTextValue()); + } else if (a == offs) { + listener->panelChanged (EvLoffs, offs->getTextValue()); + } else if (a == vart) { + listener->panelChanged (EvLvart, vart->getTextValue()); + } +} + + + +void Dehaz::autoOpenCurve () +{ + cdshape->openIfNonlinear(); + transmissionShape->openIfNonlinear(); + +} + + +void Dehaz::curveChanged (CurveEditor* ce) +{ + if (listener && getEnabled()) { + if (ce == cdshape) { + listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); + } else if (ce == transmissionShape) { + listener->panelChanged (EvDehaztransmission, M("HISTORY_CUSTOMCURVE")); + } + } +} + +void Dehaz::enabledChanged () +{ + + if (listener) { + if (get_inconsistent()) { + listener->panelChanged (EvDehazEnabled, M("GENERAL_UNCHANGED")); + } else if (getEnabled()) { + listener->panelChanged (EvDehazEnabled, M("GENERAL_ENABLED")); + } else { + listener->panelChanged (EvDehazEnabled, M("GENERAL_DISABLED")); + } + } +} + + +void Dehaz::trimValues (rtengine::procparams::ProcParams* pp) +{ + str->trimValue(pp->dehaz.str); + scal->trimValue(pp->dehaz.scal); + neigh->trimValue(pp->dehaz.neigh); + gain->trimValue(pp->dehaz.gain); + offs->trimValue(pp->dehaz.offs); + vart->trimValue(pp->dehaz.vart); + +} + +void Dehaz::setBatchMode (bool batchMode) +{ + ToolPanel::setBatchMode (batchMode); + neigh->showEditedCB (); + gain->showEditedCB (); + offs->showEditedCB (); + str->showEditedCB (); + scal->showEditedCB (); + vart->showEditedCB (); + curveEditorGD->setBatchMode (batchMode); + transmissionCurveEditorG->setBatchMode (batchMode); + + +} diff --git a/rtgui/dehaz.h b/rtgui/dehaz.h new file mode 100644 index 000000000..9cf0614c5 --- /dev/null +++ b/rtgui/dehaz.h @@ -0,0 +1,63 @@ +/* + * This file is part of RawTherapee. + */ +#ifndef _DEHAZ_H_ +#define _DEHAZ_H_ + +#include +#include "adjuster.h" +#include "toolpanel.h" +#include "guiutils.h" +#include "curveeditor.h" +#include "curveeditorgroup.h" +#include "thresholdadjuster.h" +#include "colorprovider.h" + +class Dehaz : public ToolParamBlock, public FoldableToolPanel, public CurveListener, + public AdjusterListener +{ + +protected: + CurveEditorGroup* curveEditorGD; + Adjuster* str; + Adjuster* scal; + Adjuster* neigh; + Adjuster* gain; + Adjuster* offs; + Adjuster* vart; + + Gtk::Label* labmdh; + Gtk::HBox* dhbox; + MyComboBoxText* dehazmet; + Gtk::CheckButton* retinex; + Gtk::Frame* dehazFrame; + + DiagonalCurveEditor* cdshape; + CurveEditorGroup* transmissionCurveEditorG; + sigc::connection dehazmetConn; + FlatCurveEditor* transmissionShape; + bool lastretinex; + sigc::connection retinexConn; + +public: + Dehaz (); + ~Dehaz (); + + void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = NULL); + void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = NULL); + void setBatchMode (bool batchMode); + void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = NULL); + void trimValues (rtengine::procparams::ProcParams* pp); + void adjusterChanged (Adjuster* a, double newval); +// void setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd); + void autoOpenCurve (); + void retinexChanged (); + + void enabledChanged (); + void curveChanged (CurveEditor* ce); + void dehazmetChanged(); + void retinexUpdateUI(); + +}; + +#endif diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 08c9ac0c2..2fb7f250c 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -210,85 +210,11 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) hsepdh->show (); pack_start (*hsepdh, Gtk::PACK_EXPAND_WIDGET, 4); - Gtk::Frame* dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZE_LAB")) ); - dehazFrame->set_tooltip_text(M("TP_DEHAZE_LAB_TOOLTIP")); - dehazFrame->set_border_width(0); - dehazFrame->set_label_align(0.025, 0.5); - - Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox()); - dehazVBox->set_border_width(4); - dehazVBox->set_spacing(2); - - dhbox = Gtk::manage (new Gtk::HBox ()); - labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":")); - dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); - - dehazmet = Gtk::manage (new MyComboBoxText ()); - dehazmet->append_text (M("TP_DEHAZ_NONE")); - dehazmet->append_text (M("TP_DEHAZ_UNI")); - dehazmet->append_text (M("TP_DEHAZ_LOW")); - dehazmet->append_text (M("TP_DEHAZ_HIGH")); - dehazmet->set_active(0); - dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &LCurve::dehazmetChanged) ); - // dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); - dhbox->pack_start(*dehazmet); - dehazVBox->pack_start(*dhbox); - - curveEditorGD = new CurveEditorGroup (options.lastLabCurvesDir, M("TP_LABCURVE_CONTEDIT")); - curveEditorGD->setCurveListener (this); - cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_LABCURVE_CURVEEDITOR_CD"))); - cdshape->setTooltip(M("TP_LABCURVE_CURVEEDITOR_CD_TOOLTIP")); - std::vector milestones22; - - milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); - cdshape->setBottomBarBgGradient(milestones22); - cdshape->setLeftBarBgGradient(milestones22); - - curveEditorGD->curveListComplete(); - - str = Gtk::manage (new Adjuster (M("TP_LABCURVE_STR"), 0, 100., 1., 60.)); - scal = Gtk::manage (new Adjuster (M("TP_LABCURVE_SCAL"), 1, 6., 1., 3.)); - neigh = Gtk::manage (new Adjuster (M("TP_LABCURVE_NEIGH"), 6, 100., 1., 80.)); - gain = Gtk::manage (new Adjuster (M("TP_LABCURVE_GAIN"), 50, 150, 1, 100)); - offs = Gtk::manage (new Adjuster (M("TP_LABCURVE_OFFS"), 0, 3000, 1, 0)); - vart = Gtk::manage (new Adjuster (M("TP_LABCURVE_VART"), 80, 300, 1, 125)); - dehazVBox->pack_start (*str); - str->show (); - - dehazVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); - curveEditorGD->show(); - - dehazVBox->pack_start (*scal); - scal->show (); - - dehazVBox->pack_start (*neigh); - neigh->show (); - - dehazVBox->pack_start (*gain); - gain->show (); - - dehazVBox->pack_start (*offs); - offs->show (); - - dehazVBox->pack_start (*vart); - vart->show (); - - str->setAdjusterListener (this); - scal->setAdjusterListener (this); - neigh->setAdjusterListener (this); - gain->setAdjusterListener (this); - offs->setAdjusterListener (this); - vart->setAdjusterListener (this); - dehazFrame->add(*dehazVBox); - pack_start (*dehazFrame); - } LCurve::~LCurve () { delete curveEditorG; - delete curveEditorGD; } @@ -296,30 +222,16 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); - dehazmetConn.block(true); if (pedited) { brightness->setEditedState (pedited->labCurve.brightness ? Edited : UnEdited); contrast->setEditedState (pedited->labCurve.contrast ? Edited : UnEdited); - chromaticity->setEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); + chromaticity->setEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); //%%%%%%%%%%%%%%%%%%%%%% rstprotection->setEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited); avoidcolorshift->set_inconsistent (!pedited->labCurve.avoidcolorshift); lcredsk->set_inconsistent (!pedited->labCurve.lcredsk); - str->setEditedState (pedited->labCurve.str ? Edited : UnEdited); - scal->setEditedState (pedited->labCurve.scal ? Edited : UnEdited); - neigh->setEditedState (pedited->labCurve.neigh ? Edited : UnEdited); - gain->setEditedState (pedited->labCurve.gain ? Edited : UnEdited); - offs->setEditedState (pedited->labCurve.offs ? Edited : UnEdited); - vart->setEditedState (pedited->labCurve.vart ? Edited : UnEdited); - - // if (!pedited->labCurve.dehazmet) { - // dehazmet->set_active (3); - // } - if (!pedited->labCurve.dehazmet) { - dehazmet->set_active_text(M("GENERAL_UNCHANGED")); - } //%%%%%%%%%%%%%%%%%%%%%% @@ -332,32 +244,12 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) hhshape->setUnChanged (!pedited->labCurve.hhcurve); lcshape->setUnChanged (!pedited->labCurve.lccurve); clshape->setUnChanged (!pedited->labCurve.clcurve); - cdshape->setUnChanged (!pedited->labCurve.cdcurve); } brightness->setValue (pp->labCurve.brightness); contrast->setValue (pp->labCurve.contrast); chromaticity->setValue (pp->labCurve.chromaticity); adjusterChanged(chromaticity, pp->labCurve.chromaticity); // To update the GUI sensitiveness - neigh->setValue (pp->labCurve.neigh); - gain->setValue (pp->labCurve.gain); - offs->setValue (pp->labCurve.offs); - str->setValue (pp->labCurve.str); - scal->setValue (pp->labCurve.scal); - vart->setValue (pp->labCurve.vart); - -// dehazmet->set_active (0); - if (pp->labCurve.dehazmet == "none") { - dehazmet->set_active (0); - } else if (pp->labCurve.dehazmet == "uni") { - dehazmet->set_active (1); - } else if (pp->labCurve.dehazmet == "low") { - dehazmet->set_active (2); - } else if (pp->labCurve.dehazmet == "high") { - dehazmet->set_active (3); - } - dehazmetChanged (); - //%%%%%%%%%%%%%%%%%%%%%% rstprotection->setValue (pp->labCurve.rstprotection); @@ -384,10 +276,8 @@ void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) hhshape->setCurve (pp->labCurve.hhcurve); lcshape->setCurve (pp->labCurve.lccurve); clshape->setCurve (pp->labCurve.clcurve); - cdshape->setCurve (pp->labCurve.cdcurve); queue_draw(); - dehazmetConn.block(false); enableListener (); } @@ -429,9 +319,6 @@ void LCurve::autoOpenCurve () clshape->openIfNonlinear(); } - if (!active) { - cdshape->openIfNonlinear(); - } } void LCurve::setEditProvider (EditDataProvider *provider) @@ -440,7 +327,6 @@ void LCurve::setEditProvider (EditDataProvider *provider) ccshape->setEditProvider(provider); lcshape->setEditProvider(provider); clshape->setEditProvider(provider); - cdshape->setEditProvider(provider); lhshape->setEditProvider(provider); chshape->setEditProvider(provider); hhshape->setEditProvider(provider); @@ -456,13 +342,6 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pp->labCurve.brightness = brightness->getValue (); pp->labCurve.contrast = (int)contrast->getValue (); pp->labCurve.chromaticity = (int)chromaticity->getValue (); - pp->labCurve.str = str->getValue (); - pp->labCurve.scal = (int)scal->getValue (); - pp->labCurve.neigh = neigh->getValue (); - pp->labCurve.gain = (int)gain->getValue (); - pp->labCurve.offs = (int)offs->getValue (); - pp->labCurve.vart = (int)vart->getValue (); - //%%%%%%%%%%%%%%%%%%%%%% pp->labCurve.avoidcolorshift = avoidcolorshift->get_active (); pp->labCurve.lcredsk = lcredsk->get_active (); @@ -479,7 +358,6 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pp->labCurve.hhcurve = hhshape->getCurve (); pp->labCurve.lccurve = lcshape->getCurve (); pp->labCurve.clcurve = clshape->getCurve (); - pp->labCurve.cdcurve = cdshape->getCurve (); if (pedited) { pedited->labCurve.brightness = brightness->getEditedState (); @@ -491,17 +369,6 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.lcredsk = !lcredsk->get_inconsistent(); pedited->labCurve.rstprotection = rstprotection->getEditedState (); - // pedited->labCurve.dehazmet = dehazmet->get_active_row_number() != 3; - pedited->labCurve.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); - - //%%%%%%%%%%%%%%%%%%%%%% - pedited->labCurve.str = str->getEditedState (); - pedited->labCurve.scal = scal->getEditedState (); - pedited->labCurve.neigh = neigh->getEditedState (); - pedited->labCurve.gain = gain->getEditedState (); - pedited->labCurve.offs = offs->getEditedState (); - pedited->labCurve.vart = vart->getEditedState (); - pedited->labCurve.lcurve = !lshape->isUnChanged (); pedited->labCurve.acurve = !ashape->isUnChanged (); @@ -512,31 +379,12 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.hhcurve = !hhshape->isUnChanged (); pedited->labCurve.lccurve = !lcshape->isUnChanged (); pedited->labCurve.clcurve = !clshape->isUnChanged (); - pedited->labCurve.cdcurve = !cdshape->isUnChanged (); } - if (dehazmet->get_active_row_number() == 0) { - pp->labCurve.dehazmet = "none"; - } else if (dehazmet->get_active_row_number() == 1) { - pp->labCurve.dehazmet = "uni"; - } else if (dehazmet->get_active_row_number() == 2) { - pp->labCurve.dehazmet = "low"; - } else if (dehazmet->get_active_row_number() == 3) { - pp->labCurve.dehazmet = "high"; - } - } -void LCurve::dehazmetChanged() -{ - if (listener) { - listener->panelChanged (Evdehazmet, dehazmet->get_active_text ()); - } - } - - void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) { @@ -544,36 +392,16 @@ void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedit contrast->setDefault (defParams->labCurve.contrast); chromaticity->setDefault (defParams->labCurve.chromaticity); rstprotection->setDefault (defParams->labCurve.rstprotection); - neigh->setDefault (defParams->labCurve.neigh); - gain->setDefault (defParams->labCurve.gain); - offs->setDefault (defParams->labCurve.offs); - str->setDefault (defParams->labCurve.str); - scal->setDefault (defParams->labCurve.scal); - vart->setDefault (defParams->labCurve.vart); - if (pedited) { brightness->setDefaultEditedState (pedited->labCurve.brightness ? Edited : UnEdited); contrast->setDefaultEditedState (pedited->labCurve.contrast ? Edited : UnEdited); chromaticity->setDefaultEditedState (pedited->labCurve.chromaticity ? Edited : UnEdited); rstprotection->setDefaultEditedState (pedited->labCurve.rstprotection ? Edited : UnEdited); - neigh->setDefaultEditedState (pedited->labCurve.neigh ? Edited : UnEdited); - gain->setDefaultEditedState (pedited->labCurve.gain ? Edited : UnEdited); - offs->setDefaultEditedState (pedited->labCurve.offs ? Edited : UnEdited); - str->setDefaultEditedState (pedited->labCurve.str ? Edited : UnEdited); - scal->setDefaultEditedState (pedited->labCurve.scal ? Edited : UnEdited); - vart->setDefaultEditedState (pedited->labCurve.vart ? Edited : UnEdited); - } else { brightness->setDefaultEditedState (Irrelevant); contrast->setDefaultEditedState (Irrelevant); chromaticity->setDefaultEditedState (Irrelevant); rstprotection->setDefaultEditedState (Irrelevant); - neigh->setDefaultEditedState (Irrelevant); - gain->setDefaultEditedState (Irrelevant); - offs->setDefaultEditedState (Irrelevant); - vart->setDefaultEditedState (Irrelevant); - str->setDefaultEditedState (Irrelevant); - scal->setDefaultEditedState (Irrelevant); } } @@ -679,9 +507,6 @@ void LCurve::curveChanged (CurveEditor* ce) listener->panelChanged (EvLCLCurve, M("HISTORY_CUSTOMCURVE")); } - if (ce == cdshape) { - listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); - } } } @@ -711,32 +536,6 @@ void LCurve::adjusterChanged (Adjuster* a, double newval) if (listener) { listener->panelChanged (EvLRSTProtection, costr); } - } else if (a == neigh) { - if (listener) { - listener->panelChanged (EvLneigh, costr); - } - } else if (a == str) { - if (listener) { - listener->panelChanged (EvLstr, costr); - } - } else if (a == scal) { - if (listener) { - listener->panelChanged (EvLscal, costr); - } - - } else if (a == gain) { - if (listener) { - listener->panelChanged (EvLgain, costr); - } - } else if (a == offs) { - if (listener) { - listener->panelChanged (EvLoffs, costr); - } - } else if (a == vart) { - if (listener) { - listener->panelChanged (EvLvart, costr); - } - } else if (a == chromaticity) { if (multiImage) { //if chromaticity==-100 (lowest value), we enter the B&W mode and avoid color shift and rstprotection has no effect @@ -822,15 +621,6 @@ void LCurve::setBatchMode (bool batchMode) contrast->showEditedCB (); chromaticity->showEditedCB (); rstprotection->showEditedCB (); - dehazmet->append_text (M("GENERAL_UNCHANGED")); - neigh->showEditedCB (); - gain->showEditedCB (); - offs->showEditedCB (); - str->showEditedCB (); - scal->showEditedCB (); - vart->showEditedCB (); - curveEditorGD->setBatchMode (batchMode); - curveEditorG->setBatchMode (batchMode); lcshape->setBottomBarColorProvider(NULL, -1); lcshape->setLeftBarColorProvider(NULL, -1); @@ -861,10 +651,4 @@ void LCurve::trimValues (rtengine::procparams::ProcParams* pp) brightness->trimValue(pp->labCurve.brightness); contrast->trimValue(pp->labCurve.contrast); chromaticity->trimValue(pp->labCurve.chromaticity); - str->trimValue(pp->labCurve.str); - scal->trimValue(pp->labCurve.scal); - neigh->trimValue(pp->labCurve.neigh); - gain->trimValue(pp->labCurve.gain); - offs->trimValue(pp->labCurve.offs); - vart->trimValue(pp->labCurve.vart); } diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index ae671a2f5..765574a67 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -31,17 +31,10 @@ class LCurve : public ToolParamBlock, public AdjusterListener, public FoldableTo protected: CurveEditorGroup* curveEditorG; - CurveEditorGroup* curveEditorGD; +// CurveEditorGroup* curveEditorGD; Adjuster* brightness; Adjuster* contrast; Adjuster* chromaticity; - Adjuster* str; - Adjuster* scal; - Adjuster* neigh; - Adjuster* gain; - Adjuster* offs; - Adjuster* vart; - DiagonalCurveEditor* lshape; DiagonalCurveEditor* ashape; DiagonalCurveEditor* bshape; @@ -52,7 +45,6 @@ protected: FlatCurveEditor* hhshape; Gtk::Label* labmdh; Gtk::HBox* dhbox; - MyComboBoxText* dehazmet; DiagonalCurveEditor* clshape; DiagonalCurveEditor* cdshape; @@ -62,7 +54,7 @@ protected: Gtk::CheckButton* lcredsk; Adjuster* rstprotection; - sigc::connection bwtconn, acconn, lcconn, dehazmetConn; + sigc::connection bwtconn, acconn, lcconn; bool lastACVal, lastLCVal; //%%%%%%%%%%%%%%%% @@ -90,8 +82,7 @@ public: virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); - private: - void dehazmetChanged(); + private: diff --git a/rtgui/options.cc b/rtgui/options.cc index efdb98732..5212c6505 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -177,6 +177,10 @@ void Options::updatePaths() if (lastLabCurvesDir.empty() || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { lastLabCurvesDir = preferredPath; } + + if (lastDehazDir.empty() || !safe_file_test (lastDehazDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastDehazDir = preferredPath; + } if (lastDenoiseCurvesDir.empty() || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) { lastDenoiseCurvesDir = preferredPath; @@ -682,6 +686,7 @@ void Options::setDefaults () // at the end of the "updatePaths" method. lastRgbCurvesDir = ""; lastLabCurvesDir = ""; + lastDehazDir = ""; lastDenoiseCurvesDir = ""; lastWaveletCurvesDir = ""; lastPFCurvesDir = ""; @@ -1733,6 +1738,7 @@ int Options::readFromFile (Glib::ustring fname) safeDirGet(keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir); safeDirGet(keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); safeDirGet(keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir); + safeDirGet(keyFile, "Dialogs", "LastDehazDir", lastDehazDir); safeDirGet(keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); safeDirGet(keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); safeDirGet(keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir); @@ -2069,6 +2075,7 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir); keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir); + keyFile.set_string ("Dialogs", "LastDehazDir", lastDehazDir); keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir); diff --git a/rtgui/options.h b/rtgui/options.h index 753ae01bb..f619a9455 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -278,6 +278,7 @@ public: Glib::ustring lastFlatfieldDir; Glib::ustring lastRgbCurvesDir; Glib::ustring lastLabCurvesDir; + Glib::ustring lastDehazDir; Glib::ustring lastDenoiseCurvesDir; Glib::ustring lastWaveletCurvesDir; Glib::ustring lastPFCurvesDir; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 30e1ad38a..6d81e28d8 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -49,6 +49,17 @@ void ParamsEdited::set (bool v) toneCurve.expcomp = v; toneCurve.hrenabled = v; toneCurve.method = v; + dehaz.cdcurve = v; + dehaz.dehazmet = v; + dehaz.enabled = v; + dehaz.str = v; + dehaz.scal = v; + dehaz.neigh = v; + dehaz.gain = v; + dehaz.offs = v; + dehaz.vart = v; + dehaz.transmissionCurve = v; + dehaz.retinex = v; labCurve.lcurve = v; labCurve.acurve = v; labCurve.bcurve = v; @@ -58,14 +69,6 @@ void ParamsEdited::set (bool v) labCurve.hhcurve = v; labCurve.lccurve = v; labCurve.clcurve = v; - labCurve.cdcurve = v; - labCurve.dehazmet = v; - labCurve.str = v; - labCurve.scal = v; - labCurve.neigh = v; - labCurve.gain = v; - labCurve.offs = v; - labCurve.vart = v; labCurve.brightness = v; labCurve.contrast = v; labCurve.chromaticity = v; @@ -512,6 +515,17 @@ void ParamsEdited::initFrom (const std::vector toneCurve.expcomp = toneCurve.expcomp && p.toneCurve.expcomp == other.toneCurve.expcomp; toneCurve.hrenabled = toneCurve.hrenabled && p.toneCurve.hrenabled == other.toneCurve.hrenabled; toneCurve.method = toneCurve.method && p.toneCurve.method == other.toneCurve.method; + dehaz.cdcurve = dehaz.cdcurve && p.dehaz.cdcurve == other.dehaz.cdcurve; + dehaz.transmissionCurve = dehaz.transmissionCurve && p.dehaz.transmissionCurve == other.dehaz.transmissionCurve; + dehaz.dehazmet = dehaz.dehazmet && p.dehaz.dehazmet == other.dehaz.dehazmet; + dehaz.str = dehaz.str && p.dehaz.str == other.dehaz.str; + dehaz.scal = dehaz.scal && p.dehaz.scal == other.dehaz.scal; + dehaz.neigh = dehaz.neigh && p.dehaz.neigh == other.dehaz.neigh; + dehaz.gain = dehaz.gain && p.dehaz.gain == other.dehaz.gain; + dehaz.offs = dehaz.offs && p.dehaz.offs == other.dehaz.offs; + dehaz.vart = dehaz.vart && p.dehaz.vart == other.dehaz.vart; + dehaz.enabled = dehaz.enabled && p.dehaz.enabled == other.dehaz.enabled; + dehaz.retinex = dehaz.retinex && p.dehaz.retinex == other.dehaz.retinex; labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve; labCurve.acurve = labCurve.acurve && p.labCurve.acurve == other.labCurve.acurve; labCurve.bcurve = labCurve.bcurve && p.labCurve.bcurve == other.labCurve.bcurve; @@ -521,14 +535,6 @@ void ParamsEdited::initFrom (const std::vector labCurve.hhcurve = labCurve.hhcurve && p.labCurve.hhcurve == other.labCurve.hhcurve; labCurve.lccurve = labCurve.lccurve && p.labCurve.lccurve == other.labCurve.lccurve; labCurve.clcurve = labCurve.clcurve && p.labCurve.clcurve == other.labCurve.clcurve; - labCurve.cdcurve = labCurve.cdcurve && p.labCurve.cdcurve == other.labCurve.cdcurve; - labCurve.dehazmet = labCurve.dehazmet && p.labCurve.dehazmet == other.labCurve.dehazmet; - labCurve.str = labCurve.str && p.labCurve.str == other.labCurve.str; - labCurve.scal = labCurve.scal && p.labCurve.scal == other.labCurve.scal; - labCurve.neigh = labCurve.neigh && p.labCurve.neigh == other.labCurve.neigh; - labCurve.gain = labCurve.gain && p.labCurve.gain == other.labCurve.gain; - labCurve.offs = labCurve.offs && p.labCurve.offs == other.labCurve.offs; - labCurve.vart = labCurve.vart && p.labCurve.vart == other.labCurve.vart; labCurve.brightness = labCurve.brightness && p.labCurve.brightness == other.labCurve.brightness; labCurve.contrast = labCurve.contrast && p.labCurve.contrast == other.labCurve.contrast; labCurve.chromaticity = labCurve.chromaticity && p.labCurve.chromaticity == other.labCurve.chromaticity; @@ -1010,7 +1016,49 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (toneCurve.method) { toEdit.toneCurve.method = mods.toneCurve.method; } + + if (dehaz.enabled) { + toEdit.dehaz.enabled = mods.dehaz.enabled; + } + if (dehaz.cdcurve) { + toEdit.dehaz.cdcurve = mods.dehaz.cdcurve; + } + + if (dehaz.transmissionCurve) { + toEdit.dehaz.transmissionCurve = mods.dehaz.transmissionCurve; + } + + if (dehaz.str) { + toEdit.dehaz.str = mods.dehaz.str; + } + + if (dehaz.scal) { + toEdit.dehaz.scal = mods.dehaz.scal; + } + + if (dehaz.retinex) { + toEdit.dehaz.retinex = mods.dehaz.retinex; + } + + if (dehaz.enabled) { + toEdit.dehaz.enabled = mods.dehaz.enabled; + } + + if (dehaz.neigh) { + toEdit.dehaz.neigh = mods.dehaz.neigh; + } + + if (dehaz.gain) { + toEdit.dehaz.gain = mods.dehaz.gain; + } + if (dehaz.offs) { + toEdit.dehaz.offs = mods.dehaz.offs; + } + if (dehaz.vart) { + toEdit.dehaz.vart = mods.dehaz.vart; + } + if (labCurve.lcurve) { toEdit.labCurve.lcurve = mods.labCurve.lcurve; } @@ -1042,15 +1090,15 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.lccurve) { toEdit.labCurve.lccurve = mods.labCurve.lccurve; } - if (labCurve.dehazmet) { - toEdit.labCurve.dehazmet = mods.labCurve.dehazmet; - } +// if (labCurve.dehazmet) { +// toEdit.labCurve.dehazmet = mods.labCurve.dehazmet; +// } if (labCurve.clcurve) { toEdit.labCurve.clcurve = mods.labCurve.clcurve; } - if (labCurve.cdcurve) { - toEdit.labCurve.cdcurve = mods.labCurve.cdcurve; - } + // if (labCurve.cdcurve) { + // toEdit.labCurve.cdcurve = mods.labCurve.cdcurve; + // } if (labCurve.brightness) { toEdit.labCurve.brightness = dontforceSet && options.baBehav[ADDSET_LC_BRIGHTNESS] ? toEdit.labCurve.brightness + mods.labCurve.brightness : mods.labCurve.brightness; @@ -1063,26 +1111,6 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.chromaticity) { toEdit.labCurve.chromaticity = dontforceSet && options.baBehav[ADDSET_LC_CHROMATICITY] ? toEdit.labCurve.chromaticity + mods.labCurve.chromaticity : mods.labCurve.chromaticity; } - if (labCurve.str) { - toEdit.labCurve.str = mods.labCurve.str; - } - - if (labCurve.scal) { - toEdit.labCurve.scal = mods.labCurve.scal; - } - - if (labCurve.neigh) { - toEdit.labCurve.neigh = mods.labCurve.neigh; - } - if (labCurve.gain) { - toEdit.labCurve.gain = mods.labCurve.gain; - } - if (labCurve.offs) { - toEdit.labCurve.offs = mods.labCurve.offs; - } - if (labCurve.vart) { - toEdit.labCurve.vart = mods.labCurve.vart; - } if (labCurve.avoidcolorshift) { toEdit.labCurve.avoidcolorshift = mods.labCurve.avoidcolorshift; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 021b45c86..10dbfe828 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -55,12 +55,10 @@ public: bool method; }; -class LCurveParamsEdited +class DehazParamsEdited { public: - bool brightness; - bool contrast; - bool chromaticity; + bool enabled; bool str; bool scal; bool neigh; @@ -68,7 +66,20 @@ public: bool offs; bool dehazmet; bool vart; - + bool method; + bool transmissionCurve; + bool cdcurve; + bool retinex; + +}; + + +class LCurveParamsEdited +{ +public: + bool brightness; + bool contrast; + bool chromaticity; bool avoidcolorshift; bool rstprotection; bool lcurve; @@ -81,8 +92,6 @@ public: bool hhcurve; bool lccurve; bool clcurve; - bool cdcurve; - bool enabled; bool method; }; @@ -708,6 +717,7 @@ public: LCurveParamsEdited labCurve; RGBCurvesParamsEdited rgbCurves; ColorToningEdited colorToning; + DehazParamsEdited dehaz; SharpeningParamsEdited sharpening; SharpeningParamsEdited prsharpening; SharpenEdgeParamsEdited sharpenEdge; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index c77a9cdb5..3436a9c4d 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -59,6 +59,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) colorappearance = Gtk::manage (new ColorAppearance ()); whitebalance = Gtk::manage (new WhiteBalance ()); vignetting = Gtk::manage (new Vignetting ()); + dehaz = Gtk::manage (new Dehaz ()); gradient = Gtk::manage (new Gradient ()); pcvignette = Gtk::manage (new PCVignette ()); perspective = Gtk::manage (new PerspCorrection ()); @@ -125,6 +126,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) toolPanels.push_back (colortoning); addPanel (exposurePanel, epd); toolPanels.push_back (epd); + addPanel (exposurePanel, dehaz); + toolPanels.push_back (dehaz); addPanel (exposurePanel, pcvignette); toolPanels.push_back (pcvignette); addPanel (exposurePanel, gradient); diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 8362a3f37..868fad258 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -51,6 +51,7 @@ #include "perspective.h" #include "rotate.h" #include "vignetting.h" +#include "dehaz.h" #include "gradient.h" #include "pcvignette.h" #include "toolbar.h" @@ -101,6 +102,7 @@ protected: WhiteBalance* whitebalance; Vignetting* vignetting; Gradient* gradient; + Dehaz* dehaz; PCVignette* pcvignette; LensGeometry* lensgeom; LensProfilePanel* lensProf; From 4fdbe89ebe3e0720281527d2ad7e623e90dc01fc Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 28 Aug 2015 19:57:06 +0200 Subject: [PATCH 10/71] Dehaze bug with some files --- rtengine/ipdehaz.cc | 34 ++++++++++++++++++++-------------- rtgui/paramsedited.cc | 6 +----- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 230d51bf7..1c5c64afa 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -181,13 +181,24 @@ StopWatch Stop1("MSR"); #endif for ( int i=0; i < H_L; i++) { int j; - for (j=0; j < W_L-3; j+=4) + + // for (j=0; j < W_L-3; j+=4) { - _mm_storeu_ps(&dst[i][j], LVFU(dst[i][j]) + pondv * ( xlogf(LVFU(src[i][j])/LVFU(out[i][j])) )); + + // _mm_storeu_ps(&dst[i][j], LVFU(dst[i][j]) + pondv * ( xlogf(LVFU(src[i][j])/LVFU(out[i][j])) )); } - for (;j < W_L; j++) + + // for (;j < W_L; j++) + for (int j=0;j < W_L; j++) + { - dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); + float limds =(src[i][j])/out[i][j]; + if(limds > 10000.f) limds=10000.f; + if(limds < 0.0001f) limds=0.0001f; + + // dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); + dst[i][j] += pond * ( xlogf((limds) )); + } } } @@ -198,6 +209,10 @@ StopWatch Stop1("MSR"); for ( int i=0; i < H_L; i++) for (int j=0; j < W_L; j++) { + float limds =(src[i][j])/out[i][j]; + if(limds > 10000.f) limds=10000.f; + if(limds < 0.0001f) limds=0.0001f; + dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); } #endif @@ -226,18 +241,10 @@ float logBetaGain = xlogf(beta) * gain; mean=0.f;stddv=0.f; mean_stddv( dst, mean, stddv, W_L, H_L); -/* for (int i=0; i< H_L; i++ ) - for (int j=0; j (mean + 1.5f * stddv)) dst[i][j] = mean + 1.5f * stddv; - if(dst[i][j] < (mean - 1.5f * stddv)) dst[i][j] = mean - 1.5f * stddv; - - } -*/ mini = mean - vart*stddv; maxi = mean + vart*stddv; delta = maxi - mini; -// printf("maxi=%f mini=%f mean=%f std=%f delta=%f\n", maxi, mini, mean, stddv, delta); + printf("maxi=%f mini=%f mean=%f std=%f delta=%f\n", maxi, mini, mean, stddv, delta); if ( !delta ) delta = 1.0f; float cdfactor = gain2 * 32768.f / delta; @@ -250,7 +257,6 @@ float logBetaGain = xlogf(beta) * gain; float cd = cdfactor * ( dst[i][j] - mini ) + offse; lab->L[i][j]=((1.f - strength)* lab->L[i][j] + strength * clipdehaz( cd, 0.f, 32768.f )); } - for (int i = 0; i < H_L; i++) { delete [] dst[i]; } diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 6d81e28d8..ff14758b7 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1040,11 +1040,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (dehaz.retinex) { toEdit.dehaz.retinex = mods.dehaz.retinex; } - - if (dehaz.enabled) { - toEdit.dehaz.enabled = mods.dehaz.enabled; - } - + if (dehaz.neigh) { toEdit.dehaz.neigh = mods.dehaz.neigh; } From aab584fa53a9912e2acca76a09c6bec5caf1a8fa Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 2 Sep 2015 16:05:15 +0200 Subject: [PATCH 11/71] DeHaze bugfixes, optimizations and changed behaviour of strength slider --- rtengine/color.cc | 9 + rtengine/color.h | 3 + rtengine/curves.cc | 13 +- rtengine/ipdehaz.cc | 403 +++++++++++++++++-------------------- rtengine/rawimagesource.cc | 163 +++++++++------ rtengine/rawimagesource.h | 2 +- rtengine/simpleprocess.cc | 14 +- rtgui/paramsedited.cc | 4 + 8 files changed, 307 insertions(+), 304 deletions(-) diff --git a/rtengine/color.cc b/rtengine/color.cc index c2bdcc9dd..d671d9baa 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -595,6 +595,15 @@ void Color::xyz2rgb (float x, float y, float z, float &r, float &g, float &b, co b = ((rgb_xyz[2][0] * x + rgb_xyz[2][1] * y + rgb_xyz[2][2] * z)) ; } +#ifdef __SSE2__ +void Color::xyz2rgb (vfloat x, vfloat y, vfloat z, vfloat &r, vfloat &g, vfloat &b, const vfloat rgb_xyz[3][3]) +{ + r = ((rgb_xyz[0][0] * x + rgb_xyz[0][1] * y + rgb_xyz[0][2] * z)) ; + g = ((rgb_xyz[1][0] * x + rgb_xyz[1][1] * y + rgb_xyz[1][2] * z)) ; + b = ((rgb_xyz[2][0] * x + rgb_xyz[2][1] * y + rgb_xyz[2][2] * z)) ; +} +#endif // __SSE2__ + void Color::trcGammaBW (float &r, float &g, float &b, float gammabwr, float gammabwg, float gammabwb) { // correct gamma for black and white image : pseudo TRC curve of ICC profil diff --git a/rtengine/color.h b/rtengine/color.h index 9601ec3f6..493597a33 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -293,6 +293,9 @@ public: */ static void xyz2rgb (float x, float y, float z, float &r, float &g, float &b, const double rgb_xyz[3][3]); static void xyz2rgb (float x, float y, float z, float &r, float &g, float &b, const float rgb_xyz[3][3]); +#ifdef __SSE2__ + static void xyz2rgb (vfloat x, vfloat y, vfloat z, vfloat &r, vfloat &g, vfloat &b, const vfloat rgb_xyz[3][3]); +#endif /** diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 9997b38d8..ba1be089a 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -505,13 +505,9 @@ void CurveFactory::curveCL ( bool & clcutili, const std::vector& clcurve void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip) { - bool needed; + bool needed = false; DiagonalCurve* dCurve = NULL; - bool histNeededCL = false; - - needed = false; - if (!dehaclcurvePoints.empty() && dehaclcurvePoints[0] != 0) { dCurve = new DiagonalCurve (dehaclcurvePoints, CURVES_MIN_POLY_POINTS / skip); @@ -521,11 +517,6 @@ void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve, /*LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip) { diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 1c5c64afa..66e3789f5 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -1,38 +1,33 @@ - /* - * This file is part of RawTherapee. - * - * Copyright (c) 2004-2010 Gabor Horvath - * - * RawTherapee is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * RawTherapee is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with RawTherapee. If not, see . - - * D. J. Jobson, Z. Rahman, and G. A. Woodell. A multi-scale - * Retinex for bridging the gap between color images and the - * human observation of scenes. IEEE Transactions on Image Processing, - * 1997, 6(7): 965-976 - * inspired from 2003 Fabien Pelisson - - */ - - +/* +* This file is part of RawTherapee. +* +* Copyright (c) 2004-2010 Gabor Horvath +* +* RawTherapee is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 3 of the License, or +* (at your option) any later version. +* +* RawTherapee is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with RawTherapee. If not, see . + * D. J. Jobson, Z. Rahman, and G. A. Woodell. A multi-scale + * Retinex for bridging the gap between color images and the + * human observation of scenes. IEEE Transactions on Image Processing, + * 1997, 6(7): 965-976 + * inspired from 2003 Fabien Pelisson +*/ #include #include -#include -#include -#include +#include +#include #include "rtengine.h" #include "gauss.h" #include "rawimagesource.h" @@ -40,228 +35,190 @@ #include "opthelper.h" #include "StopWatch.h" #define MAX_DEHAZE_SCALES 6 -#define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) - - namespace rtengine +#define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) + +namespace rtengine { extern const Settings* settings; -static float DehazeScales[MAX_DEHAZE_SCALES]; +static float DehazeScales[MAX_DEHAZE_SCALES]; -void dehaze_scales( float* scales, int nscales, int mode, int s) - { - if ( nscales == 1 ) - { - scales[0] = (float)s / 2.f; - } - else if (nscales == 2) - { - scales[0] = (float) s / 2.f; - scales[1] = (float) s; - } - else - { - float size_step = (float) s / (float) nscales; - - if(mode==0) { - for (int i = 0; i < nscales; ++i ) +void dehaze_scales( float* scales, int nscales, int mode, int s) +{ + if ( nscales == 1 ) { + scales[0] = (float)s / 2.f; + } else if (nscales == 2) { + scales[0] = (float) s / 2.f; + scales[1] = (float) s; + } else { + float size_step = (float) s / (float) nscales; + + if (mode == 0) { + for (int i = 0; i < nscales; ++i ) { scales[i] = 2.0f + (float)i * size_step; } - else if (mode==1) { + } else if (mode == 1) { size_step = (float)log(s - 2.0f) / (float) nscales; - for (int i = 0; i < nscales; ++i ) + + for (int i = 0; i < nscales; ++i ) { scales[i] = 2.0f + (float)pow (10.f, (i * size_step) / log (10.f)); } - else if(mode==2){ + } else if (mode == 2) { size_step = (float) log(s - 2.0f) / (float) nscales; - for ( int i = 0; i < nscales; ++i ) + + for ( int i = 0; i < nscales; ++i ) { scales[i] = s - (float)pow (10.f, (i * size_step) / log (10.f)); } + } } } -void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L ) - { - float vsquared = 0.f; - float sum = 0.f; -#pragma omp parallel for reduction(+:sum,vsquared) // this leads to differences, but parallel summation is more accurate - for (int i = 0; i L[i][j] + eps; - } + + for (int i = 0; i < H_L; i++ ) + for (int j = 0; j < W_L; j++) { + sum += dst[i][j]; + vsquared += (dst[i][j] * dst[i][j]); + } + + sum *= factor; + vsquared *= (factor * factor); + mean = sum / (float) (W_L * H_L); + vsquared /= (float) W_L * H_L; + stddv = ( vsquared - (mean * mean) ); + stddv = (float)sqrt(stddv); +} + +void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams lcur) +{ + if (lcur.enabled) {//enabled + StopWatch Stop1("MSR"); + float mean, stddv; + float mini, delta, maxi; + float eps = 2.f; + float gain2 = (float) lcur.gain / 100.f; //def =1 not use + float offse = (float) lcur.offs; //def = 0 not use + int scal = lcur.scal; //def=3 + int nei = (int) 2.5f * lcur.neigh; //def = 200 + float vart = (float)lcur.vart / 100.f;//variance + float strength = (float) lcur.str / 100.f; // Blend with original L channel data + + int modedehaz = 0; // default to 0 ( lcur.dehazmet == "uni" ) + + if (lcur.dehazmet == "low") { + modedehaz = 1; + } + + if (lcur.dehazmet == "high") { + modedehaz = 2; } dehaze_scales( DehazeScales, scal, modedehaz, nei ); - - pond = 1.0f / (float) scal; - for ( int scale = 0; scale < scal; scale++ ) - { + int H_L = height; + int W_L = width; + + float *src[H_L] ALIGNED16; + float *srcBuffer = new float[H_L * W_L]; + + for (int i = 0; i < H_L; i++) { + src[i] = &srcBuffer[i * W_L]; + } + #ifdef _OPENMP -#pragma omp parallel -#endif - { - AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); - gaussHorizontal (src, out, *pBuffer, W_L, H_L, DehazeScales[scale]); - gaussVertical (out, out, *pBuffer,W_L, H_L, DehazeScales[scale]); - delete pBuffer; - } -#ifdef __SSE2__ -#ifdef _OPENMP -#pragma omp parallel -{ - vfloat pondv = F2V(pond); -#pragma omp for -#endif - for ( int i=0; i < H_L; i++) { - int j; - - // for (j=0; j < W_L-3; j+=4) - { - - // _mm_storeu_ps(&dst[i][j], LVFU(dst[i][j]) + pondv * ( xlogf(LVFU(src[i][j])/LVFU(out[i][j])) )); - } - - // for (;j < W_L; j++) - for (int j=0;j < W_L; j++) - - { - float limds =(src[i][j])/out[i][j]; - if(limds > 10000.f) limds=10000.f; - if(limds < 0.0001f) limds=0.0001f; - - // dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); - dst[i][j] += pond * ( xlogf((limds) )); - - } - } -} -#else -#ifdef _OPENMP -#pragma omp parallel for -#endif - for ( int i=0; i < H_L; i++) - for (int j=0; j < W_L; j++) - { - float limds =(src[i][j])/out[i][j]; - if(limds > 10000.f) limds=10000.f; - if(limds < 0.0001f) limds=0.0001f; - - dst[i][j] += pond * ( xlogf((src[i][j])/out[i][j]) ); - } + #pragma omp parallel for #endif + + for (int i = 0; i < H_L; i++) + for (int j = 0; j < W_L; j++) { + src[i][j] = luminance[i][j] + eps; + luminance[i][j] = 0.f; } - for (int i = 0; i < H_L; i++) { - delete [] out[i]; - } - delete [] out; - for (int i = 0; i < H_L; i++) { - delete [] src[i]; - } - delete [] src; + float *out[H_L] ALIGNED16; + float *outBuffer = new float[H_L * W_L]; -float beta=16384.0f; -float logBetaGain = xlogf(beta) * gain; - -#ifdef _OPENMP -#pragma omp parallel for -#endif - for (int i=0; i< H_L; i++ ) - for (int j=0; jL[i][j]=((1.f - strength)* lab->L[i][j] + strength * clipdehaz( cd, 0.f, 32768.f )); - } for (int i = 0; i < H_L; i++) { - delete [] dst[i]; + out[i] = &outBuffer[i * W_L]; } - delete [] dst; - } - } + + float pond = 1.0f / (float) scal; + +#ifdef _OPENMP + #pragma omp parallel +#endif + { + AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); + + for ( int scale = 0; scale < scal; scale++ ) { + gaussHorizontal (src, out, *pBuffer, W_L, H_L, DehazeScales[scale]); + gaussVertical (out, out, *pBuffer, W_L, H_L, DehazeScales[scale]); +#ifdef __SSE2__ + vfloat pondv = F2V(pond); + vfloat limMinv = F2V(0.0001f); + vfloat limMaxv = F2V(10000.f); +#endif +#ifdef _OPENMP + #pragma omp for +#endif + + for (int i = 0; i < H_L; i++) + { + int j = 0; +#ifdef __SSE2__ + + for (; j < W_L - 3; j += 4) { + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + } + +#endif + + for (; j < W_L; j++) { + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], 0.0001f, 10000.f)); + } + } + } + delete pBuffer; + } + + delete [] outBuffer; + delete [] srcBuffer; + + float logBetaGain = xlogf(16384.f); + + mean = 0.f; + stddv = 0.f; + mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain); + + mini = mean - vart * stddv; + maxi = mean + vart * stddv; + delta = maxi - mini; + printf("maxi=%f mini=%f mean=%f std=%f delta=%f\n", maxi, mini, mean, stddv, delta); + + if ( !delta ) { + delta = 1.0f; + } + + float cdfactor = gain2 * 32768.f / delta; +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for ( int i = 0; i < H_L; i ++ ) + for (int j = 0; j < W_L; j++) { + float cd = cdfactor * ( luminance[i][j] * logBetaGain - mini ) + offse; + luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; + } + } +} } diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index a5d223aa0..596c8ab85 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1786,10 +1786,10 @@ void RawImageSource::demosaic(const RAWParams &raw) } t2.set(); - + rgbSourceModified = false; - + if( settings->verbose ) { if (getSensorType() == ST_BAYER) { @@ -1802,79 +1802,119 @@ void RawImageSource::demosaic(const RAWParams &raw) void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) { - + MyTime t4, t5; t4.set(); + if(!rgbSourceModified) { if (settings->verbose) { - printf ("Applying DeHaze\n"); + printf ("Applying DeHaze\n"); } - + TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); TMatrix wiprof = iccStore->workingSpaceInverseMatrix (cmp.working); - - double wip[3][3] = { - {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, - {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, - {wiprof[2][0], wiprof[2][1], wiprof[2][2]} - }; - double wp[3][3] = { - {wprof[0][0], wprof[0][1], wprof[0][2]}, - {wprof[1][0], wprof[1][1], wprof[1][2]}, - {wprof[2][0], wprof[2][1], wprof[2][2]} - }; - LabImage * labdeha = new LabImage(W, H); + double wip[3][3] = { + {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, + {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, + {wiprof[2][0], wiprof[2][1], wiprof[2][2]} + }; - #pragma omp parallel for - for (int i = 0; i lab - Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); - //convert Lab - Color::XYZ2Lab(X, Y, Z, L, aa, bb); - labdeha->L[i][j]=L; - // if(lcur.dehazmet !="none") { - if(dehacontlutili) labdeha->L[i][j]=cdcurve[L];//apply curve to equalize histogram - // } - labdeha->a[i][j]=aa; - labdeha->b[i][j]=bb; - - } - - MSR(labdeha, W, H, 1, lcur); + double wp[3][3] = { + {wprof[0][0], wprof[0][1], wprof[0][2]}, + {wprof[1][0], wprof[1][1], wprof[1][2]}, + {wprof[2][0], wprof[2][1], wprof[2][2]} + }; + LabImage * labdeha = new LabImage(W, H); + + // We need a buffer with original L data to allow correct blending + float *labTmp[H] ALIGNED16; + float *labTmpBuffer = new float[H * W]; + for (int i = 0; i < H; i++) { + labTmp[i] = &labTmpBuffer[i * W]; + } - #pragma omp parallel for - for (int i = 0; i L[i][j]; - a2=labdeha->a[i][j]; - b2=labdeha->b[i][j]; - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; - Color::xyz2rgb(x_, y_, z_, R, G, B, wip); - red[i][j]=R; - green[i][j]=G; - blue[i][j]=B; - } - - delete labdeha; - - t5.set(); - + // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) + // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = 0; i < H; i++ ) + for (int j = 0; j < W; j++) { + float X, Y, Z, L, aa, bb; + //rgb=>lab + Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); + //convert Lab + Color::XYZ2Lab(X, Y, Z, L, aa, bb); + labTmp[i][j] = L; + if(dehacontlutili) { + L = cdcurve[L]; //apply curve to equalize histogram + } + labdeha->L[i][j] = L; + labdeha->a[i][j] = aa; + labdeha->b[i][j] = bb; + } - if( settings->verbose ) { - printf("Dehaz=%d usec\n", t5.etime(t4)); - - } - rgbSourceModified = true; + MSR(labdeha->L, labTmp, W, H, lcur); + + delete [] labTmpBuffer; + +#ifdef __SSE2__ + vfloat wipv[3][3]; + + for(int i = 0; i < 3; i++) + for(int j = 0; j < 3; j++) { + wipv[i][j] = F2V(wiprof[i][j]); + } + +#endif // __SSE2__ +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = 0; i < H; i++ ) { + int j = 0; +#ifdef __SSE2__ + + for (; j < W - 3; j += 4) { + vfloat L2, a2, b2, x_, y_, z_; + vfloat R, G, B; + L2 = LVFU(labdeha->L[i][j]); + a2 = LVFU(labdeha->a[i][j]); + b2 = LVFU(labdeha->b[i][j]); + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); + _mm_storeu_ps(&red[i][j], R); + _mm_storeu_ps(&green[i][j], G); + _mm_storeu_ps(&blue[i][j], B); + } +#endif + for (; j < W; j++) { + float L2, a2, b2, x_, y_, z_; + float R, G, B; + L2 = labdeha->L[i][j]; + a2 = labdeha->a[i][j]; + b2 = labdeha->b[i][j]; + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wip); + red[i][j] = R; + green[i][j] = G; + blue[i][j] = B; + } + } + + delete labdeha; + + t5.set(); + + if( settings->verbose ) { + printf("Dehaz=%d usec\n", t5.etime(t4)); + } + + rgbSourceModified = true; } } - void RawImageSource::flushRawData() { if(cache) { @@ -1909,11 +1949,12 @@ void RawImageSource::HLRecovery_Global(ToneCurveParams hrp) if (settings->verbose) { printf ("Applying Highlight Recovery: Color propagation...\n"); } + HLRecovery_inpaint (red, green, blue); rgbSourceModified = true; } } - + } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 5a58d935e..2cd472de5 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -227,7 +227,7 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur); + void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams lcur); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], // multi_array2D & hfsize, multi_array2D & hilite, int box ); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 628c86dd8..dbc289276 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -115,14 +115,14 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (pl) { pl->setProgress (0.30); } - LUTf cdcurve (65536, 0); - - bool dehacontlutili=false; - CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - if(params.dehaz.dehazmet!="none") - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili );//enabled Dehaze - + if(params.dehaz.enabled) { //enabled Dehaze + LUTf cdcurve (65536, 0); + + bool dehacontlutili=false; + CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili ); + } if (pl) { pl->setProgress (0.40); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index ff14758b7..7dc1e57ea 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1029,6 +1029,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.dehaz.transmissionCurve = mods.dehaz.transmissionCurve; } + if (dehaz.dehazmet) { + toEdit.dehaz.dehazmet = mods.dehaz.dehazmet; + } + if (dehaz.str) { toEdit.dehaz.str = mods.dehaz.str; } From 8511131771e7d27de55dd33c109f5f13a4bfdaff Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 2 Sep 2015 18:32:06 +0200 Subject: [PATCH 12/71] Fixed wrong border handling in DeHaze --- rtengine/rawimagesource.cc | 51 +++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 596c8ab85..ce945a605 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1825,13 +1825,18 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - LabImage * labdeha = new LabImage(W, H); - + // We need a buffer with original L data to allow correct blending - float *labTmp[H] ALIGNED16; - float *labTmpBuffer = new float[H * W]; - for (int i = 0; i < H; i++) { - labTmp[i] = &labTmpBuffer[i * W]; + // red, green and blue still have original size of raw, but we can't use the borders + const int HNew = H-2*border; + const int WNew = W-2*border; + + LabImage * labdeha = new LabImage(WNew, HNew); + + float *labTmp[HNew] ALIGNED16; + float *labTmpBuffer = new float[HNew * WNew]; + for (int i = 0; i < HNew; i++) { + labTmp[i] = &labTmpBuffer[i * WNew]; } // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) @@ -1839,24 +1844,24 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams #ifdef _OPENMP #pragma omp parallel for #endif - for (int i = 0; i < H; i++ ) - for (int j = 0; j < W; j++) { + for (int i = border; i < H - border; i++ ) + for (int j = border; j < W - border; j++) { float X, Y, Z, L, aa, bb; //rgb=>lab Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); //convert Lab Color::XYZ2Lab(X, Y, Z, L, aa, bb); - labTmp[i][j] = L; + labTmp[i-border][j-border] = L; if(dehacontlutili) { L = cdcurve[L]; //apply curve to equalize histogram } - labdeha->L[i][j] = L; - labdeha->a[i][j] = aa; - labdeha->b[i][j] = bb; + labdeha->L[i-border][j-border] = L; + labdeha->a[i-border][j-border] = aa; + labdeha->b[i-border][j-border] = bb; } - MSR(labdeha->L, labTmp, W, H, lcur); + MSR(labdeha->L, labTmp, WNew, HNew, lcur); delete [] labTmpBuffer; @@ -1872,16 +1877,16 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams #ifdef _OPENMP #pragma omp parallel for #endif - for (int i = 0; i < H; i++ ) { - int j = 0; + for (int i = border; i < H - border; i++ ) { + int j = border; #ifdef __SSE2__ - for (; j < W - 3; j += 4) { + for (; j < W - border - 3; j += 4) { vfloat L2, a2, b2, x_, y_, z_; vfloat R, G, B; - L2 = LVFU(labdeha->L[i][j]); - a2 = LVFU(labdeha->a[i][j]); - b2 = LVFU(labdeha->b[i][j]); + L2 = LVFU(labdeha->L[i-border][j-border]); + a2 = LVFU(labdeha->a[i-border][j-border]); + b2 = LVFU(labdeha->b[i-border][j-border]); Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); _mm_storeu_ps(&red[i][j], R); @@ -1889,12 +1894,12 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams _mm_storeu_ps(&blue[i][j], B); } #endif - for (; j < W; j++) { + for (; j < W - border; j++) { float L2, a2, b2, x_, y_, z_; float R, G, B; - L2 = labdeha->L[i][j]; - a2 = labdeha->a[i][j]; - b2 = labdeha->b[i][j]; + L2 = labdeha->L[i-border][j-border]; + a2 = labdeha->a[i-border][j-border]; + b2 = labdeha->b[i-border][j-border]; Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; Color::xyz2rgb(x_, y_, z_, R, G, B, wip); red[i][j] = R; From 8b911d47896f000c4f9a2eb9423f054bd3ab48f0 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 3 Sep 2015 17:34:05 +0200 Subject: [PATCH 13/71] DeHaze enhancements (Desmis) and some bugfixes (heckflosse) --- rtdata/languages/default | 29 +- rtengine/curves.cc | 33 ++ rtengine/curves.h | 26 + rtengine/imagesource.h | 8 +- rtengine/improccoordinator.cc | 38 +- rtengine/improccoordinator.h | 1 + rtengine/ipdehaz.cc | 282 +++++++++-- rtengine/previewimage.cc | 3 +- rtengine/procevents.h | 6 +- rtengine/procparams.cc | 120 +++-- rtengine/procparams.h | 9 +- rtengine/rawimagesource.cc | 179 +++---- rtengine/rawimagesource.h | 8 +- rtengine/refreshmap.cc | 26 +- rtengine/simpleprocess.cc | 19 +- rtgui/dehaz.cc | 913 ++++++++++++++++++---------------- rtgui/dehaz.h | 13 +- rtgui/paramsedited.cc | 38 +- rtgui/paramsedited.h | 6 +- 19 files changed, 1100 insertions(+), 657 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 9ee60ab9b..86962a8c0 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -84,7 +84,7 @@ EXPORT_FASTEXPORTOPTIONS;Fast Export Options EXPORT_INSTRUCTIONS;Fast Export options provide overrides to bypass time and resource consuming development settings and to run queue processing using the fast export settings instead. This method is recommended for quicker generation of lower resolution images when speed is a priority or when resized output is desired for one or many images without making modifications to their saved development parameters. EXPORT_MAXHEIGHT;Maximum height: EXPORT_MAXWIDTH;Maximum width: -EXPORT_PUTTOQUEUEFAST; Put to queue for fast export +EXPORT_PUTTOQUEUEFAST; Put to queue for fast export EXPORT_RAW_DMETHOD;Demosaic method EXTPROGTARGET_1;raw EXTPROGTARGET_2;queue-processed @@ -151,7 +151,7 @@ FILEBROWSER_POPUPUNRANK;Unrank FILEBROWSER_POPUPUNTRASH;Remove from trash FILEBROWSER_QUERYBUTTONHINT;Clear the Find query FILEBROWSER_QUERYHINT;Type filenames to search for. Supports partial filenames. Separate the search terms using commas, e.g.\n1001,1004,1199\n\nExclude search terms by prefixing them with !=\ne.g.\n!=1001,1004,1199\n\nShortcuts:\nCtrl-f - focus the Find box,\nEnter - search,\nEsc - clear the Find box,\nShift-Esc - defocus the Find box. -FILEBROWSER_QUERYLABEL; Find: +FILEBROWSER_QUERYLABEL; Find: FILEBROWSER_RANK1_TOOLTIP;Rank 1 *\nShortcut: Shift-1 FILEBROWSER_RANK2_TOOLTIP;Rank 2 *\nShortcut: Shift-2 FILEBROWSER_RANK3_TOOLTIP;Rank 3 *\nShortcut: Shift-3 @@ -636,16 +636,19 @@ HISTORY_MSG_403;W - ES - Edge sensitivity HISTORY_MSG_404;W - ES - Base amplification HISTORY_MSG_405;W - Denoise - Level 4 HISTORY_MSG_406;W - ES - Neighboring pixels -HISTORY_MSG_407;Dehaze met +HISTORY_MSG_407;Dehaze method HISTORY_MSG_408;Dehaze neighboring HISTORY_MSG_409;Dehaze gain HISTORY_MSG_410;Dehaze offset HISTORY_MSG_411;Dehaze strength HISTORY_MSG_412;Dehaze scales -HISTORY_MSG_413;Dehaze var +HISTORY_MSG_413;Dehaze variance HISTORY_MSG_414;Dehaze histogram -HISTORY_MSG_415;Dehaze enabled -HISTORY_MSG_416;Dehaze transmission +HISTORY_MSG_415;Dehaze transmission +HISTORY_MSG_416;Dehaze enabled +HISTORY_MSG_417;Dehaze Retinex complete +HISTORY_MSG_418;Dehaze transmission median +HISTORY_MSG_419;Dehaze threshold HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -728,12 +731,12 @@ MAIN_TAB_COLOR;Color MAIN_TAB_COLOR_TOOLTIP;Shortcut: Alt-c MAIN_TAB_DETAIL;Detail MAIN_TAB_DETAIL_TOOLTIP;Shortcut: Alt-d -MAIN_TAB_DEVELOP; Develop +MAIN_TAB_DEVELOP; Develop MAIN_TAB_EXIF;Exif -MAIN_TAB_EXPORT; Fast Export +MAIN_TAB_EXPORT; Fast Export MAIN_TAB_EXPOSURE;Exposure MAIN_TAB_EXPOSURE_TOOLTIP;Shortcut: Alt-e -MAIN_TAB_FILTER; Filter +MAIN_TAB_FILTER; Filter MAIN_TAB_INSPECT; Inspect MAIN_TAB_IPTC;IPTC MAIN_TAB_METADATA;Metadata @@ -1557,21 +1560,25 @@ TP_DEHAZ_LAB_TOOLTIP;Use all component of Retinex algorihm, to improve results TP_DEHAZ_LABEL;Dehaze TP_DEHAZ_SCAL;Scales TP_DEHAZ_SCAL_TOOLTIP;Low scales increase contrast but give relief effect\nHigh scales can increase noise, but give more natural images +TP_DEHAZ_LIMD;Threshold +TP_DEHAZ_LIMD_TOOLTIP;Limits in/out - in = image source - out = image Gauss +TP_DEHAZ_MEDI;Transmission median filter TP_DEHAZ_NEIGH;Neighboring pixels TP_DEHAZ_NEIGH_TOOLTIP;Take into account, neighboring pixels, by Gauss function TP_DEHAZ_GAIN;Gain TP_DEHAZ_OFFS;Offset TP_DEHAZ_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings\nUsed for black or white pixels, and for better balance the histogram -TP_DEHAZE_LAB;Dehaze +TP_DEHAZE_LAB;Dehaze TP_DEHAZ_CONTEDIT;Histogram equalizer TP_DEHAZ_CURVEEDITOR_CD;L=f(L) TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP;Correct Raw data, to reduce halos and artifacts TP_DEHAZ_TRANSMISSION;Transmission map +TP_DEHAZ_TRANS_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction TP_DEHAZE_LAB_TOOLTIP;Use Retinex algorithm (Lab) to improve dehaze..defog... TP_DEHAZ_VART;Variance TP_DEHAZ_VART_TOOLTIP;Low variance increase local contrast and saturation, but can leeds to artifacts TP_DEHAZE_MET;Dehaze method -TP_DEHAZ_MET_TOOLTIP;Low :reinforce low light\nUniform :expect to equalize action\nHigh : reinforce high light +TP_DEHAZ_MET_TOOLTIP;For Retinex algorithm\nLow :reinforce low light\nUniform :expect to equalize action\nHigh : reinforce high light TP_DEHAZ_NONE;None TP_DEHAZ_UNI;Uniform TP_DEHAZ_LOW;Low diff --git a/rtengine/curves.cc b/rtengine/curves.cc index ba1be089a..accbea8dc 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1342,6 +1342,39 @@ void ColorAppearance::Set(Curve *pCurve) } } +// +DehaztransmissionCurve::DehaztransmissionCurve() {}; + +void DehaztransmissionCurve::Reset() +{ + luttransmission.reset(); +} + +void DehaztransmissionCurve::Set(const Curve &pCurve) +{ + if (pCurve.isIdentity()) { + luttransmission.reset(); // raise this value if the quality suffers from this number of samples + return; + } + + luttransmission(501); // raise this value if the quality suffers from this number of samples + + for (int i = 0; i < 501; i++) { + luttransmission[i] = pCurve.getVal(double(i) / 500.); + } +} + +void DehaztransmissionCurve::Set(const std::vector &curvePoints) +{ + if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { + FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); + tcurve.setIdentityValue(0.); + Set(tcurve); + } else { + Reset(); + } +} + void ToneCurve::Reset() { lutToneCurve.reset(); diff --git a/rtengine/curves.h b/rtengine/curves.h index 22f0d77fa..128882eca 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -429,6 +429,32 @@ public: }; }; +class DehaztransmissionCurve +{ +private: + LUTf luttransmission; // 0xffff range + void Set(const Curve &pCurve); + +public: + virtual ~DehaztransmissionCurve() {}; + DehaztransmissionCurve(); + + void Reset(); + void Set(const Curve *pCurve); + void Set(const std::vector &curvePoints); + float operator[](float index) const + { + return luttransmission[index]; + } + + operator bool (void) const + { + return luttransmission; + } +}; + + + class ToneCurve { public: diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 0d7c32b52..de4bdbe8d 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,15 +69,17 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; - virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; +// virtual void // dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; + virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; - virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) {}; +// virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) {}; + virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve) {}; virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified - // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); + // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* virtual void getImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, ToneCurveParams hlp, ColorManagementParams cmp, RAWParams raw) {} diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index fdcb8bf27..4c329c550 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -166,6 +166,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) RAWParams rp = params.raw; ColorManagementParams cmp = params.icm; LCurveParams lcur = params.labCurve; + if( !highDetailNeeded ) { // if below 100% magnification, take a fast path if(rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none] && rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono]) { @@ -208,11 +209,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) OR HLR gets disabled when Color method was selected */ // If high detail (=100%) is newly selected, do a demosaic update, since the last was just with FAST - - //I forced dehazmet with toneCurve.hrenabled=true==> probably another way ?? - - bool hrdehaz=false; - if(!params.toneCurve.hrenabled) if(params.dehaz.enabled) {hrdehaz=true; params.toneCurve.hrenabled=true;} if ( (todo & M_RAW) || (!highDetailRawComputed && highDetailNeeded) @@ -228,7 +224,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } imgsrc->demosaic( rp);//enabled demosaic - if (highDetailNeeded) { highDetailRawComputed = true; @@ -239,18 +234,17 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } else { highDetailRawComputed = false; } + + if (params.dehaz.enabled) { + bool dehacontlutili = false; + CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); + DehazParams DehaParams = params.dehaz; + DehaParams.getCurves(dehatransmissionCurve); + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili);//enabled Dehaze + + } } - bool dehacontlutili=false; - CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - - if (todo & M_INIT || params.dehaz.enabled){ - if(params.dehaz.enabled) - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili);//enabled Dehaze - - } - if(hrdehaz==true) params.toneCurve.hrenabled=false; - - + // Updating toneCurve.hrenabled if necessary // It has to be done there, because the next 'if' statement will use the value computed here if (todo & M_AUTOEXP) { @@ -267,9 +261,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (todo & (M_INIT | M_LINDENOISE)) { MyMutex::MyLock initLock(minit); // Also used in crop window - - imgsrc->HLRecovery_Global( params.toneCurve); // this handles Color HLRecovery - + + imgsrc->HLRecovery_Global( params.toneCurve); // this handles Color HLRecovery + if (settings->verbose) { printf ("Applying white balance, color correction & sRBG conversion...\n"); @@ -314,7 +308,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) imgsrc->getImage (currWB, tr, orig_prev, pp, params.toneCurve, params.icm, params.raw); //ColorTemp::CAT02 (orig_prev, ¶ms) ; - // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); + // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); /* Issue 2785, disabled some 1:1 tools if (todo & M_LINDENOISE) { DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; @@ -596,7 +590,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) nprevl->CopyFrom(oprevl); progress ("Applying Color Boost...", 100 * readyphase / numofphases); - // ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); + // ipf.MSR(nprevl, nprevl->W, nprevl->H, 1); ipf.chromiLuminanceCurve (NULL, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histCLurve, histLLCurve, histLCurve); ipf.vibrance(nprevl); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index cce71995e..0c2f8f459 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -129,6 +129,7 @@ protected: WavOpacityCurveBY waOpacityCurveBY; WavOpacityCurveW waOpacityCurveW; WavOpacityCurveWL waOpacityCurveWL; + DehaztransmissionCurve dehatransmissionCurve; ColorAppearance customColCurve1; ColorAppearance customColCurve2; diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 66e3789f5..6b922e503 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -34,9 +34,19 @@ #include "improcfun.h" #include "opthelper.h" #include "StopWatch.h" -#define MAX_DEHAZE_SCALES 6 +#define MAX_DEHAZE_SCALES 8 #define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) +#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 + namespace rtengine { @@ -44,7 +54,7 @@ extern const Settings* settings; static float DehazeScales[MAX_DEHAZE_SCALES]; -void dehaze_scales( float* scales, int nscales, int mode, int s) +void dehaze_scales( float* scales, int nscales, int mode, int s) { if ( nscales == 1 ) { scales[0] = (float)s / 2.f; @@ -73,24 +83,103 @@ void dehaze_scales( float* scales, int nscales, int mode, int s) } } } - -void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const float factor ) +void mean_stddv2( float **dst, float &mean, float &stddv, int W_L, int H_L, float &maxtr, float &mintr) { // summation using double precision to avoid too large summation error for large pictures double vsquared = 0.f; double sum = 0.f; - + maxtr = -999999.f; + mintr = 999999.f; #ifdef _OPENMP - #pragma omp parallel for reduction(+:sum,vsquared) // this can lead to differences, but parallel summation is more accurate + #pragma omp parallel +#endif + { + float lmax = -999999.f, lmin = 999999.f; +#ifdef _OPENMP + #pragma omp for reduction(+:sum,vsquared) nowait // this leads to differences, but parallel summation is more accurate #endif - for (int i = 0; i < H_L; i++ ) - for (int j = 0; j < W_L; j++) { - sum += dst[i][j]; - vsquared += (dst[i][j] * dst[i][j]); + for (int i = 0; i < H_L; i++ ) + for (int j = 0; j < W_L; j++) { + sum += dst[i][j]; + vsquared += (dst[i][j] * dst[i][j]); + + if ( dst[i][j] > lmax) { + lmax = dst[i][j] ; + } + + if ( dst[i][j] < lmin) { + lmin = dst[i][j] ; + } + + } + +#ifdef _OPENMP + #pragma omp critical +#endif + { + maxtr = maxtr > lmax ? maxtr : lmax; + mintr = mintr < lmin ? mintr : lmin; } + } + mean = sum / (double) (W_L * H_L); + vsquared /= (double) W_L * H_L; + stddv = ( vsquared - (mean * mean) ); + stddv = (float)sqrt(stddv); +} + + + + + + +void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const float factor, float &maxtr, float &mintr) + +{ + // summation using double precision to avoid too large summation error for large pictures + double vsquared = 0.f; + double sum = 0.f; + maxtr = 0.f; + mintr = 0.f; +#ifdef _OPENMP + #pragma omp parallel +#endif + { + float lmax = 0.f, lmin = 0.f; + +#ifdef _OPENMP + #pragma omp for reduction(+:sum,vsquared) // this can lead to differences, but parallel summation is more accurate +#endif + + for (int i = 0; i < H_L; i++ ) + for (int j = 0; j < W_L; j++) { + sum += dst[i][j]; + vsquared += (dst[i][j] * dst[i][j]); + + if ( dst[i][j] > lmax) { + lmax = dst[i][j] ; + } + + if ( dst[i][j] < lmin) { + lmin = dst[i][j] ; + } + + } + +#ifdef _OPENMP + #pragma omp critical +#endif + { + maxtr = maxtr > lmax ? maxtr : lmax; + mintr = mintr < lmin ? mintr : lmin; + } + + } + sum *= factor; + maxtr *= factor; + mintr *= factor; vsquared *= (factor * factor); mean = sum / (float) (W_L * H_L); vsquared /= (float) W_L * H_L; @@ -98,27 +187,31 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const stddv = (float)sqrt(stddv); } -void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams lcur) +void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve) { - if (lcur.enabled) {//enabled + if (deh.enabled) {//enabled StopWatch Stop1("MSR"); - float mean, stddv; + float mean, stddv, maxtr, mintr; float mini, delta, maxi; float eps = 2.f; - float gain2 = (float) lcur.gain / 100.f; //def =1 not use - float offse = (float) lcur.offs; //def = 0 not use - int scal = lcur.scal; //def=3 - int nei = (int) 2.5f * lcur.neigh; //def = 200 - float vart = (float)lcur.vart / 100.f;//variance - float strength = (float) lcur.str / 100.f; // Blend with original L channel data + float gain2 = (float) deh.gain / 100.f; //def =1 not use + float offse = (float) deh.offs; //def = 0 not use + int scal = deh.scal; //def=3 + int nei = (int) 2.8f * deh.neigh; //def = 220 + float vart = (float)deh.vart / 100.f;//variance + float strength = (float) deh.str / 100.f; // Blend with original L channel data + float limD = (float) deh.limd; + limD = pow(limD, 1.7f);//about 2500 enough + float ilimD = 1.f / limD; - int modedehaz = 0; // default to 0 ( lcur.dehazmet == "uni" ) + int modedehaz = 0; // default to 0 ( deh.dehazmet == "uni" ) + bool execcur = false; - if (lcur.dehazmet == "low") { + if (deh.dehazmet == "low") { modedehaz = 1; } - if (lcur.dehazmet == "high") { + if (deh.dehazmet == "high") { modedehaz = 2; } @@ -157,22 +250,23 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width #pragma omp parallel #endif { - AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); + AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); - for ( int scale = 0; scale < scal; scale++ ) { + for ( int scale = 0; scale < scal; scale++ ) { gaussHorizontal (src, out, *pBuffer, W_L, H_L, DehazeScales[scale]); gaussVertical (out, out, *pBuffer, W_L, H_L, DehazeScales[scale]); + #ifdef __SSE2__ vfloat pondv = F2V(pond); - vfloat limMinv = F2V(0.0001f); - vfloat limMaxv = F2V(10000.f); + vfloat limMinv = F2V(ilimD); + vfloat limMaxv = F2V(limD); + #endif #ifdef _OPENMP #pragma omp for #endif - for (int i = 0; i < H_L; i++) - { + for (int i = 0; i < H_L; i++) { int j = 0; #ifdef __SSE2__ @@ -183,10 +277,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width #endif for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], 0.0001f, 10000.f)); + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); } } } + delete pBuffer; } @@ -195,14 +290,136 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width float logBetaGain = xlogf(16384.f); + if (dehatransmissionCurve) { + execcur = true; + } + +//I re-execute luminance[i][j] = logBetaGain * luminance[i][j] because I call 2 times (or one) mean_stdvv +// no difference or very little in time +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = 0; i < H_L; i++ ) + for (int j = 0; j < W_L; j++) { + luminance[i][j] = logBetaGain * luminance[i][j]; + } + mean = 0.f; stddv = 0.f; - mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain); + // I call mean_stddv2 instead of mean_stddv ==> logBetaGain + + mean_stddv2( luminance, mean, stddv, W_L, H_L, maxtr, mintr); +// printf("mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", mean, stddv, delta, maxtr, mintr); + + // mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain, maxtr, mintr); + if (execcur) { //if curve + float asig = 0.166666f / stddv; + float bsig = 0.5f - asig * mean; + //float insigma = 0.66666f; //SD + float amean = 0.5f / mean; + float asign = 0.166666f / stddv; + float bsign = 0.5f - asign * mean; + float amax = 0.333333f / (maxtr - mean - stddv); + float bmax = 1.f - amax * maxtr; + float amin = 0.333333f / (mean - stddv - mintr); + float bmin = -amin * mintr; + +#ifdef _OPENMP + #pragma omp parallel +#endif + { + float absciss; +#ifdef _OPENMP + #pragma omp for schedule(dynamic,16) +#endif + + for (int i = 0; i < H_L; i++ ) + for (int j = 0; j < W_L; j++) { //for mintr to maxtr evalate absciss in function of original transmission + if (luminance[i][j] >= mean && luminance[i][j] < mean + stddv) { + absciss = asig * luminance[i][j] + bsig; + } else if (luminance[i][j] >= mean + stddv) { + absciss = amax * luminance[i][j] + bmax; + } else if (/*luminance[i][j] < mean && */luminance[i][j] > mean - stddv) { + absciss = asign * luminance[i][j] + bsign; + } else { /*if(luminance[i][j] <= mean - stddv)*/ + absciss = amin * luminance[i][j] + bmin; + } + + float kmul = 2.5f; + float kinterm = 1.f + kmul * (dehatransmissionCurve[absciss * 500.f] - 0.5f); //new transmission + luminance[i][j] *= kinterm; +// luminance[i][j] *= 1.000001f; + } + } + + // median filter on transmission ==> reduce artifacts + if (deh.medianmap) { + int wid = W_L; + int hei = H_L; + float *tmL[hei] ALIGNED16; + float *tmLBuffer = new float[wid * hei]; + int borderL = 1; + + for (int i = 0; i < hei; i++) { + tmL[i] = &tmLBuffer[i * wid]; + } + + /* + for(int i = borderL; i < hei - borderL; i++ ) { + for(int j = borderL; j < wid - borderL; j++) { + tmL[i][j] = luminance[i][j]; + } + } + */ +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = borderL; i < hei - borderL; i++) { + float pp[9], temp; + + for (int j = borderL; j < wid - borderL; j++) { + med3(luminance[i][j], luminance[i - 1][j], luminance[i + 1][j], luminance[i][j + 1], luminance[i][j - 1], luminance[i - 1][j - 1], luminance[i - 1][j + 1], luminance[i + 1][j - 1], luminance[i + 1][j + 1], tmL[i][j]); //3x3 + } + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = borderL; i < hei - borderL; i++ ) { + for (int j = borderL; j < wid - borderL; j++) { + luminance[i][j] = tmL[i][j]; + } + } + + delete [] tmLBuffer; + + } + + // I call mean_stddv2 instead of mean_stddv ==> logBetaGain + // mean_stddv( luminance, mean, stddv, W_L, H_L, 1.f, maxtr, mintr); + mean_stddv2( luminance, mean, stddv, W_L, H_L, maxtr, mintr); + + } + + float epsil = 0.1f; mini = mean - vart * stddv; + + if (mini < mintr) { + mini = mintr + epsil; + } + maxi = mean + vart * stddv; + + if (maxi > maxtr) { + maxi = maxtr - epsil; + } + delta = maxi - mini; - printf("maxi=%f mini=%f mean=%f std=%f delta=%f\n", maxi, mini, mean, stddv, delta); + printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); if ( !delta ) { delta = 1.0f; @@ -215,7 +432,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for ( int i = 0; i < H_L; i ++ ) for (int j = 0; j < W_L; j++) { - float cd = cdfactor * ( luminance[i][j] * logBetaGain - mini ) + offse; + // float cd = cdfactor * ( luminance[i][j] * logBetaGain - mini ) + offse; + float cd = cdfactor * ( luminance[i][j] - mini ) + offse; luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; } } diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index d68ce3229..5f7ea8ad6 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -122,7 +122,7 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext const unsigned char *data = NULL; int fw, fh; LUTf cdcurve; - bool dehacontlutili=false; + bool dehacontlutili = false; procparams::ProcParams params; /*rtengine::RAWParams raw; @@ -140,7 +140,6 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; rawImage.preprocess(params.raw, params.lensProf, params.coarse); rawImage.demosaic(params.raw); - rawImage.dehaz(params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili); Imagefloat* image = new rtengine::Imagefloat (fw, fh); rawImage.getImage (wb, TR_NONE, image, pp, params.toneCurve, params.icm, params.raw); output = new Image8(fw, fh); diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 0c890d11d..c61782da5 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -439,11 +439,13 @@ enum ProcEvent { EvLstr = 410, EvLscal = 411, EvLvart = 412, - EvLCDCurve = 413, + EvLCDCurve = 413, EvDehaztransmission = 414, EvDehazEnabled = 415, EvDehazretinex = 416, - + EvDehazmedianmap = 417, + EvLlimd = 418, + NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 58668db0d..3b40dd949 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -123,12 +123,17 @@ DehazParams::DehazParams () void DehazParams::getDefaulttransmissionCurve(std::vector &curve) { - double v[16] = { 0.00, 0.3, 0.35, 0.00, - 0.25, 0.5, 0.35, 0.35, - 0.70, 0.5, 0.35, 0.35, - 1.00, 0.7, 0.00, 0.00 - }; - curve.resize(17); + /* double v[8] = { 0.0, 0.50, 0.35, 0.35, + 1.0, 0.50, 0.35, 0.35, + }; + */ + double v[12] = { 0.00, 0.25, 0.35, 0.35, + 0.60, 0.90, 0.35, 0.35, + 1.00, 0.50, 0.35, 0.35, + }; + + + curve.resize(13); curve.at(0 ) = double(FCT_MinMaxCPoints); for (size_t i = 1; i < curve.size(); ++i) { @@ -139,12 +144,12 @@ void DehazParams::getDefaulttransmissionCurve(std::vector &curve) void DehazParams::getDefaultCDCurve(std::vector &curve) { double v[12] = { 0.00, 0.00, - 0.185, 0., - 0.235, 0.25, - 0.5, 0.5, - 0.8, 0.8, - 1.0, 1.0, - }; + 0.185, 0., + 0.235, 0.25, + 0.5, 0.5, + 0.8, 0.8, + 1.0, 1.0, + }; curve.resize(13); curve.at(0) = double(DCT_NURBS); @@ -163,16 +168,19 @@ void DehazParams::setDefaults() gain = 100; offs = 0; vart = 125; + limd = 8; getDefaulttransmissionCurve(transmissionCurve); getDefaultCDCurve(cdcurve); dehazmet = "uni"; retinex = false; + medianmap = true; + } -//void DehazParams::getCurves(transmissionCurve &transmissionCurveLUT) const -//{ - // opacityCurveLUT.Set(this->opacityCurve); -//} +void DehazParams::getCurves(DehaztransmissionCurve &transmissionCurveLUT) const +{ + transmissionCurveLUT.Set(this->transmissionCurve); +} ColorToningParams::ColorToningParams () : hlColSat(60, 80, false), shadowsColSat(80, 208, false) @@ -1438,48 +1446,63 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol } //save dehaz - + if (!pedited || pedited->dehaz.str) { keyFile.set_integer ("Dehaz", "Str", dehaz.str); } + if (!pedited || pedited->dehaz.scal) { keyFile.set_integer ("Dehaz", "Scal", dehaz.scal); } + if (!pedited || pedited->dehaz.enabled) { keyFile.set_boolean ("Dehaz", "Enabled", dehaz.enabled); } - + if (!pedited || pedited->dehaz.retinex) { keyFile.set_boolean ("Dehaz", "Retinex", dehaz.retinex); } + if (!pedited || pedited->dehaz.medianmap) { + keyFile.set_boolean ("Dehaz", "Median", dehaz.medianmap); + } + + + if (!pedited || pedited->dehaz.neigh) { keyFile.set_integer ("Dehaz", "Neigh", dehaz.neigh); } + if (!pedited || pedited->dehaz.gain) { keyFile.set_integer ("Dehaz", "Gain", dehaz.gain); } + if (!pedited || pedited->dehaz.offs) { - keyFile.set_integer ("Dehaz","Offs", dehaz.offs); + keyFile.set_integer ("Dehaz", "Offs", dehaz.offs); } + if (!pedited || pedited->dehaz.vart) { - keyFile.set_integer ("Dehaz","Vart", dehaz.vart); + keyFile.set_integer ("Dehaz", "Vart", dehaz.vart); } - + + if (!pedited || pedited->dehaz.limd) { + keyFile.set_integer ("Dehaz", "Limd", dehaz.limd); + } + if (!pedited || pedited->dehaz.dehazmet) { - keyFile.set_string ("Dehaz", "Dehazmet",dehaz.dehazmet); + keyFile.set_string ("Dehaz", "Dehazmet", dehaz.dehazmet); } - + if (!pedited || pedited->dehaz.cdcurve) { Glib::ArrayHandle cdcurve = dehaz.cdcurve; keyFile.set_double_list("Dehaz", "CDCurve", cdcurve); } - + if (!pedited || pedited->dehaz.transmissionCurve) { Glib::ArrayHandle transmissionCurve = dehaz.transmissionCurve; keyFile.set_double_list("Dehaz", "TransmissionCurve", transmissionCurve); } - + // save channel mixer if (!pedited || pedited->chmixer.red[0] || pedited->chmixer.red[1] || pedited->chmixer.red[2]) { Glib::ArrayHandle rmix (chmixer.red, 3, Glib::OWNERSHIP_NONE); @@ -1691,6 +1714,7 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol Glib::ArrayHandle lccurve = labCurve.lccurve; keyFile.set_double_list("Luminance Curve", "LcCurve", lccurve); } + if (!pedited || pedited->labCurve.clcurve) { Glib::ArrayHandle clcurve = labCurve.clcurve; keyFile.set_double_list("Luminance Curve", "ClCurve", clcurve); @@ -3736,9 +3760,10 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } } + //load dehaz if (keyFile.has_group ("Dehaz")) { - + if (keyFile.has_key ("Dehaz", "Retinex")) { dehaz.retinex = keyFile.get_boolean ("Dehaz", "Retinex"); @@ -3746,7 +3771,15 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.retinex = true; } } - + + if (keyFile.has_key ("Dehaz", "Median")) { + dehaz.medianmap = keyFile.get_boolean ("Dehaz", "Median"); + + if (pedited) { + pedited->dehaz.medianmap = true; + } + } + if (keyFile.has_key ("Dehaz", "Dehazmet")) { dehaz.dehazmet = keyFile.get_string ("Dehaz", "Dehazmet"); @@ -3754,20 +3787,23 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.dehazmet = true; } } - if (keyFile.has_key ("Dehaz", "Enabled")) { + + if (keyFile.has_key ("Dehaz", "Enabled")) { dehaz.enabled = keyFile.get_boolean ("Dehaz", "Enabled"); + if (pedited) { pedited->dehaz.enabled = true; } } - - if (keyFile.has_key ("Dehaz", "Neigh")) { + + if (keyFile.has_key ("Dehaz", "Neigh")) { dehaz.neigh = keyFile.get_integer ("Dehaz", "Neigh"); if (pedited) { pedited->dehaz.neigh = true; } } + if (keyFile.has_key ("Dehaz", "Str")) { dehaz.str = keyFile.get_integer ("Dehaz", "Str"); @@ -3775,6 +3811,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.str = true; } } + if (keyFile.has_key ("Dehaz", "Scal")) { dehaz.scal = keyFile.get_integer ("Dehaz", "Scal"); @@ -3790,6 +3827,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.gain = true; } } + if (keyFile.has_key ("Dehaz", "Offs")) { dehaz.offs = keyFile.get_integer ("Dehaz", "Offs"); @@ -3797,6 +3835,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.offs = true; } } + if (keyFile.has_key ("Dehaz", "Vart")) { dehaz.vart = keyFile.get_integer ("Dehaz", "Vart"); @@ -3804,7 +3843,15 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.vart = true; } } - + + if (keyFile.has_key ("Dehaz", "Limd")) { + dehaz.limd = keyFile.get_integer ("Dehaz", "Limd"); + + if (pedited) { + pedited->dehaz.limd = true; + } + } + if (keyFile.has_key ("Dehaz", "CDCurve")) { dehaz.cdcurve = keyFile.get_double_list ("Dehaz", "CDCurve"); @@ -3812,6 +3859,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.cdcurve = true; } } + if (keyFile.has_key ("Dehaz", "TransmissionCurve")) { dehaz.transmissionCurve = keyFile.get_double_list ("Dehaz", "TransmissionCurve"); @@ -3820,8 +3868,8 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } } - - + + // load luma curve if (keyFile.has_group ("Luminance Curve")) { if (keyFile.has_key ("Luminance Curve", "Brightness")) { @@ -3839,6 +3887,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.contrast = true; } } + if (ppVersion < 303) { // transform Saturation into Chromaticity // if Saturation == 0, should we set BWToning on? @@ -3953,6 +4002,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->labCurve.lhcurve = true; } } + if (keyFile.has_key ("Luminance Curve", "hhCurve")) { labCurve.hhcurve = keyFile.get_double_list ("Luminance Curve", "hhCurve"); @@ -7185,11 +7235,13 @@ bool ProcParams::operator== (const ProcParams& other) && dehaz.scal == other.dehaz.scal && dehaz.neigh == other.dehaz.neigh && dehaz.gain == other.dehaz.gain + && dehaz.limd == other.dehaz.limd && dehaz.offs == other.dehaz.offs && dehaz.dehazmet == other.dehaz.dehazmet && dehaz.vart == other.dehaz.vart + && dehaz.medianmap == other.dehaz.medianmap && dehaz.enabled == other.dehaz.enabled - && dehaz.retinex == other.dehaz.retinex + && dehaz.retinex == other.dehaz.retinex && labCurve.lcurve == other.labCurve.lcurve && labCurve.acurve == other.labCurve.acurve && labCurve.bcurve == other.labCurve.bcurve diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 82fb2fc4d..cd9201e50 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -38,6 +38,7 @@ class WavOpacityCurveRG; class WavOpacityCurveBY; class WavOpacityCurveW; class WavOpacityCurveWL; +class DehaztransmissionCurve; namespace procparams { @@ -276,14 +277,16 @@ public: int offs; Glib::ustring dehazmet; int vart; + int limd; + bool medianmap; bool retinex; DehazParams (); - void setDefaults(); - // void getCurves(transmissionCurve &transmissionCurveLUT) const; + void setDefaults(); + void getCurves(DehaztransmissionCurve &transmissionCurveLUT) const; static void getDefaulttransmissionCurve(std::vector &curve); static void getDefaultCDCurve(std::vector &curve); - + }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index ce945a605..c5a72e6dc 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1800,124 +1800,127 @@ void RawImageSource::demosaic(const RAWParams &raw) } } -void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) +void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili) { MyTime t4, t5; t4.set(); - if(!rgbSourceModified) { - if (settings->verbose) { - printf ("Applying DeHaze\n"); - } + if (settings->verbose) { + printf ("Applying DeHaze\n"); + } - TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); - TMatrix wiprof = iccStore->workingSpaceInverseMatrix (cmp.working); + TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); + TMatrix wiprof = iccStore->workingSpaceInverseMatrix (cmp.working); - double wip[3][3] = { - {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, - {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, - {wiprof[2][0], wiprof[2][1], wiprof[2][2]} - }; + double wip[3][3] = { + {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, + {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, + {wiprof[2][0], wiprof[2][1], wiprof[2][2]} + }; - double wp[3][3] = { - {wprof[0][0], wprof[0][1], wprof[0][2]}, - {wprof[1][0], wprof[1][1], wprof[1][2]}, - {wprof[2][0], wprof[2][1], wprof[2][2]} - }; + double wp[3][3] = { + {wprof[0][0], wprof[0][1], wprof[0][2]}, + {wprof[1][0], wprof[1][1], wprof[1][2]}, + {wprof[2][0], wprof[2][1], wprof[2][2]} + }; - // We need a buffer with original L data to allow correct blending - // red, green and blue still have original size of raw, but we can't use the borders - const int HNew = H-2*border; - const int WNew = W-2*border; + // We need a buffer with original L data to allow correct blending + // red, green and blue still have original size of raw, but we can't use the borders + const int HNew = H - 2 * border; + const int WNew = W - 2 * border; - LabImage * labdeha = new LabImage(WNew, HNew); + LabImage * labdeha = new LabImage(WNew, HNew); - float *labTmp[HNew] ALIGNED16; - float *labTmpBuffer = new float[HNew * WNew]; - for (int i = 0; i < HNew; i++) { - labTmp[i] = &labTmpBuffer[i * WNew]; - } + float *labTmp[HNew] ALIGNED16; + float *labTmpBuffer = new float[HNew * WNew]; - // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) - // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... + for (int i = 0; i < HNew; i++) { + labTmp[i] = &labTmpBuffer[i * WNew]; + } + + // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) + // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int i = border; i < H - border; i++ ) - for (int j = border; j < W - border; j++) { - float X, Y, Z, L, aa, bb; - //rgb=>lab - Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); - //convert Lab - Color::XYZ2Lab(X, Y, Z, L, aa, bb); - labTmp[i-border][j-border] = L; - if(dehacontlutili) { - L = cdcurve[L]; //apply curve to equalize histogram - } - labdeha->L[i-border][j-border] = L; - labdeha->a[i-border][j-border] = aa; - labdeha->b[i-border][j-border] = bb; + for (int i = border; i < H - border; i++ ) + for (int j = border; j < W - border; j++) { + float X, Y, Z, L, aa, bb; + //rgb=>lab + Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); + //convert Lab + Color::XYZ2Lab(X, Y, Z, L, aa, bb); + labTmp[i - border][j - border] = L; + + if(dehacontlutili) { + L = cdcurve[L]; //apply curve to equalize histogram } - MSR(labdeha->L, labTmp, WNew, HNew, lcur); + labdeha->L[i - border][j - border] = L; + labdeha->a[i - border][j - border] = aa; + labdeha->b[i - border][j - border] = bb; + } - delete [] labTmpBuffer; + MSR(labdeha->L, labTmp, WNew, HNew, deh, dehatransmissionCurve); + + delete [] labTmpBuffer; #ifdef __SSE2__ - vfloat wipv[3][3]; + vfloat wipv[3][3]; - for(int i = 0; i < 3; i++) - for(int j = 0; j < 3; j++) { - wipv[i][j] = F2V(wiprof[i][j]); - } + for(int i = 0; i < 3; i++) + for(int j = 0; j < 3; j++) { + wipv[i][j] = F2V(wiprof[i][j]); + } #endif // __SSE2__ #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int i = border; i < H - border; i++ ) { - int j = border; + + for (int i = border; i < H - border; i++ ) { + int j = border; #ifdef __SSE2__ - for (; j < W - border - 3; j += 4) { - vfloat L2, a2, b2, x_, y_, z_; - vfloat R, G, B; - L2 = LVFU(labdeha->L[i-border][j-border]); - a2 = LVFU(labdeha->a[i-border][j-border]); - b2 = LVFU(labdeha->b[i-border][j-border]); - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; - Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); - _mm_storeu_ps(&red[i][j], R); - _mm_storeu_ps(&green[i][j], G); - _mm_storeu_ps(&blue[i][j], B); - } + for (; j < W - border - 3; j += 4) { + vfloat L2, a2, b2, x_, y_, z_; + vfloat R, G, B; + L2 = LVFU(labdeha->L[i - border][j - border]); + a2 = LVFU(labdeha->a[i - border][j - border]); + b2 = LVFU(labdeha->b[i - border][j - border]); + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); + _mm_storeu_ps(&red[i][j], R); + _mm_storeu_ps(&green[i][j], G); + _mm_storeu_ps(&blue[i][j], B); + } + #endif - for (; j < W - border; j++) { - float L2, a2, b2, x_, y_, z_; - float R, G, B; - L2 = labdeha->L[i-border][j-border]; - a2 = labdeha->a[i-border][j-border]; - b2 = labdeha->b[i-border][j-border]; - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; - Color::xyz2rgb(x_, y_, z_, R, G, B, wip); - red[i][j] = R; - green[i][j] = G; - blue[i][j] = B; - } + + for (; j < W - border; j++) { + float L2, a2, b2, x_, y_, z_; + float R, G, B; + L2 = labdeha->L[i - border][j - border]; + a2 = labdeha->a[i - border][j - border]; + b2 = labdeha->b[i - border][j - border]; + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wip); + red[i][j] = R; + green[i][j] = G; + blue[i][j] = B; } - - delete labdeha; - - t5.set(); - - if( settings->verbose ) { - printf("Dehaz=%d usec\n", t5.etime(t4)); - } - - rgbSourceModified = true; } + + delete labdeha; + + t5.set(); + + if( settings->verbose ) { + printf("Dehaz=%d usec\n", t5.etime(t4)); + } + } void RawImageSource::flushRawData() diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 2cd472de5..1fd858a17 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -151,7 +151,8 @@ public: int load (Glib::ustring fname, bool batch = false); void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); - void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili); +// void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili); + void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); @@ -227,7 +228,8 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams lcur); + void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve); +// void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], // multi_array2D & hfsize, multi_array2D & hilite, int box ); @@ -273,7 +275,7 @@ protected: void jdl_interpolate_omp(); void igv_interpolate(int winw, int winh); void lmmse_interpolate_omp(int winw, int winh, int iterations); - // void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); +// void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); void amaze_demosaic_RT(int winx, int winy, int winw, int winh);//Emil's code for AMaZE void fast_demosaic(int winx, int winy, int winw, int winh );//Emil's code for fast demosaicing diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index aa1cad0f7..f368b42d4 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -428,18 +428,20 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavedgeampli DIRPYREQUALIZER, //EvWavlev3nois DIRPYREQUALIZER, //EvWavNPmet - ALLNORAW, // Evdehazmet - ALLNORAW, // EvLneigh - ALLNORAW, // EvLgain - ALLNORAW, // EvLoffs - ALLNORAW, // EvLstr - ALLNORAW, // EvLscal - ALLNORAW, // EvLvart - ALLNORAW, // EvLCDCurve - ALLNORAW, // EvDehazOpacity - ALLNORAW, // EvDehazEnabled - ALLNORAW // EvDehazretinex - + DEMOSAIC, // Evdehazmet + DEMOSAIC, // EvLneigh + DEMOSAIC, // EvLgain + DEMOSAIC, // EvLoffs + DEMOSAIC, // EvLstr + DEMOSAIC, // EvLscal + DEMOSAIC, // EvLvart + DEMOSAIC, // EvLCDCurve + DEMOSAIC, // EvDehazOpacity + DEMOSAIC, // EvDehazEnabled + DEMOSAIC, // EvDehazretinex + DEMOSAIC, // EvDehazmedianmap + DEMOSAIC // EvLlimd + }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index dbc289276..f86c1293b 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -115,25 +115,30 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if (pl) { pl->setProgress (0.30); } - + if(params.dehaz.enabled) { //enabled Dehaze LUTf cdcurve (65536, 0); - - bool dehacontlutili=false; + DehaztransmissionCurve dehatransmissionCurve; + + bool dehacontlutili = false; CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehacontlutili ); + DehazParams DehaParams = params.dehaz; + DehaParams.getCurves(dehatransmissionCurve); + + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili ); } if (pl) { pl->setProgress (0.40); } + imgsrc->HLRecovery_Global( params.toneCurve ); - + if (pl) { pl->setProgress (0.45); } - + // set the color temperature ColorTemp currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); @@ -913,7 +918,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, hist16C, hist16C, dummy, dummy, 1); - // ipf.MSR(labView, labView->W, labView->H, 1); +// ipf.MSR(labView, labView->W, labView->H, 1); ipf.chromiLuminanceCurve (NULL, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc index 8323a6a9e..4c9d79d47 100644 --- a/rtgui/dehaz.cc +++ b/rtgui/dehaz.cc @@ -1,420 +1,493 @@ -/* - * This file is part of RawTherapee. - */ -#include "dehaz.h" -#include "mycurve.h" - -using namespace rtengine; -using namespace rtengine::procparams; - -Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, true) -{ - CurveListener::setMulti(true); - std::vector milestones; - - dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) ); - dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP")); - dehazFrame->set_border_width(0); - dehazFrame->set_label_align(0.025, 0.5); - - Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox()); - dehazVBox->set_border_width(4); - dehazVBox->set_spacing(2); - - Gtk::VBox * RetiVBox = Gtk::manage ( new Gtk::VBox()); - RetiVBox->set_border_width(4); - RetiVBox->set_spacing(2); - - dhbox = Gtk::manage (new Gtk::HBox ()); - labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":")); - dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); - - dehazmet = Gtk::manage (new MyComboBoxText ()); - dehazmet->append_text (M("TP_DEHAZ_LOW")); - dehazmet->append_text (M("TP_DEHAZ_UNI")); - dehazmet->append_text (M("TP_DEHAZ_HIGH")); - dehazmet->set_active(0); - dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) ); - dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); - dhbox->pack_start(*dehazmet); - dehazVBox->pack_start(*dhbox); - std::vector defaultCurve; - - curveEditorGD = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDIT")); - curveEditorGD->setCurveListener (this); - rtengine::DehazParams::getDefaultCDCurve(defaultCurve); - cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD"))); - cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); - cdshape->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP")); - std::vector milestones22; - - milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); - cdshape->setBottomBarBgGradient(milestones22); - cdshape->setLeftBarBgGradient(milestones22); - - curveEditorGD->curveListComplete(); - - transmissionCurveEditorG = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_TRANSMISSION")); - transmissionCurveEditorG->setCurveListener (this); - - rtengine::DehazParams::getDefaulttransmissionCurve(defaultCurve); - transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false)); - transmissionShape->setIdentityValue(0.); - transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); - transmissionShape->setBottomBarBgGradient(milestones); - transmissionCurveEditorG->set_tooltip_markup (M("TP_DEHAZ_TRANS_TOOLTIP")); - - transmissionCurveEditorG->curveListComplete(); - - - - str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 60.)); - str->set_tooltip_markup (M("TP_DEHAZ_STR_TOOLTIP")); - neigh = Gtk::manage (new Adjuster (M("TP_DEHAZ_NEIGH"), 6, 100., 1., 80.)); - - retinex = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_RETIN"))); - retinex->set_active (true); - retinexConn = retinex->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::retinexChanged) ); - - dehazVBox->pack_start (*str); - str->show (); - - dehazVBox->pack_start (*neigh); - neigh->show (); - neigh->set_tooltip_markup (M("TP_DEHAZ_NEIGH_TOOLTIP")); - - dehazVBox->pack_start (*retinex); - retinex->show (); - - scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 6., 1., 3.)); - gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 50, 150, 1, 100)); - offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -3000, 3000, 1, 0)); - vart = Gtk::manage (new Adjuster (M("TP_DEHAZ_VART"), 80, 250, 1, 125)); - gain->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP")); - scal->set_tooltip_markup (M("TP_DEHAZ_SCAL_TOOLTIP")); - vart->set_tooltip_markup (M("TP_DEHAZ_VART_TOOLTIP")); - - RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); - curveEditorGD->show(); - - RetiVBox->pack_start (*scal); - scal->show (); - - - RetiVBox->pack_start (*gain); - gain->show (); - - RetiVBox->pack_start (*offs); - offs->show (); - - RetiVBox->pack_start (*vart); - vart->show (); - - RetiVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); - transmissionCurveEditorG->show(); - - - str->setAdjusterListener (this); - scal->setAdjusterListener (this); - neigh->setAdjusterListener (this); - gain->setAdjusterListener (this); - offs->setAdjusterListener (this); - vart->setAdjusterListener (this); - pack_start (*dehazVBox); - dehazFrame->add(*RetiVBox); - pack_start (*dehazFrame); - dehazFrame->hide(); - - disableListener(); - retinexChanged(); - enableListener(); - -} - -Dehaz::~Dehaz() -{ - delete curveEditorGD; - delete transmissionCurveEditorG; - -} - - -void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) -{ - disableListener (); - dehazmetConn.block(true); - - - if (pedited) { - scal->setEditedState (pedited->dehaz.scal ? Edited : UnEdited); - neigh->setEditedState (pedited->dehaz.neigh ? Edited : UnEdited); - gain->setEditedState (pedited->dehaz.gain ? Edited : UnEdited); - offs->setEditedState (pedited->dehaz.offs ? Edited : UnEdited); - vart->setEditedState (pedited->dehaz.vart ? Edited : UnEdited); - set_inconsistent (multiImage && !pedited->dehaz.enabled); - retinex->set_inconsistent (!pedited->dehaz.retinex); - - - if (!pedited->dehaz.dehazmet) { - dehazmet->set_active_text(M("GENERAL_UNCHANGED")); - } - cdshape->setUnChanged (!pedited->dehaz.cdcurve); - transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve); - - } - - neigh->setValue (pp->dehaz.neigh); - gain->setValue (pp->dehaz.gain); - offs->setValue (pp->dehaz.offs); - str->setValue (pp->dehaz.str); - scal->setValue (pp->dehaz.scal); - vart->setValue (pp->dehaz.vart); - - setEnabled (pp->dehaz.enabled); - - retinexConn.block (true); - retinex->set_active (pp->dehaz.retinex); - retinexConn.block (false); - lastretinex = pp->dehaz.retinex; - - - if (pp->dehaz.dehazmet == "low") { - dehazmet->set_active (0); - } else if (pp->dehaz.dehazmet == "uni") { - dehazmet->set_active (1); - } else if (pp->dehaz.dehazmet == "high") { - dehazmet->set_active (2); - } - dehazmetChanged (); - retinexConn.block(false); - retinexChanged (); - retinexConn.block(false); - - cdshape->setCurve (pp->dehaz.cdcurve); - dehazmetConn.block(false); - transmissionShape->setCurve (pp->dehaz.transmissionCurve); - - - enableListener (); -} -void Dehaz::retinexUpdateUI () -{ - if (!batchMode) { - if (retinex->get_active ()) { - scal->show(); - gain->show(); - offs->show(); - vart->show(); - transmissionCurveEditorG->show(); - curveEditorGD->show(); - dehazFrame->show(); - } else { - scal->hide(); - gain->hide(); - offs->hide(); - vart->hide(); - transmissionCurveEditorG->hide(); - curveEditorGD->hide(); - dehazFrame->hide(); - } - } -} - - - -void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) -{ - - pp->dehaz.str = str->getValue (); - pp->dehaz.scal = (int)scal->getValue (); - pp->dehaz.neigh = neigh->getValue (); - pp->dehaz.gain = (int)gain->getValue (); - pp->dehaz.offs = (int)offs->getValue (); - pp->dehaz.vart = (int)vart->getValue (); - pp->dehaz.cdcurve = cdshape->getCurve (); - pp->dehaz.transmissionCurve = transmissionShape->getCurve (); - pp->dehaz.enabled = getEnabled(); - pp->dehaz.retinex = retinex->get_active(); - - if (pedited) { - pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); - - //%%%%%%%%%%%%%%%%%%%%%% - pedited->dehaz.str = str->getEditedState (); - pedited->dehaz.scal = scal->getEditedState (); - pedited->dehaz.neigh = neigh->getEditedState (); - pedited->dehaz.gain = gain->getEditedState (); - pedited->dehaz.offs = offs->getEditedState (); - pedited->dehaz.vart = vart->getEditedState (); - pedited->dehaz.cdcurve = !cdshape->isUnChanged (); - pedited->dehaz.transmissionCurve = !transmissionShape->isUnChanged (); - pedited->dehaz.enabled = !get_inconsistent(); - pedited->dehaz.retinex = !retinex->get_inconsistent(); - - } - if (dehazmet->get_active_row_number() == 0) { - pp->dehaz.dehazmet = "low"; - } else if (dehazmet->get_active_row_number() == 1) { - pp->dehaz.dehazmet = "uni"; - } else if (dehazmet->get_active_row_number() == 2) { - pp->dehaz.dehazmet = "high"; - } -} - -void Dehaz::dehazmetChanged() -{ - if (listener) { - listener->panelChanged (Evdehazmet, dehazmet->get_active_text ()); - } - } - -void Dehaz::retinexChanged () -{ - if (batchMode) { - if (retinex->get_inconsistent()) { - retinex->set_inconsistent (false); - retinexConn.block (true); - retinex->set_active (false); - retinexConn.block (false); - } else if (lastretinex) { - retinex->set_inconsistent (true); - } - - lastretinex = retinex->get_active (); - } - retinexUpdateUI(); - - if (listener) { - if (retinex->get_active()) { - if (getEnabled()) { - listener->panelChanged (EvDehazretinex, M("GENERAL_ENABLED")); - } - } else { - if (getEnabled()) { - listener->panelChanged (EvDehazretinex, M("GENERAL_DISABLED")); - } - } - - } -} - - - -void Dehaz::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) -{ - - neigh->setDefault (defParams->dehaz.neigh); - gain->setDefault (defParams->dehaz.gain); - offs->setDefault (defParams->dehaz.offs); - str->setDefault (defParams->dehaz.str); - scal->setDefault (defParams->dehaz.scal); - vart->setDefault (defParams->dehaz.vart); - - if (pedited) { - neigh->setDefaultEditedState (pedited->dehaz.neigh ? Edited : UnEdited); - gain->setDefaultEditedState (pedited->dehaz.gain ? Edited : UnEdited); - offs->setDefaultEditedState (pedited->dehaz.offs ? Edited : UnEdited); - str->setDefaultEditedState (pedited->dehaz.str ? Edited : UnEdited); - scal->setDefaultEditedState (pedited->dehaz.scal ? Edited : UnEdited); - vart->setDefaultEditedState (pedited->dehaz.vart ? Edited : UnEdited); - - } else { - neigh->setDefaultEditedState (Irrelevant); - gain->setDefaultEditedState (Irrelevant); - offs->setDefaultEditedState (Irrelevant); - vart->setDefaultEditedState (Irrelevant); - str->setDefaultEditedState (Irrelevant); - scal->setDefaultEditedState (Irrelevant); - } -} -/* -void Dehaz::setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd) -{ - -} -*/ - -void Dehaz::adjusterChanged (Adjuster* a, double newval) -{ - - if (!listener || !getEnabled()) { - return; - } - - if (a == neigh) { - listener->panelChanged (EvLneigh, neigh->getTextValue()); - } else if (a == str) { - listener->panelChanged (EvLstr, str->getTextValue()); - } else if (a == scal) { - listener->panelChanged (EvLscal, scal->getTextValue()); - } else if (a == gain) { - listener->panelChanged (EvLgain, gain->getTextValue()); - } else if (a == offs) { - listener->panelChanged (EvLoffs, offs->getTextValue()); - } else if (a == vart) { - listener->panelChanged (EvLvart, vart->getTextValue()); - } -} - - - -void Dehaz::autoOpenCurve () -{ - cdshape->openIfNonlinear(); - transmissionShape->openIfNonlinear(); - -} - - -void Dehaz::curveChanged (CurveEditor* ce) -{ - if (listener && getEnabled()) { - if (ce == cdshape) { - listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); - } else if (ce == transmissionShape) { - listener->panelChanged (EvDehaztransmission, M("HISTORY_CUSTOMCURVE")); - } - } -} - -void Dehaz::enabledChanged () -{ - - if (listener) { - if (get_inconsistent()) { - listener->panelChanged (EvDehazEnabled, M("GENERAL_UNCHANGED")); - } else if (getEnabled()) { - listener->panelChanged (EvDehazEnabled, M("GENERAL_ENABLED")); - } else { - listener->panelChanged (EvDehazEnabled, M("GENERAL_DISABLED")); - } - } -} - - -void Dehaz::trimValues (rtengine::procparams::ProcParams* pp) -{ - str->trimValue(pp->dehaz.str); - scal->trimValue(pp->dehaz.scal); - neigh->trimValue(pp->dehaz.neigh); - gain->trimValue(pp->dehaz.gain); - offs->trimValue(pp->dehaz.offs); - vart->trimValue(pp->dehaz.vart); - -} - -void Dehaz::setBatchMode (bool batchMode) -{ - ToolPanel::setBatchMode (batchMode); - neigh->showEditedCB (); - gain->showEditedCB (); - offs->showEditedCB (); - str->showEditedCB (); - scal->showEditedCB (); - vart->showEditedCB (); - curveEditorGD->setBatchMode (batchMode); - transmissionCurveEditorG->setBatchMode (batchMode); - - -} +/* + * This file is part of RawTherapee. + */ +#include "dehaz.h" +#include "mycurve.h" + +using namespace rtengine; +using namespace rtengine::procparams; + +Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, true) +{ + CurveListener::setMulti(true); + std::vector milestones; + + dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) ); + dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP")); + dehazFrame->set_border_width(0); + dehazFrame->set_label_align(0.025, 0.5); + + Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox()); + dehazVBox->set_border_width(4); + dehazVBox->set_spacing(2); + + Gtk::VBox * RetiVBox = Gtk::manage ( new Gtk::VBox()); + RetiVBox->set_border_width(4); + RetiVBox->set_spacing(2); + + dhbox = Gtk::manage (new Gtk::HBox ()); + labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":")); + dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); + + dehazmet = Gtk::manage (new MyComboBoxText ()); + dehazmet->append_text (M("TP_DEHAZ_LOW")); + dehazmet->append_text (M("TP_DEHAZ_UNI")); + dehazmet->append_text (M("TP_DEHAZ_HIGH")); + dehazmet->set_active(0); + dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) ); + dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); + dhbox->pack_start(*dehazmet); + dehazVBox->pack_start(*dhbox); + std::vector defaultCurve; + + curveEditorGD = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDIT")); + curveEditorGD->setCurveListener (this); + rtengine::DehazParams::getDefaultCDCurve(defaultCurve); + cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD"))); + cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cdshape->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP")); + std::vector milestones22; + + milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshape->setBottomBarBgGradient(milestones22); + cdshape->setLeftBarBgGradient(milestones22); + + curveEditorGD->curveListComplete(); + + transmissionCurveEditorG = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_TRANSMISSION")); + transmissionCurveEditorG->setCurveListener (this); + + rtengine::DehazParams::getDefaulttransmissionCurve(defaultCurve); + transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false)); + transmissionShape->setIdentityValue(0.); + transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + transmissionShape->setBottomBarBgGradient(milestones); + transmissionCurveEditorG->set_tooltip_markup (M("TP_DEHAZ_TRANS_TOOLTIP")); + + transmissionCurveEditorG->curveListComplete(); + + + + str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 60.)); + str->set_tooltip_markup (M("TP_DEHAZ_STR_TOOLTIP")); + neigh = Gtk::manage (new Adjuster (M("TP_DEHAZ_NEIGH"), 6, 100., 1., 80.)); + + retinex = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_RETIN"))); + retinex->set_active (true); + retinexConn = retinex->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::retinexChanged) ); + + dehazVBox->pack_start (*str); + str->show (); + + dehazVBox->pack_start (*neigh); + neigh->show (); + neigh->set_tooltip_markup (M("TP_DEHAZ_NEIGH_TOOLTIP")); + + dehazVBox->pack_start (*retinex); + retinex->show (); + + scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 8., 1., 3.)); + gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 20, 200, 1, 100));//50 150 + offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -10000, 10000, 1, 0)); + vart = Gtk::manage (new Adjuster (M("TP_DEHAZ_VART"), 50, 500, 1, 125)); + limd = Gtk::manage (new Adjuster (M("TP_DEHAZ_LIMD"), 2, 100, 1, 8)); + gain->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP")); + offs->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP")); + scal->set_tooltip_markup (M("TP_DEHAZ_SCAL_TOOLTIP")); + vart->set_tooltip_markup (M("TP_DEHAZ_VART_TOOLTIP")); + limd->set_tooltip_markup (M("TP_DEHAZ_LIMD_TOOLTIP")); + + medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_MEDI"))); + medianmap->set_active (true); + medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::medianmapChanged) ); + + RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); + curveEditorGD->show(); + + RetiVBox->pack_start (*scal); + scal->show (); + + RetiVBox->pack_start (*gain); + gain->show (); + + RetiVBox->pack_start (*offs); + offs->show (); + + RetiVBox->pack_start (*vart); + vart->show (); + + RetiVBox->pack_start (*limd); + limd->show (); + + RetiVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); + transmissionCurveEditorG->show(); + + RetiVBox->pack_start (*medianmap); + medianmap->show (); + + str->setAdjusterListener (this); + scal->setAdjusterListener (this); + neigh->setAdjusterListener (this); + gain->setAdjusterListener (this); + offs->setAdjusterListener (this); + vart->setAdjusterListener (this); + limd->setAdjusterListener (this); + pack_start (*dehazVBox); + dehazFrame->add(*RetiVBox); + pack_start (*dehazFrame); + dehazFrame->hide(); + + disableListener(); + retinexChanged(); + medianmapChanged(); + enableListener(); + +} + +Dehaz::~Dehaz() +{ + delete curveEditorGD; + delete transmissionCurveEditorG; + +} + + +void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) +{ + disableListener (); + dehazmetConn.block(true); + + + if (pedited) { + scal->setEditedState (pedited->dehaz.scal ? Edited : UnEdited); + neigh->setEditedState (pedited->dehaz.neigh ? Edited : UnEdited); + gain->setEditedState (pedited->dehaz.gain ? Edited : UnEdited); + offs->setEditedState (pedited->dehaz.offs ? Edited : UnEdited); + vart->setEditedState (pedited->dehaz.vart ? Edited : UnEdited); + limd->setEditedState (pedited->dehaz.limd ? Edited : UnEdited); + set_inconsistent (multiImage && !pedited->dehaz.enabled); + retinex->set_inconsistent (!pedited->dehaz.retinex); + medianmap->set_inconsistent (!pedited->dehaz.medianmap); + + + if (!pedited->dehaz.dehazmet) { + dehazmet->set_active_text(M("GENERAL_UNCHANGED")); + } + + cdshape->setUnChanged (!pedited->dehaz.cdcurve); + transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve); + + } + + neigh->setValue (pp->dehaz.neigh); + gain->setValue (pp->dehaz.gain); + offs->setValue (pp->dehaz.offs); + str->setValue (pp->dehaz.str); + scal->setValue (pp->dehaz.scal); + vart->setValue (pp->dehaz.vart); + limd->setValue (pp->dehaz.limd); + + setEnabled (pp->dehaz.enabled); + + retinexConn.block (true); + retinex->set_active (pp->dehaz.retinex); + retinexConn.block (false); + lastretinex = pp->dehaz.retinex; + + medianmapConn.block (true); + medianmap->set_active (pp->dehaz.medianmap); + medianmapConn.block (false); + lastmedianmap = pp->dehaz.medianmap; + + + if (pp->dehaz.dehazmet == "low") { + dehazmet->set_active (0); + } else if (pp->dehaz.dehazmet == "uni") { + dehazmet->set_active (1); + } else if (pp->dehaz.dehazmet == "high") { + dehazmet->set_active (2); + } + + dehazmetChanged (); + retinexConn.block(false); + retinexChanged (); + retinexConn.block(false); + + medianmapConn.block(false); + medianmapChanged (); + medianmapConn.block(false); + + cdshape->setCurve (pp->dehaz.cdcurve); + dehazmetConn.block(false); + transmissionShape->setCurve (pp->dehaz.transmissionCurve); + + + enableListener (); +} +void Dehaz::retinexUpdateUI () +{ + if (!batchMode) { + if (retinex->get_active ()) { + scal->show(); + gain->show(); + offs->show(); + vart->show(); + limd->show(); + medianmap->show(); + transmissionCurveEditorG->show(); + curveEditorGD->show(); + dehazFrame->show(); + } else { + scal->hide(); + gain->hide(); + offs->hide(); + vart->hide(); + limd->hide(); + medianmap->hide(); + transmissionCurveEditorG->hide(); + curveEditorGD->hide(); + dehazFrame->hide(); + } + } +} + + + +void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) +{ + + pp->dehaz.str = str->getValue (); + pp->dehaz.scal = (int)scal->getValue (); + pp->dehaz.neigh = neigh->getValue (); + pp->dehaz.gain = (int)gain->getValue (); + pp->dehaz.offs = (int)offs->getValue (); + pp->dehaz.vart = (int)vart->getValue (); + pp->dehaz.limd = (int)limd->getValue (); + pp->dehaz.cdcurve = cdshape->getCurve (); + pp->dehaz.transmissionCurve = transmissionShape->getCurve (); + pp->dehaz.enabled = getEnabled(); + pp->dehaz.retinex = retinex->get_active(); + pp->dehaz.medianmap = medianmap->get_active(); + + if (pedited) { + pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); + + //%%%%%%%%%%%%%%%%%%%%%% + pedited->dehaz.str = str->getEditedState (); + pedited->dehaz.scal = scal->getEditedState (); + pedited->dehaz.neigh = neigh->getEditedState (); + pedited->dehaz.gain = gain->getEditedState (); + pedited->dehaz.offs = offs->getEditedState (); + pedited->dehaz.vart = vart->getEditedState (); + pedited->dehaz.limd = limd->getEditedState (); + pedited->dehaz.cdcurve = !cdshape->isUnChanged (); + pedited->dehaz.transmissionCurve = !transmissionShape->isUnChanged (); + pedited->dehaz.enabled = !get_inconsistent(); + pedited->dehaz.retinex = !retinex->get_inconsistent(); + pedited->dehaz.medianmap = !medianmap->get_inconsistent(); + + } + + if (dehazmet->get_active_row_number() == 0) { + pp->dehaz.dehazmet = "low"; + } else if (dehazmet->get_active_row_number() == 1) { + pp->dehaz.dehazmet = "uni"; + } else if (dehazmet->get_active_row_number() == 2) { + pp->dehaz.dehazmet = "high"; + } +} + +void Dehaz::dehazmetChanged() +{ + if (listener) { + listener->panelChanged (Evdehazmet, dehazmet->get_active_text ()); + } +} + +void Dehaz::retinexChanged () +{ + if (batchMode) { + if (retinex->get_inconsistent()) { + retinex->set_inconsistent (false); + retinexConn.block (true); + retinex->set_active (false); + retinexConn.block (false); + } else if (lastretinex) { + retinex->set_inconsistent (true); + } + + lastretinex = retinex->get_active (); + } + + retinexUpdateUI(); + + if (listener) { + if (retinex->get_active()) { + if (getEnabled()) { + listener->panelChanged (EvDehazretinex, M("GENERAL_ENABLED")); + } + } else { + if (getEnabled()) { + listener->panelChanged (EvDehazretinex, M("GENERAL_DISABLED")); + } + } + + } +} + +void Dehaz::medianmapChanged () +{ + if (batchMode) { + if (medianmap->get_inconsistent()) { + medianmap->set_inconsistent (false); + medianmapConn.block (true); + medianmap->set_active (false); + medianmapConn.block (false); + } else if (lastmedianmap) { + medianmap->set_inconsistent (true); + } + + lastmedianmap = medianmap->get_active (); + } + + if (listener) { + if (medianmap->get_active()) { + if (getEnabled()) { + listener->panelChanged (EvDehazmedianmap, M("GENERAL_ENABLED")); + } + } else { + if (getEnabled()) { + listener->panelChanged (EvDehazmedianmap, M("GENERAL_DISABLED")); + } + } + + } +} + + +void Dehaz::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) +{ + + neigh->setDefault (defParams->dehaz.neigh); + gain->setDefault (defParams->dehaz.gain); + offs->setDefault (defParams->dehaz.offs); + str->setDefault (defParams->dehaz.str); + scal->setDefault (defParams->dehaz.scal); + vart->setDefault (defParams->dehaz.vart); + limd->setDefault (defParams->dehaz.limd); + + if (pedited) { + neigh->setDefaultEditedState (pedited->dehaz.neigh ? Edited : UnEdited); + gain->setDefaultEditedState (pedited->dehaz.gain ? Edited : UnEdited); + offs->setDefaultEditedState (pedited->dehaz.offs ? Edited : UnEdited); + str->setDefaultEditedState (pedited->dehaz.str ? Edited : UnEdited); + scal->setDefaultEditedState (pedited->dehaz.scal ? Edited : UnEdited); + vart->setDefaultEditedState (pedited->dehaz.vart ? Edited : UnEdited); + limd->setDefaultEditedState (pedited->dehaz.limd ? Edited : UnEdited); + + } else { + neigh->setDefaultEditedState (Irrelevant); + gain->setDefaultEditedState (Irrelevant); + offs->setDefaultEditedState (Irrelevant); + vart->setDefaultEditedState (Irrelevant); + limd->setDefaultEditedState (Irrelevant); + str->setDefaultEditedState (Irrelevant); + scal->setDefaultEditedState (Irrelevant); + } +} +/* +void Dehaz::setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd) +{ + +} +*/ + +void Dehaz::adjusterChanged (Adjuster* a, double newval) +{ + + if (!listener || !getEnabled()) { + return; + } + + if (a == neigh) { + listener->panelChanged (EvLneigh, neigh->getTextValue()); + } else if (a == str) { + listener->panelChanged (EvLstr, str->getTextValue()); + } else if (a == scal) { + listener->panelChanged (EvLscal, scal->getTextValue()); + } else if (a == gain) { + listener->panelChanged (EvLgain, gain->getTextValue()); + } else if (a == offs) { + listener->panelChanged (EvLoffs, offs->getTextValue()); + } else if (a == vart) { + listener->panelChanged (EvLvart, vart->getTextValue()); + } else if (a == limd) { + listener->panelChanged (EvLlimd, vart->getTextValue()); + } + +} + + + +void Dehaz::autoOpenCurve () +{ + cdshape->openIfNonlinear(); + transmissionShape->openIfNonlinear(); + +} + + +void Dehaz::curveChanged (CurveEditor* ce) +{ + if (listener && getEnabled()) { + if (ce == cdshape) { + listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); + } else if (ce == transmissionShape) { + listener->panelChanged (EvDehaztransmission, M("HISTORY_CUSTOMCURVE")); + } + } +} + +void Dehaz::enabledChanged () +{ + + if (listener) { + if (get_inconsistent()) { + listener->panelChanged (EvDehazEnabled, M("GENERAL_UNCHANGED")); + } else if (getEnabled()) { + listener->panelChanged (EvDehazEnabled, M("GENERAL_ENABLED")); + } else { + listener->panelChanged (EvDehazEnabled, M("GENERAL_DISABLED")); + } + } +} + + +void Dehaz::trimValues (rtengine::procparams::ProcParams* pp) +{ + str->trimValue(pp->dehaz.str); + scal->trimValue(pp->dehaz.scal); + neigh->trimValue(pp->dehaz.neigh); + gain->trimValue(pp->dehaz.gain); + offs->trimValue(pp->dehaz.offs); + vart->trimValue(pp->dehaz.vart); + limd->trimValue(pp->dehaz.limd); + +} + +void Dehaz::setBatchMode (bool batchMode) +{ + ToolPanel::setBatchMode (batchMode); + neigh->showEditedCB (); + gain->showEditedCB (); + offs->showEditedCB (); + str->showEditedCB (); + scal->showEditedCB (); + vart->showEditedCB (); + limd->showEditedCB (); + curveEditorGD->setBatchMode (batchMode); + transmissionCurveEditorG->setBatchMode (batchMode); + + +} diff --git a/rtgui/dehaz.h b/rtgui/dehaz.h index 9cf0614c5..86d6e134a 100644 --- a/rtgui/dehaz.h +++ b/rtgui/dehaz.h @@ -14,7 +14,7 @@ #include "colorprovider.h" class Dehaz : public ToolParamBlock, public FoldableToolPanel, public CurveListener, - public AdjusterListener + public AdjusterListener { protected: @@ -25,24 +25,26 @@ protected: Adjuster* gain; Adjuster* offs; Adjuster* vart; - + Adjuster* limd; + Gtk::Label* labmdh; Gtk::HBox* dhbox; MyComboBoxText* dehazmet; Gtk::CheckButton* retinex; Gtk::Frame* dehazFrame; + Gtk::CheckButton* medianmap; DiagonalCurveEditor* cdshape; CurveEditorGroup* transmissionCurveEditorG; sigc::connection dehazmetConn; FlatCurveEditor* transmissionShape; - bool lastretinex; - sigc::connection retinexConn; + bool lastretinex, lastmedianmap; + sigc::connection retinexConn, medianmapConn; public: Dehaz (); ~Dehaz (); - + void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = NULL); void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = NULL); void setBatchMode (bool batchMode); @@ -52,6 +54,7 @@ public: // void setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd); void autoOpenCurve (); void retinexChanged (); + void medianmapChanged (); void enabledChanged (); void curveChanged (CurveEditor* ce); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 7dc1e57ea..edf449dcc 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -58,6 +58,8 @@ void ParamsEdited::set (bool v) dehaz.gain = v; dehaz.offs = v; dehaz.vart = v; + dehaz.limd = v; + dehaz.medianmap = v; dehaz.transmissionCurve = v; dehaz.retinex = v; labCurve.lcurve = v; @@ -524,8 +526,10 @@ void ParamsEdited::initFrom (const std::vector dehaz.gain = dehaz.gain && p.dehaz.gain == other.dehaz.gain; dehaz.offs = dehaz.offs && p.dehaz.offs == other.dehaz.offs; dehaz.vart = dehaz.vart && p.dehaz.vart == other.dehaz.vart; - dehaz.enabled = dehaz.enabled && p.dehaz.enabled == other.dehaz.enabled; - dehaz.retinex = dehaz.retinex && p.dehaz.retinex == other.dehaz.retinex; + dehaz.limd = dehaz.limd && p.dehaz.limd == other.dehaz.limd; + dehaz.medianmap = dehaz.medianmap && p.dehaz.medianmap == other.dehaz.medianmap; + dehaz.enabled = dehaz.enabled && p.dehaz.enabled == other.dehaz.enabled; + dehaz.retinex = dehaz.retinex && p.dehaz.retinex == other.dehaz.retinex; labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve; labCurve.acurve = labCurve.acurve && p.labCurve.acurve == other.labCurve.acurve; labCurve.bcurve = labCurve.bcurve && p.labCurve.bcurve == other.labCurve.bcurve; @@ -1016,7 +1020,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (toneCurve.method) { toEdit.toneCurve.method = mods.toneCurve.method; } - + if (dehaz.enabled) { toEdit.dehaz.enabled = mods.dehaz.enabled; } @@ -1024,7 +1028,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (dehaz.cdcurve) { toEdit.dehaz.cdcurve = mods.dehaz.cdcurve; } - + if (dehaz.transmissionCurve) { toEdit.dehaz.transmissionCurve = mods.dehaz.transmissionCurve; } @@ -1040,25 +1044,35 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (dehaz.scal) { toEdit.dehaz.scal = mods.dehaz.scal; } - + if (dehaz.retinex) { toEdit.dehaz.retinex = mods.dehaz.retinex; } - + + if (dehaz.medianmap) { + toEdit.dehaz.medianmap = mods.dehaz.medianmap; + } + if (dehaz.neigh) { toEdit.dehaz.neigh = mods.dehaz.neigh; } - + + if (dehaz.limd) { + toEdit.dehaz.limd = mods.dehaz.limd; + } + if (dehaz.gain) { toEdit.dehaz.gain = mods.dehaz.gain; } + if (dehaz.offs) { toEdit.dehaz.offs = mods.dehaz.offs; } + if (dehaz.vart) { toEdit.dehaz.vart = mods.dehaz.vart; } - + if (labCurve.lcurve) { toEdit.labCurve.lcurve = mods.labCurve.lcurve; } @@ -1090,15 +1104,17 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (labCurve.lccurve) { toEdit.labCurve.lccurve = mods.labCurve.lccurve; } + // if (labCurve.dehazmet) { // toEdit.labCurve.dehazmet = mods.labCurve.dehazmet; // } if (labCurve.clcurve) { toEdit.labCurve.clcurve = mods.labCurve.clcurve; } - // if (labCurve.cdcurve) { - // toEdit.labCurve.cdcurve = mods.labCurve.cdcurve; - // } + +// if (labCurve.cdcurve) { +// toEdit.labCurve.cdcurve = mods.labCurve.cdcurve; + // } if (labCurve.brightness) { toEdit.labCurve.brightness = dontforceSet && options.baBehav[ADDSET_LC_BRIGHTNESS] ? toEdit.labCurve.brightness + mods.labCurve.brightness : mods.labCurve.brightness; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 10dbfe828..b2a7056d1 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -66,11 +66,13 @@ public: bool offs; bool dehazmet; bool vart; + bool limd; bool method; bool transmissionCurve; bool cdcurve; bool retinex; - + bool medianmap; + }; @@ -717,7 +719,7 @@ public: LCurveParamsEdited labCurve; RGBCurvesParamsEdited rgbCurves; ColorToningEdited colorToning; - DehazParamsEdited dehaz; + DehazParamsEdited dehaz; SharpeningParamsEdited sharpening; SharpeningParamsEdited prsharpening; SharpenEdgeParamsEdited sharpenEdge; From 60b3341f3a540ca4b7668fdede8436d3b06c5c48 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 8 Sep 2015 07:14:59 +0200 Subject: [PATCH 14/71] GUI enhancement for DeHaze --- rtdata/languages/default | 4 ++ rtengine/dcrop.cc | 3 +- rtengine/imagesource.h | 4 +- rtengine/improccoordinator.cc | 10 ++-- rtengine/improccoordinator.h | 7 ++- rtengine/ipdehaz.cc | 46 +++++++++++++++-- rtengine/rawimagesource.cc | 4 +- rtengine/rawimagesource.h | 4 +- rtengine/rtengine.h | 9 ++++ rtengine/simpleprocess.cc | 4 +- rtgui/dehaz.cc | 97 ++++++++++++++++++++++++++++++++++- rtgui/dehaz.h | 20 +++++++- rtgui/toolpanelcoord.cc | 1 + 13 files changed, 192 insertions(+), 21 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 86962a8c0..c09a3f279 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1552,6 +1552,10 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. +TP_DEHAZ_MLABEL;Restored haze-free Min=%1 Max=%2 +TP_DEHAZ_MLABEL_TOOLTIP;Should be near of min=0 max=32768\nRestored image with no mixture +TP_DEHAZ_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6 +TP_DEHAZ_TLABEL_TOOLTIP;Transmission map result\nm=Mini M=Maxi used by Variance\nMe=Mean Si=Sigma\nTm=Min TM=Max of Transmission map TP_DEHAZ_STR;Strength TP_DEHAZ_STR_TOOLTIP;Mixture in proportion to the original image and that obtained by Retinex algoritm TP_DEHAZ_RETIN;Complete Retinex algoritm diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index be7f76302..58a48abed 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -158,7 +158,7 @@ void Crop::update (int todo) int heiIm = parent->fh; bool needstransform = parent->ipf.needsTransform(); - + if (todo & (M_INIT | M_LINDENOISE)) { MyMutex::MyLock lock(parent->minit); // Also used in improccoord @@ -305,7 +305,6 @@ void Crop::update (int todo) if(parent->adnListener) { parent->adnListener->noiseTilePrev (centerTile_X[poscenterX], centerTile_Y[poscenterY], CenterPreview_X, CenterPreview_Y, crW, trafw * skip); } - // I have tried "blind" some solutions..to move review ...but GUI is not my truc ! // int W,H; // cropgl->cropMoved (centerTile_X[poscenterX],centerTile_Y[poscenterY] , W, H); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index de4bdbe8d..cb8a36f7d 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -70,13 +70,13 @@ public: virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; // virtual void // dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; - virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili) {}; + virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; // virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) {}; - virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve) {}; + virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 4c329c550..f2ab07155 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -86,7 +86,7 @@ ImProcCoordinator::ImProcCoordinator () bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), fullw(1), fullh(1), pW(-1), pH(-1), - plistener(NULL), imageListener(NULL), aeListener(NULL), acListener(NULL), abwListener(NULL), actListener(NULL), adnListener(NULL), awavListener(NULL), hListener(NULL), + plistener(NULL), imageListener(NULL), aeListener(NULL), acListener(NULL), abwListener(NULL), actListener(NULL), adnListener(NULL), awavListener(NULL), dehaListener(NULL), hListener(NULL), resultValid(false), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), wavcontlutili(false), butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false) @@ -240,9 +240,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); DehazParams DehaParams = params.dehaz; DehaParams.getCurves(dehatransmissionCurve); - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili);//enabled Dehaze + float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Dehaze + if(dehaListener) { + dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + } - } + } } // Updating toneCurve.hrenabled if necessary diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 0c2f8f459..9edefba80 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -154,7 +154,8 @@ protected: AutoColorTonListener* actListener; AutoChromaListener* adnListener; WaveletListener* awavListener; - + DehazListener* dehaListener; + HistogramListener* hListener; std::vector sizeListeners; @@ -299,6 +300,10 @@ public: { adnListener = adn; } + void setDehazListener (DehazListener* adh) + { + dehaListener = adh; + } void setWaveletListener (WaveletListener* awa) { awavListener = awa; diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 6b922e503..357c672d2 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -16,10 +16,21 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . + * adaptation to Rawtherapee + * 2015 Jacques Desmis + * 2015 Ingo Weyrich + * D. J. Jobson, Z. Rahman, and G. A. Woodell. A multi-scale * Retinex for bridging the gap between color images and the * human observation of scenes. IEEE Transactions on Image Processing, * 1997, 6(7): 965-976 + + * Fan Guo Zixing Cai Bin Xie Jin Tang + * School of Information Science and Engineering, Central South University Changsha, China + + * Weixing Wang and Lian Xu + * College of Physics and Information Engineering, Fuzhou University, Fuzhou, China + * inspired from 2003 Fabien Pelisson */ @@ -187,12 +198,13 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const stddv = (float)sqrt(stddv); } -void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve) +void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { if (deh.enabled) {//enabled StopWatch Stop1("MSR"); float mean, stddv, maxtr, mintr; - float mini, delta, maxi; + // float mini, delta, maxi; + float delta; float eps = 2.f; float gain2 = (float) deh.gain / 100.f; //def =1 not use float offse = (float) deh.offs; //def = 0 not use @@ -426,17 +438,43 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width } float cdfactor = gain2 * 32768.f / delta; + maxCD =-9999999.f; + minCD =9999999.f; + #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel +#endif + { + float cdmax = -999999.f, cdmin = 999999.f; + +#ifdef _OPENMP + #pragma omp for #endif - for ( int i = 0; i < H_L; i ++ ) for (int j = 0; j < W_L; j++) { // float cd = cdfactor * ( luminance[i][j] * logBetaGain - mini ) + offse; float cd = cdfactor * ( luminance[i][j] - mini ) + offse; + if(cd > cdmax) cdmax=cd; + if(cd < cdmin) cdmin=cd; + + luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; } +#ifdef _OPENMP + #pragma omp critical +#endif + { + maxCD = maxCD > cdmax ? maxCD : cdmax; + minCD = minCD < cdmin ? minCD : cdmin; + } + } + // printf("cdmin=%f cdmax=%f\n",minCD, maxCD); + Tmean = mean; + Tsigma = stddv; + Tmin = mintr; + Tmax = maxtr; + } } } diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index c5a72e6dc..4f7d88fd7 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1800,7 +1800,7 @@ void RawImageSource::demosaic(const RAWParams &raw) } } -void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili) +void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { MyTime t4, t5; @@ -1863,7 +1863,7 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams labdeha->b[i - border][j - border] = bb; } - MSR(labdeha->L, labTmp, WNew, HNew, deh, dehatransmissionCurve); + MSR(labdeha->L, labTmp, WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); delete [] labTmpBuffer; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 1fd858a17..d6bd3a6d3 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,7 +152,7 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili); - void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili); + void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); @@ -228,7 +228,7 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve); + void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); // void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 6c727ac87..54d8d010b 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -287,6 +287,14 @@ public : }; +class DehazListener +{ +public : + virtual ~DehazListener() {} + virtual void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) {} + +}; + class AutoColorTonListener { public : @@ -405,6 +413,7 @@ public: virtual void setAutoBWListener (AutoBWListener* l) = 0; virtual void setAutoColorTonListener (AutoColorTonListener* l) = 0; virtual void setAutoChromaListener (AutoChromaListener* l) = 0; + virtual void setDehazListener (DehazListener* l) = 0; virtual void setWaveletListener (WaveletListener* l) = 0; virtual ~StagedImageProcessor () {} diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index f86c1293b..d462b9ecc 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -124,8 +124,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); DehazParams DehaParams = params.dehaz; DehaParams.getCurves(dehatransmissionCurve); - - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili ); + float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } if (pl) { diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc index 4c9d79d47..842e572a9 100644 --- a/rtgui/dehaz.cc +++ b/rtgui/dehaz.cc @@ -11,7 +11,15 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t { CurveListener::setMulti(true); std::vector milestones; - + nextmin =0.; + nextmax =0.; + nextminiT = 0.; + nextmaxiT = 0.; + nextmeanT = 0.; + nextsigma = 0.; + nextminT = 0.; + nextmaxT = 0.; + dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) ); dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP")); dehazFrame->set_border_width(0); @@ -86,7 +94,13 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t dehazVBox->pack_start (*retinex); retinex->show (); + + mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); + mMLabels->set_tooltip_markup (M("TP_DEHAZ_MLABEL_TOOLTIP")); + transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); + transLabels->set_tooltip_markup (M("TP_DEHAZ_TLABEL_TOOLTIP")); + scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 8., 1., 3.)); gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 20, 200, 1, 100));//50 150 offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -10000, 10000, 1, 0)); @@ -102,6 +116,12 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t medianmap->set_active (true); medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::medianmapChanged) ); + RetiVBox->pack_start (*mMLabels); + mMLabels->show (); + + RetiVBox->pack_start (*transLabels); + transLabels->show (); + RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); curveEditorGD->show(); @@ -151,6 +171,77 @@ Dehaz::~Dehaz() delete transmissionCurveEditorG; } +int minmaxChangedUI (void* data) +{ + GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected + (static_cast(data))->minmaxComputed_ (); + return 0; +} + +void Dehaz::minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) +{ + nextmin = cdmin; + nextmax = cdma; + nextminiT = mini; + nextmaxiT = maxi; + nextmeanT = Tmean; + nextsigma = Tsigma; + nextminT = Tmin; + nextmaxT = Tmax; + g_idle_add (minmaxChangedUI, this); + +} + +bool Dehaz::minmaxComputed_ () +{ + + disableListener (); + enableListener (); + updateLabel (); + updateTrans (); + return false; + +} +void Dehaz::updateLabel () +{ + if (!batchMode) { + float nX, nY; + nX = nextmin; + nY = nextmax; + { + mMLabels->set_text( + Glib::ustring::compose(M("TP_DEHAZ_MLABEL"), + Glib::ustring::format(std::fixed, std::setprecision(0), nX), + Glib::ustring::format(std::fixed, std::setprecision(0), nY)) + ); + } + } +} + +void Dehaz::updateTrans () +{ + if (!batchMode) { + float nm, nM, nZ, nA, nB, nS; + nm = nextminiT; + nM = nextmaxiT; + nZ = nextmeanT; + nA = nextminT; + nB = nextmaxT; + nS = nextsigma; + { + transLabels->set_text( + Glib::ustring::compose(M("TP_DEHAZ_TLABEL"), + Glib::ustring::format(std::fixed, std::setprecision(1), nm), + Glib::ustring::format(std::fixed, std::setprecision(1), nM), + Glib::ustring::format(std::fixed, std::setprecision(1), nZ), + Glib::ustring::format(std::fixed, std::setprecision(1), nS), + Glib::ustring::format(std::fixed, std::setprecision(1), nA), + Glib::ustring::format(std::fixed, std::setprecision(1), nB)) + ); + } + } +} + void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) @@ -235,6 +326,8 @@ void Dehaz::retinexUpdateUI () vart->show(); limd->show(); medianmap->show(); + mMLabels->show(); + transLabels->show(); transmissionCurveEditorG->show(); curveEditorGD->show(); dehazFrame->show(); @@ -244,6 +337,8 @@ void Dehaz::retinexUpdateUI () offs->hide(); vart->hide(); limd->hide(); + mMLabels->hide(); + transLabels->hide(); medianmap->hide(); transmissionCurveEditorG->hide(); curveEditorGD->hide(); diff --git a/rtgui/dehaz.h b/rtgui/dehaz.h index 86d6e134a..0f3b2f07e 100644 --- a/rtgui/dehaz.h +++ b/rtgui/dehaz.h @@ -13,8 +13,9 @@ #include "thresholdadjuster.h" #include "colorprovider.h" -class Dehaz : public ToolParamBlock, public FoldableToolPanel, public CurveListener, +class Dehaz : public ToolParamBlock, public FoldableToolPanel, public rtengine::DehazListener, public CurveListener, public AdjusterListener + { protected: @@ -33,7 +34,18 @@ protected: Gtk::CheckButton* retinex; Gtk::Frame* dehazFrame; Gtk::CheckButton* medianmap; - + double nextmin; + double nextmax; + double nextminiT; + double nextmaxiT; + double nextmeanT; + double nextminT; + double nextmaxT; + double nextsigma; + + Gtk::Label* mMLabels; + Gtk::Label* transLabels; + DiagonalCurveEditor* cdshape; CurveEditorGroup* transmissionCurveEditorG; sigc::connection dehazmetConn; @@ -55,6 +67,10 @@ public: void autoOpenCurve (); void retinexChanged (); void medianmapChanged (); + void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax); + bool minmaxComputed_ (); + void updateLabel (); + void updateTrans (); void enabledChanged (); void curveChanged (CurveEditor* ce); diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 3436a9c4d..5d1615e03 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -478,6 +478,7 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool ipc->setAutoColorTonListener (colortoning); ipc->setAutoChromaListener (dirpyrdenoise); ipc->setWaveletListener (wavelet); + ipc->setDehazListener (dehaz); ipc->setSizeListener (crop); ipc->setSizeListener (resize); From d8945607d554866c25efe54c3760c03398ac7d47 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Tue, 8 Sep 2015 09:56:30 +0200 Subject: [PATCH 15/71] astyle modified code on dehaze --- rtengine/colortemp.cc | 2 +- rtengine/dcrop.cc | 5 ++- rtengine/demosaic_algos.cc | 8 ++-- rtengine/improccoordinator.cc | 5 ++- rtengine/improccoordinator.h | 2 +- rtengine/ipdehaz.cc | 82 +++++++++++++++++++---------------- rtgui/dehaz.cc | 18 ++++---- rtgui/dehaz.h | 6 +-- rtgui/labcurve.cc | 15 ++++--- rtgui/labcurve.h | 6 +-- rtgui/options.cc | 2 +- 11 files changed, 81 insertions(+), 70 deletions(-) diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index e22c2fd06..d4f1c995f 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -1794,7 +1794,7 @@ The next 3 methods are inspired from: This program is in the public domain. b) Bruce Lindbloom - Adapted to Rawtherapee by J.Desmis + Adapted to RawTherapee by J.Desmis this values are often called xBar yBar zBar and are characteristics of a color / illuminant diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 58a48abed..523171ba2 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -158,7 +158,7 @@ void Crop::update (int todo) int heiIm = parent->fh; bool needstransform = parent->ipf.needsTransform(); - + if (todo & (M_INIT | M_LINDENOISE)) { MyMutex::MyLock lock(parent->minit); // Also used in improccoord @@ -305,6 +305,7 @@ void Crop::update (int todo) if(parent->adnListener) { parent->adnListener->noiseTilePrev (centerTile_X[poscenterX], centerTile_Y[poscenterY], CenterPreview_X, CenterPreview_Y, crW, trafw * skip); } + // I have tried "blind" some solutions..to move review ...but GUI is not my truc ! // int W,H; // cropgl->cropMoved (centerTile_X[poscenterX],centerTile_Y[poscenterY] , W, H); @@ -807,7 +808,7 @@ void Crop::update (int todo) LUTu dummy; int modedehaz; - // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); + // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); parent->ipf.vibrance (labnCrop); diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 954be456b..aa1b90278 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -1242,7 +1242,7 @@ void RawImageSource::border_interpolate2( int winw, int winh, int lborders) // Joint Demosaicing and Denoising using High Order Interpolation Techniques // Revision 0.9.1a - 09/02/2010 - Contact info: luis.sanz.rodriguez@gmail.com // Copyright Luis Sanz Rodriguez 2010 -// Adapted to RT by Jacques Desmis 3/2013 +// Adapted to RawTherapee by Jacques Desmis 3/2013 void RawImageSource::jdl_interpolate_omp() // from "Lassus" { @@ -1367,7 +1367,7 @@ void RawImageSource::jdl_interpolate_omp() // from "Lassus" // Color demozaicing via directional Linear Minimum Mean Square-error Estimation, // IEEE Trans. on Image Processing, vol. 14, pp. 2167-2178, // Dec. 2005. -// Adapted to RT by Jacques Desmis 3/2013 +// Adapted to RawTherapee by Jacques Desmis 3/2013 // Improved speed and reduced memory consumption by Ingo Weyrich 2/2015 //TODO Tiles to reduce memory consumption SSEFUNCTION void RawImageSource::lmmse_interpolate_omp(int winw, int winh, int iterations) @@ -2041,7 +2041,7 @@ SSEFUNCTION void RawImageSource::lmmse_interpolate_omp(int winw, int winh, int i * Visit for more information. * ***/ -// Adapted to RT by Jacques Desmis 3/2013 +// Adapted to RawTherapee by Jacques Desmis 3/2013 // SSE version by Ingo Weyrich 5/2013 #ifdef __SSE2__ #define CLIPV(a) LIMV(a,zerov,c65535v) @@ -2965,7 +2965,7 @@ void RawImageSource::nodemosaic(bool bw) /* Refinement based on EECI demosaicing algorithm by L. Chang and Y.P. Tan Paul Lee - Adapted for Rawtherapee - Jacques Desmis 04/2013 + Adapted for RawTherapee - Jacques Desmis 04/2013 */ #ifdef __SSE2__ diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index f2ab07155..9e9fa24c8 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -242,11 +242,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) DehaParams.getCurves(dehatransmissionCurve); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Dehaze + if(dehaListener) { - dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } - } + } } // Updating toneCurve.hrenabled if necessary diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 9edefba80..a6d6e044c 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -155,7 +155,7 @@ protected: AutoChromaListener* adnListener; WaveletListener* awavListener; DehazListener* dehaListener; - + HistogramListener* hListener; std::vector sizeListeners; diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 357c672d2..5f85f883a 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . - * adaptation to Rawtherapee + * adaptation to RawTherapee * 2015 Jacques Desmis * 2015 Ingo Weyrich @@ -24,13 +24,13 @@ * Retinex for bridging the gap between color images and the * human observation of scenes. IEEE Transactions on Image Processing, * 1997, 6(7): 965-976 - + * Fan Guo Zixing Cai Bin Xie Jin Tang * School of Information Science and Engineering, Central South University Changsha, China - * Weixing Wang and Lian Xu + * Weixing Wang and Lian Xu * College of Physics and Information Engineering, Fuzhou University, Fuzhou, China - + * inspired from 2003 Fabien Pelisson */ @@ -203,7 +203,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width if (deh.enabled) {//enabled StopWatch Stop1("MSR"); float mean, stddv, maxtr, mintr; - // float mini, delta, maxi; + // float mini, delta, maxi; float delta; float eps = 2.f; float gain2 = (float) deh.gain / 100.f; //def =1 not use @@ -438,43 +438,51 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width } float cdfactor = gain2 * 32768.f / delta; - maxCD =-9999999.f; - minCD =9999999.f; - + maxCD = -9999999.f; + minCD = 9999999.f; + #ifdef _OPENMP - #pragma omp parallel -#endif - { - float cdmax = -999999.f, cdmin = 999999.f; - -#ifdef _OPENMP - #pragma omp for -#endif - for ( int i = 0; i < H_L; i ++ ) - for (int j = 0; j < W_L; j++) { - // float cd = cdfactor * ( luminance[i][j] * logBetaGain - mini ) + offse; - float cd = cdfactor * ( luminance[i][j] - mini ) + offse; - if(cd > cdmax) cdmax=cd; - if(cd < cdmin) cdmin=cd; - - - luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; - } -#ifdef _OPENMP - #pragma omp critical + #pragma omp parallel #endif { - maxCD = maxCD > cdmax ? maxCD : cdmax; - minCD = minCD < cdmin ? minCD : cdmin; + float cdmax = -999999.f, cdmin = 999999.f; + +#ifdef _OPENMP + #pragma omp for +#endif + + for ( int i = 0; i < H_L; i ++ ) + for (int j = 0; j < W_L; j++) { + // float cd = cdfactor * ( luminance[i][j] * logBetaGain - mini ) + offse; + float cd = cdfactor * ( luminance[i][j] - mini ) + offse; + + if(cd > cdmax) { + cdmax = cd; + } + + if(cd < cdmin) { + cdmin = cd; + } + + + luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; + } + +#ifdef _OPENMP + #pragma omp critical +#endif + { + maxCD = maxCD > cdmax ? maxCD : cdmax; + minCD = minCD < cdmin ? minCD : cdmin; + } + } - + // printf("cdmin=%f cdmax=%f\n",minCD, maxCD); + Tmean = mean; + Tsigma = stddv; + Tmin = mintr; + Tmax = maxtr; } - // printf("cdmin=%f cdmax=%f\n",minCD, maxCD); - Tmean = mean; - Tsigma = stddv; - Tmin = mintr; - Tmax = maxtr; - } } } diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc index 842e572a9..8c9f7bbfb 100644 --- a/rtgui/dehaz.cc +++ b/rtgui/dehaz.cc @@ -11,15 +11,15 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t { CurveListener::setMulti(true); std::vector milestones; - nextmin =0.; - nextmax =0.; + nextmin = 0.; + nextmax = 0.; nextminiT = 0.; nextmaxiT = 0.; nextmeanT = 0.; nextsigma = 0.; nextminT = 0.; nextmaxT = 0.; - + dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) ); dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP")); dehazFrame->set_border_width(0); @@ -94,13 +94,13 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t dehazVBox->pack_start (*retinex); retinex->show (); - + mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); mMLabels->set_tooltip_markup (M("TP_DEHAZ_MLABEL_TOOLTIP")); transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); transLabels->set_tooltip_markup (M("TP_DEHAZ_TLABEL_TOOLTIP")); - + scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 8., 1., 3.)); gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 20, 200, 1, 100));//50 150 offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -10000, 10000, 1, 0)); @@ -121,7 +121,7 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t RetiVBox->pack_start (*transLabels); transLabels->show (); - + RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); curveEditorGD->show(); @@ -179,7 +179,7 @@ int minmaxChangedUI (void* data) } void Dehaz::minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) -{ +{ nextmin = cdmin; nextmax = cdma; nextminiT = mini; @@ -189,7 +189,7 @@ void Dehaz::minmaxChanged (double cdma, double cdmin, double mini, double maxi, nextminT = Tmin; nextmaxT = Tmax; g_idle_add (minmaxChangedUI, this); - + } bool Dehaz::minmaxComputed_ () @@ -200,7 +200,7 @@ bool Dehaz::minmaxComputed_ () updateLabel (); updateTrans (); return false; - + } void Dehaz::updateLabel () { diff --git a/rtgui/dehaz.h b/rtgui/dehaz.h index 0f3b2f07e..48007bea8 100644 --- a/rtgui/dehaz.h +++ b/rtgui/dehaz.h @@ -15,7 +15,7 @@ class Dehaz : public ToolParamBlock, public FoldableToolPanel, public rtengine::DehazListener, public CurveListener, public AdjusterListener - + { protected: @@ -42,10 +42,10 @@ protected: double nextminT; double nextmaxT; double nextsigma; - + Gtk::Label* mMLabels; Gtk::Label* transLabels; - + DiagonalCurveEditor* cdshape; CurveEditorGroup* transmissionCurveEditorG; sigc::connection dehazmetConn; diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index 2fb7f250c..fdcbed683 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -215,7 +215,7 @@ LCurve::LCurve () : FoldableToolPanel(this, "labcurves", M("TP_LABCURVE_LABEL")) LCurve::~LCurve () { delete curveEditorG; - + } void LCurve::read (const ProcParams* pp, const ParamsEdited* pedited) @@ -318,7 +318,7 @@ void LCurve::autoOpenCurve () if (!active) { clshape->openIfNonlinear(); } - + } void LCurve::setEditProvider (EditDataProvider *provider) @@ -379,10 +379,10 @@ void LCurve::write (ProcParams* pp, ParamsEdited* pedited) pedited->labCurve.hhcurve = !hhshape->isUnChanged (); pedited->labCurve.lccurve = !lcshape->isUnChanged (); pedited->labCurve.clcurve = !clshape->isUnChanged (); - - + + } - + } void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) @@ -392,6 +392,7 @@ void LCurve::setDefaults (const ProcParams* defParams, const ParamsEdited* pedit contrast->setDefault (defParams->labCurve.contrast); chromaticity->setDefault (defParams->labCurve.chromaticity); rstprotection->setDefault (defParams->labCurve.rstprotection); + if (pedited) { brightness->setDefaultEditedState (pedited->labCurve.brightness ? Edited : UnEdited); contrast->setDefaultEditedState (pedited->labCurve.contrast ? Edited : UnEdited); @@ -506,8 +507,8 @@ void LCurve::curveChanged (CurveEditor* ce) if (ce == clshape) { listener->panelChanged (EvLCLCurve, M("HISTORY_CUSTOMCURVE")); } - - + + } } diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index 765574a67..f41ba29e2 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -81,11 +81,11 @@ public: void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); - - private: + +private: + - }; #endif diff --git a/rtgui/options.cc b/rtgui/options.cc index 5212c6505..44cfca208 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -177,7 +177,7 @@ void Options::updatePaths() if (lastLabCurvesDir.empty() || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { lastLabCurvesDir = preferredPath; } - + if (lastDehazDir.empty() || !safe_file_test (lastDehazDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { lastDehazDir = preferredPath; } From 6cdc6e1fe4c7350908ea98b5ec502c09082f57b3 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 9 Sep 2015 12:22:25 +0200 Subject: [PATCH 16/71] Added experimental hsl mode for DeHaze (with still incomplete gui) --- rtengine/ipdehaz.cc | 27 +++++++++++++++++++-------- rtengine/procevents.h | 2 +- rtengine/procparams.cc | 14 ++++++++++++++ rtengine/procparams.h | 1 + rtengine/rawimagesource.cc | 36 ++++++++++++++++++++++++++++++++++++ rtengine/refreshmap.cc | 3 ++- rtgui/dehaz.cc | 38 ++++++++++++++++++++++++++++++++++++++ rtgui/dehaz.h | 3 +++ rtgui/paramsedited.cc | 6 ++++++ rtgui/paramsedited.h | 1 + 10 files changed, 121 insertions(+), 10 deletions(-) diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index 5f85f883a..a829abe9a 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -206,7 +206,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width // float mini, delta, maxi; float delta; float eps = 2.f; + bool useHsl = deh.dehazcolorspace == "HSL"; float gain2 = (float) deh.gain / 100.f; //def =1 not use + gain2 = useHsl ? gain2 * 0.5f : gain2; float offse = (float) deh.offs; //def = 0 not use int scal = deh.scal; //def=3 int nei = (int) 2.8f * deh.neigh; //def = 220 @@ -214,8 +216,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width float strength = (float) deh.str / 100.f; // Blend with original L channel data float limD = (float) deh.limd; limD = pow(limD, 1.7f);//about 2500 enough + limD *= useHsl ? 10.f : 1.f; float ilimD = 1.f / limD; - int modedehaz = 0; // default to 0 ( deh.dehazmet == "uni" ) bool execcur = false; @@ -281,15 +283,24 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for (int i = 0; i < H_L; i++) { int j = 0; #ifdef __SSE2__ - - for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + if(useHsl) { + for (; j < W_L - 3; j += 4) { + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * (LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + } + } else { + for (; j < W_L - 3; j += 4) { + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + } } - #endif - - for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); + if(useHsl) { + for (; j < W_L; j++) { + luminance[i][j] += pond * (LIM(src[i][j] / out[i][j], ilimD, limD)); + } + } else { + for (; j < W_L; j++) { + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); + } } } } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index c61782da5..98972fd89 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -445,7 +445,7 @@ enum ProcEvent { EvDehazretinex = 416, EvDehazmedianmap = 417, EvLlimd = 418, - + EvdehazColorSpace = 419, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3b40dd949..92d4bf714 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -172,6 +172,7 @@ void DehazParams::setDefaults() getDefaulttransmissionCurve(transmissionCurve); getDefaultCDCurve(cdcurve); dehazmet = "uni"; + dehazcolorspace = "Lab"; retinex = false; medianmap = true; @@ -1493,6 +1494,10 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_string ("Dehaz", "Dehazmet", dehaz.dehazmet); } + if (!pedited || pedited->dehaz.dehazcolorspace) { + keyFile.set_string ("Dehaz", "Dehazcolorspace", dehaz.dehazcolorspace); + } + if (!pedited || pedited->dehaz.cdcurve) { Glib::ArrayHandle cdcurve = dehaz.cdcurve; keyFile.set_double_list("Dehaz", "CDCurve", cdcurve); @@ -3788,6 +3793,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Dehaz", "Dehazcolorspace")) { + dehaz.dehazcolorspace = keyFile.get_string ("Dehaz", "Dehazcolorspace"); + + if (pedited) { + pedited->dehaz.dehazcolorspace = true; + } + } + if (keyFile.has_key ("Dehaz", "Enabled")) { dehaz.enabled = keyFile.get_boolean ("Dehaz", "Enabled"); @@ -7238,6 +7251,7 @@ bool ProcParams::operator== (const ProcParams& other) && dehaz.limd == other.dehaz.limd && dehaz.offs == other.dehaz.offs && dehaz.dehazmet == other.dehaz.dehazmet + && dehaz.dehazcolorspace == other.dehaz.dehazcolorspace && dehaz.vart == other.dehaz.vart && dehaz.medianmap == other.dehaz.medianmap && dehaz.enabled == other.dehaz.enabled diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 1645289a8..d0451d50f 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -277,6 +277,7 @@ public: int gain; int offs; Glib::ustring dehazmet; + Glib::ustring dehazcolorspace; int vart; int limd; bool medianmap; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 4f7d88fd7..114fb537d 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -40,6 +40,7 @@ #include #endif #include "opthelper.h" +#include "Stopwatch.h" namespace rtengine { @@ -1839,6 +1840,26 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams labTmp[i] = &labTmpBuffer[i * WNew]; } + bool useHsl = deh.dehazcolorspace == "HSL"; + if(useHsl) { + for (int i = border; i < H - border; i++ ) + for (int j = border; j < W - border; j++) { + float H,S,L; + //rgb=>lab + Color::rgb2hsl(red[i][j], green[i][j], blue[i][j],H,S,L); + L *= 65535.f; + labTmp[i - border][j - border] = L; + + if(dehacontlutili) { + L = cdcurve[L]; //apply curve to equalize histogram + } + + labdeha->L[i - border][j - border] = L; + labdeha->a[i - border][j - border] = H; + labdeha->b[i - border][j - border] = S; + } + } else { + // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... #ifdef _OPENMP @@ -1862,11 +1883,25 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams labdeha->a[i - border][j - border] = aa; labdeha->b[i - border][j - border] = bb; } + } MSR(labdeha->L, labTmp, WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); delete [] labTmpBuffer; + if(useHsl) { + for (int i = border; i < H - border; i++ ) { + int j = border; + for (; j < W - border; j++) { + float R, G, B; + Color::hsl2rgb(labdeha->a[i - border][j - border],labdeha->b[i - border][j - border],labdeha->L[i - border][j - border]/65535.f,R,G,B); + red[i][j] = R; + green[i][j] = G; + blue[i][j] = B; + } + } + + } else { #ifdef __SSE2__ vfloat wipv[3][3]; @@ -1912,6 +1947,7 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams blue[i][j] = B; } } + } delete labdeha; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index f368b42d4..2bf2e261e 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -440,7 +440,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DEMOSAIC, // EvDehazEnabled DEMOSAIC, // EvDehazretinex DEMOSAIC, // EvDehazmedianmap - DEMOSAIC // EvLlimd + DEMOSAIC, // EvLlimd + DEMOSAIC // Evdehazcolorspace }; diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc index 8c9f7bbfb..509477eed 100644 --- a/rtgui/dehaz.cc +++ b/rtgui/dehaz.cc @@ -44,7 +44,18 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t dehazmet->set_active(0); dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) ); dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); + + dehazcolorspace = Gtk::manage (new MyComboBoxText ()); + dehazcolorspace->append_text (M("TP_DEHAZ_LABSAPCE")); + dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACE")); + dehazcolorspace->set_active(0); + dehazmetConn = dehazcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazColorSpaceChanged) ); + dehazcolorspace->set_tooltip_markup (M("TP_DEHAZ_COLORSPACE_TOOLTIP")); + + + dhbox->pack_start(*dehazmet); + dhbox->pack_start(*dehazcolorspace); dehazVBox->pack_start(*dhbox); std::vector defaultCurve; @@ -266,6 +277,10 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) dehazmet->set_active_text(M("GENERAL_UNCHANGED")); } + if (!pedited->dehaz.dehazcolorspace) { + dehazcolorspace->set_active_text(M("GENERAL_UNCHANGED")); + } + cdshape->setUnChanged (!pedited->dehaz.cdcurve); transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve); @@ -301,6 +316,14 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) } dehazmetChanged (); + + if (pp->dehaz.dehazcolorspace == "Lab") { + dehazcolorspace->set_active (0); + } else if (pp->dehaz.dehazcolorspace == "HSL") { + dehazcolorspace->set_active (1); + } + dehazColorSpaceChanged(); + retinexConn.block(false); retinexChanged (); retinexConn.block(false); @@ -311,6 +334,7 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) cdshape->setCurve (pp->dehaz.cdcurve); dehazmetConn.block(false); + dehazColorSpaceConn.block(false); transmissionShape->setCurve (pp->dehaz.transmissionCurve); @@ -367,6 +391,7 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) if (pedited) { pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->dehaz.dehazcolorspace = dehazcolorspace->get_active_text() != M("GENERAL_UNCHANGED"); //%%%%%%%%%%%%%%%%%%%%%% pedited->dehaz.str = str->getEditedState (); @@ -391,6 +416,12 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) } else if (dehazmet->get_active_row_number() == 2) { pp->dehaz.dehazmet = "high"; } + + if (dehazcolorspace->get_active_row_number() == 0) { + pp->dehaz.dehazcolorspace = "Lab"; + } else if (dehazcolorspace->get_active_row_number() == 1) { + pp->dehaz.dehazcolorspace = "HSL"; + } } void Dehaz::dehazmetChanged() @@ -400,6 +431,13 @@ void Dehaz::dehazmetChanged() } } +void Dehaz::dehazColorSpaceChanged() +{ + if (listener) { + listener->panelChanged (EvdehazColorSpace, dehazcolorspace->get_active_text ()); + } +} + void Dehaz::retinexChanged () { if (batchMode) { diff --git a/rtgui/dehaz.h b/rtgui/dehaz.h index 48007bea8..aed67ba6f 100644 --- a/rtgui/dehaz.h +++ b/rtgui/dehaz.h @@ -31,6 +31,7 @@ protected: Gtk::Label* labmdh; Gtk::HBox* dhbox; MyComboBoxText* dehazmet; + MyComboBoxText* dehazcolorspace; Gtk::CheckButton* retinex; Gtk::Frame* dehazFrame; Gtk::CheckButton* medianmap; @@ -49,6 +50,7 @@ protected: DiagonalCurveEditor* cdshape; CurveEditorGroup* transmissionCurveEditorG; sigc::connection dehazmetConn; + sigc::connection dehazColorSpaceConn; FlatCurveEditor* transmissionShape; bool lastretinex, lastmedianmap; sigc::connection retinexConn, medianmapConn; @@ -75,6 +77,7 @@ public: void enabledChanged (); void curveChanged (CurveEditor* ce); void dehazmetChanged(); + void dehazColorSpaceChanged(); void retinexUpdateUI(); }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index edf449dcc..23439c8e0 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -51,6 +51,7 @@ void ParamsEdited::set (bool v) toneCurve.method = v; dehaz.cdcurve = v; dehaz.dehazmet = v; + dehaz.dehazcolorspace = v; dehaz.enabled = v; dehaz.str = v; dehaz.scal = v; @@ -520,6 +521,7 @@ void ParamsEdited::initFrom (const std::vector dehaz.cdcurve = dehaz.cdcurve && p.dehaz.cdcurve == other.dehaz.cdcurve; dehaz.transmissionCurve = dehaz.transmissionCurve && p.dehaz.transmissionCurve == other.dehaz.transmissionCurve; dehaz.dehazmet = dehaz.dehazmet && p.dehaz.dehazmet == other.dehaz.dehazmet; + dehaz.dehazcolorspace = dehaz.dehazcolorspace && p.dehaz.dehazcolorspace == other.dehaz.dehazcolorspace; dehaz.str = dehaz.str && p.dehaz.str == other.dehaz.str; dehaz.scal = dehaz.scal && p.dehaz.scal == other.dehaz.scal; dehaz.neigh = dehaz.neigh && p.dehaz.neigh == other.dehaz.neigh; @@ -1037,6 +1039,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.dehaz.dehazmet = mods.dehaz.dehazmet; } + if (dehaz.dehazcolorspace) { + toEdit.dehaz.dehazcolorspace = mods.dehaz.dehazcolorspace; + } + if (dehaz.str) { toEdit.dehaz.str = mods.dehaz.str; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index b2a7056d1..25f5750c3 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -65,6 +65,7 @@ public: bool gain; bool offs; bool dehazmet; + bool dehazcolorspace; bool vart; bool limd; bool method; From 528d85b1f9d5a847ac3adc1f7a571743df7f1cbc Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 9 Sep 2015 20:01:27 +0200 Subject: [PATCH 17/71] Dehaz enhancement HSL GUI bugs partialpaste... --- rtdata/languages/default | 11 +++- rtengine/curves.cc | 22 +++++++ rtengine/curves.h | 1 + rtengine/imagesource.h | 2 +- rtengine/improccoordinator.cc | 5 +- rtengine/improccoordinator.h | 1 + rtengine/ipdehaz.cc | 8 +-- rtengine/procevents.h | 1 + rtengine/procparams.cc | 34 +++++++++- rtengine/procparams.h | 2 + rtengine/rawimagesource.cc | 6 +- rtengine/rawimagesource.h | 2 +- rtengine/refreshmap.cc | 3 +- rtengine/simpleprocess.cc | 5 +- rtgui/addsetids.h | 9 ++- rtgui/batchtoolpanelcoord.cc | 30 +++++++++ rtgui/dehaz.cc | 114 +++++++++++++++++++++++++++++----- rtgui/dehaz.h | 11 +++- rtgui/options.cc | 7 +++ rtgui/paramsedited.cc | 22 ++++--- rtgui/paramsedited.h | 1 + rtgui/partialpastedlg.cc | 3 + rtgui/partialpastedlg.h | 3 +- rtgui/preferences.cc | 10 +++ 24 files changed, 273 insertions(+), 40 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ab9d244c4..ee94c17ed 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -643,12 +643,14 @@ HISTORY_MSG_410;Dehaze offset HISTORY_MSG_411;Dehaze strength HISTORY_MSG_412;Dehaze scales HISTORY_MSG_413;Dehaze variance -HISTORY_MSG_414;Dehaze histogram +HISTORY_MSG_414;Dehaze histogram Lab HISTORY_MSG_415;Dehaze transmission HISTORY_MSG_416;Dehaze enabled HISTORY_MSG_417;Dehaze Retinex complete HISTORY_MSG_418;Dehaze transmission median HISTORY_MSG_419;Dehaze threshold +HISTORY_MSG_420;Dehaze Space +HISTORY_MSG_421;Dehaze Histogram HSL HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -800,6 +802,7 @@ PARTIALPASTE_DIRPYREQUALIZER;Contrast by detail levels PARTIALPASTE_DISTORTION;Distortion correction PARTIALPASTE_EPD;Tone mapping PARTIALPASTE_EQUALIZER;Wavelet levels +PARTIALPASTE_DEHAZ;Dehaze PARTIALPASTE_EVERYTHING;Everything PARTIALPASTE_EXIFCHANGES;Exif PARTIALPASTE_EXPOSURE;Exposure @@ -1556,6 +1559,8 @@ TP_DEHAZ_MLABEL;Restored haze-free Min=%1 Max=%2 TP_DEHAZ_MLABEL_TOOLTIP;Should be near of min=0 max=32768\nRestored image with no mixture TP_DEHAZ_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6 TP_DEHAZ_TLABEL_TOOLTIP;Transmission map result\nm=Mini M=Maxi used by Variance\nMe=Mean Si=Sigma\nTm=Min TM=Max of Transmission map +TP_DEHAZ_LABSPACE;L*a*b* +TP_DEHAZ_HSLSPACE;HSL TP_DEHAZ_STR;Strength TP_DEHAZ_STR_TOOLTIP;Mixture in proportion to the original image and that obtained by Retinex algoritm TP_DEHAZ_RETIN;Complete Retinex algoritm @@ -1573,7 +1578,9 @@ TP_DEHAZ_GAIN;Gain TP_DEHAZ_OFFS;Offset TP_DEHAZ_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings\nUsed for black or white pixels, and for better balance the histogram TP_DEHAZE_LAB;Dehaze -TP_DEHAZ_CONTEDIT;Histogram equalizer +TP_DEHAZ_CONTEDIT;Histogram equalizer L*a*b* +TP_DEHAZ_CONTEDITH;Histogram equalizer HSL +TP_DEHAZ_COLORSPACE_TOOLTIP;Choice between L*a*b and HSL\nYou may have to adjust the histogram curve, and adjust other settings differently.\n Prefer restaured Haze-free Min#0 Max#32768 TP_DEHAZ_CURVEEDITOR_CD;L=f(L) TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP;Correct Raw data, to reduce halos and artifacts TP_DEHAZ_TRANSMISSION;Transmission map diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 53dfbcc82..36e777991 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -526,6 +526,28 @@ void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip) +{ + bool needed = false; + DiagonalCurve* dCurve = NULL; + + if (!dehaclcurvePoints.empty() && dehaclcurvePoints[0] != 0) { + dCurve = new DiagonalCurve (dehaclcurvePoints, CURVES_MIN_POLY_POINTS / skip); + + if (dCurve && !dCurve->isIdentity()) { + needed = true; + dehaHcontlutili = true; + } + } + + fillCurveArray(dCurve, dehaclCurve, skip, needed); + + if (dCurve) { + delete dCurve; + dCurve = NULL; + } +} + // add curve Lab wavelet : Cont=f(L) void CurveFactory::curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve, /*LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip) { diff --git a/rtengine/curves.h b/rtengine/curves.h index 192cf89ee..173975838 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -283,6 +283,7 @@ public: static void curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve,/* LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip); static void curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip); + static void curveDehaHContL ( bool & dehaHcontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip); static void curveToningCL ( bool & clctoningutili, const std::vector& clcurvePoints, LUTf & clToningCurve, int skip); static void curveToningLL ( bool & llctoningutili, const std::vector& llcurvePoints, LUTf & llToningCurve, int skip); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index cb8a36f7d..3aa230bb0 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -70,7 +70,7 @@ public: virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; // virtual void // dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; - virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; + virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 9e9fa24c8..f53239ca6 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -47,6 +47,7 @@ ImProcCoordinator::ImProcCoordinator () lhskcurve(65536, 0), clcurve(65536, 0), cdcurve(65536, 0), + cdHcurve(65536, 0), wavclCurve(65536, 0), clToningcurve(65536, 0), cl2Toningcurve(65536, 0), @@ -237,11 +238,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (params.dehaz.enabled) { bool dehacontlutili = false; + bool dehaHcontlutili = false; CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); + CurveFactory::curveDehaHContL (dehaHcontlutili, params.dehaz.cdHcurve, cdHcurve, 1); DehazParams DehaParams = params.dehaz; DehaParams.getCurves(dehatransmissionCurve); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Dehaze + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Dehaze if(dehaListener) { dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index a6d6e044c..452df747a 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -95,6 +95,7 @@ protected: LUTf lhskcurve; LUTf clcurve; LUTf cdcurve; + LUTf cdHcurve; LUTf wavclCurve; LUTf clToningcurve; LUTf cl2Toningcurve; diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index a829abe9a..aa01b2443 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -208,7 +208,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width float eps = 2.f; bool useHsl = deh.dehazcolorspace == "HSL"; float gain2 = (float) deh.gain / 100.f; //def =1 not use - gain2 = useHsl ? gain2 * 0.5f : gain2; + // gain2 = useHsl ? gain2 * 0.5f : gain2; float offse = (float) deh.offs; //def = 0 not use int scal = deh.scal; //def=3 int nei = (int) 2.8f * deh.neigh; //def = 220 @@ -216,7 +216,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width float strength = (float) deh.str / 100.f; // Blend with original L channel data float limD = (float) deh.limd; limD = pow(limD, 1.7f);//about 2500 enough - limD *= useHsl ? 10.f : 1.f; + // limD *= useHsl ? 10.f : 1.f; float ilimD = 1.f / limD; int modedehaz = 0; // default to 0 ( deh.dehazmet == "uni" ) bool execcur = false; @@ -285,7 +285,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width #ifdef __SSE2__ if(useHsl) { for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * (LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); } } else { for (; j < W_L - 3; j += 4) { @@ -295,7 +295,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width #endif if(useHsl) { for (; j < W_L; j++) { - luminance[i][j] += pond * (LIM(src[i][j] / out[i][j], ilimD, limD)); + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); } } else { for (; j < W_L; j++) { diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 98972fd89..9c4552697 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -446,6 +446,7 @@ enum ProcEvent { EvDehazmedianmap = 417, EvLlimd = 418, EvdehazColorSpace = 419, + EvLCDHCurve = 420, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 92d4bf714..a078ba31f 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -159,10 +159,27 @@ void DehazParams::getDefaultCDCurve(std::vector &curve) } } +void DehazParams::getDefaultCDHCurve(std::vector &curve) +{ + double v[6] = { 0.00, 0.00, + 0.5, 0.5, + 1.0, 1.0, + }; + + curve.resize(7); + curve.at(0) = double(DCT_NURBS); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at(i) = v[i - 1]; + } +} + + + void DehazParams::setDefaults() { enabled = false; - str = 60; + str = 30; scal = 3; neigh = 80; gain = 100; @@ -171,6 +188,7 @@ void DehazParams::setDefaults() limd = 8; getDefaulttransmissionCurve(transmissionCurve); getDefaultCDCurve(cdcurve); + getDefaultCDHCurve(cdHcurve); dehazmet = "uni"; dehazcolorspace = "Lab"; retinex = false; @@ -1502,6 +1520,11 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol Glib::ArrayHandle cdcurve = dehaz.cdcurve; keyFile.set_double_list("Dehaz", "CDCurve", cdcurve); } + + if (!pedited || pedited->dehaz.cdHcurve) { + Glib::ArrayHandle cdHcurve = dehaz.cdHcurve; + keyFile.set_double_list("Dehaz", "CDHCurve", cdHcurve); + } if (!pedited || pedited->dehaz.transmissionCurve) { Glib::ArrayHandle transmissionCurve = dehaz.transmissionCurve; @@ -3872,6 +3895,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->dehaz.cdcurve = true; } } + + if (keyFile.has_key ("Dehaz", "CDHCurve")) { + dehaz.cdHcurve = keyFile.get_double_list ("Dehaz", "CDHCurve"); + + if (pedited) { + pedited->dehaz.cdHcurve = true; + } + } if (keyFile.has_key ("Dehaz", "TransmissionCurve")) { dehaz.transmissionCurve = keyFile.get_double_list ("Dehaz", "TransmissionCurve"); @@ -7243,6 +7274,7 @@ bool ProcParams::operator== (const ProcParams& other) && toneCurve.hrenabled == other.toneCurve.hrenabled && toneCurve.method == other.toneCurve.method && dehaz.cdcurve == other.dehaz.cdcurve + && dehaz.cdHcurve == other.dehaz.cdHcurve && dehaz.transmissionCurve == other.dehaz.transmissionCurve && dehaz.str == other.dehaz.str && dehaz.scal == other.dehaz.scal diff --git a/rtengine/procparams.h b/rtengine/procparams.h index d0451d50f..c549aaa19 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -270,6 +270,7 @@ class DehazParams public: bool enabled; std::vector cdcurve; + std::vector cdHcurve; std::vector transmissionCurve; int str; int scal; @@ -288,6 +289,7 @@ public: static void getDefaulttransmissionCurve(std::vector &curve); static void getDefaultCDCurve(std::vector &curve); + static void getDefaultCDHCurve(std::vector &curve); }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 114fb537d..3f9d415c2 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1801,7 +1801,7 @@ void RawImageSource::demosaic(const RAWParams &raw) } } -void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { MyTime t4, t5; @@ -1850,8 +1850,8 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams L *= 65535.f; labTmp[i - border][j - border] = L; - if(dehacontlutili) { - L = cdcurve[L]; //apply curve to equalize histogram + if(dehaHcontlutili) { + L = cdHcurve[L]; //apply curve to equalize histogram } labdeha->L[i - border][j - border] = L; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index d6bd3a6d3..c77fe05a2 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,7 +152,7 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili); - void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 2bf2e261e..aa6de849b 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -441,7 +441,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DEMOSAIC, // EvDehazretinex DEMOSAIC, // EvDehazmedianmap DEMOSAIC, // EvLlimd - DEMOSAIC // Evdehazcolorspace + DEMOSAIC, // Evdehazcolorspace + DEMOSAIC // EvLCDHCurve }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index d462b9ecc..5425bc9fe 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -118,14 +118,17 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if(params.dehaz.enabled) { //enabled Dehaze LUTf cdcurve (65536, 0); + LUTf cdHcurve (65536, 0); DehaztransmissionCurve dehatransmissionCurve; bool dehacontlutili = false; + bool dehaHcontlutili = false; CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); + CurveFactory::curveDehaHContL (dehaHcontlutili, params.dehaz.cdHcurve, cdHcurve, 1); DehazParams DehaParams = params.dehaz; DehaParams.getCurves(dehatransmissionCurve); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, dehatransmissionCurve, dehacontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } if (pl) { diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 8f6ef6685..5d94ef71f 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -107,8 +107,15 @@ #define ADDSET_WA_EDGEDETECTTHR2 99 #define ADDSET_WA_TMRS 100 #define ADDSET_WA_GAMMA 101 +#define ADDSET_DH_STR 102 +#define ADDSET_DH_SCAL 103 +#define ADDSET_DH_NEIGH 104 +#define ADDSET_DH_LIMD 105 +#define ADDSET_DH_GAIN 106 +#define ADDSET_DH_OFFS 107 +#define ADDSET_DH_VART 108 // When adding items, make sure to update ADDSET_PARAM_NUM -#define ADDSET_PARAM_NUM 102 // THIS IS USED AS A DELIMITER!! +#define ADDSET_PARAM_NUM 109 // THIS IS USED AS A DELIMITER!! #endif diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 95f7f3ec7..7e8c79986 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -167,6 +167,7 @@ void BatchToolPanelCoordinator::initSession () blackwhite->setAdjusterBehavior (false, false); colortoning->setAdjusterBehavior (false, false, false, false, false); filmSimulation->setAdjusterBehavior(false); + dehaz->setAdjusterBehavior (false, false, false, false, false, false, false); shadowshighlights->setAdjusterBehavior (false, false, false); dirpyrequalizer->setAdjusterBehavior (false, false, false); @@ -203,6 +204,7 @@ void BatchToolPanelCoordinator::initSession () // colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRPROTECT], options.baBehav[ADDSET_COLORTONING_BALANCE]); colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRENGTH], options.baBehav[ADDSET_COLORTONING_BALANCE]); filmSimulation->setAdjusterBehavior(options.baBehav[ADDSET_FILMSIMULATION_STRENGTH]); + dehaz->setAdjusterBehavior (options.baBehav[ADDSET_DH_STR], options.baBehav[ADDSET_DH_SCAL], options.baBehav[ADDSET_DH_NEIGH], options.baBehav[ADDSET_DH_LIMD], options.baBehav[ADDSET_DH_GAIN], options.baBehav[ADDSET_DH_OFFS], options.baBehav[ADDSET_DH_VART]); chmixer->setAdjusterBehavior (options.baBehav[ADDSET_CHMIXER] ); blackwhite->setAdjusterBehavior (options.baBehav[ADDSET_BLACKWHITE_HUES], options.baBehav[ADDSET_BLACKWHITE_GAMMA]); @@ -575,6 +577,34 @@ void BatchToolPanelCoordinator::initSession () if (options.baBehav[ADDSET_WA_GAMMA]) { pparams.wavelet.gamma = 0; } + + if (options.baBehav[ADDSET_DH_STR]) { + pparams.dehaz.str = 0; + } + + if (options.baBehav[ADDSET_DH_SCAL]) { + pparams.dehaz.scal = 0; + } + + if (options.baBehav[ADDSET_DH_NEIGH]) { + pparams.dehaz.neigh = 0; + } + + if (options.baBehav[ADDSET_DH_LIMD]) { + pparams.dehaz.limd = 0; + } + + if (options.baBehav[ADDSET_DH_GAIN]) { + pparams.dehaz.gain = 0; + } + + if (options.baBehav[ADDSET_DH_OFFS]) { + pparams.dehaz.offs = 0; + } + + if (options.baBehav[ADDSET_DH_VART]) { + pparams.dehaz.vart = 0; + } if (options.baBehav[ADDSET_DIRPYRDN_LUMA]) { diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc index 509477eed..01c11b178 100644 --- a/rtgui/dehaz.cc +++ b/rtgui/dehaz.cc @@ -46,7 +46,7 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); dehazcolorspace = Gtk::manage (new MyComboBoxText ()); - dehazcolorspace->append_text (M("TP_DEHAZ_LABSAPCE")); + dehazcolorspace->append_text (M("TP_DEHAZ_LABSPACE")); dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACE")); dehazcolorspace->set_active(0); dehazmetConn = dehazcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazColorSpaceChanged) ); @@ -74,6 +74,22 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t curveEditorGD->curveListComplete(); + curveEditorGDH = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDITH")); + curveEditorGDH->setCurveListener (this); + rtengine::DehazParams::getDefaultCDHCurve(defaultCurve); + cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD"))); + cdshapeH->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cdshapeH->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP")); + std::vector milestones22H; + + milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshapeH->setBottomBarBgGradient(milestones22H); + cdshapeH->setLeftBarBgGradient(milestones22H); + + curveEditorGDH->curveListComplete(); + + transmissionCurveEditorG = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_TRANSMISSION")); transmissionCurveEditorG->setCurveListener (this); @@ -88,10 +104,13 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t - str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 60.)); + str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 30.)); str->set_tooltip_markup (M("TP_DEHAZ_STR_TOOLTIP")); neigh = Gtk::manage (new Adjuster (M("TP_DEHAZ_NEIGH"), 6, 100., 1., 80.)); + expretinex = new MyExpander (false, M("TP_DEHAZ_RETIN")); + expretinex->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Dehaz::foldAllButMe), expretinex) ); + retinex = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_RETIN"))); retinex->set_active (true); retinexConn = retinex->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::retinexChanged) ); @@ -103,8 +122,8 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t neigh->show (); neigh->set_tooltip_markup (M("TP_DEHAZ_NEIGH_TOOLTIP")); - dehazVBox->pack_start (*retinex); - retinex->show (); +// dehazVBox->pack_start (*retinex); +// retinex->show (); mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); mMLabels->set_tooltip_markup (M("TP_DEHAZ_MLABEL_TOOLTIP")); @@ -136,6 +155,9 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); curveEditorGD->show(); + RetiVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4); + curveEditorGDH->show(); + RetiVBox->pack_start (*scal); scal->show (); @@ -157,6 +179,8 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t RetiVBox->pack_start (*medianmap); medianmap->show (); + expretinex->add(*RetiVBox); + str->setAdjusterListener (this); scal->setAdjusterListener (this); neigh->setAdjusterListener (this); @@ -165,12 +189,14 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t vart->setAdjusterListener (this); limd->setAdjusterListener (this); pack_start (*dehazVBox); - dehazFrame->add(*RetiVBox); - pack_start (*dehazFrame); - dehazFrame->hide(); +// dehazFrame->add(*RetiVBox); +// pack_start (*dehazFrame); +// dehazFrame->hide(); + pack_start (*expretinex); disableListener(); retinexChanged(); + dehazColorSpaceChanged(); medianmapChanged(); enableListener(); @@ -179,9 +205,34 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t Dehaz::~Dehaz() { delete curveEditorGD; + delete curveEditorGDH; delete transmissionCurveEditorG; } + +void Dehaz::foldAllButMe (GdkEventButton* event, MyExpander *expander) +{ + if (event->button == 3) { + expretinex->set_expanded(expretinex == expander); + } +} + +void Dehaz::writeOptions(std::vector &tpOpen) +{ + tpOpen.push_back (expretinex->get_expanded ()); +} + +void Dehaz::updateToolState(std::vector &tpOpen) +{ + if(tpOpen.size() == 9) { + expretinex->set_expanded(tpOpen.at(0)); + } +} + + + + + int minmaxChangedUI (void* data) { GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected @@ -282,6 +333,7 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) } cdshape->setUnChanged (!pedited->dehaz.cdcurve); + cdshapeH->setUnChanged (!pedited->dehaz.cdHcurve); transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve); } @@ -322,7 +374,6 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) } else if (pp->dehaz.dehazcolorspace == "HSL") { dehazcolorspace->set_active (1); } - dehazColorSpaceChanged(); retinexConn.block(false); retinexChanged (); @@ -333,7 +384,10 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) medianmapConn.block(false); cdshape->setCurve (pp->dehaz.cdcurve); + cdshapeH->setCurve (pp->dehaz.cdHcurve); dehazmetConn.block(false); + dehazColorSpaceConn.block(false); + dehazColorSpaceChanged(); dehazColorSpaceConn.block(false); transmissionShape->setCurve (pp->dehaz.transmissionCurve); @@ -354,6 +408,7 @@ void Dehaz::retinexUpdateUI () transLabels->show(); transmissionCurveEditorG->show(); curveEditorGD->show(); + curveEditorGDH->show(); dehazFrame->show(); } else { scal->hide(); @@ -366,6 +421,7 @@ void Dehaz::retinexUpdateUI () medianmap->hide(); transmissionCurveEditorG->hide(); curveEditorGD->hide(); + curveEditorGDH->hide(); dehazFrame->hide(); } } @@ -384,6 +440,7 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) pp->dehaz.vart = (int)vart->getValue (); pp->dehaz.limd = (int)limd->getValue (); pp->dehaz.cdcurve = cdshape->getCurve (); + pp->dehaz.cdHcurve = cdshapeH->getCurve (); pp->dehaz.transmissionCurve = transmissionShape->getCurve (); pp->dehaz.enabled = getEnabled(); pp->dehaz.retinex = retinex->get_active(); @@ -402,6 +459,7 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) pedited->dehaz.vart = vart->getEditedState (); pedited->dehaz.limd = limd->getEditedState (); pedited->dehaz.cdcurve = !cdshape->isUnChanged (); + pedited->dehaz.cdHcurve = !cdshapeH->isUnChanged (); pedited->dehaz.transmissionCurve = !transmissionShape->isUnChanged (); pedited->dehaz.enabled = !get_inconsistent(); pedited->dehaz.retinex = !retinex->get_inconsistent(); @@ -431,8 +489,25 @@ void Dehaz::dehazmetChanged() } } +void Dehaz::ColorSpaceUpdateUI () +{ + if (!batchMode) { + if(dehazcolorspace->get_active_row_number() == 0) { + curveEditorGD->show(); + curveEditorGDH->hide(); + } else if(dehazcolorspace->get_active_row_number() == 1) { + curveEditorGD->hide(); + curveEditorGDH->show(); + } + } +} + + void Dehaz::dehazColorSpaceChanged() { + + ColorSpaceUpdateUI(); + if (listener) { listener->panelChanged (EvdehazColorSpace, dehazcolorspace->get_active_text ()); } @@ -529,12 +604,19 @@ void Dehaz::setDefaults (const ProcParams* defParams, const ParamsEdited* pedite scal->setDefaultEditedState (Irrelevant); } } -/* -void Dehaz::setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd) -{ -} -*/ +void Dehaz::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd) + { + + str->setAddMode(strAdd); + neigh->setAddMode(neighAdd); + scal->setAddMode(scalAdd); + limd->setAddMode(limdAdd); + gain->setAddMode(gainAdd); + offs->setAddMode(offsAdd); + vart->setAddMode(vartAdd); + } + void Dehaz::adjusterChanged (Adjuster* a, double newval) { @@ -556,7 +638,7 @@ void Dehaz::adjusterChanged (Adjuster* a, double newval) } else if (a == vart) { listener->panelChanged (EvLvart, vart->getTextValue()); } else if (a == limd) { - listener->panelChanged (EvLlimd, vart->getTextValue()); + listener->panelChanged (EvLlimd, limd->getTextValue()); } } @@ -566,6 +648,7 @@ void Dehaz::adjusterChanged (Adjuster* a, double newval) void Dehaz::autoOpenCurve () { cdshape->openIfNonlinear(); + cdshapeH->openIfNonlinear(); transmissionShape->openIfNonlinear(); } @@ -576,6 +659,8 @@ void Dehaz::curveChanged (CurveEditor* ce) if (listener && getEnabled()) { if (ce == cdshape) { listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); + } else if (ce == cdshapeH) { + listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE")); } else if (ce == transmissionShape) { listener->panelChanged (EvDehaztransmission, M("HISTORY_CUSTOMCURVE")); } @@ -620,6 +705,7 @@ void Dehaz::setBatchMode (bool batchMode) vart->showEditedCB (); limd->showEditedCB (); curveEditorGD->setBatchMode (batchMode); + curveEditorGDH->setBatchMode (batchMode); transmissionCurveEditorG->setBatchMode (batchMode); diff --git a/rtgui/dehaz.h b/rtgui/dehaz.h index aed67ba6f..13de88b1b 100644 --- a/rtgui/dehaz.h +++ b/rtgui/dehaz.h @@ -20,6 +20,7 @@ class Dehaz : public ToolParamBlock, public FoldableToolPanel, public rtengine: protected: CurveEditorGroup* curveEditorGD; + CurveEditorGroup* curveEditorGDH; Adjuster* str; Adjuster* scal; Adjuster* neigh; @@ -27,6 +28,7 @@ protected: Adjuster* offs; Adjuster* vart; Adjuster* limd; + MyExpander* expretinex; Gtk::Label* labmdh; Gtk::HBox* dhbox; @@ -48,6 +50,7 @@ protected: Gtk::Label* transLabels; DiagonalCurveEditor* cdshape; + DiagonalCurveEditor* cdshapeH; CurveEditorGroup* transmissionCurveEditorG; sigc::connection dehazmetConn; sigc::connection dehazColorSpaceConn; @@ -65,7 +68,6 @@ public: void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = NULL); void trimValues (rtengine::procparams::ProcParams* pp); void adjusterChanged (Adjuster* a, double newval); -// void setAdjusterBehavior (bool splitAdd, bool satThresholdAdd, bool satOpacityAdd, bool strprotectAdd, bool balanceAdd); void autoOpenCurve (); void retinexChanged (); void medianmapChanged (); @@ -79,6 +81,13 @@ public: void dehazmetChanged(); void dehazColorSpaceChanged(); void retinexUpdateUI(); + void ColorSpaceUpdateUI(); + void writeOptions (std::vector &tpOpen); + void updateToolState (std::vector &tpOpen); + void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd); + +private: + void foldAllButMe (GdkEventButton* event, MyExpander *expander); }; diff --git a/rtgui/options.cc b/rtgui/options.cc index 44cfca208..5e0f02e15 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -597,6 +597,13 @@ void Options::setDefaults () 0, //ADDSET_WA_EDGEDETECTTHR2 0, //ADDSET_WA_TMRS 0, //ADDSET_WA_GAMMA + 0, //ADDSET_DH_STR + 0, //ADDSET_DH_SCAL + 0, //ADDSET_DH_NEIGH + 0, //ADDSET_DH_LIMD + 0, //ADDSET_DH_GAIN + 0, //ADDSET_DH_OFFS + 0, //ADDSET_DH_VART }; baBehav = std::vector (babehav, babehav + ADDSET_PARAM_NUM); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 23439c8e0..8d786bb69 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -50,6 +50,7 @@ void ParamsEdited::set (bool v) toneCurve.hrenabled = v; toneCurve.method = v; dehaz.cdcurve = v; + dehaz.cdHcurve = v; dehaz.dehazmet = v; dehaz.dehazcolorspace = v; dehaz.enabled = v; @@ -519,6 +520,7 @@ void ParamsEdited::initFrom (const std::vector toneCurve.hrenabled = toneCurve.hrenabled && p.toneCurve.hrenabled == other.toneCurve.hrenabled; toneCurve.method = toneCurve.method && p.toneCurve.method == other.toneCurve.method; dehaz.cdcurve = dehaz.cdcurve && p.dehaz.cdcurve == other.dehaz.cdcurve; + dehaz.cdHcurve = dehaz.cdHcurve && p.dehaz.cdHcurve == other.dehaz.cdHcurve; dehaz.transmissionCurve = dehaz.transmissionCurve && p.dehaz.transmissionCurve == other.dehaz.transmissionCurve; dehaz.dehazmet = dehaz.dehazmet && p.dehaz.dehazmet == other.dehaz.dehazmet; dehaz.dehazcolorspace = dehaz.dehazcolorspace && p.dehaz.dehazcolorspace == other.dehaz.dehazcolorspace; @@ -1030,6 +1032,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (dehaz.cdcurve) { toEdit.dehaz.cdcurve = mods.dehaz.cdcurve; } + + if (dehaz.cdHcurve) { + toEdit.dehaz.cdHcurve = mods.dehaz.cdHcurve; + } if (dehaz.transmissionCurve) { toEdit.dehaz.transmissionCurve = mods.dehaz.transmissionCurve; @@ -1044,11 +1050,11 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten } if (dehaz.str) { - toEdit.dehaz.str = mods.dehaz.str; + toEdit.dehaz.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.dehaz.str + mods.dehaz.str : mods.dehaz.str; } if (dehaz.scal) { - toEdit.dehaz.scal = mods.dehaz.scal; + toEdit.dehaz.scal = dontforceSet && options.baBehav[ADDSET_DH_SCAL] ? toEdit.dehaz.scal + mods.dehaz.scal : mods.dehaz.scal; } if (dehaz.retinex) { @@ -1060,23 +1066,23 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten } if (dehaz.neigh) { - toEdit.dehaz.neigh = mods.dehaz.neigh; + toEdit.dehaz.neigh = dontforceSet && options.baBehav[ADDSET_DH_NEIGH] ? toEdit.dehaz.neigh + mods.dehaz.neigh : mods.dehaz.neigh; } if (dehaz.limd) { - toEdit.dehaz.limd = mods.dehaz.limd; + toEdit.dehaz.limd = dontforceSet && options.baBehav[ADDSET_DH_LIMD] ? toEdit.dehaz.limd + mods.dehaz.limd : mods.dehaz.limd; } if (dehaz.gain) { - toEdit.dehaz.gain = mods.dehaz.gain; - } + toEdit.dehaz.gain = dontforceSet && options.baBehav[ADDSET_DH_GAIN] ? toEdit.dehaz.gain + mods.dehaz.gain : mods.dehaz.gain; + } if (dehaz.offs) { - toEdit.dehaz.offs = mods.dehaz.offs; + toEdit.dehaz.offs = dontforceSet && options.baBehav[ADDSET_DH_OFFS] ? toEdit.dehaz.offs + mods.dehaz.offs : mods.dehaz.offs; } if (dehaz.vart) { - toEdit.dehaz.vart = mods.dehaz.vart; + toEdit.dehaz.vart = dontforceSet && options.baBehav[ADDSET_DH_VART] ? toEdit.dehaz.vart + mods.dehaz.vart : mods.dehaz.vart; } if (labCurve.lcurve) { diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 25f5750c3..2346965bc 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -71,6 +71,7 @@ public: bool method; bool transmissionCurve; bool cdcurve; + bool cdHcurve; bool retinex; bool medianmap; diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 4fbfe2d93..78dfd6803 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -52,6 +52,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) exposure = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EXPOSURE"))); sh = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_SHADOWSHIGHLIGHTS"))); epd = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EPD"))); + dehaz = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DEHAZ"))); pcvignette = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_PCVIGNETTE"))); gradient = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_GRADIENT"))); labcurve = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LABCURVE"))); @@ -141,6 +142,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) vboxes[0]->pack_start (*exposure, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*sh, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*epd, Gtk::PACK_SHRINK, 2); + vboxes[0]->pack_start (*dehaz, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*pcvignette, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*gradient, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*labcurve, Gtk::PACK_SHRINK, 2); @@ -294,6 +296,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) exposureConn = exposure->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); shConn = sh->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); epdConn = epd->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); + dehazConn = dehaz->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); pcvignetteConn = pcvignette->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); gradientConn = gradient->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); labcurveConn = labcurve->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index 697a9b830..ffa748040 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -46,6 +46,7 @@ public: Gtk::CheckButton* exposure; Gtk::CheckButton* sh; Gtk::CheckButton* epd; + Gtk::CheckButton* dehaz; Gtk::CheckButton* pcvignette; Gtk::CheckButton* gradient; Gtk::CheckButton* labcurve; @@ -123,7 +124,7 @@ public: sigc::connection everythingConn, basicConn, detailConn, colorConn, lensConn, compositionConn, metaConn, rawConn, wavConn; sigc::connection wbConn, exposureConn, shConn, pcvignetteConn, gradientConn, labcurveConn, colorappearanceConn; - sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, defringeConn, epdConn, dirpyreqConn, waveletConn; + sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, defringeConn, epdConn, dirpyreqConn, waveletConn, dehazConn; sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn, chmixerbwConn, colortoningConn, filmSimulationConn; sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn; sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, perspectiveConn, commonTransConn; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 9c0918189..afc5dd6b8 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -170,6 +170,16 @@ Gtk::Widget* Preferences::getBatchProcPanel () appendBehavList (mi, M("TP_EXPOSURE_CONTRAST"), ADDSET_TC_CONTRAST, false); appendBehavList (mi, M("TP_EXPOSURE_SATURATION"), ADDSET_TC_SATURATION, false); + mi = behModel->append (); + mi->set_value (behavColumns.label, M("TP_DEHAZ_LABEL")); + appendBehavList (mi, M("TP_DEHAZ_STR"), ADDSET_DH_STR, false); + appendBehavList (mi, M("TP_DEHAZ_NEIGH"), ADDSET_DH_NEIGH, false); + appendBehavList (mi, M("TP_DEHAZ_SCAL"), ADDSET_DH_SCAL, false); + appendBehavList (mi, M("TP_DEHAZ_GAIN"), ADDSET_DH_GAIN, false); + appendBehavList (mi, M("TP_DEHAZ_OFFS"), ADDSET_DH_OFFS, false); + appendBehavList (mi, M("TP_DEHAZ_LIMD"), ADDSET_DH_LIMD, false); + appendBehavList (mi, M("TP_DEHAZ_VART"), ADDSET_DH_VART, false); + mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_SHADOWSHLIGHTS_LABEL")); appendBehavList (mi, M("TP_SHADOWSHLIGHTS_HIGHLIGHTS"), ADDSET_SH_HIGHLIGHTS, false); From e82c79bd8aa0cf66b3d709ce5cfa8a5e676834ce Mon Sep 17 00:00:00 2001 From: Desmis Date: Thu, 10 Sep 2015 07:11:17 +0200 Subject: [PATCH 18/71] Add linear mode to HSL --- rtdata/languages/default | 3 ++- rtengine/ipdehaz.cc | 13 +++++++------ rtengine/rawimagesource.cc | 11 +++++++---- rtgui/dehaz.cc | 6 +++++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index ee94c17ed..d0c974fe4 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1560,7 +1560,8 @@ TP_DEHAZ_MLABEL_TOOLTIP;Should be near of min=0 max=32768\nRestored image with n TP_DEHAZ_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6 TP_DEHAZ_TLABEL_TOOLTIP;Transmission map result\nm=Mini M=Maxi used by Variance\nMe=Mean Si=Sigma\nTm=Min TM=Max of Transmission map TP_DEHAZ_LABSPACE;L*a*b* -TP_DEHAZ_HSLSPACE;HSL +TP_DEHAZ_HSLSPACE;HSL-Log +TP_DEHAZ_HSLSPACELIN;HSL-Lin TP_DEHAZ_STR;Strength TP_DEHAZ_STR_TOOLTIP;Mixture in proportion to the original image and that obtained by Retinex algoritm TP_DEHAZ_RETIN;Complete Retinex algoritm diff --git a/rtengine/ipdehaz.cc b/rtengine/ipdehaz.cc index aa01b2443..5c0365252 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipdehaz.cc @@ -207,8 +207,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width float delta; float eps = 2.f; bool useHsl = deh.dehazcolorspace == "HSL"; + bool useHslLin = deh.dehazcolorspace == "HSLLIN"; float gain2 = (float) deh.gain / 100.f; //def =1 not use - // gain2 = useHsl ? gain2 * 0.5f : gain2; + gain2 = useHslLin ? gain2 * 0.5f : gain2; float offse = (float) deh.offs; //def = 0 not use int scal = deh.scal; //def=3 int nei = (int) 2.8f * deh.neigh; //def = 220 @@ -216,7 +217,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width float strength = (float) deh.str / 100.f; // Blend with original L channel data float limD = (float) deh.limd; limD = pow(limD, 1.7f);//about 2500 enough - // limD *= useHsl ? 10.f : 1.f; + limD *= useHslLin ? 10.f : 1.f; float ilimD = 1.f / limD; int modedehaz = 0; // default to 0 ( deh.dehazmet == "uni" ) bool execcur = false; @@ -283,9 +284,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for (int i = 0; i < H_L; i++) { int j = 0; #ifdef __SSE2__ - if(useHsl) { + if(useHslLin) { for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * (LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); } } else { for (; j < W_L - 3; j += 4) { @@ -293,9 +294,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width } } #endif - if(useHsl) { + if(useHslLin) { for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); + luminance[i][j] += pond * (LIM(src[i][j] / out[i][j], ilimD, limD)); } } else { for (; j < W_L; j++) { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 3f9d415c2..06214469d 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1841,13 +1841,15 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams } bool useHsl = deh.dehazcolorspace == "HSL"; - if(useHsl) { + bool useHslLin = deh.dehazcolorspace == "HSLLIN"; + if(useHsl || useHslLin) { for (int i = border; i < H - border; i++ ) for (int j = border; j < W - border; j++) { float H,S,L; //rgb=>lab Color::rgb2hsl(red[i][j], green[i][j], blue[i][j],H,S,L); - L *= 65535.f; + // L *= 65535.f; + L *= 32768.f; labTmp[i - border][j - border] = L; if(dehaHcontlutili) { @@ -1889,12 +1891,13 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams delete [] labTmpBuffer; - if(useHsl) { + if(useHsl || useHslLin) { for (int i = border; i < H - border; i++ ) { int j = border; for (; j < W - border; j++) { float R, G, B; - Color::hsl2rgb(labdeha->a[i - border][j - border],labdeha->b[i - border][j - border],labdeha->L[i - border][j - border]/65535.f,R,G,B); + // Color::hsl2rgb(labdeha->a[i - border][j - border],labdeha->b[i - border][j - border],labdeha->L[i - border][j - border]/65535.f,R,G,B); + Color::hsl2rgb(labdeha->a[i - border][j - border],labdeha->b[i - border][j - border],labdeha->L[i - border][j - border]/32768.f,R,G,B); red[i][j] = R; green[i][j] = G; blue[i][j] = B; diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc index 01c11b178..3c3761e83 100644 --- a/rtgui/dehaz.cc +++ b/rtgui/dehaz.cc @@ -48,6 +48,7 @@ Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, t dehazcolorspace = Gtk::manage (new MyComboBoxText ()); dehazcolorspace->append_text (M("TP_DEHAZ_LABSPACE")); dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACE")); + dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACELIN")); dehazcolorspace->set_active(0); dehazmetConn = dehazcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazColorSpaceChanged) ); dehazcolorspace->set_tooltip_markup (M("TP_DEHAZ_COLORSPACE_TOOLTIP")); @@ -373,8 +374,9 @@ void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) dehazcolorspace->set_active (0); } else if (pp->dehaz.dehazcolorspace == "HSL") { dehazcolorspace->set_active (1); + } else if (pp->dehaz.dehazcolorspace == "HSLLIN") { + dehazcolorspace->set_active (2); } - retinexConn.block(false); retinexChanged (); retinexConn.block(false); @@ -479,6 +481,8 @@ void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) pp->dehaz.dehazcolorspace = "Lab"; } else if (dehazcolorspace->get_active_row_number() == 1) { pp->dehaz.dehazcolorspace = "HSL"; + } else if (dehazcolorspace->get_active_row_number() == 2) { + pp->dehaz.dehazcolorspace = "HSLLIN"; } } From 36537532ec827a6f07e9873906ffc17e1961dcb9 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Thu, 10 Sep 2015 11:23:29 +0200 Subject: [PATCH 19/71] Fixed compilation error - StopWatch.h capitalization --- rtengine/rawimagesource.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 06214469d..2d7bed9c2 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -40,7 +40,7 @@ #include #endif #include "opthelper.h" -#include "Stopwatch.h" +#include "StopWatch.h" namespace rtengine { From 5aa6f7861a5502743a5688b92592536ad7331ce5 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Fri, 11 Sep 2015 21:04:29 +0200 Subject: [PATCH 20/71] Dehaze tool renamed to Retinex, GUI fixed, defaults changed --- rtdata/languages/default | 104 ++-- rtengine/CMakeLists.txt | 2 +- rtengine/curves.cc | 8 +- rtengine/curves.h | 6 +- rtengine/dcrop.cc | 2 +- rtengine/imagesource.h | 8 +- rtengine/improccoordinator.cc | 10 +- rtengine/improccoordinator.h | 6 +- rtengine/{ipdehaz.cc => ipretinex.cc} | 32 +- rtengine/procevents.h | 15 +- rtengine/procparams.cc | 229 ++++---- rtengine/procparams.h | 17 +- rtengine/rawimagesource.cc | 10 +- rtengine/rawimagesource.h | 8 +- rtengine/refreshmap.cc | 14 +- rtengine/rtengine.h | 6 +- rtengine/simpleprocess.cc | 12 +- rtgui/CMakeLists.txt | 2 +- rtgui/batchtoolpanelcoord.cc | 18 +- rtgui/dehaz.cc | 716 -------------------------- rtgui/options.cc | 10 +- rtgui/options.h | 2 +- rtgui/paramsedited.cc | 123 +++-- rtgui/paramsedited.h | 8 +- rtgui/partialpastedlg.cc | 6 +- rtgui/partialpastedlg.h | 4 +- rtgui/preferences.cc | 16 +- rtgui/retinex.cc | 622 ++++++++++++++++++++++ rtgui/{dehaz.h => retinex.h} | 34 +- rtgui/toolpanelcoord.cc | 8 +- rtgui/toolpanelcoord.h | 4 +- 31 files changed, 967 insertions(+), 1095 deletions(-) rename rtengine/{ipdehaz.cc => ipretinex.cc} (93%) delete mode 100644 rtgui/dehaz.cc create mode 100644 rtgui/retinex.cc rename rtgui/{dehaz.h => retinex.h} (77%) diff --git a/rtdata/languages/default b/rtdata/languages/default index d0c974fe4..eb220fe35 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -636,21 +636,20 @@ HISTORY_MSG_403;W - ES - Edge sensitivity HISTORY_MSG_404;W - ES - Base amplification HISTORY_MSG_405;W - Denoise - Level 4 HISTORY_MSG_406;W - ES - Neighboring pixels -HISTORY_MSG_407;Dehaze method -HISTORY_MSG_408;Dehaze neighboring -HISTORY_MSG_409;Dehaze gain -HISTORY_MSG_410;Dehaze offset -HISTORY_MSG_411;Dehaze strength -HISTORY_MSG_412;Dehaze scales -HISTORY_MSG_413;Dehaze variance -HISTORY_MSG_414;Dehaze histogram Lab -HISTORY_MSG_415;Dehaze transmission -HISTORY_MSG_416;Dehaze enabled -HISTORY_MSG_417;Dehaze Retinex complete -HISTORY_MSG_418;Dehaze transmission median -HISTORY_MSG_419;Dehaze threshold -HISTORY_MSG_420;Dehaze Space -HISTORY_MSG_421;Dehaze Histogram HSL +HISTORY_MSG_407;Retinex - Method +HISTORY_MSG_408;Retinex - Neighboring +HISTORY_MSG_409;Retinex - Gain +HISTORY_MSG_410;Retinex - Offset +HISTORY_MSG_411;Retinex - Strength +HISTORY_MSG_412;Retinex - Scales +HISTORY_MSG_413;Retinex - Variance +HISTORY_MSG_414;Retinex - Histogram - Lab +HISTORY_MSG_415;Retinex - Transmission +HISTORY_MSG_416;Retinex +HISTORY_MSG_417;Retinex - Transmission median +HISTORY_MSG_418;Retinex - Threshold +HISTORY_MSG_419;Retinex - Color space +HISTORY_MSG_420;Retinex - Histogram - HSL HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -802,7 +801,7 @@ PARTIALPASTE_DIRPYREQUALIZER;Contrast by detail levels PARTIALPASTE_DISTORTION;Distortion correction PARTIALPASTE_EPD;Tone mapping PARTIALPASTE_EQUALIZER;Wavelet levels -PARTIALPASTE_DEHAZ;Dehaze +PARTIALPASTE_RETINEX;Retinex PARTIALPASTE_EVERYTHING;Everything PARTIALPASTE_EXIFCHANGES;Exif PARTIALPASTE_EXPOSURE;Exposure @@ -1555,46 +1554,39 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. -TP_DEHAZ_MLABEL;Restored haze-free Min=%1 Max=%2 -TP_DEHAZ_MLABEL_TOOLTIP;Should be near of min=0 max=32768\nRestored image with no mixture -TP_DEHAZ_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6 -TP_DEHAZ_TLABEL_TOOLTIP;Transmission map result\nm=Mini M=Maxi used by Variance\nMe=Mean Si=Sigma\nTm=Min TM=Max of Transmission map -TP_DEHAZ_LABSPACE;L*a*b* -TP_DEHAZ_HSLSPACE;HSL-Log -TP_DEHAZ_HSLSPACELIN;HSL-Lin -TP_DEHAZ_STR;Strength -TP_DEHAZ_STR_TOOLTIP;Mixture in proportion to the original image and that obtained by Retinex algoritm -TP_DEHAZ_RETIN;Complete Retinex algoritm -TP_DEHAZ_LAB;Retinex -TP_DEHAZ_LAB_TOOLTIP;Use all component of Retinex algorihm, to improve results -TP_DEHAZ_LABEL;Dehaze -TP_DEHAZ_SCAL;Scales -TP_DEHAZ_SCAL_TOOLTIP;Low scales increase contrast but give relief effect\nHigh scales can increase noise, but give more natural images -TP_DEHAZ_LIMD;Threshold -TP_DEHAZ_LIMD_TOOLTIP;Limits in/out - in = image source - out = image Gauss -TP_DEHAZ_MEDI;Transmission median filter -TP_DEHAZ_NEIGH;Neighboring pixels -TP_DEHAZ_NEIGH_TOOLTIP;Take into account, neighboring pixels, by Gauss function -TP_DEHAZ_GAIN;Gain -TP_DEHAZ_OFFS;Offset -TP_DEHAZ_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings\nUsed for black or white pixels, and for better balance the histogram -TP_DEHAZE_LAB;Dehaze -TP_DEHAZ_CONTEDIT;Histogram equalizer L*a*b* -TP_DEHAZ_CONTEDITH;Histogram equalizer HSL -TP_DEHAZ_COLORSPACE_TOOLTIP;Choice between L*a*b and HSL\nYou may have to adjust the histogram curve, and adjust other settings differently.\n Prefer restaured Haze-free Min#0 Max#32768 -TP_DEHAZ_CURVEEDITOR_CD;L=f(L) -TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP;Correct Raw data, to reduce halos and artifacts -TP_DEHAZ_TRANSMISSION;Transmission map -TP_DEHAZ_TRANS_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction -TP_DEHAZE_LAB_TOOLTIP;Use Retinex algorithm (Lab) to improve dehaze..defog... -TP_DEHAZ_VART;Variance -TP_DEHAZ_VART_TOOLTIP;Low variance increase local contrast and saturation, but can leeds to artifacts -TP_DEHAZE_MET;Dehaze method -TP_DEHAZ_MET_TOOLTIP;For Retinex algorithm\nLow :reinforce low light\nUniform :expect to equalize action\nHigh : reinforce high light -TP_DEHAZ_NONE;None -TP_DEHAZ_UNI;Uniform -TP_DEHAZ_LOW;Low -TP_DEHAZ_HIGH;High +TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +TP_RETINEX_CURVEEDITOR_CD;L=f(L) +TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts +TP_RETINEX_GAIN;Gain +TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram. +TP_RETINEX_HIGH;High +TP_RETINEX_HSLSPACE_LIN;HSL-Linear +TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +TP_RETINEX_LABEL;Retinex +TP_RETINEX_LABSPACE;L*a*b* +TP_RETINEX_LOW;Low +TP_RETINEX_MEDIAN;Transmission median filter +TP_RETINEX_METHOD;Method +TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light. +TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +TP_RETINEX_NEIGHBOR;Neighboring pixels +TP_RETINEX_NONE;None +TP_RETINEX_OFFSET;Offset +TP_RETINEX_SCALES;Scales +TP_RETINEX_SCALES_TOOLTIP;Low scales increase contrast but give relief effect.\nHigh scales can increase noise, but give more natural images. +TP_RETINEX_SETTINGS;Settings +TP_RETINEX_STRENGTH;Strength +TP_RETINEX_THRESHOLD;Threshold +TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out - in = image source - out = image Gauss +TP_RETINEX_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6 +TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nm=Mini M=Maxi used by Variance.\nMe=Mean Si=Sigma\nTm=Min TM=Max of transmission map. +TP_RETINEX_TRANSMISSION;Transmission map +TP_RETINEX_TRANSMISSION_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction +TP_RETINEX_UNIFORM;Uniform +TP_RETINEX_VARIANCE;Variance +TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. TP_LENSGEOM_AUTOCROP;Auto-Crop TP_LENSGEOM_FILL;Auto-fill TP_LENSGEOM_LABEL;Lens / Geometry diff --git a/rtengine/CMakeLists.txt b/rtengine/CMakeLists.txt index 05c73abd5..231875f95 100644 --- a/rtengine/CMakeLists.txt +++ b/rtengine/CMakeLists.txt @@ -18,7 +18,7 @@ set (RTENGINESOURCEFILES safegtk.cc colortemp.cc curves.cc flatcurves.cc diagona EdgePreservingDecomposition.cc cplx_wavelet_dec.cc FTblockDN.cc PF_correct_RT.cc previewimage.cc ipwavelet.cc dirpyr_equalizer.cc - calc_distort.cc lcp.cc dcp.cc ipdehaz.cc + calc_distort.cc lcp.cc dcp.cc ipretinex.cc cJSON.c camconst.cc klt/convolve.cc klt/error.cc klt/klt.cc klt/klt_util.cc klt/pnmio.cc klt/pyramid.cc klt/selectGoodFeatures.cc klt/storeFeatures.cc klt/trackFeatures.cc klt/writeFeatures.cc diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 36e777991..d05a9dd12 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -1366,14 +1366,14 @@ void ColorAppearance::Set(Curve *pCurve) } // -DehaztransmissionCurve::DehaztransmissionCurve() {}; +RetinextransmissionCurve::RetinextransmissionCurve() {}; -void DehaztransmissionCurve::Reset() +void RetinextransmissionCurve::Reset() { luttransmission.reset(); } -void DehaztransmissionCurve::Set(const Curve &pCurve) +void RetinextransmissionCurve::Set(const Curve &pCurve) { if (pCurve.isIdentity()) { luttransmission.reset(); // raise this value if the quality suffers from this number of samples @@ -1387,7 +1387,7 @@ void DehaztransmissionCurve::Set(const Curve &pCurve) } } -void DehaztransmissionCurve::Set(const std::vector &curvePoints) +void RetinextransmissionCurve::Set(const std::vector &curvePoints) { if (!curvePoints.empty() && curvePoints[0] > FCT_Linear && curvePoints[0] < FCT_Unchanged) { FlatCurve tcurve(curvePoints, false, CURVES_MIN_POLY_POINTS / 2); diff --git a/rtengine/curves.h b/rtengine/curves.h index 173975838..b85088143 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -430,15 +430,15 @@ public: }; }; -class DehaztransmissionCurve +class RetinextransmissionCurve { private: LUTf luttransmission; // 0xffff range void Set(const Curve &pCurve); public: - virtual ~DehaztransmissionCurve() {}; - DehaztransmissionCurve(); + virtual ~RetinextransmissionCurve() {}; + RetinextransmissionCurve(); void Reset(); void Set(const Curve *pCurve); diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 523171ba2..a97ae7f39 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -807,7 +807,7 @@ void Crop::update (int todo) bool wavcontlutili = parent->wavcontlutili; LUTu dummy; - int modedehaz; + int moderetinex; // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy, dummy, dummy); parent->ipf.vibrance (labnCrop); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 3aa230bb0..98730ac1b 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,14 +69,14 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; -// virtual void // dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; - virtual void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; +// virtual void // retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; + virtual void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; -// virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams lcur) {}; - virtual void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; +// virtual void MSR(LabImage* lab, int width, int height, int skip, RetinexParams lcur) {}; + virtual void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index f53239ca6..6a0933d14 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -236,15 +236,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) highDetailRawComputed = false; } - if (params.dehaz.enabled) { + if (params.retinex.enabled) { bool dehacontlutili = false; bool dehaHcontlutili = false; - CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - CurveFactory::curveDehaHContL (dehaHcontlutili, params.dehaz.cdHcurve, cdHcurve, 1); - DehazParams DehaParams = params.dehaz; + CurveFactory::curveDehaContL (dehacontlutili, params.retinex.cdcurve, cdcurve, 1); + CurveFactory::curveDehaHContL (dehaHcontlutili, params.retinex.cdHcurve, cdHcurve, 1); + RetinexParams DehaParams = params.retinex; DehaParams.getCurves(dehatransmissionCurve); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Dehaze + imgsrc->retinex( params.raw, params.icm, params.retinex, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Retinex if(dehaListener) { dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 452df747a..4ba9bc7c9 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -130,7 +130,7 @@ protected: WavOpacityCurveBY waOpacityCurveBY; WavOpacityCurveW waOpacityCurveW; WavOpacityCurveWL waOpacityCurveWL; - DehaztransmissionCurve dehatransmissionCurve; + RetinextransmissionCurve dehatransmissionCurve; ColorAppearance customColCurve1; ColorAppearance customColCurve2; @@ -155,7 +155,7 @@ protected: AutoColorTonListener* actListener; AutoChromaListener* adnListener; WaveletListener* awavListener; - DehazListener* dehaListener; + RetinexListener* dehaListener; HistogramListener* hListener; std::vector sizeListeners; @@ -301,7 +301,7 @@ public: { adnListener = adn; } - void setDehazListener (DehazListener* adh) + void setRetinexListener (RetinexListener* adh) { dehaListener = adh; } diff --git a/rtengine/ipdehaz.cc b/rtengine/ipretinex.cc similarity index 93% rename from rtengine/ipdehaz.cc rename to rtengine/ipretinex.cc index 5c0365252..5a3b87213 100644 --- a/rtengine/ipdehaz.cc +++ b/rtengine/ipretinex.cc @@ -45,8 +45,8 @@ #include "improcfun.h" #include "opthelper.h" #include "StopWatch.h" -#define MAX_DEHAZE_SCALES 8 -#define clipdehaz( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) +#define MAX_RETINEX_SCALES 8 +#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) #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; \ @@ -63,9 +63,9 @@ namespace rtengine extern const Settings* settings; -static float DehazeScales[MAX_DEHAZE_SCALES]; +static float RetinexScales[MAX_RETINEX_SCALES]; -void dehaze_scales( float* scales, int nscales, int mode, int s) +void retinex_scales( float* scales, int nscales, int mode, int s) { if ( nscales == 1 ) { scales[0] = (float)s / 2.f; @@ -198,7 +198,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const stddv = (float)sqrt(stddv); } -void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { if (deh.enabled) {//enabled StopWatch Stop1("MSR"); @@ -206,8 +206,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width // float mini, delta, maxi; float delta; float eps = 2.f; - bool useHsl = deh.dehazcolorspace == "HSL"; - bool useHslLin = deh.dehazcolorspace == "HSLLIN"; + bool useHsl = deh.retinexcolorspace == "HSLLOG"; + bool useHslLin = deh.retinexcolorspace == "HSLLIN"; float gain2 = (float) deh.gain / 100.f; //def =1 not use gain2 = useHslLin ? gain2 * 0.5f : gain2; float offse = (float) deh.offs; //def = 0 not use @@ -219,18 +219,18 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width limD = pow(limD, 1.7f);//about 2500 enough limD *= useHslLin ? 10.f : 1.f; float ilimD = 1.f / limD; - int modedehaz = 0; // default to 0 ( deh.dehazmet == "uni" ) + int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) bool execcur = false; - if (deh.dehazmet == "low") { - modedehaz = 1; + if (deh.retinexMethod == "uni") { + moderetinex = 0; } - if (deh.dehazmet == "high") { - modedehaz = 2; + if (deh.retinexMethod == "low") { + moderetinex = 1; } - dehaze_scales( DehazeScales, scal, modedehaz, nei ); + retinex_scales( RetinexScales, scal, moderetinex, nei ); int H_L = height; int W_L = width; @@ -268,8 +268,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); for ( int scale = 0; scale < scal; scale++ ) { - gaussHorizontal (src, out, *pBuffer, W_L, H_L, DehazeScales[scale]); - gaussVertical (out, out, *pBuffer, W_L, H_L, DehazeScales[scale]); + gaussHorizontal (src, out, *pBuffer, W_L, H_L, RetinexScales[scale]); + gaussVertical (out, out, *pBuffer, W_L, H_L, RetinexScales[scale]); #ifdef __SSE2__ vfloat pondv = F2V(pond); @@ -477,7 +477,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width } - luminance[i][j] = clipdehaz( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; + luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; } #ifdef _OPENMP diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 9c4552697..c71e8d9f1 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -432,7 +432,7 @@ enum ProcEvent { EvWavedgeampli = 403, EvWavlev3nois = 404, EvWavNPmet = 405, - Evdehazmet = 406, + EvretinexMethod = 406, EvLneigh = 407, EvLgain = 408, EvLoffs = 409, @@ -440,13 +440,12 @@ enum ProcEvent { EvLscal = 411, EvLvart = 412, EvLCDCurve = 413, - EvDehaztransmission = 414, - EvDehazEnabled = 415, - EvDehazretinex = 416, - EvDehazmedianmap = 417, - EvLlimd = 418, - EvdehazColorSpace = 419, - EvLCDHCurve = 420, + EvRetinextransmission = 414, + EvRetinexEnabled = 415, + EvRetinexmedianmap = 416, + EvLlimd = 417, + EvretinexColorSpace = 406, //change to 418 if we want a separate history entry "Retinex - Color space" + EvLCDHCurve = 419, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index a078ba31f..0c9aef7d2 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -116,12 +116,12 @@ void CropParams::mapToResized(int resizedWidth, int resizedHeight, int scale, in } } -DehazParams::DehazParams () +RetinexParams::RetinexParams () { setDefaults (); } -void DehazParams::getDefaulttransmissionCurve(std::vector &curve) +void RetinexParams::getDefaulttransmissionCurve(std::vector &curve) { /* double v[8] = { 0.0, 0.50, 0.35, 0.35, 1.0, 0.50, 0.35, 0.35, @@ -141,17 +141,16 @@ void DehazParams::getDefaulttransmissionCurve(std::vector &curve) } } -void DehazParams::getDefaultCDCurve(std::vector &curve) +void RetinexParams::getDefaultCDCurve(std::vector &curve) { - double v[12] = { 0.00, 0.00, - 0.185, 0., - 0.235, 0.25, + double v[10] = { 0., 0., + 0.25, 0.25, 0.5, 0.5, - 0.8, 0.8, - 1.0, 1.0, + 0.75, 0.75, + 1., 1., }; - curve.resize(13); + curve.resize(11); curve.at(0) = double(DCT_NURBS); for (size_t i = 1; i < curve.size(); ++i) { @@ -159,7 +158,7 @@ void DehazParams::getDefaultCDCurve(std::vector &curve) } } -void DehazParams::getDefaultCDHCurve(std::vector &curve) +void RetinexParams::getDefaultCDHCurve(std::vector &curve) { double v[6] = { 0.00, 0.00, 0.5, 0.5, @@ -176,27 +175,26 @@ void DehazParams::getDefaultCDHCurve(std::vector &curve) -void DehazParams::setDefaults() +void RetinexParams::setDefaults() { enabled = false; - str = 30; + str = 20; scal = 3; neigh = 80; - gain = 100; + gain = 50; offs = 0; vart = 125; limd = 8; getDefaulttransmissionCurve(transmissionCurve); getDefaultCDCurve(cdcurve); getDefaultCDHCurve(cdHcurve); - dehazmet = "uni"; - dehazcolorspace = "Lab"; - retinex = false; + retinexMethod = "high"; + retinexcolorspace = "Lab"; medianmap = true; } -void DehazParams::getCurves(DehaztransmissionCurve &transmissionCurveLUT) const +void RetinexParams::getCurves(RetinextransmissionCurve &transmissionCurveLUT) const { transmissionCurveLUT.Set(this->transmissionCurve); } @@ -1464,71 +1462,67 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_double_list("Exposure", "Curve2", tcurve); } - //save dehaz + //save retinex - if (!pedited || pedited->dehaz.str) { - keyFile.set_integer ("Dehaz", "Str", dehaz.str); + if (!pedited || pedited->retinex.str) { + keyFile.set_integer ("Retinex", "Str", retinex.str); } - if (!pedited || pedited->dehaz.scal) { - keyFile.set_integer ("Dehaz", "Scal", dehaz.scal); + if (!pedited || pedited->retinex.scal) { + keyFile.set_integer ("Retinex", "Scal", retinex.scal); } - if (!pedited || pedited->dehaz.enabled) { - keyFile.set_boolean ("Dehaz", "Enabled", dehaz.enabled); + if (!pedited || pedited->retinex.enabled) { + keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled); } - if (!pedited || pedited->dehaz.retinex) { - keyFile.set_boolean ("Dehaz", "Retinex", dehaz.retinex); - } - - if (!pedited || pedited->dehaz.medianmap) { - keyFile.set_boolean ("Dehaz", "Median", dehaz.medianmap); + if (!pedited || pedited->retinex.medianmap) { + keyFile.set_boolean ("Retinex", "Median", retinex.medianmap); } - if (!pedited || pedited->dehaz.neigh) { - keyFile.set_integer ("Dehaz", "Neigh", dehaz.neigh); + if (!pedited || pedited->retinex.neigh) { + keyFile.set_integer ("Retinex", "Neigh", retinex.neigh); } - if (!pedited || pedited->dehaz.gain) { - keyFile.set_integer ("Dehaz", "Gain", dehaz.gain); + if (!pedited || pedited->retinex.gain) { + keyFile.set_integer ("Retinex", "Gain", retinex.gain); } - if (!pedited || pedited->dehaz.offs) { - keyFile.set_integer ("Dehaz", "Offs", dehaz.offs); + if (!pedited || pedited->retinex.offs) { + keyFile.set_integer ("Retinex", "Offs", retinex.offs); } - if (!pedited || pedited->dehaz.vart) { - keyFile.set_integer ("Dehaz", "Vart", dehaz.vart); + if (!pedited || pedited->retinex.vart) { + keyFile.set_integer ("Retinex", "Vart", retinex.vart); } - if (!pedited || pedited->dehaz.limd) { - keyFile.set_integer ("Dehaz", "Limd", dehaz.limd); + if (!pedited || pedited->retinex.limd) { + keyFile.set_integer ("Retinex", "Limd", retinex.limd); } - if (!pedited || pedited->dehaz.dehazmet) { - keyFile.set_string ("Dehaz", "Dehazmet", dehaz.dehazmet); + if (!pedited || pedited->retinex.retinexMethod) { + keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod); } - if (!pedited || pedited->dehaz.dehazcolorspace) { - keyFile.set_string ("Dehaz", "Dehazcolorspace", dehaz.dehazcolorspace); + if (!pedited || pedited->retinex.retinexcolorspace) { + keyFile.set_string ("Retinex", "Retinexcolorspace", retinex.retinexcolorspace); } - if (!pedited || pedited->dehaz.cdcurve) { - Glib::ArrayHandle cdcurve = dehaz.cdcurve; - keyFile.set_double_list("Dehaz", "CDCurve", cdcurve); - } - - if (!pedited || pedited->dehaz.cdHcurve) { - Glib::ArrayHandle cdHcurve = dehaz.cdHcurve; - keyFile.set_double_list("Dehaz", "CDHCurve", cdHcurve); + if (!pedited || pedited->retinex.cdcurve) { + Glib::ArrayHandle cdcurve = retinex.cdcurve; + keyFile.set_double_list("Retinex", "CDCurve", cdcurve); } - if (!pedited || pedited->dehaz.transmissionCurve) { - Glib::ArrayHandle transmissionCurve = dehaz.transmissionCurve; - keyFile.set_double_list("Dehaz", "TransmissionCurve", transmissionCurve); + if (!pedited || pedited->retinex.cdHcurve) { + Glib::ArrayHandle cdHcurve = retinex.cdHcurve; + keyFile.set_double_list("Retinex", "CDHCurve", cdHcurve); + } + + if (!pedited || pedited->retinex.transmissionCurve) { + Glib::ArrayHandle transmissionCurve = retinex.transmissionCurve; + keyFile.set_double_list("Retinex", "TransmissionCurve", transmissionCurve); } // save channel mixer @@ -3789,126 +3783,118 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } - //load dehaz - if (keyFile.has_group ("Dehaz")) { + //load retinex + if (keyFile.has_group ("Retinex")) { - if (keyFile.has_key ("Dehaz", "Retinex")) { - dehaz.retinex = keyFile.get_boolean ("Dehaz", "Retinex"); + if (keyFile.has_key ("Retinex", "Median")) { + retinex.medianmap = keyFile.get_boolean ("Retinex", "Median"); if (pedited) { - pedited->dehaz.retinex = true; + pedited->retinex.medianmap = true; } } - if (keyFile.has_key ("Dehaz", "Median")) { - dehaz.medianmap = keyFile.get_boolean ("Dehaz", "Median"); + if (keyFile.has_key ("Retinex", "Retinexmet")) { + retinex.retinexMethod = keyFile.get_string ("Retinex", "Retinexmet"); if (pedited) { - pedited->dehaz.medianmap = true; + pedited->retinex.retinexMethod = true; } } - if (keyFile.has_key ("Dehaz", "Dehazmet")) { - dehaz.dehazmet = keyFile.get_string ("Dehaz", "Dehazmet"); + if (keyFile.has_key ("Retinex", "Retinexcolorspace")) { + retinex.retinexcolorspace = keyFile.get_string ("Retinex", "Retinexcolorspace"); if (pedited) { - pedited->dehaz.dehazmet = true; + pedited->retinex.retinexcolorspace = true; } } - if (keyFile.has_key ("Dehaz", "Dehazcolorspace")) { - dehaz.dehazcolorspace = keyFile.get_string ("Dehaz", "Dehazcolorspace"); + if (keyFile.has_key ("Retinex", "Enabled")) { + retinex.enabled = keyFile.get_boolean ("Retinex", "Enabled"); if (pedited) { - pedited->dehaz.dehazcolorspace = true; + pedited->retinex.enabled = true; } } - if (keyFile.has_key ("Dehaz", "Enabled")) { - dehaz.enabled = keyFile.get_boolean ("Dehaz", "Enabled"); + if (keyFile.has_key ("Retinex", "Neigh")) { + retinex.neigh = keyFile.get_integer ("Retinex", "Neigh"); if (pedited) { - pedited->dehaz.enabled = true; + pedited->retinex.neigh = true; } } - if (keyFile.has_key ("Dehaz", "Neigh")) { - dehaz.neigh = keyFile.get_integer ("Dehaz", "Neigh"); + if (keyFile.has_key ("Retinex", "Str")) { + retinex.str = keyFile.get_integer ("Retinex", "Str"); if (pedited) { - pedited->dehaz.neigh = true; + pedited->retinex.str = true; } } - if (keyFile.has_key ("Dehaz", "Str")) { - dehaz.str = keyFile.get_integer ("Dehaz", "Str"); + if (keyFile.has_key ("Retinex", "Scal")) { + retinex.scal = keyFile.get_integer ("Retinex", "Scal"); if (pedited) { - pedited->dehaz.str = true; + pedited->retinex.scal = true; } } - if (keyFile.has_key ("Dehaz", "Scal")) { - dehaz.scal = keyFile.get_integer ("Dehaz", "Scal"); + if (keyFile.has_key ("Retinex", "Gain")) { + retinex.gain = keyFile.get_integer ("Retinex", "Gain"); if (pedited) { - pedited->dehaz.scal = true; + pedited->retinex.gain = true; } } - if (keyFile.has_key ("Dehaz", "Gain")) { - dehaz.gain = keyFile.get_integer ("Dehaz", "Gain"); + if (keyFile.has_key ("Retinex", "Offs")) { + retinex.offs = keyFile.get_integer ("Retinex", "Offs"); if (pedited) { - pedited->dehaz.gain = true; + pedited->retinex.offs = true; } } - if (keyFile.has_key ("Dehaz", "Offs")) { - dehaz.offs = keyFile.get_integer ("Dehaz", "Offs"); + if (keyFile.has_key ("Retinex", "Vart")) { + retinex.vart = keyFile.get_integer ("Retinex", "Vart"); if (pedited) { - pedited->dehaz.offs = true; + pedited->retinex.vart = true; } } - if (keyFile.has_key ("Dehaz", "Vart")) { - dehaz.vart = keyFile.get_integer ("Dehaz", "Vart"); + if (keyFile.has_key ("Retinex", "Limd")) { + retinex.limd = keyFile.get_integer ("Retinex", "Limd"); if (pedited) { - pedited->dehaz.vart = true; + pedited->retinex.limd = true; } } - if (keyFile.has_key ("Dehaz", "Limd")) { - dehaz.limd = keyFile.get_integer ("Dehaz", "Limd"); + if (keyFile.has_key ("Retinex", "CDCurve")) { + retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve"); if (pedited) { - pedited->dehaz.limd = true; + pedited->retinex.cdcurve = true; } } - if (keyFile.has_key ("Dehaz", "CDCurve")) { - dehaz.cdcurve = keyFile.get_double_list ("Dehaz", "CDCurve"); + if (keyFile.has_key ("Retinex", "CDHCurve")) { + retinex.cdHcurve = keyFile.get_double_list ("Retinex", "CDHCurve"); if (pedited) { - pedited->dehaz.cdcurve = true; - } - } - - if (keyFile.has_key ("Dehaz", "CDHCurve")) { - dehaz.cdHcurve = keyFile.get_double_list ("Dehaz", "CDHCurve"); - - if (pedited) { - pedited->dehaz.cdHcurve = true; + pedited->retinex.cdHcurve = true; } } - if (keyFile.has_key ("Dehaz", "TransmissionCurve")) { - dehaz.transmissionCurve = keyFile.get_double_list ("Dehaz", "TransmissionCurve"); + if (keyFile.has_key ("Retinex", "TransmissionCurve")) { + retinex.transmissionCurve = keyFile.get_double_list ("Retinex", "TransmissionCurve"); if (pedited) { - pedited->dehaz.transmissionCurve = true; + pedited->retinex.transmissionCurve = true; } } } @@ -7273,21 +7259,20 @@ bool ProcParams::operator== (const ProcParams& other) && toneCurve.curveMode2 == other.toneCurve.curveMode2 && toneCurve.hrenabled == other.toneCurve.hrenabled && toneCurve.method == other.toneCurve.method - && dehaz.cdcurve == other.dehaz.cdcurve - && dehaz.cdHcurve == other.dehaz.cdHcurve - && dehaz.transmissionCurve == other.dehaz.transmissionCurve - && dehaz.str == other.dehaz.str - && dehaz.scal == other.dehaz.scal - && dehaz.neigh == other.dehaz.neigh - && dehaz.gain == other.dehaz.gain - && dehaz.limd == other.dehaz.limd - && dehaz.offs == other.dehaz.offs - && dehaz.dehazmet == other.dehaz.dehazmet - && dehaz.dehazcolorspace == other.dehaz.dehazcolorspace - && dehaz.vart == other.dehaz.vart - && dehaz.medianmap == other.dehaz.medianmap - && dehaz.enabled == other.dehaz.enabled - && dehaz.retinex == other.dehaz.retinex + && retinex.cdcurve == other.retinex.cdcurve + && retinex.cdHcurve == other.retinex.cdHcurve + && retinex.transmissionCurve == other.retinex.transmissionCurve + && retinex.str == other.retinex.str + && retinex.scal == other.retinex.scal + && retinex.neigh == other.retinex.neigh + && retinex.gain == other.retinex.gain + && retinex.limd == other.retinex.limd + && retinex.offs == other.retinex.offs + && retinex.retinexMethod == other.retinex.retinexMethod + && retinex.retinexcolorspace == other.retinex.retinexcolorspace + && retinex.vart == other.retinex.vart + && retinex.medianmap == other.retinex.medianmap + && retinex.enabled == other.retinex.enabled && labCurve.lcurve == other.labCurve.lcurve && labCurve.acurve == other.labCurve.acurve && labCurve.bcurve == other.labCurve.bcurve diff --git a/rtengine/procparams.h b/rtengine/procparams.h index c549aaa19..91dfbf7bc 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -39,7 +39,7 @@ class WavOpacityCurveRG; class WavOpacityCurveBY; class WavOpacityCurveW; class WavOpacityCurveWL; -class DehaztransmissionCurve; +class RetinextransmissionCurve; namespace procparams { @@ -262,9 +262,9 @@ public: static bool HLReconstructionNecessary(LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw); }; /** - * Parameters of Dehaz + * Parameters of Retinex */ -class DehazParams +class RetinexParams { public: @@ -277,15 +277,14 @@ public: int neigh; int gain; int offs; - Glib::ustring dehazmet; - Glib::ustring dehazcolorspace; + Glib::ustring retinexMethod; + Glib::ustring retinexcolorspace; int vart; int limd; bool medianmap; - bool retinex; - DehazParams (); + RetinexParams (); void setDefaults(); - void getCurves(DehaztransmissionCurve &transmissionCurveLUT) const; + void getCurves(RetinextransmissionCurve &transmissionCurveLUT) const; static void getDefaulttransmissionCurve(std::vector &curve); static void getDefaultCDCurve(std::vector &curve); @@ -1220,7 +1219,7 @@ class ProcParams public: ToneCurveParams toneCurve; ///< Tone curve parameters LCurveParams labCurve; ///< CIELAB luminance curve parameters - DehazParams dehaz; ///< Dehaz parameters + RetinexParams retinex; ///< Retinex parameters RGBCurvesParams rgbCurves; ///< RGB curves parameters ColorToningParams colorToning; ///< Color Toning parameters SharpeningParams sharpening; ///< Sharpening parameters diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 2d7bed9c2..e6664dc06 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1801,14 +1801,14 @@ void RawImageSource::demosaic(const RAWParams &raw) } } -void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { MyTime t4, t5; t4.set(); if (settings->verbose) { - printf ("Applying DeHaze\n"); + printf ("Applying Retinex\n"); } TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); @@ -1840,8 +1840,8 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams labTmp[i] = &labTmpBuffer[i * WNew]; } - bool useHsl = deh.dehazcolorspace == "HSL"; - bool useHslLin = deh.dehazcolorspace == "HSLLIN"; + bool useHsl = deh.retinexcolorspace == "HSLLOG"; + bool useHslLin = deh.retinexcolorspace == "HSLLIN"; if(useHsl || useHslLin) { for (int i = border; i < H - border; i++ ) for (int j = border; j < W - border; j++) { @@ -1957,7 +1957,7 @@ void RawImageSource::dehaz(RAWParams raw, ColorManagementParams cmp, DehazParams t5.set(); if( settings->verbose ) { - printf("Dehaz=%d usec\n", t5.etime(t4)); + printf("Retinex=%d usec\n", t5.etime(t4)); } } diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index c77fe05a2..5cb0c74a5 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -151,8 +151,8 @@ public: int load (Glib::ustring fname, bool batch = false); void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); -// void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams lcur, LUTf & cdcurve, bool dehacontlutili); - void dehaz (RAWParams raw, ColorManagementParams cmp, DehazParams deh, LUTf & cdcurve, LUTf & cdHcurve, const DehaztransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); +// void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili); + void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); @@ -228,8 +228,8 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(float** luminance, float **originalLuminance, int width, int height, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); -// void MSR(LabImage* lab, int width, int height, int skip, DehazParams deh, const DehaztransmissionCurve & dehatransmissionCurve); + void MSR(float** luminance, float **originalLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); +// void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], // multi_array2D & hfsize, multi_array2D & hilite, int box ); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index aa6de849b..0c4f9bf1d 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -102,7 +102,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { RESIZE, // EvResizeHeight RESIZE, // EvResizeEnabled ALL, // EvProfileChangeNotification - RETINEX, // EvShrHighQuality +// RETINEX, // EvShrHighQuality TRANSFORM, // EvPerspCorr DARKFRAME, // EvLCPFile RGBCURVE, // EvRGBrCurveLumamode @@ -428,7 +428,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavedgeampli DIRPYREQUALIZER, //EvWavlev3nois DIRPYREQUALIZER, //EvWavNPmet - DEMOSAIC, // Evdehazmet + DEMOSAIC, // EvretinexMethod DEMOSAIC, // EvLneigh DEMOSAIC, // EvLgain DEMOSAIC, // EvLoffs @@ -436,12 +436,12 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DEMOSAIC, // EvLscal DEMOSAIC, // EvLvart DEMOSAIC, // EvLCDCurve - DEMOSAIC, // EvDehazOpacity - DEMOSAIC, // EvDehazEnabled - DEMOSAIC, // EvDehazretinex - DEMOSAIC, // EvDehazmedianmap + DEMOSAIC, // EvRetinexOpacity + DEMOSAIC, // EvRetinexEnabled + DEMOSAIC, // EvRetinexretinex <-- TODO we can probably delete this + DEMOSAIC, // EvRetinexmedianmap DEMOSAIC, // EvLlimd - DEMOSAIC, // Evdehazcolorspace + DEMOSAIC, // Evretinexcolorspace DEMOSAIC // EvLCDHCurve diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index 54d8d010b..f15778421 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -287,10 +287,10 @@ public : }; -class DehazListener +class RetinexListener { public : - virtual ~DehazListener() {} + virtual ~RetinexListener() {} virtual void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) {} }; @@ -413,7 +413,7 @@ public: virtual void setAutoBWListener (AutoBWListener* l) = 0; virtual void setAutoColorTonListener (AutoColorTonListener* l) = 0; virtual void setAutoChromaListener (AutoChromaListener* l) = 0; - virtual void setDehazListener (DehazListener* l) = 0; + virtual void setRetinexListener (RetinexListener* l) = 0; virtual void setWaveletListener (WaveletListener* l) = 0; virtual ~StagedImageProcessor () {} diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 5425bc9fe..a3f18f770 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -116,19 +116,19 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p pl->setProgress (0.30); } - if(params.dehaz.enabled) { //enabled Dehaze + if(params.retinex.enabled) { //enabled Retinex LUTf cdcurve (65536, 0); LUTf cdHcurve (65536, 0); - DehaztransmissionCurve dehatransmissionCurve; + RetinextransmissionCurve dehatransmissionCurve; bool dehacontlutili = false; bool dehaHcontlutili = false; - CurveFactory::curveDehaContL (dehacontlutili, params.dehaz.cdcurve, cdcurve, 1); - CurveFactory::curveDehaHContL (dehaHcontlutili, params.dehaz.cdHcurve, cdHcurve, 1); - DehazParams DehaParams = params.dehaz; + CurveFactory::curveDehaContL (dehacontlutili, params.retinex.cdcurve, cdcurve, 1); + CurveFactory::curveDehaHContL (dehaHcontlutili, params.retinex.cdHcurve, cdHcurve, 1); + RetinexParams DehaParams = params.retinex; DehaParams.getCurves(dehatransmissionCurve); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->dehaz( params.raw, params.icm, params.dehaz, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + imgsrc->retinex( params.raw, params.icm, params.retinex, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } if (pl) { diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index d49b2dbe6..5f5dbc1c1 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -17,7 +17,7 @@ set (BASESOURCEFILES previewloader.cc rtimage.cc inspector.cc histogrampanel.cc history.cc imagearea.cc imageareapanel.cc iptcpanel.cc labcurve.cc main.cc - multilangmgr.cc mycurve.cc myflatcurve.cc mydiagonalcurve.cc options.cc dehaz.cc + multilangmgr.cc mycurve.cc myflatcurve.cc mydiagonalcurve.cc options.cc retinex.cc preferences.cc profilepanel.cc saveasdlg.cc saveformatpanel.cc soundman.cc splash.cc thumbnail.cc tonecurve.cc toolbar.cc diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 7e8c79986..2486f7ea9 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -167,7 +167,7 @@ void BatchToolPanelCoordinator::initSession () blackwhite->setAdjusterBehavior (false, false); colortoning->setAdjusterBehavior (false, false, false, false, false); filmSimulation->setAdjusterBehavior(false); - dehaz->setAdjusterBehavior (false, false, false, false, false, false, false); + retinex->setAdjusterBehavior (false, false, false, false, false, false, false); shadowshighlights->setAdjusterBehavior (false, false, false); dirpyrequalizer->setAdjusterBehavior (false, false, false); @@ -204,7 +204,7 @@ void BatchToolPanelCoordinator::initSession () // colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRPROTECT], options.baBehav[ADDSET_COLORTONING_BALANCE]); colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRENGTH], options.baBehav[ADDSET_COLORTONING_BALANCE]); filmSimulation->setAdjusterBehavior(options.baBehav[ADDSET_FILMSIMULATION_STRENGTH]); - dehaz->setAdjusterBehavior (options.baBehav[ADDSET_DH_STR], options.baBehav[ADDSET_DH_SCAL], options.baBehav[ADDSET_DH_NEIGH], options.baBehav[ADDSET_DH_LIMD], options.baBehav[ADDSET_DH_GAIN], options.baBehav[ADDSET_DH_OFFS], options.baBehav[ADDSET_DH_VART]); + retinex->setAdjusterBehavior (options.baBehav[ADDSET_DH_STR], options.baBehav[ADDSET_DH_SCAL], options.baBehav[ADDSET_DH_NEIGH], options.baBehav[ADDSET_DH_LIMD], options.baBehav[ADDSET_DH_GAIN], options.baBehav[ADDSET_DH_OFFS], options.baBehav[ADDSET_DH_VART]); chmixer->setAdjusterBehavior (options.baBehav[ADDSET_CHMIXER] ); blackwhite->setAdjusterBehavior (options.baBehav[ADDSET_BLACKWHITE_HUES], options.baBehav[ADDSET_BLACKWHITE_GAMMA]); @@ -579,31 +579,31 @@ void BatchToolPanelCoordinator::initSession () } if (options.baBehav[ADDSET_DH_STR]) { - pparams.dehaz.str = 0; + pparams.retinex.str = 0; } if (options.baBehav[ADDSET_DH_SCAL]) { - pparams.dehaz.scal = 0; + pparams.retinex.scal = 0; } if (options.baBehav[ADDSET_DH_NEIGH]) { - pparams.dehaz.neigh = 0; + pparams.retinex.neigh = 0; } if (options.baBehav[ADDSET_DH_LIMD]) { - pparams.dehaz.limd = 0; + pparams.retinex.limd = 0; } if (options.baBehav[ADDSET_DH_GAIN]) { - pparams.dehaz.gain = 0; + pparams.retinex.gain = 0; } if (options.baBehav[ADDSET_DH_OFFS]) { - pparams.dehaz.offs = 0; + pparams.retinex.offs = 0; } if (options.baBehav[ADDSET_DH_VART]) { - pparams.dehaz.vart = 0; + pparams.retinex.vart = 0; } diff --git a/rtgui/dehaz.cc b/rtgui/dehaz.cc deleted file mode 100644 index 3c3761e83..000000000 --- a/rtgui/dehaz.cc +++ /dev/null @@ -1,716 +0,0 @@ -/* - * This file is part of RawTherapee. - */ -#include "dehaz.h" -#include "mycurve.h" - -using namespace rtengine; -using namespace rtengine::procparams; - -Dehaz::Dehaz () : FoldableToolPanel(this, "dehaz", M("TP_DEHAZ_LABEL"), false, true) -{ - CurveListener::setMulti(true); - std::vector milestones; - nextmin = 0.; - nextmax = 0.; - nextminiT = 0.; - nextmaxiT = 0.; - nextmeanT = 0.; - nextsigma = 0.; - nextminT = 0.; - nextmaxT = 0.; - - dehazFrame = Gtk::manage (new Gtk::Frame (M("TP_DEHAZ_LAB")) ); - dehazFrame->set_tooltip_text(M("TP_DEHAZ_LAB_TOOLTIP")); - dehazFrame->set_border_width(0); - dehazFrame->set_label_align(0.025, 0.5); - - Gtk::VBox * dehazVBox = Gtk::manage ( new Gtk::VBox()); - dehazVBox->set_border_width(4); - dehazVBox->set_spacing(2); - - Gtk::VBox * RetiVBox = Gtk::manage ( new Gtk::VBox()); - RetiVBox->set_border_width(4); - RetiVBox->set_spacing(2); - - dhbox = Gtk::manage (new Gtk::HBox ()); - labmdh = Gtk::manage (new Gtk::Label (M("TP_DEHAZE_MET") + ":")); - dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); - - dehazmet = Gtk::manage (new MyComboBoxText ()); - dehazmet->append_text (M("TP_DEHAZ_LOW")); - dehazmet->append_text (M("TP_DEHAZ_UNI")); - dehazmet->append_text (M("TP_DEHAZ_HIGH")); - dehazmet->set_active(0); - dehazmetConn = dehazmet->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazmetChanged) ); - dehazmet->set_tooltip_markup (M("TP_DEHAZ_MET_TOOLTIP")); - - dehazcolorspace = Gtk::manage (new MyComboBoxText ()); - dehazcolorspace->append_text (M("TP_DEHAZ_LABSPACE")); - dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACE")); - dehazcolorspace->append_text (M("TP_DEHAZ_HSLSPACELIN")); - dehazcolorspace->set_active(0); - dehazmetConn = dehazcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Dehaz::dehazColorSpaceChanged) ); - dehazcolorspace->set_tooltip_markup (M("TP_DEHAZ_COLORSPACE_TOOLTIP")); - - - - dhbox->pack_start(*dehazmet); - dhbox->pack_start(*dehazcolorspace); - dehazVBox->pack_start(*dhbox); - std::vector defaultCurve; - - curveEditorGD = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDIT")); - curveEditorGD->setCurveListener (this); - rtengine::DehazParams::getDefaultCDCurve(defaultCurve); - cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD"))); - cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); - cdshape->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP")); - std::vector milestones22; - - milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); - cdshape->setBottomBarBgGradient(milestones22); - cdshape->setLeftBarBgGradient(milestones22); - - curveEditorGD->curveListComplete(); - - curveEditorGDH = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_CONTEDITH")); - curveEditorGDH->setCurveListener (this); - rtengine::DehazParams::getDefaultCDHCurve(defaultCurve); - cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_DEHAZ_CURVEEDITOR_CD"))); - cdshapeH->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); - cdshapeH->setTooltip(M("TP_DEHAZ_CURVEEDITOR_CD_TOOLTIP")); - std::vector milestones22H; - - milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) ); - milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) ); - cdshapeH->setBottomBarBgGradient(milestones22H); - cdshapeH->setLeftBarBgGradient(milestones22H); - - curveEditorGDH->curveListComplete(); - - - transmissionCurveEditorG = new CurveEditorGroup (options.lastDehazDir, M("TP_DEHAZ_TRANSMISSION")); - transmissionCurveEditorG->setCurveListener (this); - - rtengine::DehazParams::getDefaulttransmissionCurve(defaultCurve); - transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false)); - transmissionShape->setIdentityValue(0.); - transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); - transmissionShape->setBottomBarBgGradient(milestones); - transmissionCurveEditorG->set_tooltip_markup (M("TP_DEHAZ_TRANS_TOOLTIP")); - - transmissionCurveEditorG->curveListComplete(); - - - - str = Gtk::manage (new Adjuster (M("TP_DEHAZ_STR"), 0, 100., 1., 30.)); - str->set_tooltip_markup (M("TP_DEHAZ_STR_TOOLTIP")); - neigh = Gtk::manage (new Adjuster (M("TP_DEHAZ_NEIGH"), 6, 100., 1., 80.)); - - expretinex = new MyExpander (false, M("TP_DEHAZ_RETIN")); - expretinex->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Dehaz::foldAllButMe), expretinex) ); - - retinex = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_RETIN"))); - retinex->set_active (true); - retinexConn = retinex->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::retinexChanged) ); - - dehazVBox->pack_start (*str); - str->show (); - - dehazVBox->pack_start (*neigh); - neigh->show (); - neigh->set_tooltip_markup (M("TP_DEHAZ_NEIGH_TOOLTIP")); - -// dehazVBox->pack_start (*retinex); -// retinex->show (); - - mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); - mMLabels->set_tooltip_markup (M("TP_DEHAZ_MLABEL_TOOLTIP")); - - transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); - transLabels->set_tooltip_markup (M("TP_DEHAZ_TLABEL_TOOLTIP")); - - scal = Gtk::manage (new Adjuster (M("TP_DEHAZ_SCAL"), 1, 8., 1., 3.)); - gain = Gtk::manage (new Adjuster (M("TP_DEHAZ_GAIN"), 20, 200, 1, 100));//50 150 - offs = Gtk::manage (new Adjuster (M("TP_DEHAZ_OFFS"), -10000, 10000, 1, 0)); - vart = Gtk::manage (new Adjuster (M("TP_DEHAZ_VART"), 50, 500, 1, 125)); - limd = Gtk::manage (new Adjuster (M("TP_DEHAZ_LIMD"), 2, 100, 1, 8)); - gain->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP")); - offs->set_tooltip_markup (M("TP_DEHAZ_GAIN_TOOLTIP")); - scal->set_tooltip_markup (M("TP_DEHAZ_SCAL_TOOLTIP")); - vart->set_tooltip_markup (M("TP_DEHAZ_VART_TOOLTIP")); - limd->set_tooltip_markup (M("TP_DEHAZ_LIMD_TOOLTIP")); - - medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_DEHAZ_MEDI"))); - medianmap->set_active (true); - medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Dehaz::medianmapChanged) ); - - RetiVBox->pack_start (*mMLabels); - mMLabels->show (); - - RetiVBox->pack_start (*transLabels); - transLabels->show (); - - RetiVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); - curveEditorGD->show(); - - RetiVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4); - curveEditorGDH->show(); - - RetiVBox->pack_start (*scal); - scal->show (); - - RetiVBox->pack_start (*gain); - gain->show (); - - RetiVBox->pack_start (*offs); - offs->show (); - - RetiVBox->pack_start (*vart); - vart->show (); - - RetiVBox->pack_start (*limd); - limd->show (); - - RetiVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); - transmissionCurveEditorG->show(); - - RetiVBox->pack_start (*medianmap); - medianmap->show (); - - expretinex->add(*RetiVBox); - - str->setAdjusterListener (this); - scal->setAdjusterListener (this); - neigh->setAdjusterListener (this); - gain->setAdjusterListener (this); - offs->setAdjusterListener (this); - vart->setAdjusterListener (this); - limd->setAdjusterListener (this); - pack_start (*dehazVBox); -// dehazFrame->add(*RetiVBox); -// pack_start (*dehazFrame); -// dehazFrame->hide(); - pack_start (*expretinex); - - disableListener(); - retinexChanged(); - dehazColorSpaceChanged(); - medianmapChanged(); - enableListener(); - -} - -Dehaz::~Dehaz() -{ - delete curveEditorGD; - delete curveEditorGDH; - delete transmissionCurveEditorG; - -} - -void Dehaz::foldAllButMe (GdkEventButton* event, MyExpander *expander) -{ - if (event->button == 3) { - expretinex->set_expanded(expretinex == expander); - } -} - -void Dehaz::writeOptions(std::vector &tpOpen) -{ - tpOpen.push_back (expretinex->get_expanded ()); -} - -void Dehaz::updateToolState(std::vector &tpOpen) -{ - if(tpOpen.size() == 9) { - expretinex->set_expanded(tpOpen.at(0)); - } -} - - - - - -int minmaxChangedUI (void* data) -{ - GThreadLock lock; // All GUI acces from idle_add callbacks or separate thread HAVE to be protected - (static_cast(data))->minmaxComputed_ (); - return 0; -} - -void Dehaz::minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) -{ - nextmin = cdmin; - nextmax = cdma; - nextminiT = mini; - nextmaxiT = maxi; - nextmeanT = Tmean; - nextsigma = Tsigma; - nextminT = Tmin; - nextmaxT = Tmax; - g_idle_add (minmaxChangedUI, this); - -} - -bool Dehaz::minmaxComputed_ () -{ - - disableListener (); - enableListener (); - updateLabel (); - updateTrans (); - return false; - -} -void Dehaz::updateLabel () -{ - if (!batchMode) { - float nX, nY; - nX = nextmin; - nY = nextmax; - { - mMLabels->set_text( - Glib::ustring::compose(M("TP_DEHAZ_MLABEL"), - Glib::ustring::format(std::fixed, std::setprecision(0), nX), - Glib::ustring::format(std::fixed, std::setprecision(0), nY)) - ); - } - } -} - -void Dehaz::updateTrans () -{ - if (!batchMode) { - float nm, nM, nZ, nA, nB, nS; - nm = nextminiT; - nM = nextmaxiT; - nZ = nextmeanT; - nA = nextminT; - nB = nextmaxT; - nS = nextsigma; - { - transLabels->set_text( - Glib::ustring::compose(M("TP_DEHAZ_TLABEL"), - Glib::ustring::format(std::fixed, std::setprecision(1), nm), - Glib::ustring::format(std::fixed, std::setprecision(1), nM), - Glib::ustring::format(std::fixed, std::setprecision(1), nZ), - Glib::ustring::format(std::fixed, std::setprecision(1), nS), - Glib::ustring::format(std::fixed, std::setprecision(1), nA), - Glib::ustring::format(std::fixed, std::setprecision(1), nB)) - ); - } - } -} - - - -void Dehaz::read (const ProcParams* pp, const ParamsEdited* pedited) -{ - disableListener (); - dehazmetConn.block(true); - - - if (pedited) { - scal->setEditedState (pedited->dehaz.scal ? Edited : UnEdited); - neigh->setEditedState (pedited->dehaz.neigh ? Edited : UnEdited); - gain->setEditedState (pedited->dehaz.gain ? Edited : UnEdited); - offs->setEditedState (pedited->dehaz.offs ? Edited : UnEdited); - vart->setEditedState (pedited->dehaz.vart ? Edited : UnEdited); - limd->setEditedState (pedited->dehaz.limd ? Edited : UnEdited); - set_inconsistent (multiImage && !pedited->dehaz.enabled); - retinex->set_inconsistent (!pedited->dehaz.retinex); - medianmap->set_inconsistent (!pedited->dehaz.medianmap); - - - if (!pedited->dehaz.dehazmet) { - dehazmet->set_active_text(M("GENERAL_UNCHANGED")); - } - - if (!pedited->dehaz.dehazcolorspace) { - dehazcolorspace->set_active_text(M("GENERAL_UNCHANGED")); - } - - cdshape->setUnChanged (!pedited->dehaz.cdcurve); - cdshapeH->setUnChanged (!pedited->dehaz.cdHcurve); - transmissionShape->setUnChanged (!pedited->dehaz.transmissionCurve); - - } - - neigh->setValue (pp->dehaz.neigh); - gain->setValue (pp->dehaz.gain); - offs->setValue (pp->dehaz.offs); - str->setValue (pp->dehaz.str); - scal->setValue (pp->dehaz.scal); - vart->setValue (pp->dehaz.vart); - limd->setValue (pp->dehaz.limd); - - setEnabled (pp->dehaz.enabled); - - retinexConn.block (true); - retinex->set_active (pp->dehaz.retinex); - retinexConn.block (false); - lastretinex = pp->dehaz.retinex; - - medianmapConn.block (true); - medianmap->set_active (pp->dehaz.medianmap); - medianmapConn.block (false); - lastmedianmap = pp->dehaz.medianmap; - - - if (pp->dehaz.dehazmet == "low") { - dehazmet->set_active (0); - } else if (pp->dehaz.dehazmet == "uni") { - dehazmet->set_active (1); - } else if (pp->dehaz.dehazmet == "high") { - dehazmet->set_active (2); - } - - dehazmetChanged (); - - if (pp->dehaz.dehazcolorspace == "Lab") { - dehazcolorspace->set_active (0); - } else if (pp->dehaz.dehazcolorspace == "HSL") { - dehazcolorspace->set_active (1); - } else if (pp->dehaz.dehazcolorspace == "HSLLIN") { - dehazcolorspace->set_active (2); - } - retinexConn.block(false); - retinexChanged (); - retinexConn.block(false); - - medianmapConn.block(false); - medianmapChanged (); - medianmapConn.block(false); - - cdshape->setCurve (pp->dehaz.cdcurve); - cdshapeH->setCurve (pp->dehaz.cdHcurve); - dehazmetConn.block(false); - dehazColorSpaceConn.block(false); - dehazColorSpaceChanged(); - dehazColorSpaceConn.block(false); - transmissionShape->setCurve (pp->dehaz.transmissionCurve); - - - enableListener (); -} -void Dehaz::retinexUpdateUI () -{ - if (!batchMode) { - if (retinex->get_active ()) { - scal->show(); - gain->show(); - offs->show(); - vart->show(); - limd->show(); - medianmap->show(); - mMLabels->show(); - transLabels->show(); - transmissionCurveEditorG->show(); - curveEditorGD->show(); - curveEditorGDH->show(); - dehazFrame->show(); - } else { - scal->hide(); - gain->hide(); - offs->hide(); - vart->hide(); - limd->hide(); - mMLabels->hide(); - transLabels->hide(); - medianmap->hide(); - transmissionCurveEditorG->hide(); - curveEditorGD->hide(); - curveEditorGDH->hide(); - dehazFrame->hide(); - } - } -} - - - -void Dehaz::write (ProcParams* pp, ParamsEdited* pedited) -{ - - pp->dehaz.str = str->getValue (); - pp->dehaz.scal = (int)scal->getValue (); - pp->dehaz.neigh = neigh->getValue (); - pp->dehaz.gain = (int)gain->getValue (); - pp->dehaz.offs = (int)offs->getValue (); - pp->dehaz.vart = (int)vart->getValue (); - pp->dehaz.limd = (int)limd->getValue (); - pp->dehaz.cdcurve = cdshape->getCurve (); - pp->dehaz.cdHcurve = cdshapeH->getCurve (); - pp->dehaz.transmissionCurve = transmissionShape->getCurve (); - pp->dehaz.enabled = getEnabled(); - pp->dehaz.retinex = retinex->get_active(); - pp->dehaz.medianmap = medianmap->get_active(); - - if (pedited) { - pedited->dehaz.dehazmet = dehazmet->get_active_text() != M("GENERAL_UNCHANGED"); - pedited->dehaz.dehazcolorspace = dehazcolorspace->get_active_text() != M("GENERAL_UNCHANGED"); - - //%%%%%%%%%%%%%%%%%%%%%% - pedited->dehaz.str = str->getEditedState (); - pedited->dehaz.scal = scal->getEditedState (); - pedited->dehaz.neigh = neigh->getEditedState (); - pedited->dehaz.gain = gain->getEditedState (); - pedited->dehaz.offs = offs->getEditedState (); - pedited->dehaz.vart = vart->getEditedState (); - pedited->dehaz.limd = limd->getEditedState (); - pedited->dehaz.cdcurve = !cdshape->isUnChanged (); - pedited->dehaz.cdHcurve = !cdshapeH->isUnChanged (); - pedited->dehaz.transmissionCurve = !transmissionShape->isUnChanged (); - pedited->dehaz.enabled = !get_inconsistent(); - pedited->dehaz.retinex = !retinex->get_inconsistent(); - pedited->dehaz.medianmap = !medianmap->get_inconsistent(); - - } - - if (dehazmet->get_active_row_number() == 0) { - pp->dehaz.dehazmet = "low"; - } else if (dehazmet->get_active_row_number() == 1) { - pp->dehaz.dehazmet = "uni"; - } else if (dehazmet->get_active_row_number() == 2) { - pp->dehaz.dehazmet = "high"; - } - - if (dehazcolorspace->get_active_row_number() == 0) { - pp->dehaz.dehazcolorspace = "Lab"; - } else if (dehazcolorspace->get_active_row_number() == 1) { - pp->dehaz.dehazcolorspace = "HSL"; - } else if (dehazcolorspace->get_active_row_number() == 2) { - pp->dehaz.dehazcolorspace = "HSLLIN"; - } -} - -void Dehaz::dehazmetChanged() -{ - if (listener) { - listener->panelChanged (Evdehazmet, dehazmet->get_active_text ()); - } -} - -void Dehaz::ColorSpaceUpdateUI () -{ - if (!batchMode) { - if(dehazcolorspace->get_active_row_number() == 0) { - curveEditorGD->show(); - curveEditorGDH->hide(); - } else if(dehazcolorspace->get_active_row_number() == 1) { - curveEditorGD->hide(); - curveEditorGDH->show(); - } - } -} - - -void Dehaz::dehazColorSpaceChanged() -{ - - ColorSpaceUpdateUI(); - - if (listener) { - listener->panelChanged (EvdehazColorSpace, dehazcolorspace->get_active_text ()); - } -} - -void Dehaz::retinexChanged () -{ - if (batchMode) { - if (retinex->get_inconsistent()) { - retinex->set_inconsistent (false); - retinexConn.block (true); - retinex->set_active (false); - retinexConn.block (false); - } else if (lastretinex) { - retinex->set_inconsistent (true); - } - - lastretinex = retinex->get_active (); - } - - retinexUpdateUI(); - - if (listener) { - if (retinex->get_active()) { - if (getEnabled()) { - listener->panelChanged (EvDehazretinex, M("GENERAL_ENABLED")); - } - } else { - if (getEnabled()) { - listener->panelChanged (EvDehazretinex, M("GENERAL_DISABLED")); - } - } - - } -} - -void Dehaz::medianmapChanged () -{ - if (batchMode) { - if (medianmap->get_inconsistent()) { - medianmap->set_inconsistent (false); - medianmapConn.block (true); - medianmap->set_active (false); - medianmapConn.block (false); - } else if (lastmedianmap) { - medianmap->set_inconsistent (true); - } - - lastmedianmap = medianmap->get_active (); - } - - if (listener) { - if (medianmap->get_active()) { - if (getEnabled()) { - listener->panelChanged (EvDehazmedianmap, M("GENERAL_ENABLED")); - } - } else { - if (getEnabled()) { - listener->panelChanged (EvDehazmedianmap, M("GENERAL_DISABLED")); - } - } - - } -} - - -void Dehaz::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) -{ - - neigh->setDefault (defParams->dehaz.neigh); - gain->setDefault (defParams->dehaz.gain); - offs->setDefault (defParams->dehaz.offs); - str->setDefault (defParams->dehaz.str); - scal->setDefault (defParams->dehaz.scal); - vart->setDefault (defParams->dehaz.vart); - limd->setDefault (defParams->dehaz.limd); - - if (pedited) { - neigh->setDefaultEditedState (pedited->dehaz.neigh ? Edited : UnEdited); - gain->setDefaultEditedState (pedited->dehaz.gain ? Edited : UnEdited); - offs->setDefaultEditedState (pedited->dehaz.offs ? Edited : UnEdited); - str->setDefaultEditedState (pedited->dehaz.str ? Edited : UnEdited); - scal->setDefaultEditedState (pedited->dehaz.scal ? Edited : UnEdited); - vart->setDefaultEditedState (pedited->dehaz.vart ? Edited : UnEdited); - limd->setDefaultEditedState (pedited->dehaz.limd ? Edited : UnEdited); - - } else { - neigh->setDefaultEditedState (Irrelevant); - gain->setDefaultEditedState (Irrelevant); - offs->setDefaultEditedState (Irrelevant); - vart->setDefaultEditedState (Irrelevant); - limd->setDefaultEditedState (Irrelevant); - str->setDefaultEditedState (Irrelevant); - scal->setDefaultEditedState (Irrelevant); - } -} - -void Dehaz::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd) - { - - str->setAddMode(strAdd); - neigh->setAddMode(neighAdd); - scal->setAddMode(scalAdd); - limd->setAddMode(limdAdd); - gain->setAddMode(gainAdd); - offs->setAddMode(offsAdd); - vart->setAddMode(vartAdd); - } - - -void Dehaz::adjusterChanged (Adjuster* a, double newval) -{ - - if (!listener || !getEnabled()) { - return; - } - - if (a == neigh) { - listener->panelChanged (EvLneigh, neigh->getTextValue()); - } else if (a == str) { - listener->panelChanged (EvLstr, str->getTextValue()); - } else if (a == scal) { - listener->panelChanged (EvLscal, scal->getTextValue()); - } else if (a == gain) { - listener->panelChanged (EvLgain, gain->getTextValue()); - } else if (a == offs) { - listener->panelChanged (EvLoffs, offs->getTextValue()); - } else if (a == vart) { - listener->panelChanged (EvLvart, vart->getTextValue()); - } else if (a == limd) { - listener->panelChanged (EvLlimd, limd->getTextValue()); - } - -} - - - -void Dehaz::autoOpenCurve () -{ - cdshape->openIfNonlinear(); - cdshapeH->openIfNonlinear(); - transmissionShape->openIfNonlinear(); - -} - - -void Dehaz::curveChanged (CurveEditor* ce) -{ - if (listener && getEnabled()) { - if (ce == cdshape) { - listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); - } else if (ce == cdshapeH) { - listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE")); - } else if (ce == transmissionShape) { - listener->panelChanged (EvDehaztransmission, M("HISTORY_CUSTOMCURVE")); - } - } -} - -void Dehaz::enabledChanged () -{ - - if (listener) { - if (get_inconsistent()) { - listener->panelChanged (EvDehazEnabled, M("GENERAL_UNCHANGED")); - } else if (getEnabled()) { - listener->panelChanged (EvDehazEnabled, M("GENERAL_ENABLED")); - } else { - listener->panelChanged (EvDehazEnabled, M("GENERAL_DISABLED")); - } - } -} - - -void Dehaz::trimValues (rtengine::procparams::ProcParams* pp) -{ - str->trimValue(pp->dehaz.str); - scal->trimValue(pp->dehaz.scal); - neigh->trimValue(pp->dehaz.neigh); - gain->trimValue(pp->dehaz.gain); - offs->trimValue(pp->dehaz.offs); - vart->trimValue(pp->dehaz.vart); - limd->trimValue(pp->dehaz.limd); - -} - -void Dehaz::setBatchMode (bool batchMode) -{ - ToolPanel::setBatchMode (batchMode); - neigh->showEditedCB (); - gain->showEditedCB (); - offs->showEditedCB (); - str->showEditedCB (); - scal->showEditedCB (); - vart->showEditedCB (); - limd->showEditedCB (); - curveEditorGD->setBatchMode (batchMode); - curveEditorGDH->setBatchMode (batchMode); - transmissionCurveEditorG->setBatchMode (batchMode); - - -} diff --git a/rtgui/options.cc b/rtgui/options.cc index 5e0f02e15..681d2bc81 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -178,8 +178,8 @@ void Options::updatePaths() lastLabCurvesDir = preferredPath; } - if (lastDehazDir.empty() || !safe_file_test (lastDehazDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { - lastDehazDir = preferredPath; + if (lastRetinexDir.empty() || !safe_file_test (lastRetinexDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastLabCurvesDir, Glib::FILE_TEST_IS_DIR)) { + lastRetinexDir = preferredPath; } if (lastDenoiseCurvesDir.empty() || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_EXISTS) || !safe_file_test (lastDenoiseCurvesDir, Glib::FILE_TEST_IS_DIR)) { @@ -693,7 +693,7 @@ void Options::setDefaults () // at the end of the "updatePaths" method. lastRgbCurvesDir = ""; lastLabCurvesDir = ""; - lastDehazDir = ""; + lastRetinexDir = ""; lastDenoiseCurvesDir = ""; lastWaveletCurvesDir = ""; lastPFCurvesDir = ""; @@ -1745,7 +1745,7 @@ int Options::readFromFile (Glib::ustring fname) safeDirGet(keyFile, "Dialogs", "LastFlatfieldDir", lastFlatfieldDir); safeDirGet(keyFile, "Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); safeDirGet(keyFile, "Dialogs", "LastLabCurvesDir", lastLabCurvesDir); - safeDirGet(keyFile, "Dialogs", "LastDehazDir", lastDehazDir); + safeDirGet(keyFile, "Dialogs", "LastRetinexDir", lastRetinexDir); safeDirGet(keyFile, "Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); safeDirGet(keyFile, "Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); safeDirGet(keyFile, "Dialogs", "LastPFCurvesDir", lastPFCurvesDir); @@ -2082,7 +2082,7 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_string ("Dialogs", "LastFlatfieldDir", lastFlatfieldDir); keyFile.set_string ("Dialogs", "LastRgbCurvesDir", lastRgbCurvesDir); keyFile.set_string ("Dialogs", "LastLabCurvesDir", lastLabCurvesDir); - keyFile.set_string ("Dialogs", "LastDehazDir", lastDehazDir); + keyFile.set_string ("Dialogs", "LastRetinexDir", lastRetinexDir); keyFile.set_string ("Dialogs", "LastDenoiseCurvesDir", lastDenoiseCurvesDir); keyFile.set_string ("Dialogs", "LastWaveletCurvesDir", lastWaveletCurvesDir); keyFile.set_string ("Dialogs", "LastPFCurvesDir", lastPFCurvesDir); diff --git a/rtgui/options.h b/rtgui/options.h index f619a9455..9c2385ffb 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -278,7 +278,7 @@ public: Glib::ustring lastFlatfieldDir; Glib::ustring lastRgbCurvesDir; Glib::ustring lastLabCurvesDir; - Glib::ustring lastDehazDir; + Glib::ustring lastRetinexDir; Glib::ustring lastDenoiseCurvesDir; Glib::ustring lastWaveletCurvesDir; Glib::ustring lastPFCurvesDir; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 8d786bb69..77f2d50f8 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -49,21 +49,21 @@ void ParamsEdited::set (bool v) toneCurve.expcomp = v; toneCurve.hrenabled = v; toneCurve.method = v; - dehaz.cdcurve = v; - dehaz.cdHcurve = v; - dehaz.dehazmet = v; - dehaz.dehazcolorspace = v; - dehaz.enabled = v; - dehaz.str = v; - dehaz.scal = v; - dehaz.neigh = v; - dehaz.gain = v; - dehaz.offs = v; - dehaz.vart = v; - dehaz.limd = v; - dehaz.medianmap = v; - dehaz.transmissionCurve = v; - dehaz.retinex = v; + retinex.cdcurve = v; + retinex.cdHcurve = v; + retinex.retinexMethod = v; + retinex.retinexcolorspace = v; + retinex.enabled = v; + retinex.str = v; + retinex.scal = v; + retinex.neigh = v; + retinex.gain = v; + retinex.offs = v; + retinex.vart = v; + retinex.limd = v; + retinex.medianmap = v; + retinex.transmissionCurve = v; + retinex.retinex = v; labCurve.lcurve = v; labCurve.acurve = v; labCurve.bcurve = v; @@ -519,21 +519,20 @@ void ParamsEdited::initFrom (const std::vector toneCurve.expcomp = toneCurve.expcomp && p.toneCurve.expcomp == other.toneCurve.expcomp; toneCurve.hrenabled = toneCurve.hrenabled && p.toneCurve.hrenabled == other.toneCurve.hrenabled; toneCurve.method = toneCurve.method && p.toneCurve.method == other.toneCurve.method; - dehaz.cdcurve = dehaz.cdcurve && p.dehaz.cdcurve == other.dehaz.cdcurve; - dehaz.cdHcurve = dehaz.cdHcurve && p.dehaz.cdHcurve == other.dehaz.cdHcurve; - dehaz.transmissionCurve = dehaz.transmissionCurve && p.dehaz.transmissionCurve == other.dehaz.transmissionCurve; - dehaz.dehazmet = dehaz.dehazmet && p.dehaz.dehazmet == other.dehaz.dehazmet; - dehaz.dehazcolorspace = dehaz.dehazcolorspace && p.dehaz.dehazcolorspace == other.dehaz.dehazcolorspace; - dehaz.str = dehaz.str && p.dehaz.str == other.dehaz.str; - dehaz.scal = dehaz.scal && p.dehaz.scal == other.dehaz.scal; - dehaz.neigh = dehaz.neigh && p.dehaz.neigh == other.dehaz.neigh; - dehaz.gain = dehaz.gain && p.dehaz.gain == other.dehaz.gain; - dehaz.offs = dehaz.offs && p.dehaz.offs == other.dehaz.offs; - dehaz.vart = dehaz.vart && p.dehaz.vart == other.dehaz.vart; - dehaz.limd = dehaz.limd && p.dehaz.limd == other.dehaz.limd; - dehaz.medianmap = dehaz.medianmap && p.dehaz.medianmap == other.dehaz.medianmap; - dehaz.enabled = dehaz.enabled && p.dehaz.enabled == other.dehaz.enabled; - dehaz.retinex = dehaz.retinex && p.dehaz.retinex == other.dehaz.retinex; + retinex.cdcurve = retinex.cdcurve && p.retinex.cdcurve == other.retinex.cdcurve; + retinex.cdHcurve = retinex.cdHcurve && p.retinex.cdHcurve == other.retinex.cdHcurve; + retinex.transmissionCurve = retinex.transmissionCurve && p.retinex.transmissionCurve == other.retinex.transmissionCurve; + retinex.retinexMethod = retinex.retinexMethod && p.retinex.retinexMethod == other.retinex.retinexMethod; + retinex.retinexcolorspace = retinex.retinexcolorspace && p.retinex.retinexcolorspace == other.retinex.retinexcolorspace; + retinex.str = retinex.str && p.retinex.str == other.retinex.str; + retinex.scal = retinex.scal && p.retinex.scal == other.retinex.scal; + retinex.neigh = retinex.neigh && p.retinex.neigh == other.retinex.neigh; + retinex.gain = retinex.gain && p.retinex.gain == other.retinex.gain; + retinex.offs = retinex.offs && p.retinex.offs == other.retinex.offs; + retinex.vart = retinex.vart && p.retinex.vart == other.retinex.vart; + retinex.limd = retinex.limd && p.retinex.limd == other.retinex.limd; + retinex.medianmap = retinex.medianmap && p.retinex.medianmap == other.retinex.medianmap; + retinex.enabled = retinex.enabled && p.retinex.enabled == other.retinex.enabled; labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve; labCurve.acurve = labCurve.acurve && p.labCurve.acurve == other.labCurve.acurve; labCurve.bcurve = labCurve.bcurve && p.labCurve.bcurve == other.labCurve.bcurve; @@ -1025,64 +1024,60 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.toneCurve.method = mods.toneCurve.method; } - if (dehaz.enabled) { - toEdit.dehaz.enabled = mods.dehaz.enabled; + if (retinex.enabled) { + toEdit.retinex.enabled = mods.retinex.enabled; } - if (dehaz.cdcurve) { - toEdit.dehaz.cdcurve = mods.dehaz.cdcurve; - } - - if (dehaz.cdHcurve) { - toEdit.dehaz.cdHcurve = mods.dehaz.cdHcurve; + if (retinex.cdcurve) { + toEdit.retinex.cdcurve = mods.retinex.cdcurve; } - if (dehaz.transmissionCurve) { - toEdit.dehaz.transmissionCurve = mods.dehaz.transmissionCurve; + if (retinex.cdHcurve) { + toEdit.retinex.cdHcurve = mods.retinex.cdHcurve; } - if (dehaz.dehazmet) { - toEdit.dehaz.dehazmet = mods.dehaz.dehazmet; + if (retinex.transmissionCurve) { + toEdit.retinex.transmissionCurve = mods.retinex.transmissionCurve; } - if (dehaz.dehazcolorspace) { - toEdit.dehaz.dehazcolorspace = mods.dehaz.dehazcolorspace; + if (retinex.retinexMethod) { + toEdit.retinex.retinexMethod = mods.retinex.retinexMethod; } - if (dehaz.str) { - toEdit.dehaz.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.dehaz.str + mods.dehaz.str : mods.dehaz.str; + if (retinex.retinexcolorspace) { + toEdit.retinex.retinexcolorspace = mods.retinex.retinexcolorspace; } - if (dehaz.scal) { - toEdit.dehaz.scal = dontforceSet && options.baBehav[ADDSET_DH_SCAL] ? toEdit.dehaz.scal + mods.dehaz.scal : mods.dehaz.scal; + if (retinex.str) { + toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str; } - if (dehaz.retinex) { - toEdit.dehaz.retinex = mods.dehaz.retinex; + if (retinex.scal) { + toEdit.retinex.scal = dontforceSet && options.baBehav[ADDSET_DH_SCAL] ? toEdit.retinex.scal + mods.retinex.scal : mods.retinex.scal; } - if (dehaz.medianmap) { - toEdit.dehaz.medianmap = mods.dehaz.medianmap; + if (retinex.medianmap) { + toEdit.retinex.medianmap = mods.retinex.medianmap; } - if (dehaz.neigh) { - toEdit.dehaz.neigh = dontforceSet && options.baBehav[ADDSET_DH_NEIGH] ? toEdit.dehaz.neigh + mods.dehaz.neigh : mods.dehaz.neigh; + if (retinex.neigh) { + toEdit.retinex.neigh = dontforceSet && options.baBehav[ADDSET_DH_NEIGH] ? toEdit.retinex.neigh + mods.retinex.neigh : mods.retinex.neigh; } - if (dehaz.limd) { - toEdit.dehaz.limd = dontforceSet && options.baBehav[ADDSET_DH_LIMD] ? toEdit.dehaz.limd + mods.dehaz.limd : mods.dehaz.limd; + if (retinex.limd) { + toEdit.retinex.limd = dontforceSet && options.baBehav[ADDSET_DH_LIMD] ? toEdit.retinex.limd + mods.retinex.limd : mods.retinex.limd; } - if (dehaz.gain) { - toEdit.dehaz.gain = dontforceSet && options.baBehav[ADDSET_DH_GAIN] ? toEdit.dehaz.gain + mods.dehaz.gain : mods.dehaz.gain; + if (retinex.gain) { + toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_DH_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain; } - if (dehaz.offs) { - toEdit.dehaz.offs = dontforceSet && options.baBehav[ADDSET_DH_OFFS] ? toEdit.dehaz.offs + mods.dehaz.offs : mods.dehaz.offs; + if (retinex.offs) { + toEdit.retinex.offs = dontforceSet && options.baBehav[ADDSET_DH_OFFS] ? toEdit.retinex.offs + mods.retinex.offs : mods.retinex.offs; } - if (dehaz.vart) { - toEdit.dehaz.vart = dontforceSet && options.baBehav[ADDSET_DH_VART] ? toEdit.dehaz.vart + mods.dehaz.vart : mods.dehaz.vart; + if (retinex.vart) { + toEdit.retinex.vart = dontforceSet && options.baBehav[ADDSET_DH_VART] ? toEdit.retinex.vart + mods.retinex.vart : mods.retinex.vart; } if (labCurve.lcurve) { @@ -1117,8 +1112,8 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.labCurve.lccurve = mods.labCurve.lccurve; } -// if (labCurve.dehazmet) { -// toEdit.labCurve.dehazmet = mods.labCurve.dehazmet; +// if (labCurve.retinexMethod) { +// toEdit.labCurve.retinexMethod = mods.labCurve.retinexMethod; // } if (labCurve.clcurve) { toEdit.labCurve.clcurve = mods.labCurve.clcurve; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 2346965bc..7600b3bb1 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -55,7 +55,7 @@ public: bool method; }; -class DehazParamsEdited +class RetinexParamsEdited { public: bool enabled; @@ -64,8 +64,8 @@ public: bool neigh; bool gain; bool offs; - bool dehazmet; - bool dehazcolorspace; + bool retinexMethod; + bool retinexcolorspace; bool vart; bool limd; bool method; @@ -721,7 +721,7 @@ public: LCurveParamsEdited labCurve; RGBCurvesParamsEdited rgbCurves; ColorToningEdited colorToning; - DehazParamsEdited dehaz; + RetinexParamsEdited retinex; SharpeningParamsEdited sharpening; SharpeningParamsEdited prsharpening; SharpenEdgeParamsEdited sharpenEdge; diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 78dfd6803..046a9ccab 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -52,7 +52,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) exposure = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EXPOSURE"))); sh = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_SHADOWSHIGHLIGHTS"))); epd = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EPD"))); - dehaz = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DEHAZ"))); + retinex = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RETINEX"))); pcvignette = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_PCVIGNETTE"))); gradient = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_GRADIENT"))); labcurve = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LABCURVE"))); @@ -142,7 +142,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) vboxes[0]->pack_start (*exposure, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*sh, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*epd, Gtk::PACK_SHRINK, 2); - vboxes[0]->pack_start (*dehaz, Gtk::PACK_SHRINK, 2); + vboxes[0]->pack_start (*retinex, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*pcvignette, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*gradient, Gtk::PACK_SHRINK, 2); vboxes[0]->pack_start (*labcurve, Gtk::PACK_SHRINK, 2); @@ -296,7 +296,7 @@ PartialPasteDlg::PartialPasteDlg (Glib::ustring title) exposureConn = exposure->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); shConn = sh->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); epdConn = epd->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); - dehazConn = dehaz->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); + retinexConn = retinex->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); pcvignetteConn = pcvignette->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); gradientConn = gradient->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); labcurveConn = labcurve->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true)); diff --git a/rtgui/partialpastedlg.h b/rtgui/partialpastedlg.h index ffa748040..57a235f35 100644 --- a/rtgui/partialpastedlg.h +++ b/rtgui/partialpastedlg.h @@ -46,7 +46,7 @@ public: Gtk::CheckButton* exposure; Gtk::CheckButton* sh; Gtk::CheckButton* epd; - Gtk::CheckButton* dehaz; + Gtk::CheckButton* retinex; Gtk::CheckButton* pcvignette; Gtk::CheckButton* gradient; Gtk::CheckButton* labcurve; @@ -124,7 +124,7 @@ public: sigc::connection everythingConn, basicConn, detailConn, colorConn, lensConn, compositionConn, metaConn, rawConn, wavConn; sigc::connection wbConn, exposureConn, shConn, pcvignetteConn, gradientConn, labcurveConn, colorappearanceConn; - sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, defringeConn, epdConn, dirpyreqConn, waveletConn, dehazConn; + sigc::connection sharpenConn, gradsharpenConn, microcontrastConn, impdenConn, dirpyrdenConn, defringeConn, epdConn, dirpyreqConn, waveletConn, retinexConn; sigc::connection vibranceConn, chmixerConn, hsveqConn, rgbcurvesConn, chmixerbwConn, colortoningConn, filmSimulationConn; sigc::connection distortionConn, cacorrConn, vignettingConn, lcpConn; sigc::connection coarserotConn, finerotConn, cropConn, resizeConn, perspectiveConn, commonTransConn; diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index afc5dd6b8..47a641634 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -171,14 +171,14 @@ Gtk::Widget* Preferences::getBatchProcPanel () appendBehavList (mi, M("TP_EXPOSURE_SATURATION"), ADDSET_TC_SATURATION, false); mi = behModel->append (); - mi->set_value (behavColumns.label, M("TP_DEHAZ_LABEL")); - appendBehavList (mi, M("TP_DEHAZ_STR"), ADDSET_DH_STR, false); - appendBehavList (mi, M("TP_DEHAZ_NEIGH"), ADDSET_DH_NEIGH, false); - appendBehavList (mi, M("TP_DEHAZ_SCAL"), ADDSET_DH_SCAL, false); - appendBehavList (mi, M("TP_DEHAZ_GAIN"), ADDSET_DH_GAIN, false); - appendBehavList (mi, M("TP_DEHAZ_OFFS"), ADDSET_DH_OFFS, false); - appendBehavList (mi, M("TP_DEHAZ_LIMD"), ADDSET_DH_LIMD, false); - appendBehavList (mi, M("TP_DEHAZ_VART"), ADDSET_DH_VART, false); + mi->set_value (behavColumns.label, M("TP_RETINEX_LABEL")); + appendBehavList (mi, M("TP_RETINEX_STRENGTH"), ADDSET_DH_STR, false); + appendBehavList (mi, M("TP_RETINEX_NEIGH"), ADDSET_DH_NEIGH, false); + appendBehavList (mi, M("TP_RETINEX_SCAL"), ADDSET_DH_SCAL, false); + appendBehavList (mi, M("TP_RETINEX_GAIN"), ADDSET_DH_GAIN, false); + appendBehavList (mi, M("TP_RETINEX_OFFS"), ADDSET_DH_OFFS, false); + appendBehavList (mi, M("TP_RETINEX_LIMD"), ADDSET_DH_LIMD, false); + appendBehavList (mi, M("TP_RETINEX_VART"), ADDSET_DH_VART, false); mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_SHADOWSHLIGHTS_LABEL")); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc new file mode 100644 index 000000000..f15f7d276 --- /dev/null +++ b/rtgui/retinex.cc @@ -0,0 +1,622 @@ +/* + * This file is part of RawTherapee. + */ +#include "retinex.h" +#include "mycurve.h" + +using namespace rtengine; +using namespace rtengine::procparams; + +Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), false, true) +{ + CurveListener::setMulti(true); + std::vector milestones; + nextmin = 0.; + nextmax = 0.; + nextminiT = 0.; + nextmaxiT = 0.; + nextmeanT = 0.; + nextsigma = 0.; + nextminT = 0.; + nextmaxT = 0.; + + Gtk::VBox * retinexVBox = Gtk::manage ( new Gtk::VBox()); + retinexVBox->set_border_width(4); + retinexVBox->set_spacing(2); + + Gtk::VBox * settingsVBox = Gtk::manage ( new Gtk::VBox()); + settingsVBox->set_border_width(4); + settingsVBox->set_spacing(2); + + dhbox = Gtk::manage (new Gtk::HBox ()); + labmdh = Gtk::manage (new Gtk::Label (M("TP_RETINEX_METHOD") + ":")); + dhbox->pack_start (*labmdh, Gtk::PACK_SHRINK, 1); + + retinexMethod = Gtk::manage (new MyComboBoxText ()); + retinexMethod->append_text (M("TP_RETINEX_LOW")); + retinexMethod->append_text (M("TP_RETINEX_UNIFORM")); + retinexMethod->append_text (M("TP_RETINEX_HIGH")); + retinexMethod->set_active(0); + retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) ); + retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP")); + + retinexcolorspace = Gtk::manage (new MyComboBoxText ()); + retinexcolorspace->append_text (M("TP_RETINEX_LABSPACE")); + retinexcolorspace->append_text (M("TP_RETINEX_HSLSPACE_LOG")); + retinexcolorspace->append_text (M("TP_RETINEX_HSLSPACE_LIN")); + retinexcolorspace->set_active(0); + retinexColorSpaceConn = retinexcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexColorSpaceChanged) ); + + + dhbox->pack_start(*retinexMethod); + dhbox->pack_start(*retinexcolorspace); + retinexVBox->pack_start(*dhbox); + std::vector defaultCurve; + + curveEditorGD = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LAB")); + curveEditorGD->setCurveListener (this); + rtengine::RetinexParams::getDefaultCDCurve(defaultCurve); + cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); + cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cdshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); + std::vector milestones22; + + milestones22.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshape->setBottomBarBgGradient(milestones22); + cdshape->setLeftBarBgGradient(milestones22); + + curveEditorGD->curveListComplete(); + + curveEditorGDH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_HSL")); + curveEditorGDH->setCurveListener (this); + rtengine::RetinexParams::getDefaultCDHCurve(defaultCurve); + cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); + cdshapeH->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cdshapeH->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); + std::vector milestones22H; + + milestones22H.push_back( GradientMilestone(0., 0., 0., 0.) ); + milestones22H.push_back( GradientMilestone(1., 1., 1., 1.) ); + cdshapeH->setBottomBarBgGradient(milestones22H); + cdshapeH->setLeftBarBgGradient(milestones22H); + + curveEditorGDH->curveListComplete(); + + + transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_TRANSMISSION")); + transmissionCurveEditorG->setCurveListener (this); + + rtengine::RetinexParams::getDefaulttransmissionCurve(defaultCurve); + transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false)); + transmissionShape->setIdentityValue(0.); + transmissionShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + transmissionShape->setBottomBarBgGradient(milestones); + transmissionCurveEditorG->set_tooltip_markup (M("TP_RETINEX_TRANSMISSION_TOOLTIP")); + + transmissionCurveEditorG->curveListComplete(); + + + + str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); + neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); + + expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); + expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); + + retinexVBox->pack_start (*str); + str->show (); + + retinexVBox->pack_start (*neigh); + neigh->show (); + + mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); + mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP")); + + transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); + transLabels->set_tooltip_markup (M("TP_RETINEX_TLABEL_TOOLTIP")); + + scal = Gtk::manage (new Adjuster (M("TP_RETINEX_SCALES"), 1, 8., 1., 3.)); + gain = Gtk::manage (new Adjuster (M("TP_RETINEX_GAIN"), 20, 200, 1, 50)); + offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -10000, 10000, 1, 0)); + vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125)); + limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8)); + gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP")); + scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP")); + vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); + limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); + + medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN"))); + medianmap->set_active (true); + medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Retinex::medianmapChanged) ); + + settingsVBox->pack_start (*mMLabels); + mMLabels->show (); + + settingsVBox->pack_start (*transLabels); + transLabels->show (); + + settingsVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); + curveEditorGD->show(); + + settingsVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4); + curveEditorGDH->show(); + + settingsVBox->pack_start (*scal); + scal->show (); + + settingsVBox->pack_start (*gain); + gain->show (); + + settingsVBox->pack_start (*offs); + offs->show (); + + settingsVBox->pack_start (*vart); + vart->show (); + + settingsVBox->pack_start (*limd); + limd->show (); + + settingsVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); + transmissionCurveEditorG->show(); + + settingsVBox->pack_start (*medianmap); + medianmap->show (); + + expsettings->add(*settingsVBox); + + str->setAdjusterListener (this); + scal->setAdjusterListener (this); + neigh->setAdjusterListener (this); + gain->setAdjusterListener (this); + offs->setAdjusterListener (this); + vart->setAdjusterListener (this); + limd->setAdjusterListener (this); + pack_start (*retinexVBox); + pack_start (*expsettings); + + disableListener(); + retinexColorSpaceChanged(); + medianmapChanged(); + enableListener(); + +} + +Retinex::~Retinex() +{ + delete curveEditorGD; + delete curveEditorGDH; + delete transmissionCurveEditorG; + +} + +void Retinex::foldAllButMe (GdkEventButton* event, MyExpander *expander) +{ + if (event->button == 3) { + expsettings->set_expanded(expsettings == expander); + } +} + +void Retinex::writeOptions(std::vector &tpOpen) +{ + tpOpen.push_back (expsettings->get_expanded ()); +} + +void Retinex::updateToolState(std::vector &tpOpen) +{ + if(tpOpen.size() == 9) { + expsettings->set_expanded(tpOpen.at(0)); + } +} + + + + + +int minmaxChangedUI (void* data) +{ + GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected + (static_cast(data))->minmaxComputed_ (); + return 0; +} + +void Retinex::minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax) +{ + nextmin = cdmin; + nextmax = cdma; + nextminiT = mini; + nextmaxiT = maxi; + nextmeanT = Tmean; + nextsigma = Tsigma; + nextminT = Tmin; + nextmaxT = Tmax; + g_idle_add (minmaxChangedUI, this); + +} + +bool Retinex::minmaxComputed_ () +{ + + disableListener (); + enableListener (); + updateLabel (); + updateTrans (); + return false; + +} +void Retinex::updateLabel () +{ + if (!batchMode) { + float nX, nY; + nX = nextmin; + nY = nextmax; + { + mMLabels->set_text( + Glib::ustring::compose(M("TP_RETINEX_MLABEL"), + Glib::ustring::format(std::fixed, std::setprecision(0), nX), + Glib::ustring::format(std::fixed, std::setprecision(0), nY)) + ); + } + } +} + +void Retinex::updateTrans () +{ + if (!batchMode) { + float nm, nM, nZ, nA, nB, nS; + nm = nextminiT; + nM = nextmaxiT; + nZ = nextmeanT; + nA = nextminT; + nB = nextmaxT; + nS = nextsigma; + { + transLabels->set_text( + Glib::ustring::compose(M("TP_RETINEX_TLABEL"), + Glib::ustring::format(std::fixed, std::setprecision(1), nm), + Glib::ustring::format(std::fixed, std::setprecision(1), nM), + Glib::ustring::format(std::fixed, std::setprecision(1), nZ), + Glib::ustring::format(std::fixed, std::setprecision(1), nS), + Glib::ustring::format(std::fixed, std::setprecision(1), nA), + Glib::ustring::format(std::fixed, std::setprecision(1), nB)) + ); + } + } +} + + + +void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) +{ + disableListener (); + retinexMethodConn.block(true); + retinexColorSpaceConn.block(true); + + + if (pedited) { + scal->setEditedState (pedited->retinex.scal ? Edited : UnEdited); + neigh->setEditedState (pedited->retinex.neigh ? Edited : UnEdited); + gain->setEditedState (pedited->retinex.gain ? Edited : UnEdited); + offs->setEditedState (pedited->retinex.offs ? Edited : UnEdited); + vart->setEditedState (pedited->retinex.vart ? Edited : UnEdited); + limd->setEditedState (pedited->retinex.limd ? Edited : UnEdited); + set_inconsistent (multiImage && !pedited->retinex.enabled); + medianmap->set_inconsistent (!pedited->retinex.medianmap); + + + if (!pedited->retinex.retinexMethod) { + retinexMethod->set_active_text(M("GENERAL_UNCHANGED")); + } + + if (!pedited->retinex.retinexcolorspace) { + retinexcolorspace->set_active_text(M("GENERAL_UNCHANGED")); + } + + cdshape->setUnChanged (!pedited->retinex.cdcurve); + cdshapeH->setUnChanged (!pedited->retinex.cdHcurve); + transmissionShape->setUnChanged (!pedited->retinex.transmissionCurve); + + } + + neigh->setValue (pp->retinex.neigh); + gain->setValue (pp->retinex.gain); + offs->setValue (pp->retinex.offs); + str->setValue (pp->retinex.str); + scal->setValue (pp->retinex.scal); + vart->setValue (pp->retinex.vart); + limd->setValue (pp->retinex.limd); + + setEnabled (pp->retinex.enabled); + + medianmapConn.block (true); + medianmap->set_active (pp->retinex.medianmap); + medianmapConn.block (false); + lastmedianmap = pp->retinex.medianmap; + + if (pp->retinex.retinexMethod == "low") { + retinexMethod->set_active (0); + } else if (pp->retinex.retinexMethod == "uni") { + retinexMethod->set_active (1); + } else if (pp->retinex.retinexMethod == "high") { + retinexMethod->set_active (2); + } + + + if (pp->retinex.retinexcolorspace == "Lab") { + retinexcolorspace->set_active (0); + } else if (pp->retinex.retinexcolorspace == "HSLLOG") { + retinexcolorspace->set_active (1); + } else if (pp->retinex.retinexcolorspace == "HSLLIN") { + retinexcolorspace->set_active (2); + } + + retinexMethodChanged (); + retinexColorSpaceChanged(); + + medianmapConn.block(true); + medianmapChanged (); + medianmapConn.block(false); + + cdshape->setCurve (pp->retinex.cdcurve); + cdshapeH->setCurve (pp->retinex.cdHcurve); + + retinexMethodConn.block(false); + retinexColorSpaceConn.block(false); + transmissionShape->setCurve (pp->retinex.transmissionCurve); + + + enableListener (); +} + + + +void Retinex::write (ProcParams* pp, ParamsEdited* pedited) +{ + + pp->retinex.str = str->getValue (); + pp->retinex.scal = (int)scal->getValue (); + pp->retinex.neigh = neigh->getValue (); + pp->retinex.gain = (int)gain->getValue (); + pp->retinex.offs = (int)offs->getValue (); + pp->retinex.vart = (int)vart->getValue (); + pp->retinex.limd = (int)limd->getValue (); + pp->retinex.cdcurve = cdshape->getCurve (); + pp->retinex.cdHcurve = cdshapeH->getCurve (); + pp->retinex.transmissionCurve = transmissionShape->getCurve (); + pp->retinex.enabled = getEnabled(); + pp->retinex.medianmap = medianmap->get_active(); + + if (pedited) { + pedited->retinex.retinexMethod = retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->retinex.retinexcolorspace = retinexcolorspace->get_active_text() != M("GENERAL_UNCHANGED"); + + //%%%%%%%%%%%%%%%%%%%%%% + pedited->retinex.str = str->getEditedState (); + pedited->retinex.scal = scal->getEditedState (); + pedited->retinex.neigh = neigh->getEditedState (); + pedited->retinex.gain = gain->getEditedState (); + pedited->retinex.offs = offs->getEditedState (); + pedited->retinex.vart = vart->getEditedState (); + pedited->retinex.limd = limd->getEditedState (); + pedited->retinex.cdcurve = !cdshape->isUnChanged (); + pedited->retinex.cdHcurve = !cdshapeH->isUnChanged (); + pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged (); + pedited->retinex.enabled = !get_inconsistent(); + pedited->retinex.medianmap = !medianmap->get_inconsistent(); + + } + + if (retinexMethod->get_active_row_number() == 0) { + pp->retinex.retinexMethod = "low"; + } else if (retinexMethod->get_active_row_number() == 1) { + pp->retinex.retinexMethod = "uni"; + } else if (retinexMethod->get_active_row_number() == 2) { + pp->retinex.retinexMethod = "high"; + } + + if (retinexcolorspace->get_active_row_number() == 0) { + pp->retinex.retinexcolorspace = "Lab"; + } else if (retinexcolorspace->get_active_row_number() == 1) { + pp->retinex.retinexcolorspace = "HSLLOG"; + } else if (retinexcolorspace->get_active_row_number() == 2) { + pp->retinex.retinexcolorspace = "HSLLIN"; + } +} + +void Retinex::retinexMethodChanged() +{ + if (listener) { + listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); + } +} + +void Retinex::ColorSpaceUpdateUI () +{ + if (!batchMode) { + if(retinexcolorspace->get_active_row_number() == 0) { + curveEditorGD->show(); + curveEditorGDH->hide(); + } else if(retinexcolorspace->get_active_row_number() == 1) { + curveEditorGD->hide(); + curveEditorGDH->show(); + } + } +} + + +void Retinex::retinexColorSpaceChanged() +{ + + ColorSpaceUpdateUI(); + + if (listener) { + listener->panelChanged (EvretinexColorSpace, retinexcolorspace->get_active_text ()); + } +} + +void Retinex::medianmapChanged () +{ + if (batchMode) { + if (medianmap->get_inconsistent()) { + medianmap->set_inconsistent (false); + medianmapConn.block (true); + medianmap->set_active (false); + medianmapConn.block (false); + } else if (lastmedianmap) { + medianmap->set_inconsistent (true); + } + + lastmedianmap = medianmap->get_active (); + } + + if (listener) { + if (medianmap->get_active()) { + if (getEnabled()) { + listener->panelChanged (EvRetinexmedianmap, M("GENERAL_ENABLED")); + } + } else { + if (getEnabled()) { + listener->panelChanged (EvRetinexmedianmap, M("GENERAL_DISABLED")); + } + } + + } +} + + +void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedited) +{ + + neigh->setDefault (defParams->retinex.neigh); + gain->setDefault (defParams->retinex.gain); + offs->setDefault (defParams->retinex.offs); + str->setDefault (defParams->retinex.str); + scal->setDefault (defParams->retinex.scal); + vart->setDefault (defParams->retinex.vart); + limd->setDefault (defParams->retinex.limd); + + if (pedited) { + neigh->setDefaultEditedState (pedited->retinex.neigh ? Edited : UnEdited); + gain->setDefaultEditedState (pedited->retinex.gain ? Edited : UnEdited); + offs->setDefaultEditedState (pedited->retinex.offs ? Edited : UnEdited); + str->setDefaultEditedState (pedited->retinex.str ? Edited : UnEdited); + scal->setDefaultEditedState (pedited->retinex.scal ? Edited : UnEdited); + vart->setDefaultEditedState (pedited->retinex.vart ? Edited : UnEdited); + limd->setDefaultEditedState (pedited->retinex.limd ? Edited : UnEdited); + + } else { + neigh->setDefaultEditedState (Irrelevant); + gain->setDefaultEditedState (Irrelevant); + offs->setDefaultEditedState (Irrelevant); + vart->setDefaultEditedState (Irrelevant); + limd->setDefaultEditedState (Irrelevant); + str->setDefaultEditedState (Irrelevant); + scal->setDefaultEditedState (Irrelevant); + } +} + +void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd) + { + + str->setAddMode(strAdd); + neigh->setAddMode(neighAdd); + scal->setAddMode(scalAdd); + limd->setAddMode(limdAdd); + gain->setAddMode(gainAdd); + offs->setAddMode(offsAdd); + vart->setAddMode(vartAdd); + } + + +void Retinex::adjusterChanged (Adjuster* a, double newval) +{ + + if (!listener || !getEnabled()) { + return; + } + + if (a == neigh) { + listener->panelChanged (EvLneigh, neigh->getTextValue()); + } else if (a == str) { + listener->panelChanged (EvLstr, str->getTextValue()); + } else if (a == scal) { + listener->panelChanged (EvLscal, scal->getTextValue()); + } else if (a == gain) { + listener->panelChanged (EvLgain, gain->getTextValue()); + } else if (a == offs) { + listener->panelChanged (EvLoffs, offs->getTextValue()); + } else if (a == vart) { + listener->panelChanged (EvLvart, vart->getTextValue()); + } else if (a == limd) { + listener->panelChanged (EvLlimd, limd->getTextValue()); + } + +} + + + +void Retinex::autoOpenCurve () +{ + cdshape->openIfNonlinear(); + cdshapeH->openIfNonlinear(); + transmissionShape->openIfNonlinear(); + +} + + +void Retinex::curveChanged (CurveEditor* ce) +{ + if (listener && getEnabled()) { + if (ce == cdshape) { + listener->panelChanged (EvLCDCurve, M("HISTORY_CUSTOMCURVE")); + } else if (ce == cdshapeH) { + listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE")); + } else if (ce == transmissionShape) { + listener->panelChanged (EvRetinextransmission, M("HISTORY_CUSTOMCURVE")); + } + } +} + +void Retinex::enabledChanged () +{ + + if (listener) { + if (get_inconsistent()) { + listener->panelChanged (EvRetinexEnabled, M("GENERAL_UNCHANGED")); + } else if (getEnabled()) { + listener->panelChanged (EvRetinexEnabled, M("GENERAL_ENABLED")); + } else { + listener->panelChanged (EvRetinexEnabled, M("GENERAL_DISABLED")); + } + } +} + + +void Retinex::trimValues (rtengine::procparams::ProcParams* pp) +{ + str->trimValue(pp->retinex.str); + scal->trimValue(pp->retinex.scal); + neigh->trimValue(pp->retinex.neigh); + gain->trimValue(pp->retinex.gain); + offs->trimValue(pp->retinex.offs); + vart->trimValue(pp->retinex.vart); + limd->trimValue(pp->retinex.limd); + +} + +void Retinex::setBatchMode (bool batchMode) +{ + ToolPanel::setBatchMode (batchMode); + neigh->showEditedCB (); + gain->showEditedCB (); + offs->showEditedCB (); + str->showEditedCB (); + scal->showEditedCB (); + vart->showEditedCB (); + limd->showEditedCB (); + curveEditorGD->setBatchMode (batchMode); + curveEditorGDH->setBatchMode (batchMode); + transmissionCurveEditorG->setBatchMode (batchMode); + + +} diff --git a/rtgui/dehaz.h b/rtgui/retinex.h similarity index 77% rename from rtgui/dehaz.h rename to rtgui/retinex.h index 13de88b1b..d2c71e083 100644 --- a/rtgui/dehaz.h +++ b/rtgui/retinex.h @@ -1,8 +1,8 @@ /* * This file is part of RawTherapee. */ -#ifndef _DEHAZ_H_ -#define _DEHAZ_H_ +#ifndef _RETINEX_H_ +#define _RETINEX_H_ #include #include "adjuster.h" @@ -13,7 +13,7 @@ #include "thresholdadjuster.h" #include "colorprovider.h" -class Dehaz : public ToolParamBlock, public FoldableToolPanel, public rtengine::DehazListener, public CurveListener, +class Retinex : public ToolParamBlock, public FoldableToolPanel, public rtengine::RetinexListener, public CurveListener, public AdjusterListener { @@ -28,14 +28,12 @@ protected: Adjuster* offs; Adjuster* vart; Adjuster* limd; - MyExpander* expretinex; + MyExpander* expsettings; Gtk::Label* labmdh; Gtk::HBox* dhbox; - MyComboBoxText* dehazmet; - MyComboBoxText* dehazcolorspace; - Gtk::CheckButton* retinex; - Gtk::Frame* dehazFrame; + MyComboBoxText* retinexMethod; + MyComboBoxText* retinexcolorspace; Gtk::CheckButton* medianmap; double nextmin; double nextmax; @@ -52,15 +50,15 @@ protected: DiagonalCurveEditor* cdshape; DiagonalCurveEditor* cdshapeH; CurveEditorGroup* transmissionCurveEditorG; - sigc::connection dehazmetConn; - sigc::connection dehazColorSpaceConn; + sigc::connection retinexMethodConn; + sigc::connection retinexColorSpaceConn; FlatCurveEditor* transmissionShape; - bool lastretinex, lastmedianmap; - sigc::connection retinexConn, medianmapConn; + bool lastmedianmap; + sigc::connection medianmapConn; public: - Dehaz (); - ~Dehaz (); + Retinex (); + ~Retinex (); void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = NULL); void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = NULL); @@ -69,7 +67,6 @@ public: void trimValues (rtengine::procparams::ProcParams* pp); void adjusterChanged (Adjuster* a, double newval); void autoOpenCurve (); - void retinexChanged (); void medianmapChanged (); void minmaxChanged (double cdma, double cdmin, double mini, double maxi, double Tmean, double Tsigma, double Tmin, double Tmax); bool minmaxComputed_ (); @@ -78,14 +75,13 @@ public: void enabledChanged (); void curveChanged (CurveEditor* ce); - void dehazmetChanged(); - void dehazColorSpaceChanged(); - void retinexUpdateUI(); + void retinexMethodChanged(); + void retinexColorSpaceChanged(); void ColorSpaceUpdateUI(); void writeOptions (std::vector &tpOpen); void updateToolState (std::vector &tpOpen); void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd); - + private: void foldAllButMe (GdkEventButton* event, MyExpander *expander); diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 5d1615e03..b93f2e98a 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -59,7 +59,7 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) colorappearance = Gtk::manage (new ColorAppearance ()); whitebalance = Gtk::manage (new WhiteBalance ()); vignetting = Gtk::manage (new Vignetting ()); - dehaz = Gtk::manage (new Dehaz ()); + retinex = Gtk::manage (new Retinex ()); gradient = Gtk::manage (new Gradient ()); pcvignette = Gtk::manage (new PCVignette ()); perspective = Gtk::manage (new PerspCorrection ()); @@ -126,8 +126,8 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc(NULL) toolPanels.push_back (colortoning); addPanel (exposurePanel, epd); toolPanels.push_back (epd); - addPanel (exposurePanel, dehaz); - toolPanels.push_back (dehaz); + addPanel (exposurePanel, retinex); + toolPanels.push_back (retinex); addPanel (exposurePanel, pcvignette); toolPanels.push_back (pcvignette); addPanel (exposurePanel, gradient); @@ -478,7 +478,7 @@ void ToolPanelCoordinator::initImage (rtengine::StagedImageProcessor* ipc_, bool ipc->setAutoColorTonListener (colortoning); ipc->setAutoChromaListener (dirpyrdenoise); ipc->setWaveletListener (wavelet); - ipc->setDehazListener (dehaz); + ipc->setRetinexListener (retinex); ipc->setSizeListener (crop); ipc->setSizeListener (resize); diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 868fad258..01717d903 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -51,7 +51,7 @@ #include "perspective.h" #include "rotate.h" #include "vignetting.h" -#include "dehaz.h" +#include "retinex.h" #include "gradient.h" #include "pcvignette.h" #include "toolbar.h" @@ -102,7 +102,7 @@ protected: WhiteBalance* whitebalance; Vignetting* vignetting; Gradient* gradient; - Dehaz* dehaz; + Retinex* retinex; PCVignette* pcvignette; LensGeometry* lensgeom; LensProfilePanel* lensProf; From 5402c3d27cf4123ecb1e5d4affccf0f580c2e3c6 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 11 Sep 2015 22:19:47 +0200 Subject: [PATCH 21/71] Optimizations for Retinex HSL mode --- rtengine/color.cc | 147 +++++++++++++++++++++++++++++ rtengine/color.h | 14 ++- rtengine/ipretinex.cc | 18 +--- rtengine/rawimagesource.cc | 189 +++++++++++++++++++++++-------------- 4 files changed, 282 insertions(+), 86 deletions(-) diff --git a/rtengine/color.cc b/rtengine/color.cc index d671d9baa..ed6e9cae6 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -280,6 +280,70 @@ void Color::rgb2hsl(float r, float g, float b, float &h, float &s, float &l) } } +void Color::rgb2hslfloat(float r, float g, float b, float &h, float &s, float &l) +{ + + float m = min(r, g, b); + float M = max(r, g, b); + float C = M - m; + + l = (M + m) * 7.6295109e-6f; // (0.5f / 65535.f) + + if (fabsf(C) < 0.65535f) { // 0.00001f * 65535.f + h = 0.f; + s = 0.f; + } else { + + if (l <= 0.5f) { + s = (M - m) / (M + m); + } else { + s = (M - m) / (131070.f - M - m); // 131070.f = 2.f * 65535.f + } + + if ( r == M ) { + h = (g - b); + } else if ( g == M ) { + h = (2.f * C) + (b - r); + } else { + h = (4.f * C) + (r - g); + } + + h /= (6.f * C); + + if ( h < 0.f ) { + h += 1.f; + } else if ( h > 1.f ) { + h -= 1.f; + } + } +} + +#ifdef __SSE2__ +void Color::rgb2hsl(vfloat r, vfloat g, vfloat b, vfloat &h, vfloat &s, vfloat &l) +{ + vfloat maxv = _mm_max_ps(r, _mm_max_ps(g, b)); + vfloat minv = _mm_min_ps(r, _mm_min_ps(g, b)); + vfloat C = maxv - minv; + vfloat tempv = maxv + minv; + l = (tempv) * F2V(7.6295109e-6f); + s = (maxv - minv); + s /= vself(vmaskf_gt(l, F2V(0.5f)), F2V(131070.f) - tempv, tempv); + + h = F2V(4.f) * C + r - g; + h = vself(vmaskf_eq(g, maxv), F2V(2.f) * C + b - r, h); + h = vself(vmaskf_eq(r, maxv), g - b, h); + + h /= (F2V(6.f) * C); + vfloat onev = F2V(1.f); + h = vself(vmaskf_lt(h, ZEROV), h + onev, h); + h = vself(vmaskf_gt(h, onev), h - onev, h); + + vmask zeromask = vmaskf_lt(vabsf(C), F2V(0.65535f)); + h = vself(zeromask, ZEROV, h); + s = vself(zeromask, ZEROV, s); +} +#endif + double Color::hue2rgb(double p, double q, double t) { if (t < 0.) { @@ -299,6 +363,42 @@ double Color::hue2rgb(double p, double q, double t) } } +float Color::hue2rgbfloat(float p, float q, float t) +{ + if (t < 0.f) { + t += 6.f; + } else if( t > 6.f) { + t -= 6.f; + } + + if (t < 1.f) { + return p + (q - p) * t; + } else if (t < 3.f) { + return q; + } else if (t < 4.f) { + return p + (q - p) * (4.f - t); + } else { + return p; + } +} + +#ifdef __SSE2__ +vfloat Color::hue2rgb(vfloat p, vfloat q, vfloat t) +{ + vfloat fourv = F2V(4.f); + vfloat threev = F2V(3.f); + vfloat sixv = threev + threev; + t = vself(vmaskf_lt(t, ZEROV), t + sixv, t); + t = vself(vmaskf_gt(t, sixv), t - sixv, t); + + vfloat temp1 = p + (q - p) * t; + vfloat temp2 = p + (q - p) * (fourv - t); + vfloat result = vself(vmaskf_lt(t, fourv), temp2, p); + result = vself(vmaskf_lt(t, threev), q, result); + return vself(vmaskf_lt(t, fourv - threev), temp1, result); +} +#endif + void Color::hsl2rgb (float h, float s, float l, float &r, float &g, float &b) { @@ -324,6 +424,53 @@ void Color::hsl2rgb (float h, float s, float l, float &r, float &g, float &b) } } +void Color::hsl2rgbfloat (float h, float s, float l, float &r, float &g, float &b) +{ + + if (s == 0.f) { + r = g = b = 65535.f * l; // achromatic + } else { + float m2; + + if (l <= 0.5f) { + m2 = l * (1.f + s); + } else { + m2 = l + s - l * s; + } + + float m1 = 2.f * l - m2; + + r = 65535.f * hue2rgbfloat (m1, m2, h * 6.f + 2.f); + g = 65535.f * hue2rgbfloat (m1, m2, h * 6.f); + b = 65535.f * hue2rgbfloat (m1, m2, h * 6.f - 2.f); + } +} + +#ifdef __SSE2__ +void Color::hsl2rgb (vfloat h, vfloat s, vfloat l, vfloat &r, vfloat &g, vfloat &b) +{ + + vfloat m2 = s * l; + m2 = vself(vmaskf_gt(l, F2V(0.5f)), s - m2, m2); + m2 += l; + + vfloat twov = F2V(2.f); + vfloat c65535v = F2V(65535.f); + vfloat m1 = l + l - m2; + + h *= F2V(6.f); + r = c65535v * hue2rgb (m1, m2, h + twov); + g = c65535v * hue2rgb (m1, m2, h); + b = c65535v * hue2rgb (m1, m2, h - twov); + + vmask selectsMask = vmaskf_eq(ZEROV, s); + vfloat lc65535v = c65535v * l; + r = vself(selectsMask, lc65535v, r); + g = vself(selectsMask, lc65535v, g); + b = vself(selectsMask, lc65535v, b); +} +#endif + void Color::hsl2rgb01 (float h, float s, float l, float &r, float &g, float &b) { diff --git a/rtengine/color.h b/rtengine/color.h index 493597a33..70dbcddf5 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -89,7 +89,10 @@ private: // Separated from init() to keep the code clear static void initMunsell (); static double hue2rgb(double p, double q, double t); - + static float hue2rgbfloat(float p, float q, float t); +#ifdef __SSE2__ + static vfloat hue2rgb(vfloat p, vfloat q, vfloat t); +#endif public: typedef enum Channel { @@ -179,7 +182,10 @@ public: * @param l luminance channel [0; 1] (return value) */ static void rgb2hsl (float r, float g, float b, float &h, float &s, float &l); - + static void rgb2hslfloat (float r, float g, float b, float &h, float &s, float &l); +#ifdef __SSE2__ + static void rgb2hsl (vfloat r, vfloat g, vfloat b, vfloat &h, vfloat &s, vfloat &l); +#endif /** * @brief Convert hue/saturation/luminance in red/green/blue @@ -191,6 +197,10 @@ public: * @param b blue channel [0 ; 65535] (return value) */ static void hsl2rgb (float h, float s, float l, float &r, float &g, float &b); + static void hsl2rgbfloat (float h, float s, float l, float &r, float &g, float &b); +#ifdef __SSE2__ + static void hsl2rgb (vfloat h, vfloat s, vfloat l, vfloat &r, vfloat &g, vfloat &b); +#endif /** * @brief Convert hue/saturation/luminance in red/green/blue diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 5a3b87213..c11150e4e 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -259,7 +259,8 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width out[i] = &outBuffer[i * W_L]; } - float pond = 1.0f / (float) scal; + float logBetaGain = xlogf(16384.f); + float pond = logBetaGain / (float) scal; #ifdef _OPENMP #pragma omp parallel @@ -284,6 +285,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for (int i = 0; i < H_L; i++) { int j = 0; #ifdef __SSE2__ + if(useHslLin) { for (; j < W_L - 3; j += 4) { _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * (LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); @@ -293,7 +295,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); } } + #endif + if(useHslLin) { for (; j < W_L; j++) { luminance[i][j] += pond * (LIM(src[i][j] / out[i][j], ilimD, limD)); @@ -312,23 +316,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width delete [] outBuffer; delete [] srcBuffer; - float logBetaGain = xlogf(16384.f); if (dehatransmissionCurve) { execcur = true; } -//I re-execute luminance[i][j] = logBetaGain * luminance[i][j] because I call 2 times (or one) mean_stdvv -// no difference or very little in time -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int i = 0; i < H_L; i++ ) - for (int j = 0; j < W_L; j++) { - luminance[i][j] = logBetaGain * luminance[i][j]; - } - mean = 0.f; stddv = 0.f; // I call mean_stddv2 instead of mean_stddv ==> logBetaGain diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index e6664dc06..ff3946e5c 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1842,49 +1842,83 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa bool useHsl = deh.retinexcolorspace == "HSLLOG"; bool useHslLin = deh.retinexcolorspace == "HSLLIN"; + if(useHsl || useHslLin) { +#ifdef _OPENMP + #pragma omp parallel +#endif + { +#ifdef __SSE2__ + vfloat c32768 = F2V(32768.f); +#endif +#ifdef _OPENMP + #pragma omp for +#endif + + for (int i = border; i < H - border; i++ ) + { + int j = border; +#ifdef __SSE2__ + + for (; j < W - border - 3; j += 4) { + vfloat H, S, L; + Color::rgb2hsl(LVFU(red[i][j]), LVFU(green[i][j]), LVFU(blue[i][j]), H, S, L); + _mm_storeu_ps(&labdeha->a[i - border][j - border], H); + _mm_storeu_ps(&labdeha->b[i - border][j - border], S); + L *= c32768; + _mm_storeu_ps(&labTmp[i - border][j - border], L); + + if(dehaHcontlutili) { // curve is not vectorized + for (int k = 0; k < 4; k++) { + labdeha->L[i - border][j - border + k] = cdHcurve[labTmp[i - border][j - border + k]]; + } + } else { + _mm_storeu_ps(&labdeha->L[i - border][j - border], L); + } + } + +#endif + + for (; j < W - border; j++) { + float H, S, L; + //rgb=>lab + Color::rgb2hslfloat(red[i][j], green[i][j], blue[i][j], labdeha->a[i - border][j - border], labdeha->b[i - border][j - border], L); + L *= 32768.f; + labTmp[i - border][j - border] = L; + + if(dehaHcontlutili) { + labdeha->L[i - border][j - border] = cdHcurve[labTmp[i - border][j - border]]; + } else { + labdeha->L[i - border][j - border] = labTmp[i - border][j - border]; + } + } + } + } + } else { + + // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) + // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) for (int j = border; j < W - border; j++) { - float H,S,L; + float X, Y, Z, L, aa, bb; //rgb=>lab - Color::rgb2hsl(red[i][j], green[i][j], blue[i][j],H,S,L); - // L *= 65535.f; - L *= 32768.f; + Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); + //convert Lab + Color::XYZ2Lab(X, Y, Z, L, aa, bb); labTmp[i - border][j - border] = L; - if(dehaHcontlutili) { - L = cdHcurve[L]; //apply curve to equalize histogram + if(dehacontlutili) { + L = cdcurve[L]; //apply curve to equalize histogram } labdeha->L[i - border][j - border] = L; - labdeha->a[i - border][j - border] = H; - labdeha->b[i - border][j - border] = S; + labdeha->a[i - border][j - border] = aa; + labdeha->b[i - border][j - border] = bb; } - } else { - - // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) - // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... -#ifdef _OPENMP - #pragma omp parallel for -#endif - - for (int i = border; i < H - border; i++ ) - for (int j = border; j < W - border; j++) { - float X, Y, Z, L, aa, bb; - //rgb=>lab - Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); - //convert Lab - Color::XYZ2Lab(X, Y, Z, L, aa, bb); - labTmp[i - border][j - border] = L; - - if(dehacontlutili) { - L = cdcurve[L]; //apply curve to equalize histogram - } - - labdeha->L[i - border][j - border] = L; - labdeha->a[i - border][j - border] = aa; - labdeha->b[i - border][j - border] = bb; - } } MSR(labdeha->L, labTmp, WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); @@ -1892,65 +1926,78 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa delete [] labTmpBuffer; if(useHsl || useHslLin) { +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { int j = border; +#ifdef __SSE2__ + vfloat c32768 = F2V(32768.f); + + for (; j < W - border - 3; j += 4) { + vfloat R, G, B; + Color::hsl2rgb(LVFU(labdeha->a[i - border][j - border]), LVFU(labdeha->b[i - border][j - border]), LVFU(labdeha->L[i - border][j - border]) / c32768, R, G, B); + + _mm_storeu_ps(&red[i][j], R); + _mm_storeu_ps(&green[i][j], G); + _mm_storeu_ps(&blue[i][j], B); + } + +#endif + for (; j < W - border; j++) { - float R, G, B; - // Color::hsl2rgb(labdeha->a[i - border][j - border],labdeha->b[i - border][j - border],labdeha->L[i - border][j - border]/65535.f,R,G,B); - Color::hsl2rgb(labdeha->a[i - border][j - border],labdeha->b[i - border][j - border],labdeha->L[i - border][j - border]/32768.f,R,G,B); - red[i][j] = R; - green[i][j] = G; - blue[i][j] = B; + Color::hsl2rgbfloat(labdeha->a[i - border][j - border], labdeha->b[i - border][j - border], labdeha->L[i - border][j - border] / 32768.f, red[i][j], green[i][j], blue[i][j]); } } } else { #ifdef __SSE2__ - vfloat wipv[3][3]; + vfloat wipv[3][3]; - for(int i = 0; i < 3; i++) - for(int j = 0; j < 3; j++) { - wipv[i][j] = F2V(wiprof[i][j]); - } + for(int i = 0; i < 3; i++) + for(int j = 0; j < 3; j++) { + wipv[i][j] = F2V(wiprof[i][j]); + } #endif // __SSE2__ #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel for #endif - for (int i = border; i < H - border; i++ ) { - int j = border; + for (int i = border; i < H - border; i++ ) { + int j = border; #ifdef __SSE2__ - for (; j < W - border - 3; j += 4) { - vfloat L2, a2, b2, x_, y_, z_; - vfloat R, G, B; - L2 = LVFU(labdeha->L[i - border][j - border]); - a2 = LVFU(labdeha->a[i - border][j - border]); - b2 = LVFU(labdeha->b[i - border][j - border]); - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; - Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); - _mm_storeu_ps(&red[i][j], R); - _mm_storeu_ps(&green[i][j], G); - _mm_storeu_ps(&blue[i][j], B); - } + for (; j < W - border - 3; j += 4) { + vfloat L2, a2, b2, x_, y_, z_; + vfloat R, G, B; + L2 = LVFU(labdeha->L[i - border][j - border]); + a2 = LVFU(labdeha->a[i - border][j - border]); + b2 = LVFU(labdeha->b[i - border][j - border]); + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); + _mm_storeu_ps(&red[i][j], R); + _mm_storeu_ps(&green[i][j], G); + _mm_storeu_ps(&blue[i][j], B); + } #endif - for (; j < W - border; j++) { - float L2, a2, b2, x_, y_, z_; - float R, G, B; - L2 = labdeha->L[i - border][j - border]; - a2 = labdeha->a[i - border][j - border]; - b2 = labdeha->b[i - border][j - border]; - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; - Color::xyz2rgb(x_, y_, z_, R, G, B, wip); - red[i][j] = R; - green[i][j] = G; - blue[i][j] = B; + for (; j < W - border; j++) { + float L2, a2, b2, x_, y_, z_; + float R, G, B; + L2 = labdeha->L[i - border][j - border]; + a2 = labdeha->a[i - border][j - border]; + b2 = labdeha->b[i - border][j - border]; + Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::xyz2rgb(x_, y_, z_, R, G, B, wip); + red[i][j] = R; + green[i][j] = G; + blue[i][j] = B; + } } } - } delete labdeha; From 9b73dfb91656be44368d83fef3e508ffe6a8cc8f Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 12 Sep 2015 00:44:24 +0200 Subject: [PATCH 22/71] Fix crash when using Retinex with some curves --- rtengine/ipretinex.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index c11150e4e..f732a108e 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -329,7 +329,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width // printf("mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", mean, stddv, delta, maxtr, mintr); // mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain, maxtr, mintr); - if (execcur) { //if curve + if (execcur && mean != 0.f && stddv != 0.f) { //if curve float asig = 0.166666f / stddv; float bsig = 0.5f - asig * mean; //float insigma = 0.66666f; //SD From e8d1e14282034c5710d8669a84bc9dd38b8a0c55 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 12 Sep 2015 08:09:32 +0200 Subject: [PATCH 23/71] small bug in GUI --- rtgui/retinex.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index f15f7d276..1e4d67c99 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -432,13 +432,16 @@ void Retinex::retinexMethodChanged() void Retinex::ColorSpaceUpdateUI () { - if (!batchMode) { + if (!batchMode) { if(retinexcolorspace->get_active_row_number() == 0) { curveEditorGD->show(); curveEditorGDH->hide(); } else if(retinexcolorspace->get_active_row_number() == 1) { curveEditorGD->hide(); curveEditorGDH->show(); + } else if(retinexcolorspace->get_active_row_number() == 2) { + curveEditorGD->hide(); + curveEditorGDH->show(); } } } From 2fd42e79eab4c118ec81515b9e1f13f7a08cf915 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 12 Sep 2015 19:58:43 +0200 Subject: [PATCH 24/71] Bug in Histogram equalizer curve --- rtengine/procparams.cc | 16 ++++++++-------- rtengine/rawimagesource.cc | 7 +++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 0c9aef7d2..1655c5eb5 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -143,14 +143,14 @@ void RetinexParams::getDefaulttransmissionCurve(std::vector &curve) void RetinexParams::getDefaultCDCurve(std::vector &curve) { - double v[10] = { 0., 0., - 0.25, 0.25, - 0.5, 0.5, - 0.75, 0.75, + double v[4] = { 0., 0., + // 0.25, 0.25, + // 0.5, 0.5, + // 0.75, 0.75, 1., 1., }; - curve.resize(11); + curve.resize(5); curve.at(0) = double(DCT_NURBS); for (size_t i = 1; i < curve.size(); ++i) { @@ -160,12 +160,12 @@ void RetinexParams::getDefaultCDCurve(std::vector &curve) void RetinexParams::getDefaultCDHCurve(std::vector &curve) { - double v[6] = { 0.00, 0.00, - 0.5, 0.5, + double v[4] = { 0.00, 0.00, + // 0.5, 0.5, 1.0, 1.0, }; - curve.resize(7); + curve.resize(5); curve.at(0) = double(DCT_NURBS); for (size_t i = 1; i < curve.size(); ++i) { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index ff3946e5c..a39fed126 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1870,7 +1870,7 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa if(dehaHcontlutili) { // curve is not vectorized for (int k = 0; k < 4; k++) { - labdeha->L[i - border][j - border + k] = cdHcurve[labTmp[i - border][j - border + k]]; + labdeha->L[i - border][j - border + k] = cdHcurve[2.f*labTmp[i - border][j - border + k]]/2.f; } } else { _mm_storeu_ps(&labdeha->L[i - border][j - border], L); @@ -1887,7 +1887,7 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa labTmp[i - border][j - border] = L; if(dehaHcontlutili) { - labdeha->L[i - border][j - border] = cdHcurve[labTmp[i - border][j - border]]; + labdeha->L[i - border][j - border] = cdHcurve[2.f*labTmp[i - border][j - border]]/2.f; } else { labdeha->L[i - border][j - border] = labTmp[i - border][j - border]; } @@ -1901,7 +1901,6 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa #ifdef _OPENMP #pragma omp parallel for #endif - for (int i = border; i < H - border; i++ ) for (int j = border; j < W - border; j++) { float X, Y, Z, L, aa, bb; @@ -1912,7 +1911,7 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa labTmp[i - border][j - border] = L; if(dehacontlutili) { - L = cdcurve[L]; //apply curve to equalize histogram + L = cdcurve[L*2.f]/2.f; //apply curve to equalize histogram } labdeha->L[i - border][j - border] = L; From bc841d98085761eaa40c075fa5bdf5549fd0d92e Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 13 Sep 2015 00:39:55 +0200 Subject: [PATCH 25/71] Retinex, only demosaic when enabled/disabled or Colorspace changes --- rtengine/curves.cc | 22 ----- rtengine/curves.h | 1 - rtengine/imagesource.h | 7 +- rtengine/improccoordinator.cc | 32 +++---- rtengine/improccoordinator.h | 3 +- rtengine/procevents.h | 2 +- rtengine/rawimagesource.cc | 168 +++++++++++++++++----------------- rtengine/rawimagesource.h | 4 +- rtengine/refreshmap.cc | 28 +++--- rtengine/simpleprocess.cc | 13 +-- 10 files changed, 125 insertions(+), 155 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index d05a9dd12..86f74c92f 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -526,28 +526,6 @@ void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip) -{ - bool needed = false; - DiagonalCurve* dCurve = NULL; - - if (!dehaclcurvePoints.empty() && dehaclcurvePoints[0] != 0) { - dCurve = new DiagonalCurve (dehaclcurvePoints, CURVES_MIN_POLY_POINTS / skip); - - if (dCurve && !dCurve->isIdentity()) { - needed = true; - dehaHcontlutili = true; - } - } - - fillCurveArray(dCurve, dehaclCurve, skip, needed); - - if (dCurve) { - delete dCurve; - dCurve = NULL; - } -} - // add curve Lab wavelet : Cont=f(L) void CurveFactory::curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve, /*LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip) { diff --git a/rtengine/curves.h b/rtengine/curves.h index b85088143..264163b53 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -283,7 +283,6 @@ public: static void curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve,/* LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip); static void curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip); - static void curveDehaHContL ( bool & dehaHcontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip); static void curveToningCL ( bool & clctoningutili, const std::vector& clcurvePoints, LUTf & clToningCurve, int skip); static void curveToningLL ( bool & llctoningutili, const std::vector& llcurvePoints, LUTf & llToningCurve, int skip); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 98730ac1b..ff2c00161 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,17 +69,16 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; -// virtual void // retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili) {}; - virtual void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; + virtual void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; + virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl) {}; + virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; virtual void HLRecovery_inpaint (float** red, float** green, float** blue) {}; -// virtual void MSR(LabImage* lab, int width, int height, int skip, RetinexParams lcur) {}; virtual void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; virtual bool IsrgbSourceModified() = 0; // tracks whether cached rgb output of demosaic has been modified - // virtual void MSR(LabImage* lab, int width, int height, int skip, const LCurveParams &lcur); // use right after demosaicing image, add coarse transformation and put the result in the provided Imagefloat* virtual void getImage (ColorTemp ctemp, int tran, Imagefloat* image, PreviewProps pp, ToneCurveParams hlp, ColorManagementParams cmp, RAWParams raw) {} diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 6a0933d14..3fcc1e64b 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -46,8 +46,6 @@ ImProcCoordinator::ImProcCoordinator () satcurve(65536, 0), lhskcurve(65536, 0), clcurve(65536, 0), - cdcurve(65536, 0), - cdHcurve(65536, 0), wavclCurve(65536, 0), clToningcurve(65536, 0), cl2Toningcurve(65536, 0), @@ -89,7 +87,7 @@ ImProcCoordinator::ImProcCoordinator () pW(-1), pH(-1), plistener(NULL), imageListener(NULL), aeListener(NULL), acListener(NULL), abwListener(NULL), actListener(NULL), adnListener(NULL), awavListener(NULL), dehaListener(NULL), hListener(NULL), resultValid(false), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), wavcontlutili(false), - butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false) + butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), conversionBuffer(1, 1) {} @@ -237,22 +235,24 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } if (params.retinex.enabled) { - bool dehacontlutili = false; - bool dehaHcontlutili = false; - CurveFactory::curveDehaContL (dehacontlutili, params.retinex.cdcurve, cdcurve, 1); - CurveFactory::curveDehaHContL (dehaHcontlutili, params.retinex.cdHcurve, cdHcurve, 1); - RetinexParams DehaParams = params.retinex; - DehaParams.getCurves(dehatransmissionCurve); - float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.raw, params.icm, params.retinex, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Retinex - - if(dehaListener) { - dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); - } - + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer); } } + if (params.retinex.enabled) { + bool dehacontlutili = false; + bool useHsl = false; + LUTf cdcurve (65536, 0); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl); + float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; + imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Retinex + + if(dehaListener) { + dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + } + } + + // Updating toneCurve.hrenabled if necessary // It has to be done there, because the next 'if' statement will use the value computed here if (todo & M_AUTOEXP) { diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 4ba9bc7c9..fb24b5632 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -94,8 +94,7 @@ protected: LUTf satcurve; LUTf lhskcurve; LUTf clcurve; - LUTf cdcurve; - LUTf cdHcurve; + multi_array2D conversionBuffer; LUTf wavclCurve; LUTf clToningcurve; LUTf cl2Toningcurve; diff --git a/rtengine/procevents.h b/rtengine/procevents.h index c71e8d9f1..1a6216750 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -444,7 +444,7 @@ enum ProcEvent { EvRetinexEnabled = 415, EvRetinexmedianmap = 416, EvLlimd = 417, - EvretinexColorSpace = 406, //change to 418 if we want a separate history entry "Retinex - Color space" + EvretinexColorSpace = 418, //change to 418 if we want a separate history entry "Retinex - Color space" EvLCDHCurve = 419, NUMOFEVENTS }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index a39fed126..76eb5bee5 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1801,49 +1801,15 @@ void RawImageSource::demosaic(const RAWParams &raw) } } -void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) + +void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer) { + bool useHsl = (retinexParams.retinexcolorspace == "HSLLOG" || retinexParams.retinexcolorspace == "HSLLIN"); + conversionBuffer[0] (W - 2 * border, H - 2 * border); + conversionBuffer[1] (W - 2 * border, H - 2 * border); + conversionBuffer[2] (W - 2 * border, H - 2 * border); - MyTime t4, t5; - t4.set(); - - if (settings->verbose) { - printf ("Applying Retinex\n"); - } - - TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); - TMatrix wiprof = iccStore->workingSpaceInverseMatrix (cmp.working); - - double wip[3][3] = { - {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, - {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, - {wiprof[2][0], wiprof[2][1], wiprof[2][2]} - }; - - double wp[3][3] = { - {wprof[0][0], wprof[0][1], wprof[0][2]}, - {wprof[1][0], wprof[1][1], wprof[1][2]}, - {wprof[2][0], wprof[2][1], wprof[2][2]} - }; - - // We need a buffer with original L data to allow correct blending - // red, green and blue still have original size of raw, but we can't use the borders - const int HNew = H - 2 * border; - const int WNew = W - 2 * border; - - LabImage * labdeha = new LabImage(WNew, HNew); - - float *labTmp[HNew] ALIGNED16; - float *labTmpBuffer = new float[HNew * WNew]; - - for (int i = 0; i < HNew; i++) { - labTmp[i] = &labTmpBuffer[i * WNew]; - } - - bool useHsl = deh.retinexcolorspace == "HSLLOG"; - bool useHslLin = deh.retinexcolorspace == "HSLLIN"; - - if(useHsl || useHslLin) { + if(useHsl) { #ifdef _OPENMP #pragma omp parallel #endif @@ -1863,18 +1829,10 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa for (; j < W - border - 3; j += 4) { vfloat H, S, L; Color::rgb2hsl(LVFU(red[i][j]), LVFU(green[i][j]), LVFU(blue[i][j]), H, S, L); - _mm_storeu_ps(&labdeha->a[i - border][j - border], H); - _mm_storeu_ps(&labdeha->b[i - border][j - border], S); + _mm_storeu_ps(&conversionBuffer[0][i - border][j - border], H); + _mm_storeu_ps(&conversionBuffer[1][i - border][j - border], S); L *= c32768; - _mm_storeu_ps(&labTmp[i - border][j - border], L); - - if(dehaHcontlutili) { // curve is not vectorized - for (int k = 0; k < 4; k++) { - labdeha->L[i - border][j - border + k] = cdHcurve[2.f*labTmp[i - border][j - border + k]]/2.f; - } - } else { - _mm_storeu_ps(&labdeha->L[i - border][j - border], L); - } + _mm_storeu_ps(&conversionBuffer[2][i - border][j - border], L); } #endif @@ -1882,25 +1840,26 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa for (; j < W - border; j++) { float H, S, L; //rgb=>lab - Color::rgb2hslfloat(red[i][j], green[i][j], blue[i][j], labdeha->a[i - border][j - border], labdeha->b[i - border][j - border], L); + Color::rgb2hslfloat(red[i][j], green[i][j], blue[i][j], conversionBuffer[0][i - border][j - border], conversionBuffer[1][i - border][j - border], L); L *= 32768.f; - labTmp[i - border][j - border] = L; - - if(dehaHcontlutili) { - labdeha->L[i - border][j - border] = cdHcurve[2.f*labTmp[i - border][j - border]]/2.f; - } else { - labdeha->L[i - border][j - border] = labTmp[i - border][j - border]; - } + conversionBuffer[2][i - border][j - border] = L; } } } } else { + TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); + double wp[3][3] = { + {wprof[0][0], wprof[0][1], wprof[0][2]}, + {wprof[1][0], wprof[1][1], wprof[1][2]}, + {wprof[2][0], wprof[2][1], wprof[2][2]} + }; // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... #ifdef _OPENMP #pragma omp parallel for #endif + for (int i = border; i < H - border; i++ ) for (int j = border; j < W - border; j++) { float X, Y, Z, L, aa, bb; @@ -1908,23 +1867,60 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); //convert Lab Color::XYZ2Lab(X, Y, Z, L, aa, bb); - labTmp[i - border][j - border] = L; - - if(dehacontlutili) { - L = cdcurve[L*2.f]/2.f; //apply curve to equalize histogram - } - - labdeha->L[i - border][j - border] = L; - labdeha->a[i - border][j - border] = aa; - labdeha->b[i - border][j - border] = bb; + conversionBuffer[0][i - border][j - border] = aa; + conversionBuffer[1][i - border][j - border] = bb; + conversionBuffer[2][i - border][j - border] = L; } } +} - MSR(labdeha->L, labTmp, WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); +void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl) +{ + useHsl = (retinexParams.retinexcolorspace == "HSLLOG" || retinexParams.retinexcolorspace == "HSLLIN"); - delete [] labTmpBuffer; + if(useHsl) { + CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdHcurve, cdcurve, 1); + } else { + CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdcurve, cdcurve, 1); + } - if(useHsl || useHslLin) { + retinexParams.getCurves(retinextransmissionCurve); +} + +void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +{ + + MyTime t4, t5; + t4.set(); + + if (settings->verbose) { + printf ("Applying Retinex\n"); + } + + // We need a buffer with original L data to allow correct blending + // red, green and blue still have original size of raw, but we can't use the borders + const int HNew = H - 2 * border; + const int WNew = W - 2 * border; + + array2D LBuffer (WNew, HNew); + float **temp = conversionBuffer[2]; // one less dereference +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int i = 0; i < H - 2 * border; i++ ) + if(dehacontlutili) + for (int j = 0; j < W - 2 * border; j++) { + LBuffer[i][j] = cdcurve[2.f * temp[i][j]] / 2.f; + } + else + for (int j = 0; j < W - 2 * border; j++) { + LBuffer[i][j] = temp[i][j]; + } + + MSR(LBuffer, conversionBuffer[2], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + + if(useHsl) { #ifdef _OPENMP #pragma omp parallel for #endif @@ -1936,7 +1932,7 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa for (; j < W - border - 3; j += 4) { vfloat R, G, B; - Color::hsl2rgb(LVFU(labdeha->a[i - border][j - border]), LVFU(labdeha->b[i - border][j - border]), LVFU(labdeha->L[i - border][j - border]) / c32768, R, G, B); + Color::hsl2rgb(LVFU(conversionBuffer[0][i - border][j - border]), LVFU(conversionBuffer[1][i - border][j - border]), LVFU(LBuffer[i - border][j - border]) / c32768, R, G, B); _mm_storeu_ps(&red[i][j], R); _mm_storeu_ps(&green[i][j], G); @@ -1946,11 +1942,19 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa #endif for (; j < W - border; j++) { - Color::hsl2rgbfloat(labdeha->a[i - border][j - border], labdeha->b[i - border][j - border], labdeha->L[i - border][j - border] / 32768.f, red[i][j], green[i][j], blue[i][j]); + Color::hsl2rgbfloat(conversionBuffer[0][i - border][j - border], conversionBuffer[1][i - border][j - border], LBuffer[i - border][j - border] / 32768.f, red[i][j], green[i][j], blue[i][j]); } } } else { + TMatrix wiprof = iccStore->workingSpaceInverseMatrix (cmp.working); + + double wip[3][3] = { + {wiprof[0][0], wiprof[0][1], wiprof[0][2]}, + {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, + {wiprof[2][0], wiprof[2][1], wiprof[2][2]} + }; + #ifdef __SSE2__ vfloat wipv[3][3]; @@ -1969,12 +1973,9 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa #ifdef __SSE2__ for (; j < W - border - 3; j += 4) { - vfloat L2, a2, b2, x_, y_, z_; + vfloat x_, y_, z_; vfloat R, G, B; - L2 = LVFU(labdeha->L[i - border][j - border]); - a2 = LVFU(labdeha->a[i - border][j - border]); - b2 = LVFU(labdeha->b[i - border][j - border]); - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::Lab2XYZ(LVFU(LBuffer[i - border][j - border]), LVFU(conversionBuffer[0][i - border][j - border]), LVFU(conversionBuffer[1][i - border][j - border]), x_, y_, z_) ; Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); _mm_storeu_ps(&red[i][j], R); _mm_storeu_ps(&green[i][j], G); @@ -1984,12 +1985,9 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa #endif for (; j < W - border; j++) { - float L2, a2, b2, x_, y_, z_; + float x_, y_, z_; float R, G, B; - L2 = labdeha->L[i - border][j - border]; - a2 = labdeha->a[i - border][j - border]; - b2 = labdeha->b[i - border][j - border]; - Color::Lab2XYZ(L2, a2, b2, x_, y_, z_) ; + Color::Lab2XYZ(LBuffer[i - border][j - border], conversionBuffer[0][i - border][j - border], conversionBuffer[1][i - border][j - border], x_, y_, z_) ; Color::xyz2rgb(x_, y_, z_, R, G, B, wip); red[i][j] = R; green[i][j] = G; @@ -1998,8 +1996,6 @@ void RawImageSource::retinex(RAWParams raw, ColorManagementParams cmp, RetinexPa } } - delete labdeha; - t5.set(); if( settings->verbose ) { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 5cb0c74a5..2a2249630 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,7 +152,9 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili); - void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, LUTf & cdHcurve, const RetinextransmissionCurve & dehatransmissionCurve, bool dehacontlutili, bool dehaHcontlutili, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl); + void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 0c4f9bf1d..9acea5dd6 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -428,21 +428,21 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavedgeampli DIRPYREQUALIZER, //EvWavlev3nois DIRPYREQUALIZER, //EvWavNPmet - DEMOSAIC, // EvretinexMethod - DEMOSAIC, // EvLneigh - DEMOSAIC, // EvLgain - DEMOSAIC, // EvLoffs - DEMOSAIC, // EvLstr - DEMOSAIC, // EvLscal - DEMOSAIC, // EvLvart - DEMOSAIC, // EvLCDCurve - DEMOSAIC, // EvRetinexOpacity - DEMOSAIC, // EvRetinexEnabled - DEMOSAIC, // EvRetinexretinex <-- TODO we can probably delete this - DEMOSAIC, // EvRetinexmedianmap - DEMOSAIC, // EvLlimd + DEMOSAIC, // Unused? + ALLNORAW, // EvretinexMethod + ALLNORAW, // EvLneigh + ALLNORAW, // EvLgain + ALLNORAW, // EvLoffs was EvLstr + ALLNORAW, // EvLstr was EvLscal + ALLNORAW, // EvLscal was EvLvart + ALLNORAW, // EvLvart was EvLCDCurve + ALLNORAW, // EvRetinexOpacity // not used + ALLNORAW, // EvRetinextransmission + DEMOSAIC, // EvRetinexEnabled was EvRetinexretinex <-- TODO we can probably delete this + ALLNORAW, // EvRetinexmedianmap + ALLNORAW, // EvLlimd DEMOSAIC, // Evretinexcolorspace - DEMOSAIC // EvLCDHCurve + ALLNORAW // EvLCDHCurve }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index a3f18f770..5a07e587f 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -118,17 +118,14 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if(params.retinex.enabled) { //enabled Retinex LUTf cdcurve (65536, 0); - LUTf cdHcurve (65536, 0); RetinextransmissionCurve dehatransmissionCurve; - bool dehacontlutili = false; - bool dehaHcontlutili = false; - CurveFactory::curveDehaContL (dehacontlutili, params.retinex.cdcurve, cdcurve, 1); - CurveFactory::curveDehaHContL (dehaHcontlutili, params.retinex.cdHcurve, cdHcurve, 1); - RetinexParams DehaParams = params.retinex; - DehaParams.getCurves(dehatransmissionCurve); + bool useHsl = false; + multi_array2D conversionBuffer(1, 1); + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.raw, params.icm, params.retinex, cdcurve, cdHcurve, dehatransmissionCurve, dehacontlutili, dehaHcontlutili, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } if (pl) { From 4720231d5384e7b0061ecc2911a89bf05630a799 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 13 Sep 2015 01:24:46 +0200 Subject: [PATCH 26/71] Retinex: Set delay for sliders to 200 ms to avoid double processing when moving sliders --- rtgui/retinex.cc | 55 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 10 deletions(-) diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 1e4d67c99..835d05ae3 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -166,12 +166,47 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), expsettings->add(*settingsVBox); str->setAdjusterListener (this); + + if (str->delay < 200) { + str->delay = 200; + } + scal->setAdjusterListener (this); + + if (scal->delay < 200) { + scal->delay = 200; + } + neigh->setAdjusterListener (this); + + if (neigh->delay < 200) { + neigh->delay = 200; + } + gain->setAdjusterListener (this); + + if (gain->delay < 200) { + gain->delay = 200; + } + offs->setAdjusterListener (this); + + if (offs->delay < 200) { + offs->delay = 200; + } + vart->setAdjusterListener (this); + + if (vart->delay < 200) { + vart->delay = 200; + } + limd->setAdjusterListener (this); + + if (limd->delay < 200) { + limd->delay = 200; + } + pack_start (*retinexVBox); pack_start (*expsettings); @@ -432,16 +467,16 @@ void Retinex::retinexMethodChanged() void Retinex::ColorSpaceUpdateUI () { - if (!batchMode) { - if(retinexcolorspace->get_active_row_number() == 0) { - curveEditorGD->show(); - curveEditorGDH->hide(); + if (!batchMode) { + if(retinexcolorspace->get_active_row_number() == 0) { + curveEditorGD->show(); + curveEditorGDH->hide(); } else if(retinexcolorspace->get_active_row_number() == 1) { - curveEditorGD->hide(); - curveEditorGDH->show(); + curveEditorGD->hide(); + curveEditorGDH->show(); } else if(retinexcolorspace->get_active_row_number() == 2) { - curveEditorGD->hide(); - curveEditorGDH->show(); + curveEditorGD->hide(); + curveEditorGDH->show(); } } } @@ -519,7 +554,7 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi } void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd) - { +{ str->setAddMode(strAdd); neigh->setAddMode(neighAdd); @@ -528,7 +563,7 @@ void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, boo gain->setAddMode(gainAdd); offs->setAddMode(offsAdd); vart->setAddMode(vartAdd); - } +} void Retinex::adjusterChanged (Adjuster* a, double newval) From 192569a6bd62937933afda6c42472cfffd73450d Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 14 Sep 2015 01:46:17 +0200 Subject: [PATCH 27/71] retinex: changed gaussian part to reduce halos, small increase in processing time --- rtengine/ipretinex.cc | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index f732a108e..8ffe119b6 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -268,9 +268,25 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width { AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); - for ( int scale = 0; scale < scal; scale++ ) { - gaussHorizontal (src, out, *pBuffer, W_L, H_L, RetinexScales[scale]); - gaussVertical (out, out, *pBuffer, W_L, H_L, RetinexScales[scale]); + for ( int scale = scal - 1; scale >= 0; scale-- ) { + float ** source; + float sigma; + + if(scale == scal - 1) { // probably large sigma. Use double gauss with sigma divided by sqrt(2.0) + sigma = RetinexScales[scale] / sqrt(2.0); + source = src; + } else { // reuse result of last iteration + sigma = sqrtf((RetinexScales[scale] * RetinexScales[scale]) / (RetinexScales[scale + 1] * RetinexScales[scale + 1])); + source = out; + } + + gaussHorizontal (source, out, *pBuffer, W_L, H_L, sigma); + gaussVertical (out, out, *pBuffer, W_L, H_L, sigma); + + if(scale == scal - 1) { // probably large sigma. Use double gauss with sigma divided by sqrt(2.0) + gaussHorizontal (out, out, *pBuffer, W_L, H_L, sigma); + gaussVertical (out, out, *pBuffer, W_L, H_L, sigma); + } #ifdef __SSE2__ vfloat pondv = F2V(pond); From 864ab0685d5fe359f39266578fc99784d14954b7 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 14 Sep 2015 03:01:04 +0200 Subject: [PATCH 28/71] Retinex: Fixed wrong gaussian part for methods 'low' and 'uniform' --- rtengine/ipretinex.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 8ffe119b6..a104a0c41 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -70,20 +70,20 @@ void retinex_scales( float* scales, int nscales, int mode, int s) if ( nscales == 1 ) { scales[0] = (float)s / 2.f; } else if (nscales == 2) { - scales[0] = (float) s / 2.f; - scales[1] = (float) s; + scales[1] = (float) s / 2.f; + scales[0] = (float) s; } else { float size_step = (float) s / (float) nscales; if (mode == 0) { for (int i = 0; i < nscales; ++i ) { - scales[i] = 2.0f + (float)i * size_step; + scales[nscales - i - 1] = 2.0f + (float)i * size_step; } } else if (mode == 1) { size_step = (float)log(s - 2.0f) / (float) nscales; for (int i = 0; i < nscales; ++i ) { - scales[i] = 2.0f + (float)pow (10.f, (i * size_step) / log (10.f)); + scales[nscales - i - 1] = 2.0f + (float)pow (10.f, (i * size_step) / log (10.f)); } } else if (mode == 2) { size_step = (float) log(s - 2.0f) / (float) nscales; From 48690e0fab4c3753611832b15fe0651ffbbcf46d Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 14 Sep 2015 12:21:14 +0200 Subject: [PATCH 29/71] Retinex, correction for last patch --- rtengine/ipretinex.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index a104a0c41..29456cddd 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -271,12 +271,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for ( int scale = scal - 1; scale >= 0; scale-- ) { float ** source; float sigma; - if(scale == scal - 1) { // probably large sigma. Use double gauss with sigma divided by sqrt(2.0) sigma = RetinexScales[scale] / sqrt(2.0); source = src; } else { // reuse result of last iteration - sigma = sqrtf((RetinexScales[scale] * RetinexScales[scale]) / (RetinexScales[scale + 1] * RetinexScales[scale + 1])); + sigma = sqrtf((RetinexScales[scale] * RetinexScales[scale]) - (RetinexScales[scale + 1] * RetinexScales[scale + 1])); source = out; } From 270367c592360b8423ba8b7e0a2a02329b051d72 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 14 Sep 2015 13:14:28 +0200 Subject: [PATCH 30/71] Display histogram L in Histogram equalizer --- rtengine/curves.cc | 14 +++++++++- rtengine/curves.h | 2 +- rtengine/imagesource.h | 6 ++--- rtengine/improccoordinator.cc | 14 +++++++--- rtengine/improccoordinator.h | 3 ++- rtengine/rawimagesource.cc | 49 ++++++++++++++++++++++++++++++----- rtengine/rawimagesource.h | 6 ++--- rtengine/rtengine.h | 2 +- rtengine/simpleprocess.cc | 7 ++--- rtgui/colorappearance.cc | 2 +- rtgui/colorappearance.h | 2 +- rtgui/editorpanel.cc | 4 +-- rtgui/editorpanel.h | 2 +- rtgui/labcurve.cc | 2 +- rtgui/labcurve.h | 2 +- rtgui/retinex.cc | 6 +++++ rtgui/retinex.h | 1 + rtgui/rgbcurves.cc | 2 +- rtgui/rgbcurves.h | 2 +- rtgui/tonecurve.cc | 2 +- rtgui/tonecurve.h | 2 +- rtgui/toolpanelcoord.cc | 12 +++++---- rtgui/toolpanelcoord.h | 2 +- 23 files changed, 106 insertions(+), 40 deletions(-) diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 86f74c92f..2d355a071 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -504,19 +504,31 @@ void CurveFactory::curveCL ( bool & clcutili, const std::vector& clcurve } } -void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip) +void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip, LUTu & histogram, LUTu & outBeforeCurveHistogram) { bool needed = false; DiagonalCurve* dCurve = NULL; + outBeforeCurveHistogram.clear(); + bool histNeeded = false; if (!dehaclcurvePoints.empty() && dehaclcurvePoints[0] != 0) { dCurve = new DiagonalCurve (dehaclcurvePoints, CURVES_MIN_POLY_POINTS / skip); + if (outBeforeCurveHistogram) { + histNeeded = true; + } if (dCurve && !dCurve->isIdentity()) { needed = true; dehacontlutili = true; } } + if (histNeeded) { + for (int i = 0; i < 32768; i++) { + double hval = CLIPD((double)i / 32767.0); + int hi = (int)(255.0 * hval); + outBeforeCurveHistogram[hi] += histogram[i] ; + } + } fillCurveArray(dCurve, dehaclCurve, skip, needed); diff --git a/rtengine/curves.h b/rtengine/curves.h index 264163b53..f0643c7a9 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -282,7 +282,7 @@ public: static void curveCL ( bool & clcutili, const std::vector& clcurvePoints, LUTf & clCurve, LUTu & histogramcl, LUTu & outBeforeCLurveHistogram, int skip); static void curveWavContL ( bool & wavcontlutili, const std::vector& wavclcurvePoints, LUTf & wavclCurve,/* LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,*/int skip); - static void curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip); + static void curveDehaContL ( bool & dehacontlutili, const std::vector& dehaclcurvePoints, LUTf & dehaclCurve, int skip, LUTu & histogram, LUTu & outBeforeCurveHistogram); static void curveToningCL ( bool & clctoningutili, const std::vector& clcurvePoints, LUTf & clToningCurve, int skip); static void curveToningLL ( bool & llctoningutili, const std::vector& llcurvePoints, LUTf & llToningCurve, int skip); diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index ff2c00161..568134880 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,9 +69,9 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; - virtual void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) {}; - virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl) {}; - virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer) {}; + virtual void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu & lhist16RETI, LUTu &histLRETI) {}; + virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; + virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 3fcc1e64b..fccb2ab8e 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -55,6 +55,7 @@ ImProcCoordinator::ImProcCoordinator () lhist16(65536), lhist16Cropped(65536), lhist16CAM(65536), lhist16CroppedCAM(65536), lhist16CCAM(65536), + lhist16RETI(65536), histCropped(65536), lhist16Clad(65536), lhist16CLlad(65536), lhist16LClad(65536), lhist16LLClad(65536), @@ -75,6 +76,8 @@ ImProcCoordinator::ImProcCoordinator () bcabhist(256), histChroma(256), + histLRETI(256), + CAMBrightCurveJ(), CAMBrightCurveQ(), rCurve(), @@ -235,7 +238,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } if (params.retinex.enabled) { - imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer); + lhist16RETI.clear(); + + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, lhist16RETI); } } @@ -243,9 +248,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) bool dehacontlutili = false; bool useHsl = false; LUTf cdcurve (65536, 0); - imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl); + + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, lhist16RETI, histLRETI); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);//enabled Retinex + imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, lhist16RETI, histLRETI);//enabled Retinex if(dehaListener) { dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); @@ -832,7 +838,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (hListener) { updateLRGBHistograms (); - hListener->histogramChanged (histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma); + hListener->histogramChanged (histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma, histLRETI); } } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index fb24b5632..3266a6c0a 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -105,13 +105,14 @@ protected: LUTu lhist16, lhist16Cropped; LUTu lhist16CAM, lhist16CroppedCAM; LUTu lhist16CCAM; + LUTu lhist16RETI; LUTu histCropped; LUTu lhist16Clad, lhist16CLlad, lhist16LClad, lhist16LLClad; LUTu histRed, histRedRaw; LUTu histGreen, histGreenRaw; LUTu histBlue, histBlueRaw; LUTu histLuma, histToneCurve, histToneCurveBW, histLCurve, histCCurve, histCLurve; - LUTu histLLCurve, histLCAM, histCCAM, histClad, bcabhist, histChroma; + LUTu histLLCurve, histLCAM, histCCAM, histClad, bcabhist, histChroma, histLRETI; LUTf CAMBrightCurveJ, CAMBrightCurveQ; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 76eb5bee5..988ad50af 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -41,6 +41,9 @@ #endif #include "opthelper.h" #include "StopWatch.h" +#define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) +#undef CLIPD +#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f) namespace rtengine { @@ -1802,7 +1805,7 @@ void RawImageSource::demosaic(const RAWParams &raw) } -void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer) +void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) { bool useHsl = (retinexParams.retinexcolorspace == "HSLLOG" || retinexParams.retinexcolorspace == "HSLLIN"); conversionBuffer[0] (W - 2 * border, H - 2 * border); @@ -1828,21 +1831,27 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar for (; j < W - border - 3; j += 4) { vfloat H, S, L; + int pos; Color::rgb2hsl(LVFU(red[i][j]), LVFU(green[i][j]), LVFU(blue[i][j]), H, S, L); _mm_storeu_ps(&conversionBuffer[0][i - border][j - border], H); _mm_storeu_ps(&conversionBuffer[1][i - border][j - border], S); L *= c32768; _mm_storeu_ps(&conversionBuffer[2][i - border][j - border], L); + pos = (INT) clipretinex( conversionBuffer[2][i - border][j - border], 0, 32768);//histogram in curve HSL + lhist16RETI[pos]++; } #endif for (; j < W - border; j++) { float H, S, L; + int pos; //rgb=>lab Color::rgb2hslfloat(red[i][j], green[i][j], blue[i][j], conversionBuffer[0][i - border][j - border], conversionBuffer[1][i - border][j - border], L); L *= 32768.f; conversionBuffer[2][i - border][j - border] = L; + pos = (INT) clipretinex(L, 0, 32768); + lhist16RETI[pos]++; } } } @@ -1863,6 +1872,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar for (int i = border; i < H - border; i++ ) for (int j = border; j < W - border; j++) { float X, Y, Z, L, aa, bb; + int pos; //rgb=>lab Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); //convert Lab @@ -1870,24 +1880,26 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar conversionBuffer[0][i - border][j - border] = aa; conversionBuffer[1][i - border][j - border] = bb; conversionBuffer[2][i - border][j - border] = L; + pos = (INT) clipretinex(L, 0, 32768); + lhist16RETI[pos]++;//histogram in Curve Lab } } } -void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl) +void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) { useHsl = (retinexParams.retinexcolorspace == "HSLLOG" || retinexParams.retinexcolorspace == "HSLLIN"); if(useHsl) { - CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdHcurve, cdcurve, 1); + CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdHcurve, cdcurve, 1, lhist16RETI, histLRETI); } else { - CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdcurve, cdcurve, 1); + CurveFactory::curveDehaContL (retinexcontlutili, retinexParams.cdcurve, cdcurve, 1, lhist16RETI, histLRETI); } retinexParams.getCurves(retinextransmissionCurve); } -void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu & lhist16RETI, LUTu &histLRETI) { MyTime t4, t5; @@ -1904,6 +1916,16 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf array2D LBuffer (WNew, HNew); float **temp = conversionBuffer[2]; // one less dereference + LUTf dLcurve; + LUTu hist16RET; + float val; + hist16RET(65536, 0); + hist16RET.clear(); + + if(dehacontlutili) histLRETI.clear(); + dLcurve(65536, 0); + dLcurve.clear(); + #ifdef _OPENMP #pragma omp parallel for #endif @@ -1912,12 +1934,27 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf if(dehacontlutili) for (int j = 0; j < W - 2 * border; j++) { LBuffer[i][j] = cdcurve[2.f * temp[i][j]] / 2.f; + int pos = (INT) clipretinex(LBuffer[i][j], 0, 32768); + hist16RET[pos]++;//histogram in Curve } else for (int j = 0; j < W - 2 * border; j++) { LBuffer[i][j] = temp[i][j]; } - + + if(dehacontlutili){//update histogram + + for (int i = 0; i < 32768; i++) { + val = (double)i / 32767.0; + dLcurve[i] = CLIPD(val); + } + + for (int i = 0; i < 32768; i++) { + float hval = dLcurve[i]; + int hi = (int)(255.0f * CLIPD(hval)); + histLRETI[hi] += hist16RET[i]; + } + } MSR(LBuffer, conversionBuffer[2], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if(useHsl) { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 2a2249630..fa49d6556 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,9 +152,9 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili); - void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); - void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl); - void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer); + void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu & lhist16RETI, LUTu &histLRETI); + void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI); + void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index f15778421..195911a3a 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -250,7 +250,7 @@ public: * @param histLuma is the array of size 256 containing the histogram of the luminance channel * other for curves backgrounds, histRAW is RAW without colors */ virtual void histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve,LUTu & histLLCurve, */LUTu & histLCAM, LUTu & histCCAM, - LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw, LUTu & histChroma) {} + LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw, LUTu & histChroma, LUTu & histLRETI) {} }; /** This listener is used when the auto exposure has been recomputed (e.g. when the clipping ratio changed). */ diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 5a07e587f..631e1cbdd 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -118,14 +118,15 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if(params.retinex.enabled) { //enabled Retinex LUTf cdcurve (65536, 0); + LUTu dum; RetinextransmissionCurve dehatransmissionCurve; bool dehacontlutili = false; bool useHsl = false; multi_array2D conversionBuffer(1, 1); - imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer); - imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl); + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dum); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, dum, dum); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dum, dum); } if (pl) { diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 4c85ca32e..351009b75 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -1299,7 +1299,7 @@ void ColorAppearance::setBatchMode (bool batchMode) curveEditorG3->setBatchMode (batchMode); } -void ColorAppearance::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma) +void ColorAppearance::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) { shape->updateBackgroundHistogram (histLCAM); diff --git a/rtgui/colorappearance.h b/rtgui/colorappearance.h index 977b89ed7..04fe2a3bb 100644 --- a/rtgui/colorappearance.h +++ b/rtgui/colorappearance.h @@ -131,7 +131,7 @@ public: 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 & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); + void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller); }; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 7a234acb3..bc8efd9de 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1765,14 +1765,14 @@ void EditorPanel::tbBeforeLock_toggled () } void EditorPanel::histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, - LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw , LUTu & histChroma) + LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw , LUTu & histChroma, LUTu & histLRETI) { if (histogramPanel) { histogramPanel->histogramChanged (histRed, histGreen, histBlue, histLuma, histRedRaw, histGreenRaw, histBlueRaw, histChroma); } - tpc->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma); + tpc->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); } bool EditorPanel::CheckSidePanelsVisibility() diff --git a/rtgui/editorpanel.h b/rtgui/editorpanel.h index abe511ad1..beb24a7c9 100644 --- a/rtgui/editorpanel.h +++ b/rtgui/editorpanel.h @@ -175,7 +175,7 @@ public: // HistogramListener void histogramChanged (LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, - LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw, LUTu & histChroma); + LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw, LUTu & histChroma, LUTu & histLRETI); // event handlers void info_toggled (); diff --git a/rtgui/labcurve.cc b/rtgui/labcurve.cc index fdcbed683..7e5bf7b53 100644 --- a/rtgui/labcurve.cc +++ b/rtgui/labcurve.cc @@ -628,7 +628,7 @@ void LCurve::setBatchMode (bool batchMode) } -void LCurve::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma) +void LCurve::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) { lshape->updateBackgroundHistogram (histLCurve); diff --git a/rtgui/labcurve.h b/rtgui/labcurve.h index f41ba29e2..6caba6b8a 100644 --- a/rtgui/labcurve.h +++ b/rtgui/labcurve.h @@ -78,7 +78,7 @@ public: void avoidcolorshift_toggled (); void lcredsk_toggled(); - void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); + void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 835d05ae3..b1c290e14 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -641,6 +641,12 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp) limd->trimValue(pp->retinex.limd); } +void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) +{ + + cdshape->updateBackgroundHistogram (histLRETI); + cdshapeH->updateBackgroundHistogram (histLRETI); +} void Retinex::setBatchMode (bool batchMode) { diff --git a/rtgui/retinex.h b/rtgui/retinex.h index d2c71e083..305682660 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -81,6 +81,7 @@ public: void writeOptions (std::vector &tpOpen); void updateToolState (std::vector &tpOpen); void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd); + void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); private: void foldAllButMe (GdkEventButton* event, MyExpander *expander); diff --git a/rtgui/rgbcurves.cc b/rtgui/rgbcurves.cc index 565ec0eb5..d9c970f7a 100644 --- a/rtgui/rgbcurves.cc +++ b/rtgui/rgbcurves.cc @@ -194,7 +194,7 @@ void RGBCurves::setBatchMode (bool batchMode) } -void RGBCurves::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma) +void RGBCurves::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) { // Rshape->updateBackgroundHistogram (histRed); diff --git a/rtgui/rgbcurves.h b/rtgui/rgbcurves.h index 47a7a1344..c471a2063 100644 --- a/rtgui/rgbcurves.h +++ b/rtgui/rgbcurves.h @@ -51,7 +51,7 @@ public: void autoOpenCurve (); void curveChanged (CurveEditor* ce); - void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); + void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); void lumamodeChanged (); }; diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 770652430..ea9f740f1 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -856,7 +856,7 @@ void ToneCurve::trimValues (rtengine::procparams::ProcParams* pp) saturation->trimValue(pp->toneCurve.saturation); } -void ToneCurve::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma) +void ToneCurve::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) { shape->updateBackgroundHistogram (histToneCurve); diff --git a/rtgui/tonecurve.h b/rtgui/tonecurve.h index dae1acea6..be94c073a 100644 --- a/rtgui/tonecurve.h +++ b/rtgui/tonecurve.h @@ -104,7 +104,7 @@ public: bool curveMode2Changed_ (); void expandCurve (bool isExpanded); bool isCurveExpanded (); - void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); + void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); void setRaw (bool raw); diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index b93f2e98a..ad13459f0 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -732,12 +732,14 @@ int ToolPanelCoordinator::getSpotWBRectSize () return whitebalance->getSize (); } -void ToolPanelCoordinator::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma) +void ToolPanelCoordinator::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) { - colorappearance->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma); - toneCurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma); - lcurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma); - rgbcurves->updateCurveBackgroundHistogram(histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve, */histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma); + colorappearance->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); + toneCurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); + lcurve->updateCurveBackgroundHistogram (histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); + rgbcurves->updateCurveBackgroundHistogram(histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve, */histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); + retinex->updateCurveBackgroundHistogram(histToneCurve, histLCurve, histCCurve,/* histCLurve, histLLCurve, */histLCAM, histCCAM, histRed, histGreen, histBlue, histLuma, histLRETI); + } void ToolPanelCoordinator::foldAllButOne (Gtk::Box* parent, FoldableToolPanel* openedSection) diff --git a/rtgui/toolpanelcoord.h b/rtgui/toolpanelcoord.h index 01717d903..44073344b 100644 --- a/rtgui/toolpanelcoord.h +++ b/rtgui/toolpanelcoord.h @@ -219,7 +219,7 @@ public: { return hasChanged; } - void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma); + void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve, /*LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); void foldAllButOne (Gtk::Box* parent, FoldableToolPanel* openedSection); // multiple listeners can be added that are notified on changes (typical: profile panel and the history) From c59fca2d6ae8c6ebeb7f27c6adc4ceff7392f5ba Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 14 Sep 2015 14:49:43 +0200 Subject: [PATCH 31/71] Retinex: Fixed crash in queue and race conditions in histogram --- rtengine/imagesource.h | 2 +- rtengine/improccoordinator.cc | 4 +- rtengine/rawimagesource.cc | 188 +++++++++++++++++++++++++--------- rtengine/rawimagesource.h | 2 +- rtengine/simpleprocess.cc | 8 +- 5 files changed, 147 insertions(+), 57 deletions(-) diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 568134880..4124170f9 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,7 +69,7 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; - virtual void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu & lhist16RETI, LUTu &histLRETI) {}; + virtual void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index fccb2ab8e..4744c3171 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -77,7 +77,7 @@ ImProcCoordinator::ImProcCoordinator () histChroma(256), histLRETI(256), - + CAMBrightCurveJ(), CAMBrightCurveQ(), rCurve(), @@ -251,7 +251,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, lhist16RETI, histLRETI); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, lhist16RETI, histLRETI);//enabled Retinex + imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI);//enabled Retinex if(dehaListener) { dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 988ad50af..612a6860f 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1817,6 +1817,15 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar #pragma omp parallel #endif { + // one LUT per thread + LUTu lhist16RETIThr; + + if(lhist16RETI) + { + lhist16RETIThr(32769, 0); + lhist16RETIThr.clear(); + } + #ifdef __SSE2__ vfloat c32768 = F2V(32768.f); #endif @@ -1837,8 +1846,13 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar _mm_storeu_ps(&conversionBuffer[1][i - border][j - border], S); L *= c32768; _mm_storeu_ps(&conversionBuffer[2][i - border][j - border], L); - pos = (INT) clipretinex( conversionBuffer[2][i - border][j - border], 0, 32768);//histogram in curve HSL - lhist16RETI[pos]++; + + if(lhist16RETI) { + for(int p = 0; p < 4; p++) { + pos = (INT) clipretinex( conversionBuffer[2][i - border][j - border + p], 0.f, 32768.f);//histogram in curve HSL + lhist16RETIThr[pos]++; + } + } } #endif @@ -1850,10 +1864,27 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar Color::rgb2hslfloat(red[i][j], green[i][j], blue[i][j], conversionBuffer[0][i - border][j - border], conversionBuffer[1][i - border][j - border], L); L *= 32768.f; conversionBuffer[2][i - border][j - border] = L; - pos = (INT) clipretinex(L, 0, 32768); - lhist16RETI[pos]++; + + if(lhist16RETI) { + pos = (INT) clipretinex(L, 0, 32768); + lhist16RETIThr[pos]++; + } } } + +#ifdef _OPENMP + #pragma omp critical + { + if(lhist16RETI) + { + // Add per Thread LUT to global LUT + for(int i = 0; i < 32769; i++) { + lhist16RETI[i] += lhist16RETIThr[i]; + } + } + } +#endif + } } else { TMatrix wprof = iccStore->workingSpaceMatrix (cmp.working); @@ -1866,23 +1897,52 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar // Conversion rgb -> lab is hard to vectorize because it uses a lut (that's not the main problem) // and it uses a condition inside XYZ2Lab which is almost impossible to vectorize without making it slower... #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel +#endif + { + // one LUT per thread + LUTu lhist16RETIThr; + + if(lhist16RETI) { + lhist16RETIThr(32769, 0); + lhist16RETIThr.clear(); + } + +#ifdef _OPENMP + #pragma omp for #endif - for (int i = border; i < H - border; i++ ) - for (int j = border; j < W - border; j++) { - float X, Y, Z, L, aa, bb; - int pos; - //rgb=>lab - Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); - //convert Lab - Color::XYZ2Lab(X, Y, Z, L, aa, bb); - conversionBuffer[0][i - border][j - border] = aa; - conversionBuffer[1][i - border][j - border] = bb; - conversionBuffer[2][i - border][j - border] = L; - pos = (INT) clipretinex(L, 0, 32768); - lhist16RETI[pos]++;//histogram in Curve Lab + for (int i = border; i < H - border; i++ ) + for (int j = border; j < W - border; j++) { + float X, Y, Z, L, aa, bb; + int pos; + //rgb=>lab + Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); + //convert Lab + Color::XYZ2Lab(X, Y, Z, L, aa, bb); + conversionBuffer[0][i - border][j - border] = aa; + conversionBuffer[1][i - border][j - border] = bb; + conversionBuffer[2][i - border][j - border] = L; + + if(lhist16RETI) { + pos = (INT) clipretinex(L, 0, 32768); + lhist16RETIThr[pos]++;//histogram in Curve Lab + } + } + +#ifdef _OPENMP + #pragma omp critical + { + if(lhist16RETI) { + // Add per Thread LUT to global LUT + for(int i = 0; i < 32769; i++) { + lhist16RETI[i] += lhist16RETIThr[i]; + } + } } +#endif + + } } } @@ -1899,7 +1959,7 @@ void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdc retinexParams.getCurves(retinextransmissionCurve); } -void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu & lhist16RETI, LUTu &histLRETI) +void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) { MyTime t4, t5; @@ -1919,42 +1979,72 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf LUTf dLcurve; LUTu hist16RET; float val; - hist16RET(65536, 0); - hist16RET.clear(); - - if(dehacontlutili) histLRETI.clear(); - dLcurve(65536, 0); - dLcurve.clear(); - + + if(dehacontlutili && histLRETI) { + hist16RET(32769, 0); + hist16RET.clear(); + histLRETI.clear(); + dLcurve(32769, 0); + dLcurve.clear(); + } + #ifdef _OPENMP - #pragma omp parallel for + #pragma omp parallel +#endif + { + // one LUT per thread + LUTu hist16RETThr; + + if(dehacontlutili && histLRETI) { + hist16RETThr(32769, 0); + hist16RETThr.clear(); + } + +#ifdef _OPENMP + #pragma omp for #endif - for (int i = 0; i < H - 2 * border; i++ ) - if(dehacontlutili) - for (int j = 0; j < W - 2 * border; j++) { - LBuffer[i][j] = cdcurve[2.f * temp[i][j]] / 2.f; - int pos = (INT) clipretinex(LBuffer[i][j], 0, 32768); - hist16RET[pos]++;//histogram in Curve + for (int i = 0; i < H - 2 * border; i++ ) + if(dehacontlutili) + for (int j = 0; j < W - 2 * border; j++) { + LBuffer[i][j] = cdcurve[2.f * temp[i][j]] / 2.f; + + if(histLRETI) { + int pos = (INT) clipretinex(LBuffer[i][j], 0.f, 32768.f); + hist16RETThr[pos]++; //histogram in Curve + } + } + else + for (int j = 0; j < W - 2 * border; j++) { + LBuffer[i][j] = temp[i][j]; + } + +#ifdef _OPENMP + #pragma omp critical +#endif + { + if(dehacontlutili && histLRETI) { + // Add per Thread LUT to global LUT + for(int i = 0; i < 32769; i++) { + hist16RET[i] += hist16RETThr[i]; + } } - else - for (int j = 0; j < W - 2 * border; j++) { - LBuffer[i][j] = temp[i][j]; - } - - if(dehacontlutili){//update histogram - - for (int i = 0; i < 32768; i++) { - val = (double)i / 32767.0; - dLcurve[i] = CLIPD(val); - } - - for (int i = 0; i < 32768; i++) { - float hval = dLcurve[i]; - int hi = (int)(255.0f * CLIPD(hval)); - histLRETI[hi] += hist16RET[i]; + } } + + if(dehacontlutili && histLRETI) {//update histogram + for (int i = 0; i < 32768; i++) { + val = (double)i / 32767.0; + dLcurve[i] = CLIPD(val); + } + + for (int i = 0; i < 32768; i++) { + float hval = dLcurve[i]; + int hi = (int)(255.0f * CLIPD(hval)); + histLRETI[hi] += hist16RET[i]; + } } + MSR(LBuffer, conversionBuffer[2], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if(useHsl) { diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index fa49d6556..122664131 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,7 +152,7 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili); - void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu & lhist16RETI, LUTu &histLRETI); + void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI); void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI); void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI); void flushRawData (); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 631e1cbdd..29b1da1f6 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -118,15 +118,15 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if(params.retinex.enabled) { //enabled Retinex LUTf cdcurve (65536, 0); - LUTu dum; + LUTu dummy; RetinextransmissionCurve dehatransmissionCurve; bool dehacontlutili = false; bool useHsl = false; multi_array2D conversionBuffer(1, 1); - imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dum); - imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, dum, dum); + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, dummy, dummy ); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dum, dum); + imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); } if (pl) { From 6eba3914f479be122c6bcaa810959e32176bd889 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 14 Sep 2015 16:39:42 +0200 Subject: [PATCH 32/71] Retinex: Fixed compile bug --- rtengine/rawimagesource.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 612a6860f..52345b807 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1849,7 +1849,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar if(lhist16RETI) { for(int p = 0; p < 4; p++) { - pos = (INT) clipretinex( conversionBuffer[2][i - border][j - border + p], 0.f, 32768.f);//histogram in curve HSL + pos = (int) clipretinex( conversionBuffer[2][i - border][j - border + p], 0.f, 32768.f);//histogram in curve HSL lhist16RETIThr[pos]++; } } @@ -1866,7 +1866,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar conversionBuffer[2][i - border][j - border] = L; if(lhist16RETI) { - pos = (INT) clipretinex(L, 0, 32768); + pos = (int) clipretinex(L, 0, 32768); lhist16RETIThr[pos]++; } } @@ -1925,7 +1925,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar conversionBuffer[2][i - border][j - border] = L; if(lhist16RETI) { - pos = (INT) clipretinex(L, 0, 32768); + pos = (int) clipretinex(L, 0, 32768); lhist16RETIThr[pos]++;//histogram in Curve Lab } } @@ -2010,7 +2010,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf LBuffer[i][j] = cdcurve[2.f * temp[i][j]] / 2.f; if(histLRETI) { - int pos = (INT) clipretinex(LBuffer[i][j], 0.f, 32768.f); + int pos = (int) clipretinex(LBuffer[i][j], 0.f, 32768.f); hist16RETThr[pos]++; //histogram in Curve } } From 03d7fe8f373a544aeb07384a75afc6ce52b2a958 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Tue, 15 Sep 2015 21:11:04 +0200 Subject: [PATCH 33/71] Simplified curve defaults code --- rtengine/procparams.cc | 47 +++++------------------------------------- rtengine/procparams.h | 3 --- rtgui/retinex.cc | 7 +++---- 3 files changed, 8 insertions(+), 49 deletions(-) diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 1655c5eb5..148fc2906 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -123,10 +123,6 @@ RetinexParams::RetinexParams () void RetinexParams::getDefaulttransmissionCurve(std::vector &curve) { - /* double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.0, 0.50, 0.35, 0.35, - }; - */ double v[12] = { 0.00, 0.25, 0.35, 0.35, 0.60, 0.90, 0.35, 0.35, 1.00, 0.50, 0.35, 0.35, @@ -141,40 +137,6 @@ void RetinexParams::getDefaulttransmissionCurve(std::vector &curve) } } -void RetinexParams::getDefaultCDCurve(std::vector &curve) -{ - double v[4] = { 0., 0., - // 0.25, 0.25, - // 0.5, 0.5, - // 0.75, 0.75, - 1., 1., - }; - - curve.resize(5); - curve.at(0) = double(DCT_NURBS); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at(i) = v[i - 1]; - } -} - -void RetinexParams::getDefaultCDHCurve(std::vector &curve) -{ - double v[4] = { 0.00, 0.00, - // 0.5, 0.5, - 1.0, 1.0, - }; - - curve.resize(5); - curve.at(0) = double(DCT_NURBS); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at(i) = v[i - 1]; - } -} - - - void RetinexParams::setDefaults() { enabled = false; @@ -185,13 +147,14 @@ void RetinexParams::setDefaults() offs = 0; vart = 125; limd = 8; - getDefaulttransmissionCurve(transmissionCurve); - getDefaultCDCurve(cdcurve); - getDefaultCDHCurve(cdHcurve); retinexMethod = "high"; retinexcolorspace = "Lab"; medianmap = true; - + cdcurve.clear(); + cdcurve.push_back(DCT_Linear); + cdHcurve.clear(); + cdHcurve.push_back(DCT_Linear); + getDefaulttransmissionCurve(transmissionCurve); } void RetinexParams::getCurves(RetinextransmissionCurve &transmissionCurveLUT) const diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 91dfbf7bc..08060dcec 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -287,9 +287,6 @@ public: void getCurves(RetinextransmissionCurve &transmissionCurveLUT) const; static void getDefaulttransmissionCurve(std::vector &curve); - static void getDefaultCDCurve(std::vector &curve); - static void getDefaultCDHCurve(std::vector &curve); - }; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index b1c290e14..76cb24675 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -53,11 +53,10 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexVBox->pack_start(*dhbox); std::vector defaultCurve; + // Histogram equalizer Lab curve curveEditorGD = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LAB")); curveEditorGD->setCurveListener (this); - rtengine::RetinexParams::getDefaultCDCurve(defaultCurve); cdshape = static_cast(curveEditorGD->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); - cdshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); cdshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); std::vector milestones22; @@ -68,11 +67,10 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), curveEditorGD->curveListComplete(); + // Histogram equalizer HSL curve curveEditorGDH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_HSL")); curveEditorGDH->setCurveListener (this); - rtengine::RetinexParams::getDefaultCDHCurve(defaultCurve); cdshapeH = static_cast(curveEditorGDH->addCurve(CT_Diagonal, M("TP_RETINEX_CURVEEDITOR_CD"))); - cdshapeH->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); cdshapeH->setTooltip(M("TP_RETINEX_CURVEEDITOR_CD_TOOLTIP")); std::vector milestones22H; @@ -84,6 +82,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), curveEditorGDH->curveListComplete(); + // Transmission map curve transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_TRANSMISSION")); transmissionCurveEditorG->setCurveListener (this); From 5f97c4f15be2b35cb6de584121cde9f4032994b2 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 16 Sep 2015 00:14:58 +0200 Subject: [PATCH 34/71] Simpler interface for gaussian blur, speedup for double precision gaussian blur and speedup for retinex transmission curve --- rtengine/PF_correct_RT.cc | 36 +--- rtengine/bilateral2.h | 4 +- rtengine/gauss.h | 403 +++++++++---------------------------- rtengine/helpersse2.h | 3 + rtengine/impulse_denoise.h | 9 +- rtengine/ipretinex.cc | 66 ++---- rtengine/ipsharpen.cc | 37 +--- rtengine/shmap.cc | 5 +- 8 files changed, 132 insertions(+), 431 deletions(-) diff --git a/rtengine/PF_correct_RT.cc b/rtengine/PF_correct_RT.cc index 130a683d8..c56ce168d 100644 --- a/rtengine/PF_correct_RT.cc +++ b/rtengine/PF_correct_RT.cc @@ -65,11 +65,8 @@ SSEFUNCTION void ImProcFunctions::PF_correct_RT(LabImage * src, LabImage * dst, #pragma omp parallel #endif { - AlignedBufferMP buffer(max(src->W, src->H)); - gaussHorizontal (src->a, tmp1->a, buffer, src->W, src->H, radius); - gaussHorizontal (src->b, tmp1->b, buffer, src->W, src->H, radius); - gaussVertical (tmp1->a, tmp1->a, buffer, src->W, src->H, radius); - gaussVertical (tmp1->b, tmp1->b, buffer, src->W, src->H, radius); + gaussianBlur (src->a, tmp1->a, src->W, src->H, radius); + gaussianBlur (src->b, tmp1->b, src->W, src->H, radius); } float chromave = 0.0f; @@ -395,11 +392,8 @@ SSEFUNCTION void ImProcFunctions::PF_correct_RTcam(CieImage * src, CieImage * ds #pragma omp parallel #endif { - AlignedBufferMP buffer(max(src->W, src->H)); - 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); + gaussianBlur (sraa, tmaa, src->W, src->H, radius); + gaussianBlur (srbb, tmbb, src->W, src->H, radius); } float chromave = 0.0f; @@ -773,19 +767,14 @@ SSEFUNCTION void ImProcFunctions::Badpixelscam(CieImage * src, CieImage * dst, d #pragma omp parallel #endif { - AlignedBufferMP 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); + gaussianBlur (sraa, tmaa, src->W, src->H, radius); + gaussianBlur (srbb, tmbb, 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); + gaussianBlur (src->sh_p, tmL, src->W, src->H, 2.0);//low value to avoid artifacts } if(mode == 1) { //choice of median @@ -1386,19 +1375,14 @@ SSEFUNCTION void ImProcFunctions::BadpixelsLab(LabImage * src, LabImage * dst, d #pragma omp parallel #endif { - AlignedBufferMP 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); + gaussianBlur (sraa, tmaa, src->W, src->H, radius); + gaussianBlur (srbb, tmbb, src->W, src->H, radius); } //luma sh_p - gaussHorizontal (src->L, tmL, buffer, src->W, src->H, 2.0);//low value to avoid artifacts - gaussVertical (tmL, tmL, buffer, src->W, src->H, 2.0); + gaussianBlur (src->L, tmL, src->W, src->H, 2.0);//low value to avoid artifacts } if(mode == 1) { //choice of median diff --git a/rtengine/bilateral2.h b/rtengine/bilateral2.h index 925414fd4..7a919546f 100644 --- a/rtengine/bilateral2.h +++ b/rtengine/bilateral2.h @@ -26,9 +26,7 @@ #include "rtengine.h" #include "rt_math.h" -#include "alignedbuffer.h" #include "mytime.h" -#include "gauss.h" #include "array2D.h" #ifdef _OPENMP @@ -147,7 +145,7 @@ using namespace rtengine; a31*SULY(3,-5) + a32*SULY(3,-4) + a33*SULY(3,-3) + a34*SULY(3,-2) + a35*SULY(3,-1) + a36*SULY(3,0) + a35*SULY(3,1) + a34*SULY(3,2) + a33*SULY(3,3) + a32*SULY(3,4) + a31*SULY(3,5) + \ a21*SULY(4,-5) + a22*SULY(4,-4) + a23*SULY(4,-3) + a24*SULY(4,-2) + a25*SULY(4,-1) + a26*SULY(4,0) + a25*SULY(4,1) + a24*SULY(4,2) + a23*SULY(4,3) + a22*SULY(4,4) + a21*SULY(4,5) + \ a11*SULY(5,-5) + a12*SULY(5,-4) + a13*SULY(5,-3) + a14*SULY(5,-2) + a15*SULY(5,-1) + a16*SULY(5,0) + a15*SULY(5,1) + a14*SULY(5,2) + a13*SULY(5,3) + a12*SULY(5,4) + a11*SULY(5,5); \ - + // sigma = 0.5 template void bilateral05 (T** src, T** dst, T** buffer, int W, int H, double sens, bool multiThread) diff --git a/rtengine/gauss.h b/rtengine/gauss.h index b8ec0008f..61e5e2fe4 100644 --- a/rtengine/gauss.h +++ b/rtengine/gauss.h @@ -22,15 +22,11 @@ #include #include #include -#include "alignedbuffer.h" -#ifdef _OPENMP -#include -#endif #include "opthelper.h" // classical filtering if the support window is small: -template void gaussHorizontal3 (T** src, T** dst, AlignedBufferMP &buffer, int W, int H, const float c0, const float c1) +template void gaussHorizontal3 (T** src, T** dst, int W, int H, const float c0, const float c1) { #ifdef _OPENMP @@ -38,8 +34,7 @@ template void gaussHorizontal3 (T** src, T** dst, AlignedBufferMP* pBuf = buffer.acquire(); - T* temp = (T*)pBuf->data; + T temp[W] ALIGNED16; for (int j = 1; j < W - 1; j++) { temp[j] = (T)(c1 * (src[i][j - 1] + src[i][j + 1]) + c0 * src[i][j]); @@ -48,13 +43,11 @@ template void gaussHorizontal3 (T** src, T** dst, AlignedBufferMP void gaussVertical3 (T** src, T** dst, AlignedBufferMP &buffer, int W, int H, const float c0, const float c1) +template void gaussVertical3 (T** src, T** dst, int W, int H, const float c0, const float c1) { #ifdef _OPENMP @@ -62,8 +55,7 @@ template void gaussVertical3 (T** src, T** dst, AlignedBufferMP #endif for (int i = 0; i < W; i++) { - AlignedBuffer* pBuf = buffer.acquire(); - T* temp = (T*)pBuf->data; + T temp[H] ALIGNED16; for (int j = 1; j < H - 1; j++) { temp[j] = (T)(c1 * (src[j - 1][i] + src[j + 1][i]) + c0 * src[j][i]); @@ -75,39 +67,37 @@ template void gaussVertical3 (T** src, T** dst, AlignedBufferMP dst[j][i] = temp[j]; } - buffer.release(pBuf); - dst[H - 1][i] = src[H - 1][i]; } } -#ifdef __SSE__ +#ifdef __SSE2__ template SSEFUNCTION void gaussVertical3Sse (T** src, T** dst, int W, int H, const float c0, const float c1) { __m128 Tv, Tm1v, Tp1v; __m128 c0v, c1v; - c0v = _mm_set1_ps(c0); - c1v = _mm_set1_ps(c1); + c0v = F2V(c0); + c1v = F2V(c1); #ifdef _OPENMP #pragma omp for #endif for (int i = 0; i < W - 3; i += 4) { - Tm1v = _mm_loadu_ps( &src[0][i] ); - _mm_storeu_ps( &dst[0][i], Tm1v); + Tm1v = LVFU( src[0][i] ); + STVFU( dst[0][i], Tm1v); if (H > 1) { - Tv = _mm_loadu_ps( &src[1][i]); + Tv = LVFU( src[1][i]); } for (int j = 1; j < H - 1; j++) { - Tp1v = _mm_loadu_ps( &src[j + 1][i]); - _mm_storeu_ps( &dst[j][i], c1v * (Tp1v + Tm1v) + Tv * c0v); + Tp1v = LVFU( src[j + 1][i]); + STVFU( dst[j][i], c1v * (Tp1v + Tm1v) + Tv * c0v); Tm1v = Tv; Tv = Tp1v; } - _mm_storeu_ps( &dst[H - 1][i], _mm_loadu_ps( &src[H - 1][i])); + STVFU( dst[H - 1][i], LVFU( src[H - 1][i])); } // Borders are done without SSE @@ -129,12 +119,12 @@ template SSEFUNCTION void gaussVertical3Sse (T** src, T** dst, int W, i template SSEFUNCTION void gaussHorizontal3Sse (T** src, T** dst, int W, int H, const float c0, const float c1) { - float tmp[W][4] __attribute__ ((aligned (16))); + float tmp[W][4] ALIGNED16; __m128 Tv, Tm1v, Tp1v; __m128 c0v, c1v; - c0v = _mm_set1_ps(c0); - c1v = _mm_set1_ps(c1); + c0v = F2V(c0); + c1v = F2V(c1); #ifdef _OPENMP #pragma omp for #endif @@ -152,7 +142,7 @@ template SSEFUNCTION void gaussHorizontal3Sse (T** src, T** dst, int W, for (int j = 1; j < W - 1; j++) { Tp1v = _mm_set_ps( src[i][j + 1], src[i + 1][j + 1], src[i + 2][j + 1], src[i + 3][j + 1] ); - _mm_store_ps( &tmp[j][0], c1v * (Tp1v + Tm1v) + Tv * c0v); + STVF( tmp[j][0], c1v * (Tp1v + Tm1v) + Tv * c0v); Tm1v = Tv; Tv = Tp1v; } @@ -250,16 +240,16 @@ template SSEFUNCTION void gaussHorizontalSse (T** src, T** dst, int W, M[i][j] /= (1.0 + b1 - b2 + b3) * (1.0 - b1 - b2 - b3); } - float tmp[W][4] __attribute__ ((aligned (16))); - float tmpV[4] __attribute__ ((aligned (16))); + float tmp[W][4] ALIGNED16; + float tmpV[4] ALIGNED16; __m128 Rv; __m128 Tv, Tm2v, Tm3v; __m128 Bv, b1v, b2v, b3v; __m128 temp2W, temp2Wp1; - Bv = _mm_set1_ps(B); - b1v = _mm_set1_ps(b1); - b2v = _mm_set1_ps(b2); - b3v = _mm_set1_ps(b3); + Bv = F2V(B); + b1v = F2V(b1); + b2v = F2V(b2); + b3v = F2V(b3); #ifdef _OPENMP #pragma omp for @@ -270,47 +260,47 @@ template SSEFUNCTION void gaussHorizontalSse (T** src, T** dst, int W, tmpV[1] = src[i + 2][0]; tmpV[2] = src[i + 1][0]; tmpV[3] = src[i][0]; - Tv = _mm_load_ps(tmpV); + Tv = LVF(tmpV[0]); Rv = Tv * (Bv + b1v + b2v + b3v); Tm3v = Rv; - _mm_store_ps( &tmp[0][0], Rv ); + STVF( tmp[0][0], Rv ); tmpV[0] = src[i + 3][1]; tmpV[1] = src[i + 2][1]; tmpV[2] = src[i + 1][1]; tmpV[3] = src[i][1]; - Rv = _mm_load_ps(tmpV) * Bv + Rv * b1v + Tv * (b2v + b3v); + Rv = LVF(tmpV[0]) * Bv + Rv * b1v + Tv * (b2v + b3v); Tm2v = Rv; - _mm_store_ps( &tmp[1][0], Rv ); + STVF( tmp[1][0], Rv ); tmpV[0] = src[i + 3][2]; tmpV[1] = src[i + 2][2]; tmpV[2] = src[i + 1][2]; tmpV[3] = src[i][2]; - Rv = _mm_load_ps(tmpV) * Bv + Rv * b1v + Tm3v * b2v + Tv * b3v; - _mm_store_ps( &tmp[2][0], Rv ); + Rv = LVF(tmpV[0]) * Bv + Rv * b1v + Tm3v * b2v + Tv * b3v; + STVF( tmp[2][0], Rv ); for (int j = 3; j < W; j++) { Tv = Rv; Rv = _mm_set_ps(src[i][j], src[i + 1][j], src[i + 2][j], src[i + 3][j]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; - _mm_store_ps( &tmp[j][0], Rv ); + STVF( tmp[j][0], Rv ); Tm3v = Tm2v; Tm2v = Tv; } Tv = _mm_set_ps(src[i][W - 1], src[i + 1][W - 1], src[i + 2][W - 1], src[i + 3][W - 1]); - temp2Wp1 = Tv + _mm_set1_ps(M[2][0]) * (Rv - Tv) + _mm_set1_ps(M[2][1]) * ( Tm2v - Tv ) + _mm_set1_ps(M[2][2]) * (Tm3v - Tv); - temp2W = Tv + _mm_set1_ps(M[1][0]) * (Rv - Tv) + _mm_set1_ps(M[1][1]) * (Tm2v - Tv) + _mm_set1_ps(M[1][2]) * (Tm3v - Tv); + temp2Wp1 = Tv + F2V(M[2][0]) * (Rv - Tv) + F2V(M[2][1]) * ( Tm2v - Tv ) + F2V(M[2][2]) * (Tm3v - Tv); + temp2W = Tv + F2V(M[1][0]) * (Rv - Tv) + F2V(M[1][1]) * (Tm2v - Tv) + F2V(M[1][2]) * (Tm3v - Tv); - Rv = Tv + _mm_set1_ps(M[0][0]) * (Rv - Tv) + _mm_set1_ps(M[0][1]) * (Tm2v - Tv) + _mm_set1_ps(M[0][2]) * (Tm3v - Tv); - _mm_store_ps( &tmp[W - 1][0], Rv ); + Rv = Tv + F2V(M[0][0]) * (Rv - Tv) + F2V(M[0][1]) * (Tm2v - Tv) + F2V(M[0][2]) * (Tm3v - Tv); + STVF( tmp[W - 1][0], Rv ); Tm2v = Bv * Tm2v + b1v * Rv + b2v * temp2W + b3v * temp2Wp1; - _mm_store_ps( &tmp[W - 2][0], Tm2v ); + STVF( tmp[W - 2][0], Tm2v ); Tm3v = Bv * Tm3v + b1v * Tm2v + b2v * Rv + b3v * temp2W; - _mm_store_ps( &tmp[W - 3][0], Tm3v ); + STVF( tmp[W - 3][0], Tm3v ); Tv = Rv; Rv = Tm3v; @@ -318,8 +308,8 @@ template SSEFUNCTION void gaussHorizontalSse (T** src, T** dst, int W, for (int j = W - 4; j >= 0; j--) { Tv = Rv; - Rv = _mm_load_ps(&tmp[j][0]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; - _mm_store_ps( &tmp[j][0], Rv ); + Rv = LVF(tmp[j][0]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; + STVF( tmp[j][0], Rv ); Tm3v = Tm2v; Tm2v = Tv; } @@ -370,10 +360,10 @@ template SSEFUNCTION void gaussHorizontalSse (T** src, T** dst, int W, // fast gaussian approximation if the support window is large -template void gaussHorizontal (T** src, T** dst, AlignedBufferMP &buffer, int W, int H, double sigma) +template void gaussHorizontal (T** src, T** dst, int W, int H, double sigma) { -#ifdef __SSE__ +#ifdef __SSE2__ if (sigma < 70) { // bigger sigma only with double precision gaussHorizontalSse (src, dst, W, H, sigma); @@ -401,7 +391,7 @@ template void gaussHorizontal (T** src, T** dst, AlignedBufferMP (src, dst, buffer, W, H, c0, c1); + gaussHorizontal3 (src, dst, W, H, c0, c1); return; } @@ -439,13 +429,13 @@ template void gaussHorizontal (T** src, T** dst, AlignedBufferMP* pBuf = buffer.acquire(); - double* temp2 = pBuf->data; temp2[0] = B * src[i][0] + b1 * src[i][0] + b2 * src[i][0] + b3 * src[i][0]; temp2[1] = B * src[i][1] + b1 * temp2[0] + b2 * src[i][0] + b3 * src[i][0]; @@ -471,11 +461,10 @@ template void gaussHorizontal (T** src, T** dst, AlignedBufferMP SSEFUNCTION void gaussVerticalSse (T** src, T** dst, int W, int H, float sigma) { @@ -537,15 +526,15 @@ template SSEFUNCTION void gaussVerticalSse (T** src, T** dst, int W, in M[i][j] /= (1.0 + b1 - b2 + b3) * (1.0 - b1 - b2 - b3); } - float tmp[H][4] __attribute__ ((aligned (16))); + float tmp[H][4] ALIGNED16; __m128 Rv; __m128 Tv, Tm2v, Tm3v; __m128 Bv, b1v, b2v, b3v; __m128 temp2W, temp2Wp1; - Bv = _mm_set1_ps(B); - b1v = _mm_set1_ps(b1); - b2v = _mm_set1_ps(b2); - b3v = _mm_set1_ps(b3); + Bv = F2V(B); + b1v = F2V(b1); + b2v = F2V(b2); + b3v = F2V(b3); #ifdef _OPENMP @@ -553,39 +542,39 @@ template SSEFUNCTION void gaussVerticalSse (T** src, T** dst, int W, in #endif for (int i = 0; i < W - 3; i += 4) { - Tv = _mm_loadu_ps( &src[0][i]); + Tv = LVFU( src[0][i]); Rv = Tv * (Bv + b1v + b2v + b3v); Tm3v = Rv; - _mm_store_ps( &tmp[0][0], Rv ); + STVF( tmp[0][0], Rv ); - Rv = _mm_loadu_ps(&src[1][i]) * Bv + Rv * b1v + Tv * (b2v + b3v); + Rv = LVFU(src[1][i]) * Bv + Rv * b1v + Tv * (b2v + b3v); Tm2v = Rv; - _mm_store_ps( &tmp[1][0], Rv ); + STVF( tmp[1][0], Rv ); - Rv = _mm_loadu_ps(&src[2][i]) * Bv + Rv * b1v + Tm3v * b2v + Tv * b3v; - _mm_store_ps( &tmp[2][0], Rv ); + Rv = LVFU(src[2][i]) * Bv + Rv * b1v + Tm3v * b2v + Tv * b3v; + STVF( tmp[2][0], Rv ); for (int j = 3; j < H; j++) { Tv = Rv; - Rv = _mm_loadu_ps(&src[j][i]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; - _mm_store_ps( &tmp[j][0], Rv ); + Rv = LVFU(src[j][i]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; + STVF( tmp[j][0], Rv ); Tm3v = Tm2v; Tm2v = Tv; } - Tv = _mm_loadu_ps(&src[H - 1][i]); + Tv = LVFU(src[H - 1][i]); - temp2Wp1 = Tv + _mm_set1_ps(M[2][0]) * (Rv - Tv) + _mm_set1_ps(M[2][1]) * (Tm2v - Tv) + _mm_set1_ps(M[2][2]) * (Tm3v - Tv); - temp2W = Tv + _mm_set1_ps(M[1][0]) * (Rv - Tv) + _mm_set1_ps(M[1][1]) * (Tm2v - Tv) + _mm_set1_ps(M[1][2]) * (Tm3v - Tv); + temp2Wp1 = Tv + F2V(M[2][0]) * (Rv - Tv) + F2V(M[2][1]) * (Tm2v - Tv) + F2V(M[2][2]) * (Tm3v - Tv); + temp2W = Tv + F2V(M[1][0]) * (Rv - Tv) + F2V(M[1][1]) * (Tm2v - Tv) + F2V(M[1][2]) * (Tm3v - Tv); - Rv = Tv + _mm_set1_ps(M[0][0]) * (Rv - Tv) + _mm_set1_ps(M[0][1]) * (Tm2v - Tv) + _mm_set1_ps(M[0][2]) * (Tm3v - Tv); - _mm_storeu_ps( &dst[H - 1][i], Rv ); + Rv = Tv + F2V(M[0][0]) * (Rv - Tv) + F2V(M[0][1]) * (Tm2v - Tv) + F2V(M[0][2]) * (Tm3v - Tv); + STVFU( dst[H - 1][i], Rv ); Tm2v = Bv * Tm2v + b1v * Rv + b2v * temp2W + b3v * temp2Wp1; - _mm_storeu_ps( &dst[H - 2][i], Tm2v ); + STVFU( dst[H - 2][i], Tm2v ); Tm3v = Bv * Tm3v + b1v * Tm2v + b2v * Rv + b3v * temp2W; - _mm_storeu_ps( &dst[H - 3][i], Tm3v ); + STVFU( dst[H - 3][i], Tm3v ); Tv = Rv; Rv = Tm3v; @@ -593,8 +582,8 @@ template SSEFUNCTION void gaussVerticalSse (T** src, T** dst, int W, in for (int j = H - 4; j >= 0; j--) { Tv = Rv; - Rv = _mm_load_ps(&tmp[j][0]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; - _mm_storeu_ps( &dst[j][i], Rv ); + Rv = LVF(tmp[j][0]) * Bv + Tv * b1v + Tm2v * b2v + Tm3v * b3v; + STVFU( dst[j][i], Rv ); Tm3v = Tm2v; Tm2v = Tv; } @@ -635,10 +624,10 @@ template SSEFUNCTION void gaussVerticalSse (T** src, T** dst, int W, in #endif -template void gaussVertical (T** src, T** dst, AlignedBufferMP &buffer, int W, int H, double sigma) +template void gaussVertical (T** src, T** dst, int W, int H, double sigma) { -#ifdef __SSE__ +#ifdef __SSE2__ if (sigma < 70) { // bigger sigma only with double precision gaussVerticalSse (src, dst, W, H, sigma); @@ -666,7 +655,7 @@ template void gaussVertical (T** src, T** dst, AlignedBufferMP double csum = 2.0 * c1 + 1.0; c1 /= csum; double c0 = 1.0 / csum; - gaussVertical3 (src, dst, buffer, W, H, c0, c1); + gaussVertical3 (src, dst, W, H, c0, c1); return; } @@ -705,7 +694,7 @@ template void gaussVertical (T** src, T** dst, AlignedBufferMP } // process 'numcols' columns for better usage of L1 cpu cache (especially faster for large values of H) - static const int numcols = 4; + static const int numcols = 8; double temp2[H][numcols] ALIGNED16; double temp2Hm1[numcols], temp2H[numcols], temp2Hp1[numcols]; #ifdef _OPENMP @@ -732,20 +721,14 @@ template void gaussVertical (T** src, T** dst, AlignedBufferMP } for (int k = 0; k < numcols; k++) { - temp2[H - 1][k] = temp2Hm1[k]; - temp2[H - 2][k] = B * temp2[H - 2][k] + b1 * temp2[H - 1][k] + b2 * temp2H[k] + b3 * temp2Hp1[k]; - temp2[H - 3][k] = B * temp2[H - 3][k] + b1 * temp2[H - 2][k] + b2 * temp2[H - 1][k] + b3 * temp2H[k]; + dst[H - 1][i + k] = temp2[H - 1][k] = temp2Hm1[k]; + dst[H - 2][i + k] = temp2[H - 2][k] = B * temp2[H - 2][k] + b1 * temp2[H - 1][k] + b2 * temp2H[k] + b3 * temp2Hp1[k]; + dst[H - 3][i + k] = temp2[H - 3][k] = B * temp2[H - 3][k] + b1 * temp2[H - 2][k] + b2 * temp2[H - 1][k] + b3 * temp2H[k]; } for (int j = H - 4; j >= 0; j--) { for (int k = 0; k < numcols; k++) { - temp2[j][k] = B * temp2[j][k] + b1 * temp2[j + 1][k] + b2 * temp2[j + 2][k] + b3 * temp2[j + 3][k]; - } - } - - for (int j = 0; j < H; j++) { - for (int k = 0; k < numcols; k++) { - dst[j][i + k] = (T)temp2[j][k]; + dst[j][i + k] = temp2[j][k] = B * temp2[j][k] + b1 * temp2[j + 1][k] + b2 * temp2[j + 2][k] + b3 * temp2[j + 3][k]; } } } @@ -768,241 +751,35 @@ template void gaussVertical (T** src, T** dst, AlignedBufferMP double temp2H = src[H - 1][i] + M[1][0] * (temp2[H - 1][0] - src[H - 1][i]) + M[1][1] * (temp2[H - 2][0] - src[H - 1][i]) + M[1][2] * (temp2[H - 3][0] - src[H - 1][i]); double temp2Hp1 = src[H - 1][i] + M[2][0] * (temp2[H - 1][0] - src[H - 1][i]) + M[2][1] * (temp2[H - 2][0] - src[H - 1][i]) + M[2][2] * (temp2[H - 3][0] - src[H - 1][i]); - temp2[H - 1][0] = temp2Hm1; - temp2[H - 2][0] = B * temp2[H - 2][0] + b1 * temp2[H - 1][0] + b2 * temp2H + b3 * temp2Hp1; - temp2[H - 3][0] = B * temp2[H - 3][0] + b1 * temp2[H - 2][0] + b2 * temp2[H - 1][0] + b3 * temp2H; + dst[H - 1][i] = temp2[H - 1][0] = temp2Hm1; + dst[H - 2][i] = temp2[H - 2][0] = B * temp2[H - 2][0] + b1 * temp2[H - 1][0] + b2 * temp2H + b3 * temp2Hp1; + dst[H - 3][i] = temp2[H - 3][0] = B * temp2[H - 3][0] + b1 * temp2[H - 2][0] + b2 * temp2[H - 1][0] + b3 * temp2H; for (int j = H - 4; j >= 0; j--) { - temp2[j][0] = B * temp2[j][0] + b1 * temp2[j + 1][0] + b2 * temp2[j + 2][0] + b3 * temp2[j + 3][0]; - } - - for (int j = 0; j < H; j++) { - dst[j][i] = (T)temp2[j][0]; + dst[j][i] = temp2[j][0] = B * temp2[j][0] + b1 * temp2[j + 1][0] + b2 * temp2[j + 2][0] + b3 * temp2[j + 3][0]; } } } - - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -template void gaussDerivH (T** src, T** dst, AlignedBufferMP &buffer, int W, int H, double sigma) +template void gaussianBlur(T** src, T** dst, const int W, const int H, const double sigma, bool forceLowSigma = false) { + double newSigma = sigma; + if(forceLowSigma) { + newSigma /= sqrt(2.0); - if (sigma < 0.6) { - // apply symmetric derivative -#ifdef _OPENMP - #pragma omp for -#endif - - for (int i = 0; i < H; i++) { - AlignedBuffer* pBuf = buffer.acquire(); - T* temp = (T*)pBuf->data; - - // double* temp = buffer->data;// replaced by 2 lines above - for (int j = 1; j < W - 1; j++) { - temp[j] = (0.5 * (src[i][j + 1] - src[i][j - 1]) ); - } - - dst[i][0] = (src[i][1] - src[i][0]); - - //memcpy (dst[i]+1, temp+1, (W-2)*sizeof(T)); - for (int j = 1; j < W - 1; j++) { - dst[i][j] = temp[j]; - } - - buffer.release(pBuf); - dst[i][W - 1] = (src[i][W - 1] - src[i][W - 2]); + if(newSigma < 0.6) { // barrier to avoid using simple gauss version for higher radius + newSigma = sigma; + forceLowSigma = false; } - - return; } - // coefficient calculation - double q = 0.98711 * sigma - 0.96330; + gaussHorizontal (src, dst, W, H, newSigma); + gaussVertical (dst, dst, W, H, newSigma); - if (sigma < 2.5) { - q = 3.97156 - 4.14554 * sqrt (1.0 - 0.26891 * sigma); - } - - double b0 = 1.57825 + 2.44413 * q + 1.4281 * q * q + 0.422205 * q * q * q; - double b1 = 2.44413 * q + 2.85619 * q * q + 1.26661 * q * q * q; - double b2 = -1.4281 * q * q - 1.26661 * q * q * q; - double b3 = 0.422205 * q * q * q; - double B = 1.0 - (b1 + b2 + b3) / b0; - - b1 /= b0; - b2 /= b0; - b3 /= b0; - - // From: Bill Triggs, Michael Sdika: Boundary Conditions for Young-van Vliet Recursive Filtering - double M[3][3]; - M[0][0] = -b3 * b1 + 1.0 - b3 * b3 - b2; - M[0][1] = (b3 + b1) * (b2 + b3 * b1); - M[0][2] = b3 * (b1 + b3 * b2); - M[1][0] = b1 + b3 * b2; - M[1][1] = -(b2 - 1.0) * (b2 + b3 * b1); - M[1][2] = -(b3 * b1 + b3 * b3 + b2 - 1.0) * b3; - M[2][0] = b3 * b1 + b2 + b1 * b1 - b2 * b2; - M[2][1] = b1 * b2 + b3 * b2 * b2 - b1 * b3 * b3 - b3 * b3 * b3 - b3 * b2 + b3; - M[2][2] = b3 * (b1 + b3 * b2); - - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) { - M[i][j] /= (1.0 + b1 - b2 + b3) * (1.0 + b2 + (b1 - b3) * b3); - } - - #pragma omp for - - for (int i = 0; i < H; i++) { - AlignedBuffer* pBuf = buffer.acquire(); - T* temp2 = (T*)pBuf->data; - // double* temp2 = buffer->data;// replaced by 2 lines above - - double src0 = (src[i][1] - src[i][0]); - - temp2[0] = B * src0 + b1 * src0 + b2 * src0 + b3 * src0; - temp2[1] = B * 0.5 * (src[i][2] - src[i][0]) + b1 * temp2[0] + b2 * src0 + b3 * src0; - temp2[2] = B * 0.5 * (src[i][3] - src[i][1]) + b1 * temp2[1] + b2 * temp2[0] + b3 * src0; - - for (int j = 3; j < W - 1; j++) { - temp2[j] = B * 0.5 * (src[i][j + 1] - src[i][j - 1]) + b1 * temp2[j - 1] + b2 * temp2[j - 2] + b3 * temp2[j - 3]; - } - - double srcWm1 = (src[i][W - 1] - src[i][W - 2]); - - temp2[W - 1] = B * srcWm1 + b1 * temp2[W - 2] + b2 * temp2[W - 3] + b3 * temp2[W - 4]; - - double temp2Wm1 = srcWm1 + M[0][0] * (temp2[W - 1] - srcWm1) + M[0][1] * (temp2[W - 2] - srcWm1) + M[0][2] * (temp2[W - 3] - srcWm1); - double temp2W = srcWm1 + M[1][0] * (temp2[W - 1] - srcWm1) + M[1][1] * (temp2[W - 2] - srcWm1) + M[1][2] * (temp2[W - 3] - srcWm1); - double temp2Wp1 = srcWm1 + M[2][0] * (temp2[W - 1] - srcWm1) + M[2][1] * (temp2[W - 2] - srcWm1) + M[2][2] * (temp2[W - 3] - srcWm1); - - temp2[W - 1] = temp2Wm1; - temp2[W - 2] = B * temp2[W - 2] + b1 * temp2[W - 1] + b2 * temp2W + b3 * temp2Wp1; - temp2[W - 3] = B * temp2[W - 3] + b1 * temp2[W - 2] + b2 * temp2[W - 1] + b3 * temp2W; - - for (int j = W - 4; j >= 0; j--) { - temp2[j] = B * temp2[j] + b1 * temp2[j + 1] + b2 * temp2[j + 2] + b3 * temp2[j + 3]; - } - - for (int j = 0; j < W; j++) { - dst[i][j] = (T)temp2[j]; - } - - buffer.release(pBuf); - } -} - -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -template void gaussDerivV (T** src, T** dst, AlignedBufferMP &buffer, int W, int H, double sigma) -{ - - if (sigma < 0.6) { - // apply symmetric derivative -#ifdef _OPENMP - #pragma omp for -#endif - - for (int j = 0; j < W; j++) { - AlignedBuffer* pBuf = buffer.acquire(); - T* temp = (T*)pBuf->data; - - // double* temp = buffer->data;// replaced by 2 lines above - for (int i = 1; i < H - 1; i++) { - temp[i] = (0.5 * (src[i + 1][j] - src[i - 1][j]) ); - } - - dst[0][j] = (src[1][j] - src[0][j]); - - for (int i = 1; i < H - 1; i++) { - dst[i][j] = temp[i]; - } - - buffer.release(pBuf); - - dst[H - 1][j] = (src[H - 1][j] - src[H - 2][j]); - } - - return; - } - - // coefficient calculation - double q = 0.98711 * sigma - 0.96330; - - if (sigma < 2.5) { - q = 3.97156 - 4.14554 * sqrt (1.0 - 0.26891 * sigma); - } - - double b0 = 1.57825 + 2.44413 * q + 1.4281 * q * q + 0.422205 * q * q * q; - double b1 = 2.44413 * q + 2.85619 * q * q + 1.26661 * q * q * q; - double b2 = -1.4281 * q * q - 1.26661 * q * q * q; - double b3 = 0.422205 * q * q * q; - double B = 1.0 - (b1 + b2 + b3) / b0; - - b1 /= b0; - b2 /= b0; - b3 /= b0; - - // From: Bill Triggs, Michael Sdika: Boundary Conditions for Young-van Vliet Recursive Filtering - double M[3][3]; - M[0][0] = -b3 * b1 + 1.0 - b3 * b3 - b2; - M[0][1] = (b3 + b1) * (b2 + b3 * b1); - M[0][2] = b3 * (b1 + b3 * b2); - M[1][0] = b1 + b3 * b2; - M[1][1] = -(b2 - 1.0) * (b2 + b3 * b1); - M[1][2] = -(b3 * b1 + b3 * b3 + b2 - 1.0) * b3; - M[2][0] = b3 * b1 + b2 + b1 * b1 - b2 * b2; - M[2][1] = b1 * b2 + b3 * b2 * b2 - b1 * b3 * b3 - b3 * b3 * b3 - b3 * b2 + b3; - M[2][2] = b3 * (b1 + b3 * b2); - - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) { - M[i][j] /= (1.0 + b1 - b2 + b3) * (1.0 + b2 + (b1 - b3) * b3); - } - -#ifdef _OPENMP - #pragma omp for -#endif - - for (int i = 0; i < W; i++) { - AlignedBuffer* pBuf = buffer.acquire(); - T* temp2 = (T*)pBuf->data; - // double* temp2 = buffer->data;// replaced by 2 lines above - - double src0 = 0.5 * (src[1][i] - src[0][i]); - - temp2[0] = B * src0 + b1 * src0 + b2 * src0 + b3 * src0; - temp2[1] = B * 0.5 * (src[2][i] - src[0][i]) + b1 * temp2[0] + b2 * src0 + b3 * src0; - temp2[2] = B * 0.5 * (src[3][i] - src[1][i]) + b1 * temp2[1] + b2 * temp2[0] + b3 * src0; - - for (int j = 3; j < H - 1; j++) { - temp2[j] = B * 0.5 * (src[j + 1][i] - src[j - 1][i]) + b1 * temp2[j - 1] + b2 * temp2[j - 2] + b3 * temp2[j - 3]; - } - - double srcHm1 = 0.5 * (src[H - 1][i] - src[H - 2][i]); - - temp2[H - 1] = B * srcHm1 + b1 * temp2[H - 2] + b2 * temp2[H - 3] + b3 * temp2[H - 4]; - - double temp2Hm1 = srcHm1 + M[0][0] * (temp2[H - 1] - srcHm1) + M[0][1] * (temp2[H - 2] - srcHm1) + M[0][2] * (temp2[H - 3] - srcHm1); - double temp2H = srcHm1 + M[1][0] * (temp2[H - 1] - srcHm1) + M[1][1] * (temp2[H - 2] - srcHm1) + M[1][2] * (temp2[H - 3] - srcHm1); - double temp2Hp1 = srcHm1 + M[2][0] * (temp2[H - 1] - srcHm1) + M[2][1] * (temp2[H - 2] - srcHm1) + M[2][2] * (temp2[H - 3] - srcHm1); - - temp2[H - 1] = temp2Hm1; - temp2[H - 2] = B * temp2[H - 2] + b1 * temp2[H - 1] + b2 * temp2H + b3 * temp2Hp1; - temp2[H - 3] = B * temp2[H - 3] + b1 * temp2[H - 2] + b2 * temp2[H - 1] + b3 * temp2H; - - for (int j = H - 4; j >= 0; j--) { - temp2[j] = B * temp2[j] + b1 * temp2[j + 1] + b2 * temp2[j + 2] + b3 * temp2[j + 3]; - } - - for (int j = 0; j < H; j++) { - dst[j][i] = (T)temp2[j]; - } - - buffer.release(pBuf); + if(forceLowSigma) { + gaussHorizontal (dst, dst, W, H, newSigma); + gaussVertical (dst, dst, W, H, newSigma); } } diff --git a/rtengine/helpersse2.h b/rtengine/helpersse2.h index c7dce8806..6aee552b8 100644 --- a/rtengine/helpersse2.h +++ b/rtengine/helpersse2.h @@ -26,15 +26,18 @@ typedef __m128i vint2; #define LVF(x) _mm_load_ps(&x) #define LVFU(x) _mm_loadu_ps(&x) #define STVF(x,y) _mm_store_ps(&x,y) + #define STVFU(x,y) _mm_storeu_ps(&x,y) #else // there is a bug in gcc 4.7.x when using openmp and aligned memory and -O3 #define LVF(x) _mm_loadu_ps(&x) #define LVFU(x) _mm_loadu_ps(&x) #define STVF(x,y) _mm_storeu_ps(&x,y) + #define STVFU(x,y) _mm_storeu_ps(&x,y) #endif #else #define LVF(x) _mm_load_ps(&x) #define LVFU(x) _mm_loadu_ps(&x) #define STVF(x,y) _mm_store_ps(&x,y) + #define STVFU(x,y) _mm_storeu_ps(&x,y) #endif // Load 8 floats from a and combine a[0],a[2],a[4] and a[6] into a vector of 4 floats diff --git a/rtengine/impulse_denoise.h b/rtengine/impulse_denoise.h index 1c89021e7..0e3fefd97 100644 --- a/rtengine/impulse_denoise.h +++ b/rtengine/impulse_denoise.h @@ -65,10 +65,7 @@ SSEFUNCTION void ImProcFunctions::impulse_nr (LabImage* lab, double thresh) #pragma omp parallel #endif { - AlignedBufferMP buffer(max(width, height)); - - gaussHorizontal (lab->L, lpf, buffer, width, height, max(2.0, thresh - 1.0)); - gaussVertical (lpf, lpf, buffer, width, height, max(2.0, thresh - 1.0)); + gaussianBlur (lab->L, lpf, width, height, max(2.0, thresh - 1.0)); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -320,9 +317,7 @@ SSEFUNCTION void ImProcFunctions::impulse_nrcam (CieImage* ncie, double thresh, #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)); + gaussianBlur (ncie->sh_p, lpf, width, height, max(2.0, thresh - 1.0)); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 29456cddd..ae5b78961 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -220,7 +220,6 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width limD *= useHslLin ? 10.f : 1.f; float ilimD = 1.f / limD; int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) - bool execcur = false; if (deh.retinexMethod == "uni") { moderetinex = 0; @@ -259,32 +258,18 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width out[i] = &outBuffer[i * W_L]; } - float logBetaGain = xlogf(16384.f); - float pond = logBetaGain / (float) scal; + const float logBetaGain = xlogf(16384.f); + const float pond = logBetaGain / (float) scal; #ifdef _OPENMP #pragma omp parallel #endif { - AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W_L, H_L)); - for ( int scale = scal - 1; scale >= 0; scale-- ) { - float ** source; - float sigma; if(scale == scal - 1) { // probably large sigma. Use double gauss with sigma divided by sqrt(2.0) - sigma = RetinexScales[scale] / sqrt(2.0); - source = src; + gaussianBlur (src, out, W_L, H_L, RetinexScales[scale], true); } else { // reuse result of last iteration - sigma = sqrtf((RetinexScales[scale] * RetinexScales[scale]) - (RetinexScales[scale + 1] * RetinexScales[scale + 1])); - source = out; - } - - gaussHorizontal (source, out, *pBuffer, W_L, H_L, sigma); - gaussVertical (out, out, *pBuffer, W_L, H_L, sigma); - - if(scale == scal - 1) { // probably large sigma. Use double gauss with sigma divided by sqrt(2.0) - gaussHorizontal (out, out, *pBuffer, W_L, H_L, sigma); - gaussVertical (out, out, *pBuffer, W_L, H_L, sigma); + gaussianBlur (out, out, W_L, H_L, sqrtf(SQR(RetinexScales[scale]) - SQR(RetinexScales[scale + 1]))); } #ifdef __SSE2__ @@ -324,18 +309,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width } } } - - delete pBuffer; } delete [] outBuffer; delete [] srcBuffer; - - if (dehatransmissionCurve) { - execcur = true; - } - mean = 0.f; stddv = 0.f; // I call mean_stddv2 instead of mean_stddv ==> logBetaGain @@ -344,18 +322,20 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width // printf("mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", mean, stddv, delta, maxtr, mintr); // mean_stddv( luminance, mean, stddv, W_L, H_L, logBetaGain, maxtr, mintr); - if (execcur && mean != 0.f && stddv != 0.f) { //if curve + if (dehatransmissionCurve && mean != 0.f && stddv != 0.f) { //if curve float asig = 0.166666f / stddv; float bsig = 0.5f - asig * mean; - //float insigma = 0.66666f; //SD - float amean = 0.5f / mean; - float asign = 0.166666f / stddv; - float bsign = 0.5f - asign * mean; float amax = 0.333333f / (maxtr - mean - stddv); float bmax = 1.f - amax * maxtr; float amin = 0.333333f / (mean - stddv - mintr); float bmin = -amin * mintr; + asig *= 500.f; + bsig *= 500.f; + amax *= 500.f; + bmax *= 500.f; + amin *= 500.f; + bmin *= 500.f; #ifdef _OPENMP #pragma omp parallel #endif @@ -367,20 +347,15 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for (int i = 0; i < H_L; i++ ) for (int j = 0; j < W_L; j++) { //for mintr to maxtr evalate absciss in function of original transmission - if (luminance[i][j] >= mean && luminance[i][j] < mean + stddv) { - absciss = asig * luminance[i][j] + bsig; - } else if (luminance[i][j] >= mean + stddv) { - absciss = amax * luminance[i][j] + bmax; - } else if (/*luminance[i][j] < mean && */luminance[i][j] > mean - stddv) { - absciss = asign * luminance[i][j] + bsign; + if (LIKELY(fabsf(luminance[i][j] - mean) < stddv)) { + absciss = asig * luminance[i][j] + bsig; + } else if (luminance[i][j] >= mean) { + absciss = amax * luminance[i][j] + bmax; } else { /*if(luminance[i][j] <= mean - stddv)*/ - absciss = amin * luminance[i][j] + bmin; + absciss = amin * luminance[i][j] + bmin; } - float kmul = 2.5f; - float kinterm = 1.f + kmul * (dehatransmissionCurve[absciss * 500.f] - 0.5f); //new transmission - luminance[i][j] *= kinterm; -// luminance[i][j] *= 1.000001f; + luminance[i][j] *= (-0.25f + 2.5f * dehatransmissionCurve[absciss]); //new transmission } } @@ -396,13 +371,6 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width tmL[i] = &tmLBuffer[i * wid]; } - /* - for(int i = borderL; i < hei - borderL; i++ ) { - for(int j = borderL; j < wid - borderL; j++) { - tmL[i][j] = luminance[i][j]; - } - } - */ #ifdef _OPENMP #pragma omp parallel for #endif diff --git a/rtengine/ipsharpen.cc b/rtengine/ipsharpen.cc index 302c07655..928ffe5bd 100644 --- a/rtengine/ipsharpen.cc +++ b/rtengine/ipsharpen.cc @@ -140,16 +140,13 @@ void ImProcFunctions::deconvsharpening (LabImage* lab, float** b2, SharpeningPar #pragma omp parallel #endif { - AlignedBufferMP buffer(max(W, H)); - float damping = sharpenParam.deconvdamping / 5.0; bool needdamp = sharpenParam.deconvdamping > 0; for (int k = 0; k < sharpenParam.deconviter; k++) { // apply blur function (gaussian blur) - gaussHorizontal (tmpI, tmp, buffer, W, H, sharpenParam.deconvradius / scale); - gaussVertical (tmp, tmp, buffer, W, H, sharpenParam.deconvradius / scale); + gaussianBlur (tmpI, tmp, W, H, sharpenParam.deconvradius / scale); if (!needdamp) { #ifdef _OPENMP @@ -165,8 +162,7 @@ void ImProcFunctions::deconvsharpening (LabImage* lab, float** b2, SharpeningPar dcdamping (tmp, lab->L, damping, W, H); } - gaussHorizontal (tmp, tmp, buffer, W, H, sharpenParam.deconvradius / scale); - gaussVertical (tmp, tmp, buffer, W, H, sharpenParam.deconvradius / scale); + gaussianBlur (tmp, tmp, W, H, sharpenParam.deconvradius / scale); #ifdef _OPENMP #pragma omp for @@ -238,17 +234,11 @@ void ImProcFunctions::sharpening (LabImage* lab, float** b2, SharpeningParams &s #endif { - - AlignedBufferMP buffer(max(W, H)); - if (sharpenParam.edgesonly == false) { - - gaussHorizontal (lab->L, b2, buffer, W, H, sharpenParam.radius / scale); - gaussVertical (b2, b2, buffer, W, H, sharpenParam.radius / scale); + gaussianBlur (lab->L, b2, W, H, sharpenParam.radius / scale); } else { bilateral (lab->L, (float**)b3, b2, W, H, sharpenParam.edges_radius / scale, sharpenParam.edges_tolerance, multiThread); - gaussHorizontal (b3, b2, buffer, W, H, sharpenParam.radius / scale); - gaussVertical (b2, b2, buffer, W, H, sharpenParam.radius / scale); + gaussianBlur (b3, b2, W, H, sharpenParam.radius / scale); } float** base = lab->L; @@ -1390,17 +1380,13 @@ void ImProcFunctions::deconvsharpeningcam (CieImage* ncie, float** b2) #pragma omp parallel #endif { - AlignedBufferMP buffer(max(W, H)); - - float damping = params->sharpening.deconvdamping / 5.0; bool needdamp = params->sharpening.deconvdamping > 0; for (int k = 0; k < params->sharpening.deconviter; k++) { // apply blur function (gaussian blur) - gaussHorizontal (tmpI, tmp, buffer, W, H, params->sharpening.deconvradius / scale); - gaussVertical (tmp, tmp, buffer, W, H, params->sharpening.deconvradius / scale); + gaussianBlur (tmpI, tmp, W, H, params->sharpening.deconvradius / scale); if (!needdamp) { #ifdef _OPENMP @@ -1416,8 +1402,7 @@ void ImProcFunctions::deconvsharpeningcam (CieImage* ncie, float** b2) dcdamping (tmp, ncie->sh_p, damping, W, H); } - gaussHorizontal (tmp, tmp, buffer, W, H, params->sharpening.deconvradius / scale); - gaussVertical (tmp, tmp, buffer, W, H, params->sharpening.deconvradius / scale); + gaussianBlur (tmp, tmp, W, H, params->sharpening.deconvradius / scale); #ifdef _OPENMP @@ -1493,17 +1478,11 @@ void ImProcFunctions::sharpeningcam (CieImage* ncie, float** b2) #endif { - - AlignedBufferMP buffer(max(W, H)); - if (params->sharpening.edgesonly == false) { - - gaussHorizontal (ncie->sh_p, b2, buffer, W, H, params->sharpening.radius / scale); - gaussVertical (b2, b2, buffer, W, H, params->sharpening.radius / scale); + gaussianBlur (ncie->sh_p, b2, W, H, params->sharpening.radius / scale); } else { bilateral (ncie->sh_p, (float**)b3, b2, W, H, params->sharpening.edges_radius / scale, params->sharpening.edges_tolerance, multiThread); - gaussHorizontal (b3, b2, buffer, W, H, params->sharpening.radius / scale); - gaussVertical (b2, b2, buffer, W, H, params->sharpening.radius / scale); + gaussianBlur (b3, b2, W, H, params->sharpening.radius / scale); } float** base = ncie->sh_p; diff --git a/rtengine/shmap.cc b/rtengine/shmap.cc index cb2a2a332..34fadd5e7 100644 --- a/rtengine/shmap.cc +++ b/rtengine/shmap.cc @@ -74,10 +74,7 @@ void SHMap::update (Imagefloat* img, double radius, double lumi[3], bool hq, int #pragma omp parallel #endif { - AlignedBufferMP* pBuffer = new AlignedBufferMP (max(W, H)); - gaussHorizontal (map, map, *pBuffer, W, H, radius); - gaussVertical (map, map, *pBuffer, W, H, radius); - delete pBuffer; + gaussianBlur (map, map, W, H, radius); } } From 7d78c056033109b58d62ea0a4b84dee9c03c7a2a Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 16 Sep 2015 03:12:44 +0200 Subject: [PATCH 35/71] Remember Retinex Settings expanded state, wip --- rtgui/retinex.cc | 9 +++++---- rtgui/toolpanelcoord.cc | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 76cb24675..9d0f8b9df 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -47,11 +47,10 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexcolorspace->set_active(0); retinexColorSpaceConn = retinexcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexColorSpaceChanged) ); - dhbox->pack_start(*retinexMethod); dhbox->pack_start(*retinexcolorspace); retinexVBox->pack_start(*dhbox); - std::vector defaultCurve; + // Histogram equalizer Lab curve curveEditorGD = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LAB")); @@ -67,6 +66,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), curveEditorGD->curveListComplete(); + // Histogram equalizer HSL curve curveEditorGDH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_HSL")); curveEditorGDH->setCurveListener (this); @@ -86,6 +86,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_TRANSMISSION")); transmissionCurveEditorG->setCurveListener (this); + std::vector defaultCurve; rtengine::RetinexParams::getDefaulttransmissionCurve(defaultCurve); transmissionShape = static_cast(transmissionCurveEditorG->addCurve(CT_Flat, "", NULL, false)); transmissionShape->setIdentityValue(0.); @@ -238,8 +239,8 @@ void Retinex::writeOptions(std::vector &tpOpen) void Retinex::updateToolState(std::vector &tpOpen) { - if(tpOpen.size() == 9) { - expsettings->set_expanded(tpOpen.at(0)); + if(tpOpen.size() == 10) { + expsettings->set_expanded(tpOpen.at(9)); } } diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index ad13459f0..3c82cd0a8 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -559,6 +559,7 @@ void ToolPanelCoordinator::writeOptions () } wavelet->writeOptions(options.tpOpen); + retinex->writeOptions(options.tpOpen); } From 718b10084f05169a4ffeecb6d2dd199aace65f26 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Wed, 16 Sep 2015 18:13:01 +0200 Subject: [PATCH 36/71] Fixed history and preview refreshing --- rtengine/procevents.h | 13 +-- rtengine/refreshmap.cc | 204 +++++++++++++++++++++-------------------- rtengine/refreshmap.h | 1 - 3 files changed, 110 insertions(+), 108 deletions(-) diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 1a6216750..a86363af9 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -22,6 +22,10 @@ namespace rtengine { + + + +// Aligned so the first entry starts on line 30 enum ProcEvent { EvPhotoLoaded = 0, EvProfileLoaded = 1, @@ -226,7 +230,6 @@ enum ProcEvent { EvDPDNredchro = 200, EvDPDNbluechro = 201, EvDPDNmet = 202, -// EvDPDNperform=201, EvDemosaicLMMSEIter = 203, EvCATbadpix = 204, EvCATAutoAdap = 205, @@ -278,15 +281,13 @@ enum ProcEvent { EvDirPyrEqualizerSkin = 251, EvDirPyrEqlgamutlab = 252, EvDirPyrEqualizerHueskin = 253, -// EvDirPyrEqualizeralg=254, - EvDPDNmedian = 254, + EvDPDNmedian = 254, // EvDirPyrEqualizeralg=254, EvDPDNmedmet = 255, EvColorToningEnabled = 256, EvColorToningColor = 257, EvColorToningOpacity = 258, - EvColorToningCLCurve = 259, + EvColorToningCLCurve = 259, // EvColorToningTwocolor=259, EvColorToningMethod = 260, -// EvColorToningTwocolor=259, EvColorToningLLCurve = 261, EvColorToningredlow = 262, EvColorToninggreenlow = 263, @@ -444,7 +445,7 @@ enum ProcEvent { EvRetinexEnabled = 415, EvRetinexmedianmap = 416, EvLlimd = 417, - EvretinexColorSpace = 418, //change to 418 if we want a separate history entry "Retinex - Color space" + EvretinexColorSpace = 418, // 418 if we want a separate history entry "Retinex - Color space", 406 if we don't EvLCDHCurve = 419, NUMOFEVENTS }; diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 9acea5dd6..9376c0a47 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -19,6 +19,13 @@ #include "refreshmap.h" #include "procevents.h" + + + + + + +// Aligned so the first entry starts on line 30 int refreshmap[rtengine::NUMOFEVENTS] = { ALL, // EvPhotoLoaded, ALL, // EvProfileLoaded, @@ -102,7 +109,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { RESIZE, // EvResizeHeight RESIZE, // EvResizeEnabled ALL, // EvProfileChangeNotification -// RETINEX, // EvShrHighQuality + RETINEX, // EvShrHighQuality TRANSFORM, // EvPerspCorr DARKFRAME, // EvLCPFile RGBCURVE, // EvRGBrCurveLumamode @@ -169,7 +176,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { SHARPENING, // EvSharpenEdgeThreechannels SHARPENING, // EvSharpenMicroEnabled SHARPENING, // EvSharpenMicroMatrix - DEMOSAIC, // EvDemosaicALLEnhanced // Disabled but not removed for now, may be reintroduced some day + DEMOSAIC, // EvDemosaicALLEnhanced Disabled but not removed for now, may be reintroduced some day RGBCURVE, // EvVibranceEnabled RGBCURVE, // EvVibrancePastels RGBCURVE, // EvVibranceSaturated @@ -255,7 +262,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { RGBCURVE, // EvBWAfterCurve RGBCURVE, // EvBWAfterCurveMode RGBCURVE, // EvAutoch - NONE, // --unused-- + 0, // --unused-- RGBCURVE, // EvNeutralBW TRANSFORM, // EvGradientFeather TRANSFORM, // EvGradientStrength @@ -275,14 +282,12 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvDirPyrEqlgamutlab DIRPYREQUALIZER, // EvDirPyrEqualizerHueskin ALLNORAW, // EvDPDNmedian - ALLNORAW, //EvDPDNmedmet -//DIRPYREQUALIZER // EvDirPyrEqualizeralg + ALLNORAW, // EvDPDNmedmet RGBCURVE, // EvColorToningEnabled RGBCURVE, // EvColorToningColor RGBCURVE, // EvColorToningOpacity RGBCURVE, // EvColorToningCLCurve RGBCURVE, // EvColorToningMethod -//RGBCURVE, // EvColorToningTwocolor RGBCURVE, // EvColorToningLLCurve RGBCURVE, // EvColorToningredlow RGBCURVE, // EvColorToninggreenlow @@ -304,27 +309,27 @@ int refreshmap[rtengine::NUMOFEVENTS] = { RGBCURVE, // EvColorToningHighights RGBCURVE, // EvColorToningSatProtection RGBCURVE, // EvColorToningSatThreshold - RGBCURVE, //EvColorToningStrength - RGBCURVE, //EvColorToningautosat - ALLNORAW, //EvDPDNmetmed - ALLNORAW, //EvDPDNrgbmet - ALLNORAW, //EvDPDNpasses + RGBCURVE, // EvColorToningStrength + RGBCURVE, // EvColorToningautosat + ALLNORAW, // EvDPDNmetmed + ALLNORAW, // EvDPDNrgbmet + ALLNORAW, // EvDPDNpasses FLATFIELD, // EvFlatFieldClipControl FLATFIELD, // EvFlatFieldAutoClipControl DARKFRAME, // EvPreProcessExpBlackRed DARKFRAME, // EvPreProcessExpBlackGreen DARKFRAME, // EvPreProcessExpBlackBlue - RGBCURVE, //EvFilmSimulationEnabled - RGBCURVE, //EvFilmSimulationStrength - RGBCURVE, //EvFilmSimulationFilename - ALLNORAW, // EvDPDNLCurve - ALLNORAW, // EvDPDNsmet + RGBCURVE, // EvFilmSimulationEnabled + RGBCURVE, // EvFilmSimulationStrength + RGBCURVE, // EvFilmSimulationFilename + ALLNORAW, // EvDPDNLCurve + ALLNORAW, // EvDPDNsmet DARKFRAME, // EvPreProcessDeadPixel - ALLNORAW, //EvDPDNCCCurve - ALLNORAW, //EvDPDNautochroma - ALLNORAW, // EvDPDNLmet - ALLNORAW, // EvDPDNCmet - ALLNORAW, // EvDPDNC2met + ALLNORAW, // EvDPDNCCCurve + ALLNORAW, // EvDPDNautochroma + ALLNORAW, // EvDPDNLmet + ALLNORAW, // EvDPDNCmet + ALLNORAW, // EvDPDNC2met DIRPYREQUALIZER, // EvWavelet DIRPYREQUALIZER, // EvEnabled DIRPYREQUALIZER, // EvWavLmethod @@ -365,85 +370,82 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavdaubcoeffmet DIRPYREQUALIZER, // EvWavedgreinf DIRPYREQUALIZER, // EvWaveletch - DIRPYREQUALIZER, //EvWavCHSLmet - DIRPYREQUALIZER, //EvWavedgcont - DIRPYREQUALIZER, //EvWavEDmet - DIRPYREQUALIZER, //EvWavlev0nois - DIRPYREQUALIZER, //EvWavlev1nois - DIRPYREQUALIZER, //EvWavlev2nois - DIRPYREQUALIZER, //EvWavmedianlev - DIRPYREQUALIZER, //EvWavHHCurve - DIRPYREQUALIZER, //EvWavBackmet - DIRPYREQUALIZER, //EvWavedgedetect - DIRPYREQUALIZER, //EvWavlipst - DIRPYREQUALIZER, //EvWavedgedetectthr - DIRPYREQUALIZER, //EvWavedgedetectthr2 - DIRPYREQUALIZER, //EvWavlinkedg - DIRPYREQUALIZER, //EvWavCHCurve - DARKFRAME, //EvPreProcessHotDeadThresh - SHARPENING, //EvEPDgamma - DIRPYREQUALIZER, //EvWavtmr - DIRPYREQUALIZER, //EvWavTMmet - DIRPYREQUALIZER, //EvWavtmrs - DIRPYREQUALIZER, //EvWavbalance - DIRPYREQUALIZER, //EvWaviter - DIRPYREQUALIZER, //EvWavgamma - DIRPYREQUALIZER, //EvWavCLCurve - DIRPYREQUALIZER, //EvWavopacity - DIRPYREQUALIZER, //EvWavBAmet - DIRPYREQUALIZER, //EvWavopacityWL - RESIZE, // EvPrShrEnabled - RESIZE, // EvPrShrRadius - RESIZE, // EvPrShrAmount - RESIZE, // EvPrShrThresh - RESIZE, // EvPrShrEdgeOnly - RESIZE, // EvPrShrEdgeRadius=375, - RESIZE, // EvPrShrEdgeTolerance=376, - RESIZE, // EvPrShrHaloControl=377, - RESIZE, // EvPrShrHaloAmount=378, - RESIZE, // EvPrShrMethod=379, - RESIZE, // EvPrShrDRadius=380, - RESIZE, // EvPrShrDAmount=381, - RESIZE, // EvPrShrDDamping=382, - RESIZE, // EvPrShrDIterations=383, - DIRPYREQUALIZER, // EvWavcbenab - DIRPYREQUALIZER, // EvWavgreenhigh - DIRPYREQUALIZER, // EvWavbluehigh - DIRPYREQUALIZER, // EvWavgreenmed - DIRPYREQUALIZER, // EvWavbluemed - DIRPYREQUALIZER, // EvWavgreenlow - DIRPYREQUALIZER, // EvWavbluelow - DIRPYREQUALIZER, // EvWavNeutral - RGBCURVE, // EvDCPApplyLookTable, - RGBCURVE, // EvDCPApplyBaselineExposureOffset, - INPUTPROFILE, // EvDCPApplyHueSatMap - DIRPYREQUALIZER, // EvWavenacont - DIRPYREQUALIZER, // EvWavenachrom - DIRPYREQUALIZER, // EvWavenaedge - DIRPYREQUALIZER, // EvWavenares - DIRPYREQUALIZER, // EvWavenafin - DIRPYREQUALIZER, // EvWavenatoning - DIRPYREQUALIZER, // EvWavenanoise - DIRPYREQUALIZER, // EvWavedgesensi - DIRPYREQUALIZER, // EvWavedgeampli - DIRPYREQUALIZER, //EvWavlev3nois - DIRPYREQUALIZER, //EvWavNPmet - DEMOSAIC, // Unused? - ALLNORAW, // EvretinexMethod - ALLNORAW, // EvLneigh - ALLNORAW, // EvLgain - ALLNORAW, // EvLoffs was EvLstr - ALLNORAW, // EvLstr was EvLscal - ALLNORAW, // EvLscal was EvLvart - ALLNORAW, // EvLvart was EvLCDCurve - ALLNORAW, // EvRetinexOpacity // not used - ALLNORAW, // EvRetinextransmission - DEMOSAIC, // EvRetinexEnabled was EvRetinexretinex <-- TODO we can probably delete this - ALLNORAW, // EvRetinexmedianmap - ALLNORAW, // EvLlimd - DEMOSAIC, // Evretinexcolorspace - ALLNORAW // EvLCDHCurve - - + DIRPYREQUALIZER, // EvWavCHSLmet + DIRPYREQUALIZER, // EvWavedgcont + DIRPYREQUALIZER, // EvWavEDmet + DIRPYREQUALIZER, // EvWavlev0nois + DIRPYREQUALIZER, // EvWavlev1nois + DIRPYREQUALIZER, // EvWavlev2nois + DIRPYREQUALIZER, // EvWavmedianlev + DIRPYREQUALIZER, // EvWavHHCurve + DIRPYREQUALIZER, // EvWavBackmet + DIRPYREQUALIZER, // EvWavedgedetect + DIRPYREQUALIZER, // EvWavlipst + DIRPYREQUALIZER, // EvWavedgedetectthr + DIRPYREQUALIZER, // EvWavedgedetectthr2 + DIRPYREQUALIZER, // EvWavlinkedg + DIRPYREQUALIZER, // EvWavCHCurve + DARKFRAME, // EvPreProcessHotDeadThresh + SHARPENING, // EvEPDgamma + DIRPYREQUALIZER, // EvWavtmr + DIRPYREQUALIZER, // EvWavTMmet + DIRPYREQUALIZER, // EvWavtmrs + DIRPYREQUALIZER, // EvWavbalance + DIRPYREQUALIZER, // EvWaviter + DIRPYREQUALIZER, // EvWavgamma + DIRPYREQUALIZER, // EvWavCLCurve + DIRPYREQUALIZER, // EvWavopacity + DIRPYREQUALIZER, // EvWavBAmet + DIRPYREQUALIZER, // EvWavopacityWL + RESIZE, // EvPrShrEnabled + RESIZE, // EvPrShrRadius + RESIZE, // EvPrShrAmount + RESIZE, // EvPrShrThresh + RESIZE, // EvPrShrEdgeOnly + RESIZE, // EvPrShrEdgeRadius=375, + RESIZE, // EvPrShrEdgeTolerance=376, + RESIZE, // EvPrShrHaloControl=377, + RESIZE, // EvPrShrHaloAmount=378, + RESIZE, // EvPrShrMethod=379, + RESIZE, // EvPrShrDRadius=380, + RESIZE, // EvPrShrDAmount=381, + RESIZE, // EvPrShrDDamping=382, + RESIZE, // EvPrShrDIterations=383, + DIRPYREQUALIZER, // EvWavcbenab + DIRPYREQUALIZER, // EvWavgreenhigh + DIRPYREQUALIZER, // EvWavbluehigh + DIRPYREQUALIZER, // EvWavgreenmed + DIRPYREQUALIZER, // EvWavbluemed + DIRPYREQUALIZER, // EvWavgreenlow + DIRPYREQUALIZER, // EvWavbluelow + DIRPYREQUALIZER, // EvWavNeutral + RGBCURVE, // EvDCPApplyLookTable, + RGBCURVE, // EvDCPApplyBaselineExposureOffset, + INPUTPROFILE, // EvDCPApplyHueSatMap + DIRPYREQUALIZER, // EvWavenacont + DIRPYREQUALIZER, // EvWavenachrom + DIRPYREQUALIZER, // EvWavenaedge + DIRPYREQUALIZER, // EvWavenares + DIRPYREQUALIZER, // EvWavenafin + DIRPYREQUALIZER, // EvWavenatoning + DIRPYREQUALIZER, // EvWavenanoise + DIRPYREQUALIZER, // EvWavedgesensi + DIRPYREQUALIZER, // EvWavedgeampli + DIRPYREQUALIZER, // EvWavlev3nois + DIRPYREQUALIZER, // EvWavNPmet + ALLNORAW, // EvretinexMethod + ALLNORAW, // EvLneigh + ALLNORAW, // EvLgain + ALLNORAW, // EvLoffs + ALLNORAW, // EvLstr + ALLNORAW, // EvLscal + ALLNORAW, // EvLvart + ALLNORAW, // EvLCDCurve + ALLNORAW, // EvRetinextransmission + DEMOSAIC, // EvRetinexEnabled + ALLNORAW, // EvRetinexmedianmap + ALLNORAW, // EvLlimd + DEMOSAIC, // Evretinexcolorspace + ALLNORAW // EvLCDHCurve }; diff --git a/rtengine/refreshmap.h b/rtengine/refreshmap.h index 7aefcbcc3..16c05654a 100644 --- a/rtengine/refreshmap.h +++ b/rtengine/refreshmap.h @@ -68,7 +68,6 @@ #define INPUTPROFILE WHITEBALANCE #define GAMMA (M_COLOR|M_LUMINANCE) #define MINUPDATE M_MINUPDATE -#define NONE 0 #define ALLNORAW (M_INIT|M_LINDENOISE|M_TRANSFORM|M_BLURMAP|M_AUTOEXP|M_RGBCURVE|M_LUMACURVE|M_LUMINANCE|M_COLOR) extern int refreshmap[]; From e9a8a6f32b7cd2cd2861c2648b097d36c9287302 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 16 Sep 2015 18:47:11 +0200 Subject: [PATCH 37/71] Gamma before-after Retinex to restore tones --- rtdata/languages/default | 6 ++++ rtengine/color.cc | 30 +++++++++++++++++ rtengine/color.h | 30 +++++++++++++++++ rtengine/procevents.h | 1 + rtengine/procparams.cc | 14 ++++++++ rtengine/procparams.h | 1 + rtengine/rawimagesource.cc | 66 ++++++++++++++++++++++++++++++++++++-- rtengine/refreshmap.cc | 1 + rtgui/paramsedited.cc | 6 ++++ rtgui/paramsedited.h | 1 + rtgui/retinex.cc | 61 +++++++++++++++++++++++++++++++++-- rtgui/retinex.h | 6 ++++ 12 files changed, 219 insertions(+), 4 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index eb220fe35..63947dfed 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1560,6 +1560,12 @@ TP_RETINEX_CURVEEDITOR_CD;L=f(L) TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts TP_RETINEX_GAIN;Gain TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram. +TP_RETINEX_GAM;Gamma +TP_RETINEX_GAMMA_NONE;None +TP_RETINEX_GAMMA_LOW;Low +TP_RETINEX_GAMMA_MID;Middle +TP_RETINEX_GAMMA_HIGH;High +TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex\nDifferent from Retinex curves or others curves (Lab, Exposure,..) TP_RETINEX_HIGH;High TP_RETINEX_HSLSPACE_LIN;HSL-Linear TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic diff --git a/rtengine/color.cc b/rtengine/color.cc index ed6e9cae6..b403ee7dc 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -50,6 +50,11 @@ LUTf Color::gammatab_26_11; LUTf Color::igammatab_24_17; LUTf Color::gammatab_24_17a; LUTf Color::gammatab_13_2; +LUTf Color::igammatab_13_2; +LUTf Color::gammatab_115_2; +LUTf Color::igammatab_115_2; +LUTf Color::gammatab_145_3; +LUTf Color::igammatab_145_3; // Wikipedia sRGB: Unlike most other RGB color spaces, the sRGB gamma cannot be expressed as a single numerical value. // The overall gamma is approximately 2.2, consisting of a linear (gamma 1.0) section near black, and a non-linear section elsewhere involving a 2.4 exponent @@ -162,6 +167,11 @@ void Color::init () igammatab_24_17(65536, 0); gammatab_24_17a(65536, LUT_CLIP_ABOVE | LUT_CLIP_BELOW); gammatab_13_2(65536, 0); + igammatab_13_2(65536, 0); + gammatab_115_2(65536, 0); + igammatab_115_2(65536, 0); + gammatab_145_3(65536, 0); + igammatab_145_3(65536, 0); for (int i = 0; i < 65536; i++) { gammatab_srgb[i] = (65535.0 * gamma2 (i / 65535.0)); @@ -199,7 +209,27 @@ void Color::init () for (int i = 0; i < 65536; i++) { gammatab_13_2[i] = (65535.0 * gamma13_2 (i / 65535.0)); } + + for (int i = 0; i < 65536; i++) { + igammatab_13_2[i] = (65535.0 * igamma13_2 (i / 65535.0)); + } + for (int i = 0; i < 65536; i++) { + gammatab_115_2[i] = (65535.0 * gamma115_2 (i / 65535.0)); + } + + for (int i = 0; i < 65536; i++) { + igammatab_115_2[i] = (65535.0 * igamma115_2 (i / 65535.0)); + } + + for (int i = 0; i < 65536; i++) { + gammatab_145_3[i] = (65535.0 * gamma145_3 (i / 65535.0)); + } + + for (int i = 0; i < 65536; i++) { + igammatab_145_3[i] = (65535.0 * igamma145_3 (i / 65535.0)); + } + for (int i = 0; i < 65536; i++) { gammatab_26_11[i] = (65535.0 * gamma26_11 (i / 65535.0)); } diff --git a/rtengine/color.h b/rtengine/color.h index 70dbcddf5..53d5a8b19 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -142,6 +142,11 @@ public: static LUTf igammatab_24_17; static LUTf gammatab_24_17a; static LUTf gammatab_13_2; + static LUTf igammatab_13_2; + static LUTf gammatab_115_2; + static LUTf igammatab_115_2; + static LUTf gammatab_145_3; + static LUTf igammatab_145_3; // look-up tables for the simple exponential gamma static LUTf gammatab; @@ -951,7 +956,32 @@ public: { return x <= 0.016613 ? x * 2.0 : 1.009968 * exp(log(x) / 1.3) - 0.016613; } + + static inline double igamma13_2 (double x) + { + return x <= 0.033226 ? x / 2.0 : exp(log((x + 0.009968) / 1.009968) * 1.3); + } + static inline double gamma115_2 (double x) + { + return x <= 0.001692 ? x * 2.0 : 1.000508 * exp(log(x) / 1.15) - 0.001692; + } + + static inline double igamma115_2 (double x) + { + return x <= 0.003384 ? x / 2.0 : exp(log((x + 0.000508) / 1.000508) * 1.15); + } + + static inline double gamma145_3 (double x) + { + return x <= 0.009115 ? x * 3.0 : 1.012305 * exp(log(x) / 1.45) - 0.009115; + } + + static inline double igamma145_3 (double x) + { + return x <= 0.027345 ? x / 3.0 : exp(log((x + 0.012305) / 1.012305) * 1.45); + } + // gamma function with adjustable parameters //same as above with values calculate with Calcgamma above diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 1a6216750..79e072d77 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -446,6 +446,7 @@ enum ProcEvent { EvLlimd = 417, EvretinexColorSpace = 418, //change to 418 if we want a separate history entry "Retinex - Color space" EvLCDHCurve = 419, + Evretinexgamma = 420, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 1655c5eb5..ed0bf85c8 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -190,6 +190,7 @@ void RetinexParams::setDefaults() getDefaultCDHCurve(cdHcurve); retinexMethod = "high"; retinexcolorspace = "Lab"; + gammaretinex = "none"; medianmap = true; } @@ -1510,6 +1511,10 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_string ("Retinex", "Retinexcolorspace", retinex.retinexcolorspace); } + if (!pedited || pedited->retinex.gammaretinex) { + keyFile.set_string ("Retinex", "Gammaretinex", retinex.gammaretinex); + } + if (!pedited || pedited->retinex.cdcurve) { Glib::ArrayHandle cdcurve = retinex.cdcurve; keyFile.set_double_list("Retinex", "CDCurve", cdcurve); @@ -3810,6 +3815,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Retinex", "Gammaretinex")) { + retinex.gammaretinex = keyFile.get_string ("Retinex", "Gammaretinex"); + + if (pedited) { + pedited->retinex.gammaretinex = true; + } + } + if (keyFile.has_key ("Retinex", "Enabled")) { retinex.enabled = keyFile.get_boolean ("Retinex", "Enabled"); @@ -7270,6 +7283,7 @@ bool ProcParams::operator== (const ProcParams& other) && retinex.offs == other.retinex.offs && retinex.retinexMethod == other.retinex.retinexMethod && retinex.retinexcolorspace == other.retinex.retinexcolorspace + && retinex.gammaretinex == other.retinex.gammaretinex && retinex.vart == other.retinex.vart && retinex.medianmap == other.retinex.medianmap && retinex.enabled == other.retinex.enabled diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 91dfbf7bc..f1d70d503 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -279,6 +279,7 @@ public: int offs; Glib::ustring retinexMethod; Glib::ustring retinexcolorspace; + Glib::ustring gammaretinex; int vart; int limd; bool medianmap; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 52345b807..a9c4016c9 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1811,6 +1811,31 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar conversionBuffer[0] (W - 2 * border, H - 2 * border); conversionBuffer[1] (W - 2 * border, H - 2 * border); conversionBuffer[2] (W - 2 * border, H - 2 * border); + + LUTf *retinexgamtab;//gamma before and after Retinex to restore tones + if(retinexParams.gammaretinex == "low") + retinexgamtab = &(Color::gammatab_115_2); + else if(retinexParams.gammaretinex == "mid") + retinexgamtab = &(Color::gammatab_13_2); + else if(retinexParams.gammaretinex == "hig") + retinexgamtab = &(Color::gammatab_145_3); + +if(retinexParams.gammaretinex != "none") {//gamma +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { + for (int j = border; j < W - border; j++ ) { + float R_,G_,B_; + R_=red[i][j]; + G_=green[i][j]; + B_=blue[i][j]; + red[i][j] = (*retinexgamtab)[R_]; + green[i][j] = (*retinexgamtab)[G_]; + blue[i][j] = (*retinexgamtab)[B_]; + } + } +} if(useHsl) { #ifdef _OPENMP @@ -1916,8 +1941,16 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar for (int j = border; j < W - border; j++) { float X, Y, Z, L, aa, bb; int pos; + float R_,G_,B_; + R_ = red[i][j]; + G_ = green[i][j]; + B_ = blue[i][j]; //rgb=>lab - Color::rgbxyz(red[i][j], green[i][j], blue[i][j], X, Y, Z, wp); + // R_ = (*retinexigamtab)[red[i][j]]; + // G_ = (*retinexigamtab)[green[i][j]]; + // B_ = (*retinexigamtab)[blue[i][j]]; + + Color::rgbxyz(R_, G_, B_, X, Y, Z, wp); //convert Lab Color::XYZ2Lab(X, Y, Z, L, aa, bb); conversionBuffer[0][i - border][j - border] = aa; @@ -1944,6 +1977,9 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar } } + + + } void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) @@ -1968,6 +2004,13 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf if (settings->verbose) { printf ("Applying Retinex\n"); } + LUTf *retinexigamtab;//gamma before and after Retinex to restore tones + if(deh.gammaretinex == "low") + retinexigamtab = &(Color::igammatab_115_2); + else if(deh.gammaretinex == "mid") + retinexigamtab = &(Color::igammatab_13_2); + else if(deh.gammaretinex == "hig") + retinexigamtab = &(Color::igammatab_145_3); // We need a buffer with original L data to allow correct blending // red, green and blue still have original size of raw, but we can't use the borders @@ -2104,9 +2147,11 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf vfloat R, G, B; Color::Lab2XYZ(LVFU(LBuffer[i - border][j - border]), LVFU(conversionBuffer[0][i - border][j - border]), LVFU(conversionBuffer[1][i - border][j - border]), x_, y_, z_) ; Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); + _mm_storeu_ps(&red[i][j], R); _mm_storeu_ps(&green[i][j], G); - _mm_storeu_ps(&blue[i][j], B); + _mm_storeu_ps(&blue[i][j], B); + } #endif @@ -2119,8 +2164,25 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf red[i][j] = R; green[i][j] = G; blue[i][j] = B; + } } +} +if(deh.gammaretinex != "none"){//inverse gamma +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { + for (int j = border; j < W - border; j++ ) { + float R_,G_,B_; + R_=red[i][j]; + G_=green[i][j]; + B_=blue[i][j]; + red[i][j] = (*retinexigamtab)[R_]; + green[i][j] = (*retinexigamtab)[G_]; + blue[i][j] = (*retinexigamtab)[B_]; + } + } } t5.set(); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 9acea5dd6..71ff47c6d 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -442,6 +442,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { ALLNORAW, // EvRetinexmedianmap ALLNORAW, // EvLlimd DEMOSAIC, // Evretinexcolorspace + DEMOSAIC, // EvRetinexgamma ALLNORAW // EvLCDHCurve diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 77f2d50f8..e3fa2de1e 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -53,6 +53,7 @@ void ParamsEdited::set (bool v) retinex.cdHcurve = v; retinex.retinexMethod = v; retinex.retinexcolorspace = v; + retinex.gammaretinex = v; retinex.enabled = v; retinex.str = v; retinex.scal = v; @@ -524,6 +525,7 @@ void ParamsEdited::initFrom (const std::vector retinex.transmissionCurve = retinex.transmissionCurve && p.retinex.transmissionCurve == other.retinex.transmissionCurve; retinex.retinexMethod = retinex.retinexMethod && p.retinex.retinexMethod == other.retinex.retinexMethod; retinex.retinexcolorspace = retinex.retinexcolorspace && p.retinex.retinexcolorspace == other.retinex.retinexcolorspace; + retinex.gammaretinex = retinex.gammaretinex && p.retinex.gammaretinex == other.retinex.gammaretinex; retinex.str = retinex.str && p.retinex.str == other.retinex.str; retinex.scal = retinex.scal && p.retinex.scal == other.retinex.scal; retinex.neigh = retinex.neigh && p.retinex.neigh == other.retinex.neigh; @@ -1048,6 +1050,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.retinex.retinexcolorspace = mods.retinex.retinexcolorspace; } + if (retinex.gammaretinex) { + toEdit.retinex.gammaretinex = mods.retinex.gammaretinex; + } + if (retinex.str) { toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 7600b3bb1..850c8589d 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -66,6 +66,7 @@ public: bool offs; bool retinexMethod; bool retinexcolorspace; + bool gammaretinex; bool vart; bool limd; bool method; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index b1c290e14..a6a435356 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -46,7 +46,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexcolorspace->append_text (M("TP_RETINEX_HSLSPACE_LIN")); retinexcolorspace->set_active(0); retinexColorSpaceConn = retinexcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexColorSpaceChanged) ); - + dhbox->pack_start(*retinexMethod); dhbox->pack_start(*retinexcolorspace); @@ -96,6 +96,18 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), transmissionCurveEditorG->curveListComplete(); + gambox = Gtk::manage (new Gtk::HBox ()); + labgam = Gtk::manage (new Gtk::Label (M("TP_RETINEX_GAM") + ":")); + gambox->pack_start (*labgam, Gtk::PACK_SHRINK, 1); + + gammaretinex = Gtk::manage (new MyComboBoxText ()); + gammaretinex->append_text (M("TP_RETINEX_GAMMA_NONE")); + gammaretinex->append_text (M("TP_RETINEX_GAMMA_LOW")); + gammaretinex->append_text (M("TP_RETINEX_GAMMA_MID")); + gammaretinex->append_text (M("TP_RETINEX_GAMMA_HIGH")); + gammaretinex->set_active(0); + gammaretinexConn = gammaretinex->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::gammaretinexChanged) ); + gammaretinex->set_tooltip_markup (M("TP_RETINEX_GAMMA_TOOLTIP")); str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); @@ -103,7 +115,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); - + retinexVBox->pack_start (*str); str->show (); @@ -142,6 +154,11 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4); curveEditorGDH->show(); + gambox->pack_start(*gammaretinex); + + settingsVBox->pack_start(*gambox); + gammaretinex->show(); + settingsVBox->pack_start (*scal); scal->show (); @@ -212,6 +229,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), disableListener(); retinexColorSpaceChanged(); + gammaretinexChanged(); medianmapChanged(); enableListener(); @@ -326,6 +344,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) disableListener (); retinexMethodConn.block(true); retinexColorSpaceConn.block(true); + gammaretinexConn.block(true); if (pedited) { @@ -347,6 +366,10 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) retinexcolorspace->set_active_text(M("GENERAL_UNCHANGED")); } + if (!pedited->retinex.gammaretinex) { + gammaretinex->set_active_text(M("GENERAL_UNCHANGED")); + } + cdshape->setUnChanged (!pedited->retinex.cdcurve); cdshapeH->setUnChanged (!pedited->retinex.cdHcurve); transmissionShape->setUnChanged (!pedited->retinex.transmissionCurve); @@ -385,8 +408,19 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) retinexcolorspace->set_active (2); } + if (pp->retinex.gammaretinex == "none") { + gammaretinex->set_active (0); + } else if (pp->retinex.gammaretinex == "low") { + gammaretinex->set_active (1); + } else if (pp->retinex.gammaretinex == "mid") { + gammaretinex->set_active (2); + } else if (pp->retinex.gammaretinex == "hig") { + gammaretinex->set_active (3); + } + retinexMethodChanged (); retinexColorSpaceChanged(); + gammaretinexChanged(); medianmapConn.block(true); medianmapChanged (); @@ -397,6 +431,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) retinexMethodConn.block(false); retinexColorSpaceConn.block(false); + gammaretinexConn.block(false); transmissionShape->setCurve (pp->retinex.transmissionCurve); @@ -424,6 +459,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) if (pedited) { pedited->retinex.retinexMethod = retinexMethod->get_active_text() != M("GENERAL_UNCHANGED"); pedited->retinex.retinexcolorspace = retinexcolorspace->get_active_text() != M("GENERAL_UNCHANGED"); + pedited->retinex.gammaretinex = gammaretinex->get_active_text() != M("GENERAL_UNCHANGED"); //%%%%%%%%%%%%%%%%%%%%%% pedited->retinex.str = str->getEditedState (); @@ -456,6 +492,17 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) } else if (retinexcolorspace->get_active_row_number() == 2) { pp->retinex.retinexcolorspace = "HSLLIN"; } + + if (gammaretinex->get_active_row_number() == 0) { + pp->retinex.gammaretinex = "none"; + } else if (gammaretinex->get_active_row_number() == 1) { + pp->retinex.gammaretinex = "low"; + } else if (gammaretinex->get_active_row_number() == 2) { + pp->retinex.gammaretinex = "mid"; + } else if (gammaretinex->get_active_row_number() == 3) { + pp->retinex.gammaretinex = "hig"; + } + } void Retinex::retinexMethodChanged() @@ -492,6 +539,16 @@ void Retinex::retinexColorSpaceChanged() } } +void Retinex::gammaretinexChanged() +{ + + ColorSpaceUpdateUI(); + + if (listener) { + listener->panelChanged (Evretinexgamma, gammaretinex->get_active_text ()); + } +} + void Retinex::medianmapChanged () { if (batchMode) { diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 305682660..4b01865db 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -32,8 +32,12 @@ protected: Gtk::Label* labmdh; Gtk::HBox* dhbox; + Gtk::Label* labgam; + Gtk::HBox* gambox; + MyComboBoxText* retinexMethod; MyComboBoxText* retinexcolorspace; + MyComboBoxText* gammaretinex; Gtk::CheckButton* medianmap; double nextmin; double nextmax; @@ -52,6 +56,7 @@ protected: CurveEditorGroup* transmissionCurveEditorG; sigc::connection retinexMethodConn; sigc::connection retinexColorSpaceConn; + sigc::connection gammaretinexConn; FlatCurveEditor* transmissionShape; bool lastmedianmap; sigc::connection medianmapConn; @@ -77,6 +82,7 @@ public: void curveChanged (CurveEditor* ce); void retinexMethodChanged(); void retinexColorSpaceChanged(); + void gammaretinexChanged(); void ColorSpaceUpdateUI(); void writeOptions (std::vector &tpOpen); void updateToolState (std::vector &tpOpen); From 645791fd7138e9477dcb387e864c0ca7caef1c4e Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 18 Sep 2015 17:23:44 +0200 Subject: [PATCH 38/71] enhancement gamma free retinex --- rtdata/languages/default | 9 ++++-- rtengine/color.cc | 2 +- rtengine/color.h | 11 ++++++++ rtengine/procevents.h | 2 ++ rtengine/procparams.cc | 28 ++++++++++++++++++ rtengine/procparams.h | 2 ++ rtengine/rawimagesource.cc | 58 +++++++++++++++++++++++++++++++------- rtengine/refreshmap.cc | 4 ++- rtgui/paramsedited.cc | 12 ++++++++ rtgui/paramsedited.h | 2 ++ rtgui/retinex.cc | 58 +++++++++++++++++++++++++++++++++++++- rtgui/retinex.h | 2 ++ 12 files changed, 175 insertions(+), 15 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 278b0f5e3..ed0d098b2 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -650,7 +650,9 @@ HISTORY_MSG_417;Retinex - Transmission median HISTORY_MSG_418;Retinex - Threshold HISTORY_MSG_419;Retinex - Color space HISTORY_MSG_420;Retinex - Histogram - HSL -HISTORY_MSG_421;Retinex - Gamma +HISTORY_MSG_421;Retinex - Gamma retinex +HISTORY_MSG_422;Retinex - gamma +HISTORY_MSG_423;Retinex - slope HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1561,11 +1563,14 @@ TP_RETINEX_CURVEEDITOR_CD;L=f(L) TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts TP_RETINEX_GAIN;Gain TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram. -TP_RETINEX_GAM;Gamma +TP_RETINEX_GAM;Gamma retinex TP_RETINEX_GAMMA_NONE;None TP_RETINEX_GAMMA_LOW;Low TP_RETINEX_GAMMA_MID;Middle TP_RETINEX_GAMMA_HIGH;High +TP_RETINEX_GAMMA_FREE;Free +TP_RETINEX_GAMMA;Gamma +TP_RETINEX_SLOPE;Slope TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex\nDifferent from Retinex curves or others curves (Lab, Exposure,..) TP_RETINEX_HIGH;High TP_RETINEX_HSLSPACE_LIN;HSL-Linear diff --git a/rtengine/color.cc b/rtengine/color.cc index b403ee7dc..03a9bda93 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -233,7 +233,7 @@ void Color::init () for (int i = 0; i < 65536; i++) { gammatab_26_11[i] = (65535.0 * gamma26_11 (i / 65535.0)); } - +//gammatab_145_3 for (int i = 0; i < 65536; i++) { igammatab_26_11[i] = (65535.0 * igamma26_11 (i / 65535.0)); } diff --git a/rtengine/color.h b/rtengine/color.h index 53d5a8b19..1eb799cda 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -981,6 +981,17 @@ public: { return x <= 0.027345 ? x / 3.0 : exp(log((x + 0.012305) / 1.012305) * 1.45); } + +//gamma for Retinex + static inline double gammareti (double x, double gamma, double start, double slope, double mul, double add) + { + return (x <= start ? x*slope : exp(log(x) / gamma) * mul - add); + } + static inline double igammareti (double x, double gamma, double start, double slope, double mul, double add) + { + return (x <= start * slope ? x / slope : exp(log((x + add) / mul) * gamma) ); + } + // gamma function with adjustable parameters diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 0f87bf1bd..ddae2f583 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -448,6 +448,8 @@ enum ProcEvent { EvretinexColorSpace = 418, // 418 if we want a separate history entry "Retinex - Color space", 406 if we don't EvLCDHCurve = 419, Evretinexgamma = 420, + EvLgam = 421, + EvLslope = 422, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index b2162bed7..566bcd13a 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -142,6 +142,8 @@ void RetinexParams::setDefaults() enabled = false; str = 20; scal = 3; + gam = 1.30; + slope = 3.; neigh = 80; gain = 50; offs = 0; @@ -1436,6 +1438,14 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_integer ("Retinex", "Scal", retinex.scal); } + if (!pedited || pedited->retinex.gam) { + keyFile.set_double ("Retinex", "Gam", retinex.gam); + } + + if (!pedited || pedited->retinex.slope) { + keyFile.set_double ("Retinex", "Slope", retinex.slope); + } + if (!pedited || pedited->retinex.enabled) { keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled); } @@ -3818,6 +3828,22 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Retinex", "Gam")) { + retinex.gam = keyFile.get_double ("Retinex", "Gam"); + + if (pedited) { + pedited->retinex.gam = true; + } + } + + if (keyFile.has_key ("Retinex", "Slope")) { + retinex.slope = keyFile.get_double ("Retinex", "Slope"); + + if (pedited) { + pedited->retinex.slope = true; + } + } + if (keyFile.has_key ("Retinex", "Gain")) { retinex.gain = keyFile.get_integer ("Retinex", "Gain"); @@ -7240,6 +7266,8 @@ bool ProcParams::operator== (const ProcParams& other) && retinex.transmissionCurve == other.retinex.transmissionCurve && retinex.str == other.retinex.str && retinex.scal == other.retinex.scal + && retinex.gam == other.retinex.gam + && retinex.slope == other.retinex.slope && retinex.neigh == other.retinex.neigh && retinex.gain == other.retinex.gain && retinex.limd == other.retinex.limd diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 9bd5ecb29..4c631b6c8 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -274,6 +274,8 @@ public: std::vector transmissionCurve; int str; int scal; + double gam; + double slope; int neigh; int gain; int offs; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index a9c4016c9..8897dca15 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1813,14 +1813,36 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar conversionBuffer[2] (W - 2 * border, H - 2 * border); LUTf *retinexgamtab;//gamma before and after Retinex to restore tones + LUTf lutTonereti; + lutTonereti(65536); + if(retinexParams.gammaretinex == "low") retinexgamtab = &(Color::gammatab_115_2); else if(retinexParams.gammaretinex == "mid") retinexgamtab = &(Color::gammatab_13_2); else if(retinexParams.gammaretinex == "hig") retinexgamtab = &(Color::gammatab_145_3); + else if(retinexParams.gammaretinex == "fre"){ + double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; + double pwr = 1.0 / retinexParams.gam; + double gamm = retinexParams.gam; + double ts = retinexParams.slope; + int mode = 0, imax = 0; + Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope + // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); + for (int i = 0; i < 65536; i++) { + double val = (i) / 65535.; + double start = g_a3; + double add = g_a3; + double mul = 1. + g_a4; + double x; + x = Color::gammareti (val, gamm, start, ts, mul , add); + lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values + } + retinexgamtab = &lutTonereti; + } -if(retinexParams.gammaretinex != "none") {//gamma +if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma #ifdef _OPENMP #pragma omp parallel for #endif @@ -1832,7 +1854,7 @@ if(retinexParams.gammaretinex != "none") {//gamma B_=blue[i][j]; red[i][j] = (*retinexgamtab)[R_]; green[i][j] = (*retinexgamtab)[G_]; - blue[i][j] = (*retinexgamtab)[B_]; + blue[i][j] = (*retinexgamtab)[B_]; } } } @@ -1946,10 +1968,6 @@ if(retinexParams.gammaretinex != "none") {//gamma G_ = green[i][j]; B_ = blue[i][j]; //rgb=>lab - // R_ = (*retinexigamtab)[red[i][j]]; - // G_ = (*retinexigamtab)[green[i][j]]; - // B_ = (*retinexigamtab)[blue[i][j]]; - Color::rgbxyz(R_, G_, B_, X, Y, Z, wp); //convert Lab Color::XYZ2Lab(X, Y, Z, L, aa, bb); @@ -2004,6 +2022,9 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf if (settings->verbose) { printf ("Applying Retinex\n"); } + LUTf lutToneireti; + lutToneireti(65536); + LUTf *retinexigamtab;//gamma before and after Retinex to restore tones if(deh.gammaretinex == "low") retinexigamtab = &(Color::igammatab_115_2); @@ -2011,7 +2032,25 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf retinexigamtab = &(Color::igammatab_13_2); else if(deh.gammaretinex == "hig") retinexigamtab = &(Color::igammatab_145_3); - + else if(deh.gammaretinex == "fre"){ + double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; + double pwr = 1.0 / deh.gam; + double gamm = deh.gam; + double ts = deh.slope; + int mode = 0, imax = 0; + Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope + // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); + for (int i = 0; i < 65536; i++) { + double val = (i) / 65535.; + double x; + double mul = 1. + g_a4; + double add = g_a4; + double start = g_a2; + x = Color::igammareti (val, gamm, start, ts, mul , add); + lutToneireti[i] = CLIP(x * 65535.); + } + retinexigamtab = &lutToneireti; + } // We need a buffer with original L data to allow correct blending // red, green and blue still have original size of raw, but we can't use the borders const int HNew = H - 2 * border; @@ -2164,11 +2203,10 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf red[i][j] = R; green[i][j] = G; blue[i][j] = B; - } } } -if(deh.gammaretinex != "none"){//inverse gamma +if(deh.gammaretinex != "none" && deh.str !=0){//inverse gamma #ifdef _OPENMP #pragma omp parallel for #endif @@ -2180,7 +2218,7 @@ if(deh.gammaretinex != "none"){//inverse gamma B_=blue[i][j]; red[i][j] = (*retinexigamtab)[R_]; green[i][j] = (*retinexigamtab)[G_]; - blue[i][j] = (*retinexigamtab)[B_]; + blue[i][j] = (*retinexigamtab)[B_]; } } } diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 1ce5a4211..4ad96ebd2 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -447,6 +447,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { ALLNORAW, // EvLlimd DEMOSAIC, // Evretinexcolorspace ALLNORAW, // EvLCDHCurve - DEMOSAIC // Evretinexgamma + DEMOSAIC, // Evretinexgamma + DEMOSAIC, // EvLgam + DEMOSAIC // EvLslope }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index e3fa2de1e..dc142f6de 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -57,6 +57,8 @@ void ParamsEdited::set (bool v) retinex.enabled = v; retinex.str = v; retinex.scal = v; + retinex.gam = v; + retinex.slope = v; retinex.neigh = v; retinex.gain = v; retinex.offs = v; @@ -528,6 +530,8 @@ void ParamsEdited::initFrom (const std::vector retinex.gammaretinex = retinex.gammaretinex && p.retinex.gammaretinex == other.retinex.gammaretinex; retinex.str = retinex.str && p.retinex.str == other.retinex.str; retinex.scal = retinex.scal && p.retinex.scal == other.retinex.scal; + retinex.gam = retinex.gam && p.retinex.gam == other.retinex.gam; + retinex.slope = retinex.slope && p.retinex.slope == other.retinex.slope; retinex.neigh = retinex.neigh && p.retinex.neigh == other.retinex.neigh; retinex.gain = retinex.gain && p.retinex.gain == other.retinex.gain; retinex.offs = retinex.offs && p.retinex.offs == other.retinex.offs; @@ -1053,6 +1057,14 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (retinex.gammaretinex) { toEdit.retinex.gammaretinex = mods.retinex.gammaretinex; } + + if (retinex.gam) { + toEdit.retinex.gam = mods.retinex.gam; + } + + if (retinex.slope) { + toEdit.retinex.slope = mods.retinex.slope; + } if (retinex.str) { toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 850c8589d..bfe7fbe02 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -61,6 +61,8 @@ public: bool enabled; bool str; bool scal; + bool gam; + bool slope; bool neigh; bool gain; bool offs; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 9c4b2e3e2..1a848a037 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -105,10 +105,13 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), gammaretinex->append_text (M("TP_RETINEX_GAMMA_LOW")); gammaretinex->append_text (M("TP_RETINEX_GAMMA_MID")); gammaretinex->append_text (M("TP_RETINEX_GAMMA_HIGH")); + gammaretinex->append_text (M("TP_RETINEX_GAMMA_FREE")); gammaretinex->set_active(0); gammaretinexConn = gammaretinex->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::gammaretinexChanged) ); gammaretinex->set_tooltip_markup (M("TP_RETINEX_GAMMA_TOOLTIP")); + gam = Gtk::manage (new Adjuster (M("TP_RETINEX_GAMMA"), 1.1, 1.6, 0.01, 1.30)); + slope = Gtk::manage (new Adjuster (M("TP_RETINEX_SLOPE"), 2., 20., 0.1, 3.)); str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); @@ -158,6 +161,13 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start(*gambox); gammaretinex->show(); + + settingsVBox->pack_start (*gam); + gam->show (); + + settingsVBox->pack_start (*slope); + slope->show (); + settingsVBox->pack_start (*scal); scal->show (); @@ -193,6 +203,18 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), if (scal->delay < 200) { scal->delay = 200; } + + gam->setAdjusterListener (this); + + if (gam->delay < 500) { + gam->delay = 500; + } + + slope->setAdjusterListener (this); + + if (slope->delay < 500) { + slope->delay = 500; + } neigh->setAdjusterListener (this); @@ -350,6 +372,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) if (pedited) { scal->setEditedState (pedited->retinex.scal ? Edited : UnEdited); neigh->setEditedState (pedited->retinex.neigh ? Edited : UnEdited); + gam->setEditedState (pedited->retinex.gam ? Edited : UnEdited); + slope->setEditedState (pedited->retinex.slope ? Edited : UnEdited); gain->setEditedState (pedited->retinex.gain ? Edited : UnEdited); offs->setEditedState (pedited->retinex.offs ? Edited : UnEdited); vart->setEditedState (pedited->retinex.vart ? Edited : UnEdited); @@ -383,6 +407,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) scal->setValue (pp->retinex.scal); vart->setValue (pp->retinex.vart); limd->setValue (pp->retinex.limd); + gam->setValue (pp->retinex.gam); + slope->setValue (pp->retinex.slope); setEnabled (pp->retinex.enabled); @@ -416,6 +442,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) gammaretinex->set_active (2); } else if (pp->retinex.gammaretinex == "hig") { gammaretinex->set_active (3); + } else if (pp->retinex.gammaretinex == "fre") { + gammaretinex->set_active (4); } retinexMethodChanged (); @@ -445,6 +473,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.str = str->getValue (); pp->retinex.scal = (int)scal->getValue (); + pp->retinex.gam = gam->getValue (); + pp->retinex.slope = slope->getValue (); pp->retinex.neigh = neigh->getValue (); pp->retinex.gain = (int)gain->getValue (); pp->retinex.offs = (int)offs->getValue (); @@ -464,6 +494,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) //%%%%%%%%%%%%%%%%%%%%%% pedited->retinex.str = str->getEditedState (); pedited->retinex.scal = scal->getEditedState (); + pedited->retinex.gam = gam->getEditedState (); + pedited->retinex.slope = slope->getEditedState (); pedited->retinex.neigh = neigh->getEditedState (); pedited->retinex.gain = gain->getEditedState (); pedited->retinex.offs = offs->getEditedState (); @@ -501,6 +533,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.gammaretinex = "mid"; } else if (gammaretinex->get_active_row_number() == 3) { pp->retinex.gammaretinex = "hig"; + } else if (gammaretinex->get_active_row_number() == 4) { + pp->retinex.gammaretinex = "fre"; } } @@ -531,7 +565,6 @@ void Retinex::ColorSpaceUpdateUI () void Retinex::retinexColorSpaceChanged() { - ColorSpaceUpdateUI(); if (listener) { @@ -541,6 +574,15 @@ void Retinex::retinexColorSpaceChanged() void Retinex::gammaretinexChanged() { + if (!batchMode) { + if(gammaretinex->get_active_row_number() == 4) { + gam->show(); + slope->show(); + } else if(gammaretinex->get_active_row_number() != 4) { + gam->hide(); + slope->hide(); + } + } ColorSpaceUpdateUI(); @@ -589,6 +631,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi scal->setDefault (defParams->retinex.scal); vart->setDefault (defParams->retinex.vart); limd->setDefault (defParams->retinex.limd); + gam->setDefault (defParams->retinex.gam); + slope->setDefault (defParams->retinex.slope); if (pedited) { neigh->setDefaultEditedState (pedited->retinex.neigh ? Edited : UnEdited); @@ -598,6 +642,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi scal->setDefaultEditedState (pedited->retinex.scal ? Edited : UnEdited); vart->setDefaultEditedState (pedited->retinex.vart ? Edited : UnEdited); limd->setDefaultEditedState (pedited->retinex.limd ? Edited : UnEdited); + gam->setDefaultEditedState (pedited->retinex.gam ? Edited : UnEdited); + slope->setDefaultEditedState (pedited->retinex.slope ? Edited : UnEdited); } else { neigh->setDefaultEditedState (Irrelevant); @@ -607,6 +653,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi limd->setDefaultEditedState (Irrelevant); str->setDefaultEditedState (Irrelevant); scal->setDefaultEditedState (Irrelevant); + gam->setDefaultEditedState (Irrelevant); + slope->setDefaultEditedState (Irrelevant); } } @@ -644,6 +692,10 @@ void Retinex::adjusterChanged (Adjuster* a, double newval) listener->panelChanged (EvLvart, vart->getTextValue()); } else if (a == limd) { listener->panelChanged (EvLlimd, limd->getTextValue()); + } else if (a == gam) { + listener->panelChanged (EvLgam, gam->getTextValue()); + } else if (a == slope) { + listener->panelChanged (EvLslope, slope->getTextValue()); } } @@ -696,6 +748,8 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp) offs->trimValue(pp->retinex.offs); vart->trimValue(pp->retinex.vart); limd->trimValue(pp->retinex.limd); + gam->trimValue(pp->retinex.gam); + slope->trimValue(pp->retinex.slope); } void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI) @@ -713,6 +767,8 @@ void Retinex::setBatchMode (bool batchMode) offs->showEditedCB (); str->showEditedCB (); scal->showEditedCB (); + gam->showEditedCB (); + slope->showEditedCB (); vart->showEditedCB (); limd->showEditedCB (); curveEditorGD->setBatchMode (batchMode); diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 4b01865db..a563fa271 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -28,6 +28,8 @@ protected: Adjuster* offs; Adjuster* vart; Adjuster* limd; + Adjuster* gam; + Adjuster* slope; MyExpander* expsettings; Gtk::Label* labmdh; From bedd95e181d5387f04de1d70493ccb7b8a4aef36 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 22 Sep 2015 09:07:47 +0200 Subject: [PATCH 39/71] Partialpaste omission Retinex --- rtgui/partialpastedlg.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 046a9ccab..17f23a787 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -698,6 +698,10 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param filterPE.epd = falsePE.epd; } + if (!retinex->get_active ()) { + filterPE.retinex = falsePE.retinex; + } + if (!pcvignette->get_active ()) { filterPE.pcvignette = falsePE.pcvignette; } From 5f2151ba4dd8f19c5ebc178c64644d45c825b3fd Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 22 Sep 2015 17:26:40 +0200 Subject: [PATCH 40/71] Segfault when pasting a copied profile with retinex filter, fixes #2913 --- rtgui/paramsedited.cc | 7 ++++++- rtgui/paramsedited.h | 2 +- rtgui/toolpanelcoord.cc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index dc142f6de..58064b970 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1065,7 +1065,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (retinex.slope) { toEdit.retinex.slope = mods.retinex.slope; } - + if (retinex.str) { toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str; } @@ -2681,3 +2681,8 @@ bool LensProfParamsEdited::isUnchanged() const { return lcpFile; } + +bool RetinexParamsEdited::isUnchanged() const +{ + return enabled && retinexcolorspace && gammaretinex && gam && slope; +} \ No newline at end of file diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index bfe7fbe02..d71f4da73 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -77,7 +77,7 @@ public: bool cdHcurve; bool retinex; bool medianmap; - + bool isUnchanged() const; }; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 3c82cd0a8..2c7ae9115 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -396,7 +396,7 @@ void ToolPanelCoordinator::profileChange (const PartialProfile *nparams, rtengi lParams[1] = *mergedParams; pe.initFrom (lParams); - filterRawRefresh = pe.raw.isUnchanged() && pe.lensProf.isUnchanged(); + filterRawRefresh = pe.raw.isUnchanged() && pe.lensProf.isUnchanged() && pe.retinex.isUnchanged(); } *params = *mergedParams; From e234bb92785f2425c79e0d182c8e4451bd933f55 Mon Sep 17 00:00:00 2001 From: Desmis Date: Wed, 23 Sep 2015 11:23:30 +0200 Subject: [PATCH 41/71] Batch processing GUI --- rtgui/addsetids.h | 18 ++++++++++-------- rtgui/batchtoolpanelcoord.cc | 25 ++++++++++++++++--------- rtgui/options.cc | 16 +++++++++------- rtgui/paramsedited.cc | 25 +++++++++---------------- rtgui/preferences.cc | 16 +++++++++------- rtgui/retinex.cc | 5 +++-- rtgui/retinex.h | 2 +- 7 files changed, 57 insertions(+), 50 deletions(-) diff --git a/rtgui/addsetids.h b/rtgui/addsetids.h index 5d94ef71f..5db492db3 100644 --- a/rtgui/addsetids.h +++ b/rtgui/addsetids.h @@ -107,15 +107,17 @@ #define ADDSET_WA_EDGEDETECTTHR2 99 #define ADDSET_WA_TMRS 100 #define ADDSET_WA_GAMMA 101 -#define ADDSET_DH_STR 102 -#define ADDSET_DH_SCAL 103 -#define ADDSET_DH_NEIGH 104 -#define ADDSET_DH_LIMD 105 -#define ADDSET_DH_GAIN 106 -#define ADDSET_DH_OFFS 107 -#define ADDSET_DH_VART 108 +#define ADDSET_RETI_STR 102 +#define ADDSET_RETI_SCAL 103 +#define ADDSET_RETI_NEIGH 104 +#define ADDSET_RETI_LIMD 105 +#define ADDSET_RETI_GAIN 106 +#define ADDSET_RETI_OFFS 107 +#define ADDSET_RETI_VART 108 +#define ADDSET_RETI_GAM 109 +#define ADDSET_RETI_SLO 110 // When adding items, make sure to update ADDSET_PARAM_NUM -#define ADDSET_PARAM_NUM 109 // THIS IS USED AS A DELIMITER!! +#define ADDSET_PARAM_NUM 111 // THIS IS USED AS A DELIMITER!! #endif diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index 2486f7ea9..fa057e205 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -167,7 +167,7 @@ void BatchToolPanelCoordinator::initSession () blackwhite->setAdjusterBehavior (false, false); colortoning->setAdjusterBehavior (false, false, false, false, false); filmSimulation->setAdjusterBehavior(false); - retinex->setAdjusterBehavior (false, false, false, false, false, false, false); + retinex->setAdjusterBehavior (false, false, false, false, false, false, false, false, false); shadowshighlights->setAdjusterBehavior (false, false, false); dirpyrequalizer->setAdjusterBehavior (false, false, false); @@ -204,7 +204,7 @@ void BatchToolPanelCoordinator::initSession () // colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRPROTECT], options.baBehav[ADDSET_COLORTONING_BALANCE]); colortoning->setAdjusterBehavior (options.baBehav[ADDSET_COLORTONING_SPLIT], options.baBehav[ADDSET_COLORTONING_SATTHRESHOLD], options.baBehav[ADDSET_COLORTONING_SATOPACITY], options.baBehav[ADDSET_COLORTONING_STRENGTH], options.baBehav[ADDSET_COLORTONING_BALANCE]); filmSimulation->setAdjusterBehavior(options.baBehav[ADDSET_FILMSIMULATION_STRENGTH]); - retinex->setAdjusterBehavior (options.baBehav[ADDSET_DH_STR], options.baBehav[ADDSET_DH_SCAL], options.baBehav[ADDSET_DH_NEIGH], options.baBehav[ADDSET_DH_LIMD], options.baBehav[ADDSET_DH_GAIN], options.baBehav[ADDSET_DH_OFFS], options.baBehav[ADDSET_DH_VART]); + retinex->setAdjusterBehavior (options.baBehav[ADDSET_RETI_STR], options.baBehav[ADDSET_RETI_SCAL], options.baBehav[ADDSET_RETI_NEIGH], options.baBehav[ADDSET_RETI_LIMD], options.baBehav[ADDSET_RETI_GAIN], options.baBehav[ADDSET_RETI_OFFS], options.baBehav[ADDSET_RETI_VART], options.baBehav[ADDSET_RETI_GAM], options.baBehav[ADDSET_RETI_SLO]); chmixer->setAdjusterBehavior (options.baBehav[ADDSET_CHMIXER] ); blackwhite->setAdjusterBehavior (options.baBehav[ADDSET_BLACKWHITE_HUES], options.baBehav[ADDSET_BLACKWHITE_GAMMA]); @@ -578,35 +578,42 @@ void BatchToolPanelCoordinator::initSession () pparams.wavelet.gamma = 0; } - if (options.baBehav[ADDSET_DH_STR]) { + if (options.baBehav[ADDSET_RETI_STR]) { pparams.retinex.str = 0; } - if (options.baBehav[ADDSET_DH_SCAL]) { + if (options.baBehav[ADDSET_RETI_SCAL]) { pparams.retinex.scal = 0; } - if (options.baBehav[ADDSET_DH_NEIGH]) { + if (options.baBehav[ADDSET_RETI_NEIGH]) { pparams.retinex.neigh = 0; } - if (options.baBehav[ADDSET_DH_LIMD]) { + if (options.baBehav[ADDSET_RETI_LIMD]) { pparams.retinex.limd = 0; } - if (options.baBehav[ADDSET_DH_GAIN]) { + if (options.baBehav[ADDSET_RETI_GAIN]) { pparams.retinex.gain = 0; } - if (options.baBehav[ADDSET_DH_OFFS]) { + if (options.baBehav[ADDSET_RETI_OFFS]) { pparams.retinex.offs = 0; } - if (options.baBehav[ADDSET_DH_VART]) { + if (options.baBehav[ADDSET_RETI_VART]) { pparams.retinex.vart = 0; } + if (options.baBehav[ADDSET_RETI_GAM]) { + pparams.retinex.gam = 0; + } + if (options.baBehav[ADDSET_RETI_SLO]) { + pparams.retinex.slope = 0; + } + if (options.baBehav[ADDSET_DIRPYRDN_LUMA]) { pparams.dirpyrDenoise.luma = 0; } diff --git a/rtgui/options.cc b/rtgui/options.cc index 600f9ed68..7b6858e13 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -598,13 +598,15 @@ void Options::setDefaults () 0, //ADDSET_WA_EDGEDETECTTHR2 0, //ADDSET_WA_TMRS 0, //ADDSET_WA_GAMMA - 0, //ADDSET_DH_STR - 0, //ADDSET_DH_SCAL - 0, //ADDSET_DH_NEIGH - 0, //ADDSET_DH_LIMD - 0, //ADDSET_DH_GAIN - 0, //ADDSET_DH_OFFS - 0, //ADDSET_DH_VART + 0, //ADDSET_RETI_STR + 0, //ADDSET_RETI_SCAL + 0, //ADDSET_RETI_NEIGH + 0, //ADDSET_RETI_LIMD + 0, //ADDSET_RETI_GAIN + 0, //ADDSET_RETI_OFFS + 0, //ADDSET_RETI_VART + 0, //ADDSET_RETI_GAM + 0, //ADDSET_RETI_SLO }; baBehav = std::vector (babehav, babehav + ADDSET_PARAM_NUM); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 58064b970..2cd5acb4a 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1059,19 +1059,19 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten } if (retinex.gam) { - toEdit.retinex.gam = mods.retinex.gam; + toEdit.retinex.gam = dontforceSet && options.baBehav[ADDSET_RETI_GAM] ? toEdit.retinex.gam + mods.retinex.gam : mods.retinex.gam; } if (retinex.slope) { - toEdit.retinex.slope = mods.retinex.slope; + toEdit.retinex.slope = dontforceSet && options.baBehav[ADDSET_RETI_SLO] ? toEdit.retinex.slope + mods.retinex.slope : mods.retinex.slope; } if (retinex.str) { - toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_DH_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str; + toEdit.retinex.str = dontforceSet && options.baBehav[ADDSET_RETI_STR] ? toEdit.retinex.str + mods.retinex.str : mods.retinex.str; } if (retinex.scal) { - toEdit.retinex.scal = dontforceSet && options.baBehav[ADDSET_DH_SCAL] ? toEdit.retinex.scal + mods.retinex.scal : mods.retinex.scal; + toEdit.retinex.scal = dontforceSet && options.baBehav[ADDSET_RETI_SCAL] ? toEdit.retinex.scal + mods.retinex.scal : mods.retinex.scal; } if (retinex.medianmap) { @@ -1079,23 +1079,23 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten } if (retinex.neigh) { - toEdit.retinex.neigh = dontforceSet && options.baBehav[ADDSET_DH_NEIGH] ? toEdit.retinex.neigh + mods.retinex.neigh : mods.retinex.neigh; + toEdit.retinex.neigh = dontforceSet && options.baBehav[ADDSET_RETI_NEIGH] ? toEdit.retinex.neigh + mods.retinex.neigh : mods.retinex.neigh; } if (retinex.limd) { - toEdit.retinex.limd = dontforceSet && options.baBehav[ADDSET_DH_LIMD] ? toEdit.retinex.limd + mods.retinex.limd : mods.retinex.limd; + toEdit.retinex.limd = dontforceSet && options.baBehav[ADDSET_RETI_LIMD] ? toEdit.retinex.limd + mods.retinex.limd : mods.retinex.limd; } if (retinex.gain) { - toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_DH_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain; + toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_RETI_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain; } if (retinex.offs) { - toEdit.retinex.offs = dontforceSet && options.baBehav[ADDSET_DH_OFFS] ? toEdit.retinex.offs + mods.retinex.offs : mods.retinex.offs; + toEdit.retinex.offs = dontforceSet && options.baBehav[ADDSET_RETI_OFFS] ? toEdit.retinex.offs + mods.retinex.offs : mods.retinex.offs; } if (retinex.vart) { - toEdit.retinex.vart = dontforceSet && options.baBehav[ADDSET_DH_VART] ? toEdit.retinex.vart + mods.retinex.vart : mods.retinex.vart; + toEdit.retinex.vart = dontforceSet && options.baBehav[ADDSET_RETI_VART] ? toEdit.retinex.vart + mods.retinex.vart : mods.retinex.vart; } if (labCurve.lcurve) { @@ -1130,17 +1130,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.labCurve.lccurve = mods.labCurve.lccurve; } -// if (labCurve.retinexMethod) { -// toEdit.labCurve.retinexMethod = mods.labCurve.retinexMethod; -// } if (labCurve.clcurve) { toEdit.labCurve.clcurve = mods.labCurve.clcurve; } -// if (labCurve.cdcurve) { -// toEdit.labCurve.cdcurve = mods.labCurve.cdcurve; - // } - if (labCurve.brightness) { toEdit.labCurve.brightness = dontforceSet && options.baBehav[ADDSET_LC_BRIGHTNESS] ? toEdit.labCurve.brightness + mods.labCurve.brightness : mods.labCurve.brightness; } diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 47a641634..be3bf3566 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -172,13 +172,15 @@ Gtk::Widget* Preferences::getBatchProcPanel () mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_RETINEX_LABEL")); - appendBehavList (mi, M("TP_RETINEX_STRENGTH"), ADDSET_DH_STR, false); - appendBehavList (mi, M("TP_RETINEX_NEIGH"), ADDSET_DH_NEIGH, false); - appendBehavList (mi, M("TP_RETINEX_SCAL"), ADDSET_DH_SCAL, false); - appendBehavList (mi, M("TP_RETINEX_GAIN"), ADDSET_DH_GAIN, false); - appendBehavList (mi, M("TP_RETINEX_OFFS"), ADDSET_DH_OFFS, false); - appendBehavList (mi, M("TP_RETINEX_LIMD"), ADDSET_DH_LIMD, false); - appendBehavList (mi, M("TP_RETINEX_VART"), ADDSET_DH_VART, false); + appendBehavList (mi, M("TP_RETINEX_STRENGTH"), ADDSET_RETI_STR, false); + appendBehavList (mi, M("TP_RETINEX_NEIGHBOR"), ADDSET_RETI_NEIGH, false); + appendBehavList (mi, M("TP_RETINEX_GAMMA"), ADDSET_RETI_GAM, false); + appendBehavList (mi, M("TP_RETINEX_SLOPE"), ADDSET_RETI_SLO, false); + appendBehavList (mi, M("TP_RETINEX_SCALES"), ADDSET_RETI_SCAL, false); + appendBehavList (mi, M("TP_RETINEX_GAIN"), ADDSET_RETI_GAIN, false); + appendBehavList (mi, M("TP_RETINEX_OFFSET"), ADDSET_RETI_OFFS, false); + appendBehavList (mi, M("TP_RETINEX_THRESHOLD"), ADDSET_RETI_LIMD, false); + appendBehavList (mi, M("TP_RETINEX_VARIANCE"), ADDSET_RETI_VART, false); mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_SHADOWSHLIGHTS_LABEL")); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 1a848a037..df9ff6ada 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -658,9 +658,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi } } -void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd) +void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd, bool gamAdd, bool slopeAdd) { - str->setAddMode(strAdd); neigh->setAddMode(neighAdd); scal->setAddMode(scalAdd); @@ -668,6 +667,8 @@ void Retinex::setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, boo gain->setAddMode(gainAdd); offs->setAddMode(offsAdd); vart->setAddMode(vartAdd); + gam->setAddMode(gamAdd); + slope->setAddMode(slopeAdd); } diff --git a/rtgui/retinex.h b/rtgui/retinex.h index a563fa271..4e8d2f05e 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -88,7 +88,7 @@ public: void ColorSpaceUpdateUI(); void writeOptions (std::vector &tpOpen); void updateToolState (std::vector &tpOpen); - void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd); + void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd, bool gamAdd, bool slopeAdd); void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); private: From aa42f7394cfc6eb8037fd1b6464e87c934990360 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 28 Sep 2015 12:35:43 +0200 Subject: [PATCH 42/71] Highlight magenta!! --- rtengine/imagesource.h | 2 +- rtengine/improccoordinator.cc | 2 +- rtengine/ipretinex.cc | 2 +- rtengine/procparams.cc | 4 ++-- rtengine/rawimagesource.cc | 42 ++++++++++++++++++++++++++++++++--- rtengine/rawimagesource.h | 2 +- rtengine/simpleprocess.cc | 2 +- rtgui/retinex.cc | 2 +- 8 files changed, 47 insertions(+), 11 deletions(-) diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 4124170f9..73c8b0786 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,7 +69,7 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; - virtual void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; + virtual void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 4744c3171..0bb316b7d 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -251,7 +251,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, lhist16RETI, histLRETI); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI);//enabled Retinex + imgsrc->retinex( params.icm, params.retinex, params.toneCurve, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI);//enabled Retinex if(dehaListener) { dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index ae5b78961..351902949 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -355,7 +355,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width absciss = amin * luminance[i][j] + bmin; } - luminance[i][j] *= (-0.25f + 2.5f * dehatransmissionCurve[absciss]); //new transmission + luminance[i][j] *= (-1.f + 4.f * dehatransmissionCurve[absciss]); //new transmission } } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 566bcd13a..505913f19 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -123,8 +123,8 @@ RetinexParams::RetinexParams () void RetinexParams::getDefaulttransmissionCurve(std::vector &curve) { - double v[12] = { 0.00, 0.25, 0.35, 0.35, - 0.60, 0.90, 0.35, 0.35, + double v[12] = { 0.00, 0.34, 0.35, 0.35, + 0.60, 0.75, 0.35, 0.35, 1.00, 0.50, 0.35, 0.35, }; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 8897dca15..3b4eecaf4 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1827,6 +1827,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar double pwr = 1.0 / retinexParams.gam; double gamm = retinexParams.gam; double ts = retinexParams.slope; + int mode = 0, imax = 0; Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); @@ -1837,6 +1838,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar double mul = 1. + g_a4; double x; x = Color::gammareti (val, gamm, start, ts, mul , add); + lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values } retinexgamtab = &lutTonereti; @@ -2013,8 +2015,8 @@ void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdc retinexParams.getCurves(retinextransmissionCurve); } -void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) -{ +void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) +{ MyTime t4, t5; t4.set(); @@ -2038,6 +2040,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf double gamm = deh.gam; double ts = deh.slope; int mode = 0, imax = 0; + Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); for (int i = 0; i < 65536; i++) { @@ -2047,6 +2050,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf double add = g_a4; double start = g_a2; x = Color::igammareti (val, gamm, start, ts, mul , add); + lutToneireti[i] = CLIP(x * 65535.); } retinexigamtab = &lutToneireti; @@ -2128,7 +2132,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf } MSR(LBuffer, conversionBuffer[2], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); - + if(useHsl) { #ifdef _OPENMP #pragma omp parallel for @@ -2163,7 +2167,39 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, LUTf {wiprof[1][0], wiprof[1][1], wiprof[1][2]}, {wiprof[2][0], wiprof[2][1], wiprof[2][2]} }; + // gamut control only in Lab mode + const bool highlight = Tc.hrenabled; +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { + for (int j= border; j < W - border; j++) { + + float Lprov1 = (LBuffer[i - border][j - border])/327.68f; + float Chprov1 = sqrt(SQR(conversionBuffer[0][i - border][j - border]) + SQR(conversionBuffer[1][i - border][j - border])) / 327.68f; + float HH = xatan2f(conversionBuffer[1][i - border][j - border], conversionBuffer[0][i - border][j - border]); + float2 sincosval; + + sincosval = xsincosf(HH); + float R,G,B; +#ifdef _DEBUG + bool neg = false; + bool more_rgb = false; + //gamut control : Lab values are in gamut + Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f, neg, more_rgb); +#else + //gamut control : Lab values are in gamut + Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f); +#endif + + + conversionBuffer[0][i - border][j - border] = 327.68f * Chprov1 * sincosval.y; + conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x; + LBuffer[i - border][j - border] = Lprov1 * 327.68f; + } + } + //end gamut control #ifdef __SSE2__ vfloat wipv[3][3]; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 122664131..1f926730f 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,7 +152,7 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili); - void retinex (ColorManagementParams cmp, RetinexParams deh, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI); + void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI); void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI); void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI); void flushRawData (); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 29b1da1f6..9f9d9875c 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -126,7 +126,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, dummy, dummy ); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex( params.icm, params.retinex, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); + imgsrc->retinex( params.icm, params.retinex, params.toneCurve, cdcurve, dehatransmissionCurve, conversionBuffer, dehacontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); } if (pl) { diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index df9ff6ada..760e1f468 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -110,7 +110,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), gammaretinexConn = gammaretinex->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::gammaretinexChanged) ); gammaretinex->set_tooltip_markup (M("TP_RETINEX_GAMMA_TOOLTIP")); - gam = Gtk::manage (new Adjuster (M("TP_RETINEX_GAMMA"), 1.1, 1.6, 0.01, 1.30)); + gam = Gtk::manage (new Adjuster (M("TP_RETINEX_GAMMA"), 0.6, 1.6, 0.01, 1.30)); slope = Gtk::manage (new Adjuster (M("TP_RETINEX_SLOPE"), 2., 20., 0.1, 3.)); str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); From aaf21544a3e85eda247c7a9dd1eac9621c3aec9d Mon Sep 17 00:00:00 2001 From: heckflosse Date: Thu, 1 Oct 2015 21:16:47 +0200 Subject: [PATCH 43/71] Speeduo for Hot/Dead pixel detection --- rtengine/rawimagesource.cc | 118 ++++++++++++++++++++++--------------- rtengine/sleefsseavx.c | 6 ++ 2 files changed, 77 insertions(+), 47 deletions(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index b425a9f88..6197dba17 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -40,6 +40,7 @@ #include #endif #include "opthelper.h" +#include "StopWatch.h" namespace rtengine { @@ -946,89 +947,112 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) */ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool findHotPixels, bool findDeadPixels ) { - float varthresh = (20.0 * (thresh / 100.0) + 1.0 ); - - // counter for dead or hot pixels - int counter = 0; + StopWatch Stop1("findHotDeadPixels"); + float varthresh = (20.0 * (thresh / 100.0) + 1.0 ) / 24.f; // allocate temporary buffer float (*cfablur); cfablur = (float (*)) malloc (H * W * sizeof * cfablur); + // counter for dead or hot pixels + int counter = 0; + #pragma omp parallel { - #pragma omp for + #pragma omp for schedule(dynamic,16) nowait - for (int i = 0; i < H; i++) { - int iprev, inext, jprev, jnext; + for (int i = 2; i < H - 2; i++) { float p[9], temp; - if (i < 2) { - iprev = i + 2; - } else { - iprev = i - 2; - } + for (int j = 2; j < W - 2; j++) { - if (i > H - 3) { - inext = i - 2; - } else { - inext = i + 2; - } - - for (int j = 0; j < W; j++) { - if (j < 2) { - jprev = j + 2; - } else { - jprev = j - 2; - } - - if (j > W - 3) { - jnext = j - 2; - } else { - jnext = j + 2; - } - - med3x3(rawData[iprev][jprev], rawData[iprev][j], rawData[iprev][jnext], - rawData[i][jprev], rawData[i][j], rawData[i][jnext], - rawData[inext][jprev], rawData[inext][j], rawData[inext][jnext], temp); + med3x3(rawData[i - 2][j - 2], rawData[i - 2][j], rawData[i - 2][j + 2], + rawData[i][j - 2], rawData[i][j], rawData[i][j + 2], + rawData[i + 2][j - 2], rawData[i + 2][j], rawData[i + 2][j + 2], temp); cfablur[i * W + j] = rawData[i][j] - temp; } } + // process borders. Former version calculated the median using mirrored border which does not make sense because the original pixel loses weight + // Setting the difference between pixel and median for border pixels to zero should do the job not worse then former version + #pragma omp critical + { + for(int i = 0; i < 2; i++) { + for(int j = 0; j < W; j++) { + cfablur[i * W + j] = 0.f; + } + } + + for(int i = 2; i < H - 2; i++) { + for(int j = 0; j < 2; j++) { + cfablur[i * W + j] = 0.f; + } + + for(int j = W - 2; j < W; j++) { + cfablur[i * W + j] = 0.f; + } + } + + for(int i = H - 2; i < H; i++) { + for(int j = 0; j < W; j++) { + cfablur[i * W + j] = 0.f; + } + } + } + #pragma omp barrier #pragma omp for reduction(+:counter) schedule (dynamic,16) //cfa pixel heat/death evaluation - for (int rr = 0; rr < H; rr++) { - int top = max(0, rr - 2); - int bottom = min(H - 1, rr + 2); - int rrmWpcc = rr * W; + for (int rr = 2; rr < H - 2; rr++) { + int rrmWpcc = rr * W + 2; - for (int cc = 0; cc < W; cc++, rrmWpcc++) { + for (int cc = 2; cc < W - 2; cc++, rrmWpcc++) { //evaluate pixel for heat/death float pixdev = cfablur[rrmWpcc]; - if((!findDeadPixels) && pixdev <= 0) { + if(pixdev == 0.f) { continue; } - if((!findHotPixels) && pixdev >= 0) { + if((!findDeadPixels) && pixdev < 0) { + continue; + } + + if((!findHotPixels) && pixdev > 0) { continue; } pixdev = fabsf(pixdev); float hfnbrave = -pixdev; - int left = max(0, cc - 2); - int right = min(W - 1, cc + 2); - for (int mm = top; mm <= bottom; mm++) { - int mmmWpnn = mm * W + left; - for (int nn = left; nn <= right; nn++, mmmWpnn++) { +#ifdef __SSE2__ + // sum up 5*4 = 20 values using SSE + vfloat sum = vabsf(LVFU(cfablur[(rr - 2) * W + cc - 2])) + vabsf(LVFU(cfablur[(rr - 1) * W + cc - 2])); + sum += vabsf(LVFU(cfablur[(rr) * W + cc - 2])); + sum += vabsf(LVFU(cfablur[(rr + 1) * W + cc - 2])); + sum += vabsf(LVFU(cfablur[(rr + 2) * W + cc - 2])); + // horizontally add the values and add the result to hfnbrave + hfnbrave += vhadd(sum); + + // add remaining 5 values of last column + for (int mm = rr - 2; mm <= rr + 2; mm++) { + hfnbrave += fabsf(cfablur[mm * W + cc + 2]); + } + +#else + + for (int mm = rr - 2; mm <= rr + 2; mm++) { + int mmmWpnn = mm * W + cc - 2; + + for (int nn = cc - 2; nn <= cc + 2; nn++, mmmWpnn++) { hfnbrave += fabsf(cfablur[mmmWpnn]); } } - if (pixdev * ((bottom - top + 1) * (right - left + 1) - 1) > varthresh * hfnbrave) { +#endif + + if (pixdev > varthresh * hfnbrave) { // mark the pixel as "bad" bpMap.set(cc, rr); counter++; diff --git a/rtengine/sleefsseavx.c b/rtengine/sleefsseavx.c index 6b83c859a..c2d1278f4 100644 --- a/rtengine/sleefsseavx.c +++ b/rtengine/sleefsseavx.c @@ -1322,5 +1322,11 @@ static inline void vswap( vmask condition, vfloat &a, vfloat &b) { b = temp; } +static inline float vhadd( vfloat a ) +{ + a += _mm_movehl_ps(a, a); + return _mm_cvtss_f32(_mm_add_ss(a, _mm_shuffle_ps(a, a, 1))); +} + #endif // __SSE2__ #endif // SLEEFSSEAVX From ad4e96b9ca4ef672b9c162ec45108e6e4c307dc2 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 2 Oct 2015 23:00:10 +0200 Subject: [PATCH 44/71] Fixed comments and added some #ifdef _OPENMP --- rtengine/rawimagesource.cc | 228 ++++++++++++++++++------------------- 1 file changed, 111 insertions(+), 117 deletions(-) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 6197dba17..2421b33cf 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -31,7 +31,6 @@ #include "curves.h" #include "dfmanager.h" #include "ffmanager.h" -#include "slicer.h" #include "../rtgui/options.h" #include "dcp.h" #include "rt_math.h" @@ -551,7 +550,9 @@ int RawImageSource::interpolateBadPixelsBayer( PixelsMap &bitmapBads ) { static const float eps = 1.f; int counter = 0; +#ifdef _OPENMP #pragma omp parallel for reduction(+:counter) schedule(dynamic,16) +#endif for( int row = 2; row < H - 2; row++ ) { for(int col = 2; col < W - 2; col++ ) { @@ -666,7 +667,9 @@ int RawImageSource::interpolateBadPixelsNColours( PixelsMap &bitmapBads, const i { static const float eps = 1.f; int counter = 0; +#ifdef _OPENMP #pragma omp parallel for reduction(+:counter) schedule(dynamic,16) +#endif for( int row = 2; row < H - 2; row++ ) { for(int col = 2; col < W - 2; col++ ) { @@ -718,7 +721,7 @@ int RawImageSource::interpolateBadPixelsNColours( PixelsMap &bitmapBads, const i } } - if (LIKELY(norm[0] > 0.f)) { // This means, we found at least one pair of valid pixels in the steps above, likelyhood of this case is about 99.999% + if (LIKELY(norm[0] > 0.f)) { // This means, we found at least one pair of valid pixels in the steps above, likelihood of this case is about 99.999% for(int c = 0; c < colours; c++) { rawData[row][col * colours + c] = wtdsum[c] / (2.f * norm[c]); //gradient weighted average, Factor of 2.f is an optimization to avoid multiplications in former steps } @@ -760,13 +763,15 @@ int RawImageSource::interpolateBadPixelsNColours( PixelsMap &bitmapBads, const i return counter; // Number of interpolated pixels. } /* interpolateBadPixelsXtrans: correct raw pixels looking at the bitmap - * takes into consideration if there are multiple bad pixels in the neighborhood + * takes into consideration if there are multiple bad pixels in the neighbourhood */ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) { static const float eps = 1.f; int counter = 0; +#ifdef _OPENMP #pragma omp parallel for reduction(+:counter) schedule(dynamic,16) +#endif for( int row = 2; row < H - 2; row++ ) { for(int col = 2; col < W - 2; col++ ) { @@ -788,10 +793,10 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) if(pixelColor == 1) { // green channel. A green pixel can either be a solitary green pixel or a member of a 2x2 square of green pixels if(ri->XTRANSFC(row, col - 1) == ri->XTRANSFC(row, col + 1)) { - // If left and right neighbour have same color, then this is a solitary green pixel - // For these the following pixels will be used for interpolation. Pixel to be interpolated is in center and marked with a P. + // If left and right neighbour have same colour, then this is a solitary green pixel + // For these the following pixels will be used for interpolation. Pixel to be interpolated is in centre and marked with a P. // Pairs of pixels used in this step are numbered. A pair will be used if none of the pixels of the pair is marked bad - // 0 means, the pixel has a different color and will not be used + // 0 means, the pixel has a different colour and will not be used // 0 1 0 2 0 // 3 5 0 6 4 // 0 0 P 0 0 @@ -830,12 +835,14 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) // this is a member of a 2x2 square of green pixels // For these the following pixels will be used for interpolation. Pixel to be interpolated is at position P in the example. // Pairs of pixels used in this step are numbered. A pair will be used if none of the pixels of the pair is marked bad - // 0 means, the pixel has a different color and will not be used + // 0 means, the pixel has a different colour and will not be used // 1 0 0 3 // 0 P 2 0 // 0 2 1 0 // 3 0 0 0 - int offset1 = ri->XTRANSFC(row - 1, col - 1) == ri->XTRANSFC(row + 1, col + 1) ? 1 : -1; // pixels marked 1 in above example. Distance to P is sqrt(2) => weighting is 0.70710678f + + // pixels marked 1 in above example. Distance to P is sqrt(2) => weighting is 0.70710678f + int offset1 = ri->XTRANSFC(row - 1, col - 1) == ri->XTRANSFC(row + 1, col + 1) ? 1 : -1; if( !(bitmapBads.get(col - offset1, row - 1) || bitmapBads.get(col + offset1, row + 1))) { float dirwt = 0.70710678f / ( fabsf( rawData[row - 1][col - offset1] - rawData[row + 1][col + offset1]) + eps); @@ -843,6 +850,7 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) norm += dirwt; } + // pixels marked 2 in above example. Distance to P is 1 => weighting is 1.f int offsety = (ri->XTRANSFC(row - 1, col) != 1 ? 1 : -1); int offsetx = offset1 * offsety; @@ -866,9 +874,9 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) } } else { // red and blue channel. - // Each red or blue pixel has exactly one neigbour of same color in distance 2 and four neighbours of same color which can be reached by a move of a knight in chess. + // Each red or blue pixel has exactly one neighbour of same colour in distance 2 and four neighbours of same colour which can be reached by a move of a knight in chess. // For the distance 2 pixel (marked with an X) we generate a virtual counterpart (marked with a V) - // For red and blue channel following pixels will be used for interpolation. Pixel to be interpolated is in center and marked with a P. + // For red and blue channel following pixels will be used for interpolation. Pixel to be interpolated is in centre and marked with a P. // Pairs of pixels used in this step are numbered except for distance 2 pixels which are marked X and V. A pair will be used if none of the pixels of the pair is marked bad // 0 1 0 0 0 0 0 X 0 0 remaining cases are symmetric // 0 0 0 0 2 1 0 0 0 2 @@ -876,12 +884,12 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) // 0 0 0 0 1 0 0 0 0 0 // 0 2 0 0 0 0 2 V 1 0 - // Find two knight moves landing on a pixel of same color as the pixel to be interpolated. + // Find two knight moves landing on a pixel of same colour as the pixel to be interpolated. // If we look at first and last row of 5x5 square, we will find exactly two knight pixels. - // Additionally we know that the column of this pixel has 1 or -1 horizontal distance to the center pixel + // Additionally we know that the column of this pixel has 1 or -1 horizontal distance to the centre pixel // When we find a knight pixel, we get its counterpart, which has distance (+-3,+-3), where the signs of distance depend on the corner of the found knight pixel. // These pixels are marked 1 or 2 in above examples. Distance to P is sqrt(5) => weighting is 0.44721359f - // The following loop simply scans the four possible places. To keep things simple, it doesn't stop after finding two knight pixels, because it will not find more than two + // The following loop simply scans the four possible places. To keep things simple, it does not stop after finding two knight pixels, because it will not find more than two for(int d1 = -2, offsety = 3; d1 <= 2; d1 += 4, offsety -= 6) { for(int d2 = -1, offsetx = 3; d2 < 1; d2 += 2, offsetx -= 6) { if(ri->XTRANSFC(row + d1, col + d2) == pixelColor) { @@ -927,10 +935,8 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) norm += dirwt; } - if (LIKELY(norm > 0.f)) { // This means, we found at least one pair of valid pixels in the steps above, likelyhood of this case is about 99.999% + if (LIKELY(norm > 0.f)) { // This means, we found at least one pair of valid pixels in the steps above, likelihood of this case is about 99.999% rawData[row][col] = wtdsum / (2.f * norm); //gradient weighted average, Factor of 2.f is an optimization to avoid multiplications in former steps -//#pragma omp critical -// printf("%s Pixel at (col/row) : (%4d/%4d) : Original : %f, interpolated: %f\n",pixelColor == 0 ? "Red " : pixelColor==1 ? "Green" : "Blue ", col-7,row-7,oldval, rawData[row][col]); counter++; } } @@ -941,9 +947,9 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% /* Search for hot or dead pixels in the image and update the map - * For each pixel compare its value to the average of similar color surrounding + * For each pixel compare its value to the average of similar colour surrounding * (Taken from Emil Martinec idea) - * (Optimized by Ingo Weyrich 2013) + * (Optimized by Ingo Weyrich 2013 and 2015) */ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool findHotPixels, bool findDeadPixels ) { @@ -957,15 +963,18 @@ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool find // counter for dead or hot pixels int counter = 0; +#ifdef _OPENMP #pragma omp parallel +#endif { +#ifdef _OPENMP #pragma omp for schedule(dynamic,16) nowait +#endif for (int i = 2; i < H - 2; i++) { - float p[9], temp; + float p[9], temp; // we need this for med3x3 macro for (int j = 2; j < W - 2; j++) { - med3x3(rawData[i - 2][j - 2], rawData[i - 2][j], rawData[i - 2][j + 2], rawData[i][j - 2], rawData[i][j], rawData[i][j + 2], rawData[i + 2][j - 2], rawData[i + 2][j], rawData[i + 2][j + 2], temp); @@ -975,7 +984,9 @@ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool find // process borders. Former version calculated the median using mirrored border which does not make sense because the original pixel loses weight // Setting the difference between pixel and median for border pixels to zero should do the job not worse then former version +#ifdef _OPENMP #pragma omp critical +#endif { for(int i = 0; i < 2; i++) { for(int j = 0; j < W; j++) { @@ -999,8 +1010,11 @@ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool find } } } - #pragma omp barrier - #pragma omp for reduction(+:counter) schedule (dynamic,16) +#ifdef _OPENMP + #pragma omp barrier // barrier because of nowait clause above + + #pragma omp for reduction(+:counter) schedule(dynamic,16) +#endif //cfa pixel heat/death evaluation for (int rr = 2; rr < H - 2; rr++) { @@ -1025,7 +1039,6 @@ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool find pixdev = fabsf(pixdev); float hfnbrave = -pixdev; - #ifdef __SSE2__ // sum up 5*4 = 20 values using SSE vfloat sum = vabsf(LVFU(cfablur[(rr - 2) * W + cc - 2])) + vabsf(LVFU(cfablur[(rr - 1) * W + cc - 2])); @@ -1043,10 +1056,8 @@ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool find #else for (int mm = rr - 2; mm <= rr + 2; mm++) { - int mmmWpnn = mm * W + cc - 2; - - for (int nn = cc - 2; nn <= cc + 2; nn++, mmmWpnn++) { - hfnbrave += fabsf(cfablur[mmmWpnn]); + for (int nn = cc - 2; nn <= cc + 2; nn++) { + hfnbrave += fabsf(cfablur[mm * W + nn]); } } @@ -1563,7 +1574,10 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le int totBP = 0; // Hold count of bad pixels to correct if(ri->zeroIsBad()) { // mark all pixels with value zero as bad, has to be called before FF and DF. dcraw sets this flag only for some cameras (mainly Panasonic and Leica) +#ifdef _OPENMP #pragma omp parallel for reduction(+:totBP) +#endif + for(int i = 0; i < H; i++) for(int j = 0; j < W; j++) { if(ri->data[i][j] == 0.f) { @@ -1638,7 +1652,9 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le if (pLCPProf && idata->getFocalLen() > 0.f) { LCPMapper map(pLCPProf, idata->getFocalLen(), idata->getFocalLen35mm(), idata->getFocusDist(), idata->getFNumber(), true, false, W, H, coarse, -1); +#ifdef _OPENMP #pragma omp parallel for +#endif for (int y = 0; y < H; y++) { for (int x = 0; x < W; x++) { @@ -1672,7 +1688,9 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le int ng1 = 0, ng2 = 0, i = 0; double avgg1 = 0., avgg2 = 0.; +#ifdef _OPENMP #pragma omp parallel for default(shared) private(i) reduction(+: ng1, ng2, avgg1, avgg2) +#endif for (i = border; i < H - border; i++) for (int j = border; j < W - border; j++) @@ -1689,7 +1707,9 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le double corrg1 = ((double)avgg1 / ng1 + (double)avgg2 / ng2) / 2.0 / ((double)avgg1 / ng1); double corrg2 = ((double)avgg1 / ng1 + (double)avgg2 / ng2) / 2.0 / ((double)avgg2 / ng2); +#ifdef _OPENMP #pragma omp parallel for default(shared) +#endif for (int i = border; i < H - border; i++) for (int j = border; j < W - border; j++) @@ -1909,10 +1929,14 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile float maxval = 0.f; int c = FC(m, n); int c4 = ( c == 1 && !(m & 1) ) ? 3 : c; +#ifdef _OPENMP #pragma omp parallel +#endif { float maxvalthr = 0.f; +#ifdef _OPENMP #pragma omp for +#endif for (int row = 0; row < H - m; row += 2) { for (int col = 0; col < W - n; col += 2) { @@ -1924,7 +1948,9 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile } } +#ifdef _OPENMP #pragma omp critical +#endif { if(maxvalthr > maxval) { @@ -1954,11 +1980,15 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile for (int m = 0; m < 2; m++) for (int n = 0; n < 2; n++) { +#ifdef _OPENMP #pragma omp parallel +#endif { int c = FC(m, n); int c4 = ( c == 1 && !(m & 1) ) ? 3 : c; +#ifdef _OPENMP #pragma omp for +#endif for (int row = 0; row < H - m; row += 2) { @@ -1994,10 +2024,14 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile int clipControlGui = 0; float maxval = 0.f; // xtrans files have only one black level actually, so we can simplify the code a bit +#ifdef _OPENMP #pragma omp parallel +#endif { float maxvalthr = 0.f; +#ifdef _OPENMP #pragma omp for schedule(dynamic,16) nowait +#endif for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) { @@ -2009,7 +2043,9 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile } } +#ifdef _OPENMP #pragma omp critical +#endif { if(maxvalthr > maxval) { maxval = maxvalthr; @@ -2031,7 +2067,9 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile refcolor[c] *= limitFactor; } +#ifdef _OPENMP #pragma omp parallel for +#endif for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) { @@ -2054,7 +2092,9 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile if(ri->getSensorType() == ST_BAYER) { for (int m = 0; m < 2; m++) for (int n = 0; n < 2; n++) { +#ifdef _OPENMP #pragma omp parallel for +#endif for (int row = 0; row < H - m; row += 2) { int c = FC(row, 0); @@ -2068,7 +2108,9 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile } } } else if(ri->getSensorType() == ST_FUJI_XTRANS) { +#ifdef _OPENMP #pragma omp parallel for +#endif for (int row = 0; row < H; row++) { for (int col = 0; col < W; col++) { @@ -2177,9 +2219,13 @@ SSEFUNCTION void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur cfatmp = (float (*)) calloc (H * W, sizeof * cfatmp); // const float hotdeadthresh = 0.5; +#ifdef _OPENMP #pragma omp parallel +#endif { +#ifdef _OPENMP #pragma omp for +#endif for (int i = 0; i < H; i++) { int iprev, inext, jprev, jnext; @@ -2228,7 +2274,9 @@ SSEFUNCTION void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur //box blur cfa image; box size = BS //horizontal blur +#ifdef _OPENMP #pragma omp for +#endif for (int row = 0; row < H; row++) { int len = boxW / 2 + 1; @@ -2267,7 +2315,9 @@ SSEFUNCTION void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur __m128 onev = _mm_set1_ps( 1.0f ); __m128 temp1v, temp2v, lenv, lenp1v, lenm1v; int row; +#ifdef _OPENMP #pragma omp for +#endif for (int col = 0; col < W - 3; col += 4) { lenv = leninitv; @@ -2356,7 +2406,9 @@ SSEFUNCTION void RawImageSource::cfaboxblur(RawImage *riFlatFile, float* cfablur } #else +#ifdef _OPENMP #pragma omp for +#endif for (int col = 0; col < W; col++) { int len = boxH / 2 + 1; @@ -2438,12 +2490,15 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R // scale image colors if( ri->getSensorType() == ST_BAYER) { +#ifdef _OPENMP #pragma omp parallel +#endif { float tmpchmax[3]; tmpchmax[0] = tmpchmax[1] = tmpchmax[2] = 0.0f; - +#ifdef _OPENMP #pragma omp for nowait +#endif for (int row = winy; row < winy + winh; row ++) { @@ -2458,7 +2513,9 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R } } +#ifdef _OPENMP #pragma omp critical +#endif { chmax[0] = max(tmpchmax[0], chmax[0]); chmax[1] = max(tmpchmax[1], chmax[1]); @@ -2466,11 +2523,14 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R } } } else if ( ri->get_colors() == 1 ) { +#ifdef _OPENMP #pragma omp parallel +#endif { float tmpchmax = 0.0f; - +#ifdef _OPENMP #pragma omp for nowait +#endif for (int row = winy; row < winy + winh; row ++) { @@ -2483,18 +2543,23 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R } } +#ifdef _OPENMP #pragma omp critical +#endif { chmax[0] = chmax[1] = chmax[2] = chmax[3] = max(tmpchmax, chmax[0]); } } } else if(ri->getSensorType() == ST_FUJI_XTRANS) { +#ifdef _OPENMP #pragma omp parallel +#endif { float tmpchmax[3]; tmpchmax[0] = tmpchmax[1] = tmpchmax[2] = 0.0f; - +#ifdef _OPENMP #pragma omp for nowait +#endif for (int row = winy; row < winy + winh; row ++) { @@ -2509,7 +2574,9 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R } } +#ifdef _OPENMP #pragma omp critical +#endif { chmax[0] = max(tmpchmax[0], chmax[0]); chmax[1] = max(tmpchmax[1], chmax[1]); @@ -2517,12 +2584,15 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R } } } else { +#ifdef _OPENMP #pragma omp parallel +#endif { float tmpchmax[3]; tmpchmax[0] = tmpchmax[1] = tmpchmax[2] = 0.0f; - +#ifdef _OPENMP #pragma omp for nowait +#endif for (int row = winy; row < winy + winh; row ++) { @@ -2537,7 +2607,9 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R } } +#ifdef _OPENMP #pragma omp critical +#endif { chmax[0] = max(tmpchmax[0], chmax[0]); chmax[1] = max(tmpchmax[1], chmax[1]); @@ -2850,8 +2922,9 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam mat[i][j] += work[i][k] * camMatrix[k][j]; // rgb_xyz * imatrices.xyz_cam } - +#ifdef _OPENMP #pragma omp parallel for +#endif for (int i = 0; i < im->height; i++) for (int j = 0; j < im->width; j++) { @@ -3174,91 +3247,6 @@ void RawImageSource::colorSpaceConversion_ (Imagefloat* im, ColorManagementParam // printf ("ICM TIME: %d usec\n", t3.etime(t1)); } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -// Converts raw image including ICC input profile to working space - 16bit int version -/*void RawImageSource::colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded, cmsHPROFILE camprofile, double camMatrix[3][3], std::string camName) { - cmsHPROFILE in; - DCPProfile *dcpProf; - - if (!findInputProfile(cmp.input, embedded, camName, &dcpProf, in)) return; - - if (dcpProf!=NULL) { - dcpProf->Apply(im, (DCPLightType)cmp.preferredProfile, cmp.working, cmp.toneCurve); - } else { - if (in==NULL) { - // Take camprofile from DCRAW - // in this case we avoid using the slllllooooooowwww lcms - TMatrix work = iccStore->workingSpaceInverseMatrix (cmp.working); - double mat[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; - for (int i=0; i<3; i++) - for (int j=0; j<3; j++) - for (int k=0; k<3; k++) - mat[i][j] += work[i][k] * camMatrix[k][j]; // rgb_xyz * imatrices.xyz_cam - -#pragma omp parallel for - for (int i=0; iheight; i++) - for (int j=0; jwidth; j++) { - - float newr = mat[0][0]*im->r(i,j) + mat[0][1]*im->g(i,j) + mat[0][2]*im->b(i,j); - float newg = mat[1][0]*im->r(i,j) + mat[1][1]*im->g(i,j) + mat[1][2]*im->b(i,j); - float newb = mat[2][0]*im->r(i,j) + mat[2][1]*im->g(i,j) + mat[2][2]*im->b(i,j); - - im->r(i,j) = CLIP((int)newr); - im->g(i,j) = CLIP((int)newg); - im->b(i,j) = CLIP((int)newb); - } - } else { - // Gamma preprocessing - float gammaFac, lineFac, lineSum; - getProfilePreprocParams(in, gammaFac, lineFac, lineSum); - - if (gammaFac>0) { -#pragma omp parallel for - for ( int h = 0; h < im->height; ++h ) - for ( int w = 0; w < im->width; ++w ) { - im->r(h,w)= (int) (pow ((double)(im->r(h,w) / 65535.0), (double)gammaFac) * 65535.0); - im->g(h,w)= (int) (pow ((double)(im->g(h,w) / 65535.0), (double)gammaFac) * 65535.0); - im->b(h,w)= (int) (pow ((double)(im->b(h,w) / 65535.0), (double)gammaFac) * 65535.0); - } - } - - cmsHPROFILE out = iccStore->workingSpace (cmp.working); - //out = iccStore->workingSpaceGamma (wProfile); - lcmsMutex->lock (); - cmsHTRANSFORM hTransform = cmsCreateTransform (in, TYPE_RGB_16, out, TYPE_RGB_16, settings->colorimetricIntent, - cmsFLAGS_NOCACHE); // NOCACHE is important for thread safety - lcmsMutex->unlock (); - - if (hTransform) { - im->ExecCMSTransform(hTransform); - - // There might be Nikon postprocessings - if (lineSum>0) { -#pragma omp parallel for - for ( int h = 0; h < im->height; ++h ) - for ( int w = 0; w < im->width; ++w ) { - im->r(h,w) *= im->r(h,w) * lineFac / 65535.0 + lineSum; - im->g(h,w) *= im->g(h,w) * lineFac / 65535.0 + lineSum; - im->b(h,w) *= im->b(h,w) * lineFac / 65535.0 + lineSum; - } - } - } - else { - lcmsMutex->lock (); - hTransform = cmsCreateTransform (camprofile, TYPE_RGB_16, out, TYPE_RGB_16, - settings->colorimetricIntent, cmsFLAGS_NOCACHE); - lcmsMutex->unlock (); - - im->ExecCMSTransform(hTransform); - } - - cmsDeleteTransform(hTransform); - } - } - //t3.set (); - //printf ("ICM TIME: %d\n", t3.etime(t1)); -}*/ // Determine RAW input and output profiles. Returns TRUE on success bool RawImageSource::findInputProfile(Glib::ustring inProfile, cmsHPROFILE embedded, std::string camName, DCPProfile **dcpProf, cmsHPROFILE& in) @@ -3557,11 +3545,15 @@ void RawImageSource::getAutoExpHistogram (LUTu & histogram, int& histcompr) histogram(65536 >> histcompr); histogram.clear(); +#ifdef _OPENMP #pragma omp parallel +#endif { LUTu tmphistogram(65536 >> histcompr); tmphistogram.clear(); +#ifdef _OPENMP #pragma omp for nowait +#endif for (int i = border; i < H - border; i++) { int start, end; @@ -3600,7 +3592,9 @@ void RawImageSource::getAutoExpHistogram (LUTu & histogram, int& histcompr) } } +#ifdef _OPENMP #pragma omp critical +#endif { for(int i = 0; i < (65536 >> histcompr); i++) { histogram[i] += tmphistogram[i]; From 643a9e7d54d6c3266aa4d20fbf9e791c3038753f Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 2 Oct 2015 23:01:56 +0200 Subject: [PATCH 45/71] added a file I forgot at last commit --- rtengine/stdimagesource.h | 1 - 1 file changed, 1 deletion(-) diff --git a/rtengine/stdimagesource.h b/rtengine/stdimagesource.h index 3848fe5e9..6017fae74 100644 --- a/rtengine/stdimagesource.h +++ b/rtengine/stdimagesource.h @@ -92,7 +92,6 @@ public: void convertColorSpace(Imagefloat* image, ColorManagementParams cmp, ColorTemp &wb);// RAWParams raw will not be used for non-raw files (see imagesource.h) static void colorSpaceConversion (Imagefloat* im, ColorManagementParams cmp, cmsHPROFILE embedded, IIOSampleFormat sampleFormat); - //static void colorSpaceConversion16 (Image16* im, ColorManagementParams cmp, cmsHPROFILE embedded); static inline double intpow (double a, int b) { From d05754fbf8bbb3943a72beea4ee4dcbbcb96cb54 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Fri, 2 Oct 2015 23:03:32 +0200 Subject: [PATCH 46/71] Reduced updates to progress bar for amaze demosaic --- rtengine/amaze_demosaic_RT.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index 10a3687e6..289bfa46e 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -31,13 +31,14 @@ #include "procparams.h" #include "sleef.c" #include "opthelper.h" +#include "StopWatch.h" namespace rtengine { SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh) { - +StopWatch Stop1("amaze_demosaic_RT"); #define HCLIP(x) x //is this still necessary??? //min(clip_pt,x) @@ -1615,10 +1616,10 @@ SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, if(plistener) { progresscounter++; - if(progresscounter % 4 == 0) { + if(progresscounter % 16 == 0) { #pragma omp critical { - progress += (double)4 * ((TS - 32) * (TS - 32)) / (height * width); + progress += (double)16 * ((TS - 32) * (TS - 32)) / (height * width); if (progress > 1.0) { From 929c0ad1b3aecf18fce6245e0b75809990d8c364 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 3 Oct 2015 00:17:18 +0200 Subject: [PATCH 47/71] Removed Stopwatches --- rtengine/amaze_demosaic_RT.cc | 2 -- rtengine/rawimagesource.cc | 2 -- 2 files changed, 4 deletions(-) diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index 289bfa46e..dc2d4316e 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -31,14 +31,12 @@ #include "procparams.h" #include "sleef.c" #include "opthelper.h" -#include "StopWatch.h" namespace rtengine { SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, int winh) { -StopWatch Stop1("amaze_demosaic_RT"); #define HCLIP(x) x //is this still necessary??? //min(clip_pt,x) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 2421b33cf..6381c45b6 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -39,7 +39,6 @@ #include #endif #include "opthelper.h" -#include "StopWatch.h" namespace rtengine { @@ -953,7 +952,6 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) */ int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool findHotPixels, bool findDeadPixels ) { - StopWatch Stop1("findHotDeadPixels"); float varthresh = (20.0 * (thresh / 100.0) + 1.0 ) / 24.f; // allocate temporary buffer From 058f5b8f986a8c8c1a4e0b3a6f849fed39a494c3 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 3 Oct 2015 09:06:10 +0200 Subject: [PATCH 48/71] Bug in gamma calculation --- rtengine/color.h | 6 +++--- rtengine/rawimagesource.cc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/color.h b/rtengine/color.h index 1eb799cda..cc3a1f295 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -954,7 +954,7 @@ public: */ static inline double gamma13_2 (double x) { - return x <= 0.016613 ? x * 2.0 : 1.009968 * exp(log(x) / 1.3) - 0.016613; + return x <= 0.016613 ? x * 2.0 : 1.009968 * exp(log(x) / 1.3) - 0.009968; } static inline double igamma13_2 (double x) @@ -964,7 +964,7 @@ public: static inline double gamma115_2 (double x) { - return x <= 0.001692 ? x * 2.0 : 1.000508 * exp(log(x) / 1.15) - 0.001692; + return x <= 0.001692 ? x * 2.0 : 1.000508 * exp(log(x) / 1.15) - 0.000508; } static inline double igamma115_2 (double x) @@ -974,7 +974,7 @@ public: static inline double gamma145_3 (double x) { - return x <= 0.009115 ? x * 3.0 : 1.012305 * exp(log(x) / 1.45) - 0.009115; + return x <= 0.009115 ? x * 3.0 : 1.012305 * exp(log(x) / 1.45) - 0.012305; } static inline double igamma145_3 (double x) diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 3b4eecaf4..ae52227f5 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1834,7 +1834,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar for (int i = 0; i < 65536; i++) { double val = (i) / 65535.; double start = g_a3; - double add = g_a3; + double add = g_a4; double mul = 1. + g_a4; double x; x = Color::gammareti (val, gamm, start, ts, mul , add); From 20839d3a4a0de88a217a3709a089749268bc6bfc Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 3 Oct 2015 13:33:52 +0200 Subject: [PATCH 49/71] Color propagation highlight reconstruction causes crash on some files, fixes #2928 --- rtengine/hilite_recon.cc | 7 ++++--- rtengine/rawimagesource.cc | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 411bb0823..bc5e973e2 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -847,21 +847,22 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b green[i][j] = clipfix[1] * factor; blue[i][j] = clipfix[2] * factor; } else {//some channels clipped + const float eps = 0.0001f; int notclipped[3] = {pixel[0] < max_f[0] ? 1 : 0, pixel[1] < max_f[1] ? 1 : 0, pixel[2] < max_f[2] ? 1 : 0}; if (notclipped[0] == 0) { //red clipped red[i][j] = max(red[i][j], (clipfix[0] * ((notclipped[1] * pixel[1] + notclipped[2] * pixel[2]) / - (notclipped[1] * clipfix[1] + notclipped[2] * clipfix[2])))); + (notclipped[1] * clipfix[1] + notclipped[2] * clipfix[2] + eps)))); } if (notclipped[1] == 0) { //green clipped green[i][j] = max(green[i][j], (clipfix[1] * ((notclipped[2] * pixel[2] + notclipped[0] * pixel[0]) / - (notclipped[2] * clipfix[2] + notclipped[0] * clipfix[0])))); + (notclipped[2] * clipfix[2] + notclipped[0] * clipfix[0] + eps)))); } if (notclipped[2] == 0) { //blue clipped blue[i][j] = max(blue[i][j], (clipfix[2] * ((notclipped[0] * pixel[0] + notclipped[1] * pixel[1]) / - (notclipped[0] * clipfix[0] + notclipped[1] * clipfix[1])))); + (notclipped[0] * clipfix[0] + notclipped[1] * clipfix[1] + eps)))); } } diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 6381c45b6..3194e2f32 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -950,7 +950,7 @@ int RawImageSource::interpolateBadPixelsXtrans( PixelsMap &bitmapBads ) * (Taken from Emil Martinec idea) * (Optimized by Ingo Weyrich 2013 and 2015) */ -int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool findHotPixels, bool findDeadPixels ) +SSEFUNCTION int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thresh, bool findHotPixels, bool findDeadPixels ) { float varthresh = (20.0 * (thresh / 100.0) + 1.0 ) / 24.f; From 731ccb3ef5b91b778cb5e9ebce64b10b4779f486 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 5 Oct 2015 15:19:36 +0200 Subject: [PATCH 50/71] Add 2 methods for magenta highlight --- rtdata/languages/default | 12 ++++- rtengine/imagesource.h | 4 +- rtengine/improccoordinator.cc | 1 + rtengine/improccoordinator.h | 3 +- rtengine/ipretinex.cc | 32 +++++++++---- rtengine/procevents.h | 3 ++ rtengine/procparams.cc | 42 ++++++++++++++++++ rtengine/procparams.h | 3 ++ rtengine/rawimagesource.cc | 52 ++++++++++++++++++++-- rtengine/rawimagesource.h | 6 +-- rtengine/refreshmap.cc | 5 ++- rtengine/simpleprocess.cc | 6 ++- rtgui/paramsedited.cc | 18 ++++++++ rtgui/paramsedited.h | 3 ++ rtgui/retinex.cc | 84 ++++++++++++++++++++++++++++++++++- rtgui/retinex.h | 3 ++ 16 files changed, 252 insertions(+), 25 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index f85c71aeb..492c7ba56 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -653,6 +653,9 @@ HISTORY_MSG_420;Retinex - Histogram - HSL HISTORY_MSG_421;Retinex - Gamma retinex HISTORY_MSG_422;Retinex - gamma HISTORY_MSG_423;Retinex - slope +HISTORY_MSG_424;Retinex - HL threshold +HISTORY_MSG_425;Retinex - HL control red +HISTORY_MSG_426;Retinex - HL control GB HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1573,6 +1576,13 @@ TP_RETINEX_GAMMA;Gamma TP_RETINEX_SLOPE;Slope TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex\nDifferent from Retinex curves or others curves (Lab, Exposure,..) TP_RETINEX_HIGH;High +TP_RETINEX_HIGHLIG;Highlight +TP_RETINEX_HIGHLIGPLUS;Highlight More +TP_RETINEX_HIGHLIGHT;Highlight threshold +TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm\nNeeds probably to change settings (Neighboring pixels), and increase Raw White-point +TP_RETINEX_HIGHLIGHT2;Highlight control (red) +TP_RETINEX_HIGHLIGHT2_TOOLTIP;Acts on RGB channels to reduce magenta (red = master) +TP_RETINEX_HIGHLIGHT3;Highlight control (blue green) TP_RETINEX_HSLSPACE_LIN;HSL-Linear TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic TP_RETINEX_LABEL;Retinex @@ -1580,7 +1590,7 @@ TP_RETINEX_LABSPACE;L*a*b* TP_RETINEX_LOW;Low TP_RETINEX_MEDIAN;Transmission median filter TP_RETINEX_METHOD;Method -TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light. +TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light\nHighLight: Try to remove magenta\nHighlight More: Try to remove magenta + RGB action. TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. TP_RETINEX_NEIGHBOR;Neighboring pixels diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 73c8b0786..d9f088813 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -69,9 +69,9 @@ public: virtual int load (Glib::ustring fname, bool batch = false) = 0; virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse) {}; virtual void demosaic (const RAWParams &raw) {}; - virtual void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; + virtual void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; - virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; + virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 0bb316b7d..b5def58d0 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -365,6 +365,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } */ imgsrc->convertColorSpace(orig_prev, params.icm, currWB); + printf("improc color r=%f g=%f b=%f\n",orig_prev->r(50, 2300),orig_prev->g(50, 2300),orig_prev->b(50, 2300)); ipf.firstAnalysis (orig_prev, ¶ms, vhist16); } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 3266a6c0a..ef981fe6a 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -94,7 +94,8 @@ protected: LUTf satcurve; LUTf lhskcurve; LUTf clcurve; - multi_array2D conversionBuffer; +// multi_array2D conversionBuffer; + multi_array2D conversionBuffer; LUTf wavclCurve; LUTf clToningcurve; LUTf cl2Toningcurve; diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 351902949..f5edcd7c2 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -65,7 +65,7 @@ extern const Settings* settings; static float RetinexScales[MAX_RETINEX_SCALES]; -void retinex_scales( float* scales, int nscales, int mode, int s) +void retinex_scales( float* scales, int nscales, int mode, int s, float high) { if ( nscales == 1 ) { scales[0] = (float)s / 2.f; @@ -91,6 +91,12 @@ void retinex_scales( float* scales, int nscales, int mode, int s) for ( int i = 0; i < nscales; ++i ) { scales[i] = s - (float)pow (10.f, (i * size_step) / log (10.f)); } + } else if (mode == 3) { + size_step = (float) log(s - 2.0f) / (float) nscales; + + for ( int i = 0; i < nscales; ++i ) { + scales[i] = high*s - (float)pow (10.f, (i * size_step) / log (10.f)); + } } } } @@ -198,7 +204,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const stddv = (float)sqrt(stddv); } -void RawImageSource::MSR(float** luminance, float** originalLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { if (deh.enabled) {//enabled StopWatch Stop1("MSR"); @@ -220,7 +226,10 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width limD *= useHslLin ? 10.f : 1.f; float ilimD = 1.f / limD; int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) - + float hig = ((float) deh.highl)/100.f; + bool higplus = false ; + if(deh.retinexMethod == "highliplus") higplus = true; + if (deh.retinexMethod == "uni") { moderetinex = 0; } @@ -228,8 +237,12 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width if (deh.retinexMethod == "low") { moderetinex = 1; } - - retinex_scales( RetinexScales, scal, moderetinex, nei ); + if (deh.retinexMethod == "highli" || deh.retinexMethod == "highliplus") { + moderetinex = 3; + } + + float high = (float) deh.highl; + retinex_scales( RetinexScales, scal, moderetinex, nei, high ); int H_L = height; int W_L = width; @@ -284,6 +297,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width for (int i = 0; i < H_L; i++) { int j = 0; + #ifdef __SSE2__ if(useHslLin) { @@ -304,7 +318,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width } } else { for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); } } } @@ -450,9 +464,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, int width if(cd < cdmin) { cdmin = cd; } - - - luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * strength + (1.f - strength) * originalLuminance[i][j]; + float str = strength; + if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig; + luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j]; } #ifdef _OPENMP diff --git a/rtengine/procevents.h b/rtengine/procevents.h index ddae2f583..6b4a762af 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -450,6 +450,9 @@ enum ProcEvent { Evretinexgamma = 420, EvLgam = 421, EvLslope = 422, + EvLhighl = 423, + EvLhighlig = 424, + EvLgrbl = 425, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 505913f19..3ae96dca7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -149,6 +149,9 @@ void RetinexParams::setDefaults() offs = 0; vart = 125; limd = 8; + highl = 10; + highlig = 100; + grbl = 50; retinexMethod = "high"; retinexcolorspace = "Lab"; gammaretinex = "none"; @@ -1476,6 +1479,18 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_integer ("Retinex", "Limd", retinex.limd); } + if (!pedited || pedited->retinex.highl) { + keyFile.set_integer ("Retinex", "highl", retinex.highl); + } + + if (!pedited || pedited->retinex.highlig) { + keyFile.set_integer ("Retinex", "highlig", retinex.highlig); + } + + if (!pedited || pedited->retinex.grbl) { + keyFile.set_integer ("Retinex", "grbl", retinex.grbl); + } + if (!pedited || pedited->retinex.retinexMethod) { keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod); } @@ -3876,6 +3891,30 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Retinex", "highl")) { + retinex.highl = keyFile.get_integer ("Retinex", "highl"); + + if (pedited) { + pedited->retinex.highl = true; + } + } + + if (keyFile.has_key ("Retinex", "highlig")) { + retinex.highlig = keyFile.get_integer ("Retinex", "highlig"); + + if (pedited) { + pedited->retinex.highlig = true; + } + } + + if (keyFile.has_key ("Retinex", "grbl")) { + retinex.grbl = keyFile.get_integer ("Retinex", "grbl"); + + if (pedited) { + pedited->retinex.grbl = true; + } + } + if (keyFile.has_key ("Retinex", "CDCurve")) { retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve"); @@ -7271,6 +7310,9 @@ bool ProcParams::operator== (const ProcParams& other) && retinex.neigh == other.retinex.neigh && retinex.gain == other.retinex.gain && retinex.limd == other.retinex.limd + && retinex.highl == other.retinex.highl + && retinex.highlig == other.retinex.highlig + && retinex.grbl == other.retinex.grbl && retinex.offs == other.retinex.offs && retinex.retinexMethod == other.retinex.retinexMethod && retinex.retinexcolorspace == other.retinex.retinexcolorspace diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 4c631b6c8..8d70dfc5b 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -284,6 +284,9 @@ public: Glib::ustring gammaretinex; int vart; int limd; + int highl; + int highlig; + int grbl; bool medianmap; RetinexParams (); void setDefaults(); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index ae52227f5..d965c12d7 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1805,12 +1805,14 @@ void RawImageSource::demosaic(const RAWParams &raw) } -void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) +//void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) +void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) { bool useHsl = (retinexParams.retinexcolorspace == "HSLLOG" || retinexParams.retinexcolorspace == "HSLLIN"); conversionBuffer[0] (W - 2 * border, H - 2 * border); conversionBuffer[1] (W - 2 * border, H - 2 * border); conversionBuffer[2] (W - 2 * border, H - 2 * border); + conversionBuffer[3] (W - 2 * border, H - 2 * border); LUTf *retinexgamtab;//gamma before and after Retinex to restore tones LUTf lutTonereti; @@ -1843,6 +1845,44 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar } retinexgamtab = &lutTonereti; } +/* +//test with amsterdam.pef and other files +float rr,gg,bb; +rr=red[50][2300]; +gg=green[50][2300]; +bb=blue[50][2300]; +printf("rr=%f gg=%f bb=%f \n",rr,gg,bb); +rr=red[1630][370]; +gg=green[1630][370]; +bb=blue[1630][370]; +printf("rr1=%f gg1=%f bb1=%f \n",rr,gg,bb); +rr=red[380][1630]; +gg=green[380][1630]; +bb=blue[380][1630]; +printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb); +*/ + +if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult ! + float hig = ((float)retinexParams.highlig)/100.f; + float higgb = ((float)retinexParams.grbl)/100.f; + +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { + for (int j = border; j < W - border; j++ ) { + float R_,G_,B_; + R_=red[i][j]; + G_=green[i][j]; + B_=blue[i][j]; + + //empirical method to find highlight magenta with no conversion RGB and no white balance + //red = master Gr and Bl default higgb=0.5 + if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_; + else conversionBuffer[3][i - border][j - border] = 0.f; + } + } +} if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma #ifdef _OPENMP @@ -1854,6 +1894,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma R_=red[i][j]; G_=green[i][j]; B_=blue[i][j]; + red[i][j] = (*retinexgamtab)[R_]; green[i][j] = (*retinexgamtab)[G_]; blue[i][j] = (*retinexgamtab)[B_]; @@ -1969,6 +2010,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma R_ = red[i][j]; G_ = green[i][j]; B_ = blue[i][j]; + float k; //rgb=>lab Color::rgbxyz(R_, G_, B_, X, Y, Z, wp); //convert Lab @@ -1976,7 +2018,8 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma conversionBuffer[0][i - border][j - border] = aa; conversionBuffer[1][i - border][j - border] = bb; conversionBuffer[2][i - border][j - border] = L; - + // if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_; + // else conversionBuffer[3][i - border][j - border] = 0.f; if(lhist16RETI) { pos = (int) clipretinex(L, 0, 32768); lhist16RETIThr[pos]++;//histogram in Curve Lab @@ -2015,7 +2058,8 @@ void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdc retinexParams.getCurves(retinextransmissionCurve); } -void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) +//void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) +void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) { MyTime t4, t5; @@ -2131,7 +2175,7 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC } } - MSR(LBuffer, conversionBuffer[2], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + MSR(LBuffer, conversionBuffer[2], conversionBuffer[3], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if(useHsl) { #ifdef _OPENMP diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 1f926730f..10e17743f 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -152,9 +152,9 @@ public: void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse); void demosaic (const RAWParams &raw); // void retinex (RAWParams raw, ColorManagementParams cmp, RetinexParams lcur, LUTf & cdcurve, bool dehacontlutili); - void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI); + void retinex (ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI); void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI); - void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI); + void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI); void flushRawData (); void flushRGB (); void HLRecovery_Global (ToneCurveParams hrp); @@ -230,7 +230,7 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(float** luminance, float **originalLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void MSR(float** luminance, float **originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); // void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 4ad96ebd2..f648f5b4c 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -449,6 +449,9 @@ int refreshmap[rtengine::NUMOFEVENTS] = { ALLNORAW, // EvLCDHCurve DEMOSAIC, // Evretinexgamma DEMOSAIC, // EvLgam - DEMOSAIC // EvLslope + DEMOSAIC, // EvLslope + ALLNORAW, // EvLhighl + DEMOSAIC, // EvLhighlig + DEMOSAIC // EvLgrbl }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 9f9d9875c..73986518b 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -122,7 +122,8 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p RetinextransmissionCurve dehatransmissionCurve; bool dehacontlutili = false; bool useHsl = false; - multi_array2D conversionBuffer(1, 1); +// multi_array2D conversionBuffer(1, 1); + multi_array2D conversionBuffer(1, 1); imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); imgsrc->retinexPrepareCurves(params.retinex, cdcurve, dehatransmissionCurve, dehacontlutili, useHsl, dummy, dummy ); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; @@ -626,7 +627,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p Imagefloat* baseImg = new Imagefloat (fw, fh); imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw); - +// printf("befo color R=%f G=%f B=%f\n",baseImg->r(50, 2300),baseImg->g(50, 2300),baseImg->b(50, 2300)); if (pl) { pl->setProgress (0.50); } @@ -716,6 +717,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p delete [] Max_B_; imgsrc->convertColorSpace(baseImg, params.icm, currWB); + // printf("after color R=%f G=%f B=%f\n",baseImg->r(50, 2300),baseImg->g(50, 2300),baseImg->b(50, 2300)); // perform first analysis LUTu hist16 (65536); diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 2cd5acb4a..9c5dfbabc 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -64,6 +64,9 @@ void ParamsEdited::set (bool v) retinex.offs = v; retinex.vart = v; retinex.limd = v; + retinex.highl = v; + retinex.highlig = v; + retinex.grbl = v; retinex.medianmap = v; retinex.transmissionCurve = v; retinex.retinex = v; @@ -537,6 +540,9 @@ void ParamsEdited::initFrom (const std::vector retinex.offs = retinex.offs && p.retinex.offs == other.retinex.offs; retinex.vart = retinex.vart && p.retinex.vart == other.retinex.vart; retinex.limd = retinex.limd && p.retinex.limd == other.retinex.limd; + retinex.highl = retinex.highl && p.retinex.highl == other.retinex.highl; + retinex.highlig = retinex.highlig && p.retinex.highlig == other.retinex.highlig; + retinex.grbl = retinex.grbl && p.retinex.grbl == other.retinex.grbl; retinex.medianmap = retinex.medianmap && p.retinex.medianmap == other.retinex.medianmap; retinex.enabled = retinex.enabled && p.retinex.enabled == other.retinex.enabled; labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve; @@ -1086,6 +1092,18 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.retinex.limd = dontforceSet && options.baBehav[ADDSET_RETI_LIMD] ? toEdit.retinex.limd + mods.retinex.limd : mods.retinex.limd; } + if (retinex.highl) { + toEdit.retinex.highl = mods.retinex.highl; + } + + if (retinex.highlig) { + toEdit.retinex.highlig = mods.retinex.highlig; + } + + if (retinex.grbl) { + toEdit.retinex.grbl = mods.retinex.grbl; + } + if (retinex.gain) { toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_RETI_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index d71f4da73..16c4ed9f2 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -71,6 +71,9 @@ public: bool gammaretinex; bool vart; bool limd; + bool highl; + bool highlig; + bool grbl; bool method; bool transmissionCurve; bool cdcurve; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 760e1f468..c6aaf8702 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -36,6 +36,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexMethod->append_text (M("TP_RETINEX_LOW")); retinexMethod->append_text (M("TP_RETINEX_UNIFORM")); retinexMethod->append_text (M("TP_RETINEX_HIGH")); + retinexMethod->append_text (M("TP_RETINEX_HIGHLIG")); + retinexMethod->append_text (M("TP_RETINEX_HIGHLIGPLUS")); retinexMethod->set_active(0); retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) ); retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP")); @@ -115,6 +117,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); + highl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT"), 1, 100, 1, 10)); + highl->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT_TOOLTIP")); expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); @@ -125,6 +129,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexVBox->pack_start (*neigh); neigh->show (); + retinexVBox->pack_start (*highl); + highl->show (); + mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP")); @@ -136,10 +143,13 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -10000, 10000, 1, 0)); vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125)); limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8)); + highlig = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT2"), 1, 100, 1, 100)); + grbl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT3"), 1, 100, 1, 50)); gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP")); scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP")); vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); + highlig->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT2_TOOLTIP")); medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN"))); medianmap->set_active (true); @@ -184,6 +194,15 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*limd); limd->show (); +// settingsVBox->pack_start (*highl); +// highl->show (); + + settingsVBox->pack_start (*highlig); + highlig->show (); + + settingsVBox->pack_start (*grbl); + grbl->show (); + settingsVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); transmissionCurveEditorG->show(); @@ -246,6 +265,24 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), limd->delay = 200; } + highl->setAdjusterListener (this); + + if (highl->delay < 200) { + highl->delay = 200; + } + + highlig->setAdjusterListener (this); + + if (highlig->delay < 200) { + highlig->delay = 200; + } + + grbl->setAdjusterListener (this); + + if (grbl->delay < 200) { + grbl->delay = 200; + } + pack_start (*retinexVBox); pack_start (*expsettings); @@ -378,6 +415,9 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) offs->setEditedState (pedited->retinex.offs ? Edited : UnEdited); vart->setEditedState (pedited->retinex.vart ? Edited : UnEdited); limd->setEditedState (pedited->retinex.limd ? Edited : UnEdited); + highl->setEditedState (pedited->retinex.highl ? Edited : UnEdited); + highlig->setEditedState (pedited->retinex.highlig ? Edited : UnEdited); + grbl->setEditedState (pedited->retinex.grbl ? Edited : UnEdited); set_inconsistent (multiImage && !pedited->retinex.enabled); medianmap->set_inconsistent (!pedited->retinex.medianmap); @@ -409,6 +449,9 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) limd->setValue (pp->retinex.limd); gam->setValue (pp->retinex.gam); slope->setValue (pp->retinex.slope); + highl->setValue (pp->retinex.highl); + highlig->setValue (pp->retinex.highlig); + grbl->setValue (pp->retinex.grbl); setEnabled (pp->retinex.enabled); @@ -423,9 +466,12 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) retinexMethod->set_active (1); } else if (pp->retinex.retinexMethod == "high") { retinexMethod->set_active (2); + } else if (pp->retinex.retinexMethod == "highli") { + retinexMethod->set_active (3); + } else if (pp->retinex.retinexMethod == "highliplus") { + retinexMethod->set_active (4); } - if (pp->retinex.retinexcolorspace == "Lab") { retinexcolorspace->set_active (0); } else if (pp->retinex.retinexcolorspace == "HSLLOG") { @@ -480,6 +526,9 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.offs = (int)offs->getValue (); pp->retinex.vart = (int)vart->getValue (); pp->retinex.limd = (int)limd->getValue (); + pp->retinex.highl = (int)highl->getValue (); + pp->retinex.highlig = (int)highlig->getValue (); + pp->retinex.grbl = (int)grbl->getValue (); pp->retinex.cdcurve = cdshape->getCurve (); pp->retinex.cdHcurve = cdshapeH->getCurve (); pp->retinex.transmissionCurve = transmissionShape->getCurve (); @@ -501,6 +550,9 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pedited->retinex.offs = offs->getEditedState (); pedited->retinex.vart = vart->getEditedState (); pedited->retinex.limd = limd->getEditedState (); + pedited->retinex.highl = highl->getEditedState (); + pedited->retinex.highlig = highlig->getEditedState (); + pedited->retinex.grbl = grbl->getEditedState (); pedited->retinex.cdcurve = !cdshape->isUnChanged (); pedited->retinex.cdHcurve = !cdshapeH->isUnChanged (); pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged (); @@ -515,6 +567,10 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.retinexMethod = "uni"; } else if (retinexMethod->get_active_row_number() == 2) { pp->retinex.retinexMethod = "high"; + } else if (retinexMethod->get_active_row_number() == 3) { + pp->retinex.retinexMethod = "highli"; + } else if (retinexMethod->get_active_row_number() == 4) { + pp->retinex.retinexMethod = "highliplus"; } if (retinexcolorspace->get_active_row_number() == 0) { @@ -541,8 +597,11 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) void Retinex::retinexMethodChanged() { + if (retinexMethod->get_active_row_number() == 4) {highl->show();highlig->show();grbl->show();} + else if(retinexMethod->get_active_row_number() == 3) {highl->show();highlig->hide();grbl->hide();} + else {highl->hide();highlig->hide();grbl->hide();} if (listener) { - listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); + listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); } } @@ -631,6 +690,9 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi scal->setDefault (defParams->retinex.scal); vart->setDefault (defParams->retinex.vart); limd->setDefault (defParams->retinex.limd); + highl->setDefault (defParams->retinex.highl); + highlig->setDefault (defParams->retinex.highlig); + grbl->setDefault (defParams->retinex.grbl); gam->setDefault (defParams->retinex.gam); slope->setDefault (defParams->retinex.slope); @@ -642,6 +704,9 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi scal->setDefaultEditedState (pedited->retinex.scal ? Edited : UnEdited); vart->setDefaultEditedState (pedited->retinex.vart ? Edited : UnEdited); limd->setDefaultEditedState (pedited->retinex.limd ? Edited : UnEdited); + highl->setDefaultEditedState (pedited->retinex.highl ? Edited : UnEdited); + highlig->setDefaultEditedState (pedited->retinex.highlig ? Edited : UnEdited); + grbl->setDefaultEditedState (pedited->retinex.grbl ? Edited : UnEdited); gam->setDefaultEditedState (pedited->retinex.gam ? Edited : UnEdited); slope->setDefaultEditedState (pedited->retinex.slope ? Edited : UnEdited); @@ -651,6 +716,9 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi offs->setDefaultEditedState (Irrelevant); vart->setDefaultEditedState (Irrelevant); limd->setDefaultEditedState (Irrelevant); + highl->setDefaultEditedState (Irrelevant); + highlig->setDefaultEditedState (Irrelevant); + grbl->setDefaultEditedState (Irrelevant); str->setDefaultEditedState (Irrelevant); scal->setDefaultEditedState (Irrelevant); gam->setDefaultEditedState (Irrelevant); @@ -693,6 +761,12 @@ void Retinex::adjusterChanged (Adjuster* a, double newval) listener->panelChanged (EvLvart, vart->getTextValue()); } else if (a == limd) { listener->panelChanged (EvLlimd, limd->getTextValue()); + } else if (a == highl) { + listener->panelChanged (EvLhighl, highl->getTextValue()); + } else if (a == highlig) { + listener->panelChanged (EvLhighlig, highlig->getTextValue()); + } else if (a == grbl) { + listener->panelChanged (EvLgrbl, grbl->getTextValue()); } else if (a == gam) { listener->panelChanged (EvLgam, gam->getTextValue()); } else if (a == slope) { @@ -749,6 +823,9 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp) offs->trimValue(pp->retinex.offs); vart->trimValue(pp->retinex.vart); limd->trimValue(pp->retinex.limd); + highl->trimValue(pp->retinex.highl); + highlig->trimValue(pp->retinex.highlig); + grbl->trimValue(pp->retinex.grbl); gam->trimValue(pp->retinex.gam); slope->trimValue(pp->retinex.slope); @@ -772,6 +849,9 @@ void Retinex::setBatchMode (bool batchMode) slope->showEditedCB (); vart->showEditedCB (); limd->showEditedCB (); + highl->showEditedCB (); + highlig->showEditedCB (); + grbl->showEditedCB (); curveEditorGD->setBatchMode (batchMode); curveEditorGDH->setBatchMode (batchMode); transmissionCurveEditorG->setBatchMode (batchMode); diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 4e8d2f05e..b55a7940f 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -28,6 +28,9 @@ protected: Adjuster* offs; Adjuster* vart; Adjuster* limd; + Adjuster* highl; + Adjuster* highlig; + Adjuster* grbl; Adjuster* gam; Adjuster* slope; MyExpander* expsettings; From eb96e11a4370122751f27748cecb67ad5d48e8c5 Mon Sep 17 00:00:00 2001 From: Desmis Date: Mon, 5 Oct 2015 17:02:26 +0200 Subject: [PATCH 51/71] suppress printf in improccordinator.cc --- rtengine/improccoordinator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index b5def58d0..617038d82 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -365,7 +365,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } */ imgsrc->convertColorSpace(orig_prev, params.icm, currWB); - printf("improc color r=%f g=%f b=%f\n",orig_prev->r(50, 2300),orig_prev->g(50, 2300),orig_prev->b(50, 2300)); + // printf("improc color r=%f g=%f b=%f\n",orig_prev->r(50, 2300),orig_prev->g(50, 2300),orig_prev->b(50, 2300)); ipf.firstAnalysis (orig_prev, ¶ms, vhist16); } From 8fe6e7e8db4d0f71651453e8cac1e3d1f9cabe21 Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 6 Oct 2015 08:20:50 +0200 Subject: [PATCH 52/71] Clean code and change sensitivity highlight threshold --- rtengine/improccoordinator.cc | 1 - rtengine/ipretinex.cc | 4 ++-- rtengine/simpleprocess.cc | 3 --- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 617038d82..0bb316b7d 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -365,7 +365,6 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } */ imgsrc->convertColorSpace(orig_prev, params.icm, currWB); - // printf("improc color r=%f g=%f b=%f\n",orig_prev->r(50, 2300),orig_prev->g(50, 2300),orig_prev->b(50, 2300)); ipf.firstAnalysis (orig_prev, ¶ms, vhist16); } diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index f5edcd7c2..0ebf3ee43 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -241,7 +241,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e moderetinex = 3; } - float high = (float) deh.highl; + float high = 0.6f*(float) deh.highl;//reduce sensibility retinex_scales( RetinexScales, scal, moderetinex, nei, high ); int H_L = height; @@ -318,7 +318,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } } else { for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); } } } diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 73986518b..f6ea8ad6b 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -627,7 +627,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p Imagefloat* baseImg = new Imagefloat (fw, fh); imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw); -// printf("befo color R=%f G=%f B=%f\n",baseImg->r(50, 2300),baseImg->g(50, 2300),baseImg->b(50, 2300)); if (pl) { pl->setProgress (0.50); } @@ -717,7 +716,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p delete [] Max_B_; imgsrc->convertColorSpace(baseImg, params.icm, currWB); - // printf("after color R=%f G=%f B=%f\n",baseImg->r(50, 2300),baseImg->g(50, 2300),baseImg->b(50, 2300)); // perform first analysis LUTu hist16 (65536); @@ -817,7 +815,6 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p float moyS = 0.f; float eqty = 0.f; ipf.moyeqt (baseImg, moyS, eqty);//return image : mean saturation and standard dev of saturation - //printf("moy=%f ET=%f\n", moyS,eqty); float satp = ((moyS + 1.5f * eqty) - 0.3f) / 0.7f; //1.5 sigma ==> 93% pixels with high saturation -0.3 / 0.7 convert to Hombre scale if(satp >= 0.92f) { From 9dc786f0ea236bc793cd77b365fae1fbf9772017 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 6 Oct 2015 22:29:44 +0200 Subject: [PATCH 53/71] Segfault when curve black point is moved below white point, fixes #2923 --- rtengine/diagonalcurves.cc | 6 +++++- rtengine/rawimagesource.cc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rtengine/diagonalcurves.cc b/rtengine/diagonalcurves.cc index f46cdb8cb..f09eb3459 100644 --- a/rtengine/diagonalcurves.cc +++ b/rtengine/diagonalcurves.cc @@ -72,7 +72,11 @@ DiagonalCurve::DiagonalCurve (const std::vector& p, int poly_pn) if(x[0] == 0.f && x[1] == 0.f) // Avoid crash when first two points are at x = 0 (git Issue 2888) - x[1] = 0.5f; + x[1] = 0.01f; + + if(x[0] == 1.f && x[1] == 1.f) + // Avoid crash when first two points are at x = 1 (100 in gui) (git Issue 2923) + x[0] = 0.99f; if (!identity) { if (kind == DCT_Spline && N > 2) { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 3194e2f32..a85e7a7d3 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -983,7 +983,7 @@ SSEFUNCTION int RawImageSource::findHotDeadPixels( PixelsMap &bpMap, float thres // process borders. Former version calculated the median using mirrored border which does not make sense because the original pixel loses weight // Setting the difference between pixel and median for border pixels to zero should do the job not worse then former version #ifdef _OPENMP - #pragma omp critical + #pragma omp single #endif { for(int i = 0; i < 2; i++) { From b1dd9dd59a4895f5d6928406c381072b68a205d5 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 10 Oct 2015 01:05:08 +0200 Subject: [PATCH 54/71] Speedup and reduced memory usage for Colour Propagation --- rtengine/array2D.h | 37 +- rtengine/hilite_recon.cc | 760 +++++++++++++++++++++++--------------- rtengine/rawimagesource.h | 4 +- 3 files changed, 477 insertions(+), 324 deletions(-) diff --git a/rtengine/array2D.h b/rtengine/array2D.h index 93734a421..f9d92ac36 100644 --- a/rtengine/array2D.h +++ b/rtengine/array2D.h @@ -23,7 +23,7 @@ * Usage: * * array2D name (X-size,Y-size); - * array2D name (X-size,Y-size type ** data); + * array2D name (X-size,Y-size,type ** data); * * creates an array which is valid within the normal C/C++ scope "{ ... }" * @@ -75,7 +75,7 @@ private: T ** ptr; T * data; bool lock; // useful lock to ensure data is not changed anymore. - void ar_realloc(int w, int h) + void ar_realloc(int w, int h, int offset = 0) { if ((ptr) && ((h > y) || (4 * h < y))) { delete[] ptr; @@ -92,14 +92,14 @@ private: } if (data == NULL) { - data = new T[h * w]; + data = new T[h * w + offset]; } x = w; y = h; for (int i = 0; i < h; i++) { - ptr[i] = data + w * i; + ptr[i] = data + offset + w * i; } owner = 1; @@ -184,6 +184,19 @@ public: } } + void free() + { + if ((owner) && (data)) { + delete[] data; + data = NULL; + } + + if (ptr) { + delete [] ptr; + ptr = NULL; + } + } + // use with indices T * operator[](int index) { @@ -207,7 +220,7 @@ public: // useful within init of parent object // or use as resize of 2D array - void operator()(int w, int h, unsigned int flgs = 0) + void operator()(int w, int h, unsigned int flgs = 0, int offset = 0) { flags = flgs; @@ -223,10 +236,10 @@ public: lock = flags & ARRAY2D_LOCK_DATA; - ar_realloc(w, h); + ar_realloc(w, h, offset); if (flags & ARRAY2D_CLEAR_DATA) { - memset(data, 0, w * h * sizeof(T)); + memset(data + offset, 0, w * h * sizeof(T)); } } @@ -298,10 +311,10 @@ private: array2D list[num]; public: - multi_array2D(int x, int y, int flags = 0) + multi_array2D(int x, int y, int flags = 0, int offset = 0) { for (size_t i = 0; i < num; i++) { - list[i](x, y, flags); + list[i](x, y, flags, (i + 1) * offset); } } @@ -312,11 +325,7 @@ public: array2D & operator[](int index) { - if (static_cast(index) >= num) { - printf("index %0u is out of range[0..%0lu]", index, num - 1); - raise( SIGSEGV); - } - + assert(static_cast(index) < num); return list[index]; } }; diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index bc5e973e2..46c666c80 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -29,25 +29,15 @@ #include "rt_math.h" #include "opthelper.h" -#ifdef _OPENMP -#include -#endif - - #define FOREACHCOLOR for (int c=0; c < ColorCount; c++) -//#include "RGBdefringe.cc" - namespace rtengine { - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, int H, int W, int box ) +SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, float** temp, int H, int W, int box ) { - array2D temp(W, H); - //box blur image channel; box size = 2*box+1 //horizontal blur #ifdef _OPENMP @@ -84,10 +74,10 @@ SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, int H, int W #endif { float len = box + 1; - __m128 lenv = _mm_set1_ps( len ); - __m128 lenp1v = _mm_set1_ps( len + 1.0f ); - __m128 onev = _mm_set1_ps( 1.0f ); - __m128 tempv, temp2v; + vfloat lenv = F2V( len ); + vfloat lenp1v = F2V( len + 1.0f ); + vfloat onev = F2V( 1.0f ); + vfloat tempv, temp2v; #ifdef _OPENMP #pragma omp for nowait #endif @@ -130,7 +120,9 @@ SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, int H, int W } } +#ifdef _OPENMP #pragma omp single +#endif { for (int col = W - (W % 8); col < W - 3; col += 4) { tempv = LVFU(temp[0][col]) / lenv; @@ -160,29 +152,28 @@ SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, int H, int W _mm_storeu_ps( &dst[row][col], tempv ); } } - } - } + for (int col = W - (W % 4); col < W; col++) { + int len = box + 1; + dst[0][col] = temp[0][col] / len; - for (int col = W - (W % 4); col < W; col++) { - int len = box + 1; - dst[0][col] = temp[0][col] / len; + for (int i = 1; i <= box; i++) { + dst[0][col] += temp[i][col] / len; + } - for (int i = 1; i <= box; i++) { - dst[0][col] += temp[i][col] / len; - } + for (int row = 1; row <= box; row++) { + dst[row][col] = (dst[(row - 1)][col] * len + temp[(row + box)][col]) / (len + 1); + len ++; + } - for (int row = 1; row <= box; row++) { - dst[row][col] = (dst[(row - 1)][col] * len + temp[(row + box)][col]) / (len + 1); - len ++; - } + for (int row = box + 1; row < H - box; row++) { + dst[row][col] = dst[(row - 1)][col] + (temp[(row + box)][col] - temp[(row - box - 1)][col]) / len; + } - for (int row = box + 1; row < H - box; row++) { - dst[row][col] = dst[(row - 1)][col] + (temp[(row + box)][col] - temp[(row - box - 1)][col]) / len; - } - - for (int row = H - box; row < H; row++) { - dst[row][col] = (dst[(row - 1)][col] * len - temp[(row - box - 1)][col]) / (len - 1); - len --; + for (int row = H - box; row < H; row++) { + dst[row][col] = (dst[(row - 1)][col] * len - temp[(row - box - 1)][col]) / (len - 1); + len --; + } + } } } @@ -219,11 +210,9 @@ SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, int H, int W } -void RawImageSource::boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ) +void RawImageSource::boxblur_resamp(float **src, float **dst, float ** temp, int H, int W, int box, int samp ) { - array2D temp((W / samp) + ((W % samp) == 0 ? 0 : 1), H); - #ifdef _OPENMP #pragma omp parallel #endif @@ -235,7 +224,8 @@ void RawImageSource::boxblur_resamp(float **src, float **dst, int H, int W, int //box blur image channel; box size = 2*box+1 //horizontal blur - for (int row = 0; row < H; row++) { + for (int row = 0; row < H; row++) + { int len = box + 1; tempval = src[row][0] / len; @@ -255,8 +245,10 @@ void RawImageSource::boxblur_resamp(float **src, float **dst, int H, int W, int len ++; } + float oneByLen = 1.f / (float)len; + for (int col = box + 1; col < W - box; col++) { - tempval = tempval + (src[row][col + box] - src[row][col - box - 1]) / len; + tempval = tempval + (src[row][col + box] - src[row][col - box - 1]) * oneByLen; if(col % samp == 0) { temp[row][col / samp] = tempval; @@ -275,63 +267,125 @@ void RawImageSource::boxblur_resamp(float **src, float **dst, int H, int W, int } } + static const int numCols = 8; // process numCols columns at once for better L1 CPU cache usage #ifdef _OPENMP #pragma omp parallel #endif { - float tempval; + float tempvalN[numCols] ALIGNED16; #ifdef _OPENMP - #pragma omp for + #pragma omp for nowait #endif //vertical blur - for (int col = 0; col < W / samp; col++) { + for (int col = 0; col < (W / samp) - (numCols - 1); col += numCols) { int len = box + 1; - tempval = temp[0][col] / len; - for (int i = 1; i <= box; i++) { - tempval += temp[i][col] / len; + for(int n = 0; n < numCols; n++) { + tempvalN[n] = temp[0][col + n] / len; } - dst[0][col] = tempval; + for (int i = 1; i <= box; i++) { + for(int n = 0; n < numCols; n++) { + tempvalN[n] += temp[i][col + n] / len; + } + } + + for(int n = 0; n < numCols; n++) { + dst[0][col + n] = tempvalN[n]; + } for (int row = 1; row <= box; row++) { - tempval = (tempval * len + temp[(row + box)][col]) / (len + 1); + for(int n = 0; n < numCols; n++) { + tempvalN[n] = (tempvalN[n] * len + temp[(row + box)][col + n]) / (len + 1); + } if(row % samp == 0) { - dst[row / samp][col] = tempval; + for(int n = 0; n < numCols; n++) { + dst[row / samp][col + n] = tempvalN[n]; + } } len ++; } for (int row = box + 1; row < H - box; row++) { - tempval = tempval + (temp[(row + box)][col] - temp[(row - box - 1)][col]) / len; + for(int n = 0; n < numCols; n++) { + tempvalN[n] = tempvalN[n] + (temp[(row + box)][col + n] - temp[(row - box - 1)][col + n]) / len; + } if(row % samp == 0) { - dst[row / samp][col] = tempval; + for(int n = 0; n < numCols; n++) { + dst[row / samp][col + n] = tempvalN[n]; + } } } for (int row = H - box; row < H; row++) { - tempval = (tempval * len - temp[(row - box - 1)][col]) / (len - 1); + for(int n = 0; n < numCols; n++) { + tempvalN[n] = (tempvalN[n] * len - temp[(row - box - 1)][col + n]) / (len - 1); + } if(row % samp == 0) { - dst[row / samp][col] = tempval; + for(int n = 0; n < numCols; n++) { + dst[row / samp][col + n] = tempvalN[n]; + } } len --; } } + + // process remaining columns + #pragma omp single + { + float tempval; + + //vertical blur + for (int col = (W / samp) - ((W / samp) % numCols); col < W / samp; col++) { + int len = box + 1; + tempval = temp[0][col] / len; + + for (int i = 1; i <= box; i++) { + tempval += temp[i][col] / len; + } + + dst[0][col] = tempval; + + for (int row = 1; row <= box; row++) { + tempval = (tempval * len + temp[(row + box)][col]) / (len + 1); + + if(row % samp == 0) { + dst[row / samp][col] = tempval; + } + + len ++; + } + + for (int row = box + 1; row < H - box; row++) { + tempval = tempval + (temp[(row + box)][col] - temp[(row - box - 1)][col]) / len; + + if(row % samp == 0) { + dst[row / samp][col] = tempval; + } + } + + for (int row = H - box; row < H; row++) { + tempval = (tempval * len - temp[(row - box - 1)][col]) / (len - 1); + + if(row % samp == 0) { + dst[row / samp][col] = tempval; + } + + len --; + } + } + } } } -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** blue) { double progress = 0.0; @@ -344,12 +398,8 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b int height = H; int width = W; - const int range = 2; - const int pitch = 4; - - - int hfh = (height - (height % pitch)) / pitch; - int hfw = (width - (width % pitch)) / pitch; + static const int range = 2; + static const int pitch = 4; static const int numdirs = 4; @@ -360,7 +410,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b //%%%%%%%%%%%%%%%%%%%% //for blend algorithm: static const float blendthresh = 1.0; - const int ColorCount = 3; + static const int ColorCount = 3; // Transform matrixes rgb>lab and back static const float trans[2][ColorCount][ColorCount] = { { { 1, 1, 1 }, { 1.7320508, -1.7320508, 0 }, { -1, -1, 2 } }, @@ -370,49 +420,12 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b { { 1, 0.8660254, -0.5 }, { 1, -0.8660254, -0.5 }, { 1, 0, 1 } }, { { 1, 1, 1 }, { 1, -1, 1 }, { 1, 1, -1 } } }; - //%%%%%%%%%%%%%%%%%%%% - - float max_f[3], thresh[3], fixthresh[3], norm[3]; - - //float red1, green1, blue1;//diagnostic -// float chmaxalt[4]={0,0,0,0};//diagnostic - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //halfsize demosaic - - /* - multi_array2D hfsize (hfw+1,hfh+1,ARRAY2D_CLEAR_DATA); - - boxblur_resamp(red,hfsize[0],chmaxalt[0],height,width,range,pitch); - if(plistener){ - progress += 0.05; - plistener->setProgress(progress); - } - boxblur_resamp(green,hfsize[1],chmaxalt[1],height,width,range,pitch); - if(plistener){ - progress += 0.05; - plistener->setProgress(progress); - } - boxblur_resamp(blue,hfsize[2],chmaxalt[2],height,width,range,pitch); - if(plistener){ - progress += 0.05; - plistener->setProgress(progress); - } - - //blur image - //for (int m=0; m<3; m++) - // boxblur2(hfsize[m],hfsizeblur[m],hfh,hfw,3); - - */ - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + float max_f[3], thresh[3]; for (int c = 0; c < 3; c++) { thresh[c] = chmax[c] * threshpct; - fixthresh[c] = chmax[c] * fixthreshpct; max_f[c] = chmax[c] * maxpct; //min(chmax[0],chmax[1],chmax[2])*maxpct; - norm[c] = 1.0 / (max_f[c] - fixthresh[c]); } float whitept = max(max_f[0], max_f[1], max_f[2]); @@ -420,43 +433,57 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b float medpt = max_f[0] + max_f[1] + max_f[2] - whitept - clippt; float blendpt = blendthresh * clippt; - float camwb[4]; - - for (int c = 0; c < 4; c++) { - camwb[c] = ri->get_cam_mul(c); - } - - multi_array2D channelblur(width, height, ARRAY2D_CLEAR_DATA); - multi_array2D hilite_full(width, height, ARRAY2D_CLEAR_DATA); - - if(plistener) { - progress += 0.05; - plistener->setProgress(progress); - } + multi_array2D channelblur(width, height, 0, 48); + array2D temp(width, height); // allocate temporary buffer // blur RGB channels - boxblur2(red , channelblur[0], height, width, 4); + + boxblur2(red , channelblur[0], temp, height, width, 4); + if(plistener) { + progress += 0.05; + plistener->setProgress(progress); + } + + boxblur2(green, channelblur[1], temp, height, width, 4); + if(plistener) { + progress += 0.05; + plistener->setProgress(progress); + } + + boxblur2(blue , channelblur[2], temp, height, width, 4); + if(plistener) { + progress += 0.05; + plistener->setProgress(progress); + } + + // reduce channel blur to one array +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for(int i = 0; i < height; i++) + for(int j = 0; j < width; j++) { + channelblur[0][i][j] = fabsf(channelblur[0][i][j] - red[i][j]) + fabsf(channelblur[1][i][j] - green[i][j]) + fabsf(channelblur[2][i][j] - blue[i][j]); + } + + for (int c = 1; c < 3; c++) { + channelblur[c].free(); //free up some memory + } if(plistener) { progress += 0.05; plistener->setProgress(progress); } - boxblur2(green, channelblur[1], height, width, 4); - + multi_array2D hilite_full(width, height, ARRAY2D_CLEAR_DATA, 32); if(plistener) { - progress += 0.05; + progress += 0.10; plistener->setProgress(progress); } - boxblur2(blue , channelblur[2], height, width, 4); - if(plistener) { - progress += 0.05; - plistener->setProgress(progress); - } - - float hipass_sum = 0, hipass_norm = 0.00; + double hipass_sum = 0.f; + int hipass_norm = 0; // set up which pixels are clipped or near clipping #ifdef _OPENMP @@ -465,40 +492,34 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - //if one or more channels is highlight but none are blown, add to highlight accumulator - if ((red[i][j] > thresh[0] || green[i][j] > thresh[1] || blue[i][j] > thresh[2]) && (red[i][j] < max_f[0] && green[i][j] < max_f[1] && blue[i][j] < max_f[2])) { - hipass_sum += fabs(channelblur[0][i][j] - red[i][j]) + fabs(channelblur[1][i][j] - green[i][j]) + fabs(channelblur[2][i][j] - blue[i][j]); - hipass_norm++; + hipass_sum += channelblur[0][i][j]; + hipass_norm ++; hilite_full[0][i][j] = red[i][j]; hilite_full[1][i][j] = green[i][j]; hilite_full[2][i][j] = blue[i][j]; - hilite_full[3][i][j] = 1; - hilite_full[4][i][j] = 1; + hilite_full[3][i][j] = 1.f; } - - //if (i%100==0 && j%100==0) - // printf("row=%d col=%d r=%f g=%f b=%f hilite=%f \n",i,j,hilite_full[0][i][j],hilite_full[1][i][j],hilite_full[2][i][j],hilite_full[3][i][j]); } }//end of filling highlight array - hipass_norm += 0.01; - - float hipass_ave = (hipass_sum / hipass_norm); - + float hipass_ave = 2.f * hipass_sum / (hipass_norm + 0.01); if(plistener) { progress += 0.05; plistener->setProgress(progress); } + array2D hilite_full4(width, height); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //blur highlight data - boxblur2(hilite_full[4], hilite_full[4], height, width, 1); + boxblur2(hilite_full[3], hilite_full4, temp, height, width, 1); + + temp.free(); // free temporary buffer if(plistener) { progress += 0.05; @@ -511,32 +532,34 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - - float hipass = fabs(channelblur[0][i][j] - red[i][j]) + fabs(channelblur[1][i][j] - green[i][j]) + fabs(channelblur[2][i][j] - blue[i][j]); - - if (hipass > 2 * hipass_ave) { + if (channelblur[0][i][j] > hipass_ave) { //too much variation - hilite_full[0][i][j] = hilite_full[1][i][j] = hilite_full[2][i][j] = hilite_full[3][i][j] = 0; + hilite_full[0][i][j] = hilite_full[1][i][j] = hilite_full[2][i][j] = hilite_full[3][i][j] = 0.f; continue; } - if (hilite_full[4][i][j] > 0.00001 && hilite_full[4][i][j] < 0.95) { + if (hilite_full4[i][j] > 0.00001 && hilite_full4[i][j] < 0.95) { //too near an edge, could risk using CA affected pixels, therefore omit - hilite_full[0][i][j] = hilite_full[1][i][j] = hilite_full[2][i][j] = hilite_full[3][i][j] = 0; + hilite_full[0][i][j] = hilite_full[1][i][j] = hilite_full[2][i][j] = hilite_full[3][i][j] = 0.f; } } } - for (int c = 0; c < 3; c++) { - channelblur[c](1, 1); //free up some memory - } + channelblur[0].free(); //free up some memory + hilite_full4.free(); //free up some memory - multi_array2D hilite(hfw + 1, hfh + 1, ARRAY2D_CLEAR_DATA); + int hfh = (height - (height % pitch)) / pitch; + int hfw = (width - (width % pitch)) / pitch; + + multi_array2D hilite(hfw + 1, hfh + 1, ARRAY2D_CLEAR_DATA, 48); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // blur and resample highlight data; range=size of blur, pitch=sample spacing + + array2D temp2((width / pitch) + ((width % pitch) == 0 ? 0 : 1), height); + for (int m = 0; m < 4; m++) { - boxblur_resamp(hilite_full[m], hilite[m], height, width, range, pitch); + boxblur_resamp(hilite_full[m], hilite[m], temp2, height, width, range, pitch); if(plistener) { progress += 0.05; @@ -544,101 +567,235 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } } - for (int c = 0; c < 5; c++) { - hilite_full[c](1, 1); //free up some memory + temp2.free(); + + for (int c = 0; c < 4; c++) { + hilite_full[c].free(); //free up some memory } - multi_array2D hilite_dir(hfw, hfh, ARRAY2D_CLEAR_DATA); - + multi_array2D hilite_dir(hfw, hfh, ARRAY2D_CLEAR_DATA, 64); + // for faster processing we create two buffers using (height,width) instead of (width,height) + multi_array2D hilite_dir0(hfh, hfw, ARRAY2D_CLEAR_DATA, 64); + multi_array2D hilite_dir4(hfh, hfw, ARRAY2D_CLEAR_DATA, 64); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //blur highlights - //for (int m=0; m<4; m++) - // boxblur2(hilite[m],hilite[m],hfh,hfw,4); - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if(plistener) { progress += 0.05; plistener->setProgress(progress); } - LUTf invfn(0x10000); - - for (int i = 0; i < 0x10000; i++) { - invfn[i] = 1.0 / (1.0 + i); - } - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //fill gaps in highlight map by directional extension //raster scan from four corners - for (int j = 1; j < hfw - 1; j++) + for (int j = 1; j < hfw - 1; j++) { for (int i = 2; i < hfh - 2; i++) { //from left if (hilite[3][i][j] > 0.01) { - for (int c = 0; c < 4; c++) { - hilite_dir[c][i][j] = hilite[c][i][j] / hilite[3][i][j]; - } + hilite_dir0[3][j][i] = 1.f; } else { - for (int c = 0; c < 4; c++) { - hilite_dir[c][i][j] = 0.1 * ((hilite_dir[0 + c][i - 2][j - 1] + hilite_dir[0 + c][i - 1][j - 1] + hilite_dir[0 + c][i][j - 1] + hilite_dir[0 + c][i + 1][j - 1] + hilite_dir[0 + c][i + 2][j - 1]) / - (hilite_dir[0 + 3][i - 2][j - 1] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i][j - 1] + hilite_dir[0 + 3][i + 1][j - 1] + hilite_dir[0 + 3][i + 2][j - 1] + 0.00001)); - hilite_dir[4 + c][i][j + 1] += hilite_dir[c][i][j]; - hilite_dir[8 + c][i - 2][j] += hilite_dir[c][i][j]; - hilite_dir[12 + c][i + 2][j] += hilite_dir[c][i][j]; - } + hilite_dir0[3][j][i] = (hilite_dir0[0 + 3][j - 1][i - 2] + hilite_dir0[0 + 3][j - 1][i - 1] + hilite_dir0[0 + 3][j - 1][i] + hilite_dir0[0 + 3][j - 1][i + 1] + hilite_dir0[0 + 3][j - 1][i + 2]) == 0.f ? 0.f : 0.1f; } } + if(hilite[3][2][j] <= 0.01) { + hilite_dir[0 + 3][0][j] = hilite_dir0[3][j][2]; + } + + if(hilite[3][3][j] <= 0.01) { + hilite_dir[0 + 3][1][j] = hilite_dir0[3][j][3]; + } + + if(hilite[3][hfh - 3][j] <= 0.01) { + hilite_dir[4 + 3][hfh - 1][j] = hilite_dir0[3][j][hfh - 3]; + } + + if(hilite[3][hfh - 4][j] <= 0.01) { + hilite_dir[4 + 3][hfh - 2][j] = hilite_dir0[3][j][hfh - 4]; + } + } + + for (int i = 2; i < hfh - 2; i++) { + if(hilite[3][i][hfw - 2] <= 0.01) { + hilite_dir4[3][hfw - 1][i] = hilite_dir0[3][hfw - 2][i]; + } + } + + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int c = 0; c < 3; c++) { + for (int j = 1; j < hfw - 1; j++) { + for (int i = 2; i < hfh - 2; i++) { + //from left + if (hilite[3][i][j] > 0.01f) { + hilite_dir0[c][j][i] = hilite[c][i][j] / hilite[3][i][j]; + } else { + hilite_dir0[c][j][i] = 0.1f * ((hilite_dir0[0 + c][j - 1][i - 2] + hilite_dir0[0 + c][j - 1][i - 1] + hilite_dir0[0 + c][j - 1][i] + hilite_dir0[0 + c][j - 1][i + 1] + hilite_dir0[0 + c][j - 1][i + 2]) / + (hilite_dir0[0 + 3][j - 1][i - 2] + hilite_dir0[0 + 3][j - 1][i - 1] + hilite_dir0[0 + 3][j - 1][i] + hilite_dir0[0 + 3][j - 1][i + 1] + hilite_dir0[0 + 3][j - 1][i + 2] + 0.00001f)); + } + } + + if(hilite[3][2][j] <= 0.01f) { + hilite_dir[0 + c][0][j] = hilite_dir0[c][j][2]; + } + + if(hilite[3][3][j] <= 0.01f) { + hilite_dir[0 + c][1][j] = hilite_dir0[c][j][3]; + } + + if(hilite[3][hfh - 3][j] <= 0.01f) { + hilite_dir[4 + c][hfh - 1][j] = hilite_dir0[c][j][hfh - 3]; + } + + if(hilite[3][hfh - 4][j] <= 0.01f) { + hilite_dir[4 + c][hfh - 2][j] = hilite_dir0[c][j][hfh - 4]; + } + } + + for (int i = 2; i < hfh - 2; i++) { + if(hilite[3][i][hfw - 2] <= 0.01f) { + hilite_dir4[c][hfw - 1][i] = hilite_dir0[c][hfw - 2][i]; + } + } + } + if(plistener) { progress += 0.05; plistener->setProgress(progress); } - for (int j = hfw - 2; j > 0; j--) + for (int j = hfw - 2; j > 0; j--) { for (int i = 2; i < hfh - 2; i++) { //from right if (hilite[3][i][j] > 0.01) { - for (int c = 0; c < 4; c++) { - hilite_dir[4 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; - } + hilite_dir4[3][j][i] = 1.f; } else { - for (int c = 0; c < 4; c++) { - hilite_dir[4 + c][i][j] = 0.1 * ((hilite_dir[4 + c][(i - 2)][(j + 1)] + hilite_dir[4 + c][(i - 1)][(j + 1)] + hilite_dir[4 + c][(i)][(j + 1)] + hilite_dir[4 + c][(i + 1)][(j + 1)] + hilite_dir[4 + c][(i + 2)][(j + 1)]) / - (hilite_dir[4 + 3][(i - 2)][(j + 1)] + hilite_dir[4 + 3][(i - 1)][(j + 1)] + hilite_dir[4 + 3][(i)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 2)][(j + 1)] + 0.00001)); - hilite_dir[8 + c][i - 2][j] += hilite_dir[4 + c][i][j]; - hilite_dir[12 + c][i + 2][j] += hilite_dir[4 + c][i][j]; - } + hilite_dir4[3][j][i] = (hilite_dir4[3][(j + 1)][(i - 2)] + hilite_dir4[3][(j + 1)][(i - 1)] + hilite_dir4[3][(j + 1)][(i)] + hilite_dir4[3][(j + 1)][(i + 1)] + hilite_dir4[3][(j + 1)][(i + 2)]) == 0.f ? 0.f : 0.1f; } } + if(hilite[3][2][j] <= 0.01) { + hilite_dir[0 + 3][0][j] += hilite_dir4[3][j][2]; + } + + if(hilite[3][hfh - 3][j] <= 0.01) { + hilite_dir[4 + 3][hfh - 1][j] += hilite_dir4[3][j][hfh - 3]; + } + } + + for (int i = 2; i < hfh - 2; i++) { + if(hilite[3][i][0] <= 0.01) { + hilite_dir[0 + 3][i - 2][0] += hilite_dir4[3][0][i]; + hilite_dir[4 + 3][i + 2][0] += hilite_dir4[3][0][i]; + } + + if(hilite[3][i][1] <= 0.01) { + hilite_dir[0 + 3][i - 2][1] += hilite_dir4[3][1][i]; + hilite_dir[4 + 3][i + 2][1] += hilite_dir4[3][1][i]; + } + + if(hilite[3][i][hfw - 2] <= 0.01) { + hilite_dir[0 + 3][i - 2][hfw - 2] += hilite_dir4[3][hfw - 2][i]; + hilite_dir[4 + 3][i + 2][hfw - 2] += hilite_dir4[3][hfw - 2][i]; + } + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int c = 0; c < 3; c++) { + for (int j = hfw - 2; j > 0; j--) { + for (int i = 2; i < hfh - 2; i++) { + //from right + if (hilite[3][i][j] > 0.01) { + hilite_dir4[c][j][i] = hilite[c][i][j] / hilite[3][i][j]; + } else { + hilite_dir4[c][j][i] = 0.1 * ((hilite_dir4[c][(j + 1)][(i - 2)] + hilite_dir4[c][(j + 1)][(i - 1)] + hilite_dir4[c][(j + 1)][(i)] + hilite_dir4[c][(j + 1)][(i + 1)] + hilite_dir4[c][(j + 1)][(i + 2)]) / + (hilite_dir4[3][(j + 1)][(i - 2)] + hilite_dir4[3][(j + 1)][(i - 1)] + hilite_dir4[3][(j + 1)][(i)] + hilite_dir4[3][(j + 1)][(i + 1)] + hilite_dir4[3][(j + 1)][(i + 2)] + 0.00001)); + } + } + + if(hilite[3][2][j] <= 0.01) { + hilite_dir[0 + c][0][j] += hilite_dir4[c][j][2]; + } + + if(hilite[3][hfh - 3][j] <= 0.01) { + hilite_dir[4 + c][hfh - 1][j] += hilite_dir4[c][j][hfh - 3]; + } + } + + for (int i = 2; i < hfh - 2; i++) { + if(hilite[3][i][0] <= 0.01) { + hilite_dir[0 + c][i - 2][0] += hilite_dir4[c][0][i]; + hilite_dir[4 + c][i + 2][0] += hilite_dir4[c][0][i]; + } + + if(hilite[3][i][1] <= 0.01) { + hilite_dir[0 + c][i - 2][1] += hilite_dir4[c][1][i]; + hilite_dir[4 + c][i + 2][1] += hilite_dir4[c][1][i]; + } + + if(hilite[3][i][hfw - 2] <= 0.01) { + hilite_dir[0 + c][i - 2][hfw - 2] += hilite_dir4[c][hfw - 2][i]; + hilite_dir[4 + c][i + 2][hfw - 2] += hilite_dir4[c][hfw - 2][i]; + } + } + } + if(plistener) { progress += 0.05; plistener->setProgress(progress); } + for (int i = 1; i < hfh - 1; i++) for (int j = 2; j < hfw - 2; j++) { - //if (i%100==0 && j%100==0) - // printf("row=%d col=%d r=%f g=%f b=%f hilite=%f \n",i,j,hilite[0][i][j],hilite[1][i][j],hilite[2][i][j],hilite[3][i][j]); - //from top if (hilite[3][i][j] > 0.01) { - for (int c = 0; c < 4; c++) { - hilite_dir[8 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; - } + hilite_dir[0 + 3][i][j] = 1.f; } else { - for (int c = 0; c < 4; c++) { - hilite_dir[8 + c][i][j] = 0.1 * ((hilite_dir[8 + c][i - 1][j - 2] + hilite_dir[8 + c][i - 1][j - 1] + hilite_dir[8 + c][i - 1][j] + hilite_dir[8 + c][i - 1][j + 1] + hilite_dir[8 + c][i - 1][j + 2]) / - (hilite_dir[8 + 3][i - 1][j - 2] + hilite_dir[8 + 3][i - 1][j - 1] + hilite_dir[8 + 3][i - 1][j] + hilite_dir[8 + 3][i - 1][j + 1] + hilite_dir[8 + 3][i - 1][j + 2] + 0.00001)); - hilite_dir[12 + c][i + 1][j] += hilite_dir[8 + c][i][j]; + hilite_dir[0 + 3][i][j] = (hilite_dir[0 + 3][i - 1][j - 2] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i - 1][j] + hilite_dir[0 + 3][i - 1][j + 1] + hilite_dir[0 + 3][i - 1][j + 2]) == 0.f ? 0.f : 0.1f; + } + } + + for (int j = 2; j < hfw - 2; j++) { + if(hilite[3][hfh - 2][j] <= 0.01) { + hilite_dir[4 + 3][hfh - 1][j] += hilite_dir[0 + 3][hfh - 2][j]; + } + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int c = 0; c < 3; c++) { + for (int i = 1; i < hfh - 1; i++) { + for (int j = 2; j < hfw - 2; j++) { + //from top + if (hilite[3][i][j] > 0.01) { + hilite_dir[0 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; + } else { + hilite_dir[0 + c][i][j] = 0.1 * ((hilite_dir[0 + c][i - 1][j - 2] + hilite_dir[0 + c][i - 1][j - 1] + hilite_dir[0 + c][i - 1][j] + hilite_dir[0 + c][i - 1][j + 1] + hilite_dir[0 + c][i - 1][j + 2]) / + (hilite_dir[0 + 3][i - 1][j - 2] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i - 1][j] + hilite_dir[0 + 3][i - 1][j + 1] + hilite_dir[0 + 3][i - 1][j + 2] + 0.00001)); } } } + for (int j = 2; j < hfw - 2; j++) { + if(hilite[3][hfh - 2][j] <= 0.01) { + hilite_dir[4 + c][hfh - 1][j] += hilite_dir[0 + c][hfh - 2][j]; + } + } + + } + if(plistener) { progress += 0.05; plistener->setProgress(progress); @@ -648,17 +805,29 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int j = 2; j < hfw - 2; j++) { //from bottom if (hilite[3][i][j] > 0.01) { - for (int c = 0; c < 4; c++) { - hilite_dir[12 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; - } + hilite_dir[4 + 3][i][j] = 1.f; } else { - for (int c = 0; c < 4; c++) { - hilite_dir[12 + c][i][j] = 0.1 * ((hilite_dir[12 + c][(i + 1)][(j - 2)] + hilite_dir[12 + c][(i + 1)][(j - 1)] + hilite_dir[12 + c][(i + 1)][(j)] + hilite_dir[12 + c][(i + 1)][(j + 1)] + hilite_dir[12 + c][(i + 1)][(j + 2)]) / - (hilite_dir[12 + 3][(i + 1)][(j - 2)] + hilite_dir[12 + 3][(i + 1)][(j - 1)] + hilite_dir[12 + 3][(i + 1)][(j)] + hilite_dir[12 + 3][(i + 1)][(j + 1)] + hilite_dir[12 + 3][(i + 1)][(j + 2)] + 0.00001)); + hilite_dir[4 + 3][i][j] = (hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)]) == 0.f ? 0.f : 0.1f; + } + } + +#ifdef _OPENMP + #pragma omp parallel for +#endif + + for (int c = 0; c < 4; c++) { + for (int i = hfh - 2; i > 0; i--) { + for (int j = 2; j < hfw - 2; j++) { + //from bottom + if (hilite[3][i][j] > 0.01) { + hilite_dir[4 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; + } else { + hilite_dir[4 + c][i][j] = 0.1 * ((hilite_dir[4 + c][(i + 1)][(j - 2)] + hilite_dir[4 + c][(i + 1)][(j - 1)] + hilite_dir[4 + c][(i + 1)][(j)] + hilite_dir[4 + c][(i + 1)][(j + 1)] + hilite_dir[4 + c][(i + 1)][(j + 2)]) / + (hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)] + 0.00001)); } } - } + } if(plistener) { progress += 0.05; @@ -666,7 +835,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } //fill in edges - for (int dir = 0; dir < numdirs; dir++) { + for (int dir = 0; dir < 2; dir++) { for (int i = 1; i < hfh - 1; i++) for (int c = 0; c < 4; c++) { hilite_dir[dir * 4 + c][i][0] = hilite_dir[dir * 4 + c][i][1]; @@ -687,27 +856,63 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } } + for (int i = 1; i < hfh - 1; i++) + for (int c = 0; c < 4; c++) { + hilite_dir0[c][0][i] = hilite_dir0[c][1][i]; + hilite_dir0[c][hfw - 1][i] = hilite_dir0[c][hfw - 2][i]; + } + + for (int j = 1; j < hfw - 1; j++) + for (int c = 0; c < 4; c++) { + hilite_dir0[c][j][0] = hilite_dir0[c][j][1]; + hilite_dir0[c][j][hfh - 1] = hilite_dir0[c][j][hfh - 2]; + } + + for (int c = 0; c < 4; c++) { + hilite_dir0[c][0][0] = hilite_dir0[c][0][1] = hilite_dir0[c][1][0] = hilite_dir0[c][1][1] = hilite_dir0[c][2][2]; + hilite_dir0[c][hfw - 1][0] = hilite_dir0[c][hfw - 1][1] = hilite_dir0[c][hfw - 2][0] = hilite_dir0[c][hfw - 2][1] = hilite_dir0[c][hfw - 3][2]; + hilite_dir0[c][0][hfh - 1] = hilite_dir0[c][0][hfh - 2] = hilite_dir0[c][1][hfh - 1] = hilite_dir0[c][1][hfh - 2] = hilite_dir0[c][2][hfh - 3]; + hilite_dir0[c][hfw - 1][hfh - 1] = hilite_dir0[c][hfw - 1][hfh - 2] = hilite_dir0[c][hfw - 2][hfh - 1] = hilite_dir0[c][hfw - 2][hfh - 2] = hilite_dir0[c][hfw - 3][hfh - 3]; + } + + for (int i = 1; i < hfh - 1; i++) + for (int c = 0; c < 4; c++) { + hilite_dir4[c][0][i] = hilite_dir4[c][1][i]; + hilite_dir4[c][hfw - 1][i] = hilite_dir4[c][hfw - 2][i]; + } + + for (int j = 1; j < hfw - 1; j++) + for (int c = 0; c < 4; c++) { + hilite_dir4[c][j][0] = hilite_dir4[c][j][1]; + hilite_dir4[c][j][hfh - 1] = hilite_dir4[c][j][hfh - 2]; + } + + for (int c = 0; c < 4; c++) { + hilite_dir4[c][0][0] = hilite_dir4[c][0][1] = hilite_dir4[c][1][0] = hilite_dir4[c][1][1] = hilite_dir4[c][2][2]; + hilite_dir4[c][hfw - 1][0] = hilite_dir4[c][hfw - 1][1] = hilite_dir4[c][hfw - 2][0] = hilite_dir4[c][hfw - 2][1] = hilite_dir4[c][hfw - 3][2]; + hilite_dir4[c][0][hfh - 1] = hilite_dir4[c][0][hfh - 2] = hilite_dir4[c][1][hfh - 1] = hilite_dir4[c][1][hfh - 2] = hilite_dir4[c][2][hfh - 3]; + hilite_dir4[c][hfw - 1][hfh - 1] = hilite_dir4[c][hfw - 1][hfh - 2] = hilite_dir4[c][hfw - 2][hfh - 1] = hilite_dir4[c][hfw - 2][hfh - 2] = hilite_dir4[c][hfw - 3][hfh - 3]; + } + + + if(plistener) { progress += 0.05; plistener->setProgress(progress); } - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - /*for (int m=0; m<4*numdirs; m++) { - boxblur2(hilite_dir[m],hilite_dir[m],hfh,hfw,4); - }*/ - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - //now we have highlight data extended in various directions - //next step is to build back local data by averaging - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // now reconstruct clipped channels using color ratios - //const float Yclip = 0.3333*(max[0] + max[1] + max[2]); - //float sumwt=0, counts=0; + for(int c = 0; c < 4; c++) { + hilite[c].free(); + } + + LUTf invfn(0x10000); + + for (int i = 0; i < 0x10000; i++) { + invfn[i] = 1.0 / (1.0 + i); + } #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -725,8 +930,6 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b continue; //pixel not clipped } - //if (pixel[0] 0.5) { + dirwt = invfn[65535 * (SQR(rgb_blend[0] / Y - hilite_dir0[0][j1][i1] / Yhi) + + SQR(rgb_blend[1] / Y - hilite_dir0[1][j1][i1] / Yhi) + + SQR(rgb_blend[2] / Y - hilite_dir0[2][j1][i1] / Yhi))]; + totwt += dirwt; + clipfix[0] += dirwt * hilite_dir0[0][j1][i1] / (hilite_dir0[3][j1][i1] + 0.00001); + clipfix[1] += dirwt * hilite_dir0[1][j1][i1] / (hilite_dir0[3][j1][i1] + 0.00001); + clipfix[2] += dirwt * hilite_dir0[2][j1][i1] / (hilite_dir0[3][j1][i1] + 0.00001); + } + + for (int dir = 0; dir < 2; dir++) { float Yhi = 0.001 + (hilite_dir[dir * 4 + 0][i1][j1] + hilite_dir[dir * 4 + 1][i1][j1] + hilite_dir[dir * 4 + 2][i1][j1]); float Y = 0.001 + (rgb_blend[0] + rgb_blend[1] + rgb_blend[2]); @@ -827,6 +1043,19 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } } + Yhi = 0.001 + (hilite_dir4[0][j1][i1] + hilite_dir4[1][j1][i1] + hilite_dir4[2][j1][i1]); + Y = 0.001 + (rgb_blend[0] + rgb_blend[1] + rgb_blend[2]); + + if (hilite_dir4[0][j1][i1] + hilite_dir4[1][j1][i1] + hilite_dir4[2][j1][i1] > 0.5) { + dirwt = invfn[65535 * (SQR(rgb_blend[0] / Y - hilite_dir4[0][j1][i1] / Yhi) + + SQR(rgb_blend[1] / Y - hilite_dir4[1][j1][i1] / Yhi) + + SQR(rgb_blend[2] / Y - hilite_dir4[2][j1][i1] / Yhi))]; + totwt += dirwt; + clipfix[0] += dirwt * hilite_dir4[0][j1][i1] / (hilite_dir4[3][j1][i1] + 0.00001); + clipfix[1] += dirwt * hilite_dir4[1][j1][i1] / (hilite_dir4[3][j1][i1] + 0.00001); + clipfix[2] += dirwt * hilite_dir4[2][j1][i1] / (hilite_dir4[3][j1][i1] + 0.00001); + } + if(totwt == 0.f) { continue; } @@ -841,7 +1070,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b if (pixel[0] > max_f[0] && pixel[1] > max_f[1] && pixel[2] > max_f[2]) { //all channels clipped float Y = (0.299 * clipfix[0] + 0.587 * clipfix[1] + 0.114 * clipfix[2]); - //float Y = (clipfix[0] + clipfix[1] + clipfix[2]); + factor = whitept / Y; red[i][j] = clipfix[0] * factor; green[i][j] = clipfix[1] * factor; @@ -866,28 +1095,11 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } } - /*if (hilite[3][i1][j1]>0.01) { - red[i][j] = (red[i][j] + hilite[0][i1][j1])/(1+hilite[3][i1][j1]); - green[i][j] = (green[i][j]+ hilite[1][i1][j1])/(1+hilite[3][i1][j1]); - blue[i][j] = (blue[i][j] + hilite[2][i1][j1])/(1+hilite[3][i1][j1]); - }*/ - Y = (0.299 * red[i][j] + 0.587 * green[i][j] + 0.114 * blue[i][j]); if (Y > whitept) { factor = whitept / Y; - /*I = (0.596 * red[i][j] - 0.275 * green[i][j] - 0.321 * blue[i][j]); - Q = (0.212 * red[i][j] - 0.523 * green[i][j] + 0.311 * blue[i][j]); - - Y *= factor; - I *= factor;//max(0,min(1,(whitept-Y)/(whitept-clippt))); - Q *= factor;//max(0,min(1,(whitept-Y)/(whitept-clippt))); - - red[i][j] = Y + 0.956*I + 0.621*Q; - green[i][j] = Y - 0.272*I - 0.647*Q; - blue[i][j] = Y - 1.105*I + 1.702*Q;*/ - red[i][j] *= factor; green[i][j] *= factor; blue[i][j] *= factor; @@ -899,76 +1111,8 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b plistener->setProgress(1.00); } - //printf("ave wt=%f\n",sumwt/counts); - - - // diagnostic output - /*for (int i=0; i & hfsize, multi_array2D & hilite, int box ); From 257d4bf54ede968513c8872ca39cc850aa7b38f3 Mon Sep 17 00:00:00 2001 From: Desmis Date: Sat, 10 Oct 2015 08:56:55 +0200 Subject: [PATCH 55/71] Suppress 2 sliders and add hue-curve --- rtdata/languages/default | 6 ++- rtengine/ipretinex.cc | 41 +++++++++++++++- rtengine/procevents.h | 1 + rtengine/procparams.cc | 17 +++++++ rtengine/procparams.h | 1 + rtengine/rawimagesource.cc | 66 +++++++++++++++++++++++--- rtengine/rawimagesource.h | 2 +- rtengine/refreshmap.cc | 3 +- rtgui/paramsedited.cc | 6 +++ rtgui/paramsedited.h | 1 + rtgui/retinex.cc | 95 +++++++++++++++++++++++++++++++++++--- rtgui/retinex.h | 6 ++- 12 files changed, 226 insertions(+), 19 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 492c7ba56..8f3903770 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -656,6 +656,7 @@ HISTORY_MSG_423;Retinex - slope HISTORY_MSG_424;Retinex - HL threshold HISTORY_MSG_425;Retinex - HL control red HISTORY_MSG_426;Retinex - HL control GB +HISTORY_MSG_427;Retinex - Hue equalizer HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1564,6 +1565,9 @@ TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* TP_RETINEX_CURVEEDITOR_CD;L=f(L) TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts +TP_RETINEX_CONTEDIT_LH;Hue equalizer +TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Equalize strength in function of hue\nIf Reinex method='highlight' also acts on the chroma TP_RETINEX_GAIN;Gain TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram. TP_RETINEX_GAM;Gamma retinex @@ -1590,7 +1594,7 @@ TP_RETINEX_LABSPACE;L*a*b* TP_RETINEX_LOW;Low TP_RETINEX_MEDIAN;Transmission median filter TP_RETINEX_METHOD;Method -TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light\nHighLight: Try to remove magenta\nHighlight More: Try to remove magenta + RGB action. +TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light\nHighLight: Try to remove magenta TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. TP_RETINEX_NEIGHBOR;Neighboring pixels diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 0ebf3ee43..b74568a3d 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -204,7 +204,7 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const stddv = (float)sqrt(stddv); } -void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) +void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { if (deh.enabled) {//enabled StopWatch Stop1("MSR"); @@ -228,6 +228,25 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) float hig = ((float) deh.highl)/100.f; bool higplus = false ; + + FlatCurve* shcurve = NULL;//curve L=f(H) + bool lhutili = false; + + if (deh.enabled) { + shcurve = new FlatCurve(deh.lhcurve); + + if (!shcurve || shcurve->isIdentity()) { + if (shcurve) { + delete shcurve; + shcurve = NULL; + } + } + else { + lhutili = true; + } + } + + if(deh.retinexMethod == "highliplus") higplus = true; if (deh.retinexMethod == "uni") { @@ -442,6 +461,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e maxCD = -9999999.f; minCD = 9999999.f; + + + #ifdef _OPENMP #pragma omp parallel #endif @@ -465,7 +487,17 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e cdmin = cd; } float str = strength; - if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig; + if(lhutili) { // S=f(H) + { + float HH = exLuminance[i][j]; + float valparam; + if(useHsl || useHslLin) valparam = float((shcurve->getVal(HH) - 0.5f)); + else valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); + str *= (1.f + 2.f*valparam); + } + } + + // if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig; luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j]; } @@ -483,6 +515,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e Tsigma = stddv; Tmin = mintr; Tmax = maxtr; + + if (shcurve) { + delete shcurve; + } + } } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 6b4a762af..04847c3fa 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -453,6 +453,7 @@ enum ProcEvent { EvLhighl = 423, EvLhighlig = 424, EvLgrbl = 425, + EvRetinexlhcurve = 426, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 3ae96dca7..dee75f5c4 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -160,6 +160,9 @@ void RetinexParams::setDefaults() cdcurve.push_back(DCT_Linear); cdHcurve.clear(); cdHcurve.push_back(DCT_Linear); + lhcurve.clear(); + lhcurve.push_back(DCT_Linear); + getDefaulttransmissionCurve(transmissionCurve); } @@ -1513,6 +1516,11 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_double_list("Retinex", "CDHCurve", cdHcurve); } + if (!pedited || pedited->retinex.lhcurve) { + Glib::ArrayHandle lhcurve = retinex.lhcurve; + keyFile.set_double_list("Retinex", "LHCurve", lhcurve); + } + if (!pedited || pedited->retinex.transmissionCurve) { Glib::ArrayHandle transmissionCurve = retinex.transmissionCurve; keyFile.set_double_list("Retinex", "TransmissionCurve", transmissionCurve); @@ -3931,6 +3939,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } + if (keyFile.has_key ("Retinex", "LHCurve")) { + retinex.lhcurve = keyFile.get_double_list ("Retinex", "LHCurve"); + + if (pedited) { + pedited->retinex.lhcurve = true; + } + } + if (keyFile.has_key ("Retinex", "TransmissionCurve")) { retinex.transmissionCurve = keyFile.get_double_list ("Retinex", "TransmissionCurve"); @@ -7302,6 +7318,7 @@ bool ProcParams::operator== (const ProcParams& other) && toneCurve.method == other.toneCurve.method && retinex.cdcurve == other.retinex.cdcurve && retinex.cdHcurve == other.retinex.cdHcurve + && retinex.lhcurve == other.retinex.lhcurve && retinex.transmissionCurve == other.retinex.transmissionCurve && retinex.str == other.retinex.str && retinex.scal == other.retinex.scal diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 8d70dfc5b..7c5172a83 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -271,6 +271,7 @@ public: bool enabled; std::vector cdcurve; std::vector cdHcurve; + std::vector lhcurve; std::vector transmissionCurve; int str; int scal; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index d965c12d7..607f0621c 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1861,7 +1861,7 @@ gg=green[380][1630]; bb=blue[380][1630]; printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb); */ - +/* if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult ! float hig = ((float)retinexParams.highlig)/100.f; float higgb = ((float)retinexParams.grbl)/100.f; @@ -1878,12 +1878,12 @@ if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") { //empirical method to find highlight magenta with no conversion RGB and no white balance //red = master Gr and Bl default higgb=0.5 - if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_; - else conversionBuffer[3][i - border][j - border] = 0.f; + // if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_; + // else conversionBuffer[3][i - border][j - border] = 0.f; } } } - +*/ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma #ifdef _OPENMP #pragma omp parallel for @@ -1936,6 +1936,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma _mm_storeu_ps(&conversionBuffer[1][i - border][j - border], S); L *= c32768; _mm_storeu_ps(&conversionBuffer[2][i - border][j - border], L); + _mm_storeu_ps(&conversionBuffer[3][i - border][j - border], H); if(lhist16RETI) { for(int p = 0; p < 4; p++) { @@ -2018,6 +2019,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma conversionBuffer[0][i - border][j - border] = aa; conversionBuffer[1][i - border][j - border] = bb; conversionBuffer[2][i - border][j - border] = L; + conversionBuffer[3][i - border][j - border] = xatan2f(bb,aa); // if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_; // else conversionBuffer[3][i - border][j - border] = 0.f; if(lhist16RETI) { @@ -2118,6 +2120,25 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC dLcurve.clear(); } + FlatCurve* chcurve = NULL;//curve c=f(H) + bool chutili = false; + + if (deh.enabled && deh.retinexMethod == "highli") { + chcurve = new FlatCurve(deh.lhcurve); + + if (!chcurve || chcurve->isIdentity()) { + if (chcurve) { + delete chcurve; + chcurve = NULL; + } + } + else { + chutili = true; + } + } + + + #ifdef _OPENMP #pragma omp parallel #endif @@ -2174,10 +2195,30 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC histLRETI[hi] += hist16RET[i]; } } - MSR(LBuffer, conversionBuffer[2], conversionBuffer[3], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); if(useHsl) { + if(chutili) { +#ifdef _OPENMP + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { + int j = border; + for (; j < W - border; j++) { + + float valp; + float chr; + // if(chutili) { // c=f(H) + { + valp = float((chcurve->getVal(conversionBuffer[3][i - border][j - border]) - 0.5f)); + + conversionBuffer[1][i - border][j - border] *= (1.f + 2.f*valp); + } + // } + + } + } + } #ifdef _OPENMP #pragma omp parallel for #endif @@ -2223,6 +2264,14 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC float Chprov1 = sqrt(SQR(conversionBuffer[0][i - border][j - border]) + SQR(conversionBuffer[1][i - border][j - border])) / 327.68f; float HH = xatan2f(conversionBuffer[1][i - border][j - border], conversionBuffer[0][i - border][j - border]); float2 sincosval; + float valp; + float chr; + if(chutili) { // c=f(H) + { + valp = float((chcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); + Chprov1 *= (1.f + 2.f*valp); + } + } sincosval = xsincosf(HH); float R,G,B; @@ -2242,7 +2291,8 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x; LBuffer[i - border][j - border] = Lprov1 * 327.68f; } - } + } + //end gamut control #ifdef __SSE2__ vfloat wipv[3][3]; @@ -2286,6 +2336,10 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC } } } + if (chcurve) { + delete chcurve; + } + if(deh.gammaretinex != "none" && deh.str !=0){//inverse gamma #ifdef _OPENMP #pragma omp parallel for diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 10e17743f..17f17ebbb 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -230,7 +230,7 @@ public: void boxblur2(float** src, float** dst, int H, int W, int box ); void boxblur_resamp(float **src, float **dst, int H, int W, int box, int samp ); - void MSR(float** luminance, float **originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); + void MSR(float** luminance, float **originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax); // void MSR(LabImage* lab, int width, int height, int skip, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve); //void boxblur_resamp(float **red, float **green, float **blue, int H, int W, float thresh[3], float max[3], diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index f648f5b4c..82889c1a0 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -452,6 +452,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DEMOSAIC, // EvLslope ALLNORAW, // EvLhighl DEMOSAIC, // EvLhighlig - DEMOSAIC // EvLgrbl + DEMOSAIC, // EvLgrbl + DEMOSAIC // EvRetinexlhcurve }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 9c5dfbabc..b53050b30 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -51,6 +51,7 @@ void ParamsEdited::set (bool v) toneCurve.method = v; retinex.cdcurve = v; retinex.cdHcurve = v; + retinex.lhcurve = v; retinex.retinexMethod = v; retinex.retinexcolorspace = v; retinex.gammaretinex = v; @@ -527,6 +528,7 @@ void ParamsEdited::initFrom (const std::vector toneCurve.method = toneCurve.method && p.toneCurve.method == other.toneCurve.method; retinex.cdcurve = retinex.cdcurve && p.retinex.cdcurve == other.retinex.cdcurve; retinex.cdHcurve = retinex.cdHcurve && p.retinex.cdHcurve == other.retinex.cdHcurve; + retinex.lhcurve = retinex.lhcurve && p.retinex.lhcurve == other.retinex.lhcurve; retinex.transmissionCurve = retinex.transmissionCurve && p.retinex.transmissionCurve == other.retinex.transmissionCurve; retinex.retinexMethod = retinex.retinexMethod && p.retinex.retinexMethod == other.retinex.retinexMethod; retinex.retinexcolorspace = retinex.retinexcolorspace && p.retinex.retinexcolorspace == other.retinex.retinexcolorspace; @@ -1048,6 +1050,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.retinex.cdHcurve = mods.retinex.cdHcurve; } + if (retinex.lhcurve) { + toEdit.retinex.lhcurve = mods.retinex.lhcurve; + } + if (retinex.transmissionCurve) { toEdit.retinex.transmissionCurve = mods.retinex.transmissionCurve; } diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 16c4ed9f2..98c5d22ac 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -78,6 +78,7 @@ public: bool transmissionCurve; bool cdcurve; bool cdHcurve; + bool lhcurve; bool retinex; bool medianmap; bool isUnchanged() const; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index c6aaf8702..10e15d16b 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -37,7 +37,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexMethod->append_text (M("TP_RETINEX_UNIFORM")); retinexMethod->append_text (M("TP_RETINEX_HIGH")); retinexMethod->append_text (M("TP_RETINEX_HIGHLIG")); - retinexMethod->append_text (M("TP_RETINEX_HIGHLIGPLUS")); +// retinexMethod->append_text (M("TP_RETINEX_HIGHLIGPLUS")); retinexMethod->set_active(0); retinexMethodConn = retinexMethod->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexMethodChanged) ); retinexMethod->set_tooltip_markup (M("TP_RETINEX_METHOD_TOOLTIP")); @@ -151,6 +151,27 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); highlig->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT2_TOOLTIP")); + curveEditorGH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LH")); + curveEditorGH->setCurveListener (this); + + lhshape = static_cast(curveEditorGH->addCurve(CT_Flat, M("TP_RETINEX_CURVEEDITOR_LH"))); + lhshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_LH_TOOLTIP")); + lhshape->setCurveColorProvider(this, 4); + // lhshape->setEditID(EUID_Lab_LHCurve, BT_SINGLEPLANE_FLOAT); + + milestones.clear(); + + for (int i = 0; i < 7; i++) { + float R, G, B; + float x = float(i) * (1.0f / 6.0); + Color::hsv2rgb01(x, 0.5f, 0.5f, R, G, B); + milestones.push_back( GradientMilestone(double(x), double(R), double(G), double(B)) ); + } + + lhshape->setBottomBarBgGradient(milestones); + + curveEditorGH->curveListComplete(); + medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN"))); medianmap->set_active (true); medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Retinex::medianmapChanged) ); @@ -167,6 +188,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*curveEditorGDH, Gtk::PACK_SHRINK, 4); curveEditorGDH->show(); + settingsVBox->pack_start (*curveEditorGH, Gtk::PACK_SHRINK, 4); + curveEditorGH->show(); + gambox->pack_start(*gammaretinex); settingsVBox->pack_start(*gambox); @@ -299,6 +323,7 @@ Retinex::~Retinex() delete curveEditorGD; delete curveEditorGDH; delete transmissionCurveEditorG; + delete curveEditorGH; } @@ -437,6 +462,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) cdshape->setUnChanged (!pedited->retinex.cdcurve); cdshapeH->setUnChanged (!pedited->retinex.cdHcurve); transmissionShape->setUnChanged (!pedited->retinex.transmissionCurve); + lhshape->setUnChanged (!pedited->retinex.lhcurve); } @@ -468,8 +494,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) retinexMethod->set_active (2); } else if (pp->retinex.retinexMethod == "highli") { retinexMethod->set_active (3); - } else if (pp->retinex.retinexMethod == "highliplus") { - retinexMethod->set_active (4); +// } else if (pp->retinex.retinexMethod == "highliplus") { +// retinexMethod->set_active (4); } if (pp->retinex.retinexcolorspace == "Lab") { @@ -502,6 +528,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) cdshape->setCurve (pp->retinex.cdcurve); cdshapeH->setCurve (pp->retinex.cdHcurve); + lhshape->setCurve (pp->retinex.lhcurve); retinexMethodConn.block(false); retinexColorSpaceConn.block(false); @@ -530,6 +557,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.highlig = (int)highlig->getValue (); pp->retinex.grbl = (int)grbl->getValue (); pp->retinex.cdcurve = cdshape->getCurve (); + pp->retinex.lhcurve = lhshape->getCurve (); pp->retinex.cdHcurve = cdshapeH->getCurve (); pp->retinex.transmissionCurve = transmissionShape->getCurve (); pp->retinex.enabled = getEnabled(); @@ -558,6 +586,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged (); pedited->retinex.enabled = !get_inconsistent(); pedited->retinex.medianmap = !medianmap->get_inconsistent(); + pedited->retinex.lhcurve = !lhshape->isUnChanged (); } @@ -569,8 +598,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.retinexMethod = "high"; } else if (retinexMethod->get_active_row_number() == 3) { pp->retinex.retinexMethod = "highli"; - } else if (retinexMethod->get_active_row_number() == 4) { - pp->retinex.retinexMethod = "highliplus"; +// } else if (retinexMethod->get_active_row_number() == 4) { +// pp->retinex.retinexMethod = "highliplus"; } if (retinexcolorspace->get_active_row_number() == 0) { @@ -597,8 +626,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) void Retinex::retinexMethodChanged() { - if (retinexMethod->get_active_row_number() == 4) {highl->show();highlig->show();grbl->show();} - else if(retinexMethod->get_active_row_number() == 3) {highl->show();highlig->hide();grbl->hide();} + // if (retinexMethod->get_active_row_number() == 4) {highl->show();highlig->show();grbl->show();} + if(retinexMethod->get_active_row_number() == 3) {highl->show();highlig->hide();grbl->hide();} else {highl->hide();highlig->hide();grbl->hide();} if (listener) { listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); @@ -608,6 +637,8 @@ void Retinex::retinexMethodChanged() void Retinex::ColorSpaceUpdateUI () { if (!batchMode) { + curveEditorGH->show(); + if(retinexcolorspace->get_active_row_number() == 0) { curveEditorGD->show(); curveEditorGDH->hide(); @@ -782,6 +813,7 @@ void Retinex::autoOpenCurve () cdshape->openIfNonlinear(); cdshapeH->openIfNonlinear(); transmissionShape->openIfNonlinear(); + lhshape->openIfNonlinear(); } @@ -795,6 +827,8 @@ void Retinex::curveChanged (CurveEditor* ce) listener->panelChanged (EvLCDHCurve, M("HISTORY_CUSTOMCURVE")); } else if (ce == transmissionShape) { listener->panelChanged (EvRetinextransmission, M("HISTORY_CUSTOMCURVE")); + } else if (ce == lhshape) { + listener->panelChanged (EvRetinexlhcurve, M("HISTORY_CUSTOMCURVE")); } } } @@ -837,6 +871,52 @@ void Retinex::updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histL cdshapeH->updateBackgroundHistogram (histLRETI); } +void Retinex::colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller *caller) +{ + + float R, G, B; + + if (elemType == ColorCaller::CCET_VERTICAL_BAR) { + valY = 0.5; + } + + if (callerId == 1) { // ch - main curve + + Color::hsv2rgb01(float(valX), float(valY), 0.5f, R, G, B); + } else if (callerId == 2) { // cc - bottom bar + + float value = (1.f - 0.7f) * float(valX) + 0.7f; + // whole hue range + // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) + Color::hsv2rgb01(float(valY), float(valX), value, R, G, B); + } else if (callerId == 3) { // lc - bottom bar + + float value = (1.f - 0.7f) * float(valX) + 0.7f; + + // whole hue range + // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) + Color::hsv2rgb01(float(valY), float(valX), value, R, G, B); + } else if (callerId == 4) { // LH - bottom bar + Color::hsv2rgb01(float(valX), 0.5f, float(valY), R, G, B); + } else if (callerId == 5) { // HH - bottom bar + float h = float((valY - 0.5) * 0.3 + valX); + + if (h > 1.0f) { + h -= 1.0f; + } else if (h < 0.0f) { + h += 1.0f; + } + + Color::hsv2rgb01(h, 0.5f, 0.5f, R, G, B); + } + + caller->ccRed = double(R); + caller->ccGreen = double(G); + caller->ccBlue = double(B); +} + + + void Retinex::setBatchMode (bool batchMode) { ToolPanel::setBatchMode (batchMode); @@ -855,6 +935,7 @@ void Retinex::setBatchMode (bool batchMode) curveEditorGD->setBatchMode (batchMode); curveEditorGDH->setBatchMode (batchMode); transmissionCurveEditorG->setBatchMode (batchMode); + curveEditorGH->setBatchMode (batchMode); } diff --git a/rtgui/retinex.h b/rtgui/retinex.h index b55a7940f..1e6118e66 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -14,13 +14,14 @@ #include "colorprovider.h" class Retinex : public ToolParamBlock, public FoldableToolPanel, public rtengine::RetinexListener, public CurveListener, - public AdjusterListener + public AdjusterListener, public ColorProvider { protected: CurveEditorGroup* curveEditorGD; CurveEditorGroup* curveEditorGDH; + CurveEditorGroup* curveEditorGH; Adjuster* str; Adjuster* scal; Adjuster* neigh; @@ -63,6 +64,7 @@ protected: sigc::connection retinexColorSpaceConn; sigc::connection gammaretinexConn; FlatCurveEditor* transmissionShape; + FlatCurveEditor* lhshape; bool lastmedianmap; sigc::connection medianmapConn; @@ -93,6 +95,8 @@ public: void updateToolState (std::vector &tpOpen); void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd, bool gamAdd, bool slopeAdd); void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); + + virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); private: void foldAllButMe (GdkEventButton* event, MyExpander *expander); From 6eaf68e8500efd1672508c1026490c6888c49692 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 11 Oct 2015 19:17:09 +0200 Subject: [PATCH 56/71] Improved quality of Colour Propagation for some cases --- rtengine/hilite_recon.cc | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 46c666c80..0c8b40fd9 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -421,11 +421,46 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b { { 1, 1, 1 }, { 1, -1, 1 }, { 1, 1, -1 } } }; + + for(int c=0;c<3;c++) + printf("chmax[%d] : %f\tclmax[%d] : %f\tratio[%d] : %f\n",c,chmax[c],c,clmax[c],c,chmax[c]/clmax[c]); + + float factor[3]; + for(int i=0;i<3;i++) + factor[i] = chmax[i]/clmax[i]; + + float minFactor = min(factor[0],factor[1],factor[2]); + if(minFactor > 1.f) { // all 3 channels clipped + // calculate clip factor per channel + for(int c=0;c<3;c++) + factor[c] /= minFactor; + // get max clip factor + int maxpos = 0; + float maxValNew = 0.f; + for(int c=0;c<3;c++) + if(chmax[c]/factor[c] > maxValNew) { + maxValNew = chmax[c]/factor[c]; + maxpos = c; + } + float clipFactor = (clmax[maxpos]) / maxValNew; + if(clipFactor < maxpct) + // if max clipfactor < clippct (0.95) adjust per channel factors + for(int c=0;c<3;c++) { + factor[c] *= (maxpct / clipFactor); + } + } else { + factor[0] = factor[1] = factor[2] = 1.f; + } + + for(int c=0;c<3;c++) { + printf("correction factor [%d] : %f\n",c,factor[c]); + } + float max_f[3], thresh[3]; for (int c = 0; c < 3; c++) { - thresh[c] = chmax[c] * threshpct; - max_f[c] = chmax[c] * maxpct; //min(chmax[0],chmax[1],chmax[2])*maxpct; + thresh[c] = chmax[c] * threshpct / factor[c]; + max_f[c] = chmax[c] * maxpct / factor[c]; } float whitept = max(max_f[0], max_f[1], max_f[2]); From 33182f743cfa80066be24edcb2284f65b29e4cb3 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 12 Oct 2015 17:57:38 +0200 Subject: [PATCH 57/71] sometimes getimage is not called after demosaic, fixes #2932 --- rtengine/improccoordinator.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index fa1fae502..933373920 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -220,13 +220,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } imgsrc->demosaic( rp ); + // if a demosaic happened we should also call getimage later, so we need to set the M_INIT flag + todo |= M_INIT; if (highDetailNeeded) { highDetailRawComputed = true; - - if (params.toneCurve.hrenabled && params.toneCurve.method == "Color") { - todo |= M_INIT; - } } else { highDetailRawComputed = false; } From 9061b2549d4a43f4d7aa51567b54d18c9da4f2ad Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 13 Oct 2015 14:36:19 +0200 Subject: [PATCH 58/71] Fix inconsistent behaviour in Colour Propagation --- rtengine/hilite_recon.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index 0c8b40fd9..c35eb9f63 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -467,6 +467,10 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b float clippt = min(max_f[0], max_f[1], max_f[2]); float medpt = max_f[0] + max_f[1] + max_f[2] - whitept - clippt; float blendpt = blendthresh * clippt; + float medFactor[3]; + for(int c=0;c<3;c++) { + medFactor[c] = max(1.0f, max_f[c] / medpt) / (-blendpt); + } multi_array2D channelblur(width, height, 0, 48); array2D temp(width, height); // allocate temporary buffer @@ -1023,9 +1027,9 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b FOREACHCOLOR rgb[c] = cam[0][c] / ColorCount; // Copy converted pixel back - float rfrac = min(1.0f, max(1.0f, max_f[0] / medpt) * (pixel[0] - blendpt) / (hlmax[0] - blendpt)); - float gfrac = min(1.0f, max(1.0f, max_f[1] / medpt) * (pixel[1] - blendpt) / (hlmax[1] - blendpt)); - float bfrac = min(1.0f, max(1.0f, max_f[2] / medpt) * (pixel[2] - blendpt) / (hlmax[2] - blendpt)); + float rfrac = max(0.f,min(1.0f, medFactor[0] * (pixel[0] - blendpt))); + float gfrac = max(0.f,min(1.0f, medFactor[1] * (pixel[1] - blendpt))); + float bfrac = max(0.f,min(1.0f, medFactor[2] * (pixel[2] - blendpt))); if (pixel[0] > blendpt) { rgb_blend[0] = rfrac * rgb[0] + (1 - rfrac) * pixel[0]; From d669f2ff2ea787f86baa2f76f6c59805eafa199a Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 13 Oct 2015 14:49:37 +0200 Subject: [PATCH 59/71] change gamma and log --- rtdata/languages/default | 12 +++--- rtengine/ipretinex.cc | 13 ++++-- rtengine/procevents.h | 6 +-- rtengine/procparams.cc | 28 ++++++------- rtengine/procparams.h | 4 +- rtengine/rawimagesource.cc | 16 ++++++-- rtengine/refreshmap.cc | 4 +- rtgui/paramsedited.cc | 18 ++++----- rtgui/paramsedited.h | 4 +- rtgui/retinex.cc | 82 ++++++++++++++++++++------------------ rtgui/retinex.h | 2 +- 11 files changed, 103 insertions(+), 86 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 8f3903770..8bf439f58 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -654,9 +654,8 @@ HISTORY_MSG_421;Retinex - Gamma retinex HISTORY_MSG_422;Retinex - gamma HISTORY_MSG_423;Retinex - slope HISTORY_MSG_424;Retinex - HL threshold -HISTORY_MSG_425;Retinex - HL control red -HISTORY_MSG_426;Retinex - HL control GB -HISTORY_MSG_427;Retinex - Hue equalizer +HISTORY_MSG_425;Retinex - Log base +HISTORY_MSG_426;Retinex - Hue equalizer HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOTS;Snapshots @@ -1561,13 +1560,15 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. +TP_RETINEX_BASELOG;Logarithm base +TP_RETINEX_BASELOG_TOOLTIP;Change base logarithm\nLow values = near linear\nHigh values increase effect TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* TP_RETINEX_CURVEEDITOR_CD;L=f(L) TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts TP_RETINEX_CONTEDIT_LH;Hue equalizer TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) -TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Equalize strength in function of hue\nIf Reinex method='highlight' also acts on the chroma +TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Equalize strength in function of hue\nIf Retinex method='highlight' also acts on the chroma TP_RETINEX_GAIN;Gain TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram. TP_RETINEX_GAM;Gamma retinex @@ -1584,9 +1585,6 @@ TP_RETINEX_HIGHLIG;Highlight TP_RETINEX_HIGHLIGPLUS;Highlight More TP_RETINEX_HIGHLIGHT;Highlight threshold TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm\nNeeds probably to change settings (Neighboring pixels), and increase Raw White-point -TP_RETINEX_HIGHLIGHT2;Highlight control (red) -TP_RETINEX_HIGHLIGHT2_TOOLTIP;Acts on RGB channels to reduce magenta (red = master) -TP_RETINEX_HIGHLIGHT3;Highlight control (blue green) TP_RETINEX_HSLSPACE_LIN;HSL-Linear TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic TP_RETINEX_LABEL;Retinex diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index b74568a3d..aac78ab70 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -228,7 +228,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) float hig = ((float) deh.highl)/100.f; bool higplus = false ; - + float elogt; + float hl = deh.baselog; + if(hl >= 2.71828f) elogt = 2.71828f + SQR(SQR(hl - 2.71828f)); + else elogt = hl; + // printf("elo=%f\n",elogt); FlatCurve* shcurve = NULL;//curve L=f(H) bool lhutili = false; @@ -308,6 +312,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e vfloat pondv = F2V(pond); vfloat limMinv = F2V(ilimD); vfloat limMaxv = F2V(limD); + vfloat elogtv = F2V(elogt); #endif #ifdef _OPENMP @@ -316,7 +321,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e for (int i = 0; i < H_L; i++) { int j = 0; - + #ifdef __SSE2__ if(useHslLin) { @@ -325,7 +330,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } } else { for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )); + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )/xlogf(elogtv)); } } @@ -337,7 +342,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } } else { for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)); + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD))/log(elogt);// /logt ? } } } diff --git a/rtengine/procevents.h b/rtengine/procevents.h index 04847c3fa..4dbbad07c 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -451,9 +451,9 @@ enum ProcEvent { EvLgam = 421, EvLslope = 422, EvLhighl = 423, - EvLhighlig = 424, - EvLgrbl = 425, - EvRetinexlhcurve = 426, + EvLbaselog = 424, +// EvLgrbl = 425, + EvRetinexlhcurve = 425, NUMOFEVENTS }; } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index dee75f5c4..cda6e003e 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -150,8 +150,8 @@ void RetinexParams::setDefaults() vart = 125; limd = 8; highl = 10; - highlig = 100; - grbl = 50; + baselog = 2.71828; +// grbl = 50; retinexMethod = "high"; retinexcolorspace = "Lab"; gammaretinex = "none"; @@ -1486,13 +1486,13 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol keyFile.set_integer ("Retinex", "highl", retinex.highl); } - if (!pedited || pedited->retinex.highlig) { - keyFile.set_integer ("Retinex", "highlig", retinex.highlig); + if (!pedited || pedited->retinex.baselog) { + keyFile.set_double ("Retinex", "baselog", retinex.baselog); } - if (!pedited || pedited->retinex.grbl) { - keyFile.set_integer ("Retinex", "grbl", retinex.grbl); - } +// if (!pedited || pedited->retinex.grbl) { +// keyFile.set_integer ("Retinex", "grbl", retinex.grbl); +// } if (!pedited || pedited->retinex.retinexMethod) { keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod); @@ -3907,22 +3907,22 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } - if (keyFile.has_key ("Retinex", "highlig")) { - retinex.highlig = keyFile.get_integer ("Retinex", "highlig"); + if (keyFile.has_key ("Retinex", "baselog")) { + retinex.baselog = keyFile.get_double ("Retinex", "baselog"); if (pedited) { - pedited->retinex.highlig = true; + pedited->retinex.baselog = true; } } - if (keyFile.has_key ("Retinex", "grbl")) { +/* if (keyFile.has_key ("Retinex", "grbl")) { retinex.grbl = keyFile.get_integer ("Retinex", "grbl"); if (pedited) { pedited->retinex.grbl = true; } } - +*/ if (keyFile.has_key ("Retinex", "CDCurve")) { retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve"); @@ -7328,8 +7328,8 @@ bool ProcParams::operator== (const ProcParams& other) && retinex.gain == other.retinex.gain && retinex.limd == other.retinex.limd && retinex.highl == other.retinex.highl - && retinex.highlig == other.retinex.highlig - && retinex.grbl == other.retinex.grbl + && retinex.baselog == other.retinex.baselog +// && retinex.grbl == other.retinex.grbl && retinex.offs == other.retinex.offs && retinex.retinexMethod == other.retinex.retinexMethod && retinex.retinexcolorspace == other.retinex.retinexcolorspace diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 7c5172a83..d46fd4181 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -286,8 +286,8 @@ public: int vart; int limd; int highl; - int highlig; - int grbl; + double baselog; +// int grbl; bool medianmap; RetinexParams (); void setDefaults(); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 607f0621c..26e417dfc 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1829,6 +1829,8 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar double pwr = 1.0 / retinexParams.gam; double gamm = retinexParams.gam; double ts = retinexParams.slope; + double gamm2 = retinexParams.gam; + if(gamm2 < 1.) {pwr = 1./pwr; gamm = 1. / gamm;} int mode = 0, imax = 0; Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope @@ -1839,7 +1841,10 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar double add = g_a4; double mul = 1. + g_a4; double x; - x = Color::gammareti (val, gamm, start, ts, mul , add); + if(gamm2 < 1.) {start = g_a2; add = g_a4; + x = Color::igammareti (val, gamm, start, ts, mul , add);} + else + x = Color::gammareti (val, gamm, start, ts, mul , add); lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values } @@ -2084,9 +2089,11 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; double pwr = 1.0 / deh.gam; double gamm = deh.gam; + double gamm2 = gamm; double ts = deh.slope; int mode = 0, imax = 0; - + if(gamm2 < 1.) {pwr = 1./pwr; gamm = 1. / gamm;} + Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); for (int i = 0; i < 65536; i++) { @@ -2095,7 +2102,10 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC double mul = 1. + g_a4; double add = g_a4; double start = g_a2; - x = Color::igammareti (val, gamm, start, ts, mul , add); + if(gamm2 < 1.) {start = g_a3; add = g_a3; + x = Color::gammareti (val, gamm, start, ts, mul , add);} + else + x = Color::igammareti (val, gamm, start, ts, mul , add); lutToneireti[i] = CLIP(x * 65535.); } diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index 82889c1a0..4180fd67a 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -451,8 +451,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DEMOSAIC, // EvLgam DEMOSAIC, // EvLslope ALLNORAW, // EvLhighl - DEMOSAIC, // EvLhighlig - DEMOSAIC, // EvLgrbl + DEMOSAIC, // EvLbaselog +// DEMOSAIC, // EvLgrbl DEMOSAIC // EvRetinexlhcurve }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index b53050b30..81cf57736 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -66,8 +66,8 @@ void ParamsEdited::set (bool v) retinex.vart = v; retinex.limd = v; retinex.highl = v; - retinex.highlig = v; - retinex.grbl = v; + retinex.baselog = v; +// retinex.grbl = v; retinex.medianmap = v; retinex.transmissionCurve = v; retinex.retinex = v; @@ -543,8 +543,8 @@ void ParamsEdited::initFrom (const std::vector retinex.vart = retinex.vart && p.retinex.vart == other.retinex.vart; retinex.limd = retinex.limd && p.retinex.limd == other.retinex.limd; retinex.highl = retinex.highl && p.retinex.highl == other.retinex.highl; - retinex.highlig = retinex.highlig && p.retinex.highlig == other.retinex.highlig; - retinex.grbl = retinex.grbl && p.retinex.grbl == other.retinex.grbl; + retinex.baselog = retinex.baselog && p.retinex.baselog == other.retinex.baselog; +// retinex.grbl = retinex.grbl && p.retinex.grbl == other.retinex.grbl; retinex.medianmap = retinex.medianmap && p.retinex.medianmap == other.retinex.medianmap; retinex.enabled = retinex.enabled && p.retinex.enabled == other.retinex.enabled; labCurve.lcurve = labCurve.lcurve && p.labCurve.lcurve == other.labCurve.lcurve; @@ -1102,13 +1102,13 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.retinex.highl = mods.retinex.highl; } - if (retinex.highlig) { - toEdit.retinex.highlig = mods.retinex.highlig; + if (retinex.baselog) { + toEdit.retinex.baselog = mods.retinex.baselog; } - if (retinex.grbl) { - toEdit.retinex.grbl = mods.retinex.grbl; - } +// if (retinex.grbl) { +// toEdit.retinex.grbl = mods.retinex.grbl; +// } if (retinex.gain) { toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_RETI_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain; diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 98c5d22ac..3fa753013 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -72,8 +72,8 @@ public: bool vart; bool limd; bool highl; - bool highlig; - bool grbl; + bool baselog; +// bool grbl; bool method; bool transmissionCurve; bool cdcurve; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 10e15d16b..04b7aebd6 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -112,8 +112,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), gammaretinexConn = gammaretinex->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::gammaretinexChanged) ); gammaretinex->set_tooltip_markup (M("TP_RETINEX_GAMMA_TOOLTIP")); - gam = Gtk::manage (new Adjuster (M("TP_RETINEX_GAMMA"), 0.6, 1.6, 0.01, 1.30)); - slope = Gtk::manage (new Adjuster (M("TP_RETINEX_SLOPE"), 2., 20., 0.1, 3.)); + gam = Gtk::manage (new Adjuster (M("TP_RETINEX_GAMMA"), 0.6, 3.0, 0.01, 1.30)); + slope = Gtk::manage (new Adjuster (M("TP_RETINEX_SLOPE"), 1., 20., 0.1, 3.)); str = Gtk::manage (new Adjuster (M("TP_RETINEX_STRENGTH"), 0, 100., 1., 20.)); neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); @@ -143,13 +143,13 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -10000, 10000, 1, 0)); vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125)); limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8)); - highlig = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT2"), 1, 100, 1, 100)); - grbl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT3"), 1, 100, 1, 50)); + baselog = Gtk::manage (new Adjuster (M("TP_RETINEX_BASELOG"), 1.1, 100., 0.001, 2.718)); +// grbl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT3"), 1, 100, 1, 50)); gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP")); scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP")); vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); - highlig->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT2_TOOLTIP")); + baselog->set_tooltip_markup (M("TP_RETINEX_BASELOG_TOOLTIP")); curveEditorGH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LH")); curveEditorGH->setCurveListener (this); @@ -221,11 +221,11 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), // settingsVBox->pack_start (*highl); // highl->show (); - settingsVBox->pack_start (*highlig); - highlig->show (); + settingsVBox->pack_start (*baselog); + baselog->show (); - settingsVBox->pack_start (*grbl); - grbl->show (); +// settingsVBox->pack_start (*grbl); +// grbl->show (); settingsVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); transmissionCurveEditorG->show(); @@ -295,18 +295,18 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), highl->delay = 200; } - highlig->setAdjusterListener (this); + baselog->setAdjusterListener (this); - if (highlig->delay < 200) { - highlig->delay = 200; + if (baselog->delay < 200) { + baselog->delay = 200; } - grbl->setAdjusterListener (this); +/* grbl->setAdjusterListener (this); if (grbl->delay < 200) { grbl->delay = 200; } - +*/ pack_start (*retinexVBox); pack_start (*expsettings); @@ -441,8 +441,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) vart->setEditedState (pedited->retinex.vart ? Edited : UnEdited); limd->setEditedState (pedited->retinex.limd ? Edited : UnEdited); highl->setEditedState (pedited->retinex.highl ? Edited : UnEdited); - highlig->setEditedState (pedited->retinex.highlig ? Edited : UnEdited); - grbl->setEditedState (pedited->retinex.grbl ? Edited : UnEdited); + baselog->setEditedState (pedited->retinex.baselog ? Edited : UnEdited); +// grbl->setEditedState (pedited->retinex.grbl ? Edited : UnEdited); set_inconsistent (multiImage && !pedited->retinex.enabled); medianmap->set_inconsistent (!pedited->retinex.medianmap); @@ -476,8 +476,8 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) gam->setValue (pp->retinex.gam); slope->setValue (pp->retinex.slope); highl->setValue (pp->retinex.highl); - highlig->setValue (pp->retinex.highlig); - grbl->setValue (pp->retinex.grbl); + baselog->setValue (pp->retinex.baselog); +// grbl->setValue (pp->retinex.grbl); setEnabled (pp->retinex.enabled); @@ -554,8 +554,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pp->retinex.vart = (int)vart->getValue (); pp->retinex.limd = (int)limd->getValue (); pp->retinex.highl = (int)highl->getValue (); - pp->retinex.highlig = (int)highlig->getValue (); - pp->retinex.grbl = (int)grbl->getValue (); + pp->retinex.baselog = baselog->getValue (); +// pp->retinex.grbl = (int)grbl->getValue (); pp->retinex.cdcurve = cdshape->getCurve (); pp->retinex.lhcurve = lhshape->getCurve (); pp->retinex.cdHcurve = cdshapeH->getCurve (); @@ -579,8 +579,8 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) pedited->retinex.vart = vart->getEditedState (); pedited->retinex.limd = limd->getEditedState (); pedited->retinex.highl = highl->getEditedState (); - pedited->retinex.highlig = highlig->getEditedState (); - pedited->retinex.grbl = grbl->getEditedState (); + pedited->retinex.baselog = baselog->getEditedState (); +// pedited->retinex.grbl = grbl->getEditedState (); pedited->retinex.cdcurve = !cdshape->isUnChanged (); pedited->retinex.cdHcurve = !cdshapeH->isUnChanged (); pedited->retinex.transmissionCurve = !transmissionShape->isUnChanged (); @@ -626,9 +626,10 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) void Retinex::retinexMethodChanged() { - // if (retinexMethod->get_active_row_number() == 4) {highl->show();highlig->show();grbl->show();} - if(retinexMethod->get_active_row_number() == 3) {highl->show();highlig->hide();grbl->hide();} - else {highl->hide();highlig->hide();grbl->hide();} + + if(retinexMethod->get_active_row_number() == 3) highl->show(); + else highl->hide(); + if (listener) { listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); } @@ -642,12 +643,15 @@ void Retinex::ColorSpaceUpdateUI () if(retinexcolorspace->get_active_row_number() == 0) { curveEditorGD->show(); curveEditorGDH->hide(); + baselog->show(); } else if(retinexcolorspace->get_active_row_number() == 1) { curveEditorGD->hide(); curveEditorGDH->show(); + baselog->show(); } else if(retinexcolorspace->get_active_row_number() == 2) { curveEditorGD->hide(); curveEditorGDH->show(); + baselog->hide(); } } } @@ -722,8 +726,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi vart->setDefault (defParams->retinex.vart); limd->setDefault (defParams->retinex.limd); highl->setDefault (defParams->retinex.highl); - highlig->setDefault (defParams->retinex.highlig); - grbl->setDefault (defParams->retinex.grbl); + baselog->setDefault (defParams->retinex.baselog); +// grbl->setDefault (defParams->retinex.grbl); gam->setDefault (defParams->retinex.gam); slope->setDefault (defParams->retinex.slope); @@ -736,8 +740,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi vart->setDefaultEditedState (pedited->retinex.vart ? Edited : UnEdited); limd->setDefaultEditedState (pedited->retinex.limd ? Edited : UnEdited); highl->setDefaultEditedState (pedited->retinex.highl ? Edited : UnEdited); - highlig->setDefaultEditedState (pedited->retinex.highlig ? Edited : UnEdited); - grbl->setDefaultEditedState (pedited->retinex.grbl ? Edited : UnEdited); + baselog->setDefaultEditedState (pedited->retinex.baselog ? Edited : UnEdited); +// grbl->setDefaultEditedState (pedited->retinex.grbl ? Edited : UnEdited); gam->setDefaultEditedState (pedited->retinex.gam ? Edited : UnEdited); slope->setDefaultEditedState (pedited->retinex.slope ? Edited : UnEdited); @@ -748,8 +752,8 @@ void Retinex::setDefaults (const ProcParams* defParams, const ParamsEdited* pedi vart->setDefaultEditedState (Irrelevant); limd->setDefaultEditedState (Irrelevant); highl->setDefaultEditedState (Irrelevant); - highlig->setDefaultEditedState (Irrelevant); - grbl->setDefaultEditedState (Irrelevant); + baselog->setDefaultEditedState (Irrelevant); +// grbl->setDefaultEditedState (Irrelevant); str->setDefaultEditedState (Irrelevant); scal->setDefaultEditedState (Irrelevant); gam->setDefaultEditedState (Irrelevant); @@ -794,10 +798,10 @@ void Retinex::adjusterChanged (Adjuster* a, double newval) listener->panelChanged (EvLlimd, limd->getTextValue()); } else if (a == highl) { listener->panelChanged (EvLhighl, highl->getTextValue()); - } else if (a == highlig) { - listener->panelChanged (EvLhighlig, highlig->getTextValue()); - } else if (a == grbl) { - listener->panelChanged (EvLgrbl, grbl->getTextValue()); + } else if (a == baselog) { + listener->panelChanged (EvLbaselog, baselog->getTextValue()); +// } else if (a == grbl) { +// listener->panelChanged (EvLgrbl, grbl->getTextValue()); } else if (a == gam) { listener->panelChanged (EvLgam, gam->getTextValue()); } else if (a == slope) { @@ -858,8 +862,8 @@ void Retinex::trimValues (rtengine::procparams::ProcParams* pp) vart->trimValue(pp->retinex.vart); limd->trimValue(pp->retinex.limd); highl->trimValue(pp->retinex.highl); - highlig->trimValue(pp->retinex.highlig); - grbl->trimValue(pp->retinex.grbl); + baselog->trimValue(pp->retinex.baselog); +// grbl->trimValue(pp->retinex.grbl); gam->trimValue(pp->retinex.gam); slope->trimValue(pp->retinex.slope); @@ -930,8 +934,8 @@ void Retinex::setBatchMode (bool batchMode) vart->showEditedCB (); limd->showEditedCB (); highl->showEditedCB (); - highlig->showEditedCB (); - grbl->showEditedCB (); + baselog->showEditedCB (); +// grbl->showEditedCB (); curveEditorGD->setBatchMode (batchMode); curveEditorGDH->setBatchMode (batchMode); transmissionCurveEditorG->setBatchMode (batchMode); diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 1e6118e66..1a56fb170 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -30,7 +30,7 @@ protected: Adjuster* vart; Adjuster* limd; Adjuster* highl; - Adjuster* highlig; + Adjuster* baselog; Adjuster* grbl; Adjuster* gam; Adjuster* slope; From 604020e1e24fb5b282ca4d3d3c1db8aeecb3f17c Mon Sep 17 00:00:00 2001 From: Desmis Date: Tue, 13 Oct 2015 17:07:17 +0200 Subject: [PATCH 60/71] best transition between method high and highlight --- rtengine/ipretinex.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index aac78ab70..aa89ef639 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -263,8 +263,10 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e if (deh.retinexMethod == "highli" || deh.retinexMethod == "highliplus") { moderetinex = 3; } - - float high = 0.6f*(float) deh.highl;//reduce sensibility + float aahi = 49.f/99.f;////reduce sensibility 50% + float bbhi = 1.f - aahi; + float high; + high = bbhi + aahi*(float) deh.highl; retinex_scales( RetinexScales, scal, moderetinex, nei, high ); int H_L = height; From 17eca17e61924e551b6bb433f23b9474b8059356 Mon Sep 17 00:00:00 2001 From: Marcin Bajor Date: Wed, 14 Oct 2015 10:43:33 +0200 Subject: [PATCH 61/71] Fix for build with sigc++ >= 2.5.2 --- rtgui/adjuster.cc | 2 +- rtgui/preferences.cc | 2 +- rtgui/thresholdadjuster.cc | 2 +- rtgui/tonecurve.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index bbd6e76cf..f0e53fbbf 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -17,7 +17,7 @@ * along with RawTherapee. If not, see . */ #include "adjuster.h" -#include +#include #include #include "multilangmgr.h" #include "../rtengine/rtengine.h" diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 9c0918189..141ad35d3 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -16,7 +16,7 @@ * You should have received a copy of the GNU General Public License * along with RawTherapee. If not, see . */ -#include +#include #include "preferences.h" #include "multilangmgr.h" #include "splash.h" diff --git a/rtgui/thresholdadjuster.cc b/rtgui/thresholdadjuster.cc index a7e21a26d..800f6edf5 100644 --- a/rtgui/thresholdadjuster.cc +++ b/rtgui/thresholdadjuster.cc @@ -17,7 +17,7 @@ * along with RawTherapee. If not, see . */ #include "thresholdadjuster.h" -#include +#include #include #include "multilangmgr.h" #include "../rtengine/rtengine.h" diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 770652430..799513c2a 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -18,7 +18,7 @@ */ #include "tonecurve.h" #include "adjuster.h" -#include +#include #include #include "ppversion.h" #include "edit.h" From c6620b415db72cbdf8833476a21af5190e15fa22 Mon Sep 17 00:00:00 2001 From: Marcin Bajor Date: Wed, 14 Oct 2015 10:51:27 +0200 Subject: [PATCH 62/71] Fix for build with C++11 flags --- rtengine/dcraw.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index add5b525d..8e0a36df2 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -136,10 +136,10 @@ const float d65_white[3] = { 0.950456, 1, 1.088754 }; #define SQR(x) rtengine::SQR(x) #define ABS(x) (((int)(x) ^ ((int)(x) >> 31)) - ((int)(x) >> 31)) -#define MIN(a,b) rtengine::min(a,static_cast(b)) -#define MAX(a,b) rtengine::max(a,static_cast(b)) -#define LIM(x,min,max) rtengine::LIM(x,static_cast(min),static_cast(max)) -#define ULIM(x,y,z) rtengine::ULIM(x,static_cast(y),static_cast(z)) +#define MIN(a,b) rtengine::min(a,static_cast<__typeof__(a)>(b)) +#define MAX(a,b) rtengine::max(a,static_cast<__typeof__(a)>(b)) +#define LIM(x,min,max) rtengine::LIM(x,static_cast<__typeof__(x)>(min),static_cast<__typeof__(x)>(max)) +#define ULIM(x,y,z) rtengine::ULIM(x,static_cast<__typeof__(x)>(y),static_cast<__typeof__(x)>(z)) #define CLIP(x) rtengine::CLIP(x) #define SWAP(a,b) { a=a+b; b=a-b; a=a-b; } From aef0fc7ec8847b75650a86fd63b31bc0dc63ab49 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 14 Oct 2015 16:37:54 +0200 Subject: [PATCH 63/71] Updated dcraw.patch file --- rtengine/dcraw.patch | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rtengine/dcraw.patch b/rtengine/dcraw.patch index e1603864a..db24e7fe8 100644 --- a/rtengine/dcraw.patch +++ b/rtengine/dcraw.patch @@ -1,5 +1,5 @@ ---- dcraw.c 2015-08-15 15:35:27 +0000 -+++ dcraw.cc 2015-08-16 13:46:33 +0000 +--- dcraw.c 2015-09-21 10:08:04 +0000 ++++ dcraw.cc 2015-10-14 14:29:55 +0000 @@ -1,3 +1,15 @@ +/*RT*/#include +/*RT*/#include @@ -148,10 +148,10 @@ -#define LIM(x,min,max) MAX(min,MIN(x,max)) -#define ULIM(x,y,z) ((y) < (z) ? LIM(x,y,z) : LIM(x,z,y)) -#define CLIP(x) LIM(x,0,65535) -+#define MIN(a,b) rtengine::min(a,static_cast(b)) -+#define MAX(a,b) rtengine::max(a,static_cast(b)) -+#define LIM(x,min,max) rtengine::LIM(x,static_cast(min),static_cast(max)) -+#define ULIM(x,y,z) rtengine::ULIM(x,static_cast(y),static_cast(z)) ++#define MIN(a,b) rtengine::min(a,static_cast<__typeof__(a)>(b)) ++#define MAX(a,b) rtengine::max(a,static_cast<__typeof__(a)>(b)) ++#define LIM(x,min,max) rtengine::LIM(x,static_cast<__typeof__(x)>(min),static_cast<__typeof__(x)>(max)) ++#define ULIM(x,y,z) rtengine::ULIM(x,static_cast<__typeof__(x)>(y),static_cast<__typeof__(x)>(z)) +#define CLIP(x) rtengine::CLIP(x) #define SWAP(a,b) { a=a+b; b=a-b; a=a-b; } From a0dabf8067ef34fa5fedb0ef142bf82a28f11c89 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Wed, 14 Oct 2015 23:15:01 +0200 Subject: [PATCH 64/71] Colour Propagation, cleanup and a small speedup --- rtengine/hilite_recon.cc | 312 +++++++++++++++++++-------------------- 1 file changed, 156 insertions(+), 156 deletions(-) diff --git a/rtengine/hilite_recon.cc b/rtengine/hilite_recon.cc index c35eb9f63..9f618ace5 100644 --- a/rtengine/hilite_recon.cc +++ b/rtengine/hilite_recon.cc @@ -28,12 +28,11 @@ #include "rawimagesource.h" #include "rt_math.h" #include "opthelper.h" - -#define FOREACHCOLOR for (int c=0; c < ColorCount; c++) - namespace rtengine { +extern const Settings* settings; + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, float** temp, int H, int W, int box ) @@ -152,6 +151,7 @@ SSEFUNCTION void RawImageSource::boxblur2(float** src, float** dst, float** temp _mm_storeu_ps( &dst[row][col], tempv ); } } + for (int col = W - (W % 4); col < W; col++) { int len = box + 1; dst[0][col] = temp[0][col] / len; @@ -403,62 +403,70 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b static const int numdirs = 4; - static const float threshpct = 0.25; - static const float fixthreshpct = 0.7; - static const float maxpct = 0.95; - + static const float threshpct = 0.25f; + static const float fixthreshpct = 0.7f; + static const float maxpct = 0.95f; + static const float epsilon = 0.00001f; //%%%%%%%%%%%%%%%%%%%% //for blend algorithm: static const float blendthresh = 1.0; static const int ColorCount = 3; // Transform matrixes rgb>lab and back - static const float trans[2][ColorCount][ColorCount] = { - { { 1, 1, 1 }, { 1.7320508, -1.7320508, 0 }, { -1, -1, 2 } }, - { { 1, 1, 1 }, { 1, -1, 1 }, { 1, 1, -1 } } - }; - static const float itrans[2][ColorCount][ColorCount] = { - { { 1, 0.8660254, -0.5 }, { 1, -0.8660254, -0.5 }, { 1, 0, 1 } }, - { { 1, 1, 1 }, { 1, -1, 1 }, { 1, 1, -1 } } - }; + static const float trans[ColorCount][ColorCount] = + { { 1.f, 1.f, 1.f }, { 1.7320508f, -1.7320508f, 0.f }, { -1.f, -1.f, 2.f } }; + static const float itrans[ColorCount][ColorCount] = + { { 1.f, 0.8660254f, -0.5f }, { 1.f, -0.8660254f, -0.5f }, { 1.f, 0.f, 1.f } }; - - for(int c=0;c<3;c++) - printf("chmax[%d] : %f\tclmax[%d] : %f\tratio[%d] : %f\n",c,chmax[c],c,clmax[c],c,chmax[c]/clmax[c]); + if(settings->verbose) + for(int c = 0; c < 3; c++) { + printf("chmax[%d] : %f\tclmax[%d] : %f\tratio[%d] : %f\n", c, chmax[c], c, clmax[c], c, chmax[c] / clmax[c]); + } float factor[3]; - for(int i=0;i<3;i++) - factor[i] = chmax[i]/clmax[i]; - float minFactor = min(factor[0],factor[1],factor[2]); + for(int c = 0; c < ColorCount; c++) { + factor[c] = chmax[c] / clmax[c]; + } + + float minFactor = min(factor[0], factor[1], factor[2]); + if(minFactor > 1.f) { // all 3 channels clipped // calculate clip factor per channel - for(int c=0;c<3;c++) + for (int c = 0; c < ColorCount; c++) { factor[c] /= minFactor; + } + // get max clip factor int maxpos = 0; float maxValNew = 0.f; - for(int c=0;c<3;c++) - if(chmax[c]/factor[c] > maxValNew) { - maxValNew = chmax[c]/factor[c]; + + for (int c = 0; c < ColorCount; c++) { + if(chmax[c] / factor[c] > maxValNew) { + maxValNew = chmax[c] / factor[c]; maxpos = c; } - float clipFactor = (clmax[maxpos]) / maxValNew; + } + + float clipFactor = clmax[maxpos] / maxValNew; + if(clipFactor < maxpct) - // if max clipfactor < clippct (0.95) adjust per channel factors - for(int c=0;c<3;c++) { + + // if max clipFactor < maxpct (0.95) adjust per channel factors + for (int c = 0; c < ColorCount; c++) { factor[c] *= (maxpct / clipFactor); } } else { factor[0] = factor[1] = factor[2] = 1.f; } - for(int c=0;c<3;c++) { - printf("correction factor [%d] : %f\n",c,factor[c]); - } + if(settings->verbose) + for (int c = 0; c < ColorCount; c++) { + printf("correction factor[%d] : %f\n", c, factor[c]); + } float max_f[3], thresh[3]; - for (int c = 0; c < 3; c++) { + for (int c = 0; c < ColorCount; c++) { thresh[c] = chmax[c] * threshpct / factor[c]; max_f[c] = chmax[c] * maxpct / factor[c]; } @@ -468,7 +476,8 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b float medpt = max_f[0] + max_f[1] + max_f[2] - whitept - clippt; float blendpt = blendthresh * clippt; float medFactor[3]; - for(int c=0;c<3;c++) { + + for (int c = 0; c < ColorCount; c++) { medFactor[c] = max(1.0f, max_f[c] / medpt) / (-blendpt); } @@ -477,19 +486,22 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b // blur RGB channels - boxblur2(red , channelblur[0], temp, height, width, 4); + boxblur2(red, channelblur[0], temp, height, width, 4); + if(plistener) { progress += 0.05; plistener->setProgress(progress); } boxblur2(green, channelblur[1], temp, height, width, 4); + if(plistener) { progress += 0.05; plistener->setProgress(progress); } - boxblur2(blue , channelblur[2], temp, height, width, 4); + boxblur2(blue, channelblur[2], temp, height, width, 4); + if(plistener) { progress += 0.05; plistener->setProgress(progress); @@ -515,12 +527,12 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } multi_array2D hilite_full(width, height, ARRAY2D_CLEAR_DATA, 32); + if(plistener) { progress += 0.10; plistener->setProgress(progress); } - double hipass_sum = 0.f; int hipass_norm = 0; @@ -547,7 +559,8 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } }//end of filling highlight array - float hipass_ave = 2.f * hipass_sum / (hipass_norm + 0.01); + float hipass_ave = 2.f * hipass_sum / (hipass_norm + epsilon); + if(plistener) { progress += 0.05; plistener->setProgress(progress); @@ -577,7 +590,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b continue; } - if (hilite_full4[i][j] > 0.00001 && hilite_full4[i][j] < 0.95) { + if (hilite_full4[i][j] > epsilon && hilite_full4[i][j] < 0.95f) { //too near an edge, could risk using CA affected pixels, therefore omit hilite_full[0][i][j] = hilite_full[1][i][j] = hilite_full[2][i][j] = hilite_full[3][i][j] = 0.f; } @@ -616,49 +629,43 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b // for faster processing we create two buffers using (height,width) instead of (width,height) multi_array2D hilite_dir0(hfh, hfw, ARRAY2D_CLEAR_DATA, 64); multi_array2D hilite_dir4(hfh, hfw, ARRAY2D_CLEAR_DATA, 64); - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - if(plistener) { progress += 0.05; plistener->setProgress(progress); } - - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - - //fill gaps in highlight map by directional extension //raster scan from four corners for (int j = 1; j < hfw - 1; j++) { for (int i = 2; i < hfh - 2; i++) { //from left - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir0[3][j][i] = 1.f; } else { hilite_dir0[3][j][i] = (hilite_dir0[0 + 3][j - 1][i - 2] + hilite_dir0[0 + 3][j - 1][i - 1] + hilite_dir0[0 + 3][j - 1][i] + hilite_dir0[0 + 3][j - 1][i + 1] + hilite_dir0[0 + 3][j - 1][i + 2]) == 0.f ? 0.f : 0.1f; } } - if(hilite[3][2][j] <= 0.01) { + if(hilite[3][2][j] <= epsilon) { hilite_dir[0 + 3][0][j] = hilite_dir0[3][j][2]; } - if(hilite[3][3][j] <= 0.01) { + if(hilite[3][3][j] <= epsilon) { hilite_dir[0 + 3][1][j] = hilite_dir0[3][j][3]; } - if(hilite[3][hfh - 3][j] <= 0.01) { + if(hilite[3][hfh - 3][j] <= epsilon) { hilite_dir[4 + 3][hfh - 1][j] = hilite_dir0[3][j][hfh - 3]; } - if(hilite[3][hfh - 4][j] <= 0.01) { + if(hilite[3][hfh - 4][j] <= epsilon) { hilite_dir[4 + 3][hfh - 2][j] = hilite_dir0[3][j][hfh - 4]; } } for (int i = 2; i < hfh - 2; i++) { - if(hilite[3][i][hfw - 2] <= 0.01) { + if(hilite[3][i][hfw - 2] <= epsilon) { hilite_dir4[3][hfw - 1][i] = hilite_dir0[3][hfw - 2][i]; } } @@ -672,33 +679,33 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int j = 1; j < hfw - 1; j++) { for (int i = 2; i < hfh - 2; i++) { //from left - if (hilite[3][i][j] > 0.01f) { + if (hilite[3][i][j] > epsilon) { hilite_dir0[c][j][i] = hilite[c][i][j] / hilite[3][i][j]; } else { hilite_dir0[c][j][i] = 0.1f * ((hilite_dir0[0 + c][j - 1][i - 2] + hilite_dir0[0 + c][j - 1][i - 1] + hilite_dir0[0 + c][j - 1][i] + hilite_dir0[0 + c][j - 1][i + 1] + hilite_dir0[0 + c][j - 1][i + 2]) / - (hilite_dir0[0 + 3][j - 1][i - 2] + hilite_dir0[0 + 3][j - 1][i - 1] + hilite_dir0[0 + 3][j - 1][i] + hilite_dir0[0 + 3][j - 1][i + 1] + hilite_dir0[0 + 3][j - 1][i + 2] + 0.00001f)); + (hilite_dir0[0 + 3][j - 1][i - 2] + hilite_dir0[0 + 3][j - 1][i - 1] + hilite_dir0[0 + 3][j - 1][i] + hilite_dir0[0 + 3][j - 1][i + 1] + hilite_dir0[0 + 3][j - 1][i + 2] + epsilon)); } } - if(hilite[3][2][j] <= 0.01f) { + if(hilite[3][2][j] <= epsilon) { hilite_dir[0 + c][0][j] = hilite_dir0[c][j][2]; } - if(hilite[3][3][j] <= 0.01f) { + if(hilite[3][3][j] <= epsilon) { hilite_dir[0 + c][1][j] = hilite_dir0[c][j][3]; } - if(hilite[3][hfh - 3][j] <= 0.01f) { + if(hilite[3][hfh - 3][j] <= epsilon) { hilite_dir[4 + c][hfh - 1][j] = hilite_dir0[c][j][hfh - 3]; } - if(hilite[3][hfh - 4][j] <= 0.01f) { + if(hilite[3][hfh - 4][j] <= epsilon) { hilite_dir[4 + c][hfh - 2][j] = hilite_dir0[c][j][hfh - 4]; } } for (int i = 2; i < hfh - 2; i++) { - if(hilite[3][i][hfw - 2] <= 0.01f) { + if(hilite[3][i][hfw - 2] <= epsilon) { hilite_dir4[c][hfw - 1][i] = hilite_dir0[c][hfw - 2][i]; } } @@ -712,34 +719,34 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int j = hfw - 2; j > 0; j--) { for (int i = 2; i < hfh - 2; i++) { //from right - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir4[3][j][i] = 1.f; } else { hilite_dir4[3][j][i] = (hilite_dir4[3][(j + 1)][(i - 2)] + hilite_dir4[3][(j + 1)][(i - 1)] + hilite_dir4[3][(j + 1)][(i)] + hilite_dir4[3][(j + 1)][(i + 1)] + hilite_dir4[3][(j + 1)][(i + 2)]) == 0.f ? 0.f : 0.1f; } } - if(hilite[3][2][j] <= 0.01) { + if(hilite[3][2][j] <= epsilon) { hilite_dir[0 + 3][0][j] += hilite_dir4[3][j][2]; } - if(hilite[3][hfh - 3][j] <= 0.01) { + if(hilite[3][hfh - 3][j] <= epsilon) { hilite_dir[4 + 3][hfh - 1][j] += hilite_dir4[3][j][hfh - 3]; } } for (int i = 2; i < hfh - 2; i++) { - if(hilite[3][i][0] <= 0.01) { + if(hilite[3][i][0] <= epsilon) { hilite_dir[0 + 3][i - 2][0] += hilite_dir4[3][0][i]; hilite_dir[4 + 3][i + 2][0] += hilite_dir4[3][0][i]; } - if(hilite[3][i][1] <= 0.01) { + if(hilite[3][i][1] <= epsilon) { hilite_dir[0 + 3][i - 2][1] += hilite_dir4[3][1][i]; hilite_dir[4 + 3][i + 2][1] += hilite_dir4[3][1][i]; } - if(hilite[3][i][hfw - 2] <= 0.01) { + if(hilite[3][i][hfw - 2] <= epsilon) { hilite_dir[0 + 3][i - 2][hfw - 2] += hilite_dir4[3][hfw - 2][i]; hilite_dir[4 + 3][i + 2][hfw - 2] += hilite_dir4[3][hfw - 2][i]; } @@ -753,35 +760,35 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int j = hfw - 2; j > 0; j--) { for (int i = 2; i < hfh - 2; i++) { //from right - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir4[c][j][i] = hilite[c][i][j] / hilite[3][i][j]; } else { hilite_dir4[c][j][i] = 0.1 * ((hilite_dir4[c][(j + 1)][(i - 2)] + hilite_dir4[c][(j + 1)][(i - 1)] + hilite_dir4[c][(j + 1)][(i)] + hilite_dir4[c][(j + 1)][(i + 1)] + hilite_dir4[c][(j + 1)][(i + 2)]) / - (hilite_dir4[3][(j + 1)][(i - 2)] + hilite_dir4[3][(j + 1)][(i - 1)] + hilite_dir4[3][(j + 1)][(i)] + hilite_dir4[3][(j + 1)][(i + 1)] + hilite_dir4[3][(j + 1)][(i + 2)] + 0.00001)); + (hilite_dir4[3][(j + 1)][(i - 2)] + hilite_dir4[3][(j + 1)][(i - 1)] + hilite_dir4[3][(j + 1)][(i)] + hilite_dir4[3][(j + 1)][(i + 1)] + hilite_dir4[3][(j + 1)][(i + 2)] + epsilon)); } } - if(hilite[3][2][j] <= 0.01) { + if(hilite[3][2][j] <= epsilon) { hilite_dir[0 + c][0][j] += hilite_dir4[c][j][2]; } - if(hilite[3][hfh - 3][j] <= 0.01) { + if(hilite[3][hfh - 3][j] <= epsilon) { hilite_dir[4 + c][hfh - 1][j] += hilite_dir4[c][j][hfh - 3]; } } for (int i = 2; i < hfh - 2; i++) { - if(hilite[3][i][0] <= 0.01) { + if(hilite[3][i][0] <= epsilon) { hilite_dir[0 + c][i - 2][0] += hilite_dir4[c][0][i]; hilite_dir[4 + c][i + 2][0] += hilite_dir4[c][0][i]; } - if(hilite[3][i][1] <= 0.01) { + if(hilite[3][i][1] <= epsilon) { hilite_dir[0 + c][i - 2][1] += hilite_dir4[c][1][i]; hilite_dir[4 + c][i + 2][1] += hilite_dir4[c][1][i]; } - if(hilite[3][i][hfw - 2] <= 0.01) { + if(hilite[3][i][hfw - 2] <= epsilon) { hilite_dir[0 + c][i - 2][hfw - 2] += hilite_dir4[c][hfw - 2][i]; hilite_dir[4 + c][i + 2][hfw - 2] += hilite_dir4[c][hfw - 2][i]; } @@ -797,7 +804,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int i = 1; i < hfh - 1; i++) for (int j = 2; j < hfw - 2; j++) { //from top - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir[0 + 3][i][j] = 1.f; } else { hilite_dir[0 + 3][i][j] = (hilite_dir[0 + 3][i - 1][j - 2] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i - 1][j] + hilite_dir[0 + 3][i - 1][j + 1] + hilite_dir[0 + 3][i - 1][j + 2]) == 0.f ? 0.f : 0.1f; @@ -805,7 +812,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } for (int j = 2; j < hfw - 2; j++) { - if(hilite[3][hfh - 2][j] <= 0.01) { + if(hilite[3][hfh - 2][j] <= epsilon) { hilite_dir[4 + 3][hfh - 1][j] += hilite_dir[0 + 3][hfh - 2][j]; } } @@ -818,21 +825,20 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int i = 1; i < hfh - 1; i++) { for (int j = 2; j < hfw - 2; j++) { //from top - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir[0 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; } else { hilite_dir[0 + c][i][j] = 0.1 * ((hilite_dir[0 + c][i - 1][j - 2] + hilite_dir[0 + c][i - 1][j - 1] + hilite_dir[0 + c][i - 1][j] + hilite_dir[0 + c][i - 1][j + 1] + hilite_dir[0 + c][i - 1][j + 2]) / - (hilite_dir[0 + 3][i - 1][j - 2] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i - 1][j] + hilite_dir[0 + 3][i - 1][j + 1] + hilite_dir[0 + 3][i - 1][j + 2] + 0.00001)); + (hilite_dir[0 + 3][i - 1][j - 2] + hilite_dir[0 + 3][i - 1][j - 1] + hilite_dir[0 + 3][i - 1][j] + hilite_dir[0 + 3][i - 1][j + 1] + hilite_dir[0 + 3][i - 1][j + 2] + epsilon)); } } } for (int j = 2; j < hfw - 2; j++) { - if(hilite[3][hfh - 2][j] <= 0.01) { + if(hilite[3][hfh - 2][j] <= epsilon) { hilite_dir[4 + c][hfh - 1][j] += hilite_dir[0 + c][hfh - 2][j]; } } - } if(plistener) { @@ -843,7 +849,7 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int i = hfh - 2; i > 0; i--) for (int j = 2; j < hfw - 2; j++) { //from bottom - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir[4 + 3][i][j] = 1.f; } else { hilite_dir[4 + 3][i][j] = (hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)]) == 0.f ? 0.f : 0.1f; @@ -858,11 +864,11 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b for (int i = hfh - 2; i > 0; i--) { for (int j = 2; j < hfw - 2; j++) { //from bottom - if (hilite[3][i][j] > 0.01) { + if (hilite[3][i][j] > epsilon) { hilite_dir[4 + c][i][j] = hilite[c][i][j] / hilite[3][i][j]; } else { hilite_dir[4 + c][i][j] = 0.1 * ((hilite_dir[4 + c][(i + 1)][(j - 2)] + hilite_dir[4 + c][(i + 1)][(j - 1)] + hilite_dir[4 + c][(i + 1)][(j)] + hilite_dir[4 + c][(i + 1)][(j + 1)] + hilite_dir[4 + c][(i + 1)][(j + 2)]) / - (hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)] + 0.00001)); + (hilite_dir[4 + 3][(i + 1)][(j - 2)] + hilite_dir[4 + 3][(i + 1)][(j - 1)] + hilite_dir[4 + 3][(i + 1)][(j)] + hilite_dir[4 + 3][(i + 1)][(j + 1)] + hilite_dir[4 + 3][(i + 1)][(j + 2)] + epsilon)); } } } @@ -933,25 +939,18 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b hilite_dir4[c][hfw - 1][hfh - 1] = hilite_dir4[c][hfw - 1][hfh - 2] = hilite_dir4[c][hfw - 2][hfh - 1] = hilite_dir4[c][hfw - 2][hfh - 2] = hilite_dir4[c][hfw - 3][hfh - 3]; } - - if(plistener) { progress += 0.05; plistener->setProgress(progress); } - //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - // now reconstruct clipped channels using color ratios - + //free up some memory for(int c = 0; c < 4; c++) { hilite[c].free(); } - LUTf invfn(0x10000); - - for (int i = 0; i < 0x10000; i++) { - invfn[i] = 1.0 / (1.0 + i); - } + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + // now reconstruct clipped channels using color ratios #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) @@ -961,7 +960,6 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b int i1 = min((i - (i % pitch)) / pitch, hfh - 1); for (int j = 0; j < width; j++) { - int j1 = min((j - (j % pitch)) / pitch, hfw - 1); float pixel[3] = {red[i][j], green[i][j], blue[i][j]}; @@ -969,9 +967,9 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b continue; //pixel not clipped } - //%%%%%%%%%%%%%%%%%%%%%%% - //estimate recovered values using modified HLRecovery_blend algorithm + int j1 = min((j - (j % pitch)) / pitch, hfw - 1); + //estimate recovered values using modified HLRecovery_blend algorithm float rgb[ColorCount], rgb_blend[ColorCount] = {}, cam[2][ColorCount], lab[2][ColorCount], sum[2], chratio; // Copy input pixel to rgb so it's easier to access in loops @@ -980,23 +978,22 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b rgb[2] = pixel[2]; // Initialize cam with raw input [0] and potentially clipped input [1] - FOREACHCOLOR { + for (int c = 0; c < ColorCount; c++) { cam[0][c] = rgb[c]; cam[1][c] = min(cam[0][c], clippt); } // Calculate the lightness correction ratio (chratio) for (int i2 = 0; i2 < 2; i2++) { - FOREACHCOLOR { + for (int c = 0; c < ColorCount; c++) { lab[i2][c] = 0; - for (int j = 0; j < ColorCount; j++) - { - lab[i2][c] += trans[ColorCount - 3][c][j] * cam[i2][j]; + for (int j = 0; j < ColorCount; j++) { + lab[i2][c] += trans[c][j] * cam[i2][j]; } } - sum[i2] = 0; + sum[i2] = 0.f; for (int c = 1; c < ColorCount; c++) { sum[i2] += SQR(lab[i2][c]); @@ -1004,10 +1001,10 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } if(sum[0] == 0.f) { // avoid division by zero - sum[0] = 0.0001f; + sum[0] = epsilon; } - chratio = sqrt(sum[1] / sum[0]); + chratio = sqrtf(sum[1] / sum[0]); // Apply ratio to lightness in lab space @@ -1016,83 +1013,89 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b } // Transform back from lab to RGB - FOREACHCOLOR { + for (int c = 0; c < ColorCount; c++) { cam[0][c] = 0; - for (int j = 0; j < ColorCount; j++) - { - cam[0][c] += itrans[ColorCount - 3][c][j] * lab[0][j]; + for (int j = 0; j < ColorCount; j++) { + cam[0][c] += itrans[c][j] * lab[0][j]; } } - FOREACHCOLOR rgb[c] = cam[0][c] / ColorCount; + + for (int c = 0; c < ColorCount; c++) { + rgb[c] = cam[0][c] / ColorCount; + } // Copy converted pixel back - float rfrac = max(0.f,min(1.0f, medFactor[0] * (pixel[0] - blendpt))); - float gfrac = max(0.f,min(1.0f, medFactor[1] * (pixel[1] - blendpt))); - float bfrac = max(0.f,min(1.0f, medFactor[2] * (pixel[2] - blendpt))); + float rfrac = max(0.f, min(1.f, medFactor[0] * (pixel[0] - blendpt))); + float gfrac = max(0.f, min(1.f, medFactor[1] * (pixel[1] - blendpt))); + float bfrac = max(0.f, min(1.f, medFactor[2] * (pixel[2] - blendpt))); if (pixel[0] > blendpt) { - rgb_blend[0] = rfrac * rgb[0] + (1 - rfrac) * pixel[0]; + rgb_blend[0] = rfrac * rgb[0] + (1.f - rfrac) * pixel[0]; } if (pixel[1] > blendpt) { - rgb_blend[1] = gfrac * rgb[1] + (1 - gfrac) * pixel[1]; + rgb_blend[1] = gfrac * rgb[1] + (1.f - gfrac) * pixel[1]; } if (pixel[2] > blendpt) { - rgb_blend[2] = bfrac * rgb[2] + (1 - bfrac) * pixel[2]; + rgb_blend[2] = bfrac * rgb[2] + (1.f - bfrac) * pixel[2]; } //end of HLRecovery_blend estimation //%%%%%%%%%%%%%%%%%%%%%%% - //float pixref[3]={min(Yclip,hfsize[0][i1][j1]),min(Yclip,hfsize[1][i1][j1]),min(Yclip,hfsize[2][i1][j1])}; - //there are clipped highlights //first, determine weighted average of unclipped extensions (weighting is by 'hue' proximity) - float dirwt, factor; - float totwt = 0; //0.0003; - float clipfix[3] = {0, 0, 0}; //={totwt*rgb_blend[0],totwt*rgb_blend[1],totwt*rgb_blend[2]}; + float totwt = 0.f; + float clipfix[3] = {0.f, 0.f, 0.f}; - float Yhi = 0.001 + (hilite_dir0[0][j1][i1] + hilite_dir0[1][j1][i1] + hilite_dir0[2][j1][i1]); - float Y = 0.001 + (rgb_blend[0] + rgb_blend[1] + rgb_blend[2]); + float Y = epsilon + rgb_blend[0] + rgb_blend[1] + rgb_blend[2]; - if (hilite_dir0[0][j1][i1] + hilite_dir0[1][j1][i1] + hilite_dir0[2][j1][i1] > 0.5) { - dirwt = invfn[65535 * (SQR(rgb_blend[0] / Y - hilite_dir0[0][j1][i1] / Yhi) + - SQR(rgb_blend[1] / Y - hilite_dir0[1][j1][i1] / Yhi) + - SQR(rgb_blend[2] / Y - hilite_dir0[2][j1][i1] / Yhi))]; - totwt += dirwt; - clipfix[0] += dirwt * hilite_dir0[0][j1][i1] / (hilite_dir0[3][j1][i1] + 0.00001); - clipfix[1] += dirwt * hilite_dir0[1][j1][i1] / (hilite_dir0[3][j1][i1] + 0.00001); - clipfix[2] += dirwt * hilite_dir0[2][j1][i1] / (hilite_dir0[3][j1][i1] + 0.00001); + for (int c = 0; c < ColorCount; c++) { + rgb_blend[c] /= Y; + } + + float Yhi = 1.f / (hilite_dir0[0][j1][i1] + hilite_dir0[1][j1][i1] + hilite_dir0[2][j1][i1]); + + if (Yhi < 2.f) { + float dirwt = 1.f / (1.f + 65535.f * (SQR(rgb_blend[0] - hilite_dir0[0][j1][i1] * Yhi) + + SQR(rgb_blend[1] - hilite_dir0[1][j1][i1] * Yhi) + + SQR(rgb_blend[2] - hilite_dir0[2][j1][i1] * Yhi))); + totwt = dirwt; + dirwt /= (hilite_dir0[3][j1][i1] + epsilon); + clipfix[0] = dirwt * hilite_dir0[0][j1][i1]; + clipfix[1] = dirwt * hilite_dir0[1][j1][i1]; + clipfix[2] = dirwt * hilite_dir0[2][j1][i1]; } for (int dir = 0; dir < 2; dir++) { - float Yhi = 0.001 + (hilite_dir[dir * 4 + 0][i1][j1] + hilite_dir[dir * 4 + 1][i1][j1] + hilite_dir[dir * 4 + 2][i1][j1]); - float Y = 0.001 + (rgb_blend[0] + rgb_blend[1] + rgb_blend[2]); + float Yhi = 1.f / ( hilite_dir[dir * 4 + 0][i1][j1] + hilite_dir[dir * 4 + 1][i1][j1] + hilite_dir[dir * 4 + 2][i1][j1]); - if (hilite_dir[dir * 4 + 0][i1][j1] + hilite_dir[dir * 4 + 1][i1][j1] + hilite_dir[dir * 4 + 2][i1][j1] > 0.5) { - dirwt = invfn[65535 * (SQR(rgb_blend[0] / Y - hilite_dir[dir * 4 + 0][i1][j1] / Yhi) + - SQR(rgb_blend[1] / Y - hilite_dir[dir * 4 + 1][i1][j1] / Yhi) + - SQR(rgb_blend[2] / Y - hilite_dir[dir * 4 + 2][i1][j1] / Yhi))]; + if (Yhi < 2.f) { + float dirwt = 1.f / (1.f + 65535.f * (SQR(rgb_blend[0] - hilite_dir[dir * 4 + 0][i1][j1] * Yhi) + + SQR(rgb_blend[1] - hilite_dir[dir * 4 + 1][i1][j1] * Yhi) + + SQR(rgb_blend[2] - hilite_dir[dir * 4 + 2][i1][j1] * Yhi))); totwt += dirwt; - clipfix[0] += dirwt * hilite_dir[dir * 4 + 0][i1][j1] / (hilite_dir[dir * 4 + 3][i1][j1] + 0.00001); - clipfix[1] += dirwt * hilite_dir[dir * 4 + 1][i1][j1] / (hilite_dir[dir * 4 + 3][i1][j1] + 0.00001); - clipfix[2] += dirwt * hilite_dir[dir * 4 + 2][i1][j1] / (hilite_dir[dir * 4 + 3][i1][j1] + 0.00001); + dirwt /= (hilite_dir[dir * 4 + 3][i1][j1] + epsilon); + clipfix[0] += dirwt * hilite_dir[dir * 4 + 0][i1][j1]; + clipfix[1] += dirwt * hilite_dir[dir * 4 + 1][i1][j1]; + clipfix[2] += dirwt * hilite_dir[dir * 4 + 2][i1][j1]; } } - Yhi = 0.001 + (hilite_dir4[0][j1][i1] + hilite_dir4[1][j1][i1] + hilite_dir4[2][j1][i1]); - Y = 0.001 + (rgb_blend[0] + rgb_blend[1] + rgb_blend[2]); - if (hilite_dir4[0][j1][i1] + hilite_dir4[1][j1][i1] + hilite_dir4[2][j1][i1] > 0.5) { - dirwt = invfn[65535 * (SQR(rgb_blend[0] / Y - hilite_dir4[0][j1][i1] / Yhi) + - SQR(rgb_blend[1] / Y - hilite_dir4[1][j1][i1] / Yhi) + - SQR(rgb_blend[2] / Y - hilite_dir4[2][j1][i1] / Yhi))]; + Yhi = 1.f / (hilite_dir4[0][j1][i1] + hilite_dir4[1][j1][i1] + hilite_dir4[2][j1][i1]); + + if (Yhi < 2.f) { + float dirwt = 1.f / (1.f + 65535.f * (SQR(rgb_blend[0] - hilite_dir4[0][j1][i1] * Yhi) + + SQR(rgb_blend[1] - hilite_dir4[1][j1][i1] * Yhi) + + SQR(rgb_blend[2] - hilite_dir4[2][j1][i1] * Yhi))); totwt += dirwt; - clipfix[0] += dirwt * hilite_dir4[0][j1][i1] / (hilite_dir4[3][j1][i1] + 0.00001); - clipfix[1] += dirwt * hilite_dir4[1][j1][i1] / (hilite_dir4[3][j1][i1] + 0.00001); - clipfix[2] += dirwt * hilite_dir4[2][j1][i1] / (hilite_dir4[3][j1][i1] + 0.00001); + dirwt /= (hilite_dir4[3][j1][i1] + epsilon); + clipfix[0] += dirwt * hilite_dir4[0][j1][i1]; + clipfix[1] += dirwt * hilite_dir4[1][j1][i1]; + clipfix[2] += dirwt * hilite_dir4[2][j1][i1]; } if(totwt == 0.f) { @@ -1102,42 +1105,39 @@ void RawImageSource :: HLRecovery_inpaint (float** red, float** green, float** b clipfix[0] /= totwt; clipfix[1] /= totwt; clipfix[2] /= totwt; - //sumwt += totwt; - //counts ++; //now correct clipped channels if (pixel[0] > max_f[0] && pixel[1] > max_f[1] && pixel[2] > max_f[2]) { //all channels clipped float Y = (0.299 * clipfix[0] + 0.587 * clipfix[1] + 0.114 * clipfix[2]); - factor = whitept / Y; + float factor = whitept / Y; red[i][j] = clipfix[0] * factor; green[i][j] = clipfix[1] * factor; blue[i][j] = clipfix[2] * factor; } else {//some channels clipped - const float eps = 0.0001f; - int notclipped[3] = {pixel[0] < max_f[0] ? 1 : 0, pixel[1] < max_f[1] ? 1 : 0, pixel[2] < max_f[2] ? 1 : 0}; + float notclipped[3] = {pixel[0] <= max_f[0] ? 1.f : 0.f, pixel[1] <= max_f[1] ? 1.f : 0.f, pixel[2] <= max_f[2] ? 1.f : 0.f}; - if (notclipped[0] == 0) { //red clipped + if (notclipped[0] == 0.f) { //red clipped red[i][j] = max(red[i][j], (clipfix[0] * ((notclipped[1] * pixel[1] + notclipped[2] * pixel[2]) / - (notclipped[1] * clipfix[1] + notclipped[2] * clipfix[2] + eps)))); + (notclipped[1] * clipfix[1] + notclipped[2] * clipfix[2] + epsilon)))); } - if (notclipped[1] == 0) { //green clipped + if (notclipped[1] == 0.f) { //green clipped green[i][j] = max(green[i][j], (clipfix[1] * ((notclipped[2] * pixel[2] + notclipped[0] * pixel[0]) / - (notclipped[2] * clipfix[2] + notclipped[0] * clipfix[0] + eps)))); + (notclipped[2] * clipfix[2] + notclipped[0] * clipfix[0] + epsilon)))); } - if (notclipped[2] == 0) { //blue clipped + if (notclipped[2] == 0.f) { //blue clipped blue[i][j] = max(blue[i][j], (clipfix[2] * ((notclipped[0] * pixel[0] + notclipped[1] * pixel[1]) / - (notclipped[0] * clipfix[0] + notclipped[1] * clipfix[1] + eps)))); + (notclipped[0] * clipfix[0] + notclipped[1] * clipfix[1] + epsilon)))); } } Y = (0.299 * red[i][j] + 0.587 * green[i][j] + 0.114 * blue[i][j]); if (Y > whitept) { - factor = whitept / Y; + float factor = whitept / Y; red[i][j] *= factor; green[i][j] *= factor; From 678177bad998550370cba6a6573773b75eadb473 Mon Sep 17 00:00:00 2001 From: Desmis Date: Fri, 16 Oct 2015 11:56:18 +0200 Subject: [PATCH 65/71] simplification of the interface --- rtdata/languages/default | 7 +++-- rtengine/color.cc | 20 ++++++------ rtengine/ipretinex.cc | 5 +-- rtengine/procparams.cc | 2 +- rtgui/retinex.cc | 66 +++++++++++++++++++++++++++++++++------- rtgui/retinex.h | 6 +++- 6 files changed, 79 insertions(+), 27 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 8bf439f58..3666e9cb9 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1596,6 +1596,8 @@ TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\n TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. TP_RETINEX_NEIGHBOR;Neighboring pixels +TP_RETINEX_NEUTRAL;Reset +TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to default TP_RETINEX_NONE;None TP_RETINEX_OFFSET;Offset TP_RETINEX_SCALES;Scales @@ -1604,8 +1606,9 @@ TP_RETINEX_SETTINGS;Settings TP_RETINEX_STRENGTH;Strength TP_RETINEX_THRESHOLD;Threshold TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out - in = image source - out = image Gauss -TP_RETINEX_TLABEL;TR m=%1 M=%2 Me=%3 Si=%4 Tm=%5 TM=%6 -TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nm=Mini M=Maxi used by Variance.\nMe=Mean Si=Sigma\nTm=Min TM=Max of transmission map. +TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. TP_RETINEX_TRANSMISSION;Transmission map TP_RETINEX_TRANSMISSION_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction TP_RETINEX_UNIFORM;Uniform diff --git a/rtengine/color.cc b/rtengine/color.cc index 03a9bda93..13bad89db 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -1316,35 +1316,35 @@ void Color::calcGamma (double pwr, double ts, int mode, int imax, double &gamma0 { //from Dcraw (D.Coffin) int i; - double g[6], bnd[2] = {0, 0}; + double g[6], bnd[2] = {0., 0.}; g[0] = pwr; g[1] = ts; - g[2] = g[3] = g[4] = 0; - bnd[g[1] >= 1] = 1; + g[2] = g[3] = g[4] = 0.; + bnd[g[1] >= 1.] = 1.; - if (g[1] && (g[1] - 1) * (g[0] - 1) <= 0) { + if (g[1] && (g[1] - 1.) * (g[0] - 1.) <= 0.) { for (i = 0; i < 48; i++) { - g[2] = (bnd[0] + bnd[1]) / 2; + g[2] = (bnd[0] + bnd[1]) / 2.; if (g[0]) { - bnd[(pow(g[2] / g[1], -g[0]) - 1) / g[0] - 1 / g[2] > -1] = g[2]; + bnd[(pow(g[2] / g[1], -g[0]) - 1.) / g[0] - 1. / g[2] > -1.] = g[2]; } else { - bnd[g[2] / exp(1 - 1 / g[2]) < g[1]] = g[2]; + bnd[g[2] / exp(1. - 1. / g[2]) < g[1]] = g[2]; } } g[3] = g[2] / g[1]; if (g[0]) { - g[4] = g[2] * (1 / g[0] - 1); + g[4] = g[2] * (1. / g[0] - 1.); } } if (g[0]) { - g[5] = 1 / (g[1] * SQR(g[3]) / 2 - g[4] * (1 - g[3]) + (1 - pow(g[3], 1 + g[0])) * (1 + g[4]) / (1 + g[0])) - 1; + g[5] = 1. / (g[1] * SQR(g[3]) / 2. - g[4] * (1. - g[3]) + (1. - pow(g[3], 1. + g[0])) * (1. + g[4]) / (1. + g[0])) - 1.; } else { - g[5] = 1 / (g[1] * SQR(g[3]) / 2 + 1 - g[2] - g[3] - g[2] * g[3] * (log(g[3]) - 1)) - 1; + g[5] = 1. / (g[1] * SQR(g[3]) / 2. + 1. - g[2] - g[3] - g[2] * g[3] * (log(g[3]) - 1.)) - 1.; } if (!mode--) { diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index aa89ef639..bfaf7fdb4 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -218,6 +218,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e gain2 = useHslLin ? gain2 * 0.5f : gain2; float offse = (float) deh.offs; //def = 0 not use int scal = deh.scal; //def=3 + scal = 3;//disabled scal int nei = (int) 2.8f * deh.neigh; //def = 220 float vart = (float)deh.vart / 100.f;//variance float strength = (float) deh.str / 100.f; // Blend with original L channel data @@ -232,7 +233,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e float hl = deh.baselog; if(hl >= 2.71828f) elogt = 2.71828f + SQR(SQR(hl - 2.71828f)); else elogt = hl; - // printf("elo=%f\n",elogt); + elogt = 2.71828f;//disabled baselog FlatCurve* shcurve = NULL;//curve L=f(H) bool lhutili = false; @@ -458,7 +459,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } delta = maxi - mini; - printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); + // printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); if ( !delta ) { delta = 1.0f; diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index cda6e003e..9c47bfdc7 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -147,7 +147,7 @@ void RetinexParams::setDefaults() neigh = 80; gain = 50; offs = 0; - vart = 125; + vart = 200; limd = 8; highl = 10; baselog = 2.71828; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 04b7aebd6..6a3d6a9d7 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -119,6 +119,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), neigh = Gtk::manage (new Adjuster (M("TP_RETINEX_NEIGHBOR"), 6, 100., 1., 80.)); highl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT"), 1, 100, 1, 10)); highl->set_tooltip_markup (M("TP_RETINEX_HIGHLIGHT_TOOLTIP")); + vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 200)); + vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); @@ -129,6 +131,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexVBox->pack_start (*neigh); neigh->show (); + retinexVBox->pack_start (*vart); + vart->show (); + retinexVBox->pack_start (*highl); highl->show (); @@ -137,17 +142,18 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), transLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); transLabels->set_tooltip_markup (M("TP_RETINEX_TLABEL_TOOLTIP")); + transLabels2 = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); scal = Gtk::manage (new Adjuster (M("TP_RETINEX_SCALES"), 1, 8., 1., 3.)); gain = Gtk::manage (new Adjuster (M("TP_RETINEX_GAIN"), 20, 200, 1, 50)); offs = Gtk::manage (new Adjuster (M("TP_RETINEX_OFFSET"), -10000, 10000, 1, 0)); - vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125)); +// vart = Gtk::manage (new Adjuster (M("TP_RETINEX_VARIANCE"), 50, 500, 1, 125)); limd = Gtk::manage (new Adjuster (M("TP_RETINEX_THRESHOLD"), 2, 100, 1, 8)); baselog = Gtk::manage (new Adjuster (M("TP_RETINEX_BASELOG"), 1.1, 100., 0.001, 2.718)); // grbl = Gtk::manage (new Adjuster (M("TP_RETINEX_HIGHLIGHT3"), 1, 100, 1, 50)); gain->set_tooltip_markup (M("TP_RETINEX_GAIN_TOOLTIP")); scal->set_tooltip_markup (M("TP_RETINEX_SCALES_TOOLTIP")); - vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); +// vart->set_tooltip_markup (M("TP_RETINEX_VARIANCE_TOOLTIP")); limd->set_tooltip_markup (M("TP_RETINEX_THRESHOLD_TOOLTIP")); baselog->set_tooltip_markup (M("TP_RETINEX_BASELOG_TOOLTIP")); @@ -157,7 +163,6 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), lhshape = static_cast(curveEditorGH->addCurve(CT_Flat, M("TP_RETINEX_CURVEEDITOR_LH"))); lhshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_LH_TOOLTIP")); lhshape->setCurveColorProvider(this, 4); - // lhshape->setEditID(EUID_Lab_LHCurve, BT_SINGLEPLANE_FLOAT); milestones.clear(); @@ -182,6 +187,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*transLabels); transLabels->show (); + settingsVBox->pack_start (*transLabels2); + transLabels2->show (); + settingsVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); curveEditorGD->show(); @@ -203,8 +211,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), slope->show (); - settingsVBox->pack_start (*scal); - scal->show (); +// settingsVBox->pack_start (*scal); +// scal->show (); settingsVBox->pack_start (*gain); gain->show (); @@ -212,8 +220,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*offs); offs->show (); - settingsVBox->pack_start (*vart); - vart->show (); +// settingsVBox->pack_start (*vart); +// vart->show (); settingsVBox->pack_start (*limd); limd->show (); @@ -221,8 +229,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), // settingsVBox->pack_start (*highl); // highl->show (); - settingsVBox->pack_start (*baselog); - baselog->show (); +// settingsVBox->pack_start (*baselog); +// baselog->show (); // settingsVBox->pack_start (*grbl); // grbl->show (); @@ -232,9 +240,21 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*medianmap); medianmap->show (); - expsettings->add(*settingsVBox); + neutrHBox = Gtk::manage (new Gtk::HBox ()); + neutrHBox->set_border_width (2); + + neutral = Gtk::manage (new Gtk::Button (M("TP_RETINEX_NEUTRAL"))); + RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); + neutral->set_image(*resetImg); + neutral->set_tooltip_text (M("TP_RETINEX_NEUTRAL_TIP")); + neutralconn = neutral->signal_pressed().connect( sigc::mem_fun(*this, &Retinex::neutral_pressed) ); + neutral->show(); + neutrHBox->pack_start (*neutral); + + + str->setAdjusterListener (this); if (str->delay < 200) { @@ -309,6 +329,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), */ pack_start (*retinexVBox); pack_start (*expsettings); + pack_start (*neutrHBox); disableListener(); retinexColorSpaceChanged(); @@ -326,6 +347,24 @@ Retinex::~Retinex() delete curveEditorGH; } +void Retinex::neutral_pressed () +{ + neigh->resetValue(false); + gain->resetValue(false); + offs->resetValue(false); + str->resetValue(false); + scal->resetValue(false); + vart->resetValue(false); + limd->resetValue(false); + highl->resetValue(false); + baselog->resetValue(false); + gam->resetValue(false); + slope->resetValue(false); + transmissionShape->reset(); + cdshape->reset(); + cdshapeH->reset(); + lhshape->reset(); +} void Retinex::foldAllButMe (GdkEventButton* event, MyExpander *expander) { @@ -413,10 +452,15 @@ void Retinex::updateTrans () Glib::ustring::format(std::fixed, std::setprecision(1), nm), Glib::ustring::format(std::fixed, std::setprecision(1), nM), Glib::ustring::format(std::fixed, std::setprecision(1), nZ), - Glib::ustring::format(std::fixed, std::setprecision(1), nS), + Glib::ustring::format(std::fixed, std::setprecision(1), nS)) + ); + transLabels2->set_text( + Glib::ustring::compose(M("TP_RETINEX_TLABEL2"), Glib::ustring::format(std::fixed, std::setprecision(1), nA), Glib::ustring::format(std::fixed, std::setprecision(1), nB)) ); + + } } } diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 1a56fb170..09912341e 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -40,6 +40,8 @@ protected: Gtk::HBox* dhbox; Gtk::Label* labgam; Gtk::HBox* gambox; + Gtk::Button* neutral; + Gtk::HBox* neutrHBox; MyComboBoxText* retinexMethod; MyComboBoxText* retinexcolorspace; @@ -56,11 +58,12 @@ protected: Gtk::Label* mMLabels; Gtk::Label* transLabels; + Gtk::Label* transLabels2; DiagonalCurveEditor* cdshape; DiagonalCurveEditor* cdshapeH; CurveEditorGroup* transmissionCurveEditorG; - sigc::connection retinexMethodConn; + sigc::connection retinexMethodConn, neutralconn; sigc::connection retinexColorSpaceConn; sigc::connection gammaretinexConn; FlatCurveEditor* transmissionShape; @@ -84,6 +87,7 @@ public: bool minmaxComputed_ (); void updateLabel (); void updateTrans (); + void neutral_pressed (); void enabledChanged (); void curveChanged (CurveEditor* ce); From 7e6d0d45f4d56348b1b9b75db6cac099359d8175 Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Sat, 17 Oct 2015 14:44:14 +0200 Subject: [PATCH 66/71] Revised Retinex language file and settings --- rtdata/languages/default | 41 ++++++++++------------- rtengine/ipretinex.cc | 22 ++++++------ rtengine/procparams.cc | 18 +++++----- rtgui/retinex.cc | 72 ++++++++++++++++++++-------------------- 4 files changed, 73 insertions(+), 80 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index 3666e9cb9..ddf218625 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -650,9 +650,9 @@ HISTORY_MSG_417;Retinex - Transmission median HISTORY_MSG_418;Retinex - Threshold HISTORY_MSG_419;Retinex - Color space HISTORY_MSG_420;Retinex - Histogram - HSL -HISTORY_MSG_421;Retinex - Gamma retinex -HISTORY_MSG_422;Retinex - gamma -HISTORY_MSG_423;Retinex - slope +HISTORY_MSG_421;Retinex - Gamma +HISTORY_MSG_422;Retinex - Gamma +HISTORY_MSG_423;Retinex - Gamma slope HISTORY_MSG_424;Retinex - HL threshold HISTORY_MSG_425;Retinex - Log base HISTORY_MSG_426;Retinex - Hue equalizer @@ -1560,31 +1560,28 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. -TP_RETINEX_BASELOG;Logarithm base -TP_RETINEX_BASELOG_TOOLTIP;Change base logarithm\nLow values = near linear\nHigh values increase effect TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* TP_RETINEX_CURVEEDITOR_CD;L=f(L) -TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Correct raw data to reduce halos and artifacts +TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. TP_RETINEX_CONTEDIT_LH;Hue equalizer TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) -TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Equalize strength in function of hue\nIf Retinex method='highlight' also acts on the chroma +TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. TP_RETINEX_GAIN;Gain -TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with offset, this is very different from others settings. Used for black or white pixels, and for better balance the histogram. -TP_RETINEX_GAM;Gamma retinex +TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +TP_RETINEX_GAMMA;Gamma TP_RETINEX_GAMMA_NONE;None TP_RETINEX_GAMMA_LOW;Low TP_RETINEX_GAMMA_MID;Middle TP_RETINEX_GAMMA_HIGH;High TP_RETINEX_GAMMA_FREE;Free -TP_RETINEX_GAMMA;Gamma -TP_RETINEX_SLOPE;Slope -TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex\nDifferent from Retinex curves or others curves (Lab, Exposure,..) +TP_RETINEX_GAMMA;Free gamma +TP_RETINEX_SLOPE;Free gamma slope +TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). TP_RETINEX_HIGH;High TP_RETINEX_HIGHLIG;Highlight -TP_RETINEX_HIGHLIGPLUS;Highlight More TP_RETINEX_HIGHLIGHT;Highlight threshold -TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm\nNeeds probably to change settings (Neighboring pixels), and increase Raw White-point +TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. TP_RETINEX_HSLSPACE_LIN;HSL-Linear TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic TP_RETINEX_LABEL;Retinex @@ -1592,25 +1589,23 @@ TP_RETINEX_LABSPACE;L*a*b* TP_RETINEX_LOW;Low TP_RETINEX_MEDIAN;Transmission median filter TP_RETINEX_METHOD;Method -TP_RETINEX_METHOD_TOOLTIP;Low: Reinforce low light,\nUniform: Equalize action,\nHigh: Reinforce high light\nHighLight: Try to remove magenta +TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. TP_RETINEX_NEIGHBOR;Neighboring pixels TP_RETINEX_NEUTRAL;Reset -TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to default +TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. TP_RETINEX_NONE;None TP_RETINEX_OFFSET;Offset -TP_RETINEX_SCALES;Scales -TP_RETINEX_SCALES_TOOLTIP;Low scales increase contrast but give relief effect.\nHigh scales can increase noise, but give more natural images. TP_RETINEX_SETTINGS;Settings TP_RETINEX_STRENGTH;Strength TP_RETINEX_THRESHOLD;Threshold -TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out - in = image source - out = image Gauss +TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 -TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. TP_RETINEX_TRANSMISSION;Transmission map -TP_RETINEX_TRANSMISSION_TOOLTIP;Modify transmission in function of transmission\nAbscissa : transmission from negatives values (min), mean, and positives values (max)\nOrdonate : amplification - reduction +TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. TP_RETINEX_UNIFORM;Uniform TP_RETINEX_VARIANCE;Variance TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. @@ -1806,9 +1801,9 @@ TP_WAVELET_CONTRA;Contrast TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. TP_WAVELET_CONTR;Gamut TP_WAVELET_CTYPE;Chrominance control -TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. TP_WAVELET_CURVEEDITOR_CL;L TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. TP_WAVELET_CURVEEDITOR_HH;HH diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index bfaf7fdb4..8a283ac56 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -44,7 +44,6 @@ #include "rawimagesource.h" #include "improcfun.h" #include "opthelper.h" -#include "StopWatch.h" #define MAX_RETINEX_SCALES 8 #define clipretinex( val, minv, maxv ) (( val = (val < minv ? minv : val ) ) > maxv ? maxv : val ) @@ -207,7 +206,6 @@ void mean_stddv( float **dst, float &mean, float &stddv, int W_L, int H_L, const void RawImageSource::MSR(float** luminance, float** originalLuminance, float **exLuminance, int width, int height, RetinexParams deh, const RetinextransmissionCurve & dehatransmissionCurve, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax) { if (deh.enabled) {//enabled - StopWatch Stop1("MSR"); float mean, stddv, maxtr, mintr; // float mini, delta, maxi; float delta; @@ -250,10 +248,10 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e lhutili = true; } } - - + + if(deh.retinexMethod == "highliplus") higplus = true; - + if (deh.retinexMethod == "uni") { moderetinex = 0; } @@ -324,7 +322,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e for (int i = 0; i < H_L; i++) { int j = 0; - + #ifdef __SSE2__ if(useHslLin) { @@ -469,9 +467,9 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e maxCD = -9999999.f; minCD = 9999999.f; - - - + + + #ifdef _OPENMP #pragma omp parallel #endif @@ -504,7 +502,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e str *= (1.f + 2.f*valparam); } } - + // if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig; luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j]; } @@ -523,11 +521,11 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e Tsigma = stddv; Tmin = mintr; Tmax = maxtr; - + if (shcurve) { delete shcurve; } - + } } diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 987891195..501d0a030 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -155,14 +155,14 @@ void RetinexParams::setDefaults() retinexMethod = "high"; retinexcolorspace = "Lab"; gammaretinex = "none"; - medianmap = true; + medianmap = false; cdcurve.clear(); cdcurve.push_back(DCT_Linear); cdHcurve.clear(); cdHcurve.push_back(DCT_Linear); lhcurve.clear(); lhcurve.push_back(DCT_Linear); - + getDefaulttransmissionCurve(transmissionCurve); } @@ -1451,7 +1451,7 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol if (!pedited || pedited->retinex.slope) { keyFile.set_double ("Retinex", "Slope", retinex.slope); } - + if (!pedited || pedited->retinex.enabled) { keyFile.set_boolean ("Retinex", "Enabled", retinex.enabled); } @@ -1493,7 +1493,7 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol // if (!pedited || pedited->retinex.grbl) { // keyFile.set_integer ("Retinex", "grbl", retinex.grbl); // } - + if (!pedited || pedited->retinex.retinexMethod) { keyFile.set_string ("Retinex", "RetinexMethod", retinex.retinexMethod); } @@ -1520,7 +1520,7 @@ int ProcParams::save (Glib::ustring fname, Glib::ustring fname2, bool fnameAbsol Glib::ArrayHandle lhcurve = retinex.lhcurve; keyFile.set_double_list("Retinex", "LHCurve", lhcurve); } - + if (!pedited || pedited->retinex.transmissionCurve) { Glib::ArrayHandle transmissionCurve = retinex.transmissionCurve; keyFile.set_double_list("Retinex", "TransmissionCurve", transmissionCurve); @@ -3818,7 +3818,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->retinex.gammaretinex = true; } } - + if (keyFile.has_key ("Retinex", "Enabled")) { retinex.enabled = keyFile.get_boolean ("Retinex", "Enabled"); @@ -3866,7 +3866,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->retinex.slope = true; } } - + if (keyFile.has_key ("Retinex", "Gain")) { retinex.gain = keyFile.get_integer ("Retinex", "Gain"); @@ -3922,7 +3922,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->retinex.grbl = true; } } -*/ +*/ if (keyFile.has_key ("Retinex", "CDCurve")) { retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve"); @@ -3946,7 +3946,7 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) pedited->retinex.lhcurve = true; } } - + if (keyFile.has_key ("Retinex", "TransmissionCurve")) { retinex.transmissionCurve = keyFile.get_double_list ("Retinex", "TransmissionCurve"); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 6a3d6a9d7..73e604e2e 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -48,7 +48,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexcolorspace->append_text (M("TP_RETINEX_HSLSPACE_LIN")); retinexcolorspace->set_active(0); retinexColorSpaceConn = retinexcolorspace->signal_changed().connect ( sigc::mem_fun(*this, &Retinex::retinexColorSpaceChanged) ); - + dhbox->pack_start(*retinexMethod); dhbox->pack_start(*retinexcolorspace); retinexVBox->pack_start(*dhbox); @@ -99,9 +99,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), transmissionCurveEditorG->curveListComplete(); gambox = Gtk::manage (new Gtk::HBox ()); - labgam = Gtk::manage (new Gtk::Label (M("TP_RETINEX_GAM") + ":")); + labgam = Gtk::manage (new Gtk::Label (M("TP_RETINEX_GAMMA") + ":")); gambox->pack_start (*labgam, Gtk::PACK_SHRINK, 1); - + gammaretinex = Gtk::manage (new MyComboBoxText ()); gammaretinex->append_text (M("TP_RETINEX_GAMMA_NONE")); gammaretinex->append_text (M("TP_RETINEX_GAMMA_LOW")); @@ -124,7 +124,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), expsettings = new MyExpander (false, M("TP_RETINEX_SETTINGS")); expsettings->signal_button_release_event().connect_notify( sigc::bind( sigc::mem_fun(this, &Retinex::foldAllButMe), expsettings) ); - + retinexVBox->pack_start (*str); str->show (); @@ -133,10 +133,10 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), retinexVBox->pack_start (*vart); vart->show (); - + retinexVBox->pack_start (*highl); highl->show (); - + mMLabels = Gtk::manage(new Gtk::Label("---", Gtk::ALIGN_CENTER)); mMLabels->set_tooltip_markup (M("TP_RETINEX_MLABEL_TOOLTIP")); @@ -159,11 +159,11 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), curveEditorGH = new CurveEditorGroup (options.lastRetinexDir, M("TP_RETINEX_CONTEDIT_LH")); curveEditorGH->setCurveListener (this); - + lhshape = static_cast(curveEditorGH->addCurve(CT_Flat, M("TP_RETINEX_CURVEEDITOR_LH"))); lhshape->setTooltip(M("TP_RETINEX_CURVEEDITOR_LH_TOOLTIP")); lhshape->setCurveColorProvider(this, 4); - + milestones.clear(); for (int i = 0; i < 7; i++) { @@ -174,9 +174,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), } lhshape->setBottomBarBgGradient(milestones); - + curveEditorGH->curveListComplete(); - + medianmap = Gtk::manage (new Gtk::CheckButton (M("TP_RETINEX_MEDIAN"))); medianmap->set_active (true); medianmapConn = medianmap->signal_toggled().connect( sigc::mem_fun(*this, &Retinex::medianmapChanged) ); @@ -189,7 +189,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*transLabels2); transLabels2->show (); - + settingsVBox->pack_start (*curveEditorGD, Gtk::PACK_SHRINK, 4); curveEditorGD->show(); @@ -198,9 +198,9 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*curveEditorGH, Gtk::PACK_SHRINK, 4); curveEditorGH->show(); - + gambox->pack_start(*gammaretinex); - + settingsVBox->pack_start(*gambox); gammaretinex->show(); @@ -209,8 +209,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), settingsVBox->pack_start (*slope); slope->show (); - - + + // settingsVBox->pack_start (*scal); // scal->show (); @@ -234,7 +234,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), // settingsVBox->pack_start (*grbl); // grbl->show (); - + settingsVBox->pack_start( *transmissionCurveEditorG, Gtk::PACK_SHRINK, 2); transmissionCurveEditorG->show(); @@ -244,7 +244,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), neutrHBox = Gtk::manage (new Gtk::HBox ()); neutrHBox->set_border_width (2); - + neutral = Gtk::manage (new Gtk::Button (M("TP_RETINEX_NEUTRAL"))); RTImage *resetImg = Gtk::manage (new RTImage ("gtk-undo-ltr-small.png", "gtk-undo-rtl-small.png")); neutral->set_image(*resetImg); @@ -253,8 +253,8 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), neutral->show(); neutrHBox->pack_start (*neutral); - - + + str->setAdjusterListener (this); if (str->delay < 200) { @@ -266,13 +266,13 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), if (scal->delay < 200) { scal->delay = 200; } - + gam->setAdjusterListener (this); if (gam->delay < 500) { gam->delay = 500; } - + slope->setAdjusterListener (this); if (slope->delay < 500) { @@ -314,7 +314,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), if (highl->delay < 200) { highl->delay = 200; } - + baselog->setAdjusterListener (this); if (baselog->delay < 200) { @@ -326,7 +326,7 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), if (grbl->delay < 200) { grbl->delay = 200; } -*/ +*/ pack_start (*retinexVBox); pack_start (*expsettings); pack_start (*neutrHBox); @@ -364,7 +364,7 @@ void Retinex::neutral_pressed () cdshape->reset(); cdshapeH->reset(); lhshape->reset(); -} +} void Retinex::foldAllButMe (GdkEventButton* event, MyExpander *expander) { @@ -459,8 +459,8 @@ void Retinex::updateTrans () Glib::ustring::format(std::fixed, std::setprecision(1), nA), Glib::ustring::format(std::fixed, std::setprecision(1), nB)) ); - - + + } } } @@ -502,7 +502,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) if (!pedited->retinex.gammaretinex) { gammaretinex->set_active_text(M("GENERAL_UNCHANGED")); } - + cdshape->setUnChanged (!pedited->retinex.cdcurve); cdshapeH->setUnChanged (!pedited->retinex.cdHcurve); transmissionShape->setUnChanged (!pedited->retinex.transmissionCurve); @@ -561,7 +561,7 @@ void Retinex::read (const ProcParams* pp, const ParamsEdited* pedited) } else if (pp->retinex.gammaretinex == "fre") { gammaretinex->set_active (4); } - + retinexMethodChanged (); retinexColorSpaceChanged(); gammaretinexChanged(); @@ -653,7 +653,7 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) } else if (retinexcolorspace->get_active_row_number() == 2) { pp->retinex.retinexcolorspace = "HSLLIN"; } - + if (gammaretinex->get_active_row_number() == 0) { pp->retinex.gammaretinex = "none"; } else if (gammaretinex->get_active_row_number() == 1) { @@ -665,12 +665,12 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) } else if (gammaretinex->get_active_row_number() == 4) { pp->retinex.gammaretinex = "fre"; } - + } void Retinex::retinexMethodChanged() { - + if(retinexMethod->get_active_row_number() == 3) highl->show(); else highl->hide(); @@ -683,19 +683,19 @@ void Retinex::ColorSpaceUpdateUI () { if (!batchMode) { curveEditorGH->show(); - + if(retinexcolorspace->get_active_row_number() == 0) { curveEditorGD->show(); curveEditorGDH->hide(); - baselog->show(); + baselog->show(); } else if(retinexcolorspace->get_active_row_number() == 1) { curveEditorGD->hide(); curveEditorGDH->show(); - baselog->show(); + baselog->show(); } else if(retinexcolorspace->get_active_row_number() == 2) { curveEditorGD->hide(); curveEditorGDH->show(); - baselog->hide(); + baselog->hide(); } } } @@ -718,7 +718,7 @@ void Retinex::gammaretinexChanged() slope->show(); } else if(gammaretinex->get_active_row_number() != 4) { gam->hide(); - slope->hide(); + slope->hide(); } } From 7ca8de08ab3140e53beb184b3b4937082aef7e50 Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Sat, 17 Oct 2015 14:45:24 +0200 Subject: [PATCH 67/71] astyle all modified files in retinex branch --- rtengine/color.cc | 9 +- rtengine/color.h | 10 +- rtengine/curves.cc | 2 + rtengine/helpersse2.h | 30 +-- rtengine/ipretinex.cc | 49 ++-- rtengine/procparams.cc | 14 +- rtengine/rawimagesource.cc | 419 +++++++++++++++++++---------------- rtengine/simpleprocess.cc | 1 + rtgui/batchtoolpanelcoord.cc | 16 +- rtgui/editorpanel.cc | 1 + rtgui/paramsedited.cc | 6 +- rtgui/partialpastedlg.cc | 2 +- rtgui/preferences.cc | 2 +- rtgui/retinex.cc | 27 ++- rtgui/retinex.h | 4 +- 15 files changed, 324 insertions(+), 268 deletions(-) diff --git a/rtengine/color.cc b/rtengine/color.cc index 13bad89db..c0dbab4d3 100644 --- a/rtengine/color.cc +++ b/rtengine/color.cc @@ -209,7 +209,7 @@ void Color::init () for (int i = 0; i < 65536; i++) { gammatab_13_2[i] = (65535.0 * gamma13_2 (i / 65535.0)); } - + for (int i = 0; i < 65536; i++) { igammatab_13_2[i] = (65535.0 * igamma13_2 (i / 65535.0)); } @@ -217,7 +217,7 @@ void Color::init () for (int i = 0; i < 65536; i++) { gammatab_115_2[i] = (65535.0 * gamma115_2 (i / 65535.0)); } - + for (int i = 0; i < 65536; i++) { igammatab_115_2[i] = (65535.0 * igamma115_2 (i / 65535.0)); } @@ -225,14 +225,15 @@ void Color::init () for (int i = 0; i < 65536; i++) { gammatab_145_3[i] = (65535.0 * gamma145_3 (i / 65535.0)); } - + for (int i = 0; i < 65536; i++) { igammatab_145_3[i] = (65535.0 * igamma145_3 (i / 65535.0)); } - + for (int i = 0; i < 65536; i++) { gammatab_26_11[i] = (65535.0 * gamma26_11 (i / 65535.0)); } + //gammatab_145_3 for (int i = 0; i < 65536; i++) { igammatab_26_11[i] = (65535.0 * igamma26_11 (i / 65535.0)); diff --git a/rtengine/color.h b/rtengine/color.h index cc3a1f295..c179946f0 100644 --- a/rtengine/color.h +++ b/rtengine/color.h @@ -956,7 +956,7 @@ public: { return x <= 0.016613 ? x * 2.0 : 1.009968 * exp(log(x) / 1.3) - 0.009968; } - + static inline double igamma13_2 (double x) { return x <= 0.033226 ? x / 2.0 : exp(log((x + 0.009968) / 1.009968) * 1.3); @@ -966,17 +966,17 @@ public: { return x <= 0.001692 ? x * 2.0 : 1.000508 * exp(log(x) / 1.15) - 0.000508; } - + static inline double igamma115_2 (double x) { return x <= 0.003384 ? x / 2.0 : exp(log((x + 0.000508) / 1.000508) * 1.15); } - + static inline double gamma145_3 (double x) { return x <= 0.009115 ? x * 3.0 : 1.012305 * exp(log(x) / 1.45) - 0.012305; } - + static inline double igamma145_3 (double x) { return x <= 0.027345 ? x / 3.0 : exp(log((x + 0.012305) / 1.012305) * 1.45); @@ -992,7 +992,7 @@ public: return (x <= start * slope ? x / slope : exp(log((x + add) / mul) * gamma) ); } - + // gamma function with adjustable parameters //same as above with values calculate with Calcgamma above diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 2d355a071..4ad1d06bd 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -513,6 +513,7 @@ void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector= 9) || __GNUC__ > 4 - #define LVF(x) _mm_load_ps(&x) - #define LVFU(x) _mm_loadu_ps(&x) - #define STVF(x,y) _mm_store_ps(&x,y) - #define STVFU(x,y) _mm_storeu_ps(&x,y) - #else // there is a bug in gcc 4.7.x when using openmp and aligned memory and -O3 - #define LVF(x) _mm_loadu_ps(&x) - #define LVFU(x) _mm_loadu_ps(&x) - #define STVF(x,y) _mm_storeu_ps(&x,y) - #define STVFU(x,y) _mm_storeu_ps(&x,y) - #endif +#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4 +#define LVF(x) _mm_load_ps(&x) +#define LVFU(x) _mm_loadu_ps(&x) +#define STVF(x,y) _mm_store_ps(&x,y) +#define STVFU(x,y) _mm_storeu_ps(&x,y) +#else // there is a bug in gcc 4.7.x when using openmp and aligned memory and -O3 +#define LVF(x) _mm_loadu_ps(&x) +#define LVFU(x) _mm_loadu_ps(&x) +#define STVF(x,y) _mm_storeu_ps(&x,y) +#define STVFU(x,y) _mm_storeu_ps(&x,y) +#endif #else - #define LVF(x) _mm_load_ps(&x) - #define LVFU(x) _mm_loadu_ps(&x) - #define STVF(x,y) _mm_store_ps(&x,y) - #define STVFU(x,y) _mm_storeu_ps(&x,y) +#define LVF(x) _mm_load_ps(&x) +#define LVFU(x) _mm_loadu_ps(&x) +#define STVF(x,y) _mm_store_ps(&x,y) +#define STVFU(x,y) _mm_storeu_ps(&x,y) #endif // Load 8 floats from a and combine a[0],a[2],a[4] and a[6] into a vector of 4 floats diff --git a/rtengine/ipretinex.cc b/rtengine/ipretinex.cc index 8a283ac56..54d6888ea 100644 --- a/rtengine/ipretinex.cc +++ b/rtengine/ipretinex.cc @@ -94,7 +94,7 @@ void retinex_scales( float* scales, int nscales, int mode, int s, float high) size_step = (float) log(s - 2.0f) / (float) nscales; for ( int i = 0; i < nscales; ++i ) { - scales[i] = high*s - (float)pow (10.f, (i * size_step) / log (10.f)); + scales[i] = high * s - (float)pow (10.f, (i * size_step) / log (10.f)); } } } @@ -225,12 +225,17 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e limD *= useHslLin ? 10.f : 1.f; float ilimD = 1.f / limD; int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" ) - float hig = ((float) deh.highl)/100.f; + float hig = ((float) deh.highl) / 100.f; bool higplus = false ; float elogt; float hl = deh.baselog; - if(hl >= 2.71828f) elogt = 2.71828f + SQR(SQR(hl - 2.71828f)); - else elogt = hl; + + if(hl >= 2.71828f) { + elogt = 2.71828f + SQR(SQR(hl - 2.71828f)); + } else { + elogt = hl; + } + elogt = 2.71828f;//disabled baselog FlatCurve* shcurve = NULL;//curve L=f(H) bool lhutili = false; @@ -243,14 +248,15 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e delete shcurve; shcurve = NULL; } - } - else { + } else { lhutili = true; } } - if(deh.retinexMethod == "highliplus") higplus = true; + if(deh.retinexMethod == "highliplus") { + higplus = true; + } if (deh.retinexMethod == "uni") { moderetinex = 0; @@ -259,13 +265,15 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e if (deh.retinexMethod == "low") { moderetinex = 1; } + if (deh.retinexMethod == "highli" || deh.retinexMethod == "highliplus") { moderetinex = 3; } - float aahi = 49.f/99.f;////reduce sensibility 50% + + float aahi = 49.f / 99.f; ////reduce sensibility 50% float bbhi = 1.f - aahi; float high; - high = bbhi + aahi*(float) deh.highl; + high = bbhi + aahi * (float) deh.highl; retinex_scales( RetinexScales, scal, moderetinex, nei, high ); int H_L = height; @@ -331,7 +339,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } } else { for (; j < W_L - 3; j += 4) { - _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )/xlogf(elogtv)); + _mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) ) / xlogf(elogtv)); } } @@ -343,7 +351,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } } else { for (; j < W_L; j++) { - luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD))/log(elogt);// /logt ? + luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)) / log(elogt); // /logt ? } } } @@ -457,7 +465,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e } delta = maxi - mini; - // printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); + // printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr); if ( !delta ) { delta = 1.0f; @@ -492,19 +500,26 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e if(cd < cdmin) { cdmin = cd; } + float str = strength; + if(lhutili) { // S=f(H) { float HH = exLuminance[i][j]; float valparam; - if(useHsl || useHslLin) valparam = float((shcurve->getVal(HH) - 0.5f)); - else valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); - str *= (1.f + 2.f*valparam); + + if(useHsl || useHslLin) { + valparam = float((shcurve->getVal(HH) - 0.5f)); + } else { + valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); + } + + str *= (1.f + 2.f * valparam); } } - // if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig; - luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j]; + // if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig; + luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j]; } #ifdef _OPENMP diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index 501d0a030..eaf90d5c2 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -3915,14 +3915,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited) } } -/* if (keyFile.has_key ("Retinex", "grbl")) { - retinex.grbl = keyFile.get_integer ("Retinex", "grbl"); + /* if (keyFile.has_key ("Retinex", "grbl")) { + retinex.grbl = keyFile.get_integer ("Retinex", "grbl"); - if (pedited) { - pedited->retinex.grbl = true; - } - } -*/ + if (pedited) { + pedited->retinex.grbl = true; + } + } + */ if (keyFile.has_key ("Retinex", "CDCurve")) { retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve"); diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 0e590ccd1..2c0d8ad2f 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -1855,99 +1855,111 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar conversionBuffer[1] (W - 2 * border, H - 2 * border); conversionBuffer[2] (W - 2 * border, H - 2 * border); conversionBuffer[3] (W - 2 * border, H - 2 * border); - - LUTf *retinexgamtab;//gamma before and after Retinex to restore tones - LUTf lutTonereti; - lutTonereti(65536); - - if(retinexParams.gammaretinex == "low") - retinexgamtab = &(Color::gammatab_115_2); - else if(retinexParams.gammaretinex == "mid") - retinexgamtab = &(Color::gammatab_13_2); - else if(retinexParams.gammaretinex == "hig") - retinexgamtab = &(Color::gammatab_145_3); - else if(retinexParams.gammaretinex == "fre"){ - double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; - double pwr = 1.0 / retinexParams.gam; - double gamm = retinexParams.gam; - double ts = retinexParams.slope; - double gamm2 = retinexParams.gam; - if(gamm2 < 1.) {pwr = 1./pwr; gamm = 1. / gamm;} - - int mode = 0, imax = 0; - Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope - // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); - for (int i = 0; i < 65536; i++) { - double val = (i) / 65535.; - double start = g_a3; - double add = g_a4; - double mul = 1. + g_a4; - double x; - if(gamm2 < 1.) {start = g_a2; add = g_a4; - x = Color::igammareti (val, gamm, start, ts, mul , add);} - else - x = Color::gammareti (val, gamm, start, ts, mul , add); - - lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values - } - retinexgamtab = &lutTonereti; + + LUTf *retinexgamtab;//gamma before and after Retinex to restore tones + LUTf lutTonereti; + lutTonereti(65536); + + if(retinexParams.gammaretinex == "low") { + retinexgamtab = &(Color::gammatab_115_2); + } else if(retinexParams.gammaretinex == "mid") { + retinexgamtab = &(Color::gammatab_13_2); + } else if(retinexParams.gammaretinex == "hig") { + retinexgamtab = &(Color::gammatab_145_3); + } else if(retinexParams.gammaretinex == "fre") { + double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; + double pwr = 1.0 / retinexParams.gam; + double gamm = retinexParams.gam; + double ts = retinexParams.slope; + double gamm2 = retinexParams.gam; + + if(gamm2 < 1.) { + pwr = 1. / pwr; + gamm = 1. / gamm; } -/* -//test with amsterdam.pef and other files -float rr,gg,bb; -rr=red[50][2300]; -gg=green[50][2300]; -bb=blue[50][2300]; -printf("rr=%f gg=%f bb=%f \n",rr,gg,bb); -rr=red[1630][370]; -gg=green[1630][370]; -bb=blue[1630][370]; -printf("rr1=%f gg1=%f bb1=%f \n",rr,gg,bb); -rr=red[380][1630]; -gg=green[380][1630]; -bb=blue[380][1630]; -printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb); -*/ -/* -if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult ! - float hig = ((float)retinexParams.highlig)/100.f; - float higgb = ((float)retinexParams.grbl)/100.f; - -#ifdef _OPENMP - #pragma omp parallel for -#endif - for (int i = border; i < H - border; i++ ) { - for (int j = border; j < W - border; j++ ) { - float R_,G_,B_; - R_=red[i][j]; - G_=green[i][j]; - B_=blue[i][j]; - - //empirical method to find highlight magenta with no conversion RGB and no white balance - //red = master Gr and Bl default higgb=0.5 - // if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_; - // else conversionBuffer[3][i - border][j - border] = 0.f; + + int mode = 0, imax = 0; + Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope + + // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); + for (int i = 0; i < 65536; i++) { + double val = (i) / 65535.; + double start = g_a3; + double add = g_a4; + double mul = 1. + g_a4; + double x; + + if(gamm2 < 1.) { + start = g_a2; + add = g_a4; + x = Color::igammareti (val, gamm, start, ts, mul , add); + } else { + x = Color::gammareti (val, gamm, start, ts, mul , add); } - } -} -*/ -if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma + + lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values + } + + retinexgamtab = &lutTonereti; + } + + /* + //test with amsterdam.pef and other files + float rr,gg,bb; + rr=red[50][2300]; + gg=green[50][2300]; + bb=blue[50][2300]; + printf("rr=%f gg=%f bb=%f \n",rr,gg,bb); + rr=red[1630][370]; + gg=green[1630][370]; + bb=blue[1630][370]; + printf("rr1=%f gg1=%f bb1=%f \n",rr,gg,bb); + rr=red[380][1630]; + gg=green[380][1630]; + bb=blue[380][1630]; + printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb); + */ + /* + if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult ! + float hig = ((float)retinexParams.highlig)/100.f; + float higgb = ((float)retinexParams.grbl)/100.f; + + #ifdef _OPENMP + #pragma omp parallel for + #endif + for (int i = border; i < H - border; i++ ) { + for (int j = border; j < W - border; j++ ) { + float R_,G_,B_; + R_=red[i][j]; + G_=green[i][j]; + B_=blue[i][j]; + + //empirical method to find highlight magenta with no conversion RGB and no white balance + //red = master Gr and Bl default higgb=0.5 + // if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_; + // else conversionBuffer[3][i - border][j - border] = 0.f; + } + } + } + */ + if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma #ifdef _OPENMP #pragma omp parallel for -#endif +#endif + for (int i = border; i < H - border; i++ ) { for (int j = border; j < W - border; j++ ) { - float R_,G_,B_; - R_=red[i][j]; - G_=green[i][j]; - B_=blue[i][j]; - + float R_, G_, B_; + R_ = red[i][j]; + G_ = green[i][j]; + B_ = blue[i][j]; + red[i][j] = (*retinexgamtab)[R_]; green[i][j] = (*retinexgamtab)[G_]; - blue[i][j] = (*retinexgamtab)[B_]; + blue[i][j] = (*retinexgamtab)[B_]; } - } -} + } + } if(useHsl) { #ifdef _OPENMP @@ -2054,7 +2066,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma for (int j = border; j < W - border; j++) { float X, Y, Z, L, aa, bb; int pos; - float R_,G_,B_; + float R_, G_, B_; R_ = red[i][j]; G_ = green[i][j]; B_ = blue[i][j]; @@ -2066,9 +2078,10 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma conversionBuffer[0][i - border][j - border] = aa; conversionBuffer[1][i - border][j - border] = bb; conversionBuffer[2][i - border][j - border] = L; - conversionBuffer[3][i - border][j - border] = xatan2f(bb,aa); - // if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_; - // else conversionBuffer[3][i - border][j - border] = 0.f; + conversionBuffer[3][i - border][j - border] = xatan2f(bb, aa); + +// if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_; +// else conversionBuffer[3][i - border][j - border] = 0.f; if(lhist16RETI) { pos = (int) clipretinex(L, 0, 32768); lhist16RETIThr[pos]++;//histogram in Curve Lab @@ -2089,9 +2102,9 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma } } - - - + + + } void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdcurve, RetinextransmissionCurve &retinextransmissionCurve, bool &retinexcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) @@ -2109,7 +2122,7 @@ void RawImageSource::retinexPrepareCurves(RetinexParams retinexParams, LUTf &cdc //void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneCurveParams Tc, LUTf & cdcurve, const RetinextransmissionCurve & dehatransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) -{ +{ MyTime t4, t5; t4.set(); @@ -2117,42 +2130,55 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC if (settings->verbose) { printf ("Applying Retinex\n"); } - LUTf lutToneireti; - lutToneireti(65536); - - LUTf *retinexigamtab;//gamma before and after Retinex to restore tones - if(deh.gammaretinex == "low") - retinexigamtab = &(Color::igammatab_115_2); - else if(deh.gammaretinex == "mid") - retinexigamtab = &(Color::igammatab_13_2); - else if(deh.gammaretinex == "hig") - retinexigamtab = &(Color::igammatab_145_3); - else if(deh.gammaretinex == "fre"){ - double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; - double pwr = 1.0 / deh.gam; - double gamm = deh.gam; - double gamm2 = gamm; - double ts = deh.slope; - int mode = 0, imax = 0; - if(gamm2 < 1.) {pwr = 1./pwr; gamm = 1. / gamm;} - - Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope - // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); - for (int i = 0; i < 65536; i++) { - double val = (i) / 65535.; - double x; - double mul = 1. + g_a4; - double add = g_a4; - double start = g_a2; - if(gamm2 < 1.) {start = g_a3; add = g_a3; - x = Color::gammareti (val, gamm, start, ts, mul , add);} - else - x = Color::igammareti (val, gamm, start, ts, mul , add); - - lutToneireti[i] = CLIP(x * 65535.); - } - retinexigamtab = &lutToneireti; + + LUTf lutToneireti; + lutToneireti(65536); + + LUTf *retinexigamtab;//gamma before and after Retinex to restore tones + + if(deh.gammaretinex == "low") { + retinexigamtab = &(Color::igammatab_115_2); + } else if(deh.gammaretinex == "mid") { + retinexigamtab = &(Color::igammatab_13_2); + } else if(deh.gammaretinex == "hig") { + retinexigamtab = &(Color::igammatab_145_3); + } else if(deh.gammaretinex == "fre") { + double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5; + double pwr = 1.0 / deh.gam; + double gamm = deh.gam; + double gamm2 = gamm; + double ts = deh.slope; + int mode = 0, imax = 0; + + if(gamm2 < 1.) { + pwr = 1. / pwr; + gamm = 1. / gamm; } + + Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope + + // printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4); + for (int i = 0; i < 65536; i++) { + double val = (i) / 65535.; + double x; + double mul = 1. + g_a4; + double add = g_a4; + double start = g_a2; + + if(gamm2 < 1.) { + start = g_a3; + add = g_a3; + x = Color::gammareti (val, gamm, start, ts, mul , add); + } else { + x = Color::igammareti (val, gamm, start, ts, mul , add); + } + + lutToneireti[i] = CLIP(x * 65535.); + } + + retinexigamtab = &lutToneireti; + } + // We need a buffer with original L data to allow correct blending // red, green and blue still have original size of raw, but we can't use the borders const int HNew = H - 2 * border; @@ -2172,25 +2198,24 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC dLcurve.clear(); } - FlatCurve* chcurve = NULL;//curve c=f(H) - bool chutili = false; + FlatCurve* chcurve = NULL;//curve c=f(H) + bool chutili = false; - if (deh.enabled && deh.retinexMethod == "highli") { - chcurve = new FlatCurve(deh.lhcurve); + if (deh.enabled && deh.retinexMethod == "highli") { + chcurve = new FlatCurve(deh.lhcurve); - if (!chcurve || chcurve->isIdentity()) { - if (chcurve) { - delete chcurve; - chcurve = NULL; - } - } - else { - chutili = true; + if (!chcurve || chcurve->isIdentity()) { + if (chcurve) { + delete chcurve; + chcurve = NULL; } + } else { + chutili = true; } - - - + } + + + #ifdef _OPENMP #pragma omp parallel #endif @@ -2247,30 +2272,34 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC histLRETI[hi] += hist16RET[i]; } } + MSR(LBuffer, conversionBuffer[2], conversionBuffer[3], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); - + if(useHsl) { - if(chutili) { + if(chutili) { #ifdef _OPENMP - #pragma omp parallel for -#endif + #pragma omp parallel for +#endif + for (int i = border; i < H - border; i++ ) { int j = border; + for (; j < W - border; j++) { - - float valp; - float chr; - // if(chutili) { // c=f(H) - { - valp = float((chcurve->getVal(conversionBuffer[3][i - border][j - border]) - 0.5f)); - - conversionBuffer[1][i - border][j - border] *= (1.f + 2.f*valp); - } - // } - + + float valp; + float chr; + // if(chutili) { // c=f(H) + { + valp = float((chcurve->getVal(conversionBuffer[3][i - border][j - border]) - 0.5f)); + + conversionBuffer[1][i - border][j - border] *= (1.f + 2.f * valp); + } + // } + } } } + #ifdef _OPENMP #pragma omp parallel for #endif @@ -2309,42 +2338,44 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC #ifdef _OPENMP #pragma omp parallel for #endif + for (int i = border; i < H - border; i++ ) { - for (int j= border; j < W - border; j++) { - - float Lprov1 = (LBuffer[i - border][j - border])/327.68f; + for (int j = border; j < W - border; j++) { + + float Lprov1 = (LBuffer[i - border][j - border]) / 327.68f; float Chprov1 = sqrt(SQR(conversionBuffer[0][i - border][j - border]) + SQR(conversionBuffer[1][i - border][j - border])) / 327.68f; float HH = xatan2f(conversionBuffer[1][i - border][j - border], conversionBuffer[0][i - border][j - border]); float2 sincosval; float valp; float chr; - if(chutili) { // c=f(H) - { - valp = float((chcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); - Chprov1 *= (1.f + 2.f*valp); - } + + if(chutili) { // c=f(H) + { + valp = float((chcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f)); + Chprov1 *= (1.f + 2.f * valp); } - + } + sincosval = xsincosf(HH); - float R,G,B; + float R, G, B; #ifdef _DEBUG - bool neg = false; - bool more_rgb = false; - //gamut control : Lab values are in gamut - Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f, neg, more_rgb); + bool neg = false; + bool more_rgb = false; + //gamut control : Lab values are in gamut + Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f, neg, more_rgb); #else - //gamut control : Lab values are in gamut - Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f); + //gamut control : Lab values are in gamut + Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f); #endif - conversionBuffer[0][i - border][j - border] = 327.68f * Chprov1 * sincosval.y; - conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x; - LBuffer[i - border][j - border] = Lprov1 * 327.68f; + conversionBuffer[0][i - border][j - border] = 327.68f * Chprov1 * sincosval.y; + conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x; + LBuffer[i - border][j - border] = Lprov1 * 327.68f; } - } - + } + //end gamut control #ifdef __SSE2__ vfloat wipv[3][3]; @@ -2368,11 +2399,11 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC vfloat R, G, B; Color::Lab2XYZ(LVFU(LBuffer[i - border][j - border]), LVFU(conversionBuffer[0][i - border][j - border]), LVFU(conversionBuffer[1][i - border][j - border]), x_, y_, z_) ; Color::xyz2rgb(x_, y_, z_, R, G, B, wipv); - + _mm_storeu_ps(&red[i][j], R); _mm_storeu_ps(&green[i][j], G); - _mm_storeu_ps(&blue[i][j], B); - + _mm_storeu_ps(&blue[i][j], B); + } #endif @@ -2387,26 +2418,28 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC blue[i][j] = B; } } -} - if (chcurve) { - delete chcurve; - } + } -if(deh.gammaretinex != "none" && deh.str !=0){//inverse gamma + if (chcurve) { + delete chcurve; + } + + if(deh.gammaretinex != "none" && deh.str != 0) { //inverse gamma #ifdef _OPENMP #pragma omp parallel for -#endif +#endif + for (int i = border; i < H - border; i++ ) { for (int j = border; j < W - border; j++ ) { - float R_,G_,B_; - R_=red[i][j]; - G_=green[i][j]; - B_=blue[i][j]; + float R_, G_, B_; + R_ = red[i][j]; + G_ = green[i][j]; + B_ = blue[i][j]; red[i][j] = (*retinexigamtab)[R_]; green[i][j] = (*retinexigamtab)[G_]; - blue[i][j] = (*retinexigamtab)[B_]; + blue[i][j] = (*retinexigamtab)[B_]; } - } + } } t5.set(); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index f6ea8ad6b..91b7df178 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -627,6 +627,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p Imagefloat* baseImg = new Imagefloat (fw, fh); imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw); + if (pl) { pl->setProgress (0.50); } diff --git a/rtgui/batchtoolpanelcoord.cc b/rtgui/batchtoolpanelcoord.cc index fa057e205..e1d78a19f 100644 --- a/rtgui/batchtoolpanelcoord.cc +++ b/rtgui/batchtoolpanelcoord.cc @@ -577,31 +577,31 @@ void BatchToolPanelCoordinator::initSession () if (options.baBehav[ADDSET_WA_GAMMA]) { pparams.wavelet.gamma = 0; } - + if (options.baBehav[ADDSET_RETI_STR]) { pparams.retinex.str = 0; } - + if (options.baBehav[ADDSET_RETI_SCAL]) { pparams.retinex.scal = 0; } - + if (options.baBehav[ADDSET_RETI_NEIGH]) { pparams.retinex.neigh = 0; } - + if (options.baBehav[ADDSET_RETI_LIMD]) { pparams.retinex.limd = 0; } - + if (options.baBehav[ADDSET_RETI_GAIN]) { pparams.retinex.gain = 0; } - + if (options.baBehav[ADDSET_RETI_OFFS]) { pparams.retinex.offs = 0; } - + if (options.baBehav[ADDSET_RETI_VART]) { pparams.retinex.vart = 0; } @@ -613,7 +613,7 @@ void BatchToolPanelCoordinator::initSession () if (options.baBehav[ADDSET_RETI_SLO]) { pparams.retinex.slope = 0; } - + if (options.baBehav[ADDSET_DIRPYRDN_LUMA]) { pparams.dirpyrDenoise.luma = 0; } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index ef4ec5715..4d1907422 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -567,6 +567,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) Gtk::Allocation alloc; iareapanel->imageArea->on_resized(alloc); } + history->resetSnapShotNumber(); } diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 81cf57736..08433357c 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -1053,7 +1053,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (retinex.lhcurve) { toEdit.retinex.lhcurve = mods.retinex.lhcurve; } - + if (retinex.transmissionCurve) { toEdit.retinex.transmissionCurve = mods.retinex.transmissionCurve; } @@ -1109,10 +1109,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten // if (retinex.grbl) { // toEdit.retinex.grbl = mods.retinex.grbl; // } - + if (retinex.gain) { toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_RETI_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain; - } + } if (retinex.offs) { toEdit.retinex.offs = dontforceSet && options.baBehav[ADDSET_RETI_OFFS] ? toEdit.retinex.offs + mods.retinex.offs : mods.retinex.offs; diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index 17f23a787..ec2320138 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -701,7 +701,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param if (!retinex->get_active ()) { filterPE.retinex = falsePE.retinex; } - + if (!pcvignette->get_active ()) { filterPE.pcvignette = falsePE.pcvignette; } diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index 8a0250f84..22c53aa00 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -181,7 +181,7 @@ Gtk::Widget* Preferences::getBatchProcPanel () appendBehavList (mi, M("TP_RETINEX_OFFSET"), ADDSET_RETI_OFFS, false); appendBehavList (mi, M("TP_RETINEX_THRESHOLD"), ADDSET_RETI_LIMD, false); appendBehavList (mi, M("TP_RETINEX_VARIANCE"), ADDSET_RETI_VART, false); - + mi = behModel->append (); mi->set_value (behavColumns.label, M("TP_SHADOWSHLIGHTS_LABEL")); appendBehavList (mi, M("TP_SHADOWSHLIGHTS_HIGHLIGHTS"), ADDSET_SH_HIGHLIGHTS, false); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 73e604e2e..2613cf8da 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -321,12 +321,12 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"), baselog->delay = 200; } -/* grbl->setAdjusterListener (this); + /* grbl->setAdjusterListener (this); - if (grbl->delay < 200) { - grbl->delay = 200; - } -*/ + if (grbl->delay < 200) { + grbl->delay = 200; + } + */ pack_start (*retinexVBox); pack_start (*expsettings); pack_start (*neutrHBox); @@ -671,18 +671,21 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited) void Retinex::retinexMethodChanged() { - if(retinexMethod->get_active_row_number() == 3) highl->show(); - else highl->hide(); + if(retinexMethod->get_active_row_number() == 3) { + highl->show(); + } else { + highl->hide(); + } if (listener) { - listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); + listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ()); } } void Retinex::ColorSpaceUpdateUI () { if (!batchMode) { - curveEditorGH->show(); + curveEditorGH->show(); if(retinexcolorspace->get_active_row_number() == 0) { curveEditorGD->show(); @@ -941,9 +944,9 @@ void Retinex::colorForValue (double valX, double valY, enum ColorCaller::ElemTyp float value = (1.f - 0.7f) * float(valX) + 0.7f; - // whole hue range - // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) - Color::hsv2rgb01(float(valY), float(valX), value, R, G, B); + // whole hue range + // Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before) + Color::hsv2rgb01(float(valY), float(valX), value, R, G, B); } else if (callerId == 4) { // LH - bottom bar Color::hsv2rgb01(float(valX), 0.5f, float(valY), R, G, B); } else if (callerId == 5) { // HH - bottom bar diff --git a/rtgui/retinex.h b/rtgui/retinex.h index 09912341e..a9b462808 100644 --- a/rtgui/retinex.h +++ b/rtgui/retinex.h @@ -42,7 +42,7 @@ protected: Gtk::HBox* gambox; Gtk::Button* neutral; Gtk::HBox* neutrHBox; - + MyComboBoxText* retinexMethod; MyComboBoxText* retinexcolorspace; MyComboBoxText* gammaretinex; @@ -99,7 +99,7 @@ public: void updateToolState (std::vector &tpOpen); void setAdjusterBehavior (bool strAdd, bool neighAdd, bool scalAdd, bool limdAdd, bool gainAdd, bool offsAdd, bool vartAdd, bool gamAdd, bool slopeAdd); void updateCurveBackgroundHistogram (LUTu & histToneCurve, LUTu & histLCurve, LUTu & histCCurve,/* LUTu & histCLurve, LUTu & histLLCurve,*/ LUTu & histLCAM, LUTu & histCCAM, LUTu & histRed, LUTu & histGreen, LUTu & histBlue, LUTu & histLuma, LUTu & histLRETI); - + virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); private: From a51ac8b905c69a8fbfa9fe7f5c3a6f1e665a170d Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Sat, 17 Oct 2015 15:25:37 +0200 Subject: [PATCH 68/71] a little remaining astyle --- rtgui/history.h | 5 ++++- rtgui/threadutils.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/rtgui/history.h b/rtgui/history.h index daf3b9205..760444b5f 100644 --- a/rtgui/history.h +++ b/rtgui/history.h @@ -126,7 +126,10 @@ public: void redo (); bool blistenerLock; - void resetSnapShotNumber() {bmnum = 1;}; + void resetSnapShotNumber() + { + bmnum = 1; + }; }; #endif diff --git a/rtgui/threadutils.h b/rtgui/threadutils.h index 2ee654c4e..b7231d5de 100644 --- a/rtgui/threadutils.h +++ b/rtgui/threadutils.h @@ -260,7 +260,7 @@ public: inline MyReaderLock(MyRWMutex& mutex, const char* name, const char* file, const int line) : rwMutex(mutex), locked(false), locknumber(0) #else public: - inline MyReaderLock(MyRWMutex& mutex) : rwMutex(mutex) + inline MyReaderLock(MyRWMutex & mutex) : rwMutex(mutex) #endif { @@ -496,7 +496,7 @@ public: inline MyWriterLock(MyRWMutex& mutex, const char* name, const char* file, const int line) : rwMutex(mutex), locked(false), locknumber(0) #else public: - inline MyWriterLock(MyRWMutex& mutex) : rwMutex(mutex) + inline MyWriterLock(MyRWMutex & mutex) : rwMutex(mutex) #endif { // to operate safely From 4ace3d96bc1367dc2fab354b596367ee0a243edd Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Sat, 17 Oct 2015 16:05:35 +0200 Subject: [PATCH 69/71] interface language translation files updated --- rtdata/languages/Catala | 83 +++++++++++-- rtdata/languages/Chinese (Simplified) | 83 +++++++++++-- rtdata/languages/Chinese (Traditional) | 83 +++++++++++-- rtdata/languages/Czech | 86 +++++++++++--- rtdata/languages/Dansk | 83 +++++++++++-- rtdata/languages/Deutsch | 77 ++++++++++-- rtdata/languages/English (UK) | 83 +++++++++++-- rtdata/languages/English (US) | 83 +++++++++++-- rtdata/languages/Espanol | 83 +++++++++++-- rtdata/languages/Euskara | 83 +++++++++++-- rtdata/languages/Francais | 81 +++++++++++-- rtdata/languages/Greek | 83 +++++++++++-- rtdata/languages/Hebrew | 83 +++++++++++-- rtdata/languages/Italiano | 83 +++++++++++-- rtdata/languages/Japanese | 81 +++++++++++-- rtdata/languages/Latvian | 83 +++++++++++-- rtdata/languages/Magyar | 83 +++++++++++-- rtdata/languages/Nederlands | 86 +++++++++++--- rtdata/languages/Norsk BM | 83 +++++++++++-- rtdata/languages/Polish | 83 +++++++++++-- rtdata/languages/Polish (Latin Characters) | 83 +++++++++++-- rtdata/languages/Portugues (Brasil) | 83 +++++++++++-- rtdata/languages/Russian | 83 +++++++++++-- rtdata/languages/Serbian (Cyrilic Characters) | 83 +++++++++++-- rtdata/languages/Serbian (Latin Characters) | 83 +++++++++++-- rtdata/languages/Slovak | 83 +++++++++++-- rtdata/languages/Suomi | 83 +++++++++++-- rtdata/languages/Swedish | 83 +++++++++++-- rtdata/languages/Turkish | 83 +++++++++++-- rtdata/languages/default | 110 ++++++++---------- 30 files changed, 2134 insertions(+), 379 deletions(-) diff --git a/rtdata/languages/Catala b/rtdata/languages/Catala index f8e21bdc1..7a7d4e400 100644 --- a/rtdata/languages/Catala +++ b/rtdata/languages/Catala @@ -495,7 +495,6 @@ PARTIALPASTE_FLATFIELDBLURRADIUS;Radi borrositat CP PARTIALPASTE_FLATFIELDBLURTYPE;Tipus borrositat CP PARTIALPASTE_FLATFIELDFILE;Fitxer de camp pla PARTIALPASTE_HSVEQUALIZER;Equalitzador HSV -PARTIALPASTE_ICMGAMMA;Sortida gama PARTIALPASTE_ICMSETTINGS;Ajustos gestió de color PARTIALPASTE_IMPULSEDENOISE;Impuls de reducció de soroll PARTIALPASTE_IPTCINFO;Dades IPTC @@ -1274,6 +1273,26 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 !MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3 @@ -1306,6 +1325,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !PARTIALPASTE_PREPROCESS_DEADPIXFILT;Dead pixel filter !PARTIALPASTE_PREPROCESS_HOTPIXFILT;Hot pixel filter !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1590,7 +1610,7 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1722,6 +1742,54 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_LUMAMODE;Luminosity mode !TP_RGBCURVES_LUMAMODE_TOOLTIP;Luminosity mode allows to vary the contribution of R, G and B channels to the luminosity of the image, without altering image color. !TP_SAVEDIALOG_OK_TIP;Shortcut: Ctrl-Enter @@ -1751,7 +1819,6 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1765,7 +1832,6 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1777,9 +1843,9 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1842,7 +1908,6 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1889,10 +1954,6 @@ ZOOMPANEL_ZOOMOUT;Allunya\nDrecera: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Chinese (Simplified) b/rtdata/languages/Chinese (Simplified) index 11c13d31a..38a6e31f8 100644 --- a/rtdata/languages/Chinese (Simplified) +++ b/rtdata/languages/Chinese (Simplified) @@ -402,7 +402,6 @@ PARTIALPASTE_EXIFCHANGES;对exif所做的修改 PARTIALPASTE_EXPOSURE;曝光 PARTIALPASTE_GRADIENT;渐变过滤 PARTIALPASTE_HSVEQUALIZER;HSV均衡 -PARTIALPASTE_ICMGAMMA;到处伽吗值 PARTIALPASTE_ICMSETTINGS;ICM 设置 PARTIALPASTE_IPTCINFO;IPTC 信息 PARTIALPASTE_LABCURVE;Lab调整 @@ -1188,6 +1187,26 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 !MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3 !MAIN_BUTTON_NAVSYNC_TOOLTIP;Synchronize the File Browser or Filmstrip with the Editor to reveal the thumbnail of the currently opened image, and clear any active filters.\nShortcut: x\n\nAs above, but without clearing active filters:\nShortcut: y\n(Note that the thumbnail of the opened image will not be shown if filtered out). @@ -1234,6 +1253,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1522,7 +1542,7 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1689,6 +1709,54 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix !TP_RESIZE_APPLIESTO;Applies to: +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_SHARPENING_TOOLTIP;Expect a slightly different effect when using with CIECAM02. If difference is observed, adjust to taste. !TP_SHARPENMICRO_LABEL;Microcontrast !TP_SHARPENMICRO_MATRIX;3×3 matrix instead of 5×5 @@ -1734,7 +1802,6 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1748,7 +1815,6 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1760,9 +1826,9 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1825,7 +1891,6 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1872,10 +1937,6 @@ ZOOMPANEL_ZOOMOUT;缩放拉远\n快捷键: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Chinese (Traditional) b/rtdata/languages/Chinese (Traditional) index 710706d1b..55433c068 100644 --- a/rtdata/languages/Chinese (Traditional) +++ b/rtdata/languages/Chinese (Traditional) @@ -922,6 +922,26 @@ TP_WBALANCE_TEMPERATURE;色溫 !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1002,7 +1022,6 @@ TP_WBALANCE_TEMPERATURE;色溫 !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1024,6 +1043,7 @@ TP_WBALANCE_TEMPERATURE;色溫 !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1399,7 +1419,7 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1656,6 +1676,54 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_RESIZE_FITBOX;Bounding Box !TP_RESIZE_FULLIMAGE;Full Image !TP_RESIZE_LANCZOS;Lanczos +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1719,7 +1787,6 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1733,7 +1800,6 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1745,9 +1811,9 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1810,7 +1876,6 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1857,10 +1922,6 @@ TP_WBALANCE_TEMPERATURE;色溫 !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Czech b/rtdata/languages/Czech index 8deab96b5..c1610bb87 100644 --- a/rtdata/languages/Czech +++ b/rtdata/languages/Czech @@ -747,7 +747,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field kontrola oříznutí PARTIALPASTE_FLATFIELDFILE;Flat Field soubor PARTIALPASTE_GRADIENT;Přechodový filtr PARTIALPASTE_HSVEQUALIZER;HSV korekce -PARTIALPASTE_ICMGAMMA;Výstupní gama PARTIALPASTE_ICMSETTINGS;Nastavení správy barev PARTIALPASTE_IMPULSEDENOISE;Redukce impulzního šumu PARTIALPASTE_IPTCINFO;IPTC @@ -1604,7 +1603,6 @@ TP_WAVELET_6;Úroveň 6 TP_WAVELET_7;Úroveň 7 TP_WAVELET_8;Úroveň 8 TP_WAVELET_9;Úroveň 9 -TP_WAVELET_ALL;Všechny úrovně ve všech směrech TP_WAVELET_APPLYTO;Použít na TP_WAVELET_AVOID;Zabránit posunu barev TP_WAVELET_CH1;Všechny barvy @@ -1621,7 +1619,6 @@ TP_WAVELET_CONTRA;Kontrast TP_WAVELET_CONTRA_TOOLTIP;Změní kontrast zůstatku obrazu\nFunkce maximálních úrovní TP_WAVELET_CONTR;Paleta - nastavení TP_WAVELET_DALL;Všechny směry -TP_WAVELET_DISP;Nastavení náhledu TP_WAVELET_DONE;Svisle TP_WAVELET_DTHR;Napříč TP_WAVELET_DTWO;Vodorovně @@ -1637,7 +1634,6 @@ TP_WAVELET_HUESKIN;Rozsah odstínů (pleť) TP_WAVELET_HUESKIN_TOOLTIP;Pyramida je pro horní část, kde je algoritmus nejvíce efektivní.\nKe spodní části, tranzitním zónám.\nPokud potřebujete posunout oblast hodně doleva nebo doprava - nebo pokud se vyskytnou artefakty = vyvážení bílé není správné, můžete mírně zmenšit zónu aby jste zabránili ovlivnění ostatních částí obrázku. TP_WAVELET_HUESKY;Rozsah odstínů (obloha) TP_WAVELET_HUESKY_TOOLTIP;Pyramida je pro horní část, kde je algoritmus nejvíce efektivní.\nKe spodní části, tranzitním zónám.\nPokud potřebujete posunout oblast hodně doleva nebo doprava - nebo pokud se vyskytnou artefakty = vyvážení bílé není správné, můžete mírně zmenšit zónu aby jste zabránili ovlivnění ostatních částí obrázku. -TP_WAVELET_INF;Méně nebo shodně s úrovní TP_WAVELET_LABEL;Úrovně vlnky TP_WAVELET_LARGEST;Nejhrubší TP_WAVELET_LEVCH;Barevnost @@ -1648,10 +1644,8 @@ TP_WAVELET_LEVLABEL;Náhled maximálně dostupné úrovně=%1 TP_WAVELET_LOWLIGHT;Rozsah projasnění stínů TP_WAVELET_MEDI;Omezení artefaktů na modré obloze TP_WAVELET_NEUTRAL;Neutrální -TP_WAVELET_ONE;Jedna úroveň TP_WAVELET_OPACITY;Neprůhlednost modrá-žlutá Úrovně TP_WAVELET_PASTEL;Barevnost pastelů -TP_WAVELET_PREVIEWLEVELS;Náhled TP_WAVELET_RESCHRO;Barevnost TP_WAVELET_RESCONH;Světla TP_WAVELET_RESCON;Stíny @@ -1814,8 +1808,29 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_CURVEBBOXPOS;Position of curve copypasta buttons !PREFERENCES_CURVEBBOXPOS_ABOVE;Above @@ -1848,6 +1863,54 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !TP_PRSHARPENING_TOOLTIP;Sharpens the image after resizing. Only works when the "Lanczos" resizing method is used. It is impossible to preview the effects of this tool. See RawPedia for usage instructions. !TP_RAW_HD;Threshold !TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, but false positives may lead to artifacts. If you notice any artifacts appearing when enabling the Hot/Dead Pixel Filters, gradually increase the threshold value until they disappear. +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_B0;Black !TP_WAVELET_B1;Grey !TP_WAVELET_B2;Residual @@ -1861,22 +1924,20 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CHCU;Curve !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. !TP_WAVELET_COMPTM;Tone mapping !TP_WAVELET_CONTEDIT;'After' contrast curve !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1916,7 +1977,6 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection !TP_WAVELET_MEDILEV_TOOLTIP;When you enable Edge Detection, it is recommanded:\n- to disabled low contrast levels to avoid artifacts,\n- to use high values of gradient sensitivity.\n\nYou can modulate the strength with 'refine' from Denoise and Refine. @@ -1934,10 +1994,6 @@ ZOOMPANEL_ZOOMOUT;Oddálit\nZkratka: - !TP_WAVELET_RE1;Reinforced !TP_WAVELET_RE2;Unchanged !TP_WAVELET_RE3;Reduced -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Dansk b/rtdata/languages/Dansk index 66acbfb22..8c3c0d651 100644 --- a/rtdata/languages/Dansk +++ b/rtdata/languages/Dansk @@ -918,6 +918,26 @@ TP_WBALANCE_TEMPERATURE;Temperatur !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1000,7 +1020,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1022,6 +1041,7 @@ TP_WBALANCE_TEMPERATURE;Temperatur !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1397,7 +1417,7 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1655,6 +1675,54 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1718,7 +1786,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1732,7 +1799,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1744,9 +1810,9 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1809,7 +1875,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1856,10 +1921,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch index 362879fa6..a7afd6fdc 100644 --- a/rtdata/languages/Deutsch +++ b/rtdata/languages/Deutsch @@ -818,7 +818,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Weißbild: Kontrolle zu heller Bereiche PARTIALPASTE_FLATFIELDFILE;Weißbild: Datei PARTIALPASTE_GRADIENT;Grauverlaufsfilter PARTIALPASTE_HSVEQUALIZER;Farbton (H) / Sättigung (S) / Dynamik (V) -PARTIALPASTE_ICMGAMMA;Ausgabe-Gamma PARTIALPASTE_ICMSETTINGS;ICM-Einstellungen PARTIALPASTE_IMPULSEDENOISE;Impulsrauschreduzierung PARTIALPASTE_IPTCINFO;IPTC-Informationen @@ -1722,7 +1721,6 @@ TP_WAVELET_BANONE;Keine TP_WAVELET_BASLI;Regler TP_WAVELET_BATYPE;Kontrastmethode TP_WAVELET_CBENAB;Farbausgleich -TP_WAVELET_CBTYPE;Farbausgleich TP_WAVELET_CCURVE;Lokaler Kontrast TP_WAVELET_CH1;Gesamter Farbbereich TP_WAVELET_CH2;Sättigung/Pastell @@ -1735,7 +1733,6 @@ TP_WAVELET_CHR_TOOLTIP;Farbton als Funktion des Kontrasts und der Farbton-Kontra TP_WAVELET_CHSL;Regler TP_WAVELET_CHTYPE;Chrominanzmethode TP_WAVELET_COLORT;Deckkraft Rot/Grün -TP_WAVELET_COMBOTH;Beide TP_WAVELET_COMPCONT;Kontrast TP_WAVELET_COMPGAMMA;Gammakompression TP_WAVELET_COMPGAMMA_TOOLTIP;Das Anpassen des Gammawerts des Nachbildes ermöglicht das Angleichen der Daten und des Histogramms @@ -1812,7 +1809,6 @@ TP_WAVELET_LEVTWO;Ebene 3 TP_WAVELET_LEVZERO;Ebene 1 TP_WAVELET_LINKEDG;Mit der Kantenschärfungsstärke verlinken TP_WAVELET_LIPST;Erweiterter Algorithmus -TP_WAVELET_LIPST_TOOLTIP;Dieser Algorithmus verwendet einen Pixel und acht seiner Nachbarn. Sind die Unterschiede gering, werden die Ränder verstärkt. TP_WAVELET_LOWLIGHT;Schatten-Luminanzbereich TP_WAVELET_MEDGREINF;Erste Ebene TP_WAVELET_MEDILEV;Kantenerkennung @@ -1859,10 +1855,6 @@ TP_WAVELET_TILESFULL;Ganzes Bild TP_WAVELET_TILESIZE;Kachelgröße TP_WAVELET_TILESLIT;Kleine Kacheln TP_WAVELET_TILES_TOOLTIP;“Ganzes Bild“ (empfohlen) liefert eine bessere Qualität.\n“Kacheln“ benötigen weniger Speicher und sind nur für Computer mit wenig RAM zu empfehlen. -TP_WAVELET_TMHIGH;Hoch -TP_WAVELET_TMLOWHIGH;Niedrig + Hoch -TP_WAVELET_TMNONE;Keine -TP_WAVELET_TMSTD;Standard TP_WAVELET_TMSTRENGTH;Stärke TP_WAVELET_TMSTRENGTH_TOOLTIP;Kontrolliert die Stärke der Dynamik- oder Kontrastkompression des Nachbildes. Ist der Wert ungleich 0, werden die Stärke- und Gammaregler des Dynamikkompressions-Werkzeugs im Belichtungsreiter deaktiviert. TP_WAVELET_TMTYPE;Kompression @@ -1925,4 +1917,73 @@ ZOOMPANEL_ZOOMOUT;Herauszoomen\nTaste: - ! Untranslated keys follow; remove the ! prefix after an entry is translated. !!!!!!!!!!!!!!!!!!!!!!!!! +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer +!PARTIALPASTE_RETINEX;Retinex +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted diff --git a/rtdata/languages/English (UK) b/rtdata/languages/English (UK) index 9df9ea9b6..e30422f98 100644 --- a/rtdata/languages/English (UK) +++ b/rtdata/languages/English (UK) @@ -20,6 +20,7 @@ HISTORY_MSG_257;Colour Toning HISTORY_MSG_258;CT - Colour curve HISTORY_MSG_322;W - Gamut - Avoid colour shift HISTORY_MSG_385;W - Residual - Colour Balance +HISTORY_MSG_419;Retinex - Colour space MAIN_TAB_COLOR;Colour MAIN_TOOLTIP_BACKCOLOR0;Background colour of the preview: Theme-based\nShortcut: 9 MAIN_TOOLTIP_BACKCOLOR1;Background colour of the preview: Black\nShortcut: 9 @@ -96,7 +97,6 @@ TP_VIGNETTING_CENTER_X;Centre X TP_VIGNETTING_CENTER_Y;Centre Y TP_WAVELET_AVOID;Avoid colour shift TP_WAVELET_CBENAB;Toning and Colour Balance -TP_WAVELET_CBTYPE;Toning and Colour Balance TP_WAVELET_CB_TOOLTIP;For strong values product colour-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted TP_WAVELET_CHRO_TOOLTIP;Sets the wavelet level which will be the threshold between saturated and pastel colours.\n1-x: saturated\nx-9: pastel\n\nIf the value exceeds the amount of wavelet levels you are using then it will be ignored. TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "white balance" by modulating the blue/red balance.\nThis can be useful when shooting conditions:\na) are far from the standard illuminant (e.g. underwater),\nb) are far from conditions where calibrations were performed,\nc) where the matrices or ICC profiles are unsuitable. @@ -716,6 +716,25 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT;Add !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !HISTORY_SNAPSHOTS;Snapshots @@ -872,7 +891,6 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_IPTCINFO;IPTC !PARTIALPASTE_LABCURVE;L*a*b* adjustments @@ -897,6 +915,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps !PARTIALPASTE_RESIZE;Resize +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_ROTATION;Rotation !PARTIALPASTE_SHADOWSHIGHLIGHTS;Shadows/highlights @@ -1354,7 +1373,7 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. !TP_DIRPYRDENOISE_CURVEEDITOR_L_TOOLTIP;Modulates action of 'Luminance' denoise @@ -1622,6 +1641,54 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width !TP_RESIZE_W;Width: +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1717,7 +1784,6 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1729,9 +1795,9 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1794,7 +1860,6 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1841,10 +1906,6 @@ TP_WBALANCE_EQBLUERED_TOOLTIP;Allows to deviate from the normal behaviour of "wh !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/English (US) b/rtdata/languages/English (US) index 34413967d..9edc36113 100644 --- a/rtdata/languages/English (US) +++ b/rtdata/languages/English (US) @@ -636,6 +636,26 @@ !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT;Add !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !HISTORY_SNAPSHOTS;Snapshots @@ -798,7 +818,6 @@ !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_ICMSETTINGS;Color management settings !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_IPTCINFO;IPTC @@ -825,6 +844,7 @@ !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps !PARTIALPASTE_RESIZE;Resize +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_ROTATION;Rotation !PARTIALPASTE_SHADOWSHIGHLIGHTS;Shadows/highlights @@ -1319,7 +1339,7 @@ !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1611,6 +1631,54 @@ !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width !TP_RESIZE_W;Width: +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1702,7 +1770,6 @@ !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1716,7 +1783,6 @@ !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1728,9 +1794,9 @@ !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1793,7 +1859,6 @@ !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1840,10 +1905,6 @@ !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Espanol b/rtdata/languages/Espanol index 05611d2da..a8777b87e 100644 --- a/rtdata/languages/Espanol +++ b/rtdata/languages/Espanol @@ -722,7 +722,6 @@ PARTIALPASTE_FLATFIELDBLURTYPE;Tipo de difuminado de campo plano PARTIALPASTE_FLATFIELDCLIPCONTROL;Control de recorte de Campo Plano PARTIALPASTE_FLATFIELDFILE;Archivo de campo plano PARTIALPASTE_HSVEQUALIZER;Ecualizador HSV -PARTIALPASTE_ICMGAMMA;Gamma de salida PARTIALPASTE_ICMSETTINGS;Ajustes de Gestión de Color PARTIALPASTE_IMPULSEDENOISE;Impulsar Reducción de ruido PARTIALPASTE_IPTCINFO;Información IPTC @@ -1678,6 +1677,26 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_INSPECT; Inspect !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w @@ -1692,6 +1711,7 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !NAVIGATOR_V;V: !PARTIALPASTE_EQUALIZER;Wavelet levels !PARTIALPASTE_GRADIENT;Graduated filter +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1760,7 +1780,7 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1795,6 +1815,54 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_PRSHARPENING_TOOLTIP;Sharpens the image after resizing. Only works when the "Lanczos" resizing method is used. It is impossible to preview the effects of this tool. See RawPedia for usage instructions. !TP_RAW_HD;Threshold !TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, but false positives may lead to artifacts. If you notice any artifacts appearing when enabling the Hot/Dead Pixel Filters, gradually increase the threshold value until they disappear. +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 @@ -1819,7 +1887,6 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1833,7 +1900,6 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1845,9 +1911,9 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1910,7 +1976,6 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1957,10 +2022,6 @@ ZOOMPANEL_ZOOMOUT;Reducir Zoom\nAtajo: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Euskara b/rtdata/languages/Euskara index e2365b060..bc4f034f8 100644 --- a/rtdata/languages/Euskara +++ b/rtdata/languages/Euskara @@ -918,6 +918,26 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1000,7 +1020,6 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1022,6 +1041,7 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1397,7 +1417,7 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1655,6 +1675,54 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1718,7 +1786,6 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1732,7 +1799,6 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1744,9 +1810,9 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1809,7 +1875,6 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1856,10 +1921,6 @@ TP_WBALANCE_TEMPERATURE;Tenperatura !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 96d75c07e..f9ea84a66 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -796,7 +796,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Contrôle de l'écrêtage du Champs Uniforme PARTIALPASTE_FLATFIELDFILE;Fichier de Champ Uniforme PARTIALPASTE_GRADIENT;Filtre Dégradé PARTIALPASTE_HSVEQUALIZER;Égaliseur TSV -PARTIALPASTE_ICMGAMMA;Gamma de sortie PARTIALPASTE_ICMSETTINGS;Réglages ICM PARTIALPASTE_IMPULSEDENOISE;Réduction du bruit d'impulsion PARTIALPASTE_IPTCINFO;Infos IPTC @@ -1700,7 +1699,6 @@ TP_WAVELET_BANONE;Aucun TP_WAVELET_BASLI;Curseur TP_WAVELET_BATYPE;Bal. du contraste par TP_WAVELET_CBENAB;Virage Partiel et Balance Couleur -TP_WAVELET_CBTYPE;Virage Partiel et Balance Couleur TP_WAVELET_CB_TOOLTIP;Pour les valeurs élevées, produit un virage partiel en les combinant ou non avec les valeurs (courbes) spécifiées dans 'Virage'\nPour les faible valeurs, vous pouvez changer la balance des blancs du fond (ciel, ...) sans changer celui du premier plan, généralement plus contrasté. TP_WAVELET_CCURVE;Contraste local TP_WAVELET_CH1;Plage chromatique complète @@ -1714,7 +1712,6 @@ TP_WAVELET_CHR_TOOLTIP;Ajuste le chroma en fonction des "niveaux de contraste" e TP_WAVELET_CHSL;Curseurs TP_WAVELET_CHTYPE;Méthode de chrominance TP_WAVELET_COLORT;Opacité Rouge-Vert -TP_WAVELET_COMBOTH;Les deux TP_WAVELET_COMPCONT;Contraste TP_WAVELET_COMPGAMMA;Compression gamma TP_WAVELET_COMPGAMMA_TOOLTIP;Ajuster le gamma de l'image résiduelle vous permet d'équiilibrer les données de l'histograme. @@ -1791,7 +1788,6 @@ TP_WAVELET_LEVTWO;Niveau 3 TP_WAVELET_LEVZERO;Niveau 1 TP_WAVELET_LINKEDG;Lier à la 'Force' de la 'Netteté des bords' TP_WAVELET_LIPST;Algorithme amélioré -TP_WAVELET_LIPST_TOOLTIP;Cet algorithme utilise la proximité d'un pixel et huit de ses voisins. Si moins de différence, les bords sont renforcés. TP_WAVELET_LOWLIGHT;Plage de luminance des ombres TP_WAVELET_MEDGREINF;Premier niveau TP_WAVELET_MEDILEV;Détection des bords @@ -1838,10 +1834,6 @@ TP_WAVELET_TILESFULL;Image entière TP_WAVELET_TILESIZE;Méthode de découpage TP_WAVELET_TILESLIT;Petites tuiles TP_WAVELET_TILES_TOOLTIP;Traiter l'image entière donnera les meilleurs résulats et est l'option recommandé, l'usage des tuiles étant une solution alternative recommandé pour les utilisateurs disposant de peu de RAM. Cf. RawPedia pour la configuration mémoire requise. -TP_WAVELET_TMHIGH;Haut -TP_WAVELET_TMLOWHIGH;Bas+Haut -TP_WAVELET_TMNONE;Aucun -TP_WAVELET_TMSTD;Standard TP_WAVELET_TMSTRENGTH;Force de la compression TP_WAVELET_TMSTRENGTH_TOOLTIP;Contrôle la force de la compression tonale ou de la compression de contraste de l'image résiduelle. Lorsque la valeur est différente de 0, les curseurs Force et Gamma de l'outil Compression Tonale dans l'onglet Exposition seront grisés. TP_WAVELET_TMTYPE;Méthode de compression @@ -1901,3 +1893,76 @@ ZOOMPANEL_ZOOMFITSCREEN;Ajuster à la fenêtre\nRaccourci: f ZOOMPANEL_ZOOMIN;Zoom Avant\nRaccourci: + ZOOMPANEL_ZOOMOUT;Zoom Arrière\nRaccourci: - +!!!!!!!!!!!!!!!!!!!!!!!!! +! Untranslated keys follow; remove the ! prefix after an entry is translated. +!!!!!!!!!!!!!!!!!!!!!!!!! + +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer +!PARTIALPASTE_RETINEX;Retinex +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. diff --git a/rtdata/languages/Greek b/rtdata/languages/Greek index 1529e40c4..a02384e50 100644 --- a/rtdata/languages/Greek +++ b/rtdata/languages/Greek @@ -917,6 +917,26 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -999,7 +1019,6 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1021,6 +1040,7 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1396,7 +1416,7 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1654,6 +1674,54 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1717,7 +1785,6 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1731,7 +1798,6 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1743,9 +1809,9 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1808,7 +1874,6 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1855,10 +1920,6 @@ TP_WBALANCE_TEMPERATURE;Θερμοκρασία !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Hebrew b/rtdata/languages/Hebrew index a2cd5a37f..4d17da309 100644 --- a/rtdata/languages/Hebrew +++ b/rtdata/languages/Hebrew @@ -918,6 +918,26 @@ TP_WBALANCE_TEMPERATURE;מידת חום !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1000,7 +1020,6 @@ TP_WBALANCE_TEMPERATURE;מידת חום !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1022,6 +1041,7 @@ TP_WBALANCE_TEMPERATURE;מידת חום !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1397,7 +1417,7 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1655,6 +1675,54 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1718,7 +1786,6 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1732,7 +1799,6 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1744,9 +1810,9 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1809,7 +1875,6 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1856,10 +1921,6 @@ TP_WBALANCE_TEMPERATURE;מידת חום !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Italiano b/rtdata/languages/Italiano index 253ce2f50..520011c11 100644 --- a/rtdata/languages/Italiano +++ b/rtdata/languages/Italiano @@ -627,7 +627,6 @@ PARTIALPASTE_FLATFIELDBLURTYPE;Flat Field - Modalità di sfocamento PARTIALPASTE_FLATFIELDFILE;File Flat Field PARTIALPASTE_GRADIENT;Filtro Graduato PARTIALPASTE_HSVEQUALIZER;Equalizzatore HSV -PARTIALPASTE_ICMGAMMA;Gamma di uscita PARTIALPASTE_ICMSETTINGS;Impostazioni Gestione Colore PARTIALPASTE_IMPULSEDENOISE;Riduzione Rumore Puntuale PARTIALPASTE_IPTCINFO;Informazioni IPTC @@ -1542,6 +1541,26 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_INSPECT; Inspect !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w @@ -1551,6 +1570,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field clip control !PARTIALPASTE_PREPROCESS_DEADPIXFILT;Dead pixel filter !PARTIALPASTE_PREPROCESS_HOTPIXFILT;Hot pixel filter +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1661,7 +1681,7 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1737,6 +1757,54 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 @@ -1761,7 +1829,6 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1775,7 +1842,6 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1787,9 +1853,9 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1852,7 +1918,6 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1899,10 +1964,6 @@ ZOOMPANEL_ZOOMOUT;Rimpicciolisci.\nScorciatoia: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Japanese b/rtdata/languages/Japanese index 206228497..55a737344 100644 --- a/rtdata/languages/Japanese +++ b/rtdata/languages/Japanese @@ -829,7 +829,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;フラットフィールド クリップコ PARTIALPASTE_FLATFIELDFILE;フラットフィールド ファイル PARTIALPASTE_GRADIENT;グラデーションフィルター PARTIALPASTE_HSVEQUALIZER;HSV イコライザ -PARTIALPASTE_ICMGAMMA;出力ガンマ PARTIALPASTE_ICMSETTINGS;ICM 設定 PARTIALPASTE_IMPULSEDENOISE;インパルス・ノイズ低減 PARTIALPASTE_IPTCINFO;IPTC 情報 @@ -1733,7 +1732,6 @@ TP_WAVELET_BANONE;なし TP_WAVELET_BASLI;スライダー TP_WAVELET_BATYPE;バランス方式 TP_WAVELET_CBENAB;カラートーンとカラーバランス -TP_WAVELET_CBTYPE;カラートーンとカラーバランス TP_WAVELET_CB_TOOLTIP;高い値は、’カラートーン’と併用するか、或いはカラートーンは使わないで単独で使います。\n低い値の場合は前景の色合いを変えずに背景(sky, ...) のホワイトバランスを変えるような効果を得られます。一般的にはコントラストが高くなる印象があります。 TP_WAVELET_CCURVE;ローカルコントラスト TP_WAVELET_CH1;全ての色 @@ -1747,7 +1745,6 @@ TP_WAVELET_CHR_TOOLTIP;色度を”コントラストレベル”と”色度と TP_WAVELET_CHSL;スライダー TP_WAVELET_CHTYPE;調整の方法 TP_WAVELET_COLORT;レッド/グリーンの不透明度 -TP_WAVELET_COMBOTH;両方 TP_WAVELET_COMPCONT;コントラスト TP_WAVELET_COMPGAMMA;ガンマの圧縮 TP_WAVELET_COMPGAMMA_TOOLTIP;残差画像のガンマを調整することで、画像データとヒストグラムの均衡を図ります。 @@ -1824,7 +1821,6 @@ TP_WAVELET_LEVTWO;レベル3 TP_WAVELET_LEVZERO;レベル1 TP_WAVELET_LINKEDG;エッジのシャープネスの強さとリンク TP_WAVELET_LIPST;高度なアルゴリズム -TP_WAVELET_LIPST_TOOLTIP;リプシッツ連続というアルゴリズムを使います。処理時間とメモリー消費量は増えますが、エッジ検出の精度は上がります TP_WAVELET_LOWLIGHT;シャドウの輝度範囲 TP_WAVELET_MEDGREINF;最初のレベル TP_WAVELET_MEDILEV;エッジ検出 @@ -1871,10 +1867,6 @@ TP_WAVELET_TILESFULL;画像全体 TP_WAVELET_TILESIZE;タイルのサイズ TP_WAVELET_TILESLIT;小さいタイル TP_WAVELET_TILES_TOOLTIP;画像全体を処理する方が良い結果をもたらすので、推奨される選択です。タイルによる処理はRAMの容量が小さいユーザー向けです。必要なメモリー容量に関してはRawPediaを参照して下さい。 -TP_WAVELET_TMHIGH;高 -TP_WAVELET_TMLOWHIGH;低と高に偏重 -TP_WAVELET_TMNONE;なし -TP_WAVELET_TMSTD;標準 TP_WAVELET_TMSTRENGTH;残差の効力を圧縮 TP_WAVELET_TMSTRENGTH_TOOLTIP;トーンマッピングの強さや残差画像のコントラストの圧縮を加減します。値が0以外の場合、露光補正パネルのトーンマッピングでは、強さとガンマのスライダー無効となります TP_WAVELET_TMTYPE;圧縮の方法 @@ -1933,3 +1925,76 @@ ZOOMPANEL_ZOOMFITSCREEN;画像全体を画面に合わせる\nショートカッ ZOOMPANEL_ZOOMIN;ズームイン\nショートカット: + ZOOMPANEL_ZOOMOUT;ズームアウト\nショートカット: - +!!!!!!!!!!!!!!!!!!!!!!!!! +! Untranslated keys follow; remove the ! prefix after an entry is translated. +!!!!!!!!!!!!!!!!!!!!!!!!! + +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer +!PARTIALPASTE_RETINEX;Retinex +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. diff --git a/rtdata/languages/Latvian b/rtdata/languages/Latvian index 934ded58e..67b4580ce 100644 --- a/rtdata/languages/Latvian +++ b/rtdata/languages/Latvian @@ -918,6 +918,26 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1000,7 +1020,6 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1022,6 +1041,7 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1397,7 +1417,7 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1655,6 +1675,54 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1718,7 +1786,6 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1732,7 +1799,6 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1744,9 +1810,9 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1809,7 +1875,6 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1856,10 +1921,6 @@ TP_WBALANCE_TEMPERATURE;Temperatūra !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Magyar b/rtdata/languages/Magyar index e2390022a..d2073c56f 100644 --- a/rtdata/languages/Magyar +++ b/rtdata/languages/Magyar @@ -477,7 +477,6 @@ PARTIALPASTE_FLATFIELDBLURRADIUS;FF elmosás sugara PARTIALPASTE_FLATFIELDBLURTYPE;FF elmosás típusa PARTIALPASTE_FLATFIELDFILE;Flat field (FF) állomány PARTIALPASTE_HSVEQUALIZER;HSV Equalizer -PARTIALPASTE_ICMGAMMA;Kimeneti gamma PARTIALPASTE_ICMSETTINGS;ICM beállítások PARTIALPASTE_IMPULSEDENOISE;Impulse zajszűrés PARTIALPASTE_IPTCINFO;IPTC információk @@ -1202,6 +1201,26 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 !MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3 @@ -1242,6 +1261,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !PARTIALPASTE_PREPROCESS_DEADPIXFILT;Dead pixel filter !PARTIALPASTE_PREPROCESS_HOTPIXFILT;Hot pixel filter !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1543,7 +1563,7 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1716,6 +1736,54 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_LUMAMODE;Luminosity mode !TP_RGBCURVES_LUMAMODE_TOOLTIP;Luminosity mode allows to vary the contribution of R, G and B channels to the luminosity of the image, without altering image color. !TP_SAVEDIALOG_OK_TIP;Shortcut: Ctrl-Enter @@ -1755,7 +1823,6 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1769,7 +1836,6 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1781,9 +1847,9 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1846,7 +1912,6 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1893,10 +1958,6 @@ ZOOMPANEL_ZOOMOUT;Kicsinyítés - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Nederlands b/rtdata/languages/Nederlands index ef344a423..6d8204721 100644 --- a/rtdata/languages/Nederlands +++ b/rtdata/languages/Nederlands @@ -727,7 +727,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Vlakveld clip controle PARTIALPASTE_FLATFIELDFILE;Vlakveldopname PARTIALPASTE_GRADIENT;Grijsverloop Filter PARTIALPASTE_HSVEQUALIZER;HSV-balans -PARTIALPASTE_ICMGAMMA;Uitvoer gamma PARTIALPASTE_ICMSETTINGS;ICM-instellingen PARTIALPASTE_IMPULSEDENOISE;Spot ruisonderdrukking PARTIALPASTE_IPTCINFO;IPTC-informatie @@ -1580,7 +1579,6 @@ TP_WAVELET_5;Niveau 5 TP_WAVELET_6;Niveau 6 TP_WAVELET_7;Niveau 7 TP_WAVELET_8;Niveau 8 -TP_WAVELET_ALL;Alle niveau-richtingen TP_WAVELET_APPLYTO;Toepassen TP_WAVELET_AVOID;Vermijd kleurverschuiving TP_WAVELET_CH1;Alle chroma's @@ -1597,7 +1595,6 @@ TP_WAVELET_CONTRA;Contrast TP_WAVELET_CONTRA_TOOLTIP;Wijzig contrast in de rest van de afbeelding TP_WAVELET_CONTR;Gamut - controle TP_WAVELET_DALL;Alle richtingen -TP_WAVELET_DISP;Wavelet niveau's TP_WAVELET_DONE;Richting: Vertikaal TP_WAVELET_DTHR;Richting: Diagonaal TP_WAVELET_DTWO;Richting: Horizontaal @@ -1611,7 +1608,6 @@ TP_WAVELET_HS1;Alle luminanties TP_WAVELET_HS2;Hoge lichten/Schaduwen TP_WAVELET_HUESKIN;Tint reeks (huid) TP_WAVELET_HUESKY;Tint Reeks (lucht) -TP_WAVELET_INF;Onder of gelijk aan het niveau TP_WAVELET_LABEL;Wavelet niveau's TP_WAVELET_LARGEST;grof TP_WAVELET_LEVCH;Chromaticiteit @@ -1622,10 +1618,8 @@ TP_WAVELET_LEVLABEL;Voorbeeld maximum mogelijke niveau's=%1 TP_WAVELET_LOWLIGHT;Schaduwen: Luminantie Reeks (0..100) TP_WAVELET_MEDI;Verminder artefacten in blauwe lucht TP_WAVELET_NEUTRAL;Neutraal -TP_WAVELET_ONE;Eén niveau TP_WAVELET_OPACITY;Dekking Blauw-Geel Niveau TP_WAVELET_PASTEL;Pastel chromaciteit -TP_WAVELET_PREVIEWLEVELS;Voorbeeld TP_WAVELET_RESCHRO;Chromaticiteit TP_WAVELET_RESCONH;Hoge lichten TP_WAVELET_RESCON;Schaduwen @@ -1792,8 +1786,29 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISSTD;High !PREFERENCES_CURVEBBOXPOS;Position of curve copypasta buttons @@ -1829,6 +1844,54 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_PRSHARPENING_TOOLTIP;Sharpens the image after resizing. Only works when the "Lanczos" resizing method is used. It is impossible to preview the effects of this tool. See RawPedia for usage instructions. !TP_RAW_HD;Threshold !TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, but false positives may lead to artifacts. If you notice any artifacts appearing when enabling the Hot/Dead Pixel Filters, gradually increase the threshold value until they disappear. +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_9;Level 9 !TP_WAVELET_B0;Black !TP_WAVELET_B1;Grey @@ -1843,22 +1906,20 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CHCU;Curve !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. !TP_WAVELET_COMPTM;Tone mapping !TP_WAVELET_CONTEDIT;'After' contrast curve !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1898,7 +1959,6 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection !TP_WAVELET_MEDILEV_TOOLTIP;When you enable Edge Detection, it is recommanded:\n- to disabled low contrast levels to avoid artifacts,\n- to use high values of gradient sensitivity.\n\nYou can modulate the strength with 'refine' from Denoise and Refine. @@ -1916,10 +1976,6 @@ ZOOMPANEL_ZOOMOUT;Zoom uit\nSneltoets: - !TP_WAVELET_RE1;Reinforced !TP_WAVELET_RE2;Unchanged !TP_WAVELET_RE3;Reduced -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Norsk BM b/rtdata/languages/Norsk BM index f6a598b5e..028fb69ea 100644 --- a/rtdata/languages/Norsk BM +++ b/rtdata/languages/Norsk BM @@ -917,6 +917,26 @@ TP_WBALANCE_TEMPERATURE;Temperatur !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -999,7 +1019,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1021,6 +1040,7 @@ TP_WBALANCE_TEMPERATURE;Temperatur !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1396,7 +1416,7 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1654,6 +1674,54 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1717,7 +1785,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1731,7 +1798,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1743,9 +1809,9 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1808,7 +1874,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1855,10 +1920,6 @@ TP_WBALANCE_TEMPERATURE;Temperatur !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Polish b/rtdata/languages/Polish index 63d153c25..1657da6f2 100644 --- a/rtdata/languages/Polish +++ b/rtdata/languages/Polish @@ -677,7 +677,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Puste pole - Zabezp. przed obcinaniem PARTIALPASTE_FLATFIELDFILE;Puste pole - Wybór PARTIALPASTE_GRADIENT;Filtr połówkowy PARTIALPASTE_HSVEQUALIZER;Ekwalizator HSV -PARTIALPASTE_ICMGAMMA;Gamma wyjściowa PARTIALPASTE_ICMSETTINGS;Ustawienia ICM PARTIALPASTE_IMPULSEDENOISE;Redukcja szumów impulsowych PARTIALPASTE_IPTCINFO;IPTC @@ -1634,10 +1633,31 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_INSPECT; Inspect !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w !PARTIALPASTE_EQUALIZER;Wavelet levels +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1706,7 +1726,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1741,6 +1761,54 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_PRSHARPENING_TOOLTIP;Sharpens the image after resizing. Only works when the "Lanczos" resizing method is used. It is impossible to preview the effects of this tool. See RawPedia for usage instructions. !TP_RAW_HD;Threshold !TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, but false positives may lead to artifacts. If you notice any artifacts appearing when enabling the Hot/Dead Pixel Filters, gradually increase the threshold value until they disappear. +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 @@ -1765,7 +1833,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1779,7 +1846,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1791,9 +1857,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1856,7 +1922,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1903,10 +1968,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrót: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Polish (Latin Characters) b/rtdata/languages/Polish (Latin Characters) index 0289fb0f6..0381c2395 100644 --- a/rtdata/languages/Polish (Latin Characters) +++ b/rtdata/languages/Polish (Latin Characters) @@ -677,7 +677,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Puste pole - Zabezp. przed obcinaniem PARTIALPASTE_FLATFIELDFILE;Puste pole - Wybor PARTIALPASTE_GRADIENT;Filtr polowkowy PARTIALPASTE_HSVEQUALIZER;Ekwalizator HSV -PARTIALPASTE_ICMGAMMA;Gamma wyjsciowa PARTIALPASTE_ICMSETTINGS;Ustawienia ICM PARTIALPASTE_IMPULSEDENOISE;Redukcja szumow impulsowych PARTIALPASTE_IPTCINFO;IPTC @@ -1634,10 +1633,31 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_INSPECT; Inspect !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w !PARTIALPASTE_EQUALIZER;Wavelet levels +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1706,7 +1726,7 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1741,6 +1761,54 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_PRSHARPENING_TOOLTIP;Sharpens the image after resizing. Only works when the "Lanczos" resizing method is used. It is impossible to preview the effects of this tool. See RawPedia for usage instructions. !TP_RAW_HD;Threshold !TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, but false positives may lead to artifacts. If you notice any artifacts appearing when enabling the Hot/Dead Pixel Filters, gradually increase the threshold value until they disappear. +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 @@ -1765,7 +1833,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1779,7 +1846,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1791,9 +1857,9 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1856,7 +1922,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1903,10 +1968,6 @@ ZOOMPANEL_ZOOMOUT;Oddal\nSkrot: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Portugues (Brasil) b/rtdata/languages/Portugues (Brasil) index 26060cd9b..3bd28c81f 100644 --- a/rtdata/languages/Portugues (Brasil) +++ b/rtdata/languages/Portugues (Brasil) @@ -918,6 +918,26 @@ TP_WBALANCE_TEMPERATURE;Temperatura !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1000,7 +1020,6 @@ TP_WBALANCE_TEMPERATURE;Temperatura !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1022,6 +1041,7 @@ TP_WBALANCE_TEMPERATURE;Temperatura !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1397,7 +1417,7 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1655,6 +1675,54 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1718,7 +1786,6 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1732,7 +1799,6 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1744,9 +1810,9 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1809,7 +1875,6 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1856,10 +1921,6 @@ TP_WBALANCE_TEMPERATURE;Temperatura !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Russian b/rtdata/languages/Russian index d75ed6995..465e9c781 100644 --- a/rtdata/languages/Russian +++ b/rtdata/languages/Russian @@ -611,7 +611,6 @@ PARTIALPASTE_FLATFIELDBLURTYPE;Тип размытия ПП PARTIALPASTE_FLATFIELDFILE;Файл плоского поля (ПП) PARTIALPASTE_GRADIENT;Градиентный фильтр PARTIALPASTE_HSVEQUALIZER;HSV Эквалайзер -PARTIALPASTE_ICMGAMMA;Выходная гамма PARTIALPASTE_ICMSETTINGS;Параметры ICM PARTIALPASTE_IMPULSEDENOISE;Подавление импульсного шума PARTIALPASTE_IPTCINFO;Данные IPTC @@ -1485,6 +1484,26 @@ ZOOMPANEL_ZOOMOUT;Удалить - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !MAIN_TAB_INSPECT; Inspect !MAIN_TAB_WAVELET;Wavelet !MAIN_TAB_WAVELET_TOOLTIP;Shortcut: Alt-w @@ -1505,6 +1524,7 @@ ZOOMPANEL_ZOOMOUT;Удалить - !PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field clip control !PARTIALPASTE_PREPROCESS_DEADPIXFILT;Dead pixel filter !PARTIALPASTE_PREPROCESS_HOTPIXFILT;Hot pixel filter +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_WAVELETGROUP;Wavelet Levels !PREFERENCES_AUTLISLOW;Low !PREFERENCES_AUTLISMAX;Max - Average of all tiles @@ -1655,7 +1675,7 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1739,6 +1759,54 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_1;Level 1 !TP_WAVELET_2;Level 2 !TP_WAVELET_3;Level 3 @@ -1763,7 +1831,6 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1777,7 +1844,6 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1789,9 +1855,9 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1854,7 +1920,6 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1901,10 +1966,6 @@ ZOOMPANEL_ZOOMOUT;Удалить - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Serbian (Cyrilic Characters) b/rtdata/languages/Serbian (Cyrilic Characters) index f2c537d7c..344818259 100644 --- a/rtdata/languages/Serbian (Cyrilic Characters) +++ b/rtdata/languages/Serbian (Cyrilic Characters) @@ -1123,6 +1123,26 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 !MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3 @@ -1167,12 +1187,12 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !PARTIALPASTE_FILMSIMULATION;Film simulation !PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field clip control !PARTIALPASTE_GRADIENT;Graduated filter -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_LENSPROFILE;Lens correction profile !PARTIALPASTE_PCVIGNETTE;Vignette filter !PARTIALPASTE_PREPROCESS_DEADPIXFILT;Dead pixel filter !PARTIALPASTE_PREPROCESS_HOTPIXFILT;Hot pixel filter !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels @@ -1484,7 +1504,7 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1673,6 +1693,54 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1724,7 +1792,6 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1738,7 +1805,6 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1750,9 +1816,9 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1815,7 +1881,6 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1862,10 +1927,6 @@ ZOOMPANEL_ZOOMOUT;Умањује приказ слике - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Serbian (Latin Characters) b/rtdata/languages/Serbian (Latin Characters) index 049923837..dab79ad6b 100644 --- a/rtdata/languages/Serbian (Latin Characters) +++ b/rtdata/languages/Serbian (Latin Characters) @@ -1123,6 +1123,26 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 !MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3 @@ -1167,12 +1187,12 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !PARTIALPASTE_FILMSIMULATION;Film simulation !PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field clip control !PARTIALPASTE_GRADIENT;Graduated filter -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_LENSPROFILE;Lens correction profile !PARTIALPASTE_PCVIGNETTE;Vignette filter !PARTIALPASTE_PREPROCESS_DEADPIXFILT;Dead pixel filter !PARTIALPASTE_PREPROCESS_HOTPIXFILT;Hot pixel filter !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_VIBRANCE;Vibrance !PARTIALPASTE_WAVELETGROUP;Wavelet Levels @@ -1484,7 +1504,7 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1673,6 +1693,54 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1724,7 +1792,6 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1738,7 +1805,6 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1750,9 +1816,9 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1815,7 +1881,6 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1862,10 +1927,6 @@ ZOOMPANEL_ZOOMOUT;Umanjuje prikaz slike - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Slovak b/rtdata/languages/Slovak index 4f1a92446..0a5010a0f 100644 --- a/rtdata/languages/Slovak +++ b/rtdata/languages/Slovak @@ -981,6 +981,26 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 !MAIN_BUTTON_NAVPREV_TOOLTIP;Navigate to the previous image relative to image opened in the Editor.\nShortcut: Shift-F3\n\nTo navigate to the previous image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F3 @@ -1055,7 +1075,6 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LENSPROFILE;Lens correction profile !PARTIALPASTE_PCVIGNETTE;Vignette filter @@ -1076,6 +1095,7 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1435,7 +1455,7 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1662,6 +1682,54 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_RESIZE_FITBOX;Bounding Box !TP_RESIZE_FULLIMAGE;Full Image !TP_RESIZE_LANCZOS;Lanczos +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1725,7 +1793,6 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1739,7 +1806,6 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1751,9 +1817,9 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1816,7 +1882,6 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1863,10 +1928,6 @@ ZOOMPANEL_ZOOMOUT;Oddialiť - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Suomi b/rtdata/languages/Suomi index 083c7931a..0e792a868 100644 --- a/rtdata/languages/Suomi +++ b/rtdata/languages/Suomi @@ -919,6 +919,26 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1001,7 +1021,6 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1023,6 +1042,7 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1397,7 +1417,7 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1655,6 +1675,54 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1718,7 +1786,6 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1732,7 +1799,6 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1744,9 +1810,9 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1809,7 +1875,6 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1856,10 +1921,6 @@ TP_WBALANCE_TEMPERATURE;Lämpötila [K] !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Swedish b/rtdata/languages/Swedish index 9ccc5af02..16f8686b6 100644 --- a/rtdata/languages/Swedish +++ b/rtdata/languages/Swedish @@ -762,7 +762,6 @@ PARTIALPASTE_FLATFIELDBLURTYPE;Oskärpetyp hos plattfältet PARTIALPASTE_FLATFIELDFILE;Plattfältsfil PARTIALPASTE_GRADIENT;Graderat filter PARTIALPASTE_HSVEQUALIZER;HSV-equalizer -PARTIALPASTE_ICMGAMMA;Utmatningsgamma PARTIALPASTE_ICMSETTINGS;Färghanteringsinställningar PARTIALPASTE_IMPULSEDENOISE;Brusreducering mha stegsvar PARTIALPASTE_IPTCINFO;IPTC-info @@ -1611,7 +1610,6 @@ TP_WAVELET_CHCU;Kurva TP_WAVELET_CHSL;Reglage TP_WAVELET_CHTYPE;Krominans-metod TP_WAVELET_COLORT;Opacitet rött-grönt -TP_WAVELET_COMBOTH;Båda TP_WAVELET_COMPCONT;Kontrast TP_WAVELET_DAUB2;D2 - låg TP_WAVELET_DAUB4;D4 - standard @@ -1668,8 +1666,6 @@ TP_WAVELET_THRESHOLD;Högdagernivåer TP_WAVELET_THRH;Högdagertröskel TP_WAVELET_THR;Skuggtröskel TP_WAVELET_TILESFULL;Hela bilden -TP_WAVELET_TMNONE;Ingen -TP_WAVELET_TMSTD;Standard TP_WBALANCE_AUTO;Auto TP_WBALANCE_CAMERA;Kamera TP_WBALANCE_CLOUDY;Molnigt @@ -1764,8 +1760,29 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !HISTORY_MSG_401;W - Toning sub-tool !HISTORY_MSG_402;W - Denoise sub-tool !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !PARTIALPASTE_COLORTONING;Color toning !PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field clip control +!PARTIALPASTE_RETINEX;Retinex !PREFERENCES_INSPECT_MAXBUFFERS_TOOLTIP;Set the maximum number of images stored in cache when hovering over them in the File Browser; systems with little RAM (2GB) should keep this value set to 1 or 2. !PREFERENCES_LEVDN;Cell size !PREFERENCES_LISS;Auto multi-zone smoothing @@ -1783,7 +1800,7 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_COLORTONING_TWOBY;Special a* and b* !TP_COLORTONING_TWOCOLOR_TOOLTIP;Standard chroma:\nLinear response, a* = b*.\n\nSpecial chroma:\nLinear response, a* = b*, but unbound - try under the diagonal.\n\nSpecial a* and b*:\nLinear response unbound with separate curves for a* and b*. Intended for special effects.\n\nSpecial chroma 2 colors:\nMore predictable. !TP_DIRPYRDENOISE_C2TYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. !TP_DIRPYRDENOISE_CURVEEDITOR_L_TOOLTIP;Modulates action of 'Luminance' denoise @@ -1818,8 +1835,55 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_RAW_HD_TOOLTIP;Lower values make hot/dead pixel detection more aggressive, but false positives may lead to artifacts. If you notice any artifacts appearing when enabling the Hot/Dead Pixel Filters, gradually increase the threshold value until they disappear. !TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster. !TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CH2;Saturated/pastel !TP_WAVELET_CHRO;Saturated/pastel threshold @@ -1836,9 +1900,9 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1870,7 +1934,6 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_WAVELET_LEVELS_TOOLTIP;Choose the number of detail levels the image is to be decomposed into. More levels require more RAM and require a longer processing time. !TP_WAVELET_LEVLABEL;Preview maximum possible levels = %1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDILEV_TOOLTIP;When you enable Edge Detection, it is recommanded:\n- to disabled low contrast levels to avoid artifacts,\n- to use high values of gradient sensitivity.\n\nYou can modulate the strength with 'refine' from Denoise and Refine. !TP_WAVELET_NOISE;Denoise and Refine @@ -1890,8 +1953,6 @@ ZOOMPANEL_ZOOMOUT;Förminska.\nKortkommando: - !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/Turkish b/rtdata/languages/Turkish index 520caf65d..aaf21ef75 100644 --- a/rtdata/languages/Turkish +++ b/rtdata/languages/Turkish @@ -918,6 +918,26 @@ TP_WBALANCE_TEMPERATURE;Isı !HISTORY_MSG_404;W - ES - Base amplification !HISTORY_MSG_405;W - Denoise - Level 4 !HISTORY_MSG_406;W - ES - Neighboring pixels +!HISTORY_MSG_407;Retinex - Method +!HISTORY_MSG_408;Retinex - Neighboring +!HISTORY_MSG_409;Retinex - Gain +!HISTORY_MSG_410;Retinex - Offset +!HISTORY_MSG_411;Retinex - Strength +!HISTORY_MSG_412;Retinex - Scales +!HISTORY_MSG_413;Retinex - Variance +!HISTORY_MSG_414;Retinex - Histogram - Lab +!HISTORY_MSG_415;Retinex - Transmission +!HISTORY_MSG_416;Retinex +!HISTORY_MSG_417;Retinex - Transmission median +!HISTORY_MSG_418;Retinex - Threshold +!HISTORY_MSG_419;Retinex - Color space +!HISTORY_MSG_420;Retinex - Histogram - HSL +!HISTORY_MSG_421;Retinex - Gamma +!HISTORY_MSG_422;Retinex - Gamma +!HISTORY_MSG_423;Retinex - Gamma slope +!HISTORY_MSG_424;Retinex - HL threshold +!HISTORY_MSG_425;Retinex - Log base +!HISTORY_MSG_426;Retinex - Hue equalizer !HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s !MAIN_BUTTON_FULLSCREEN;Fullscreen !MAIN_BUTTON_NAVNEXT_TOOLTIP;Navigate to the next image relative to image opened in the Editor.\nShortcut: Shift-F4\n\nTo navigate to the next image relative to the currently selected thumbnail in the File Browser or Filmstrip:\nShortcut: F4 @@ -1000,7 +1020,6 @@ TP_WBALANCE_TEMPERATURE;Isı !PARTIALPASTE_FLATFIELDFILE;Flat-field file !PARTIALPASTE_GRADIENT;Graduated filter !PARTIALPASTE_HSVEQUALIZER;HSV equalizer -!PARTIALPASTE_ICMGAMMA;Output gamma !PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction !PARTIALPASTE_LABCURVE;L*a*b* adjustments !PARTIALPASTE_LENSPROFILE;Lens correction profile @@ -1022,6 +1041,7 @@ TP_WBALANCE_TEMPERATURE;Isı !PARTIALPASTE_RAW_DMETHOD;Demosaic method !PARTIALPASTE_RAW_FALSECOLOR;False color suppression !PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps +!PARTIALPASTE_RETINEX;Retinex !PARTIALPASTE_RGBCURVES;RGB curves !PARTIALPASTE_SHARPENEDGE;Edges !PARTIALPASTE_SHARPENMICRO;Microcontrast @@ -1396,7 +1416,7 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_DIRPYRDENOISE_CCCURVE;Chrominance curve !TP_DIRPYRDENOISE_CHROMAFR;Chrominance !TP_DIRPYRDENOISE_CHROMA;Chrominance - Master -!TP_DIRPYRDENOISE_CTYPE;Auto method +!TP_DIRPYRDENOISE_CTYPE;Method !TP_DIRPYRDENOISE_CTYPE_TOOLTIP;Manual\nActs on the full image.\nYou control the noise reduction settings manually.\n\nAutomatic global\nActs on the full image.\n9 zones are used to calculate a global chrominance noise reduction setting.\n\nAutomatic multi-zones\nNo preview - works only during saving, but using the "Preview" method by matching the tile size and center to the preview size and center you can get an idea of the expected results.\nThe image is divided into tiles (about 10 to 70 depending on image size) and each tile receives its own chrominance noise reduction settings.\n\nPreview\nActs on the whole image.\nThe part of the image visible in the preview is used to calculate global chrominance noise reduction settings. !TP_DIRPYRDENOISE_CURVEEDITOR_CC;Chroma !TP_DIRPYRDENOISE_CURVEEDITOR_CC_TOOLTIP;Increase (multiply) the value of all chrominance sliders.\nThis curve lets you adjust the strength of chromatic noise reduction as a function of chromaticity, for instance to increase the action in areas of low saturation and to decrease it in those of high saturation. @@ -1654,6 +1674,54 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_RESIZE_LANCZOS;Lanczos !TP_RESIZE_SPECIFY;Specify: !TP_RESIZE_WIDTH;Width +!TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +!TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +!TP_RETINEX_CONTEDIT_LH;Hue equalizer +!TP_RETINEX_CURVEEDITOR_CD;L=f(L) +!TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +!TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +!TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +!TP_RETINEX_GAIN;Gain +!TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +!TP_RETINEX_GAMMA;Free gamma +!TP_RETINEX_GAMMA;Gamma +!TP_RETINEX_GAMMA_FREE;Free +!TP_RETINEX_GAMMA_HIGH;High +!TP_RETINEX_GAMMA_LOW;Low +!TP_RETINEX_GAMMA_MID;Middle +!TP_RETINEX_GAMMA_NONE;None +!TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +!TP_RETINEX_HIGHLIGHT;Highlight threshold +!TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +!TP_RETINEX_HIGHLIG;Highlight +!TP_RETINEX_HIGH;High +!TP_RETINEX_HSLSPACE_LIN;HSL-Linear +!TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +!TP_RETINEX_LABEL;Retinex +!TP_RETINEX_LABSPACE;L*a*b* +!TP_RETINEX_LOW;Low +!TP_RETINEX_MEDIAN;Transmission median filter +!TP_RETINEX_METHOD;Method +!TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +!TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +!TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +!TP_RETINEX_NEIGHBOR;Neighboring pixels +!TP_RETINEX_NEUTRAL;Reset +!TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +!TP_RETINEX_OFFSET;Offset +!TP_RETINEX_SETTINGS;Settings +!TP_RETINEX_SLOPE;Free gamma slope +!TP_RETINEX_STRENGTH;Strength +!TP_RETINEX_THRESHOLD;Threshold +!TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +!TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +!TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +!TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +!TP_RETINEX_TRANSMISSION;Transmission map +!TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +!TP_RETINEX_UNIFORM;Uniform +!TP_RETINEX_VARIANCE;Variance +!TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. !TP_RGBCURVES_BLUE;B !TP_RGBCURVES_CHANNEL;Channel !TP_RGBCURVES_GREEN;G @@ -1717,7 +1785,6 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_WAVELET_BASLI;Slider !TP_WAVELET_BATYPE;Contrast balance method !TP_WAVELET_CBENAB;Toning and Color Balance -!TP_WAVELET_CBTYPE;Toning and Color Balance !TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted !TP_WAVELET_CCURVE;Local contrast !TP_WAVELET_CH1;Whole chroma range @@ -1731,7 +1798,6 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_WAVELET_CHSL;Sliders !TP_WAVELET_CHTYPE;Chrominance method !TP_WAVELET_COLORT;Opacity Red-Green -!TP_WAVELET_COMBOTH;Both !TP_WAVELET_COMPCONT;Contrast !TP_WAVELET_COMPGAMMA;Compression gamma !TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1743,9 +1809,9 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_WAVELET_CONTRA_TOOLTIP;Changes contrast of the residual image. !TP_WAVELET_CONTR;Gamut !TP_WAVELET_CTYPE;Chrominance control -!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (absciss)\nLow absciss represents small local contrast (real values about 10..20)\n50% absciss represents average of local contrast (real value about 100..300)\n66% absciss represents standard deviation of local contrast (real value about 300..800)\n100% represents maximum (real value about 3000..8000) +!TP_WAVELET_CURVEEDITOR_CC_TOOLTIP;Modifies local contrast as a function of the original local contrast (abscissa).\nLow abscissa values represent small local contrast (real values about 10..20).\n50% abscissa represents average local contrast (real value about 100..300).\n66% abscissa represents standard deviation of local contrast (real value about 300..800).\n100% abscissa represents maximum local contrast (real value about 3000..8000). !TP_WAVELET_CURVEEDITOR_CH;Contrast levels=f(Hue) -!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function oh hue.\nTake care not to overwrite changes made with the Gamut Hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. +!TP_WAVELET_CURVEEDITOR_CH_TOOLTIP;Modifies each level's contrast as a function of hue.\nTake care not to overwrite changes made with the Gamut sub-tool's hue controls.\nThe curve will only have an effect when wavelet contrast level sliders are non-zero. !TP_WAVELET_CURVEEDITOR_CL;L !TP_WAVELET_CURVEEDITOR_CL_TOOLTIP;Applies a final contrast luminance curve at the end of the wavelet treatment. !TP_WAVELET_CURVEEDITOR_HH;HH @@ -1808,7 +1874,6 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_WAVELET_LEVZERO;Level 1 !TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength !TP_WAVELET_LIPST;Enhanced algoritm -!TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. !TP_WAVELET_LOWLIGHT;Shadow luminance range !TP_WAVELET_MEDGREINF;First level !TP_WAVELET_MEDILEV;Edge detection @@ -1855,10 +1920,6 @@ TP_WBALANCE_TEMPERATURE;Isı !TP_WAVELET_TILESIZE;Tiling method !TP_WAVELET_TILESLIT;Little tiles !TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -!TP_WAVELET_TMHIGH;High -!TP_WAVELET_TMLOWHIGH;Low+High -!TP_WAVELET_TMNONE;None -!TP_WAVELET_TMSTD;Standard !TP_WAVELET_TMSTRENGTH;Compression strength !TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. !TP_WAVELET_TMTYPE;Compression method diff --git a/rtdata/languages/default b/rtdata/languages/default index ddf218625..45b5f007b 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -807,7 +807,6 @@ PARTIALPASTE_DIRPYREQUALIZER;Contrast by detail levels PARTIALPASTE_DISTORTION;Distortion correction PARTIALPASTE_EPD;Tone mapping PARTIALPASTE_EQUALIZER;Wavelet levels -PARTIALPASTE_RETINEX;Retinex PARTIALPASTE_EVERYTHING;Everything PARTIALPASTE_EXIFCHANGES;Exif PARTIALPASTE_EXPOSURE;Exposure @@ -819,7 +818,6 @@ PARTIALPASTE_FLATFIELDCLIPCONTROL;Flat-field clip control PARTIALPASTE_FLATFIELDFILE;Flat-field file PARTIALPASTE_GRADIENT;Graduated filter PARTIALPASTE_HSVEQUALIZER;HSV equalizer -PARTIALPASTE_ICMGAMMA;Output gamma PARTIALPASTE_ICMSETTINGS;Color management settings PARTIALPASTE_IMPULSEDENOISE;Impulse noise reduction PARTIALPASTE_IPTCINFO;IPTC @@ -846,6 +844,7 @@ PARTIALPASTE_RAW_DMETHOD;Demosaic method PARTIALPASTE_RAW_FALSECOLOR;False color suppression PARTIALPASTE_RAW_LMMSEITERATIONS;LMMSE enhancement steps PARTIALPASTE_RESIZE;Resize +PARTIALPASTE_RETINEX;Retinex PARTIALPASTE_RGBCURVES;RGB curves PARTIALPASTE_ROTATION;Rotation PARTIALPASTE_SHADOWSHIGHLIGHTS;Shadows/highlights @@ -1526,7 +1525,6 @@ TP_LABCURVE_BRIGHTNESS;Lightness TP_LABCURVE_CHROMATICITY;Chromaticity TP_LABCURVE_CHROMA_TOOLTIP;To apply B&W toning, set Chromaticity to -100. TP_LABCURVE_CONTRAST;Contrast -TP_LABCURVE_CONTEDIT;Histogram equalizer TP_LABCURVE_CURVEEDITOR;Luminance Curve TP_LABCURVE_CURVEEDITOR_A_RANGE1;Green Saturated TP_LABCURVE_CURVEEDITOR_A_RANGE2;Green Pastel @@ -1542,8 +1540,6 @@ TP_LABCURVE_CURVEEDITOR_CC_RANGE2;Dull TP_LABCURVE_CURVEEDITOR_CC_RANGE3;Pastel TP_LABCURVE_CURVEEDITOR_CC_RANGE4;Saturated TP_LABCURVE_CURVEEDITOR_CC_TOOLTIP;Chromaticity according to chromaticity C=f(C) -TP_LABCURVE_CURVEEDITOR_CD;CL -TP_LABCURVE_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L) TP_LABCURVE_CURVEEDITOR_CH;CH TP_LABCURVE_CURVEEDITOR_CH_TOOLTIP;Chromaticity according to hue C=f(H) TP_LABCURVE_CURVEEDITOR_CL;CL @@ -1560,55 +1556,6 @@ TP_LABCURVE_LCREDSK;Restrict LC to red and skin-tones TP_LABCURVE_LCREDSK_TIP;If enabled, the LC Curve affects only red and skin-tones.\nIf disabled, it applies to all tones. TP_LABCURVE_RSTPROTECTION;Red and skin-tones protection TP_LABCURVE_RSTPRO_TOOLTIP;Works on the Chromaticity slider and the CC curve. -TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL -TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* -TP_RETINEX_CURVEEDITOR_CD;L=f(L) -TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. -TP_RETINEX_CONTEDIT_LH;Hue equalizer -TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) -TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. -TP_RETINEX_GAIN;Gain -TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. -TP_RETINEX_GAMMA;Gamma -TP_RETINEX_GAMMA_NONE;None -TP_RETINEX_GAMMA_LOW;Low -TP_RETINEX_GAMMA_MID;Middle -TP_RETINEX_GAMMA_HIGH;High -TP_RETINEX_GAMMA_FREE;Free -TP_RETINEX_GAMMA;Free gamma -TP_RETINEX_SLOPE;Free gamma slope -TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). -TP_RETINEX_HIGH;High -TP_RETINEX_HIGHLIG;Highlight -TP_RETINEX_HIGHLIGHT;Highlight threshold -TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. -TP_RETINEX_HSLSPACE_LIN;HSL-Linear -TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic -TP_RETINEX_LABEL;Retinex -TP_RETINEX_LABSPACE;L*a*b* -TP_RETINEX_LOW;Low -TP_RETINEX_MEDIAN;Transmission median filter -TP_RETINEX_METHOD;Method -TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. -TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 -TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. -TP_RETINEX_NEIGHBOR;Neighboring pixels -TP_RETINEX_NEUTRAL;Reset -TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. -TP_RETINEX_NONE;None -TP_RETINEX_OFFSET;Offset -TP_RETINEX_SETTINGS;Settings -TP_RETINEX_STRENGTH;Strength -TP_RETINEX_THRESHOLD;Threshold -TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. -TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 -TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 -TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. -TP_RETINEX_TRANSMISSION;Transmission map -TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. -TP_RETINEX_UNIFORM;Uniform -TP_RETINEX_VARIANCE;Variance -TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. TP_LENSGEOM_AUTOCROP;Auto-Crop TP_LENSGEOM_FILL;Auto-fill TP_LENSGEOM_LABEL;Lens / Geometry @@ -1684,6 +1631,54 @@ TP_RESIZE_SCALE;Scale TP_RESIZE_SPECIFY;Specify: TP_RESIZE_WIDTH;Width TP_RESIZE_W;Width: +TP_RETINEX_CONTEDIT_HSL;Histogram equalizer HSL +TP_RETINEX_CONTEDIT_LAB;Histogram equalizer L*a*b* +TP_RETINEX_CONTEDIT_LH;Hue equalizer +TP_RETINEX_CURVEEDITOR_CD;L=f(L) +TP_RETINEX_CURVEEDITOR_CD_TOOLTIP;Luminance according to luminance L=f(L)\nCorrect raw data to reduce halos and artifacts. +TP_RETINEX_CURVEEDITOR_LH;Strength=f(H) +TP_RETINEX_CURVEEDITOR_LH_TOOLTIP;Strength according to hue Strength=f(H)\nThis curve also acts on chroma when using the "Highlight" retinex method. +TP_RETINEX_GAIN;Gain +TP_RETINEX_GAIN_TOOLTIP;Acts on the transmission in combination with the offset. This is very different from the others settings. Used for black or white pixels, and to help balance the histogram. +TP_RETINEX_GAMMA;Free gamma +TP_RETINEX_GAMMA;Gamma +TP_RETINEX_GAMMA_FREE;Free +TP_RETINEX_GAMMA_HIGH;High +TP_RETINEX_GAMMA_LOW;Low +TP_RETINEX_GAMMA_MID;Middle +TP_RETINEX_GAMMA_NONE;None +TP_RETINEX_GAMMA_TOOLTIP;Restore tones by applying gamma before and after Retinex. Different from Retinex curves or others curves (Lab, Exposure, etc.). +TP_RETINEX_HIGHLIGHT;Highlight threshold +TP_RETINEX_HIGHLIGHT_TOOLTIP;Increase action of High algorithm.\nMay require you to re-adjust "Neighboring pixels" and to increase the "White-point correction" in the Raw tab -> Raw White Points tool. +TP_RETINEX_HIGHLIG;Highlight +TP_RETINEX_HIGH;High +TP_RETINEX_HSLSPACE_LIN;HSL-Linear +TP_RETINEX_HSLSPACE_LOG;HSL-Logarithmic +TP_RETINEX_LABEL;Retinex +TP_RETINEX_LABSPACE;L*a*b* +TP_RETINEX_LOW;Low +TP_RETINEX_MEDIAN;Transmission median filter +TP_RETINEX_METHOD;Method +TP_RETINEX_METHOD_TOOLTIP;Low = Reinforce low light,\nUniform = Equalize action,\nHigh = Reinforce high light,\nHighlight = Remove magenta in highlights. +TP_RETINEX_MLABEL;Restored haze-free Min=%1 Max=%2 +TP_RETINEX_MLABEL_TOOLTIP;Should be near min=0 max=32768\nRestored image with no mixture. +TP_RETINEX_NEIGHBOR;Neighboring pixels +TP_RETINEX_NEUTRAL;Reset +TP_RETINEX_NEUTRAL_TIP;Reset all sliders and curves to their default values. +TP_RETINEX_OFFSET;Offset +TP_RETINEX_SETTINGS;Settings +TP_RETINEX_SLOPE;Free gamma slope +TP_RETINEX_STRENGTH;Strength +TP_RETINEX_THRESHOLD;Threshold +TP_RETINEX_THRESHOLD_TOOLTIP;Limits in/out.\nIn = image source,\nOut = image gauss. +TP_RETINEX_TLABEL2;TM Tm=%1 TM=%2 +TP_RETINEX_TLABEL;TM Min=%1 Max=%2 Mean=%3 Sigma=%4 +TP_RETINEX_TLABEL_TOOLTIP;Transmission map result.\nMin and Max are used by Variance.\nMean and Sigma\nTm=Min TM=Max of transmission map. +TP_RETINEX_TRANSMISSION;Transmission map +TP_RETINEX_TRANSMISSION_TOOLTIP;Transmission according to transmission.\nAbscissa: transmission from negative values (min), mean, and positives values (max).\nOrdinate: amplification or reduction. +TP_RETINEX_UNIFORM;Uniform +TP_RETINEX_VARIANCE;Variance +TP_RETINEX_VARIANCE_TOOLTIP;Low variance increase local contrast and saturation, but can lead to artifacts. TP_RGBCURVES_BLUE;B TP_RGBCURVES_CHANNEL;Channel TP_RGBCURVES_GREEN;G @@ -1775,7 +1770,6 @@ TP_WAVELET_BANONE;None TP_WAVELET_BASLI;Slider TP_WAVELET_BATYPE;Contrast balance method TP_WAVELET_CBENAB;Toning and Color Balance -TP_WAVELET_CBTYPE;Toning and Color Balance TP_WAVELET_CB_TOOLTIP;For strong values product color-toning by combining it or not with levels decomposition 'toning'\nFor low values you can change the white balance of the background (sky, ...) without changing that of the front plane, generally more contrasted TP_WAVELET_CCURVE;Local contrast TP_WAVELET_CH1;Whole chroma range @@ -1789,7 +1783,6 @@ TP_WAVELET_CHR_TOOLTIP;Adjusts chroma as a function of "contrast levels" and "ch TP_WAVELET_CHSL;Sliders TP_WAVELET_CHTYPE;Chrominance method TP_WAVELET_COLORT;Opacity Red-Green -TP_WAVELET_COMBOTH;Both TP_WAVELET_COMPCONT;Contrast TP_WAVELET_COMPGAMMA;Compression gamma TP_WAVELET_COMPGAMMA_TOOLTIP;Adjusting the gamma of the residual image allows you to equilibrate the data and histogram. @@ -1866,7 +1859,6 @@ TP_WAVELET_LEVTWO;Level 3 TP_WAVELET_LEVZERO;Level 1 TP_WAVELET_LINKEDG;Link with Edge Sharpness' Strength TP_WAVELET_LIPST;Enhanced algoritm -TP_WAVELET_LIPST_TOOLTIP;This algorithm uses the proximity of a pixel and eight of its neighbors. If less difference, edges are reinforced. TP_WAVELET_LOWLIGHT;Shadow luminance range TP_WAVELET_MEDGREINF;First level TP_WAVELET_MEDILEV;Edge detection @@ -1913,10 +1905,6 @@ TP_WAVELET_TILESFULL;Full image TP_WAVELET_TILESIZE;Tiling method TP_WAVELET_TILESLIT;Little tiles TP_WAVELET_TILES_TOOLTIP;Processing the full image leads to better quality and is the recommended option, while using tiles is a fall-back solution for users with little RAM. Refer to RawPedia for memory requirements. -TP_WAVELET_TMHIGH;High -TP_WAVELET_TMLOWHIGH;Low+High -TP_WAVELET_TMNONE;None -TP_WAVELET_TMSTD;Standard TP_WAVELET_TMSTRENGTH;Compression strength TP_WAVELET_TMSTRENGTH_TOOLTIP;Control the strength of tone mapping or contrast compression of the residual image. When the value is different from 0, the Strength and Gamma sliders of the Tone Mapping tool in the Exposure tab will become grayed out. TP_WAVELET_TMTYPE;Compression method From 84a9c2c664964ac60006acbfecca7b3cd3deee9d Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Sat, 17 Oct 2015 16:09:37 +0200 Subject: [PATCH 70/71] Updated RELEASE_NOTES.txt --- RELEASE_NOTES.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index d64b336c7..c057d41a7 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -5,7 +5,7 @@ This is a development version of RawTherapee. We update the code every day, whic While we only commit tested and relatively stable code and so the development versions should be fairly stable, you should be aware that: - They only had limited testing, so there may be bugs unknown to us. -- You should report these bugs so they get fixed for the stable release. See www.rawpedia.rawtherapee.com/How_to_write_useful_bug_reports The way tools work in the development versions is likely to change as we tweak and tune them, so your processing profiles may produce different results when used in a future stable versions. +- You should report these bugs so they get fixed for the stable release. See www.rawpedia.rawtherapee.com/How_to_write_useful_bug_reports The way new tools work in the development versions is likely to change as we tweak and tune them, so your processing profiles may produce different results when used in a future stable versions. - Bugs present in the stable versions get fixed, and until a new stable version is released these fixes are present in these development versions, thereby making the development version "more stable" than the previous stable version. At the same time, new features may introduce new bugs :) This is a trade-off you should be aware of. In order to use RawTherapee efficiently you should know that: @@ -19,7 +19,7 @@ Refer to RawPedia for information about RawTherapee's tools and how to use them. DOCUMENTATION ------------- -http://rawtherapee.com/documentation +http://rawtherapee.com/blog/documentation http://rawpedia.rawtherapee.com/ REPORTING BUGS @@ -44,5 +44,5 @@ http://plus.google.com/106783532637761598368 REVISION HISTORY ---------------- The complete changelog is available at: -https://code.google.com/p/rawtherapee/source/list +https://github.com/Beep6581/RawTherapee/commits/master From 26b5d4f25e63c5bfd79d3540d864a5e298194e76 Mon Sep 17 00:00:00 2001 From: Beep6581 Date: Sat, 17 Oct 2015 16:13:55 +0200 Subject: [PATCH 71/71] Use default theme if options file sets theme to nothing, "Theme=", fixes #2937 --- rtgui/main.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtgui/main.cc b/rtgui/main.cc index cc7c3cbe5..5b10dbf7b 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -276,6 +276,10 @@ int main(int argc, char **argv) simpleEditor = true; } + if (options.theme.empty()) { + options.theme = "21-Gray-Gray"; + } + if (!options.useSystemTheme) { std::vector rcfiles; rcfiles.push_back (argv0 + "/themes/" + options.theme + ".gtkrc");