Skip to content

copy HDR10+ and T35 metadata only to visible frames

Currently the placement of T35 metadata within a temporal unit matters, and it's not clear from the "AV1 Bitstream & Decoding Process Specification" that it should.

Given an OBU with a temporal unit with one more more hidden frames and one shown frame:

Broken

before_hidden_frame

If the T35 metadata appears after the OBU header, and therefore before a show_frame=0 rather than immediately preceding the show_frame=1 frame, then the decoder will associate it with the hidden frame during decoding, and and clear it. By the time the shown frame is returned this metadata has been lost.

Works

before_show_frame

If the T35 metadata appears right before the show_frame=1 then the decoder will correctly associate it with the returned frame. This works if the encoder places the metadata right before the shown frame, such as the way it's implemented in SVT-AV1 at https://gitlab.com/AOMediaCodec/SVT-AV1/-/blob/master/Source/Lib/Codec/packetization_process.c#L792-796

The fix

If we only attach (and then clear) T35 metadata to a shown frame both of these OBU layouts are correctly handled. Since the handling of T35 is now bundled together with content light and mastering display metadata I've applied the fix to the entire unit to avoid breaking the encapsulation of dav1d_picture_copy_props, although it shouldn't matter for CLL and MDCV metadata since it does not get cleared.

I can update this fix to separate out T35 metadata handling from the rest if desired.

Merge request reports