HDR -> SDR tonemapping

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

Re: HDR -> SDR tonemapping

Post by admin » Sun Jun 03, 2018 2:05 pm

You're welcome and thanks for pointing out HDRTools. I'll definitelt check it out. Looks like jpsdr has done some serious research on all this.

Don't forget that I'm going for speed and that way looks a bit sluggish.

BTW, don't you use DGSource()? If you have an nVidia card I'll give you a free license.

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

Re: HDR -> SDR tonemapping

Post by Narkyy » Sun Jun 03, 2018 2:14 pm

Yes, it is slow. I'm just mentioning it because the conversions seem accurate.

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

Re: HDR -> SDR tonemapping

Post by admin » Sun Jun 03, 2018 2:29 pm

Yes, I'm interested to see what he is doing for gamut mapping. Going through XYZ space is interesting but can be slow.

I'm probably going to open source my plugin code too at some point.

Check the last line in my previous post.

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

Re: HDR -> SDR tonemapping

Post by Narkyy » Sun Jun 03, 2018 2:34 pm

I have a license already, I just can't use it for HEVC ;)

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

Re: HDR -> SDR tonemapping

Post by admin » Sun Jun 03, 2018 2:45 pm

Ah, wrong card!

Timings for prefetch=6 on my i7-7700K + 1080 Ti:

HDRTools: 15.25 fps
DGHDRtoSDR: 102.4 fps

Don't know if I have maxed out HDRTools because the multithreading instructions are a bit complicated and confusing (to me). I'm not sure I like the idea of internal multithreading in the filters.

douzi
Posts: 6
Joined: Fri May 25, 2018 3:28 am

Re: HDR -> SDR tonemapping

Post by douzi » Sun Jun 03, 2018 5:22 pm

Thank you for the new implementation, I'll try out later.

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

Re: HDR -> SDR tonemapping

Post by admin » Thu Jun 07, 2018 2:11 pm

FYI guys, the sat parameter is broken and is fixed at 1.5. I'll fix that in the next release. Fortunately, 1.5 is a reasonable value. ;)

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

Re: HDR -> SDR tonemapping

Post by admin » Thu Jun 07, 2018 4:29 pm

I figured out how to determine which pixels are outside the 709 gamut.

* Convert 10-bit YUV to normalized [0,1] float RGB (still nonlinear).

* Linearize by applying ST.2084 PQEOTF.

* Convert to CIE XYZ space. Use the matrix from:

http://www.russellcottrell.com/photo/ma ... ulator.htm

* Project to obtain the the x and y values of the CIE colorspace.

* Test if the x,y value falls outside the triangle defined by the 709 color primaries.

This will enable me to test different nonlinear (i.e., different action on in-gamut and out-of-gamut) gamut mappings.

I'm starting to actually grok all this stuff.

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

Re: HDR -> SDR tonemapping

Post by Narkyy » Mon Jun 18, 2018 11:21 am

Thanks for the update :salute:

There seems to be some issues with the tonemap parameters
none and mobius are returning the same result, and hable is very dark in <150 luma (light param only affects high luma areas)
Also the saturation looks off, the reds are unsaturated for some reason.

In order: default, hable, HDRTools
1.png
1.png (1.32 MiB) Viewed 62 times
2.png
2.png (829.75 KiB) Viewed 62 times
3.png
3.png (1.32 MiB) Viewed 62 times

I didn't save the previous plugin version but the colors with inverse looked like HDRTools.

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

Re: HDR -> SDR tonemapping

Post by admin » Mon Jun 18, 2018 11:56 am

Thank you for your testing.

mobius and none are not the same. Check the detail in the clouds right around the left of the left-hand rider and the green tone in the clouds for none in the samples below. Mobius is subtle but definitely improves colors and details in the brighter areas. The first is:

dghdrtosdr(impl="255",tm="none",sat=1.00,light=250)

and the second is:

dghdrtosdr(impl="255",tm="mobius",sat=1.00,light=250)

You can try a sat=1.25 to increase the saturation. I would look at HDRTools but it's all hard-core ASM with no C version, so it may be difficult to compare what I am doing to that. I expect that the difference here is due to the gamut mapping, which I am still studying. To me, the HDRTools soldier's face looks a bit too red.

Regarding Hable, I hate Hable. I simply don't understand the parameters at all, so I cannot tell if it is working correctly. Can you give me that sample please? Also, try increasing the exp parameter to something like 10.

none.bmp
none.bmp (23.73 MiB) Viewed 55 times
mobius.bmp
mobius.bmp (23.73 MiB) Viewed 55 times

Post Reply