It would be amazing if all types are supported.

Analysis of the problem: The typical case is two input images A and B, and
one output image R. Each can be one of 11 types. The problem with the
current approach is that we have a cross product of the 11 types, resulting
in 11^3 madness. Can we get away with not using the cross product and still
achieve our goal? Here is another approach that may or may not work, I am
brainstorming. If it does not work at least it might provoke some ideas.

First of all, notice this pattern:

1. Specialize type for input image A.
2. Specialize type for input image B.
3. Specialize type for input image C.
4. Create iterators for A, B and C based on their types.

Step 4 is the key thing to notice. It is the ONE AND ONLY  end goal of our
types specialization!

So why not have it like this:

some_image_processing_function (R, A, B, ...) {

switch (A.spec().format.basetype) {
    case TypeDesc::FLOAT: // create iterator for A of type <float, float>,
on heap somehow?
    // same for the other types
}

switch (B.spec().format.basetype) {
    case TypeDesc::FLOAT: // create iterator for B of type <float, float>,
on heap somehow?
    // same for the other types
}

switch (C.spec().format.basetype) {
    case TypeDesc::FLOAT: // create iterator for C of type <float, float>,
on heap somehow?
    // same for the other types
}

}

If we could do something like this the complexity is 3*11=33 compared to
11^3=1331.

Again, I am just brainstorming, it might work or not but in worst case it
will provoke some ideas. The main thing to notice is that the types of the
images are independent of each other so there is no need to do cross
products, we might be able to handle them separately somehow.

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

Reply via email to