AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
April 2005

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2005.04.11 07:38 "TIFF_MAPPED", by Katrina Maramba
2005.04.11 14:17 "Re: TIFF_MAPPED", by Bob Friesenhahn

2005.04.11 14:17 "Re: TIFF_MAPPED", by Bob Friesenhahn

On Mon, 11 Apr 2005, katrina maramba wrote:
>
> 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/