Sony Mavica 411 to PPM file converter

I recently had a visit from my mom who owns a Sony Mavica camera. This camera produces standard MPEG and JPEG files, but it also creates 64x48 pixel thumbnails for preview/index on its own tiny LCD screen. These files are named with an extension that is ".411".

Sony appears not to want to document the ".411" file format, but it is clear from various web pages that it is a variant of the CCIR.601 standard YUV encoding used in MPEG. The name indicates that the file content consists of chunks of 6 bytes: 4 bytes of image Y values, followed by 1 bytes of U and one byte of V values that apply to the previous 4 Y pixel values.

There appear to be some commercial 411 file readers on the net, and there is the Java-based Javica program, but I prefer Open Source command-line utilities. So, I grabbed a copy of netpbm-9.11 from SourceForge and hacked the eyuvtoppm.c file so that it looks like this. While this may not be exactly the right thing to do, it produces results which are close enough for me.

The source code