AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2005.03.15 11:58 "[Tiff] QT and libtiff helpp", by Oral DALAY
2005.03.15 12:16 "Re: [Tiff] QT and libtiff helpp", by Andrey Kiselev
2005.04.11 07:38 "[Tiff] TIFF_MAPPED", by katrina maramba
2005.04.11 14:17 "Re: [Tiff] TIFF_MAPPED", by Bob Friesenhahn
2005.04.13 01:58 "[Tiff] Baseline TIFF Reader", by katrina maramba
2005.04.13 03:17 "Re: [Tiff] Baseline TIFF Reader", by Bob Friesenhahn

2005.04.11 14:17 "Re: [Tiff] TIFF_MAPPED", by Bob Friesenhahn

Can anybody tell me what the TIFF_MAPPED macro means? It's comment says "file is mapped into memory". What does this mean? When can I have a 'memory mapped file'?

Libtiff normally memory maps input files on platforms where it makes sense. You can re-inforce your desire for memory-mapped input by adding 'M' to the TIFFOpen() option string, or prevent it by adding 'm' to the option string.

You can gain a bit more control over what libtiff does by using TIFFClientOpen() to define the I/O functions it should use. One of these functions is to memory map the file.

Please note that libtiff memory maps the entire file. It does not attempt to do any "windowing" on the memory mapping. This means if the input TIFF file is larger than the available process address space, the mapping will fail.

         /*
          * Setup initial directory.
          */
         switch (mode[0]) {
         case 'r':

                 tif->tif_nextdiroff = tif->tif_header.tiff_diroff;
                 /*
                  * Try to use a memory-mapped file if the client
                  * has not explicitly suppressed usage with the
                  * 'm' flag in the open mode (see above).
                  */

                 if ((tif->tif_flags & TIFF_MAPPED) &&
         !TIFFMapFileContents(tif, (tdata_t*) &tif->tif_base, &tif->tif_size))
                         tif->tif_flags &= ~TIFF_MAPPED;
                 if (TIFFReadDirectory(tif)) {
                         tif->tif_rawcc = -1;
                         tif->tif_flags |= TIFF_BUFFERSETUP;
                         return (tif);
                 }
                 break;

Bob
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/