diff --git a/rtengine/tmo_fattal02.cc b/rtengine/tmo_fattal02.cc index 846518df7..37e01ea97 100644 --- a/rtengine/tmo_fattal02.cc +++ b/rtengine/tmo_fattal02.cc @@ -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 } } diff --git a/rtgui/fattaltonemap.cc b/rtgui/fattaltonemap.cc index aefe405d5..d14b76004 100644 --- a/rtgui/fattaltonemap.cc +++ b/rtgui/fattaltonemap.cc @@ -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);