Scaling of Canon Raw Files (a.k.a. Combing Artifacts)

  1. Contents

How it All Started

I bought a Canon 30D DSLR in May 2006 and soon after I wrote a program to create histograms from raw files and called it rawhistogram :-) As soon as I analyzed a few of my photos I realized that some of them had mysterious combing patterns in their histogram. A typical example is IMG_0903.png from the above page. I was surprised and shared my findings on the DPReview and Open Photography forums, hoping that someone will have an explanation. Here are the two original threads:

No one had an explanation, however people showed a lot of interest and made some good suggestions. Some people sent me photos form other Canon cameras (e.g. EOS 5D) and I found that some of them were combed as well. So I kept adding photos to the page and improving my program from time to time. I also tested the dark noise performance of quite a few cameras since them (you can see the results here) but the combing artifacts remained a mystery even though I had some guesses.

What Are the Combing Artifacts?

They are essentially an effect of scaling the raw data (i.e. multiplying it by a number or "stretching" it) before it is written to the raw file. This by itself was not a mystery. The real mystery was why is Canon doing this and under what circumstances. This was particularly curious in light of the fact that Canon cameras usually save real, untouched raw data to their raw files (this is not at all the case with most other DSLR brands).

What Causes the Combing Artifacts?

It remained a mystery until December 2007, when a visitor to my page called Martin sent me the following email (I owe Martin an apology for delaying so long before posting his findings):

Hi!
I've read your page "Creating Raw Histograms From Digital Camera Raw Files"
and I have some (I think) interesting information to add:

The "combing" is really a scaling result. You already found out the strong
correlation between the combing and aperture size. Thanks for this research!

I did analyze the histograms of my photos, and I discovered that all photos
taken with the same ISO group and aperture have the same relative scaling
factor applied, see my tables below.
It was 100% consistent, not a single CR2 file was irregular!
...

You can read his complete email by clicking the text. I strongly recommend it - it explains everything!

In short the scaling which causes the combing is done at apertures larger (smaller f-number) than f/2.8 in order to compensate for the signal drop caused by the light rays hitting the sensor at oblique angles. Unlike film, digital sensors do not "like" oblique light angles since the micro-lenses in front of the pixels are not optimized for them. As a result for really wide apertures the signal (counts) given by the sensor is not as high as it should be (i.e. it is not proportional to the increase in light intensity) and the firmware is correcting for it by multiplying the raw data by a constant scaling factor.

This is a summary of the scaling percentages that Martin determined for his 30D. I have not done it for mine yet so I am not sure if the scaling is the same for all units.

ISO f/2.8+ f/2.5 f/2.2 f/2.0 f/1.8
100, 200, 400, 800, 1600 100.00101.10102.15103.76106.15
125, 250, 500, 1000 129.66131.10132.47134.55137.67
160, 320, 640, 1250 77.1077.9578.7680.0081.84
3200 200.00202.20204.30207.52212.30

Looking at the first row of the table you can see that for ISO 100, f/2.8+ there is no scaling (100%), then the factors increase with wider (smaller f-number) apertures.

The second row is for the "upscaled fake ISOs" - they are achieved by multiplying the corresponding smaller whole ones by 1.296 (check it yourself :-). To put it another way to get ISO 125 at f/1.8 the camera shot at ISO 100, then multiplied the data by 1.0615 to correct for the wide aperture and then multiplied that by 1.296 to make the raw data look like it was shot at ISO 125.

Similarly the third row is for the "downscaled fake ISOs" - they are derived from the next larger whole ones by multiplying with 0.771. For example at f/1.8:

ISO160 = ISO200 * 1.0615 * 0.771

And finally ISO 3200 is ISO 1600 doubled. See my EOS 40D test for further details about the "fake" ISOs.

I will add more information and test photos shortly. I also intend to modify the rawhistogram program to properly detect the combing and calculate the scaling that was applied. This may take some time however - please be patient.