Page 15 of 24

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 9:38 am
by admin
3 minutes is great, dmcs. Thanks for the sample. Investigating...

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

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 9:45 am
by admin
@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.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 11:15 am
by admin
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.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 11:43 am
by dmcs
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.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 12:32 pm
by admin
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?

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 12:47 pm
by dmcs
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.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 12:53 pm
by admin
Yes, I meant the m2ts. Thank you.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 1:25 pm
by admin
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:

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 1:34 pm
by dmcs
:salute: :salute:

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 1:44 pm
by Narkyy
That would cause issues like this as well right? Not just in highlights

Image

Thank you for the hard work :hat:

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 2:16 pm
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.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 3:07 pm
by Narkyy
Yes sorry, there's mostly visible blocking around vivid/deep colors.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 3:38 pm
by admin
Got it, thanks. Keep that sample, I'm going to ask you for it later. ;)

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 4:24 pm
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.

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 4:35 pm
by Guest
Sounds like you are just flying thru it now

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 4:43 pm
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

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 5:37 pm
by Guest
So, what you are so eloquently saying is that poop happens

Re: HDR -> SDR tonemapping

Posted: Mon Jul 09, 2018 8:56 pm
by admin
Or, maybe, don't count the chickens before they hatch.

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 8:00 am
by Beta
Hi guys!

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

Image

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 10:08 am
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+.

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 11:29 am
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

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 2:00 pm
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

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 3:00 pm
by Guest
+1
Like

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 3:29 pm
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.

Re: HDR -> SDR tonemapping

Posted: Tue Jul 10, 2018 3:33 pm
by Guest
"The color contouring" issue seems to be gone, which was the problem so it looks good
Me, I am just 1