[SciPy-user] PIL and gaussian_filter?

Sebastian Haase haase@msg.ucsf....
Sat May 24 02:13:33 CDT 2008


On Sat, May 24, 2008 at 5:39 AM, Robert Kern <robert.kern@gmail.com> wrote:
> On Fri, May 23, 2008 at 9:06 PM, Anne Archibald
> <peridot.faceted@gmail.com> wrote:
>> 2008/5/22 Johannes Strömberg <johannes.stromberg@gmail.com>:
>>> Thank you everyone,
>>>
>>> Unfortunately I was wrong about the calculations I actually need to
>>> perform. I have got a working set of operations for what I need (see
>>> below), but it is awfully slow. Anybody got any idea on how to make it
>>> faster?
>>>
>>> # in = array
>>> # gaussian = array
>>> # threshold = int
>>> # percent = int
>>>
>>> diff = in - gaussian
>>> diff = numpy.where(diff > threshold,diff,0)
>>
>> It might help a little to write:
>> diff[diff>threshold] = 0
>>
>> Otherwise there's not too much fat in there.
>
> As I think I've mentioned in another thread, these masked operations
> are inherently slow. We use iterators to do them, and this interferes
> with the ability of the compiler to use optimized instructions. It is
> exactly this operation that was the bottleneck in one of our programs,
> so we wrote a C function using SSE2 instructions to do this wicked
> fast.
Robert,
would it be possible, that you could post this
"C function using SSE2 instructions" !?
I'm very curious to see some SSE2. Are you saying the compiler is not
optimizing normal code to use those instructions ?
Lastly, I assume you interface to C using ctypes, right?

Thanks,
Sebastian Haase


More information about the SciPy-user mailing list