PDA

View Full Version : Masktools 1.5.1 Unrecognized Exception?!


LB
16th September 2004, 01:45
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MPEG2Dec3dg.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools151.dll")

Mpeg2Source("L:\Episodes\Ep46\Ep46.d2v")

"Unrecognized Exception: Line 2" WTF?!!?! And yes, that is the ENTIRE script... so umm yeah...

Using:
WinXP Pro SP2
VirtualDub 1.5.10
Avisynth 2.5.5 Official Aug31 rls (also tried 2.5.4 and 2.5.3)
XEON CPUs (essentially pentium 4)


help? (and obviously masktools 149 works fine...)

Manao
16th September 2004, 07:31
Disable hyperthreading.

I don't know what's going on, I don't have a PIV to test, but that will work. If somebody have some input data on that issue, I'm interested, because I can't see what is going on. The only difference, I think, may come from the fact that 1.4.9 was compiled with intel compilator ( though I'm not even sure of that ), and that now I compile with M$ compilator, and I use the /G7 flag ( which should work for both PIV and Athlon ).

LB
16th September 2004, 08:12
Originally posted by Manao
Disable hyperthreading.

I don't know what's going on, I don't have a PIV to test, but that will work. If somebody have some input data on that issue, I'm interested, because I can't see what is going on. The only difference, I think, may come from the fact that 1.4.9 was compiled with intel compilator ( though I'm not even sure of that ), and that now I compile with M$ compilator, and I use the /G7 flag ( which should work for both PIV and Athlon ).

I'll try that. It's interesting you say that because my bro has an AMD and it works fine :eek:

LB
16th September 2004, 22:38
:(

I disabled HT and it didn't help. I'm still getting an "unrecognized exception" referring to the Masktools line. If I take out the line then vdub loads the avs fine, and if I also replace my 1.51 with 1.49 it loads fine... any ideas?

Manao
16th September 2004, 22:43
You put an 's' behind cpu. Does that mean you have dual Xeon ? If so, it may behave like a PIV alone, with hyperthreading, so it may be the same issue. If you can't disable one of the two processor, I don't think you'll be able to use the masktools.

BTW, if sh0dan or IanB are looking here, do you know what could be happening, because there are basically no differences between 1.4.9 and 1.5.1 except for new filters. I interface them with avisynth in the same way.

LB
19th September 2004, 01:23
Hey. Yeah, I have 2 x cpu. But if you say there is no real difference between v149 and v151, then it doesn't make any sense why v149 works, and every prior version works fine too, yet v151 doesn't work... :confused:

Oh, and I stripped out EVERYTHING but the bare minimum. Masktools + a huffy avi file... still doesn't load. I get that same "unrecognized exception line 1" error

LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools151.dll")
avisource("c:\test.avi")

http://img13.exs.cx/img13/7684/Untitled-118.gif

IanB
20th September 2004, 03:34
Manao,

This looks like the work of our friend the "Missing Exception handler code compiler bug". I still have no solution other than to check the assembler generated for missing init code for variables referenced by the Exception code, and there is a good chance it's not even in your code.

Puttingtry
{
...<lot'sa code here>...
}
Catch (...) { throw; }into affected routines seems to help (but so does shuffling data declarations).

LB,

Try putting MaskTools151.dll in the pluggin directory and letting it autoload instead of manually loading it. That code path is slightly different and may yield a hint.

IanB

LB
21st September 2004, 00:40
Originally posted by IanB
LB,

Try putting MaskTools151.dll in the pluggin directory and letting it autoload instead of manually loading it. That code path is slightly different and may yield a hint.

IanB

The DLL is and has always been in the plugin directory. Many, many, avs users have encountered a different problem where when using the auto-load feature of avisynth, virtualdub crashes (no error message) upon opening any avs file. I don't know if there is an agreed upon reason why this happens, but it's been an issue ever since auto-load was implimented, and occures frequently on MANY individuals PCs. The accepted solution has been to simply delete the registry entry for Avisynth in the registry which eliminates auto-loading... so I always do this.

But just for kicks I re-installed avisynth 2.5.5 (re-creating the registry entry), loaded up the avs with those above two lines in it and... CRASH. heh. No error message; which is expected. Once I delete the registry entry, I then get that same message as I screenshotted above. So... autoload doesn't help due to the "other" crash bug.

Incognito
26th September 2004, 01:05
Hello. Apparently there IS a problem w/ masktools v1.5.1 and HT enabled processors. Im using an Intel Pentium 4 800MHz FSB 3.2GHz Hyper-Threading Processor and w/ it on, the error message(pic) that LB posted is what you will get. With HT off however, the filter will load correctly. The DLL can be anywhere you want, just put the correct path in the avs and it should load. Hope this info will help some of you.

LB
27th September 2004, 03:23
@Incognito

Interesting. Thanks for the info. So I guess that means:

1. All 2xCPU P4 Intel rigs = 1.5.1 will not work irregardless of whether HT is on or off

2. All 1xCPU P4 Intel rigs = 1.5.1 will only work if HT is off

Manao
27th September 2004, 07:16
Alright, I compiled a version of MaskTools with a try / catch around the "AvisynthPluginInit2" function.

I don't know if it will help, but it's the only piece of code Avisynth should parse if you've got masktools.dll in your plugin directory but you don't use it.

Fetch it here : http://jourdan.madism.org/~manao/MaskTools-p4.dll

I hope it'll work.

IanB
27th September 2004, 10:04
Originally posted by Manao
Alright, I compiled a version of MaskTools with a try / catch around the "AvisynthPluginInit2" function.

I don't know if it will help, but it's the only piece of code Avisynth should parse if you've got masktools.dll in your plugin directory but you don't use it.

I hope it'll work.Manao,

I downloaded your 1.5.3 source and compiled it up in release mode with .asm listings. Your code looks okay as far as the missing code bug. I suspect the stuffed code is going to be downstream of env->AddFunction(...) and your just getting stung. The Try/Catch hack is just to force the compiler to emit the code it otherwise forgets about, it doesn't help if your code is not wrong.

As a diagnostic you might stick a messagebox in the catch code saying "Ah! I've been shot!" there should be no un-caught exceptions crossing the AddFunction(...) interface, so this should never get called.

I suspect something inside Avisynth is throwing some dumb exception like "Not Found" (lot's of these happen normally) and the Handler chain is GPF'ing with a comiler bug, that AccessViolation exception will chuck back all the way to Evaluate which Print's "Unrecognised Exception". If your lucky, if not the process screw itself and dies.

Also seeing this is a HT only problem it maybe an entirely new bug, unrelated to the one I am guessing about. Anybody got a spare HT ICE ???

IanB

ARDA
27th September 2004, 12:49
@Manao

I've just included your p4 version in my plugins directory and made
a simple teste with YV12Subtract.No problems at all in a pentium4
with HT enabled. I would like to see the solution you've found cause
I also have problem with kronos.dll that give nonsense results under
HT machines,maybe it is not the same problem but would like to take
a look.Thanks in advance

I hope this can be useful
ARDA

Manao
27th September 2004, 13:14
I did as IanB advised : Inside the AvisynthPluginInit2 function, I surrounded all the env->AddFunction(...) by try {} catch (...) {throw; }.

ARDA
27th September 2004, 17:22
Thank you I will see if that solves my problem
ARDA

LB
3rd October 2004, 01:08
@Manao

Thanks!!! Problem solved man! That new version did the trick! Many thanks!

Incognito
9th October 2004, 21:44
Hey guys. I got a problem w/ that dll thats suppose to work w/ HT on.. masktools-p4.dll. Now..if only i can figure out how to post images :confused: ..meh..guess i'll upload them to another site and link them.

**Deleted Image Links**


Anyone have any clues as to what could be going on?

[EDIT] The image posting didnt work so i had to hyperlink them instead..srry :(

[EDIT][EDIT] Well that didnt work either.. :mad:

LB
13th October 2004, 05:58
Well, pictures are not a big deal. Just tell us what the error message says. And if you are intent on posting pictures, try hosting on www.imageshack.us

No registration is needed. Just click browse, find your pic, and hit the post button. Takes less than 5s.

Incognito
13th October 2004, 16:00
ahh tnx for the site LB. now here's the pics:

original(masktools.dll)
http://img55.exs.cx/img55/2043/original_masktools.jpg

masktools-p4
http://img42.exs.cx/img42/3299/masktools-p4.jpg

really, i have no clue whats up with that. not all frames look like that however, just when doing some random scrolling in vdub i see it, and when i encode to a avi(using xvid) it shows the same way.

Manao
13th October 2004, 16:21
What was the script you used ? Don't forget that, by default, all filters of the masktools consider you don't care about chroma and discard that information ( meaning most of the time the chroma you get back is pure garbage ). Read the documentation ( http://jourdan.madism.org/~manao/MaskTools.htm ) for further details.

Incognito
13th October 2004, 21:52
would it matter what the script has to solve this problem? the way i see it, the script works. when using the original masktools.dll w/ HT disabled, the video looks just fine. Its when i switch HT back on and load the p4 version of masktools mentioned above by you rather than the regular one, that is when i get crap in the video. maybe i should try the p4 version w/ HT disabled just to see what would happen..

Manao
13th October 2004, 22:02
I changed a lot of things in the latest version of the MaskTools.

Especially, a lot of filters which were working in place aren't anymore ( because of an avisynth strangeness which was causing slowdowns ). Before, a filter such as YV12LUT, with U = V = 1, would have had it's chroma left untouched. Now, if you want to preserve the chroma, you have to specify U = V = 2, as it is said in the documentation.

It has nothing to do with the special P4 version ( anyway, the version you should take now is this one, it includes the P4 fix )

http://jourdan.madism.org/~manao/MaskTools-v1.5.4.zip

Incognito
14th October 2004, 01:33
mmkay, i'll give it a try. tnx

LB
17th October 2004, 11:40
@manao

Mmm, with the P4 version of 1.51 I ended up getting the same error (green screens) as Incognito did.

I tried the 1.54 version but it doesn't load; so it looks like there isn't a p4 fix in there. :(

Manao
17th October 2004, 11:48
Please, before saying it's an error, provide a script which shows the alledged error. A lot of people have been reporting green screen with the MaskTools, whereas it was a documented and wanted feature.

Now, for the PIV thing, the fix is still here. So I don't know what could have been wrong. IanB, do you have any insight on this ? Must I add try / catch in all my constructors ?

IanB
18th October 2004, 05:58
Originally posted by Manao
....
Now, for the PIV thing, the fix is still here. So I don't know what could have been wrong. IanB, do you have any insight on this ? Must I add try / catch in all my constructors ?

Manao,

The compiler bug is very sensitive. Typically when present, adding or deleting only a single char* p; declaration is enough to change the behaviour. Wrapping try { <stuff> } catch(...) { throw;} is some insurance against getting stung, I am not sure how good that insurance is but so far it seems to work.

Bidoche asserts the problem only occurs when smart pointers (avsvalue, pframe, etc) are used. He may be very correct but the assertion is currently unprovable. (10^10 examples of truth only need 1 example of false to fail a proof).

Another option is to disable optimization, debug versions of code NEVER seem to have the problem. For MMX/assembler GetFrame() implementations this is a low cost option.

IanB

Manao
18th October 2004, 06:34
I'll put try / catch every where around my code then. I won't release in debug, because there are filters not written is assembler. Thank you again, I hope it'll work.

Manao
18th October 2004, 20:40
Alright, two new attempts : I shuffle the code where that AddFunctions where made, I added another try / catch in the main class, and I change a little the compiler options. If somebody with a P4 with hyperthreading wants to test it :

http://jourdan.madism.org/~manao/MaskTools-p4-2.dll
http://jourdan.madism.org/~manao/MaskTools-p4-3.dll

LB
23rd October 2004, 23:57
P4-2 gives me an overall green screen with some stuff coming through, but for the most part the screen is all green (with vmtoon).

P4-3 gives me less of a green screen, but all the screens appear to have ghosts from other frames overlayed onto it.

Manao
24th October 2004, 00:01
They were meant to test the hyperthreading bug, they are strictly identical otherwise.

But of course, once more, if you use U = V = 1 ( which are defaults ), and that you still want the chroma, then you'll get total random garbage in the chroma channel, hence the difference.

By vmtoon, you meant in fact mftoon, don't you ? Which version was it ? If it was the latest, I'll contact mf asap to tell him to use correctly the U and V parameters.

Dreassica
25th October 2004, 13:10
is it me or do none of these links work anymore?

Manao
25th October 2004, 13:30
They'll work now. Thank you for reporting the error ( apache's configuration was broken by the admin )

Nicholi
6th November 2004, 02:52
A bit confused here on the whole 1.5.4 subject with chroma. Using the scripts I have now with 1.5.1 have no problems. Now using 1.5.4 however there are a few strange noticable chroma artifacts popping up.

Thus I have to force UV = 2 to keep everything the same as in 1.5.1 ? When I do this though I get the green effect described by Incognito, it only seems to come on/off every few frames. When I use UV = 1 however the script seems to run perfectly fine with no strange color artifacts as in 1.5.1. What values need to be correctly changed to mimic 1.5.1, for final verification ? I keep looking for the documentation you are pointing to, but the only thing I find is kurosu's 1.4.16 version. Which seems to say UV = 1 to keep everything the same? The u = v = 2 comment you made before just confused me.

Also I do not have a P4 with hyperthreading, however everyone I've heard back from (which do have HT and are whiny about turning it off, which does work to fix the problem) that I have pointed to your MaskTools-p4-2.dll and MaskTools-p4-3.dll versions, report a constant green effect on their screen as Incognito's picture. No matter what their UV settings are.

Manao
6th November 2004, 09:32
Nicholi : i re-checked all my filters. I had missed an error in Binarize, which hence had an erratic behavior only with y | u | v = 2.

But, y | u | v = 1 with that bugged filter has exactly the same effect.

Now, for the difference between 1 & 2 : # 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)Now, with 1, you'll always end up with garbage. 2 will copy the first ( i didn't recall having put a second there, my mistake ) video plane. The only exception is MaskedMerge, where 1 will copy the first video plane, and 2 the second ( though I don't like that, it could be avoid by inverting clips and inverting the mask, but i would have broken compatibility with too much scripts... ).

And now, for the p4 version. It's hard to believe that with the same dll, on an athlon, it works, and on a p4, it doesn't. Especially when you know that there are no processor specific instructions used. It's only a shuffling of the code, and some random try / catch in order the compiler not to produce a buggy dll.

So, well, if none bother to post a script which produces the error ( in order me to find what could go wrong ), i won't be able to do anything.

Anyway, back to the issue with binarize, I'll post later today a bugfix version. Meanwhile, can you tell me if binarize was involved in all the scripts which showed the chroma problem ? Because I checked all my filters, but then, I may have let another bug pass through.

@LB, Incognito & all : I've been rather harsch with your bug reports. I apologize ( since there indeed was a bug with binarize ), but next time, provide a script showing the bug, and if you're using a script made by somebody else, give at least a version number and a link to the script.

Manao
6th November 2004, 09:55
Version with binarize working :

http://jourdan.madism.org/~manao/MaskTools-v1.5.5.dll

Also, two new versions for p4 :

http://jourdan.madism.org/~manao/MaskTools-p4-4.dll
http://jourdan.madism.org/~manao/MaskTools-p4-5.dll

( If only the second works whereas the first doesn't, I kill myself )

Incognito
8th November 2004, 00:55
mmm..finally got some time to test. Manao, have soem bad news, but dont kill urself :p

MaskTools-p4-4.dll doesnt load w/ HT enabled. MaskTools-p4-5.dll however does. The strange thing is the entire video(approx. 55 mins.) is ok, but when I scroll to the credits(approx. 4 mins.), thats when the color starts to go screwy(green frames and ghosting). Like I said.. very strange. Thanks for all your hard work though. Keep trying :D

Manao
8th November 2004, 09:35
OK, then I now know a part of the problem. UPX ( which is used to reduce the size of the dll ) seems not to be working with exceptions, as they are handled in the .net scheme.

That explains, i think, the unability to load.

Incognito : can you provide the script you used ? Because if the version is running correctly for 55 minutes, i can't see how i couldn't for the last 4 ( well, in fact, there's a remote possibility that, were you lucky enough, the U & V planes are allocated right where the data they should have contained is, but somehow, i doubt it )

Incognito
8th November 2004, 16:26
Manao, I've been told the user "Nicholi" sent you a script. That script is the same one I'm using. Figured there's no point in sending the same thing twice.

Manao
8th November 2004, 16:40
He send me two scripts : one which merges the results of several deinterlacer, the second with uses mipsmooth & other filters. Which one was it ?

Mug Funky
10th November 2004, 07:56
2nd one works on this machine here (the P4 HT i was using the other day).

i didn't try the first one (i figured it may not work, and i needed a working masktools in a hurry).

i might try the first one when i've got a spare moment.

thanks heaps, i can now use avisynth on this machine :)

Nicholi
14th November 2004, 03:31
Just tested on my roommate's computer. The MaskTools-p4-4.dll version will not load, but MaskTools-p4-5.dll will. Hope this helps along the fix.

Socio
14th November 2004, 04:25
I can load the P4 3 dll and P4 5 dll but P4 4 will crash program I am using a P4 3.06 HT capable processor if that helps.