I don't see how it would not be more efficient to move a conditional from 
inside the channel loop to outside.  We should always prefer as few 
conditionals as possible inside the innermost loop.


On Jul 14, 2012, at 9:09 PM, Chris Foster wrote:

> On Sun, Jul 15, 2012 at 9:33 AM, Stefan Stavrev <[email protected]> 
> wrote:
>> I implemented and tested all 12 Porter-Duff operations.
>> It worked out nicely, very little changed in the code we already
>> had for 'over'.
>> 
>> https://github.com/StefanStavrev/oiio/commit/4d59cc94a11ec91faadd97ab94102cfde26714a4
> 
> Implementation suggestion:
> 
> It's worth checking whether your porter_duff function is more efficient
> to implement as
> 
> float Fa = Fa0 + Fa1*alpha_b;
> float Fb = Fb0 + Fb1*alpha_a;
> 
> Where you compute the float coefficients Fa0,Fa1,Fb0,Fb1 *outside* the
> loop, rather than having a switch statement for each channel of each
> pixel.
> 
> ~Chris

--
Larry Gritz
[email protected]


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

Reply via email to