Vital File Format #522

Teunis (2022-10-18 08:32) · 489 view(s) · 1 comment(s)

In the description of the "TRKINFO" (Structure for track information) on page 6, there's specified "recfmt".

I assume the storage space width expressed in bytes is the following:

FMT_FLOAT 4 bytes

FMT_DOUBLE 8 bytes

FMT_CHAR 1 byte

FMT_BYTE 1 byte

FMT_SHORT 2 bytes

FMT_WORD 2 bytes

FMT_LONG 4 bytes

FMT_DWORD 4 bytes

Is my assumption correct?

 

Second question, all these formats are "signed" and use 2nd complement?

 

Also, FMT_FLOAT and FMT_DOUBLE are specified according to IEEE 754?   https://en.wikipedia.org/wiki/IEEE_754-1985" target="_blank">https://en.wikipedia.org/wiki/IEEE_754-1985

Thanks.

TvB

 


vitaldb2017 (2022-11-29 04:27)
Sorry for the late response.
For the first question, your assumption is correct.
For the second question, FMT_FLOAT and FMT_DOUBLE follow the IEEE-754, but FMT_BYTE, FMT_WORD, and FMT_DWORD are unsigned, while other types are signed.
You can use the open-source implementations for reading the vital file format in Python, Javascript and C/C++.
https://github.com/vitaldb/vitalutils/blob/master/python/vitaldb-pypi/vitaldb/utils.py
https://github.com/vitaldb/vitalutils/blob/master/Javascript/vitaldb.js
https://github.com/vitaldb/vitalutils/blob/master/C%2B%2B/vital_recs.cpp