Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-r.b-one.net (mx-r.one.com [91.198.169.249])
	by mail9.b-one.net (Postfix) with ESMTP id B0906400400
	for <info@awaresystems.be>; Thu,  1 Apr 2010 23:25:26 +0200 (CEST)
Received: by mx-r.b-one.net (Postfix, from userid 106)
	id A7BED315ED80; Thu,  1 Apr 2010 23:25:26 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=4 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144]) by
 mx-r.b-one.net (Postfix) with ESMTP id BF717315ED80 for
 <info@awaresystems.be>; Thu,  1 Apr 2010 23:25:25 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by
 lists.maptools.org (Postfix) with ESMTP id 02CD71D18E55F; Thu,  1 Apr 2010
 16:22:31 -0500 (EST)
Received: from sasl.smtp.pobox.com (a-pb-sasl-quonix.pobox.com
 [208.72.237.25]) by lists.maptools.org (Postfix) with ESMTP id 7F4431D0E52B6
 for <tiff@lists.maptools.org>; Thu,  1 Apr 2010 16:12:59 -0500 (EST)
Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by
 a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 9867FA73CE for
 <tiff@lists.maptools.org>; Thu,  1 Apr 2010 17:12:54 -0400 (EDT)
Received: from a-pb-sasl-quonix. (unknown [127.0.0.1]) by
 a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 71A8EA73CD for
 <tiff@lists.maptools.org>; Thu,  1 Apr 2010 17:12:54 -0400 (EDT)
Received: from [192.168.2.11] (unknown [70.30.127.135]) (using TLSv1 with
 cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested)
 by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id 30DABA73CC for
 <tiff@lists.maptools.org>; Thu,  1 Apr 2010 17:12:54 -0400 (EDT)
Message-ID: <4BB50C55.3070109@pobox.com>
Date: Thu, 01 Apr 2010 17:12:53 -0400
From: Frank Warmerdam <warmerdam@pobox.com>
User-Agent: Thunderbird 2.0.0.6 (X11/20071022)
MIME-Version: 1.0
To: TIFF mailing list <tiff@lists.maptools.org>
X-Pobox-Relay-ID:
 5694673E-3DD3-11DF-84BB-D033EE7EF46B-06493634!a-pb-sasl-quonix.pobox.com
Subject: [Tiff] TIFFReadScanline and large compressed one-strip files
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
 <mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

Folks,

I have an LZW compressed TIFF file of 290MB or so with the whole image
in one strip.  Reading the file with the TIFFReadScanline() function causes
the entire 280MB of compressed data to be loaded into memory at the point
the first scanline is read.

My client is finding that in some cases on 32bit systems there isn't 290MB
of contiguous memory available and would like a way avoiding prereading the
whole strip.

Does anyone have any suggestions for this?

I see that currently TIFFReadScanline() calls TIFFSeek() which loads the
appropriate data into the working buffer.  I'm wondering if I could load
just part of the data into the raw buffer based on knowledge of what
scanline I want.  Perhaps loading enough raw data that I'm guaranteed to
satisfy all the raw data needed for one scanline (say 2*uncompressed size
plus 500 bytes).

I'm concerned that I would need to complicate the management of the currently
loaded raw data considerably to handle this sort of rolling buffering.  Does
it seem ill advised to even try?

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

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
