Return-Path: <owner-tiff@olympiakos.com>
Received: from localhost (ak4719.spb.edu [127.0.0.1])
	by ak4719.spb.edu (8.12.1/8.12.1/Debian -5) with ESMTP id h44CUI4g007203
	for <dron@localhost>; Sun, 4 May 2003 16:32:04 +0400
Received: from pop.in02.prd.whowhere.com [209.202.220.196]
	by localhost with POP3 (fetchmail-6.2.0)
	for dron@localhost (single-drop); Sun, 04 May 2003 16:32:04 +0400 (MSD)
Received: from gate7.olympiakos.com ([64.32.199.150]) by whowhere.com; Wed, 30 Apr 2003 15:23:01 -0000
X-Envelope-Sender: owner-tiff@olympiakos.com
Received: by gate7.olympiakos.com (Postfix, from userid 65534)
	id 6DC84110F7; Wed, 30 Apr 2003 11:20:28 -0400 (EDT)
Received: from localhost (localhost [127.0.0.1])
	by gate7.olympiakos.com (Postfix) with SMTP
	id 485A1110F3; Wed, 30 Apr 2003 11:20:28 -0400 (EDT)
Received: by gate7.olympiakos.com (bulk_mailer v1.9); Wed, 30 Apr 2003 11:20:07 -0400
Delivered-To: tiff-outgoing@gate7.olympiakos.com
Received: by gate7.olympiakos.com (Postfix, from userid 16)
	id 596E91108E; Wed, 30 Apr 2003 11:20:07 -0400 (EDT)
Delivered-To: tiff@olympiakos.com
Received: from motgate4.mot.com (motgate4.mot.com [144.189.100.102])
	by gate7.olympiakos.com (Postfix) with ESMTP id 13F411108E
	for <tiff@olympiakos.com>; Wed, 30 Apr 2003 11:20:06 -0400 (EDT)
Received: from az33exr01.mot.com (az33exr01.mot.com [10.64.251.231])
	by motgate4.mot.com (Motorola/Motgate4) with ESMTP id h3UFK5c9002340
	for <tiff@olympiakos.com>; Wed, 30 Apr 2003 08:20:05 -0700 (MST)
Received: from zei02exm02.cork.cig.mot.com ([10.131.7.12])
	by az33exr01.mot.com (Motorola/az33exr01) with ESMTP id h3UFJxCR026668
	for <tiff@olympiakos.com>; Wed, 30 Apr 2003 10:20:00 -0500
Received: by zei02exm02.cork.cig.mot.com with Internet Mail Service (5.5.2656.59)
	id <GTG9LQYW>; Wed, 30 Apr 2003 16:19:58 +0100
Message-ID: <496E31A690F7D311B93C0008C789494C06ACDBF7@zei02exm01.cork.cig.mot.com>
From: Carter John-jcarte01 <John.A.Carter@motorola.com>
To: "'Harring Figueiredo'" <harringf@yahoo.com>, tiff@olympiakos.com
Subject: RE: Newbie Question (StripOffsets/StripByteCount)
Date: Wed, 30 Apr 2003 16:19:25 +0100
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2656.59)
Content-Type: text/plain
Sender: owner-tiff@olympiakos.com
Precedence: bulk
Status: RO
Content-Length: 5819
Lines: 178

sorry about that yea your right, i was getting confused 
with the way I have it coded.

if(count * size_of_type) > 4)
	its an offset
else
	its a value


re compression: just an example of casting,
ive seen the compression type variable being 
mis-intepreted because it wasn't cast,
I sure this holds true for other tags.

jc 		 

-----Original Message-----
From: Harring Figueiredo [mailto:harringf@yahoo.com]
Sent: 30 April 2003 16:09
To: Carter John-jcarte01; tiff@olympiakos.com
Subject: RE: Newbie Question (StripOffsets/StripByteCount)




 Hi John,
 
  Thanks for the reply. I am not sure about your condition: ( count *
size_of_type >= 4). 


  if count * size_of_tag is == 4, then it fits on a long value. Therefore; it
will not be an offset.

The TIFF 6.0 spec (page 15) says, " .. Value Offset contains the Value instead
of pointing to the Value if and only if the Value fits into 4 bytes. ..." 
                         -------------------------------------------

 If it is == 4 bytes, it clearly fits, thus it will not be an offset, but the
value itself. (Anyone cares to commnet on this ?)

  I am not sure about the compression, since I will not decompress it. I will
just read the strips and move/copy into another area. The StripBytecount will
have the correct number of bytes to read since it is "after any compression."


  Thanks again for the email.


Harring.

--- Carter John-jcarte01 <John.A.Carter@motorola.com> wrote:
> Hi Harring
> 
> I think I'm right in making a correction to your
> condition.
> I think it should be ( count * size_of_type >= 4) 
> rather than 
> ( count * size_of_type > 4)
> I made that mistake too, and it took me a while to spot it.
> 
> also (on slightly related point)
> don't forget to cast the ifd_entry.value_offset  
> such as compression below, switching on ifd_entry.value_offset
> directly can give you some strange results.  
> 
> 		case COMPRESSION:
> 			tiff_data->compression = (TIFF_SHORT)ifd_entry.value_offset;
> 			if(DEBUG&LOAD_PAGE_DEBUG){
> 				printf("COMPRESSION:\n");
> 				switch(tiff_data->compression){
> 					case 1:
> 						printf("	Image is not compressed\n");
> 						break;
> 					case 2:
> 						printf("	Uses 1d Huffman run length encoding\n");
> 						break;
> 					case 3:
> 						printf("	T4 Bilevel compression\n");
> 						break;
> 					case 4:
> 						printf("	T6 Bilevel compression\n");
> 						break;
> 					case 5:
> 						printf("	LZW compression\n");
> 						break;
> 					case 6:
> 						printf("	JPEG compression\n");
> 						break;
> 					case 32773:
> 						printf("	PackBits on Raster image data\n");
> 						break;
> 					default:
> 						printf("	No case for compression type %d\n",
> 								ifd_entry.value_offset);
> 						printf("	in file %s %d\n",__FILE__,__LINE__);
> 						break;
> 				}
> 			}
> 			break;   
> 
> -----Original Message-----
> From: Harring Figueiredo [mailto:harringf@yahoo.com]
> Sent: 29 April 2003 18:59
> To: Belshan, James (E52); tiff@olympiakos.com
> Subject: RE: Newbie Question (StripOffsets/StripByteCount)
> 
> 
> 
> 
>   James,
> 
>   Thanks for the reply.
> 
>   I understand the offset concept when the data does not fit on the LONG
> value
> field  ( count * size_of_type > 4) means that the value holds the offset. In
> fact, I already have a Java TIFF dump that matches exactly with the C
> counterpart ( except that mine still does not handle multipage).
> 
>   Thanks again for clarifying how to get the strip data. I will do the way
> you
> are saying.
> 
>  Harring.
> 
> 
> --- "Belshan, James (E52)" <belshan_jl@nns.com> wrote:
> > Hope I don't say anything that's incorrect... But here goes.
> > 
> > How you interpret the ValueOffset (VO) field depends on how much and what
> > type of numbers are in the tag.  If all of the tag data will fit in the VO
> > field, it puts it there, otherwise VO is a LONG pointer to the data
> > location.  If that's the case, then you would move to that point in the
> > file, and read the number and type of Values specified in the tag.  In your
> > case, since the StipOffset and StripByteCount tags only have 1 value, it
> > fits in the VO field.  So you would move to byte 8 in the file and read
> > 11544 bytes of data to get your image.
> > 
> > If you had more than 1 strip, (say 5 strips) then StripOffsets would have 5
> > values (and so wouldn't fit in the VO field), and the StripOffsets VO would
> > point you where to go to read 5 LONG offsets.  You would then go to EACH of
> > the 5 byte locations and read the proper # of bytes for that strip.
> > StripByteCounts would also have 5 values to tell how long each of the 5
> > strips are.
> > 
> > Page 16 of the TIFF Rev 6.0 tells you that the VO field is 4 bytes long, so
> > it will fit 2 SHORTS or 1 LONG.  An example of a tag that doesn't fit in
> the
> > VO field is the RATIONAL resolutions that tiffdump is showing you.
> > RATIONALS are 8 bytes, and so don't fit in the VO field.  tiffdump is
> > actually following an offset in the VO, and reading 8 bytes to make the
> > RATIONAL.  
> > 
> > Hope this helps,
> > 
> > James
> 
> 
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Search - Faster. Easier. Bingo.
> http://search.yahoo.com
> 
> To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
> or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org
> 
> To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
> or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org


__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

To subscribe or unsubscribe email tiff-request@olympiakos.com with subscribe
or unsubscribe in the email body.  Libtiff home page: http://www.libtiff.org

