Each image track of a CR3 file describes its picture in a CRAW sample
entry inside its stsd box (see boxes).
The layout below is from reverse engineering; Canon has published nothing. All numbers
are big-endian.
CRAW
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | size | 0x3C for the JPEG track; 0xD4 or 0xE4 for raw tracks |
| 4 | 4 | type | CRAW |
| 8 | 6 | reserved | 0 |
| 14 | 2 | data reference index | 1 |
| 16 | 16 | reserved | 0 |
| 32 | 2 | width | Image width in pixels |
| 34 | 2 | height | Image height in pixels |
| 36 | 4 | horizontal resolution | 72.0 as 16.16 fixed point (00 48 00 00) |
| 40 | 4 | vertical resolution | 72.0 |
| 44 | 4 | – | 0 |
| 48 | 2 | frame count | 1 |
| 50 | 32 | compressor name | Unknown content |
| 82 | 2 | bit depth | 24 |
| 84 | 2 | – | −1 |
| 86 | 2 | flags | 3 for the JPEG track, 1 for raw and C-RAW |
| 88 | 2 | – | 0 for JPEG, 1 for raw and C-RAW |
| 90 | varies | child boxes | JPEG (12 bytes, a zero long) for the JPEG track; CMP1, CDI1 and free for raw tracks |
Up to offset 90 this is the standard visual sample entry of ISO base media, so the field names at 14 to 84 follow that standard.
CMP1: compression header
| Offset | Size | Field | Meaning |
|---|---|---|---|
| 0 | 4 | size | 0x3C |
| 4 | 4 | type | CMP1 |
| 8 | 2 | – | Unknown (−1) |
| 10 | 2 | header size | Bytes that follow, 0x30 |
| 12 | 4 | version | 0x100 |
| 16 | 4 | image width | In pixels |
| 20 | 4 | image height | In pixels |
| 24 | 4 | tile width | Half the image width for large images, split into two slices |
| 28 | 4 | tile height | Tile height |
| 32 | 1 | bits per sample | Usually 14 |
| 33 | 4 bits | planes | 4: one per CFA colour |
| 33 | 4 bits | CFA layout | 0 RGGB, 1 GRBG, 2 GBRG, 3 BGGR |
| 34 | 4 bits | encoding type | 0 raw and C-RAW, 3 raw burst |
| 34 | 4 bits | wavelet levels | 0 for lossless raw, 3 for C-RAW |
| 35 | 1 bit | several tiles across | 1 when the image is split horizontally |
| 35 | 1 bit | several tiles down | Always 0 so far |
| 36 | 4 | track header size | Size of the tile, plane and subband headers at the start of the image in mdat |
| 40 | 1 bit | extended header | 1 when an extended header follows at 60 |
| 44 | 16 | – | 01 01 00 00 per plane, meaning unknown |
| 60 | 4 | extended header size | When the flag is set |
| 64 | 1 bit | median bit depth present | Second bit of the byte at 64 |
| 92 | 1 | median bit depth | Usually 14, when present |
Within each byte the first field named is in the high bits. The rest of bytes 40 to 43, and most of the extended header, are not understood.
CDI1 and IAD1: image areas
CDI1 is a full box (size, type, a version byte and 3 flag bytes) whose
only content is IAD1, so its size is the size of IAD1 plus
12. IAD1 holds shorts:
| Offset | Field | Meaning |
|---|---|---|
| 8, 10 | – | 0, 0 |
| 12 | width | Sensor width |
| 14 | height | Sensor height |
| 16 | – | 1 |
| 18 | slices | 0 for the small image, 2 for the full size image |
| 20, 22 | – | 1, 0 |
| 24–30 | crop | Full size image: left, top, right, bottom of the recommended crop. The small image has other values here (its width − 4, height − 1, width − 1, height − 1 on the EOS R), not fully understood. |
| 32–38 | left optical black | Left, top, right, bottom; full size image only |
| 40–46 | top optical black | Left, top, right, bottom; full size image only |
| 48–54 | active area | Left, top, right, bottom; full size image only |
Offsets here include the 8-byte box header. Coordinates are zero-based and inclusive. The active area is known to overrun the image by a few pixels on some cameras.
CTMD sample entry
| Offset | Size | Field |
|---|---|---|
| 0 | 4 | Size, 0x4C |
| 4 | 4 | CTMD |
| 8 | 8 | 0 |
| 16 | 4 | Number of record types, such as 7 |
| 20 | 8 each | Per record type: a short (unknown), the type (short), and its size (long) |
The records themselves are in mdat; see
media data.