diff --git a/rtdata/images/Dark/actions/gamut-hist.png b/rtdata/images/Dark/actions/gamut-hist.png
new file mode 100644
index 000000000..8a60118dd
Binary files /dev/null and b/rtdata/images/Dark/actions/gamut-hist.png differ
diff --git a/rtdata/images/Light/actions/gamut-hist.png b/rtdata/images/Light/actions/gamut-hist.png
new file mode 100644
index 000000000..8c81e0213
Binary files /dev/null and b/rtdata/images/Light/actions/gamut-hist.png differ
diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais
index 1deea5f07..fe26cda2d 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 eec5268c9..2d249d5b3 100644
--- a/rtdata/languages/default
+++ b/rtdata/languages/default
@@ -1787,6 +1787,7 @@ TP_RAW_PIXELSHIFTSMOOTH_TOOLTIP;Smooth transitions between areas with motion and
TP_RAW_PIXELSHIFTSTDDEVFACTORBLUE;StdDev factor Blue
TP_RAW_PIXELSHIFTSTDDEVFACTORGREEN;StdDev factor Green
TP_RAW_PIXELSHIFTSTDDEVFACTORRED;StdDev factor Red
+TP_RAW_RCD;RCD
TP_RAW_SENSOR_BAYER_LABEL;Sensor with Bayer Matrix
TP_RAW_SENSOR_XTRANS_DMETHOD_TOOLTIP;3-pass gives best results (recommended for low ISO images).\n1-pass is almost undistinguishable from 3-pass for high ISO images and is faster.
TP_RAW_SENSOR_XTRANS_LABEL;Sensor with X-Trans Matrix
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 0634deedd..334f97f05 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,8 +657,9 @@ 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));
- float noisevar_Ldetail = SQR(static_cast(SQR(100. - dnparams.Ldetail) + 50.*(100. - dnparams.Ldetail)) * TS * 0.5f);
+ const float gain = pow(2.0f, float(expcomp));
+ float params_Ldetail = min(float(dnparams.Ldetail), 99.9f); // max out to avoid div by zero when using noisevar_Ldetail as divisor
+ float noisevar_Ldetail = SQR(static_cast(SQR(100. - params_Ldetail) + 50.*(100. - params_Ldetail)) * TS * 0.5f);
array2D tilemask_in(TS, TS);
array2D tilemask_out(TS, TS);
@@ -706,7 +711,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 +751,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 +761,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 +790,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 +806,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 +819,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 +858,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 +1084,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 +1144,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 +1181,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 +1218,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 +1300,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 +1328,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 +1424,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 +1439,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 +1462,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 +1781,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 +1843,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 +1875,7 @@ SSEFUNCTION void ImProcFunctions::RGB_denoise(int kall, Imagefloat * src, Imagef
}
}
}
+
#ifdef _OPENMP
#pragma omp for nowait
#endif
@@ -1896,16 +1902,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 +1962,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 +2040,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 +2073,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 +2152,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 +2181,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;
}
@@ -2902,7 +2908,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;
@@ -3002,7 +3008,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;
@@ -3081,7 +3087,7 @@ void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int l
delta *= 0.15f;
} else if (chaut < 650.f) {
delta *= 0.1f;
- } else /*if (chaut >= 650.f)*/ {
+ } else { /*if (chaut >= 650.f)*/
delta *= 0.07f;
}
@@ -3119,7 +3125,7 @@ void ImProcFunctions::calcautodn_info (float &chaut, float &delta, int Nb, int l
delta *= 0.3f;
} else if (chaut < 650.f) {
delta *= 0.2f;
- } else /*if (chaut >= 650.f)*/ {
+ } else { /*if (chaut >= 650.f)*/
delta *= 0.15f;
}
@@ -3157,7 +3163,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])},
@@ -3209,7 +3215,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;
@@ -3228,11 +3234,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])},
@@ -3276,19 +3282,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;
@@ -3522,13 +3528,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/demosaic_algos.cc b/rtengine/demosaic_algos.cc
index 88d369969..d83b90cef 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);
}
@@ -3927,6 +3928,299 @@ void RawImageSource::cielab (const float (*rgb)[3], float* l, float* a, float *b
}
}
+
+/**
+* RATIO CORRECTED DEMOSAICING
+* Luis Sanz Rodriguez (luis.sanz.rodriguez(at)gmail(dot)com)
+*
+* Release 2.3 @ 171125
+*
+* Original code from https://github.com/LuisSR/RCD-Demosaicing
+* Licensed under the GNU GPL version 3
+*/
+void RawImageSource::rcd_demosaic()
+{
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgressStr(Glib::ustring::compose(M("TP_RAW_DMETHOD_PROGRESSBAR"), "rcd"));
+ plistener->setProgress(0);
+ }
+
+ int width = W, height = H;
+
+ std::vector cfa(width * height);
+ std::vector> rgb(width * height);
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for (int row = 0; row < height; row++) {
+ for (int col = 0, indx = row * width + col; col < width; col++, indx++) {
+ int c = FC(row, col);
+ cfa[indx] = rgb[indx][c] = LIM01(rawData[row][col] / 65535.f);
+ }
+ }
+
+ if (plistener) {
+ plistener->setProgress(0.05);
+ }
+ // ------------------------------------------------------------------------
+/* RT
+ int row, col, indx, c;
+*/
+ int w1 = width, w2 = 2 * width, w3 = 3 * width, w4 = 4 * width;
+
+ //Tolerance to avoid dividing by zero
+ static const float eps = 1e-5, epssq = 1e-10;
+
+/* RT
+ //Gradients
+ float N_Grad, E_Grad, W_Grad, S_Grad, NW_Grad, NE_Grad, SW_Grad, SE_Grad;
+
+ //Pixel estimation
+ float N_Est, E_Est, W_Est, S_Est, NW_Est, NE_Est, SW_Est, SE_Est, V_Est, H_Est, P_Est, Q_Est;
+
+ //Directional discrimination
+ //float V_Stat, H_Stat, P_Stat, Q_Stat;
+ float VH_Central_Value, VH_Neighbour_Value, PQ_Central_Value, PQ_Neighbour_Value;
+*/
+ float ( *VH_Dir ), ( *PQ_Dir );
+
+ //Low pass filter
+ float ( *lpf );
+
+
+ /**
+ * STEP 1: Find cardinal and diagonal interpolation directions
+ */
+
+ VH_Dir = ( float ( * ) ) calloc( width * height, sizeof *VH_Dir ); //merror ( VH_Dir, "rcd_demosaicing_171117()" );
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for (int row = 4; row < height - 4; row++ ) {
+ for (int col = 4, indx = row * width + col; col < width - 4; col++, indx++ ) {
+ //Calculate h/v local discrimination
+ float V_Stat = max(epssq, - 18.0f * cfa[indx] * cfa[indx - w1] - 18.0f * cfa[indx] * cfa[indx + w1] - 36.0f * cfa[indx] * cfa[indx - w2] - 36.0f * cfa[indx] * cfa[indx + w2] + 18.0f * cfa[indx] * cfa[indx - w3] + 18.0f * cfa[indx] * cfa[indx + w3] - 2.0f * cfa[indx] * cfa[indx - w4] - 2.0f * cfa[indx] * cfa[indx + w4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - w1] * cfa[indx + w1] - 12.0f * cfa[indx - w1] * cfa[indx - w2] + 24.0f * cfa[indx - w1] * cfa[indx + w2] - 38.0f * cfa[indx - w1] * cfa[indx - w3] + 16.0f * cfa[indx - w1] * cfa[indx + w3] + 12.0f * cfa[indx - w1] * cfa[indx - w4] - 6.0f * cfa[indx - w1] * cfa[indx + w4] + 46.0f * cfa[indx - w1] * cfa[indx - w1] + 24.0f * cfa[indx + w1] * cfa[indx - w2] - 12.0f * cfa[indx + w1] * cfa[indx + w2] + 16.0f * cfa[indx + w1] * cfa[indx - w3] - 38.0f * cfa[indx + w1] * cfa[indx + w3] - 6.0f * cfa[indx + w1] * cfa[indx - w4] + 12.0f * cfa[indx + w1] * cfa[indx + w4] + 46.0f * cfa[indx + w1] * cfa[indx + w1] + 14.0f * cfa[indx - w2] * cfa[indx + w2] - 12.0f * cfa[indx - w2] * cfa[indx + w3] - 2.0f * cfa[indx - w2] * cfa[indx - w4] + 2.0f * cfa[indx - w2] * cfa[indx + w4] + 11.0f * cfa[indx - w2] * cfa[indx - w2] - 12.0f * cfa[indx + w2] * cfa[indx - w3] + 2.0f * cfa[indx + w2] * cfa[indx - w4] - 2.0f * cfa[indx + w2] * cfa[indx + w4] + 11.0f * cfa[indx + w2] * cfa[indx + w2] + 2.0f * cfa[indx - w3] * cfa[indx + w3] - 6.0f * cfa[indx - w3] * cfa[indx - w4] + 10.0f * cfa[indx - w3] * cfa[indx - w3] - 6.0f * cfa[indx + w3] * cfa[indx + w4] + 10.0f * cfa[indx + w3] * cfa[indx + w3] + 1.0f * cfa[indx - w4] * cfa[indx - w4] + 1.0f * cfa[indx + w4] * cfa[indx + w4]);
+
+ float H_Stat = max(epssq, - 18.0f * cfa[indx] * cfa[indx - 1] - 18.0f * cfa[indx] * cfa[indx + 1] - 36.0f * cfa[indx] * cfa[indx - 2] - 36.0f * cfa[indx] * cfa[indx + 2] + 18.0f * cfa[indx] * cfa[indx - 3] + 18.0f * cfa[indx] * cfa[indx + 3] - 2.0f * cfa[indx] * cfa[indx - 4] - 2.0f * cfa[indx] * cfa[indx + 4] + 38.0f * cfa[indx] * cfa[indx] - 70.0f * cfa[indx - 1] * cfa[indx + 1] - 12.0f * cfa[indx - 1] * cfa[indx - 2] + 24.0f * cfa[indx - 1] * cfa[indx + 2] - 38.0f * cfa[indx - 1] * cfa[indx - 3] + 16.0f * cfa[indx - 1] * cfa[indx + 3] + 12.0f * cfa[indx - 1] * cfa[indx - 4] - 6.0f * cfa[indx - 1] * cfa[indx + 4] + 46.0f * cfa[indx - 1] * cfa[indx - 1] + 24.0f * cfa[indx + 1] * cfa[indx - 2] - 12.0f * cfa[indx + 1] * cfa[indx + 2] + 16.0f * cfa[indx + 1] * cfa[indx - 3] - 38.0f * cfa[indx + 1] * cfa[indx + 3] - 6.0f * cfa[indx + 1] * cfa[indx - 4] + 12.0f * cfa[indx + 1] * cfa[indx + 4] + 46.0f * cfa[indx + 1] * cfa[indx + 1] + 14.0f * cfa[indx - 2] * cfa[indx + 2] - 12.0f * cfa[indx - 2] * cfa[indx + 3] - 2.0f * cfa[indx - 2] * cfa[indx - 4] + 2.0f * cfa[indx - 2] * cfa[indx + 4] + 11.0f * cfa[indx - 2] * cfa[indx - 2] - 12.0f * cfa[indx + 2] * cfa[indx - 3] + 2.0f * cfa[indx + 2] * cfa[indx - 4] - 2.0f * cfa[indx + 2] * cfa[indx + 4] + 11.0f * cfa[indx + 2] * cfa[indx + 2] + 2.0f * cfa[indx - 3] * cfa[indx + 3] - 6.0f * cfa[indx - 3] * cfa[indx - 4] + 10.0f * cfa[indx - 3] * cfa[indx - 3] - 6.0f * cfa[indx + 3] * cfa[indx + 4] + 10.0f * cfa[indx + 3] * cfa[indx + 3] + 1.0f * cfa[indx - 4] * cfa[indx - 4] + 1.0f * cfa[indx + 4] * cfa[indx + 4]);
+
+ VH_Dir[indx] = V_Stat / (V_Stat + H_Stat);
+ }
+ }
+
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgress(0.2);
+ }
+ // -------------------------------------------------------------------------
+
+ /**
+ * STEP 2: Calculate the low pass filter
+ */
+
+ // Step 2.1: Low pass filter incorporating green, red and blue local samples from the raw data
+ lpf = ( float ( * ) ) calloc( width * height, sizeof *lpf ); //merror ( lpf, "rcd_demosaicing_171125()" );
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for ( int row = 2; row < height - 2; row++ ) {
+ for ( int col = 2 + (FC( row, 0 ) & 1), indx = row * width + col; col < width - 2; col += 2, indx += 2 ) {
+
+ lpf[indx] = 0.25f * cfa[indx] + 0.125f * ( cfa[indx - w1] + cfa[indx + w1] + cfa[indx - 1] + cfa[indx + 1] ) + 0.0625f * ( cfa[indx - w1 - 1] + cfa[indx - w1 + 1] + cfa[indx + w1 - 1] + cfa[indx + w1 + 1] );
+
+ }
+ }
+
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgress(0.4);
+ }
+ // ------------------------------------------------------------------------
+
+ /**
+ * STEP 3: Populate the green channel
+ */
+
+ // Step 3.1: Populate the green channel at blue and red CFA positions
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for ( int row = 4; row < height - 4; row++ ) {
+ for ( int col = 4 + (FC( row, 0 ) & 1), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) {
+
+ // Refined vertical and horizontal local discrimination
+ float VH_Central_Value = VH_Dir[indx];
+ float VH_Neighbourhood_Value = 0.25f * ( VH_Dir[indx - w1 - 1] + VH_Dir[indx - w1 + 1] + VH_Dir[indx + w1 - 1] + VH_Dir[indx + w1 + 1] );
+
+ float VH_Disc = ( fabs( 0.5f - VH_Central_Value ) < fabs( 0.5f - VH_Neighbourhood_Value ) ) ? VH_Neighbourhood_Value : VH_Central_Value;
+
+ // Cardinal gradients
+ float N_Grad = eps + fabs( cfa[indx - w1] - cfa[indx + w1] ) + fabs( cfa[indx] - cfa[indx - w2] ) + fabs( cfa[indx - w1] - cfa[indx - w3] ) + fabs( cfa[indx - w2] - cfa[indx - w4] );
+ float S_Grad = eps + fabs( cfa[indx + w1] - cfa[indx - w1] ) + fabs( cfa[indx] - cfa[indx + w2] ) + fabs( cfa[indx + w1] - cfa[indx + w3] ) + fabs( cfa[indx + w2] - cfa[indx + w4] );
+ float W_Grad = eps + fabs( cfa[indx - 1] - cfa[indx + 1] ) + fabs( cfa[indx] - cfa[indx - 2] ) + fabs( cfa[indx - 1] - cfa[indx - 3] ) + fabs( cfa[indx - 2] - cfa[indx - 4] );
+ float E_Grad = eps + fabs( cfa[indx + 1] - cfa[indx - 1] ) + fabs( cfa[indx] - cfa[indx + 2] ) + fabs( cfa[indx + 1] - cfa[indx + 3] ) + fabs( cfa[indx + 2] - cfa[indx + 4] );
+
+ // Cardinal pixel estimations
+ float N_Est = cfa[indx - w1] * ( 1.f + ( lpf[indx] - lpf[indx - w2] ) / ( eps + lpf[indx] + lpf[indx - w2] ) );
+ float S_Est = cfa[indx + w1] * ( 1.f + ( lpf[indx] - lpf[indx + w2] ) / ( eps + lpf[indx] + lpf[indx + w2] ) );
+ float W_Est = cfa[indx - 1] * ( 1.f + ( lpf[indx] - lpf[indx - 2] ) / ( eps + lpf[indx] + lpf[indx - 2] ) );
+ float E_Est = cfa[indx + 1] * ( 1.f + ( lpf[indx] - lpf[indx + 2] ) / ( eps + lpf[indx] + lpf[indx + 2] ) );
+
+ // Vertical and horizontal estimations
+ float V_Est = ( S_Grad * N_Est + N_Grad * S_Est ) / max(eps, N_Grad + S_Grad );
+ float H_Est = ( W_Grad * E_Est + E_Grad * W_Est ) / max(eps, E_Grad + W_Grad );
+
+ // G@B and G@R interpolation
+ rgb[indx][1] = LIM( VH_Disc * H_Est + ( 1.f - VH_Disc ) * V_Est, 0.f, 1.f );
+
+ }
+ }
+
+ free( lpf );
+
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgress(0.5);
+ }
+ // ------------------------------------------------------------------------
+
+ /**
+ * STEP 4: Populate the red and blue channels
+ */
+
+ // Step 4.1: Calculate P/Q diagonal local discrimination
+ PQ_Dir = ( float ( * ) ) calloc( width * height, sizeof *PQ_Dir ); //merror ( PQ_Dir, "rcd_demosaicing_171125()" );
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for ( int row = 4; row < height - 4; row++ ) {
+ for ( int col = 4 + (FC( row, 0 ) & 1), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) {
+
+ float P_Stat = max( - 18.f * cfa[indx] * cfa[indx - w1 - 1] - 18.f * cfa[indx] * cfa[indx + w1 + 1] - 36.f * cfa[indx] * cfa[indx - w2 - 2] - 36.f * cfa[indx] * cfa[indx + w2 + 2] + 18.f * cfa[indx] * cfa[indx - w3 - 3] + 18.f * cfa[indx] * cfa[indx + w3 + 3] - 2.f * cfa[indx] * cfa[indx - w4 - 4] - 2.f * cfa[indx] * cfa[indx + w4 + 4] + 38.f * cfa[indx] * cfa[indx] - 70.f * cfa[indx - w1 - 1] * cfa[indx + w1 + 1] - 12.f * cfa[indx - w1 - 1] * cfa[indx - w2 - 2] + 24.f * cfa[indx - w1 - 1] * cfa[indx + w2 + 2] - 38.f * cfa[indx - w1 - 1] * cfa[indx - w3 - 3] + 16.f * cfa[indx - w1 - 1] * cfa[indx + w3 + 3] + 12.f * cfa[indx - w1 - 1] * cfa[indx - w4 - 4] - 6.f * cfa[indx - w1 - 1] * cfa[indx + w4 + 4] + 46.f * cfa[indx - w1 - 1] * cfa[indx - w1 - 1] + 24.f * cfa[indx + w1 + 1] * cfa[indx - w2 - 2] - 12.f * cfa[indx + w1 + 1] * cfa[indx + w2 + 2] + 16.f * cfa[indx + w1 + 1] * cfa[indx - w3 - 3] - 38.f * cfa[indx + w1 + 1] * cfa[indx + w3 + 3] - 6.f * cfa[indx + w1 + 1] * cfa[indx - w4 - 4] + 12.f * cfa[indx + w1 + 1] * cfa[indx + w4 + 4] + 46.f * cfa[indx + w1 + 1] * cfa[indx + w1 + 1] + 14.f * cfa[indx - w2 - 2] * cfa[indx + w2 + 2] - 12.f * cfa[indx - w2 - 2] * cfa[indx + w3 + 3] - 2.f * cfa[indx - w2 - 2] * cfa[indx - w4 - 4] + 2.f * cfa[indx - w2 - 2] * cfa[indx + w4 + 4] + 11.f * cfa[indx - w2 - 2] * cfa[indx - w2 - 2] - 12.f * cfa[indx + w2 + 2] * cfa[indx - w3 - 3] + 2 * cfa[indx + w2 + 2] * cfa[indx - w4 - 4] - 2.f * cfa[indx + w2 + 2] * cfa[indx + w4 + 4] + 11.f * cfa[indx + w2 + 2] * cfa[indx + w2 + 2] + 2.f * cfa[indx - w3 - 3] * cfa[indx + w3 + 3] - 6.f * cfa[indx - w3 - 3] * cfa[indx - w4 - 4] + 10.f * cfa[indx - w3 - 3] * cfa[indx - w3 - 3] - 6.f * cfa[indx + w3 + 3] * cfa[indx + w4 + 4] + 10.f * cfa[indx + w3 + 3] * cfa[indx + w3 + 3] + 1.f * cfa[indx - w4 - 4] * cfa[indx - w4 - 4] + 1.f * cfa[indx + w4 + 4] * cfa[indx + w4 + 4], epssq );
+ float Q_Stat = max( - 18.f * cfa[indx] * cfa[indx + w1 - 1] - 18.f * cfa[indx] * cfa[indx - w1 + 1] - 36.f * cfa[indx] * cfa[indx + w2 - 2] - 36.f * cfa[indx] * cfa[indx - w2 + 2] + 18.f * cfa[indx] * cfa[indx + w3 - 3] + 18.f * cfa[indx] * cfa[indx - w3 + 3] - 2.f * cfa[indx] * cfa[indx + w4 - 4] - 2.f * cfa[indx] * cfa[indx - w4 + 4] + 38.f * cfa[indx] * cfa[indx] - 70.f * cfa[indx + w1 - 1] * cfa[indx - w1 + 1] - 12.f * cfa[indx + w1 - 1] * cfa[indx + w2 - 2] + 24.f * cfa[indx + w1 - 1] * cfa[indx - w2 + 2] - 38.f * cfa[indx + w1 - 1] * cfa[indx + w3 - 3] + 16.f * cfa[indx + w1 - 1] * cfa[indx - w3 + 3] + 12.f * cfa[indx + w1 - 1] * cfa[indx + w4 - 4] - 6.f * cfa[indx + w1 - 1] * cfa[indx - w4 + 4] + 46.f * cfa[indx + w1 - 1] * cfa[indx + w1 - 1] + 24.f * cfa[indx - w1 + 1] * cfa[indx + w2 - 2] - 12.f * cfa[indx - w1 + 1] * cfa[indx - w2 + 2] + 16.f * cfa[indx - w1 + 1] * cfa[indx + w3 - 3] - 38.f * cfa[indx - w1 + 1] * cfa[indx - w3 + 3] - 6.f * cfa[indx - w1 + 1] * cfa[indx + w4 - 4] + 12.f * cfa[indx - w1 + 1] * cfa[indx - w4 + 4] + 46.f * cfa[indx - w1 + 1] * cfa[indx - w1 + 1] + 14.f * cfa[indx + w2 - 2] * cfa[indx - w2 + 2] - 12.f * cfa[indx + w2 - 2] * cfa[indx - w3 + 3] - 2.f * cfa[indx + w2 - 2] * cfa[indx + w4 - 4] + 2.f * cfa[indx + w2 - 2] * cfa[indx - w4 + 4] + 11.f * cfa[indx + w2 - 2] * cfa[indx + w2 - 2] - 12.f * cfa[indx - w2 + 2] * cfa[indx + w3 - 3] + 2 * cfa[indx - w2 + 2] * cfa[indx + w4 - 4] - 2.f * cfa[indx - w2 + 2] * cfa[indx - w4 + 4] + 11.f * cfa[indx - w2 + 2] * cfa[indx - w2 + 2] + 2.f * cfa[indx + w3 - 3] * cfa[indx - w3 + 3] - 6.f * cfa[indx + w3 - 3] * cfa[indx + w4 - 4] + 10.f * cfa[indx + w3 - 3] * cfa[indx + w3 - 3] - 6.f * cfa[indx - w3 + 3] * cfa[indx - w4 + 4] + 10.f * cfa[indx - w3 + 3] * cfa[indx - w3 + 3] + 1.f * cfa[indx + w4 - 4] * cfa[indx + w4 - 4] + 1.f * cfa[indx - w4 + 4] * cfa[indx - w4 + 4], epssq );
+
+ PQ_Dir[indx] = P_Stat / ( P_Stat + Q_Stat );
+
+ }
+ }
+
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgress(0.7);
+ }
+ // -------------------------------------------------------------------------
+
+ // Step 4.2: Populate the red and blue channels at blue and red CFA positions
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for ( int row = 4; row < height - 4; row++ ) {
+ for ( int col = 4 + (FC( row, 0 ) & 1), indx = row * width + col, c = 2 - FC( row, col ); col < width - 4; col += 2, indx += 2 ) {
+
+ // Refined P/Q diagonal local discrimination
+ float PQ_Central_Value = PQ_Dir[indx];
+ float PQ_Neighbourhood_Value = 0.25f * ( PQ_Dir[indx - w1 - 1] + PQ_Dir[indx - w1 + 1] + PQ_Dir[indx + w1 - 1] + PQ_Dir[indx + w1 + 1] );
+
+ float PQ_Disc = ( fabs( 0.5f - PQ_Central_Value ) < fabs( 0.5f - PQ_Neighbourhood_Value ) ) ? PQ_Neighbourhood_Value : PQ_Central_Value;
+
+ // Diagonal gradients
+ float NW_Grad = eps + fabs( rgb[indx - w1 - 1][c] - rgb[indx + w1 + 1][c] ) + fabs( rgb[indx - w1 - 1][c] - rgb[indx - w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 - 2][1] );
+ float NE_Grad = eps + fabs( rgb[indx - w1 + 1][c] - rgb[indx + w1 - 1][c] ) + fabs( rgb[indx - w1 + 1][c] - rgb[indx - w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx - w2 + 2][1] );
+ float SW_Grad = eps + fabs( rgb[indx + w1 - 1][c] - rgb[indx - w1 + 1][c] ) + fabs( rgb[indx + w1 - 1][c] - rgb[indx + w3 - 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 - 2][1] );
+ float SE_Grad = eps + fabs( rgb[indx + w1 + 1][c] - rgb[indx - w1 - 1][c] ) + fabs( rgb[indx + w1 + 1][c] - rgb[indx + w3 + 3][c] ) + fabs( rgb[indx][1] - rgb[indx + w2 + 2][1] );
+
+ // Diagonal colour differences
+ float NW_Est = rgb[indx - w1 - 1][c] - rgb[indx - w1 - 1][1];
+ float NE_Est = rgb[indx - w1 + 1][c] - rgb[indx - w1 + 1][1];
+ float SW_Est = rgb[indx + w1 - 1][c] - rgb[indx + w1 - 1][1];
+ float SE_Est = rgb[indx + w1 + 1][c] - rgb[indx + w1 + 1][1];
+
+ // P/Q estimations
+ float P_Est = ( NW_Grad * SE_Est + SE_Grad * NW_Est ) / max(eps, NW_Grad + SE_Grad );
+ float Q_Est = ( NE_Grad * SW_Est + SW_Grad * NE_Est ) / max(eps, NE_Grad + SW_Grad );
+
+ // R@B and B@R interpolation
+ rgb[indx][c] = LIM( rgb[indx][1] + ( 1.f - PQ_Disc ) * P_Est + PQ_Disc * Q_Est, 0.f, 1.f );
+
+ }
+ }
+
+ free( PQ_Dir );
+
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgress(0.825);
+ }
+ // -------------------------------------------------------------------------
+
+ // Step 4.3: Populate the red and blue channels at green CFA positions
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for ( int row = 4; row < height - 4; row++ ) {
+ for ( int col = 4 + (FC( row, 1 ) & 1), indx = row * width + col; col < width - 4; col += 2, indx += 2 ) {
+
+ // Refined vertical and horizontal local discrimination
+ float VH_Central_Value = VH_Dir[indx];
+ float VH_Neighbourhood_Value = 0.25f * ( VH_Dir[indx - w1 - 1] + VH_Dir[indx - w1 + 1] + VH_Dir[indx + w1 - 1] + VH_Dir[indx + w1 + 1] );
+
+ float VH_Disc = ( fabs( 0.5f - VH_Central_Value ) < fabs( 0.5f - VH_Neighbourhood_Value ) ) ? VH_Neighbourhood_Value : VH_Central_Value;
+
+ for ( int c = 0; c <= 2; c += 2 ) {
+
+ // Cardinal gradients
+ float N_Grad = eps + fabs( rgb[indx][1] - rgb[indx - w2][1] ) + fabs( rgb[indx - w1][c] - rgb[indx + w1][c] ) + fabs( rgb[indx - w1][c] - rgb[indx - w3][c] );
+ float S_Grad = eps + fabs( rgb[indx][1] - rgb[indx + w2][1] ) + fabs( rgb[indx + w1][c] - rgb[indx - w1][c] ) + fabs( rgb[indx + w1][c] - rgb[indx + w3][c] );
+ float W_Grad = eps + fabs( rgb[indx][1] - rgb[indx - 2][1] ) + fabs( rgb[indx - 1][c] - rgb[indx + 1][c] ) + fabs( rgb[indx - 1][c] - rgb[indx - 3][c] );
+ float E_Grad = eps + fabs( rgb[indx][1] - rgb[indx + 2][1] ) + fabs( rgb[indx + 1][c] - rgb[indx - 1][c] ) + fabs( rgb[indx + 1][c] - rgb[indx + 3][c] );
+
+ // Cardinal colour differences
+ float N_Est = rgb[indx - w1][c] - rgb[indx - w1][1];
+ float S_Est = rgb[indx + w1][c] - rgb[indx + w1][1];
+ float W_Est = rgb[indx - 1][c] - rgb[indx - 1][1];
+ float E_Est = rgb[indx + 1][c] - rgb[indx + 1][1];
+
+ // Vertical and horizontal estimations
+ float V_Est = ( N_Grad * S_Est + S_Grad * N_Est ) / max(eps, N_Grad + S_Grad );
+ float H_Est = ( E_Grad * W_Est + W_Grad * E_Est ) / max(eps, E_Grad + W_Grad );
+
+ // R@G and B@G interpolation
+ rgb[indx][c] = LIM( rgb[indx][1] + ( 1.f - VH_Disc ) * V_Est + VH_Disc * H_Est, 0.f, 1.f );
+
+ }
+ }
+ }
+
+ free(VH_Dir);
+
+ // RT ---------------------------------------------------------------------
+ if (plistener) {
+ plistener->setProgress(0.95);
+ }
+
+#ifdef _OPENMP
+ #pragma omp parallel for
+#endif
+ for (int row = 0; row < height; ++row) {
+ for (int col = 0, idx = row * width + col ; col < width; ++col, ++idx) {
+ red[row][col] = CLIP(rgb[idx][0] * 65535.f);
+ green[row][col] = CLIP(rgb[idx][1] * 65535.f);
+ blue[row][col] = CLIP(rgb[idx][2] * 65535.f);
+ }
+ }
+
+ border_interpolate2(width, height, 4);
+
+ if (plistener) {
+ plistener->setProgress(1);
+ }
+ // -------------------------------------------------------------------------
+}
+
#define fcol(row,col) xtrans[(row)%6][(col)%6]
#define isgreen(row,col) (xtrans[(row)%3][(col)%3]&1)
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/iccstore.h b/rtengine/iccstore.h
index 48efae087..bdb15d2c0 100644
--- a/rtengine/iccstore.h
+++ b/rtengine/iccstore.h
@@ -34,7 +34,7 @@ namespace rtengine
namespace procparams
{
- class ColorManagementParams;
+ struct ColorManagementParams;
}
diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index fc6a2284f..8fd7bb959 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -171,14 +171,14 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall)
if ( !highDetailNeeded ) {
// if below 100% magnification, take a fast path
- if (rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::none] && rp.bayersensor.method != RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::mono]) {
- rp.bayersensor.method = RAWParams::BayerSensor::methodstring[RAWParams::BayerSensor::fast];
+ if (rp.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE) && rp.bayersensor.method != RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::NONE)) {
+ rp.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST);
}
//bayerrp.all_enhance = false;
- if (rp.xtranssensor.method != RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::none] && rp.xtranssensor.method != RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::mono]) {
- rp.xtranssensor.method = RAWParams::XTransSensor::methodstring[RAWParams::XTransSensor::fast];
+ if (rp.xtranssensor.method != RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE) && rp.xtranssensor.method != RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::NONE)) {
+ rp.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST);
}
rp.bayersensor.ccSteps = 0;
diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc
index c22d7b509..ad7e4260d 100644
--- a/rtengine/improcfun.cc
+++ b/rtengine/improcfun.cc
@@ -438,11 +438,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);
@@ -801,7 +801,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);
@@ -839,7 +839,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;
@@ -887,7 +887,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;
/*
@@ -930,7 +930,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);
@@ -988,7 +988,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;
@@ -1012,7 +1012,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;
@@ -1032,7 +1032,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;
@@ -1117,21 +1117,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;
}
@@ -1302,9 +1302,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
}
}
@@ -1378,21 +1378,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;
}
@@ -1752,14 +1752,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);
@@ -2212,7 +2212,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;
@@ -2241,7 +2241,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;
@@ -2285,7 +2285,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;
@@ -2323,7 +2323,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;
@@ -2380,7 +2380,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;
@@ -2403,7 +2403,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;
@@ -2420,7 +2420,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;
@@ -2490,10 +2490,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
}
@@ -2501,13 +2501,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;
}
@@ -2743,9 +2743,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();
@@ -2837,10 +2837,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
}
@@ -2848,13 +2848,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];
}
@@ -3250,25 +3250,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);
}
@@ -3317,8 +3317,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);
@@ -3621,21 +3621,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);
@@ -3645,7 +3645,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++) {
@@ -3656,7 +3656,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++) {
@@ -3667,7 +3667,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++) {
@@ -3692,28 +3692,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++) {
@@ -3721,7 +3721,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++) {
@@ -3729,7 +3729,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++) {
@@ -4192,21 +4192,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);
@@ -4216,7 +4216,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);
@@ -4652,7 +4652,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
@@ -4663,7 +4663,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
@@ -6488,9 +6488,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 85b35ef18..189d61ddf 100644
--- a/rtengine/ipwavelet.cc
+++ b/rtengine/ipwavelet.cc
@@ -432,56 +432,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/procparams.cc b/rtengine/procparams.cc
index 71ce3a1e3..661efdef9 100644
--- a/rtengine/procparams.cc
+++ b/rtengine/procparams.cc
@@ -16,17 +16,21 @@
* You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see .
*/
-#include
-#include "procparams.h"
-#include "curves.h"
-#include "../rtgui/multilangmgr.h"
-#include "../rtgui/version.h"
-#include "../rtgui/ppversion.h"
-#include "../rtgui/paramsedited.h"
-#include "../rtgui/options.h"
+
+#include