Panasonic has not published RW2. The tag names here are ExifTool’s and the decoding
follows dcraw. The file starts 49 49 55 00 (IIU), then the
offset of IFD 0 as in a little-endian TIFF file. IFD 0 mixes Panasonic’s own tags (low
numbers) with standard TIFF tags.
Panasonic tags in IFD 0
| Tag | Name | Type | Meaning |
|---|---|---|---|
0x0001 | PanasonicRawVersion | UNDEFINED | Version, as ASCII digits |
0x0002 | SensorWidth | SHORT | Width of the sensor data |
0x0003 | SensorHeight | SHORT | Height of the sensor data |
0x0004–0x0007 | SensorTopBorder, LeftBorder, BottomBorder, RightBorder | SHORT | The visible area within the sensor data |
0x0008 | SamplesPerPixel | SHORT | Samples per pixel |
0x0009 | CFAPattern | SHORT | 0 n/a, 1 RG/GB, 2 GR/BG, 3 GB/RG, 4 BG/GR |
0x000A | BitsPerSample | SHORT | Bits per value, such as 12 |
0x000B | Compression | SHORT | 34316 RAW 1, 34826 RAW 2, 34828 RAW 3, 34830 RAW 4 |
0x000E–0x0010 | LinearityLimitRed, Green, Blue | SHORT | Highest linear value of each colour |
0x0011, 0x0012 | RedBalance, BlueBalance | SHORT | White balance (early cameras such as the Digilux 2) |
0x0013 | WBInfo | – | White balance presets (below) |
0x0017 | ISO | SHORT | ISO speed |
0x0018–0x001A | HighISOMultiplierRed, Green, Blue | SHORT | Gains used at high ISO |
0x001B | NoiseReductionParams | UNDEFINED | A count, then for each entry an ISO and red, green and blue strengths |
0x001C–0x001E | BlackLevelRed, Green, Blue | SHORT | Black level of each colour |
0x0024–0x0026 | WBRedLevel, WBGreenLevel, WBBlueLevel | SHORT | White balance as shot |
0x0027 | WBInfo2 | – | White balance presets with green (below) |
0x002D | RawFormat | SHORT | Version of the raw data coding; values not documented |
0x002E | JpgFromRaw | UNDEFINED | A JPEG preview with its own complete Exif data |
0x002F–0x0032 | CropTop, CropLeft, CropBottom, CropRight | SHORT | Crop applied by the camera |
0x0037 | ISO | LONG | ISO speed in newer cameras |
0x0118 | RawDataOffset | LONG | Where the raw data starts |
0x0119 | DistortionInfo | – | Lens distortion correction (below) |
0x011C | Gamma | SHORT | Gamma |
0x0120 | CameraIFD | – | An IFD of camera settings (below) |
0x0121 | Multishot | LONG | 0 off, 65536 pixel shift |
0x0127 | JpgFromRaw2 | – | A second embedded JPEG |
Standard tags in IFD 0 include Make (0x010F), Model, StripOffsets
(0x0111), Orientation, RowsPerStrip, StripByteCounts, Artist, XMP
(0x02BC), Copyright, IPTC, and the Exif and GPS IFD pointers.
Sub-tables
- WBInfo (
0x0013): shorts. Index 0 is the number of entries; then up to seven pairs of a light source type (Exif LightSource codes) and red and blue levels. - WBInfo2 (
0x0027): the same, with red, green and blue levels for each entry. - DistortionInfo (
0x0119): signed shorts of distortion parameters and a scale; the low 4 bits of one field switch the correction off (0) or on (1). The model behind the parameters is not documented. - CameraIFD (
0x0120): an IFD with tags such as0x1201and0x1202(lens make and model),0x1301–0x1303(aperture, shutter speed, sensitivity),0x3200–0x3203(daylight white balance per CFA colour) and0x3300(white balance set: 0 auto up to 16).
Sub-table layouts
From ExifTool’s PanasonicRaw tables. Indexes count 16-bit values from 0.
| Table | Layout |
|---|---|
| WBInfo | 0: number of entries. Then up to seven entries of three values from index 1: a light source type (Exif LightSource code) and the red and blue levels (types at 1, 4, 7, 10, 13, 16, 19) |
| WBInfo2 | 0: number of entries. Up to seven entries of four values from index 1: the type, then red, green and blue levels (types at 1, 5, 9, 13, 17, 21, 25) |
| DistortionInfo | Signed shorts: 2 DistortionParam02, 4 DistortionParam04, 5 DistortionScale, 7 (bits 0 to 3) DistortionCorrection (0 off, 1 on), 8 DistortionParam08, 9 DistortionParam09, 11 DistortionParam11, 12 DistortionN (marked uncertain) |
| CameraIFD tag | Name | Values |
|---|---|---|
0x1001 | MultishotOn | 0 no, 1 yes |
0x1100, 0x1101 | FocusStepNear, FocusStepCount | – |
0x1102 | FlashFired | 0 no, 1 yes |
0x1105 | ZoomPosition | 0 to 255 on most cameras |
0x1200 | LensAttached | 0 no, 1 yes; many CameraIFD tags are invalid without a lens |
0x1201–0x1203 | LensTypeMake, LensTypeModel, FocalLengthIn35mmFormat | – |
0x1301–0x1303 | ApertureValue, ShutterSpeedValue, SensitivityValue | – |
0x1305 | HighISOMode | 1 on, 2 off |
0x1412 | FacesDetected | 0 no, 1 yes |
0x3200–0x3203 | WB_CFA0 to WB_CFA3_LevelDaylight | – |
0x3300, 0x3600 | WhiteBalanceSet, WhiteBalanceDetected | 0 auto, 1 daylight, 2 cloudy, 3 tungsten, 5 flash, 8 to 11 custom 1 to 4, 12 shade, 13 Kelvin, 16 AWBc (4, 6 and 7 not available) |
0x3420, 0x3421 | WB_RedLevelAuto, WB_BlueLevelAuto | – |
0x3501 | Orientation | The TIFF orientation codes 1 to 8 |
Raw data
The sensor data starts at RawDataOffset (or StripOffsets). Older RW2 files are either unpacked or use the original Panasonic compression below, which dcraw decodes. Newer cameras use further coding versions (RawFormat values beyond the original), supported in LibRaw but not publicly specified; they are not described here.
The original compression reads the data in blocks of 16384 bytes. Each block is
stored rotated: to rebuild it, move its last 0x2008 bytes to the front. Bits are then
read with a position p that starts at 0 for each block and, for each read of n bits,
becomes (p − n) mod 0x20000; the bits are taken from the 16-bit
little-endian value at byte (p >> 3) XOR 0x3FF0, shifted right by
p mod 8. Each row is coded in groups of 14 pixels, with a predictor for
even and one for odd columns:
at the start of each 14-pixel group: pred[0] = pred[1] = nonz[0] = nonz[1] = 0
for each pixel, i = column mod 14, c = i mod 2:
if i mod 3 == 2: sh = 4 >> (3 - read 2 bits)
if nonz[c]:
j = read 8 bits
if j != 0:
pred[c] -= 0x80 << sh
if pred[c] < 0 or sh == 4: pred[c] &= (1 << sh) - 1
pred[c] += j << sh
else:
nonz[c] = read 8 bits
if nonz[c] != 0 or i > 11: pred[c] = nonz[c] << 4 | read 4 bits
value = pred[c]
Values are 12-bit. The pixels of each row are all coded, including any beyond the
visible width. dcraw treats a value above 4098 inside the visible width as an error.
The Compression codes in the main table (34316, 34826, 34828, 34830) name four raw
versions; ExifTool lists no values for RawFormat (0x002D), and none of the
sources read here say how versions 2 to 4 are coded.
Sources
- ExifTool: PanasonicRaw tags – the IFD 0 table, WBInfo, WBInfo2, DistortionInfo, CameraIFD and WhiteBalance values
- dcraw.c (ncruces mirror) –
panasonic_load_rawandpana_bits, read as a description - The
IIUfile header is not described in the ExifTool text read in this check; it comes from the earlier reading