Merge with 'Beep6581/dev'

This commit is contained in:
Pandagrapher 2023-10-20 13:16:03 +02:00
commit 3eb73fb225
13 changed files with 98 additions and 29 deletions

View File

@ -12,7 +12,7 @@ on:
workflow_dispatch:
env:
publish_pre_dev_labels: '[]'
publish_pre_dev_labels: '["Beep6581:ladehazeblack"]'
jobs:
build:

View File

@ -12,7 +12,7 @@ on:
workflow_dispatch:
env:
publish_pre_dev_labels: '[]'
publish_pre_dev_labels: '["Beep6581:ladehazeblack"]'
jobs:
build:
@ -35,21 +35,21 @@ jobs:
with:
location: C:\msys2
update: true
msystem: MINGW64
install: |
gzip
git
intltool
mingw-w64-x86_64-gcc
mingw-w64-x86_64-make
mingw-w64-x86_64-pkg-config
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gtkmm3
mingw-w64-x86_64-lcms2
mingw-w64-x86_64-fftw
mingw-w64-x86_64-lensfun
mingw-w64-x86_64-libiptcdata
mingw-w64-x86_64-exiv2
pacboy: |
cc:p
pkgconf:p
cmake:p
ninja:p
gtkmm3:p
lcms2:p
fftw:p
lensfun:p
libiptcdata:p
exiv2:p
- name: Configure build
run: |
@ -63,11 +63,6 @@ jobs:
echo "Cache suffix is '$CACHE_SUFFIX'."
fi
echo "Making build directory."
mkdir build
echo "Changing working directory to the build directory."
cd build
echo "Running CMake configure."
cmake \
-G "Ninja" \
@ -75,21 +70,18 @@ jobs:
-DCACHE_NAME_SUFFIX="$CACHE_SUFFIX" \
-DPROC_TARGET_NUMBER="1" \
-DLENSFUNDBDIR="share/lensfun" \
..
-S . -B build
echo "Recording filtered ref name."
echo "REF_NAME_FILTERED=$REF_NAME_FILTERED" >> "$(cygpath -u $GITHUB_ENV)"
- name: Build RawTherapee
working-directory: ./build
run: |
echo "Running CMake install."
cmake --build . --target install
cmake --build build --target install
- name: Include Lensfun
run: |
echo "Patching lensfun-update-data script."
sed -i 's/HTTPError\(, ValueError\)/URLError\1/' $(which lensfun-update-data)
echo "Updating Lensfun database."
lensfun-update-data
echo "Creating Lensfun directory in the build directory."

View File

@ -1447,6 +1447,7 @@ HISTORY_MSG_LOCALCONTRAST_ENABLED;Local Contrast
HISTORY_MSG_LOCALCONTRAST_LIGHTNESS;Local Contrast - Lightness
HISTORY_MSG_LOCALCONTRAST_RADIUS;Local Contrast - Radius
HISTORY_MSG_LOCALLAB_TE_PIVOT;Local - Equalizer pivot
HISTORY_MSG_LOCAL_DEHAZE_BLACK;Local - Dehaze - black
HISTORY_MSG_LOCAL_GAMUTMUNSEL;Local - SC - Avoid Color Shift
HISTORY_MSG_METADATA_MODE;Metadata copy mode
HISTORY_MSG_MICROCONTRAST_CONTRAST;Microcontrast - Contrast threshold
@ -2875,6 +2876,7 @@ TP_LOCALLAB_DARKRETI;Darkness
TP_LOCALLAB_DEHAFRA;Dehaze
TP_LOCALLAB_DEHAZ;Strength
TP_LOCALLAB_DEHAZFRAME_TOOLTIP;Removes atmospheric haze. Increases overall saturation and detail.\nCan remove color casts, but may also introduce a blue cast which can be corrected with other tools.
TP_LOCALLAB_DEHAZE_BLACK;Black
TP_LOCALLAB_DEHAZ_TOOLTIP;Negative values add haze.
TP_LOCALLAB_DELTAD;Delta balance
TP_LOCALLAB_DELTAEC;ΔE Image mask

View File

@ -364,6 +364,8 @@ enum class BlurType {
float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax,
float& meantm, float& stdtm, float& meanreti, float& stdreti, float &fab,
float &highresi, float &nresi, float &highresi46, float &nresi46, float &Lhighresi, float &Lnresi, float &Lhighresi46, float &Lnresi46);
void tone_eqdehaz(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread);
void addGaNoise(LabImage *lab, LabImage *dst, const float mean, const float variance, const int sk);
void BlurNoise_Localold(int call, const struct local_params& lp, LabImage* original, LabImage* transformed, const LabImage* const tmp1, int cx, int cy);
@ -489,7 +491,7 @@ enum class BlurType {
void BadpixelsLab(LabImage * lab, double radius, int thresh, float chrom);
void dehaze(Imagefloat *rgb, const procparams::DehazeParams &dehazeParams);
void dehazeloc(Imagefloat *rgb, const procparams::DehazeParams &dehazeParams);
void dehazeloc(Imagefloat *rgb, const procparams::DehazeParams &dehazeParams, int sk, int sp);
void ToneMapFattal02(Imagefloat *rgb, const procparams::FattalToneMappingParams &fatParams, int detail_level, int Lalone, float **Lum, int WW, int HH, int algo);
void localContrast(LabImage *lab, float **destination, const procparams::LocalContrastParams &localContrastParams, bool fftwlc, double scale);
void colorToningLabGrid(LabImage *lab, int xstart, int xend, int ystart, int yend, bool MultiThread);

View File

@ -454,7 +454,7 @@ void ImProcFunctions::dehaze(Imagefloat *img, const DehazeParams &dehazeParams)
}
}
void ImProcFunctions::dehazeloc(Imagefloat *img, const DehazeParams &dehazeParams)
void ImProcFunctions::dehazeloc(Imagefloat *img, const DehazeParams &dehazeParams, int sk, int sp)
{
//J.Desmis 12 2019 - this version derived from ART, is slower than the main from maximum 10% - probably use of SSE
//Probably Ingo could solved this problem in some times
@ -476,6 +476,13 @@ void ImProcFunctions::dehazeloc(Imagefloat *img, const DehazeParams &dehazeParam
float ambient[3];
float maxDistance = 0.f;
int whit = 0;
int blac = params->locallab.spots.at(sp).dehazeblack;
if(blac != 0) {
ImProcFunctions::tone_eqdehaz(this, img, whit, blac, params->icm.workingProfile, sk, multiThread);
}
{
array2D<float>& R = dark; // R and dark can safely use the same buffer, which is faster and reduces memory allocations/deallocations
array2D<float> G(W, H);

View File

@ -2303,6 +2303,34 @@ void ImProcFunctions::loccont(int bfw, int bfh, LabImage* tmp1, float rad, float
}
}
void ImProcFunctions::tone_eqdehaz(ImProcFunctions *ipf, Imagefloat *rgb, int whits, int blacks, const Glib::ustring &workingProfile, double scale, bool multithread)
{
ToneEqualizerParams params;
params.enabled = true;
params.regularization = 0.f;
params.pivot = 0.f;
double blred = 0.4;
params.bands[0] = blred * blacks;
int bla = abs(blacks);
int threshblawhi = 50;
int threshblawhi2 = 85;
if(bla > threshblawhi) {
params.bands[1] = blred * sign(blacks) * (bla - threshblawhi);
}
if(bla > threshblawhi2) {
params.bands[2] = blred * sign(blacks) * (bla - threshblawhi2);
}
params.bands[4] = whits;
int whi = abs(whits);
if(whi > threshblawhi) {
params.bands[3] = sign(whits) * (whi - threshblawhi);
}
ipf->toneEqualizer(rgb, params, workingProfile, scale, multithread);
}
void sigmoidla (float &valj, float thresj, float lambda)
{
//thres : shifts the action of sigmoid to darker tones or lights
@ -14412,7 +14440,7 @@ void ImProcFunctions::Lab_Local(
dehazeParams.saturation = lp.dehazeSaturation;
dehazeParams.depth = lp.depth;
lab2rgb(*bufexpfin, *tmpImage.get(), params->icm.workingProfile);
dehazeloc(tmpImage.get(), dehazeParams);
dehazeloc(tmpImage.get(), dehazeParams, sk, sp);
rgb2lab(*tmpImage.get(), *bufexpfin, params->icm.workingProfile);
transit_shapedetect2(sp, 0.f, 0.f, call, 30, bufexporig.get(), bufexpfin.get(), nullptr, hueref, chromaref, lumaref, sobelref, 0.f, nullptr, lp, original, transformed, cx, cy, sk);

View File

@ -3828,6 +3828,7 @@ LocallabParams::LocallabSpot::LocallabSpot() :
equilret(false),
loglin(true),
dehazeSaturation(50.0),
dehazeblack(0.0),
softradiusret(40.0),
CCmaskreticurve{
static_cast<double>(FCT_MinMaxCPoints),
@ -5043,6 +5044,7 @@ bool LocallabParams::LocallabSpot::operator ==(const LocallabSpot& other) const
&& equilret == other.equilret
&& loglin == other.loglin
&& dehazeSaturation == other.dehazeSaturation
&& dehazeblack == other.dehazeblack
&& softradiusret == other.softradiusret
&& CCmaskreticurve == other.CCmaskreticurve
&& LLmaskreticurve == other.LLmaskreticurve
@ -6927,6 +6929,7 @@ int ProcParams::save(const Glib::ustring& fname, const Glib::ustring& fname2, bo
saveToKeyfile(!pedited || spot_edited->equilret, "Locallab", "Equilret_" + index_str, spot.equilret, keyFile);
saveToKeyfile(!pedited || spot_edited->loglin, "Locallab", "Loglin_" + index_str, spot.loglin, keyFile);
saveToKeyfile(!pedited || spot_edited->dehazeSaturation, "Locallab", "dehazeSaturation_" + index_str, spot.dehazeSaturation, keyFile);
saveToKeyfile(!pedited || spot_edited->dehazeblack, "Locallab", "dehazeblack_" + index_str, spot.dehazeblack, keyFile);
saveToKeyfile(!pedited || spot_edited->softradiusret, "Locallab", "Softradiusret_" + index_str, spot.softradiusret, keyFile);
saveToKeyfile(!pedited || spot_edited->CCmaskreticurve, "Locallab", "CCmaskretiCurve_" + index_str, spot.CCmaskreticurve, keyFile);
saveToKeyfile(!pedited || spot_edited->LLmaskreticurve, "Locallab", "LLmaskretiCurve_" + index_str, spot.LLmaskreticurve, keyFile);
@ -9143,7 +9146,8 @@ int ProcParams::load(const Glib::ustring& fname, ParamsEdited* pedited)
assignFromKeyfile(keyFile, "Locallab", "Inversret_" + index_str, spot.inversret, spotEdited.inversret);
assignFromKeyfile(keyFile, "Locallab", "Equilret_" + index_str, spot.equilret, spotEdited.equilret);
assignFromKeyfile(keyFile, "Locallab", "Loglin_" + index_str, spot.loglin, spotEdited.loglin);
assignFromKeyfile(keyFile, "Locallab", "dehazeSaturation" + index_str, spot.dehazeSaturation, spotEdited.dehazeSaturation);
assignFromKeyfile(keyFile, "Locallab", "dehazeSaturation_" + index_str, spot.dehazeSaturation, spotEdited.dehazeSaturation);
assignFromKeyfile(keyFile, "Locallab", "dehazeblack_" + index_str, spot.dehazeblack, spotEdited.dehazeblack);
assignFromKeyfile(keyFile, "Locallab", "Softradiusret_" + index_str, spot.softradiusret, spotEdited.softradiusret);
assignFromKeyfile(keyFile, "Locallab", "CCmaskretiCurve_" + index_str, spot.CCmaskreticurve, spotEdited.CCmaskreticurve);
assignFromKeyfile(keyFile, "Locallab", "LLmaskretiCurve_" + index_str, spot.LLmaskreticurve, spotEdited.LLmaskreticurve);

View File

@ -1403,6 +1403,7 @@ struct LocallabParams {
bool equilret;
bool loglin;
double dehazeSaturation;
double dehazeblack;
double softradiusret;
std::vector<double> CCmaskreticurve;
std::vector<double> LLmaskreticurve;

View File

@ -940,6 +940,7 @@ private:
Adjuster* const dehaz;
Adjuster* const depth;
Adjuster* const dehazeSaturation;
Adjuster* const dehazeblack;
Gtk::Frame* const retiFrame;
Adjuster* const str;
Gtk::CheckButton* const loglin;
@ -991,6 +992,8 @@ private:
DiagonalCurveEditor* const Lmaskretishape;
Gtk::CheckButton* const inversret;
rtengine::ProcEvent Evlocallabdehazeblack;
sigc::connection loglinConn, retinexMethodConn, fftwretiConn, equilretConn, showmaskretiMethodConn, enaretiMaskConn, enaretiMasktmapConn, inversretConn;
public:

View File

@ -796,6 +796,7 @@ LocallabRetinex::LocallabRetinex():
dehaz(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEHAZ"), -100, 100, 1, 0))),
depth(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEPTH"), 0, 100, 1, 25))),
dehazeSaturation(Gtk::manage(new Adjuster(M("TP_DEHAZE_SATURATION"), 0, 100, 1, 50))),
dehazeblack(Gtk::manage(new Adjuster(M("TP_LOCALLAB_DEHAZE_BLACK"), -65., 100., 1., 0.))),
retiFrame(Gtk::manage(new Gtk::Frame(M("TP_LOCALLAB_RETIFRA")))),
str(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STR"), 0., 100., 0.2, 0.))),
loglin(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_LOGLIN")))),
@ -848,6 +849,10 @@ LocallabRetinex::LocallabRetinex():
Lmaskretishape(static_cast<DiagonalCurveEditor*>(mask2retiCurveEditorG->addCurve(CT_Diagonal, "L(L)"))),
inversret(Gtk::manage(new Gtk::CheckButton(M("TP_LOCALLAB_INVERS"))))
{
auto m = ProcEventMapper::getInstance();
Evlocallabdehazeblack = m->newEvent(AUTOEXP, "HISTORY_MSG_LOCAL_DEHAZE_BLACK");
set_orientation(Gtk::ORIENTATION_VERTICAL);
const LocallabParams::LocallabSpot defSpot;
@ -857,6 +862,7 @@ LocallabRetinex::LocallabRetinex():
dehazeSaturation->setAdjusterListener(this);
depth->setAdjusterListener(this);
dehazeblack->setAdjusterListener(this);
retiFrame->set_label_align(0.025, 0.5);
@ -991,6 +997,7 @@ LocallabRetinex::LocallabRetinex():
dehaBox->pack_start(*dehaz);
dehaBox->pack_start(*depth);
dehaBox->pack_start(*dehazeSaturation);
dehaBox->pack_start(*dehazeblack);
dehaFrame->add(*dehaBox);
auxBox->add(*dehaFrame);
ToolParamBlock* const deharetiBox = Gtk::manage(new ToolParamBlock());
@ -1247,6 +1254,7 @@ void LocallabRetinex::read(const rtengine::procparams::ProcParams* pp, const Par
dehaz->setValue((double)spot.dehaz);
depth->setValue((double)spot.depth);
dehazeSaturation->setValue((double)spot.dehazeSaturation);
dehazeblack->setValue((double)spot.dehazeblack);
str->setValue(spot.str);
loglin->set_active(spot.loglin);
sensih->setValue((double)spot.sensih);
@ -1325,6 +1333,7 @@ void LocallabRetinex::write(rtengine::procparams::ProcParams* pp, ParamsEdited*
spot.dehaz = dehaz->getIntValue();
spot.depth = depth->getIntValue();
spot.dehazeSaturation = dehazeSaturation->getIntValue();
spot.dehazeblack = dehazeblack->getValue();
spot.str = str->getValue();
spot.loglin = loglin->get_active();
spot.sensih = sensih->getIntValue();
@ -1383,6 +1392,7 @@ void LocallabRetinex::setDefaults(const rtengine::procparams::ProcParams* defPar
// Set default values for adjuster widgets
dehaz->setDefault((double)defSpot.dehaz);
dehazeSaturation->setDefault((double)defSpot.dehazeSaturation);
dehazeblack->setDefault((double)defSpot.dehazeblack);
depth->setDefault((double)defSpot.depth);
str->setDefault(defSpot.str);
sensih->setDefault((double)defSpot.sensih);
@ -1438,6 +1448,13 @@ void LocallabRetinex::adjusterChanged(Adjuster* a, double newval)
}
}
if (a == dehazeblack) {
if (listener) {
listener->panelChanged(Evlocallabdehazeblack,
dehazeblack->getTextValue() + " (" + escapeHtmlChars(getSpotName()) + ")");
}
}
if (a == depth) {
if (listener) {
listener->panelChanged(Evlocallabdepth,

View File

@ -1478,6 +1478,7 @@ void ParamsEdited::initFrom(const std::vector<rtengine::procparams::ProcParams>&
locallab.spots.at(j).equilret = locallab.spots.at(j).equilret && pSpot.equilret == otherSpot.equilret;
locallab.spots.at(j).loglin = locallab.spots.at(j).loglin && pSpot.loglin == otherSpot.loglin;
locallab.spots.at(j).dehazeSaturation = locallab.spots.at(j).dehazeSaturation && pSpot.dehazeSaturation == otherSpot.dehazeSaturation;
locallab.spots.at(j).dehazeblack = locallab.spots.at(j).dehazeblack && pSpot.dehazeblack == otherSpot.dehazeblack;
locallab.spots.at(j).softradiusret = locallab.spots.at(j).softradiusret && pSpot.softradiusret == otherSpot.softradiusret;
locallab.spots.at(j).CCmaskreticurve = locallab.spots.at(j).CCmaskreticurve && pSpot.CCmaskreticurve == otherSpot.CCmaskreticurve;
locallab.spots.at(j).LLmaskreticurve = locallab.spots.at(j).LLmaskreticurve && pSpot.LLmaskreticurve == otherSpot.LLmaskreticurve;
@ -4933,6 +4934,10 @@ void ParamsEdited::combine(rtengine::procparams::ProcParams& toEdit, const rteng
toEdit.locallab.spots.at(i).dehazeSaturation = mods.locallab.spots.at(i).dehazeSaturation;
}
if (locallab.spots.at(i).dehazeblack) {
toEdit.locallab.spots.at(i).dehazeblack = mods.locallab.spots.at(i).dehazeblack;
}
if (locallab.spots.at(i).softradiusret) {
toEdit.locallab.spots.at(i).softradiusret = mods.locallab.spots.at(i).softradiusret;
}
@ -7864,6 +7869,7 @@ LocallabParamsEdited::LocallabSpotEdited::LocallabSpotEdited(bool v) :
equilret(v),
loglin(v),
dehazeSaturation(v),
dehazeblack(v),
softradiusret(v),
CCmaskreticurve(v),
LLmaskreticurve(v),
@ -8559,6 +8565,7 @@ void LocallabParamsEdited::LocallabSpotEdited::set(bool v)
equilret = v;
loglin = v;
dehazeSaturation = v;
dehazeblack = v;
softradiusret = v;
CCmaskreticurve = v;
LLmaskreticurve = v;

View File

@ -776,6 +776,7 @@ public:
bool equilret;
bool loglin;
bool dehazeSaturation;
bool dehazeblack;
bool softradiusret;
bool CCmaskreticurve;
bool LLmaskreticurve;

View File

@ -856,10 +856,15 @@ ToolPanelCoordinator::updateToolPanel(
}
FoldableToolPanel *tool_panel =
getFoldableToolPanel(*new_tool_trees_iter);
if (tool_panel->getParent()) {
const bool reparent = tool_panel->getParent();
if (reparent) {
tool_panel->getParent()->remove(*tool_panel->getExpander());
}
addPanel(panelBox, tool_panel, level);
if (!reparent) {
// If attaching for the first time, update the widget sizes.
tool_panel->getExpander()->check_resize();
}
}
// Update the child tools.