Skip to content

Commit 7bd98ef

Browse files
authored
SDS Metafiles: reworked documentation, schema, templates, utilities (#276)
SDS Metafiles: reworked documentation, updated schema and templates audio: codec: changed to format: sds metadata: incorporated feedback Update Python utilities for SDS 3.1 metadata - Accept `sample-frequency` with legacy `frequency` fallback where applicable - Treat `sample-frequency` as optional in `sds-view.py`, deriving plot rate from record timeslots when possible - Require `audio:` metadata for WAV conversion and read WAV parameters from audio subnotes - Keep image metadata on the `image:` path for video conversion - Add clear errors when value-list utilities receive `image:` or `audio:` metadata instead of `value:` entries`
1 parent 57ec85b commit 7bd98ef

28 files changed

Lines changed: 766 additions & 407 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This is a list of the relevant files and directories.
3131
| [template](./template) | [SDS template application](https://arm-software.github.io/SDS-Framework/main/template.html), a test framework for DSP and ML algorithms. |
3232
| [layer/sdsio](./layer/sdsio) | Configured [SDSIO layers](https://arm-software.github.io/SDS-Framework/main/sdsio.html) for file I/O via Network, USB, or File System. |
3333
| [utilities](./utilities) | Python scripts for processing of SDS binary data files. |
34-
| [schema](./schema) | Schema for [SDS YAML metadata format](https://arm-software.github.io/SDS-Framework/main/theory.html#yaml-metadata-format) that describes the content of SDS files. |
34+
| [schema](./schema) | Schema for [SDS YAML metadata format](https://arm-software.github.io/SDS-Framework/main/theory.html#sds-metadata-format) that describes the content of SDS files.
3535
| [sds](./sds) | SDS-Framework source files and implementation of various SDSIO interfaces. |
3636
| [.github/workflows](./.github/workflows) | GitHub Actions for validation and publishing. |
3737
| [.ci](./.ci) | Files that relate to CI tests. |
7.2 KB
Loading
134 KB
Loading

documentation/images/overview.pptx

41.3 KB
Binary file not shown.

documentation/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This user's guide assumes basic knowledge about Cortex-M software development. I
1919

2020
Version | Description
2121
:------------------|:-------------------------
22+
3.1.0 | The [SDS metadata format](theory.md#sds-metadata-format) uses clearer field names, such as `sample-frequency:`, and adds the [`audio:` data stream](theory.md#audio-data-stream).
2223
3.0.0 | [Major rework of the SDS-Framework and SDSIO-Server](https://github.com/ARM-software/SDS-Framework/releases/v3.0.0). A single firmware image enables record/play control and user status exchange (using sdsFlags variable). The Monitor interface connects the SDSIO-Server with the [SDS extension for VS Code](https://marketplace.visualstudio.com/items?itemName=arm.cmsis-sds), which provides an intuitive user interface.
2324
2.1.0 | [Minor update of the SDS-Framework](https://github.com/ARM-software/SDS-Framework/releases/v2.1.0)
2425
2.0.0 | [Major update of the SDS-Framework](https://github.com/ARM-software/SDS-Framework/releases/v2.0.0)

documentation/theory.md

Lines changed: 149 additions & 74 deletions
Large diffs are not rendered by default.

documentation/utilities.md

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ The `streams:` node provides additional information about the SDS data streams t
147147
`streams:` | | Content
148148
:-----------------------------------------------------------|:-------------|:------------------------------------
149149
`- name:` | **Required** | Name of the data stream.
150-
    `view:` | Optional | Format of the data stream for the viewer (signal, wav, video, heatmap, csv, csv2)
150+
    `view:` | Optional | Format of the data stream for the viewer (signal, wav, image, heatmap, csv, csv2)
151151

152152
### `play:`
153153

@@ -214,13 +214,7 @@ It communicates with the target using a [SDSIO-Client interface](https://github.
214214
- [RTT](sdsio.md#using-rtt-interface) for communication via the RTT interface of a debug adapter (J-Link or pyOCD).
215215
- [Network](sdsio.md#using-network-interface) for TCP/IP communication via IoT Socket using MDK-Middleware, LwIP, or CMSIS-Driver WiFi.
216216

217-
SDS data streams are stored in `*.sds` files with the following naming convention:
218-
219-
`<stream-name>.<label>[.p].sds` (`[.p]` is added when the SDS data stream is recorded during the playback)
220-
221-
For more details, see the [Filenames section](theory.md#filenames).
222-
223-
The contents of `<name>.<label>[.p].sds` files are described by the metadata file `<name>.sds.yml` in [YAML format](https://github.com/ARM-software/SDS-Framework/tree/main/schema).
217+
SDS data streams are stored in file that use the format `<stream-name>.<label>[.p].sds`. See [Filenames](theory.md#filenames) for details. The contents of SDS data files are described by the [YAML metadata](https://github.com/ARM-software/SDS-Framework/tree/main/schema) file that use the format `<stream-name>.sds.yml`.
224218

225219
### Usage
226220

@@ -428,15 +422,15 @@ Then reload rules with `sudo udevadm control --reload && sudo udevadm trigger`.
428422
## SDS-View
429423

430424
The Python utility [**SDS-View**](https://github.com/ARM-software/SDS-Framework/tree/main/utilities) generates a time-based plot
431-
from data recorded in SDS files (`<name>.<label>.sds`) using the metadata provided in `<name>.sds.yml`.
425+
from data recorded in SDS files (`<stream-name>.<label>.sds`) using the metadata provided in `<stream-name>.sds.yml`.
432426

433-
The horizontal time scale is derived from the number of data points in a recording and frequency provided in the metadata description.
427+
The horizontal time scale is derived from the number of data points in a recording and `sample-frequency:` provided in the metadata description.
434428
All plots from a single recording are displayed on the same figure (shared vertical scale).
435429

436430
If there are 3 values described in the metadata file, an optional 3D view may be displayed.
437431

438432
!!! Note
439-
- SDS-View requires that all values in the [`*.sds.yml` metadata file](https://arm-software.github.io/SDS-Framework/main/theory.html#yaml-metadata-format) have the same data type (float, uint32_t, uint16_t, ...)
433+
- SDS-View requires that all values in the [`<stream-name>.sds.yml` metadata file](theory.md#sds-metadata-format) have the same data type (float, uint32_t, uint16_t, ...)
440434

441435
### Usage
442436

@@ -514,26 +508,28 @@ required:
514508

515509
```yml
516510
sds:
517-
name: Microphone
518-
description: Mono microphone with 16kHz sample rate
519-
frequency: 16000
511+
name: Mono
512+
description: Mono 16-bit PCM microphone
520513
content:
521-
- value: Mono
522-
type: int16_t
514+
- audio:
515+
sample-frequency: 16000
516+
bit-depth: 16
517+
audio-channels: 1
518+
format: pcm
523519
```
524520

525521
**Example of metadata yml file for stereo microphone:**
526522

527523
```yml
528524
sds:
529-
name: Microphone
530-
description: Stereo microphone with 16kHz sample rate
531-
frequency: 16000
525+
name: Stereo
526+
description: Stereo 16-bit PCM microphone
532527
content:
533-
- value: Left channel
534-
type: int16_t
535-
- value: Right channel
536-
type: int16_t
528+
- audio:
529+
sample-frequency: 44100
530+
bit-depth: 16
531+
audio-channels: 2
532+
format: pcm
537533
```
538534

539535
**Example:**
@@ -588,7 +584,7 @@ optional:
588584
sds:
589585
name: Gyroscope
590586
description: Gyroscope with 1667Hz sample rate
591-
frequency: 1667
587+
sample-frequency: 1667
592588
content:
593589
- value: x
594590
type: int16_t
@@ -734,11 +730,8 @@ required:
734730
sds:
735731
name: Video Stream - RGB888
736732
description: 192 x 192 RGB888 video frames
737-
frequency: 30
738733
content:
739-
- value: Frame
740-
type: uint8_t
741-
image:
734+
- image:
742735
pixel_format: RGB888
743736
width: 192
744737
height: 192
@@ -752,7 +745,7 @@ python sds-convert.py video -i Camera.0.sds -o Camera.mp4 -y Camera.sds.yml
752745
```
753746

754747
!!! Note
755-
- [Theory of Operation - Image Metadata Format](theory.md#image-metadata-format) contains more information about the supported video formats.
748+
- [Theory of Operation - Image Metadata Format](theory.md#image-data-stream) contains more information about the supported video formats.
756749

757750
## SDS-Check
758751

schema/README.md

Lines changed: 10 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,111 +1,17 @@
1-
# Synchronous Data Stream - File Format
1+
# Schema and Templates Files
22

3-
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 timeslot information that allows to correlate the data streams as it is for example required in a sensor fusion application.
3+
This folder contains:
44

5-
The binary data format (stored in `*.<n>.sds` data files) has a record structure with a variable size. Each record has the following format:
5+
## Schema for SDS Metadata file
66

7-
1. **timeslot**: record timeslot in tick-frequency (32-bit unsigned integer, little endian)
8-
2. **data size**: number of data bytes in the record (32-bit unsigned integer, little endian)
9-
3. **binary data**: SDS stream (little endian, no padding) as described with the `*.sds.yml` file.
7+
- Schema description [`sds.schema.json`](sds.schema.json) for SDS Metadata files.
8+
- [Audio format](./audio_format/) metadata file templates.
9+
- [Image format](./image_format/) metadata file templates
1010

11-
The content of each data stream is described in a [YAML](https://en.wikipedia.org/wiki/YAML) metadata file that is created by the user.
11+
See [SDS-Framework - Theory of Operation - SDS Metadata Format](https://arm-software.github.io/SDS-Framework/main/theory.html#sds-metadata-format) for detailed description.
1212

13-
## YAML Format
13+
## Schema for SDSIO Control file
1414

15-
The following section defines the YAML format of this metadata file. The file `sds.schema.json` is a schema description of the SDS Format Description.
15+
- Schema description [`sdsio.schema.json`](sdsio.schema.json) for SDS Metadata files.
1616

17-
`sds:` | Start of the SDS Format Description
18-
:------------------------------------|---------------------------------------------------
19-
&nbsp;&nbsp;&nbsp; `name:` | Name of the Synchronous Data Stream (SDS)
20-
&nbsp;&nbsp;&nbsp; `description:` | Additional descriptive text (optional)
21-
&nbsp;&nbsp;&nbsp; `frequency:` | Capture frequency of the SDS
22-
&nbsp;&nbsp;&nbsp; `tick-frequency:` | Tick frequency of the timeslot value (optional); default: 1000 for 1 millisecond interval
23-
&nbsp;&nbsp;&nbsp; `content:` | List of values captured (see below)
24-
25-
`content:` | List of values captured (in the order of the data file)
26-
:------------------------------------|---------------------------------------------------
27-
`- value:` | Name of the value
28-
&nbsp;&nbsp;&nbsp; `type:` | Data type of the value
29-
&nbsp;&nbsp;&nbsp; `offset:` | Offset of the value (optional); default: 0
30-
&nbsp;&nbsp;&nbsp; `scale:` | Scale factor of the value (optional); default: 1.0
31-
&nbsp;&nbsp;&nbsp; `unit:` | Physical unit of the value (optional); default: no units
32-
&nbsp;&nbsp;&nbsp; `image:` | Image format metadata (optional)
33-
34-
### Image Format Metadata Fields
35-
36-
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.
37-
38-
`image:` | Image stream metadata (all fields required except where noted)
39-
:------------------------------------|---------------------------------------------------
40-
&nbsp;&nbsp;&nbsp; `pixel_format:` | Pixel format identifier (enum)
41-
&nbsp;&nbsp;&nbsp; `width:` | Number of pixels per row (integer, minimum: 1)
42-
&nbsp;&nbsp;&nbsp; `height:` | Number of rows (integer, minimum: 1)
43-
&nbsp;&nbsp;&nbsp; `stride_bytes:` | Bytes per row for single-plane formats (required for single-plane)
44-
&nbsp;&nbsp;&nbsp; `planes:` | Per-plane stride array for multi-plane formats (required for multi-plane)
45-
46-
The `pixel_format` field accepts the following identifiers:
47-
48-
- **Single-plane formats**: `RAW8`, `RAW10`, `RGB565`, `RGB888`, `YUYV`, `UYVY`
49-
- **Multi-plane formats**: `NV12`, `NV21`, `I420`, `NV16`, `NV61`, `YUV422P`, `YUV444`, `YUV444P`
50-
51-
## Examples
52-
53-
### Sensor Data Stream
54-
55-
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).
56-
57-
![image](https://user-images.githubusercontent.com/8268058/208393980-ebe82918-625b-46d7-8f16-74590f8e1ea2.png)
58-
59-
The binary data that are coming form this sensors are stored in data files with the following file format: `<sensor-name>.<file-index>.sds`. In this example the files names could be:
60-
61-
```yml
62-
sensorX.0.sds # capture 0
63-
sensorX.1.sds # capture 1
64-
```
65-
66-
The following `sensorX.sds.yml` provides the format description of the SDS `sensorX` binary data files and maybe used by data conversion utilities and data viewers.
67-
68-
```yml
69-
sds: # describes a synchronous data stream
70-
name: sensorX # user defined name
71-
description: Gyroscope stream with 1KHz, plus additional user data
72-
frequency: 1000
73-
content:
74-
- value: x # Value name is 'x'
75-
type: uint16_t # stored using a 16-bit unsigned int
76-
scale: 0.2 # value is scaled by 0.2
77-
unit: dps # base unit of the value
78-
- value: y
79-
type: uint16_t
80-
scale: 0.2
81-
unit: dps
82-
- value: z
83-
type: uint16_t
84-
unit: dps # scale 1.0 is default
85-
- value: temp
86-
type: float
87-
unit: degree Celsius
88-
- value: raw
89-
type: uint16_t # raw data, no scale or unit given
90-
- value: flag
91-
type: uint32_t:1 # a single bit stored in a 32-bit int
92-
```
93-
94-
### Video Frame Stream
95-
96-
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.
97-
98-
```yml
99-
sds:
100-
name: Camera stream
101-
description: RGB888 video capture at 30 fps
102-
frequency: 30
103-
content:
104-
- value: frame
105-
type: uint8_t
106-
image:
107-
pixel_format: RGB888
108-
width: 640
109-
height: 480
110-
stride_bytes: 1920 # 640 pixels * 3 bytes/pixel
111-
```
17+
See [SDS-Framework - Utilities - SDSIO Control File](https://arm-software.github.io/SDS-Framework/main/utilities.html#sdsio-control-file-sdsioyml) for detailed description.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sds:
2+
name: Mono
3+
description: Mono 16-bit PCM microphone
4+
content:
5+
- audio:
6+
sample-frequency: 16000
7+
bit-depth: 16
8+
audio-channels: 1
9+
format: pcm
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
sds:
2+
name: Stereo
3+
description: Stereo 16-bit PCM microphone
4+
content:
5+
- audio:
6+
sample-frequency: 44100
7+
bit-depth: 16
8+
audio-channels: 2
9+
format: pcm

0 commit comments

Comments
 (0)