Turn wavelet.Lmethod into an integer (by @heckflosse, #4397)

This commit is contained in:
Flössie 2018-02-14 20:09:17 +01:00
parent 04cef998a2
commit cf3ea4f451
5 changed files with 22 additions and 14 deletions

View File

@ -2453,7 +2453,7 @@ void ImProcFunctions::finalContAllL (float ** WavCoeffs_L, float * WavCoeffs_L0,
} }
} }
int choicelevel = atoi(params->wavelet.Lmethod.data()) - 1; int choicelevel = params->wavelet.Lmethod - 1;
choicelevel = choicelevel == -1 ? 4 : choicelevel; choicelevel = choicelevel == -1 ? 4 : choicelevel;
int choiceClevel = 0; int choiceClevel = 0;
@ -3266,7 +3266,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
} }
// to see each level of wavelet ...level from 0 to 8 // to see each level of wavelet ...level from 0 to 8
int choicelevel = atoi(params->wavelet.Lmethod.data()) - 1; int choicelevel = params->wavelet.Lmethod - 1;
choicelevel = choicelevel == -1 ? 4 : choicelevel; choicelevel = choicelevel == -1 ? 4 : choicelevel;
} }
@ -3524,7 +3524,7 @@ void ImProcFunctions::ContAllAB (LabImage * labco, int maxlvl, float ** varhue,
} }
// to see each level of wavelet ...level from 0 to 8 // to see each level of wavelet ...level from 0 to 8
int choicelevel = atoi(params->wavelet.Lmethod.data()) - 1; int choicelevel = params->wavelet.Lmethod - 1;
choicelevel = choicelevel == -1 ? 4 : choicelevel; choicelevel = choicelevel == -1 ? 4 : choicelevel;
int choiceClevel = 0; int choiceClevel = 0;

View File

@ -2081,7 +2081,7 @@ WaveletParams::WaveletParams() :
expfinal(false), expfinal(false),
exptoning(false), exptoning(false),
expnoise(false), expnoise(false),
Lmethod("4_"), Lmethod(4),
CLmethod("all"), CLmethod("all"),
Backmethod("grey"), Backmethod("grey"),
Tilesmethod("full"), Tilesmethod("full"),
@ -4220,7 +4220,15 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Wavelet", "Lipst", pedited, wavelet.lipst, pedited->wavelet.lipst); assignFromKeyfile(keyFile, "Wavelet", "Lipst", pedited, wavelet.lipst, pedited->wavelet.lipst);
assignFromKeyfile(keyFile, "Wavelet", "AvoidColorShift", pedited, wavelet.avoid, pedited->wavelet.avoid); assignFromKeyfile(keyFile, "Wavelet", "AvoidColorShift", pedited, wavelet.avoid, pedited->wavelet.avoid);
assignFromKeyfile(keyFile, "Wavelet", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr); assignFromKeyfile(keyFile, "Wavelet", "TMr", pedited, wavelet.tmr, pedited->wavelet.tmr);
if (ppVersion < 331) { // wavelet.Lmethod was a string before version 331
Glib::ustring temp;
assignFromKeyfile(keyFile, "Wavelet", "LevMethod", pedited, temp, pedited->wavelet.Lmethod);
if (!temp.empty()) {
wavelet.Lmethod = std::stoi(temp);
}
} else {
assignFromKeyfile(keyFile, "Wavelet", "LevMethod", pedited, wavelet.Lmethod, pedited->wavelet.Lmethod); assignFromKeyfile(keyFile, "Wavelet", "LevMethod", pedited, wavelet.Lmethod, pedited->wavelet.Lmethod);
}
assignFromKeyfile(keyFile, "Wavelet", "ChoiceLevMethod", pedited, wavelet.CLmethod, pedited->wavelet.CLmethod); assignFromKeyfile(keyFile, "Wavelet", "ChoiceLevMethod", pedited, wavelet.CLmethod, pedited->wavelet.CLmethod);
assignFromKeyfile(keyFile, "Wavelet", "BackMethod", pedited, wavelet.Backmethod, pedited->wavelet.Backmethod); assignFromKeyfile(keyFile, "Wavelet", "BackMethod", pedited, wavelet.Backmethod, pedited->wavelet.Backmethod);
assignFromKeyfile(keyFile, "Wavelet", "TilesMethod", pedited, wavelet.Tilesmethod, pedited->wavelet.Tilesmethod); assignFromKeyfile(keyFile, "Wavelet", "TilesMethod", pedited, wavelet.Tilesmethod, pedited->wavelet.Tilesmethod);

View File

@ -1098,7 +1098,7 @@ struct WaveletParams {
bool exptoning; bool exptoning;
bool expnoise; bool expnoise;
Glib::ustring Lmethod; int Lmethod;
Glib::ustring CLmethod; Glib::ustring CLmethod;
Glib::ustring Backmethod; Glib::ustring Backmethod;
Glib::ustring Tilesmethod; Glib::ustring Tilesmethod;

View File

@ -1,11 +1,13 @@
#pragma once #pragma once
// This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes // This number has to be incremented whenever the PP3 file format is modified or the behaviour of a tool changes
#define PPVERSION 330 #define PPVERSION 331
#define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified #define PPVERSION_AEXP 301 //value of PPVERSION when auto exposure algorithm was modified
/* /*
Log of version changes Log of version changes
331 2018-14-02
changed wavelet.Lmethod to int
330 2018-20-01 330 2018-20-01
Added 'Auto-matched Tone Curve' button, performing histogram matching Added 'Auto-matched Tone Curve' button, performing histogram matching
329 2017-12-09 329 2017-12-09

View File

@ -1096,7 +1096,7 @@ void Wavelet::read (const ProcParams* pp, const ParamsEdited* pedited)
Dirmethod->set_active (3); Dirmethod->set_active (3);
} }
int selectedLevel = atoi(pp->wavelet.Lmethod.data()) - 1; int selectedLevel = pp->wavelet.Lmethod - 1;
Lmethod->set_active (selectedLevel == -1 ? 4 : selectedLevel); Lmethod->set_active (selectedLevel == -1 ? 4 : selectedLevel);
ccshape->setCurve (pp->wavelet.ccwcurve); ccshape->setCurve (pp->wavelet.ccwcurve);
@ -1735,9 +1735,7 @@ void Wavelet::write (ProcParams* pp, ParamsEdited* pedited)
pp->wavelet.Dirmethod = "all"; pp->wavelet.Dirmethod = "all";
} }
char lMethod[3]; // one additional char to avoid buffer overrun if someone increases number of levels > 9 pp->wavelet.Lmethod = Lmethod->get_active_row_number() + 1;
sprintf(lMethod, "%d", Lmethod->get_active_row_number() + 1);
pp->wavelet.Lmethod = lMethod;
} }
void Wavelet::curveChanged (CurveEditor* ce) void Wavelet::curveChanged (CurveEditor* ce)