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 d1b2d1d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/wnnm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,11 @@ 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->src_vi->numFrames + 1 + 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 d1b2d1d

Please sign in to comment.