Offsets are from the start of the segment data, after the 13-byte header.
Palette definition (PDS, 0x14)
| Offset | Size | Name | Meaning |
|---|---|---|---|
0 | 1 | Palette ID | The palette’s identifier. A later palette with the same ID updates it. |
1 | 1 | Version | The palette’s version within the epoch. |
2 | 5 each | Entries | Repeat to the end of the segment. |
Each entry is 5 bytes.
| Offset | Name | Meaning |
|---|---|---|
0 | Entry ID | The colour index, 0–255. |
1 | Y | Luminance. |
2 | Cr | Red colour difference. |
3 | Cb | Blue colour difference. |
4 | Alpha | Transparency, from 0 (transparent) to 255 (opaque). |
FFmpeg converts with BT.709 for video above 576 lines and BT.601 at or below.
Object definition (ODS, 0x15)
Holds an image. A large image is split across several ODS segments, and only the first has the length and dimensions.
| Offset | Size | Name | Meaning |
|---|---|---|---|
0 | 2 | Object ID | The object’s identifier. |
2 | 1 | Version | The object’s version. |
3 | 1 | Sequence flags | 80 first fragment, 40 last fragment, C0 first and last. |
4 | 3 | Data length | First fragment only. Includes the 4 bytes of width and height, so the run-length data is this minus 4. |
7 | 2 | Width | First fragment only. |
9 | 2 | Height | First fragment only. |
11 | varies | Data | Run-length encoded pixels. Later fragments carry only data, from offset 4. |
Run-length encoding
The data holds one palette index per pixel, row by row. Each row ends with a line-end code.
| Bytes | Meaning |
|---|---|
CC | One pixel of colour CC (non-zero). |
00 00LLLLLL | L pixels of colour 0 (1–63). |
00 01LLLLLL LLLLLLLL | L pixels of colour 0 (64–16,383). |
00 10LLLLLL CC | L pixels of colour CC (3–63). |
00 11LLLLLL LLLLLLLL CC | L pixels of colour CC (64–16,383). |
00 00 | End of the row. |
Worked example
00 00 object ID 0
00 version 0
C0 a single fragment (first and last)
00 3F 06 data length, including the next 4 bytes
01 79 width 377
00 2B height 43
… run-length data