Revert "lanczos3: Actually sample 7x7 instead of 6x6 (#27)" #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts commit 22e1bb1.
The kernel size of the
lanczos3
filter is 6x6, and sampling it atx=3.5
ory=3.5
results in a weight of0
, thus making these pixels completely irrelevant. This became more clear in #28 that simplified the offset passed tolanczos3_filter()
to always be0.5
, to read the weight at the middle of each source pixel.Note that for an even reduction in image size the center coordinate of every target pixel (what
uv
denotes) is exactly on the boundary between two source pixels, meaning the pixel at kernel positionx=0,y=0
(barring float imprecisions) is at the right/bottom of the center of the target pixel, hence correctly reading 3 pixels to the left, top, right and bottom (with indices in the range [-3, 2]).For uneven reductions (i.e. 3x) this doesn't hold, and that was likely what the code removed in #28 was incorrectly trying to compensate for?