HDR PQ to HLG

These CUDA filters are packaged into DGDecodeNV, which is part of DGDecNV.
Post Reply
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

HDR PQ to HLG

Post by admin »

I have the basic HDR PQ to HLG chain working fine. It's currently outputting the HLG to YV12 (because I had the code from DGHDRtoSDR) so it acts as a form of HDR->SDR conversion, showing the property people talk about of HLG looking OK when played as SDR 709. Honestly, though, I think that property is overblown because it seems some gamut mapping and tone mapping can still be beneficial for display on a SDR device and the result is clearly worse without those.

So I'm adding full depth YUV420P16 output (have to make a 10-bit 2020 RGB->YUV conversion) so that it can act as a pure PQ->HLG transcode, outputting 2020 HDR HLG in 16 bits. YV12 versus YUV420P16 output will be selectable via a parameter. Then everything over to CUDA and Bob's your uncle.
DAE avatar
Guest

Re: HDR PQ to HLG

Post by Guest »

Looks like you have been busy,
and who is this Bob guy? ;)
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR PQ to HLG

Post by admin »

gonca wrote:
Sun Jul 01, 2018 8:15 pm
who is this Bob guy?
Bob's your uncle.

https://en.wikipedia.org/wiki/Bob%27s_your_uncle
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR PQ to HLG

Post by admin »

Here's a first version for y'all. Feedback appreciated. It implements the process given in the BBC white paper with a fix to avoid divide by zero when applying gamma to RGB = 0,0,0. Why didn't they mention that? ;)

http://rationalqm.us/misc/DGPQtoHLG_1.0.rar

It runs at 96 fps on my i7 7700K 1080 Ti system for 3840x2160. That's a bit slower than DGHDRtoSDR because it outputs P16 so the GPU transfer load is increased. For these large frames the GPU transfer bandwidth is a much more significant factor than the kernel execution.

I decided not to have an option for outputting YV12 because it is so easy to add ConvertBits(8) in your script. And anyway, HDR->SDR using that process is a poor way to convert to SDR. Use DGHDRtoSDR for that.
DAE avatar
Guest

Re: HDR PQ to HLG

Post by Guest »

Your plugin does a good job, when video is played back in either SDR or HDR
I guess that with this plugin people can make one single backup for playback on SDR or HDR devices
Well done
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR PQ to HLG

Post by admin »

Thanks for the positive assessment but I repeat again that it is suboptimal for HDR->SDR and I discourage that. The real purpose is to transcode from PQ to HLG for use in HLG displays and ecosystems.

PQ and HLG are two very different approaches. PQ is absolute with respect to brightness (display-referred) while HLG is relative (scene-referred). HLG is better suited for broadcasting and it can be argued that PQ has shot itself in the foot for the days when we have really bright displays (content will have to be remastered). HLG also does not require metadata. There will be competition between the two and we will see which prevails. In the meantime, it can't be bad to have a way to go PQ->HLG. Nobody seems to be asking for the reverse. ;)
DAE avatar
Guest

Re: HDR PQ to HLG

Post by Guest »

Agreed, HDR PQ to HLG is a "poor mans version" of HDRtoSDR
HLG was developed for broadcasting with backward compatibility in mind, a single stream can be used by HDR or SDR displays.
For streaming, or local playback, HDR is the way to go
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR PQ to HLG

Post by admin »

gonca wrote:
Mon Jul 02, 2018 4:32 pm
HLG was developed for broadcasting with backward compatibility in mind, a single stream can be used by HDR or SDR displays.
OK, but only if you qualify the SDR as BT.2020 10-bit. When one says "SDR" one usually means BT.709 8-bit HD displays.

The BBC page best describes what the "backward compatibility" is all about. That things seem to look "OK" on a BT.709 8-bit display is a coincidence, not a design goal of the HLG system.

https://www.bbc.co.uk/rd/projects/high-dynamic-range
DAE avatar
Guest

Re: HDR PQ to HLG

Post by Guest »

OK, but only if you qualify SDR here as BT.2020. When one says "SDR" one usually means BT.709 HD displays.
You are quite correct on this
The correct wording should have been
HLG was designed to be compatible with HDR and SDR displays

Didn't mean to imply that it displays HDR on HDR displays and SDR on SDR displays
It is a bandwidth reduced format for broadcasting
Either way
a proper hdr to sdr is still better quality
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR PQ to HLG

Post by admin »

You know me, always a stickler for precision. You had it right, but I had to pick nits. Nits, get it? :twisted:
DAE avatar
Guest

Re: HDR PQ to HLG

Post by Guest »

:lol:
Post Reply