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. |
|
|
Thread Tools | Search this Thread | Display Modes |
1st December 2005, 17:37 | #142 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
Badness: It seems to depend on the script you plane to use. Some (Koroshiya) did experience faster encoder while others (lcksg) had slower encoding.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
2nd December 2005, 20:01 | #143 | Link |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
tsp,
Can I trouble you with another abstract question? I'm planning a filter that needs intermediary working space (i.e. a big array or VideoFrame) in each GetFrame call. If two GetFrames are called simultaneously, they each need their own working space, *not* shared. So far so good, except that I don't want to allocate/deallocate every GetFrame call, since there are no guarantees on the allocation speed. Apart from the intermediate space, everything is fully parallel-friendly, so I would like to find a similarly parallel-friendly way of providing intermediate space. The best way I can think of to deal with this is to have a pool of appropriately sized arrays -- i.e., effectively to build a custom allocator that is called in every GetFrame... but then the allocator might be called twice simultaneously. Any advice on a clean way to go? Should I try and put some kind of lock on the allocator,* or should I just leave it for MT(mode = 2) to deal with or is there a simpler solution? *which will presumably affect portability. It's going to be a while before I try building something like this, so there really is no hurry to answer the question. (It's not terribly important anyway... but I would much rather build things to be parallel-friendly where possible.) Thanks, M.
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed. Last edited by mg262; 2nd December 2005 at 20:09. |
2nd December 2005, 22:18 | #144 | Link | |
Registered User
Join Date: Mar 2005
Location: Pleven, Bulgaria, Europe.
Posts: 45
|
OMG I'm so tired, I can't think straight. Someone tell me why this syntax doesn't work please ?
Quote:
|
|
2nd December 2005, 22:29 | #145 | Link | |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
mg262:
with mode=2 there will never be two GetFrame calls to the same filter instance as there are as many filter instances as there are threads. So it should be safe to allocate the working space in the constructor and release it in the destructor. If you wanted to share some variables between the different instances of your filter you would need to use the PClipLocalStorage in avisynth 2.6. Quote:
Code:
MT(""" ffdshow("default") """)
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ Last edited by tsp; 2nd December 2005 at 23:15. |
|
2nd December 2005, 22:59 | #146 | Link |
Registered User
Join Date: Mar 2005
Location: Pleven, Bulgaria, Europe.
Posts: 45
|
Yay it worked! Thankz!
PS Although it didn't do any changes. Speed is exactly the same. Second core doesn't seem to work according to EVEREST (benchmark app). I've got a P4 HT @ 3000 GHz. Last edited by AssassiNBG; 2nd December 2005 at 23:05. |
3rd December 2005, 03:55 | #147 | Link |
Registered User
Join Date: Sep 2004
Location: Near LA, California, USA
Posts: 1,545
|
hmm...interesting.
I used to use this in order to get it to work. d="default" MT("ffdshow(d)")
__________________
Pirate: Now how would you like to die? Would you like to have your head chopped off or be burned at the stake? Curly: Burned at the stake! Moe: Why? Curly: A hot steak is always better than a cold chop. |
3rd December 2005, 11:16 | #149 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
try seing how many cores windows task manager shows if the total cpu utilization is already 100% before running MT() when you will not gain much by running it.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
3rd December 2005, 14:47 | #151 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
it might be because ffdshow avisynth filter doesn't support multithreading. I will try to figure out.
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
3rd December 2005, 14:58 | #152 | Link | |
Clouded
Join Date: Jul 2003
Location: Cambridge, UK
Posts: 1,148
|
Quote:
__________________
a.k.a. Clouded. Come and help by making sure your favourite AVISynth filters and scripts are listed. |
|
5th December 2005, 20:55 | #153 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
Here is an exsample on how the PClipLocalStorage can be used to share a cache between multiple instances(that are created with mode=2,4):
Code:
class Cache { public: //These function should be threadsafe. The most simple way is to use a //critical section like this PVideoFrame GetCachedFrame(int framenumber) { EnterCriticalSection(&cs); //Code //... LeaveCriticalSection(&cs); return retval; } SetCachedFrame(PVideoFrame frame); private: CRITICAL_SECTION cs; } class Sample : public GenericVideoFilter{ public: Sample(PClip _child, IScriptEnvironment* env); ~Sample(); PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env); protected: PClipLocalStorage cls; Cache* FrameCache; } Sample::Sample(PClip _child, IScriptEnvironment* env) : GenericVideoFilter(_child),cls(env) { //if the cache has not been created yet GetValue will return 0 if(cls->GetValue()==0) { //create the cache and save the address in the PClipLocalStorage FrameCache = new Cache(); cls->SetValue(static_cast<void*>(FrameCache)); } // The cache has been created so assign the address to FrameCache else { FrameCache=static_cast<cache*>(cls->GetValue()); } } Sample::~Sample() { //only delete FrameCache if it is not delete yet. if(cls->GetValue()!=0) { delete FrameCache; cls->SetValue(0);//Signal that the cache is deleted } }
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
6th December 2005, 02:45 | #154 | Link | |
Registered User
Join Date: Sep 2004
Posts: 113
|
Quote:
the weirdest thing... i have the same problem: if i don't set mtmode in the script, it encodes at a certain speed. if i use any of the mtmodes, cpu will go to 100% but encoding speed is reduced to half in some of the mt modes ! so from the testing i've done it appears that using mt mode actually worsens instead of speed up which really doesn't make any sense. i've placed the avisynth with mt-included dll from TSP's website in system32. my spec is dual xeon 3.2ghz with 1gb ram. my script is as follows: Code:
# PLUGINS LoadPlugin("D:\TBS\Filters\Decomb521.dll") LoadPlugin("D:\TBS\Filters\DGDecode.dll") LoadPlugin("D:\TBS\Filters\UnDot.dll") LoadPlugin("D:\TBS\Filters\MSharpen.dll") LoadPlugin("D:\TBS\Filters\RemoveGrainSSE3.dll") SetMTMode(2,2) mpeg2source("F:\hd_capture.d2v",idct=3) SelectEven() trim(5017, 6815) Crop(162,4,-164,-4) undot() BicubicResize(512,384,0,0.75) |
|
6th December 2005, 11:29 | #155 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
shpitz: No not really. Might try SetMTMode(2) instead but I don't think it will improve it. You could try to but some of the more cpu demanding filters in like limitedSharpen or vaguedenoise because it seems to be very dependent on what script is used. Rather strange with these dual Xeon. Could anyone with an Athlon X2 test if they got the same problem with the above script?
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
6th December 2005, 14:54 | #156 | Link | |
Registered User
Join Date: May 2004
Posts: 288
|
Quote:
|
|
6th December 2005, 14:57 | #157 | Link |
Registered User
Join Date: Sep 2004
Posts: 113
|
thanks for the reply TSP.
the really weird thing about all this thing is the fact that the cpu usage goes up while the encoding speed goes down. it's like it is going up-hill, more power is needed yet the climbing rate is getting slower and slower, it is really bizarre. what really gets me is the fact that during an encode, cpu usage is around 40%, no more, no less. and this gives me the feeling the pc is not used to its whole potential... i could run 2 instances of vdub and encode 2 clips at the same time, but still the encoding speed of 1 will affect the other, so 2 instances doesn't really mean double the speed. so all i want is to maximize the speed of 1 single encoding session. |
6th December 2005, 14:57 | #158 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
not if he only uses SetMTMode because that is included in the modified avisynth.dll
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
6th December 2005, 14:59 | #159 | Link | |
Registered User
Join Date: Sep 2004
Posts: 113
|
Quote:
thanks |
|
6th December 2005, 15:13 | #160 | Link |
Registered User
Join Date: Aug 2004
Location: Denmark
Posts: 807
|
well all the information about the modified avisynth.dll is scattered around in this thread. Some day I really should sit down and write some proper documentation for this.
Basicly SetmtMode change the script parser and the internal cache so that more than one frame can be processed at a time. To do this I had to modify avisynth so that is the reason why it's not included in mt.dll. Mt on the other hand split the frame up in smaller pieces and run each piece on a different thread/processor. This can be done with a plugin allthough it works best with the modfied dll. For more information try reading the whole thread (or just my post ). The strange thing as you said is that it runs slower while using 100% cpu time. There are of cource an overhead by running avisynth multithreaded but not that high. Maybe running all these instances pollutes the cache? Does it makes any difference to disable HT?
__________________
Get my avisynth filters @ http://www.avisynth.org/tsp/ |
|
|