A RAF file has two sets of tags of its own, besides the Exif and maker note data in its JPEG: the records of the metadata block, and the Fujifilm IFD in the raw section. The names are ExifTool’s; Fujifilm has published nothing.
Metadata block
At the metadata offset given in the header, big-endian:
| Field | Size | Meaning |
|---|---|---|
| Count | 4 | Number of records |
| Tag | 2 | Record type |
| Size | 2 | Bytes of data |
| Data | Size | The value, usually 16-bit numbers |
| Tag | Name | Content |
|---|---|---|
0x0100 | RawImageFullSize | Height and width of the sensor data, including borders |
0x0110 | RawImageCropTopLeft | Top margin, then left margin of the visible area |
0x0111 | RawImageCroppedSize | Height and width of the visible area |
0x0115 | RawImageAspectRatio | Aspect ratio of the output |
0x0117 | RawZoomActive | 0 no, 1 yes: digital zoom was used |
0x0118 | RawZoomTopLeft | Top left of the zoomed area, within the cropped size |
0x0119 | RawZoomSize | Size of the zoomed area |
0x0121 | RawImageSize | Height and width of the output image |
0x0130 | FujiLayout | Sensor layout bytes; decoders use bits of the first two bytes to handle the row arrangement and the 45° layout of Super CCD sensors |
0x0131 | XTransLayout | 36 bytes: the 6 × 6 X-Trans colour pattern, 0 red, 1 green, 2 blue, stored last cell first |
0x2000 | WB_GRGBLevelsAuto | White balance levels, green, red, green, blue, for auto |
0x2100 | WB_GRGBLevelsDaylight | … for daylight |
0x2200 | WB_GRGBLevelsCloudy | … for cloudy |
0x2300 | WB_GRGBLevelsDaylightFluor | … for daylight fluorescent |
0x2301 | WB_GRGBLevelsDayWhiteFluor | … for day white fluorescent |
0x2302 | WB_GRGBLevelsWhiteFluorescent | … for white fluorescent |
0x2310 | WB_GRGBLevelsWarmWhiteFluor | … for warm white fluorescent |
0x2311 | WB_GRGBLevelsLivingRoomWarmWhiteFluor | … for living room warm white fluorescent |
0x2400 | WB_GRGBLevelsTungsten | … for tungsten |
0x2410 | WB_GRGBLevelsFlash | … for flash |
0x2FF0 | WB_GRGBLevels | White balance as shot |
0x9200 | RelativeExposure | Exposure relative to normal |
0x9650 | RawExposureBias | Exposure bias of the raw data |
0xC000 | RAFData | A block that includes the raw width and height at model-dependent positions |
Fujifilm IFD
In the TIFF structure of the raw section, tag 0xF000 points to an IFD
with these tags:
| Tag | Name | Content |
|---|---|---|
0xF001 | RawImageFullWidth | Width of the sensor data |
0xF002 | RawImageFullHeight | Height of the sensor data |
0xF003 | BitsPerSample | Bits per value, such as 14 |
0xF007 | StripOffsets | Where the sensor data starts |
0xF008 | StripByteCounts | Its length |
0xF00A | BlackLevel | Black levels, per colour of the pattern |
0xF00B | GeometricDistortionParams | Lens distortion correction |
0xF00C | WB_GRBLevelsStandard | Reference white balance levels |
0xF00D | WB_GRBLevelsAuto | Auto white balance levels |
0xF00E | WB_GRBLevels | White balance as shot |
0xF00F | ChromaticAberrationParams | Lateral chromatic aberration correction |
0xF010 | VignettingParams | Vignetting correction |
dcraw’s reading of the metadata block gives the details that the table leaves out:
0x0100 is height then width (16-bit each); 0x0121 is height
then width of the output, and dcraw adds 3 when the width is 4284; for
0x0130 the first byte’s top bit is the “rotated” flag of a Super CCD sensor
(the height is doubled and the width halved when it is set) and bit 3 of the second
byte, when clear, means a layout with fuji_width set; for 0x0131 each of
the 36 bytes is a colour in its low 2 bits, filled from the last cell backwards; and
0x2FF0 holds four 16-bit multipliers, which dcraw stores with each adjacent
pair swapped (index XOR 1; libopenraw gives the order 1, 0, 3, 2), turning the file’s
green, red, green, blue into red, green, blue, green.
0xC000 (RAFData), when longer than 20,000 bytes, is read as
little-endian 32-bit numbers for the raw width and height. ExifTool’s RAFData
table places the width at indexes 0, 4 and 8 and the height at 4, 8 and 12, depending on
the model (RawImageWidth and RawImageHeight overlap), and its
header table gives RAFCompression at 108 (0 uncompressed, 2 lossless, 3 lossy).
Uncompressed sensor data is stored as 16-bit values row by row, or packed on some models. Fujifilm’s lossless and lossy compressed raw formats (header compression 2 and 3) use a block-based adaptive coding that open source decoders such as LibRaw implement; it has no public specification and is not described here.
Sources
- libopenraw: RAF – the metadata container, the CFA section and tags 0x100 to 0x131, 0x2FF0 and 0xC000
- ExifTool: FujiFilm tags – the RAF header, RAFData and FujiIFD tables
- dcraw.c (ncruces mirror) – the FUJIFILM branch of
identifyandparse_fuji, read as a description