FastLineDarken for AMVApp 3.0beta

This forum is for questions and discussion of all the aspects of handling and cleaning up your footage with Avisynth.
Locked
User avatar
LantisEscudo
Joined: Thu Mar 08, 2001 5:21 pm
Location: Eastern Massachusetts
Contact:
Org Profile

FastLineDarken for AMVApp 3.0beta

Post by LantisEscudo » Fri Nov 30, 2007 8:09 pm

The AMVApp 3.0 didn't include FastLineDarken, which is a function I found quite useful, but as it was written, it needed the old masktools dll, while the App comes with masktools v2. I had a huge amount of trouble getting masktools and masktools v2 to play nicely together, so I finally said screw it and rewrote the function to use masktools v2 instead. Mostly just a straight copy/replace of function names, with one parameter correction in the thinning function (it's all green with the original parameters).

Code: Select all

function FastLineDarken( clip c, int "strength", int "luma_cap", int "threshold", int "thinning") {
	str = string(default(strength, 48) /128.)
	lum = string(default(luma_cap, 191))
	thr = string(default(threshold, 4))
	thinning = default(thinning,24)
	thn = string(thinning /16.)
	exin=c.mt_expand().mt_inpand()
	diff = mt_lutxy(c,exin,yexpr="y "+lum+" <y> x y "\
		+lum+" < y "+lum+" ? - 0 ? 127 +",uexpr="x",vexpr="x")
	linemask = mt_lut(diff.mt_inpand(),"x 127 - "+thn+" * 255 +")\
		.mt_convolution("1 1 1","1 1 1",y=3,u=0,v=0)
	thick = mt_lutxy(c, exin, yexpr="y "+lum+" <y> x y "\
		+lum+" < y "+lum+" ? - 0 ? "+str+" * x +",uexpr="x",vexpr="x")
	thin = mt_lutxy(c.mt_expand(),diff,yexpr="x y 127 - "+str+" 1 + * +")
	return (thinning == 0) ? thick : mt_merge(thin,thick,linemask,y=3,u=4,v=4)
}

User avatar
Zarxrax
Joined: Sun Apr 01, 2001 6:37 pm
Contact:
Org Profile

Post by Zarxrax » Sat Dec 01, 2007 11:47 am

The vmtoon function included in the amvapp 3 was intended to replace fastlinedarken, as it can be configured to simply darken lines as that function did.

Additionally, there was recently a new actual plugin released that does line darkening. Its based on a version of mftoon, but is much faster since its an actual plugin rather than a function. I'm really liking it so far. http://forum.doom9.org/showthread.php?t=131454

Locked

Return to “AviSynth Help”