Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix suspected off-by-one error in Swift decoder #253

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

daprice
Copy link

@daprice daprice commented Jun 14, 2024

I believe I found an off-by-one error in the Swift decoder that was resulting in detail being cropped from the bottom and right edges of the decoded images.

Because the x and y pixel coordinates are iterated using half-open ranges, their maximum values are one less than width and height. Therefore I think the divisors for calculating the basis when iterating over pixels should also be one less.

This isn’t very noticeable when using the recommended 32x32 size, but when using smaller sizes like 8x8, this change makes the BlurHash images line up more closely with their source images.

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.

1 participant