diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index 3cb0ee8de..433769b7a 100644 --- a/rtengine/amaze_demosaic_RT.cc +++ b/rtengine/amaze_demosaic_RT.cc @@ -45,7 +45,7 @@ SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, volatile double progress = 0.0; if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE))); plistener->setProgress (0.0); } diff --git a/rtengine/curves.cc b/rtengine/curves.cc index 8ece458e7..6dfa640fc 100644 --- a/rtengine/curves.cc +++ b/rtengine/curves.cc @@ -482,8 +482,8 @@ void CurveFactory::complexsgnCurve (bool & autili, bool & butili, bool & ccutil SSEFUNCTION void CurveFactory::complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, - procparams::ToneCurveParams::Mode curveMode, const std::vector& curvePoints, - procparams::ToneCurveParams::Mode curveMode2, const std::vector& curvePoints2, + procparams::ToneCurveParams::TcMode curveMode, const std::vector& curvePoints, + procparams::ToneCurveParams::TcMode curveMode2, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, diff --git a/rtengine/curves.h b/rtengine/curves.h index 413531471..0ae322e82 100644 --- a/rtengine/curves.h +++ b/rtengine/curves.h @@ -281,7 +281,7 @@ public: public: static void complexCurve (double ecomp, double black, double hlcompr, double hlcomprthresh, double shcompr, double br, double contr, - procparams::ToneCurveParams::Mode curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::Mode curveMode2, const std::vector& curvePoints2, + procparams::ToneCurveParams::TcMode curveMode, const std::vector& curvePoints, procparams::ToneCurveParams::TcMode curveMode2, const std::vector& curvePoints2, LUTu & histogram, LUTf & hlCurve, LUTf & shCurve, LUTf & outCurve, LUTu & outBeforeCCurveHistogram, ToneCurve & outToneCurve, ToneCurve & outToneCurve2, int skip = 1); diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 6a5b8eba8..f5fbe5e8f 100644 --- a/rtengine/demosaic_algos.cc +++ b/rtengine/demosaic_algos.cc @@ -65,7 +65,7 @@ extern const Settings* settings; void RawImageSource::eahd_demosaic () { if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::eahd])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::EAHD))); plistener->setProgress (0.0); } @@ -494,7 +494,7 @@ void RawImageSource::hphd_green (float** hpmap) void RawImageSource::hphd_demosaic () { if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::hphd])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::HPHD))); plistener->setProgress (0.0); } @@ -595,7 +595,7 @@ void RawImageSource::vng4_demosaic () const bool plistenerActive = plistener; if (plistenerActive) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::vng4])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::VNG4))); plistener->setProgress (progress); } @@ -893,7 +893,7 @@ void RawImageSource::ppg_demosaic() if (plistener) { // looks like ppg isn't supported anymore - //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ppg])); + //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::ppg))); plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), "xxx")); plistener->setProgress (0.0); } @@ -1201,7 +1201,7 @@ void RawImageSource::jdl_interpolate_omp() // from "Lassus" if (plistener) { // this function seems to be unused - //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::jdl])); + //plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::jdl))); plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), "xxx")); plistener->setProgress (0.0); } @@ -1397,7 +1397,7 @@ SSEFUNCTION void RawImageSource::lmmse_interpolate_omp(int winw, int winh, array } if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::lmmse])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::LMMSE))); plistener->setProgress (0.0); } @@ -1975,7 +1975,7 @@ SSEFUNCTION void RawImageSource::igv_interpolate(int winw, int winh) border_interpolate2(winw, winh, 7); if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::IGV))); plistener->setProgress (0.0); } @@ -2364,7 +2364,7 @@ void RawImageSource::igv_interpolate(int winw, int winh) border_interpolate2(winw, winh, 7); if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::IGV))); plistener->setProgress (0.0); } @@ -2639,7 +2639,7 @@ void RawImageSource::ahd_demosaic(int winx, int winy, int winw, int winh) const float d65_white[3] = { 0.950456, 1, 1.088754 }; if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ahd])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AHD))); plistener->setProgress (0.0); } @@ -3702,7 +3702,7 @@ BENCHFUN double currentProgress = 0.0; if(plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::dcb])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCB))); plistener->setProgress (currentProgress); } diff --git a/rtengine/fast_demo.cc b/rtengine/fast_demo.cc index 12286d9f1..b57bab90e 100644 --- a/rtengine/fast_demo.cc +++ b/rtengine/fast_demo.cc @@ -62,7 +62,7 @@ SSEFUNCTION void RawImageSource::fast_demosaic(int winx, int winy, int winw, int //int winw=W, winh=H; if (plistener) { - plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast])); + plistener->setProgressStr (Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST))); plistener->setProgress (progress); } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index dffd9572e..f5687a08a 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -167,14 +167,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) 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]) { - rp.bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast]; + if (rp.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) && rp.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE)) { + rp.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); } //bayerrp.all_enhance = false; - if (rp.xtranssensor.method != RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::none] && rp.xtranssensor.method != RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono]) { - rp.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; + if (rp.xtranssensor.method != RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) && rp.xtranssensor.method != RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) { + rp.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); } rp.bayersensor.ccSteps = 0; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index bc5bafca0..7685a4d10 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -440,11 +440,11 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } // extracting datas from 'params' to avoid cache flush (to be confirmed) - ColorAppearanceParams::TCMode curveMode = params->colorappearance.curveMode; - ColorAppearanceParams::TCMode curveMode2 = params->colorappearance.curveMode2; + ColorAppearanceParams::TcMode curveMode = params->colorappearance.curveMode; + ColorAppearanceParams::TcMode curveMode2 = params->colorappearance.curveMode2; bool hasColCurve1 = bool (customColCurve1); bool hasColCurve2 = bool (customColCurve2); - ColorAppearanceParams::CTCMode curveMode3 = params->colorappearance.curveMode3; + ColorAppearanceParams::CtcMode curveMode3 = params->colorappearance.curveMode3; bool hasColCurve3 = bool (customColCurve3); @@ -805,7 +805,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { /* float Jj=(float) Jpro*327.68; float Jold=Jj; const Lightcurve& userColCurve = static_cast(customColCurve1); @@ -843,7 +843,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } t1L = true; - } else if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { //attention! Brightness curves are open - unlike Lightness or Lab or RGB==> rendering and algoritms will be different float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qanc = Qpro; @@ -891,7 +891,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode2 == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68; float Jold = Jj; /* @@ -934,7 +934,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Jpro = 1.; } - } else if (curveMode2 == ColorAppearanceParams::TCMode::BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TcMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qq = (float) Qpro * 327.68f * (1.f / coef); @@ -992,7 +992,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Cc = (float) Cpro * coef; @@ -1016,7 +1016,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh } // Cpro=Cc/coef; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { // double parsat = 0.8; //0.6 double coef = 327.68 / parsat; float Ss = (float) spro * coef; @@ -1036,7 +1036,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh Cpro = (spro * spro * Qpro) / (10000.0); c1s = 1; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { // double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Mm = (float) Mpro * coef; @@ -1121,21 +1121,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1390,21 +1390,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int begh, int endh int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1765,14 +1765,14 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int const float rstprotection = 100. - params->colorappearance.rstprotection; // extracting datas from 'params' to avoid cache flush (to be confirmed) - const ColorAppearanceParams::TCMode curveMode = params->colorappearance.curveMode; + const ColorAppearanceParams::TcMode curveMode = params->colorappearance.curveMode; const bool hasColCurve1 = bool (customColCurve1); - const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TCMode::LIGHT; + const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TcMode::LIGHT; - const ColorAppearanceParams::TCMode curveMode2 = params->colorappearance.curveMode2; + const ColorAppearanceParams::TcMode curveMode2 = params->colorappearance.curveMode2; const bool hasColCurve2 = bool (customColCurve2); - const ColorAppearanceParams::CTCMode curveMode3 = params->colorappearance.curveMode3; + const ColorAppearanceParams::CtcMode curveMode3 = params->colorappearance.curveMode3; const bool hasColCurve3 = bool (customColCurve3); bool needJ = (alg == 0 || alg == 1 || alg == 3); @@ -2226,7 +2226,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2255,7 +2255,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int if (Jpro < 1.f) { Jpro = 1.f; } - } else if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { //attention! Brightness curves are open - unlike Lightness or Lab or RGB==> rendering and algoritms will be different float coef = ((aw + 4.f) * (4.f / c)) / 100.f; float Qanc = Qpro; @@ -2299,7 +2299,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TCMode::LIGHT) { + if (curveMode2 == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2337,7 +2337,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Jpro = 1.f; } - } else if (curveMode2 == ColorAppearanceParams::TCMode::BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TcMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; @@ -2394,7 +2394,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Cc = (float) Cpro * coef; @@ -2417,7 +2417,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Cpro = 50.f; } */ - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { // float parsat = 0.8f; //0.6 float coef = 327.68f / parsat; float Ss = (float) spro * coef; @@ -2434,7 +2434,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int Color::skinredfloat (Jpro, hpro, Ss, Sold, dred, protect_red, sk, rstprotection, ko, spro); Qpro = ( 4.0f / c ) * sqrtf ( Jpro / 100.0f ) * ( aw + 4.0f ) ; Cpro = (spro * spro * Qpro) / (10000.0f); - } else if (curveMode3 == ColorAppearanceParams::CTCMode::COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { // float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Mm = (float) Mpro * coef; @@ -2504,7 +2504,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float colch; //update histogram - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0f; libr = Q; //40.0 to 100.0 approximative factor for Q - 327 for J } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ @@ -2515,10 +2515,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.f;//327 colch = C; //450.0 approximative factor for s 320 for M - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0f; colch = s; } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ @@ -2857,7 +2857,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int float libr; float colch; - if (curveMode == ColorAppearanceParams::TCMode::BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0f; libr = ncie->Q_p[i][j]; //40.0 to 100.0 approximative factor for Q - 327 for J } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ @@ -2868,10 +2868,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int begh, int posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::CTCMode::CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.f;//327.f; colch = ncie_C_p; - } else if (curveMode3 == ColorAppearanceParams::CTCMode::SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0f; colch = 100.f * sqrtf (ncie_C_p / ncie->Q_p[i][j]); } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ @@ -3270,25 +3270,25 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer const float hlrange = 65536.0 - shoulder; const bool isProPhoto = (params->icm.working == "ProPhoto"); // extracting datas from 'params' to avoid cache flush (to be confirmed) - ToneCurveParams::Mode curveMode = params->toneCurve.curveMode; - ToneCurveParams::Mode curveMode2 = params->toneCurve.curveMode2; + ToneCurveParams::TcMode curveMode = params->toneCurve.curveMode; + ToneCurveParams::TcMode curveMode2 = params->toneCurve.curveMode2; bool highlight = params->toneCurve.hrenabled;//Get the value if "highlight reconstruction" is activated bool hasToneCurve1 = bool (customToneCurve1); bool hasToneCurve2 = bool (customToneCurve2); - BlackWhiteParams::eTCModeId beforeCurveMode = params->blackwhite.beforeCurveMode; - BlackWhiteParams::eTCModeId afterCurveMode = params->blackwhite.afterCurveMode; + BlackWhiteParams::TcMode beforeCurveMode = params->blackwhite.beforeCurveMode; + BlackWhiteParams::TcMode afterCurveMode = params->blackwhite.afterCurveMode; bool hasToneCurvebw1 = bool (customToneCurvebw1); bool hasToneCurvebw2 = bool (customToneCurvebw2); PerceptualToneCurveState ptc1ApplyState, ptc2ApplyState; - if (hasToneCurve1 && curveMode == ToneCurveParams::Mode::PERCEPTUAL) { + if (hasToneCurve1 && curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.initApplyState (ptc1ApplyState, params->icm.working); } - if (hasToneCurve2 && curveMode2 == ToneCurveParams::Mode::PERCEPTUAL) { + if (hasToneCurve2 && curveMode2 == ToneCurveParams::TcMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.initApplyState (ptc2ApplyState, params->icm.working); } @@ -3641,21 +3641,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve1) { - if (curveMode == ToneCurveParams::Mode::STD) { // Standard + if (curveMode == ToneCurveParams::TcMode::STD) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::FILMLIKE) { // Adobe like + } else if (curveMode == ToneCurveParams::TcMode::FILMLIKE) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode == ToneCurveParams::TcMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve1); @@ -3665,7 +3665,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode == ToneCurveParams::TcMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3676,7 +3676,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode == ToneCurveParams::TcMode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3687,7 +3687,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode == ToneCurveParams::Mode::PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3712,28 +3712,28 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve2) { - if (curveMode2 == ToneCurveParams::Mode::STD) { // Standard + if (curveMode2 == ToneCurveParams::TcMode::STD) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::FILMLIKE) { // Adobe like + } else if (curveMode2 == ToneCurveParams::TcMode::FILMLIKE) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels + } else if (curveMode2 == ToneCurveParams::TcMode::SATANDVALBLENDING) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted + } else if (curveMode2 == ToneCurveParams::TcMode::WEIGHTEDSTD) { // apply the curve to the rgb channels, weighted const WeightedStdToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3741,7 +3741,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::LUMINANCE) { // apply the curve to the luminance channel + } else if (curveMode2 == ToneCurveParams::TcMode::LUMINANCE) { // apply the curve to the luminance channel const LuminanceToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -3749,7 +3749,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (curveMode2 == ToneCurveParams::Mode::PERCEPTUAL) { // apply curve while keeping color appearance constant + } else if (curveMode2 == ToneCurveParams::TcMode::PERCEPTUAL) { // apply curve while keeping color appearance constant const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); for (int i = istart, ti = 0; i < tH; i++, ti++) { @@ -4212,21 +4212,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer //black and white if (blackwhite) { if (hasToneCurvebw1) { - if (beforeCurveMode == BlackWhiteParams::TC_MODE_STD_BW) { // Standard + if (beforeCurveMode == BlackWhiteParams::TcMode::STD_BW) { // Standard for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const StandardToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_FILMLIKE_BW) { // Adobe like + } else if (beforeCurveMode == BlackWhiteParams::TcMode::FILMLIKE_BW) { // Adobe like for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const AdobeToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW) { // apply the curve on the saturation and value channels + } else if (beforeCurveMode == BlackWhiteParams::TcMode::SATANDVALBLENDING_BW) { // apply the curve on the saturation and value channels for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const SatAndValueBlendingToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); @@ -4236,7 +4236,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurvebw.Apply (rtemp[ti * TS + tj], gtemp[ti * TS + tj], btemp[ti * TS + tj]); } } - } else if (beforeCurveMode == BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted + } else if (beforeCurveMode == BlackWhiteParams::TcMode::WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted for (int i = istart, ti = 0; i < tH; i++, ti++) { for (int j = jstart, tj = 0; j < tW; j++, tj++) { const WeightedStdToneCurvebw& userToneCurvebw = static_cast (customToneCurvebw1); @@ -4672,7 +4672,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer if (hasToneCurvebw2) { - if (afterCurveMode == BlackWhiteParams::TC_MODE_STD_BW) { // Standard + if (afterCurveMode == BlackWhiteParams::TcMode::STD_BW) { // Standard #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 5) #endif @@ -4683,7 +4683,7 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer userToneCurve.Apply (tmpImage->r (i, j), tmpImage->g (i, j), tmpImage->b (i, j)); } } - } else if (afterCurveMode == BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted + } else if (afterCurveMode == BlackWhiteParams::TcMode::WEIGHTEDSTD_BW) { // apply the curve to the rgb channels, weighted #ifdef _OPENMP #pragma omp parallel for schedule(dynamic, 5) #endif diff --git a/rtengine/pixelshift.cc b/rtengine/pixelshift.cc index 5a7e88f1c..256aaaf63 100644 --- a/rtengine/pixelshift.cc +++ b/rtengine/pixelshift.cc @@ -311,11 +311,11 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA bayerParams.pixelShiftAutomatic = true; - if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Automatic) { + if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO) { bool pixelShiftEqualBright = bayerParams.pixelShiftEqualBright; bayerParams.setPixelShiftDefaults(); bayerParams.pixelShiftEqualBright = pixelShiftEqualBright; - } else if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Off) { + } else if(bayerParams.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::OFF) { bayerParams.pixelShiftAutomatic = false; bayerParams.pixelShiftShowMotion = false; } @@ -506,7 +506,7 @@ void RawImageSource::pixelshift(int winx, int winy, int winw, int winh, const RA static const float ePerIsoK70 = 0.5f; if(plistener) { - plistener->setProgressStr(Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift])); + plistener->setProgressStr(Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT))); plistener->setProgress(0.0); } diff --git a/rtengine/previewimage.cc b/rtengine/previewimage.cc index e6703aed5..536fdb616 100644 --- a/rtengine/previewimage.cc +++ b/rtengine/previewimage.cc @@ -108,10 +108,10 @@ PreviewImage::PreviewImage (const Glib::ustring &fname, const Glib::ustring &ext rawImage.getFullSize (fw, fh, TR_NONE); PreviewProps pp (0, 0, fw, fh, 1); params.icm.input = Glib::ustring("(embedded)"); - params.raw.bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast]; + params.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); params.raw.deadPixelFilter = false; params.raw.ca_autocorrect = false; - params.raw.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast]; + params.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); rawImage.preprocess(params.raw, params.lensProf, params.coarse); rawImage.demosaic(params.raw); Imagefloat image(fw, fh); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index c064f5366..5494aecdd 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -32,14 +32,62 @@ #include "../rtgui/ppversion.h" #include "../rtgui/version.h" -#define APPVERSION RTVERSION - using namespace std; extern Options options; namespace { +Glib::ustring expandRelativePath (const Glib::ustring &procparams_fname, const Glib::ustring &prefix, Glib::ustring embedded_fname) +{ + if (embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { + return embedded_fname; + } + + if (prefix != "") { + if (embedded_fname.length() < prefix.length() || embedded_fname.substr (0, prefix.length()) != prefix) { + return embedded_fname; + } + + embedded_fname = embedded_fname.substr (prefix.length()); + } + + if (Glib::path_is_absolute (embedded_fname)) { + return prefix + embedded_fname; + } + + Glib::ustring absPath = prefix + Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S + embedded_fname; + return absPath; +} + +Glib::ustring relativePathIfInside (const Glib::ustring &procparams_fname, bool fnameAbsolute, Glib::ustring embedded_fname) +{ + if (fnameAbsolute || embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { + return embedded_fname; + } + + Glib::ustring prefix = ""; + + if (embedded_fname.length() > 5 && embedded_fname.substr (0, 5) == "file:") { + embedded_fname = embedded_fname.substr (5); + prefix = "file:"; + } + + if (!Glib::path_is_absolute (embedded_fname)) { + return prefix + embedded_fname; + } + + Glib::ustring dir1 = Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S; + Glib::ustring dir2 = Glib::path_get_dirname (embedded_fname) + G_DIR_SEPARATOR_S; + + if (dir2.substr (0, dir1.length()) != dir1) { + // it's in a different directory, ie not inside + return prefix + embedded_fname; + } + + return prefix + embedded_fname.substr (dir1.length()); +} + void avoidEmptyCurve (std::vector &curve) { if (curve.empty()) { @@ -251,61 +299,81 @@ bool saveToKeyfile( return false; } -// ( *)if \((!pedited \|\| pedited->.*?)\) \{\R *keyFile\.set_integer \("(.*?)", "(.*?)", (.*?)\);\R *\}\R -// \1saveToKeyfile(\2, "\3", "\4", \5, keyFile); +const int tr = options.rtSettings.top_right; +const int br = options.rtSettings.bot_right; +const int tl = options.rtSettings.top_left; +const int bl = options.rtSettings.bot_left; } namespace rtengine { + namespace procparams { -const int tr = (int) options.rtSettings.top_right; -const int br = (int) options.rtSettings.bot_right; -const int tl = (int) options.rtSettings.top_left; -const int bl = (int) options.rtSettings.bot_left; -const char *RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::numMethods] = {"amaze", "igv", "lmmse", "eahd", "hphd", "vng4", "dcb", "ahd", "fast", "mono", "none", "pixelshift" }; -const char *RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::numMethods] = {"3-pass (best)", "1-pass (medium)", "fast", "mono", "none" }; +bool operator ==(const rtengine::procparams::WaveletParams& a, const rtengine::procparams::WaveletParams& b) +{ + if (a.enabled != b.enabled) { + return false; + } -const char *RAWParams::ff_BlurTypestring[RAWParams::numFlatFileBlurTypes] = {/*"Parametric",*/ "Area Flatfield", "Vertical Flatfield", "Horizontal Flatfield", "V+H Flatfield"}; + for (int i = 0; i < 9; i++) { + if (a.c[i] != b.c[i]) { + return false; + } + } -const std::vector WBParams::wbEntries = { - {"Camera", WBEntry::Type::CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, - {"Auto", WBEntry::Type::AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, - {"Daylight", WBEntry::Type::DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, - {"Cloudy", WBEntry::Type::CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, - {"Shade", WBEntry::Type::SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, - {"Water 1", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, - {"Water 2", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, - {"Tungsten", WBEntry::Type::TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, - {"Fluo F1", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, - {"Fluo F2", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, - {"Fluo F3", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, - {"Fluo F4", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, - {"Fluo F5", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, - {"Fluo F6", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, - {"Fluo F7", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, - {"Fluo F8", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, - {"Fluo F9", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, - {"Fluo F10", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, - {"Fluo F11", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, - {"Fluo F12", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, - {"HMI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, - {"GTI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, - {"JudgeIII Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, - {"Solux Lamp 3500K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, - {"Solux Lamp 4100K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, - {"Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, - {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, - {"LED LSI Lumelex 2040", WBEntry::Type::LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, - {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, - {"Flash 5500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, - {"Flash 6000K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, - {"Flash 6500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, - // Should remain the last one - {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} -}; + for (int i = 0; i < 9; i++) { + if (a.ch[i] != b.ch[i]) { + return false; + } + } + + return true; +} + +bool operator ==(const rtengine::procparams::DirPyrEqualizerParams& a, const rtengine::procparams::DirPyrEqualizerParams& b) +{ + if (a.enabled != b.enabled) { + return false; + } + + for (int i = 0; i < 6; i++) { + if (a.mult[i] != b.mult[i]) { + return false; + } + } + + return a.threshold == b.threshold; +} + +ToneCurveParams::ToneCurveParams() +{ + setDefaults(); +} + +void ToneCurveParams::setDefaults() +{ + autoexp = false; + clip = 0.02; + expcomp = 0; + brightness = 0; + contrast = 0; + saturation = 0; + black = 0; + hlcompr = 0; + hlcomprthresh = 33; + shcompr = 50; + curve.clear (); + curve.push_back (DCT_Linear); + curve2.clear (); + curve2.push_back (DCT_Linear); + curveMode = ToneCurveParams::TcMode::STD; + curveMode2 = ToneCurveParams::TcMode::STD; + hrenabled = false; + method = "Blend"; +} bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGreenRaw, LUTu &histBlueRaw) { @@ -316,68 +384,11 @@ bool ToneCurveParams::HLReconstructionNecessary (LUTu &histRedRaw, LUTu &histGre return histRedRaw[255] > 50 || histGreenRaw[255] > 50 || histBlueRaw[255] > 50 || histRedRaw[0] > 50 || histGreenRaw[0] > 50 || histBlueRaw[0] > 50; } -CropParams::CropParams() : - enabled(false), - x(0), - y(0), - w(0), - h(0), - fixratio(false) -{ -} - -// Maps crop to resized width (e.g. smaller previews) -void CropParams::mapToResized (int resizedWidth, int resizedHeight, int scale, int &x1, int &x2, int &y1, int &y2) const -{ - x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; - - if (enabled) { - x1 = min (resizedWidth - 1, max (0, x / scale)); - y1 = min (resizedHeight - 1, max (0, y / scale)); - x2 = min (resizedWidth, max (0, (x + w) / scale)); - y2 = min (resizedHeight, max (0, (y + h) / scale)); - } -} - RetinexParams::RetinexParams () { setDefaults (); } -void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) -{ - double v[12] = { 0.00, 0.50, 0.35, 0.35, - 0.60, 0.75, 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) { - curve.at (i) = v[i - 1]; - } -} - -void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) -{ - double v[16] = { 0.00, 0.1, 0.35, 0.00, - 0.25, 0.25, 0.35, 0.35, - 0.70, 0.25, 0.35, 0.35, - 1.00, 0.1, 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 RetinexParams::setDefaults() { enabled = false; @@ -427,33 +438,15 @@ void RetinexParams::getCurves (RetinextransmissionCurve &transmissionCurveLUT, R } -ColorToningParams::ColorToningParams () : hlColSat (60, 80, false), shadowsColSat (80, 208, false) +void RetinexParams::getDefaultgaintransmissionCurve (std::vector &curve) { - setDefaults(); -} - -void ColorToningParams::getDefaultColorCurve (std::vector &curve) -{ - double v[8] = { 0.050, 0.62, 0.25, 0.25, - 0.585, 0.11, 0.25, 0.25 - }; - - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - -void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) -{ - double v[16] = { 0.00, 0.3, 0.35, 0.00, - 0.25, 0.8, 0.35, 0.35, - 0.70, 0.8, 0.35, 0.35, - 1.00, 0.3, 0.00, 0.00 + double v[16] = { 0.00, 0.1, 0.35, 0.00, + 0.25, 0.25, 0.35, 0.35, + 0.70, 0.25, 0.35, 0.35, + 1.00, 0.1, 0.00, 0.00 }; + + curve.resize (17); curve.at (0 ) = double (FCT_MinMaxCPoints); @@ -462,34 +455,27 @@ void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) } } -void ColorToningParams::getDefaultCLCurve (std::vector &curve) -{ - double v[6] = { 0.00, 0.00, - 0.35, 0.65, - 1.00, 1.00 - }; - curve.resize (7); - curve.at (0) = double (DCT_NURBS); +void RetinexParams::getDefaulttransmissionCurve (std::vector &curve) +{ + double v[12] = { 0.00, 0.50, 0.35, 0.35, + 0.60, 0.75, 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) { curve.at (i) = v[i - 1]; } } -void ColorToningParams::getDefaultCL2Curve (std::vector &curve) +// Maps crop to resized width (e.g. smaller previews) +ColorToningParams::ColorToningParams () : hlColSat (60, 80, false), shadowsColSat (80, 208, false) { - double v[6] = { 0.00, 0.00, - 0.35, 0.65, - 1.00, 1.00 - }; - - curve.resize (7); - curve.at (0) = double (DCT_NURBS); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } + setDefaults(); } void ColorToningParams::setDefaults() @@ -808,6 +794,66 @@ void ColorToningParams::getCurves (ColorGradientCurve &colorCurveLUT, OpacityCur } } +void ColorToningParams::getDefaultColorCurve (std::vector &curve) +{ + double v[8] = { 0.050, 0.62, 0.25, 0.25, + 0.585, 0.11, 0.25, 0.25 + }; + + curve.resize (9); + curve.at (0) = double (FCT_MinMaxCPoints); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at (i) = v[i - 1]; + } +} + + +void ColorToningParams::getDefaultOpacityCurve (std::vector &curve) +{ + double v[16] = { 0.00, 0.3, 0.35, 0.00, + 0.25, 0.8, 0.35, 0.35, + 0.70, 0.8, 0.35, 0.35, + 1.00, 0.3, 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 ColorToningParams::getDefaultCLCurve (std::vector &curve) +{ + double v[6] = { 0.00, 0.00, + 0.35, 0.65, + 1.00, 1.00 + }; + + 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 ColorToningParams::getDefaultCL2Curve (std::vector &curve) +{ + double v[6] = { 0.00, 0.00, + 0.35, 0.65, + 1.00, 1.00 + }; + + curve.resize (7); + curve.at (0) = double (DCT_NURBS); + + for (size_t i = 1; i < curve.size(); ++i) { + curve.at (i) = v[i - 1]; + } +} + SharpeningParams::SharpeningParams() : enabled (false), radius (0.5), @@ -822,8 +868,8 @@ SharpeningParams::SharpeningParams() : deconvradius (0.75), deconviter (30), deconvdamping (20) -{}; - +{ +} VibranceParams::VibranceParams() : enabled (false), @@ -833,10 +879,244 @@ VibranceParams::VibranceParams() : protectskins (false), avoidcolorshift (true), pastsattog (true) -{}; +{ +} -//WaveletParams::WaveletParams (): hueskin(-5, 25, 170, 120, false), hueskin2(-260, -250, -130, -140, false), hllev(50, 75, 100, 98, false), bllev(0, 2, 50, 25, false), pastlev(0, 2, 30, 20, false), satlev(30, 45, 130, 100, false), edgcont(0, 20, 100, 75, false){ +const std::vector& WBParams::getWbEntries() +{ + static const std::vector wb_entries = { + {"Camera", WBEntry::Type::CAMERA, M ("TP_WBALANCE_CAMERA"), 0, 1.f, 1.f, 0.f}, + {"Auto", WBEntry::Type::AUTO, M ("TP_WBALANCE_AUTO"), 0, 1.f, 1.f, 0.f}, + {"Daylight", WBEntry::Type::DAYLIGHT, M ("TP_WBALANCE_DAYLIGHT"), 5300, 1.f, 1.f, 0.f}, + {"Cloudy", WBEntry::Type::CLOUDY, M ("TP_WBALANCE_CLOUDY"), 6200, 1.f, 1.f, 0.f}, + {"Shade", WBEntry::Type::SHADE, M ("TP_WBALANCE_SHADE"), 7600, 1.f, 1.f, 0.f}, + {"Water 1", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER1"), 35000, 0.3f, 1.1f, 0.f}, + {"Water 2", WBEntry::Type::WATER, M ("TP_WBALANCE_WATER2"), 48000, 0.63f, 1.38f, 0.f}, + {"Tungsten", WBEntry::Type::TUNGSTEN, M ("TP_WBALANCE_TUNGSTEN"), 2856, 1.f, 1.f, 0.f}, + {"Fluo F1", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO1"), 6430, 1.f, 1.f, 0.f}, + {"Fluo F2", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO2"), 4230, 1.f, 1.f, 0.f}, + {"Fluo F3", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO3"), 3450, 1.f, 1.f, 0.f}, + {"Fluo F4", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO4"), 2940, 1.f, 1.f, 0.f}, + {"Fluo F5", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO5"), 6350, 1.f, 1.f, 0.f}, + {"Fluo F6", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO6"), 4150, 1.f, 1.f, 0.f}, + {"Fluo F7", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO7"), 6500, 1.f, 1.f, 0.f}, + {"Fluo F8", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO8"), 5020, 1.f, 1.f, 0.f}, + {"Fluo F9", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO9"), 4330, 1.f, 1.f, 0.f}, + {"Fluo F10", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO10"), 5300, 1.f, 1.f, 0.f}, + {"Fluo F11", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO11"), 4000, 1.f, 1.f, 0.f}, + {"Fluo F12", WBEntry::Type::FLUORESCENT, M ("TP_WBALANCE_FLUO12"), 3000, 1.f, 1.f, 0.f}, + {"HMI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_HMI"), 4800, 1.f, 1.f, 0.f}, + {"GTI Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_GTI"), 5000, 1.f, 1.f, 0.f}, + {"JudgeIII Lamp", WBEntry::Type::LAMP, M ("TP_WBALANCE_JUDGEIII"), 5100, 1.f, 1.f, 0.f}, + {"Solux Lamp 3500K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX35"), 3480, 1.f, 1.f, 0.f}, + {"Solux Lamp 4100K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX41"), 3930, 1.f, 1.f, 0.f}, + {"Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47"), 4700, 1.f, 1.f, 0.f}, + {"NG Solux Lamp 4700K", WBEntry::Type::LAMP, M ("TP_WBALANCE_SOLUX47_NG"), 4480, 1.f, 1.f, 0.f}, + {"LED LSI Lumelex 2040", WBEntry::Type::LED, M ("TP_WBALANCE_LED_LSI"), 2970, 1.f, 1.f, 0.f}, + {"LED CRS SP12 WWMR16", WBEntry::Type::LED, M ("TP_WBALANCE_LED_CRS"), 3050, 1.f, 1.f, 0.f}, + {"Flash 5500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH55"), 5500, 1.f, 1.f, 0.f}, + {"Flash 6000K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH60"), 6000, 1.f, 1.f, 0.f}, + {"Flash 6500K", WBEntry::Type::FLASH, M ("TP_WBALANCE_FLASH65"), 6500, 1.f, 1.f, 0.f}, + // Should remain the last one + {"Custom", WBEntry::Type::CUSTOM, M ("TP_WBALANCE_CUSTOM"), 0, 1.f, 1.f, 0.f} + }; + + return wb_entries; +} + +DirPyrDenoiseParams::DirPyrDenoiseParams () +{ + setDefaults (); +} + +void DirPyrDenoiseParams::setDefaults() +{ + + lcurve = { + static_cast(FCT_MinMaxCPoints), + 0.05, + 0.15, + 0.35, + 0.35, + 0.55, + 0.04, + 0.35, + 0.35 + }; + + cccurve = { + static_cast(FCT_MinMaxCPoints), + 0.05, + 0.50, + 0.35, + 0.35, + 0.35, + 0.05, + 0.35, + 0.35 + }; + + enabled = false; + enhance = false; + median = false; + perform = false; + luma = 0; + passes = 1; + dmethod = "Lab"; + Lmethod = "SLI";//"CUR";// SLIDER method with value 0 is set as default, while the default Lcurve is populated via getDefaultNoisCurve and can be switched to by the user + Cmethod = "MAN"; + C2method = "AUTO"; + smethod = "shal"; + medmethod = "soft"; + methodmed = "none"; + rgbmethod = "soft"; + Ldetail = 0; + chroma = 15; + redchro = 0; + bluechro = 0; + gamma = 1.7; + perform = false; +} + +void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const +{ + lCurve.Set (this->lcurve); + cCurve.Set (this->cccurve); +} + +FattalToneMappingParams::FattalToneMappingParams() +{ + setDefaults(); +} + +void FattalToneMappingParams::setDefaults() +{ + enabled = false; + threshold = 0; + amount = 0; +} + +CropParams::CropParams() : + enabled(false), + x(0), + y(0), + w(0), + h(0), + fixratio(false) +{ +} + +void CropParams::mapToResized (int resizedWidth, int resizedHeight, int scale, int &x1, int &x2, int &y1, int &y2) const +{ + x1 = 0, x2 = resizedWidth, y1 = 0, y2 = resizedHeight; + + if (enabled) { + x1 = min (resizedWidth - 1, max (0, x / scale)); + y1 = min (resizedHeight - 1, max (0, y / scale)); + x2 = min (resizedWidth, max (0, (x + w) / scale)); + y2 = min (resizedHeight, max (0, (y + h) / scale)); + } +} + +CoarseTransformParams::CoarseTransformParams() +{ + setDefaults(); +} + +void CoarseTransformParams::setDefaults() +{ + rotate = 0; + hflip = false; + vflip = false; +} + +LensProfParams::LensProfParams() +{ + setDefaults(); +} + +void LensProfParams::setDefaults() +{ + lcMode = LcMode::NONE; + lcpFile = ""; + useDist = useVign = true; + useCA = false; + lfCameraMake = ""; + lfCameraModel = ""; + lfLens = ""; +} + +bool LensProfParams::useLensfun() const +{ + return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; +} + +bool LensProfParams::lfAutoMatch() const +{ + return lcMode == LcMode::LENSFUNAUTOMATCH; +} + +bool LensProfParams::useLcp() const +{ + return lcMode == LcMode::LCP && lcpFile.length() > 0; +} + +bool LensProfParams::lfManual() const +{ + return lcMode == LcMode::LENSFUNMANUAL; +} + +const std::vector& LensProfParams::getMethodStrings() const +{ + static const std::vector method_strings = { + "none", + "lfauto", + "lfmanual", + "lcp" + }; + return method_strings; +} + +Glib::ustring LensProfParams::getMethodString(LcMode mode) const +{ + return getMethodStrings()[toUnderlying(mode)]; +} + +LensProfParams::LcMode LensProfParams::getMethodNumber(const Glib::ustring& mode) const +{ + for (std::vector::size_type i = 0; i < getMethodStrings().size(); ++i) { + if (getMethodStrings()[i] == mode) { + return static_cast(i); + } + } + return LcMode::NONE; +} + +const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); + +ColorManagementParams::ColorManagementParams() +{ + setDefaults(); +} + +void ColorManagementParams::setDefaults() +{ + input = "(cameraICC)"; + toneCurve = false; + applyLookTable = false; + applyBaselineExposureOffset = true; + applyHueSatMap = true; + dcpIlluminant = 0; + working = "ProPhoto"; + output = "RT_sRGB"; + outputIntent = RI_RELATIVE; + outputBPC = true; + gamma = "default"; + gampos = 2.22; + slpos = 4.5; + freegamma = false; +} WaveletParams::WaveletParams() : hueskin ( -5, 25, 170, 120, false), @@ -855,94 +1135,6 @@ WaveletParams::WaveletParams() : setDefaults (); } -void WaveletParams::getDefaultOpacityCurveRG (std::vector &curve) -{ - double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35 - }; - - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} -void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) -{ - double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35 - }; - - curve.resize (9); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - -void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) -{ - double v[16] = { 0.00, 0.35, 0.35, 0.00, - 0.35, 0.75, 0.35, 0.35, - 0.60, 0.75, 0.35, 0.35, - 1.00, 0.35, 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 WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) -{ - double v[8] = { 0.0, 0.50, 0.35, 0.35, - 1.00, 0.50, 0.35, 0.35 - }; - - /*double v[12]={ 0.00, 0.53, 0.35, 0.00, - 0.42, 0.53, 0.35, 0.35, - 1.00, 0.15, 0.00, 0.00 }; - */ - curve.resize (9); - curve.at (0) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } -} - - -void WaveletParams::getDefaultCCWCurve (std::vector &curve) -{ - double v[12] = { 0.0, 0.25, 0.35, 0.35, - 0.50, 0.75, 0.35, 0.35, - 0.90, 0.0, 0.35, 0.35 - }; - - curve.resize (13); - curve.at (0 ) = double (FCT_MinMaxCPoints); - - for (size_t i = 1; i < curve.size(); ++i) { - curve.at (i) = v[i - 1]; - } - -} - -void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const -{ - cCurve.Set (this->ccwcurve); - opacityCurveLUTRG.Set (this->opacityCurveRG); - opacityCurveLUTBY.Set (this->opacityCurveBY); - opacityCurveLUTW.Set (this->opacityCurveW); - opacityCurveLUTWL.Set (this->opacityCurveWL); - -} - void WaveletParams::setDefaults() { getDefaultCCWCurve (ccwcurve); @@ -1039,185 +1231,128 @@ void WaveletParams::setDefaults() } - -DirPyrDenoiseParams::DirPyrDenoiseParams () +void WaveletParams::getCurves (WavCurve &cCurve, WavOpacityCurveRG &opacityCurveLUTRG, WavOpacityCurveBY &opacityCurveLUTBY, WavOpacityCurveW &opacityCurveLUTW, WavOpacityCurveWL &opacityCurveLUTWL) const { - setDefaults (); + cCurve.Set (this->ccwcurve); + opacityCurveLUTRG.Set (this->opacityCurveRG); + opacityCurveLUTBY.Set (this->opacityCurveBY); + opacityCurveLUTW.Set (this->opacityCurveW); + opacityCurveLUTWL.Set (this->opacityCurveWL); + } -void DirPyrDenoiseParams::setDefaults() +void WaveletParams::getDefaultCCWCurve (std::vector &curve) { - - lcurve = { + curve = { static_cast(FCT_MinMaxCPoints), - 0.05, - 0.15, + 0.0, + 0.25, 0.35, 0.35, - 0.55, - 0.04, + 0.50, + 0.75, + 0.35, + 0.35, + 0.90, + 0.0, 0.35, 0.35 }; - cccurve = { +} + +void WaveletParams::getDefaultOpacityCurveRG (std::vector &curve) +{ + curve = { static_cast(FCT_MinMaxCPoints), - 0.05, + 0.0, 0.50, 0.35, 0.35, - 0.35, - 0.05, + 1.00, + 0.50, 0.35, 0.35 }; - - enabled = false; - enhance = false; - median = false; - perform = false; - luma = 0; - passes = 1; - dmethod = "Lab"; - Lmethod = "SLI";//"CUR";// SLIDER method with value 0 is set as default, while the default Lcurve is populated via getDefaultNoisCurve and can be switched to by the user - Cmethod = "MAN"; - C2method = "AUTO"; - smethod = "shal"; - medmethod = "soft"; - methodmed = "none"; - rgbmethod = "soft"; - Ldetail = 0; - chroma = 15; - redchro = 0; - bluechro = 0; - gamma = 1.7; - perform = false; } -void DirPyrDenoiseParams::getCurves (NoiseCurve &lCurve, NoiseCurve &cCurve) const +void WaveletParams::getDefaultOpacityCurveBY (std::vector &curve) { - lCurve.Set (this->lcurve); - cCurve.Set (this->cccurve); -} - -FattalToneMappingParams::FattalToneMappingParams() -{ - setDefaults(); -} - -void FattalToneMappingParams::setDefaults() -{ - enabled = false; - threshold = 0; - amount = 0; -} - -ToneCurveParams::ToneCurveParams() -{ - setDefaults(); -} - -void ToneCurveParams::setDefaults() -{ - autoexp = false; - clip = 0.02; - expcomp = 0; - brightness = 0; - contrast = 0; - saturation = 0; - black = 0; - hlcompr = 0; - hlcomprthresh = 33; - shcompr = 50; - curve.clear (); - curve.push_back (DCT_Linear); - curve2.clear (); - curve2.push_back (DCT_Linear); - curveMode = ToneCurveParams::Mode::STD; - curveMode2 = ToneCurveParams::Mode::STD; - hrenabled = false; - method = "Blend"; -} - -LensProfParams::LensProfParams() -{ - setDefaults(); -} - -void LensProfParams::setDefaults() -{ - lcMode = LcMode::NONE; - lcpFile = ""; - useDist = useVign = true; - useCA = false; - lfCameraMake = ""; - lfCameraModel = ""; - lfLens = ""; -} - -bool LensProfParams::useLensfun() const -{ - return lcMode == LcMode::LENSFUNAUTOMATCH || lcMode == LcMode::LENSFUNMANUAL; -} - -bool LensProfParams::lfAutoMatch() const -{ - return lcMode == LcMode::LENSFUNAUTOMATCH; -} - -bool LensProfParams::useLcp() const -{ - return lcMode == LcMode::LCP && lcpFile.length() > 0; -} - -bool LensProfParams::lfManual() const -{ - return lcMode == LcMode::LENSFUNMANUAL; -} - -const std::vector& LensProfParams::getMethodStrings() const -{ - static const std::vector method_strings = { - "none", - "lfauto", - "lfmanual", - "lcp" + curve = { + static_cast(FCT_MinMaxCPoints), + 0.0, + 0.50, + 0.35, + 0.35, + 1.00, + 0.50, + 0.35, + 0.35 }; - return method_strings; } -Glib::ustring LensProfParams::getMethodString(LcMode mode) const + +void WaveletParams::getDefaultOpacityCurveW (std::vector &curve) { - return getMethodStrings()[toUnderlying(mode)]; + curve = { + static_cast(FCT_MinMaxCPoints), + 0.00, + 0.35, + 0.35, + 0.00, + 0.35, + 0.75, + 0.35, + 0.35, + 0.60, + 0.75, + 0.35, + 0.35, + 1.00, + 0.35, + 0.00, + 0.00 + }; } -LensProfParams::LcMode LensProfParams::getMethodNumber(const Glib::ustring& mode) const +void WaveletParams::getDefaultOpacityCurveWL (std::vector &curve) { - for (std::vector::size_type i = 0; i < getMethodStrings().size(); ++i) { - if (getMethodStrings()[i] == mode) { - return static_cast(i); - } - } - return LcMode::NONE; + curve = { + static_cast(FCT_MinMaxCPoints), + 0.0, + 0.50, + 0.35, + 0.35, + 1.00, + 0.50, + 0.35, + 0.35 + }; } -CoarseTransformParams::CoarseTransformParams() + +DirPyrEqualizerParams::DirPyrEqualizerParams() : + hueskin (20, 80, 2000, 1200, false) +{ +} + +FilmSimulationParams::FilmSimulationParams() { setDefaults(); } -void CoarseTransformParams::setDefaults() +void FilmSimulationParams::setDefaults() { - rotate = 0; - hflip = false; - vflip = false; + enabled = false; + clutFilename = Glib::ustring(); + strength = 100; } void RAWParams::BayerSensor::setPixelShiftDefaults() { pixelShiftMotion = 0; - pixelShiftMotionCorrection = RAWParams::BayerSensor::Grid3x3New; - pixelShiftMotionCorrectionMethod = RAWParams::BayerSensor::Automatic; + pixelShiftMotionCorrection = RAWParams::BayerSensor::PSMotionCorrection::GRID_3X3_NEW; + pixelShiftMotionCorrectionMethod = RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO; pixelShiftStddevFactorGreen = 5.0; pixelShiftStddevFactorRed = 5.0; pixelShiftStddevFactorBlue = 5.0; @@ -1245,9 +1380,55 @@ void RAWParams::BayerSensor::setPixelShiftDefaults() pixelShiftNonGreenAmaze = false; } +const std::vector& RAWParams::BayerSensor::getMethodStrings() +{ + static const std::vector method_strings { + "amaze", + "igv", + "lmmse", + "eahd", + "hphd", + "vng4", + "dcb", + "ahd", + "fast", + "mono", + "none", + "pixelshift" + }; + return method_strings; +} + +Glib::ustring RAWParams::BayerSensor::getMethodString(Method method) +{ + return getMethodStrings()[toUnderlying(method)]; +} + +const std::vector& RAWParams::XTransSensor::getMethodStrings() +{ + static const std::vector method_strings { + "3-pass (best)", + "1-pass (medium)", + "fast", + "mono", + "none" + }; + return method_strings; +} + +Glib::ustring RAWParams::XTransSensor::getMethodString(Method method) +{ + return getMethodStrings()[toUnderlying(method)]; +} + +RAWParams::RAWParams() +{ + setDefaults(); +} + void RAWParams::setDefaults() { - bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze]; + bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE); bayersensor.imageNum = 0; bayersensor.ccSteps = 0; bayersensor.dcb_iterations = 2; @@ -1262,7 +1443,7 @@ void RAWParams::setDefaults() bayersensor.linenoise = 0; bayersensor.greenthresh = 0; - xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::threePass]; + xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS); xtranssensor.ccSteps = 0; xtranssensor.blackred = 0.0; xtranssensor.blackgreen = 0.0; @@ -1273,7 +1454,7 @@ void RAWParams::setDefaults() df_autoselect = false; ff_AutoSelect = false; ff_BlurRadius = 32; - ff_BlurType = RAWParams::ff_BlurTypestring[RAWParams::area_ff]; + ff_BlurType = RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::AREA); ff_AutoClipControl = false; ff_clipControl = 0; cared = 0; @@ -1288,22 +1469,20 @@ void RAWParams::setDefaults() } -void ColorManagementParams::setDefaults() +const std::vector& RAWParams::getFlatFieldBlurTypeStrings() { - input = "(cameraICC)"; - toneCurve = false; - applyLookTable = false; - applyBaselineExposureOffset = true; - applyHueSatMap = true; - dcpIlluminant = 0; - working = "ProPhoto"; - output = "RT_sRGB"; - outputIntent = RI_RELATIVE; - outputBPC = true; - gamma = "default"; - gampos = 2.22; - slpos = 4.5; - freegamma = false; + static const std::vector blur_type_strings { + "Area Flatfield", + "Vertical Flatfield", + "Horizontal Flatfield", + "V+H Flatfield" + }; + return blur_type_strings; +} + +Glib::ustring RAWParams::getFlatFieldBlurTypeString(FlatFieldBlurType type) +{ + return getFlatFieldBlurTypeStrings()[toUnderlying(type)]; } ProcParams::ProcParams () @@ -1312,26 +1491,6 @@ ProcParams::ProcParams () setDefaults (); } -void ProcParams::init () -{ -} - -void ProcParams::cleanup () -{ -} - -ProcParams* ProcParams::create () -{ - - return new ProcParams(); -} - -void ProcParams::destroy (ProcParams* pp) -{ - - delete pp; -} - void ProcParams::setDefaults () { @@ -1462,11 +1621,11 @@ void ProcParams::setDefaults () colorappearance.curve.push_back (DCT_Linear); colorappearance.curve2.clear (); colorappearance.curve2.push_back (DCT_Linear); - colorappearance.curveMode = ColorAppearanceParams::TCMode::LIGHT; - colorappearance.curveMode2 = ColorAppearanceParams::TCMode::LIGHT; + colorappearance.curveMode = ColorAppearanceParams::TcMode::LIGHT; + colorappearance.curveMode2 = ColorAppearanceParams::TcMode::LIGHT; colorappearance.curve3.clear (); colorappearance.curve3.push_back (DCT_Linear); - colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::CHROMA; + colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::CHROMA; colorappearance.tempout = 5000; colorappearance.greenout = 1.0; colorappearance.ybout = 18; @@ -1602,10 +1761,10 @@ void ProcParams::setDefaults () blackwhite.setting = "NormalContrast"; blackwhite.beforeCurve.clear (); blackwhite.beforeCurve.push_back (DCT_Linear); - blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_STD_BW; + blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::STD_BW; blackwhite.afterCurve.clear (); blackwhite.afterCurve.push_back (DCT_Linear); - blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_STD_BW; + blackwhite.afterCurveMode = BlackWhiteParams::TcMode::STD_BW; blackwhite.algo = "SP"; resize.enabled = false; @@ -1653,56 +1812,6 @@ void ProcParams::setDefaults () ppVersion = PPVERSION; } -static Glib::ustring expandRelativePath (const Glib::ustring &procparams_fname, const Glib::ustring &prefix, Glib::ustring embedded_fname) -{ - if (embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { - return embedded_fname; - } - - if (prefix != "") { - if (embedded_fname.length() < prefix.length() || embedded_fname.substr (0, prefix.length()) != prefix) { - return embedded_fname; - } - - embedded_fname = embedded_fname.substr (prefix.length()); - } - - if (Glib::path_is_absolute (embedded_fname)) { - return prefix + embedded_fname; - } - - Glib::ustring absPath = prefix + Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S + embedded_fname; - return absPath; -} - -static Glib::ustring relativePathIfInside (const Glib::ustring &procparams_fname, bool fnameAbsolute, Glib::ustring embedded_fname) -{ - if (fnameAbsolute || embedded_fname == "" || !Glib::path_is_absolute (procparams_fname)) { - return embedded_fname; - } - - Glib::ustring prefix = ""; - - if (embedded_fname.length() > 5 && embedded_fname.substr (0, 5) == "file:") { - embedded_fname = embedded_fname.substr (5); - prefix = "file:"; - } - - if (!Glib::path_is_absolute (embedded_fname)) { - return prefix + embedded_fname; - } - - Glib::ustring dir1 = Glib::path_get_dirname (procparams_fname) + G_DIR_SEPARATOR_S; - Glib::ustring dir2 = Glib::path_get_dirname (embedded_fname) + G_DIR_SEPARATOR_S; - - if (dir2.substr (0, dir1.length()) != dir1) { - // it's in a different directory, ie not inside - return prefix + embedded_fname; - } - - return prefix + embedded_fname.substr (dir1.length()); -} - int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, bool fnameAbsolute, ParamsEdited* pedited) { if (fname.empty () && fname2.empty ()) { @@ -1715,7 +1824,7 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b Glib::KeyFile keyFile; // Version - keyFile.set_string ("Version", "AppVersion", APPVERSION); + keyFile.set_string ("Version", "AppVersion", RTVERSION); keyFile.set_integer ("Version", "Version", PPVERSION); saveToKeyfile(!pedited || pedited->general.rank, "General", "Rank", rank, keyFile); @@ -1738,13 +1847,13 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->toneCurve.hrenabled, "HLRecovery", "Enabled", toneCurve.hrenabled, keyFile); saveToKeyfile(!pedited || pedited->toneCurve.method, "HLRecovery", "Method", toneCurve.method, keyFile); - const std::map tc_mapping = { - {ToneCurveParams::Mode::STD, "Standard"}, - {ToneCurveParams::Mode::FILMLIKE, "FilmLike"}, - {ToneCurveParams::Mode::SATANDVALBLENDING, "SatAndValueBlending"}, - {ToneCurveParams::Mode::WEIGHTEDSTD,"WeightedStd"}, - {ToneCurveParams::Mode::LUMINANCE, "Luminance"}, - {ToneCurveParams::Mode::PERCEPTUAL, "Perceptual"} + const std::map tc_mapping = { + {ToneCurveParams::TcMode::STD, "Standard"}, + {ToneCurveParams::TcMode::FILMLIKE, "FilmLike"}, + {ToneCurveParams::TcMode::SATANDVALBLENDING, "SatAndValueBlending"}, + {ToneCurveParams::TcMode::WEIGHTEDSTD,"WeightedStd"}, + {ToneCurveParams::TcMode::LUMINANCE, "Luminance"}, + {ToneCurveParams::TcMode::PERCEPTUAL, "Perceptual"} }; saveToKeyfile(!pedited || pedited->toneCurve.curveMode, "Exposure", "CurveMode", tc_mapping, toneCurve.curveMode, keyFile); @@ -1806,11 +1915,11 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b // Black & White saveToKeyfile(!pedited || pedited->blackwhite.enabled, "Black & White", "Enabled", blackwhite.enabled, keyFile); - saveToKeyfile(!pedited || pedited->blackwhite.method, "Black & White", "Method", blackwhite.method , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.method, "Black & White", "Method", blackwhite.method, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.autoc, "Black & White", "Auto", blackwhite.autoc, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.enabledcc, "Black & White", "ComplementaryColors", blackwhite.enabledcc, keyFile); - saveToKeyfile(!pedited || pedited->blackwhite.setting, "Black & White", "Setting", blackwhite.setting , keyFile); - saveToKeyfile(!pedited || pedited->blackwhite.filter, "Black & White", "Filter", blackwhite.filter , keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.setting, "Black & White", "Setting", blackwhite.setting, keyFile); + saveToKeyfile(!pedited || pedited->blackwhite.filter, "Black & White", "Filter", blackwhite.filter, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.mixerRed, "Black & White", "MixerRed", blackwhite.mixerRed, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.mixerOrange, "Black & White", "MixerOrange", blackwhite.mixerOrange, keyFile); saveToKeyfile(!pedited || pedited->blackwhite.mixerYellow, "Black & White", "MixerYellow", blackwhite.mixerYellow, keyFile); @@ -1829,10 +1938,10 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b "Black & White", "BeforeCurveMode", { - {BlackWhiteParams::TC_MODE_STD_BW, "Standard"}, - {BlackWhiteParams::TC_MODE_FILMLIKE_BW, "FilmLike"}, - {BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW, "SatAndValueBlending"}, - {BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW, "WeightedStd"} + {BlackWhiteParams::TcMode::STD_BW, "Standard"}, + {BlackWhiteParams::TcMode::FILMLIKE_BW, "FilmLike"}, + {BlackWhiteParams::TcMode::SATANDVALBLENDING_BW, "SatAndValueBlending"}, + {BlackWhiteParams::TcMode::WEIGHTEDSTD_BW, "WeightedStd"} }, blackwhite.beforeCurveMode, @@ -1843,8 +1952,8 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b "Black & White", "AfterCurveMode", { - {BlackWhiteParams::TC_MODE_STD_BW, "Standard"}, - {BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW, "WeightedStd"} + {BlackWhiteParams::TcMode::STD_BW, "Standard"}, + {BlackWhiteParams::TcMode::WEIGHTEDSTD_BW, "WeightedStd"} }, blackwhite.afterCurveMode, @@ -1965,9 +2074,9 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorappearance.tonecie, "Color appearance", "Tonecie", colorappearance.tonecie, keyFile); // if (!pedited || pedited->colorappearance.sharpcie) keyFile.set_boolean ("Color appearance", "Sharpcie", colorappearance.sharpcie); - const std::map ca_mapping = { - {ColorAppearanceParams::TCMode::LIGHT, "Lightness"}, - {ColorAppearanceParams::TCMode::BRIGHT, "Brightness"} + const std::map ca_mapping = { + {ColorAppearanceParams::TcMode::LIGHT, "Lightness"}, + {ColorAppearanceParams::TcMode::BRIGHT, "Brightness"} }; saveToKeyfile(!pedited || pedited->colorappearance.curveMode, "Color appearance", "CurveMode", ca_mapping, colorappearance.curveMode, keyFile); @@ -1977,9 +2086,9 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b "Color appearance", "CurveMode3", { - {ColorAppearanceParams::CTCMode::CHROMA, "Chroma"}, - {ColorAppearanceParams::CTCMode::SATUR, "Saturation"}, - {ColorAppearanceParams::CTCMode::COLORF, "Colorfullness"} + {ColorAppearanceParams::CtcMode::CHROMA, "Chroma"}, + {ColorAppearanceParams::CtcMode::SATUR, "Saturation"}, + {ColorAppearanceParams::CtcMode::COLORF, "Colorfullness"} }, colorappearance.curveMode3, @@ -2214,13 +2323,15 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b std::stringstream ss; ss << "Contrast" << (i + 1); - saveToKeyfile(!pedited || pedited->wavelet.c[i], "Wavelet", ss.str(), wavelet.c[i], keyFile); } + saveToKeyfile(!pedited || pedited->wavelet.c[i], "Wavelet", ss.str(), wavelet.c[i], keyFile); + } for (int i = 0; i < 9; i++) { std::stringstream ss; ss << "Chroma" << (i + 1); - saveToKeyfile(!pedited || pedited->wavelet.ch[i], "Wavelet", ss.str(), wavelet.ch[i], keyFile); } + saveToKeyfile(!pedited || pedited->wavelet.ch[i], "Wavelet", ss.str(), wavelet.ch[i], keyFile); + } saveToKeyfile(!pedited || pedited->wavelet.sup, "Wavelet", "ContExtra", wavelet.sup, keyFile); saveToKeyfile(!pedited || pedited->wavelet.HSmethod, "Wavelet", "HSMethod", wavelet.HSmethod, keyFile); @@ -2342,72 +2453,72 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b saveToKeyfile(!pedited || pedited->colorToning.cl2curve, "ColorToning", "Cl2Curve", colorToning.cl2curve, keyFile); // Raw - saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame) , keyFile); - saveToKeyfile(!pedited || pedited->raw.df_autoselect, "RAW", "DarkFrameAuto", raw.df_autoselect , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_file, "RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file) , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_AutoSelect, "RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_BlurRadius, "RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_BlurType, "RAW", "FlatFieldBlurType", raw.ff_BlurType , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_AutoClipControl, "RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl , keyFile); - saveToKeyfile(!pedited || pedited->raw.ff_clipControl, "RAW", "FlatFieldClipControl", raw.ff_clipControl , keyFile); - saveToKeyfile(!pedited || pedited->raw.ca_autocorrect, "RAW", "CA", raw.ca_autocorrect , keyFile); - saveToKeyfile(!pedited || pedited->raw.cared, "RAW", "CARed", raw.cared , keyFile); - saveToKeyfile(!pedited || pedited->raw.cablue, "RAW", "CABlue", raw.cablue , keyFile); - saveToKeyfile(!pedited || pedited->raw.hotPixelFilter, "RAW", "HotPixelFilter", raw.hotPixelFilter , keyFile); - saveToKeyfile(!pedited || pedited->raw.deadPixelFilter, "RAW", "DeadPixelFilter", raw.deadPixelFilter , keyFile); - saveToKeyfile(!pedited || pedited->raw.hotdeadpix_thresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.method, "RAW Bayer", "Method", raw.bayersensor.method , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.imageNum, "RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1 , keyFile); + saveToKeyfile(!pedited || pedited->raw.darkFrame, "RAW", "DarkFrame", relativePathIfInside (fname, fnameAbsolute, raw.dark_frame), keyFile); + saveToKeyfile(!pedited || pedited->raw.df_autoselect, "RAW", "DarkFrameAuto", raw.df_autoselect, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_file, "RAW", "FlatFieldFile", relativePathIfInside (fname, fnameAbsolute, raw.ff_file), keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_AutoSelect, "RAW", "FlatFieldAutoSelect", raw.ff_AutoSelect, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_BlurRadius, "RAW", "FlatFieldBlurRadius", raw.ff_BlurRadius, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_BlurType, "RAW", "FlatFieldBlurType", raw.ff_BlurType, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_AutoClipControl, "RAW", "FlatFieldAutoClipControl", raw.ff_AutoClipControl, keyFile); + saveToKeyfile(!pedited || pedited->raw.ff_clipControl, "RAW", "FlatFieldClipControl", raw.ff_clipControl, keyFile); + saveToKeyfile(!pedited || pedited->raw.ca_autocorrect, "RAW", "CA", raw.ca_autocorrect, keyFile); + saveToKeyfile(!pedited || pedited->raw.cared, "RAW", "CARed", raw.cared, keyFile); + saveToKeyfile(!pedited || pedited->raw.cablue, "RAW", "CABlue", raw.cablue, keyFile); + saveToKeyfile(!pedited || pedited->raw.hotPixelFilter, "RAW", "HotPixelFilter", raw.hotPixelFilter, keyFile); + saveToKeyfile(!pedited || pedited->raw.deadPixelFilter, "RAW", "DeadPixelFilter", raw.deadPixelFilter, keyFile); + saveToKeyfile(!pedited || pedited->raw.hotdeadpix_thresh, "RAW", "HotDeadPixelThresh", raw.hotdeadpix_thresh, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.method, "RAW Bayer", "Method", raw.bayersensor.method, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.imageNum, "RAW Bayer", "ImageNum", raw.bayersensor.imageNum + 1, keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.ccSteps, "RAW Bayer", "CcSteps", raw.bayersensor.ccSteps, keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack0, "RAW Bayer", "PreBlack0", raw.bayersensor.black0 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack1, "RAW Bayer", "PreBlack1", raw.bayersensor.black1 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack2, "RAW Bayer", "PreBlack2", raw.bayersensor.black2 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack3, "RAW Bayer", "PreBlack3", raw.bayersensor.black3 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.exTwoGreen, "RAW Bayer", "PreTwoGreen", raw.bayersensor.twogreen , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack0, "RAW Bayer", "PreBlack0", raw.bayersensor.black0, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack1, "RAW Bayer", "PreBlack1", raw.bayersensor.black1, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack2, "RAW Bayer", "PreBlack2", raw.bayersensor.black2, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exBlack3, "RAW Bayer", "PreBlack3", raw.bayersensor.black3, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.exTwoGreen, "RAW Bayer", "PreTwoGreen", raw.bayersensor.twogreen, keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.linenoise, "RAW Bayer", "LineDenoise", raw.bayersensor.linenoise, keyFile); saveToKeyfile(!pedited || pedited->raw.bayersensor.greenEq, "RAW Bayer", "GreenEqThreshold", raw.bayersensor.greenthresh, keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbIterations, "RAW Bayer", "DCBIterations", raw.bayersensor.dcb_iterations , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbEnhance, "RAW Bayer", "DCBEnhance", raw.bayersensor.dcb_enhance , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.lmmseIterations, "RAW Bayer", "LMMSEIterations", raw.bayersensor.lmmse_iterations , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotion, "RAW Bayer", "PixelShiftMotion", raw.bayersensor.pixelShiftMotion , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrection, "RAW Bayer", "PixelShiftMotionCorrection", raw.bayersensor.pixelShiftMotionCorrection , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod, "RAW Bayer", "PixelShiftMotionCorrectionMethod", raw.bayersensor.pixelShiftMotionCorrectionMethod , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen, "RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorRed, "RAW Bayer", "pixelShiftStddevFactorRed", raw.bayersensor.pixelShiftStddevFactorRed , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorBlue, "RAW Bayer", "pixelShiftStddevFactorBlue", raw.bayersensor.pixelShiftStddevFactorBlue , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEperIso, "RAW Bayer", "PixelShiftEperIso", raw.bayersensor.pixelShiftEperIso , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNreadIso, "RAW Bayer", "PixelShiftNreadIso", raw.bayersensor.pixelShiftNreadIso , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftPrnu, "RAW Bayer", "PixelShiftPrnu", raw.bayersensor.pixelShiftPrnu , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSigma, "RAW Bayer", "PixelShiftSigma", raw.bayersensor.pixelShiftSigma , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSum, "RAW Bayer", "PixelShiftSum", raw.bayersensor.pixelShiftSum , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftRedBlueWeight, "RAW Bayer", "PixelShiftRedBlueWeight", raw.bayersensor.pixelShiftRedBlueWeight , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotion, "RAW Bayer", "PixelShiftShowMotion", raw.bayersensor.pixelShiftShowMotion , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly, "RAW Bayer", "PixelShiftShowMotionMaskOnly", raw.bayersensor.pixelShiftShowMotionMaskOnly , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftAutomatic, "RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal, "RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenVertical, "RAW Bayer", "pixelShiftNonGreenVertical", raw.bayersensor.pixelShiftNonGreenVertical , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftHoleFill, "RAW Bayer", "pixelShiftHoleFill", raw.bayersensor.pixelShiftHoleFill , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian, "RAW Bayer", "pixelShiftMedian", raw.bayersensor.pixelShiftMedian , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian3, "RAW Bayer", "pixelShiftMedian3", raw.bayersensor.pixelShiftMedian3 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftGreen, "RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftBlur, "RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSmooth, "RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftExp0, "RAW Bayer", "pixelShiftExp0", raw.bayersensor.pixelShiftExp0 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftLmmse, "RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBright, "RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel, "RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross, "RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross2, "RAW Bayer", "pixelShiftNonGreenCross2", raw.bayersensor.pixelShiftNonGreenCross2 , keyFile); - saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenAmaze, "RAW Bayer", "pixelShiftNonGreenAmaze", raw.bayersensor.pixelShiftNonGreenAmaze , keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method , keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbIterations, "RAW Bayer", "DCBIterations", raw.bayersensor.dcb_iterations, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.dcbEnhance, "RAW Bayer", "DCBEnhance", raw.bayersensor.dcb_enhance, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.lmmseIterations, "RAW Bayer", "LMMSEIterations", raw.bayersensor.lmmse_iterations, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotion, "RAW Bayer", "PixelShiftMotion", raw.bayersensor.pixelShiftMotion, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrection, "RAW Bayer", "PixelShiftMotionCorrection", toUnderlying(raw.bayersensor.pixelShiftMotionCorrection), keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod, "RAW Bayer", "PixelShiftMotionCorrectionMethod", toUnderlying(raw.bayersensor.pixelShiftMotionCorrectionMethod), keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorGreen, "RAW Bayer", "pixelShiftStddevFactorGreen", raw.bayersensor.pixelShiftStddevFactorGreen, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorRed, "RAW Bayer", "pixelShiftStddevFactorRed", raw.bayersensor.pixelShiftStddevFactorRed, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftStddevFactorBlue, "RAW Bayer", "pixelShiftStddevFactorBlue", raw.bayersensor.pixelShiftStddevFactorBlue, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEperIso, "RAW Bayer", "PixelShiftEperIso", raw.bayersensor.pixelShiftEperIso, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNreadIso, "RAW Bayer", "PixelShiftNreadIso", raw.bayersensor.pixelShiftNreadIso, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftPrnu, "RAW Bayer", "PixelShiftPrnu", raw.bayersensor.pixelShiftPrnu, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSigma, "RAW Bayer", "PixelShiftSigma", raw.bayersensor.pixelShiftSigma, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSum, "RAW Bayer", "PixelShiftSum", raw.bayersensor.pixelShiftSum, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftRedBlueWeight, "RAW Bayer", "PixelShiftRedBlueWeight", raw.bayersensor.pixelShiftRedBlueWeight, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotion, "RAW Bayer", "PixelShiftShowMotion", raw.bayersensor.pixelShiftShowMotion, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftShowMotionMaskOnly, "RAW Bayer", "PixelShiftShowMotionMaskOnly", raw.bayersensor.pixelShiftShowMotionMaskOnly, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftAutomatic, "RAW Bayer", "pixelShiftAutomatic", raw.bayersensor.pixelShiftAutomatic, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenHorizontal, "RAW Bayer", "pixelShiftNonGreenHorizontal", raw.bayersensor.pixelShiftNonGreenHorizontal, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenVertical, "RAW Bayer", "pixelShiftNonGreenVertical", raw.bayersensor.pixelShiftNonGreenVertical, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftHoleFill, "RAW Bayer", "pixelShiftHoleFill", raw.bayersensor.pixelShiftHoleFill, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian, "RAW Bayer", "pixelShiftMedian", raw.bayersensor.pixelShiftMedian, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftMedian3, "RAW Bayer", "pixelShiftMedian3", raw.bayersensor.pixelShiftMedian3, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftGreen, "RAW Bayer", "pixelShiftGreen", raw.bayersensor.pixelShiftGreen, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftBlur, "RAW Bayer", "pixelShiftBlur", raw.bayersensor.pixelShiftBlur, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftSmooth, "RAW Bayer", "pixelShiftSmoothFactor", raw.bayersensor.pixelShiftSmoothFactor, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftExp0, "RAW Bayer", "pixelShiftExp0", raw.bayersensor.pixelShiftExp0, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftLmmse, "RAW Bayer", "pixelShiftLmmse", raw.bayersensor.pixelShiftLmmse, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBright, "RAW Bayer", "pixelShiftEqualBright", raw.bayersensor.pixelShiftEqualBright, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftEqualBrightChannel, "RAW Bayer", "pixelShiftEqualBrightChannel", raw.bayersensor.pixelShiftEqualBrightChannel, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross, "RAW Bayer", "pixelShiftNonGreenCross", raw.bayersensor.pixelShiftNonGreenCross, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenCross2, "RAW Bayer", "pixelShiftNonGreenCross2", raw.bayersensor.pixelShiftNonGreenCross2, keyFile); + saveToKeyfile(!pedited || pedited->raw.bayersensor.pixelShiftNonGreenAmaze, "RAW Bayer", "pixelShiftNonGreenAmaze", raw.bayersensor.pixelShiftNonGreenAmaze, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.method, "RAW X-Trans", "Method", raw.xtranssensor.method, keyFile); saveToKeyfile(!pedited || pedited->raw.xtranssensor.ccSteps, "RAW X-Trans", "CcSteps", raw.xtranssensor.ccSteps, keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackRed, "RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred , keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen , keyFile); - saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackBlue, "RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue , keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackRed, "RAW X-Trans", "PreBlackRed", raw.xtranssensor.blackred, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackGreen, "RAW X-Trans", "PreBlackGreen", raw.xtranssensor.blackgreen, keyFile); + saveToKeyfile(!pedited || pedited->raw.xtranssensor.exBlackBlue, "RAW X-Trans", "PreBlackBlue", raw.xtranssensor.blackblue, keyFile); // Raw exposition - saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos , keyFile); - saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser , keyFile); + saveToKeyfile(!pedited || pedited->raw.exPos, "RAW", "PreExposure", raw.expos, keyFile); + saveToKeyfile(!pedited || pedited->raw.exPreser, "RAW", "PrePreserv", raw.preser, keyFile); // EXIF change list if (!pedited || pedited->exif) { @@ -2445,26 +2556,6 @@ int ProcParams::save (const Glib::ustring &fname, const Glib::ustring &fname2, b } } -int ProcParams::write (const Glib::ustring &fname, const Glib::ustring &content) const -{ - - int error = 0; - - if (fname.length()) { - FILE *f; - f = g_fopen (fname.c_str (), "wt"); - - if (f == nullptr) { - error = 1; - } else { - fprintf (f, "%s", content.c_str()); - fclose (f); - } - } - - return error; -} - int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) { setlocale (LC_NUMERIC, "C"); // to set decimal point to "." @@ -2503,7 +2594,7 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) fclose (f); ppVersion = PPVERSION; - appVersion = APPVERSION; + appVersion = RTVERSION; if (keyFile.has_group ("Version")) { if (keyFile.has_key ("Version", "AppVersion")) { @@ -2540,13 +2631,13 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) toneCurve.shcompr = 100; // older pp3 files can have values above 100. } - const std::map tc_mapping = { - {"Standard", ToneCurveParams::Mode::STD}, - {"FilmLike", ToneCurveParams::Mode::FILMLIKE}, - {"SatAndValueBlending", ToneCurveParams::Mode::SATANDVALBLENDING}, - {"WeightedStd", ToneCurveParams::Mode::WEIGHTEDSTD}, - {"Luminance", ToneCurveParams::Mode::LUMINANCE}, - {"Perceptual", ToneCurveParams::Mode::PERCEPTUAL} + const std::map tc_mapping = { + {"Standard", ToneCurveParams::TcMode::STD}, + {"FilmLike", ToneCurveParams::TcMode::FILMLIKE}, + {"SatAndValueBlending", ToneCurveParams::TcMode::SATANDVALBLENDING}, + {"WeightedStd", ToneCurveParams::TcMode::WEIGHTEDSTD}, + {"Luminance", ToneCurveParams::TcMode::LUMINANCE}, + {"Perceptual", ToneCurveParams::TcMode::PERCEPTUAL} }; assignFromKeyfile(keyFile, "Exposure", "CurveMode", pedited, tc_mapping, toneCurve.curveMode, pedited->toneCurve.curveMode); @@ -2612,10 +2703,10 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "BeforeCurveMode", pedited, { - {"Standard", BlackWhiteParams::TC_MODE_STD_BW}, - {"FilmLike", BlackWhiteParams::TC_MODE_FILMLIKE_BW}, - {"SatAndValueBlending", BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW}, - {"WeightedStd", BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW} + {"Standard", BlackWhiteParams::TcMode::STD_BW}, + {"FilmLike", BlackWhiteParams::TcMode::FILMLIKE_BW}, + {"SatAndValueBlending", BlackWhiteParams::TcMode::SATANDVALBLENDING_BW}, + {"WeightedStd", BlackWhiteParams::TcMode::WEIGHTEDSTD_BW} }, blackwhite.beforeCurveMode, pedited->blackwhite.beforeCurveMode @@ -2628,8 +2719,8 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "AfterCurveMode", pedited, { - {"Standard", BlackWhiteParams::TC_MODE_STD_BW}, - {"WeightedStd", BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW} + {"Standard", BlackWhiteParams::TcMode::STD_BW}, + {"WeightedStd", BlackWhiteParams::TcMode::WEIGHTEDSTD_BW} }, blackwhite.afterCurveMode, pedited->blackwhite.afterCurveMode @@ -2896,9 +2987,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Color appearance", "Tonecie", pedited, colorappearance.tonecie, pedited->colorappearance.tonecie); // if (keyFile.has_key ("Color appearance", "Sharpcie")) {colorappearance.sharpcie = keyFile.get_boolean ("Color appearance", "Sharpcie"); if (pedited) pedited->colorappearance.sharpcie = true; } - const std::map tc_mapping = { - {"Lightness", ColorAppearanceParams::TCMode::LIGHT}, - {"Brightness", ColorAppearanceParams::TCMode::BRIGHT} + const std::map tc_mapping = { + {"Lightness", ColorAppearanceParams::TcMode::LIGHT}, + {"Brightness", ColorAppearanceParams::TcMode::BRIGHT} }; assignFromKeyfile(keyFile, "Color appearance", "CurveMode", pedited, tc_mapping, colorappearance.curveMode, pedited->colorappearance.curveMode); assignFromKeyfile(keyFile, "Color appearance", "CurveMode2", pedited, tc_mapping, colorappearance.curveMode2, pedited->colorappearance.curveMode2); @@ -2909,9 +3000,9 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) "CurveMode3", pedited, { - {"Chroma", ColorAppearanceParams::CTCMode::CHROMA}, - {"Saturation", ColorAppearanceParams::CTCMode::SATUR}, - {"Colorfullness", ColorAppearanceParams::CTCMode::COLORF} + {"Chroma", ColorAppearanceParams::CtcMode::CHROMA}, + {"Saturation", ColorAppearanceParams::CtcMode::SATUR}, + {"Colorfullness", ColorAppearanceParams::CtcMode::COLORF} }, colorappearance.curveMode3, pedited->colorappearance.curveMode3 @@ -3657,14 +3748,14 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "RAW Bayer", "LMMSEIterations", pedited, raw.bayersensor.lmmse_iterations, pedited->raw.bayersensor.lmmseIterations); assignFromKeyfile(keyFile, "RAW Bayer", "PixelShiftMotion", pedited, raw.bayersensor.pixelShiftMotion, pedited->raw.bayersensor.pixelShiftMotion); if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrection")) { - raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::ePSMotionCorrection)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrection"); + raw.bayersensor.pixelShiftMotionCorrection = (RAWParams::BayerSensor::PSMotionCorrection)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrection"); if (pedited) { pedited->raw.bayersensor.pixelShiftMotionCorrection = true; } } if (keyFile.has_key ("RAW Bayer", "PixelShiftMotionCorrectionMethod")) { - raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod"); + raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::PSMotionCorrectionMethod)keyFile.get_integer ("RAW Bayer", "PixelShiftMotionCorrectionMethod"); if (pedited) { pedited->raw.bayersensor.pixelShiftMotionCorrectionMethod = true; @@ -3766,58 +3857,20 @@ int ProcParams::load (const Glib::ustring &fname, ParamsEdited* pedited) return 0; } -const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring ("No ICM: sRGB output"); - -bool operator== (const WaveletParams & a, const WaveletParams & b) +ProcParams* ProcParams::create () { - if (a.enabled != b.enabled) { - return false; - } - for (int i = 0; i < 9; i++) { - if (a.c[i] != b.c[i]) { - return false; - } - } - - for (int i = 0; i < 9; i++) { - if (a.ch[i] != b.ch[i]) { - return false; - } - } - - return true; + return new ProcParams(); } - - -bool operator== (const DirPyrEqualizerParams & a, const DirPyrEqualizerParams & b) +void ProcParams::destroy (ProcParams* pp) { - if (a.enabled != b.enabled) { - return false; - } - for (int i = 0; i < 6; i++) { - if (a.mult[i] != b.mult[i]) { - return false; - } - } - - return a.threshold == b.threshold; + delete pp; } -/*bool operator==(const ExifPairs& a, const ExifPairs& b) { - - return a.field == b.field && a.value == b.value; -} - -bool operator==(const IPTCPairs& a, const IPTCPairs& b) { - - return a.field == b.field && a.values == b.values; -}*/ bool ProcParams::operator== (const ProcParams& other) { - return toneCurve.curve == other.toneCurve.curve && toneCurve.curve2 == other.toneCurve.curve2 @@ -4293,7 +4346,35 @@ bool ProcParams::operator== (const ProcParams& other) bool ProcParams::operator!= (const ProcParams& other) { - return ! (*this == other); + return !(*this == other); +} + +void ProcParams::init () +{ +} + +void ProcParams::cleanup () +{ +} + +int ProcParams::write (const Glib::ustring &fname, const Glib::ustring &content) const +{ + + int error = 0; + + if (fname.length()) { + FILE *f; + f = g_fopen (fname.c_str (), "wt"); + + if (f == nullptr) { + error = 1; + } else { + fprintf (f, "%s", content.c_str()); + fclose (f); + } + } + + return error; } PartialProfile::PartialProfile (bool createInstance, bool paramsEditedValue) @@ -4337,6 +4418,28 @@ PartialProfile::PartialProfile (const ProcParams* pp, const ParamsEdited* pe) } } +void PartialProfile::deleteInstance () +{ + if (pparams) { + delete pparams; + pparams = nullptr; + } + + if (pedited) { + delete pedited; + pedited = nullptr; + } +} + +void PartialProfile::clearGeneral () +{ + if (pedited) { + pedited->general.colorlabel = false; + pedited->general.intrash = false; + pedited->general.rank = false; + } +} + int PartialProfile::load (const Glib::ustring &fName) { if (!pparams) { @@ -4356,29 +4459,14 @@ int PartialProfile::load (const Glib::ustring &fName) } } -void PartialProfile::deleteInstance () -{ - if (pparams) { - delete pparams; - pparams = nullptr; - } - - if (pedited) { - delete pedited; - pedited = nullptr; - } -} - /* * Set the all values of the General section to false * in order to preserve them in applyTo */ -void PartialProfile::clearGeneral () +void PartialProfile::set (bool v) { if (pedited) { - pedited->general.colorlabel = false; - pedited->general.intrash = false; - pedited->general.rank = false; + pedited->set (v); } } @@ -4389,13 +4477,6 @@ const void PartialProfile::applyTo (ProcParams *destParams) const } } -void PartialProfile::set (bool v) -{ - if (pedited) { - pedited->set (v); - } } } -} - diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 20c9db026..09dc6b07d 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -28,6 +28,7 @@ #include "coord.h" #include "LUT.h" +#include "utils.h" class ParamsEdited; @@ -254,7 +255,7 @@ private: * Parameters of the tone curve */ struct ToneCurveParams { - enum class Mode { + enum class TcMode { STD, // Standard modes, the curve is applied on all component individually WEIGHTEDSTD, // Weighted standard mode FILMLIKE, // Film-like mode, as defined in Adobe's reference code @@ -270,8 +271,8 @@ struct ToneCurveParams { double expcomp; std::vector curve; std::vector curve2; - Mode curveMode; - Mode curveMode2; + TcMode curveMode; + TcMode curveMode2; int brightness; int black; int contrast; @@ -519,18 +520,20 @@ struct WBParams { double green; double equal; double tempBias; + + static const std::vector& getWbEntries(); }; /** * Parameters of colorappearance */ struct ColorAppearanceParams { - enum class TCMode { + enum class TcMode { LIGHT, // Lightness mode BRIGHT, // Brightness mode }; - enum class CTCMode { + enum class CtcMode { CHROMA, // chroma mode SATUR, // saturation mode COLORF, // colorfullness mode @@ -544,9 +547,9 @@ struct ColorAppearanceParams { std::vector curve; std::vector curve2; std::vector curve3; - TCMode curveMode; - TCMode curveMode2; - CTCMode curveMode3; + TcMode curveMode; + TcMode curveMode2; + CtcMode curveMode3; Glib::ustring surround; Glib::ustring surrsrc; @@ -798,21 +801,18 @@ struct ChannelMixerParams { int blue[3]; }; -class BlackWhiteParams -{ - -public: - enum eTCModeId { - TC_MODE_STD_BW, // Standard modes, the curve is applied on all component individually - TC_MODE_WEIGHTEDSTD_BW, // Weighted standard mode - TC_MODE_FILMLIKE_BW, // Film-like mode, as defined in Adobe's reference code - TC_MODE_SATANDVALBLENDING_BW // Modify the Saturation and Value channel +struct BlackWhiteParams { + enum class TcMode { + STD_BW, // Standard modes, the curve is applied on all component individually + WEIGHTEDSTD_BW, // Weighted standard mode + FILMLIKE_BW, // Film-like mode, as defined in Adobe's reference code + SATANDVALBLENDING_BW // Modify the Saturation and Value channel }; std::vector beforeCurve; - eTCModeId beforeCurveMode; + TcMode beforeCurveMode; std::vector afterCurve; - eTCModeId afterCurveMode; + TcMode afterCurveMode; Glib::ustring algo; std::vector luminanceCurve; @@ -838,32 +838,15 @@ public: /** * Parameters of the c/a correction */ -class CACorrParams -{ - -public: +struct CACorrParams { double red; double blue; }; -/** - * Parameters of the highlight recovery - */ -/* -class HRecParams { - - public: - bool enabled; - Glib::ustring method; -}; -*/ /** * Parameters of the resizing */ -class ResizeParams -{ - -public: +struct ResizeParams { bool enabled; double scale; Glib::ustring appliesTo; @@ -876,10 +859,7 @@ public: /** * Parameters of the color spaces used during the processing */ -class ColorManagementParams -{ - -public: +struct ColorManagementParams { Glib::ustring input; bool toneCurve; bool applyLookTable; @@ -897,10 +877,7 @@ public: double slpos; bool freegamma; - ColorManagementParams() - { - setDefaults(); - } + ColorManagementParams(); void setDefaults(); }; @@ -912,14 +889,11 @@ typedef std::map ExifPairs; /** * The IPTC key/value pairs */ -typedef std::map > IPTCPairs; +typedef std::map> IPTCPairs; -class WaveletParams -{ - -public: - std::vector ccwcurve; +struct WaveletParams { + std::vector ccwcurve; std::vector opacityCurveRG; std::vector opacityCurveBY; std::vector opacityCurveW; @@ -940,7 +914,6 @@ public: int bluehigh; bool lipst; - // bool edgreinf; bool avoid; bool tmr; int strength; @@ -1006,44 +979,35 @@ public: Threshold level2noise; Threshold level3noise; - - WaveletParams (); + WaveletParams(); void setDefaults(); - void getCurves (WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; + void getCurves(WavCurve& cCurve, WavOpacityCurveRG& opacityCurveLUTRG, WavOpacityCurveBY& opacityCurveLUTBY, WavOpacityCurveW& opacityCurveLUTW, WavOpacityCurveWL& opacityCurveLUTWL) const; static void getDefaultCCWCurve (std::vector& curve); static void getDefaultOpacityCurveRG (std::vector& curve); static void getDefaultOpacityCurveBY (std::vector& curve); static void getDefaultOpacityCurveW (std::vector& curve); static void getDefaultOpacityCurveWL (std::vector& curve); - }; - /** * Directional pyramid equalizer params */ -class DirPyrEqualizerParams -{ - -public: +struct DirPyrEqualizerParams { bool enabled; bool gamutlab; double mult[6]; double threshold; double skinprotect; Threshold hueskin; - //Glib::ustring algo; Glib::ustring cbdlMethod; - DirPyrEqualizerParams() : hueskin (20, 80, 2000, 1200, false) {}; + + DirPyrEqualizerParams(); }; /** * HSV equalizer params */ -class HSVEqualizerParams -{ - -public: +struct HSVEqualizerParams { std::vector hcurve; std::vector scurve; std::vector vcurve; @@ -1058,45 +1022,48 @@ struct FilmSimulationParams { Glib::ustring clutFilename; int strength; - FilmSimulationParams() - { - setDefaults(); - } - - void setDefaults() - { - enabled = false; - clutFilename = Glib::ustring(); - strength = 100; - } + FilmSimulationParams(); + void setDefaults(); }; /** * Parameters for RAW demosaicing, common to all sensor type */ -class RAWParams -{ - -public: +struct RAWParams { /** * Parameters for RAW demosaicing specific to Bayer sensors */ - class BayerSensor - { - public: - //enum eMethod{ eahd,hphd,vng4,dcb,amaze,ahd,IGV_noise,fast, - //numMethods }; // This MUST be the last enum - enum eMethod { amaze, igv, lmmse, eahd, hphd, vng4, dcb, ahd, fast, mono, none, pixelshift, - numMethods - }; // This MUST be the last enum - enum ePSMotionCorrection { - Grid1x1, Grid1x2, Grid3x3, Grid5x5, Grid7x7, Grid3x3New + struct BayerSensor { + enum class Method { + AMAZE, + IGV, + LMMSE, + EAHD, + HPHD, + VNG4, + DCB, + AHD, + FAST, + MONO, + NONE, + PIXELSHIFT }; - enum ePSMotionCorrectionMethod { - Off, Automatic, Custom + + enum class PSMotionCorrection { + GRID_1X1, + GRID_1X2, + GRID_3X3, + GRID_5X5, + GRID_7X7, + GRID_3X3_NEW + }; + + enum class PSMotionCorrectionMethod { + OFF, + AUTO, + CUSTOM }; - static const char *methodstring[numMethods]; Glib::ustring method; int imageNum; @@ -1111,8 +1078,8 @@ public: int dcb_iterations; int lmmse_iterations; int pixelShiftMotion; - ePSMotionCorrection pixelShiftMotionCorrection; - ePSMotionCorrectionMethod pixelShiftMotionCorrectionMethod; + PSMotionCorrection pixelShiftMotionCorrection; + PSMotionCorrectionMethod pixelShiftMotionCorrectionMethod; double pixelShiftStddevFactorGreen; double pixelShiftStddevFactorRed; double pixelShiftStddevFactorBlue; @@ -1141,38 +1108,44 @@ public: bool pixelShiftNonGreenCross2; bool pixelShiftNonGreenAmaze; bool dcb_enhance; - //bool all_enhance; void setPixelShiftDefaults(); + static const std::vector& getMethodStrings(); + static Glib::ustring getMethodString(Method method); }; /** * Parameters for RAW demosaicing specific to X-Trans sensors */ - class XTransSensor - { - public: - enum eMethod { threePass, onePass, fast, mono, none, - numMethods - }; // This MUST be the last enum - static const char *methodstring[numMethods]; + struct XTransSensor { + enum class Method { + THREE_PASS, + ONE_PASS, + FAST, + MONO, + NONE + }; Glib::ustring method; int ccSteps; double blackred; double blackgreen; double blackblue; - }; + + static const std::vector& getMethodStrings(); + static Glib::ustring getMethodString(Method method); + }; BayerSensor bayersensor; ///< RAW parameters for Bayer sensors XTransSensor xtranssensor; ///< RAW parameters for X-Trans sensors - enum eFlatFileBlurType { /*parametric,*/area_ff, v_ff, h_ff, vh_ff, - numFlatFileBlurTypes - }; // This MUST be the last enum - - static const char *ff_BlurTypestring[numFlatFileBlurTypes]; + enum class FlatFieldBlurType { + AREA, + V, + H, + VH, + }; Glib::ustring dark_frame; bool df_autoselect; @@ -1196,11 +1169,11 @@ public: bool deadPixelFilter; int hotdeadpix_thresh; - RAWParams() - { - setDefaults(); - } + RAWParams(); void setDefaults(); + + static const std::vector& getFlatFieldBlurTypeStrings(); + static Glib::ustring getFlatFieldBlurTypeString(FlatFieldBlurType type); }; /** @@ -1348,7 +1321,8 @@ public: * and automatically delete them in the destructor. This class has been mostly created * to be used with vectors, which use the default constructor/destructor */ -class AutoPartialProfile : public PartialProfile +class AutoPartialProfile : + public PartialProfile { public: AutoPartialProfile() : PartialProfile (true) {} diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index 6ab9076aa..998d5e72e 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -650,8 +650,8 @@ void RawImageSource::getImage (const ColorTemp &ctemp, int tran, Imagefloat* ima const float new_pre_mul[4] = { ri->get_pre_mul(0) / rm, ri->get_pre_mul(1) / gm, ri->get_pre_mul(2) / bm, ri->get_pre_mul(3) / gm }; float new_scale_mul[4]; - bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono]) - || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono]); + bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) + || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE)); float gain = calculate_scale_mul(new_scale_mul, new_pre_mul, c_white, cblacksom, isMono, ri->get_colors()); rm = new_scale_mul[0] / scale_mul[0] * gain; gm = new_scale_mul[1] / scale_mul[1] * gain; @@ -1921,7 +1921,7 @@ void RawImageSource::preprocess (const RAWParams &raw, const LensProfParams &le } // check if it is an olympus E camera or green equilibration is enabled. If yes, compute G channel pre-compensation factors - if ( ri->getSensorType() == ST_BAYER && (raw.bayersensor.greenthresh || (((idata->getMake().size() >= 7 && idata->getMake().substr(0, 7) == "OLYMPUS" && idata->getModel()[0] == 'E') || (idata->getMake().size() >= 9 && idata->getMake().substr(0, 9) == "Panasonic")) && raw.bayersensor.method != RAWParams::BayerSensor::methodstring[ RAWParams::BayerSensor::vng4])) ) { + if ( ri->getSensorType() == ST_BAYER && (raw.bayersensor.greenthresh || (((idata->getMake().size() >= 7 && idata->getMake().substr(0, 7) == "OLYMPUS" && idata->getModel()[0] == 'E') || (idata->getMake().size() >= 9 && idata->getMake().substr(0, 9) == "Panasonic")) && raw.bayersensor.method != RAWParams::BayerSensor::getMethodString( RAWParams::BayerSensor::Method::VNG4))) ) { // global correction if(numFrames == 4) { for(int i = 0; i < 4; ++i) { @@ -2027,27 +2027,27 @@ void RawImageSource::demosaic(const RAWParams &raw) t1.set(); if (ri->getSensorType() == ST_BAYER) { - if ( raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::hphd] ) { + if ( raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::HPHD) ) { hphd_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::vng4] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::VNG4) ) { vng4_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::ahd] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AHD) ) { ahd_demosaic (0, 0, W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::amaze] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::AMAZE) ) { amaze_demosaic_RT (0, 0, W, H, rawData, red, green, blue); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::pixelshift] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::PIXELSHIFT) ) { pixelshift(0, 0, W, H, raw.bayersensor, currFrame, ri->get_model(), raw.expos); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::dcb] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::DCB) ) { dcb_demosaic(raw.bayersensor.dcb_iterations, raw.bayersensor.dcb_enhance); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::eahd]) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::EAHD)) { eahd_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv]) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::IGV)) { igv_interpolate(W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::lmmse]) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::LMMSE)) { lmmse_interpolate_omp(W, H, rawData, red, green, blue, raw.bayersensor.lmmse_iterations); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST) ) { fast_demosaic (0, 0, W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] ) { + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) ) { nodemosaic(true); } else { nodemosaic(false); @@ -2056,13 +2056,13 @@ void RawImageSource::demosaic(const RAWParams &raw) //if (raw.all_enhance) refinement_lassus(); } else if (ri->getSensorType() == ST_FUJI_XTRANS) { - if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast] ) { + if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST) ) { fast_xtrans_interpolate(); - } else if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::onePass]) { + } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::ONE_PASS)) { xtrans_interpolate(1, false); - } else if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::threePass] ) { + } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS) ) { xtrans_interpolate(3, true); - } else if(raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono] ) { + } else if(raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) ) { nodemosaic(true); } else { nodemosaic(false); @@ -2803,14 +2803,14 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile BS += BS & 1; //function call to cfabloxblur - if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::v_ff]) { + if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::V)) { cfaboxblur(riFlatFile, cfablur, 2 * BS, 0); - } else if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::h_ff]) { + } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::H)) { cfaboxblur(riFlatFile, cfablur, 0, 2 * BS); - } else if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::vh_ff]) { + } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::VH)) { //slightly more complicated blur if trying to correct both vertical and horizontal anomalies cfaboxblur(riFlatFile, cfablur, BS, BS); //first do area blur to correct vignette - } else { //(raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::area_ff]) + } else { //(raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::area_ff)) cfaboxblur(riFlatFile, cfablur, BS, BS); } @@ -3008,7 +3008,7 @@ void RawImageSource::processFlatField(const RAWParams &raw, RawImage *riFlatFile } } - if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::vh_ff]) { + if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::VH)) { float *cfablur1 = (float (*)) malloc (H * W * sizeof * cfablur1); float *cfablur2 = (float (*)) malloc (H * W * sizeof * cfablur2); //slightly more complicated blur if trying to correct both vertical and horizontal anomalies @@ -3429,7 +3429,7 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R black_lev[2] = raw.bayersensor.black2; //B black_lev[3] = raw.bayersensor.black3; //G2 - isMono = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] == raw.bayersensor.method; + isMono = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) == raw.bayersensor.method; } else if (getSensorType() == ST_FUJI_XTRANS) { black_lev[0] = raw.xtranssensor.blackred; //R @@ -3437,7 +3437,7 @@ void RawImageSource::scaleColors(int winx, int winy, int winw, int winh, const R black_lev[2] = raw.xtranssensor.blackblue; //B black_lev[3] = raw.xtranssensor.blackgreen; //G2 (set, only used with a Bayer filter) - isMono = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono] == raw.xtranssensor.method; + isMono = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) == raw.xtranssensor.method; } for(int i = 0; i < 4 ; i++) { diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index c8d45acf8..844f8fb39 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1483,16 +1483,12 @@ private: params.defringe.radius); adjust_radius (defaultparams.sh.radius, scale_factor, params.sh.radius); - if (params.raw.xtranssensor.method == - procparams::RAWParams::XTransSensor::methodstring[ - procparams::RAWParams::XTransSensor::threePass]) { - params.raw.xtranssensor.method = - procparams::RAWParams::XTransSensor::methodstring[ - procparams::RAWParams::XTransSensor::onePass]; + if (params.raw.xtranssensor.method == procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::THREE_PASS)) { + params.raw.xtranssensor.method = procparams::RAWParams::XTransSensor::getMethodString(procparams::RAWParams::XTransSensor::Method::ONE_PASS); } - if (params.raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::pixelshift]) { - params.raw.bayersensor.method = procparams::RAWParams::BayerSensor::methodstring[params.raw.bayersensor.pixelShiftLmmse ? procparams::RAWParams::BayerSensor::lmmse : procparams::RAWParams::BayerSensor::amaze]; + if (params.raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT)) { + params.raw.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(params.raw.bayersensor.pixelShiftLmmse ? procparams::RAWParams::BayerSensor::Method::LMMSE : procparams::RAWParams::BayerSensor::Method::AMAZE); } } diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index d5a728a97..9df7c106d 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -29,8 +29,8 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); method = Gtk::manage (new MyComboBoxText ()); - for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - method->append(M("TP_RAW_" + Glib::ustring(procparams::RAWParams::BayerSensor::methodstring[i]).uppercase())); + for(const auto method_string : procparams::RAWParams::BayerSensor::getMethodStrings()) { + method->append(M("TP_RAW_" + Glib::ustring(method_string).uppercase())); } method->set_active(0); @@ -112,7 +112,7 @@ BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RA pixelShiftMotionMethod->append(M("TP_RAW_PIXELSHIFTMM_OFF")); pixelShiftMotionMethod->append(M("TP_RAW_PIXELSHIFTMM_AUTO")); pixelShiftMotionMethod->append(M("TP_RAW_PIXELSHIFTMM_CUSTOM")); - pixelShiftMotionMethod->set_active(RAWParams::BayerSensor::ePSMotionCorrectionMethod::Automatic); + pixelShiftMotionMethod->set_active(toUnderlying(RAWParams::BayerSensor::PSMotionCorrectionMethod::AUTO)); pixelShiftMotionMethod->show(); hb3->pack_start(*pixelShiftMotionMethod); pixelShiftFrame->pack_start(*hb3); @@ -347,11 +347,11 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params pixelShiftMotionCorrection->block (true); #endif - method->set_active(procparams::RAWParams::BayerSensor::numMethods); + method->set_active(std::numeric_limits::max()); imageNumber->set_active(pp->raw.bayersensor.imageNum); - for( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - if( pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[i]) { + for (size_t i = 0; i < procparams::RAWParams::BayerSensor::getMethodStrings().size(); ++i) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodStrings()[i]) { method->set_active(i); oldMethod = i; break; @@ -452,7 +452,7 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params #endif if(!pedited->raw.bayersensor.method) { - method->set_active(procparams::RAWParams::BayerSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name } if(!pedited->raw.bayersensor.imageNum) { imageNumber->set_active_text(M("GENERAL_UNCHANGED")); @@ -468,21 +468,21 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params } if (!batchMode) { - if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::dcb] || - method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::DCB) || + method->get_active_row_number() == std::numeric_limits::max()) { dcbOptions->show(); } else { dcbOptions->hide(); } - if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::lmmse] || - method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::LMMSE) || + method->get_active_row_number() == std::numeric_limits::max()) { lmmseOptions->show(); } else { lmmseOptions->hide(); } - if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::pixelshift] || - method->get_active_row_number() == procparams::RAWParams::BayerSensor::numMethods) { - if(pp->raw.bayersensor.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::Custom) { + if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::PIXELSHIFT) || + method->get_active_row_number() == std::numeric_limits::max()) { + if(pp->raw.bayersensor.pixelShiftMotionCorrectionMethod == RAWParams::BayerSensor::PSMotionCorrectionMethod::CUSTOM) { pixelShiftOptions->show(); } else { pixelShiftOptions->hide(); @@ -493,9 +493,9 @@ void BayerProcess::read(const rtengine::procparams::ProcParams* pp, const Params } // Flase color suppression is applied to all demozaicing method, so don't hide anything - /*if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::eahd] || - pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::hphd] || - pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::methodstring[procparams::RAWParams::BayerSensor::vng4]) + /*if (pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::EAHD) || + pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::HPHD) || + pp->raw.bayersensor.method == procparams::RAWParams::BayerSensor::getMethodString(procparams::RAWParams::BayerSensor::Method::VNG4)) ccSteps->show(); else ccSteps->hide();*/ @@ -520,7 +520,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe pp->raw.bayersensor.dcb_enhance = dcbEnhance->getLastActive (); //pp->raw.bayersensor.all_enhance = allEnhance->getLastActive (); pp->raw.bayersensor.lmmse_iterations = lmmseIterations->getIntValue(); - pp->raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::ePSMotionCorrectionMethod)pixelShiftMotionMethod->get_active_row_number(); + pp->raw.bayersensor.pixelShiftMotionCorrectionMethod = (RAWParams::BayerSensor::PSMotionCorrectionMethod)pixelShiftMotionMethod->get_active_row_number(); pp->raw.bayersensor.pixelShiftEperIso = pixelShiftEperIso->getValue(); pp->raw.bayersensor.pixelShiftSigma = pixelShiftSigma->getValue(); pp->raw.bayersensor.pixelShiftShowMotion = pixelShiftShowMotion->getLastActive (); @@ -554,8 +554,8 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe #endif int currentRow = method->get_active_row_number(); - if( currentRow >= 0 && currentRow < procparams::RAWParams::BayerSensor::numMethods) { - pp->raw.bayersensor.method = procparams::RAWParams::BayerSensor::methodstring[currentRow]; + if( currentRow >= 0 && currentRow < std::numeric_limits::max()) { + pp->raw.bayersensor.method = procparams::RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method(currentRow)); } currentRow = imageNumber->get_active_row_number(); @@ -566,7 +566,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe if (pedited) { pedited->raw.bayersensor.ccSteps = ccSteps->getEditedState (); - pedited->raw.bayersensor.method = method->get_active_row_number() != procparams::RAWParams::BayerSensor::numMethods; + pedited->raw.bayersensor.method = method->get_active_row_number() != std::numeric_limits::max(); pedited->raw.bayersensor.imageNum = imageNumber->get_active_text() != M("GENERAL_UNCHANGED"); pedited->raw.bayersensor.dcbIterations = dcbIterations->getEditedState (); pedited->raw.bayersensor.dcbEnhance = !dcbEnhance->get_inconsistent(); @@ -610,7 +610,7 @@ void BayerProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pe void BayerProcess::setBatchMode(bool batchMode) { method->append (M("GENERAL_UNCHANGED")); - method->set_active(procparams::RAWParams::BayerSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name #ifdef PIXELSHIFTDEV pixelShiftMotionCorrection->append (M("GENERAL_UNCHANGED")); pixelShiftMotionCorrection->set_active_text (M("GENERAL_UNCHANGED")); @@ -750,22 +750,23 @@ void BayerProcess::psMotionCorrectionChanged () void BayerProcess::methodChanged () { - int curSelection = method->get_active_row_number(); + const int curSelection = method->get_active_row_number(); + const RAWParams::BayerSensor::Method method = RAWParams::BayerSensor::Method(curSelection); if (!batchMode) { - if ( curSelection == procparams::RAWParams::BayerSensor::dcb) { + if (method == procparams::RAWParams::BayerSensor::Method::DCB) { dcbOptions->show(); } else { dcbOptions->hide(); } - if ( curSelection == procparams::RAWParams::BayerSensor::lmmse) { + if (method == procparams::RAWParams::BayerSensor::Method::LMMSE) { lmmseOptions->show(); } else { lmmseOptions->hide(); } - if ( curSelection == procparams::RAWParams::BayerSensor::pixelshift) { + if (method == procparams::RAWParams::BayerSensor::Method::PIXELSHIFT) { if(pixelShiftMotionMethod->get_active_row_number() == 2) { pixelShiftOptions->show(); } else { @@ -780,10 +781,10 @@ void BayerProcess::methodChanged () Glib::ustring methodName = ""; bool ppreq = false; - if( curSelection >= 0 && curSelection < procparams::RAWParams::BayerSensor::numMethods) { - methodName = procparams::RAWParams::BayerSensor::methodstring[curSelection]; + if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { + methodName = procparams::RAWParams::BayerSensor::getMethodString(method); - if (curSelection == procparams::RAWParams::BayerSensor::mono || oldMethod == procparams::RAWParams::BayerSensor::mono) { + if (method == procparams::RAWParams::BayerSensor::Method::MONO || RAWParams::BayerSensor::Method(oldMethod) == procparams::RAWParams::BayerSensor::Method::MONO) { ppreq = true; } } diff --git a/rtgui/blackwhite.cc b/rtgui/blackwhite.cc index efa960a81..2b410846f 100644 --- a/rtgui/blackwhite.cc +++ b/rtgui/blackwhite.cc @@ -500,7 +500,7 @@ void BlackWhite::read (const ProcParams* pp, const ParamsEdited* pedited) mixerPurple->setValue (pp->blackwhite.mixerPurple); luminanceCurve->setCurve (pp->blackwhite.luminanceCurve); beforeCurve->setCurve (pp->blackwhite.beforeCurve); - beforeCurveMode->set_active(pp->blackwhite.beforeCurveMode); + beforeCurveMode->set_active(toUnderlying(pp->blackwhite.beforeCurveMode)); afterCurve->setCurve (pp->blackwhite.afterCurve); // afterCurveMode->set_active(pp->blackwhite.afterCurveMode); @@ -583,18 +583,18 @@ void BlackWhite::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = beforeCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_STD_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::STD_BW; } else if (tcMode == 1) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_WEIGHTEDSTD_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::WEIGHTEDSTD_BW; } else if (tcMode == 2) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_FILMLIKE_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::FILMLIKE_BW; } else if (tcMode == 3) { - pp->blackwhite.beforeCurveMode = BlackWhiteParams::TC_MODE_SATANDVALBLENDING_BW; + pp->blackwhite.beforeCurveMode = BlackWhiteParams::TcMode::SATANDVALBLENDING_BW; } // tcMode = afterCurveMode->get_active_row_number(); -// if (tcMode == 0) pp->blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_STD_BW; - // else if (tcMode == 1) pp->blackwhite.afterCurveMode = BlackWhiteParams::TC_MODE_WEIGHTEDSTD; +// if (tcMode == 0) pp->blackwhite.afterCurveMode = BlackWhiteParams::TCMode::STD_BW; + // else if (tcMode == 1) pp->blackwhite.afterCurveMode = BlackWhiteParams::TCMode::WEIGHTEDSTD; if (pedited) { pedited->blackwhite.enabled = !get_inconsistent(); diff --git a/rtgui/colorappearance.cc b/rtgui/colorappearance.cc index 7d8eb7de4..7a31ae39f 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -1044,27 +1044,27 @@ void ColorAppearance::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode = ColorAppearanceParams::TCMode::LIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TcMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode = ColorAppearanceParams::TCMode::BRIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TcMode::BRIGHT; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TCMode::LIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TcMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TCMode::BRIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TcMode::BRIGHT; } int tcMode3 = toneCurveMode3->get_active_row_number(); if (tcMode3 == 0) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::CHROMA; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::CHROMA; } else if (tcMode3 == 1) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::SATUR; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::SATUR; } else if (tcMode3 == 2) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::CTCMode::COLORF; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::COLORF; } if (pedited) { diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 4e5e885ea..f4510682e 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -1047,7 +1047,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y) if(ipc) { procparams::ProcParams params; ipc->getParams(¶ms); - if(params.raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none] || params.raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::none]) { + if(params.raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) || params.raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) { ImageSource *isrc = static_cast(ipc->getInitialImage()); isrc->getRawValues(mx, my, params.coarse.rotate, rval, gval, bval); } diff --git a/rtgui/exportpanel.cc b/rtgui/exportpanel.cc index 7fdc3ae50..144a107d5 100644 --- a/rtgui/exportpanel.cc +++ b/rtgui/exportpanel.cc @@ -68,8 +68,8 @@ ExportPanel::ExportPanel () : listener (nullptr) hb_raw_bayer_method->pack_start (*Gtk::manage (new Gtk::Label ( M ("EXPORT_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); raw_bayer_method = Gtk::manage (new MyComboBoxText ()); - for ( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) { - raw_bayer_method->append (procparams::RAWParams::BayerSensor::methodstring[i]); + for (const auto method_string : RAWParams::BayerSensor::getMethodStrings()) { + raw_bayer_method->append(method_string); } raw_bayer_method->set_active (0); @@ -91,8 +91,8 @@ ExportPanel::ExportPanel () : listener (nullptr) hb_raw_xtrans_method->pack_start (*Gtk::manage (new Gtk::Label ( M ("EXPORT_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); raw_xtrans_method = Gtk::manage (new MyComboBoxText ()); - for ( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) { - raw_xtrans_method->append (procparams::RAWParams::XTransSensor::methodstring[i]); + for (const auto method_string : RAWParams::XTransSensor::getMethodStrings()) { + raw_xtrans_method->append(method_string); } raw_xtrans_method->set_active (0); @@ -275,15 +275,15 @@ void ExportPanel::SaveSettingsAsDefault() //saving Bayer demosaic_method int currentRow = raw_bayer_method->get_active_row_number(); - if ( currentRow >= 0 && currentRow < procparams::RAWParams::BayerSensor::numMethods) { - FE_OPT_STORE_ (options.fastexport_raw_bayer_method, procparams::RAWParams::BayerSensor::methodstring[currentRow]); + if (currentRow >= 0 && currentRow < std::numeric_limits::max()) { + FE_OPT_STORE_ (options.fastexport_raw_bayer_method, procparams::RAWParams::BayerSensor::getMethodStrings()[currentRow]); } //saving X-Trans demosaic_method currentRow = raw_xtrans_method->get_active_row_number(); - if ( currentRow >= 0 && currentRow < procparams::RAWParams::XTransSensor::numMethods) { - FE_OPT_STORE_ (options.fastexport_raw_xtrans_method, procparams::RAWParams::XTransSensor::methodstring[currentRow]); + if (currentRow >= 0 && currentRow < std::numeric_limits::max()) { + FE_OPT_STORE_ (options.fastexport_raw_xtrans_method, procparams::RAWParams::XTransSensor::getMethodStrings()[currentRow]); } // options.fastexport_icm_input = icm_input ; @@ -337,20 +337,20 @@ void ExportPanel::LoadDefaultSettings() bypass_raw_ff->set_active (options.fastexport_bypass_raw_ff ); // Bayer demosaic method - raw_bayer_method->set_active (procparams::RAWParams::BayerSensor::numMethods); + raw_bayer_method->set_active(std::numeric_limits::max()); - for ( size_t i = 0; i < procparams::RAWParams::BayerSensor::numMethods; i++) - if ( options.fastexport_raw_bayer_method == procparams::RAWParams::BayerSensor::methodstring[i]) { - raw_bayer_method->set_active (i); + for (size_t i = 0; i < RAWParams::BayerSensor::getMethodStrings().size(); ++i) + if (options.fastexport_raw_bayer_method == procparams::RAWParams::BayerSensor::getMethodStrings()[i]) { + raw_bayer_method->set_active(i); break; } // X-Trans demosaic method - raw_xtrans_method->set_active (procparams::RAWParams::XTransSensor::numMethods); + raw_xtrans_method->set_active(std::numeric_limits::max()); - for ( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) - if ( options.fastexport_raw_xtrans_method == procparams::RAWParams::XTransSensor::methodstring[i]) { - raw_xtrans_method->set_active (i); + for (size_t i = 0; i < procparams::RAWParams::XTransSensor::getMethodStrings().size(); ++i) + if (options.fastexport_raw_xtrans_method == procparams::RAWParams::XTransSensor::getMethodStrings()[i]) { + raw_xtrans_method->set_active(i); break; } diff --git a/rtgui/flatfield.cc b/rtgui/flatfield.cc index 5b52ce9d2..2b57aa470 100644 --- a/rtgui/flatfield.cc +++ b/rtgui/flatfield.cc @@ -111,13 +111,14 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi flatFieldBlurTypeconn.block (true); //flatFieldBlurType - for( size_t i = 0; i < procparams::RAWParams::numFlatFileBlurTypes; i++) - if( pp->raw.ff_BlurType == procparams::RAWParams::ff_BlurTypestring[i]) { + for (size_t i = 0; i < procparams::RAWParams::getFlatFieldBlurTypeStrings().size(); ++i) { + if (pp->raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeStrings()[i]) { flatFieldBlurType->set_active(i); break; } + } - if (multiImage || pp->raw.ff_BlurType == procparams::RAWParams::ff_BlurTypestring[procparams::RAWParams::area_ff]) { + if (multiImage || pp->raw.ff_BlurType == procparams::RAWParams::getFlatFieldBlurTypeString(procparams::RAWParams::FlatFieldBlurType::AREA)) { flatFieldClipControl->show(); } else { flatFieldClipControl->hide(); @@ -135,7 +136,7 @@ void FlatField::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi flatFieldClipControl->setAutoInconsistent(multiImage && !pedited->raw.ff_AutoClipControl); if( !pedited->raw.ff_BlurType ) { - flatFieldBlurType->set_active(procparams::RAWParams::numFlatFileBlurTypes); // No name + flatFieldBlurType->set_active(std::numeric_limits::max()); // No name } } @@ -216,8 +217,8 @@ void FlatField::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit int currentRow = flatFieldBlurType->get_active_row_number(); - if( currentRow >= 0 && currentRow < procparams::RAWParams::numFlatFileBlurTypes) { - pp->raw.ff_BlurType = procparams::RAWParams::ff_BlurTypestring[currentRow]; + if( currentRow >= 0 && currentRow < std::numeric_limits::max()) { + pp->raw.ff_BlurType = procparams::RAWParams::getFlatFieldBlurTypeStrings()[currentRow]; } if (pedited) { @@ -226,7 +227,7 @@ void FlatField::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit pedited->raw.ff_BlurRadius = flatFieldBlurRadius->getEditedState (); pedited->raw.ff_clipControl = flatFieldClipControl->getEditedState (); pedited->raw.ff_AutoClipControl = !flatFieldClipControl->getAutoInconsistent(); - pedited->raw.ff_BlurType = flatFieldBlurType->get_active_row_number() != procparams::RAWParams::numFlatFileBlurTypes; + pedited->raw.ff_BlurType = flatFieldBlurType->get_active_row_number() != std::numeric_limits::max(); } } @@ -336,15 +337,16 @@ void FlatField::flatFieldFile_Reset() void FlatField::flatFieldBlurTypeChanged () { - int curSelection = flatFieldBlurType->get_active_row_number(); + const int curSelection = flatFieldBlurType->get_active_row_number(); + const RAWParams::FlatFieldBlurType blur_type = RAWParams::FlatFieldBlurType(curSelection); - Glib::ustring s = ""; + Glib::ustring s; - if( curSelection >= 0 && curSelection < procparams::RAWParams::numFlatFileBlurTypes) { + if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { s = flatFieldBlurType->get_active_text(); } - if (multiImage || curSelection == procparams::RAWParams::area_ff) { + if (multiImage || blur_type == procparams::RAWParams::FlatFieldBlurType::AREA) { flatFieldClipControl->show(); } else { flatFieldClipControl->hide(); diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 558b0fe6b..a9dd35466 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -314,33 +314,33 @@ void ToneCurve::write (ProcParams* pp, ParamsEdited* pedited) int tcMode = toneCurveMode->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::STD; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::WEIGHTEDSTD; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::FILMLIKE; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::SATANDVALBLENDING; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::LUMINANCE; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode = ToneCurveParams::Mode::PERCEPTUAL; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::PERCEPTUAL; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::STD; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::WEIGHTEDSTD; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::FILMLIKE; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::SATANDVALBLENDING; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::LUMINANCE; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode2 = ToneCurveParams::Mode::PERCEPTUAL; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::PERCEPTUAL; } if (pedited) { diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index fc6a880f3..7dbc02b4e 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -163,12 +163,12 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB // Assign the model to the Combobox method->set_model(refTreeModel); - WBEntry::Type oldType = WBParams::wbEntries[0].type; + WBEntry::Type oldType = WBParams::getWbEntries()[0].type; WBEntry::Type currType; Gtk::TreeModel::Row row, childrow; - for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (oldType != (currType = WBParams::wbEntries[i].type)) { + for (unsigned int i = 0; i < WBParams::getWbEntries().size(); i++) { + if (oldType != (currType = WBParams::getWbEntries()[i].type)) { // New entry type if (currType == WBEntry::Type::FLUORESCENT) { // Creating the Fluorescent subcategory header @@ -219,12 +219,12 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB ) { childrow = *(refTreeModel->append(row.children())); childrow[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; - childrow[methodColumns.colLabel] = WBParams::wbEntries[i].GUILabel; + childrow[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; childrow[methodColumns.colId] = i; } else { row = *(refTreeModel->append()); row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; - row[methodColumns.colLabel] = WBParams::wbEntries[i].GUILabel; + row[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; row[methodColumns.colId] = i; } @@ -441,7 +441,7 @@ void WhiteBalance::optChanged () tempBias->setEditedState (UnEdited); } else { unsigned int methodId = findWBEntryId (row[methodColumns.colLabel], WBLT_GUI); - const WBEntry& currMethod = WBParams::wbEntries[methodId]; + const WBEntry& currMethod = WBParams::getWbEntries()[methodId]; tempBias->set_sensitive(currMethod.type == WBEntry::Type::AUTO); @@ -740,7 +740,7 @@ void WhiteBalance::setBatchMode (bool batchMode) equal->showEditedCB (); tempBias->showEditedCB (); Gtk::TreeModel::Row row = *(refTreeModel->append()); - row[methodColumns.colId] = WBParams::wbEntries.size(); + row[methodColumns.colId] = WBParams::getWbEntries().size(); row[methodColumns.colLabel] = M("GENERAL_UNCHANGED"); } @@ -810,8 +810,8 @@ void WhiteBalance::cache_customWB(int temp, double green) unsigned int WhiteBalance::findWBEntryId (const Glib::ustring& label, enum WB_LabelType lblType) { - for (unsigned int i = 0; i < WBParams::wbEntries.size(); i++) { - if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i].GUILabel : WBParams::wbEntries[i].ppLabel)) { + for (unsigned int i = 0; i < WBParams::getWbEntries().size(); i++) { + if (label == (lblType == WBLT_GUI ? WBParams::getWbEntries()[i].GUILabel : WBParams::getWbEntries()[i].ppLabel)) { return i; } } @@ -821,13 +821,13 @@ unsigned int WhiteBalance::findWBEntryId (const Glib::ustring& label, enum WB_La std::pair WhiteBalance::findWBEntry(const Glib::ustring& label, enum WB_LabelType lblType) { - for (unsigned int i = 0; i < WBParams::wbEntries.size(); ++i) { - if (label == (lblType == WBLT_GUI ? WBParams::wbEntries[i].GUILabel : WBParams::wbEntries[i].ppLabel)) { - return {true, WBParams::wbEntries[i]}; + for (unsigned int i = 0; i < WBParams::getWbEntries().size(); ++i) { + if (label == (lblType == WBLT_GUI ? WBParams::getWbEntries()[i].GUILabel : WBParams::getWbEntries()[i].ppLabel)) { + return {true, WBParams::getWbEntries()[i]}; } } - return {false, WBParams::wbEntries[0]}; + return {false, WBParams::getWbEntries()[0]}; } int WhiteBalance::_setActiveMethod(Glib::ustring &label, Gtk::TreeModel::Children &children) diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index 453f0a53d..bf986202f 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -29,11 +29,11 @@ XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP hb1->pack_start (*Gtk::manage (new Gtk::Label ( M("TP_RAW_DMETHOD") + ": ")), Gtk::PACK_SHRINK, 4); method = Gtk::manage (new MyComboBoxText ()); - for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) { + for (const auto method_string : RAWParams::XTransSensor::getMethodStrings()) { const std::string langKey = - [i]() -> std::string + [method_string]() -> std::string { - const std::string str(procparams::RAWParams::XTransSensor::methodstring[i]); + const std::string str(method_string); std::string res; for (const auto& c : str) { @@ -83,10 +83,10 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param disableListener (); methodconn.block (true); - method->set_active(procparams::RAWParams::XTransSensor::numMethods); + method->set_active(std::numeric_limits::max()); - for( size_t i = 0; i < procparams::RAWParams::XTransSensor::numMethods; i++) - if( pp->raw.xtranssensor.method == procparams::RAWParams::XTransSensor::methodstring[i]) { + for (size_t i = 0; i < RAWParams::XTransSensor::getMethodStrings().size(); ++i) + if( pp->raw.xtranssensor.method == RAWParams::XTransSensor::getMethodStrings()[i]) { method->set_active(i); oldSelection = i; break; @@ -96,7 +96,7 @@ void XTransProcess::read(const rtengine::procparams::ProcParams* pp, const Param ccSteps->setEditedState (pedited->raw.xtranssensor.ccSteps ? Edited : UnEdited); if( !pedited->raw.xtranssensor.method ) { - method->set_active(procparams::RAWParams::XTransSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name } } @@ -113,12 +113,12 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p int currentRow = method->get_active_row_number(); - if( currentRow >= 0 && currentRow < procparams::RAWParams::XTransSensor::numMethods) { - pp->raw.xtranssensor.method = procparams::RAWParams::XTransSensor::methodstring[currentRow]; + if (currentRow >= 0 && currentRow < std::numeric_limits::max()) { + pp->raw.xtranssensor.method = procparams::RAWParams::XTransSensor::getMethodStrings()[currentRow]; } if (pedited) { - pedited->raw.xtranssensor.method = method->get_active_row_number() != procparams::RAWParams::XTransSensor::numMethods; + pedited->raw.xtranssensor.method = method->get_active_row_number() != std::numeric_limits::max(); pedited->raw.xtranssensor.ccSteps = ccSteps->getEditedState (); } } @@ -126,7 +126,7 @@ void XTransProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* p void XTransProcess::setBatchMode(bool batchMode) { method->append (M("GENERAL_UNCHANGED")); - method->set_active(procparams::RAWParams::XTransSensor::numMethods); // No name + method->set_active(std::numeric_limits::max()); // No name ToolPanel::setBatchMode (batchMode); ccSteps->showEditedCB (); } @@ -153,15 +153,16 @@ void XTransProcess::adjusterChanged (Adjuster* a, double newval) void XTransProcess::methodChanged () { - int curSelection = method->get_active_row_number(); + const int curSelection = method->get_active_row_number(); + const RAWParams::XTransSensor::Method method = RAWParams::XTransSensor::Method(curSelection); - Glib::ustring methodName = ""; + Glib::ustring methodName; bool ppreq = false; - if( curSelection >= 0 && curSelection < procparams::RAWParams::XTransSensor::numMethods) { - methodName = procparams::RAWParams::XTransSensor::methodstring[curSelection]; + if (curSelection >= 0 && curSelection < std::numeric_limits::max()) { + methodName = RAWParams::XTransSensor::getMethodStrings()[curSelection]; - if (curSelection == procparams::RAWParams::XTransSensor::mono || oldSelection == procparams::RAWParams::XTransSensor::mono) { + if (method == RAWParams::XTransSensor::Method::NONE || RAWParams::XTransSensor::Method(oldSelection) == RAWParams::XTransSensor::Method::NONE) { ppreq = true; } }