patchwork/denoising: fix bug in weighted average.