Return-Path: owner-tiff@olympiakos.com
Return-Path: <owner-tiff@olympiakos.com>
Received: from localhost (localhost [127.0.0.1])
	by at1895.spb.edu (8.12.0.Beta7/8.12.0.Beta7) with ESMTP id f43AbOGJ007679
	for <dron@localhost>; Thu, 3 May 2001 14:46:19 +0400
Received: from eudoramail.com [209.185.123.45]
	by localhost with POP3 (fetchmail-5.8.1)
	for dron@localhost (single-drop); Thu, 03 May 2001 14:46:19 +0400 (MSD)
Received: from gate7.olympiakos.com ([207.176.88.85]) by shared1-mail.whowhere.com; Wed May  2 13:08:54 2001
Received: from localhost (daemon@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) with SMTP id PAA11229;
	Wed, 2 May 2001 15:51:29 -0400
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Wed, 2 May 2001 15:51:08 -0400
Received: (from majordom@localhost)
	by gate7.olympiakos.com (8.9.3/8.9.3) id PAA11184
	for tiff-outgoing; Wed, 2 May 2001 15:51:08 -0400
X-Authentication-Warning: gate7.olympiakos.com: majordom set sender to owner-tiff@olympiakos.com using -f
Received: from spitfire.velocet.net (spitfire.velocet.net [209.167.225.66])
	by gate7.olympiakos.com (8.9.3/8.9.3) with ESMTP id PAA11173
	for <tiff@olympiakos.com>; Wed, 2 May 2001 15:51:05 -0400
Received: from pobox.com (H14.C198.tor.velocet.net [216.138.198.14])
	by spitfire.velocet.net (Postfix) with ESMTP
	id 9FE5019A13A; Wed,  2 May 2001 15:51:02 -0400 (EDT)
Message-ID: <3AF0643C.C880E3C@pobox.com>
Date: Wed, 02 May 2001 15:47:08 -0400
From: Frank Warmerdam <warmerdam@pobox.com>
Reply-To: warmerdam@pobox.com
X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14 i586)
X-Accept-Language: en
MIME-Version: 1.0
To: "Michael O'Rourke" <morourke@Adobe.COM>
Cc: tiff@olympiakos.com
Subject: Re: TIFFSetDirectory speed?
References: <IJEEKGEBDCHCGMJDLMHHEEOPCHAA.morourke@adobe.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-tiff@olympiakos.com
Status: RO
Content-Length: 1149
Lines: 25

Michael O'Rourke wrote:
> 
> How costly is it to set the directory in say a 5,000 page TIFF file? For
> instance, if I want to go to page 4,000 can libtiff easily jump there or
> does it actually have to read the previous 3,999 pages to get to page 4,000?

Michael,

You can go directly to a TIFF direct using TIFFSetSubDirectory() if
you know the byte offset.  However, if all you have is the page number
you will need to use TIFFSetDirectory().  

Luckily TIFFSetDirectory() appears to just read minimal information from
each intermediate directory as it searches for the target directory.  It
particular it only parses all the tags in the directory once it finds the
directory it wants.  But it would generally do 5000 disk seeks and reads
which could be quite expensive if the directories are distributed widely
through the file. 

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

