Add libdeflate support for accelerated (35-50%) internal libtiff ZIP/Deflate compression/decompression #3068
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The first commit improves the ZIP/Deflate codec of internal libtiff to be able to use libdeflate (https://github.com/ebiggers/libdeflate). It has been submitted to upstream libtiff (per https://gitlab.com/libtiff/libtiff/-/merge_requests/158), so ultimately the improvement will be available when using external libtiff as well.
It is accompanied by the needed changes in the GTiff driver, autotest and in the GDAL build system (autoconf/nmake) to be able to build against libdeflate.
So we can have 2 kind of builds with the Zip/Deflate codec:
Speed improvements in the 35%-50% range can be expected when libdeflate is used, that is when reading/writing a full tile or stip (which is the nominal situation for well behaved TIFF files). Compression level up to 12 is now supported (capped to 9 when zlib is used).
Still requires zlib for situations where libdeflate cannot be used (that is for scanline access, since libdeflate has no streaming mode)
Of course, deflate codestreams produced by libdeflate can be read by zlib, and vice-versa.
Funded by EOX and Safe software
The second commit adds usage of libdeflate to GDAL itself in the CPLZlibDeflate() and CPLZLibInflate() functions. So having an explicit GDAL libdeflate-enabled build is required to benefit from that, independently of the choice of internal vs external libtiff
Similarly to the libtiff case, zlib is still needed, since libdeflate cannot be always used. This could improve a bit the speed of the MVT and OSM PBF drivers (but probably not that much, at least for the OSM PBF case)