V1.02
Thom Hogan’s Complete Guide to the Nikon D300
Page 157
14-bit, the data is packed as four 14-bit values in every seven
bytes (seven bytes = 56 bits). We’re mostly interested in this
raw data section of the NEF at the moment.
When an uncompressed NEF is unpacked, the first pixel in the
top row of the raw image data is 12 (or 14) bits of green data,
the second is 12 (or 14) bits of red data, and this pattern
alternates throughout the first row. The second row starts with
12 (or 14) bits of blue data, then 12 (or 14) bits of green data,
and then this pattern repeats.
No interpolation or corrections are applied to this data—NEF
files contain essentially what the Analog-to-Digital converter
deciphered from the photosites (potentially with that pesky
visually lossless compression I’ll eventually get around to
talking about). This is one reason why NEF files require
special software to decode; the sensor data must be converted
(demosaiced) into RGB data and color corrected.
Tip:
If you’re a programming wizard and want to know the exact
format of the NEF files, here’s a quick explanation: the file is
built in standard TIFF format (technically TIFF-EP) but given
a NEF extension, and starts with tags for EXIF header
information and white balance tables, then a thumbnail
image (in JPEG BASIC format), and finally the raw pixel data
stored in a simple left-to-right, top-to-bottom format.
If you’re a programmer, you might want to examine the C
code that can be found at:
http://www.cybercom.net/~dcoffin/
--it’s the same code
that’s formed the basis of Bibble, Photoshop, and other
converters (though many of these have now modified that
code).
If you’re just curious about how software converts the Bayer
pattern data into RGB data, send your browser to
www.liralab.it/teaching/SINA/papers/demosaicking-JEI-
02.pdf
, which contains a short discussion on common
demosaicing methods.