Michael Zucchi

 B.E. (Comp. Sys. Eng.)

  also known as zed
  & handle of notzed


android (44)
beagle (63)
biographical (95)
blogz (9)
business (1)
code (73)
cooking (31)
dez (7)
dusk (30)
extensionz (1)
ffts (3)
forth (3)
free software (4)
games (32)
gloat (2)
globalisation (1)
gnu (4)
graphics (16)
gsoc (4)
hacking (451)
haiku (2)
horticulture (10)
house (23)
hsa (6)
humour (7)
imagez (28)
java (229)
java ee (3)
javafx (49)
jjmpeg (80)
junk (3)
kobo (15)
libeze (7)
linux (5)
mediaz (27)
ml (15)
nativez (9)
opencl (120)
os (17)
panamaz (3)
parallella (97)
pdfz (8)
philosophy (26)
picfx (2)
players (1)
playerz (2)
politics (7)
ps3 (12)
puppybits (17)
rants (137)
readerz (8)
rez (1)
socles (36)
termz (3)
videoz (6)
vulkan (3)
wanki (3)
workshop (3)
zcl (3)
zedzone (23)
Monday, 06 December 2010, 12:50

The green, green grass of home.

We've had some spring weather this year which seems more like the spring weather of 20 odd years ago than it has been of late. Warm thunderstorms, short but heavy downpours, a bit of humidity and warmth. So perhaps it wasn't just nostalgia for what it used to be like making it feel like the weather has been more dreary the last few years.

The heat and damp has sent the grass totally boonta. I mowed that 2 days ago and it's almost ready again for another haircut.

Tagged horticulture.
Saturday, 04 December 2010, 12:42

The weekend.

Another weekend upon us. And it's a scorcher, headed for 36 today. The evap is getting a good workout and it's really nice inside. I had plans to go for a ride to a mate's near the beach and other sorts of things but after last night I don't feel up to much so I might just sit inside and do sfa. Spent the morning watering the pot plants and the garden (after a massive down-pour on Wednesday it's amazing how quickly things dry out in the heat), mowing the lawn, fertilizing, and constructing a frame to support the tomatoes. I also had the bright and in hindsight totally obvious idea of keeping the mint plants out of the full sun so they develop large soft leaves rather than the small hard ones.

And so to some thoughts of the moment ...

Just because I like to see microsoft suffer i've been watching what happened with their latest phone release ... and by what limited data is available it sounds like it was a bit of a flop. Ahh well and good. Over a few beers last night I was chatting to a mate about their weird-arse advertising campaign and I think I worked out what they were trying to do. Someone looked at some charts - one showing the total population of the world, and the other showing how many people already owned a jesus phone or alternative. Then they decided they'd try to sell to the biggest slice of the pie by making fun of the minority rather than trying to steal those customers. At best, the adverts seem to be aimed at those of us who think jesus phone users are wankers - but we're just not interested in the technology itself, so you're not going to sell anything to us (and incidentally I don't see any problem with fishing a phone out of a pissing trough - these things get dropped all the time and it's not like you're going to leave it there). Then a big section of the market will never be interested in such devices because they're simply too complex and although they might appreciate the adverts (if they understand them at all) they are not potential sales. So that leaves the other section of the market - call them the 'aspirational smart-phone' buyers - who want to `grow up' and become jesus phone owning wankers themselves one day. And you're not going to sell to them by pointing out they want to be jesus phone owning wankers. But apart from all that if people are going spend a bit of their hard-earned on a 'cool gadget' they want it to be 'cool'. And that has never been microsoft apart from a pretty small band of retards who don't know any better.

Despite efforts to shut it down, wikileaks seems to be soldering on. Good thing. The media coverage of their latest spill, particularly here in Australia where we expect things to be a bit better than the US, has been utterly appalling. Apart from a couple of alternate viewpoints published on the ABC blogging site (aka 'the drum') the media (and all TV channels) have been in one voice - roundly condemning wikileaks and running full fisted with the US state department line of how terrible it all is and how illegal it has to be. And the australian pollies have all but given up the idea of australian sovereignty with their limp wristed kow-towing to the USA, basically offering an australian citizen up for whatever the yanks want to do to him. Disgraceful gormless arseholes - I can't imagine any of the actual cables that might mention Australia could paint a worse picture of their gutlessness than they're doing by themselves on prime-time TV. At most they're probably worried that Australians might realise how irrelevant their country is in the wider scheme of things and that we don't actually 'punch above our weight' in any sense.

Oh and the whole 'wikileaks is just a CIA/mossad conspiracy' thing is exactly the sort of 'grass roots' conspiracy you'd expect the CIA to use to discredit them. It does sound plausible at first, but ... then a bit of common-sense prevails.

And apparently the fishing fleets have run out of new fisheries to plunder. That is utterly mind-blowing when one considers just how big the oceans are - they are 2/3 of the surface of the planet. Even with centuries of logging there are still areas of un-touched rainforest - which has only ever covered a fraction of the land surface.

Tagged biographical, rants.
Wednesday, 01 December 2010, 21:01

OpenCL Images and Arrays

Curiosity got the better of me and I ran a bunch of tests on separable convolution filters using opencl image types compared to float types.

Not surprisingly perhaps the card seem to be designed for graphics workloads more than computational workloads.


The test is running a 31x31 separable convolution kernel over a 1024x768 image. Implemented using two passes - a horizontal and then vertical convolution.

The image version is also executed over normalised unsigned byte data as well as float data (4x channel). The array version only uses single-channel float planes.

In both cases a single thread calculates each output pixel. Timings are from the NVidia Compute Visual Profiler and the card is an NVidia GTX 480.

Array version

For the X convolution it copies the kernel and 128 elements of the source array to local memory - which is then shared amongst the 64 threads in the work unit.

For the Y convolution this makes things slower because of the way it accesses memory, so it just relies on memory coalescing for the accesses and also for the memory accesses to be interleaved with processing to hide the latency.

The code must manually handle the edges - it just clips to the boundary.

Timings: X=192μS Y=400μS Total=592μS (per plane) 1776μS (3x planes).

I also tried changing the array types to float4 and processing 4 packed planes at once. This pretty much scaled linearly - i'd expected it to scale better than linearly.

Timings: X=820μS Y=1460μS Total=2280μS (4x planes) 570μS (per plane)

Image version

The first image version was a very simple implementation that just reads pixels directly from the source image. Although the data is stored in UBYTE RGBA format it only calculates 3 channels (4 channels can be done for <10% extra time). The X and Y convolution code is more or less identical save for the direction it works in.

Timings: X=618μS Y=618μS Total=1236μS (3x channels) 1269μS (4x channels)

A pretty clear win - but this is only with octet data.

I then tried using floating point as the storage, and things weren't so rosy for the image version.

Timings: X=1824μS Y=2541μS Total=4365μS (3x channels)

So I started moving some of the optimisations required for the array version into the image version. First I just copied the kernel to local memory first in both X and Y versions. Pretty major improvement.

Timings: X=1176μS Y=2117μS Total=3293μS

And finally I added the code which copies 128 elements of the data to local memory. To do this for the Y convolution I also had to change the local work size to be 64 in Y rather than X - and this probably explains why it ran faster since it creates more work groups.

Timings: X=770μS Y=732μS Total=1502μS

What is strange though that this version is slower on the byte data. I guess the extra complication and overhead of copying stuff locally slows it down too much.

Timings: X=712μS Y=731μS Total=1444μS

And if I remove the local copy of the image data the timings improve further.

Timings: X=677μS Y=725μS Total=1402μS

But they are still behind the naive version for BYTE data.


Storing data in array buffers, with properly written code can achieve similar performance to image storage - even though they have radically different data paths and cache characteristics. Array types can process individual planes separately - but can also process vector/multi-channel types fairly easily too.

Although a trivial implementation worked well for 32-bit backed pixel types, non-byte image types require almost identical treatment to the array based implementation in order to gain good performance.

Even though it might not be the most efficient, the same code can also be executed for different image storage types - the image read/write methods just use floating point values in registers which is the most convenient for the arithmetic (and tuned for the GPU). For the array code it would require completely different code for each data type - e.g. normalising to float or using fixed point arithmetic.

In short, the NVidia GPU seems optimised for accessing data through image types. And particularly for typically screen-sized images stored in 32 bit packed format. Not so surprising for a graphics card.

It would be interesting to compare to the ATI card I have - I suspect it would be pretty much a similar result and perhaps even more so, since it doesn't have have any L1 cache for array accesses. But profiling that is somewhat more work and I can't be bothered right now. I have also yet to try it with single-channel images.

Update Actually I need to know about single-channel images so I tried that and it was a bit disappointing for BYTE data: X=593μS Y=600μS Total=1193μS, the texture cache probably stores all channels anyway and for all I know the image is being stored in memory at 32 bits per pixel. For the float data using the optimised version things are somewhat better - X=263μS Y=301μS Total=564μS. And bizarrely now the optimised version is faster for the BYTE data as well - X=242μS Y=295μS Total=537μS. Presumably this is because the smaller amount of processing isn't able to hide the memory latency but the manual caching is (and the smaller local array sizes are less of a limitation for concurrency - the minuscule local memory is the main bottleneck for optimising OpenCL).

I'm running into some memory stress for work and if the byte data were stored packed it might be a big benefit here - right now i'm using float arrays. Using images might simplify some of the code too, although it looks like the more memory heavy stuff will still need to use local memory - although at least in this example that extra work would make it run faster than array types.

Tagged opencl.
Wednesday, 01 December 2010, 08:49

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.

Tagged imagez, opencl, videoz.
Friday, 26 November 2010, 17:35

T-Shirts, guts, and vegetables

Oh on another note I got my GSOC 2010 T-Shirt delivered today. From the paperwork it looks like it was sent on the 23rd, so 2.5 days isn't bad for 13 000km. I was also surprised to see the confirmation of delivery email from fedex.com arrive about 5 minutes after I answered the door.

And fortunately it fits ok - never can tell with size numbers locally let alone internationally (it's an L). Although my Ximian tshirts have stretched a bit, they were a reasonable guide (yes I still wear them - although most are getting a bit tatty these days). Just gotta lose a bit of gut so I can wear it without extra embarrassment.


Combination of over-eating, over-drinking and over-sitting has let my weight creep up a bit too much. I finally weighed myself the other night and got enough of a shock that I decided to do something about it. No more making fresh pasta or bread and eating the whole lot in one sitting, hang back a bit on the booze and cheese, and I'd already started to cut back on the keyboard hours.

Actually the sleep apnoea had been getting pretty bad of late and apart from alcohol (and being overweight) aggravating it big meals don't seem to be a good idea either. I have a bit of a feeling that yeast and/or flour and/or carbs also seem a problem but it's a bit hard to gauge that for sure. I'm don't know if it is in any way related but last week with the very hot weather and northerly winds (from the desert) my hayfever was so bad I could barely breathe at night, I was waking up gasping for air well before daybreak (which is about 5am at the moment). And even before that i'd be so tired in the afternoon I often needed a nap.

So for a couple of days i just had 2 coffees (plenty of milk but no sugar) in the morning, then 1 snag for lunch, some nuts for a snack if I felt too hungry, and finally a big salad with another sausage for an early dinner along with eating it a bit more slowly; and keeping to that general idea since. A few pangs of hunger for a while but not enough to be a problem, and I seemed to be getting them anyway - having a huge dinner and then waking up feeling `starving' just didn't seem right. If you just ignore the feeling it just tends to go away for quite a while, and the salad and a bit of meat is enough to fill satiated at night.

Did about 20km of cycling today just visiting a couple of shops - apart from the waste of time in the city I got some homebrew sugars and some stormwater fittings. My legs felt a bit tired, and my head was feeling a bit light and foggy (almost pleasant actually) but a small snack fixed that when I got home. But not a whole big packet of chips which is something i'd gotten into a bad habit of downing after a decent ride. Not that 20km even rates on that scale.

It's still too early to tell how this will play out - tonight is my traditional piss-up night which i'm giving a miss - but so far I'm generally waking up pretty early and ending up more tired at night (good - no problem getting to sleep) but able to make it through the day without a nanna nap.

With X-Mas coming up i'll probably be a glutton like everyone else, but i'll see if a couple of weeks of this makes any difference. Although the weight is quite an issue, I really want to see if it affects my sleep and general feeling of weariness upon rising and throughout the day.


All this talking of diet gives me a chance to mention a post I that I came across a few days ago which I found interesting. To summarise, a `militant' vegan has started to eat meat again because without it she was getting very very sick. I saw it on a link from here via The Animal Spirits Page side-bar (direct link).

Apart from the little `schadenfreude' all of us `right thinking' people experience when we hear of such silly ideas getting the boot up the arse they deserve, it is good to see she had the guts to admit she was very wrong and sort both herself and some of the facts out and try to ensure others don't get stuck in the same spot. It was interesting the way she specifically pointed out that eating meat `felt natural' and her body handled it with no problem - often a claim by the vegetables that their system isn't unable to process meat. What, did they grow 4 stomachs and start mooing all of a sudden? Udders to that.

I think this is one for the vitamin pill poppers too. This is what a vitamin deficiency looks like. You get very sick. You can die. This is why they're called vita(l) min(eral)s. So, unless you are very sick all you're really doing by taking a daily dose of vitamins is pissing your money down the toilet by turning your wee into liquid gold and making some pill pushers very wealthy. e.g. if you don't have scurvy - you don't have a vitamin C deficiency. Any `pep' you get is from the placebo effect, or perhaps just having a glass of water.

The fact she's getting violent threats just shows there's some pretty unstable people out there, perhaps the sort of crazy control freaks that try to hook into the unnatural self-flagellation of things like veganism rather than dealing with their `issues'. And maybe they're suffering from poor diet and a vitamin deficiency ;-)

Tagged biographical.
Friday, 26 November 2010, 16:13

Wow I'm an idiot.

In a moment of weakness I forked out for Gran Turismo 5.


Although i'd heard about it, it was a shock to see that it forces you to update the firmware - which I am unable to do since I don't accept the terms (I presume - I can barely even read them from where I sit). What a load of bullshit.

I should've just borrowed it off mates when they got bored with it; I haven't bought a game for months and I guess I will keep borrowing as many games as possible (i'm borrowing god of war and final fantasy atm) with a few specific things once in a while. I'd already decided never to buy any download games again simply because they cannot be shared, sold, or given away. And certainly not rent any movies at the exorbitantly outrageous price they're asking (This one I am completely baffled by - at $2-3/night they'd rent loads of movies without trouble, at $6-7 they rent a tiny handful. It makes absolutely zero economic sense).

It's not like I'm ever going to bother getting GNU/Linux running on the thing again - why would I waste my time on dead-end locked down hardware that nobody else will ever use - so I will probably update the firmware anyway. But it's the principle here, I paid a fucking load of money for this shiny box, I am not renting it - how come it feels as though I don't own it?

Tagged games, rants.
Wednesday, 24 November 2010, 18:20


I had another go at playing with GL images via OpenCL today. Although the GPU is currently the main bottleneck i'm a little concerned about moving stuff off and back onto it when it isn't necessary and i'm starting to run into some memory and performance issues.

The code was running but nothing was happening - no matter what I was doing nothing was being written by the opencl code to the texture memory. I was missing one crucial detail from the documentation - I wasn't acquiring the objects for OpenCL before using them. Stupid mistake.

But that was only step one. Absolutely no luck trying to get it to run from another thread - an definite requirement if i am to use it. But eventually the google came to the rescue and I found this question in the nvidia forums by a guy who answered it himself:

Just wanted to report that I had solved the problem. I just release the GL objects before drawing and reacquire them after rendering is complete. Since these rendering calls happen in the process rather than the thread, it doesn't throw any error. I can still run my kernel through the host thread.

I was also having a lot of stability issues and it turns out GLJPanel shouldn't be used at the moment, so I just changed to a GLCanvas and it seemed to fix those issues.

There's still the little matter of the application crashing when you close it - but as far as I can ascertain this is a nvidia driver bug. It seems to work ok on my ATI card. That's still a little untidy so I might have to see if it happens on microsoft windows too before deciding if I should try that route.

As with anything the more complex it becomes and the more of the API you're using the more likely you're to run into bugs or other problems, so there are risks with this. I really need some quality performance metrics to find out if there are benefits which make the risks worth it, but there's a lot of work just in that.


I finally finished God of War III last night - i'd been playing a few hours here and there and giving up when I felt like throwing the controller around. Unfortunately about mid-way through after dying for the 20th time against one baddie I switched to easy mode ... which made it perhaps a bit too easy. But I guess it's better than giving up entirely.

It unlocked a really interesting bunch of videos which I also went through. Some of the technology is pretty nice. The segment about the Poseidon battle got me interested in playing it again to see how it looked. I'd forgotten how good it looked (a few beers in when I started) - very very impressed. I would guess they spent a lot more time on that than the last few bits of the game and it shows. Still either way, looking at the OpenGL api today I wondered how much effort and knowledge it took to turn it into something like that.

GT5 comes out tomorrow (25th here in Australia - as per usual one day behind the rest of the world), and if I get energetic I might wander down to a shop to grab it. Was a big fan of 3, not so much of 4 and somewhat disappointed in the 'hd' preview. Maybe I should wait for the reviews and the inevitable 'platinum'ning of it if it isn't much special. Hmm, apparently it still has screen tearing and frame-drops, most probably because of the rather idiotic idea to run at 1080p ... well that's a massive disappointment, to me that's about the most offensive mistake anyone can make with a video game. This entertaining partial review doesn't inspire confidence either ...

Tagged games, opencl.
Tuesday, 23 November 2010, 12:59

Bugs. The other kind.

My garden has been a bit under attack lately - I severely pruned some citrus so they are spouting wildly, I have a jungle of lettuce, and a few chilli and tomato plants starting to move.

None of this is particularly visible during the daylight but I've gone out a few nights (during the brilliantly bright full moon) to find out what's going to town on everything.

So here's a list of the bugs, pests and otherwise i've noticed in the garden lately.


I've put out some snailbait so at least these aren't doing so much damage at the moment but boy there were a lot of them, some very sizable. I've had at least 15 killed in one large pot alone - no wonder the habanero seedlings kept disappearing. I might get one or two viable plants out of them, but they always grow so slowly ...

Slater Beetles

I don't know if these eat live things or just dead matter but there's some pretty big ones hiding in sheltered spots.


Seem to be everywhere, in large numbers. I was wondering what was eating the lettuce leaves since i'd put the snailbaits out and went out one night with a torch to see - whole lettuce leaves covered in dozens of the things eating big holes through them. And I also found them going to town on a lemon tree - doing a lot more damage than I expected which is more of a concern than the numerous lettuce. I've put out some beer traps with which i've had much success in the past but they don't seem to be going for them so much this year. So I resorted to a little fly spray just to help the leaves while they're very young although I don't want that to become a habit.

Citrus Leaf Eating Weevil

This was a new one. I've seen similar bugs hanging around the inside of the lettuce but not on citrus. I have a barely alive 'limequat' in a large pot which just sprang to life again a couple of weeks ago and I noticed something was hoeing into the rapidly advancing new leaves. One bug it seemed was doing all the damage. I'm keeping a close eye on this one since I fear this is it's last chance before it dies completely.


For some reason they've only gone for the lemon tree so far but they're making a mess of that. There's an ant colony in the half-barrel the lemon is growing in so maybe that's why since they seem to farm the aphids.

Elder wood bugs

I hadn't ever seen these before moving to this house and have been waging war with them ever since. They thrive on leaf litter so one control measure is to clean that up. Eventually I found out a very weak solution of detergent worked well and eventually migrated from using a hand trigger spray to a pressure pump spray to a watering can to now just big buckets of slightly soapy water to try to get them. Only needs about a tablespoon of detergent for a 10 litre bucket and it's pretty devastating to ants too. I don't think i'll ever be rid of them but at least their numbers are kept in check if I keep doing it regularly.


I have some large coriander plants which have gone to seed - covered in large flower heads. These are doing a good job attracting bees although there are usually a few around here and there. One thing I noticed in Perth was a lack of bees - so much so it was a problem getting fruit to set - and it's nice to see that given the problems in other parts of the world the bees here are still quite numerous. There was even a swarm next door a few weeks ago.

Lady bugs

Even saw a couple of ladybugs around which are not that common. One reason I don't want to spray too much ...

Praying mantis

Well I saw one a few weeks ago. Nice surprise.


Blasted things keep running across my roof making a racket and hanging out in a large golden rain tree next to the house - generally smashing up the small stalks and making a mess. My roses this year are very spread out with long stems falling over (I didn't do a good job pruning I suspect) and one of the nicer ones broke in half. As a probably vain attempt to salvage it I put a couple of branches in some wet dirt, and the possums even ate the leaves off that while it was sitting on the ground. At least they don't do that too often.

Tagged horticulture.
Newer Posts | Older Posts
Copyright (C) 2019 Michael Zucchi, All Rights Reserved. Powered by gcc & me!