Skip to content

Commit

Permalink
source/wnnm.cpp: fix temporal padding for VAggregate()
Browse files Browse the repository at this point in the history
  • Loading branch information
WolframRhodium committed Jul 15, 2022
1 parent 40d809d commit f49d64e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/wnnm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,9 @@ static const VSFrameRef *VS_CC VAggregateGetFrame(
std::memset(buffer, 0, 2 * plane_width * sizeof(float));
for (int i = 0; i < 2 * d->radius + 1; ++i) {
auto agg_src = srcps[i];
agg_src += ((2 * d->radius - i) * 2 * plane_height + y) * plane_stride;
// bm3d.VAggregate implements zero padding in temporal dimension
// here we implements replication padding
agg_src += ((std::clamp(2 * d->radius - i, n - d->radius, n + d->radius)) * 2 * plane_height + y) * plane_stride;
for (int x = 0; x < plane_width; ++x) {
buffer[x] += agg_src[x];
}
Expand Down

0 comments on commit f49d64e

Please sign in to comment.