AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
June 2006

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2006.06.02 15:22 "TIFFWriteRawStrip with multi-strip?", by Bernie Pallek
2006.06.02 16:35 "Re: TIFFWriteRawStrip with multi-strip?", by Joris Van Damme
2006.06.02 17:08 "Re: TIFFWriteRawStrip with multi-strip?", by Bernie Pallek
2006.06.02 17:20 "Re: TIFFWriteRawStrip with multi-strip?", by Joris Van Damme
2006.06.07 08:50 "Re: TIFFWriteRawStrip with multi-strip?", by Gerben Vos
2006.06.07 11:48 "Re: TIFFWriteRawStrip with multi-strip?", by Joris Van Damme
2006.06.07 13:48 "Re: TIFFWriteRawStrip with multi-strip?", by Bernie Pallek

2006.06.02 17:20 "Re: TIFFWriteRawStrip with multi-strip?", by Joris Van Damme

Joris wrote:
> This type of compression, G4, encodes each scanline relative to
> previous scanline. The first scanline is encoded relative to a
> 'virtual' all-white line. So if you divide the block, the first part
> will make sense, the second will be corrupted. There's no way you can
> work around that.

Perhaps I was expressing myself too strongly.

You could scan through the image, decompressing it, holding on to the
reference previous scanline and the newly decompressed scanline. Before
decompression of the first scanline of the newly divided strip, you can
flush previous data to previous strip as you now have its length.

Next, you could decompress first scanline of the new strip, using
appropriate reference line. You could then recompress that first
scanline, using an all-white reference line. Now the new strip has a
suitable start. You could then scan on, and repeat the process.

So this saves nothing in the decompression departement. It does save you
a huge decompressed buffer, replacing that need with a buffer to hold
only two scanlines. And it does save in the recompression departement,
replacing that need with recompression of only the first scanline of
each newly divided strip (and some memory copy, likely, as the newly
recompressed scanline is likely larger then its previous version). G4
being a lossless compression mode, this does not improve the results
which are fine either way.

This comes at the cost of a lot of coding effort, and good knowledge of
the G4 compression scheme. I'd guess it's not worth it, G4
(de)compression being fast as it is, unless you've got some special
application like an absolute need to divide the G4 compressed blocks on
very low memory devices or something... Do you?


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