It all depends on how often the channel shuffling is needed.

I'm just thinking about oiiotool for a second...
In a typical use, probably no channel shuffling is done at all.
More rarely, the inputs need to be shuffled into some uniform ordering, but 
then combined with other things in the same order.

Example uses I can think of:

* Simple channel extraction:
        oiiotool myrgb.tif --channels 1 -o green.tif

* Simple shuffling:
        oiiotool my_screwedup_bgra_file.tif --channels 2,1,0,3 -o rgba.tif

* You have a "fat" file with 10 channels, and you want to pull out just the 
RGBA and comp it with another input.
        oiiotool fat1.tif --channels 4,5,6,7 fat2.tif --channels 2,4,6,8 -o 
composite.tif

* One of your inputs is RGBA, another is just iA, you want to replicate the 
gray to color in the second image for the composite:
        oiiotool myrgba.tif myia.tif --channels 0,0,0,1 -over -o composite.tif

And so on.  I think that doing the channel selection in one operation up front, 
then having conditional-less operations following should be at least as 
efficient as doing channel selection within each op.

I'm not sure I can easily think of a long series of operations that would 
require multiple, different shufflings.  Did you have a usage case in mind as 
an example?

I'm not sure we have a compelling argument yet that we need this flexibility 
everywhere (and would have to pay for it in code complexity and possibly 
performance).  We can always give a simple channel selection like I describe 
now, then do something more sophisticated later, if and when the performance of 
the simple solution is shown to be inadequate.

Just my intuition.  If the comp folks out there say I'm crazy naive, I'll 
listen.


On Jul 17, 2012, at 4:59 PM, Stefan Stavrev wrote:

> Hehe, yeah I thought of that too.
> 
> I rejected it because I thought it will be expensive,
> might be wrong though.
> 
> For each input image you will have to
> copy the channels you want in a new image. Imagine
> doing that for 2 or 3 input images for each operation.
> Imagine now an image sequence and for each frame
> lots of operations. I dunno, maybe it is not that expensive?
> The solution I got now seems much less expensive.
> 

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to