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. |
24th July 2024, 09:02 | #1 | Link |
Registered User
Join Date: Dec 2005
Location: Sweden
Posts: 715
|
Dumden - denoise
Code:
function dumden(clip o, int "t", int "tlum", int "tcol", float "spa", string "mode", float "omix") { ### DUMDEN - a dumb and fast denoising function for calming down frenetic noise. ### High motion is more spatial than temporal, low motion is the opposite. ### Modes "one", "two" and "tre" to play around with. ### Need: Masktools2, neo-vaguedenoiser, rgtools, vsttempsmooth, gradationcurves(for mode "two"). t = Default(t, 3) # temporal radius tlum = Default(tlum, 7) # temporal luma thresh tcol = Default(tcol, 5) # temporal chroma thresh spa = Default(spa, 2.0) # spatial strength mode = Default(mode, "one") # modes: "one", "two, "tre" omix = Default(omix, 0.25) # mix the original with the spatial filtering cb = ExtractY(o).convertbits(8,dither=-1) bit = BitsPerComponent(o) ag = cb.coloryuv(autogain=true).merge(cb,0.56) m1 = ag.mif(n=3).removegrain(20,-1).convertbits(bit) at = ag.temporalsoften(1,255,0,255,2) m2 = mt_makediff(at.merge(ag,0.42),at).ApplyGradationCurves(lumaPoints="0,0, 64,32, 128,128, 192,32, 255,0") m2 = m2.mt_binarize(127).removegrain(20,-1).convertbits(bit) m3 = ag.removegrain(20,-1).mt_motion(thy1=1,thy2=12).convertbits(bit) sp = o.neo_vd(threshold=spa) st = sp.merge(o,omix).vsttempsmooth(maxr=t,ythresh=tlum,uthresh=tcol,vthresh=tcol,ymdiff=2,umdiff=1,vmdiff=1) out = \ mode == "one" ? mt_merge(st,st.merge(sp,0.75),m1,luma=true,u=3,v=3) : \ mode == "two" ? mt_merge(st.merge(sp,0.75),st,m2,luma=true,u=3,v=3) : \ mode == "tre" ? mt_merge(st,st.merge(sp,0.75),m3,luma=true,u=3,v=3) : \ return out } function Mif(clip C, int "n") { n=default(n, 2) nr=string(n) mt_lutxy(C, C.Trim(1, 0), mt_polish(" "+nr+" * abs(x-y)"), U=-128, V=-128) return Last } Any ideas are welcome Last edited by anton_foy; 24th July 2024 at 11:31. Reason: Tweaked params and cleaned up |
25th July 2024, 10:06 | #3 | Link |
Registered User
Join Date: Dec 2005
Location: Sweden
Posts: 715
|
No, this is just simple and dumb function to play around with. I still get some motion artifacts in between the high and low/static motion. Thats why motion compensation and block matching alternatives
are superior. Just wanted to try another approach. |
Thread Tools | Search this Thread |
Display Modes | |
|
|