converted the code from 8bit -> float didn't do any of that optimizing should 
perhaps do that but i preferred to just get it working quickly and without 
getting any additional errors.

i did notice a few things however while testing out the code.
mainly that it felt like it always were in air brush mode making some of the 
brushes way to strong unless you had a huge spacing (not overlapping).
as for if the hsv_to_rgb crashes well it did when i originally wrote the patch 
but just looked at the code and i see no reason at all for it to actually crash 
as you said its just 2 simple static functions.



________________________________
 From: Xavier Thomas <xavier.thomas.1...@gmail.com>
To: Fredrik hansson <fredrikhansson_12...@yahoo.com>; bf-blender developers 
<bf-committers@blender.org> 
Sent: Wednesday, October 31, 2012 8:25 PM
Subject: Re: [Bf-committers] texture painting blend mode patch
 

I a looked at the patch and effectively the code for float images is missing.

Another thing that might need investigating is the rgb_to_hsv and hsv_to_rgb 
method,  basically duplicated code because the origiginal version crash with 
threading! I think it might be better to fix the original, it should be basic 
static methods, I do no see any reason to crash.

Not related to this patch specifically but it seems there is quite a room for 
optimisation. If I understood well, for each pixel that is painted 
on, IMB_blend_color() is called, and this function is only a big 
switch(blend_mode) that then call the method that blend the 2 colors.

One possibly better way to do this is to cache a pointer to the apropriate 
method each time the blend mode is changed so the huge switch statement is not 
done for every pixel.
Another way maybe to inline the blend funtions so we do a function call less 
for each pixel.

For the float version of the blend funtion SSE2 will certainly provide a 20 to 
40% gain, and (depending on the compilator and the images used) you might want 
to avoid code like this:

if(test)
    temp=big float calculation;
else
    temp=other big float calc;

which is not pipeline friendly, and prefer:

temp1 = big float calculation;

temp2 = other big float calc;

temp = test ? temp1 : temp2;

but this is not always the case so don't optimise blindly.


Xavier





2012/10/31 Fredrik hansson <fredrikhansson_12...@yahoo.com>


>oh
> right i think that might have been why it wasn't added before or
>something i guess i could take a look at writing the float versions
>quickly should be the same pretty much.
>
>
>
>
>________________________________
> From: Antony Riakiotakis <kal...@gmail.com>
>To: Fredrik hansson <fredrikhansson_12...@yahoo.com>; bf-blender developers 
><bf-committers@blender.org>
>Sent: Wednesday, October 31, 2012 4:39 PM
>Subject: Re: [Bf-committers] texture painting blend mode patch
>
>
>This looks cool! A little remark though, we would also need float
>versions for the functions to support float images properly.
>_______________________________________________
>Bf-committers mailing list
>Bf-committers@blender.org
>http://lists.blender.org/mailman/listinfo/bf-committers
>
_______________________________________________
Bf-committers mailing list
Bf-committers@blender.org
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to