View Single Post
Old 15th March 2017, 13:02   #13  |  Link
age
Registered User
 
Join Date: Oct 2015
Posts: 54
Thank you all for your suggestion and the hdr samples.
Well I've discovered some interesting things....
First, a better version of the hable tonemapping that gives better contrast,brightness and saturation.
http://screenshotcomparison.com/comparison/203550


I've tried different algorithms, the aces tonemapping too but I don't like it very much.
Here a good link for a lot of open source tm operators :

https://github.com/tizian/tonemapper.../src/operators

And a different version of aces:

https://github.com/keijiro/PostProce...emapping.cginc


new script with correct parameters
Code:
import vapoursynth as vs


core = vs.get_core()
c = core.ffms2.Source(source  = 'C:/bla')

source_peak=1000 #set manually
LDR_nits=100     #set 150 or 200 for lowering the brightness

c=core.resize.Bilinear(clip=c, format=vs.YUV444PS, range_in_s="limited", range_s="full",chromaloc_in_s="center",dither_type="none")

c=core.resize.Bicubic(clip=c, format=vs.RGBS, matrix_in_s="2020ncl", range_in_s="full",dither_type="none")

c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="st2084", transfer_s="linear",dither_type="none", nominal_luminance=source_peak)

exposure_bias=(source_peak/LDR_nits)

#hable tone mapping  correct parameters
#["A"] = 0.22
#["B"] = 0.3
#["C"] = 0.1
#["D"] = 0.2
#["E"] = 0.01
#["F"] = 0.3
#["W"] = 11.2
#((x * (A*x + C*B) + D*E) / (x * (A*x+B) + D*F)) - E/F"   
tm = core.std.Expr(c, expr="x    {exposure_bias} * 0.22 x    {exposure_bias} * * 0.03 + * 0.002 +    x   {exposure_bias} * 0.22 x   {exposure_bias} * * 0.3 + * 0.06 + / 0.01 0.30 / -  ".format(exposure_bias=exposure_bias),format=vs.RGBS)#12=1200 nits / 100 nits



w = core.std.Expr(c, expr="{exposure_bias} 0.22 {exposure_bias} * 0.03 + * 0.002 + {exposure_bias} 0.22 {exposure_bias} * 0.3 + * 0.06 + / 0.01 0.30 / -  ".format(exposure_bias=exposure_bias),format=vs.RGBS)

c = core.std.Expr(clips=[tm,w], expr=" x  1 y  / *  ",format=vs.RGBS)

#c=core.fmtc.primaries(clip=c, prims="2020", primd="709")
c=core.resize.Bilinear(clip=c, format=vs.RGBS, primaries_in_s="2020", primaries_s="709",dither_type="none")
c=core.resize.Bilinear(clip=c, format=vs.RGBS, transfer_in_s="linear", transfer_s="709",dither_type="none")

c=core.resize.Bilinear(clip=c, format=vs.YUV420P8, matrix_s="709", range_in_s="full",range_s="limited",chromaloc_in_s="center")


c.set_output()
age is offline   Reply With Quote