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 | 0x0300, 0x0610 | Enhancer, GainBase | As named in ExifTool; layouts not described there |
| ImageProcessing | 0x0100–0x0111, 0x0113–0x011F | WB_RBLevels variants (3000K to 7500K and custom white balance), WB_GLevel variants | Red/blue and green levels for preset colour temperatures |
| ImageProcessing | 0x0805 | SensorCalibration | Named in the earlier reading; not in the part of ExifTool’s table re-read here, so unconfirmed |
| RawInfo | 0x0100, 0x0200, 0x0600, 0x0612–0x0615 | WB_RBLevelsUsed, ColorMatrix2, BlackLevel2, crop | The same information, older layout |
| RawInfo | 0x1000, 0x1001, 0x2000, 0x2020 | LightSource, WhiteBalanceComp, CMExposureCompensation, CMSaturation | Colour settings (note 0x1000 is ShutterSpeedValue in the main table) |
| 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.
dcraw confirms these steps. Its Huffman table for high has 12 codes and a
thirteenth meaning “more bits follow”: entry i (from 11 down to 0) fills
2048 >> i slots of a 12-bit table with the length i + 1 and the
value i. The result is checked against 12 bits (a larger value is an error),
and the data begins 7 bytes into the strip.
Sources
- ExifTool: Olympus tags – the main table, ImageProcessing, RawInfo and sub-IFD pointers. The maker note header types (
OLYMP,OLYMPUS,OM SYSTEM) and their sizes were not in the text read; the 16-byte OM SYSTEM header size is unconfirmed - dcraw.c (ncruces mirror) –
olympus_load_raw, read as a description