Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx9.public.one.com ([195.47.247.105])
	by mail6.local.one.com (Dovecot) with LMTP id tKkJGuYH5VhGIwAAsyOMew
	for <filtered@awaresystems.be>; Wed, 05 Apr 2017 15:52:16 +0000
X-HalOne-ID: d6634f2b-1a17-11e7-857d-246e961730ec
Received: from mail-oi0-f49.google.com (unknown [209.85.218.49])
	by mx9.public.one.com (Halon) with ESMTPS
	id d6634f2b-1a17-11e7-857d-246e961730ec;
	Wed, 05 Apr 2017 15:52:15 +0000 (UTC)
Received: by mail-oi0-f49.google.com with SMTP id f193so20231670oib.2
        for <filtered@awaresystems.be>; Wed, 05 Apr 2017 08:52:14 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-original-authentication-results:x-gm-message-state:delivered-to
         :from:to:thread-topic:thread-index:date:message-id:references
         :in-reply-to:accept-language:content-language:spamdiagnosticoutput
         :spamdiagnosticmetadata:mime-version:cc:subject:precedence:list-id
         :list-unsubscribe:list-archive:list-post:list-help:list-subscribe
         :mime-version:sender:errors-to;
        bh=1zcijW0F32XkQfS/V+2yyEPH1VjdUiRazbMpC4yuGJk=;
        b=SLPLi01yv2piFQIxzXh36ZFzcyhLmbfntW8TPEqtwLC/0evvoH3HxjoP1d+CjHcDp3
         DLv7SyPJ0LJB40JgrzVGe2PGrLew/7iLVWpkQBOFTJ5WpHDLjYwUtRvlAr7qSDT8ninI
         Z2YMdQHrNDD0/D5yP5Ky8n/53dBITC6lpV0Bnbn05Xqa2kZZdbGyfuc+MxODD4Y36/Yt
         N/Qq897QGdr/WtDkzLY9EdZlUuM1YS7r+NfmG6e/s/gc1cadtfU23j0YLnXFbk5Aa9QK
         bkhhoY80E1C45M3sq32pK8M4JAuf+qD+6JtvH2SpzB8mWIVuvLqyD4J0VFjWnMX3EFyR
         lsJg==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org;       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=msn.com
X-Gm-Message-State: AFeK/H1p56SA5DxG26WHd/ggd+nN/HWUdkKsso71dnpelKKJHSkX+uqKttFM+j2H3ERbPRq+38Nx2S4yVfJBYHhApYXXmto=
X-Received: by 10.202.236.203 with SMTP id k194mr14196666oih.133.1491407533612;
        Wed, 05 Apr 2017 08:52:13 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.202.168.9 with SMTP id r9csp295110oie;
        Wed, 5 Apr 2017 08:52:12 -0700 (PDT)
X-Received: by 10.223.139.30 with SMTP id n30mr26813642wra.86.1491407532268;
        Wed, 05 Apr 2017 08:52:12 -0700 (PDT)
Return-Path: <tiff-bounces@lists.maptools.org>
Received: from lists.maptools.org (ks365428.kimsufi.com. [94.23.4.142])
        by mx.google.com with ESMTP id z9si23096778wra.264.2017.04.05.08.52.09;
        Wed, 05 Apr 2017 08:52:12 -0700 (PDT)
Received-SPF: neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=94.23.4.142;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 94.23.4.142 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) smtp.mailfrom=tiff-bounces@lists.maptools.org;
       dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=msn.com
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id D159E35C03F;
	Wed,  5 Apr 2017 10:51:08 -0500 (EST)
Received: from NAM03-DM3-obe.outbound.protection.outlook.com
	(mail-oln040092008031.outbound.protection.outlook.com [40.92.8.31])
	by lists.maptools.org (Postfix) with ESMTPS id 6D43C35C025
	for <tiff@lists.maptools.org>; Wed,  5 Apr 2017 10:50:51 -0500 (EST)
Received: from BY2NAM03FT053.eop-NAM03.prod.protection.outlook.com
	(10.152.84.52) by BY2NAM03HT239.eop-NAM03.prod.protection.outlook.com
	(10.152.85.254) with Microsoft SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.1019.14;
	Wed, 5 Apr 2017 15:50:49 +0000
Received: from MWHPR19MB1181.namprd19.prod.outlook.com (10.152.84.52) by
	BY2NAM03FT053.mail.protection.outlook.com (10.152.84.186) with
	Microsoft SMTP Server (version=TLS1_2,
	cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id
	15.1.1019.14 via Frontend Transport; Wed, 5 Apr 2017 15:50:49 +0000
Received: from MWHPR19MB1181.namprd19.prod.outlook.com ([10.175.7.140]) by
	MWHPR19MB1181.namprd19.prod.outlook.com ([10.175.7.140]) with mapi id
	15.01.1005.019; Wed, 5 Apr 2017 15:50:49 +0000
From: Charles Auer <Bumble731@msn.com>
To: Dinesh Iyer <dsi.maillist@gmail.com>, Bob Friesenhahn
	<bfriesen@simple.dallas.tx.us>
Thread-Topic: [Tiff] Reading images with bits per pixel not a multiple of 8
Thread-Index: AQHSrJy8jwjvePnpA06FNS4/tdt0UaGz7GCAgAAOkACAAAD5gIABQouAgAGvR6s=
Date: Wed, 5 Apr 2017 15:50:48 +0000
Message-ID: <MWHPR19MB11819516CE1422376FA88C4EE10A0@MWHPR19MB1181.namprd19.prod.outlook.com>
References: <CAHcSuBrMiYmF=OW9T-UyAYcLdYudzYP-pRuCXSy_8VcAfGReQw@mail.gmail.com>
	<alpine.GSO.2.20.1704031245250.13187@scrappy.simplesystems.org>
	<fa9c07e3-d044-b1df-2ef5-fee8c4b18bc5@codelibre.net>
	<alpine.GSO.2.20.1704031344400.13187@scrappy.simplesystems.org>,
	<CAHcSuBqNMoupf76Vh0OV-9Qp4bTY06JJfNv_yLhoeXYY-VAYQA@mail.gmail.com>
In-Reply-To: <CAHcSuBqNMoupf76Vh0OV-9Qp4bTY06JJfNv_yLhoeXYY-VAYQA@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
authentication-results: lists.maptools.org; dkim=none (message not signed)
	header.d=none; lists.maptools.org;
	dmarc=none action=none header.from=msn.com; 
x-incomingtopheadermarker: OriginalChecksum:9B926DC066482743CE7E010D25143B88001C3088916B4D4D920DF6F9B49F8666;
	UpperCasedChecksum:B7B86C3721779F6AAA971925B5878D51651DD1A901C357DC17CC7402B8D11F7C;
	SizeAsReceived:8459; Count:42
x-tmn: [SPahmz0Gsvg4v1KXflOldpFZNLWY/4QC]
x-microsoft-exchange-diagnostics: 1; BY2NAM03HT239;
	5:J74+8jAVDWuPsswKvBv8eABgsOVn2Zb4YwQWOAek+NAmGv3Tc8F8OuuITs+IIPpTSuku8EqNDBrEWoZJryFr+EF9pPaG2g/2QxIRPSAj9VCuknRRSGYx8rVLC7q5Uyd9fgGl7fNAxlI2l1o5EAgYbA==;
	24:O/IBnV/65SrvrpVBUuP7TTnBLebKTdvnEn5iNsWoWODtDLoBIQozBDRz/N2g6CWF16fnEYVaE8cZnHlKMGkXge9vW9zKJH22qhJ12KDSWB8=;
	7:4p5P2QzezlKarxTuZ1eViFSYnxh6Rz0+p0zSTGML9rC9si+RTj4szpym8t63NythucxsNBj6dGD29MK6a7vKjTd9kK4Y1knBS9ZYjmbqYsbpvWcOMbTsboTV5aJtNlaAoNotL2sQpH9Hjj3kTi+Hl/ndrlPeuQt0IEiR26k1xM2gXGcN9DiioZ7Epi94tVOyPlQUSAkon1K1D6XunKt7UoRw/rPWg6vNdaMXkHV0/VXtFfkYNhiRUlHdesNZSAyEQYbHZKkwzEzru/yOSsv8/0WNaaUINI77ZNvpZDeR+Hrz4qqfqzgBS1t65GPYmTxY
x-incomingheadercount: 42
x-eopattributedmessage: 0
x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(7070007)(98901004);
	DIR:OUT; SFP:1901; SCL:1; SRVR:BY2NAM03HT239;
	H:MWHPR19MB1181.namprd19.prod.outlook.com; FPR:; SPF:None;
	LANG:en; 
x-ms-office365-filtering-correlation-id: b93d5685-5d00-4ebb-cce0-08d47c3b87ef
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
	RULEID:(22001)(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031322274)(1601125374)(1603101448)(1701031045);
	SRVR:BY2NAM03HT239; 
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031);
	SRVR:BY2NAM03HT239; BCL:0; PCL:0; RULEID:; SRVR:BY2NAM03HT239; 
x-forefront-prvs: 0268246AE7
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
MIME-Version: 1.0
X-OriginatorOrg: outlook.com
X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Apr 2017 15:50:48.9775 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Internet
X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa
X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2NAM03HT239
Cc: TIFF mailing list <tiff@lists.maptools.org>
Subject: Re: [Tiff] Reading images with bits per pixel not a multiple of 8
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: multipart/mixed; boundary="===============0374770203=="
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

--===============0374770203==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_MWHPR19MB11819516CE1422376FA88C4EE10A0MWHPR19MB1181namp_"

--_000_MWHPR19MB11819516CE1422376FA88C4EE10A0MWHPR19MB1181namp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

TIFFIsByteSwapped returns a non-zero value if the image data was in a diffe=
rent byte-order than the host machine. Zero is returned if the TIFF file an=
d local host byte-orders are the same. Note that TIFFReadTile(), TIFFReadSt=
rip() and TIFFReadScanline() functions already normally perform byte swappi=
ng to local host order if needed.

.

I'm not sure if this is helpful.

.




________________________________
From: tiff-bounces@lists.maptools.org <tiff-bounces@lists.maptools.org> on =
behalf of Dinesh Iyer <dsi.maillist@gmail.com>
Sent: Tuesday, April 4, 2017 2:00 PM
To: Bob Friesenhahn
Cc: TIFF mailing list
Subject: Re: [Tiff] Reading images with bits per pixel not a multiple of 8

Currently, in my code, when I read 16-bit images, I just treat the buffer r=
eturned by TiffReadEncodedStrip as uint16_T and read the data. It appears t=
hat is incorrect because it will give the wrong result for big-endian files=
. Am I correct?

Regards,
Dinesh

On Mon, Apr 3, 2017 at 2:46 PM, Bob Friesenhahn <bfriesen@simple.dallas.tx.=
us<mailto:bfriesen@simple.dallas.tx.us>> wrote:
On Mon, 3 Apr 2017, Roger Leigh wrote:
>>
>> Except for depths 8, 16, and 24 (which are swapped to "native"
>> endianness by libtiff), the data is always ordered in
>> most-significant-bit order
>> so you need to start with the top bits.
>
> What about 32, 48 and 64 bit variants which are all multiples of these
> specially handled sizes?
>
> Just wondering because I am not currently doing any special case
> handling for 32-bit and higher sizes.

You are correct.  I should have mentioned 32 and 64 bit sizes as well.
I am not sure about 48.

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us<mailto:bfriesen@simple.dallas.tx.us>, http://w=
ww.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org<mailto:Tiff@lists.maptools.org>
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/


--_000_MWHPR19MB11819516CE1422376FA88C4EE10A0MWHPR19MB1181namp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=
n-bottom:0;} --></style>
</head>
<body dir=3D"ltr">
<div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font=
-family:Calibri,Arial,Helvetica,sans-serif;" dir=3D"ltr">
<p><i style=3D"color: rgb(68, 68, 68); font-family: verdana, helvetica, ari=
al, sans-serif; font-size: 16px; background-color: rgb(238, 238, 238);">TIF=
FIsByteSwapped</i><span style=3D"color: rgb(68, 68, 68); font-family: verda=
na, helvetica, arial, sans-serif; font-size: 16px; background-color: rgb(23=
8, 238, 238);">&nbsp;returns
 a non-zero value if the image data was in a different byte-order than the =
host machine. Zero is returned if the TIFF file and local host byte-orders =
are the same. Note that TIFFReadTile(), TIFFReadStrip() and TIFFReadScanlin=
e() functions already normally perform
 byte swapping to local host order if needed.</span><br>
</p>
<p><span style=3D"color: rgb(68, 68, 68); font-family: verdana, helvetica, =
arial, sans-serif; font-size: 16px; background-color: rgb(238, 238, 238);">=
.</span></p>
<p><span style=3D"color: rgb(68, 68, 68); font-family: verdana, helvetica, =
arial, sans-serif; font-size: 16px; background-color: rgb(238, 238, 238);">=
I'm not sure if this is helpful.</span></p>
<p><span style=3D"color: rgb(68, 68, 68); font-family: verdana, helvetica, =
arial, sans-serif; font-size: 16px; background-color: rgb(238, 238, 238);">=
.</span></p>
<p><span style=3D"color: rgb(68, 68, 68); font-family: verdana, helvetica, =
arial, sans-serif; font-size: 16px; background-color: rgb(238, 238, 238);">=
<br>
</span></p>
<p><span style=3D"color: rgb(68, 68, 68); font-family: verdana, helvetica, =
arial, sans-serif; font-size: 16px; background-color: rgb(238, 238, 238);">=
<br>
</span></p>
<br>
<br>
<div style=3D"color: rgb(0, 0, 0);">
<hr tabindex=3D"-1" style=3D"display:inline-block; width:98%">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" co=
lor=3D"#000000" style=3D"font-size:11pt"><b>From:</b> tiff-bounces@lists.ma=
ptools.org &lt;tiff-bounces@lists.maptools.org&gt; on behalf of Dinesh Iyer=
 &lt;dsi.maillist@gmail.com&gt;<br>
<b>Sent:</b> Tuesday, April 4, 2017 2:00 PM<br>
<b>To:</b> Bob Friesenhahn<br>
<b>Cc:</b> TIFF mailing list<br>
<b>Subject:</b> Re: [Tiff] Reading images with bits per pixel not a multipl=
e of 8</font>
<div>&nbsp;</div>
</div>
<div>
<div dir=3D"ltr">Currently, in my code, when I read 16-bit images, I just t=
reat the buffer returned by TiffReadEncodedStrip as uint16_T and read the d=
ata. It appears that is incorrect because it will give the wrong result for=
 big-endian files. Am I correct?
<div><br>
</div>
<div>Regards,</div>
<div>Dinesh</div>
</div>
<div class=3D"gmail_extra"><br>
<div class=3D"gmail_quote">On Mon, Apr 3, 2017 at 2:46 PM, Bob Friesenhahn =
<span dir=3D"ltr">
&lt;<a href=3D"mailto:bfriesen@simple.dallas.tx.us" target=3D"_blank">bfrie=
sen@simple.dallas.tx.us</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex; border-left:1=
px #ccc solid; padding-left:1ex">
<span class=3D"">On Mon, 3 Apr 2017, Roger Leigh wrote:<br>
&gt;&gt;<br>
&gt;&gt; Except for depths 8, 16, and 24 (which are swapped to &quot;native=
&quot;<br>
&gt;&gt; endianness by libtiff), the data is always ordered in<br>
&gt;&gt; most-significant-bit order<br>
&gt;&gt; so you need to start with the top bits.<br>
&gt;<br>
&gt; What about 32, 48 and 64 bit variants which are all multiples of these=
<br>
&gt; specially handled sizes?<br>
&gt;<br>
&gt; Just wondering because I am not currently doing any special case<br>
&gt; handling for 32-bit and higher sizes.<br>
<br>
</span>You are correct.&nbsp; I should have mentioned 32 and 64 bit sizes a=
s well.<br>
I am not sure about 48.<br>
<span class=3D"im HOEnZb"><br>
Bob<br>
--<br>
Bob Friesenhahn<br>
<a href=3D"mailto:bfriesen@simple.dallas.tx.us">bfriesen@simple.dallas.tx.u=
s</a>, <a href=3D"http://www.simplesystems.org/users/bfriesen/" rel=3D"nore=
ferrer" target=3D"_blank">
http://www.simplesystems.org/<wbr>users/bfriesen/</a><br>
GraphicsMagick Maintainer,&nbsp; &nbsp; <a href=3D"http://www.GraphicsMagic=
k.org/" rel=3D"noreferrer" target=3D"_blank">
http://www.GraphicsMagick.org/</a><br>
</span>
<div class=3D"HOEnZb">
<div class=3D"h5">______________________________<wbr>_________________<br>
Tiff mailing list: <a href=3D"mailto:Tiff@lists.maptools.org">Tiff@lists.ma=
ptools.org</a><br>
<a href=3D"http://lists.maptools.org/mailman/listinfo/tiff" rel=3D"noreferr=
er" target=3D"_blank">http://lists.maptools.org/<wbr>mailman/listinfo/tiff<=
/a><br>
<a href=3D"http://www.remotesensing.org/libtiff/" rel=3D"noreferrer" target=
=3D"_blank">http://www.remotesensing.org/<wbr>libtiff/</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</body>
</html>

--_000_MWHPR19MB11819516CE1422376FA88C4EE10A0MWHPR19MB1181namp_--

--===============0374770203==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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