HDR -> SDR conversion
Re: HDR -> SDR tonemapping for DGDecodeNV
Okay. I have the clips ready
original and messed up mastering display data (badly)
Interesting point, when you trim with MKVToolNix you lose the metadata, don't know if it affected the video.
Computer busy right now, will compare as soon as I can
Note
Changing from sdr>hdr>sdr resizes all open folders, just like changing resolution
original and messed up mastering display data (badly)
Interesting point, when you trim with MKVToolNix you lose the metadata, don't know if it affected the video.
Computer busy right now, will compare as soon as I can
Note
Changing from sdr>hdr>sdr resizes all open folders, just like changing resolution
Re: HDR -> SDR tonemapping for DGDecodeNV
Changed the meta data and got a green screen
messed up colors
original colors
messed up colors
Code: Select all
Mastering display color primaries : R: x=0.080000 y=0.020000, G: x=0.100000 y=0.700000, B: x=0.010000 y=0.010000, White point: x=0.012700 y=0.009000
Mastering display luminance : min: 0.1000 cd/m2, max: 1.0000 cd/m2
Maximum Content Light Level : 1000 cd/m2
Maximum Frame-Average Light Level : 50 cd/m2
Code: Select all
Mastering display color primaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance : min: 0.0050 cd/m2, max: 4000.0000 cd/m2
Maximum Content Light Level : 456 cd/m2
Maximum Frame-Average Light Level : 151 cd/m2
Re: HDR -> SDR tonemapping for DGDecodeNV
Thanks. Very interesting result, this experiment confirm my thoughts, that the display device needs these metadata to properly display HDR content. I'm still having trouble with what kolak said that device use high complex method algorith just to display HDR.
And for now, i can't get rid of the idea that HDR -> SDR could easely be done using these metadata, and that display device use simple direct formula, with these metadata, and not high complex algorithm involving the whole frame analysis.
But, stil unable to link these metadata with the informations in the REC.2100. Don't see where they fits in the formula...![Thinking :scratch:](./images/smilies/icon_scratch2.gif)
And for now, i can't get rid of the idea that HDR -> SDR could easely be done using these metadata, and that display device use simple direct formula, with these metadata, and not high complex algorithm involving the whole frame analysis.
But, stil unable to link these metadata with the informations in the REC.2100. Don't see where they fits in the formula...
![Thinking :scratch:](./images/smilies/icon_scratch2.gif)
Re: HDR -> SDR tonemapping for DGDecodeNV
Ok, got a very interesting answer and information about HDR. I had no idea it was in a such mess state... ![Wow :wow:](./images/smilies/icon_eek2.gif)
Seeing this, i gave up the idea of trying to do an HDR to SDR convertion.
![Wow :wow:](./images/smilies/icon_eek2.gif)
Seeing this, i gave up the idea of trying to do an HDR to SDR convertion.
Re: HDR -> SDR tonemapping for DGDecodeNV
It's ugly for now but I have at least a working process for HDR->SDR based on the existing Vapoursynth solution. It's ugly because of the color space conversions I had to do in Avisynth+ to be able to pass planar float RGB to my filter dgtonemap(). So, guys, help me out. It should be possible to at least combine the conversions down from 4 to 2 but for the life of me I cannot figure out what is actually possible in Avisynth+, due to the spotty documentation. Here is the ugliness (although the resulting video looks great with the Reinhard tonemapping):
Code: Select all
loadplugin("dgdecodenv.dll")
loadplugin("dgtonemap.dll")
dgsource("THE GREAT WALL.dgi",fulldepth=true)
# Converting YUV420P16 to planar float RGB.
converttoplanarrgb(matrix="rec709")
converttofloat(bits=32)
dgtonemap()
# Converting from planar float RGB to YV12,
converttoyv12()
convertbits(8) # Strange but if this is omitted, P016 is delivered!
prefetch(4)
Re: HDR -> SDR tonemapping for DGDecodeNV
I did some googling and found nothing for avs+
Mind you, I am not that experienced with what you are trying to accomplish
Maybe others can help out more
Mind you, I am not that experienced with what you are trying to accomplish
Maybe others can help out more
This is a good starting pointHere is the ugliness (although the resultingwith the Reinhard tonemapping):Code: Select all
video looks great
Re: HDR -> SDR tonemapping for DGDecodeNV
I'll talk to pinterf about it.
Working directly in RGBP16 may be possible.
Ideally, I would like the filter to accept YUV420P16 but return YV12P8. But the Avisynth framework does not seem to support this for external filters.
Got a lot of research to do on Avisynth+ capabilities, the actual tonemapping part is the easy part.![Surprised :o](./images/smilies/icon_e_surprised.gif)
Working directly in RGBP16 may be possible.
Ideally, I would like the filter to accept YUV420P16 but return YV12P8. But the Avisynth framework does not seem to support this for external filters.
Got a lot of research to do on Avisynth+ capabilities, the actual tonemapping part is the easy part.
![Surprised :o](./images/smilies/icon_e_surprised.gif)
Re: HDR -> SDR tonemapping for DGDecodeNV
I have it working in RGBP16 so the script now looks like this:
Now I'll move it to the GPU. Probably the conversions to/from RGB can be done there too, eliminating the conversions in the script.
Code: Select all
dgsource("THE GREAT WALL.dgi",fulldepth=true)
converttoplanarrgb(matrix="rec709")
dgtonemap(white=0.25) # arbitrary units, don't try to make sense of it
converttoyv12()
convertbits(8) # include to deliver 8-bit, exclude for 16-bit
Re: HDR -> SDR tonemapping for DGDecodeNV
Before (converted without tonemapping) and after (with tonemapping) screenshots follow. As I mentioned, now that the infrastructure is in place, the tonemapping algorithm can be experimented with to find what we like best. This is basic Reinhard global with no attempt to tweak the white point (I just chose one that seemed OK).
![Image](http://rationalqm.us/misc/untoned.jpg)
![Image](http://rationalqm.us/misc/toned.jpg)
![Image](http://rationalqm.us/misc/untoned.jpg)
![Image](http://rationalqm.us/misc/toned.jpg)
Re: HDR -> SDR tonemapping for DGDecodeNV
![Thanks :hat:](./images/smilies/icon_hattip.gif)
Edit
I liked that movie
Re: HDR -> SDR tonemapping for DGDecodeNV
I never saw it, just got a sample from ![Thinking :scratch:](./images/smilies/icon_scratch2.gif)
![Thinking :scratch:](./images/smilies/icon_scratch2.gif)
Re: HDR -> SDR tonemapping for DGDecodeNV
Both of your screenshots come out as 8 bit, so HDR data not coming thru?
Re: HDR -> SDR tonemapping for DGDecodeNV
You're right that I had said the first was P016 2020. I have fixed that. Thanks for pointing it out.
The first is rendering HDR as SDR without the tonemapping. It shows what you get with a naive conversion. The difference is the whole reason for tonemapping.
The first is rendering HDR as SDR without the tonemapping. It shows what you get with a naive conversion. The difference is the whole reason for tonemapping.
Re: HDR -> SDR tonemapping for DGDecodeNV
The tonemapping one looks pretty good
When you wish, I can do comparison testing, UHD disks come with a BD version, so I can do HDR to HDR>SDR to SDR tests
When you wish, I can do comparison testing, UHD disks come with a BD version, so I can do HDR to HDR>SDR to SDR tests
Re: HDR -> SDR tonemapping for DGDecodeNV
Cool, I'll definitely take you up on that when things are out of the oven.
Re: HDR -> SDR tonemapping for DGDecodeNV
Discovering lots of things...
Most importantly, the internal Avisynth+ conversions are completely unsuitable for this, and pinterf has confirmed that. He recommended using the z.lib stuff. I converted to that and the results are now much better (gonca had supplied some disappointing test results with the internal conversions). Unfortunately, the z.lib stuff is dreadfully slow. I've inquired about it and I hope something can be done, but if not we have to accept that Avisynth+ is basically dead for this kind of work. There's no point to CUDA-accelerate the tone mapping if the conversions are the bottleneck. Let's see...
Current script:
Note to gonca, don't try to run this as it needs a new dgtonemap.dll.
Most importantly, the internal Avisynth+ conversions are completely unsuitable for this, and pinterf has confirmed that. He recommended using the z.lib stuff. I converted to that and the results are now much better (gonca had supplied some disappointing test results with the internal conversions). Unfortunately, the z.lib stuff is dreadfully slow. I've inquired about it and I hope something can be done, but if not we have to accept that Avisynth+ is basically dead for this kind of work. There's no point to CUDA-accelerate the tone mapping if the conversions are the bottleneck. Let's see...
Current script:
Code: Select all
loadplugin("avsresize.dll")
dgsource("D:\Don\Programming\C++\Vapoursynth filters\Skeleton\Vapoursynth Test\THE GREAT WALL.dgi",fulldepth=true)
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
dgtonemap()
z_ConvertFormat(pixel_type="YUV420P16",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
prefetch(8)
Re: HDR -> SDR tonemapping for DGDecodeNV
Don't be sorry; that's weak.
It's not about resizing (I edited my post, thanks for pointing it out); it's about format conversions.
![Wink ;)](./images/smilies/icon_e_wink.gif)
Re: HDR -> SDR tonemapping for DGDecodeNV
The first images I had up were not so great, because the Avisynth+ core colorspace conversions are not up to the job. But the images I replaced them with in the post are made with the avsresize (z.lib) conversions. They mimic the Vapoursynth core conversions but are very slow.
Re: HDR -> SDR tonemapping for DGDecodeNV
As Guest 2 suggests, it's time to port zimg to CUDA. It's not about Vapoursynth versus Avisynth+: CUDASynth.
Re: HDR -> SDR tonemapping for DGDecodeNV
They look good,great improvement with your new approachBut the images I replaced them with
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Re: HDR -> SDR tonemapping for DGDecodeNV
I have to say I'm really pleased to see all this going on.
The most intensive testing I've seen so far.
I should really upgrade my graphics card.
The most intensive testing I've seen so far.
I should really upgrade my graphics card.
Re: HDR -> SDR tonemapping for DGDecodeNV
1050 Ti would be a good affordable step up.
Or wait for Volta. gonca and me, we like to waste our money to be on the bleeding edge. Gotta spend it all before I die.![Laughing :lol:](./images/smilies/icon_lol.gif)
Or wait for Volta. gonca and me, we like to waste our money to be on the bleeding edge. Gotta spend it all before I die.
![Laughing :lol:](./images/smilies/icon_lol.gif)