Return-Path: <tiff-bounces@remotesensing.org>
Received: from inmx018.isp.belgacom.be (inmx018.isp.belgacom.be [195.238.2.79])
        by mailst035.isp.belgacom.be (8.12.11/8.12.11/Skynet-MAILSTORE-2.14) with ESMTP id j2MKdTNm002304
        for <joris.at.lebbeke@skynet.be>; Tue, 22 Mar 2005 21:39:30 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from xserve.flids.com (adsl-065-083-169-202.sip.mco.bellsouth.net [65.83.169.202])
        by inmx018.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id j2MKdD4P002121
        for <joris.at.lebbeke@skynet.be>; Tue, 22 Mar 2005 21:39:16 +0100
        (envelope-from <tiff-bounces@remotesensing.org>)
Received: from adsl-065-083-169-202.sip.mco.bellsouth.net (localhost [127.0.0.1])
	by xserve.flids.com (Postfix) with ESMTP
	id E95651721A56; Tue, 22 Mar 2005 15:38:51 -0500 (EST)
X-Original-To: tiff@remotesensing.org
Delivered-To: tiff@remotesensing.org
Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.205])
	by xserve.flids.com (Postfix) with ESMTP id EB0021721A46
	for <tiff@remotesensing.org>; Tue, 22 Mar 2005 15:38:49 -0500 (EST)
Received: by wproxy.gmail.com with SMTP id 69so934080wra
	for <tiff@remotesensing.org>; Tue, 22 Mar 2005 12:38:49 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references;
	b=bhCrskX42o7nw4Qd5OCMA1fvy/gqsZOoPg+BZOyt68sYy+6dOKHT32Nt/sIRxGEYj71H1bWv5T/pYyLo8kdo4F1Ev19ZfsSJ3l8SRscCEvqWUfRoGIY6qWyokjGGBqchPNHTD2F2qU8ZTzcys1WpaMFouZLsLwU0mArv9ZWTR9w=
Received: by 10.54.96.9 with SMTP id t9mr217921wrb;
	Tue, 22 Mar 2005 12:38:49 -0800 (PST)
Received: by 10.54.13.2 with HTTP; Tue, 22 Mar 2005 12:38:49 -0800 (PST)
Message-ID: <931f8ea905032212387b9513e1@mail.gmail.com>
Date: Tue, 22 Mar 2005 15:38:49 -0500
From: Frank Warmerdam <fwarmerdam@gmail.com>
To: Bob Friesenhahn <bfriesen@simple.dallas.tx.us>
Subject: Re: [Tiff] tif_jpeg.c and 12bit JPEG Files
In-Reply-To: <Pine.SOC.4.60.0503221407310.8945@blade.simplesystems.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
References: <931f8ea905032209207728feb5@mail.gmail.com>
	<Pine.SOC.4.60.0503221158080.8945@blade.simplesystems.org>
	<931f8ea905032210105f1486b1@mail.gmail.com>
	<Pine.SOC.4.60.0503221217560.8945@blade.simplesystems.org>
	<16960.28021.4204.14634@canoe.dclg.ca>
	<Pine.SOC.4.60.0503221407310.8945@blade.simplesystems.org>
Cc: libtiff-Mailinglist <tiff@remotesensing.org>,
        David Gilbert <dgilbert@dclg.ca>
X-BeenThere: tiff@remotesensing.org
X-Mailman-Version: 2.1.2
Precedence: list
Reply-To: warmerdam@pobox.com
List-Id: TIFF and libtiff discussion  <tiff.remotesensing.org>
List-Unsubscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=unsubscribe>
List-Archive: <http://xserve.flids.com/pipermail/tiff>
List-Post: <mailto:tiff@remotesensing.org>
List-Help: <mailto:tiff-request@remotesensing.org?subject=help>
List-Subscribe: <http://xserve.flids.com/mailman/listinfo/tiff>,
	<mailto:tiff-request@remotesensing.org?subject=subscribe>
Sender: tiff-bounces@remotesensing.org
Errors-To: tiff-bounces@remotesensing.org
X-UIDL: 65af6a1af028eadea1d70177b2a90839

On Tue, 22 Mar 2005 14:25:45 -0600 (CST), Bob Friesenhahn
<bfriesen@simple.dallas.tx.us> wrote:
> On Tue, 22 Mar 2005, David Gilbert wrote:
> This is not really compatible with the way the libtiff interfaces
> work.  Libtiff normally provides the data as a scanline, strip, or
> tile where the bits-per-sample of the data is the same as reported by
> libtiff, and the values occupy the full range of the sample.  As part
> of the "decompress" step, the data should be converted to packed
> 12-bit form.  This can easily be done "in-place" if necessary while
> reading since 12-bits is smaller than 16-bits.  A secondary buffer
> would be needed while writing.

Bob, 

I have modified the JPEGDecode in tif_jpeg.c to take care of
repacking the 16bit data into 12bit packed format.  BTW, the
changes are now all committed in tif_jpeg.c in the CVS head
for libtiff for use with the Mk1 libjpeg. 

> In order to make 12-bit JPEG in TIFF available to a broader variety of
> applications, an option could be provided via a virtual tag (similar
> to that used by the LogLuv support) to set libtiff in a mode where
> 12-bit JPEG in TIFF pretends to be a 16-bit format.  12-bit JPEG in
> TIFF files would be reported as 16-bits/sample.  In this case the
> samples should be scaled to 16-bits.  The only change necessary for
> applications already supporting 16-bit TIFF is to set the option
> requesting that 12-bit TIFF be supported like 16-bit TIFF.

While I agree this would be desirable (auto-upgrade to 16bit), 
I am not personally keen to try and implement it.  It might be
fairly challenging to do properly without any adverse effects.

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@remotesensing.org
http://xserve.flids.com/mailman/listinfo/tiff
