HDR -> SDR conversion

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

Re: HDR -> SDR tonemapping

Post by admin » Mon Jul 09, 2018 9:38 am

3 minutes is great, dmcs. Thanks for the sample. Investigating...

Maybe we need something like madVR's adaptive light setting.

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin » Mon Jul 09, 2018 9:45 am

@dmcs

Can you tell me how that bigger sample came to be? Is it from a UHD bluray? How was it processed? If it is from a UHD bluray, it would be much better for me to get the m2ts file. One problem with the mkv is that we don't know for sure all the metadata is being preserved.

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin » Mon Jul 09, 2018 11:15 am

Bingo! Pretty sure I've found the problem. I was clipping the out-of-gamut RGB before applying the tonemapping. Duh. Of course we should do it after, because the tonemapping is going to pull lots of super-bright pixels into gamut. After changing this I get good results even with light as bright as light=100. By good I mean the bright blob at frame 2676 does not expand and completely lose its detail. The mobius settings for it are trans=0.8, peak=5.0. They won't help you though until I release the fixed version. I will do that after a little more experimentation.

I said this in reply to Narkyy:

"light = 160 is way too low, in my opinion. Don't blame me for blown out areas with that light setting."

Eating humble pie as Narkyy was right to choose that light level. We can go even brighter without blowing out the highlights with the change described above.

dmcs
Posts: 32
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping

Post by dmcs » Mon Jul 09, 2018 11:43 am

admin wrote:
Mon Jul 09, 2018 9:45 am
@dmcs

Can you tell me how that bigger sample came to be? Is it from a UHD bluray? How was it processed? If it is from a UHD bluray, it would be much better for me to get the m2ts file. One problem with the mkv is that we don't know for sure all the metadata is being preserved.
Yeah, I used MKVToolNix to trim the file from the UHD remux. The mediainfo from the m2ts file and the mkv one are identical.

m2ts: https://p.teknik.io/Me5TA
mkv: https://p.teknik.io/LU6MD

And boy, am I glad to hear you're figuring things out. :D :D

Edit: The only metadata missing from mkv is the Dolby Vision. It's not supported by matroska yet.

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin » Mon Jul 09, 2018 12:32 pm

Now I've figured out the cause of the blockiness compared to the original and madVR. I was always clipping R/G/B < 0.0 to 0.0. I need to tonemap them back into 709 range also instead of just clipping them.

@dmcs

Is this sample known to be Dolby Vision?

dmcs
Posts: 32
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping

Post by dmcs » Mon Jul 09, 2018 12:47 pm

admin wrote:
Mon Jul 09, 2018 12:32 pm
@dmcs

Is this sample known to be Dolby Vision?
I'm not sure what you meant. m2ts has Dolby Vision metadata. mkv sample file doesn't.
Here's the full mediainfo of the m2ts file.

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin » Mon Jul 09, 2018 12:53 pm

Yes, I meant the m2ts. Thank you.

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin » Mon Jul 09, 2018 1:25 pm

Another cause of blockiness! I apply tonemapping individually to R, G, and B. This causes hue shifts depending on how the individual components are mapped. I have to apply it to the lightness L. So I am going to redesign everything to work in CIELAB space and apply tonemapping to the L of darks and lights to bring them into range of 709. If there are any out-of-gamut colors left then I'll decide what to do with them. If they are sparse I can just clip them. If not, maybe desaturate them. We'll see.

Finally thinking I might be understanding things. :lol:

dmcs
Posts: 32
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping

Post by dmcs » Mon Jul 09, 2018 1:34 pm

:salute: :salute:

Narkyy
Posts: 51
Joined: Thu May 25, 2017 11:51 pm

Re: HDR -> SDR tonemapping

Post by Narkyy » Mon Jul 09, 2018 1:44 pm

That would cause issues like this as well right? Not just in highlights

Image

Thank you for the hard work :hat:

Post Reply