PDA

View Full Version : Strange bug with trim + mergeluma


Manao
29th July 2004, 06:49
The following script doesn't work :source = mpeg2source("K:\amelie.d2v",cpu2="oooooo").crop(8,80,-8,-80)
avance = source.trim(1,0)
resultat = source.mergeluma(avance)
return resultatWhereas this one doessource = mpeg2source("K:\amelie.d2v",cpu2="oooooo").crop(8,80,-8,-80)
avance = source.trim(1,0)
resultat = source.mergechroma(avance)
return resultatAs does this onesource = mpeg2source("K:\amelie.d2v",cpu2="oooooo").crop(8,80,-8,-80)
avance = source.blur(1.0).trim(1,0)
resultat = source.mergeluma(avance)
return resultatAnd, worse, this one does too :source = mpeg2source("K:\amelie.d2v",cpu2="oooooo").crop(8,80,-8,-80).blur(1.0)
avance = source.trim(1,0)
resultat = source.mergeluma(avance)
return resultatIn the first script, the chroma isn't correclty updated on a linear access to the frame ( right arrow in vdub for exemple ), whereas a random access makes it output the right frame. The three other clips show no problem at all.

I had a look to the source code of mergeluma / mergechroma, there is a difference when the luma / chroma is simply copied : in mergechroma, the chroma is moved to the first clip which is returned, while in mergeluma, the chroma is moved to the second clip, which is then returned.

Edit : I forgot : latest avisynth 2.55, vdubmod 1.5.4.1

Mug Funky
29th July 2004, 10:05
try crop(blah, align=true) ?

not sure if this does anything though.

btw, i love that movie

sh0dan
29th July 2004, 12:27
Try if you can replicate using june 17th binary, and perhaps plain 2.54.

Manao
29th July 2004, 19:39
Sorry for the late answer. Plain 2.54 doesn't work either, didn't try intermediary 2.55 alpha. Neither does align = true in crop ( that would have astonished me ). The issue is still here without the crop.

More details even :

In the GetFrame() method of an avisynth filter, we have two choices to output a frame : either we make the received frame writable, or we create a new one. If the latest filter used for defining the source is a filter which doesn't create a new frame, it doesn't work. If it creates a new frame, it works. I tried with blur, deen ( create a new frames ) and binarize, yv12lut ( doesn't create a new frame ).

The bug can be solved 'easily' by changing mergeluma in order him to copy the luma into the frame ( instead of changing the clip and copying the chroma ). But I don't know if what is currently implemented in mergeluma is supposed to work or not ( meaning, does this bug is a avisynth' bug, or a mergeluma's one ? )

sh0dan
29th July 2004, 20:00
What a stupid mistake to. Anyway - it's fixed.

Btw. the problem was that I wan't at any time requesting the Write pointer for the LUMA plane. If this isn't done then the image isn't properly ref-counted, and not marked as updated. Anyway - thanks for the detailed report - it made it very easy to spot the mistake!

Manao
29th July 2004, 20:24
Huh ? You need to request the write pointer of the luma plane ? Why is that so ? The MakeWritable isn't enough ? And is it the case for the chroma planes pointers ? ( I want to avoid such issues with my filters, if I ever have to use a construction like the one of mergeluma ).