Skip to content

Commit

Permalink
Fix bugs (hang and incorrect normalisation) in the kernel smoother
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHarker committed Apr 9, 2022
1 parent c9d037e commit e2b4873
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FrameLib_Dependencies/KernelSmoother.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class kernel_smoother : private spectral_processor<T, Allocator>

uintptr_t filter_size = static_cast<uintptr_t>(std::ceil(std::max(width_lo, width_hi) * 0.5));
uintptr_t filter_full = filter_size * 2 - 1;
uintptr_t max_per_filter = static_cast<uintptr_t>(width_mul ? (2.0 / width_mul) + 1.0 : length);
uintptr_t max_per_filter = static_cast<uintptr_t>(width_mul ? (2.0 / std::abs(width_mul)) + 1.0 : length);
uintptr_t data_width = max_per_filter + (filter_full - 1);

op_sizes sizes(data_width, filter_full, processor::EdgeMode::Linear);
Expand Down
4 changes: 2 additions & 2 deletions FrameLib_Objects/Vector/FrameLib_KernelSmooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ void FrameLib_KernelSmooth::process()

if (mParameters.getEnum<Scales>(kScale) == kNormalised)
{
width_lo /= static_cast<double>(sizeIn2);
width_hi /= static_cast<double>(sizeIn2);
width_lo /= static_cast<double>(sizeIn1);
width_hi /= static_cast<double>(sizeIn1);
}

mSmoother.smooth(output, input, kernel, sizeIn1, sizeIn2, width_lo, width_hi, symmetric, edges);
Expand Down

0 comments on commit e2b4873

Please sign in to comment.