Skip to content

morph: fix regressions after Highway implementation #4240

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

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

kleisauke
Copy link
Member

See the individual commits for more details.

Context: lovell/sharp#4243.

Test case
$ cat <<EOT > 3x3.mat
3 3 1 0
0 0 0
0 0 0
0 0 0
EOT
$ curl -LO https://github.com/qpincon/sharp/raw/main/test/fixtures/dot-and-lines.png
$ vips morph dot-and-lines.png erode.png 3x3.mat erode --vips-novector
$ vips morph dot-and-lines.png dilate.png 3x3.mat dilate --vips-novector

Targets the 8.16 branch.

Previously, `seq->coff` was used both for storing offsets to clear
values (zero values in masks) and as an array for non-128 mask
coefficients. However, in commit 40e2884 (PR libvips#3618), `seq->coff`
was restricted to `guint8` values, making it incompatible for
storing offsets.

Fix this by syncing the C-paths with the Highway implementation.
`~p` and `p ^ 255` produce the same result on uchar images, as XOR
affects only the lowest 8 bits.
@jcupitt
Copy link
Member

jcupitt commented Nov 4, 2024

Great!

The nip and libvips tests passed, I'll look at expanding them to catch things like this.

@jcupitt jcupitt merged commit 9fe7ac3 into libvips:8.16 Nov 4, 2024
6 checks passed
@kleisauke kleisauke deleted the 8.16-fix-morph branch November 4, 2024 12:36
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