View Full Version : Request: need MaskTools v2.x adaptation of HQDering
Chainmax
3rd March 2006, 13:42
I have a source with quite strong haloing which DeHalo_Alpha can't completely remove. I want to try using HQDering with low settings (so as to not produce aliasing) as a postprocessor, but it requires MaskTools v1.4.9. Could someone please adapt it to MaskTools v2.x but keeping its functionality intact?
foxyshadis
3rd March 2006, 20:19
Is this (http://forum.doom9.org/showthread.php?t=103859) an effective source? Or is there a better one? It's a bit of a crazy function, slower than it has to be, but it won't be hard to convert.
Chainmax
3rd March 2006, 21:30
I once was about to ask for an optimization of HQDering, but DeHalo_Alpha came out at about that point so I didn't go through wth the request. Besides, I figure you script experts already have too much on your plates to add the optimization of an obsolete function on it. That's why I'm only requesting this conversion.
The official thread on here is this one (http://forum.doom9.org/showthread.php?t=67532&highlight=hqdering). I'm not sure if mf posted an updated version at his forum or not but since it's been down forever it doesn't matter.
foxyshadis
3rd March 2006, 22:07
Do you mind if I change the semantics slightly? It's pretty messy about smoother parameters, when it makes a lot more sense to just pass in a smoothed clip. Like
hqdering(200,smoother=RemoveGrain(mode=4))
(Default is same as before, of course.)
######
##
## 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)
}
Chainmax
3rd March 2006, 22:32
Thanks a lot, I really appreciate it :).
About the semantics change: it's great, much more logical. The appropriate call for HQDering(strength=255, smoother="Unfilter", params="-50, -50") would now be HQDering(255,smoother=Unfilter(-50,-50)), right?
[edit]I guess not, because with that call it gives me a "there is no function called Deen" error. The smoother=... parameter is probably being ignored.
foxyshadis
3rd March 2006, 23:55
Interesting, I didn't notice since I have Deen, but it'll still try to evaluate it even if you don't use it. One of those leaky abstractions I forgot about. Replace smoothed =... with:
smoothed = defined(smoother) ? smoother : input.Deen("a3d",4,15,15,20)
I've edited the above to reflect this.
Chainmax
4th March 2006, 00:42
Now I get a "there is no function named mt_mask" error.
foxyshadis
4th March 2006, 00:55
Gah! Why do I always do that. mt_edge becomes mt_mask when I type it out. Sorry about that.
Chainmax
4th March 2006, 01:53
Now it works, thanks :).
DryFire
4th March 2006, 03:04
Another thanks from me.
Should we expect to see a speed increase?
foxyshadis
4th March 2006, 03:32
I'll see whether I can whip something up quickly; I have to figure out what he was aiming for and find a faster way to get there. If nothing else, a partial speedup should be easy.
Didée
4th March 2006, 04:01
And here we go again ...
Available:
TTempSmooth( [radius] , [threshold_high] , [threshold_low] , [Analyze-Clip] )
Wanted:
The spatial equivalent.
Chainmax
4th March 2006, 04:01
HQDering() was an almost perfect dehaloer: it removed it quite well and sharpened the picture to boot. Too bad it created aliasing and the parameters I'm using aren't nearly as nice :(.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.