Fixed crash - thanks alberto - to encoding
This commit is contained in:
parent
48330133f1
commit
4fa494da55
@ -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 l = xlogf(std::max(Y2[y][x], 1e-9f));
|
||||||
float ll = round(l * base_posterization) / base_posterization;
|
float ll = round(l * base_posterization) / base_posterization;
|
||||||
Y[y][x] = xexpf(ll);
|
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 &g = rgb->g(y, x);
|
||||||
float &b = rgb->b(y, x);
|
float &b = rgb->b(y, x);
|
||||||
float t = Y[y][x];
|
float t = Y[y][x];
|
||||||
|
float t2;
|
||||||
if (t > noise) {
|
if (t > noise && (t2 = norm(r, g, b)) > noise) {
|
||||||
float c = apply(t, false);
|
float c = apply(t, false);
|
||||||
float f = c / t;
|
float f = c / t;
|
||||||
float t2 = norm(r, g, b);
|
// float t2 = norm(r, g, b);
|
||||||
float f2 = apply(t2) / t2;
|
float f2 = apply(t2) / t2;
|
||||||
f = intp(blend, f, f2);
|
f = intp(blend, f, f2);
|
||||||
|
assert(std::isfinite(f));
|
||||||
r *= f;
|
r *= f;
|
||||||
g *= f;
|
g *= f;
|
||||||
b *= f;
|
b *= f;
|
||||||
|
assert(std::isfinite(r));
|
||||||
|
assert(std::isfinite(g));
|
||||||
|
assert(std::isfinite(b));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user