diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index 85fe0b306..e9efe4005 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -1069,7 +1069,7 @@ PREFERENCES_OUTDIR;Dossier de sortie PREFERENCES_OUTDIRFOLDER;Dossier de sauvegarde PREFERENCES_OUTDIRFOLDERHINT;Place les images traitées dans le dossier selectionné PREFERENCES_OUTDIRTEMPLATE;Utiliser le modèle -PREFERENCES_OUTDIRTEMPLATEHINT;Vous pouvez utiliser les paramètres de chaîne formatées suivants:\n%f, %d1, %d2, ..., %p1, %p2, ..., %r, %s1, %s2, ...\n\nCes chaînes de formattage se réfèrent aux différentes parties du chemin de la photo, certains de ses attributs ou un numéro de séquence arbitraire dans le traitement par lot.\n\nPar exemple, si la photo en cours de traitement a le chemin suivant:\n/home/tom/image/02-09-2006/dsc0012.nef\nla signification des chaînes de formattage est:\n%d4 = home\n%d3 = tom\n%d2 = photos\n%d1 = 2010-10-31\n%f = dsc0042\n%p1 = /home/tom/photos/2010-10-31/\n%p2 = /home/tom/photos/\n%p3 = /home/tom/\n%p4 = /home/\n\n%r sera remplacé par le rang de la photo. Si la photo n'a pas de rang, %r sera remplacé par '0'. Si la photo est dans la corbeille de RawTherapee, %r sera remplacé par 'x'.\n\n%s1, %s2, etc. sera remplacé par un index de séquence constitué de 1 à 9 chiffre. L'index de la séquence commencera à 1 à chaque fois que le file de traitement est démarrée, et est incrémenté de 1 pour chaque image traitée.\n\nSi vous voulez enregistrer l'image de sortie là où se trouve l'originale, écrivez:\n%p1/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "convertis" situé dans le dossier de l'originale, écrivez:\n%p1/convertis/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "/home/tom/photos/convertis/2010-10-31", écrivez:\n%p2/convertis/%d1/%f +PREFERENCES_OUTDIRTEMPLATEHINT;Vous pouvez utiliser les paramètres de chaîne formatées suivants:\n%f, %d1, %d2, ..., %p1, %p2, ..., %r, %s1, %s2, ...\n\nCes chaînes de formattage se réfèrent aux différentes parties du chemin de la photo, certains de ses attributs ou un numéro de séquence arbitraire dans le traitement par lot.\n\nPar exemple, si la photo en cours de traitement a le chemin suivant:\n/home/tom/photos/2010-10-31/dsc0042.nef\nla signification des chaînes de formattage est:\n%d4 = home\n%d3 = tom\n%d2 = photos\n%d1 = 2010-10-31\n%f = dsc0042\n%p1 = /home/tom/photos/2010-10-31/\n%p2 = /home/tom/photos/\n%p3 = /home/tom/\n%p4 = /home/\n\n%r sera remplacé par le rang de la photo. Si la photo n'a pas de rang, %r sera remplacé par '0'. Si la photo est dans la corbeille de RawTherapee, %r sera remplacé par 'x'.\n\n%s1, %s2, etc. sera remplacé par un index de séquence constitué de 1 à 9 chiffres. L'index de la séquence commencera à 1 à chaque fois que le file de traitement est démarrée, et est incrémenté de 1 pour chaque image traitée.\n\nSi vous voulez enregistrer l'image de sortie là où se trouve l'originale, écrivez:\n%p1/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "convertis" situé dans le dossier de l'originale, écrivez:\n%p1/convertis/%f\n\nSi vous voulez enregistrer l'image de sortie dans un dossier nommé "/home/tom/photos/convertis/2010-10-31", écrivez:\n%p2/convertis/%d1/%f PREFERENCES_OVERLAY_FILENAMES;Superposer les noms de fichier sur les vignettes dans le navigateur de fichier PREFERENCES_OVERLAY_FILENAMES_FILMSTRIP;Superposer les noms de fichier sur les vignettes dans le panneau d'édition PREFERENCES_OVERWRITEOUTPUTFILE;Écraser le fichier s'il existe déjà diff --git a/rtdata/languages/default b/rtdata/languages/default index 8ac6fd3c8..8d9488703 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -836,6 +836,7 @@ HISTORY_MSG_585;Local - LD HISTORY_MSG_587;Local - Spot method HISTORY_MSG_588;Local - Spot Excluding scope HISTORY_MSG_589;Local - Spot Excluding struc +HISTORY_MSG_590;Local - Warm Cool HISTORY_NEWSNAPSHOT;Add HISTORY_NEWSNAPSHOT_TOOLTIP;Shortcut: Alt-s HISTORY_SNAPSHOT;Snapshot @@ -1906,6 +1907,7 @@ TP_LOCALLAB_CURVEEDITOR_TONES_LABEL;Tone curve TP_LOCALLAB_TRANSIT;Transition TP_LOCALLAB_TRANSIT_TOOLTIP;Adjust smoothness of transition between affected and unaffected areas. TP_LOCALLAB_VIBRANCE;Vibrance +TP_LOCALLAB_WARM;Warm - Cool TP_LOCAL_HEIGHT;Bottom TP_LOCAL_HEIGHT_T;Top TP_LOCAL_WIDTH;Right diff --git a/rtengine/CA_correct_RT.cc b/rtengine/CA_correct_RT.cc index 59fd804f1..bfd56cc0a 100644 --- a/rtengine/CA_correct_RT.cc +++ b/rtengine/CA_correct_RT.cc @@ -218,18 +218,18 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const // Main algorithm: Tile loop calculating correction parameters per tile #pragma omp for collapse(2) schedule(dynamic) nowait for (int top = -border ; top < height; top += ts - border2) - for (int left = -border; left < width; left += ts - border2) { + for (int left = -border; left < width - (W & 1); left += ts - border2) { memset(buffer, 0, buffersize); const int vblock = ((top + border) / (ts - border2)) + 1; const int hblock = ((left + border) / (ts - border2)) + 1; const int bottom = min(top + ts, height + border); - const int right = min(left + ts, width + border); + const int right = min(left + ts, width - (W & 1) + border); const int rr1 = bottom - top; const int cc1 = right - left; const int rrmin = top < 0 ? border : 0; const int rrmax = bottom > height ? height - top : rr1; const int ccmin = left < 0 ? border : 0; - const int ccmax = right > width ? width - left : cc1; + const int ccmax = (right > width - (W & 1)) ? width - (W & 1) - left : cc1; // rgb from input CFA data // rgb values should be floating point numbers between 0 and 1 @@ -755,20 +755,20 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const #pragma omp for schedule(dynamic) collapse(2) nowait for (int top = -border; top < height; top += ts - border2) - for (int left = -border; left < width; left += ts - border2) { + for (int left = -border; left < width - (W & 1); left += ts - border2) { memset(buffer, 0, buffersize); float lblockshifts[2][2]; const int vblock = ((top + border) / (ts - border2)) + 1; const int hblock = ((left + border) / (ts - border2)) + 1; const int bottom = min(top + ts, height + border); - const int right = min(left + ts, width + border); + const int right = min(left + ts, width - (W & 1) + border); const int rr1 = bottom - top; const int cc1 = right - left; const int rrmin = top < 0 ? border : 0; const int rrmax = bottom > height ? height - top : rr1; const int ccmin = left < 0 ? border : 0; - const int ccmax = right > width ? width - left : cc1; + const int ccmax = (right > width - (W & 1)) ? width - (W & 1) - left : cc1; // rgb from input CFA data // rgb values should be floating point number between 0 and 1 @@ -1145,7 +1145,7 @@ void RawImageSource::CA_correct_RT(const bool autoCA, const double cared, const STC2VFU(rawData[row][col], LVFU(RawDataTmp[indx])); } #endif - for(; col < width; col += 2, indx++) { + for(; col < width - (W & 1); col += 2, indx++) { rawData[row][col] = RawDataTmp[indx]; } } diff --git a/rtengine/FTblockDN.cc b/rtengine/FTblockDN.cc index 852133df6..7f3c79a46 100644 --- a/rtengine/FTblockDN.cc +++ b/rtengine/FTblockDN.cc @@ -74,13 +74,14 @@ extern const Settings* settings; extern MyMutex *fftwMutex; -namespace { +namespace +{ template void do_median_denoise(float **src, float **dst, float upperBound, const int width, const int height, const ImProcFunctions::Median medianType, const int iterations, const int numThreads, float **buffer) { typedef ImProcFunctions::Median Median; - + int border = 1; switch (medianType) { @@ -227,6 +228,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid case Median::TYPE_5X5_STRONG: { #ifdef __SSE2__ + for (; !useUpperBound && j < width - border - 3; j += 4) { STVFU( medianOut[i][j], @@ -261,6 +263,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid } #endif + for (; j < width - border; ++j) { if (!useUpperBound || medianIn[i][j] <= upperBound) { medianOut[i][j] = median( @@ -315,7 +318,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid #endif std::array pp; - + for (; j < width - border; ++j) { if (!useUpperBound || medianIn[i][j] <= upperBound) { for (int kk = 0, ii = -border; ii <= border; ++ii) { @@ -323,7 +326,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid pp[kk] = medianIn[i + ii][j + jj]; } } - + medianOut[i][j] = median(pp); } else { medianOut[i][j] = medianIn[i][j]; @@ -350,7 +353,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid #endif std::array pp; - + for (; j < width - border; ++j) { if (!useUpperBound || medianIn[i][j] <= upperBound) { for (int kk = 0, ii = -border; ii <= border; ++ii) { @@ -358,7 +361,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid pp[kk] = medianIn[i + ii][j + jj]; } } - + medianOut[i][j] = median(pp); } else { medianOut[i][j] = medianIn[i][j]; @@ -393,6 +396,7 @@ void do_median_denoise(float **src, float **dst, float upperBound, const int wid #ifdef _OPENMP #pragma omp parallel for num_threads(numThreads) if (numThreads>1) #endif + for (int i = 0; i < height; ++i) { for (int j = 0; j < width; ++j) { dst[i][j] = medianOut[i][j]; @@ -491,7 +495,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef MyMutex::MyLock lock(*fftwMutex); const nrquality nrQuality = (dnparams.smethod == "shal") ? QUALITY_STANDARD : QUALITY_HIGH;//shrink method - const float qhighFactor = (nrQuality == QUALITY_HIGH) ? 1.f / static_cast( settings->nrhigh) : 1.0f; + const float qhighFactor = (nrQuality == QUALITY_HIGH) ? 1.f / static_cast(settings->nrhigh) : 1.0f; const bool useNoiseCCurve = (noiseCCurve && noiseCCurve.getSum() > 5.f); const bool useNoiseLCurve = (noiseLCurve && noiseLCurve.getSum() >= 7.f); const bool autoch = (settings->leveldnautsimpl == 1 && (dnparams.Cmethod == "AUT" || dnparams.Cmethod == "PRE")) || (settings->leveldnautsimpl == 0 && (dnparams.C2method == "AUTO" || dnparams.C2method == "PREV")); @@ -531,15 +535,15 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef const bool denoiseMethodRgb = (dnparams.dmethod == "RGB"); // init luma noisevarL - const float noiseluma = static_cast( dnparams.luma); - const float noisevarL = (useNoiseLCurve && (denoiseMethodRgb || !isRAW)) ? static_cast (SQR(((noiseluma + 1.0) / 125.0) * (10. + (noiseluma + 1.0) / 25.0))) : static_cast (SQR((noiseluma / 125.0) * (1.0 + noiseluma / 25.0))); + const float noiseluma = static_cast(dnparams.luma); + const float noisevarL = (useNoiseLCurve && (denoiseMethodRgb || !isRAW)) ? static_cast(SQR(((noiseluma + 1.0) / 125.0) * (10. + (noiseluma + 1.0) / 25.0))) : static_cast(SQR((noiseluma / 125.0) * (1.0 + noiseluma / 25.0))); const bool denoiseLuminance = (noisevarL > 0.00001f); //printf("NL=%f \n",noisevarL); if (useNoiseLCurve || useNoiseCCurve) { int hei = calclum->getHeight(); int wid = calclum->getWidth(); - TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wpi[3][3] = { {static_cast(wprofi[0][0]), static_cast(wprofi[0][1]), static_cast(wprofi[0][2])}, @@ -653,7 +657,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef Color::gammanf2lut(igamcurve, igam, 32768.f, 65535.f); } - const float gain = pow (2.0f, float(expcomp)); + const float gain = pow(2.0f, float(expcomp)); float noisevar_Ldetail = SQR(static_cast(SQR(100. - dnparams.Ldetail) + 50.*(100. - dnparams.Ldetail)) * TS * 0.5f); array2D tilemask_in(TS, TS); @@ -706,7 +710,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; - Tile_calc (tilesize, overlap, (options.rgbDenoiseThreadLimit == 0 && !ponder) ? (numTries == 1 ? 0 : 2) : 2, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + Tile_calc(tilesize, overlap, (options.rgbDenoiseThreadLimit == 0 && !ponder) ? (numTries == 1 ? 0 : 2) : 2, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); memoryAllocationFailed = false; const int numtiles = numtiles_W * numtiles_H; @@ -746,8 +750,8 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftwf_plan plan_backward_blox[2]; if (denoiseLuminance) { - float *Lbloxtmp = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof (float))); - float *fLbloxtmp = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof (float))); + float *Lbloxtmp = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + float *fLbloxtmp = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); int nfwd[2] = {TS, TS}; @@ -756,12 +760,12 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftw_r2r_kind bwdkind[2] = {FFTW_REDFT01, FFTW_REDFT01}; // Creating the plans with FFTW_MEASURE instead of FFTW_ESTIMATE speeds up the execute a bit - plan_forward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - plan_backward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - plan_forward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - plan_backward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT ); - fftwf_free (Lbloxtmp); - fftwf_free (fLbloxtmp); + plan_forward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + plan_backward_blox[0] = fftwf_plan_many_r2r(2, nfwd, max_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + plan_forward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, Lbloxtmp, nullptr, 1, TS * TS, fLbloxtmp, nullptr, 1, TS * TS, fwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + plan_backward_blox[1] = fftwf_plan_many_r2r(2, nfwd, min_numblox_W, fLbloxtmp, nullptr, 1, TS * TS, Lbloxtmp, nullptr, 1, TS * TS, bwdkind, FFTW_MEASURE || FFTW_DESTROY_INPUT); + fftwf_free(Lbloxtmp); + fftwf_free(fLbloxtmp); } #ifndef _OPENMP @@ -785,7 +789,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } if (options.rgbDenoiseThreadLimit > 0) - while(denoiseNestedLevels * numthreads > options.rgbDenoiseThreadLimit) { + while (denoiseNestedLevels * numthreads > options.rgbDenoiseThreadLimit) { denoiseNestedLevels--; } @@ -801,12 +805,12 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef if (numtiles > 1 && denoiseLuminance) { for (int i = 0; i < denoiseNestedLevels * numthreads; ++i) { - LbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); - fLbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + LbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + fLbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); } } - TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix (params->icm.working); + TMatrix wiprof = ICCStore::getInstance()->workingSpaceInverseMatrix(params->icm.working); //inverse matrix user select const float wip[3][3] = { {static_cast(wiprof[0][0]), static_cast(wiprof[0][1]), static_cast(wiprof[0][2])}, @@ -814,7 +818,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef {static_cast(wiprof[2][0]), static_cast(wiprof[2][1]), static_cast(wiprof[2][2])} }; - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wp[3][3] = { {static_cast(wprof[0][0]), static_cast(wprof[0][1]), static_cast(wprof[0][2])}, @@ -853,19 +857,19 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef int height = tilebottom - tiletop; int width2 = (width + 1) / 2; float realred, realblue; - float interm_med = static_cast( dnparams.chroma) / 10.0; + float interm_med = static_cast(dnparams.chroma) / 10.0; float intermred, intermblue; if (dnparams.redchro > 0.) { intermred = (dnparams.redchro / 10.); } else { - intermred = static_cast( dnparams.redchro) / 7.0; //increase slower than linear for more sensit + intermred = static_cast(dnparams.redchro) / 7.0; //increase slower than linear for more sensit } if (dnparams.bluechro > 0.) { intermblue = (dnparams.bluechro / 10.); } else { - intermblue = static_cast( dnparams.bluechro) / 7.0; //increase slower than linear for more sensit + intermblue = static_cast(dnparams.bluechro) / 7.0; //increase slower than linear for more sensit } if (ponder && kall == 2) { @@ -1079,7 +1083,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef //binary 1 or 0 for each level, eg subsampling = 0 means no subsampling, 1 means subsample //the first level only, 7 means subsample the first three levels, etc. //actual implementation only works with subsampling set to 1 - float interm_medT = static_cast( dnparams.chroma) / 10.0; + float interm_medT = static_cast(dnparams.chroma) / 10.0; bool execwavelet = true; if (!denoiseLuminance && interm_medT < 0.05f && dnparams.median && (dnparams.methodmed == "Lab" || dnparams.methodmed == "Lonly")) { @@ -1139,7 +1143,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef levwav = min(maxlev2, levwav); // if (settings->verbose) printf("levwavelet=%i noisevarA=%f noisevarB=%f \n",levwav, noisevarab_r, noisevarab_b); - Ldecomp = new wavelet_decomposition (labdn->L[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); + Ldecomp = new wavelet_decomposition(labdn->L[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); if (Ldecomp->memoryAllocationFailed) { memoryAllocationFailed = true; @@ -1176,7 +1180,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef float chmaxresid = 0.f; float chmaxresidtemp = 0.f; - adecomp = new wavelet_decomposition (labdn->a[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); + adecomp = new wavelet_decomposition(labdn->a[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); if (adecomp->memoryAllocationFailed) { memoryAllocationFailed = true; @@ -1213,7 +1217,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef delete adecomp; if (!memoryAllocationFailed) { - wavelet_decomposition* bdecomp = new wavelet_decomposition (labdn->b[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); + wavelet_decomposition* bdecomp = new wavelet_decomposition(labdn->b[0], labdn->W, labdn->H, levwav, 1, 1, max(1, denoiseNestedLevels)); if (bdecomp->memoryAllocationFailed) { memoryAllocationFailed = true; @@ -1295,79 +1299,6 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } if (!memoryAllocationFailed) { - if ((metchoice == 1 || metchoice == 2 || metchoice == 3 || metchoice == 4) && dnparams.median) { - float** tmL; - int wid = labdn->W; - int hei = labdn->H; - tmL = new float*[hei]; - - for (int i = 0; i < hei; ++i) { - tmL[i] = new float[wid]; - } - - Median medianTypeL = Median::TYPE_3X3_SOFT; - Median medianTypeAB = Median::TYPE_3X3_SOFT; - - if (dnparams.medmethod == "soft") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_3X3_SOFT; - } else { - medianTypeL = Median::TYPE_3X3_SOFT; - medianTypeAB = Median::TYPE_3X3_SOFT; - } - } else if (dnparams.medmethod == "33") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_3X3_STRONG; - } else { - medianTypeL = Median::TYPE_3X3_SOFT; - medianTypeAB = Median::TYPE_3X3_STRONG; - } - } else if (dnparams.medmethod == "55soft") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_5X5_SOFT; - } else { - medianTypeL = Median::TYPE_3X3_SOFT; - medianTypeAB = Median::TYPE_5X5_SOFT; - } - } else if (dnparams.medmethod == "55") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_5X5_STRONG; - } else { - medianTypeL = Median::TYPE_3X3_STRONG; - medianTypeAB = Median::TYPE_5X5_STRONG; - } - } else if (dnparams.medmethod == "77") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_7X7; - } else { - medianTypeL = Median::TYPE_3X3_STRONG; - medianTypeAB = Median::TYPE_7X7; - } - } else if (dnparams.medmethod == "99") { - if (metchoice != 4) { - medianTypeL = medianTypeAB = Median::TYPE_9X9; - } else { - medianTypeL = Median::TYPE_5X5_SOFT; - medianTypeAB = Median::TYPE_9X9; - } - } - - if (metchoice == 1 || metchoice == 2 || metchoice == 4) { - Median_Denoise(labdn->L, labdn->L, wid, hei, medianTypeL, dnparams.passes, denoiseNestedLevels, tmL); - } - - if (metchoice == 2 || metchoice == 3 || metchoice == 4) { - Median_Denoise(labdn->a, labdn->a, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); - Median_Denoise(labdn->b, labdn->b, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); - } - - for (int i = 0; i < hei; ++i) { - delete[] tmL[i]; - } - - delete[] tmL; - } - //wavelet denoised L channel //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1396,8 +1327,8 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef if (numtiles == 1) { for (int i = 0; i < denoiseNestedLevels * numthreads; ++i) { - LbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); - fLbloxArray[i] = reinterpret_cast( fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + LbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); + fLbloxArray[i] = reinterpret_cast(fftwf_malloc(max_numblox_W * TS * TS * sizeof(float))); } } @@ -1492,7 +1423,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef for (int hblk = 0; hblk < numblox_W; ++hblk) { - RGBtile_denoise (fLblox, hblk, noisevar_Ldetail, nbrwt, blurbuffer); + RGBtile_denoise(fLblox, hblk, noisevar_Ldetail, nbrwt, blurbuffer); }//end of horizontal block loop //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1507,7 +1438,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef int topproc = (vblk - blkrad) * offset; //add row of blocks to output image tile - RGBoutput_tile_row (Lblox, Ldetail, tilemask_out, height, width, topproc); + RGBoutput_tile_row(Lblox, Ldetail, tilemask_out, height, width, topproc); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -1530,6 +1461,79 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } + if ((metchoice == 1 || metchoice == 2 || metchoice == 3 || metchoice == 4) && dnparams.median) { + float** tmL; + int wid = labdn->W; + int hei = labdn->H; + tmL = new float*[hei]; + + for (int i = 0; i < hei; ++i) { + tmL[i] = new float[wid]; + } + + Median medianTypeL = Median::TYPE_3X3_SOFT; + Median medianTypeAB = Median::TYPE_3X3_SOFT; + + if (dnparams.medmethod == "soft") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_3X3_SOFT; + } else { + medianTypeL = Median::TYPE_3X3_SOFT; + medianTypeAB = Median::TYPE_3X3_SOFT; + } + } else if (dnparams.medmethod == "33") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_3X3_STRONG; + } else { + medianTypeL = Median::TYPE_3X3_SOFT; + medianTypeAB = Median::TYPE_3X3_STRONG; + } + } else if (dnparams.medmethod == "55soft") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_5X5_SOFT; + } else { + medianTypeL = Median::TYPE_3X3_SOFT; + medianTypeAB = Median::TYPE_5X5_SOFT; + } + } else if (dnparams.medmethod == "55") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_5X5_STRONG; + } else { + medianTypeL = Median::TYPE_3X3_STRONG; + medianTypeAB = Median::TYPE_5X5_STRONG; + } + } else if (dnparams.medmethod == "77") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_7X7; + } else { + medianTypeL = Median::TYPE_3X3_STRONG; + medianTypeAB = Median::TYPE_7X7; + } + } else if (dnparams.medmethod == "99") { + if (metchoice != 4) { + medianTypeL = medianTypeAB = Median::TYPE_9X9; + } else { + medianTypeL = Median::TYPE_5X5_SOFT; + medianTypeAB = Median::TYPE_9X9; + } + } + + if (metchoice == 1 || metchoice == 2 || metchoice == 4) { + Median_Denoise(labdn->L, labdn->L, wid, hei, medianTypeL, dnparams.passes, denoiseNestedLevels, tmL); + } + + if (metchoice == 2 || metchoice == 3 || metchoice == 4) { + Median_Denoise(labdn->a, labdn->a, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); + Median_Denoise(labdn->b, labdn->b, wid, hei, medianTypeAB, dnparams.passes, denoiseNestedLevels, tmL); + } + + for (int i = 0; i < hei; ++i) { + delete[] tmL[i]; + } + + delete[] tmL; + } + //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // transform denoised "Lab" to output RGB @@ -1776,7 +1780,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef fftwf_destroy_plan(plan_backward_blox[1]); fftwf_cleanup(); } - } while(memoryAllocationFailed && numTries < 2 && (options.rgbDenoiseThreadLimit == 0) && !ponder); + } while (memoryAllocationFailed && numTries < 2 && (options.rgbDenoiseThreadLimit == 0) && !ponder); if (memoryAllocationFailed) { printf("tiled denoise failed due to isufficient memory. Output is not denoised!\n"); @@ -1838,16 +1842,16 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } - } else { + } else + { #pragma omp for - for (int i = 2; i < hei - 2; ++i) - { + for (int i = 2; i < hei - 2; ++i) { if (methmed == 3) { for (int j = 2; j < wid - 2; ++j) { tm[i][j] = median(source->r(i, j), source->r(i - 1, j), source->r(i + 1, j), source->r(i, j + 1), source->r(i, j - 1), source->r(i - 1, j - 1), source->r(i - 1, j + 1), source->r(i + 1, j - 1), source->r(i + 1, j + 1), - source->r(i - 2, j), source->r(i + 2, j), source->r(i, j + 2), source->r(i, j - 2), source->r(i - 2, j - 2), source->r(i - 2, j + 2), source->r(i + 2, j - 2), source->r(i + 2, j + 2), - source->r(i - 2, j + 1), source->r(i + 2, j + 1), source->r(i - 1, j + 2), source->r(i - 1, j - 2), source->r(i - 2, j - 1), source->r(i + 2, j - 1), source->r(i + 1, j + 2), source->r(i + 1, j - 2));//5x5 + source->r(i - 2, j), source->r(i + 2, j), source->r(i, j + 2), source->r(i, j - 2), source->r(i - 2, j - 2), source->r(i - 2, j + 2), source->r(i + 2, j - 2), source->r(i + 2, j + 2), + source->r(i - 2, j + 1), source->r(i + 2, j + 1), source->r(i - 1, j + 2), source->r(i - 1, j - 2), source->r(i - 2, j - 1), source->r(i + 2, j - 1), source->r(i + 1, j + 2), source->r(i + 1, j - 2));//5x5 } } else { for (int j = 2; j < wid - 2; ++j) { @@ -1870,6 +1874,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } + #ifdef _OPENMP #pragma omp for nowait #endif @@ -1896,16 +1901,16 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } - } else { + } else + { #pragma omp for - for (int i = 2; i < hei - 2; ++i) - { + for (int i = 2; i < hei - 2; ++i) { if (methmed == 3) { for (int j = 2; j < wid - 2; ++j) { tm[i][j] = median(source->b(i, j), source->b(i - 1, j), source->b(i + 1, j), source->b(i, j + 1), source->b(i, j - 1), source->b(i - 1, j - 1), source->b(i - 1, j + 1), source->b(i + 1, j - 1), source->b(i + 1, j + 1), - source->b(i - 2, j), source->b(i + 2, j), source->b(i, j + 2), source->b(i, j - 2), source->b(i - 2, j - 2), source->b(i - 2, j + 2), source->b(i + 2, j - 2), source->b(i + 2, j + 2), - source->b(i - 2, j + 1), source->b(i + 2, j + 1), source->b(i - 1, j + 2), source->b(i - 1, j - 2), source->b(i - 2, j - 1), source->b(i + 2, j - 1), source->b(i + 1, j + 2), source->b(i + 1, j - 2)); // 5x5 + source->b(i - 2, j), source->b(i + 2, j), source->b(i, j + 2), source->b(i, j - 2), source->b(i - 2, j - 2), source->b(i - 2, j + 2), source->b(i + 2, j - 2), source->b(i + 2, j + 2), + source->b(i - 2, j + 1), source->b(i + 2, j + 1), source->b(i - 1, j + 2), source->b(i - 1, j - 2), source->b(i - 2, j - 1), source->b(i + 2, j - 1), source->b(i + 1, j + 2), source->b(i + 1, j - 2)); // 5x5 } } else { for (int j = 2; j < wid - 2; ++j) { @@ -1956,16 +1961,16 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef } } } - } else { + } else + { #pragma omp for - for (int i = 2; i < hei - 2; ++i) - { + for (int i = 2; i < hei - 2; ++i) { if (methmed == 3) { for (int j = 2; j < wid - 2; ++j) { tm[i][j] = median(source->g(i, j), source->g(i - 1, j), source->g(i + 1, j), source->g(i, j + 1), source->g(i, j - 1), source->g(i - 1, j - 1), source->g(i - 1, j + 1), source->g(i + 1, j - 1), source->g(i + 1, j + 1), - source->g(i - 2, j), source->g(i + 2, j), source->g(i, j + 2), source->g(i, j - 2), source->g(i - 2, j - 2), source->g(i - 2, j + 2), source->g(i + 2, j - 2), source->g(i + 2, j + 2), - source->g(i - 2, j + 1), source->g(i + 2, j + 1), source->g(i - 1, j + 2), source->g(i - 1, j - 2), source->g(i - 2, j - 1), source->g(i + 2, j - 1), source->g(i + 1, j + 2), source->g(i + 1, j - 2)); // 5x5 + source->g(i - 2, j), source->g(i + 2, j), source->g(i, j + 2), source->g(i, j - 2), source->g(i - 2, j - 2), source->g(i - 2, j + 2), source->g(i + 2, j - 2), source->g(i + 2, j + 2), + source->g(i - 2, j + 1), source->g(i + 2, j + 1), source->g(i - 1, j + 2), source->g(i - 1, j - 2), source->g(i - 2, j - 1), source->g(i + 2, j - 1), source->g(i + 1, j + 2), source->g(i + 1, j - 2)); // 5x5 } } else { for (int j = 2; j < wid - 2; ++j) { @@ -2034,7 +2039,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -SSEFUNCTION void ImProcFunctions::RGBtile_denoise (float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer) //for DCT +SSEFUNCTION void ImProcFunctions::RGBtile_denoise(float * fLblox, int hblproc, float noisevar_Ldetail, float * nbrwt, float * blurbuffer) //for DCT { int blkstart = hblproc * TS * TS; @@ -2067,7 +2072,7 @@ SSEFUNCTION void ImProcFunctions::RGBtile_denoise (float * fLblox, int hblproc, //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -void ImProcFunctions::RGBoutput_tile_row (float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top) +void ImProcFunctions::RGBoutput_tile_row(float *bloxrow_L, float ** Ldetail, float ** tilemask_out, int height, int width, int top) { const int numblox_W = ceil((static_cast(width)) / (offset)); const float DCTnorm = 1.0f / (4 * TS * TS); //for DCT @@ -2146,7 +2151,7 @@ float ImProcFunctions::MadMax(float * DataList, int & max, int datalen) float ImProcFunctions::Mad(float * DataList, const int datalen) { - if(datalen <= 1) { // Avoid possible buffer underrun + if (datalen <= 1) { // Avoid possible buffer underrun return 0; } @@ -2175,7 +2180,7 @@ float ImProcFunctions::Mad(float * DataList, const int datalen) float ImProcFunctions::MadRgb(float * DataList, const int datalen) { - if(datalen <= 1) { // Avoid possible buffer underrun + if (datalen <= 1) { // Avoid possible buffer underrun return 0; } @@ -2924,7 +2929,7 @@ SSEFUNCTION void ImProcFunctions::ShrinkAll_info(float ** WavCoeffs_a, float ** } } - const float reduc = (schoice == 2) ? static_cast( settings->nrhigh) : 1.f; + const float reduc = (schoice == 2) ? static_cast(settings->nrhigh) : 1.f; for (int dir = 1; dir < 4; ++dir) { float mada, madb; @@ -3024,7 +3029,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_infoGamCurve(const procparams::Dir } } -void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc) +void ImProcFunctions::calcautodn_info(float &chaut, float &delta, int Nb, int levaut, float maxmax, float lumema, float chromina, int mode, int lissage, float redyel, float skinc, float nsknc) { float reducdelta = 1.f; @@ -3179,7 +3184,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat float** bcalc; hei = provicalc->getHeight(); wid = provicalc->getWidth(); - TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprofi = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wpi[3][3] = { {static_cast(wprofi[0][0]), static_cast(wprofi[0][1]), static_cast(wprofi[0][2])}, @@ -3231,7 +3236,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat bool denoiseMethodRgb = (dnparams.dmethod == "RGB"); - const float gain = pow (2.0f, float(expcomp)); + const float gain = pow(2.0f, float(expcomp)); int tilesize; int overlap; @@ -3250,11 +3255,11 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat //always no Tiles int kall = 0; - Tile_calc (tilesize, overlap, kall, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + Tile_calc(tilesize, overlap, kall, imwidth, imheight, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params->icm.working); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working); const float wp[3][3] = { {static_cast(wprof[0][0]), static_cast(wprof[0][1]), static_cast(wprof[0][2])}, {static_cast(wprof[1][0]), static_cast(wprof[1][1]), static_cast(wprof[1][2])}, @@ -3298,19 +3303,19 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat } float realred, realblue; - float interm_med = static_cast( dnparams.chroma) / 10.0; + float interm_med = static_cast(dnparams.chroma) / 10.0; float intermred, intermblue; if (dnparams.redchro > 0.) { intermred = (dnparams.redchro / 10.); } else { - intermred = static_cast( dnparams.redchro) / 7.0; //increase slower than linear for more sensit + intermred = static_cast(dnparams.redchro) / 7.0; //increase slower than linear for more sensit } if (dnparams.bluechro > 0.) { intermblue = (dnparams.bluechro / 10.); } else { - intermblue = static_cast( dnparams.bluechro) / 7.0; //increase slower than linear for more sensit + intermblue = static_cast(dnparams.bluechro) / 7.0; //increase slower than linear for more sensit } realred = interm_med + intermred; @@ -3544,13 +3549,13 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise_info(Imagefloat * src, Imagefloat #pragma omp section #endif { - adecomp = new wavelet_decomposition (labdn->data + datalen, labdn->W, labdn->H, levwav, 1); + adecomp = new wavelet_decomposition(labdn->data + datalen, labdn->W, labdn->H, levwav, 1); } #ifdef _RT_NESTED_OPENMP #pragma omp section #endif { - bdecomp = new wavelet_decomposition (labdn->data + 2 * datalen, labdn->W, labdn->H, levwav, 1); + bdecomp = new wavelet_decomposition(labdn->data + 2 * datalen, labdn->W, labdn->H, levwav, 1); } } diff --git a/rtengine/amaze_demosaic_RT.cc b/rtengine/amaze_demosaic_RT.cc index 3cb0ee8de..30c673813 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); } @@ -223,13 +223,19 @@ SSEFUNCTION void RawImageSource::amaze_demosaic_RT(int winx, int winy, int winw, // fill inner part for (int rr = rrmin; rr < rrmax; rr++) { int row = rr + top; - - for (int cc = ccmin; cc < ccmax; cc += 4) { + int cc = ccmin; + for (; cc < ccmax - 3; cc += 4) { int indx1 = rr * ts + cc; vfloat tempv = LVFU(rawData[row][cc + left]) / c65535v; STVF(cfa[indx1], tempv ); STVF(rgbgreen[indx1], tempv ); } + for (; cc < ccmax; ++cc) { + int indx1 = rr * ts + cc; + float temp = rawData[row][cc + left] / 65535.f; + cfa[indx1] = temp; + rgbgreen[indx1] = temp; + } } //fill lower border diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 6b9da8492..e746aeb50 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -38,9 +38,9 @@ namespace // "ceil" rounding template -constexpr T skips (T a, T b) +constexpr T skips(T a, T b) { - return a / b + static_cast (a % b); + return a / b + static_cast(a % b); } } @@ -50,47 +50,47 @@ namespace rtengine extern const Settings* settings; -Crop::Crop (ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) - : PipetteBuffer (editDataProvider), origCrop (nullptr), laboCrop (nullptr), labnCrop (nullptr), reservCrop (nullptr), - cropImg (nullptr), cbuf_real (nullptr), cshmap (nullptr), shbuf_real (nullptr), transCrop (nullptr), cieCrop (nullptr), cbuffer (nullptr), shbuffer (nullptr), - updating (false), newUpdatePending (false), skip (10), - cropx (0), cropy (0), cropw (-1), croph (-1), - trafx (0), trafy (0), trafw (-1), trafh (-1), - rqcropx (0), rqcropy (0), rqcropw (-1), rqcroph (-1), - borderRequested (32), upperBorder (0), leftBorder (0), - cropAllocated (false), - cropImageListener (nullptr), parent (parent), isDetailWindow (isDetailWindow) +Crop::Crop(ImProcCoordinator* parent, EditDataProvider *editDataProvider, bool isDetailWindow) + : PipetteBuffer(editDataProvider), origCrop(nullptr), laboCrop(nullptr), labnCrop(nullptr), reservCrop(nullptr), + cropImg(nullptr), cbuf_real(nullptr), cshmap(nullptr), shbuf_real(nullptr), transCrop(nullptr), cieCrop(nullptr), cbuffer(nullptr), shbuffer(nullptr), + updating(false), newUpdatePending(false), skip(10), + cropx(0), cropy(0), cropw(-1), croph(-1), + trafx(0), trafy(0), trafw(-1), trafh(-1), + rqcropx(0), rqcropy(0), rqcropw(-1), rqcroph(-1), + borderRequested(32), upperBorder(0), leftBorder(0), + cropAllocated(false), + cropImageListener(nullptr), parent(parent), isDetailWindow(isDetailWindow) { - parent->crops.push_back (this); + parent->crops.push_back(this); } -Crop::~Crop () +Crop::~Crop() { - MyMutex::MyLock cropLock (cropMutex); + MyMutex::MyLock cropLock(cropMutex); - std::vector::iterator i = std::find (parent->crops.begin(), parent->crops.end(), this); + std::vector::iterator i = std::find(parent->crops.begin(), parent->crops.end(), this); - if (i != parent->crops.end ()) { - parent->crops.erase (i); + if (i != parent->crops.end()) { + parent->crops.erase(i); } - MyMutex::MyLock processingLock (parent->mProcessing); - freeAll (); -} - -void Crop::destroy () -{ - MyMutex::MyLock lock (cropMutex); - MyMutex::MyLock processingLock (parent->mProcessing); + MyMutex::MyLock processingLock(parent->mProcessing); freeAll(); } -void Crop::setListener (DetailedCropListener* il) +void Crop::destroy() +{ + MyMutex::MyLock lock(cropMutex); + MyMutex::MyLock processingLock(parent->mProcessing); + freeAll(); +} + +void Crop::setListener(DetailedCropListener* il) { // We can make reads in the IF, because the mProcessing lock is only needed for change if (cropImageListener != il) { - MyMutex::MyLock lock (cropMutex); + MyMutex::MyLock lock(cropMutex); cropImageListener = il; } } @@ -105,9 +105,9 @@ EditUniqueID Crop::getCurrEditID() * Delete the edit image buffer if there's no subscriber anymore. * If allocation has to be done, it is deferred to Crop::update */ -void Crop::setEditSubscriber (EditSubscriber* newSubscriber) +void Crop::setEditSubscriber(EditSubscriber* newSubscriber) { - MyMutex::MyLock lock (cropMutex); + MyMutex::MyLock lock(cropMutex); // At this point, editCrop.dataProvider->currSubscriber is the old subscriber EditSubscriber *oldSubscriber = PipetteBuffer::dataProvider ? PipetteBuffer::dataProvider->getCurrSubscriber() : nullptr; @@ -133,13 +133,13 @@ void Crop::setEditSubscriber (EditSubscriber* newSubscriber) bool Crop::hasListener() { - MyMutex::MyLock cropLock (cropMutex); + MyMutex::MyLock cropLock(cropMutex); return cropImageListener; } -void Crop::update (int todo) +void Crop::update(int todo) { - MyMutex::MyLock cropLock (cropMutex); + MyMutex::MyLock cropLock(cropMutex); ProcParams& params = parent->params; // CropGUIListener* cropgl; @@ -152,16 +152,16 @@ void Crop::update (int todo) bool overrideWindow = false; if (cropImageListener) { - overrideWindow = cropImageListener->getWindow (wx, wy, ww, wh, ws); + overrideWindow = cropImageListener->getWindow(wx, wy, ww, wh, ws); } // re-allocate sub-images and arrays if their dimensions changed bool needsinitupdate = false; if (!overrideWindow) { - needsinitupdate = setCropSizes (rqcropx, rqcropy, rqcropw, rqcroph, skip, true); + needsinitupdate = setCropSizes(rqcropx, rqcropy, rqcropw, rqcroph, skip, true); } else { - needsinitupdate = setCropSizes (wx, wy, ww, wh, ws, true); // this set skip=ws + needsinitupdate = setCropSizes(wx, wy, ww, wh, ws, true); // this set skip=ws } // it something has been reallocated, all processing steps have to be performed @@ -170,7 +170,7 @@ void Crop::update (int todo) } // Tells to the ImProcFunctions' tool what is the preview scale, which may lead to some simplifications - parent->ipf.setScale (skip); + parent->ipf.setScale(skip); Imagefloat* baseCrop = origCrop; int widIm = parent->fw;//full image @@ -179,12 +179,12 @@ void Crop::update (int todo) bool needstransform = parent->ipf.needsTransform(); if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { - MyMutex::MyLock lock (parent->minit); // Also used in improccoord + MyMutex::MyLock lock(parent->minit); // Also used in improccoord - int tr = getCoarseBitMask (params.coarse); + int tr = getCoarseBitMask(params.coarse); if (!needsinitupdate) { - setCropSizes (rqcropx, rqcropy, rqcropw, rqcroph, skip, true); + setCropSizes(rqcropx, rqcropy, rqcropw, rqcroph, skip, true); } // printf("x=%d y=%d crow=%d croh=%d skip=%d\n",rqcropx, rqcropy, rqcropw, rqcroph, skip); @@ -196,7 +196,7 @@ void Crop::update (int todo) float autoNR = (float) settings->nrauto;// float autoNRmax = (float) settings->nrautomax;// - params.dirpyrDenoise.getCurves (noiseLCurve, noiseCCurve); + params.dirpyrDenoise.getCurves(noiseLCurve, noiseCCurve); int tilesize; int overlap; @@ -214,7 +214,7 @@ void Crop::update (int todo) int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; int kall = 2; - parent->ipf.Tile_calc (tilesize, overlap, kall, widIm, heiIm, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + parent->ipf.Tile_calc(tilesize, overlap, kall, widIm, heiIm, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); kall = 0; float *min_b = new float [9]; @@ -236,20 +236,20 @@ void Crop::update (int todo) } if (settings->leveldnautsimpl == 1) { - if (params.dirpyrDenoise.Cmethod == "MAN" || params.dirpyrDenoise.Cmethod == "PON" ) { - PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); + if (params.dirpyrDenoise.Cmethod == "MAN" || params.dirpyrDenoise.Cmethod == "PON") { + PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip); + parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw); } } else { if (params.dirpyrDenoise.C2method == "MANU") { - PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); + PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip); + parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw); } } if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "PRE") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "PREV")) { - PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); + PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip); + parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw); if ((!isDetailWindow) && parent->adnListener && skip == 1 && params.dirpyrDenoise.enabled) { float lowdenoise = 1.f; @@ -267,15 +267,15 @@ void Crop::update (int todo) int poscenterY = 0; for (int cc = 0; cc < numtiles_W; cc++) { - if (abs (centerTile_X[cc] - CenterPreview_X) < minimuX) { - minimuX = abs (centerTile_X[cc] - CenterPreview_X); + if (abs(centerTile_X[cc] - CenterPreview_X) < minimuX) { + minimuX = abs(centerTile_X[cc] - CenterPreview_X); poscenterX = cc; } } for (int cc = 0; cc < numtiles_H; cc++) { - if (abs (centerTile_Y[cc] - CenterPreview_Y) < minimuY) { - minimuY = abs (centerTile_Y[cc] - CenterPreview_Y); + if (abs(centerTile_Y[cc] - CenterPreview_Y) < minimuY) { + minimuY = abs(centerTile_Y[cc] - CenterPreview_Y); poscenterY = cc; } } @@ -302,7 +302,7 @@ void Crop::update (int todo) float adjustr = 1.f; - if (params.icm.working == "ProPhoto") { + if (params.icm.working == "ProPhoto") { adjustr = 1.f; } else if (params.icm.working == "Adobe RGB") { adjustr = 1.f / 1.3f; @@ -319,7 +319,7 @@ void Crop::update (int todo) } if (parent->adnListener) { - parent->adnListener->noiseTilePrev (centerTile_X[poscenterX], centerTile_Y[poscenterY], CenterPreview_X, CenterPreview_Y, crW, trafw * skip); + parent->adnListener->noiseTilePrev(centerTile_X[poscenterX], centerTile_Y[poscenterY], CenterPreview_X, CenterPreview_Y, crW, trafw * skip); } // I have tried "blind" some solutions..to move review ...but GUI is not my truc ! @@ -333,17 +333,17 @@ void Crop::update (int todo) // we only need image reduced to 1/4 here int W = origCrop->getWidth(); int H = origCrop->getHeight(); - Imagefloat *provicalc = new Imagefloat ((W + 1) / 2, (H + 1) / 2); //for denoise curves + Imagefloat *provicalc = new Imagefloat((W + 1) / 2, (H + 1) / 2); //for denoise curves for (int ii = 0; ii < H; ii += 2) { for (int jj = 0; jj < W; jj += 2) { - provicalc->r (ii >> 1, jj >> 1) = origCrop->r (ii, jj); - provicalc->g (ii >> 1, jj >> 1) = origCrop->g (ii, jj); - provicalc->b (ii >> 1, jj >> 1) = origCrop->b (ii, jj); + provicalc->r(ii >> 1, jj >> 1) = origCrop->r(ii, jj); + provicalc->g(ii >> 1, jj >> 1) = origCrop->g(ii, jj); + provicalc->b(ii >> 1, jj >> 1) = origCrop->b(ii, jj); } } - parent->imgsrc->convertColorSpace (provicalc, params.icm, parent->currWB); //for denoise luminance curve + parent->imgsrc->convertColorSpace(provicalc, params.icm, parent->currWB); //for denoise luminance curve float maxr = 0.f; float maxb = 0.f; @@ -357,10 +357,10 @@ void Crop::update (int todo) maxblueaut = 0.f; minredaut = 0.f; minblueaut = 0.f; - LUTf gamcurve (65536, 0); + LUTf gamcurve(65536, 0); float gam, gamthresh, gamslope; - parent->ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); - parent->ipf.RGB_denoise_info (origCrop, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, parent->imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc, true); + parent->ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + parent->ipf.RGB_denoise_info(origCrop, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, parent->imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc, true); // printf("redy=%f skin=%f pcskin=%f\n",redyel, skinc,nsknc); // printf("DCROP skip=%d cha=%4.0f Nb=%d red=%4.0f bl=%4.0f redM=%4.0f bluM=%4.0f L=%4.0f sigL=%4.0f Ch=%4.0f Si=%4.0f\n",skip, chaut,Nb, redaut,blueaut, maxredaut, maxblueaut, lumema, sigma_L, chromina, sigma); float multip = 1.f; @@ -369,12 +369,12 @@ void Crop::update (int todo) multip = 2.f; //take into account gamma for TIF / JPG approximate value...not good for gamma=1 } - float maxmax = max (maxredaut, maxblueaut); + float maxmax = max(maxredaut, maxblueaut); float delta; int mode = 0; // float redyel, skinc, nsknc; int lissage = settings->leveldnliss; - parent->ipf.calcautodn_info (chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); + parent->ipf.calcautodn_info(chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); if (maxredaut > maxblueaut) { @@ -397,7 +397,7 @@ void Crop::update (int todo) params.dirpyrDenoise.chroma = chaut / (autoNR * multip * adjustr * lowdenoise); params.dirpyrDenoise.redchro = maxr; params.dirpyrDenoise.bluechro = maxb; - parent->adnListener->chromaChanged (params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro); + parent->adnListener->chromaChanged(params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro); delete provicalc; } @@ -433,16 +433,16 @@ void Crop::update (int todo) lowdenoise = 0.7f; } - LUTf gamcurve (65536, 0); + LUTf gamcurve(65536, 0); float gam, gamthresh, gamslope; - parent->ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + parent->ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); int Nb[9]; #ifdef _OPENMP #pragma omp parallel #endif { - Imagefloat *origCropPart = new Imagefloat (crW, crH);//allocate memory - Imagefloat *provicalc = new Imagefloat ((crW + 1) / 2, (crH + 1) / 2); //for denoise curves + Imagefloat *origCropPart = new Imagefloat(crW, crH); //allocate memory + Imagefloat *provicalc = new Imagefloat((crW + 1) / 2, (crH + 1) / 2); //for denoise curves int coordW[3];//coordonate of part of image to mesure noise int coordH[3]; @@ -460,24 +460,24 @@ void Crop::update (int todo) for (int wcr = 0; wcr <= 2; wcr++) { for (int hcr = 0; hcr <= 2; hcr++) { - PreviewProps ppP (coordW[wcr], coordH[hcr], crW, crH, 1); - parent->imgsrc->getImage (parent->currWB, tr, origCropPart, ppP, params.toneCurve, params.raw ); + PreviewProps ppP(coordW[wcr], coordH[hcr], crW, crH, 1); + parent->imgsrc->getImage(parent->currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); // we only need image reduced to 1/4 here for (int ii = 0; ii < crH; ii += 2) { for (int jj = 0; jj < crW; jj += 2) { - provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); - provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); - provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); + provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); + provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); + provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); } } - parent->imgsrc->convertColorSpace (provicalc, params.icm, parent->currWB); //for denoise luminance curve + parent->imgsrc->convertColorSpace(provicalc, params.icm, parent->currWB); //for denoise luminance curve float pondcorrec = 1.0f; float chaut = 0.f, redaut = 0.f, blueaut = 0.f, maxredaut = 0.f, maxblueaut = 0.f, minredaut = 0.f, minblueaut = 0.f, chromina = 0.f, sigma = 0.f, lumema = 0.f, sigma_L = 0.f, redyel = 0.f, skinc = 0.f, nsknc = 0.f; int nb = 0; - parent->ipf.RGB_denoise_info (origCropPart, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, parent->imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + parent->ipf.RGB_denoise_info(origCropPart, provicalc, parent->imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, parent->imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); //printf("DCROP skip=%d cha=%f red=%f bl=%f redM=%f bluM=%f chrom=%f sigm=%f lum=%f\n",skip, chaut,redaut,blueaut, maxredaut, maxblueaut, chromina, sigma, lumema); Nb[hcr * 3 + wcr] = nb; @@ -522,7 +522,7 @@ void Crop::update (int todo) float adjustr = 1.f; - if (params.icm.working == "ProPhoto") { + if (params.icm.working == "ProPhoto") { adjustr = 1.f; // } else if (params.icm.working == "Adobe RGB") { adjustr = 1.f / 1.3f; @@ -543,8 +543,8 @@ void Crop::update (int todo) int lissage = settings->leveldnliss; for (int k = 0; k < 9; k++) { - float maxmax = max (parent->denoiseInfoStore.max_r[k], parent->denoiseInfoStore.max_b[k]); - parent->ipf.calcautodn_info (parent->denoiseInfoStore.ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k]); + float maxmax = max(parent->denoiseInfoStore.max_r[k], parent->denoiseInfoStore.max_b[k]); + parent->ipf.calcautodn_info(parent->denoiseInfoStore.ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k]); // printf("ch_M=%f delta=%f\n",ch_M[k], delta[k]); } @@ -609,12 +609,12 @@ void Crop::update (int todo) parent->denoiseInfoStore.valid = true; if (parent->adnListener) { - parent->adnListener->chromaChanged (params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro); + parent->adnListener->chromaChanged(params.dirpyrDenoise.chroma, params.dirpyrDenoise.redchro, params.dirpyrDenoise.bluechro); } if (settings->verbose) { t2aue.set(); - printf ("Info denoise auto performed in %d usec:\n", t2aue.etime (t1aue)); + printf("Info denoise auto performed in %d usec:\n", t2aue.etime(t1aue)); } //end evaluate noise @@ -622,8 +622,8 @@ void Crop::update (int todo) // if(params.dirpyrDenoise.Cmethod=="AUT" || params.dirpyrDenoise.Cmethod=="PON") {//reinit origCrop after Auto if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { //reinit origCrop after Auto - PreviewProps pp (trafx, trafy, trafw * skip, trafh * skip, skip); - parent->imgsrc->getImage (parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw ); + PreviewProps pp(trafx, trafy, trafw * skip, trafh * skip, skip); + parent->imgsrc->getImage(parent->currWB, tr, origCrop, pp, params.toneCurve, params.raw); } DirPyrDenoiseParams denoiseParams = params.dirpyrDenoise; @@ -638,25 +638,25 @@ void Crop::update (int todo) noiseLCurve.Reset(); } - if ((noiseLCurve || noiseCCurve ) && skip == 1 && denoiseParams.enabled) { //only allocate memory if enabled and skip + if ((noiseLCurve || noiseCCurve) && skip == 1 && denoiseParams.enabled) { //only allocate memory if enabled and skip // we only need image reduced to 1/4 here int W = origCrop->getWidth(); int H = origCrop->getHeight(); - calclum = new Imagefloat ((W + 1) / 2, (H + 1) / 2); //for denoise curves + calclum = new Imagefloat((W + 1) / 2, (H + 1) / 2); //for denoise curves for (int ii = 0; ii < H; ii += 2) { for (int jj = 0; jj < W; jj += 2) { - calclum->r (ii >> 1, jj >> 1) = origCrop->r (ii, jj); - calclum->g (ii >> 1, jj >> 1) = origCrop->g (ii, jj); - calclum->b (ii >> 1, jj >> 1) = origCrop->b (ii, jj); + calclum->r(ii >> 1, jj >> 1) = origCrop->r(ii, jj); + calclum->g(ii >> 1, jj >> 1) = origCrop->g(ii, jj); + calclum->b(ii >> 1, jj >> 1) = origCrop->b(ii, jj); } } - parent->imgsrc->convertColorSpace (calclum, params.icm, parent->currWB); //for denoise luminance curve + parent->imgsrc->convertColorSpace(calclum, params.icm, parent->currWB); //for denoise luminance curve } if (skip != 1) if (parent->adnListener) { - parent->adnListener->noiseChanged (0.f, 0.f); + parent->adnListener->noiseChanged(0.f, 0.f); } if (todo & M_LINDENOISE) { @@ -664,26 +664,26 @@ void Crop::update (int todo) int kall = 0; float nresi, highresi; - parent->ipf.RGB_denoise (kall, origCrop, origCrop, calclum, parent->denoiseInfoStore.ch_M, parent->denoiseInfoStore.max_r, parent->denoiseInfoStore.max_b, parent->imgsrc->isRAW(), /*Roffset,*/ denoiseParams, parent->imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); + parent->ipf.RGB_denoise(kall, origCrop, origCrop, calclum, parent->denoiseInfoStore.ch_M, parent->denoiseInfoStore.max_r, parent->denoiseInfoStore.max_b, parent->imgsrc->isRAW(), /*Roffset,*/ denoiseParams, parent->imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); if (parent->adnListener) { - parent->adnListener->noiseChanged (nresi, highresi); + parent->adnListener->noiseChanged(nresi, highresi); } if (settings->leveldnautsimpl == 1) { if ((denoiseParams.Cmethod == "AUT" || denoiseParams.Cmethod == "PRE") && (parent->adnListener)) { // force display value of sliders - parent->adnListener->chromaChanged (denoiseParams.chroma, denoiseParams.redchro, denoiseParams.bluechro); + parent->adnListener->chromaChanged(denoiseParams.chroma, denoiseParams.redchro, denoiseParams.bluechro); } } else { if ((denoiseParams.C2method == "AUTO" || denoiseParams.C2method == "PREV") && (parent->adnListener)) { // force display value of sliders - parent->adnListener->chromaChanged (denoiseParams.chroma, denoiseParams.redchro, denoiseParams.bluechro); + parent->adnListener->chromaChanged(denoiseParams.chroma, denoiseParams.redchro, denoiseParams.bluechro); } } } } - parent->imgsrc->convertColorSpace (origCrop, params.icm, parent->currWB); + parent->imgsrc->convertColorSpace(origCrop, params.icm, parent->currWB); delete [] min_r; delete [] min_b; @@ -698,9 +698,10 @@ void Crop::update (int todo) } // has to be called after setCropSizes! Tools prior to this point can't handle the Edit mechanism, but that shouldn't be a problem. - createBuffer (cropw, croph); + createBuffer(cropw, croph); std::unique_ptr fattalCrop; + if ((todo & M_HDR) && params.fattal.enabled) { Imagefloat *f = origCrop; int fw = skips(parent->fw, skip); @@ -710,6 +711,7 @@ void Crop::update (int todo) if (trafx || trafy || trafw != fw || trafh != fh) { need_cropping = true; + // fattal needs to work on the full image. So here we get the full // image from imgsrc, and replace the denoised crop in case if (!params.dirpyrDenoise.enabled && skip == 1 && parent->fattal_11_dcrop_cache) { @@ -718,7 +720,7 @@ void Crop::update (int todo) } else { f = new Imagefloat(fw, fh); fattalCrop.reset(f); - PreviewProps pp (0, 0, parent->fw, parent->fh, skip); + PreviewProps pp(0, 0, parent->fw, parent->fh, skip); int tr = getCoarseBitMask(params.coarse); parent->imgsrc->getImage(parent->currWB, tr, f, pp, params.toneCurve, params.raw); parent->imgsrc->convertColorSpace(f, params.icm, parent->currWB); @@ -730,8 +732,10 @@ void Crop::update (int todo) #ifdef _OPENMP #pragma omp parallel for #endif + for (int y = 0; y < baseCrop->getHeight(); ++y) { int dy = oy + y; + for (int x = 0; x < baseCrop->getWidth(); ++x) { int dx = ox + x; f->r(dy, dx) = baseCrop->r(y, x); @@ -745,6 +749,7 @@ void Crop::update (int todo) } } } + if (need_fattal) { parent->ipf.ToneMapFattal02(f); } @@ -758,8 +763,10 @@ void Crop::update (int todo) #ifdef _OPENMP #pragma omp parallel for #endif + for (int y = 0; y < trafh; ++y) { int cy = y + oy; + for (int x = 0; x < trafw; ++x) { int cx = x + ox; c->r(y, x) = f->r(cy, cx); @@ -767,24 +774,25 @@ void Crop::update (int todo) c->b(y, x) = f->b(cy, cx); } } + baseCrop = c; } else { baseCrop = f; } } - + // transform if (needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) { if (!transCrop) { - transCrop = new Imagefloat (cropw, croph); + transCrop = new Imagefloat(cropw, croph); } if (needstransform) - parent->ipf.transform (baseCrop, transCrop, cropx / skip, cropy / skip, trafx / skip, trafy / skip, skips (parent->fw, skip), skips (parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), - parent->imgsrc->getMetaData(), - parent->imgsrc->getRotateDegree(), false); + parent->ipf.transform(baseCrop, transCrop, cropx / skip, cropy / skip, trafx / skip, trafy / skip, skips(parent->fw, skip), skips(parent->fh, skip), parent->getFullWidth(), parent->getFullHeight(), + parent->imgsrc->getMetaData(), + parent->imgsrc->getRotateDegree(), false); else { - baseCrop->copyData (transCrop); + baseCrop->copyData(transCrop); } if (transCrop) { @@ -802,16 +810,16 @@ void Crop::update (int todo) const int W = baseCrop->getWidth(); const int H = baseCrop->getHeight(); - LabImage labcbdl (W, H); - parent->ipf.rgb2lab (*baseCrop, labcbdl, params.icm.working); - parent->ipf.dirpyrequalizer (&labcbdl, skip); - parent->ipf.lab2rgb (labcbdl, *baseCrop, params.icm.working); + LabImage labcbdl(W, H); + parent->ipf.rgb2lab(*baseCrop, labcbdl, params.icm.working); + parent->ipf.dirpyrequalizer(&labcbdl, skip); + parent->ipf.lab2rgb(labcbdl, *baseCrop, params.icm.working); } // blurmap for shadow & highlights if ((todo & M_BLURMAP) && params.sh.enabled) { - double radius = sqrt (double (skips (parent->fw, skip) * skips (parent->fw, skip) + skips (parent->fh, skip) * skips (parent->fh, skip))) / 2.0; + double radius = sqrt(double (skips(parent->fw, skip) * skips(parent->fw, skip) + skips(parent->fh, skip) * skips(parent->fh, skip))) / 2.0; double shradius = params.sh.radius; if (!params.sh.hq) { @@ -819,13 +827,13 @@ void Crop::update (int todo) } if (!cshmap) { - cshmap = new SHMap (cropw, croph, true); + cshmap = new SHMap(cropw, croph, true); } - cshmap->update (baseCrop, shradius, parent->ipf.lumimul, params.sh.hq, skip); + cshmap->update(baseCrop, shradius, parent->ipf.lumimul, params.sh.hq, skip); if (parent->shmap->min_f < 65535.f) { // don't call forceStat with wrong values - cshmap->forceStat (parent->shmap->max_f, parent->shmap->min_f, parent->shmap->avg); + cshmap->forceStat(parent->shmap->max_f, parent->shmap->min_f, parent->shmap->avg); } } @@ -846,13 +854,13 @@ void Crop::update (int todo) if (todo & M_RGBCURVE) { double rrm, ggm, bbm; DCPProfile::ApplyState as; - DCPProfile *dcpProf = parent->imgsrc->getDCP (params.icm, as); + DCPProfile *dcpProf = parent->imgsrc->getDCP(params.icm, as); LUTu histToneCurve; - parent->ipf.rgbProc (baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve, cshmap, - params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, parent->colourToningSatLimit, parent->colourToningSatLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->opautili, parent->clToningcurve, parent->cl2Toningcurve, - parent->customToneCurve1, parent->customToneCurve2, parent->beforeToneCurveBW, parent->afterToneCurveBW, rrm, ggm, bbm, - parent->bwAutoR, parent->bwAutoG, parent->bwAutoB, dcpProf, as, histToneCurve); + parent->ipf.rgbProc(baseCrop, laboCrop, this, parent->hltonecurve, parent->shtonecurve, parent->tonecurve, cshmap, + params.toneCurve.saturation, parent->rCurve, parent->gCurve, parent->bCurve, parent->colourToningSatLimit, parent->colourToningSatLimitOpacity, parent->ctColorCurve, parent->ctOpacityCurve, parent->opautili, parent->clToningcurve, parent->cl2Toningcurve, + parent->customToneCurve1, parent->customToneCurve2, parent->beforeToneCurveBW, parent->afterToneCurveBW, rrm, ggm, bbm, + parent->bwAutoR, parent->bwAutoG, parent->bwAutoB, dcpProf, as, histToneCurve); } /*xref=000;yref=000; @@ -876,8 +884,8 @@ void Crop::update (int todo) if (todo & (M_LUMINANCE + M_COLOR)) { // //if (tutu) { // //I made a little change here. Rather than have luminanceCurve (and others) use in/out lab images, we can do more if we copy right here. - labnCrop->CopyFrom (laboCrop); - reservCrop->CopyFrom (laboCrop); + labnCrop->CopyFrom(laboCrop); + reservCrop->CopyFrom(laboCrop); //parent->ipf.luminanceCurve (labnCrop, labnCrop, parent->lumacurve); @@ -889,16 +897,16 @@ void Crop::update (int todo) bool cclutili = parent->cclutili; bool locallutili = parent->locallutili; - LUTf lllocalcurve2 (65536, 0); + LUTf lllocalcurve2(65536, 0); bool localcutili = parent->locallutili; - LUTf cclocalcurve2 (65536, 0); + LUTf cclocalcurve2(65536, 0); bool localskutili = parent->localskutili; - LUTf sklocalcurve2 (65536, 0); + LUTf sklocalcurve2(65536, 0); bool localexutili = parent->localexutili; - LUTf exlocalcurve2 (65536, 0); - LUTf hltonecurveloc2 (32768, 0);//65536 - LUTf shtonecurveloc2 (32768, 0); - LUTf tonecurveloc2 (32768, 0); + LUTf exlocalcurve2(65536, 0); + LUTf hltonecurveloc2(32768, 0); //65536 + LUTf shtonecurveloc2(32768, 0); + LUTf tonecurveloc2(32768, 0); bool LHutili = parent->LHutili; bool HHutili = parent->HHutili; @@ -915,17 +923,17 @@ void Crop::update (int todo) // bool tyty = false; int maxspot = settings->nspot + 1; - if (needslocal ) { + if (needslocal) { // if (tyty ) { - std::string mdfive = getMD5 (parent->imgsrc->getFileName()); + std::string mdfive = getMD5(parent->imgsrc->getFileName()); Glib::ustring pop = options.cacheBaseDir + "/mip/"; Glib::ustring datalab; if (options.mip == MI_opt) { - datalab = pop + Glib::path_get_basename (parent->imgsrc->getFileName () + "." + mdfive + ".mip"); + datalab = pop + Glib::path_get_basename(parent->imgsrc->getFileName() + "." + mdfive + ".mip"); } if (options.mip == MI_prev) { @@ -933,7 +941,7 @@ void Crop::update (int todo) } - ifstream fich (datalab, ios::in); + ifstream fich(datalab, ios::in); if (fich && parent->versionmip != 0) {//to avoid crash in some cases // int **dataspotd; @@ -977,7 +985,7 @@ void Crop::update (int todo) params.locallab.strength = parent->strengths[sp]; params.locallab.sensibn = parent->sensibns[sp]; - if ( parent->inversrads[sp] == 0) { + if (parent->inversrads[sp] == 0) { params.locallab.inversrad = false; } else { params.locallab.inversrad = true; @@ -1138,11 +1146,12 @@ void Crop::update (int todo) params.locallab.sensiexclu = parent->sensiexclus[sp]; params.locallab.struc = parent->strucs[sp]; + params.locallab.warm = parent->warms[sp]; std::vector cretie; for (int j = 0; j < parent->sizeretics[sp]; j++) { - cretie.push_back ((double) (parent->reticurvs[sp * 500 + j]) / 1000.); + cretie.push_back((double)(parent->reticurvs[sp * 500 + j]) / 1000.); } params.locallab.localTgaincurve.clear(); @@ -1151,7 +1160,7 @@ void Crop::update (int todo) std::vector llc; for (int j = 0; j < parent->sizellcs[sp]; j++) { - llc.push_back ((double) (parent->llcurvs[sp * 500 + j]) / 1000.); + llc.push_back((double)(parent->llcurvs[sp * 500 + j]) / 1000.); } params.locallab.llcurve.clear(); @@ -1160,7 +1169,7 @@ void Crop::update (int todo) std::vector ccc; for (int j = 0; j < parent->sizecccs[sp]; j++) { - ccc.push_back ((double) (parent->cccurvs[sp * 500 + j]) / 1000.); + ccc.push_back((double)(parent->cccurvs[sp * 500 + j]) / 1000.); } params.locallab.cccurve.clear(); @@ -1169,7 +1178,7 @@ void Crop::update (int todo) std::vector lhc; for (int j = 0; j < parent->sizelhcs[sp]; j++) { - lhc.push_back ((double) (parent->lhcurvs[sp * 500 + j]) / 1000.); + lhc.push_back((double)(parent->lhcurvs[sp * 500 + j]) / 1000.); } params.locallab.LHcurve.clear(); @@ -1178,7 +1187,7 @@ void Crop::update (int todo) std::vector hhc; for (int j = 0; j < parent->sizehhcs[sp]; j++) { - hhc.push_back ((double) (parent->hhcurvs[sp * 500 + j]) / 1000.); + hhc.push_back((double)(parent->hhcurvs[sp * 500 + j]) / 1000.); } params.locallab.HHcurve.clear(); @@ -1187,32 +1196,32 @@ void Crop::update (int todo) std::vector skc; for (int j = 0; j < parent->sizeskintonecurves[sp]; j++) { - skc.push_back ((double) (parent->skintonescurves[sp * 500 + j]) / 1000.); + skc.push_back((double)(parent->skintonescurves[sp * 500 + j]) / 1000.); } params.locallab.skintonescurve.clear(); params.locallab.skintonescurve = skc; - params.locallab.psthreshold.setValues (parent->psthresholds[sp * 500], parent->psthresholds[sp * 500 + 1]); + params.locallab.psthreshold.setValues(parent->psthresholds[sp * 500], parent->psthresholds[sp * 500 + 1]); std::vector sex; for (int j = 0; j < parent->sizeexcurves[sp]; j++) { - sex.push_back ((double) (parent->excurves[sp * 500 + j]) / 1000.); + sex.push_back((double)(parent->excurves[sp * 500 + j]) / 1000.); } params.locallab.excurve.clear(); params.locallab.excurve = sex; - params.locallab.getCurves (locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); + params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); locallutili = false; - CurveFactory::curveLocal (locallutili, params.locallab.llcurve, lllocalcurve2, sca); + CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve2, sca); localcutili = false; - CurveFactory::curveCCLocal (localcutili, params.locallab.cccurve, cclocalcurve2, sca); + CurveFactory::curveCCLocal(localcutili, params.locallab.cccurve, cclocalcurve2, sca); //localskutili = false; - CurveFactory::curveskLocal (localskutili, params.locallab.skintonescurve, sklocalcurve2, sca); - CurveFactory::curveexLocal (localexutili, params.locallab.excurve, exlocalcurve2, sca); + CurveFactory::curveskLocal(localskutili, params.locallab.skintonescurve, sklocalcurve2, sca); + CurveFactory::curveexLocal(localexutili, params.locallab.excurve, exlocalcurve2, sca); double br = 0.; @@ -1223,9 +1232,9 @@ void Crop::update (int todo) double hlcomprthresh = params.locallab.hlcomprthresh; double shcompr = params.locallab.shcompr; - CurveFactory::complexCurvelocal (ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, - parent->lhist16, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, - sca); + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, + parent->lhist16, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, + sca); params.locallab.hueref = (parent->huerefs[sp]) / 100.f; params.locallab.chromaref = parent->chromarefs[sp]; @@ -1233,15 +1242,15 @@ void Crop::update (int todo) 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, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); + 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, LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve2.clear(); cclocalcurve2.clear(); sklocalcurve2.clear(); exlocalcurve2.clear(); if (skip <= 2) { - usleep (settings->cropsleep); //wait to avoid crash when crop 100% and move window + usleep(settings->cropsleep); //wait to avoid crash when crop 100% and move window } } } @@ -1303,7 +1312,7 @@ void Crop::update (int todo) parent->strengths[sp] = params.locallab.strength; parent->sensibns[sp] = params.locallab.sensibn; - if ( parent->inversrads[0] == 0) { + if (parent->inversrads[0] == 0) { params.locallab.inversrad = false; parent->inversrads[sp] = 0; } else { @@ -1516,11 +1525,12 @@ void Crop::update (int todo) parent->sensiexclus[sp] = params.locallab.sensiexclu = parent->sensiexclus[0]; parent->strucs[sp] = params.locallab.struc = parent->strucs[0]; + parent->warms[sp] = params.locallab.warm = parent->warms[0]; std::vector ccret; for (int j = 0; j < parent->sizeretics[sp]; j++) { - ccret.push_back ((double) (parent->reticurvs[0 * 500 + j]) / 1000.); + ccret.push_back((double)(parent->reticurvs[0 * 500 + j]) / 1000.); parent->reticurvs[sp * 500 + j] = parent->reticurvs[0 * 500 + j]; } @@ -1530,7 +1540,7 @@ void Crop::update (int todo) std::vector llcL; for (int j = 0; j < parent->sizellcs[sp]; j++) { - llcL.push_back ((double) (parent->llcurvs[0 * 500 + j]) / 1000.); + llcL.push_back((double)(parent->llcurvs[0 * 500 + j]) / 1000.); parent->llcurvs[sp * 500 + j] = parent->llcurvs[0 * 500 + j] ; } @@ -1540,7 +1550,7 @@ void Crop::update (int todo) std::vector cccL; for (int j = 0; j < parent->sizecccs[sp]; j++) { - cccL.push_back ((double) (parent->cccurvs[0 * 500 + j]) / 1000.); + cccL.push_back((double)(parent->cccurvs[0 * 500 + j]) / 1000.); parent->cccurvs[sp * 500 + j] = parent->cccurvs[0 * 500 + j] ; } @@ -1550,7 +1560,7 @@ void Crop::update (int todo) std::vector lhcL; for (int j = 0; j < parent->sizelhcs[sp]; j++) { - lhcL.push_back ((double) (parent->lhcurvs[0 * 500 + j]) / 1000.); + lhcL.push_back((double)(parent->lhcurvs[0 * 500 + j]) / 1000.); parent->lhcurvs[sp * 500 + j] = parent->lhcurvs[0 * 500 + j] ; } @@ -1560,7 +1570,7 @@ void Crop::update (int todo) std::vector hhcL; for (int j = 0; j < parent->sizehhcs[sp]; j++) { - hhcL.push_back ((double) (parent->hhcurvs[0 * 500 + j]) / 1000.); + hhcL.push_back((double)(parent->hhcurvs[0 * 500 + j]) / 1000.); parent->hhcurvs[sp * 500 + j] = parent->hhcurvs[0 * 500 + j] ; } @@ -1570,7 +1580,7 @@ void Crop::update (int todo) std::vector skcL; for (int j = 0; j < parent->sizeskintonecurves[sp]; j++) { - skcL.push_back ((double) (parent->skintonescurves[0 * 500 + j]) / 1000.); + skcL.push_back((double)(parent->skintonescurves[0 * 500 + j]) / 1000.); parent->skintonescurves[sp * 500 + j] = parent->skintonescurves[0 * 500 + j] ; } @@ -1580,27 +1590,27 @@ void Crop::update (int todo) parent->skintonescurves[sp * 500] = parent->skintonescurves[0 * 500]; parent->skintonescurves[sp * 500 + 1] = parent->skintonescurves[0 * 500 + 1]; - params.locallab.psthreshold.setValues (parent->psthresholds[0 * 500], parent->psthresholds[0 * 500 + 1]); + params.locallab.psthreshold.setValues(parent->psthresholds[0 * 500], parent->psthresholds[0 * 500 + 1]); std::vector sexL; for (int j = 0; j < parent->sizeexcurves[sp]; j++) { - sexL.push_back ((double) (parent->excurves[0 * 500 + j]) / 1000.); + sexL.push_back((double)(parent->excurves[0 * 500 + j]) / 1000.); parent->excurves[sp * 500 + j] = parent->excurves[0 * 500 + j] ; } params.locallab.excurve.clear(); params.locallab.excurve = sexL; - params.locallab.getCurves (locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); + params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); locallutili = false; localcutili = false; - CurveFactory::curveLocal (locallutili, params.locallab.llcurve, lllocalcurve2, sca); - CurveFactory::curveCCLocal (localcutili, params.locallab.cccurve, cclocalcurve2, sca); - CurveFactory::curveskLocal (localskutili, params.locallab.skintonescurve, sklocalcurve2, sca); - CurveFactory::curveexLocal (localexutili, params.locallab.excurve, exlocalcurve2, sca); + CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve2, sca); + CurveFactory::curveCCLocal(localcutili, params.locallab.cccurve, cclocalcurve2, sca); + CurveFactory::curveskLocal(localskutili, params.locallab.skintonescurve, sklocalcurve2, sca); + CurveFactory::curveexLocal(localexutili, params.locallab.excurve, exlocalcurve2, sca); double br = 0.; double contr = 0.; @@ -1610,16 +1620,16 @@ void Crop::update (int todo) double hlcomprthresh = params.locallab.hlcomprthresh; double shcompr = params.locallab.shcompr; - CurveFactory::complexCurvelocal (ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, - parent->lhist16, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, - sca); + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, + parent->lhist16, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, + sca); params.locallab.hueref = (parent->huerefs[sp]) / 100.f; 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, - LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); + 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, + LHutili, HHutili, cclocalcurve2, localskutili, sklocalcurve2, localexutili, exlocalcurve2, hltonecurveloc2, shtonecurveloc2, tonecurveloc2, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve2.clear(); cclocalcurve2.clear(); @@ -1632,29 +1642,29 @@ void Crop::update (int todo) // int moderetinex; // parent->ipf.MSR(labnCrop, labnCrop->W, labnCrop->H, 1); - parent->ipf.chromiLuminanceCurve (this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); - parent->ipf.vibrance (labnCrop); + parent->ipf.chromiLuminanceCurve(this, 1, labnCrop, labnCrop, parent->chroma_acurve, parent->chroma_bcurve, parent->satcurve, parent->lhskcurve, parent->clcurve, parent->lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); + parent->ipf.vibrance(labnCrop); - if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { - parent->ipf.EPDToneMap (labnCrop, 5, skip); + if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + parent->ipf.EPDToneMap(labnCrop, 5, skip); } //parent->ipf.EPDToneMap(labnCrop, 5, 1); //Go with much fewer than normal iterates for fast redisplay. // for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled if (skip == 1) { if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - parent->ipf.impulsedenoise (labnCrop); + parent->ipf.impulsedenoise(labnCrop); } - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled) ) { - parent->ipf.defringe (labnCrop); + if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + parent->ipf.defringe(labnCrop); } - parent->ipf.MLsharpen (labnCrop); + parent->ipf.MLsharpen(labnCrop); if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - parent->ipf.MLmicrocontrast (labnCrop); - parent->ipf.sharpening (labnCrop, (float**)cbuffer, params.sharpening); + parent->ipf.MLmicrocontrast(labnCrop); + parent->ipf.sharpening(labnCrop, (float**)cbuffer, params.sharpening); } } @@ -1663,13 +1673,13 @@ void Crop::update (int todo) if (params.dirpyrequalizer.cbdlMethod == "aft") { if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled))) { - parent->ipf.dirpyrequalizer (labnCrop, skip); + parent->ipf.dirpyrequalizer(labnCrop, skip); // parent->ipf.Lanczoslab (labnCrop,labnCrop , 1.f/skip); } } int kall = 0; - int minwin = min (labnCrop->W, labnCrop->H); + int minwin = min(labnCrop->W, labnCrop->H); int maxlevelcrop = 10; // if(cp.mul[9]!=0)maxlevelcrop=10; @@ -1709,10 +1719,10 @@ void Crop::update (int todo) int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; - parent->ipf.Tile_calc (tilesize, overlap, kall, labnCrop->W, labnCrop->H, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + parent->ipf.Tile_calc(tilesize, overlap, kall, labnCrop->W, labnCrop->H, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); //now we have tile dimensions, overlaps //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - int minsizetile = min (tilewidth, tileheight); + int minsizetile = min(tilewidth, tileheight); int maxlev2 = 10; if (minsizetile < 1024 && maxlevelcrop == 10) { @@ -1731,10 +1741,10 @@ void Crop::update (int todo) maxlev2 = 6; } - int maxL = min (maxlev2, maxlevelcrop); + int maxL = min(maxlev2, maxlevelcrop); if (parent->awavListener) { - parent->awavListener->wavChanged (float (maxL)); + parent->awavListener->wavChanged(float (maxL)); } if ((params.wavelet.enabled)) { @@ -1747,28 +1757,28 @@ void Crop::update (int todo) LUTf wavclCurve; LUTu dummy; - params.wavelet.getCurves (wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); + params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); - parent->ipf.ip_wavelet (labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); + parent->ipf.ip_wavelet(labnCrop, labnCrop, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, parent->wavclCurve, skip); } // } // } if (params.colorappearance.enabled) { - float fnum = parent->imgsrc->getMetaData()->getFNumber (); // F number - float fiso = parent->imgsrc->getMetaData()->getISOSpeed () ; // ISO - float fspeed = parent->imgsrc->getMetaData()->getShutterSpeed () ; // Speed - double fcomp = parent->imgsrc->getMetaData()->getExpComp (); // Compensation +/- + float fnum = parent->imgsrc->getMetaData()->getFNumber(); // F number + float fiso = parent->imgsrc->getMetaData()->getISOSpeed() ; // ISO + float fspeed = parent->imgsrc->getMetaData()->getShutterSpeed() ; // Speed + double fcomp = parent->imgsrc->getMetaData()->getExpComp(); // Compensation +/- double adap; // Scene's luminosity adaptation factor if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) { //if no exif data or wrong adap = 2000.; } else { - double E_V = fcomp + log2 (double ((fnum * fnum) / fspeed / (fiso / 100.f))); + double E_V = fcomp + log2(double ((fnum * fnum) / fspeed / (fiso / 100.f))); E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV - E_V += log2 (params.raw.expos); // exposure raw white point ; log2 ==> linear to EV - adap = pow (2., E_V - 3.); // cd / m2 + E_V += log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV + adap = pow(2., E_V - 3.); // cd / m2 // end calculation adaptation scene luminosity } @@ -1779,18 +1789,18 @@ void Crop::update (int todo) } if (!cieCrop) { - cieCrop = new CieImage (cropw, croph); + cieCrop = new CieImage(cropw, croph); } if (settings->ciecamfloat) { float d, dj, yb; // not used after this block - parent->ipf.ciecam_02float (cieCrop, float (adap), 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, - dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1); + parent->ipf.ciecam_02float(cieCrop, float (adap), 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, + dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, d, dj, yb, 1); } else { double dd, dj; // not used after this block - parent->ipf.ciecam_02 (cieCrop, adap, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, - dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, dd, dj, 1); + parent->ipf.ciecam_02(cieCrop, adap, 1, 2, labnCrop, ¶ms, parent->customColCurve1, parent->customColCurve2, parent->customColCurve3, + dummy, dummy, parent->CAMBrightCurveJ, parent->CAMBrightCurveQ, parent->CAMMean, 5, skip, execsharp, dd, dj, 1); } } else { // CIECAM is disbaled, we free up its image buffer to save some space @@ -1806,13 +1816,13 @@ void Crop::update (int todo) PipetteBuffer::setReady(); // Computing the preview image, i.e. converting from lab->Monitor color space (soft-proofing disabled) or lab->Output profile->Monitor color space (soft-proofing enabled) - parent->ipf.lab2monitorRgb (labnCrop, cropImg); + parent->ipf.lab2monitorRgb(labnCrop, cropImg); if (cropImageListener) { // Computing the internal image for analysis, i.e. conversion from lab->Output profile (rtSettings.HistogramWorking disabled) or lab->WCS (rtSettings.HistogramWorking enabled) // internal image in output color space for analysis - Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0, 0, cropw, croph, params.icm); + Image8 *cropImgtrue = parent->ipf.lab2rgb(labnCrop, 0, 0, cropw, croph, params.icm); int finalW = rqcropw; @@ -1826,30 +1836,30 @@ void Crop::update (int todo) finalH = cropImg->getHeight() - upperBorder; } - Image8* final = new Image8 (finalW, finalH); - Image8* finaltrue = new Image8 (finalW, finalH); + Image8* final = new Image8(finalW, finalH); + Image8* finaltrue = new Image8(finalW, finalH); for (int i = 0; i < finalH; i++) { - memcpy (final->data + 3 * i * finalW, cropImg->data + 3 * (i + upperBorder)*cropw + 3 * leftBorder, 3 * finalW); - memcpy (finaltrue->data + 3 * i * finalW, cropImgtrue->data + 3 * (i + upperBorder)*cropw + 3 * leftBorder, 3 * finalW); + memcpy(final->data + 3 * i * finalW, cropImg->data + 3 * (i + upperBorder)*cropw + 3 * leftBorder, 3 * finalW); + memcpy(finaltrue->data + 3 * i * finalW, cropImgtrue->data + 3 * (i + upperBorder)*cropw + 3 * leftBorder, 3 * finalW); } - cropImageListener->setDetailedCrop (final, finaltrue, params.icm, params.crop, rqcropx, rqcropy, rqcropw, rqcroph, skip); + cropImageListener->setDetailedCrop(final, finaltrue, params.icm, params.crop, rqcropx, rqcropy, rqcropw, rqcroph, skip); delete final; delete finaltrue; delete cropImgtrue; } } -void Crop::freeAll () +void Crop::freeAll() { if (settings->verbose) { - printf ("freeallcrop starts %d\n", (int)cropAllocated); + printf("freeallcrop starts %d\n", (int)cropAllocated); } if (cropAllocated) { - if (origCrop ) { + if (origCrop) { delete origCrop; origCrop = nullptr; } @@ -1859,18 +1869,18 @@ void Crop::freeAll () transCrop = nullptr; } - if (laboCrop ) { + if (laboCrop) { delete laboCrop; laboCrop = nullptr; } - if (labnCrop ) { + if (labnCrop) { delete labnCrop; labnCrop = nullptr; } - if (reservCrop ) { + if (reservCrop) { delete reservCrop; reservCrop = nullptr; } @@ -1880,12 +1890,12 @@ void Crop::freeAll () lablocCrop = NULL; } */ - if (cropImg ) { + if (cropImg) { delete cropImg; cropImg = nullptr; } - if (cieCrop ) { + if (cieCrop) { delete cieCrop; cieCrop = nullptr; } @@ -1895,17 +1905,17 @@ void Crop::freeAll () cbuf_real = nullptr; } - if (cbuffer ) { + if (cbuffer) { delete [] cbuffer; cbuffer = nullptr; } - if (shbuffer ) { + if (shbuffer) { delete [] shbuffer; shbuffer = nullptr; } - if (cshmap ) { + if (cshmap) { delete cshmap; cshmap = nullptr; } @@ -1920,7 +1930,7 @@ void Crop::freeAll () namespace { -bool check_need_larger_crop_for_lcp_distortion (int fw, int fh, int x, int y, int w, int h, const ProcParams ¶ms) +bool check_need_larger_crop_for_lcp_distortion(int fw, int fh, int x, int y, int w, int h, const ProcParams ¶ms) { if (x == 0 && y == 0 && w == fw && h == fh) { return false; @@ -1935,15 +1945,15 @@ bool check_need_larger_crop_for_lcp_distortion (int fw, int fh, int x, int y, in * If the scale changes, this method will free all buffers and reallocate ones of the new size. * It will then tell to the SizeListener that size has changed (sizeChanged) */ -bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool internal) +bool Crop::setCropSizes(int rcx, int rcy, int rcw, int rch, int skip, bool internal) { if (settings->verbose) { - printf ("setcropsizes before lock\n"); + printf("setcropsizes before lock\n"); } if (!internal) { - cropMutex.lock (); + cropMutex.lock(); } bool changed = false; @@ -1954,12 +1964,12 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte rqcroph = rch; // store and set requested crop size - int rqx1 = LIM (rqcropx, 0, parent->fullw - 1); - int rqy1 = LIM (rqcropy, 0, parent->fullh - 1); + int rqx1 = LIM(rqcropx, 0, parent->fullw - 1); + int rqy1 = LIM(rqcropy, 0, parent->fullh - 1); int rqx2 = rqx1 + rqcropw - 1; int rqy2 = rqy1 + rqcroph - 1; - rqx2 = LIM (rqx2, 0, parent->fullw - 1); - rqy2 = LIM (rqy2, 0, parent->fullh - 1); + rqx2 = LIM(rqx2, 0, parent->fullw - 1); + rqy2 = LIM(rqy2, 0, parent->fullh - 1); this->skip = skip; @@ -1969,10 +1979,10 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte int bx2 = rqx2 + skip * borderRequested; int by2 = rqy2 + skip * borderRequested; // clip it to fit into image area - bx1 = LIM (bx1, 0, parent->fullw - 1); - by1 = LIM (by1, 0, parent->fullh - 1); - bx2 = LIM (bx2, 0, parent->fullw - 1); - by2 = LIM (by2, 0, parent->fullh - 1); + bx1 = LIM(bx1, 0, parent->fullw - 1); + by1 = LIM(by1, 0, parent->fullh - 1); + bx2 = LIM(bx2, 0, parent->fullw - 1); + by2 = LIM(by2, 0, parent->fullh - 1); int bw = bx2 - bx1 + 1; int bh = by2 - by1 + 1; @@ -1985,9 +1995,9 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte ProcParams& params = parent->params; - parent->ipf.transCoord (parent->fw, parent->fh, bx1, by1, bw, bh, orx, ory, orw, orh); + parent->ipf.transCoord(parent->fw, parent->fh, bx1, by1, bw, bh, orx, ory, orw, orh); - if (check_need_larger_crop_for_lcp_distortion (parent->fw, parent->fh, orx, ory, orw, orh, parent->params)) { + if (check_need_larger_crop_for_lcp_distortion(parent->fw, parent->fh, orx, ory, orw, orh, parent->params)) { // TODO - this is an estimate of the max distortion relative to the image size. ATM it is hardcoded to be 15%, which seems enough. If not, need to revise int dW = int (double (parent->fw) * 0.15 / (2 * skip)); int dH = int (double (parent->fh) * 0.15 / (2 * skip)); @@ -2016,34 +2026,34 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte y2 = parent->fh; } - orx = max (x1, 0); - ory = max (y1, 0); - orw = min (x2 - x1, parent->fw - orx); - orh = min (y2 - y1, parent->fh - ory); + orx = max(x1, 0); + ory = max(y1, 0); + orw = min(x2 - x1, parent->fw - orx); + orh = min(y2 - y1, parent->fh - ory); } - leftBorder = skips (rqx1 - bx1, skip); - upperBorder = skips (rqy1 - by1, skip); + leftBorder = skips(rqx1 - bx1, skip); + upperBorder = skips(rqy1 - by1, skip); - PreviewProps cp (orx, ory, orw, orh, skip); + PreviewProps cp(orx, ory, orw, orh, skip); int orW, orH; - parent->imgsrc->getSize (cp, orW, orH); + parent->imgsrc->getSize(cp, orW, orH); trafx = orx; trafy = ory; - int cw = skips (bw, skip); - int ch = skips (bh, skip); + int cw = skips(bw, skip); + int ch = skips(bh, skip); if (settings->verbose) { - printf ("setsizes starts (%d, %d, %d, %d, %d, %d)\n", orW, orH, trafw, trafh, cw, ch); + printf("setsizes starts (%d, %d, %d, %d, %d, %d)\n", orW, orH, trafw, trafh, cw, ch); } EditType editType = ET_PIPETTE; - if (const auto editProvider = PipetteBuffer::getDataProvider ()) { - if (const auto editSubscriber = editProvider->getCurrSubscriber ()) { - editType = editSubscriber->getEditingType (); + if (const auto editProvider = PipetteBuffer::getDataProvider()) { + if (const auto editSubscriber = editProvider->getCurrSubscriber()) { + editType = editSubscriber->getEditingType(); } } @@ -2058,18 +2068,18 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte origCrop = new Imagefloat; } - origCrop->allocate (trafw, trafh); // Resizing the buffer (optimization) + origCrop->allocate(trafw, trafh); // Resizing the buffer (optimization) // if transCrop doesn't exist yet, it'll be created where necessary if (transCrop) { - transCrop->allocate (cropw, croph); + transCrop->allocate(cropw, croph); } if (laboCrop) { delete laboCrop; // laboCrop can't be resized } - laboCrop = new LabImage (cropw, croph); + laboCrop = new LabImage(cropw, croph); // if (translabCrop) translabCrop->reallocLab(); @@ -2077,13 +2087,13 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte delete labnCrop; // labnCrop can't be resized } - labnCrop = new LabImage (cropw, croph); + labnCrop = new LabImage(cropw, croph); if (reservCrop) { delete reservCrop; // labnCrop can't be resized } - reservCrop = new LabImage (cropw, croph); + reservCrop = new LabImage(cropw, croph); /* if (lablocCrop) { delete lablocCrop; // labnCrop can't be resized @@ -2095,7 +2105,7 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte cropImg = new Image8; } - cropImg->allocate (cropw, croph); // Resizing the buffer (optimization) + cropImg->allocate(cropw, croph); // Resizing the buffer (optimization) //cieCrop is only used in Crop::update, it is destroyed now but will be allocated on first use if (cieCrop) { @@ -2103,11 +2113,11 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte cieCrop = nullptr; } - if (cbuffer ) { + if (cbuffer) { delete [] cbuffer; } - if (shbuffer ) { + if (shbuffer) { delete [] shbuffer; } @@ -2119,31 +2129,31 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte delete [] shbuf_real; } - if (cshmap ) { + if (cshmap) { delete cshmap; cshmap = nullptr; } cbuffer = new float*[croph]; - cbuf_real = new float[ (croph + 2)*cropw]; + cbuf_real = new float[(croph + 2)*cropw]; for (int i = 0; i < croph; i++) { cbuffer[i] = cbuf_real + cropw * i + cropw; } shbuffer = new float*[croph]; - shbuf_real = new float[ (croph + 2)*cropw]; + shbuf_real = new float[(croph + 2)*cropw]; for (int i = 0; i < croph; i++) { shbuffer[i] = shbuf_real + cropw * i + cropw; } if (params.sh.enabled) { - cshmap = new SHMap (cropw, croph, true); + cshmap = new SHMap(cropw, croph, true); } if (editType == ET_PIPETTE) { - PipetteBuffer::resize (cropw, croph); + PipetteBuffer::resize(cropw, croph); } else if (PipetteBuffer::bufferCreated()) { PipetteBuffer::flush(); } @@ -2157,11 +2167,11 @@ bool Crop::setCropSizes (int rcx, int rcy, int rcw, int rch, int skip, bool inte cropy = by1; if (settings->verbose) { - printf ("setsizes ends\n"); + printf("setsizes ends\n"); } if (!internal) { - cropMutex.unlock (); + cropMutex.unlock(); } return changed; @@ -2196,20 +2206,20 @@ bool Crop::tryUpdate() * * This method is called when the visible part of the crop has changed (resize, zoom, etc..), so it needs a full update */ -void Crop::fullUpdate () +void Crop::fullUpdate() { - parent->updaterThreadStart.lock (); + parent->updaterThreadStart.lock(); if (parent->updaterRunning && parent->thread) { // Do NOT reset changes here, since in a long chain of events it will lead to chroma_scale not being updated, // causing Color::lab2rgb to return a black image on some opens //parent->changeSinceLast = 0; - parent->thread->join (); + parent->thread->join(); } if (parent->plistener) { - parent->plistener->setProgressState (true); + parent->plistener->setProgressState(true); } // If there are more update request, the following WHILE will collect it @@ -2217,33 +2227,33 @@ void Crop::fullUpdate () while (newUpdatePending) { newUpdatePending = false; - update (ALL); + update(ALL); } updating = false; // end of crop update if (parent->plistener) { - parent->plistener->setProgressState (false); + parent->plistener->setProgressState(false); } - parent->updaterThreadStart.unlock (); + parent->updaterThreadStart.unlock(); } int Crop::get_skip() { - MyMutex::MyLock lock (cropMutex); + MyMutex::MyLock lock(cropMutex); return skip; } int Crop::getLeftBorder() { - MyMutex::MyLock lock (cropMutex); + MyMutex::MyLock lock(cropMutex); return leftBorder; } int Crop::getUpperBorder() { - MyMutex::MyLock lock (cropMutex); + MyMutex::MyLock lock(cropMutex); return upperBorder; } diff --git a/rtengine/demosaic_algos.cc b/rtengine/demosaic_algos.cc index 88d369969..4a82dd720 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); } @@ -2029,7 +2029,8 @@ SSEFUNCTION void RawImageSource::igv_interpolate(int winw, int winh) for (; col < width; col++, indx += 2) { dest1[indx >> 1] = CLIP(rawData[row][col]); //rawData = RT datas col++; - dest2[indx >> 1] = CLIP(rawData[row][col]); //rawData = RT datas + if(col < width) + dest2[indx >> 1] = CLIP(rawData[row][col]); //rawData = RT datas } } @@ -2364,7 +2365,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 +2640,7 @@ void RawImageSource::ahd_demosaic() 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 +3703,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 6143d172e..8d02bafb2 100644 --- a/rtengine/fast_demo.cc +++ b/rtengine/fast_demo.cc @@ -62,7 +62,7 @@ SSEFUNCTION void RawImageSource::fast_demosaic() //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 60082ac40..2a59332b2 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -38,179 +38,180 @@ namespace rtengine extern const Settings* settings; -ImProcCoordinator::ImProcCoordinator () - : orig_prev (nullptr), oprevi (nullptr), oprevl (nullptr), nprevl (nullptr), reserv (nullptr), fattal_11_dcrop_cache (nullptr), previmg (nullptr), workimg (nullptr), - ncie (nullptr), imgsrc (nullptr), shmap (nullptr), lastAwbEqual (0.), lastAwbTempBias (0.0), ipf (¶ms, true), monitorIntent (RI_RELATIVE), - softProof (false), gamutCheck (false), scale (10), highDetailPreprocessComputed (false), highDetailRawComputed (false), - allocated (false), bwAutoR (-9000.f), bwAutoG (-9000.f), bwAutoB (-9000.f), CAMMean (NAN), coordX (0), coordY (0), localX (0), localY (0), +ImProcCoordinator::ImProcCoordinator() + : orig_prev(nullptr), oprevi(nullptr), oprevl(nullptr), nprevl(nullptr), reserv(nullptr), fattal_11_dcrop_cache(nullptr), previmg(nullptr), workimg(nullptr), + ncie(nullptr), imgsrc(nullptr), shmap(nullptr), lastAwbEqual(0.), lastAwbTempBias(0.0), ipf(¶ms, true), monitorIntent(RI_RELATIVE), + softProof(false), gamutCheck(false), scale(10), highDetailPreprocessComputed(false), highDetailRawComputed(false), + allocated(false), bwAutoR(-9000.f), bwAutoG(-9000.f), bwAutoB(-9000.f), CAMMean(NAN), coordX(0), coordY(0), localX(0), localY(0), ctColorCurve(), - hltonecurve (65536), - shtonecurve (65536), - tonecurve (65536, 0), //,1); - lumacurve (32770, 0), // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation - chroma_acurve (65536, 0), - chroma_bcurve (65536, 0), - satcurve (65536, 0), - lhskcurve (65536, 0), - clcurve (65536, 0), - conversionBuffer (1, 1), - wavclCurve (65536, 0), - clToningcurve (65536, 0), - lllocalcurve (65536, 0), - cclocalcurve (65536, 0), - sklocalcurve (65536, 0), - exlocalcurve (65536, 0), - hltonecurveloc (32768, 0),//32768 - shtonecurveloc (32768, 0), - tonecurveloc (32768, 0), - cl2Toningcurve (65536, 0), - Noisecurve (65536, 0), - NoiseCCcurve (65536, 0), - vhist16 (65536), vhist16bw (65536), - lhist16CAM (65536), - lhist16CCAM (65536), + hltonecurve(65536), + shtonecurve(65536), + tonecurve(65536, 0), //,1); + lumacurve(32770, 0), // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation + chroma_acurve(65536, 0), + chroma_bcurve(65536, 0), + satcurve(65536, 0), + lhskcurve(65536, 0), + clcurve(65536, 0), + conversionBuffer(1, 1), + wavclCurve(65536, 0), + clToningcurve(65536, 0), + lllocalcurve(65536, 0), + cclocalcurve(65536, 0), + sklocalcurve(65536, 0), + exlocalcurve(65536, 0), + hltonecurveloc(32768, 0), //32768 + shtonecurveloc(32768, 0), + tonecurveloc(32768, 0), + cl2Toningcurve(65536, 0), + Noisecurve(65536, 0), + NoiseCCcurve(65536, 0), + vhist16(65536), vhist16bw(65536), + lhist16CAM(65536), + lhist16CCAM(65536), lhist16RETI(), - lhist16LClad (65536), - histRed (256), histRedRaw (256), - histGreen (256), histGreenRaw (256), - histBlue (256), histBlueRaw (256), - histLuma (256), - histToneCurve (256), - histToneCurveBW (256), - histLCurve (256), - histCCurve (256), - histLLCurve (256), - histLCAM (256), - histCCAM (256), - histClad (256), - bcabhist (256), - histChroma (256), - histLRETI (256), + lhist16LClad(65536), + histRed(256), histRedRaw(256), + histGreen(256), histGreenRaw(256), + histBlue(256), histBlueRaw(256), + histLuma(256), + histToneCurve(256), + histToneCurveBW(256), + histLCurve(256), + histCCurve(256), + histLLCurve(256), + histLCAM(256), + histCCAM(256), + histClad(256), + bcabhist(256), + histChroma(256), + histLRETI(256), CAMBrightCurveJ(), CAMBrightCurveQ(), rCurve(), gCurve(), bCurve(), - rcurvehist (256), rcurvehistCropped (256), rbeforehist (256), - gcurvehist (256), gcurvehistCropped (256), gbeforehist (256), - bcurvehist (256), bcurvehistCropped (256), bbeforehist (256), - fw (0), fh (0), tr (0), - fullw (1), fullh (1), - pW (-1), pH (-1), + rcurvehist(256), rcurvehistCropped(256), rbeforehist(256), + gcurvehist(256), gcurvehistCropped(256), gbeforehist(256), + bcurvehist(256), bcurvehistCropped(256), bbeforehist(256), + fw(0), fh(0), tr(0), + fullw(1), fullh(1), + pW(-1), pH(-1), //<<<<<<< HEAD - 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), - circrads (500, -10000), - centerx (500, -10000), - centery (500, -10000), - centerxbufs (500, -10000), - centerybufs (500, -10000), - adjblurs (500, -10000), - cutpasts (500, -10000), - lastdusts (500, -10000), - blurmets (500, -10000), - dustmets (500, -10000), + 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), + circrads(500, -10000), + centerx(500, -10000), + centery(500, -10000), + centerxbufs(500, -10000), + centerybufs(500, -10000), + adjblurs(500, -10000), + cutpasts(500, -10000), + lastdusts(500, -10000), + blurmets(500, -10000), + dustmets(500, -10000), - locx (500, -10000), - locy (500, -10000), - locxl (500, -10000), - locyt (500, -10000), - lights (500, -100000), - contrs (500, -10000), - chroms (500, -10000), - sensis (500, -10000), - expcomps (500, -10000), - blacks (500, -10000), - hlcomprs (500, -10000), - hlcomprthreshs (500, -10000), - shcomprs (500, -10000), - sensiexs (500, -10000), + locx(500, -10000), + locy(500, -10000), + locxl(500, -10000), + locyt(500, -10000), + lights(500, -100000), + contrs(500, -10000), + chroms(500, -10000), + sensis(500, -10000), + expcomps(500, -10000), + blacks(500, -10000), + hlcomprs(500, -10000), + hlcomprthreshs(500, -10000), + shcomprs(500, -10000), + sensiexs(500, -10000), - transits (500, -10000), + transits(500, -10000), - inverss (500, -10000), - curvactivs (500, -10000), - smeths (500, -10000), - curens (500, -10000), - radiuss (500, -10000), - strengths (500, -10000), - sensibns (500, -10000), - inversrads (500, -10000), - strs (500, 10000), - chrrts (500, -10000), - neighs (500, -10000), - varts (500, -10000), - sensihs (500, -10000), - inversrets (500, -10000), - retinexs (500, -10000), - sps (500, -10000), - sharradiuss (500, -10000), - sharamounts (500, -10000), - shardampings (500, -10000), - inversshas (500, -10000), - shariters (500, -10000), - sensishas (500, -10000), - qualitys (500, -10000), - thress (500, -10000), - proxis (500, -10000), - noiselumfs (500, -10000), - noiselumcs (500, -10000), - noisechrofs (500, -10000), - noisechrocs (500, -10000), - mult0s (500, -10000), - mult1s (500, -10000), - mult2s (500, -10000), - mult3s (500, -10000), - mult4s (500, -10000), - chromacbdls (500, -10000), - thresholds (500, -10000), - sensicbs (500, -10000), - activlums (500, -10000), - versionmip (0), - strens (500, -10000), - gammas (500, -10000), - estops (500, -10000), - scaltms (500, -10000), - reweis (500, -10000), - sensitms (500, -10000), - qualitycurves (500, -10000), - sizeretics (500, -10000), - reticurvs (25000, -10000), //allow 500 values for each control point * 500 - retrabs (500, -10000), - llcurvs (25000, -10000), //allow 500 values for each control point * 500 - sizellcs (500, -10000), - lhcurvs (25000, -10000), //allow 500 values for each control point * 500 - hhcurvs (25000, -10000), //allow 500 values for each control point * 500 - sizelhcs (500, -10000), - sizehhcs (500, -10000), - cccurvs (25000, -10000), //allow 500 values for each control point * 500 - sizecccs (500, -10000), - sensivs (500, -10000), - saturateds (500, -10000), - pastels (500, -10000), - psthresholds (500, -10000), - protectskinss (500, -10000), - avoidcolorshifts (500, -10000), - pastsattogs (500, -10000), - skintonescurves (25000, -10000), - sizeskintonecurves (500, -10000), - excurves (25000, -10000), - sizeexcurves (500, -10000), - exclumets (500, -1000), - sensiexclus (500, -1000), - strucs (500, -1000), - huerefs (500, -100000.f), - chromarefs (500, -100000.f), - lumarefs (500, -100000.f), - sobelrefs (500, -100000.f), + inverss(500, -10000), + curvactivs(500, -10000), + smeths(500, -10000), + curens(500, -10000), + radiuss(500, -10000), + strengths(500, -10000), + sensibns(500, -10000), + inversrads(500, -10000), + strs(500, 10000), + chrrts(500, -10000), + neighs(500, -10000), + varts(500, -10000), + sensihs(500, -10000), + inversrets(500, -10000), + retinexs(500, -10000), + sps(500, -10000), + sharradiuss(500, -10000), + sharamounts(500, -10000), + shardampings(500, -10000), + inversshas(500, -10000), + shariters(500, -10000), + sensishas(500, -10000), + qualitys(500, -10000), + thress(500, -10000), + proxis(500, -10000), + noiselumfs(500, -10000), + noiselumcs(500, -10000), + noisechrofs(500, -10000), + noisechrocs(500, -10000), + mult0s(500, -10000), + mult1s(500, -10000), + mult2s(500, -10000), + mult3s(500, -10000), + mult4s(500, -10000), + chromacbdls(500, -10000), + thresholds(500, -10000), + sensicbs(500, -10000), + activlums(500, -10000), + versionmip(0), + strens(500, -10000), + gammas(500, -10000), + estops(500, -10000), + scaltms(500, -10000), + reweis(500, -10000), + sensitms(500, -10000), + qualitycurves(500, -10000), + sizeretics(500, -10000), + reticurvs(25000, -10000), //allow 500 values for each control point * 500 + retrabs(500, -10000), + llcurvs(25000, -10000), //allow 500 values for each control point * 500 + sizellcs(500, -10000), + lhcurvs(25000, -10000), //allow 500 values for each control point * 500 + hhcurvs(25000, -10000), //allow 500 values for each control point * 500 + sizelhcs(500, -10000), + sizehhcs(500, -10000), + cccurvs(25000, -10000), //allow 500 values for each control point * 500 + sizecccs(500, -10000), + sensivs(500, -10000), + saturateds(500, -10000), + pastels(500, -10000), + psthresholds(500, -10000), + protectskinss(500, -10000), + avoidcolorshifts(500, -10000), + pastsattogs(500, -10000), + skintonescurves(25000, -10000), + sizeskintonecurves(500, -10000), + excurves(25000, -10000), + sizeexcurves(500, -10000), + exclumets(500, -1000), + sensiexclus(500, -1000), + strucs(500, -1000), + warms(500, -1000), + huerefs(500, -100000.f), + chromarefs(500, -100000.f), + lumarefs(500, -100000.f), + sobelrefs(500, -100000.f), - huer (0), - chromar (0), - lumar (0), - sobeler (0), - colourToningSatLimit (0.f), colourToningSatLimitOpacity (0.f), - retistrsav (nullptr) + huer(0), + chromar(0), + lumar(0), + sobeler(0), + colourToningSatLimit(0.f), colourToningSatLimitOpacity(0.f), + retistrsav(nullptr) /* ======= plistener (nullptr), imageListener (nullptr), aeListener (nullptr), acListener (nullptr), abwListener (nullptr), awbListener (nullptr), frameCountListener (nullptr), imageTypeListener (nullptr), actListener (nullptr), adnListener (nullptr), awavListener (nullptr), dehaListener (nullptr), hListener (nullptr), @@ -220,24 +221,24 @@ ImProcCoordinator::ImProcCoordinator () */ {} -void ImProcCoordinator::assign (ImageSource* imgsrc) +void ImProcCoordinator::assign(ImageSource* imgsrc) { this->imgsrc = imgsrc; } -ImProcCoordinator::~ImProcCoordinator () +ImProcCoordinator::~ImProcCoordinator() { destroying = true; - updaterThreadStart.lock (); + updaterThreadStart.lock(); if (updaterRunning && thread) { - thread->join (); + thread->join(); } mProcessing.lock(); mProcessing.unlock(); - freeAll (); + freeAll(); if (fattal_11_dcrop_cache) { delete fattal_11_dcrop_cache; @@ -250,23 +251,23 @@ ImProcCoordinator::~ImProcCoordinator () delete toDel[i]; } - imgsrc->decreaseRef (); - updaterThreadStart.unlock (); + imgsrc->decreaseRef(); + updaterThreadStart.unlock(); } -DetailedCrop* ImProcCoordinator::createCrop (::EditDataProvider *editDataProvider, bool isDetailWindow) +DetailedCrop* ImProcCoordinator::createCrop(::EditDataProvider *editDataProvider, bool isDetailWindow) { - return new Crop (this, editDataProvider, isDetailWindow); + return new Crop(this, editDataProvider, isDetailWindow); } // todo: bitmask containing desired actions, taken from changesSinceLast // cropCall: calling crop, used to prevent self-updates ...doesn't seem to be used -void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) +void ImProcCoordinator::updatePreviewImage(int todo, Crop* cropCall) { - MyMutex::MyLock processingLock (mProcessing); + MyMutex::MyLock processingLock(mProcessing); int numofphases = 14; int readyphase = 0; @@ -287,7 +288,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // Check if any detail crops need high detail. If not, take a fast path short cut if (!highDetailNeeded) { for (size_t i = 0; i < crops.size(); i++) - if (crops[i]->get_skip() == 1 ) { // skip=1 -> full resolution + if (crops[i]->get_skip() == 1) { // skip=1 -> full resolution highDetailNeeded = true; break; } @@ -297,16 +298,16 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) ColorManagementParams cmp = params.icm; LCurveParams lcur = params.labCurve; - if ( !highDetailNeeded ) { + 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; @@ -314,18 +315,18 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //rp.deadPixelFilter = rp.hotPixelFilter = false; } - progress ("Applying white balance, color correction & sRGB conversion...", 100 * readyphase / numofphases); + progress("Applying white balance, color correction & sRGB conversion...", 100 * readyphase / numofphases); if (frameCountListener) { - frameCountListener->FrameCountChanged (imgsrc->getFrameCount(), params.raw.bayersensor.imageNum); + frameCountListener->FrameCountChanged(imgsrc->getFrameCount(), params.raw.bayersensor.imageNum); } // raw auto CA is bypassed if no high detail is needed, so we have to compute it when high detail is needed - if ( (todo & M_PREPROC) || (!highDetailPreprocessComputed && highDetailNeeded)) { - imgsrc->setCurrentFrame (params.raw.bayersensor.imageNum); + if ((todo & M_PREPROC) || (!highDetailPreprocessComputed && highDetailNeeded)) { + imgsrc->setCurrentFrame(params.raw.bayersensor.imageNum); - imgsrc->preprocess ( rp, params.lensProf, params.coarse ); - imgsrc->getRAWHistogram ( histRedRaw, histGreenRaw, histBlueRaw ); + imgsrc->preprocess(rp, params.lensProf, params.coarse); + imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw); if (highDetailNeeded) { highDetailPreprocessComputed = true; @@ -347,23 +348,23 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // If high detail (=100%) is newly selected, do a demosaic update, since the last was just with FAST if (imageTypeListener) { - imageTypeListener->imageTypeChanged (imgsrc->isRAW(), imgsrc->getSensorType() == ST_BAYER, imgsrc->getSensorType() == ST_FUJI_XTRANS); + imageTypeListener->imageTypeChanged(imgsrc->isRAW(), imgsrc->getSensorType() == ST_BAYER, imgsrc->getSensorType() == ST_FUJI_XTRANS); } - if ( (todo & M_RAW) + if ((todo & M_RAW) || (!highDetailRawComputed && highDetailNeeded) - || ( params.toneCurve.hrenabled && params.toneCurve.method != "Color" && imgsrc->isRGBSourceModified()) + || (params.toneCurve.hrenabled && params.toneCurve.method != "Color" && imgsrc->isRGBSourceModified()) || (!params.toneCurve.hrenabled && params.toneCurve.method == "Color" && imgsrc->isRGBSourceModified())) { if (settings->verbose) { if (imgsrc->getSensorType() == ST_BAYER) { - printf ("Demosaic Bayer image n.%d using method: %s\n", rp.bayersensor.imageNum + 1, rp.bayersensor.method.c_str()); + printf("Demosaic Bayer image n.%d using method: %s\n", rp.bayersensor.imageNum + 1, rp.bayersensor.method.c_str()); } else if (imgsrc->getSensorType() == ST_FUJI_XTRANS) { - printf ("Demosaic X-Trans image with using method: %s\n", rp.xtranssensor.method.c_str()); + printf("Demosaic X-Trans image with using method: %s\n", rp.xtranssensor.method.c_str()); } } - imgsrc->demosaic ( rp); //enabled demosaic + imgsrc->demosaic(rp); //enabled demosaic // if a demosaic happened we should also call getimage later, so we need to set the M_INIT flag todo |= M_INIT; @@ -374,10 +375,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } if (params.retinex.enabled) { - lhist16RETI (32768); + lhist16RETI(32768); lhist16RETI.clear(); - imgsrc->retinexPrepareBuffers (params.icm, params.retinex, conversionBuffer, lhist16RETI); + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, lhist16RETI); } } @@ -385,15 +386,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) bool dehacontlutili = false; bool mapcontlutili = false; bool useHsl = false; - LUTf cdcurve (65536, 0); - LUTf mapcurve (65536, 0); + LUTf cdcurve(65536, 0); + LUTf mapcurve(65536, 0); - imgsrc->retinexPrepareCurves (params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, lhist16RETI, histLRETI); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, lhist16RETI, histLRETI); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex ( params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI); //enabled Retinex + imgsrc->retinex(params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, histLRETI); //enabled Retinex if (dehaListener) { - dehaListener->minmaxChanged (maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); + dehaListener->minmaxChanged(maxCD, minCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax); } } @@ -402,7 +403,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // It has to be done there, because the next 'if' statement will use the value computed here if (todo & M_AUTOEXP) { if (params.toneCurve.autoexp) {// this enabled HLRecovery - if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { + if (ToneCurveParams::HLReconstructionNecessary(histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { // switching params.toneCurve.hrenabled to true -> shouting in listener's ears! params.toneCurve.hrenabled = true; @@ -413,32 +414,32 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } if (todo & (M_INIT | M_LINDENOISE | M_HDR)) { - MyMutex::MyLock initLock (minit); // Also used in crop window + MyMutex::MyLock initLock(minit); // Also used in crop window - imgsrc->HLRecovery_Global ( params.toneCurve); // this handles Color HLRecovery + imgsrc->HLRecovery_Global(params.toneCurve); // this handles Color HLRecovery if (settings->verbose) { - printf ("Applying white balance, color correction & sRBG conversion...\n"); + printf("Applying white balance, color correction & sRBG conversion...\n"); } - currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); if (params.wb.method == "Camera") { - currWB = imgsrc->getWB (); + currWB = imgsrc->getWB(); } else if (params.wb.method == "Auto") { if (lastAwbEqual != params.wb.equal || lastAwbTempBias != params.wb.tempBias) { double rm, gm, bm; - imgsrc->getAutoWBMultipliers (rm, gm, bm); + imgsrc->getAutoWBMultipliers(rm, gm, bm); if (rm != -1.) { - autoWB.update (rm, gm, bm, params.wb.equal, params.wb.tempBias); + autoWB.update(rm, gm, bm, params.wb.equal, params.wb.tempBias); lastAwbEqual = params.wb.equal; lastAwbTempBias = params.wb.tempBias; } else { lastAwbEqual = -1.; lastAwbTempBias = 0.0; - autoWB.useDefaults (params.wb.equal); + autoWB.useDefaults(params.wb.equal); } //double rr,gg,bb; @@ -448,24 +449,24 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) currWB = autoWB; } - params.wb.temperature = currWB.getTemp (); - params.wb.green = currWB.getGreen (); + params.wb.temperature = currWB.getTemp(); + params.wb.green = currWB.getGreen(); if (params.wb.method == "Auto" && awbListener) { - awbListener->WBChanged (params.wb.temperature, params.wb.green); + awbListener->WBChanged(params.wb.temperature, params.wb.green); } - int tr = getCoarseBitMask (params.coarse); + int tr = getCoarseBitMask(params.coarse); - imgsrc->getFullSize (fw, fh, tr); + imgsrc->getFullSize(fw, fh, tr); // Will (re)allocate the preview's buffers - setScale (scale); - PreviewProps pp (0, 0, fw, fh, scale); + setScale(scale); + PreviewProps pp(0, 0, fw, fh, scale); // Tells to the ImProcFunctions' tools what is the preview scale, which may lead to some simplifications - ipf.setScale (scale); + ipf.setScale(scale); - imgsrc->getImage (currWB, tr, orig_prev, pp, params.toneCurve, params.raw); + imgsrc->getImage(currWB, tr, orig_prev, pp, params.toneCurve, params.raw); denoiseInfoStore.valid = false; //ColorTemp::CAT02 (orig_prev, ¶ms) ; // printf("orig_prevW=%d\n scale=%d",orig_prev->width, scale); @@ -510,9 +511,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } */ - imgsrc->convertColorSpace (orig_prev, params.icm, currWB); + imgsrc->convertColorSpace(orig_prev, params.icm, currWB); - ipf.firstAnalysis (orig_prev, params, vhist16); + ipf.firstAnalysis(orig_prev, params, vhist16); } readyphase++; @@ -523,7 +524,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fattal_11_dcrop_cache = nullptr; } - ipf.ToneMapFattal02 (orig_prev); + ipf.ToneMapFattal02(orig_prev); if (oprevi != orig_prev) { delete oprevi; @@ -532,37 +533,37 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) oprevi = orig_prev; - progress ("Rotate / Distortion...", 100 * readyphase / numofphases); + progress("Rotate / Distortion...", 100 * readyphase / numofphases); // Remove transformation if unneeded bool needstransform = ipf.needsTransform(); - if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled)) ) { - assert (oprevi); + if ((needstransform || ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled))) { + assert(oprevi); Imagefloat *op = oprevi; - oprevi = new Imagefloat (pW, pH); + oprevi = new Imagefloat(pW, pH); if (needstransform) - ipf.transform (op, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, - imgsrc->getMetaData(), imgsrc->getRotateDegree(), false); + ipf.transform(op, oprevi, 0, 0, 0, 0, pW, pH, fw, fh, + imgsrc->getMetaData(), imgsrc->getRotateDegree(), false); else { - op->copyData (oprevi); + op->copyData(oprevi); } } if ((todo & (M_TRANSFORM | M_RGBCURVE)) && params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = oprevi->getWidth(); const int H = oprevi->getHeight(); - LabImage labcbdl (W, H); - ipf.rgb2lab (*oprevi, labcbdl, params.icm.working); - ipf.dirpyrequalizer (&labcbdl, scale); - ipf.lab2rgb (labcbdl, *oprevi, params.icm.working); + LabImage labcbdl(W, H); + ipf.rgb2lab(*oprevi, labcbdl, params.icm.working); + ipf.dirpyrequalizer(&labcbdl, scale); + ipf.lab2rgb(labcbdl, *oprevi, params.icm.working); } readyphase++; - progress ("Preparing shadow/highlight map...", 100 * readyphase / numofphases); + progress("Preparing shadow/highlight map...", 100 * readyphase / numofphases); if ((todo & M_BLURMAP) && params.sh.enabled) { - double radius = sqrt (double (pW * pW + pH * pH)) / 2.0; + double radius = sqrt(double (pW * pW + pH * pH)) / 2.0; double shradius = params.sh.radius; if (!params.sh.hq) { @@ -570,10 +571,10 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } if (!shmap) { - shmap = new SHMap (pW, pH, true); + shmap = new SHMap(pW, pH, true); } - shmap->update (oprevi, shradius, ipf.lumimul, params.sh.hq, scale); + shmap->update(oprevi, shradius, ipf.lumimul, params.sh.hq, scale); } @@ -584,49 +585,49 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (params.toneCurve.autoexp) { LUTu aehist; int aehistcompr; - imgsrc->getAutoExpHistogram (aehist, aehistcompr); - ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, params.toneCurve.expcomp, - params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh); + imgsrc->getAutoExpHistogram(aehist, aehistcompr); + ipf.getAutoExp(aehist, aehistcompr, params.toneCurve.clip, params.toneCurve.expcomp, + params.toneCurve.brightness, params.toneCurve.contrast, params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh); if (aeListener) - aeListener->autoExpChanged (params.toneCurve.expcomp, params.toneCurve.brightness, params.toneCurve.contrast, - params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.hrenabled); + aeListener->autoExpChanged(params.toneCurve.expcomp, params.toneCurve.brightness, params.toneCurve.contrast, + params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.hrenabled); } } - progress ("Exposure curve & CIELAB conversion...", 100 * readyphase / numofphases); + progress("Exposure curve & CIELAB conversion...", 100 * readyphase / numofphases); if ((todo & M_RGBCURVE) || (todo & M_CROP)) { // if (hListener) oprevi->calcCroppedHistogram(params, scale, histCropped); //complexCurve also calculated pre-curves histogram depending on crop - CurveFactory::complexCurve (params.toneCurve.expcomp, params.toneCurve.black / 65535.0, - params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, - params.toneCurve.shcompr, params.toneCurve.brightness, params.toneCurve.contrast, - params.toneCurve.curve, params.toneCurve.curve2, - vhist16, hltonecurve, shtonecurve, tonecurve, histToneCurve, customToneCurve1, customToneCurve2, 1); + CurveFactory::complexCurve(params.toneCurve.expcomp, params.toneCurve.black / 65535.0, + params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, + params.toneCurve.shcompr, params.toneCurve.brightness, params.toneCurve.contrast, + params.toneCurve.curve, params.toneCurve.curve2, + vhist16, hltonecurve, shtonecurve, tonecurve, histToneCurve, customToneCurve1, customToneCurve2, 1); - CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1); - CurveFactory::RGBCurve (params.rgbCurves.gcurve, gCurve, 1); - CurveFactory::RGBCurve (params.rgbCurves.bcurve, bCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.rcurve, rCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.gcurve, gCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.bcurve, bCurve, 1); opautili = false; if (params.colorToning.enabled) { - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params.icm.working); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params.icm.working); double wp[3][3] = { {wprof[0][0], wprof[0][1], wprof[0][2]}, {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili); - CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, scale == 1 ? 1 : 16); - CurveFactory::curveToning (params.colorToning.cl2curve, cl2Toningcurve, scale == 1 ? 1 : 16); + params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, opautili); + CurveFactory::curveToning(params.colorToning.clcurve, clToningcurve, scale == 1 ? 1 : 16); + CurveFactory::curveToning(params.colorToning.cl2curve, cl2Toningcurve, scale == 1 ? 1 : 16); } if (params.blackwhite.enabled) { - CurveFactory::curveBW (params.blackwhite.beforeCurve, params.blackwhite.afterCurve, vhist16bw, histToneCurveBW, beforeToneCurveBW, afterToneCurveBW, 1); + CurveFactory::curveBW(params.blackwhite.beforeCurve, params.blackwhite.afterCurve, vhist16bw, histToneCurveBW, beforeToneCurveBW, afterToneCurveBW, 1); } colourToningSatLimit = float (params.colorToning.satProtectionThreshold) / 100.f * 0.7f + 0.3f; @@ -639,7 +640,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (params.colorToning.enabled && params.colorToning.autosat) { //for colortoning evaluation of saturation settings float moyS = 0.f; float eqty = 0.f; - ipf.moyeqt (oprevi, moyS, eqty);//return image : mean saturation and standard dev of saturation + ipf.moyeqt(oprevi, moyS, eqty); //return image : mean saturation and standard dev of saturation //printf("moy=%f ET=%f\n", moyS,eqty); float satp = ((moyS + 1.5f * eqty) - 0.3f) / 0.7f; //1.5 sigma ==> 93% pixels with high saturation -0.3 / 0.7 convert to Hombre scale @@ -663,11 +664,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (actListener) { //if(params.blackwhite.enabled) {actListener->autoColorTonChanged(0, satTH, satPR);} if (params.blackwhite.enabled && params.colorToning.autosat) { - actListener->autoColorTonChanged (0, satTH, satPR); //hide sliders only if autosat + actListener->autoColorTonChanged(0, satTH, satPR); //hide sliders only if autosat indi = 0; } else { if (params.colorToning.autosat) { - if (params.colorToning.method == "Lab") { + if (params.colorToning.method == "Lab") { indi = 1; } else if (params.colorToning.method == "RGBCurves") { indi = 1; @@ -685,32 +686,32 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } // if it's just crop we just need the histogram, no image updates - if ( todo & M_RGBCURVE ) { + if (todo & M_RGBCURVE) { //initialize rrm bbm ggm different from zero to avoid black screen in some cases double rrm = 33.; double ggm = 33.; double bbm = 33.; DCPProfile::ApplyState as; - DCPProfile *dcpProf = imgsrc->getDCP (params.icm, as); + DCPProfile *dcpProf = imgsrc->getDCP(params.icm, as); - ipf.rgbProc (oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, shmap, params.toneCurve.saturation, - rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, dcpProf, as, histToneCurve); + ipf.rgbProc(oprevi, oprevl, nullptr, hltonecurve, shtonecurve, tonecurve, shmap, params.toneCurve.saturation, + rCurve, gCurve, bCurve, colourToningSatLimit, colourToningSatLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, beforeToneCurveBW, afterToneCurveBW, rrm, ggm, bbm, bwAutoR, bwAutoG, bwAutoB, params.toneCurve.expcomp, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, dcpProf, as, histToneCurve); if (params.blackwhite.enabled && params.blackwhite.autoc && abwListener) { if (settings->verbose) { - printf ("ImProcCoordinator / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", bwAutoR, bwAutoG, bwAutoB); + printf("ImProcCoordinator / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", bwAutoR, bwAutoG, bwAutoB); } - abwListener->BWChanged ((float) rrm, (float) ggm, (float) bbm); + abwListener->BWChanged((float) rrm, (float) ggm, (float) bbm); } if (params.colorToning.autosat && actListener) { if (settings->verbose) { - printf ("ImProcCoordinator / Auto CT: indi=%d satH=%d satPR=%d\n", indi, (int)colourToningSatLimit, (int) colourToningSatLimitOpacity); + printf("ImProcCoordinator / Auto CT: indi=%d satH=%d satPR=%d\n", indi, (int)colourToningSatLimit, (int) colourToningSatLimitOpacity); } - actListener->autoColorTonChanged (indi, (int) colourToningSatLimit, (int)colourToningSatLimitOpacity); //change sliders autosat + actListener->autoColorTonChanged(indi, (int) colourToningSatLimit, (int)colourToningSatLimitOpacity); //change sliders autosat } // correct GUI black and white with value @@ -720,11 +721,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) // compute L channel histogram int x1, y1, x2, y2; - params.crop.mapToResized (pW, pH, scale, x1, x2, y1, y2); + params.crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); } readyphase++; - lhist16 (32768); + lhist16(32768); if (todo & (M_LUMACURVE | M_CROP)) { /* @@ -735,11 +736,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) */ lhist16.clear(); #ifdef _OPENMP - const int numThreads = min (max (pW * pH / (int)lhist16.getSize(), 1), omp_get_max_threads()); + const int numThreads = min(max(pW * pH / (int)lhist16.getSize(), 1), omp_get_max_threads()); #pragma omp parallel num_threads(numThreads) if(numThreads>1) #endif { - LUTu lhist16thr (lhist16.getSize()); + LUTu lhist16thr(lhist16.getSize()); lhist16thr.clear(); #ifdef _OPENMP #pragma omp for nowait @@ -747,7 +748,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int x = 0; x < pH; x++) for (int y = 0; y < pW; y++) { - int pos = (int) (oprevl->L[x][y]); + int pos = (int)(oprevl->L[x][y]); lhist16thr[pos]++; } @@ -757,26 +758,26 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) lhist16 += lhist16thr; } #ifdef _OPENMP - static_cast (numThreads); // to silence cppcheck warning + static_cast(numThreads); // to silence cppcheck warning #endif - CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, lhist16, lumacurve, histLCurve, scale == 1 ? 1 : 16, utili); + CurveFactory::complexLCurve(params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, lhist16, lumacurve, histLCurve, scale == 1 ? 1 : 16, utili); } if (todo & M_LUMACURVE) { - CurveFactory::curveCL (clcutili, params.labCurve.clcurve, clcurve, scale == 1 ? 1 : 16); + CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, scale == 1 ? 1 : 16); - CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, - params.labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, scale == 1 ? 1 : 16); + CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, + params.labCurve.lccurve, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, scale == 1 ? 1 : 16); } //scale = 1; - if (todo & (M_LUMINANCE + M_COLOR) ) { - nprevl->CopyFrom (oprevl); - reserv->CopyFrom (oprevl); + if (todo & (M_LUMINANCE + M_COLOR)) { + nprevl->CopyFrom(oprevl); + reserv->CopyFrom(oprevl); int maxspot = settings->nspot + 1; - progress ("Applying Color Boost...", 100 * readyphase / numofphases); + progress("Applying Color Boost...", 100 * readyphase / numofphases); if (params.locallab.enabled) { @@ -801,27 +802,27 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) */ bool isascii = true; - std::string mdfive = getMD5 (imgsrc->getFileName()); + std::string mdfive = getMD5(imgsrc->getFileName()); Glib::ustring datainterm = imgsrc->getFileName() + ".ii";//extansion ii arbitrary to test if mip file is possible - ofstream finterm (datainterm, ios::out); + ofstream finterm(datainterm, ios::out); if (finterm.fail()) { - printf ("Non ascii Mip file possible..switch to Profiles\n"); + printf("Non ascii Mip file possible..switch to Profiles\n"); isascii = false; } else { - printf ("ascii Mip file possible!\n"); + printf("ascii Mip file possible!\n"); } finterm.close(); if (isascii == true) { - if ( std::remove (datainterm.c_str()) != 0 ) { - perror ( "Error deleting test ii file" ); + if (std::remove(datainterm.c_str()) != 0) { + perror("Error deleting test ii file"); } else { - puts ( "Test ii file successfully deleted" ); + puts("Test ii file successfully deleted"); } } @@ -830,7 +831,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) Glib::ustring datal; if (options.mip == MI_opt || !isascii) { - datal = pop + Glib::path_get_basename (imgsrc->getFileName () + "." + mdfive + ".mip"); + datal = pop + Glib::path_get_basename(imgsrc->getFileName() + "." + mdfive + ".mip"); } if (options.mip == MI_prev && isascii) {//&& isascii @@ -844,9 +845,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) else ("ca va bien\n"); test.close(); */ - ifstream fic0 (datal, ios::in); + ifstream fic0(datal, ios::in); - printf ("mip files in=%s\n", datal.c_str()); + printf("mip files in=%s\n", datal.c_str()); // if(! fic0.fail()) { float **shbuffer = nullptr; versionmip = 0; @@ -859,7 +860,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) }; - int maxdata = 85;// 82 10015//78;//73 for 10011 + int maxdata = 86;//85 10016;// 82 10015//78;//73 for 10011 if (fic0) { //find current version mip @@ -867,14 +868,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) std::string spotline; // int cont = 0; - while (getline (fic0, line)) { + while (getline(fic0, line)) { spotline = line; - std::size_t pos = spotline.find ("="); - std::size_t posend = spotline.find ("@"); //in case of for futur use + std::size_t pos = spotline.find("="); + std::size_t posend = spotline.find("@"); //in case of for futur use - if (spotline.substr (0, pos) == "Mipversion") { - std::string strversion = spotline.substr (pos + 1, (posend - pos)); - versionmip = std::stoi (strversion.c_str()); + if (spotline.substr(0, pos) == "Mipversion") { + std::string strversion = spotline.substr(pos + 1, (posend - pos)); + versionmip = std::stoi(strversion.c_str()); } @@ -883,14 +884,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic0.close(); } - printf ("current mipvers=%i\n", versionmip); - ifstream fic (datal, ios::in); + printf("current mipvers=%i\n", versionmip); + ifstream fic(datal, ios::in); if (fic.fail() || versionmip == 0 || params.locallab.nbspot == 0) { //initialize mip with default values if no file or old file to prevent crash - ofstream fic (datal, ios::out | ios::trunc); // ouverture en écriture avec effacement du fichier ouvert + ofstream fic(datal, ios::out | ios::trunc); // ouverture en écriture avec effacement du fichier ouvert if (params.locallab.nbspot == 0) { params.locallab.nbspot = 1; @@ -903,7 +904,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //initilize newues when first utilisation of Locallab. Prepare creation of Mip files for (int sp = 1; sp < maxspot; sp++) { // spots default int t_sp = sp; - int t_mipversion = 10016;//new value for each change + int t_mipversion = 10017;//new value for each change int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -1022,6 +1023,8 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_sensiexclu = 19; int t_struc = 0; + //10017 + int t_warm = 0; //all variables except locRETgainCurve 'coomon for all) fic << "Mipversion=" << t_mipversion << '@' << endl; @@ -1114,6 +1117,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic << "ExcludeMethod=" << t_excludemeth << '@' << endl; fic << "Sensiexclu=" << t_sensiexclu << '@' << endl; fic << "Struc=" << t_struc << '@' << endl; + fic << "Warm=" << t_warm << '@' << endl; fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; @@ -1365,6 +1369,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) dataspot[79][0] = sensiexclus[0] = params.locallab.sensiexclu; dataspot[80][0] = strucs[0] = params.locallab.struc; + dataspot[81][0] = warms[0] = params.locallab.warm; // for all curves work around - I do not know how to do with params curves... //curve Reti local @@ -1377,13 +1382,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcur[siz + 1]; for (int j = 0; j < siz; j++) { - s_datcur[j] = reticurvs[0 + j] = (int) (1000. * params.locallab.localTgaincurve[j]); + s_datcur[j] = reticurvs[0 + j] = (int)(1000. * params.locallab.localTgaincurve[j]); } std::string cur_str = ""; for (int j = 0; j < siz; j++) { - cur_str = cur_str + std::to_string (s_datcur[j]) + delim[j]; + cur_str = cur_str + std::to_string(s_datcur[j]) + delim[j]; } inser = retistr[0] = cur_str + "@"; @@ -1399,13 +1404,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcurl[sizl + 1]; for (int j = 0; j < sizl; j++) { - s_datcurl[j] = llcurvs[0 + j] = (int) (1000. * params.locallab.llcurve[j]); + s_datcurl[j] = llcurvs[0 + j] = (int)(1000. * params.locallab.llcurve[j]); } std::string ll_str = ""; for (int j = 0; j < sizl; j++) { - ll_str = ll_str + std::to_string (s_datcurl[j]) + delim[j]; + ll_str = ll_str + std::to_string(s_datcurl[j]) + delim[j]; } llstr[0] = ll_str + "@"; @@ -1421,13 +1426,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcurc[sizc + 1]; for (int j = 0; j < sizc; j++) { - s_datcurc[j] = cccurvs[0 + j] = (int) (1000. * params.locallab.cccurve[j]); + s_datcurc[j] = cccurvs[0 + j] = (int)(1000. * params.locallab.cccurve[j]); } std::string cc_str = ""; for (int j = 0; j < sizc; j++) { - cc_str = cc_str + std::to_string (s_datcurc[j]) + delim[j]; + cc_str = cc_str + std::to_string(s_datcurc[j]) + delim[j]; } ccstr[0] = cc_str + "@"; @@ -1445,13 +1450,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcurh[sizh + 1]; for (int j = 0; j < sizh; j++) { - s_datcurh[j] = lhcurvs[0 + j] = (int) (1000. * params.locallab.LHcurve[j]); + s_datcurh[j] = lhcurvs[0 + j] = (int)(1000. * params.locallab.LHcurve[j]); } std::string lh_str = ""; for (int j = 0; j < sizh; j++) { - lh_str = lh_str + std::to_string (s_datcurh[j]) + delim[j]; + lh_str = lh_str + std::to_string(s_datcurh[j]) + delim[j]; } lhstr[0] = lh_str + "@"; @@ -1469,13 +1474,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcurhh[sizhh + 1]; for (int j = 0; j < sizhh; j++) { - s_datcurhh[j] = hhcurvs[0 + j] = (int) (1000. * params.locallab.HHcurve[j]); + s_datcurhh[j] = hhcurvs[0 + j] = (int)(1000. * params.locallab.HHcurve[j]); } std::string hh_str = ""; for (int j = 0; j < sizhh; j++) { - hh_str = hh_str + std::to_string (s_datcurhh[j]) + delim[j]; + hh_str = hh_str + std::to_string(s_datcurhh[j]) + delim[j]; } hhstr[0] = hh_str + "@"; @@ -1493,13 +1498,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcursk[sizsk + 1]; for (int j = 0; j < sizsk; j++) { - s_datcursk[j] = skintonescurves[0 + j] = (int) (1000. * params.locallab.skintonescurve[j]); + s_datcursk[j] = skintonescurves[0 + j] = (int)(1000. * params.locallab.skintonescurve[j]); } std::string sk_str = ""; for (int j = 0; j < sizsk; j++) { - sk_str = sk_str + std::to_string (s_datcursk[j]) + delim[j]; + sk_str = sk_str + std::to_string(s_datcursk[j]) + delim[j]; } skinstr[0] = sk_str + "@"; @@ -1510,13 +1515,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //PSThreshold int sizps = 2; int s_datps[sizps + 1]; - s_datps[1] = psthresholds[1] = static_cast (params.locallab.psthreshold.value[ThresholdSelector::TS_TOPLEFT]); + s_datps[1] = psthresholds[1] = static_cast(params.locallab.psthreshold.getTopLeft()); - s_datps[0] = psthresholds[0] = static_cast (params.locallab.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]); + s_datps[0] = psthresholds[0] = static_cast(params.locallab.psthreshold.getBottomLeft()); std::string ps_str = ""; - ps_str = ps_str + std::to_string (s_datps[0]) + delim[0] + std::to_string (s_datps[1]) + delim[1]; + ps_str = ps_str + std::to_string(s_datps[0]) + delim[0] + std::to_string(s_datps[1]) + delim[1]; pthstr[0] = ps_str + "@"; //end local ps @@ -1533,13 +1538,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int s_datcurex[sizex + 1]; for (int j = 0; j < sizex; j++) { - s_datcurex[j] = excurves[0 + j] = (int) (1000. * params.locallab.excurve[j]); + s_datcurex[j] = excurves[0 + j] = (int)(1000. * params.locallab.excurve[j]); } std::string ex_str = ""; for (int j = 0; j < sizex; j++) { - ex_str = ex_str + std::to_string (s_datcurex[j]) + delim[j]; + ex_str = ex_str + std::to_string(s_datcurex[j]) + delim[j]; } exstr[0] = ex_str + "@"; @@ -1551,7 +1556,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) if (params.locallab.anbspot == 0) { //update GUI and MIP after current spot ==> params, shift with the other alolistener if (aloListener && params.locallab.anbspot == 0) { - aloListener->localretChanged (dataspot, retistr[0], llstr[0], lhstr[0], ccstr[0], hhstr[0], skinstr[0], pthstr[0], exstr[0], 0, 1); + aloListener->localretChanged(dataspot, retistr[0], llstr[0], lhstr[0], ccstr[0], hhstr[0], skinstr[0], pthstr[0], exstr[0], 0, 1); } } @@ -1575,7 +1580,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) bool excpth = true; bool excurvex = true; - ifstream fich (datal, ios::in); + ifstream fich(datal, ios::in); //read mip file if (fich) {//may be a file with versionmip = 10000 @@ -1647,72 +1652,76 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) maxind = 77; } - while (getline (fich, line)) { - spotline = line; - std::size_t pos = spotline.find ("="); - std::size_t posend = spotline.find ("@"); //in case of for futur use + if (versionmip == 10016) { + maxind = 80; + } - if (spotline.substr (0, pos) == "Mipversion") { - std::string strversion = spotline.substr (pos + 1, (posend - pos)); - versionmip = std::stoi (strversion.c_str()); + while (getline(fich, line)) { + spotline = line; + std::size_t pos = spotline.find("="); + std::size_t posend = spotline.find("@"); //in case of for futur use + + if (spotline.substr(0, pos) == "Mipversion") { + std::string strversion = spotline.substr(pos + 1, (posend - pos)); + versionmip = std::stoi(strversion.c_str()); } - if (spotline.substr (0, pos) == "Spot") { + if (spotline.substr(0, pos) == "Spot") { cont = 0; } cont++; - std::string str3 = spotline.substr (pos + 1, (posend - pos)); + std::string str3 = spotline.substr(pos + 1, (posend - pos)); if (cont == 1) { - ns = std::stoi (str3.c_str()); + ns = std::stoi(str3.c_str()); } if (ns < maxspot) { if (cont >= 2 && cont < 16) { - dataspot[cont][ns] = std::stoi (str3.c_str()); + dataspot[cont][ns] = std::stoi(str3.c_str()); } - if (spotline.substr (0, pos) == "Currentspot") { - dataspot[16][0] = std::stoi (str3.c_str()); + if (spotline.substr(0, pos) == "Currentspot") { + dataspot[16][0] = std::stoi(str3.c_str()); } if (cont > 16 && cont < maxind) { - dataspot[cont][ns] = std::stoi (str3.c_str()); + dataspot[cont][ns] = std::stoi(str3.c_str()); } - if (excurvret && spotline.substr (0, pos) == "curveReti") { + if (excurvret && spotline.substr(0, pos) == "curveReti") { retistr[ns] = str3; } - if (excurvll && spotline.substr (0, pos) == "curveLL") { + if (excurvll && spotline.substr(0, pos) == "curveLL") { llstr[ns] = str3; } - if (excurvlh && spotline.substr (0, pos) == "curveLH") { + if (excurvlh && spotline.substr(0, pos) == "curveLH") { lhstr[ns] = str3; } - if (excurvcc && spotline.substr (0, pos) == "curveCC") { + if (excurvcc && spotline.substr(0, pos) == "curveCC") { ccstr[ns] = str3; } - if (excurvhh && spotline.substr (0, pos) == "curveHH") { + if (excurvhh && spotline.substr(0, pos) == "curveHH") { hhstr[ns] = str3; } - if (excurvsk && spotline.substr (0, pos) == "curveskin") { + if (excurvsk && spotline.substr(0, pos) == "curveskin") { skinstr[ns] = str3; } - if (excpth && spotline.substr (0, pos) == "pthres") { + if (excpth && spotline.substr(0, pos) == "pthres") { pthstr[ns] = str3; } - if (excurvex && spotline.substr (0, pos) == "curveex") { + if (excurvex && spotline.substr(0, pos) == "curveex") { exstr[ns] = str3; } } @@ -1862,15 +1871,22 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } + if (versionmip <= 10016) {// + for (int sp = 1; sp < maxspot; sp++) { // spots default + dataspot[81][sp] = 0; + } + } + + //here we change the number of spot - if (ns < (maxspot - 1)) { - ofstream fic (datal, ios::out | ios::app); // ouverture en écriture avec effacement du fichier ouvert + if (ns < (maxspot - 1)) { + ofstream fic(datal, ios::out | ios::app); // ouverture en écriture avec effacement du fichier ouvert for (int sp = ns + 1 ; sp < maxspot; sp++) { // spots default int t_sp = sp; - int t_mipversion = 10016; + int t_mipversion = 10017; int t_circrad = 18; int t_locX = 250; int t_locY = 250; @@ -1981,6 +1997,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_sensiexclu = 19; int t_struc = 0; + //10017 + int t_warm = 0; + fic << "Mipversion=" << t_mipversion << '@' << endl; fic << "Spot=" << t_sp << '@' << endl; fic << "Circrad=" << t_circrad << '@' << endl; @@ -2068,6 +2087,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic << "ExcludeMethod=" << t_excludemeth << '@' << endl; fic << "Sensiexclu=" << t_sensiexclu << '@' << endl; fic << "Struc=" << t_struc << '@' << endl; + fic << "Warm=" << t_warm << '@' << endl; fic << "curveReti=" << t_curvret << '@' << endl; fic << "curveLL=" << t_curvll << '@' << endl; @@ -2085,7 +2105,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fic.close(); - ifstream fich2 (datal, ios::in); + ifstream fich2(datal, ios::in); if (fich2) { @@ -2095,68 +2115,68 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int ns2 = 0; int maxin = maxdata - 4; //70 ;//64 - while (getline (fich2, line2)) { + while (getline(fich2, line2)) { spotline2 = line2; - std::size_t pos2 = spotline2.find ("="); - std::size_t posend2 = spotline2.find ("@"); //in case of for futur use + std::size_t pos2 = spotline2.find("="); + std::size_t posend2 = spotline2.find("@"); //in case of for futur use - if (spotline2.substr (0, pos2) == "Mipversion") { - std::string strversion = spotline2.substr (pos2 + 1, (posend2 - pos2)); - versionmip = std::stoi (strversion.c_str()); + if (spotline2.substr(0, pos2) == "Mipversion") { + std::string strversion = spotline2.substr(pos2 + 1, (posend2 - pos2)); + versionmip = std::stoi(strversion.c_str()); } - if (spotline2.substr (0, pos2) == "Spot") { + if (spotline2.substr(0, pos2) == "Spot") { cont2 = 0; } cont2++; - std::string str32 = spotline2.substr (pos2 + 1, (posend2 - pos2)); + std::string str32 = spotline2.substr(pos2 + 1, (posend2 - pos2)); if (cont2 == 1) { - ns2 = std::stoi (str32.c_str()); + ns2 = std::stoi(str32.c_str()); } if (cont2 >= 2 && cont2 < 16) { - dataspot[cont2][ns2] = std::stoi (str32.c_str()); + dataspot[cont2][ns2] = std::stoi(str32.c_str()); } - if (spotline2.substr (0, pos2) == "Currentspot") { - dataspot[16][0] = std::stoi (str32.c_str()); + if (spotline2.substr(0, pos2) == "Currentspot") { + dataspot[16][0] = std::stoi(str32.c_str()); } if (cont2 > 16 && cont2 < maxin) { - dataspot[cont2][ns2] = std::stoi (str32.c_str()); + dataspot[cont2][ns2] = std::stoi(str32.c_str()); } - if (spotline2.substr (0, pos2) == "curveReti") { + if (spotline2.substr(0, pos2) == "curveReti") { retistr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "curveLL") { + if (spotline2.substr(0, pos2) == "curveLL") { llstr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "curveLH") { + if (spotline2.substr(0, pos2) == "curveLH") { lhstr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "curveCC") { + if (spotline2.substr(0, pos2) == "curveCC") { ccstr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "curveHH") { + if (spotline2.substr(0, pos2) == "curveHH") { hhstr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "curveskin") { + if (spotline2.substr(0, pos2) == "curveskin") { skinstr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "pthres") { + if (spotline2.substr(0, pos2) == "pthres") { pthstr[ns2] = str32; } - if (spotline2.substr (0, pos2) == "curveex") { + if (spotline2.substr(0, pos2) == "curveex") { exstr[ns2] = str32; } @@ -2416,13 +2436,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) params.locallab.sensiexclu = sensiexclus[sp] = dataspot[79][sp]; params.locallab.struc = strucs[sp] = dataspot[80][sp]; + params.locallab.warm = warms[sp] = dataspot[81][sp]; int *s_datc; s_datc = new int[70]; int siz; - ipf.strcurv_data (retistr[sp], s_datc, siz);//convert data in int string with strcurv_data () - it is a work around ! + ipf.strcurv_data(retistr[sp], s_datc, siz); //convert data in int string with strcurv_data () - it is a work around ! sizeretics[sp] = siz; @@ -2430,7 +2451,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < siz; j++) { reticurvs[sp * 500 + j] = s_datc[j]; - cretiend.push_back ((double) (s_datc[j]) / 1000.); + cretiend.push_back((double)(s_datc[j]) / 1000.); } delete [] s_datc; @@ -2439,7 +2460,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcl = new int[70]; int sizl; - ipf.strcurv_data (llstr[sp], s_datcl, sizl); + ipf.strcurv_data(llstr[sp], s_datcl, sizl); sizellcs[sp] = sizl; @@ -2447,7 +2468,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizl; j++) { llcurvs[sp * 500 + j] = s_datcl[j]; - cllend.push_back ((double) (s_datcl[j]) / 1000.); + cllend.push_back((double)(s_datcl[j]) / 1000.); } delete [] s_datcl; @@ -2457,7 +2478,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcc = new int[70]; int sizc; - ipf.strcurv_data (ccstr[sp], s_datcc, sizc); + ipf.strcurv_data(ccstr[sp], s_datcc, sizc); sizecccs[sp] = sizc; @@ -2465,7 +2486,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizc; j++) { cccurvs[sp * 500 + j] = s_datcc[j]; - cccend.push_back ((double) (s_datcc[j]) / 1000.); + cccend.push_back((double)(s_datcc[j]) / 1000.); } delete [] s_datcc; @@ -2474,7 +2495,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datch = new int[70]; int sizh; - ipf.strcurv_data (lhstr[sp], s_datch, sizh); + ipf.strcurv_data(lhstr[sp], s_datch, sizh); sizelhcs[sp] = sizh; @@ -2482,7 +2503,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizh; j++) { lhcurvs[sp * 500 + j] = s_datch[j]; - clhend.push_back ((double) (s_datch[j]) / 1000.); + clhend.push_back((double)(s_datch[j]) / 1000.); } delete [] s_datch; @@ -2492,7 +2513,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datchh = new int[70]; int sizhh; - ipf.strcurv_data (hhstr[sp], s_datchh, sizhh); + ipf.strcurv_data(hhstr[sp], s_datchh, sizhh); sizehhcs[sp] = sizhh; @@ -2500,7 +2521,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizhh; j++) { hhcurvs[sp * 500 + j] = s_datchh[j]; - chhend.push_back ((double) (s_datchh[j]) / 1000.); + chhend.push_back((double)(s_datchh[j]) / 1000.); } delete [] s_datchh; @@ -2510,7 +2531,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcsk = new int[70]; int sizsk; - ipf.strcurv_data (skinstr[sp], s_datcsk, sizsk); + ipf.strcurv_data(skinstr[sp], s_datcsk, sizsk); sizeskintonecurves[sp] = sizsk; @@ -2518,7 +2539,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizsk; j++) { skintonescurves[sp * 500 + j] = s_datcsk[j]; - cskend.push_back ((double) (s_datcsk[j]) / 1000.); + cskend.push_back((double)(s_datcsk[j]) / 1000.); } delete [] s_datcsk; @@ -2526,12 +2547,12 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //PSThreshold + 1 int sizps = 2; int s_datcps[sizps + 1]; - ipf.strcurv_data (pthstr[sp], s_datcps, sizps); + ipf.strcurv_data(pthstr[sp], s_datcps, sizps); psthresholds[sp * 500] = s_datcps[0]; psthresholds[sp * 500 + 1] = s_datcps[1]; // printf("A 0=%i 1=%i\n", s_datcps[0], s_datcps[1]); - params.locallab.psthreshold.setValues (s_datcps[0], s_datcps[1]); + params.locallab.psthreshold.setValues(s_datcps[0], s_datcps[1]); //end local PS @@ -2540,7 +2561,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcexx = new int[70]; int sizexx; - ipf.strcurv_data (exstr[sp], s_datcexx, sizexx); + ipf.strcurv_data(exstr[sp], s_datcexx, sizexx); sizeexcurves[sp] = sizexx; @@ -2548,7 +2569,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizexx; j++) { excurves[sp * 500 + j] = s_datcexx[j]; - cexend.push_back ((double) (s_datcexx[j]) / 1000.); + cexend.push_back((double)(s_datcexx[j]) / 1000.); } delete [] s_datcexx; @@ -2608,11 +2629,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) localexutili = true; } - params.locallab.getCurves (locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); - CurveFactory::curveLocal (locallutili, params.locallab.llcurve, lllocalcurve, sca); - CurveFactory::curveCCLocal (localcutili, params.locallab.cccurve, cclocalcurve, sca); - CurveFactory::curveskLocal (localskutili, params.locallab.skintonescurve, sklocalcurve, sca); - CurveFactory::curveexLocal (localexutili, params.locallab.excurve, exlocalcurve, sca); + params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); + CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve, sca); + CurveFactory::curveCCLocal(localcutili, params.locallab.cccurve, cclocalcurve, sca); + CurveFactory::curveskLocal(localskutili, params.locallab.skintonescurve, sklocalcurve, sca); + CurveFactory::curveexLocal(localexutili, params.locallab.excurve, exlocalcurve, sca); //provisory double br = 0.; double contr = 0.; @@ -2622,13 +2643,13 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) double hlcomprthresh = params.locallab.hlcomprthresh; double shcompr = params.locallab.shcompr; - CurveFactory::complexCurvelocal (ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, - lhist16, hltonecurveloc, shtonecurveloc, tonecurveloc, - sca); + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, + lhist16, hltonecurveloc, shtonecurveloc, tonecurveloc, + sca); double huere, chromare, lumare; double sobelre; - ipf.calc_ref (nprevl, nprevl, 0, 0, pW, pH, scale, huere, chromare, lumare, sobelre); + ipf.calc_ref(nprevl, nprevl, 0, 0, pW, pH, scale, huere, chromare, lumare, sobelre); huer = huere; chromar = chromare; lumar = lumare ; @@ -2643,8 +2664,8 @@ 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, - LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); + ipf.Lab_Local(3, (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.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve.clear(); cclocalcurve.clear(); sklocalcurve.clear(); @@ -2661,7 +2682,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //update GUI and Mip files if (aloListener && realspot != dataspot[16][0]) { //update GUI and MIP - aloListener->localChanged (dataspot, retistr[sp], llstr[sp], lhstr[sp], ccstr[sp], hhstr[sp], skinstr[sp], pthstr[sp], exstr[sp], sp, maxreal); + aloListener->localChanged(dataspot, retistr[sp], llstr[sp], lhstr[sp], ccstr[sp], hhstr[sp], skinstr[sp], pthstr[sp], exstr[sp], sp, maxreal); } @@ -2956,13 +2977,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) dataspot[79][sp] = sensiexclus[sp] = params.locallab.sensiexclu = dataspot[79][0]; dataspot[80][sp] = strucs[sp] = params.locallab.struc = dataspot[80][0]; + dataspot[81][sp] = warms[sp] = params.locallab.warm = dataspot[81][0]; int *s_datc; s_datc = new int[70]; int siz; - ipf.strcurv_data (retistr[0], s_datc, siz); + ipf.strcurv_data(retistr[0], s_datc, siz); sizeretics[sp] = siz; std::vector cretiend; @@ -2970,7 +2992,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < siz; j++) { reticurvs[sp * 500 + j] = s_datc[j]; - cretiend.push_back ((double) (s_datc[j]) / 1000.); + cretiend.push_back((double)(s_datc[j]) / 1000.); } @@ -2983,7 +3005,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcl = new int[70]; int sizl; - ipf.strcurv_data (llstr[0], s_datcl, sizl); + ipf.strcurv_data(llstr[0], s_datcl, sizl); sizellcs[sp] = sizl; std::vector cllend; @@ -2991,7 +3013,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizl; j++) { llcurvs[sp * 500 + j] = s_datcl[j]; - cllend.push_back ((double) (s_datcl[j]) / 1000.); + cllend.push_back((double)(s_datcl[j]) / 1000.); } @@ -3005,7 +3027,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcc = new int[70]; int sizc; - ipf.strcurv_data (ccstr[0], s_datcc, sizc); + ipf.strcurv_data(ccstr[0], s_datcc, sizc); sizecccs[sp] = sizc; std::vector cccend; @@ -3013,7 +3035,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizc; j++) { cccurvs[sp * 500 + j] = s_datcc[j]; - cccend.push_back ((double) (s_datcc[j]) / 1000.); + cccend.push_back((double)(s_datcc[j]) / 1000.); } @@ -3026,7 +3048,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datch = new int[70]; int sizh; - ipf.strcurv_data (lhstr[0], s_datch, sizh); + ipf.strcurv_data(lhstr[0], s_datch, sizh); sizelhcs[sp] = sizh; std::vector clhend; @@ -3034,7 +3056,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizh; j++) { lhcurvs[sp * 500 + j] = s_datch[j]; - clhend.push_back ((double) (s_datch[j]) / 1000.); + clhend.push_back((double)(s_datch[j]) / 1000.); } @@ -3047,7 +3069,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datchh = new int[70]; int sizhh; - ipf.strcurv_data (hhstr[0], s_datchh, sizhh); + ipf.strcurv_data(hhstr[0], s_datchh, sizhh); sizehhcs[sp] = sizhh; std::vector chhend; @@ -3055,7 +3077,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizhh; j++) { hhcurvs[sp * 500 + j] = s_datchh[j]; - chhend.push_back ((double) (s_datchh[j]) / 1000.); + chhend.push_back((double)(s_datchh[j]) / 1000.); } @@ -3068,7 +3090,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcsk = new int[70]; int sizsk; - ipf.strcurv_data (skinstr[0], s_datcsk, sizsk); + ipf.strcurv_data(skinstr[0], s_datcsk, sizsk); sizeskintonecurves[sp] = sizsk; std::vector cskend; @@ -3076,7 +3098,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizsk; j++) { skintonescurves[sp * 500 + j] = s_datcsk[j]; - cskend.push_back ((double) (s_datcsk[j]) / 1000.); + cskend.push_back((double)(s_datcsk[j]) / 1000.); } @@ -3090,18 +3112,18 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //PSThreshold + 1 int sizps = 2; int s_datcps[sizps + 1]; - ipf.strcurv_data (pthstr[0], s_datcps, sizps); + ipf.strcurv_data(pthstr[0], s_datcps, sizps); psthresholds[sp * 500] = s_datcps[0]; psthresholds[sp * 500 + 1] = s_datcps[1]; // printf("B 0=%i 1=%i\n", s_datcps[0], s_datcps[1]); std::string ps_str2 = ""; - ps_str2 = ps_str2 + std::to_string (s_datcps[0]) + delim[0] + std::to_string (s_datcps[1]) + delim[1]; + ps_str2 = ps_str2 + std::to_string(s_datcps[0]) + delim[0] + std::to_string(s_datcps[1]) + delim[1]; pthstr[0] = ps_str2 + "@"; pthstr[sp] = pthstr[0]; - params.locallab.psthreshold.setValues (s_datcps[0], s_datcps[1]); + params.locallab.psthreshold.setValues(s_datcps[0], s_datcps[1]); //end local PS @@ -3110,7 +3132,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) s_datcex = new int[70]; int sizex; // printf ("ex0=%s \n", exstr[0].c_str()); - ipf.strcurv_data (exstr[0], s_datcex, sizex); + ipf.strcurv_data(exstr[0], s_datcex, sizex); sizeexcurves[sp] = sizex; std::vector cexend; @@ -3118,7 +3140,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int j = 0; j < sizex; j++) { excurves[sp * 500 + j] = s_datcex[j]; - cexend.push_back ((double) (s_datcex[j]) / 1000.); + cexend.push_back((double)(s_datcex[j]) / 1000.); } @@ -3140,7 +3162,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) LHutili = true; } - params.locallab.getCurves (locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); + params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); locallutili = false; localcutili = false; localskutili = false; @@ -3167,29 +3189,29 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) double hlcomprthresh = params.locallab.hlcomprthresh; double shcompr = params.locallab.shcompr; - CurveFactory::complexCurvelocal (ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, - lhist16, hltonecurveloc, shtonecurveloc, tonecurveloc, - sca); + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, + lhist16, hltonecurveloc, shtonecurveloc, tonecurveloc, + sca); - CurveFactory::curveLocal (locallutili, params.locallab.llcurve, lllocalcurve, sca); - CurveFactory::curveCCLocal (localcutili, params.locallab.cccurve, cclocalcurve, sca); - CurveFactory::curveskLocal (localskutili, params.locallab.skintonescurve, sklocalcurve, sca); - CurveFactory::curveexLocal (localexutili, params.locallab.excurve, exlocalcurve, sca); + CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve, sca); + CurveFactory::curveCCLocal(localcutili, params.locallab.cccurve, cclocalcurve, sca); + CurveFactory::curveskLocal(localskutili, params.locallab.skintonescurve, sklocalcurve, sca); + CurveFactory::curveexLocal(localexutili, params.locallab.excurve, exlocalcurve, sca); params.locallab.hueref = huerefs[sp] / 100.; 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, - localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); + ipf.Lab_Local(3, (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.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve.clear(); cclocalcurve.clear(); sklocalcurve.clear(); exlocalcurve.clear(); //write mip file in real time - ofstream fou (datal, ios::out | ios::trunc); + ofstream fou(datal, ios::out | ios::trunc); if (fou) @@ -3197,7 +3219,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) for (int spe = 1; spe < maxspot; spe++) { int t_sp = spe; - int t_mipversion = 10016; + int t_mipversion = 10017; int t_circrad = dataspot[2][spe]; int t_locX = dataspot[3][spe]; int t_locY = dataspot[4][spe]; @@ -3284,6 +3306,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) int t_excludemeth = dataspot[78][spe]; int t_sensiexclu = dataspot[79][spe]; int t_struc = dataspot[80][spe]; + int t_warm = dataspot[81][spe]; int t_hueref = dataspot[maxdata - 4][spe]; int t_chromaref = dataspot[maxdata - 3][spe]; @@ -3389,6 +3412,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) fou << "ExcludeMethod=" << t_excludemeth << '@' << endl; fou << "Sensiexclu=" << t_sensiexclu << '@' << endl; fou << "Struc=" << t_struc << '@' << endl; + fou << "Warm=" << t_warm << '@' << endl; fou << "hueref=" << t_hueref << '@' << endl; fou << "chromaref=" << t_chromaref << '@' << endl; @@ -3431,11 +3455,11 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) histCCurve.clear(); histLCurve.clear(); - ipf.chromiLuminanceCurve (nullptr, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve); - ipf.vibrance (nprevl); + ipf.chromiLuminanceCurve(nullptr, pW, nprevl, nprevl, chroma_acurve, chroma_bcurve, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, histCCurve, histLCurve); + ipf.vibrance(nprevl); - if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { - ipf.EPDToneMap (nprevl, 5, scale); + if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { + ipf.EPDToneMap(nprevl, 5, scale); } // for all treatments Defringe, Sharpening, Contrast detail , Microcontrast they are activated if "CIECAM" function are disabled @@ -3482,9 +3506,9 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } */ if (params.dirpyrequalizer.cbdlMethod == "aft") { - if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) ) { - progress ("Pyramid wavelet...", 100 * readyphase / numofphases); - ipf.dirpyrequalizer (nprevl, scale); + if (((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled))) { + progress("Pyramid wavelet...", 100 * readyphase / numofphases); + ipf.dirpyrequalizer(nprevl, scale); //ipf.Lanczoslab (ip_wavelet(LabImage * lab, LabImage * dst, const procparams::EqualizerParams & eqparams), nprevl, 1.f/scale); readyphase++; } @@ -3493,18 +3517,18 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) wavcontlutili = false; //CurveFactory::curveWavContL ( wavcontlutili,params.wavelet.lcurve, wavclCurve, LUTu & histogramwavcl, LUTu & outBeforeWavCLurveHistogram,int skip); - CurveFactory::curveWavContL (wavcontlutili, params.wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16); + CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve, scale == 1 ? 1 : 16); if ((params.wavelet.enabled)) { WaveletParams WaveParams = params.wavelet; // WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY); - WaveParams.getCurves (wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); + WaveParams.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); int kall = 0; - progress ("Wavelet...", 100 * readyphase / numofphases); + progress("Wavelet...", 100 * readyphase / numofphases); // ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, scale); - ipf.ip_wavelet (nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); + ipf.ip_wavelet(nprevl, nprevl, kall, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, scale); } @@ -3513,23 +3537,23 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) //L histo and Chroma histo for ciecam // histogram well be for Lab (Lch) values, because very difficult to do with J,Q, M, s, C int x1, y1, x2, y2; - params.crop.mapToResized (pW, pH, scale, x1, x2, y1, y2); + params.crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); lhist16CAM.clear(); lhist16CCAM.clear(); if (!params.colorappearance.datacie) { for (int x = 0; x < pH; x++) for (int y = 0; y < pW; y++) { - int pos = CLIP ((int) (nprevl->L[x][y])); - int posc = CLIP ((int)sqrt (nprevl->a[x][y] * nprevl->a[x][y] + nprevl->b[x][y] * nprevl->b[x][y])); + int pos = CLIP((int)(nprevl->L[x][y])); + int posc = CLIP((int)sqrt(nprevl->a[x][y] * nprevl->a[x][y] + nprevl->b[x][y] * nprevl->b[x][y])); lhist16CAM[pos]++; lhist16CCAM[posc]++; } } - CurveFactory::curveLightBrightColor (params.colorappearance.curve, params.colorappearance.curve2, params.colorappearance.curve3, - lhist16CAM, histLCAM, lhist16CCAM, histCCAM, - customColCurve1, customColCurve2, customColCurve3, 1); + CurveFactory::curveLightBrightColor(params.colorappearance.curve, params.colorappearance.curve2, params.colorappearance.curve3, + lhist16CAM, histLCAM, lhist16CCAM, histCCAM, + customColCurve1, customColCurve2, customColCurve3, 1); const FramesMetaData* metaData = imgsrc->getMetaData(); int imgNum = 0; @@ -3542,19 +3566,19 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) } } - float fnum = metaData->getFNumber (imgNum); // F number - float fiso = metaData->getISOSpeed (imgNum) ; // ISO - float fspeed = metaData->getShutterSpeed (imgNum) ; // Speed - double fcomp = metaData->getExpComp (imgNum); // Compensation +/- + float fnum = metaData->getFNumber(imgNum); // F number + float fiso = metaData->getISOSpeed(imgNum) ; // ISO + float fspeed = metaData->getShutterSpeed(imgNum) ; // Speed + double fcomp = metaData->getExpComp(imgNum); // Compensation +/- double adap; if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) { //if no exif data or wrong adap = 2000.; } else { - double E_V = fcomp + log2 (double ((fnum * fnum) / fspeed / (fiso / 100.f))); + double E_V = fcomp + log2(double ((fnum * fnum) / fspeed / (fiso / 100.f))); E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV - E_V += log2 (params.raw.expos); // exposure raw white point ; log2 ==> linear to EV - adap = powf (2.f, E_V - 3.f); // cd / m2 + E_V += log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV + adap = powf(2.f, E_V - 3.f); // cd / m2 // end calculation adaptation scene luminosity } @@ -3562,15 +3586,15 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) bool execsharp = false; if (!ncie) { - ncie = new CieImage (pW, pH); + ncie = new CieImage(pW, pH); } if (!CAMBrightCurveJ && (params.colorappearance.algo == "JC" || params.colorappearance.algo == "JS" || params.colorappearance.algo == "ALL")) { - CAMBrightCurveJ (32768, 0); + CAMBrightCurveJ(32768, 0); } if (!CAMBrightCurveQ && (params.colorappearance.algo == "QM" || params.colorappearance.algo == "ALL")) { - CAMBrightCurveQ (32768, 0); + CAMBrightCurveQ(32768, 0); } // Issue 2785, only float version of ciecam02 for navigator and pan background @@ -3578,18 +3602,18 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) CAMBrightCurveJ.dirty = true; CAMBrightCurveQ.dirty = true; - ipf.ciecam_02float (ncie, float (adap), pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); + ipf.ciecam_02float(ncie, float (adap), pW, 2, nprevl, ¶ms, customColCurve1, customColCurve2, customColCurve3, histLCAM, histCCAM, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, scale, execsharp, d, dj, yb, 1); if ((params.colorappearance.autodegree || params.colorappearance.autodegreeout) && acListener && params.colorappearance.enabled) { - acListener->autoCamChanged (100.* (double)d, 100.* (double)dj); + acListener->autoCamChanged(100.* (double)d, 100.* (double)dj); } if (params.colorappearance.autoadapscen && acListener && params.colorappearance.enabled) { - acListener->adapCamChanged (adap); //real value of adapt scene + acListener->adapCamChanged(adap); //real value of adapt scene } if (params.colorappearance.autoybscen && acListener && params.colorappearance.enabled) { - acListener->ybCamChanged ((int) yb); //real value Yb scene + acListener->ybCamChanged((int) yb); //real value Yb scene } readyphase++; @@ -3616,29 +3640,29 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) lastOutputProfile = params.icm.output; lastOutputIntent = params.icm.outputIntent; lastOutputBPC = params.icm.outputBPC; - ipf.updateColorProfiles (monitorProfile, monitorIntent, softProof, gamutCheck); + ipf.updateColorProfiles(monitorProfile, monitorIntent, softProof, gamutCheck); } // process crop, if needed for (size_t i = 0; i < crops.size(); i++) - if (crops[i]->hasListener () && cropCall != crops[i] ) { - crops[i]->update (todo); // may call ourselves + if (crops[i]->hasListener() && cropCall != crops[i]) { + crops[i]->update(todo); // may call ourselves } - progress ("Conversion to RGB...", 100 * readyphase / numofphases); + progress("Conversion to RGB...", 100 * readyphase / numofphases); if ((todo != CROP && todo != MINUPDATE) || (todo & M_MONITOR)) { - MyMutex::MyLock prevImgLock (previmg->getMutex()); + MyMutex::MyLock prevImgLock(previmg->getMutex()); try { // Computing the preview image, i.e. converting from WCS->Monitor color space (soft-proofing disabled) or WCS->Printer profile->Monitor color space (soft-proofing enabled) - ipf.lab2monitorRgb (nprevl, previmg); + ipf.lab2monitorRgb(nprevl, previmg); // Computing the internal image for analysis, i.e. conversion from WCS->Output profile delete workimg; - workimg = ipf.lab2rgb (nprevl, 0, 0, pW, pH, params.icm); + workimg = ipf.lab2rgb(nprevl, 0, 0, pW, pH, params.icm); } catch (char * str) { - progress ("Error converting file...", 0); + progress("Error converting file...", 0); return; } } @@ -3647,31 +3671,31 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) resultValid = true; if (imageListener) { - imageListener->setImage (previmg, scale, params.crop); + imageListener->setImage(previmg, scale, params.crop); } } if (imageListener) // TODO: The WB tool should be advertised too in order to get the AutoWB's temp and green values { - imageListener->imageReady (params.crop); + imageListener->imageReady(params.crop); } readyphase++; if (hListener) { - updateLRGBHistograms (); - hListener->histogramChanged (histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma, histLRETI); + updateLRGBHistograms(); + hListener->histogramChanged(histRed, histGreen, histBlue, histLuma, histToneCurve, histLCurve, histCCurve, /*histCLurve, histLLCurve,*/ histLCAM, histCCAM, histRedRaw, histGreenRaw, histBlueRaw, histChroma, histLRETI); } } -void ImProcCoordinator::freeAll () +void ImProcCoordinator::freeAll() { if (settings->verbose) { - printf ("freeall starts %d\n", (int)allocated); + printf("freeall starts %d\n", (int)allocated); } if (allocated) { @@ -3696,7 +3720,7 @@ void ImProcCoordinator::freeAll () ncie = nullptr; if (imageListener) { - imageListener->delImage (previmg); + imageListener->delImage(previmg); } else { delete previmg; } @@ -3720,50 +3744,50 @@ void ImProcCoordinator::freeAll () * * @param prevscale New Preview's scale. */ -void ImProcCoordinator::setScale (int prevscale) +void ImProcCoordinator::setScale(int prevscale) { if (settings->verbose) { - printf ("setscale before lock\n"); + printf("setscale before lock\n"); } - tr = getCoarseBitMask (params.coarse); + tr = getCoarseBitMask(params.coarse); int nW, nH; - imgsrc->getFullSize (fw, fh, tr); + imgsrc->getFullSize(fw, fh, tr); prevscale++; do { prevscale--; - PreviewProps pp (0, 0, fw, fh, prevscale); - imgsrc->getSize (pp, nW, nH); - } while (nH < 400 && prevscale > 1 && (nW * nH < 1000000) ); // sctually hardcoded values, perhaps a better choice is possible + PreviewProps pp(0, 0, fw, fh, prevscale); + imgsrc->getSize(pp, nW, nH); + } while (nH < 400 && prevscale > 1 && (nW * nH < 1000000)); // sctually hardcoded values, perhaps a better choice is possible if (settings->verbose) { - printf ("setscale starts (%d, %d)\n", nW, nH); + printf("setscale starts (%d, %d)\n", nW, nH); } if (nW != pW || nH != pH) { - freeAll (); + freeAll(); pW = nW; pH = nH; - orig_prev = new Imagefloat (pW, pH); + orig_prev = new Imagefloat(pW, pH); oprevi = orig_prev; - oprevl = new LabImage (pW, pH); - nprevl = new LabImage (pW, pH); - reserv = new LabImage (pW, pH); + oprevl = new LabImage(pW, pH); + nprevl = new LabImage(pW, pH); + reserv = new LabImage(pW, pH); // nprevloc = new LabImage (pW, pH); //ncie is only used in ImProcCoordinator::updatePreviewImage, it will be allocated on first use and deleted if not used anymore - previmg = new Image8 (pW, pH); - workimg = new Image8 (pW, pH); + previmg = new Image8(pW, pH); + workimg = new Image8(pW, pH); if (params.sh.enabled) { - shmap = new SHMap (pW, pH, true); + shmap = new SHMap(pW, pH, true); } allocated = true; @@ -3775,26 +3799,26 @@ void ImProcCoordinator::setScale (int prevscale) fullh = fh; if (settings->verbose) { - printf ("setscale ends\n"); + printf("setscale ends\n"); } if (!sizeListeners.empty()) for (size_t i = 0; i < sizeListeners.size(); i++) { - sizeListeners[i]->sizeChanged (fullw, fullh, fw, fh); + sizeListeners[i]->sizeChanged(fullw, fullh, fw, fh); } if (settings->verbose) { - printf ("setscale ends2\n"); + printf("setscale ends2\n"); } } -void ImProcCoordinator::updateLRGBHistograms () +void ImProcCoordinator::updateLRGBHistograms() { int x1, y1, x2, y2; - params.crop.mapToResized (pW, pH, scale, x1, x2, y1, y2); + params.crop.mapToResized(pW, pH, scale, x1, x2, y1, y2); #pragma omp parallel sections { @@ -3805,7 +3829,7 @@ void ImProcCoordinator::updateLRGBHistograms () for (int i = y1; i < y2; i++) for (int j = x1; j < x2; j++) { - histChroma[ (int) (sqrtf (SQR (nprevl->a[i][j]) + SQR (nprevl->b[i][j])) / 188.f)]++; //188 = 48000/256 + histChroma[(int)(sqrtf(SQR(nprevl->a[i][j]) + SQR(nprevl->b[i][j])) / 188.f)]++; //188 = 48000/256 } } #pragma omp section @@ -3815,7 +3839,7 @@ void ImProcCoordinator::updateLRGBHistograms () for (int i = y1; i < y2; i++) for (int j = x1; j < x2; j++) { - histLuma[ (int) (nprevl->L[i][j] / 128.f)]++; + histLuma[(int)(nprevl->L[i][j] / 128.f)]++; } } #pragma omp section @@ -3843,7 +3867,7 @@ void ImProcCoordinator::updateLRGBHistograms () } -void ImProcCoordinator::progress (Glib::ustring str, int pr) +void ImProcCoordinator::progress(Glib::ustring str, int pr) { /* if (plistener) { @@ -3852,28 +3876,28 @@ void ImProcCoordinator::progress (Glib::ustring str, int pr) }*/ } -bool ImProcCoordinator::getAutoWB (double& temp, double& green, double equal, double tempBias) +bool ImProcCoordinator::getAutoWB(double& temp, double& green, double equal, double tempBias) { if (imgsrc) { if (lastAwbEqual != equal || lastAwbTempBias != tempBias) { // Issue 2500 MyMutex::MyLock lock(minit); // Also used in crop window double rm, gm, bm; - imgsrc->getAutoWBMultipliers (rm, gm, bm); + imgsrc->getAutoWBMultipliers(rm, gm, bm); if (rm != -1) { - autoWB.update (rm, gm, bm, equal, tempBias); + autoWB.update(rm, gm, bm, equal, tempBias); lastAwbEqual = equal; lastAwbTempBias = tempBias; } else { lastAwbEqual = -1.; - autoWB.useDefaults (equal); + autoWB.useDefaults(equal); lastAwbTempBias = 0.0; } } - temp = autoWB.getTemp (); - green = autoWB.getGreen (); + temp = autoWB.getTemp(); + green = autoWB.getGreen(); return true; } else { //temp = autoWB.getTemp(); @@ -3883,64 +3907,64 @@ bool ImProcCoordinator::getAutoWB (double& temp, double& green, double equal, do } } -void ImProcCoordinator::getCamWB (double & temp, double & green) +void ImProcCoordinator::getCamWB(double & temp, double & green) { if (imgsrc) { - temp = imgsrc->getWB().getTemp (); - green = imgsrc->getWB().getGreen (); + temp = imgsrc->getWB().getTemp(); + green = imgsrc->getWB().getGreen(); } } -void ImProcCoordinator::getSpotWB (int x, int y, int rect, double & temp, double & tgreen) +void ImProcCoordinator::getSpotWB(int x, int y, int rect, double & temp, double & tgreen) { ColorTemp ret; { - MyMutex::MyLock lock (mProcessing); + MyMutex::MyLock lock(mProcessing); std::vector points, red, green, blue; for (int i = y - rect; i <= y + rect; i++) for (int j = x - rect; j <= x + rect; j++) { - points.push_back (Coord2D (j, i)); + points.push_back(Coord2D(j, i)); } - ipf.transCoord (fw, fh, points, red, green, blue); + ipf.transCoord(fw, fh, points, red, green, blue); - int tr = getCoarseBitMask (params.coarse); + int tr = getCoarseBitMask(params.coarse); - ret = imgsrc->getSpotWB (red, green, blue, tr, params.wb.equal); - currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + ret = imgsrc->getSpotWB(red, green, blue, tr, params.wb.equal); + currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); //double rr,gg,bb; //currWB.getMultipliers(rr,gg,bb); } // end of mutex lockong if (ret.getTemp() > 0) { - temp = ret.getTemp (); - tgreen = ret.getGreen (); + temp = ret.getTemp(); + tgreen = ret.getGreen(); } else { - temp = currWB.getTemp (); - tgreen = currWB.getGreen (); + temp = currWB.getTemp(); + tgreen = currWB.getGreen(); } } -void ImProcCoordinator::getAutoCrop (double ratio, int &x, int &y, int &w, int &h) +void ImProcCoordinator::getAutoCrop(double ratio, int &x, int &y, int &w, int &h) { - MyMutex::MyLock lock (mProcessing); + MyMutex::MyLock lock(mProcessing); LensCorrection *pLCPMap = nullptr; if (params.lensProf.useLcp() && imgsrc->getMetaData()->getFocalLen() > 0) { - const std::shared_ptr pLCPProf = LCPStore::getInstance()->getProfile (params.lensProf.lcpFile); + const std::shared_ptr pLCPProf = LCPStore::getInstance()->getProfile(params.lensProf.lcpFile); - if (pLCPProf) pLCPMap = new LCPMapper (pLCPProf, imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), - 0, false, params.lensProf.useDist, fullw, fullh, params.coarse, imgsrc->getRotateDegree()); + if (pLCPProf) pLCPMap = new LCPMapper(pLCPProf, imgsrc->getMetaData()->getFocalLen(), imgsrc->getMetaData()->getFocalLen35mm(), imgsrc->getMetaData()->getFocusDist(), + 0, false, params.lensProf.useDist, fullw, fullh, params.coarse, imgsrc->getRotateDegree()); } - double fillscale = ipf.getTransformAutoFill (fullw, fullh, pLCPMap); + double fillscale = ipf.getTransformAutoFill(fullw, fullh, pLCPMap); if (ratio > 0) { w = fullw * fillscale; @@ -3959,64 +3983,64 @@ void ImProcCoordinator::getAutoCrop (double ratio, int &x, int &y, int &w, int & y = (fullh - h) / 2; } -void ImProcCoordinator::setMonitorProfile (const Glib::ustring & profile, RenderingIntent intent) +void ImProcCoordinator::setMonitorProfile(const Glib::ustring & profile, RenderingIntent intent) { monitorProfile = profile; monitorIntent = intent; } -void ImProcCoordinator::getMonitorProfile (Glib::ustring & profile, RenderingIntent & intent) const +void ImProcCoordinator::getMonitorProfile(Glib::ustring & profile, RenderingIntent & intent) const { profile = monitorProfile; intent = monitorIntent; } -void ImProcCoordinator::setSoftProofing (bool softProof, bool gamutCheck) +void ImProcCoordinator::setSoftProofing(bool softProof, bool gamutCheck) { this->softProof = softProof; this->gamutCheck = gamutCheck; } -void ImProcCoordinator::getSoftProofing (bool & softProof, bool & gamutCheck) +void ImProcCoordinator::getSoftProofing(bool & softProof, bool & gamutCheck) { softProof = this->softProof; gamutCheck = this->gamutCheck; } -void ImProcCoordinator::saveInputICCReference (const Glib::ustring & fname, bool apply_wb) +void ImProcCoordinator::saveInputICCReference(const Glib::ustring & fname, bool apply_wb) { - MyMutex::MyLock lock (mProcessing); + MyMutex::MyLock lock(mProcessing); int fW, fH; - int tr = getCoarseBitMask (params.coarse); + int tr = getCoarseBitMask(params.coarse); - imgsrc->getFullSize (fW, fH, tr); - PreviewProps pp (0, 0, fW, fH, 1); + imgsrc->getFullSize(fW, fH, tr); + PreviewProps pp(0, 0, fW, fH, 1); ProcParams ppar = params; ppar.toneCurve.hrenabled = false; ppar.icm.input = "(none)"; - Imagefloat* im = new Imagefloat (fW, fH); - imgsrc->preprocess ( ppar.raw, ppar.lensProf, ppar.coarse ); - imgsrc->demosaic (ppar.raw ); - ColorTemp currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + Imagefloat* im = new Imagefloat(fW, fH); + imgsrc->preprocess(ppar.raw, ppar.lensProf, ppar.coarse); + imgsrc->demosaic(ppar.raw); + ColorTemp currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); if (params.wb.method == "Camera") { - currWB = imgsrc->getWB (); + currWB = imgsrc->getWB(); } else if (params.wb.method == "Auto") { if (lastAwbEqual != params.wb.equal || lastAwbTempBias != params.wb.tempBias) { double rm, gm, bm; - imgsrc->getAutoWBMultipliers (rm, gm, bm); + imgsrc->getAutoWBMultipliers(rm, gm, bm); if (rm != -1.) { - autoWB.update (rm, gm, bm, params.wb.equal, params.wb.tempBias); + autoWB.update(rm, gm, bm, params.wb.equal, params.wb.tempBias); lastAwbEqual = params.wb.equal; lastAwbTempBias = params.wb.tempBias; } else { lastAwbEqual = -1.; lastAwbTempBias = 0.0; - autoWB.useDefaults (params.wb.equal); + autoWB.useDefaults(params.wb.equal); } } @@ -4027,19 +4051,19 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring & fname, bool currWB = ColorTemp(); // = no white balance } - imgsrc->getImage (currWB, tr, im, pp, ppar.toneCurve, ppar.raw); - ImProcFunctions ipf (&ppar, true); + imgsrc->getImage(currWB, tr, im, pp, ppar.toneCurve, ppar.raw); + ImProcFunctions ipf(&ppar, true); if (ipf.needsTransform()) { - Imagefloat* trImg = new Imagefloat (fW, fH); - ipf.transform (im, trImg, 0, 0, 0, 0, fW, fH, fW, fH, - imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); + Imagefloat* trImg = new Imagefloat(fW, fH); + ipf.transform(im, trImg, 0, 0, 0, 0, fW, fH, fW, fH, + imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); delete im; im = trImg; } if (params.crop.enabled) { - Imagefloat *tmpim = new Imagefloat (params.crop.w, params.crop.h); + Imagefloat *tmpim = new Imagefloat(params.crop.w, params.crop.h); int cx = params.crop.x; int cy = params.crop.y; int cw = params.crop.w; @@ -4048,9 +4072,9 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring & fname, bool for (int i = cy; i < cy + ch; i++) { for (int j = cx; j < cx + cw; j++) { - tmpim->r (i - cy, j - cx) = im->r (i, j); - tmpim->g (i - cy, j - cx) = im->g (i, j); - tmpim->b (i - cy, j - cx) = im->b (i, j); + tmpim->r(i - cy, j - cx) = im->r(i, j); + tmpim->g(i - cy, j - cx) = im->g(i, j); + tmpim->b(i - cy, j - cx) = im->b(i, j); } } @@ -4063,9 +4087,9 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring & fname, bool for (int i = 0; i < im->getHeight(); i++) { for (int j = 0; j < im->getWidth(); j++) { - im->r (i, j) = CLIP (im->r (i, j)); - im->g (i, j) = CLIP (im->g (i, j)); - im->b (i, j) = CLIP (im->b (i, j)); + im->r(i, j) = CLIP(im->r(i, j)); + im->g(i, j) = CLIP(im->g(i, j)); + im->b(i, j) = CLIP(im->b(i, j)); } } @@ -4073,115 +4097,115 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring & fname, bool delete im; int imw, imh; - double tmpScale = ipf.resizeScale (¶ms, fW, fH, imw, imh); + double tmpScale = ipf.resizeScale(¶ms, fW, fH, imw, imh); if (tmpScale != 1.0) { - Image16* tempImage = new Image16 (imw, imh); - ipf.resize (im16, tempImage, tmpScale); + Image16* tempImage = new Image16(imw, imh); + ipf.resize(im16, tempImage, tmpScale); delete im16; im16 = tempImage; } - im16->saveTIFF (fname, 16, true); + im16->saveTIFF(fname, 16, true); delete im16; if (plistener) { - plistener->setProgressState (false); + plistener->setProgressState(false); } //im->saveJPEG (fname, 85); } -void ImProcCoordinator::stopProcessing () +void ImProcCoordinator::stopProcessing() { - updaterThreadStart.lock (); + updaterThreadStart.lock(); if (updaterRunning && thread) { changeSinceLast = 0; - thread->join (); + thread->join(); } - updaterThreadStart.unlock (); + updaterThreadStart.unlock(); } -void ImProcCoordinator::startProcessing () +void ImProcCoordinator::startProcessing() { #undef THREAD_PRIORITY_NORMAL if (!destroying) { if (!updaterRunning) { - updaterThreadStart.lock (); + updaterThreadStart.lock(); thread = nullptr; updaterRunning = true; - updaterThreadStart.unlock (); + updaterThreadStart.unlock(); //batchThread->yield(); //the running batch should wait other threads to avoid conflict - thread = Glib::Thread::create (sigc::mem_fun (*this, &ImProcCoordinator::process), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); + thread = Glib::Thread::create(sigc::mem_fun(*this, &ImProcCoordinator::process), 0, true, true, Glib::THREAD_PRIORITY_NORMAL); } } } -void ImProcCoordinator::startProcessing (int changeCode) +void ImProcCoordinator::startProcessing(int changeCode) { paramsUpdateMutex.lock(); changeSinceLast |= changeCode; paramsUpdateMutex.unlock(); - startProcessing (); + startProcessing(); } -void ImProcCoordinator::process () +void ImProcCoordinator::process() { if (plistener) { - plistener->setProgressState (true); + plistener->setProgressState(true); } - paramsUpdateMutex.lock (); + paramsUpdateMutex.lock(); while (changeSinceLast) { params = nextParams; int change = changeSinceLast; changeSinceLast = 0; - paramsUpdateMutex.unlock (); + paramsUpdateMutex.unlock(); // M_VOID means no update, and is a bit higher that the rest if (change & (M_VOID - 1)) { - updatePreviewImage (change); + updatePreviewImage(change); } - paramsUpdateMutex.lock (); + paramsUpdateMutex.lock(); } - paramsUpdateMutex.unlock (); + paramsUpdateMutex.unlock(); updaterRunning = false; if (plistener) { - plistener->setProgressState (false); + plistener->setProgressState(false); } } -ProcParams* ImProcCoordinator::beginUpdateParams () +ProcParams* ImProcCoordinator::beginUpdateParams() { - paramsUpdateMutex.lock (); + paramsUpdateMutex.lock(); return &nextParams; } -void ImProcCoordinator::endUpdateParams (ProcEvent change) +void ImProcCoordinator::endUpdateParams(ProcEvent change) { - endUpdateParams ( refreshmap[ (int)change] ); + endUpdateParams(refreshmap[(int)change]); } -void ImProcCoordinator::endUpdateParams (int changeFlags) +void ImProcCoordinator::endUpdateParams(int changeFlags) { changeSinceLast |= changeFlags; - paramsUpdateMutex.unlock (); - startProcessing (); + paramsUpdateMutex.unlock(); + startProcessing(); } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 8bb4462f5..28ab288ea 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -89,7 +89,7 @@ protected: bool highDetailRawComputed; bool allocated; - void freeAll (); + void freeAll(); // Precomputed values used by DetailedCrop ---------------------------------------------- @@ -199,11 +199,11 @@ protected: MyMutex minit; // to gain mutually exclusive access to ... to what exactly? - void progress (Glib::ustring str, int pr); - void reallocAll (); - void updateLRGBHistograms (); - void setScale (int prevscale); - void updatePreviewImage (int todo, Crop* cropCall = nullptr); + void progress(Glib::ustring str, int pr); + void reallocAll(); + void updateLRGBHistograms(); + void setScale(int prevscale); + void updatePreviewImage(int todo, Crop* cropCall = nullptr); MyMutex mProcessing; ProcParams params; @@ -353,6 +353,7 @@ protected: LUTi exclumets; LUTi sensiexclus; LUTi strucs; + LUTi warms; LUTf huerefs; LUTf chromarefs; @@ -360,162 +361,162 @@ protected: LUTf sobelrefs; double huer, chromar, lumar, sobeler; - void startProcessing (); - void process (); + void startProcessing(); + void process(); float colourToningSatLimit; float colourToningSatLimitOpacity; public: - ImProcCoordinator (); - ~ImProcCoordinator (); - void assign (ImageSource* imgsrc); + ImProcCoordinator(); + ~ImProcCoordinator(); + void assign(ImageSource* imgsrc); - void getParams (procparams::ProcParams* dst) + void getParams(procparams::ProcParams* dst) { *dst = params; } - void startProcessing (int changeCode); - ProcParams* beginUpdateParams (); - void endUpdateParams (ProcEvent change); // must be called after beginUpdateParams, triggers update - void endUpdateParams (int changeFlags); - void stopProcessing (); + void startProcessing(int changeCode); + ProcParams* beginUpdateParams(); + void endUpdateParams(ProcEvent change); // must be called after beginUpdateParams, triggers update + void endUpdateParams(int changeFlags); + void stopProcessing(); // void updatePreviewImage (int todo, Crop* cropCall = NULL); std::string *retistrsav; - void setPreviewScale (int scale) + void setPreviewScale(int scale) { - setScale (scale); + setScale(scale); } - int getPreviewScale () + int getPreviewScale() { return scale; } //void fullUpdatePreviewImage (); - int getFullWidth () + int getFullWidth() { return fullw; } - int getFullHeight () + int getFullHeight() { return fullh; } - int getPreviewWidth () + int getPreviewWidth() { return pW; } - int getPreviewHeight () + int getPreviewHeight() { return pH; } - DetailedCrop* createCrop (::EditDataProvider *editDataProvider, bool isDetailWindow); + DetailedCrop* createCrop(::EditDataProvider *editDataProvider, bool isDetailWindow); - bool getAutoWB (double& temp, double& green, double equal, double tempBias); - void getCamWB (double& temp, double& green); - void getSpotWB (int x, int y, int rectSize, double& temp, double& green); - void getAutoCrop (double ratio, int &x, int &y, int &w, int &h); + bool getAutoWB(double& temp, double& green, double equal, double tempBias); + void getCamWB(double& temp, double& green); + void getSpotWB(int x, int y, int rectSize, double& temp, double& green); + void getAutoCrop(double ratio, int &x, int &y, int &w, int &h); - void setMonitorProfile (const Glib::ustring& profile, RenderingIntent intent); - void getMonitorProfile (Glib::ustring& profile, RenderingIntent& intent) const; - void setSoftProofing (bool softProof, bool gamutCheck); - void getSoftProofing (bool &softProof, bool &gamutCheck); + void setMonitorProfile(const Glib::ustring& profile, RenderingIntent intent); + void getMonitorProfile(Glib::ustring& profile, RenderingIntent& intent) const; + void setSoftProofing(bool softProof, bool gamutCheck); + void getSoftProofing(bool &softProof, bool &gamutCheck); - bool updateTryLock () + bool updateTryLock() { return updaterThreadStart.trylock(); } - void updateUnLock () + void updateUnLock() { updaterThreadStart.unlock(); } - void setProgressListener (ProgressListener* pl) + void setProgressListener(ProgressListener* pl) { plistener = pl; } - void setPreviewImageListener (PreviewImageListener* il) + void setPreviewImageListener(PreviewImageListener* il) { imageListener = il; } - void setSizeListener (SizeListener* il) + void setSizeListener(SizeListener* il) { - sizeListeners.push_back (il); + sizeListeners.push_back(il); } - void delSizeListener (SizeListener* il) + void delSizeListener(SizeListener* il) { - std::vector::iterator it = std::find (sizeListeners.begin(), sizeListeners.end(), il); + std::vector::iterator it = std::find(sizeListeners.begin(), sizeListeners.end(), il); if (it != sizeListeners.end()) { - sizeListeners.erase (it); + sizeListeners.erase(it); } } - void setAutoExpListener (AutoExpListener* ael) + void setAutoExpListener(AutoExpListener* ael) { aeListener = ael; } - void setHistogramListener (HistogramListener *h) + void setHistogramListener(HistogramListener *h) { hListener = h; } - void setAutoCamListener (AutoCamListener* acl) + void setAutoCamListener(AutoCamListener* acl) { acListener = acl; } - void setAutoBWListener (AutoBWListener* abw) + void setAutoBWListener(AutoBWListener* abw) { abwListener = abw; } - void setlocalListener (localListener* alo) + void setlocalListener(localListener* alo) { aloListener = alo; } - void setAutoWBListener (AutoWBListener* awb) + void setAutoWBListener(AutoWBListener* awb) { awbListener = awb; } - void setAutoColorTonListener (AutoColorTonListener* bwct) + void setAutoColorTonListener(AutoColorTonListener* bwct) { actListener = bwct; } - void setAutoChromaListener (AutoChromaListener* adn) + void setAutoChromaListener(AutoChromaListener* adn) { adnListener = adn; } - void setRetinexListener (RetinexListener* adh) + void setRetinexListener(RetinexListener* adh) { dehaListener = adh; } - void setWaveletListener (WaveletListener* awa) + void setWaveletListener(WaveletListener* awa) { awavListener = awa; } - void setFrameCountListener (FrameCountListener* fcl) + void setFrameCountListener(FrameCountListener* fcl) { frameCountListener = fcl; } - void setImageTypeListener (ImageTypeListener* itl) + void setImageTypeListener(ImageTypeListener* itl) { imageTypeListener = itl; } - void saveInputICCReference (const Glib::ustring& fname, bool apply_wb); + void saveInputICCReference(const Glib::ustring& fname, bool apply_wb); - InitialImage* getInitialImage () + InitialImage* getInitialImage() { return imgsrc; } struct DenoiseInfoStore { - DenoiseInfoStore () : chM (0), max_r{}, max_b{}, ch_M{}, valid (false) {} + DenoiseInfoStore() : chM(0), max_r{}, max_b{}, ch_M{}, valid(false) {} float chM; float max_r[9]; float max_b[9]; diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index a21ec7dcd..74b77facf 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -440,11 +440,11 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L } // extracting datas from 'params' to avoid cache flush (to be confirmed) - ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode; - ColorAppearanceParams::eTCModeId 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::eCTCModeId curveMode3 = params->colorappearance.curveMode3; + ColorAppearanceParams::CtcMode curveMode3 = params->colorappearance.curveMode3; bool hasColCurve3 = bool (customColCurve3); @@ -803,7 +803,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { /* float Jj=(float) Jpro*327.68; float Jold=Jj; const Lightcurve& userColCurve = static_cast(customColCurve1); @@ -841,7 +841,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L } t1L = true; - } else if (curveMode == ColorAppearanceParams::TC_MODE_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; @@ -889,7 +889,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode2 == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68; float Jold = Jj; /* @@ -932,7 +932,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L Jpro = 1.; } - } else if (curveMode2 == ColorAppearanceParams::TC_MODE_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); @@ -990,7 +990,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Cc = (float) Cpro * coef; @@ -1014,7 +1014,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L } // Cpro=Cc/coef; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { // double parsat = 0.8; //0.6 double coef = 327.68 / parsat; float Ss = (float) spro * coef; @@ -1034,7 +1034,7 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L Cpro = (spro * spro * Qpro) / (10000.0); c1s = 1; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { // double parsat = 0.8; //0.68; double coef = 327.68 / parsat; float Mm = (float) Mpro * coef; @@ -1119,21 +1119,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1304,9 +1304,9 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L // if (params->dirpyrequalizer.algo=="FI") choice=0; // else if(params->dirpyrequalizer.algo=="LA") choice=1; if (rtt == 1) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, b_l, t_l, t_r, scale); //contrast by detail adapted to CIECAM } } @@ -1380,21 +1380,21 @@ void ImProcFunctions::ciecam_02 (CieImage* ncie, double adap, int pW, int pwb, L int libr = 0; int colch = 0; - if (curveMode == ColorAppearanceParams::TC_MODE_BRIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::BRIGHT) { brli = 70.0; libr = 1; - } else if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + } else if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { brli = 327.; libr = 0; } - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.;//327.; colch = 0; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0; colch = 1; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_COLORF) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { chsacol = 400.;//327.0; colch = 2; } @@ -1754,14 +1754,14 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw const float rstprotection = 100. - params->colorappearance.rstprotection; // extracting datas from 'params' to avoid cache flush (to be confirmed) - const ColorAppearanceParams::eTCModeId curveMode = params->colorappearance.curveMode; + const ColorAppearanceParams::TcMode curveMode = params->colorappearance.curveMode; const bool hasColCurve1 = bool (customColCurve1); - const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TC_MODE_LIGHT; + const bool t1L = hasColCurve1 && curveMode == ColorAppearanceParams::TcMode::LIGHT; - const ColorAppearanceParams::eTCModeId curveMode2 = params->colorappearance.curveMode2; + const ColorAppearanceParams::TcMode curveMode2 = params->colorappearance.curveMode2; const bool hasColCurve2 = bool (customColCurve2); - const ColorAppearanceParams::eCTCModeId curveMode3 = params->colorappearance.curveMode3; + const ColorAppearanceParams::CtcMode curveMode3 = params->colorappearance.curveMode3; const bool hasColCurve3 = bool (customColCurve3); bool needJ = (alg == 0 || alg == 1 || alg == 3); @@ -2214,7 +2214,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw } if (hasColCurve1) {//curve 1 with Lightness and Brightness - if (curveMode == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2243,7 +2243,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw if (Jpro < 1.f) { Jpro = 1.f; } - } else if (curveMode == ColorAppearanceParams::TC_MODE_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; @@ -2287,7 +2287,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw } if (hasColCurve2) {//curve 2 with Lightness and Brightness - if (curveMode2 == ColorAppearanceParams::TC_MODE_LIGHT) { + if (curveMode2 == ColorAppearanceParams::TcMode::LIGHT) { float Jj = (float) Jpro * 327.68f; float Jold = Jj; float Jold100 = (float) Jpro; @@ -2325,7 +2325,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw Jpro = 1.f; } - } else if (curveMode2 == ColorAppearanceParams::TC_MODE_BRIGHT) { // + } else if (curveMode2 == ColorAppearanceParams::TcMode::BRIGHT) { // float Qanc = Qpro; float coef = ((aw + 4.f) * (4.f / c)) / 100.f; @@ -2382,7 +2382,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw } if (hasColCurve3) {//curve 3 with chroma saturation colorfullness - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Cc = (float) Cpro * coef; @@ -2405,7 +2405,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw Cpro = 50.f; } */ - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_SATUR) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { // float parsat = 0.8f; //0.6 float coef = 327.68f / parsat; float Ss = (float) spro * coef; @@ -2422,7 +2422,7 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw 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::TC_MODE_COLORF) { // + } else if (curveMode3 == ColorAppearanceParams::CtcMode::COLORF) { // float parsat = 0.8f; //0.68; float coef = 327.68f / parsat; float Mm = (float) Mpro * coef; @@ -2492,10 +2492,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw float colch; //update histogram - if (curveMode == ColorAppearanceParams::TC_MODE_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::TC_MODE_LIGHT)*/ + } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ brli = 327.f; libr = J; //327 for J } @@ -2503,13 +2503,13 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::TC_MODE_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::TC_MODE_SATUR) { + } else if (curveMode3 == ColorAppearanceParams::CtcMode::SATUR) { chsacol = 450.0f; colch = s; - } else { /*if(curveMode3 == ColorAppearanceParams::TC_MODE_COLORF)*/ + } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ chsacol = 400.0f;//327 colch = M; } @@ -2745,9 +2745,9 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw // else if(params->dirpyrequalizer.algo=="LA") choice=1; if (rtt == 1) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; lab->deleteLab(); dirpyr_equalizercam (ncie, ncie->sh_p, ncie->sh_p, ncie->W, ncie->H, ncie->h_p, ncie->C_p, params->dirpyrequalizer.mult, params->dirpyrequalizer.threshold, params->dirpyrequalizer.skinprotect, true, b_l, t_l, t_r, scale); //contrast by detail adapted to CIECAM lab->reallocLab(); @@ -2839,10 +2839,10 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw float libr; float colch; - if (curveMode == ColorAppearanceParams::TC_MODE_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::TC_MODE_LIGHT)*/ + } else { /*if(curveMode == ColorAppearanceParams::TCMode::LIGHT)*/ brli = 327.f; libr = ncie->J_p[i][j]; //327 for J } @@ -2850,13 +2850,13 @@ void ImProcFunctions::ciecam_02float (CieImage* ncie, float adap, int pW, int pw posl = (int) (libr * brli); hist16JCAM[posl]++; - if (curveMode3 == ColorAppearanceParams::TC_MODE_CHROMA) { + if (curveMode3 == ColorAppearanceParams::CtcMode::CHROMA) { chsacol = 400.f;//327.f; colch = ncie_C_p; - } else if (curveMode3 == ColorAppearanceParams::TC_MODE_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::TC_MODE_COLORF)*/ + } else { /*if(curveMode3 == ColorAppearanceParams::CTCMode::COLORF)*/ chsacol = 400.f;//327.0f; colch = ncie->M_p[i][j]; } @@ -3256,25 +3256,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::eTCModeId curveMode = params->toneCurve.curveMode; - ToneCurveParams::eTCModeId 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::TC_MODE_PERCEPTUAL) { + if (hasToneCurve1 && curveMode == ToneCurveParams::TcMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve1); userToneCurve.initApplyState (ptc1ApplyState, params->icm.working); } - if (hasToneCurve2 && curveMode2 == ToneCurveParams::TC_MODE_PERCEPTUAL) { + if (hasToneCurve2 && curveMode2 == ToneCurveParams::TcMode::PERCEPTUAL) { const PerceptualToneCurve& userToneCurve = static_cast (customToneCurve2); userToneCurve.initApplyState (ptc2ApplyState, params->icm.working); } @@ -3323,8 +3323,8 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer float RedHigh = (100.f + float (params->colorToning.redhigh)) / 100.f; //printf("RedH=%f\n",RedHigh); float GreenHigh = (100.f + float (params->colorToning.greenhigh)) / 100.f; float BlueHigh = (100.f + float (params->colorToning.bluehigh)) / 100.f; - float SatLow = float (params->colorToning.shadowsColSat.value[0]) / 100.f; - float SatHigh = float (params->colorToning.hlColSat.value[0]) / 100.f; + float SatLow = float (params->colorToning.shadowsColSat.getBottom()) / 100.f; + float SatHigh = float (params->colorToning.hlColSat.getBottom()) / 100.f; float Balan = float (params->colorToning.balance); @@ -3627,21 +3627,21 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve1) { - if (curveMode == ToneCurveParams::TC_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::TC_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::TC_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); @@ -3651,7 +3651,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::TC_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++) { @@ -3662,7 +3662,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::TC_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++) { @@ -3673,7 +3673,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::TC_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++) { @@ -3698,28 +3698,28 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } if (hasToneCurve2) { - if (curveMode2 == ToneCurveParams::TC_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::TC_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::TC_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::TC_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++) { @@ -3727,7 +3727,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::TC_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++) { @@ -3735,7 +3735,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::TC_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++) { @@ -4198,21 +4198,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 StandardToneCurve& 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 AdobeToneCurve& 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 SatAndValueBlendingToneCurve& userToneCurvebw = static_cast (customToneCurvebw1); @@ -4222,7 +4222,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 WeightedStdToneCurve& userToneCurvebw = static_cast (customToneCurvebw1); @@ -4658,7 +4658,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 @@ -4669,7 +4669,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 @@ -6499,9 +6499,9 @@ void ImProcFunctions::badpixlab (LabImage* lab, double rad, int thr, int mode, f void ImProcFunctions::dirpyrequalizer (LabImage* lab, int scale) { if (params->dirpyrequalizer.enabled && lab->W >= 8 && lab->H >= 8) { - float b_l = static_cast (params->dirpyrequalizer.hueskin.value[0]) / 100.0f; - float t_l = static_cast (params->dirpyrequalizer.hueskin.value[1]) / 100.0f; - float t_r = static_cast (params->dirpyrequalizer.hueskin.value[3]) / 100.0f; + float b_l = static_cast (params->dirpyrequalizer.hueskin.getBottomLeft()) / 100.0f; + float t_l = static_cast (params->dirpyrequalizer.hueskin.getTopLeft()) / 100.0f; + float t_r = static_cast (params->dirpyrequalizer.hueskin.getTopRight()) / 100.0f; // if (params->dirpyrequalizer.algo=="FI") choice=0; // else if(params->dirpyrequalizer.algo=="LA") choice=1; float artifact = (float) settings->artifact_cbdl; diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index 68efd1aea..f17d5d9b1 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -126,7 +126,7 @@ void ImProcFunctions::vibrance (LabImage* lab) const float chromaPastel = float (params->vibrance.pastels) / 100.0f; const float chromaSatur = float (params->vibrance.saturated) / 100.0f; const float p00 = 0.07f; - const float limitpastelsatur = (static_cast (params->vibrance.psthreshold.value[ThresholdSelector::TS_TOPLEFT]) / 100.0f) * (1.0f - p00) + p00; + const float limitpastelsatur = (static_cast(params->vibrance.psthreshold.getTopLeft()) / 100.0f) * (1.0f - p00) + p00; const float maxdp = (limitpastelsatur - p00) / 4.0f; const float maxds = (1.0 - limitpastelsatur) / 4.0f; const float p0 = p00 + maxdp; @@ -135,7 +135,7 @@ void ImProcFunctions::vibrance (LabImage* lab) const float s0 = limitpastelsatur + maxds; const float s1 = limitpastelsatur + 2.0f * maxds; const float s2 = limitpastelsatur + 3.0f * maxds; - const float transitionweighting = static_cast (params->vibrance.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]) / 100.0f; + const float transitionweighting = static_cast(params->vibrance.psthreshold.getBottomLeft()) / 100.0f; float chromamean = 0.0f; if (chromaPastel != chromaSatur) { diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index 750d455bb..a2e81e18f 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -431,56 +431,56 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int cp.thH = float (waparams.thrH); cp.sky = waparams.sky; //skin - cp.b_l = static_cast (params->wavelet.hueskin.value[0]) / 100.0f; - cp.t_l = static_cast (params->wavelet.hueskin.value[1]) / 100.0f; - cp.b_r = static_cast (params->wavelet.hueskin.value[2]) / 100.0f; - cp.t_r = static_cast (params->wavelet.hueskin.value[3]) / 100.0f; + cp.b_l = static_cast(params->wavelet.hueskin.getBottomLeft()) / 100.0f; + cp.t_l = static_cast(params->wavelet.hueskin.getTopLeft()) / 100.0f; + cp.b_r = static_cast(params->wavelet.hueskin.getBottomRight()) / 100.0f; + cp.t_r = static_cast(params->wavelet.hueskin.getTopRight()) / 100.0f; - cp.b_ly = static_cast (params->wavelet.hueskin2.value[0]) / 100.0f; - cp.t_ly = static_cast (params->wavelet.hueskin2.value[1]) / 100.0f; - cp.b_ry = static_cast (params->wavelet.hueskin2.value[2]) / 100.0f; - cp.t_ry = static_cast (params->wavelet.hueskin2.value[3]) / 100.0f; + cp.b_ly = static_cast(params->wavelet.hueskin2.getBottomLeft()) / 100.0f; + cp.t_ly = static_cast(params->wavelet.hueskin2.getTopLeft()) / 100.0f; + cp.b_ry = static_cast(params->wavelet.hueskin2.getBottomRight()) / 100.0f; + cp.t_ry = static_cast(params->wavelet.hueskin2.getTopRight()) / 100.0f; cp.numlevH = params->wavelet.threshold; //shadows - cp.b_lsl = static_cast (params->wavelet.bllev.value[0]); - cp.t_lsl = static_cast (params->wavelet.bllev.value[1]); - cp.b_rsl = static_cast (params->wavelet.bllev.value[2]); - cp.t_rsl = static_cast (params->wavelet.bllev.value[3]); + cp.b_lsl = static_cast(params->wavelet.bllev.getBottomLeft()); + cp.t_lsl = static_cast(params->wavelet.bllev.getTopLeft()); + cp.b_rsl = static_cast(params->wavelet.bllev.getBottomRight()); + cp.t_rsl = static_cast(params->wavelet.bllev.getTopRight()); cp.numlevS = params->wavelet.threshold2; int maxlevS = 9 - cp.numlevH; cp.numlevS = MIN (cp.numlevS, maxlevS); //printf("levHigh=%d levShad=%d\n",cp.numlevH,cp.numlevS); //highlight - cp.b_lhl = static_cast (params->wavelet.hllev.value[0]); - cp.t_lhl = static_cast (params->wavelet.hllev.value[1]); - cp.b_rhl = static_cast (params->wavelet.hllev.value[2]); - cp.t_rhl = static_cast (params->wavelet.hllev.value[3]); + cp.b_lhl = static_cast(params->wavelet.hllev.getBottomLeft()); + cp.t_lhl = static_cast(params->wavelet.hllev.getTopLeft()); + cp.b_rhl = static_cast(params->wavelet.hllev.getBottomRight()); + cp.t_rhl = static_cast(params->wavelet.hllev.getTopRight()); //printf("BL=%f TL=%f BR=%f TR=%f\n",cp.b_lhl,cp.t_lhl,cp.b_rhl,cp.t_rhl); //pastel - cp.b_lpast = static_cast (params->wavelet.pastlev.value[0]); - cp.t_lpast = static_cast (params->wavelet.pastlev.value[1]); - cp.b_rpast = static_cast (params->wavelet.pastlev.value[2]); - cp.t_rpast = static_cast (params->wavelet.pastlev.value[3]); + cp.b_lpast = static_cast(params->wavelet.pastlev.getBottomLeft()); + cp.t_lpast = static_cast(params->wavelet.pastlev.getTopLeft()); + cp.b_rpast = static_cast(params->wavelet.pastlev.getBottomRight()); + cp.t_rpast = static_cast(params->wavelet.pastlev.getTopRight()); //saturated - cp.b_lsat = static_cast (params->wavelet.satlev.value[0]); - cp.t_lsat = static_cast (params->wavelet.satlev.value[1]); - cp.b_rsat = static_cast (params->wavelet.satlev.value[2]); - cp.t_rsat = static_cast (params->wavelet.satlev.value[3]); + cp.b_lsat = static_cast(params->wavelet.satlev.getBottomLeft()); + cp.t_lsat = static_cast(params->wavelet.satlev.getTopLeft()); + cp.b_rsat = static_cast(params->wavelet.satlev.getBottomRight()); + cp.t_rsat = static_cast(params->wavelet.satlev.getTopRight()); //edge local contrast - cp.edg_low = static_cast (params->wavelet.edgcont.value[0]); - cp.edg_mean = static_cast (params->wavelet.edgcont.value[1]); - cp.edg_max = static_cast (params->wavelet.edgcont.value[2]); - cp.edg_sd = static_cast (params->wavelet.edgcont.value[3]); + cp.edg_low = static_cast(params->wavelet.edgcont.getBottomLeft()); + cp.edg_mean = static_cast(params->wavelet.edgcont.getTopLeft()); + cp.edg_max = static_cast(params->wavelet.edgcont.getBottomRight()); + cp.edg_sd = static_cast(params->wavelet.edgcont.getTopRight()); //level noise - cp.lev0s = static_cast (params->wavelet.level0noise.value[0]); - cp.lev0n = static_cast (params->wavelet.level0noise.value[1]); - cp.lev1s = static_cast (params->wavelet.level1noise.value[0]); - cp.lev1n = static_cast (params->wavelet.level1noise.value[1]); - cp.lev2s = static_cast (params->wavelet.level2noise.value[0]); - cp.lev2n = static_cast (params->wavelet.level2noise.value[1]); - cp.lev3s = static_cast (params->wavelet.level3noise.value[0]); - cp.lev3n = static_cast (params->wavelet.level3noise.value[1]); + cp.lev0s = static_cast(params->wavelet.level0noise.getBottom()); + cp.lev0n = static_cast(params->wavelet.level0noise.getTop()); + cp.lev1s = static_cast(params->wavelet.level1noise.getBottom()); + cp.lev1n = static_cast(params->wavelet.level1noise.getTop()); + cp.lev2s = static_cast(params->wavelet.level2noise.getBottom()); + cp.lev2n = static_cast(params->wavelet.level2noise.getTop()); + cp.lev3s = static_cast(params->wavelet.level3noise.getBottom()); + cp.lev3n = static_cast(params->wavelet.level3noise.getTop()); cp.detectedge = params->wavelet.medianlev; //printf("low=%f mean=%f sd=%f max=%f\n",cp.edg_low,cp.edg_mean,cp.edg_sd,cp.edg_max); 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 1bd72a354..0b3610de2 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/procevents.h b/rtengine/procevents.h index 0d87778bf..6980e3ce5 100644 --- a/rtengine/procevents.h +++ b/rtengine/procevents.h @@ -617,6 +617,7 @@ enum ProcEvent { Evlocallabexclumethod = 586, Evlocallabsensiexclu = 587, Evlocallabstruc = 588, + Evlocallabwarm = 589, NUMOFEVENTS diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index a6ce900bb..6a1427382 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -2331,7 +2331,6 @@ HHcurve{ skintonescurve { DCT_Linear }, - enabled(false), degree(0), locY(250), @@ -2344,12 +2343,14 @@ circrad(18), centerXbuf(0), centerYbuf(0), adjblur(0), +qualityMethod("enhden"), qualitycurveMethod("none"), proxi(0), thres(18), lightness(0), contrast(0), chroma(0), +warm(0), expcomp(0), black(0), hlcompr(20), @@ -2380,16 +2381,15 @@ struc(0), sensibn(40), sensitm(19), sensisha(19), +radius(1), +strength(0), +stren(0), +gamma(100), +estop(140), +scaltm(10), +rewei(0), transit(60), -chrrt(0), avoid(false), -mult{ - 1.0, - 1.0, - 1.0, - 1.0, - 1.0, -}, Smethod("IND"), Exclumethod("norm"), retinexMethod("high"), @@ -2400,25 +2400,26 @@ cutpast(false), lastdust(false), curvactiv(false), activlum(false), -radius(1), inversrad(false), inversret(false), inverssha(false), -strength(0), -stren(0), -gamma(100), -estop(140), -scaltm(10), -rewei(0), hueref(1.), chromaref(50.), lumaref(50.), sobelref(0.), str(0), neigh(50), -vart(200), nbspot(1), anbspot(0), +vart(200), +chrrt(0), +mult{ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, +}, expcolor(false), expexpose(false), expvibrance(false), @@ -2436,7 +2437,7 @@ chromacbdl(0) bool LocallabParams::operator ==(const LocallabParams& other) const { return - && enabled == other.enabled + enabled == other.enabled && avoid == other.avoid && invers == other.invers && cutpast == other.cutpast @@ -2469,6 +2470,7 @@ bool LocallabParams::operator ==(const LocallabParams& other) const && lightness == other.lightness && contrast == other.contrast && chroma == other.chroma + && warm == other.warm && expcomp == other.expcomp && hlcompr == other.hlcompr && hlcomprthresh == other.hlcomprthresh @@ -2488,8 +2490,7 @@ bool LocallabParams::operator ==(const LocallabParams& other) const return true; }() - && protectskins == other.protectskins; - + && protectskins == other.protectskins && avoidcolorshift == other.avoidcolorshift && pastsattog == other.pastsattog && skintonescurve == other.skintonescurve @@ -2546,7 +2547,7 @@ bool LocallabParams::operator ==(const LocallabParams& other) const && llcurve == other.llcurve && cccurve == other.cccurve && LHcurve == other.LHcurve - && HHcurve == other.HHcurve + && HHcurve == other.HHcurve; } @@ -2572,7 +2573,6 @@ void LocallabParams::getCurves( } - DirPyrEqualizerParams::DirPyrEqualizerParams() : enabled(false), gamutlab(false), @@ -3441,12 +3441,13 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo saveToKeyfile(!pedited || pedited->locallab.circrad, "Locallab", "Circrad", locallab.circrad, keyFile); saveToKeyfile(!pedited || pedited->locallab.centerXbuf, "Locallab", "CenterXbuf", locallab.centerXbuf, keyFile); saveToKeyfile(!pedited || pedited->locallab.centerYbuf, "Locallab", "CenterYbuf", locallab.centerYbuf, keyFile); - saveToKeyfile(!pedited || pedited->locallab.adlblur, "Locallab", "Adjblur", locallab.adjblur, keyFile); + saveToKeyfile(!pedited || pedited->locallab.adjblur, "Locallab", "Adjblur", locallab.adjblur, keyFile); saveToKeyfile(!pedited || pedited->locallab.thres, "Locallab", "Thres", locallab.thres, keyFile); saveToKeyfile(!pedited || pedited->locallab.proxi, "Locallab", "Proxi", locallab.proxi, keyFile); saveToKeyfile(!pedited || pedited->locallab.lightness, "Locallab", "Lightness", locallab.lightness, keyFile); saveToKeyfile(!pedited || pedited->locallab.contrast, "Locallab", "Contrast", locallab.contrast, keyFile); saveToKeyfile(!pedited || pedited->locallab.chroma, "Locallab", "Chroma", locallab.chroma, keyFile); + saveToKeyfile(!pedited || pedited->locallab.warm, "Locallab", "Warm", locallab.warm, keyFile); saveToKeyfile(!pedited || pedited->locallab.expcomp, "Locallab", "Expcomp", locallab.expcomp, keyFile); saveToKeyfile(!pedited || pedited->locallab.hlcompr, "Locallab", "Hlcompr", locallab.hlcompr, keyFile); saveToKeyfile(!pedited || pedited->locallab.hlcomprthresh, "Locallab", "Hlcomprthresh", locallab.hlcomprthresh, keyFile); @@ -4496,6 +4497,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) assignFromKeyfile(keyFile, "Locallab", "Thres", pedited, locallab.thres, pedited->locallab.thres); assignFromKeyfile(keyFile, "Locallab", "Proxi", pedited, locallab.proxi, pedited->locallab.proxi); assignFromKeyfile(keyFile, "Locallab", "Chroma", pedited, locallab.chroma, pedited->locallab.chroma); + assignFromKeyfile(keyFile, "Locallab", "Warm", pedited, locallab.warm, pedited->locallab.warm); assignFromKeyfile(keyFile, "Locallab", "Expcomp", pedited, locallab.expcomp, pedited->locallab.expcomp); assignFromKeyfile(keyFile, "Locallab", "Hlcompr", pedited, locallab.hlcompr, pedited->locallab.hlcompr); assignFromKeyfile(keyFile, "Locallab", "Hlcomprthresh", pedited, locallab.hlcomprthresh, pedited->locallab.hlcomprthresh); @@ -4580,6 +4582,7 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited) } + if (keyFile.has_group("PCVignette")) { assignFromKeyfile(keyFile, "PCVignette", "Enabled", pedited, pcvignette.enabled, pedited->pcvignette.enabled); assignFromKeyfile(keyFile, "PCVignette", "Strength", pedited, pcvignette.strength, pedited->pcvignette.strength); @@ -5301,6 +5304,7 @@ bool ProcParams::operator ==(const ProcParams& other) const && lensProf == other.lensProf && perspective == other.perspective && gradient == other.gradient + && locallab == other.locallab && pcvignette == other.pcvignette && cacorrection == other.cacorrection && vignetting == other.vignetting diff --git a/rtengine/procparams.h b/rtengine/procparams.h index b030d58cc..95f735bf0 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -38,11 +38,11 @@ namespace rtengine class ColorGradientCurve; class NoiseCurve; class OpacityCurve; -class RetinextransmissionCurve; class RetinexgaintransmissionCurve; +class RetinextransmissionCurve; class WavCurve; -class WavOpacityCurveRG; class WavOpacityCurveBY; +class WavOpacityCurveRG; class WavOpacityCurveW; class WavOpacityCurveWL; class LocretigainCurve; @@ -50,7 +50,6 @@ class LocretigainCurverab; class LocLHCurve; class LocHHCurve; - enum RenderingIntent { RI_PERCEPTUAL = INTENT_PERCEPTUAL, RI_RELATIVE = INTENT_RELATIVE_COLORIMETRIC, @@ -144,6 +143,7 @@ public: top_left = top; } + void setValues(T bottom_left, T top_left, T bottom_right, T top_right) { this->bottom_left = bottom_left; @@ -295,8 +295,8 @@ struct ToneCurveParams { }; /** -* Parameters of Retinex -*/ + * Parameters of Retinex + */ struct RetinexParams { bool enabled; std::vector cdcurve; @@ -447,8 +447,6 @@ struct ColorToningParams { * Parameters of the sharpening */ struct SharpeningParams { - -public: bool enabled; double radius; int amount; @@ -471,7 +469,6 @@ public: }; struct SharpenEdgeParams { -public: bool enabled; int passes; double amount; @@ -484,8 +481,8 @@ public: }; + struct SharpenMicroParams { -public: bool enabled; bool matrix; double amount; @@ -501,8 +498,6 @@ public: * Parameters of the vibrance */ struct VibranceParams { - -public: bool enabled; int pastels; int saturated; @@ -518,18 +513,6 @@ public: bool operator !=(const VibranceParams& other) const; }; -/** - * Parameters of the color boost - */ -/*class ColorBoostParams { - - public: - int amount; - bool avoidclip; - bool enable_saturationlimiter; - double saturationlimit; -};*/ - /** * Parameters of the white balance adjustments */ @@ -702,7 +685,6 @@ struct DirPyrDenoiseParams { }; -//EPD related parameters. // EPD related parameters. struct EPDParams { bool enabled; @@ -882,12 +864,20 @@ struct GradientParams { bool operator ==(const GradientParams& other) const; bool operator !=(const GradientParams& other) const; }; + /** * Parameters of the Local Lab */ struct LocallabParams { + std::vector llcurve; + std::vector cccurve; + std::vector excurve; + std::vector localTgaincurve; + std::vector localTgaincurverab; + std::vector LHcurve; + std::vector HHcurve; + std::vector skintonescurve; -public: bool enabled; double degree; int locY; @@ -900,48 +890,34 @@ public: int centerXbuf; int centerYbuf; int adjblur; - int thres; - int proxi; Glib::ustring qualityMethod; Glib::ustring qualitycurveMethod; - bool expcolor; - bool expexpose; - bool expvibrance; - bool expblur; - bool exptonemap; - bool expreti; - bool expsharp; - bool expcbdl; - bool expdenoi; - + int proxi; + int thres; int lightness; int contrast; int chroma; + int warm; int expcomp; int black; - int shcompr; int hlcompr; int hlcomprthresh; - - + int shcompr; int pastels; int saturated; Threshold psthreshold; bool protectskins; bool avoidcolorshift; bool pastsattog; - std::vector skintonescurve; int sensiv; - - int sharradius; - int sharamount; - int shardamping; - int shariter; int noiselumf; int noiselumc; int noisechrof; int noisechroc; - + int sharradius; + int sharamount; + int shardamping; + int shariter; int sensi; int sensiex; int sensih; @@ -950,8 +926,8 @@ public: int sensiexclu; int struc; int sensibn; - int sensisha; int sensitm; + int sensisha; int radius; int strength; int stren; @@ -984,15 +960,16 @@ public: int anbspot; int vart; int chrrt; - std::vector localTgaincurve; - std::vector localTgaincurverab; - std::vector llcurve; - std::vector cccurve; - std::vector LHcurve; - std::vector HHcurve; - std::vector excurve; - double mult[5]; + bool expcolor; + bool expexpose; + bool expvibrance; + bool expblur; + bool exptonemap; + bool expreti; + bool expsharp; + bool expcbdl; + bool expdenoi; double threshold; int chromacbdl; diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index f8f1acdfc..d25faa459 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -650,9 +650,9 @@ 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]); - float gain = calculate_scale_mul (new_scale_mul, new_pre_mul, c_white, cblacksom, isMono, ri->get_colors()); + bool isMono = (ri->getSensorType() == ST_FUJI_XTRANS && raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::MONO)) + || (ri->getSensorType() == ST_BAYER && raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO)); + 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; bm = new_scale_mul[2] / scale_mul[2] * gain; @@ -1930,7 +1930,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) { @@ -2036,28 +2036,28 @@ 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 (); - } 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] ) { - pixelshift (0, 0, W, H, raw.bayersensor, currFrame, ri->get_model(), raw.expos); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::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::PIXELSHIFT) ) { + pixelshift(0, 0, W, H, raw.bayersensor, currFrame, ri->get_model(), raw.expos); + } 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::getMethodString(RAWParams::BayerSensor::Method::EAHD)) { eahd_demosaic (); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::igv]) { - igv_interpolate (W, H); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::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::IGV)) { + igv_interpolate(W, H); + } 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::getMethodString(RAWParams::BayerSensor::Method::FAST) ) { fast_demosaic(); - } else if (raw.bayersensor.method == RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono] ) { - nodemosaic (true); + } else if (raw.bayersensor.method == RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::MONO) ) { + nodemosaic(true); } else { nodemosaic (false); } @@ -2065,14 +2065,14 @@ 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]) { - xtrans_interpolate (1, false); - } else if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::threePass] ) { - xtrans_interpolate (3, true); - } else if (raw.xtranssensor.method == RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono] ) { - nodemosaic (true); + } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::ONE_PASS)) { + xtrans_interpolate(1, false); + } else if (raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::THREE_PASS) ) { + xtrans_interpolate(3, true); + } else if(raw.xtranssensor.method == RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::MONO) ) { + nodemosaic(true); } else { nodemosaic (false); } @@ -2812,15 +2812,15 @@ void RawImageSource::processFlatField (const RAWParams &raw, RawImage *riFlatFil BS += BS & 1; //function call to cfabloxblur - if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::v_ff]) { - cfaboxblur (riFlatFile, cfablur, 2 * BS, 0); - } else if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::h_ff]) { - cfaboxblur (riFlatFile, cfablur, 0, 2 * BS); - } else if (raw.ff_BlurType == RAWParams::ff_BlurTypestring[RAWParams::vh_ff]) { + if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::V)) { + cfaboxblur(riFlatFile, cfablur, 2 * BS, 0); + } else if (raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::FlatFieldBlurType::H)) { + cfaboxblur(riFlatFile, cfablur, 0, 2 * BS); + } 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]) - cfaboxblur (riFlatFile, cfablur, BS, BS); + cfaboxblur(riFlatFile, cfablur, BS, BS); //first do area blur to correct vignette + } else { //(raw.ff_BlurType == RAWParams::getFlatFieldBlurTypeString(RAWParams::area_ff)) + cfaboxblur(riFlatFile, cfablur, BS, BS); } if (ri->getSensorType() == ST_BAYER) { @@ -3017,7 +3017,7 @@ void RawImageSource::processFlatField (const RAWParams &raw, RawImage *riFlatFil } } - 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 @@ -3438,7 +3438,7 @@ void RawImageSource::scaleColors (int winx, int winy, int winw, int winh, const 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::MONO) == raw.bayersensor.method; } else if (getSensorType() == ST_FUJI_XTRANS) { black_lev[0] = raw.xtranssensor.blackred; //R @@ -3446,7 +3446,7 @@ void RawImageSource::scaleColors (int winx, int winy, int winw, int winh, const 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::MONO) == raw.xtranssensor.method; } for (int i = 0; i < 4 ; i++) { diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index d0fa3933c..e49903cd3 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -615,7 +615,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { LUMINANCECURVE, // Evlocallabsobelref LUMINANCECURVE, // Evlocallabexclumethod LUMINANCECURVE, // Evlocallabsensiexclu - LUMINANCECURVE // Evlocallabstruc + LUMINANCECURVE, // Evlocallabstruc + LUMINANCECURVE // Evlocallabwarm }; diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 1ab248925..4bb3ff33b 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -46,7 +46,7 @@ namespace { template -void adjust_radius (const T &default_param, double scale_factor, T ¶m) +void adjust_radius(const T &default_param, double scale_factor, T ¶m) { const double delta = (param - default_param) * scale_factor; param = default_param + delta; @@ -56,20 +56,20 @@ void adjust_radius (const T &default_param, double scale_factor, T ¶m) class ImageProcessor { public: - ImageProcessor (ProcessingJob* pjob, int& errorCode, - ProgressListener* pl, bool tunnelMetaData, bool flush): - job (static_cast (pjob)), - errorCode (errorCode), - pl (pl), - tunnelMetaData (tunnelMetaData), - flush (flush), + ImageProcessor(ProcessingJob* pjob, int& errorCode, + ProgressListener* pl, bool tunnelMetaData, bool flush): + job(static_cast(pjob)), + errorCode(errorCode), + pl(pl), + tunnelMetaData(tunnelMetaData), + flush(flush), // internal state - ipf_p (nullptr), - ii (nullptr), - imgsrc (nullptr), - fw (-1), - fh (-1), - pp (0, 0, 0, 0, 0) + ipf_p(nullptr), + ii(nullptr), + imgsrc(nullptr), + fw(-1), + fh(-1), + pp(0, 0, 0, 0, 0) { } @@ -117,14 +117,14 @@ private: errorCode = 0; if (pl) { - pl->setProgressStr ("PROGRESSBAR_PROCESSING"); - pl->setProgress (0.0); + pl->setProgressStr("PROGRESSBAR_PROCESSING"); + pl->setProgress(0.0); } ii = job->initialImage; if (!ii) { - ii = InitialImage::load (job->fname, job->isRaw, &errorCode); + ii = InitialImage::load(job->fname, job->isRaw, &errorCode); if (errorCode) { delete job; @@ -135,10 +135,10 @@ private: procparams::ProcParams& params = job->pparams; // acquire image from imagesource - imgsrc = ii->getImageSource (); + imgsrc = ii->getImageSource(); - tr = getCoarseBitMask (params.coarse); - imgsrc->getFullSize (fw, fh, tr); + tr = getCoarseBitMask(params.coarse); + imgsrc->getFullSize(fw, fh, tr); // check the crop params if (params.crop.x > fw || params.crop.y > fh) { @@ -172,36 +172,36 @@ private: // MyTime t1,t2; // t1.set(); - ipf_p.reset (new ImProcFunctions (¶ms, true)); + ipf_p.reset(new ImProcFunctions(¶ms, true)); ImProcFunctions &ipf = * (ipf_p.get()); - pp = PreviewProps (0, 0, fw, fh, 1); - imgsrc->setCurrentFrame (params.raw.bayersensor.imageNum); - imgsrc->preprocess ( params.raw, params.lensProf, params.coarse, params.dirpyrDenoise.enabled); + pp = PreviewProps(0, 0, fw, fh, 1); + imgsrc->setCurrentFrame(params.raw.bayersensor.imageNum); + imgsrc->preprocess(params.raw, params.lensProf, params.coarse, params.dirpyrDenoise.enabled); if (params.toneCurve.autoexp) {// this enabled HLRecovery - LUTu histRedRaw (256), histGreenRaw (256), histBlueRaw (256); - imgsrc->getRAWHistogram (histRedRaw, histGreenRaw, histBlueRaw); + LUTu histRedRaw(256), histGreenRaw(256), histBlueRaw(256); + imgsrc->getRAWHistogram(histRedRaw, histGreenRaw, histBlueRaw); - if (ToneCurveParams::HLReconstructionNecessary (histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { + if (ToneCurveParams::HLReconstructionNecessary(histRedRaw, histGreenRaw, histBlueRaw) && !params.toneCurve.hrenabled) { params.toneCurve.hrenabled = true; // WARNING: Highlight Reconstruction is being forced 'on', should we force a method here too? } } if (pl) { - pl->setProgress (0.20); + pl->setProgress(0.20); } - imgsrc->demosaic ( params.raw); + imgsrc->demosaic(params.raw); if (pl) { - pl->setProgress (0.30); + pl->setProgress(0.30); } if (params.retinex.enabled) { //enabled Retinex - LUTf cdcurve (65536, 0); - LUTf mapcurve (65536, 0); + LUTf cdcurve(65536, 0); + LUTf mapcurve(65536, 0); LUTu dummy; RetinextransmissionCurve dehatransmissionCurve; RetinexgaintransmissionCurve dehagaintransmissionCurve; @@ -209,37 +209,37 @@ private: bool mapcontlutili = false; bool useHsl = false; // multi_array2D conversionBuffer(1, 1); - multi_array2D conversionBuffer (1, 1); - imgsrc->retinexPrepareBuffers (params.icm, params.retinex, conversionBuffer, dummy); - imgsrc->retinexPrepareCurves (params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy ); + multi_array2D conversionBuffer(1, 1); + imgsrc->retinexPrepareBuffers(params.icm, params.retinex, conversionBuffer, dummy); + imgsrc->retinexPrepareCurves(params.retinex, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, dehacontlutili, mapcontlutili, useHsl, dummy, dummy); float minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax; - imgsrc->retinex ( params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); + imgsrc->retinex(params.icm, params.retinex, params.toneCurve, cdcurve, mapcurve, dehatransmissionCurve, dehagaintransmissionCurve, conversionBuffer, dehacontlutili, mapcontlutili, useHsl, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax, dummy); } if (pl) { - pl->setProgress (0.40); + pl->setProgress(0.40); } - imgsrc->HLRecovery_Global ( params.toneCurve ); + imgsrc->HLRecovery_Global(params.toneCurve); if (pl) { - pl->setProgress (0.45); + pl->setProgress(0.45); } // set the color temperature - currWB = ColorTemp (params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); + currWB = ColorTemp(params.wb.temperature, params.wb.green, params.wb.equal, params.wb.method); if (params.wb.method == "Camera") { - currWB = imgsrc->getWB (); + currWB = imgsrc->getWB(); } else if (params.wb.method == "Auto") { double rm, gm, bm; - imgsrc->getAutoWBMultipliers (rm, gm, bm); - currWB.update (rm, gm, bm, params.wb.equal, params.wb.tempBias); + imgsrc->getAutoWBMultipliers(rm, gm, bm); + currWB.update(rm, gm, bm, params.wb.equal, params.wb.tempBias); } calclum = nullptr ; - params.dirpyrDenoise.getCurves (noiseLCurve, noiseCCurve); + params.dirpyrDenoise.getCurves(noiseLCurve, noiseCCurve); autoNR = (float) settings->nrauto;// autoNRmax = (float) settings->nrautomax;// @@ -256,7 +256,7 @@ private: // const int tilesize = 768; // const int overlap = 96; int numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip; - ipf.Tile_calc (tilesize, overlap, 2, fw, fh, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); + ipf.Tile_calc(tilesize, overlap, 2, fw, fh, numtiles_W, numtiles_H, tilewidth, tileheight, tileWskip, tileHskip); int nbtl = numtiles_W * numtiles_H; if ((settings->leveldnautsimpl == 1 && params.dirpyrDenoise.Cmethod == "AUT") || (settings->leveldnautsimpl == 0 && params.dirpyrDenoise.C2method == "AUTO")) { @@ -309,14 +309,14 @@ private: // Imagefloat *origCropPart;//init auto noise // origCropPart = new Imagefloat (crW, crH);//allocate memory if (params.dirpyrDenoise.enabled) {//evaluate Noise - LUTf gamcurve (65536, 0); + LUTf gamcurve(65536, 0); float gam, gamthresh, gamslope; - ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); #pragma omp parallel { Imagefloat *origCropPart;//init auto noise - origCropPart = new Imagefloat (crW, crH);//allocate memory - Imagefloat *provicalc = new Imagefloat ((crW + 1) / 2, (crH + 1) / 2); //for denoise curves + origCropPart = new Imagefloat(crW, crH); //allocate memory + Imagefloat *provicalc = new Imagefloat((crW + 1) / 2, (crH + 1) / 2); //for denoise curves int skipP = 1; #pragma omp for schedule(dynamic) collapse(2) nowait @@ -324,20 +324,20 @@ private: for (int hcr = 0; hcr < numtiles_H; hcr++) { int beg_tileW = wcr * tileWskip + tileWskip / 2.f - crW / 2.f; int beg_tileH = hcr * tileHskip + tileHskip / 2.f - crH / 2.f; - PreviewProps ppP (beg_tileW, beg_tileH, crW, crH, skipP); - imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw ); + PreviewProps ppP(beg_tileW, beg_tileH, crW, crH, skipP); + imgsrc->getImage(currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); //baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve); // we only need image reduced to 1/4 here for (int ii = 0; ii < crH; ii += 2) { for (int jj = 0; jj < crW; jj += 2) { - provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); - provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); - provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); + provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); + provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); + provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); } } - imgsrc->convertColorSpace (provicalc, params.icm, currWB); //for denoise luminance curve + imgsrc->convertColorSpace(provicalc, params.icm, currWB); //for denoise luminance curve float maxr = 0.f; float maxb = 0.f; float pondcorrec = 1.0f; @@ -350,11 +350,11 @@ private: maxblueaut = 0.f; chromina = 0.f; sigma = 0.f; - ipf.RGB_denoise_info (origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + ipf.RGB_denoise_info(origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, Nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); float multip = 1.f; float adjustr = 1.f; - if (params.icm.working == "ProPhoto") { + if (params.icm.working == "ProPhoto") { adjustr = 1.f; // } else if (params.icm.working == "Adobe RGB") { adjustr = 1.f / 1.3f; @@ -376,11 +376,11 @@ private: multip = 2.f; //take into account gamma for TIF / JPG approximate value...not good fot gamma=1 } - float maxmax = max (maxredaut, maxblueaut); + float maxmax = max(maxredaut, maxblueaut); float delta; int mode = 2; int lissage = settings->leveldnliss; - ipf.calcautodn_info (chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); + ipf.calcautodn_info(chaut, delta, Nb, levaut, maxmax, lumema, chromina, mode, lissage, redyel, skinc, nsknc); // printf("PROCESS cha=%f red=%f bl=%f redM=%f bluM=%f chrom=%f sigm=%f lum=%f sigL=%f\n",chaut,redaut,blueaut, maxredaut, maxblueaut, chromina, sigma, lumema, sigma_L); if (maxredaut > maxblueaut) { @@ -479,7 +479,7 @@ private: if (settings->verbose) { t2pone.set(); - printf ("Info denoise ponderated performed in %d usec:\n", t2pone.etime (t1pone)); + printf("Info denoise ponderated performed in %d usec:\n", t2pone.etime(t1pone)); } } @@ -520,9 +520,9 @@ private: } if (params.dirpyrDenoise.enabled) {//evaluate Noise - LUTf gamcurve (65536, 0); + LUTf gamcurve(65536, 0); float gam, gamthresh, gamslope; - ipf.RGB_denoise_infoGamCurve (params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); + ipf.RGB_denoise_infoGamCurve(params.dirpyrDenoise, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope); int Nb[9]; int coordW[3];//coordonate of part of image to mesure noise int coordH[3]; @@ -537,31 +537,31 @@ private: #pragma omp parallel { Imagefloat *origCropPart;//init auto noise - origCropPart = new Imagefloat (crW, crH);//allocate memory - Imagefloat *provicalc = new Imagefloat ((crW + 1) / 2, (crH + 1) / 2); //for denoise curves + origCropPart = new Imagefloat(crW, crH); //allocate memory + Imagefloat *provicalc = new Imagefloat((crW + 1) / 2, (crH + 1) / 2); //for denoise curves #pragma omp for schedule(dynamic) collapse(2) nowait for (int wcr = 0; wcr <= 2; wcr++) { for (int hcr = 0; hcr <= 2; hcr++) { - PreviewProps ppP (coordW[wcr], coordH[hcr], crW, crH, 1); - imgsrc->getImage (currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); + PreviewProps ppP(coordW[wcr], coordH[hcr], crW, crH, 1); + imgsrc->getImage(currWB, tr, origCropPart, ppP, params.toneCurve, params.raw); //baseImg->getStdImage(currWB, tr, origCropPart, ppP, true, params.toneCurve); // we only need image reduced to 1/4 here for (int ii = 0; ii < crH; ii += 2) { for (int jj = 0; jj < crW; jj += 2) { - provicalc->r (ii >> 1, jj >> 1) = origCropPart->r (ii, jj); - provicalc->g (ii >> 1, jj >> 1) = origCropPart->g (ii, jj); - provicalc->b (ii >> 1, jj >> 1) = origCropPart->b (ii, jj); + provicalc->r(ii >> 1, jj >> 1) = origCropPart->r(ii, jj); + provicalc->g(ii >> 1, jj >> 1) = origCropPart->g(ii, jj); + provicalc->b(ii >> 1, jj >> 1) = origCropPart->b(ii, jj); } } - imgsrc->convertColorSpace (provicalc, params.icm, currWB); //for denoise luminance curve + imgsrc->convertColorSpace(provicalc, params.icm, currWB); //for denoise luminance curve int nb = 0; float chaut = 0.f, redaut = 0.f, blueaut = 0.f, maxredaut = 0.f, maxblueaut = 0.f, minredaut = 0.f, minblueaut = 0.f, chromina = 0.f, sigma = 0.f, lumema = 0.f, sigma_L = 0.f, redyel = 0.f, skinc = 0.f, nsknc = 0.f; - ipf.RGB_denoise_info (origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); + ipf.RGB_denoise_info(origCropPart, provicalc, imgsrc->isRAW(), gamcurve, gam, gamthresh, gamslope, params.dirpyrDenoise, imgsrc->getDirPyrDenoiseExpComp(), chaut, nb, redaut, blueaut, maxredaut, maxblueaut, minredaut, minblueaut, chromina, sigma, lumema, sigma_L, redyel, skinc, nsknc); Nb[hcr * 3 + wcr] = nb; ch_M[hcr * 3 + wcr] = chaut; max_r[hcr * 3 + wcr] = maxredaut; @@ -597,7 +597,7 @@ private: float MinRMoy = 0.f; float MinBMoy = 0.f; - if (params.icm.working == "ProPhoto") { + if (params.icm.working == "ProPhoto") { adjustr = 1.f; } else if (params.icm.working == "Adobe RGB") { adjustr = 1.f / 1.3f; @@ -624,8 +624,8 @@ private: int lissage = settings->leveldnliss; for (int k = 0; k < 9; k++) { - float maxmax = max (max_r[k], max_b[k]); - ipf.calcautodn_info (ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k] ); + float maxmax = max(max_r[k], max_b[k]); + ipf.calcautodn_info(ch_M[k], delta[k], Nb[k], levaut, maxmax, lumL[k], chromC[k], mode, lissage, ry[k], sk[k], pcsk[k]); // printf("ch_M=%f delta=%f\n",ch_M[k], delta[k]); } @@ -698,17 +698,17 @@ private: if (settings->verbose) { t2aue.set(); - printf ("Info denoise auto performed in %d usec:\n", t2aue.etime (t1aue)); + printf("Info denoise auto performed in %d usec:\n", t2aue.etime(t1aue)); } //end evaluate noise } - baseImg = new Imagefloat (fw, fh); - imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.raw); + baseImg = new Imagefloat(fw, fh); + imgsrc->getImage(currWB, tr, baseImg, pp, params.toneCurve, params.raw); if (pl) { - pl->setProgress (0.50); + pl->setProgress(0.50); } // LUTf Noisecurve (65536,0); @@ -724,8 +724,8 @@ private: if (params.toneCurve.autoexp) { LUTu aehist; int aehistcompr; - imgsrc->getAutoExpHistogram (aehist, aehistcompr); - ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); + imgsrc->getAutoExpHistogram(aehist, aehistcompr); + ipf.getAutoExp(aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); } // at this stage, we can flush the raw data to free up quite an important amount of memory @@ -765,20 +765,20 @@ private: noiseLCurve.Reset(); } - if (denoiseParams.enabled && (noiseLCurve || noiseCCurve )) { + if (denoiseParams.enabled && (noiseLCurve || noiseCCurve)) { // we only need image reduced to 1/4 here - calclum = new Imagefloat ((fw + 1) / 2, (fh + 1) / 2); //for luminance denoise curve + calclum = new Imagefloat((fw + 1) / 2, (fh + 1) / 2); //for luminance denoise curve #pragma omp parallel for for (int ii = 0; ii < fh; ii += 2) { for (int jj = 0; jj < fw; jj += 2) { - calclum->r (ii >> 1, jj >> 1) = baseImg->r (ii, jj); - calclum->g (ii >> 1, jj >> 1) = baseImg->g (ii, jj); - calclum->b (ii >> 1, jj >> 1) = baseImg->b (ii, jj); + calclum->r(ii >> 1, jj >> 1) = baseImg->r(ii, jj); + calclum->g(ii >> 1, jj >> 1) = baseImg->g(ii, jj); + calclum->b(ii >> 1, jj >> 1) = baseImg->b(ii, jj); } } - imgsrc->convertColorSpace (calclum, params.icm, currWB); + imgsrc->convertColorSpace(calclum, params.icm, currWB); } if (denoiseParams.enabled) { @@ -787,7 +787,7 @@ private: // ipf.RGB_denoise(baseImg, baseImg, calclum, imgsrc->isRAW(), denoiseParams, params.defringe, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, lldenoiseutili); float nresi, highresi; int kall = 2; - ipf.RGB_denoise (kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); + ipf.RGB_denoise(kall, baseImg, baseImg, calclum, ch_M, max_r, max_b, imgsrc->isRAW(), denoiseParams, imgsrc->getDirPyrDenoiseExpComp(), noiseLCurve, noiseCCurve, nresi, highresi); } @@ -810,17 +810,17 @@ private: //ImProcFunctions ipf (¶ms, true); ImProcFunctions &ipf = * (ipf_p.get()); - imgsrc->convertColorSpace (baseImg, params.icm, currWB); + imgsrc->convertColorSpace(baseImg, params.icm, currWB); // perform first analysis - hist16 (65536); + hist16(65536); - ipf.firstAnalysis (baseImg, params, hist16); + ipf.firstAnalysis(baseImg, params, hist16); if (params.fattal.enabled) { ipf.ToneMapFattal02(baseImg); } - + // perform transform (excepted resizing) if (ipf.needsTransform()) { Imagefloat* trImg = nullptr; @@ -828,11 +828,11 @@ private: if (ipf.needsLuminanceOnly()) { trImg = baseImg; } else { - trImg = new Imagefloat (fw, fh); + trImg = new Imagefloat(fw, fh); } - ipf.transform (baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, - imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); + ipf.transform(baseImg, trImg, 0, 0, 0, 0, fw, fh, fw, fh, + imgsrc->getMetaData(), imgsrc->getRotateDegree(), true); if (trImg != baseImg) { delete baseImg; @@ -850,69 +850,69 @@ private: if (params.dirpyrequalizer.cbdlMethod == "bef" && params.dirpyrequalizer.enabled && !params.colorappearance.enabled) { const int W = baseImg->getWidth(); const int H = baseImg->getHeight(); - LabImage labcbdl (W, H); - ipf.rgb2lab (*baseImg, labcbdl, params.icm.working); - ipf.dirpyrequalizer (&labcbdl, 1); - ipf.lab2rgb (labcbdl, *baseImg, params.icm.working); + LabImage labcbdl(W, H); + ipf.rgb2lab(*baseImg, labcbdl, params.icm.working); + ipf.dirpyrequalizer(&labcbdl, 1); + ipf.lab2rgb(labcbdl, *baseImg, params.icm.working); } // update blurmap SHMap* shmap = nullptr; if (params.sh.enabled) { - shmap = new SHMap (fw, fh, true); - double radius = sqrt (double (fw * fw + fh * fh)) / 2.0; + shmap = new SHMap(fw, fh, true); + double radius = sqrt(double (fw * fw + fh * fh)) / 2.0; double shradius = params.sh.radius; if (!params.sh.hq) { shradius *= radius / 1800.0; } - shmap->update (baseImg, shradius, ipf.lumimul, params.sh.hq, 1); + shmap->update(baseImg, shradius, ipf.lumimul, params.sh.hq, 1); } // RGB processing - curve1 (65536); - curve2 (65536); - curve (65536, 0); - satcurve (65536, 0); - lhskcurve (65536, 0); - lumacurve (32770, 0); // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation - clcurve (65536, 0); - wavclCurve (65536, 0); + curve1(65536); + curve2(65536); + curve(65536, 0); + satcurve(65536, 0); + lhskcurve(65536, 0); + lumacurve(32770, 0); // lumacurve[32768] and lumacurve[32769] will be set to 32768 and 32769 later to allow linear interpolation + clcurve(65536, 0); + wavclCurve(65536, 0); //if(params.blackwhite.enabled) params.toneCurve.hrenabled=false; - CurveFactory::complexCurve (expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, - params.toneCurve.curve, params.toneCurve.curve2, - hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2 ); + CurveFactory::complexCurve(expcomp, black / 65535.0, hlcompr, hlcomprthresh, params.toneCurve.shcompr, bright, contr, + params.toneCurve.curve, params.toneCurve.curve2, + hist16, curve1, curve2, curve, dummy, customToneCurve1, customToneCurve2); - CurveFactory::RGBCurve (params.rgbCurves.rcurve, rCurve, 1); - CurveFactory::RGBCurve (params.rgbCurves.gcurve, gCurve, 1); - CurveFactory::RGBCurve (params.rgbCurves.bcurve, bCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.rcurve, rCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.gcurve, gCurve, 1); + CurveFactory::RGBCurve(params.rgbCurves.bcurve, bCurve, 1); bool opautili = false; if (params.colorToning.enabled) { - TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix (params.icm.working); + TMatrix wprof = ICCStore::getInstance()->workingSpaceMatrix(params.icm.working); double wp[3][3] = { {wprof[0][0], wprof[0][1], wprof[0][2]}, {wprof[1][0], wprof[1][1], wprof[1][2]}, {wprof[2][0], wprof[2][1], wprof[2][2]} }; - params.colorToning.getCurves (ctColorCurve, ctOpacityCurve, wp, opautili); - clToningcurve (65536, 0); - CurveFactory::curveToning (params.colorToning.clcurve, clToningcurve, 1); - cl2Toningcurve (65536, 0); - CurveFactory::curveToning (params.colorToning.cl2curve, cl2Toningcurve, 1); + params.colorToning.getCurves(ctColorCurve, ctOpacityCurve, wp, opautili); + clToningcurve(65536, 0); + CurveFactory::curveToning(params.colorToning.clcurve, clToningcurve, 1); + cl2Toningcurve(65536, 0); + CurveFactory::curveToning(params.colorToning.cl2curve, cl2Toningcurve, 1); } - labView = new LabImage (fw, fh); - reservView = new LabImage (fw, fh); + labView = new LabImage(fw, fh); + reservView = new LabImage(fw, fh); if (params.blackwhite.enabled) { - CurveFactory::curveBW (params.blackwhite.beforeCurve, params.blackwhite.afterCurve, hist16, dummy, customToneCurvebw1, customToneCurvebw2, 1); + CurveFactory::curveBW(params.blackwhite.beforeCurve, params.blackwhite.afterCurve, hist16, dummy, customToneCurvebw1, customToneCurvebw2, 1); } double rrm, ggm, bbm; @@ -923,7 +923,7 @@ private: if (params.colorToning.enabled && params.colorToning.autosat) { //for colortoning evaluation of saturation settings float moyS = 0.f; float eqty = 0.f; - ipf.moyeqt (baseImg, moyS, eqty);//return image : mean saturation and standard dev of saturation + ipf.moyeqt(baseImg, moyS, eqty); //return image : mean saturation and standard dev of saturation float satp = ((moyS + 1.5f * eqty) - 0.3f) / 0.7f; //1.5 sigma ==> 93% pixels with high saturation -0.3 / 0.7 convert to Hombre scale if (satp >= 0.92f) { @@ -941,18 +941,18 @@ private: autor = -9000.f; // This will ask to compute the "auto" values for the B&W tool (have to be inferior to -5000) DCPProfile::ApplyState as; - DCPProfile *dcpProf = imgsrc->getDCP (params.icm, as); + DCPProfile *dcpProf = imgsrc->getDCP(params.icm, as); LUTu histToneCurve; - ipf.rgbProc (baseImg, labView, nullptr, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve); + ipf.rgbProc(baseImg, labView, nullptr, curve1, curve2, curve, shmap, params.toneCurve.saturation, rCurve, gCurve, bCurve, satLimit, satLimitOpacity, ctColorCurve, ctOpacityCurve, opautili, clToningcurve, cl2Toningcurve, customToneCurve1, customToneCurve2, customToneCurvebw1, customToneCurvebw2, rrm, ggm, bbm, autor, autog, autob, expcomp, hlcompr, hlcomprthresh, dcpProf, as, histToneCurve); if (settings->verbose) { - printf ("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob); + printf("Output image / Auto B&W coefs: R=%.2f G=%.2f B=%.2f\n", autor, autog, autob); } // if clut was used and size of clut cache == 1 we free the memory used by the clutstore (default clut cache size = 1 for 32 bit OS) - if ( params.filmSimulation.enabled && !params.filmSimulation.clutFilename.empty() && options.clutCacheSize == 1) { + if (params.filmSimulation.enabled && !params.filmSimulation.clutFilename.empty() && options.clutCacheSize == 1) { CLUTStore::getInstance().clearCache(); } @@ -977,7 +977,7 @@ private: shmap = nullptr; if (pl) { - pl->setProgress (0.55); + pl->setProgress(0.55); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -992,7 +992,7 @@ private: #pragma omp parallel #endif { - LUTu hist16thr (hist16.getSize()); // one temporary lookup table per thread + LUTu hist16thr(hist16.getSize()); // one temporary lookup table per thread hist16thr.clear(); #ifdef _OPENMP #pragma omp for schedule(static) nowait @@ -1000,7 +1000,7 @@ private: for (int i = 0; i < fh; i++) for (int j = 0; j < fw; j++) { - hist16thr[ (int) ((labView->L[i][j]))]++; + hist16thr[(int)((labView->L[i][j]))]++; } #pragma omp critical @@ -1011,32 +1011,32 @@ private: } bool utili; - CurveFactory::complexLCurve (params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, lumacurve, dummy, 1, utili); + CurveFactory::complexLCurve(params.labCurve.brightness, params.labCurve.contrast, params.labCurve.lcurve, hist16, lumacurve, dummy, 1, utili); bool clcutili; - CurveFactory::curveCL (clcutili, params.labCurve.clcurve, clcurve, 1); + CurveFactory::curveCL(clcutili, params.labCurve.clcurve, clcurve, 1); bool ccutili, cclutili; - CurveFactory::complexsgnCurve (autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, - params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); + CurveFactory::complexsgnCurve(autili, butili, ccutili, cclutili, params.labCurve.acurve, params.labCurve.bcurve, params.labCurve.cccurve, + params.labCurve.lccurve, curve1, curve2, satcurve, lhskcurve, 1); // bool locallutili = false; // bool localcutili = false; - reservView->CopyFrom (labView); + reservView->CopyFrom(labView); if (params.locallab.enabled) { MyTime t1, t2; t1.set(); - std::string mdfive = getMD5 (imgsrc->getFileName()); + std::string mdfive = getMD5(imgsrc->getFileName()); Glib::ustring pop = options.cacheBaseDir + "/mip/"; Glib::ustring datalab; if (options.mip == MI_opt) { - datalab = pop + Glib::path_get_basename (imgsrc->getFileName () + "." + mdfive + ".mip"); + datalab = pop + Glib::path_get_basename(imgsrc->getFileName() + "." + mdfive + ".mip"); } if (options.mip == MI_prev) { @@ -1049,16 +1049,16 @@ private: LocHHCurve lochhCurve; LocretigainCurverab locRETgainCurverab; - LUTf lllocalcurve (65536, 0); - LUTf cclocalcurve (65536, 0); - LUTf sklocalcurve (65536, 0); - LUTf hltonecurveloc (32768, 0); - LUTf shtonecurveloc (32768, 0); - LUTf tonecurveloc (32768, 0); - LUTf exlocalcurve (32768, 0); + LUTf lllocalcurve(65536, 0); + LUTf cclocalcurve(65536, 0); + LUTf sklocalcurve(65536, 0); + LUTf hltonecurveloc(32768, 0); + LUTf shtonecurveloc(32768, 0); + LUTf tonecurveloc(32768, 0); + LUTf exlocalcurve(32768, 0); // int realspot = params.locallab.nbspot; int maxspot = settings->nspot + 1; - ifstream fic0 (datalab, ios::in); + ifstream fic0(datalab, ios::in); float** shbuffer = nullptr; int versionmip = 0; std::string delim[69] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", @@ -1080,17 +1080,17 @@ private: string spotline; // int cont = 0; - while (getline (fic0, line)) { + while (getline(fic0, line)) { spotline = line; - std::size_t pos = spotline.find ("="); - std::size_t posend = spotline.find ("@"); //in case of for futur use + std::size_t pos = spotline.find("="); + std::size_t posend = spotline.find("@"); //in case of for futur use - if (spotline.substr (0, pos) == "Mipversion") { - string strversion = spotline.substr (pos + 1, (posend - pos)); - versionmip = std::stoi (strversion.c_str()); + if (spotline.substr(0, pos) == "Mipversion") { + string strversion = spotline.substr(pos + 1, (posend - pos)); + versionmip = std::stoi(strversion.c_str()); } - if (spotline.substr (0, pos) == "Spot") { + if (spotline.substr(0, pos) == "Spot") { // cont = 0; } @@ -1100,8 +1100,8 @@ private: fic0.close(); } - ifstream fich (datalab, ios::in); - int maxdata = 85; //82;//78;//73 10011 + ifstream fich(datalab, ios::in); + int maxdata = 86; //85 10016 //82;//78;//73 10011 if (fich && versionmip != 0) { std::string inser; @@ -1335,6 +1335,7 @@ private: dataspots[79][0] = params.locallab.sensiexclu; dataspots[80][0] = params.locallab.struc; + dataspots[81][0] = params.locallab.warm; dataspots[maxdata - 4][0] = 100.f * params.locallab.hueref; dataspots[maxdata - 3][0] = params.locallab.chromaref; @@ -1352,13 +1353,13 @@ private: int s_datcur[siz + 1]; for (int j = 0; j < siz; j++) { - s_datcur[j] = (int) (1000. * params.locallab.localTgaincurve[j]); + s_datcur[j] = (int)(1000. * params.locallab.localTgaincurve[j]); } std::string cur_str = ""; for (int j = 0; j < siz; j++) { - cur_str = cur_str + std::to_string (s_datcur[j]) + delim[j]; + cur_str = cur_str + std::to_string(s_datcur[j]) + delim[j]; } inser = retistrs[0] = cur_str + "@"; @@ -1373,13 +1374,13 @@ private: int s_datcurl[sizl + 1]; for (int j = 0; j < sizl; j++) { - s_datcurl[j] = (int) (1000. * params.locallab.llcurve[j]); + s_datcurl[j] = (int)(1000. * params.locallab.llcurve[j]); } std::string ll_str = ""; for (int j = 0; j < sizl; j++) { - ll_str = ll_str + std::to_string (s_datcurl[j]) + delim[j]; + ll_str = ll_str + std::to_string(s_datcurl[j]) + delim[j]; } llstrs[0] = ll_str + "@"; @@ -1395,13 +1396,13 @@ private: int s_datcurc[sizc + 1]; for (int j = 0; j < sizc; j++) { - s_datcurc[j] = (int) (1000. * params.locallab.cccurve[j]); + s_datcurc[j] = (int)(1000. * params.locallab.cccurve[j]); } std::string cc_str = ""; for (int j = 0; j < sizc; j++) { - cc_str = cc_str + std::to_string (s_datcurc[j]) + delim[j]; + cc_str = cc_str + std::to_string(s_datcurc[j]) + delim[j]; } ccstrs[0] = cc_str + "@"; @@ -1418,13 +1419,13 @@ private: int s_datcurh[sizh + 1]; for (int j = 0; j < sizh; j++) { - s_datcurh[j] = (int) (1000. * params.locallab.LHcurve[j]); + s_datcurh[j] = (int)(1000. * params.locallab.LHcurve[j]); } std::string lh_str = ""; for (int j = 0; j < sizh; j++) { - lh_str = lh_str + std::to_string (s_datcurh[j]) + delim[j]; + lh_str = lh_str + std::to_string(s_datcurh[j]) + delim[j]; } lhstrs[0] = lh_str + "@"; @@ -1439,13 +1440,13 @@ private: int s_datcurhh[sizhh + 1]; for (int j = 0; j < sizhh; j++) { - s_datcurhh[j] = (int) (1000. * params.locallab.HHcurve[j]); + s_datcurhh[j] = (int)(1000. * params.locallab.HHcurve[j]); } std::string hh_str = ""; for (int j = 0; j < sizhh; j++) { - hh_str = hh_str + std::to_string (s_datcurhh[j]) + delim[j]; + hh_str = hh_str + std::to_string(s_datcurhh[j]) + delim[j]; } hhstrs[0] = hh_str + "@"; @@ -1461,13 +1462,13 @@ private: int s_datcursk[sizsk + 1]; for (int j = 0; j < sizsk; j++) { - s_datcursk[j] = (int) (1000. * params.locallab.skintonescurve[j]); + s_datcursk[j] = (int)(1000. * params.locallab.skintonescurve[j]); } std::string sk_str = ""; for (int j = 0; j < sizsk; j++) { - sk_str = sk_str + std::to_string (s_datcursk[j]) + delim[j]; + sk_str = sk_str + std::to_string(s_datcursk[j]) + delim[j]; } skinstrs[0] = sk_str + "@"; @@ -1476,14 +1477,14 @@ private: //PSThreshold int sizps = 2; int s_datps[sizps + 1]; - s_datps[1] = static_cast (params.locallab.psthreshold.value[ThresholdSelector::TS_TOPLEFT]); + s_datps[1] = static_cast(params.locallab.psthreshold.getTopLeft()); - s_datps[0] = static_cast (params.locallab.psthreshold.value[ThresholdSelector::TS_BOTTOMLEFT]); + s_datps[0] = static_cast(params.locallab.psthreshold.getBottomLeft()); std::string ps_str = ""; for (int j = 0; j < sizps; j++) { - ps_str = ps_str + std::to_string (s_datps[j]) + delim[j]; + ps_str = ps_str + std::to_string(s_datps[j]) + delim[j]; } pthstrs[0] = ps_str + "@"; @@ -1502,13 +1503,13 @@ private: int s_datcurex[sizsk + 1]; for (int j = 0; j < sizex; j++) { - s_datcurex[j] = (int) (1000. * params.locallab.excurve[j]); + s_datcurex[j] = (int)(1000. * params.locallab.excurve[j]); } std::string ex_str = ""; for (int j = 0; j < sizex; j++) { - ex_str = ex_str + std::to_string (s_datcurex[j]) + delim[j]; + ex_str = ex_str + std::to_string(s_datcurex[j]) + delim[j]; } exstrs[0] = ex_str + "@"; @@ -1527,70 +1528,70 @@ private: std::string spotline; int cont = 0; - while (getline (fich, line)) { + while (getline(fich, line)) { spotline = line; - std::size_t pos = spotline.find ("="); - std::size_t posend = spotline.find ("@"); //in case of for futur use + std::size_t pos = spotline.find("="); + std::size_t posend = spotline.find("@"); //in case of for futur use - if (spotline.substr (0, pos) == "Mipversion") { - std::string strversion = spotline.substr (pos + 1, (posend - pos)); - versionmip = std::stoi (strversion.c_str()); + if (spotline.substr(0, pos) == "Mipversion") { + std::string strversion = spotline.substr(pos + 1, (posend - pos)); + versionmip = std::stoi(strversion.c_str()); } - if (spotline.substr (0, pos) == "Spot") { + if (spotline.substr(0, pos) == "Spot") { cont = 0; } cont++; - std::string str3 = spotline.substr (pos + 1, (posend - pos)); + std::string str3 = spotline.substr(pos + 1, (posend - pos)); if (cont == 1) { - ns = std::stoi (str3.c_str()); + ns = std::stoi(str3.c_str()); } if (cont >= 2 && cont < 16) { - dataspots[cont][ns] = std::stoi (str3.c_str()); + dataspots[cont][ns] = std::stoi(str3.c_str()); } - if (spotline.substr (0, pos) == "Currentspot") { - dataspots[16][0] = std::stoi (str3.c_str()); + if (spotline.substr(0, pos) == "Currentspot") { + dataspots[16][0] = std::stoi(str3.c_str()); } if (cont > 16 && cont < maxdata) { - dataspots[cont][ns] = std::stoi (str3.c_str()); + dataspots[cont][ns] = std::stoi(str3.c_str()); } - if (spotline.substr (0, pos) == "curveReti") { + if (spotline.substr(0, pos) == "curveReti") { retistrs[ns] = str3; } - if (spotline.substr (0, pos) == "curveLL") { + if (spotline.substr(0, pos) == "curveLL") { llstrs[ns] = str3; } - if (spotline.substr (0, pos) == "curveLH") { + if (spotline.substr(0, pos) == "curveLH") { lhstrs[ns] = str3; } - if (spotline.substr (0, pos) == "curveHH") { + if (spotline.substr(0, pos) == "curveHH") { hhstrs[ns] = str3; } - if (spotline.substr (0, pos) == "curveCC") { + if (spotline.substr(0, pos) == "curveCC") { ccstrs[ns] = str3; } - if (spotline.substr (0, pos) == "curveskin") { + if (spotline.substr(0, pos) == "curveskin") { skinstrs[ns] = str3; } - if (spotline.substr (0, pos) == "pthres") { + if (spotline.substr(0, pos) == "pthres") { pthstrs[ns] = str3; } - if (spotline.substr (0, pos) == "curveex") { + if (spotline.substr(0, pos) == "curveex") { exstrs[ns] = str3; } @@ -1803,6 +1804,7 @@ private: params.locallab.sensiexclu = dataspots[79][sp]; params.locallab.struc = dataspots[80][sp]; + params.locallab.warm = dataspots[81][sp]; params.locallab.hueref = ((float) dataspots[maxdata - 4][sp]) / 100.f; params.locallab.chromaref = dataspots[maxdata - 3][sp]; @@ -1814,11 +1816,11 @@ private: s_datc = new int[70]; int siz; - ipf.strcurv_data (retistrs[sp], s_datc, siz); + ipf.strcurv_data(retistrs[sp], s_datc, siz); std::vector cretiend; for (int j = 0; j < siz; j++) { - cretiend.push_back ((double) (s_datc[j]) / 1000.); + cretiend.push_back((double)(s_datc[j]) / 1000.); } delete [] s_datc; @@ -1827,13 +1829,13 @@ private: s_datcl = new int[70]; int sizl; - ipf.strcurv_data (llstrs[sp], s_datcl, sizl); + ipf.strcurv_data(llstrs[sp], s_datcl, sizl); std::vector cllend; for (int j = 0; j < sizl; j++) { - cllend.push_back ((double) (s_datcl[j]) / 1000.); + cllend.push_back((double)(s_datcl[j]) / 1000.); } delete [] s_datcl; @@ -1842,13 +1844,13 @@ private: s_datcc = new int[70]; int sizc; - ipf.strcurv_data (ccstrs[sp], s_datcc, sizc); + ipf.strcurv_data(ccstrs[sp], s_datcc, sizc); std::vector cccend; for (int j = 0; j < sizc; j++) { - cccend.push_back ((double) (s_datcc[j]) / 1000.); + cccend.push_back((double)(s_datcc[j]) / 1000.); } delete [] s_datcc; @@ -1857,26 +1859,26 @@ private: s_datch = new int[70]; int sizh; - ipf.strcurv_data (lhstrs[sp], s_datch, sizh); + ipf.strcurv_data(lhstrs[sp], s_datch, sizh); std::vector clhend; for (int j = 0; j < sizh; j++) { - clhend.push_back ((double) (s_datch[j]) / 1000.); + clhend.push_back((double)(s_datch[j]) / 1000.); } int *s_datchh; s_datchh = new int[70]; int sizhh; - ipf.strcurv_data (hhstrs[sp], s_datchh, sizhh); + ipf.strcurv_data(hhstrs[sp], s_datchh, sizhh); std::vector chhend; for (int j = 0; j < sizhh; j++) { - chhend.push_back ((double) (s_datchh[j]) / 1000.); + chhend.push_back((double)(s_datchh[j]) / 1000.); } delete [] s_datchh; @@ -1885,13 +1887,13 @@ private: s_datcsk = new int[70]; int sizsk; - ipf.strcurv_data (skinstrs[sp], s_datcsk, sizsk); + ipf.strcurv_data(skinstrs[sp], s_datcsk, sizsk); std::vector cskend; for (int j = 0; j < sizsk; j++) { - cskend.push_back ((double) (s_datcsk[j]) / 1000.); + cskend.push_back((double)(s_datcsk[j]) / 1000.); } delete [] s_datcsk; @@ -1899,22 +1901,22 @@ private: //PSThreshold + 1 int sizps = 2; int s_datcps[sizps + 1]; - ipf.strcurv_data (pthstrs[sp], s_datcps, sizps); + ipf.strcurv_data(pthstrs[sp], s_datcps, sizps); - params.locallab.psthreshold.setValues (s_datcps[0], s_datcps[1]); + params.locallab.psthreshold.setValues(s_datcps[0], s_datcps[1]); //expos int *s_datcex; s_datcex = new int[70]; int sizex; - ipf.strcurv_data (exstrs[sp], s_datcex, sizex); + ipf.strcurv_data(exstrs[sp], s_datcex, sizex); std::vector cexend; for (int j = 0; j < sizex; j++) { - cexend.push_back ((double) (s_datcex[j]) / 1000.); + cexend.push_back((double)(s_datcex[j]) / 1000.); } delete [] s_datcex; @@ -1948,7 +1950,7 @@ private: } - params.locallab.getCurves (locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); + params.locallab.getCurves(locRETgainCurve, locRETgainCurverab, loclhCurve, lochhCurve, LHutili, HHutili); bool locallutili = false; bool localcutili = false; bool localskutili = false; @@ -1966,11 +1968,11 @@ private: localexutili = true; } - CurveFactory::curveLocal (locallutili, params.locallab.llcurve, lllocalcurve, 1); - CurveFactory::curveCCLocal (localcutili, params.locallab.cccurve, cclocalcurve, 1); - CurveFactory::curveskLocal (localskutili, params.locallab.skintonescurve, sklocalcurve, 1); + CurveFactory::curveLocal(locallutili, params.locallab.llcurve, lllocalcurve, 1); + CurveFactory::curveCCLocal(localcutili, params.locallab.cccurve, cclocalcurve, 1); + CurveFactory::curveskLocal(localskutili, params.locallab.skintonescurve, sklocalcurve, 1); - CurveFactory::curveexLocal (localexutili, params.locallab.excurve, exlocalcurve, 1); + CurveFactory::curveexLocal(localexutili, params.locallab.excurve, exlocalcurve, 1); //provisory double br = 0.; double contr = 0.; @@ -1980,21 +1982,21 @@ private: double hlcomprthresh = params.locallab.hlcomprthresh; double shcompr = params.locallab.shcompr; - CurveFactory::complexCurvelocal (ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, - hist16, hltonecurveloc, shtonecurveloc, tonecurveloc, - 1); + CurveFactory::complexCurvelocal(ecomp, black / 65535., hlcompr, hlcomprthresh, shcompr, br, contr, + hist16, hltonecurveloc, shtonecurveloc, tonecurveloc, + 1); double huere, chromare, lumare; double sobelre; - ipf.calc_ref (labView, labView, 0, 0, fw, fh, 1, huere, chromare, lumare, sobelre); + ipf.calc_ref(labView, labView, 0, 0, fw, fh, 1, huere, chromare, lumare, sobelre); params.locallab.hueref = huere; 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, - LHutili, HHutili, cclocalcurve, localskutili, sklocalcurve, localexutili, exlocalcurve, hltonecurveloc, shtonecurveloc, tonecurveloc, params.locallab.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); + ipf.Lab_Local(2, (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.hueref, params.locallab.chromaref, params.locallab.lumaref, params.locallab.sobelref); lllocalcurve.clear(); cclocalcurve.clear(); sklocalcurve.clear(); @@ -2035,8 +2037,8 @@ private: t2.set(); - if ( settings->verbose ) { - printf ("Total local:- %d usec\n", t2.etime (t1)); + if (settings->verbose) { + printf("Total local:- %d usec\n", t2.etime(t1)); } } @@ -2044,32 +2046,32 @@ private: delete reservView; reservView = nullptr; - ipf.chromiLuminanceCurve (nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); + ipf.chromiLuminanceCurve(nullptr, 1, labView, labView, curve1, curve2, satcurve, lhskcurve, clcurve, lumacurve, utili, autili, butili, ccutili, cclutili, clcutili, dummy, dummy); if ((params.colorappearance.enabled && !params.colorappearance.tonecie) || (!params.colorappearance.enabled)) { - ipf.EPDToneMap (labView, 5, 1); + ipf.EPDToneMap(labView, 5, 1); } - ipf.vibrance (labView); + ipf.vibrance(labView); if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - ipf.impulsedenoise (labView); + ipf.impulsedenoise(labView); } // for all treatments Defringe, Sharpening, Contrast detail ,Microcontrast they are activated if "CIECAM" function are disabled if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - ipf.defringe (labView); + ipf.defringe(labView); } if (params.sharpenEdge.enabled) { - ipf.MLsharpen (labView); + ipf.MLsharpen(labView); } if (params.sharpenMicro.enabled) { - if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { - ipf.MLmicrocontrast (labView); //!params.colorappearance.sharpcie + if ((params.colorappearance.enabled && !settings->autocielab) || (!params.colorappearance.enabled)) { + ipf.MLmicrocontrast(labView); //!params.colorappearance.sharpcie } } @@ -2081,7 +2083,7 @@ private: buffer[i] = new float[fw]; } - ipf.sharpening (labView, (float**)buffer, params.sharpening); + ipf.sharpening(labView, (float**)buffer, params.sharpening); for (int i = 0; i < fh; i++) { delete [] buffer[i]; @@ -2097,22 +2099,22 @@ private: WavOpacityCurveW waOpacityCurveW; WavOpacityCurveWL waOpacityCurveWL; - params.wavelet.getCurves (wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL ); + params.wavelet.getCurves(wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL); // directional pyramid wavelet if (params.dirpyrequalizer.cbdlMethod == "aft") { if ((params.colorappearance.enabled && !settings->autocielab) || !params.colorappearance.enabled) { - ipf.dirpyrequalizer (labView, 1); //TODO: this is the luminance tonecurve, not the RGB one + ipf.dirpyrequalizer(labView, 1); //TODO: this is the luminance tonecurve, not the RGB one } } bool wavcontlutili = false; - CurveFactory::curveWavContL (wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); + CurveFactory::curveWavContL(wavcontlutili, params.wavelet.wavclCurve, wavclCurve,/* hist16C, dummy,*/ 1); if (params.wavelet.enabled) { - ipf.ip_wavelet (labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); + ipf.ip_wavelet(labView, labView, 2, WaveParams, wavCLVCurve, waOpacityCurveRG, waOpacityCurveBY, waOpacityCurveW, waOpacityCurveWL, wavclCurve, 1); } wavCLVCurve.Reset(); @@ -2126,9 +2128,9 @@ private: f_h = fh; } - CieImage *cieView = new CieImage (f_w, (f_h)); + CieImage *cieView = new CieImage(f_w, (f_h)); - CurveFactory::curveLightBrightColor ( + CurveFactory::curveLightBrightColor( params.colorappearance.curve, params.colorappearance.curve2, params.colorappearance.curve3, @@ -2149,19 +2151,19 @@ private: //imgNum = params.raw.xtranssensor.imageNum; } - float fnum = imgsrc->getMetaData()->getFNumber (imgNum); // F number - float fiso = imgsrc->getMetaData()->getISOSpeed (imgNum) ; // ISO - float fspeed = imgsrc->getMetaData()->getShutterSpeed (imgNum) ; //speed - float fcomp = imgsrc->getMetaData()->getExpComp (imgNum); //compensation + - + float fnum = imgsrc->getMetaData()->getFNumber(imgNum); // F number + float fiso = imgsrc->getMetaData()->getISOSpeed(imgNum) ; // ISO + float fspeed = imgsrc->getMetaData()->getShutterSpeed(imgNum) ; //speed + float fcomp = imgsrc->getMetaData()->getExpComp(imgNum); //compensation + - if (fnum < 0.3f || fiso < 5.f || fspeed < 0.00001f) { adap = 2000.; }//if no exif data or wrong else { - float E_V = fcomp + log2 ((fnum * fnum) / fspeed / (fiso / 100.f)); + float E_V = fcomp + log2((fnum * fnum) / fspeed / (fiso / 100.f)); E_V += params.toneCurve.expcomp;// exposure compensation in tonecurve ==> direct EV - E_V += log2 (params.raw.expos); // exposure raw white point ; log2 ==> linear to EV - adap = powf (2.f, E_V - 3.f); //cd / m2 + E_V += log2(params.raw.expos); // exposure raw white point ; log2 ==> linear to EV + adap = powf(2.f, E_V - 3.f); //cd / m2 } LUTf CAMBrightCurveJ; @@ -2171,18 +2173,18 @@ private: if (params.sharpening.enabled) { if (settings->ciecamfloat) { float d, dj, yb; - ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); + ipf.ciecam_02float(cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } else { double dd, dj; - ipf.ciecam_02 (cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); + ipf.ciecam_02(cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); } } else { if (settings->ciecamfloat) { float d, dj, yb; - ipf.ciecam_02float (cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); + ipf.ciecam_02float(cieView, float (adap), 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, d, dj, yb, 1); } else { double dd, dj; - ipf.ciecam_02 (cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); + ipf.ciecam_02(cieView, adap, 1, 2, labView, ¶ms, customColCurve1, customColCurve2, customColCurve3, dummy, dummy, CAMBrightCurveJ, CAMBrightCurveQ, CAMMean, 5, 1, true, dd, dj, 1); } } } @@ -2198,11 +2200,11 @@ private: //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if (pl) { - pl->setProgress (0.60); + pl->setProgress(0.60); } int imw, imh; - double tmpScale = ipf.resizeScale (¶ms, fw, fh, imw, imh); + double tmpScale = ipf.resizeScale(¶ms, fw, fh, imw, imh); bool labResize = params.resize.enabled && params.resize.method != "Nearest" && tmpScale != 1.0; LabImage *tmplab; @@ -2216,7 +2218,7 @@ private: ch = params.crop.h; if (labResize) { // crop lab data - tmplab = new LabImage (cw, ch); + tmplab = new LabImage(cw, ch); for (int row = 0; row < ch; row++) { for (int col = 0; col < cw; col++) { @@ -2235,8 +2237,8 @@ private: if (labResize) { // resize lab data // resize image - tmplab = new LabImage (imw, imh); - ipf.Lanczos (labView, tmplab, tmpScale); + tmplab = new LabImage(imw, imh); + ipf.Lanczos(labView, tmplab, tmpScale); delete labView; labView = tmplab; cw = labView->W; @@ -2254,7 +2256,7 @@ private: buffer[i] = new float[cw]; } - ipf.sharpening (labView, (float**)buffer, params.prsharpening); + ipf.sharpening(labView, (float**)buffer, params.prsharpening); for (int i = 0; i < ch; i++) { delete [] buffer[i]; @@ -2274,13 +2276,13 @@ private: GammaValues ga; // if(params.blackwhite.enabled) params.toneCurve.hrenabled=false; - readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm, &ga); + readyImg = ipf.lab2rgb16(labView, cx, cy, cw, ch, params.icm, &ga); customGamma = true; //or selected Free gamma useLCMS = false; - if ((jprof = ICCStore::getInstance()->createCustomGammaOutputProfile (params.icm, ga)) == nullptr) { + if ((jprof = ICCStore::getInstance()->createCustomGammaOutputProfile(params.icm, ga)) == nullptr) { useLCMS = true; } @@ -2288,10 +2290,10 @@ private: // if Default gamma mode: we use the profile selected in the "Output profile" combobox; // gamma come from the selected profile, otherwise it comes from "Free gamma" tool - readyImg = ipf.lab2rgb16 (labView, cx, cy, cw, ch, params.icm); + readyImg = ipf.lab2rgb16(labView, cx, cy, cw, ch, params.icm); if (settings->verbose) { - printf ("Output profile_: \"%s\"\n", params.icm.output.c_str()); + printf("Output profile_: \"%s\"\n", params.icm.output.c_str()); } } @@ -2304,24 +2306,24 @@ private: if (bwonly) { //force BW r=g=b if (settings->verbose) { - printf ("Force BW\n"); + printf("Force BW\n"); } for (int ccw = 0; ccw < cw; ccw++) { for (int cch = 0; cch < ch; cch++) { - readyImg->r (cch, ccw) = readyImg->g (cch, ccw); - readyImg->b (cch, ccw) = readyImg->g (cch, ccw); + readyImg->r(cch, ccw) = readyImg->g(cch, ccw); + readyImg->b(cch, ccw) = readyImg->g(cch, ccw); } } } if (pl) { - pl->setProgress (0.70); + pl->setProgress(0.70); } if (tmpScale != 1.0 && params.resize.method == "Nearest") { // resize rgb data (gamma applied) - Image16* tempImage = new Image16 (imw, imh); - ipf.resize (readyImg, tempImage, tmpScale); + Image16* tempImage = new Image16(imw, imh); + ipf.resize(readyImg, tempImage, tmpScale); delete readyImg; readyImg = tempImage; } @@ -2329,10 +2331,10 @@ private: if (tunnelMetaData) { // Sending back the whole first root, which won't necessarily be the selected frame number // and may contain subframe depending on initial raw's hierarchy - readyImg->setMetadata (ii->getMetaData()->getRootExifData ()); + readyImg->setMetadata(ii->getMetaData()->getRootExifData()); } else { // ask for the correct frame number, but may contain subframe depending on initial raw's hierarchy - readyImg->setMetadata (ii->getMetaData()->getBestExifData (imgsrc, ¶ms.raw), params.exif, params.iptc); + readyImg->setMetadata(ii->getMetaData()->getBestExifData(imgsrc, ¶ms.raw), params.exif, params.iptc); } @@ -2340,8 +2342,8 @@ private: if (customGamma) { if (!useLCMS) { // use corrected sRGB profile in order to apply a good TRC if present, otherwise use LCMS2 profile generated by lab2rgb16 w/ gamma - ProfileContent pc (jprof); - readyImg->setOutputProfile (pc.getData().c_str(), pc.getData().size()); + ProfileContent pc(jprof); + readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size()); } } else { // use the selected output profile if present, otherwise use LCMS2 profile generate by lab2rgb16 w/ gamma @@ -2349,23 +2351,23 @@ private: if (params.icm.output != "" && params.icm.output != ColorManagementParams::NoICMString) { // if ICCStore::getInstance()->getProfile send back an object, then ICCStore::getInstance()->getContent will do too - cmsHPROFILE jprof = ICCStore::getInstance()->getProfile (params.icm.output); //get outProfile + cmsHPROFILE jprof = ICCStore::getInstance()->getProfile(params.icm.output); //get outProfile if (jprof == nullptr) { if (settings->verbose) { - printf ("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", params.icm.output.c_str()); + printf("\"%s\" ICC output profile not found!\n - use LCMS2 substitution\n", params.icm.output.c_str()); } } else { if (settings->verbose) { - printf ("Using \"%s\" output profile\n", params.icm.output.c_str()); + printf("Using \"%s\" output profile\n", params.icm.output.c_str()); } - ProfileContent pc = ICCStore::getInstance()->getContent (params.icm.output); - readyImg->setOutputProfile (pc.getData().c_str(), pc.getData().size()); + ProfileContent pc = ICCStore::getInstance()->getContent(params.icm.output); + readyImg->setOutputProfile(pc.getData().c_str(), pc.getData().size()); } } else { // No ICM - readyImg->setOutputProfile (nullptr, 0); + readyImg->setOutputProfile(nullptr, 0); } } @@ -2374,13 +2376,13 @@ private: // printf("Total:- %d usec\n", t2.etime(t1)); if (!job->initialImage) { - ii->decreaseRef (); + ii->decreaseRef(); } delete job; if (pl) { - pl->setProgress (0.75); + pl->setProgress(0.75); } /* curve1.reset();curve2.reset(); @@ -2404,10 +2406,10 @@ private: ImProcFunctions &ipf = * (ipf_p.get()); int imw, imh; - double scale_factor = ipf.resizeScale (¶ms, fw, fh, imw, imh); + double scale_factor = ipf.resizeScale(¶ms, fw, fh, imw, imh); - std::unique_ptr tmplab (new LabImage (fw, fh)); - ipf.rgb2lab (*baseImg, *tmplab, params.icm.working); + std::unique_ptr tmplab(new LabImage(fw, fh)); + ipf.rgb2lab(*baseImg, *tmplab, params.icm.working); if (params.crop.enabled) { int cx = params.crop.x; @@ -2415,7 +2417,7 @@ private: int cw = params.crop.w; int ch = params.crop.h; - std::unique_ptr cropped (new LabImage (cw, ch)); + std::unique_ptr cropped(new LabImage(cw, ch)); for (int row = 0; row < ch; row++) { for (int col = 0; col < cw; col++) { @@ -2425,29 +2427,29 @@ private: } } - tmplab = std::move (cropped); + tmplab = std::move(cropped); } - assert (params.resize.enabled); + assert(params.resize.enabled); // resize image { - std::unique_ptr resized (new LabImage (imw, imh)); - ipf.Lanczos (tmplab.get(), resized.get(), scale_factor); - tmplab = std::move (resized); + std::unique_ptr resized(new LabImage(imw, imh)); + ipf.Lanczos(tmplab.get(), resized.get(), scale_factor); + tmplab = std::move(resized); } - adjust_procparams (scale_factor); + adjust_procparams(scale_factor); fw = imw; fh = imh; delete baseImg; - baseImg = new Imagefloat (fw, fh); - ipf.lab2rgb (*tmplab, *baseImg, params.icm.working); + baseImg = new Imagefloat(fw, fh); + ipf.lab2rgb(*tmplab, *baseImg, params.icm.working); } - void adjust_procparams (double scale_factor) + void adjust_procparams(double scale_factor) { procparams::ProcParams ¶ms = job->pparams; procparams::ProcParams defaultparams; @@ -2458,8 +2460,8 @@ private: if (params.prsharpening.enabled) { params.sharpening = params.prsharpening; } else { - adjust_radius (defaultparams.sharpening.radius, scale_factor, - params.sharpening.radius); + adjust_radius(defaultparams.sharpening.radius, scale_factor, + params.sharpening.radius); } params.impulseDenoise.thresh *= scale_factor; @@ -2474,16 +2476,16 @@ private: auto &lcurve = params.dirpyrDenoise.lcurve; for (size_t i = 2; i < lcurve.size(); i += 4) { - lcurve[i] *= min (scale_factor * 2, 1.0); + lcurve[i] *= min(scale_factor * 2, 1.0); } - noiseLCurve.Set (lcurve); + noiseLCurve.Set(lcurve); const char *medmethods[] = { "soft", "33", "55soft", "55", "77", "99" }; if (params.dirpyrDenoise.median) { auto &key = params.dirpyrDenoise.methodmed == "RGB" ? params.dirpyrDenoise.rgbmethod : params.dirpyrDenoise.medmethod; - for (int i = 1; i < int (sizeof (medmethods) / sizeof (const char *)); ++i) { + for (int i = 1; i < int (sizeof(medmethods) / sizeof(const char *)); ++i) { if (key == medmethods[i]) { int j = i - int (1.0 / scale_factor); @@ -2501,29 +2503,25 @@ private: params.epd.scale *= scale_factor; //params.epd.edgeStopping *= scale_factor; - const double dirpyreq_scale = min (scale_factor * 1.5, 1.0); + const double dirpyreq_scale = min(scale_factor * 1.5, 1.0); for (int i = 0; i < 6; ++i) { - adjust_radius (defaultparams.dirpyrequalizer.mult[i], dirpyreq_scale, - params.dirpyrequalizer.mult[i]); + adjust_radius(defaultparams.dirpyrequalizer.mult[i], dirpyreq_scale, + params.dirpyrequalizer.mult[i]); } params.dirpyrequalizer.threshold *= scale_factor; - adjust_radius (defaultparams.defringe.radius, scale_factor, - params.defringe.radius); - adjust_radius (defaultparams.sh.radius, scale_factor, params.sh.radius); + adjust_radius(defaultparams.defringe.radius, scale_factor, + 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); } } @@ -2606,40 +2604,40 @@ private: } // namespace -IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool tunnelMetaData, bool flush) +IImage16* processImage(ProcessingJob* pjob, int& errorCode, ProgressListener* pl, bool tunnelMetaData, bool flush) { - ImageProcessor proc (pjob, errorCode, pl, tunnelMetaData, flush); + ImageProcessor proc(pjob, errorCode, pl, tunnelMetaData, flush); return proc(); } -void batchProcessingThread (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) +void batchProcessingThread(ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) { ProcessingJob* currentJob = job; while (currentJob) { int errorCode; - IImage16* img = processImage (currentJob, errorCode, bpl, tunnelMetaData, true); + IImage16* img = processImage(currentJob, errorCode, bpl, tunnelMetaData, true); if (errorCode) { - bpl->error (M ("MAIN_MSG_CANNOTLOAD")); + bpl->error(M("MAIN_MSG_CANNOTLOAD")); currentJob = nullptr; } else { try { - currentJob = bpl->imageReady (img); + currentJob = bpl->imageReady(img); } catch (Glib::Exception& ex) { - bpl->error (ex.what()); + bpl->error(ex.what()); currentJob = nullptr; } } } } -void startBatchProcessing (ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) +void startBatchProcessing(ProcessingJob* job, BatchProcessingListener* bpl, bool tunnelMetaData) { if (bpl) { - Glib::Thread::create (sigc::bind (sigc::ptr_fun (batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_LOW); + Glib::Thread::create(sigc::bind(sigc::ptr_fun(batchProcessingThread), job, bpl, tunnelMetaData), 0, true, true, Glib::THREAD_PRIORITY_LOW); } } diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 4af176cd2..645451905 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -233,18 +233,12 @@ void gaussianBlur (const Array2Df& I, Array2Df& L, bool multithread) } } -void createGaussianPyramids ( Array2Df* H, Array2Df** pyramids, int nlevels, bool multithread) +void createGaussianPyramids (Array2Df** pyramids, int nlevels, bool multithread) { - int width = H->getCols(); - int height = H->getRows(); - const int size = width * height; + // pyramids[0] is already set + int width = pyramids[0]->getCols(); + int height = pyramids[0]->getRows(); - pyramids[0] = new Array2Df (width, height); - -//#pragma omp parallel for shared(pyramids, H) - for ( int i = 0 ; i < size ; i++ ) { - (*pyramids[0]) (i) = (*H) (i); - } Array2Df* L = new Array2Df (width, height); gaussianBlur ( *pyramids[0], *L, multithread ); @@ -531,77 +525,54 @@ void tmo_fattal02 (size_t width, /** RT */ - // create gaussian pyramids - // int mins = (width= MSIZE ) - // { - // nlevels++; - // mins /= 2; - // } - // // std::cout << "DEBUG: nlevels = " << nlevels << ", mins = " << mins << std::endl; - // // The following lines solves a bug with images particularly small - // if (nlevels == 0) nlevels = 1; const int nlevels = 7; // RT -- see above - Array2Df** pyramids = new Array2Df*[nlevels]; - createGaussianPyramids (H, pyramids, nlevels, multithread); - // ph.setValue(8); + Array2Df* pyramids[nlevels]; + pyramids[0] = H; + createGaussianPyramids (pyramids, nlevels, multithread); // calculate gradients and its average values on pyramid levels - Array2Df** gradients = new Array2Df*[nlevels]; - float* avgGrad = new float[nlevels]; + Array2Df* gradients[nlevels]; + float avgGrad[nlevels]; for ( int k = 0 ; k < nlevels ; k++ ) { gradients[k] = new Array2Df (pyramids[k]->getCols(), pyramids[k]->getRows()); avgGrad[k] = calculateGradients (pyramids[k], gradients[k], k, multithread); - delete pyramids[k]; + if(k != 0) // pyramids[0] is H. Will be deleted later + delete pyramids[k]; } - delete[] pyramids; - // ph.setValue(12); // calculate fi matrix Array2Df* FI = new Array2Df (width, height); calculateFiMatrix (FI, gradients, avgGrad, nlevels, detail_level, alfa, beta, noise, multithread); -// dumpPFS( "FI.pfs", FI, "Y" ); for ( int i = 0 ; i < nlevels ; i++ ) { delete gradients[i]; } - delete[] gradients; - delete[] avgGrad; - // ph.setValue(16); - // if (ph.canceled()){ - // delete FI; - // delete H; - // return; - // } - /** - RT - bring back the FI image to the input size if it was downscaled */ if (fullH) { + delete H; + H = fullH; Array2Df *FI2 = new Array2Df (fullwidth, fullheight); rescale_bilinear (*FI, *FI2, multithread); delete FI; FI = FI2; width = fullwidth; height = fullheight; - delete H; - H = fullH; } /** RT */ // attenuate gradients Array2Df* Gx = new Array2Df (width, height); - Array2Df* Gy = new Array2Df (width, height); + Array2Df* Gy = &L; // use L as buffer for Gy // the fft solver solves the Poisson pde but with slightly different // boundary conditions, so we need to adjust the assembly of the right hand // side accordingly (basically fft solver assumes U(-1) = U(1), whereas zero // Neumann conditions assume U(-1)=U(0)), see also divergence calculation - // if (fftsolver) #pragma omp parallel for if(multithread) for ( size_t y = 0 ; y < height ; y++ ) { @@ -634,68 +605,49 @@ void tmo_fattal02 (size_t width, (*FI) (x, y) -= (*Gy) (x, y - 1); } - // if (fftsolver) - { - if (x == 0) { - (*FI) (x, y) += (*Gx) (x, y); - } + if (x == 0) { + (*FI) (x, y) += (*Gx) (x, y); + } - if (y == 0) { - (*FI) (x, y) += (*Gy) (x, y); - } + if (y == 0) { + (*FI) (x, y) += (*Gy) (x, y); } } } //delete Gx; // RT - reused as temp buffer in solve_pde_fft, deleted later - delete Gy; // solve pde and exponentiate (ie recover compressed image) { - // if (fftsolver) - { - MyMutex::MyLock lock (*fftwMutex); - solve_pde_fft (FI, &L, Gx, multithread); //, ph); - } - delete Gx; - delete FI; - // else - // { - // solve_pde_multigrid(&DivG, &U, ph); - // } -// #ifndef NDEBUG -// printf("\npde residual error: %f\n", residual_pde(&U, &DivG)); -// #endif - // ph.setValue(90); - // if ( ph.canceled() ) - // { - // return; - // } - #pragma omp parallel if(multithread) - { + MyMutex::MyLock lock (*fftwMutex); + solve_pde_fft (FI, &L, Gx, multithread); + } + delete Gx; + delete FI; + + #pragma omp parallel if(multithread) + { #ifdef __SSE2__ - vfloat gammav = F2V (gamma); + vfloat gammav = F2V (gamma); #endif - #pragma omp for schedule(dynamic,16) + #pragma omp for schedule(dynamic,16) - for (size_t i = 0 ; i < height ; i++) { - size_t j = 0; + for (size_t i = 0 ; i < height ; i++) { + size_t j = 0; #ifdef __SSE2__ - for (; j < width - 3; j += 4) { - STVFU (L[i][j], xexpf (gammav * LVFU (L[i][j]))); - } + for (; j < width - 3; j += 4) { + STVFU (L[i][j], xexpf (gammav * LVFU (L[i][j]))); + } #endif - for (; j < width; j++) { - L[i][j] = xexpf ( gamma * L[i][j]); - } + for (; j < width; j++) { + L[i][j] = xexpf ( gamma * L[i][j]); } } } - // ph.setValue(95); // remove percentile of min and max values and renormalize float cut_min = 0.01f * black_point; @@ -759,31 +711,6 @@ void tmo_fattal02 (size_t width, // atimes(). This means the assembly of the right hand side F is different // for both solvers. -// #include - -// #include - -// #include -// #include -// #include "arch/math.h" -// #include -// #ifdef _OPENMP -// #include -// #endif -// #include -// #include - -// #include "Libpfs/progress.h" -// #include "Libpfs/array2d.h" -// #include "pde.h" - -// using namespace std; - - -// #ifndef SQR -// #define SQR(x) (x)*(x) -// #endif - // returns T = EVy A EVx^tr // note, modifies input data @@ -955,23 +882,13 @@ void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/* // transforms F into eigenvector space: Ftr = //DEBUG_STR << "solve_pde_fft: transform F to ev space (fft)" << std::endl; - Array2Df* F_tr = buf; //new Array2Df(width,height); + Array2Df* F_tr = buf; transform_normal2ev (F, F_tr, multithread); // TODO: F no longer needed so could release memory, but as it is an // input parameter we won't do that - // ph.setValue(50); - // if (ph.canceled()) - // { - // delete F_tr; - // return; - // } - //DEBUG_STR << "solve_pde_fft: F_tr(0,0) = " << (*F_tr)(0,0); - //DEBUG_STR << " (must be 0 for solution to exist)" << std::endl; // in the eigenvector space the solution is very simple - //DEBUG_STR << "solve_pde_fft: solve in eigenvector space" << std::endl; -// Array2Df* U_tr = new Array2Df(width,height); std::vector l1 = get_lambda (height); std::vector l2 = get_lambda (width); @@ -985,10 +902,8 @@ void solve_pde_fft (Array2Df *F, Array2Df *U, Array2Df *buf, bool multithread)/* (*F_tr) (0, 0) = 0.f; // any value ok, only adds a const to the solution - // transforms U_tr back to the normal space - //DEBUG_STR << "solve_pde_fft: transform U_tr to normal space (fft)" << std::endl; + // transforms F_tr back to the normal space transform_ev2normal (F_tr, U, multithread); -// delete F_tr; // no longer needed so release memory // the solution U as calculated will satisfy something like int U = 0 // since for any constant c, U-c is also a solution and we are mainly diff --git a/rtengine/utils.h b/rtengine/utils.h index 9c56ad0a0..5730c2544 100644 --- a/rtengine/utils.h +++ b/rtengine/utils.h @@ -38,7 +38,7 @@ void hflip(unsigned char* img, int w, int h); void vflip(unsigned char* img, int w, int h); template -typename std::underlying_type::type toUnderlying(ENUM value) +constexpr typename std::underlying_type::type toUnderlying(ENUM value) { return static_cast::type>(value); } 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 91f58f42e..7a31ae39f 100644 --- a/rtgui/colorappearance.cc +++ b/rtgui/colorappearance.cc @@ -799,9 +799,9 @@ void ColorAppearance::read (const ProcParams* pp, const ParamsEdited* pedited) shape->setCurve (pp->colorappearance.curve); shape2->setCurve (pp->colorappearance.curve2); shape3->setCurve (pp->colorappearance.curve3); - toneCurveMode->set_active (pp->colorappearance.curveMode); - toneCurveMode2->set_active (pp->colorappearance.curveMode2); - toneCurveMode3->set_active (pp->colorappearance.curveMode3); + toneCurveMode->set_active (toUnderlying(pp->colorappearance.curveMode)); + toneCurveMode2->set_active (toUnderlying(pp->colorappearance.curveMode2)); + toneCurveMode3->set_active (toUnderlying(pp->colorappearance.curveMode3)); curveMode3Changed(); // This will set the correct sensitive state of depending Adjusters if (pedited) { @@ -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::TC_MODE_LIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TcMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode = ColorAppearanceParams::TC_MODE_BRIGHT; + pp->colorappearance.curveMode = ColorAppearanceParams::TcMode::BRIGHT; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_LIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TcMode::LIGHT; } else if (tcMode == 1) { - pp->colorappearance.curveMode2 = ColorAppearanceParams::TC_MODE_BRIGHT; + pp->colorappearance.curveMode2 = ColorAppearanceParams::TcMode::BRIGHT; } int tcMode3 = toneCurveMode3->get_active_row_number(); if (tcMode3 == 0) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_CHROMA; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::CHROMA; } else if (tcMode3 == 1) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_SATUR; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::SATUR; } else if (tcMode3 == 2) { - pp->colorappearance.curveMode3 = ColorAppearanceParams::TC_MODE_COLORF; + pp->colorappearance.curveMode3 = ColorAppearanceParams::CtcMode::COLORF; } if (pedited) { diff --git a/rtgui/colortoning.cc b/rtgui/colortoning.cc index 786030a73..c5d9252cd 100644 --- a/rtgui/colortoning.cc +++ b/rtgui/colortoning.cc @@ -54,14 +54,14 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR colorShape->setLeftBarBgGradient(milestones); + const ColorToningParams default_params; + // luminance gradient milestones.clear(); milestones.push_back( GradientMilestone(0., 0., 0., 0.) ); milestones.push_back( GradientMilestone(1., 1., 1., 1.) ); colorShape->setBottomBarBgGradient(milestones); - std::vector defaultCurve; - rtengine::ColorToningParams::getDefaultColorCurve(defaultCurve); - colorShape->setResetCurve(FCT_MinMaxCPoints, defaultCurve); + colorShape->setResetCurve(FCT_MinMaxCPoints, default_params.colorCurve); // This will add the reset button at the end of the curveType buttons colorCurveEditorG->curveListComplete(); @@ -88,10 +88,9 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR opacityCurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_OPACITY")); opacityCurveEditorG->setCurveListener (this); - rtengine::ColorToningParams::getDefaultOpacityCurve(defaultCurve); opacityShape = static_cast(opacityCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShape->setIdentityValue(0.); - opacityShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShape->setResetCurve(FlatCurveType(default_params.opacityCurve.at(0)), default_params.opacityCurve); opacityShape->setBottomBarBgGradient(milestones); // This will add the reset button at the end of the curveType buttons @@ -107,9 +106,8 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR clCurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_CHROMAC")); clCurveEditorG->setCurveListener (this); - rtengine::ColorToningParams::getDefaultCLCurve(defaultCurve); clshape = static_cast(clCurveEditorG->addCurve(CT_Diagonal, M("TP_COLORTONING_AB"), irg, false)); - clshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + clshape->setResetCurve(DiagonalCurveType(default_params.clcurve.at(0)), default_params.clcurve); clshape->setTooltip(M("TP_COLORTONING_CURVEEDITOR_CL_TOOLTIP")); clshape->setLeftBarColorProvider(this, 1); @@ -127,9 +125,8 @@ ColorToning::ColorToning () : FoldableToolPanel(this, "colortoning", M("TP_COLOR cl2CurveEditorG = new CurveEditorGroup (options.lastColorToningCurvesDir, M("TP_COLORTONING_CHROMAC")); cl2CurveEditorG->setCurveListener (this); - rtengine::ColorToningParams::getDefaultCL2Curve(defaultCurve); cl2shape = static_cast(cl2CurveEditorG->addCurve(CT_Diagonal, M("TP_COLORTONING_BY"), iby, false)); - cl2shape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); + cl2shape->setResetCurve(DiagonalCurveType(default_params.cl2curve.at(0)), default_params.cl2curve); cl2shape->setTooltip(M("TP_COLORTONING_CURVEEDITOR_CL_TOOLTIP")); cl2shape->setLeftBarColorProvider(this, 1); 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/darkframe.cc b/rtgui/darkframe.cc index ab9156d7d..9f1f61d18 100644 --- a/rtgui/darkframe.cc +++ b/rtgui/darkframe.cc @@ -77,7 +77,7 @@ void DarkFrame::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi dfAuto->set_active( pp->raw.df_autoselect ); if(pedited ) { - dfAuto->set_inconsistent(!pedited->raw.dfAuto ); + dfAuto->set_inconsistent(!pedited->raw.df_autoselect ); } if (Glib::file_test (pp->raw.dark_frame, Glib::FILE_TEST_EXISTS)) { @@ -152,7 +152,7 @@ void DarkFrame::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit if (pedited) { pedited->raw.darkFrame = dfChanged; - pedited->raw.dfAuto = !dfAuto->get_inconsistent(); + pedited->raw.df_autoselect = !dfAuto->get_inconsistent(); } } diff --git a/rtgui/dirpyrdenoise.cc b/rtgui/dirpyrdenoise.cc index 168a9df03..2a90f183e 100644 --- a/rtgui/dirpyrdenoise.cc +++ b/rtgui/dirpyrdenoise.cc @@ -61,7 +61,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP NoiscurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_LCURVE")); //curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir); NoiscurveEditorG->setCurveListener (this); - rtengine::DirPyrDenoiseParams::getDefaultNoisCurve(defaultCurve); + defaultCurve = rtengine::DirPyrDenoiseParams().lcurve; lshape = static_cast(NoiscurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); lshape->setIdentityValue(0.); lshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); @@ -145,7 +145,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP CCcurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_CCCURVE")); CCcurveEditorG->setCurveListener (this); - rtengine::DirPyrDenoiseParams::getDefaultCCCurve(defaultCurve); + defaultCurve = rtengine::DirPyrDenoiseParams().cccurve; ccshape = static_cast(CCcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); ccshape->setIdentityValue(0.); ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); 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/filebrowser.cc b/rtgui/filebrowser.cc index cda737285..b308911a7 100644 --- a/rtgui/filebrowser.cc +++ b/rtgui/filebrowser.cc @@ -1021,7 +1021,7 @@ void FileBrowser::pasteProfile () for (unsigned int i = 0; i < mselected.size(); i++) { // copying read only clipboard PartialProfile to a temporary one - rtengine::procparams::PartialProfile cbPartProf = clipboard.getPartialProfile(); + const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile(); rtengine::procparams::PartialProfile pastedPartProf(cbPartProf.pparams, cbPartProf.pedited, true); // applying the PartialProfile to the thumb's ProcParams @@ -1069,7 +1069,7 @@ void FileBrowser::partPasteProfile () for (unsigned int i = 0; i < mselected.size(); i++) { // copying read only clipboard PartialProfile to a temporary one, initialized to the thumb's ProcParams mselected[i]->thumbnail->createProcParamsForUpdate(false, false); // this can execute customprofilebuilder to generate param file - rtengine::procparams::PartialProfile cbPartProf = clipboard.getPartialProfile(); + const rtengine::procparams::PartialProfile& cbPartProf = clipboard.getPartialProfile(); rtengine::procparams::PartialProfile pastedPartProf(&mselected[i]->thumbnail->getProcParams (), nullptr); // pushing the selected values of the clipboard PartialProfile to the temporary PartialProfile 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/lensprofile.cc b/rtgui/lensprofile.cc index f5c9a11ab..052cb1455 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -190,10 +190,6 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa updateDisabled(false); } - ckbUseDist->set_active (pp->lensProf.useDist); - ckbUseVign->set_active (pp->lensProf.useVign && isRaw); - ckbUseCA->set_active(pp->lensProf.useCA && isRaw && ckbUseCA->get_sensitive()); - const LFDatabase *db = LFDatabase::getInstance(); LFCamera c; @@ -226,6 +222,10 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa updateLensfunWarning(); + ckbUseDist->set_active (pp->lensProf.useDist); + ckbUseVign->set_active (pp->lensProf.useVign && isRaw); + ckbUseCA->set_active(pp->lensProf.useCA && isRaw && ckbUseCA->get_sensitive()); + enableListener (); conUseDist.block(false); } diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index eaa228036..f7aafea60 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -189,6 +189,7 @@ Locallab::Locallab(): } } + const LocallabParams default_params; nbspot->setAdjusterListener(this); nbspot->set_tooltip_text(M("TP_LOCALLAB_NBSPOT_TOOLTIP")); @@ -309,9 +310,7 @@ Locallab::Locallab(): llCurveEditorG->setCurveListener(this); - rtengine::LocallabParams::getDefaultLLCurve(defaultCurve); llshape = static_cast(llCurveEditorG->addCurve(CT_Diagonal, "L(L)")); - // llshape->setResetCurve(DiagonalCurveType(defaultCurve.at(0)), defaultCurve); llshape->setResetCurve(DiagonalCurveType(default_params.llcurve.at(0)), default_params.llcurve); llshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); milestones.push_back(GradientMilestone(0., 0., 0., 0.)); @@ -319,7 +318,6 @@ Locallab::Locallab(): llshape->setBottomBarBgGradient(milestones); llshape->setLeftBarBgGradient(milestones); - rtengine::LocallabParams::getDefaultCCCurve(defaultCurve4); ccshape = static_cast(llCurveEditorG->addCurve(CT_Diagonal, "C(C)")); ccshape->setResetCurve(DiagonalCurveType(default_params.cccurve.at(0)), default_params.cccurve); ccshape->setTooltip(M("TP_LOCALLAB_CURVEEDITOR_LL_TOOLTIP")); @@ -328,7 +326,6 @@ Locallab::Locallab(): ccshape->setBottomBarBgGradient(milestones); ccshape->setLeftBarBgGradient(milestones); - rtengine::LocallabParams::getDefaultLHCurve(defaultCurve3); LHshape = static_cast(llCurveEditorG->addCurve(CT_Flat, "L(H)", nullptr, false, true)); @@ -347,7 +344,6 @@ Locallab::Locallab(): LHshape->setBottomBarBgGradient(milestones); - rtengine::LocallabParams::getDefaultHHCurve(defaultCurve5); HHshape = static_cast(llCurveEditorG->addCurve(CT_Flat, "H(H)", nullptr, false, true)); @@ -378,6 +374,12 @@ Locallab::Locallab(): //contrast->set_tooltip_text (M("TP_LOCALLAB_CONTRAST_TOOLTIP")); contrast->setAdjusterListener(this); + Gtk::Image* iblueredL = Gtk::manage(new RTImage("ajd-wb-bluered1.png")); + Gtk::Image* iblueredR = Gtk::manage(new RTImage("ajd-wb-bluered2.png")); + + warm = Gtk::manage(new Adjuster(M("TP_LOCALLAB_WARM"), -100., 100., 1., 0., iblueredL, iblueredR)); + warm->setAdjusterListener(this); + //chroma->set_tooltip_text (M("TP_LOCALLAB_CHROMA_TOOLTIP")); chroma->setAdjusterListener(this); @@ -471,7 +473,6 @@ Locallab::Locallab(): LocalcurveEditorgainT->setCurveListener(this); - rtengine::LocallabParams::getDefaultLocalgainCurveT(defaultCurve2); cTgainshape = static_cast(LocalcurveEditorgainT->addCurve(CT_Flat, "", nullptr, false, false)); @@ -482,14 +483,13 @@ Locallab::Locallab(): LocalcurveEditorgainTrab->setCurveListener(this); - rtengine::LocallabParams::getDefaultLocalgainCurveTrab(defaultCurve2rab); cTgainshaperab = static_cast(LocalcurveEditorgainTrab->addCurve(CT_Flat, "", nullptr, false, false)); cTgainshaperab->setIdentityValue(0.); - cTgainshaperab->setResetCurve(FlatCurveType(localTgaincurverab.at(0)), localTgaincurverab); + cTgainshaperab->setResetCurve(FlatCurveType(default_params.localTgaincurverab.at(0)), default_params.localTgaincurverab); cTgainshaperab->setTooltip(M("TP_RETINEX_GAINTRANSMISSIONRAB_TOOLTIP")); LocalcurveEditorgainT->curveListComplete(); @@ -683,6 +683,7 @@ Locallab::Locallab(): colorBox->pack_start(*superFrame); colorBox->pack_start(*chroma); + colorBox->pack_start(*warm); colorBox->pack_start(*sensi); dustFrame->set_label_align(0.025, 0.5); @@ -1255,6 +1256,7 @@ void Locallab::neutral_pressed() proxi->resetValue(false); lightness->resetValue(false); chroma->resetValue(false); + warm->resetValue(false); contrast->resetValue(false); sensi->resetValue(false); radius->resetValue(false); @@ -1803,12 +1805,13 @@ bool Locallab::localComputed_() sensiexclu->setValue(nextdatasp[79]); struc->setValue(nextdatasp[80]); + warm->setValue(nextdatasp[81]); - double intermed = 0.01 * (double) nextdatasp[81]; + double intermed = 0.01 * (double) nextdatasp[82]; hueref->setValue(intermed); - chromaref->setValue(nextdatasp[82]); - lumaref->setValue(nextdatasp[83]); - sobelref->setValue(nextdatasp[84]); + chromaref->setValue(nextdatasp[83]); + lumaref->setValue(nextdatasp[84]); + sobelref->setValue(nextdatasp[85]); int *s_datc; s_datc = new int[70]; @@ -2092,7 +2095,7 @@ bool Locallab::localComputed_() void Locallab::localChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat) { - for (int i = 2; i < 85; i++) { + for (int i = 2; i < 86; i++) { nextdatasp[i] = datasp[i][sp]; } @@ -2163,6 +2166,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) lightness->setEditedState(pedited->locallab.lightness ? Edited : UnEdited); contrast->setEditedState(pedited->locallab.contrast ? Edited : UnEdited); chroma->setEditedState(pedited->locallab.chroma ? Edited : UnEdited); + warm->setEditedState(pedited->locallab.warm ? Edited : UnEdited); expcomp->setEditedState(pedited->locallab.expcomp ? Edited : UnEdited); hlcompr->setEditedState(pedited->locallab.hlcompr ? Edited : UnEdited); hlcomprthresh->setEditedState(pedited->locallab.hlcomprthresh ? Edited : UnEdited); @@ -2335,6 +2339,7 @@ void Locallab::read(const ProcParams* pp, const ParamsEdited* pedited) lightness->setValue(pp->locallab.lightness); contrast->setValue(pp->locallab.contrast); chroma->setValue(pp->locallab.chroma); + warm->setValue(pp->locallab.warm); expcomp->setValue(pp->locallab.expcomp); hlcompr->setValue(pp->locallab.hlcompr); hlcomprthresh->setValue(pp->locallab.hlcomprthresh); @@ -2803,6 +2808,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pp->locallab.lightness = lightness->getIntValue(); pp->locallab.contrast = contrast->getIntValue(); pp->locallab.chroma = chroma->getIntValue(); + pp->locallab.warm = warm->getIntValue(); pp->locallab.expcomp = expcomp->getValue(); pp->locallab.black = (int)black->getValue(); pp->locallab.hlcompr = (int)hlcompr->getValue(); @@ -2912,6 +2918,7 @@ void Locallab::write(ProcParams* pp, ParamsEdited* pedited) pedited->locallab.lightness = lightness->getEditedState(); pedited->locallab.contrast = contrast->getEditedState(); pedited->locallab.chroma = chroma->getEditedState(); + pedited->locallab.warm = warm->getEditedState(); pedited->locallab.expcomp = expcomp->getEditedState(); pedited->locallab.black = black->getEditedState(); pedited->locallab.hlcompr = hlcompr->getEditedState(); @@ -3681,6 +3688,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe lightness->setDefault(defParams->locallab.lightness); contrast->setDefault(defParams->locallab.contrast); chroma->setDefault(defParams->locallab.chroma); + warm->setDefault(defParams->locallab.warm); expcomp->setDefault(defParams->locallab.expcomp); black->setDefault(defParams->locallab.black); hlcompr->setDefault(defParams->locallab.hlcompr); @@ -3754,6 +3762,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe lightness->setDefaultEditedState(pedited->locallab.lightness ? Edited : UnEdited); contrast->setDefaultEditedState(pedited->locallab.contrast ? Edited : UnEdited); chroma->setDefaultEditedState(pedited->locallab.chroma ? Edited : UnEdited); + warm->setDefaultEditedState(pedited->locallab.warm ? Edited : UnEdited); expcomp->setDefaultEditedState(pedited->locallab.expcomp ? Edited : UnEdited); black->setDefaultEditedState(pedited->locallab.black ? Edited : UnEdited); hlcompr->setDefaultEditedState(pedited->locallab.hlcompr ? Edited : UnEdited); @@ -3826,6 +3835,7 @@ void Locallab::setDefaults(const ProcParams * defParams, const ParamsEdited * pe lightness->setDefaultEditedState(Irrelevant); contrast->setDefaultEditedState(Irrelevant); chroma->setDefaultEditedState(Irrelevant); + warm->setDefaultEditedState(Irrelevant); expcomp->setDefaultEditedState(Irrelevant); black->setDefaultEditedState(Irrelevant); hlcompr->setDefaultEditedState(Irrelevant); @@ -3975,6 +3985,8 @@ void Locallab::adjusterChanged(Adjuster * a, double newval) listener->panelChanged(Evlocallabcontrast, contrast->getTextValue()); } else if (a == chroma) { listener->panelChanged(Evlocallabchroma, chroma->getTextValue()); + } else if (a == warm) { + listener->panelChanged(Evlocallabwarm, warm->getTextValue()); } else if (a == expcomp) { listener->panelChanged(Evlocallabexpcomp, expcomp->getTextValue()); } else if (a == hlcompr) { @@ -4182,6 +4194,7 @@ void Locallab::trimValues(rtengine::procparams::ProcParams * pp) lightness->trimValue(pp->locallab.lightness); contrast->trimValue(pp->locallab.contrast); chroma->trimValue(pp->locallab.chroma); + warm->trimValue(pp->locallab.warm); expcomp->trimValue(pp->locallab.expcomp); hlcompr->trimValue(pp->locallab.hlcompr); hlcomprthresh->trimValue(pp->locallab.hlcomprthresh); @@ -4265,6 +4278,7 @@ void Locallab::setBatchMode(bool batchMode) lightness->showEditedCB(); contrast->showEditedCB(); chroma->showEditedCB(); + warm->showEditedCB(); expcomp->showEditedCB(); black->showEditedCB(); hlcompr->showEditedCB(); diff --git a/rtgui/locallab.h b/rtgui/locallab.h index e4332114d..d9bbff9ed 100644 --- a/rtgui/locallab.h +++ b/rtgui/locallab.h @@ -32,8 +32,8 @@ class Locallab : { private: int lastObject; - void foldAllButMe (GdkEventButton* event, MyExpander *expander); - void enableToggled (MyExpander *expander); + void foldAllButMe(GdkEventButton* event, MyExpander *expander); + void enableToggled(MyExpander *expander); //protected: @@ -196,6 +196,8 @@ private: CurveEditorGroup* curveEditorGG; Adjuster* pastels; Adjuster* saturated; + Adjuster* warm; + ThresholdAdjuster* psThreshold; Gtk::CheckButton* protectSkins; Gtk::CheckButton* avoidColorShift; @@ -229,7 +231,7 @@ private: - int nextdatasp[85]; + int nextdatasp[86]; int nextlength; std::string nextstr; std::string nextstr2; @@ -259,69 +261,69 @@ private: bool lastavoid, lastinvers, lastcutpast, lastlastdust, lastinversrad, lastinversret, lastactivlum, lastinverssha, lastcurvactiv; int lastanbspot; - void editToggled (); + void editToggled(); public: - Locallab (); - ~Locallab (); + Locallab(); + ~Locallab(); - void read (const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr); - void write (rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr); - void setDefaults (const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr); + void read(const rtengine::procparams::ProcParams* pp, const ParamsEdited* pedited = nullptr); + void write(rtengine::procparams::ProcParams* pp, ParamsEdited* pedited = nullptr); + void setDefaults(const rtengine::procparams::ProcParams* defParams, const ParamsEdited* pedited = nullptr); - void setBatchMode (bool batchMode); + void setBatchMode(bool batchMode); - void updateGeometry (const int centerX_, const int centerY_, const int circrad_, const int locY_, const double degree_, const int locX_, const int locYT_, const int locXL_, const int fullWidth = -1, const int fullHeight = -1); - void SmethodChanged (); - void ExclumethodChanged (); - void writeOptions (std::vector &tpOpen); - void updateToolState (std::vector &tpOpen); + void updateGeometry(const int centerX_, const int centerY_, const int circrad_, const int locY_, const double degree_, const int locX_, const int locYT_, const int locXL_, const int fullWidth = -1, const int fullHeight = -1); + void SmethodChanged(); + void ExclumethodChanged(); + void writeOptions(std::vector &tpOpen); + void updateToolState(std::vector &tpOpen); - void adjusterChanged (Adjuster* a, double newval); - void adjusterChanged (ThresholdAdjuster* a, int newBottom, int newTop); + void adjusterChanged(Adjuster* a, double newval); + void adjusterChanged(ThresholdAdjuster* a, int newBottom, int newTop); - void enabledChanged (); - void setAdjusterBehavior (bool degreeadd, bool locYadd, bool locXadd, bool locYTadd, bool locXLadd, bool centeradd, bool lightnessadd, bool contrastadd, bool chromaadd, bool sensiadd, bool transitadd, bool radiusadd, bool strengthadd); - void trimValues (rtengine::procparams::ProcParams* pp); - void avoidChanged (); - void activlumChanged (); - void inversChanged (); - void curvactivChanged (); - void inversradChanged (); - void inversretChanged (); - void inversshaChanged (); - void cutpastChanged (); - void lastdustChanged (); + void enabledChanged(); + void setAdjusterBehavior(bool degreeadd, bool locYadd, bool locXadd, bool locYTadd, bool locXLadd, bool centeradd, bool lightnessadd, bool contrastadd, bool chromaadd, bool sensiadd, bool transitadd, bool radiusadd, bool strengthadd); + void trimValues(rtengine::procparams::ProcParams* pp); + void avoidChanged(); + void activlumChanged(); + void inversChanged(); + void curvactivChanged(); + void inversradChanged(); + void inversretChanged(); + void inversshaChanged(); + void cutpastChanged(); + void lastdustChanged(); - void curveChanged (CurveEditor* ce); - void autoOpenCurve (); - void localChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat); - void localretChanged (int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat); - bool localComputed_ (); - bool localretComputed_ (); - void setEditProvider (EditDataProvider* provider); + void curveChanged(CurveEditor* ce); + void autoOpenCurve(); + void localChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat); + void localretChanged(int **datasp, std::string datastr, std::string ll_str, std::string lh_str, std::string cc_str, std::string hh_str, std::string sk_str, std::string ps_str, std::string ex_str, int sp, int maxdat); + bool localComputed_(); + bool localretComputed_(); + void setEditProvider(EditDataProvider* provider); void retinexMethodChanged(); void blurMethodChanged(); void dustMethodChanged(); void qualityMethodChanged(); void qualitycurveMethodChanged(); - void lumaneutralPressed (); - void lumacontrastPlusPressed (); - void lumacontrastMinusPressed (); - void neutral_pressed (); - virtual void colorForValue (double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); - void protectskins_toggled (); - void avoidcolorshift_toggled (); - void pastsattog_toggled (); - std::vector getCurvePoints (ThresholdSelector* tAdjuster) const; + void lumaneutralPressed(); + void lumacontrastPlusPressed(); + void lumacontrastMinusPressed(); + void neutral_pressed(); + virtual void colorForValue(double valX, double valY, enum ColorCaller::ElemType elemType, int callerId, ColorCaller* caller); + void protectskins_toggled(); + void avoidcolorshift_toggled(); + void pastsattog_toggled(); + std::vector getCurvePoints(ThresholdSelector* tAdjuster) const; // EditSubscriber interface - CursorShape getCursor (int objectID); - bool mouseOver (int modifierKey); - bool button1Pressed (int modifierKey); + CursorShape getCursor(int objectID); + bool mouseOver(int modifierKey); + bool button1Pressed(int modifierKey); bool button1Released(); - bool drag1 (int modifierKey); - void switchOffEditMode (); + bool drag1(int modifierKey); + void switchOffEditMode(); }; diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index c16ab1433..95efd51ec 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -21,13 +21,13 @@ #include "options.h" #include "addsetids.h" -ParamsEdited::ParamsEdited (bool value) +ParamsEdited::ParamsEdited(bool value) { - set (value); + set(value); } -void ParamsEdited::set (bool v) +void ParamsEdited::set(bool v) { general.rank = v; @@ -336,6 +336,7 @@ void ParamsEdited::set (bool v) locallab.lightness = v; locallab.contrast = v; locallab.chroma = v; + locallab.warm = v; locallab.expcomp = v; locallab.hlcompr = v; locallab.hlcomprthresh = v; @@ -531,14 +532,14 @@ void ParamsEdited::set (bool v) raw.xtranssensor.exBlackRed = v; raw.xtranssensor.exBlackGreen = v; raw.xtranssensor.exBlackBlue = v; - raw.caCorrection = v; - raw.caBlue = v; - raw.caRed = v; + raw.ca_autocorrect = v; + raw.cablue = v; + raw.cared = v; raw.hotPixelFilter = v; raw.deadPixelFilter = v; - raw.hotDeadPixelThresh = v; + raw.hotdeadpix_thresh = v; raw.darkFrame = v; - raw.dfAuto = v; + raw.df_autoselect = v; raw.ff_file = v; raw.ff_AutoSelect = v; raw.ff_BlurRadius = v; @@ -669,10 +670,10 @@ void ParamsEdited::set (bool v) using namespace rtengine; using namespace rtengine::procparams; -void ParamsEdited::initFrom (const std::vector& src) +void ParamsEdited::initFrom(const std::vector& src) { - set (true); + set(true); if (src.empty()) { return; @@ -918,7 +919,7 @@ void ParamsEdited::initFrom (const std::vector fattal.enabled = fattal.enabled && p.fattal.enabled == other.fattal.enabled; fattal.threshold = fattal.threshold && p.fattal.threshold == other.fattal.threshold; fattal.amount = fattal.amount && p.fattal.amount == other.fattal.amount; - + sh.enabled = sh.enabled && p.sh.enabled == other.sh.enabled; sh.hq = sh.hq && p.sh.hq == other.sh.hq; sh.highlights = sh.highlights && p.sh.highlights == other.sh.highlights; @@ -993,6 +994,7 @@ void ParamsEdited::initFrom (const std::vector locallab.lightness = locallab.lightness && p.locallab.lightness == other.locallab.lightness; locallab.contrast = locallab.contrast && p.locallab.contrast == other.locallab.contrast; locallab.chroma = locallab.chroma && p.locallab.chroma == other.locallab.chroma; + locallab.warm = locallab.warm && p.locallab.warm == other.locallab.warm; locallab.expcomp = locallab.expcomp && p.locallab.expcomp == other.locallab.expcomp; locallab.hlcompr = locallab.hlcompr && p.locallab.hlcompr == other.locallab.hlcompr; locallab.hlcomprthresh = locallab.hlcomprthresh && p.locallab.hlcomprthresh == other.locallab.hlcomprthresh; @@ -1180,14 +1182,14 @@ void ParamsEdited::initFrom (const std::vector raw.xtranssensor.exBlackRed = raw.xtranssensor.exBlackRed && p.raw.xtranssensor.blackred == other.raw.xtranssensor.blackred; raw.xtranssensor.exBlackGreen = raw.xtranssensor.exBlackGreen && p.raw.xtranssensor.blackgreen == other.raw.xtranssensor.blackgreen; raw.xtranssensor.exBlackBlue = raw.xtranssensor.exBlackBlue && p.raw.xtranssensor.blackblue == other.raw.xtranssensor.blackblue; - raw.caCorrection = raw.caCorrection && p.raw.ca_autocorrect == other.raw.ca_autocorrect; - raw.caRed = raw.caRed && p.raw.cared == other.raw.cared; - raw.caBlue = raw.caBlue && p.raw.cablue == other.raw.cablue; + raw.ca_autocorrect = raw.ca_autocorrect && p.raw.ca_autocorrect == other.raw.ca_autocorrect; + raw.cared = raw.cared && p.raw.cared == other.raw.cared; + raw.cablue = raw.cablue && p.raw.cablue == other.raw.cablue; raw.hotPixelFilter = raw.hotPixelFilter && p.raw.hotPixelFilter == other.raw.hotPixelFilter; raw.deadPixelFilter = raw.deadPixelFilter && p.raw.deadPixelFilter == other.raw.deadPixelFilter; - raw.hotDeadPixelThresh = raw.hotDeadPixelThresh && p.raw.hotdeadpix_thresh == other.raw.hotdeadpix_thresh; + raw.hotdeadpix_thresh = raw.hotdeadpix_thresh && p.raw.hotdeadpix_thresh == other.raw.hotdeadpix_thresh; raw.darkFrame = raw.darkFrame && p.raw.dark_frame == other.raw.dark_frame; - raw.dfAuto = raw.dfAuto && p.raw.df_autoselect == other.raw.df_autoselect; + raw.df_autoselect = raw.df_autoselect && p.raw.df_autoselect == other.raw.df_autoselect; raw.ff_file = raw.ff_file && p.raw.ff_file == other.raw.ff_file; raw.ff_AutoSelect = raw.ff_AutoSelect && p.raw.ff_AutoSelect == other.raw.ff_AutoSelect; raw.ff_BlurRadius = raw.ff_BlurRadius && p.raw.ff_BlurRadius == other.raw.ff_BlurRadius; @@ -1312,7 +1314,7 @@ void ParamsEdited::initFrom (const std::vector } } -void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet) +void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet) { bool dontforceSet = !forceSet; @@ -2197,12 +2199,14 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten if (fattal.enabled) { toEdit.fattal.enabled = mods.fattal.enabled; } + if (fattal.threshold) { toEdit.fattal.threshold = mods.fattal.threshold; } + if (fattal.amount) { toEdit.fattal.amount = mods.fattal.amount; - } + } if (sh.enabled) { toEdit.sh.enabled = mods.sh.enabled; @@ -2528,6 +2532,10 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.locallab.chroma = mods.locallab.chroma; } + if (locallab.warm) { + toEdit.locallab.warm = mods.locallab.warm; + } + if (locallab.expcomp) { toEdit.locallab.expcomp = mods.locallab.expcomp; } @@ -3192,15 +3200,15 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.raw.xtranssensor.blackblue = dontforceSet && options.baBehav[ADDSET_RAWEXPOS_BLACKS] ? toEdit.raw.xtranssensor.blackblue + mods.raw.xtranssensor.blackblue : mods.raw.xtranssensor.blackblue; } - if (raw.caCorrection) { + if (raw.ca_autocorrect) { toEdit.raw.ca_autocorrect = mods.raw.ca_autocorrect; } - if (raw.caRed) { + if (raw.cared) { toEdit.raw.cared = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cared + mods.raw.cared : mods.raw.cared; } - if (raw.caBlue) { + if (raw.cablue) { toEdit.raw.cablue = dontforceSet && options.baBehav[ADDSET_RAWCACORR] ? toEdit.raw.cablue + mods.raw.cablue : mods.raw.cablue; } @@ -3220,7 +3228,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.raw.deadPixelFilter = mods.raw.deadPixelFilter; } - if (raw.hotDeadPixelThresh) { + if (raw.hotdeadpix_thresh) { toEdit.raw.hotdeadpix_thresh = mods.raw.hotdeadpix_thresh; } @@ -3228,7 +3236,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten toEdit.raw.dark_frame = mods.raw.dark_frame; } - if (raw.dfAuto) { + if (raw.df_autoselect) { toEdit.raw.df_autoselect = mods.raw.df_autoselect; } @@ -3683,8 +3691,8 @@ bool RAWParamsEdited::XTransSensor::isUnchanged() const bool RAWParamsEdited::isUnchanged() const { - return bayersensor.isUnchanged() && xtranssensor.isUnchanged() && caCorrection && caRed && caBlue && hotPixelFilter && deadPixelFilter && hotDeadPixelThresh && darkFrame - && dfAuto && ff_file && ff_AutoSelect && ff_BlurRadius && ff_BlurType && exPos && exPreser && ff_AutoClipControl && ff_clipControl; + return bayersensor.isUnchanged() && xtranssensor.isUnchanged() && ca_autocorrect && cared && cablue && hotPixelFilter && deadPixelFilter && hotdeadpix_thresh && darkFrame + && df_autoselect && ff_file && ff_AutoSelect && ff_BlurRadius && ff_BlurType && exPos && exPreser && ff_AutoClipControl && ff_clipControl; } bool LensProfParamsEdited::isUnchanged() const diff --git a/rtgui/paramsedited.h b/rtgui/paramsedited.h index 4b29e0842..c37324b1d 100644 --- a/rtgui/paramsedited.h +++ b/rtgui/paramsedited.h @@ -365,7 +365,8 @@ public: }; -class FattalToneMappingParamsEdited { +class FattalToneMappingParamsEdited +{ public: bool enabled; bool threshold; @@ -454,6 +455,7 @@ public: bool lightness; bool contrast; bool chroma; + bool warm; bool expcomp; bool hlcompr; bool hlcomprthresh; @@ -676,7 +678,6 @@ public: bool gamma; bool gampos; bool slpos; - bool gamfree; bool freegamma; }; class WaveletParamsEdited @@ -873,14 +874,14 @@ public: BayerSensor bayersensor; XTransSensor xtranssensor; - bool caCorrection; - bool caRed; - bool caBlue; + bool ca_autocorrect; + bool cared; + bool cablue; bool hotPixelFilter; bool deadPixelFilter; - bool hotDeadPixelThresh; + bool hotdeadpix_thresh; bool darkFrame; - bool dfAuto; + bool df_autoselect; bool ff_file; bool ff_AutoSelect; bool ff_BlurRadius; @@ -944,13 +945,10 @@ public: bool exif; bool iptc; - explicit ParamsEdited (bool value = false); + explicit ParamsEdited(bool value = false); - void set (bool v); - void initFrom (const std::vector& src); - void combine (rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet); - - bool operator== (const ParamsEdited& other); - bool operator!= (const ParamsEdited& other); + void set(bool v); + void initFrom(const std::vector& src); + void combine(rtengine::procparams::ProcParams& toEdit, const rtengine::procparams::ProcParams& mods, bool forceSet); }; #endif diff --git a/rtgui/partialpastedlg.cc b/rtgui/partialpastedlg.cc index bb8236ace..58bb7e156 100644 --- a/rtgui/partialpastedlg.cc +++ b/rtgui/partialpastedlg.cc @@ -978,12 +978,12 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param } if (!raw_ca_autocorrect->get_active ()) { - filterPE.raw.caCorrection = falsePE.raw.caCorrection; + filterPE.raw.ca_autocorrect = falsePE.raw.ca_autocorrect; } if (!raw_caredblue->get_active ()) { - filterPE.raw.caRed = falsePE.raw.caRed; - filterPE.raw.caBlue = falsePE.raw.caBlue; + filterPE.raw.cared = falsePE.raw.cared; + filterPE.raw.cablue = falsePE.raw.cablue; } if (!raw_hotpix_filt->get_active ()) { @@ -995,7 +995,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param } if (!raw_deadpix_filt->get_active () && !raw_hotpix_filt->get_active ()) { - filterPE.raw.hotDeadPixelThresh = falsePE.raw.hotDeadPixelThresh; + filterPE.raw.hotdeadpix_thresh = falsePE.raw.hotdeadpix_thresh; } if (!df_file->get_active ()) { @@ -1003,7 +1003,7 @@ void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dstPP, Param } if (!df_AutoSelect->get_active ()) { - filterPE.raw.dfAuto = falsePE.raw.dfAuto; + filterPE.raw.df_autoselect = falsePE.raw.df_autoselect; } if (!ff_file->get_active ()) { diff --git a/rtgui/ppversion.h b/rtgui/ppversion.h index d2e9be090..d799be406 100644 --- a/rtgui/ppversion.h +++ b/rtgui/ppversion.h @@ -1,14 +1,15 @@ -#ifndef _PPVERSION_ -#define _PPVERSION_ +#pragma once // This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes -#define PPVERSION 327 +#define PPVERSION 328 #define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified /* Log of version changes + 328 2017-11-22 + Fix wrong type of ff_clipControl 327 2017-09-15 - [Profiles Lens Correction] Added Lensfun + [Profiled Lens Correction] Added Lensfun 326 2015-07-26 [Exposure] Added 'Perceptual' tone curve mode 325 2015-07-23 @@ -45,5 +46,3 @@ added [Directional Pyramid Denoising] Method, Redchro, Bluechro added [RGB Curves] LumaMode */ - -#endif diff --git a/rtgui/preprocess.cc b/rtgui/preprocess.cc index 44d054214..02e0ff220 100644 --- a/rtgui/preprocess.cc +++ b/rtgui/preprocess.cc @@ -81,7 +81,7 @@ void PreProcess::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedi pp->raw.hotdeadpix_thresh = hdThreshold->getIntValue(); if (pedited) { - pedited->raw.hotDeadPixelThresh = hdThreshold->getEditedState (); + pedited->raw.hotdeadpix_thresh = hdThreshold->getEditedState (); pedited->raw.hotPixelFilter = !hotPixel->get_inconsistent(); pedited->raw.deadPixelFilter = !deadPixel->get_inconsistent(); } diff --git a/rtgui/rawcacorrection.cc b/rtgui/rawcacorrection.cc index ca3b1a970..75c60a7a2 100644 --- a/rtgui/rawcacorrection.cc +++ b/rtgui/rawcacorrection.cc @@ -61,9 +61,9 @@ void RAWCACorr::read(const rtengine::procparams::ProcParams* pp, const ParamsEdi disableListener (); if(pedited ) { - caAutocorrect->setEdited(pedited->raw.caCorrection); - caRed->setEditedState( pedited->raw.caRed ? Edited : UnEdited ); - caBlue->setEditedState( pedited->raw.caBlue ? Edited : UnEdited ); + caAutocorrect->setEdited(pedited->raw.ca_autocorrect); + caRed->setEditedState( pedited->raw.cared ? Edited : UnEdited ); + caBlue->setEditedState( pedited->raw.cablue ? Edited : UnEdited ); } // disable Red and Blue sliders when caAutocorrect is enabled @@ -84,9 +84,9 @@ void RAWCACorr::write( rtengine::procparams::ProcParams* pp, ParamsEdited* pedit pp->raw.cablue = caBlue->getValue(); if (pedited) { - pedited->raw.caCorrection = !caAutocorrect->get_inconsistent(); - pedited->raw.caRed = caRed->getEditedState (); - pedited->raw.caBlue = caBlue->getEditedState (); + pedited->raw.ca_autocorrect = !caAutocorrect->get_inconsistent(); + pedited->raw.cared = caRed->getEditedState (); + pedited->raw.cablue = caBlue->getEditedState (); } } @@ -132,8 +132,8 @@ void RAWCACorr::setDefaults(const rtengine::procparams::ProcParams* defParams, c caBlue->setDefault( defParams->raw.cablue); if (pedited) { - caRed->setDefaultEditedState( pedited->raw.caRed ? Edited : UnEdited); - caBlue->setDefaultEditedState( pedited->raw.caBlue ? Edited : UnEdited); + caRed->setDefaultEditedState( pedited->raw.cared ? Edited : UnEdited); + caBlue->setDefaultEditedState( pedited->raw.cablue ? Edited : UnEdited); } else { caRed->setDefaultEditedState( Irrelevant ); caBlue->setDefaultEditedState( Irrelevant ); diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index bf88a85e4..320c91fd5 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -380,14 +380,15 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL") Gtk::Grid *tranGrid = Gtk::manage (new Gtk::Grid()); setExpandAlignProperties (tranGrid, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); + const RetinexParams default_params; + // Transmission map curve transmissionCurveEditorG = new CurveEditorGroup (options.lastRetinexDir, M ("TP_RETINEX_TRANSMISSION")); setExpandAlignProperties (transmissionCurveEditorG, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); transmissionCurveEditorG->setCurveListener (this); - rtengine::RetinexParams::getDefaulttransmissionCurve (defaultCurve); transmissionShape = static_cast (transmissionCurveEditorG->addCurve (CT_Flat, "", nullptr, false, false)); transmissionShape->setIdentityValue (0.); - transmissionShape->setResetCurve (FlatCurveType (defaultCurve.at (0)), defaultCurve); + transmissionShape->setResetCurve (FlatCurveType (default_params.transmissionCurve.at (0)), default_params.transmissionCurve); // transmissionShape->setBottomBarBgGradient(milestones); transmissionCurveEditorG->curveListComplete(); transmissionCurveEditorG->set_tooltip_markup (M ("TP_RETINEX_TRANSMISSION_TOOLTIP")); @@ -439,10 +440,9 @@ Retinex::Retinex () : FoldableToolPanel (this, "retinex", M ("TP_RETINEX_LABEL") gaintransmissionCurve = new CurveEditorGroup (options.lastRetinexDir, M ("TP_RETINEX_GAINTRANSMISSION")); setExpandAlignProperties (gaintransmissionCurve, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_START); gaintransmissionCurve->setCurveListener (this); - rtengine::RetinexParams::getDefaultgaintransmissionCurve (defaultCurve); gaintransmissionShape = static_cast (gaintransmissionCurve->addCurve (CT_Flat, "", nullptr, false, false)); gaintransmissionShape->setIdentityValue (0.); - gaintransmissionShape->setResetCurve (FlatCurveType (defaultCurve.at (0)), defaultCurve); + gaintransmissionShape->setResetCurve (FlatCurveType (default_params.gaintransmissionCurve.at (0)), default_params.gaintransmissionCurve); //gaintransmissionShape->setBottomBarBgGradient(milestones); gaintransmissionCurve->set_tooltip_markup (M ("TP_RETINEX_GAINTRANSMISSION_TOOLTIP")); gaintransmissionCurve->curveListComplete(); diff --git a/rtgui/thresholdadjuster.cc b/rtgui/thresholdadjuster.cc index 754205e2e..7afd128b5 100644 --- a/rtgui/thresholdadjuster.cc +++ b/rtgui/thresholdadjuster.cc @@ -341,20 +341,20 @@ void ThresholdAdjuster::sendToListener () rtengine::procparams::Threshold t = tSelector.getPositions(); if (tSelector.isDouble()) { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1], t.value[2], t.value[3]); - adjusterListener->adjusterChanged2 (this, t.value[0], t.value[1], t.value[2], t.value[3]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); + adjusterListener->adjusterChanged2 (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); } else { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft()); } } else { // if precision is equal to 0, then we assume that the listener is waiting for integers rtengine::procparams::Threshold t = tSelector.getPositions(); if (tSelector.isDouble()) { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1], t.value[2], t.value[3]); - adjusterListener->adjusterChanged2 (this, t.value[0], t.value[1], t.value[2], t.value[3]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); + adjusterListener->adjusterChanged2 (this, t.getBottomLeft(), t.getTopLeft(), t.getBottomRight(), t.getTopRight()); } else { - adjusterListener->adjusterChanged (this, t.value[0], t.value[1]); + adjusterListener->adjusterChanged (this, t.getBottomLeft(), t.getTopLeft()); } } } diff --git a/rtgui/thresholdselector.h b/rtgui/thresholdselector.h index f6caa4302..32b423e64 100644 --- a/rtgui/thresholdselector.h +++ b/rtgui/thresholdselector.h @@ -138,12 +138,12 @@ public: template void setDefaults (const rtengine::procparams::Threshold &t) { - defPos[TS_BOTTOMLEFT] = double(t.value[0]); // should we use shapeValue() ? - defPos[TS_TOPLEFT] = double(t.value[1]); + defPos[TS_BOTTOMLEFT] = double(t.getBottomLeft()); // should we use shapeValue() ? + defPos[TS_TOPLEFT] = double(t.getTopLeft()); if (doubleThresh) { - defPos[TS_BOTTOMRIGHT] = double(t.value[2]); - defPos[TS_TOPRIGHT] = double(t.value[3]); + defPos[TS_BOTTOMRIGHT] = double(t.getBottomRight()); + defPos[TS_TOPRIGHT] = double(t.getTopRight()); } } void setDefaults (double bottom, double top); @@ -151,12 +151,12 @@ public: template void setPositions (const rtengine::procparams::Threshold &tValues) { - positions[TS_BOTTOMLEFT] = static_cast(tValues.value[TS_BOTTOMLEFT]); - positions[TS_TOPLEFT] = static_cast(tValues.value[TS_TOPLEFT]); + positions[TS_BOTTOMLEFT] = static_cast(tValues.getBottomLeft()); + positions[TS_TOPLEFT] = static_cast(tValues.getTopLeft()); if (tValues.isDouble()) { - positions[TS_BOTTOMRIGHT] = static_cast(tValues.value[TS_BOTTOMRIGHT]); - positions[TS_TOPRIGHT] = static_cast(tValues.value[TS_TOPRIGHT]); + positions[TS_BOTTOMRIGHT] = static_cast(tValues.getBottomRight()); + positions[TS_TOPRIGHT] = static_cast(tValues.getTopRight()); } updateTooltip(); diff --git a/rtgui/tonecurve.cc b/rtgui/tonecurve.cc index 28dcf9f3d..a9dd35466 100644 --- a/rtgui/tonecurve.cc +++ b/rtgui/tonecurve.cc @@ -223,8 +223,8 @@ void ToneCurve::read (const ProcParams* pp, const ParamsEdited* pedited) shape->setCurve (pp->toneCurve.curve); shape2->setCurve (pp->toneCurve.curve2); - toneCurveMode->set_active(pp->toneCurve.curveMode); - toneCurveMode2->set_active(pp->toneCurve.curveMode2); + toneCurveMode->set_active(rtengine::toUnderlying(pp->toneCurve.curveMode)); + toneCurveMode2->set_active(rtengine::toUnderlying(pp->toneCurve.curveMode2)); if (pedited) { expcomp->setEditedState (pedited->toneCurve.expcomp ? Edited : UnEdited); @@ -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::TC_MODE_STD; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_WEIGHTEDSTD; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_FILMLIKE; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_SATANDVALBLENDING; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_LUMINANCE; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode = ToneCurveParams::TC_MODE_PERCEPTUAL; + pp->toneCurve.curveMode = ToneCurveParams::TcMode::PERCEPTUAL; } tcMode = toneCurveMode2->get_active_row_number(); if (tcMode == 0) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_STD; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::STD; } else if (tcMode == 1) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_WEIGHTEDSTD; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::WEIGHTEDSTD; } else if (tcMode == 2) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_FILMLIKE; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::FILMLIKE; } else if (tcMode == 3) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_SATANDVALBLENDING; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::SATANDVALBLENDING; } else if (tcMode == 4) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_LUMINANCE; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::LUMINANCE; } else if (tcMode == 5) { - pp->toneCurve.curveMode2 = ToneCurveParams::TC_MODE_PERCEPTUAL; + pp->toneCurve.curveMode2 = ToneCurveParams::TcMode::PERCEPTUAL; } if (pedited) { diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index b61c9acd4..d3a594848 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -408,12 +408,11 @@ Wavelet::Wavelet() : opaCurveEditorG->setCurveListener (this); - std::vector defaultCurve; + const WaveletParams default_params; - rtengine::WaveletParams::getDefaultOpacityCurveRG(defaultCurve); opacityShapeRG = static_cast(opaCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeRG->setIdentityValue(0.); - opacityShapeRG->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShapeRG->setResetCurve(FlatCurveType(default_params.opacityCurveRG.at(0)), default_params.opacityCurveRG); opaCurveEditorG->curveListComplete(); opaCurveEditorG->show(); @@ -422,10 +421,9 @@ Wavelet::Wavelet() : opacityCurveEditorG->setCurveListener (this); - rtengine::WaveletParams::getDefaultOpacityCurveBY(defaultCurve); opacityShapeBY = static_cast(opacityCurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeBY->setIdentityValue(0.); - opacityShapeBY->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShapeBY->setResetCurve(FlatCurveType(default_params.opacityCurveBY.at(0)), default_params.opacityCurveBY); opacityCurveEditorG->curveListComplete(); opacityCurveEditorG->show(); @@ -502,11 +500,10 @@ Wavelet::Wavelet() : // <-- Edge Sharpness Local Contrast curve CCWcurveEditorG->setCurveListener (this); - rtengine::WaveletParams::getDefaultCCWCurve(defaultCurve); ccshape = static_cast(CCWcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false)); ccshape->setIdentityValue(0.); - ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + ccshape->setResetCurve(FlatCurveType(default_params.ccwcurve.at(0)), default_params.ccwcurve); ccshape->setTooltip(M("TP_WAVELET_CURVEEDITOR_CC_TOOLTIP")); CCWcurveEditorG->curveListComplete(); @@ -781,10 +778,9 @@ Wavelet::Wavelet() : opacityCurveEditorW->setCurveListener (this); - rtengine::WaveletParams::getDefaultOpacityCurveW(defaultCurve); opacityShape = static_cast(opacityCurveEditorW->addCurve(CT_Flat, "", nullptr, false, false)); opacityShape->setIdentityValue(0.); - opacityShape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShape->setResetCurve(FlatCurveType(default_params.opacityCurveW.at(0)), default_params.opacityCurveW); opacityShape->setBottomBarBgGradient(milestones2); // This will add the reset button at the end of the curveType buttons @@ -798,10 +794,9 @@ Wavelet::Wavelet() : opacityCurveEditorWL->setCurveListener (this); - rtengine::WaveletParams::getDefaultOpacityCurveWL(defaultCurve); opacityShapeWL = static_cast(opacityCurveEditorWL->addCurve(CT_Flat, "", nullptr, false, false)); opacityShapeWL->setIdentityValue(0.); - opacityShapeWL->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve); + opacityShapeWL->setResetCurve(FlatCurveType(default_params.opacityCurveWL.at(0)), default_params.opacityCurveWL); opacityShapeWL->setTooltip(M("TP_WAVELET_OPACITYWL_TOOLTIP")); // This will add the reset button at the end of the curveType buttons diff --git a/rtgui/whitebalance.cc b/rtgui/whitebalance.cc index d16dafa08..7dbc02b4e 100644 --- a/rtgui/whitebalance.cc +++ b/rtgui/whitebalance.cc @@ -34,7 +34,7 @@ using namespace rtengine; using namespace rtengine::procparams; -Glib::RefPtr WhiteBalance::wbPixbufs[rtengine::procparams::WBT_CUSTOM + 1]; +Glib::RefPtr WhiteBalance::wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM) + 1]; /* Glib::RefPtr WhiteBalance::wbCameraPB, WhiteBalance::wbAutoPB, WhiteBalance::wbSunPB, WhiteBalance::wbTungstenPB, WhiteBalance::wbCloudyPB, WhiteBalance::wbShadePB, WhiteBalance::wbFluorescentPB, WhiteBalance::wbLampPB, @@ -43,24 +43,24 @@ Glib::RefPtr WhiteBalance::wbCameraPB, WhiteBalance::wbAutoPB, Whit void WhiteBalance::init () { - wbPixbufs[WBT_CAMERA] = RTImage::createFromFile ("wb-camera.png"); - wbPixbufs[WBT_AUTO] = RTImage::createFromFile ("wb-auto.png"); - wbPixbufs[WBT_DAYLIGHT] = RTImage::createFromFile ("wb-sun.png"); - wbPixbufs[WBT_CLOUDY] = RTImage::createFromFile ("wb-cloudy.png"); - wbPixbufs[WBT_SHADE] = RTImage::createFromFile ("wb-shade.png"); - wbPixbufs[WBT_WATER] = RTImage::createFromFile ("wb-water.png"); -// wbPixbufs[WBT_WATER2] = RTImage::createFromFile ("wb-water.png"); - wbPixbufs[WBT_TUNGSTEN] = RTImage::createFromFile ("wb-tungsten.png"); - wbPixbufs[WBT_FLUORESCENT] = RTImage::createFromFile ("wb-fluorescent.png"); - wbPixbufs[WBT_LAMP] = RTImage::createFromFile ("wb-lamp.png"); - wbPixbufs[WBT_FLASH] = RTImage::createFromFile ("wb-flash.png"); - wbPixbufs[WBT_LED] = RTImage::createFromFile ("wb-led.png"); - wbPixbufs[WBT_CUSTOM] = RTImage::createFromFile ("wb-custom.png"); + wbPixbufs[toUnderlying(WBEntry::Type::CAMERA)] = RTImage::createFromFile ("wb-camera.png"); + wbPixbufs[toUnderlying(WBEntry::Type::AUTO)] = RTImage::createFromFile ("wb-auto.png"); + wbPixbufs[toUnderlying(WBEntry::Type::DAYLIGHT)] = RTImage::createFromFile ("wb-sun.png"); + wbPixbufs[toUnderlying(WBEntry::Type::CLOUDY)] = RTImage::createFromFile ("wb-cloudy.png"); + wbPixbufs[toUnderlying(WBEntry::Type::SHADE)] = RTImage::createFromFile ("wb-shade.png"); + wbPixbufs[toUnderlying(WBEntry::Type::WATER)] = RTImage::createFromFile ("wb-water.png"); +// wbPixbufs[WBEntry::Type::WATER2] = RTImage::createFromFile ("wb-water.png"); + wbPixbufs[toUnderlying(WBEntry::Type::TUNGSTEN)] = RTImage::createFromFile ("wb-tungsten.png"); + wbPixbufs[toUnderlying(WBEntry::Type::FLUORESCENT)] = RTImage::createFromFile ("wb-fluorescent.png"); + wbPixbufs[toUnderlying(WBEntry::Type::LAMP)] = RTImage::createFromFile ("wb-lamp.png"); + wbPixbufs[toUnderlying(WBEntry::Type::FLASH)] = RTImage::createFromFile ("wb-flash.png"); + wbPixbufs[toUnderlying(WBEntry::Type::LED)] = RTImage::createFromFile ("wb-led.png"); + wbPixbufs[toUnderlying(WBEntry::Type::CUSTOM)] = RTImage::createFromFile ("wb-custom.png"); } void WhiteBalance::cleanup () { - for (unsigned int i = 0; i < WBT_CUSTOM + 1; i++) { + for (unsigned int i = 0; i < toUnderlying(WBEntry::Type::CUSTOM) + 1; i++) { wbPixbufs[i].reset(); } } @@ -163,68 +163,68 @@ WhiteBalance::WhiteBalance () : FoldableToolPanel(this, "whitebalance", M("TP_WB // Assign the model to the Combobox method->set_model(refTreeModel); - enum WBTypes oldType = WBParams::wbEntries[0]->type; - enum WBTypes currType; + 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 == WBT_FLUORESCENT) { + if (currType == WBEntry::Type::FLUORESCENT) { // Creating the Fluorescent subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLUO_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_WATER) { + if (currType == WBEntry::Type::WATER) { // Creating the under water subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_WATER_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_LAMP) { + if (currType == WBEntry::Type::LAMP) { // Creating the Lamp subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LAMP_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_LED) { + if (currType == WBEntry::Type::LED) { // Creating the LED subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_LED_HEADER"); row[methodColumns.colId] = i + 100; } - if (currType == WBT_FLASH) { + if (currType == WBEntry::Type::FLASH) { // Creating the Flash subcategory header row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; row[methodColumns.colLabel] = M("TP_WBALANCE_FLASH_HEADER"); row[methodColumns.colId] = i + 100; } } - if (currType == WBT_FLUORESCENT - || currType == WBT_LAMP - || currType == WBT_WATER - || currType == WBT_FLASH - || currType == WBT_LED + if (currType == WBEntry::Type::FLUORESCENT + || currType == WBEntry::Type::LAMP + || currType == WBEntry::Type::WATER + || currType == WBEntry::Type::FLASH + || currType == WBEntry::Type::LED ) { childrow = *(refTreeModel->append(row.children())); - childrow[methodColumns.colIcon] = wbPixbufs[currType]; - childrow[methodColumns.colLabel] = WBParams::wbEntries[i]->GUILabel; + childrow[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + childrow[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; childrow[methodColumns.colId] = i; } else { row = *(refTreeModel->append()); - row[methodColumns.colIcon] = wbPixbufs[currType]; - row[methodColumns.colLabel] = WBParams::wbEntries[i]->GUILabel; + row[methodColumns.colIcon] = wbPixbufs[toUnderlying(currType)]; + row[methodColumns.colLabel] = WBParams::getWbEntries()[i].GUILabel; row[methodColumns.colId] = i; } @@ -362,12 +362,24 @@ void WhiteBalance::adjusterChanged (Adjuster* a, double newval) } Glib::ustring colLabel = row[methodColumns.colLabel]; - WBEntry* ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); - WBEntry* wbCustom = findWBEntry ("Custom", WBLT_PP); + const std::pair ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); + const std::pair wbCustom = findWBEntry ("Custom", WBLT_PP); - if (!ppMethod || (ppMethod->ppLabel != wbCustom->ppLabel && !((a == equal || a == tempBias) && ppMethod->type == WBT_AUTO)) ) { + if ( + !ppMethod.first + || ( + ppMethod.second.ppLabel != wbCustom.second.ppLabel + && !( + ( + a == equal + || a == tempBias + ) + && ppMethod.second.type == WBEntry::Type::AUTO + ) + ) + ) { methconn.block(true); - opt = setActiveMethod(wbCustom->GUILabel); + opt = setActiveMethod(wbCustom.second.GUILabel); tempBias->set_sensitive(false); cache_customWB (tVal, gVal); @@ -429,12 +441,12 @@ void WhiteBalance::optChanged () tempBias->setEditedState (UnEdited); } else { unsigned int methodId = findWBEntryId (row[methodColumns.colLabel], WBLT_GUI); - WBEntry* currMethod = WBParams::wbEntries[methodId]; + const WBEntry& currMethod = WBParams::getWbEntries()[methodId]; - tempBias->set_sensitive(currMethod->type == WBT_AUTO); + tempBias->set_sensitive(currMethod.type == WBEntry::Type::AUTO); - switch (currMethod->type) { - case WBT_CAMERA: + switch (currMethod.type) { + case WBEntry::Type::CAMERA: if (wbp) { double ctemp, cgreen; wbp->getCamWB (ctemp, cgreen); @@ -451,7 +463,7 @@ void WhiteBalance::optChanged () break; - case WBT_AUTO: + case WBEntry::Type::AUTO: if (wbp) { if (batchMode) { temp->setEditedState (UnEdited); @@ -464,7 +476,7 @@ void WhiteBalance::optChanged () break; - case WBT_CUSTOM: + case WBEntry::Type::CUSTOM: if (custom_temp > 0) { temp->setValue (temp->getAddMode() ? 0.0 : custom_temp); green->setValue (green->getAddMode() ? 0.0 : custom_green); @@ -484,19 +496,19 @@ void WhiteBalance::optChanged () break; /* All other solution are the default cases - case WBT_DAYLIGHT: - case WBT_CLOUDY: - case WBT_SHADE: - case WBT_TUNGSTEN: - case WBT_FLUORESCENT: - case WBT_LAMP: - case WBT_FLASH: - case WBT_LED:*/ + case WBEntry::Type::DAYLIGHT: + case WBEntry::Type::CLOUDY: + case WBEntry::Type::SHADE: + case WBEntry::Type::TUNGSTEN: + case WBEntry::Type::FLUORESCENT: + case WBEntry::Type::LAMP: + case WBEntry::Type::FLASH: + case WBEntry::Type::LED:*/ default: // recall custom WB settings if it exists, set to 1.0 otherwise - temp->setValue ( temp->getAddMode() ? 0.0 : (double)(currMethod->temperature)); - green->setValue (green->getAddMode() ? 0.0 : (double)(currMethod->green)); - equal->setValue (equal->getAddMode() ? 0.0 : (double)(currMethod->equal)); + temp->setValue ( temp->getAddMode() ? 0.0 : (double)(currMethod.temperature)); + green->setValue (green->getAddMode() ? 0.0 : (double)(currMethod.green)); + equal->setValue (equal->getAddMode() ? 0.0 : (double)(currMethod.equal)); if (batchMode) { temp->setEditedState (Edited); @@ -551,17 +563,21 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) if (pedited && !pedited->wb.method) { opt = setActiveMethod(M("GENERAL_UNCHANGED")); } else { - WBEntry* wbValues = findWBEntry(pp->wb.method, WBLT_PP); + const WBEntry& wbValues = + [this, pp]() -> const WBEntry& + { + const std::pair res = findWBEntry(pp->wb.method, WBLT_PP); + return + !res.first + ? findWBEntry("Camera", WBLT_PP).second + : res.second; + }(); - if (!wbValues) { - wbValues = findWBEntry("Camera", WBLT_PP); - } - - opt = setActiveMethod(wbValues->GUILabel); + opt = setActiveMethod(wbValues.GUILabel); // temperature is reset to the associated temperature, or 0.0 if addMode is set. - switch (wbValues->type) { - case WBT_CUSTOM: + switch (wbValues.type) { + case WBEntry::Type::CUSTOM: temp->setValue (temp->getAddMode() ? 0.0 : pp->wb.temperature); green->setValue (green->getAddMode() ? 0.0 : pp->wb.green); equal->setValue (equal->getAddMode() ? 0.0 : pp->wb.equal); @@ -578,7 +594,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) break; - case WBT_CAMERA: + case WBEntry::Type::CAMERA: if (wbp) { double ctemp = -1.0; double cgreen = -1.0; @@ -600,7 +616,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) break; - case WBT_AUTO: + case WBEntry::Type::AUTO: // the equalizer's value is restored for the AutoWB equal->setValue (equal->getAddMode() ? 0.0 : pp->wb.equal); tempBias->setValue (tempBias->getAddMode() ? 0.0 : pp->wb.tempBias); @@ -620,18 +636,18 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) /* All those types are the "default" case: - case WBT_DAYLIGHT: - case WBT_CLOUDY: - case WBT_SHADE: - case WBT_TUNGSTEN: - case WBT_FLUORESCENT: - case WBT_LAMP: - case WBT_FLASH: - case WBT_LED: + case WBEntry::Type::DAYLIGHT: + case WBEntry::Type::CLOUDY: + case WBEntry::Type::SHADE: + case WBEntry::Type::TUNGSTEN: + case WBEntry::Type::FLUORESCENT: + case WBEntry::Type::LAMP: + case WBEntry::Type::FLASH: + case WBEntry::Type::LED: */ default: // Set the associated temperature, or 0.0 if in ADD mode - temp->setValue(temp->getAddMode() ? 0.0 : (double)wbValues->temperature); + temp->setValue(temp->getAddMode() ? 0.0 : (double)wbValues.temperature); // Set the stored temperature, or 0.0 if in ADD mode green->setValue(green->getAddMode() ? 0.0 : pp->wb.green); equal->setValue(equal->getAddMode() ? 0.0 : pp->wb.equal); @@ -648,7 +664,7 @@ void WhiteBalance::read (const ProcParams* pp, const ParamsEdited* pedited) break; } - tempBias->set_sensitive(wbValues->type == WBT_AUTO); + tempBias->set_sensitive(wbValues.type == WBEntry::Type::AUTO); } methconn.block (false); @@ -668,10 +684,10 @@ void WhiteBalance::write (ProcParams* pp, ParamsEdited* pedited) pedited->wb.method = row[methodColumns.colLabel] != M("GENERAL_UNCHANGED"); } - WBEntry* ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); + const std::pair ppMethod = findWBEntry (row[methodColumns.colLabel], WBLT_GUI); - if (ppMethod) { - pp->wb.method = ppMethod->ppLabel; + if (ppMethod.first) { + pp->wb.method = ppMethod.second.ppLabel; } pp->wb.temperature = temp->getIntValue (); @@ -724,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"); } @@ -739,10 +755,10 @@ void WhiteBalance::setWB (int vtemp, double vgreen) { methconn.block(true); - WBEntry *wbValues = findWBEntry("Custom", WBLT_PP); + const std::pair wbValues = findWBEntry("Custom", WBLT_PP); temp->setValue (vtemp); green->setValue (vgreen); - opt = setActiveMethod(wbValues->GUILabel); + opt = setActiveMethod(wbValues.second.GUILabel); cache_customWB (vtemp, vgreen); // sequence in which this call is made is important; must be before "method->set_active (2);" cache_customEqual(equal->getValue()); temp->setEditedState (Edited); @@ -792,10 +808,10 @@ void WhiteBalance::cache_customWB(int temp, double green) cache_customGreen (green); } -unsigned int WhiteBalance::findWBEntryId (const Glib::ustring &label, enum WB_LabelType lblType) +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; } } @@ -803,15 +819,15 @@ unsigned int WhiteBalance::findWBEntryId (const Glib::ustring &label, enum WB_La return 0; // default to camera wb } -WBEntry* WhiteBalance::findWBEntry (Glib::ustring label, enum WB_LabelType lblType) +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 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 nullptr; + return {false, WBParams::getWbEntries()[0]}; } int WhiteBalance::_setActiveMethod(Glib::ustring &label, Gtk::TreeModel::Children &children) diff --git a/rtgui/whitebalance.h b/rtgui/whitebalance.h index 7366e55b5..d1fafcea3 100644 --- a/rtgui/whitebalance.h +++ b/rtgui/whitebalance.h @@ -57,7 +57,7 @@ protected: } }; - static Glib::RefPtr wbPixbufs[rtengine::procparams::WBT_CUSTOM + 1]; + static Glib::RefPtr wbPixbufs[rtengine::toUnderlying(rtengine::procparams::WBEntry::Type::CUSTOM) + 1]; Glib::RefPtr refTreeModel; MethodColumns methodColumns; MyComboBox* method; @@ -85,9 +85,9 @@ protected: int setActiveMethod (Glib::ustring label); int _setActiveMethod (Glib::ustring &label, Gtk::TreeModel::Children &children); - Gtk::TreeModel::Row getActiveMethod (); - unsigned int findWBEntryId (const Glib::ustring &label, enum WB_LabelType lblType = WBLT_GUI); - rtengine::procparams::WBEntry* findWBEntry (Glib::ustring label, enum WB_LabelType lblType = WBLT_GUI); + Gtk::TreeModel::Row getActiveMethod(); + unsigned int findWBEntryId (const Glib::ustring& label, enum WB_LabelType lblType = WBLT_GUI); + std::pair findWBEntry (const Glib::ustring& label, enum WB_LabelType lblType = WBLT_GUI); public: diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index 453f0a53d..9e0c94ea0 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::MONO || RAWParams::XTransSensor::Method(oldSelection) == RAWParams::XTransSensor::Method::MONO) { ppreq = true; } }