{
w=input.width()
h=input.height
repmode = 2
clmode = 4
upscaled=input.spline36resize(w*2,h*2)
quad = Quadruple(input) # each pixel is quadrupled, SSETools are needed
qpel = RemoveGrain(quad, mode=12, modeU=-1) # blur the luma for searching motion vectors
qsuper=MSuper(qpel,hpad=4,vpad=4,pel=2,sharp=2)
bvectors = MAnalyse(qsuper, blksize=16, lambda=200, isb=true)
fvectors = MAnalyse(qsuper, blksize=16, lambda=200, isb=false)
backward = MCompensate(upscaled,qsuper,bvectors)
forward = MCompensate(upscaled,qsuper,fvectors)
clensed = mcclense(quad, backward, forward, grey=_grey).shrinkby2(grey=_grey) #SSETools are needed for shrinking
rep=Repair(clensed, input, mode=repmode, modeU=_grey ? -1 : repmode)
rg = RemoveGrain(rep, mode=clmode, modeU=_grey ? -1 : clmode)
return TemporalRepair(rg, rep, grey=_grey, smooth=_smooth).mergechroma(input)
}