Resolve rounding issues in reduce #1872
Merged
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 PR is a split-off from #1769, targeting the
8.10
branch.It fixes two small bugs that have been found with jsummers/resamplescope. The first commit (kleisauke@49d8051) restores the round-to-nearest behaviour in
reduce{h,v}
, that was removed with PR #1592. This change can be observed in the following graphs:The second commit (kleisauke@fdc140e) rounds the sum values to the nearest integer in
*_notab
version. I'm not entirely sure why this is necessary and whether this is the right place to do it, but it seems to fix the double-precision graph:The last commit (kleisauke@4533375) rounds the
x
andy
values of thevips_embed
call up and take this offset into account (i.e. by subtracting it fromhoffset
/voffset
). Somehow I cannot illustrate this change within the graphs, but can confirm that this fixes the border-issues reported on sharp (lovell/sharp#2408 and lovell/sharp#2411). It also does not cause regressions on the pyvips-issue-148 and vips-issue-703 test repositories.