Log in

View Full Version : Combining filters together


ryrynz
27th February 2013, 00:31
I've been fiddling with real time anime Avisynth sharpening for awhile and have popped Psharpen and Hysteria together into a single script which improved performance a little. Awarpsharp2 is another one in the chain and I've read that using an edge mask can help improve Awarpsharp's final result, so I thought about adding that in too and utilizing Hysteria's edge mask.

So far I haven't had any luck so far getting it to work, I get invalid command errors for Awarpsharp or just no change in the picture at all.. any chance someone can help me out? :)

Guest
27th February 2013, 15:25
Post your script that isn't working as you expect.

ryrynz
10th March 2013, 08:08
SEt wrote on the first post of awarpsharp2

you can do advanced edge mask filtering (like MDegrain) before passing it to warp stage to get more stable result.


Since there's an edge mask in hysteria and I use this filter a bit I'd like to try getting this improved more stable result by using awarp with it, which I assume would be aWarp(edge_mask_clip, int "depth", int "chroma")? I haven't been able to get it to work though and I can't find any examples of awarp being used with a mask to help me out, if you could help me do this is would be appreciated.

Unmodified Hysteria code:

function Hysteria(clip orig, float "strength", bool "usemask", int "lowthresh", int "highthresh", \
int "luma_cap", int "maxchg", int "minchg", bool "showmask") {

Assert(orig.IsYV12(), "Hysteria: YV12 input only")

lowthresh = Default(lowthresh, 6)
highthresh = Default(highthresh, 20)
showmask = Default(showmask, false)
strength = Default(strength, 1.0)
str = String(strength)
usemask = Default(usemask, true)
luma_cap = Default(luma_cap, 191)
lc = String(luma_cap)
maxchg = Default(maxchg, 255)
lim = String(maxchg)
minchg = Default(minchg, 0)
thr = String(minchg)


noisymask = orig.mt_edge(thy1=lowthresh,thy2=lowthresh,mode="cartoon")
cleanmask = orig.mt_edge(thy1=highthresh,thy2=highthresh,mode="cartoon")
themask = mt_hysteresis(cleanmask,noisymask).mt_inflate().Blur(1.0).Blur(1.0).mt_deflate()

diffs = mt_makediff(orig.mt_inflate(u=2,v=2),orig).mt_lut("x 128 - "+str+" *")
darkened = mt_lutxy(orig, diffs, "x x "+lc+" > 0 y "+lim+" > "+lim+" y "+thr+" < 0 y ? ? ? -")

usemask? mt_merge(orig,darkened,themask,u=2,v=2): darkened.MergeChroma(orig)

return showmask? themask.Levels(0,1,255,80,255).MergeChroma(orig): last