Page 14 of 24

Re: HDR -> SDR tonemapping

Posted: Sun Jun 03, 2018 2:05 pm
by admin
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.

Re: HDR -> SDR tonemapping

Posted: Sun Jun 03, 2018 2:14 pm
by Narkyy
Yes, it is slow. I'm just mentioning it because the conversions seem accurate.

Re: HDR -> SDR tonemapping

Posted: Sun Jun 03, 2018 2:29 pm
by admin
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.

Re: HDR -> SDR tonemapping

Posted: Sun Jun 03, 2018 2:34 pm
by Narkyy
I have a license already, I just can't use it for HEVC ;)

Re: HDR -> SDR tonemapping

Posted: Sun Jun 03, 2018 2:45 pm
by admin
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.

Re: HDR -> SDR tonemapping

Posted: Sun Jun 03, 2018 5:22 pm
by douzi
Thank you for the new implementation, I'll try out later.

Re: HDR -> SDR tonemapping

Posted: Thu Jun 07, 2018 2:11 pm
by admin
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. ;)

Re: HDR -> SDR tonemapping

Posted: Thu Jun 07, 2018 4:29 pm
by admin
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.

Re: HDR -> SDR tonemapping

Posted: Mon Jun 18, 2018 11:21 am
by Narkyy
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
2.png
3.png

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

Re: HDR -> SDR tonemapping

Posted: Mon Jun 18, 2018 11:56 am
by admin
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
mobius.bmp

Re: HDR -> SDR tonemapping

Posted: Mon Jun 18, 2018 12:23 pm
by Narkyy
You're right, there's a difference between none and mobius mostly only in highlights, mobius being much better at retaining detail and not overblowing the lighting.

However the colors are still off, and increasing saturation doesn't restore the reds.
I managed to get the old 1.2 version of the plugin and the colors are much better.

In order: none, mobius, old plugin
1.png
2.png
3.png
I don't really care about Hable either anymore, but I'm not sure it's a problem with Hable as it works properly on the old plugin.


Tested HDRTools with the different chromacity parameters
1 is Gx=0.265, Gy=0.690, Bx=0.150, By=0.060, Rx=0.680, Ry=0.320 (BT2100, from the github page)
2 is Gx=0.170, Gy=0.797, Bx=0.131, By=0.046, Rx=0.708, Ry=0.292 (BT2020, from the code)

4.png
5.png

Re: HDR -> SDR tonemapping

Posted: Mon Jun 18, 2018 12:57 pm
by admin
That's great info, thanks. Can I get the source file to be able to investigate all this? Thank you.

Re: HDR -> SDR tonemapping

Posted: Mon Jun 18, 2018 3:34 pm
by Narkyy
Here's a small sample of the part
https://mega.nz/#!AVliwIqa!XSnOsoEAMGG8 ... R9hW8QvtYE

Script for HDRTools 0.1, it errors with the latest 0.2 for some reason.
ConvertYUVtoXYZ(Color=0,OutputMode=1, Gx=0.170,Gy=0.797,Bx=0.131,By=0.046,Rx=0.708,Ry=0.292,Wx=0.31271,Wy=0.32902)
ConvertXYZ_HDRtoSDR(MinMastering=1, MaxMastering=1000,Coeff_X=26, Coeff_Y=26, Coeff_Z=26)
ConvertXYZtoYUV(Color=2, OutputMode=2, pColor=0)
z_ConvertFormat(pixel_type="YV12")

Re: HDR -> SDR tonemapping

Posted: Mon Jun 18, 2018 3:37 pm
by admin
Great, thank you.

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 10:01 am
by admin
@Narkyy

Please re-download version 1.4 as I have slipstreamed a fix for the colors issue. Looks good to me although, again, this may not be my final gamut mapping solution.

http://rationalqm.us/misc/DGHDRtoSDR_1.4.rar

@douzi

For your stream with the blown-out heater set light=400-500 for good results with this new version. I am working on a heuristic to set light automatically based on the metadata and video content.

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 10:16 am
by admin
Re-download one more time. I had the old version up instead of the new one. It is updated now.

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 1:48 pm
by Narkyy
It looks good now, pretty much the same colors as HDRTools :hat:
Also where has Mobius been all this time? It's amazing the control you can have over highlights, which Hable didn't have :bow:

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 2:50 pm
by admin
Thanks for the testing, Narkyy. The mobius concept comes from MPV with some of my own changes and implemented for CUDA of course. I like it because the parameters are simple and easy to understand, whereas Hable...oy. Maybe Hable can give similar results, but good luck finding the parameter combination.

HDRTools will be fixed shortly for the issue you mentioned, according to the author.

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 5:24 pm
by Dion
Was never a fan of Hable but I did like Reinhard but it had issues.. Looks like mobius solved alot of those issues.

The amount of work you put into this is incredible.. :bravo:

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 6:06 pm
by admin
Thanks, HDR to SDR is a niche area but I like showing off what CUDA can do.

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 9:39 pm
by dmcs
In the manual of the version 1.4 says that the "gamma" parameter has a default value of 1.42. Could this be a typo?

Re: HDR -> SDR tonemapping

Posted: Tue Jun 19, 2018 11:32 pm
by Narkyy
dmcs wrote:
Tue Jun 19, 2018 9:39 pm
In the manual of the version 1.4 says that the "gamma" parameter has a default value of 1.42. Could this be a typo?
Yes it's still following previous versions with default at 0.42

Re: HDR -> SDR tonemapping

Posted: Wed Jun 20, 2018 6:20 am
by admin
dmcs wrote:
Tue Jun 19, 2018 9:39 pm
In the manual of the version 1.4 says that the "gamma" parameter has a default value of 1.42. Could this be a typo?
More like a brain fart. Why do I keep doing this? :?

Updated online. Thanks for pointing it out.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 02, 2018 5:55 pm
by dmcs
Hi,
I am having an issue with highlight being overblown in this particular scene.
If I set light=500, it seems to alleviate the problem, although not entirely. However, every thing else will be too dark. And adjusting gamma brings back the issue.

HDR No tonemapping
Image

Mobius, light=160
Image

Mobius, light=250
Image

Mobius, light=500
Image

SDR
Image

Sample:
https://mega.nz/#!8IggFAqb!LOTOfwBozW-E ... LF5Z-VaeHU

Re: HDR -> SDR tonemapping

Posted: Mon Jul 02, 2018 10:05 pm
by admin
I'll investigate. Thank you for the report and the sample, dmcs.