Wednesday, 1 December 2010

Hacking stuff


Saturday was a bit cold and dreary here so I spent the day hacking on some ideas - actually I ended up spending about 10 hours hacking solidly. In short I hooked up Xuggle (lib-`ffmpeg') with OpenCL and OpenGL. Using OpenCL to do some image processing and then dumping it to the display with OpenGL. Eventually I plan to hook up other video sources such as web cameras and capture cards and fortunately this stuff is pretty easy with Linux.

There's nothing i'm doing with OpenCL that couldn't just be done with pixel shaders but I need to test the interoperability and stability of that combination, and maybe i'll eventually come up with some ideas that need more complex processing. And I've only ever done a little bit of OpenGL and certainly no shaders. I tried a gaussian blur (or 1d separable convolution), sobel filter, yuv conversion, and a simple de-interlacer which worked surprisingly well (take every long field as given, and interpolate the short field by 1/2 a pixel vertically and then double the frame-rate).

This the first time i've been working with OpenCL images as a data store as well, and that went pretty smoothly. Very different performance characteristics to using arrays, and I hope to do a little timing at some point. The gaussian blur for instance didn't make any difference if I did it vertically or horizontally - using arrays the performance is very different. Incidentally the GPU profiler appears to be working since the last release, and/or I fixed the code problems I had (threading issues) so I can profile stuff again.

And finally I wrapped the video on a sphere ... err just because. Coming from the C64 era this is just something one must try, even if it looks a bit pants.

Then I got a little excited about the prospect of a hardware/software project, creating a mixing panel and building a simple digital video effects processor. Possibly using an arduino as an I/O controller for the console. But that might be a more long-term idea and there's a few other directions I might head in.


Yesterday was a bit weird - I haven't been sleeping a lot (too hot I think, the cat, other noises) so I was tired as hell all day and even resorted to a nap around 5pm. Couldn't really concentrate on work. But then I got bored about 10pm and ended up hacking on ImageZ again into the very wee hours. Looks like today is a bit of a wreck too but maybe I can concentrate enough to get some work done.

I'm not planning to spend a lot of time on it but I am thinking of cleaning it up a bit, getting what's there working reasonably well and `releasing' it. I ran it the other day to make screen-shots and it just felt nice to use so maybe if I polish it a little i'll use it myself. My needs are pretty modest - mostly just resizing gigantic camera pictures for the web and the odd screenshot

So I added a 'resize layer' function, and a new undo type to handle that. Cleaned up a bit of dead code. And started working out how to make the 'super affine tool' apply it's changes (a little tricky). This showed up some issues with the tool being stored in the toolbar - e.g. how do you 'apply' it, and once applied what next?

Although it's been a couple of months at least since I worked on it I was surprised how quickly I got back up to speed on it and remembered various details of the code-base. I can barely remember what I did yesterday, let alone 3 months ago but somehow that doesn't seem to apply as directly to hacking.

No comments: