2006.02.02 15:29 "Re: [Tiff] Fastest method to load tiff files?", by Edward Lam
Thanks for the tips. I'll keep those in mind. I'm primarily dealing with either stripped or tiled images. The images range from 8 to 32 bits per sample (ie. 32-bit floats). I was hoping someone would have gone down this route and knew which interface one should be using. Currently, we're using the TIFFReadEncodedStrip() and TIFFReadEncodedTile() interface. If the image has interleaved data, we de-interleave it ourselves.
Pallek, Bernie: #CIPO - OPIC wrote:
The answer depends a little on what kind of TIFFs you'll be reading. If black and white, you'll find a nice example here:
- write several versions of your routines, using different strategies/ideas
- profile your code, and see where your bottlenecks are; if your code is slow, you can improve it -- if they are in libtiff itself, you're done
- always try to pre-compute the final memory requirements so you can allocate all at once (superfluous memory management can waste time)
- if you know certain things about types of images, and those types of images will always be used, you can optimize for them, although that would generally require tuning of the actual library, not the code that uses it (for instance, if it's a given that the images are always equal to or small than a certain size, you can allocate one buffer for that (maximum) size, and keep re-using that buffer, instead of allocating and de-allocating for each image in a batch -- realize, though, that the gains are likely to be marginal)
- if you really need that extra little bit of speed, you might be able to recompile libtiff with tweaked build settings for your target platform (consider things like byte-alignment, etc)
> -----Original Message-----
> [mailto:firstname.lastname@example.org]On Behalf Of Edward Lam
> Sent: Thursday, February 2, 2006 9:34 AM
> To: email@example.com
> Subject: [Tiff] Fastest method to load tiff files?
>> Tiff mailing list: Tiff@lists.maptools.org