Fixed crash - thanks alberto - to encoding

This commit is contained in:
Desmis 2020-01-21 18:21:59 +01:00
parent 48330133f1
commit 4fa494da55

View File

@ -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));
}
}
}