A Small RAW Decoder Comparison
(dcraw, dcraw_ahd, Bibble)
Bibble 4.4 has improved sharpness!
A few days ago Bibble Labs released Bibble 4.4 (a free upgrade for old customers) which has a new Demosaicing artifact reduction option. It produces sharper output than before and my preliminary tests seem to suggest it resolves about the same level of detail as dcraw 7.60 (which is already an old version).
dcraw's output looks sharper but it has more contrast with default settings. To give them a fair comparison, more contrast should be added to the images produces by Bibble 4.4. I haven't had the time to do any real comparison yet.
Meanwhile, Dave Coffin has added slight AHD improvements and yet another new version of dcraw (v7.79) is already available.
The official dcraw is now using AHD!
Dave Coffin released a new version of dcraw (v7.60, 2005-08-30) that uses the AHD algorithm from dcraw_ahd. Therefore the official dcraw now performs the same as dcraw_ahd and there's nothing to compare between them anymore.
Bibble Labs released Bibble 4.3 this month but the demosaicing algorithm hasn't changed, so the comparison between dcraw_ahd and Bibble is still valid.
Introduction
Many digital cameras can output the unprocessed raw image data coming from the sensor. CCD/CMOS sensors only record one color for each pixel and the real color for a given pixel has to be interpolated from the surrounding pixels. This process is called demosaicing and there are many different algorithms for doing it. Most, if not all, raw processing software authors claim their algorithm is the most advanced in the market and provides the highest quality output possible.
I'm mostly interested in Dave Coffin's marvelous dcraw because it's open source, clean ANSI C and can easily be integrated into any kind of raw workflow. The main reason I bought Bibble was the fact that at the time it seemed to provide the highest quality output I could get on Linux (and it still excels in highlight recovery). Dcraw provides notably sharper images with more details, but at the cost of introducing color artifacts.
Dcraw uses the Variable Number of Gradients Method for demosaicing. Anyone who owns a sharp lens and has used dcraw knows that this algorithm produces clearly visible (shown below) color artifacts that probably could, to some extend, be automatically removed in the post processing. Fortunately, an algorithm exists which produces just as detailed image with practically no color problems. This algorithm is called Adaptive homogeneity-directed demosaicing algorithm (AHD) and is invented by Keigo Hirakawa and Thomas W. Parks. The algorithm is explain in [1] and [2]. An algorithm without a practical implementation is useless, and here Paul Lee enters the picture with his excellent implementation of AHD for dcraw, dcraw_ahd.
The Comparison
The following software was used.
- dcraw 7.46
- dcraw_ahd based on dcraw 7.43 (CVS rev. 1.271)
- Bibble Pro 4.2.6
- ImageMagick 6.2.3
The command line for dcraw and dcraw_ahd was
For Bibble the default settings were used too and sharpening was turned off. The color balance between Bibble and dcraw with default settings seems to be close enough, so no fine-tuning was done. Bibble has three levels for color artifact reduction: Standard, Strong, Strongest. It seems the setting doesn't affect at all the sharpness of the image but only the colors. The samples below include two version from Bibble, one with fringe reduction set to Standard and one for Strongest.
Dcraw produces 10 pixels wider and taller images than Bibble (which in turn produces larger images than the JPEGs on Nikon D70) so the images generated with dcraw(_ahd) were cropped using mogrify.
Then the four .tif images were chopped to a series of 642x428 images.
Results
Move the mouse cursor over the image to change it. Use the menus to select which image is shown when mouse is not on the image (Mouse out) and which is shown when mouse is on the image (Mouse over). There are 6 different images to compare and the image can be selected from the, you guessed it, Image menu.
If the Javascript doesn't work for you, please take a look at the image directory. They are the very same images you'd see below. You still need a way to flip them very easily to see the small differences, however.
Some notes of the images:
- Both Bibble and dcraw have newer versions available with improved output quality. Therefore this comparison is outdated.
- The images are 100% (1:1) crops from the original image. The image was taken with a Nikon D70.
- To see the difference between Bibble and dcraw_ahd, see images number 1 and 5. Look especially for the tree's texture in image 1. Image 5 is overall much sharper with dcraw_ahd. There is some color difference, too. It can of course be adjusted later, so there's probably not much point in comparing the defaults. However, dcraw(_ahd) has less saturated colors and more contrast with the default settings. To my eye it looks more natural, but indeed the color corrections can be done for Bibble by hand.
- To see the difference between Bibble's Standard and Strongest, set image number 2. There is some very slight color fringing (mostly in the middle of the image) with Standard setting. Strongest does remove the fringing, but it also evens out the colors badly, and in this particular image everything starts to look pretty much green, which is wrong. Bibble's Standard does a pretty good job already, so in this image it's better not to use Bibble's fringe reduction.
- Images 2 and 3 show the superiority of dcraw_ahd compared to the original dcraw. The level of detail is practically the same (although by pixel peeping it can be seen that dcraw_ahd reveals a tiny bit more detail because of better colors) but there's a visible improvement at sharp, inclined edges where dcraw shows annoying color fringing. This image isn't even nearly the worst case. I didn't want to pick up a special case but instead a pretty casual image with lots of details and sharp edges to look for.
- In image 6 the highlights are blown out in dcraw(_ahd). This can be changed by tuning dcraw's parameters. By using a tool like Udi Fuchs's UFRaw the highlights are preserved with the default settings. However, I'm not sure if dcraw can compete with Bibble's excellent highlight recovery in more demanding situations. The lost highlights cannot be recovered after raw conversion, so it's an important part of a raw conversion software when there's a need to get everything out of the camera's dynamic range.
Conclusions
My main motivation for writing this was to show that with the new demosaicing algorithm written by Paul Lee, dcraw_ahd shows superior sharpness and detail without color artifacts compared to Bibble which I've used to date. The color artifacts of dcraw have really been a show stopper for me, and as was already stated, this image is not a worst case scenario for dcraw.
Bibble's highlight recovery works very well, and when used properly, can be used to extend a bit the narrow dynamic range of todays digital cameras. Frankly, we're talking of only about a half stop or so here, but it's still better than losing it.
Dave Coffin and Paul Lee have done a great job, and dcraw is finally producing really high quality output that I've seen previously only with commercial raw decoding software, which are, interestingly enough, often based on the original dcraw for reading the raw files, but with improved demosaicing algorithm.
It should also be noted that the images here are 1:1 crops so the differences are quite small after all and aren't visible in small prints. In medium sized prints they start to show up, and in large prints they really matter.
Contact
Please don't hesitate to contact me for corrections and positive or negative comments. Also if you know a really bad-ass raw conversion software that produces better output than dcraw, please use it to convert the original.nef to TIFF or good quality JPEG without sharpening or other heavy processing, and send me the URL in email. Please don't send the file as an email attachment.Sakari Tanhua
<stanhua@cc.hut.fi>
2005-08-01