Tempter57
26th November 2012, 11:07
@Jenyok
The problem is to discriminate between what is noise and what isn't. But the sharpening stage will sharpen also noise, which will be blend later inside the other frames. So you can't escape the temporal denoising, more efficient than spatial denoising, combined with motion compensation.
# http://forum.doom9.org/showthread.php?t=142704
# ==== plugins ===
#avstp.dll
#RGTools.dll
#nnedi3.dll
#AddGrainC.dll
#mvtools2mod.dll
#masktools2.dll
#dfttest.dll
#SmoothAdjust.dll
#splineresize.dll
#awarpsharp2.dll
#dither.dll
#dither.avsi
#flash3kyuu_deband.dll
#mt_xxpand_multi.avsi
#MSRmod.avs
#LindaSharp.avs
#O16mod.avsi
#HQDeringmod.avsi
#GrainFactoryLite_v1.2.avsi
function MSRmod(clip clp, int "W", int "H", float "thr", float "depth", float "strength", int "g1str", int "g2str", int "g3str", int "smode", int "radius", bool "aWarp4", bool "GF3", bool "lsb")
{
# Change those constants to tune for the best result of interpolation
# Resize
W = Default( W, 1280 )
H = Default( H, 720 )
# MSuper
hpad = 8 # 4
vpad = 8
pel = 2 # 1 or 4
rfilter = 4 # 2
sharp = 2 # 2
# MAnalyse
blks = 16
blksV = 8
overlap = blks / 2
overlapV = blksV / 2
search = 5
searchparam = 3
dct = 0
# MCompensate
thSAD = 321
thSCD1 = 400
thSCD2 = 120
# GradFun3
GF3 = Default( GF3, false )
smode = Default( smode, 0 ) # GradFun3 "smode" parameter
thr = Default( thr, 0.42 ) # GradFun3 "thr" parameter
radius = Default( radius, 16 ) # GradFun3 "radius" parameter
# AddGrain
g1str = Default( g1str, 8 )
g2str = Default( g2str, 6 )
g3str = Default( g3str, 3 )
# Overlay
opacity = 0.5
# Output_depth
lsb = Default( lsb, false )
# Sharpening
aWarp4 = Default( aWarp4, true )
depth = Default( depth, 2 )
strength = Default( strength, 0.85 )
brc = BilinearResize(clp, W, H)
psuper = MSuper(brc.removegrain(11), hpad=hpad, vpad=vpad, pel=pel, sharp=sharp, rfilter=rfilter)
vec1 = MAnalyse(psuper, truemotion=true, isb=true, delta=2, blksize=blks, blksizeV=blksV, overlap=overlap, overlapV=overlapV, search=search, searchparam=searchparam, lambda=1024, dct=dct)
vec2 = MAnalyse(psuper, truemotion=true, isb=true, delta=1, blksize=blks, blksizeV=blksV, overlap=overlap, overlapV=overlapV, search=search, searchparam=searchparam, lambda=1024, dct=dct)
vec3 = MAnalyse(psuper, truemotion=true, isb=false,delta=1, blksize=blks, blksizeV=blksV, overlap=overlap, overlapV=overlapV, search=search, searchparam=searchparam, lambda=1024, dct=dct)
vec4 = MAnalyse(psuper, truemotion=true, isb=false,delta=2, blksize=blks, blksizeV=blksV, overlap=overlap, overlapV=overlapV, search=search, searchparam=searchparam, lambda=1024, dct=dct)
nnedi3_rpow2(clp, rfactor=2, cshift="spline144resize", qual=2, nsize=0, nns=3, fwidth=W, fheight=H)
clp = (aWarp4 == true ) ? aWarp4(Spline36Resize(width*4, height*4, 0.375, 0.375), aSobel().aBlur(), depth=2, chroma=4) : LindaSharp(strength)
ssuper = MSuper(clp, hpad=hpad, vpad=vpad, pel=pel, sharp=sharp, rfilter=rfilter, levels=1)
c1 = MCompensate(clp, ssuper, vec1, thSAD=thSAD , thSCD1=thSCD1, thSCD2=thSCD2)
c2 = MCompensate(clp, ssuper, vec2, thSAD=thSAD , thSCD1=thSCD1, thSCD2=thSCD2)
c3 = MCompensate(clp, ssuper, vec3, thSAD=thSAD , thSCD1=thSCD1, thSCD2=thSCD2)
c4 = MCompensate(clp, ssuper, vec4, thSAD=thSAD , thSCD1=thSCD1, thSCD2=thSCD2)
t1 = Overlay(clp, c1, opacity=opacity)
t2 = Overlay(clp, c2, opacity=opacity)
t3 = Overlay(clp, c3, opacity=opacity)
t4 = Overlay(clp, c4, opacity=opacity)
f1 = Overlay(t1, t2, opacity=opacity)
f2 = Overlay(t3, t4, opacity=opacity)
Overlay(f1, f2, opacity=opacity)
U16() # 8 bit=> 16 bit
HQDeringmod(mrad=2, mthr=60, minp=1, sharp=1, Y=3, U=2, V=2, lsb_in=true, lsb=true)
Dither_resize16nr (W, H, kernel="spline", taps=32, noring=true)
# DEBANDING
(GF3 == true ) ? GradFun3(smode=smode, thr=thr, radius=radius, lsb_in=true, lsb=true): \
f3kdb(16, 64, 64, 64, 0, 0, dynamic_grain=true, dither_algo=3, input_mode=1, output_mode=1)
# AddGrain
GrainFL(g1str=g1str, g2str=g2str, g3str=g3str, g1size=1.3, g2size=1.1, g3size=0.9, g1soft=2, g2soft=2, g3soft=2, th1=24, th2=64, th3=96, th4=160, lsb=true, lsb_in=true)
Dither_convert_yuv_to_rgb (matrix="601", output="rgb48y", lsb_in=true)
r = SelectEvery (3, 0)
g = SelectEvery (3, 1)
b = SelectEvery (3, 2)
output = ( lsb == true ) ? Dither_convert_rgb_to_yuv (r, g, b, matrix="709", lsb=true, mode=7, ampn=1, ampo=0.6, output="YV16") : \
Dither_convert_rgb_to_yuv (r, g, b, matrix="709", lsb=false, mode=0)
return (output)
}
function LindaSharp (clip clp, float "strength")
{
strength = default(strength, 0.85)
and = clp.sbr()
Peter = and.removegrain(4,-1)
go = mt_makediff(and,Peter)
mt_lutxy(clp, go, "x y 128 - abs 1 2 / ^ 2 * "+string(strength)+" * y 128 - y 128 - abs 0.001 + / * +",U=2,V=2)
}
function sbr(clip o) {
rg11=o.removegrain(11)
rg11D=mt_makediff(o,rg11)
rg11DD=mt_makediff(rg11D,rg11D.removegrain(11)).mt_lutxy(rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?")
o.mt_makediff(rg11DD,U=2,V=2)
}
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.