Log in

View Full Version : Yet another bug report: Crop and StackVertical in YV12


mf
10th April 2003, 12:39
I'm getting pretty desperate at AVISynth. Whenever I try something exotic I find bugs.

This works:
LoadPlugin("D:\Video\Avisynth\Avisynth\MPEGDecoder.dll")
LoadPlugin("D:\Video\Avisynth\Avisynth\MPEG2Dec3.dll")
LoadPlugin("D:\Video\Avisynth\Avisynth\Decomb.dll")

prev = MPEGSource("G:\file.vob").Telecide(guide=1).BlindPP(cpu2="ooxxxx")

grey = prev.GreyScale()

new = Crop(grey, 0, 0, 0, 2)
new2 = Crop(grey, 0, 2, 0, 0)
return prev.MergeLuma(StackVertical(new, new2))

But this doesn't:
LoadPlugin("D:\Video\Avisynth\Avisynth\MPEGDecoder.dll")
LoadPlugin("D:\Video\Avisynth\Avisynth\MPEG2Dec3.dll")
LoadPlugin("D:\Video\Avisynth\Avisynth\Decomb.dll")

prev = MPEGSource("G:\file.vob").Telecide(guide=1).BlindPP(cpu2="ooxxxx")

grey = prev.GreyScale()

new = Crop(grey, 0, 0, 0, 2).ShowFrameNumber()
new2 = Crop(grey, 0, 2, 0, 0)
return prev.MergeLuma(StackVertical(new, new2))
Change between first script and second is highlighted. Now I really don't get why a simple ShowFrameNumber would cause an access violation. Basically any filter I place in there causes an access violation (originally I wanted to do a levels correction on "new").

sh0dan
10th April 2003, 13:00
There is a reason it's still labeled "beta".

I cannot reproduce the crash. However - your "new" is only 2 pixels high, so this is probably why AviSynth has problems with it. Many filters have problems with sizes less than 4x4 pixels in either direction.

The following script works fine here, with the latest CVS binary:

prev = AVISource("d:\video\drf\peter\620.AVI", pixel_type="yuy2").converttoyv12()
grey = prev.GreyScale()
new = Crop(grey, 0, 0, 0, 2).ShowFrameNumber()
new2 = Crop(grey, 0, 2, 0, 0)
MergeLuma(prev,StackVertical(new, new2))


btw, there is no need to use greyscale, since you are only merging luma.

mf
10th April 2003, 13:07
And if the clip is YV12 ?

Btw: I know it's beta, and I'm happy to help improve it. It's just kind of annoying :D.

Explanation for my script:

LOTR has a lighter top line which is annoying when played fullscreen. So I wanted to seperate that line, perform levels correction, and stack them back. mod2 is preventing this from happening optimally, I just stumbled upon this while testing. I'm now gonna go on, and throw in some ConvertToRGBs to evade mod2.

One question btw, we have a mystery on #xvid :). Is Y 0-255 ? If so, I can safely convert to RGB in greyscale and convert back to YUV, and then merge the chroma back. It'll just be a bit slow.


Edit: this is the working script, I just posted the bug (for me anyway) because even though it doesn't directly apply to me someone else will probably find it one day and it'd be better to have it fixed :)
prev = MPEG2Source("D:\DIR\file.d2v").Crop(6,76,708,424).Convolution3D(preset="movieLQ").BicubicResize(704,288,0,0.75)

grey = prev.GreyScale().ConvertToRGB32()

new = Crop(grey, 0, 0, 0, 1).Levels(0, 1, 255, 255, 0)
new2 = Crop(grey, 0, 1, 0, 0)

return prev.MergeLuma(StackVertical(new, new2).ConvertToYV12())

sh0dan
10th April 2003, 13:30
Y is 16-235 (inclusive).

As you can see the source is converted to YV12, so this is in YV12 mode. Which binary are you using?

This does what you want:

grey = converttoyuy2(prev)
new = Crop(grey, 0, 0, 0, 1).levels(20,2.0,225,0,255)
new2 = Crop(grey, 0, 1, 0, 0)
new3 = StackVertical(new, new2).converttoyv12()
MergeLuma(prev,new3)

Without the quality and speed penalty.

mf
10th April 2003, 13:36
Originally posted by sh0dan
Y is 16-235 (inclusive).

As you can see the source is converted to YV12, so this is in YV12 mode. Which binary are you using?

This does what you want:
Without the quality and speed penalty.
Ah! Sorry I didn't see the convert. I'm using a version from http://cultact-server.novi.dk/kpo/avisynth/avisynth_alpha.html, downloaded a few days ago. And thanks for the hint on YUY2, I totally forgot that :).