Log in

View Full Version : MaskTools - strange behavior


redfordxx
18th March 2005, 00:26
I tried to use some functions in masktools. It gave me sometimes weird results.
I can reproduce these 2 examples:clip.YV12LUT(yexpr="x",uexpr="x",vexpr="x")
clip.YV12LUT(yexpr="128",uexpr="128",vexpr="128")The first, I would expect original, but received only light green version of it.
Second, I expected grey clip, but received green...

What could be wrong (AMD A XP 2500+, WinXP, MaskTools 1.5.5 and 1.5.6)?

Manao
18th March 2005, 07:31
Nop, a careful reading of the documentation would have allow you to see that default settings are Y=3, U=1 and V=1, which means luma is processed while chroma is trashed ( hence its content isn't even predictible ). u=v=2 means that chroma is preserved, but not processed. u=v=x <= 0 means that u and v will be set to -x.

redfordxx
18th March 2005, 11:06
Originally posted by Manao
Y=3, U=1 and V=1
Aaaaa, I know these parameters, but sometimes I forget. I try today evening.

As I understand it, LUT should be the fastest solution possible and even the most complicated math operation is here equally fast coz it's calculated only once, right?

In avisynth is an Invert function and in MaskTools too. How do I decide, which is called?

Manao
18th March 2005, 11:13
> As I understand it, LUT should be the fastest solution

It depends what operation you want to do. A specialized filter would do faster the operation "x = x * 2", for example. But as a general purpose solution, yes, the LUT is the fastest possible, and speed will remain the same whatever the operation.

> In avisynth is an Invert function and in MaskTools too. How do I decide, which is called?

IIRC, i removed invert from the masktools. Perhaps i forgot to remove it from the documentation.

redfordxx
18th March 2005, 11:48
I looked again in the documentation. Now I see the misunderstanding.- value=2 will copy the 2nd video plane (if appliable) to the output corresponding plane
- value=1 will not process it (i.e., most often, left it with 1st clip plane or garbage - check by yourself)I understood, that value=2 is applicable when two videos are processed (YV12LUTxy).

So I am again not sure. You wrote here, that if I use a function in MaskTools, value=2 means preserve original. From doc I understand, when I process two clips value=2 means to preserve original of second clip and value=1 when (I am lucky) preserve first clip. Confused. (Till now I've been using 1 believing it preserves original...)

Manao
18th March 2005, 12:11
OK, indeed, the documentation isn't clear on the effect of u,y,v=2 ( in fact, it's even somehow wrong ) :

* If the filter takes only one video as input, 2 will preserve the plane, while 1 will give random data.
* If the filter takes two videos as input, it depends of the filter
- MaskedMerge : 1 will copy first video plane, while 2 will copy the second one
- YV12LUTxy, YV12Substract : 1 will give random data, while 2 will copy the *first* video plane.

Sorry for this mistake. I'll update tonight the online documentation.

redfordxx
18th March 2005, 12:42
Originally posted by Manao
in fact, it's even somehow wrongMaybe, in next version in MaskTools, the best solution will be ALWAYS (for all functions):
1=1st video
2=2nd video, if doesn't exist, first video.
I believe that (provided we admit nobody is interested in random data) this is backwards compatible...
...IMHO

Didée
18th March 2005, 12:54
Manao, I wanted to ask this for quite a while:

What is the limit of expression length (the string's length) for the LUT commands? Somewhere there *must* be a limit, either from MaskTool's or from AviSynth's side. I didn't hit it up to now, but I've some operations in mind that, although easy from the idea's principle, might get *very* lenghty in reverse polnic (or however it's spelled) ...

Manao
18th March 2005, 13:34
redforxx : the garbage also means that it'll be faster, because you avoid a copy. For MaskedMerge, garbage shouldn't happen, because its aim is to construct a valid result. However, for YV12LUTxy and YV12Substract ( and YV12Logic & co ), their aim is to build masks and work on them, so you may want to work only on a particular plane. As these filters are symetrical ( you swap the input clips, you get the same results - or you can get the same results ), it doesn't decrease their usability.

Didee : there are no limitation from my side. I guess you can go pretty high.

Didée
18th March 2005, 16:16
Manao: Now I got really curious, and tested it out: Seems like 4096 (4095? might have miscounted) is the limit for string's length. Above that, AviSynth spits out an "evaluate: unreckognized exeption".

Phew. That should really suffice. If I should need more, it's time to visit me in the madhouse :D

redfordxx
22nd March 2005, 00:42
Originally posted by Manao
redforxx : the garbage also means that it'll be faster, because you avoid a copy.Can be understood. Leaving a blank page won't help for the speed? Well, sorry that's my OT curiosity, don't bother with thatYV12SubstractYeah, I thought too, but the function not found. I tried YV12Subtract and it worked.;) Now I noticed that you use both expressions in doc.As these filters are symetrical????????
I guess logic, but subtract and lutxy?