HDR -> SDR conversion

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

Re: HDR -> SDR tonemapping

Post by admin »

Thanks for the explanation, Selur. :salute:
DAE avatar
Guest

Re: HDR -> SDR tonemapping for DGDecodeNV

Post by Guest »

admin wrote:
Sun Mar 25, 2018 6:49 am
@gonca

I see you are linking from the web for your images. Are you able to attach them to your post instead? Then they would be here permanently. If it is not working I can fix it.
Will do from now on
DAE avatar
dmcs
Posts: 36
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping for DGDecodeNV

Post by dmcs »

admin wrote:
Sun Mar 25, 2018 7:39 am
OK, boys and girls, please re-download to get DGTonemap 1.1. It should significantly improve the whites and be much closer to the SDR versions. You can tweak it further if desired using the contrast and bright parameters.
Thank you for the update. Could you please tell me the default values of "contrast" and "bright" in the new version?
DAE avatar
Nginx
Posts: 26
Joined: Fri Mar 23, 2018 12:48 am

Re: HDR -> SDR tonemapping

Post by Nginx »

Thanks for the update.
Is that tonemap1.1 txt file readable? looks like I have some encoding issue(I asume its not utf8?). Random code showed on my sublimetext..
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

dmcs wrote:
Sun Mar 25, 2018 9:57 am
Thank you for the update. Could you please tell me the default values of "contrast" and "bright" in the new version?
Good point. :facepalm:

contrast = 0.3
bright = 3.0

I have updated the help file.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Nginx wrote:
Sun Mar 25, 2018 10:37 am
Thanks for the update.
Is that tonemap1.1 txt file readable? looks like I have some encoding issue(I asume its not utf8?). Random code showed on my sublimetext..
I don't know what was up there because I just replaced it. Can you re-download and check again? Thanks. Should be UTF8. Works fine with sublimetext for me.

I'm trying to do too many things at once, gotta slow down. :P
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

admin wrote:
Sun Mar 25, 2018 10:38 am
dmcs wrote:
Sun Mar 25, 2018 9:57 am
Thank you for the update. Could you please tell me the default values of "contrast" and "bright" in the new version?
Good point. :facepalm:

contrast = 0.3
bright = 1.0

I have updated the help file.
Thank you
Edit
Help file shows bright=3.0 as default

Too many things at once
Gotta slow down
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Yes, 3.0 is the default. Post edited. Thank you.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping for DGDecodeNV

Post by admin »

gonca wrote:
Sun Mar 25, 2018 9:35 am
Will do from now on
Sweet. :salute:
DAE avatar
dmcs
Posts: 36
Joined: Sat Oct 21, 2017 9:40 pm

Re: HDR -> SDR tonemapping

Post by dmcs »

I mess around the "bright" parameter, but cannot see any difference between the values (default, 1.0, 5.0).
Not sure where I did wrong.
Here's my script:

Code: Select all

DGSource("br2049.dgi", crop_t=280, crop_b=280, fulldepth=true).Spline36Resize(1920, 800)
z_ConvertFormat(pixel_type="RGBPS", colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
DGTonemap(bright=5)
z_ConvertFormat(pixel_type="YV12", colorspace_op="rgb:linear:2020:l=>709:709:709:l", dither_type="ordered")
Subtitle("bright=5.0", size=25)
Attachments
1a.png
1b.png
1c.png
2a.png
2b.png
2c.png
3a.png
3b.png
3c.png
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

I know what's wrong, standby. Thank you.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Re-download, should be all fixed up. Thanks for pointing it out.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Higher numbers reduce brightness, you can even go to bright=1000 and beyond, but it stops having an effect up there. bright=3.0 is already too bright. Maybe 4.0 is better. It's logarithmic. Let me know what default you like. I'm also going to look at Hable and some local operators. Tonemapping raises some interesting philosophical questions regarding what features of perception should be favored, given that we cannot retain all of the information.
DAE avatar
Narkyy
Posts: 51
Joined: Thu May 25, 2017 11:51 pm

Re: HDR -> SDR tonemapping

Post by Narkyy »

So I'm trying to test the DGTonemap plugin without DGSource (as I don't have a HEVC decoding GPU).
I'm not sure what the plugin expects as input. As 16 bit source, it returns double the height but a proper image at the top.
This is my script (cropping the bottom)

Code: Select all

LSMASHVideoSource("source.mp4", stacked=true, format="YUV420P16")
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
dgtonemap(contrast=0.2, bright=7.0)
z_ConvertFormat(pixel_type="YV12",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
crop(0,280,0,-2440)
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Welcome to the forum!

That's probably some hacky high-bit depth support in LSMASH, i.e., it's that double-image nonsense done for use with Avisynth 2.6, which doesn't have native 16-bit support. I can't support hacks like that. Ask the LSMASH guys for real 16-bit support. We are in the UHD era.
DAE avatar
Narkyy
Posts: 51
Joined: Thu May 25, 2017 11:51 pm

Re: HDR -> SDR tonemapping

Post by Narkyy »

Hmm alright, thanks.
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

It's like going out of your way to support Windows 3.0 or XP.

1050 Ti's are very reasonable if you shop around. Around $180.
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

sdr
1 sdr.jpg
bright=4.0
bright=4.0.jpg
bright=5.0
bright=5.0.jpg
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Nice, thanks gonca. I like bright=5. The SDR one is too dark in the shadows compared to bright=5, IMHO.
DAE avatar
Guest

Re: HDR -> SDR tonemapping

Post by Guest »

If you want me to further test with different samples let me know
User avatar
DJATOM
Posts: 176
Joined: Fri Oct 16, 2015 6:14 pm

Re: HDR -> SDR tonemapping

Post by DJATOM »

Narkyy wrote:
Sun Mar 25, 2018 2:49 pm
So I'm trying to test the DGTonemap plugin without DGSource (as I don't have a HEVC decoding GPU).
I'm not sure what the plugin expects as input. As 16 bit source, it returns double the height but a proper image at the top.
This is my script (cropping the bottom)

Code: Select all

LSMASHVideoSource("source.mp4", stacked=true, format="YUV420P16")
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
dgtonemap(contrast=0.2, bright=7.0)
z_ConvertFormat(pixel_type="YV12",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
crop(0,280,0,-2440)
You can tell AviSynth+ about stacked things, but in your case you don't even need to spend cycles on conversion, just something like

Code: Select all

LSMASHVideoSource("source.mp4", format="YUV420P16")
ConvertFromDoubleWidth(16)
z_ConvertFormat(pixel_type="RGBPS",colorspace_op="2020ncl:st2084:2020:l=>rgb:linear:2020:l", dither_type="none")
dgtonemap(contrast=0.2, bright=7.0)
z_ConvertFormat(pixel_type="YV12",colorspace_op="rgb:linear:2020:l=>709:709:709:l",dither_type="ordered")
crop(0,280,0,-2440)
should work for you.
PC: RTX 2070 | Ryzen R9 5950X (no OC) | 64 GB RAM
Notebook: RTX 4060 | Ryzen R9 7945HX | 32 GB RAM
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Cool, thanks for notifying us about that possibility. I'd never heard of that.
DAE avatar
Narkyy
Posts: 51
Joined: Thu May 25, 2017 11:51 pm

Re: HDR -> SDR tonemapping

Post by Narkyy »

Unfortunately that only made the width 1920, there was still garbage in the extra bottom 2160 pixels.
This is what worked though if anyone's interested: ConvertFromStacked(16) and crop(0,280,0,-280)
I'm not sure why but that works and it doesn't when LSMASH loads as stacked=false

Thanks for the help, I'll probably post some test samples soon :)
User avatar
admin
Posts: 4551
Joined: Thu Sep 09, 2010 3:08 pm

Re: HDR -> SDR tonemapping

Post by admin »

Maybe DJATOM knows something about that.

@all

I released a new version of DGTonemap that adds the Hable operator. Read the
DGTonemap.txt file as the usage has changed. Hable seems to preserve details
better to my eye.

http://rationalqm.us/DGTonemap.rar
User avatar
DJATOM
Posts: 176
Joined: Fri Oct 16, 2015 6:14 pm

Re: HDR -> SDR tonemapping

Post by DJATOM »

Code: Select all

LwlibavVideoSource("D:\ACCEL_WORLD_INFINITE_BURST_UHD\BDMV\STREAM\00004.m2ts")
ConvertFromDoubleWidth(bits=10)
ConvertBits(16)
That way I get native 16 bit video (checked with ConvertBits(8,dither=0) and ConvertToStacked(), both produce valid output for me.
PC: RTX 2070 | Ryzen R9 5950X (no OC) | 64 GB RAM
Notebook: RTX 4060 | Ryzen R9 7945HX | 32 GB RAM
Post Reply