Michael Chourdakis
Michael Chourdakis

Reputation: 11178

HDR video publishing

I'm relative new to HDR and I'm trying to understand the color transfer functions. The idea is to produce a YouTube-compatible HDR video.

So I manage to create a Direct2D surface with DXGI_FORMAT_R16G16B16A16_FLOAT and use GUID_WICPixelFormat128bppPRGBAFloat bitmaps and my primitives have a full color range as well.

I can convert these bitmaps to 10-10-10-2 DWORD (10-bit) with WIC (from GUID_WICPixelFormat128bppPRGBAFloat to GUID_WICPixelFormat32bppRGBA1010102) and use the NVidia NvEnc H.265 with NV_ENC_HEVC_PROFILE_MAIN10_GUID and NV_ENC_BUFFER_FORMAT_ABGR10 buffers.

So far, so good. My app produces a 10-bit YUV video which plays correctly in Windows and also can be correctly loaded with Media Foundation in my editor later on.

The troubles begin when I specify in the NVEnc color transfers. As far as I understand, the color transfer modes describe the way to translate color values into light for HDR displays.

When I put the PG or HLG specs to NvEnc:

ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.videoSignalTypePresentFlag = 1;
ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.videoFormat = NV_ENC_VUI_VIDEO_FORMAT_UNSPECIFIED;
ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.videoFullRangeFlag = 0;
ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.colourDescriptionPresentFlag = 1;
ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.colourPrimaries = NV_ENC_VUI_COLOR_PRIMARIES_BT2020;
ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.transferCharacteristics = NV_ENC_VUI_TRANSFER_CHARACTERISTIC_SMPTE2084;                            ne.encodeCodecConfig.hevcConfig.hevcVUIParameters.colourMatrix = NV_ENC_VUI_MATRIX_COEFFS_BT2020_NCL;

the result video is recognized in YouTube as HDR but it plays badly, colors are heavily distorted (same in Windows Player).

The question is, how do I need to pre-process my RGB10 input in order to be correctly transferred with PQ or HLG?

I was suggested OpenColorIO, I'm not very much sure how to proceed from now on.

Reading stuff in https://www.lightillusion.com/what_is_hdr.html, there's a PQ table:

10,000 nits = 1023
5,000 nits = 948
4,000 nits = 924
2,000 nits = 847
1,000 nits = 769
400 nits = 668
100 nits = 519
0 nits = 0

Does that mean that I have to transform the color's linear luminance to these levels somehow?

Upvotes: 0

Views: 104

Answers (0)

Related Questions