2021.04.18 15:57 "[Tiff] Scalar & SIMD optimization", by Larry Bank
Hi all. I'm new to this group and would like some feedback on a few ideas. Many years ago I wrote optimized codecs for all standard image compression types and recently decided to start sharing the code to the open source community. My first releases were for the embedded/Arduino community because I thought it would have the most impact:
https://github.com/bitbank2/JPEGDEC
https://github.com/bitbank2/AnimatedGIF
https://github.com/bitbank2/TIFF_G4
https://github.com/bitbank2/image_to_c
Then I saw the need to optimize open source libraries with a wider reach (e.g. giflib, libTIFF, libPNG). I created a much faster version of giflib:
https://github.com/bitbank2/giflib-turbo
After poking around libTIFF, it surprised me that no one had bothered to optimize certain parts with SIMD. SIMD optimization is even more important on the new Apple M1; the speed difference is tremendous.
I don't personally use libTIFF, libPNG, libjpeg or giflib because I wrote my own codecs. This is the basic problem with randomly optimizing other people's code. I don't have a personal stake in this work because I don't use it. This also complicates testing since I don't have any projects which depend on the code.
From my testing, my work can bring the following benefits to libTIFF:
- Faster CCITT G4 encoding (2-3x)
- Faster LZW decoding (1-20x depending on how compressed the data is. Well compressed data will decode much faster with my code)
- SIMD code for much faster prediction filters (e.g. 25-30% overall speedup for LZW encoding/decoding).
I have a full time job and a family, so free time is scarce. I'll help with optimization if there is a clear benefit to the community.
Finally... what I'm asking of this group is the following:
- Please point me to narrowly defined optimization tasks that bring the most benefit (e.g. 16-bit grayscale LZW decoding jobs for xxx community/group)
- I'm looking for some passive income through Github sponsors, so sponsorship would help justify spending time on a problem specific to libTIFF
- Volunteers to help test/integrate/design how SIMD code should be integrated into libTIFF since it apparently hasn't been done before
Thanks for listening,
Larry Bank