12.04.2025, 16:51
Here's a Vapoursynth port or RemoveDirtSMC, but normal RemoveDirtMC seems superior.
The S seems to stand for 'simple'.
The S seems to stand for 'simple'.
def RemoveTempGrain(clip: vs.VideoNode, mode: int=17) -> vs.VideoNode:
if hasattr(core, 'zsmooth'):
rg = core.zsmooth.RemoveGrain(clip, mode=mode)
else:
rg = core.rgvs.RemoveGrain(clip, mode=mode)
return TemporalRepair(rg, clip)
def RemoveDirtS(clip: vs.VideoNode, limit: int= 6, grey: bool=False) -> vs.VideoNode:
clensed = core.rgvs.Clense(clip)
if hasattr(core, 'zsmooth'):
alt = core.zsmooth.RemoveGrain(clip, mode=10)
else:
alt = core.rgvs.RemoveGrain(clip, mode=10)
return core.removedirt.RestoreMotionBlocks(clensed, clip, alternative=alt, pthreshold=4, cthreshold=6, gmthreshold=40, dist=1, dmode=2, debug=False, noise=limit, noisy=16, grey=False)
def RemoveDirtSMC(clip: vs.VideoNode, limit: int=6, repmode: int=16, remgrainmode: int=17, block_size: int=8, block_over: int=4, gpu: bool=False) -> vs.VideoNode:
if gpu:
import ChangeFPS
block_over = 0 if block_over == 0 else 1 if block_over == 2 else 2 if block_over == 4 else 3
Super = core.svp1.Super(clip, "{gpu:1,pel:4}")
bvec = core.svp1.Analyse(Super['clip'], Super['data'], clip, "{ gpu:1, block:{w:"+str(block_size)+", h:"+str(block_size)+",overlap:"+str(block_over)+"} }")
fvec = core.svp1.Analyse(Super['clip'], Super['data'], clip, "{ gpu:1, block:{w:"+str(block_size)+", h:"+str(block_size)+",overlap:"+str(block_over)+",special:{delta: 1}} }")
backw = core.svp2.SmoothFps(clip,Super['clip'], Super['data'],bvec['clip'],bvec['data'],"{}") # here the frame rate is doubled
forw = core.svp2.SmoothFps(clip,Super['clip'], Super['data'],fvec['clip'],fvec['data'],"{}") # here the frame rate is doubled
# since backw and forw now have twice the frame count I drop half the frames
backw = ChangeFPS.ChangeFPS(backw,clip.fps_num,clip.fps_den)
forw = ChangeFPS.ChangeFPS(forw,clip.fps_num,clip.fps_den)
else:
#block size of MAnalyze, blksize 8 is much better for 720x576 noisy source than blksize=16
#block overlapping of MAnalyze 0! 2 or 4 is not good for my noisy b&w 8mm film source
i = core.mv.Super(clip, pel=2, sharp=2) # avs: i=MSuper(clip,pel=2, isse=false)
bvec = core.mv.Analyse(super=i,isb=True, blksize=block_size,overlap=block_over, delta=1, truemotion=True, chroma=True)
fvec = core.mv.Analyse(super=i,isb=False, blksize=block_size,overlap=block_over, delta=1, truemotion=True, chroma=True)
backw = core.mv.Flow(clip=clip,super=i,vectors=[bvec])
forw = core.mv.Flow(clip=clip,super=i,vectors=[fvec])
clip = core.std.Interleave([backw, clip, forw])
clip = RemoveDirtS(clip, limit)
if hasattr(core, 'zsmooth'):
clip = core.zsmooth.RemoveGrain(clip, mode=10)
else:
clip = core.rgvs.RemoveGrain(clip, mode=10)
clip = core.std.SelectEvery(clip, 3, 1)
return clip
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.