light: hack -soft to give better results on https://github.com/ericwa/tyrutils-ericw/issues/171

This commit is contained in:
Eric Wasylishen 2017-09-16 17:47:40 -06:00
parent 26c5f65f4e
commit 7252ba7841
1 changed files with 9 additions and 2 deletions

View File

@ -2540,14 +2540,21 @@ BoxBlurImage(const std::vector<qvec4f> &input, int w, int h, int radius)
for (int y0 = -radius; y0 <= radius; y0++) { for (int y0 = -radius; y0 <= radius; y0++) {
for (int x0 = -radius; x0 <= radius; x0++) { for (int x0 = -radius; x0 <= radius; x0++) {
const int x1 = x + x0; const int x1 = qclamp(x + x0, 0, w - 1);
const int y1 = y + y0; const int y1 = qclamp(y + y0, 0, h - 1);
// check if the kernel goes outside of the source image // check if the kernel goes outside of the source image
// 2017-09-16: this is a hack, but clamping the
// x/y instead of discarding the samples outside of the
// kernel looks better in some cases:
// https://github.com/ericwa/tyrutils-ericw/issues/171
#if 0
if (x1 < 0 || x1 >= w) if (x1 < 0 || x1 >= w)
continue; continue;
if (y1 < 0 || y1 >= h) if (y1 < 0 || y1 >= h)
continue; continue;
#endif
// read the input sample // read the input sample
const float weight = 1.0f; const float weight = 1.0f;