Log in

View Full Version : Avisynth's strangeness ?


Manao
12th March 2004, 23:07
Sorry for the not precise post title, but I didn't know how to name that.

Thanks to Didée, I found what I thought was a bug in one of the MaskTools' filters. However, the way the bug is happening is more than strange. Let me explain :

The issue is with YV12LUT, which applies an arbitrary function to all the pixels of the clip. With some special filters' combinations, instead of returning for a pixel whose value is x, f(x), it systematically returns f(0).

The strangeness comes in fact from the non systematicallity of this wrong behavior. Look at the following two examples : source = MPEG2Source("R:\foo.d2v")
attempt1 = source.MotionMask()
attempt2 = source.MotionMask().YV12LUT(Yexpr = "x 2 *")
attempt3 = source.YV12LUT(Yexpr = "x 2 *")
return Interleave(attempt1,attempt2,attempt3)source = MPEG2Source("R:\foo.d2v")
attempt2 = source.MotionMask().YV12LUT(Yexpr = "x 2 *")
attempt1 = source.MotionMask()
attempt3 = source.YV12LUT(Yexpr = "x 2 *")
return Interleave(attempt2,attempt1,attempt3)They do not give the same output. attempt3 is the one expected, attempt1 also, but in the first case, attempt2 is correct, in the second it is not.

Moreover, trying simply the attempt2's line alone triggers the wrong behavior. That behavior also happens with YV12Subtract, but no other filters ( in the MaskTools ) makes YV12LUT behave wrongly.

There is nothing special about these two particular filters. MotionMask is the only one to use a reference from the previous frame, but the behavior doesn't show up with TemporalSoften, or Deen or Convolution3D for example.

YV12Subtract works exactly the same way as YV12Layer for example ( modifies in place the first clip ), but YV12Layer has no issue at all.

----

YV12Lut is working as expected, excepted when used directly after one of these two filters, and even not always.

MotionMask and YV12Subtract also work correctly, except in these two situations where it is followed by YV12LUT. So I can only think of something happening between them. If I add a filter inbetween that does nothing ( a levels for example ), it doesn't work better.

So I'm totally lost.

I have however a question for avisynth's devs : what happens if a filter modifies in place a frame ( with creating a new one ) ? And more generally, what happens between filters ?

Didée
13th March 2004, 17:22
For the record, it seems that YV12LUT after DEdgeMask is dangerous, too. In the iiP script, I now successfully use YV12LUT in all instances, exept for one where a DEdgeMask is preceeding (look in the last third of iiP, in the section "# Build new edgemask ... edge2=..."). There, for example, the Y-levels adjustment works correctly only if gamma=1.0.

Seems to be a really strange issue.

- Didée

Manao
14th March 2004, 09:51
And I can't reproduce this one. Damn it. I'm more and more at lost here.

BTW, useMMX is useless at the moment for DEdgeMask. And I fear it'll never be used in fact.