The D300 supports two types of compressed NEF files. One version is said to be lossless (and labeled as such in the camera), while the other is said by Nikon to be either virtually lossless or visually lossless, meaning that results visually indistinguishable from those that would be produced by the original data can be recovered.
Lossless compressed NEF truly lossless
Compressed NEF visually lossless
Visually lossless isnt quite the same as lossless. In the truly lossless version the original data is recovered exactly when the data is later uncompressed, so we dont have to worry about or discuss further what happens with the data in the Lossless compressed NEF option.
In the visually lossless version (Compressed NEF) you get some of the original data back (in the shadows and some mid-tones), but the highlights are posterized in a way that is consistent with the human visions capabilities. We do need to discuss how this works, as it ca produce visual effects in your images.
Im not sure Id term the methodology Nikon uses for the visually lossless format as compression, but heres how it works: when photosite data comes off the ADC, it has 12 or 14 bits of value to it. Lets use 12-bits to keep things simple. A 12-bit value from the ADC of 0 would represent no data(black), a value of 4095 would represent saturation(white). If that was the way we stored the data, wed need 12 bits to store each photosites data. In order to reduce storage size, the D300 (and other Nikon DSLR bodies) include a special method of compressing NEF data (Compressed NEF set via the D300 SHOOTING menu) which works as follows:
· Shadow and low mid-range values as passed on as is.
· High mid-range and highlights values are split into groups (essentially, neighboring values are rounded to a central value; for example values of 1023, 1024 and 1025 might all be grouped together and stored as a single value). The manner in which this is done isnt linear. The last possible group value (almost white) has more adjacent values in its group than the first. This non-linearity is designed to correspond to the way our eye is able to distinguish between bright tones.
Thus, there are significantly fewer than 4096 values possible in the scheme for a 12-bit data and significantly less than 16384 values for the 14-bit data. The resulting compressed data is further compressed using a somewhat traditional method that looks at adjacent differences and is truly lossless; the final data is also packed across byte boundaries for space efficiency. The result is that the 12 bits of original data stores in about 6 bits (and 14 bits of original data stores in about 7 bits).