openexr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Openexr-devel] Finding out if a file contains all tiles


From: Florian Kainz
Subject: Re: [Openexr-devel] Finding out if a file contains all tiles
Date: Tue, 25 Apr 2006 11:05:08 -0700
User-agent: Mozilla Thunderbird 1.0 (X11/20041207)

Once you have opened the file by constructing an input file
object, isComplete() only checks a flag that has been computed
by the constructor.  However...

The time it takes to construct the input file object depends
on whether any tiles or scan lines are missing, independent
of whether you will be calling isComplete() or not.  If the
file is complete, the constructor is fast.  If scan lines or
tiles are missing, then constructing the input file object
takes a little longer:

An OpenEXR file consists of a header, a tile offset table and
the tiles.  (For more details, see our new file layout document:
http://www.openexr.com/openexrfilelayout.pdf)

After opening a file for writing, the IlmImf library immediately
writes the file header, followed by an empty tile offset table.
The library knows the size of the table, but it does not yet
know the location of the tiles in the file.  Immediately before
before closing the file, the library replaces the empty table
with a table that contains the actual tile locations.

When you open a file for reading, the tile offset table may be
empty or incomplete.  In this case the input file constructor
scans through the rest of the file to determine where the tiles
are.  This process is significantly faster than reading the
entire file.  Only a 20-byte header at the start of every tile
is read; the rest of the file is skipped.

Reconstructing the file's tile offset table happens every
time you open an incomplete file for reading.  Once you have
successfully opened the file, the cost of calling isComplete()
is negligible.

Florian



David Larsson wrote:
Interesting.
What's the expected running time of this function? Is it a quick flag check or more of a loop over all tiles to see if they are available.

Cheers
/David L

On 4/25/06, *Florian Kainz* <address@hidden <mailto:address@hidden>> wrote:

    Class InputFile has an isComplete() method that allows you to check
    if any tiles or scan lines are missing.  ImfInputFile.h says:

         isComplete() returns true if all pixels in the data window are
         present in the input file, or false if any pixels are missing.
         (Another program may still be busy writing the file, or file
         writing may have been aborted prematurely.)

    I guess the function should be mentioned in the documentation...

    Florian



    David Larsson wrote:
     > Hi,
     > I wonder if there is a fast way to figure out if an exr-file is
    missing
     > any tiles, preferably not involving reading all tiles.
     >
     > /David Larsson
     >
     >
     >
    ------------------------------------------------------------------------
     >
     > _______________________________________________
     > Openexr-devel mailing list
     > address@hidden <mailto:address@hidden>
     > http://lists.nongnu.org/mailman/listinfo/openexr-devel






reply via email to

[Prev in Thread] Current Thread [Next in Thread]