Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
The **SDS Framework** uses a binary data file format to store the individual data streams. It supports the recording and playback of multiple data streams that may have jitters. Therefore each stream contains timestamp information that allows to correlate the data streams as it is for example required in a sensor fusion application.

The binary data format (stored in `*.<n>.sds` data files) has a record structure with a variable size. Each record has the following format:

1. **timestamp**: record timestamp in tick-frequency (32-bit unsigned integer, little endian)
2. **data size**: number of data bytes in the record (32-bit unsigned integer, little endian)
3. **binary data**: SDS stream (little endian, no padding) as described with the `*.sds.yml` file.
Expand All @@ -28,8 +29,28 @@ The following section defines the YAML format of this metadata file. The file `s
&nbsp;&nbsp;&nbsp; `offset:` | Offset of the value (optional); default: 0
&nbsp;&nbsp;&nbsp; `scale:` | Scale factor of the value (optional); default: 1.0
&nbsp;&nbsp;&nbsp; `unit:` | Physical unit of the value (optional); default: no units
&nbsp;&nbsp;&nbsp; `image:` | Image format metadata (optional)

### Image Format Metadata Fields

The `image` fields provide metadata for image data captured in the SDS stream. When a content item represents image data, `image` describes the format, dimensions, and memory layout.

`image:` | Image stream metadata (all fields required except where noted)
:------------------------------------|---------------------------------------------------
&nbsp;&nbsp;&nbsp; `pixel_format:` | Pixel format identifier (enum)
&nbsp;&nbsp;&nbsp; `width:` | Number of pixels per row (integer, minimum: 1)
&nbsp;&nbsp;&nbsp; `height:` | Number of rows (integer, minimum: 1)
&nbsp;&nbsp;&nbsp; `stride_bytes:` | Bytes per row for single-plane formats (required for single-plane)
&nbsp;&nbsp;&nbsp; `planes:` | Per-plane stride array for multi-plane formats (required for multi-plane)

The `pixel_format` field accepts the following identifiers:

- **Single-plane formats**: `RAW8`, `RAW10`, `RGB565`, `RGB888`, `YUYV`, `UYVY`
- **Multi-plane formats**: `NV12`, `NV21`, `I420`, `NV16`, `NV61`, `YUV422P`, `YUV444`, `YUV444P`

## Example
## Examples

### Sensor Data Stream

This example defines a data stream with the name "sensorX" that contains the values of a gyroscope, temperature sensor, and additional raw data (that are not further described).

Expand Down Expand Up @@ -69,3 +90,22 @@ sds: # describes a synchronous data stream
- value: flag
type: uint32_t:1 # a single bit stored in a 32-bit int
```

### Video Frame Stream

This example shows a video stream capturing RGB888 frames at 30 Hz. Each frame is 640x480 pixels with 3 bytes per pixel (RGB), requiring a stride of 1920 bytes per row.

```yml
sds:
name: Camera stream
description: RGB888 video capture at 30 fps
frequency: 30
content:
- value: frame
type: uint8_t
image:
pixel_format: RGB888
width: 640
height: 480
stride_bytes: 1920 # 640 pixels * 3 bytes/pixel
```
80 changes: 76 additions & 4 deletions schema/sds.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"sds": {
Expand All @@ -19,7 +19,8 @@
},
"tick-frequency": {
"type": "number",
"description": "Tick frequency of the timestamp value (optional); default: 1000 for 1 milli-second interval"
"description": "Tick frequency of the timestamp value (optional); default: 1000 for 1 milli-second interval",
"default": 1000
},
"content": {
"type": "array",
Expand All @@ -37,15 +38,86 @@
},
"offset": {
"type": "number",
"description": "Offset of the value (optional); default: 0"
"description": "Offset of the value (optional); default: 0",
"default": 0
},
"scale": {
"type": "number",
"description": "Scale factor of the value (optional); default: 1.0"
"description": "Scale factor of the value (optional); default: 1.0",
"default": 1.0
},
"unit": {
"type": "string",
"description": "Physical unit of the value (optional); default: no units"
},
"image": {
"type": "object",
"description": "Image stream metadata, applicable when the value represents an image frame",
"properties": {
"pixel_format": {
"type": "string",
"description": "Pixel format identifier.",
"enum": [
"RAW8",
"RAW10",
"RGB565",
"RGB888",
"NV12",
"NV21",
"I420",
"NV16",
"NV61",
"YUYV",
"UYVY",
"YUV422P",
"YUV444",
"YUV444P"
]
},
"width": {
"type": "integer",
"minimum": 1,
"description": "Number of pixels per row."
},
"height": {
"type": "integer",
"minimum": 1,
"description": "Number of rows."
},
"stride_bytes": {
"type": "integer",
"minimum": 1,
"description": "Bytes per row for single-plane formats."
},
"planes": {
"type": "array",
"description": "Per-plane stride (for multi-plane formats).",
"minItems": 2,
"maxItems": 3,
"items": {
"type": "object",
"properties": {
"stride_bytes": {
"type": "integer",
"minimum": 1,
"description": "Bytes per row for this plane."
}
},
"required": ["stride_bytes"]
}
}
},
"required": ["pixel_format", "width", "height"],
"oneOf": [
{
"required": ["stride_bytes"],
"not": { "required": ["planes"] }
},
{
"required": ["planes"],
"not": { "required": ["stride_bytes"] }
}
]
}
},
"required": ["value", "type"]
Expand Down
Loading