Log in

View Full Version : How to convert HDR to SDR correctly


Timberlake
28th July 2019, 04:02
Recently I've been working on covert HDR to SDR correctly.

Source is playing by mpc-hc. Using madVR.
https://i.loli.net/2019/07/28/5d3d0cf1ddd6f24716.png


This is a screenshot of the encode using following script.
https://i.loli.net/2019/07/28/5d3d0cf1d7db323613.png
loadplugin("D:\Software\Encode\dgdecnv2053\DGDecodeNV.dll")
loadplugin("D:\Software\Encode\_AVSFilter\DGHDRtoSDR_1.12\DGHDRtoSDR.dll")
DGSource("00005.dgi", fulldepth=true)
DGHDRtoSDR()
prefetch(6)
BilinearResize(1920, 1080)


This is a screenshot of the encode using following script.
https://i.loli.net/2019/07/28/5d3d0cf1d923536552.png
loadplugin("D:\Software\Encode\dgdecnv2053\DGDecodeNV.dll")
loadplugin("D:\Software\Encode\_AVSFilter\DGTonemap\DGTonemap.dll")
loadplugin("D:\Software\Encode\_AVSFilter\avsresize-r1d\Release\avsresize.dll")
SetFilterMTMode("z_ConvertFormat", MT_MULTI_INSTANCE) # May not be needed.
DGSource("00005.dgi",fulldepth=true)
ConvertBits(10) # Use 12 for 12-bit
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
# Choose one of these:
#DGReinhard()
DGHable()
z_ConvertFormat(pixel_type="YV12",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
prefetch(4)
BilinearResize(1920, 1080)


Or perhaps there is something wrong with madVR.
Two scripts each comes from DGHDRtoSDR_1.12.txt (http://rationalqm.us/hdr/DGHDRtoSDR_1.12.rar) and DGTonemap_1.2.txt (http://rationalqm.us/DGTonemap.rar)

videoh
28th July 2019, 07:14
You haven't actually told us what you think is bad or wrong! There is no "correct" for this conversion. Every method has to make some subjective tradeoffs.

BTW, you can do the resize with DGSource() to improve performance.

Timberlake
28th July 2019, 07:53
You haven't actually told us what you think is bad or wrong! There is no "correct" for this conversion. Every method has to make some subjective tradeoffs.

BTW, you can do the resize with DGSource() to improve performance.

Oh, it just none of the encodes have the same color compared to the source.
Thanks for the advice.

tebasuna51
28th July 2019, 11:24
Let me use this thread to expose some doubts about that conversion.

- Like the color space Rec. 2020 (https://en.wikipedia.org/wiki/Rec._2020) is bigger than Rec. 709 (https://en.wikipedia.org/wiki/Rec._709) we never can obtain the same color, we only can obtain a aproach.

- In order to compare screenshots, the original is taken from a monitor capable of show Rec. 2020 space or we are comparing how madvr do the conversion 2020 -> 709 with other methods?

- It is possible obtain a screenshot with the true HDR color?

Atak_Snajpera
28th July 2019, 12:16
Default exposure in DGHable is too strong! Use DGHable(exposure=1.0)

Default value
https://i.imgsafe.org/d8/d864b225a3.png


exposure=1.0
https://i.imgsafe.org/d8/d8645638bb.png

Timberlake
28th July 2019, 17:27
Thanks a lot. I am new here as an encoder and a new member of this forum.
There is so much to learn.

videoh
28th July 2019, 17:53
Welcome to the forum and good luck for your projects!