Received: by smtp02.oce.nl (4.1/SMI-4.1)
	id AA02510; Sat, 20 Jun 98 11:39:24 +0200
Received: from sgi.sgi.com (SGI.COM [192.48.153.1])
	by oce.nl (8.9.0/8.9.0) with ESMTP id LAA06095
	for <rvdt@oce.nl>; Sat, 20 Jun 1998 11:31:10 +0200 (MET DST)
Received: from cthulhu.engr.sgi.com (cthulhu.engr.sgi.com [192.26.80.2]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via ESMTP id CAA07392; Sat, 20 Jun 1998 02:28:58 -0700 (PDT)
	mail_from (owner-tiff@sgi.engr.sgi.com)
Received: (from majordomo-owner@localhost)
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	id CAA73101
	for tiff-list;
	Sat, 20 Jun 1998 02:02:06 -0700 (PDT)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from sgi.sgi.com (sgi.engr.sgi.com [192.26.80.37])
	by cthulhu.engr.sgi.com (980427.SGI.8.8.8/970903.SGI.AUTOCF)
	via ESMTP id CAA18568
	for <tiff-relay@cthulhu.engr.sgi.com>;
	Sat, 20 Jun 1998 02:02:04 -0700 (PDT)
	mail_from (owner-tiff@sgi.sgi.com)
Received: from lilly.ping.de (lilly.ping.de [195.37.120.2]) by sgi.sgi.com (980309.SGI.8.8.8-aspam-6.2/980304.SGI-aspam: SGI does not authorize the use of its proprietary systems or networks for unsolicited or bulk email from the Internet.) via SMTP id CAA29271
	for <tiff@sgi.com>; Sat, 20 Jun 1998 02:02:02 -0700 (PDT)
	mail_from (fdc@cliwe.ping.de)
Received: (qmail 8303 invoked by uid 10); 20 Jun 1998 09:02:01 -0000
Received: from cliwe.ping.de by lilly.ping.de with UUCP (rmail-0.1-fdc); 20 Jun 1998 09:02:01 -0000
Received: (qmail 6548 invoked by uid 150); 20 Jun 1998 08:54:05 -0000
To: Scott Kennedy <ScottKennedy@compuserve.com>
Cc: tiff list <tiff@sgi.com>
Subject: Re: damaged tiff file update
References: <199806191843_MC2-40C6-736E@compuserve.com>
Mime-Version: 1.0 (generated by tm-edit 7.108)
Content-Type: text/plain; charset=US-ASCII
From: fdc@cliwe.ping.de (Frank D. Cringle)
Date: 20 Jun 1998 10:54:05 +0200
In-Reply-To: Scott Kennedy's message of "Fri, 19 Jun 1998 18:43:21 -0400"
Message-Id: <vtwwac5u8i.fsf@cliwe.ping.de>
Lines: 38
X-Mailer: Gnus v5.5/XEmacs 20.3 - "Vatican City"
Sender: owner-tiff@fddi-sgi.sgi.com
Precedence: bulk

Scott Kennedy <ScottKennedy@compuserve.com> writes:
> [ ... ]
> I was dealing with group 4 compressed tifs, so importing the data in
> [ ... ]
> that the data was compressed in a single strip. If I'm missing a few bytes
> from the beginning of the compressed strip, as is certain, is there anyway
> to decompress it correctly?

The short answer is: no.

A somewhat longer answer: well, maybe.  The problem is that G4 encodes
each line after the first line in terms of its difference from the
preceding line.  Also, it is a variable length code with no
indication of the boundaries between code words or the boundaries
between lines.  As long as you start decoding at the beginning and
there are no bit-errors, everything works out fine.  But even a single
bit error in G4 data generally makes the remainder of the image
unreadable.  If the image is computer-generated (rather than scanned
from paper) you might conceivably find a white line, just below a line
of text, that has been encoded in horizontal mode.  For an image width
of 1696 that would be the bitstream 001 011000 00011011 0000110111.
Starting with those bits, feed the data into a G4 decoder and
something sensible may come out.  Unfortunately, that bit stream can
occur by chance as part of some other code words starting at a
different bit boundary.

Hmmm...  Here is another strategy.  Feed the data you have into a G4
decoder repeatedly, starting one bit further down the datastream on
each attempt.  Most attempts will produce garbage and the decoder will 
complain about incorrect line lengths, unknown extension codes and the 
like.  But if you hit a line that was encoded without reference to its 
predecessor (or one whose predecessor happened to be pure white), the
decoder will be correctly synchronised and the remainder of the image
will come out OK.

-- 
Frank Cringle,      fdc@cliwe.ping.de
voice: (+49 2304) 467101; fax: 943357
