HDR -> SDR conversion

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

Re: HDR -> SDR tonemapping

Post by admin »

You're welcome. But please, whenever you say "issues like this" don't assume we know what you are talking about. Tell it in words too. I look at your last image and think "umm, OK, what issue?". Context is completely lacking.

I'll try to guess. You are thinking there are hue shifts there leading to a blocking effect. Hard to say without the source. But, yes, it can happen to any RGB color if the individual channels get different scalings from the tonemapping.
DAE avatar
Narkyy
Posts: 51
Joined: Thu May 25, 2017 11:51 pm

Re: HDR -> SDR tonemapping

Post by Narkyy »

Yes sorry, there's mostly visible blocking around vivid/deep colors.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Got it, thanks. Keep that sample, I'm going to ask you for it later. ;)
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Ha, I don't even have to go to CIELAB and back (which is expensive). I can do it directly in linear RGB space. Find the max of R, G, and B. Then tonemap that max one and apply the resulting scaling to all three. It's also faster than tonemapping all three individually, although for CUDA the actual kernel time is small compared to the frame transfer time, so it's a moot point.
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

Sounds like you are just flying thru it now
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

It's working in my head. :lol:

Actually, I tested that one frame by just multiplying the RGB by 0.2 for the whole frame (because the largest RGB component is ~5.0) and the bright area looks great with no blocking or hue shift and more detail than madVR. So when I put the proper nonlinear function in place everything should look great. However, many a drop is spilt twixt cup and mouth. Or:

But, Mousie, thou art no thy lane,
In proving foresight may be vain;
The best laid schemes o' Mice an' Men,
Gang aft agley,
An' lea'e us nought but grief an' pain,
For promis'd joy!

-- "To A Mouse" by Robert Burns
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

So, what you are so eloquently saying is that poop happens
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Or, maybe, don't count the chickens before they hatch.
DAE avatar
Beta
Posts: 10
Joined: Tue Jul 10, 2018 7:54 am

Re: HDR -> SDR tonemapping

Post by Beta »

Hi guys!

Is anyone here who can help to me fix this issue?
The source is HEVC
Thank You!

Image
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Looks like an AVSPMOD issue (AVSPMOD not using Avisynth+?). Try to open your script in VirtualDub2 and report the result. Note that these filters require Avisynth+.
DAE avatar
Beta
Posts: 10
Joined: Tue Jul 10, 2018 7:54 am

Re: HDR -> SDR tonemapping

Post by Beta »

admin wrote:
Tue Jul 10, 2018 10:08 am
Looks like an AVSPMOD issue (AVSPMOD not using Avisynth+?). Try to open your script in VirtualDub2 and report the result. Note that these filters require Avisynth+.
Thank You!!

I forgot that avisynth+ has two versions!!

We need for this:

https://github.com/pinterf/AviSynthPlus/releases

Now its all fine!!

Image
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Following is my latest result for mobius applied to the lightness rather than individual color channels (frame 2467 of the sample). Specifically, using this script:

dghdrtosdr(light=200,tm="mobius",trans=0.3,peak=2.1)

Even at fairly bright light=200 there is better detail than in the madVR result, and at the same time there is no severe artifacting or hue shifting. I'm pretty happy with this. One interesting thing is that as you raise the peak past 2.1 more strong whites coming in causes the compression to increase and hue changes start to appear. I don't see a need for higher peaks but I will investigate if it is possible to include them without hue shifts, possibly by going to a more constant hue color space like ICtCp.

https://www.dolby.com/us/en/technologie ... -paper.pdf

What do y'all think of this result? If you like it I'll make a release.

latest.jpg
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

+1
Like
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Surely you count for more than 1? ;)

I tested it on the previous problematic stream (the one with the heater bars that disappeared). The bars remain intact with all light levels. I also tried it on the The Great Wall scene with the riders kicking up dust in the sun and it gives way better detail in the clouds to the left of the riders than anything before. So it's looking good. I have one little thing to fix up and then I'll give a release. Still 110 fps with my i7-7700K + 1080 Ti.
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

"The color contouring" issue seems to be gone, which was the problem so it looks good
Me, I am just 1
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Beta wrote:
Tue Jul 10, 2018 11:29 am
Thank You!!
You're welcome, Beta, and welcome to the forum! Look out for the next release, it will handle highlights way better.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

gonca wrote:
Tue Jul 10, 2018 3:33 pm
Me, I am just 1
I count you double. Get over it. :twisted:
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

OK, I fixed the last little wrinkle and all the previous streams look great, IMHO.

Now, as things are looking so good with mobius, and as mobius has simple and easy-to-understand parameters, I want to ditch hable. Hable has a boatload of non-intuitive parameters and I never did figure out how to set it up right. So I give y'all an opportunity to object before I remove it. If you can make a strong case for it maybe I'll leave it there. I'm going to decide later tonight.

Another thing I noticed (and which is described in the literature) is that the approach I have taken can produce highly saturated colors that can sometimes look like too much. The sat parameter is there so you can desaturate the result. My question is should I leave the default sat at 1.0, or reduce it to (say) 0.8?
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

I would say, go for one approach and ditch Hable
The saturation thingy, drop it to 0.8 and then adjust the default, if needed, in the future based on feedback
DAE avatar
Narkyy
Posts: 51
Joined: Thu May 25, 2017 11:51 pm

Re: HDR -> SDR tonemapping

Post by Narkyy »

Ideally saturation should only be adjusted for around highlights that cause these very saturated colors, as overall the default saturation is good.
I don't think anyone cares for Hable anymore :salute:
DAE avatar
dmcs
Posts: 36
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping

Post by dmcs »

admin wrote:
Tue Jul 10, 2018 2:00 pm
What do y'all think of this result? If you like it I'll make a release.
I think it looks really good. But, please allow me to be a bit nitpicking :)

There seems to be little artifact exists along the contour if you look closely (literally). Well, either that, or the saturation makes me think it's artifact? Anw, I don't think anyone would notice during normal playback.

Thanks a lot for your hard work. :salute: :salute:
Screenshot_2018-07-10 latest jpg (JPEG Image, 960 × 540 pixels) - Scaled (98%).png
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Yes, I noticed it too. I agree it's probably not noticeable but I may know the cause so why not try to fix it. I'm still just clipping R/G/B values that end up negative after 2020->709. I need to tonemap them as I do for values > 1.0. I'll see if I can mitigate it.

Good eyes! :wow:
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

OK, I did some more deep looking. The clipping of R/G/B values < 0 is relatively insignificant. I'm thinking the real problem is that RGB space is not constant hue and saturation for brightness changes. So, for example, if we take an RGB value and reduce its brightness by multipying all the channels by (say) 0.5, there is a subtle hue and saturation change. So in a real image where in gamut colors of a given hue and saturation can be right next to out of gamut ones with the same hue and saturation (one is just brighter), if we scale down the out of gamut one then now we can see blocking because the hues and saturations are now different when they should have stayed the same. Bottom line, we can't do lightness compression in RGB space. I hoped to get away with it, but it is now apparent that it was too cheap. :cry:

Next step, try a more hue/saturation-linear space like xyY, CIELAB, or ICtCp.
DAE avatar
dmcs
Posts: 36
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping

Post by dmcs »

Darn. That's unfortunate. :? :shock:
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

After sleeping on it I'm not convinced by my own explanation. Those blocks are much bigger than a pixel so something other than what I suggested must be causing it. Investigations continue today after I take care of renols's issue with DGDecNV.
Post Reply