Log in

View Full Version : silly question ... how to return null clip ?


halsboss
22nd November 2008, 02:57
Searched but couldn't find the right syntax. Am modifying LimitedSharpenFaster to incorporate mp4guy's changes as extra modes (for my own use) and can't find out how to return a null clip.

I need it to go something like from
OLD

Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")

NEW

dfg = Smode==1 ?
\ MT_lutxy(last, fq2d("bcl", 256, 0, gamma=1, rescale=false), "y "+string(round(strength/100))+" * 127 + X + 127 -", u=2, v=2).invert
: null
Str=string(float(strength)/100.0)
normsharp = Smode==1 ? MT_lutxy(dfg, fq2d(dfg, "bcl", 256, 0, gamma=1, rescale=false), "y "+string(round(strength/100))+" * 127 + X + 127 -", u=2, v=2).invert
\ : Smode==2 ? unsharp(vary=1.5, varc=1.5, strength=1)
\ : Smode==3 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")

I guess I could put each part of each mode into sub-functions, however to make minimal changes, what's the best way to get it to do nothing for the dfg clip ?

PS, what's fq2d (I'll search but a hint would be good.

halsboss
22nd November 2008, 03:02
Oh, just found NOP ... I guess if should be this ?

Smode == 1 ? dfg = MT_lutxy(last, fq2d("bcl", 256, 0, gamma=1, rescale=false), "y "+string(round(strength/100))+" * 127 + X + 127 -", u=2, v=2).invert
\ : NOP

Anyway, about that null clip...

stickboy
22nd November 2008, 07:48
http://www.avisynth.org/stickboy/

Gavino
22nd November 2008, 09:42
Oh, just found NOP ... I guess if should be this ?
NOP serves your purpose fine, but in fact you could just as easily use 0 or 42 here. See this thread.

There is no such thing as a null clip. There is what is effectively a null value, which you can get from stickboy's Undefined() function or something equivalent.

halsboss
22nd November 2008, 10:43
Thankyou, the code I gave above didn't work so I had to settle on

dfg = Smode==5 ? MT_lutxy(last, F2Quiver("bcl", 256, 0, gamma=1, rescale=false), "y "+string(round(strength/100))+" * 127 + X + 127 -", u=2, v=2).invert : NOP()

Thanks Gavino that thread is a good one.

stickboy
22nd November 2008, 18:41
There is no such thing as a null clip. There is what is effectively a null value, which you can get from stickboy's Undefined() function or something equivalent.Well, I'd define a null clip as a clip with 0 frames (which is what my NullCip function creates).

Gavino
22nd November 2008, 19:56
Well, I'd define a null clip as a clip with 0 frames (which is what my NullCip function creates).
Yes, I agree that fits the bill nicely. It is a genuine clip and can be used as such, unlike the null value.

Conversely, NOP (being zero) and Undefined() use almost no memory, so are more appropriate when you are not going to use the value.