shrinkv: align chunking with shrinkh#4474
Conversation
|
FWIW, we could also experiment with doing --- a/libvips/resample/templates.h
+++ b/libvips/resample/templates.h
@@ -355,6 +355,14 @@ static double inline sinc_filter(double x)
using VipsFilterFn = double (*)(double);
+double inline box_filter(double x)
+{
+ if (x > -0.5 && x <= 0.5)
+ return 1.0;
+
+ return 0.0;
+}
+
template <VipsKernel K>
static double inline filter(double x);(untested) However, I'm not sure how much work this would require and whether it would be performance-neutral. |
2f33272 to
c965a14
Compare
|
I've found a solution that works for all these edge cases. $ vips black huge.png 30000 30000 --bands 4
$ /usr/bin/time -f %M:%e vipsthumbnail huge.png -o x.png --size 1x1
344000:2.92
$ vips black x.jpg 6000 6000 --bands 3
$ cat issue-3538.py
#!/usr/bin/env python3
import sys
import pyvips
image = pyvips.Image.new_from_file(sys.argv[1], access="sequential")
image = image.sharpen(sigma=8).resize(0.1)
image = image.copy_memory()
$ /usr/bin/time -f %M:%e ./issue-3538.py x.jpg
219252:4.25
$ vipsheader pexels-daniel-xavier-1239291.jpg
pexels-daniel-xavier-1239291.jpg: 6000x4000 uchar, 3 bands, srgb, jpegload
$ cat issue-3600.py
#!/usr/bin/env python3
import sys
import pyvips
image = pyvips.Image.new_from_file(sys.argv[1])
image = image.icc_transform("srgb", embedded=True)
image = image.rotate(1.4)
image = image.resize(float(sys.argv[2]))
image = image.copy_memory()
$ VIPS_CONCURRENCY=1 /usr/bin/time -f %M:%e ./issue-3600.py pexels-daniel-xavier-1239291.jpg 0.26
210344:0.71
$ VIPS_CONCURRENCY=1 /usr/bin/time -f %M:%e ./issue-3600.py pexels-daniel-xavier-1239291.jpg 0.24
209176:1.14Still marked as draft, as I also need to do some benchmarks with this PR. |
d4a7a9d to
044c4ae
Compare
044c4ae to
93cf3cd
Compare
|
Benchmark results for this PR are available at: On my AMD Ryzen 9 7900 workstation, it's approximately 2% - 6% slower than the This is ready for review now. |
|
Great! This seems to work well for me. I tried benchmarking against the slightly simpler version in 8.15 and there is a speed up for the C path (though it's not huge), so that's good. |
i.e. read up to 16 (i.e. fatstrip) scanlines at a time.
Resolves: #4170.