- Code: Select all
######
##
## HQDering v0.1 by mf
##
## Applies derining by using a smart smoother near edges (where ringing occurs) only.
##
## Usage: Import("HQDering-v0.1.avs")
## HQDering()
##
####
function HQDering(clip input, int "strength", int "overall", clip "smoother") {
strength = Default(strength, 255) # strength, 0-255
overall = Default(overall, 0) # overall smoothing, 0-255
smoothed = defined(smoother) ? smoother : input.Deen("a3d",4,15,15,20) # filter that smooths
normalmask=input.mt_edge(thY1=3, thY2=255, mode="sobel", chroma="none")
amplifiedmask=normalmask.Levels(0, 3.3, 90, 0, 255).Blur(1.0)
thickmask=normalmask.mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 90, 0, 255)
\ .Blur(1.0).mt_inflate().mt_inflate().mt_inflate().Levels(0, 3.3, 255, 0, 255)
\ .mt_inflate().mt_inflate()
ringingmask=mt_lutxy(amplifiedmask.mt_invert(), thickmask, expr="x y * 255 /").Levels(60, 3.0, 140, overall, strength)
mt_merge(input, smoothed, ringingmask)
}
Since the avtech doesn't really help anymore for deringing, besides suggesting to use mpeg2source's cpu parameter (which wasn't doing the job, in this case), and the only deringer suggested in the past was blinddehalo3 which blurred too much to get working results. >_<
I'll note here that this deringer, while giving a nice and non-blurry output, can introduce aliasing, especially noticeable at high strength (default is max, btw, you might want to see how low you can go), even more odd looking if you try to chain it twice. Perhaps the odd look might not be there in anime, but since I had to use this on LA footage, it was pretty noticeable. >_< Still better than blurry output, tho.











