Olympus has not published ORF. This page follows the open source decoders (dcraw and its successors) and ExifTool’s tag tables.
Header
| Bytes | Meaning |
|---|---|
49 49 52 4F (IIRO) | Little-endian; the usual ORF header |
49 49 52 53 (IIRS) | Little-endian; used by some models |
4D 4D 4F 52 (MMOR) | Big-endian; used by some older models |
Bytes 4 to 7 are the offset of IFD 0, exactly as in TIFF; only the magic number differs from TIFF’s 42.
Directories
- IFD 0 is the raw image: ImageWidth, ImageLength, BitsPerSample, Compression, StripOffsets and StripByteCounts, plus make, model and the Exif IFD pointer.
- The Exif IFD holds the Olympus maker note, which contains the preview JPEG and the data a raw decoder needs.
Maker note headers
| Header | Size | Offsets relative to |
|---|---|---|
OLYMP, a zero byte, and a 2-byte version | 8 | The TIFF header of the file (older cameras) |
OLYMPUS, a zero byte, II, and version 03 00 | 12 | The start of the maker note |
OM SYSTEM, three zero bytes, II, and version 04 00 | 16 | The start of the maker note (OM System cameras) |
The header is followed by an IFD. With the newer headers, most information is in sub-IFDs pointed to by tags of the main IFD:
| Tag | Sub-IFD |
|---|---|
0x2010 | Equipment: camera and lens identity |
0x2020 | CameraSettings: exposure, white balance, quality, and the preview JPEG |
0x2030, 0x2031 | RawDevelopment, RawDev2: settings for in-camera raw development |
0x2040 | ImageProcessing: white balance levels, colour matrix, black levels, crop |
0x2050 | FocusInfo |
0x3000 | RawInfo: similar data in older E-series cameras |
Raw decoding tags
| IFD | Tag | Name | Use |
|---|---|---|---|
| ImageProcessing | 0x0100 | WB_RBLevels | Red and blue white balance levels |
| ImageProcessing | 0x0200 | ColorMatrix | 3 × 3 colour matrix |
| ImageProcessing | 0x0600 | BlackLevel2 | Black level of each of the four CFA colours |
| ImageProcessing | 0x0611 | ValidBits | Significant bits per value |
| ImageProcessing | 0x0612–0x0615 | CropLeft, CropTop, CropWidth, CropHeight | The visible part of the sensor |
| ImageProcessing | 0x0805 | SensorCalibration | Sensor calibration values |
| RawInfo | 0x0100, 0x0200, 0x0600, 0x0612–0x0615 | WB_RBLevelsUsed, ColorMatrix2, BlackLevel2, crop | The same information, older layout |
| Main | 0x1011, 0x1012, 0x1017, 0x1018 | ColorMatrix, BlackLevel, RedBalance, BlueBalance | The same information in early cameras |
Storage
The sensor data is uncompressed (12-bit values packed or in 16 bits each) or uses Olympus’s own compression. Decoders recognise compressed data from the size of the strip, which is smaller than uncompressed data would be, rather than from a Compression value.
Olympus compression
The data starts 7 bytes into the strip and is read as a big-endian bit stream, row by
row. Each pixel uses state kept separately for even and odd columns (reset at the
start of each row): a magnitude carry0, an average carry1 and
a run counter carry2.
i = (carry2 < 3) ? 2 : 0
nbits = 2 + i; while (carry0 >> (nbits + i)) nbits++
s = read 3 bits; low = s & 3; sign = (s & 4) ? -1 : 0
high = number of 0 bits before the next 1 bit (at most 12)
if high == 12: high = (read 16 - nbits bits) >> 1
carry0 = (high << nbits) | read nbits bits
diff = (carry0 ^ sign) + carry1
carry1 = (diff * 3 + carry1) >> 5
carry2 = (carry0 > 16) ? 0 : carry2 + 1
value = prediction + ((diff << 2) | low)
The prediction uses the same-colour neighbours two columns left (w), two rows up
(n) and diagonally (nw): 0 for the first two rows and columns where they are missing
(using w or n alone when only one exists). Otherwise, if nw lies between w and n, the
prediction is w + n − nw when either differs from nw by more than 32, or
else the average of w and n; if not, it is whichever of w and n is further from
nw.