Serialization icon

Binary hierarchical serialization

This article is about the binary hierarchical serialization, standardly used by Axis to serialize its media.

It is used for the AXS and AXI file formats.

It represents a simple data structure, where data is stored as a binary chunks, each starting with a header which contains an identifier to denote the contained data semantic and a value of the contained data size.

Each chunk may contain other chunks, thus creating a hierarchical structre.
The size of the subchunks, along with the size of their headers, is added to the data size value of the parent chunk.

This structuring has several advantages

  • A reader unfamiliar with certain data chunks can simply skip them
  • Naturally backward compatible
  • Quick access to any particular data chunk without traversing the whole data stream
  • Easily extendable by just adding new chunks instead of changing the serialization format

The header of a chunk consists of a 32-bit unsigned integer value for data identifier, followed by a 64-bit unsigned integer value for data size, followed by data raw data itself.

Axis has this serialization implemented in the HierarchicalStreamReader and HierarchicalStreamWriter classes

Hierarchical Serialization