Skip to content

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

Open
daprice wants to merge 1 commit into
woltapp:masterfrom
daprice:master
Open

Fix suspected off-by-one error in Swift decoder#253
daprice wants to merge 1 commit into
woltapp:masterfrom
daprice:master

Conversation

@daprice
Copy link
Copy Markdown

@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