Skip to content

Commit

Permalink
Remove incorrect normalization in Hann window
Browse files Browse the repository at this point in the history
The window should carry a factor of 1/2 for each of the two cosine terms
being multiplied together, for a combined factor of 1/4. However, the
normalization factor comes out anyway when output pixel values are
divided by the sum of the weights, so it's a micro-optimization to just
remove the factor rather than correcting it.
  • Loading branch information
svank committed May 21, 2022
1 parent 3cfc7a8 commit 4a1a492
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion reproject/adaptive/deforest.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ cdef double hanning_filter(double x, double y) nogil:
y = fabs(y)
if x >= 1 or y >= 1:
return 0
return (cos(x * pi)+1.0) * (cos(y * pi)+1.0) / 2.0
return (cos(x * pi)+1.0) * (cos(y * pi)+1.0)


@cython.boundscheck(False)
Expand Down

0 comments on commit 4a1a492

Please sign in to comment.