内存上升到 4100MB 迅速下降,循环往复...
代码: 全选
source = r"D:\a\a.ts" #输入视频
src = core.lsmas.LWLibavSource(source,threads=0,repeat=True)
#src16 = haf.SMDegrain(src16, tr=2,thSAD=300, RefineMotion=True, contrasharp=True, interlaced=True, tff=True, prefilter=3)
src = haf.QTGMC(src,TFF=True,FPSDivisor=2)#
#src16 = mvf.Depth(src, depth=16)
###根本不知道在做什么
srcA = mvf.Depth(src, depth=32)
src_yuv = core.fmtc.resample(srcA,css="444",kernel="cubic",a1=0,a2=0.5,fulls=False,fulld=False,interlaced=0, interlacedd=0)
sup = Oyster.Super(src_yuv)
ref_f = Oyster.Basic(src_yuv, sup, short_time=False)
ref_s = Oyster.Basic(src_yuv, sup, short_time=True)
#short_time = True is meant for Deringing and short_time = False is for Destaircase and Deblocking
c = Oyster.Destaircase(src_yuv, ref_f, block_step=2)
c = Oyster.Deringing(src_yuv, ref_s, block_step=2)
src16= mvf.ToYUV(c,depth=16)
###TAA
src16 = taa.TAAmbk(src16,aatype=1,preaa=-1,mtype=1)
#2倍拉伸画面--来自Morpheus1123__github
upscale = znrs.nnedi3_resample(src16,target_width=1440,target_height=1080,curves="709",curved="709",mats="709", matd="709",sigmoid=True)
src16 =upscale
down444 = core.fmtc.resample(src16,720,540, sx=[-0.5,0,0], css="444", planes=[3,2,2], cplace="MPEG2")
###下面来自_lolihouse大礼包__动漫花园###
nr16y = core.knlm.KNLMeansCL(src16, d=2, a=2, s=3, h=0.8, wmode=2, device_type="GPU", device_id = 1)
nr16uv = core.knlm.KNLMeansCL(down444, d=2, a=1, s=3, h=0.4, wmode=2, device_type="GPU", device_id = 1)
nr16 = core.std.ShufflePlanes([nr16y,nr16uv], [0,1,2], vs.YUV)
nr8 = mvf.Depth(nr16, depth=8)
luma = core.std.ShufflePlanes(nr8, 0, vs.YUV).resize.Bilinear(format=vs.YUV420P8)
nrmaskg = core.tcanny.TCanny(nr8,sigma=1.1,t_h=5.0,op=2,planes=0)
nrmaskb = core.tcanny.TCanny(nr8,sigma=1.3,t_h=6.5,op=2,planes=0)
nrmasks = core.tcanny.TCanny(nr8,sigma=0.8,op=2,gmmax=255,mode=1,planes=[0,1,2]).std.Expr(["x 7 < 0 65535 ?",""],vs.YUV420P16)
nrmask = core.std.Expr([nrmaskg,nrmaskb,nrmasks, nr8],["a 20 < 65535 a 48 < x 256 * a 96 < y 256 * z ? ? ?",""],vs.YUV420P16)
#看不懂的边缘检测(据说还不能通杀)&&学了表达式转换,也不能了解深层含义的像素表达式
nrmask = core.std.Maximum(nrmask,0).std.Maximum(0).std.Minimum(0)
nrmask = core.rgvs.RemoveGrain(nrmask,[20,0])
debd = core.f3kdb.Deband(nr16,12,24,16,16,0,0,output_depth=16)
debd = core.f3kdb.Deband(debd,20,56,32,32,0,0,output_depth=16)
debd = mvf.LimitFilter(debd,nr16,thr=0.6,thrc=0.5,elast=2.0)
debd = core.std.MaskedMerge(debd,nr16,nrmask,first_plane=True)
res = debd
res = mvf.Depth(res,10).set_output()