Parameter header

The C3D file header contains a pointer (Word 1) to the first block of the parameter section in the C3D file.  The pointer is a byte value that indicates the 512-byte block number of the first block of the parameter section counting the C3D header as block one.  The first four bytes of the parameter section contain the following parameter record header:

Byte

Typical Value

Description

1

0x00 hex

Reserved for parameter file use.

2

0x00 hex

Reserved for parameter file use.

3

Nn

Number of parameter blocks to follow (see below).

4

85

83 decimal + processor type.

 Processor type 1 = Intel

 Processor type 2 = DEC (VAX, PDP-11)

 Processor type 3 = MIPS processor (SGI/MIPS)

Figure 8 – The parameter section header in a C3D file.

The first two bytes of the parameter record are only meaningful if they also form the first word of the file – this is because the more general ADTech file format requires the first byte of a file to point to the first parameter block and the second byte to contain decimal 80.  Hence, these two bytes are always ignored in C3D files.

Although not required, it is a good idea to preserve the values of these two bytes when reading and re-writing C3D files in order to maintain compatibility with some older software applications that may not be fully C3D compliant and may expect to find parameter file values in these locations.  This is because one common technique for creating C3D files used to be to maintain a parameter “template” as a separate file – an application could then simply create a header block and append the parameter file and data.  This technique resulted in the parameter section containing non-zero bytes in the first word, which casual programmers assumed (incorrectly) were valid flags or pointers.

Figure 9 – A hex dump of a parameter section header record with an invalid first word.

The third byte of the parameter header contains a count of the number of 512-byte blocks within the parameter section, counting the first block that contains the parameter header record as block 1.  This effectively sets the size of the parameter section storage allocation within the C3D file.  In the example shown the parameter section occupies nine 512-byte blocks.

Although it is not explicitly stated in the original C3D format description, it may be assumed that the third byte is interpreted as an unsigned byte value with a range of 0 to 255.  This allows C3D files to contain up to 127.5kB of data in the parameter section.

The inclusion of the processor type as byte four of the parameter header enables any program accessing the parameter and data files to determine the internal format of the floating-point numbers and signed integer numbers within the C3D file.  Note that there is no requirement to use any specific number format so long as the correct format is indicated in the parameter header at the start of the parameter section and is used throughout the C3D file.  The example shown has a processor type of 0x55h (85 decimal) indicating that the DEC internal number conventions are used within this file.  A fully compliant C3D application should be able to handle all number formats.  Typically, the number format will be determined by the computer that writes the file, but it is not difficult to translate all numbers to another number structure format on file output.

It is probably worth noting at this point that while the ability to store data in both floating point and integer format is useful, most software applications should probably choose one processor type format as default.  Most new applications appear to use Intel (processor type 1) but also read DEC and MIPS for compatibility with other manufacturers.  As a rule, integer files are half the size of their floating-point counterparts and are usually faster to open and perform read/write operations.  However, floating point files offer the ability to store a greater range of data values which is significant when analog data is filtered or otherwise processed.

More:

Notes for Programmers - Parameters