Merge branch 'hdr_tonemap_fattal' of https://github.com/Beep6581/RawTherapee into hdr_tonemap_fattal

This commit is contained in:
heckflosse
2017-11-06 01:12:37 +01:00
2 changed files with 11 additions and 4 deletions

View File

@@ -1130,6 +1130,12 @@ void rescale_bilinear(const Array2Df &src, Array2Df &dst, bool multithread)
}
}
inline float luminance(float r, float g, float b, TMatrix ws)
{
return r * ws[1][0] + g * ws[1][1] + b * ws[1][2];
}
} // namespace
@@ -1161,13 +1167,14 @@ void ImProcFunctions::ToneMapFattal02(Imagefloat *rgb)
const float epsilon = 1e-4f;
const float luminance_noise_floor = 65.535f;
const float min_luminance = 1.f;
TMatrix ws = ICCStore::getInstance()->workingSpaceMatrix(params->icm.working);
#ifdef _OPENMP
#pragma omp parallel for if (multiThread)
#endif
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
Yr(x, y) = std::max(Color::rgbLuminance(rgb->r(y, x), rgb->g(y, x), rgb->b(y, x)), min_luminance); // clip really black pixels
Yr(x, y) = std::max(luminance(rgb->r(y, x), rgb->g(y, x), rgb->b(y, x), ws), min_luminance); // clip really black pixels
}
}

View File

@@ -29,14 +29,14 @@ FattalToneMapping::FattalToneMapping(): FoldableToolPanel(this, "fattal", M("TP_
// setEnabledTooltipMarkup(M("TP_EPD_TOOLTIP"));
amount = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_AMOUNT"), 0., 100., 1., 0.0));
threshold = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_THRESHOLD"), -100., 100., 1., 0.0));
amount = Gtk::manage(new Adjuster (M("TP_TM_FATTAL_AMOUNT"), -100., 100., 1., 0.0));
threshold->setAdjusterListener(this);
amount->setAdjusterListener(this);
threshold->setAdjusterListener(this);
threshold->show();
amount->show();
threshold->show();
pack_start(*amount);
pack_start(*threshold);