Skip to content

Commit 4531545

Browse files
authored
fix invertlut in some cases (#4373)
If the measurements filled the entire x range, we were not writing the final value. For example: ``` 2 2 0 0 1 1 ``` ``` $ vips invertlut linear.mat x2.v $ vips getpoint x2.v 255 0 -nan ``` With this PR you get 1, as expected.
1 parent 0bf64e9 commit 4531545

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- fill_nearest: fix a leak
2020
- colour: use suggested rendering intent as fallback [kleisauke]
2121
- morph: fix Orc path with large masks [kleisauke]
22+
- invertlut: fix final value in some cases
2223
- matrixload: fix file format detect for some matrix types
2324

2425
10/10/24 8.16.0

libvips/create/invertlut.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ vips_invertlut_build_create(VipsInvertlut *lut)
212212

213213
/* Interpolate the data sections.
214214
*/
215-
for (k = first; k < last; k++) {
215+
for (k = first; k <= last; k++) {
216216
/* Where we're at in the [0,1] range.
217217
*/
218218
double ki = (double) k / (lut->size - 1);

0 commit comments

Comments
 (0)