Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-26 Thread Hans Meine
Am Mittwoch, 17. September 2008 01:43:45 schrieb Brendan Simons: On 16-Sep-08, at 4:50 AM, Stéfan van der Walt wrote: I may be completely off base here, but you should be able to do this *very* quickly using your GPU, or even just using OpenGL. Otherwise, coding it up in ctypes is easy as

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-18 Thread Stéfan van der Walt
Hey Brendan 2008/9/17 Brendan Simons [EMAIL PROTECTED]: I would love a c-types code snippet. I'm not very handy in c. Since I gather numpy is row-major, I thought I up and down crops very quickly by moving the start and end pointers of the array. For cropping left and right, is there a

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-17 Thread Francesc Alted
A Wednesday 17 September 2008, Brendan Simons escrigué: [clip] I would love a c-types code snippet. I'm not very handy in c. Since I gather numpy is row-major, I thought I up and down crops very quickly by moving the start and end pointers of the array. For cropping left and right, is there

[Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-16 Thread brendan simons
Hi everyone I have a quick problem. I'm trying to write a routine to demosaic video data extremely quickly. I thought my algorithm would make good use of my processor's vector math units, but it isn't fast enough (it currently takes about 300ms for each 8 megapixel frame) Maybe you can help

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-16 Thread Stéfan van der Walt
Hi Brendan 2008/9/16 brendan simons [EMAIL PROTECTED]: #interpolate the green pixels from the bayer filter image ain g = greenMask * ain gi = g[:-2, 1:-1].astype('uint16') gi += g[2:, 1:-1] gi += g[1:-1, :-2] gi += g[1:-1, 2:] gi /= 4 gi += g[1:-1, 1:-1] return gi I may be completely

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-16 Thread David Huard
Brendan, Not sure if I understand correctly what you want, but ... Numpy vector operations are performed in C, so there will be an iteration over the array elements. For parallel operations over all pixels, you'd need a package that talks to your GPU, such as pyGPU. I've never tried it and if

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-16 Thread Brendan Simons
Why would I need the GPU to do parallel operations? I thought most modern processors have vector units. I just don't know if there's a way to have my code use them. I tried a quick test with pyopengl (as quick as can be done in that crazy api), but I found adding two textures of the same

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-16 Thread Brendan Simons
On 16-Sep-08, at 4:50 AM, Stéfan van der Walt wrote: Hi Brendan 2008/9/16 brendan simons [EMAIL PROTECTED]: #interpolate the green pixels from the bayer filter image ain g = greenMask * ain gi = g[:-2, 1:-1].astype('uint16') gi += g[2:, 1:-1] gi += g[1:-1, :-2] gi += g[1:-1, 2:] gi /=

Re: [Numpy-discussion] Help speeding up element-wise operations for video processing

2008-09-16 Thread David Cournapeau
Brendan Simons wrote: Why would I need the GPU to do parallel operations? I thought most modern processors have vector units. I just don't know if there's a way to have my code use them. Yes, modern CPU have vector units, but to use them efficiently, you have to use assembly or specially