diff --git a/rtengine/iplocallab.cc b/rtengine/iplocallab.cc index 7094fa509..7e5c2bf61 100644 --- a/rtengine/iplocallab.cc +++ b/rtengine/iplocallab.cc @@ -1451,6 +1451,7 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, floa float l = xlogf(std::max(Y2[y][x], 1e-9f)); float ll = round(l * base_posterization) / base_posterization; Y[y][x] = xexpf(ll); + assert(std::isfinite(Y[y][x])); } } @@ -1470,16 +1471,20 @@ void ImProcFunctions::log_encode(Imagefloat *rgb, struct local_params & lp, floa float &g = rgb->g(y, x); float &b = rgb->b(y, x); float t = Y[y][x]; - - if (t > noise) { + float t2; + if (t > noise && (t2 = norm(r, g, b)) > noise) { float c = apply(t, false); float f = c / t; - float t2 = norm(r, g, b); + // float t2 = norm(r, g, b); float f2 = apply(t2) / t2; f = intp(blend, f, f2); + assert(std::isfinite(f)); r *= f; g *= f; b *= f; + assert(std::isfinite(r)); + assert(std::isfinite(g)); + assert(std::isfinite(b)); } } }