Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 14th September 2012, 20:46   #1  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
VDub filter crashes - need quadrilateral transform

Could someone help me what to do against a VDub filter crash?
Trying SetMemoryMax() did not help. It is a 32bit Windows7 system with 4GB, Avisynth 2.58
Quadrilateral sometimes delivers one frame in the AvsPmod preview, but never the next frame. There is always an access violation.
Another good quadrilateral transform I know of is ImageMagick, but I need to call it from the runtime environment, and my suggestion in this forum how to call Imagemagick filters does not work in the RTE.
VCMohan's Reform plugin also crashes in the RTE.
The vdf is 'General Quadrilateral Transform (v0.98)' from Alain Vielle.
Code:
LoadVirtualDubPlugin("C:\...\Quadrilateral.vdf", "QuadrilateralVDF", 0)
AviSource("C:\...\x.AVI")
ConvertToRGB()
c = last
xa1 = 0
ya1 = 0
xb1 = c.width
yb1 = 0
xc1 = c.width
yc1 = c.height
xd1 = 0
yd1 = height
xa2 = 200
ya2 = 0
xb2 = c.width
yb2 = 0
xc2 = width
yc2 = height
xd2 = 0
yd2 = height
str = string(xd1)+" "+string(xc1)+" "+string(xa1)+" "+string(xb1)+" "+string(yd1)+" "+string(yc1)+" "+string(ya1)+" "+string(yb1)+" "+string(xd2)+" "+string(xc2)+" "+string(xa2)+" "+string(xb2)+" "+string(yd2)+" "+string(yc2)+" "+string(ya2)+" "+string(yb2)
subtitle(str)
c.QuadrilateralVDF(1, 1, 1, 0, str)

Last edited by martin53; 20th September 2012 at 19:39.
martin53 is offline   Reply With Quote
Old 15th September 2012, 08:08   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Tried your problem script, (only 20 secs clip), no probs (XP32)
but noticed that your coords are off by 1, ie should be eg width-1 not width.
The VD interface limits extremes to eg max x coord not width, will not allow to enter
bigger, so it could well the the problem, also plug is beta.
Give it a try with corrected coords.


Code:
LoadVirtualDubPlugin("D:\avs\avi\Quadrilateral.vdf", "QuadrilateralVDF", 0)
AviSource("D:\avs\avi\1.AVI")
ConvertToRGB32()
c = last
xa1 = 0
ya1 = 0
xb1 = c.width-1
yb1 = 0
xc1 = c.width-1
yc1 = c.height-1
xd1 = 0
yd1 = height-1
xa2 = 200
ya2 = 0
xb2 = c.width-1
yb2 = 0
xc2 = width-1
yc2 = height-1
xd2 = 0
yd2 = height-1
str = string(xd1)+" "+string(xc1)+" "+string(xa1)+" "+string(xb1)+" "+string(yd1)+" "+string(yc1)+" "+string(ya1)+" "+string(yb1)+" "+string(xd2)+" "+string(xc2)+" "+string(xa2)+" "+string(xb2)+" "+string(yd2)+" "+string(yc2)+" "+string(ya2)+" "+string(yb2)
subtitle(str)
c.QuadrilateralVDF(1, 1, 1, 0, str)
EDIT: Also should be RGB32
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 15th September 2012 at 11:15.
StainlessS is offline   Reply With Quote
Old 16th September 2012, 20:10   #3  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Quote:
Originally Posted by StainlessS View Post
Tried your problem script, (only 20 secs clip), no probs
Hmm, I already guessed I need not only mention 'RTE' in the post, but also provide the crashing instead of the working example:

Code:
LoadVirtualDubPlugin("D:\avs\avi\Quadrilateral.vdf", "QuadrilateralVDF", 0)
AviSource("D:\avs\avi\1.AVI")
ConvertToRGB32()
Scriptclip("""
c = last
xa1 = 0
ya1 = 0
xb1 = c.width-1
yb1 = 0
xc1 = c.width-1
yc1 = c.height-1
xd1 = 0
yd1 = height-1
xa2 = 200
ya2 = 0
xb2 = c.width-1
yb2 = 0
xc2 = width-1
yc2 = height-1
xd2 = 0
yd2 = height-1
str = string(xd1)+" "+string(xc1)+" "+string(xa1)+" "+string(xb1)+" "+string(yd1)+" "+string(yc1)+" "+string(ya1)+" "+string(yb1)+" "+string(xd2)+" "+string(xc2)+" "+string(xa2)+" "+string(xb2)+" "+string(yd2)+" "+string(yc2)+" "+string(ya2)+" "+string(yb2)
subtitle(str)
c.QuadrilateralVDF(1, 1, 1, 0, str)
""")
(the offset should have no effect because original and transformed frame have the identical offset and quadrilateral gently handles coordinates outside the frame - but still thanks for the hint!)
martin53 is offline   Reply With Quote
Old 17th September 2012, 00:25   #4  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by martin53 View Post
but also provide the crashing instead of the working example:
Yep, thats probably is a good idea.

EDIT:
Tried your crashing script with a 1920x1080 clip, no problems, even with the width rather than width-1
settings. Dont know what your problem is. (Of course the subtitle line does nothing)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 17th September 2012 at 10:53.
StainlessS is offline   Reply With Quote
Old 17th September 2012, 21:23   #5  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
StainlessS,
thank you very much for the test!
I confirm: the script works on my XP32 netbook.

Does anyone have an idea (or is there a thread) about how Win7/32 (~3.5GB available RAM) could be different in terms of executing this quite simple runtime script?

I have installed the neccessary VC runtimes, Haali Media Splitter and that stuff, a quite actual ffdshow configured to the minimum extent needed to open all usual media sources (MP4,MKV,FLV). I'm not aware of having installed any evil tweaks on either of the systems. E.g.
- global Data Execution Prevention is off.
- Deactivated antivirus realtime engine had no effect.
- Changing "AviSource" to "DirectShowSource" had no effect.

AvsPmod, MPC-HC and Virtualdub portable fail to play from the 2nd frame of the script on the Win7 system (the 1st frame is displayed correctly) with this error:
"CAVIStreamSynth: System exception - Access Violation at 0x77c22c39, reading from 0x89b001f" (VDub),
"WindowsError: exception: access violation reading 0x0735001F" (AvsPmod),
"CAVIStreamSynth: System exception - Access Violation at 0x77c22c39, reading from 0xbbb001f" (MPC-HC).

Script runs fine when I comment out the Quadrilateral line, then showing the parameters as subtitle. That makes me guess it's not the input to the script, it's something in the combination W7 - RTE - way_the_plugin_is_written?
Note: the plugin can be executed outside the RTE (Scriptclip and closing quote lines commented out), except when a lot of other programs are running, then similar behaviour occurs.

EDIT 9/19/12:
Smaller example config, using a 640 by 480 sample clip:
Code:
LoadVirtualDubPlugin("D:\avs\avi\Quadrilateral.vdf", "QuadrilateralVDF", 0)
AviSource("D:\avs\avi\1.AVI")
ConvertToRGB32()
Scriptclip("""QuadrilateralVDF(1, 1, 1, 0, "0 639 0 639 479 479 0 0 0 639 0 639 479 479 0 0")""")
- deactivated ffdshow
- removed all plugins and avsi scripts from plugin folder
- re-encoded the AVI from MJPG to hfyu and used that source file
- DebugView logs several lines when the clip is loaded (~67 lines with VDub portable). No additional line is logged when I advance from the first displayed to the second -failing - frame.
- After AvsPmod, Virtualdub or MPC-HC fail with the error, their processes remain as zombie processes (found with Proceess Explorer)
- installed EMET, turned off all memory security methods for VirtualDubPortable.exe / for VirtualDub.exe and opened the script in Virtualdub Portable
- tried to run VirtualDub under control of Ollydbg. I must admit I am absolutely new to debugging Windows programs. So I failed because VirtualDub.exe expects to find the prepared environment from VirtualDubPortable.exe. Running this one under OllyDbg.exe made everything run fine, but when the access violation appeared, OllyDbg did not notice anything. Also, running MPC-HC under OllyDbg failed: in the debugger, MPC-HC's "open file" dialog crashed. AvsPmod's program start up created loads of access violations in OllyDbg, and Windows Media Player crashed similar to MPC-HC. Also, I did not succeed in starting VirtualDubPortable.exe, then attaching OllyDbg to the VirtualDub child process: that made stop all threads of the process and I was unable to resume any one of them.
EDIT 9/20/12:
- Set VirtualDub.exe (not VirtualDubPortable.exe) to Windows XP SP3 compatibility mode with Windows compatibility assistant & opened the script in this prog. Same behaviour as before.
EDIT 9/21/12:
- Test on different system with W7/32 with same result (copied here for completeness from 2 posts below)

No remedy so far.

Last edited by martin53; 21st September 2012 at 22:46. Reason: Test on different system
martin53 is offline   Reply With Quote
Old 21st September 2012, 20:04   #6  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
This is a long shot and I only mention it because StainlessS has been unable to reproduce your crash.

I wonder if you have bad RAM on your W7 system. It sounds a lot like errors I have had with almost stable overclocked RAM. A lot of things work but some tasks always crash. This is different to the totally random crashes that can also happen when over clocking. Sometimes the error is so specific it doesn't show itself unless you do something very specific.

Now I know you probably are not overclocking anything but I have also had these problems, albeit rarely, with a bad stick of RAM. It would usually work but a specific task would kill it (usually a particular video game in my case).

Try a good ram test or the most aggressive test IMO; a good 24h of prime95 in "blend" test mode, if you want to check.
Asmodian is offline   Reply With Quote
Old 21st September 2012, 20:24   #7  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Asmodian,
thanks for the hint. I am sceptical, because the symptom is absolutely reproduceable, regardless of RAM usage (lots of big other progs open), temperature (happens immediately after start and exactly the same way after hours), with every player. It does not happen with any of the lots of plugins that I am using over years, and it is reproduceable no matter what is coded in advance of this specific plugin. The original event was in a 200+ lines realtime function. It always happens at the 2nd frame. Only with this VDub plugin. I use my system a lot and it is very, very stable. Neither with image processing nor with video processing do I experience any flaws, very rare and explainable application freezes, no bluescreens at all, and the system RAM was not modified since start of 2010 (I had one bad RAM after I built the system in autum 2009 indeed).

It has all aspects of a SW problem and no aspect of a HW problem. - Yes, no overclocking of course. I would feel impudent to sabotage my system and then ask unsuspecting people for help.
Edit
Tested the script on my wife's laptop, same result. Asmodian, thanks, but does that convince you too?

Can anyone confirm that the example script does run under Win7/32 on his system?

Last edited by martin53; 21st September 2012 at 22:48.
martin53 is offline   Reply With Quote
Old 21st September 2012, 22:51   #8  |  Link
vdcrim
Registered User
 
Join Date: Dec 2011
Posts: 192
Crashes also for me on Windows 7 64-bits, Avisynth 2.6 (SEt's builds) with ScriptClip, and for non-linear access without ScriptClip. Mohan's plugin works in both cases though. This is with ColorBars() as source and also with real videos.
vdcrim is offline   Reply With Quote
Old 21st September 2012, 22:53   #9  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
One question, does the Quadrilateral plugin work correctly in VirtualDub alone with the same size frame on your Win7/32 system?

Quote:
"CAVIStreamSynth: System exception - Access Violation at 0x77c22c39, reading from 0x89b001f" (VDub),
"WindowsError: exception: access violation reading 0x0735001F" (AvsPmod),
"CAVIStreamSynth: System exception - Access Violation at 0x77c22c39, reading from 0xbbb001f" (MPC-HC).
The partial code addresses are the same, 0x2c39, and the partial fault addresses are the same, 0x1001f, so this is probably a programming out of bounds error. Unfortunately it seems the author never released the source before loosing interest in the project.


Assuming the plugin is faulting on reading the source frame, you could try padding the source frame thus :-
Code:
LoadVirtualDubPlugin("D:\avs\avi\Quadrilateral.vdf", "QuadrilateralVDF", 0)
AviSource("D:\avs\avi\1.AVI")
ConvertToRGB32()
AddBorders(16, 16, 16, 16, $FFFF00) # Pad frame
Crop(16, 16, -16, -16) # Mask padding
Scriptclip("""QuadrilateralVDF(1, 1, 1, 0, "0 639 0 639 479 479 0 0 0 639 0 639 479 479 0 0")""")
If this works the padding with bright yellow will be obvious in the output where any yellow pixels appear, indicating out of frame access.
IanB is offline   Reply With Quote
Old 21st September 2012, 23:36   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
The author has been back on line and perhaps could enlighten us all.

http://forum.doom9.org/showthread.ph...81#post1592181
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 22nd September 2012, 11:10   #11  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
StainlessS,
yes, I contacted the author. Currently, he cannot concern himself with the matter, but maybe in some weeks, he said.

IanB,
brilliant! I must admit, I'm a bit ashamed.
- VirtualDub shows the preview as expected. But afterwards, for example when I just want to close the video, VirtualDub crashes with this error message:
An out-of-bounds memory access (access violation) occurred in module 'ntdll'...
...reading address 06DD001F...
...while starting filter "General Quadrilateral Transform (v0.98)"
I remember that I wondered about a VirtualDub Crash later that evening, but was too tired to give it attention, and did not combine things.

- your padding example gives the same result, but
- ColorBars().ConvertToRGB32().BicubicResize(128,128).AddBorders(128,128,128,128).Crop(128,128,-128,-128).ScriptClip(...) made one core go to 100% CPU load (in the AvsPmod preview) until I lost patience. I'm going to change the quadrilateral parameters appropriately and play around with some more configurations.

EDIT
Although I think we understand the problem now, that hopefully the plugin can be reviewed, these are my test results.
Code:
LoadVirtualDubPlugin("D:\avs\avi\Quadrilateral.vdf", "QuadrilateralVDF",0)
ColorBars().ConvertToRGB32().BicubicResize(129,103)
#AddBorders(8000, 8000, 8000, 8000, $FFFF00) # Pad frame
#Crop(8000, 8000, -8000, -8000) # Mask padding
QuadrilateralVDF(1, 1, 1, 0, "0 139 0 139 126 126 0 0 0 139 0 139 126 126 0 0")
#Scriptclip("""QuadrilateralVDF(1, 1, 1, 0, "0 139 0 139 126 126 0 0 0 139 0 139 126 126 0 0")""")
- up to width 128, height 103, the result looks good and both quadrilateral alternatives work stable.
- with the non-RTE line active, starting from width 129, the result looks faulty towards the right edge, there is a tiny additional, mostly black column (although the quadrilateral x coordinates should support up to width 140). With the RTE line active, there is a tiny error message that I cannot read.
- starting from width 130 or height 104, one core (allow me to say "the Avisynth thread", although i guess AvsPmod & AviSynth use lots of threads) hangs at 100% forever.
- with reasonable clip dimensions, e.g. 640x480, see earlier posts.
- I could not identify a benefit from (even heavy) padding outside the RTE.
- With a multiline ScriptClip (with copies of the padding functions inside the RTE), I was able to increase the with, and read the error message: "ScriptClip: Function did not return a video clip with the same width as the source clip!" This error disappears with commenting out the quadrilateral function.
... so maybe it is not so much invalid read access in the input frame, but an invalid (too wide) frame being generated.

Last edited by martin53; 22nd September 2012 at 12:30. Reason: details about max. clip dimension tests
martin53 is offline   Reply With Quote
Old 22nd September 2012, 14:31   #12  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
I think that this VD plugin resembles V.C.Mohan's 'Reform' very much.
Do you have any inconvenience in Reform?
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 23rd September 2012, 11:58   #13  |  Link
martin53
Registered User
 
Join Date: Mar 2007
Posts: 407
Quote:
Originally Posted by Chikuzen View Post
Do you have any inconvenience in Reform?
Yes, like I mentioned in the thread starting post.
This script also crashes at my site in AvsPmod and VirtualDubPortable:
Code:
ColorBars()
Skew(last, ltopx=3, ltopy=3, lbotx=3, lboty=477, rtopx=637, rtopy=3, rbotx=637, rboty=407)
#Scriptclip("Skew(last, ltopx=3, ltopy=3, lbotx=3, lboty=477, rtopx=637, rtopy=3, rbotx=637, rboty=407)")
At the moment, it crashes right at the start. But there were times when it started playing successfully, crashing only after some dozen frames.

If it works as presented, move the comment marker one line up and try again.

Also less convenient with skew:
- All coordinates must be inside the frame range, and even some pixels away from the corners. So a frame that is to be 'almost not' transformed must still be padded somehow, and the padding color will leak into the result, I suspect. Quadrilateral allows skew, deskew and more in one function.
- Quadrilateral's interpolation looks better to me. With skew I remember seeing stairsteps.
- Quadrilateral's transformation allows real projective mapping , while the reform documentation says 'meant for minor distortions'.
martin53 is offline   Reply With Quote
Old 23rd September 2012, 12:28   #14  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
I tried reform recently, and found it always caused exceptions unless I used resize="line" or resize="point". It also seems not to be a true quad transform, as more extreme values result in curved sides to the quadrilateral.

David
wonkey_monkey is offline   Reply With Quote
Old 23rd September 2012, 15:50   #15  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
I would try to help with the crashing if the author will make his source code available.
Guest is offline   Reply With Quote
Old 23rd September 2012, 16:42   #16  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
I strung together some of my old code for doing quad transforms into an AviSynth filter.

No source, but also no crashes so far

David
wonkey_monkey is offline   Reply With Quote
Old 26th September 2012, 01:58   #17  |  Link
Wizal
Registered User
 
Join Date: May 2002
Posts: 38
Guys guys guys, please be patient, I'm not dead and I have of course the source of my Quad filter, but I'm currently in a hotel several thousands of miles from home.
Wizal is offline   Reply With Quote
Old 26th September 2012, 02:01   #18  |  Link
Guest
Guest
 
Join Date: Jan 2002
Posts: 21,901
Then when you get home we can have a shootout between the tools.
Guest is offline   Reply With Quote
Old 7th October 2012, 13:30   #19  |  Link
Wizal
Registered User
 
Join Date: May 2002
Posts: 38
Good news: I found the sources
Wizal is offline   Reply With Quote
Old 8th October 2012, 08:52   #20  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
Problem found, second delete of mfd->posx and mfd->posy arrays in BuildTransform(). Vista/W7 runtimes detect this and barf.

Fix, reset pointers to 0 after delete in EndProc()
Code:
int EndProc(FilterActivation *fa, const FilterFunctions *ff) {
	MyFilterData *mfd = (MyFilterData *)fa->filter_data;
	delete[] mfd->posx;
	delete[] mfd->posy;
	mfd->posx = 0;
	mfd->posy = 0;
	return 0;
}
See attached for mod'ed source and .vdf
Attached Files
File Type: zip Quadrilateral.zip (43.1 KB, 55 views)
IanB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:29.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.