Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas014.isp.belgacom.be (localhost [127.0.0.1])
        by inav027.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k1L5vGVr007007
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Feb 2006 06:57:16 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx006.isp.belgacom.be (inmx006.isp.belgacom.be [195.238.4.106])
        by inas014.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k1L5vDGb020713
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Feb 2006 06:57:15 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx006.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id k1L5v5uu007890
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Feb 2006 06:57:05 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k1L5rbJY001348;
	Tue, 21 Feb 2006 00:53:55 -0500
Received: from outmx017.isp.belgacom.be (outmx017.isp.belgacom.be
	[195.238.4.116])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k1L5rabb001345
	for <tiff@lists.maptools.org>; Tue, 21 Feb 2006 00:53:36 -0500
Received: from outmx017.isp.belgacom.be (localhost [127.0.0.1])
	by outmx017.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with
	ESMTP id k1L5rSYW006030
	for <tiff@lists.maptools.org>; Tue, 21 Feb 2006 06:53:28 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Received: from dfgrrxsknr4e (13-144.246.81.adsl.skynet.be [81.246.144.13])
	by outmx017.isp.belgacom.be (8.12.11/8.12.11/Skynet-OUT-2.22) with SMTP
	id k1L5rOsC006001; Tue, 21 Feb 2006 06:53:24 +0100
	(envelope-from <joris.at.lebbeke@skynet.be>)
Message-ID: <004101c636ab$3a8a5690$0d90f651@dfgrrxsknr4e>
From: "Joris" <joris.at.lebbeke@skynet.be>
To: "Benares" <benarestham@gmail.com>,
        "TIFF mailing list" <tiff@lists.maptools.org>
References: <9e46d1bb0602192354k39768df3tb290d0a5fa8bf59f@mail.gmail.com>
Subject: Re: [Tiff] TIFFReadScanline query
Date: Tue, 21 Feb 2006 06:54:05 +0100
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2800.1506
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
Cc: 
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
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>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
Content-Transfer-Encoding: quoted-printable
X-MIME-Autoconverted: from 8bit to quoted-printable by inav027.isp.belgacom.be id k1L5vGVr007007
X-UIDL: 000000000023ceae.0000130f
X-MSP-STORE: Tue, 21 Feb 2006 06:57:20 +0100
Status:   

Benares,

I can't seem to get my head around why you get the results you do, given
the code (and bug) that you've quoted, or not entirely anyway, but maybe
that's just lack of caffe=EFne... In any case, there is a bug in the code
you've quoted.

- Your basic problem is that you're not dealing with bytes given to you
in line_buffer, but are indexing uint32 values in that buffer instead.
So declare line_buffer to be an uint8*, or equivalent (you C guys custom
redefining basic types all the time, it's hard to tell how to properly
name a simple pointer to a byte). The rest of your code seems designed
fine on the condition that you declare line_buffer to be an uint8*
instead.
- Allocate only ScanlineSize bytes for line_buffer, not
ScanlineSize*sizeof(uint32). (But cure above problem first, or you'll
have an access violation on your hands.)
- How can you be sure a<<8<<8 equals (a<<8)<<8? It seems that way, from
the results you get, I think, but how you C guys manage to keep track of
the priority of your set of thousands of such operations, and know for
sure such stuff doesn't instead  equal a<<(8<<8) is beyond me.

As to your input file itself, it's monstorous. The very much invalid
flawed content of Kodak DC290 files has been described on the list
before (see http://www.asmail.be/msg0054881737.html). I've
double-checked, and your input file seems to follow that same layout.


Joris Van Damme
info@awaresystems.be
http://www.awaresystems.be/
Download your free TIFF tag viewer for windows here:
http://www.awaresystems.be/imaging/tiff/astifftagviewer.html

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