Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 22nd August 2023, 23:47   #41  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 662
Code:
function clayDTL(clip Input, clip "Preclip", clip "Superclip", clip "Darkclip", clip "Brightclip", int "DthSAD", int "DthSADC",
\ int "BthSAD", int "BthSADC", int "TR", int "BLKSize", int "Rb", int "Overlap", int "Pel", bool "Chroma",
\ float "VDTh", bool "TM", float "Falloff", int "UV", int "LO", int "HI", float "MID", int "MIX", bool "Fast", bool "Spat",
\ float "thSADA_a", float "thSADA_b")
{
DthSAD = default(DthSAD, 150)
DthSADC= default(DthSADC, 150)
BthSAD = default(BthSAD, 70)
BthSADC= default(BthSADC, 70)
_thSADA_a = default(thSADA_a, 0) #disabled
_thSADA_b = default(thSADA_b, 0) #disabled
TR = default(TR, 6)
BLKSize = default(BLKSize, 32)
Overlap = default(Overlap, 16)
Rb = default(Rb, 8)
Pel = default(Pel, 1)
Chroma = default(Chroma, true)
Tm = default(Tm, false)
Falloff = default(Falloff, 0.9)
VDth = default(VDth, 1.5)
Spat = default(Spat, true)
LO = default(LO, 60)
MID = default(MID, 0.57)
HI = default(HI, 127)
MIX = default(MIX, 230)
UV = default(UV, 3)
Fast = default(Fast, false)
Bt= BitLShift(1,input.BitsPerComponent - 8)

preclip = Default(preclip,input)
superclip = Default(superclip,input)
darkclip = Default(darkclip,input)
brightclip = Default(brightclip,input)

super = MSuper(superclip, pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superB = MSuper(superclip.merge(input), pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superfilt = MSuper(preclip, pel=pel, hpad = 0, vpad = 0, mt=false,sharp=1)
Multi_Vector = Superfilt.MAnalyse(Multi=True, Delta=tr, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma, truemotion=tm, global=true)
vmulti2 = Mrecalculate(superfilt,multi_vector,thsad=Dthsad,truemotion=tm,tr=tr,blksize=rb,overlap=rb/2,mt=false,chroma=true)

mv_bw1=SelectEvery(multi_vector, tr*2, 0)
mv_fw1=SelectEvery(multi_vector, tr*2, 1)
mv_bw2=SelectEvery(multi_vector, tr*2, 2)
mv_fw2=SelectEvery(multi_vector, tr*2, 3)

dark = spat ? darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)) :
\ darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)).
\ neo_VD(VDTh, 1, 6, 90, UV=UV)

multi_2fixed=Interleave(mv_bw1, mv_fw1, mv_bw2, mv_fw2)

bright = Fast ? input : brightclip.MDegrainN(SuperB, multi_2fixed, 2, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=BthSAD, thSADC=BthSADC)

mask=dark.extractY().levels(lo*bt, mid, hi*bt, 0, mix*bt)

mt_merge(dark, bright, mask, luma=true, u=uv, v=uv)

return last
}
avs-usage:
Code:
LSMASHVideoSource("C:\Videos\C0135.mp4", decoder="h264_cuvid")

propclearall()
convertbits(16)
Levels(0, 1, 255*256, 0, 235*256, coring=false)
converttoYUV444()

cd=convertbits(8,dither=-1).convertToYv12()
pre=cd.CCD(13).ex_median("IQMV",Y=3,UV=3).ex_sbr(2)

ClayDTL(tr=7,dthsad=170,dthsadc=170,bthsad=100, thSADA_a=1.3, thSADA_b=50,preclip=pre,superclip=ex_unsharp(1.77,th=1.1,fc=width(),safe=true,UV=1),darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

deblock(planes="UV")
neo_F3KDB(grainY=0,grainC=0,Y=46,mt=true,output_depth=16,range=22,sample_mode=3).mergechroma(last)

Convertbits(10,dither=1)
prefetch(4)
Quote:
If you test -e.02 build with standard static thSAD values for Clay script - does it produce equal result to pinterf 2.7.45 build ?
Yes, if I just use ClayDTL (-e.02 build) without autoSAD the result is normal as with the 2.7.45 build.

Same ol' test clip (151mb)
neo_VD

If the quality of denoising with autoSAD (and all the other great features of your version) can get the same or very similar to 2.7.45 build it will be a bomb.

Last edited by anton_foy; 23rd August 2023 at 07:28.
anton_foy is offline   Reply With Quote
Old 23rd August 2023, 11:32   #42  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 987
"thsad=170,dthsadc=170,bthsad=100,"

Is it also your target settings for static thSADs mode ? To compare auto mode result and attempt to make close to static thSADs mode.
DTL is offline   Reply With Quote
Old 23rd August 2023, 12:44   #43  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 662
Quote:
Originally Posted by DTL View Post
"thsad=170,dthsadc=170,bthsad=100,"

Is it also your target settings for static thSADs mode ? To compare auto mode result and attempt to make close to static thSADs mode.
Yes I used my original thSAD settings but I also tried with 70-600 thSAD together with autoSAD and I could not see much difference.
anton_foy is offline   Reply With Quote
Old 23rd August 2023, 16:10   #44  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 987
Well - will try with that values.

"tried with 70-600 thSAD together with autoSAD "

If Auto-thSAD enabled - the old th-values only define the ratio from internally calculated 'main' thSAD and other thSAD2, thSADC, thSADC2 (and used as fail-safe fallback if no valid frames near current present). Main adjustments in auto mode are only thSADA_a (possible typical useful range 1.0f to 2.0f..3.0f) and thSADA_b (possible useful range - about 0.2..0.5 of typically used static thSAD (absolute) value).

So if you provide params like thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), and enable auto mode - the algorithm only calculate back 'Falloff' value from thSAD and thSAD2 and use it to calculate new thSAD2 from current auto-computed 'base' thSAD. So if you start to set thSAD to some very high values - it does not change internally calculated thSAD but only cause lower thSAD2 values computed and used internally (because thSAD/thSAD2 ratio become very large).

So in 'auto' mode setting only thSAD to some very high values will cause a great decrease of denoising because it will cause very small thSAD2 and usage only few near frames.
If you see not enough denoising in 'auto' mode - the first to try is to set thSADA_a to higher values.
DTL is offline   Reply With Quote
Old 2nd September 2023, 08:44   #45  |  Link
anonymlol
Registered User
 
Join Date: Apr 2013
Posts: 19
I have a similar script called GlutenFree. (based on mandarinka's script)

Feel free to have a look.

Last edited by anonymlol; 2nd September 2023 at 13:28.
anonymlol is offline   Reply With Quote
Old 3rd September 2023, 08:40   #46  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 662
Quote:
Originally Posted by anonymlol View Post
I have a similar script called GlutenFree. (based on mandarinka's script)

Feel free to have a look.
Cool thanks! Seems that mandarinka's script touches more in bright areas than dark, Clay is opposite but must give them a try
anton_foy is offline   Reply With Quote
Old 18th September 2023, 22:34   #47  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 662
@Anonymlol I tried it and it is good but even if I lowered lut to 2 it is stil not enough denoising. Perhaps mdegrain2 is not enough.
anton_foy is offline   Reply With Quote
Old 21st September 2023, 12:14   #48  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 987
I am back from vacation to work and trying to test the script with auto-thSAD. I was able to run only the simplified version because it uses many external functions.

Current tested script:
Code:
LoadPlugin("mvtools2.dll")
LoadPlugin("masktools2.dll")
LoadPlugin("ffms2.dll")
LoadPlugin("LSMASHSource.dll")
LoadPlugin("vsdegrainmedian.dll")
#LoadVirtualDubPLugin("ccd_64bit.vdf", "CCD") - returns error 0x7e


function clayDTL(clip Input, clip "Preclip", clip "Superclip", clip "Darkclip", clip "Brightclip", int "DthSAD", int "DthSADC",
\ int "BthSAD", int "BthSADC", int "TR", int "BLKSize", int "Rb", int "Overlap", int "Pel", bool "Chroma",
\ float "VDTh", bool "TM", float "Falloff", int "UV", int "LO", int "HI", float "MID", int "MIX", bool "Fast", bool "Spat",
\ float "thSADA_a", float "thSADA_b")
{
DthSAD = default(DthSAD, 150)
DthSADC= default(DthSADC, 150)
BthSAD = default(BthSAD, 70)
BthSADC= default(BthSADC, 70)
_thSADA_a = default(thSADA_a, 0) #disabled
_thSADA_b = default(thSADA_b, 0) #disabled
TR = default(TR, 6)
BLKSize = default(BLKSize, 32)
Overlap = default(Overlap, 16)
Rb = default(Rb, 8)
Pel = default(Pel, 1)
Chroma = default(Chroma, true)
Tm = default(Tm, false)
Falloff = default(Falloff, 0.9)
VDth = default(VDth, 1.5)
Spat = default(Spat, true)
LO = default(LO, 60)
MID = default(MID, 0.57)
HI = default(HI, 127)
MIX = default(MIX, 230)
UV = default(UV, 3)
Fast = default(Fast, false)
Bt= BitLShift(1,input.BitsPerComponent - 8)

preclip = Default(preclip,input)
superclip = Default(superclip,input)
darkclip = Default(darkclip,input)
brightclip = Default(brightclip,input)

super = MSuper(superclip, pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superB = MSuper(superclip.merge(input), pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superfilt = MSuper(preclip, pel=pel, hpad = 0, vpad = 0, mt=false,sharp=1)
Multi_Vector = Superfilt.MAnalyse(Multi=True, Delta=tr, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma, truemotion=tm, global=true)
vmulti2 = Mrecalculate(superfilt,multi_vector,thsad=Dthsad,truemotion=tm,tr=tr,blksize=rb,overlap=rb/2,mt=false,chroma=true)

mv_bw1=SelectEvery(multi_vector, tr*2, 0)
mv_fw1=SelectEvery(multi_vector, tr*2, 1)
mv_bw2=SelectEvery(multi_vector, tr*2, 2)
mv_fw2=SelectEvery(multi_vector, tr*2, 3)

dark = spat ? darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)) :
\ darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)).
\ neo_VD(VDTh, 1, 6, 90, UV=UV)

multi_2fixed=Interleave(mv_bw1, mv_fw1, mv_bw2, mv_fw2)

bright = Fast ? input : brightclip.MDegrainN(SuperB, multi_2fixed, 2, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=BthSAD, thSADC=BthSADC)

mask=dark.extractY().levels(lo*bt, mid, hi*bt, 0, mix*bt)

mt_merge(dark, bright, mask, luma=true, u=uv, v=uv)

return last
}

LSMASHVideoSource("C0135.mp4")
#FFmpegSource2("C0135.mp4")

Crop(700, 540, 1000, 640)

propclearall()
convertbits(16)
Levels(0, 1, 255*256, 0, 235*256, coring=false)
converttoYUV444()

cd=convertbits(8,dither=-1).convertToYv12()
pre=cd #.CCD(13).ex_median("IQMV",Y=3,UV=3).ex_sbr(2)

sup01=last # ex_unsharp(1.77,th=1.1,fc=width(),safe=true,UV=1)

staticthsad=ClayDTL(tr=7,dthsad=170,dthsadc=170,bthsad=100, thSADA_a=0, thSADA_b=0,preclip=pre,superclip=sup01,darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

autothsad=ClayDTL(tr=7,dthsad=17,dthsadc=17,bthsad=10, thSADA_a=1.3, thSADA_b=50,preclip=pre,superclip=sup01,darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

Interleave(last.Subtitle("src"), staticthsad.Subtitle("static"), autothsad.Subtitle("auto"))

Convertbits(8,dither=1)

Prefetch(4)
It looks working close between static and auto modes. To show that auto working I cut 0 from dthsad,dthsadc,bthsad params in a call with auto enabled.
Function clayDTL() used unchanged as it uses only mvtools and masktools external plugins .dlls and neo_VD() plugin not called with the script calling params (spat=true as default).

The still not found functions:
CCD(13).
ex_median("IQMV",Y=3,UV=3).ex_sbr(2)

ex_unsharp(1.77,th=1.1,fc=width(),safe=true,UV=1)

CCD is a virtualdub plugin only ? Downloaded from http://acobw.narod.ru/ version x64 returns error at load 0x7e. Also ex_* are Dogway functions from some libraries scripts ? As I use only manual loading of plugins and not use external functions libraries I do not have all required functions libraries installed and do not have experience where and how to install (I assume it is installed in some auto-load folders for AVS+ ?). So to test script with auto-loading of plugins and script functions libraries can you provide some archived form of all required plugins and functions scripts libraries with paths to install (maybe archived from drive C:\ root with paths ?) ? Or a description how to install all required functions libraries to the clean AVS+ installation only.
Also my development system does not have NVIDIA hardware h.264 decoder so I can run LSMASHVideoSource in software decode mode only. I hope it does not make a difference and ffmpegsource also working good at my system.

Last edited by DTL; 21st September 2023 at 12:19.
DTL is offline   Reply With Quote
Old 21st September 2023, 14:42   #49  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 1,898
CCD
https://github.com/Dogway/Avisynth-S...Pack.avsi#L198

ex_median
https://github.com/Dogway/Avisynth-S...2452C1-L2452C1

ex_sbr
https://github.com/Dogway/Avisynth-S...rain.avsi#L796

ex_unsharp
https://github.com/Dogway/Avisynth-S...#L518C3-L518C3
kedautinh12 is offline   Reply With Quote
Old 21st September 2023, 15:20   #50  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 987
Thank you - with importing that .avsi files and adding RgTools.dll it starts to work with all functions. Now with full 'pre' clip preparation I see it really not reach required denoise levels in 'auto' mode. Will look in debugger now.

After looking into debug:

After pre=cd.CCD(13).ex_median("IQMV",Y=3,UV=3).ex_sbr(2) the prefiltered clip gives very low average SAD - about 57 for 1 frame (after 0), without prefiltering it is about 180. So default static thSAD about 170 (for dark clip) is really very big for this prefiltered clip. Auto-thSAD simply selects lower thSAD for processing so create lower denoise effect. If you need equal to static 170 thSAD for provided test clip it is autp settings about
thSADA_a=3.5, thSADA_b=50

Though both static thSAD=170 and thSADA_a=3.5, thSADA_b=50 is too high th-settings and may cause more bad blocks blending and detail loss. Also too high thSADA_a param setting will close to disable th-variation proportional to nosie level and will be close to simply too high static thSAD setting.

So with such prefiltering settings you can start with auto settings of thSADA_a=3.5, thSADA_b=50 and tune thSADA_a slowly to lower values looking for still enough denoise with details saving balance. And try to check with another clip with different noise level if auto feature will track threshold better in compare with manual thSAD adjusting.

I start to see some difference in dark parts between static and auto-thSAD only with thSADA_a about 2.7 (with thSADA_b=50).

Test script with prefiltering:
Code:
LoadPlugin("mvtools2.dll")
LoadPlugin("masktools2.dll")
LoadPlugin("ffms2.dll")
LoadPlugin("LSMASHSource.dll")
LoadPlugin("vsdegrainmedian.dll")
LoadPlugin("RgTools.dll")

Import("DeblockPack.avsi")
Import("ExTools.avsi")
Import("SMDegrain.avsi")
Import("SharpenersPack.avsi")

function clayDTL(clip Input, clip "Preclip", clip "Superclip", clip "Darkclip", clip "Brightclip", int "DthSAD", int "DthSADC",
\ int "BthSAD", int "BthSADC", int "TR", int "BLKSize", int "Rb", int "Overlap", int "Pel", bool "Chroma",
\ float "VDTh", bool "TM", float "Falloff", int "UV", int "LO", int "HI", float "MID", int "MIX", bool "Fast", bool "Spat",
\ float "thSADA_a", float "thSADA_b")
{
DthSAD = default(DthSAD, 150)
DthSADC= default(DthSADC, 150)
BthSAD = default(BthSAD, 70)
BthSADC= default(BthSADC, 70)
_thSADA_a = default(thSADA_a, 0) #disabled
_thSADA_b = default(thSADA_b, 0) #disabled
TR = default(TR, 6)
BLKSize = default(BLKSize, 32)
Overlap = default(Overlap, 16)
Rb = default(Rb, 8)
Pel = default(Pel, 1)
Chroma = default(Chroma, true)
Tm = default(Tm, false)
Falloff = default(Falloff, 0.9)
VDth = default(VDth, 1.5)
Spat = default(Spat, true)
LO = default(LO, 60)
MID = default(MID, 0.57)
HI = default(HI, 127)
MIX = default(MIX, 230)
UV = default(UV, 3)
Fast = default(Fast, false)
Bt= BitLShift(1,input.BitsPerComponent - 8)

preclip = Default(preclip,input)
superclip = Default(superclip,input)
darkclip = Default(darkclip,input)
brightclip = Default(brightclip,input)

super = MSuper(superclip, pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superB = MSuper(superclip.merge(input), pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superfilt = MSuper(preclip, pel=pel, hpad = 0, vpad = 0, mt=false,sharp=1)
Multi_Vector = Superfilt.MAnalyse(Multi=True, Delta=tr, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma, truemotion=tm, global=true)
vmulti2 = Mrecalculate(superfilt,multi_vector,thsad=Dthsad,truemotion=tm,tr=tr,blksize=rb,overlap=rb/2,mt=false,chroma=true)

mv_bw1=SelectEvery(multi_vector, tr*2, 0)
mv_fw1=SelectEvery(multi_vector, tr*2, 1)
mv_bw2=SelectEvery(multi_vector, tr*2, 2)
mv_fw2=SelectEvery(multi_vector, tr*2, 3)

dark = spat ? darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)) :
\ darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)).
\ neo_VD(VDTh, 1, 6, 90, UV=UV)

multi_2fixed=Interleave(mv_bw1, mv_fw1, mv_bw2, mv_fw2)

bright = Fast ? input : brightclip.MDegrainN(SuperB, multi_2fixed, 2, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=BthSAD, thSADC=BthSADC)

mask=dark.extractY().levels(lo*bt, mid, hi*bt, 0, mix*bt)

mt_merge(dark, bright, mask, luma=true, u=uv, v=uv)

return last
}

LSMASHVideoSource("C0135.mp4")
#FFmpegSource2("C0135.mp4")

Crop(700, 540, 1000, 640)

propclearall()
convertbits(16)
Levels(0, 1, 255*256, 0, 235*256, coring=false)
converttoYUV444()

cd=convertbits(8,dither=-1).convertToYv12()
pre=cd.CCD(13).ex_median("IQMV",Y=3,UV=3).ex_sbr(2)

sup01=ex_unsharp(1.77,th=1.1,fc=width(),safe=true,UV=1)

staticthsad=ClayDTL(tr=7,dthsad=170,dthsadc=170,bthsad=100, thSADA_a=0, thSADA_b=0,preclip=pre,superclip=sup01,darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

autothsad=ClayDTL(tr=7,dthsad=1700,dthsadc=1700,bthsad=1000, thSADA_a=2.7, thSADA_b=50,preclip=pre,superclip=sup01,darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

Interleave(last.Subtitle("src"), staticthsad.Subtitle("static"), autothsad.Subtitle("auto"))

Convertbits(8,dither=1)

Prefetch(4)
Also I see with auto-thSAD enabled the thSADX values better to keep in range 100 or higher - setting to 17 looks like cause additional computing issues. So better to keep thSADX values as usual.

Last edited by DTL; 21st September 2023 at 16:59.
DTL is offline   Reply With Quote
Old 22nd September 2023, 13:10   #51  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 662
Quote:
Originally Posted by DTL View Post
Thank you - with importing that .avsi files and adding RgTools.dll it starts to work with all functions. Now with full 'pre' clip preparation I see it really not reach required denoise levels in 'auto' mode. Will look in debugger now.

After looking into debug:

After pre=cd.CCD(13).ex_median("IQMV",Y=3,UV=3).ex_sbr(2) the prefiltered clip gives very low average SAD - about 57 for 1 frame (after 0), without prefiltering it is about 180. So default static thSAD about 170 (for dark clip) is really very big for this prefiltered clip. Auto-thSAD simply selects lower thSAD for processing so create lower denoise effect. If you need equal to static 170 thSAD for provided test clip it is autp settings about
thSADA_a=3.5, thSADA_b=50

Though both static thSAD=170 and thSADA_a=3.5, thSADA_b=50 is too high th-settings and may cause more bad blocks blending and detail loss. Also too high thSADA_a param setting will close to disable th-variation proportional to nosie level and will be close to simply too high static thSAD setting.

So with such prefiltering settings you can start with auto settings of thSADA_a=3.5, thSADA_b=50 and tune thSADA_a slowly to lower values looking for still enough denoise with details saving balance. And try to check with another clip with different noise level if auto feature will track threshold better in compare with manual thSAD adjusting.

I start to see some difference in dark parts between static and auto-thSAD only with thSADA_a about 2.7 (with thSADA_b=50).

Test script with prefiltering:
Code:
LoadPlugin("mvtools2.dll")
LoadPlugin("masktools2.dll")
LoadPlugin("ffms2.dll")
LoadPlugin("LSMASHSource.dll")
LoadPlugin("vsdegrainmedian.dll")
LoadPlugin("RgTools.dll")

Import("DeblockPack.avsi")
Import("ExTools.avsi")
Import("SMDegrain.avsi")
Import("SharpenersPack.avsi")

function clayDTL(clip Input, clip "Preclip", clip "Superclip", clip "Darkclip", clip "Brightclip", int "DthSAD", int "DthSADC",
\ int "BthSAD", int "BthSADC", int "TR", int "BLKSize", int "Rb", int "Overlap", int "Pel", bool "Chroma",
\ float "VDTh", bool "TM", float "Falloff", int "UV", int "LO", int "HI", float "MID", int "MIX", bool "Fast", bool "Spat",
\ float "thSADA_a", float "thSADA_b")
{
DthSAD = default(DthSAD, 150)
DthSADC= default(DthSADC, 150)
BthSAD = default(BthSAD, 70)
BthSADC= default(BthSADC, 70)
_thSADA_a = default(thSADA_a, 0) #disabled
_thSADA_b = default(thSADA_b, 0) #disabled
TR = default(TR, 6)
BLKSize = default(BLKSize, 32)
Overlap = default(Overlap, 16)
Rb = default(Rb, 8)
Pel = default(Pel, 1)
Chroma = default(Chroma, true)
Tm = default(Tm, false)
Falloff = default(Falloff, 0.9)
VDth = default(VDth, 1.5)
Spat = default(Spat, true)
LO = default(LO, 60)
MID = default(MID, 0.57)
HI = default(HI, 127)
MIX = default(MIX, 230)
UV = default(UV, 3)
Fast = default(Fast, false)
Bt= BitLShift(1,input.BitsPerComponent - 8)

preclip = Default(preclip,input)
superclip = Default(superclip,input)
darkclip = Default(darkclip,input)
brightclip = Default(brightclip,input)

super = MSuper(superclip, pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superB = MSuper(superclip.merge(input), pel=pel, hpad = 0, vpad = 0, chroma=chroma, mt=false, levels=1, sharp=1)
superfilt = MSuper(preclip, pel=pel, hpad = 0, vpad = 0, mt=false,sharp=1)
Multi_Vector = Superfilt.MAnalyse(Multi=True, Delta=tr, BLKSize=BLKSize, Overlap=Overlap, Chroma=Chroma, truemotion=tm, global=true)
vmulti2 = Mrecalculate(superfilt,multi_vector,thsad=Dthsad,truemotion=tm,tr=tr,blksize=rb,overlap=rb/2,mt=false,chroma=true)

mv_bw1=SelectEvery(multi_vector, tr*2, 0)
mv_fw1=SelectEvery(multi_vector, tr*2, 1)
mv_bw2=SelectEvery(multi_vector, tr*2, 2)
mv_fw2=SelectEvery(multi_vector, tr*2, 3)

dark = spat ? darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)) :
\ darkclip.MDegrainN(Super, vmulti2, TR, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=DthSAD, thSAD2=Int(DthSAD*Falloff), thSADC=DthSADC, thSADC2=Int(DthSADC*Falloff)).
\ neo_VD(VDTh, 1, 6, 90, UV=UV)

multi_2fixed=Interleave(mv_bw1, mv_fw1, mv_bw2, mv_fw2)

bright = Fast ? input : brightclip.MDegrainN(SuperB, multi_2fixed, 2, thSADA_a=_thSADA_a, thSADA_b=_thSADA_b, thSAD=BthSAD, thSADC=BthSADC)

mask=dark.extractY().levels(lo*bt, mid, hi*bt, 0, mix*bt)

mt_merge(dark, bright, mask, luma=true, u=uv, v=uv)

return last
}

LSMASHVideoSource("C0135.mp4")
#FFmpegSource2("C0135.mp4")

Crop(700, 540, 1000, 640)

propclearall()
convertbits(16)
Levels(0, 1, 255*256, 0, 235*256, coring=false)
converttoYUV444()

cd=convertbits(8,dither=-1).convertToYv12()
pre=cd.CCD(13).ex_median("IQMV",Y=3,UV=3).ex_sbr(2)

sup01=ex_unsharp(1.77,th=1.1,fc=width(),safe=true,UV=1)

staticthsad=ClayDTL(tr=7,dthsad=170,dthsadc=170,bthsad=100, thSADA_a=0, thSADA_b=0,preclip=pre,superclip=sup01,darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

autothsad=ClayDTL(tr=7,dthsad=1700,dthsadc=1700,bthsad=1000, thSADA_a=2.7, thSADA_b=50,preclip=pre,superclip=sup01,darkclip=vsdegrainmedian(),brightclip=last,chroma=true)

Interleave(last.Subtitle("src"), staticthsad.Subtitle("static"), autothsad.Subtitle("auto"))

Convertbits(8,dither=1)

Prefetch(4)
Also I see with auto-thSAD enabled the thSADX values better to keep in range 100 or higher - setting to 17 looks like cause additional computing issues. So better to keep thSADX values as usual.
Great to see this kind of progress DTL! Have been utterly occupied with work so I will need a couple of days before I try it out. Lots of anticipation

Edit: also Im awaiting parts for a completely new computer with RTX 4070 card, AMD Ryzen 9 7950X 4.5 GHz, G.Skill 64GB (2x32GB) DDR5 6000MHz CL30 Trident Z5 etc. So very interested to know how this will perform.

Last edited by anton_foy; 22nd September 2023 at 13:15.
anton_foy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:12.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.