DepanSafe source

From Avisynth wiki
Jump to: navigation, search

source: http://pastebin.com/raw.php?i=pqPp0n72

function depansafe( clip c, float "dxmax", float "dymax", float "error", clip "prefilter", bool "info", string "log" ) {
	dxmax = default(dxmax, 1.5)
	dymax = default(dymax, 1.5)
	error = default(error, 4.0)
	prefilter = default(prefilter,c.removegrain(4,4))

	c
	DepanStabilize(data=MDepan(prefilter.MSuper.MAnalyse(isb=false),log=log,error=error),
		\dxmax=dxmax,dymax=dymax,zoommax=1,rotmax=0,info=info)

	cropx = ceil(dxmax)*2
	cropy = ceil(dymax)*2
	ratiox = "YPlaneMax("+string(ceil(99-dxmax/cropx*100))+")"
	ratioy = "YPlaneMax("+string(ceil(99-dymax/cropy*100))+")"

	crop(width-cropx,0,0,0).conditionalfilter(
		\crop(0,0,cropx,0).conditionalfilter(
			\crop(0,height-cropy,0,0).conditionalfilter(
				\crop(0,0,0,cropy).conditionalfilter(
					\last,c,ratioy,">","0"),
				\c,ratioy,">","0"),
			\c,ratiox,">","0"),
		\c,ratiox,">","0")
}
Personal tools