FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix 16-bit ImageFilter accuracy by akx · Pull Request #9786 · python-pillow/Pillow · GitHub

Fix 16-bit ImageFilter accuracy - #9786

Merged
radarhere merged 2 commits into
python-pillow:mainfrom
akx:just-bugfix-f16
Jul 17, 2026
Merged

Fix 16-bit ImageFilter accuracy#9786
radarhere merged 2 commits into
python-pillow:mainfrom
akx:just-bugfix-f16

Conversation

akx commented Jul 9, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Follows up on #8438 (418ae7c)

Also included in #9760.

  1. The high byte of each 16-bit channel was being truncated due to an operator typo.
  2. 16-bit values were inadvertently rounded up by a pixel value per iteration.

Copy link
Copy Markdown
Member

I've created akx#9 with a suggestion.

akx commented Jul 13, 2026

Copy link
Copy Markdown
Contributor Author

Sure, though then the relationship between the 1000 requested and the 1001 we're testing against is a little muddier.

Copy link
Copy Markdown
Member

We can restore it if you would prefer, I just didn't see any need to not be precise.

Is that what 'Allow for kernel rounding errors' was meant to refer to?

akx commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Is that what 'Allow for kernel rounding errors' was meant to refer to?

Yes... Now that I look into it again without just allowing "well it's probably floating point 🤷", the source of the bug is the "Add one time for rounding" from 847dd67 being accumulated into 1.0 throughout due to int ss_int = ROUND_UP(ss);.

That needs to be fixed, and then we can truly use exact values 😄

akx force-pushed the just-bugfix-f16 branch from b0f428d to 4b87863 Compare July 16, 2026 07:22
akx changed the title Fix high byte of I;16* images being truncated by ImageFilter Fix I;16* ImageFilter accuracy Jul 16, 2026
akx force-pushed the just-bugfix-f16 branch from 4b87863 to edd2d82 Compare July 16, 2026 07:25
akx changed the title Fix I;16* ImageFilter accuracy Fix 16-bit ImageFilter accuracy Jul 16, 2026
Comment thread Tests/test_image_filter.py Outdated
Comment thread Tests/test_image_filter.py Outdated
akx force-pushed the just-bugfix-f16 branch from edd2d82 to 4d4d54b Compare July 16, 2026 09:04
akx force-pushed the just-bugfix-f16 branch from 4d4d54b to 77bd329 Compare July 16, 2026 09:04
radarhere merged commit 78be7e8 into python-pillow:main Jul 17, 2026
98 of 102 checks passed
akx deleted the just-bugfix-f16 branch August 10, 2026 18:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL