2008.08.19 05:17 "[Tiff] Regarding DICONDE and its Specification", by Harsha

2008.08.22 08:56 "[Tiff] creating sparse files......", by Rogier Wolff

Hi,

I'm stitching kind of large panoramas. This results in big

intermediate files. On my last run, which took overnight to stitch, thought 42 Gb of free disk space would be enough. Wrong! I

I got over thrity files of over 1.2Gbytes, filling up the disk.

It turns out that most of the files contain lots of zeroes. On Unix can be stored effciently by not issueing a "write" with a buffer this

full of zeroes, but by seeking over the area. The operating system act as if the area was filled with zeroes. will

I'v modified "tif_unix.c" to read:

static int isallzero (tdata_t buf, tsize_t size)
{
        int i;
        for (i=0;i<size;i++)
                if (buf[i]) return 0;
        return 1;
}

static tsize_t
_tiffWriteProc(thandle_t fd, tdata_t buf, tsize_t size)
{
        if (isallzero (buf, size))
                return (lseek ((int) fd, (off_t)size, SEEK_CUR));
        else
                return ((tsize_t) write((int) fd, buf, (size_t) size));
}

static toff_t
_tiffSeekProc(thandle_t fd, toff_t off, int whence)
{
        return ((toff_t) lseek((int) fd, (off_t) off, whence));
}

static int
_tiffCloseProc(thandle_t fd)
{
        toff_t curoffset;
        toff_t fsize;

        curoffset = _tiffSeekProc (fd, 0, SEEK_CUR);
        fsize     = _tiffSeekProc (fd, 0, SEEK_END);

        if (curoffset > fsize) {
                ftruncate((int)fd, curoffset);
        }

        return (close((int) fd));
}

I haven't tested it yet. Maybe someone here has the same problem I have, and is willing to do a test-run. I'll make a proper patch later on. This is just to allow you guys know and to invite comments....

While writing this Email message, I've found a bug: If an area is written, and then later zeroed by the application program the new code won't work. I'll have to think about how to get this case right. In practise a modified libtiff should be easy to plug into "hugin" and the results should be visible, the bug-situation will probably not trigger.

(I used to be able to hit the "compress" checkbox inside hugin, and it would work. But it seems to have gone "dead" in the version currently installed on my machine.)

        Roger.

--

** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **

*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement.
Does it sit on the couch all day? Is it unemployed? Please be specific!
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ