astyle all modified files in retinex branch

This commit is contained in:
Beep6581 2015-10-17 14:45:24 +02:00
parent 7e6d0d45f4
commit 7ca8de08ab
15 changed files with 324 additions and 268 deletions

View File

@ -233,6 +233,7 @@ void Color::init ()
for (int i = 0; i < 65536; i++) {
gammatab_26_11[i] = (65535.0 * gamma26_11 (i / 65535.0));
}
//gammatab_145_3
for (int i = 0; i < 65536; i++) {
igammatab_26_11[i] = (65535.0 * igamma26_11 (i / 65535.0));

View File

@ -513,6 +513,7 @@ void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector<dou
if (!dehaclcurvePoints.empty() && dehaclcurvePoints[0] != 0) {
dCurve = new DiagonalCurve (dehaclcurvePoints, CURVES_MIN_POLY_POINTS / skip);
if (outBeforeCurveHistogram) {
histNeeded = true;
}
@ -522,6 +523,7 @@ void CurveFactory::curveDehaContL ( bool & dehacontlutili, const std::vector<dou
dehacontlutili = true;
}
}
if (histNeeded) {
for (int i = 0; i < 32768; i++) {
double hval = CLIPD((double)i / 32767.0);

View File

@ -22,22 +22,22 @@ typedef __m128i vint2;
//
#ifdef __GNUC__
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4
#define LVF(x) _mm_load_ps(&x)
#define LVFU(x) _mm_loadu_ps(&x)
#define STVF(x,y) _mm_store_ps(&x,y)
#define STVFU(x,y) _mm_storeu_ps(&x,y)
#else // there is a bug in gcc 4.7.x when using openmp and aligned memory and -O3
#define LVF(x) _mm_loadu_ps(&x)
#define LVFU(x) _mm_loadu_ps(&x)
#define STVF(x,y) _mm_storeu_ps(&x,y)
#define STVFU(x,y) _mm_storeu_ps(&x,y)
#endif
#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4
#define LVF(x) _mm_load_ps(&x)
#define LVFU(x) _mm_loadu_ps(&x)
#define STVF(x,y) _mm_store_ps(&x,y)
#define STVFU(x,y) _mm_storeu_ps(&x,y)
#else // there is a bug in gcc 4.7.x when using openmp and aligned memory and -O3
#define LVF(x) _mm_loadu_ps(&x)
#define LVFU(x) _mm_loadu_ps(&x)
#define STVF(x,y) _mm_storeu_ps(&x,y)
#define STVFU(x,y) _mm_storeu_ps(&x,y)
#endif
#else
#define LVF(x) _mm_load_ps(&x)
#define LVFU(x) _mm_loadu_ps(&x)
#define STVF(x,y) _mm_store_ps(&x,y)
#define STVFU(x,y) _mm_storeu_ps(&x,y)
#define LVF(x) _mm_load_ps(&x)
#define LVFU(x) _mm_loadu_ps(&x)
#define STVF(x,y) _mm_store_ps(&x,y)
#define STVFU(x,y) _mm_storeu_ps(&x,y)
#endif
// Load 8 floats from a and combine a[0],a[2],a[4] and a[6] into a vector of 4 floats

View File

@ -94,7 +94,7 @@ void retinex_scales( float* scales, int nscales, int mode, int s, float high)
size_step = (float) log(s - 2.0f) / (float) nscales;
for ( int i = 0; i < nscales; ++i ) {
scales[i] = high*s - (float)pow (10.f, (i * size_step) / log (10.f));
scales[i] = high * s - (float)pow (10.f, (i * size_step) / log (10.f));
}
}
}
@ -225,12 +225,17 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
limD *= useHslLin ? 10.f : 1.f;
float ilimD = 1.f / limD;
int moderetinex = 2; // default to 2 ( deh.retinexMethod == "high" )
float hig = ((float) deh.highl)/100.f;
float hig = ((float) deh.highl) / 100.f;
bool higplus = false ;
float elogt;
float hl = deh.baselog;
if(hl >= 2.71828f) elogt = 2.71828f + SQR(SQR(hl - 2.71828f));
else elogt = hl;
if(hl >= 2.71828f) {
elogt = 2.71828f + SQR(SQR(hl - 2.71828f));
} else {
elogt = hl;
}
elogt = 2.71828f;//disabled baselog
FlatCurve* shcurve = NULL;//curve L=f(H)
bool lhutili = false;
@ -243,14 +248,15 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
delete shcurve;
shcurve = NULL;
}
}
else {
} else {
lhutili = true;
}
}
if(deh.retinexMethod == "highliplus") higplus = true;
if(deh.retinexMethod == "highliplus") {
higplus = true;
}
if (deh.retinexMethod == "uni") {
moderetinex = 0;
@ -259,13 +265,15 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
if (deh.retinexMethod == "low") {
moderetinex = 1;
}
if (deh.retinexMethod == "highli" || deh.retinexMethod == "highliplus") {
moderetinex = 3;
}
float aahi = 49.f/99.f;////reduce sensibility 50%
float aahi = 49.f / 99.f; ////reduce sensibility 50%
float bbhi = 1.f - aahi;
float high;
high = bbhi + aahi*(float) deh.highl;
high = bbhi + aahi * (float) deh.highl;
retinex_scales( RetinexScales, scal, moderetinex, nei, high );
int H_L = height;
@ -331,7 +339,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
}
} else {
for (; j < W_L - 3; j += 4) {
_mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) )/xlogf(elogtv));
_mm_storeu_ps(&luminance[i][j], LVFU(luminance[i][j]) + pondv * xlogf(LIMV(LVFU(src[i][j]) / LVFU(out[i][j]), limMinv, limMaxv) ) / xlogf(elogtv));
}
}
@ -343,7 +351,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
}
} else {
for (; j < W_L; j++) {
luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD))/log(elogt);// /logt ?
luminance[i][j] += pond * xlogf(LIM(src[i][j] / out[i][j], ilimD, limD)) / log(elogt); // /logt ?
}
}
}
@ -457,7 +465,7 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
}
delta = maxi - mini;
// printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
// printf("maxi=%f mini=%f mean=%f std=%f delta=%f maxtr=%f mintr=%f\n", maxi, mini, mean, stddv, delta, maxtr, mintr);
if ( !delta ) {
delta = 1.0f;
@ -492,19 +500,26 @@ void RawImageSource::MSR(float** luminance, float** originalLuminance, float **e
if(cd < cdmin) {
cdmin = cd;
}
float str = strength;
if(lhutili) { // S=f(H)
{
float HH = exLuminance[i][j];
float valparam;
if(useHsl || useHslLin) valparam = float((shcurve->getVal(HH) - 0.5f));
else valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f));
str *= (1.f + 2.f*valparam);
if(useHsl || useHslLin) {
valparam = float((shcurve->getVal(HH) - 0.5f));
} else {
valparam = float((shcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f));
}
str *= (1.f + 2.f * valparam);
}
}
// if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig;
luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j];
// if(exLuminance[i][j] > 65535.f*hig && higplus) str *= hig;
luminance[i][j] = clipretinex( cd, 0.f, 32768.f ) * str + (1.f - str) * originalLuminance[i][j];
}
#ifdef _OPENMP

View File

@ -3915,14 +3915,14 @@ int ProcParams::load (Glib::ustring fname, ParamsEdited* pedited)
}
}
/* if (keyFile.has_key ("Retinex", "grbl")) {
retinex.grbl = keyFile.get_integer ("Retinex", "grbl");
/* if (keyFile.has_key ("Retinex", "grbl")) {
retinex.grbl = keyFile.get_integer ("Retinex", "grbl");
if (pedited) {
pedited->retinex.grbl = true;
}
}
*/
if (pedited) {
pedited->retinex.grbl = true;
}
}
*/
if (keyFile.has_key ("Retinex", "CDCurve")) {
retinex.cdcurve = keyFile.get_double_list ("Retinex", "CDCurve");

View File

@ -1856,98 +1856,110 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, RetinexPar
conversionBuffer[2] (W - 2 * border, H - 2 * border);
conversionBuffer[3] (W - 2 * border, H - 2 * border);
LUTf *retinexgamtab;//gamma before and after Retinex to restore tones
LUTf lutTonereti;
lutTonereti(65536);
LUTf *retinexgamtab;//gamma before and after Retinex to restore tones
LUTf lutTonereti;
lutTonereti(65536);
if(retinexParams.gammaretinex == "low")
retinexgamtab = &(Color::gammatab_115_2);
else if(retinexParams.gammaretinex == "mid")
retinexgamtab = &(Color::gammatab_13_2);
else if(retinexParams.gammaretinex == "hig")
retinexgamtab = &(Color::gammatab_145_3);
else if(retinexParams.gammaretinex == "fre"){
double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5;
double pwr = 1.0 / retinexParams.gam;
double gamm = retinexParams.gam;
double ts = retinexParams.slope;
double gamm2 = retinexParams.gam;
if(gamm2 < 1.) {pwr = 1./pwr; gamm = 1. / gamm;}
if(retinexParams.gammaretinex == "low") {
retinexgamtab = &(Color::gammatab_115_2);
} else if(retinexParams.gammaretinex == "mid") {
retinexgamtab = &(Color::gammatab_13_2);
} else if(retinexParams.gammaretinex == "hig") {
retinexgamtab = &(Color::gammatab_145_3);
} else if(retinexParams.gammaretinex == "fre") {
double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5;
double pwr = 1.0 / retinexParams.gam;
double gamm = retinexParams.gam;
double ts = retinexParams.slope;
double gamm2 = retinexParams.gam;
if(gamm2 < 1.) {
pwr = 1. / pwr;
gamm = 1. / gamm;
}
int mode = 0, imax = 0;
Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope
int mode = 0, imax = 0;
Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope
// printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4);
for (int i = 0; i < 65536; i++) {
double val = (i) / 65535.;
double start = g_a3;
double add = g_a4;
double mul = 1. + g_a4;
double x;
if(gamm2 < 1.) {start = g_a2; add = g_a4;
x = Color::igammareti (val, gamm, start, ts, mul , add);}
else
x = Color::gammareti (val, gamm, start, ts, mul , add);
for (int i = 0; i < 65536; i++) {
double val = (i) / 65535.;
double start = g_a3;
double add = g_a4;
double mul = 1. + g_a4;
double x;
lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values
if(gamm2 < 1.) {
start = g_a2;
add = g_a4;
x = Color::igammareti (val, gamm, start, ts, mul , add);
} else {
x = Color::gammareti (val, gamm, start, ts, mul , add);
}
retinexgamtab = &lutTonereti;
}
/*
//test with amsterdam.pef and other files
float rr,gg,bb;
rr=red[50][2300];
gg=green[50][2300];
bb=blue[50][2300];
printf("rr=%f gg=%f bb=%f \n",rr,gg,bb);
rr=red[1630][370];
gg=green[1630][370];
bb=blue[1630][370];
printf("rr1=%f gg1=%f bb1=%f \n",rr,gg,bb);
rr=red[380][1630];
gg=green[380][1630];
bb=blue[380][1630];
printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb);
*/
/*
if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult !
float hig = ((float)retinexParams.highlig)/100.f;
float higgb = ((float)retinexParams.grbl)/100.f;
lutTonereti[i] = CLIP(x * 65535.);// CLIP avoid in some case extra values
}
retinexgamtab = &lutTonereti;
}
/*
//test with amsterdam.pef and other files
float rr,gg,bb;
rr=red[50][2300];
gg=green[50][2300];
bb=blue[50][2300];
printf("rr=%f gg=%f bb=%f \n",rr,gg,bb);
rr=red[1630][370];
gg=green[1630][370];
bb=blue[1630][370];
printf("rr1=%f gg1=%f bb1=%f \n",rr,gg,bb);
rr=red[380][1630];
gg=green[380][1630];
bb=blue[380][1630];
printf("rr2=%f gg2=%f bb2=%f \n",rr,gg,bb);
*/
/*
if(retinexParams.highlig < 100 && retinexParams.retinexMethod == "highliplus") {//try to recover magenta...very difficult !
float hig = ((float)retinexParams.highlig)/100.f;
float higgb = ((float)retinexParams.grbl)/100.f;
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = border; i < H - border; i++ ) {
for (int j = border; j < W - border; j++ ) {
float R_,G_,B_;
R_=red[i][j];
G_=green[i][j];
B_=blue[i][j];
//empirical method to find highlight magenta with no conversion RGB and no white balance
//red = master Gr and Bl default higgb=0.5
// if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_;
// else conversionBuffer[3][i - border][j - border] = 0.f;
}
}
}
*/
if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = border; i < H - border; i++ ) {
for (int j = border; j < W - border; j++ ) {
float R_,G_,B_;
R_=red[i][j];
G_=green[i][j];
B_=blue[i][j];
//empirical method to find highlight magenta with no conversion RGB and no white balance
//red = master Gr and Bl default higgb=0.5
// if(R_>65535.f*hig && G_ > 65535.f*higgb && B_ > 65535.f*higgb) conversionBuffer[3][i - border][j - border] = R_;
// else conversionBuffer[3][i - border][j - border] = 0.f;
}
}
}
*/
if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = border; i < H - border; i++ ) {
for (int j = border; j < W - border; j++ ) {
float R_,G_,B_;
R_=red[i][j];
G_=green[i][j];
B_=blue[i][j];
float R_, G_, B_;
R_ = red[i][j];
G_ = green[i][j];
B_ = blue[i][j];
red[i][j] = (*retinexgamtab)[R_];
green[i][j] = (*retinexgamtab)[G_];
blue[i][j] = (*retinexgamtab)[B_];
}
}
}
}
if(useHsl) {
#ifdef _OPENMP
@ -2054,7 +2066,7 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
for (int j = border; j < W - border; j++) {
float X, Y, Z, L, aa, bb;
int pos;
float R_,G_,B_;
float R_, G_, B_;
R_ = red[i][j];
G_ = green[i][j];
B_ = blue[i][j];
@ -2066,9 +2078,10 @@ if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma
conversionBuffer[0][i - border][j - border] = aa;
conversionBuffer[1][i - border][j - border] = bb;
conversionBuffer[2][i - border][j - border] = L;
conversionBuffer[3][i - border][j - border] = xatan2f(bb,aa);
// if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_;
// else conversionBuffer[3][i - border][j - border] = 0.f;
conversionBuffer[3][i - border][j - border] = xatan2f(bb, aa);
// if(R_>40000.f && G_ > 30000.f && B_ > 30000.f) conversionBuffer[3][i - border][j - border] = R_;
// else conversionBuffer[3][i - border][j - border] = 0.f;
if(lhist16RETI) {
pos = (int) clipretinex(L, 0, 32768);
lhist16RETIThr[pos]++;//histogram in Curve Lab
@ -2117,42 +2130,55 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
if (settings->verbose) {
printf ("Applying Retinex\n");
}
LUTf lutToneireti;
lutToneireti(65536);
LUTf *retinexigamtab;//gamma before and after Retinex to restore tones
if(deh.gammaretinex == "low")
retinexigamtab = &(Color::igammatab_115_2);
else if(deh.gammaretinex == "mid")
retinexigamtab = &(Color::igammatab_13_2);
else if(deh.gammaretinex == "hig")
retinexigamtab = &(Color::igammatab_145_3);
else if(deh.gammaretinex == "fre"){
double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5;
double pwr = 1.0 / deh.gam;
double gamm = deh.gam;
double gamm2 = gamm;
double ts = deh.slope;
int mode = 0, imax = 0;
if(gamm2 < 1.) {pwr = 1./pwr; gamm = 1. / gamm;}
LUTf lutToneireti;
lutToneireti(65536);
Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope
// printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4);
for (int i = 0; i < 65536; i++) {
double val = (i) / 65535.;
double x;
double mul = 1. + g_a4;
double add = g_a4;
double start = g_a2;
if(gamm2 < 1.) {start = g_a3; add = g_a3;
x = Color::gammareti (val, gamm, start, ts, mul , add);}
else
x = Color::igammareti (val, gamm, start, ts, mul , add);
LUTf *retinexigamtab;//gamma before and after Retinex to restore tones
lutToneireti[i] = CLIP(x * 65535.);
}
retinexigamtab = &lutToneireti;
if(deh.gammaretinex == "low") {
retinexigamtab = &(Color::igammatab_115_2);
} else if(deh.gammaretinex == "mid") {
retinexigamtab = &(Color::igammatab_13_2);
} else if(deh.gammaretinex == "hig") {
retinexigamtab = &(Color::igammatab_145_3);
} else if(deh.gammaretinex == "fre") {
double g_a0, g_a1, g_a2, g_a3, g_a4, g_a5;
double pwr = 1.0 / deh.gam;
double gamm = deh.gam;
double gamm2 = gamm;
double ts = deh.slope;
int mode = 0, imax = 0;
if(gamm2 < 1.) {
pwr = 1. / pwr;
gamm = 1. / gamm;
}
Color::calcGamma(pwr, ts, mode, imax, g_a0, g_a1, g_a2, g_a3, g_a4, g_a5); // call to calcGamma with selected gamma and slope
// printf("g_a0=%f g_a1=%f g_a2=%f g_a3=%f g_a4=%f\n", g_a0,g_a1,g_a2,g_a3,g_a4);
for (int i = 0; i < 65536; i++) {
double val = (i) / 65535.;
double x;
double mul = 1. + g_a4;
double add = g_a4;
double start = g_a2;
if(gamm2 < 1.) {
start = g_a3;
add = g_a3;
x = Color::gammareti (val, gamm, start, ts, mul , add);
} else {
x = Color::igammareti (val, gamm, start, ts, mul , add);
}
lutToneireti[i] = CLIP(x * 65535.);
}
retinexigamtab = &lutToneireti;
}
// We need a buffer with original L data to allow correct blending
// red, green and blue still have original size of raw, but we can't use the borders
const int HNew = H - 2 * border;
@ -2172,22 +2198,21 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
dLcurve.clear();
}
FlatCurve* chcurve = NULL;//curve c=f(H)
bool chutili = false;
FlatCurve* chcurve = NULL;//curve c=f(H)
bool chutili = false;
if (deh.enabled && deh.retinexMethod == "highli") {
chcurve = new FlatCurve(deh.lhcurve);
if (deh.enabled && deh.retinexMethod == "highli") {
chcurve = new FlatCurve(deh.lhcurve);
if (!chcurve || chcurve->isIdentity()) {
if (chcurve) {
delete chcurve;
chcurve = NULL;
}
}
else {
chutili = true;
if (!chcurve || chcurve->isIdentity()) {
if (chcurve) {
delete chcurve;
chcurve = NULL;
}
} else {
chutili = true;
}
}
@ -2247,30 +2272,34 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
histLRETI[hi] += hist16RET[i];
}
}
MSR(LBuffer, conversionBuffer[2], conversionBuffer[3], WNew, HNew, deh, dehatransmissionCurve, minCD, maxCD, mini, maxi, Tmean, Tsigma, Tmin, Tmax);
if(useHsl) {
if(chutili) {
#ifdef _OPENMP
#pragma omp parallel for
#pragma omp parallel for
#endif
for (int i = border; i < H - border; i++ ) {
int j = border;
for (; j < W - border; j++) {
float valp;
float chr;
// if(chutili) { // c=f(H)
{
valp = float((chcurve->getVal(conversionBuffer[3][i - border][j - border]) - 0.5f));
float valp;
float chr;
// if(chutili) { // c=f(H)
{
valp = float((chcurve->getVal(conversionBuffer[3][i - border][j - border]) - 0.5f));
conversionBuffer[1][i - border][j - border] *= (1.f + 2.f*valp);
}
// }
conversionBuffer[1][i - border][j - border] *= (1.f + 2.f * valp);
}
// }
}
}
}
#ifdef _OPENMP
#pragma omp parallel for
#endif
@ -2309,39 +2338,41 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = border; i < H - border; i++ ) {
for (int j= border; j < W - border; j++) {
float Lprov1 = (LBuffer[i - border][j - border])/327.68f;
for (int i = border; i < H - border; i++ ) {
for (int j = border; j < W - border; j++) {
float Lprov1 = (LBuffer[i - border][j - border]) / 327.68f;
float Chprov1 = sqrt(SQR(conversionBuffer[0][i - border][j - border]) + SQR(conversionBuffer[1][i - border][j - border])) / 327.68f;
float HH = xatan2f(conversionBuffer[1][i - border][j - border], conversionBuffer[0][i - border][j - border]);
float2 sincosval;
float valp;
float chr;
if(chutili) { // c=f(H)
{
valp = float((chcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f));
Chprov1 *= (1.f + 2.f*valp);
}
if(chutili) { // c=f(H)
{
valp = float((chcurve->getVal(Color::huelab_to_huehsv2(HH)) - 0.5f));
Chprov1 *= (1.f + 2.f * valp);
}
}
sincosval = xsincosf(HH);
float R,G,B;
float R, G, B;
#ifdef _DEBUG
bool neg = false;
bool more_rgb = false;
//gamut control : Lab values are in gamut
Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
bool neg = false;
bool more_rgb = false;
//gamut control : Lab values are in gamut
Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f, neg, more_rgb);
#else
//gamut control : Lab values are in gamut
Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f);
//gamut control : Lab values are in gamut
Color::gamutLchonly(HH, sincosval, Lprov1, Chprov1, R, G, B, wip, highlight, 0.15f, 0.96f);
#endif
conversionBuffer[0][i - border][j - border] = 327.68f * Chprov1 * sincosval.y;
conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x;
LBuffer[i - border][j - border] = Lprov1 * 327.68f;
conversionBuffer[0][i - border][j - border] = 327.68f * Chprov1 * sincosval.y;
conversionBuffer[1][i - border][j - border] = 327.68f * Chprov1 * sincosval.x;
LBuffer[i - border][j - border] = Lprov1 * 327.68f;
}
}
@ -2387,21 +2418,23 @@ void RawImageSource::retinex(ColorManagementParams cmp, RetinexParams deh, ToneC
blue[i][j] = B;
}
}
}
if (chcurve) {
delete chcurve;
}
}
if(deh.gammaretinex != "none" && deh.str !=0){//inverse gamma
if (chcurve) {
delete chcurve;
}
if(deh.gammaretinex != "none" && deh.str != 0) { //inverse gamma
#ifdef _OPENMP
#pragma omp parallel for
#endif
for (int i = border; i < H - border; i++ ) {
for (int j = border; j < W - border; j++ ) {
float R_,G_,B_;
R_=red[i][j];
G_=green[i][j];
B_=blue[i][j];
float R_, G_, B_;
R_ = red[i][j];
G_ = green[i][j];
B_ = blue[i][j];
red[i][j] = (*retinexigamtab)[R_];
green[i][j] = (*retinexigamtab)[G_];
blue[i][j] = (*retinexigamtab)[B_];

View File

@ -627,6 +627,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p
Imagefloat* baseImg = new Imagefloat (fw, fh);
imgsrc->getImage (currWB, tr, baseImg, pp, params.toneCurve, params.icm, params.raw);
if (pl) {
pl->setProgress (0.50);
}

View File

@ -567,6 +567,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc)
Gtk::Allocation alloc;
iareapanel->imageArea->on_resized(alloc);
}
history->resetSnapShotNumber();
}

View File

@ -1112,7 +1112,7 @@ void ParamsEdited::combine (rtengine::procparams::ProcParams& toEdit, const rten
if (retinex.gain) {
toEdit.retinex.gain = dontforceSet && options.baBehav[ADDSET_RETI_GAIN] ? toEdit.retinex.gain + mods.retinex.gain : mods.retinex.gain;
}
}
if (retinex.offs) {
toEdit.retinex.offs = dontforceSet && options.baBehav[ADDSET_RETI_OFFS] ? toEdit.retinex.offs + mods.retinex.offs : mods.retinex.offs;

View File

@ -321,12 +321,12 @@ Retinex::Retinex () : FoldableToolPanel(this, "retinex", M("TP_RETINEX_LABEL"),
baselog->delay = 200;
}
/* grbl->setAdjusterListener (this);
/* grbl->setAdjusterListener (this);
if (grbl->delay < 200) {
grbl->delay = 200;
}
*/
if (grbl->delay < 200) {
grbl->delay = 200;
}
*/
pack_start (*retinexVBox);
pack_start (*expsettings);
pack_start (*neutrHBox);
@ -671,18 +671,21 @@ void Retinex::write (ProcParams* pp, ParamsEdited* pedited)
void Retinex::retinexMethodChanged()
{
if(retinexMethod->get_active_row_number() == 3) highl->show();
else highl->hide();
if(retinexMethod->get_active_row_number() == 3) {
highl->show();
} else {
highl->hide();
}
if (listener) {
listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ());
listener->panelChanged (EvretinexMethod, retinexMethod->get_active_text ());
}
}
void Retinex::ColorSpaceUpdateUI ()
{
if (!batchMode) {
curveEditorGH->show();
curveEditorGH->show();
if(retinexcolorspace->get_active_row_number() == 0) {
curveEditorGD->show();
@ -941,9 +944,9 @@ void Retinex::colorForValue (double valX, double valY, enum ColorCaller::ElemTyp
float value = (1.f - 0.7f) * float(valX) + 0.7f;
// whole hue range
// Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
Color::hsv2rgb01(float(valY), float(valX), value, R, G, B);
// whole hue range
// Y axis / from 0.15 up to 0.75 (arbitrary values; was 0.45 before)
Color::hsv2rgb01(float(valY), float(valX), value, R, G, B);
} else if (callerId == 4) { // LH - bottom bar
Color::hsv2rgb01(float(valX), 0.5f, float(valY), R, G, B);
} else if (callerId == 5) { // HH - bottom bar