openexr-devel
[Top][All Lists]
Advanced

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

Re: [Openexr-devel] Storing multiple layers in OpenEXR files


From: Florian Kainz
Subject: Re: [Openexr-devel] Storing multiple layers in OpenEXR files
Date: Wed, 16 Feb 2005 20:20:57 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030314


We don't have regular expressions nor wildcards to retrieve all channel names starting with "diffuse." and which would retrieve the set {diffuse.R, diffuse.G, diffuse.B}. Or alternatively, a query with "diffuse.*" that would retrieve the first channel in alpahbetical order like "Diffuse.B". And then from that we couls continue scanning through the channel names until the layername differs. Without that, we must first retrieve all the channels and parse their names and build a regrouping structure. Then we can start retrieving the actual data and regrouping them into layers.

Since the regrouping data and channel names were readily available at store time, I just decided that it was simpler to save that information rather than deriving and rebuilding it at load time.


A standard way to represent layers should be as easy to use as
possible; we should not avoid an easy-to-use solution in favor
of another one that just happens to require slightly less work
to implement.

Since a file's channels are already sorted alphabetically, it
would not be a lot of work to add a method to class ChannelList
that finds all channels whose names begin with with a  given
prefix, e.g. "layername.":

    void
    ChannelList::channelsWithPrefix
        (const char prefix[],
         ConstIterator &first,
         ConstIterator &last) const
     {
        first = last = _map.lower_bound (prefix);
        int n = strlen (prefix);

        while (last != end() && strncmp (last.name(), prefix, n) <= 0)
            ++last;
     }

The function might be used like this:

    ChannelList::ConstIterator first, last;
    channels.channelsWithPrefix ("diffuse.", first, last);

    for (ChannelList::constIterator i = first; i != last; ++i)
        doSomethingWithChannel (i.channel());

In one single string attribute. I llike that idea. And this would certainly save file space.

What about something like this :
"diffuse{R,G,B},ambiance{R,G,B},Z,tangent{X,Y},normal{X,Y}"

I would prefer:

    "diffuse,ambiance,Z,tangent,normal"

Or, even better, use an attribute whose value is a vector of strings,
and store the names of the layers in the elements of the vector.







reply via email to

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