Up to Nikon D3 index

Red and blue firmware multipliers in the Nikon D3

We are interested to know if firmware (ie. software) in the D3 applies a scale factor to pixel amplitudes after analogue-to-digital conversion and before writing them to the raw file.

Method

A photo was taken of some crushed limestone in my drive:

This subject has a broad and continuous histogram.

The camera was set to write 14-bit raw files and all in-camera noise reduction options were turned off. The raw files were processed in such a way as to extract the numbers (referred to as DN for data number) without any alteration. The raw files were split into their red, green and blue components, but no Bayer interpolation (or 'demosaicing') was done.

The histograms of the red and blue were compared with that of the green. In particular, we look for holes in the red and blue histograms, which would indicate that numbers produced by the analogue-to-digital converter have been mutliplied by some factor before being written to the raw file.

Results

Here is the histogram of the green:

It is a continuous curve with no low or zero counts except at each end.

And here is that of the blue:

This is a very different kettle of fish. It has regular low or zero counts all along it, and also almost regular high values which are close to twice the usual magnitude.

Looking closer at the area around DN=1500:

There are lows in the count every 9, 10 or 11 DNs. These lows are sometimes zero and sometimes a small count in single figures. The average separation of these lows, taken over the region DN=1004 to 1402, is one low every 10.205 DNs. Had the lows all been zero, that would have been consistent with a stretching of the blue pixel amplitudes by a factor of 1.1 or thereabouts.

The highs, which are just under twice the height of their neighbours, occur regularly at a spacing of one every 135 and 136 DNs, alternately. (For example, there are highs at DN = 1017, 1152, 1288, 1423 etc.)

The highs are not always adjacent to lows, and there are no missing DNs in the histogram (apart from those regular lows for which the count is zero). I can't think of a good explanation for the highs. Can you?

Here's an even closer look, this time with a bar chart and a logarithmic Y scale so you can see that the lows are not all zero:

Another way of approaching this question is to assume that, in the absence of firmware scaling, the red and blue would produce the same sort of numbers as the green does, and to ask, given that, what scale factor should be applied to the red and blue to produce the statistics we actually observed. Those were, when the sensor was fully saturated at ISO 200:

Depending upon whether one chooses to scale up the Min, Max or Mean green value, that requires a scale factor of between 1.02 and 1.04 to reach the observed blue values. That at any rate is in the same ball park as the factor of 1.1 we deduce from the frequency of holes in the histogram.

In fact, of course, it is unlikely that the red, green and blue filters of the Bayer array have the same transmission, even if the sensor has a flat spectral response.

It seems that the red has a higher firmware scale factor than the blue, since at saturation it produces nothing but 16,383 (=2^14). The red histogram has similar holes to the blue one, only more frequent - corresponding to a higher multiplier - and they are also somewhat less regular. There are no spikes upwards as there are in the blue.

I don't know why Nikon has chosen to adjust the scale factors such that the green saturates gracefully - never reaching 16,383 - whereas the red clips at 16,383 and the blue is somewhere in between.

Here are the histogram files, which are CSV text files loadable into a spread sheet:
red histogram file
green histogram file
blue histogram file
NEF file no longer on server. Email me if you want it.

Column 1 is DN value, and column 2 is Count. My C program that produces these files outputs a line for every DN (whether its count is zero or not) between the lowest and highest DN having a non-zero count.

Peter Facey, Winchester, England
20080311 raw file download added
20080128 originated