2017.02.06 23:59 "Re: [Tiff] Qs about support for more than 2^16 IFDs and writing performance", by Paavo Helde
Hi, I can comment from the viewpoint of just another user of libtiff. I have seen the slowdown myself (with ca 10,000 IFD-s) and profiled the cause to be the TIFFLinkDirectory() function which traverses the whole file again and again when adding new IFD-s.
Some kind of caching is needed for avoiding this traversal, but not sure if the approach demonstrated by this patch is the best one. It also contains modification of TIF (e.g. tif->tif_dirnumber++;) in a function called "Check" which is smelly.
The patch does not address the 65535 IFD limit problem (for solving that it looks like one needs to add a bunch of new libtiff functions for directories as the existing ones are defined in terms of uint16).
On 6.02.2017 22:43, Dinesh Iyer wrote:
I am developing an application that uses libTIFF for reading/writing TIFF files and I have the following questions about libTIFF. I apologize in advance if these questions have been asked but I could not find answers to them in the archive.
- I noticed that libTIFF does not support reading images from TIFF files as IFD's greater than 65535. The TIFF specification does not appear to impose such a limit but libTIFF does. I have a few clients who have 100,000 image TIFF stacks that they would like to be able to read.
- I noticed that libTIFF does appear to support writing > 65536 images into a TIFF file. Is this the expected behaviour or an over-sight?
- Lastly, when i tested writing a large number of images into a TIFF file, I found that the performance was very slow. It took ~2.5 hrs to write 66200 images, each of size just 64x64. I came across this github post: https://github.com/escabe/libtiff/commit/58b4c3ba4478987ecfe1e793b9d925e59eecfa36
- about why the performance is poor and a possible fix for this. Is this patch recommended?
- Are there plans to limit the 65536 IFD restriction for TIFF files and also improve the writing performance anytime soon? Or is the recommendation to patch my local copy of the TIFF library?