PDA

View Full Version : Please help me modify this function.


AssassiNBG
22nd March 2007, 16:33
I have this function which uses MaskTools 1.5.8 but that version of masktools is conflicting with another dll so I wonder if you could help me out in modifying this function to work with masktools 2.0a30.

function antialiasing(clip orig,int "th_luma",int "th_croma",string "type",int "aath") {

# "th_luma" & "th_croma" are the edge detection thres.: lower values=more edges filtered
# "type" is the matrix used for edge detection: with "sobel" (default) only the
# hi-contrast edges, where artefacts are more noticeable, are filtered. If you want
# to test other matrices, read the MaskTools Guide for more info.
# "aath" = anti-aliasing strenght (default should be fine)

th_luma = Default(th_luma, 20)
th_croma = Default(th_croma, 20)
type = Default(type, "sobel")
aath = Default(aath, 48)
ox = orig.width
oy = orig.height
dx = orig.width * 2
dy = orig.height * 2
clp = orig.IsYV12() ? orig : orig.ConvertToYV12()

a=clp
b=clp.Lanczos4Resize(dx,dy).TurnLeft().SangNom(aa=aath).TurnRight().SangNom(aa=aath) \
.LanczosResize(ox,oy)
c=clp.EdgeMask(th_luma,th_luma,th_croma,th_croma,type)
MaskedMerge(a,b,c)

}

The only calls that don't work are EdgeMask and probably MaskedEdge if it's been changed too. The masking in the new masktools is called with mt_edge.

I would really appreciate it if someone could help me out in any way.

MOmonster
23rd March 2007, 12:45
I didnīt tested but if you change this code:
c=clp.EdgeMask(th_luma,th_luma,th_croma,th_croma,type)
MaskedMerge(a,b,c)
into this:
c=clp.mt_edge(mode=type, thY1=th_luma, thY2=th_luma, thC1=th_croma, thC2=th_croma)
mt_merge(a,b,c)
the function should run fine with masktools 2.0 alpha.

AssassiNBG
23rd March 2007, 13:15
Yep, this definitely fixes the problem ! Thank you so much MOmonster!

EDIT: Actually, it doesn't fix the crashing problem (described in the fft3dgpu thread), but the function does work using those changes. Now I have no idea what is causing this ...