Long time no blog, mostly because I had nothing to say beside the usual rants.

This week at Novell it is hack week, and I decided to spend a good amount of time to put libopenraw into a better shape, mostly in the area of extracting and decompressing the CFA[1] data (the RAW data).

Recently I got my first major outside contribution for libopenraw as support for Minolta MRW files. Thanks Bradley, you rock!

So far this week I have done:

  • refactored and genericized the unpacking (12 bits to 16) as most RAW files have 12bits per channel and store it without padding in the file ("harder" to decode[2], but less space wasted). This code I wrote it for the Minolta MRW but end up being usefull to DNG and Nikon NEF
  • implemented an API to also obtain the CFA pattern. The CFA pattern describe the organisation of the CFA (Color Filter Array), mostly the order of the colors. Currently it only support RGB and 2 by 2 patterns. This data is required in order to perform the demosaic (ie convert the CFA to obtain a colorful RGB image)
  • enhanced the test suite to checksum the data (in order to check that we didn't break anything) and to check for the CFA pattern.
  • fixed various bugs needed to either go further or to that were actually bugs, like the unpacking that did fail because it was losing the last bytes of the buffer whose size was not multiple of 3.
  • started dealing with the Nikon mess. Nikon files are either uncompressed, packed with some weird padding (discard 8 bits if column % 10 == 9), or compressed in a lossy way. As of right now, only the uncompressed files are supported. Oh there is also a bug where NEF file from the D100 might be marked as compressed when they are not[3].

So far the file very well supported are:

  • Canon CR2 and CRW (not the CRW from the "hacked" firmware)
  • DNG (unless they are compressed, I need to support loading in tiles as I already have the lossless JPEG compression), and only with a number of bits per channel of 12 or 16. Strangely, the Leica M8 files seems to be 8 bits per channel.
  • Nikon NEF uncompressed (D1, D1X, D2X)
  • Minolta MRW (with the exception of the A200 for which I still miss a sample)


[1] Color Filter Array

[2] 12 bits is actually simplier than 14 or 10

[3] apparently some people did choose to compress, but it was very slow on the camera. I have to locate a sample.