Home
friends [entries|archive|friends|userinfo]
Luke Gorrie

[ website | My Website ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

programming exposition [May. 15th, 2008|09:06 am]

xach

Every now and then I see questions like this:

What's the Lisp equivalent of Java's zotFrizzle?

or

Is there a Lisp-for-C++-programmers guide?

In general I think it's better to learn a language on its own terms, without trying hard to figure out how it maps to some language you already know.

I was reminded of that when reviewing K&R for some C hacking. There's one part that says "This is like the foo feature of Pascal or the bar feature of Fortran." Now I just have to learn Pascal or Fortran to get the reference!

Link2 comments|Leave a comment

weekend redux [May. 13th, 2008|04:43 pm]

pvaneynd
Saturday was learning the care and maintenance of a caravan, followed by work in the garden.

Sunday was cutting the hedge, breaking the scissors, getting new scissors, breaking them too and finally in the end getting quality German indestructible scissors.

Monday was resting and going for a walk to Mechelen. Yesterday was a course and discovering a large (15cm across) infection on my leg. So I got a pack of instructions (if ... or ... or ... then go to the hospital immediately) and two packs of antibiotics.

So a quiet weekend :-S.
LinkLeave a comment

faster automotivator compositing [May. 13th, 2008|03:26 pm]

xach
[Tags|, ]

AutoMotivator has a special fancy high res version so you can, in theory, make a motivational poster big enough to print and hang on your wall.

This has worked out reasonably well, but one sore point is the performance of ImageMagick for big images.

AutoMotivator works by taking the original photo, creating two PNGs for the title and inspirational text, and compositing them together against a black background with convert. On big images (2000 pixels or more on a side), it gets very slow (5-20+ seconds) and sucks up a lot of memory.

I'm not sure why it's so slow, but I suspect it's loading all the input images into memory, creating a big output image in memory, filling in the output, and then writing the output to disk.

Since my compositing needs are pretty simple, I don't have to load all that image data: producing each row of the output image only requires reading one row from each the images that single output row intersects. (This thought was originally inspired by picturetile, which must be incredibly slow.)

With that idea in mind, over the weekend I wrote a small compositing program in C. It uses the row-at-a-time input and output functions from libpng and libjpeg. The basic algorithm is:

  • get the dimensions and placement of the input data sources
  • note which data sources appear on each row
  • create a jpeg output object, and one output row
  • for each row in the output:
    • for each input source on that row:
      • merge a row from the input into the output row
    • write the output row out to disk
  • finish the output jpeg

I'm really rusty at C (it's been over ten years since my last useful C program), but the end result is working well: my compositor is about ten times faster than ImageMagick at assembling big poster images. Sure, it also has a hundredth of the features, but it fortunately does exactly what I need. And the difference in user experience quality between producing a poster in two seconds and 20 seconds is huge.

LinkLeave a comment

Rainy fun [May. 4th, 2008|07:49 pm]

xach

DSC_3188.JPG, originally uploaded by Zach Beane.

If it's raining, that means it's time to put on the rain suit and go splashing in puddles.

Link1 comment|Leave a comment

[May. 4th, 2008|03:39 pm]

orangeudav
# uname -a
Darwin 192.168.10.5 9.0.0d1 Darwin Kernel Version 9.0.0d1: Wed Dec 12 00:16:00 PST 2007; root:xnu-933.0.0.211.obj~2/RELEASE_ARM_S5L8900XRB iPhone1,1 unknown
Link4 comments|Leave a comment

navigation
[ viewing | most recent entries ]