diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 20b5b5286..28dbb14c5 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -1308,7 +1308,7 @@ void Crop::update(int todo) params.locallab.lumaref = parent->lumarefs[sp]; params.locallab.sobelref = parent->sobelrefs[sp]; - parent->ipf.Lab_Local(1, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, + parent->ipf.Lab_Local(1, maxspot, sp, parent->huerefs, parent->sobelrefs, parent->centerx, parent->centery, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve2.clear(); cclocalcurve2.clear(); @@ -1799,7 +1799,7 @@ void Crop::update(int todo) params.locallab.chromaref = parent->chromarefs[sp]; params.locallab.lumaref = parent->lumarefs[sp]; params.locallab.sobelref = parent->sobelrefs[sp]; - parent->ipf.Lab_Local(1, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, loclhCurve, lochhCurve, + parent->ipf.Lab_Local(1, maxspot, sp, parent->huerefs, parent->sobelrefs, parent->centerx, parent->centery, (float**)shbuffer, labnCrop, labnCrop, reservCrop, cropx / skip, cropy / skip, skips(parent->fw, skip), skips(parent->fh, skip), skip, locRETgainCurve, lllocalcurve2, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve2.clear(); diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 36d5dea45..79b3897d7 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -100,7 +100,7 @@ ImProcCoordinator::ImProcCoordinator() plistener(nullptr), awbListener(nullptr), imageListener(nullptr), aeListener(nullptr), acListener(nullptr), abwListener(nullptr), aloListener(nullptr), actListener(nullptr), adnListener(nullptr), awavListener(nullptr), dehaListener(nullptr), frameCountListener(nullptr), imageTypeListener(nullptr), hListener(nullptr), resultValid(false), lastOutputProfile("BADFOOD"), lastOutputIntent(RI__COUNT), lastOutputBPC(false), thread(nullptr), changeSinceLast(0), updaterRunning(false), destroying(false), utili(false), autili(false), butili(false), ccutili(false), cclutili(false), clcutili(false), opautili(false), wavcontlutili(false), - dataspot(nullptr), retistr(nullptr), llstr(nullptr), lhstr(nullptr), ccstr(nullptr), hhstr(nullptr), skinstr(nullptr), pthstr(nullptr), exstr(nullptr), + dataspot(nullptr), maxdata(0), retistr(nullptr), llstr(nullptr), lhstr(nullptr), ccstr(nullptr), hhstr(nullptr), skinstr(nullptr), pthstr(nullptr), exstr(nullptr), circrads(500, -10000), centerx(500, -10000), centery(500, -10000), @@ -890,7 +890,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) }; - int maxdata = 102; //101 10023 //100 10022 //99 10021 // 90 10020 //88 10019//87 10018 //86 10017 //85 10016;// 82 10015//78;//73 for 10011 + maxdata = 102; //101 10023 //100 10022 //99 10021 // 90 10020 //88 10019//87 10018 //86 10017 //85 10016;// 82 10015//78;//73 for 10011 //same value in simpleprocess.cc //same value in locallab.h for int nextdatasp[102];//102 = maxdata @@ -2717,7 +2717,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) dataspot[maxdata - 2][sp] = lumarefs[sp] = params.locallab.lumaref; dataspot[maxdata - 1][sp] = sobelrefs[sp] = params.locallab.sobelref; //printf("sp=%i huerefsp=%f\n", sp, huerefs[sp]); - ipf.Lab_Local(3, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, + ipf.Lab_Local(3, maxspot, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve.clear(); cclocalcurve.clear(); @@ -3370,7 +3370,7 @@ void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) params.locallab.chromaref = chromarefs[sp]; params.locallab.lumaref = lumarefs[sp]; params.locallab.sobelref = sobelrefs[sp]; - ipf.Lab_Local(3, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, + ipf.Lab_Local(3, maxspot, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, nprevl, nprevl, reserv, 0, 0, pW, pH, scale, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve.clear(); cclocalcurve.clear(); diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 2e57edbd5..848ec6869 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -242,6 +242,7 @@ protected: bool curveutili; int **dataspot; + int maxdata; std::string *retistr; std::string *llstr; std::string *lhstr; diff --git a/rtengine/improcfun.h b/rtengine/improcfun.h index 3770a2f5a..30f5d61a1 100644 --- a/rtengine/improcfun.h +++ b/rtengine/improcfun.h @@ -297,7 +297,7 @@ public: void calc_ref(LabImage* original, LabImage* transformed, int cx, int cy, int oW, int oH, int sk, double &huerefblur, double &huere, double &chromare, double &lumare, double &sobelref); void copy_ref(LabImage* spotbuffer, LabImage* original, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp, double &huerefspot, double &chromarefspot, double &lumarefspot); void paste_ref(LabImage* spotbuffer, LabImage* transformed, int cx, int cy, int sk, const struct local_params & lp); - void Lab_Local(int call, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref); + void Lab_Local(int call, int maxspot, int sp, LUTf & huerefs, LUTf & sobelrefs, LUTi & centerx, LUTi & centery, float** shbuffer, LabImage* original, LabImage* transformed, LabImage* reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool &LHutili, bool &HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurve, LUTf & shtonecurve, LUTf & tonecurve, double & huerefblur, double &hueref, double &chromaref, double &lumaref, double &sobelref); void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk); void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); void InverseBlurNoise_Local(const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy); diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index f4cdcb586..bdb28a534 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -2139,6 +2139,7 @@ void ImProcFunctions::DeNoise_Local_imp(int call, const struct local_params& lp, case 1: { // inside transition zone float factorx = localFactor; float difL, difa, difb; + if (call == 2 /*|| call == 1 || call == 3 */) { //simpleprocess difL = tmp1->L[loy - begy][lox - begx] - original->L[y][x]; difa = tmp1->a[loy - begy][lox - begx] - original->a[y][x]; @@ -8476,7 +8477,7 @@ void ImProcFunctions::fftw_denoise(int GW, int GH, int max_numblox_W, int min_nu -void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk, +void ImProcFunctions::Lab_Local(int call, int maxspot, int sp, LUTf & huerefs, LUTf & sobelrefs, LUTi & centerx, LUTi & centery, float** shbuffer, LabImage * original, LabImage * transformed, LabImage * reserved, int cx, int cy, int oW, int oH, int sk, const LocretigainCurve & locRETgainCcurve, LUTf & lllocalcurve, const LocLHCurve & loclhCurve, const LocHHCurve & lochhCurve, bool & LHutili, bool & HHutili, LUTf & cclocalcurve, bool & localskutili, LUTf & sklocalcurve, bool & localexutili, LUTf & exlocalcurve, LUTf & hltonecurveloc, LUTf & shtonecurveloc, LUTf & tonecurveloc, double & huerefblur, double & hueref, double & chromaref, double & lumaref, double & sobelref) { @@ -8697,7 +8698,7 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, bool titi = false; - if (titi) { + if (titi) { //&& call == 3 @@ -8709,6 +8710,20 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, //Cdeltae Ldeltae - deltaE Chroma and Luma in area bfw bfh //Cdeltaesob Ldeltaesob - Sobel transformed of deltaE Chroma and Luma in area bfw bfh + //retreive coordonate and values of references around current exclude Spot + // hueref dataspot[maxdata - 4][sp] = huerefs[sp] = 100.f * params.locallab.hueref; + // dataspot[maxdata - 1][sp] = sobelrefs[sp] = params.locallab.sobelref; + + //retrieve datas for hueref, sobelref and centerX Y for all spot around + /* + huerefs[sp]; + sobelrefs[sp]; + centerx[sp]; + centery[sp]; + */ + //int currentcenterx = centerx[0]; + //int currentcentery = centery[0]; + const JaggedArray Cdeltae(bfw, bfh); const JaggedArray Cdeltaesob(bfw, bfh); const JaggedArray Ldeltae(bfw, bfh); @@ -8845,7 +8860,7 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, float *radlimR = nullptr; radlimR = new float[yEn - begy + ar]; - + printf("huar=%f sob=%f cx=%i\n", huerefs[2], sobelrefs[2], centerx[1]); for (int w = 0; w < (xEn - begx); w++) { @@ -9352,6 +9367,8 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, delete[] meanaft; delete[] meanbef; + + } //then restore non modified area @@ -9661,6 +9678,7 @@ void ImProcFunctions::Lab_Local(int call, float** shbuffer, LabImage * original, #ifdef _OPENMP #pragma omp parallel for schedule(dynamic,16) #endif + for (int ir = 0; ir < GH; ir++) for (int jr = 0; jr < GW; jr++) { bufwv->L[ir][jr] = original->L[ir][jr]; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 209a9219b..3110d68a7 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -1145,6 +1145,10 @@ private: int **dataspots; dataspots = new int*[maxdata]; + LUTf huerefs(500, -10000.f); + LUTf sobelrefs(500, -10000.f); + LUTi centerx (500, -10000); + LUTi centery (500, -10000); for (int i = 0; i < maxdata; i++) { dataspots[i] = new int[maxspot]; @@ -1718,8 +1722,8 @@ private: params.locallab.locY = dataspots[4][sp]; params.locallab.locYT = dataspots[5][sp]; params.locallab.locXL = dataspots[6][sp]; - params.locallab.centerX = dataspots[7][sp]; - params.locallab.centerY = dataspots[8][sp]; + params.locallab.centerX = centerx[sp]= dataspots[7][sp]; + params.locallab.centerY = centery[sp] = dataspots[8][sp]; params.locallab.lightness = dataspots[9][sp]; params.locallab.contrast = dataspots[10][sp]; params.locallab.chroma = dataspots[11][sp]; @@ -1978,10 +1982,11 @@ private: } params.locallab.huerefblur = ((float) dataspots[maxdata - 5][sp]) / 100.f; - params.locallab.hueref = ((float) dataspots[maxdata - 4][sp]) / 100.f; + params.locallab.hueref = huerefs[sp] = ((float) dataspots[maxdata - 4][sp]) / 100.f; + huerefs[sp] *= 100.f; params.locallab.chromaref = dataspots[maxdata - 3][sp]; params.locallab.lumaref = dataspots[maxdata - 2][sp]; - params.locallab.sobelref = dataspots[maxdata - 1][sp]; + params.locallab.sobelref = sobelrefs[sp] = dataspots[maxdata - 1][sp]; int *s_datc; @@ -2168,8 +2173,9 @@ private: params.locallab.chromaref = chromare; params.locallab.lumaref = lumare; params.locallab.sobelref = sobelre; - - ipf.Lab_Local(2, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, + //nullptr or dataspot ?? + + ipf.Lab_Local(2, maxspot, sp, huerefs, sobelrefs, centerx, centery, (float**)shbuffer, labView, labView, reservView, 0, 0, fw, fh, 1, locRETgainCurve, lllocalcurve, loclhCurve, lochhCurve, LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.huerefblur, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve.clear(); cclocalcurve.clear();