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 9th February 2007, 02:14   #441  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
Only if your hardware is 10 years old and improperly cooled, or your power supply is about to die.

Computers are designed to be able to run at full utilization for a full year straight if necessary, pushing it hard for 12 hours can't hurt it, and can't even crash it if it's properly cooled.
foxyshadis is offline   Reply With Quote
Old 11th February 2007, 07:41   #442  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
@tsp
Is the source code for your version of avisynth available? or just diffs from the cvs code? I got a chance to test Merlin7777's script using debug builds of Decomb, Colormatrix, and AddGrainC, along with your 2.5.7.3 avisynth.dll and 4 out of 5 times the script stopped on an access violation several calls deep in avisynth.dll. 1 time it stopped in Decimate::FindDupicate() because the data pointer of one of the pvideoframe object's videoframe pointer's vfb pointer was null causing an access violation when decimate tried to use the pointer it was returned by ->GetReadPtr().
tritical is offline   Reply With Quote
Old 11th February 2007, 11:21   #443  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
tritical: the sourcecode is available here. It includes a vs 2003 solution.
I also encountered the bug with decimate calling env->bltbit with a null pointer as the dst pointer.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 11th February 2007, 17:25   #444  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
Tsp, is there a way to TOTALLY shut off SetMTMode in parts of script? I was testing this following basic script using Tritical's TWriteAvi and i keep getting a file exists error which appears to coming from 2 threads of TWriteAvi each trying to create/open/write to "C:\test.avi" (work fine when i do not use MT)

Very basic failing example:

SetMTMode(5)
mpeg2source("D:\AutoEncode\part1\part1.d2v",cpu=0) #source input is 1080i
SetMTMode(2)
Lanczos4Resize(624,352)
SetMTMode(5)
TWriteAvi(fname="C:\test.avi",overwrite=true,showAll=true)


tsp i thought you once said there was a SetMTMode(0) for that but i can't find the thread. (Maybe i dreamt it haha)


Thanks
Zep is offline   Reply With Quote
Old 11th February 2007, 22:10   #445  |  Link
jeffy
Registered User
 
Join Date: Jan 2007
Posts: 943
No SetMTMode(0)

Quote:
Originally Posted by Zep View Post
tsp i thought you once said there was a SetMTMode(0) for that but i can't find the thread. (Maybe i dreamt it haha)
Thanks
More reading here:
http://forum.doom9.org/showthread.php?t=94996&page=15
http://forum.doom9.org/showthread.ph...583#post812583
jeffy is offline   Reply With Quote
Old 11th February 2007, 23:31   #446  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Zep: mode=0 is set when setmtmode is not used. It can not be set. Mode 5 should only create one instance if the filter(TWriteAvi).
If you only wants to use multithreading to resize the video use mt() instead:
Code:
mpeg2source("D:\AutoEncode\part1\part1.d2v",cpu=0)
mt("Lanczos4Resize(624,last.height())",splitvertical=false)
mt("Lanczos4Resize(last.width(),352)",splitvertical=true)
TWriteAvi(fname="C:\test.avi",overwrite=true,showAll=true)
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 12th February 2007, 04:43   #447  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
Thanks for the source. I haven't been able to figure anything out except that (on this comp at least) it is definitely a problem with filters having pvideoframes with references to vfbs with null data pointers and datasize=0... which seems to indicate that those vfbs had their destructor code run by i->~LinkedVideoFrameBuffer() in ScriptEnvironment::GetFrameBuffer2().
tritical is offline   Reply With Quote
Old 12th February 2007, 11:59   #448  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
tritical: It suggest that the refcounting somewhere is messed up. If the refcount only temporarily goes down to 0 in a filter and increase to 1 before the filter return it would only appears as an error when running with more than 1 thread.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 13th February 2007, 02:53   #449  |  Link
Spuds
dumber every day
 
Spuds's Avatar
 
Join Date: Dec 2006
Location: Planet Earth
Posts: 154
I have been using 0.5 with good success. I upgraded the avisynth and mt dll's to the new 0.6 version and began to experience some problems.

Using just a simple script of setting mt mode=2 and opening an avi file (vhs capture, about 1hr long) with no processing. I then opened that in virtualdub and the playback has cracking in the audio and some single frames are fully pixelated with random colored blocks. I backed out to 0.5 and opened the same script with no issues. Anyone else experience problems?
Spuds is offline   Reply With Quote
Old 13th February 2007, 08:14   #450  |  Link
tritical
Registered User
 
Join Date: Dec 2003
Location: MO, US
Posts: 999
When I was testing I did stick an _ASSERTE(vfb->refcount>0) inside VideoFrame::AddRef(), and also changed

if (InterlockedCompareExchange((long*)&i->refcount,1,0)==0)

to

if (InterlockedCompareExchange((long*)&i->refcount,0,0)==0)

in GetBuffer2() so that the refcount would stay 0 on those. The assert triggered once, but I wasn't able to figure out the sequence of events that lead to it happening. The call stack pointed back through PVideoFrame::Init() and PVideoFrame::PVideoFrame(VideoFrame* x) to this line in cacheMT.cpp:

PVideoFrame retval=BuildVideoFrame(i, n); // Success!

Unfortunately, I don't have access to that comp right now so can't do anymore testing until my comp is free.
tritical is offline   Reply With Quote
Old 13th February 2007, 09:27   #451  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
yeah my memory is shot forgot about some of that. thx
Zep is offline   Reply With Quote
Old 13th February 2007, 09:32   #452  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
Quote:
Originally Posted by tsp View Post
Zep: mode=0 is set when setmtmode is not used. It can not be set. Mode 5 should only create one instance if the filter(TWriteAvi).
If you only wants to use multithreading to resize the video use mt() instead:
Code:
mpeg2source("D:\AutoEncode\part1\part1.d2v",cpu=0)
mt("Lanczos4Resize(624,last.height())",splitvertical=false)
mt("Lanczos4Resize(last.width(),352)",splitvertical=true)
TWriteAvi(fname="C:\test.avi",overwrite=true,showAll=true)

ok will do. I sorta thought i would have to use MT() but sometimes my triple and quad quoting doesn't work haha and why i like to stick to set SetMTMode() whenever i can

will give it a go

thx
Zep is offline   Reply With Quote
Old 14th February 2007, 14:51   #453  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
Quote:
Originally Posted by tsp View Post
Zep: mode=0 is set when setmtmode is not used. It can not be set. Mode 5 should only create one instance if the filter(TWriteAvi).
If you only wants to use multithreading to resize the video use mt() instead:
Code:
mpeg2source("D:\AutoEncode\part1\part1.d2v",cpu=0)
mt("Lanczos4Resize(624,last.height())",splitvertical=false)mt("Lanczos4Resize(last.width(),352)",splitvertical=true)
TWriteAvi(fname="C:\test.avi",overwrite=true,showAll=true)
Having fun testing out all this stuff

I ran into a few problems though. Most of the following comes from me wanting to only MT certain functions and not MT the whole script with SetMTmode() since some of the filters i use are slower with setMTmode(5) or (6) than no MT at all and if i try to go 2 they crash and if 3 or 4 are really slow. Anyway...


1) I get an access violation error every time i try to do
mt("Decimate(cycle=5,quality=0)")
Any idea if the bug is in MT or Decimate?

I wonder because
SetMTMode(2)
Decimate(cycle=5,quality=0)

seems to works fine


2) for the life of me i can't figure out the syntax for
mt("mpeg2source("D:\whatever.d2v",cpu=0)")

I have tried triple quotes with no luck
mt(""" mpeg2source("D:\whatever.d2v",cpu=0) """)

any ideas on getting that to work?


3) 2.6 alpha with built in setMTmode() is faster for me by a rather large amount (about 25%) than the 2.5.7 MT 0.6 package. Any idea as to why that could be?


4) when using setMTmode() is there a way to set splitvertical to either true or false? Does it internally always use false?


5) Some filters work with setMTmode() but not with MT() or vise versa. Are there some basic differences we should know about between the two methods?

6) using as example Lanczos4Resize() with MT() is MUCH faster then using it in setMTmode() run. Not only that but CPU usage goes through the roof as well without any speed gain over the MT() way even when i do something like this

SetMTMode(2)
Lanczos4Resize(960,last.height())
Lanczos4Resize(last.width(),528)


oh i think i will stop for now

Thanks for such a wonderful tool!
Zep is offline   Reply With Quote
Old 14th February 2007, 17:33   #454  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Finland
Posts: 5,718
Quote:
Originally Posted by Zep View Post
2) for the life of me i can't figure out the syntax for
mt("mpeg2source("D:\whatever.d2v",cpu=0)")

I have tried triple quotes with no luck
mt(""" mpeg2source("D:\whatever.d2v",cpu=0) """)
Have you tried MT("""MPEG2Source("path\clip.d2v")""") , that is, without any extra spaces?

In SetMTMode a thread requests the whole frame so no need to split in vertical or horizontal direction. MT requests one frame and splits it in two halves.
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 14th February 2007, 17:48   #455  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,558
2) Since mt() splits the input in pieces, that can't work, it's not smart enough to figure out when a source shows up; if it did, it'd probably give you two copies of the source stacked. All the multithreading comes from being able to split the input.

5) The basic difference is that mt() splits and sends both pieces of the frame to two copies of each filter, while setmtmode() says "give me 3, oh and run 4 while you're at it" on the assumption that the next frame is probably going to be needed, without splitting anything. I have no idea how smart the frame decision part is though. Some mt modes will try to use the same copy of the filter, some will create new ones. (That should explain why #4 isn't needed.)

The rest of the answers are buried in the code somewhere, I only know the basics. ;_;
foxyshadis is offline   Reply With Quote
Old 14th February 2007, 22:16   #456  |  Link
tsp
Registered User
 
tsp's Avatar
 
Join Date: Aug 2004
Location: Denmark
Posts: 807
Quote:
Originally Posted by Zep View Post
Having fun testing out all this stuff

1) I get an access violation error every time i try to do
mt("Decimate(cycle=5,quality=0)")
Any idea if the bug is in MT or Decimate?

I wonder because
SetMTMode(2)
Decimate(cycle=5,quality=0)

seems to works fine

2) for the life of me i can't figure out the syntax for
mt("mpeg2source("D:\whatever.d2v",cpu=0)")

I have tried triple quotes with no luck
mt(""" mpeg2source("D:\whatever.d2v",cpu=0) """)

any ideas on getting that to work?
mt only works with filters taking 1 clip as a input (luckily most filters does that. But mpeg2source, avisource, DirectShowSource doesn't take a input clip so they wouldn't work. Also see foxyshadis explanation.

Quote:
Originally Posted by Zep View Post
3) 2.6 alpha with built in setMTmode() is faster for me by a rather large amount (about 25%) than the 2.5.7 MT 0.6 package. Any idea as to why that could be?
I added some more thread synchronization to the 2.5.7 version to fix some crashes. This will case more waiting for each thread and thereby reducing performance. What script exactly do you experience this with?

Quote:
Originally Posted by Zep View Post
4) when using setMTmode() is there a way to set splitvertical to either true or false? Does it internally always use false?


5) Some filters work with setMTmode() but not with MT() or vise versa. Are there some basic differences we should know about between the two methods?
See foxyshadis explanation.

Quote:
Originally Posted by Zep View Post
6) using as example Lanczos4Resize() with MT() is MUCH faster then using it in setMTmode() run. Not only that but CPU usage goes through the roof as well without any speed gain over the MT() way even when i do something like this

SetMTMode(2)
Lanczos4Resize(960,last.height())
Lanczos4Resize(last.width(),528)
Well MT uses a more simple method so for filters that doesn't need information about the complete frame it should be used instead of SetMTMode (unfortunately Setmtmode and MT() doesn't mix very well in the same script). I will try to improve the performance with setmtmode but unfortunately I don't have unlimited time to do that

oh i think i will stop for now

Thanks for such a wonderful tool![/QUOTE]

Quote:
Originally Posted by foxyshadis
I have no idea how smart the frame decision part is though.
A special filter is inserted at the end of the script and before each Setmtmode(5) and 6 that calculates the difference between the current and the last frame and add it to the current frame to see what frame to request next. No very intelligent but works fine if mode=5 or =6 is not used as most application that opens the avisynth script request the frame in linear order.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/
tsp is offline   Reply With Quote
Old 16th February 2007, 03:57   #457  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
Quote:
Originally Posted by foxyshadis View Post
2) Since mt() splits the input in pieces, that can't work, it's not smart enough to figure out when a source shows up; if it did, it'd probably give you two copies of the source stacked. All the multithreading comes from being able to split the input.
interesting.

Quote:
Originally Posted by foxyshadis View Post
5) The basic difference is that mt() splits and sends both pieces of the frame to two copies of each filter, while setmtmode() says "give me 3, oh and run 4 while you're at it" on the assumption that the next frame is probably going to be needed, without splitting anything. I have no idea how smart the frame decision part is though. Some mt modes will try to use the same copy of the filter, some will create new ones. (That should explain why #4 isn't needed.)
After reading your post I can see why MT() is faster on my resize example.
Zep is offline   Reply With Quote
Old 16th February 2007, 04:02   #458  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
Quote:
Originally Posted by Boulder View Post
Have you tried MT("""MPEG2Source("path\clip.d2v")""") , that is, without any extra spaces?
yes i did and it does not work but tsp explained why above

Quote:
Originally Posted by Boulder View Post
In SetMTMode a thread requests the whole frame so no need to split in vertical or horizontal direction. MT requests one frame and splits it in two halves.


ahhh and now i see why resize works fine in setmtmode without having to worry about changing both width and height at the same time unlike MT()
Zep is offline   Reply With Quote
Old 16th February 2007, 04:15   #459  |  Link
Zep
Registered User
 
Join Date: Jul 2002
Posts: 587
Quote:
Originally Posted by tsp View Post
mt only works with filters taking 1 clip as a input (luckily most filters does that. But mpeg2source, avisource, DirectShowSource doesn't take a input clip so they wouldn't work. Also see foxyshadis explanation.
ahh right I should have realized that on my own.

Quote:
Originally Posted by tsp View Post
I added some more thread synchronization to the 2.5.7 version to fix some crashes. This will case more waiting for each thread and thereby reducing performance. What script exactly do you experience this with?
all scripts the 2.6 alpha that wilbert compiled is faster
than all other version i have tried by a good amount.


Quote:
Originally Posted by tsp View Post
Well MT uses a more simple method so for filters that doesn't need information about the complete frame it should be used instead of SetMTMode (unfortunately Setmtmode and MT() doesn't mix very well in the same script). I will try to improve the performance with setmtmode but unfortunately I don't have unlimited time to do that
well in the 2.6alpha i use the latest MT plug-in from the 0.6 package with it and using the methods together so far has worked very well.

example being

setmtmode(3)
mpeg2source*
mt("Lanczos4Resize(960,last.height())",splitvertical=false)
mt("Lanczos4Resize(last.width(),528)",splitvertical=true)

note mode 3 is faster than mode 2 for mpeg2source which i find interesting. mode 2 puts that filter into a roller coaster ride but mode 3 speeds it up some and keeps it at a steady rate on my box anyway

thx!
Zep is offline   Reply With Quote
Old 16th February 2007, 04:34   #460  |  Link
BigDid
Actually in reserve
 
Join Date: Oct 2004
Posts: 1,605
Quote:
Originally Posted by Zep View Post
...all scripts the 2.6 alpha that wilbert compiled is faster
than all other version i have tried by a good amount.
Hi,

Could you give a link to the Wilbert 2.6 alpha cause I can see only the 2.6 pre-alpha like here http://forum.doom9.org/showthread.ph...298#post862298
or here
http://forum.doom9.org/showthread.ph...359#post841359

Thanks

Did
__________________
Having a problem with AutoGK? Read & use the FAQ & MORE FAQ first
Want to exchange on AutoGK? try doom10.org
In reserve (inactive) for an undefined period of time.
BigDid 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 22:26.


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