This version of this project implements parsers and formatters for:
- ISO/IEC 23090-5:2024 Video-based visual volumetric coding (V3C)
- ISO/IEC 23090-12:2024 MPEG immersive video (MIV)
This project provides:
- V3C syntax structure coders, automatically generated from the specifications:
- Parsing by the
parsemethods - Parsing and printing by the
printmethods - Formatting by the
formatmethods - Bit counting by the
count_bitsmethods - More could be added if needed, e.g.
operator !=
- Parsing by the
- High-level syntax (HLS) support library
- V3C sample stream parser that prints all names, values and bit positions
- V3C sample stream demuxer code example
- Representative unit tests for all coders also serve as code example
Requirements:
- C++20 compiler toolchain
- Catch2 for unit testing
This project was derived from a Philips-internal project:
Bart Kroon, [V3C][MIV] V3C library generated from specification text, ISO/IEC JTC 1/SC 29/WG 7 MPEG/M75027, Online, January 2026.
The C++20 code generator maps the syntax and semantics as follows onto C++:
| JTC1 specification construct | C++ construct |
|---|---|
| Specification | Namespace |
| Syntax structure | Class with pimpl pattern and coding methods |
| Syntax element | Getters and setters on the class |
| Descriptor | Using declarations + hls support library |
| Dependent syntax structure | Syntax structures instantiations are combined in a struct v3c_coder::structures |
| Parsing dependency | The coders are passed as the ctx reference and they have a structures() method to access parsing dependencies |
| Shared syntax structure (see below) | Solved by having all in one structure, so the semi-hierarchical structure is not replicated |
| Free functions | Functions in hls namespace or members functions of the coders |
| Global variables | Data members of the v3c_coder::variables struct accessible through the variables() method of the coders |
| Decoder implementation | Something that has a hls::parser that hooks into the various signals like on_nal_unit to run decoding processes |
| Encoder implementation | Something that has a hls::formatter that sets all the syntax elements and calls the format functions |
Some considerations:
- The design in general favors value types over references.
- The original design was based on the visitor pattern, having only one visitor for all coders but this made the project slow and difficult to compile because the compiler has full visibility on everything.
- The current design has generated code for each separate coder.
- Each coder is in a separate static library to reduce the build time and binary size and avoid having all the strings in the project if printing is not needed.
- Decoders based on this project need to use the enter and leave hooks to execute decoding processes at the right moment:
- Syntax structures that occur multiple times in a bitstream like
nal_unit_headerare rewritten.
- Syntax structures that occur multiple times in a bitstream like
The C++ V3C parser was created and tested by parsing MIV and V-PCC conformance bitstreams and comparing the log-files with those of the respective test models, TMIV and TMC2. Achieving full coverage in that way, there was no need to create many unit or developer tests. The ones that were created serve to test specific features of the code generation or specifications. The following executables are available for direct use and as a code example:
parse_v3c_sample_stream: print all syntax structures and syntax elements in bitstream order.demux_v3c_sample_stream: print the top-level syntax structures and syntax elements in bitstream order, withon_vps,on_v3c_unitandon_nal_unitcallbacks.
To ensure good code quality the CMake presets enable a the following categories of warnings on all supported compilers:
- All
- Extra
- Pedantic
- Shadowing
- Conversions
- Unreachable code
No warnings had to be disabled.
To ensure good code quality Clang Tidy is run with the most important categories of checks:
- Bugprone
- Performance
The following categories were not enabled:
- C++ core guidelines: It is to much work to pass some of these tests and in general that is not that useful.
- Modernization: This code is modern, using C++20 aspects mainly to make the code shorter and more readible, and running the tests takes time.
- Readibility: This code is based on a specification that follows a C-like convention and mindset. That makes it hard to cover all aspects of readibility. Also these checks take time so they are not for free.
The following checks were disabled:
bugprone-easily-swappable-parameters: The syntax structure parameters all have the same type. Not sure how to avoid that in a meaningful way.bugprone-exception-escape: We have encountered some false alarms, so we disable warnings-as-errors for this one.
Below graph visualizes the CMake module dependencies of the C++ coder project. Notably, because V3C and MIV form a circular reference in the specification, miv_lib is just an alias for v3c_lib.
wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-25/wasi-sdk-25.0-x86_64-linux.tar.gz
tar xaf wasi-sdk-25.0-x86_64-linux.tar.gz
rm wasi-sdk-25.0-x86_64-linux.tar.gz
mv wasi-sdk-25.0-x86_64-linux path/to/wasi-sdkexport WASI_SDK="path/to/wasi-sdk
cmake --list-presetscmake --preset wasm-debug
cmake --build --preset wasm-debugGo to root folder of the project and run
python3 -m http.serverOpen web browser and paste
http://localhost:8000/html/wasm_viewer.html
You can use conformance bitstream to test the parser.