NEF missing values

I used libraw to decode NEF images and looked at the r, g, b values. It turns out that certain r and b values never occur. I.e., some histogram values are zero.

In fact, the pattern of zeros is very regular. So for red, we have no samples with values 5, 14, 23, 33, 42, 51, 61, 70, 80, 89, 98 ... etc. For blue, there are no samples with values 4, 12, 20, 28, 36, 44, 52, 60, 68, 76, 84, 93.

Every 9th or 10th red value is missing. Every 8th or 9th blue value is mission.

The images were taken in 14 bit mode on a Nikon D7000.

It looks like some kind of scaling artifact. Is this artifact something that is in the raw data, or is it a side-effect of how the raw file is decoded to an image array?

Forums: 

This is Nikon's 'White

This is Nikon's 'White balance preconditioning' feature (no way to turn it off, AFAIK).
The data from Red and Green channels are multiplied by some small coefficient and rounded to integer after that.

I do not know WHY Nikon is doing this, but it happens on ALL recent Nikon cameras (have not tested very old ones like D2).

The nikon data is 'lossless JPEG' (huffman compression) compressed. Decompressor code is same for many camera types (Canon, Nikon, Lossless DNG, several others). The missing values occur only on Nikon files. So, this is definitely not decompression artifact, but source data artifact.

-- Alex Tutubalin