Implement support for encoding HDR10+ from JSON metadata file by quietvoid · Pull Request #3000 · xiph/rav1e

The goal of this PR is to allow users to encode HDR video with HDR10+ metadata, in compliance with the AV1 HDR10+ specification.

In the current state, the changes make it possible to encode HDR10+ for both CLI and Rust API usage.

From CLI, the metadata is expected to be passed as a JSON metadata file, which follows the same format as encoders like x265.
The metadata parsing/encoding is done through the hdr10plus crate.
The library is probably less than ideal but it should be fine to parse things at init.

The CLI opt can be either --hdr10plus-json or --dhdr10-info (used by x265)

From Rust, the metadata must be encoded into the final T.35 and provided for the frames that require it.

Output bitstream validated with the AOM AV1 HDR10+ Validator.

Starting this as a draft, as some things need to be improved;

  • Behaviour when some parsed metadata is invalid.
    • Either the encoder has to abort, or keeps going with an incomplete map of frame<->metadata.
  • Need to make the ST2094-40 prefix const.
  • Improve comments.
  • ... probably more, feedback welcome.